From f97e87d30ffd158894bab07c2080f4446f14388b Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 27 May 2026 06:18:27 +0000 Subject: [PATCH 1/2] feat: A new field `target_instance_settings` is added to message `.google.cloud.sql.v1.PointInTimeRestoreContext` feat: A new field `target_instance_clear_settings_field_names` is added to message `.google.cloud.sql.v1.PointInTimeRestoreContext` feat: A new field `region` is added to message `.google.cloud.sql.v1.PointInTimeRestoreContext` feat: A new value `PROJECT_ABUSE` is added to enum `SqlSuspensionReason` feat: A new field `psc_auto_dns_enabled` is added to message `.google.cloud.sql.v1.PscConfig` feat: A new field `psc_write_endpoint_dns_enabled` is added to message `.google.cloud.sql.v1.PscConfig` feat: A new value `PRE_CHECK_MAJOR_VERSION_UPGRADE` is added to enum `SqlOperationType` feat: A new field `accelerated_replica_mode` is added to message `.google.cloud.sql.v1.Settings` feat: A new value `POSTGRES_19` is added to enum `SqlDatabaseVersion` feat: A new value `SQLSERVER_2025_STANDARD` is added to enum `SqlDatabaseVersion` feat: A new value `SQLSERVER_2025_ENTERPRISE` is added to enum `SqlDatabaseVersion` feat: A new value `SQLSERVER_2025_EXPRESS` is added to enum `SqlDatabaseVersion` docs: A comment for field `project` in message `.google.cloud.sql.v1.SqlInstancesCloneRequest` is changed docs: A comment for field `auto_iam_authn` in message `.google.cloud.sql.v1.ExecuteSqlPayload` is changed docs: A comment for field `consumer_project` in message `.google.cloud.sql.v1.PscAutoConnectionConfig` is changed docs: A comment for message `PerformanceCaptureConfig` is changed docs: A comment for field `enabled` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed docs: A comment for field `probing_interval_seconds` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed docs: A comment for field `probe_threshold` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed docs: A comment for field `running_threads_threshold` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed docs: A comment for field `seconds_behind_source_threshold` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed docs: A comment for field `transaction_duration_threshold` in message `.google.cloud.sql.v1.PerformanceCaptureConfig` is changed PiperOrigin-RevId: 921857990 Source-Link: https://github.com/googleapis/googleapis/commit/06fde4541dbd2c110e359703e400c394bb24cc5e Source-Link: https://github.com/googleapis/googleapis-gen/commit/6c6337a7d993487d86994b440bd4cfbcf16fc079 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNxbC8uT3dsQm90LnlhbWwiLCJoIjoiNmM2MzM3YTdkOTkzNDg3ZDg2OTk0YjQ0MGJkNGNmYmNmMTZmYzA3OSJ9 --- .../google-cloud-sql/.eslintignore | 7 + .../google-cloud-sql/.eslintrc.json | 4 + owl-bot-staging/google-cloud-sql/.gitignore | 14 + owl-bot-staging/google-cloud-sql/.jsdoc.js | 55 + owl-bot-staging/google-cloud-sql/.mocharc.js | 33 + owl-bot-staging/google-cloud-sql/.nycrc | 24 + owl-bot-staging/google-cloud-sql/README.md | 263 + ...loud_sql_available_database_versions.proto | 33 + .../cloud/sql/v1/cloud_sql_backup_runs.proto | 270 + .../cloud/sql/v1/cloud_sql_backups.proto | 327 + .../cloud/sql/v1/cloud_sql_connect.proto | 216 + .../cloud/sql/v1/cloud_sql_databases.proto | 152 + .../cloud/sql/v1/cloud_sql_events.proto | 33 + .../v1/cloud_sql_feature_eligibility.proto | 31 + .../google/cloud/sql/v1/cloud_sql_flags.proto | 161 + .../cloud/sql/v1/cloud_sql_iam_policies.proto | 30 + .../sql/v1/cloud_sql_instance_names.proto | 31 + .../cloud/sql/v1/cloud_sql_instances.proto | 2530 + .../cloud/sql/v1/cloud_sql_operations.proto | 105 + .../cloud/sql/v1/cloud_sql_regions.proto | 33 + .../cloud/sql/v1/cloud_sql_resources.proto | 2388 + .../cloud/sql/v1/cloud_sql_ssl_certs.proto | 141 + .../google/cloud/sql/v1/cloud_sql_tiers.proto | 76 + .../google/cloud/sql/v1/cloud_sql_users.proto | 313 + .../google/cloud/sql/v1beta4/cloud_sql.proto | 1739 + .../cloud/sql/v1beta4/cloud_sql_connect.proto | 217 + .../sql/v1beta4/cloud_sql_iam_policies.proto | 30 + .../sql/v1beta4/cloud_sql_resources.proto | 4074 + .../cloud/sql/v1beta4/cloud_sql_tiers.proto | 74 + .../cloud/sql/v1beta4/cloud_sql_users.proto | 311 + .../google-cloud-sql/protos/protos.d.ts | 63446 ++++++ .../google-cloud-sql/protos/protos.js | 167547 +++++++++++++++ .../google-cloud-sql/protos/protos.json | 18221 ++ .../snippet_metadata_google.cloud.sql.v1.json | 3567 + .../v1/sql_backup_runs_service.delete.js | 70 + .../v1/sql_backup_runs_service.get.js | 68 + .../v1/sql_backup_runs_service.insert.js | 67 + .../v1/sql_backup_runs_service.list.js | 74 + .../v1/sql_backups_service.create_backup.js | 67 + .../v1/sql_backups_service.delete_backup.js | 62 + .../v1/sql_backups_service.get_backup.js | 62 + .../v1/sql_backups_service.list_backups.js | 86 + .../v1/sql_backups_service.update_backup.js | 68 + ...connect_service.generate_ephemeral_cert.js | 81 + ...ql_connect_service.get_connect_settings.js | 69 + .../v1/sql_databases_service.delete.js | 68 + .../generated/v1/sql_databases_service.get.js | 68 + .../v1/sql_databases_service.insert.js | 67 + .../v1/sql_databases_service.list.js | 64 + .../v1/sql_databases_service.patch.js | 71 + .../v1/sql_databases_service.update.js | 71 + .../generated/v1/sql_flags_service.list.js | 66 + ...ql_instances_service.acquire_ssrs_lease.js | 75 + ...tances_service.add_entra_id_certificate.js | 66 + .../v1/sql_instances_service.add_server_ca.js | 64 + ...nstances_service.add_server_certificate.js | 64 + .../v1/sql_instances_service.clone.js | 71 + .../sql_instances_service.create_ephemeral.js | 67 + .../v1/sql_instances_service.delete.js | 81 + .../v1/sql_instances_service.demote.js | 71 + .../v1/sql_instances_service.demote_master.js | 67 + .../v1/sql_instances_service.execute_sql.js | 70 + .../v1/sql_instances_service.export.js | 67 + .../v1/sql_instances_service.failover.js | 67 + .../generated/v1/sql_instances_service.get.js | 66 + ...nstances_service.get_disk_shrink_config.js | 64 + ...tances_service.get_latest_recovery_time.js | 69 + .../v1/sql_instances_service.import.js | 67 + .../v1/sql_instances_service.insert.js | 64 + .../v1/sql_instances_service.list.js | 83 + ...nces_service.list_entra_id_certificates.js | 66 + .../sql_instances_service.list_server_cas.js | 64 + ...tances_service.list_server_certificates.js | 66 + .../v1/sql_instances_service.patch.js | 67 + ...l_instances_service.perform_disk_shrink.js | 68 + ...instances_service.point_in_time_restore.js | 68 + ...service.pre_check_major_version_upgrade.js | 72 + .../sql_instances_service.promote_replica.js | 73 + .../v1/sql_instances_service.reencrypt.js | 68 + ...ql_instances_service.release_ssrs_lease.js | 69 + ...nstances_service.reschedule_maintenance.js | 67 + ...ql_instances_service.reset_replica_size.js | 64 + .../sql_instances_service.reset_ssl_config.js | 68 + .../v1/sql_instances_service.restart.js | 64 + .../sql_instances_service.restore_backup.js | 67 + ...ces_service.rotate_entra_id_certificate.js | 70 + .../sql_instances_service.rotate_server_ca.js | 67 + ...ances_service.rotate_server_certificate.js | 70 + ...l_instances_service.start_external_sync.js | 94 + .../v1/sql_instances_service.start_replica.js | 64 + .../v1/sql_instances_service.stop_replica.js | 64 + .../v1/sql_instances_service.switchover.js | 70 + .../v1/sql_instances_service.truncate_log.js | 67 + .../v1/sql_instances_service.update.js | 67 + ...s_service.verify_external_sync_settings.js | 96 + .../v1/sql_operations_service.cancel.js | 64 + .../v1/sql_operations_service.get.js | 66 + .../v1/sql_operations_service.list.js | 73 + .../v1/sql_ssl_certs_service.delete.js | 68 + .../generated/v1/sql_ssl_certs_service.get.js | 68 + .../v1/sql_ssl_certs_service.insert.js | 67 + .../v1/sql_ssl_certs_service.list.js | 64 + .../generated/v1/sql_tiers_service.list.js | 60 + .../generated/v1/sql_users_service.delete.js | 72 + .../generated/v1/sql_users_service.get.js | 72 + .../generated/v1/sql_users_service.insert.js | 67 + .../generated/v1/sql_users_service.list.js | 64 + .../generated/v1/sql_users_service.update.js | 86 + ...pet_metadata_google.cloud.sql.v1beta4.json | 3567 + .../v1beta4/sql_backup_runs_service.delete.js | 70 + .../v1beta4/sql_backup_runs_service.get.js | 68 + .../v1beta4/sql_backup_runs_service.insert.js | 67 + .../v1beta4/sql_backup_runs_service.list.js | 74 + .../sql_backups_service.create_backup.js | 67 + .../sql_backups_service.delete_backup.js | 62 + .../v1beta4/sql_backups_service.get_backup.js | 62 + .../sql_backups_service.list_backups.js | 86 + .../sql_backups_service.update_backup.js | 68 + ...connect_service.generate_ephemeral_cert.js | 81 + ...ql_connect_service.get_connect_settings.js | 69 + .../v1beta4/sql_databases_service.delete.js | 68 + .../v1beta4/sql_databases_service.get.js | 68 + .../v1beta4/sql_databases_service.insert.js | 67 + .../v1beta4/sql_databases_service.list.js | 64 + .../v1beta4/sql_databases_service.patch.js | 71 + .../v1beta4/sql_databases_service.update.js | 71 + .../v1beta4/sql_flags_service.list.js | 66 + ...ql_instances_service.acquire_ssrs_lease.js | 74 + ...tances_service.add_entra_id_certificate.js | 66 + .../sql_instances_service.add_server_ca.js | 64 + ...nstances_service.add_server_certificate.js | 66 + .../v1beta4/sql_instances_service.clone.js | 68 + .../sql_instances_service.create_ephemeral.js | 67 + .../v1beta4/sql_instances_service.delete.js | 81 + .../v1beta4/sql_instances_service.demote.js | 70 + .../sql_instances_service.demote_master.js | 67 + .../sql_instances_service.execute_sql.js | 70 + .../v1beta4/sql_instances_service.export.js | 67 + .../v1beta4/sql_instances_service.failover.js | 67 + .../v1beta4/sql_instances_service.get.js | 64 + ...nstances_service.get_disk_shrink_config.js | 64 + ...tances_service.get_latest_recovery_time.js | 69 + .../v1beta4/sql_instances_service.import.js | 67 + .../v1beta4/sql_instances_service.insert.js | 64 + .../v1beta4/sql_instances_service.list.js | 83 + ...nces_service.list_entra_id_certificates.js | 66 + .../sql_instances_service.list_server_cas.js | 64 + ...tances_service.list_server_certificates.js | 66 + .../v1beta4/sql_instances_service.patch.js | 67 + ...l_instances_service.perform_disk_shrink.js | 68 + ...instances_service.point_in_time_restore.js | 68 + ...service.pre_check_major_version_upgrade.js | 72 + .../sql_instances_service.promote_replica.js | 73 + .../sql_instances_service.reencrypt.js | 68 + ...ql_instances_service.release_ssrs_lease.js | 70 + ...nstances_service.reschedule_maintenance.js | 67 + ...ql_instances_service.reset_replica_size.js | 64 + .../sql_instances_service.reset_ssl_config.js | 68 + .../v1beta4/sql_instances_service.restart.js | 64 + .../sql_instances_service.restore_backup.js | 67 + ...ces_service.rotate_entra_id_certificate.js | 71 + .../sql_instances_service.rotate_server_ca.js | 67 + ...ances_service.rotate_server_certificate.js | 71 + ...l_instances_service.start_external_sync.js | 94 + .../sql_instances_service.start_replica.js | 64 + .../sql_instances_service.stop_replica.js | 64 + .../sql_instances_service.switchover.js | 70 + .../sql_instances_service.truncate_log.js | 67 + .../v1beta4/sql_instances_service.update.js | 67 + ...s_service.verify_external_sync_settings.js | 96 + .../v1beta4/sql_operations_service.cancel.js | 64 + .../v1beta4/sql_operations_service.get.js | 64 + .../v1beta4/sql_operations_service.list.js | 73 + .../v1beta4/sql_ssl_certs_service.delete.js | 68 + .../v1beta4/sql_ssl_certs_service.get.js | 68 + .../v1beta4/sql_ssl_certs_service.insert.js | 67 + .../v1beta4/sql_ssl_certs_service.list.js | 64 + .../v1beta4/sql_tiers_service.list.js | 60 + .../v1beta4/sql_users_service.delete.js | 72 + .../v1beta4/sql_users_service.get.js | 72 + .../v1beta4/sql_users_service.insert.js | 67 + .../v1beta4/sql_users_service.list.js | 64 + .../v1beta4/sql_users_service.update.js | 86 + .../src/v1/gapic_metadata.json | 965 + .../google-cloud-sql/src/v1/index.ts | 34 + ...ilable_database_versions_service_client.ts | 491 + ...tabase_versions_service_client_config.json | 25 + ..._database_versions_service_proto_list.json | 19 + .../src/v1/sql_backup_runs_service_client.ts | 1059 + ...sql_backup_runs_service_client_config.json | 46 + .../sql_backup_runs_service_proto_list.json | 19 + .../src/v1/sql_backups_service_client.ts | 1323 + .../v1/sql_backups_service_client_config.json | 51 + .../v1/sql_backups_service_proto_list.json | 19 + .../src/v1/sql_connect_service_client.ts | 804 + .../v1/sql_connect_service_client_config.json | 34 + .../v1/sql_connect_service_proto_list.json | 19 + .../src/v1/sql_databases_service_client.ts | 1328 + .../sql_databases_service_client_config.json | 56 + .../v1/sql_databases_service_proto_list.json | 19 + .../src/v1/sql_events_service_client.ts | 487 + .../v1/sql_events_service_client_config.json | 25 + .../src/v1/sql_events_service_proto_list.json | 19 + .../sql_feature_eligibility_service_client.ts | 488 + ...ure_eligibility_service_client_config.json | 25 + ...eature_eligibility_service_proto_list.json | 19 + .../src/v1/sql_flags_service_client.ts | 642 + .../v1/sql_flags_service_client_config.json | 31 + .../src/v1/sql_flags_service_proto_list.json | 19 + .../src/v1/sql_iam_policies_service_client.ts | 487 + ...ql_iam_policies_service_client_config.json | 25 + .../sql_iam_policies_service_proto_list.json | 19 + .../v1/sql_instance_names_service_client.ts | 487 + ..._instance_names_service_client_config.json | 25 + ...sql_instance_names_service_proto_list.json | 19 + .../src/v1/sql_instances_service_client.ts | 6827 + .../sql_instances_service_client_config.json | 241 + .../v1/sql_instances_service_proto_list.json | 19 + .../src/v1/sql_operations_service_client.ts | 916 + .../sql_operations_service_client_config.json | 41 + .../v1/sql_operations_service_proto_list.json | 19 + .../src/v1/sql_regions_service_client.ts | 487 + .../v1/sql_regions_service_client_config.json | 25 + .../v1/sql_regions_service_proto_list.json | 19 + .../src/v1/sql_ssl_certs_service_client.ts | 1046 + .../sql_ssl_certs_service_client_config.json | 46 + .../v1/sql_ssl_certs_service_proto_list.json | 19 + .../src/v1/sql_tiers_service_client.ts | 644 + .../v1/sql_tiers_service_client_config.json | 31 + .../src/v1/sql_tiers_service_proto_list.json | 19 + .../src/v1/sql_users_service_client.ts | 1181 + .../v1/sql_users_service_client_config.json | 51 + .../src/v1/sql_users_service_proto_list.json | 19 + .../src/v1beta4/gapic_metadata.json | 905 + .../google-cloud-sql/src/v1beta4/index.ts | 29 + .../v1beta4/sql_backup_runs_service_client.ts | 1114 + ...sql_backup_runs_service_client_config.json | 46 + .../sql_backup_runs_service_proto_list.json | 8 + .../src/v1beta4/sql_backups_service_client.ts | 1339 + .../sql_backups_service_client_config.json | 51 + .../sql_backups_service_proto_list.json | 8 + .../src/v1beta4/sql_connect_service_client.ts | 816 + .../sql_connect_service_client_config.json | 34 + .../sql_connect_service_proto_list.json | 8 + .../v1beta4/sql_databases_service_client.ts | 1405 + .../sql_databases_service_client_config.json | 56 + .../sql_databases_service_proto_list.json | 8 + .../src/v1beta4/sql_flags_service_client.ts | 671 + .../sql_flags_service_client_config.json | 31 + .../v1beta4/sql_flags_service_proto_list.json | 8 + .../sql_iam_policies_service_client.ts | 487 + ...ql_iam_policies_service_client_config.json | 25 + .../sql_iam_policies_service_proto_list.json | 8 + .../v1beta4/sql_instances_service_client.ts | 6945 + .../sql_instances_service_client_config.json | 241 + .../sql_instances_service_proto_list.json | 8 + .../v1beta4/sql_operations_service_client.ts | 963 + .../sql_operations_service_client_config.json | 41 + .../sql_operations_service_proto_list.json | 8 + .../v1beta4/sql_ssl_certs_service_client.ts | 1097 + .../sql_ssl_certs_service_client_config.json | 46 + .../sql_ssl_certs_service_proto_list.json | 8 + .../src/v1beta4/sql_tiers_service_client.ts | 647 + .../sql_tiers_service_client_config.json | 31 + .../v1beta4/sql_tiers_service_proto_list.json | 8 + .../src/v1beta4/sql_users_service_client.ts | 1200 + .../sql_users_service_client_config.json | 51 + .../v1beta4/sql_users_service_proto_list.json | 8 + .../google-cloud-sql/system-test/install.ts | 51 + ..._available_database_versions_service_v1.ts | 571 + .../test/gapic_sql_backup_runs_service_v1.ts | 1192 + .../gapic_sql_backup_runs_service_v1beta4.ts | 1233 + .../test/gapic_sql_backups_service_v1.ts | 1435 + .../test/gapic_sql_backups_service_v1beta4.ts | 1483 + .../test/gapic_sql_connect_service_v1.ts | 841 + .../test/gapic_sql_connect_service_v1beta4.ts | 867 + .../test/gapic_sql_databases_service_v1.ts | 1567 + .../gapic_sql_databases_service_v1beta4.ts | 1575 + .../test/gapic_sql_events_service_v1.ts | 519 + ...apic_sql_feature_eligibility_service_v1.ts | 565 + .../test/gapic_sql_flags_service_v1.ts | 609 + .../test/gapic_sql_flags_service_v1beta4.ts | 649 + .../test/gapic_sql_iam_policies_service_v1.ts | 541 + .../gapic_sql_iam_policies_service_v1beta4.ts | 541 + .../gapic_sql_instance_names_service_v1.ts | 541 + .../test/gapic_sql_instances_service_v1.ts | 7478 + .../gapic_sql_instances_service_v1beta4.ts | 7248 + .../test/gapic_sql_operations_service_v1.ts | 979 + .../gapic_sql_operations_service_v1beta4.ts | 1020 + .../test/gapic_sql_regions_service_v1.ts | 520 + .../test/gapic_sql_ssl_certs_service_v1.ts | 1158 + .../gapic_sql_ssl_certs_service_v1beta4.ts | 1231 + .../test/gapic_sql_tiers_service_v1.ts | 653 + .../test/gapic_sql_tiers_service_v1beta4.ts | 655 + .../test/gapic_sql_users_service_v1.ts | 1285 + .../test/gapic_sql_users_service_v1beta4.ts | 1287 + .../google-cloud-sql/tsconfig.json | 22 + .../google-cloud-sql/webpack.config.js | 64 + 298 files changed, 357822 insertions(+) create mode 100644 owl-bot-staging/google-cloud-sql/.eslintignore create mode 100644 owl-bot-staging/google-cloud-sql/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-sql/.gitignore create mode 100644 owl-bot-staging/google-cloud-sql/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-sql/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-sql/.nycrc create mode 100644 owl-bot-staging/google-cloud-sql/README.md create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backups.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_connect.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_databases.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_events.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_flags.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instance_names.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_operations.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_regions.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_tiers.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_users.proto create mode 100644 owl-bot-staging/google-cloud-sql/protos/protos.d.ts create mode 100644 owl-bot-staging/google-cloud-sql/protos/protos.js create mode 100644 owl-bot-staging/google-cloud-sql/protos/protos.json create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.delete.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.insert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.create_backup.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.delete_backup.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.get_backup.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.list_backups.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.update_backup.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.get_connect_settings.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.delete.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.insert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.patch.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.update.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_flags_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_entra_id_certificate.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_ca.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_certificate.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.create_ephemeral.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.delete.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote_master.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.execute_sql.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.export.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.failover.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_disk_shrink_config.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_latest_recovery_time.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.import.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.insert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_entra_id_certificates.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_cas.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_certificates.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.patch.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.perform_disk_shrink.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.point_in_time_restore.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.promote_replica.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reencrypt.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.release_ssrs_lease.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reschedule_maintenance.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_replica_size.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_ssl_config.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restart.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restore_backup.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_ca.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_certificate.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_external_sync.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_replica.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.stop_replica.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.switchover.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.truncate_log.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.update.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.verify_external_sync_settings.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.cancel.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.delete.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.insert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_tiers_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.delete.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.insert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.update.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.delete.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.insert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.create_backup.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.delete_backup.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.get_backup.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.list_backups.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.update_backup.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.get_connect_settings.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.delete.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.insert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.patch.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.update.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_flags_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_ca.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_certificate.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.clone.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.create_ephemeral.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.delete.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote_master.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.execute_sql.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.export.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.failover.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.import.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.insert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_cas.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_certificates.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.patch.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.promote_replica.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reencrypt.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_replica_size.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restart.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restore_backup.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_external_sync.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_replica.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.stop_replica.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.switchover.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.truncate_log.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.update.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.cancel.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.delete.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.insert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_tiers_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.delete.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.get.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.insert.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.list.js create mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.update.js create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/index.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client.ts create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client_config.json create mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_proto_list.json create mode 100644 owl-bot-staging/google-cloud-sql/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_available_database_versions_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_events_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_instance_names_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_regions_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1.ts create mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts create mode 100644 owl-bot-staging/google-cloud-sql/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-sql/webpack.config.js diff --git a/owl-bot-staging/google-cloud-sql/.eslintignore b/owl-bot-staging/google-cloud-sql/.eslintignore new file mode 100644 index 000000000000..cfc348ec4d11 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-sql/.eslintrc.json b/owl-bot-staging/google-cloud-sql/.eslintrc.json new file mode 100644 index 000000000000..3e8d97ccb390 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "extends": "./node_modules/gts", + "root": true +} diff --git a/owl-bot-staging/google-cloud-sql/.gitignore b/owl-bot-staging/google-cloud-sql/.gitignore new file mode 100644 index 000000000000..d4f03a0df2e8 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +/.coverage +/coverage +/.nyc_output +/docs/ +/out/ +/build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-sql/.jsdoc.js b/owl-bot-staging/google-cloud-sql/.jsdoc.js new file mode 100644 index 000000000000..b712c954f332 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2026 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/sql', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-sql/.mocharc.js b/owl-bot-staging/google-cloud-sql/.mocharc.js new file mode 100644 index 000000000000..5eb34e86c874 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-sql/.nycrc b/owl-bot-staging/google-cloud-sql/.nycrc new file mode 100644 index 000000000000..81a95fc94b00 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/.nycrc @@ -0,0 +1,24 @@ +{ + "report-dir": "./.coverage", + "reporter": ["text", "lcov"], + "exclude": [ + "**/*-test", + "**/.coverage", + "**/apis", + "**/benchmark", + "**/conformance", + "**/docs", + "**/samples", + "**/scripts", + "**/protos", + "**/test", + "**/*.d.ts", + ".jsdoc.js", + "**/.jsdoc.js", + "karma.conf.js", + "webpack-tests.config.js", + "webpack.config.js" + ], + "exclude-after-remap": false, + "all": true +} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-sql/README.md b/owl-bot-staging/google-cloud-sql/README.md new file mode 100644 index 000000000000..497b95b405f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/README.md @@ -0,0 +1,263 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "The comments you see below are used to generate those parts of the template in later states." +Google Cloud Platform logo + +# [Cloud SQL Admin API: Nodejs Client][homepage] + +This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways +unless absolutely necessary (e.g. because of critical security issues) or with +an extensive deprecation period. Issues and requests against **stable** libraries +are addressed with the highest priority + +[![npm version](https://img.shields.io/npm/v/@google-cloud/sql.svg)](https://www.npmjs.org/package/@google-cloud/sql) + +Cloud SQL Admin API client for Node.js + +[//]: # "partials.introduction" + +A comprehensive list of changes in each version may be found in +[the CHANGELOG][homepage_changelog]. + +* [Cloud SQL Admin API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/sql/latest) + + +Read more about the client libraries for Cloud APIs, including the older +Google APIs Client Libraries, in [Client Libraries Explained][explained]. + +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained + +**Table of contents:** + +* [Quickstart](#quickstart) + * [Before you begin](#before-you-begin) + * [Installing the client library](#installing-the-client-library) + +* [Versioning](#versioning) +* [Contributing](#contributing) +* [License](#license) + +## Quickstart +### Before you begin + +1. [Select or create a Cloud Platform project][projects]. +1. [Enable billing for your project][billing]. +1. [Enable the Cloud SQL Admin API API][enable_api]. +1. [Set up authentication][auth] so you can access the + API from your local workstation. +### Installing the client library + +```bash +npm install @google-cloud/sql +``` + +[//]: # "partials.body" + +## Samples + +Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. + +| Sample | Source Code | +| --------------------------- | --------------------------------- | +| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json) | +| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.delete.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.get.js) | +| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.insert.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.list.js) | +| create backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backups_service.create_backup.js) | +| delete backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backups_service.delete_backup.js) | +| get backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backups_service.get_backup.js) | +| list backups | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backups_service.list_backups.js) | +| update backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backups_service.update_backup.js) | +| generate ephemeral cert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js) | +| get connect settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_connect_service.get_connect_settings.js) | +| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.delete.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.get.js) | +| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.insert.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.list.js) | +| patch | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.patch.js) | +| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.update.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_flags_service.list.js) | +| acquire ssrs lease | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js) | +| add entra id certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.add_entra_id_certificate.js) | +| add server ca | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_ca.js) | +| add server certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_certificate.js) | +| clone | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js) | +| create ephemeral | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.create_ephemeral.js) | +| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.delete.js) | +| demote | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.demote.js) | +| demote master | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.demote_master.js) | +| execute sql | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.execute_sql.js) | +| export | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.export.js) | +| failover | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.failover.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.get.js) | +| get disk shrink config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.get_disk_shrink_config.js) | +| get latest recovery time | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.get_latest_recovery_time.js) | +| import | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.import.js) | +| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.insert.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.list.js) | +| list entra id certificates | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.list_entra_id_certificates.js) | +| list server cas | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_cas.js) | +| list server certificates | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_certificates.js) | +| patch | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.patch.js) | +| perform disk shrink | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.perform_disk_shrink.js) | +| point in time restore | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.point_in_time_restore.js) | +| pre check major version upgrade | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js) | +| promote replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.promote_replica.js) | +| reencrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.reencrypt.js) | +| release ssrs lease | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.release_ssrs_lease.js) | +| reschedule maintenance | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.reschedule_maintenance.js) | +| reset replica size | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_replica_size.js) | +| reset ssl config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_ssl_config.js) | +| restart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.restart.js) | +| restore backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.restore_backup.js) | +| rotate entra id certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js) | +| rotate server ca | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_ca.js) | +| rotate server certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_certificate.js) | +| start external sync | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.start_external_sync.js) | +| start replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.start_replica.js) | +| stop replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.stop_replica.js) | +| switchover | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.switchover.js) | +| truncate log | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.truncate_log.js) | +| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.update.js) | +| verify external sync settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.verify_external_sync_settings.js) | +| cancel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_operations_service.cancel.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_operations_service.get.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_operations_service.list.js) | +| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.delete.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.get.js) | +| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.insert.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.list.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_tiers_service.list.js) | +| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_users_service.delete.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_users_service.get.js) | +| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_users_service.insert.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_users_service.list.js) | +| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_users_service.update.js) | +| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json) | +| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.delete.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.get.js) | +| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.insert.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.list.js) | +| create backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.create_backup.js) | +| delete backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.delete_backup.js) | +| get backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.get_backup.js) | +| list backups | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.list_backups.js) | +| update backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.update_backup.js) | +| generate ephemeral cert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js) | +| get connect settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.get_connect_settings.js) | +| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.delete.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.get.js) | +| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.insert.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.list.js) | +| patch | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.patch.js) | +| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.update.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_flags_service.list.js) | +| acquire ssrs lease | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js) | +| add entra id certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js) | +| add server ca | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_ca.js) | +| add server certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_certificate.js) | +| clone | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.clone.js) | +| create ephemeral | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.create_ephemeral.js) | +| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.delete.js) | +| demote | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote.js) | +| demote master | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote_master.js) | +| execute sql | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.execute_sql.js) | +| export | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.export.js) | +| failover | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.failover.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get.js) | +| get disk shrink config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js) | +| get latest recovery time | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js) | +| import | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.import.js) | +| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.insert.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list.js) | +| list entra id certificates | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js) | +| list server cas | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_cas.js) | +| list server certificates | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_certificates.js) | +| patch | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.patch.js) | +| perform disk shrink | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js) | +| point in time restore | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js) | +| pre check major version upgrade | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js) | +| promote replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.promote_replica.js) | +| reencrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reencrypt.js) | +| release ssrs lease | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js) | +| reschedule maintenance | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js) | +| reset replica size | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_replica_size.js) | +| reset ssl config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js) | +| restart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restart.js) | +| restore backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restore_backup.js) | +| rotate entra id certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js) | +| rotate server ca | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js) | +| rotate server certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js) | +| start external sync | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_external_sync.js) | +| start replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_replica.js) | +| stop replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.stop_replica.js) | +| switchover | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.switchover.js) | +| truncate log | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.truncate_log.js) | +| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.update.js) | +| verify external sync settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js) | +| cancel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.cancel.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.get.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.list.js) | +| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.delete.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.get.js) | +| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.insert.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.list.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_tiers_service.list.js) | +| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_users_service.delete.js) | +| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_users_service.get.js) | +| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_users_service.insert.js) | +| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_users_service.list.js) | +| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_users_service.update.js) | + + +## Supported Node.js Versions + +Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). +Libraries are compatible with all current _active_ and _maintenance_ versions of +Node.js. +If you are using an end-of-life version of Node.js, we recommend that you update +as soon as possible to an actively supported LTS version. + +Google's client libraries support legacy versions of Node.js runtimes on a +best-efforts basis with the following warnings: + +* Legacy versions are not tested in continuous integration. +* Some security patches and features cannot be backported. +* Dependencies cannot be kept up-to-date. + +Client libraries targeting some end-of-life versions of Node.js are available, and +can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). +The dist-tags follow the naming convention `legacy-(version)`. +For example, `npm install @google-cloud/sql@legacy-8` installs client libraries +for versions compatible with Node.js 8. + +## Versioning + +This library follows [Semantic Versioning](http://semver.org/). + +More Information: [Google Cloud Platform Launch Stages][launch_stages] + +[launch_stages]: https://cloud.google.com/terms/launch-stages + +## Contributing + +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). + +Please note that this `README.md` +and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) +are generated from a central template. + +## License + +Apache Version 2.0 + +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) + +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[projects]: https://console.cloud.google.com/project +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=sqladmin.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local +[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples +[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/CHANGELOG.md +[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto new file mode 100644 index 000000000000..0147d26d397e --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto @@ -0,0 +1,33 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlAvailableDatabaseVersionsProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service that exposes Cloud SQL database versions information. This +// service is only used internally. +service SqlAvailableDatabaseVersionsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto new file mode 100644 index 000000000000..b90def1581a8 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto @@ -0,0 +1,270 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/sql/v1/cloud_sql_resources.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlBackupRunsProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service for managing database backups. +service SqlBackupRunsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Deletes the backup taken by a backup run. + rpc Delete(SqlBackupRunsDeleteRequest) returns (Operation) { + option (google.api.http) = { + delete: "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" + }; + } + + // Retrieves a resource containing information about a backup run. + rpc Get(SqlBackupRunsGetRequest) returns (BackupRun) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" + }; + } + + // Creates a new backup run on demand. + rpc Insert(SqlBackupRunsInsertRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/backupRuns" + body: "body" + }; + } + + // Lists all backup runs associated with the project or a given instance + // and configuration in the reverse chronological order of the backup + // initiation time. + rpc List(SqlBackupRunsListRequest) returns (BackupRunsListResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/backupRuns" + }; + } +} + +// Backup runs delete request. +message SqlBackupRunsDeleteRequest { + // The ID of the backup run to delete. To find a backup run ID, use the + // [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list) + // method. + int64 id = 1; + + // Cloud SQL instance ID. This does not include the project ID. + string instance = 2; + + // Project ID of the project that contains the instance. + string project = 3; +} + +// Backup runs get request. +message SqlBackupRunsGetRequest { + // The ID of this backup run. + int64 id = 1; + + // Cloud SQL instance ID. This does not include the project ID. + string instance = 2; + + // Project ID of the project that contains the instance. + string project = 3; +} + +// Backup runs insert request. +message SqlBackupRunsInsertRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + BackupRun body = 100; +} + +// Backup runs list request. +message SqlBackupRunsListRequest { + // Cloud SQL instance ID, or "-" for all instances. This does not include + // the project ID. + string instance = 1; + + // Maximum number of backup runs per response. + int32 max_results = 2; + + // A previously-returned page token representing part of the larger set of + // results to view. + string page_token = 3; + + // Project ID of the project that contains the instance. + string project = 4; +} + +// A BackupRun resource. +message BackupRun { + // This is always `sql#backupRun`. + string kind = 1; + + // The status of this run. + SqlBackupRunStatus status = 2; + + // The time the run was enqueued in UTC timezone in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp enqueued_time = 3; + + // The identifier for this backup run. Unique only for a specific Cloud SQL + // instance. + int64 id = 4; + + // The time the backup operation actually started in UTC timezone in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp start_time = 5; + + // The time the backup operation completed in UTC timezone in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp end_time = 6; + + // Information about why the backup operation failed. This is only present if + // the run has the FAILED status. + OperationError error = 7; + + // The type of this run; can be either "AUTOMATED" or "ON_DEMAND" or "FINAL". + // This field defaults to "ON_DEMAND" and is ignored, when specified for + // insert requests. + SqlBackupRunType type = 8; + + // The description of this run, only applicable to on-demand backups. + string description = 9; + + // The start time of the backup window during which this the backup was + // attempted in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for + // example `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp window_start_time = 10; + + // Name of the database instance. + string instance = 11; + + // The URI of this resource. + string self_link = 12; + + // Location of the backups. + string location = 13; + + // Output only. The instance database version at the time this backup was + // made. + SqlDatabaseVersion database_version = 15 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Encryption configuration specific to a backup. + DiskEncryptionConfiguration disk_encryption_configuration = 16; + + // Encryption status specific to a backup. + DiskEncryptionStatus disk_encryption_status = 17; + + // Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. + SqlBackupKind backup_kind = 19; + + // Backup time zone to prevent restores to an instance with + // a different time zone. Now relevant only for SQL Server. + string time_zone = 23; + + // Output only. The maximum chargeable bytes for the backup. + optional int64 max_chargeable_bytes = 24 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Backup run list results. +message BackupRunsListResponse { + // This is always `sql#backupRunsList`. + string kind = 1; + + // A list of backup runs in reverse chronological order of the enqueued time. + repeated BackupRun items = 2; + + // The continuation token, used to page through large result sets. Provide + // this value in a subsequent request to return the next page of results. + string next_page_token = 3; +} + +// The status of a backup run. +enum SqlBackupRunStatus { + // The status of the run is unknown. + SQL_BACKUP_RUN_STATUS_UNSPECIFIED = 0; + + // The backup operation was enqueued. + ENQUEUED = 1; + + // The backup is overdue across a given backup window. Indicates a + // problem. Example: Long-running operation in progress during + // the whole window. + OVERDUE = 2; + + // The backup is in progress. + RUNNING = 3; + + // The backup failed. + FAILED = 4; + + // The backup was successful. + SUCCESSFUL = 5; + + // The backup was skipped (without problems) for a given backup + // window. Example: Instance was idle. + SKIPPED = 6; + + // The backup is about to be deleted. + DELETION_PENDING = 7; + + // The backup deletion failed. + DELETION_FAILED = 8; + + // The backup has been deleted. + DELETED = 9; +} + +// Defines the supported backup kinds. +enum SqlBackupKind { + // This is an unknown BackupKind. + SQL_BACKUP_KIND_UNSPECIFIED = 0; + + // Snapshot-based backups. + SNAPSHOT = 1; + + // Physical backups. + PHYSICAL = 2; +} + +// Type of backup (i.e. automated, on demand, etc). +enum SqlBackupRunType { + // This is an unknown BackupRun type. + SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0; + + // The backup schedule automatically triggers a backup. + AUTOMATED = 1; + + // The user manually triggers a backup. + ON_DEMAND = 2; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backups.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backups.proto new file mode 100644 index 000000000000..220be86b60fa --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backups.proto @@ -0,0 +1,327 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/sql/v1/cloud_sql_backup_runs.proto"; +import "google/cloud/sql/v1/cloud_sql_instances.proto"; +import "google/cloud/sql/v1/cloud_sql_resources.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/interval.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlBackupsProto"; +option java_package = "com.google.cloud.sql.v1"; + +service SqlBackupsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Creates a backup for a Cloud SQL instance. This API can be used only to + // create on-demand backups. + rpc CreateBackup(CreateBackupRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent, backup"; + } + + // Retrieves a resource containing information about a backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/v1/{name=projects/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all backups associated with the project. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the retention period and description of the backup. You can use + // this API to update final backups only. + rpc UpdateBackup(UpdateBackupRequest) returns (Operation) { + option (google.api.http) = { + patch: "/v1/{backup.name=projects/*/backups/*}" + body: "backup" + }; + option (google.api.method_signature) = "backup, update_mask"; + } + + // Deletes the backup. + rpc DeleteBackup(DeleteBackupRequest) returns (Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// The request payload to create the backup +message CreateBackupRequest { + // Required. The parent resource where this backup is created. + // Format: projects/{project} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "sqladmin.googleapis.com/Backup" + } + ]; + + // Required. The Backup to create. + Backup backup = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request payload to get the backup. +message GetBackupRequest { + // Required. The name of the backup to retrieve. + // Format: projects/{project}/backups/{backup} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } + ]; +} + +// The request payload to list the backups. +message ListBackupsRequest { + // Required. The parent that owns this collection of backups. + // Format: projects/{project} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "sqladmin.googleapis.com/Backup" + } + ]; + + // The maximum number of backups to return per response. The service might + // return fewer backups than this value. If a value for this parameter isn't + // specified, then, at most, 500 backups are returned. The maximum value is + // 2,000. Any values that you set, which are greater than 2,000, are changed + // to 2,000. + int32 page_size = 2; + + // A page token, received from a previous `ListBackups` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListBackups` must match + // the call that provided the page token. + string page_token = 3; + + // Multiple filter queries are separated by spaces. For example, + // 'instance:abc AND type:FINAL, 'location:us', + // 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + // type, instance, backupInterval.startTime (creation time), or location. + string filter = 4; +} + +// The response payload containing a list of the backups. +message ListBackupsResponse { + // A list of backups. + repeated Backup backups = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, then there aren't subsequent pages. + string next_page_token = 2; + + // If a region isn't unavailable or if an unknown error occurs, then a warning + // message is returned. + repeated ApiWarning warnings = 3; +} + +// The request payload to update the backup. +message UpdateBackupRequest { + // Required. The backup to update. + // The backup’s `name` field is used to identify the backup to update. + // Format: projects/{project}/backups/{backup} + Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields that you can update. You can update only the description + // and retention period of the final backup. + google.protobuf.FieldMask update_mask = 2; +} + +// The request payload to delete the backup. +message DeleteBackupRequest { + // Required. The name of the backup to delete. + // Format: projects/{project}/backups/{backup} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } + ]; +} + +// A backup resource. +message Backup { + option (google.api.resource) = { + type: "sqladmin.googleapis.com/Backup" + pattern: "projects/{project}/backups/{backup}" + }; + + // The backup type. + enum SqlBackupType { + // This is an unknown backup type. + SQL_BACKUP_TYPE_UNSPECIFIED = 0; + + // The backup schedule triggers a backup automatically. + AUTOMATED = 1; + + // The user triggers a backup manually. + ON_DEMAND = 2; + + // The backup created when instance is deleted. + FINAL = 3; + } + + // The backup's state + enum SqlBackupState { + // The state of the backup is unknown. + SQL_BACKUP_STATE_UNSPECIFIED = 0; + + // The backup that's added to a queue. + ENQUEUED = 1; + + // The backup is in progress. + RUNNING = 2; + + // The backup failed. + FAILED = 3; + + // The backup is successful. + SUCCESSFUL = 4; + + // The backup is being deleted. + DELETING = 5; + + // Deletion of the backup failed. + DELETION_FAILED = 6; + } + + // Output only. The resource name of the backup. + // Format: projects/{project}/backups/{backup}. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This is always `sql#backup`. + string kind = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The URI of this resource. + string self_link = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of this backup. The type can be "AUTOMATED", + // "ON_DEMAND" or “FINAL”. + SqlBackupType type = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of this backup. + string description = 5; + + // The name of the source database instance. + string instance = 6; + + // The storage location of the backups. The location can be multi-regional. + string location = 7; + + // Output only. This output contains the following values: + // start_time: All database writes up to this time are available. + // end_time: Any database writes after this time aren't available. + google.type.Interval backup_interval = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The status of this backup. + SqlBackupState state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Information about why the backup operation fails (for example, + // when the backup state fails). + OperationError error = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This output contains the encryption configuration for a backup + // and the resource name of the KMS key for disk encryption. + string kms_key = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This output contains the encryption status for a backup and + // the version of the KMS key that's used to encrypt the Cloud SQL instance. + string kms_key_version = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. + SqlBackupKind backup_kind = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This output contains a backup time zone. If a Cloud SQL for + // SQL Server instance has a different time zone from the backup's time zone, + // then the restore to the instance doesn't happen. + string time_zone = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + oneof expiration { + // Input only. The time-to-live (TTL) interval for this resource (in days). + // For example: ttlDays:7, means 7 days from the current time. The + // expiration time can't exceed 365 days from the time that the backup is + // created. + int64 ttl_days = 16 [(google.api.field_behavior) = INPUT_ONLY]; + + // Backup expiration time. + // A UTC timestamp of when this backup expired. + google.protobuf.Timestamp expiry_time = 17; + } + + // Output only. The database version of the instance of at the time this + // backup was made. + SqlDatabaseVersion database_version = 20 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The maximum chargeable bytes for the backup. + optional int64 max_chargeable_bytes = 23 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Output only. Timestamp in UTC of when the instance associated + // with this backup is deleted. + google.protobuf.Timestamp instance_deletion_time = 24 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Optional. Output only. The instance setting of the source instance that's + // associated with this backup. + DatabaseInstance instance_settings = 25 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Output only. The mapping to backup run resource used for IAM validations. + string backup_run = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This status indicates whether the backup satisfies PZS. + // + // The status is reserved for future use. + google.protobuf.BoolValue satisfies_pzs = 27 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This status indicates whether the backup satisfies PZI. + // + // The status is reserved for future use. + google.protobuf.BoolValue satisfies_pzi = 28 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_connect.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_connect.proto new file mode 100644 index 000000000000..c00419be1536 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_connect.proto @@ -0,0 +1,216 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/sql/v1/cloud_sql_resources.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlConnectProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Cloud SQL connect service. +service SqlConnectService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Retrieves connect settings about a Cloud SQL instance. + rpc GetConnectSettings(GetConnectSettingsRequest) returns (ConnectSettings) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/connectSettings" + }; + } + + // Generates a short-lived X509 certificate containing the provided public key + // and signed by a private key specific to the target instance. Users may use + // the certificate to authenticate as themselves when connecting to the + // database. + rpc GenerateEphemeralCert(GenerateEphemeralCertRequest) + returns (GenerateEphemeralCertResponse) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}:generateEphemeralCert" + body: "*" + }; + } +} + +// Connect settings retrieval request. +message GetConnectSettingsRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Optional. Optional snapshot read timestamp to trade freshness for + // performance. + google.protobuf.Timestamp read_time = 7 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Connect settings retrieval response. +message ConnectSettings { + // Various Certificate Authority (CA) modes for certificate signing. + enum CaMode { + // CA mode is unknown. + CA_MODE_UNSPECIFIED = 0; + + // Google-managed self-signed internal CA. + GOOGLE_MANAGED_INTERNAL_CA = 1; + + // Google-managed regional CA part of root CA hierarchy hosted on Google + // Cloud's Certificate Authority Service (CAS). + GOOGLE_MANAGED_CAS_CA = 2; + + // Customer-managed CA hosted on Google Cloud's Certificate Authority + // Service (CAS). + CUSTOMER_MANAGED_CAS_CA = 3; + } + + // Details of a single read pool node of a read pool. + message ConnectPoolNodeConfig { + // Output only. The name of the read pool node. Doesn't include the project + // ID. + optional string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Mappings containing IP addresses that can be used to connect + // to the read pool node. + repeated IpMapping ip_addresses = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The DNS name of the read pool node. + optional string dns_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of DNS names used by this read pool node. + repeated DnsNameMapping dns_names = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // MdxProtocolSupport describes parts of the MDX protocol supported by this + // instance. + enum MdxProtocolSupport { + // Not specified. + MDX_PROTOCOL_SUPPORT_UNSPECIFIED = 0; + + // Client should send the client protocol type in the MDX request. + CLIENT_PROTOCOL_TYPE = 1; + } + + // This is always `sql#connectSettings`. + string kind = 1; + + // SSL configuration. + SslCert server_ca_cert = 2; + + // The assigned IP addresses for the instance. + repeated IpMapping ip_addresses = 3; + + // The cloud region for the instance. For example, `us-central1`, + // `europe-west1`. The region cannot be changed after instance creation. + string region = 4; + + // The database engine type and version. The `databaseVersion` + // field cannot be changed after instance creation. + // MySQL instances: `MYSQL_8_0`, `MYSQL_5_7` (default), + // or `MYSQL_5_6`. + // PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, + // `POSTGRES_11`, `POSTGRES_12` (default), `POSTGRES_13`, or `POSTGRES_14`. + // SQL Server instances: `SQLSERVER_2017_STANDARD` (default), + // `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, + // `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, + // `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or + // `SQLSERVER_2019_WEB`. + SqlDatabaseVersion database_version = 31; + + // `SECOND_GEN`: Cloud SQL database instance. + // `EXTERNAL`: A database server that is not managed by Google. + // This property is read-only; use the `tier` property in the `settings` + // object to determine the database type. + SqlBackendType backend_type = 32; + + // Whether PSC connectivity is enabled for this instance. + bool psc_enabled = 33; + + // The dns name of the instance. + string dns_name = 34; + + // Specify what type of CA is used for the server certificate. + CaMode server_ca_mode = 35; + + // Custom subject alternative names for the server certificate. + repeated string custom_subject_alternative_names = 37; + + // Output only. The list of DNS names used by this instance. + repeated DnsNameMapping dns_names = 38 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The number of read pool nodes in a read pool. + optional int32 node_count = 63; + + // Output only. Entries containing information about each read pool node of + // the read pool. + repeated ConnectPoolNodeConfig nodes = 64 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Output only. mdx_protocol_support controls how the client uses + // metadata exchange when connecting to the instance. The values in the list + // representing parts of the MDX protocol that are supported by this instance. + // When the list is empty, the instance does not support MDX, so the client + // must not send an MDX request. The default is empty. + repeated MdxProtocolSupport mdx_protocol_support = 39 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; +} + +// Ephemeral certificate creation request. +message GenerateEphemeralCertRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // PEM encoded public key to include in the signed certificate. + string public_key = 3 [json_name = "public_key"]; + + // Optional. Access token to include in the signed certificate. + string access_token = 4 + [json_name = "access_token", (google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional snapshot read timestamp to trade freshness for + // performance. + google.protobuf.Timestamp read_time = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set, it will contain the cert valid duration. + google.protobuf.Duration valid_duration = 12 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Ephemeral certificate creation request. +message GenerateEphemeralCertResponse { + // Generated cert + SslCert ephemeral_cert = 1; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_databases.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_databases.proto new file mode 100644 index 000000000000..56e02ed26a9b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_databases.proto @@ -0,0 +1,152 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/cloud/sql/v1/cloud_sql_resources.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlDatabasesProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service to manage databases. +service SqlDatabasesService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Deletes a database from a Cloud SQL instance. + rpc Delete(SqlDatabasesDeleteRequest) returns (Operation) { + option (google.api.http) = { + delete: "/v1/projects/{project}/instances/{instance}/databases/{database}" + }; + } + + // Retrieves a resource containing information about a database inside a Cloud + // SQL instance. + rpc Get(SqlDatabasesGetRequest) returns (Database) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/databases/{database}" + }; + } + + // Inserts a resource containing information about a database inside a Cloud + // SQL instance. + // + // **Note:** You can't modify the default character set and collation. + rpc Insert(SqlDatabasesInsertRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/databases" + body: "body" + }; + } + + // Lists databases in the specified Cloud SQL instance. + rpc List(SqlDatabasesListRequest) returns (DatabasesListResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/databases" + }; + } + + // Partially updates a resource containing information about a database inside + // a Cloud SQL instance. This method supports patch semantics. + rpc Patch(SqlDatabasesUpdateRequest) returns (Operation) { + option (google.api.http) = { + patch: "/v1/projects/{project}/instances/{instance}/databases/{database}" + body: "body" + }; + } + + // Updates a resource containing information about a database inside a Cloud + // SQL instance. + rpc Update(SqlDatabasesUpdateRequest) returns (Operation) { + option (google.api.http) = { + put: "/v1/projects/{project}/instances/{instance}/databases/{database}" + body: "body" + }; + } +} + +// Database delete request. +message SqlDatabasesDeleteRequest { + // Name of the database to be deleted in the instance. + string database = 1; + + // Database instance ID. This does not include the project ID. + string instance = 2; + + // Project ID of the project that contains the instance. + string project = 3; +} + +// Database get request. +message SqlDatabasesGetRequest { + // Name of the database in the instance. + string database = 1; + + // Database instance ID. This does not include the project ID. + string instance = 2; + + // Project ID of the project that contains the instance. + string project = 3; +} + +// Database insert request. +message SqlDatabasesInsertRequest { + // Database instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + Database body = 100; +} + +// Database list request. +message SqlDatabasesListRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +// Database update request. +message SqlDatabasesUpdateRequest { + // Name of the database to be updated in the instance. + string database = 1; + + // Database instance ID. This does not include the project ID. + string instance = 2; + + // Project ID of the project that contains the instance. + string project = 3; + + Database body = 100; +} + +// Database list response. +message DatabasesListResponse { + // This is always `sql#databasesList`. + string kind = 1; + + // List of database resources in the instance. + repeated Database items = 2; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_events.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_events.proto new file mode 100644 index 000000000000..3d1bb688c30b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_events.proto @@ -0,0 +1,33 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlEventsProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service that exposes Cloud SQL event information. This +// service is only used internally. +service SqlEventsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto new file mode 100644 index 000000000000..d33e44df0c35 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto @@ -0,0 +1,31 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlFeatureEligibilityProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service to verify the eligibility of an instance for a given operation. +service SqlFeatureEligibilityService { + option (google.api.default_host) = "sqladmin.googleapis.com"; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_flags.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_flags.proto new file mode 100644 index 000000000000..b7b704399cf1 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_flags.proto @@ -0,0 +1,161 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/sql/v1/cloud_sql_resources.proto"; +import "google/protobuf/wrappers.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlFlagsProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service to manage database flags for Cloud SQL instances. +service SqlFlagsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Lists all available database flags for Cloud SQL instances. + rpc List(SqlFlagsListRequest) returns (FlagsListResponse) { + option (google.api.http) = { + get: "/v1/flags" + }; + } +} + +// Flags list request. +message SqlFlagsListRequest { + // Database type and version you want to retrieve flags for. By default, this + // method returns flags for all database types and versions. + string database_version = 1; + + // Optional. Specify the scope of flags to be returned by SqlFlagsListService. + // Return list of database flags if unspecified. + optional SqlFlagScope flag_scope = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Flags list response. +message FlagsListResponse { + // This is always `sql#flagsList`. + string kind = 1; + + // List of flags. + repeated Flag items = 2; +} + +// A flag resource. +message Flag { + // This is the name of the flag. Flag names always use underscores, not + // hyphens, for example: `max_allowed_packet` + string name = 1; + + // The type of the flag. Flags are typed to being `BOOLEAN`, `STRING`, + // `INTEGER` or `NONE`. `NONE` is used for flags that do not take a + // value, such as `skip_grant_tables`. + SqlFlagType type = 2; + + // The database version this flag applies to. Can be + // MySQL instances: `MYSQL_8_0`, `MYSQL_8_0_18`, `MYSQL_8_0_26`, `MYSQL_5_7`, + // or `MYSQL_5_6`. PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, + // `POSTGRES_11` or `POSTGRES_12`. SQL Server instances: + // `SQLSERVER_2017_STANDARD`, `SQLSERVER_2017_ENTERPRISE`, + // `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, + // `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or + // `SQLSERVER_2019_WEB`. + // See [the complete + // list](/sql/docs/mysql/admin-api/rest/v1/SqlDatabaseVersion). + repeated SqlDatabaseVersion applies_to = 3; + + // For `STRING` flags, a list of strings that the value can be set to. + repeated string allowed_string_values = 4; + + // For `INTEGER` flags, the minimum allowed value. + google.protobuf.Int64Value min_value = 5; + + // For `INTEGER` flags, the maximum allowed value. + google.protobuf.Int64Value max_value = 6; + + // Indicates whether changing this flag will trigger a database restart. Only + // applicable to Second Generation instances. + google.protobuf.BoolValue requires_restart = 7; + + // This is always `sql#flag`. + string kind = 8; + + // Whether or not the flag is considered in beta. + google.protobuf.BoolValue in_beta = 9; + + // Use this field if only certain integers are accepted. Can be combined + // with min_value and max_value to add additional values. + repeated int64 allowed_int_values = 10; + + // Scope of flag. + SqlFlagScope flag_scope = 15; + + // Recommended flag value for UI display. + oneof recommended_value { + // Recommended string value in string format for UI display. + string recommended_string_value = 16; + + // Recommended int value in integer format for UI display. + google.protobuf.Int64Value recommended_int_value = 17; + } +} + +enum SqlFlagType { + // This is an unknown flag type. + SQL_FLAG_TYPE_UNSPECIFIED = 0; + + // Boolean type flag. + BOOLEAN = 1; + + // String type flag. + STRING = 2; + + // Integer type flag. + INTEGER = 3; + + // Flag type used for a server startup option. + NONE = 4; + + // Type introduced specially for MySQL TimeZone offset. Accept a string value + // with the format [-12:59, 13:00]. + MYSQL_TIMEZONE_OFFSET = 5; + + // Float type flag. + FLOAT = 6; + + // Comma-separated list of the strings in a SqlFlagType enum. + REPEATED_STRING = 7; +} + +// Scopes of a flag describe where the flag is used. +enum SqlFlagScope { + // Assume database flags if unspecified + SQL_FLAG_SCOPE_UNSPECIFIED = 0; + + // database flags + SQL_FLAG_SCOPE_DATABASE = 1; + + // connection pool configuration flags + SQL_FLAG_SCOPE_CONNECTION_POOL = 2; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto new file mode 100644 index 000000000000..4edbc6317695 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto @@ -0,0 +1,30 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlIamPoliciesProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service for providing IAM Meta APIs for Cloud SQL. +service SqlIamPoliciesService { + option (google.api.default_host) = "sqladmin.googleapis.com"; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instance_names.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instance_names.proto new file mode 100644 index 000000000000..cc00b42bda2f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instance_names.proto @@ -0,0 +1,31 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlInstanceNamesServiceProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Cloud SQL instance names service. +service SqlInstanceNamesService { + option (google.api.default_host) = "sqladmin.googleapis.com"; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto new file mode 100644 index 000000000000..b07e2fa0b118 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto @@ -0,0 +1,2530 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/sql/v1/cloud_sql_resources.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/rpc/status.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlServiceProto"; +option java_package = "com.google.cloud.sql.v1"; +option (google.api.resource_definition) = { + type: "backupdr.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; + +service SqlInstancesService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Adds a new trusted Certificate Authority (CA) version for the specified + // instance. Required to prepare for a certificate rotation. If a CA version + // was previously added but never used in a certificate rotation, this + // operation replaces that version. There cannot be more than one CA version + // waiting to be rotated in. For instances that have enabled Certificate + // Authority Service (CAS) based server CA, use AddServerCertificate to add a + // new server certificate. + rpc AddServerCa(SqlInstancesAddServerCaRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/addServerCa" + }; + } + + // Add a new trusted server certificate version for the specified instance + // using Certificate Authority Service (CAS) server CA. Required to prepare + // for a certificate rotation. If a server certificate version was previously + // added but never used in a certificate rotation, this operation replaces + // that version. There cannot be more than one certificate version waiting to + // be rotated in. For instances not using CAS server CA, use AddServerCa + // instead. + rpc AddServerCertificate(SqlInstancesAddServerCertificateRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/addServerCertificate" + }; + } + + // Adds a new Entra ID certificate for the specified instance. If an Entra ID + // certificate was previously added but never used in a certificate rotation, + // this operation replaces that version. + rpc AddEntraIdCertificate(SqlInstancesAddEntraIdCertificateRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/addEntraIdCertificate" + }; + } + + // Creates a Cloud SQL instance as a clone of the source instance. Using this + // operation might cause your instance to restart. + rpc Clone(SqlInstancesCloneRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/clone" + body: "body" + }; + } + + // Deletes a Cloud SQL instance. + rpc Delete(SqlInstancesDeleteRequest) returns (Operation) { + option (google.api.http) = { + delete: "/v1/projects/{project}/instances/{instance}" + }; + } + + // Demotes the stand-alone instance to be a Cloud SQL read replica for an + // external database server. + rpc DemoteMaster(SqlInstancesDemoteMasterRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/demoteMaster" + body: "body" + }; + } + + // Demotes an existing standalone instance to be a Cloud SQL read replica + // for an external database server. + rpc Demote(SqlInstancesDemoteRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/demote" + body: "body" + }; + } + + // Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL + // dump or CSV file. + rpc Export(SqlInstancesExportRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/export" + body: "body" + }; + } + + // Initiates a manual failover of a high availability (HA) primary instance + // to a standby instance, which becomes the primary instance. Users are + // then rerouted to the new primary. For more information, see the + // [Overview of high + // availability](https://cloud.google.com/sql/docs/mysql/high-availability) + // page in the Cloud SQL documentation. + // If using Legacy HA (MySQL only), this causes the instance to failover to + // its failover replica instance. + rpc Failover(SqlInstancesFailoverRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/failover" + body: "body" + }; + } + + // Reencrypt CMEK instance with latest key version. + rpc Reencrypt(SqlInstancesReencryptRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/reencrypt" + body: "body" + }; + } + + // Retrieves a resource containing information about a Cloud SQL instance. + rpc Get(SqlInstancesGetRequest) returns (DatabaseInstance) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}" + }; + } + + // Imports data into a Cloud SQL instance from a SQL dump or CSV file in + // Cloud Storage. + rpc Import(SqlInstancesImportRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/import" + body: "body" + }; + } + + // Creates a new Cloud SQL instance. + rpc Insert(SqlInstancesInsertRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances" + body: "body" + }; + } + + // Lists instances under a given project. + rpc List(SqlInstancesListRequest) returns (InstancesListResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances" + }; + } + + // Lists all of the trusted Certificate Authorities (CAs) for the specified + // instance. There can be up to three CAs listed: the CA that was used to sign + // the certificate that is currently in use, a CA that has been added but not + // yet used to sign a certificate, and a CA used to sign a certificate that + // has previously rotated out. + rpc ListServerCas(SqlInstancesListServerCasRequest) + returns (InstancesListServerCasResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/listServerCas" + }; + } + + // Lists all versions of server certificates and certificate authorities (CAs) + // for the specified instance. There can be up to three sets of certs listed: + // the certificate that is currently in use, a future that has been added but + // not yet used to sign a certificate, and a certificate that has been rotated + // out. For instances not using Certificate Authority Service (CAS) server CA, + // use ListServerCas instead. + rpc ListServerCertificates(SqlInstancesListServerCertificatesRequest) + returns (InstancesListServerCertificatesResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/listServerCertificates" + }; + } + + // Lists all versions of EntraID certificates for the specified instance. + // There can be up to three sets of certificates listed: the certificate that + // is currently in use, a future that has been added but not yet used to sign + // a certificate, and a certificate that has been rotated out. + rpc ListEntraIdCertificates(SqlInstancesListEntraIdCertificatesRequest) + returns (InstancesListEntraIdCertificatesResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/listEntraIdCertificates" + }; + } + + // Partially updates settings of a Cloud SQL instance by merging the request + // with the current configuration. This method supports patch semantics. + rpc Patch(SqlInstancesPatchRequest) returns (Operation) { + option (google.api.http) = { + patch: "/v1/projects/{project}/instances/{instance}" + body: "body" + }; + } + + // Promotes the read replica instance to be an independent Cloud SQL + // primary instance. + // Using this operation might cause your instance to restart. + rpc PromoteReplica(SqlInstancesPromoteReplicaRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/promoteReplica" + }; + } + + // Switches over from the primary instance to the DR replica + // instance. + rpc Switchover(SqlInstancesSwitchoverRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/switchover" + }; + } + + // Deletes all client certificates and generates a new server SSL certificate + // for the instance. + rpc ResetSslConfig(SqlInstancesResetSslConfigRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/resetSslConfig" + }; + } + + // Restarts a Cloud SQL instance. + rpc Restart(SqlInstancesRestartRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/restart" + }; + } + + // Restores a backup of a Cloud SQL instance. Using this operation might cause + // your instance to restart. + rpc RestoreBackup(SqlInstancesRestoreBackupRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/restoreBackup" + body: "body" + }; + } + + // Rotates the server certificate to one signed by the Certificate Authority + // (CA) version previously added with the addServerCA method. For instances + // that have enabled Certificate Authority Service (CAS) based server CA, + // use RotateServerCertificate to rotate the server certificate. + rpc RotateServerCa(SqlInstancesRotateServerCaRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/rotateServerCa" + body: "body" + }; + } + + // Rotates the server certificate version to one previously added with the + // addServerCertificate method. For instances not using Certificate Authority + // Service (CAS) server CA, use RotateServerCa instead. + rpc RotateServerCertificate(SqlInstancesRotateServerCertificateRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/rotateServerCertificate" + body: "body" + }; + } + + // Rotates the server certificate version to one previously added with the + // addEntraIdCertificate method. + rpc RotateEntraIdCertificate(SqlInstancesRotateEntraIdCertificateRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/rotateEntraIdCertificate" + body: "body" + }; + } + + // Starts the replication in the read replica instance. + rpc StartReplica(SqlInstancesStartReplicaRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/startReplica" + }; + } + + // Stops the replication in the read replica instance. + rpc StopReplica(SqlInstancesStopReplicaRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/stopReplica" + }; + } + + // Truncate MySQL general and slow query log tables + // MySQL only. + rpc TruncateLog(SqlInstancesTruncateLogRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/truncateLog" + body: "body" + }; + } + + // Updates settings of a Cloud SQL instance. Using this operation might cause + // your instance to restart. + rpc Update(SqlInstancesUpdateRequest) returns (Operation) { + option (google.api.http) = { + put: "/v1/projects/{project}/instances/{instance}" + body: "body" + }; + } + + // Generates a short-lived X509 certificate containing the provided public key + // and signed by a private key specific to the target instance. Users may use + // the certificate to authenticate as themselves when connecting to the + // database. + rpc CreateEphemeral(SqlInstancesCreateEphemeralCertRequest) + returns (SslCert) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/createEphemeral" + body: "body" + }; + } + + // Reschedules the maintenance on the given instance. + rpc RescheduleMaintenance(SqlInstancesRescheduleMaintenanceRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/rescheduleMaintenance" + body: "body" + }; + } + + // Verify External primary instance external sync settings. + rpc VerifyExternalSyncSettings(SqlInstancesVerifyExternalSyncSettingsRequest) + returns (SqlInstancesVerifyExternalSyncSettingsResponse) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/verifyExternalSyncSettings" + body: "*" + }; + } + + // Start External primary instance migration. + rpc StartExternalSync(SqlInstancesStartExternalSyncRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/startExternalSync" + body: "*" + }; + } + + // Perform Disk Shrink on primary instance. + rpc PerformDiskShrink(SqlInstancesPerformDiskShrinkRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/performDiskShrink" + body: "body" + }; + } + + // Get Disk Shrink Config for a given instance. + rpc GetDiskShrinkConfig(SqlInstancesGetDiskShrinkConfigRequest) + returns (SqlInstancesGetDiskShrinkConfigResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/getDiskShrinkConfig" + }; + } + + // Reset Replica Size to primary instance disk size. + rpc ResetReplicaSize(SqlInstancesResetReplicaSizeRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/resetReplicaSize" + body: "*" + }; + } + + // Get Latest Recovery Time for a given instance. + rpc GetLatestRecoveryTime(SqlInstancesGetLatestRecoveryTimeRequest) + returns (SqlInstancesGetLatestRecoveryTimeResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/getLatestRecoveryTime" + }; + } + + // Execute SQL statements. + rpc ExecuteSql(SqlInstancesExecuteSqlRequest) + returns (SqlInstancesExecuteSqlResponse) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/executeSql" + body: "body" + }; + } + + // Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + rpc AcquireSsrsLease(SqlInstancesAcquireSsrsLeaseRequest) + returns (SqlInstancesAcquireSsrsLeaseResponse) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/acquireSsrsLease" + body: "body" + }; + } + + // Release a lease for the setup of SQL Server Reporting Services (SSRS). + rpc ReleaseSsrsLease(SqlInstancesReleaseSsrsLeaseRequest) + returns (SqlInstancesReleaseSsrsLeaseResponse) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/releaseSsrsLease" + }; + } + + // Execute MVU Pre-checks + rpc PreCheckMajorVersionUpgrade( + SqlInstancesPreCheckMajorVersionUpgradeRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade" + body: "body" + }; + } + + // Point in time restore for an instance managed by Google Cloud Backup and + // Disaster Recovery. + rpc PointInTimeRestore(SqlInstancesPointInTimeRestoreRequest) + returns (Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}:pointInTimeRestore" + body: "context" + }; + } +} + +// Instance add server CA request. +message SqlInstancesAddServerCaRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +// Instance add server certificate request. +message SqlInstancesAddServerCertificateRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +// Instance add Entra ID certificate request. +message SqlInstancesAddEntraIdCertificateRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Instance clone request. +message SqlInstancesCloneRequest { + // Required. The ID of the Cloud SQL instance to be cloned (source). This does + // not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the source Cloud SQL instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + InstancesCloneRequest body = 100 [(google.api.field_behavior) = REQUIRED]; +} + +// Instance delete request. +message SqlInstancesDeleteRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance to be deleted. + string project = 2; + + // Flag to opt-in for final backup. By default, it is turned off. + optional bool enable_final_backup = 7; + + oneof expiration { + // Optional. Retention period of the final backup. + int64 final_backup_ttl_days = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Final Backup expiration time. + // Timestamp in UTC of when this resource is considered expired. + google.protobuf.Timestamp final_backup_expiry_time = 6 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The description of the final backup. + string final_backup_description = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance demote master request. +message SqlInstancesDemoteMasterRequest { + // Cloud SQL instance name. + string instance = 1; + + // ID of the project that contains the instance. + string project = 2; + + InstancesDemoteMasterRequest body = 100; +} + +// Instance demote request. +message SqlInstancesDemoteRequest { + // Required. Cloud SQL instance name. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The request body. + InstancesDemoteRequest body = 100 [(google.api.field_behavior) = REQUIRED]; +} + +// Instance export request. +message SqlInstancesExportRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance to be exported. + string project = 2; + + InstancesExportRequest body = 100; +} + +// Instance failover request. +message SqlInstancesFailoverRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // ID of the project that contains the read replica. + string project = 2; + + InstancesFailoverRequest body = 100; +} + +// Instance get request. +message SqlInstancesGetRequest { + // Required. Database instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Instance import request. +message SqlInstancesImportRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + InstancesImportRequest body = 100; +} + +// Instance insert request. +message SqlInstancesInsertRequest { + // Project ID of the project to which the newly created Cloud SQL instances + // should belong. + string project = 1; + + DatabaseInstance body = 100; +} + +// Instance list request. +message SqlInstancesListRequest { + // A filter expression that filters resources listed in the response. + // The expression is in the form of field:value. For example, + // 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per + // their JSON representation, such as 'settings.userLabels.auto_start:true'. + // + // Multiple filter queries are space-separated. For example. + // 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each + // expression is an AND expression. However, you can include AND and OR + // expressions explicitly. + string filter = 1; + + // The maximum number of instances to return. The service may return fewer + // than this value. + // If unspecified, at most 500 instances are returned. + // The maximum value is 1000; values above 1000 are coerced to 1000. + uint32 max_results = 2; + + // A previously-returned page token representing part of the larger set of + // results to view. + string page_token = 3; + + // Project ID of the project for which to list Cloud SQL instances. + string project = 4; +} + +// Instance list server CAs request. +message SqlInstancesListServerCasRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +// Instance list server certificates request. +message SqlInstancesListServerCertificatesRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Instance list Entra ID certificates request. +message SqlInstancesListEntraIdCertificatesRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Instance patch request. +message SqlInstancesPatchRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + DatabaseInstance body = 100; +} + +// Instance promote replica request. +message SqlInstancesPromoteReplicaRequest { + // Cloud SQL read replica instance name. + string instance = 1; + + // ID of the project that contains the read replica. + string project = 2; + + // Set to true to invoke a replica failover to the DR + // replica. As part of replica failover, the promote operation attempts + // to add the original primary instance as a replica of the promoted + // DR replica when the original primary instance comes back online. + // If set to false or not specified, then the original primary + // instance becomes an independent Cloud SQL primary instance. + bool failover = 3; +} + +// Instance switchover request. +message SqlInstancesSwitchoverRequest { + // Cloud SQL read replica instance name. + string instance = 1; + + // ID of the project that contains the replica. + string project = 2; + + // Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations + // timeout, which is a sum of all database operations. Default value is 10 + // minutes and can be modified to a maximum value of 24 hours. + google.protobuf.Duration db_timeout = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance reset SSL config request. +message SqlInstancesResetSslConfigRequest { + // Reset SSL mode to selectively refresh the SSL materials. + enum ResetSslMode { + // Reset SSL mode is not specified. + RESET_SSL_MODE_UNSPECIFIED = 0; + + // Refresh all TLS configs. This is the default behaviour. + ALL = 1; + + // Refreshes the replication-related TLS configuration settings provided by + // the primary instance. + // Not applicable to on-premises replication instances. + SYNC_FROM_PRIMARY = 2; + } + + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Optional. Reset SSL mode to use. + ResetSslMode mode = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance restart request. +message SqlInstancesRestartRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance to be restarted. + string project = 2; +} + +// Instance restore backup request. +message SqlInstancesRestoreBackupRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + InstancesRestoreBackupRequest body = 100; +} + +// Instance rotate server CA request. +message SqlInstancesRotateServerCaRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + InstancesRotateServerCaRequest body = 100; +} + +// Instance rotate server certificate request. +message SqlInstancesRotateServerCertificateRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Rotate server certificate request body. + InstancesRotateServerCertificateRequest body = 100 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance rotate server certificate request. +message SqlInstancesRotateEntraIdCertificateRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Rotate Entra ID certificate request body. + InstancesRotateEntraIdCertificateRequest body = 100 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance start replica request. +message SqlInstancesStartReplicaRequest { + // Cloud SQL read replica instance name. + string instance = 1; + + // ID of the project that contains the read replica. + string project = 2; +} + +// Instance stop replica request. +message SqlInstancesStopReplicaRequest { + // Cloud SQL read replica instance name. + string instance = 1; + + // ID of the project that contains the read replica. + string project = 2; +} + +// Instance truncate log request. +message SqlInstancesTruncateLogRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the Cloud SQL project. + string project = 2; + + InstancesTruncateLogRequest body = 100; +} + +// Instance perform disk shrink request. +message SqlInstancesPerformDiskShrinkRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Perform disk shrink context. + PerformDiskShrinkContext body = 100; +} + +// Instance update request. +message SqlInstancesUpdateRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + DatabaseInstance body = 100; +} + +// Instance reschedule maintenance request. +message SqlInstancesRescheduleMaintenanceRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // ID of the project that contains the instance. + string project = 2; + + SqlInstancesRescheduleMaintenanceRequestBody body = 100; +} + +// Instance reencrypt request. +message SqlInstancesReencryptRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // ID of the project that contains the instance. + string project = 2; + + // Reencrypt body that users request + InstancesReencryptRequest body = 3; +} + +// Database Instance reencrypt request. +message InstancesReencryptRequest { + // Configuration specific to backup re-encryption + optional BackupReencryptionConfig backup_reencryption_config = 1; +} + +// Backup Reencryption Config +message BackupReencryptionConfig { + // Backup type for re-encryption + enum BackupType { + // Unknown backup type, will be defaulted to AUTOMATIC backup type + BACKUP_TYPE_UNSPECIFIED = 0; + + // Reencrypt automatic backups + AUTOMATED = 1; + + // Reencrypt on-demand backups + ON_DEMAND = 2; + } + + // Backup re-encryption limit + optional int32 backup_limit = 1; + + // Type of backups users want to re-encrypt. + optional BackupType backup_type = 2; +} + +// External Sync parallel level. +enum ExternalSyncParallelLevel { + // Unknown sync parallel level. Will be defaulted to OPTIMAL. + EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED = 0; + + // Minimal parallel level. + MIN = 1; + + // Optimal parallel level. + OPTIMAL = 2; + + // Maximum parallel level. + MAX = 3; +} + +// The selected object that Cloud SQL migrates. +message ExternalSyncSelectedObject { + // The name of the database that Cloud SQL migrates. + string database = 1; +} + +// Instance get disk shrink config request. +message SqlInstancesGetDiskShrinkConfigRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +// Instance verify external sync settings request. +message SqlInstancesVerifyExternalSyncSettingsRequest { + enum ExternalSyncMode { + // Unknown external sync mode, will be defaulted to ONLINE mode + EXTERNAL_SYNC_MODE_UNSPECIFIED = 0; + + // Online external sync will set up replication after initial data external + // sync + ONLINE = 1; + + // Offline external sync only dumps and loads a one-time snapshot of + // the primary instance's data + OFFLINE = 2; + } + + // MigrationType determines whether the migration is a physical file-based + // migration or a logical dump file-based migration. + enum MigrationType { + // Default value is a logical dump file-based migration + MIGRATION_TYPE_UNSPECIFIED = 0; + + // Logical dump file-based migration + LOGICAL = 1; + + // Physical file-based migration + PHYSICAL = 2; + } + + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Flag to enable verifying connection only + bool verify_connection_only = 3; + + // External sync mode + ExternalSyncMode sync_mode = 4; + + // Optional. Flag to verify settings required by replication setup only + bool verify_replication_only = 5 [(google.api.field_behavior) = OPTIONAL]; + + oneof sync_config { + // Optional. MySQL-specific settings for start external sync. + MySqlSyncConfig mysql_sync_config = 6 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. MigrationType configures the migration to use physical files or + // logical dump files. If not set, then the logical dump file configuration is + // used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + MigrationType migration_type = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Parallel level for initial data sync. Only applicable for + // PostgreSQL. + ExternalSyncParallelLevel sync_parallel_level = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Migrate only the specified objects from the source instance. If + // this field is empty, then migrate all objects. + repeated ExternalSyncSelectedObject selected_objects = 9 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance start external sync request. +message SqlInstancesStartExternalSyncRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // ID of the project that contains the instance. + string project = 2; + + // External sync mode. + SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode sync_mode = 3; + + // Whether to skip the verification step (VESS). + bool skip_verification = 4; + + oneof sync_config { + // MySQL-specific settings for start external sync. + MySqlSyncConfig mysql_sync_config = 6; + } + + // Optional. Parallel level for initial data sync. Currently only applicable + // for MySQL. + ExternalSyncParallelLevel sync_parallel_level = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. MigrationType configures the migration to use physical files or + // logical dump files. If not set, then the logical dump file configuration is + // used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType migration_type = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. MySQL only. True if end-user has confirmed that this SES call + // will wipe replica databases overlapping with the proposed selected_objects. + // If this field is not set and there are both overlapping and additional + // databases proposed, an error will be returned. + bool replica_overwrite_enabled = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance reset replica size request. +message SqlInstancesResetReplicaSizeRequest { + // Cloud SQL read replica instance name. + string instance = 1; + + // ID of the project that contains the read replica. + string project = 2; +} + +// Instance create ephemeral certificate request. +message SqlInstancesCreateEphemeralCertRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the Cloud SQL project. + string project = 2; + + SslCertsCreateEphemeralRequest body = 100; +} + +// Database instance clone request. +message InstancesCloneRequest { + // Required. Contains details about the clone operation. + CloneContext clone_context = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Database demote primary instance request. +message InstancesDemoteMasterRequest { + // Contains details about the demoteMaster operation. + DemoteMasterContext demote_master_context = 1; +} + +// This request is used to demote an existing standalone instance to be a +// Cloud SQL read replica for an external database server. +message InstancesDemoteRequest { + // Required. Contains details about the demote operation. + DemoteContext demote_context = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Database instance export request. +message InstancesExportRequest { + // Contains details about the export operation. + ExportContext export_context = 1; +} + +// Instance failover request. +message InstancesFailoverRequest { + // Failover Context. + FailoverContext failover_context = 1; +} + +// SslCerts create ephemeral certificate request. +message SslCertsCreateEphemeralRequest { + // PEM encoded public key to include in the signed certificate. + string public_key = 1 [json_name = "public_key"]; + + // Access token to include in the signed certificate. + string access_token = 2 [json_name = "access_token"]; +} + +// Database instance import request. +message InstancesImportRequest { + // Contains details about the import operation. + ImportContext import_context = 1; +} + +// Request for Pre-checks for MVU +message InstancesPreCheckMajorVersionUpgradeRequest { + // Required. Contains details about the pre-check major version upgrade + // operation. + PreCheckMajorVersionUpgradeContext pre_check_major_version_upgrade_context = 1 + [(google.api.field_behavior) = REQUIRED]; +} + +// Database instances list response. +message InstancesListResponse { + // This is always `sql#instancesList`. + string kind = 1; + + // List of warnings that occurred while handling the request. + repeated ApiWarning warnings = 2; + + // List of database instance resources. + repeated DatabaseInstance items = 3; + + // The continuation token, used to page through large result sets. Provide + // this value in a subsequent request to return the next page of results. + string next_page_token = 4; +} + +// Instances ListServerCas response. +message InstancesListServerCasResponse { + // List of server CA certificates for the instance. + repeated SslCert certs = 1; + + string active_version = 2; + + // This is always `sql#instancesListServerCas`. + string kind = 3; +} + +// Instances ListServerCertificates response. +message InstancesListServerCertificatesResponse { + // List of server CA certificates for the instance. + repeated SslCert ca_certs = 1; + + // List of server certificates for the instance, signed by the corresponding + // CA from the `ca_certs` list. + repeated SslCert server_certs = 2; + + // The `sha1_fingerprint` of the active certificate from `server_certs`. + string active_version = 3; + + // This is always `sql#instancesListServerCertificates`. + string kind = 4; +} + +// Instances ListEntraIdCertificates response. +message InstancesListEntraIdCertificatesResponse { + // List of Entra ID certificates for the instance. + repeated SslCert certs = 1; + + // The `sha1_fingerprint` of the active certificate from `certs`. + string active_version = 2; + + // This is always `sql#instancesListEntraIdCertificates`. + string kind = 3; +} + +// Database instance restore backup request. +message InstancesRestoreBackupRequest { + // Parameters required to perform the restore backup operation. + RestoreBackupContext restore_backup_context = 1; + + // The name of the backup that's used to restore a Cloud SQL instance: + // Format: projects/{project-id}/backups/{backup-uid}. Only one of + // restore_backup_context, backup, backupdr_backup can be passed to the input. + string backup = 2 [ + (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } + ]; + + // The name of the backup that's used to restore a Cloud SQL instance: + // Format: + // "projects/{project-id}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup-uid}". + // Only one of restore_backup_context, backup, backupdr_backup can be + // passed to the input. + string backupdr_backup = 4 [ + (google.api.resource_reference) = { type: "backupdr.googleapis.com/Backup" } + ]; + + // Optional. By using this parameter, Cloud SQL overrides any instance + // settings stored in the backup you are restoring from. You can't change the + // instance's major database version and you can only increase the disk size. + // You can use this field to restore new instances only. This field is not + // applicable for restore to existing instances. + DatabaseInstance restore_instance_settings = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. This field has the same purpose as restore_instance_settings, + // changes any instance settings stored in the backup you are restoring from. + // With the difference that these fields are cleared in the settings. + repeated string restore_instance_clear_overrides_field_names = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Rotate server CA request. +message InstancesRotateServerCaRequest { + // Contains details about the rotate server CA operation. + RotateServerCaContext rotate_server_ca_context = 1; +} + +// Rotate server certificate request. +message InstancesRotateServerCertificateRequest { + // Optional. Contains details about the rotate server certificate operation. + RotateServerCertificateContext rotate_server_certificate_context = 1 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Rotate Entra ID certificate request. +message InstancesRotateEntraIdCertificateRequest { + // Optional. Contains details about the rotate server certificate operation. + RotateEntraIdCertificateContext rotate_entra_id_certificate_context = 1 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance truncate log request. +message InstancesTruncateLogRequest { + // Contains details about the truncate log operation. + TruncateLogContext truncate_log_context = 1; +} + +// Request to acquire a lease for SSRS. +message InstancesAcquireSsrsLeaseRequest { + // Contains details about the acquire SSRS lease operation. + AcquireSsrsLeaseContext acquire_ssrs_lease_context = 1; +} + +// Request for Pre-checks for MVU +message SqlInstancesPreCheckMajorVersionUpgradeRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The context for request to perform the pre-check major version + // upgrade operation. + InstancesPreCheckMajorVersionUpgradeRequest body = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Instance verify external sync settings response. +message SqlInstancesVerifyExternalSyncSettingsResponse { + // This is always `sql#migrationSettingErrorList`. + string kind = 1; + + // List of migration violations. + repeated SqlExternalSyncSettingError errors = 2; + + // List of migration warnings. + repeated SqlExternalSyncSettingError warnings = 3; +} + +// Instance get disk shrink config response. +message SqlInstancesGetDiskShrinkConfigResponse { + // This is always `sql#getDiskShrinkConfig`. + string kind = 1; + + // The minimum size to which a disk can be shrunk in GigaBytes. + int64 minimal_target_size_gb = 2; + + // Additional message to customers. + string message = 3; +} + +// Instance get latest recovery time request. +message SqlInstancesGetLatestRecoveryTimeRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // The timestamp used to identify the time when the source instance is + // deleted. If this instance is deleted, then you must set the timestamp. + optional google.protobuf.Timestamp source_instance_deletion_time = 3; +} + +// Instance get latest recovery time response. +message SqlInstancesGetLatestRecoveryTimeResponse { + // This is always `sql#getLatestRecoveryTime`. + string kind = 1; + + // Timestamp, identifies the latest recovery time of the source instance. + google.protobuf.Timestamp latest_recovery_time = 2; + + // Timestamp, identifies the earliest recovery time of the source instance. + google.protobuf.Timestamp earliest_recovery_time = 3; +} + +// Database instance clone context. +message CloneContext { + // This is always `sql#cloneContext`. + string kind = 1; + + // Reserved for future use. + int64 pitr_timestamp_ms = 2; + + // Required. Name of the Cloud SQL instance to be created as a clone. + string destination_instance_name = 3 [(google.api.field_behavior) = REQUIRED]; + + // Binary log coordinates, if specified, identify the position up to which the + // source instance is cloned. If not specified, the source instance is + // cloned up to the most recent binary log coordinates. + BinLogCoordinates bin_log_coordinates = 4; + + // Timestamp, if specified, identifies the time to which the source instance + // is cloned. + google.protobuf.Timestamp point_in_time = 5; + + // The name of the allocated ip range for the private ip Cloud SQL instance. + // For example: "google-managed-services-default". If set, the cloned instance + // ip will be created in the allocated range. The range name must comply with + // [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name + // must be 1-63 characters long and match the regular expression + // [a-z]([-a-z0-9]*[a-z0-9])?. + // Reserved for future use. + string allocated_ip_range = 6; + + // (SQL Server only) Clone only the specified databases from the source + // instance. Clone all databases if empty. + repeated string database_names = 9; + + // Optional. Copy clone and point-in-time recovery clone of an instance to the + // specified zone. If no zone is specified, clone to the same primary zone as + // the source instance. This field applies to all DB types. + optional string preferred_zone = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Copy clone and point-in-time recovery clone of a regional + // instance in the specified zones. If not specified, clone to the same + // secondary zone as the source instance. This value cannot be the same as the + // preferred_zone field. This field applies to all DB types. + optional string preferred_secondary_zone = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // The timestamp used to identify the time when the source instance is + // deleted. If this instance is deleted, then you must set the timestamp. + optional google.protobuf.Timestamp source_instance_deletion_time = 12; + + // Optional. The project ID of the destination project where the cloned + // instance will be created. To perform a cross-project clone, this field is + // required. If not specified, the clone is created in the same project + // as the source instance. + optional string destination_project = 13 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The fully qualified URI of the VPC network to which the cloned + // instance will be connected via Private Services Access for private IP. For + // example:`projects/my-network-project/global/networks/my-network`. This + // field is only required for cross-project cloning. + optional string destination_network = 14 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; +} + +// The context to perform a point-in-time recovery of an instance managed by +// Backup and Disaster Recovery (DR) Service. +message PointInTimeRestoreContext { + // The Backup and Disaster Recovery (DR) Service Datasource URI. + // Format: + // projects/{project}/locations/{region}/backupVaults/{backupvault}/dataSources/{datasource}. + optional string datasource = 1; + + // Required. The date and time to which you want to restore the instance. + google.protobuf.Timestamp point_in_time = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Target instance name. + optional string target_instance = 3; + + // Optional. The resource link for the VPC network from which the Cloud SQL + // instance is accessible for private IP. For example, + // `/projects/myProject/global/networks/default`. + optional string private_network = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the allocated IP range for the internal IP Cloud SQL + // instance. For example: "google-managed-services-default". If you set this, + // then Cloud SQL creates the IP address for the cloned instance in the + // allocated range. This range must comply with [RFC + // 1035](https://tools.ietf.org/html/rfc1035) standards. Specifically, the + // name must be 1-63 characters long and match the regular expression + // [a-z]([-a-z0-9]*[a-z0-9])?. Reserved for future use. + optional string allocated_ip_range = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Point-in-time recovery of an instance to the specified zone. If + // no zone is specified, then clone to the same primary zone as the source + // instance. + optional string preferred_zone = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Point-in-time recovery of a regional instance in the specified + // zones. If not specified, clone to the same secondary zone as the source + // instance. This value cannot be the same as the preferred_zone field. + optional string preferred_secondary_zone = 9 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the instance settings that will be overridden from the + // source instance. This field is only applicable for cross project PITRs. + DatabaseInstance target_instance_settings = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the instance settings that will be cleared from the + // source instance. This field is only applicable for cross project PITRs. + repeated string target_instance_clear_settings_field_names = 12 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The region of the target instance where the datasource will be + // restored. For example: "us-central1". + optional string region = 13 [(google.api.field_behavior) = OPTIONAL]; +} + +// Binary log coordinates. +message BinLogCoordinates { + // Name of the binary log file for a Cloud SQL instance. + string bin_log_file_name = 1; + + // Position (offset) within the binary log file. + int64 bin_log_position = 2; + + // This is always `sql#binLogCoordinates`. + string kind = 3; +} + +// A Cloud SQL instance resource. +message DatabaseInstance { + // The current serving state of the database instance. + enum SqlInstanceState { + // The state of the instance is unknown. + SQL_INSTANCE_STATE_UNSPECIFIED = 0; + + // The instance is running, or has been stopped by owner. + RUNNABLE = 1; + + // The instance is not available, for example due to problems with billing. + SUSPENDED = 2; + + // The instance is being deleted. + PENDING_DELETE = 3; + + // The instance is being created. + PENDING_CREATE = 4; + + // The instance is down for maintenance. + MAINTENANCE = 5; + + // The creation of the instance failed or a fatal error occurred during + // maintenance. + FAILED = 6; + + // Deprecated + ONLINE_MAINTENANCE = 7 [deprecated = true]; + + // (Applicable to read pool nodes only.) The read pool node needs to be + // repaired. The database might be unavailable. + REPAIRING = 8; + } + + message SqlFailoverReplica { + // The name of the failover replica. If specified at instance creation, a + // failover replica is created for the instance. The name + // doesn't include the project ID. + string name = 1; + + // The availability status of the failover replica. A false status indicates + // that the failover replica is out of sync. The primary instance can only + // failover to the failover replica when the status is true. + google.protobuf.BoolValue available = 2; + } + + // Any scheduled maintenance for this instance. + message SqlScheduledMaintenance { + // The start time of any upcoming scheduled maintenance for this instance. + google.protobuf.Timestamp start_time = 1; + + bool can_defer = 2 [deprecated = true]; + + // If the scheduled maintenance can be rescheduled. + bool can_reschedule = 3; + + // Maintenance cannot be rescheduled to start beyond this deadline. + optional google.protobuf.Timestamp schedule_deadline_time = 4; + } + + // This message wraps up the information written by out-of-disk detection job. + message SqlOutOfDiskReport { + // This enum lists all possible states regarding out-of-disk issues. + enum SqlOutOfDiskState { + // Unspecified state + SQL_OUT_OF_DISK_STATE_UNSPECIFIED = 0; + + // The instance has plenty space on data disk + NORMAL = 1; + + // Data disk is almost used up. It is shutdown to prevent data + // corruption. + SOFT_SHUTDOWN = 2; + } + + // This field represents the state generated by the proactive database + // wellness job for OutOfDisk issues. + // * Writers: + // * the proactive database wellness job for OOD. + // * Readers: + // * the proactive database wellness job + optional SqlOutOfDiskState sql_out_of_disk_state = 1; + + // The minimum recommended increase size in GigaBytes + // This field is consumed by the frontend + // * Writers: + // * the proactive database wellness job for OOD. + // * Readers: + optional int32 sql_min_recommended_increase_size_gb = 2; + } + + // The SQL network architecture for the instance. + enum SqlNetworkArchitecture { + SQL_NETWORK_ARCHITECTURE_UNSPECIFIED = 0; + + // The instance uses the new network architecture. + NEW_NETWORK_ARCHITECTURE = 1; + + // The instance uses the old network architecture. + OLD_NETWORK_ARCHITECTURE = 2; + } + + // Details of a single read pool node of a read pool. + message PoolNodeConfig { + // Output only. The name of the read pool node, to be used for retrieving + // metrics and logs. + optional string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The zone of the read pool node. + optional string gce_zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Mappings containing IP addresses that can be used to connect + // to the read pool node. + repeated IpMapping ip_addresses = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The DNS name of the read pool node. + optional string dns_name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the read pool node. + optional SqlInstanceState state = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of DNS names used by this read pool node. + repeated DnsNameMapping dns_names = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Private Service Connect (PSC) service attachment of the + // read pool node. + optional string psc_service_attachment_link = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of settings for requested automatically-setup + // Private Service Connect (PSC) consumer endpoints that can be used to + // connect to this read pool node. + repeated PscAutoConnectionConfig psc_auto_connections = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // This is always `sql#instance`. + string kind = 1; + + // The current serving state of the Cloud SQL instance. + SqlInstanceState state = 2; + + // The database engine type and version. The `databaseVersion` field cannot + // be changed after instance creation. + SqlDatabaseVersion database_version = 3; + + // The user settings. + Settings settings = 4; + + // This field is deprecated and will be removed from a future version of the + // API. Use the `settings.settingsVersion` field instead. + string etag = 5; + + // The name and status of the failover replica. + SqlFailoverReplica failover_replica = 6; + + // The name of the instance which will act as primary in the replication + // setup. + string master_instance_name = 7; + + // The replicas of the instance. + repeated string replica_names = 8; + + // The maximum disk size of the instance in bytes. + google.protobuf.Int64Value max_disk_size = 9 [deprecated = true]; + + // The current disk usage of the instance in bytes. This property has been + // deprecated. Use the + // "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud + // Monitoring API instead. Please see [this + // announcement](https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ) + // for details. + google.protobuf.Int64Value current_disk_size = 10 [deprecated = true]; + + // The assigned IP addresses for the instance. + repeated IpMapping ip_addresses = 11; + + // SSL configuration. + SslCert server_ca_cert = 12; + + // The instance type. + SqlInstanceType instance_type = 13; + + // The project ID of the project containing the Cloud SQL instance. The Google + // apps domain is prefixed if applicable. + string project = 14; + + // The IPv6 address assigned to the instance. + // (Deprecated) This property was applicable only + // to First Generation instances. + string ipv6_address = 15 [deprecated = true]; + + // The service account email address assigned to the instance.\This + // property is read-only. + string service_account_email_address = 16; + + // Configuration specific to on-premises instances. + OnPremisesConfiguration on_premises_configuration = 17; + + // Configuration specific to failover replicas and read replicas. + ReplicaConfiguration replica_configuration = 18; + + // The backend type. + // `SECOND_GEN`: Cloud SQL database instance. + // `EXTERNAL`: A database server that is not managed by Google. + // + // This property is read-only; use the `tier` property in the `settings` + // object to determine the database type. + SqlBackendType backend_type = 19; + + // The URI of this resource. + string self_link = 20; + + // If the instance state is SUSPENDED, the reason for the suspension. + repeated SqlSuspensionReason suspension_reason = 21; + + // Connection name of the Cloud SQL instance used in connection strings. + string connection_name = 22; + + // Name of the Cloud SQL instance. This does not include the project ID. + string name = 23; + + // The geographical region of the Cloud SQL instance. + // + // It can be one of the + // [regions](https://cloud.google.com/sql/docs/mysql/locations#location-r) + // where Cloud SQL operates: + // + // For example, `asia-east1`, `europe-west1`, and `us-central1`. + // The default value is `us-central1`. + string region = 24; + + // The Compute Engine zone that the instance is currently serving from. This + // value could be different from the zone that was specified when the instance + // was created if the instance has failed over to its secondary zone. WARNING: + // Changing this might restart the instance. + string gce_zone = 25; + + // The Compute Engine zone that the failover instance is currently serving + // from for a regional instance. This value could be different + // from the zone that was specified when the instance + // was created if the instance has failed over to its secondary/failover zone. + string secondary_gce_zone = 34; + + // Disk encryption configuration specific to an instance. + DiskEncryptionConfiguration disk_encryption_configuration = 26; + + // Disk encryption status specific to an instance. + DiskEncryptionStatus disk_encryption_status = 27; + + // Initial root password. Use only on creation. You must set root passwords + // before you can connect to PostgreSQL instances. + string root_password = 29; + + // The start time of any upcoming scheduled maintenance for this instance. + SqlScheduledMaintenance scheduled_maintenance = 30; + + // This status indicates whether the instance satisfies PZS. + // + // The status is reserved for future use. + google.protobuf.BoolValue satisfies_pzs = 35; + + // Output only. Stores the current database version running on the instance + // including minor version such as `MYSQL_8_0_18`. + string database_installed_version = 40 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // This field represents the report generated by the proactive database + // wellness job for OutOfDisk issues. + // * Writers: + // * the proactive database wellness job for OOD. + // * Readers: + // * the proactive database wellness job + optional SqlOutOfDiskReport out_of_disk_report = 38; + + // Output only. The time when the instance was created in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp create_time = 39 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. List all maintenance versions applicable on the instance + repeated string available_maintenance_versions = 41 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The current software version on the instance. + string maintenance_version = 42; + + // Output only. All database versions that are available for upgrade. + repeated AvailableDatabaseVersion upgradable_database_versions = 45 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + optional SqlNetworkArchitecture sql_network_architecture = 47; + + // Output only. The link to service attachment of PSC instance. + optional string psc_service_attachment_link = 48 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The dns name of the instance. + optional string dns_name = 49 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. DEPRECATED: please use write_endpoint instead. + optional string primary_dns_name = 51 + [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The dns name of the primary instance in a replication group. + optional string write_endpoint = 52 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. A primary instance and disaster recovery (DR) replica pair. + // A DR replica is a cross-region replica that you designate + // for failover in the event that the primary instance + // experiences regional failure. + // Applicable to MySQL and PostgreSQL. + ReplicationCluster replication_cluster = 54 + [(google.api.field_behavior) = OPTIONAL]; + + // Gemini instance configuration. + optional GeminiInstanceConfig gemini_config = 55; + + // Output only. This status indicates whether the instance satisfies PZI. + // + // The status is reserved for future use. + google.protobuf.BoolValue satisfies_pzi = 56 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input only. Whether Cloud SQL is enabled to switch storing point-in-time + // recovery log files from a data disk to Cloud Storage. + optional google.protobuf.BoolValue + switch_transaction_logs_to_cloud_storage_enabled = 57 + [(google.api.field_behavior) = INPUT_ONLY]; + + // Input only. Determines whether an in-place major version upgrade of + // replicas happens when an in-place major version upgrade of a primary + // instance is initiated. + optional google.protobuf.BoolValue + include_replicas_for_major_version_upgrade = 59 + [(google.api.field_behavior) = INPUT_ONLY]; + + // Optional. Input only. Immutable. Tag keys and tag values that are bound to + // this instance. You must represent each item in the map as: + // `"" : ""`. + // + // For example, a single resource can have the following tags: + // ``` + // "123/environment": "production", + // "123/costCenter": "marketing", + // ``` + // + // For more information on tag creation and management, see + // https://cloud.google.com/resource-manager/docs/tags/tags-overview. + map tags = 60 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OPTIONAL + ]; + + // The number of read pool nodes in a read pool. + optional int32 node_count = 63; + + // Output only. Entries containing information about each read pool node of + // the read pool. + repeated PoolNodeConfig nodes = 64 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of DNS names used by this instance. + repeated DnsNameMapping dns_names = 67 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Gemini instance configuration. +message GeminiInstanceConfig { + // Output only. Whether Gemini is enabled. + optional bool entitled = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether the vacuum management is enabled. + optional bool google_vacuum_mgmt_enabled = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether canceling the out-of-memory (OOM) session is enabled. + optional bool oom_session_cancel_enabled = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether the active query is enabled. + optional bool active_query_enabled = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether the index advisor is enabled. + optional bool index_advisor_enabled = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether the flag recommender is enabled. + optional bool flag_recommender_enabled = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A primary instance and disaster recovery (DR) replica pair. +// A DR replica is a cross-region replica that you designate for failover in +// the event that the primary instance experiences regional failure. +// Applicable to MySQL and PostgreSQL. +message ReplicationCluster { + // Output only. If set, this field indicates this instance has a private + // service access (PSA) DNS endpoint that is pointing to the primary instance + // of the cluster. If this instance is the primary, then the DNS endpoint + // points to this instance. After a switchover or replica failover operation, + // this DNS endpoint points to the promoted instance. This is a read-only + // field, returned to the user as information. This field can exist even if a + // standalone instance doesn't have a DR replica yet or the DR replica is + // deleted. + string psa_write_endpoint = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. If the instance is a primary instance, then this field identifies + // the disaster recovery (DR) replica. A DR replica is an optional + // configuration for Enterprise Plus edition instances. If the instance is a + // read replica, then the field is not set. Set this field to a replica name + // to designate a DR replica for a primary instance. Remove the replica name + // to remove the DR replica designation. + string failover_dr_replica_name = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Read-only field that indicates whether the replica is a DR + // replica. This field is not set if the instance is a primary instance. + bool dr_replica = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// An available database version. It can be a major or a minor version. +message AvailableDatabaseVersion { + // The version's major version name. + optional string major_version = 3; + + // The database version name. For MySQL 8.0, this string provides the database + // major and minor version. + optional string name = 8; + + // The database version's display name. + optional string display_name = 9; +} + +// Reschedule options for maintenance windows. +message SqlInstancesRescheduleMaintenanceRequestBody { + enum RescheduleType { + RESCHEDULE_TYPE_UNSPECIFIED = 0; + + // Reschedules maintenance to happen now (within 5 minutes). + IMMEDIATE = 1; + + // Reschedules maintenance to occur within one week from the originally + // scheduled day and time. + NEXT_AVAILABLE_WINDOW = 2; + + // Reschedules maintenance to a specific time and day. + SPECIFIC_TIME = 3; + } + + message Reschedule { + // Required. The type of the reschedule. + RescheduleType reschedule_type = 1; + + // Optional. Timestamp when the maintenance shall be rescheduled to if + // reschedule_type=SPECIFIC_TIME, in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp schedule_time = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. The type of the reschedule the user wants. + Reschedule reschedule = 3; +} + +// Database instance demote primary instance context. +message DemoteMasterContext { + // This is always `sql#demoteMasterContext`. + string kind = 1; + + // Verify the GTID consistency for demote operation. Default value: + // `True`. Setting this flag to `false` enables you to bypass the GTID + // consistency check between on-premises primary instance and Cloud SQL + // instance during the demotion operation but also exposes you to the risk of + // future replication failures. Change the value only if you know the reason + // for the GTID divergence and are confident that doing so will not cause any + // replication issues. + google.protobuf.BoolValue verify_gtid_consistency = 2; + + // The name of the instance which will act as on-premises primary instance + // in the replication setup. + string master_instance_name = 3; + + // Configuration specific to read-replicas replicating from the on-premises + // primary instance. + DemoteMasterConfiguration replica_configuration = 4; + + // Flag to skip replication setup on the instance. + bool skip_replication_setup = 5; +} + +// This context is used to demote an existing standalone instance to be +// a Cloud SQL read replica for an external database server. +message DemoteContext { + // This is always `sql#demoteContext`. + string kind = 1; + + // Required. The name of the instance which acts as the on-premises primary + // instance in the replication setup. + string source_representative_instance_name = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Database instance failover context. +message FailoverContext { + // The current settings version of this instance. Request will be rejected if + // this version doesn't match the current settings version. + int64 settings_version = 1; + + // This is always `sql#failoverContext`. + string kind = 2; +} + +// Database instance restore from backup context. +// Backup context contains source instance id and project id. +message RestoreBackupContext { + // This is always `sql#restoreBackupContext`. + string kind = 1; + + // The ID of the backup run to restore from. + int64 backup_run_id = 2; + + // The ID of the instance that the backup was taken from. + string instance_id = 3; + + // The full project ID of the source instance. + string project = 4; +} + +// Instance rotate server CA context. +message RotateServerCaContext { + // This is always `sql#rotateServerCaContext`. + string kind = 1; + + // The fingerprint of the next version to be rotated to. If left unspecified, + // will be rotated to the most recently added server CA version. + string next_version = 2; +} + +// Instance rotate server certificate context. +message RotateServerCertificateContext { + // Optional. This is always `sql#rotateServerCertificateContext`. + string kind = 1 [(google.api.field_behavior) = OPTIONAL]; + + // The fingerprint of the next version to be rotated to. If left unspecified, + // will be rotated to the most recently added server certificate version. + string next_version = 2; +} + +// Instance rotate Entra ID certificate context. +message RotateEntraIdCertificateContext { + // Optional. This is always `sql#rotateEntraIdCertificateContext`. + string kind = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The fingerprint of the next version to be rotated to. If left + // unspecified, will be rotated to the most recently added server certificate + // version. + string next_version = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Database Instance truncate log context. +message TruncateLogContext { + // This is always `sql#truncateLogContext`. + string kind = 1; + + // The type of log to truncate. Valid values are `MYSQL_GENERAL_TABLE` and + // `MYSQL_SLOW_TABLE`. + string log_type = 2; +} + +// External primary instance migration setting error/warning. +message SqlExternalSyncSettingError { + enum SqlExternalSyncSettingErrorType { + SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED = 0; + + CONNECTION_FAILURE = 1; + + BINLOG_NOT_ENABLED = 2; + + INCOMPATIBLE_DATABASE_VERSION = 3; + + REPLICA_ALREADY_SETUP = 4; + + // The replication user is missing privileges that are required. + INSUFFICIENT_PRIVILEGE = 5; + + // Unsupported migration type. + UNSUPPORTED_MIGRATION_TYPE = 6; + + // No pglogical extension installed on databases, applicable for postgres. + NO_PGLOGICAL_INSTALLED = 7; + + // pglogical node already exists on databases, applicable for postgres. + PGLOGICAL_NODE_ALREADY_EXISTS = 8; + + // The value of parameter wal_level is not set to logical. + INVALID_WAL_LEVEL = 9; + + // The value of parameter shared_preload_libraries does not include + // pglogical. + INVALID_SHARED_PRELOAD_LIBRARY = 10; + + // The value of parameter max_replication_slots is not sufficient. + INSUFFICIENT_MAX_REPLICATION_SLOTS = 11; + + // The value of parameter max_wal_senders is not sufficient. + INSUFFICIENT_MAX_WAL_SENDERS = 12; + + // The value of parameter max_worker_processes is not sufficient. + INSUFFICIENT_MAX_WORKER_PROCESSES = 13; + + // Extensions installed are either not supported or having unsupported + // versions. + UNSUPPORTED_EXTENSIONS = 14; + + // The value of parameter rds.logical_replication is not set to 1. + INVALID_RDS_LOGICAL_REPLICATION = 15; + + // The primary instance logging setup doesn't allow EM sync. + INVALID_LOGGING_SETUP = 16; + + // The primary instance database parameter setup doesn't allow EM sync. + INVALID_DB_PARAM = 17; + + // The gtid_mode is not supported, applicable for MySQL. + UNSUPPORTED_GTID_MODE = 18; + + // SQL Server Agent is not running. + SQLSERVER_AGENT_NOT_RUNNING = 19; + + // The table definition is not support due to missing primary key or replica + // identity, applicable for postgres. Note that this is a warning and won't + // block the migration. + UNSUPPORTED_TABLE_DEFINITION = 20; + + // The customer has a definer that will break EM setup. + UNSUPPORTED_DEFINER = 21; + + // SQL Server @@SERVERNAME does not match actual host name. + SQLSERVER_SERVERNAME_MISMATCH = 22; + + // The primary instance has been setup and will fail the setup. + PRIMARY_ALREADY_SETUP = 23; + + // The primary instance has unsupported binary log format. + UNSUPPORTED_BINLOG_FORMAT = 24; + + // The primary instance's binary log retention setting. + BINLOG_RETENTION_SETTING = 25; + + // The primary instance has tables with unsupported storage engine. + UNSUPPORTED_STORAGE_ENGINE = 26; + + // Source has tables with limited support + // eg: PostgreSQL tables without primary keys. + LIMITED_SUPPORT_TABLES = 27; + + // The replica instance contains existing data. + EXISTING_DATA_IN_REPLICA = 28; + + // The replication user is missing privileges that are optional. + MISSING_OPTIONAL_PRIVILEGES = 29; + + // Additional BACKUP_ADMIN privilege is granted to the replication user + // which may lock source MySQL 8 instance for DDLs during initial sync. + RISKY_BACKUP_ADMIN_PRIVILEGE = 30; + + // The Cloud Storage bucket is missing necessary permissions. + INSUFFICIENT_GCS_PERMISSIONS = 31; + + // The Cloud Storage bucket has an error in the file or contains invalid + // file information. + INVALID_FILE_INFO = 32; + + // The source instance has unsupported database settings for migration. + UNSUPPORTED_DATABASE_SETTINGS = 33; + + // The replication user is missing parallel import specific privileges. + // (e.g. LOCK TABLES) for MySQL. + MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE = 34; + + // The global variable local_infile is off on external server replica. + LOCAL_INFILE_OFF = 35; + + // This code instructs customers to turn on point-in-time recovery manually + // for the instance after promoting the Cloud SQL for PostgreSQL instance. + TURN_ON_PITR_AFTER_PROMOTE = 36; + + // The minor version of replica database is incompatible with the source. + INCOMPATIBLE_DATABASE_MINOR_VERSION = 37; + + // This warning message indicates that Cloud SQL uses the maximum number of + // subscriptions to migrate data from the source to the destination. + SOURCE_MAX_SUBSCRIPTIONS = 38; + + // Unable to verify definers on the source for MySQL. + UNABLE_TO_VERIFY_DEFINERS = 39; + + // If a time out occurs while the subscription counts are calculated, then + // this value is set to 1. Otherwise, this value is set to 2. + SUBSCRIPTION_CALCULATION_STATUS = 40; + + // Count of subscriptions needed to sync source data for PostgreSQL + // database. + PG_SUBSCRIPTION_COUNT = 41; + + // Final parallel level that is used to do migration. + PG_SYNC_PARALLEL_LEVEL = 42; + + // The disk size of the replica instance is smaller than the data size of + // the source instance. + INSUFFICIENT_DISK_SIZE = 43; + + // The data size of the source instance is greater than 1 TB, the number of + // cores of the replica instance is less than 8, and the memory of the + // replica is less than 32 GB. + INSUFFICIENT_MACHINE_TIER = 44; + + // The warning message indicates the unsupported extensions will not be + // migrated to the destination. + UNSUPPORTED_EXTENSIONS_NOT_MIGRATED = 45; + + // The warning message indicates the pg_cron extension and settings will not + // be migrated to the destination. + EXTENSIONS_NOT_MIGRATED = 46; + + // The error message indicates that pg_cron flags are enabled on the + // destination which is not supported during the migration. + PG_CRON_FLAG_ENABLED_IN_REPLICA = 47; + + // This error message indicates that the specified extensions are not + // enabled on destination instance. For example, before you can migrate + // data to the destination instance, you must enable the PGAudit extension + // on the instance. + EXTENSIONS_NOT_ENABLED_IN_REPLICA = 48; + + // The source database has generated columns that can't be migrated. Please + // change them to regular columns before migration. + UNSUPPORTED_COLUMNS = 49; + + // The source database has users that aren't created in the replica. + // First, create all users, which are in the pg_user_mappings table + // of the source database, in the destination instance. Then, perform the + // migration. + USERS_NOT_CREATED_IN_REPLICA = 50; + + // The selected objects include system objects that aren't supported for + // migration. + UNSUPPORTED_SYSTEM_OBJECTS = 51; + + // The source database has tables with the FULL or NOTHING replica identity. + // Before starting your migration, either remove the identity or change it + // to DEFAULT. Note that this is an error and will block the migration. + UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY = 52; + + // The selected objects don't exist on the source instance. + SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE = 53; + + // PSC only destination instance does not have a network attachment URI. + PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI = 54; + + // Selected objects reference unselected objects. Based on their object type + // (foreign key constraint or view), selected objects will fail during + // migration. + SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS = 55; + + // The migration will delete existing data in the replica; set + // [replica_overwrite_enabled][google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.replica_overwrite_enabled] + // in the request to acknowledge this. This is an error. MySQL only. + PROMPT_DELETE_EXISTING = 56; + + // The migration will delete existing data in the replica; + // [replica_overwrite_enabled][google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.replica_overwrite_enabled] + // was set in the request acknowledging this. This is a warning rather than + // an error. MySQL only. + WILL_DELETE_EXISTING = 57; + + // The replication user is missing specific privileges to setup DDL + // replication. (e.g. CREATE EVENT TRIGGER, CREATE SCHEMA) for PostgreSQL. + PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE = 58; + } + + // Can be `sql#externalSyncSettingError` or + // `sql#externalSyncSettingWarning`. + string kind = 1; + + // Identifies the specific error that occurred. + SqlExternalSyncSettingErrorType type = 2; + + // Additional information about the error encountered. + string detail = 3; +} + +// A list of objects that the user selects for replication from an external +// source instance. +message SelectedObjects { + // Required. The name of the database to migrate. + string database = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// On-premises instance configuration. +message OnPremisesConfiguration { + // SslOption defines the SSL mode to be used for replica connection to the + // on-premises source. + enum SslOption { + // Unknown SSL option i.e. SSL option not specified by user. + SSL_OPTION_UNSPECIFIED = 0; + + // SSL is not used for replica connection to the on-premises source. + DISABLE = 1; + + // SSL is required for replica connection to the on-premises source. + REQUIRE = 2; + + // Verify CA is required for replica connection to the on-premises source. + VERIFY_CA = 3; + } + + // The host and port of the on-premises instance in host:port format + string host_port = 1; + + // This is always `sql#onPremisesConfiguration`. + string kind = 2; + + // The username for connecting to on-premises instance. + string username = 3; + + // The password for connecting to on-premises instance. + string password = 4; + + // PEM representation of the trusted CA's x509 certificate. + string ca_certificate = 5; + + // PEM representation of the replica's x509 certificate. + string client_certificate = 6; + + // PEM representation of the replica's private key. The corresponding public + // key is encoded in the client's certificate. + string client_key = 7; + + // The dump file to create the Cloud SQL replica. + string dump_file_path = 8; + + // The reference to Cloud SQL instance if the source is Cloud SQL. + InstanceReference source_instance = 15; + + // Optional. A list of objects that the user selects for replication from an + // external source instance. + repeated SelectedObjects selected_objects = 16 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. SSL option for replica connection to the on-premises source. + SslOption ssl_option = 18 [(google.api.field_behavior) = OPTIONAL]; +} + +// Read-replica configuration for connecting to the primary instance. +message ReplicaConfiguration { + // This is always `sql#replicaConfiguration`. + string kind = 1; + + // MySQL specific configuration when replicating from a MySQL on-premises + // primary instance. Replication configuration information such as the + // username, password, certificates, and keys are not stored in the instance + // metadata. The configuration information is used only to set up the + // replication connection and is stored by MySQL in a file named + // `master.info` in the data directory. + MySqlReplicaConfiguration mysql_replica_configuration = 2; + + // Specifies if the replica is the failover target. If the field is set to + // `true`, the replica will be designated as a failover replica. In case the + // primary instance fails, the replica instance will be promoted as the new + // primary instance. Only one replica can be specified as failover target, and + // the replica has to be in different zone with the primary instance. + google.protobuf.BoolValue failover_target = 3; + + // Optional. Specifies if a SQL Server replica is a cascadable replica. A + // cascadable replica is a SQL Server cross region replica that supports + // replica(s) under it. + google.protobuf.BoolValue cascadable_replica = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Execute SQL statements request. +message SqlInstancesExecuteSqlRequest { + // Required. Database instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // The request body. + ExecuteSqlPayload body = 100; +} + +// The request payload used to execute SQL statements. +message ExecuteSqlPayload { + // Controls how the API should respond when the SQL execution result exceeds + // 10 MB. + enum PartialResultMode { + // Unspecified mode, effectively the same as `FAIL_PARTIAL_RESULT`. + PARTIAL_RESULT_MODE_UNSPECIFIED = 0; + + // Throw an error if the result exceeds 10 MB or if only a partial result + // can be retrieved. Don't return the result. + FAIL_PARTIAL_RESULT = 1; + + // Return a truncated result and set `partial_result` to true if the result + // exceeds 10 MB or if only a partial result can be retrieved due to error. + // Don't throw an error. + ALLOW_PARTIAL_RESULT = 2; + } + + // Optional. The name of an existing database user to connect to the database. + // When `auto_iam_authn` is set to true, this field is ignored and the API + // caller's IAM user is used. + string user = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. SQL statements to run on the database. It can be a single + // statement or a sequence of statements separated by semicolons. + string sql_statement = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Name of the database on which the statement will be executed. + string database = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Credentials for the database connection. + oneof user_password { + // Optional. When set to `true`, the API caller identity associated with the + // request is used for database authentication. The API caller must be an + // IAM user in the database. + bool auto_iam_authn = 11 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The maximum number of rows returned per SQL statement. + int64 row_limit = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Controls how the API should respond when the SQL execution result + // is incomplete due to the size limit or another error. The default mode is + // to throw an error. + PartialResultMode partial_result_mode = 13 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the name of the application that is making the request. + // This field is used for telemetry. Only alphanumeric characters, dashes, and + // underscores are allowed. The maximum length is 32 characters. + string application = 16 [(google.api.field_behavior) = OPTIONAL]; +} + +// Execute SQL statements response. +message SqlInstancesExecuteSqlResponse { + // Represents a notice or warning message from the database. + message Message { + // The full message string. + // For PostgreSQL, this is a formatted string that may include severity, + // code, and the notice/warning message. + // For MySQL, this contains the warning message. + optional string message = 1; + + // The severity of the message (e.g., "NOTICE" for PostgreSQL, "WARNING" for + // MySQL). + optional string severity = 2; + } + + // A list of notices and warnings generated during query execution. + // For PostgreSQL, this includes all notices and warnings. + // For MySQL, this includes warnings generated by the last executed statement. + // To retrieve all warnings for a multi-statement query, `SHOW WARNINGS` must + // be executed after each statement. + repeated Message messages = 9; + + // The additional metadata information regarding the execution of the SQL + // statements. + Metadata metadata = 6; + + // The list of results after executing all the SQL statements. + repeated QueryResult results = 7; + + // Contains the error from the database if the SQL execution failed. + google.rpc.Status status = 8; +} + +// QueryResult contains the result of executing a single SQL statement. +message QueryResult { + // List of columns included in the result. This also includes the data type + // of the column. + repeated Column columns = 1; + + // Rows returned by the SQL statement. + repeated Row rows = 2; + + // Message related to the SQL execution result. + string message = 3; + + // Set to true if the SQL execution's result is truncated due to size limits + // or an error retrieving results. + bool partial_result = 4; + + // If results were truncated due to an error, details of that error. + google.rpc.Status status = 8; +} + +// Contains the name and datatype of a column. +message Column { + // Name of the column. + string name = 1; + + // Datatype of the column. + string type = 2; +} + +// Contains the values for a row. +message Row { + // The values for the row. + repeated Value values = 1; +} + +// The cell value of the table. +message Value { + // The cell value in string format. + string value = 1; + + // If cell value is null, then this flag will be set to true. + bool null_value = 2; +} + +// The additional metadata information regarding the execution of the SQL +// statements. +message Metadata { + // The time taken to execute the SQL statements. + google.protobuf.Duration sql_statement_execution_time = 1; +} + +// Request to acquire a lease for SSRS. +message SqlInstancesAcquireSsrsLeaseRequest { + // Required. Cloud SQL instance ID. This doesn't include the project ID. It's + // composed of lowercase letters, numbers, and hyphens, and it must start with + // a letter. The total length must be 98 characters or less (Example: + // instance-id). + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance (Example: + // project-id). + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The request body. + InstancesAcquireSsrsLeaseRequest body = 100 + [(google.api.field_behavior) = REQUIRED]; +} + +// Response for the acquire SSRS lease request. +message SqlInstancesAcquireSsrsLeaseResponse { + // The unique identifier for this operation. + string operation_id = 1; +} + +// Request to release a lease for SSRS. +message SqlInstancesReleaseSsrsLeaseRequest { + // Required. The Cloud SQL instance ID. This doesn't include the project ID. + // The instance ID contains lowercase letters, numbers, and hyphens, and it + // must start with a letter. This ID can have a maximum length of 98 + // characters. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The project ID that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Response for the release SSRS lease request. +message SqlInstancesReleaseSsrsLeaseResponse { + // The unique identifier for this operation. + string operation_id = 1; +} + +// Request to perform a point in time restore on a Google Cloud Backup and +// Disaster Recovery managed instance. +message SqlInstancesPointInTimeRestoreRequest { + // Required. The parent resource where you created this instance. + // Format: projects/{project} + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The context for request to perform a PITR on a Google Cloud + // Backup and Disaster Recovery managed instance. + PointInTimeRestoreContext context = 100 + [(google.api.field_behavior) = REQUIRED]; +} + +enum SqlInstanceType { + // This is an unknown Cloud SQL instance type. + SQL_INSTANCE_TYPE_UNSPECIFIED = 0; + + // A regular Cloud SQL instance that is not replicating from a primary + // instance. + CLOUD_SQL_INSTANCE = 1; + + // An instance running on the customer's premises that is not managed by + // Cloud SQL. + ON_PREMISES_INSTANCE = 2; + + // A Cloud SQL instance acting as a read-replica. + READ_REPLICA_INSTANCE = 3; + + // A Cloud SQL read pool. + READ_POOL_INSTANCE = 5; +} + +// The suspension reason of the database instance if the state is SUSPENDED. +enum SqlSuspensionReason { + // This is an unknown suspension reason. + SQL_SUSPENSION_REASON_UNSPECIFIED = 0; + + // The instance is suspended due to billing issues (for example:, account + // issue) + BILLING_ISSUE = 2; + + // The instance is suspended due to illegal content (for example:, child + // pornography, copyrighted material, etc.). + LEGAL_ISSUE = 3; + + // The instance is causing operational issues (for example:, causing the + // database to crash). + OPERATIONAL_ISSUE = 4; + + // The KMS key used by the instance is either revoked or denied access to + KMS_KEY_ISSUE = 5; + + // The project is suspended due to abuse detected by Ares. + PROJECT_ABUSE = 8; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_operations.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_operations.proto new file mode 100644 index 000000000000..dd4c3fa7e5ef --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_operations.proto @@ -0,0 +1,105 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/sql/v1/cloud_sql_resources.proto"; +import "google/protobuf/empty.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlOperationsProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service to fetch operations for database instances. +service SqlOperationsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Retrieves an instance operation that has been performed on an instance. + rpc Get(SqlOperationsGetRequest) returns (Operation) { + option (google.api.http) = { + get: "/v1/projects/{project}/operations/{operation}" + }; + } + + // Lists all instance operations that have been performed on the given Cloud + // SQL instance in the reverse chronological order of the start time. + rpc List(SqlOperationsListRequest) returns (OperationsListResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/operations" + }; + } + + // Cancels an instance operation that has been performed on an instance. + rpc Cancel(SqlOperationsCancelRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v1/projects/{project}/operations/{operation}/cancel" + }; + } +} + +// Operations get request. +message SqlOperationsGetRequest { + // Required. Instance operation ID. + string operation = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Operations list request. +message SqlOperationsListRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Maximum number of operations per response. + uint32 max_results = 2; + + // A previously-returned page token representing part of the larger set of + // results to view. + string page_token = 3; + + // Project ID of the project that contains the instance. + string project = 4; +} + +// Operations list response. +message OperationsListResponse { + // This is always `sql#operationsList`. + string kind = 1; + + // List of operation resources. + repeated Operation items = 2; + + // The continuation token, used to page through large result sets. Provide + // this value in a subsequent request to return the next page of results. + string next_page_token = 3; +} + +// Operations cancel request. +message SqlOperationsCancelRequest { + // Instance operation ID. + string operation = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_regions.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_regions.proto new file mode 100644 index 000000000000..91d841faf5ca --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_regions.proto @@ -0,0 +1,33 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlRegionsServiceProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service that exposes Cloud SQL region information. This service is only used +// internally and does not follow the same patterns as the other v1 RPCs. +service SqlRegionsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto new file mode 100644 index 000000000000..4f2fa0a5fc9e --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto @@ -0,0 +1,2388 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/field_behavior.proto"; +import "google/api/field_info.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlResourcesProto"; +option java_package = "com.google.cloud.sql.v1"; + +// An entry for an Access Control list. +message AclEntry { + // The allowlisted value for the access control list. + string value = 1; + + // The time when this access control entry expires in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp expiration_time = 2; + + // Optional. A label to identify this entry. + string name = 3 [(google.api.field_behavior) = OPTIONAL]; + + // This is always `sql#aclEntry`. + string kind = 4; +} + +// An Admin API warning message. +message ApiWarning { + enum SqlApiWarningCode { + // An unknown or unset warning type from Cloud SQL API. + SQL_API_WARNING_CODE_UNSPECIFIED = 0; + + // Warning when one or more regions are not reachable. The returned result + // set may be incomplete. + REGION_UNREACHABLE = 1; + + // Warning when user provided maxResults parameter exceeds the limit. The + // returned result set may be incomplete. + MAX_RESULTS_EXCEEDS_LIMIT = 2; + + // Warning when user tries to create/update a user with credentials that + // have previously been compromised by a public data breach. + COMPROMISED_CREDENTIALS = 3; + + // Warning when the operation succeeds but some non-critical workflow state + // failed. + INTERNAL_STATE_FAILURE = 4; + } + + // Code to uniquely identify the warning type. + SqlApiWarningCode code = 1; + + // The warning message. + string message = 2; + + // The region name for REGION_UNREACHABLE warning. + string region = 3; +} + +// We currently only support backup retention by specifying the number +// of backups we will retain. +message BackupRetentionSettings { + // The units that retained_backups specifies, we only support COUNT. + enum RetentionUnit { + // Backup retention unit is unspecified, will be treated as COUNT. + RETENTION_UNIT_UNSPECIFIED = 0; + + // Retention will be by count, eg. "retain the most recent 7 backups". + COUNT = 1; + } + + // The unit that 'retained_backups' represents. + RetentionUnit retention_unit = 1; + + // Depending on the value of retention_unit, this is used to determine + // if a backup needs to be deleted. If retention_unit is 'COUNT', we will + // retain this many backups. + google.protobuf.Int32Value retained_backups = 2; +} + +// Database instance backup configuration. +message BackupConfiguration { + // This value contains the storage location of the transactional logs + // used to perform point-in-time recovery (PITR) for the database. + enum TransactionalLogStorageState { + // Unspecified. + TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED = 0; + + // The transaction logs used for PITR for the instance are stored + // on a data disk. + DISK = 1; + + // The transaction logs used for PITR for the instance are switching from + // being stored on a data disk to being stored in Cloud Storage. + // Only applicable to MySQL. + SWITCHING_TO_CLOUD_STORAGE = 2; + + // The transaction logs used for PITR for the instance are now stored + // in Cloud Storage. Previously, they were stored on a data disk. + // Only applicable to MySQL. + SWITCHED_TO_CLOUD_STORAGE = 3; + + // The transaction logs used for PITR for the instance are stored in + // Cloud Storage. Only applicable to MySQL and PostgreSQL. + CLOUD_STORAGE = 4; + } + + // Backup tier that manages the backups for the instance. + enum BackupTier { + // Unspecified. + BACKUP_TIER_UNSPECIFIED = 0; + + // Instance is managed by Cloud SQL. + STANDARD = 1; + + // Deprecated: ADVANCED is deprecated. Please use ENHANCED instead. + ADVANCED = 2 [deprecated = true]; + + // Instance is managed by Google Cloud Backup and DR Service. + ENHANCED = 3; + } + + // Start time for the daily backup configuration in UTC timezone in the 24 + // hour format - `HH:MM`. + string start_time = 1; + + // Whether this configuration is enabled. + google.protobuf.BoolValue enabled = 2; + + // This is always `sql#backupConfiguration`. + string kind = 3; + + // (MySQL only) Whether binary log is enabled. If backup configuration is + // disabled, binarylog must be disabled as well. + google.protobuf.BoolValue binary_log_enabled = 4; + + // Reserved for future use. + google.protobuf.BoolValue replication_log_archiving_enabled = 5; + + // Location of the backup + string location = 6; + + // Whether point in time recovery is enabled. + google.protobuf.BoolValue point_in_time_recovery_enabled = 7; + + // Backup retention settings. + BackupRetentionSettings backup_retention_settings = 8; + + // The number of days of transaction logs we retain for point in time + // restore, from 1-7. + google.protobuf.Int32Value transaction_log_retention_days = 9; + + // Output only. This value contains the storage location of transactional logs + // used to perform point-in-time recovery (PITR) for the database. + optional TransactionalLogStorageState transactional_log_storage_state = 10 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Backup tier that manages the backups for the instance. + optional BackupTier backup_tier = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Perform disk shrink context. +message PerformDiskShrinkContext { + // The target disk shrink size in GigaBytes. + int64 target_size_gb = 1; +} + +// Structured PreCheckResponse containing message, type, and required +// actions. +message PreCheckResponse { + // The type of message which can be an info, a warning, or an error that + // requires user intervention. + enum MessageType { + // Default unspecified value to prevent unintended behavior changes. + MESSAGE_TYPE_UNSPECIFIED = 0; + + // General informational messages that don't require action. + INFO = 1; + + // Warnings that might impact the upgrade but don't block it. + WARNING = 2; + + // Errors that a user must resolve before proceeding with the upgrade. + ERROR = 3; + } + + // The message to be displayed to the user. + optional string message = 2; + + // The type of message whether it is an info, warning, or error. + optional MessageType message_type = 3; + + // The actions that the user needs to take. Use repeated for multiple + // actions. + repeated string actions_required = 4; +} + +// Pre-check major version upgrade context. +message PreCheckMajorVersionUpgradeContext { + // Required. The target database version to upgrade to. + SqlDatabaseVersion target_database_version = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Output only. The responses from the precheck operation. + repeated PreCheckResponse pre_check_response = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. This is always `sql#preCheckMajorVersionUpgradeContext`. + string kind = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Backup context. +message BackupContext { + // The identifier of the backup. + int64 backup_id = 1; + + // This is always `sql#backupContext`. + string kind = 2; + + // The name of the backup. + // Format: projects/{project}/backups/{backup} + string name = 3; +} + +// Represents a SQL database on the Cloud SQL instance. +message Database { + // This is always `sql#database`. + string kind = 1; + + // The Cloud SQL charset value. + string charset = 2; + + // The Cloud SQL collation value. + string collation = 3; + + // This field is deprecated and will be removed from a future version of the + // API. + string etag = 4; + + // The name of the database in the Cloud SQL instance. This does not include + // the project ID or instance name. + string name = 5; + + // The name of the Cloud SQL instance. This does not include the project ID. + string instance = 6; + + // The URI of this resource. + string self_link = 7; + + // The project ID of the project containing the Cloud SQL database. The Google + // apps domain is prefixed if applicable. + string project = 8; + + oneof database_details { + SqlServerDatabaseDetails sqlserver_database_details = 9; + } +} + +// Represents a Sql Server database on the Cloud SQL instance. +message SqlServerDatabaseDetails { + // The version of SQL Server with which the database is to be made compatible + int32 compatibility_level = 1; + + // The recovery model of a SQL Server database + string recovery_model = 2; +} + +// Database flags for Cloud SQL instances. +message DatabaseFlags { + // The name of the flag. These flags are passed at instance startup, so + // include both server options and system variables. Flags are + // specified with underscores, not hyphens. For more information, see + // [Configuring Database Flags](https://cloud.google.com/sql/docs/mysql/flags) + // in the Cloud SQL documentation. + string name = 1; + + // The value of the flag. Boolean flags are set to `on` for true + // and `off` for false. This field must be omitted if the flag + // doesn't take a value. + string value = 2; +} + +// MySQL-specific external server sync settings. +message MySqlSyncConfig { + // Flags to use for the initial dump. + repeated SyncFlags initial_sync_flags = 1; +} + +// Initial sync flags for certain Cloud SQL APIs. +// Currently used for the MySQL external server initial dump. +message SyncFlags { + // The name of the flag. + string name = 1; + + // The value of the flag. This field must be omitted if the flag + // doesn't take a value. + string value = 2; +} + +// Reference to another Cloud SQL instance. +message InstanceReference { + // The name of the Cloud SQL instance being referenced. + // This does not include the project ID. + string name = 1; + + // The region of the Cloud SQL instance being referenced. + string region = 2; + + // The project ID of the Cloud SQL instance being referenced. + // The default is the same project ID as the instance references it. + string project = 3; +} + +// Read-replica configuration for connecting to the on-premises primary +// instance. +message DemoteMasterConfiguration { + // This is always `sql#demoteMasterConfiguration`. + string kind = 1; + + // MySQL specific configuration when replicating from a MySQL on-premises + // primary instance. Replication configuration information such as the + // username, password, certificates, and keys are not stored in the instance + // metadata. The configuration information is used only to set up the + // replication connection and is stored by MySQL in a file named + // `master.info` in the data directory. + DemoteMasterMySqlReplicaConfiguration mysql_replica_configuration = 2; +} + +// Read-replica configuration specific to MySQL databases. +message DemoteMasterMySqlReplicaConfiguration { + // This is always `sql#demoteMasterMysqlReplicaConfiguration`. + string kind = 1; + + // The username for the replication connection. + string username = 2; + + // The password for the replication connection. + string password = 3; + + // PEM representation of the replica's private key. The corresponding public + // key is encoded in the client's certificate. The format of the replica's + // private key can be either PKCS #1 or PKCS #8. + string client_key = 4; + + // PEM representation of the replica's x509 certificate. + string client_certificate = 5; + + // PEM representation of the trusted CA's x509 certificate. + string ca_certificate = 6; +} + +enum SqlFileType { + // Unknown file type. + SQL_FILE_TYPE_UNSPECIFIED = 0; + + // File containing SQL statements. + SQL = 1; + + // File in CSV format. + CSV = 2; + + BAK = 4; + + // TDE certificate. + TDE = 8; +} + +// Database instance export context. +message ExportContext { + message SqlCsvExportOptions { + // The select query used to extract the data. + string select_query = 1; + + // Specifies the character that should appear before a data character that + // needs to be escaped. + string escape_character = 2; + + // Specifies the quoting character to be used when a data value is quoted. + string quote_character = 3; + + // Specifies the character that separates columns within each row (line) of + // the file. + string fields_terminated_by = 4; + + // This is used to separate lines. If a line does not contain all fields, + // the rest of the columns are set to their default values. + string lines_terminated_by = 6; + } + + message SqlExportOptions { + // Options for exporting from MySQL. + message MysqlExportOptions { + // Option to include SQL statement required to set up replication. If set + // to `1`, the dump file includes a CHANGE MASTER TO statement with the + // binary log coordinates, and --set-gtid-purged is set to ON. If set to + // `2`, the CHANGE MASTER TO statement is written as a SQL comment and + // has no effect. If set to any value other than `1`, --set-gtid-purged + // is set to OFF. + google.protobuf.Int32Value master_data = 1; + } + + // Options for exporting from a Cloud SQL for PostgreSQL instance. + message PostgresExportOptions { + // Optional. Use this option to include DROP <object> + // SQL statements. Use these statements to delete database objects before + // running the import operation. + google.protobuf.BoolValue clean = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Option to include an IF EXISTS SQL statement with each DROP + // statement produced by clean. + google.protobuf.BoolValue if_exists = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Tables to export, or that were exported, from the specified database. If + // you specify tables, specify one and only one database. For PostgreSQL + // instances, you can specify only one table. + repeated string tables = 1; + + // Export only schemas. + google.protobuf.BoolValue schema_only = 2; + + MysqlExportOptions mysql_export_options = 3; + + // Optional. The number of threads to use for parallel export. + google.protobuf.Int32Value threads = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether or not the export should be parallel. + google.protobuf.BoolValue parallel = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Options for exporting from a Cloud SQL for PostgreSQL instance. + PostgresExportOptions postgres_export_options = 6 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Options for exporting BAK files (SQL Server-only) + message SqlBakExportOptions { + // Whether or not the export should be striped. + google.protobuf.BoolValue striped = 1; + + // Option for specifying how many stripes to use for the export. + // If blank, and the value of the striped field is true, + // the number of stripes is automatically chosen. + google.protobuf.Int32Value stripe_count = 2; + + // Type of this bak file will be export, FULL or DIFF, SQL Server only + BakType bak_type = 4; + + // Deprecated: copy_only is deprecated. Use differential_base instead + google.protobuf.BoolValue copy_only = 5 [deprecated = true]; + + // Whether or not the backup can be used as a differential base + // copy_only backup can not be served as differential base + google.protobuf.BoolValue differential_base = 6; + + // Optional. The begin timestamp when transaction log will be included in + // the export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) + // format (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all + // available logs from the beginning of retention period will be included. + // Only applied to Cloud SQL for SQL Server. + google.protobuf.Timestamp export_log_start_time = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The end timestamp when transaction log will be included in the + // export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) format + // (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all + // available logs until current time will be included. Only applied to Cloud + // SQL for SQL Server. + google.protobuf.Timestamp export_log_end_time = 8 + [(google.api.field_behavior) = OPTIONAL]; + } + + message SqlTdeExportOptions { + // Required. Path to the TDE certificate public key + // in the form gs://bucketName/fileName. + // The instance must have write access to the bucket. + // Applicable only for SQL Server instances. + string certificate_path = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Path to the TDE certificate private key + // in the form gs://bucketName/fileName. + // The instance must have write access to the location. + // Applicable only for SQL Server instances. + string private_key_path = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Password that encrypts the private key. + string private_key_password = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Certificate name. + // Applicable only for SQL Server instances. + string name = 5 [(google.api.field_behavior) = REQUIRED]; + } + + // The path to the file in Google Cloud Storage where the export will be + // stored. The URI is in the form `gs://bucketName/fileName`. If the file + // already exists, the request succeeds, but the operation fails. If + // `fileType` is `SQL` and the filename ends with .gz, + // the contents are compressed. + string uri = 1; + + // Databases to be exported.
`MySQL instances:` If + // `fileType` is `SQL` and no database is specified, all + // databases are exported, except for the `mysql` system database. + // If `fileType` is `CSV`, you can specify one database, + // either by using this property or by using the + // `csvExportOptions.selectQuery` property, which takes precedence + // over this property.
`PostgreSQL instances:` If you don't specify a + // database by name, all user databases in the instance are exported. + // This excludes system databases and Cloud SQL databases used to manage + // internal operations. Exporting all user databases is only available for + // directory-formatted parallel export. If `fileType` is `CSV`, + // this database must match the one specified in the + // `csvExportOptions.selectQuery` property.
`SQL Server + // instances:` You must specify one database to be exported, and the + // `fileType` must be `BAK`. + repeated string databases = 2; + + // This is always `sql#exportContext`. + string kind = 3; + + // Options for exporting data as SQL statements. + SqlExportOptions sql_export_options = 4; + + // Options for exporting data as CSV. `MySQL` and `PostgreSQL` + // instances only. + SqlCsvExportOptions csv_export_options = 5; + + // The file type for the specified uri. + SqlFileType file_type = 6; + + // Whether to perform a serverless export. + google.protobuf.BoolValue offload = 8; + + // Options for exporting data as BAK files. + SqlBakExportOptions bak_export_options = 9; + + // Optional. Export parameters specific to SQL Server TDE certificates + SqlTdeExportOptions tde_export_options = 10 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Database instance import context. +message ImportContext { + message SqlImportOptions { + message PostgresImportOptions { + // Optional. The --clean flag for the pg_restore utility. This flag + // applies only if you enabled Cloud SQL to import files in parallel. + google.protobuf.BoolValue clean = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The --if-exists flag for the pg_restore utility. This flag + // applies only if you enabled Cloud SQL to import files in parallel. + google.protobuf.BoolValue if_exists = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The number of threads to use for parallel import. + google.protobuf.Int32Value threads = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether or not the import should be parallel. + google.protobuf.BoolValue parallel = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Options for importing from a Cloud SQL for PostgreSQL instance. + PostgresImportOptions postgres_import_options = 3 + [(google.api.field_behavior) = OPTIONAL]; + } + + message SqlCsvImportOptions { + // The table to which CSV data is imported. + string table = 1; + + // The columns to which CSV data is imported. If not specified, all columns + // of the database table are loaded with CSV data. + repeated string columns = 2; + + // Specifies the character that should appear before a data character that + // needs to be escaped. + string escape_character = 4; + + // Specifies the quoting character to be used when a data value is quoted. + string quote_character = 5; + + // Specifies the character that separates columns within each row (line) of + // the file. + string fields_terminated_by = 6; + + // This is used to separate lines. If a line does not contain all fields, + // the rest of the columns are set to their default values. + string lines_terminated_by = 8; + } + + message SqlBakImportOptions { + message EncryptionOptions { + // Path to the Certificate (.cer) in Cloud Storage, in the form + // `gs://bucketName/fileName`. The instance must have + // write permissions to the bucket and read access to the file. + string cert_path = 1; + + // Path to the Certificate Private Key (.pvk) in Cloud Storage, in the + // form `gs://bucketName/fileName`. The instance must have + // write permissions to the bucket and read access to the file. + string pvk_path = 2; + + // Password that encrypts the private key + string pvk_password = 3; + + // Optional. Whether the imported file remains encrypted. + google.protobuf.BoolValue keep_encrypted = 5 + [(google.api.field_behavior) = OPTIONAL]; + } + + EncryptionOptions encryption_options = 1; + + // Whether or not the backup set being restored is striped. + // Applies only to Cloud SQL for SQL Server. + google.protobuf.BoolValue striped = 2; + + // Whether or not the backup importing will restore database + // with NORECOVERY option. + // Applies only to Cloud SQL for SQL Server. + google.protobuf.BoolValue no_recovery = 4; + + // Whether or not the backup importing request will just bring database + // online without downloading Bak content only one of "no_recovery" and + // "recovery_only" can be true otherwise error will return. Applies only to + // Cloud SQL for SQL Server. + google.protobuf.BoolValue recovery_only = 5; + + // Type of the bak content, FULL or DIFF + BakType bak_type = 6; + + // Optional. The timestamp when the import should stop. This timestamp is in + // the [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, + // `2023-10-01T16:19:00.094`). This field is equivalent to the STOPAT + // keyword and applies to Cloud SQL for SQL Server only. + google.protobuf.Timestamp stop_at = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The marked transaction where the import should stop. This field + // is equivalent to the STOPATMARK keyword and applies to Cloud SQL for SQL + // Server only. + string stop_at_mark = 8 [(google.api.field_behavior) = OPTIONAL]; + } + + message SqlTdeImportOptions { + // Required. Path to the TDE certificate public key + // in the form gs://bucketName/fileName. + // The instance must have read access to the file. + // Applicable only for SQL Server instances. + string certificate_path = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Path to the TDE certificate private key + // in the form gs://bucketName/fileName. + // The instance must have read access to the file. + // Applicable only for SQL Server instances. + string private_key_path = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Password that encrypts the private key. + string private_key_password = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Certificate name. + // Applicable only for SQL Server instances. + string name = 5 [(google.api.field_behavior) = REQUIRED]; + } + + // Path to the import file in Cloud Storage, in the form + // `gs://bucketName/fileName`. Compressed gzip files (.gz) are supported + // when `fileType` is `SQL`. The instance must have + // write permissions to the bucket and read access to the file. + string uri = 1; + + // The target database for the import. If `fileType` is `SQL`, this field + // is required only if the import file does not specify a database, and is + // overridden by any database specification in the import file. For entire + // instance parallel import operations, the database is overridden by the + // database name stored in subdirectory name. If + // `fileType` is `CSV`, one database must be specified. + string database = 2; + + // This is always `sql#importContext`. + string kind = 3; + + // The file type for the specified uri.\`SQL`: The file + // contains SQL statements. \`CSV`: The file contains CSV data. + SqlFileType file_type = 4; + + // Options for importing data as CSV. + SqlCsvImportOptions csv_import_options = 5; + + // The PostgreSQL user for this import operation. PostgreSQL instances only. + string import_user = 6; + + // Import parameters specific to SQL Server .BAK files + SqlBakImportOptions bak_import_options = 7; + + // Optional. Options for importing data from SQL statements. + SqlImportOptions sql_import_options = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Import parameters specific to SQL Server TDE certificates + SqlTdeImportOptions tde_import_options = 9 + [(google.api.field_behavior) = OPTIONAL]; +} + +enum BakType { + // Default type. + BAK_TYPE_UNSPECIFIED = 0; + + // Full backup. + FULL = 1; + + // Differential backup. + DIFF = 2; + + // Transaction Log backup + TLOG = 3; +} + +// IP Management configuration. +message IpConfiguration { + // The SSL options for database connections. + enum SslMode { + // The SSL mode is unknown. + SSL_MODE_UNSPECIFIED = 0; + + // Allow non-SSL/non-TLS and SSL/TLS connections. + // For SSL connections to MySQL and PostgreSQL, the client certificate + // isn't verified. + // + // When this value is used, the legacy `require_ssl` flag must be false or + // cleared to avoid a conflict between the values of the two flags. + ALLOW_UNENCRYPTED_AND_ENCRYPTED = 1; + + // Only allow connections encrypted with SSL/TLS. + // For SSL connections to MySQL and PostgreSQL, the client certificate + // isn't verified. + // + // When this value is used, the legacy `require_ssl` flag must be false or + // cleared to avoid a conflict between the values of the two flags. + ENCRYPTED_ONLY = 2; + + // Only allow connections encrypted with SSL/TLS and with valid + // client certificates. + // + // When this value is used, the legacy `require_ssl` flag must be true or + // cleared to avoid the conflict between values of two flags. + // PostgreSQL clients or users that connect using IAM database + // authentication must use either the + // [Cloud SQL Auth + // Proxy](https://cloud.google.com/sql/docs/postgres/connect-auth-proxy) or + // [Cloud SQL + // Connectors](https://cloud.google.com/sql/docs/postgres/connect-connectors) + // to enforce client identity verification. + // + // Only applicable to MySQL and PostgreSQL. Not applicable to SQL Server. + TRUSTED_CLIENT_CERTIFICATE_REQUIRED = 3; + } + + // Various Certificate Authority (CA) modes for certificate signing. + enum CaMode { + // CA mode is unspecified. It is effectively the same as + // `GOOGLE_MANAGED_INTERNAL_CA`. + CA_MODE_UNSPECIFIED = 0; + + // Google-managed self-signed internal CA. + GOOGLE_MANAGED_INTERNAL_CA = 1; + + // Google-managed regional CA part of root CA hierarchy hosted on Google + // Cloud's Certificate Authority Service (CAS). + GOOGLE_MANAGED_CAS_CA = 2; + + // Customer-managed CA hosted on Google Cloud's Certificate Authority + // Service (CAS). + CUSTOMER_MANAGED_CAS_CA = 3; + } + + // Settings for automatic server certificate rotation. + enum ServerCertificateRotationMode { + // Unspecified: no automatic server certificate rotation. + SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED = 0; + + // No automatic server certificate rotation. The user must [manage server + // certificate + // rotation](/sql/docs/mysql/manage-ssl-instance#rotate-server-certificate-cas) + // on their side. + NO_AUTOMATIC_ROTATION = 1; + + // Automatic server certificate rotation during Cloud SQL scheduled + // maintenance or self-service maintenance updates. Requires + // `server_ca_mode` to be `GOOGLE_MANAGED_CAS_CA` or + // `CUSTOMER_MANAGED_CAS_CA`. + AUTOMATIC_ROTATION_DURING_MAINTENANCE = 2; + } + + // Whether the instance is assigned a public IP address or not. + google.protobuf.BoolValue ipv4_enabled = 1; + + // The resource link for the VPC network from which the Cloud SQL instance is + // accessible for private IP. For example, + // `/projects/myProject/global/networks/default`. This setting can + // be updated, but it cannot be removed after it is set. + string private_network = 2; + + // Use `ssl_mode` instead. + // + // Whether SSL/TLS connections over IP are enforced. + // If set to false, then allow both non-SSL/non-TLS and SSL/TLS connections. + // For SSL/TLS connections, the client certificate won't be verified. If + // set to true, then only allow connections encrypted with SSL/TLS and with + // valid client certificates. If you want to enforce SSL/TLS without enforcing + // the requirement for valid client certificates, then use the `ssl_mode` flag + // instead of the `require_ssl` flag. + google.protobuf.BoolValue require_ssl = 3; + + // The list of external networks that are allowed to connect to the instance + // using the IP. In 'CIDR' notation, also known as 'slash' notation (for + // example: `157.197.200.0/24`). + repeated AclEntry authorized_networks = 4; + + // The name of the allocated ip range for the private ip Cloud SQL instance. + // For example: "google-managed-services-default". If set, the instance ip + // will be created in the allocated range. The range name must comply with + // [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name + // must be 1-63 characters long and match the regular expression + // `[a-z]([-a-z0-9]*[a-z0-9])?.` + string allocated_ip_range = 6; + + // Controls connectivity to private IP instances from Google services, + // such as BigQuery. + google.protobuf.BoolValue enable_private_path_for_google_cloud_services = 7; + + // Specify how SSL/TLS is enforced in database connections. If you must use + // the `require_ssl` flag for backward compatibility, then only the following + // value pairs are valid: + // + // For PostgreSQL and MySQL: + // + // * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false` + // * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=false` + // * `ssl_mode=TRUSTED_CLIENT_CERTIFICATE_REQUIRED` and `require_ssl=true` + // + // For SQL Server: + // + // * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false` + // * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=true` + // + // The value of `ssl_mode` has priority over the value of `require_ssl`. + // + // For example, for the pair `ssl_mode=ENCRYPTED_ONLY` and + // `require_ssl=false`, `ssl_mode=ENCRYPTED_ONLY` means accept only SSL + // connections, while `require_ssl=false` means accept both non-SSL + // and SSL connections. In this case, MySQL and PostgreSQL databases respect + // `ssl_mode` and accepts only SSL connections. + SslMode ssl_mode = 8; + + // PSC settings for this instance. + optional PscConfig psc_config = 9; + + // Specify what type of CA is used for the server certificate. + optional CaMode server_ca_mode = 10; + + // Optional. Custom Subject Alternative Name(SAN)s for a Cloud SQL instance. + repeated string custom_subject_alternative_names = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource name of the server CA pool for an instance with + // `CUSTOMER_MANAGED_CAS_CA` as the `server_ca_mode`. + // Format: projects/{PROJECT}/locations/{REGION}/caPools/{CA_POOL_ID} + optional string server_ca_pool = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Controls the automatic server certificate rotation feature. This + // feature is disabled by default. When enabled, the server certificate will + // be automatically rotated during Cloud SQL scheduled maintenance or + // self-service maintenance updates up to six months before it expires. This + // setting can only be set if server_ca_mode is either GOOGLE_MANAGED_CAS_CA + // or CUSTOMER_MANAGED_CAS_CA. + optional ServerCertificateRotationMode server_certificate_rotation_mode = 16 + [(google.api.field_behavior) = OPTIONAL]; +} + +// PSC settings for a Cloud SQL instance. +message PscConfig { + // Whether PSC connectivity is enabled for this instance. + optional bool psc_enabled = 1; + + // Optional. The list of consumer projects that are allow-listed for PSC + // connections to this instance. This instance can be connected to with PSC + // from any network in these projects. + // + // Each consumer project in this list may be represented by a project number + // (numeric) or by a project id (alphanumeric). + repeated string allowed_consumer_projects = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The list of settings for requested Private Service Connect + // consumer endpoints that can be used to connect to this Cloud SQL instance. + repeated PscAutoConnectionConfig psc_auto_connections = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The network attachment of the consumer network that the + // Private Service Connect enabled Cloud SQL instance is + // authorized to connect via PSC interface. + // format: projects/PROJECT/regions/REGION/networkAttachments/ID + string network_attachment_uri = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether PSC DNS automation is enabled for this + // instance. When enabled, Cloud SQL provisions a universal DNS record across + // all networks configured with Private Service Connect (PSC) + // auto-connections. This will default to true for new instances when Private + // Service Connect is enabled. + optional bool psc_auto_dns_enabled = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether PSC write endpoint DNS automation is enabled + // for this instance. When enabled, Cloud SQL provisions a universal global + // DNS record across all networks configured with Private Service Connect + // (PSC) auto-connections that always points to the cluster primary instance. + // This feature is only supported for Enterprise Plus edition. + // This will default to true for new Enterprise Plus instances when + // `psc_auto_dns_enabled` is enabled. + optional bool psc_write_endpoint_dns_enabled = 6 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Settings for an automatically-setup Private Service Connect consumer endpoint +// that is used to connect to a Cloud SQL instance. +message PscAutoConnectionConfig { + // Optional. This is the project ID of consumer service project of this + // consumer endpoint. + // + // This is only applicable if `consumer_network` is a shared VPC + // network. + string consumer_project = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The consumer network of this consumer endpoint. This must be a + // resource path that includes both the host project and the network name. + // + // For example, `projects/project1/global/networks/network1`. + // + // The consumer host project of this network might be different from the + // consumer service project. + string consumer_network = 2 [(google.api.field_behavior) = OPTIONAL]; + + // The IP address of the consumer endpoint. + optional string ip_address = 3 + [(google.api.field_info).format = IPV4_OR_IPV6]; + + // The connection status of the consumer endpoint. + optional string status = 4; + + // The connection policy status of the consumer network. + optional string consumer_network_status = 5; +} + +// Preferred location. This specifies where a Cloud SQL instance is located. +// Note that if the preferred location is not available, the instance will be +// located as close as possible within the region. Only one location may be +// specified. +message LocationPreference { + // The App Engine application to follow, it must be in the same region as the + // Cloud SQL instance. WARNING: Changing this might restart the instance. + string follow_gae_application = 1 [deprecated = true]; + + // The preferred Compute Engine zone (for example: us-central1-a, + // us-central1-b, etc.). WARNING: Changing this might restart the instance. + string zone = 2; + + // The preferred Compute Engine zone for the secondary/failover + // (for example: us-central1-a, us-central1-b, etc.). + // To disable this field, set it to 'no_secondary_zone'. + string secondary_zone = 4; + + // This is always `sql#locationPreference`. + string kind = 3; +} + +// Maintenance window. This specifies when a Cloud SQL instance is +// restarted for system maintenance purposes. +message MaintenanceWindow { + // Hour of day - 0 to 23. Specify in the UTC time zone. + google.protobuf.Int32Value hour = 1; + + // Day of week - `MONDAY`, `TUESDAY`, `WEDNESDAY`, `THURSDAY`, `FRIDAY`, + // `SATURDAY`, or `SUNDAY`. Specify in the UTC time zone. + // Returned in output as an integer, 1 to 7, where `1` equals Monday. + google.protobuf.Int32Value day = 2; + + // Maintenance timing settings: `canary`, `stable`, or `week5`. + // For more information, see [About maintenance on Cloud SQL + // instances](https://cloud.google.com/sql/docs/mysql/maintenance). + SqlUpdateTrack update_track = 3; + + // This is always `sql#maintenanceWindow`. + string kind = 4; +} + +// Deny maintenance Periods. This specifies a date range during when all CSA +// rollout will be denied. +message DenyMaintenancePeriod { + // "deny maintenance period" start date. If the year of the start date is + // empty, the year of the end date also must be empty. In this case, it means + // the deny maintenance period recurs every year. The date is in format + // yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01 + string start_date = 1; + + // "deny maintenance period" end date. If the year of the end date is empty, + // the year of the start date also must be empty. In this case, it means the + // no maintenance interval recurs every year. The date is in format yyyy-mm-dd + // i.e., 2020-11-01, or mm-dd, i.e., 11-01 + string end_date = 2; + + // Time in UTC when the "deny maintenance period" starts on start_date and + // ends on end_date. The time is in format: HH:mm:SS, i.e., 00:00:00 + string time = 3; +} + +// Insights configuration. This specifies when Cloud SQL Insights feature is +// enabled and optional configuration. +message InsightsConfig { + // Whether Query Insights feature is enabled. + bool query_insights_enabled = 1; + + // Whether Query Insights will record client address when enabled. + bool record_client_address = 2; + + // Whether Query Insights will record application tags from query when + // enabled. + bool record_application_tags = 3; + + // Maximum query length stored in bytes. Default value: 1024 bytes. + // Range: 256-4500 bytes. Query lengths greater than this field value will be + // truncated to this value. When unset, query length will be the default + // value. Changing query length will restart the database. + google.protobuf.Int32Value query_string_length = 4; + + // Number of query execution plans captured by Insights per minute + // for all queries combined. Default is 5. + google.protobuf.Int32Value query_plans_per_minute = 5; + + // Optional. Whether enhanced query insights feature is enabled. + google.protobuf.BoolValue enhanced_query_insights_enabled = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Read-replica configuration specific to MySQL databases. +message MySqlReplicaConfiguration { + // Path to a SQL dump file in Google Cloud Storage from which the replica + // instance is to be created. The URI is in the form gs://bucketName/fileName. + // Compressed gzip files (.gz) are also supported. + // Dumps have the binlog co-ordinates from which replication + // begins. This can be accomplished by setting --master-data to 1 when using + // mysqldump. + string dump_file_path = 1; + + // The username for the replication connection. + string username = 2; + + // The password for the replication connection. + string password = 3; + + // Seconds to wait between connect retries. MySQL's default is 60 seconds. + google.protobuf.Int32Value connect_retry_interval = 4; + + // Interval in milliseconds between replication heartbeats. + google.protobuf.Int64Value master_heartbeat_period = 5; + + // PEM representation of the trusted CA's x509 certificate. + string ca_certificate = 6; + + // PEM representation of the replica's x509 certificate. + string client_certificate = 7; + + // PEM representation of the replica's private key. The corresponding public + // key is encoded in the client's certificate. + string client_key = 8; + + // A list of permissible ciphers to use for SSL encryption. + string ssl_cipher = 9; + + // Whether or not to check the primary instance's Common Name value in the + // certificate that it sends during the SSL handshake. + google.protobuf.BoolValue verify_server_certificate = 10; + + // This is always `sql#mysqlReplicaConfiguration`. + string kind = 11; +} + +// Disk encryption configuration for an instance. +message DiskEncryptionConfiguration { + // Resource name of KMS key for disk encryption + string kms_key_name = 1; + + // This is always `sql#diskEncryptionConfiguration`. + string kind = 2; +} + +// Disk encryption status for an instance. +message DiskEncryptionStatus { + // KMS key version used to encrypt the Cloud SQL instance resource + string kms_key_version_name = 1; + + // This is always `sql#diskEncryptionStatus`. + string kind = 2; +} + +// Database instance IP mapping +message IpMapping { + // The type of this IP address. A `PRIMARY` address is a public address that + // can accept incoming connections. A `PRIVATE` address is a private address + // that can accept incoming connections. An `OUTGOING` address is the source + // address of connections originating from the instance, if supported. + SqlIpAddressType type = 1; + + // The IP address assigned. + string ip_address = 2; + + // The due time for this IP to be retired in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. This field is only available when + // the IP is scheduled to be retired. + google.protobuf.Timestamp time_to_retire = 3; +} + +// The type of maintenance to be performed on the instance. +enum SqlMaintenanceType { + // Maintenance type is unspecified. + SQL_MAINTENANCE_TYPE_UNSPECIFIED = 0; + + // Indicates that a standalone instance is undergoing maintenance. The + // instance can be either a primary instance or a replica. + INSTANCE_MAINTENANCE = 1; + + // Indicates that the primary instance and all of its replicas, including + // cascading replicas, are undergoing maintenance. Maintenance is performed on + // groups of replicas first, followed by the primary instance. + REPLICA_INCLUDED_MAINTENANCE = 2; + + // Indicates that the standalone instance is undergoing maintenance, initiated + // by self-service. The instance can be either a primary instance or a + // replica. + INSTANCE_SELF_SERVICE_MAINTENANCE = 3; + + // Indicates that the primary instance and all of its replicas are undergoing + // maintenance, initiated by self-service. Maintenance is performed on groups + // of replicas first, followed by the primary instance. + REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE = 4; +} + +// The sub operation type based on the operation type. +message SqlSubOperationType { + // Sub operation details corresponding to the operation type. + oneof sub_operation_details { + // The type of maintenance to be performed on the instance. + SqlMaintenanceType maintenance_type = 1; + } +} + +// An Operation resource. For successful operations that return an +// Operation resource, only the fields relevant to the operation are populated +// in the resource. +message Operation { + // The type of Cloud SQL operation. + enum SqlOperationType { + // Unknown operation type. + SQL_OPERATION_TYPE_UNSPECIFIED = 0; + + // Imports data into a Cloud SQL instance. + IMPORT = 1; + + // Exports data from a Cloud SQL instance to a Cloud Storage + // bucket. + EXPORT = 2; + + // Creates a new Cloud SQL instance. + CREATE = 3; + + // Updates the settings of a Cloud SQL instance. + UPDATE = 4; + + // Deletes a Cloud SQL instance. + DELETE = 5; + + // Restarts the Cloud SQL instance. + RESTART = 6; + + BACKUP = 7 [deprecated = true]; + + SNAPSHOT = 8 [deprecated = true]; + + // Performs instance backup. + BACKUP_VOLUME = 9; + + // Deletes an instance backup. + DELETE_VOLUME = 10; + + // Restores an instance backup. + RESTORE_VOLUME = 11; + + // Injects a privileged user in mysql for MOB instances. + INJECT_USER = 12; + + // Clones a Cloud SQL instance. + CLONE = 14; + + // Stops replication on a Cloud SQL read replica instance. + STOP_REPLICA = 15; + + // Starts replication on a Cloud SQL read replica instance. + START_REPLICA = 16; + + // Promotes a Cloud SQL replica instance. + PROMOTE_REPLICA = 17; + + // Creates a Cloud SQL replica instance. + CREATE_REPLICA = 18; + + // Creates a new user in a Cloud SQL instance. + CREATE_USER = 19; + + // Deletes a user from a Cloud SQL instance. + DELETE_USER = 20; + + // Updates an existing user in a Cloud SQL instance. If a user with the + // specified username doesn't exist, a new user is created. + UPDATE_USER = 21; + + // Creates a database in the Cloud SQL instance. + CREATE_DATABASE = 22; + + // Deletes a database in the Cloud SQL instance. + DELETE_DATABASE = 23; + + // Updates a database in the Cloud SQL instance. + UPDATE_DATABASE = 24; + + // Performs failover of an HA-enabled Cloud SQL + // failover replica. + FAILOVER = 25; + + // Deletes the backup taken by a backup run. + DELETE_BACKUP = 26; + + RECREATE_REPLICA = 27; + + // Truncates a general or slow log table in MySQL. + TRUNCATE_LOG = 28; + + // Demotes the stand-alone instance to be a Cloud SQL + // read replica for an external database server. + DEMOTE_MASTER = 29; + + // Indicates that the instance is currently in maintenance. Maintenance + // typically causes the instance to be unavailable for 1-3 minutes. + MAINTENANCE = 30; + + // This field is deprecated, and will be removed in future version of API. + ENABLE_PRIVATE_IP = 31 [deprecated = true]; + + DEFER_MAINTENANCE = 32 [deprecated = true]; + + // Creates clone instance. + CREATE_CLONE = 33 [deprecated = true]; + + // Reschedule maintenance to another time. + RESCHEDULE_MAINTENANCE = 34; + + // Starts external sync of a Cloud SQL EM replica to an external primary + // instance. + START_EXTERNAL_SYNC = 35; + + // Recovers logs from an instance's old data disk. + LOG_CLEANUP = 36; + + // Performs auto-restart of an HA-enabled Cloud SQL database for auto + // recovery. + AUTO_RESTART = 37; + + // Re-encrypts CMEK instances with latest key version. + REENCRYPT = 38; + + // Switches the roles of the primary and replica pair. The target instance + // should be the replica. + SWITCHOVER = 39; + + // Update a backup. + UPDATE_BACKUP = 40; + + // Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + ACQUIRE_SSRS_LEASE = 42; + + // Release a lease for the setup of SQL Server Reporting Services (SSRS). + RELEASE_SSRS_LEASE = 43; + + // Reconfigures old primary after a promote replica operation. Effect of a + // promote operation to the old primary is executed in this operation, + // asynchronously from the promote replica operation executed to the + // replica. + RECONFIGURE_OLD_PRIMARY = 44; + + // Indicates that the instance, its read replicas, and its cascading + // replicas are in maintenance. Maintenance typically gets initiated on + // groups of replicas first, followed by the primary instance. For each + // instance, maintenance typically causes the instance to be unavailable for + // 1-3 minutes. + CLUSTER_MAINTENANCE = 45 [deprecated = true]; + + // Indicates that the instance (and any of its replicas) are currently in + // maintenance. This is initiated as a self-service request by using SSM. + // Maintenance typically causes the instance to be unavailable for 1-3 + // minutes. + SELF_SERVICE_MAINTENANCE = 46 [deprecated = true]; + + // Switches a primary instance to a replica. This operation runs as part of + // a switchover operation to the original primary instance. + SWITCHOVER_TO_REPLICA = 47; + + // Updates the major version of a Cloud SQL instance. + MAJOR_VERSION_UPGRADE = 48; + + // Deprecated: ADVANCED_BACKUP is deprecated. Use ENHANCED_BACKUP instead. + ADVANCED_BACKUP = 49 [deprecated = true]; + + // Changes the BackupTier of a Cloud SQL instance. + MANAGE_BACKUP = 50; + + // Creates a backup for an Enhanced BackupTier Cloud SQL instance. + ENHANCED_BACKUP = 51; + + // Repairs entire read pool or specified read pool nodes in the read pool. + REPAIR_READ_POOL = 52; + + // Creates a Cloud SQL read pool instance. + CREATE_READ_POOL = 53; + + // Pre-checks the major version upgrade operation. + PRE_CHECK_MAJOR_VERSION_UPGRADE = 54; + } + + // The status of an operation. + enum SqlOperationStatus { + // The state of the operation is unknown. + SQL_OPERATION_STATUS_UNSPECIFIED = 0; + + // The operation has been queued, but has not started yet. + PENDING = 1; + + // The operation is running. + RUNNING = 2; + + // The operation completed. + DONE = 3; + } + + // This is always `sql#operation`. + string kind = 1; + + string target_link = 2; + + // The status of an operation. + SqlOperationStatus status = 3; + + // The email address of the user who initiated this operation. + string user = 4; + + // The time this operation was enqueued in UTC timezone in [RFC + // 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp insert_time = 5; + + // The time this operation actually started in UTC timezone in [RFC + // 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp start_time = 6; + + // The time this operation finished in UTC timezone in [RFC + // 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp end_time = 7; + + // If errors occurred during processing of this operation, this field will be + // populated. + OperationErrors error = 8; + + // An Admin API warning message. + ApiWarning api_warning = 19; + + // The type of the operation. Valid values are: + // * `CREATE` + // * `DELETE` + // * `UPDATE` + // * `RESTART` + // * `IMPORT` + // * `EXPORT` + // * `BACKUP_VOLUME` + // * `RESTORE_VOLUME` + // * `CREATE_USER` + // * `DELETE_USER` + // * `CREATE_DATABASE` + // * `DELETE_DATABASE` + SqlOperationType operation_type = 9; + + // The context for import operation, if applicable. + ImportContext import_context = 10; + + // The context for export operation, if applicable. + ExportContext export_context = 11; + + // The context for backup operation, if applicable. + BackupContext backup_context = 17; + + // This field is only populated when the operation_type is + // PRE_CHECK_MAJOR_VERSION_UPGRADE. + // The PreCheckMajorVersionUpgradeContext message itself contains the details + // for that pre-check, such as the target database version for the upgrade + // and the results of the check (including any warnings or errors found). + PreCheckMajorVersionUpgradeContext pre_check_major_version_upgrade_context = + 50; + + // An identifier that uniquely identifies the operation. You can use this + // identifier to retrieve the Operations resource that has information about + // the operation. + string name = 12; + + // Name of the resource on which this operation runs. + string target_id = 13; + + // The URI of this resource. + string self_link = 14; + + // The project ID of the target instance related to this operation. + string target_project = 15; + + // The context for acquire SSRS lease operation, if applicable. + AcquireSsrsLeaseContext acquire_ssrs_lease_context = 20; + + // Optional. The sub operation based on the operation type. + SqlSubOperationType sub_operation_type = 48 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Database instance operation error. +message OperationError { + // This is always `sql#operationError`. + string kind = 1; + + // Identifies the specific error that occurred. + string code = 2; + + // Additional information about the error encountered. + string message = 3; +} + +// Database instance operation errors list wrapper. +message OperationErrors { + // This is always `sql#operationErrors`. + string kind = 1; + + // The list of errors encountered while processing this operation. + repeated OperationError errors = 2; +} + +// Database instance local user password validation policy. +// This message defines the password policy for local database users. +// When enabled, it enforces constraints on password complexity, length, +// and reuse. Keep this policy enabled to help prevent unauthorized access. +message PasswordValidationPolicy { + // The complexity choices of the password. + enum Complexity { + // Complexity check is not specified. + COMPLEXITY_UNSPECIFIED = 0; + + // A combination of lowercase, uppercase, numeric, and non-alphanumeric + // characters. + COMPLEXITY_DEFAULT = 1; + } + + // Minimum number of characters allowed. + google.protobuf.Int32Value min_length = 1; + + // The complexity of the password. + Complexity complexity = 2; + + // Number of previous passwords that cannot be reused. + google.protobuf.Int32Value reuse_interval = 3; + + // Disallow username as a part of the password. + google.protobuf.BoolValue disallow_username_substring = 4; + + // Minimum interval after which the password can be changed. This flag is only + // supported for PostgreSQL. + google.protobuf.Duration password_change_interval = 5; + + // Whether to enable the password policy or not. When enabled, passwords must + // meet complexity requirements. Keep this policy enabled to help prevent + // unauthorized access. Disabling this policy allows weak passwords. + google.protobuf.BoolValue enable_password_policy = 6; + + // This field is deprecated and will be removed in a future version of the + // API. + google.protobuf.BoolValue disallow_compromised_credentials = 7 + [deprecated = true]; +} + +// Data cache configurations. +message DataCacheConfig { + // Whether data cache is enabled for the instance. + bool data_cache_enabled = 1; +} + +// Config used to determine the final backup settings for the instance. +message FinalBackupConfig { + // Whether the final backup is enabled for the instance. + optional bool enabled = 1; + + // The number of days to retain the final backup after the instance deletion. + // The final backup will be purged at (time_of_instance_deletion + + // retention_days). + optional int32 retention_days = 3; +} + +// Database instance settings. +message Settings { + // Specifies when the instance is activated. + enum SqlActivationPolicy { + // Unknown activation plan. + SQL_ACTIVATION_POLICY_UNSPECIFIED = 0; + + // The instance is always up and running. + ALWAYS = 1; + + // The instance never starts. + NEVER = 2; + + // The instance starts upon receiving requests. + ON_DEMAND = 3 [deprecated = true]; + } + + // The edition of the instance. + enum Edition { + // The instance did not specify the edition. + EDITION_UNSPECIFIED = 0; + + // The instance is an enterprise edition. + ENTERPRISE = 2; + + // The instance is an Enterprise Plus edition. + ENTERPRISE_PLUS = 3; + } + + // The options for enforcing Cloud SQL connectors in the instance. + enum ConnectorEnforcement { + // The requirement for Cloud SQL connectors is unknown. + CONNECTOR_ENFORCEMENT_UNSPECIFIED = 0; + + // Do not require Cloud SQL connectors. + NOT_REQUIRED = 1; + + // Require all connections to use Cloud SQL connectors, including the + // Cloud SQL Auth Proxy and Cloud SQL Java, Python, and Go connectors. + // Note: This disables all existing authorized networks. + REQUIRED = 2; + } + + // ExecuteSql API's access to the instance. + enum DataApiAccess { + // Unspecified, effectively the same as `DISALLOW_DATA_API`. + DATA_API_ACCESS_UNSPECIFIED = 0; + + // Disallow using ExecuteSql API to connect to the instance. + DISALLOW_DATA_API = 1; + + // Allow using ExecuteSql API to connect to the instance. For private IP + // instances, this allows authorized users to access the instance from + // the public internet using ExecuteSql API. + ALLOW_DATA_API = 2; + } + + // The version of instance settings. This is a required field for update + // method to make sure concurrent updates are handled properly. During update, + // use the most recent settingsVersion value for this instance and do not try + // to update this value. + google.protobuf.Int64Value settings_version = 1; + + // The App Engine app IDs that can access this instance. + // (Deprecated) Applied to First Generation instances only. + repeated string authorized_gae_applications = 2 [deprecated = true]; + + // The tier (or machine type) for this instance, for example + // `db-custom-1-3840`. WARNING: Changing this restarts the instance. + string tier = 3; + + // This is always `sql#settings`. + string kind = 4; + + // User-provided labels, represented as a dictionary where each label is a + // single key value pair. + map user_labels = 5; + + // Availability type. Potential values: + // * `ZONAL`: The instance serves data from only one zone. Outages in that + // zone affect data accessibility. + // * `REGIONAL`: The instance can serve data from more than one zone in a + // region (it is highly available)./ + // + // For more information, see [Overview of the High Availability + // Configuration](https://cloud.google.com/sql/docs/mysql/high-availability). + SqlAvailabilityType availability_type = 6; + + // The pricing plan for this instance. This can be either `PER_USE` or + // `PACKAGE`. Only `PER_USE` is supported for Second Generation instances. + SqlPricingPlan pricing_plan = 7; + + // The type of replication this instance uses. This can be either + // `ASYNCHRONOUS` or `SYNCHRONOUS`. (Deprecated) This property was only + // applicable to First Generation instances. + SqlReplicationType replication_type = 8 [deprecated = true]; + + // The maximum size to which storage capacity can be automatically increased. + // The default value is 0, which specifies that there is no limit. + google.protobuf.Int64Value storage_auto_resize_limit = 9; + + // The activation policy specifies when the instance is activated; it is + // applicable only when the instance state is RUNNABLE. Valid values: + // * `ALWAYS`: The instance is on, and remains so even in the absence of + // connection requests. + // * `NEVER`: The instance is off; it is not activated, even if a + // connection request arrives. + SqlActivationPolicy activation_policy = 10; + + // The settings for IP Management. This allows to enable or disable the + // instance IP and manage which external networks can connect to the instance. + // The IPv4 address cannot be disabled for Second Generation instances. + IpConfiguration ip_configuration = 11; + + // Configuration to increase storage size automatically. The default value is + // true. + google.protobuf.BoolValue storage_auto_resize = 12; + + // The location preference settings. This allows the instance to be located as + // near as possible to either an App Engine app or Compute Engine zone for + // better performance. App Engine co-location was only applicable to First + // Generation instances. + LocationPreference location_preference = 13; + + // The database flags passed to the instance at startup. + repeated DatabaseFlags database_flags = 14; + + // The type of data disk: `PD_SSD` (default) or `PD_HDD`. Not used for + // First Generation instances. + SqlDataDiskType data_disk_type = 15; + + // The maintenance window for this instance. This specifies when the instance + // can be restarted for maintenance purposes. + MaintenanceWindow maintenance_window = 16; + + // The daily backup configuration for the instance. + BackupConfiguration backup_configuration = 17; + + // Configuration specific to read replica instances. Indicates whether + // replication is enabled or not. WARNING: Changing this restarts the + // instance. + google.protobuf.BoolValue database_replication_enabled = 18; + + // Configuration specific to read replica instances. Indicates whether + // database flags for crash-safe replication are enabled. This property was + // only applicable to First Generation instances. + google.protobuf.BoolValue crash_safe_replication_enabled = 19 + [deprecated = true]; + + // The size of data disk, in GB. The data disk size minimum is 10GB. + google.protobuf.Int64Value data_disk_size_gb = 20; + + // Active Directory configuration, relevant only for Cloud SQL for SQL Server. + SqlActiveDirectoryConfig active_directory_config = 22; + + // The name of server Instance collation. + string collation = 23; + + // Deny maintenance periods + repeated DenyMaintenancePeriod deny_maintenance_periods = 24; + + // Insights configuration, for now relevant only for Postgres. + InsightsConfig insights_config = 25; + + // The local user password validation policy of the instance. + PasswordValidationPolicy password_validation_policy = 27; + + // SQL Server specific audit configuration. + SqlServerAuditConfig sql_server_audit_config = 29; + + // Optional. The edition of the instance. + Edition edition = 38 [(google.api.field_behavior) = OPTIONAL]; + + // Specifies if connections must use Cloud SQL connectors. + // Option values include the following: `NOT_REQUIRED` (Cloud SQL instances + // can be connected without Cloud SQL + // Connectors) and `REQUIRED` (Only allow connections that use Cloud SQL + // Connectors). + // + // Note that using REQUIRED disables all existing authorized networks. If + // this field is not specified when creating a new instance, NOT_REQUIRED is + // used. If this field is not specified when patching or updating an existing + // instance, it is left unchanged in the instance. + ConnectorEnforcement connector_enforcement = 32; + + // Configuration to protect against accidental instance deletion. + google.protobuf.BoolValue deletion_protection_enabled = 33; + + // Server timezone, relevant only for Cloud SQL for SQL Server. + string time_zone = 34; + + // Specifies advanced machine configuration for the instances relevant only + // for SQL Server. + AdvancedMachineFeatures advanced_machine_features = 35; + + // Configuration for data cache. + DataCacheConfig data_cache_config = 37; + + // Optional. Configuration value for recreation of replica after certain + // replication lag + google.protobuf.Int32Value replication_lag_max_seconds = 39 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When this parameter is set to true, Cloud SQL instances can + // connect to Vertex AI to pass requests for real-time predictions and + // insights to the AI. The default value is false. This applies only to Cloud + // SQL for MySQL and Cloud SQL for PostgreSQL instances. + google.protobuf.BoolValue enable_google_ml_integration = 40 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. By default, Cloud SQL instances have schema extraction disabled + // for Dataplex. When this parameter is set to true, schema extraction for + // Dataplex on Cloud SQL instances is activated. + google.protobuf.BoolValue enable_dataplex_integration = 41 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When this parameter is set to true, Cloud SQL retains backups of + // the instance even after the instance is deleted. The ON_DEMAND backup will + // be retained until customer deletes the backup or the project. The AUTOMATED + // backup will be retained based on the backups retention setting. + google.protobuf.BoolValue retain_backups_on_delete = 42 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Provisioned number of I/O operations per second for the data + // disk. This field is only used for hyperdisk-balanced disk types. + optional int64 data_disk_provisioned_iops = 43 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Provisioned throughput measured in MiB per second for the data + // disk. This field is only used for hyperdisk-balanced disk types. + optional int64 data_disk_provisioned_throughput = 44 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The managed connection pooling configuration for the instance. + optional ConnectionPoolConfig connection_pool_config = 45 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The final backup configuration for the instance. + optional FinalBackupConfig final_backup_config = 47 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The read pool auto-scale configuration for the instance. + optional ReadPoolAutoScaleConfig read_pool_auto_scale_config = 48 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether the replica is in accelerated mode. This feature is in + // private preview and requires allowlisting to take effect. + google.protobuf.BoolValue accelerated_replica_mode = 49 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Cloud SQL for MySQL auto-upgrade configuration. When this + // parameter is set to true, auto-upgrade is enabled for MySQL 8.0 minor + // versions. The MySQL version must be 8.0.35 or higher. + optional bool auto_upgrade_enabled = 50 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Microsoft Entra ID configuration for the SQL Server instance. + SqlServerEntraIdConfig entraid_config = 52 + [(google.api.field_behavior) = OPTIONAL]; + + // This parameter controls whether to allow using ExecuteSql API to connect to + // the instance. Not allowed by default. + optional DataApiAccess data_api_access = 53; + + // Optional. Configuration for Performance Capture, provides diagnostic + // metrics during high load situations. + PerformanceCaptureConfig performance_capture_config = 54 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Performance capture configuration. +message PerformanceCaptureConfig { + // Optional. Enables or disables the performance capture feature. + optional bool enabled = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the interval in seconds between consecutive probes that + // check if any trigger condition thresholds have been reached. + optional int32 probing_interval_seconds = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the minimum number of consecutive probe threshold that + // triggers performance capture. + optional int32 probe_threshold = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the minimum number of MySQL `Threads_running` to + // trigger the performance capture on the primary instance. + optional int32 running_threads_threshold = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the minimum number of seconds replica must be lagging + // behind primary instance to trigger the performance capture on replica. + optional int32 seconds_behind_source_threshold = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the amount of time in seconds that a transaction needs + // to have been open before the watcher starts recording it. + optional int32 transaction_duration_threshold = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Connection pool flags for Cloud SQL instances managed connection pool +// configuration. +message ConnectionPoolFlags { + // Required. The name of the flag. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value of the flag. Boolean flags are set to `on` for true + // and `off` for false. This field must be omitted if the flag + // doesn't take a value. + string value = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The managed connection pooling configuration. +message ConnectionPoolConfig { + // Whether managed connection pooling is enabled. + optional bool connection_pooling_enabled = 1; + + // Optional. List of connection pool configuration flags. + repeated ConnectionPoolFlags flags = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Number of connection poolers. + optional int32 pooler_count = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The read pool auto-scale configuration. +message ReadPoolAutoScaleConfig { + // Target metric for read pool auto scaling. + message TargetMetric { + // The metric name to be used for auto scaling. + optional string metric = 1; + + // The target value for the metric. + optional float target_value = 2; + } + + // Indicates whether read pool auto scaling is enabled. + optional bool enabled = 1; + + // Minimum number of read pool nodes to be maintained. + optional int32 min_node_count = 2; + + // Maximum number of read pool nodes to be maintained. + optional int32 max_node_count = 3; + + // Optional. Target metrics for read pool auto scaling. + repeated TargetMetric target_metrics = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Indicates whether read pool auto scaling supports scale in operations + // (removing nodes). + optional bool disable_scale_in = 5; + + // The cooldown period for scale-in operations. + optional int32 scale_in_cooldown_seconds = 6; + + // The cooldown period for scale-out operations. + optional int32 scale_out_cooldown_seconds = 7; +} + +// Specifies options for controlling advanced machine features. +message AdvancedMachineFeatures { + // The number of threads per physical core. + int32 threads_per_core = 1; +} + +// SslCerts Resource +message SslCert { + // This is always `sql#sslCert`. + string kind = 1; + + // Serial number, as extracted from the certificate. + string cert_serial_number = 2; + + // PEM representation. + string cert = 3; + + // The time when the certificate was created in [RFC + // 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z` + google.protobuf.Timestamp create_time = 4; + + // User supplied name. Constrained to [a-zA-Z.-_ ]+. + string common_name = 5; + + // The time when the certificate expires in [RFC + // 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp expiration_time = 6; + + // Sha1 Fingerprint. + string sha1_fingerprint = 7; + + // Name of the database instance. + string instance = 8; + + // The URI of this resource. + string self_link = 9; +} + +// SslCertDetail. +message SslCertDetail { + // The public information about the cert. + SslCert cert_info = 1; + + // The private key for the client cert, in pem format. Keep private in order + // to protect your security. + string cert_private_key = 2; +} + +// Active Directory configuration, relevant only for Cloud SQL for SQL Server. +message SqlActiveDirectoryConfig { + // The modes of Active Directory configuration. + enum ActiveDirectoryMode { + // Unspecified mode. Will default to MANAGED_ACTIVE_DIRECTORY if the mode is + // not specified to maintain backward compatibility. + ACTIVE_DIRECTORY_MODE_UNSPECIFIED = 0; + + // Managed Active Directory mode. + MANAGED_ACTIVE_DIRECTORY = 1; + + // Deprecated: Use CUSTOMER_MANAGED_ACTIVE_DIRECTORY instead. + SELF_MANAGED_ACTIVE_DIRECTORY = 2 [deprecated = true]; + + // Customer-managed Active Directory mode. + CUSTOMER_MANAGED_ACTIVE_DIRECTORY = 3; + } + + // This is always sql#activeDirectoryConfig. + string kind = 1; + + // The name of the domain (e.g., mydomain.com). + string domain = 2; + + // Optional. The mode of the Active Directory configuration. + ActiveDirectoryMode mode = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Domain controller IPv4 addresses used to bootstrap Active + // Directory. + repeated string dns_servers = 4 [ + (google.api.field_info).format = IPV4, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. The secret manager key storing the administrator credential. + // (e.g., projects/{project}/secrets/{secret}). + string admin_credential_secret_name = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The organizational unit distinguished name. This is the full + // hierarchical path to the organizational unit. + string organizational_unit = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// SQL Server specific audit configuration. +message SqlServerAuditConfig { + // This is always sql#sqlServerAuditConfig + string kind = 1; + + // The name of the destination bucket (e.g., gs://mybucket). + string bucket = 2; + + // How long to keep generated audit files. + google.protobuf.Duration retention_interval = 3; + + // How often to upload generated audit files. + google.protobuf.Duration upload_interval = 4; +} + +// SQL Server Entra ID configuration. +message SqlServerEntraIdConfig { + // Output only. This is always sql#sqlServerEntraIdConfig + string kind = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The tenant ID for the Entra ID configuration. + string tenant_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The application ID for the Entra ID configuration. + string application_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +enum SqlBackendType { + // This is an unknown backend type for instance. + SQL_BACKEND_TYPE_UNSPECIFIED = 0; + + // V1 speckle instance. + FIRST_GEN = 1 [deprecated = true]; + + // V2 speckle instance. + SECOND_GEN = 2; + + // On premises instance. + EXTERNAL = 3; +} + +enum SqlIpAddressType { + // This is an unknown IP address type. + SQL_IP_ADDRESS_TYPE_UNSPECIFIED = 0; + + // IP address the customer is supposed to connect to. Usually this is the + // load balancer's IP address + PRIMARY = 1; + + // Source IP address of the connection a read replica establishes to its + // external primary instance. This IP address can be allowlisted by the + // customer in case it has a firewall that filters incoming connection to its + // on premises primary instance. + OUTGOING = 2; + + // Private IP used when using private IPs and network peering. + PRIVATE = 3; + + // V1 IP of a migrated instance. We want the user to + // decommission this IP as soon as the migration is complete. + // Note: V1 instances with V1 ip addresses will be counted as PRIMARY. + MIGRATED_1ST_GEN = 4; +} + +// The database engine type and version. +enum SqlDatabaseVersion { + // This is an unknown database version. + SQL_DATABASE_VERSION_UNSPECIFIED = 0; + + // The database version is MySQL 5.1. + MYSQL_5_1 = 2 [deprecated = true]; + + // The database version is MySQL 5.5. + MYSQL_5_5 = 3 [deprecated = true]; + + // The database version is MySQL 5.6. + MYSQL_5_6 = 5; + + // The database version is MySQL 5.7. + MYSQL_5_7 = 6; + + // The database version is MySQL 8. + MYSQL_8_0 = 20; + + // The database major version is MySQL 8.0 and the minor version is 18. + MYSQL_8_0_18 = 41; + + // The database major version is MySQL 8.0 and the minor version is 26. + MYSQL_8_0_26 = 85; + + // The database major version is MySQL 8.0 and the minor version is 27. + MYSQL_8_0_27 = 111; + + // The database major version is MySQL 8.0 and the minor version is 28. + MYSQL_8_0_28 = 132; + + // The database major version is MySQL 8.0 and the minor version is 29. + MYSQL_8_0_29 = 148 [deprecated = true]; + + // The database major version is MySQL 8.0 and the minor version is 30. + MYSQL_8_0_30 = 174; + + // The database major version is MySQL 8.0 and the minor version is 31. + MYSQL_8_0_31 = 197; + + // The database major version is MySQL 8.0 and the minor version is 32. + MYSQL_8_0_32 = 213; + + // The database major version is MySQL 8.0 and the minor version is 33. + MYSQL_8_0_33 = 238; + + // The database major version is MySQL 8.0 and the minor version is 34. + MYSQL_8_0_34 = 239; + + // The database major version is MySQL 8.0 and the minor version is 35. + MYSQL_8_0_35 = 240; + + // The database major version is MySQL 8.0 and the minor version is 36. + MYSQL_8_0_36 = 241; + + // The database major version is MySQL 8.0 and the minor version is 37. + MYSQL_8_0_37 = 355; + + // The database major version is MySQL 8.0 and the minor version is 39. + MYSQL_8_0_39 = 357; + + // The database major version is MySQL 8.0 and the minor version is 40. + MYSQL_8_0_40 = 358; + + // The database major version is MySQL 8.0 and the minor version is 41. + MYSQL_8_0_41 = 488; + + // The database major version is MySQL 8.0 and the minor version is 42. + MYSQL_8_0_42 = 489; + + // The database major version is MySQL 8.0 and the minor version is 43. + MYSQL_8_0_43 = 553; + + // The database major version is MySQL 8.0 and the minor version is 44. + MYSQL_8_0_44 = 554; + + // The database major version is MySQL 8.0 and the minor version is 45. + MYSQL_8_0_45 = 555; + + // The database major version is MySQL 8.0 and the minor version is 46. + MYSQL_8_0_46 = 556; + + // The database version is MySQL 8.4. + MYSQL_8_4 = 398; + + // The database version is MySQL 9.7. + MYSQL_9_7 = 654; + + // The database version is SQL Server 2017 Standard. + SQLSERVER_2017_STANDARD = 11; + + // The database version is SQL Server 2017 Enterprise. + SQLSERVER_2017_ENTERPRISE = 14; + + // The database version is SQL Server 2017 Express. + SQLSERVER_2017_EXPRESS = 15; + + // The database version is SQL Server 2017 Web. + SQLSERVER_2017_WEB = 16; + + // The database version is PostgreSQL 9.6. + POSTGRES_9_6 = 9; + + // The database version is PostgreSQL 10. + POSTGRES_10 = 18; + + // The database version is PostgreSQL 11. + POSTGRES_11 = 10; + + // The database version is PostgreSQL 12. + POSTGRES_12 = 19; + + // The database version is PostgreSQL 13. + POSTGRES_13 = 23; + + // The database version is PostgreSQL 14. + POSTGRES_14 = 110; + + // The database version is PostgreSQL 15. + POSTGRES_15 = 172; + + // The database version is PostgreSQL 16. + POSTGRES_16 = 272; + + // The database version is PostgreSQL 17. + POSTGRES_17 = 408; + + // The database version is PostgreSQL 18. + POSTGRES_18 = 557; + + // The database version is PostgreSQL 19. + POSTGRES_19 = 684; + + // The database version is SQL Server 2019 Standard. + SQLSERVER_2019_STANDARD = 26; + + // The database version is SQL Server 2019 Enterprise. + SQLSERVER_2019_ENTERPRISE = 27; + + // The database version is SQL Server 2019 Express. + SQLSERVER_2019_EXPRESS = 28; + + // The database version is SQL Server 2019 Web. + SQLSERVER_2019_WEB = 29; + + // The database version is SQL Server 2022 Standard. + SQLSERVER_2022_STANDARD = 199; + + // The database version is SQL Server 2022 Enterprise. + SQLSERVER_2022_ENTERPRISE = 200; + + // The database version is SQL Server 2022 Express. + SQLSERVER_2022_EXPRESS = 201; + + // The database version is SQL Server 2022 Web. + SQLSERVER_2022_WEB = 202; + + // The database version is SQL Server 2025 Standard. + SQLSERVER_2025_STANDARD = 549; + + // The database version is SQL Server 2025 Enterprise. + SQLSERVER_2025_ENTERPRISE = 550; + + // The database version is SQL Server 2025 Express. + SQLSERVER_2025_EXPRESS = 551; +} + +// The pricing plan for this instance. +enum SqlPricingPlan { + // This is an unknown pricing plan for this instance. + SQL_PRICING_PLAN_UNSPECIFIED = 0; + + // The instance is billed at a monthly flat rate. + PACKAGE = 1; + + // The instance is billed per usage. + PER_USE = 2; +} + +enum SqlReplicationType { + // This is an unknown replication type for a Cloud SQL instance. + SQL_REPLICATION_TYPE_UNSPECIFIED = 0; + + // The synchronous replication mode for First Generation instances. It is the + // default value. + SYNCHRONOUS = 1; + + // The asynchronous replication mode for First Generation instances. It + // provides a slight performance gain, but if an outage occurs while this + // option is set to asynchronous, you can lose up to a few seconds of updates + // to your data. + ASYNCHRONOUS = 2; +} + +// The type of disk that is used for a v2 instance to use. +enum SqlDataDiskType { + // This is an unknown data disk type. + SQL_DATA_DISK_TYPE_UNSPECIFIED = 0; + + // An SSD data disk. + PD_SSD = 1; + + // An HDD data disk. + PD_HDD = 2; + + // This field is deprecated and will be removed from a future version of the + // API. + OBSOLETE_LOCAL_SSD = 3 [deprecated = true]; + + // A Hyperdisk Balanced data disk. + HYPERDISK_BALANCED = 4; +} + +// The availability type of the given Cloud SQL instance. +enum SqlAvailabilityType { + // This is an unknown Availability type. + SQL_AVAILABILITY_TYPE_UNSPECIFIED = 0; + + // Zonal available instance. + ZONAL = 1; + + // Regional available instance. + REGIONAL = 2; +} + +enum SqlUpdateTrack { + // This is an unknown maintenance timing preference. + SQL_UPDATE_TRACK_UNSPECIFIED = 0; + + // For an instance with a scheduled maintenance window, this maintenance + // timing indicates that the maintenance update is scheduled 7 to 14 days + // after the notification is sent out. Also referred to as `Week 1` (Console) + // and `preview` (gcloud CLI). + canary = 1; + + // For an instance with a scheduled maintenance window, this maintenance + // timing indicates that the maintenance update is scheduled 15 to 21 days + // after the notification is sent out. Also referred to as `Week 2` (Console) + // and `production` (gcloud CLI). + stable = 2; + + // For instance with a scheduled maintenance window, this maintenance + // timing indicates that the maintenance update is scheduled 35 to 42 days + // after the notification is sent out. + week5 = 3; +} + +// Acquire SSRS lease context. +message AcquireSsrsLeaseContext { + // The username to be used as the setup login to connect to the database + // server for SSRS setup. + optional string setup_login = 1; + + // The username to be used as the service login to connect to the report + // database for SSRS setup. + optional string service_login = 2; + + // The report database to be used for SSRS setup. + optional string report_database = 3; + + // Lease duration needed for SSRS setup. + optional google.protobuf.Duration duration = 4; +} + +// DNS metadata. +message DnsNameMapping { + // The connection type of the DNS name. + // This enum is not frozen, and new values may be added in the future. + enum ConnectionType { + // Unknown connection type. + CONNECTION_TYPE_UNSPECIFIED = 0; + + // Public IP. + PUBLIC = 1; + + // Private services access (private IP). + PRIVATE_SERVICES_ACCESS = 2; + + // Private Service Connect. + PRIVATE_SERVICE_CONNECT = 3; + } + + // The scope that the DNS name applies to. + enum DnsScope { + // DNS scope not set. This value should not be used. + DNS_SCOPE_UNSPECIFIED = 0; + + // Indicates an instance-level DNS name. + INSTANCE = 1; + + // Indicates a cluster-level DNS name. + CLUSTER = 2; + } + + // The system responsible for managing the DNS record. + enum RecordManager { + // Record manager not set. This value should not be used. + RECORD_MANAGER_UNSPECIFIED = 0; + + // The record may be managed by the customer. It is not automatically + // managed by Cloud SQL automation. + CUSTOMER = 1; + + // The record is managed by Cloud SQL, which will create, update, + // and delete the DNS records for the zone automatically when + // the Cloud SQL database instance is created or updated. + CLOUD_SQL_AUTOMATION = 2; + } + + // Output only. The DNS name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The connection type of the DNS name. + ConnectionType connection_type = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The scope that the DNS name applies to. + DnsScope dns_scope = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The manager for this DNS record. + RecordManager record_manager = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto new file mode 100644 index 000000000000..1a39afd1c8bf --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto @@ -0,0 +1,141 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/cloud/sql/v1/cloud_sql_resources.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlSslCertsProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service to manage SSL certs for Cloud SQL instances. +service SqlSslCertsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Deletes the SSL certificate. For First Generation instances, the + // certificate remains valid until the instance is restarted. + rpc Delete(SqlSslCertsDeleteRequest) returns (Operation) { + option (google.api.http) = { + delete: "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + }; + } + + // Retrieves a particular SSL certificate. Does not include the private key + // (required for usage). The private key must be saved from the response to + // initial creation. + rpc Get(SqlSslCertsGetRequest) returns (SslCert) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + }; + } + + // Creates an SSL certificate and returns it along with the private key and + // server certificate authority. The new certificate will not be usable until + // the instance is restarted. + rpc Insert(SqlSslCertsInsertRequest) returns (SslCertsInsertResponse) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/sslCerts" + body: "body" + }; + } + + // Lists all of the current SSL certificates for the instance. + rpc List(SqlSslCertsListRequest) returns (SslCertsListResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/sslCerts" + }; + } +} + +message SqlSslCertsDeleteRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Sha1 FingerPrint. + string sha1_fingerprint = 3; +} + +message SqlSslCertsGetRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Sha1 FingerPrint. + string sha1_fingerprint = 3; +} + +message SqlSslCertsInsertRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + SslCertsInsertRequest body = 100; +} + +message SqlSslCertsListRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +// SslCerts insert request. +message SslCertsInsertRequest { + // User supplied name. Must be a distinct name from the other certificates + // for this instance. + string common_name = 1; +} + +// SslCert insert response. +message SslCertsInsertResponse { + // This is always `sql#sslCertsInsert`. + string kind = 1; + + // The operation to track the ssl certs insert request. + Operation operation = 2; + + // The server Certificate Authority's certificate. If this is missing you can + // force a new one to be generated by calling resetSslConfig method on + // instances resource. + SslCert server_ca_cert = 3; + + // The new client certificate and private key. + SslCertDetail client_cert = 4; +} + +// SslCerts list response. +message SslCertsListResponse { + // This is always `sql#sslCertsList`. + string kind = 1; + + // List of client certificates for the instance. + repeated SslCert items = 2; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_tiers.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_tiers.proto new file mode 100644 index 000000000000..42bec043bef0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_tiers.proto @@ -0,0 +1,76 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlTiersProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Service for providing machine types (tiers) for Cloud SQL instances. +service SqlTiersService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Lists all available machine types (tiers) for Cloud SQL, for example, + // `db-custom-1-3840`. For more information, see + // https://cloud.google.com/sql/pricing. + rpc List(SqlTiersListRequest) returns (TiersListResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/tiers" + }; + } +} + +// Tiers list request. +message SqlTiersListRequest { + // Project ID of the project for which to list tiers. + string project = 1; +} + +// Tiers list response. +message TiersListResponse { + // This is always `sql#tiersList`. + string kind = 1; + + // List of tiers. + repeated Tier items = 2; +} + +// A Google Cloud SQL service tier resource. +message Tier { + // An identifier for the machine type, for example, `db-custom-1-3840`. For + // related information, see [Pricing](/sql/pricing). + string tier = 1; + + // The maximum RAM usage of this tier in bytes. + int64 RAM = 2 [json_name = "RAM"]; + + // This is always `sql#tier`. + string kind = 3; + + // The maximum disk size of this tier in bytes. + int64 Disk_Quota = 4 [json_name = "DiskQuota"]; + + // The applicable regions for this tier. + repeated string region = 5; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto new file mode 100644 index 000000000000..b74de3516d5b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto @@ -0,0 +1,313 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/sql/v1/cloud_sql_resources.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlUsersProto"; +option java_package = "com.google.cloud.sql.v1"; + +// Cloud SQL users service. +service SqlUsersService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Deletes a user from a Cloud SQL instance. + rpc Delete(SqlUsersDeleteRequest) returns (Operation) { + option (google.api.http) = { + delete: "/v1/projects/{project}/instances/{instance}/users" + }; + } + + // Retrieves a resource containing information about a user. + rpc Get(SqlUsersGetRequest) returns (User) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/users/{name}" + }; + } + + // Creates a new user in a Cloud SQL instance. + rpc Insert(SqlUsersInsertRequest) returns (Operation) { + option (google.api.http) = { + post: "/v1/projects/{project}/instances/{instance}/users" + body: "body" + }; + } + + // Lists users in the specified Cloud SQL instance. + rpc List(SqlUsersListRequest) returns (UsersListResponse) { + option (google.api.http) = { + get: "/v1/projects/{project}/instances/{instance}/users" + }; + } + + // Updates an existing user in a Cloud SQL instance. + rpc Update(SqlUsersUpdateRequest) returns (Operation) { + option (google.api.http) = { + put: "/v1/projects/{project}/instances/{instance}/users" + body: "body" + }; + } +} + +message SqlUsersDeleteRequest { + // Host of the user in the instance. + string host = 1; + + // Database instance ID. This does not include the project ID. + string instance = 2; + + // Name of the user in the instance. + string name = 3; + + // Project ID of the project that contains the instance. + string project = 4; +} + +// Request message for Users Get RPC +message SqlUsersGetRequest { + // Database instance ID. This does not include the project ID. + string instance = 1; + + // User of the instance. + string name = 2; + + // Project ID of the project that contains the instance. + string project = 3; + + // Host of a user of the instance. + string host = 4; +} + +message SqlUsersInsertRequest { + // Database instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + User body = 100; +} + +message SqlUsersListRequest { + // Database instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +message SqlUsersUpdateRequest { + // Optional. Host of the user in the instance. + string host = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Database instance ID. This does not include the project ID. + string instance = 2; + + // Name of the user in the instance. + string name = 3; + + // Project ID of the project that contains the instance. + string project = 4; + + // Optional. List of database roles to grant to the user. body.database_roles + // will be ignored for update request. + repeated string database_roles = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies whether to revoke existing roles that are not present + // in the `database_roles` field. If `false` or unset, the database roles + // specified in `database_roles` are added to the user's existing roles. + optional bool revoke_existing_roles = 6 + [(google.api.field_behavior) = OPTIONAL]; + + User body = 100; +} + +// User level password validation policy. +message UserPasswordValidationPolicy { + // Number of failed login attempts allowed before user get locked. + int32 allowed_failed_attempts = 1; + + // Expiration duration after password is updated. + google.protobuf.Duration password_expiration_duration = 2; + + // If true, failed login attempts check will be enabled. + bool enable_failed_attempts_check = 3; + + // Output only. Read-only password status. + PasswordStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // If true, the user must specify the current password before changing the + // password. This flag is supported only for MySQL. + bool enable_password_verification = 5; +} + +// Read-only password status. +message PasswordStatus { + // If true, user does not have login privileges. + bool locked = 1; + + // The expiration time of the current password. + google.protobuf.Timestamp password_expiration_time = 2; +} + +// A Cloud SQL user resource. +message User { + // The user type. + enum SqlUserType { + // The database's built-in user type. + BUILT_IN = 0; + + // Cloud IAM user. + CLOUD_IAM_USER = 1; + + // Cloud IAM service account. + CLOUD_IAM_SERVICE_ACCOUNT = 2; + + // Cloud IAM group. Not used for login. + CLOUD_IAM_GROUP = 3; + + // Read-only. Login for a user that belongs to the Cloud IAM group. + CLOUD_IAM_GROUP_USER = 4; + + // Read-only. Login for a service account that belongs to the + // Cloud IAM group. + CLOUD_IAM_GROUP_SERVICE_ACCOUNT = 5; + + // Microsoft Entra ID user. + ENTRAID_USER = 7; + } + + // The type of retained password. + enum DualPasswordType { + // The default value. + DUAL_PASSWORD_TYPE_UNSPECIFIED = 0; + + // Do not update the user's dual password status. + NO_MODIFY_DUAL_PASSWORD = 1; + + // No dual password usable for connecting using this user. + NO_DUAL_PASSWORD = 2; + + // Dual password usable for connecting using this user. + DUAL_PASSWORD = 3; + } + + // Indicates if a group is available for IAM database authentication. + enum IamStatus { + // The default value for users that are not of type CLOUD_IAM_GROUP. + // Only CLOUD_IAM_GROUP users will be inactive or active. + // Users with an IamStatus of IAM_STATUS_UNSPECIFIED will not + // display whether they are active or inactive as that is not applicable to + // them. + IAM_STATUS_UNSPECIFIED = 0; + + // INACTIVE indicates a group is not available for IAM database + // authentication. + INACTIVE = 1; + + // ACTIVE indicates a group is available for IAM database authentication. + ACTIVE = 2; + } + + // This is always `sql#user`. + string kind = 1; + + // The password for the user. + string password = 2; + + // This field is deprecated and will be removed from a future version of the + // API. + string etag = 3; + + // The name of the user in the Cloud SQL instance. Can be omitted for + // `update` because it is already specified in the URL. + string name = 4; + + // Optional. The host from which the user can connect. For `insert` + // operations, host defaults to an empty string. For `update` + // operations, host is specified as part of the request URL. The host name + // cannot be updated after insertion. For a MySQL instance, it's required; + // for a PostgreSQL or SQL Server instance, it's optional. + string host = 5 [(google.api.field_behavior) = OPTIONAL]; + + // The name of the Cloud SQL instance. This does not include the project ID. + // Can be omitted for `update` because it is already specified on the + // URL. + string instance = 6; + + // The project ID of the project containing the Cloud SQL database. The Google + // apps domain is prefixed if applicable. Can be omitted for `update` because + // it is already specified on the URL. + string project = 7; + + // The user type. It determines the method to authenticate the user during + // login. The default is the database's built-in user type. + SqlUserType type = 8; + + // User details for specific database type + oneof user_details { + SqlServerUserDetails sqlserver_user_details = 9; + } + + // Optional. The full email for an IAM user. For normal database users, this + // will not be filled. Only applicable to MySQL database users. + string iam_email = 11 [(google.api.field_behavior) = OPTIONAL]; + + // User level password validation policy. + UserPasswordValidationPolicy password_policy = 12; + + // Dual password status for the user. + optional DualPasswordType dual_password_type = 13; + + // Indicates if a group is active or inactive for IAM database authentication. + optional IamStatus iam_status = 14; + + // Optional. Role memberships of the user + repeated string database_roles = 15 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a Sql Server user on the Cloud SQL instance. +message SqlServerUserDetails { + // If the user has been disabled + bool disabled = 1; + + // The server roles for this user + repeated string server_roles = 2; +} + +// User list response. +message UsersListResponse { + // This is always `sql#usersList`. + string kind = 1; + + // List of user resources in the instance. + repeated User items = 2; + + // Unused. + string next_page_token = 3 [deprecated = true]; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql.proto new file mode 100644 index 000000000000..ae82a77bea1a --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql.proto @@ -0,0 +1,1739 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1beta4; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/sql/v1beta4/cloud_sql_resources.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlServiceProto"; +option java_package = "com.google.cloud.sql.v1beta4"; + +service SqlBackupRunsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Deletes the backup taken by a backup run. + rpc Delete(SqlBackupRunsDeleteRequest) returns (Operation) { + option (google.api.http) = { + delete: "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" + }; + } + + // Retrieves a resource containing information about a backup run. + rpc Get(SqlBackupRunsGetRequest) returns (BackupRun) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" + }; + } + + // Creates a new backup run on demand. + rpc Insert(SqlBackupRunsInsertRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns" + body: "body" + }; + } + + // Lists all backup runs associated with the project or a given instance and + // configuration in the reverse chronological order of the backup initiation + // time. + rpc List(SqlBackupRunsListRequest) returns (BackupRunsListResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns" + }; + } +} + +service SqlDatabasesService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Deletes a database from a Cloud SQL instance. + rpc Delete(SqlDatabasesDeleteRequest) returns (Operation) { + option (google.api.http) = { + delete: "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" + }; + } + + // Retrieves a resource containing information about a database inside a Cloud + // SQL instance. + rpc Get(SqlDatabasesGetRequest) returns (Database) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" + }; + } + + // Inserts a resource containing information about a database inside a Cloud + // SQL instance. + // + // **Note:** You can't modify the default character set and collation. + rpc Insert(SqlDatabasesInsertRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/databases" + body: "body" + }; + } + + // Lists databases in the specified Cloud SQL instance. + rpc List(SqlDatabasesListRequest) returns (DatabasesListResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/databases" + }; + } + + // Partially updates a resource containing information about a database inside + // a Cloud SQL instance. This method supports patch semantics. + rpc Patch(SqlDatabasesUpdateRequest) returns (Operation) { + option (google.api.http) = { + patch: "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" + body: "body" + }; + } + + // Updates a resource containing information about a database inside a Cloud + // SQL instance. + rpc Update(SqlDatabasesUpdateRequest) returns (Operation) { + option (google.api.http) = { + put: "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" + body: "body" + }; + } +} + +service SqlFlagsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Lists all available database flags for Cloud SQL instances. + rpc List(SqlFlagsListRequest) returns (FlagsListResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/flags" + }; + } +} + +service SqlInstancesService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Add a new trusted Certificate Authority (CA) version for the specified + // instance. Required to prepare for a certificate rotation. If a CA version + // was previously added but never used in a certificate rotation, this + // operation replaces that version. There cannot be more than one CA version + // waiting to be rotated in. For instances that have enabled Certificate + // Authority Service (CAS) based server CA, use AddServerCertificate to add a + // new server certificate. + rpc AddServerCa(SqlInstancesAddServerCaRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCa" + }; + } + + // Add a new trusted server certificate version for the specified instance + // using Certificate Authority Service (CAS) server CA. Required to prepare + // for a certificate rotation. If a server certificate version was previously + // added but never used in a certificate rotation, this operation replaces + // that version. There cannot be more than one certificate version waiting to + // be rotated in. For instances not using CAS server CA, use AddServerCa + // instead. + rpc AddServerCertificate(SqlInstancesAddServerCertificateRequest) + returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCertificate" + }; + } + + // Adds a new Entra ID certificate for the specified instance. If an Entra ID + // certificate was previously added but never used in a certificate rotation, + // this operation replaces that version. + rpc AddEntraIdCertificate(SqlInstancesAddEntraIdCertificateRequest) + returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/addEntraIdCertificate" + }; + } + + // Creates a Cloud SQL instance as a clone of the source instance. Using this + // operation might cause your instance to restart. + rpc Clone(SqlInstancesCloneRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/clone" + body: "body" + }; + } + + // Deletes a Cloud SQL instance. + rpc Delete(SqlInstancesDeleteRequest) returns (Operation) { + option (google.api.http) = { + delete: "/sql/v1beta4/projects/{project}/instances/{instance}" + }; + } + + // Demotes the stand-alone instance to be a Cloud SQL read replica for an + // external database server. + rpc DemoteMaster(SqlInstancesDemoteMasterRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/demoteMaster" + body: "body" + }; + } + + // Demotes an existing standalone instance to be a Cloud SQL read replica + // for an external database server. + rpc Demote(SqlInstancesDemoteRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/demote" + body: "body" + }; + } + + // Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL + // dump or CSV file. + rpc Export(SqlInstancesExportRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/export" + body: "body" + }; + } + + // Initiates a manual failover of a high availability (HA) primary instance + // to a standby instance, which becomes the primary instance. Users are + // then rerouted to the new primary. For more information, see the + // [Overview of high + // availability](https://cloud.google.com/sql/docs/mysql/high-availability) + // page in the Cloud SQL documentation. + // If using Legacy HA (MySQL only), this causes the instance to failover to + // its failover replica instance. + rpc Failover(SqlInstancesFailoverRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/failover" + body: "body" + }; + } + + // Reencrypt CMEK instance with latest key version. + rpc Reencrypt(SqlInstancesReencryptRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/reencrypt" + body: "body" + }; + } + + // Retrieves a resource containing information about a Cloud SQL instance. + rpc Get(SqlInstancesGetRequest) returns (DatabaseInstance) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}" + }; + } + + // Imports data into a Cloud SQL instance from a SQL dump or CSV file in + // Cloud Storage. + rpc Import(SqlInstancesImportRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/import" + body: "body" + }; + } + + // Creates a new Cloud SQL instance. + rpc Insert(SqlInstancesInsertRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances" + body: "body" + }; + } + + // Lists instances under a given project. + rpc List(SqlInstancesListRequest) returns (InstancesListResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances" + }; + } + + // Lists all of the trusted Certificate Authorities (CAs) for the specified + // instance. There can be up to three CAs listed: the CA that was used to sign + // the certificate that is currently in use, a CA that has been added but not + // yet used to sign a certificate, and a CA used to sign a certificate that + // has previously rotated out. + rpc ListServerCas(SqlInstancesListServerCasRequest) + returns (InstancesListServerCasResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCas" + }; + } + + // Lists all versions of server certificates and certificate authorities (CAs) + // for the specified instance. There can be up to three sets of certs listed: + // the certificate that is currently in use, a future that has been added but + // not yet used to sign a certificate, and a certificate that has been rotated + // out. For instances not using Certificate Authority Service (CAS) server CA, + // use ListServerCas instead. + rpc ListServerCertificates(SqlInstancesListServerCertificatesRequest) + returns (InstancesListServerCertificatesResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCertificates" + }; + } + + // Lists all versions of EntraID certificates for the specified instance. + // There can be up to three sets of certificates listed: the certificate that + // is currently in use, a future that has been added but not yet used to sign + // a certificate, and a certificate that has been rotated out. + rpc ListEntraIdCertificates(SqlInstancesListEntraIdCertificatesRequest) + returns (InstancesListEntraIdCertificatesResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/listEntraIdCertificates" + }; + } + + // Partially updates settings of a Cloud SQL instance by merging the request + // with the current configuration. This method supports patch semantics. + rpc Patch(SqlInstancesPatchRequest) returns (Operation) { + option (google.api.http) = { + patch: "/sql/v1beta4/projects/{project}/instances/{instance}" + body: "body" + }; + } + + // Promotes the read replica instance to be an independent Cloud SQL + // primary instance. + // Using this operation might cause your instance to restart. + rpc PromoteReplica(SqlInstancesPromoteReplicaRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/promoteReplica" + }; + } + + // Switches over from the primary instance to the DR replica + // instance. + rpc Switchover(SqlInstancesSwitchoverRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/switchover" + }; + } + + // Deletes all client certificates and generates a new server SSL certificate + // for the instance. + rpc ResetSslConfig(SqlInstancesResetSslConfigRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/resetSslConfig" + }; + } + + // Restarts a Cloud SQL instance. + rpc Restart(SqlInstancesRestartRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/restart" + }; + } + + // Restores a backup of a Cloud SQL instance. Using this operation might cause + // your instance to restart. + rpc RestoreBackup(SqlInstancesRestoreBackupRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/restoreBackup" + body: "body" + }; + } + + // Rotates the server certificate to one signed by the Certificate Authority + // (CA) version previously added with the addServerCA method. For instances + // that have enabled Certificate Authority Service (CAS) based server CA, + // use RotateServerCertificate to rotate the server certificate. + rpc RotateServerCa(SqlInstancesRotateServerCaRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCa" + body: "body" + }; + } + + // Rotates the server certificate version to one previously added with the + // addServerCertificate method. For instances not using Certificate Authority + // Service (CAS) server CA, use RotateServerCa instead. + rpc RotateServerCertificate(SqlInstancesRotateServerCertificateRequest) + returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCertificate" + body: "body" + }; + } + + // Rotates the Entra Id certificate version to one previously added with the + // addEntraIdCertificate method. + rpc RotateEntraIdCertificate(SqlInstancesRotateEntraIdCertificateRequest) + returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/rotateEntraIdCertificate" + body: "body" + }; + } + + // Starts the replication in the read replica instance. + rpc StartReplica(SqlInstancesStartReplicaRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/startReplica" + }; + } + + // Stops the replication in the read replica instance. + rpc StopReplica(SqlInstancesStopReplicaRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/stopReplica" + }; + } + + // Truncate MySQL general and slow query log tables + // MySQL only. + rpc TruncateLog(SqlInstancesTruncateLogRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/truncateLog" + body: "body" + }; + } + + // Updates settings of a Cloud SQL instance. Using this operation might cause + // your instance to restart. + rpc Update(SqlInstancesUpdateRequest) returns (Operation) { + option (google.api.http) = { + put: "/sql/v1beta4/projects/{project}/instances/{instance}" + body: "body" + }; + } + + // Generates a short-lived X509 certificate containing the provided public key + // and signed by a private key specific to the target instance. Users may use + // the certificate to authenticate as themselves when connecting to the + // database. + rpc CreateEphemeral(SqlInstancesCreateEphemeralCertRequest) + returns (SslCert) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/createEphemeral" + body: "body" + }; + } + + // Reschedules the maintenance on the given instance. + rpc RescheduleMaintenance(SqlInstancesRescheduleMaintenanceRequest) + returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/rescheduleMaintenance" + body: "body" + }; + } + + // Verify External primary instance external sync settings. + rpc VerifyExternalSyncSettings(SqlInstancesVerifyExternalSyncSettingsRequest) + returns (SqlInstancesVerifyExternalSyncSettingsResponse) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/verifyExternalSyncSettings" + body: "*" + }; + } + + // Start External primary instance migration. + rpc StartExternalSync(SqlInstancesStartExternalSyncRequest) + returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/startExternalSync" + body: "*" + }; + } + + // Perform Disk Shrink on primary instance. + rpc PerformDiskShrink(SqlInstancesPerformDiskShrinkRequest) + returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/performDiskShrink" + body: "body" + }; + } + + // Get Disk Shrink Config for a given instance. + rpc GetDiskShrinkConfig(SqlInstancesGetDiskShrinkConfigRequest) + returns (SqlInstancesGetDiskShrinkConfigResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/getDiskShrinkConfig" + }; + } + + // Reset Replica Size to primary instance disk size. + rpc ResetReplicaSize(SqlInstancesResetReplicaSizeRequest) + returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/resetReplicaSize" + body: "*" + }; + } + + // Get Latest Recovery Time for a given instance. + rpc GetLatestRecoveryTime(SqlInstancesGetLatestRecoveryTimeRequest) + returns (SqlInstancesGetLatestRecoveryTimeResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/getLatestRecoveryTime" + }; + } + + // Execute SQL statements. + rpc ExecuteSql(SqlInstancesExecuteSqlRequest) + returns (SqlInstancesExecuteSqlResponse) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/executeSql" + body: "body" + }; + } + + // Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + rpc AcquireSsrsLease(SqlInstancesAcquireSsrsLeaseRequest) + returns (SqlInstancesAcquireSsrsLeaseResponse) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/acquireSsrsLease" + body: "body" + }; + } + + // Release a lease for the setup of SQL Server Reporting Services (SSRS). + rpc ReleaseSsrsLease(SqlInstancesReleaseSsrsLeaseRequest) + returns (SqlInstancesReleaseSsrsLeaseResponse) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/releaseSsrsLease" + }; + } + + // Execute MVU Pre-checks + rpc PreCheckMajorVersionUpgrade( + SqlInstancesPreCheckMajorVersionUpgradeRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade" + body: "body" + }; + } + + // Point in time restore for an instance managed by Google Cloud Backup and + // Disaster Recovery. + rpc PointInTimeRestore(SqlInstancesPointInTimeRestoreRequest) + returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/{parent=projects/*}:pointInTimeRestore" + body: "context" + }; + } +} + +service SqlOperationsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Retrieves an instance operation that has been performed on an instance. + rpc Get(SqlOperationsGetRequest) returns (Operation) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/operations/{operation}" + }; + } + + // Lists all instance operations that have been performed on the given Cloud + // SQL instance in the reverse chronological order of the start time. + rpc List(SqlOperationsListRequest) returns (OperationsListResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/operations" + }; + } + + // Cancels an instance operation that has been performed on an instance. + // Ordinarily, this method name should be `CancelSqlOperation`. + rpc Cancel(SqlOperationsCancelRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/operations/{operation}/cancel" + }; + } +} + +service SqlSslCertsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Deletes the SSL certificate. For First Generation instances, the + // certificate remains valid until the instance is restarted. + rpc Delete(SqlSslCertsDeleteRequest) returns (Operation) { + option (google.api.http) = { + delete: "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + }; + } + + // Retrieves a particular SSL certificate. Does not include the private key + // (required for usage). The private key must be saved from the response to + // initial creation. + rpc Get(SqlSslCertsGetRequest) returns (SslCert) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + }; + } + + // Creates an SSL certificate and returns it along with the private key and + // server certificate authority. The new certificate will not be usable until + // the instance is restarted. + rpc Insert(SqlSslCertsInsertRequest) returns (SslCertsInsertResponse) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts" + body: "body" + }; + } + + // Lists all of the current SSL certificates for the instance. + rpc List(SqlSslCertsListRequest) returns (SslCertsListResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts" + }; + } +} + +service SqlBackupsService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Creates a backup for a Cloud SQL instance. This API can be used only to + // create on-demand backups. + rpc CreateBackup(CreateBackupRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/{parent=projects/*}/backups" + body: "backup" + }; + option (google.api.method_signature) = "parent, backup"; + } + + // Retrieves a resource containing information about a backup. + rpc GetBackup(GetBackupRequest) returns (Backup) { + option (google.api.http) = { + get: "/sql/v1beta4/{name=projects/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all backups associated with the project. + rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/{parent=projects/*}/backups" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates the retention period and the description of the backup. You can use + // this API to update final backups only. + rpc UpdateBackup(UpdateBackupRequest) returns (Operation) { + option (google.api.http) = { + patch: "/sql/v1beta4/{backup.name=projects/*/backups/*}" + body: "backup" + }; + option (google.api.method_signature) = "backup, update_mask"; + } + + // Deletes the backup. + rpc DeleteBackup(DeleteBackupRequest) returns (Operation) { + option (google.api.http) = { + delete: "/sql/v1beta4/{name=projects/*/backups/*}" + }; + option (google.api.method_signature) = "name"; + } +} + +// The request payload to create the backup +message CreateBackupRequest { + // Required. The parent resource where this backup is created. + // Format: projects/{project} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "sqladmin.googleapis.com/Backup" + } + ]; + + // Required. The Backup to create. + Backup backup = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request payload to get the backup. +message GetBackupRequest { + // Required. The name of the backup to retrieve. + // Format: projects/{project}/backups/{backup} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } + ]; +} + +// The request payload to list the backups. +message ListBackupsRequest { + // Required. The parent that owns this collection of backups. + // Format: projects/{project} + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "sqladmin.googleapis.com/Backup" + } + ]; + + // The maximum number of backups to return per response. The service might + // return fewer backups than this value. If a value for this parameter isn't + // specified, then, at most, 500 backups are returned. The maximum value is + // 2,000. Any values that you set, which are greater than 2,000, are changed + // to 2,000. + int32 page_size = 2; + + // A page token, received from a previous `ListBackups` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListBackups` must match + // the call that provided the page token. + string page_token = 3; + + // Multiple filter queries are separated by spaces. For example, + // 'instance:abc AND type:FINAL, 'location:us', + // 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + // type, instance, backupInterval.startTime (creation time), or location. + string filter = 4; +} + +// The response payload containing a list of the backups. +message ListBackupsResponse { + // A list of backups. + repeated Backup backups = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, then there aren't subsequent pages. + string next_page_token = 2; + + // If a region isn't unavailable or if an unknown error occurs, then a warning + // message is returned. + repeated ApiWarning warnings = 3; +} + +// The request payload to update the backup. +message UpdateBackupRequest { + // Required. The backup to update. + // The backup’s `name` field is used to identify the backup to update. + // Format: projects/{project}/backups/{backup} + Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields that you can update. You can update only the description + // and retention period of the final backup. + google.protobuf.FieldMask update_mask = 2; +} + +// The request payload to delete the backup. +message DeleteBackupRequest { + // Required. The name of the backup to delete. + // Format: projects/{project}/backups/{backup} + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } + ]; +} + +message SqlBackupRunsDeleteRequest { + // The ID of the backup run to delete. To find a backup run ID, use the + // [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/backupRuns/list) + // method. + int64 id = 1; + + // Cloud SQL instance ID. This does not include the project ID. + string instance = 2; + + // Project ID of the project that contains the instance. + string project = 3; +} + +message SqlBackupRunsGetRequest { + // The ID of this backup run. + int64 id = 1; + + // Cloud SQL instance ID. This does not include the project ID. + string instance = 2; + + // Project ID of the project that contains the instance. + string project = 3; +} + +message SqlBackupRunsInsertRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + BackupRun body = 100; +} + +message SqlBackupRunsListRequest { + // Cloud SQL instance ID, or "-" for all instances. This does not include + // the project ID. + string instance = 1; + + // Maximum number of backup runs per response. + int32 max_results = 2; + + // A previously-returned page token representing part of the larger set of + // results to view. + string page_token = 3; + + // Project ID of the project that contains the instance. + string project = 4; +} + +message SqlDatabasesDeleteRequest { + // Name of the database to be deleted in the instance. + string database = 1; + + // Database instance ID. This does not include the project ID. + string instance = 2; + + // Project ID of the project that contains the instance. + string project = 3; +} + +message SqlDatabasesGetRequest { + // Name of the database in the instance. + string database = 1; + + // Database instance ID. This does not include the project ID. + string instance = 2; + + // Project ID of the project that contains the instance. + string project = 3; +} + +message SqlDatabasesInsertRequest { + // Database instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + Database body = 100; +} + +message SqlDatabasesListRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +message SqlDatabasesUpdateRequest { + // Name of the database to be updated in the instance. + string database = 1; + + // Database instance ID. This does not include the project ID. + string instance = 2; + + // Project ID of the project that contains the instance. + string project = 3; + + Database body = 100; +} + +message SqlFlagsListRequest { + // Database type and version you want to retrieve flags for. By default, this + // method returns flags for all database types and versions. + string database_version = 1; + + // Optional. Specify the scope of flags to be returned by SqlFlagsListService. + // Return list of database flags if unspecified. + optional SqlFlagScope flag_scope = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +message SqlInstancesAddServerCaRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +// Request for AddServerCertificate RPC. +message SqlInstancesAddServerCertificateRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request for AddEntraIdCertificate RPC. +message SqlInstancesAddEntraIdCertificateRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message SqlInstancesCloneRequest { + // The ID of the Cloud SQL instance to be cloned (source). This does not + // include the project ID. + string instance = 1; + + // Project ID of the source as well as the clone Cloud SQL instance. + string project = 2; + + InstancesCloneRequest body = 100; +} + +message SqlInstancesDeleteRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance to be deleted. + string project = 2; + + // Flag to opt-in for final backup. By default, it is turned off. + optional bool enable_final_backup = 7; + + oneof expiration { + // Optional. Retention period of the final backup. + int64 final_backup_ttl_days = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Final Backup expiration time. + // Timestamp in UTC of when this resource is considered expired. + google.protobuf.Timestamp final_backup_expiry_time = 6 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The description of the final backup. + string final_backup_description = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +message SqlInstancesDemoteMasterRequest { + // Cloud SQL instance name. + string instance = 1; + + // ID of the project that contains the instance. + string project = 2; + + InstancesDemoteMasterRequest body = 100; +} + +// Instance demote request. +message SqlInstancesDemoteRequest { + // Required. The name of the Cloud SQL instance. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // The request body. + InstancesDemoteRequest body = 100; +} + +message SqlInstancesExportRequest { + // The Cloud SQL instance ID. This doesn't include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance to be exported. + string project = 2; + + InstancesExportRequest body = 100; +} + +message SqlInstancesFailoverRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // ID of the project that contains the read replica. + string project = 2; + + InstancesFailoverRequest body = 100; +} + +message SqlInstancesGetRequest { + // Database instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +message SqlInstancesImportRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + InstancesImportRequest body = 100; +} + +message SqlInstancesInsertRequest { + // Project ID of the project to which the newly created Cloud SQL instances + // should belong. + string project = 1; + + DatabaseInstance body = 100; +} + +message SqlInstancesListRequest { + // A filter expression that filters resources listed in the response. + // The expression is in the form of field:value. For example, + // 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per + // their JSON representation, such as 'settings.userLabels.auto_start:true'. + // + // Multiple filter queries are space-separated. For example. + // 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each + // expression is an AND expression. However, you can include AND and OR + // expressions explicitly. + string filter = 1; + + // The maximum number of instances to return. The service may return fewer + // than this value. + // If unspecified, at most 500 instances are returned. + // The maximum value is 1000; values above 1000 are coerced to 1000. + uint32 max_results = 2; + + // A previously-returned page token representing part of the larger set of + // results to view. + string page_token = 3; + + // Project ID of the project for which to list Cloud SQL instances. + string project = 4; +} + +message SqlInstancesListServerCasRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +message SqlInstancesListServerCertificatesRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for SqlInstancesService.ListEntraIdCertificates. +message SqlInstancesListEntraIdCertificatesRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +message SqlInstancesPatchRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + DatabaseInstance body = 100; +} + +message SqlInstancesPromoteReplicaRequest { + // Cloud SQL read replica instance name. + string instance = 1; + + // ID of the project that contains the read replica. + string project = 2; + + // Set to true to invoke a replica failover to the DR replica. + // As part of replica failover, the promote operation attempts + // to add the original primary instance as a replica of the promoted + // DR replica when the original primary instance comes back online. + // If set to false or not specified, then the original primary + // instance becomes an independent Cloud SQL primary instance. + bool failover = 3; +} + +// Instance switchover request. +message SqlInstancesSwitchoverRequest { + // Cloud SQL read replica instance name. + string instance = 1; + + // ID of the project that contains the replica. + string project = 2; + + // Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations + // timeout, which is a sum of all database operations. Default value is 10 + // minutes and can be modified to a maximum value of 24 hours. + google.protobuf.Duration db_timeout = 3 + [(google.api.field_behavior) = OPTIONAL]; +} + +message SqlInstancesResetSslConfigRequest { + // Reset SSL mode to selectively refresh the SSL materials. + enum ResetSslMode { + // Reset SSL mode is not specified. + RESET_SSL_MODE_UNSPECIFIED = 0; + + // Refresh all TLS configs. This is the default behaviour. + ALL = 1; + + // Refreshes the replication-related TLS configuration settings provided by + // the primary instance. + // Not applicable to on-premises replication instances. + SYNC_FROM_PRIMARY = 2; + } + + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Optional. Reset SSL mode to use. + ResetSslMode mode = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +message SqlInstancesRestartRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance to be restarted. + string project = 2; +} + +message SqlInstancesRestoreBackupRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + InstancesRestoreBackupRequest body = 100; +} + +message SqlInstancesRotateServerCaRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + InstancesRotateServerCaRequest body = 100; +} + +message SqlInstancesRotateServerCertificateRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Rotate server certificate request body. + InstancesRotateServerCertificateRequest body = 100 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for SqlInstancesService.RotateEntraIdCertificate. +message SqlInstancesRotateEntraIdCertificateRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Rotate Entra ID certificate request body. + InstancesRotateEntraIdCertificateRequest body = 100 + [(google.api.field_behavior) = REQUIRED]; +} + +message SqlInstancesStartReplicaRequest { + // Cloud SQL read replica instance name. + string instance = 1; + + // ID of the project that contains the read replica. + string project = 2; +} + +message SqlInstancesStopReplicaRequest { + // Cloud SQL read replica instance name. + string instance = 1; + + // ID of the project that contains the read replica. + string project = 2; +} + +message SqlInstancesTruncateLogRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the Cloud SQL project. + string project = 2; + + InstancesTruncateLogRequest body = 100; +} + +message SqlInstancesUpdateRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + DatabaseInstance body = 100; +} + +// Instance reencrypt request. +message SqlInstancesReencryptRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // ID of the project that contains the instance. + string project = 2; + + // Reencrypt body that users request + InstancesReencryptRequest body = 3; +} + +// Database Instance reencrypt request. +message InstancesReencryptRequest { + // Configuration specific to backup re-encryption + optional BackupReencryptionConfig backup_reencryption_config = 1; +} + +// Backup Reencryption Config +message BackupReencryptionConfig { + // Backup type for re-encryption + enum BackupType { + // Unknown backup type, will be defaulted to AUTOMATIC backup type + BACKUP_TYPE_UNSPECIFIED = 0; + + // Reencrypt automatic backups + AUTOMATED = 1; + + // Reencrypt on-demand backups + ON_DEMAND = 2; + } + + // Backup re-encryption limit + optional int32 backup_limit = 1; + + // Type of backups users want to re-encrypt. + optional BackupType backup_type = 2; +} + +message SqlInstancesRescheduleMaintenanceRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // ID of the project that contains the instance. + string project = 2; + + SqlInstancesRescheduleMaintenanceRequestBody body = 100; +} + +// Instance perform disk shrink request. +message SqlInstancesPerformDiskShrinkRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Perform disk shrink context. + PerformDiskShrinkContext body = 100; +} + +// External Sync parallel level. +enum ExternalSyncParallelLevel { + // Unknown sync parallel level. Will be defaulted to OPTIMAL. + EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED = 0; + + // Minimal parallel level. + MIN = 1; + + // Optimal parallel level. + OPTIMAL = 2; + + // Maximum parallel level. + MAX = 3; +} + +// The selected object that Cloud SQL migrates. +message ExternalSyncSelectedObject { + // The name of the database that Cloud SQL migrates. + string database = 1; +} + +message SqlInstancesVerifyExternalSyncSettingsRequest { + enum ExternalSyncMode { + // Unknown external sync mode, will be defaulted to ONLINE mode + EXTERNAL_SYNC_MODE_UNSPECIFIED = 0; + + // Online external sync will set up replication after initial data external + // sync + ONLINE = 1; + + // Offline external sync only dumps and loads a one-time snapshot of + // the primary instance's data + OFFLINE = 2; + } + + // MigrationType determines whether the migration is a physical file-based + // migration or a logical dump file-based migration. + enum MigrationType { + // Default value is a logical dump file-based migration + MIGRATION_TYPE_UNSPECIFIED = 0; + + // Logical dump file-based migration + LOGICAL = 1; + + // Physical file-based migration + PHYSICAL = 2; + } + + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Flag to enable verifying connection only + bool verify_connection_only = 3; + + // External sync mode + ExternalSyncMode sync_mode = 4; + + // Optional. Flag to verify settings required by replication setup only + bool verify_replication_only = 5 [(google.api.field_behavior) = OPTIONAL]; + + oneof sync_config { + // Optional. MySQL-specific settings for start external sync. + MySqlSyncConfig mysql_sync_config = 6 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. MigrationType configures the migration to use physical files or + // logical dump files. If not set, then the logical dump file configuration is + // used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + MigrationType migration_type = 7 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Parallel level for initial data sync. Only applicable for + // PostgreSQL. + ExternalSyncParallelLevel sync_parallel_level = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Migrate only the specified objects from the source instance. If + // this field is empty, then migrate all objects. + repeated ExternalSyncSelectedObject selected_objects = 9 + [(google.api.field_behavior) = OPTIONAL]; +} + +message SqlInstancesStartExternalSyncRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // ID of the project that contains the instance. + string project = 2; + + // External sync mode. + SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode sync_mode = 3; + + // Whether to skip the verification step (VESS). + bool skip_verification = 4; + + oneof sync_config { + // MySQL-specific settings for start external sync. + MySqlSyncConfig mysql_sync_config = 6; + } + + // Optional. Parallel level for initial data sync. Currently only applicable + // for MySQL. + ExternalSyncParallelLevel sync_parallel_level = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. MigrationType configures the migration to use physical files or + // logical dump files. If not set, then the logical dump file configuration is + // used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType migration_type = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. MySQL only. True if end-user has confirmed that this SES call + // will wipe replica databases overlapping with the proposed selected_objects. + // If this field is not set and there are both overlapping and additional + // databases proposed, an error will be returned. + bool replica_overwrite_enabled = 9 [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance reset replica size request. +message SqlInstancesResetReplicaSizeRequest { + // Cloud SQL read replica instance name. + string instance = 1; + + // ID of the project that contains the read replica. + string project = 2; +} + +message SqlOperationsGetRequest { + // Instance operation ID. + string operation = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +message SqlOperationsListRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Maximum number of operations per response. + uint32 max_results = 2; + + // A previously-returned page token representing part of the larger set of + // results to view. + string page_token = 3; + + // Project ID of the project that contains the instance. + string project = 4; +} + +// The request payload to cancel an operation. +message SqlOperationsCancelRequest { + // Instance operation ID. + string operation = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +message SqlInstancesCreateEphemeralCertRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the Cloud SQL project. + string project = 2; + + SslCertsCreateEphemeralRequest body = 100; +} + +message SqlSslCertsDeleteRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Sha1 FingerPrint. + string sha1_fingerprint = 3; +} + +message SqlSslCertsGetRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Sha1 FingerPrint. + string sha1_fingerprint = 3; +} + +message SqlSslCertsInsertRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + SslCertsInsertRequest body = 100; +} + +message SqlSslCertsListRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +// Instance get disk shrink config request. +message SqlInstancesGetDiskShrinkConfigRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +// Instance get latest recovery time request. +message SqlInstancesGetLatestRecoveryTimeRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // The timestamp used to identify the time when the source instance is + // deleted. If this instance is deleted, then you must set the timestamp. + optional google.protobuf.Timestamp source_instance_deletion_time = 3; +} + +// Instance get latest recovery time response. +message SqlInstancesGetLatestRecoveryTimeResponse { + // This is always `sql#getLatestRecoveryTime`. + string kind = 1; + + // Timestamp, identifies the latest recovery time of the source instance. + google.protobuf.Timestamp latest_recovery_time = 2; + + // Timestamp, identifies the earliest recovery time of the source instance. + google.protobuf.Timestamp earliest_recovery_time = 3; +} + +// Execute SQL statements request. +message SqlInstancesExecuteSqlRequest { + // Required. Database instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // The request body. + ExecuteSqlPayload body = 100; +} + +// Request to release a lease for SSRS. +message SqlInstancesReleaseSsrsLeaseRequest { + // Required. The Cloud SQL instance ID. This doesn't include the project ID. + // It's composed of lowercase letters, numbers, and hyphens, and it must start + // with a letter. The total length must be 98 characters or less (Example: + // instance-id). + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The ID of the project that contains the instance (Example: + // project-id). + string project = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The response for the release of the SSRS lease. +message SqlInstancesReleaseSsrsLeaseResponse { + // The operation ID. + string operation_id = 1; +} + +// The request payload used to execute SQL statements. +message ExecuteSqlPayload { + // Controls how the API should respond when the SQL execution result exceeds + // 10 MB. + enum PartialResultMode { + // Unspecified mode, effectively the same as `FAIL_PARTIAL_RESULT`. + PARTIAL_RESULT_MODE_UNSPECIFIED = 0; + + // Throw an error if the result exceeds 10 MB or if only a partial result + // can be retrieved. Don't return the result. + FAIL_PARTIAL_RESULT = 1; + + // Return a truncated result and set `partial_result` to true if the result + // exceeds 10 MB or if only a partial result can be retrieved due to error. + // Don't throw an error. + ALLOW_PARTIAL_RESULT = 2; + } + + // Optional. The name of an existing database user to connect to the database. + // When `auto_iam_authn` is set to true, this field is ignored and the API + // caller's IAM user is used. + string user = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. SQL statements to run on the database. It can be a single + // statement or a sequence of statements separated by semicolons. + string sql_statement = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. Name of the database on which the statement will be executed. + string database = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Credentials for the database connection. + oneof user_password { + // Optional. When set to true, the API caller identity associated with the + // request is used for database authentication. The API caller must be an + // IAM user in the database. + bool auto_iam_authn = 11 [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The maximum number of rows returned per SQL statement. + int64 row_limit = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Controls how the API should respond when the SQL execution result + // is incomplete due to the size limit or another error. The default mode is + // to throw an error. + PartialResultMode partial_result_mode = 13 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the name of the application that is making the request. + // This field is used for telemetry. Only alphanumeric characters, dashes, and + // underscores are allowed. The maximum length is 32 characters. + string application = 16 [(google.api.field_behavior) = OPTIONAL]; +} + +// Execute SQL statements response. +message SqlInstancesExecuteSqlResponse { + // Represents a notice or warning message from the database. + message Message { + // The full message string. + // For PostgreSQL, this is a formatted string that may include severity, + // code, and the notice/warning message. + // For MySQL, this contains the warning message. + optional string message = 1; + + // The severity of the message (e.g., "NOTICE" for PostgreSQL, "WARNING" for + // MySQL). + optional string severity = 2; + } + + // A list of notices and warnings generated during query execution. + // For PostgreSQL, this includes all notices and warnings. + // For MySQL, this includes warnings generated by the last executed statement. + // To retrieve all warnings for a multi-statement query, `SHOW WARNINGS` must + // be executed after each statement. + repeated Message messages = 9; + + // The additional metadata information regarding the execution of the SQL + // statements. + Metadata metadata = 6; + + // The list of results after executing all the SQL statements. + repeated QueryResult results = 7; + + // Contains the error from the database if the SQL execution failed. + google.rpc.Status status = 8; +} + +// QueryResult contains the result of executing a single SQL statement. +message QueryResult { + // List of columns included in the result. This also includes the data type + // of the column. + repeated Column columns = 1; + + // Rows returned by the SQL statement. + repeated Row rows = 2; + + // Message related to the SQL execution result. + string message = 3; + + // Set to true if the SQL execution's result is truncated due to size limits + // or an error retrieving results. + bool partial_result = 4; + + // If results were truncated due to an error, details of that error. + google.rpc.Status status = 8; +} + +// Contains the name and datatype of a column. +message Column { + // Name of the column. + string name = 1; + + // Datatype of the column. + string type = 2; +} + +// Contains the values for a row. +message Row { + // The values for the row. + repeated Value values = 1; +} + +// The cell value of the table. +message Value { + // The cell value represented in string format. + string value = 1; + + // If cell value is null, then this flag will be set to true. + bool null_value = 2; +} + +// The additional metadata information regarding the execution of the SQL +// statements. +message Metadata { + // The time taken to execute the SQL statements. + google.protobuf.Duration sql_statement_execution_time = 1; +} + +// Request to acquire a lease for SSRS. +message SqlInstancesAcquireSsrsLeaseRequest { + // Required. Cloud SQL instance ID. This doesn't include the project ID. It's + // composed of lowercase letters, numbers, and hyphens, and it must start with + // a letter. The total length must be 98 characters or less (Example: + // instance-id). + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. ID of the project that contains the instance (Example: + // project-id). + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // The body for request to acquire an SSRS lease. + InstancesAcquireSsrsLeaseRequest body = 100; +} + +// Request for Pre-checks for MVU +message SqlInstancesPreCheckMajorVersionUpgradeRequest { + // Required. Cloud SQL instance ID. This does not include the project ID. + string instance = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Project ID of the project that contains the instance. + string project = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The context for request to perform the pre-check major version + // upgrade operation. + InstancesPreCheckMajorVersionUpgradeRequest body = 3 + [(google.api.field_behavior) = REQUIRED]; +} + +// Acquire SSRS lease response. +message SqlInstancesAcquireSsrsLeaseResponse { + // The unique identifier for this operation. + optional string operation_id = 1; +} + +// Request to perform a point in time restore on a Google Cloud Backup and +// Disaster Recovery managed instance. +message SqlInstancesPointInTimeRestoreRequest { + // Required. The parent resource where you created this instance. + // Format: projects/{project} + string parent = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The context for request to perform a PITR on a Google Cloud + // Backup and Disaster Recovery managed instance. + PointInTimeRestoreContext context = 100 + [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto new file mode 100644 index 000000000000..dd71ca90f164 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto @@ -0,0 +1,217 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1beta4; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/sql/v1beta4/cloud_sql_resources.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlConnectProto"; +option java_package = "com.google.cloud.sql.v1beta4"; + +// Cloud SQL connect service. +service SqlConnectService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Retrieves connect settings about a Cloud SQL instance. + rpc GetConnectSettings(GetConnectSettingsRequest) returns (ConnectSettings) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/connectSettings" + }; + } + + // Generates a short-lived X509 certificate containing the provided public key + // and signed by a private key specific to the target instance. Users may use + // the certificate to authenticate as themselves when connecting to the + // database. + rpc GenerateEphemeralCert(GenerateEphemeralCertRequest) + returns (GenerateEphemeralCertResponse) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}:generateEphemeralCert" + body: "*" + }; + } +} + +// Connect settings retrieval request. +message GetConnectSettingsRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // Optional. Optional snapshot read timestamp to trade freshness for + // performance. + google.protobuf.Timestamp read_time = 7 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Connect settings retrieval response. +message ConnectSettings { + // Various Certificate Authority (CA) modes for certificate signing. + enum CaMode { + // CA mode is unspecified. It is effectively the same as + // `GOOGLE_MANAGED_INTERNAL_CA`. + CA_MODE_UNSPECIFIED = 0; + + // Google-managed self-signed internal CA. + GOOGLE_MANAGED_INTERNAL_CA = 1; + + // Google-managed regional CA part of root CA hierarchy hosted on Google + // Cloud's Certificate Authority Service (CAS). + GOOGLE_MANAGED_CAS_CA = 2; + + // Customer-managed CA hosted on Google Cloud's Certificate Authority + // Service (CAS). + CUSTOMER_MANAGED_CAS_CA = 3; + } + + // Details of a single read pool node of a read pool. + message ConnectPoolNodeConfig { + // Output only. The name of the read pool node. Doesn't include the project + // ID. + optional string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Mappings containing IP addresses that can be used to connect + // to the read pool node. + repeated IpMapping ip_addresses = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The DNS name of the read pool node. + optional string dns_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of DNS names used by this read pool node. + repeated DnsNameMapping dns_names = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // MdxProtocolSupport describes parts of the MDX protocol supported by this + // instance. + enum MdxProtocolSupport { + // Not specified. + MDX_PROTOCOL_SUPPORT_UNSPECIFIED = 0; + + // Client should send the client protocol type in the MDX request. + CLIENT_PROTOCOL_TYPE = 1; + } + + // This is always `sql#connectSettings`. + string kind = 1; + + // SSL configuration. + SslCert server_ca_cert = 2; + + // The assigned IP addresses for the instance. + repeated IpMapping ip_addresses = 3; + + // The cloud region for the instance. e.g. `us-central1`, `europe-west1`. + // The region cannot be changed after instance creation. + string region = 4; + + // The database engine type and version. The `databaseVersion` + // field cannot be changed after instance creation. + // MySQL instances: `MYSQL_8_0`, `MYSQL_5_7` (default), + // or `MYSQL_5_6`. + // PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, + // `POSTGRES_11` or `POSTGRES_12` (default), `POSTGRES_13`, or `POSTGRES_14`. + // SQL Server instances: `SQLSERVER_2017_STANDARD` (default), + // `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, + // `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, + // `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or + // `SQLSERVER_2019_WEB`. + SqlDatabaseVersion database_version = 31; + + // `SECOND_GEN`: Cloud SQL database instance. + // `EXTERNAL`: A database server that is not managed by Google. + // This property is read-only; use the `tier` property in the `settings` + // object to determine the database type. + SqlBackendType backend_type = 32; + + // Whether PSC connectivity is enabled for this instance. + bool psc_enabled = 33; + + // The dns name of the instance. + string dns_name = 34; + + // Specify what type of CA is used for the server certificate. + CaMode server_ca_mode = 35; + + // Custom subject alternative names for the server certificate. + repeated string custom_subject_alternative_names = 37; + + // Output only. The list of DNS names used by this instance. + repeated DnsNameMapping dns_names = 38 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The number of read pool nodes in a read pool. + optional int32 node_count = 63; + + // Output only. Entries containing information about each read pool node of + // the read pool. + repeated ConnectPoolNodeConfig nodes = 64 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Output only. mdx_protocol_support controls how the client uses + // metadata exchange when connecting to the instance. The values in the list + // representing parts of the MDX protocol that are supported by this instance. + // When the list is empty, the instance does not support MDX, so the client + // must not send an MDX request. The default is empty. + repeated MdxProtocolSupport mdx_protocol_support = 39 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = OPTIONAL + ]; +} + +// Ephemeral certificate creation request. +message GenerateEphemeralCertRequest { + // Cloud SQL instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + // PEM encoded public key to include in the signed certificate. + string public_key = 3 [json_name = "public_key"]; + + // Optional. Access token to include in the signed certificate. + string access_token = 4 + [json_name = "access_token", (google.api.field_behavior) = OPTIONAL]; + + // Optional. Optional snapshot read timestamp to trade freshness for + // performance. + google.protobuf.Timestamp read_time = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set, it will contain the cert valid duration. + google.protobuf.Duration valid_duration = 12 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Ephemeral certificate creation request. +message GenerateEphemeralCertResponse { + // Generated cert + SslCert ephemeral_cert = 1; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto new file mode 100644 index 000000000000..b115c94055c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto @@ -0,0 +1,30 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1beta4; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlIamPoliciesProto"; +option java_package = "com.google.cloud.sql.v1beta4"; + +// Service for providing IAM Meta APIs for Cloud SQL. +service SqlIamPoliciesService { + option (google.api.default_host) = "sqladmin.googleapis.com"; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto new file mode 100644 index 000000000000..4f48f2bf9f9f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto @@ -0,0 +1,4074 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1beta4; + +import "google/api/field_behavior.proto"; +import "google/api/field_info.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/wrappers.proto"; +import "google/type/interval.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlResourcesProto"; +option java_package = "com.google.cloud.sql.v1beta4"; +option (google.api.resource_definition) = { + type: "backupdr.googleapis.com/Backup" + pattern: "projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{network}" +}; + +// An entry for an Access Control list. +message AclEntry { + // The allowlisted value for the access control list. + string value = 1; + + // The time when this access control entry expires in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp expiration_time = 2; + + // Optional. A label to identify this entry. + string name = 3 [(google.api.field_behavior) = OPTIONAL]; + + // This is always `sql#aclEntry`. + string kind = 4; +} + +// An Admin API warning message. +message ApiWarning { + enum SqlApiWarningCode { + // An unknown or unset warning type from Cloud SQL API. + SQL_API_WARNING_CODE_UNSPECIFIED = 0; + + // Warning when one or more regions are not reachable. The returned result + // set may be incomplete. + REGION_UNREACHABLE = 1; + + // Warning when user provided maxResults parameter exceeds the limit. The + // returned result set may be incomplete. + MAX_RESULTS_EXCEEDS_LIMIT = 2; + + // Warning when user tries to create/update a user with credentials that + // have previously been compromised by a public data breach. + COMPROMISED_CREDENTIALS = 3; + + // Warning when the operation succeeds but some non-critical workflow state + // failed. + INTERNAL_STATE_FAILURE = 4; + } + + // Code to uniquely identify the warning type. + SqlApiWarningCode code = 1; + + // The warning message. + string message = 2; + + // The region name for REGION_UNREACHABLE warning. + string region = 3; +} + +// We currently only support backup retention by specifying the number +// of backups we will retain. +message BackupRetentionSettings { + // The units that retained_backups specifies, we only support COUNT. + enum RetentionUnit { + // Backup retention unit is unspecified, will be treated as COUNT. + RETENTION_UNIT_UNSPECIFIED = 0; + + // Retention will be by count, eg. "retain the most recent 7 backups". + COUNT = 1; + } + + // The unit that 'retained_backups' represents. + RetentionUnit retention_unit = 1; + + // Depending on the value of retention_unit, this is used to determine + // if a backup needs to be deleted. If retention_unit is 'COUNT', we will + // retain this many backups. + google.protobuf.Int32Value retained_backups = 2; +} + +// Database instance backup configuration. +message BackupConfiguration { + // This value contains the storage location of the transactional logs + // used to perform point-in-time recovery (PITR) for the database. + enum TransactionalLogStorageState { + // Unspecified. + TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED = 0; + + // The transaction logs used for PITR for the instance are stored + // on a data disk. + DISK = 1; + + // The transaction logs used for PITR for the instance are switching from + // being stored on a data disk to being stored in Cloud Storage. + // Only applicable to MySQL. + SWITCHING_TO_CLOUD_STORAGE = 2; + + // The transaction logs used for PITR for the instance are now stored + // in Cloud Storage. Previously, they were stored on a data disk. + // Only applicable to MySQL. + SWITCHED_TO_CLOUD_STORAGE = 3; + + // The transaction logs used for PITR for the instance are stored in + // Cloud Storage. Only applicable to MySQL and PostgreSQL. + CLOUD_STORAGE = 4; + } + + // Backup tier that manages the backups for the instance. + enum BackupTier { + // Unspecified. + BACKUP_TIER_UNSPECIFIED = 0; + + // Instance is managed by Cloud SQL. + STANDARD = 1; + + // Deprecated: ADVANCED is deprecated. Please use ENHANCED instead. + ADVANCED = 2 [deprecated = true]; + + // Instance is managed by Google Cloud Backup and DR Service. + ENHANCED = 3; + } + + // Start time for the daily backup configuration in UTC timezone in the 24 + // hour format - `HH:MM`. + string start_time = 1; + + // Whether this configuration is enabled. + google.protobuf.BoolValue enabled = 2; + + // This is always `sql#backupConfiguration`. + string kind = 3; + + // (MySQL only) Whether binary log is enabled. If backup configuration is + // disabled, binarylog must be disabled as well. + google.protobuf.BoolValue binary_log_enabled = 4; + + // Reserved for future use. + google.protobuf.BoolValue replication_log_archiving_enabled = 5; + + // Location of the backup + string location = 6; + + // Whether point in time recovery is enabled. + google.protobuf.BoolValue point_in_time_recovery_enabled = 7; + + // The number of days of transaction logs we retain for point in time + // restore, from 1-7. + google.protobuf.Int32Value transaction_log_retention_days = 9; + + // Backup retention settings. + BackupRetentionSettings backup_retention_settings = 10; + + // Output only. This value contains the storage location of transactional logs + // for the database for point-in-time recovery. + optional TransactionalLogStorageState transactional_log_storage_state = 11 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Backup tier that manages the backups for the instance. + optional BackupTier backup_tier = 12 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A BackupRun resource. +message BackupRun { + // This is always `sql#backupRun`. + string kind = 1; + + // The status of this run. + SqlBackupRunStatus status = 2; + + // The time the run was enqueued in UTC timezone in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp enqueued_time = 3; + + // The identifier for this backup run. Unique only for a specific Cloud SQL + // instance. + int64 id = 4; + + // The time the backup operation actually started in UTC timezone in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp start_time = 5; + + // The time the backup operation completed in UTC timezone in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp end_time = 6; + + // Information about why the backup operation failed. This is only present if + // the run has the FAILED status. + OperationError error = 7; + + // The type of this run; can be either "AUTOMATED" or "ON_DEMAND" or "FINAL". + // This field defaults to "ON_DEMAND" and is ignored, when specified for + // insert requests. + SqlBackupRunType type = 8; + + // The description of this run, only applicable to on-demand backups. + string description = 9; + + // The start time of the backup window during which this the backup was + // attempted in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for + // example `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp window_start_time = 10; + + // Name of the database instance. + string instance = 11; + + // The URI of this resource. + string self_link = 12; + + // Location of the backups. + string location = 13; + + // Output only. The instance database version at the time this backup was + // made. + SqlDatabaseVersion database_version = 15 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Encryption configuration specific to a backup. + DiskEncryptionConfiguration disk_encryption_configuration = 16; + + // Encryption status specific to a backup. + DiskEncryptionStatus disk_encryption_status = 17; + + // Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. + SqlBackupKind backup_kind = 19; + + // Backup time zone to prevent restores to an instance with + // a different time zone. Now relevant only for SQL Server. + string time_zone = 23; + + // Output only. The maximum chargeable bytes for the backup. + optional int64 max_chargeable_bytes = 24 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A backup resource. +message Backup { + option (google.api.resource) = { + type: "sqladmin.googleapis.com/Backup" + pattern: "projects/{project}/backups/{backup}" + }; + + // The backup type. + enum SqlBackupType { + // This is an unknown backup type. + SQL_BACKUP_TYPE_UNSPECIFIED = 0; + + // The backup schedule triggers a backup automatically. + AUTOMATED = 1; + + // The user triggers a backup manually. + ON_DEMAND = 2; + + // The backup that's created when the instance is deleted. + FINAL = 3; + } + + // The backup's state + enum SqlBackupState { + // The state of the backup is unknown. + SQL_BACKUP_STATE_UNSPECIFIED = 0; + + // The backup that's added to a queue. + ENQUEUED = 1; + + // The backup is in progress. + RUNNING = 2; + + // The backup failed. + FAILED = 3; + + // The backup is successful. + SUCCESSFUL = 4; + + // The backup is being deleted. + DELETING = 5; + + // Deletion of the backup failed. + DELETION_FAILED = 6; + } + + // Output only. The resource name of the backup. + // Format: projects/{project}/backups/{backup}. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This is always `sql#backup`. + string kind = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The URI of this resource. + string self_link = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The type of this backup. The type can be "AUTOMATED", + // "ON_DEMAND", or “FINAL”. + SqlBackupType type = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The description of this backup. + string description = 5; + + // The name of the database instance. + string instance = 6; + + // The storage location of the backups. The location can be multi-regional. + string location = 7; + + // Output only. This output contains the following values: + // start_time: All database writes up to this time are available. + // end_time: Any database writes after this time aren't available. + google.type.Interval backup_interval = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The state of this backup. + SqlBackupState state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Information about why the backup operation fails (for example, + // when the backup state fails). + OperationError error = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This output contains the encryption configuration for a backup + // and the resource name of the KMS key for disk encryption. + string kms_key = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This output contains the encryption status for a backup and + // the version of the KMS key that's used to encrypt the Cloud SQL instance. + string kms_key_version = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. + SqlBackupKind backup_kind = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This output contains a backup time zone. If a Cloud SQL for + // SQL Server instance has a different time zone from the backup's time zone, + // then the restore to the instance doesn't happen. + string time_zone = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; + + oneof expiration { + // Input only. The time-to-live (TTL) interval for this resource (in days). + // For example: ttlDays:7, means 7 days from the current time. The + // expiration time can't exceed 365 days from the time that the backup is + // created. + int64 ttl_days = 16 [(google.api.field_behavior) = INPUT_ONLY]; + + // Backup expiration time. + // A UTC timestamp of when this resource expired. + google.protobuf.Timestamp expiry_time = 17; + } + + // Output only. The database version of the instance of at the time this + // backup was made. + SqlDatabaseVersion database_version = 20 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The maximum chargeable bytes for the backup. + optional int64 max_chargeable_bytes = 23 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. Output only. Timestamp in UTC of when the instance associated + // with this backup is deleted. + google.protobuf.Timestamp instance_deletion_time = 24 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Optional. Output only. Instance setting of the source instance that's + // associated with this backup. + DatabaseInstance instance_settings = 25 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // Output only. The mapping to backup run resource used for IAM validations. + string backup_run = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This status indicates whether the backup satisfies PZS. + // + // The status is reserved for future use. + google.protobuf.BoolValue satisfies_pzs = 27 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. This status indicates whether the backup satisfies PZI. + // + // The status is reserved for future use. + google.protobuf.BoolValue satisfies_pzi = 28 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Backup run list results. +message BackupRunsListResponse { + // This is always `sql#backupRunsList`. + string kind = 1; + + // A list of backup runs in reverse chronological order of the enqueued time. + repeated BackupRun items = 2; + + // The continuation token, used to page through large result sets. Provide + // this value in a subsequent request to return the next page of results. + string next_page_token = 3; +} + +// Binary log coordinates. +message BinLogCoordinates { + // Name of the binary log file for a Cloud SQL instance. + string bin_log_file_name = 1; + + // Position (offset) within the binary log file. + int64 bin_log_position = 2; + + // This is always `sql#binLogCoordinates`. + string kind = 3; +} + +// Backup context. +message BackupContext { + // The identifier of the backup. + int64 backup_id = 1; + + // This is always `sql#backupContext`. + string kind = 2; + + // The name of the backup. + // Format: projects/{project}/backups/{backup} + string name = 3; +} + +// Database instance clone context. +message CloneContext { + // This is always `sql#cloneContext`. + string kind = 1; + + // Reserved for future use. + int64 pitr_timestamp_ms = 2; + + // Name of the Cloud SQL instance to be created as a clone. + string destination_instance_name = 3; + + // Binary log coordinates, if specified, identify the position up to which the + // source instance is cloned. If not specified, the source instance is + // cloned up to the most recent binary log coordinates. + BinLogCoordinates bin_log_coordinates = 4; + + // Timestamp, if specified, identifies the time to which the source instance + // is cloned. + google.protobuf.Timestamp point_in_time = 5; + + // The name of the allocated ip range for the private ip Cloud SQL instance. + // For example: "google-managed-services-default". If set, the cloned instance + // ip will be created in the allocated range. The range name must comply with + // [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name + // must be 1-63 characters long and match the regular expression + // [a-z]([-a-z0-9]*[a-z0-9])?. + // Reserved for future use. + string allocated_ip_range = 6; + + // (SQL Server only) Clone only the specified databases from the source + // instance. Clone all databases if empty. + repeated string database_names = 9; + + // Optional. Copy clone and point-in-time recovery clone of an instance to the + // specified zone. If no zone is specified, clone to the same primary zone as + // the source instance. + optional string preferred_zone = 10 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Copy clone and point-in-time recovery clone of a regional + // instance in the specified zones. If not specified, clone to the same + // secondary zone as the source instance. This value cannot be the same as the + // preferred_zone field. + optional string preferred_secondary_zone = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // The timestamp used to identify the time when the source instance is + // deleted. If this instance is deleted, then you must set the timestamp. + optional google.protobuf.Timestamp source_instance_deletion_time = 12; + + // Optional. The project ID of the destination project where the cloned + // instance will be created. To perform a cross-project clone, this field is + // required. If not specified, the clone is created in the same project + // as the source instance. + optional string destination_project = 13 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The fully qualified URI of the VPC network to which the cloned + // instance will be connected via Private Services Access for private IP. For + // example:`projects/my-network-project/global/networks/my-network`. This + // field is only required for cross-project cloning. + optional string destination_network = 14 [ + (google.api.field_behavior) = OPTIONAL, + (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } + ]; +} + +// Represents a SQL database on the Cloud SQL instance. +message Database { + // This is always `sql#database`. + string kind = 1; + + // The Cloud SQL charset value. + string charset = 2; + + // The Cloud SQL collation value. + string collation = 3; + + // This field is deprecated and will be removed from a future version of the + // API. + string etag = 4; + + // The name of the database in the Cloud SQL instance. This does not include + // the project ID or instance name. + string name = 5; + + // The name of the Cloud SQL instance. This does not include the project ID. + string instance = 6; + + // The URI of this resource. + string self_link = 7; + + // The project ID of the project containing the Cloud SQL database. The Google + // apps domain is prefixed if applicable. + string project = 8; + + oneof database_details { + SqlServerDatabaseDetails sqlserver_database_details = 9; + } +} + +// Represents a Sql Server database on the Cloud SQL instance. +message SqlServerDatabaseDetails { + // The version of SQL Server with which the database is to be made compatible + int32 compatibility_level = 1; + + // The recovery model of a SQL Server database + string recovery_model = 2; +} + +// Database flags for Cloud SQL instances. +message DatabaseFlags { + // The name of the flag. These flags are passed at instance startup, so + // include both server options and system variables. Flags are + // specified with underscores, not hyphens. For more information, see + // [Configuring Database Flags](https://cloud.google.com/sql/docs/mysql/flags) + // in the Cloud SQL documentation. + string name = 1; + + // The value of the flag. Boolean flags are set to `on` for true + // and `off` for false. This field must be omitted if the flag + // doesn't take a value. + string value = 2; +} + +// Initial sync flags for certain Cloud SQL APIs. +// Currently used for the MySQL external server initial dump. +message SyncFlags { + // The name of the flag. + string name = 1; + + // The value of the flag. This field must be omitted if the flag + // doesn't take a value. + string value = 2; +} + +// Reference to another Cloud SQL instance. +message InstanceReference { + // The name of the Cloud SQL instance being referenced. + // This does not include the project ID. + string name = 1; + + // The region of the Cloud SQL instance being referenced. + string region = 2; + + // The project ID of the Cloud SQL instance being referenced. + // The default is the same project ID as the instance references it. + string project = 3; +} + +// A Cloud SQL instance resource. +message DatabaseInstance { + // The current serving state of the database instance. + enum SqlInstanceState { + // The state of the instance is unknown. + SQL_INSTANCE_STATE_UNSPECIFIED = 0; + + // The instance is running, or has been stopped by owner. + RUNNABLE = 1; + + // The instance is not available, for example due to problems with billing. + SUSPENDED = 2; + + // The instance is being deleted. + PENDING_DELETE = 3; + + // The instance is being created. + PENDING_CREATE = 4; + + // The instance is down for maintenance. + MAINTENANCE = 5; + + // The creation of the instance failed or a fatal error occurred during + // maintenance. + FAILED = 6; + + // Deprecated + ONLINE_MAINTENANCE = 7 [deprecated = true]; + + // (Applicable to read pool nodes only.) The read pool node needs to be + // repaired. The database might be unavailable. + REPAIRING = 8; + } + + message SqlFailoverReplica { + // The name of the failover replica. If specified at instance creation, a + // failover replica is created for the instance. The name + // doesn't include the project ID. + string name = 1; + + // The availability status of the failover replica. A false status indicates + // that the failover replica is out of sync. The primary instance can only + // failover to the failover replica when the status is true. + google.protobuf.BoolValue available = 2; + } + + // Any scheduled maintenance for this instance. + message SqlScheduledMaintenance { + // The start time of any upcoming scheduled maintenance for this instance. + google.protobuf.Timestamp start_time = 1; + + bool can_defer = 2 [deprecated = true]; + + // If the scheduled maintenance can be rescheduled. + bool can_reschedule = 3; + + // Maintenance cannot be rescheduled to start beyond this deadline. + optional google.protobuf.Timestamp schedule_deadline_time = 4; + } + + // This message wraps up the information written by out-of-disk detection job. + message SqlOutOfDiskReport { + // This enum lists all possible states regarding out-of-disk issues. + enum SqlOutOfDiskState { + // Unspecified state + SQL_OUT_OF_DISK_STATE_UNSPECIFIED = 0; + + // The instance has plenty space on data disk + NORMAL = 1; + + // Data disk is almost used up. It is shutdown to prevent data + // corruption. + SOFT_SHUTDOWN = 2; + } + + // This field represents the state generated by the proactive database + // wellness job for OutOfDisk issues. + // * Writers: + // * the proactive database wellness job for OOD. + // * Readers: + // * the proactive database wellness job + optional SqlOutOfDiskState sql_out_of_disk_state = 1; + + // The minimum recommended increase size in GigaBytes + // This field is consumed by the frontend + // * Writers: + // * the proactive database wellness job for OOD. + // * Readers: + optional int32 sql_min_recommended_increase_size_gb = 2; + } + + // The SQL network architecture for the instance. + enum SqlNetworkArchitecture { + SQL_NETWORK_ARCHITECTURE_UNSPECIFIED = 0; + + // The instance uses the new network architecture. + NEW_NETWORK_ARCHITECTURE = 1; + + // The instance uses the old network architecture. + OLD_NETWORK_ARCHITECTURE = 2; + } + + // Details of a single read pool node of a read pool. + message PoolNodeConfig { + // Output only. The name of the read pool node, to be used for retrieving + // metrics and logs. + optional string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The zone of the read pool node. + optional string gce_zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Mappings containing IP addresses that can be used to connect + // to the read pool node. + repeated IpMapping ip_addresses = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The DNS name of the read pool node. + optional string dns_name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the read pool node. + optional SqlInstanceState state = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of DNS names used by this read pool node. + repeated DnsNameMapping dns_names = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Private Service Connect (PSC) service attachment of the + // read pool node. + optional string psc_service_attachment_link = 7 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of settings for requested automatically-setup + // Private Service Connect (PSC) consumer endpoints that can be used to + // connect to this read pool node. + repeated PscAutoConnectionConfig psc_auto_connections = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // This is always `sql#instance`. + string kind = 1; + + // The current serving state of the Cloud SQL instance. + SqlInstanceState state = 2; + + // The database engine type and version. The `databaseVersion` field cannot + // be changed after instance creation. + SqlDatabaseVersion database_version = 3; + + // The user settings. + Settings settings = 4; + + // This field is deprecated and will be removed from a future version of the + // API. Use the `settings.settingsVersion` field instead. + string etag = 5; + + // The name and status of the failover replica. + SqlFailoverReplica failover_replica = 6; + + // The name of the instance which will act as primary in the replication + // setup. + string master_instance_name = 7; + + // The replicas of the instance. + repeated string replica_names = 8; + + // The maximum disk size of the instance in bytes. + google.protobuf.Int64Value max_disk_size = 9 [deprecated = true]; + + // The current disk usage of the instance in bytes. This property has been + // deprecated. Use the + // "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud + // Monitoring API instead. Please see [this + // announcement](https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ) + // for details. + google.protobuf.Int64Value current_disk_size = 10 [deprecated = true]; + + // The assigned IP addresses for the instance. + repeated IpMapping ip_addresses = 11; + + // SSL configuration. + SslCert server_ca_cert = 12; + + // The instance type. + SqlInstanceType instance_type = 13; + + // The project ID of the project containing the Cloud SQL instance. The Google + // apps domain is prefixed if applicable. + string project = 14; + + // The IPv6 address assigned to the instance. + // (Deprecated) This property was applicable only + // to First Generation instances. + string ipv6_address = 15 [deprecated = true]; + + // The service account email address assigned to the instance. \This + // property is read-only. + string service_account_email_address = 16; + + // Configuration specific to on-premises instances. + OnPremisesConfiguration on_premises_configuration = 17; + + // Configuration specific to failover replicas and read replicas. + ReplicaConfiguration replica_configuration = 18; + + // The backend type. + // `SECOND_GEN`: Cloud SQL database instance. + // `EXTERNAL`: A database server that is not managed by Google. + // + // This property is read-only; use the `tier` property in the `settings` + // object to determine the database type. + SqlBackendType backend_type = 19; + + // The URI of this resource. + string self_link = 20; + + // If the instance state is SUSPENDED, the reason for the suspension. + repeated SqlSuspensionReason suspension_reason = 21; + + // Connection name of the Cloud SQL instance used in connection strings. + string connection_name = 22; + + // Name of the Cloud SQL instance. This does not include the project ID. + string name = 23; + + // The geographical region of the Cloud SQL instance. + // + // It can be one of the + // [regions](https://cloud.google.com/sql/docs/mysql/locations#location-r) + // where Cloud SQL operates: + // + // For example, `asia-east1`, `europe-west1`, and `us-central1`. + // The default value is `us-central1`. + string region = 24; + + // The Compute Engine zone that the instance is currently serving from. This + // value could be different from the zone that was specified when the instance + // was created if the instance has failed over to its secondary zone. WARNING: + // Changing this might restart the instance. + string gce_zone = 25; + + // The Compute Engine zone that the failover instance is currently serving + // from for a regional instance. This value could be different + // from the zone that was specified when the instance + // was created if the instance has failed over to its secondary/failover zone. + string secondary_gce_zone = 34; + + // Disk encryption configuration specific to an instance. + DiskEncryptionConfiguration disk_encryption_configuration = 26; + + // Disk encryption status specific to an instance. + DiskEncryptionStatus disk_encryption_status = 27; + + // Initial root password. Use only on creation. You must set root passwords + // before you can connect to PostgreSQL instances. + string root_password = 29; + + // The start time of any upcoming scheduled maintenance for this instance. + SqlScheduledMaintenance scheduled_maintenance = 30; + + // This status indicates whether the instance satisfies PZS. + // + // The status is reserved for future use. + google.protobuf.BoolValue satisfies_pzs = 35; + + // Output only. Stores the current database version running on the instance + // including minor version such as `MYSQL_8_0_18`. + string database_installed_version = 40 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // This field represents the report generated by the proactive database + // wellness job for OutOfDisk issues. + // * Writers: + // * the proactive database wellness job for OOD. + // * Readers: + // * the proactive database wellness job + optional SqlOutOfDiskReport out_of_disk_report = 38; + + // Output only. The time when the instance was created in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp create_time = 39 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. List all maintenance versions applicable on the instance + repeated string available_maintenance_versions = 41 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The current software version on the instance. + string maintenance_version = 42; + + // Output only. All database versions that are available for upgrade. + repeated AvailableDatabaseVersion upgradable_database_versions = 45 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The SQL network architecture for the instance. + optional SqlNetworkArchitecture sql_network_architecture = 47; + + // Output only. The link to service attachment of PSC instance. + optional string psc_service_attachment_link = 48 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The dns name of the instance. + optional string dns_name = 49 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. DEPRECATED: please use write_endpoint instead. + optional string primary_dns_name = 51 + [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The dns name of the primary instance in a replication group. + optional string write_endpoint = 52 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A primary instance and disaster recovery (DR) replica pair. + // A DR replica is a cross-region replica that you designate + // for failover in the event that the primary instance + // experiences regional failure. + // Applicable to MySQL and PostgreSQL. + optional ReplicationCluster replication_cluster = 54; + + // Gemini instance configuration. + optional GeminiInstanceConfig gemini_config = 55; + + // Output only. This status indicates whether the instance satisfies PZI. + // + // The status is reserved for future use. + google.protobuf.BoolValue satisfies_pzi = 56 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input only. Whether Cloud SQL is enabled to switch storing point-in-time + // recovery log files from a data disk to Cloud Storage. + optional google.protobuf.BoolValue + switch_transaction_logs_to_cloud_storage_enabled = 57 + [(google.api.field_behavior) = INPUT_ONLY]; + + // Input only. Determines whether an in-place major version upgrade of + // replicas happens when an in-place major version upgrade of a primary + // instance is initiated. + optional google.protobuf.BoolValue + include_replicas_for_major_version_upgrade = 59 + [(google.api.field_behavior) = INPUT_ONLY]; + + // Optional. Input only. Immutable. Tag keys and tag values that are bound to + // this instance. You must represent each item in the map as: + // `"" : ""`. + // + // For example, a single resource can have the following tags: + // ``` + // "123/environment": "production", + // "123/costCenter": "marketing", + // ``` + // + // For more information on tag creation and management, see + // https://cloud.google.com/resource-manager/docs/tags/tags-overview. + map tags = 60 [ + (google.api.field_behavior) = INPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OPTIONAL + ]; + + // The number of read pool nodes in a read pool. + optional int32 node_count = 63; + + // Output only. Entries containing information about each read pool node of + // the read pool. + repeated PoolNodeConfig nodes = 64 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The list of DNS names used by this instance. + repeated DnsNameMapping dns_names = 67 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// DNS metadata. +message DnsNameMapping { + // The connection type of the DNS name. + enum ConnectionType { + // Unknown connection type. + CONNECTION_TYPE_UNSPECIFIED = 0; + + // Public IP. + PUBLIC = 1; + + // Private services access (private IP). + PRIVATE_SERVICES_ACCESS = 2; + + // Private Service Connect. + PRIVATE_SERVICE_CONNECT = 3; + } + + // The scope that the DNS name applies to. + enum DnsScope { + // DNS scope not set. This value should not be used. + DNS_SCOPE_UNSPECIFIED = 0; + + // Indicates an instance-level DNS name. + INSTANCE = 1; + + // Indicates a cluster-level DNS name. + CLUSTER = 2; + } + + // The system responsible for managing the DNS record. + enum RecordManager { + // Record manager not set. This value should not be used. + RECORD_MANAGER_UNSPECIFIED = 0; + + // The record may be managed by the customer. It is not automatically + // managed by Cloud SQL automation. + CUSTOMER = 1; + + // The record is managed by Cloud SQL, which will create, update, and delete + // the DNS records for the zone automatically when the Cloud SQL database + // instance is created or updated. + CLOUD_SQL_AUTOMATION = 2; + } + + // Output only. The DNS name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The connection type of the DNS name. + ConnectionType connection_type = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The scope that the DNS name applies to. + DnsScope dns_scope = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The manager for this DNS record. + RecordManager record_manager = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Gemini instance configuration. +message GeminiInstanceConfig { + // Output only. Whether Gemini is enabled. + optional bool entitled = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether the vacuum management is enabled. + optional bool google_vacuum_mgmt_enabled = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether canceling the out-of-memory (OOM) session is enabled. + optional bool oom_session_cancel_enabled = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether the active query is enabled. + optional bool active_query_enabled = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether the index advisor is enabled. + optional bool index_advisor_enabled = 5 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Whether the flag recommender is enabled. + optional bool flag_recommender_enabled = 6 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A primary instance and disaster recovery (DR) replica pair. +// A DR replica is a cross-region replica that you designate for failover +// in the event that the primary instance has regional failure. +// Applicable to MySQL and PostgreSQL. +message ReplicationCluster { + // Output only. If set, this field indicates this instance has a private + // service access (PSA) DNS endpoint that is pointing to the primary instance + // of the cluster. If this instance is the primary, then the DNS endpoint + // points to this instance. After a switchover or replica failover operation, + // this DNS endpoint points to the promoted instance. This is a read-only + // field, returned to the user as information. This field can exist even if a + // standalone instance doesn't have a DR replica yet or the DR replica is + // deleted. + optional string psa_write_endpoint = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. If the instance is a primary instance, then this field identifies + // the disaster recovery (DR) replica. A DR replica is an optional + // configuration for Enterprise Plus edition instances. If the instance is a + // read replica, then the field is not set. Set this field to a replica name + // to designate a DR replica for a primary instance. Remove the replica name + // to remove the DR replica designation. + optional string failover_dr_replica_name = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Read-only field that indicates whether the replica is a DR + // replica. This field is not set if the instance is a primary instance. + optional bool dr_replica = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// An available database version. It can be a major or a minor version. +message AvailableDatabaseVersion { + // The version's major version name. + optional string major_version = 3; + + // The database version name. For MySQL 8.0, this string provides the database + // major and minor version. + optional string name = 8; + + // The database version's display name. + optional string display_name = 9; +} + +// Database list response. +message DatabasesListResponse { + // This is always `sql#databasesList`. + string kind = 1; + + // List of database resources in the instance. + repeated Database items = 2; +} + +// Read-replica configuration for connecting to the on-premises primary +// instance. +message DemoteMasterConfiguration { + // This is always `sql#demoteMasterConfiguration`. + string kind = 1; + + // MySQL specific configuration when replicating from a MySQL on-premises + // primary instance. Replication configuration information such as the + // username, password, certificates, and keys are not stored in the instance + // metadata. The configuration information is used only to set up the + // replication connection and is stored by MySQL in a file named + // `master.info` in the data directory. + DemoteMasterMySqlReplicaConfiguration mysql_replica_configuration = 2; +} + +// Database instance demote primary instance context. +message DemoteMasterContext { + // This is always `sql#demoteMasterContext`. + string kind = 1; + + // Verify the GTID consistency for demote operation. Default value: + // `True`. Setting this flag to `false` enables you to bypass the GTID + // consistency check between on-premises primary instance and Cloud SQL + // instance during the demotion operation but also exposes you to the risk of + // future replication failures. Change the value only if you know the reason + // for the GTID divergence and are confident that doing so will not cause any + // replication issues. + google.protobuf.BoolValue verify_gtid_consistency = 2; + + // The name of the instance which will act as on-premises primary instance + // in the replication setup. + string master_instance_name = 3; + + // Configuration specific to read-replicas replicating from the on-premises + // primary instance. + DemoteMasterConfiguration replica_configuration = 4; + + // Flag to skip replication setup on the instance. + bool skip_replication_setup = 5; +} + +// Read-replica configuration specific to MySQL databases. +message DemoteMasterMySqlReplicaConfiguration { + // This is always `sql#demoteMasterMysqlReplicaConfiguration`. + string kind = 1; + + // The username for the replication connection. + string username = 2; + + // The password for the replication connection. + string password = 3; + + // PEM representation of the replica's private key. The corresponding public + // key is encoded in the client's certificate. The format of the replica's + // private key can be either PKCS #1 or PKCS #8. + string client_key = 4; + + // PEM representation of the replica's x509 certificate. + string client_certificate = 5; + + // PEM representation of the trusted CA's x509 certificate. + string ca_certificate = 6; +} + +// This context is used to demote an existing standalone instance to be +// a Cloud SQL read replica for an external database server. +message DemoteContext { + // This is always `sql#demoteContext`. + string kind = 1; + + // Required. The name of the instance which acts as an on-premises primary + // instance in the replication setup. + string source_representative_instance_name = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +enum SqlFileType { + // Unknown file type. + SQL_FILE_TYPE_UNSPECIFIED = 0; + + // File containing SQL statements. + SQL = 1; + + // File in CSV format. + CSV = 2; + + BAK = 4; + + // TDE certificate. + TDE = 8; +} + +// Database instance export context. +message ExportContext { + message SqlCsvExportOptions { + // The select query used to extract the data. + string select_query = 1; + + // Specifies the character that should appear before a data character that + // needs to be escaped. + string escape_character = 2; + + // Specifies the quoting character to be used when a data value is quoted. + string quote_character = 3; + + // Specifies the character that separates columns within each row (line) of + // the file. + string fields_terminated_by = 4; + + // This is used to separate lines. If a line does not contain all fields, + // the rest of the columns are set to their default values. + string lines_terminated_by = 6; + } + + message SqlExportOptions { + // Options for exporting from MySQL. + message MysqlExportOptions { + // Option to include SQL statement required to set up replication. If set + // to `1`, the dump file includes a CHANGE MASTER TO statement with the + // binary log coordinates, and --set-gtid-purged is set to ON. If set to + // `2`, the CHANGE MASTER TO statement is written as a SQL comment and + // has no effect. If set to any value other than `1`, --set-gtid-purged + // is set to OFF. + google.protobuf.Int32Value master_data = 1; + } + + // Options for exporting from a Cloud SQL for PostgreSQL instance. + message PostgresExportOptions { + // Optional. Use this option to include DROP <object> + // SQL statements. Use these statements to delete database objects before + // running the import operation. + google.protobuf.BoolValue clean = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Option to include an IF EXISTS SQL statement with each DROP + // statement produced by clean. + google.protobuf.BoolValue if_exists = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Tables to export, or that were exported, from the specified database. If + // you specify tables, specify one and only one database. For PostgreSQL + // instances, you can specify only one table. + repeated string tables = 1; + + // Export only schemas. + google.protobuf.BoolValue schema_only = 2; + + MysqlExportOptions mysql_export_options = 3; + + // Optional. The number of threads to use for parallel export. + google.protobuf.Int32Value threads = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether or not the export should be parallel. + google.protobuf.BoolValue parallel = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Options for exporting from a Cloud SQL for PostgreSQL instance. + PostgresExportOptions postgres_export_options = 6 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Options for exporting BAK files (SQL Server-only) + message SqlBakExportOptions { + // Whether or not the export should be striped. + google.protobuf.BoolValue striped = 1; + + // Option for specifying how many stripes to use for the export. + // If blank, and the value of the striped field is true, + // the number of stripes is automatically chosen. + google.protobuf.Int32Value stripe_count = 2; + + // Type of this bak file will be export, FULL or DIFF, SQL Server only + BakType bak_type = 4; + + // Deprecated: copy_only is deprecated. Use differential_base instead + google.protobuf.BoolValue copy_only = 5 [deprecated = true]; + + // Whether or not the backup can be used as a differential base + // copy_only backup can not be served as differential base + google.protobuf.BoolValue differential_base = 6; + + // Optional. The begin timestamp when transaction log will be included in + // the export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) + // format (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all + // available logs from the beginning of retention period will be included. + // Only applied to Cloud SQL for SQL Server. + google.protobuf.Timestamp export_log_start_time = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The end timestamp when transaction log will be included in the + // export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) format + // (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all + // available logs until current time will be included. Only applied to Cloud + // SQL for SQL Server. + google.protobuf.Timestamp export_log_end_time = 8 + [(google.api.field_behavior) = OPTIONAL]; + } + + message SqlTdeExportOptions { + // Required. Path to the TDE certificate public key + // in the form gs://bucketName/fileName. + // The instance must have write access to the location. + // Applicable only for SQL Server instances. + string certificate_path = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Path to the TDE certificate private key + // in the form gs://bucketName/fileName. + // The instance must have write access to the location. + // Applicable only for SQL Server instances. + string private_key_path = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Password that encrypts the private key. + string private_key_password = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Certificate name. + // Applicable only for SQL Server instances. + string name = 5 [(google.api.field_behavior) = REQUIRED]; + } + + // The path to the file in Google Cloud Storage where the export will be + // stored. The URI is in the form `gs://bucketName/fileName`. If the file + // already exists, the request succeeds, but the operation fails. If + // `fileType` is `SQL` and the filename ends with .gz, + // the contents are compressed. + string uri = 1; + + // Databases to be exported.
`MySQL instances:` If + // `fileType` is `SQL` and no database is specified, all + // databases are exported, except for the `mysql` system database. + // If `fileType` is `CSV`, you can specify one database, + // either by using this property or by using the + // `csvExportOptions.selectQuery` property, which takes precedence + // over this property.
`PostgreSQL instances:` If you don't specify a + // database by name, all user databases in the instance are + // exported. This excludes system databases and Cloud SQL databases used to + // manage internal operations. Exporting all user databases is only available + // for directory-formatted parallel export. If `fileType` is `CSV`, + // this database must match the one specified in the + // `csvExportOptions.selectQuery` property.
`SQL Server + // instances:` You must specify one database to be exported, and the + // `fileType` must be `BAK`. + repeated string databases = 2; + + // This is always `sql#exportContext`. + string kind = 3; + + // Options for exporting data as SQL statements. + SqlExportOptions sql_export_options = 4; + + // Options for exporting data as CSV. `MySQL` and `PostgreSQL` + // instances only. + SqlCsvExportOptions csv_export_options = 5; + + // The file type for the specified uri. + SqlFileType file_type = 6; + + // Whether to perform a serverless export. + google.protobuf.BoolValue offload = 8; + + // Options for exporting data as BAK files. + SqlBakExportOptions bak_export_options = 9; + + // Optional. Export parameters specific to SQL Server TDE certificates + SqlTdeExportOptions tde_export_options = 10 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Database instance failover context. +message FailoverContext { + // The current settings version of this instance. Request will be rejected if + // this version doesn't match the current settings version. + int64 settings_version = 1; + + // This is always `sql#failoverContext`. + string kind = 2; +} + +// A flag resource. +message Flag { + // This is the name of the flag. Flag names always use underscores, not + // hyphens, for example: `max_allowed_packet` + string name = 1; + + // The type of the flag. Flags are typed to being `BOOLEAN`, `STRING`, + // `INTEGER` or `NONE`. `NONE` is used for flags which do not take a + // value, such as `skip_grant_tables`. + SqlFlagType type = 2; + + // The database version this flag applies to. Can be + // MySQL instances: `MYSQL_8_0`, `MYSQL_8_0_18`, `MYSQL_8_0_26`, `MYSQL_5_7`, + // or `MYSQL_5_6`. PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, + // `POSTGRES_11` or `POSTGRES_12`. SQL Server instances: + // `SQLSERVER_2017_STANDARD`, `SQLSERVER_2017_ENTERPRISE`, + // `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, + // `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or + // `SQLSERVER_2019_WEB`. + // See [the complete + // list](/sql/docs/mysql/admin-api/rest/v1/SqlDatabaseVersion). + repeated SqlDatabaseVersion applies_to = 3; + + // For `STRING` flags, a list of strings that the value can be set to. + repeated string allowed_string_values = 4; + + // For `INTEGER` flags, the minimum allowed value. + google.protobuf.Int64Value min_value = 5; + + // For `INTEGER` flags, the maximum allowed value. + google.protobuf.Int64Value max_value = 6; + + // Indicates whether changing this flag will trigger a database restart. Only + // applicable to Second Generation instances. + google.protobuf.BoolValue requires_restart = 7; + + // This is always `sql#flag`. + string kind = 8; + + // Whether or not the flag is considered in beta. + google.protobuf.BoolValue in_beta = 9; + + // Use this field if only certain integers are accepted. Can be combined + // with min_value and max_value to add additional values. + repeated int64 allowed_int_values = 10; + + // Scope of flag. + SqlFlagScope flag_scope = 15; + + // Recommended flag value for UI display. + oneof recommended_value { + // Recommended flag value in string format for UI display. + string recommended_string_value = 16; + + // Recommended flag value in integer format for UI display. + google.protobuf.Int64Value recommended_int_value = 17; + } +} + +// Flags list response. +message FlagsListResponse { + // This is always `sql#flagsList`. + string kind = 1; + + // List of flags. + repeated Flag items = 2; +} + +// Database instance import context. +message ImportContext { + message SqlImportOptions { + message PostgresImportOptions { + // Optional. The --clean flag for the pg_restore utility. This flag + // applies only if you enabled Cloud SQL to import files in parallel. + google.protobuf.BoolValue clean = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The --if-exists flag for the pg_restore utility. This flag + // applies only if you enabled Cloud SQL to import files in parallel. + google.protobuf.BoolValue if_exists = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Optional. The number of threads to use for parallel import. + google.protobuf.Int32Value threads = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Whether or not the import should be parallel. + google.protobuf.BoolValue parallel = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Options for importing from a Cloud SQL for PostgreSQL instance. + PostgresImportOptions postgres_import_options = 3 + [(google.api.field_behavior) = OPTIONAL]; + } + + message SqlCsvImportOptions { + // The table to which CSV data is imported. + string table = 1; + + // The columns to which CSV data is imported. If not specified, all columns + // of the database table are loaded with CSV data. + repeated string columns = 2; + + // Specifies the character that should appear before a data character that + // needs to be escaped. + string escape_character = 4; + + // Specifies the quoting character to be used when a data value is quoted. + string quote_character = 5; + + // Specifies the character that separates columns within each row (line) of + // the file. + string fields_terminated_by = 6; + + // This is used to separate lines. If a line does not contain all fields, + // the rest of the columns are set to their default values. + string lines_terminated_by = 8; + } + + message SqlBakImportOptions { + message EncryptionOptions { + // Path to the Certificate (.cer) in Cloud Storage, in the form + // `gs://bucketName/fileName`. The instance must have write permissions + // to the bucket and read access to the file. + string cert_path = 1; + + // Path to the Certificate Private Key (.pvk) in Cloud Storage, in the + // form `gs://bucketName/fileName`. The instance must have write + // permissions to the bucket and read access to the file. + string pvk_path = 2; + + // Password that encrypts the private key + string pvk_password = 3; + + // Optional. Whether the imported file remains encrypted. + google.protobuf.BoolValue keep_encrypted = 5 + [(google.api.field_behavior) = OPTIONAL]; + } + + EncryptionOptions encryption_options = 1; + + // Whether or not the backup set being restored is striped. + // Applies only to Cloud SQL for SQL Server. + google.protobuf.BoolValue striped = 2; + + // Whether or not the backup importing will restore database + // with NORECOVERY option. + // Applies only to Cloud SQL for SQL Server. + google.protobuf.BoolValue no_recovery = 4; + + // Whether or not the backup importing request will just bring database + // online without downloading Bak content only one of "no_recovery" and + // "recovery_only" can be true otherwise error will return. Applies only to + // Cloud SQL for SQL Server. + google.protobuf.BoolValue recovery_only = 5; + + // Type of the bak content, FULL or DIFF. + BakType bak_type = 6; + + // Optional. The timestamp when the import should stop. This timestamp is in + // the [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, + // `2023-10-01T16:19:00.094`). This field is equivalent to the STOPAT + // keyword and applies to Cloud SQL for SQL Server only. + google.protobuf.Timestamp stop_at = 7 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The marked transaction where the import should stop. This field + // is equivalent to the STOPATMARK keyword and applies to Cloud SQL for SQL + // Server only. + string stop_at_mark = 8 [(google.api.field_behavior) = OPTIONAL]; + } + + message SqlTdeImportOptions { + // Required. Path to the TDE certificate public key + // in the form gs://bucketName/fileName. + // The instance must have read access to the file. + // Applicable only for SQL Server instances. + string certificate_path = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Path to the TDE certificate private key + // in the form gs://bucketName/fileName. + // The instance must have read access to the file. + // Applicable only for SQL Server instances. + string private_key_path = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. Password that encrypts the private key. + string private_key_password = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Certificate name. + // Applicable only for SQL Server instances. + string name = 5 [(google.api.field_behavior) = REQUIRED]; + } + + // Path to the import file in Cloud Storage, in the form + // `gs://bucketName/fileName`. Compressed gzip files (.gz) are supported + // when `fileType` is `SQL`. The instance must have + // write permissions to the bucket and read access to the file. + string uri = 1; + + // The target database for the import. If `fileType` is `SQL`, this field + // is required only if the import file does not specify a database, and is + // overridden by any database specification in the import file. For entire + // instance parallel import operations, the database is overridden by the + // database name stored in subdirectory name. If + // `fileType` is `CSV`, one database must be specified. + string database = 2; + + // This is always `sql#importContext`. + string kind = 3; + + // The file type for the specified uri. + // * `SQL`: The file contains SQL statements. + // * `CSV`: The file contains CSV data. + // * `BAK`: The file contains backup data for a SQL Server instance. + SqlFileType file_type = 4; + + // Options for importing data as CSV. + SqlCsvImportOptions csv_import_options = 5; + + // The PostgreSQL user for this import operation. PostgreSQL instances only. + string import_user = 6; + + // Import parameters specific to SQL Server .BAK files + SqlBakImportOptions bak_import_options = 7; + + // Optional. Options for importing data from SQL statements. + SqlImportOptions sql_import_options = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Import parameters specific to SQL Server .TDE files + // Import parameters specific to SQL Server TDE certificates + SqlTdeImportOptions tde_import_options = 9 + [(google.api.field_behavior) = OPTIONAL]; +} + +enum BakType { + // Default type. + BAK_TYPE_UNSPECIFIED = 0; + + // Full backup. + FULL = 1; + + // Differential backup. + DIFF = 2; + + // SQL Server Transaction Log + TLOG = 3; +} + +// Database instance clone request. +message InstancesCloneRequest { + // Contains details about the clone operation. + CloneContext clone_context = 1; +} + +// Database demote primary instance request. +message InstancesDemoteMasterRequest { + // Contains details about the demoteMaster operation. + DemoteMasterContext demote_master_context = 1; +} + +// This request is used to demote an existing standalone instance to be a +// Cloud SQL read replica for an external database server. +message InstancesDemoteRequest { + // Required. This context is used to demote an existing standalone instance to + // be a Cloud SQL read replica for an external database server. + DemoteContext demote_context = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// Database instance export request. +message InstancesExportRequest { + // Contains details about the export operation. + ExportContext export_context = 1; +} + +// Instance failover request. +message InstancesFailoverRequest { + // Failover Context. + FailoverContext failover_context = 1; +} + +// Database instance import request. +message InstancesImportRequest { + // Contains details about the import operation. + ImportContext import_context = 1; +} + +// Request for Pre-checks for MVU +message InstancesPreCheckMajorVersionUpgradeRequest { + // Required. Contains details about the pre-check major version upgrade + // operation. + PreCheckMajorVersionUpgradeContext pre_check_major_version_upgrade_context = 1 + [(google.api.field_behavior) = REQUIRED]; +} + +// MySQL-specific external server sync settings. +message MySqlSyncConfig { + // Flags to use for the initial dump. + repeated SyncFlags initial_sync_flags = 1; +} + +// Database instances list response. +message InstancesListResponse { + // This is always `sql#instancesList`. + string kind = 1; + + // List of warnings that occurred while handling the request. + repeated ApiWarning warnings = 2; + + // List of database instance resources. + repeated DatabaseInstance items = 3; + + // The continuation token, used to page through large result sets. Provide + // this value in a subsequent request to return the next page of results. + string next_page_token = 4; +} + +// Instances ListServerCas response. +message InstancesListServerCasResponse { + // List of server CA certificates for the instance. + repeated SslCert certs = 1; + + string active_version = 2; + + // This is always `sql#instancesListServerCas`. + string kind = 3; +} + +// Instances ListServerCertificatess response. +message InstancesListServerCertificatesResponse { + // List of server CA certificates for the instance. + repeated SslCert ca_certs = 1; + + // List of server certificates for the instance, signed by the corresponding + // CA from the `ca_certs` list. + repeated SslCert server_certs = 2; + + // The `sha1_fingerprint` of the active certificate from `server_certs`. + string active_version = 3; + + // This is always `sql#instancesListServerCertificates`. + string kind = 4; +} + +// Instances ListEntraIdCertificates response. +message InstancesListEntraIdCertificatesResponse { + // List of Entra ID certificates for the instance. + repeated SslCert certs = 1; + + // The `sha1_fingerprint` of the active certificate from `certs`. + string active_version = 2; + + // This is always `sql#instancesListEntraIdCertificates`. + string kind = 3; +} + +// Database instance restore backup request. +message InstancesRestoreBackupRequest { + // Parameters required to perform the restore backup operation. + RestoreBackupContext restore_backup_context = 1; + + // The name of the backup that's used to restore a Cloud SQL instance: + // Format: projects/{project-id}/backups/{backup-uid}. Only one of + // restore_backup_context, backup, backupdr_backup can be passed to the input. + string backup = 2 [ + (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } + ]; + + // The name of the backup that's used to restore a Cloud SQL instance: + // Format: + // "projects/{project-id}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup-uid}". + // Only one of restore_backup_context, backup, backupdr_backup can be + // passed to the input. + string backupdr_backup = 4 [ + (google.api.resource_reference) = { type: "backupdr.googleapis.com/Backup" } + ]; + + // Optional. By using this parameter, Cloud SQL overrides any instance + // settings stored in the backup you are restoring from. You can't change the + // instance's major database version and you can only increase the disk size. + // You can use this field to restore new instances only. This field is not + // applicable for restore to existing instances. + DatabaseInstance restore_instance_settings = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. This field has the same purpose as restore_instance_settings, + // changes any instance settings stored in the backup you are restoring from. + // With the difference that these fields are cleared in the settings. + repeated string restore_instance_clear_overrides_field_names = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Rotate Server CA request. +message InstancesRotateServerCaRequest { + // Contains details about the rotate server CA operation. + RotateServerCaContext rotate_server_ca_context = 1; +} + +// Rotate Server Certificate request. +message InstancesRotateServerCertificateRequest { + // Optional. Contains details about the rotate server CA operation. + RotateServerCertificateContext rotate_server_certificate_context = 1 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Rotate Entra ID Certificate request. +message InstancesRotateEntraIdCertificateRequest { + // Optional. Contains details about the rotate Entra ID certificate operation. + RotateEntraIdCertificateContext rotate_entra_id_certificate_context = 1 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance truncate log request. +message InstancesTruncateLogRequest { + // Contains details about the truncate log operation. + TruncateLogContext truncate_log_context = 1; +} + +// Request to acquire an SSRS lease for an instance. +message InstancesAcquireSsrsLeaseRequest { + // Contains details about the acquire SSRS lease operation. + AcquireSsrsLeaseContext acquire_ssrs_lease_context = 1; +} + +// Context to perform a point-in-time restore of an instance managed by +// Backup and Disaster Recovery (DR) Service. +message PointInTimeRestoreContext { + // The Backup and Disaster Recovery (DR) Service Datasource URI. + // Format: + // projects/{project}/locations/{region}/backupVaults/{backupvault}/dataSources/{datasource}. + optional string datasource = 1; + + // Required. The date and time to which you want to restore the instance. + google.protobuf.Timestamp point_in_time = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Target instance name. + optional string target_instance = 3; + + // Optional. The resource link for the VPC network from which the Cloud SQL + // instance is accessible for private IP. For example, + // `/projects/myProject/global/networks/default`. + optional string private_network = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The name of the allocated IP range for the internal IP Cloud SQL + // instance. For example: "google-managed-services-default". If you set this, + // then Cloud SQL creates the IP address for the cloned instance in the + // allocated range. This range must comply with [RFC + // 1035](https://tools.ietf.org/html/rfc1035) standards. Specifically, the + // name must be 1-63 characters long and match the regular expression + // [a-z]([-a-z0-9]*[a-z0-9])?. Reserved for future use. + optional string allocated_ip_range = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Point-in-time recovery of an instance to the specified zone. If + // no zone is specified, then clone to the same primary zone as the source + // instance. + optional string preferred_zone = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Point-in-time recovery of a regional instance in the specified + // zones. If not specified, clone to the same secondary zone as the source + // instance. This value cannot be the same as the preferred_zone field. + optional string preferred_secondary_zone = 9 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Perform disk shrink context. +message PerformDiskShrinkContext { + // The target disk shrink size in GigaBytes. + int64 target_size_gb = 1; +} + +// Structured PreCheckResponse containing message, type, and required +// actions. +message PreCheckResponse { + // The type of message which can be an info, a warning, or an error that + // requires user intervention. + enum MessageType { + // Default unspecified value to prevent unintended behavior changes. + MESSAGE_TYPE_UNSPECIFIED = 0; + + // General informational messages that don't require action. + INFO = 1; + + // Warnings that might impact the upgrade but don't block it. + WARNING = 2; + + // Errors that a user must resolve before proceeding with the upgrade. + ERROR = 3; + } + + // The message to be displayed to the user. + optional string message = 2; + + // The type of message whether it is an info, warning, or error. + optional MessageType message_type = 3; + + // The actions that the user needs to take. Use repeated for multiple + // actions. + repeated string actions_required = 4; +} + +// Pre-check major version upgrade context. +message PreCheckMajorVersionUpgradeContext { + // Required. The target database version to upgrade to. + SqlDatabaseVersion target_database_version = 1 + [(google.api.field_behavior) = REQUIRED]; + + // Output only. The responses from the precheck operation. + repeated PreCheckResponse pre_check_response = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. This is always `sql#preCheckMajorVersionUpgradeContext`. + string kind = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance get disk shrink config response. +message SqlInstancesGetDiskShrinkConfigResponse { + // This is always `sql#getDiskShrinkConfig`. + string kind = 1; + + // The minimum size to which a disk can be shrunk in GigaBytes. + int64 minimal_target_size_gb = 2; + + // Additional message to customers. + string message = 3; +} + +// Instance verify external sync settings response. +message SqlInstancesVerifyExternalSyncSettingsResponse { + // This is always `sql#migrationSettingErrorList`. + string kind = 1; + + // List of migration violations. + repeated SqlExternalSyncSettingError errors = 2; + + // List of migration warnings. + repeated SqlExternalSyncSettingError warnings = 3; +} + +// External primary instance migration setting error/warning. +message SqlExternalSyncSettingError { + enum SqlExternalSyncSettingErrorType { + SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED = 0; + + CONNECTION_FAILURE = 1; + + BINLOG_NOT_ENABLED = 2; + + INCOMPATIBLE_DATABASE_VERSION = 3; + + REPLICA_ALREADY_SETUP = 4; + + // The replication user is missing privileges that are required. + INSUFFICIENT_PRIVILEGE = 5; + + // Unsupported migration type. + UNSUPPORTED_MIGRATION_TYPE = 6; + + // No pglogical extension installed on databases, applicable for postgres. + NO_PGLOGICAL_INSTALLED = 7; + + // pglogical node already exists on databases, applicable for postgres. + PGLOGICAL_NODE_ALREADY_EXISTS = 8; + + // The value of parameter wal_level is not set to logical. + INVALID_WAL_LEVEL = 9; + + // The value of parameter shared_preload_libraries does not include + // pglogical. + INVALID_SHARED_PRELOAD_LIBRARY = 10; + + // The value of parameter max_replication_slots is not sufficient. + INSUFFICIENT_MAX_REPLICATION_SLOTS = 11; + + // The value of parameter max_wal_senders is not sufficient. + INSUFFICIENT_MAX_WAL_SENDERS = 12; + + // The value of parameter max_worker_processes is not sufficient. + INSUFFICIENT_MAX_WORKER_PROCESSES = 13; + + // Extensions installed are either not supported or having unsupported + // versions + UNSUPPORTED_EXTENSIONS = 14; + + // The value of parameter rds.logical_replication is not set to 1. + INVALID_RDS_LOGICAL_REPLICATION = 15; + + // The primary instance logging setup doesn't allow EM sync. + INVALID_LOGGING_SETUP = 16; + + // The primary instance database parameter setup doesn't allow EM sync. + INVALID_DB_PARAM = 17; + + // The gtid_mode is not supported, applicable for MySQL. + UNSUPPORTED_GTID_MODE = 18; + + // SQL Server Agent is not running. + SQLSERVER_AGENT_NOT_RUNNING = 19; + + // The table definition is not support due to missing primary key or replica + // identity, applicable for postgres. Note that this is a warning and won't + // block the migration. + UNSUPPORTED_TABLE_DEFINITION = 20; + + // The customer has a definer that will break EM setup. + UNSUPPORTED_DEFINER = 21; + + // SQL Server @@SERVERNAME does not match actual host name. + SQLSERVER_SERVERNAME_MISMATCH = 22; + + // The primary instance has been setup and will fail the setup. + PRIMARY_ALREADY_SETUP = 23; + + // The primary instance has unsupported binary log format. + UNSUPPORTED_BINLOG_FORMAT = 24; + + // The primary instance's binary log retention setting. + BINLOG_RETENTION_SETTING = 25; + + // The primary instance has tables with unsupported storage engine. + UNSUPPORTED_STORAGE_ENGINE = 26; + + // Source has tables with limited support + // eg: PostgreSQL tables without primary keys. + LIMITED_SUPPORT_TABLES = 27; + + // The replica instance contains existing data. + EXISTING_DATA_IN_REPLICA = 28; + + // The replication user is missing privileges that are optional. + MISSING_OPTIONAL_PRIVILEGES = 29; + + // Additional BACKUP_ADMIN privilege is granted to the replication user + // which may lock source MySQL 8 instance for DDLs during initial sync. + RISKY_BACKUP_ADMIN_PRIVILEGE = 30; + + // The Cloud Storage bucket is missing necessary permissions. + INSUFFICIENT_GCS_PERMISSIONS = 31; + + // The Cloud Storage bucket has an error in the file or contains invalid + // file information. + INVALID_FILE_INFO = 32; + + // The source instance has unsupported database settings for migration. + UNSUPPORTED_DATABASE_SETTINGS = 33; + + // The replication user is missing parallel import specific privileges. + // (e.g. LOCK TABLES) for MySQL. + MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE = 34; + + // The global variable local_infile is off on external server replica. + LOCAL_INFILE_OFF = 35; + + // This code instructs customers to turn on point-in-time recovery manually + // for the instance after promoting the Cloud SQL for PostgreSQL instance. + TURN_ON_PITR_AFTER_PROMOTE = 36; + + // The minor version of replica database is incompatible with the source. + INCOMPATIBLE_DATABASE_MINOR_VERSION = 37; + + // This warning message indicates that Cloud SQL uses the maximum number of + // subscriptions to migrate data from the source to the destination. + SOURCE_MAX_SUBSCRIPTIONS = 38; + + // Unable to verify definers on the source for MySQL. + UNABLE_TO_VERIFY_DEFINERS = 39; + + // If a time out occurs while the subscription counts are calculated, then + // this value is set to 1. Otherwise, this value is set to 2. + SUBSCRIPTION_CALCULATION_STATUS = 40; + + // Count of subscriptions needed to sync source data for PostgreSQL + // database. + PG_SUBSCRIPTION_COUNT = 41; + + // Final parallel level that is used to do migration. + PG_SYNC_PARALLEL_LEVEL = 42; + + // The disk size of the replica instance is smaller than the data size of + // the source instance. + INSUFFICIENT_DISK_SIZE = 43; + + // The data size of the source instance is greater than 1 TB, the number of + // cores of the replica instance is less than 8, and the memory of the + // replica is less than 32 GB. + INSUFFICIENT_MACHINE_TIER = 44; + + // The warning message indicates the unsupported extensions will not be + // migrated to the destination. + UNSUPPORTED_EXTENSIONS_NOT_MIGRATED = 45; + + // The warning message indicates the pg_cron extension and settings will not + // be migrated to the destination. + EXTENSIONS_NOT_MIGRATED = 46; + + // The error message indicates that pg_cron flags are enabled on the + // destination which is not supported during the migration. + PG_CRON_FLAG_ENABLED_IN_REPLICA = 47; + + // This error message indicates that the specified extensions are not + // enabled on destination instance. For example, before you can migrate + // data to the destination instance, you must enable the PGAudit extension + // on the instance. + EXTENSIONS_NOT_ENABLED_IN_REPLICA = 48; + + // The source database has generated columns that can't be migrated. Please + // change them to regular columns before migration. + UNSUPPORTED_COLUMNS = 49; + + // The source database has users that aren't created in the replica. + // First, create all users, which are in the pg_user_mappings table + // of the source database, in the destination instance. Then, perform the + // migration. + USERS_NOT_CREATED_IN_REPLICA = 50; + + // The selected objects include system objects that aren't supported for + // migration. + UNSUPPORTED_SYSTEM_OBJECTS = 51; + + // The source database has tables with the FULL or NOTHING replica identity. + // Before starting your migration, either remove the identity or change it + // to DEFAULT. Note that this is an error and will block the migration. + UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY = 52; + + // The selected objects don't exist on the source instance. + SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE = 53; + + // PSC only destination instance does not have a network attachment URI. + PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI = 54; + + // Selected objects reference unselected objects. Based on their object type + // (foreign key constraint or view), selected objects will fail during + // migration. + SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS = 55; + + // The migration will delete existing data in the replica; set + // [replica_overwrite_enabled][google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.replica_overwrite_enabled] + // in the request to acknowledge this. This is an error. MySQL only. + PROMPT_DELETE_EXISTING = 56; + + // The migration will delete existing data in the replica; + // [replica_overwrite_enabled][google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.replica_overwrite_enabled] + // was set in the request acknowledging this. This is a warning rather than + // an error. MySQL only. + WILL_DELETE_EXISTING = 57; + + // The replication user is missing specific privileges to setup DDL + // replication. (e.g. CREATE EVENT TRIGGER, CREATE SCHEMA) for PostgreSQL. + PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE = 58; + } + + // Can be `sql#externalSyncSettingError` or + // `sql#externalSyncSettingWarning`. + string kind = 1; + + // Identifies the specific error that occurred. + SqlExternalSyncSettingErrorType type = 2; + + // Additional information about the error encountered. + string detail = 3; +} + +// IP Management configuration. +message IpConfiguration { + // The SSL options for database connections. + enum SslMode { + // The SSL mode is unknown. + SSL_MODE_UNSPECIFIED = 0; + + // Allow non-SSL/non-TLS and SSL/TLS connections. + // For SSL connections to MySQL and PostgreSQL, the client certificate + // isn't verified. + // + // When this value is used, the legacy `require_ssl` flag must be false or + // cleared to avoid a conflict between the values of the two flags. + ALLOW_UNENCRYPTED_AND_ENCRYPTED = 1; + + // Only allow connections encrypted with SSL/TLS. + // For SSL connections to MySQL and PostgreSQL, the client certificate + // isn't verified. + // + // When this value is used, the legacy `require_ssl` flag must be false or + // cleared to avoid a conflict between the values of the two flags. + ENCRYPTED_ONLY = 2; + + // Only allow connections encrypted with SSL/TLS and with valid + // client certificates. + // + // When this value is used, the legacy `require_ssl` flag must be true or + // cleared to avoid the conflict between values of two flags. + // PostgreSQL clients or users that connect using IAM database + // authentication must use either the + // [Cloud SQL Auth + // Proxy](https://cloud.google.com/sql/docs/postgres/connect-auth-proxy) or + // [Cloud SQL + // Connectors](https://cloud.google.com/sql/docs/postgres/connect-connectors) + // to enforce client identity verification. + // + // Only applicable to MySQL and PostgreSQL. Not applicable to SQL Server. + TRUSTED_CLIENT_CERTIFICATE_REQUIRED = 3; + } + + // Various Certificate Authority (CA) modes for certificate signing. + enum CaMode { + // CA mode is unspecified. It is effectively the same as + // `GOOGLE_MANAGED_INTERNAL_CA`. + CA_MODE_UNSPECIFIED = 0; + + // Google-managed self-signed internal CA. + GOOGLE_MANAGED_INTERNAL_CA = 1; + + // Google-managed regional CA part of root CA hierarchy hosted on Google + // Cloud's Certificate Authority Service (CAS). + GOOGLE_MANAGED_CAS_CA = 2; + + // Customer-managed CA hosted on Google Cloud's Certificate Authority + // Service (CAS). + CUSTOMER_MANAGED_CAS_CA = 3; + } + + // Settings for automatic server certificate rotation. + enum ServerCertificateRotationMode { + // Unspecified: no automatic server certificate rotation. + SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED = 0; + + // No automatic server certificate rotation. The user must [manage server + // certificate + // rotation](/sql/docs/mysql/manage-ssl-instance#rotate-server-certificate-cas) + // on their side. + NO_AUTOMATIC_ROTATION = 1; + + // Automatic server certificate rotation during Cloud SQL scheduled + // maintenance or self-service maintenance updates. Requires + // `server_ca_mode` to be `GOOGLE_MANAGED_CAS_CA` or + // `CUSTOMER_MANAGED_CAS_CA`. + AUTOMATIC_ROTATION_DURING_MAINTENANCE = 2; + } + + // Whether the instance is assigned a public IP address or not. + google.protobuf.BoolValue ipv4_enabled = 1; + + // The resource link for the VPC network from which the Cloud SQL instance is + // accessible for private IP. For example, + // `/projects/myProject/global/networks/default`. This setting can + // be updated, but it cannot be removed after it is set. + string private_network = 2; + + // Use `ssl_mode` instead. + // + // Whether SSL/TLS connections over IP are enforced. + // If set to false, then allow both non-SSL/non-TLS and SSL/TLS connections. + // For SSL/TLS connections, the client certificate won't be verified. If + // set to true, then only allow connections encrypted with SSL/TLS and with + // valid client certificates. If you want to enforce SSL/TLS without enforcing + // the requirement for valid client certificates, then use the `ssl_mode` flag + // instead of the legacy `require_ssl` flag. + google.protobuf.BoolValue require_ssl = 3; + + // The list of external networks that are allowed to connect to the instance + // using the IP. In 'CIDR' notation, also known as 'slash' notation (for + // example: `157.197.200.0/24`). + repeated AclEntry authorized_networks = 4; + + // The name of the allocated ip range for the private ip Cloud SQL instance. + // For example: "google-managed-services-default". If set, the instance ip + // will be created in the allocated range. The range name must comply with + // [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name + // must be 1-63 characters long and match the regular expression + // `[a-z]([-a-z0-9]*[a-z0-9])?.` + string allocated_ip_range = 6; + + // Controls connectivity to private IP instances from Google services, + // such as BigQuery. + google.protobuf.BoolValue enable_private_path_for_google_cloud_services = 7; + + // Specify how SSL/TLS is enforced in database connections. If you must use + // the `require_ssl` flag for backward compatibility, then only the following + // value pairs are valid: + // + // For PostgreSQL and MySQL: + // + // * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false` + // * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=false` + // * `ssl_mode=TRUSTED_CLIENT_CERTIFICATE_REQUIRED` and `require_ssl=true` + // + // For SQL Server: + // + // * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false` + // * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=true` + // + // The value of `ssl_mode` has priority over the value of `require_ssl`. + // + // For example, for the pair `ssl_mode=ENCRYPTED_ONLY` and + // `require_ssl=false`, `ssl_mode=ENCRYPTED_ONLY` means accept only SSL + // connections, while `require_ssl=false` means accept both non-SSL + // and SSL connections. In this case, MySQL and PostgreSQL databases respect + // `ssl_mode` and accepts only SSL connections. + SslMode ssl_mode = 8; + + // PSC settings for this instance. + optional PscConfig psc_config = 9; + + // Specify what type of CA is used for the server certificate. + optional CaMode server_ca_mode = 10; + + // Optional. Custom Subject Alternative Name(SAN)s for a Cloud SQL instance. + repeated string custom_subject_alternative_names = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The resource name of the server CA pool for an instance with + // `CUSTOMER_MANAGED_CAS_CA` as the `server_ca_mode`. + // Format: projects/{PROJECT}/locations/{REGION}/caPools/{CA_POOL_ID} + optional string server_ca_pool = 12 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Controls the automatic server certificate rotation feature. This + // feature is disabled by default. When enabled, the server certificate will + // be automatically rotated during Cloud SQL scheduled maintenance or + // self-service maintenance updates up to six months before it expires. This + // setting can only be set if server_ca_mode is either GOOGLE_MANAGED_CAS_CA + // or CUSTOMER_MANAGED_CAS_CA. + optional ServerCertificateRotationMode server_certificate_rotation_mode = 16 + [(google.api.field_behavior) = OPTIONAL]; +} + +// PSC settings for a Cloud SQL instance. +message PscConfig { + // Whether PSC connectivity is enabled for this instance. + optional bool psc_enabled = 1; + + // Optional. The list of consumer projects that are allow-listed for PSC + // connections to this instance. This instance can be connected to with PSC + // from any network in these projects. + // + // Each consumer project in this list may be represented by a project number + // (numeric) or by a project id (alphanumeric). + repeated string allowed_consumer_projects = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The list of settings for requested Private Service Connect + // consumer endpoints that can be used to connect to this Cloud SQL instance. + repeated PscAutoConnectionConfig psc_auto_connections = 3 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The network attachment of the consumer network that the + // Private Service Connect enabled Cloud SQL instance is + // authorized to connect via PSC interface. + // format: projects/PROJECT/regions/REGION/networkAttachments/ID + string network_attachment_uri = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Settings for an automatically-setup Private Service Connect consumer endpoint +// that is used to connect to a Cloud SQL instance. +message PscAutoConnectionConfig { + // Optional. This is the project ID of consumer service project of this + // consumer endpoint. + // + // Optional. This is only applicable if consumer_network is a shared vpc + // network. + string consumer_project = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The consumer network of this consumer endpoint. This must be a + // resource path that includes both the host project and the network name. + // + // For example, `projects/project1/global/networks/network1`. + // + // The consumer host project of this network might be different from the + // consumer service project. + string consumer_network = 2 [(google.api.field_behavior) = OPTIONAL]; + + // The IP address of the consumer endpoint. + optional string ip_address = 3 + [(google.api.field_info).format = IPV4_OR_IPV6]; + + // The connection status of the consumer endpoint. + optional string status = 4; + + // The connection policy status of the consumer network. + optional string consumer_network_status = 5; +} + +// Database instance IP mapping +message IpMapping { + // The type of this IP address. A `PRIMARY` address is a public address that + // can accept incoming connections. A `PRIVATE` address is a private address + // that can accept incoming connections. An `OUTGOING` address is the source + // address of connections originating from the instance, if supported. + SqlIpAddressType type = 1; + + // The IP address assigned. + string ip_address = 2; + + // The due time for this IP to be retired in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. This field is only available when + // the IP is scheduled to be retired. + google.protobuf.Timestamp time_to_retire = 3; +} + +// Preferred location. This specifies where a Cloud SQL instance is located. +// Note that if the preferred location is not available, the instance will be +// located as close as possible within the region. Only one location may be +// specified. +message LocationPreference { + // The App Engine application to follow, it must be in the same region as the + // Cloud SQL instance. WARNING: Changing this might restart the instance. + string follow_gae_application = 1 [deprecated = true]; + + // The preferred Compute Engine zone (for example: us-central1-a, + // us-central1-b, etc.). WARNING: Changing this might restart the instance. + string zone = 2; + + // The preferred Compute Engine zone for the secondary/failover + // (for example: us-central1-a, us-central1-b, etc.). + // To disable this field, set it to 'no_secondary_zone'. + string secondary_zone = 4; + + // This is always `sql#locationPreference`. + string kind = 3; +} + +// Maintenance window. This specifies when a Cloud SQL instance +// is restarted for system maintenance purposes. +message MaintenanceWindow { + // Hour of day - 0 to 23. Specify in the UTC time zone. + google.protobuf.Int32Value hour = 1; + + // Day of week - `MONDAY`, `TUESDAY`, `WEDNESDAY`, `THURSDAY`, `FRIDAY`, + // `SATURDAY`, or `SUNDAY`. Specify in the UTC time zone. + // Returned in output as an integer, 1 to 7, where `1` equals Monday. + google.protobuf.Int32Value day = 2; + + // Maintenance timing settings: `canary`, `stable`, or `week5`. + // For more information, see [About maintenance on Cloud SQL + // instances](https://cloud.google.com/sql/docs/mysql/maintenance). + SqlUpdateTrack update_track = 3; + + // This is always `sql#maintenanceWindow`. + string kind = 4; +} + +// Deny Maintenance Periods. This specifies a date range during when all CSA +// rollout will be denied. +message DenyMaintenancePeriod { + // "deny maintenance period" start date. If the year of the start date is + // empty, the year of the end date also must be empty. In this case, it means + // the deny maintenance period recurs every year. The date is in format + // yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01 + string start_date = 1; + + // "deny maintenance period" end date. If the year of the end date is empty, + // the year of the start date also must be empty. In this case, it means the + // deny maintenance period recurs every year. The date is in format yyyy-mm-dd + // i.e., 2020-11-01, or mm-dd, i.e., 11-01 + string end_date = 2; + + // Time in UTC when the "deny maintenance period" starts on start_date and + // ends on end_date. The time is in format: HH:mm:SS, i.e., 00:00:00 + string time = 3; +} + +// Insights configuration. This specifies when Cloud SQL Insights feature is +// enabled and optional configuration. +message InsightsConfig { + // Whether Query Insights feature is enabled. + bool query_insights_enabled = 1; + + // Whether Query Insights will record client address when enabled. + bool record_client_address = 2; + + // Whether Query Insights will record application tags from query when + // enabled. + bool record_application_tags = 3; + + // Maximum query length stored in bytes. Default value: 1024 bytes. + // Range: 256-4500 bytes. Query lengths greater than this field value will be + // truncated to this value. When unset, query length will be the default + // value. Changing query length will restart the database. + google.protobuf.Int32Value query_string_length = 4; + + // Number of query execution plans captured by Insights per minute + // for all queries combined. Default is 5. + google.protobuf.Int32Value query_plans_per_minute = 5; + + // Optional. Whether enhanced query insights feature is enabled. + google.protobuf.BoolValue enhanced_query_insights_enabled = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Read-replica configuration specific to MySQL databases. +message MySqlReplicaConfiguration { + // Path to a SQL dump file in Google Cloud Storage from which the replica + // instance is to be created. The URI is in the form gs://bucketName/fileName. + // Compressed gzip files (.gz) are also supported. + // Dumps have the binlog co-ordinates from which replication + // begins. This can be accomplished by setting --master-data to 1 when using + // mysqldump. + string dump_file_path = 1; + + // The username for the replication connection. + string username = 2; + + // The password for the replication connection. + string password = 3; + + // Seconds to wait between connect retries. MySQL's default is 60 seconds. + google.protobuf.Int32Value connect_retry_interval = 4; + + // Interval in milliseconds between replication heartbeats. + google.protobuf.Int64Value master_heartbeat_period = 5; + + // PEM representation of the trusted CA's x509 certificate. + string ca_certificate = 6; + + // PEM representation of the replica's x509 certificate. + string client_certificate = 7; + + // PEM representation of the replica's private key. The corresponding public + // key is encoded in the client's certificate. + string client_key = 8; + + // A list of permissible ciphers to use for SSL encryption. + string ssl_cipher = 9; + + // Whether or not to check the primary instance's Common Name value in the + // certificate that it sends during the SSL handshake. + google.protobuf.BoolValue verify_server_certificate = 10; + + // This is always `sql#mysqlReplicaConfiguration`. + string kind = 11; +} + +// A list of objects that the user selects for replication from an external +// source instance. +message SelectedObjects { + // Required. The name of the database to migrate. + string database = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// On-premises instance configuration. +message OnPremisesConfiguration { + // SslOption defines the SSL mode to be used for replica connection to the + // on-premises source. + enum SslOption { + // Unknown SSL option i.e. SSL option not specified by user. + SSL_OPTION_UNSPECIFIED = 0; + + // SSL is disabled for replica connection to the on-premises source. + DISABLE = 1; + + // SSL is required for replica connection to the on-premises source. + REQUIRE = 2; + + // Verify CA is required for replica connection to the on-premises source. + VERIFY_CA = 3; + } + + // The host and port of the on-premises instance in host:port format + string host_port = 1; + + // This is always `sql#onPremisesConfiguration`. + string kind = 2; + + // The username for connecting to on-premises instance. + string username = 3; + + // The password for connecting to on-premises instance. + string password = 4; + + // PEM representation of the trusted CA's x509 certificate. + string ca_certificate = 5; + + // PEM representation of the replica's x509 certificate. + string client_certificate = 6; + + // PEM representation of the replica's private key. The corresponding public + // key is encoded in the client's certificate. + string client_key = 7; + + // The dump file to create the Cloud SQL replica. + string dump_file_path = 8; + + // The reference to Cloud SQL instance if the source is Cloud SQL. + InstanceReference source_instance = 15; + + // Optional. A list of objects that the user selects for replication from an + // external source instance. + repeated SelectedObjects selected_objects = 16 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. SslOption for replica connection to the on-premises source. + SslOption ssl_option = 18 [(google.api.field_behavior) = OPTIONAL]; +} + +// Disk encryption configuration for an instance. +message DiskEncryptionConfiguration { + // Resource name of KMS key for disk encryption + string kms_key_name = 1; + + // This is always `sql#diskEncryptionConfiguration`. + string kind = 2; +} + +// Disk encryption status for an instance. +message DiskEncryptionStatus { + // KMS key version used to encrypt the Cloud SQL instance resource + string kms_key_version_name = 1; + + // This is always `sql#diskEncryptionStatus`. + string kind = 2; +} + +// The type of maintenance to be performed on the instance. +enum SqlMaintenanceType { + // Maintenance type is unspecified. + SQL_MAINTENANCE_TYPE_UNSPECIFIED = 0; + + // Indicates that a standalone instance is undergoing maintenance. The + // instance can be either a primary instance or a replica. + INSTANCE_MAINTENANCE = 1; + + // Indicates that the primary instance and all of its replicas, including + // cascading replicas, are undergoing maintenance. Maintenance is performed on + // groups of replicas first, followed by the primary instance. + REPLICA_INCLUDED_MAINTENANCE = 2; + + // Indicates that the standalone instance is undergoing maintenance, initiated + // by self-service. The instance can be either a primary instance or a + // replica. + INSTANCE_SELF_SERVICE_MAINTENANCE = 3; + + // Indicates that the primary instance and all of its replicas are undergoing + // maintenance, initiated by self-service. Maintenance is performed on groups + // of replicas first, followed by the primary instance. + REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE = 4; +} + +// The sub operation type based on the operation type. +message SqlSubOperationType { + // Sub operation details corresponding to the operation type. + oneof sub_operation_details { + // The type of maintenance to be performed on the instance. + SqlMaintenanceType maintenance_type = 1; + } +} + +// An Operation resource. For successful operations that return an +// Operation resource, only the fields relevant to the operation are populated +// in the resource. +message Operation { + // The type of Cloud SQL operation. + enum SqlOperationType { + // Unknown operation type. + SQL_OPERATION_TYPE_UNSPECIFIED = 0; + + // Imports data into a Cloud SQL instance. + IMPORT = 1; + + // Exports data from a Cloud SQL instance to a Cloud Storage + // bucket. + EXPORT = 2; + + // Creates a new Cloud SQL instance. + CREATE = 3; + + // Updates the settings of a Cloud SQL instance. + UPDATE = 4; + + // Deletes a Cloud SQL instance. + DELETE = 5; + + // Restarts the Cloud SQL instance. + RESTART = 6; + + BACKUP = 7 [deprecated = true]; + + SNAPSHOT = 8 [deprecated = true]; + + // Performs instance backup. + BACKUP_VOLUME = 9; + + // Deletes an instance backup. + DELETE_VOLUME = 10; + + // Restores an instance backup. + RESTORE_VOLUME = 11; + + // Injects a privileged user in mysql for MOB instances. + INJECT_USER = 12; + + // Clones a Cloud SQL instance. + CLONE = 14; + + // Stops replication on a Cloud SQL read replica instance. + STOP_REPLICA = 15; + + // Starts replication on a Cloud SQL read replica instance. + START_REPLICA = 16; + + // Promotes a Cloud SQL replica instance. + PROMOTE_REPLICA = 17; + + // Creates a Cloud SQL replica instance. + CREATE_REPLICA = 18; + + // Creates a new user in a Cloud SQL instance. + CREATE_USER = 19; + + // Deletes a user from a Cloud SQL instance. + DELETE_USER = 20; + + // Updates an existing user in a Cloud SQL instance. If a user with the + // specified username doesn't exist, a new user is created. + UPDATE_USER = 21; + + // Creates a database in the Cloud SQL instance. + CREATE_DATABASE = 22; + + // Deletes a database in the Cloud SQL instance. + DELETE_DATABASE = 23; + + // Updates a database in the Cloud SQL instance. + UPDATE_DATABASE = 24; + + // Performs failover of an HA-enabled Cloud SQL + // failover replica. + FAILOVER = 25; + + // Deletes the backup taken by a backup run. + DELETE_BACKUP = 26; + + RECREATE_REPLICA = 27; + + // Truncates a general or slow log table in MySQL. + TRUNCATE_LOG = 28; + + // Demotes the stand-alone instance to be a Cloud SQL + // read replica for an external database server. + DEMOTE_MASTER = 29; + + // Indicates that the instance is currently in maintenance. Maintenance + // typically causes the instance to be unavailable for 1-3 minutes. + MAINTENANCE = 30; + + // This field is deprecated, and will be removed in future version of API. + ENABLE_PRIVATE_IP = 31 [deprecated = true]; + + DEFER_MAINTENANCE = 32 [deprecated = true]; + + // Creates clone instance. + CREATE_CLONE = 33 [deprecated = true]; + + // Reschedule maintenance to another time. + RESCHEDULE_MAINTENANCE = 34; + + // Starts external sync of a Cloud SQL EM replica to an external primary + // instance. + START_EXTERNAL_SYNC = 35; + + // Recovers logs from an instance's old data disk. + LOG_CLEANUP = 36; + + // Performs auto-restart of an HA-enabled Cloud SQL database for auto + // recovery. + AUTO_RESTART = 37; + + // Re-encrypts CMEK instances with latest key version. + REENCRYPT = 38; + + // Switches the roles of the primary and replica pair. The target instance + // should be the replica. + SWITCHOVER = 39; + + // Update a backup. + UPDATE_BACKUP = 40; + + // Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + ACQUIRE_SSRS_LEASE = 42; + + // Release a lease for the setup of SQL Server Reporting Services (SSRS). + RELEASE_SSRS_LEASE = 43; + + // Reconfigures old primary after a promote replica operation. Effect of a + // promote operation to the old primary is executed in this operation, + // asynchronously from the promote replica operation executed to the + // replica. + RECONFIGURE_OLD_PRIMARY = 44; + + // Indicates that the instance, its read replicas, and its cascading + // replicas are in maintenance. Maintenance typically gets initiated on + // groups of replicas first, followed by the primary instance. For each + // instance, maintenance typically causes the instance to be unavailable for + // 1-3 minutes. + CLUSTER_MAINTENANCE = 45 [deprecated = true]; + + // Indicates that the instance (and any of its replicas) are currently in + // maintenance. This is initiated as a self-service request by using SSM. + // Maintenance typically causes the instance to be unavailable for 1-3 + // minutes. + SELF_SERVICE_MAINTENANCE = 46 [deprecated = true]; + + // Switches a primary instance to a replica. This operation runs as part of + // a switchover operation to the original primary instance. + SWITCHOVER_TO_REPLICA = 47; + + // Updates the major version of a Cloud SQL instance. + MAJOR_VERSION_UPGRADE = 48; + + // Deprecated: ADVANCED_BACKUP is deprecated. Use ENHANCED_BACKUP instead. + ADVANCED_BACKUP = 49 [deprecated = true]; + + // Changes the BackupTier of a Cloud SQL instance. + MANAGE_BACKUP = 50; + + // Creates a backup for an Enhanced BackupTier Cloud SQL instance. + ENHANCED_BACKUP = 51; + + // Repairs entire read pool or specified read pool nodes in the read pool. + REPAIR_READ_POOL = 52; + + // Creates a Cloud SQL read pool instance. + CREATE_READ_POOL = 53; + } + + // The status of an operation. + enum SqlOperationStatus { + // The state of the operation is unknown. + SQL_OPERATION_STATUS_UNSPECIFIED = 0; + + // The operation has been queued, but has not started yet. + PENDING = 1; + + // The operation is running. + RUNNING = 2; + + // The operation completed. + DONE = 3; + } + + // This is always `sql#operation`. + string kind = 1; + + string target_link = 2; + + // The status of an operation. + SqlOperationStatus status = 3; + + // The email address of the user who initiated this operation. + string user = 4; + + // The time this operation was enqueued in UTC timezone in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp insert_time = 5; + + // The time this operation actually started in UTC timezone in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp start_time = 6; + + // The time this operation finished in UTC timezone in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp end_time = 7; + + // If errors occurred during processing of this operation, this field will be + // populated. + OperationErrors error = 8; + + // An Admin API warning message. + ApiWarning api_warning = 19; + + // The type of the operation. Valid values are: + // * `CREATE` + // * `DELETE` + // * `UPDATE` + // * `RESTART` + // * `IMPORT` + // * `EXPORT` + // * `BACKUP_VOLUME` + // * `RESTORE_VOLUME` + // * `CREATE_USER` + // * `DELETE_USER` + // * `CREATE_DATABASE` + // * `DELETE_DATABASE` + SqlOperationType operation_type = 9; + + // The context for import operation, if applicable. + ImportContext import_context = 10; + + // The context for export operation, if applicable. + ExportContext export_context = 11; + + // The context for backup operation, if applicable. + BackupContext backup_context = 17; + + // The context for pre-check major version upgrade operation, if applicable. + // This field is only populated when the operation_type is + // PRE_CHECK_MAJOR_VERSION_UPGRADE. + // The PreCheckMajorVersionUpgradeContext message itself contains the details + // for that pre-check, such as the target database version for the upgrade + // and the results of the check (including any warnings or errors found). + PreCheckMajorVersionUpgradeContext pre_check_major_version_upgrade_context = + 50; + + // An identifier that uniquely identifies the operation. You can use this + // identifier to retrieve the Operations resource that has information about + // the operation. + string name = 12; + + // Name of the resource on which this operation runs. + string target_id = 13; + + // The URI of this resource. + string self_link = 14; + + // The project ID of the target instance related to this operation. + string target_project = 15; + + // The context for acquire SSRS lease operation, if applicable. + AcquireSsrsLeaseContext acquire_ssrs_lease_context = 20; + + // Optional. The sub operation based on the operation type. + SqlSubOperationType sub_operation_type = 48 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Database instance operation error. +message OperationError { + // This is always `sql#operationError`. + string kind = 1; + + // Identifies the specific error that occurred. + string code = 2; + + // Additional information about the error encountered. + string message = 3; +} + +// Database instance operation errors list wrapper. +message OperationErrors { + // This is always `sql#operationErrors`. + string kind = 1; + + // The list of errors encountered while processing this operation. + repeated OperationError errors = 2; +} + +// Database instance local user password validation policy. +// This message defines the password policy for local database users. +// When enabled, it enforces constraints on password complexity, length, +// and reuse. Keep this policy enabled to help prevent unauthorized access. +message PasswordValidationPolicy { + // The complexity choices of the password. + enum Complexity { + // Complexity check is not specified. + COMPLEXITY_UNSPECIFIED = 0; + + // A combination of lowercase, uppercase, numeric, and non-alphanumeric + // characters. + COMPLEXITY_DEFAULT = 1; + } + + // Minimum number of characters allowed. + google.protobuf.Int32Value min_length = 1; + + // The complexity of the password. + Complexity complexity = 2; + + // Number of previous passwords that cannot be reused. + google.protobuf.Int32Value reuse_interval = 3; + + // Disallow username as a part of the password. + google.protobuf.BoolValue disallow_username_substring = 4; + + // Minimum interval after which the password can be changed. This flag is only + // supported for PostgreSQL. + google.protobuf.Duration password_change_interval = 5; + + // Whether to enable the password policy or not. When enabled, passwords must + // meet complexity requirements. Keep this policy enabled to help prevent + // unauthorized access. Disabling this policy allows weak passwords. + google.protobuf.BoolValue enable_password_policy = 6; + + // This field is deprecated and will be removed in a future version of the + // API. + google.protobuf.BoolValue disallow_compromised_credentials = 7 + [deprecated = true]; +} + +// Operations list response. +message OperationsListResponse { + // This is always `sql#operationsList`. + string kind = 1; + + // List of operation resources. + repeated Operation items = 2; + + // The continuation token, used to page through large result sets. Provide + // this value in a subsequent request to return the next page of results. + string next_page_token = 3; +} + +// Read-replica configuration for connecting to the primary instance. +message ReplicaConfiguration { + // This is always `sql#replicaConfiguration`. + string kind = 1; + + // MySQL specific configuration when replicating from a MySQL on-premises + // primary instance. Replication configuration information such as the + // username, password, certificates, and keys are not stored in the instance + // metadata. The configuration information is used only to set up the + // replication connection and is stored by MySQL in a file named + // `master.info` in the data directory. + MySqlReplicaConfiguration mysql_replica_configuration = 2; + + // Specifies if the replica is the failover target. If the field is set to + // `true` the replica will be designated as a failover replica. In case the + // primary instance fails, the replica instance will be promoted as the new + // primary instance. Only one replica can be specified as failover target, and + // the replica has to be in different zone with the primary instance. + google.protobuf.BoolValue failover_target = 3; + + // Optional. Specifies if a SQL Server replica is a cascadable replica. A + // cascadable replica is a SQL Server cross region replica that supports + // replica(s) under it. + google.protobuf.BoolValue cascadable_replica = 5 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Database instance restore from backup context. +// Backup context contains source instance id and project id. +message RestoreBackupContext { + // This is always `sql#restoreBackupContext`. + string kind = 1; + + // The ID of the backup run to restore from. + int64 backup_run_id = 2; + + // The ID of the instance that the backup was taken from. + string instance_id = 3; + + // The full project ID of the source instance. + string project = 4; +} + +// Instance rotate server CA context. +message RotateServerCaContext { + // This is always `sql#rotateServerCaContext`. + string kind = 1; + + // The fingerprint of the next version to be rotated to. If left unspecified, + // will be rotated to the most recently added server CA version. + string next_version = 2; +} + +// Instance rotate server certificate context. +message RotateServerCertificateContext { + // Optional. This is always `sql#rotateServerCertificateContext`. + string kind = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The fingerprint of the next version to be rotated to. If left + // unspecified, will be rotated to the most recently added server certificate + // version. + string next_version = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Instance rotate Entra ID certificate context. +message RotateEntraIdCertificateContext { + // Optional. This is always `sql#rotateEntraIdCertificateContext`. + string kind = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The fingerprint of the next version to be rotated to. If left + // unspecified, will be rotated to the most recently added Entra ID + // certificate version. + string next_version = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Data cache configurations. +message DataCacheConfig { + // Whether data cache is enabled for the instance. + bool data_cache_enabled = 1; +} + +// Config used to determine the final backup settings for the instance. +message FinalBackupConfig { + // Whether the final backup is enabled for the instance. + optional bool enabled = 1; + + // The number of days to retain the final backup after the instance deletion. + // The final backup will be purged at (time_of_instance_deletion + + // retention_days). + optional int32 retention_days = 3; +} + +// Database instance settings. +message Settings { + // Specifies when the instance is activated. + enum SqlActivationPolicy { + // Unknown activation plan. + SQL_ACTIVATION_POLICY_UNSPECIFIED = 0; + + // The instance is always up and running. + ALWAYS = 1; + + // The instance never starts. + NEVER = 2; + + // The instance starts upon receiving requests. + ON_DEMAND = 3 [deprecated = true]; + } + + // The edition of the instance. + enum Edition { + // The instance did not specify the edition. + EDITION_UNSPECIFIED = 0; + + // The instance is an enterprise edition. + ENTERPRISE = 2; + + // The instance is an Enterprise Plus edition. + ENTERPRISE_PLUS = 3; + } + + // The options for enforcing Cloud SQL connectors in the instance. + enum ConnectorEnforcement { + // The requirement for Cloud SQL connectors is unknown. + CONNECTOR_ENFORCEMENT_UNSPECIFIED = 0; + + // Do not require Cloud SQL connectors. + NOT_REQUIRED = 1; + + // Require all connections to use Cloud SQL connectors, including the + // Cloud SQL Auth Proxy and Cloud SQL Java, Python, and Go connectors. + // Note: This disables all existing authorized networks. + REQUIRED = 2; + } + + // ExecuteSql API's access to the instance. + enum DataApiAccess { + // Unspecified, effectively the same as `DISALLOW_DATA_API`. + DATA_API_ACCESS_UNSPECIFIED = 0; + + // Disallow using ExecuteSql API to connect to the instance. + DISALLOW_DATA_API = 1; + + // Allow using ExecuteSql API to connect to the instance. For private IP + // instances, this allows authorized users to access the instance from + // the public internet using ExecuteSql API. + ALLOW_DATA_API = 2; + } + + // The version of instance settings. This is a required field for update + // method to make sure concurrent updates are handled properly. During update, + // use the most recent settingsVersion value for this instance and do not try + // to update this value. + google.protobuf.Int64Value settings_version = 1; + + // The App Engine app IDs that can access this instance. + // (Deprecated) Applied to First Generation instances only. + repeated string authorized_gae_applications = 2 [deprecated = true]; + + // The tier (or machine type) for this instance, for example + // `db-custom-1-3840`. WARNING: Changing this restarts the instance. + string tier = 3; + + // This is always `sql#settings`. + string kind = 4; + + // User-provided labels, represented as a dictionary where each label is a + // single key value pair. + map user_labels = 5; + + // Availability type. Potential values: + // * `ZONAL`: The instance serves data from only one zone. Outages in that + // zone affect data accessibility. + // * `REGIONAL`: The instance can serve data from more than one zone in a + // region (it is highly available)./ + // + // For more information, see [Overview of the High Availability + // Configuration](https://cloud.google.com/sql/docs/mysql/high-availability). + SqlAvailabilityType availability_type = 6; + + // The pricing plan for this instance. This can be either `PER_USE` or + // `PACKAGE`. Only `PER_USE` is supported for Second Generation instances. + SqlPricingPlan pricing_plan = 7; + + // The type of replication this instance uses. This can be either + // `ASYNCHRONOUS` or `SYNCHRONOUS`. (Deprecated) This property was only + // applicable to First Generation instances. + SqlReplicationType replication_type = 8 [deprecated = true]; + + // The maximum size to which storage capacity can be automatically increased. + // The default value is 0, which specifies that there is no limit. + google.protobuf.Int64Value storage_auto_resize_limit = 9; + + // The activation policy specifies when the instance is activated; it is + // applicable only when the instance state is RUNNABLE. Valid values: + // * `ALWAYS`: The instance is on, and remains so even in the absence of + // connection requests. + // * `NEVER`: The instance is off; it is not activated, even if a + // connection request arrives. + SqlActivationPolicy activation_policy = 10; + + // The settings for IP Management. This allows to enable or disable the + // instance IP and manage which external networks can connect to the instance. + // The IPv4 address cannot be disabled for Second Generation instances. + IpConfiguration ip_configuration = 11; + + // Configuration to increase storage size automatically. The default value is + // true. + google.protobuf.BoolValue storage_auto_resize = 12; + + // The location preference settings. This allows the instance to be located as + // near as possible to either an App Engine app or Compute Engine zone for + // better performance. App Engine co-location was only applicable to First + // Generation instances. + LocationPreference location_preference = 13; + + // The database flags passed to the instance at startup. + repeated DatabaseFlags database_flags = 14; + + // The type of data disk: `PD_SSD` (default) or `PD_HDD`. Not used for + // First Generation instances. + SqlDataDiskType data_disk_type = 15; + + // The maintenance window for this instance. This specifies when the instance + // can be restarted for maintenance purposes. + MaintenanceWindow maintenance_window = 16; + + // The daily backup configuration for the instance. + BackupConfiguration backup_configuration = 17; + + // Configuration specific to read replica instances. Indicates whether + // replication is enabled or not. WARNING: Changing this restarts the + // instance. + google.protobuf.BoolValue database_replication_enabled = 18; + + // Configuration specific to read replica instances. Indicates whether + // database flags for crash-safe replication are enabled. This property was + // only applicable to First Generation instances. + google.protobuf.BoolValue crash_safe_replication_enabled = 19 + [deprecated = true]; + + // The size of data disk, in GB. The data disk size minimum is 10GB. + google.protobuf.Int64Value data_disk_size_gb = 20; + + // Active Directory configuration, relevant only for Cloud SQL for SQL Server. + SqlActiveDirectoryConfig active_directory_config = 22; + + // The name of server Instance collation. + string collation = 23; + + // Deny maintenance periods + repeated DenyMaintenancePeriod deny_maintenance_periods = 24; + + // Insights configuration, for now relevant only for Postgres. + InsightsConfig insights_config = 25; + + // The local user password validation policy of the instance. + PasswordValidationPolicy password_validation_policy = 27; + + // SQL Server specific audit configuration. + SqlServerAuditConfig sql_server_audit_config = 29; + + // Optional. The edition of the instance. + Edition edition = 38 [(google.api.field_behavior) = OPTIONAL]; + + // Specifies if connections must use Cloud SQL connectors. + // Option values include the following: `NOT_REQUIRED` (Cloud SQL instances + // can be connected without Cloud SQL + // Connectors) and `REQUIRED` (Only allow connections that use Cloud SQL + // Connectors) + // + // Note that using REQUIRED disables all existing authorized networks. If + // this field is not specified when creating a new instance, NOT_REQUIRED is + // used. If this field is not specified when patching or updating an existing + // instance, it is left unchanged in the instance. + ConnectorEnforcement connector_enforcement = 32; + + // Configuration to protect against accidental instance deletion. + google.protobuf.BoolValue deletion_protection_enabled = 33; + + // Server timezone, relevant only for Cloud SQL for SQL Server. + string time_zone = 34; + + // Specifies advanced machine configuration for the instances relevant only + // for SQL Server. + AdvancedMachineFeatures advanced_machine_features = 35; + + // Configuration for data cache. + DataCacheConfig data_cache_config = 37; + + // Optional. Configuration value for recreation of replica after certain + // replication lag. + google.protobuf.Int32Value replication_lag_max_seconds = 39 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When this parameter is set to true, Cloud SQL instances can + // connect to Vertex AI to pass requests for real-time predictions and + // insights to the AI. The default value is false. This applies only to Cloud + // SQL for MySQL and Cloud SQL for PostgreSQL instances. + google.protobuf.BoolValue enable_google_ml_integration = 40 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. By default, Cloud SQL instances have schema extraction disabled + // for Dataplex. When this parameter is set to true, schema extraction for + // Dataplex on Cloud SQL instances is activated. + google.protobuf.BoolValue enable_dataplex_integration = 41 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. When this parameter is set to true, Cloud SQL retains backups of + // the instance even after the instance is deleted. The ON_DEMAND backup will + // be retained until customer deletes the backup or the project. The AUTOMATED + // backup will be retained based on the backups retention setting. + google.protobuf.BoolValue retain_backups_on_delete = 42 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Provisioned number of I/O operations per second for the data + // disk. This field is only used for hyperdisk-balanced disk types. + optional int64 data_disk_provisioned_iops = 43 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Provisioned throughput measured in MiB per second for the data + // disk. This field is only used for hyperdisk-balanced disk types. + optional int64 data_disk_provisioned_throughput = 44 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The managed connection pooling configuration for the instance. + optional ConnectionPoolConfig connection_pool_config = 45 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The final backup configuration for the instance. + optional FinalBackupConfig final_backup_config = 47 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The read pool auto-scale configuration for the instance. + optional ReadPoolAutoScaleConfig read_pool_auto_scale_config = 48 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Cloud SQL for MySQL auto-upgrade configuration. When this + // parameter is set to true, auto-upgrade is enabled for MySQL 8.0 minor + // versions. The MySQL version must be 8.0.35 or higher. + optional bool auto_upgrade_enabled = 50 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The Microsoft Entra ID configuration for the SQL Server instance. + SqlServerEntraIdConfig entraid_config = 52 + [(google.api.field_behavior) = OPTIONAL]; + + // This parameter controls whether to allow using ExecuteSql API to connect to + // the instance. Not allowed by default. + optional DataApiAccess data_api_access = 53; + + // Optional. Configuration for Performance Capture, provides diagnostic + // metrics during high load situations. + PerformanceCaptureConfig performance_capture_config = 54 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Performance Capture configuration. +message PerformanceCaptureConfig { + // Optional. Enable or disable the Performance Capture. + optional bool enabled = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The time interval in seconds between any two probes. + optional int32 probing_interval_seconds = 2 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The minimum number of consecutive readings above threshold that + // triggers instance state capture. + optional int32 probe_threshold = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The minimum number of server threads running to trigger the + // capture on primary. + optional int32 running_threads_threshold = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The minimum number of seconds replica must be lagging behind + // primary to trigger capture on replica. + optional int32 seconds_behind_source_threshold = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The amount of time in seconds that a transaction needs to have + // been open before the watcher starts recording it. + optional int32 transaction_duration_threshold = 8 + [(google.api.field_behavior) = OPTIONAL]; +} + +// Specifies options for controlling advanced machine features. +message AdvancedMachineFeatures { + // The number of threads per physical core. + int32 threads_per_core = 1; +} + +// SslCerts Resource +message SslCert { + // This is always `sql#sslCert`. + string kind = 1; + + // Serial number, as extracted from the certificate. + string cert_serial_number = 2; + + // PEM representation. + string cert = 3; + + // The time when the certificate was created in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp create_time = 4; + + // User supplied name. Constrained to [a-zA-Z.-_ ]+. + string common_name = 5; + + // The time when the certificate expires in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp expiration_time = 6; + + // Sha1 Fingerprint. + string sha1_fingerprint = 7; + + // Name of the database instance. + string instance = 8; + + // The URI of this resource. + string self_link = 9; +} + +// SslCertDetail. +message SslCertDetail { + // The public information about the cert. + SslCert cert_info = 1; + + // The private key for the client cert, in pem format. Keep private in order + // to protect your security. + string cert_private_key = 2; +} + +// SslCerts create ephemeral certificate request. +message SslCertsCreateEphemeralRequest { + // PEM encoded public key to include in the signed certificate. + string public_key = 1 [json_name = "public_key"]; + + // Access token to include in the signed certificate. + string access_token = 2 [json_name = "access_token"]; +} + +// SslCerts insert request. +message SslCertsInsertRequest { + // User supplied name. Must be a distinct name from the other certificates + // for this instance. + string common_name = 1; +} + +// Reschedule options for maintenance windows. +message SqlInstancesRescheduleMaintenanceRequestBody { + enum RescheduleType { + RESCHEDULE_TYPE_UNSPECIFIED = 0; + + // Reschedules maintenance to happen now (within 5 minutes). + IMMEDIATE = 1; + + // Reschedules maintenance to occur within one week from the originally + // scheduled day and time. + NEXT_AVAILABLE_WINDOW = 2; + + // Reschedules maintenance to a specific time and day. + SPECIFIC_TIME = 3; + } + + message Reschedule { + // Required. The type of the reschedule. + RescheduleType reschedule_type = 1; + + // Optional. Timestamp when the maintenance shall be rescheduled to if + // reschedule_type=SPECIFIC_TIME, in + // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example + // `2012-11-15T16:19:00.094Z`. + google.protobuf.Timestamp schedule_time = 2 + [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. The type of the reschedule the user wants. + Reschedule reschedule = 3; +} + +// SslCert insert response. +message SslCertsInsertResponse { + // This is always `sql#sslCertsInsert`. + string kind = 1; + + // The operation to track the ssl certs insert request. + Operation operation = 2; + + // The server Certificate Authority's certificate. If this is missing you can + // force a new one to be generated by calling resetSslConfig method on + // instances resource. + SslCert server_ca_cert = 3; + + // The new client certificate and private key. + SslCertDetail client_cert = 4; +} + +// SslCerts list response. +message SslCertsListResponse { + // This is always `sql#sslCertsList`. + string kind = 1; + + // List of client certificates for the instance. + repeated SslCert items = 2; +} + +// Database Instance truncate log context. +message TruncateLogContext { + // This is always `sql#truncateLogContext`. + string kind = 1; + + // The type of log to truncate. Valid values are `MYSQL_GENERAL_TABLE` and + // `MYSQL_SLOW_TABLE`. + string log_type = 2; +} + +// Active Directory configuration, relevant only for Cloud SQL for SQL Server. +message SqlActiveDirectoryConfig { + // The modes of Active Directory configuration. + enum ActiveDirectoryMode { + // Unspecified mode. + ACTIVE_DIRECTORY_MODE_UNSPECIFIED = 0; + + // Managed Active Directory mode. This is the fallback option to maintain + // backward compatibility. + MANAGED_ACTIVE_DIRECTORY = 1; + + // Deprecated: Use CUSTOMER_MANAGED_ACTIVE_DIRECTORY instead. + SELF_MANAGED_ACTIVE_DIRECTORY = 2 [deprecated = true]; + + // Customer-managed Active Directory mode. + CUSTOMER_MANAGED_ACTIVE_DIRECTORY = 3; + } + + // This is always sql#activeDirectoryConfig. + string kind = 1; + + // The name of the domain (e.g., mydomain.com). + string domain = 2; + + // Optional. The mode of the Active Directory configuration. + ActiveDirectoryMode mode = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Domain controller IPv4 addresses used to bootstrap Active + // Directory. + repeated string dns_servers = 4 [ + (google.api.field_info).format = IPV4, + (google.api.field_behavior) = OPTIONAL + ]; + + // Optional. The secret manager key storing the administrator credential. + // (e.g., projects/{project}/secrets/{secret}). + string admin_credential_secret_name = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The organizational unit distinguished name. This is the full + // hierarchical path to the organizational unit. + string organizational_unit = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// SQL Server specific audit configuration. +message SqlServerAuditConfig { + // This is always sql#sqlServerAuditConfig + string kind = 1; + + // The name of the destination bucket (e.g., gs://mybucket). + string bucket = 2; + + // How long to keep generated audit files. + google.protobuf.Duration retention_interval = 3; + + // How often to upload generated audit files. + google.protobuf.Duration upload_interval = 4; +} + +// SQL Server Entra ID configuration. +message SqlServerEntraIdConfig { + // Output only. This is always sql#sqlServerEntraIdConfig + string kind = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional. The tenant ID for the Entra ID configuration. + string tenant_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The application ID for the Entra ID configuration. + string application_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// The status of a backup run. +enum SqlBackupRunStatus { + // The status of the run is unknown. + SQL_BACKUP_RUN_STATUS_UNSPECIFIED = 0; + + // The backup operation was enqueued. + ENQUEUED = 1; + + // The backup is overdue across a given backup window. Indicates a + // problem. Example: Long-running operation in progress during + // the whole window. + OVERDUE = 2; + + // The backup is in progress. + RUNNING = 3; + + // The backup failed. + FAILED = 4; + + // The backup was successful. + SUCCESSFUL = 5; + + // The backup was skipped (without problems) for a given backup + // window. Example: Instance was idle. + SKIPPED = 6; + + // The backup is about to be deleted. + DELETION_PENDING = 7; + + // The backup deletion failed. + DELETION_FAILED = 8; + + // The backup has been deleted. + DELETED = 9; +} + +enum SqlBackupRunType { + // This is an unknown BackupRun type. + SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0; + + // The backup schedule automatically triggers a backup. + AUTOMATED = 1; + + // The user manually triggers a backup. + ON_DEMAND = 2; +} + +// Defines the supported backup kinds +enum SqlBackupKind { + // This is an unknown BackupKind. + SQL_BACKUP_KIND_UNSPECIFIED = 0; + + // Snapshot-based backups. + SNAPSHOT = 1; + + // Physical backups. + PHYSICAL = 2; +} + +enum SqlBackendType { + // This is an unknown backend type for instance. + SQL_BACKEND_TYPE_UNSPECIFIED = 0; + + // V1 speckle instance. + FIRST_GEN = 1 [deprecated = true]; + + // V2 speckle instance. + SECOND_GEN = 2; + + // On premises instance. + EXTERNAL = 3; +} + +enum SqlIpAddressType { + // This is an unknown IP address type. + SQL_IP_ADDRESS_TYPE_UNSPECIFIED = 0; + + // IP address the customer is supposed to connect to. Usually this is the + // load balancer's IP address + PRIMARY = 1; + + // Source IP address of the connection a read replica establishes to its + // external primary instance. This IP address can be allowlisted by the + // customer in case it has a firewall that filters incoming connection to its + // on premises primary instance. + OUTGOING = 2; + + // Private IP used when using private IPs and network peering. + PRIVATE = 3; + + // V1 IP of a migrated instance. We want the user to + // decommission this IP as soon as the migration is complete. + // Note: V1 instances with V1 ip addresses will be counted as PRIMARY. + MIGRATED_1ST_GEN = 4; +} + +enum SqlInstanceType { + // This is an unknown Cloud SQL instance type. + SQL_INSTANCE_TYPE_UNSPECIFIED = 0; + + // A regular Cloud SQL instance that is not replicating from a primary + // instance. + CLOUD_SQL_INSTANCE = 1; + + // An instance running on the customer's premises that is not managed by + // Cloud SQL. + ON_PREMISES_INSTANCE = 2; + + // A Cloud SQL instance acting as a read-replica. + READ_REPLICA_INSTANCE = 3; + + // A Cloud SQL read pool. + READ_POOL_INSTANCE = 5; +} + +// Connection pool flags for Cloud SQL instances managed connection pool +// configuration. +message ConnectionPoolFlags { + // Required. The name of the flag. + string name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The value of the flag. Boolean flags are set to `on` for true + // and `off` for false. This field must be omitted if the flag + // doesn't take a value. + string value = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The read pool auto-scale configuration. +message ReadPoolAutoScaleConfig { + // Target metric for read pool auto scaling. + message TargetMetric { + // The metric name to be used for auto scaling. + optional string metric = 1; + + // The target value for the metric. + optional float target_value = 2; + } + + // Indicates whether read pool auto scaling is enabled. + optional bool enabled = 1; + + // Minimum number of read pool nodes to be maintained. + optional int32 min_node_count = 2; + + // Maximum number of read pool nodes to be maintained. + optional int32 max_node_count = 3; + + // Optional. Target metrics for read pool auto scaling. + repeated TargetMetric target_metrics = 4 + [(google.api.field_behavior) = OPTIONAL]; + + // Indicates whether read pool auto scaling supports scale in operations + // (removing nodes). + optional bool disable_scale_in = 5; + + // The cooldown period for scale in operations. + optional int32 scale_in_cooldown_seconds = 6; + + // The cooldown period for scale out operations. + optional int32 scale_out_cooldown_seconds = 7; +} + +// The managed connection pooling configuration. +message ConnectionPoolConfig { + // Whether managed connection pooling is enabled. + optional bool connection_pooling_enabled = 1; + + // Optional. List of connection pool configuration flags. + repeated ConnectionPoolFlags flags = 8 + [(google.api.field_behavior) = OPTIONAL]; + + // Output only. Number of connection poolers. + optional int32 pooler_count = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The database engine type and version. +enum SqlDatabaseVersion { + // This is an unknown database version. + SQL_DATABASE_VERSION_UNSPECIFIED = 0; + + // The database version is MySQL 5.1. + MYSQL_5_1 = 2 [deprecated = true]; + + // The database version is MySQL 5.5. + MYSQL_5_5 = 3 [deprecated = true]; + + // The database version is MySQL 5.6. + MYSQL_5_6 = 5; + + // The database version is MySQL 5.7. + MYSQL_5_7 = 6; + + // The database version is MySQL 8. + MYSQL_8_0 = 20; + + // The database major version is MySQL 8.0 and the minor version is 18. + MYSQL_8_0_18 = 41; + + // The database major version is MySQL 8.0 and the minor version is 26. + MYSQL_8_0_26 = 85; + + // The database major version is MySQL 8.0 and the minor version is 27. + MYSQL_8_0_27 = 111; + + // The database major version is MySQL 8.0 and the minor version is 28. + MYSQL_8_0_28 = 132; + + // The database major version is MySQL 8.0 and the minor version is 29. + MYSQL_8_0_29 = 148 [deprecated = true]; + + // The database major version is MySQL 8.0 and the minor version is 30. + MYSQL_8_0_30 = 174; + + // The database major version is MySQL 8.0 and the minor version is 31. + MYSQL_8_0_31 = 197; + + // The database major version is MySQL 8.0 and the minor version is 32. + MYSQL_8_0_32 = 213; + + // The database major version is MySQL 8.0 and the minor version is 33. + MYSQL_8_0_33 = 238; + + // The database major version is MySQL 8.0 and the minor version is 34. + MYSQL_8_0_34 = 239; + + // The database major version is MySQL 8.0 and the minor version is 35. + MYSQL_8_0_35 = 240; + + // The database major version is MySQL 8.0 and the minor version is 36. + MYSQL_8_0_36 = 241; + + // The database major version is MySQL 8.0 and the minor version is 37. + MYSQL_8_0_37 = 355; + + // The database major version is MySQL 8.0 and the minor version is 39. + MYSQL_8_0_39 = 357; + + // The database major version is MySQL 8.0 and the minor version is 40. + MYSQL_8_0_40 = 358; + + // The database major version is MySQL 8.0 and the minor version is 41. + MYSQL_8_0_41 = 488; + + // The database major version is MySQL 8.0 and the minor version is 42. + MYSQL_8_0_42 = 489; + + // The database major version is MySQL 8.0 and the minor version is 43. + MYSQL_8_0_43 = 553; + + // The database major version is MySQL 8.0 and the minor version is 44. + MYSQL_8_0_44 = 554; + + // The database major version is MySQL 8.0 and the minor version is 45. + MYSQL_8_0_45 = 555; + + // The database major version is MySQL 8.0 and the minor version is 46. + MYSQL_8_0_46 = 556; + + // The database version is MySQL 8.4. + MYSQL_8_4 = 398; + + // The database version is MySQL 9.7. + MYSQL_9_7 = 654; + + // The database version is SQL Server 2017 Standard. + SQLSERVER_2017_STANDARD = 11; + + // The database version is SQL Server 2017 Enterprise. + SQLSERVER_2017_ENTERPRISE = 14; + + // The database version is SQL Server 2017 Express. + SQLSERVER_2017_EXPRESS = 15; + + // The database version is SQL Server 2017 Web. + SQLSERVER_2017_WEB = 16; + + // The database version is PostgreSQL 9.6. + POSTGRES_9_6 = 9; + + // The database version is PostgreSQL 10. + POSTGRES_10 = 18; + + // The database version is PostgreSQL 11. + POSTGRES_11 = 10; + + // The database version is PostgreSQL 12. + POSTGRES_12 = 19; + + // The database version is PostgreSQL 13. + POSTGRES_13 = 23; + + // The database version is PostgreSQL 14. + POSTGRES_14 = 110; + + // The database version is PostgreSQL 15. + POSTGRES_15 = 172; + + // The database version is PostgreSQL 16. + POSTGRES_16 = 272; + + // The database version is PostgreSQL 17. + POSTGRES_17 = 408; + + // The database version is PostgreSQL 18. + POSTGRES_18 = 557; + + // The database version is SQL Server 2019 Standard. + SQLSERVER_2019_STANDARD = 26; + + // The database version is SQL Server 2019 Enterprise. + SQLSERVER_2019_ENTERPRISE = 27; + + // The database version is SQL Server 2019 Express. + SQLSERVER_2019_EXPRESS = 28; + + // The database version is SQL Server 2019 Web. + SQLSERVER_2019_WEB = 29; + + // The database version is SQL Server 2022 Standard. + SQLSERVER_2022_STANDARD = 199; + + // The database version is SQL Server 2022 Enterprise. + SQLSERVER_2022_ENTERPRISE = 200; + + // The database version is SQL Server 2022 Express. + SQLSERVER_2022_EXPRESS = 201; + + // The database version is SQL Server 2022 Web. + SQLSERVER_2022_WEB = 202; +} + +// The suspension reason of the database instance if the state is SUSPENDED. +enum SqlSuspensionReason { + // This is an unknown suspension reason. + SQL_SUSPENSION_REASON_UNSPECIFIED = 0; + + // The instance is suspended due to billing issues (for example:, account + // issue) + BILLING_ISSUE = 2; + + // The instance is suspended due to illegal content (for example:, child + // pornography, copyrighted material, etc.). + LEGAL_ISSUE = 3; + + // The instance is causing operational issues (for example:, causing the + // database to crash). + OPERATIONAL_ISSUE = 4; + + // The KMS key used by the instance is either revoked or denied access to + KMS_KEY_ISSUE = 5; +} + +// The pricing plan for this instance. +enum SqlPricingPlan { + // This is an unknown pricing plan for this instance. + SQL_PRICING_PLAN_UNSPECIFIED = 0; + + // The instance is billed at a monthly flat rate. + PACKAGE = 1; + + // The instance is billed per usage. + PER_USE = 2; +} + +enum SqlReplicationType { + // This is an unknown replication type for a Cloud SQL instance. + SQL_REPLICATION_TYPE_UNSPECIFIED = 0; + + // The synchronous replication mode for First Generation instances. It is the + // default value. + SYNCHRONOUS = 1; + + // The asynchronous replication mode for First Generation instances. It + // provides a slight performance gain, but if an outage occurs while this + // option is set to asynchronous, you can lose up to a few seconds of updates + // to your data. + ASYNCHRONOUS = 2; +} + +// The type of disk that is used for a v2 instance to use. +enum SqlDataDiskType { + // This is an unknown data disk type. + SQL_DATA_DISK_TYPE_UNSPECIFIED = 0; + + // An SSD data disk. + PD_SSD = 1; + + // An HDD data disk. + PD_HDD = 2; + + // This field is deprecated and will be removed from a future version of the + // API. + OBSOLETE_LOCAL_SSD = 3 [deprecated = true]; + + // A Hyperdisk Balanced data disk. + HYPERDISK_BALANCED = 4; +} + +// The availability type of the given Cloud SQL instance. +enum SqlAvailabilityType { + // This is an unknown Availability type. + SQL_AVAILABILITY_TYPE_UNSPECIFIED = 0; + + // Zonal available instance. + ZONAL = 1; + + // Regional available instance. + REGIONAL = 2; +} + +enum SqlUpdateTrack { + // This is an unknown maintenance timing preference. + SQL_UPDATE_TRACK_UNSPECIFIED = 0; + + // For an instance with a scheduled maintenance window, this maintenance + // timing indicates that the maintenance update is scheduled 7 to 14 days + // after the notification is sent out. Also referred to as `Week 1` (Console) + // and `preview` (gcloud CLI). + canary = 1; + + // For an instance with a scheduled maintenance window, this maintenance + // timing indicates that the maintenance update is scheduled 15 to 21 days + // after the notification is sent out. Also referred to as `Week 2` (Console) + // and `production` (gcloud CLI). + stable = 2; + + // For instance with a scheduled maintenance window, this maintenance + // timing indicates that the maintenance update is scheduled 35 to 42 days + // after the notification is sent out. + week5 = 3; +} + +// Acquire SSRS lease context. +message AcquireSsrsLeaseContext { + // The username to be used as the setup login to connect to the database + // server for SSRS setup. + optional string setup_login = 1; + + // The username to be used as the service login to connect to the report + // database for SSRS setup. + optional string service_login = 2; + + // The report database to be used for the SSRS setup. + optional string report_database = 3; + + // Lease duration needed for the SSRS setup. + optional google.protobuf.Duration duration = 4; +} + +enum SqlFlagType { + // This is an unknown flag type. + SQL_FLAG_TYPE_UNSPECIFIED = 0; + + // Boolean type flag. + BOOLEAN = 1; + + // String type flag. + STRING = 2; + + // Integer type flag. + INTEGER = 3; + + // Flag type used for a server startup option. + NONE = 4; + + // Type introduced specially for MySQL TimeZone offset. Accept a string value + // with the format [-12:59, 13:00]. + MYSQL_TIMEZONE_OFFSET = 5; + + // Float type flag. + FLOAT = 6; + + // Comma-separated list of the strings in a SqlFlagType enum. + REPEATED_STRING = 7; +} + +// Scopes of a flag describe where the flag is used. +enum SqlFlagScope { + // Assume database flags if unspecified + SQL_FLAG_SCOPE_UNSPECIFIED = 0; + + // database flags + SQL_FLAG_SCOPE_DATABASE = 1; + + // connection pool configuration flags + SQL_FLAG_SCOPE_CONNECTION_POOL = 2; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto new file mode 100644 index 000000000000..8c2f712c8b99 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto @@ -0,0 +1,74 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1beta4; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlTiersProto"; +option java_package = "com.google.cloud.sql.v1beta4"; + +// Service for providing machine types (tiers) for Cloud SQL. +service SqlTiersService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Lists all available machine types (tiers) for Cloud SQL, for example, + // `db-custom-1-3840`. For related information, see [Pricing](/sql/pricing). + rpc List(SqlTiersListRequest) returns (TiersListResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/tiers" + }; + } +} + +message SqlTiersListRequest { + // Project ID of the project for which to list tiers. + string project = 1; +} + +// Tiers list response. +message TiersListResponse { + // This is always `sql#tiersList`. + string kind = 1; + + // List of tiers. + repeated Tier items = 2; +} + +// A Google Cloud SQL service tier resource. +message Tier { + // An identifier for the machine type, for example, `db-custom-1-3840`. For + // related information, see [Pricing](/sql/pricing). + string tier = 1; + + // The maximum RAM usage of this tier in bytes. + int64 RAM = 2 [json_name = "RAM"]; + + // This is always `sql#tier`. + string kind = 3; + + // The maximum disk size of this tier in bytes. + int64 Disk_Quota = 4 [json_name = "DiskQuota"]; + + // The applicable regions for this tier. + repeated string region = 5; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_users.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_users.proto new file mode 100644 index 000000000000..bb4e20c993bb --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_users.proto @@ -0,0 +1,311 @@ +// Copyright 2026 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. + +syntax = "proto3"; + +package google.cloud.sql.v1beta4; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/cloud/sql/v1beta4/cloud_sql_resources.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; +option java_multiple_files = true; +option java_outer_classname = "CloudSqlUsersProto"; +option java_package = "com.google.cloud.sql.v1beta4"; + +service SqlUsersService { + option (google.api.default_host) = "sqladmin.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform," + "https://www.googleapis.com/auth/sqlservice.admin"; + + // Deletes a user from a Cloud SQL instance. + rpc Delete(SqlUsersDeleteRequest) returns (Operation) { + option (google.api.http) = { + delete: "/sql/v1beta4/projects/{project}/instances/{instance}/users" + }; + } + + // Retrieves a resource containing information about a user. + rpc Get(SqlUsersGetRequest) returns (User) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/users/{name}" + }; + } + + // Creates a new user in a Cloud SQL instance. + rpc Insert(SqlUsersInsertRequest) returns (Operation) { + option (google.api.http) = { + post: "/sql/v1beta4/projects/{project}/instances/{instance}/users" + body: "body" + }; + } + + // Lists users in the specified Cloud SQL instance. + rpc List(SqlUsersListRequest) returns (UsersListResponse) { + option (google.api.http) = { + get: "/sql/v1beta4/projects/{project}/instances/{instance}/users" + }; + } + + // Updates an existing user in a Cloud SQL instance. + rpc Update(SqlUsersUpdateRequest) returns (Operation) { + option (google.api.http) = { + put: "/sql/v1beta4/projects/{project}/instances/{instance}/users" + body: "body" + }; + } +} + +message SqlUsersDeleteRequest { + // Host of the user in the instance. + string host = 1; + + // Database instance ID. This does not include the project ID. + string instance = 2; + + // Name of the user in the instance. + string name = 3; + + // Project ID of the project that contains the instance. + string project = 4; +} + +// Request message for Users Get RPC +message SqlUsersGetRequest { + // Database instance ID. This does not include the project ID. + string instance = 1; + + // User of the instance. + string name = 2; + + // Project ID of the project that contains the instance. + string project = 3; + + // Host of a user of the instance. + string host = 4; +} + +message SqlUsersInsertRequest { + // Database instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; + + User body = 100; +} + +message SqlUsersListRequest { + // Database instance ID. This does not include the project ID. + string instance = 1; + + // Project ID of the project that contains the instance. + string project = 2; +} + +message SqlUsersUpdateRequest { + // Optional. Host of the user in the instance. + string host = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Database instance ID. This does not include the project ID. + string instance = 2; + + // Name of the user in the instance. + string name = 3; + + // Project ID of the project that contains the instance. + string project = 4; + + // Optional. List of database roles to grant to the user. body.database_roles + // will be ignored for update request. + repeated string database_roles = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies whether to revoke existing roles that are not present + // in the `database_roles` field. If `false` or unset, the database roles + // specified in `database_roles` are added to the user's existing roles. + optional bool revoke_existing_roles = 6 + [(google.api.field_behavior) = OPTIONAL]; + + User body = 100; +} + +// User level password validation policy. +message UserPasswordValidationPolicy { + // Number of failed login attempts allowed before user get locked. + int32 allowed_failed_attempts = 1; + + // Expiration duration after password is updated. + google.protobuf.Duration password_expiration_duration = 2; + + // If true, failed login attempts check will be enabled. + bool enable_failed_attempts_check = 3; + + // Output only. Read-only password status. + PasswordStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // If true, the user must specify the current password before changing the + // password. This flag is supported only for MySQL. + bool enable_password_verification = 5; +} + +// Read-only password status. +message PasswordStatus { + // If true, user does not have login privileges. + bool locked = 1; + + // The expiration time of the current password. + google.protobuf.Timestamp password_expiration_time = 2; +} + +// A Cloud SQL user resource. +message User { + // The user type. + enum SqlUserType { + // The database's built-in user type. + BUILT_IN = 0; + + // Cloud IAM user. + CLOUD_IAM_USER = 1; + + // Cloud IAM service account. + CLOUD_IAM_SERVICE_ACCOUNT = 2; + + // Cloud IAM group. Not used for login. + CLOUD_IAM_GROUP = 3; + + // Read-only. Login for a user that belongs to the Cloud IAM group. + CLOUD_IAM_GROUP_USER = 4; + + // Read-only. Login for a service account that belongs to the + // Cloud IAM group. + CLOUD_IAM_GROUP_SERVICE_ACCOUNT = 5; + + // Microsoft Entra ID user. + ENTRAID_USER = 7; + } + + // The type of retained password. + enum DualPasswordType { + // The default value. + DUAL_PASSWORD_TYPE_UNSPECIFIED = 0; + + // Do not update the user's dual password status. + NO_MODIFY_DUAL_PASSWORD = 1; + + // No dual password usable for connecting using this user. + NO_DUAL_PASSWORD = 2; + + // Dual password usable for connecting using this user. + DUAL_PASSWORD = 3; + } + + // Indicates if a group is available for IAM database authentication. + enum IamStatus { + // The default value for users that are not of type CLOUD_IAM_GROUP. + // Only CLOUD_IAM_GROUP users will be inactive or active. + // Users with an IamStatus of IAM_STATUS_UNSPECIFIED will not + // display whether they are active or inactive as that is not applicable to + // them. + IAM_STATUS_UNSPECIFIED = 0; + + // INACTIVE indicates a group is not available for IAM database + // authentication. + INACTIVE = 1; + + // ACTIVE indicates a group is available for IAM database authentication. + ACTIVE = 2; + } + + // This is always `sql#user`. + string kind = 1; + + // The password for the user. + string password = 2; + + // This field is deprecated and will be removed from a future version of the + // API. + string etag = 3; + + // The name of the user in the Cloud SQL instance. Can be omitted for + // `update` because it is already specified in the URL. + string name = 4; + + // Optional. The host from which the user can connect. For `insert` + // operations, host defaults to an empty string. For `update` + // operations, host is specified as part of the request URL. The host name + // cannot be updated after insertion. For a MySQL instance, it's required; + // for a PostgreSQL or SQL Server instance, it's optional. + string host = 5 [(google.api.field_behavior) = OPTIONAL]; + + // The name of the Cloud SQL instance. This does not include the project ID. + // Can be omitted for update because it is already specified on the + // URL. + string instance = 6; + + // The project ID of the project containing the Cloud SQL database. The Google + // apps domain is prefixed if applicable. Can be omitted for + // update because it is already specified on the URL. + string project = 7; + + // The user type. It determines the method to authenticate the user during + // login. The default is the database's built-in user type. + SqlUserType type = 8; + + // User details for specific database type + oneof user_details { + SqlServerUserDetails sqlserver_user_details = 9; + } + + // Optional. The full email for an IAM user. For normal database users, this + // will not be filled. Only applicable to MySQL database users. + string iam_email = 11 [(google.api.field_behavior) = OPTIONAL]; + + // User level password validation policy. + UserPasswordValidationPolicy password_policy = 12; + + // Dual password status for the user. + optional DualPasswordType dual_password_type = 13; + + // Indicates if a group is active or inactive for IAM database authentication. + optional IamStatus iam_status = 14; + + // Optional. Role memberships of the user + repeated string database_roles = 15 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents a Sql Server user on the Cloud SQL instance. +message SqlServerUserDetails { + // If the user has been disabled + bool disabled = 1; + + // The server roles for this user + repeated string server_roles = 2; +} + +// User list response. +message UsersListResponse { + // This is always sql#usersList. + string kind = 1; + + // List of user resources in the instance. + repeated User items = 2; + + // Unused. + string next_page_token = 3 [deprecated = true]; +} diff --git a/owl-bot-staging/google-cloud-sql/protos/protos.d.ts b/owl-bot-staging/google-cloud-sql/protos/protos.d.ts new file mode 100644 index 000000000000..fa584fd39e4e --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/protos.d.ts @@ -0,0 +1,63446 @@ +// Copyright 2026 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. + +import type {protobuf as $protobuf} from "google-gax"; +import Long = require("long"); +/** Namespace google. */ +export namespace google { + + /** Namespace cloud. */ + namespace cloud { + + /** Namespace sql. */ + namespace sql { + + /** Namespace v1. */ + namespace v1 { + + /** Represents a SqlAvailableDatabaseVersionsService */ + class SqlAvailableDatabaseVersionsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlAvailableDatabaseVersionsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlAvailableDatabaseVersionsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlAvailableDatabaseVersionsService; + } + + /** Represents a SqlBackupRunsService */ + class SqlBackupRunsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlBackupRunsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlBackupRunsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlBackupRunsService; + + /** + * Calls Delete. + * @param request SqlBackupRunsDeleteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public delete(request: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, callback: google.cloud.sql.v1.SqlBackupRunsService.DeleteCallback): void; + + /** + * Calls Delete. + * @param request SqlBackupRunsDeleteRequest message or plain object + * @returns Promise + */ + public delete(request: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest): Promise; + + /** + * Calls Get. + * @param request SqlBackupRunsGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BackupRun + */ + public get(request: google.cloud.sql.v1.ISqlBackupRunsGetRequest, callback: google.cloud.sql.v1.SqlBackupRunsService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlBackupRunsGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1.ISqlBackupRunsGetRequest): Promise; + + /** + * Calls Insert. + * @param request SqlBackupRunsInsertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public insert(request: google.cloud.sql.v1.ISqlBackupRunsInsertRequest, callback: google.cloud.sql.v1.SqlBackupRunsService.InsertCallback): void; + + /** + * Calls Insert. + * @param request SqlBackupRunsInsertRequest message or plain object + * @returns Promise + */ + public insert(request: google.cloud.sql.v1.ISqlBackupRunsInsertRequest): Promise; + + /** + * Calls List. + * @param request SqlBackupRunsListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BackupRunsListResponse + */ + public list(request: google.cloud.sql.v1.ISqlBackupRunsListRequest, callback: google.cloud.sql.v1.SqlBackupRunsService.ListCallback): void; + + /** + * Calls List. + * @param request SqlBackupRunsListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1.ISqlBackupRunsListRequest): Promise; + } + + namespace SqlBackupRunsService { + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|delete_}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|get}. + * @param error Error, if any + * @param [response] BackupRun + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.BackupRun) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|insert}. + * @param error Error, if any + * @param [response] Operation + */ + type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|list}. + * @param error Error, if any + * @param [response] BackupRunsListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.BackupRunsListResponse) => void; + } + + /** Properties of a SqlBackupRunsDeleteRequest. */ + interface ISqlBackupRunsDeleteRequest { + + /** SqlBackupRunsDeleteRequest id */ + id?: (number|Long|string|null); + + /** SqlBackupRunsDeleteRequest instance */ + instance?: (string|null); + + /** SqlBackupRunsDeleteRequest project */ + project?: (string|null); + } + + /** Represents a SqlBackupRunsDeleteRequest. */ + class SqlBackupRunsDeleteRequest implements ISqlBackupRunsDeleteRequest { + + /** + * Constructs a new SqlBackupRunsDeleteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest); + + /** SqlBackupRunsDeleteRequest id. */ + public id: (number|Long|string); + + /** SqlBackupRunsDeleteRequest instance. */ + public instance: string; + + /** SqlBackupRunsDeleteRequest project. */ + public project: string; + + /** + * Creates a new SqlBackupRunsDeleteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBackupRunsDeleteRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest): google.cloud.sql.v1.SqlBackupRunsDeleteRequest; + + /** + * Encodes the specified SqlBackupRunsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsDeleteRequest.verify|verify} messages. + * @param message SqlBackupRunsDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBackupRunsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsDeleteRequest.verify|verify} messages. + * @param message SqlBackupRunsDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBackupRunsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlBackupRunsDeleteRequest; + + /** + * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBackupRunsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlBackupRunsDeleteRequest; + + /** + * Verifies a SqlBackupRunsDeleteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBackupRunsDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBackupRunsDeleteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlBackupRunsDeleteRequest; + + /** + * Creates a plain object from a SqlBackupRunsDeleteRequest message. Also converts values to other types if specified. + * @param message SqlBackupRunsDeleteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlBackupRunsDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBackupRunsDeleteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBackupRunsDeleteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlBackupRunsGetRequest. */ + interface ISqlBackupRunsGetRequest { + + /** SqlBackupRunsGetRequest id */ + id?: (number|Long|string|null); + + /** SqlBackupRunsGetRequest instance */ + instance?: (string|null); + + /** SqlBackupRunsGetRequest project */ + project?: (string|null); + } + + /** Represents a SqlBackupRunsGetRequest. */ + class SqlBackupRunsGetRequest implements ISqlBackupRunsGetRequest { + + /** + * Constructs a new SqlBackupRunsGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlBackupRunsGetRequest); + + /** SqlBackupRunsGetRequest id. */ + public id: (number|Long|string); + + /** SqlBackupRunsGetRequest instance. */ + public instance: string; + + /** SqlBackupRunsGetRequest project. */ + public project: string; + + /** + * Creates a new SqlBackupRunsGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBackupRunsGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlBackupRunsGetRequest): google.cloud.sql.v1.SqlBackupRunsGetRequest; + + /** + * Encodes the specified SqlBackupRunsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsGetRequest.verify|verify} messages. + * @param message SqlBackupRunsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlBackupRunsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBackupRunsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsGetRequest.verify|verify} messages. + * @param message SqlBackupRunsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlBackupRunsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBackupRunsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlBackupRunsGetRequest; + + /** + * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBackupRunsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlBackupRunsGetRequest; + + /** + * Verifies a SqlBackupRunsGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBackupRunsGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBackupRunsGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlBackupRunsGetRequest; + + /** + * Creates a plain object from a SqlBackupRunsGetRequest message. Also converts values to other types if specified. + * @param message SqlBackupRunsGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlBackupRunsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBackupRunsGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBackupRunsGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlBackupRunsInsertRequest. */ + interface ISqlBackupRunsInsertRequest { + + /** SqlBackupRunsInsertRequest instance */ + instance?: (string|null); + + /** SqlBackupRunsInsertRequest project */ + project?: (string|null); + + /** SqlBackupRunsInsertRequest body */ + body?: (google.cloud.sql.v1.IBackupRun|null); + } + + /** Represents a SqlBackupRunsInsertRequest. */ + class SqlBackupRunsInsertRequest implements ISqlBackupRunsInsertRequest { + + /** + * Constructs a new SqlBackupRunsInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlBackupRunsInsertRequest); + + /** SqlBackupRunsInsertRequest instance. */ + public instance: string; + + /** SqlBackupRunsInsertRequest project. */ + public project: string; + + /** SqlBackupRunsInsertRequest body. */ + public body?: (google.cloud.sql.v1.IBackupRun|null); + + /** + * Creates a new SqlBackupRunsInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBackupRunsInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlBackupRunsInsertRequest): google.cloud.sql.v1.SqlBackupRunsInsertRequest; + + /** + * Encodes the specified SqlBackupRunsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsInsertRequest.verify|verify} messages. + * @param message SqlBackupRunsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlBackupRunsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBackupRunsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsInsertRequest.verify|verify} messages. + * @param message SqlBackupRunsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlBackupRunsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBackupRunsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlBackupRunsInsertRequest; + + /** + * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBackupRunsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlBackupRunsInsertRequest; + + /** + * Verifies a SqlBackupRunsInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBackupRunsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBackupRunsInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlBackupRunsInsertRequest; + + /** + * Creates a plain object from a SqlBackupRunsInsertRequest message. Also converts values to other types if specified. + * @param message SqlBackupRunsInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlBackupRunsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBackupRunsInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBackupRunsInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlBackupRunsListRequest. */ + interface ISqlBackupRunsListRequest { + + /** SqlBackupRunsListRequest instance */ + instance?: (string|null); + + /** SqlBackupRunsListRequest maxResults */ + maxResults?: (number|null); + + /** SqlBackupRunsListRequest pageToken */ + pageToken?: (string|null); + + /** SqlBackupRunsListRequest project */ + project?: (string|null); + } + + /** Represents a SqlBackupRunsListRequest. */ + class SqlBackupRunsListRequest implements ISqlBackupRunsListRequest { + + /** + * Constructs a new SqlBackupRunsListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlBackupRunsListRequest); + + /** SqlBackupRunsListRequest instance. */ + public instance: string; + + /** SqlBackupRunsListRequest maxResults. */ + public maxResults: number; + + /** SqlBackupRunsListRequest pageToken. */ + public pageToken: string; + + /** SqlBackupRunsListRequest project. */ + public project: string; + + /** + * Creates a new SqlBackupRunsListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBackupRunsListRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlBackupRunsListRequest): google.cloud.sql.v1.SqlBackupRunsListRequest; + + /** + * Encodes the specified SqlBackupRunsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsListRequest.verify|verify} messages. + * @param message SqlBackupRunsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlBackupRunsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBackupRunsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsListRequest.verify|verify} messages. + * @param message SqlBackupRunsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlBackupRunsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBackupRunsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlBackupRunsListRequest; + + /** + * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBackupRunsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlBackupRunsListRequest; + + /** + * Verifies a SqlBackupRunsListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBackupRunsListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBackupRunsListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlBackupRunsListRequest; + + /** + * Creates a plain object from a SqlBackupRunsListRequest message. Also converts values to other types if specified. + * @param message SqlBackupRunsListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlBackupRunsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBackupRunsListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBackupRunsListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupRun. */ + interface IBackupRun { + + /** BackupRun kind */ + kind?: (string|null); + + /** BackupRun status */ + status?: (google.cloud.sql.v1.SqlBackupRunStatus|keyof typeof google.cloud.sql.v1.SqlBackupRunStatus|null); + + /** BackupRun enqueuedTime */ + enqueuedTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun id */ + id?: (number|Long|string|null); + + /** BackupRun startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun error */ + error?: (google.cloud.sql.v1.IOperationError|null); + + /** BackupRun type */ + type?: (google.cloud.sql.v1.SqlBackupRunType|keyof typeof google.cloud.sql.v1.SqlBackupRunType|null); + + /** BackupRun description */ + description?: (string|null); + + /** BackupRun windowStartTime */ + windowStartTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun instance */ + instance?: (string|null); + + /** BackupRun selfLink */ + selfLink?: (string|null); + + /** BackupRun location */ + location?: (string|null); + + /** BackupRun databaseVersion */ + databaseVersion?: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion|null); + + /** BackupRun diskEncryptionConfiguration */ + diskEncryptionConfiguration?: (google.cloud.sql.v1.IDiskEncryptionConfiguration|null); + + /** BackupRun diskEncryptionStatus */ + diskEncryptionStatus?: (google.cloud.sql.v1.IDiskEncryptionStatus|null); + + /** BackupRun backupKind */ + backupKind?: (google.cloud.sql.v1.SqlBackupKind|keyof typeof google.cloud.sql.v1.SqlBackupKind|null); + + /** BackupRun timeZone */ + timeZone?: (string|null); + + /** BackupRun maxChargeableBytes */ + maxChargeableBytes?: (number|Long|string|null); + } + + /** Represents a BackupRun. */ + class BackupRun implements IBackupRun { + + /** + * Constructs a new BackupRun. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IBackupRun); + + /** BackupRun kind. */ + public kind: string; + + /** BackupRun status. */ + public status: (google.cloud.sql.v1.SqlBackupRunStatus|keyof typeof google.cloud.sql.v1.SqlBackupRunStatus); + + /** BackupRun enqueuedTime. */ + public enqueuedTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun id. */ + public id: (number|Long|string); + + /** BackupRun startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun error. */ + public error?: (google.cloud.sql.v1.IOperationError|null); + + /** BackupRun type. */ + public type: (google.cloud.sql.v1.SqlBackupRunType|keyof typeof google.cloud.sql.v1.SqlBackupRunType); + + /** BackupRun description. */ + public description: string; + + /** BackupRun windowStartTime. */ + public windowStartTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun instance. */ + public instance: string; + + /** BackupRun selfLink. */ + public selfLink: string; + + /** BackupRun location. */ + public location: string; + + /** BackupRun databaseVersion. */ + public databaseVersion: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion); + + /** BackupRun diskEncryptionConfiguration. */ + public diskEncryptionConfiguration?: (google.cloud.sql.v1.IDiskEncryptionConfiguration|null); + + /** BackupRun diskEncryptionStatus. */ + public diskEncryptionStatus?: (google.cloud.sql.v1.IDiskEncryptionStatus|null); + + /** BackupRun backupKind. */ + public backupKind: (google.cloud.sql.v1.SqlBackupKind|keyof typeof google.cloud.sql.v1.SqlBackupKind); + + /** BackupRun timeZone. */ + public timeZone: string; + + /** BackupRun maxChargeableBytes. */ + public maxChargeableBytes?: (number|Long|string|null); + + /** + * Creates a new BackupRun instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupRun instance + */ + public static create(properties?: google.cloud.sql.v1.IBackupRun): google.cloud.sql.v1.BackupRun; + + /** + * Encodes the specified BackupRun message. Does not implicitly {@link google.cloud.sql.v1.BackupRun.verify|verify} messages. + * @param message BackupRun message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IBackupRun, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupRun message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRun.verify|verify} messages. + * @param message BackupRun message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IBackupRun, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupRun message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupRun + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupRun; + + /** + * Decodes a BackupRun message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupRun + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupRun; + + /** + * Verifies a BackupRun message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupRun message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupRun + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupRun; + + /** + * Creates a plain object from a BackupRun message. Also converts values to other types if specified. + * @param message BackupRun + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.BackupRun, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupRun to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupRun + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupRunsListResponse. */ + interface IBackupRunsListResponse { + + /** BackupRunsListResponse kind */ + kind?: (string|null); + + /** BackupRunsListResponse items */ + items?: (google.cloud.sql.v1.IBackupRun[]|null); + + /** BackupRunsListResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a BackupRunsListResponse. */ + class BackupRunsListResponse implements IBackupRunsListResponse { + + /** + * Constructs a new BackupRunsListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IBackupRunsListResponse); + + /** BackupRunsListResponse kind. */ + public kind: string; + + /** BackupRunsListResponse items. */ + public items: google.cloud.sql.v1.IBackupRun[]; + + /** BackupRunsListResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new BackupRunsListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupRunsListResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IBackupRunsListResponse): google.cloud.sql.v1.BackupRunsListResponse; + + /** + * Encodes the specified BackupRunsListResponse message. Does not implicitly {@link google.cloud.sql.v1.BackupRunsListResponse.verify|verify} messages. + * @param message BackupRunsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IBackupRunsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupRunsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRunsListResponse.verify|verify} messages. + * @param message BackupRunsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IBackupRunsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupRunsListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupRunsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupRunsListResponse; + + /** + * Decodes a BackupRunsListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupRunsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupRunsListResponse; + + /** + * Verifies a BackupRunsListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupRunsListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupRunsListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupRunsListResponse; + + /** + * Creates a plain object from a BackupRunsListResponse message. Also converts values to other types if specified. + * @param message BackupRunsListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.BackupRunsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupRunsListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupRunsListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlBackupRunStatus enum. */ + enum SqlBackupRunStatus { + SQL_BACKUP_RUN_STATUS_UNSPECIFIED = 0, + ENQUEUED = 1, + OVERDUE = 2, + RUNNING = 3, + FAILED = 4, + SUCCESSFUL = 5, + SKIPPED = 6, + DELETION_PENDING = 7, + DELETION_FAILED = 8, + DELETED = 9 + } + + /** SqlBackupKind enum. */ + enum SqlBackupKind { + SQL_BACKUP_KIND_UNSPECIFIED = 0, + SNAPSHOT = 1, + PHYSICAL = 2 + } + + /** SqlBackupRunType enum. */ + enum SqlBackupRunType { + SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0, + AUTOMATED = 1, + ON_DEMAND = 2 + } + + /** Properties of an AclEntry. */ + interface IAclEntry { + + /** AclEntry value */ + value?: (string|null); + + /** AclEntry expirationTime */ + expirationTime?: (google.protobuf.ITimestamp|null); + + /** AclEntry name */ + name?: (string|null); + + /** AclEntry kind */ + kind?: (string|null); + } + + /** Represents an AclEntry. */ + class AclEntry implements IAclEntry { + + /** + * Constructs a new AclEntry. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IAclEntry); + + /** AclEntry value. */ + public value: string; + + /** AclEntry expirationTime. */ + public expirationTime?: (google.protobuf.ITimestamp|null); + + /** AclEntry name. */ + public name: string; + + /** AclEntry kind. */ + public kind: string; + + /** + * Creates a new AclEntry instance using the specified properties. + * @param [properties] Properties to set + * @returns AclEntry instance + */ + public static create(properties?: google.cloud.sql.v1.IAclEntry): google.cloud.sql.v1.AclEntry; + + /** + * Encodes the specified AclEntry message. Does not implicitly {@link google.cloud.sql.v1.AclEntry.verify|verify} messages. + * @param message AclEntry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IAclEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AclEntry message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AclEntry.verify|verify} messages. + * @param message AclEntry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IAclEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AclEntry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AclEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.AclEntry; + + /** + * Decodes an AclEntry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AclEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.AclEntry; + + /** + * Verifies an AclEntry message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AclEntry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AclEntry + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.AclEntry; + + /** + * Creates a plain object from an AclEntry message. Also converts values to other types if specified. + * @param message AclEntry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.AclEntry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AclEntry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AclEntry + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ApiWarning. */ + interface IApiWarning { + + /** ApiWarning code */ + code?: (google.cloud.sql.v1.ApiWarning.SqlApiWarningCode|keyof typeof google.cloud.sql.v1.ApiWarning.SqlApiWarningCode|null); + + /** ApiWarning message */ + message?: (string|null); + + /** ApiWarning region */ + region?: (string|null); + } + + /** Represents an ApiWarning. */ + class ApiWarning implements IApiWarning { + + /** + * Constructs a new ApiWarning. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IApiWarning); + + /** ApiWarning code. */ + public code: (google.cloud.sql.v1.ApiWarning.SqlApiWarningCode|keyof typeof google.cloud.sql.v1.ApiWarning.SqlApiWarningCode); + + /** ApiWarning message. */ + public message: string; + + /** ApiWarning region. */ + public region: string; + + /** + * Creates a new ApiWarning instance using the specified properties. + * @param [properties] Properties to set + * @returns ApiWarning instance + */ + public static create(properties?: google.cloud.sql.v1.IApiWarning): google.cloud.sql.v1.ApiWarning; + + /** + * Encodes the specified ApiWarning message. Does not implicitly {@link google.cloud.sql.v1.ApiWarning.verify|verify} messages. + * @param message ApiWarning message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IApiWarning, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ApiWarning message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ApiWarning.verify|verify} messages. + * @param message ApiWarning message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IApiWarning, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ApiWarning message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ApiWarning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ApiWarning; + + /** + * Decodes an ApiWarning message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ApiWarning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ApiWarning; + + /** + * Verifies an ApiWarning message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ApiWarning message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ApiWarning + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ApiWarning; + + /** + * Creates a plain object from an ApiWarning message. Also converts values to other types if specified. + * @param message ApiWarning + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ApiWarning, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ApiWarning to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ApiWarning + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ApiWarning { + + /** SqlApiWarningCode enum. */ + enum SqlApiWarningCode { + SQL_API_WARNING_CODE_UNSPECIFIED = 0, + REGION_UNREACHABLE = 1, + MAX_RESULTS_EXCEEDS_LIMIT = 2, + COMPROMISED_CREDENTIALS = 3, + INTERNAL_STATE_FAILURE = 4 + } + } + + /** Properties of a BackupRetentionSettings. */ + interface IBackupRetentionSettings { + + /** BackupRetentionSettings retentionUnit */ + retentionUnit?: (google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit|keyof typeof google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit|null); + + /** BackupRetentionSettings retainedBackups */ + retainedBackups?: (google.protobuf.IInt32Value|null); + } + + /** Represents a BackupRetentionSettings. */ + class BackupRetentionSettings implements IBackupRetentionSettings { + + /** + * Constructs a new BackupRetentionSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IBackupRetentionSettings); + + /** BackupRetentionSettings retentionUnit. */ + public retentionUnit: (google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit|keyof typeof google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit); + + /** BackupRetentionSettings retainedBackups. */ + public retainedBackups?: (google.protobuf.IInt32Value|null); + + /** + * Creates a new BackupRetentionSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupRetentionSettings instance + */ + public static create(properties?: google.cloud.sql.v1.IBackupRetentionSettings): google.cloud.sql.v1.BackupRetentionSettings; + + /** + * Encodes the specified BackupRetentionSettings message. Does not implicitly {@link google.cloud.sql.v1.BackupRetentionSettings.verify|verify} messages. + * @param message BackupRetentionSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IBackupRetentionSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupRetentionSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRetentionSettings.verify|verify} messages. + * @param message BackupRetentionSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IBackupRetentionSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupRetentionSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupRetentionSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupRetentionSettings; + + /** + * Decodes a BackupRetentionSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupRetentionSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupRetentionSettings; + + /** + * Verifies a BackupRetentionSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupRetentionSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupRetentionSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupRetentionSettings; + + /** + * Creates a plain object from a BackupRetentionSettings message. Also converts values to other types if specified. + * @param message BackupRetentionSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.BackupRetentionSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupRetentionSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupRetentionSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BackupRetentionSettings { + + /** RetentionUnit enum. */ + enum RetentionUnit { + RETENTION_UNIT_UNSPECIFIED = 0, + COUNT = 1 + } + } + + /** Properties of a BackupConfiguration. */ + interface IBackupConfiguration { + + /** BackupConfiguration startTime */ + startTime?: (string|null); + + /** BackupConfiguration enabled */ + enabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration kind */ + kind?: (string|null); + + /** BackupConfiguration binaryLogEnabled */ + binaryLogEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration replicationLogArchivingEnabled */ + replicationLogArchivingEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration location */ + location?: (string|null); + + /** BackupConfiguration pointInTimeRecoveryEnabled */ + pointInTimeRecoveryEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration backupRetentionSettings */ + backupRetentionSettings?: (google.cloud.sql.v1.IBackupRetentionSettings|null); + + /** BackupConfiguration transactionLogRetentionDays */ + transactionLogRetentionDays?: (google.protobuf.IInt32Value|null); + + /** BackupConfiguration transactionalLogStorageState */ + transactionalLogStorageState?: (google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|keyof typeof google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|null); + + /** BackupConfiguration backupTier */ + backupTier?: (google.cloud.sql.v1.BackupConfiguration.BackupTier|keyof typeof google.cloud.sql.v1.BackupConfiguration.BackupTier|null); + } + + /** Represents a BackupConfiguration. */ + class BackupConfiguration implements IBackupConfiguration { + + /** + * Constructs a new BackupConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IBackupConfiguration); + + /** BackupConfiguration startTime. */ + public startTime: string; + + /** BackupConfiguration enabled. */ + public enabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration kind. */ + public kind: string; + + /** BackupConfiguration binaryLogEnabled. */ + public binaryLogEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration replicationLogArchivingEnabled. */ + public replicationLogArchivingEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration location. */ + public location: string; + + /** BackupConfiguration pointInTimeRecoveryEnabled. */ + public pointInTimeRecoveryEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration backupRetentionSettings. */ + public backupRetentionSettings?: (google.cloud.sql.v1.IBackupRetentionSettings|null); + + /** BackupConfiguration transactionLogRetentionDays. */ + public transactionLogRetentionDays?: (google.protobuf.IInt32Value|null); + + /** BackupConfiguration transactionalLogStorageState. */ + public transactionalLogStorageState?: (google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|keyof typeof google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|null); + + /** BackupConfiguration backupTier. */ + public backupTier?: (google.cloud.sql.v1.BackupConfiguration.BackupTier|keyof typeof google.cloud.sql.v1.BackupConfiguration.BackupTier|null); + + /** + * Creates a new BackupConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1.IBackupConfiguration): google.cloud.sql.v1.BackupConfiguration; + + /** + * Encodes the specified BackupConfiguration message. Does not implicitly {@link google.cloud.sql.v1.BackupConfiguration.verify|verify} messages. + * @param message BackupConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IBackupConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupConfiguration.verify|verify} messages. + * @param message BackupConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IBackupConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupConfiguration; + + /** + * Decodes a BackupConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupConfiguration; + + /** + * Verifies a BackupConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupConfiguration; + + /** + * Creates a plain object from a BackupConfiguration message. Also converts values to other types if specified. + * @param message BackupConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.BackupConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BackupConfiguration { + + /** TransactionalLogStorageState enum. */ + enum TransactionalLogStorageState { + TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED = 0, + DISK = 1, + SWITCHING_TO_CLOUD_STORAGE = 2, + SWITCHED_TO_CLOUD_STORAGE = 3, + CLOUD_STORAGE = 4 + } + + /** BackupTier enum. */ + enum BackupTier { + BACKUP_TIER_UNSPECIFIED = 0, + STANDARD = 1, + ADVANCED = 2, + ENHANCED = 3 + } + } + + /** Properties of a PerformDiskShrinkContext. */ + interface IPerformDiskShrinkContext { + + /** PerformDiskShrinkContext targetSizeGb */ + targetSizeGb?: (number|Long|string|null); + } + + /** Represents a PerformDiskShrinkContext. */ + class PerformDiskShrinkContext implements IPerformDiskShrinkContext { + + /** + * Constructs a new PerformDiskShrinkContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IPerformDiskShrinkContext); + + /** PerformDiskShrinkContext targetSizeGb. */ + public targetSizeGb: (number|Long|string); + + /** + * Creates a new PerformDiskShrinkContext instance using the specified properties. + * @param [properties] Properties to set + * @returns PerformDiskShrinkContext instance + */ + public static create(properties?: google.cloud.sql.v1.IPerformDiskShrinkContext): google.cloud.sql.v1.PerformDiskShrinkContext; + + /** + * Encodes the specified PerformDiskShrinkContext message. Does not implicitly {@link google.cloud.sql.v1.PerformDiskShrinkContext.verify|verify} messages. + * @param message PerformDiskShrinkContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IPerformDiskShrinkContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PerformDiskShrinkContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PerformDiskShrinkContext.verify|verify} messages. + * @param message PerformDiskShrinkContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IPerformDiskShrinkContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PerformDiskShrinkContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PerformDiskShrinkContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PerformDiskShrinkContext; + + /** + * Decodes a PerformDiskShrinkContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PerformDiskShrinkContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PerformDiskShrinkContext; + + /** + * Verifies a PerformDiskShrinkContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PerformDiskShrinkContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PerformDiskShrinkContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PerformDiskShrinkContext; + + /** + * Creates a plain object from a PerformDiskShrinkContext message. Also converts values to other types if specified. + * @param message PerformDiskShrinkContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.PerformDiskShrinkContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PerformDiskShrinkContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PerformDiskShrinkContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PreCheckResponse. */ + interface IPreCheckResponse { + + /** PreCheckResponse message */ + message?: (string|null); + + /** PreCheckResponse messageType */ + messageType?: (google.cloud.sql.v1.PreCheckResponse.MessageType|keyof typeof google.cloud.sql.v1.PreCheckResponse.MessageType|null); + + /** PreCheckResponse actionsRequired */ + actionsRequired?: (string[]|null); + } + + /** Represents a PreCheckResponse. */ + class PreCheckResponse implements IPreCheckResponse { + + /** + * Constructs a new PreCheckResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IPreCheckResponse); + + /** PreCheckResponse message. */ + public message?: (string|null); + + /** PreCheckResponse messageType. */ + public messageType?: (google.cloud.sql.v1.PreCheckResponse.MessageType|keyof typeof google.cloud.sql.v1.PreCheckResponse.MessageType|null); + + /** PreCheckResponse actionsRequired. */ + public actionsRequired: string[]; + + /** + * Creates a new PreCheckResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PreCheckResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IPreCheckResponse): google.cloud.sql.v1.PreCheckResponse; + + /** + * Encodes the specified PreCheckResponse message. Does not implicitly {@link google.cloud.sql.v1.PreCheckResponse.verify|verify} messages. + * @param message PreCheckResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IPreCheckResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PreCheckResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PreCheckResponse.verify|verify} messages. + * @param message PreCheckResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IPreCheckResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PreCheckResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PreCheckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PreCheckResponse; + + /** + * Decodes a PreCheckResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PreCheckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PreCheckResponse; + + /** + * Verifies a PreCheckResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PreCheckResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PreCheckResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PreCheckResponse; + + /** + * Creates a plain object from a PreCheckResponse message. Also converts values to other types if specified. + * @param message PreCheckResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.PreCheckResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PreCheckResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PreCheckResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PreCheckResponse { + + /** MessageType enum. */ + enum MessageType { + MESSAGE_TYPE_UNSPECIFIED = 0, + INFO = 1, + WARNING = 2, + ERROR = 3 + } + } + + /** Properties of a PreCheckMajorVersionUpgradeContext. */ + interface IPreCheckMajorVersionUpgradeContext { + + /** PreCheckMajorVersionUpgradeContext targetDatabaseVersion */ + targetDatabaseVersion?: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion|null); + + /** PreCheckMajorVersionUpgradeContext preCheckResponse */ + preCheckResponse?: (google.cloud.sql.v1.IPreCheckResponse[]|null); + + /** PreCheckMajorVersionUpgradeContext kind */ + kind?: (string|null); + } + + /** Represents a PreCheckMajorVersionUpgradeContext. */ + class PreCheckMajorVersionUpgradeContext implements IPreCheckMajorVersionUpgradeContext { + + /** + * Constructs a new PreCheckMajorVersionUpgradeContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext); + + /** PreCheckMajorVersionUpgradeContext targetDatabaseVersion. */ + public targetDatabaseVersion: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion); + + /** PreCheckMajorVersionUpgradeContext preCheckResponse. */ + public preCheckResponse: google.cloud.sql.v1.IPreCheckResponse[]; + + /** PreCheckMajorVersionUpgradeContext kind. */ + public kind: string; + + /** + * Creates a new PreCheckMajorVersionUpgradeContext instance using the specified properties. + * @param [properties] Properties to set + * @returns PreCheckMajorVersionUpgradeContext instance + */ + public static create(properties?: google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext): google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext; + + /** + * Encodes the specified PreCheckMajorVersionUpgradeContext message. Does not implicitly {@link google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify|verify} messages. + * @param message PreCheckMajorVersionUpgradeContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PreCheckMajorVersionUpgradeContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify|verify} messages. + * @param message PreCheckMajorVersionUpgradeContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PreCheckMajorVersionUpgradeContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext; + + /** + * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PreCheckMajorVersionUpgradeContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext; + + /** + * Verifies a PreCheckMajorVersionUpgradeContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PreCheckMajorVersionUpgradeContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PreCheckMajorVersionUpgradeContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext; + + /** + * Creates a plain object from a PreCheckMajorVersionUpgradeContext message. Also converts values to other types if specified. + * @param message PreCheckMajorVersionUpgradeContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PreCheckMajorVersionUpgradeContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PreCheckMajorVersionUpgradeContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupContext. */ + interface IBackupContext { + + /** BackupContext backupId */ + backupId?: (number|Long|string|null); + + /** BackupContext kind */ + kind?: (string|null); + + /** BackupContext name */ + name?: (string|null); + } + + /** Represents a BackupContext. */ + class BackupContext implements IBackupContext { + + /** + * Constructs a new BackupContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IBackupContext); + + /** BackupContext backupId. */ + public backupId: (number|Long|string); + + /** BackupContext kind. */ + public kind: string; + + /** BackupContext name. */ + public name: string; + + /** + * Creates a new BackupContext instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupContext instance + */ + public static create(properties?: google.cloud.sql.v1.IBackupContext): google.cloud.sql.v1.BackupContext; + + /** + * Encodes the specified BackupContext message. Does not implicitly {@link google.cloud.sql.v1.BackupContext.verify|verify} messages. + * @param message BackupContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupContext.verify|verify} messages. + * @param message BackupContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupContext; + + /** + * Decodes a BackupContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupContext; + + /** + * Verifies a BackupContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupContext; + + /** + * Creates a plain object from a BackupContext message. Also converts values to other types if specified. + * @param message BackupContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.BackupContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Database. */ + interface IDatabase { + + /** Database kind */ + kind?: (string|null); + + /** Database charset */ + charset?: (string|null); + + /** Database collation */ + collation?: (string|null); + + /** Database etag */ + etag?: (string|null); + + /** Database name */ + name?: (string|null); + + /** Database instance */ + instance?: (string|null); + + /** Database selfLink */ + selfLink?: (string|null); + + /** Database project */ + project?: (string|null); + + /** Database sqlserverDatabaseDetails */ + sqlserverDatabaseDetails?: (google.cloud.sql.v1.ISqlServerDatabaseDetails|null); + } + + /** Represents a Database. */ + class Database implements IDatabase { + + /** + * Constructs a new Database. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDatabase); + + /** Database kind. */ + public kind: string; + + /** Database charset. */ + public charset: string; + + /** Database collation. */ + public collation: string; + + /** Database etag. */ + public etag: string; + + /** Database name. */ + public name: string; + + /** Database instance. */ + public instance: string; + + /** Database selfLink. */ + public selfLink: string; + + /** Database project. */ + public project: string; + + /** Database sqlserverDatabaseDetails. */ + public sqlserverDatabaseDetails?: (google.cloud.sql.v1.ISqlServerDatabaseDetails|null); + + /** Database databaseDetails. */ + public databaseDetails?: "sqlserverDatabaseDetails"; + + /** + * Creates a new Database instance using the specified properties. + * @param [properties] Properties to set + * @returns Database instance + */ + public static create(properties?: google.cloud.sql.v1.IDatabase): google.cloud.sql.v1.Database; + + /** + * Encodes the specified Database message. Does not implicitly {@link google.cloud.sql.v1.Database.verify|verify} messages. + * @param message Database message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDatabase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Database message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Database.verify|verify} messages. + * @param message Database message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDatabase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Database message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Database; + + /** + * Decodes a Database message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Database; + + /** + * Verifies a Database message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Database message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Database + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Database; + + /** + * Creates a plain object from a Database message. Also converts values to other types if specified. + * @param message Database + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.Database, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Database to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Database + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlServerDatabaseDetails. */ + interface ISqlServerDatabaseDetails { + + /** SqlServerDatabaseDetails compatibilityLevel */ + compatibilityLevel?: (number|null); + + /** SqlServerDatabaseDetails recoveryModel */ + recoveryModel?: (string|null); + } + + /** Represents a SqlServerDatabaseDetails. */ + class SqlServerDatabaseDetails implements ISqlServerDatabaseDetails { + + /** + * Constructs a new SqlServerDatabaseDetails. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlServerDatabaseDetails); + + /** SqlServerDatabaseDetails compatibilityLevel. */ + public compatibilityLevel: number; + + /** SqlServerDatabaseDetails recoveryModel. */ + public recoveryModel: string; + + /** + * Creates a new SqlServerDatabaseDetails instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlServerDatabaseDetails instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlServerDatabaseDetails): google.cloud.sql.v1.SqlServerDatabaseDetails; + + /** + * Encodes the specified SqlServerDatabaseDetails message. Does not implicitly {@link google.cloud.sql.v1.SqlServerDatabaseDetails.verify|verify} messages. + * @param message SqlServerDatabaseDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlServerDatabaseDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlServerDatabaseDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerDatabaseDetails.verify|verify} messages. + * @param message SqlServerDatabaseDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlServerDatabaseDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlServerDatabaseDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlServerDatabaseDetails; + + /** + * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlServerDatabaseDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlServerDatabaseDetails; + + /** + * Verifies a SqlServerDatabaseDetails message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlServerDatabaseDetails message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlServerDatabaseDetails + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlServerDatabaseDetails; + + /** + * Creates a plain object from a SqlServerDatabaseDetails message. Also converts values to other types if specified. + * @param message SqlServerDatabaseDetails + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlServerDatabaseDetails, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlServerDatabaseDetails to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlServerDatabaseDetails + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DatabaseFlags. */ + interface IDatabaseFlags { + + /** DatabaseFlags name */ + name?: (string|null); + + /** DatabaseFlags value */ + value?: (string|null); + } + + /** Represents a DatabaseFlags. */ + class DatabaseFlags implements IDatabaseFlags { + + /** + * Constructs a new DatabaseFlags. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDatabaseFlags); + + /** DatabaseFlags name. */ + public name: string; + + /** DatabaseFlags value. */ + public value: string; + + /** + * Creates a new DatabaseFlags instance using the specified properties. + * @param [properties] Properties to set + * @returns DatabaseFlags instance + */ + public static create(properties?: google.cloud.sql.v1.IDatabaseFlags): google.cloud.sql.v1.DatabaseFlags; + + /** + * Encodes the specified DatabaseFlags message. Does not implicitly {@link google.cloud.sql.v1.DatabaseFlags.verify|verify} messages. + * @param message DatabaseFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDatabaseFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DatabaseFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseFlags.verify|verify} messages. + * @param message DatabaseFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDatabaseFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DatabaseFlags message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DatabaseFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseFlags; + + /** + * Decodes a DatabaseFlags message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DatabaseFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseFlags; + + /** + * Verifies a DatabaseFlags message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DatabaseFlags message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DatabaseFlags + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseFlags; + + /** + * Creates a plain object from a DatabaseFlags message. Also converts values to other types if specified. + * @param message DatabaseFlags + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DatabaseFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DatabaseFlags to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DatabaseFlags + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MySqlSyncConfig. */ + interface IMySqlSyncConfig { + + /** MySqlSyncConfig initialSyncFlags */ + initialSyncFlags?: (google.cloud.sql.v1.ISyncFlags[]|null); + } + + /** Represents a MySqlSyncConfig. */ + class MySqlSyncConfig implements IMySqlSyncConfig { + + /** + * Constructs a new MySqlSyncConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IMySqlSyncConfig); + + /** MySqlSyncConfig initialSyncFlags. */ + public initialSyncFlags: google.cloud.sql.v1.ISyncFlags[]; + + /** + * Creates a new MySqlSyncConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns MySqlSyncConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IMySqlSyncConfig): google.cloud.sql.v1.MySqlSyncConfig; + + /** + * Encodes the specified MySqlSyncConfig message. Does not implicitly {@link google.cloud.sql.v1.MySqlSyncConfig.verify|verify} messages. + * @param message MySqlSyncConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IMySqlSyncConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MySqlSyncConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MySqlSyncConfig.verify|verify} messages. + * @param message MySqlSyncConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IMySqlSyncConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MySqlSyncConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MySqlSyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.MySqlSyncConfig; + + /** + * Decodes a MySqlSyncConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MySqlSyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.MySqlSyncConfig; + + /** + * Verifies a MySqlSyncConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MySqlSyncConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MySqlSyncConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.MySqlSyncConfig; + + /** + * Creates a plain object from a MySqlSyncConfig message. Also converts values to other types if specified. + * @param message MySqlSyncConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.MySqlSyncConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MySqlSyncConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MySqlSyncConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SyncFlags. */ + interface ISyncFlags { + + /** SyncFlags name */ + name?: (string|null); + + /** SyncFlags value */ + value?: (string|null); + } + + /** Represents a SyncFlags. */ + class SyncFlags implements ISyncFlags { + + /** + * Constructs a new SyncFlags. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISyncFlags); + + /** SyncFlags name. */ + public name: string; + + /** SyncFlags value. */ + public value: string; + + /** + * Creates a new SyncFlags instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncFlags instance + */ + public static create(properties?: google.cloud.sql.v1.ISyncFlags): google.cloud.sql.v1.SyncFlags; + + /** + * Encodes the specified SyncFlags message. Does not implicitly {@link google.cloud.sql.v1.SyncFlags.verify|verify} messages. + * @param message SyncFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISyncFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SyncFlags.verify|verify} messages. + * @param message SyncFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISyncFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncFlags message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SyncFlags; + + /** + * Decodes a SyncFlags message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SyncFlags; + + /** + * Verifies a SyncFlags message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncFlags message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncFlags + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SyncFlags; + + /** + * Creates a plain object from a SyncFlags message. Also converts values to other types if specified. + * @param message SyncFlags + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SyncFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncFlags to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SyncFlags + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstanceReference. */ + interface IInstanceReference { + + /** InstanceReference name */ + name?: (string|null); + + /** InstanceReference region */ + region?: (string|null); + + /** InstanceReference project */ + project?: (string|null); + } + + /** Represents an InstanceReference. */ + class InstanceReference implements IInstanceReference { + + /** + * Constructs a new InstanceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstanceReference); + + /** InstanceReference name. */ + public name: string; + + /** InstanceReference region. */ + public region: string; + + /** InstanceReference project. */ + public project: string; + + /** + * Creates a new InstanceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns InstanceReference instance + */ + public static create(properties?: google.cloud.sql.v1.IInstanceReference): google.cloud.sql.v1.InstanceReference; + + /** + * Encodes the specified InstanceReference message. Does not implicitly {@link google.cloud.sql.v1.InstanceReference.verify|verify} messages. + * @param message InstanceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstanceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstanceReference message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstanceReference.verify|verify} messages. + * @param message InstanceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstanceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstanceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstanceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstanceReference; + + /** + * Decodes an InstanceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstanceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstanceReference; + + /** + * Verifies an InstanceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstanceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstanceReference + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstanceReference; + + /** + * Creates a plain object from an InstanceReference message. Also converts values to other types if specified. + * @param message InstanceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstanceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstanceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstanceReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DemoteMasterConfiguration. */ + interface IDemoteMasterConfiguration { + + /** DemoteMasterConfiguration kind */ + kind?: (string|null); + + /** DemoteMasterConfiguration mysqlReplicaConfiguration */ + mysqlReplicaConfiguration?: (google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration|null); + } + + /** Represents a DemoteMasterConfiguration. */ + class DemoteMasterConfiguration implements IDemoteMasterConfiguration { + + /** + * Constructs a new DemoteMasterConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDemoteMasterConfiguration); + + /** DemoteMasterConfiguration kind. */ + public kind: string; + + /** DemoteMasterConfiguration mysqlReplicaConfiguration. */ + public mysqlReplicaConfiguration?: (google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration|null); + + /** + * Creates a new DemoteMasterConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns DemoteMasterConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1.IDemoteMasterConfiguration): google.cloud.sql.v1.DemoteMasterConfiguration; + + /** + * Encodes the specified DemoteMasterConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterConfiguration.verify|verify} messages. + * @param message DemoteMasterConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDemoteMasterConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DemoteMasterConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterConfiguration.verify|verify} messages. + * @param message DemoteMasterConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDemoteMasterConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DemoteMasterConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DemoteMasterConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DemoteMasterConfiguration; + + /** + * Decodes a DemoteMasterConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DemoteMasterConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DemoteMasterConfiguration; + + /** + * Verifies a DemoteMasterConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DemoteMasterConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DemoteMasterConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DemoteMasterConfiguration; + + /** + * Creates a plain object from a DemoteMasterConfiguration message. Also converts values to other types if specified. + * @param message DemoteMasterConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DemoteMasterConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DemoteMasterConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DemoteMasterConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DemoteMasterMySqlReplicaConfiguration. */ + interface IDemoteMasterMySqlReplicaConfiguration { + + /** DemoteMasterMySqlReplicaConfiguration kind */ + kind?: (string|null); + + /** DemoteMasterMySqlReplicaConfiguration username */ + username?: (string|null); + + /** DemoteMasterMySqlReplicaConfiguration password */ + password?: (string|null); + + /** DemoteMasterMySqlReplicaConfiguration clientKey */ + clientKey?: (string|null); + + /** DemoteMasterMySqlReplicaConfiguration clientCertificate */ + clientCertificate?: (string|null); + + /** DemoteMasterMySqlReplicaConfiguration caCertificate */ + caCertificate?: (string|null); + } + + /** Represents a DemoteMasterMySqlReplicaConfiguration. */ + class DemoteMasterMySqlReplicaConfiguration implements IDemoteMasterMySqlReplicaConfiguration { + + /** + * Constructs a new DemoteMasterMySqlReplicaConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration); + + /** DemoteMasterMySqlReplicaConfiguration kind. */ + public kind: string; + + /** DemoteMasterMySqlReplicaConfiguration username. */ + public username: string; + + /** DemoteMasterMySqlReplicaConfiguration password. */ + public password: string; + + /** DemoteMasterMySqlReplicaConfiguration clientKey. */ + public clientKey: string; + + /** DemoteMasterMySqlReplicaConfiguration clientCertificate. */ + public clientCertificate: string; + + /** DemoteMasterMySqlReplicaConfiguration caCertificate. */ + public caCertificate: string; + + /** + * Creates a new DemoteMasterMySqlReplicaConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns DemoteMasterMySqlReplicaConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration): google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration; + + /** + * Encodes the specified DemoteMasterMySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. + * @param message DemoteMasterMySqlReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DemoteMasterMySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. + * @param message DemoteMasterMySqlReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DemoteMasterMySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration; + + /** + * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DemoteMasterMySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration; + + /** + * Verifies a DemoteMasterMySqlReplicaConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DemoteMasterMySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DemoteMasterMySqlReplicaConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration; + + /** + * Creates a plain object from a DemoteMasterMySqlReplicaConfiguration message. Also converts values to other types if specified. + * @param message DemoteMasterMySqlReplicaConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DemoteMasterMySqlReplicaConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DemoteMasterMySqlReplicaConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlFileType enum. */ + enum SqlFileType { + SQL_FILE_TYPE_UNSPECIFIED = 0, + SQL = 1, + CSV = 2, + BAK = 4, + TDE = 8 + } + + /** Properties of an ExportContext. */ + interface IExportContext { + + /** ExportContext uri */ + uri?: (string|null); + + /** ExportContext databases */ + databases?: (string[]|null); + + /** ExportContext kind */ + kind?: (string|null); + + /** ExportContext sqlExportOptions */ + sqlExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlExportOptions|null); + + /** ExportContext csvExportOptions */ + csvExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions|null); + + /** ExportContext fileType */ + fileType?: (google.cloud.sql.v1.SqlFileType|keyof typeof google.cloud.sql.v1.SqlFileType|null); + + /** ExportContext offload */ + offload?: (google.protobuf.IBoolValue|null); + + /** ExportContext bakExportOptions */ + bakExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlBakExportOptions|null); + + /** ExportContext tdeExportOptions */ + tdeExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions|null); + } + + /** Represents an ExportContext. */ + class ExportContext implements IExportContext { + + /** + * Constructs a new ExportContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IExportContext); + + /** ExportContext uri. */ + public uri: string; + + /** ExportContext databases. */ + public databases: string[]; + + /** ExportContext kind. */ + public kind: string; + + /** ExportContext sqlExportOptions. */ + public sqlExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlExportOptions|null); + + /** ExportContext csvExportOptions. */ + public csvExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions|null); + + /** ExportContext fileType. */ + public fileType: (google.cloud.sql.v1.SqlFileType|keyof typeof google.cloud.sql.v1.SqlFileType); + + /** ExportContext offload. */ + public offload?: (google.protobuf.IBoolValue|null); + + /** ExportContext bakExportOptions. */ + public bakExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlBakExportOptions|null); + + /** ExportContext tdeExportOptions. */ + public tdeExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions|null); + + /** + * Creates a new ExportContext instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportContext instance + */ + public static create(properties?: google.cloud.sql.v1.IExportContext): google.cloud.sql.v1.ExportContext; + + /** + * Encodes the specified ExportContext message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.verify|verify} messages. + * @param message ExportContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IExportContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.verify|verify} messages. + * @param message ExportContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IExportContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext; + + /** + * Decodes an ExportContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext; + + /** + * Verifies an ExportContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext; + + /** + * Creates a plain object from an ExportContext message. Also converts values to other types if specified. + * @param message ExportContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ExportContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ExportContext { + + /** Properties of a SqlCsvExportOptions. */ + interface ISqlCsvExportOptions { + + /** SqlCsvExportOptions selectQuery */ + selectQuery?: (string|null); + + /** SqlCsvExportOptions escapeCharacter */ + escapeCharacter?: (string|null); + + /** SqlCsvExportOptions quoteCharacter */ + quoteCharacter?: (string|null); + + /** SqlCsvExportOptions fieldsTerminatedBy */ + fieldsTerminatedBy?: (string|null); + + /** SqlCsvExportOptions linesTerminatedBy */ + linesTerminatedBy?: (string|null); + } + + /** Represents a SqlCsvExportOptions. */ + class SqlCsvExportOptions implements ISqlCsvExportOptions { + + /** + * Constructs a new SqlCsvExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions); + + /** SqlCsvExportOptions selectQuery. */ + public selectQuery: string; + + /** SqlCsvExportOptions escapeCharacter. */ + public escapeCharacter: string; + + /** SqlCsvExportOptions quoteCharacter. */ + public quoteCharacter: string; + + /** SqlCsvExportOptions fieldsTerminatedBy. */ + public fieldsTerminatedBy: string; + + /** SqlCsvExportOptions linesTerminatedBy. */ + public linesTerminatedBy: string; + + /** + * Creates a new SqlCsvExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlCsvExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions): google.cloud.sql.v1.ExportContext.SqlCsvExportOptions; + + /** + * Encodes the specified SqlCsvExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.verify|verify} messages. + * @param message SqlCsvExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlCsvExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.verify|verify} messages. + * @param message SqlCsvExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlCsvExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlCsvExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlCsvExportOptions; + + /** + * Decodes a SqlCsvExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlCsvExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlCsvExportOptions; + + /** + * Verifies a SqlCsvExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlCsvExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlCsvExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlCsvExportOptions; + + /** + * Creates a plain object from a SqlCsvExportOptions message. Also converts values to other types if specified. + * @param message SqlCsvExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ExportContext.SqlCsvExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlCsvExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlCsvExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlExportOptions. */ + interface ISqlExportOptions { + + /** SqlExportOptions tables */ + tables?: (string[]|null); + + /** SqlExportOptions schemaOnly */ + schemaOnly?: (google.protobuf.IBoolValue|null); + + /** SqlExportOptions mysqlExportOptions */ + mysqlExportOptions?: (google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions|null); + + /** SqlExportOptions threads */ + threads?: (google.protobuf.IInt32Value|null); + + /** SqlExportOptions parallel */ + parallel?: (google.protobuf.IBoolValue|null); + + /** SqlExportOptions postgresExportOptions */ + postgresExportOptions?: (google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions|null); + } + + /** Represents a SqlExportOptions. */ + class SqlExportOptions implements ISqlExportOptions { + + /** + * Constructs a new SqlExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ExportContext.ISqlExportOptions); + + /** SqlExportOptions tables. */ + public tables: string[]; + + /** SqlExportOptions schemaOnly. */ + public schemaOnly?: (google.protobuf.IBoolValue|null); + + /** SqlExportOptions mysqlExportOptions. */ + public mysqlExportOptions?: (google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions|null); + + /** SqlExportOptions threads. */ + public threads?: (google.protobuf.IInt32Value|null); + + /** SqlExportOptions parallel. */ + public parallel?: (google.protobuf.IBoolValue|null); + + /** SqlExportOptions postgresExportOptions. */ + public postgresExportOptions?: (google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions|null); + + /** + * Creates a new SqlExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ExportContext.ISqlExportOptions): google.cloud.sql.v1.ExportContext.SqlExportOptions; + + /** + * Encodes the specified SqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.verify|verify} messages. + * @param message SqlExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ExportContext.ISqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.verify|verify} messages. + * @param message SqlExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.ISqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlExportOptions; + + /** + * Decodes a SqlExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlExportOptions; + + /** + * Verifies a SqlExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlExportOptions; + + /** + * Creates a plain object from a SqlExportOptions message. Also converts values to other types if specified. + * @param message SqlExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ExportContext.SqlExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlExportOptions { + + /** Properties of a MysqlExportOptions. */ + interface IMysqlExportOptions { + + /** MysqlExportOptions masterData */ + masterData?: (google.protobuf.IInt32Value|null); + } + + /** Represents a MysqlExportOptions. */ + class MysqlExportOptions implements IMysqlExportOptions { + + /** + * Constructs a new MysqlExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions); + + /** MysqlExportOptions masterData. */ + public masterData?: (google.protobuf.IInt32Value|null); + + /** + * Creates a new MysqlExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MysqlExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions): google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions; + + /** + * Encodes the specified MysqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. + * @param message MysqlExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MysqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. + * @param message MysqlExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MysqlExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MysqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions; + + /** + * Decodes a MysqlExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MysqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions; + + /** + * Verifies a MysqlExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MysqlExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MysqlExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions; + + /** + * Creates a plain object from a MysqlExportOptions message. Also converts values to other types if specified. + * @param message MysqlExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MysqlExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MysqlExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PostgresExportOptions. */ + interface IPostgresExportOptions { + + /** PostgresExportOptions clean */ + clean?: (google.protobuf.IBoolValue|null); + + /** PostgresExportOptions ifExists */ + ifExists?: (google.protobuf.IBoolValue|null); + } + + /** Represents a PostgresExportOptions. */ + class PostgresExportOptions implements IPostgresExportOptions { + + /** + * Constructs a new PostgresExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions); + + /** PostgresExportOptions clean. */ + public clean?: (google.protobuf.IBoolValue|null); + + /** PostgresExportOptions ifExists. */ + public ifExists?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new PostgresExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns PostgresExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions): google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions; + + /** + * Encodes the specified PostgresExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. + * @param message PostgresExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PostgresExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. + * @param message PostgresExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PostgresExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PostgresExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions; + + /** + * Decodes a PostgresExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PostgresExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions; + + /** + * Verifies a PostgresExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PostgresExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PostgresExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions; + + /** + * Creates a plain object from a PostgresExportOptions message. Also converts values to other types if specified. + * @param message PostgresExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PostgresExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PostgresExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SqlBakExportOptions. */ + interface ISqlBakExportOptions { + + /** SqlBakExportOptions striped */ + striped?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions stripeCount */ + stripeCount?: (google.protobuf.IInt32Value|null); + + /** SqlBakExportOptions bakType */ + bakType?: (google.cloud.sql.v1.BakType|keyof typeof google.cloud.sql.v1.BakType|null); + + /** SqlBakExportOptions copyOnly */ + copyOnly?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions differentialBase */ + differentialBase?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions exportLogStartTime */ + exportLogStartTime?: (google.protobuf.ITimestamp|null); + + /** SqlBakExportOptions exportLogEndTime */ + exportLogEndTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a SqlBakExportOptions. */ + class SqlBakExportOptions implements ISqlBakExportOptions { + + /** + * Constructs a new SqlBakExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ExportContext.ISqlBakExportOptions); + + /** SqlBakExportOptions striped. */ + public striped?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions stripeCount. */ + public stripeCount?: (google.protobuf.IInt32Value|null); + + /** SqlBakExportOptions bakType. */ + public bakType: (google.cloud.sql.v1.BakType|keyof typeof google.cloud.sql.v1.BakType); + + /** SqlBakExportOptions copyOnly. */ + public copyOnly?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions differentialBase. */ + public differentialBase?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions exportLogStartTime. */ + public exportLogStartTime?: (google.protobuf.ITimestamp|null); + + /** SqlBakExportOptions exportLogEndTime. */ + public exportLogEndTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new SqlBakExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBakExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ExportContext.ISqlBakExportOptions): google.cloud.sql.v1.ExportContext.SqlBakExportOptions; + + /** + * Encodes the specified SqlBakExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlBakExportOptions.verify|verify} messages. + * @param message SqlBakExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ExportContext.ISqlBakExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBakExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlBakExportOptions.verify|verify} messages. + * @param message SqlBakExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.ISqlBakExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBakExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBakExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlBakExportOptions; + + /** + * Decodes a SqlBakExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBakExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlBakExportOptions; + + /** + * Verifies a SqlBakExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBakExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBakExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlBakExportOptions; + + /** + * Creates a plain object from a SqlBakExportOptions message. Also converts values to other types if specified. + * @param message SqlBakExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ExportContext.SqlBakExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBakExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBakExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlTdeExportOptions. */ + interface ISqlTdeExportOptions { + + /** SqlTdeExportOptions certificatePath */ + certificatePath?: (string|null); + + /** SqlTdeExportOptions privateKeyPath */ + privateKeyPath?: (string|null); + + /** SqlTdeExportOptions privateKeyPassword */ + privateKeyPassword?: (string|null); + + /** SqlTdeExportOptions name */ + name?: (string|null); + } + + /** Represents a SqlTdeExportOptions. */ + class SqlTdeExportOptions implements ISqlTdeExportOptions { + + /** + * Constructs a new SqlTdeExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions); + + /** SqlTdeExportOptions certificatePath. */ + public certificatePath: string; + + /** SqlTdeExportOptions privateKeyPath. */ + public privateKeyPath: string; + + /** SqlTdeExportOptions privateKeyPassword. */ + public privateKeyPassword: string; + + /** SqlTdeExportOptions name. */ + public name: string; + + /** + * Creates a new SqlTdeExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlTdeExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions): google.cloud.sql.v1.ExportContext.SqlTdeExportOptions; + + /** + * Encodes the specified SqlTdeExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.verify|verify} messages. + * @param message SqlTdeExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlTdeExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.verify|verify} messages. + * @param message SqlTdeExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlTdeExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlTdeExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlTdeExportOptions; + + /** + * Decodes a SqlTdeExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlTdeExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlTdeExportOptions; + + /** + * Verifies a SqlTdeExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlTdeExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlTdeExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlTdeExportOptions; + + /** + * Creates a plain object from a SqlTdeExportOptions message. Also converts values to other types if specified. + * @param message SqlTdeExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ExportContext.SqlTdeExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlTdeExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlTdeExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an ImportContext. */ + interface IImportContext { + + /** ImportContext uri */ + uri?: (string|null); + + /** ImportContext database */ + database?: (string|null); + + /** ImportContext kind */ + kind?: (string|null); + + /** ImportContext fileType */ + fileType?: (google.cloud.sql.v1.SqlFileType|keyof typeof google.cloud.sql.v1.SqlFileType|null); + + /** ImportContext csvImportOptions */ + csvImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions|null); + + /** ImportContext importUser */ + importUser?: (string|null); + + /** ImportContext bakImportOptions */ + bakImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlBakImportOptions|null); + + /** ImportContext sqlImportOptions */ + sqlImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlImportOptions|null); + + /** ImportContext tdeImportOptions */ + tdeImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions|null); + } + + /** Represents an ImportContext. */ + class ImportContext implements IImportContext { + + /** + * Constructs a new ImportContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IImportContext); + + /** ImportContext uri. */ + public uri: string; + + /** ImportContext database. */ + public database: string; + + /** ImportContext kind. */ + public kind: string; + + /** ImportContext fileType. */ + public fileType: (google.cloud.sql.v1.SqlFileType|keyof typeof google.cloud.sql.v1.SqlFileType); + + /** ImportContext csvImportOptions. */ + public csvImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions|null); + + /** ImportContext importUser. */ + public importUser: string; + + /** ImportContext bakImportOptions. */ + public bakImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlBakImportOptions|null); + + /** ImportContext sqlImportOptions. */ + public sqlImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlImportOptions|null); + + /** ImportContext tdeImportOptions. */ + public tdeImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions|null); + + /** + * Creates a new ImportContext instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportContext instance + */ + public static create(properties?: google.cloud.sql.v1.IImportContext): google.cloud.sql.v1.ImportContext; + + /** + * Encodes the specified ImportContext message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.verify|verify} messages. + * @param message ImportContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IImportContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.verify|verify} messages. + * @param message ImportContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IImportContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext; + + /** + * Decodes an ImportContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext; + + /** + * Verifies an ImportContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext; + + /** + * Creates a plain object from an ImportContext message. Also converts values to other types if specified. + * @param message ImportContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ImportContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ImportContext { + + /** Properties of a SqlImportOptions. */ + interface ISqlImportOptions { + + /** SqlImportOptions threads */ + threads?: (google.protobuf.IInt32Value|null); + + /** SqlImportOptions parallel */ + parallel?: (google.protobuf.IBoolValue|null); + + /** SqlImportOptions postgresImportOptions */ + postgresImportOptions?: (google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions|null); + } + + /** Represents a SqlImportOptions. */ + class SqlImportOptions implements ISqlImportOptions { + + /** + * Constructs a new SqlImportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ImportContext.ISqlImportOptions); + + /** SqlImportOptions threads. */ + public threads?: (google.protobuf.IInt32Value|null); + + /** SqlImportOptions parallel. */ + public parallel?: (google.protobuf.IBoolValue|null); + + /** SqlImportOptions postgresImportOptions. */ + public postgresImportOptions?: (google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions|null); + + /** + * Creates a new SqlImportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlImportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ImportContext.ISqlImportOptions): google.cloud.sql.v1.ImportContext.SqlImportOptions; + + /** + * Encodes the specified SqlImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.verify|verify} messages. + * @param message SqlImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ImportContext.ISqlImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.verify|verify} messages. + * @param message SqlImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.ISqlImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlImportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlImportOptions; + + /** + * Decodes a SqlImportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlImportOptions; + + /** + * Verifies a SqlImportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlImportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlImportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlImportOptions; + + /** + * Creates a plain object from a SqlImportOptions message. Also converts values to other types if specified. + * @param message SqlImportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ImportContext.SqlImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlImportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlImportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlImportOptions { + + /** Properties of a PostgresImportOptions. */ + interface IPostgresImportOptions { + + /** PostgresImportOptions clean */ + clean?: (google.protobuf.IBoolValue|null); + + /** PostgresImportOptions ifExists */ + ifExists?: (google.protobuf.IBoolValue|null); + } + + /** Represents a PostgresImportOptions. */ + class PostgresImportOptions implements IPostgresImportOptions { + + /** + * Constructs a new PostgresImportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions); + + /** PostgresImportOptions clean. */ + public clean?: (google.protobuf.IBoolValue|null); + + /** PostgresImportOptions ifExists. */ + public ifExists?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new PostgresImportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns PostgresImportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions): google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions; + + /** + * Encodes the specified PostgresImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. + * @param message PostgresImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PostgresImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. + * @param message PostgresImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PostgresImportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PostgresImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions; + + /** + * Decodes a PostgresImportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PostgresImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions; + + /** + * Verifies a PostgresImportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PostgresImportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PostgresImportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions; + + /** + * Creates a plain object from a PostgresImportOptions message. Also converts values to other types if specified. + * @param message PostgresImportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PostgresImportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PostgresImportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SqlCsvImportOptions. */ + interface ISqlCsvImportOptions { + + /** SqlCsvImportOptions table */ + table?: (string|null); + + /** SqlCsvImportOptions columns */ + columns?: (string[]|null); + + /** SqlCsvImportOptions escapeCharacter */ + escapeCharacter?: (string|null); + + /** SqlCsvImportOptions quoteCharacter */ + quoteCharacter?: (string|null); + + /** SqlCsvImportOptions fieldsTerminatedBy */ + fieldsTerminatedBy?: (string|null); + + /** SqlCsvImportOptions linesTerminatedBy */ + linesTerminatedBy?: (string|null); + } + + /** Represents a SqlCsvImportOptions. */ + class SqlCsvImportOptions implements ISqlCsvImportOptions { + + /** + * Constructs a new SqlCsvImportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions); + + /** SqlCsvImportOptions table. */ + public table: string; + + /** SqlCsvImportOptions columns. */ + public columns: string[]; + + /** SqlCsvImportOptions escapeCharacter. */ + public escapeCharacter: string; + + /** SqlCsvImportOptions quoteCharacter. */ + public quoteCharacter: string; + + /** SqlCsvImportOptions fieldsTerminatedBy. */ + public fieldsTerminatedBy: string; + + /** SqlCsvImportOptions linesTerminatedBy. */ + public linesTerminatedBy: string; + + /** + * Creates a new SqlCsvImportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlCsvImportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions): google.cloud.sql.v1.ImportContext.SqlCsvImportOptions; + + /** + * Encodes the specified SqlCsvImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.verify|verify} messages. + * @param message SqlCsvImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlCsvImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.verify|verify} messages. + * @param message SqlCsvImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlCsvImportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlCsvImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlCsvImportOptions; + + /** + * Decodes a SqlCsvImportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlCsvImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlCsvImportOptions; + + /** + * Verifies a SqlCsvImportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlCsvImportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlCsvImportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlCsvImportOptions; + + /** + * Creates a plain object from a SqlCsvImportOptions message. Also converts values to other types if specified. + * @param message SqlCsvImportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ImportContext.SqlCsvImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlCsvImportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlCsvImportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlBakImportOptions. */ + interface ISqlBakImportOptions { + + /** SqlBakImportOptions encryptionOptions */ + encryptionOptions?: (google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions|null); + + /** SqlBakImportOptions striped */ + striped?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions noRecovery */ + noRecovery?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions recoveryOnly */ + recoveryOnly?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions bakType */ + bakType?: (google.cloud.sql.v1.BakType|keyof typeof google.cloud.sql.v1.BakType|null); + + /** SqlBakImportOptions stopAt */ + stopAt?: (google.protobuf.ITimestamp|null); + + /** SqlBakImportOptions stopAtMark */ + stopAtMark?: (string|null); + } + + /** Represents a SqlBakImportOptions. */ + class SqlBakImportOptions implements ISqlBakImportOptions { + + /** + * Constructs a new SqlBakImportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ImportContext.ISqlBakImportOptions); + + /** SqlBakImportOptions encryptionOptions. */ + public encryptionOptions?: (google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions|null); + + /** SqlBakImportOptions striped. */ + public striped?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions noRecovery. */ + public noRecovery?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions recoveryOnly. */ + public recoveryOnly?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions bakType. */ + public bakType: (google.cloud.sql.v1.BakType|keyof typeof google.cloud.sql.v1.BakType); + + /** SqlBakImportOptions stopAt. */ + public stopAt?: (google.protobuf.ITimestamp|null); + + /** SqlBakImportOptions stopAtMark. */ + public stopAtMark: string; + + /** + * Creates a new SqlBakImportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBakImportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ImportContext.ISqlBakImportOptions): google.cloud.sql.v1.ImportContext.SqlBakImportOptions; + + /** + * Encodes the specified SqlBakImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.verify|verify} messages. + * @param message SqlBakImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ImportContext.ISqlBakImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBakImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.verify|verify} messages. + * @param message SqlBakImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.ISqlBakImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBakImportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBakImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlBakImportOptions; + + /** + * Decodes a SqlBakImportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBakImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlBakImportOptions; + + /** + * Verifies a SqlBakImportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBakImportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBakImportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlBakImportOptions; + + /** + * Creates a plain object from a SqlBakImportOptions message. Also converts values to other types if specified. + * @param message SqlBakImportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ImportContext.SqlBakImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBakImportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBakImportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlBakImportOptions { + + /** Properties of an EncryptionOptions. */ + interface IEncryptionOptions { + + /** EncryptionOptions certPath */ + certPath?: (string|null); + + /** EncryptionOptions pvkPath */ + pvkPath?: (string|null); + + /** EncryptionOptions pvkPassword */ + pvkPassword?: (string|null); + + /** EncryptionOptions keepEncrypted */ + keepEncrypted?: (google.protobuf.IBoolValue|null); + } + + /** Represents an EncryptionOptions. */ + class EncryptionOptions implements IEncryptionOptions { + + /** + * Constructs a new EncryptionOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions); + + /** EncryptionOptions certPath. */ + public certPath: string; + + /** EncryptionOptions pvkPath. */ + public pvkPath: string; + + /** EncryptionOptions pvkPassword. */ + public pvkPassword: string; + + /** EncryptionOptions keepEncrypted. */ + public keepEncrypted?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new EncryptionOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EncryptionOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions): google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions; + + /** + * Encodes the specified EncryptionOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. + * @param message EncryptionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EncryptionOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. + * @param message EncryptionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EncryptionOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions; + + /** + * Decodes an EncryptionOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions; + + /** + * Verifies an EncryptionOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EncryptionOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EncryptionOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions; + + /** + * Creates a plain object from an EncryptionOptions message. Also converts values to other types if specified. + * @param message EncryptionOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EncryptionOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EncryptionOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SqlTdeImportOptions. */ + interface ISqlTdeImportOptions { + + /** SqlTdeImportOptions certificatePath */ + certificatePath?: (string|null); + + /** SqlTdeImportOptions privateKeyPath */ + privateKeyPath?: (string|null); + + /** SqlTdeImportOptions privateKeyPassword */ + privateKeyPassword?: (string|null); + + /** SqlTdeImportOptions name */ + name?: (string|null); + } + + /** Represents a SqlTdeImportOptions. */ + class SqlTdeImportOptions implements ISqlTdeImportOptions { + + /** + * Constructs a new SqlTdeImportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions); + + /** SqlTdeImportOptions certificatePath. */ + public certificatePath: string; + + /** SqlTdeImportOptions privateKeyPath. */ + public privateKeyPath: string; + + /** SqlTdeImportOptions privateKeyPassword. */ + public privateKeyPassword: string; + + /** SqlTdeImportOptions name. */ + public name: string; + + /** + * Creates a new SqlTdeImportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlTdeImportOptions instance + */ + public static create(properties?: google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions): google.cloud.sql.v1.ImportContext.SqlTdeImportOptions; + + /** + * Encodes the specified SqlTdeImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.verify|verify} messages. + * @param message SqlTdeImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlTdeImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.verify|verify} messages. + * @param message SqlTdeImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlTdeImportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlTdeImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlTdeImportOptions; + + /** + * Decodes a SqlTdeImportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlTdeImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlTdeImportOptions; + + /** + * Verifies a SqlTdeImportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlTdeImportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlTdeImportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlTdeImportOptions; + + /** + * Creates a plain object from a SqlTdeImportOptions message. Also converts values to other types if specified. + * @param message SqlTdeImportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ImportContext.SqlTdeImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlTdeImportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlTdeImportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** BakType enum. */ + enum BakType { + BAK_TYPE_UNSPECIFIED = 0, + FULL = 1, + DIFF = 2, + TLOG = 3 + } + + /** Properties of an IpConfiguration. */ + interface IIpConfiguration { + + /** IpConfiguration ipv4Enabled */ + ipv4Enabled?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration privateNetwork */ + privateNetwork?: (string|null); + + /** IpConfiguration requireSsl */ + requireSsl?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration authorizedNetworks */ + authorizedNetworks?: (google.cloud.sql.v1.IAclEntry[]|null); + + /** IpConfiguration allocatedIpRange */ + allocatedIpRange?: (string|null); + + /** IpConfiguration enablePrivatePathForGoogleCloudServices */ + enablePrivatePathForGoogleCloudServices?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration sslMode */ + sslMode?: (google.cloud.sql.v1.IpConfiguration.SslMode|keyof typeof google.cloud.sql.v1.IpConfiguration.SslMode|null); + + /** IpConfiguration pscConfig */ + pscConfig?: (google.cloud.sql.v1.IPscConfig|null); + + /** IpConfiguration serverCaMode */ + serverCaMode?: (google.cloud.sql.v1.IpConfiguration.CaMode|keyof typeof google.cloud.sql.v1.IpConfiguration.CaMode|null); + + /** IpConfiguration customSubjectAlternativeNames */ + customSubjectAlternativeNames?: (string[]|null); + + /** IpConfiguration serverCaPool */ + serverCaPool?: (string|null); + + /** IpConfiguration serverCertificateRotationMode */ + serverCertificateRotationMode?: (google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|keyof typeof google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|null); + } + + /** Represents an IpConfiguration. */ + class IpConfiguration implements IIpConfiguration { + + /** + * Constructs a new IpConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IIpConfiguration); + + /** IpConfiguration ipv4Enabled. */ + public ipv4Enabled?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration privateNetwork. */ + public privateNetwork: string; + + /** IpConfiguration requireSsl. */ + public requireSsl?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration authorizedNetworks. */ + public authorizedNetworks: google.cloud.sql.v1.IAclEntry[]; + + /** IpConfiguration allocatedIpRange. */ + public allocatedIpRange: string; + + /** IpConfiguration enablePrivatePathForGoogleCloudServices. */ + public enablePrivatePathForGoogleCloudServices?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration sslMode. */ + public sslMode: (google.cloud.sql.v1.IpConfiguration.SslMode|keyof typeof google.cloud.sql.v1.IpConfiguration.SslMode); + + /** IpConfiguration pscConfig. */ + public pscConfig?: (google.cloud.sql.v1.IPscConfig|null); + + /** IpConfiguration serverCaMode. */ + public serverCaMode?: (google.cloud.sql.v1.IpConfiguration.CaMode|keyof typeof google.cloud.sql.v1.IpConfiguration.CaMode|null); + + /** IpConfiguration customSubjectAlternativeNames. */ + public customSubjectAlternativeNames: string[]; + + /** IpConfiguration serverCaPool. */ + public serverCaPool?: (string|null); + + /** IpConfiguration serverCertificateRotationMode. */ + public serverCertificateRotationMode?: (google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|keyof typeof google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|null); + + /** + * Creates a new IpConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns IpConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1.IIpConfiguration): google.cloud.sql.v1.IpConfiguration; + + /** + * Encodes the specified IpConfiguration message. Does not implicitly {@link google.cloud.sql.v1.IpConfiguration.verify|verify} messages. + * @param message IpConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IIpConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IpConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.IpConfiguration.verify|verify} messages. + * @param message IpConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IIpConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IpConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IpConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.IpConfiguration; + + /** + * Decodes an IpConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IpConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.IpConfiguration; + + /** + * Verifies an IpConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IpConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IpConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.IpConfiguration; + + /** + * Creates a plain object from an IpConfiguration message. Also converts values to other types if specified. + * @param message IpConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.IpConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IpConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IpConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace IpConfiguration { + + /** SslMode enum. */ + enum SslMode { + SSL_MODE_UNSPECIFIED = 0, + ALLOW_UNENCRYPTED_AND_ENCRYPTED = 1, + ENCRYPTED_ONLY = 2, + TRUSTED_CLIENT_CERTIFICATE_REQUIRED = 3 + } + + /** CaMode enum. */ + enum CaMode { + CA_MODE_UNSPECIFIED = 0, + GOOGLE_MANAGED_INTERNAL_CA = 1, + GOOGLE_MANAGED_CAS_CA = 2, + CUSTOMER_MANAGED_CAS_CA = 3 + } + + /** ServerCertificateRotationMode enum. */ + enum ServerCertificateRotationMode { + SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED = 0, + NO_AUTOMATIC_ROTATION = 1, + AUTOMATIC_ROTATION_DURING_MAINTENANCE = 2 + } + } + + /** Properties of a PscConfig. */ + interface IPscConfig { + + /** PscConfig pscEnabled */ + pscEnabled?: (boolean|null); + + /** PscConfig allowedConsumerProjects */ + allowedConsumerProjects?: (string[]|null); + + /** PscConfig pscAutoConnections */ + pscAutoConnections?: (google.cloud.sql.v1.IPscAutoConnectionConfig[]|null); + + /** PscConfig networkAttachmentUri */ + networkAttachmentUri?: (string|null); + + /** PscConfig pscAutoDnsEnabled */ + pscAutoDnsEnabled?: (boolean|null); + + /** PscConfig pscWriteEndpointDnsEnabled */ + pscWriteEndpointDnsEnabled?: (boolean|null); + } + + /** Represents a PscConfig. */ + class PscConfig implements IPscConfig { + + /** + * Constructs a new PscConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IPscConfig); + + /** PscConfig pscEnabled. */ + public pscEnabled?: (boolean|null); + + /** PscConfig allowedConsumerProjects. */ + public allowedConsumerProjects: string[]; + + /** PscConfig pscAutoConnections. */ + public pscAutoConnections: google.cloud.sql.v1.IPscAutoConnectionConfig[]; + + /** PscConfig networkAttachmentUri. */ + public networkAttachmentUri: string; + + /** PscConfig pscAutoDnsEnabled. */ + public pscAutoDnsEnabled?: (boolean|null); + + /** PscConfig pscWriteEndpointDnsEnabled. */ + public pscWriteEndpointDnsEnabled?: (boolean|null); + + /** + * Creates a new PscConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns PscConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IPscConfig): google.cloud.sql.v1.PscConfig; + + /** + * Encodes the specified PscConfig message. Does not implicitly {@link google.cloud.sql.v1.PscConfig.verify|verify} messages. + * @param message PscConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IPscConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PscConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PscConfig.verify|verify} messages. + * @param message PscConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IPscConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PscConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PscConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PscConfig; + + /** + * Decodes a PscConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PscConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PscConfig; + + /** + * Verifies a PscConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PscConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PscConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PscConfig; + + /** + * Creates a plain object from a PscConfig message. Also converts values to other types if specified. + * @param message PscConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.PscConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PscConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PscConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PscAutoConnectionConfig. */ + interface IPscAutoConnectionConfig { + + /** PscAutoConnectionConfig consumerProject */ + consumerProject?: (string|null); + + /** PscAutoConnectionConfig consumerNetwork */ + consumerNetwork?: (string|null); + + /** PscAutoConnectionConfig ipAddress */ + ipAddress?: (string|null); + + /** PscAutoConnectionConfig status */ + status?: (string|null); + + /** PscAutoConnectionConfig consumerNetworkStatus */ + consumerNetworkStatus?: (string|null); + } + + /** Represents a PscAutoConnectionConfig. */ + class PscAutoConnectionConfig implements IPscAutoConnectionConfig { + + /** + * Constructs a new PscAutoConnectionConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IPscAutoConnectionConfig); + + /** PscAutoConnectionConfig consumerProject. */ + public consumerProject: string; + + /** PscAutoConnectionConfig consumerNetwork. */ + public consumerNetwork: string; + + /** PscAutoConnectionConfig ipAddress. */ + public ipAddress?: (string|null); + + /** PscAutoConnectionConfig status. */ + public status?: (string|null); + + /** PscAutoConnectionConfig consumerNetworkStatus. */ + public consumerNetworkStatus?: (string|null); + + /** + * Creates a new PscAutoConnectionConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns PscAutoConnectionConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IPscAutoConnectionConfig): google.cloud.sql.v1.PscAutoConnectionConfig; + + /** + * Encodes the specified PscAutoConnectionConfig message. Does not implicitly {@link google.cloud.sql.v1.PscAutoConnectionConfig.verify|verify} messages. + * @param message PscAutoConnectionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IPscAutoConnectionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PscAutoConnectionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PscAutoConnectionConfig.verify|verify} messages. + * @param message PscAutoConnectionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IPscAutoConnectionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PscAutoConnectionConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PscAutoConnectionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PscAutoConnectionConfig; + + /** + * Decodes a PscAutoConnectionConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PscAutoConnectionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PscAutoConnectionConfig; + + /** + * Verifies a PscAutoConnectionConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PscAutoConnectionConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PscAutoConnectionConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PscAutoConnectionConfig; + + /** + * Creates a plain object from a PscAutoConnectionConfig message. Also converts values to other types if specified. + * @param message PscAutoConnectionConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.PscAutoConnectionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PscAutoConnectionConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PscAutoConnectionConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LocationPreference. */ + interface ILocationPreference { + + /** LocationPreference followGaeApplication */ + followGaeApplication?: (string|null); + + /** LocationPreference zone */ + zone?: (string|null); + + /** LocationPreference secondaryZone */ + secondaryZone?: (string|null); + + /** LocationPreference kind */ + kind?: (string|null); + } + + /** Represents a LocationPreference. */ + class LocationPreference implements ILocationPreference { + + /** + * Constructs a new LocationPreference. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ILocationPreference); + + /** LocationPreference followGaeApplication. */ + public followGaeApplication: string; + + /** LocationPreference zone. */ + public zone: string; + + /** LocationPreference secondaryZone. */ + public secondaryZone: string; + + /** LocationPreference kind. */ + public kind: string; + + /** + * Creates a new LocationPreference instance using the specified properties. + * @param [properties] Properties to set + * @returns LocationPreference instance + */ + public static create(properties?: google.cloud.sql.v1.ILocationPreference): google.cloud.sql.v1.LocationPreference; + + /** + * Encodes the specified LocationPreference message. Does not implicitly {@link google.cloud.sql.v1.LocationPreference.verify|verify} messages. + * @param message LocationPreference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ILocationPreference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocationPreference message, length delimited. Does not implicitly {@link google.cloud.sql.v1.LocationPreference.verify|verify} messages. + * @param message LocationPreference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ILocationPreference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocationPreference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocationPreference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.LocationPreference; + + /** + * Decodes a LocationPreference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocationPreference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.LocationPreference; + + /** + * Verifies a LocationPreference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocationPreference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocationPreference + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.LocationPreference; + + /** + * Creates a plain object from a LocationPreference message. Also converts values to other types if specified. + * @param message LocationPreference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.LocationPreference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocationPreference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LocationPreference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MaintenanceWindow. */ + interface IMaintenanceWindow { + + /** MaintenanceWindow hour */ + hour?: (google.protobuf.IInt32Value|null); + + /** MaintenanceWindow day */ + day?: (google.protobuf.IInt32Value|null); + + /** MaintenanceWindow updateTrack */ + updateTrack?: (google.cloud.sql.v1.SqlUpdateTrack|keyof typeof google.cloud.sql.v1.SqlUpdateTrack|null); + + /** MaintenanceWindow kind */ + kind?: (string|null); + } + + /** Represents a MaintenanceWindow. */ + class MaintenanceWindow implements IMaintenanceWindow { + + /** + * Constructs a new MaintenanceWindow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IMaintenanceWindow); + + /** MaintenanceWindow hour. */ + public hour?: (google.protobuf.IInt32Value|null); + + /** MaintenanceWindow day. */ + public day?: (google.protobuf.IInt32Value|null); + + /** MaintenanceWindow updateTrack. */ + public updateTrack: (google.cloud.sql.v1.SqlUpdateTrack|keyof typeof google.cloud.sql.v1.SqlUpdateTrack); + + /** MaintenanceWindow kind. */ + public kind: string; + + /** + * Creates a new MaintenanceWindow instance using the specified properties. + * @param [properties] Properties to set + * @returns MaintenanceWindow instance + */ + public static create(properties?: google.cloud.sql.v1.IMaintenanceWindow): google.cloud.sql.v1.MaintenanceWindow; + + /** + * Encodes the specified MaintenanceWindow message. Does not implicitly {@link google.cloud.sql.v1.MaintenanceWindow.verify|verify} messages. + * @param message MaintenanceWindow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IMaintenanceWindow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MaintenanceWindow message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MaintenanceWindow.verify|verify} messages. + * @param message MaintenanceWindow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IMaintenanceWindow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MaintenanceWindow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MaintenanceWindow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.MaintenanceWindow; + + /** + * Decodes a MaintenanceWindow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MaintenanceWindow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.MaintenanceWindow; + + /** + * Verifies a MaintenanceWindow message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MaintenanceWindow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MaintenanceWindow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.MaintenanceWindow; + + /** + * Creates a plain object from a MaintenanceWindow message. Also converts values to other types if specified. + * @param message MaintenanceWindow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.MaintenanceWindow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MaintenanceWindow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MaintenanceWindow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DenyMaintenancePeriod. */ + interface IDenyMaintenancePeriod { + + /** DenyMaintenancePeriod startDate */ + startDate?: (string|null); + + /** DenyMaintenancePeriod endDate */ + endDate?: (string|null); + + /** DenyMaintenancePeriod time */ + time?: (string|null); + } + + /** Represents a DenyMaintenancePeriod. */ + class DenyMaintenancePeriod implements IDenyMaintenancePeriod { + + /** + * Constructs a new DenyMaintenancePeriod. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDenyMaintenancePeriod); + + /** DenyMaintenancePeriod startDate. */ + public startDate: string; + + /** DenyMaintenancePeriod endDate. */ + public endDate: string; + + /** DenyMaintenancePeriod time. */ + public time: string; + + /** + * Creates a new DenyMaintenancePeriod instance using the specified properties. + * @param [properties] Properties to set + * @returns DenyMaintenancePeriod instance + */ + public static create(properties?: google.cloud.sql.v1.IDenyMaintenancePeriod): google.cloud.sql.v1.DenyMaintenancePeriod; + + /** + * Encodes the specified DenyMaintenancePeriod message. Does not implicitly {@link google.cloud.sql.v1.DenyMaintenancePeriod.verify|verify} messages. + * @param message DenyMaintenancePeriod message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDenyMaintenancePeriod, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DenyMaintenancePeriod message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DenyMaintenancePeriod.verify|verify} messages. + * @param message DenyMaintenancePeriod message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDenyMaintenancePeriod, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DenyMaintenancePeriod message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DenyMaintenancePeriod + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DenyMaintenancePeriod; + + /** + * Decodes a DenyMaintenancePeriod message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DenyMaintenancePeriod + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DenyMaintenancePeriod; + + /** + * Verifies a DenyMaintenancePeriod message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DenyMaintenancePeriod message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DenyMaintenancePeriod + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DenyMaintenancePeriod; + + /** + * Creates a plain object from a DenyMaintenancePeriod message. Also converts values to other types if specified. + * @param message DenyMaintenancePeriod + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DenyMaintenancePeriod, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DenyMaintenancePeriod to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DenyMaintenancePeriod + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InsightsConfig. */ + interface IInsightsConfig { + + /** InsightsConfig queryInsightsEnabled */ + queryInsightsEnabled?: (boolean|null); + + /** InsightsConfig recordClientAddress */ + recordClientAddress?: (boolean|null); + + /** InsightsConfig recordApplicationTags */ + recordApplicationTags?: (boolean|null); + + /** InsightsConfig queryStringLength */ + queryStringLength?: (google.protobuf.IInt32Value|null); + + /** InsightsConfig queryPlansPerMinute */ + queryPlansPerMinute?: (google.protobuf.IInt32Value|null); + + /** InsightsConfig enhancedQueryInsightsEnabled */ + enhancedQueryInsightsEnabled?: (google.protobuf.IBoolValue|null); + } + + /** Represents an InsightsConfig. */ + class InsightsConfig implements IInsightsConfig { + + /** + * Constructs a new InsightsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInsightsConfig); + + /** InsightsConfig queryInsightsEnabled. */ + public queryInsightsEnabled: boolean; + + /** InsightsConfig recordClientAddress. */ + public recordClientAddress: boolean; + + /** InsightsConfig recordApplicationTags. */ + public recordApplicationTags: boolean; + + /** InsightsConfig queryStringLength. */ + public queryStringLength?: (google.protobuf.IInt32Value|null); + + /** InsightsConfig queryPlansPerMinute. */ + public queryPlansPerMinute?: (google.protobuf.IInt32Value|null); + + /** InsightsConfig enhancedQueryInsightsEnabled. */ + public enhancedQueryInsightsEnabled?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new InsightsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InsightsConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IInsightsConfig): google.cloud.sql.v1.InsightsConfig; + + /** + * Encodes the specified InsightsConfig message. Does not implicitly {@link google.cloud.sql.v1.InsightsConfig.verify|verify} messages. + * @param message InsightsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInsightsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InsightsConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InsightsConfig.verify|verify} messages. + * @param message InsightsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInsightsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InsightsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InsightsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InsightsConfig; + + /** + * Decodes an InsightsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InsightsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InsightsConfig; + + /** + * Verifies an InsightsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InsightsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InsightsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InsightsConfig; + + /** + * Creates a plain object from an InsightsConfig message. Also converts values to other types if specified. + * @param message InsightsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InsightsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InsightsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InsightsConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MySqlReplicaConfiguration. */ + interface IMySqlReplicaConfiguration { + + /** MySqlReplicaConfiguration dumpFilePath */ + dumpFilePath?: (string|null); + + /** MySqlReplicaConfiguration username */ + username?: (string|null); + + /** MySqlReplicaConfiguration password */ + password?: (string|null); + + /** MySqlReplicaConfiguration connectRetryInterval */ + connectRetryInterval?: (google.protobuf.IInt32Value|null); + + /** MySqlReplicaConfiguration masterHeartbeatPeriod */ + masterHeartbeatPeriod?: (google.protobuf.IInt64Value|null); + + /** MySqlReplicaConfiguration caCertificate */ + caCertificate?: (string|null); + + /** MySqlReplicaConfiguration clientCertificate */ + clientCertificate?: (string|null); + + /** MySqlReplicaConfiguration clientKey */ + clientKey?: (string|null); + + /** MySqlReplicaConfiguration sslCipher */ + sslCipher?: (string|null); + + /** MySqlReplicaConfiguration verifyServerCertificate */ + verifyServerCertificate?: (google.protobuf.IBoolValue|null); + + /** MySqlReplicaConfiguration kind */ + kind?: (string|null); + } + + /** Represents a MySqlReplicaConfiguration. */ + class MySqlReplicaConfiguration implements IMySqlReplicaConfiguration { + + /** + * Constructs a new MySqlReplicaConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IMySqlReplicaConfiguration); + + /** MySqlReplicaConfiguration dumpFilePath. */ + public dumpFilePath: string; + + /** MySqlReplicaConfiguration username. */ + public username: string; + + /** MySqlReplicaConfiguration password. */ + public password: string; + + /** MySqlReplicaConfiguration connectRetryInterval. */ + public connectRetryInterval?: (google.protobuf.IInt32Value|null); + + /** MySqlReplicaConfiguration masterHeartbeatPeriod. */ + public masterHeartbeatPeriod?: (google.protobuf.IInt64Value|null); + + /** MySqlReplicaConfiguration caCertificate. */ + public caCertificate: string; + + /** MySqlReplicaConfiguration clientCertificate. */ + public clientCertificate: string; + + /** MySqlReplicaConfiguration clientKey. */ + public clientKey: string; + + /** MySqlReplicaConfiguration sslCipher. */ + public sslCipher: string; + + /** MySqlReplicaConfiguration verifyServerCertificate. */ + public verifyServerCertificate?: (google.protobuf.IBoolValue|null); + + /** MySqlReplicaConfiguration kind. */ + public kind: string; + + /** + * Creates a new MySqlReplicaConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns MySqlReplicaConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1.IMySqlReplicaConfiguration): google.cloud.sql.v1.MySqlReplicaConfiguration; + + /** + * Encodes the specified MySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.MySqlReplicaConfiguration.verify|verify} messages. + * @param message MySqlReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MySqlReplicaConfiguration.verify|verify} messages. + * @param message MySqlReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.MySqlReplicaConfiguration; + + /** + * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.MySqlReplicaConfiguration; + + /** + * Verifies a MySqlReplicaConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MySqlReplicaConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.MySqlReplicaConfiguration; + + /** + * Creates a plain object from a MySqlReplicaConfiguration message. Also converts values to other types if specified. + * @param message MySqlReplicaConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.MySqlReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MySqlReplicaConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MySqlReplicaConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DiskEncryptionConfiguration. */ + interface IDiskEncryptionConfiguration { + + /** DiskEncryptionConfiguration kmsKeyName */ + kmsKeyName?: (string|null); + + /** DiskEncryptionConfiguration kind */ + kind?: (string|null); + } + + /** Represents a DiskEncryptionConfiguration. */ + class DiskEncryptionConfiguration implements IDiskEncryptionConfiguration { + + /** + * Constructs a new DiskEncryptionConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDiskEncryptionConfiguration); + + /** DiskEncryptionConfiguration kmsKeyName. */ + public kmsKeyName: string; + + /** DiskEncryptionConfiguration kind. */ + public kind: string; + + /** + * Creates a new DiskEncryptionConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns DiskEncryptionConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1.IDiskEncryptionConfiguration): google.cloud.sql.v1.DiskEncryptionConfiguration; + + /** + * Encodes the specified DiskEncryptionConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionConfiguration.verify|verify} messages. + * @param message DiskEncryptionConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDiskEncryptionConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DiskEncryptionConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionConfiguration.verify|verify} messages. + * @param message DiskEncryptionConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDiskEncryptionConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DiskEncryptionConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DiskEncryptionConfiguration; + + /** + * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DiskEncryptionConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DiskEncryptionConfiguration; + + /** + * Verifies a DiskEncryptionConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DiskEncryptionConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DiskEncryptionConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DiskEncryptionConfiguration; + + /** + * Creates a plain object from a DiskEncryptionConfiguration message. Also converts values to other types if specified. + * @param message DiskEncryptionConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DiskEncryptionConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DiskEncryptionConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DiskEncryptionConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DiskEncryptionStatus. */ + interface IDiskEncryptionStatus { + + /** DiskEncryptionStatus kmsKeyVersionName */ + kmsKeyVersionName?: (string|null); + + /** DiskEncryptionStatus kind */ + kind?: (string|null); + } + + /** Represents a DiskEncryptionStatus. */ + class DiskEncryptionStatus implements IDiskEncryptionStatus { + + /** + * Constructs a new DiskEncryptionStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDiskEncryptionStatus); + + /** DiskEncryptionStatus kmsKeyVersionName. */ + public kmsKeyVersionName: string; + + /** DiskEncryptionStatus kind. */ + public kind: string; + + /** + * Creates a new DiskEncryptionStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns DiskEncryptionStatus instance + */ + public static create(properties?: google.cloud.sql.v1.IDiskEncryptionStatus): google.cloud.sql.v1.DiskEncryptionStatus; + + /** + * Encodes the specified DiskEncryptionStatus message. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionStatus.verify|verify} messages. + * @param message DiskEncryptionStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDiskEncryptionStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DiskEncryptionStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionStatus.verify|verify} messages. + * @param message DiskEncryptionStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDiskEncryptionStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DiskEncryptionStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DiskEncryptionStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DiskEncryptionStatus; + + /** + * Decodes a DiskEncryptionStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DiskEncryptionStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DiskEncryptionStatus; + + /** + * Verifies a DiskEncryptionStatus message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DiskEncryptionStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DiskEncryptionStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DiskEncryptionStatus; + + /** + * Creates a plain object from a DiskEncryptionStatus message. Also converts values to other types if specified. + * @param message DiskEncryptionStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DiskEncryptionStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DiskEncryptionStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DiskEncryptionStatus + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an IpMapping. */ + interface IIpMapping { + + /** IpMapping type */ + type?: (google.cloud.sql.v1.SqlIpAddressType|keyof typeof google.cloud.sql.v1.SqlIpAddressType|null); + + /** IpMapping ipAddress */ + ipAddress?: (string|null); + + /** IpMapping timeToRetire */ + timeToRetire?: (google.protobuf.ITimestamp|null); + } + + /** Represents an IpMapping. */ + class IpMapping implements IIpMapping { + + /** + * Constructs a new IpMapping. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IIpMapping); + + /** IpMapping type. */ + public type: (google.cloud.sql.v1.SqlIpAddressType|keyof typeof google.cloud.sql.v1.SqlIpAddressType); + + /** IpMapping ipAddress. */ + public ipAddress: string; + + /** IpMapping timeToRetire. */ + public timeToRetire?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new IpMapping instance using the specified properties. + * @param [properties] Properties to set + * @returns IpMapping instance + */ + public static create(properties?: google.cloud.sql.v1.IIpMapping): google.cloud.sql.v1.IpMapping; + + /** + * Encodes the specified IpMapping message. Does not implicitly {@link google.cloud.sql.v1.IpMapping.verify|verify} messages. + * @param message IpMapping message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IIpMapping, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IpMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1.IpMapping.verify|verify} messages. + * @param message IpMapping message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IIpMapping, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IpMapping message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IpMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.IpMapping; + + /** + * Decodes an IpMapping message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IpMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.IpMapping; + + /** + * Verifies an IpMapping message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IpMapping message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IpMapping + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.IpMapping; + + /** + * Creates a plain object from an IpMapping message. Also converts values to other types if specified. + * @param message IpMapping + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.IpMapping, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IpMapping to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IpMapping + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlMaintenanceType enum. */ + enum SqlMaintenanceType { + SQL_MAINTENANCE_TYPE_UNSPECIFIED = 0, + INSTANCE_MAINTENANCE = 1, + REPLICA_INCLUDED_MAINTENANCE = 2, + INSTANCE_SELF_SERVICE_MAINTENANCE = 3, + REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE = 4 + } + + /** Properties of a SqlSubOperationType. */ + interface ISqlSubOperationType { + + /** SqlSubOperationType maintenanceType */ + maintenanceType?: (google.cloud.sql.v1.SqlMaintenanceType|keyof typeof google.cloud.sql.v1.SqlMaintenanceType|null); + } + + /** Represents a SqlSubOperationType. */ + class SqlSubOperationType implements ISqlSubOperationType { + + /** + * Constructs a new SqlSubOperationType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlSubOperationType); + + /** SqlSubOperationType maintenanceType. */ + public maintenanceType?: (google.cloud.sql.v1.SqlMaintenanceType|keyof typeof google.cloud.sql.v1.SqlMaintenanceType|null); + + /** SqlSubOperationType subOperationDetails. */ + public subOperationDetails?: "maintenanceType"; + + /** + * Creates a new SqlSubOperationType instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlSubOperationType instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlSubOperationType): google.cloud.sql.v1.SqlSubOperationType; + + /** + * Encodes the specified SqlSubOperationType message. Does not implicitly {@link google.cloud.sql.v1.SqlSubOperationType.verify|verify} messages. + * @param message SqlSubOperationType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlSubOperationType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlSubOperationType message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSubOperationType.verify|verify} messages. + * @param message SqlSubOperationType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlSubOperationType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlSubOperationType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlSubOperationType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlSubOperationType; + + /** + * Decodes a SqlSubOperationType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlSubOperationType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlSubOperationType; + + /** + * Verifies a SqlSubOperationType message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlSubOperationType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlSubOperationType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlSubOperationType; + + /** + * Creates a plain object from a SqlSubOperationType message. Also converts values to other types if specified. + * @param message SqlSubOperationType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlSubOperationType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlSubOperationType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlSubOperationType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Operation. */ + interface IOperation { + + /** Operation kind */ + kind?: (string|null); + + /** Operation targetLink */ + targetLink?: (string|null); + + /** Operation status */ + status?: (google.cloud.sql.v1.Operation.SqlOperationStatus|keyof typeof google.cloud.sql.v1.Operation.SqlOperationStatus|null); + + /** Operation user */ + user?: (string|null); + + /** Operation insertTime */ + insertTime?: (google.protobuf.ITimestamp|null); + + /** Operation startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** Operation endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** Operation error */ + error?: (google.cloud.sql.v1.IOperationErrors|null); + + /** Operation apiWarning */ + apiWarning?: (google.cloud.sql.v1.IApiWarning|null); + + /** Operation operationType */ + operationType?: (google.cloud.sql.v1.Operation.SqlOperationType|keyof typeof google.cloud.sql.v1.Operation.SqlOperationType|null); + + /** Operation importContext */ + importContext?: (google.cloud.sql.v1.IImportContext|null); + + /** Operation exportContext */ + exportContext?: (google.cloud.sql.v1.IExportContext|null); + + /** Operation backupContext */ + backupContext?: (google.cloud.sql.v1.IBackupContext|null); + + /** Operation preCheckMajorVersionUpgradeContext */ + preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null); + + /** Operation name */ + name?: (string|null); + + /** Operation targetId */ + targetId?: (string|null); + + /** Operation selfLink */ + selfLink?: (string|null); + + /** Operation targetProject */ + targetProject?: (string|null); + + /** Operation acquireSsrsLeaseContext */ + acquireSsrsLeaseContext?: (google.cloud.sql.v1.IAcquireSsrsLeaseContext|null); + + /** Operation subOperationType */ + subOperationType?: (google.cloud.sql.v1.ISqlSubOperationType|null); + } + + /** Represents an Operation. */ + class Operation implements IOperation { + + /** + * Constructs a new Operation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IOperation); + + /** Operation kind. */ + public kind: string; + + /** Operation targetLink. */ + public targetLink: string; + + /** Operation status. */ + public status: (google.cloud.sql.v1.Operation.SqlOperationStatus|keyof typeof google.cloud.sql.v1.Operation.SqlOperationStatus); + + /** Operation user. */ + public user: string; + + /** Operation insertTime. */ + public insertTime?: (google.protobuf.ITimestamp|null); + + /** Operation startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** Operation endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** Operation error. */ + public error?: (google.cloud.sql.v1.IOperationErrors|null); + + /** Operation apiWarning. */ + public apiWarning?: (google.cloud.sql.v1.IApiWarning|null); + + /** Operation operationType. */ + public operationType: (google.cloud.sql.v1.Operation.SqlOperationType|keyof typeof google.cloud.sql.v1.Operation.SqlOperationType); + + /** Operation importContext. */ + public importContext?: (google.cloud.sql.v1.IImportContext|null); + + /** Operation exportContext. */ + public exportContext?: (google.cloud.sql.v1.IExportContext|null); + + /** Operation backupContext. */ + public backupContext?: (google.cloud.sql.v1.IBackupContext|null); + + /** Operation preCheckMajorVersionUpgradeContext. */ + public preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null); + + /** Operation name. */ + public name: string; + + /** Operation targetId. */ + public targetId: string; + + /** Operation selfLink. */ + public selfLink: string; + + /** Operation targetProject. */ + public targetProject: string; + + /** Operation acquireSsrsLeaseContext. */ + public acquireSsrsLeaseContext?: (google.cloud.sql.v1.IAcquireSsrsLeaseContext|null); + + /** Operation subOperationType. */ + public subOperationType?: (google.cloud.sql.v1.ISqlSubOperationType|null); + + /** + * Creates a new Operation instance using the specified properties. + * @param [properties] Properties to set + * @returns Operation instance + */ + public static create(properties?: google.cloud.sql.v1.IOperation): google.cloud.sql.v1.Operation; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.cloud.sql.v1.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Operation; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Operation; + + /** + * Verifies an Operation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Operation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Operation; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @param message Operation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Operation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Operation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Operation { + + /** SqlOperationType enum. */ + enum SqlOperationType { + SQL_OPERATION_TYPE_UNSPECIFIED = 0, + IMPORT = 1, + EXPORT = 2, + CREATE = 3, + UPDATE = 4, + DELETE = 5, + RESTART = 6, + BACKUP = 7, + SNAPSHOT = 8, + BACKUP_VOLUME = 9, + DELETE_VOLUME = 10, + RESTORE_VOLUME = 11, + INJECT_USER = 12, + CLONE = 14, + STOP_REPLICA = 15, + START_REPLICA = 16, + PROMOTE_REPLICA = 17, + CREATE_REPLICA = 18, + CREATE_USER = 19, + DELETE_USER = 20, + UPDATE_USER = 21, + CREATE_DATABASE = 22, + DELETE_DATABASE = 23, + UPDATE_DATABASE = 24, + FAILOVER = 25, + DELETE_BACKUP = 26, + RECREATE_REPLICA = 27, + TRUNCATE_LOG = 28, + DEMOTE_MASTER = 29, + MAINTENANCE = 30, + ENABLE_PRIVATE_IP = 31, + DEFER_MAINTENANCE = 32, + CREATE_CLONE = 33, + RESCHEDULE_MAINTENANCE = 34, + START_EXTERNAL_SYNC = 35, + LOG_CLEANUP = 36, + AUTO_RESTART = 37, + REENCRYPT = 38, + SWITCHOVER = 39, + UPDATE_BACKUP = 40, + ACQUIRE_SSRS_LEASE = 42, + RELEASE_SSRS_LEASE = 43, + RECONFIGURE_OLD_PRIMARY = 44, + CLUSTER_MAINTENANCE = 45, + SELF_SERVICE_MAINTENANCE = 46, + SWITCHOVER_TO_REPLICA = 47, + MAJOR_VERSION_UPGRADE = 48, + ADVANCED_BACKUP = 49, + MANAGE_BACKUP = 50, + ENHANCED_BACKUP = 51, + REPAIR_READ_POOL = 52, + CREATE_READ_POOL = 53, + PRE_CHECK_MAJOR_VERSION_UPGRADE = 54 + } + + /** SqlOperationStatus enum. */ + enum SqlOperationStatus { + SQL_OPERATION_STATUS_UNSPECIFIED = 0, + PENDING = 1, + RUNNING = 2, + DONE = 3 + } + } + + /** Properties of an OperationError. */ + interface IOperationError { + + /** OperationError kind */ + kind?: (string|null); + + /** OperationError code */ + code?: (string|null); + + /** OperationError message */ + message?: (string|null); + } + + /** Represents an OperationError. */ + class OperationError implements IOperationError { + + /** + * Constructs a new OperationError. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IOperationError); + + /** OperationError kind. */ + public kind: string; + + /** OperationError code. */ + public code: string; + + /** OperationError message. */ + public message: string; + + /** + * Creates a new OperationError instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationError instance + */ + public static create(properties?: google.cloud.sql.v1.IOperationError): google.cloud.sql.v1.OperationError; + + /** + * Encodes the specified OperationError message. Does not implicitly {@link google.cloud.sql.v1.OperationError.verify|verify} messages. + * @param message OperationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationError.verify|verify} messages. + * @param message OperationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.OperationError; + + /** + * Decodes an OperationError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.OperationError; + + /** + * Verifies an OperationError message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationError + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.OperationError; + + /** + * Creates a plain object from an OperationError message. Also converts values to other types if specified. + * @param message OperationError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.OperationError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OperationErrors. */ + interface IOperationErrors { + + /** OperationErrors kind */ + kind?: (string|null); + + /** OperationErrors errors */ + errors?: (google.cloud.sql.v1.IOperationError[]|null); + } + + /** Represents an OperationErrors. */ + class OperationErrors implements IOperationErrors { + + /** + * Constructs a new OperationErrors. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IOperationErrors); + + /** OperationErrors kind. */ + public kind: string; + + /** OperationErrors errors. */ + public errors: google.cloud.sql.v1.IOperationError[]; + + /** + * Creates a new OperationErrors instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationErrors instance + */ + public static create(properties?: google.cloud.sql.v1.IOperationErrors): google.cloud.sql.v1.OperationErrors; + + /** + * Encodes the specified OperationErrors message. Does not implicitly {@link google.cloud.sql.v1.OperationErrors.verify|verify} messages. + * @param message OperationErrors message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IOperationErrors, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationErrors message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationErrors.verify|verify} messages. + * @param message OperationErrors message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IOperationErrors, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationErrors message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationErrors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.OperationErrors; + + /** + * Decodes an OperationErrors message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationErrors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.OperationErrors; + + /** + * Verifies an OperationErrors message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationErrors message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationErrors + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.OperationErrors; + + /** + * Creates a plain object from an OperationErrors message. Also converts values to other types if specified. + * @param message OperationErrors + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.OperationErrors, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationErrors to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationErrors + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PasswordValidationPolicy. */ + interface IPasswordValidationPolicy { + + /** PasswordValidationPolicy minLength */ + minLength?: (google.protobuf.IInt32Value|null); + + /** PasswordValidationPolicy complexity */ + complexity?: (google.cloud.sql.v1.PasswordValidationPolicy.Complexity|keyof typeof google.cloud.sql.v1.PasswordValidationPolicy.Complexity|null); + + /** PasswordValidationPolicy reuseInterval */ + reuseInterval?: (google.protobuf.IInt32Value|null); + + /** PasswordValidationPolicy disallowUsernameSubstring */ + disallowUsernameSubstring?: (google.protobuf.IBoolValue|null); + + /** PasswordValidationPolicy passwordChangeInterval */ + passwordChangeInterval?: (google.protobuf.IDuration|null); + + /** PasswordValidationPolicy enablePasswordPolicy */ + enablePasswordPolicy?: (google.protobuf.IBoolValue|null); + + /** PasswordValidationPolicy disallowCompromisedCredentials */ + disallowCompromisedCredentials?: (google.protobuf.IBoolValue|null); + } + + /** Represents a PasswordValidationPolicy. */ + class PasswordValidationPolicy implements IPasswordValidationPolicy { + + /** + * Constructs a new PasswordValidationPolicy. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IPasswordValidationPolicy); + + /** PasswordValidationPolicy minLength. */ + public minLength?: (google.protobuf.IInt32Value|null); + + /** PasswordValidationPolicy complexity. */ + public complexity: (google.cloud.sql.v1.PasswordValidationPolicy.Complexity|keyof typeof google.cloud.sql.v1.PasswordValidationPolicy.Complexity); + + /** PasswordValidationPolicy reuseInterval. */ + public reuseInterval?: (google.protobuf.IInt32Value|null); + + /** PasswordValidationPolicy disallowUsernameSubstring. */ + public disallowUsernameSubstring?: (google.protobuf.IBoolValue|null); + + /** PasswordValidationPolicy passwordChangeInterval. */ + public passwordChangeInterval?: (google.protobuf.IDuration|null); + + /** PasswordValidationPolicy enablePasswordPolicy. */ + public enablePasswordPolicy?: (google.protobuf.IBoolValue|null); + + /** PasswordValidationPolicy disallowCompromisedCredentials. */ + public disallowCompromisedCredentials?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new PasswordValidationPolicy instance using the specified properties. + * @param [properties] Properties to set + * @returns PasswordValidationPolicy instance + */ + public static create(properties?: google.cloud.sql.v1.IPasswordValidationPolicy): google.cloud.sql.v1.PasswordValidationPolicy; + + /** + * Encodes the specified PasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1.PasswordValidationPolicy.verify|verify} messages. + * @param message PasswordValidationPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PasswordValidationPolicy.verify|verify} messages. + * @param message PasswordValidationPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PasswordValidationPolicy message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PasswordValidationPolicy; + + /** + * Decodes a PasswordValidationPolicy message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PasswordValidationPolicy; + + /** + * Verifies a PasswordValidationPolicy message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PasswordValidationPolicy + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PasswordValidationPolicy; + + /** + * Creates a plain object from a PasswordValidationPolicy message. Also converts values to other types if specified. + * @param message PasswordValidationPolicy + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.PasswordValidationPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PasswordValidationPolicy to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PasswordValidationPolicy + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PasswordValidationPolicy { + + /** Complexity enum. */ + enum Complexity { + COMPLEXITY_UNSPECIFIED = 0, + COMPLEXITY_DEFAULT = 1 + } + } + + /** Properties of a DataCacheConfig. */ + interface IDataCacheConfig { + + /** DataCacheConfig dataCacheEnabled */ + dataCacheEnabled?: (boolean|null); + } + + /** Represents a DataCacheConfig. */ + class DataCacheConfig implements IDataCacheConfig { + + /** + * Constructs a new DataCacheConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDataCacheConfig); + + /** DataCacheConfig dataCacheEnabled. */ + public dataCacheEnabled: boolean; + + /** + * Creates a new DataCacheConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns DataCacheConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IDataCacheConfig): google.cloud.sql.v1.DataCacheConfig; + + /** + * Encodes the specified DataCacheConfig message. Does not implicitly {@link google.cloud.sql.v1.DataCacheConfig.verify|verify} messages. + * @param message DataCacheConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDataCacheConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DataCacheConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DataCacheConfig.verify|verify} messages. + * @param message DataCacheConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDataCacheConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DataCacheConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DataCacheConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DataCacheConfig; + + /** + * Decodes a DataCacheConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DataCacheConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DataCacheConfig; + + /** + * Verifies a DataCacheConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DataCacheConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DataCacheConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DataCacheConfig; + + /** + * Creates a plain object from a DataCacheConfig message. Also converts values to other types if specified. + * @param message DataCacheConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DataCacheConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DataCacheConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DataCacheConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FinalBackupConfig. */ + interface IFinalBackupConfig { + + /** FinalBackupConfig enabled */ + enabled?: (boolean|null); + + /** FinalBackupConfig retentionDays */ + retentionDays?: (number|null); + } + + /** Represents a FinalBackupConfig. */ + class FinalBackupConfig implements IFinalBackupConfig { + + /** + * Constructs a new FinalBackupConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IFinalBackupConfig); + + /** FinalBackupConfig enabled. */ + public enabled?: (boolean|null); + + /** FinalBackupConfig retentionDays. */ + public retentionDays?: (number|null); + + /** + * Creates a new FinalBackupConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns FinalBackupConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IFinalBackupConfig): google.cloud.sql.v1.FinalBackupConfig; + + /** + * Encodes the specified FinalBackupConfig message. Does not implicitly {@link google.cloud.sql.v1.FinalBackupConfig.verify|verify} messages. + * @param message FinalBackupConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IFinalBackupConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FinalBackupConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FinalBackupConfig.verify|verify} messages. + * @param message FinalBackupConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IFinalBackupConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FinalBackupConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FinalBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.FinalBackupConfig; + + /** + * Decodes a FinalBackupConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FinalBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.FinalBackupConfig; + + /** + * Verifies a FinalBackupConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FinalBackupConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FinalBackupConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.FinalBackupConfig; + + /** + * Creates a plain object from a FinalBackupConfig message. Also converts values to other types if specified. + * @param message FinalBackupConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.FinalBackupConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FinalBackupConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FinalBackupConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Settings. */ + interface ISettings { + + /** Settings settingsVersion */ + settingsVersion?: (google.protobuf.IInt64Value|null); + + /** Settings authorizedGaeApplications */ + authorizedGaeApplications?: (string[]|null); + + /** Settings tier */ + tier?: (string|null); + + /** Settings kind */ + kind?: (string|null); + + /** Settings userLabels */ + userLabels?: ({ [k: string]: string }|null); + + /** Settings availabilityType */ + availabilityType?: (google.cloud.sql.v1.SqlAvailabilityType|keyof typeof google.cloud.sql.v1.SqlAvailabilityType|null); + + /** Settings pricingPlan */ + pricingPlan?: (google.cloud.sql.v1.SqlPricingPlan|keyof typeof google.cloud.sql.v1.SqlPricingPlan|null); + + /** Settings replicationType */ + replicationType?: (google.cloud.sql.v1.SqlReplicationType|keyof typeof google.cloud.sql.v1.SqlReplicationType|null); + + /** Settings storageAutoResizeLimit */ + storageAutoResizeLimit?: (google.protobuf.IInt64Value|null); + + /** Settings activationPolicy */ + activationPolicy?: (google.cloud.sql.v1.Settings.SqlActivationPolicy|keyof typeof google.cloud.sql.v1.Settings.SqlActivationPolicy|null); + + /** Settings ipConfiguration */ + ipConfiguration?: (google.cloud.sql.v1.IIpConfiguration|null); + + /** Settings storageAutoResize */ + storageAutoResize?: (google.protobuf.IBoolValue|null); + + /** Settings locationPreference */ + locationPreference?: (google.cloud.sql.v1.ILocationPreference|null); + + /** Settings databaseFlags */ + databaseFlags?: (google.cloud.sql.v1.IDatabaseFlags[]|null); + + /** Settings dataDiskType */ + dataDiskType?: (google.cloud.sql.v1.SqlDataDiskType|keyof typeof google.cloud.sql.v1.SqlDataDiskType|null); + + /** Settings maintenanceWindow */ + maintenanceWindow?: (google.cloud.sql.v1.IMaintenanceWindow|null); + + /** Settings backupConfiguration */ + backupConfiguration?: (google.cloud.sql.v1.IBackupConfiguration|null); + + /** Settings databaseReplicationEnabled */ + databaseReplicationEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings crashSafeReplicationEnabled */ + crashSafeReplicationEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings dataDiskSizeGb */ + dataDiskSizeGb?: (google.protobuf.IInt64Value|null); + + /** Settings activeDirectoryConfig */ + activeDirectoryConfig?: (google.cloud.sql.v1.ISqlActiveDirectoryConfig|null); + + /** Settings collation */ + collation?: (string|null); + + /** Settings denyMaintenancePeriods */ + denyMaintenancePeriods?: (google.cloud.sql.v1.IDenyMaintenancePeriod[]|null); + + /** Settings insightsConfig */ + insightsConfig?: (google.cloud.sql.v1.IInsightsConfig|null); + + /** Settings passwordValidationPolicy */ + passwordValidationPolicy?: (google.cloud.sql.v1.IPasswordValidationPolicy|null); + + /** Settings sqlServerAuditConfig */ + sqlServerAuditConfig?: (google.cloud.sql.v1.ISqlServerAuditConfig|null); + + /** Settings edition */ + edition?: (google.cloud.sql.v1.Settings.Edition|keyof typeof google.cloud.sql.v1.Settings.Edition|null); + + /** Settings connectorEnforcement */ + connectorEnforcement?: (google.cloud.sql.v1.Settings.ConnectorEnforcement|keyof typeof google.cloud.sql.v1.Settings.ConnectorEnforcement|null); + + /** Settings deletionProtectionEnabled */ + deletionProtectionEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings timeZone */ + timeZone?: (string|null); + + /** Settings advancedMachineFeatures */ + advancedMachineFeatures?: (google.cloud.sql.v1.IAdvancedMachineFeatures|null); + + /** Settings dataCacheConfig */ + dataCacheConfig?: (google.cloud.sql.v1.IDataCacheConfig|null); + + /** Settings replicationLagMaxSeconds */ + replicationLagMaxSeconds?: (google.protobuf.IInt32Value|null); + + /** Settings enableGoogleMlIntegration */ + enableGoogleMlIntegration?: (google.protobuf.IBoolValue|null); + + /** Settings enableDataplexIntegration */ + enableDataplexIntegration?: (google.protobuf.IBoolValue|null); + + /** Settings retainBackupsOnDelete */ + retainBackupsOnDelete?: (google.protobuf.IBoolValue|null); + + /** Settings dataDiskProvisionedIops */ + dataDiskProvisionedIops?: (number|Long|string|null); + + /** Settings dataDiskProvisionedThroughput */ + dataDiskProvisionedThroughput?: (number|Long|string|null); + + /** Settings connectionPoolConfig */ + connectionPoolConfig?: (google.cloud.sql.v1.IConnectionPoolConfig|null); + + /** Settings finalBackupConfig */ + finalBackupConfig?: (google.cloud.sql.v1.IFinalBackupConfig|null); + + /** Settings readPoolAutoScaleConfig */ + readPoolAutoScaleConfig?: (google.cloud.sql.v1.IReadPoolAutoScaleConfig|null); + + /** Settings acceleratedReplicaMode */ + acceleratedReplicaMode?: (google.protobuf.IBoolValue|null); + + /** Settings autoUpgradeEnabled */ + autoUpgradeEnabled?: (boolean|null); + + /** Settings entraidConfig */ + entraidConfig?: (google.cloud.sql.v1.ISqlServerEntraIdConfig|null); + + /** Settings dataApiAccess */ + dataApiAccess?: (google.cloud.sql.v1.Settings.DataApiAccess|keyof typeof google.cloud.sql.v1.Settings.DataApiAccess|null); + + /** Settings performanceCaptureConfig */ + performanceCaptureConfig?: (google.cloud.sql.v1.IPerformanceCaptureConfig|null); + } + + /** Represents a Settings. */ + class Settings implements ISettings { + + /** + * Constructs a new Settings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISettings); + + /** Settings settingsVersion. */ + public settingsVersion?: (google.protobuf.IInt64Value|null); + + /** Settings authorizedGaeApplications. */ + public authorizedGaeApplications: string[]; + + /** Settings tier. */ + public tier: string; + + /** Settings kind. */ + public kind: string; + + /** Settings userLabels. */ + public userLabels: { [k: string]: string }; + + /** Settings availabilityType. */ + public availabilityType: (google.cloud.sql.v1.SqlAvailabilityType|keyof typeof google.cloud.sql.v1.SqlAvailabilityType); + + /** Settings pricingPlan. */ + public pricingPlan: (google.cloud.sql.v1.SqlPricingPlan|keyof typeof google.cloud.sql.v1.SqlPricingPlan); + + /** Settings replicationType. */ + public replicationType: (google.cloud.sql.v1.SqlReplicationType|keyof typeof google.cloud.sql.v1.SqlReplicationType); + + /** Settings storageAutoResizeLimit. */ + public storageAutoResizeLimit?: (google.protobuf.IInt64Value|null); + + /** Settings activationPolicy. */ + public activationPolicy: (google.cloud.sql.v1.Settings.SqlActivationPolicy|keyof typeof google.cloud.sql.v1.Settings.SqlActivationPolicy); + + /** Settings ipConfiguration. */ + public ipConfiguration?: (google.cloud.sql.v1.IIpConfiguration|null); + + /** Settings storageAutoResize. */ + public storageAutoResize?: (google.protobuf.IBoolValue|null); + + /** Settings locationPreference. */ + public locationPreference?: (google.cloud.sql.v1.ILocationPreference|null); + + /** Settings databaseFlags. */ + public databaseFlags: google.cloud.sql.v1.IDatabaseFlags[]; + + /** Settings dataDiskType. */ + public dataDiskType: (google.cloud.sql.v1.SqlDataDiskType|keyof typeof google.cloud.sql.v1.SqlDataDiskType); + + /** Settings maintenanceWindow. */ + public maintenanceWindow?: (google.cloud.sql.v1.IMaintenanceWindow|null); + + /** Settings backupConfiguration. */ + public backupConfiguration?: (google.cloud.sql.v1.IBackupConfiguration|null); + + /** Settings databaseReplicationEnabled. */ + public databaseReplicationEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings crashSafeReplicationEnabled. */ + public crashSafeReplicationEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings dataDiskSizeGb. */ + public dataDiskSizeGb?: (google.protobuf.IInt64Value|null); + + /** Settings activeDirectoryConfig. */ + public activeDirectoryConfig?: (google.cloud.sql.v1.ISqlActiveDirectoryConfig|null); + + /** Settings collation. */ + public collation: string; + + /** Settings denyMaintenancePeriods. */ + public denyMaintenancePeriods: google.cloud.sql.v1.IDenyMaintenancePeriod[]; + + /** Settings insightsConfig. */ + public insightsConfig?: (google.cloud.sql.v1.IInsightsConfig|null); + + /** Settings passwordValidationPolicy. */ + public passwordValidationPolicy?: (google.cloud.sql.v1.IPasswordValidationPolicy|null); + + /** Settings sqlServerAuditConfig. */ + public sqlServerAuditConfig?: (google.cloud.sql.v1.ISqlServerAuditConfig|null); + + /** Settings edition. */ + public edition: (google.cloud.sql.v1.Settings.Edition|keyof typeof google.cloud.sql.v1.Settings.Edition); + + /** Settings connectorEnforcement. */ + public connectorEnforcement: (google.cloud.sql.v1.Settings.ConnectorEnforcement|keyof typeof google.cloud.sql.v1.Settings.ConnectorEnforcement); + + /** Settings deletionProtectionEnabled. */ + public deletionProtectionEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings timeZone. */ + public timeZone: string; + + /** Settings advancedMachineFeatures. */ + public advancedMachineFeatures?: (google.cloud.sql.v1.IAdvancedMachineFeatures|null); + + /** Settings dataCacheConfig. */ + public dataCacheConfig?: (google.cloud.sql.v1.IDataCacheConfig|null); + + /** Settings replicationLagMaxSeconds. */ + public replicationLagMaxSeconds?: (google.protobuf.IInt32Value|null); + + /** Settings enableGoogleMlIntegration. */ + public enableGoogleMlIntegration?: (google.protobuf.IBoolValue|null); + + /** Settings enableDataplexIntegration. */ + public enableDataplexIntegration?: (google.protobuf.IBoolValue|null); + + /** Settings retainBackupsOnDelete. */ + public retainBackupsOnDelete?: (google.protobuf.IBoolValue|null); + + /** Settings dataDiskProvisionedIops. */ + public dataDiskProvisionedIops?: (number|Long|string|null); + + /** Settings dataDiskProvisionedThroughput. */ + public dataDiskProvisionedThroughput?: (number|Long|string|null); + + /** Settings connectionPoolConfig. */ + public connectionPoolConfig?: (google.cloud.sql.v1.IConnectionPoolConfig|null); + + /** Settings finalBackupConfig. */ + public finalBackupConfig?: (google.cloud.sql.v1.IFinalBackupConfig|null); + + /** Settings readPoolAutoScaleConfig. */ + public readPoolAutoScaleConfig?: (google.cloud.sql.v1.IReadPoolAutoScaleConfig|null); + + /** Settings acceleratedReplicaMode. */ + public acceleratedReplicaMode?: (google.protobuf.IBoolValue|null); + + /** Settings autoUpgradeEnabled. */ + public autoUpgradeEnabled?: (boolean|null); + + /** Settings entraidConfig. */ + public entraidConfig?: (google.cloud.sql.v1.ISqlServerEntraIdConfig|null); + + /** Settings dataApiAccess. */ + public dataApiAccess?: (google.cloud.sql.v1.Settings.DataApiAccess|keyof typeof google.cloud.sql.v1.Settings.DataApiAccess|null); + + /** Settings performanceCaptureConfig. */ + public performanceCaptureConfig?: (google.cloud.sql.v1.IPerformanceCaptureConfig|null); + + /** + * Creates a new Settings instance using the specified properties. + * @param [properties] Properties to set + * @returns Settings instance + */ + public static create(properties?: google.cloud.sql.v1.ISettings): google.cloud.sql.v1.Settings; + + /** + * Encodes the specified Settings message. Does not implicitly {@link google.cloud.sql.v1.Settings.verify|verify} messages. + * @param message Settings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Settings.verify|verify} messages. + * @param message Settings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Settings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Settings; + + /** + * Decodes a Settings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Settings; + + /** + * Verifies a Settings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Settings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Settings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Settings; + + /** + * Creates a plain object from a Settings message. Also converts values to other types if specified. + * @param message Settings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.Settings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Settings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Settings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Settings { + + /** SqlActivationPolicy enum. */ + enum SqlActivationPolicy { + SQL_ACTIVATION_POLICY_UNSPECIFIED = 0, + ALWAYS = 1, + NEVER = 2, + ON_DEMAND = 3 + } + + /** Edition enum. */ + enum Edition { + EDITION_UNSPECIFIED = 0, + ENTERPRISE = 2, + ENTERPRISE_PLUS = 3 + } + + /** ConnectorEnforcement enum. */ + enum ConnectorEnforcement { + CONNECTOR_ENFORCEMENT_UNSPECIFIED = 0, + NOT_REQUIRED = 1, + REQUIRED = 2 + } + + /** DataApiAccess enum. */ + enum DataApiAccess { + DATA_API_ACCESS_UNSPECIFIED = 0, + DISALLOW_DATA_API = 1, + ALLOW_DATA_API = 2 + } + } + + /** Properties of a PerformanceCaptureConfig. */ + interface IPerformanceCaptureConfig { + + /** PerformanceCaptureConfig enabled */ + enabled?: (boolean|null); + + /** PerformanceCaptureConfig probingIntervalSeconds */ + probingIntervalSeconds?: (number|null); + + /** PerformanceCaptureConfig probeThreshold */ + probeThreshold?: (number|null); + + /** PerformanceCaptureConfig runningThreadsThreshold */ + runningThreadsThreshold?: (number|null); + + /** PerformanceCaptureConfig secondsBehindSourceThreshold */ + secondsBehindSourceThreshold?: (number|null); + + /** PerformanceCaptureConfig transactionDurationThreshold */ + transactionDurationThreshold?: (number|null); + } + + /** Represents a PerformanceCaptureConfig. */ + class PerformanceCaptureConfig implements IPerformanceCaptureConfig { + + /** + * Constructs a new PerformanceCaptureConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IPerformanceCaptureConfig); + + /** PerformanceCaptureConfig enabled. */ + public enabled?: (boolean|null); + + /** PerformanceCaptureConfig probingIntervalSeconds. */ + public probingIntervalSeconds?: (number|null); + + /** PerformanceCaptureConfig probeThreshold. */ + public probeThreshold?: (number|null); + + /** PerformanceCaptureConfig runningThreadsThreshold. */ + public runningThreadsThreshold?: (number|null); + + /** PerformanceCaptureConfig secondsBehindSourceThreshold. */ + public secondsBehindSourceThreshold?: (number|null); + + /** PerformanceCaptureConfig transactionDurationThreshold. */ + public transactionDurationThreshold?: (number|null); + + /** + * Creates a new PerformanceCaptureConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns PerformanceCaptureConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IPerformanceCaptureConfig): google.cloud.sql.v1.PerformanceCaptureConfig; + + /** + * Encodes the specified PerformanceCaptureConfig message. Does not implicitly {@link google.cloud.sql.v1.PerformanceCaptureConfig.verify|verify} messages. + * @param message PerformanceCaptureConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IPerformanceCaptureConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PerformanceCaptureConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PerformanceCaptureConfig.verify|verify} messages. + * @param message PerformanceCaptureConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IPerformanceCaptureConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PerformanceCaptureConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PerformanceCaptureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PerformanceCaptureConfig; + + /** + * Decodes a PerformanceCaptureConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PerformanceCaptureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PerformanceCaptureConfig; + + /** + * Verifies a PerformanceCaptureConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PerformanceCaptureConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PerformanceCaptureConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PerformanceCaptureConfig; + + /** + * Creates a plain object from a PerformanceCaptureConfig message. Also converts values to other types if specified. + * @param message PerformanceCaptureConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.PerformanceCaptureConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PerformanceCaptureConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PerformanceCaptureConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ConnectionPoolFlags. */ + interface IConnectionPoolFlags { + + /** ConnectionPoolFlags name */ + name?: (string|null); + + /** ConnectionPoolFlags value */ + value?: (string|null); + } + + /** Represents a ConnectionPoolFlags. */ + class ConnectionPoolFlags implements IConnectionPoolFlags { + + /** + * Constructs a new ConnectionPoolFlags. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IConnectionPoolFlags); + + /** ConnectionPoolFlags name. */ + public name: string; + + /** ConnectionPoolFlags value. */ + public value: string; + + /** + * Creates a new ConnectionPoolFlags instance using the specified properties. + * @param [properties] Properties to set + * @returns ConnectionPoolFlags instance + */ + public static create(properties?: google.cloud.sql.v1.IConnectionPoolFlags): google.cloud.sql.v1.ConnectionPoolFlags; + + /** + * Encodes the specified ConnectionPoolFlags message. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolFlags.verify|verify} messages. + * @param message ConnectionPoolFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IConnectionPoolFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConnectionPoolFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolFlags.verify|verify} messages. + * @param message ConnectionPoolFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IConnectionPoolFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConnectionPoolFlags message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConnectionPoolFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ConnectionPoolFlags; + + /** + * Decodes a ConnectionPoolFlags message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConnectionPoolFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ConnectionPoolFlags; + + /** + * Verifies a ConnectionPoolFlags message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConnectionPoolFlags message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConnectionPoolFlags + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ConnectionPoolFlags; + + /** + * Creates a plain object from a ConnectionPoolFlags message. Also converts values to other types if specified. + * @param message ConnectionPoolFlags + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ConnectionPoolFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConnectionPoolFlags to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConnectionPoolFlags + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ConnectionPoolConfig. */ + interface IConnectionPoolConfig { + + /** ConnectionPoolConfig connectionPoolingEnabled */ + connectionPoolingEnabled?: (boolean|null); + + /** ConnectionPoolConfig flags */ + flags?: (google.cloud.sql.v1.IConnectionPoolFlags[]|null); + + /** ConnectionPoolConfig poolerCount */ + poolerCount?: (number|null); + } + + /** Represents a ConnectionPoolConfig. */ + class ConnectionPoolConfig implements IConnectionPoolConfig { + + /** + * Constructs a new ConnectionPoolConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IConnectionPoolConfig); + + /** ConnectionPoolConfig connectionPoolingEnabled. */ + public connectionPoolingEnabled?: (boolean|null); + + /** ConnectionPoolConfig flags. */ + public flags: google.cloud.sql.v1.IConnectionPoolFlags[]; + + /** ConnectionPoolConfig poolerCount. */ + public poolerCount?: (number|null); + + /** + * Creates a new ConnectionPoolConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ConnectionPoolConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IConnectionPoolConfig): google.cloud.sql.v1.ConnectionPoolConfig; + + /** + * Encodes the specified ConnectionPoolConfig message. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolConfig.verify|verify} messages. + * @param message ConnectionPoolConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IConnectionPoolConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConnectionPoolConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolConfig.verify|verify} messages. + * @param message ConnectionPoolConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IConnectionPoolConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConnectionPoolConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConnectionPoolConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ConnectionPoolConfig; + + /** + * Decodes a ConnectionPoolConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConnectionPoolConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ConnectionPoolConfig; + + /** + * Verifies a ConnectionPoolConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConnectionPoolConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConnectionPoolConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ConnectionPoolConfig; + + /** + * Creates a plain object from a ConnectionPoolConfig message. Also converts values to other types if specified. + * @param message ConnectionPoolConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ConnectionPoolConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConnectionPoolConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConnectionPoolConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReadPoolAutoScaleConfig. */ + interface IReadPoolAutoScaleConfig { + + /** ReadPoolAutoScaleConfig enabled */ + enabled?: (boolean|null); + + /** ReadPoolAutoScaleConfig minNodeCount */ + minNodeCount?: (number|null); + + /** ReadPoolAutoScaleConfig maxNodeCount */ + maxNodeCount?: (number|null); + + /** ReadPoolAutoScaleConfig targetMetrics */ + targetMetrics?: (google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric[]|null); + + /** ReadPoolAutoScaleConfig disableScaleIn */ + disableScaleIn?: (boolean|null); + + /** ReadPoolAutoScaleConfig scaleInCooldownSeconds */ + scaleInCooldownSeconds?: (number|null); + + /** ReadPoolAutoScaleConfig scaleOutCooldownSeconds */ + scaleOutCooldownSeconds?: (number|null); + } + + /** Represents a ReadPoolAutoScaleConfig. */ + class ReadPoolAutoScaleConfig implements IReadPoolAutoScaleConfig { + + /** + * Constructs a new ReadPoolAutoScaleConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IReadPoolAutoScaleConfig); + + /** ReadPoolAutoScaleConfig enabled. */ + public enabled?: (boolean|null); + + /** ReadPoolAutoScaleConfig minNodeCount. */ + public minNodeCount?: (number|null); + + /** ReadPoolAutoScaleConfig maxNodeCount. */ + public maxNodeCount?: (number|null); + + /** ReadPoolAutoScaleConfig targetMetrics. */ + public targetMetrics: google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric[]; + + /** ReadPoolAutoScaleConfig disableScaleIn. */ + public disableScaleIn?: (boolean|null); + + /** ReadPoolAutoScaleConfig scaleInCooldownSeconds. */ + public scaleInCooldownSeconds?: (number|null); + + /** ReadPoolAutoScaleConfig scaleOutCooldownSeconds. */ + public scaleOutCooldownSeconds?: (number|null); + + /** + * Creates a new ReadPoolAutoScaleConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ReadPoolAutoScaleConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IReadPoolAutoScaleConfig): google.cloud.sql.v1.ReadPoolAutoScaleConfig; + + /** + * Encodes the specified ReadPoolAutoScaleConfig message. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.verify|verify} messages. + * @param message ReadPoolAutoScaleConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IReadPoolAutoScaleConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReadPoolAutoScaleConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.verify|verify} messages. + * @param message ReadPoolAutoScaleConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IReadPoolAutoScaleConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReadPoolAutoScaleConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ReadPoolAutoScaleConfig; + + /** + * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReadPoolAutoScaleConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ReadPoolAutoScaleConfig; + + /** + * Verifies a ReadPoolAutoScaleConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReadPoolAutoScaleConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReadPoolAutoScaleConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ReadPoolAutoScaleConfig; + + /** + * Creates a plain object from a ReadPoolAutoScaleConfig message. Also converts values to other types if specified. + * @param message ReadPoolAutoScaleConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ReadPoolAutoScaleConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReadPoolAutoScaleConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReadPoolAutoScaleConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ReadPoolAutoScaleConfig { + + /** Properties of a TargetMetric. */ + interface ITargetMetric { + + /** TargetMetric metric */ + metric?: (string|null); + + /** TargetMetric targetValue */ + targetValue?: (number|null); + } + + /** Represents a TargetMetric. */ + class TargetMetric implements ITargetMetric { + + /** + * Constructs a new TargetMetric. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric); + + /** TargetMetric metric. */ + public metric?: (string|null); + + /** TargetMetric targetValue. */ + public targetValue?: (number|null); + + /** + * Creates a new TargetMetric instance using the specified properties. + * @param [properties] Properties to set + * @returns TargetMetric instance + */ + public static create(properties?: google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric): google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric; + + /** + * Encodes the specified TargetMetric message. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. + * @param message TargetMetric message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TargetMetric message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. + * @param message TargetMetric message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TargetMetric message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TargetMetric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric; + + /** + * Decodes a TargetMetric message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TargetMetric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric; + + /** + * Verifies a TargetMetric message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TargetMetric message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TargetMetric + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric; + + /** + * Creates a plain object from a TargetMetric message. Also converts values to other types if specified. + * @param message TargetMetric + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TargetMetric to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TargetMetric + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an AdvancedMachineFeatures. */ + interface IAdvancedMachineFeatures { + + /** AdvancedMachineFeatures threadsPerCore */ + threadsPerCore?: (number|null); + } + + /** Represents an AdvancedMachineFeatures. */ + class AdvancedMachineFeatures implements IAdvancedMachineFeatures { + + /** + * Constructs a new AdvancedMachineFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IAdvancedMachineFeatures); + + /** AdvancedMachineFeatures threadsPerCore. */ + public threadsPerCore: number; + + /** + * Creates a new AdvancedMachineFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns AdvancedMachineFeatures instance + */ + public static create(properties?: google.cloud.sql.v1.IAdvancedMachineFeatures): google.cloud.sql.v1.AdvancedMachineFeatures; + + /** + * Encodes the specified AdvancedMachineFeatures message. Does not implicitly {@link google.cloud.sql.v1.AdvancedMachineFeatures.verify|verify} messages. + * @param message AdvancedMachineFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IAdvancedMachineFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AdvancedMachineFeatures message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AdvancedMachineFeatures.verify|verify} messages. + * @param message AdvancedMachineFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IAdvancedMachineFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AdvancedMachineFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AdvancedMachineFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.AdvancedMachineFeatures; + + /** + * Decodes an AdvancedMachineFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AdvancedMachineFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.AdvancedMachineFeatures; + + /** + * Verifies an AdvancedMachineFeatures message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AdvancedMachineFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AdvancedMachineFeatures + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.AdvancedMachineFeatures; + + /** + * Creates a plain object from an AdvancedMachineFeatures message. Also converts values to other types if specified. + * @param message AdvancedMachineFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.AdvancedMachineFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AdvancedMachineFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AdvancedMachineFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCert. */ + interface ISslCert { + + /** SslCert kind */ + kind?: (string|null); + + /** SslCert certSerialNumber */ + certSerialNumber?: (string|null); + + /** SslCert cert */ + cert?: (string|null); + + /** SslCert createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** SslCert commonName */ + commonName?: (string|null); + + /** SslCert expirationTime */ + expirationTime?: (google.protobuf.ITimestamp|null); + + /** SslCert sha1Fingerprint */ + sha1Fingerprint?: (string|null); + + /** SslCert instance */ + instance?: (string|null); + + /** SslCert selfLink */ + selfLink?: (string|null); + } + + /** Represents a SslCert. */ + class SslCert implements ISslCert { + + /** + * Constructs a new SslCert. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISslCert); + + /** SslCert kind. */ + public kind: string; + + /** SslCert certSerialNumber. */ + public certSerialNumber: string; + + /** SslCert cert. */ + public cert: string; + + /** SslCert createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** SslCert commonName. */ + public commonName: string; + + /** SslCert expirationTime. */ + public expirationTime?: (google.protobuf.ITimestamp|null); + + /** SslCert sha1Fingerprint. */ + public sha1Fingerprint: string; + + /** SslCert instance. */ + public instance: string; + + /** SslCert selfLink. */ + public selfLink: string; + + /** + * Creates a new SslCert instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCert instance + */ + public static create(properties?: google.cloud.sql.v1.ISslCert): google.cloud.sql.v1.SslCert; + + /** + * Encodes the specified SslCert message. Does not implicitly {@link google.cloud.sql.v1.SslCert.verify|verify} messages. + * @param message SslCert message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISslCert, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCert message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCert.verify|verify} messages. + * @param message SslCert message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISslCert, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCert message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCert + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCert; + + /** + * Decodes a SslCert message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCert + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCert; + + /** + * Verifies a SslCert message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCert message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCert + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCert; + + /** + * Creates a plain object from a SslCert message. Also converts values to other types if specified. + * @param message SslCert + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SslCert, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCert to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCert + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCertDetail. */ + interface ISslCertDetail { + + /** SslCertDetail certInfo */ + certInfo?: (google.cloud.sql.v1.ISslCert|null); + + /** SslCertDetail certPrivateKey */ + certPrivateKey?: (string|null); + } + + /** Represents a SslCertDetail. */ + class SslCertDetail implements ISslCertDetail { + + /** + * Constructs a new SslCertDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISslCertDetail); + + /** SslCertDetail certInfo. */ + public certInfo?: (google.cloud.sql.v1.ISslCert|null); + + /** SslCertDetail certPrivateKey. */ + public certPrivateKey: string; + + /** + * Creates a new SslCertDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCertDetail instance + */ + public static create(properties?: google.cloud.sql.v1.ISslCertDetail): google.cloud.sql.v1.SslCertDetail; + + /** + * Encodes the specified SslCertDetail message. Does not implicitly {@link google.cloud.sql.v1.SslCertDetail.verify|verify} messages. + * @param message SslCertDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISslCertDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCertDetail message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertDetail.verify|verify} messages. + * @param message SslCertDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISslCertDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCertDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCertDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCertDetail; + + /** + * Decodes a SslCertDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCertDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCertDetail; + + /** + * Verifies a SslCertDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCertDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCertDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCertDetail; + + /** + * Creates a plain object from a SslCertDetail message. Also converts values to other types if specified. + * @param message SslCertDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SslCertDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCertDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCertDetail + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlActiveDirectoryConfig. */ + interface ISqlActiveDirectoryConfig { + + /** SqlActiveDirectoryConfig kind */ + kind?: (string|null); + + /** SqlActiveDirectoryConfig domain */ + domain?: (string|null); + + /** SqlActiveDirectoryConfig mode */ + mode?: (google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode|keyof typeof google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode|null); + + /** SqlActiveDirectoryConfig dnsServers */ + dnsServers?: (string[]|null); + + /** SqlActiveDirectoryConfig adminCredentialSecretName */ + adminCredentialSecretName?: (string|null); + + /** SqlActiveDirectoryConfig organizationalUnit */ + organizationalUnit?: (string|null); + } + + /** Represents a SqlActiveDirectoryConfig. */ + class SqlActiveDirectoryConfig implements ISqlActiveDirectoryConfig { + + /** + * Constructs a new SqlActiveDirectoryConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlActiveDirectoryConfig); + + /** SqlActiveDirectoryConfig kind. */ + public kind: string; + + /** SqlActiveDirectoryConfig domain. */ + public domain: string; + + /** SqlActiveDirectoryConfig mode. */ + public mode: (google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode|keyof typeof google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode); + + /** SqlActiveDirectoryConfig dnsServers. */ + public dnsServers: string[]; + + /** SqlActiveDirectoryConfig adminCredentialSecretName. */ + public adminCredentialSecretName: string; + + /** SqlActiveDirectoryConfig organizationalUnit. */ + public organizationalUnit: string; + + /** + * Creates a new SqlActiveDirectoryConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlActiveDirectoryConfig instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlActiveDirectoryConfig): google.cloud.sql.v1.SqlActiveDirectoryConfig; + + /** + * Encodes the specified SqlActiveDirectoryConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlActiveDirectoryConfig.verify|verify} messages. + * @param message SqlActiveDirectoryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlActiveDirectoryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlActiveDirectoryConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlActiveDirectoryConfig.verify|verify} messages. + * @param message SqlActiveDirectoryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlActiveDirectoryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlActiveDirectoryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlActiveDirectoryConfig; + + /** + * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlActiveDirectoryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlActiveDirectoryConfig; + + /** + * Verifies a SqlActiveDirectoryConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlActiveDirectoryConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlActiveDirectoryConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlActiveDirectoryConfig; + + /** + * Creates a plain object from a SqlActiveDirectoryConfig message. Also converts values to other types if specified. + * @param message SqlActiveDirectoryConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlActiveDirectoryConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlActiveDirectoryConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlActiveDirectoryConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlActiveDirectoryConfig { + + /** ActiveDirectoryMode enum. */ + enum ActiveDirectoryMode { + ACTIVE_DIRECTORY_MODE_UNSPECIFIED = 0, + MANAGED_ACTIVE_DIRECTORY = 1, + SELF_MANAGED_ACTIVE_DIRECTORY = 2, + CUSTOMER_MANAGED_ACTIVE_DIRECTORY = 3 + } + } + + /** Properties of a SqlServerAuditConfig. */ + interface ISqlServerAuditConfig { + + /** SqlServerAuditConfig kind */ + kind?: (string|null); + + /** SqlServerAuditConfig bucket */ + bucket?: (string|null); + + /** SqlServerAuditConfig retentionInterval */ + retentionInterval?: (google.protobuf.IDuration|null); + + /** SqlServerAuditConfig uploadInterval */ + uploadInterval?: (google.protobuf.IDuration|null); + } + + /** Represents a SqlServerAuditConfig. */ + class SqlServerAuditConfig implements ISqlServerAuditConfig { + + /** + * Constructs a new SqlServerAuditConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlServerAuditConfig); + + /** SqlServerAuditConfig kind. */ + public kind: string; + + /** SqlServerAuditConfig bucket. */ + public bucket: string; + + /** SqlServerAuditConfig retentionInterval. */ + public retentionInterval?: (google.protobuf.IDuration|null); + + /** SqlServerAuditConfig uploadInterval. */ + public uploadInterval?: (google.protobuf.IDuration|null); + + /** + * Creates a new SqlServerAuditConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlServerAuditConfig instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlServerAuditConfig): google.cloud.sql.v1.SqlServerAuditConfig; + + /** + * Encodes the specified SqlServerAuditConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlServerAuditConfig.verify|verify} messages. + * @param message SqlServerAuditConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlServerAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlServerAuditConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerAuditConfig.verify|verify} messages. + * @param message SqlServerAuditConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlServerAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlServerAuditConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlServerAuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlServerAuditConfig; + + /** + * Decodes a SqlServerAuditConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlServerAuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlServerAuditConfig; + + /** + * Verifies a SqlServerAuditConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlServerAuditConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlServerAuditConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlServerAuditConfig; + + /** + * Creates a plain object from a SqlServerAuditConfig message. Also converts values to other types if specified. + * @param message SqlServerAuditConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlServerAuditConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlServerAuditConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlServerAuditConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlServerEntraIdConfig. */ + interface ISqlServerEntraIdConfig { + + /** SqlServerEntraIdConfig kind */ + kind?: (string|null); + + /** SqlServerEntraIdConfig tenantId */ + tenantId?: (string|null); + + /** SqlServerEntraIdConfig applicationId */ + applicationId?: (string|null); + } + + /** Represents a SqlServerEntraIdConfig. */ + class SqlServerEntraIdConfig implements ISqlServerEntraIdConfig { + + /** + * Constructs a new SqlServerEntraIdConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlServerEntraIdConfig); + + /** SqlServerEntraIdConfig kind. */ + public kind: string; + + /** SqlServerEntraIdConfig tenantId. */ + public tenantId: string; + + /** SqlServerEntraIdConfig applicationId. */ + public applicationId: string; + + /** + * Creates a new SqlServerEntraIdConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlServerEntraIdConfig instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlServerEntraIdConfig): google.cloud.sql.v1.SqlServerEntraIdConfig; + + /** + * Encodes the specified SqlServerEntraIdConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlServerEntraIdConfig.verify|verify} messages. + * @param message SqlServerEntraIdConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlServerEntraIdConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlServerEntraIdConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerEntraIdConfig.verify|verify} messages. + * @param message SqlServerEntraIdConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlServerEntraIdConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlServerEntraIdConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlServerEntraIdConfig; + + /** + * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlServerEntraIdConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlServerEntraIdConfig; + + /** + * Verifies a SqlServerEntraIdConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlServerEntraIdConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlServerEntraIdConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlServerEntraIdConfig; + + /** + * Creates a plain object from a SqlServerEntraIdConfig message. Also converts values to other types if specified. + * @param message SqlServerEntraIdConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlServerEntraIdConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlServerEntraIdConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlServerEntraIdConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlBackendType enum. */ + enum SqlBackendType { + SQL_BACKEND_TYPE_UNSPECIFIED = 0, + FIRST_GEN = 1, + SECOND_GEN = 2, + EXTERNAL = 3 + } + + /** SqlIpAddressType enum. */ + enum SqlIpAddressType { + SQL_IP_ADDRESS_TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + OUTGOING = 2, + PRIVATE = 3, + MIGRATED_1ST_GEN = 4 + } + + /** SqlDatabaseVersion enum. */ + enum SqlDatabaseVersion { + SQL_DATABASE_VERSION_UNSPECIFIED = 0, + MYSQL_5_1 = 2, + MYSQL_5_5 = 3, + MYSQL_5_6 = 5, + MYSQL_5_7 = 6, + MYSQL_8_0 = 20, + MYSQL_8_0_18 = 41, + MYSQL_8_0_26 = 85, + MYSQL_8_0_27 = 111, + MYSQL_8_0_28 = 132, + MYSQL_8_0_29 = 148, + MYSQL_8_0_30 = 174, + MYSQL_8_0_31 = 197, + MYSQL_8_0_32 = 213, + MYSQL_8_0_33 = 238, + MYSQL_8_0_34 = 239, + MYSQL_8_0_35 = 240, + MYSQL_8_0_36 = 241, + MYSQL_8_0_37 = 355, + MYSQL_8_0_39 = 357, + MYSQL_8_0_40 = 358, + MYSQL_8_0_41 = 488, + MYSQL_8_0_42 = 489, + MYSQL_8_0_43 = 553, + MYSQL_8_0_44 = 554, + MYSQL_8_0_45 = 555, + MYSQL_8_0_46 = 556, + MYSQL_8_4 = 398, + MYSQL_9_7 = 654, + SQLSERVER_2017_STANDARD = 11, + SQLSERVER_2017_ENTERPRISE = 14, + SQLSERVER_2017_EXPRESS = 15, + SQLSERVER_2017_WEB = 16, + POSTGRES_9_6 = 9, + POSTGRES_10 = 18, + POSTGRES_11 = 10, + POSTGRES_12 = 19, + POSTGRES_13 = 23, + POSTGRES_14 = 110, + POSTGRES_15 = 172, + POSTGRES_16 = 272, + POSTGRES_17 = 408, + POSTGRES_18 = 557, + POSTGRES_19 = 684, + SQLSERVER_2019_STANDARD = 26, + SQLSERVER_2019_ENTERPRISE = 27, + SQLSERVER_2019_EXPRESS = 28, + SQLSERVER_2019_WEB = 29, + SQLSERVER_2022_STANDARD = 199, + SQLSERVER_2022_ENTERPRISE = 200, + SQLSERVER_2022_EXPRESS = 201, + SQLSERVER_2022_WEB = 202, + SQLSERVER_2025_STANDARD = 549, + SQLSERVER_2025_ENTERPRISE = 550, + SQLSERVER_2025_EXPRESS = 551 + } + + /** SqlPricingPlan enum. */ + enum SqlPricingPlan { + SQL_PRICING_PLAN_UNSPECIFIED = 0, + PACKAGE = 1, + PER_USE = 2 + } + + /** SqlReplicationType enum. */ + enum SqlReplicationType { + SQL_REPLICATION_TYPE_UNSPECIFIED = 0, + SYNCHRONOUS = 1, + ASYNCHRONOUS = 2 + } + + /** SqlDataDiskType enum. */ + enum SqlDataDiskType { + SQL_DATA_DISK_TYPE_UNSPECIFIED = 0, + PD_SSD = 1, + PD_HDD = 2, + OBSOLETE_LOCAL_SSD = 3, + HYPERDISK_BALANCED = 4 + } + + /** SqlAvailabilityType enum. */ + enum SqlAvailabilityType { + SQL_AVAILABILITY_TYPE_UNSPECIFIED = 0, + ZONAL = 1, + REGIONAL = 2 + } + + /** SqlUpdateTrack enum. */ + enum SqlUpdateTrack { + SQL_UPDATE_TRACK_UNSPECIFIED = 0, + canary = 1, + stable = 2, + week5 = 3 + } + + /** Properties of an AcquireSsrsLeaseContext. */ + interface IAcquireSsrsLeaseContext { + + /** AcquireSsrsLeaseContext setupLogin */ + setupLogin?: (string|null); + + /** AcquireSsrsLeaseContext serviceLogin */ + serviceLogin?: (string|null); + + /** AcquireSsrsLeaseContext reportDatabase */ + reportDatabase?: (string|null); + + /** AcquireSsrsLeaseContext duration */ + duration?: (google.protobuf.IDuration|null); + } + + /** Represents an AcquireSsrsLeaseContext. */ + class AcquireSsrsLeaseContext implements IAcquireSsrsLeaseContext { + + /** + * Constructs a new AcquireSsrsLeaseContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IAcquireSsrsLeaseContext); + + /** AcquireSsrsLeaseContext setupLogin. */ + public setupLogin?: (string|null); + + /** AcquireSsrsLeaseContext serviceLogin. */ + public serviceLogin?: (string|null); + + /** AcquireSsrsLeaseContext reportDatabase. */ + public reportDatabase?: (string|null); + + /** AcquireSsrsLeaseContext duration. */ + public duration?: (google.protobuf.IDuration|null); + + /** + * Creates a new AcquireSsrsLeaseContext instance using the specified properties. + * @param [properties] Properties to set + * @returns AcquireSsrsLeaseContext instance + */ + public static create(properties?: google.cloud.sql.v1.IAcquireSsrsLeaseContext): google.cloud.sql.v1.AcquireSsrsLeaseContext; + + /** + * Encodes the specified AcquireSsrsLeaseContext message. Does not implicitly {@link google.cloud.sql.v1.AcquireSsrsLeaseContext.verify|verify} messages. + * @param message AcquireSsrsLeaseContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IAcquireSsrsLeaseContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AcquireSsrsLeaseContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AcquireSsrsLeaseContext.verify|verify} messages. + * @param message AcquireSsrsLeaseContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IAcquireSsrsLeaseContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AcquireSsrsLeaseContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.AcquireSsrsLeaseContext; + + /** + * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AcquireSsrsLeaseContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.AcquireSsrsLeaseContext; + + /** + * Verifies an AcquireSsrsLeaseContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AcquireSsrsLeaseContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AcquireSsrsLeaseContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.AcquireSsrsLeaseContext; + + /** + * Creates a plain object from an AcquireSsrsLeaseContext message. Also converts values to other types if specified. + * @param message AcquireSsrsLeaseContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.AcquireSsrsLeaseContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AcquireSsrsLeaseContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AcquireSsrsLeaseContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DnsNameMapping. */ + interface IDnsNameMapping { + + /** DnsNameMapping name */ + name?: (string|null); + + /** DnsNameMapping connectionType */ + connectionType?: (google.cloud.sql.v1.DnsNameMapping.ConnectionType|keyof typeof google.cloud.sql.v1.DnsNameMapping.ConnectionType|null); + + /** DnsNameMapping dnsScope */ + dnsScope?: (google.cloud.sql.v1.DnsNameMapping.DnsScope|keyof typeof google.cloud.sql.v1.DnsNameMapping.DnsScope|null); + + /** DnsNameMapping recordManager */ + recordManager?: (google.cloud.sql.v1.DnsNameMapping.RecordManager|keyof typeof google.cloud.sql.v1.DnsNameMapping.RecordManager|null); + } + + /** Represents a DnsNameMapping. */ + class DnsNameMapping implements IDnsNameMapping { + + /** + * Constructs a new DnsNameMapping. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDnsNameMapping); + + /** DnsNameMapping name. */ + public name: string; + + /** DnsNameMapping connectionType. */ + public connectionType: (google.cloud.sql.v1.DnsNameMapping.ConnectionType|keyof typeof google.cloud.sql.v1.DnsNameMapping.ConnectionType); + + /** DnsNameMapping dnsScope. */ + public dnsScope: (google.cloud.sql.v1.DnsNameMapping.DnsScope|keyof typeof google.cloud.sql.v1.DnsNameMapping.DnsScope); + + /** DnsNameMapping recordManager. */ + public recordManager: (google.cloud.sql.v1.DnsNameMapping.RecordManager|keyof typeof google.cloud.sql.v1.DnsNameMapping.RecordManager); + + /** + * Creates a new DnsNameMapping instance using the specified properties. + * @param [properties] Properties to set + * @returns DnsNameMapping instance + */ + public static create(properties?: google.cloud.sql.v1.IDnsNameMapping): google.cloud.sql.v1.DnsNameMapping; + + /** + * Encodes the specified DnsNameMapping message. Does not implicitly {@link google.cloud.sql.v1.DnsNameMapping.verify|verify} messages. + * @param message DnsNameMapping message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDnsNameMapping, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DnsNameMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DnsNameMapping.verify|verify} messages. + * @param message DnsNameMapping message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDnsNameMapping, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DnsNameMapping message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DnsNameMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DnsNameMapping; + + /** + * Decodes a DnsNameMapping message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DnsNameMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DnsNameMapping; + + /** + * Verifies a DnsNameMapping message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DnsNameMapping message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DnsNameMapping + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DnsNameMapping; + + /** + * Creates a plain object from a DnsNameMapping message. Also converts values to other types if specified. + * @param message DnsNameMapping + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DnsNameMapping, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DnsNameMapping to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DnsNameMapping + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DnsNameMapping { + + /** ConnectionType enum. */ + enum ConnectionType { + CONNECTION_TYPE_UNSPECIFIED = 0, + PUBLIC = 1, + PRIVATE_SERVICES_ACCESS = 2, + PRIVATE_SERVICE_CONNECT = 3 + } + + /** DnsScope enum. */ + enum DnsScope { + DNS_SCOPE_UNSPECIFIED = 0, + INSTANCE = 1, + CLUSTER = 2 + } + + /** RecordManager enum. */ + enum RecordManager { + RECORD_MANAGER_UNSPECIFIED = 0, + CUSTOMER = 1, + CLOUD_SQL_AUTOMATION = 2 + } + } + + /** Represents a SqlBackupsService */ + class SqlBackupsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlBackupsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlBackupsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlBackupsService; + + /** + * Calls CreateBackup. + * @param request CreateBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createBackup(request: google.cloud.sql.v1.ICreateBackupRequest, callback: google.cloud.sql.v1.SqlBackupsService.CreateBackupCallback): void; + + /** + * Calls CreateBackup. + * @param request CreateBackupRequest message or plain object + * @returns Promise + */ + public createBackup(request: google.cloud.sql.v1.ICreateBackupRequest): Promise; + + /** + * Calls GetBackup. + * @param request GetBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Backup + */ + public getBackup(request: google.cloud.sql.v1.IGetBackupRequest, callback: google.cloud.sql.v1.SqlBackupsService.GetBackupCallback): void; + + /** + * Calls GetBackup. + * @param request GetBackupRequest message or plain object + * @returns Promise + */ + public getBackup(request: google.cloud.sql.v1.IGetBackupRequest): Promise; + + /** + * Calls ListBackups. + * @param request ListBackupsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListBackupsResponse + */ + public listBackups(request: google.cloud.sql.v1.IListBackupsRequest, callback: google.cloud.sql.v1.SqlBackupsService.ListBackupsCallback): void; + + /** + * Calls ListBackups. + * @param request ListBackupsRequest message or plain object + * @returns Promise + */ + public listBackups(request: google.cloud.sql.v1.IListBackupsRequest): Promise; + + /** + * Calls UpdateBackup. + * @param request UpdateBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateBackup(request: google.cloud.sql.v1.IUpdateBackupRequest, callback: google.cloud.sql.v1.SqlBackupsService.UpdateBackupCallback): void; + + /** + * Calls UpdateBackup. + * @param request UpdateBackupRequest message or plain object + * @returns Promise + */ + public updateBackup(request: google.cloud.sql.v1.IUpdateBackupRequest): Promise; + + /** + * Calls DeleteBackup. + * @param request DeleteBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteBackup(request: google.cloud.sql.v1.IDeleteBackupRequest, callback: google.cloud.sql.v1.SqlBackupsService.DeleteBackupCallback): void; + + /** + * Calls DeleteBackup. + * @param request DeleteBackupRequest message or plain object + * @returns Promise + */ + public deleteBackup(request: google.cloud.sql.v1.IDeleteBackupRequest): Promise; + } + + namespace SqlBackupsService { + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|createBackup}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|getBackup}. + * @param error Error, if any + * @param [response] Backup + */ + type GetBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1.Backup) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|listBackups}. + * @param error Error, if any + * @param [response] ListBackupsResponse + */ + type ListBackupsCallback = (error: (Error|null), response?: google.cloud.sql.v1.ListBackupsResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|updateBackup}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|deleteBackup}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + } + + /** Properties of a CreateBackupRequest. */ + interface ICreateBackupRequest { + + /** CreateBackupRequest parent */ + parent?: (string|null); + + /** CreateBackupRequest backup */ + backup?: (google.cloud.sql.v1.IBackup|null); + } + + /** Represents a CreateBackupRequest. */ + class CreateBackupRequest implements ICreateBackupRequest { + + /** + * Constructs a new CreateBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ICreateBackupRequest); + + /** CreateBackupRequest parent. */ + public parent: string; + + /** CreateBackupRequest backup. */ + public backup?: (google.cloud.sql.v1.IBackup|null); + + /** + * Creates a new CreateBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ICreateBackupRequest): google.cloud.sql.v1.CreateBackupRequest; + + /** + * Encodes the specified CreateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.CreateBackupRequest.verify|verify} messages. + * @param message CreateBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ICreateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.CreateBackupRequest.verify|verify} messages. + * @param message CreateBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ICreateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.CreateBackupRequest; + + /** + * Decodes a CreateBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.CreateBackupRequest; + + /** + * Verifies a CreateBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.CreateBackupRequest; + + /** + * Creates a plain object from a CreateBackupRequest message. Also converts values to other types if specified. + * @param message CreateBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.CreateBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetBackupRequest. */ + interface IGetBackupRequest { + + /** GetBackupRequest name */ + name?: (string|null); + } + + /** Represents a GetBackupRequest. */ + class GetBackupRequest implements IGetBackupRequest { + + /** + * Constructs a new GetBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IGetBackupRequest); + + /** GetBackupRequest name. */ + public name: string; + + /** + * Creates a new GetBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IGetBackupRequest): google.cloud.sql.v1.GetBackupRequest; + + /** + * Encodes the specified GetBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.GetBackupRequest.verify|verify} messages. + * @param message GetBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IGetBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GetBackupRequest.verify|verify} messages. + * @param message GetBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IGetBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.GetBackupRequest; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.GetBackupRequest; + + /** + * Verifies a GetBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.GetBackupRequest; + + /** + * Creates a plain object from a GetBackupRequest message. Also converts values to other types if specified. + * @param message GetBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.GetBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListBackupsRequest. */ + interface IListBackupsRequest { + + /** ListBackupsRequest parent */ + parent?: (string|null); + + /** ListBackupsRequest pageSize */ + pageSize?: (number|null); + + /** ListBackupsRequest pageToken */ + pageToken?: (string|null); + + /** ListBackupsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListBackupsRequest. */ + class ListBackupsRequest implements IListBackupsRequest { + + /** + * Constructs a new ListBackupsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IListBackupsRequest); + + /** ListBackupsRequest parent. */ + public parent: string; + + /** ListBackupsRequest pageSize. */ + public pageSize: number; + + /** ListBackupsRequest pageToken. */ + public pageToken: string; + + /** ListBackupsRequest filter. */ + public filter: string; + + /** + * Creates a new ListBackupsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBackupsRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IListBackupsRequest): google.cloud.sql.v1.ListBackupsRequest; + + /** + * Encodes the specified ListBackupsRequest message. Does not implicitly {@link google.cloud.sql.v1.ListBackupsRequest.verify|verify} messages. + * @param message ListBackupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IListBackupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListBackupsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ListBackupsRequest.verify|verify} messages. + * @param message ListBackupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IListBackupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ListBackupsRequest; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ListBackupsRequest; + + /** + * Verifies a ListBackupsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListBackupsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListBackupsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ListBackupsRequest; + + /** + * Creates a plain object from a ListBackupsRequest message. Also converts values to other types if specified. + * @param message ListBackupsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ListBackupsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListBackupsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListBackupsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListBackupsResponse. */ + interface IListBackupsResponse { + + /** ListBackupsResponse backups */ + backups?: (google.cloud.sql.v1.IBackup[]|null); + + /** ListBackupsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListBackupsResponse warnings */ + warnings?: (google.cloud.sql.v1.IApiWarning[]|null); + } + + /** Represents a ListBackupsResponse. */ + class ListBackupsResponse implements IListBackupsResponse { + + /** + * Constructs a new ListBackupsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IListBackupsResponse); + + /** ListBackupsResponse backups. */ + public backups: google.cloud.sql.v1.IBackup[]; + + /** ListBackupsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListBackupsResponse warnings. */ + public warnings: google.cloud.sql.v1.IApiWarning[]; + + /** + * Creates a new ListBackupsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBackupsResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IListBackupsResponse): google.cloud.sql.v1.ListBackupsResponse; + + /** + * Encodes the specified ListBackupsResponse message. Does not implicitly {@link google.cloud.sql.v1.ListBackupsResponse.verify|verify} messages. + * @param message ListBackupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IListBackupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListBackupsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ListBackupsResponse.verify|verify} messages. + * @param message ListBackupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IListBackupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ListBackupsResponse; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ListBackupsResponse; + + /** + * Verifies a ListBackupsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListBackupsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListBackupsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ListBackupsResponse; + + /** + * Creates a plain object from a ListBackupsResponse message. Also converts values to other types if specified. + * @param message ListBackupsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ListBackupsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListBackupsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListBackupsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateBackupRequest. */ + interface IUpdateBackupRequest { + + /** UpdateBackupRequest backup */ + backup?: (google.cloud.sql.v1.IBackup|null); + + /** UpdateBackupRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateBackupRequest. */ + class UpdateBackupRequest implements IUpdateBackupRequest { + + /** + * Constructs a new UpdateBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IUpdateBackupRequest); + + /** UpdateBackupRequest backup. */ + public backup?: (google.cloud.sql.v1.IBackup|null); + + /** UpdateBackupRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IUpdateBackupRequest): google.cloud.sql.v1.UpdateBackupRequest; + + /** + * Encodes the specified UpdateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.UpdateBackupRequest.verify|verify} messages. + * @param message UpdateBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IUpdateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UpdateBackupRequest.verify|verify} messages. + * @param message UpdateBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IUpdateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.UpdateBackupRequest; + + /** + * Decodes an UpdateBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.UpdateBackupRequest; + + /** + * Verifies an UpdateBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.UpdateBackupRequest; + + /** + * Creates a plain object from an UpdateBackupRequest message. Also converts values to other types if specified. + * @param message UpdateBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.UpdateBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteBackupRequest. */ + interface IDeleteBackupRequest { + + /** DeleteBackupRequest name */ + name?: (string|null); + } + + /** Represents a DeleteBackupRequest. */ + class DeleteBackupRequest implements IDeleteBackupRequest { + + /** + * Constructs a new DeleteBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDeleteBackupRequest); + + /** DeleteBackupRequest name. */ + public name: string; + + /** + * Creates a new DeleteBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IDeleteBackupRequest): google.cloud.sql.v1.DeleteBackupRequest; + + /** + * Encodes the specified DeleteBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.DeleteBackupRequest.verify|verify} messages. + * @param message DeleteBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDeleteBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DeleteBackupRequest.verify|verify} messages. + * @param message DeleteBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDeleteBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DeleteBackupRequest; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DeleteBackupRequest; + + /** + * Verifies a DeleteBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DeleteBackupRequest; + + /** + * Creates a plain object from a DeleteBackupRequest message. Also converts values to other types if specified. + * @param message DeleteBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DeleteBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Backup. */ + interface IBackup { + + /** Backup name */ + name?: (string|null); + + /** Backup kind */ + kind?: (string|null); + + /** Backup selfLink */ + selfLink?: (string|null); + + /** Backup type */ + type?: (google.cloud.sql.v1.Backup.SqlBackupType|keyof typeof google.cloud.sql.v1.Backup.SqlBackupType|null); + + /** Backup description */ + description?: (string|null); + + /** Backup instance */ + instance?: (string|null); + + /** Backup location */ + location?: (string|null); + + /** Backup backupInterval */ + backupInterval?: (google.type.IInterval|null); + + /** Backup state */ + state?: (google.cloud.sql.v1.Backup.SqlBackupState|keyof typeof google.cloud.sql.v1.Backup.SqlBackupState|null); + + /** Backup error */ + error?: (google.cloud.sql.v1.IOperationError|null); + + /** Backup kmsKey */ + kmsKey?: (string|null); + + /** Backup kmsKeyVersion */ + kmsKeyVersion?: (string|null); + + /** Backup backupKind */ + backupKind?: (google.cloud.sql.v1.SqlBackupKind|keyof typeof google.cloud.sql.v1.SqlBackupKind|null); + + /** Backup timeZone */ + timeZone?: (string|null); + + /** Backup ttlDays */ + ttlDays?: (number|Long|string|null); + + /** Backup expiryTime */ + expiryTime?: (google.protobuf.ITimestamp|null); + + /** Backup databaseVersion */ + databaseVersion?: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion|null); + + /** Backup maxChargeableBytes */ + maxChargeableBytes?: (number|Long|string|null); + + /** Backup instanceDeletionTime */ + instanceDeletionTime?: (google.protobuf.ITimestamp|null); + + /** Backup instanceSettings */ + instanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** Backup backupRun */ + backupRun?: (string|null); + + /** Backup satisfiesPzs */ + satisfiesPzs?: (google.protobuf.IBoolValue|null); + + /** Backup satisfiesPzi */ + satisfiesPzi?: (google.protobuf.IBoolValue|null); + } + + /** Represents a Backup. */ + class Backup implements IBackup { + + /** + * Constructs a new Backup. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IBackup); + + /** Backup name. */ + public name: string; + + /** Backup kind. */ + public kind: string; + + /** Backup selfLink. */ + public selfLink: string; + + /** Backup type. */ + public type: (google.cloud.sql.v1.Backup.SqlBackupType|keyof typeof google.cloud.sql.v1.Backup.SqlBackupType); + + /** Backup description. */ + public description: string; + + /** Backup instance. */ + public instance: string; + + /** Backup location. */ + public location: string; + + /** Backup backupInterval. */ + public backupInterval?: (google.type.IInterval|null); + + /** Backup state. */ + public state: (google.cloud.sql.v1.Backup.SqlBackupState|keyof typeof google.cloud.sql.v1.Backup.SqlBackupState); + + /** Backup error. */ + public error?: (google.cloud.sql.v1.IOperationError|null); + + /** Backup kmsKey. */ + public kmsKey: string; + + /** Backup kmsKeyVersion. */ + public kmsKeyVersion: string; + + /** Backup backupKind. */ + public backupKind: (google.cloud.sql.v1.SqlBackupKind|keyof typeof google.cloud.sql.v1.SqlBackupKind); + + /** Backup timeZone. */ + public timeZone: string; + + /** Backup ttlDays. */ + public ttlDays?: (number|Long|string|null); + + /** Backup expiryTime. */ + public expiryTime?: (google.protobuf.ITimestamp|null); + + /** Backup databaseVersion. */ + public databaseVersion: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion); + + /** Backup maxChargeableBytes. */ + public maxChargeableBytes?: (number|Long|string|null); + + /** Backup instanceDeletionTime. */ + public instanceDeletionTime?: (google.protobuf.ITimestamp|null); + + /** Backup instanceSettings. */ + public instanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** Backup backupRun. */ + public backupRun: string; + + /** Backup satisfiesPzs. */ + public satisfiesPzs?: (google.protobuf.IBoolValue|null); + + /** Backup satisfiesPzi. */ + public satisfiesPzi?: (google.protobuf.IBoolValue|null); + + /** Backup expiration. */ + public expiration?: ("ttlDays"|"expiryTime"); + + /** + * Creates a new Backup instance using the specified properties. + * @param [properties] Properties to set + * @returns Backup instance + */ + public static create(properties?: google.cloud.sql.v1.IBackup): google.cloud.sql.v1.Backup; + + /** + * Encodes the specified Backup message. Does not implicitly {@link google.cloud.sql.v1.Backup.verify|verify} messages. + * @param message Backup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IBackup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Backup message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Backup.verify|verify} messages. + * @param message Backup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IBackup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Backup message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Backup; + + /** + * Decodes a Backup message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Backup; + + /** + * Verifies a Backup message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Backup message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Backup + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Backup; + + /** + * Creates a plain object from a Backup message. Also converts values to other types if specified. + * @param message Backup + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.Backup, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Backup to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Backup + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Backup { + + /** SqlBackupType enum. */ + enum SqlBackupType { + SQL_BACKUP_TYPE_UNSPECIFIED = 0, + AUTOMATED = 1, + ON_DEMAND = 2, + FINAL = 3 + } + + /** SqlBackupState enum. */ + enum SqlBackupState { + SQL_BACKUP_STATE_UNSPECIFIED = 0, + ENQUEUED = 1, + RUNNING = 2, + FAILED = 3, + SUCCESSFUL = 4, + DELETING = 5, + DELETION_FAILED = 6 + } + } + + /** Represents a SqlInstancesService */ + class SqlInstancesService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlInstancesService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlInstancesService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlInstancesService; + + /** + * Calls AddServerCa. + * @param request SqlInstancesAddServerCaRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addServerCa(request: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, callback: google.cloud.sql.v1.SqlInstancesService.AddServerCaCallback): void; + + /** + * Calls AddServerCa. + * @param request SqlInstancesAddServerCaRequest message or plain object + * @returns Promise + */ + public addServerCa(request: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest): Promise; + + /** + * Calls AddServerCertificate. + * @param request SqlInstancesAddServerCertificateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addServerCertificate(request: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, callback: google.cloud.sql.v1.SqlInstancesService.AddServerCertificateCallback): void; + + /** + * Calls AddServerCertificate. + * @param request SqlInstancesAddServerCertificateRequest message or plain object + * @returns Promise + */ + public addServerCertificate(request: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest): Promise; + + /** + * Calls AddEntraIdCertificate. + * @param request SqlInstancesAddEntraIdCertificateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addEntraIdCertificate(request: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, callback: google.cloud.sql.v1.SqlInstancesService.AddEntraIdCertificateCallback): void; + + /** + * Calls AddEntraIdCertificate. + * @param request SqlInstancesAddEntraIdCertificateRequest message or plain object + * @returns Promise + */ + public addEntraIdCertificate(request: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest): Promise; + + /** + * Calls Clone. + * @param request SqlInstancesCloneRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public clone(request: google.cloud.sql.v1.ISqlInstancesCloneRequest, callback: google.cloud.sql.v1.SqlInstancesService.CloneCallback): void; + + /** + * Calls Clone. + * @param request SqlInstancesCloneRequest message or plain object + * @returns Promise + */ + public clone(request: google.cloud.sql.v1.ISqlInstancesCloneRequest): Promise; + + /** + * Calls Delete. + * @param request SqlInstancesDeleteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public delete(request: google.cloud.sql.v1.ISqlInstancesDeleteRequest, callback: google.cloud.sql.v1.SqlInstancesService.DeleteCallback): void; + + /** + * Calls Delete. + * @param request SqlInstancesDeleteRequest message or plain object + * @returns Promise + */ + public delete(request: google.cloud.sql.v1.ISqlInstancesDeleteRequest): Promise; + + /** + * Calls DemoteMaster. + * @param request SqlInstancesDemoteMasterRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public demoteMaster(request: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, callback: google.cloud.sql.v1.SqlInstancesService.DemoteMasterCallback): void; + + /** + * Calls DemoteMaster. + * @param request SqlInstancesDemoteMasterRequest message or plain object + * @returns Promise + */ + public demoteMaster(request: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest): Promise; + + /** + * Calls Demote. + * @param request SqlInstancesDemoteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public demote(request: google.cloud.sql.v1.ISqlInstancesDemoteRequest, callback: google.cloud.sql.v1.SqlInstancesService.DemoteCallback): void; + + /** + * Calls Demote. + * @param request SqlInstancesDemoteRequest message or plain object + * @returns Promise + */ + public demote(request: google.cloud.sql.v1.ISqlInstancesDemoteRequest): Promise; + + /** + * Calls Export. + * @param request SqlInstancesExportRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public export(request: google.cloud.sql.v1.ISqlInstancesExportRequest, callback: google.cloud.sql.v1.SqlInstancesService.ExportCallback): void; + + /** + * Calls Export. + * @param request SqlInstancesExportRequest message or plain object + * @returns Promise + */ + public export(request: google.cloud.sql.v1.ISqlInstancesExportRequest): Promise; + + /** + * Calls Failover. + * @param request SqlInstancesFailoverRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public failover(request: google.cloud.sql.v1.ISqlInstancesFailoverRequest, callback: google.cloud.sql.v1.SqlInstancesService.FailoverCallback): void; + + /** + * Calls Failover. + * @param request SqlInstancesFailoverRequest message or plain object + * @returns Promise + */ + public failover(request: google.cloud.sql.v1.ISqlInstancesFailoverRequest): Promise; + + /** + * Calls Reencrypt. + * @param request SqlInstancesReencryptRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public reencrypt(request: google.cloud.sql.v1.ISqlInstancesReencryptRequest, callback: google.cloud.sql.v1.SqlInstancesService.ReencryptCallback): void; + + /** + * Calls Reencrypt. + * @param request SqlInstancesReencryptRequest message or plain object + * @returns Promise + */ + public reencrypt(request: google.cloud.sql.v1.ISqlInstancesReencryptRequest): Promise; + + /** + * Calls Get. + * @param request SqlInstancesGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DatabaseInstance + */ + public get(request: google.cloud.sql.v1.ISqlInstancesGetRequest, callback: google.cloud.sql.v1.SqlInstancesService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlInstancesGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1.ISqlInstancesGetRequest): Promise; + + /** + * Calls Import. + * @param request SqlInstancesImportRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public import(request: google.cloud.sql.v1.ISqlInstancesImportRequest, callback: google.cloud.sql.v1.SqlInstancesService.ImportCallback): void; + + /** + * Calls Import. + * @param request SqlInstancesImportRequest message or plain object + * @returns Promise + */ + public import(request: google.cloud.sql.v1.ISqlInstancesImportRequest): Promise; + + /** + * Calls Insert. + * @param request SqlInstancesInsertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public insert(request: google.cloud.sql.v1.ISqlInstancesInsertRequest, callback: google.cloud.sql.v1.SqlInstancesService.InsertCallback): void; + + /** + * Calls Insert. + * @param request SqlInstancesInsertRequest message or plain object + * @returns Promise + */ + public insert(request: google.cloud.sql.v1.ISqlInstancesInsertRequest): Promise; + + /** + * Calls List. + * @param request SqlInstancesListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and InstancesListResponse + */ + public list(request: google.cloud.sql.v1.ISqlInstancesListRequest, callback: google.cloud.sql.v1.SqlInstancesService.ListCallback): void; + + /** + * Calls List. + * @param request SqlInstancesListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1.ISqlInstancesListRequest): Promise; + + /** + * Calls ListServerCas. + * @param request SqlInstancesListServerCasRequest message or plain object + * @param callback Node-style callback called with the error, if any, and InstancesListServerCasResponse + */ + public listServerCas(request: google.cloud.sql.v1.ISqlInstancesListServerCasRequest, callback: google.cloud.sql.v1.SqlInstancesService.ListServerCasCallback): void; + + /** + * Calls ListServerCas. + * @param request SqlInstancesListServerCasRequest message or plain object + * @returns Promise + */ + public listServerCas(request: google.cloud.sql.v1.ISqlInstancesListServerCasRequest): Promise; + + /** + * Calls ListServerCertificates. + * @param request SqlInstancesListServerCertificatesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and InstancesListServerCertificatesResponse + */ + public listServerCertificates(request: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, callback: google.cloud.sql.v1.SqlInstancesService.ListServerCertificatesCallback): void; + + /** + * Calls ListServerCertificates. + * @param request SqlInstancesListServerCertificatesRequest message or plain object + * @returns Promise + */ + public listServerCertificates(request: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest): Promise; + + /** + * Calls ListEntraIdCertificates. + * @param request SqlInstancesListEntraIdCertificatesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and InstancesListEntraIdCertificatesResponse + */ + public listEntraIdCertificates(request: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, callback: google.cloud.sql.v1.SqlInstancesService.ListEntraIdCertificatesCallback): void; + + /** + * Calls ListEntraIdCertificates. + * @param request SqlInstancesListEntraIdCertificatesRequest message or plain object + * @returns Promise + */ + public listEntraIdCertificates(request: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest): Promise; + + /** + * Calls Patch. + * @param request SqlInstancesPatchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public patch(request: google.cloud.sql.v1.ISqlInstancesPatchRequest, callback: google.cloud.sql.v1.SqlInstancesService.PatchCallback): void; + + /** + * Calls Patch. + * @param request SqlInstancesPatchRequest message or plain object + * @returns Promise + */ + public patch(request: google.cloud.sql.v1.ISqlInstancesPatchRequest): Promise; + + /** + * Calls PromoteReplica. + * @param request SqlInstancesPromoteReplicaRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public promoteReplica(request: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, callback: google.cloud.sql.v1.SqlInstancesService.PromoteReplicaCallback): void; + + /** + * Calls PromoteReplica. + * @param request SqlInstancesPromoteReplicaRequest message or plain object + * @returns Promise + */ + public promoteReplica(request: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest): Promise; + + /** + * Calls Switchover. + * @param request SqlInstancesSwitchoverRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public switchover(request: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, callback: google.cloud.sql.v1.SqlInstancesService.SwitchoverCallback): void; + + /** + * Calls Switchover. + * @param request SqlInstancesSwitchoverRequest message or plain object + * @returns Promise + */ + public switchover(request: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest): Promise; + + /** + * Calls ResetSslConfig. + * @param request SqlInstancesResetSslConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public resetSslConfig(request: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, callback: google.cloud.sql.v1.SqlInstancesService.ResetSslConfigCallback): void; + + /** + * Calls ResetSslConfig. + * @param request SqlInstancesResetSslConfigRequest message or plain object + * @returns Promise + */ + public resetSslConfig(request: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest): Promise; + + /** + * Calls Restart. + * @param request SqlInstancesRestartRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public restart(request: google.cloud.sql.v1.ISqlInstancesRestartRequest, callback: google.cloud.sql.v1.SqlInstancesService.RestartCallback): void; + + /** + * Calls Restart. + * @param request SqlInstancesRestartRequest message or plain object + * @returns Promise + */ + public restart(request: google.cloud.sql.v1.ISqlInstancesRestartRequest): Promise; + + /** + * Calls RestoreBackup. + * @param request SqlInstancesRestoreBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public restoreBackup(request: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, callback: google.cloud.sql.v1.SqlInstancesService.RestoreBackupCallback): void; + + /** + * Calls RestoreBackup. + * @param request SqlInstancesRestoreBackupRequest message or plain object + * @returns Promise + */ + public restoreBackup(request: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest): Promise; + + /** + * Calls RotateServerCa. + * @param request SqlInstancesRotateServerCaRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rotateServerCa(request: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, callback: google.cloud.sql.v1.SqlInstancesService.RotateServerCaCallback): void; + + /** + * Calls RotateServerCa. + * @param request SqlInstancesRotateServerCaRequest message or plain object + * @returns Promise + */ + public rotateServerCa(request: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest): Promise; + + /** + * Calls RotateServerCertificate. + * @param request SqlInstancesRotateServerCertificateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rotateServerCertificate(request: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, callback: google.cloud.sql.v1.SqlInstancesService.RotateServerCertificateCallback): void; + + /** + * Calls RotateServerCertificate. + * @param request SqlInstancesRotateServerCertificateRequest message or plain object + * @returns Promise + */ + public rotateServerCertificate(request: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest): Promise; + + /** + * Calls RotateEntraIdCertificate. + * @param request SqlInstancesRotateEntraIdCertificateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rotateEntraIdCertificate(request: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, callback: google.cloud.sql.v1.SqlInstancesService.RotateEntraIdCertificateCallback): void; + + /** + * Calls RotateEntraIdCertificate. + * @param request SqlInstancesRotateEntraIdCertificateRequest message or plain object + * @returns Promise + */ + public rotateEntraIdCertificate(request: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest): Promise; + + /** + * Calls StartReplica. + * @param request SqlInstancesStartReplicaRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public startReplica(request: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, callback: google.cloud.sql.v1.SqlInstancesService.StartReplicaCallback): void; + + /** + * Calls StartReplica. + * @param request SqlInstancesStartReplicaRequest message or plain object + * @returns Promise + */ + public startReplica(request: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest): Promise; + + /** + * Calls StopReplica. + * @param request SqlInstancesStopReplicaRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public stopReplica(request: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, callback: google.cloud.sql.v1.SqlInstancesService.StopReplicaCallback): void; + + /** + * Calls StopReplica. + * @param request SqlInstancesStopReplicaRequest message or plain object + * @returns Promise + */ + public stopReplica(request: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest): Promise; + + /** + * Calls TruncateLog. + * @param request SqlInstancesTruncateLogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public truncateLog(request: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, callback: google.cloud.sql.v1.SqlInstancesService.TruncateLogCallback): void; + + /** + * Calls TruncateLog. + * @param request SqlInstancesTruncateLogRequest message or plain object + * @returns Promise + */ + public truncateLog(request: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest): Promise; + + /** + * Calls Update. + * @param request SqlInstancesUpdateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public update(request: google.cloud.sql.v1.ISqlInstancesUpdateRequest, callback: google.cloud.sql.v1.SqlInstancesService.UpdateCallback): void; + + /** + * Calls Update. + * @param request SqlInstancesUpdateRequest message or plain object + * @returns Promise + */ + public update(request: google.cloud.sql.v1.ISqlInstancesUpdateRequest): Promise; + + /** + * Calls CreateEphemeral. + * @param request SqlInstancesCreateEphemeralCertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SslCert + */ + public createEphemeral(request: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, callback: google.cloud.sql.v1.SqlInstancesService.CreateEphemeralCallback): void; + + /** + * Calls CreateEphemeral. + * @param request SqlInstancesCreateEphemeralCertRequest message or plain object + * @returns Promise + */ + public createEphemeral(request: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest): Promise; + + /** + * Calls RescheduleMaintenance. + * @param request SqlInstancesRescheduleMaintenanceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rescheduleMaintenance(request: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, callback: google.cloud.sql.v1.SqlInstancesService.RescheduleMaintenanceCallback): void; + + /** + * Calls RescheduleMaintenance. + * @param request SqlInstancesRescheduleMaintenanceRequest message or plain object + * @returns Promise + */ + public rescheduleMaintenance(request: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest): Promise; + + /** + * Calls VerifyExternalSyncSettings. + * @param request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesVerifyExternalSyncSettingsResponse + */ + public verifyExternalSyncSettings(request: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, callback: google.cloud.sql.v1.SqlInstancesService.VerifyExternalSyncSettingsCallback): void; + + /** + * Calls VerifyExternalSyncSettings. + * @param request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object + * @returns Promise + */ + public verifyExternalSyncSettings(request: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest): Promise; + + /** + * Calls StartExternalSync. + * @param request SqlInstancesStartExternalSyncRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public startExternalSync(request: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, callback: google.cloud.sql.v1.SqlInstancesService.StartExternalSyncCallback): void; + + /** + * Calls StartExternalSync. + * @param request SqlInstancesStartExternalSyncRequest message or plain object + * @returns Promise + */ + public startExternalSync(request: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest): Promise; + + /** + * Calls PerformDiskShrink. + * @param request SqlInstancesPerformDiskShrinkRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public performDiskShrink(request: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, callback: google.cloud.sql.v1.SqlInstancesService.PerformDiskShrinkCallback): void; + + /** + * Calls PerformDiskShrink. + * @param request SqlInstancesPerformDiskShrinkRequest message or plain object + * @returns Promise + */ + public performDiskShrink(request: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest): Promise; + + /** + * Calls GetDiskShrinkConfig. + * @param request SqlInstancesGetDiskShrinkConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesGetDiskShrinkConfigResponse + */ + public getDiskShrinkConfig(request: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, callback: google.cloud.sql.v1.SqlInstancesService.GetDiskShrinkConfigCallback): void; + + /** + * Calls GetDiskShrinkConfig. + * @param request SqlInstancesGetDiskShrinkConfigRequest message or plain object + * @returns Promise + */ + public getDiskShrinkConfig(request: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest): Promise; + + /** + * Calls ResetReplicaSize. + * @param request SqlInstancesResetReplicaSizeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public resetReplicaSize(request: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, callback: google.cloud.sql.v1.SqlInstancesService.ResetReplicaSizeCallback): void; + + /** + * Calls ResetReplicaSize. + * @param request SqlInstancesResetReplicaSizeRequest message or plain object + * @returns Promise + */ + public resetReplicaSize(request: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest): Promise; + + /** + * Calls GetLatestRecoveryTime. + * @param request SqlInstancesGetLatestRecoveryTimeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesGetLatestRecoveryTimeResponse + */ + public getLatestRecoveryTime(request: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, callback: google.cloud.sql.v1.SqlInstancesService.GetLatestRecoveryTimeCallback): void; + + /** + * Calls GetLatestRecoveryTime. + * @param request SqlInstancesGetLatestRecoveryTimeRequest message or plain object + * @returns Promise + */ + public getLatestRecoveryTime(request: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest): Promise; + + /** + * Calls ExecuteSql. + * @param request SqlInstancesExecuteSqlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesExecuteSqlResponse + */ + public executeSql(request: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, callback: google.cloud.sql.v1.SqlInstancesService.ExecuteSqlCallback): void; + + /** + * Calls ExecuteSql. + * @param request SqlInstancesExecuteSqlRequest message or plain object + * @returns Promise + */ + public executeSql(request: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest): Promise; + + /** + * Calls AcquireSsrsLease. + * @param request SqlInstancesAcquireSsrsLeaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesAcquireSsrsLeaseResponse + */ + public acquireSsrsLease(request: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, callback: google.cloud.sql.v1.SqlInstancesService.AcquireSsrsLeaseCallback): void; + + /** + * Calls AcquireSsrsLease. + * @param request SqlInstancesAcquireSsrsLeaseRequest message or plain object + * @returns Promise + */ + public acquireSsrsLease(request: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest): Promise; + + /** + * Calls ReleaseSsrsLease. + * @param request SqlInstancesReleaseSsrsLeaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesReleaseSsrsLeaseResponse + */ + public releaseSsrsLease(request: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, callback: google.cloud.sql.v1.SqlInstancesService.ReleaseSsrsLeaseCallback): void; + + /** + * Calls ReleaseSsrsLease. + * @param request SqlInstancesReleaseSsrsLeaseRequest message or plain object + * @returns Promise + */ + public releaseSsrsLease(request: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest): Promise; + + /** + * Calls PreCheckMajorVersionUpgrade. + * @param request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public preCheckMajorVersionUpgrade(request: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, callback: google.cloud.sql.v1.SqlInstancesService.PreCheckMajorVersionUpgradeCallback): void; + + /** + * Calls PreCheckMajorVersionUpgrade. + * @param request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object + * @returns Promise + */ + public preCheckMajorVersionUpgrade(request: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest): Promise; + + /** + * Calls PointInTimeRestore. + * @param request SqlInstancesPointInTimeRestoreRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public pointInTimeRestore(request: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, callback: google.cloud.sql.v1.SqlInstancesService.PointInTimeRestoreCallback): void; + + /** + * Calls PointInTimeRestore. + * @param request SqlInstancesPointInTimeRestoreRequest message or plain object + * @returns Promise + */ + public pointInTimeRestore(request: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest): Promise; + } + + namespace SqlInstancesService { + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addServerCa}. + * @param error Error, if any + * @param [response] Operation + */ + type AddServerCaCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addServerCertificate}. + * @param error Error, if any + * @param [response] Operation + */ + type AddServerCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addEntraIdCertificate}. + * @param error Error, if any + * @param [response] Operation + */ + type AddEntraIdCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|clone}. + * @param error Error, if any + * @param [response] Operation + */ + type CloneCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|delete_}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|demoteMaster}. + * @param error Error, if any + * @param [response] Operation + */ + type DemoteMasterCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|demote}. + * @param error Error, if any + * @param [response] Operation + */ + type DemoteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|export_}. + * @param error Error, if any + * @param [response] Operation + */ + type ExportCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|failover}. + * @param error Error, if any + * @param [response] Operation + */ + type FailoverCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|reencrypt}. + * @param error Error, if any + * @param [response] Operation + */ + type ReencryptCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|get}. + * @param error Error, if any + * @param [response] DatabaseInstance + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.DatabaseInstance) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|import_}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|insert}. + * @param error Error, if any + * @param [response] Operation + */ + type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|list}. + * @param error Error, if any + * @param [response] InstancesListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.InstancesListResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listServerCas}. + * @param error Error, if any + * @param [response] InstancesListServerCasResponse + */ + type ListServerCasCallback = (error: (Error|null), response?: google.cloud.sql.v1.InstancesListServerCasResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listServerCertificates}. + * @param error Error, if any + * @param [response] InstancesListServerCertificatesResponse + */ + type ListServerCertificatesCallback = (error: (Error|null), response?: google.cloud.sql.v1.InstancesListServerCertificatesResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listEntraIdCertificates}. + * @param error Error, if any + * @param [response] InstancesListEntraIdCertificatesResponse + */ + type ListEntraIdCertificatesCallback = (error: (Error|null), response?: google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|patch}. + * @param error Error, if any + * @param [response] Operation + */ + type PatchCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|promoteReplica}. + * @param error Error, if any + * @param [response] Operation + */ + type PromoteReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|switchover}. + * @param error Error, if any + * @param [response] Operation + */ + type SwitchoverCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|resetSslConfig}. + * @param error Error, if any + * @param [response] Operation + */ + type ResetSslConfigCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|restart}. + * @param error Error, if any + * @param [response] Operation + */ + type RestartCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|restoreBackup}. + * @param error Error, if any + * @param [response] Operation + */ + type RestoreBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateServerCa}. + * @param error Error, if any + * @param [response] Operation + */ + type RotateServerCaCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateServerCertificate}. + * @param error Error, if any + * @param [response] Operation + */ + type RotateServerCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateEntraIdCertificate}. + * @param error Error, if any + * @param [response] Operation + */ + type RotateEntraIdCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|startReplica}. + * @param error Error, if any + * @param [response] Operation + */ + type StartReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|stopReplica}. + * @param error Error, if any + * @param [response] Operation + */ + type StopReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|truncateLog}. + * @param error Error, if any + * @param [response] Operation + */ + type TruncateLogCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|update}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|createEphemeral}. + * @param error Error, if any + * @param [response] SslCert + */ + type CreateEphemeralCallback = (error: (Error|null), response?: google.cloud.sql.v1.SslCert) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rescheduleMaintenance}. + * @param error Error, if any + * @param [response] Operation + */ + type RescheduleMaintenanceCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|verifyExternalSyncSettings}. + * @param error Error, if any + * @param [response] SqlInstancesVerifyExternalSyncSettingsResponse + */ + type VerifyExternalSyncSettingsCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|startExternalSync}. + * @param error Error, if any + * @param [response] Operation + */ + type StartExternalSyncCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|performDiskShrink}. + * @param error Error, if any + * @param [response] Operation + */ + type PerformDiskShrinkCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|getDiskShrinkConfig}. + * @param error Error, if any + * @param [response] SqlInstancesGetDiskShrinkConfigResponse + */ + type GetDiskShrinkConfigCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|resetReplicaSize}. + * @param error Error, if any + * @param [response] Operation + */ + type ResetReplicaSizeCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|getLatestRecoveryTime}. + * @param error Error, if any + * @param [response] SqlInstancesGetLatestRecoveryTimeResponse + */ + type GetLatestRecoveryTimeCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|executeSql}. + * @param error Error, if any + * @param [response] SqlInstancesExecuteSqlResponse + */ + type ExecuteSqlCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|acquireSsrsLease}. + * @param error Error, if any + * @param [response] SqlInstancesAcquireSsrsLeaseResponse + */ + type AcquireSsrsLeaseCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|releaseSsrsLease}. + * @param error Error, if any + * @param [response] SqlInstancesReleaseSsrsLeaseResponse + */ + type ReleaseSsrsLeaseCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|preCheckMajorVersionUpgrade}. + * @param error Error, if any + * @param [response] Operation + */ + type PreCheckMajorVersionUpgradeCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|pointInTimeRestore}. + * @param error Error, if any + * @param [response] Operation + */ + type PointInTimeRestoreCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + } + + /** Properties of a SqlInstancesAddServerCaRequest. */ + interface ISqlInstancesAddServerCaRequest { + + /** SqlInstancesAddServerCaRequest instance */ + instance?: (string|null); + + /** SqlInstancesAddServerCaRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesAddServerCaRequest. */ + class SqlInstancesAddServerCaRequest implements ISqlInstancesAddServerCaRequest { + + /** + * Constructs a new SqlInstancesAddServerCaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest); + + /** SqlInstancesAddServerCaRequest instance. */ + public instance: string; + + /** SqlInstancesAddServerCaRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesAddServerCaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesAddServerCaRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest): google.cloud.sql.v1.SqlInstancesAddServerCaRequest; + + /** + * Encodes the specified SqlInstancesAddServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCaRequest.verify|verify} messages. + * @param message SqlInstancesAddServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesAddServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCaRequest.verify|verify} messages. + * @param message SqlInstancesAddServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesAddServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesAddServerCaRequest; + + /** + * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesAddServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesAddServerCaRequest; + + /** + * Verifies a SqlInstancesAddServerCaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesAddServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesAddServerCaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesAddServerCaRequest; + + /** + * Creates a plain object from a SqlInstancesAddServerCaRequest message. Also converts values to other types if specified. + * @param message SqlInstancesAddServerCaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesAddServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesAddServerCaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesAddServerCaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesAddServerCertificateRequest. */ + interface ISqlInstancesAddServerCertificateRequest { + + /** SqlInstancesAddServerCertificateRequest instance */ + instance?: (string|null); + + /** SqlInstancesAddServerCertificateRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesAddServerCertificateRequest. */ + class SqlInstancesAddServerCertificateRequest implements ISqlInstancesAddServerCertificateRequest { + + /** + * Constructs a new SqlInstancesAddServerCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest); + + /** SqlInstancesAddServerCertificateRequest instance. */ + public instance: string; + + /** SqlInstancesAddServerCertificateRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesAddServerCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesAddServerCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest): google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest; + + /** + * Encodes the specified SqlInstancesAddServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest.verify|verify} messages. + * @param message SqlInstancesAddServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesAddServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest.verify|verify} messages. + * @param message SqlInstancesAddServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesAddServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest; + + /** + * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesAddServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest; + + /** + * Verifies a SqlInstancesAddServerCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesAddServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesAddServerCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest; + + /** + * Creates a plain object from a SqlInstancesAddServerCertificateRequest message. Also converts values to other types if specified. + * @param message SqlInstancesAddServerCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesAddServerCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesAddServerCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesAddEntraIdCertificateRequest. */ + interface ISqlInstancesAddEntraIdCertificateRequest { + + /** SqlInstancesAddEntraIdCertificateRequest instance */ + instance?: (string|null); + + /** SqlInstancesAddEntraIdCertificateRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesAddEntraIdCertificateRequest. */ + class SqlInstancesAddEntraIdCertificateRequest implements ISqlInstancesAddEntraIdCertificateRequest { + + /** + * Constructs a new SqlInstancesAddEntraIdCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest); + + /** SqlInstancesAddEntraIdCertificateRequest instance. */ + public instance: string; + + /** SqlInstancesAddEntraIdCertificateRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesAddEntraIdCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesAddEntraIdCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest): google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest; + + /** + * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. + * @param message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. + * @param message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesAddEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest; + + /** + * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesAddEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest; + + /** + * Verifies a SqlInstancesAddEntraIdCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesAddEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesAddEntraIdCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest; + + /** + * Creates a plain object from a SqlInstancesAddEntraIdCertificateRequest message. Also converts values to other types if specified. + * @param message SqlInstancesAddEntraIdCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesAddEntraIdCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesAddEntraIdCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesCloneRequest. */ + interface ISqlInstancesCloneRequest { + + /** SqlInstancesCloneRequest instance */ + instance?: (string|null); + + /** SqlInstancesCloneRequest project */ + project?: (string|null); + + /** SqlInstancesCloneRequest body */ + body?: (google.cloud.sql.v1.IInstancesCloneRequest|null); + } + + /** Represents a SqlInstancesCloneRequest. */ + class SqlInstancesCloneRequest implements ISqlInstancesCloneRequest { + + /** + * Constructs a new SqlInstancesCloneRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesCloneRequest); + + /** SqlInstancesCloneRequest instance. */ + public instance: string; + + /** SqlInstancesCloneRequest project. */ + public project: string; + + /** SqlInstancesCloneRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesCloneRequest|null); + + /** + * Creates a new SqlInstancesCloneRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesCloneRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesCloneRequest): google.cloud.sql.v1.SqlInstancesCloneRequest; + + /** + * Encodes the specified SqlInstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCloneRequest.verify|verify} messages. + * @param message SqlInstancesCloneRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCloneRequest.verify|verify} messages. + * @param message SqlInstancesCloneRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesCloneRequest; + + /** + * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesCloneRequest; + + /** + * Verifies a SqlInstancesCloneRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesCloneRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesCloneRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesCloneRequest; + + /** + * Creates a plain object from a SqlInstancesCloneRequest message. Also converts values to other types if specified. + * @param message SqlInstancesCloneRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesCloneRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesCloneRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesCloneRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesDeleteRequest. */ + interface ISqlInstancesDeleteRequest { + + /** SqlInstancesDeleteRequest instance */ + instance?: (string|null); + + /** SqlInstancesDeleteRequest project */ + project?: (string|null); + + /** SqlInstancesDeleteRequest enableFinalBackup */ + enableFinalBackup?: (boolean|null); + + /** SqlInstancesDeleteRequest finalBackupTtlDays */ + finalBackupTtlDays?: (number|Long|string|null); + + /** SqlInstancesDeleteRequest finalBackupExpiryTime */ + finalBackupExpiryTime?: (google.protobuf.ITimestamp|null); + + /** SqlInstancesDeleteRequest finalBackupDescription */ + finalBackupDescription?: (string|null); + } + + /** Represents a SqlInstancesDeleteRequest. */ + class SqlInstancesDeleteRequest implements ISqlInstancesDeleteRequest { + + /** + * Constructs a new SqlInstancesDeleteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesDeleteRequest); + + /** SqlInstancesDeleteRequest instance. */ + public instance: string; + + /** SqlInstancesDeleteRequest project. */ + public project: string; + + /** SqlInstancesDeleteRequest enableFinalBackup. */ + public enableFinalBackup?: (boolean|null); + + /** SqlInstancesDeleteRequest finalBackupTtlDays. */ + public finalBackupTtlDays?: (number|Long|string|null); + + /** SqlInstancesDeleteRequest finalBackupExpiryTime. */ + public finalBackupExpiryTime?: (google.protobuf.ITimestamp|null); + + /** SqlInstancesDeleteRequest finalBackupDescription. */ + public finalBackupDescription: string; + + /** SqlInstancesDeleteRequest expiration. */ + public expiration?: ("finalBackupTtlDays"|"finalBackupExpiryTime"); + + /** + * Creates a new SqlInstancesDeleteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesDeleteRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesDeleteRequest): google.cloud.sql.v1.SqlInstancesDeleteRequest; + + /** + * Encodes the specified SqlInstancesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDeleteRequest.verify|verify} messages. + * @param message SqlInstancesDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDeleteRequest.verify|verify} messages. + * @param message SqlInstancesDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesDeleteRequest; + + /** + * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesDeleteRequest; + + /** + * Verifies a SqlInstancesDeleteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesDeleteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesDeleteRequest; + + /** + * Creates a plain object from a SqlInstancesDeleteRequest message. Also converts values to other types if specified. + * @param message SqlInstancesDeleteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesDeleteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesDeleteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesDemoteMasterRequest. */ + interface ISqlInstancesDemoteMasterRequest { + + /** SqlInstancesDemoteMasterRequest instance */ + instance?: (string|null); + + /** SqlInstancesDemoteMasterRequest project */ + project?: (string|null); + + /** SqlInstancesDemoteMasterRequest body */ + body?: (google.cloud.sql.v1.IInstancesDemoteMasterRequest|null); + } + + /** Represents a SqlInstancesDemoteMasterRequest. */ + class SqlInstancesDemoteMasterRequest implements ISqlInstancesDemoteMasterRequest { + + /** + * Constructs a new SqlInstancesDemoteMasterRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest); + + /** SqlInstancesDemoteMasterRequest instance. */ + public instance: string; + + /** SqlInstancesDemoteMasterRequest project. */ + public project: string; + + /** SqlInstancesDemoteMasterRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesDemoteMasterRequest|null); + + /** + * Creates a new SqlInstancesDemoteMasterRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesDemoteMasterRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest): google.cloud.sql.v1.SqlInstancesDemoteMasterRequest; + + /** + * Encodes the specified SqlInstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteMasterRequest.verify|verify} messages. + * @param message SqlInstancesDemoteMasterRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteMasterRequest.verify|verify} messages. + * @param message SqlInstancesDemoteMasterRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesDemoteMasterRequest; + + /** + * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesDemoteMasterRequest; + + /** + * Verifies a SqlInstancesDemoteMasterRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesDemoteMasterRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesDemoteMasterRequest; + + /** + * Creates a plain object from a SqlInstancesDemoteMasterRequest message. Also converts values to other types if specified. + * @param message SqlInstancesDemoteMasterRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesDemoteMasterRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesDemoteMasterRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesDemoteMasterRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesDemoteRequest. */ + interface ISqlInstancesDemoteRequest { + + /** SqlInstancesDemoteRequest instance */ + instance?: (string|null); + + /** SqlInstancesDemoteRequest project */ + project?: (string|null); + + /** SqlInstancesDemoteRequest body */ + body?: (google.cloud.sql.v1.IInstancesDemoteRequest|null); + } + + /** Represents a SqlInstancesDemoteRequest. */ + class SqlInstancesDemoteRequest implements ISqlInstancesDemoteRequest { + + /** + * Constructs a new SqlInstancesDemoteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesDemoteRequest); + + /** SqlInstancesDemoteRequest instance. */ + public instance: string; + + /** SqlInstancesDemoteRequest project. */ + public project: string; + + /** SqlInstancesDemoteRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesDemoteRequest|null); + + /** + * Creates a new SqlInstancesDemoteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesDemoteRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesDemoteRequest): google.cloud.sql.v1.SqlInstancesDemoteRequest; + + /** + * Encodes the specified SqlInstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteRequest.verify|verify} messages. + * @param message SqlInstancesDemoteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteRequest.verify|verify} messages. + * @param message SqlInstancesDemoteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesDemoteRequest; + + /** + * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesDemoteRequest; + + /** + * Verifies a SqlInstancesDemoteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesDemoteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesDemoteRequest; + + /** + * Creates a plain object from a SqlInstancesDemoteRequest message. Also converts values to other types if specified. + * @param message SqlInstancesDemoteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesDemoteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesDemoteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesDemoteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesExportRequest. */ + interface ISqlInstancesExportRequest { + + /** SqlInstancesExportRequest instance */ + instance?: (string|null); + + /** SqlInstancesExportRequest project */ + project?: (string|null); + + /** SqlInstancesExportRequest body */ + body?: (google.cloud.sql.v1.IInstancesExportRequest|null); + } + + /** Represents a SqlInstancesExportRequest. */ + class SqlInstancesExportRequest implements ISqlInstancesExportRequest { + + /** + * Constructs a new SqlInstancesExportRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesExportRequest); + + /** SqlInstancesExportRequest instance. */ + public instance: string; + + /** SqlInstancesExportRequest project. */ + public project: string; + + /** SqlInstancesExportRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesExportRequest|null); + + /** + * Creates a new SqlInstancesExportRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesExportRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesExportRequest): google.cloud.sql.v1.SqlInstancesExportRequest; + + /** + * Encodes the specified SqlInstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExportRequest.verify|verify} messages. + * @param message SqlInstancesExportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExportRequest.verify|verify} messages. + * @param message SqlInstancesExportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesExportRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesExportRequest; + + /** + * Decodes a SqlInstancesExportRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesExportRequest; + + /** + * Verifies a SqlInstancesExportRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesExportRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesExportRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesExportRequest; + + /** + * Creates a plain object from a SqlInstancesExportRequest message. Also converts values to other types if specified. + * @param message SqlInstancesExportRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesExportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesExportRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesExportRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesFailoverRequest. */ + interface ISqlInstancesFailoverRequest { + + /** SqlInstancesFailoverRequest instance */ + instance?: (string|null); + + /** SqlInstancesFailoverRequest project */ + project?: (string|null); + + /** SqlInstancesFailoverRequest body */ + body?: (google.cloud.sql.v1.IInstancesFailoverRequest|null); + } + + /** Represents a SqlInstancesFailoverRequest. */ + class SqlInstancesFailoverRequest implements ISqlInstancesFailoverRequest { + + /** + * Constructs a new SqlInstancesFailoverRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesFailoverRequest); + + /** SqlInstancesFailoverRequest instance. */ + public instance: string; + + /** SqlInstancesFailoverRequest project. */ + public project: string; + + /** SqlInstancesFailoverRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesFailoverRequest|null); + + /** + * Creates a new SqlInstancesFailoverRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesFailoverRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesFailoverRequest): google.cloud.sql.v1.SqlInstancesFailoverRequest; + + /** + * Encodes the specified SqlInstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesFailoverRequest.verify|verify} messages. + * @param message SqlInstancesFailoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesFailoverRequest.verify|verify} messages. + * @param message SqlInstancesFailoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesFailoverRequest; + + /** + * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesFailoverRequest; + + /** + * Verifies a SqlInstancesFailoverRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesFailoverRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesFailoverRequest; + + /** + * Creates a plain object from a SqlInstancesFailoverRequest message. Also converts values to other types if specified. + * @param message SqlInstancesFailoverRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesFailoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesFailoverRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesFailoverRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesGetRequest. */ + interface ISqlInstancesGetRequest { + + /** SqlInstancesGetRequest instance */ + instance?: (string|null); + + /** SqlInstancesGetRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesGetRequest. */ + class SqlInstancesGetRequest implements ISqlInstancesGetRequest { + + /** + * Constructs a new SqlInstancesGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesGetRequest); + + /** SqlInstancesGetRequest instance. */ + public instance: string; + + /** SqlInstancesGetRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesGetRequest): google.cloud.sql.v1.SqlInstancesGetRequest; + + /** + * Encodes the specified SqlInstancesGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetRequest.verify|verify} messages. + * @param message SqlInstancesGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetRequest.verify|verify} messages. + * @param message SqlInstancesGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesGetRequest; + + /** + * Decodes a SqlInstancesGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesGetRequest; + + /** + * Verifies a SqlInstancesGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesGetRequest; + + /** + * Creates a plain object from a SqlInstancesGetRequest message. Also converts values to other types if specified. + * @param message SqlInstancesGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesImportRequest. */ + interface ISqlInstancesImportRequest { + + /** SqlInstancesImportRequest instance */ + instance?: (string|null); + + /** SqlInstancesImportRequest project */ + project?: (string|null); + + /** SqlInstancesImportRequest body */ + body?: (google.cloud.sql.v1.IInstancesImportRequest|null); + } + + /** Represents a SqlInstancesImportRequest. */ + class SqlInstancesImportRequest implements ISqlInstancesImportRequest { + + /** + * Constructs a new SqlInstancesImportRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesImportRequest); + + /** SqlInstancesImportRequest instance. */ + public instance: string; + + /** SqlInstancesImportRequest project. */ + public project: string; + + /** SqlInstancesImportRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesImportRequest|null); + + /** + * Creates a new SqlInstancesImportRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesImportRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesImportRequest): google.cloud.sql.v1.SqlInstancesImportRequest; + + /** + * Encodes the specified SqlInstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesImportRequest.verify|verify} messages. + * @param message SqlInstancesImportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesImportRequest.verify|verify} messages. + * @param message SqlInstancesImportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesImportRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesImportRequest; + + /** + * Decodes a SqlInstancesImportRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesImportRequest; + + /** + * Verifies a SqlInstancesImportRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesImportRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesImportRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesImportRequest; + + /** + * Creates a plain object from a SqlInstancesImportRequest message. Also converts values to other types if specified. + * @param message SqlInstancesImportRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesImportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesImportRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesImportRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesInsertRequest. */ + interface ISqlInstancesInsertRequest { + + /** SqlInstancesInsertRequest project */ + project?: (string|null); + + /** SqlInstancesInsertRequest body */ + body?: (google.cloud.sql.v1.IDatabaseInstance|null); + } + + /** Represents a SqlInstancesInsertRequest. */ + class SqlInstancesInsertRequest implements ISqlInstancesInsertRequest { + + /** + * Constructs a new SqlInstancesInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesInsertRequest); + + /** SqlInstancesInsertRequest project. */ + public project: string; + + /** SqlInstancesInsertRequest body. */ + public body?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** + * Creates a new SqlInstancesInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesInsertRequest): google.cloud.sql.v1.SqlInstancesInsertRequest; + + /** + * Encodes the specified SqlInstancesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesInsertRequest.verify|verify} messages. + * @param message SqlInstancesInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesInsertRequest.verify|verify} messages. + * @param message SqlInstancesInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesInsertRequest; + + /** + * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesInsertRequest; + + /** + * Verifies a SqlInstancesInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesInsertRequest; + + /** + * Creates a plain object from a SqlInstancesInsertRequest message. Also converts values to other types if specified. + * @param message SqlInstancesInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesListRequest. */ + interface ISqlInstancesListRequest { + + /** SqlInstancesListRequest filter */ + filter?: (string|null); + + /** SqlInstancesListRequest maxResults */ + maxResults?: (number|null); + + /** SqlInstancesListRequest pageToken */ + pageToken?: (string|null); + + /** SqlInstancesListRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesListRequest. */ + class SqlInstancesListRequest implements ISqlInstancesListRequest { + + /** + * Constructs a new SqlInstancesListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesListRequest); + + /** SqlInstancesListRequest filter. */ + public filter: string; + + /** SqlInstancesListRequest maxResults. */ + public maxResults: number; + + /** SqlInstancesListRequest pageToken. */ + public pageToken: string; + + /** SqlInstancesListRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesListRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesListRequest): google.cloud.sql.v1.SqlInstancesListRequest; + + /** + * Encodes the specified SqlInstancesListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListRequest.verify|verify} messages. + * @param message SqlInstancesListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListRequest.verify|verify} messages. + * @param message SqlInstancesListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesListRequest; + + /** + * Decodes a SqlInstancesListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesListRequest; + + /** + * Verifies a SqlInstancesListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesListRequest; + + /** + * Creates a plain object from a SqlInstancesListRequest message. Also converts values to other types if specified. + * @param message SqlInstancesListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesListServerCasRequest. */ + interface ISqlInstancesListServerCasRequest { + + /** SqlInstancesListServerCasRequest instance */ + instance?: (string|null); + + /** SqlInstancesListServerCasRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesListServerCasRequest. */ + class SqlInstancesListServerCasRequest implements ISqlInstancesListServerCasRequest { + + /** + * Constructs a new SqlInstancesListServerCasRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesListServerCasRequest); + + /** SqlInstancesListServerCasRequest instance. */ + public instance: string; + + /** SqlInstancesListServerCasRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesListServerCasRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesListServerCasRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesListServerCasRequest): google.cloud.sql.v1.SqlInstancesListServerCasRequest; + + /** + * Encodes the specified SqlInstancesListServerCasRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCasRequest.verify|verify} messages. + * @param message SqlInstancesListServerCasRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesListServerCasRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesListServerCasRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCasRequest.verify|verify} messages. + * @param message SqlInstancesListServerCasRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesListServerCasRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesListServerCasRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesListServerCasRequest; + + /** + * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesListServerCasRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesListServerCasRequest; + + /** + * Verifies a SqlInstancesListServerCasRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesListServerCasRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesListServerCasRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesListServerCasRequest; + + /** + * Creates a plain object from a SqlInstancesListServerCasRequest message. Also converts values to other types if specified. + * @param message SqlInstancesListServerCasRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesListServerCasRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesListServerCasRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesListServerCasRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesListServerCertificatesRequest. */ + interface ISqlInstancesListServerCertificatesRequest { + + /** SqlInstancesListServerCertificatesRequest instance */ + instance?: (string|null); + + /** SqlInstancesListServerCertificatesRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesListServerCertificatesRequest. */ + class SqlInstancesListServerCertificatesRequest implements ISqlInstancesListServerCertificatesRequest { + + /** + * Constructs a new SqlInstancesListServerCertificatesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest); + + /** SqlInstancesListServerCertificatesRequest instance. */ + public instance: string; + + /** SqlInstancesListServerCertificatesRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesListServerCertificatesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesListServerCertificatesRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest): google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest; + + /** + * Encodes the specified SqlInstancesListServerCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest.verify|verify} messages. + * @param message SqlInstancesListServerCertificatesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesListServerCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest.verify|verify} messages. + * @param message SqlInstancesListServerCertificatesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesListServerCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest; + + /** + * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesListServerCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest; + + /** + * Verifies a SqlInstancesListServerCertificatesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesListServerCertificatesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesListServerCertificatesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest; + + /** + * Creates a plain object from a SqlInstancesListServerCertificatesRequest message. Also converts values to other types if specified. + * @param message SqlInstancesListServerCertificatesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesListServerCertificatesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesListServerCertificatesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesListEntraIdCertificatesRequest. */ + interface ISqlInstancesListEntraIdCertificatesRequest { + + /** SqlInstancesListEntraIdCertificatesRequest instance */ + instance?: (string|null); + + /** SqlInstancesListEntraIdCertificatesRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesListEntraIdCertificatesRequest. */ + class SqlInstancesListEntraIdCertificatesRequest implements ISqlInstancesListEntraIdCertificatesRequest { + + /** + * Constructs a new SqlInstancesListEntraIdCertificatesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest); + + /** SqlInstancesListEntraIdCertificatesRequest instance. */ + public instance: string; + + /** SqlInstancesListEntraIdCertificatesRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesListEntraIdCertificatesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesListEntraIdCertificatesRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest): google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest; + + /** + * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. + * @param message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. + * @param message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesListEntraIdCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest; + + /** + * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesListEntraIdCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest; + + /** + * Verifies a SqlInstancesListEntraIdCertificatesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesListEntraIdCertificatesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesListEntraIdCertificatesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest; + + /** + * Creates a plain object from a SqlInstancesListEntraIdCertificatesRequest message. Also converts values to other types if specified. + * @param message SqlInstancesListEntraIdCertificatesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesListEntraIdCertificatesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesListEntraIdCertificatesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesPatchRequest. */ + interface ISqlInstancesPatchRequest { + + /** SqlInstancesPatchRequest instance */ + instance?: (string|null); + + /** SqlInstancesPatchRequest project */ + project?: (string|null); + + /** SqlInstancesPatchRequest body */ + body?: (google.cloud.sql.v1.IDatabaseInstance|null); + } + + /** Represents a SqlInstancesPatchRequest. */ + class SqlInstancesPatchRequest implements ISqlInstancesPatchRequest { + + /** + * Constructs a new SqlInstancesPatchRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesPatchRequest); + + /** SqlInstancesPatchRequest instance. */ + public instance: string; + + /** SqlInstancesPatchRequest project. */ + public project: string; + + /** SqlInstancesPatchRequest body. */ + public body?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** + * Creates a new SqlInstancesPatchRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesPatchRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesPatchRequest): google.cloud.sql.v1.SqlInstancesPatchRequest; + + /** + * Encodes the specified SqlInstancesPatchRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPatchRequest.verify|verify} messages. + * @param message SqlInstancesPatchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesPatchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesPatchRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPatchRequest.verify|verify} messages. + * @param message SqlInstancesPatchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesPatchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesPatchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesPatchRequest; + + /** + * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesPatchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesPatchRequest; + + /** + * Verifies a SqlInstancesPatchRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesPatchRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesPatchRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesPatchRequest; + + /** + * Creates a plain object from a SqlInstancesPatchRequest message. Also converts values to other types if specified. + * @param message SqlInstancesPatchRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesPatchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesPatchRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesPatchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesPromoteReplicaRequest. */ + interface ISqlInstancesPromoteReplicaRequest { + + /** SqlInstancesPromoteReplicaRequest instance */ + instance?: (string|null); + + /** SqlInstancesPromoteReplicaRequest project */ + project?: (string|null); + + /** SqlInstancesPromoteReplicaRequest failover */ + failover?: (boolean|null); + } + + /** Represents a SqlInstancesPromoteReplicaRequest. */ + class SqlInstancesPromoteReplicaRequest implements ISqlInstancesPromoteReplicaRequest { + + /** + * Constructs a new SqlInstancesPromoteReplicaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest); + + /** SqlInstancesPromoteReplicaRequest instance. */ + public instance: string; + + /** SqlInstancesPromoteReplicaRequest project. */ + public project: string; + + /** SqlInstancesPromoteReplicaRequest failover. */ + public failover: boolean; + + /** + * Creates a new SqlInstancesPromoteReplicaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesPromoteReplicaRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest): google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest; + + /** + * Encodes the specified SqlInstancesPromoteReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest.verify|verify} messages. + * @param message SqlInstancesPromoteReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesPromoteReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest.verify|verify} messages. + * @param message SqlInstancesPromoteReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesPromoteReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest; + + /** + * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesPromoteReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest; + + /** + * Verifies a SqlInstancesPromoteReplicaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesPromoteReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesPromoteReplicaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest; + + /** + * Creates a plain object from a SqlInstancesPromoteReplicaRequest message. Also converts values to other types if specified. + * @param message SqlInstancesPromoteReplicaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesPromoteReplicaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesPromoteReplicaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesSwitchoverRequest. */ + interface ISqlInstancesSwitchoverRequest { + + /** SqlInstancesSwitchoverRequest instance */ + instance?: (string|null); + + /** SqlInstancesSwitchoverRequest project */ + project?: (string|null); + + /** SqlInstancesSwitchoverRequest dbTimeout */ + dbTimeout?: (google.protobuf.IDuration|null); + } + + /** Represents a SqlInstancesSwitchoverRequest. */ + class SqlInstancesSwitchoverRequest implements ISqlInstancesSwitchoverRequest { + + /** + * Constructs a new SqlInstancesSwitchoverRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest); + + /** SqlInstancesSwitchoverRequest instance. */ + public instance: string; + + /** SqlInstancesSwitchoverRequest project. */ + public project: string; + + /** SqlInstancesSwitchoverRequest dbTimeout. */ + public dbTimeout?: (google.protobuf.IDuration|null); + + /** + * Creates a new SqlInstancesSwitchoverRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesSwitchoverRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest): google.cloud.sql.v1.SqlInstancesSwitchoverRequest; + + /** + * Encodes the specified SqlInstancesSwitchoverRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesSwitchoverRequest.verify|verify} messages. + * @param message SqlInstancesSwitchoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesSwitchoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesSwitchoverRequest.verify|verify} messages. + * @param message SqlInstancesSwitchoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesSwitchoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesSwitchoverRequest; + + /** + * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesSwitchoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesSwitchoverRequest; + + /** + * Verifies a SqlInstancesSwitchoverRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesSwitchoverRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesSwitchoverRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesSwitchoverRequest; + + /** + * Creates a plain object from a SqlInstancesSwitchoverRequest message. Also converts values to other types if specified. + * @param message SqlInstancesSwitchoverRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesSwitchoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesSwitchoverRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesSwitchoverRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesResetSslConfigRequest. */ + interface ISqlInstancesResetSslConfigRequest { + + /** SqlInstancesResetSslConfigRequest instance */ + instance?: (string|null); + + /** SqlInstancesResetSslConfigRequest project */ + project?: (string|null); + + /** SqlInstancesResetSslConfigRequest mode */ + mode?: (google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode|keyof typeof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode|null); + } + + /** Represents a SqlInstancesResetSslConfigRequest. */ + class SqlInstancesResetSslConfigRequest implements ISqlInstancesResetSslConfigRequest { + + /** + * Constructs a new SqlInstancesResetSslConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest); + + /** SqlInstancesResetSslConfigRequest instance. */ + public instance: string; + + /** SqlInstancesResetSslConfigRequest project. */ + public project: string; + + /** SqlInstancesResetSslConfigRequest mode. */ + public mode: (google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode|keyof typeof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode); + + /** + * Creates a new SqlInstancesResetSslConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesResetSslConfigRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest): google.cloud.sql.v1.SqlInstancesResetSslConfigRequest; + + /** + * Encodes the specified SqlInstancesResetSslConfigRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.verify|verify} messages. + * @param message SqlInstancesResetSslConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesResetSslConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.verify|verify} messages. + * @param message SqlInstancesResetSslConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesResetSslConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesResetSslConfigRequest; + + /** + * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesResetSslConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesResetSslConfigRequest; + + /** + * Verifies a SqlInstancesResetSslConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesResetSslConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesResetSslConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesResetSslConfigRequest; + + /** + * Creates a plain object from a SqlInstancesResetSslConfigRequest message. Also converts values to other types if specified. + * @param message SqlInstancesResetSslConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesResetSslConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesResetSslConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesResetSslConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlInstancesResetSslConfigRequest { + + /** ResetSslMode enum. */ + enum ResetSslMode { + RESET_SSL_MODE_UNSPECIFIED = 0, + ALL = 1, + SYNC_FROM_PRIMARY = 2 + } + } + + /** Properties of a SqlInstancesRestartRequest. */ + interface ISqlInstancesRestartRequest { + + /** SqlInstancesRestartRequest instance */ + instance?: (string|null); + + /** SqlInstancesRestartRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesRestartRequest. */ + class SqlInstancesRestartRequest implements ISqlInstancesRestartRequest { + + /** + * Constructs a new SqlInstancesRestartRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesRestartRequest); + + /** SqlInstancesRestartRequest instance. */ + public instance: string; + + /** SqlInstancesRestartRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesRestartRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRestartRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesRestartRequest): google.cloud.sql.v1.SqlInstancesRestartRequest; + + /** + * Encodes the specified SqlInstancesRestartRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestartRequest.verify|verify} messages. + * @param message SqlInstancesRestartRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesRestartRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRestartRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestartRequest.verify|verify} messages. + * @param message SqlInstancesRestartRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRestartRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRestartRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRestartRequest; + + /** + * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRestartRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRestartRequest; + + /** + * Verifies a SqlInstancesRestartRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRestartRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRestartRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRestartRequest; + + /** + * Creates a plain object from a SqlInstancesRestartRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRestartRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesRestartRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRestartRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRestartRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRestoreBackupRequest. */ + interface ISqlInstancesRestoreBackupRequest { + + /** SqlInstancesRestoreBackupRequest instance */ + instance?: (string|null); + + /** SqlInstancesRestoreBackupRequest project */ + project?: (string|null); + + /** SqlInstancesRestoreBackupRequest body */ + body?: (google.cloud.sql.v1.IInstancesRestoreBackupRequest|null); + } + + /** Represents a SqlInstancesRestoreBackupRequest. */ + class SqlInstancesRestoreBackupRequest implements ISqlInstancesRestoreBackupRequest { + + /** + * Constructs a new SqlInstancesRestoreBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest); + + /** SqlInstancesRestoreBackupRequest instance. */ + public instance: string; + + /** SqlInstancesRestoreBackupRequest project. */ + public project: string; + + /** SqlInstancesRestoreBackupRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesRestoreBackupRequest|null); + + /** + * Creates a new SqlInstancesRestoreBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRestoreBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest): google.cloud.sql.v1.SqlInstancesRestoreBackupRequest; + + /** + * Encodes the specified SqlInstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestoreBackupRequest.verify|verify} messages. + * @param message SqlInstancesRestoreBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestoreBackupRequest.verify|verify} messages. + * @param message SqlInstancesRestoreBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRestoreBackupRequest; + + /** + * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRestoreBackupRequest; + + /** + * Verifies a SqlInstancesRestoreBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRestoreBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRestoreBackupRequest; + + /** + * Creates a plain object from a SqlInstancesRestoreBackupRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRestoreBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesRestoreBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRestoreBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRestoreBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRotateServerCaRequest. */ + interface ISqlInstancesRotateServerCaRequest { + + /** SqlInstancesRotateServerCaRequest instance */ + instance?: (string|null); + + /** SqlInstancesRotateServerCaRequest project */ + project?: (string|null); + + /** SqlInstancesRotateServerCaRequest body */ + body?: (google.cloud.sql.v1.IInstancesRotateServerCaRequest|null); + } + + /** Represents a SqlInstancesRotateServerCaRequest. */ + class SqlInstancesRotateServerCaRequest implements ISqlInstancesRotateServerCaRequest { + + /** + * Constructs a new SqlInstancesRotateServerCaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest); + + /** SqlInstancesRotateServerCaRequest instance. */ + public instance: string; + + /** SqlInstancesRotateServerCaRequest project. */ + public project: string; + + /** SqlInstancesRotateServerCaRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesRotateServerCaRequest|null); + + /** + * Creates a new SqlInstancesRotateServerCaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRotateServerCaRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest): google.cloud.sql.v1.SqlInstancesRotateServerCaRequest; + + /** + * Encodes the specified SqlInstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCaRequest.verify|verify} messages. + * @param message SqlInstancesRotateServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCaRequest.verify|verify} messages. + * @param message SqlInstancesRotateServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRotateServerCaRequest; + + /** + * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRotateServerCaRequest; + + /** + * Verifies a SqlInstancesRotateServerCaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRotateServerCaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRotateServerCaRequest; + + /** + * Creates a plain object from a SqlInstancesRotateServerCaRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRotateServerCaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesRotateServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRotateServerCaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRotateServerCaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRotateServerCertificateRequest. */ + interface ISqlInstancesRotateServerCertificateRequest { + + /** SqlInstancesRotateServerCertificateRequest instance */ + instance?: (string|null); + + /** SqlInstancesRotateServerCertificateRequest project */ + project?: (string|null); + + /** SqlInstancesRotateServerCertificateRequest body */ + body?: (google.cloud.sql.v1.IInstancesRotateServerCertificateRequest|null); + } + + /** Represents a SqlInstancesRotateServerCertificateRequest. */ + class SqlInstancesRotateServerCertificateRequest implements ISqlInstancesRotateServerCertificateRequest { + + /** + * Constructs a new SqlInstancesRotateServerCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest); + + /** SqlInstancesRotateServerCertificateRequest instance. */ + public instance: string; + + /** SqlInstancesRotateServerCertificateRequest project. */ + public project: string; + + /** SqlInstancesRotateServerCertificateRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesRotateServerCertificateRequest|null); + + /** + * Creates a new SqlInstancesRotateServerCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRotateServerCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest): google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest; + + /** + * Encodes the specified SqlInstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. + * @param message SqlInstancesRotateServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. + * @param message SqlInstancesRotateServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest; + + /** + * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest; + + /** + * Verifies a SqlInstancesRotateServerCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRotateServerCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest; + + /** + * Creates a plain object from a SqlInstancesRotateServerCertificateRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRotateServerCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRotateServerCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRotateServerCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRotateEntraIdCertificateRequest. */ + interface ISqlInstancesRotateEntraIdCertificateRequest { + + /** SqlInstancesRotateEntraIdCertificateRequest instance */ + instance?: (string|null); + + /** SqlInstancesRotateEntraIdCertificateRequest project */ + project?: (string|null); + + /** SqlInstancesRotateEntraIdCertificateRequest body */ + body?: (google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest|null); + } + + /** Represents a SqlInstancesRotateEntraIdCertificateRequest. */ + class SqlInstancesRotateEntraIdCertificateRequest implements ISqlInstancesRotateEntraIdCertificateRequest { + + /** + * Constructs a new SqlInstancesRotateEntraIdCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest); + + /** SqlInstancesRotateEntraIdCertificateRequest instance. */ + public instance: string; + + /** SqlInstancesRotateEntraIdCertificateRequest project. */ + public project: string; + + /** SqlInstancesRotateEntraIdCertificateRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest|null); + + /** + * Creates a new SqlInstancesRotateEntraIdCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRotateEntraIdCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest): google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest; + + /** + * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @param message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @param message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest; + + /** + * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest; + + /** + * Verifies a SqlInstancesRotateEntraIdCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRotateEntraIdCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest; + + /** + * Creates a plain object from a SqlInstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRotateEntraIdCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRotateEntraIdCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRotateEntraIdCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesStartReplicaRequest. */ + interface ISqlInstancesStartReplicaRequest { + + /** SqlInstancesStartReplicaRequest instance */ + instance?: (string|null); + + /** SqlInstancesStartReplicaRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesStartReplicaRequest. */ + class SqlInstancesStartReplicaRequest implements ISqlInstancesStartReplicaRequest { + + /** + * Constructs a new SqlInstancesStartReplicaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest); + + /** SqlInstancesStartReplicaRequest instance. */ + public instance: string; + + /** SqlInstancesStartReplicaRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesStartReplicaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesStartReplicaRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest): google.cloud.sql.v1.SqlInstancesStartReplicaRequest; + + /** + * Encodes the specified SqlInstancesStartReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartReplicaRequest.verify|verify} messages. + * @param message SqlInstancesStartReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesStartReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartReplicaRequest.verify|verify} messages. + * @param message SqlInstancesStartReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesStartReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesStartReplicaRequest; + + /** + * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesStartReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesStartReplicaRequest; + + /** + * Verifies a SqlInstancesStartReplicaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesStartReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesStartReplicaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesStartReplicaRequest; + + /** + * Creates a plain object from a SqlInstancesStartReplicaRequest message. Also converts values to other types if specified. + * @param message SqlInstancesStartReplicaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesStartReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesStartReplicaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesStartReplicaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesStopReplicaRequest. */ + interface ISqlInstancesStopReplicaRequest { + + /** SqlInstancesStopReplicaRequest instance */ + instance?: (string|null); + + /** SqlInstancesStopReplicaRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesStopReplicaRequest. */ + class SqlInstancesStopReplicaRequest implements ISqlInstancesStopReplicaRequest { + + /** + * Constructs a new SqlInstancesStopReplicaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest); + + /** SqlInstancesStopReplicaRequest instance. */ + public instance: string; + + /** SqlInstancesStopReplicaRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesStopReplicaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesStopReplicaRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest): google.cloud.sql.v1.SqlInstancesStopReplicaRequest; + + /** + * Encodes the specified SqlInstancesStopReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStopReplicaRequest.verify|verify} messages. + * @param message SqlInstancesStopReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesStopReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStopReplicaRequest.verify|verify} messages. + * @param message SqlInstancesStopReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesStopReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesStopReplicaRequest; + + /** + * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesStopReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesStopReplicaRequest; + + /** + * Verifies a SqlInstancesStopReplicaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesStopReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesStopReplicaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesStopReplicaRequest; + + /** + * Creates a plain object from a SqlInstancesStopReplicaRequest message. Also converts values to other types if specified. + * @param message SqlInstancesStopReplicaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesStopReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesStopReplicaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesStopReplicaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesTruncateLogRequest. */ + interface ISqlInstancesTruncateLogRequest { + + /** SqlInstancesTruncateLogRequest instance */ + instance?: (string|null); + + /** SqlInstancesTruncateLogRequest project */ + project?: (string|null); + + /** SqlInstancesTruncateLogRequest body */ + body?: (google.cloud.sql.v1.IInstancesTruncateLogRequest|null); + } + + /** Represents a SqlInstancesTruncateLogRequest. */ + class SqlInstancesTruncateLogRequest implements ISqlInstancesTruncateLogRequest { + + /** + * Constructs a new SqlInstancesTruncateLogRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest); + + /** SqlInstancesTruncateLogRequest instance. */ + public instance: string; + + /** SqlInstancesTruncateLogRequest project. */ + public project: string; + + /** SqlInstancesTruncateLogRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesTruncateLogRequest|null); + + /** + * Creates a new SqlInstancesTruncateLogRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesTruncateLogRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest): google.cloud.sql.v1.SqlInstancesTruncateLogRequest; + + /** + * Encodes the specified SqlInstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesTruncateLogRequest.verify|verify} messages. + * @param message SqlInstancesTruncateLogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesTruncateLogRequest.verify|verify} messages. + * @param message SqlInstancesTruncateLogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesTruncateLogRequest; + + /** + * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesTruncateLogRequest; + + /** + * Verifies a SqlInstancesTruncateLogRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesTruncateLogRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesTruncateLogRequest; + + /** + * Creates a plain object from a SqlInstancesTruncateLogRequest message. Also converts values to other types if specified. + * @param message SqlInstancesTruncateLogRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesTruncateLogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesTruncateLogRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesTruncateLogRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesPerformDiskShrinkRequest. */ + interface ISqlInstancesPerformDiskShrinkRequest { + + /** SqlInstancesPerformDiskShrinkRequest instance */ + instance?: (string|null); + + /** SqlInstancesPerformDiskShrinkRequest project */ + project?: (string|null); + + /** SqlInstancesPerformDiskShrinkRequest body */ + body?: (google.cloud.sql.v1.IPerformDiskShrinkContext|null); + } + + /** Represents a SqlInstancesPerformDiskShrinkRequest. */ + class SqlInstancesPerformDiskShrinkRequest implements ISqlInstancesPerformDiskShrinkRequest { + + /** + * Constructs a new SqlInstancesPerformDiskShrinkRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest); + + /** SqlInstancesPerformDiskShrinkRequest instance. */ + public instance: string; + + /** SqlInstancesPerformDiskShrinkRequest project. */ + public project: string; + + /** SqlInstancesPerformDiskShrinkRequest body. */ + public body?: (google.cloud.sql.v1.IPerformDiskShrinkContext|null); + + /** + * Creates a new SqlInstancesPerformDiskShrinkRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesPerformDiskShrinkRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest): google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest; + + /** + * Encodes the specified SqlInstancesPerformDiskShrinkRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. + * @param message SqlInstancesPerformDiskShrinkRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesPerformDiskShrinkRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. + * @param message SqlInstancesPerformDiskShrinkRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesPerformDiskShrinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest; + + /** + * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesPerformDiskShrinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest; + + /** + * Verifies a SqlInstancesPerformDiskShrinkRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesPerformDiskShrinkRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesPerformDiskShrinkRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest; + + /** + * Creates a plain object from a SqlInstancesPerformDiskShrinkRequest message. Also converts values to other types if specified. + * @param message SqlInstancesPerformDiskShrinkRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesPerformDiskShrinkRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesPerformDiskShrinkRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesUpdateRequest. */ + interface ISqlInstancesUpdateRequest { + + /** SqlInstancesUpdateRequest instance */ + instance?: (string|null); + + /** SqlInstancesUpdateRequest project */ + project?: (string|null); + + /** SqlInstancesUpdateRequest body */ + body?: (google.cloud.sql.v1.IDatabaseInstance|null); + } + + /** Represents a SqlInstancesUpdateRequest. */ + class SqlInstancesUpdateRequest implements ISqlInstancesUpdateRequest { + + /** + * Constructs a new SqlInstancesUpdateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesUpdateRequest); + + /** SqlInstancesUpdateRequest instance. */ + public instance: string; + + /** SqlInstancesUpdateRequest project. */ + public project: string; + + /** SqlInstancesUpdateRequest body. */ + public body?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** + * Creates a new SqlInstancesUpdateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesUpdateRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesUpdateRequest): google.cloud.sql.v1.SqlInstancesUpdateRequest; + + /** + * Encodes the specified SqlInstancesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesUpdateRequest.verify|verify} messages. + * @param message SqlInstancesUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesUpdateRequest.verify|verify} messages. + * @param message SqlInstancesUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesUpdateRequest; + + /** + * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesUpdateRequest; + + /** + * Verifies a SqlInstancesUpdateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesUpdateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesUpdateRequest; + + /** + * Creates a plain object from a SqlInstancesUpdateRequest message. Also converts values to other types if specified. + * @param message SqlInstancesUpdateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesUpdateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesUpdateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRescheduleMaintenanceRequest. */ + interface ISqlInstancesRescheduleMaintenanceRequest { + + /** SqlInstancesRescheduleMaintenanceRequest instance */ + instance?: (string|null); + + /** SqlInstancesRescheduleMaintenanceRequest project */ + project?: (string|null); + + /** SqlInstancesRescheduleMaintenanceRequest body */ + body?: (google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody|null); + } + + /** Represents a SqlInstancesRescheduleMaintenanceRequest. */ + class SqlInstancesRescheduleMaintenanceRequest implements ISqlInstancesRescheduleMaintenanceRequest { + + /** + * Constructs a new SqlInstancesRescheduleMaintenanceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest); + + /** SqlInstancesRescheduleMaintenanceRequest instance. */ + public instance: string; + + /** SqlInstancesRescheduleMaintenanceRequest project. */ + public project: string; + + /** SqlInstancesRescheduleMaintenanceRequest body. */ + public body?: (google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody|null); + + /** + * Creates a new SqlInstancesRescheduleMaintenanceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRescheduleMaintenanceRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. + * @param message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. + * @param message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRescheduleMaintenanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRescheduleMaintenanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest; + + /** + * Verifies a SqlInstancesRescheduleMaintenanceRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRescheduleMaintenanceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRescheduleMaintenanceRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest; + + /** + * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRescheduleMaintenanceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRescheduleMaintenanceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRescheduleMaintenanceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesReencryptRequest. */ + interface ISqlInstancesReencryptRequest { + + /** SqlInstancesReencryptRequest instance */ + instance?: (string|null); + + /** SqlInstancesReencryptRequest project */ + project?: (string|null); + + /** SqlInstancesReencryptRequest body */ + body?: (google.cloud.sql.v1.IInstancesReencryptRequest|null); + } + + /** Represents a SqlInstancesReencryptRequest. */ + class SqlInstancesReencryptRequest implements ISqlInstancesReencryptRequest { + + /** + * Constructs a new SqlInstancesReencryptRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesReencryptRequest); + + /** SqlInstancesReencryptRequest instance. */ + public instance: string; + + /** SqlInstancesReencryptRequest project. */ + public project: string; + + /** SqlInstancesReencryptRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesReencryptRequest|null); + + /** + * Creates a new SqlInstancesReencryptRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesReencryptRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesReencryptRequest): google.cloud.sql.v1.SqlInstancesReencryptRequest; + + /** + * Encodes the specified SqlInstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReencryptRequest.verify|verify} messages. + * @param message SqlInstancesReencryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReencryptRequest.verify|verify} messages. + * @param message SqlInstancesReencryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesReencryptRequest; + + /** + * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesReencryptRequest; + + /** + * Verifies a SqlInstancesReencryptRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesReencryptRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesReencryptRequest; + + /** + * Creates a plain object from a SqlInstancesReencryptRequest message. Also converts values to other types if specified. + * @param message SqlInstancesReencryptRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesReencryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesReencryptRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesReencryptRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesReencryptRequest. */ + interface IInstancesReencryptRequest { + + /** InstancesReencryptRequest backupReencryptionConfig */ + backupReencryptionConfig?: (google.cloud.sql.v1.IBackupReencryptionConfig|null); + } + + /** Represents an InstancesReencryptRequest. */ + class InstancesReencryptRequest implements IInstancesReencryptRequest { + + /** + * Constructs a new InstancesReencryptRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesReencryptRequest); + + /** InstancesReencryptRequest backupReencryptionConfig. */ + public backupReencryptionConfig?: (google.cloud.sql.v1.IBackupReencryptionConfig|null); + + /** + * Creates a new InstancesReencryptRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesReencryptRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesReencryptRequest): google.cloud.sql.v1.InstancesReencryptRequest; + + /** + * Encodes the specified InstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesReencryptRequest.verify|verify} messages. + * @param message InstancesReencryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesReencryptRequest.verify|verify} messages. + * @param message InstancesReencryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesReencryptRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesReencryptRequest; + + /** + * Decodes an InstancesReencryptRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesReencryptRequest; + + /** + * Verifies an InstancesReencryptRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesReencryptRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesReencryptRequest; + + /** + * Creates a plain object from an InstancesReencryptRequest message. Also converts values to other types if specified. + * @param message InstancesReencryptRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesReencryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesReencryptRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesReencryptRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupReencryptionConfig. */ + interface IBackupReencryptionConfig { + + /** BackupReencryptionConfig backupLimit */ + backupLimit?: (number|null); + + /** BackupReencryptionConfig backupType */ + backupType?: (google.cloud.sql.v1.BackupReencryptionConfig.BackupType|keyof typeof google.cloud.sql.v1.BackupReencryptionConfig.BackupType|null); + } + + /** Represents a BackupReencryptionConfig. */ + class BackupReencryptionConfig implements IBackupReencryptionConfig { + + /** + * Constructs a new BackupReencryptionConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IBackupReencryptionConfig); + + /** BackupReencryptionConfig backupLimit. */ + public backupLimit?: (number|null); + + /** BackupReencryptionConfig backupType. */ + public backupType?: (google.cloud.sql.v1.BackupReencryptionConfig.BackupType|keyof typeof google.cloud.sql.v1.BackupReencryptionConfig.BackupType|null); + + /** + * Creates a new BackupReencryptionConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupReencryptionConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IBackupReencryptionConfig): google.cloud.sql.v1.BackupReencryptionConfig; + + /** + * Encodes the specified BackupReencryptionConfig message. Does not implicitly {@link google.cloud.sql.v1.BackupReencryptionConfig.verify|verify} messages. + * @param message BackupReencryptionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IBackupReencryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupReencryptionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupReencryptionConfig.verify|verify} messages. + * @param message BackupReencryptionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IBackupReencryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupReencryptionConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupReencryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupReencryptionConfig; + + /** + * Decodes a BackupReencryptionConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupReencryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupReencryptionConfig; + + /** + * Verifies a BackupReencryptionConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupReencryptionConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupReencryptionConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupReencryptionConfig; + + /** + * Creates a plain object from a BackupReencryptionConfig message. Also converts values to other types if specified. + * @param message BackupReencryptionConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.BackupReencryptionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupReencryptionConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupReencryptionConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BackupReencryptionConfig { + + /** BackupType enum. */ + enum BackupType { + BACKUP_TYPE_UNSPECIFIED = 0, + AUTOMATED = 1, + ON_DEMAND = 2 + } + } + + /** ExternalSyncParallelLevel enum. */ + enum ExternalSyncParallelLevel { + EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED = 0, + MIN = 1, + OPTIMAL = 2, + MAX = 3 + } + + /** Properties of an ExternalSyncSelectedObject. */ + interface IExternalSyncSelectedObject { + + /** ExternalSyncSelectedObject database */ + database?: (string|null); + } + + /** Represents an ExternalSyncSelectedObject. */ + class ExternalSyncSelectedObject implements IExternalSyncSelectedObject { + + /** + * Constructs a new ExternalSyncSelectedObject. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IExternalSyncSelectedObject); + + /** ExternalSyncSelectedObject database. */ + public database: string; + + /** + * Creates a new ExternalSyncSelectedObject instance using the specified properties. + * @param [properties] Properties to set + * @returns ExternalSyncSelectedObject instance + */ + public static create(properties?: google.cloud.sql.v1.IExternalSyncSelectedObject): google.cloud.sql.v1.ExternalSyncSelectedObject; + + /** + * Encodes the specified ExternalSyncSelectedObject message. Does not implicitly {@link google.cloud.sql.v1.ExternalSyncSelectedObject.verify|verify} messages. + * @param message ExternalSyncSelectedObject message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IExternalSyncSelectedObject, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExternalSyncSelectedObject message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExternalSyncSelectedObject.verify|verify} messages. + * @param message ExternalSyncSelectedObject message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IExternalSyncSelectedObject, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExternalSyncSelectedObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExternalSyncSelectedObject; + + /** + * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExternalSyncSelectedObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExternalSyncSelectedObject; + + /** + * Verifies an ExternalSyncSelectedObject message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExternalSyncSelectedObject message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExternalSyncSelectedObject + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExternalSyncSelectedObject; + + /** + * Creates a plain object from an ExternalSyncSelectedObject message. Also converts values to other types if specified. + * @param message ExternalSyncSelectedObject + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ExternalSyncSelectedObject, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExternalSyncSelectedObject to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExternalSyncSelectedObject + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesGetDiskShrinkConfigRequest. */ + interface ISqlInstancesGetDiskShrinkConfigRequest { + + /** SqlInstancesGetDiskShrinkConfigRequest instance */ + instance?: (string|null); + + /** SqlInstancesGetDiskShrinkConfigRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesGetDiskShrinkConfigRequest. */ + class SqlInstancesGetDiskShrinkConfigRequest implements ISqlInstancesGetDiskShrinkConfigRequest { + + /** + * Constructs a new SqlInstancesGetDiskShrinkConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest); + + /** SqlInstancesGetDiskShrinkConfigRequest instance. */ + public instance: string; + + /** SqlInstancesGetDiskShrinkConfigRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesGetDiskShrinkConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesGetDiskShrinkConfigRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. + * @param message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. + * @param message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesGetDiskShrinkConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesGetDiskShrinkConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest; + + /** + * Verifies a SqlInstancesGetDiskShrinkConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesGetDiskShrinkConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesGetDiskShrinkConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest; + + /** + * Creates a plain object from a SqlInstancesGetDiskShrinkConfigRequest message. Also converts values to other types if specified. + * @param message SqlInstancesGetDiskShrinkConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesGetDiskShrinkConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesGetDiskShrinkConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesVerifyExternalSyncSettingsRequest. */ + interface ISqlInstancesVerifyExternalSyncSettingsRequest { + + /** SqlInstancesVerifyExternalSyncSettingsRequest instance */ + instance?: (string|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest project */ + project?: (string|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly */ + verifyConnectionOnly?: (boolean|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest syncMode */ + syncMode?: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly */ + verifyReplicationOnly?: (boolean|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig */ + mysqlSyncConfig?: (google.cloud.sql.v1.IMySqlSyncConfig|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest migrationType */ + migrationType?: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel */ + syncParallelLevel?: (google.cloud.sql.v1.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1.ExternalSyncParallelLevel|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects */ + selectedObjects?: (google.cloud.sql.v1.IExternalSyncSelectedObject[]|null); + } + + /** Represents a SqlInstancesVerifyExternalSyncSettingsRequest. */ + class SqlInstancesVerifyExternalSyncSettingsRequest implements ISqlInstancesVerifyExternalSyncSettingsRequest { + + /** + * Constructs a new SqlInstancesVerifyExternalSyncSettingsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest); + + /** SqlInstancesVerifyExternalSyncSettingsRequest instance. */ + public instance: string; + + /** SqlInstancesVerifyExternalSyncSettingsRequest project. */ + public project: string; + + /** SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly. */ + public verifyConnectionOnly: boolean; + + /** SqlInstancesVerifyExternalSyncSettingsRequest syncMode. */ + public syncMode: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode); + + /** SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly. */ + public verifyReplicationOnly: boolean; + + /** SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig. */ + public mysqlSyncConfig?: (google.cloud.sql.v1.IMySqlSyncConfig|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest migrationType. */ + public migrationType: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType); + + /** SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel. */ + public syncParallelLevel: (google.cloud.sql.v1.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1.ExternalSyncParallelLevel); + + /** SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects. */ + public selectedObjects: google.cloud.sql.v1.IExternalSyncSelectedObject[]; + + /** SqlInstancesVerifyExternalSyncSettingsRequest syncConfig. */ + public syncConfig?: "mysqlSyncConfig"; + + /** + * Creates a new SqlInstancesVerifyExternalSyncSettingsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesVerifyExternalSyncSettingsRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. + * @param message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. + * @param message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesVerifyExternalSyncSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesVerifyExternalSyncSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest; + + /** + * Verifies a SqlInstancesVerifyExternalSyncSettingsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesVerifyExternalSyncSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesVerifyExternalSyncSettingsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest; + + /** + * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsRequest message. Also converts values to other types if specified. + * @param message SqlInstancesVerifyExternalSyncSettingsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesVerifyExternalSyncSettingsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlInstancesVerifyExternalSyncSettingsRequest { + + /** ExternalSyncMode enum. */ + enum ExternalSyncMode { + EXTERNAL_SYNC_MODE_UNSPECIFIED = 0, + ONLINE = 1, + OFFLINE = 2 + } + + /** MigrationType enum. */ + enum MigrationType { + MIGRATION_TYPE_UNSPECIFIED = 0, + LOGICAL = 1, + PHYSICAL = 2 + } + } + + /** Properties of a SqlInstancesStartExternalSyncRequest. */ + interface ISqlInstancesStartExternalSyncRequest { + + /** SqlInstancesStartExternalSyncRequest instance */ + instance?: (string|null); + + /** SqlInstancesStartExternalSyncRequest project */ + project?: (string|null); + + /** SqlInstancesStartExternalSyncRequest syncMode */ + syncMode?: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null); + + /** SqlInstancesStartExternalSyncRequest skipVerification */ + skipVerification?: (boolean|null); + + /** SqlInstancesStartExternalSyncRequest mysqlSyncConfig */ + mysqlSyncConfig?: (google.cloud.sql.v1.IMySqlSyncConfig|null); + + /** SqlInstancesStartExternalSyncRequest syncParallelLevel */ + syncParallelLevel?: (google.cloud.sql.v1.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1.ExternalSyncParallelLevel|null); + + /** SqlInstancesStartExternalSyncRequest migrationType */ + migrationType?: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null); + + /** SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled */ + replicaOverwriteEnabled?: (boolean|null); + } + + /** Represents a SqlInstancesStartExternalSyncRequest. */ + class SqlInstancesStartExternalSyncRequest implements ISqlInstancesStartExternalSyncRequest { + + /** + * Constructs a new SqlInstancesStartExternalSyncRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest); + + /** SqlInstancesStartExternalSyncRequest instance. */ + public instance: string; + + /** SqlInstancesStartExternalSyncRequest project. */ + public project: string; + + /** SqlInstancesStartExternalSyncRequest syncMode. */ + public syncMode: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode); + + /** SqlInstancesStartExternalSyncRequest skipVerification. */ + public skipVerification: boolean; + + /** SqlInstancesStartExternalSyncRequest mysqlSyncConfig. */ + public mysqlSyncConfig?: (google.cloud.sql.v1.IMySqlSyncConfig|null); + + /** SqlInstancesStartExternalSyncRequest syncParallelLevel. */ + public syncParallelLevel: (google.cloud.sql.v1.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1.ExternalSyncParallelLevel); + + /** SqlInstancesStartExternalSyncRequest migrationType. */ + public migrationType: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType); + + /** SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled. */ + public replicaOverwriteEnabled: boolean; + + /** SqlInstancesStartExternalSyncRequest syncConfig. */ + public syncConfig?: "mysqlSyncConfig"; + + /** + * Creates a new SqlInstancesStartExternalSyncRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesStartExternalSyncRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest): google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest; + + /** + * Encodes the specified SqlInstancesStartExternalSyncRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.verify|verify} messages. + * @param message SqlInstancesStartExternalSyncRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesStartExternalSyncRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.verify|verify} messages. + * @param message SqlInstancesStartExternalSyncRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesStartExternalSyncRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest; + + /** + * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesStartExternalSyncRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest; + + /** + * Verifies a SqlInstancesStartExternalSyncRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesStartExternalSyncRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesStartExternalSyncRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest; + + /** + * Creates a plain object from a SqlInstancesStartExternalSyncRequest message. Also converts values to other types if specified. + * @param message SqlInstancesStartExternalSyncRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesStartExternalSyncRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesStartExternalSyncRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesResetReplicaSizeRequest. */ + interface ISqlInstancesResetReplicaSizeRequest { + + /** SqlInstancesResetReplicaSizeRequest instance */ + instance?: (string|null); + + /** SqlInstancesResetReplicaSizeRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesResetReplicaSizeRequest. */ + class SqlInstancesResetReplicaSizeRequest implements ISqlInstancesResetReplicaSizeRequest { + + /** + * Constructs a new SqlInstancesResetReplicaSizeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest); + + /** SqlInstancesResetReplicaSizeRequest instance. */ + public instance: string; + + /** SqlInstancesResetReplicaSizeRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesResetReplicaSizeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesResetReplicaSizeRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest): google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest; + + /** + * Encodes the specified SqlInstancesResetReplicaSizeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. + * @param message SqlInstancesResetReplicaSizeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesResetReplicaSizeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. + * @param message SqlInstancesResetReplicaSizeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesResetReplicaSizeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest; + + /** + * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesResetReplicaSizeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest; + + /** + * Verifies a SqlInstancesResetReplicaSizeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesResetReplicaSizeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesResetReplicaSizeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest; + + /** + * Creates a plain object from a SqlInstancesResetReplicaSizeRequest message. Also converts values to other types if specified. + * @param message SqlInstancesResetReplicaSizeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesResetReplicaSizeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesResetReplicaSizeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesCreateEphemeralCertRequest. */ + interface ISqlInstancesCreateEphemeralCertRequest { + + /** SqlInstancesCreateEphemeralCertRequest instance */ + instance?: (string|null); + + /** SqlInstancesCreateEphemeralCertRequest project */ + project?: (string|null); + + /** SqlInstancesCreateEphemeralCertRequest body */ + body?: (google.cloud.sql.v1.ISslCertsCreateEphemeralRequest|null); + } + + /** Represents a SqlInstancesCreateEphemeralCertRequest. */ + class SqlInstancesCreateEphemeralCertRequest implements ISqlInstancesCreateEphemeralCertRequest { + + /** + * Constructs a new SqlInstancesCreateEphemeralCertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest); + + /** SqlInstancesCreateEphemeralCertRequest instance. */ + public instance: string; + + /** SqlInstancesCreateEphemeralCertRequest project. */ + public project: string; + + /** SqlInstancesCreateEphemeralCertRequest body. */ + public body?: (google.cloud.sql.v1.ISslCertsCreateEphemeralRequest|null); + + /** + * Creates a new SqlInstancesCreateEphemeralCertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesCreateEphemeralCertRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest): google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest; + + /** + * Encodes the specified SqlInstancesCreateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. + * @param message SqlInstancesCreateEphemeralCertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesCreateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. + * @param message SqlInstancesCreateEphemeralCertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesCreateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest; + + /** + * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesCreateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest; + + /** + * Verifies a SqlInstancesCreateEphemeralCertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesCreateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesCreateEphemeralCertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest; + + /** + * Creates a plain object from a SqlInstancesCreateEphemeralCertRequest message. Also converts values to other types if specified. + * @param message SqlInstancesCreateEphemeralCertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesCreateEphemeralCertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesCreateEphemeralCertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesCloneRequest. */ + interface IInstancesCloneRequest { + + /** InstancesCloneRequest cloneContext */ + cloneContext?: (google.cloud.sql.v1.ICloneContext|null); + } + + /** Represents an InstancesCloneRequest. */ + class InstancesCloneRequest implements IInstancesCloneRequest { + + /** + * Constructs a new InstancesCloneRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesCloneRequest); + + /** InstancesCloneRequest cloneContext. */ + public cloneContext?: (google.cloud.sql.v1.ICloneContext|null); + + /** + * Creates a new InstancesCloneRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesCloneRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesCloneRequest): google.cloud.sql.v1.InstancesCloneRequest; + + /** + * Encodes the specified InstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesCloneRequest.verify|verify} messages. + * @param message InstancesCloneRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesCloneRequest.verify|verify} messages. + * @param message InstancesCloneRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesCloneRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesCloneRequest; + + /** + * Decodes an InstancesCloneRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesCloneRequest; + + /** + * Verifies an InstancesCloneRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesCloneRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesCloneRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesCloneRequest; + + /** + * Creates a plain object from an InstancesCloneRequest message. Also converts values to other types if specified. + * @param message InstancesCloneRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesCloneRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesCloneRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesCloneRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesDemoteMasterRequest. */ + interface IInstancesDemoteMasterRequest { + + /** InstancesDemoteMasterRequest demoteMasterContext */ + demoteMasterContext?: (google.cloud.sql.v1.IDemoteMasterContext|null); + } + + /** Represents an InstancesDemoteMasterRequest. */ + class InstancesDemoteMasterRequest implements IInstancesDemoteMasterRequest { + + /** + * Constructs a new InstancesDemoteMasterRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesDemoteMasterRequest); + + /** InstancesDemoteMasterRequest demoteMasterContext. */ + public demoteMasterContext?: (google.cloud.sql.v1.IDemoteMasterContext|null); + + /** + * Creates a new InstancesDemoteMasterRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesDemoteMasterRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesDemoteMasterRequest): google.cloud.sql.v1.InstancesDemoteMasterRequest; + + /** + * Encodes the specified InstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteMasterRequest.verify|verify} messages. + * @param message InstancesDemoteMasterRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteMasterRequest.verify|verify} messages. + * @param message InstancesDemoteMasterRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesDemoteMasterRequest; + + /** + * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesDemoteMasterRequest; + + /** + * Verifies an InstancesDemoteMasterRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesDemoteMasterRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesDemoteMasterRequest; + + /** + * Creates a plain object from an InstancesDemoteMasterRequest message. Also converts values to other types if specified. + * @param message InstancesDemoteMasterRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesDemoteMasterRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesDemoteMasterRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesDemoteMasterRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesDemoteRequest. */ + interface IInstancesDemoteRequest { + + /** InstancesDemoteRequest demoteContext */ + demoteContext?: (google.cloud.sql.v1.IDemoteContext|null); + } + + /** Represents an InstancesDemoteRequest. */ + class InstancesDemoteRequest implements IInstancesDemoteRequest { + + /** + * Constructs a new InstancesDemoteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesDemoteRequest); + + /** InstancesDemoteRequest demoteContext. */ + public demoteContext?: (google.cloud.sql.v1.IDemoteContext|null); + + /** + * Creates a new InstancesDemoteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesDemoteRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesDemoteRequest): google.cloud.sql.v1.InstancesDemoteRequest; + + /** + * Encodes the specified InstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteRequest.verify|verify} messages. + * @param message InstancesDemoteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteRequest.verify|verify} messages. + * @param message InstancesDemoteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesDemoteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesDemoteRequest; + + /** + * Decodes an InstancesDemoteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesDemoteRequest; + + /** + * Verifies an InstancesDemoteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesDemoteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesDemoteRequest; + + /** + * Creates a plain object from an InstancesDemoteRequest message. Also converts values to other types if specified. + * @param message InstancesDemoteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesDemoteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesDemoteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesDemoteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesExportRequest. */ + interface IInstancesExportRequest { + + /** InstancesExportRequest exportContext */ + exportContext?: (google.cloud.sql.v1.IExportContext|null); + } + + /** Represents an InstancesExportRequest. */ + class InstancesExportRequest implements IInstancesExportRequest { + + /** + * Constructs a new InstancesExportRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesExportRequest); + + /** InstancesExportRequest exportContext. */ + public exportContext?: (google.cloud.sql.v1.IExportContext|null); + + /** + * Creates a new InstancesExportRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesExportRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesExportRequest): google.cloud.sql.v1.InstancesExportRequest; + + /** + * Encodes the specified InstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesExportRequest.verify|verify} messages. + * @param message InstancesExportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesExportRequest.verify|verify} messages. + * @param message InstancesExportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesExportRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesExportRequest; + + /** + * Decodes an InstancesExportRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesExportRequest; + + /** + * Verifies an InstancesExportRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesExportRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesExportRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesExportRequest; + + /** + * Creates a plain object from an InstancesExportRequest message. Also converts values to other types if specified. + * @param message InstancesExportRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesExportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesExportRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesExportRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesFailoverRequest. */ + interface IInstancesFailoverRequest { + + /** InstancesFailoverRequest failoverContext */ + failoverContext?: (google.cloud.sql.v1.IFailoverContext|null); + } + + /** Represents an InstancesFailoverRequest. */ + class InstancesFailoverRequest implements IInstancesFailoverRequest { + + /** + * Constructs a new InstancesFailoverRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesFailoverRequest); + + /** InstancesFailoverRequest failoverContext. */ + public failoverContext?: (google.cloud.sql.v1.IFailoverContext|null); + + /** + * Creates a new InstancesFailoverRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesFailoverRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesFailoverRequest): google.cloud.sql.v1.InstancesFailoverRequest; + + /** + * Encodes the specified InstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesFailoverRequest.verify|verify} messages. + * @param message InstancesFailoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesFailoverRequest.verify|verify} messages. + * @param message InstancesFailoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesFailoverRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesFailoverRequest; + + /** + * Decodes an InstancesFailoverRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesFailoverRequest; + + /** + * Verifies an InstancesFailoverRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesFailoverRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesFailoverRequest; + + /** + * Creates a plain object from an InstancesFailoverRequest message. Also converts values to other types if specified. + * @param message InstancesFailoverRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesFailoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesFailoverRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesFailoverRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCertsCreateEphemeralRequest. */ + interface ISslCertsCreateEphemeralRequest { + + /** SslCertsCreateEphemeralRequest publicKey */ + publicKey?: (string|null); + + /** SslCertsCreateEphemeralRequest accessToken */ + accessToken?: (string|null); + } + + /** Represents a SslCertsCreateEphemeralRequest. */ + class SslCertsCreateEphemeralRequest implements ISslCertsCreateEphemeralRequest { + + /** + * Constructs a new SslCertsCreateEphemeralRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISslCertsCreateEphemeralRequest); + + /** SslCertsCreateEphemeralRequest publicKey. */ + public publicKey: string; + + /** SslCertsCreateEphemeralRequest accessToken. */ + public accessToken: string; + + /** + * Creates a new SslCertsCreateEphemeralRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCertsCreateEphemeralRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISslCertsCreateEphemeralRequest): google.cloud.sql.v1.SslCertsCreateEphemeralRequest; + + /** + * Encodes the specified SslCertsCreateEphemeralRequest message. Does not implicitly {@link google.cloud.sql.v1.SslCertsCreateEphemeralRequest.verify|verify} messages. + * @param message SslCertsCreateEphemeralRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISslCertsCreateEphemeralRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCertsCreateEphemeralRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsCreateEphemeralRequest.verify|verify} messages. + * @param message SslCertsCreateEphemeralRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISslCertsCreateEphemeralRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCertsCreateEphemeralRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCertsCreateEphemeralRequest; + + /** + * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCertsCreateEphemeralRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCertsCreateEphemeralRequest; + + /** + * Verifies a SslCertsCreateEphemeralRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCertsCreateEphemeralRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCertsCreateEphemeralRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCertsCreateEphemeralRequest; + + /** + * Creates a plain object from a SslCertsCreateEphemeralRequest message. Also converts values to other types if specified. + * @param message SslCertsCreateEphemeralRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SslCertsCreateEphemeralRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCertsCreateEphemeralRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCertsCreateEphemeralRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesImportRequest. */ + interface IInstancesImportRequest { + + /** InstancesImportRequest importContext */ + importContext?: (google.cloud.sql.v1.IImportContext|null); + } + + /** Represents an InstancesImportRequest. */ + class InstancesImportRequest implements IInstancesImportRequest { + + /** + * Constructs a new InstancesImportRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesImportRequest); + + /** InstancesImportRequest importContext. */ + public importContext?: (google.cloud.sql.v1.IImportContext|null); + + /** + * Creates a new InstancesImportRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesImportRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesImportRequest): google.cloud.sql.v1.InstancesImportRequest; + + /** + * Encodes the specified InstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesImportRequest.verify|verify} messages. + * @param message InstancesImportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesImportRequest.verify|verify} messages. + * @param message InstancesImportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesImportRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesImportRequest; + + /** + * Decodes an InstancesImportRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesImportRequest; + + /** + * Verifies an InstancesImportRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesImportRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesImportRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesImportRequest; + + /** + * Creates a plain object from an InstancesImportRequest message. Also converts values to other types if specified. + * @param message InstancesImportRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesImportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesImportRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesImportRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesPreCheckMajorVersionUpgradeRequest. */ + interface IInstancesPreCheckMajorVersionUpgradeRequest { + + /** InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext */ + preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null); + } + + /** Represents an InstancesPreCheckMajorVersionUpgradeRequest. */ + class InstancesPreCheckMajorVersionUpgradeRequest implements IInstancesPreCheckMajorVersionUpgradeRequest { + + /** + * Constructs a new InstancesPreCheckMajorVersionUpgradeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest); + + /** InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext. */ + public preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null); + + /** + * Creates a new InstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesPreCheckMajorVersionUpgradeRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest): google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @param message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @param message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Verifies an InstancesPreCheckMajorVersionUpgradeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesPreCheckMajorVersionUpgradeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Creates a plain object from an InstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. + * @param message InstancesPreCheckMajorVersionUpgradeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesPreCheckMajorVersionUpgradeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesPreCheckMajorVersionUpgradeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesListResponse. */ + interface IInstancesListResponse { + + /** InstancesListResponse kind */ + kind?: (string|null); + + /** InstancesListResponse warnings */ + warnings?: (google.cloud.sql.v1.IApiWarning[]|null); + + /** InstancesListResponse items */ + items?: (google.cloud.sql.v1.IDatabaseInstance[]|null); + + /** InstancesListResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents an InstancesListResponse. */ + class InstancesListResponse implements IInstancesListResponse { + + /** + * Constructs a new InstancesListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesListResponse); + + /** InstancesListResponse kind. */ + public kind: string; + + /** InstancesListResponse warnings. */ + public warnings: google.cloud.sql.v1.IApiWarning[]; + + /** InstancesListResponse items. */ + public items: google.cloud.sql.v1.IDatabaseInstance[]; + + /** InstancesListResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new InstancesListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesListResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesListResponse): google.cloud.sql.v1.InstancesListResponse; + + /** + * Encodes the specified InstancesListResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListResponse.verify|verify} messages. + * @param message InstancesListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListResponse.verify|verify} messages. + * @param message InstancesListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesListResponse; + + /** + * Decodes an InstancesListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesListResponse; + + /** + * Verifies an InstancesListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesListResponse; + + /** + * Creates a plain object from an InstancesListResponse message. Also converts values to other types if specified. + * @param message InstancesListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesListServerCasResponse. */ + interface IInstancesListServerCasResponse { + + /** InstancesListServerCasResponse certs */ + certs?: (google.cloud.sql.v1.ISslCert[]|null); + + /** InstancesListServerCasResponse activeVersion */ + activeVersion?: (string|null); + + /** InstancesListServerCasResponse kind */ + kind?: (string|null); + } + + /** Represents an InstancesListServerCasResponse. */ + class InstancesListServerCasResponse implements IInstancesListServerCasResponse { + + /** + * Constructs a new InstancesListServerCasResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesListServerCasResponse); + + /** InstancesListServerCasResponse certs. */ + public certs: google.cloud.sql.v1.ISslCert[]; + + /** InstancesListServerCasResponse activeVersion. */ + public activeVersion: string; + + /** InstancesListServerCasResponse kind. */ + public kind: string; + + /** + * Creates a new InstancesListServerCasResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesListServerCasResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesListServerCasResponse): google.cloud.sql.v1.InstancesListServerCasResponse; + + /** + * Encodes the specified InstancesListServerCasResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCasResponse.verify|verify} messages. + * @param message InstancesListServerCasResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesListServerCasResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesListServerCasResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCasResponse.verify|verify} messages. + * @param message InstancesListServerCasResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesListServerCasResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesListServerCasResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesListServerCasResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesListServerCasResponse; + + /** + * Decodes an InstancesListServerCasResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesListServerCasResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesListServerCasResponse; + + /** + * Verifies an InstancesListServerCasResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesListServerCasResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesListServerCasResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesListServerCasResponse; + + /** + * Creates a plain object from an InstancesListServerCasResponse message. Also converts values to other types if specified. + * @param message InstancesListServerCasResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesListServerCasResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesListServerCasResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesListServerCasResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesListServerCertificatesResponse. */ + interface IInstancesListServerCertificatesResponse { + + /** InstancesListServerCertificatesResponse caCerts */ + caCerts?: (google.cloud.sql.v1.ISslCert[]|null); + + /** InstancesListServerCertificatesResponse serverCerts */ + serverCerts?: (google.cloud.sql.v1.ISslCert[]|null); + + /** InstancesListServerCertificatesResponse activeVersion */ + activeVersion?: (string|null); + + /** InstancesListServerCertificatesResponse kind */ + kind?: (string|null); + } + + /** Represents an InstancesListServerCertificatesResponse. */ + class InstancesListServerCertificatesResponse implements IInstancesListServerCertificatesResponse { + + /** + * Constructs a new InstancesListServerCertificatesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesListServerCertificatesResponse); + + /** InstancesListServerCertificatesResponse caCerts. */ + public caCerts: google.cloud.sql.v1.ISslCert[]; + + /** InstancesListServerCertificatesResponse serverCerts. */ + public serverCerts: google.cloud.sql.v1.ISslCert[]; + + /** InstancesListServerCertificatesResponse activeVersion. */ + public activeVersion: string; + + /** InstancesListServerCertificatesResponse kind. */ + public kind: string; + + /** + * Creates a new InstancesListServerCertificatesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesListServerCertificatesResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesListServerCertificatesResponse): google.cloud.sql.v1.InstancesListServerCertificatesResponse; + + /** + * Encodes the specified InstancesListServerCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCertificatesResponse.verify|verify} messages. + * @param message InstancesListServerCertificatesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesListServerCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesListServerCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCertificatesResponse.verify|verify} messages. + * @param message InstancesListServerCertificatesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesListServerCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesListServerCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesListServerCertificatesResponse; + + /** + * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesListServerCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesListServerCertificatesResponse; + + /** + * Verifies an InstancesListServerCertificatesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesListServerCertificatesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesListServerCertificatesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesListServerCertificatesResponse; + + /** + * Creates a plain object from an InstancesListServerCertificatesResponse message. Also converts values to other types if specified. + * @param message InstancesListServerCertificatesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesListServerCertificatesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesListServerCertificatesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesListServerCertificatesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesListEntraIdCertificatesResponse. */ + interface IInstancesListEntraIdCertificatesResponse { + + /** InstancesListEntraIdCertificatesResponse certs */ + certs?: (google.cloud.sql.v1.ISslCert[]|null); + + /** InstancesListEntraIdCertificatesResponse activeVersion */ + activeVersion?: (string|null); + + /** InstancesListEntraIdCertificatesResponse kind */ + kind?: (string|null); + } + + /** Represents an InstancesListEntraIdCertificatesResponse. */ + class InstancesListEntraIdCertificatesResponse implements IInstancesListEntraIdCertificatesResponse { + + /** + * Constructs a new InstancesListEntraIdCertificatesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse); + + /** InstancesListEntraIdCertificatesResponse certs. */ + public certs: google.cloud.sql.v1.ISslCert[]; + + /** InstancesListEntraIdCertificatesResponse activeVersion. */ + public activeVersion: string; + + /** InstancesListEntraIdCertificatesResponse kind. */ + public kind: string; + + /** + * Creates a new InstancesListEntraIdCertificatesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesListEntraIdCertificatesResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse): google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse; + + /** + * Encodes the specified InstancesListEntraIdCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.verify|verify} messages. + * @param message InstancesListEntraIdCertificatesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesListEntraIdCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.verify|verify} messages. + * @param message InstancesListEntraIdCertificatesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesListEntraIdCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse; + + /** + * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesListEntraIdCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse; + + /** + * Verifies an InstancesListEntraIdCertificatesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesListEntraIdCertificatesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesListEntraIdCertificatesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse; + + /** + * Creates a plain object from an InstancesListEntraIdCertificatesResponse message. Also converts values to other types if specified. + * @param message InstancesListEntraIdCertificatesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesListEntraIdCertificatesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesListEntraIdCertificatesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesRestoreBackupRequest. */ + interface IInstancesRestoreBackupRequest { + + /** InstancesRestoreBackupRequest restoreBackupContext */ + restoreBackupContext?: (google.cloud.sql.v1.IRestoreBackupContext|null); + + /** InstancesRestoreBackupRequest backup */ + backup?: (string|null); + + /** InstancesRestoreBackupRequest backupdrBackup */ + backupdrBackup?: (string|null); + + /** InstancesRestoreBackupRequest restoreInstanceSettings */ + restoreInstanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames */ + restoreInstanceClearOverridesFieldNames?: (string[]|null); + } + + /** Represents an InstancesRestoreBackupRequest. */ + class InstancesRestoreBackupRequest implements IInstancesRestoreBackupRequest { + + /** + * Constructs a new InstancesRestoreBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesRestoreBackupRequest); + + /** InstancesRestoreBackupRequest restoreBackupContext. */ + public restoreBackupContext?: (google.cloud.sql.v1.IRestoreBackupContext|null); + + /** InstancesRestoreBackupRequest backup. */ + public backup: string; + + /** InstancesRestoreBackupRequest backupdrBackup. */ + public backupdrBackup: string; + + /** InstancesRestoreBackupRequest restoreInstanceSettings. */ + public restoreInstanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames. */ + public restoreInstanceClearOverridesFieldNames: string[]; + + /** + * Creates a new InstancesRestoreBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesRestoreBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesRestoreBackupRequest): google.cloud.sql.v1.InstancesRestoreBackupRequest; + + /** + * Encodes the specified InstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRestoreBackupRequest.verify|verify} messages. + * @param message InstancesRestoreBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRestoreBackupRequest.verify|verify} messages. + * @param message InstancesRestoreBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesRestoreBackupRequest; + + /** + * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesRestoreBackupRequest; + + /** + * Verifies an InstancesRestoreBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesRestoreBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesRestoreBackupRequest; + + /** + * Creates a plain object from an InstancesRestoreBackupRequest message. Also converts values to other types if specified. + * @param message InstancesRestoreBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesRestoreBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesRestoreBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesRestoreBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesRotateServerCaRequest. */ + interface IInstancesRotateServerCaRequest { + + /** InstancesRotateServerCaRequest rotateServerCaContext */ + rotateServerCaContext?: (google.cloud.sql.v1.IRotateServerCaContext|null); + } + + /** Represents an InstancesRotateServerCaRequest. */ + class InstancesRotateServerCaRequest implements IInstancesRotateServerCaRequest { + + /** + * Constructs a new InstancesRotateServerCaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesRotateServerCaRequest); + + /** InstancesRotateServerCaRequest rotateServerCaContext. */ + public rotateServerCaContext?: (google.cloud.sql.v1.IRotateServerCaContext|null); + + /** + * Creates a new InstancesRotateServerCaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesRotateServerCaRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesRotateServerCaRequest): google.cloud.sql.v1.InstancesRotateServerCaRequest; + + /** + * Encodes the specified InstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCaRequest.verify|verify} messages. + * @param message InstancesRotateServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCaRequest.verify|verify} messages. + * @param message InstancesRotateServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesRotateServerCaRequest; + + /** + * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesRotateServerCaRequest; + + /** + * Verifies an InstancesRotateServerCaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesRotateServerCaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesRotateServerCaRequest; + + /** + * Creates a plain object from an InstancesRotateServerCaRequest message. Also converts values to other types if specified. + * @param message InstancesRotateServerCaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesRotateServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesRotateServerCaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesRotateServerCaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesRotateServerCertificateRequest. */ + interface IInstancesRotateServerCertificateRequest { + + /** InstancesRotateServerCertificateRequest rotateServerCertificateContext */ + rotateServerCertificateContext?: (google.cloud.sql.v1.IRotateServerCertificateContext|null); + } + + /** Represents an InstancesRotateServerCertificateRequest. */ + class InstancesRotateServerCertificateRequest implements IInstancesRotateServerCertificateRequest { + + /** + * Constructs a new InstancesRotateServerCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesRotateServerCertificateRequest); + + /** InstancesRotateServerCertificateRequest rotateServerCertificateContext. */ + public rotateServerCertificateContext?: (google.cloud.sql.v1.IRotateServerCertificateContext|null); + + /** + * Creates a new InstancesRotateServerCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesRotateServerCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesRotateServerCertificateRequest): google.cloud.sql.v1.InstancesRotateServerCertificateRequest; + + /** + * Encodes the specified InstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCertificateRequest.verify|verify} messages. + * @param message InstancesRotateServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCertificateRequest.verify|verify} messages. + * @param message InstancesRotateServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesRotateServerCertificateRequest; + + /** + * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesRotateServerCertificateRequest; + + /** + * Verifies an InstancesRotateServerCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesRotateServerCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesRotateServerCertificateRequest; + + /** + * Creates a plain object from an InstancesRotateServerCertificateRequest message. Also converts values to other types if specified. + * @param message InstancesRotateServerCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesRotateServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesRotateServerCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesRotateServerCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesRotateEntraIdCertificateRequest. */ + interface IInstancesRotateEntraIdCertificateRequest { + + /** InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext */ + rotateEntraIdCertificateContext?: (google.cloud.sql.v1.IRotateEntraIdCertificateContext|null); + } + + /** Represents an InstancesRotateEntraIdCertificateRequest. */ + class InstancesRotateEntraIdCertificateRequest implements IInstancesRotateEntraIdCertificateRequest { + + /** + * Constructs a new InstancesRotateEntraIdCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest); + + /** InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext. */ + public rotateEntraIdCertificateContext?: (google.cloud.sql.v1.IRotateEntraIdCertificateContext|null); + + /** + * Creates a new InstancesRotateEntraIdCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesRotateEntraIdCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest): google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest; + + /** + * Encodes the specified InstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @param message InstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @param message InstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest; + + /** + * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest; + + /** + * Verifies an InstancesRotateEntraIdCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesRotateEntraIdCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest; + + /** + * Creates a plain object from an InstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. + * @param message InstancesRotateEntraIdCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesRotateEntraIdCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesRotateEntraIdCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesTruncateLogRequest. */ + interface IInstancesTruncateLogRequest { + + /** InstancesTruncateLogRequest truncateLogContext */ + truncateLogContext?: (google.cloud.sql.v1.ITruncateLogContext|null); + } + + /** Represents an InstancesTruncateLogRequest. */ + class InstancesTruncateLogRequest implements IInstancesTruncateLogRequest { + + /** + * Constructs a new InstancesTruncateLogRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesTruncateLogRequest); + + /** InstancesTruncateLogRequest truncateLogContext. */ + public truncateLogContext?: (google.cloud.sql.v1.ITruncateLogContext|null); + + /** + * Creates a new InstancesTruncateLogRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesTruncateLogRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesTruncateLogRequest): google.cloud.sql.v1.InstancesTruncateLogRequest; + + /** + * Encodes the specified InstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesTruncateLogRequest.verify|verify} messages. + * @param message InstancesTruncateLogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesTruncateLogRequest.verify|verify} messages. + * @param message InstancesTruncateLogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesTruncateLogRequest; + + /** + * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesTruncateLogRequest; + + /** + * Verifies an InstancesTruncateLogRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesTruncateLogRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesTruncateLogRequest; + + /** + * Creates a plain object from an InstancesTruncateLogRequest message. Also converts values to other types if specified. + * @param message InstancesTruncateLogRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesTruncateLogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesTruncateLogRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesTruncateLogRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesAcquireSsrsLeaseRequest. */ + interface IInstancesAcquireSsrsLeaseRequest { + + /** InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext */ + acquireSsrsLeaseContext?: (google.cloud.sql.v1.IAcquireSsrsLeaseContext|null); + } + + /** Represents an InstancesAcquireSsrsLeaseRequest. */ + class InstancesAcquireSsrsLeaseRequest implements IInstancesAcquireSsrsLeaseRequest { + + /** + * Constructs a new InstancesAcquireSsrsLeaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest); + + /** InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext. */ + public acquireSsrsLeaseContext?: (google.cloud.sql.v1.IAcquireSsrsLeaseContext|null); + + /** + * Creates a new InstancesAcquireSsrsLeaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesAcquireSsrsLeaseRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest): google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest; + + /** + * Encodes the specified InstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @param message InstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @param message InstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest; + + /** + * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest; + + /** + * Verifies an InstancesAcquireSsrsLeaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesAcquireSsrsLeaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest; + + /** + * Creates a plain object from an InstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. + * @param message InstancesAcquireSsrsLeaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesAcquireSsrsLeaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesAcquireSsrsLeaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesPreCheckMajorVersionUpgradeRequest. */ + interface ISqlInstancesPreCheckMajorVersionUpgradeRequest { + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest instance */ + instance?: (string|null); + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest project */ + project?: (string|null); + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest body */ + body?: (google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest|null); + } + + /** Represents a SqlInstancesPreCheckMajorVersionUpgradeRequest. */ + class SqlInstancesPreCheckMajorVersionUpgradeRequest implements ISqlInstancesPreCheckMajorVersionUpgradeRequest { + + /** + * Constructs a new SqlInstancesPreCheckMajorVersionUpgradeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest); + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest instance. */ + public instance: string; + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest project. */ + public project: string; + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest|null); + + /** + * Creates a new SqlInstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest): google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Verifies a SqlInstancesPreCheckMajorVersionUpgradeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Creates a plain object from a SqlInstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. + * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesPreCheckMajorVersionUpgradeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesPreCheckMajorVersionUpgradeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesVerifyExternalSyncSettingsResponse. */ + interface ISqlInstancesVerifyExternalSyncSettingsResponse { + + /** SqlInstancesVerifyExternalSyncSettingsResponse kind */ + kind?: (string|null); + + /** SqlInstancesVerifyExternalSyncSettingsResponse errors */ + errors?: (google.cloud.sql.v1.ISqlExternalSyncSettingError[]|null); + + /** SqlInstancesVerifyExternalSyncSettingsResponse warnings */ + warnings?: (google.cloud.sql.v1.ISqlExternalSyncSettingError[]|null); + } + + /** Represents a SqlInstancesVerifyExternalSyncSettingsResponse. */ + class SqlInstancesVerifyExternalSyncSettingsResponse implements ISqlInstancesVerifyExternalSyncSettingsResponse { + + /** + * Constructs a new SqlInstancesVerifyExternalSyncSettingsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse); + + /** SqlInstancesVerifyExternalSyncSettingsResponse kind. */ + public kind: string; + + /** SqlInstancesVerifyExternalSyncSettingsResponse errors. */ + public errors: google.cloud.sql.v1.ISqlExternalSyncSettingError[]; + + /** SqlInstancesVerifyExternalSyncSettingsResponse warnings. */ + public warnings: google.cloud.sql.v1.ISqlExternalSyncSettingError[]; + + /** + * Creates a new SqlInstancesVerifyExternalSyncSettingsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesVerifyExternalSyncSettingsResponse instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. + * @param message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. + * @param message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesVerifyExternalSyncSettingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesVerifyExternalSyncSettingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse; + + /** + * Verifies a SqlInstancesVerifyExternalSyncSettingsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesVerifyExternalSyncSettingsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesVerifyExternalSyncSettingsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse; + + /** + * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsResponse message. Also converts values to other types if specified. + * @param message SqlInstancesVerifyExternalSyncSettingsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesVerifyExternalSyncSettingsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesGetDiskShrinkConfigResponse. */ + interface ISqlInstancesGetDiskShrinkConfigResponse { + + /** SqlInstancesGetDiskShrinkConfigResponse kind */ + kind?: (string|null); + + /** SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb */ + minimalTargetSizeGb?: (number|Long|string|null); + + /** SqlInstancesGetDiskShrinkConfigResponse message */ + message?: (string|null); + } + + /** Represents a SqlInstancesGetDiskShrinkConfigResponse. */ + class SqlInstancesGetDiskShrinkConfigResponse implements ISqlInstancesGetDiskShrinkConfigResponse { + + /** + * Constructs a new SqlInstancesGetDiskShrinkConfigResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse); + + /** SqlInstancesGetDiskShrinkConfigResponse kind. */ + public kind: string; + + /** SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb. */ + public minimalTargetSizeGb: (number|Long|string); + + /** SqlInstancesGetDiskShrinkConfigResponse message. */ + public message: string; + + /** + * Creates a new SqlInstancesGetDiskShrinkConfigResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesGetDiskShrinkConfigResponse instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. + * @param message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. + * @param message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesGetDiskShrinkConfigResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesGetDiskShrinkConfigResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse; + + /** + * Verifies a SqlInstancesGetDiskShrinkConfigResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesGetDiskShrinkConfigResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesGetDiskShrinkConfigResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse; + + /** + * Creates a plain object from a SqlInstancesGetDiskShrinkConfigResponse message. Also converts values to other types if specified. + * @param message SqlInstancesGetDiskShrinkConfigResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesGetDiskShrinkConfigResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesGetDiskShrinkConfigResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesGetLatestRecoveryTimeRequest. */ + interface ISqlInstancesGetLatestRecoveryTimeRequest { + + /** SqlInstancesGetLatestRecoveryTimeRequest instance */ + instance?: (string|null); + + /** SqlInstancesGetLatestRecoveryTimeRequest project */ + project?: (string|null); + + /** SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime */ + sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a SqlInstancesGetLatestRecoveryTimeRequest. */ + class SqlInstancesGetLatestRecoveryTimeRequest implements ISqlInstancesGetLatestRecoveryTimeRequest { + + /** + * Constructs a new SqlInstancesGetLatestRecoveryTimeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest); + + /** SqlInstancesGetLatestRecoveryTimeRequest instance. */ + public instance: string; + + /** SqlInstancesGetLatestRecoveryTimeRequest project. */ + public project: string; + + /** SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime. */ + public sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new SqlInstancesGetLatestRecoveryTimeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesGetLatestRecoveryTimeRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. + * @param message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. + * @param message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesGetLatestRecoveryTimeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesGetLatestRecoveryTimeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest; + + /** + * Verifies a SqlInstancesGetLatestRecoveryTimeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesGetLatestRecoveryTimeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesGetLatestRecoveryTimeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest; + + /** + * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeRequest message. Also converts values to other types if specified. + * @param message SqlInstancesGetLatestRecoveryTimeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesGetLatestRecoveryTimeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesGetLatestRecoveryTimeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesGetLatestRecoveryTimeResponse. */ + interface ISqlInstancesGetLatestRecoveryTimeResponse { + + /** SqlInstancesGetLatestRecoveryTimeResponse kind */ + kind?: (string|null); + + /** SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime */ + latestRecoveryTime?: (google.protobuf.ITimestamp|null); + + /** SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime */ + earliestRecoveryTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a SqlInstancesGetLatestRecoveryTimeResponse. */ + class SqlInstancesGetLatestRecoveryTimeResponse implements ISqlInstancesGetLatestRecoveryTimeResponse { + + /** + * Constructs a new SqlInstancesGetLatestRecoveryTimeResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse); + + /** SqlInstancesGetLatestRecoveryTimeResponse kind. */ + public kind: string; + + /** SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime. */ + public latestRecoveryTime?: (google.protobuf.ITimestamp|null); + + /** SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime. */ + public earliestRecoveryTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new SqlInstancesGetLatestRecoveryTimeResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesGetLatestRecoveryTimeResponse instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. + * @param message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. + * @param message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesGetLatestRecoveryTimeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesGetLatestRecoveryTimeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse; + + /** + * Verifies a SqlInstancesGetLatestRecoveryTimeResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesGetLatestRecoveryTimeResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesGetLatestRecoveryTimeResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse; + + /** + * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeResponse message. Also converts values to other types if specified. + * @param message SqlInstancesGetLatestRecoveryTimeResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesGetLatestRecoveryTimeResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesGetLatestRecoveryTimeResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CloneContext. */ + interface ICloneContext { + + /** CloneContext kind */ + kind?: (string|null); + + /** CloneContext pitrTimestampMs */ + pitrTimestampMs?: (number|Long|string|null); + + /** CloneContext destinationInstanceName */ + destinationInstanceName?: (string|null); + + /** CloneContext binLogCoordinates */ + binLogCoordinates?: (google.cloud.sql.v1.IBinLogCoordinates|null); + + /** CloneContext pointInTime */ + pointInTime?: (google.protobuf.ITimestamp|null); + + /** CloneContext allocatedIpRange */ + allocatedIpRange?: (string|null); + + /** CloneContext databaseNames */ + databaseNames?: (string[]|null); + + /** CloneContext preferredZone */ + preferredZone?: (string|null); + + /** CloneContext preferredSecondaryZone */ + preferredSecondaryZone?: (string|null); + + /** CloneContext sourceInstanceDeletionTime */ + sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); + + /** CloneContext destinationProject */ + destinationProject?: (string|null); + + /** CloneContext destinationNetwork */ + destinationNetwork?: (string|null); + } + + /** Represents a CloneContext. */ + class CloneContext implements ICloneContext { + + /** + * Constructs a new CloneContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ICloneContext); + + /** CloneContext kind. */ + public kind: string; + + /** CloneContext pitrTimestampMs. */ + public pitrTimestampMs: (number|Long|string); + + /** CloneContext destinationInstanceName. */ + public destinationInstanceName: string; + + /** CloneContext binLogCoordinates. */ + public binLogCoordinates?: (google.cloud.sql.v1.IBinLogCoordinates|null); + + /** CloneContext pointInTime. */ + public pointInTime?: (google.protobuf.ITimestamp|null); + + /** CloneContext allocatedIpRange. */ + public allocatedIpRange: string; + + /** CloneContext databaseNames. */ + public databaseNames: string[]; + + /** CloneContext preferredZone. */ + public preferredZone?: (string|null); + + /** CloneContext preferredSecondaryZone. */ + public preferredSecondaryZone?: (string|null); + + /** CloneContext sourceInstanceDeletionTime. */ + public sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); + + /** CloneContext destinationProject. */ + public destinationProject?: (string|null); + + /** CloneContext destinationNetwork. */ + public destinationNetwork?: (string|null); + + /** + * Creates a new CloneContext instance using the specified properties. + * @param [properties] Properties to set + * @returns CloneContext instance + */ + public static create(properties?: google.cloud.sql.v1.ICloneContext): google.cloud.sql.v1.CloneContext; + + /** + * Encodes the specified CloneContext message. Does not implicitly {@link google.cloud.sql.v1.CloneContext.verify|verify} messages. + * @param message CloneContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ICloneContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CloneContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.CloneContext.verify|verify} messages. + * @param message CloneContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ICloneContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CloneContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CloneContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.CloneContext; + + /** + * Decodes a CloneContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CloneContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.CloneContext; + + /** + * Verifies a CloneContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CloneContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CloneContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.CloneContext; + + /** + * Creates a plain object from a CloneContext message. Also converts values to other types if specified. + * @param message CloneContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.CloneContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CloneContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CloneContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PointInTimeRestoreContext. */ + interface IPointInTimeRestoreContext { + + /** PointInTimeRestoreContext datasource */ + datasource?: (string|null); + + /** PointInTimeRestoreContext pointInTime */ + pointInTime?: (google.protobuf.ITimestamp|null); + + /** PointInTimeRestoreContext targetInstance */ + targetInstance?: (string|null); + + /** PointInTimeRestoreContext privateNetwork */ + privateNetwork?: (string|null); + + /** PointInTimeRestoreContext allocatedIpRange */ + allocatedIpRange?: (string|null); + + /** PointInTimeRestoreContext preferredZone */ + preferredZone?: (string|null); + + /** PointInTimeRestoreContext preferredSecondaryZone */ + preferredSecondaryZone?: (string|null); + + /** PointInTimeRestoreContext targetInstanceSettings */ + targetInstanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** PointInTimeRestoreContext targetInstanceClearSettingsFieldNames */ + targetInstanceClearSettingsFieldNames?: (string[]|null); + + /** PointInTimeRestoreContext region */ + region?: (string|null); + } + + /** Represents a PointInTimeRestoreContext. */ + class PointInTimeRestoreContext implements IPointInTimeRestoreContext { + + /** + * Constructs a new PointInTimeRestoreContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IPointInTimeRestoreContext); + + /** PointInTimeRestoreContext datasource. */ + public datasource?: (string|null); + + /** PointInTimeRestoreContext pointInTime. */ + public pointInTime?: (google.protobuf.ITimestamp|null); + + /** PointInTimeRestoreContext targetInstance. */ + public targetInstance?: (string|null); + + /** PointInTimeRestoreContext privateNetwork. */ + public privateNetwork?: (string|null); + + /** PointInTimeRestoreContext allocatedIpRange. */ + public allocatedIpRange?: (string|null); + + /** PointInTimeRestoreContext preferredZone. */ + public preferredZone?: (string|null); + + /** PointInTimeRestoreContext preferredSecondaryZone. */ + public preferredSecondaryZone?: (string|null); + + /** PointInTimeRestoreContext targetInstanceSettings. */ + public targetInstanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** PointInTimeRestoreContext targetInstanceClearSettingsFieldNames. */ + public targetInstanceClearSettingsFieldNames: string[]; + + /** PointInTimeRestoreContext region. */ + public region?: (string|null); + + /** + * Creates a new PointInTimeRestoreContext instance using the specified properties. + * @param [properties] Properties to set + * @returns PointInTimeRestoreContext instance + */ + public static create(properties?: google.cloud.sql.v1.IPointInTimeRestoreContext): google.cloud.sql.v1.PointInTimeRestoreContext; + + /** + * Encodes the specified PointInTimeRestoreContext message. Does not implicitly {@link google.cloud.sql.v1.PointInTimeRestoreContext.verify|verify} messages. + * @param message PointInTimeRestoreContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IPointInTimeRestoreContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PointInTimeRestoreContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PointInTimeRestoreContext.verify|verify} messages. + * @param message PointInTimeRestoreContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IPointInTimeRestoreContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PointInTimeRestoreContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PointInTimeRestoreContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PointInTimeRestoreContext; + + /** + * Decodes a PointInTimeRestoreContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PointInTimeRestoreContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PointInTimeRestoreContext; + + /** + * Verifies a PointInTimeRestoreContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PointInTimeRestoreContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PointInTimeRestoreContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PointInTimeRestoreContext; + + /** + * Creates a plain object from a PointInTimeRestoreContext message. Also converts values to other types if specified. + * @param message PointInTimeRestoreContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.PointInTimeRestoreContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PointInTimeRestoreContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PointInTimeRestoreContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BinLogCoordinates. */ + interface IBinLogCoordinates { + + /** BinLogCoordinates binLogFileName */ + binLogFileName?: (string|null); + + /** BinLogCoordinates binLogPosition */ + binLogPosition?: (number|Long|string|null); + + /** BinLogCoordinates kind */ + kind?: (string|null); + } + + /** Represents a BinLogCoordinates. */ + class BinLogCoordinates implements IBinLogCoordinates { + + /** + * Constructs a new BinLogCoordinates. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IBinLogCoordinates); + + /** BinLogCoordinates binLogFileName. */ + public binLogFileName: string; + + /** BinLogCoordinates binLogPosition. */ + public binLogPosition: (number|Long|string); + + /** BinLogCoordinates kind. */ + public kind: string; + + /** + * Creates a new BinLogCoordinates instance using the specified properties. + * @param [properties] Properties to set + * @returns BinLogCoordinates instance + */ + public static create(properties?: google.cloud.sql.v1.IBinLogCoordinates): google.cloud.sql.v1.BinLogCoordinates; + + /** + * Encodes the specified BinLogCoordinates message. Does not implicitly {@link google.cloud.sql.v1.BinLogCoordinates.verify|verify} messages. + * @param message BinLogCoordinates message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IBinLogCoordinates, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BinLogCoordinates message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BinLogCoordinates.verify|verify} messages. + * @param message BinLogCoordinates message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IBinLogCoordinates, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BinLogCoordinates message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BinLogCoordinates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BinLogCoordinates; + + /** + * Decodes a BinLogCoordinates message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BinLogCoordinates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BinLogCoordinates; + + /** + * Verifies a BinLogCoordinates message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BinLogCoordinates message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BinLogCoordinates + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BinLogCoordinates; + + /** + * Creates a plain object from a BinLogCoordinates message. Also converts values to other types if specified. + * @param message BinLogCoordinates + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.BinLogCoordinates, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BinLogCoordinates to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BinLogCoordinates + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DatabaseInstance. */ + interface IDatabaseInstance { + + /** DatabaseInstance kind */ + kind?: (string|null); + + /** DatabaseInstance state */ + state?: (google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null); + + /** DatabaseInstance databaseVersion */ + databaseVersion?: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion|null); + + /** DatabaseInstance settings */ + settings?: (google.cloud.sql.v1.ISettings|null); + + /** DatabaseInstance etag */ + etag?: (string|null); + + /** DatabaseInstance failoverReplica */ + failoverReplica?: (google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica|null); + + /** DatabaseInstance masterInstanceName */ + masterInstanceName?: (string|null); + + /** DatabaseInstance replicaNames */ + replicaNames?: (string[]|null); + + /** DatabaseInstance maxDiskSize */ + maxDiskSize?: (google.protobuf.IInt64Value|null); + + /** DatabaseInstance currentDiskSize */ + currentDiskSize?: (google.protobuf.IInt64Value|null); + + /** DatabaseInstance ipAddresses */ + ipAddresses?: (google.cloud.sql.v1.IIpMapping[]|null); + + /** DatabaseInstance serverCaCert */ + serverCaCert?: (google.cloud.sql.v1.ISslCert|null); + + /** DatabaseInstance instanceType */ + instanceType?: (google.cloud.sql.v1.SqlInstanceType|keyof typeof google.cloud.sql.v1.SqlInstanceType|null); + + /** DatabaseInstance project */ + project?: (string|null); + + /** DatabaseInstance ipv6Address */ + ipv6Address?: (string|null); + + /** DatabaseInstance serviceAccountEmailAddress */ + serviceAccountEmailAddress?: (string|null); + + /** DatabaseInstance onPremisesConfiguration */ + onPremisesConfiguration?: (google.cloud.sql.v1.IOnPremisesConfiguration|null); + + /** DatabaseInstance replicaConfiguration */ + replicaConfiguration?: (google.cloud.sql.v1.IReplicaConfiguration|null); + + /** DatabaseInstance backendType */ + backendType?: (google.cloud.sql.v1.SqlBackendType|keyof typeof google.cloud.sql.v1.SqlBackendType|null); + + /** DatabaseInstance selfLink */ + selfLink?: (string|null); + + /** DatabaseInstance suspensionReason */ + suspensionReason?: (google.cloud.sql.v1.SqlSuspensionReason[]|null); + + /** DatabaseInstance connectionName */ + connectionName?: (string|null); + + /** DatabaseInstance name */ + name?: (string|null); + + /** DatabaseInstance region */ + region?: (string|null); + + /** DatabaseInstance gceZone */ + gceZone?: (string|null); + + /** DatabaseInstance secondaryGceZone */ + secondaryGceZone?: (string|null); + + /** DatabaseInstance diskEncryptionConfiguration */ + diskEncryptionConfiguration?: (google.cloud.sql.v1.IDiskEncryptionConfiguration|null); + + /** DatabaseInstance diskEncryptionStatus */ + diskEncryptionStatus?: (google.cloud.sql.v1.IDiskEncryptionStatus|null); + + /** DatabaseInstance rootPassword */ + rootPassword?: (string|null); + + /** DatabaseInstance scheduledMaintenance */ + scheduledMaintenance?: (google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance|null); + + /** DatabaseInstance satisfiesPzs */ + satisfiesPzs?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance databaseInstalledVersion */ + databaseInstalledVersion?: (string|null); + + /** DatabaseInstance outOfDiskReport */ + outOfDiskReport?: (google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport|null); + + /** DatabaseInstance createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** DatabaseInstance availableMaintenanceVersions */ + availableMaintenanceVersions?: (string[]|null); + + /** DatabaseInstance maintenanceVersion */ + maintenanceVersion?: (string|null); + + /** DatabaseInstance upgradableDatabaseVersions */ + upgradableDatabaseVersions?: (google.cloud.sql.v1.IAvailableDatabaseVersion[]|null); + + /** DatabaseInstance sqlNetworkArchitecture */ + sqlNetworkArchitecture?: (google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|null); + + /** DatabaseInstance pscServiceAttachmentLink */ + pscServiceAttachmentLink?: (string|null); + + /** DatabaseInstance dnsName */ + dnsName?: (string|null); + + /** DatabaseInstance primaryDnsName */ + primaryDnsName?: (string|null); + + /** DatabaseInstance writeEndpoint */ + writeEndpoint?: (string|null); + + /** DatabaseInstance replicationCluster */ + replicationCluster?: (google.cloud.sql.v1.IReplicationCluster|null); + + /** DatabaseInstance geminiConfig */ + geminiConfig?: (google.cloud.sql.v1.IGeminiInstanceConfig|null); + + /** DatabaseInstance satisfiesPzi */ + satisfiesPzi?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance switchTransactionLogsToCloudStorageEnabled */ + switchTransactionLogsToCloudStorageEnabled?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance includeReplicasForMajorVersionUpgrade */ + includeReplicasForMajorVersionUpgrade?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance tags */ + tags?: ({ [k: string]: string }|null); + + /** DatabaseInstance nodeCount */ + nodeCount?: (number|null); + + /** DatabaseInstance nodes */ + nodes?: (google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig[]|null); + + /** DatabaseInstance dnsNames */ + dnsNames?: (google.cloud.sql.v1.IDnsNameMapping[]|null); + } + + /** Represents a DatabaseInstance. */ + class DatabaseInstance implements IDatabaseInstance { + + /** + * Constructs a new DatabaseInstance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDatabaseInstance); + + /** DatabaseInstance kind. */ + public kind: string; + + /** DatabaseInstance state. */ + public state: (google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlInstanceState); + + /** DatabaseInstance databaseVersion. */ + public databaseVersion: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion); + + /** DatabaseInstance settings. */ + public settings?: (google.cloud.sql.v1.ISettings|null); + + /** DatabaseInstance etag. */ + public etag: string; + + /** DatabaseInstance failoverReplica. */ + public failoverReplica?: (google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica|null); + + /** DatabaseInstance masterInstanceName. */ + public masterInstanceName: string; + + /** DatabaseInstance replicaNames. */ + public replicaNames: string[]; + + /** DatabaseInstance maxDiskSize. */ + public maxDiskSize?: (google.protobuf.IInt64Value|null); + + /** DatabaseInstance currentDiskSize. */ + public currentDiskSize?: (google.protobuf.IInt64Value|null); + + /** DatabaseInstance ipAddresses. */ + public ipAddresses: google.cloud.sql.v1.IIpMapping[]; + + /** DatabaseInstance serverCaCert. */ + public serverCaCert?: (google.cloud.sql.v1.ISslCert|null); + + /** DatabaseInstance instanceType. */ + public instanceType: (google.cloud.sql.v1.SqlInstanceType|keyof typeof google.cloud.sql.v1.SqlInstanceType); + + /** DatabaseInstance project. */ + public project: string; + + /** DatabaseInstance ipv6Address. */ + public ipv6Address: string; + + /** DatabaseInstance serviceAccountEmailAddress. */ + public serviceAccountEmailAddress: string; + + /** DatabaseInstance onPremisesConfiguration. */ + public onPremisesConfiguration?: (google.cloud.sql.v1.IOnPremisesConfiguration|null); + + /** DatabaseInstance replicaConfiguration. */ + public replicaConfiguration?: (google.cloud.sql.v1.IReplicaConfiguration|null); + + /** DatabaseInstance backendType. */ + public backendType: (google.cloud.sql.v1.SqlBackendType|keyof typeof google.cloud.sql.v1.SqlBackendType); + + /** DatabaseInstance selfLink. */ + public selfLink: string; + + /** DatabaseInstance suspensionReason. */ + public suspensionReason: google.cloud.sql.v1.SqlSuspensionReason[]; + + /** DatabaseInstance connectionName. */ + public connectionName: string; + + /** DatabaseInstance name. */ + public name: string; + + /** DatabaseInstance region. */ + public region: string; + + /** DatabaseInstance gceZone. */ + public gceZone: string; + + /** DatabaseInstance secondaryGceZone. */ + public secondaryGceZone: string; + + /** DatabaseInstance diskEncryptionConfiguration. */ + public diskEncryptionConfiguration?: (google.cloud.sql.v1.IDiskEncryptionConfiguration|null); + + /** DatabaseInstance diskEncryptionStatus. */ + public diskEncryptionStatus?: (google.cloud.sql.v1.IDiskEncryptionStatus|null); + + /** DatabaseInstance rootPassword. */ + public rootPassword: string; + + /** DatabaseInstance scheduledMaintenance. */ + public scheduledMaintenance?: (google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance|null); + + /** DatabaseInstance satisfiesPzs. */ + public satisfiesPzs?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance databaseInstalledVersion. */ + public databaseInstalledVersion: string; + + /** DatabaseInstance outOfDiskReport. */ + public outOfDiskReport?: (google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport|null); + + /** DatabaseInstance createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** DatabaseInstance availableMaintenanceVersions. */ + public availableMaintenanceVersions: string[]; + + /** DatabaseInstance maintenanceVersion. */ + public maintenanceVersion: string; + + /** DatabaseInstance upgradableDatabaseVersions. */ + public upgradableDatabaseVersions: google.cloud.sql.v1.IAvailableDatabaseVersion[]; + + /** DatabaseInstance sqlNetworkArchitecture. */ + public sqlNetworkArchitecture?: (google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|null); + + /** DatabaseInstance pscServiceAttachmentLink. */ + public pscServiceAttachmentLink?: (string|null); + + /** DatabaseInstance dnsName. */ + public dnsName?: (string|null); + + /** DatabaseInstance primaryDnsName. */ + public primaryDnsName?: (string|null); + + /** DatabaseInstance writeEndpoint. */ + public writeEndpoint?: (string|null); + + /** DatabaseInstance replicationCluster. */ + public replicationCluster?: (google.cloud.sql.v1.IReplicationCluster|null); + + /** DatabaseInstance geminiConfig. */ + public geminiConfig?: (google.cloud.sql.v1.IGeminiInstanceConfig|null); + + /** DatabaseInstance satisfiesPzi. */ + public satisfiesPzi?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance switchTransactionLogsToCloudStorageEnabled. */ + public switchTransactionLogsToCloudStorageEnabled?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance includeReplicasForMajorVersionUpgrade. */ + public includeReplicasForMajorVersionUpgrade?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance tags. */ + public tags: { [k: string]: string }; + + /** DatabaseInstance nodeCount. */ + public nodeCount?: (number|null); + + /** DatabaseInstance nodes. */ + public nodes: google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig[]; + + /** DatabaseInstance dnsNames. */ + public dnsNames: google.cloud.sql.v1.IDnsNameMapping[]; + + /** + * Creates a new DatabaseInstance instance using the specified properties. + * @param [properties] Properties to set + * @returns DatabaseInstance instance + */ + public static create(properties?: google.cloud.sql.v1.IDatabaseInstance): google.cloud.sql.v1.DatabaseInstance; + + /** + * Encodes the specified DatabaseInstance message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.verify|verify} messages. + * @param message DatabaseInstance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDatabaseInstance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DatabaseInstance message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.verify|verify} messages. + * @param message DatabaseInstance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDatabaseInstance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DatabaseInstance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DatabaseInstance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseInstance; + + /** + * Decodes a DatabaseInstance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DatabaseInstance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseInstance; + + /** + * Verifies a DatabaseInstance message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DatabaseInstance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DatabaseInstance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseInstance; + + /** + * Creates a plain object from a DatabaseInstance message. Also converts values to other types if specified. + * @param message DatabaseInstance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DatabaseInstance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DatabaseInstance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DatabaseInstance + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DatabaseInstance { + + /** SqlInstanceState enum. */ + enum SqlInstanceState { + SQL_INSTANCE_STATE_UNSPECIFIED = 0, + RUNNABLE = 1, + SUSPENDED = 2, + PENDING_DELETE = 3, + PENDING_CREATE = 4, + MAINTENANCE = 5, + FAILED = 6, + ONLINE_MAINTENANCE = 7, + REPAIRING = 8 + } + + /** Properties of a SqlFailoverReplica. */ + interface ISqlFailoverReplica { + + /** SqlFailoverReplica name */ + name?: (string|null); + + /** SqlFailoverReplica available */ + available?: (google.protobuf.IBoolValue|null); + } + + /** Represents a SqlFailoverReplica. */ + class SqlFailoverReplica implements ISqlFailoverReplica { + + /** + * Constructs a new SqlFailoverReplica. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica); + + /** SqlFailoverReplica name. */ + public name: string; + + /** SqlFailoverReplica available. */ + public available?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new SqlFailoverReplica instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlFailoverReplica instance + */ + public static create(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica): google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica; + + /** + * Encodes the specified SqlFailoverReplica message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. + * @param message SqlFailoverReplica message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlFailoverReplica message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. + * @param message SqlFailoverReplica message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlFailoverReplica message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlFailoverReplica + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica; + + /** + * Decodes a SqlFailoverReplica message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlFailoverReplica + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica; + + /** + * Verifies a SqlFailoverReplica message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlFailoverReplica message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlFailoverReplica + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica; + + /** + * Creates a plain object from a SqlFailoverReplica message. Also converts values to other types if specified. + * @param message SqlFailoverReplica + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlFailoverReplica to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlFailoverReplica + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlScheduledMaintenance. */ + interface ISqlScheduledMaintenance { + + /** SqlScheduledMaintenance startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** SqlScheduledMaintenance canDefer */ + canDefer?: (boolean|null); + + /** SqlScheduledMaintenance canReschedule */ + canReschedule?: (boolean|null); + + /** SqlScheduledMaintenance scheduleDeadlineTime */ + scheduleDeadlineTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a SqlScheduledMaintenance. */ + class SqlScheduledMaintenance implements ISqlScheduledMaintenance { + + /** + * Constructs a new SqlScheduledMaintenance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance); + + /** SqlScheduledMaintenance startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** SqlScheduledMaintenance canDefer. */ + public canDefer: boolean; + + /** SqlScheduledMaintenance canReschedule. */ + public canReschedule: boolean; + + /** SqlScheduledMaintenance scheduleDeadlineTime. */ + public scheduleDeadlineTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new SqlScheduledMaintenance instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlScheduledMaintenance instance + */ + public static create(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance): google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance; + + /** + * Encodes the specified SqlScheduledMaintenance message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. + * @param message SqlScheduledMaintenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlScheduledMaintenance message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. + * @param message SqlScheduledMaintenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlScheduledMaintenance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlScheduledMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance; + + /** + * Decodes a SqlScheduledMaintenance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlScheduledMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance; + + /** + * Verifies a SqlScheduledMaintenance message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlScheduledMaintenance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlScheduledMaintenance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance; + + /** + * Creates a plain object from a SqlScheduledMaintenance message. Also converts values to other types if specified. + * @param message SqlScheduledMaintenance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlScheduledMaintenance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlScheduledMaintenance + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlOutOfDiskReport. */ + interface ISqlOutOfDiskReport { + + /** SqlOutOfDiskReport sqlOutOfDiskState */ + sqlOutOfDiskState?: (google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null); + + /** SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb */ + sqlMinRecommendedIncreaseSizeGb?: (number|null); + } + + /** Represents a SqlOutOfDiskReport. */ + class SqlOutOfDiskReport implements ISqlOutOfDiskReport { + + /** + * Constructs a new SqlOutOfDiskReport. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport); + + /** SqlOutOfDiskReport sqlOutOfDiskState. */ + public sqlOutOfDiskState?: (google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null); + + /** SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb. */ + public sqlMinRecommendedIncreaseSizeGb?: (number|null); + + /** + * Creates a new SqlOutOfDiskReport instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlOutOfDiskReport instance + */ + public static create(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport): google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport; + + /** + * Encodes the specified SqlOutOfDiskReport message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. + * @param message SqlOutOfDiskReport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlOutOfDiskReport message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. + * @param message SqlOutOfDiskReport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlOutOfDiskReport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlOutOfDiskReport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport; + + /** + * Decodes a SqlOutOfDiskReport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlOutOfDiskReport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport; + + /** + * Verifies a SqlOutOfDiskReport message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlOutOfDiskReport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlOutOfDiskReport + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport; + + /** + * Creates a plain object from a SqlOutOfDiskReport message. Also converts values to other types if specified. + * @param message SqlOutOfDiskReport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlOutOfDiskReport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlOutOfDiskReport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlOutOfDiskReport { + + /** SqlOutOfDiskState enum. */ + enum SqlOutOfDiskState { + SQL_OUT_OF_DISK_STATE_UNSPECIFIED = 0, + NORMAL = 1, + SOFT_SHUTDOWN = 2 + } + } + + /** SqlNetworkArchitecture enum. */ + enum SqlNetworkArchitecture { + SQL_NETWORK_ARCHITECTURE_UNSPECIFIED = 0, + NEW_NETWORK_ARCHITECTURE = 1, + OLD_NETWORK_ARCHITECTURE = 2 + } + + /** Properties of a PoolNodeConfig. */ + interface IPoolNodeConfig { + + /** PoolNodeConfig name */ + name?: (string|null); + + /** PoolNodeConfig gceZone */ + gceZone?: (string|null); + + /** PoolNodeConfig ipAddresses */ + ipAddresses?: (google.cloud.sql.v1.IIpMapping[]|null); + + /** PoolNodeConfig dnsName */ + dnsName?: (string|null); + + /** PoolNodeConfig state */ + state?: (google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null); + + /** PoolNodeConfig dnsNames */ + dnsNames?: (google.cloud.sql.v1.IDnsNameMapping[]|null); + + /** PoolNodeConfig pscServiceAttachmentLink */ + pscServiceAttachmentLink?: (string|null); + + /** PoolNodeConfig pscAutoConnections */ + pscAutoConnections?: (google.cloud.sql.v1.IPscAutoConnectionConfig[]|null); + } + + /** Represents a PoolNodeConfig. */ + class PoolNodeConfig implements IPoolNodeConfig { + + /** + * Constructs a new PoolNodeConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig); + + /** PoolNodeConfig name. */ + public name?: (string|null); + + /** PoolNodeConfig gceZone. */ + public gceZone?: (string|null); + + /** PoolNodeConfig ipAddresses. */ + public ipAddresses: google.cloud.sql.v1.IIpMapping[]; + + /** PoolNodeConfig dnsName. */ + public dnsName?: (string|null); + + /** PoolNodeConfig state. */ + public state?: (google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null); + + /** PoolNodeConfig dnsNames. */ + public dnsNames: google.cloud.sql.v1.IDnsNameMapping[]; + + /** PoolNodeConfig pscServiceAttachmentLink. */ + public pscServiceAttachmentLink?: (string|null); + + /** PoolNodeConfig pscAutoConnections. */ + public pscAutoConnections: google.cloud.sql.v1.IPscAutoConnectionConfig[]; + + /** + * Creates a new PoolNodeConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns PoolNodeConfig instance + */ + public static create(properties?: google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig): google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig; + + /** + * Encodes the specified PoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.verify|verify} messages. + * @param message PoolNodeConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.verify|verify} messages. + * @param message PoolNodeConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PoolNodeConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig; + + /** + * Decodes a PoolNodeConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig; + + /** + * Verifies a PoolNodeConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PoolNodeConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PoolNodeConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig; + + /** + * Creates a plain object from a PoolNodeConfig message. Also converts values to other types if specified. + * @param message PoolNodeConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PoolNodeConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PoolNodeConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a GeminiInstanceConfig. */ + interface IGeminiInstanceConfig { + + /** GeminiInstanceConfig entitled */ + entitled?: (boolean|null); + + /** GeminiInstanceConfig googleVacuumMgmtEnabled */ + googleVacuumMgmtEnabled?: (boolean|null); + + /** GeminiInstanceConfig oomSessionCancelEnabled */ + oomSessionCancelEnabled?: (boolean|null); + + /** GeminiInstanceConfig activeQueryEnabled */ + activeQueryEnabled?: (boolean|null); + + /** GeminiInstanceConfig indexAdvisorEnabled */ + indexAdvisorEnabled?: (boolean|null); + + /** GeminiInstanceConfig flagRecommenderEnabled */ + flagRecommenderEnabled?: (boolean|null); + } + + /** Represents a GeminiInstanceConfig. */ + class GeminiInstanceConfig implements IGeminiInstanceConfig { + + /** + * Constructs a new GeminiInstanceConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IGeminiInstanceConfig); + + /** GeminiInstanceConfig entitled. */ + public entitled?: (boolean|null); + + /** GeminiInstanceConfig googleVacuumMgmtEnabled. */ + public googleVacuumMgmtEnabled?: (boolean|null); + + /** GeminiInstanceConfig oomSessionCancelEnabled. */ + public oomSessionCancelEnabled?: (boolean|null); + + /** GeminiInstanceConfig activeQueryEnabled. */ + public activeQueryEnabled?: (boolean|null); + + /** GeminiInstanceConfig indexAdvisorEnabled. */ + public indexAdvisorEnabled?: (boolean|null); + + /** GeminiInstanceConfig flagRecommenderEnabled. */ + public flagRecommenderEnabled?: (boolean|null); + + /** + * Creates a new GeminiInstanceConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns GeminiInstanceConfig instance + */ + public static create(properties?: google.cloud.sql.v1.IGeminiInstanceConfig): google.cloud.sql.v1.GeminiInstanceConfig; + + /** + * Encodes the specified GeminiInstanceConfig message. Does not implicitly {@link google.cloud.sql.v1.GeminiInstanceConfig.verify|verify} messages. + * @param message GeminiInstanceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IGeminiInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeminiInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GeminiInstanceConfig.verify|verify} messages. + * @param message GeminiInstanceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IGeminiInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeminiInstanceConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeminiInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.GeminiInstanceConfig; + + /** + * Decodes a GeminiInstanceConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeminiInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.GeminiInstanceConfig; + + /** + * Verifies a GeminiInstanceConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeminiInstanceConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeminiInstanceConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.GeminiInstanceConfig; + + /** + * Creates a plain object from a GeminiInstanceConfig message. Also converts values to other types if specified. + * @param message GeminiInstanceConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.GeminiInstanceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeminiInstanceConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GeminiInstanceConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReplicationCluster. */ + interface IReplicationCluster { + + /** ReplicationCluster psaWriteEndpoint */ + psaWriteEndpoint?: (string|null); + + /** ReplicationCluster failoverDrReplicaName */ + failoverDrReplicaName?: (string|null); + + /** ReplicationCluster drReplica */ + drReplica?: (boolean|null); + } + + /** Represents a ReplicationCluster. */ + class ReplicationCluster implements IReplicationCluster { + + /** + * Constructs a new ReplicationCluster. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IReplicationCluster); + + /** ReplicationCluster psaWriteEndpoint. */ + public psaWriteEndpoint: string; + + /** ReplicationCluster failoverDrReplicaName. */ + public failoverDrReplicaName: string; + + /** ReplicationCluster drReplica. */ + public drReplica: boolean; + + /** + * Creates a new ReplicationCluster instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplicationCluster instance + */ + public static create(properties?: google.cloud.sql.v1.IReplicationCluster): google.cloud.sql.v1.ReplicationCluster; + + /** + * Encodes the specified ReplicationCluster message. Does not implicitly {@link google.cloud.sql.v1.ReplicationCluster.verify|verify} messages. + * @param message ReplicationCluster message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IReplicationCluster, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReplicationCluster message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReplicationCluster.verify|verify} messages. + * @param message ReplicationCluster message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IReplicationCluster, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReplicationCluster message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplicationCluster + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ReplicationCluster; + + /** + * Decodes a ReplicationCluster message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplicationCluster + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ReplicationCluster; + + /** + * Verifies a ReplicationCluster message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReplicationCluster message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplicationCluster + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ReplicationCluster; + + /** + * Creates a plain object from a ReplicationCluster message. Also converts values to other types if specified. + * @param message ReplicationCluster + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ReplicationCluster, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReplicationCluster to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplicationCluster + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AvailableDatabaseVersion. */ + interface IAvailableDatabaseVersion { + + /** AvailableDatabaseVersion majorVersion */ + majorVersion?: (string|null); + + /** AvailableDatabaseVersion name */ + name?: (string|null); + + /** AvailableDatabaseVersion displayName */ + displayName?: (string|null); + } + + /** Represents an AvailableDatabaseVersion. */ + class AvailableDatabaseVersion implements IAvailableDatabaseVersion { + + /** + * Constructs a new AvailableDatabaseVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IAvailableDatabaseVersion); + + /** AvailableDatabaseVersion majorVersion. */ + public majorVersion?: (string|null); + + /** AvailableDatabaseVersion name. */ + public name?: (string|null); + + /** AvailableDatabaseVersion displayName. */ + public displayName?: (string|null); + + /** + * Creates a new AvailableDatabaseVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns AvailableDatabaseVersion instance + */ + public static create(properties?: google.cloud.sql.v1.IAvailableDatabaseVersion): google.cloud.sql.v1.AvailableDatabaseVersion; + + /** + * Encodes the specified AvailableDatabaseVersion message. Does not implicitly {@link google.cloud.sql.v1.AvailableDatabaseVersion.verify|verify} messages. + * @param message AvailableDatabaseVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IAvailableDatabaseVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AvailableDatabaseVersion message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AvailableDatabaseVersion.verify|verify} messages. + * @param message AvailableDatabaseVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IAvailableDatabaseVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AvailableDatabaseVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AvailableDatabaseVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.AvailableDatabaseVersion; + + /** + * Decodes an AvailableDatabaseVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AvailableDatabaseVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.AvailableDatabaseVersion; + + /** + * Verifies an AvailableDatabaseVersion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AvailableDatabaseVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AvailableDatabaseVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.AvailableDatabaseVersion; + + /** + * Creates a plain object from an AvailableDatabaseVersion message. Also converts values to other types if specified. + * @param message AvailableDatabaseVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.AvailableDatabaseVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AvailableDatabaseVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AvailableDatabaseVersion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRescheduleMaintenanceRequestBody. */ + interface ISqlInstancesRescheduleMaintenanceRequestBody { + + /** SqlInstancesRescheduleMaintenanceRequestBody reschedule */ + reschedule?: (google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null); + } + + /** Represents a SqlInstancesRescheduleMaintenanceRequestBody. */ + class SqlInstancesRescheduleMaintenanceRequestBody implements ISqlInstancesRescheduleMaintenanceRequestBody { + + /** + * Constructs a new SqlInstancesRescheduleMaintenanceRequestBody. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody); + + /** SqlInstancesRescheduleMaintenanceRequestBody reschedule. */ + public reschedule?: (google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null); + + /** + * Creates a new SqlInstancesRescheduleMaintenanceRequestBody instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRescheduleMaintenanceRequestBody instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. + * @param message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. + * @param message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRescheduleMaintenanceRequestBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRescheduleMaintenanceRequestBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody; + + /** + * Verifies a SqlInstancesRescheduleMaintenanceRequestBody message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRescheduleMaintenanceRequestBody message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRescheduleMaintenanceRequestBody + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody; + + /** + * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequestBody message. Also converts values to other types if specified. + * @param message SqlInstancesRescheduleMaintenanceRequestBody + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRescheduleMaintenanceRequestBody to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRescheduleMaintenanceRequestBody + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlInstancesRescheduleMaintenanceRequestBody { + + /** RescheduleType enum. */ + enum RescheduleType { + RESCHEDULE_TYPE_UNSPECIFIED = 0, + IMMEDIATE = 1, + NEXT_AVAILABLE_WINDOW = 2, + SPECIFIC_TIME = 3 + } + + /** Properties of a Reschedule. */ + interface IReschedule { + + /** Reschedule rescheduleType */ + rescheduleType?: (google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|keyof typeof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|null); + + /** Reschedule scheduleTime */ + scheduleTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Reschedule. */ + class Reschedule implements IReschedule { + + /** + * Constructs a new Reschedule. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule); + + /** Reschedule rescheduleType. */ + public rescheduleType: (google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|keyof typeof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType); + + /** Reschedule scheduleTime. */ + public scheduleTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new Reschedule instance using the specified properties. + * @param [properties] Properties to set + * @returns Reschedule instance + */ + public static create(properties?: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; + + /** + * Encodes the specified Reschedule message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. + * @param message Reschedule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Reschedule message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. + * @param message Reschedule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Reschedule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Reschedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; + + /** + * Decodes a Reschedule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Reschedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; + + /** + * Verifies a Reschedule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Reschedule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Reschedule + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; + + /** + * Creates a plain object from a Reschedule message. Also converts values to other types if specified. + * @param message Reschedule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Reschedule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Reschedule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a DemoteMasterContext. */ + interface IDemoteMasterContext { + + /** DemoteMasterContext kind */ + kind?: (string|null); + + /** DemoteMasterContext verifyGtidConsistency */ + verifyGtidConsistency?: (google.protobuf.IBoolValue|null); + + /** DemoteMasterContext masterInstanceName */ + masterInstanceName?: (string|null); + + /** DemoteMasterContext replicaConfiguration */ + replicaConfiguration?: (google.cloud.sql.v1.IDemoteMasterConfiguration|null); + + /** DemoteMasterContext skipReplicationSetup */ + skipReplicationSetup?: (boolean|null); + } + + /** Represents a DemoteMasterContext. */ + class DemoteMasterContext implements IDemoteMasterContext { + + /** + * Constructs a new DemoteMasterContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDemoteMasterContext); + + /** DemoteMasterContext kind. */ + public kind: string; + + /** DemoteMasterContext verifyGtidConsistency. */ + public verifyGtidConsistency?: (google.protobuf.IBoolValue|null); + + /** DemoteMasterContext masterInstanceName. */ + public masterInstanceName: string; + + /** DemoteMasterContext replicaConfiguration. */ + public replicaConfiguration?: (google.cloud.sql.v1.IDemoteMasterConfiguration|null); + + /** DemoteMasterContext skipReplicationSetup. */ + public skipReplicationSetup: boolean; + + /** + * Creates a new DemoteMasterContext instance using the specified properties. + * @param [properties] Properties to set + * @returns DemoteMasterContext instance + */ + public static create(properties?: google.cloud.sql.v1.IDemoteMasterContext): google.cloud.sql.v1.DemoteMasterContext; + + /** + * Encodes the specified DemoteMasterContext message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterContext.verify|verify} messages. + * @param message DemoteMasterContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDemoteMasterContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DemoteMasterContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterContext.verify|verify} messages. + * @param message DemoteMasterContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDemoteMasterContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DemoteMasterContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DemoteMasterContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DemoteMasterContext; + + /** + * Decodes a DemoteMasterContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DemoteMasterContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DemoteMasterContext; + + /** + * Verifies a DemoteMasterContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DemoteMasterContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DemoteMasterContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DemoteMasterContext; + + /** + * Creates a plain object from a DemoteMasterContext message. Also converts values to other types if specified. + * @param message DemoteMasterContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DemoteMasterContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DemoteMasterContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DemoteMasterContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DemoteContext. */ + interface IDemoteContext { + + /** DemoteContext kind */ + kind?: (string|null); + + /** DemoteContext sourceRepresentativeInstanceName */ + sourceRepresentativeInstanceName?: (string|null); + } + + /** Represents a DemoteContext. */ + class DemoteContext implements IDemoteContext { + + /** + * Constructs a new DemoteContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDemoteContext); + + /** DemoteContext kind. */ + public kind: string; + + /** DemoteContext sourceRepresentativeInstanceName. */ + public sourceRepresentativeInstanceName: string; + + /** + * Creates a new DemoteContext instance using the specified properties. + * @param [properties] Properties to set + * @returns DemoteContext instance + */ + public static create(properties?: google.cloud.sql.v1.IDemoteContext): google.cloud.sql.v1.DemoteContext; + + /** + * Encodes the specified DemoteContext message. Does not implicitly {@link google.cloud.sql.v1.DemoteContext.verify|verify} messages. + * @param message DemoteContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDemoteContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DemoteContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteContext.verify|verify} messages. + * @param message DemoteContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDemoteContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DemoteContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DemoteContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DemoteContext; + + /** + * Decodes a DemoteContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DemoteContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DemoteContext; + + /** + * Verifies a DemoteContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DemoteContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DemoteContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DemoteContext; + + /** + * Creates a plain object from a DemoteContext message. Also converts values to other types if specified. + * @param message DemoteContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DemoteContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DemoteContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DemoteContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FailoverContext. */ + interface IFailoverContext { + + /** FailoverContext settingsVersion */ + settingsVersion?: (number|Long|string|null); + + /** FailoverContext kind */ + kind?: (string|null); + } + + /** Represents a FailoverContext. */ + class FailoverContext implements IFailoverContext { + + /** + * Constructs a new FailoverContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IFailoverContext); + + /** FailoverContext settingsVersion. */ + public settingsVersion: (number|Long|string); + + /** FailoverContext kind. */ + public kind: string; + + /** + * Creates a new FailoverContext instance using the specified properties. + * @param [properties] Properties to set + * @returns FailoverContext instance + */ + public static create(properties?: google.cloud.sql.v1.IFailoverContext): google.cloud.sql.v1.FailoverContext; + + /** + * Encodes the specified FailoverContext message. Does not implicitly {@link google.cloud.sql.v1.FailoverContext.verify|verify} messages. + * @param message FailoverContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IFailoverContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FailoverContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FailoverContext.verify|verify} messages. + * @param message FailoverContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IFailoverContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FailoverContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FailoverContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.FailoverContext; + + /** + * Decodes a FailoverContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FailoverContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.FailoverContext; + + /** + * Verifies a FailoverContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FailoverContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FailoverContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.FailoverContext; + + /** + * Creates a plain object from a FailoverContext message. Also converts values to other types if specified. + * @param message FailoverContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.FailoverContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FailoverContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FailoverContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RestoreBackupContext. */ + interface IRestoreBackupContext { + + /** RestoreBackupContext kind */ + kind?: (string|null); + + /** RestoreBackupContext backupRunId */ + backupRunId?: (number|Long|string|null); + + /** RestoreBackupContext instanceId */ + instanceId?: (string|null); + + /** RestoreBackupContext project */ + project?: (string|null); + } + + /** Represents a RestoreBackupContext. */ + class RestoreBackupContext implements IRestoreBackupContext { + + /** + * Constructs a new RestoreBackupContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IRestoreBackupContext); + + /** RestoreBackupContext kind. */ + public kind: string; + + /** RestoreBackupContext backupRunId. */ + public backupRunId: (number|Long|string); + + /** RestoreBackupContext instanceId. */ + public instanceId: string; + + /** RestoreBackupContext project. */ + public project: string; + + /** + * Creates a new RestoreBackupContext instance using the specified properties. + * @param [properties] Properties to set + * @returns RestoreBackupContext instance + */ + public static create(properties?: google.cloud.sql.v1.IRestoreBackupContext): google.cloud.sql.v1.RestoreBackupContext; + + /** + * Encodes the specified RestoreBackupContext message. Does not implicitly {@link google.cloud.sql.v1.RestoreBackupContext.verify|verify} messages. + * @param message RestoreBackupContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IRestoreBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RestoreBackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RestoreBackupContext.verify|verify} messages. + * @param message RestoreBackupContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IRestoreBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RestoreBackupContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RestoreBackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.RestoreBackupContext; + + /** + * Decodes a RestoreBackupContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RestoreBackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.RestoreBackupContext; + + /** + * Verifies a RestoreBackupContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RestoreBackupContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RestoreBackupContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.RestoreBackupContext; + + /** + * Creates a plain object from a RestoreBackupContext message. Also converts values to other types if specified. + * @param message RestoreBackupContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.RestoreBackupContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RestoreBackupContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RestoreBackupContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RotateServerCaContext. */ + interface IRotateServerCaContext { + + /** RotateServerCaContext kind */ + kind?: (string|null); + + /** RotateServerCaContext nextVersion */ + nextVersion?: (string|null); + } + + /** Represents a RotateServerCaContext. */ + class RotateServerCaContext implements IRotateServerCaContext { + + /** + * Constructs a new RotateServerCaContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IRotateServerCaContext); + + /** RotateServerCaContext kind. */ + public kind: string; + + /** RotateServerCaContext nextVersion. */ + public nextVersion: string; + + /** + * Creates a new RotateServerCaContext instance using the specified properties. + * @param [properties] Properties to set + * @returns RotateServerCaContext instance + */ + public static create(properties?: google.cloud.sql.v1.IRotateServerCaContext): google.cloud.sql.v1.RotateServerCaContext; + + /** + * Encodes the specified RotateServerCaContext message. Does not implicitly {@link google.cloud.sql.v1.RotateServerCaContext.verify|verify} messages. + * @param message RotateServerCaContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IRotateServerCaContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RotateServerCaContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateServerCaContext.verify|verify} messages. + * @param message RotateServerCaContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IRotateServerCaContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RotateServerCaContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RotateServerCaContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.RotateServerCaContext; + + /** + * Decodes a RotateServerCaContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RotateServerCaContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.RotateServerCaContext; + + /** + * Verifies a RotateServerCaContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RotateServerCaContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RotateServerCaContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.RotateServerCaContext; + + /** + * Creates a plain object from a RotateServerCaContext message. Also converts values to other types if specified. + * @param message RotateServerCaContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.RotateServerCaContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RotateServerCaContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RotateServerCaContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RotateServerCertificateContext. */ + interface IRotateServerCertificateContext { + + /** RotateServerCertificateContext kind */ + kind?: (string|null); + + /** RotateServerCertificateContext nextVersion */ + nextVersion?: (string|null); + } + + /** Represents a RotateServerCertificateContext. */ + class RotateServerCertificateContext implements IRotateServerCertificateContext { + + /** + * Constructs a new RotateServerCertificateContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IRotateServerCertificateContext); + + /** RotateServerCertificateContext kind. */ + public kind: string; + + /** RotateServerCertificateContext nextVersion. */ + public nextVersion: string; + + /** + * Creates a new RotateServerCertificateContext instance using the specified properties. + * @param [properties] Properties to set + * @returns RotateServerCertificateContext instance + */ + public static create(properties?: google.cloud.sql.v1.IRotateServerCertificateContext): google.cloud.sql.v1.RotateServerCertificateContext; + + /** + * Encodes the specified RotateServerCertificateContext message. Does not implicitly {@link google.cloud.sql.v1.RotateServerCertificateContext.verify|verify} messages. + * @param message RotateServerCertificateContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IRotateServerCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RotateServerCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateServerCertificateContext.verify|verify} messages. + * @param message RotateServerCertificateContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IRotateServerCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RotateServerCertificateContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RotateServerCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.RotateServerCertificateContext; + + /** + * Decodes a RotateServerCertificateContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RotateServerCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.RotateServerCertificateContext; + + /** + * Verifies a RotateServerCertificateContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RotateServerCertificateContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RotateServerCertificateContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.RotateServerCertificateContext; + + /** + * Creates a plain object from a RotateServerCertificateContext message. Also converts values to other types if specified. + * @param message RotateServerCertificateContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.RotateServerCertificateContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RotateServerCertificateContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RotateServerCertificateContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RotateEntraIdCertificateContext. */ + interface IRotateEntraIdCertificateContext { + + /** RotateEntraIdCertificateContext kind */ + kind?: (string|null); + + /** RotateEntraIdCertificateContext nextVersion */ + nextVersion?: (string|null); + } + + /** Represents a RotateEntraIdCertificateContext. */ + class RotateEntraIdCertificateContext implements IRotateEntraIdCertificateContext { + + /** + * Constructs a new RotateEntraIdCertificateContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IRotateEntraIdCertificateContext); + + /** RotateEntraIdCertificateContext kind. */ + public kind: string; + + /** RotateEntraIdCertificateContext nextVersion. */ + public nextVersion: string; + + /** + * Creates a new RotateEntraIdCertificateContext instance using the specified properties. + * @param [properties] Properties to set + * @returns RotateEntraIdCertificateContext instance + */ + public static create(properties?: google.cloud.sql.v1.IRotateEntraIdCertificateContext): google.cloud.sql.v1.RotateEntraIdCertificateContext; + + /** + * Encodes the specified RotateEntraIdCertificateContext message. Does not implicitly {@link google.cloud.sql.v1.RotateEntraIdCertificateContext.verify|verify} messages. + * @param message RotateEntraIdCertificateContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IRotateEntraIdCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RotateEntraIdCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateEntraIdCertificateContext.verify|verify} messages. + * @param message RotateEntraIdCertificateContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IRotateEntraIdCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RotateEntraIdCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.RotateEntraIdCertificateContext; + + /** + * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RotateEntraIdCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.RotateEntraIdCertificateContext; + + /** + * Verifies a RotateEntraIdCertificateContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RotateEntraIdCertificateContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RotateEntraIdCertificateContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.RotateEntraIdCertificateContext; + + /** + * Creates a plain object from a RotateEntraIdCertificateContext message. Also converts values to other types if specified. + * @param message RotateEntraIdCertificateContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.RotateEntraIdCertificateContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RotateEntraIdCertificateContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RotateEntraIdCertificateContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TruncateLogContext. */ + interface ITruncateLogContext { + + /** TruncateLogContext kind */ + kind?: (string|null); + + /** TruncateLogContext logType */ + logType?: (string|null); + } + + /** Represents a TruncateLogContext. */ + class TruncateLogContext implements ITruncateLogContext { + + /** + * Constructs a new TruncateLogContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ITruncateLogContext); + + /** TruncateLogContext kind. */ + public kind: string; + + /** TruncateLogContext logType. */ + public logType: string; + + /** + * Creates a new TruncateLogContext instance using the specified properties. + * @param [properties] Properties to set + * @returns TruncateLogContext instance + */ + public static create(properties?: google.cloud.sql.v1.ITruncateLogContext): google.cloud.sql.v1.TruncateLogContext; + + /** + * Encodes the specified TruncateLogContext message. Does not implicitly {@link google.cloud.sql.v1.TruncateLogContext.verify|verify} messages. + * @param message TruncateLogContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ITruncateLogContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TruncateLogContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.TruncateLogContext.verify|verify} messages. + * @param message TruncateLogContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ITruncateLogContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TruncateLogContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TruncateLogContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.TruncateLogContext; + + /** + * Decodes a TruncateLogContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TruncateLogContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.TruncateLogContext; + + /** + * Verifies a TruncateLogContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TruncateLogContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TruncateLogContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.TruncateLogContext; + + /** + * Creates a plain object from a TruncateLogContext message. Also converts values to other types if specified. + * @param message TruncateLogContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.TruncateLogContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TruncateLogContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TruncateLogContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlExternalSyncSettingError. */ + interface ISqlExternalSyncSettingError { + + /** SqlExternalSyncSettingError kind */ + kind?: (string|null); + + /** SqlExternalSyncSettingError type */ + type?: (google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|keyof typeof google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|null); + + /** SqlExternalSyncSettingError detail */ + detail?: (string|null); + } + + /** Represents a SqlExternalSyncSettingError. */ + class SqlExternalSyncSettingError implements ISqlExternalSyncSettingError { + + /** + * Constructs a new SqlExternalSyncSettingError. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlExternalSyncSettingError); + + /** SqlExternalSyncSettingError kind. */ + public kind: string; + + /** SqlExternalSyncSettingError type. */ + public type: (google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|keyof typeof google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType); + + /** SqlExternalSyncSettingError detail. */ + public detail: string; + + /** + * Creates a new SqlExternalSyncSettingError instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlExternalSyncSettingError instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlExternalSyncSettingError): google.cloud.sql.v1.SqlExternalSyncSettingError; + + /** + * Encodes the specified SqlExternalSyncSettingError message. Does not implicitly {@link google.cloud.sql.v1.SqlExternalSyncSettingError.verify|verify} messages. + * @param message SqlExternalSyncSettingError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlExternalSyncSettingError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlExternalSyncSettingError message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlExternalSyncSettingError.verify|verify} messages. + * @param message SqlExternalSyncSettingError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlExternalSyncSettingError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlExternalSyncSettingError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlExternalSyncSettingError; + + /** + * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlExternalSyncSettingError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlExternalSyncSettingError; + + /** + * Verifies a SqlExternalSyncSettingError message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlExternalSyncSettingError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlExternalSyncSettingError + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlExternalSyncSettingError; + + /** + * Creates a plain object from a SqlExternalSyncSettingError message. Also converts values to other types if specified. + * @param message SqlExternalSyncSettingError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlExternalSyncSettingError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlExternalSyncSettingError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlExternalSyncSettingError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlExternalSyncSettingError { + + /** SqlExternalSyncSettingErrorType enum. */ + enum SqlExternalSyncSettingErrorType { + SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED = 0, + CONNECTION_FAILURE = 1, + BINLOG_NOT_ENABLED = 2, + INCOMPATIBLE_DATABASE_VERSION = 3, + REPLICA_ALREADY_SETUP = 4, + INSUFFICIENT_PRIVILEGE = 5, + UNSUPPORTED_MIGRATION_TYPE = 6, + NO_PGLOGICAL_INSTALLED = 7, + PGLOGICAL_NODE_ALREADY_EXISTS = 8, + INVALID_WAL_LEVEL = 9, + INVALID_SHARED_PRELOAD_LIBRARY = 10, + INSUFFICIENT_MAX_REPLICATION_SLOTS = 11, + INSUFFICIENT_MAX_WAL_SENDERS = 12, + INSUFFICIENT_MAX_WORKER_PROCESSES = 13, + UNSUPPORTED_EXTENSIONS = 14, + INVALID_RDS_LOGICAL_REPLICATION = 15, + INVALID_LOGGING_SETUP = 16, + INVALID_DB_PARAM = 17, + UNSUPPORTED_GTID_MODE = 18, + SQLSERVER_AGENT_NOT_RUNNING = 19, + UNSUPPORTED_TABLE_DEFINITION = 20, + UNSUPPORTED_DEFINER = 21, + SQLSERVER_SERVERNAME_MISMATCH = 22, + PRIMARY_ALREADY_SETUP = 23, + UNSUPPORTED_BINLOG_FORMAT = 24, + BINLOG_RETENTION_SETTING = 25, + UNSUPPORTED_STORAGE_ENGINE = 26, + LIMITED_SUPPORT_TABLES = 27, + EXISTING_DATA_IN_REPLICA = 28, + MISSING_OPTIONAL_PRIVILEGES = 29, + RISKY_BACKUP_ADMIN_PRIVILEGE = 30, + INSUFFICIENT_GCS_PERMISSIONS = 31, + INVALID_FILE_INFO = 32, + UNSUPPORTED_DATABASE_SETTINGS = 33, + MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE = 34, + LOCAL_INFILE_OFF = 35, + TURN_ON_PITR_AFTER_PROMOTE = 36, + INCOMPATIBLE_DATABASE_MINOR_VERSION = 37, + SOURCE_MAX_SUBSCRIPTIONS = 38, + UNABLE_TO_VERIFY_DEFINERS = 39, + SUBSCRIPTION_CALCULATION_STATUS = 40, + PG_SUBSCRIPTION_COUNT = 41, + PG_SYNC_PARALLEL_LEVEL = 42, + INSUFFICIENT_DISK_SIZE = 43, + INSUFFICIENT_MACHINE_TIER = 44, + UNSUPPORTED_EXTENSIONS_NOT_MIGRATED = 45, + EXTENSIONS_NOT_MIGRATED = 46, + PG_CRON_FLAG_ENABLED_IN_REPLICA = 47, + EXTENSIONS_NOT_ENABLED_IN_REPLICA = 48, + UNSUPPORTED_COLUMNS = 49, + USERS_NOT_CREATED_IN_REPLICA = 50, + UNSUPPORTED_SYSTEM_OBJECTS = 51, + UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY = 52, + SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE = 53, + PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI = 54, + SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS = 55, + PROMPT_DELETE_EXISTING = 56, + WILL_DELETE_EXISTING = 57, + PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE = 58 + } + } + + /** Properties of a SelectedObjects. */ + interface ISelectedObjects { + + /** SelectedObjects database */ + database?: (string|null); + } + + /** Represents a SelectedObjects. */ + class SelectedObjects implements ISelectedObjects { + + /** + * Constructs a new SelectedObjects. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISelectedObjects); + + /** SelectedObjects database. */ + public database: string; + + /** + * Creates a new SelectedObjects instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectedObjects instance + */ + public static create(properties?: google.cloud.sql.v1.ISelectedObjects): google.cloud.sql.v1.SelectedObjects; + + /** + * Encodes the specified SelectedObjects message. Does not implicitly {@link google.cloud.sql.v1.SelectedObjects.verify|verify} messages. + * @param message SelectedObjects message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISelectedObjects, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectedObjects message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SelectedObjects.verify|verify} messages. + * @param message SelectedObjects message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISelectedObjects, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectedObjects message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectedObjects + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SelectedObjects; + + /** + * Decodes a SelectedObjects message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectedObjects + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SelectedObjects; + + /** + * Verifies a SelectedObjects message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SelectedObjects message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectedObjects + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SelectedObjects; + + /** + * Creates a plain object from a SelectedObjects message. Also converts values to other types if specified. + * @param message SelectedObjects + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SelectedObjects, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectedObjects to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectedObjects + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OnPremisesConfiguration. */ + interface IOnPremisesConfiguration { + + /** OnPremisesConfiguration hostPort */ + hostPort?: (string|null); + + /** OnPremisesConfiguration kind */ + kind?: (string|null); + + /** OnPremisesConfiguration username */ + username?: (string|null); + + /** OnPremisesConfiguration password */ + password?: (string|null); + + /** OnPremisesConfiguration caCertificate */ + caCertificate?: (string|null); + + /** OnPremisesConfiguration clientCertificate */ + clientCertificate?: (string|null); + + /** OnPremisesConfiguration clientKey */ + clientKey?: (string|null); + + /** OnPremisesConfiguration dumpFilePath */ + dumpFilePath?: (string|null); + + /** OnPremisesConfiguration sourceInstance */ + sourceInstance?: (google.cloud.sql.v1.IInstanceReference|null); + + /** OnPremisesConfiguration selectedObjects */ + selectedObjects?: (google.cloud.sql.v1.ISelectedObjects[]|null); + + /** OnPremisesConfiguration sslOption */ + sslOption?: (google.cloud.sql.v1.OnPremisesConfiguration.SslOption|keyof typeof google.cloud.sql.v1.OnPremisesConfiguration.SslOption|null); + } + + /** Represents an OnPremisesConfiguration. */ + class OnPremisesConfiguration implements IOnPremisesConfiguration { + + /** + * Constructs a new OnPremisesConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IOnPremisesConfiguration); + + /** OnPremisesConfiguration hostPort. */ + public hostPort: string; + + /** OnPremisesConfiguration kind. */ + public kind: string; + + /** OnPremisesConfiguration username. */ + public username: string; + + /** OnPremisesConfiguration password. */ + public password: string; + + /** OnPremisesConfiguration caCertificate. */ + public caCertificate: string; + + /** OnPremisesConfiguration clientCertificate. */ + public clientCertificate: string; + + /** OnPremisesConfiguration clientKey. */ + public clientKey: string; + + /** OnPremisesConfiguration dumpFilePath. */ + public dumpFilePath: string; + + /** OnPremisesConfiguration sourceInstance. */ + public sourceInstance?: (google.cloud.sql.v1.IInstanceReference|null); + + /** OnPremisesConfiguration selectedObjects. */ + public selectedObjects: google.cloud.sql.v1.ISelectedObjects[]; + + /** OnPremisesConfiguration sslOption. */ + public sslOption: (google.cloud.sql.v1.OnPremisesConfiguration.SslOption|keyof typeof google.cloud.sql.v1.OnPremisesConfiguration.SslOption); + + /** + * Creates a new OnPremisesConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns OnPremisesConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1.IOnPremisesConfiguration): google.cloud.sql.v1.OnPremisesConfiguration; + + /** + * Encodes the specified OnPremisesConfiguration message. Does not implicitly {@link google.cloud.sql.v1.OnPremisesConfiguration.verify|verify} messages. + * @param message OnPremisesConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IOnPremisesConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OnPremisesConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OnPremisesConfiguration.verify|verify} messages. + * @param message OnPremisesConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IOnPremisesConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OnPremisesConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OnPremisesConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.OnPremisesConfiguration; + + /** + * Decodes an OnPremisesConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OnPremisesConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.OnPremisesConfiguration; + + /** + * Verifies an OnPremisesConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OnPremisesConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OnPremisesConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.OnPremisesConfiguration; + + /** + * Creates a plain object from an OnPremisesConfiguration message. Also converts values to other types if specified. + * @param message OnPremisesConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.OnPremisesConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OnPremisesConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OnPremisesConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace OnPremisesConfiguration { + + /** SslOption enum. */ + enum SslOption { + SSL_OPTION_UNSPECIFIED = 0, + DISABLE = 1, + REQUIRE = 2, + VERIFY_CA = 3 + } + } + + /** Properties of a ReplicaConfiguration. */ + interface IReplicaConfiguration { + + /** ReplicaConfiguration kind */ + kind?: (string|null); + + /** ReplicaConfiguration mysqlReplicaConfiguration */ + mysqlReplicaConfiguration?: (google.cloud.sql.v1.IMySqlReplicaConfiguration|null); + + /** ReplicaConfiguration failoverTarget */ + failoverTarget?: (google.protobuf.IBoolValue|null); + + /** ReplicaConfiguration cascadableReplica */ + cascadableReplica?: (google.protobuf.IBoolValue|null); + } + + /** Represents a ReplicaConfiguration. */ + class ReplicaConfiguration implements IReplicaConfiguration { + + /** + * Constructs a new ReplicaConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IReplicaConfiguration); + + /** ReplicaConfiguration kind. */ + public kind: string; + + /** ReplicaConfiguration mysqlReplicaConfiguration. */ + public mysqlReplicaConfiguration?: (google.cloud.sql.v1.IMySqlReplicaConfiguration|null); + + /** ReplicaConfiguration failoverTarget. */ + public failoverTarget?: (google.protobuf.IBoolValue|null); + + /** ReplicaConfiguration cascadableReplica. */ + public cascadableReplica?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new ReplicaConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplicaConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1.IReplicaConfiguration): google.cloud.sql.v1.ReplicaConfiguration; + + /** + * Encodes the specified ReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.ReplicaConfiguration.verify|verify} messages. + * @param message ReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReplicaConfiguration.verify|verify} messages. + * @param message ReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReplicaConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ReplicaConfiguration; + + /** + * Decodes a ReplicaConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ReplicaConfiguration; + + /** + * Verifies a ReplicaConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplicaConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ReplicaConfiguration; + + /** + * Creates a plain object from a ReplicaConfiguration message. Also converts values to other types if specified. + * @param message ReplicaConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReplicaConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplicaConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesExecuteSqlRequest. */ + interface ISqlInstancesExecuteSqlRequest { + + /** SqlInstancesExecuteSqlRequest instance */ + instance?: (string|null); + + /** SqlInstancesExecuteSqlRequest project */ + project?: (string|null); + + /** SqlInstancesExecuteSqlRequest body */ + body?: (google.cloud.sql.v1.IExecuteSqlPayload|null); + } + + /** Represents a SqlInstancesExecuteSqlRequest. */ + class SqlInstancesExecuteSqlRequest implements ISqlInstancesExecuteSqlRequest { + + /** + * Constructs a new SqlInstancesExecuteSqlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest); + + /** SqlInstancesExecuteSqlRequest instance. */ + public instance: string; + + /** SqlInstancesExecuteSqlRequest project. */ + public project: string; + + /** SqlInstancesExecuteSqlRequest body. */ + public body?: (google.cloud.sql.v1.IExecuteSqlPayload|null); + + /** + * Creates a new SqlInstancesExecuteSqlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesExecuteSqlRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest): google.cloud.sql.v1.SqlInstancesExecuteSqlRequest; + + /** + * Encodes the specified SqlInstancesExecuteSqlRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlRequest.verify|verify} messages. + * @param message SqlInstancesExecuteSqlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesExecuteSqlRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlRequest.verify|verify} messages. + * @param message SqlInstancesExecuteSqlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesExecuteSqlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesExecuteSqlRequest; + + /** + * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesExecuteSqlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesExecuteSqlRequest; + + /** + * Verifies a SqlInstancesExecuteSqlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesExecuteSqlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesExecuteSqlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesExecuteSqlRequest; + + /** + * Creates a plain object from a SqlInstancesExecuteSqlRequest message. Also converts values to other types if specified. + * @param message SqlInstancesExecuteSqlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesExecuteSqlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesExecuteSqlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesExecuteSqlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExecuteSqlPayload. */ + interface IExecuteSqlPayload { + + /** ExecuteSqlPayload user */ + user?: (string|null); + + /** ExecuteSqlPayload sqlStatement */ + sqlStatement?: (string|null); + + /** ExecuteSqlPayload database */ + database?: (string|null); + + /** ExecuteSqlPayload autoIamAuthn */ + autoIamAuthn?: (boolean|null); + + /** ExecuteSqlPayload rowLimit */ + rowLimit?: (number|Long|string|null); + + /** ExecuteSqlPayload partialResultMode */ + partialResultMode?: (google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode|keyof typeof google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode|null); + + /** ExecuteSqlPayload application */ + application?: (string|null); + } + + /** Represents an ExecuteSqlPayload. */ + class ExecuteSqlPayload implements IExecuteSqlPayload { + + /** + * Constructs a new ExecuteSqlPayload. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IExecuteSqlPayload); + + /** ExecuteSqlPayload user. */ + public user: string; + + /** ExecuteSqlPayload sqlStatement. */ + public sqlStatement: string; + + /** ExecuteSqlPayload database. */ + public database: string; + + /** ExecuteSqlPayload autoIamAuthn. */ + public autoIamAuthn?: (boolean|null); + + /** ExecuteSqlPayload rowLimit. */ + public rowLimit: (number|Long|string); + + /** ExecuteSqlPayload partialResultMode. */ + public partialResultMode: (google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode|keyof typeof google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode); + + /** ExecuteSqlPayload application. */ + public application: string; + + /** ExecuteSqlPayload userPassword. */ + public userPassword?: "autoIamAuthn"; + + /** + * Creates a new ExecuteSqlPayload instance using the specified properties. + * @param [properties] Properties to set + * @returns ExecuteSqlPayload instance + */ + public static create(properties?: google.cloud.sql.v1.IExecuteSqlPayload): google.cloud.sql.v1.ExecuteSqlPayload; + + /** + * Encodes the specified ExecuteSqlPayload message. Does not implicitly {@link google.cloud.sql.v1.ExecuteSqlPayload.verify|verify} messages. + * @param message ExecuteSqlPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IExecuteSqlPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExecuteSqlPayload message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExecuteSqlPayload.verify|verify} messages. + * @param message ExecuteSqlPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IExecuteSqlPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExecuteSqlPayload message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExecuteSqlPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExecuteSqlPayload; + + /** + * Decodes an ExecuteSqlPayload message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExecuteSqlPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExecuteSqlPayload; + + /** + * Verifies an ExecuteSqlPayload message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExecuteSqlPayload message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExecuteSqlPayload + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExecuteSqlPayload; + + /** + * Creates a plain object from an ExecuteSqlPayload message. Also converts values to other types if specified. + * @param message ExecuteSqlPayload + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ExecuteSqlPayload, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExecuteSqlPayload to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExecuteSqlPayload + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ExecuteSqlPayload { + + /** PartialResultMode enum. */ + enum PartialResultMode { + PARTIAL_RESULT_MODE_UNSPECIFIED = 0, + FAIL_PARTIAL_RESULT = 1, + ALLOW_PARTIAL_RESULT = 2 + } + } + + /** Properties of a SqlInstancesExecuteSqlResponse. */ + interface ISqlInstancesExecuteSqlResponse { + + /** SqlInstancesExecuteSqlResponse messages */ + messages?: (google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage[]|null); + + /** SqlInstancesExecuteSqlResponse metadata */ + metadata?: (google.cloud.sql.v1.IMetadata|null); + + /** SqlInstancesExecuteSqlResponse results */ + results?: (google.cloud.sql.v1.IQueryResult[]|null); + + /** SqlInstancesExecuteSqlResponse status */ + status?: (google.rpc.IStatus|null); + } + + /** Represents a SqlInstancesExecuteSqlResponse. */ + class SqlInstancesExecuteSqlResponse implements ISqlInstancesExecuteSqlResponse { + + /** + * Constructs a new SqlInstancesExecuteSqlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse); + + /** SqlInstancesExecuteSqlResponse messages. */ + public messages: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage[]; + + /** SqlInstancesExecuteSqlResponse metadata. */ + public metadata?: (google.cloud.sql.v1.IMetadata|null); + + /** SqlInstancesExecuteSqlResponse results. */ + public results: google.cloud.sql.v1.IQueryResult[]; + + /** SqlInstancesExecuteSqlResponse status. */ + public status?: (google.rpc.IStatus|null); + + /** + * Creates a new SqlInstancesExecuteSqlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesExecuteSqlResponse instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse; + + /** + * Encodes the specified SqlInstancesExecuteSqlResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.verify|verify} messages. + * @param message SqlInstancesExecuteSqlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesExecuteSqlResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.verify|verify} messages. + * @param message SqlInstancesExecuteSqlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesExecuteSqlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse; + + /** + * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesExecuteSqlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse; + + /** + * Verifies a SqlInstancesExecuteSqlResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesExecuteSqlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesExecuteSqlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse; + + /** + * Creates a plain object from a SqlInstancesExecuteSqlResponse message. Also converts values to other types if specified. + * @param message SqlInstancesExecuteSqlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesExecuteSqlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesExecuteSqlResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlInstancesExecuteSqlResponse { + + /** Properties of a Message. */ + interface IMessage { + + /** Message message */ + message?: (string|null); + + /** Message severity */ + severity?: (string|null); + } + + /** Represents a Message. */ + class Message implements IMessage { + + /** + * Constructs a new Message. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage); + + /** Message message. */ + public message?: (string|null); + + /** Message severity. */ + public severity?: (string|null); + + /** + * Creates a new Message instance using the specified properties. + * @param [properties] Properties to set + * @returns Message instance + */ + public static create(properties?: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Message message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message; + + /** + * Verifies a Message message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Message + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @param message Message + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Message to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Message + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a QueryResult. */ + interface IQueryResult { + + /** QueryResult columns */ + columns?: (google.cloud.sql.v1.IColumn[]|null); + + /** QueryResult rows */ + rows?: (google.cloud.sql.v1.IRow[]|null); + + /** QueryResult message */ + message?: (string|null); + + /** QueryResult partialResult */ + partialResult?: (boolean|null); + + /** QueryResult status */ + status?: (google.rpc.IStatus|null); + } + + /** Represents a QueryResult. */ + class QueryResult implements IQueryResult { + + /** + * Constructs a new QueryResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IQueryResult); + + /** QueryResult columns. */ + public columns: google.cloud.sql.v1.IColumn[]; + + /** QueryResult rows. */ + public rows: google.cloud.sql.v1.IRow[]; + + /** QueryResult message. */ + public message: string; + + /** QueryResult partialResult. */ + public partialResult: boolean; + + /** QueryResult status. */ + public status?: (google.rpc.IStatus|null); + + /** + * Creates a new QueryResult instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryResult instance + */ + public static create(properties?: google.cloud.sql.v1.IQueryResult): google.cloud.sql.v1.QueryResult; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.sql.v1.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.sql.v1.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.QueryResult; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.QueryResult; + + /** + * Verifies a QueryResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.QueryResult; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @param message QueryResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.QueryResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Column. */ + interface IColumn { + + /** Column name */ + name?: (string|null); + + /** Column type */ + type?: (string|null); + } + + /** Represents a Column. */ + class Column implements IColumn { + + /** + * Constructs a new Column. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IColumn); + + /** Column name. */ + public name: string; + + /** Column type. */ + public type: string; + + /** + * Creates a new Column instance using the specified properties. + * @param [properties] Properties to set + * @returns Column instance + */ + public static create(properties?: google.cloud.sql.v1.IColumn): google.cloud.sql.v1.Column; + + /** + * Encodes the specified Column message. Does not implicitly {@link google.cloud.sql.v1.Column.verify|verify} messages. + * @param message Column message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IColumn, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Column message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Column.verify|verify} messages. + * @param message Column message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IColumn, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Column message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Column + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Column; + + /** + * Decodes a Column message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Column + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Column; + + /** + * Verifies a Column message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Column message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Column + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Column; + + /** + * Creates a plain object from a Column message. Also converts values to other types if specified. + * @param message Column + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.Column, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Column to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Column + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Row. */ + interface IRow { + + /** Row values */ + values?: (google.cloud.sql.v1.IValue[]|null); + } + + /** Represents a Row. */ + class Row implements IRow { + + /** + * Constructs a new Row. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IRow); + + /** Row values. */ + public values: google.cloud.sql.v1.IValue[]; + + /** + * Creates a new Row instance using the specified properties. + * @param [properties] Properties to set + * @returns Row instance + */ + public static create(properties?: google.cloud.sql.v1.IRow): google.cloud.sql.v1.Row; + + /** + * Encodes the specified Row message. Does not implicitly {@link google.cloud.sql.v1.Row.verify|verify} messages. + * @param message Row message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Row message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Row.verify|verify} messages. + * @param message Row message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Row message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Row; + + /** + * Decodes a Row message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Row; + + /** + * Verifies a Row message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Row message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Row + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Row; + + /** + * Creates a plain object from a Row message. Also converts values to other types if specified. + * @param message Row + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.Row, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Row to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Row + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Value. */ + interface IValue { + + /** Value value */ + value?: (string|null); + + /** Value nullValue */ + nullValue?: (boolean|null); + } + + /** Represents a Value. */ + class Value implements IValue { + + /** + * Constructs a new Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IValue); + + /** Value value. */ + public value: string; + + /** Value nullValue. */ + public nullValue: boolean; + + /** + * Creates a new Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Value instance + */ + public static create(properties?: google.cloud.sql.v1.IValue): google.cloud.sql.v1.Value; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.cloud.sql.v1.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Value; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Value; + + /** + * Verifies a Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Value + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Value; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @param message Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Metadata. */ + interface IMetadata { + + /** Metadata sqlStatementExecutionTime */ + sqlStatementExecutionTime?: (google.protobuf.IDuration|null); + } + + /** Represents a Metadata. */ + class Metadata implements IMetadata { + + /** + * Constructs a new Metadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IMetadata); + + /** Metadata sqlStatementExecutionTime. */ + public sqlStatementExecutionTime?: (google.protobuf.IDuration|null); + + /** + * Creates a new Metadata instance using the specified properties. + * @param [properties] Properties to set + * @returns Metadata instance + */ + public static create(properties?: google.cloud.sql.v1.IMetadata): google.cloud.sql.v1.Metadata; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.sql.v1.Metadata.verify|verify} messages. + * @param message Metadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Metadata.verify|verify} messages. + * @param message Metadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Metadata; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Metadata; + + /** + * Verifies a Metadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Metadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Metadata; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @param message Metadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.Metadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Metadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Metadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesAcquireSsrsLeaseRequest. */ + interface ISqlInstancesAcquireSsrsLeaseRequest { + + /** SqlInstancesAcquireSsrsLeaseRequest instance */ + instance?: (string|null); + + /** SqlInstancesAcquireSsrsLeaseRequest project */ + project?: (string|null); + + /** SqlInstancesAcquireSsrsLeaseRequest body */ + body?: (google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest|null); + } + + /** Represents a SqlInstancesAcquireSsrsLeaseRequest. */ + class SqlInstancesAcquireSsrsLeaseRequest implements ISqlInstancesAcquireSsrsLeaseRequest { + + /** + * Constructs a new SqlInstancesAcquireSsrsLeaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest); + + /** SqlInstancesAcquireSsrsLeaseRequest instance. */ + public instance: string; + + /** SqlInstancesAcquireSsrsLeaseRequest project. */ + public project: string; + + /** SqlInstancesAcquireSsrsLeaseRequest body. */ + public body?: (google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest|null); + + /** + * Creates a new SqlInstancesAcquireSsrsLeaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesAcquireSsrsLeaseRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @param message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @param message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest; + + /** + * Verifies a SqlInstancesAcquireSsrsLeaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesAcquireSsrsLeaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest; + + /** + * Creates a plain object from a SqlInstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. + * @param message SqlInstancesAcquireSsrsLeaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesAcquireSsrsLeaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesAcquireSsrsLeaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesAcquireSsrsLeaseResponse. */ + interface ISqlInstancesAcquireSsrsLeaseResponse { + + /** SqlInstancesAcquireSsrsLeaseResponse operationId */ + operationId?: (string|null); + } + + /** Represents a SqlInstancesAcquireSsrsLeaseResponse. */ + class SqlInstancesAcquireSsrsLeaseResponse implements ISqlInstancesAcquireSsrsLeaseResponse { + + /** + * Constructs a new SqlInstancesAcquireSsrsLeaseResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse); + + /** SqlInstancesAcquireSsrsLeaseResponse operationId. */ + public operationId: string; + + /** + * Creates a new SqlInstancesAcquireSsrsLeaseResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesAcquireSsrsLeaseResponse instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. + * @param message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. + * @param message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesAcquireSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesAcquireSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse; + + /** + * Verifies a SqlInstancesAcquireSsrsLeaseResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesAcquireSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesAcquireSsrsLeaseResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse; + + /** + * Creates a plain object from a SqlInstancesAcquireSsrsLeaseResponse message. Also converts values to other types if specified. + * @param message SqlInstancesAcquireSsrsLeaseResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesAcquireSsrsLeaseResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesAcquireSsrsLeaseResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesReleaseSsrsLeaseRequest. */ + interface ISqlInstancesReleaseSsrsLeaseRequest { + + /** SqlInstancesReleaseSsrsLeaseRequest instance */ + instance?: (string|null); + + /** SqlInstancesReleaseSsrsLeaseRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesReleaseSsrsLeaseRequest. */ + class SqlInstancesReleaseSsrsLeaseRequest implements ISqlInstancesReleaseSsrsLeaseRequest { + + /** + * Constructs a new SqlInstancesReleaseSsrsLeaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest); + + /** SqlInstancesReleaseSsrsLeaseRequest instance. */ + public instance: string; + + /** SqlInstancesReleaseSsrsLeaseRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesReleaseSsrsLeaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesReleaseSsrsLeaseRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. + * @param message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. + * @param message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesReleaseSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesReleaseSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest; + + /** + * Verifies a SqlInstancesReleaseSsrsLeaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesReleaseSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesReleaseSsrsLeaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest; + + /** + * Creates a plain object from a SqlInstancesReleaseSsrsLeaseRequest message. Also converts values to other types if specified. + * @param message SqlInstancesReleaseSsrsLeaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesReleaseSsrsLeaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesReleaseSsrsLeaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesReleaseSsrsLeaseResponse. */ + interface ISqlInstancesReleaseSsrsLeaseResponse { + + /** SqlInstancesReleaseSsrsLeaseResponse operationId */ + operationId?: (string|null); + } + + /** Represents a SqlInstancesReleaseSsrsLeaseResponse. */ + class SqlInstancesReleaseSsrsLeaseResponse implements ISqlInstancesReleaseSsrsLeaseResponse { + + /** + * Constructs a new SqlInstancesReleaseSsrsLeaseResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse); + + /** SqlInstancesReleaseSsrsLeaseResponse operationId. */ + public operationId: string; + + /** + * Creates a new SqlInstancesReleaseSsrsLeaseResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesReleaseSsrsLeaseResponse instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. + * @param message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. + * @param message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesReleaseSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesReleaseSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse; + + /** + * Verifies a SqlInstancesReleaseSsrsLeaseResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesReleaseSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesReleaseSsrsLeaseResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse; + + /** + * Creates a plain object from a SqlInstancesReleaseSsrsLeaseResponse message. Also converts values to other types if specified. + * @param message SqlInstancesReleaseSsrsLeaseResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesReleaseSsrsLeaseResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesReleaseSsrsLeaseResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesPointInTimeRestoreRequest. */ + interface ISqlInstancesPointInTimeRestoreRequest { + + /** SqlInstancesPointInTimeRestoreRequest parent */ + parent?: (string|null); + + /** SqlInstancesPointInTimeRestoreRequest context */ + context?: (google.cloud.sql.v1.IPointInTimeRestoreContext|null); + } + + /** Represents a SqlInstancesPointInTimeRestoreRequest. */ + class SqlInstancesPointInTimeRestoreRequest implements ISqlInstancesPointInTimeRestoreRequest { + + /** + * Constructs a new SqlInstancesPointInTimeRestoreRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest); + + /** SqlInstancesPointInTimeRestoreRequest parent. */ + public parent: string; + + /** SqlInstancesPointInTimeRestoreRequest context. */ + public context?: (google.cloud.sql.v1.IPointInTimeRestoreContext|null); + + /** + * Creates a new SqlInstancesPointInTimeRestoreRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesPointInTimeRestoreRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest): google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest; + + /** + * Encodes the specified SqlInstancesPointInTimeRestoreRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. + * @param message SqlInstancesPointInTimeRestoreRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesPointInTimeRestoreRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. + * @param message SqlInstancesPointInTimeRestoreRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesPointInTimeRestoreRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest; + + /** + * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesPointInTimeRestoreRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest; + + /** + * Verifies a SqlInstancesPointInTimeRestoreRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesPointInTimeRestoreRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesPointInTimeRestoreRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest; + + /** + * Creates a plain object from a SqlInstancesPointInTimeRestoreRequest message. Also converts values to other types if specified. + * @param message SqlInstancesPointInTimeRestoreRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesPointInTimeRestoreRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesPointInTimeRestoreRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlInstanceType enum. */ + enum SqlInstanceType { + SQL_INSTANCE_TYPE_UNSPECIFIED = 0, + CLOUD_SQL_INSTANCE = 1, + ON_PREMISES_INSTANCE = 2, + READ_REPLICA_INSTANCE = 3, + READ_POOL_INSTANCE = 5 + } + + /** SqlSuspensionReason enum. */ + enum SqlSuspensionReason { + SQL_SUSPENSION_REASON_UNSPECIFIED = 0, + BILLING_ISSUE = 2, + LEGAL_ISSUE = 3, + OPERATIONAL_ISSUE = 4, + KMS_KEY_ISSUE = 5, + PROJECT_ABUSE = 8 + } + + /** Represents a SqlConnectService */ + class SqlConnectService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlConnectService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlConnectService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlConnectService; + + /** + * Calls GetConnectSettings. + * @param request GetConnectSettingsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConnectSettings + */ + public getConnectSettings(request: google.cloud.sql.v1.IGetConnectSettingsRequest, callback: google.cloud.sql.v1.SqlConnectService.GetConnectSettingsCallback): void; + + /** + * Calls GetConnectSettings. + * @param request GetConnectSettingsRequest message or plain object + * @returns Promise + */ + public getConnectSettings(request: google.cloud.sql.v1.IGetConnectSettingsRequest): Promise; + + /** + * Calls GenerateEphemeralCert. + * @param request GenerateEphemeralCertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateEphemeralCertResponse + */ + public generateEphemeralCert(request: google.cloud.sql.v1.IGenerateEphemeralCertRequest, callback: google.cloud.sql.v1.SqlConnectService.GenerateEphemeralCertCallback): void; + + /** + * Calls GenerateEphemeralCert. + * @param request GenerateEphemeralCertRequest message or plain object + * @returns Promise + */ + public generateEphemeralCert(request: google.cloud.sql.v1.IGenerateEphemeralCertRequest): Promise; + } + + namespace SqlConnectService { + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlConnectService|getConnectSettings}. + * @param error Error, if any + * @param [response] ConnectSettings + */ + type GetConnectSettingsCallback = (error: (Error|null), response?: google.cloud.sql.v1.ConnectSettings) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlConnectService|generateEphemeralCert}. + * @param error Error, if any + * @param [response] GenerateEphemeralCertResponse + */ + type GenerateEphemeralCertCallback = (error: (Error|null), response?: google.cloud.sql.v1.GenerateEphemeralCertResponse) => void; + } + + /** Properties of a GetConnectSettingsRequest. */ + interface IGetConnectSettingsRequest { + + /** GetConnectSettingsRequest instance */ + instance?: (string|null); + + /** GetConnectSettingsRequest project */ + project?: (string|null); + + /** GetConnectSettingsRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a GetConnectSettingsRequest. */ + class GetConnectSettingsRequest implements IGetConnectSettingsRequest { + + /** + * Constructs a new GetConnectSettingsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IGetConnectSettingsRequest); + + /** GetConnectSettingsRequest instance. */ + public instance: string; + + /** GetConnectSettingsRequest project. */ + public project: string; + + /** GetConnectSettingsRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new GetConnectSettingsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetConnectSettingsRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IGetConnectSettingsRequest): google.cloud.sql.v1.GetConnectSettingsRequest; + + /** + * Encodes the specified GetConnectSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1.GetConnectSettingsRequest.verify|verify} messages. + * @param message GetConnectSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IGetConnectSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetConnectSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GetConnectSettingsRequest.verify|verify} messages. + * @param message GetConnectSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IGetConnectSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetConnectSettingsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetConnectSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.GetConnectSettingsRequest; + + /** + * Decodes a GetConnectSettingsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetConnectSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.GetConnectSettingsRequest; + + /** + * Verifies a GetConnectSettingsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetConnectSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetConnectSettingsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.GetConnectSettingsRequest; + + /** + * Creates a plain object from a GetConnectSettingsRequest message. Also converts values to other types if specified. + * @param message GetConnectSettingsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.GetConnectSettingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetConnectSettingsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetConnectSettingsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ConnectSettings. */ + interface IConnectSettings { + + /** ConnectSettings kind */ + kind?: (string|null); + + /** ConnectSettings serverCaCert */ + serverCaCert?: (google.cloud.sql.v1.ISslCert|null); + + /** ConnectSettings ipAddresses */ + ipAddresses?: (google.cloud.sql.v1.IIpMapping[]|null); + + /** ConnectSettings region */ + region?: (string|null); + + /** ConnectSettings databaseVersion */ + databaseVersion?: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion|null); + + /** ConnectSettings backendType */ + backendType?: (google.cloud.sql.v1.SqlBackendType|keyof typeof google.cloud.sql.v1.SqlBackendType|null); + + /** ConnectSettings pscEnabled */ + pscEnabled?: (boolean|null); + + /** ConnectSettings dnsName */ + dnsName?: (string|null); + + /** ConnectSettings serverCaMode */ + serverCaMode?: (google.cloud.sql.v1.ConnectSettings.CaMode|keyof typeof google.cloud.sql.v1.ConnectSettings.CaMode|null); + + /** ConnectSettings customSubjectAlternativeNames */ + customSubjectAlternativeNames?: (string[]|null); + + /** ConnectSettings dnsNames */ + dnsNames?: (google.cloud.sql.v1.IDnsNameMapping[]|null); + + /** ConnectSettings nodeCount */ + nodeCount?: (number|null); + + /** ConnectSettings nodes */ + nodes?: (google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig[]|null); + + /** ConnectSettings mdxProtocolSupport */ + mdxProtocolSupport?: (google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport[]|null); + } + + /** Represents a ConnectSettings. */ + class ConnectSettings implements IConnectSettings { + + /** + * Constructs a new ConnectSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IConnectSettings); + + /** ConnectSettings kind. */ + public kind: string; + + /** ConnectSettings serverCaCert. */ + public serverCaCert?: (google.cloud.sql.v1.ISslCert|null); + + /** ConnectSettings ipAddresses. */ + public ipAddresses: google.cloud.sql.v1.IIpMapping[]; + + /** ConnectSettings region. */ + public region: string; + + /** ConnectSettings databaseVersion. */ + public databaseVersion: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion); + + /** ConnectSettings backendType. */ + public backendType: (google.cloud.sql.v1.SqlBackendType|keyof typeof google.cloud.sql.v1.SqlBackendType); + + /** ConnectSettings pscEnabled. */ + public pscEnabled: boolean; + + /** ConnectSettings dnsName. */ + public dnsName: string; + + /** ConnectSettings serverCaMode. */ + public serverCaMode: (google.cloud.sql.v1.ConnectSettings.CaMode|keyof typeof google.cloud.sql.v1.ConnectSettings.CaMode); + + /** ConnectSettings customSubjectAlternativeNames. */ + public customSubjectAlternativeNames: string[]; + + /** ConnectSettings dnsNames. */ + public dnsNames: google.cloud.sql.v1.IDnsNameMapping[]; + + /** ConnectSettings nodeCount. */ + public nodeCount?: (number|null); + + /** ConnectSettings nodes. */ + public nodes: google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig[]; + + /** ConnectSettings mdxProtocolSupport. */ + public mdxProtocolSupport: google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport[]; + + /** + * Creates a new ConnectSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns ConnectSettings instance + */ + public static create(properties?: google.cloud.sql.v1.IConnectSettings): google.cloud.sql.v1.ConnectSettings; + + /** + * Encodes the specified ConnectSettings message. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.verify|verify} messages. + * @param message ConnectSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IConnectSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConnectSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.verify|verify} messages. + * @param message ConnectSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IConnectSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConnectSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConnectSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ConnectSettings; + + /** + * Decodes a ConnectSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConnectSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ConnectSettings; + + /** + * Verifies a ConnectSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConnectSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConnectSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ConnectSettings; + + /** + * Creates a plain object from a ConnectSettings message. Also converts values to other types if specified. + * @param message ConnectSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ConnectSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConnectSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConnectSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ConnectSettings { + + /** CaMode enum. */ + enum CaMode { + CA_MODE_UNSPECIFIED = 0, + GOOGLE_MANAGED_INTERNAL_CA = 1, + GOOGLE_MANAGED_CAS_CA = 2, + CUSTOMER_MANAGED_CAS_CA = 3 + } + + /** Properties of a ConnectPoolNodeConfig. */ + interface IConnectPoolNodeConfig { + + /** ConnectPoolNodeConfig name */ + name?: (string|null); + + /** ConnectPoolNodeConfig ipAddresses */ + ipAddresses?: (google.cloud.sql.v1.IIpMapping[]|null); + + /** ConnectPoolNodeConfig dnsName */ + dnsName?: (string|null); + + /** ConnectPoolNodeConfig dnsNames */ + dnsNames?: (google.cloud.sql.v1.IDnsNameMapping[]|null); + } + + /** Represents a ConnectPoolNodeConfig. */ + class ConnectPoolNodeConfig implements IConnectPoolNodeConfig { + + /** + * Constructs a new ConnectPoolNodeConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig); + + /** ConnectPoolNodeConfig name. */ + public name?: (string|null); + + /** ConnectPoolNodeConfig ipAddresses. */ + public ipAddresses: google.cloud.sql.v1.IIpMapping[]; + + /** ConnectPoolNodeConfig dnsName. */ + public dnsName?: (string|null); + + /** ConnectPoolNodeConfig dnsNames. */ + public dnsNames: google.cloud.sql.v1.IDnsNameMapping[]; + + /** + * Creates a new ConnectPoolNodeConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ConnectPoolNodeConfig instance + */ + public static create(properties?: google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig): google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig; + + /** + * Encodes the specified ConnectPoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. + * @param message ConnectPoolNodeConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConnectPoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. + * @param message ConnectPoolNodeConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConnectPoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig; + + /** + * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConnectPoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig; + + /** + * Verifies a ConnectPoolNodeConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConnectPoolNodeConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConnectPoolNodeConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig; + + /** + * Creates a plain object from a ConnectPoolNodeConfig message. Also converts values to other types if specified. + * @param message ConnectPoolNodeConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConnectPoolNodeConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConnectPoolNodeConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** MdxProtocolSupport enum. */ + enum MdxProtocolSupport { + MDX_PROTOCOL_SUPPORT_UNSPECIFIED = 0, + CLIENT_PROTOCOL_TYPE = 1 + } + } + + /** Properties of a GenerateEphemeralCertRequest. */ + interface IGenerateEphemeralCertRequest { + + /** GenerateEphemeralCertRequest instance */ + instance?: (string|null); + + /** GenerateEphemeralCertRequest project */ + project?: (string|null); + + /** GenerateEphemeralCertRequest publicKey */ + publicKey?: (string|null); + + /** GenerateEphemeralCertRequest accessToken */ + accessToken?: (string|null); + + /** GenerateEphemeralCertRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** GenerateEphemeralCertRequest validDuration */ + validDuration?: (google.protobuf.IDuration|null); + } + + /** Represents a GenerateEphemeralCertRequest. */ + class GenerateEphemeralCertRequest implements IGenerateEphemeralCertRequest { + + /** + * Constructs a new GenerateEphemeralCertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IGenerateEphemeralCertRequest); + + /** GenerateEphemeralCertRequest instance. */ + public instance: string; + + /** GenerateEphemeralCertRequest project. */ + public project: string; + + /** GenerateEphemeralCertRequest publicKey. */ + public publicKey: string; + + /** GenerateEphemeralCertRequest accessToken. */ + public accessToken: string; + + /** GenerateEphemeralCertRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** GenerateEphemeralCertRequest validDuration. */ + public validDuration?: (google.protobuf.IDuration|null); + + /** + * Creates a new GenerateEphemeralCertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateEphemeralCertRequest instance + */ + public static create(properties?: google.cloud.sql.v1.IGenerateEphemeralCertRequest): google.cloud.sql.v1.GenerateEphemeralCertRequest; + + /** + * Encodes the specified GenerateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertRequest.verify|verify} messages. + * @param message GenerateEphemeralCertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IGenerateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertRequest.verify|verify} messages. + * @param message GenerateEphemeralCertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IGenerateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.GenerateEphemeralCertRequest; + + /** + * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.GenerateEphemeralCertRequest; + + /** + * Verifies a GenerateEphemeralCertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateEphemeralCertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.GenerateEphemeralCertRequest; + + /** + * Creates a plain object from a GenerateEphemeralCertRequest message. Also converts values to other types if specified. + * @param message GenerateEphemeralCertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.GenerateEphemeralCertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateEphemeralCertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateEphemeralCertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GenerateEphemeralCertResponse. */ + interface IGenerateEphemeralCertResponse { + + /** GenerateEphemeralCertResponse ephemeralCert */ + ephemeralCert?: (google.cloud.sql.v1.ISslCert|null); + } + + /** Represents a GenerateEphemeralCertResponse. */ + class GenerateEphemeralCertResponse implements IGenerateEphemeralCertResponse { + + /** + * Constructs a new GenerateEphemeralCertResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IGenerateEphemeralCertResponse); + + /** GenerateEphemeralCertResponse ephemeralCert. */ + public ephemeralCert?: (google.cloud.sql.v1.ISslCert|null); + + /** + * Creates a new GenerateEphemeralCertResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateEphemeralCertResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IGenerateEphemeralCertResponse): google.cloud.sql.v1.GenerateEphemeralCertResponse; + + /** + * Encodes the specified GenerateEphemeralCertResponse message. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertResponse.verify|verify} messages. + * @param message GenerateEphemeralCertResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IGenerateEphemeralCertResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateEphemeralCertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertResponse.verify|verify} messages. + * @param message GenerateEphemeralCertResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IGenerateEphemeralCertResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateEphemeralCertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.GenerateEphemeralCertResponse; + + /** + * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateEphemeralCertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.GenerateEphemeralCertResponse; + + /** + * Verifies a GenerateEphemeralCertResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateEphemeralCertResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateEphemeralCertResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.GenerateEphemeralCertResponse; + + /** + * Creates a plain object from a GenerateEphemeralCertResponse message. Also converts values to other types if specified. + * @param message GenerateEphemeralCertResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.GenerateEphemeralCertResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateEphemeralCertResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateEphemeralCertResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a SqlDatabasesService */ + class SqlDatabasesService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlDatabasesService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlDatabasesService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlDatabasesService; + + /** + * Calls Delete. + * @param request SqlDatabasesDeleteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public delete(request: google.cloud.sql.v1.ISqlDatabasesDeleteRequest, callback: google.cloud.sql.v1.SqlDatabasesService.DeleteCallback): void; + + /** + * Calls Delete. + * @param request SqlDatabasesDeleteRequest message or plain object + * @returns Promise + */ + public delete(request: google.cloud.sql.v1.ISqlDatabasesDeleteRequest): Promise; + + /** + * Calls Get. + * @param request SqlDatabasesGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Database + */ + public get(request: google.cloud.sql.v1.ISqlDatabasesGetRequest, callback: google.cloud.sql.v1.SqlDatabasesService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlDatabasesGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1.ISqlDatabasesGetRequest): Promise; + + /** + * Calls Insert. + * @param request SqlDatabasesInsertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public insert(request: google.cloud.sql.v1.ISqlDatabasesInsertRequest, callback: google.cloud.sql.v1.SqlDatabasesService.InsertCallback): void; + + /** + * Calls Insert. + * @param request SqlDatabasesInsertRequest message or plain object + * @returns Promise + */ + public insert(request: google.cloud.sql.v1.ISqlDatabasesInsertRequest): Promise; + + /** + * Calls List. + * @param request SqlDatabasesListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DatabasesListResponse + */ + public list(request: google.cloud.sql.v1.ISqlDatabasesListRequest, callback: google.cloud.sql.v1.SqlDatabasesService.ListCallback): void; + + /** + * Calls List. + * @param request SqlDatabasesListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1.ISqlDatabasesListRequest): Promise; + + /** + * Calls Patch. + * @param request SqlDatabasesUpdateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public patch(request: google.cloud.sql.v1.ISqlDatabasesUpdateRequest, callback: google.cloud.sql.v1.SqlDatabasesService.PatchCallback): void; + + /** + * Calls Patch. + * @param request SqlDatabasesUpdateRequest message or plain object + * @returns Promise + */ + public patch(request: google.cloud.sql.v1.ISqlDatabasesUpdateRequest): Promise; + + /** + * Calls Update. + * @param request SqlDatabasesUpdateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public update(request: google.cloud.sql.v1.ISqlDatabasesUpdateRequest, callback: google.cloud.sql.v1.SqlDatabasesService.UpdateCallback): void; + + /** + * Calls Update. + * @param request SqlDatabasesUpdateRequest message or plain object + * @returns Promise + */ + public update(request: google.cloud.sql.v1.ISqlDatabasesUpdateRequest): Promise; + } + + namespace SqlDatabasesService { + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|delete_}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|get}. + * @param error Error, if any + * @param [response] Database + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.Database) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|insert}. + * @param error Error, if any + * @param [response] Operation + */ + type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|list}. + * @param error Error, if any + * @param [response] DatabasesListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.DatabasesListResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|patch}. + * @param error Error, if any + * @param [response] Operation + */ + type PatchCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|update}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + } + + /** Properties of a SqlDatabasesDeleteRequest. */ + interface ISqlDatabasesDeleteRequest { + + /** SqlDatabasesDeleteRequest database */ + database?: (string|null); + + /** SqlDatabasesDeleteRequest instance */ + instance?: (string|null); + + /** SqlDatabasesDeleteRequest project */ + project?: (string|null); + } + + /** Represents a SqlDatabasesDeleteRequest. */ + class SqlDatabasesDeleteRequest implements ISqlDatabasesDeleteRequest { + + /** + * Constructs a new SqlDatabasesDeleteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlDatabasesDeleteRequest); + + /** SqlDatabasesDeleteRequest database. */ + public database: string; + + /** SqlDatabasesDeleteRequest instance. */ + public instance: string; + + /** SqlDatabasesDeleteRequest project. */ + public project: string; + + /** + * Creates a new SqlDatabasesDeleteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlDatabasesDeleteRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlDatabasesDeleteRequest): google.cloud.sql.v1.SqlDatabasesDeleteRequest; + + /** + * Encodes the specified SqlDatabasesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesDeleteRequest.verify|verify} messages. + * @param message SqlDatabasesDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlDatabasesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlDatabasesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesDeleteRequest.verify|verify} messages. + * @param message SqlDatabasesDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlDatabasesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlDatabasesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlDatabasesDeleteRequest; + + /** + * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlDatabasesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlDatabasesDeleteRequest; + + /** + * Verifies a SqlDatabasesDeleteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlDatabasesDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlDatabasesDeleteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlDatabasesDeleteRequest; + + /** + * Creates a plain object from a SqlDatabasesDeleteRequest message. Also converts values to other types if specified. + * @param message SqlDatabasesDeleteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlDatabasesDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlDatabasesDeleteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlDatabasesDeleteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlDatabasesGetRequest. */ + interface ISqlDatabasesGetRequest { + + /** SqlDatabasesGetRequest database */ + database?: (string|null); + + /** SqlDatabasesGetRequest instance */ + instance?: (string|null); + + /** SqlDatabasesGetRequest project */ + project?: (string|null); + } + + /** Represents a SqlDatabasesGetRequest. */ + class SqlDatabasesGetRequest implements ISqlDatabasesGetRequest { + + /** + * Constructs a new SqlDatabasesGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlDatabasesGetRequest); + + /** SqlDatabasesGetRequest database. */ + public database: string; + + /** SqlDatabasesGetRequest instance. */ + public instance: string; + + /** SqlDatabasesGetRequest project. */ + public project: string; + + /** + * Creates a new SqlDatabasesGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlDatabasesGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlDatabasesGetRequest): google.cloud.sql.v1.SqlDatabasesGetRequest; + + /** + * Encodes the specified SqlDatabasesGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesGetRequest.verify|verify} messages. + * @param message SqlDatabasesGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlDatabasesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlDatabasesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesGetRequest.verify|verify} messages. + * @param message SqlDatabasesGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlDatabasesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlDatabasesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlDatabasesGetRequest; + + /** + * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlDatabasesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlDatabasesGetRequest; + + /** + * Verifies a SqlDatabasesGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlDatabasesGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlDatabasesGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlDatabasesGetRequest; + + /** + * Creates a plain object from a SqlDatabasesGetRequest message. Also converts values to other types if specified. + * @param message SqlDatabasesGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlDatabasesGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlDatabasesGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlDatabasesGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlDatabasesInsertRequest. */ + interface ISqlDatabasesInsertRequest { + + /** SqlDatabasesInsertRequest instance */ + instance?: (string|null); + + /** SqlDatabasesInsertRequest project */ + project?: (string|null); + + /** SqlDatabasesInsertRequest body */ + body?: (google.cloud.sql.v1.IDatabase|null); + } + + /** Represents a SqlDatabasesInsertRequest. */ + class SqlDatabasesInsertRequest implements ISqlDatabasesInsertRequest { + + /** + * Constructs a new SqlDatabasesInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlDatabasesInsertRequest); + + /** SqlDatabasesInsertRequest instance. */ + public instance: string; + + /** SqlDatabasesInsertRequest project. */ + public project: string; + + /** SqlDatabasesInsertRequest body. */ + public body?: (google.cloud.sql.v1.IDatabase|null); + + /** + * Creates a new SqlDatabasesInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlDatabasesInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlDatabasesInsertRequest): google.cloud.sql.v1.SqlDatabasesInsertRequest; + + /** + * Encodes the specified SqlDatabasesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesInsertRequest.verify|verify} messages. + * @param message SqlDatabasesInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlDatabasesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlDatabasesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesInsertRequest.verify|verify} messages. + * @param message SqlDatabasesInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlDatabasesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlDatabasesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlDatabasesInsertRequest; + + /** + * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlDatabasesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlDatabasesInsertRequest; + + /** + * Verifies a SqlDatabasesInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlDatabasesInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlDatabasesInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlDatabasesInsertRequest; + + /** + * Creates a plain object from a SqlDatabasesInsertRequest message. Also converts values to other types if specified. + * @param message SqlDatabasesInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlDatabasesInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlDatabasesInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlDatabasesInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlDatabasesListRequest. */ + interface ISqlDatabasesListRequest { + + /** SqlDatabasesListRequest instance */ + instance?: (string|null); + + /** SqlDatabasesListRequest project */ + project?: (string|null); + } + + /** Represents a SqlDatabasesListRequest. */ + class SqlDatabasesListRequest implements ISqlDatabasesListRequest { + + /** + * Constructs a new SqlDatabasesListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlDatabasesListRequest); + + /** SqlDatabasesListRequest instance. */ + public instance: string; + + /** SqlDatabasesListRequest project. */ + public project: string; + + /** + * Creates a new SqlDatabasesListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlDatabasesListRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlDatabasesListRequest): google.cloud.sql.v1.SqlDatabasesListRequest; + + /** + * Encodes the specified SqlDatabasesListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesListRequest.verify|verify} messages. + * @param message SqlDatabasesListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlDatabasesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlDatabasesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesListRequest.verify|verify} messages. + * @param message SqlDatabasesListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlDatabasesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlDatabasesListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlDatabasesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlDatabasesListRequest; + + /** + * Decodes a SqlDatabasesListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlDatabasesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlDatabasesListRequest; + + /** + * Verifies a SqlDatabasesListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlDatabasesListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlDatabasesListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlDatabasesListRequest; + + /** + * Creates a plain object from a SqlDatabasesListRequest message. Also converts values to other types if specified. + * @param message SqlDatabasesListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlDatabasesListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlDatabasesListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlDatabasesListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlDatabasesUpdateRequest. */ + interface ISqlDatabasesUpdateRequest { + + /** SqlDatabasesUpdateRequest database */ + database?: (string|null); + + /** SqlDatabasesUpdateRequest instance */ + instance?: (string|null); + + /** SqlDatabasesUpdateRequest project */ + project?: (string|null); + + /** SqlDatabasesUpdateRequest body */ + body?: (google.cloud.sql.v1.IDatabase|null); + } + + /** Represents a SqlDatabasesUpdateRequest. */ + class SqlDatabasesUpdateRequest implements ISqlDatabasesUpdateRequest { + + /** + * Constructs a new SqlDatabasesUpdateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlDatabasesUpdateRequest); + + /** SqlDatabasesUpdateRequest database. */ + public database: string; + + /** SqlDatabasesUpdateRequest instance. */ + public instance: string; + + /** SqlDatabasesUpdateRequest project. */ + public project: string; + + /** SqlDatabasesUpdateRequest body. */ + public body?: (google.cloud.sql.v1.IDatabase|null); + + /** + * Creates a new SqlDatabasesUpdateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlDatabasesUpdateRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlDatabasesUpdateRequest): google.cloud.sql.v1.SqlDatabasesUpdateRequest; + + /** + * Encodes the specified SqlDatabasesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesUpdateRequest.verify|verify} messages. + * @param message SqlDatabasesUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlDatabasesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlDatabasesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesUpdateRequest.verify|verify} messages. + * @param message SqlDatabasesUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlDatabasesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlDatabasesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlDatabasesUpdateRequest; + + /** + * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlDatabasesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlDatabasesUpdateRequest; + + /** + * Verifies a SqlDatabasesUpdateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlDatabasesUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlDatabasesUpdateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlDatabasesUpdateRequest; + + /** + * Creates a plain object from a SqlDatabasesUpdateRequest message. Also converts values to other types if specified. + * @param message SqlDatabasesUpdateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlDatabasesUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlDatabasesUpdateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlDatabasesUpdateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DatabasesListResponse. */ + interface IDatabasesListResponse { + + /** DatabasesListResponse kind */ + kind?: (string|null); + + /** DatabasesListResponse items */ + items?: (google.cloud.sql.v1.IDatabase[]|null); + } + + /** Represents a DatabasesListResponse. */ + class DatabasesListResponse implements IDatabasesListResponse { + + /** + * Constructs a new DatabasesListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IDatabasesListResponse); + + /** DatabasesListResponse kind. */ + public kind: string; + + /** DatabasesListResponse items. */ + public items: google.cloud.sql.v1.IDatabase[]; + + /** + * Creates a new DatabasesListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DatabasesListResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IDatabasesListResponse): google.cloud.sql.v1.DatabasesListResponse; + + /** + * Encodes the specified DatabasesListResponse message. Does not implicitly {@link google.cloud.sql.v1.DatabasesListResponse.verify|verify} messages. + * @param message DatabasesListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IDatabasesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DatabasesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabasesListResponse.verify|verify} messages. + * @param message DatabasesListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IDatabasesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DatabasesListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DatabasesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabasesListResponse; + + /** + * Decodes a DatabasesListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DatabasesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabasesListResponse; + + /** + * Verifies a DatabasesListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DatabasesListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DatabasesListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabasesListResponse; + + /** + * Creates a plain object from a DatabasesListResponse message. Also converts values to other types if specified. + * @param message DatabasesListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.DatabasesListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DatabasesListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DatabasesListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a SqlEventsService */ + class SqlEventsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlEventsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlEventsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlEventsService; + } + + /** Represents a SqlFeatureEligibilityService */ + class SqlFeatureEligibilityService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlFeatureEligibilityService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlFeatureEligibilityService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlFeatureEligibilityService; + } + + /** Represents a SqlFlagsService */ + class SqlFlagsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlFlagsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlFlagsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlFlagsService; + + /** + * Calls List. + * @param request SqlFlagsListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and FlagsListResponse + */ + public list(request: google.cloud.sql.v1.ISqlFlagsListRequest, callback: google.cloud.sql.v1.SqlFlagsService.ListCallback): void; + + /** + * Calls List. + * @param request SqlFlagsListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1.ISqlFlagsListRequest): Promise; + } + + namespace SqlFlagsService { + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlFlagsService|list}. + * @param error Error, if any + * @param [response] FlagsListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.FlagsListResponse) => void; + } + + /** Properties of a SqlFlagsListRequest. */ + interface ISqlFlagsListRequest { + + /** SqlFlagsListRequest databaseVersion */ + databaseVersion?: (string|null); + + /** SqlFlagsListRequest flagScope */ + flagScope?: (google.cloud.sql.v1.SqlFlagScope|keyof typeof google.cloud.sql.v1.SqlFlagScope|null); + } + + /** Represents a SqlFlagsListRequest. */ + class SqlFlagsListRequest implements ISqlFlagsListRequest { + + /** + * Constructs a new SqlFlagsListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlFlagsListRequest); + + /** SqlFlagsListRequest databaseVersion. */ + public databaseVersion: string; + + /** SqlFlagsListRequest flagScope. */ + public flagScope?: (google.cloud.sql.v1.SqlFlagScope|keyof typeof google.cloud.sql.v1.SqlFlagScope|null); + + /** + * Creates a new SqlFlagsListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlFlagsListRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlFlagsListRequest): google.cloud.sql.v1.SqlFlagsListRequest; + + /** + * Encodes the specified SqlFlagsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlFlagsListRequest.verify|verify} messages. + * @param message SqlFlagsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlFlagsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlFlagsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlFlagsListRequest.verify|verify} messages. + * @param message SqlFlagsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlFlagsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlFlagsListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlFlagsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlFlagsListRequest; + + /** + * Decodes a SqlFlagsListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlFlagsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlFlagsListRequest; + + /** + * Verifies a SqlFlagsListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlFlagsListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlFlagsListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlFlagsListRequest; + + /** + * Creates a plain object from a SqlFlagsListRequest message. Also converts values to other types if specified. + * @param message SqlFlagsListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlFlagsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlFlagsListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlFlagsListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FlagsListResponse. */ + interface IFlagsListResponse { + + /** FlagsListResponse kind */ + kind?: (string|null); + + /** FlagsListResponse items */ + items?: (google.cloud.sql.v1.IFlag[]|null); + } + + /** Represents a FlagsListResponse. */ + class FlagsListResponse implements IFlagsListResponse { + + /** + * Constructs a new FlagsListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IFlagsListResponse); + + /** FlagsListResponse kind. */ + public kind: string; + + /** FlagsListResponse items. */ + public items: google.cloud.sql.v1.IFlag[]; + + /** + * Creates a new FlagsListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns FlagsListResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IFlagsListResponse): google.cloud.sql.v1.FlagsListResponse; + + /** + * Encodes the specified FlagsListResponse message. Does not implicitly {@link google.cloud.sql.v1.FlagsListResponse.verify|verify} messages. + * @param message FlagsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IFlagsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FlagsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FlagsListResponse.verify|verify} messages. + * @param message FlagsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IFlagsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FlagsListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FlagsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.FlagsListResponse; + + /** + * Decodes a FlagsListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FlagsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.FlagsListResponse; + + /** + * Verifies a FlagsListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FlagsListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FlagsListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.FlagsListResponse; + + /** + * Creates a plain object from a FlagsListResponse message. Also converts values to other types if specified. + * @param message FlagsListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.FlagsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FlagsListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FlagsListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Flag. */ + interface IFlag { + + /** Flag name */ + name?: (string|null); + + /** Flag type */ + type?: (google.cloud.sql.v1.SqlFlagType|keyof typeof google.cloud.sql.v1.SqlFlagType|null); + + /** Flag appliesTo */ + appliesTo?: (google.cloud.sql.v1.SqlDatabaseVersion[]|null); + + /** Flag allowedStringValues */ + allowedStringValues?: (string[]|null); + + /** Flag minValue */ + minValue?: (google.protobuf.IInt64Value|null); + + /** Flag maxValue */ + maxValue?: (google.protobuf.IInt64Value|null); + + /** Flag requiresRestart */ + requiresRestart?: (google.protobuf.IBoolValue|null); + + /** Flag kind */ + kind?: (string|null); + + /** Flag inBeta */ + inBeta?: (google.protobuf.IBoolValue|null); + + /** Flag allowedIntValues */ + allowedIntValues?: ((number|Long|string)[]|null); + + /** Flag flagScope */ + flagScope?: (google.cloud.sql.v1.SqlFlagScope|keyof typeof google.cloud.sql.v1.SqlFlagScope|null); + + /** Flag recommendedStringValue */ + recommendedStringValue?: (string|null); + + /** Flag recommendedIntValue */ + recommendedIntValue?: (google.protobuf.IInt64Value|null); + } + + /** Represents a Flag. */ + class Flag implements IFlag { + + /** + * Constructs a new Flag. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IFlag); + + /** Flag name. */ + public name: string; + + /** Flag type. */ + public type: (google.cloud.sql.v1.SqlFlagType|keyof typeof google.cloud.sql.v1.SqlFlagType); + + /** Flag appliesTo. */ + public appliesTo: google.cloud.sql.v1.SqlDatabaseVersion[]; + + /** Flag allowedStringValues. */ + public allowedStringValues: string[]; + + /** Flag minValue. */ + public minValue?: (google.protobuf.IInt64Value|null); + + /** Flag maxValue. */ + public maxValue?: (google.protobuf.IInt64Value|null); + + /** Flag requiresRestart. */ + public requiresRestart?: (google.protobuf.IBoolValue|null); + + /** Flag kind. */ + public kind: string; + + /** Flag inBeta. */ + public inBeta?: (google.protobuf.IBoolValue|null); + + /** Flag allowedIntValues. */ + public allowedIntValues: (number|Long|string)[]; + + /** Flag flagScope. */ + public flagScope: (google.cloud.sql.v1.SqlFlagScope|keyof typeof google.cloud.sql.v1.SqlFlagScope); + + /** Flag recommendedStringValue. */ + public recommendedStringValue?: (string|null); + + /** Flag recommendedIntValue. */ + public recommendedIntValue?: (google.protobuf.IInt64Value|null); + + /** Flag recommendedValue. */ + public recommendedValue?: ("recommendedStringValue"|"recommendedIntValue"); + + /** + * Creates a new Flag instance using the specified properties. + * @param [properties] Properties to set + * @returns Flag instance + */ + public static create(properties?: google.cloud.sql.v1.IFlag): google.cloud.sql.v1.Flag; + + /** + * Encodes the specified Flag message. Does not implicitly {@link google.cloud.sql.v1.Flag.verify|verify} messages. + * @param message Flag message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IFlag, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Flag message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Flag.verify|verify} messages. + * @param message Flag message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IFlag, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Flag message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Flag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Flag; + + /** + * Decodes a Flag message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Flag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Flag; + + /** + * Verifies a Flag message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Flag message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Flag + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Flag; + + /** + * Creates a plain object from a Flag message. Also converts values to other types if specified. + * @param message Flag + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.Flag, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Flag to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Flag + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlFlagType enum. */ + enum SqlFlagType { + SQL_FLAG_TYPE_UNSPECIFIED = 0, + BOOLEAN = 1, + STRING = 2, + INTEGER = 3, + NONE = 4, + MYSQL_TIMEZONE_OFFSET = 5, + FLOAT = 6, + REPEATED_STRING = 7 + } + + /** SqlFlagScope enum. */ + enum SqlFlagScope { + SQL_FLAG_SCOPE_UNSPECIFIED = 0, + SQL_FLAG_SCOPE_DATABASE = 1, + SQL_FLAG_SCOPE_CONNECTION_POOL = 2 + } + + /** Represents a SqlIamPoliciesService */ + class SqlIamPoliciesService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlIamPoliciesService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlIamPoliciesService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlIamPoliciesService; + } + + /** Represents a SqlInstanceNamesService */ + class SqlInstanceNamesService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlInstanceNamesService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlInstanceNamesService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlInstanceNamesService; + } + + /** Represents a SqlOperationsService */ + class SqlOperationsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlOperationsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlOperationsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlOperationsService; + + /** + * Calls Get. + * @param request SqlOperationsGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public get(request: google.cloud.sql.v1.ISqlOperationsGetRequest, callback: google.cloud.sql.v1.SqlOperationsService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlOperationsGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1.ISqlOperationsGetRequest): Promise; + + /** + * Calls List. + * @param request SqlOperationsListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and OperationsListResponse + */ + public list(request: google.cloud.sql.v1.ISqlOperationsListRequest, callback: google.cloud.sql.v1.SqlOperationsService.ListCallback): void; + + /** + * Calls List. + * @param request SqlOperationsListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1.ISqlOperationsListRequest): Promise; + + /** + * Calls Cancel. + * @param request SqlOperationsCancelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public cancel(request: google.cloud.sql.v1.ISqlOperationsCancelRequest, callback: google.cloud.sql.v1.SqlOperationsService.CancelCallback): void; + + /** + * Calls Cancel. + * @param request SqlOperationsCancelRequest message or plain object + * @returns Promise + */ + public cancel(request: google.cloud.sql.v1.ISqlOperationsCancelRequest): Promise; + } + + namespace SqlOperationsService { + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|get}. + * @param error Error, if any + * @param [response] Operation + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|list}. + * @param error Error, if any + * @param [response] OperationsListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.OperationsListResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|cancel}. + * @param error Error, if any + * @param [response] Empty + */ + type CancelCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Properties of a SqlOperationsGetRequest. */ + interface ISqlOperationsGetRequest { + + /** SqlOperationsGetRequest operation */ + operation?: (string|null); + + /** SqlOperationsGetRequest project */ + project?: (string|null); + } + + /** Represents a SqlOperationsGetRequest. */ + class SqlOperationsGetRequest implements ISqlOperationsGetRequest { + + /** + * Constructs a new SqlOperationsGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlOperationsGetRequest); + + /** SqlOperationsGetRequest operation. */ + public operation: string; + + /** SqlOperationsGetRequest project. */ + public project: string; + + /** + * Creates a new SqlOperationsGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlOperationsGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlOperationsGetRequest): google.cloud.sql.v1.SqlOperationsGetRequest; + + /** + * Encodes the specified SqlOperationsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsGetRequest.verify|verify} messages. + * @param message SqlOperationsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlOperationsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlOperationsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsGetRequest.verify|verify} messages. + * @param message SqlOperationsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlOperationsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlOperationsGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlOperationsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlOperationsGetRequest; + + /** + * Decodes a SqlOperationsGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlOperationsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlOperationsGetRequest; + + /** + * Verifies a SqlOperationsGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlOperationsGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlOperationsGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlOperationsGetRequest; + + /** + * Creates a plain object from a SqlOperationsGetRequest message. Also converts values to other types if specified. + * @param message SqlOperationsGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlOperationsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlOperationsGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlOperationsGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlOperationsListRequest. */ + interface ISqlOperationsListRequest { + + /** SqlOperationsListRequest instance */ + instance?: (string|null); + + /** SqlOperationsListRequest maxResults */ + maxResults?: (number|null); + + /** SqlOperationsListRequest pageToken */ + pageToken?: (string|null); + + /** SqlOperationsListRequest project */ + project?: (string|null); + } + + /** Represents a SqlOperationsListRequest. */ + class SqlOperationsListRequest implements ISqlOperationsListRequest { + + /** + * Constructs a new SqlOperationsListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlOperationsListRequest); + + /** SqlOperationsListRequest instance. */ + public instance: string; + + /** SqlOperationsListRequest maxResults. */ + public maxResults: number; + + /** SqlOperationsListRequest pageToken. */ + public pageToken: string; + + /** SqlOperationsListRequest project. */ + public project: string; + + /** + * Creates a new SqlOperationsListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlOperationsListRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlOperationsListRequest): google.cloud.sql.v1.SqlOperationsListRequest; + + /** + * Encodes the specified SqlOperationsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsListRequest.verify|verify} messages. + * @param message SqlOperationsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlOperationsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlOperationsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsListRequest.verify|verify} messages. + * @param message SqlOperationsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlOperationsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlOperationsListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlOperationsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlOperationsListRequest; + + /** + * Decodes a SqlOperationsListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlOperationsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlOperationsListRequest; + + /** + * Verifies a SqlOperationsListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlOperationsListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlOperationsListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlOperationsListRequest; + + /** + * Creates a plain object from a SqlOperationsListRequest message. Also converts values to other types if specified. + * @param message SqlOperationsListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlOperationsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlOperationsListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlOperationsListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OperationsListResponse. */ + interface IOperationsListResponse { + + /** OperationsListResponse kind */ + kind?: (string|null); + + /** OperationsListResponse items */ + items?: (google.cloud.sql.v1.IOperation[]|null); + + /** OperationsListResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents an OperationsListResponse. */ + class OperationsListResponse implements IOperationsListResponse { + + /** + * Constructs a new OperationsListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IOperationsListResponse); + + /** OperationsListResponse kind. */ + public kind: string; + + /** OperationsListResponse items. */ + public items: google.cloud.sql.v1.IOperation[]; + + /** OperationsListResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new OperationsListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationsListResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IOperationsListResponse): google.cloud.sql.v1.OperationsListResponse; + + /** + * Encodes the specified OperationsListResponse message. Does not implicitly {@link google.cloud.sql.v1.OperationsListResponse.verify|verify} messages. + * @param message OperationsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IOperationsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationsListResponse.verify|verify} messages. + * @param message OperationsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IOperationsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationsListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.OperationsListResponse; + + /** + * Decodes an OperationsListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.OperationsListResponse; + + /** + * Verifies an OperationsListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationsListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationsListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.OperationsListResponse; + + /** + * Creates a plain object from an OperationsListResponse message. Also converts values to other types if specified. + * @param message OperationsListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.OperationsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationsListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationsListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlOperationsCancelRequest. */ + interface ISqlOperationsCancelRequest { + + /** SqlOperationsCancelRequest operation */ + operation?: (string|null); + + /** SqlOperationsCancelRequest project */ + project?: (string|null); + } + + /** Represents a SqlOperationsCancelRequest. */ + class SqlOperationsCancelRequest implements ISqlOperationsCancelRequest { + + /** + * Constructs a new SqlOperationsCancelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlOperationsCancelRequest); + + /** SqlOperationsCancelRequest operation. */ + public operation: string; + + /** SqlOperationsCancelRequest project. */ + public project: string; + + /** + * Creates a new SqlOperationsCancelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlOperationsCancelRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlOperationsCancelRequest): google.cloud.sql.v1.SqlOperationsCancelRequest; + + /** + * Encodes the specified SqlOperationsCancelRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsCancelRequest.verify|verify} messages. + * @param message SqlOperationsCancelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlOperationsCancelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlOperationsCancelRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsCancelRequest.verify|verify} messages. + * @param message SqlOperationsCancelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlOperationsCancelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlOperationsCancelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlOperationsCancelRequest; + + /** + * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlOperationsCancelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlOperationsCancelRequest; + + /** + * Verifies a SqlOperationsCancelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlOperationsCancelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlOperationsCancelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlOperationsCancelRequest; + + /** + * Creates a plain object from a SqlOperationsCancelRequest message. Also converts values to other types if specified. + * @param message SqlOperationsCancelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlOperationsCancelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlOperationsCancelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlOperationsCancelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a SqlRegionsService */ + class SqlRegionsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlRegionsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlRegionsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlRegionsService; + } + + /** Represents a SqlSslCertsService */ + class SqlSslCertsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlSslCertsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlSslCertsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlSslCertsService; + + /** + * Calls Delete. + * @param request SqlSslCertsDeleteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public delete(request: google.cloud.sql.v1.ISqlSslCertsDeleteRequest, callback: google.cloud.sql.v1.SqlSslCertsService.DeleteCallback): void; + + /** + * Calls Delete. + * @param request SqlSslCertsDeleteRequest message or plain object + * @returns Promise + */ + public delete(request: google.cloud.sql.v1.ISqlSslCertsDeleteRequest): Promise; + + /** + * Calls Get. + * @param request SqlSslCertsGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SslCert + */ + public get(request: google.cloud.sql.v1.ISqlSslCertsGetRequest, callback: google.cloud.sql.v1.SqlSslCertsService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlSslCertsGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1.ISqlSslCertsGetRequest): Promise; + + /** + * Calls Insert. + * @param request SqlSslCertsInsertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SslCertsInsertResponse + */ + public insert(request: google.cloud.sql.v1.ISqlSslCertsInsertRequest, callback: google.cloud.sql.v1.SqlSslCertsService.InsertCallback): void; + + /** + * Calls Insert. + * @param request SqlSslCertsInsertRequest message or plain object + * @returns Promise + */ + public insert(request: google.cloud.sql.v1.ISqlSslCertsInsertRequest): Promise; + + /** + * Calls List. + * @param request SqlSslCertsListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SslCertsListResponse + */ + public list(request: google.cloud.sql.v1.ISqlSslCertsListRequest, callback: google.cloud.sql.v1.SqlSslCertsService.ListCallback): void; + + /** + * Calls List. + * @param request SqlSslCertsListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1.ISqlSslCertsListRequest): Promise; + } + + namespace SqlSslCertsService { + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|delete_}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|get}. + * @param error Error, if any + * @param [response] SslCert + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.SslCert) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|insert}. + * @param error Error, if any + * @param [response] SslCertsInsertResponse + */ + type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1.SslCertsInsertResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|list}. + * @param error Error, if any + * @param [response] SslCertsListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.SslCertsListResponse) => void; + } + + /** Properties of a SqlSslCertsDeleteRequest. */ + interface ISqlSslCertsDeleteRequest { + + /** SqlSslCertsDeleteRequest instance */ + instance?: (string|null); + + /** SqlSslCertsDeleteRequest project */ + project?: (string|null); + + /** SqlSslCertsDeleteRequest sha1Fingerprint */ + sha1Fingerprint?: (string|null); + } + + /** Represents a SqlSslCertsDeleteRequest. */ + class SqlSslCertsDeleteRequest implements ISqlSslCertsDeleteRequest { + + /** + * Constructs a new SqlSslCertsDeleteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlSslCertsDeleteRequest); + + /** SqlSslCertsDeleteRequest instance. */ + public instance: string; + + /** SqlSslCertsDeleteRequest project. */ + public project: string; + + /** SqlSslCertsDeleteRequest sha1Fingerprint. */ + public sha1Fingerprint: string; + + /** + * Creates a new SqlSslCertsDeleteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlSslCertsDeleteRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlSslCertsDeleteRequest): google.cloud.sql.v1.SqlSslCertsDeleteRequest; + + /** + * Encodes the specified SqlSslCertsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsDeleteRequest.verify|verify} messages. + * @param message SqlSslCertsDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlSslCertsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlSslCertsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsDeleteRequest.verify|verify} messages. + * @param message SqlSslCertsDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlSslCertsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlSslCertsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlSslCertsDeleteRequest; + + /** + * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlSslCertsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlSslCertsDeleteRequest; + + /** + * Verifies a SqlSslCertsDeleteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlSslCertsDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlSslCertsDeleteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlSslCertsDeleteRequest; + + /** + * Creates a plain object from a SqlSslCertsDeleteRequest message. Also converts values to other types if specified. + * @param message SqlSslCertsDeleteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlSslCertsDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlSslCertsDeleteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlSslCertsDeleteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlSslCertsGetRequest. */ + interface ISqlSslCertsGetRequest { + + /** SqlSslCertsGetRequest instance */ + instance?: (string|null); + + /** SqlSslCertsGetRequest project */ + project?: (string|null); + + /** SqlSslCertsGetRequest sha1Fingerprint */ + sha1Fingerprint?: (string|null); + } + + /** Represents a SqlSslCertsGetRequest. */ + class SqlSslCertsGetRequest implements ISqlSslCertsGetRequest { + + /** + * Constructs a new SqlSslCertsGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlSslCertsGetRequest); + + /** SqlSslCertsGetRequest instance. */ + public instance: string; + + /** SqlSslCertsGetRequest project. */ + public project: string; + + /** SqlSslCertsGetRequest sha1Fingerprint. */ + public sha1Fingerprint: string; + + /** + * Creates a new SqlSslCertsGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlSslCertsGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlSslCertsGetRequest): google.cloud.sql.v1.SqlSslCertsGetRequest; + + /** + * Encodes the specified SqlSslCertsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsGetRequest.verify|verify} messages. + * @param message SqlSslCertsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlSslCertsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlSslCertsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsGetRequest.verify|verify} messages. + * @param message SqlSslCertsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlSslCertsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlSslCertsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlSslCertsGetRequest; + + /** + * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlSslCertsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlSslCertsGetRequest; + + /** + * Verifies a SqlSslCertsGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlSslCertsGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlSslCertsGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlSslCertsGetRequest; + + /** + * Creates a plain object from a SqlSslCertsGetRequest message. Also converts values to other types if specified. + * @param message SqlSslCertsGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlSslCertsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlSslCertsGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlSslCertsGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlSslCertsInsertRequest. */ + interface ISqlSslCertsInsertRequest { + + /** SqlSslCertsInsertRequest instance */ + instance?: (string|null); + + /** SqlSslCertsInsertRequest project */ + project?: (string|null); + + /** SqlSslCertsInsertRequest body */ + body?: (google.cloud.sql.v1.ISslCertsInsertRequest|null); + } + + /** Represents a SqlSslCertsInsertRequest. */ + class SqlSslCertsInsertRequest implements ISqlSslCertsInsertRequest { + + /** + * Constructs a new SqlSslCertsInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlSslCertsInsertRequest); + + /** SqlSslCertsInsertRequest instance. */ + public instance: string; + + /** SqlSslCertsInsertRequest project. */ + public project: string; + + /** SqlSslCertsInsertRequest body. */ + public body?: (google.cloud.sql.v1.ISslCertsInsertRequest|null); + + /** + * Creates a new SqlSslCertsInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlSslCertsInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlSslCertsInsertRequest): google.cloud.sql.v1.SqlSslCertsInsertRequest; + + /** + * Encodes the specified SqlSslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsInsertRequest.verify|verify} messages. + * @param message SqlSslCertsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlSslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlSslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsInsertRequest.verify|verify} messages. + * @param message SqlSslCertsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlSslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlSslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlSslCertsInsertRequest; + + /** + * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlSslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlSslCertsInsertRequest; + + /** + * Verifies a SqlSslCertsInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlSslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlSslCertsInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlSslCertsInsertRequest; + + /** + * Creates a plain object from a SqlSslCertsInsertRequest message. Also converts values to other types if specified. + * @param message SqlSslCertsInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlSslCertsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlSslCertsInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlSslCertsInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlSslCertsListRequest. */ + interface ISqlSslCertsListRequest { + + /** SqlSslCertsListRequest instance */ + instance?: (string|null); + + /** SqlSslCertsListRequest project */ + project?: (string|null); + } + + /** Represents a SqlSslCertsListRequest. */ + class SqlSslCertsListRequest implements ISqlSslCertsListRequest { + + /** + * Constructs a new SqlSslCertsListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlSslCertsListRequest); + + /** SqlSslCertsListRequest instance. */ + public instance: string; + + /** SqlSslCertsListRequest project. */ + public project: string; + + /** + * Creates a new SqlSslCertsListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlSslCertsListRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlSslCertsListRequest): google.cloud.sql.v1.SqlSslCertsListRequest; + + /** + * Encodes the specified SqlSslCertsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsListRequest.verify|verify} messages. + * @param message SqlSslCertsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlSslCertsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlSslCertsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsListRequest.verify|verify} messages. + * @param message SqlSslCertsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlSslCertsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlSslCertsListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlSslCertsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlSslCertsListRequest; + + /** + * Decodes a SqlSslCertsListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlSslCertsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlSslCertsListRequest; + + /** + * Verifies a SqlSslCertsListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlSslCertsListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlSslCertsListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlSslCertsListRequest; + + /** + * Creates a plain object from a SqlSslCertsListRequest message. Also converts values to other types if specified. + * @param message SqlSslCertsListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlSslCertsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlSslCertsListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlSslCertsListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCertsInsertRequest. */ + interface ISslCertsInsertRequest { + + /** SslCertsInsertRequest commonName */ + commonName?: (string|null); + } + + /** Represents a SslCertsInsertRequest. */ + class SslCertsInsertRequest implements ISslCertsInsertRequest { + + /** + * Constructs a new SslCertsInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISslCertsInsertRequest); + + /** SslCertsInsertRequest commonName. */ + public commonName: string; + + /** + * Creates a new SslCertsInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCertsInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISslCertsInsertRequest): google.cloud.sql.v1.SslCertsInsertRequest; + + /** + * Encodes the specified SslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertRequest.verify|verify} messages. + * @param message SslCertsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertRequest.verify|verify} messages. + * @param message SslCertsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCertsInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCertsInsertRequest; + + /** + * Decodes a SslCertsInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCertsInsertRequest; + + /** + * Verifies a SslCertsInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCertsInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCertsInsertRequest; + + /** + * Creates a plain object from a SslCertsInsertRequest message. Also converts values to other types if specified. + * @param message SslCertsInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SslCertsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCertsInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCertsInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCertsInsertResponse. */ + interface ISslCertsInsertResponse { + + /** SslCertsInsertResponse kind */ + kind?: (string|null); + + /** SslCertsInsertResponse operation */ + operation?: (google.cloud.sql.v1.IOperation|null); + + /** SslCertsInsertResponse serverCaCert */ + serverCaCert?: (google.cloud.sql.v1.ISslCert|null); + + /** SslCertsInsertResponse clientCert */ + clientCert?: (google.cloud.sql.v1.ISslCertDetail|null); + } + + /** Represents a SslCertsInsertResponse. */ + class SslCertsInsertResponse implements ISslCertsInsertResponse { + + /** + * Constructs a new SslCertsInsertResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISslCertsInsertResponse); + + /** SslCertsInsertResponse kind. */ + public kind: string; + + /** SslCertsInsertResponse operation. */ + public operation?: (google.cloud.sql.v1.IOperation|null); + + /** SslCertsInsertResponse serverCaCert. */ + public serverCaCert?: (google.cloud.sql.v1.ISslCert|null); + + /** SslCertsInsertResponse clientCert. */ + public clientCert?: (google.cloud.sql.v1.ISslCertDetail|null); + + /** + * Creates a new SslCertsInsertResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCertsInsertResponse instance + */ + public static create(properties?: google.cloud.sql.v1.ISslCertsInsertResponse): google.cloud.sql.v1.SslCertsInsertResponse; + + /** + * Encodes the specified SslCertsInsertResponse message. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertResponse.verify|verify} messages. + * @param message SslCertsInsertResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISslCertsInsertResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCertsInsertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertResponse.verify|verify} messages. + * @param message SslCertsInsertResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISslCertsInsertResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCertsInsertResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCertsInsertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCertsInsertResponse; + + /** + * Decodes a SslCertsInsertResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCertsInsertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCertsInsertResponse; + + /** + * Verifies a SslCertsInsertResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCertsInsertResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCertsInsertResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCertsInsertResponse; + + /** + * Creates a plain object from a SslCertsInsertResponse message. Also converts values to other types if specified. + * @param message SslCertsInsertResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SslCertsInsertResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCertsInsertResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCertsInsertResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCertsListResponse. */ + interface ISslCertsListResponse { + + /** SslCertsListResponse kind */ + kind?: (string|null); + + /** SslCertsListResponse items */ + items?: (google.cloud.sql.v1.ISslCert[]|null); + } + + /** Represents a SslCertsListResponse. */ + class SslCertsListResponse implements ISslCertsListResponse { + + /** + * Constructs a new SslCertsListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISslCertsListResponse); + + /** SslCertsListResponse kind. */ + public kind: string; + + /** SslCertsListResponse items. */ + public items: google.cloud.sql.v1.ISslCert[]; + + /** + * Creates a new SslCertsListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCertsListResponse instance + */ + public static create(properties?: google.cloud.sql.v1.ISslCertsListResponse): google.cloud.sql.v1.SslCertsListResponse; + + /** + * Encodes the specified SslCertsListResponse message. Does not implicitly {@link google.cloud.sql.v1.SslCertsListResponse.verify|verify} messages. + * @param message SslCertsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISslCertsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCertsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsListResponse.verify|verify} messages. + * @param message SslCertsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISslCertsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCertsListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCertsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCertsListResponse; + + /** + * Decodes a SslCertsListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCertsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCertsListResponse; + + /** + * Verifies a SslCertsListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCertsListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCertsListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCertsListResponse; + + /** + * Creates a plain object from a SslCertsListResponse message. Also converts values to other types if specified. + * @param message SslCertsListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SslCertsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCertsListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCertsListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a SqlTiersService */ + class SqlTiersService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlTiersService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlTiersService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlTiersService; + + /** + * Calls List. + * @param request SqlTiersListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TiersListResponse + */ + public list(request: google.cloud.sql.v1.ISqlTiersListRequest, callback: google.cloud.sql.v1.SqlTiersService.ListCallback): void; + + /** + * Calls List. + * @param request SqlTiersListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1.ISqlTiersListRequest): Promise; + } + + namespace SqlTiersService { + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlTiersService|list}. + * @param error Error, if any + * @param [response] TiersListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.TiersListResponse) => void; + } + + /** Properties of a SqlTiersListRequest. */ + interface ISqlTiersListRequest { + + /** SqlTiersListRequest project */ + project?: (string|null); + } + + /** Represents a SqlTiersListRequest. */ + class SqlTiersListRequest implements ISqlTiersListRequest { + + /** + * Constructs a new SqlTiersListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlTiersListRequest); + + /** SqlTiersListRequest project. */ + public project: string; + + /** + * Creates a new SqlTiersListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlTiersListRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlTiersListRequest): google.cloud.sql.v1.SqlTiersListRequest; + + /** + * Encodes the specified SqlTiersListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlTiersListRequest.verify|verify} messages. + * @param message SqlTiersListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlTiersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlTiersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlTiersListRequest.verify|verify} messages. + * @param message SqlTiersListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlTiersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlTiersListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlTiersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlTiersListRequest; + + /** + * Decodes a SqlTiersListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlTiersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlTiersListRequest; + + /** + * Verifies a SqlTiersListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlTiersListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlTiersListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlTiersListRequest; + + /** + * Creates a plain object from a SqlTiersListRequest message. Also converts values to other types if specified. + * @param message SqlTiersListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlTiersListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlTiersListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlTiersListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TiersListResponse. */ + interface ITiersListResponse { + + /** TiersListResponse kind */ + kind?: (string|null); + + /** TiersListResponse items */ + items?: (google.cloud.sql.v1.ITier[]|null); + } + + /** Represents a TiersListResponse. */ + class TiersListResponse implements ITiersListResponse { + + /** + * Constructs a new TiersListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ITiersListResponse); + + /** TiersListResponse kind. */ + public kind: string; + + /** TiersListResponse items. */ + public items: google.cloud.sql.v1.ITier[]; + + /** + * Creates a new TiersListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns TiersListResponse instance + */ + public static create(properties?: google.cloud.sql.v1.ITiersListResponse): google.cloud.sql.v1.TiersListResponse; + + /** + * Encodes the specified TiersListResponse message. Does not implicitly {@link google.cloud.sql.v1.TiersListResponse.verify|verify} messages. + * @param message TiersListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ITiersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TiersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.TiersListResponse.verify|verify} messages. + * @param message TiersListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ITiersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TiersListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TiersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.TiersListResponse; + + /** + * Decodes a TiersListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TiersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.TiersListResponse; + + /** + * Verifies a TiersListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TiersListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TiersListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.TiersListResponse; + + /** + * Creates a plain object from a TiersListResponse message. Also converts values to other types if specified. + * @param message TiersListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.TiersListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TiersListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TiersListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Tier. */ + interface ITier { + + /** Tier tier */ + tier?: (string|null); + + /** Tier RAM */ + RAM?: (number|Long|string|null); + + /** Tier kind */ + kind?: (string|null); + + /** Tier Disk_Quota */ + Disk_Quota?: (number|Long|string|null); + + /** Tier region */ + region?: (string[]|null); + } + + /** Represents a Tier. */ + class Tier implements ITier { + + /** + * Constructs a new Tier. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ITier); + + /** Tier tier. */ + public tier: string; + + /** Tier RAM. */ + public RAM: (number|Long|string); + + /** Tier kind. */ + public kind: string; + + /** Tier Disk_Quota. */ + public Disk_Quota: (number|Long|string); + + /** Tier region. */ + public region: string[]; + + /** + * Creates a new Tier instance using the specified properties. + * @param [properties] Properties to set + * @returns Tier instance + */ + public static create(properties?: google.cloud.sql.v1.ITier): google.cloud.sql.v1.Tier; + + /** + * Encodes the specified Tier message. Does not implicitly {@link google.cloud.sql.v1.Tier.verify|verify} messages. + * @param message Tier message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ITier, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Tier message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Tier.verify|verify} messages. + * @param message Tier message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ITier, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Tier message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Tier + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Tier; + + /** + * Decodes a Tier message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Tier + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Tier; + + /** + * Verifies a Tier message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Tier message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Tier + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Tier; + + /** + * Creates a plain object from a Tier message. Also converts values to other types if specified. + * @param message Tier + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.Tier, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Tier to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Tier + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a SqlUsersService */ + class SqlUsersService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlUsersService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlUsersService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlUsersService; + + /** + * Calls Delete. + * @param request SqlUsersDeleteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public delete(request: google.cloud.sql.v1.ISqlUsersDeleteRequest, callback: google.cloud.sql.v1.SqlUsersService.DeleteCallback): void; + + /** + * Calls Delete. + * @param request SqlUsersDeleteRequest message or plain object + * @returns Promise + */ + public delete(request: google.cloud.sql.v1.ISqlUsersDeleteRequest): Promise; + + /** + * Calls Get. + * @param request SqlUsersGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and User + */ + public get(request: google.cloud.sql.v1.ISqlUsersGetRequest, callback: google.cloud.sql.v1.SqlUsersService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlUsersGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1.ISqlUsersGetRequest): Promise; + + /** + * Calls Insert. + * @param request SqlUsersInsertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public insert(request: google.cloud.sql.v1.ISqlUsersInsertRequest, callback: google.cloud.sql.v1.SqlUsersService.InsertCallback): void; + + /** + * Calls Insert. + * @param request SqlUsersInsertRequest message or plain object + * @returns Promise + */ + public insert(request: google.cloud.sql.v1.ISqlUsersInsertRequest): Promise; + + /** + * Calls List. + * @param request SqlUsersListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UsersListResponse + */ + public list(request: google.cloud.sql.v1.ISqlUsersListRequest, callback: google.cloud.sql.v1.SqlUsersService.ListCallback): void; + + /** + * Calls List. + * @param request SqlUsersListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1.ISqlUsersListRequest): Promise; + + /** + * Calls Update. + * @param request SqlUsersUpdateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public update(request: google.cloud.sql.v1.ISqlUsersUpdateRequest, callback: google.cloud.sql.v1.SqlUsersService.UpdateCallback): void; + + /** + * Calls Update. + * @param request SqlUsersUpdateRequest message or plain object + * @returns Promise + */ + public update(request: google.cloud.sql.v1.ISqlUsersUpdateRequest): Promise; + } + + namespace SqlUsersService { + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|delete_}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|get}. + * @param error Error, if any + * @param [response] User + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.User) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|insert}. + * @param error Error, if any + * @param [response] Operation + */ + type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|list}. + * @param error Error, if any + * @param [response] UsersListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.UsersListResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|update}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; + } + + /** Properties of a SqlUsersDeleteRequest. */ + interface ISqlUsersDeleteRequest { + + /** SqlUsersDeleteRequest host */ + host?: (string|null); + + /** SqlUsersDeleteRequest instance */ + instance?: (string|null); + + /** SqlUsersDeleteRequest name */ + name?: (string|null); + + /** SqlUsersDeleteRequest project */ + project?: (string|null); + } + + /** Represents a SqlUsersDeleteRequest. */ + class SqlUsersDeleteRequest implements ISqlUsersDeleteRequest { + + /** + * Constructs a new SqlUsersDeleteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlUsersDeleteRequest); + + /** SqlUsersDeleteRequest host. */ + public host: string; + + /** SqlUsersDeleteRequest instance. */ + public instance: string; + + /** SqlUsersDeleteRequest name. */ + public name: string; + + /** SqlUsersDeleteRequest project. */ + public project: string; + + /** + * Creates a new SqlUsersDeleteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlUsersDeleteRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlUsersDeleteRequest): google.cloud.sql.v1.SqlUsersDeleteRequest; + + /** + * Encodes the specified SqlUsersDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersDeleteRequest.verify|verify} messages. + * @param message SqlUsersDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlUsersDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlUsersDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersDeleteRequest.verify|verify} messages. + * @param message SqlUsersDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlUsersDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlUsersDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlUsersDeleteRequest; + + /** + * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlUsersDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlUsersDeleteRequest; + + /** + * Verifies a SqlUsersDeleteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlUsersDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlUsersDeleteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlUsersDeleteRequest; + + /** + * Creates a plain object from a SqlUsersDeleteRequest message. Also converts values to other types if specified. + * @param message SqlUsersDeleteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlUsersDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlUsersDeleteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlUsersDeleteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlUsersGetRequest. */ + interface ISqlUsersGetRequest { + + /** SqlUsersGetRequest instance */ + instance?: (string|null); + + /** SqlUsersGetRequest name */ + name?: (string|null); + + /** SqlUsersGetRequest project */ + project?: (string|null); + + /** SqlUsersGetRequest host */ + host?: (string|null); + } + + /** Represents a SqlUsersGetRequest. */ + class SqlUsersGetRequest implements ISqlUsersGetRequest { + + /** + * Constructs a new SqlUsersGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlUsersGetRequest); + + /** SqlUsersGetRequest instance. */ + public instance: string; + + /** SqlUsersGetRequest name. */ + public name: string; + + /** SqlUsersGetRequest project. */ + public project: string; + + /** SqlUsersGetRequest host. */ + public host: string; + + /** + * Creates a new SqlUsersGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlUsersGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlUsersGetRequest): google.cloud.sql.v1.SqlUsersGetRequest; + + /** + * Encodes the specified SqlUsersGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersGetRequest.verify|verify} messages. + * @param message SqlUsersGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlUsersGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlUsersGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersGetRequest.verify|verify} messages. + * @param message SqlUsersGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlUsersGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlUsersGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlUsersGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlUsersGetRequest; + + /** + * Decodes a SqlUsersGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlUsersGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlUsersGetRequest; + + /** + * Verifies a SqlUsersGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlUsersGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlUsersGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlUsersGetRequest; + + /** + * Creates a plain object from a SqlUsersGetRequest message. Also converts values to other types if specified. + * @param message SqlUsersGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlUsersGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlUsersGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlUsersGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlUsersInsertRequest. */ + interface ISqlUsersInsertRequest { + + /** SqlUsersInsertRequest instance */ + instance?: (string|null); + + /** SqlUsersInsertRequest project */ + project?: (string|null); + + /** SqlUsersInsertRequest body */ + body?: (google.cloud.sql.v1.IUser|null); + } + + /** Represents a SqlUsersInsertRequest. */ + class SqlUsersInsertRequest implements ISqlUsersInsertRequest { + + /** + * Constructs a new SqlUsersInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlUsersInsertRequest); + + /** SqlUsersInsertRequest instance. */ + public instance: string; + + /** SqlUsersInsertRequest project. */ + public project: string; + + /** SqlUsersInsertRequest body. */ + public body?: (google.cloud.sql.v1.IUser|null); + + /** + * Creates a new SqlUsersInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlUsersInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlUsersInsertRequest): google.cloud.sql.v1.SqlUsersInsertRequest; + + /** + * Encodes the specified SqlUsersInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersInsertRequest.verify|verify} messages. + * @param message SqlUsersInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlUsersInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlUsersInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersInsertRequest.verify|verify} messages. + * @param message SqlUsersInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlUsersInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlUsersInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlUsersInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlUsersInsertRequest; + + /** + * Decodes a SqlUsersInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlUsersInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlUsersInsertRequest; + + /** + * Verifies a SqlUsersInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlUsersInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlUsersInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlUsersInsertRequest; + + /** + * Creates a plain object from a SqlUsersInsertRequest message. Also converts values to other types if specified. + * @param message SqlUsersInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlUsersInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlUsersInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlUsersInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlUsersListRequest. */ + interface ISqlUsersListRequest { + + /** SqlUsersListRequest instance */ + instance?: (string|null); + + /** SqlUsersListRequest project */ + project?: (string|null); + } + + /** Represents a SqlUsersListRequest. */ + class SqlUsersListRequest implements ISqlUsersListRequest { + + /** + * Constructs a new SqlUsersListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlUsersListRequest); + + /** SqlUsersListRequest instance. */ + public instance: string; + + /** SqlUsersListRequest project. */ + public project: string; + + /** + * Creates a new SqlUsersListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlUsersListRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlUsersListRequest): google.cloud.sql.v1.SqlUsersListRequest; + + /** + * Encodes the specified SqlUsersListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersListRequest.verify|verify} messages. + * @param message SqlUsersListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlUsersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlUsersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersListRequest.verify|verify} messages. + * @param message SqlUsersListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlUsersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlUsersListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlUsersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlUsersListRequest; + + /** + * Decodes a SqlUsersListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlUsersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlUsersListRequest; + + /** + * Verifies a SqlUsersListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlUsersListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlUsersListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlUsersListRequest; + + /** + * Creates a plain object from a SqlUsersListRequest message. Also converts values to other types if specified. + * @param message SqlUsersListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlUsersListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlUsersListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlUsersListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlUsersUpdateRequest. */ + interface ISqlUsersUpdateRequest { + + /** SqlUsersUpdateRequest host */ + host?: (string|null); + + /** SqlUsersUpdateRequest instance */ + instance?: (string|null); + + /** SqlUsersUpdateRequest name */ + name?: (string|null); + + /** SqlUsersUpdateRequest project */ + project?: (string|null); + + /** SqlUsersUpdateRequest databaseRoles */ + databaseRoles?: (string[]|null); + + /** SqlUsersUpdateRequest revokeExistingRoles */ + revokeExistingRoles?: (boolean|null); + + /** SqlUsersUpdateRequest body */ + body?: (google.cloud.sql.v1.IUser|null); + } + + /** Represents a SqlUsersUpdateRequest. */ + class SqlUsersUpdateRequest implements ISqlUsersUpdateRequest { + + /** + * Constructs a new SqlUsersUpdateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlUsersUpdateRequest); + + /** SqlUsersUpdateRequest host. */ + public host: string; + + /** SqlUsersUpdateRequest instance. */ + public instance: string; + + /** SqlUsersUpdateRequest name. */ + public name: string; + + /** SqlUsersUpdateRequest project. */ + public project: string; + + /** SqlUsersUpdateRequest databaseRoles. */ + public databaseRoles: string[]; + + /** SqlUsersUpdateRequest revokeExistingRoles. */ + public revokeExistingRoles?: (boolean|null); + + /** SqlUsersUpdateRequest body. */ + public body?: (google.cloud.sql.v1.IUser|null); + + /** + * Creates a new SqlUsersUpdateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlUsersUpdateRequest instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlUsersUpdateRequest): google.cloud.sql.v1.SqlUsersUpdateRequest; + + /** + * Encodes the specified SqlUsersUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersUpdateRequest.verify|verify} messages. + * @param message SqlUsersUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlUsersUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlUsersUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersUpdateRequest.verify|verify} messages. + * @param message SqlUsersUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlUsersUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlUsersUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlUsersUpdateRequest; + + /** + * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlUsersUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlUsersUpdateRequest; + + /** + * Verifies a SqlUsersUpdateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlUsersUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlUsersUpdateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlUsersUpdateRequest; + + /** + * Creates a plain object from a SqlUsersUpdateRequest message. Also converts values to other types if specified. + * @param message SqlUsersUpdateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlUsersUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlUsersUpdateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlUsersUpdateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UserPasswordValidationPolicy. */ + interface IUserPasswordValidationPolicy { + + /** UserPasswordValidationPolicy allowedFailedAttempts */ + allowedFailedAttempts?: (number|null); + + /** UserPasswordValidationPolicy passwordExpirationDuration */ + passwordExpirationDuration?: (google.protobuf.IDuration|null); + + /** UserPasswordValidationPolicy enableFailedAttemptsCheck */ + enableFailedAttemptsCheck?: (boolean|null); + + /** UserPasswordValidationPolicy status */ + status?: (google.cloud.sql.v1.IPasswordStatus|null); + + /** UserPasswordValidationPolicy enablePasswordVerification */ + enablePasswordVerification?: (boolean|null); + } + + /** Represents a UserPasswordValidationPolicy. */ + class UserPasswordValidationPolicy implements IUserPasswordValidationPolicy { + + /** + * Constructs a new UserPasswordValidationPolicy. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IUserPasswordValidationPolicy); + + /** UserPasswordValidationPolicy allowedFailedAttempts. */ + public allowedFailedAttempts: number; + + /** UserPasswordValidationPolicy passwordExpirationDuration. */ + public passwordExpirationDuration?: (google.protobuf.IDuration|null); + + /** UserPasswordValidationPolicy enableFailedAttemptsCheck. */ + public enableFailedAttemptsCheck: boolean; + + /** UserPasswordValidationPolicy status. */ + public status?: (google.cloud.sql.v1.IPasswordStatus|null); + + /** UserPasswordValidationPolicy enablePasswordVerification. */ + public enablePasswordVerification: boolean; + + /** + * Creates a new UserPasswordValidationPolicy instance using the specified properties. + * @param [properties] Properties to set + * @returns UserPasswordValidationPolicy instance + */ + public static create(properties?: google.cloud.sql.v1.IUserPasswordValidationPolicy): google.cloud.sql.v1.UserPasswordValidationPolicy; + + /** + * Encodes the specified UserPasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1.UserPasswordValidationPolicy.verify|verify} messages. + * @param message UserPasswordValidationPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IUserPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserPasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UserPasswordValidationPolicy.verify|verify} messages. + * @param message UserPasswordValidationPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IUserPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserPasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.UserPasswordValidationPolicy; + + /** + * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserPasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.UserPasswordValidationPolicy; + + /** + * Verifies a UserPasswordValidationPolicy message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserPasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserPasswordValidationPolicy + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.UserPasswordValidationPolicy; + + /** + * Creates a plain object from a UserPasswordValidationPolicy message. Also converts values to other types if specified. + * @param message UserPasswordValidationPolicy + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.UserPasswordValidationPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserPasswordValidationPolicy to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserPasswordValidationPolicy + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PasswordStatus. */ + interface IPasswordStatus { + + /** PasswordStatus locked */ + locked?: (boolean|null); + + /** PasswordStatus passwordExpirationTime */ + passwordExpirationTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a PasswordStatus. */ + class PasswordStatus implements IPasswordStatus { + + /** + * Constructs a new PasswordStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IPasswordStatus); + + /** PasswordStatus locked. */ + public locked: boolean; + + /** PasswordStatus passwordExpirationTime. */ + public passwordExpirationTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new PasswordStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns PasswordStatus instance + */ + public static create(properties?: google.cloud.sql.v1.IPasswordStatus): google.cloud.sql.v1.PasswordStatus; + + /** + * Encodes the specified PasswordStatus message. Does not implicitly {@link google.cloud.sql.v1.PasswordStatus.verify|verify} messages. + * @param message PasswordStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IPasswordStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PasswordStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PasswordStatus.verify|verify} messages. + * @param message PasswordStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IPasswordStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PasswordStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PasswordStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PasswordStatus; + + /** + * Decodes a PasswordStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PasswordStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PasswordStatus; + + /** + * Verifies a PasswordStatus message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PasswordStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PasswordStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PasswordStatus; + + /** + * Creates a plain object from a PasswordStatus message. Also converts values to other types if specified. + * @param message PasswordStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.PasswordStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PasswordStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PasswordStatus + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a User. */ + interface IUser { + + /** User kind */ + kind?: (string|null); + + /** User password */ + password?: (string|null); + + /** User etag */ + etag?: (string|null); + + /** User name */ + name?: (string|null); + + /** User host */ + host?: (string|null); + + /** User instance */ + instance?: (string|null); + + /** User project */ + project?: (string|null); + + /** User type */ + type?: (google.cloud.sql.v1.User.SqlUserType|keyof typeof google.cloud.sql.v1.User.SqlUserType|null); + + /** User sqlserverUserDetails */ + sqlserverUserDetails?: (google.cloud.sql.v1.ISqlServerUserDetails|null); + + /** User iamEmail */ + iamEmail?: (string|null); + + /** User passwordPolicy */ + passwordPolicy?: (google.cloud.sql.v1.IUserPasswordValidationPolicy|null); + + /** User dualPasswordType */ + dualPasswordType?: (google.cloud.sql.v1.User.DualPasswordType|keyof typeof google.cloud.sql.v1.User.DualPasswordType|null); + + /** User iamStatus */ + iamStatus?: (google.cloud.sql.v1.User.IamStatus|keyof typeof google.cloud.sql.v1.User.IamStatus|null); + + /** User databaseRoles */ + databaseRoles?: (string[]|null); + } + + /** Represents a User. */ + class User implements IUser { + + /** + * Constructs a new User. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IUser); + + /** User kind. */ + public kind: string; + + /** User password. */ + public password: string; + + /** User etag. */ + public etag: string; + + /** User name. */ + public name: string; + + /** User host. */ + public host: string; + + /** User instance. */ + public instance: string; + + /** User project. */ + public project: string; + + /** User type. */ + public type: (google.cloud.sql.v1.User.SqlUserType|keyof typeof google.cloud.sql.v1.User.SqlUserType); + + /** User sqlserverUserDetails. */ + public sqlserverUserDetails?: (google.cloud.sql.v1.ISqlServerUserDetails|null); + + /** User iamEmail. */ + public iamEmail: string; + + /** User passwordPolicy. */ + public passwordPolicy?: (google.cloud.sql.v1.IUserPasswordValidationPolicy|null); + + /** User dualPasswordType. */ + public dualPasswordType?: (google.cloud.sql.v1.User.DualPasswordType|keyof typeof google.cloud.sql.v1.User.DualPasswordType|null); + + /** User iamStatus. */ + public iamStatus?: (google.cloud.sql.v1.User.IamStatus|keyof typeof google.cloud.sql.v1.User.IamStatus|null); + + /** User databaseRoles. */ + public databaseRoles: string[]; + + /** User userDetails. */ + public userDetails?: "sqlserverUserDetails"; + + /** + * Creates a new User instance using the specified properties. + * @param [properties] Properties to set + * @returns User instance + */ + public static create(properties?: google.cloud.sql.v1.IUser): google.cloud.sql.v1.User; + + /** + * Encodes the specified User message. Does not implicitly {@link google.cloud.sql.v1.User.verify|verify} messages. + * @param message User message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IUser, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified User message, length delimited. Does not implicitly {@link google.cloud.sql.v1.User.verify|verify} messages. + * @param message User message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IUser, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a User message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns User + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.User; + + /** + * Decodes a User message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns User + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.User; + + /** + * Verifies a User message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a User message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns User + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.User; + + /** + * Creates a plain object from a User message. Also converts values to other types if specified. + * @param message User + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.User, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this User to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for User + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace User { + + /** SqlUserType enum. */ + enum SqlUserType { + BUILT_IN = 0, + CLOUD_IAM_USER = 1, + CLOUD_IAM_SERVICE_ACCOUNT = 2, + CLOUD_IAM_GROUP = 3, + CLOUD_IAM_GROUP_USER = 4, + CLOUD_IAM_GROUP_SERVICE_ACCOUNT = 5, + ENTRAID_USER = 7 + } + + /** DualPasswordType enum. */ + enum DualPasswordType { + DUAL_PASSWORD_TYPE_UNSPECIFIED = 0, + NO_MODIFY_DUAL_PASSWORD = 1, + NO_DUAL_PASSWORD = 2, + DUAL_PASSWORD = 3 + } + + /** IamStatus enum. */ + enum IamStatus { + IAM_STATUS_UNSPECIFIED = 0, + INACTIVE = 1, + ACTIVE = 2 + } + } + + /** Properties of a SqlServerUserDetails. */ + interface ISqlServerUserDetails { + + /** SqlServerUserDetails disabled */ + disabled?: (boolean|null); + + /** SqlServerUserDetails serverRoles */ + serverRoles?: (string[]|null); + } + + /** Represents a SqlServerUserDetails. */ + class SqlServerUserDetails implements ISqlServerUserDetails { + + /** + * Constructs a new SqlServerUserDetails. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.ISqlServerUserDetails); + + /** SqlServerUserDetails disabled. */ + public disabled: boolean; + + /** SqlServerUserDetails serverRoles. */ + public serverRoles: string[]; + + /** + * Creates a new SqlServerUserDetails instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlServerUserDetails instance + */ + public static create(properties?: google.cloud.sql.v1.ISqlServerUserDetails): google.cloud.sql.v1.SqlServerUserDetails; + + /** + * Encodes the specified SqlServerUserDetails message. Does not implicitly {@link google.cloud.sql.v1.SqlServerUserDetails.verify|verify} messages. + * @param message SqlServerUserDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.ISqlServerUserDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlServerUserDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerUserDetails.verify|verify} messages. + * @param message SqlServerUserDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.ISqlServerUserDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlServerUserDetails message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlServerUserDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlServerUserDetails; + + /** + * Decodes a SqlServerUserDetails message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlServerUserDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlServerUserDetails; + + /** + * Verifies a SqlServerUserDetails message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlServerUserDetails message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlServerUserDetails + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlServerUserDetails; + + /** + * Creates a plain object from a SqlServerUserDetails message. Also converts values to other types if specified. + * @param message SqlServerUserDetails + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.SqlServerUserDetails, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlServerUserDetails to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlServerUserDetails + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UsersListResponse. */ + interface IUsersListResponse { + + /** UsersListResponse kind */ + kind?: (string|null); + + /** UsersListResponse items */ + items?: (google.cloud.sql.v1.IUser[]|null); + + /** UsersListResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a UsersListResponse. */ + class UsersListResponse implements IUsersListResponse { + + /** + * Constructs a new UsersListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1.IUsersListResponse); + + /** UsersListResponse kind. */ + public kind: string; + + /** UsersListResponse items. */ + public items: google.cloud.sql.v1.IUser[]; + + /** UsersListResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new UsersListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns UsersListResponse instance + */ + public static create(properties?: google.cloud.sql.v1.IUsersListResponse): google.cloud.sql.v1.UsersListResponse; + + /** + * Encodes the specified UsersListResponse message. Does not implicitly {@link google.cloud.sql.v1.UsersListResponse.verify|verify} messages. + * @param message UsersListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1.IUsersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UsersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UsersListResponse.verify|verify} messages. + * @param message UsersListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1.IUsersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UsersListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UsersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.UsersListResponse; + + /** + * Decodes a UsersListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UsersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.UsersListResponse; + + /** + * Verifies a UsersListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UsersListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UsersListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.UsersListResponse; + + /** + * Creates a plain object from a UsersListResponse message. Also converts values to other types if specified. + * @param message UsersListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1.UsersListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UsersListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UsersListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace v1beta4. */ + namespace v1beta4 { + + /** Represents a SqlBackupRunsService */ + class SqlBackupRunsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlBackupRunsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlBackupRunsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlBackupRunsService; + + /** + * Calls Delete. + * @param request SqlBackupRunsDeleteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public delete(request: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, callback: google.cloud.sql.v1beta4.SqlBackupRunsService.DeleteCallback): void; + + /** + * Calls Delete. + * @param request SqlBackupRunsDeleteRequest message or plain object + * @returns Promise + */ + public delete(request: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest): Promise; + + /** + * Calls Get. + * @param request SqlBackupRunsGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BackupRun + */ + public get(request: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, callback: google.cloud.sql.v1beta4.SqlBackupRunsService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlBackupRunsGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest): Promise; + + /** + * Calls Insert. + * @param request SqlBackupRunsInsertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public insert(request: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, callback: google.cloud.sql.v1beta4.SqlBackupRunsService.InsertCallback): void; + + /** + * Calls Insert. + * @param request SqlBackupRunsInsertRequest message or plain object + * @returns Promise + */ + public insert(request: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest): Promise; + + /** + * Calls List. + * @param request SqlBackupRunsListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and BackupRunsListResponse + */ + public list(request: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, callback: google.cloud.sql.v1beta4.SqlBackupRunsService.ListCallback): void; + + /** + * Calls List. + * @param request SqlBackupRunsListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest): Promise; + } + + namespace SqlBackupRunsService { + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|delete_}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|get}. + * @param error Error, if any + * @param [response] BackupRun + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.BackupRun) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|insert}. + * @param error Error, if any + * @param [response] Operation + */ + type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|list}. + * @param error Error, if any + * @param [response] BackupRunsListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.BackupRunsListResponse) => void; + } + + /** Represents a SqlDatabasesService */ + class SqlDatabasesService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlDatabasesService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlDatabasesService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlDatabasesService; + + /** + * Calls Delete. + * @param request SqlDatabasesDeleteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public delete(request: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.DeleteCallback): void; + + /** + * Calls Delete. + * @param request SqlDatabasesDeleteRequest message or plain object + * @returns Promise + */ + public delete(request: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest): Promise; + + /** + * Calls Get. + * @param request SqlDatabasesGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Database + */ + public get(request: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlDatabasesGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest): Promise; + + /** + * Calls Insert. + * @param request SqlDatabasesInsertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public insert(request: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.InsertCallback): void; + + /** + * Calls Insert. + * @param request SqlDatabasesInsertRequest message or plain object + * @returns Promise + */ + public insert(request: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest): Promise; + + /** + * Calls List. + * @param request SqlDatabasesListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DatabasesListResponse + */ + public list(request: google.cloud.sql.v1beta4.ISqlDatabasesListRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.ListCallback): void; + + /** + * Calls List. + * @param request SqlDatabasesListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1beta4.ISqlDatabasesListRequest): Promise; + + /** + * Calls Patch. + * @param request SqlDatabasesUpdateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public patch(request: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.PatchCallback): void; + + /** + * Calls Patch. + * @param request SqlDatabasesUpdateRequest message or plain object + * @returns Promise + */ + public patch(request: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest): Promise; + + /** + * Calls Update. + * @param request SqlDatabasesUpdateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public update(request: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.UpdateCallback): void; + + /** + * Calls Update. + * @param request SqlDatabasesUpdateRequest message or plain object + * @returns Promise + */ + public update(request: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest): Promise; + } + + namespace SqlDatabasesService { + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|delete_}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|get}. + * @param error Error, if any + * @param [response] Database + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Database) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|insert}. + * @param error Error, if any + * @param [response] Operation + */ + type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|list}. + * @param error Error, if any + * @param [response] DatabasesListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.DatabasesListResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|patch}. + * @param error Error, if any + * @param [response] Operation + */ + type PatchCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|update}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + } + + /** Represents a SqlFlagsService */ + class SqlFlagsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlFlagsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlFlagsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlFlagsService; + + /** + * Calls List. + * @param request SqlFlagsListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and FlagsListResponse + */ + public list(request: google.cloud.sql.v1beta4.ISqlFlagsListRequest, callback: google.cloud.sql.v1beta4.SqlFlagsService.ListCallback): void; + + /** + * Calls List. + * @param request SqlFlagsListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1beta4.ISqlFlagsListRequest): Promise; + } + + namespace SqlFlagsService { + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlFlagsService|list}. + * @param error Error, if any + * @param [response] FlagsListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.FlagsListResponse) => void; + } + + /** Represents a SqlInstancesService */ + class SqlInstancesService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlInstancesService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlInstancesService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlInstancesService; + + /** + * Calls AddServerCa. + * @param request SqlInstancesAddServerCaRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addServerCa(request: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.AddServerCaCallback): void; + + /** + * Calls AddServerCa. + * @param request SqlInstancesAddServerCaRequest message or plain object + * @returns Promise + */ + public addServerCa(request: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest): Promise; + + /** + * Calls AddServerCertificate. + * @param request SqlInstancesAddServerCertificateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addServerCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.AddServerCertificateCallback): void; + + /** + * Calls AddServerCertificate. + * @param request SqlInstancesAddServerCertificateRequest message or plain object + * @returns Promise + */ + public addServerCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest): Promise; + + /** + * Calls AddEntraIdCertificate. + * @param request SqlInstancesAddEntraIdCertificateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public addEntraIdCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.AddEntraIdCertificateCallback): void; + + /** + * Calls AddEntraIdCertificate. + * @param request SqlInstancesAddEntraIdCertificateRequest message or plain object + * @returns Promise + */ + public addEntraIdCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest): Promise; + + /** + * Calls Clone. + * @param request SqlInstancesCloneRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public clone(request: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.CloneCallback): void; + + /** + * Calls Clone. + * @param request SqlInstancesCloneRequest message or plain object + * @returns Promise + */ + public clone(request: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest): Promise; + + /** + * Calls Delete. + * @param request SqlInstancesDeleteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public delete(request: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.DeleteCallback): void; + + /** + * Calls Delete. + * @param request SqlInstancesDeleteRequest message or plain object + * @returns Promise + */ + public delete(request: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest): Promise; + + /** + * Calls DemoteMaster. + * @param request SqlInstancesDemoteMasterRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public demoteMaster(request: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.DemoteMasterCallback): void; + + /** + * Calls DemoteMaster. + * @param request SqlInstancesDemoteMasterRequest message or plain object + * @returns Promise + */ + public demoteMaster(request: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest): Promise; + + /** + * Calls Demote. + * @param request SqlInstancesDemoteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public demote(request: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.DemoteCallback): void; + + /** + * Calls Demote. + * @param request SqlInstancesDemoteRequest message or plain object + * @returns Promise + */ + public demote(request: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest): Promise; + + /** + * Calls Export. + * @param request SqlInstancesExportRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public export(request: google.cloud.sql.v1beta4.ISqlInstancesExportRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ExportCallback): void; + + /** + * Calls Export. + * @param request SqlInstancesExportRequest message or plain object + * @returns Promise + */ + public export(request: google.cloud.sql.v1beta4.ISqlInstancesExportRequest): Promise; + + /** + * Calls Failover. + * @param request SqlInstancesFailoverRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public failover(request: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.FailoverCallback): void; + + /** + * Calls Failover. + * @param request SqlInstancesFailoverRequest message or plain object + * @returns Promise + */ + public failover(request: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest): Promise; + + /** + * Calls Reencrypt. + * @param request SqlInstancesReencryptRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public reencrypt(request: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ReencryptCallback): void; + + /** + * Calls Reencrypt. + * @param request SqlInstancesReencryptRequest message or plain object + * @returns Promise + */ + public reencrypt(request: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest): Promise; + + /** + * Calls Get. + * @param request SqlInstancesGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and DatabaseInstance + */ + public get(request: google.cloud.sql.v1beta4.ISqlInstancesGetRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlInstancesGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1beta4.ISqlInstancesGetRequest): Promise; + + /** + * Calls Import. + * @param request SqlInstancesImportRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public import(request: google.cloud.sql.v1beta4.ISqlInstancesImportRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ImportCallback): void; + + /** + * Calls Import. + * @param request SqlInstancesImportRequest message or plain object + * @returns Promise + */ + public import(request: google.cloud.sql.v1beta4.ISqlInstancesImportRequest): Promise; + + /** + * Calls Insert. + * @param request SqlInstancesInsertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public insert(request: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.InsertCallback): void; + + /** + * Calls Insert. + * @param request SqlInstancesInsertRequest message or plain object + * @returns Promise + */ + public insert(request: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest): Promise; + + /** + * Calls List. + * @param request SqlInstancesListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and InstancesListResponse + */ + public list(request: google.cloud.sql.v1beta4.ISqlInstancesListRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ListCallback): void; + + /** + * Calls List. + * @param request SqlInstancesListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1beta4.ISqlInstancesListRequest): Promise; + + /** + * Calls ListServerCas. + * @param request SqlInstancesListServerCasRequest message or plain object + * @param callback Node-style callback called with the error, if any, and InstancesListServerCasResponse + */ + public listServerCas(request: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ListServerCasCallback): void; + + /** + * Calls ListServerCas. + * @param request SqlInstancesListServerCasRequest message or plain object + * @returns Promise + */ + public listServerCas(request: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest): Promise; + + /** + * Calls ListServerCertificates. + * @param request SqlInstancesListServerCertificatesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and InstancesListServerCertificatesResponse + */ + public listServerCertificates(request: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ListServerCertificatesCallback): void; + + /** + * Calls ListServerCertificates. + * @param request SqlInstancesListServerCertificatesRequest message or plain object + * @returns Promise + */ + public listServerCertificates(request: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest): Promise; + + /** + * Calls ListEntraIdCertificates. + * @param request SqlInstancesListEntraIdCertificatesRequest message or plain object + * @param callback Node-style callback called with the error, if any, and InstancesListEntraIdCertificatesResponse + */ + public listEntraIdCertificates(request: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ListEntraIdCertificatesCallback): void; + + /** + * Calls ListEntraIdCertificates. + * @param request SqlInstancesListEntraIdCertificatesRequest message or plain object + * @returns Promise + */ + public listEntraIdCertificates(request: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest): Promise; + + /** + * Calls Patch. + * @param request SqlInstancesPatchRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public patch(request: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.PatchCallback): void; + + /** + * Calls Patch. + * @param request SqlInstancesPatchRequest message or plain object + * @returns Promise + */ + public patch(request: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest): Promise; + + /** + * Calls PromoteReplica. + * @param request SqlInstancesPromoteReplicaRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public promoteReplica(request: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.PromoteReplicaCallback): void; + + /** + * Calls PromoteReplica. + * @param request SqlInstancesPromoteReplicaRequest message or plain object + * @returns Promise + */ + public promoteReplica(request: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest): Promise; + + /** + * Calls Switchover. + * @param request SqlInstancesSwitchoverRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public switchover(request: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.SwitchoverCallback): void; + + /** + * Calls Switchover. + * @param request SqlInstancesSwitchoverRequest message or plain object + * @returns Promise + */ + public switchover(request: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest): Promise; + + /** + * Calls ResetSslConfig. + * @param request SqlInstancesResetSslConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public resetSslConfig(request: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ResetSslConfigCallback): void; + + /** + * Calls ResetSslConfig. + * @param request SqlInstancesResetSslConfigRequest message or plain object + * @returns Promise + */ + public resetSslConfig(request: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest): Promise; + + /** + * Calls Restart. + * @param request SqlInstancesRestartRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public restart(request: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RestartCallback): void; + + /** + * Calls Restart. + * @param request SqlInstancesRestartRequest message or plain object + * @returns Promise + */ + public restart(request: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest): Promise; + + /** + * Calls RestoreBackup. + * @param request SqlInstancesRestoreBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public restoreBackup(request: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RestoreBackupCallback): void; + + /** + * Calls RestoreBackup. + * @param request SqlInstancesRestoreBackupRequest message or plain object + * @returns Promise + */ + public restoreBackup(request: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest): Promise; + + /** + * Calls RotateServerCa. + * @param request SqlInstancesRotateServerCaRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rotateServerCa(request: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCaCallback): void; + + /** + * Calls RotateServerCa. + * @param request SqlInstancesRotateServerCaRequest message or plain object + * @returns Promise + */ + public rotateServerCa(request: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest): Promise; + + /** + * Calls RotateServerCertificate. + * @param request SqlInstancesRotateServerCertificateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rotateServerCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCertificateCallback): void; + + /** + * Calls RotateServerCertificate. + * @param request SqlInstancesRotateServerCertificateRequest message or plain object + * @returns Promise + */ + public rotateServerCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest): Promise; + + /** + * Calls RotateEntraIdCertificate. + * @param request SqlInstancesRotateEntraIdCertificateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rotateEntraIdCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RotateEntraIdCertificateCallback): void; + + /** + * Calls RotateEntraIdCertificate. + * @param request SqlInstancesRotateEntraIdCertificateRequest message or plain object + * @returns Promise + */ + public rotateEntraIdCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest): Promise; + + /** + * Calls StartReplica. + * @param request SqlInstancesStartReplicaRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public startReplica(request: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.StartReplicaCallback): void; + + /** + * Calls StartReplica. + * @param request SqlInstancesStartReplicaRequest message or plain object + * @returns Promise + */ + public startReplica(request: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest): Promise; + + /** + * Calls StopReplica. + * @param request SqlInstancesStopReplicaRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public stopReplica(request: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.StopReplicaCallback): void; + + /** + * Calls StopReplica. + * @param request SqlInstancesStopReplicaRequest message or plain object + * @returns Promise + */ + public stopReplica(request: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest): Promise; + + /** + * Calls TruncateLog. + * @param request SqlInstancesTruncateLogRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public truncateLog(request: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.TruncateLogCallback): void; + + /** + * Calls TruncateLog. + * @param request SqlInstancesTruncateLogRequest message or plain object + * @returns Promise + */ + public truncateLog(request: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest): Promise; + + /** + * Calls Update. + * @param request SqlInstancesUpdateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public update(request: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.UpdateCallback): void; + + /** + * Calls Update. + * @param request SqlInstancesUpdateRequest message or plain object + * @returns Promise + */ + public update(request: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest): Promise; + + /** + * Calls CreateEphemeral. + * @param request SqlInstancesCreateEphemeralCertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SslCert + */ + public createEphemeral(request: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.CreateEphemeralCallback): void; + + /** + * Calls CreateEphemeral. + * @param request SqlInstancesCreateEphemeralCertRequest message or plain object + * @returns Promise + */ + public createEphemeral(request: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest): Promise; + + /** + * Calls RescheduleMaintenance. + * @param request SqlInstancesRescheduleMaintenanceRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public rescheduleMaintenance(request: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RescheduleMaintenanceCallback): void; + + /** + * Calls RescheduleMaintenance. + * @param request SqlInstancesRescheduleMaintenanceRequest message or plain object + * @returns Promise + */ + public rescheduleMaintenance(request: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest): Promise; + + /** + * Calls VerifyExternalSyncSettings. + * @param request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesVerifyExternalSyncSettingsResponse + */ + public verifyExternalSyncSettings(request: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.VerifyExternalSyncSettingsCallback): void; + + /** + * Calls VerifyExternalSyncSettings. + * @param request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object + * @returns Promise + */ + public verifyExternalSyncSettings(request: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest): Promise; + + /** + * Calls StartExternalSync. + * @param request SqlInstancesStartExternalSyncRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public startExternalSync(request: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.StartExternalSyncCallback): void; + + /** + * Calls StartExternalSync. + * @param request SqlInstancesStartExternalSyncRequest message or plain object + * @returns Promise + */ + public startExternalSync(request: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest): Promise; + + /** + * Calls PerformDiskShrink. + * @param request SqlInstancesPerformDiskShrinkRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public performDiskShrink(request: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.PerformDiskShrinkCallback): void; + + /** + * Calls PerformDiskShrink. + * @param request SqlInstancesPerformDiskShrinkRequest message or plain object + * @returns Promise + */ + public performDiskShrink(request: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest): Promise; + + /** + * Calls GetDiskShrinkConfig. + * @param request SqlInstancesGetDiskShrinkConfigRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesGetDiskShrinkConfigResponse + */ + public getDiskShrinkConfig(request: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.GetDiskShrinkConfigCallback): void; + + /** + * Calls GetDiskShrinkConfig. + * @param request SqlInstancesGetDiskShrinkConfigRequest message or plain object + * @returns Promise + */ + public getDiskShrinkConfig(request: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest): Promise; + + /** + * Calls ResetReplicaSize. + * @param request SqlInstancesResetReplicaSizeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public resetReplicaSize(request: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ResetReplicaSizeCallback): void; + + /** + * Calls ResetReplicaSize. + * @param request SqlInstancesResetReplicaSizeRequest message or plain object + * @returns Promise + */ + public resetReplicaSize(request: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest): Promise; + + /** + * Calls GetLatestRecoveryTime. + * @param request SqlInstancesGetLatestRecoveryTimeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesGetLatestRecoveryTimeResponse + */ + public getLatestRecoveryTime(request: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.GetLatestRecoveryTimeCallback): void; + + /** + * Calls GetLatestRecoveryTime. + * @param request SqlInstancesGetLatestRecoveryTimeRequest message or plain object + * @returns Promise + */ + public getLatestRecoveryTime(request: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest): Promise; + + /** + * Calls ExecuteSql. + * @param request SqlInstancesExecuteSqlRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesExecuteSqlResponse + */ + public executeSql(request: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ExecuteSqlCallback): void; + + /** + * Calls ExecuteSql. + * @param request SqlInstancesExecuteSqlRequest message or plain object + * @returns Promise + */ + public executeSql(request: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest): Promise; + + /** + * Calls AcquireSsrsLease. + * @param request SqlInstancesAcquireSsrsLeaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesAcquireSsrsLeaseResponse + */ + public acquireSsrsLease(request: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.AcquireSsrsLeaseCallback): void; + + /** + * Calls AcquireSsrsLease. + * @param request SqlInstancesAcquireSsrsLeaseRequest message or plain object + * @returns Promise + */ + public acquireSsrsLease(request: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest): Promise; + + /** + * Calls ReleaseSsrsLease. + * @param request SqlInstancesReleaseSsrsLeaseRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SqlInstancesReleaseSsrsLeaseResponse + */ + public releaseSsrsLease(request: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ReleaseSsrsLeaseCallback): void; + + /** + * Calls ReleaseSsrsLease. + * @param request SqlInstancesReleaseSsrsLeaseRequest message or plain object + * @returns Promise + */ + public releaseSsrsLease(request: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest): Promise; + + /** + * Calls PreCheckMajorVersionUpgrade. + * @param request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public preCheckMajorVersionUpgrade(request: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.PreCheckMajorVersionUpgradeCallback): void; + + /** + * Calls PreCheckMajorVersionUpgrade. + * @param request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object + * @returns Promise + */ + public preCheckMajorVersionUpgrade(request: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest): Promise; + + /** + * Calls PointInTimeRestore. + * @param request SqlInstancesPointInTimeRestoreRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public pointInTimeRestore(request: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.PointInTimeRestoreCallback): void; + + /** + * Calls PointInTimeRestore. + * @param request SqlInstancesPointInTimeRestoreRequest message or plain object + * @returns Promise + */ + public pointInTimeRestore(request: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest): Promise; + } + + namespace SqlInstancesService { + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addServerCa}. + * @param error Error, if any + * @param [response] Operation + */ + type AddServerCaCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addServerCertificate}. + * @param error Error, if any + * @param [response] Operation + */ + type AddServerCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addEntraIdCertificate}. + * @param error Error, if any + * @param [response] Operation + */ + type AddEntraIdCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|clone}. + * @param error Error, if any + * @param [response] Operation + */ + type CloneCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|delete_}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|demoteMaster}. + * @param error Error, if any + * @param [response] Operation + */ + type DemoteMasterCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|demote}. + * @param error Error, if any + * @param [response] Operation + */ + type DemoteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|export_}. + * @param error Error, if any + * @param [response] Operation + */ + type ExportCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|failover}. + * @param error Error, if any + * @param [response] Operation + */ + type FailoverCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|reencrypt}. + * @param error Error, if any + * @param [response] Operation + */ + type ReencryptCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|get}. + * @param error Error, if any + * @param [response] DatabaseInstance + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.DatabaseInstance) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|import_}. + * @param error Error, if any + * @param [response] Operation + */ + type ImportCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|insert}. + * @param error Error, if any + * @param [response] Operation + */ + type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|list}. + * @param error Error, if any + * @param [response] InstancesListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.InstancesListResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listServerCas}. + * @param error Error, if any + * @param [response] InstancesListServerCasResponse + */ + type ListServerCasCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.InstancesListServerCasResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listServerCertificates}. + * @param error Error, if any + * @param [response] InstancesListServerCertificatesResponse + */ + type ListServerCertificatesCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listEntraIdCertificates}. + * @param error Error, if any + * @param [response] InstancesListEntraIdCertificatesResponse + */ + type ListEntraIdCertificatesCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|patch}. + * @param error Error, if any + * @param [response] Operation + */ + type PatchCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|promoteReplica}. + * @param error Error, if any + * @param [response] Operation + */ + type PromoteReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|switchover}. + * @param error Error, if any + * @param [response] Operation + */ + type SwitchoverCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|resetSslConfig}. + * @param error Error, if any + * @param [response] Operation + */ + type ResetSslConfigCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|restart}. + * @param error Error, if any + * @param [response] Operation + */ + type RestartCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|restoreBackup}. + * @param error Error, if any + * @param [response] Operation + */ + type RestoreBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateServerCa}. + * @param error Error, if any + * @param [response] Operation + */ + type RotateServerCaCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateServerCertificate}. + * @param error Error, if any + * @param [response] Operation + */ + type RotateServerCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateEntraIdCertificate}. + * @param error Error, if any + * @param [response] Operation + */ + type RotateEntraIdCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|startReplica}. + * @param error Error, if any + * @param [response] Operation + */ + type StartReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|stopReplica}. + * @param error Error, if any + * @param [response] Operation + */ + type StopReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|truncateLog}. + * @param error Error, if any + * @param [response] Operation + */ + type TruncateLogCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|update}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|createEphemeral}. + * @param error Error, if any + * @param [response] SslCert + */ + type CreateEphemeralCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SslCert) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rescheduleMaintenance}. + * @param error Error, if any + * @param [response] Operation + */ + type RescheduleMaintenanceCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|verifyExternalSyncSettings}. + * @param error Error, if any + * @param [response] SqlInstancesVerifyExternalSyncSettingsResponse + */ + type VerifyExternalSyncSettingsCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|startExternalSync}. + * @param error Error, if any + * @param [response] Operation + */ + type StartExternalSyncCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|performDiskShrink}. + * @param error Error, if any + * @param [response] Operation + */ + type PerformDiskShrinkCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|getDiskShrinkConfig}. + * @param error Error, if any + * @param [response] SqlInstancesGetDiskShrinkConfigResponse + */ + type GetDiskShrinkConfigCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|resetReplicaSize}. + * @param error Error, if any + * @param [response] Operation + */ + type ResetReplicaSizeCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|getLatestRecoveryTime}. + * @param error Error, if any + * @param [response] SqlInstancesGetLatestRecoveryTimeResponse + */ + type GetLatestRecoveryTimeCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|executeSql}. + * @param error Error, if any + * @param [response] SqlInstancesExecuteSqlResponse + */ + type ExecuteSqlCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|acquireSsrsLease}. + * @param error Error, if any + * @param [response] SqlInstancesAcquireSsrsLeaseResponse + */ + type AcquireSsrsLeaseCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|releaseSsrsLease}. + * @param error Error, if any + * @param [response] SqlInstancesReleaseSsrsLeaseResponse + */ + type ReleaseSsrsLeaseCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|preCheckMajorVersionUpgrade}. + * @param error Error, if any + * @param [response] Operation + */ + type PreCheckMajorVersionUpgradeCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|pointInTimeRestore}. + * @param error Error, if any + * @param [response] Operation + */ + type PointInTimeRestoreCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + } + + /** Represents a SqlOperationsService */ + class SqlOperationsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlOperationsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlOperationsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlOperationsService; + + /** + * Calls Get. + * @param request SqlOperationsGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public get(request: google.cloud.sql.v1beta4.ISqlOperationsGetRequest, callback: google.cloud.sql.v1beta4.SqlOperationsService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlOperationsGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1beta4.ISqlOperationsGetRequest): Promise; + + /** + * Calls List. + * @param request SqlOperationsListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and OperationsListResponse + */ + public list(request: google.cloud.sql.v1beta4.ISqlOperationsListRequest, callback: google.cloud.sql.v1beta4.SqlOperationsService.ListCallback): void; + + /** + * Calls List. + * @param request SqlOperationsListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1beta4.ISqlOperationsListRequest): Promise; + + /** + * Calls Cancel. + * @param request SqlOperationsCancelRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Empty + */ + public cancel(request: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, callback: google.cloud.sql.v1beta4.SqlOperationsService.CancelCallback): void; + + /** + * Calls Cancel. + * @param request SqlOperationsCancelRequest message or plain object + * @returns Promise + */ + public cancel(request: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest): Promise; + } + + namespace SqlOperationsService { + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|get}. + * @param error Error, if any + * @param [response] Operation + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|list}. + * @param error Error, if any + * @param [response] OperationsListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.OperationsListResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|cancel}. + * @param error Error, if any + * @param [response] Empty + */ + type CancelCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; + } + + /** Represents a SqlSslCertsService */ + class SqlSslCertsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlSslCertsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlSslCertsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlSslCertsService; + + /** + * Calls Delete. + * @param request SqlSslCertsDeleteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public delete(request: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, callback: google.cloud.sql.v1beta4.SqlSslCertsService.DeleteCallback): void; + + /** + * Calls Delete. + * @param request SqlSslCertsDeleteRequest message or plain object + * @returns Promise + */ + public delete(request: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest): Promise; + + /** + * Calls Get. + * @param request SqlSslCertsGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SslCert + */ + public get(request: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, callback: google.cloud.sql.v1beta4.SqlSslCertsService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlSslCertsGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest): Promise; + + /** + * Calls Insert. + * @param request SqlSslCertsInsertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SslCertsInsertResponse + */ + public insert(request: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, callback: google.cloud.sql.v1beta4.SqlSslCertsService.InsertCallback): void; + + /** + * Calls Insert. + * @param request SqlSslCertsInsertRequest message or plain object + * @returns Promise + */ + public insert(request: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest): Promise; + + /** + * Calls List. + * @param request SqlSslCertsListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and SslCertsListResponse + */ + public list(request: google.cloud.sql.v1beta4.ISqlSslCertsListRequest, callback: google.cloud.sql.v1beta4.SqlSslCertsService.ListCallback): void; + + /** + * Calls List. + * @param request SqlSslCertsListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1beta4.ISqlSslCertsListRequest): Promise; + } + + namespace SqlSslCertsService { + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|delete_}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|get}. + * @param error Error, if any + * @param [response] SslCert + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SslCert) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|insert}. + * @param error Error, if any + * @param [response] SslCertsInsertResponse + */ + type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SslCertsInsertResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|list}. + * @param error Error, if any + * @param [response] SslCertsListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SslCertsListResponse) => void; + } + + /** Represents a SqlBackupsService */ + class SqlBackupsService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlBackupsService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlBackupsService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlBackupsService; + + /** + * Calls CreateBackup. + * @param request CreateBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public createBackup(request: google.cloud.sql.v1beta4.ICreateBackupRequest, callback: google.cloud.sql.v1beta4.SqlBackupsService.CreateBackupCallback): void; + + /** + * Calls CreateBackup. + * @param request CreateBackupRequest message or plain object + * @returns Promise + */ + public createBackup(request: google.cloud.sql.v1beta4.ICreateBackupRequest): Promise; + + /** + * Calls GetBackup. + * @param request GetBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Backup + */ + public getBackup(request: google.cloud.sql.v1beta4.IGetBackupRequest, callback: google.cloud.sql.v1beta4.SqlBackupsService.GetBackupCallback): void; + + /** + * Calls GetBackup. + * @param request GetBackupRequest message or plain object + * @returns Promise + */ + public getBackup(request: google.cloud.sql.v1beta4.IGetBackupRequest): Promise; + + /** + * Calls ListBackups. + * @param request ListBackupsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ListBackupsResponse + */ + public listBackups(request: google.cloud.sql.v1beta4.IListBackupsRequest, callback: google.cloud.sql.v1beta4.SqlBackupsService.ListBackupsCallback): void; + + /** + * Calls ListBackups. + * @param request ListBackupsRequest message or plain object + * @returns Promise + */ + public listBackups(request: google.cloud.sql.v1beta4.IListBackupsRequest): Promise; + + /** + * Calls UpdateBackup. + * @param request UpdateBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public updateBackup(request: google.cloud.sql.v1beta4.IUpdateBackupRequest, callback: google.cloud.sql.v1beta4.SqlBackupsService.UpdateBackupCallback): void; + + /** + * Calls UpdateBackup. + * @param request UpdateBackupRequest message or plain object + * @returns Promise + */ + public updateBackup(request: google.cloud.sql.v1beta4.IUpdateBackupRequest): Promise; + + /** + * Calls DeleteBackup. + * @param request DeleteBackupRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public deleteBackup(request: google.cloud.sql.v1beta4.IDeleteBackupRequest, callback: google.cloud.sql.v1beta4.SqlBackupsService.DeleteBackupCallback): void; + + /** + * Calls DeleteBackup. + * @param request DeleteBackupRequest message or plain object + * @returns Promise + */ + public deleteBackup(request: google.cloud.sql.v1beta4.IDeleteBackupRequest): Promise; + } + + namespace SqlBackupsService { + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|createBackup}. + * @param error Error, if any + * @param [response] Operation + */ + type CreateBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|getBackup}. + * @param error Error, if any + * @param [response] Backup + */ + type GetBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Backup) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|listBackups}. + * @param error Error, if any + * @param [response] ListBackupsResponse + */ + type ListBackupsCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.ListBackupsResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|updateBackup}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|deleteBackup}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + } + + /** Properties of a CreateBackupRequest. */ + interface ICreateBackupRequest { + + /** CreateBackupRequest parent */ + parent?: (string|null); + + /** CreateBackupRequest backup */ + backup?: (google.cloud.sql.v1beta4.IBackup|null); + } + + /** Represents a CreateBackupRequest. */ + class CreateBackupRequest implements ICreateBackupRequest { + + /** + * Constructs a new CreateBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ICreateBackupRequest); + + /** CreateBackupRequest parent. */ + public parent: string; + + /** CreateBackupRequest backup. */ + public backup?: (google.cloud.sql.v1beta4.IBackup|null); + + /** + * Creates a new CreateBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns CreateBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ICreateBackupRequest): google.cloud.sql.v1beta4.CreateBackupRequest; + + /** + * Encodes the specified CreateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.CreateBackupRequest.verify|verify} messages. + * @param message CreateBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ICreateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CreateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.CreateBackupRequest.verify|verify} messages. + * @param message CreateBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ICreateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CreateBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CreateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.CreateBackupRequest; + + /** + * Decodes a CreateBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CreateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.CreateBackupRequest; + + /** + * Verifies a CreateBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CreateBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CreateBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.CreateBackupRequest; + + /** + * Creates a plain object from a CreateBackupRequest message. Also converts values to other types if specified. + * @param message CreateBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.CreateBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CreateBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CreateBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GetBackupRequest. */ + interface IGetBackupRequest { + + /** GetBackupRequest name */ + name?: (string|null); + } + + /** Represents a GetBackupRequest. */ + class GetBackupRequest implements IGetBackupRequest { + + /** + * Constructs a new GetBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IGetBackupRequest); + + /** GetBackupRequest name. */ + public name: string; + + /** + * Creates a new GetBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IGetBackupRequest): google.cloud.sql.v1beta4.GetBackupRequest; + + /** + * Encodes the specified GetBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GetBackupRequest.verify|verify} messages. + * @param message GetBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IGetBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GetBackupRequest.verify|verify} messages. + * @param message GetBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IGetBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.GetBackupRequest; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.GetBackupRequest; + + /** + * Verifies a GetBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.GetBackupRequest; + + /** + * Creates a plain object from a GetBackupRequest message. Also converts values to other types if specified. + * @param message GetBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.GetBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListBackupsRequest. */ + interface IListBackupsRequest { + + /** ListBackupsRequest parent */ + parent?: (string|null); + + /** ListBackupsRequest pageSize */ + pageSize?: (number|null); + + /** ListBackupsRequest pageToken */ + pageToken?: (string|null); + + /** ListBackupsRequest filter */ + filter?: (string|null); + } + + /** Represents a ListBackupsRequest. */ + class ListBackupsRequest implements IListBackupsRequest { + + /** + * Constructs a new ListBackupsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IListBackupsRequest); + + /** ListBackupsRequest parent. */ + public parent: string; + + /** ListBackupsRequest pageSize. */ + public pageSize: number; + + /** ListBackupsRequest pageToken. */ + public pageToken: string; + + /** ListBackupsRequest filter. */ + public filter: string; + + /** + * Creates a new ListBackupsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBackupsRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IListBackupsRequest): google.cloud.sql.v1beta4.ListBackupsRequest; + + /** + * Encodes the specified ListBackupsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsRequest.verify|verify} messages. + * @param message ListBackupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IListBackupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListBackupsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsRequest.verify|verify} messages. + * @param message ListBackupsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IListBackupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ListBackupsRequest; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ListBackupsRequest; + + /** + * Verifies a ListBackupsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListBackupsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListBackupsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ListBackupsRequest; + + /** + * Creates a plain object from a ListBackupsRequest message. Also converts values to other types if specified. + * @param message ListBackupsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ListBackupsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListBackupsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListBackupsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ListBackupsResponse. */ + interface IListBackupsResponse { + + /** ListBackupsResponse backups */ + backups?: (google.cloud.sql.v1beta4.IBackup[]|null); + + /** ListBackupsResponse nextPageToken */ + nextPageToken?: (string|null); + + /** ListBackupsResponse warnings */ + warnings?: (google.cloud.sql.v1beta4.IApiWarning[]|null); + } + + /** Represents a ListBackupsResponse. */ + class ListBackupsResponse implements IListBackupsResponse { + + /** + * Constructs a new ListBackupsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IListBackupsResponse); + + /** ListBackupsResponse backups. */ + public backups: google.cloud.sql.v1beta4.IBackup[]; + + /** ListBackupsResponse nextPageToken. */ + public nextPageToken: string; + + /** ListBackupsResponse warnings. */ + public warnings: google.cloud.sql.v1beta4.IApiWarning[]; + + /** + * Creates a new ListBackupsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns ListBackupsResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IListBackupsResponse): google.cloud.sql.v1beta4.ListBackupsResponse; + + /** + * Encodes the specified ListBackupsResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsResponse.verify|verify} messages. + * @param message ListBackupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IListBackupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ListBackupsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsResponse.verify|verify} messages. + * @param message ListBackupsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IListBackupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ListBackupsResponse; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ListBackupsResponse; + + /** + * Verifies a ListBackupsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ListBackupsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ListBackupsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ListBackupsResponse; + + /** + * Creates a plain object from a ListBackupsResponse message. Also converts values to other types if specified. + * @param message ListBackupsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ListBackupsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ListBackupsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ListBackupsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an UpdateBackupRequest. */ + interface IUpdateBackupRequest { + + /** UpdateBackupRequest backup */ + backup?: (google.cloud.sql.v1beta4.IBackup|null); + + /** UpdateBackupRequest updateMask */ + updateMask?: (google.protobuf.IFieldMask|null); + } + + /** Represents an UpdateBackupRequest. */ + class UpdateBackupRequest implements IUpdateBackupRequest { + + /** + * Constructs a new UpdateBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IUpdateBackupRequest); + + /** UpdateBackupRequest backup. */ + public backup?: (google.cloud.sql.v1beta4.IBackup|null); + + /** UpdateBackupRequest updateMask. */ + public updateMask?: (google.protobuf.IFieldMask|null); + + /** + * Creates a new UpdateBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns UpdateBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IUpdateBackupRequest): google.cloud.sql.v1beta4.UpdateBackupRequest; + + /** + * Encodes the specified UpdateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.UpdateBackupRequest.verify|verify} messages. + * @param message UpdateBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IUpdateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UpdateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UpdateBackupRequest.verify|verify} messages. + * @param message UpdateBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IUpdateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UpdateBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UpdateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.UpdateBackupRequest; + + /** + * Decodes an UpdateBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UpdateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.UpdateBackupRequest; + + /** + * Verifies an UpdateBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UpdateBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UpdateBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.UpdateBackupRequest; + + /** + * Creates a plain object from an UpdateBackupRequest message. Also converts values to other types if specified. + * @param message UpdateBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.UpdateBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UpdateBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UpdateBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DeleteBackupRequest. */ + interface IDeleteBackupRequest { + + /** DeleteBackupRequest name */ + name?: (string|null); + } + + /** Represents a DeleteBackupRequest. */ + class DeleteBackupRequest implements IDeleteBackupRequest { + + /** + * Constructs a new DeleteBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDeleteBackupRequest); + + /** DeleteBackupRequest name. */ + public name: string; + + /** + * Creates a new DeleteBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns DeleteBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDeleteBackupRequest): google.cloud.sql.v1beta4.DeleteBackupRequest; + + /** + * Encodes the specified DeleteBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.DeleteBackupRequest.verify|verify} messages. + * @param message DeleteBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDeleteBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DeleteBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DeleteBackupRequest.verify|verify} messages. + * @param message DeleteBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDeleteBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DeleteBackupRequest; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DeleteBackupRequest; + + /** + * Verifies a DeleteBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DeleteBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DeleteBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DeleteBackupRequest; + + /** + * Creates a plain object from a DeleteBackupRequest message. Also converts values to other types if specified. + * @param message DeleteBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DeleteBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DeleteBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DeleteBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlBackupRunsDeleteRequest. */ + interface ISqlBackupRunsDeleteRequest { + + /** SqlBackupRunsDeleteRequest id */ + id?: (number|Long|string|null); + + /** SqlBackupRunsDeleteRequest instance */ + instance?: (string|null); + + /** SqlBackupRunsDeleteRequest project */ + project?: (string|null); + } + + /** Represents a SqlBackupRunsDeleteRequest. */ + class SqlBackupRunsDeleteRequest implements ISqlBackupRunsDeleteRequest { + + /** + * Constructs a new SqlBackupRunsDeleteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest); + + /** SqlBackupRunsDeleteRequest id. */ + public id: (number|Long|string); + + /** SqlBackupRunsDeleteRequest instance. */ + public instance: string; + + /** SqlBackupRunsDeleteRequest project. */ + public project: string; + + /** + * Creates a new SqlBackupRunsDeleteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBackupRunsDeleteRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest): google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest; + + /** + * Encodes the specified SqlBackupRunsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest.verify|verify} messages. + * @param message SqlBackupRunsDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBackupRunsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest.verify|verify} messages. + * @param message SqlBackupRunsDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBackupRunsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest; + + /** + * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBackupRunsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest; + + /** + * Verifies a SqlBackupRunsDeleteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBackupRunsDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBackupRunsDeleteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest; + + /** + * Creates a plain object from a SqlBackupRunsDeleteRequest message. Also converts values to other types if specified. + * @param message SqlBackupRunsDeleteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBackupRunsDeleteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBackupRunsDeleteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlBackupRunsGetRequest. */ + interface ISqlBackupRunsGetRequest { + + /** SqlBackupRunsGetRequest id */ + id?: (number|Long|string|null); + + /** SqlBackupRunsGetRequest instance */ + instance?: (string|null); + + /** SqlBackupRunsGetRequest project */ + project?: (string|null); + } + + /** Represents a SqlBackupRunsGetRequest. */ + class SqlBackupRunsGetRequest implements ISqlBackupRunsGetRequest { + + /** + * Constructs a new SqlBackupRunsGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest); + + /** SqlBackupRunsGetRequest id. */ + public id: (number|Long|string); + + /** SqlBackupRunsGetRequest instance. */ + public instance: string; + + /** SqlBackupRunsGetRequest project. */ + public project: string; + + /** + * Creates a new SqlBackupRunsGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBackupRunsGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest): google.cloud.sql.v1beta4.SqlBackupRunsGetRequest; + + /** + * Encodes the specified SqlBackupRunsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsGetRequest.verify|verify} messages. + * @param message SqlBackupRunsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBackupRunsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsGetRequest.verify|verify} messages. + * @param message SqlBackupRunsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBackupRunsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlBackupRunsGetRequest; + + /** + * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBackupRunsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlBackupRunsGetRequest; + + /** + * Verifies a SqlBackupRunsGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBackupRunsGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBackupRunsGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlBackupRunsGetRequest; + + /** + * Creates a plain object from a SqlBackupRunsGetRequest message. Also converts values to other types if specified. + * @param message SqlBackupRunsGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlBackupRunsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBackupRunsGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBackupRunsGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlBackupRunsInsertRequest. */ + interface ISqlBackupRunsInsertRequest { + + /** SqlBackupRunsInsertRequest instance */ + instance?: (string|null); + + /** SqlBackupRunsInsertRequest project */ + project?: (string|null); + + /** SqlBackupRunsInsertRequest body */ + body?: (google.cloud.sql.v1beta4.IBackupRun|null); + } + + /** Represents a SqlBackupRunsInsertRequest. */ + class SqlBackupRunsInsertRequest implements ISqlBackupRunsInsertRequest { + + /** + * Constructs a new SqlBackupRunsInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest); + + /** SqlBackupRunsInsertRequest instance. */ + public instance: string; + + /** SqlBackupRunsInsertRequest project. */ + public project: string; + + /** SqlBackupRunsInsertRequest body. */ + public body?: (google.cloud.sql.v1beta4.IBackupRun|null); + + /** + * Creates a new SqlBackupRunsInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBackupRunsInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest): google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest; + + /** + * Encodes the specified SqlBackupRunsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest.verify|verify} messages. + * @param message SqlBackupRunsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBackupRunsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest.verify|verify} messages. + * @param message SqlBackupRunsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBackupRunsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest; + + /** + * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBackupRunsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest; + + /** + * Verifies a SqlBackupRunsInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBackupRunsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBackupRunsInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest; + + /** + * Creates a plain object from a SqlBackupRunsInsertRequest message. Also converts values to other types if specified. + * @param message SqlBackupRunsInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBackupRunsInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBackupRunsInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlBackupRunsListRequest. */ + interface ISqlBackupRunsListRequest { + + /** SqlBackupRunsListRequest instance */ + instance?: (string|null); + + /** SqlBackupRunsListRequest maxResults */ + maxResults?: (number|null); + + /** SqlBackupRunsListRequest pageToken */ + pageToken?: (string|null); + + /** SqlBackupRunsListRequest project */ + project?: (string|null); + } + + /** Represents a SqlBackupRunsListRequest. */ + class SqlBackupRunsListRequest implements ISqlBackupRunsListRequest { + + /** + * Constructs a new SqlBackupRunsListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest); + + /** SqlBackupRunsListRequest instance. */ + public instance: string; + + /** SqlBackupRunsListRequest maxResults. */ + public maxResults: number; + + /** SqlBackupRunsListRequest pageToken. */ + public pageToken: string; + + /** SqlBackupRunsListRequest project. */ + public project: string; + + /** + * Creates a new SqlBackupRunsListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBackupRunsListRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest): google.cloud.sql.v1beta4.SqlBackupRunsListRequest; + + /** + * Encodes the specified SqlBackupRunsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsListRequest.verify|verify} messages. + * @param message SqlBackupRunsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBackupRunsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsListRequest.verify|verify} messages. + * @param message SqlBackupRunsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBackupRunsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlBackupRunsListRequest; + + /** + * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBackupRunsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlBackupRunsListRequest; + + /** + * Verifies a SqlBackupRunsListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBackupRunsListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBackupRunsListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlBackupRunsListRequest; + + /** + * Creates a plain object from a SqlBackupRunsListRequest message. Also converts values to other types if specified. + * @param message SqlBackupRunsListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlBackupRunsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBackupRunsListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBackupRunsListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlDatabasesDeleteRequest. */ + interface ISqlDatabasesDeleteRequest { + + /** SqlDatabasesDeleteRequest database */ + database?: (string|null); + + /** SqlDatabasesDeleteRequest instance */ + instance?: (string|null); + + /** SqlDatabasesDeleteRequest project */ + project?: (string|null); + } + + /** Represents a SqlDatabasesDeleteRequest. */ + class SqlDatabasesDeleteRequest implements ISqlDatabasesDeleteRequest { + + /** + * Constructs a new SqlDatabasesDeleteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest); + + /** SqlDatabasesDeleteRequest database. */ + public database: string; + + /** SqlDatabasesDeleteRequest instance. */ + public instance: string; + + /** SqlDatabasesDeleteRequest project. */ + public project: string; + + /** + * Creates a new SqlDatabasesDeleteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlDatabasesDeleteRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest): google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest; + + /** + * Encodes the specified SqlDatabasesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest.verify|verify} messages. + * @param message SqlDatabasesDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlDatabasesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest.verify|verify} messages. + * @param message SqlDatabasesDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlDatabasesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest; + + /** + * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlDatabasesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest; + + /** + * Verifies a SqlDatabasesDeleteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlDatabasesDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlDatabasesDeleteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest; + + /** + * Creates a plain object from a SqlDatabasesDeleteRequest message. Also converts values to other types if specified. + * @param message SqlDatabasesDeleteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlDatabasesDeleteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlDatabasesDeleteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlDatabasesGetRequest. */ + interface ISqlDatabasesGetRequest { + + /** SqlDatabasesGetRequest database */ + database?: (string|null); + + /** SqlDatabasesGetRequest instance */ + instance?: (string|null); + + /** SqlDatabasesGetRequest project */ + project?: (string|null); + } + + /** Represents a SqlDatabasesGetRequest. */ + class SqlDatabasesGetRequest implements ISqlDatabasesGetRequest { + + /** + * Constructs a new SqlDatabasesGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest); + + /** SqlDatabasesGetRequest database. */ + public database: string; + + /** SqlDatabasesGetRequest instance. */ + public instance: string; + + /** SqlDatabasesGetRequest project. */ + public project: string; + + /** + * Creates a new SqlDatabasesGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlDatabasesGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest): google.cloud.sql.v1beta4.SqlDatabasesGetRequest; + + /** + * Encodes the specified SqlDatabasesGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesGetRequest.verify|verify} messages. + * @param message SqlDatabasesGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlDatabasesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesGetRequest.verify|verify} messages. + * @param message SqlDatabasesGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlDatabasesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlDatabasesGetRequest; + + /** + * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlDatabasesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlDatabasesGetRequest; + + /** + * Verifies a SqlDatabasesGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlDatabasesGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlDatabasesGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlDatabasesGetRequest; + + /** + * Creates a plain object from a SqlDatabasesGetRequest message. Also converts values to other types if specified. + * @param message SqlDatabasesGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlDatabasesGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlDatabasesGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlDatabasesGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlDatabasesInsertRequest. */ + interface ISqlDatabasesInsertRequest { + + /** SqlDatabasesInsertRequest instance */ + instance?: (string|null); + + /** SqlDatabasesInsertRequest project */ + project?: (string|null); + + /** SqlDatabasesInsertRequest body */ + body?: (google.cloud.sql.v1beta4.IDatabase|null); + } + + /** Represents a SqlDatabasesInsertRequest. */ + class SqlDatabasesInsertRequest implements ISqlDatabasesInsertRequest { + + /** + * Constructs a new SqlDatabasesInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest); + + /** SqlDatabasesInsertRequest instance. */ + public instance: string; + + /** SqlDatabasesInsertRequest project. */ + public project: string; + + /** SqlDatabasesInsertRequest body. */ + public body?: (google.cloud.sql.v1beta4.IDatabase|null); + + /** + * Creates a new SqlDatabasesInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlDatabasesInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest): google.cloud.sql.v1beta4.SqlDatabasesInsertRequest; + + /** + * Encodes the specified SqlDatabasesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesInsertRequest.verify|verify} messages. + * @param message SqlDatabasesInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlDatabasesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesInsertRequest.verify|verify} messages. + * @param message SqlDatabasesInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlDatabasesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlDatabasesInsertRequest; + + /** + * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlDatabasesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlDatabasesInsertRequest; + + /** + * Verifies a SqlDatabasesInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlDatabasesInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlDatabasesInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlDatabasesInsertRequest; + + /** + * Creates a plain object from a SqlDatabasesInsertRequest message. Also converts values to other types if specified. + * @param message SqlDatabasesInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlDatabasesInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlDatabasesInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlDatabasesInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlDatabasesListRequest. */ + interface ISqlDatabasesListRequest { + + /** SqlDatabasesListRequest instance */ + instance?: (string|null); + + /** SqlDatabasesListRequest project */ + project?: (string|null); + } + + /** Represents a SqlDatabasesListRequest. */ + class SqlDatabasesListRequest implements ISqlDatabasesListRequest { + + /** + * Constructs a new SqlDatabasesListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlDatabasesListRequest); + + /** SqlDatabasesListRequest instance. */ + public instance: string; + + /** SqlDatabasesListRequest project. */ + public project: string; + + /** + * Creates a new SqlDatabasesListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlDatabasesListRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlDatabasesListRequest): google.cloud.sql.v1beta4.SqlDatabasesListRequest; + + /** + * Encodes the specified SqlDatabasesListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesListRequest.verify|verify} messages. + * @param message SqlDatabasesListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlDatabasesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlDatabasesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesListRequest.verify|verify} messages. + * @param message SqlDatabasesListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlDatabasesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlDatabasesListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlDatabasesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlDatabasesListRequest; + + /** + * Decodes a SqlDatabasesListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlDatabasesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlDatabasesListRequest; + + /** + * Verifies a SqlDatabasesListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlDatabasesListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlDatabasesListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlDatabasesListRequest; + + /** + * Creates a plain object from a SqlDatabasesListRequest message. Also converts values to other types if specified. + * @param message SqlDatabasesListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlDatabasesListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlDatabasesListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlDatabasesListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlDatabasesUpdateRequest. */ + interface ISqlDatabasesUpdateRequest { + + /** SqlDatabasesUpdateRequest database */ + database?: (string|null); + + /** SqlDatabasesUpdateRequest instance */ + instance?: (string|null); + + /** SqlDatabasesUpdateRequest project */ + project?: (string|null); + + /** SqlDatabasesUpdateRequest body */ + body?: (google.cloud.sql.v1beta4.IDatabase|null); + } + + /** Represents a SqlDatabasesUpdateRequest. */ + class SqlDatabasesUpdateRequest implements ISqlDatabasesUpdateRequest { + + /** + * Constructs a new SqlDatabasesUpdateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest); + + /** SqlDatabasesUpdateRequest database. */ + public database: string; + + /** SqlDatabasesUpdateRequest instance. */ + public instance: string; + + /** SqlDatabasesUpdateRequest project. */ + public project: string; + + /** SqlDatabasesUpdateRequest body. */ + public body?: (google.cloud.sql.v1beta4.IDatabase|null); + + /** + * Creates a new SqlDatabasesUpdateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlDatabasesUpdateRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest): google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest; + + /** + * Encodes the specified SqlDatabasesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest.verify|verify} messages. + * @param message SqlDatabasesUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlDatabasesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest.verify|verify} messages. + * @param message SqlDatabasesUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlDatabasesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest; + + /** + * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlDatabasesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest; + + /** + * Verifies a SqlDatabasesUpdateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlDatabasesUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlDatabasesUpdateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest; + + /** + * Creates a plain object from a SqlDatabasesUpdateRequest message. Also converts values to other types if specified. + * @param message SqlDatabasesUpdateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlDatabasesUpdateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlDatabasesUpdateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlFlagsListRequest. */ + interface ISqlFlagsListRequest { + + /** SqlFlagsListRequest databaseVersion */ + databaseVersion?: (string|null); + + /** SqlFlagsListRequest flagScope */ + flagScope?: (google.cloud.sql.v1beta4.SqlFlagScope|keyof typeof google.cloud.sql.v1beta4.SqlFlagScope|null); + } + + /** Represents a SqlFlagsListRequest. */ + class SqlFlagsListRequest implements ISqlFlagsListRequest { + + /** + * Constructs a new SqlFlagsListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlFlagsListRequest); + + /** SqlFlagsListRequest databaseVersion. */ + public databaseVersion: string; + + /** SqlFlagsListRequest flagScope. */ + public flagScope?: (google.cloud.sql.v1beta4.SqlFlagScope|keyof typeof google.cloud.sql.v1beta4.SqlFlagScope|null); + + /** + * Creates a new SqlFlagsListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlFlagsListRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlFlagsListRequest): google.cloud.sql.v1beta4.SqlFlagsListRequest; + + /** + * Encodes the specified SqlFlagsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlFlagsListRequest.verify|verify} messages. + * @param message SqlFlagsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlFlagsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlFlagsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlFlagsListRequest.verify|verify} messages. + * @param message SqlFlagsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlFlagsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlFlagsListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlFlagsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlFlagsListRequest; + + /** + * Decodes a SqlFlagsListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlFlagsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlFlagsListRequest; + + /** + * Verifies a SqlFlagsListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlFlagsListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlFlagsListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlFlagsListRequest; + + /** + * Creates a plain object from a SqlFlagsListRequest message. Also converts values to other types if specified. + * @param message SqlFlagsListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlFlagsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlFlagsListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlFlagsListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesAddServerCaRequest. */ + interface ISqlInstancesAddServerCaRequest { + + /** SqlInstancesAddServerCaRequest instance */ + instance?: (string|null); + + /** SqlInstancesAddServerCaRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesAddServerCaRequest. */ + class SqlInstancesAddServerCaRequest implements ISqlInstancesAddServerCaRequest { + + /** + * Constructs a new SqlInstancesAddServerCaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest); + + /** SqlInstancesAddServerCaRequest instance. */ + public instance: string; + + /** SqlInstancesAddServerCaRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesAddServerCaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesAddServerCaRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest): google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest; + + /** + * Encodes the specified SqlInstancesAddServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest.verify|verify} messages. + * @param message SqlInstancesAddServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesAddServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest.verify|verify} messages. + * @param message SqlInstancesAddServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesAddServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest; + + /** + * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesAddServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest; + + /** + * Verifies a SqlInstancesAddServerCaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesAddServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesAddServerCaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest; + + /** + * Creates a plain object from a SqlInstancesAddServerCaRequest message. Also converts values to other types if specified. + * @param message SqlInstancesAddServerCaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesAddServerCaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesAddServerCaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesAddServerCertificateRequest. */ + interface ISqlInstancesAddServerCertificateRequest { + + /** SqlInstancesAddServerCertificateRequest instance */ + instance?: (string|null); + + /** SqlInstancesAddServerCertificateRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesAddServerCertificateRequest. */ + class SqlInstancesAddServerCertificateRequest implements ISqlInstancesAddServerCertificateRequest { + + /** + * Constructs a new SqlInstancesAddServerCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest); + + /** SqlInstancesAddServerCertificateRequest instance. */ + public instance: string; + + /** SqlInstancesAddServerCertificateRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesAddServerCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesAddServerCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest): google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest; + + /** + * Encodes the specified SqlInstancesAddServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest.verify|verify} messages. + * @param message SqlInstancesAddServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesAddServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest.verify|verify} messages. + * @param message SqlInstancesAddServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesAddServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest; + + /** + * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesAddServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest; + + /** + * Verifies a SqlInstancesAddServerCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesAddServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesAddServerCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest; + + /** + * Creates a plain object from a SqlInstancesAddServerCertificateRequest message. Also converts values to other types if specified. + * @param message SqlInstancesAddServerCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesAddServerCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesAddServerCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesAddEntraIdCertificateRequest. */ + interface ISqlInstancesAddEntraIdCertificateRequest { + + /** SqlInstancesAddEntraIdCertificateRequest instance */ + instance?: (string|null); + + /** SqlInstancesAddEntraIdCertificateRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesAddEntraIdCertificateRequest. */ + class SqlInstancesAddEntraIdCertificateRequest implements ISqlInstancesAddEntraIdCertificateRequest { + + /** + * Constructs a new SqlInstancesAddEntraIdCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest); + + /** SqlInstancesAddEntraIdCertificateRequest instance. */ + public instance: string; + + /** SqlInstancesAddEntraIdCertificateRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesAddEntraIdCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesAddEntraIdCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest): google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest; + + /** + * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. + * @param message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. + * @param message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesAddEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest; + + /** + * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesAddEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest; + + /** + * Verifies a SqlInstancesAddEntraIdCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesAddEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesAddEntraIdCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest; + + /** + * Creates a plain object from a SqlInstancesAddEntraIdCertificateRequest message. Also converts values to other types if specified. + * @param message SqlInstancesAddEntraIdCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesAddEntraIdCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesAddEntraIdCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesCloneRequest. */ + interface ISqlInstancesCloneRequest { + + /** SqlInstancesCloneRequest instance */ + instance?: (string|null); + + /** SqlInstancesCloneRequest project */ + project?: (string|null); + + /** SqlInstancesCloneRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesCloneRequest|null); + } + + /** Represents a SqlInstancesCloneRequest. */ + class SqlInstancesCloneRequest implements ISqlInstancesCloneRequest { + + /** + * Constructs a new SqlInstancesCloneRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest); + + /** SqlInstancesCloneRequest instance. */ + public instance: string; + + /** SqlInstancesCloneRequest project. */ + public project: string; + + /** SqlInstancesCloneRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesCloneRequest|null); + + /** + * Creates a new SqlInstancesCloneRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesCloneRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest): google.cloud.sql.v1beta4.SqlInstancesCloneRequest; + + /** + * Encodes the specified SqlInstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCloneRequest.verify|verify} messages. + * @param message SqlInstancesCloneRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCloneRequest.verify|verify} messages. + * @param message SqlInstancesCloneRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesCloneRequest; + + /** + * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesCloneRequest; + + /** + * Verifies a SqlInstancesCloneRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesCloneRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesCloneRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesCloneRequest; + + /** + * Creates a plain object from a SqlInstancesCloneRequest message. Also converts values to other types if specified. + * @param message SqlInstancesCloneRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesCloneRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesCloneRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesCloneRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesDeleteRequest. */ + interface ISqlInstancesDeleteRequest { + + /** SqlInstancesDeleteRequest instance */ + instance?: (string|null); + + /** SqlInstancesDeleteRequest project */ + project?: (string|null); + + /** SqlInstancesDeleteRequest enableFinalBackup */ + enableFinalBackup?: (boolean|null); + + /** SqlInstancesDeleteRequest finalBackupTtlDays */ + finalBackupTtlDays?: (number|Long|string|null); + + /** SqlInstancesDeleteRequest finalBackupExpiryTime */ + finalBackupExpiryTime?: (google.protobuf.ITimestamp|null); + + /** SqlInstancesDeleteRequest finalBackupDescription */ + finalBackupDescription?: (string|null); + } + + /** Represents a SqlInstancesDeleteRequest. */ + class SqlInstancesDeleteRequest implements ISqlInstancesDeleteRequest { + + /** + * Constructs a new SqlInstancesDeleteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest); + + /** SqlInstancesDeleteRequest instance. */ + public instance: string; + + /** SqlInstancesDeleteRequest project. */ + public project: string; + + /** SqlInstancesDeleteRequest enableFinalBackup. */ + public enableFinalBackup?: (boolean|null); + + /** SqlInstancesDeleteRequest finalBackupTtlDays. */ + public finalBackupTtlDays?: (number|Long|string|null); + + /** SqlInstancesDeleteRequest finalBackupExpiryTime. */ + public finalBackupExpiryTime?: (google.protobuf.ITimestamp|null); + + /** SqlInstancesDeleteRequest finalBackupDescription. */ + public finalBackupDescription: string; + + /** SqlInstancesDeleteRequest expiration. */ + public expiration?: ("finalBackupTtlDays"|"finalBackupExpiryTime"); + + /** + * Creates a new SqlInstancesDeleteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesDeleteRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest): google.cloud.sql.v1beta4.SqlInstancesDeleteRequest; + + /** + * Encodes the specified SqlInstancesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDeleteRequest.verify|verify} messages. + * @param message SqlInstancesDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDeleteRequest.verify|verify} messages. + * @param message SqlInstancesDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesDeleteRequest; + + /** + * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesDeleteRequest; + + /** + * Verifies a SqlInstancesDeleteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesDeleteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesDeleteRequest; + + /** + * Creates a plain object from a SqlInstancesDeleteRequest message. Also converts values to other types if specified. + * @param message SqlInstancesDeleteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesDeleteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesDeleteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesDemoteMasterRequest. */ + interface ISqlInstancesDemoteMasterRequest { + + /** SqlInstancesDemoteMasterRequest instance */ + instance?: (string|null); + + /** SqlInstancesDemoteMasterRequest project */ + project?: (string|null); + + /** SqlInstancesDemoteMasterRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest|null); + } + + /** Represents a SqlInstancesDemoteMasterRequest. */ + class SqlInstancesDemoteMasterRequest implements ISqlInstancesDemoteMasterRequest { + + /** + * Constructs a new SqlInstancesDemoteMasterRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest); + + /** SqlInstancesDemoteMasterRequest instance. */ + public instance: string; + + /** SqlInstancesDemoteMasterRequest project. */ + public project: string; + + /** SqlInstancesDemoteMasterRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest|null); + + /** + * Creates a new SqlInstancesDemoteMasterRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesDemoteMasterRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest): google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest; + + /** + * Encodes the specified SqlInstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest.verify|verify} messages. + * @param message SqlInstancesDemoteMasterRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest.verify|verify} messages. + * @param message SqlInstancesDemoteMasterRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest; + + /** + * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest; + + /** + * Verifies a SqlInstancesDemoteMasterRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesDemoteMasterRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest; + + /** + * Creates a plain object from a SqlInstancesDemoteMasterRequest message. Also converts values to other types if specified. + * @param message SqlInstancesDemoteMasterRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesDemoteMasterRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesDemoteMasterRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesDemoteRequest. */ + interface ISqlInstancesDemoteRequest { + + /** SqlInstancesDemoteRequest instance */ + instance?: (string|null); + + /** SqlInstancesDemoteRequest project */ + project?: (string|null); + + /** SqlInstancesDemoteRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesDemoteRequest|null); + } + + /** Represents a SqlInstancesDemoteRequest. */ + class SqlInstancesDemoteRequest implements ISqlInstancesDemoteRequest { + + /** + * Constructs a new SqlInstancesDemoteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest); + + /** SqlInstancesDemoteRequest instance. */ + public instance: string; + + /** SqlInstancesDemoteRequest project. */ + public project: string; + + /** SqlInstancesDemoteRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesDemoteRequest|null); + + /** + * Creates a new SqlInstancesDemoteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesDemoteRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest): google.cloud.sql.v1beta4.SqlInstancesDemoteRequest; + + /** + * Encodes the specified SqlInstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteRequest.verify|verify} messages. + * @param message SqlInstancesDemoteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteRequest.verify|verify} messages. + * @param message SqlInstancesDemoteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesDemoteRequest; + + /** + * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesDemoteRequest; + + /** + * Verifies a SqlInstancesDemoteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesDemoteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesDemoteRequest; + + /** + * Creates a plain object from a SqlInstancesDemoteRequest message. Also converts values to other types if specified. + * @param message SqlInstancesDemoteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesDemoteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesDemoteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesDemoteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesExportRequest. */ + interface ISqlInstancesExportRequest { + + /** SqlInstancesExportRequest instance */ + instance?: (string|null); + + /** SqlInstancesExportRequest project */ + project?: (string|null); + + /** SqlInstancesExportRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesExportRequest|null); + } + + /** Represents a SqlInstancesExportRequest. */ + class SqlInstancesExportRequest implements ISqlInstancesExportRequest { + + /** + * Constructs a new SqlInstancesExportRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesExportRequest); + + /** SqlInstancesExportRequest instance. */ + public instance: string; + + /** SqlInstancesExportRequest project. */ + public project: string; + + /** SqlInstancesExportRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesExportRequest|null); + + /** + * Creates a new SqlInstancesExportRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesExportRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesExportRequest): google.cloud.sql.v1beta4.SqlInstancesExportRequest; + + /** + * Encodes the specified SqlInstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExportRequest.verify|verify} messages. + * @param message SqlInstancesExportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExportRequest.verify|verify} messages. + * @param message SqlInstancesExportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesExportRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesExportRequest; + + /** + * Decodes a SqlInstancesExportRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesExportRequest; + + /** + * Verifies a SqlInstancesExportRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesExportRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesExportRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesExportRequest; + + /** + * Creates a plain object from a SqlInstancesExportRequest message. Also converts values to other types if specified. + * @param message SqlInstancesExportRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesExportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesExportRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesExportRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesFailoverRequest. */ + interface ISqlInstancesFailoverRequest { + + /** SqlInstancesFailoverRequest instance */ + instance?: (string|null); + + /** SqlInstancesFailoverRequest project */ + project?: (string|null); + + /** SqlInstancesFailoverRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesFailoverRequest|null); + } + + /** Represents a SqlInstancesFailoverRequest. */ + class SqlInstancesFailoverRequest implements ISqlInstancesFailoverRequest { + + /** + * Constructs a new SqlInstancesFailoverRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest); + + /** SqlInstancesFailoverRequest instance. */ + public instance: string; + + /** SqlInstancesFailoverRequest project. */ + public project: string; + + /** SqlInstancesFailoverRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesFailoverRequest|null); + + /** + * Creates a new SqlInstancesFailoverRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesFailoverRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest): google.cloud.sql.v1beta4.SqlInstancesFailoverRequest; + + /** + * Encodes the specified SqlInstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesFailoverRequest.verify|verify} messages. + * @param message SqlInstancesFailoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesFailoverRequest.verify|verify} messages. + * @param message SqlInstancesFailoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesFailoverRequest; + + /** + * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesFailoverRequest; + + /** + * Verifies a SqlInstancesFailoverRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesFailoverRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesFailoverRequest; + + /** + * Creates a plain object from a SqlInstancesFailoverRequest message. Also converts values to other types if specified. + * @param message SqlInstancesFailoverRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesFailoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesFailoverRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesFailoverRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesGetRequest. */ + interface ISqlInstancesGetRequest { + + /** SqlInstancesGetRequest instance */ + instance?: (string|null); + + /** SqlInstancesGetRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesGetRequest. */ + class SqlInstancesGetRequest implements ISqlInstancesGetRequest { + + /** + * Constructs a new SqlInstancesGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetRequest); + + /** SqlInstancesGetRequest instance. */ + public instance: string; + + /** SqlInstancesGetRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetRequest): google.cloud.sql.v1beta4.SqlInstancesGetRequest; + + /** + * Encodes the specified SqlInstancesGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetRequest.verify|verify} messages. + * @param message SqlInstancesGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetRequest.verify|verify} messages. + * @param message SqlInstancesGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesGetRequest; + + /** + * Decodes a SqlInstancesGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesGetRequest; + + /** + * Verifies a SqlInstancesGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesGetRequest; + + /** + * Creates a plain object from a SqlInstancesGetRequest message. Also converts values to other types if specified. + * @param message SqlInstancesGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesImportRequest. */ + interface ISqlInstancesImportRequest { + + /** SqlInstancesImportRequest instance */ + instance?: (string|null); + + /** SqlInstancesImportRequest project */ + project?: (string|null); + + /** SqlInstancesImportRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesImportRequest|null); + } + + /** Represents a SqlInstancesImportRequest. */ + class SqlInstancesImportRequest implements ISqlInstancesImportRequest { + + /** + * Constructs a new SqlInstancesImportRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesImportRequest); + + /** SqlInstancesImportRequest instance. */ + public instance: string; + + /** SqlInstancesImportRequest project. */ + public project: string; + + /** SqlInstancesImportRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesImportRequest|null); + + /** + * Creates a new SqlInstancesImportRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesImportRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesImportRequest): google.cloud.sql.v1beta4.SqlInstancesImportRequest; + + /** + * Encodes the specified SqlInstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesImportRequest.verify|verify} messages. + * @param message SqlInstancesImportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesImportRequest.verify|verify} messages. + * @param message SqlInstancesImportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesImportRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesImportRequest; + + /** + * Decodes a SqlInstancesImportRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesImportRequest; + + /** + * Verifies a SqlInstancesImportRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesImportRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesImportRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesImportRequest; + + /** + * Creates a plain object from a SqlInstancesImportRequest message. Also converts values to other types if specified. + * @param message SqlInstancesImportRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesImportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesImportRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesImportRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesInsertRequest. */ + interface ISqlInstancesInsertRequest { + + /** SqlInstancesInsertRequest project */ + project?: (string|null); + + /** SqlInstancesInsertRequest body */ + body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); + } + + /** Represents a SqlInstancesInsertRequest. */ + class SqlInstancesInsertRequest implements ISqlInstancesInsertRequest { + + /** + * Constructs a new SqlInstancesInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest); + + /** SqlInstancesInsertRequest project. */ + public project: string; + + /** SqlInstancesInsertRequest body. */ + public body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); + + /** + * Creates a new SqlInstancesInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest): google.cloud.sql.v1beta4.SqlInstancesInsertRequest; + + /** + * Encodes the specified SqlInstancesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesInsertRequest.verify|verify} messages. + * @param message SqlInstancesInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesInsertRequest.verify|verify} messages. + * @param message SqlInstancesInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesInsertRequest; + + /** + * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesInsertRequest; + + /** + * Verifies a SqlInstancesInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesInsertRequest; + + /** + * Creates a plain object from a SqlInstancesInsertRequest message. Also converts values to other types if specified. + * @param message SqlInstancesInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesListRequest. */ + interface ISqlInstancesListRequest { + + /** SqlInstancesListRequest filter */ + filter?: (string|null); + + /** SqlInstancesListRequest maxResults */ + maxResults?: (number|null); + + /** SqlInstancesListRequest pageToken */ + pageToken?: (string|null); + + /** SqlInstancesListRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesListRequest. */ + class SqlInstancesListRequest implements ISqlInstancesListRequest { + + /** + * Constructs a new SqlInstancesListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesListRequest); + + /** SqlInstancesListRequest filter. */ + public filter: string; + + /** SqlInstancesListRequest maxResults. */ + public maxResults: number; + + /** SqlInstancesListRequest pageToken. */ + public pageToken: string; + + /** SqlInstancesListRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesListRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesListRequest): google.cloud.sql.v1beta4.SqlInstancesListRequest; + + /** + * Encodes the specified SqlInstancesListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListRequest.verify|verify} messages. + * @param message SqlInstancesListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListRequest.verify|verify} messages. + * @param message SqlInstancesListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesListRequest; + + /** + * Decodes a SqlInstancesListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesListRequest; + + /** + * Verifies a SqlInstancesListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesListRequest; + + /** + * Creates a plain object from a SqlInstancesListRequest message. Also converts values to other types if specified. + * @param message SqlInstancesListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesListServerCasRequest. */ + interface ISqlInstancesListServerCasRequest { + + /** SqlInstancesListServerCasRequest instance */ + instance?: (string|null); + + /** SqlInstancesListServerCasRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesListServerCasRequest. */ + class SqlInstancesListServerCasRequest implements ISqlInstancesListServerCasRequest { + + /** + * Constructs a new SqlInstancesListServerCasRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest); + + /** SqlInstancesListServerCasRequest instance. */ + public instance: string; + + /** SqlInstancesListServerCasRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesListServerCasRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesListServerCasRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest): google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest; + + /** + * Encodes the specified SqlInstancesListServerCasRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest.verify|verify} messages. + * @param message SqlInstancesListServerCasRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesListServerCasRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest.verify|verify} messages. + * @param message SqlInstancesListServerCasRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesListServerCasRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest; + + /** + * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesListServerCasRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest; + + /** + * Verifies a SqlInstancesListServerCasRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesListServerCasRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesListServerCasRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest; + + /** + * Creates a plain object from a SqlInstancesListServerCasRequest message. Also converts values to other types if specified. + * @param message SqlInstancesListServerCasRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesListServerCasRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesListServerCasRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesListServerCertificatesRequest. */ + interface ISqlInstancesListServerCertificatesRequest { + + /** SqlInstancesListServerCertificatesRequest instance */ + instance?: (string|null); + + /** SqlInstancesListServerCertificatesRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesListServerCertificatesRequest. */ + class SqlInstancesListServerCertificatesRequest implements ISqlInstancesListServerCertificatesRequest { + + /** + * Constructs a new SqlInstancesListServerCertificatesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest); + + /** SqlInstancesListServerCertificatesRequest instance. */ + public instance: string; + + /** SqlInstancesListServerCertificatesRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesListServerCertificatesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesListServerCertificatesRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest): google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest; + + /** + * Encodes the specified SqlInstancesListServerCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest.verify|verify} messages. + * @param message SqlInstancesListServerCertificatesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesListServerCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest.verify|verify} messages. + * @param message SqlInstancesListServerCertificatesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesListServerCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest; + + /** + * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesListServerCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest; + + /** + * Verifies a SqlInstancesListServerCertificatesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesListServerCertificatesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesListServerCertificatesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest; + + /** + * Creates a plain object from a SqlInstancesListServerCertificatesRequest message. Also converts values to other types if specified. + * @param message SqlInstancesListServerCertificatesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesListServerCertificatesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesListServerCertificatesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesListEntraIdCertificatesRequest. */ + interface ISqlInstancesListEntraIdCertificatesRequest { + + /** SqlInstancesListEntraIdCertificatesRequest instance */ + instance?: (string|null); + + /** SqlInstancesListEntraIdCertificatesRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesListEntraIdCertificatesRequest. */ + class SqlInstancesListEntraIdCertificatesRequest implements ISqlInstancesListEntraIdCertificatesRequest { + + /** + * Constructs a new SqlInstancesListEntraIdCertificatesRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest); + + /** SqlInstancesListEntraIdCertificatesRequest instance. */ + public instance: string; + + /** SqlInstancesListEntraIdCertificatesRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesListEntraIdCertificatesRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesListEntraIdCertificatesRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest): google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest; + + /** + * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. + * @param message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. + * @param message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesListEntraIdCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest; + + /** + * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesListEntraIdCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest; + + /** + * Verifies a SqlInstancesListEntraIdCertificatesRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesListEntraIdCertificatesRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesListEntraIdCertificatesRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest; + + /** + * Creates a plain object from a SqlInstancesListEntraIdCertificatesRequest message. Also converts values to other types if specified. + * @param message SqlInstancesListEntraIdCertificatesRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesListEntraIdCertificatesRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesListEntraIdCertificatesRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesPatchRequest. */ + interface ISqlInstancesPatchRequest { + + /** SqlInstancesPatchRequest instance */ + instance?: (string|null); + + /** SqlInstancesPatchRequest project */ + project?: (string|null); + + /** SqlInstancesPatchRequest body */ + body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); + } + + /** Represents a SqlInstancesPatchRequest. */ + class SqlInstancesPatchRequest implements ISqlInstancesPatchRequest { + + /** + * Constructs a new SqlInstancesPatchRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest); + + /** SqlInstancesPatchRequest instance. */ + public instance: string; + + /** SqlInstancesPatchRequest project. */ + public project: string; + + /** SqlInstancesPatchRequest body. */ + public body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); + + /** + * Creates a new SqlInstancesPatchRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesPatchRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest): google.cloud.sql.v1beta4.SqlInstancesPatchRequest; + + /** + * Encodes the specified SqlInstancesPatchRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPatchRequest.verify|verify} messages. + * @param message SqlInstancesPatchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesPatchRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPatchRequest.verify|verify} messages. + * @param message SqlInstancesPatchRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesPatchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesPatchRequest; + + /** + * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesPatchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesPatchRequest; + + /** + * Verifies a SqlInstancesPatchRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesPatchRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesPatchRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesPatchRequest; + + /** + * Creates a plain object from a SqlInstancesPatchRequest message. Also converts values to other types if specified. + * @param message SqlInstancesPatchRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesPatchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesPatchRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesPatchRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesPromoteReplicaRequest. */ + interface ISqlInstancesPromoteReplicaRequest { + + /** SqlInstancesPromoteReplicaRequest instance */ + instance?: (string|null); + + /** SqlInstancesPromoteReplicaRequest project */ + project?: (string|null); + + /** SqlInstancesPromoteReplicaRequest failover */ + failover?: (boolean|null); + } + + /** Represents a SqlInstancesPromoteReplicaRequest. */ + class SqlInstancesPromoteReplicaRequest implements ISqlInstancesPromoteReplicaRequest { + + /** + * Constructs a new SqlInstancesPromoteReplicaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest); + + /** SqlInstancesPromoteReplicaRequest instance. */ + public instance: string; + + /** SqlInstancesPromoteReplicaRequest project. */ + public project: string; + + /** SqlInstancesPromoteReplicaRequest failover. */ + public failover: boolean; + + /** + * Creates a new SqlInstancesPromoteReplicaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesPromoteReplicaRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest): google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest; + + /** + * Encodes the specified SqlInstancesPromoteReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest.verify|verify} messages. + * @param message SqlInstancesPromoteReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesPromoteReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest.verify|verify} messages. + * @param message SqlInstancesPromoteReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesPromoteReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest; + + /** + * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesPromoteReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest; + + /** + * Verifies a SqlInstancesPromoteReplicaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesPromoteReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesPromoteReplicaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest; + + /** + * Creates a plain object from a SqlInstancesPromoteReplicaRequest message. Also converts values to other types if specified. + * @param message SqlInstancesPromoteReplicaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesPromoteReplicaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesPromoteReplicaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesSwitchoverRequest. */ + interface ISqlInstancesSwitchoverRequest { + + /** SqlInstancesSwitchoverRequest instance */ + instance?: (string|null); + + /** SqlInstancesSwitchoverRequest project */ + project?: (string|null); + + /** SqlInstancesSwitchoverRequest dbTimeout */ + dbTimeout?: (google.protobuf.IDuration|null); + } + + /** Represents a SqlInstancesSwitchoverRequest. */ + class SqlInstancesSwitchoverRequest implements ISqlInstancesSwitchoverRequest { + + /** + * Constructs a new SqlInstancesSwitchoverRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest); + + /** SqlInstancesSwitchoverRequest instance. */ + public instance: string; + + /** SqlInstancesSwitchoverRequest project. */ + public project: string; + + /** SqlInstancesSwitchoverRequest dbTimeout. */ + public dbTimeout?: (google.protobuf.IDuration|null); + + /** + * Creates a new SqlInstancesSwitchoverRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesSwitchoverRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest): google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest; + + /** + * Encodes the specified SqlInstancesSwitchoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest.verify|verify} messages. + * @param message SqlInstancesSwitchoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesSwitchoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest.verify|verify} messages. + * @param message SqlInstancesSwitchoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesSwitchoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest; + + /** + * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesSwitchoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest; + + /** + * Verifies a SqlInstancesSwitchoverRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesSwitchoverRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesSwitchoverRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest; + + /** + * Creates a plain object from a SqlInstancesSwitchoverRequest message. Also converts values to other types if specified. + * @param message SqlInstancesSwitchoverRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesSwitchoverRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesSwitchoverRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesResetSslConfigRequest. */ + interface ISqlInstancesResetSslConfigRequest { + + /** SqlInstancesResetSslConfigRequest instance */ + instance?: (string|null); + + /** SqlInstancesResetSslConfigRequest project */ + project?: (string|null); + + /** SqlInstancesResetSslConfigRequest mode */ + mode?: (google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode|null); + } + + /** Represents a SqlInstancesResetSslConfigRequest. */ + class SqlInstancesResetSslConfigRequest implements ISqlInstancesResetSslConfigRequest { + + /** + * Constructs a new SqlInstancesResetSslConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest); + + /** SqlInstancesResetSslConfigRequest instance. */ + public instance: string; + + /** SqlInstancesResetSslConfigRequest project. */ + public project: string; + + /** SqlInstancesResetSslConfigRequest mode. */ + public mode: (google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode); + + /** + * Creates a new SqlInstancesResetSslConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesResetSslConfigRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest): google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest; + + /** + * Encodes the specified SqlInstancesResetSslConfigRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.verify|verify} messages. + * @param message SqlInstancesResetSslConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesResetSslConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.verify|verify} messages. + * @param message SqlInstancesResetSslConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesResetSslConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest; + + /** + * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesResetSslConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest; + + /** + * Verifies a SqlInstancesResetSslConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesResetSslConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesResetSslConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest; + + /** + * Creates a plain object from a SqlInstancesResetSslConfigRequest message. Also converts values to other types if specified. + * @param message SqlInstancesResetSslConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesResetSslConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesResetSslConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlInstancesResetSslConfigRequest { + + /** ResetSslMode enum. */ + enum ResetSslMode { + RESET_SSL_MODE_UNSPECIFIED = 0, + ALL = 1, + SYNC_FROM_PRIMARY = 2 + } + } + + /** Properties of a SqlInstancesRestartRequest. */ + interface ISqlInstancesRestartRequest { + + /** SqlInstancesRestartRequest instance */ + instance?: (string|null); + + /** SqlInstancesRestartRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesRestartRequest. */ + class SqlInstancesRestartRequest implements ISqlInstancesRestartRequest { + + /** + * Constructs a new SqlInstancesRestartRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest); + + /** SqlInstancesRestartRequest instance. */ + public instance: string; + + /** SqlInstancesRestartRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesRestartRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRestartRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest): google.cloud.sql.v1beta4.SqlInstancesRestartRequest; + + /** + * Encodes the specified SqlInstancesRestartRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestartRequest.verify|verify} messages. + * @param message SqlInstancesRestartRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRestartRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestartRequest.verify|verify} messages. + * @param message SqlInstancesRestartRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRestartRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRestartRequest; + + /** + * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRestartRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRestartRequest; + + /** + * Verifies a SqlInstancesRestartRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRestartRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRestartRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRestartRequest; + + /** + * Creates a plain object from a SqlInstancesRestartRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRestartRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRestartRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRestartRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRestartRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRestoreBackupRequest. */ + interface ISqlInstancesRestoreBackupRequest { + + /** SqlInstancesRestoreBackupRequest instance */ + instance?: (string|null); + + /** SqlInstancesRestoreBackupRequest project */ + project?: (string|null); + + /** SqlInstancesRestoreBackupRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest|null); + } + + /** Represents a SqlInstancesRestoreBackupRequest. */ + class SqlInstancesRestoreBackupRequest implements ISqlInstancesRestoreBackupRequest { + + /** + * Constructs a new SqlInstancesRestoreBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest); + + /** SqlInstancesRestoreBackupRequest instance. */ + public instance: string; + + /** SqlInstancesRestoreBackupRequest project. */ + public project: string; + + /** SqlInstancesRestoreBackupRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest|null); + + /** + * Creates a new SqlInstancesRestoreBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRestoreBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest): google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest; + + /** + * Encodes the specified SqlInstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest.verify|verify} messages. + * @param message SqlInstancesRestoreBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest.verify|verify} messages. + * @param message SqlInstancesRestoreBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest; + + /** + * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest; + + /** + * Verifies a SqlInstancesRestoreBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRestoreBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest; + + /** + * Creates a plain object from a SqlInstancesRestoreBackupRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRestoreBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRestoreBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRestoreBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRotateServerCaRequest. */ + interface ISqlInstancesRotateServerCaRequest { + + /** SqlInstancesRotateServerCaRequest instance */ + instance?: (string|null); + + /** SqlInstancesRotateServerCaRequest project */ + project?: (string|null); + + /** SqlInstancesRotateServerCaRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest|null); + } + + /** Represents a SqlInstancesRotateServerCaRequest. */ + class SqlInstancesRotateServerCaRequest implements ISqlInstancesRotateServerCaRequest { + + /** + * Constructs a new SqlInstancesRotateServerCaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest); + + /** SqlInstancesRotateServerCaRequest instance. */ + public instance: string; + + /** SqlInstancesRotateServerCaRequest project. */ + public project: string; + + /** SqlInstancesRotateServerCaRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest|null); + + /** + * Creates a new SqlInstancesRotateServerCaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRotateServerCaRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest): google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest; + + /** + * Encodes the specified SqlInstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest.verify|verify} messages. + * @param message SqlInstancesRotateServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest.verify|verify} messages. + * @param message SqlInstancesRotateServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest; + + /** + * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest; + + /** + * Verifies a SqlInstancesRotateServerCaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRotateServerCaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest; + + /** + * Creates a plain object from a SqlInstancesRotateServerCaRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRotateServerCaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRotateServerCaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRotateServerCaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRotateServerCertificateRequest. */ + interface ISqlInstancesRotateServerCertificateRequest { + + /** SqlInstancesRotateServerCertificateRequest instance */ + instance?: (string|null); + + /** SqlInstancesRotateServerCertificateRequest project */ + project?: (string|null); + + /** SqlInstancesRotateServerCertificateRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest|null); + } + + /** Represents a SqlInstancesRotateServerCertificateRequest. */ + class SqlInstancesRotateServerCertificateRequest implements ISqlInstancesRotateServerCertificateRequest { + + /** + * Constructs a new SqlInstancesRotateServerCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest); + + /** SqlInstancesRotateServerCertificateRequest instance. */ + public instance: string; + + /** SqlInstancesRotateServerCertificateRequest project. */ + public project: string; + + /** SqlInstancesRotateServerCertificateRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest|null); + + /** + * Creates a new SqlInstancesRotateServerCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRotateServerCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest): google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest; + + /** + * Encodes the specified SqlInstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. + * @param message SqlInstancesRotateServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. + * @param message SqlInstancesRotateServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest; + + /** + * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest; + + /** + * Verifies a SqlInstancesRotateServerCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRotateServerCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest; + + /** + * Creates a plain object from a SqlInstancesRotateServerCertificateRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRotateServerCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRotateServerCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRotateServerCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRotateEntraIdCertificateRequest. */ + interface ISqlInstancesRotateEntraIdCertificateRequest { + + /** SqlInstancesRotateEntraIdCertificateRequest instance */ + instance?: (string|null); + + /** SqlInstancesRotateEntraIdCertificateRequest project */ + project?: (string|null); + + /** SqlInstancesRotateEntraIdCertificateRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest|null); + } + + /** Represents a SqlInstancesRotateEntraIdCertificateRequest. */ + class SqlInstancesRotateEntraIdCertificateRequest implements ISqlInstancesRotateEntraIdCertificateRequest { + + /** + * Constructs a new SqlInstancesRotateEntraIdCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest); + + /** SqlInstancesRotateEntraIdCertificateRequest instance. */ + public instance: string; + + /** SqlInstancesRotateEntraIdCertificateRequest project. */ + public project: string; + + /** SqlInstancesRotateEntraIdCertificateRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest|null); + + /** + * Creates a new SqlInstancesRotateEntraIdCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRotateEntraIdCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest): google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest; + + /** + * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @param message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @param message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest; + + /** + * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest; + + /** + * Verifies a SqlInstancesRotateEntraIdCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRotateEntraIdCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest; + + /** + * Creates a plain object from a SqlInstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRotateEntraIdCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRotateEntraIdCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRotateEntraIdCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesStartReplicaRequest. */ + interface ISqlInstancesStartReplicaRequest { + + /** SqlInstancesStartReplicaRequest instance */ + instance?: (string|null); + + /** SqlInstancesStartReplicaRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesStartReplicaRequest. */ + class SqlInstancesStartReplicaRequest implements ISqlInstancesStartReplicaRequest { + + /** + * Constructs a new SqlInstancesStartReplicaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest); + + /** SqlInstancesStartReplicaRequest instance. */ + public instance: string; + + /** SqlInstancesStartReplicaRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesStartReplicaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesStartReplicaRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest): google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest; + + /** + * Encodes the specified SqlInstancesStartReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest.verify|verify} messages. + * @param message SqlInstancesStartReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesStartReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest.verify|verify} messages. + * @param message SqlInstancesStartReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesStartReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest; + + /** + * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesStartReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest; + + /** + * Verifies a SqlInstancesStartReplicaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesStartReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesStartReplicaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest; + + /** + * Creates a plain object from a SqlInstancesStartReplicaRequest message. Also converts values to other types if specified. + * @param message SqlInstancesStartReplicaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesStartReplicaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesStartReplicaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesStopReplicaRequest. */ + interface ISqlInstancesStopReplicaRequest { + + /** SqlInstancesStopReplicaRequest instance */ + instance?: (string|null); + + /** SqlInstancesStopReplicaRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesStopReplicaRequest. */ + class SqlInstancesStopReplicaRequest implements ISqlInstancesStopReplicaRequest { + + /** + * Constructs a new SqlInstancesStopReplicaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest); + + /** SqlInstancesStopReplicaRequest instance. */ + public instance: string; + + /** SqlInstancesStopReplicaRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesStopReplicaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesStopReplicaRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest): google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest; + + /** + * Encodes the specified SqlInstancesStopReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest.verify|verify} messages. + * @param message SqlInstancesStopReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesStopReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest.verify|verify} messages. + * @param message SqlInstancesStopReplicaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesStopReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest; + + /** + * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesStopReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest; + + /** + * Verifies a SqlInstancesStopReplicaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesStopReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesStopReplicaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest; + + /** + * Creates a plain object from a SqlInstancesStopReplicaRequest message. Also converts values to other types if specified. + * @param message SqlInstancesStopReplicaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesStopReplicaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesStopReplicaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesTruncateLogRequest. */ + interface ISqlInstancesTruncateLogRequest { + + /** SqlInstancesTruncateLogRequest instance */ + instance?: (string|null); + + /** SqlInstancesTruncateLogRequest project */ + project?: (string|null); + + /** SqlInstancesTruncateLogRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesTruncateLogRequest|null); + } + + /** Represents a SqlInstancesTruncateLogRequest. */ + class SqlInstancesTruncateLogRequest implements ISqlInstancesTruncateLogRequest { + + /** + * Constructs a new SqlInstancesTruncateLogRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest); + + /** SqlInstancesTruncateLogRequest instance. */ + public instance: string; + + /** SqlInstancesTruncateLogRequest project. */ + public project: string; + + /** SqlInstancesTruncateLogRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesTruncateLogRequest|null); + + /** + * Creates a new SqlInstancesTruncateLogRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesTruncateLogRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest): google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest; + + /** + * Encodes the specified SqlInstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest.verify|verify} messages. + * @param message SqlInstancesTruncateLogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest.verify|verify} messages. + * @param message SqlInstancesTruncateLogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest; + + /** + * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest; + + /** + * Verifies a SqlInstancesTruncateLogRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesTruncateLogRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest; + + /** + * Creates a plain object from a SqlInstancesTruncateLogRequest message. Also converts values to other types if specified. + * @param message SqlInstancesTruncateLogRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesTruncateLogRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesTruncateLogRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesUpdateRequest. */ + interface ISqlInstancesUpdateRequest { + + /** SqlInstancesUpdateRequest instance */ + instance?: (string|null); + + /** SqlInstancesUpdateRequest project */ + project?: (string|null); + + /** SqlInstancesUpdateRequest body */ + body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); + } + + /** Represents a SqlInstancesUpdateRequest. */ + class SqlInstancesUpdateRequest implements ISqlInstancesUpdateRequest { + + /** + * Constructs a new SqlInstancesUpdateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest); + + /** SqlInstancesUpdateRequest instance. */ + public instance: string; + + /** SqlInstancesUpdateRequest project. */ + public project: string; + + /** SqlInstancesUpdateRequest body. */ + public body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); + + /** + * Creates a new SqlInstancesUpdateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesUpdateRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest): google.cloud.sql.v1beta4.SqlInstancesUpdateRequest; + + /** + * Encodes the specified SqlInstancesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesUpdateRequest.verify|verify} messages. + * @param message SqlInstancesUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesUpdateRequest.verify|verify} messages. + * @param message SqlInstancesUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesUpdateRequest; + + /** + * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesUpdateRequest; + + /** + * Verifies a SqlInstancesUpdateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesUpdateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesUpdateRequest; + + /** + * Creates a plain object from a SqlInstancesUpdateRequest message. Also converts values to other types if specified. + * @param message SqlInstancesUpdateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesUpdateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesUpdateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesReencryptRequest. */ + interface ISqlInstancesReencryptRequest { + + /** SqlInstancesReencryptRequest instance */ + instance?: (string|null); + + /** SqlInstancesReencryptRequest project */ + project?: (string|null); + + /** SqlInstancesReencryptRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesReencryptRequest|null); + } + + /** Represents a SqlInstancesReencryptRequest. */ + class SqlInstancesReencryptRequest implements ISqlInstancesReencryptRequest { + + /** + * Constructs a new SqlInstancesReencryptRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest); + + /** SqlInstancesReencryptRequest instance. */ + public instance: string; + + /** SqlInstancesReencryptRequest project. */ + public project: string; + + /** SqlInstancesReencryptRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesReencryptRequest|null); + + /** + * Creates a new SqlInstancesReencryptRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesReencryptRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest): google.cloud.sql.v1beta4.SqlInstancesReencryptRequest; + + /** + * Encodes the specified SqlInstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReencryptRequest.verify|verify} messages. + * @param message SqlInstancesReencryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReencryptRequest.verify|verify} messages. + * @param message SqlInstancesReencryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesReencryptRequest; + + /** + * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesReencryptRequest; + + /** + * Verifies a SqlInstancesReencryptRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesReencryptRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesReencryptRequest; + + /** + * Creates a plain object from a SqlInstancesReencryptRequest message. Also converts values to other types if specified. + * @param message SqlInstancesReencryptRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesReencryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesReencryptRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesReencryptRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesReencryptRequest. */ + interface IInstancesReencryptRequest { + + /** InstancesReencryptRequest backupReencryptionConfig */ + backupReencryptionConfig?: (google.cloud.sql.v1beta4.IBackupReencryptionConfig|null); + } + + /** Represents an InstancesReencryptRequest. */ + class InstancesReencryptRequest implements IInstancesReencryptRequest { + + /** + * Constructs a new InstancesReencryptRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesReencryptRequest); + + /** InstancesReencryptRequest backupReencryptionConfig. */ + public backupReencryptionConfig?: (google.cloud.sql.v1beta4.IBackupReencryptionConfig|null); + + /** + * Creates a new InstancesReencryptRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesReencryptRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesReencryptRequest): google.cloud.sql.v1beta4.InstancesReencryptRequest; + + /** + * Encodes the specified InstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesReencryptRequest.verify|verify} messages. + * @param message InstancesReencryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesReencryptRequest.verify|verify} messages. + * @param message InstancesReencryptRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesReencryptRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesReencryptRequest; + + /** + * Decodes an InstancesReencryptRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesReencryptRequest; + + /** + * Verifies an InstancesReencryptRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesReencryptRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesReencryptRequest; + + /** + * Creates a plain object from an InstancesReencryptRequest message. Also converts values to other types if specified. + * @param message InstancesReencryptRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesReencryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesReencryptRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesReencryptRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupReencryptionConfig. */ + interface IBackupReencryptionConfig { + + /** BackupReencryptionConfig backupLimit */ + backupLimit?: (number|null); + + /** BackupReencryptionConfig backupType */ + backupType?: (google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|keyof typeof google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|null); + } + + /** Represents a BackupReencryptionConfig. */ + class BackupReencryptionConfig implements IBackupReencryptionConfig { + + /** + * Constructs a new BackupReencryptionConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IBackupReencryptionConfig); + + /** BackupReencryptionConfig backupLimit. */ + public backupLimit?: (number|null); + + /** BackupReencryptionConfig backupType. */ + public backupType?: (google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|keyof typeof google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|null); + + /** + * Creates a new BackupReencryptionConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupReencryptionConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IBackupReencryptionConfig): google.cloud.sql.v1beta4.BackupReencryptionConfig; + + /** + * Encodes the specified BackupReencryptionConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupReencryptionConfig.verify|verify} messages. + * @param message BackupReencryptionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IBackupReencryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupReencryptionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupReencryptionConfig.verify|verify} messages. + * @param message BackupReencryptionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupReencryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupReencryptionConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupReencryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupReencryptionConfig; + + /** + * Decodes a BackupReencryptionConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupReencryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupReencryptionConfig; + + /** + * Verifies a BackupReencryptionConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupReencryptionConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupReencryptionConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupReencryptionConfig; + + /** + * Creates a plain object from a BackupReencryptionConfig message. Also converts values to other types if specified. + * @param message BackupReencryptionConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.BackupReencryptionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupReencryptionConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupReencryptionConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BackupReencryptionConfig { + + /** BackupType enum. */ + enum BackupType { + BACKUP_TYPE_UNSPECIFIED = 0, + AUTOMATED = 1, + ON_DEMAND = 2 + } + } + + /** Properties of a SqlInstancesRescheduleMaintenanceRequest. */ + interface ISqlInstancesRescheduleMaintenanceRequest { + + /** SqlInstancesRescheduleMaintenanceRequest instance */ + instance?: (string|null); + + /** SqlInstancesRescheduleMaintenanceRequest project */ + project?: (string|null); + + /** SqlInstancesRescheduleMaintenanceRequest body */ + body?: (google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody|null); + } + + /** Represents a SqlInstancesRescheduleMaintenanceRequest. */ + class SqlInstancesRescheduleMaintenanceRequest implements ISqlInstancesRescheduleMaintenanceRequest { + + /** + * Constructs a new SqlInstancesRescheduleMaintenanceRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest); + + /** SqlInstancesRescheduleMaintenanceRequest instance. */ + public instance: string; + + /** SqlInstancesRescheduleMaintenanceRequest project. */ + public project: string; + + /** SqlInstancesRescheduleMaintenanceRequest body. */ + public body?: (google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody|null); + + /** + * Creates a new SqlInstancesRescheduleMaintenanceRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRescheduleMaintenanceRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. + * @param message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. + * @param message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRescheduleMaintenanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRescheduleMaintenanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest; + + /** + * Verifies a SqlInstancesRescheduleMaintenanceRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRescheduleMaintenanceRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRescheduleMaintenanceRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest; + + /** + * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequest message. Also converts values to other types if specified. + * @param message SqlInstancesRescheduleMaintenanceRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRescheduleMaintenanceRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRescheduleMaintenanceRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesPerformDiskShrinkRequest. */ + interface ISqlInstancesPerformDiskShrinkRequest { + + /** SqlInstancesPerformDiskShrinkRequest instance */ + instance?: (string|null); + + /** SqlInstancesPerformDiskShrinkRequest project */ + project?: (string|null); + + /** SqlInstancesPerformDiskShrinkRequest body */ + body?: (google.cloud.sql.v1beta4.IPerformDiskShrinkContext|null); + } + + /** Represents a SqlInstancesPerformDiskShrinkRequest. */ + class SqlInstancesPerformDiskShrinkRequest implements ISqlInstancesPerformDiskShrinkRequest { + + /** + * Constructs a new SqlInstancesPerformDiskShrinkRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest); + + /** SqlInstancesPerformDiskShrinkRequest instance. */ + public instance: string; + + /** SqlInstancesPerformDiskShrinkRequest project. */ + public project: string; + + /** SqlInstancesPerformDiskShrinkRequest body. */ + public body?: (google.cloud.sql.v1beta4.IPerformDiskShrinkContext|null); + + /** + * Creates a new SqlInstancesPerformDiskShrinkRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesPerformDiskShrinkRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest): google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest; + + /** + * Encodes the specified SqlInstancesPerformDiskShrinkRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. + * @param message SqlInstancesPerformDiskShrinkRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesPerformDiskShrinkRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. + * @param message SqlInstancesPerformDiskShrinkRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesPerformDiskShrinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest; + + /** + * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesPerformDiskShrinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest; + + /** + * Verifies a SqlInstancesPerformDiskShrinkRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesPerformDiskShrinkRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesPerformDiskShrinkRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest; + + /** + * Creates a plain object from a SqlInstancesPerformDiskShrinkRequest message. Also converts values to other types if specified. + * @param message SqlInstancesPerformDiskShrinkRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesPerformDiskShrinkRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesPerformDiskShrinkRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** ExternalSyncParallelLevel enum. */ + enum ExternalSyncParallelLevel { + EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED = 0, + MIN = 1, + OPTIMAL = 2, + MAX = 3 + } + + /** Properties of an ExternalSyncSelectedObject. */ + interface IExternalSyncSelectedObject { + + /** ExternalSyncSelectedObject database */ + database?: (string|null); + } + + /** Represents an ExternalSyncSelectedObject. */ + class ExternalSyncSelectedObject implements IExternalSyncSelectedObject { + + /** + * Constructs a new ExternalSyncSelectedObject. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IExternalSyncSelectedObject); + + /** ExternalSyncSelectedObject database. */ + public database: string; + + /** + * Creates a new ExternalSyncSelectedObject instance using the specified properties. + * @param [properties] Properties to set + * @returns ExternalSyncSelectedObject instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IExternalSyncSelectedObject): google.cloud.sql.v1beta4.ExternalSyncSelectedObject; + + /** + * Encodes the specified ExternalSyncSelectedObject message. Does not implicitly {@link google.cloud.sql.v1beta4.ExternalSyncSelectedObject.verify|verify} messages. + * @param message ExternalSyncSelectedObject message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IExternalSyncSelectedObject, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExternalSyncSelectedObject message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExternalSyncSelectedObject.verify|verify} messages. + * @param message ExternalSyncSelectedObject message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IExternalSyncSelectedObject, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExternalSyncSelectedObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExternalSyncSelectedObject; + + /** + * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExternalSyncSelectedObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExternalSyncSelectedObject; + + /** + * Verifies an ExternalSyncSelectedObject message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExternalSyncSelectedObject message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExternalSyncSelectedObject + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExternalSyncSelectedObject; + + /** + * Creates a plain object from an ExternalSyncSelectedObject message. Also converts values to other types if specified. + * @param message ExternalSyncSelectedObject + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ExternalSyncSelectedObject, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExternalSyncSelectedObject to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExternalSyncSelectedObject + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesVerifyExternalSyncSettingsRequest. */ + interface ISqlInstancesVerifyExternalSyncSettingsRequest { + + /** SqlInstancesVerifyExternalSyncSettingsRequest instance */ + instance?: (string|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest project */ + project?: (string|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly */ + verifyConnectionOnly?: (boolean|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest syncMode */ + syncMode?: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly */ + verifyReplicationOnly?: (boolean|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig */ + mysqlSyncConfig?: (google.cloud.sql.v1beta4.IMySqlSyncConfig|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest migrationType */ + migrationType?: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel */ + syncParallelLevel?: (google.cloud.sql.v1beta4.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1beta4.ExternalSyncParallelLevel|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects */ + selectedObjects?: (google.cloud.sql.v1beta4.IExternalSyncSelectedObject[]|null); + } + + /** Represents a SqlInstancesVerifyExternalSyncSettingsRequest. */ + class SqlInstancesVerifyExternalSyncSettingsRequest implements ISqlInstancesVerifyExternalSyncSettingsRequest { + + /** + * Constructs a new SqlInstancesVerifyExternalSyncSettingsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest); + + /** SqlInstancesVerifyExternalSyncSettingsRequest instance. */ + public instance: string; + + /** SqlInstancesVerifyExternalSyncSettingsRequest project. */ + public project: string; + + /** SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly. */ + public verifyConnectionOnly: boolean; + + /** SqlInstancesVerifyExternalSyncSettingsRequest syncMode. */ + public syncMode: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode); + + /** SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly. */ + public verifyReplicationOnly: boolean; + + /** SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig. */ + public mysqlSyncConfig?: (google.cloud.sql.v1beta4.IMySqlSyncConfig|null); + + /** SqlInstancesVerifyExternalSyncSettingsRequest migrationType. */ + public migrationType: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType); + + /** SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel. */ + public syncParallelLevel: (google.cloud.sql.v1beta4.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1beta4.ExternalSyncParallelLevel); + + /** SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects. */ + public selectedObjects: google.cloud.sql.v1beta4.IExternalSyncSelectedObject[]; + + /** SqlInstancesVerifyExternalSyncSettingsRequest syncConfig. */ + public syncConfig?: "mysqlSyncConfig"; + + /** + * Creates a new SqlInstancesVerifyExternalSyncSettingsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesVerifyExternalSyncSettingsRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. + * @param message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. + * @param message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesVerifyExternalSyncSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesVerifyExternalSyncSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest; + + /** + * Verifies a SqlInstancesVerifyExternalSyncSettingsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesVerifyExternalSyncSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesVerifyExternalSyncSettingsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest; + + /** + * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsRequest message. Also converts values to other types if specified. + * @param message SqlInstancesVerifyExternalSyncSettingsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesVerifyExternalSyncSettingsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlInstancesVerifyExternalSyncSettingsRequest { + + /** ExternalSyncMode enum. */ + enum ExternalSyncMode { + EXTERNAL_SYNC_MODE_UNSPECIFIED = 0, + ONLINE = 1, + OFFLINE = 2 + } + + /** MigrationType enum. */ + enum MigrationType { + MIGRATION_TYPE_UNSPECIFIED = 0, + LOGICAL = 1, + PHYSICAL = 2 + } + } + + /** Properties of a SqlInstancesStartExternalSyncRequest. */ + interface ISqlInstancesStartExternalSyncRequest { + + /** SqlInstancesStartExternalSyncRequest instance */ + instance?: (string|null); + + /** SqlInstancesStartExternalSyncRequest project */ + project?: (string|null); + + /** SqlInstancesStartExternalSyncRequest syncMode */ + syncMode?: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null); + + /** SqlInstancesStartExternalSyncRequest skipVerification */ + skipVerification?: (boolean|null); + + /** SqlInstancesStartExternalSyncRequest mysqlSyncConfig */ + mysqlSyncConfig?: (google.cloud.sql.v1beta4.IMySqlSyncConfig|null); + + /** SqlInstancesStartExternalSyncRequest syncParallelLevel */ + syncParallelLevel?: (google.cloud.sql.v1beta4.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1beta4.ExternalSyncParallelLevel|null); + + /** SqlInstancesStartExternalSyncRequest migrationType */ + migrationType?: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null); + + /** SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled */ + replicaOverwriteEnabled?: (boolean|null); + } + + /** Represents a SqlInstancesStartExternalSyncRequest. */ + class SqlInstancesStartExternalSyncRequest implements ISqlInstancesStartExternalSyncRequest { + + /** + * Constructs a new SqlInstancesStartExternalSyncRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest); + + /** SqlInstancesStartExternalSyncRequest instance. */ + public instance: string; + + /** SqlInstancesStartExternalSyncRequest project. */ + public project: string; + + /** SqlInstancesStartExternalSyncRequest syncMode. */ + public syncMode: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode); + + /** SqlInstancesStartExternalSyncRequest skipVerification. */ + public skipVerification: boolean; + + /** SqlInstancesStartExternalSyncRequest mysqlSyncConfig. */ + public mysqlSyncConfig?: (google.cloud.sql.v1beta4.IMySqlSyncConfig|null); + + /** SqlInstancesStartExternalSyncRequest syncParallelLevel. */ + public syncParallelLevel: (google.cloud.sql.v1beta4.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1beta4.ExternalSyncParallelLevel); + + /** SqlInstancesStartExternalSyncRequest migrationType. */ + public migrationType: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType); + + /** SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled. */ + public replicaOverwriteEnabled: boolean; + + /** SqlInstancesStartExternalSyncRequest syncConfig. */ + public syncConfig?: "mysqlSyncConfig"; + + /** + * Creates a new SqlInstancesStartExternalSyncRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesStartExternalSyncRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest): google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest; + + /** + * Encodes the specified SqlInstancesStartExternalSyncRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.verify|verify} messages. + * @param message SqlInstancesStartExternalSyncRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesStartExternalSyncRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.verify|verify} messages. + * @param message SqlInstancesStartExternalSyncRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesStartExternalSyncRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest; + + /** + * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesStartExternalSyncRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest; + + /** + * Verifies a SqlInstancesStartExternalSyncRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesStartExternalSyncRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesStartExternalSyncRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest; + + /** + * Creates a plain object from a SqlInstancesStartExternalSyncRequest message. Also converts values to other types if specified. + * @param message SqlInstancesStartExternalSyncRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesStartExternalSyncRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesStartExternalSyncRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesResetReplicaSizeRequest. */ + interface ISqlInstancesResetReplicaSizeRequest { + + /** SqlInstancesResetReplicaSizeRequest instance */ + instance?: (string|null); + + /** SqlInstancesResetReplicaSizeRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesResetReplicaSizeRequest. */ + class SqlInstancesResetReplicaSizeRequest implements ISqlInstancesResetReplicaSizeRequest { + + /** + * Constructs a new SqlInstancesResetReplicaSizeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest); + + /** SqlInstancesResetReplicaSizeRequest instance. */ + public instance: string; + + /** SqlInstancesResetReplicaSizeRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesResetReplicaSizeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesResetReplicaSizeRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest): google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest; + + /** + * Encodes the specified SqlInstancesResetReplicaSizeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. + * @param message SqlInstancesResetReplicaSizeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesResetReplicaSizeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. + * @param message SqlInstancesResetReplicaSizeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesResetReplicaSizeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest; + + /** + * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesResetReplicaSizeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest; + + /** + * Verifies a SqlInstancesResetReplicaSizeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesResetReplicaSizeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesResetReplicaSizeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest; + + /** + * Creates a plain object from a SqlInstancesResetReplicaSizeRequest message. Also converts values to other types if specified. + * @param message SqlInstancesResetReplicaSizeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesResetReplicaSizeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesResetReplicaSizeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlOperationsGetRequest. */ + interface ISqlOperationsGetRequest { + + /** SqlOperationsGetRequest operation */ + operation?: (string|null); + + /** SqlOperationsGetRequest project */ + project?: (string|null); + } + + /** Represents a SqlOperationsGetRequest. */ + class SqlOperationsGetRequest implements ISqlOperationsGetRequest { + + /** + * Constructs a new SqlOperationsGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlOperationsGetRequest); + + /** SqlOperationsGetRequest operation. */ + public operation: string; + + /** SqlOperationsGetRequest project. */ + public project: string; + + /** + * Creates a new SqlOperationsGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlOperationsGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlOperationsGetRequest): google.cloud.sql.v1beta4.SqlOperationsGetRequest; + + /** + * Encodes the specified SqlOperationsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsGetRequest.verify|verify} messages. + * @param message SqlOperationsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlOperationsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlOperationsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsGetRequest.verify|verify} messages. + * @param message SqlOperationsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlOperationsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlOperationsGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlOperationsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlOperationsGetRequest; + + /** + * Decodes a SqlOperationsGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlOperationsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlOperationsGetRequest; + + /** + * Verifies a SqlOperationsGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlOperationsGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlOperationsGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlOperationsGetRequest; + + /** + * Creates a plain object from a SqlOperationsGetRequest message. Also converts values to other types if specified. + * @param message SqlOperationsGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlOperationsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlOperationsGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlOperationsGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlOperationsListRequest. */ + interface ISqlOperationsListRequest { + + /** SqlOperationsListRequest instance */ + instance?: (string|null); + + /** SqlOperationsListRequest maxResults */ + maxResults?: (number|null); + + /** SqlOperationsListRequest pageToken */ + pageToken?: (string|null); + + /** SqlOperationsListRequest project */ + project?: (string|null); + } + + /** Represents a SqlOperationsListRequest. */ + class SqlOperationsListRequest implements ISqlOperationsListRequest { + + /** + * Constructs a new SqlOperationsListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlOperationsListRequest); + + /** SqlOperationsListRequest instance. */ + public instance: string; + + /** SqlOperationsListRequest maxResults. */ + public maxResults: number; + + /** SqlOperationsListRequest pageToken. */ + public pageToken: string; + + /** SqlOperationsListRequest project. */ + public project: string; + + /** + * Creates a new SqlOperationsListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlOperationsListRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlOperationsListRequest): google.cloud.sql.v1beta4.SqlOperationsListRequest; + + /** + * Encodes the specified SqlOperationsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsListRequest.verify|verify} messages. + * @param message SqlOperationsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlOperationsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlOperationsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsListRequest.verify|verify} messages. + * @param message SqlOperationsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlOperationsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlOperationsListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlOperationsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlOperationsListRequest; + + /** + * Decodes a SqlOperationsListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlOperationsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlOperationsListRequest; + + /** + * Verifies a SqlOperationsListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlOperationsListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlOperationsListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlOperationsListRequest; + + /** + * Creates a plain object from a SqlOperationsListRequest message. Also converts values to other types if specified. + * @param message SqlOperationsListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlOperationsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlOperationsListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlOperationsListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlOperationsCancelRequest. */ + interface ISqlOperationsCancelRequest { + + /** SqlOperationsCancelRequest operation */ + operation?: (string|null); + + /** SqlOperationsCancelRequest project */ + project?: (string|null); + } + + /** Represents a SqlOperationsCancelRequest. */ + class SqlOperationsCancelRequest implements ISqlOperationsCancelRequest { + + /** + * Constructs a new SqlOperationsCancelRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest); + + /** SqlOperationsCancelRequest operation. */ + public operation: string; + + /** SqlOperationsCancelRequest project. */ + public project: string; + + /** + * Creates a new SqlOperationsCancelRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlOperationsCancelRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest): google.cloud.sql.v1beta4.SqlOperationsCancelRequest; + + /** + * Encodes the specified SqlOperationsCancelRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsCancelRequest.verify|verify} messages. + * @param message SqlOperationsCancelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlOperationsCancelRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsCancelRequest.verify|verify} messages. + * @param message SqlOperationsCancelRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlOperationsCancelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlOperationsCancelRequest; + + /** + * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlOperationsCancelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlOperationsCancelRequest; + + /** + * Verifies a SqlOperationsCancelRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlOperationsCancelRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlOperationsCancelRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlOperationsCancelRequest; + + /** + * Creates a plain object from a SqlOperationsCancelRequest message. Also converts values to other types if specified. + * @param message SqlOperationsCancelRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlOperationsCancelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlOperationsCancelRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlOperationsCancelRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesCreateEphemeralCertRequest. */ + interface ISqlInstancesCreateEphemeralCertRequest { + + /** SqlInstancesCreateEphemeralCertRequest instance */ + instance?: (string|null); + + /** SqlInstancesCreateEphemeralCertRequest project */ + project?: (string|null); + + /** SqlInstancesCreateEphemeralCertRequest body */ + body?: (google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest|null); + } + + /** Represents a SqlInstancesCreateEphemeralCertRequest. */ + class SqlInstancesCreateEphemeralCertRequest implements ISqlInstancesCreateEphemeralCertRequest { + + /** + * Constructs a new SqlInstancesCreateEphemeralCertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest); + + /** SqlInstancesCreateEphemeralCertRequest instance. */ + public instance: string; + + /** SqlInstancesCreateEphemeralCertRequest project. */ + public project: string; + + /** SqlInstancesCreateEphemeralCertRequest body. */ + public body?: (google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest|null); + + /** + * Creates a new SqlInstancesCreateEphemeralCertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesCreateEphemeralCertRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest): google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest; + + /** + * Encodes the specified SqlInstancesCreateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. + * @param message SqlInstancesCreateEphemeralCertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesCreateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. + * @param message SqlInstancesCreateEphemeralCertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesCreateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest; + + /** + * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesCreateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest; + + /** + * Verifies a SqlInstancesCreateEphemeralCertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesCreateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesCreateEphemeralCertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest; + + /** + * Creates a plain object from a SqlInstancesCreateEphemeralCertRequest message. Also converts values to other types if specified. + * @param message SqlInstancesCreateEphemeralCertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesCreateEphemeralCertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesCreateEphemeralCertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlSslCertsDeleteRequest. */ + interface ISqlSslCertsDeleteRequest { + + /** SqlSslCertsDeleteRequest instance */ + instance?: (string|null); + + /** SqlSslCertsDeleteRequest project */ + project?: (string|null); + + /** SqlSslCertsDeleteRequest sha1Fingerprint */ + sha1Fingerprint?: (string|null); + } + + /** Represents a SqlSslCertsDeleteRequest. */ + class SqlSslCertsDeleteRequest implements ISqlSslCertsDeleteRequest { + + /** + * Constructs a new SqlSslCertsDeleteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest); + + /** SqlSslCertsDeleteRequest instance. */ + public instance: string; + + /** SqlSslCertsDeleteRequest project. */ + public project: string; + + /** SqlSslCertsDeleteRequest sha1Fingerprint. */ + public sha1Fingerprint: string; + + /** + * Creates a new SqlSslCertsDeleteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlSslCertsDeleteRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest): google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest; + + /** + * Encodes the specified SqlSslCertsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest.verify|verify} messages. + * @param message SqlSslCertsDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlSslCertsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest.verify|verify} messages. + * @param message SqlSslCertsDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlSslCertsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest; + + /** + * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlSslCertsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest; + + /** + * Verifies a SqlSslCertsDeleteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlSslCertsDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlSslCertsDeleteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest; + + /** + * Creates a plain object from a SqlSslCertsDeleteRequest message. Also converts values to other types if specified. + * @param message SqlSslCertsDeleteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlSslCertsDeleteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlSslCertsDeleteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlSslCertsGetRequest. */ + interface ISqlSslCertsGetRequest { + + /** SqlSslCertsGetRequest instance */ + instance?: (string|null); + + /** SqlSslCertsGetRequest project */ + project?: (string|null); + + /** SqlSslCertsGetRequest sha1Fingerprint */ + sha1Fingerprint?: (string|null); + } + + /** Represents a SqlSslCertsGetRequest. */ + class SqlSslCertsGetRequest implements ISqlSslCertsGetRequest { + + /** + * Constructs a new SqlSslCertsGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest); + + /** SqlSslCertsGetRequest instance. */ + public instance: string; + + /** SqlSslCertsGetRequest project. */ + public project: string; + + /** SqlSslCertsGetRequest sha1Fingerprint. */ + public sha1Fingerprint: string; + + /** + * Creates a new SqlSslCertsGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlSslCertsGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest): google.cloud.sql.v1beta4.SqlSslCertsGetRequest; + + /** + * Encodes the specified SqlSslCertsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsGetRequest.verify|verify} messages. + * @param message SqlSslCertsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlSslCertsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsGetRequest.verify|verify} messages. + * @param message SqlSslCertsGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlSslCertsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlSslCertsGetRequest; + + /** + * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlSslCertsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlSslCertsGetRequest; + + /** + * Verifies a SqlSslCertsGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlSslCertsGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlSslCertsGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlSslCertsGetRequest; + + /** + * Creates a plain object from a SqlSslCertsGetRequest message. Also converts values to other types if specified. + * @param message SqlSslCertsGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlSslCertsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlSslCertsGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlSslCertsGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlSslCertsInsertRequest. */ + interface ISqlSslCertsInsertRequest { + + /** SqlSslCertsInsertRequest instance */ + instance?: (string|null); + + /** SqlSslCertsInsertRequest project */ + project?: (string|null); + + /** SqlSslCertsInsertRequest body */ + body?: (google.cloud.sql.v1beta4.ISslCertsInsertRequest|null); + } + + /** Represents a SqlSslCertsInsertRequest. */ + class SqlSslCertsInsertRequest implements ISqlSslCertsInsertRequest { + + /** + * Constructs a new SqlSslCertsInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest); + + /** SqlSslCertsInsertRequest instance. */ + public instance: string; + + /** SqlSslCertsInsertRequest project. */ + public project: string; + + /** SqlSslCertsInsertRequest body. */ + public body?: (google.cloud.sql.v1beta4.ISslCertsInsertRequest|null); + + /** + * Creates a new SqlSslCertsInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlSslCertsInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest): google.cloud.sql.v1beta4.SqlSslCertsInsertRequest; + + /** + * Encodes the specified SqlSslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsInsertRequest.verify|verify} messages. + * @param message SqlSslCertsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlSslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsInsertRequest.verify|verify} messages. + * @param message SqlSslCertsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlSslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlSslCertsInsertRequest; + + /** + * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlSslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlSslCertsInsertRequest; + + /** + * Verifies a SqlSslCertsInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlSslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlSslCertsInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlSslCertsInsertRequest; + + /** + * Creates a plain object from a SqlSslCertsInsertRequest message. Also converts values to other types if specified. + * @param message SqlSslCertsInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlSslCertsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlSslCertsInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlSslCertsInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlSslCertsListRequest. */ + interface ISqlSslCertsListRequest { + + /** SqlSslCertsListRequest instance */ + instance?: (string|null); + + /** SqlSslCertsListRequest project */ + project?: (string|null); + } + + /** Represents a SqlSslCertsListRequest. */ + class SqlSslCertsListRequest implements ISqlSslCertsListRequest { + + /** + * Constructs a new SqlSslCertsListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlSslCertsListRequest); + + /** SqlSslCertsListRequest instance. */ + public instance: string; + + /** SqlSslCertsListRequest project. */ + public project: string; + + /** + * Creates a new SqlSslCertsListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlSslCertsListRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlSslCertsListRequest): google.cloud.sql.v1beta4.SqlSslCertsListRequest; + + /** + * Encodes the specified SqlSslCertsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsListRequest.verify|verify} messages. + * @param message SqlSslCertsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlSslCertsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlSslCertsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsListRequest.verify|verify} messages. + * @param message SqlSslCertsListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlSslCertsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlSslCertsListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlSslCertsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlSslCertsListRequest; + + /** + * Decodes a SqlSslCertsListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlSslCertsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlSslCertsListRequest; + + /** + * Verifies a SqlSslCertsListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlSslCertsListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlSslCertsListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlSslCertsListRequest; + + /** + * Creates a plain object from a SqlSslCertsListRequest message. Also converts values to other types if specified. + * @param message SqlSslCertsListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlSslCertsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlSslCertsListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlSslCertsListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesGetDiskShrinkConfigRequest. */ + interface ISqlInstancesGetDiskShrinkConfigRequest { + + /** SqlInstancesGetDiskShrinkConfigRequest instance */ + instance?: (string|null); + + /** SqlInstancesGetDiskShrinkConfigRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesGetDiskShrinkConfigRequest. */ + class SqlInstancesGetDiskShrinkConfigRequest implements ISqlInstancesGetDiskShrinkConfigRequest { + + /** + * Constructs a new SqlInstancesGetDiskShrinkConfigRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest); + + /** SqlInstancesGetDiskShrinkConfigRequest instance. */ + public instance: string; + + /** SqlInstancesGetDiskShrinkConfigRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesGetDiskShrinkConfigRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesGetDiskShrinkConfigRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. + * @param message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. + * @param message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesGetDiskShrinkConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesGetDiskShrinkConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest; + + /** + * Verifies a SqlInstancesGetDiskShrinkConfigRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesGetDiskShrinkConfigRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesGetDiskShrinkConfigRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest; + + /** + * Creates a plain object from a SqlInstancesGetDiskShrinkConfigRequest message. Also converts values to other types if specified. + * @param message SqlInstancesGetDiskShrinkConfigRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesGetDiskShrinkConfigRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesGetDiskShrinkConfigRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesGetLatestRecoveryTimeRequest. */ + interface ISqlInstancesGetLatestRecoveryTimeRequest { + + /** SqlInstancesGetLatestRecoveryTimeRequest instance */ + instance?: (string|null); + + /** SqlInstancesGetLatestRecoveryTimeRequest project */ + project?: (string|null); + + /** SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime */ + sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a SqlInstancesGetLatestRecoveryTimeRequest. */ + class SqlInstancesGetLatestRecoveryTimeRequest implements ISqlInstancesGetLatestRecoveryTimeRequest { + + /** + * Constructs a new SqlInstancesGetLatestRecoveryTimeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest); + + /** SqlInstancesGetLatestRecoveryTimeRequest instance. */ + public instance: string; + + /** SqlInstancesGetLatestRecoveryTimeRequest project. */ + public project: string; + + /** SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime. */ + public sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new SqlInstancesGetLatestRecoveryTimeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesGetLatestRecoveryTimeRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. + * @param message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. + * @param message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesGetLatestRecoveryTimeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesGetLatestRecoveryTimeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest; + + /** + * Verifies a SqlInstancesGetLatestRecoveryTimeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesGetLatestRecoveryTimeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesGetLatestRecoveryTimeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest; + + /** + * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeRequest message. Also converts values to other types if specified. + * @param message SqlInstancesGetLatestRecoveryTimeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesGetLatestRecoveryTimeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesGetLatestRecoveryTimeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesGetLatestRecoveryTimeResponse. */ + interface ISqlInstancesGetLatestRecoveryTimeResponse { + + /** SqlInstancesGetLatestRecoveryTimeResponse kind */ + kind?: (string|null); + + /** SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime */ + latestRecoveryTime?: (google.protobuf.ITimestamp|null); + + /** SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime */ + earliestRecoveryTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a SqlInstancesGetLatestRecoveryTimeResponse. */ + class SqlInstancesGetLatestRecoveryTimeResponse implements ISqlInstancesGetLatestRecoveryTimeResponse { + + /** + * Constructs a new SqlInstancesGetLatestRecoveryTimeResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse); + + /** SqlInstancesGetLatestRecoveryTimeResponse kind. */ + public kind: string; + + /** SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime. */ + public latestRecoveryTime?: (google.protobuf.ITimestamp|null); + + /** SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime. */ + public earliestRecoveryTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new SqlInstancesGetLatestRecoveryTimeResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesGetLatestRecoveryTimeResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. + * @param message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. + * @param message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesGetLatestRecoveryTimeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesGetLatestRecoveryTimeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse; + + /** + * Verifies a SqlInstancesGetLatestRecoveryTimeResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesGetLatestRecoveryTimeResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesGetLatestRecoveryTimeResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse; + + /** + * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeResponse message. Also converts values to other types if specified. + * @param message SqlInstancesGetLatestRecoveryTimeResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesGetLatestRecoveryTimeResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesGetLatestRecoveryTimeResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesExecuteSqlRequest. */ + interface ISqlInstancesExecuteSqlRequest { + + /** SqlInstancesExecuteSqlRequest instance */ + instance?: (string|null); + + /** SqlInstancesExecuteSqlRequest project */ + project?: (string|null); + + /** SqlInstancesExecuteSqlRequest body */ + body?: (google.cloud.sql.v1beta4.IExecuteSqlPayload|null); + } + + /** Represents a SqlInstancesExecuteSqlRequest. */ + class SqlInstancesExecuteSqlRequest implements ISqlInstancesExecuteSqlRequest { + + /** + * Constructs a new SqlInstancesExecuteSqlRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest); + + /** SqlInstancesExecuteSqlRequest instance. */ + public instance: string; + + /** SqlInstancesExecuteSqlRequest project. */ + public project: string; + + /** SqlInstancesExecuteSqlRequest body. */ + public body?: (google.cloud.sql.v1beta4.IExecuteSqlPayload|null); + + /** + * Creates a new SqlInstancesExecuteSqlRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesExecuteSqlRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest; + + /** + * Encodes the specified SqlInstancesExecuteSqlRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest.verify|verify} messages. + * @param message SqlInstancesExecuteSqlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesExecuteSqlRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest.verify|verify} messages. + * @param message SqlInstancesExecuteSqlRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesExecuteSqlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest; + + /** + * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesExecuteSqlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest; + + /** + * Verifies a SqlInstancesExecuteSqlRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesExecuteSqlRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesExecuteSqlRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest; + + /** + * Creates a plain object from a SqlInstancesExecuteSqlRequest message. Also converts values to other types if specified. + * @param message SqlInstancesExecuteSqlRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesExecuteSqlRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesExecuteSqlRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesReleaseSsrsLeaseRequest. */ + interface ISqlInstancesReleaseSsrsLeaseRequest { + + /** SqlInstancesReleaseSsrsLeaseRequest instance */ + instance?: (string|null); + + /** SqlInstancesReleaseSsrsLeaseRequest project */ + project?: (string|null); + } + + /** Represents a SqlInstancesReleaseSsrsLeaseRequest. */ + class SqlInstancesReleaseSsrsLeaseRequest implements ISqlInstancesReleaseSsrsLeaseRequest { + + /** + * Constructs a new SqlInstancesReleaseSsrsLeaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest); + + /** SqlInstancesReleaseSsrsLeaseRequest instance. */ + public instance: string; + + /** SqlInstancesReleaseSsrsLeaseRequest project. */ + public project: string; + + /** + * Creates a new SqlInstancesReleaseSsrsLeaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesReleaseSsrsLeaseRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. + * @param message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. + * @param message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesReleaseSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesReleaseSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest; + + /** + * Verifies a SqlInstancesReleaseSsrsLeaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesReleaseSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesReleaseSsrsLeaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest; + + /** + * Creates a plain object from a SqlInstancesReleaseSsrsLeaseRequest message. Also converts values to other types if specified. + * @param message SqlInstancesReleaseSsrsLeaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesReleaseSsrsLeaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesReleaseSsrsLeaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesReleaseSsrsLeaseResponse. */ + interface ISqlInstancesReleaseSsrsLeaseResponse { + + /** SqlInstancesReleaseSsrsLeaseResponse operationId */ + operationId?: (string|null); + } + + /** Represents a SqlInstancesReleaseSsrsLeaseResponse. */ + class SqlInstancesReleaseSsrsLeaseResponse implements ISqlInstancesReleaseSsrsLeaseResponse { + + /** + * Constructs a new SqlInstancesReleaseSsrsLeaseResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse); + + /** SqlInstancesReleaseSsrsLeaseResponse operationId. */ + public operationId: string; + + /** + * Creates a new SqlInstancesReleaseSsrsLeaseResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesReleaseSsrsLeaseResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. + * @param message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. + * @param message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesReleaseSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesReleaseSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse; + + /** + * Verifies a SqlInstancesReleaseSsrsLeaseResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesReleaseSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesReleaseSsrsLeaseResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse; + + /** + * Creates a plain object from a SqlInstancesReleaseSsrsLeaseResponse message. Also converts values to other types if specified. + * @param message SqlInstancesReleaseSsrsLeaseResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesReleaseSsrsLeaseResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesReleaseSsrsLeaseResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ExecuteSqlPayload. */ + interface IExecuteSqlPayload { + + /** ExecuteSqlPayload user */ + user?: (string|null); + + /** ExecuteSqlPayload sqlStatement */ + sqlStatement?: (string|null); + + /** ExecuteSqlPayload database */ + database?: (string|null); + + /** ExecuteSqlPayload autoIamAuthn */ + autoIamAuthn?: (boolean|null); + + /** ExecuteSqlPayload rowLimit */ + rowLimit?: (number|Long|string|null); + + /** ExecuteSqlPayload partialResultMode */ + partialResultMode?: (google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode|keyof typeof google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode|null); + + /** ExecuteSqlPayload application */ + application?: (string|null); + } + + /** Represents an ExecuteSqlPayload. */ + class ExecuteSqlPayload implements IExecuteSqlPayload { + + /** + * Constructs a new ExecuteSqlPayload. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IExecuteSqlPayload); + + /** ExecuteSqlPayload user. */ + public user: string; + + /** ExecuteSqlPayload sqlStatement. */ + public sqlStatement: string; + + /** ExecuteSqlPayload database. */ + public database: string; + + /** ExecuteSqlPayload autoIamAuthn. */ + public autoIamAuthn?: (boolean|null); + + /** ExecuteSqlPayload rowLimit. */ + public rowLimit: (number|Long|string); + + /** ExecuteSqlPayload partialResultMode. */ + public partialResultMode: (google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode|keyof typeof google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode); + + /** ExecuteSqlPayload application. */ + public application: string; + + /** ExecuteSqlPayload userPassword. */ + public userPassword?: "autoIamAuthn"; + + /** + * Creates a new ExecuteSqlPayload instance using the specified properties. + * @param [properties] Properties to set + * @returns ExecuteSqlPayload instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IExecuteSqlPayload): google.cloud.sql.v1beta4.ExecuteSqlPayload; + + /** + * Encodes the specified ExecuteSqlPayload message. Does not implicitly {@link google.cloud.sql.v1beta4.ExecuteSqlPayload.verify|verify} messages. + * @param message ExecuteSqlPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IExecuteSqlPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExecuteSqlPayload message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExecuteSqlPayload.verify|verify} messages. + * @param message ExecuteSqlPayload message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IExecuteSqlPayload, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExecuteSqlPayload message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExecuteSqlPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExecuteSqlPayload; + + /** + * Decodes an ExecuteSqlPayload message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExecuteSqlPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExecuteSqlPayload; + + /** + * Verifies an ExecuteSqlPayload message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExecuteSqlPayload message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExecuteSqlPayload + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExecuteSqlPayload; + + /** + * Creates a plain object from an ExecuteSqlPayload message. Also converts values to other types if specified. + * @param message ExecuteSqlPayload + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ExecuteSqlPayload, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExecuteSqlPayload to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExecuteSqlPayload + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ExecuteSqlPayload { + + /** PartialResultMode enum. */ + enum PartialResultMode { + PARTIAL_RESULT_MODE_UNSPECIFIED = 0, + FAIL_PARTIAL_RESULT = 1, + ALLOW_PARTIAL_RESULT = 2 + } + } + + /** Properties of a SqlInstancesExecuteSqlResponse. */ + interface ISqlInstancesExecuteSqlResponse { + + /** SqlInstancesExecuteSqlResponse messages */ + messages?: (google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage[]|null); + + /** SqlInstancesExecuteSqlResponse metadata */ + metadata?: (google.cloud.sql.v1beta4.IMetadata|null); + + /** SqlInstancesExecuteSqlResponse results */ + results?: (google.cloud.sql.v1beta4.IQueryResult[]|null); + + /** SqlInstancesExecuteSqlResponse status */ + status?: (google.rpc.IStatus|null); + } + + /** Represents a SqlInstancesExecuteSqlResponse. */ + class SqlInstancesExecuteSqlResponse implements ISqlInstancesExecuteSqlResponse { + + /** + * Constructs a new SqlInstancesExecuteSqlResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse); + + /** SqlInstancesExecuteSqlResponse messages. */ + public messages: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage[]; + + /** SqlInstancesExecuteSqlResponse metadata. */ + public metadata?: (google.cloud.sql.v1beta4.IMetadata|null); + + /** SqlInstancesExecuteSqlResponse results. */ + public results: google.cloud.sql.v1beta4.IQueryResult[]; + + /** SqlInstancesExecuteSqlResponse status. */ + public status?: (google.rpc.IStatus|null); + + /** + * Creates a new SqlInstancesExecuteSqlResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesExecuteSqlResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse; + + /** + * Encodes the specified SqlInstancesExecuteSqlResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.verify|verify} messages. + * @param message SqlInstancesExecuteSqlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesExecuteSqlResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.verify|verify} messages. + * @param message SqlInstancesExecuteSqlResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesExecuteSqlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse; + + /** + * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesExecuteSqlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse; + + /** + * Verifies a SqlInstancesExecuteSqlResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesExecuteSqlResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesExecuteSqlResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse; + + /** + * Creates a plain object from a SqlInstancesExecuteSqlResponse message. Also converts values to other types if specified. + * @param message SqlInstancesExecuteSqlResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesExecuteSqlResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesExecuteSqlResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlInstancesExecuteSqlResponse { + + /** Properties of a Message. */ + interface IMessage { + + /** Message message */ + message?: (string|null); + + /** Message severity */ + severity?: (string|null); + } + + /** Represents a Message. */ + class Message implements IMessage { + + /** + * Constructs a new Message. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage); + + /** Message message. */ + public message?: (string|null); + + /** Message severity. */ + public severity?: (string|null); + + /** + * Creates a new Message instance using the specified properties. + * @param [properties] Properties to set + * @returns Message instance + */ + public static create(properties?: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. + * @param message Message message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Message message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message; + + /** + * Verifies a Message message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Message + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @param message Message + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Message to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Message + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a QueryResult. */ + interface IQueryResult { + + /** QueryResult columns */ + columns?: (google.cloud.sql.v1beta4.IColumn[]|null); + + /** QueryResult rows */ + rows?: (google.cloud.sql.v1beta4.IRow[]|null); + + /** QueryResult message */ + message?: (string|null); + + /** QueryResult partialResult */ + partialResult?: (boolean|null); + + /** QueryResult status */ + status?: (google.rpc.IStatus|null); + } + + /** Represents a QueryResult. */ + class QueryResult implements IQueryResult { + + /** + * Constructs a new QueryResult. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IQueryResult); + + /** QueryResult columns. */ + public columns: google.cloud.sql.v1beta4.IColumn[]; + + /** QueryResult rows. */ + public rows: google.cloud.sql.v1beta4.IRow[]; + + /** QueryResult message. */ + public message: string; + + /** QueryResult partialResult. */ + public partialResult: boolean; + + /** QueryResult status. */ + public status?: (google.rpc.IStatus|null); + + /** + * Creates a new QueryResult instance using the specified properties. + * @param [properties] Properties to set + * @returns QueryResult instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IQueryResult): google.cloud.sql.v1beta4.QueryResult; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.sql.v1beta4.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.QueryResult.verify|verify} messages. + * @param message QueryResult message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.QueryResult; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.QueryResult; + + /** + * Verifies a QueryResult message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns QueryResult + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.QueryResult; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @param message QueryResult + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.QueryResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this QueryResult to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for QueryResult + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Column. */ + interface IColumn { + + /** Column name */ + name?: (string|null); + + /** Column type */ + type?: (string|null); + } + + /** Represents a Column. */ + class Column implements IColumn { + + /** + * Constructs a new Column. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IColumn); + + /** Column name. */ + public name: string; + + /** Column type. */ + public type: string; + + /** + * Creates a new Column instance using the specified properties. + * @param [properties] Properties to set + * @returns Column instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IColumn): google.cloud.sql.v1beta4.Column; + + /** + * Encodes the specified Column message. Does not implicitly {@link google.cloud.sql.v1beta4.Column.verify|verify} messages. + * @param message Column message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IColumn, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Column message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Column.verify|verify} messages. + * @param message Column message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IColumn, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Column message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Column + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Column; + + /** + * Decodes a Column message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Column + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Column; + + /** + * Verifies a Column message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Column message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Column + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Column; + + /** + * Creates a plain object from a Column message. Also converts values to other types if specified. + * @param message Column + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.Column, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Column to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Column + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Row. */ + interface IRow { + + /** Row values */ + values?: (google.cloud.sql.v1beta4.IValue[]|null); + } + + /** Represents a Row. */ + class Row implements IRow { + + /** + * Constructs a new Row. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IRow); + + /** Row values. */ + public values: google.cloud.sql.v1beta4.IValue[]; + + /** + * Creates a new Row instance using the specified properties. + * @param [properties] Properties to set + * @returns Row instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IRow): google.cloud.sql.v1beta4.Row; + + /** + * Encodes the specified Row message. Does not implicitly {@link google.cloud.sql.v1beta4.Row.verify|verify} messages. + * @param message Row message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Row message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Row.verify|verify} messages. + * @param message Row message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IRow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Row message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Row; + + /** + * Decodes a Row message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Row; + + /** + * Verifies a Row message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Row message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Row + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Row; + + /** + * Creates a plain object from a Row message. Also converts values to other types if specified. + * @param message Row + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.Row, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Row to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Row + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Value. */ + interface IValue { + + /** Value value */ + value?: (string|null); + + /** Value nullValue */ + nullValue?: (boolean|null); + } + + /** Represents a Value. */ + class Value implements IValue { + + /** + * Constructs a new Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IValue); + + /** Value value. */ + public value: string; + + /** Value nullValue. */ + public nullValue: boolean; + + /** + * Creates a new Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Value instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IValue): google.cloud.sql.v1beta4.Value; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.cloud.sql.v1beta4.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Value.verify|verify} messages. + * @param message Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Value; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Value; + + /** + * Verifies a Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Value + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Value; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @param message Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Metadata. */ + interface IMetadata { + + /** Metadata sqlStatementExecutionTime */ + sqlStatementExecutionTime?: (google.protobuf.IDuration|null); + } + + /** Represents a Metadata. */ + class Metadata implements IMetadata { + + /** + * Constructs a new Metadata. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IMetadata); + + /** Metadata sqlStatementExecutionTime. */ + public sqlStatementExecutionTime?: (google.protobuf.IDuration|null); + + /** + * Creates a new Metadata instance using the specified properties. + * @param [properties] Properties to set + * @returns Metadata instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IMetadata): google.cloud.sql.v1beta4.Metadata; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.sql.v1beta4.Metadata.verify|verify} messages. + * @param message Metadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Metadata.verify|verify} messages. + * @param message Metadata message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Metadata; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Metadata; + + /** + * Verifies a Metadata message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Metadata + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Metadata; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @param message Metadata + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.Metadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Metadata to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Metadata + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesAcquireSsrsLeaseRequest. */ + interface ISqlInstancesAcquireSsrsLeaseRequest { + + /** SqlInstancesAcquireSsrsLeaseRequest instance */ + instance?: (string|null); + + /** SqlInstancesAcquireSsrsLeaseRequest project */ + project?: (string|null); + + /** SqlInstancesAcquireSsrsLeaseRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest|null); + } + + /** Represents a SqlInstancesAcquireSsrsLeaseRequest. */ + class SqlInstancesAcquireSsrsLeaseRequest implements ISqlInstancesAcquireSsrsLeaseRequest { + + /** + * Constructs a new SqlInstancesAcquireSsrsLeaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest); + + /** SqlInstancesAcquireSsrsLeaseRequest instance. */ + public instance: string; + + /** SqlInstancesAcquireSsrsLeaseRequest project. */ + public project: string; + + /** SqlInstancesAcquireSsrsLeaseRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest|null); + + /** + * Creates a new SqlInstancesAcquireSsrsLeaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesAcquireSsrsLeaseRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @param message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @param message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest; + + /** + * Verifies a SqlInstancesAcquireSsrsLeaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesAcquireSsrsLeaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest; + + /** + * Creates a plain object from a SqlInstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. + * @param message SqlInstancesAcquireSsrsLeaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesAcquireSsrsLeaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesAcquireSsrsLeaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesPreCheckMajorVersionUpgradeRequest. */ + interface ISqlInstancesPreCheckMajorVersionUpgradeRequest { + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest instance */ + instance?: (string|null); + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest project */ + project?: (string|null); + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest body */ + body?: (google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest|null); + } + + /** Represents a SqlInstancesPreCheckMajorVersionUpgradeRequest. */ + class SqlInstancesPreCheckMajorVersionUpgradeRequest implements ISqlInstancesPreCheckMajorVersionUpgradeRequest { + + /** + * Constructs a new SqlInstancesPreCheckMajorVersionUpgradeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest); + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest instance. */ + public instance: string; + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest project. */ + public project: string; + + /** SqlInstancesPreCheckMajorVersionUpgradeRequest body. */ + public body?: (google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest|null); + + /** + * Creates a new SqlInstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest): google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Verifies a SqlInstancesPreCheckMajorVersionUpgradeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Creates a plain object from a SqlInstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. + * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesPreCheckMajorVersionUpgradeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesPreCheckMajorVersionUpgradeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesAcquireSsrsLeaseResponse. */ + interface ISqlInstancesAcquireSsrsLeaseResponse { + + /** SqlInstancesAcquireSsrsLeaseResponse operationId */ + operationId?: (string|null); + } + + /** Represents a SqlInstancesAcquireSsrsLeaseResponse. */ + class SqlInstancesAcquireSsrsLeaseResponse implements ISqlInstancesAcquireSsrsLeaseResponse { + + /** + * Constructs a new SqlInstancesAcquireSsrsLeaseResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse); + + /** SqlInstancesAcquireSsrsLeaseResponse operationId. */ + public operationId?: (string|null); + + /** + * Creates a new SqlInstancesAcquireSsrsLeaseResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesAcquireSsrsLeaseResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. + * @param message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. + * @param message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesAcquireSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesAcquireSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse; + + /** + * Verifies a SqlInstancesAcquireSsrsLeaseResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesAcquireSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesAcquireSsrsLeaseResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse; + + /** + * Creates a plain object from a SqlInstancesAcquireSsrsLeaseResponse message. Also converts values to other types if specified. + * @param message SqlInstancesAcquireSsrsLeaseResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesAcquireSsrsLeaseResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesAcquireSsrsLeaseResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesPointInTimeRestoreRequest. */ + interface ISqlInstancesPointInTimeRestoreRequest { + + /** SqlInstancesPointInTimeRestoreRequest parent */ + parent?: (string|null); + + /** SqlInstancesPointInTimeRestoreRequest context */ + context?: (google.cloud.sql.v1beta4.IPointInTimeRestoreContext|null); + } + + /** Represents a SqlInstancesPointInTimeRestoreRequest. */ + class SqlInstancesPointInTimeRestoreRequest implements ISqlInstancesPointInTimeRestoreRequest { + + /** + * Constructs a new SqlInstancesPointInTimeRestoreRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest); + + /** SqlInstancesPointInTimeRestoreRequest parent. */ + public parent: string; + + /** SqlInstancesPointInTimeRestoreRequest context. */ + public context?: (google.cloud.sql.v1beta4.IPointInTimeRestoreContext|null); + + /** + * Creates a new SqlInstancesPointInTimeRestoreRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesPointInTimeRestoreRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest): google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest; + + /** + * Encodes the specified SqlInstancesPointInTimeRestoreRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. + * @param message SqlInstancesPointInTimeRestoreRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesPointInTimeRestoreRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. + * @param message SqlInstancesPointInTimeRestoreRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesPointInTimeRestoreRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest; + + /** + * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesPointInTimeRestoreRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest; + + /** + * Verifies a SqlInstancesPointInTimeRestoreRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesPointInTimeRestoreRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesPointInTimeRestoreRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest; + + /** + * Creates a plain object from a SqlInstancesPointInTimeRestoreRequest message. Also converts values to other types if specified. + * @param message SqlInstancesPointInTimeRestoreRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesPointInTimeRestoreRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesPointInTimeRestoreRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AclEntry. */ + interface IAclEntry { + + /** AclEntry value */ + value?: (string|null); + + /** AclEntry expirationTime */ + expirationTime?: (google.protobuf.ITimestamp|null); + + /** AclEntry name */ + name?: (string|null); + + /** AclEntry kind */ + kind?: (string|null); + } + + /** Represents an AclEntry. */ + class AclEntry implements IAclEntry { + + /** + * Constructs a new AclEntry. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IAclEntry); + + /** AclEntry value. */ + public value: string; + + /** AclEntry expirationTime. */ + public expirationTime?: (google.protobuf.ITimestamp|null); + + /** AclEntry name. */ + public name: string; + + /** AclEntry kind. */ + public kind: string; + + /** + * Creates a new AclEntry instance using the specified properties. + * @param [properties] Properties to set + * @returns AclEntry instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IAclEntry): google.cloud.sql.v1beta4.AclEntry; + + /** + * Encodes the specified AclEntry message. Does not implicitly {@link google.cloud.sql.v1beta4.AclEntry.verify|verify} messages. + * @param message AclEntry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IAclEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AclEntry message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AclEntry.verify|verify} messages. + * @param message AclEntry message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IAclEntry, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AclEntry message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AclEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.AclEntry; + + /** + * Decodes an AclEntry message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AclEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.AclEntry; + + /** + * Verifies an AclEntry message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AclEntry message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AclEntry + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.AclEntry; + + /** + * Creates a plain object from an AclEntry message. Also converts values to other types if specified. + * @param message AclEntry + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.AclEntry, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AclEntry to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AclEntry + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ApiWarning. */ + interface IApiWarning { + + /** ApiWarning code */ + code?: (google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode|keyof typeof google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode|null); + + /** ApiWarning message */ + message?: (string|null); + + /** ApiWarning region */ + region?: (string|null); + } + + /** Represents an ApiWarning. */ + class ApiWarning implements IApiWarning { + + /** + * Constructs a new ApiWarning. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IApiWarning); + + /** ApiWarning code. */ + public code: (google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode|keyof typeof google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode); + + /** ApiWarning message. */ + public message: string; + + /** ApiWarning region. */ + public region: string; + + /** + * Creates a new ApiWarning instance using the specified properties. + * @param [properties] Properties to set + * @returns ApiWarning instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IApiWarning): google.cloud.sql.v1beta4.ApiWarning; + + /** + * Encodes the specified ApiWarning message. Does not implicitly {@link google.cloud.sql.v1beta4.ApiWarning.verify|verify} messages. + * @param message ApiWarning message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IApiWarning, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ApiWarning message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ApiWarning.verify|verify} messages. + * @param message ApiWarning message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IApiWarning, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ApiWarning message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ApiWarning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ApiWarning; + + /** + * Decodes an ApiWarning message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ApiWarning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ApiWarning; + + /** + * Verifies an ApiWarning message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ApiWarning message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ApiWarning + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ApiWarning; + + /** + * Creates a plain object from an ApiWarning message. Also converts values to other types if specified. + * @param message ApiWarning + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ApiWarning, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ApiWarning to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ApiWarning + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ApiWarning { + + /** SqlApiWarningCode enum. */ + enum SqlApiWarningCode { + SQL_API_WARNING_CODE_UNSPECIFIED = 0, + REGION_UNREACHABLE = 1, + MAX_RESULTS_EXCEEDS_LIMIT = 2, + COMPROMISED_CREDENTIALS = 3, + INTERNAL_STATE_FAILURE = 4 + } + } + + /** Properties of a BackupRetentionSettings. */ + interface IBackupRetentionSettings { + + /** BackupRetentionSettings retentionUnit */ + retentionUnit?: (google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit|keyof typeof google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit|null); + + /** BackupRetentionSettings retainedBackups */ + retainedBackups?: (google.protobuf.IInt32Value|null); + } + + /** Represents a BackupRetentionSettings. */ + class BackupRetentionSettings implements IBackupRetentionSettings { + + /** + * Constructs a new BackupRetentionSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IBackupRetentionSettings); + + /** BackupRetentionSettings retentionUnit. */ + public retentionUnit: (google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit|keyof typeof google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit); + + /** BackupRetentionSettings retainedBackups. */ + public retainedBackups?: (google.protobuf.IInt32Value|null); + + /** + * Creates a new BackupRetentionSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupRetentionSettings instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IBackupRetentionSettings): google.cloud.sql.v1beta4.BackupRetentionSettings; + + /** + * Encodes the specified BackupRetentionSettings message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRetentionSettings.verify|verify} messages. + * @param message BackupRetentionSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IBackupRetentionSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupRetentionSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRetentionSettings.verify|verify} messages. + * @param message BackupRetentionSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupRetentionSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupRetentionSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupRetentionSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupRetentionSettings; + + /** + * Decodes a BackupRetentionSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupRetentionSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupRetentionSettings; + + /** + * Verifies a BackupRetentionSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupRetentionSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupRetentionSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupRetentionSettings; + + /** + * Creates a plain object from a BackupRetentionSettings message. Also converts values to other types if specified. + * @param message BackupRetentionSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.BackupRetentionSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupRetentionSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupRetentionSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BackupRetentionSettings { + + /** RetentionUnit enum. */ + enum RetentionUnit { + RETENTION_UNIT_UNSPECIFIED = 0, + COUNT = 1 + } + } + + /** Properties of a BackupConfiguration. */ + interface IBackupConfiguration { + + /** BackupConfiguration startTime */ + startTime?: (string|null); + + /** BackupConfiguration enabled */ + enabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration kind */ + kind?: (string|null); + + /** BackupConfiguration binaryLogEnabled */ + binaryLogEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration replicationLogArchivingEnabled */ + replicationLogArchivingEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration location */ + location?: (string|null); + + /** BackupConfiguration pointInTimeRecoveryEnabled */ + pointInTimeRecoveryEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration transactionLogRetentionDays */ + transactionLogRetentionDays?: (google.protobuf.IInt32Value|null); + + /** BackupConfiguration backupRetentionSettings */ + backupRetentionSettings?: (google.cloud.sql.v1beta4.IBackupRetentionSettings|null); + + /** BackupConfiguration transactionalLogStorageState */ + transactionalLogStorageState?: (google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|keyof typeof google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|null); + + /** BackupConfiguration backupTier */ + backupTier?: (google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|keyof typeof google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|null); + } + + /** Represents a BackupConfiguration. */ + class BackupConfiguration implements IBackupConfiguration { + + /** + * Constructs a new BackupConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IBackupConfiguration); + + /** BackupConfiguration startTime. */ + public startTime: string; + + /** BackupConfiguration enabled. */ + public enabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration kind. */ + public kind: string; + + /** BackupConfiguration binaryLogEnabled. */ + public binaryLogEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration replicationLogArchivingEnabled. */ + public replicationLogArchivingEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration location. */ + public location: string; + + /** BackupConfiguration pointInTimeRecoveryEnabled. */ + public pointInTimeRecoveryEnabled?: (google.protobuf.IBoolValue|null); + + /** BackupConfiguration transactionLogRetentionDays. */ + public transactionLogRetentionDays?: (google.protobuf.IInt32Value|null); + + /** BackupConfiguration backupRetentionSettings. */ + public backupRetentionSettings?: (google.cloud.sql.v1beta4.IBackupRetentionSettings|null); + + /** BackupConfiguration transactionalLogStorageState. */ + public transactionalLogStorageState?: (google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|keyof typeof google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|null); + + /** BackupConfiguration backupTier. */ + public backupTier?: (google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|keyof typeof google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|null); + + /** + * Creates a new BackupConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IBackupConfiguration): google.cloud.sql.v1beta4.BackupConfiguration; + + /** + * Encodes the specified BackupConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupConfiguration.verify|verify} messages. + * @param message BackupConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IBackupConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupConfiguration.verify|verify} messages. + * @param message BackupConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupConfiguration; + + /** + * Decodes a BackupConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupConfiguration; + + /** + * Verifies a BackupConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupConfiguration; + + /** + * Creates a plain object from a BackupConfiguration message. Also converts values to other types if specified. + * @param message BackupConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.BackupConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace BackupConfiguration { + + /** TransactionalLogStorageState enum. */ + enum TransactionalLogStorageState { + TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED = 0, + DISK = 1, + SWITCHING_TO_CLOUD_STORAGE = 2, + SWITCHED_TO_CLOUD_STORAGE = 3, + CLOUD_STORAGE = 4 + } + + /** BackupTier enum. */ + enum BackupTier { + BACKUP_TIER_UNSPECIFIED = 0, + STANDARD = 1, + ADVANCED = 2, + ENHANCED = 3 + } + } + + /** Properties of a BackupRun. */ + interface IBackupRun { + + /** BackupRun kind */ + kind?: (string|null); + + /** BackupRun status */ + status?: (google.cloud.sql.v1beta4.SqlBackupRunStatus|keyof typeof google.cloud.sql.v1beta4.SqlBackupRunStatus|null); + + /** BackupRun enqueuedTime */ + enqueuedTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun id */ + id?: (number|Long|string|null); + + /** BackupRun startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun error */ + error?: (google.cloud.sql.v1beta4.IOperationError|null); + + /** BackupRun type */ + type?: (google.cloud.sql.v1beta4.SqlBackupRunType|keyof typeof google.cloud.sql.v1beta4.SqlBackupRunType|null); + + /** BackupRun description */ + description?: (string|null); + + /** BackupRun windowStartTime */ + windowStartTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun instance */ + instance?: (string|null); + + /** BackupRun selfLink */ + selfLink?: (string|null); + + /** BackupRun location */ + location?: (string|null); + + /** BackupRun databaseVersion */ + databaseVersion?: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion|null); + + /** BackupRun diskEncryptionConfiguration */ + diskEncryptionConfiguration?: (google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null); + + /** BackupRun diskEncryptionStatus */ + diskEncryptionStatus?: (google.cloud.sql.v1beta4.IDiskEncryptionStatus|null); + + /** BackupRun backupKind */ + backupKind?: (google.cloud.sql.v1beta4.SqlBackupKind|keyof typeof google.cloud.sql.v1beta4.SqlBackupKind|null); + + /** BackupRun timeZone */ + timeZone?: (string|null); + + /** BackupRun maxChargeableBytes */ + maxChargeableBytes?: (number|Long|string|null); + } + + /** Represents a BackupRun. */ + class BackupRun implements IBackupRun { + + /** + * Constructs a new BackupRun. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IBackupRun); + + /** BackupRun kind. */ + public kind: string; + + /** BackupRun status. */ + public status: (google.cloud.sql.v1beta4.SqlBackupRunStatus|keyof typeof google.cloud.sql.v1beta4.SqlBackupRunStatus); + + /** BackupRun enqueuedTime. */ + public enqueuedTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun id. */ + public id: (number|Long|string); + + /** BackupRun startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun error. */ + public error?: (google.cloud.sql.v1beta4.IOperationError|null); + + /** BackupRun type. */ + public type: (google.cloud.sql.v1beta4.SqlBackupRunType|keyof typeof google.cloud.sql.v1beta4.SqlBackupRunType); + + /** BackupRun description. */ + public description: string; + + /** BackupRun windowStartTime. */ + public windowStartTime?: (google.protobuf.ITimestamp|null); + + /** BackupRun instance. */ + public instance: string; + + /** BackupRun selfLink. */ + public selfLink: string; + + /** BackupRun location. */ + public location: string; + + /** BackupRun databaseVersion. */ + public databaseVersion: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion); + + /** BackupRun diskEncryptionConfiguration. */ + public diskEncryptionConfiguration?: (google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null); + + /** BackupRun diskEncryptionStatus. */ + public diskEncryptionStatus?: (google.cloud.sql.v1beta4.IDiskEncryptionStatus|null); + + /** BackupRun backupKind. */ + public backupKind: (google.cloud.sql.v1beta4.SqlBackupKind|keyof typeof google.cloud.sql.v1beta4.SqlBackupKind); + + /** BackupRun timeZone. */ + public timeZone: string; + + /** BackupRun maxChargeableBytes. */ + public maxChargeableBytes?: (number|Long|string|null); + + /** + * Creates a new BackupRun instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupRun instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IBackupRun): google.cloud.sql.v1beta4.BackupRun; + + /** + * Encodes the specified BackupRun message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRun.verify|verify} messages. + * @param message BackupRun message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IBackupRun, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupRun message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRun.verify|verify} messages. + * @param message BackupRun message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupRun, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupRun message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupRun + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupRun; + + /** + * Decodes a BackupRun message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupRun + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupRun; + + /** + * Verifies a BackupRun message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupRun message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupRun + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupRun; + + /** + * Creates a plain object from a BackupRun message. Also converts values to other types if specified. + * @param message BackupRun + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.BackupRun, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupRun to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupRun + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Backup. */ + interface IBackup { + + /** Backup name */ + name?: (string|null); + + /** Backup kind */ + kind?: (string|null); + + /** Backup selfLink */ + selfLink?: (string|null); + + /** Backup type */ + type?: (google.cloud.sql.v1beta4.Backup.SqlBackupType|keyof typeof google.cloud.sql.v1beta4.Backup.SqlBackupType|null); + + /** Backup description */ + description?: (string|null); + + /** Backup instance */ + instance?: (string|null); + + /** Backup location */ + location?: (string|null); + + /** Backup backupInterval */ + backupInterval?: (google.type.IInterval|null); + + /** Backup state */ + state?: (google.cloud.sql.v1beta4.Backup.SqlBackupState|keyof typeof google.cloud.sql.v1beta4.Backup.SqlBackupState|null); + + /** Backup error */ + error?: (google.cloud.sql.v1beta4.IOperationError|null); + + /** Backup kmsKey */ + kmsKey?: (string|null); + + /** Backup kmsKeyVersion */ + kmsKeyVersion?: (string|null); + + /** Backup backupKind */ + backupKind?: (google.cloud.sql.v1beta4.SqlBackupKind|keyof typeof google.cloud.sql.v1beta4.SqlBackupKind|null); + + /** Backup timeZone */ + timeZone?: (string|null); + + /** Backup ttlDays */ + ttlDays?: (number|Long|string|null); + + /** Backup expiryTime */ + expiryTime?: (google.protobuf.ITimestamp|null); + + /** Backup databaseVersion */ + databaseVersion?: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion|null); + + /** Backup maxChargeableBytes */ + maxChargeableBytes?: (number|Long|string|null); + + /** Backup instanceDeletionTime */ + instanceDeletionTime?: (google.protobuf.ITimestamp|null); + + /** Backup instanceSettings */ + instanceSettings?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); + + /** Backup backupRun */ + backupRun?: (string|null); + + /** Backup satisfiesPzs */ + satisfiesPzs?: (google.protobuf.IBoolValue|null); + + /** Backup satisfiesPzi */ + satisfiesPzi?: (google.protobuf.IBoolValue|null); + } + + /** Represents a Backup. */ + class Backup implements IBackup { + + /** + * Constructs a new Backup. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IBackup); + + /** Backup name. */ + public name: string; + + /** Backup kind. */ + public kind: string; + + /** Backup selfLink. */ + public selfLink: string; + + /** Backup type. */ + public type: (google.cloud.sql.v1beta4.Backup.SqlBackupType|keyof typeof google.cloud.sql.v1beta4.Backup.SqlBackupType); + + /** Backup description. */ + public description: string; + + /** Backup instance. */ + public instance: string; + + /** Backup location. */ + public location: string; + + /** Backup backupInterval. */ + public backupInterval?: (google.type.IInterval|null); + + /** Backup state. */ + public state: (google.cloud.sql.v1beta4.Backup.SqlBackupState|keyof typeof google.cloud.sql.v1beta4.Backup.SqlBackupState); + + /** Backup error. */ + public error?: (google.cloud.sql.v1beta4.IOperationError|null); + + /** Backup kmsKey. */ + public kmsKey: string; + + /** Backup kmsKeyVersion. */ + public kmsKeyVersion: string; + + /** Backup backupKind. */ + public backupKind: (google.cloud.sql.v1beta4.SqlBackupKind|keyof typeof google.cloud.sql.v1beta4.SqlBackupKind); + + /** Backup timeZone. */ + public timeZone: string; + + /** Backup ttlDays. */ + public ttlDays?: (number|Long|string|null); + + /** Backup expiryTime. */ + public expiryTime?: (google.protobuf.ITimestamp|null); + + /** Backup databaseVersion. */ + public databaseVersion: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion); + + /** Backup maxChargeableBytes. */ + public maxChargeableBytes?: (number|Long|string|null); + + /** Backup instanceDeletionTime. */ + public instanceDeletionTime?: (google.protobuf.ITimestamp|null); + + /** Backup instanceSettings. */ + public instanceSettings?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); + + /** Backup backupRun. */ + public backupRun: string; + + /** Backup satisfiesPzs. */ + public satisfiesPzs?: (google.protobuf.IBoolValue|null); + + /** Backup satisfiesPzi. */ + public satisfiesPzi?: (google.protobuf.IBoolValue|null); + + /** Backup expiration. */ + public expiration?: ("ttlDays"|"expiryTime"); + + /** + * Creates a new Backup instance using the specified properties. + * @param [properties] Properties to set + * @returns Backup instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IBackup): google.cloud.sql.v1beta4.Backup; + + /** + * Encodes the specified Backup message. Does not implicitly {@link google.cloud.sql.v1beta4.Backup.verify|verify} messages. + * @param message Backup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IBackup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Backup message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Backup.verify|verify} messages. + * @param message Backup message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackup, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Backup message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Backup; + + /** + * Decodes a Backup message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Backup; + + /** + * Verifies a Backup message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Backup message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Backup + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Backup; + + /** + * Creates a plain object from a Backup message. Also converts values to other types if specified. + * @param message Backup + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.Backup, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Backup to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Backup + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Backup { + + /** SqlBackupType enum. */ + enum SqlBackupType { + SQL_BACKUP_TYPE_UNSPECIFIED = 0, + AUTOMATED = 1, + ON_DEMAND = 2, + FINAL = 3 + } + + /** SqlBackupState enum. */ + enum SqlBackupState { + SQL_BACKUP_STATE_UNSPECIFIED = 0, + ENQUEUED = 1, + RUNNING = 2, + FAILED = 3, + SUCCESSFUL = 4, + DELETING = 5, + DELETION_FAILED = 6 + } + } + + /** Properties of a BackupRunsListResponse. */ + interface IBackupRunsListResponse { + + /** BackupRunsListResponse kind */ + kind?: (string|null); + + /** BackupRunsListResponse items */ + items?: (google.cloud.sql.v1beta4.IBackupRun[]|null); + + /** BackupRunsListResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a BackupRunsListResponse. */ + class BackupRunsListResponse implements IBackupRunsListResponse { + + /** + * Constructs a new BackupRunsListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IBackupRunsListResponse); + + /** BackupRunsListResponse kind. */ + public kind: string; + + /** BackupRunsListResponse items. */ + public items: google.cloud.sql.v1beta4.IBackupRun[]; + + /** BackupRunsListResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new BackupRunsListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupRunsListResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IBackupRunsListResponse): google.cloud.sql.v1beta4.BackupRunsListResponse; + + /** + * Encodes the specified BackupRunsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRunsListResponse.verify|verify} messages. + * @param message BackupRunsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IBackupRunsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupRunsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRunsListResponse.verify|verify} messages. + * @param message BackupRunsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupRunsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupRunsListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupRunsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupRunsListResponse; + + /** + * Decodes a BackupRunsListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupRunsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupRunsListResponse; + + /** + * Verifies a BackupRunsListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupRunsListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupRunsListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupRunsListResponse; + + /** + * Creates a plain object from a BackupRunsListResponse message. Also converts values to other types if specified. + * @param message BackupRunsListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.BackupRunsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupRunsListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupRunsListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BinLogCoordinates. */ + interface IBinLogCoordinates { + + /** BinLogCoordinates binLogFileName */ + binLogFileName?: (string|null); + + /** BinLogCoordinates binLogPosition */ + binLogPosition?: (number|Long|string|null); + + /** BinLogCoordinates kind */ + kind?: (string|null); + } + + /** Represents a BinLogCoordinates. */ + class BinLogCoordinates implements IBinLogCoordinates { + + /** + * Constructs a new BinLogCoordinates. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IBinLogCoordinates); + + /** BinLogCoordinates binLogFileName. */ + public binLogFileName: string; + + /** BinLogCoordinates binLogPosition. */ + public binLogPosition: (number|Long|string); + + /** BinLogCoordinates kind. */ + public kind: string; + + /** + * Creates a new BinLogCoordinates instance using the specified properties. + * @param [properties] Properties to set + * @returns BinLogCoordinates instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IBinLogCoordinates): google.cloud.sql.v1beta4.BinLogCoordinates; + + /** + * Encodes the specified BinLogCoordinates message. Does not implicitly {@link google.cloud.sql.v1beta4.BinLogCoordinates.verify|verify} messages. + * @param message BinLogCoordinates message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IBinLogCoordinates, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BinLogCoordinates message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BinLogCoordinates.verify|verify} messages. + * @param message BinLogCoordinates message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IBinLogCoordinates, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BinLogCoordinates message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BinLogCoordinates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BinLogCoordinates; + + /** + * Decodes a BinLogCoordinates message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BinLogCoordinates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BinLogCoordinates; + + /** + * Verifies a BinLogCoordinates message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BinLogCoordinates message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BinLogCoordinates + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BinLogCoordinates; + + /** + * Creates a plain object from a BinLogCoordinates message. Also converts values to other types if specified. + * @param message BinLogCoordinates + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.BinLogCoordinates, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BinLogCoordinates to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BinLogCoordinates + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BackupContext. */ + interface IBackupContext { + + /** BackupContext backupId */ + backupId?: (number|Long|string|null); + + /** BackupContext kind */ + kind?: (string|null); + + /** BackupContext name */ + name?: (string|null); + } + + /** Represents a BackupContext. */ + class BackupContext implements IBackupContext { + + /** + * Constructs a new BackupContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IBackupContext); + + /** BackupContext backupId. */ + public backupId: (number|Long|string); + + /** BackupContext kind. */ + public kind: string; + + /** BackupContext name. */ + public name: string; + + /** + * Creates a new BackupContext instance using the specified properties. + * @param [properties] Properties to set + * @returns BackupContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IBackupContext): google.cloud.sql.v1beta4.BackupContext; + + /** + * Encodes the specified BackupContext message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupContext.verify|verify} messages. + * @param message BackupContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupContext.verify|verify} messages. + * @param message BackupContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BackupContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupContext; + + /** + * Decodes a BackupContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupContext; + + /** + * Verifies a BackupContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BackupContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BackupContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupContext; + + /** + * Creates a plain object from a BackupContext message. Also converts values to other types if specified. + * @param message BackupContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.BackupContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BackupContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BackupContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CloneContext. */ + interface ICloneContext { + + /** CloneContext kind */ + kind?: (string|null); + + /** CloneContext pitrTimestampMs */ + pitrTimestampMs?: (number|Long|string|null); + + /** CloneContext destinationInstanceName */ + destinationInstanceName?: (string|null); + + /** CloneContext binLogCoordinates */ + binLogCoordinates?: (google.cloud.sql.v1beta4.IBinLogCoordinates|null); + + /** CloneContext pointInTime */ + pointInTime?: (google.protobuf.ITimestamp|null); + + /** CloneContext allocatedIpRange */ + allocatedIpRange?: (string|null); + + /** CloneContext databaseNames */ + databaseNames?: (string[]|null); + + /** CloneContext preferredZone */ + preferredZone?: (string|null); + + /** CloneContext preferredSecondaryZone */ + preferredSecondaryZone?: (string|null); + + /** CloneContext sourceInstanceDeletionTime */ + sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); + + /** CloneContext destinationProject */ + destinationProject?: (string|null); + + /** CloneContext destinationNetwork */ + destinationNetwork?: (string|null); + } + + /** Represents a CloneContext. */ + class CloneContext implements ICloneContext { + + /** + * Constructs a new CloneContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ICloneContext); + + /** CloneContext kind. */ + public kind: string; + + /** CloneContext pitrTimestampMs. */ + public pitrTimestampMs: (number|Long|string); + + /** CloneContext destinationInstanceName. */ + public destinationInstanceName: string; + + /** CloneContext binLogCoordinates. */ + public binLogCoordinates?: (google.cloud.sql.v1beta4.IBinLogCoordinates|null); + + /** CloneContext pointInTime. */ + public pointInTime?: (google.protobuf.ITimestamp|null); + + /** CloneContext allocatedIpRange. */ + public allocatedIpRange: string; + + /** CloneContext databaseNames. */ + public databaseNames: string[]; + + /** CloneContext preferredZone. */ + public preferredZone?: (string|null); + + /** CloneContext preferredSecondaryZone. */ + public preferredSecondaryZone?: (string|null); + + /** CloneContext sourceInstanceDeletionTime. */ + public sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); + + /** CloneContext destinationProject. */ + public destinationProject?: (string|null); + + /** CloneContext destinationNetwork. */ + public destinationNetwork?: (string|null); + + /** + * Creates a new CloneContext instance using the specified properties. + * @param [properties] Properties to set + * @returns CloneContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ICloneContext): google.cloud.sql.v1beta4.CloneContext; + + /** + * Encodes the specified CloneContext message. Does not implicitly {@link google.cloud.sql.v1beta4.CloneContext.verify|verify} messages. + * @param message CloneContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ICloneContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CloneContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.CloneContext.verify|verify} messages. + * @param message CloneContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ICloneContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CloneContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CloneContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.CloneContext; + + /** + * Decodes a CloneContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CloneContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.CloneContext; + + /** + * Verifies a CloneContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CloneContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CloneContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.CloneContext; + + /** + * Creates a plain object from a CloneContext message. Also converts values to other types if specified. + * @param message CloneContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.CloneContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CloneContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CloneContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Database. */ + interface IDatabase { + + /** Database kind */ + kind?: (string|null); + + /** Database charset */ + charset?: (string|null); + + /** Database collation */ + collation?: (string|null); + + /** Database etag */ + etag?: (string|null); + + /** Database name */ + name?: (string|null); + + /** Database instance */ + instance?: (string|null); + + /** Database selfLink */ + selfLink?: (string|null); + + /** Database project */ + project?: (string|null); + + /** Database sqlserverDatabaseDetails */ + sqlserverDatabaseDetails?: (google.cloud.sql.v1beta4.ISqlServerDatabaseDetails|null); + } + + /** Represents a Database. */ + class Database implements IDatabase { + + /** + * Constructs a new Database. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDatabase); + + /** Database kind. */ + public kind: string; + + /** Database charset. */ + public charset: string; + + /** Database collation. */ + public collation: string; + + /** Database etag. */ + public etag: string; + + /** Database name. */ + public name: string; + + /** Database instance. */ + public instance: string; + + /** Database selfLink. */ + public selfLink: string; + + /** Database project. */ + public project: string; + + /** Database sqlserverDatabaseDetails. */ + public sqlserverDatabaseDetails?: (google.cloud.sql.v1beta4.ISqlServerDatabaseDetails|null); + + /** Database databaseDetails. */ + public databaseDetails?: "sqlserverDatabaseDetails"; + + /** + * Creates a new Database instance using the specified properties. + * @param [properties] Properties to set + * @returns Database instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDatabase): google.cloud.sql.v1beta4.Database; + + /** + * Encodes the specified Database message. Does not implicitly {@link google.cloud.sql.v1beta4.Database.verify|verify} messages. + * @param message Database message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDatabase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Database message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Database.verify|verify} messages. + * @param message Database message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDatabase, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Database message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Database; + + /** + * Decodes a Database message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Database; + + /** + * Verifies a Database message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Database message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Database + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Database; + + /** + * Creates a plain object from a Database message. Also converts values to other types if specified. + * @param message Database + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.Database, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Database to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Database + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlServerDatabaseDetails. */ + interface ISqlServerDatabaseDetails { + + /** SqlServerDatabaseDetails compatibilityLevel */ + compatibilityLevel?: (number|null); + + /** SqlServerDatabaseDetails recoveryModel */ + recoveryModel?: (string|null); + } + + /** Represents a SqlServerDatabaseDetails. */ + class SqlServerDatabaseDetails implements ISqlServerDatabaseDetails { + + /** + * Constructs a new SqlServerDatabaseDetails. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlServerDatabaseDetails); + + /** SqlServerDatabaseDetails compatibilityLevel. */ + public compatibilityLevel: number; + + /** SqlServerDatabaseDetails recoveryModel. */ + public recoveryModel: string; + + /** + * Creates a new SqlServerDatabaseDetails instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlServerDatabaseDetails instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlServerDatabaseDetails): google.cloud.sql.v1beta4.SqlServerDatabaseDetails; + + /** + * Encodes the specified SqlServerDatabaseDetails message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerDatabaseDetails.verify|verify} messages. + * @param message SqlServerDatabaseDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlServerDatabaseDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlServerDatabaseDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerDatabaseDetails.verify|verify} messages. + * @param message SqlServerDatabaseDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlServerDatabaseDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlServerDatabaseDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlServerDatabaseDetails; + + /** + * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlServerDatabaseDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlServerDatabaseDetails; + + /** + * Verifies a SqlServerDatabaseDetails message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlServerDatabaseDetails message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlServerDatabaseDetails + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlServerDatabaseDetails; + + /** + * Creates a plain object from a SqlServerDatabaseDetails message. Also converts values to other types if specified. + * @param message SqlServerDatabaseDetails + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlServerDatabaseDetails, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlServerDatabaseDetails to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlServerDatabaseDetails + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DatabaseFlags. */ + interface IDatabaseFlags { + + /** DatabaseFlags name */ + name?: (string|null); + + /** DatabaseFlags value */ + value?: (string|null); + } + + /** Represents a DatabaseFlags. */ + class DatabaseFlags implements IDatabaseFlags { + + /** + * Constructs a new DatabaseFlags. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDatabaseFlags); + + /** DatabaseFlags name. */ + public name: string; + + /** DatabaseFlags value. */ + public value: string; + + /** + * Creates a new DatabaseFlags instance using the specified properties. + * @param [properties] Properties to set + * @returns DatabaseFlags instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDatabaseFlags): google.cloud.sql.v1beta4.DatabaseFlags; + + /** + * Encodes the specified DatabaseFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseFlags.verify|verify} messages. + * @param message DatabaseFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDatabaseFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DatabaseFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseFlags.verify|verify} messages. + * @param message DatabaseFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDatabaseFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DatabaseFlags message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DatabaseFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseFlags; + + /** + * Decodes a DatabaseFlags message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DatabaseFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseFlags; + + /** + * Verifies a DatabaseFlags message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DatabaseFlags message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DatabaseFlags + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseFlags; + + /** + * Creates a plain object from a DatabaseFlags message. Also converts values to other types if specified. + * @param message DatabaseFlags + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DatabaseFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DatabaseFlags to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DatabaseFlags + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SyncFlags. */ + interface ISyncFlags { + + /** SyncFlags name */ + name?: (string|null); + + /** SyncFlags value */ + value?: (string|null); + } + + /** Represents a SyncFlags. */ + class SyncFlags implements ISyncFlags { + + /** + * Constructs a new SyncFlags. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISyncFlags); + + /** SyncFlags name. */ + public name: string; + + /** SyncFlags value. */ + public value: string; + + /** + * Creates a new SyncFlags instance using the specified properties. + * @param [properties] Properties to set + * @returns SyncFlags instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISyncFlags): google.cloud.sql.v1beta4.SyncFlags; + + /** + * Encodes the specified SyncFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.SyncFlags.verify|verify} messages. + * @param message SyncFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISyncFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SyncFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SyncFlags.verify|verify} messages. + * @param message SyncFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISyncFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SyncFlags message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SyncFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SyncFlags; + + /** + * Decodes a SyncFlags message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SyncFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SyncFlags; + + /** + * Verifies a SyncFlags message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SyncFlags message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SyncFlags + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SyncFlags; + + /** + * Creates a plain object from a SyncFlags message. Also converts values to other types if specified. + * @param message SyncFlags + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SyncFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SyncFlags to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SyncFlags + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstanceReference. */ + interface IInstanceReference { + + /** InstanceReference name */ + name?: (string|null); + + /** InstanceReference region */ + region?: (string|null); + + /** InstanceReference project */ + project?: (string|null); + } + + /** Represents an InstanceReference. */ + class InstanceReference implements IInstanceReference { + + /** + * Constructs a new InstanceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstanceReference); + + /** InstanceReference name. */ + public name: string; + + /** InstanceReference region. */ + public region: string; + + /** InstanceReference project. */ + public project: string; + + /** + * Creates a new InstanceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns InstanceReference instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstanceReference): google.cloud.sql.v1beta4.InstanceReference; + + /** + * Encodes the specified InstanceReference message. Does not implicitly {@link google.cloud.sql.v1beta4.InstanceReference.verify|verify} messages. + * @param message InstanceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstanceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstanceReference message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstanceReference.verify|verify} messages. + * @param message InstanceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstanceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstanceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstanceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstanceReference; + + /** + * Decodes an InstanceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstanceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstanceReference; + + /** + * Verifies an InstanceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstanceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstanceReference + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstanceReference; + + /** + * Creates a plain object from an InstanceReference message. Also converts values to other types if specified. + * @param message InstanceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstanceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstanceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstanceReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DatabaseInstance. */ + interface IDatabaseInstance { + + /** DatabaseInstance kind */ + kind?: (string|null); + + /** DatabaseInstance state */ + state?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null); + + /** DatabaseInstance databaseVersion */ + databaseVersion?: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion|null); + + /** DatabaseInstance settings */ + settings?: (google.cloud.sql.v1beta4.ISettings|null); + + /** DatabaseInstance etag */ + etag?: (string|null); + + /** DatabaseInstance failoverReplica */ + failoverReplica?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica|null); + + /** DatabaseInstance masterInstanceName */ + masterInstanceName?: (string|null); + + /** DatabaseInstance replicaNames */ + replicaNames?: (string[]|null); + + /** DatabaseInstance maxDiskSize */ + maxDiskSize?: (google.protobuf.IInt64Value|null); + + /** DatabaseInstance currentDiskSize */ + currentDiskSize?: (google.protobuf.IInt64Value|null); + + /** DatabaseInstance ipAddresses */ + ipAddresses?: (google.cloud.sql.v1beta4.IIpMapping[]|null); + + /** DatabaseInstance serverCaCert */ + serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); + + /** DatabaseInstance instanceType */ + instanceType?: (google.cloud.sql.v1beta4.SqlInstanceType|keyof typeof google.cloud.sql.v1beta4.SqlInstanceType|null); + + /** DatabaseInstance project */ + project?: (string|null); + + /** DatabaseInstance ipv6Address */ + ipv6Address?: (string|null); + + /** DatabaseInstance serviceAccountEmailAddress */ + serviceAccountEmailAddress?: (string|null); + + /** DatabaseInstance onPremisesConfiguration */ + onPremisesConfiguration?: (google.cloud.sql.v1beta4.IOnPremisesConfiguration|null); + + /** DatabaseInstance replicaConfiguration */ + replicaConfiguration?: (google.cloud.sql.v1beta4.IReplicaConfiguration|null); + + /** DatabaseInstance backendType */ + backendType?: (google.cloud.sql.v1beta4.SqlBackendType|keyof typeof google.cloud.sql.v1beta4.SqlBackendType|null); + + /** DatabaseInstance selfLink */ + selfLink?: (string|null); + + /** DatabaseInstance suspensionReason */ + suspensionReason?: (google.cloud.sql.v1beta4.SqlSuspensionReason[]|null); + + /** DatabaseInstance connectionName */ + connectionName?: (string|null); + + /** DatabaseInstance name */ + name?: (string|null); + + /** DatabaseInstance region */ + region?: (string|null); + + /** DatabaseInstance gceZone */ + gceZone?: (string|null); + + /** DatabaseInstance secondaryGceZone */ + secondaryGceZone?: (string|null); + + /** DatabaseInstance diskEncryptionConfiguration */ + diskEncryptionConfiguration?: (google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null); + + /** DatabaseInstance diskEncryptionStatus */ + diskEncryptionStatus?: (google.cloud.sql.v1beta4.IDiskEncryptionStatus|null); + + /** DatabaseInstance rootPassword */ + rootPassword?: (string|null); + + /** DatabaseInstance scheduledMaintenance */ + scheduledMaintenance?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance|null); + + /** DatabaseInstance satisfiesPzs */ + satisfiesPzs?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance databaseInstalledVersion */ + databaseInstalledVersion?: (string|null); + + /** DatabaseInstance outOfDiskReport */ + outOfDiskReport?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport|null); + + /** DatabaseInstance createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** DatabaseInstance availableMaintenanceVersions */ + availableMaintenanceVersions?: (string[]|null); + + /** DatabaseInstance maintenanceVersion */ + maintenanceVersion?: (string|null); + + /** DatabaseInstance upgradableDatabaseVersions */ + upgradableDatabaseVersions?: (google.cloud.sql.v1beta4.IAvailableDatabaseVersion[]|null); + + /** DatabaseInstance sqlNetworkArchitecture */ + sqlNetworkArchitecture?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|null); + + /** DatabaseInstance pscServiceAttachmentLink */ + pscServiceAttachmentLink?: (string|null); + + /** DatabaseInstance dnsName */ + dnsName?: (string|null); + + /** DatabaseInstance primaryDnsName */ + primaryDnsName?: (string|null); + + /** DatabaseInstance writeEndpoint */ + writeEndpoint?: (string|null); + + /** DatabaseInstance replicationCluster */ + replicationCluster?: (google.cloud.sql.v1beta4.IReplicationCluster|null); + + /** DatabaseInstance geminiConfig */ + geminiConfig?: (google.cloud.sql.v1beta4.IGeminiInstanceConfig|null); + + /** DatabaseInstance satisfiesPzi */ + satisfiesPzi?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance switchTransactionLogsToCloudStorageEnabled */ + switchTransactionLogsToCloudStorageEnabled?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance includeReplicasForMajorVersionUpgrade */ + includeReplicasForMajorVersionUpgrade?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance tags */ + tags?: ({ [k: string]: string }|null); + + /** DatabaseInstance nodeCount */ + nodeCount?: (number|null); + + /** DatabaseInstance nodes */ + nodes?: (google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig[]|null); + + /** DatabaseInstance dnsNames */ + dnsNames?: (google.cloud.sql.v1beta4.IDnsNameMapping[]|null); + } + + /** Represents a DatabaseInstance. */ + class DatabaseInstance implements IDatabaseInstance { + + /** + * Constructs a new DatabaseInstance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDatabaseInstance); + + /** DatabaseInstance kind. */ + public kind: string; + + /** DatabaseInstance state. */ + public state: (google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState); + + /** DatabaseInstance databaseVersion. */ + public databaseVersion: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion); + + /** DatabaseInstance settings. */ + public settings?: (google.cloud.sql.v1beta4.ISettings|null); + + /** DatabaseInstance etag. */ + public etag: string; + + /** DatabaseInstance failoverReplica. */ + public failoverReplica?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica|null); + + /** DatabaseInstance masterInstanceName. */ + public masterInstanceName: string; + + /** DatabaseInstance replicaNames. */ + public replicaNames: string[]; + + /** DatabaseInstance maxDiskSize. */ + public maxDiskSize?: (google.protobuf.IInt64Value|null); + + /** DatabaseInstance currentDiskSize. */ + public currentDiskSize?: (google.protobuf.IInt64Value|null); + + /** DatabaseInstance ipAddresses. */ + public ipAddresses: google.cloud.sql.v1beta4.IIpMapping[]; + + /** DatabaseInstance serverCaCert. */ + public serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); + + /** DatabaseInstance instanceType. */ + public instanceType: (google.cloud.sql.v1beta4.SqlInstanceType|keyof typeof google.cloud.sql.v1beta4.SqlInstanceType); + + /** DatabaseInstance project. */ + public project: string; + + /** DatabaseInstance ipv6Address. */ + public ipv6Address: string; + + /** DatabaseInstance serviceAccountEmailAddress. */ + public serviceAccountEmailAddress: string; + + /** DatabaseInstance onPremisesConfiguration. */ + public onPremisesConfiguration?: (google.cloud.sql.v1beta4.IOnPremisesConfiguration|null); + + /** DatabaseInstance replicaConfiguration. */ + public replicaConfiguration?: (google.cloud.sql.v1beta4.IReplicaConfiguration|null); + + /** DatabaseInstance backendType. */ + public backendType: (google.cloud.sql.v1beta4.SqlBackendType|keyof typeof google.cloud.sql.v1beta4.SqlBackendType); + + /** DatabaseInstance selfLink. */ + public selfLink: string; + + /** DatabaseInstance suspensionReason. */ + public suspensionReason: google.cloud.sql.v1beta4.SqlSuspensionReason[]; + + /** DatabaseInstance connectionName. */ + public connectionName: string; + + /** DatabaseInstance name. */ + public name: string; + + /** DatabaseInstance region. */ + public region: string; + + /** DatabaseInstance gceZone. */ + public gceZone: string; + + /** DatabaseInstance secondaryGceZone. */ + public secondaryGceZone: string; + + /** DatabaseInstance diskEncryptionConfiguration. */ + public diskEncryptionConfiguration?: (google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null); + + /** DatabaseInstance diskEncryptionStatus. */ + public diskEncryptionStatus?: (google.cloud.sql.v1beta4.IDiskEncryptionStatus|null); + + /** DatabaseInstance rootPassword. */ + public rootPassword: string; + + /** DatabaseInstance scheduledMaintenance. */ + public scheduledMaintenance?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance|null); + + /** DatabaseInstance satisfiesPzs. */ + public satisfiesPzs?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance databaseInstalledVersion. */ + public databaseInstalledVersion: string; + + /** DatabaseInstance outOfDiskReport. */ + public outOfDiskReport?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport|null); + + /** DatabaseInstance createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** DatabaseInstance availableMaintenanceVersions. */ + public availableMaintenanceVersions: string[]; + + /** DatabaseInstance maintenanceVersion. */ + public maintenanceVersion: string; + + /** DatabaseInstance upgradableDatabaseVersions. */ + public upgradableDatabaseVersions: google.cloud.sql.v1beta4.IAvailableDatabaseVersion[]; + + /** DatabaseInstance sqlNetworkArchitecture. */ + public sqlNetworkArchitecture?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|null); + + /** DatabaseInstance pscServiceAttachmentLink. */ + public pscServiceAttachmentLink?: (string|null); + + /** DatabaseInstance dnsName. */ + public dnsName?: (string|null); + + /** DatabaseInstance primaryDnsName. */ + public primaryDnsName?: (string|null); + + /** DatabaseInstance writeEndpoint. */ + public writeEndpoint?: (string|null); + + /** DatabaseInstance replicationCluster. */ + public replicationCluster?: (google.cloud.sql.v1beta4.IReplicationCluster|null); + + /** DatabaseInstance geminiConfig. */ + public geminiConfig?: (google.cloud.sql.v1beta4.IGeminiInstanceConfig|null); + + /** DatabaseInstance satisfiesPzi. */ + public satisfiesPzi?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance switchTransactionLogsToCloudStorageEnabled. */ + public switchTransactionLogsToCloudStorageEnabled?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance includeReplicasForMajorVersionUpgrade. */ + public includeReplicasForMajorVersionUpgrade?: (google.protobuf.IBoolValue|null); + + /** DatabaseInstance tags. */ + public tags: { [k: string]: string }; + + /** DatabaseInstance nodeCount. */ + public nodeCount?: (number|null); + + /** DatabaseInstance nodes. */ + public nodes: google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig[]; + + /** DatabaseInstance dnsNames. */ + public dnsNames: google.cloud.sql.v1beta4.IDnsNameMapping[]; + + /** + * Creates a new DatabaseInstance instance using the specified properties. + * @param [properties] Properties to set + * @returns DatabaseInstance instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDatabaseInstance): google.cloud.sql.v1beta4.DatabaseInstance; + + /** + * Encodes the specified DatabaseInstance message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.verify|verify} messages. + * @param message DatabaseInstance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDatabaseInstance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DatabaseInstance message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.verify|verify} messages. + * @param message DatabaseInstance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDatabaseInstance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DatabaseInstance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DatabaseInstance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseInstance; + + /** + * Decodes a DatabaseInstance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DatabaseInstance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseInstance; + + /** + * Verifies a DatabaseInstance message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DatabaseInstance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DatabaseInstance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseInstance; + + /** + * Creates a plain object from a DatabaseInstance message. Also converts values to other types if specified. + * @param message DatabaseInstance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DatabaseInstance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DatabaseInstance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DatabaseInstance + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DatabaseInstance { + + /** SqlInstanceState enum. */ + enum SqlInstanceState { + SQL_INSTANCE_STATE_UNSPECIFIED = 0, + RUNNABLE = 1, + SUSPENDED = 2, + PENDING_DELETE = 3, + PENDING_CREATE = 4, + MAINTENANCE = 5, + FAILED = 6, + ONLINE_MAINTENANCE = 7, + REPAIRING = 8 + } + + /** Properties of a SqlFailoverReplica. */ + interface ISqlFailoverReplica { + + /** SqlFailoverReplica name */ + name?: (string|null); + + /** SqlFailoverReplica available */ + available?: (google.protobuf.IBoolValue|null); + } + + /** Represents a SqlFailoverReplica. */ + class SqlFailoverReplica implements ISqlFailoverReplica { + + /** + * Constructs a new SqlFailoverReplica. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica); + + /** SqlFailoverReplica name. */ + public name: string; + + /** SqlFailoverReplica available. */ + public available?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new SqlFailoverReplica instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlFailoverReplica instance + */ + public static create(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica): google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica; + + /** + * Encodes the specified SqlFailoverReplica message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. + * @param message SqlFailoverReplica message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlFailoverReplica message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. + * @param message SqlFailoverReplica message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlFailoverReplica message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlFailoverReplica + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica; + + /** + * Decodes a SqlFailoverReplica message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlFailoverReplica + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica; + + /** + * Verifies a SqlFailoverReplica message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlFailoverReplica message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlFailoverReplica + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica; + + /** + * Creates a plain object from a SqlFailoverReplica message. Also converts values to other types if specified. + * @param message SqlFailoverReplica + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlFailoverReplica to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlFailoverReplica + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlScheduledMaintenance. */ + interface ISqlScheduledMaintenance { + + /** SqlScheduledMaintenance startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** SqlScheduledMaintenance canDefer */ + canDefer?: (boolean|null); + + /** SqlScheduledMaintenance canReschedule */ + canReschedule?: (boolean|null); + + /** SqlScheduledMaintenance scheduleDeadlineTime */ + scheduleDeadlineTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a SqlScheduledMaintenance. */ + class SqlScheduledMaintenance implements ISqlScheduledMaintenance { + + /** + * Constructs a new SqlScheduledMaintenance. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance); + + /** SqlScheduledMaintenance startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** SqlScheduledMaintenance canDefer. */ + public canDefer: boolean; + + /** SqlScheduledMaintenance canReschedule. */ + public canReschedule: boolean; + + /** SqlScheduledMaintenance scheduleDeadlineTime. */ + public scheduleDeadlineTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new SqlScheduledMaintenance instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlScheduledMaintenance instance + */ + public static create(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance): google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance; + + /** + * Encodes the specified SqlScheduledMaintenance message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. + * @param message SqlScheduledMaintenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlScheduledMaintenance message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. + * @param message SqlScheduledMaintenance message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlScheduledMaintenance message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlScheduledMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance; + + /** + * Decodes a SqlScheduledMaintenance message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlScheduledMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance; + + /** + * Verifies a SqlScheduledMaintenance message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlScheduledMaintenance message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlScheduledMaintenance + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance; + + /** + * Creates a plain object from a SqlScheduledMaintenance message. Also converts values to other types if specified. + * @param message SqlScheduledMaintenance + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlScheduledMaintenance to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlScheduledMaintenance + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlOutOfDiskReport. */ + interface ISqlOutOfDiskReport { + + /** SqlOutOfDiskReport sqlOutOfDiskState */ + sqlOutOfDiskState?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null); + + /** SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb */ + sqlMinRecommendedIncreaseSizeGb?: (number|null); + } + + /** Represents a SqlOutOfDiskReport. */ + class SqlOutOfDiskReport implements ISqlOutOfDiskReport { + + /** + * Constructs a new SqlOutOfDiskReport. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport); + + /** SqlOutOfDiskReport sqlOutOfDiskState. */ + public sqlOutOfDiskState?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null); + + /** SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb. */ + public sqlMinRecommendedIncreaseSizeGb?: (number|null); + + /** + * Creates a new SqlOutOfDiskReport instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlOutOfDiskReport instance + */ + public static create(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport): google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport; + + /** + * Encodes the specified SqlOutOfDiskReport message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. + * @param message SqlOutOfDiskReport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlOutOfDiskReport message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. + * @param message SqlOutOfDiskReport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlOutOfDiskReport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlOutOfDiskReport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport; + + /** + * Decodes a SqlOutOfDiskReport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlOutOfDiskReport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport; + + /** + * Verifies a SqlOutOfDiskReport message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlOutOfDiskReport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlOutOfDiskReport + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport; + + /** + * Creates a plain object from a SqlOutOfDiskReport message. Also converts values to other types if specified. + * @param message SqlOutOfDiskReport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlOutOfDiskReport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlOutOfDiskReport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlOutOfDiskReport { + + /** SqlOutOfDiskState enum. */ + enum SqlOutOfDiskState { + SQL_OUT_OF_DISK_STATE_UNSPECIFIED = 0, + NORMAL = 1, + SOFT_SHUTDOWN = 2 + } + } + + /** SqlNetworkArchitecture enum. */ + enum SqlNetworkArchitecture { + SQL_NETWORK_ARCHITECTURE_UNSPECIFIED = 0, + NEW_NETWORK_ARCHITECTURE = 1, + OLD_NETWORK_ARCHITECTURE = 2 + } + + /** Properties of a PoolNodeConfig. */ + interface IPoolNodeConfig { + + /** PoolNodeConfig name */ + name?: (string|null); + + /** PoolNodeConfig gceZone */ + gceZone?: (string|null); + + /** PoolNodeConfig ipAddresses */ + ipAddresses?: (google.cloud.sql.v1beta4.IIpMapping[]|null); + + /** PoolNodeConfig dnsName */ + dnsName?: (string|null); + + /** PoolNodeConfig state */ + state?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null); + + /** PoolNodeConfig dnsNames */ + dnsNames?: (google.cloud.sql.v1beta4.IDnsNameMapping[]|null); + + /** PoolNodeConfig pscServiceAttachmentLink */ + pscServiceAttachmentLink?: (string|null); + + /** PoolNodeConfig pscAutoConnections */ + pscAutoConnections?: (google.cloud.sql.v1beta4.IPscAutoConnectionConfig[]|null); + } + + /** Represents a PoolNodeConfig. */ + class PoolNodeConfig implements IPoolNodeConfig { + + /** + * Constructs a new PoolNodeConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig); + + /** PoolNodeConfig name. */ + public name?: (string|null); + + /** PoolNodeConfig gceZone. */ + public gceZone?: (string|null); + + /** PoolNodeConfig ipAddresses. */ + public ipAddresses: google.cloud.sql.v1beta4.IIpMapping[]; + + /** PoolNodeConfig dnsName. */ + public dnsName?: (string|null); + + /** PoolNodeConfig state. */ + public state?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null); + + /** PoolNodeConfig dnsNames. */ + public dnsNames: google.cloud.sql.v1beta4.IDnsNameMapping[]; + + /** PoolNodeConfig pscServiceAttachmentLink. */ + public pscServiceAttachmentLink?: (string|null); + + /** PoolNodeConfig pscAutoConnections. */ + public pscAutoConnections: google.cloud.sql.v1beta4.IPscAutoConnectionConfig[]; + + /** + * Creates a new PoolNodeConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns PoolNodeConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig): google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig; + + /** + * Encodes the specified PoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.verify|verify} messages. + * @param message PoolNodeConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.verify|verify} messages. + * @param message PoolNodeConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PoolNodeConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig; + + /** + * Decodes a PoolNodeConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig; + + /** + * Verifies a PoolNodeConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PoolNodeConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PoolNodeConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig; + + /** + * Creates a plain object from a PoolNodeConfig message. Also converts values to other types if specified. + * @param message PoolNodeConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PoolNodeConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PoolNodeConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a DnsNameMapping. */ + interface IDnsNameMapping { + + /** DnsNameMapping name */ + name?: (string|null); + + /** DnsNameMapping connectionType */ + connectionType?: (google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType|null); + + /** DnsNameMapping dnsScope */ + dnsScope?: (google.cloud.sql.v1beta4.DnsNameMapping.DnsScope|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.DnsScope|null); + + /** DnsNameMapping recordManager */ + recordManager?: (google.cloud.sql.v1beta4.DnsNameMapping.RecordManager|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.RecordManager|null); + } + + /** Represents a DnsNameMapping. */ + class DnsNameMapping implements IDnsNameMapping { + + /** + * Constructs a new DnsNameMapping. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDnsNameMapping); + + /** DnsNameMapping name. */ + public name: string; + + /** DnsNameMapping connectionType. */ + public connectionType: (google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType); + + /** DnsNameMapping dnsScope. */ + public dnsScope: (google.cloud.sql.v1beta4.DnsNameMapping.DnsScope|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.DnsScope); + + /** DnsNameMapping recordManager. */ + public recordManager: (google.cloud.sql.v1beta4.DnsNameMapping.RecordManager|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.RecordManager); + + /** + * Creates a new DnsNameMapping instance using the specified properties. + * @param [properties] Properties to set + * @returns DnsNameMapping instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDnsNameMapping): google.cloud.sql.v1beta4.DnsNameMapping; + + /** + * Encodes the specified DnsNameMapping message. Does not implicitly {@link google.cloud.sql.v1beta4.DnsNameMapping.verify|verify} messages. + * @param message DnsNameMapping message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDnsNameMapping, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DnsNameMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DnsNameMapping.verify|verify} messages. + * @param message DnsNameMapping message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDnsNameMapping, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DnsNameMapping message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DnsNameMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DnsNameMapping; + + /** + * Decodes a DnsNameMapping message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DnsNameMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DnsNameMapping; + + /** + * Verifies a DnsNameMapping message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DnsNameMapping message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DnsNameMapping + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DnsNameMapping; + + /** + * Creates a plain object from a DnsNameMapping message. Also converts values to other types if specified. + * @param message DnsNameMapping + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DnsNameMapping, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DnsNameMapping to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DnsNameMapping + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DnsNameMapping { + + /** ConnectionType enum. */ + enum ConnectionType { + CONNECTION_TYPE_UNSPECIFIED = 0, + PUBLIC = 1, + PRIVATE_SERVICES_ACCESS = 2, + PRIVATE_SERVICE_CONNECT = 3 + } + + /** DnsScope enum. */ + enum DnsScope { + DNS_SCOPE_UNSPECIFIED = 0, + INSTANCE = 1, + CLUSTER = 2 + } + + /** RecordManager enum. */ + enum RecordManager { + RECORD_MANAGER_UNSPECIFIED = 0, + CUSTOMER = 1, + CLOUD_SQL_AUTOMATION = 2 + } + } + + /** Properties of a GeminiInstanceConfig. */ + interface IGeminiInstanceConfig { + + /** GeminiInstanceConfig entitled */ + entitled?: (boolean|null); + + /** GeminiInstanceConfig googleVacuumMgmtEnabled */ + googleVacuumMgmtEnabled?: (boolean|null); + + /** GeminiInstanceConfig oomSessionCancelEnabled */ + oomSessionCancelEnabled?: (boolean|null); + + /** GeminiInstanceConfig activeQueryEnabled */ + activeQueryEnabled?: (boolean|null); + + /** GeminiInstanceConfig indexAdvisorEnabled */ + indexAdvisorEnabled?: (boolean|null); + + /** GeminiInstanceConfig flagRecommenderEnabled */ + flagRecommenderEnabled?: (boolean|null); + } + + /** Represents a GeminiInstanceConfig. */ + class GeminiInstanceConfig implements IGeminiInstanceConfig { + + /** + * Constructs a new GeminiInstanceConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IGeminiInstanceConfig); + + /** GeminiInstanceConfig entitled. */ + public entitled?: (boolean|null); + + /** GeminiInstanceConfig googleVacuumMgmtEnabled. */ + public googleVacuumMgmtEnabled?: (boolean|null); + + /** GeminiInstanceConfig oomSessionCancelEnabled. */ + public oomSessionCancelEnabled?: (boolean|null); + + /** GeminiInstanceConfig activeQueryEnabled. */ + public activeQueryEnabled?: (boolean|null); + + /** GeminiInstanceConfig indexAdvisorEnabled. */ + public indexAdvisorEnabled?: (boolean|null); + + /** GeminiInstanceConfig flagRecommenderEnabled. */ + public flagRecommenderEnabled?: (boolean|null); + + /** + * Creates a new GeminiInstanceConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns GeminiInstanceConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IGeminiInstanceConfig): google.cloud.sql.v1beta4.GeminiInstanceConfig; + + /** + * Encodes the specified GeminiInstanceConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.GeminiInstanceConfig.verify|verify} messages. + * @param message GeminiInstanceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IGeminiInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeminiInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GeminiInstanceConfig.verify|verify} messages. + * @param message GeminiInstanceConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IGeminiInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeminiInstanceConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeminiInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.GeminiInstanceConfig; + + /** + * Decodes a GeminiInstanceConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeminiInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.GeminiInstanceConfig; + + /** + * Verifies a GeminiInstanceConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeminiInstanceConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeminiInstanceConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.GeminiInstanceConfig; + + /** + * Creates a plain object from a GeminiInstanceConfig message. Also converts values to other types if specified. + * @param message GeminiInstanceConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.GeminiInstanceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeminiInstanceConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GeminiInstanceConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReplicationCluster. */ + interface IReplicationCluster { + + /** ReplicationCluster psaWriteEndpoint */ + psaWriteEndpoint?: (string|null); + + /** ReplicationCluster failoverDrReplicaName */ + failoverDrReplicaName?: (string|null); + + /** ReplicationCluster drReplica */ + drReplica?: (boolean|null); + } + + /** Represents a ReplicationCluster. */ + class ReplicationCluster implements IReplicationCluster { + + /** + * Constructs a new ReplicationCluster. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IReplicationCluster); + + /** ReplicationCluster psaWriteEndpoint. */ + public psaWriteEndpoint?: (string|null); + + /** ReplicationCluster failoverDrReplicaName. */ + public failoverDrReplicaName?: (string|null); + + /** ReplicationCluster drReplica. */ + public drReplica?: (boolean|null); + + /** + * Creates a new ReplicationCluster instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplicationCluster instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IReplicationCluster): google.cloud.sql.v1beta4.ReplicationCluster; + + /** + * Encodes the specified ReplicationCluster message. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicationCluster.verify|verify} messages. + * @param message ReplicationCluster message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IReplicationCluster, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReplicationCluster message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicationCluster.verify|verify} messages. + * @param message ReplicationCluster message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IReplicationCluster, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReplicationCluster message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplicationCluster + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ReplicationCluster; + + /** + * Decodes a ReplicationCluster message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplicationCluster + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ReplicationCluster; + + /** + * Verifies a ReplicationCluster message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReplicationCluster message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplicationCluster + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ReplicationCluster; + + /** + * Creates a plain object from a ReplicationCluster message. Also converts values to other types if specified. + * @param message ReplicationCluster + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ReplicationCluster, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReplicationCluster to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplicationCluster + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AvailableDatabaseVersion. */ + interface IAvailableDatabaseVersion { + + /** AvailableDatabaseVersion majorVersion */ + majorVersion?: (string|null); + + /** AvailableDatabaseVersion name */ + name?: (string|null); + + /** AvailableDatabaseVersion displayName */ + displayName?: (string|null); + } + + /** Represents an AvailableDatabaseVersion. */ + class AvailableDatabaseVersion implements IAvailableDatabaseVersion { + + /** + * Constructs a new AvailableDatabaseVersion. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IAvailableDatabaseVersion); + + /** AvailableDatabaseVersion majorVersion. */ + public majorVersion?: (string|null); + + /** AvailableDatabaseVersion name. */ + public name?: (string|null); + + /** AvailableDatabaseVersion displayName. */ + public displayName?: (string|null); + + /** + * Creates a new AvailableDatabaseVersion instance using the specified properties. + * @param [properties] Properties to set + * @returns AvailableDatabaseVersion instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IAvailableDatabaseVersion): google.cloud.sql.v1beta4.AvailableDatabaseVersion; + + /** + * Encodes the specified AvailableDatabaseVersion message. Does not implicitly {@link google.cloud.sql.v1beta4.AvailableDatabaseVersion.verify|verify} messages. + * @param message AvailableDatabaseVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IAvailableDatabaseVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AvailableDatabaseVersion message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AvailableDatabaseVersion.verify|verify} messages. + * @param message AvailableDatabaseVersion message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IAvailableDatabaseVersion, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AvailableDatabaseVersion message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AvailableDatabaseVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.AvailableDatabaseVersion; + + /** + * Decodes an AvailableDatabaseVersion message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AvailableDatabaseVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.AvailableDatabaseVersion; + + /** + * Verifies an AvailableDatabaseVersion message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AvailableDatabaseVersion message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AvailableDatabaseVersion + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.AvailableDatabaseVersion; + + /** + * Creates a plain object from an AvailableDatabaseVersion message. Also converts values to other types if specified. + * @param message AvailableDatabaseVersion + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.AvailableDatabaseVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AvailableDatabaseVersion to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AvailableDatabaseVersion + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DatabasesListResponse. */ + interface IDatabasesListResponse { + + /** DatabasesListResponse kind */ + kind?: (string|null); + + /** DatabasesListResponse items */ + items?: (google.cloud.sql.v1beta4.IDatabase[]|null); + } + + /** Represents a DatabasesListResponse. */ + class DatabasesListResponse implements IDatabasesListResponse { + + /** + * Constructs a new DatabasesListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDatabasesListResponse); + + /** DatabasesListResponse kind. */ + public kind: string; + + /** DatabasesListResponse items. */ + public items: google.cloud.sql.v1beta4.IDatabase[]; + + /** + * Creates a new DatabasesListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns DatabasesListResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDatabasesListResponse): google.cloud.sql.v1beta4.DatabasesListResponse; + + /** + * Encodes the specified DatabasesListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabasesListResponse.verify|verify} messages. + * @param message DatabasesListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDatabasesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DatabasesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabasesListResponse.verify|verify} messages. + * @param message DatabasesListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDatabasesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DatabasesListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DatabasesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabasesListResponse; + + /** + * Decodes a DatabasesListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DatabasesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabasesListResponse; + + /** + * Verifies a DatabasesListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DatabasesListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DatabasesListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabasesListResponse; + + /** + * Creates a plain object from a DatabasesListResponse message. Also converts values to other types if specified. + * @param message DatabasesListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DatabasesListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DatabasesListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DatabasesListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DemoteMasterConfiguration. */ + interface IDemoteMasterConfiguration { + + /** DemoteMasterConfiguration kind */ + kind?: (string|null); + + /** DemoteMasterConfiguration mysqlReplicaConfiguration */ + mysqlReplicaConfiguration?: (google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration|null); + } + + /** Represents a DemoteMasterConfiguration. */ + class DemoteMasterConfiguration implements IDemoteMasterConfiguration { + + /** + * Constructs a new DemoteMasterConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDemoteMasterConfiguration); + + /** DemoteMasterConfiguration kind. */ + public kind: string; + + /** DemoteMasterConfiguration mysqlReplicaConfiguration. */ + public mysqlReplicaConfiguration?: (google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration|null); + + /** + * Creates a new DemoteMasterConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns DemoteMasterConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDemoteMasterConfiguration): google.cloud.sql.v1beta4.DemoteMasterConfiguration; + + /** + * Encodes the specified DemoteMasterConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterConfiguration.verify|verify} messages. + * @param message DemoteMasterConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDemoteMasterConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DemoteMasterConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterConfiguration.verify|verify} messages. + * @param message DemoteMasterConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDemoteMasterConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DemoteMasterConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DemoteMasterConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DemoteMasterConfiguration; + + /** + * Decodes a DemoteMasterConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DemoteMasterConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DemoteMasterConfiguration; + + /** + * Verifies a DemoteMasterConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DemoteMasterConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DemoteMasterConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DemoteMasterConfiguration; + + /** + * Creates a plain object from a DemoteMasterConfiguration message. Also converts values to other types if specified. + * @param message DemoteMasterConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DemoteMasterConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DemoteMasterConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DemoteMasterConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DemoteMasterContext. */ + interface IDemoteMasterContext { + + /** DemoteMasterContext kind */ + kind?: (string|null); + + /** DemoteMasterContext verifyGtidConsistency */ + verifyGtidConsistency?: (google.protobuf.IBoolValue|null); + + /** DemoteMasterContext masterInstanceName */ + masterInstanceName?: (string|null); + + /** DemoteMasterContext replicaConfiguration */ + replicaConfiguration?: (google.cloud.sql.v1beta4.IDemoteMasterConfiguration|null); + + /** DemoteMasterContext skipReplicationSetup */ + skipReplicationSetup?: (boolean|null); + } + + /** Represents a DemoteMasterContext. */ + class DemoteMasterContext implements IDemoteMasterContext { + + /** + * Constructs a new DemoteMasterContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDemoteMasterContext); + + /** DemoteMasterContext kind. */ + public kind: string; + + /** DemoteMasterContext verifyGtidConsistency. */ + public verifyGtidConsistency?: (google.protobuf.IBoolValue|null); + + /** DemoteMasterContext masterInstanceName. */ + public masterInstanceName: string; + + /** DemoteMasterContext replicaConfiguration. */ + public replicaConfiguration?: (google.cloud.sql.v1beta4.IDemoteMasterConfiguration|null); + + /** DemoteMasterContext skipReplicationSetup. */ + public skipReplicationSetup: boolean; + + /** + * Creates a new DemoteMasterContext instance using the specified properties. + * @param [properties] Properties to set + * @returns DemoteMasterContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDemoteMasterContext): google.cloud.sql.v1beta4.DemoteMasterContext; + + /** + * Encodes the specified DemoteMasterContext message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterContext.verify|verify} messages. + * @param message DemoteMasterContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDemoteMasterContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DemoteMasterContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterContext.verify|verify} messages. + * @param message DemoteMasterContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDemoteMasterContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DemoteMasterContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DemoteMasterContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DemoteMasterContext; + + /** + * Decodes a DemoteMasterContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DemoteMasterContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DemoteMasterContext; + + /** + * Verifies a DemoteMasterContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DemoteMasterContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DemoteMasterContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DemoteMasterContext; + + /** + * Creates a plain object from a DemoteMasterContext message. Also converts values to other types if specified. + * @param message DemoteMasterContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DemoteMasterContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DemoteMasterContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DemoteMasterContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DemoteMasterMySqlReplicaConfiguration. */ + interface IDemoteMasterMySqlReplicaConfiguration { + + /** DemoteMasterMySqlReplicaConfiguration kind */ + kind?: (string|null); + + /** DemoteMasterMySqlReplicaConfiguration username */ + username?: (string|null); + + /** DemoteMasterMySqlReplicaConfiguration password */ + password?: (string|null); + + /** DemoteMasterMySqlReplicaConfiguration clientKey */ + clientKey?: (string|null); + + /** DemoteMasterMySqlReplicaConfiguration clientCertificate */ + clientCertificate?: (string|null); + + /** DemoteMasterMySqlReplicaConfiguration caCertificate */ + caCertificate?: (string|null); + } + + /** Represents a DemoteMasterMySqlReplicaConfiguration. */ + class DemoteMasterMySqlReplicaConfiguration implements IDemoteMasterMySqlReplicaConfiguration { + + /** + * Constructs a new DemoteMasterMySqlReplicaConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration); + + /** DemoteMasterMySqlReplicaConfiguration kind. */ + public kind: string; + + /** DemoteMasterMySqlReplicaConfiguration username. */ + public username: string; + + /** DemoteMasterMySqlReplicaConfiguration password. */ + public password: string; + + /** DemoteMasterMySqlReplicaConfiguration clientKey. */ + public clientKey: string; + + /** DemoteMasterMySqlReplicaConfiguration clientCertificate. */ + public clientCertificate: string; + + /** DemoteMasterMySqlReplicaConfiguration caCertificate. */ + public caCertificate: string; + + /** + * Creates a new DemoteMasterMySqlReplicaConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns DemoteMasterMySqlReplicaConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration): google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration; + + /** + * Encodes the specified DemoteMasterMySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. + * @param message DemoteMasterMySqlReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DemoteMasterMySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. + * @param message DemoteMasterMySqlReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DemoteMasterMySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration; + + /** + * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DemoteMasterMySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration; + + /** + * Verifies a DemoteMasterMySqlReplicaConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DemoteMasterMySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DemoteMasterMySqlReplicaConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration; + + /** + * Creates a plain object from a DemoteMasterMySqlReplicaConfiguration message. Also converts values to other types if specified. + * @param message DemoteMasterMySqlReplicaConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DemoteMasterMySqlReplicaConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DemoteMasterMySqlReplicaConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DemoteContext. */ + interface IDemoteContext { + + /** DemoteContext kind */ + kind?: (string|null); + + /** DemoteContext sourceRepresentativeInstanceName */ + sourceRepresentativeInstanceName?: (string|null); + } + + /** Represents a DemoteContext. */ + class DemoteContext implements IDemoteContext { + + /** + * Constructs a new DemoteContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDemoteContext); + + /** DemoteContext kind. */ + public kind: string; + + /** DemoteContext sourceRepresentativeInstanceName. */ + public sourceRepresentativeInstanceName: string; + + /** + * Creates a new DemoteContext instance using the specified properties. + * @param [properties] Properties to set + * @returns DemoteContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDemoteContext): google.cloud.sql.v1beta4.DemoteContext; + + /** + * Encodes the specified DemoteContext message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteContext.verify|verify} messages. + * @param message DemoteContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDemoteContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DemoteContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteContext.verify|verify} messages. + * @param message DemoteContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDemoteContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DemoteContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DemoteContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DemoteContext; + + /** + * Decodes a DemoteContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DemoteContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DemoteContext; + + /** + * Verifies a DemoteContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DemoteContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DemoteContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DemoteContext; + + /** + * Creates a plain object from a DemoteContext message. Also converts values to other types if specified. + * @param message DemoteContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DemoteContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DemoteContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DemoteContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlFileType enum. */ + enum SqlFileType { + SQL_FILE_TYPE_UNSPECIFIED = 0, + SQL = 1, + CSV = 2, + BAK = 4, + TDE = 8 + } + + /** Properties of an ExportContext. */ + interface IExportContext { + + /** ExportContext uri */ + uri?: (string|null); + + /** ExportContext databases */ + databases?: (string[]|null); + + /** ExportContext kind */ + kind?: (string|null); + + /** ExportContext sqlExportOptions */ + sqlExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions|null); + + /** ExportContext csvExportOptions */ + csvExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions|null); + + /** ExportContext fileType */ + fileType?: (google.cloud.sql.v1beta4.SqlFileType|keyof typeof google.cloud.sql.v1beta4.SqlFileType|null); + + /** ExportContext offload */ + offload?: (google.protobuf.IBoolValue|null); + + /** ExportContext bakExportOptions */ + bakExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions|null); + + /** ExportContext tdeExportOptions */ + tdeExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions|null); + } + + /** Represents an ExportContext. */ + class ExportContext implements IExportContext { + + /** + * Constructs a new ExportContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IExportContext); + + /** ExportContext uri. */ + public uri: string; + + /** ExportContext databases. */ + public databases: string[]; + + /** ExportContext kind. */ + public kind: string; + + /** ExportContext sqlExportOptions. */ + public sqlExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions|null); + + /** ExportContext csvExportOptions. */ + public csvExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions|null); + + /** ExportContext fileType. */ + public fileType: (google.cloud.sql.v1beta4.SqlFileType|keyof typeof google.cloud.sql.v1beta4.SqlFileType); + + /** ExportContext offload. */ + public offload?: (google.protobuf.IBoolValue|null); + + /** ExportContext bakExportOptions. */ + public bakExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions|null); + + /** ExportContext tdeExportOptions. */ + public tdeExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions|null); + + /** + * Creates a new ExportContext instance using the specified properties. + * @param [properties] Properties to set + * @returns ExportContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IExportContext): google.cloud.sql.v1beta4.ExportContext; + + /** + * Encodes the specified ExportContext message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.verify|verify} messages. + * @param message ExportContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IExportContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.verify|verify} messages. + * @param message ExportContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IExportContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExportContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext; + + /** + * Decodes an ExportContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext; + + /** + * Verifies an ExportContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExportContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExportContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext; + + /** + * Creates a plain object from an ExportContext message. Also converts values to other types if specified. + * @param message ExportContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ExportContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExportContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExportContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ExportContext { + + /** Properties of a SqlCsvExportOptions. */ + interface ISqlCsvExportOptions { + + /** SqlCsvExportOptions selectQuery */ + selectQuery?: (string|null); + + /** SqlCsvExportOptions escapeCharacter */ + escapeCharacter?: (string|null); + + /** SqlCsvExportOptions quoteCharacter */ + quoteCharacter?: (string|null); + + /** SqlCsvExportOptions fieldsTerminatedBy */ + fieldsTerminatedBy?: (string|null); + + /** SqlCsvExportOptions linesTerminatedBy */ + linesTerminatedBy?: (string|null); + } + + /** Represents a SqlCsvExportOptions. */ + class SqlCsvExportOptions implements ISqlCsvExportOptions { + + /** + * Constructs a new SqlCsvExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions); + + /** SqlCsvExportOptions selectQuery. */ + public selectQuery: string; + + /** SqlCsvExportOptions escapeCharacter. */ + public escapeCharacter: string; + + /** SqlCsvExportOptions quoteCharacter. */ + public quoteCharacter: string; + + /** SqlCsvExportOptions fieldsTerminatedBy. */ + public fieldsTerminatedBy: string; + + /** SqlCsvExportOptions linesTerminatedBy. */ + public linesTerminatedBy: string; + + /** + * Creates a new SqlCsvExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlCsvExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions; + + /** + * Encodes the specified SqlCsvExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.verify|verify} messages. + * @param message SqlCsvExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlCsvExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.verify|verify} messages. + * @param message SqlCsvExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlCsvExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlCsvExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions; + + /** + * Decodes a SqlCsvExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlCsvExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions; + + /** + * Verifies a SqlCsvExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlCsvExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlCsvExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions; + + /** + * Creates a plain object from a SqlCsvExportOptions message. Also converts values to other types if specified. + * @param message SqlCsvExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlCsvExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlCsvExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlExportOptions. */ + interface ISqlExportOptions { + + /** SqlExportOptions tables */ + tables?: (string[]|null); + + /** SqlExportOptions schemaOnly */ + schemaOnly?: (google.protobuf.IBoolValue|null); + + /** SqlExportOptions mysqlExportOptions */ + mysqlExportOptions?: (google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions|null); + + /** SqlExportOptions threads */ + threads?: (google.protobuf.IInt32Value|null); + + /** SqlExportOptions parallel */ + parallel?: (google.protobuf.IBoolValue|null); + + /** SqlExportOptions postgresExportOptions */ + postgresExportOptions?: (google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions|null); + } + + /** Represents a SqlExportOptions. */ + class SqlExportOptions implements ISqlExportOptions { + + /** + * Constructs a new SqlExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions); + + /** SqlExportOptions tables. */ + public tables: string[]; + + /** SqlExportOptions schemaOnly. */ + public schemaOnly?: (google.protobuf.IBoolValue|null); + + /** SqlExportOptions mysqlExportOptions. */ + public mysqlExportOptions?: (google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions|null); + + /** SqlExportOptions threads. */ + public threads?: (google.protobuf.IInt32Value|null); + + /** SqlExportOptions parallel. */ + public parallel?: (google.protobuf.IBoolValue|null); + + /** SqlExportOptions postgresExportOptions. */ + public postgresExportOptions?: (google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions|null); + + /** + * Creates a new SqlExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions; + + /** + * Encodes the specified SqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.verify|verify} messages. + * @param message SqlExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.verify|verify} messages. + * @param message SqlExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions; + + /** + * Decodes a SqlExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions; + + /** + * Verifies a SqlExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions; + + /** + * Creates a plain object from a SqlExportOptions message. Also converts values to other types if specified. + * @param message SqlExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlExportOptions { + + /** Properties of a MysqlExportOptions. */ + interface IMysqlExportOptions { + + /** MysqlExportOptions masterData */ + masterData?: (google.protobuf.IInt32Value|null); + } + + /** Represents a MysqlExportOptions. */ + class MysqlExportOptions implements IMysqlExportOptions { + + /** + * Constructs a new MysqlExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions); + + /** MysqlExportOptions masterData. */ + public masterData?: (google.protobuf.IInt32Value|null); + + /** + * Creates a new MysqlExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MysqlExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions; + + /** + * Encodes the specified MysqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. + * @param message MysqlExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MysqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. + * @param message MysqlExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MysqlExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MysqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions; + + /** + * Decodes a MysqlExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MysqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions; + + /** + * Verifies a MysqlExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MysqlExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MysqlExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions; + + /** + * Creates a plain object from a MysqlExportOptions message. Also converts values to other types if specified. + * @param message MysqlExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MysqlExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MysqlExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PostgresExportOptions. */ + interface IPostgresExportOptions { + + /** PostgresExportOptions clean */ + clean?: (google.protobuf.IBoolValue|null); + + /** PostgresExportOptions ifExists */ + ifExists?: (google.protobuf.IBoolValue|null); + } + + /** Represents a PostgresExportOptions. */ + class PostgresExportOptions implements IPostgresExportOptions { + + /** + * Constructs a new PostgresExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions); + + /** PostgresExportOptions clean. */ + public clean?: (google.protobuf.IBoolValue|null); + + /** PostgresExportOptions ifExists. */ + public ifExists?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new PostgresExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns PostgresExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions; + + /** + * Encodes the specified PostgresExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. + * @param message PostgresExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PostgresExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. + * @param message PostgresExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PostgresExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PostgresExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions; + + /** + * Decodes a PostgresExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PostgresExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions; + + /** + * Verifies a PostgresExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PostgresExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PostgresExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions; + + /** + * Creates a plain object from a PostgresExportOptions message. Also converts values to other types if specified. + * @param message PostgresExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PostgresExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PostgresExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SqlBakExportOptions. */ + interface ISqlBakExportOptions { + + /** SqlBakExportOptions striped */ + striped?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions stripeCount */ + stripeCount?: (google.protobuf.IInt32Value|null); + + /** SqlBakExportOptions bakType */ + bakType?: (google.cloud.sql.v1beta4.BakType|keyof typeof google.cloud.sql.v1beta4.BakType|null); + + /** SqlBakExportOptions copyOnly */ + copyOnly?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions differentialBase */ + differentialBase?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions exportLogStartTime */ + exportLogStartTime?: (google.protobuf.ITimestamp|null); + + /** SqlBakExportOptions exportLogEndTime */ + exportLogEndTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a SqlBakExportOptions. */ + class SqlBakExportOptions implements ISqlBakExportOptions { + + /** + * Constructs a new SqlBakExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions); + + /** SqlBakExportOptions striped. */ + public striped?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions stripeCount. */ + public stripeCount?: (google.protobuf.IInt32Value|null); + + /** SqlBakExportOptions bakType. */ + public bakType: (google.cloud.sql.v1beta4.BakType|keyof typeof google.cloud.sql.v1beta4.BakType); + + /** SqlBakExportOptions copyOnly. */ + public copyOnly?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions differentialBase. */ + public differentialBase?: (google.protobuf.IBoolValue|null); + + /** SqlBakExportOptions exportLogStartTime. */ + public exportLogStartTime?: (google.protobuf.ITimestamp|null); + + /** SqlBakExportOptions exportLogEndTime. */ + public exportLogEndTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new SqlBakExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBakExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions; + + /** + * Encodes the specified SqlBakExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.verify|verify} messages. + * @param message SqlBakExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBakExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.verify|verify} messages. + * @param message SqlBakExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBakExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBakExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions; + + /** + * Decodes a SqlBakExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBakExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions; + + /** + * Verifies a SqlBakExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBakExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBakExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions; + + /** + * Creates a plain object from a SqlBakExportOptions message. Also converts values to other types if specified. + * @param message SqlBakExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBakExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBakExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlTdeExportOptions. */ + interface ISqlTdeExportOptions { + + /** SqlTdeExportOptions certificatePath */ + certificatePath?: (string|null); + + /** SqlTdeExportOptions privateKeyPath */ + privateKeyPath?: (string|null); + + /** SqlTdeExportOptions privateKeyPassword */ + privateKeyPassword?: (string|null); + + /** SqlTdeExportOptions name */ + name?: (string|null); + } + + /** Represents a SqlTdeExportOptions. */ + class SqlTdeExportOptions implements ISqlTdeExportOptions { + + /** + * Constructs a new SqlTdeExportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions); + + /** SqlTdeExportOptions certificatePath. */ + public certificatePath: string; + + /** SqlTdeExportOptions privateKeyPath. */ + public privateKeyPath: string; + + /** SqlTdeExportOptions privateKeyPassword. */ + public privateKeyPassword: string; + + /** SqlTdeExportOptions name. */ + public name: string; + + /** + * Creates a new SqlTdeExportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlTdeExportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions; + + /** + * Encodes the specified SqlTdeExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.verify|verify} messages. + * @param message SqlTdeExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlTdeExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.verify|verify} messages. + * @param message SqlTdeExportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlTdeExportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlTdeExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions; + + /** + * Decodes a SqlTdeExportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlTdeExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions; + + /** + * Verifies a SqlTdeExportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlTdeExportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlTdeExportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions; + + /** + * Creates a plain object from a SqlTdeExportOptions message. Also converts values to other types if specified. + * @param message SqlTdeExportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlTdeExportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlTdeExportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a FailoverContext. */ + interface IFailoverContext { + + /** FailoverContext settingsVersion */ + settingsVersion?: (number|Long|string|null); + + /** FailoverContext kind */ + kind?: (string|null); + } + + /** Represents a FailoverContext. */ + class FailoverContext implements IFailoverContext { + + /** + * Constructs a new FailoverContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IFailoverContext); + + /** FailoverContext settingsVersion. */ + public settingsVersion: (number|Long|string); + + /** FailoverContext kind. */ + public kind: string; + + /** + * Creates a new FailoverContext instance using the specified properties. + * @param [properties] Properties to set + * @returns FailoverContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IFailoverContext): google.cloud.sql.v1beta4.FailoverContext; + + /** + * Encodes the specified FailoverContext message. Does not implicitly {@link google.cloud.sql.v1beta4.FailoverContext.verify|verify} messages. + * @param message FailoverContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IFailoverContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FailoverContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FailoverContext.verify|verify} messages. + * @param message FailoverContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IFailoverContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FailoverContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FailoverContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.FailoverContext; + + /** + * Decodes a FailoverContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FailoverContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.FailoverContext; + + /** + * Verifies a FailoverContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FailoverContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FailoverContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.FailoverContext; + + /** + * Creates a plain object from a FailoverContext message. Also converts values to other types if specified. + * @param message FailoverContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.FailoverContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FailoverContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FailoverContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Flag. */ + interface IFlag { + + /** Flag name */ + name?: (string|null); + + /** Flag type */ + type?: (google.cloud.sql.v1beta4.SqlFlagType|keyof typeof google.cloud.sql.v1beta4.SqlFlagType|null); + + /** Flag appliesTo */ + appliesTo?: (google.cloud.sql.v1beta4.SqlDatabaseVersion[]|null); + + /** Flag allowedStringValues */ + allowedStringValues?: (string[]|null); + + /** Flag minValue */ + minValue?: (google.protobuf.IInt64Value|null); + + /** Flag maxValue */ + maxValue?: (google.protobuf.IInt64Value|null); + + /** Flag requiresRestart */ + requiresRestart?: (google.protobuf.IBoolValue|null); + + /** Flag kind */ + kind?: (string|null); + + /** Flag inBeta */ + inBeta?: (google.protobuf.IBoolValue|null); + + /** Flag allowedIntValues */ + allowedIntValues?: ((number|Long|string)[]|null); + + /** Flag flagScope */ + flagScope?: (google.cloud.sql.v1beta4.SqlFlagScope|keyof typeof google.cloud.sql.v1beta4.SqlFlagScope|null); + + /** Flag recommendedStringValue */ + recommendedStringValue?: (string|null); + + /** Flag recommendedIntValue */ + recommendedIntValue?: (google.protobuf.IInt64Value|null); + } + + /** Represents a Flag. */ + class Flag implements IFlag { + + /** + * Constructs a new Flag. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IFlag); + + /** Flag name. */ + public name: string; + + /** Flag type. */ + public type: (google.cloud.sql.v1beta4.SqlFlagType|keyof typeof google.cloud.sql.v1beta4.SqlFlagType); + + /** Flag appliesTo. */ + public appliesTo: google.cloud.sql.v1beta4.SqlDatabaseVersion[]; + + /** Flag allowedStringValues. */ + public allowedStringValues: string[]; + + /** Flag minValue. */ + public minValue?: (google.protobuf.IInt64Value|null); + + /** Flag maxValue. */ + public maxValue?: (google.protobuf.IInt64Value|null); + + /** Flag requiresRestart. */ + public requiresRestart?: (google.protobuf.IBoolValue|null); + + /** Flag kind. */ + public kind: string; + + /** Flag inBeta. */ + public inBeta?: (google.protobuf.IBoolValue|null); + + /** Flag allowedIntValues. */ + public allowedIntValues: (number|Long|string)[]; + + /** Flag flagScope. */ + public flagScope: (google.cloud.sql.v1beta4.SqlFlagScope|keyof typeof google.cloud.sql.v1beta4.SqlFlagScope); + + /** Flag recommendedStringValue. */ + public recommendedStringValue?: (string|null); + + /** Flag recommendedIntValue. */ + public recommendedIntValue?: (google.protobuf.IInt64Value|null); + + /** Flag recommendedValue. */ + public recommendedValue?: ("recommendedStringValue"|"recommendedIntValue"); + + /** + * Creates a new Flag instance using the specified properties. + * @param [properties] Properties to set + * @returns Flag instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IFlag): google.cloud.sql.v1beta4.Flag; + + /** + * Encodes the specified Flag message. Does not implicitly {@link google.cloud.sql.v1beta4.Flag.verify|verify} messages. + * @param message Flag message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IFlag, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Flag message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Flag.verify|verify} messages. + * @param message Flag message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IFlag, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Flag message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Flag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Flag; + + /** + * Decodes a Flag message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Flag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Flag; + + /** + * Verifies a Flag message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Flag message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Flag + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Flag; + + /** + * Creates a plain object from a Flag message. Also converts values to other types if specified. + * @param message Flag + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.Flag, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Flag to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Flag + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FlagsListResponse. */ + interface IFlagsListResponse { + + /** FlagsListResponse kind */ + kind?: (string|null); + + /** FlagsListResponse items */ + items?: (google.cloud.sql.v1beta4.IFlag[]|null); + } + + /** Represents a FlagsListResponse. */ + class FlagsListResponse implements IFlagsListResponse { + + /** + * Constructs a new FlagsListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IFlagsListResponse); + + /** FlagsListResponse kind. */ + public kind: string; + + /** FlagsListResponse items. */ + public items: google.cloud.sql.v1beta4.IFlag[]; + + /** + * Creates a new FlagsListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns FlagsListResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IFlagsListResponse): google.cloud.sql.v1beta4.FlagsListResponse; + + /** + * Encodes the specified FlagsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.FlagsListResponse.verify|verify} messages. + * @param message FlagsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IFlagsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FlagsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FlagsListResponse.verify|verify} messages. + * @param message FlagsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IFlagsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FlagsListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FlagsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.FlagsListResponse; + + /** + * Decodes a FlagsListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FlagsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.FlagsListResponse; + + /** + * Verifies a FlagsListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FlagsListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FlagsListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.FlagsListResponse; + + /** + * Creates a plain object from a FlagsListResponse message. Also converts values to other types if specified. + * @param message FlagsListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.FlagsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FlagsListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FlagsListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an ImportContext. */ + interface IImportContext { + + /** ImportContext uri */ + uri?: (string|null); + + /** ImportContext database */ + database?: (string|null); + + /** ImportContext kind */ + kind?: (string|null); + + /** ImportContext fileType */ + fileType?: (google.cloud.sql.v1beta4.SqlFileType|keyof typeof google.cloud.sql.v1beta4.SqlFileType|null); + + /** ImportContext csvImportOptions */ + csvImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions|null); + + /** ImportContext importUser */ + importUser?: (string|null); + + /** ImportContext bakImportOptions */ + bakImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions|null); + + /** ImportContext sqlImportOptions */ + sqlImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions|null); + + /** ImportContext tdeImportOptions */ + tdeImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions|null); + } + + /** Represents an ImportContext. */ + class ImportContext implements IImportContext { + + /** + * Constructs a new ImportContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IImportContext); + + /** ImportContext uri. */ + public uri: string; + + /** ImportContext database. */ + public database: string; + + /** ImportContext kind. */ + public kind: string; + + /** ImportContext fileType. */ + public fileType: (google.cloud.sql.v1beta4.SqlFileType|keyof typeof google.cloud.sql.v1beta4.SqlFileType); + + /** ImportContext csvImportOptions. */ + public csvImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions|null); + + /** ImportContext importUser. */ + public importUser: string; + + /** ImportContext bakImportOptions. */ + public bakImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions|null); + + /** ImportContext sqlImportOptions. */ + public sqlImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions|null); + + /** ImportContext tdeImportOptions. */ + public tdeImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions|null); + + /** + * Creates a new ImportContext instance using the specified properties. + * @param [properties] Properties to set + * @returns ImportContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IImportContext): google.cloud.sql.v1beta4.ImportContext; + + /** + * Encodes the specified ImportContext message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.verify|verify} messages. + * @param message ImportContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IImportContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ImportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.verify|verify} messages. + * @param message ImportContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IImportContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ImportContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ImportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext; + + /** + * Decodes an ImportContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ImportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext; + + /** + * Verifies an ImportContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ImportContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ImportContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext; + + /** + * Creates a plain object from an ImportContext message. Also converts values to other types if specified. + * @param message ImportContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ImportContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ImportContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ImportContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ImportContext { + + /** Properties of a SqlImportOptions. */ + interface ISqlImportOptions { + + /** SqlImportOptions threads */ + threads?: (google.protobuf.IInt32Value|null); + + /** SqlImportOptions parallel */ + parallel?: (google.protobuf.IBoolValue|null); + + /** SqlImportOptions postgresImportOptions */ + postgresImportOptions?: (google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions|null); + } + + /** Represents a SqlImportOptions. */ + class SqlImportOptions implements ISqlImportOptions { + + /** + * Constructs a new SqlImportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions); + + /** SqlImportOptions threads. */ + public threads?: (google.protobuf.IInt32Value|null); + + /** SqlImportOptions parallel. */ + public parallel?: (google.protobuf.IBoolValue|null); + + /** SqlImportOptions postgresImportOptions. */ + public postgresImportOptions?: (google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions|null); + + /** + * Creates a new SqlImportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlImportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions; + + /** + * Encodes the specified SqlImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.verify|verify} messages. + * @param message SqlImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.verify|verify} messages. + * @param message SqlImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlImportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions; + + /** + * Decodes a SqlImportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions; + + /** + * Verifies a SqlImportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlImportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlImportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions; + + /** + * Creates a plain object from a SqlImportOptions message. Also converts values to other types if specified. + * @param message SqlImportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlImportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlImportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlImportOptions { + + /** Properties of a PostgresImportOptions. */ + interface IPostgresImportOptions { + + /** PostgresImportOptions clean */ + clean?: (google.protobuf.IBoolValue|null); + + /** PostgresImportOptions ifExists */ + ifExists?: (google.protobuf.IBoolValue|null); + } + + /** Represents a PostgresImportOptions. */ + class PostgresImportOptions implements IPostgresImportOptions { + + /** + * Constructs a new PostgresImportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions); + + /** PostgresImportOptions clean. */ + public clean?: (google.protobuf.IBoolValue|null); + + /** PostgresImportOptions ifExists. */ + public ifExists?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new PostgresImportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns PostgresImportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions; + + /** + * Encodes the specified PostgresImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. + * @param message PostgresImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PostgresImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. + * @param message PostgresImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PostgresImportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PostgresImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions; + + /** + * Decodes a PostgresImportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PostgresImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions; + + /** + * Verifies a PostgresImportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PostgresImportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PostgresImportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions; + + /** + * Creates a plain object from a PostgresImportOptions message. Also converts values to other types if specified. + * @param message PostgresImportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PostgresImportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PostgresImportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SqlCsvImportOptions. */ + interface ISqlCsvImportOptions { + + /** SqlCsvImportOptions table */ + table?: (string|null); + + /** SqlCsvImportOptions columns */ + columns?: (string[]|null); + + /** SqlCsvImportOptions escapeCharacter */ + escapeCharacter?: (string|null); + + /** SqlCsvImportOptions quoteCharacter */ + quoteCharacter?: (string|null); + + /** SqlCsvImportOptions fieldsTerminatedBy */ + fieldsTerminatedBy?: (string|null); + + /** SqlCsvImportOptions linesTerminatedBy */ + linesTerminatedBy?: (string|null); + } + + /** Represents a SqlCsvImportOptions. */ + class SqlCsvImportOptions implements ISqlCsvImportOptions { + + /** + * Constructs a new SqlCsvImportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions); + + /** SqlCsvImportOptions table. */ + public table: string; + + /** SqlCsvImportOptions columns. */ + public columns: string[]; + + /** SqlCsvImportOptions escapeCharacter. */ + public escapeCharacter: string; + + /** SqlCsvImportOptions quoteCharacter. */ + public quoteCharacter: string; + + /** SqlCsvImportOptions fieldsTerminatedBy. */ + public fieldsTerminatedBy: string; + + /** SqlCsvImportOptions linesTerminatedBy. */ + public linesTerminatedBy: string; + + /** + * Creates a new SqlCsvImportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlCsvImportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions): google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions; + + /** + * Encodes the specified SqlCsvImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.verify|verify} messages. + * @param message SqlCsvImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlCsvImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.verify|verify} messages. + * @param message SqlCsvImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlCsvImportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlCsvImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions; + + /** + * Decodes a SqlCsvImportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlCsvImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions; + + /** + * Verifies a SqlCsvImportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlCsvImportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlCsvImportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions; + + /** + * Creates a plain object from a SqlCsvImportOptions message. Also converts values to other types if specified. + * @param message SqlCsvImportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlCsvImportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlCsvImportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlBakImportOptions. */ + interface ISqlBakImportOptions { + + /** SqlBakImportOptions encryptionOptions */ + encryptionOptions?: (google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions|null); + + /** SqlBakImportOptions striped */ + striped?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions noRecovery */ + noRecovery?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions recoveryOnly */ + recoveryOnly?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions bakType */ + bakType?: (google.cloud.sql.v1beta4.BakType|keyof typeof google.cloud.sql.v1beta4.BakType|null); + + /** SqlBakImportOptions stopAt */ + stopAt?: (google.protobuf.ITimestamp|null); + + /** SqlBakImportOptions stopAtMark */ + stopAtMark?: (string|null); + } + + /** Represents a SqlBakImportOptions. */ + class SqlBakImportOptions implements ISqlBakImportOptions { + + /** + * Constructs a new SqlBakImportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions); + + /** SqlBakImportOptions encryptionOptions. */ + public encryptionOptions?: (google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions|null); + + /** SqlBakImportOptions striped. */ + public striped?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions noRecovery. */ + public noRecovery?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions recoveryOnly. */ + public recoveryOnly?: (google.protobuf.IBoolValue|null); + + /** SqlBakImportOptions bakType. */ + public bakType: (google.cloud.sql.v1beta4.BakType|keyof typeof google.cloud.sql.v1beta4.BakType); + + /** SqlBakImportOptions stopAt. */ + public stopAt?: (google.protobuf.ITimestamp|null); + + /** SqlBakImportOptions stopAtMark. */ + public stopAtMark: string; + + /** + * Creates a new SqlBakImportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlBakImportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions; + + /** + * Encodes the specified SqlBakImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.verify|verify} messages. + * @param message SqlBakImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlBakImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.verify|verify} messages. + * @param message SqlBakImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlBakImportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlBakImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions; + + /** + * Decodes a SqlBakImportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlBakImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions; + + /** + * Verifies a SqlBakImportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlBakImportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlBakImportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions; + + /** + * Creates a plain object from a SqlBakImportOptions message. Also converts values to other types if specified. + * @param message SqlBakImportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlBakImportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlBakImportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlBakImportOptions { + + /** Properties of an EncryptionOptions. */ + interface IEncryptionOptions { + + /** EncryptionOptions certPath */ + certPath?: (string|null); + + /** EncryptionOptions pvkPath */ + pvkPath?: (string|null); + + /** EncryptionOptions pvkPassword */ + pvkPassword?: (string|null); + + /** EncryptionOptions keepEncrypted */ + keepEncrypted?: (google.protobuf.IBoolValue|null); + } + + /** Represents an EncryptionOptions. */ + class EncryptionOptions implements IEncryptionOptions { + + /** + * Constructs a new EncryptionOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions); + + /** EncryptionOptions certPath. */ + public certPath: string; + + /** EncryptionOptions pvkPath. */ + public pvkPath: string; + + /** EncryptionOptions pvkPassword. */ + public pvkPassword: string; + + /** EncryptionOptions keepEncrypted. */ + public keepEncrypted?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new EncryptionOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EncryptionOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions; + + /** + * Encodes the specified EncryptionOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. + * @param message EncryptionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EncryptionOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. + * @param message EncryptionOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EncryptionOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions; + + /** + * Decodes an EncryptionOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions; + + /** + * Verifies an EncryptionOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EncryptionOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EncryptionOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions; + + /** + * Creates a plain object from an EncryptionOptions message. Also converts values to other types if specified. + * @param message EncryptionOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EncryptionOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EncryptionOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SqlTdeImportOptions. */ + interface ISqlTdeImportOptions { + + /** SqlTdeImportOptions certificatePath */ + certificatePath?: (string|null); + + /** SqlTdeImportOptions privateKeyPath */ + privateKeyPath?: (string|null); + + /** SqlTdeImportOptions privateKeyPassword */ + privateKeyPassword?: (string|null); + + /** SqlTdeImportOptions name */ + name?: (string|null); + } + + /** Represents a SqlTdeImportOptions. */ + class SqlTdeImportOptions implements ISqlTdeImportOptions { + + /** + * Constructs a new SqlTdeImportOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions); + + /** SqlTdeImportOptions certificatePath. */ + public certificatePath: string; + + /** SqlTdeImportOptions privateKeyPath. */ + public privateKeyPath: string; + + /** SqlTdeImportOptions privateKeyPassword. */ + public privateKeyPassword: string; + + /** SqlTdeImportOptions name. */ + public name: string; + + /** + * Creates a new SqlTdeImportOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlTdeImportOptions instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions): google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions; + + /** + * Encodes the specified SqlTdeImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.verify|verify} messages. + * @param message SqlTdeImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlTdeImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.verify|verify} messages. + * @param message SqlTdeImportOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlTdeImportOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlTdeImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions; + + /** + * Decodes a SqlTdeImportOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlTdeImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions; + + /** + * Verifies a SqlTdeImportOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlTdeImportOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlTdeImportOptions + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions; + + /** + * Creates a plain object from a SqlTdeImportOptions message. Also converts values to other types if specified. + * @param message SqlTdeImportOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlTdeImportOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlTdeImportOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** BakType enum. */ + enum BakType { + BAK_TYPE_UNSPECIFIED = 0, + FULL = 1, + DIFF = 2, + TLOG = 3 + } + + /** Properties of an InstancesCloneRequest. */ + interface IInstancesCloneRequest { + + /** InstancesCloneRequest cloneContext */ + cloneContext?: (google.cloud.sql.v1beta4.ICloneContext|null); + } + + /** Represents an InstancesCloneRequest. */ + class InstancesCloneRequest implements IInstancesCloneRequest { + + /** + * Constructs a new InstancesCloneRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesCloneRequest); + + /** InstancesCloneRequest cloneContext. */ + public cloneContext?: (google.cloud.sql.v1beta4.ICloneContext|null); + + /** + * Creates a new InstancesCloneRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesCloneRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesCloneRequest): google.cloud.sql.v1beta4.InstancesCloneRequest; + + /** + * Encodes the specified InstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesCloneRequest.verify|verify} messages. + * @param message InstancesCloneRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesCloneRequest.verify|verify} messages. + * @param message InstancesCloneRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesCloneRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesCloneRequest; + + /** + * Decodes an InstancesCloneRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesCloneRequest; + + /** + * Verifies an InstancesCloneRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesCloneRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesCloneRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesCloneRequest; + + /** + * Creates a plain object from an InstancesCloneRequest message. Also converts values to other types if specified. + * @param message InstancesCloneRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesCloneRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesCloneRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesCloneRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesDemoteMasterRequest. */ + interface IInstancesDemoteMasterRequest { + + /** InstancesDemoteMasterRequest demoteMasterContext */ + demoteMasterContext?: (google.cloud.sql.v1beta4.IDemoteMasterContext|null); + } + + /** Represents an InstancesDemoteMasterRequest. */ + class InstancesDemoteMasterRequest implements IInstancesDemoteMasterRequest { + + /** + * Constructs a new InstancesDemoteMasterRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest); + + /** InstancesDemoteMasterRequest demoteMasterContext. */ + public demoteMasterContext?: (google.cloud.sql.v1beta4.IDemoteMasterContext|null); + + /** + * Creates a new InstancesDemoteMasterRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesDemoteMasterRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest): google.cloud.sql.v1beta4.InstancesDemoteMasterRequest; + + /** + * Encodes the specified InstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.verify|verify} messages. + * @param message InstancesDemoteMasterRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.verify|verify} messages. + * @param message InstancesDemoteMasterRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesDemoteMasterRequest; + + /** + * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesDemoteMasterRequest; + + /** + * Verifies an InstancesDemoteMasterRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesDemoteMasterRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesDemoteMasterRequest; + + /** + * Creates a plain object from an InstancesDemoteMasterRequest message. Also converts values to other types if specified. + * @param message InstancesDemoteMasterRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesDemoteMasterRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesDemoteMasterRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesDemoteMasterRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesDemoteRequest. */ + interface IInstancesDemoteRequest { + + /** InstancesDemoteRequest demoteContext */ + demoteContext?: (google.cloud.sql.v1beta4.IDemoteContext|null); + } + + /** Represents an InstancesDemoteRequest. */ + class InstancesDemoteRequest implements IInstancesDemoteRequest { + + /** + * Constructs a new InstancesDemoteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesDemoteRequest); + + /** InstancesDemoteRequest demoteContext. */ + public demoteContext?: (google.cloud.sql.v1beta4.IDemoteContext|null); + + /** + * Creates a new InstancesDemoteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesDemoteRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesDemoteRequest): google.cloud.sql.v1beta4.InstancesDemoteRequest; + + /** + * Encodes the specified InstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteRequest.verify|verify} messages. + * @param message InstancesDemoteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteRequest.verify|verify} messages. + * @param message InstancesDemoteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesDemoteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesDemoteRequest; + + /** + * Decodes an InstancesDemoteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesDemoteRequest; + + /** + * Verifies an InstancesDemoteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesDemoteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesDemoteRequest; + + /** + * Creates a plain object from an InstancesDemoteRequest message. Also converts values to other types if specified. + * @param message InstancesDemoteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesDemoteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesDemoteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesDemoteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesExportRequest. */ + interface IInstancesExportRequest { + + /** InstancesExportRequest exportContext */ + exportContext?: (google.cloud.sql.v1beta4.IExportContext|null); + } + + /** Represents an InstancesExportRequest. */ + class InstancesExportRequest implements IInstancesExportRequest { + + /** + * Constructs a new InstancesExportRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesExportRequest); + + /** InstancesExportRequest exportContext. */ + public exportContext?: (google.cloud.sql.v1beta4.IExportContext|null); + + /** + * Creates a new InstancesExportRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesExportRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesExportRequest): google.cloud.sql.v1beta4.InstancesExportRequest; + + /** + * Encodes the specified InstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesExportRequest.verify|verify} messages. + * @param message InstancesExportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesExportRequest.verify|verify} messages. + * @param message InstancesExportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesExportRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesExportRequest; + + /** + * Decodes an InstancesExportRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesExportRequest; + + /** + * Verifies an InstancesExportRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesExportRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesExportRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesExportRequest; + + /** + * Creates a plain object from an InstancesExportRequest message. Also converts values to other types if specified. + * @param message InstancesExportRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesExportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesExportRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesExportRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesFailoverRequest. */ + interface IInstancesFailoverRequest { + + /** InstancesFailoverRequest failoverContext */ + failoverContext?: (google.cloud.sql.v1beta4.IFailoverContext|null); + } + + /** Represents an InstancesFailoverRequest. */ + class InstancesFailoverRequest implements IInstancesFailoverRequest { + + /** + * Constructs a new InstancesFailoverRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesFailoverRequest); + + /** InstancesFailoverRequest failoverContext. */ + public failoverContext?: (google.cloud.sql.v1beta4.IFailoverContext|null); + + /** + * Creates a new InstancesFailoverRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesFailoverRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesFailoverRequest): google.cloud.sql.v1beta4.InstancesFailoverRequest; + + /** + * Encodes the specified InstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesFailoverRequest.verify|verify} messages. + * @param message InstancesFailoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesFailoverRequest.verify|verify} messages. + * @param message InstancesFailoverRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesFailoverRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesFailoverRequest; + + /** + * Decodes an InstancesFailoverRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesFailoverRequest; + + /** + * Verifies an InstancesFailoverRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesFailoverRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesFailoverRequest; + + /** + * Creates a plain object from an InstancesFailoverRequest message. Also converts values to other types if specified. + * @param message InstancesFailoverRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesFailoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesFailoverRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesFailoverRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesImportRequest. */ + interface IInstancesImportRequest { + + /** InstancesImportRequest importContext */ + importContext?: (google.cloud.sql.v1beta4.IImportContext|null); + } + + /** Represents an InstancesImportRequest. */ + class InstancesImportRequest implements IInstancesImportRequest { + + /** + * Constructs a new InstancesImportRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesImportRequest); + + /** InstancesImportRequest importContext. */ + public importContext?: (google.cloud.sql.v1beta4.IImportContext|null); + + /** + * Creates a new InstancesImportRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesImportRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesImportRequest): google.cloud.sql.v1beta4.InstancesImportRequest; + + /** + * Encodes the specified InstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesImportRequest.verify|verify} messages. + * @param message InstancesImportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesImportRequest.verify|verify} messages. + * @param message InstancesImportRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesImportRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesImportRequest; + + /** + * Decodes an InstancesImportRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesImportRequest; + + /** + * Verifies an InstancesImportRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesImportRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesImportRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesImportRequest; + + /** + * Creates a plain object from an InstancesImportRequest message. Also converts values to other types if specified. + * @param message InstancesImportRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesImportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesImportRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesImportRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesPreCheckMajorVersionUpgradeRequest. */ + interface IInstancesPreCheckMajorVersionUpgradeRequest { + + /** InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext */ + preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null); + } + + /** Represents an InstancesPreCheckMajorVersionUpgradeRequest. */ + class InstancesPreCheckMajorVersionUpgradeRequest implements IInstancesPreCheckMajorVersionUpgradeRequest { + + /** + * Constructs a new InstancesPreCheckMajorVersionUpgradeRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest); + + /** InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext. */ + public preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null); + + /** + * Creates a new InstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesPreCheckMajorVersionUpgradeRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest): google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @param message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @param message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Verifies an InstancesPreCheckMajorVersionUpgradeRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesPreCheckMajorVersionUpgradeRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest; + + /** + * Creates a plain object from an InstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. + * @param message InstancesPreCheckMajorVersionUpgradeRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesPreCheckMajorVersionUpgradeRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesPreCheckMajorVersionUpgradeRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MySqlSyncConfig. */ + interface IMySqlSyncConfig { + + /** MySqlSyncConfig initialSyncFlags */ + initialSyncFlags?: (google.cloud.sql.v1beta4.ISyncFlags[]|null); + } + + /** Represents a MySqlSyncConfig. */ + class MySqlSyncConfig implements IMySqlSyncConfig { + + /** + * Constructs a new MySqlSyncConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IMySqlSyncConfig); + + /** MySqlSyncConfig initialSyncFlags. */ + public initialSyncFlags: google.cloud.sql.v1beta4.ISyncFlags[]; + + /** + * Creates a new MySqlSyncConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns MySqlSyncConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IMySqlSyncConfig): google.cloud.sql.v1beta4.MySqlSyncConfig; + + /** + * Encodes the specified MySqlSyncConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlSyncConfig.verify|verify} messages. + * @param message MySqlSyncConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IMySqlSyncConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MySqlSyncConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlSyncConfig.verify|verify} messages. + * @param message MySqlSyncConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IMySqlSyncConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MySqlSyncConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MySqlSyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.MySqlSyncConfig; + + /** + * Decodes a MySqlSyncConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MySqlSyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.MySqlSyncConfig; + + /** + * Verifies a MySqlSyncConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MySqlSyncConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MySqlSyncConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.MySqlSyncConfig; + + /** + * Creates a plain object from a MySqlSyncConfig message. Also converts values to other types if specified. + * @param message MySqlSyncConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.MySqlSyncConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MySqlSyncConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MySqlSyncConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesListResponse. */ + interface IInstancesListResponse { + + /** InstancesListResponse kind */ + kind?: (string|null); + + /** InstancesListResponse warnings */ + warnings?: (google.cloud.sql.v1beta4.IApiWarning[]|null); + + /** InstancesListResponse items */ + items?: (google.cloud.sql.v1beta4.IDatabaseInstance[]|null); + + /** InstancesListResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents an InstancesListResponse. */ + class InstancesListResponse implements IInstancesListResponse { + + /** + * Constructs a new InstancesListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesListResponse); + + /** InstancesListResponse kind. */ + public kind: string; + + /** InstancesListResponse warnings. */ + public warnings: google.cloud.sql.v1beta4.IApiWarning[]; + + /** InstancesListResponse items. */ + public items: google.cloud.sql.v1beta4.IDatabaseInstance[]; + + /** InstancesListResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new InstancesListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesListResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesListResponse): google.cloud.sql.v1beta4.InstancesListResponse; + + /** + * Encodes the specified InstancesListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListResponse.verify|verify} messages. + * @param message InstancesListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListResponse.verify|verify} messages. + * @param message InstancesListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesListResponse; + + /** + * Decodes an InstancesListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesListResponse; + + /** + * Verifies an InstancesListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesListResponse; + + /** + * Creates a plain object from an InstancesListResponse message. Also converts values to other types if specified. + * @param message InstancesListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesListServerCasResponse. */ + interface IInstancesListServerCasResponse { + + /** InstancesListServerCasResponse certs */ + certs?: (google.cloud.sql.v1beta4.ISslCert[]|null); + + /** InstancesListServerCasResponse activeVersion */ + activeVersion?: (string|null); + + /** InstancesListServerCasResponse kind */ + kind?: (string|null); + } + + /** Represents an InstancesListServerCasResponse. */ + class InstancesListServerCasResponse implements IInstancesListServerCasResponse { + + /** + * Constructs a new InstancesListServerCasResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesListServerCasResponse); + + /** InstancesListServerCasResponse certs. */ + public certs: google.cloud.sql.v1beta4.ISslCert[]; + + /** InstancesListServerCasResponse activeVersion. */ + public activeVersion: string; + + /** InstancesListServerCasResponse kind. */ + public kind: string; + + /** + * Creates a new InstancesListServerCasResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesListServerCasResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesListServerCasResponse): google.cloud.sql.v1beta4.InstancesListServerCasResponse; + + /** + * Encodes the specified InstancesListServerCasResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCasResponse.verify|verify} messages. + * @param message InstancesListServerCasResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesListServerCasResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesListServerCasResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCasResponse.verify|verify} messages. + * @param message InstancesListServerCasResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesListServerCasResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesListServerCasResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesListServerCasResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesListServerCasResponse; + + /** + * Decodes an InstancesListServerCasResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesListServerCasResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesListServerCasResponse; + + /** + * Verifies an InstancesListServerCasResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesListServerCasResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesListServerCasResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesListServerCasResponse; + + /** + * Creates a plain object from an InstancesListServerCasResponse message. Also converts values to other types if specified. + * @param message InstancesListServerCasResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesListServerCasResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesListServerCasResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesListServerCasResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesListServerCertificatesResponse. */ + interface IInstancesListServerCertificatesResponse { + + /** InstancesListServerCertificatesResponse caCerts */ + caCerts?: (google.cloud.sql.v1beta4.ISslCert[]|null); + + /** InstancesListServerCertificatesResponse serverCerts */ + serverCerts?: (google.cloud.sql.v1beta4.ISslCert[]|null); + + /** InstancesListServerCertificatesResponse activeVersion */ + activeVersion?: (string|null); + + /** InstancesListServerCertificatesResponse kind */ + kind?: (string|null); + } + + /** Represents an InstancesListServerCertificatesResponse. */ + class InstancesListServerCertificatesResponse implements IInstancesListServerCertificatesResponse { + + /** + * Constructs a new InstancesListServerCertificatesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse); + + /** InstancesListServerCertificatesResponse caCerts. */ + public caCerts: google.cloud.sql.v1beta4.ISslCert[]; + + /** InstancesListServerCertificatesResponse serverCerts. */ + public serverCerts: google.cloud.sql.v1beta4.ISslCert[]; + + /** InstancesListServerCertificatesResponse activeVersion. */ + public activeVersion: string; + + /** InstancesListServerCertificatesResponse kind. */ + public kind: string; + + /** + * Creates a new InstancesListServerCertificatesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesListServerCertificatesResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse): google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse; + + /** + * Encodes the specified InstancesListServerCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.verify|verify} messages. + * @param message InstancesListServerCertificatesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesListServerCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.verify|verify} messages. + * @param message InstancesListServerCertificatesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesListServerCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse; + + /** + * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesListServerCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse; + + /** + * Verifies an InstancesListServerCertificatesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesListServerCertificatesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesListServerCertificatesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse; + + /** + * Creates a plain object from an InstancesListServerCertificatesResponse message. Also converts values to other types if specified. + * @param message InstancesListServerCertificatesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesListServerCertificatesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesListServerCertificatesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesListEntraIdCertificatesResponse. */ + interface IInstancesListEntraIdCertificatesResponse { + + /** InstancesListEntraIdCertificatesResponse certs */ + certs?: (google.cloud.sql.v1beta4.ISslCert[]|null); + + /** InstancesListEntraIdCertificatesResponse activeVersion */ + activeVersion?: (string|null); + + /** InstancesListEntraIdCertificatesResponse kind */ + kind?: (string|null); + } + + /** Represents an InstancesListEntraIdCertificatesResponse. */ + class InstancesListEntraIdCertificatesResponse implements IInstancesListEntraIdCertificatesResponse { + + /** + * Constructs a new InstancesListEntraIdCertificatesResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse); + + /** InstancesListEntraIdCertificatesResponse certs. */ + public certs: google.cloud.sql.v1beta4.ISslCert[]; + + /** InstancesListEntraIdCertificatesResponse activeVersion. */ + public activeVersion: string; + + /** InstancesListEntraIdCertificatesResponse kind. */ + public kind: string; + + /** + * Creates a new InstancesListEntraIdCertificatesResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesListEntraIdCertificatesResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse): google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse; + + /** + * Encodes the specified InstancesListEntraIdCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.verify|verify} messages. + * @param message InstancesListEntraIdCertificatesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesListEntraIdCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.verify|verify} messages. + * @param message InstancesListEntraIdCertificatesResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesListEntraIdCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse; + + /** + * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesListEntraIdCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse; + + /** + * Verifies an InstancesListEntraIdCertificatesResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesListEntraIdCertificatesResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesListEntraIdCertificatesResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse; + + /** + * Creates a plain object from an InstancesListEntraIdCertificatesResponse message. Also converts values to other types if specified. + * @param message InstancesListEntraIdCertificatesResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesListEntraIdCertificatesResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesListEntraIdCertificatesResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesRestoreBackupRequest. */ + interface IInstancesRestoreBackupRequest { + + /** InstancesRestoreBackupRequest restoreBackupContext */ + restoreBackupContext?: (google.cloud.sql.v1beta4.IRestoreBackupContext|null); + + /** InstancesRestoreBackupRequest backup */ + backup?: (string|null); + + /** InstancesRestoreBackupRequest backupdrBackup */ + backupdrBackup?: (string|null); + + /** InstancesRestoreBackupRequest restoreInstanceSettings */ + restoreInstanceSettings?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); + + /** InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames */ + restoreInstanceClearOverridesFieldNames?: (string[]|null); + } + + /** Represents an InstancesRestoreBackupRequest. */ + class InstancesRestoreBackupRequest implements IInstancesRestoreBackupRequest { + + /** + * Constructs a new InstancesRestoreBackupRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest); + + /** InstancesRestoreBackupRequest restoreBackupContext. */ + public restoreBackupContext?: (google.cloud.sql.v1beta4.IRestoreBackupContext|null); + + /** InstancesRestoreBackupRequest backup. */ + public backup: string; + + /** InstancesRestoreBackupRequest backupdrBackup. */ + public backupdrBackup: string; + + /** InstancesRestoreBackupRequest restoreInstanceSettings. */ + public restoreInstanceSettings?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); + + /** InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames. */ + public restoreInstanceClearOverridesFieldNames: string[]; + + /** + * Creates a new InstancesRestoreBackupRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesRestoreBackupRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest): google.cloud.sql.v1beta4.InstancesRestoreBackupRequest; + + /** + * Encodes the specified InstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.verify|verify} messages. + * @param message InstancesRestoreBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.verify|verify} messages. + * @param message InstancesRestoreBackupRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesRestoreBackupRequest; + + /** + * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesRestoreBackupRequest; + + /** + * Verifies an InstancesRestoreBackupRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesRestoreBackupRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesRestoreBackupRequest; + + /** + * Creates a plain object from an InstancesRestoreBackupRequest message. Also converts values to other types if specified. + * @param message InstancesRestoreBackupRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesRestoreBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesRestoreBackupRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesRestoreBackupRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesRotateServerCaRequest. */ + interface IInstancesRotateServerCaRequest { + + /** InstancesRotateServerCaRequest rotateServerCaContext */ + rotateServerCaContext?: (google.cloud.sql.v1beta4.IRotateServerCaContext|null); + } + + /** Represents an InstancesRotateServerCaRequest. */ + class InstancesRotateServerCaRequest implements IInstancesRotateServerCaRequest { + + /** + * Constructs a new InstancesRotateServerCaRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest); + + /** InstancesRotateServerCaRequest rotateServerCaContext. */ + public rotateServerCaContext?: (google.cloud.sql.v1beta4.IRotateServerCaContext|null); + + /** + * Creates a new InstancesRotateServerCaRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesRotateServerCaRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest): google.cloud.sql.v1beta4.InstancesRotateServerCaRequest; + + /** + * Encodes the specified InstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.verify|verify} messages. + * @param message InstancesRotateServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.verify|verify} messages. + * @param message InstancesRotateServerCaRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesRotateServerCaRequest; + + /** + * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesRotateServerCaRequest; + + /** + * Verifies an InstancesRotateServerCaRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesRotateServerCaRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesRotateServerCaRequest; + + /** + * Creates a plain object from an InstancesRotateServerCaRequest message. Also converts values to other types if specified. + * @param message InstancesRotateServerCaRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesRotateServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesRotateServerCaRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesRotateServerCaRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesRotateServerCertificateRequest. */ + interface IInstancesRotateServerCertificateRequest { + + /** InstancesRotateServerCertificateRequest rotateServerCertificateContext */ + rotateServerCertificateContext?: (google.cloud.sql.v1beta4.IRotateServerCertificateContext|null); + } + + /** Represents an InstancesRotateServerCertificateRequest. */ + class InstancesRotateServerCertificateRequest implements IInstancesRotateServerCertificateRequest { + + /** + * Constructs a new InstancesRotateServerCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest); + + /** InstancesRotateServerCertificateRequest rotateServerCertificateContext. */ + public rotateServerCertificateContext?: (google.cloud.sql.v1beta4.IRotateServerCertificateContext|null); + + /** + * Creates a new InstancesRotateServerCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesRotateServerCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest): google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest; + + /** + * Encodes the specified InstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.verify|verify} messages. + * @param message InstancesRotateServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.verify|verify} messages. + * @param message InstancesRotateServerCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest; + + /** + * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest; + + /** + * Verifies an InstancesRotateServerCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesRotateServerCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest; + + /** + * Creates a plain object from an InstancesRotateServerCertificateRequest message. Also converts values to other types if specified. + * @param message InstancesRotateServerCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesRotateServerCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesRotateServerCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesRotateEntraIdCertificateRequest. */ + interface IInstancesRotateEntraIdCertificateRequest { + + /** InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext */ + rotateEntraIdCertificateContext?: (google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext|null); + } + + /** Represents an InstancesRotateEntraIdCertificateRequest. */ + class InstancesRotateEntraIdCertificateRequest implements IInstancesRotateEntraIdCertificateRequest { + + /** + * Constructs a new InstancesRotateEntraIdCertificateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest); + + /** InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext. */ + public rotateEntraIdCertificateContext?: (google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext|null); + + /** + * Creates a new InstancesRotateEntraIdCertificateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesRotateEntraIdCertificateRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest): google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest; + + /** + * Encodes the specified InstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @param message InstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @param message InstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest; + + /** + * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest; + + /** + * Verifies an InstancesRotateEntraIdCertificateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesRotateEntraIdCertificateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest; + + /** + * Creates a plain object from an InstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. + * @param message InstancesRotateEntraIdCertificateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesRotateEntraIdCertificateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesRotateEntraIdCertificateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesTruncateLogRequest. */ + interface IInstancesTruncateLogRequest { + + /** InstancesTruncateLogRequest truncateLogContext */ + truncateLogContext?: (google.cloud.sql.v1beta4.ITruncateLogContext|null); + } + + /** Represents an InstancesTruncateLogRequest. */ + class InstancesTruncateLogRequest implements IInstancesTruncateLogRequest { + + /** + * Constructs a new InstancesTruncateLogRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesTruncateLogRequest); + + /** InstancesTruncateLogRequest truncateLogContext. */ + public truncateLogContext?: (google.cloud.sql.v1beta4.ITruncateLogContext|null); + + /** + * Creates a new InstancesTruncateLogRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesTruncateLogRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesTruncateLogRequest): google.cloud.sql.v1beta4.InstancesTruncateLogRequest; + + /** + * Encodes the specified InstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesTruncateLogRequest.verify|verify} messages. + * @param message InstancesTruncateLogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesTruncateLogRequest.verify|verify} messages. + * @param message InstancesTruncateLogRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesTruncateLogRequest; + + /** + * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesTruncateLogRequest; + + /** + * Verifies an InstancesTruncateLogRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesTruncateLogRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesTruncateLogRequest; + + /** + * Creates a plain object from an InstancesTruncateLogRequest message. Also converts values to other types if specified. + * @param message InstancesTruncateLogRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesTruncateLogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesTruncateLogRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesTruncateLogRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InstancesAcquireSsrsLeaseRequest. */ + interface IInstancesAcquireSsrsLeaseRequest { + + /** InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext */ + acquireSsrsLeaseContext?: (google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null); + } + + /** Represents an InstancesAcquireSsrsLeaseRequest. */ + class InstancesAcquireSsrsLeaseRequest implements IInstancesAcquireSsrsLeaseRequest { + + /** + * Constructs a new InstancesAcquireSsrsLeaseRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest); + + /** InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext. */ + public acquireSsrsLeaseContext?: (google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null); + + /** + * Creates a new InstancesAcquireSsrsLeaseRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns InstancesAcquireSsrsLeaseRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest): google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest; + + /** + * Encodes the specified InstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @param message InstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @param message InstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest; + + /** + * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest; + + /** + * Verifies an InstancesAcquireSsrsLeaseRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InstancesAcquireSsrsLeaseRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest; + + /** + * Creates a plain object from an InstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. + * @param message InstancesAcquireSsrsLeaseRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InstancesAcquireSsrsLeaseRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InstancesAcquireSsrsLeaseRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PointInTimeRestoreContext. */ + interface IPointInTimeRestoreContext { + + /** PointInTimeRestoreContext datasource */ + datasource?: (string|null); + + /** PointInTimeRestoreContext pointInTime */ + pointInTime?: (google.protobuf.ITimestamp|null); + + /** PointInTimeRestoreContext targetInstance */ + targetInstance?: (string|null); + + /** PointInTimeRestoreContext privateNetwork */ + privateNetwork?: (string|null); + + /** PointInTimeRestoreContext allocatedIpRange */ + allocatedIpRange?: (string|null); + + /** PointInTimeRestoreContext preferredZone */ + preferredZone?: (string|null); + + /** PointInTimeRestoreContext preferredSecondaryZone */ + preferredSecondaryZone?: (string|null); + } + + /** Represents a PointInTimeRestoreContext. */ + class PointInTimeRestoreContext implements IPointInTimeRestoreContext { + + /** + * Constructs a new PointInTimeRestoreContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IPointInTimeRestoreContext); + + /** PointInTimeRestoreContext datasource. */ + public datasource?: (string|null); + + /** PointInTimeRestoreContext pointInTime. */ + public pointInTime?: (google.protobuf.ITimestamp|null); + + /** PointInTimeRestoreContext targetInstance. */ + public targetInstance?: (string|null); + + /** PointInTimeRestoreContext privateNetwork. */ + public privateNetwork?: (string|null); + + /** PointInTimeRestoreContext allocatedIpRange. */ + public allocatedIpRange?: (string|null); + + /** PointInTimeRestoreContext preferredZone. */ + public preferredZone?: (string|null); + + /** PointInTimeRestoreContext preferredSecondaryZone. */ + public preferredSecondaryZone?: (string|null); + + /** + * Creates a new PointInTimeRestoreContext instance using the specified properties. + * @param [properties] Properties to set + * @returns PointInTimeRestoreContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IPointInTimeRestoreContext): google.cloud.sql.v1beta4.PointInTimeRestoreContext; + + /** + * Encodes the specified PointInTimeRestoreContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PointInTimeRestoreContext.verify|verify} messages. + * @param message PointInTimeRestoreContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IPointInTimeRestoreContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PointInTimeRestoreContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PointInTimeRestoreContext.verify|verify} messages. + * @param message PointInTimeRestoreContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IPointInTimeRestoreContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PointInTimeRestoreContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PointInTimeRestoreContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PointInTimeRestoreContext; + + /** + * Decodes a PointInTimeRestoreContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PointInTimeRestoreContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PointInTimeRestoreContext; + + /** + * Verifies a PointInTimeRestoreContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PointInTimeRestoreContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PointInTimeRestoreContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PointInTimeRestoreContext; + + /** + * Creates a plain object from a PointInTimeRestoreContext message. Also converts values to other types if specified. + * @param message PointInTimeRestoreContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.PointInTimeRestoreContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PointInTimeRestoreContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PointInTimeRestoreContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PerformDiskShrinkContext. */ + interface IPerformDiskShrinkContext { + + /** PerformDiskShrinkContext targetSizeGb */ + targetSizeGb?: (number|Long|string|null); + } + + /** Represents a PerformDiskShrinkContext. */ + class PerformDiskShrinkContext implements IPerformDiskShrinkContext { + + /** + * Constructs a new PerformDiskShrinkContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IPerformDiskShrinkContext); + + /** PerformDiskShrinkContext targetSizeGb. */ + public targetSizeGb: (number|Long|string); + + /** + * Creates a new PerformDiskShrinkContext instance using the specified properties. + * @param [properties] Properties to set + * @returns PerformDiskShrinkContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IPerformDiskShrinkContext): google.cloud.sql.v1beta4.PerformDiskShrinkContext; + + /** + * Encodes the specified PerformDiskShrinkContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PerformDiskShrinkContext.verify|verify} messages. + * @param message PerformDiskShrinkContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IPerformDiskShrinkContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PerformDiskShrinkContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PerformDiskShrinkContext.verify|verify} messages. + * @param message PerformDiskShrinkContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IPerformDiskShrinkContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PerformDiskShrinkContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PerformDiskShrinkContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PerformDiskShrinkContext; + + /** + * Decodes a PerformDiskShrinkContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PerformDiskShrinkContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PerformDiskShrinkContext; + + /** + * Verifies a PerformDiskShrinkContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PerformDiskShrinkContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PerformDiskShrinkContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PerformDiskShrinkContext; + + /** + * Creates a plain object from a PerformDiskShrinkContext message. Also converts values to other types if specified. + * @param message PerformDiskShrinkContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.PerformDiskShrinkContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PerformDiskShrinkContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PerformDiskShrinkContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PreCheckResponse. */ + interface IPreCheckResponse { + + /** PreCheckResponse message */ + message?: (string|null); + + /** PreCheckResponse messageType */ + messageType?: (google.cloud.sql.v1beta4.PreCheckResponse.MessageType|keyof typeof google.cloud.sql.v1beta4.PreCheckResponse.MessageType|null); + + /** PreCheckResponse actionsRequired */ + actionsRequired?: (string[]|null); + } + + /** Represents a PreCheckResponse. */ + class PreCheckResponse implements IPreCheckResponse { + + /** + * Constructs a new PreCheckResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IPreCheckResponse); + + /** PreCheckResponse message. */ + public message?: (string|null); + + /** PreCheckResponse messageType. */ + public messageType?: (google.cloud.sql.v1beta4.PreCheckResponse.MessageType|keyof typeof google.cloud.sql.v1beta4.PreCheckResponse.MessageType|null); + + /** PreCheckResponse actionsRequired. */ + public actionsRequired: string[]; + + /** + * Creates a new PreCheckResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns PreCheckResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IPreCheckResponse): google.cloud.sql.v1beta4.PreCheckResponse; + + /** + * Encodes the specified PreCheckResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckResponse.verify|verify} messages. + * @param message PreCheckResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IPreCheckResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PreCheckResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckResponse.verify|verify} messages. + * @param message PreCheckResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IPreCheckResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PreCheckResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PreCheckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PreCheckResponse; + + /** + * Decodes a PreCheckResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PreCheckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PreCheckResponse; + + /** + * Verifies a PreCheckResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PreCheckResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PreCheckResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PreCheckResponse; + + /** + * Creates a plain object from a PreCheckResponse message. Also converts values to other types if specified. + * @param message PreCheckResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.PreCheckResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PreCheckResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PreCheckResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PreCheckResponse { + + /** MessageType enum. */ + enum MessageType { + MESSAGE_TYPE_UNSPECIFIED = 0, + INFO = 1, + WARNING = 2, + ERROR = 3 + } + } + + /** Properties of a PreCheckMajorVersionUpgradeContext. */ + interface IPreCheckMajorVersionUpgradeContext { + + /** PreCheckMajorVersionUpgradeContext targetDatabaseVersion */ + targetDatabaseVersion?: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion|null); + + /** PreCheckMajorVersionUpgradeContext preCheckResponse */ + preCheckResponse?: (google.cloud.sql.v1beta4.IPreCheckResponse[]|null); + + /** PreCheckMajorVersionUpgradeContext kind */ + kind?: (string|null); + } + + /** Represents a PreCheckMajorVersionUpgradeContext. */ + class PreCheckMajorVersionUpgradeContext implements IPreCheckMajorVersionUpgradeContext { + + /** + * Constructs a new PreCheckMajorVersionUpgradeContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext); + + /** PreCheckMajorVersionUpgradeContext targetDatabaseVersion. */ + public targetDatabaseVersion: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion); + + /** PreCheckMajorVersionUpgradeContext preCheckResponse. */ + public preCheckResponse: google.cloud.sql.v1beta4.IPreCheckResponse[]; + + /** PreCheckMajorVersionUpgradeContext kind. */ + public kind: string; + + /** + * Creates a new PreCheckMajorVersionUpgradeContext instance using the specified properties. + * @param [properties] Properties to set + * @returns PreCheckMajorVersionUpgradeContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext): google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext; + + /** + * Encodes the specified PreCheckMajorVersionUpgradeContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify|verify} messages. + * @param message PreCheckMajorVersionUpgradeContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PreCheckMajorVersionUpgradeContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify|verify} messages. + * @param message PreCheckMajorVersionUpgradeContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PreCheckMajorVersionUpgradeContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext; + + /** + * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PreCheckMajorVersionUpgradeContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext; + + /** + * Verifies a PreCheckMajorVersionUpgradeContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PreCheckMajorVersionUpgradeContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PreCheckMajorVersionUpgradeContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext; + + /** + * Creates a plain object from a PreCheckMajorVersionUpgradeContext message. Also converts values to other types if specified. + * @param message PreCheckMajorVersionUpgradeContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PreCheckMajorVersionUpgradeContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PreCheckMajorVersionUpgradeContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesGetDiskShrinkConfigResponse. */ + interface ISqlInstancesGetDiskShrinkConfigResponse { + + /** SqlInstancesGetDiskShrinkConfigResponse kind */ + kind?: (string|null); + + /** SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb */ + minimalTargetSizeGb?: (number|Long|string|null); + + /** SqlInstancesGetDiskShrinkConfigResponse message */ + message?: (string|null); + } + + /** Represents a SqlInstancesGetDiskShrinkConfigResponse. */ + class SqlInstancesGetDiskShrinkConfigResponse implements ISqlInstancesGetDiskShrinkConfigResponse { + + /** + * Constructs a new SqlInstancesGetDiskShrinkConfigResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse); + + /** SqlInstancesGetDiskShrinkConfigResponse kind. */ + public kind: string; + + /** SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb. */ + public minimalTargetSizeGb: (number|Long|string); + + /** SqlInstancesGetDiskShrinkConfigResponse message. */ + public message: string; + + /** + * Creates a new SqlInstancesGetDiskShrinkConfigResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesGetDiskShrinkConfigResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. + * @param message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. + * @param message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesGetDiskShrinkConfigResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesGetDiskShrinkConfigResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse; + + /** + * Verifies a SqlInstancesGetDiskShrinkConfigResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesGetDiskShrinkConfigResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesGetDiskShrinkConfigResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse; + + /** + * Creates a plain object from a SqlInstancesGetDiskShrinkConfigResponse message. Also converts values to other types if specified. + * @param message SqlInstancesGetDiskShrinkConfigResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesGetDiskShrinkConfigResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesGetDiskShrinkConfigResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesVerifyExternalSyncSettingsResponse. */ + interface ISqlInstancesVerifyExternalSyncSettingsResponse { + + /** SqlInstancesVerifyExternalSyncSettingsResponse kind */ + kind?: (string|null); + + /** SqlInstancesVerifyExternalSyncSettingsResponse errors */ + errors?: (google.cloud.sql.v1beta4.ISqlExternalSyncSettingError[]|null); + + /** SqlInstancesVerifyExternalSyncSettingsResponse warnings */ + warnings?: (google.cloud.sql.v1beta4.ISqlExternalSyncSettingError[]|null); + } + + /** Represents a SqlInstancesVerifyExternalSyncSettingsResponse. */ + class SqlInstancesVerifyExternalSyncSettingsResponse implements ISqlInstancesVerifyExternalSyncSettingsResponse { + + /** + * Constructs a new SqlInstancesVerifyExternalSyncSettingsResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse); + + /** SqlInstancesVerifyExternalSyncSettingsResponse kind. */ + public kind: string; + + /** SqlInstancesVerifyExternalSyncSettingsResponse errors. */ + public errors: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError[]; + + /** SqlInstancesVerifyExternalSyncSettingsResponse warnings. */ + public warnings: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError[]; + + /** + * Creates a new SqlInstancesVerifyExternalSyncSettingsResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesVerifyExternalSyncSettingsResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. + * @param message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. + * @param message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesVerifyExternalSyncSettingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesVerifyExternalSyncSettingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse; + + /** + * Verifies a SqlInstancesVerifyExternalSyncSettingsResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesVerifyExternalSyncSettingsResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesVerifyExternalSyncSettingsResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse; + + /** + * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsResponse message. Also converts values to other types if specified. + * @param message SqlInstancesVerifyExternalSyncSettingsResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesVerifyExternalSyncSettingsResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlExternalSyncSettingError. */ + interface ISqlExternalSyncSettingError { + + /** SqlExternalSyncSettingError kind */ + kind?: (string|null); + + /** SqlExternalSyncSettingError type */ + type?: (google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|keyof typeof google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|null); + + /** SqlExternalSyncSettingError detail */ + detail?: (string|null); + } + + /** Represents a SqlExternalSyncSettingError. */ + class SqlExternalSyncSettingError implements ISqlExternalSyncSettingError { + + /** + * Constructs a new SqlExternalSyncSettingError. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError); + + /** SqlExternalSyncSettingError kind. */ + public kind: string; + + /** SqlExternalSyncSettingError type. */ + public type: (google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|keyof typeof google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType); + + /** SqlExternalSyncSettingError detail. */ + public detail: string; + + /** + * Creates a new SqlExternalSyncSettingError instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlExternalSyncSettingError instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError): google.cloud.sql.v1beta4.SqlExternalSyncSettingError; + + /** + * Encodes the specified SqlExternalSyncSettingError message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify|verify} messages. + * @param message SqlExternalSyncSettingError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlExternalSyncSettingError message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify|verify} messages. + * @param message SqlExternalSyncSettingError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlExternalSyncSettingError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlExternalSyncSettingError; + + /** + * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlExternalSyncSettingError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlExternalSyncSettingError; + + /** + * Verifies a SqlExternalSyncSettingError message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlExternalSyncSettingError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlExternalSyncSettingError + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlExternalSyncSettingError; + + /** + * Creates a plain object from a SqlExternalSyncSettingError message. Also converts values to other types if specified. + * @param message SqlExternalSyncSettingError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlExternalSyncSettingError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlExternalSyncSettingError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlExternalSyncSettingError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlExternalSyncSettingError { + + /** SqlExternalSyncSettingErrorType enum. */ + enum SqlExternalSyncSettingErrorType { + SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED = 0, + CONNECTION_FAILURE = 1, + BINLOG_NOT_ENABLED = 2, + INCOMPATIBLE_DATABASE_VERSION = 3, + REPLICA_ALREADY_SETUP = 4, + INSUFFICIENT_PRIVILEGE = 5, + UNSUPPORTED_MIGRATION_TYPE = 6, + NO_PGLOGICAL_INSTALLED = 7, + PGLOGICAL_NODE_ALREADY_EXISTS = 8, + INVALID_WAL_LEVEL = 9, + INVALID_SHARED_PRELOAD_LIBRARY = 10, + INSUFFICIENT_MAX_REPLICATION_SLOTS = 11, + INSUFFICIENT_MAX_WAL_SENDERS = 12, + INSUFFICIENT_MAX_WORKER_PROCESSES = 13, + UNSUPPORTED_EXTENSIONS = 14, + INVALID_RDS_LOGICAL_REPLICATION = 15, + INVALID_LOGGING_SETUP = 16, + INVALID_DB_PARAM = 17, + UNSUPPORTED_GTID_MODE = 18, + SQLSERVER_AGENT_NOT_RUNNING = 19, + UNSUPPORTED_TABLE_DEFINITION = 20, + UNSUPPORTED_DEFINER = 21, + SQLSERVER_SERVERNAME_MISMATCH = 22, + PRIMARY_ALREADY_SETUP = 23, + UNSUPPORTED_BINLOG_FORMAT = 24, + BINLOG_RETENTION_SETTING = 25, + UNSUPPORTED_STORAGE_ENGINE = 26, + LIMITED_SUPPORT_TABLES = 27, + EXISTING_DATA_IN_REPLICA = 28, + MISSING_OPTIONAL_PRIVILEGES = 29, + RISKY_BACKUP_ADMIN_PRIVILEGE = 30, + INSUFFICIENT_GCS_PERMISSIONS = 31, + INVALID_FILE_INFO = 32, + UNSUPPORTED_DATABASE_SETTINGS = 33, + MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE = 34, + LOCAL_INFILE_OFF = 35, + TURN_ON_PITR_AFTER_PROMOTE = 36, + INCOMPATIBLE_DATABASE_MINOR_VERSION = 37, + SOURCE_MAX_SUBSCRIPTIONS = 38, + UNABLE_TO_VERIFY_DEFINERS = 39, + SUBSCRIPTION_CALCULATION_STATUS = 40, + PG_SUBSCRIPTION_COUNT = 41, + PG_SYNC_PARALLEL_LEVEL = 42, + INSUFFICIENT_DISK_SIZE = 43, + INSUFFICIENT_MACHINE_TIER = 44, + UNSUPPORTED_EXTENSIONS_NOT_MIGRATED = 45, + EXTENSIONS_NOT_MIGRATED = 46, + PG_CRON_FLAG_ENABLED_IN_REPLICA = 47, + EXTENSIONS_NOT_ENABLED_IN_REPLICA = 48, + UNSUPPORTED_COLUMNS = 49, + USERS_NOT_CREATED_IN_REPLICA = 50, + UNSUPPORTED_SYSTEM_OBJECTS = 51, + UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY = 52, + SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE = 53, + PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI = 54, + SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS = 55, + PROMPT_DELETE_EXISTING = 56, + WILL_DELETE_EXISTING = 57, + PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE = 58 + } + } + + /** Properties of an IpConfiguration. */ + interface IIpConfiguration { + + /** IpConfiguration ipv4Enabled */ + ipv4Enabled?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration privateNetwork */ + privateNetwork?: (string|null); + + /** IpConfiguration requireSsl */ + requireSsl?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration authorizedNetworks */ + authorizedNetworks?: (google.cloud.sql.v1beta4.IAclEntry[]|null); + + /** IpConfiguration allocatedIpRange */ + allocatedIpRange?: (string|null); + + /** IpConfiguration enablePrivatePathForGoogleCloudServices */ + enablePrivatePathForGoogleCloudServices?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration sslMode */ + sslMode?: (google.cloud.sql.v1beta4.IpConfiguration.SslMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.SslMode|null); + + /** IpConfiguration pscConfig */ + pscConfig?: (google.cloud.sql.v1beta4.IPscConfig|null); + + /** IpConfiguration serverCaMode */ + serverCaMode?: (google.cloud.sql.v1beta4.IpConfiguration.CaMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.CaMode|null); + + /** IpConfiguration customSubjectAlternativeNames */ + customSubjectAlternativeNames?: (string[]|null); + + /** IpConfiguration serverCaPool */ + serverCaPool?: (string|null); + + /** IpConfiguration serverCertificateRotationMode */ + serverCertificateRotationMode?: (google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|null); + } + + /** Represents an IpConfiguration. */ + class IpConfiguration implements IIpConfiguration { + + /** + * Constructs a new IpConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IIpConfiguration); + + /** IpConfiguration ipv4Enabled. */ + public ipv4Enabled?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration privateNetwork. */ + public privateNetwork: string; + + /** IpConfiguration requireSsl. */ + public requireSsl?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration authorizedNetworks. */ + public authorizedNetworks: google.cloud.sql.v1beta4.IAclEntry[]; + + /** IpConfiguration allocatedIpRange. */ + public allocatedIpRange: string; + + /** IpConfiguration enablePrivatePathForGoogleCloudServices. */ + public enablePrivatePathForGoogleCloudServices?: (google.protobuf.IBoolValue|null); + + /** IpConfiguration sslMode. */ + public sslMode: (google.cloud.sql.v1beta4.IpConfiguration.SslMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.SslMode); + + /** IpConfiguration pscConfig. */ + public pscConfig?: (google.cloud.sql.v1beta4.IPscConfig|null); + + /** IpConfiguration serverCaMode. */ + public serverCaMode?: (google.cloud.sql.v1beta4.IpConfiguration.CaMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.CaMode|null); + + /** IpConfiguration customSubjectAlternativeNames. */ + public customSubjectAlternativeNames: string[]; + + /** IpConfiguration serverCaPool. */ + public serverCaPool?: (string|null); + + /** IpConfiguration serverCertificateRotationMode. */ + public serverCertificateRotationMode?: (google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|null); + + /** + * Creates a new IpConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns IpConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IIpConfiguration): google.cloud.sql.v1beta4.IpConfiguration; + + /** + * Encodes the specified IpConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.IpConfiguration.verify|verify} messages. + * @param message IpConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IIpConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IpConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.IpConfiguration.verify|verify} messages. + * @param message IpConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IIpConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IpConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IpConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.IpConfiguration; + + /** + * Decodes an IpConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IpConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.IpConfiguration; + + /** + * Verifies an IpConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IpConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IpConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.IpConfiguration; + + /** + * Creates a plain object from an IpConfiguration message. Also converts values to other types if specified. + * @param message IpConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.IpConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IpConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IpConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace IpConfiguration { + + /** SslMode enum. */ + enum SslMode { + SSL_MODE_UNSPECIFIED = 0, + ALLOW_UNENCRYPTED_AND_ENCRYPTED = 1, + ENCRYPTED_ONLY = 2, + TRUSTED_CLIENT_CERTIFICATE_REQUIRED = 3 + } + + /** CaMode enum. */ + enum CaMode { + CA_MODE_UNSPECIFIED = 0, + GOOGLE_MANAGED_INTERNAL_CA = 1, + GOOGLE_MANAGED_CAS_CA = 2, + CUSTOMER_MANAGED_CAS_CA = 3 + } + + /** ServerCertificateRotationMode enum. */ + enum ServerCertificateRotationMode { + SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED = 0, + NO_AUTOMATIC_ROTATION = 1, + AUTOMATIC_ROTATION_DURING_MAINTENANCE = 2 + } + } + + /** Properties of a PscConfig. */ + interface IPscConfig { + + /** PscConfig pscEnabled */ + pscEnabled?: (boolean|null); + + /** PscConfig allowedConsumerProjects */ + allowedConsumerProjects?: (string[]|null); + + /** PscConfig pscAutoConnections */ + pscAutoConnections?: (google.cloud.sql.v1beta4.IPscAutoConnectionConfig[]|null); + + /** PscConfig networkAttachmentUri */ + networkAttachmentUri?: (string|null); + } + + /** Represents a PscConfig. */ + class PscConfig implements IPscConfig { + + /** + * Constructs a new PscConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IPscConfig); + + /** PscConfig pscEnabled. */ + public pscEnabled?: (boolean|null); + + /** PscConfig allowedConsumerProjects. */ + public allowedConsumerProjects: string[]; + + /** PscConfig pscAutoConnections. */ + public pscAutoConnections: google.cloud.sql.v1beta4.IPscAutoConnectionConfig[]; + + /** PscConfig networkAttachmentUri. */ + public networkAttachmentUri: string; + + /** + * Creates a new PscConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns PscConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IPscConfig): google.cloud.sql.v1beta4.PscConfig; + + /** + * Encodes the specified PscConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PscConfig.verify|verify} messages. + * @param message PscConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IPscConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PscConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PscConfig.verify|verify} messages. + * @param message PscConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IPscConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PscConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PscConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PscConfig; + + /** + * Decodes a PscConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PscConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PscConfig; + + /** + * Verifies a PscConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PscConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PscConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PscConfig; + + /** + * Creates a plain object from a PscConfig message. Also converts values to other types if specified. + * @param message PscConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.PscConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PscConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PscConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PscAutoConnectionConfig. */ + interface IPscAutoConnectionConfig { + + /** PscAutoConnectionConfig consumerProject */ + consumerProject?: (string|null); + + /** PscAutoConnectionConfig consumerNetwork */ + consumerNetwork?: (string|null); + + /** PscAutoConnectionConfig ipAddress */ + ipAddress?: (string|null); + + /** PscAutoConnectionConfig status */ + status?: (string|null); + + /** PscAutoConnectionConfig consumerNetworkStatus */ + consumerNetworkStatus?: (string|null); + } + + /** Represents a PscAutoConnectionConfig. */ + class PscAutoConnectionConfig implements IPscAutoConnectionConfig { + + /** + * Constructs a new PscAutoConnectionConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IPscAutoConnectionConfig); + + /** PscAutoConnectionConfig consumerProject. */ + public consumerProject: string; + + /** PscAutoConnectionConfig consumerNetwork. */ + public consumerNetwork: string; + + /** PscAutoConnectionConfig ipAddress. */ + public ipAddress?: (string|null); + + /** PscAutoConnectionConfig status. */ + public status?: (string|null); + + /** PscAutoConnectionConfig consumerNetworkStatus. */ + public consumerNetworkStatus?: (string|null); + + /** + * Creates a new PscAutoConnectionConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns PscAutoConnectionConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IPscAutoConnectionConfig): google.cloud.sql.v1beta4.PscAutoConnectionConfig; + + /** + * Encodes the specified PscAutoConnectionConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify|verify} messages. + * @param message PscAutoConnectionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IPscAutoConnectionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PscAutoConnectionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify|verify} messages. + * @param message PscAutoConnectionConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IPscAutoConnectionConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PscAutoConnectionConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PscAutoConnectionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PscAutoConnectionConfig; + + /** + * Decodes a PscAutoConnectionConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PscAutoConnectionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PscAutoConnectionConfig; + + /** + * Verifies a PscAutoConnectionConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PscAutoConnectionConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PscAutoConnectionConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PscAutoConnectionConfig; + + /** + * Creates a plain object from a PscAutoConnectionConfig message. Also converts values to other types if specified. + * @param message PscAutoConnectionConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.PscAutoConnectionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PscAutoConnectionConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PscAutoConnectionConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an IpMapping. */ + interface IIpMapping { + + /** IpMapping type */ + type?: (google.cloud.sql.v1beta4.SqlIpAddressType|keyof typeof google.cloud.sql.v1beta4.SqlIpAddressType|null); + + /** IpMapping ipAddress */ + ipAddress?: (string|null); + + /** IpMapping timeToRetire */ + timeToRetire?: (google.protobuf.ITimestamp|null); + } + + /** Represents an IpMapping. */ + class IpMapping implements IIpMapping { + + /** + * Constructs a new IpMapping. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IIpMapping); + + /** IpMapping type. */ + public type: (google.cloud.sql.v1beta4.SqlIpAddressType|keyof typeof google.cloud.sql.v1beta4.SqlIpAddressType); + + /** IpMapping ipAddress. */ + public ipAddress: string; + + /** IpMapping timeToRetire. */ + public timeToRetire?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new IpMapping instance using the specified properties. + * @param [properties] Properties to set + * @returns IpMapping instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IIpMapping): google.cloud.sql.v1beta4.IpMapping; + + /** + * Encodes the specified IpMapping message. Does not implicitly {@link google.cloud.sql.v1beta4.IpMapping.verify|verify} messages. + * @param message IpMapping message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IIpMapping, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified IpMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.IpMapping.verify|verify} messages. + * @param message IpMapping message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IIpMapping, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an IpMapping message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns IpMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.IpMapping; + + /** + * Decodes an IpMapping message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns IpMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.IpMapping; + + /** + * Verifies an IpMapping message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an IpMapping message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns IpMapping + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.IpMapping; + + /** + * Creates a plain object from an IpMapping message. Also converts values to other types if specified. + * @param message IpMapping + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.IpMapping, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this IpMapping to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for IpMapping + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a LocationPreference. */ + interface ILocationPreference { + + /** LocationPreference followGaeApplication */ + followGaeApplication?: (string|null); + + /** LocationPreference zone */ + zone?: (string|null); + + /** LocationPreference secondaryZone */ + secondaryZone?: (string|null); + + /** LocationPreference kind */ + kind?: (string|null); + } + + /** Represents a LocationPreference. */ + class LocationPreference implements ILocationPreference { + + /** + * Constructs a new LocationPreference. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ILocationPreference); + + /** LocationPreference followGaeApplication. */ + public followGaeApplication: string; + + /** LocationPreference zone. */ + public zone: string; + + /** LocationPreference secondaryZone. */ + public secondaryZone: string; + + /** LocationPreference kind. */ + public kind: string; + + /** + * Creates a new LocationPreference instance using the specified properties. + * @param [properties] Properties to set + * @returns LocationPreference instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ILocationPreference): google.cloud.sql.v1beta4.LocationPreference; + + /** + * Encodes the specified LocationPreference message. Does not implicitly {@link google.cloud.sql.v1beta4.LocationPreference.verify|verify} messages. + * @param message LocationPreference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ILocationPreference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LocationPreference message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.LocationPreference.verify|verify} messages. + * @param message LocationPreference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ILocationPreference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LocationPreference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LocationPreference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.LocationPreference; + + /** + * Decodes a LocationPreference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LocationPreference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.LocationPreference; + + /** + * Verifies a LocationPreference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LocationPreference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LocationPreference + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.LocationPreference; + + /** + * Creates a plain object from a LocationPreference message. Also converts values to other types if specified. + * @param message LocationPreference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.LocationPreference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LocationPreference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LocationPreference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MaintenanceWindow. */ + interface IMaintenanceWindow { + + /** MaintenanceWindow hour */ + hour?: (google.protobuf.IInt32Value|null); + + /** MaintenanceWindow day */ + day?: (google.protobuf.IInt32Value|null); + + /** MaintenanceWindow updateTrack */ + updateTrack?: (google.cloud.sql.v1beta4.SqlUpdateTrack|keyof typeof google.cloud.sql.v1beta4.SqlUpdateTrack|null); + + /** MaintenanceWindow kind */ + kind?: (string|null); + } + + /** Represents a MaintenanceWindow. */ + class MaintenanceWindow implements IMaintenanceWindow { + + /** + * Constructs a new MaintenanceWindow. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IMaintenanceWindow); + + /** MaintenanceWindow hour. */ + public hour?: (google.protobuf.IInt32Value|null); + + /** MaintenanceWindow day. */ + public day?: (google.protobuf.IInt32Value|null); + + /** MaintenanceWindow updateTrack. */ + public updateTrack: (google.cloud.sql.v1beta4.SqlUpdateTrack|keyof typeof google.cloud.sql.v1beta4.SqlUpdateTrack); + + /** MaintenanceWindow kind. */ + public kind: string; + + /** + * Creates a new MaintenanceWindow instance using the specified properties. + * @param [properties] Properties to set + * @returns MaintenanceWindow instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IMaintenanceWindow): google.cloud.sql.v1beta4.MaintenanceWindow; + + /** + * Encodes the specified MaintenanceWindow message. Does not implicitly {@link google.cloud.sql.v1beta4.MaintenanceWindow.verify|verify} messages. + * @param message MaintenanceWindow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IMaintenanceWindow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MaintenanceWindow message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MaintenanceWindow.verify|verify} messages. + * @param message MaintenanceWindow message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IMaintenanceWindow, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MaintenanceWindow message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MaintenanceWindow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.MaintenanceWindow; + + /** + * Decodes a MaintenanceWindow message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MaintenanceWindow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.MaintenanceWindow; + + /** + * Verifies a MaintenanceWindow message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MaintenanceWindow message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MaintenanceWindow + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.MaintenanceWindow; + + /** + * Creates a plain object from a MaintenanceWindow message. Also converts values to other types if specified. + * @param message MaintenanceWindow + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.MaintenanceWindow, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MaintenanceWindow to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MaintenanceWindow + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DenyMaintenancePeriod. */ + interface IDenyMaintenancePeriod { + + /** DenyMaintenancePeriod startDate */ + startDate?: (string|null); + + /** DenyMaintenancePeriod endDate */ + endDate?: (string|null); + + /** DenyMaintenancePeriod time */ + time?: (string|null); + } + + /** Represents a DenyMaintenancePeriod. */ + class DenyMaintenancePeriod implements IDenyMaintenancePeriod { + + /** + * Constructs a new DenyMaintenancePeriod. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDenyMaintenancePeriod); + + /** DenyMaintenancePeriod startDate. */ + public startDate: string; + + /** DenyMaintenancePeriod endDate. */ + public endDate: string; + + /** DenyMaintenancePeriod time. */ + public time: string; + + /** + * Creates a new DenyMaintenancePeriod instance using the specified properties. + * @param [properties] Properties to set + * @returns DenyMaintenancePeriod instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDenyMaintenancePeriod): google.cloud.sql.v1beta4.DenyMaintenancePeriod; + + /** + * Encodes the specified DenyMaintenancePeriod message. Does not implicitly {@link google.cloud.sql.v1beta4.DenyMaintenancePeriod.verify|verify} messages. + * @param message DenyMaintenancePeriod message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDenyMaintenancePeriod, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DenyMaintenancePeriod message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DenyMaintenancePeriod.verify|verify} messages. + * @param message DenyMaintenancePeriod message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDenyMaintenancePeriod, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DenyMaintenancePeriod message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DenyMaintenancePeriod + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DenyMaintenancePeriod; + + /** + * Decodes a DenyMaintenancePeriod message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DenyMaintenancePeriod + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DenyMaintenancePeriod; + + /** + * Verifies a DenyMaintenancePeriod message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DenyMaintenancePeriod message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DenyMaintenancePeriod + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DenyMaintenancePeriod; + + /** + * Creates a plain object from a DenyMaintenancePeriod message. Also converts values to other types if specified. + * @param message DenyMaintenancePeriod + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DenyMaintenancePeriod, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DenyMaintenancePeriod to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DenyMaintenancePeriod + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an InsightsConfig. */ + interface IInsightsConfig { + + /** InsightsConfig queryInsightsEnabled */ + queryInsightsEnabled?: (boolean|null); + + /** InsightsConfig recordClientAddress */ + recordClientAddress?: (boolean|null); + + /** InsightsConfig recordApplicationTags */ + recordApplicationTags?: (boolean|null); + + /** InsightsConfig queryStringLength */ + queryStringLength?: (google.protobuf.IInt32Value|null); + + /** InsightsConfig queryPlansPerMinute */ + queryPlansPerMinute?: (google.protobuf.IInt32Value|null); + + /** InsightsConfig enhancedQueryInsightsEnabled */ + enhancedQueryInsightsEnabled?: (google.protobuf.IBoolValue|null); + } + + /** Represents an InsightsConfig. */ + class InsightsConfig implements IInsightsConfig { + + /** + * Constructs a new InsightsConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IInsightsConfig); + + /** InsightsConfig queryInsightsEnabled. */ + public queryInsightsEnabled: boolean; + + /** InsightsConfig recordClientAddress. */ + public recordClientAddress: boolean; + + /** InsightsConfig recordApplicationTags. */ + public recordApplicationTags: boolean; + + /** InsightsConfig queryStringLength. */ + public queryStringLength?: (google.protobuf.IInt32Value|null); + + /** InsightsConfig queryPlansPerMinute. */ + public queryPlansPerMinute?: (google.protobuf.IInt32Value|null); + + /** InsightsConfig enhancedQueryInsightsEnabled. */ + public enhancedQueryInsightsEnabled?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new InsightsConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns InsightsConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IInsightsConfig): google.cloud.sql.v1beta4.InsightsConfig; + + /** + * Encodes the specified InsightsConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.InsightsConfig.verify|verify} messages. + * @param message InsightsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IInsightsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified InsightsConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InsightsConfig.verify|verify} messages. + * @param message InsightsConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IInsightsConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an InsightsConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns InsightsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InsightsConfig; + + /** + * Decodes an InsightsConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns InsightsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InsightsConfig; + + /** + * Verifies an InsightsConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an InsightsConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns InsightsConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InsightsConfig; + + /** + * Creates a plain object from an InsightsConfig message. Also converts values to other types if specified. + * @param message InsightsConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.InsightsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this InsightsConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for InsightsConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MySqlReplicaConfiguration. */ + interface IMySqlReplicaConfiguration { + + /** MySqlReplicaConfiguration dumpFilePath */ + dumpFilePath?: (string|null); + + /** MySqlReplicaConfiguration username */ + username?: (string|null); + + /** MySqlReplicaConfiguration password */ + password?: (string|null); + + /** MySqlReplicaConfiguration connectRetryInterval */ + connectRetryInterval?: (google.protobuf.IInt32Value|null); + + /** MySqlReplicaConfiguration masterHeartbeatPeriod */ + masterHeartbeatPeriod?: (google.protobuf.IInt64Value|null); + + /** MySqlReplicaConfiguration caCertificate */ + caCertificate?: (string|null); + + /** MySqlReplicaConfiguration clientCertificate */ + clientCertificate?: (string|null); + + /** MySqlReplicaConfiguration clientKey */ + clientKey?: (string|null); + + /** MySqlReplicaConfiguration sslCipher */ + sslCipher?: (string|null); + + /** MySqlReplicaConfiguration verifyServerCertificate */ + verifyServerCertificate?: (google.protobuf.IBoolValue|null); + + /** MySqlReplicaConfiguration kind */ + kind?: (string|null); + } + + /** Represents a MySqlReplicaConfiguration. */ + class MySqlReplicaConfiguration implements IMySqlReplicaConfiguration { + + /** + * Constructs a new MySqlReplicaConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IMySqlReplicaConfiguration); + + /** MySqlReplicaConfiguration dumpFilePath. */ + public dumpFilePath: string; + + /** MySqlReplicaConfiguration username. */ + public username: string; + + /** MySqlReplicaConfiguration password. */ + public password: string; + + /** MySqlReplicaConfiguration connectRetryInterval. */ + public connectRetryInterval?: (google.protobuf.IInt32Value|null); + + /** MySqlReplicaConfiguration masterHeartbeatPeriod. */ + public masterHeartbeatPeriod?: (google.protobuf.IInt64Value|null); + + /** MySqlReplicaConfiguration caCertificate. */ + public caCertificate: string; + + /** MySqlReplicaConfiguration clientCertificate. */ + public clientCertificate: string; + + /** MySqlReplicaConfiguration clientKey. */ + public clientKey: string; + + /** MySqlReplicaConfiguration sslCipher. */ + public sslCipher: string; + + /** MySqlReplicaConfiguration verifyServerCertificate. */ + public verifyServerCertificate?: (google.protobuf.IBoolValue|null); + + /** MySqlReplicaConfiguration kind. */ + public kind: string; + + /** + * Creates a new MySqlReplicaConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns MySqlReplicaConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IMySqlReplicaConfiguration): google.cloud.sql.v1beta4.MySqlReplicaConfiguration; + + /** + * Encodes the specified MySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verify|verify} messages. + * @param message MySqlReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verify|verify} messages. + * @param message MySqlReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.MySqlReplicaConfiguration; + + /** + * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.MySqlReplicaConfiguration; + + /** + * Verifies a MySqlReplicaConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MySqlReplicaConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.MySqlReplicaConfiguration; + + /** + * Creates a plain object from a MySqlReplicaConfiguration message. Also converts values to other types if specified. + * @param message MySqlReplicaConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.MySqlReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MySqlReplicaConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MySqlReplicaConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SelectedObjects. */ + interface ISelectedObjects { + + /** SelectedObjects database */ + database?: (string|null); + } + + /** Represents a SelectedObjects. */ + class SelectedObjects implements ISelectedObjects { + + /** + * Constructs a new SelectedObjects. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISelectedObjects); + + /** SelectedObjects database. */ + public database: string; + + /** + * Creates a new SelectedObjects instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectedObjects instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISelectedObjects): google.cloud.sql.v1beta4.SelectedObjects; + + /** + * Encodes the specified SelectedObjects message. Does not implicitly {@link google.cloud.sql.v1beta4.SelectedObjects.verify|verify} messages. + * @param message SelectedObjects message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISelectedObjects, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectedObjects message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SelectedObjects.verify|verify} messages. + * @param message SelectedObjects message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISelectedObjects, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectedObjects message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectedObjects + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SelectedObjects; + + /** + * Decodes a SelectedObjects message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectedObjects + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SelectedObjects; + + /** + * Verifies a SelectedObjects message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SelectedObjects message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectedObjects + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SelectedObjects; + + /** + * Creates a plain object from a SelectedObjects message. Also converts values to other types if specified. + * @param message SelectedObjects + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SelectedObjects, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectedObjects to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectedObjects + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OnPremisesConfiguration. */ + interface IOnPremisesConfiguration { + + /** OnPremisesConfiguration hostPort */ + hostPort?: (string|null); + + /** OnPremisesConfiguration kind */ + kind?: (string|null); + + /** OnPremisesConfiguration username */ + username?: (string|null); + + /** OnPremisesConfiguration password */ + password?: (string|null); + + /** OnPremisesConfiguration caCertificate */ + caCertificate?: (string|null); + + /** OnPremisesConfiguration clientCertificate */ + clientCertificate?: (string|null); + + /** OnPremisesConfiguration clientKey */ + clientKey?: (string|null); + + /** OnPremisesConfiguration dumpFilePath */ + dumpFilePath?: (string|null); + + /** OnPremisesConfiguration sourceInstance */ + sourceInstance?: (google.cloud.sql.v1beta4.IInstanceReference|null); + + /** OnPremisesConfiguration selectedObjects */ + selectedObjects?: (google.cloud.sql.v1beta4.ISelectedObjects[]|null); + + /** OnPremisesConfiguration sslOption */ + sslOption?: (google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption|keyof typeof google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption|null); + } + + /** Represents an OnPremisesConfiguration. */ + class OnPremisesConfiguration implements IOnPremisesConfiguration { + + /** + * Constructs a new OnPremisesConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IOnPremisesConfiguration); + + /** OnPremisesConfiguration hostPort. */ + public hostPort: string; + + /** OnPremisesConfiguration kind. */ + public kind: string; + + /** OnPremisesConfiguration username. */ + public username: string; + + /** OnPremisesConfiguration password. */ + public password: string; + + /** OnPremisesConfiguration caCertificate. */ + public caCertificate: string; + + /** OnPremisesConfiguration clientCertificate. */ + public clientCertificate: string; + + /** OnPremisesConfiguration clientKey. */ + public clientKey: string; + + /** OnPremisesConfiguration dumpFilePath. */ + public dumpFilePath: string; + + /** OnPremisesConfiguration sourceInstance. */ + public sourceInstance?: (google.cloud.sql.v1beta4.IInstanceReference|null); + + /** OnPremisesConfiguration selectedObjects. */ + public selectedObjects: google.cloud.sql.v1beta4.ISelectedObjects[]; + + /** OnPremisesConfiguration sslOption. */ + public sslOption: (google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption|keyof typeof google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption); + + /** + * Creates a new OnPremisesConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns OnPremisesConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IOnPremisesConfiguration): google.cloud.sql.v1beta4.OnPremisesConfiguration; + + /** + * Encodes the specified OnPremisesConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.OnPremisesConfiguration.verify|verify} messages. + * @param message OnPremisesConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IOnPremisesConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OnPremisesConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OnPremisesConfiguration.verify|verify} messages. + * @param message OnPremisesConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IOnPremisesConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OnPremisesConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OnPremisesConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.OnPremisesConfiguration; + + /** + * Decodes an OnPremisesConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OnPremisesConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.OnPremisesConfiguration; + + /** + * Verifies an OnPremisesConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OnPremisesConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OnPremisesConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.OnPremisesConfiguration; + + /** + * Creates a plain object from an OnPremisesConfiguration message. Also converts values to other types if specified. + * @param message OnPremisesConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.OnPremisesConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OnPremisesConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OnPremisesConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace OnPremisesConfiguration { + + /** SslOption enum. */ + enum SslOption { + SSL_OPTION_UNSPECIFIED = 0, + DISABLE = 1, + REQUIRE = 2, + VERIFY_CA = 3 + } + } + + /** Properties of a DiskEncryptionConfiguration. */ + interface IDiskEncryptionConfiguration { + + /** DiskEncryptionConfiguration kmsKeyName */ + kmsKeyName?: (string|null); + + /** DiskEncryptionConfiguration kind */ + kind?: (string|null); + } + + /** Represents a DiskEncryptionConfiguration. */ + class DiskEncryptionConfiguration implements IDiskEncryptionConfiguration { + + /** + * Constructs a new DiskEncryptionConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDiskEncryptionConfiguration); + + /** DiskEncryptionConfiguration kmsKeyName. */ + public kmsKeyName: string; + + /** DiskEncryptionConfiguration kind. */ + public kind: string; + + /** + * Creates a new DiskEncryptionConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns DiskEncryptionConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDiskEncryptionConfiguration): google.cloud.sql.v1beta4.DiskEncryptionConfiguration; + + /** + * Encodes the specified DiskEncryptionConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify|verify} messages. + * @param message DiskEncryptionConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDiskEncryptionConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DiskEncryptionConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify|verify} messages. + * @param message DiskEncryptionConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDiskEncryptionConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DiskEncryptionConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DiskEncryptionConfiguration; + + /** + * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DiskEncryptionConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DiskEncryptionConfiguration; + + /** + * Verifies a DiskEncryptionConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DiskEncryptionConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DiskEncryptionConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DiskEncryptionConfiguration; + + /** + * Creates a plain object from a DiskEncryptionConfiguration message. Also converts values to other types if specified. + * @param message DiskEncryptionConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DiskEncryptionConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DiskEncryptionConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DiskEncryptionConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DiskEncryptionStatus. */ + interface IDiskEncryptionStatus { + + /** DiskEncryptionStatus kmsKeyVersionName */ + kmsKeyVersionName?: (string|null); + + /** DiskEncryptionStatus kind */ + kind?: (string|null); + } + + /** Represents a DiskEncryptionStatus. */ + class DiskEncryptionStatus implements IDiskEncryptionStatus { + + /** + * Constructs a new DiskEncryptionStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDiskEncryptionStatus); + + /** DiskEncryptionStatus kmsKeyVersionName. */ + public kmsKeyVersionName: string; + + /** DiskEncryptionStatus kind. */ + public kind: string; + + /** + * Creates a new DiskEncryptionStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns DiskEncryptionStatus instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDiskEncryptionStatus): google.cloud.sql.v1beta4.DiskEncryptionStatus; + + /** + * Encodes the specified DiskEncryptionStatus message. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionStatus.verify|verify} messages. + * @param message DiskEncryptionStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDiskEncryptionStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DiskEncryptionStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionStatus.verify|verify} messages. + * @param message DiskEncryptionStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDiskEncryptionStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DiskEncryptionStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DiskEncryptionStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DiskEncryptionStatus; + + /** + * Decodes a DiskEncryptionStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DiskEncryptionStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DiskEncryptionStatus; + + /** + * Verifies a DiskEncryptionStatus message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DiskEncryptionStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DiskEncryptionStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DiskEncryptionStatus; + + /** + * Creates a plain object from a DiskEncryptionStatus message. Also converts values to other types if specified. + * @param message DiskEncryptionStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DiskEncryptionStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DiskEncryptionStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DiskEncryptionStatus + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlMaintenanceType enum. */ + enum SqlMaintenanceType { + SQL_MAINTENANCE_TYPE_UNSPECIFIED = 0, + INSTANCE_MAINTENANCE = 1, + REPLICA_INCLUDED_MAINTENANCE = 2, + INSTANCE_SELF_SERVICE_MAINTENANCE = 3, + REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE = 4 + } + + /** Properties of a SqlSubOperationType. */ + interface ISqlSubOperationType { + + /** SqlSubOperationType maintenanceType */ + maintenanceType?: (google.cloud.sql.v1beta4.SqlMaintenanceType|keyof typeof google.cloud.sql.v1beta4.SqlMaintenanceType|null); + } + + /** Represents a SqlSubOperationType. */ + class SqlSubOperationType implements ISqlSubOperationType { + + /** + * Constructs a new SqlSubOperationType. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlSubOperationType); + + /** SqlSubOperationType maintenanceType. */ + public maintenanceType?: (google.cloud.sql.v1beta4.SqlMaintenanceType|keyof typeof google.cloud.sql.v1beta4.SqlMaintenanceType|null); + + /** SqlSubOperationType subOperationDetails. */ + public subOperationDetails?: "maintenanceType"; + + /** + * Creates a new SqlSubOperationType instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlSubOperationType instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlSubOperationType): google.cloud.sql.v1beta4.SqlSubOperationType; + + /** + * Encodes the specified SqlSubOperationType message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSubOperationType.verify|verify} messages. + * @param message SqlSubOperationType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlSubOperationType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlSubOperationType message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSubOperationType.verify|verify} messages. + * @param message SqlSubOperationType message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlSubOperationType, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlSubOperationType message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlSubOperationType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlSubOperationType; + + /** + * Decodes a SqlSubOperationType message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlSubOperationType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlSubOperationType; + + /** + * Verifies a SqlSubOperationType message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlSubOperationType message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlSubOperationType + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlSubOperationType; + + /** + * Creates a plain object from a SqlSubOperationType message. Also converts values to other types if specified. + * @param message SqlSubOperationType + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlSubOperationType, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlSubOperationType to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlSubOperationType + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Operation. */ + interface IOperation { + + /** Operation kind */ + kind?: (string|null); + + /** Operation targetLink */ + targetLink?: (string|null); + + /** Operation status */ + status?: (google.cloud.sql.v1beta4.Operation.SqlOperationStatus|keyof typeof google.cloud.sql.v1beta4.Operation.SqlOperationStatus|null); + + /** Operation user */ + user?: (string|null); + + /** Operation insertTime */ + insertTime?: (google.protobuf.ITimestamp|null); + + /** Operation startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** Operation endTime */ + endTime?: (google.protobuf.ITimestamp|null); + + /** Operation error */ + error?: (google.cloud.sql.v1beta4.IOperationErrors|null); + + /** Operation apiWarning */ + apiWarning?: (google.cloud.sql.v1beta4.IApiWarning|null); + + /** Operation operationType */ + operationType?: (google.cloud.sql.v1beta4.Operation.SqlOperationType|keyof typeof google.cloud.sql.v1beta4.Operation.SqlOperationType|null); + + /** Operation importContext */ + importContext?: (google.cloud.sql.v1beta4.IImportContext|null); + + /** Operation exportContext */ + exportContext?: (google.cloud.sql.v1beta4.IExportContext|null); + + /** Operation backupContext */ + backupContext?: (google.cloud.sql.v1beta4.IBackupContext|null); + + /** Operation preCheckMajorVersionUpgradeContext */ + preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null); + + /** Operation name */ + name?: (string|null); + + /** Operation targetId */ + targetId?: (string|null); + + /** Operation selfLink */ + selfLink?: (string|null); + + /** Operation targetProject */ + targetProject?: (string|null); + + /** Operation acquireSsrsLeaseContext */ + acquireSsrsLeaseContext?: (google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null); + + /** Operation subOperationType */ + subOperationType?: (google.cloud.sql.v1beta4.ISqlSubOperationType|null); + } + + /** Represents an Operation. */ + class Operation implements IOperation { + + /** + * Constructs a new Operation. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IOperation); + + /** Operation kind. */ + public kind: string; + + /** Operation targetLink. */ + public targetLink: string; + + /** Operation status. */ + public status: (google.cloud.sql.v1beta4.Operation.SqlOperationStatus|keyof typeof google.cloud.sql.v1beta4.Operation.SqlOperationStatus); + + /** Operation user. */ + public user: string; + + /** Operation insertTime. */ + public insertTime?: (google.protobuf.ITimestamp|null); + + /** Operation startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** Operation endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** Operation error. */ + public error?: (google.cloud.sql.v1beta4.IOperationErrors|null); + + /** Operation apiWarning. */ + public apiWarning?: (google.cloud.sql.v1beta4.IApiWarning|null); + + /** Operation operationType. */ + public operationType: (google.cloud.sql.v1beta4.Operation.SqlOperationType|keyof typeof google.cloud.sql.v1beta4.Operation.SqlOperationType); + + /** Operation importContext. */ + public importContext?: (google.cloud.sql.v1beta4.IImportContext|null); + + /** Operation exportContext. */ + public exportContext?: (google.cloud.sql.v1beta4.IExportContext|null); + + /** Operation backupContext. */ + public backupContext?: (google.cloud.sql.v1beta4.IBackupContext|null); + + /** Operation preCheckMajorVersionUpgradeContext. */ + public preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null); + + /** Operation name. */ + public name: string; + + /** Operation targetId. */ + public targetId: string; + + /** Operation selfLink. */ + public selfLink: string; + + /** Operation targetProject. */ + public targetProject: string; + + /** Operation acquireSsrsLeaseContext. */ + public acquireSsrsLeaseContext?: (google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null); + + /** Operation subOperationType. */ + public subOperationType?: (google.cloud.sql.v1beta4.ISqlSubOperationType|null); + + /** + * Creates a new Operation instance using the specified properties. + * @param [properties] Properties to set + * @returns Operation instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IOperation): google.cloud.sql.v1beta4.Operation; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.cloud.sql.v1beta4.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Operation.verify|verify} messages. + * @param message Operation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Operation; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Operation; + + /** + * Verifies an Operation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Operation + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Operation; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @param message Operation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Operation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Operation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Operation { + + /** SqlOperationType enum. */ + enum SqlOperationType { + SQL_OPERATION_TYPE_UNSPECIFIED = 0, + IMPORT = 1, + EXPORT = 2, + CREATE = 3, + UPDATE = 4, + DELETE = 5, + RESTART = 6, + BACKUP = 7, + SNAPSHOT = 8, + BACKUP_VOLUME = 9, + DELETE_VOLUME = 10, + RESTORE_VOLUME = 11, + INJECT_USER = 12, + CLONE = 14, + STOP_REPLICA = 15, + START_REPLICA = 16, + PROMOTE_REPLICA = 17, + CREATE_REPLICA = 18, + CREATE_USER = 19, + DELETE_USER = 20, + UPDATE_USER = 21, + CREATE_DATABASE = 22, + DELETE_DATABASE = 23, + UPDATE_DATABASE = 24, + FAILOVER = 25, + DELETE_BACKUP = 26, + RECREATE_REPLICA = 27, + TRUNCATE_LOG = 28, + DEMOTE_MASTER = 29, + MAINTENANCE = 30, + ENABLE_PRIVATE_IP = 31, + DEFER_MAINTENANCE = 32, + CREATE_CLONE = 33, + RESCHEDULE_MAINTENANCE = 34, + START_EXTERNAL_SYNC = 35, + LOG_CLEANUP = 36, + AUTO_RESTART = 37, + REENCRYPT = 38, + SWITCHOVER = 39, + UPDATE_BACKUP = 40, + ACQUIRE_SSRS_LEASE = 42, + RELEASE_SSRS_LEASE = 43, + RECONFIGURE_OLD_PRIMARY = 44, + CLUSTER_MAINTENANCE = 45, + SELF_SERVICE_MAINTENANCE = 46, + SWITCHOVER_TO_REPLICA = 47, + MAJOR_VERSION_UPGRADE = 48, + ADVANCED_BACKUP = 49, + MANAGE_BACKUP = 50, + ENHANCED_BACKUP = 51, + REPAIR_READ_POOL = 52, + CREATE_READ_POOL = 53 + } + + /** SqlOperationStatus enum. */ + enum SqlOperationStatus { + SQL_OPERATION_STATUS_UNSPECIFIED = 0, + PENDING = 1, + RUNNING = 2, + DONE = 3 + } + } + + /** Properties of an OperationError. */ + interface IOperationError { + + /** OperationError kind */ + kind?: (string|null); + + /** OperationError code */ + code?: (string|null); + + /** OperationError message */ + message?: (string|null); + } + + /** Represents an OperationError. */ + class OperationError implements IOperationError { + + /** + * Constructs a new OperationError. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IOperationError); + + /** OperationError kind. */ + public kind: string; + + /** OperationError code. */ + public code: string; + + /** OperationError message. */ + public message: string; + + /** + * Creates a new OperationError instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationError instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IOperationError): google.cloud.sql.v1beta4.OperationError; + + /** + * Encodes the specified OperationError message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationError.verify|verify} messages. + * @param message OperationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationError.verify|verify} messages. + * @param message OperationError message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationError message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.OperationError; + + /** + * Decodes an OperationError message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.OperationError; + + /** + * Verifies an OperationError message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationError message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationError + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.OperationError; + + /** + * Creates a plain object from an OperationError message. Also converts values to other types if specified. + * @param message OperationError + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.OperationError, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationError to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationError + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an OperationErrors. */ + interface IOperationErrors { + + /** OperationErrors kind */ + kind?: (string|null); + + /** OperationErrors errors */ + errors?: (google.cloud.sql.v1beta4.IOperationError[]|null); + } + + /** Represents an OperationErrors. */ + class OperationErrors implements IOperationErrors { + + /** + * Constructs a new OperationErrors. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IOperationErrors); + + /** OperationErrors kind. */ + public kind: string; + + /** OperationErrors errors. */ + public errors: google.cloud.sql.v1beta4.IOperationError[]; + + /** + * Creates a new OperationErrors instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationErrors instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IOperationErrors): google.cloud.sql.v1beta4.OperationErrors; + + /** + * Encodes the specified OperationErrors message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationErrors.verify|verify} messages. + * @param message OperationErrors message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IOperationErrors, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationErrors message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationErrors.verify|verify} messages. + * @param message OperationErrors message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IOperationErrors, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationErrors message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationErrors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.OperationErrors; + + /** + * Decodes an OperationErrors message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationErrors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.OperationErrors; + + /** + * Verifies an OperationErrors message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationErrors message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationErrors + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.OperationErrors; + + /** + * Creates a plain object from an OperationErrors message. Also converts values to other types if specified. + * @param message OperationErrors + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.OperationErrors, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationErrors to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationErrors + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PasswordValidationPolicy. */ + interface IPasswordValidationPolicy { + + /** PasswordValidationPolicy minLength */ + minLength?: (google.protobuf.IInt32Value|null); + + /** PasswordValidationPolicy complexity */ + complexity?: (google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity|keyof typeof google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity|null); + + /** PasswordValidationPolicy reuseInterval */ + reuseInterval?: (google.protobuf.IInt32Value|null); + + /** PasswordValidationPolicy disallowUsernameSubstring */ + disallowUsernameSubstring?: (google.protobuf.IBoolValue|null); + + /** PasswordValidationPolicy passwordChangeInterval */ + passwordChangeInterval?: (google.protobuf.IDuration|null); + + /** PasswordValidationPolicy enablePasswordPolicy */ + enablePasswordPolicy?: (google.protobuf.IBoolValue|null); + + /** PasswordValidationPolicy disallowCompromisedCredentials */ + disallowCompromisedCredentials?: (google.protobuf.IBoolValue|null); + } + + /** Represents a PasswordValidationPolicy. */ + class PasswordValidationPolicy implements IPasswordValidationPolicy { + + /** + * Constructs a new PasswordValidationPolicy. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IPasswordValidationPolicy); + + /** PasswordValidationPolicy minLength. */ + public minLength?: (google.protobuf.IInt32Value|null); + + /** PasswordValidationPolicy complexity. */ + public complexity: (google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity|keyof typeof google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity); + + /** PasswordValidationPolicy reuseInterval. */ + public reuseInterval?: (google.protobuf.IInt32Value|null); + + /** PasswordValidationPolicy disallowUsernameSubstring. */ + public disallowUsernameSubstring?: (google.protobuf.IBoolValue|null); + + /** PasswordValidationPolicy passwordChangeInterval. */ + public passwordChangeInterval?: (google.protobuf.IDuration|null); + + /** PasswordValidationPolicy enablePasswordPolicy. */ + public enablePasswordPolicy?: (google.protobuf.IBoolValue|null); + + /** PasswordValidationPolicy disallowCompromisedCredentials. */ + public disallowCompromisedCredentials?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new PasswordValidationPolicy instance using the specified properties. + * @param [properties] Properties to set + * @returns PasswordValidationPolicy instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IPasswordValidationPolicy): google.cloud.sql.v1beta4.PasswordValidationPolicy; + + /** + * Encodes the specified PasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordValidationPolicy.verify|verify} messages. + * @param message PasswordValidationPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordValidationPolicy.verify|verify} messages. + * @param message PasswordValidationPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PasswordValidationPolicy message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PasswordValidationPolicy; + + /** + * Decodes a PasswordValidationPolicy message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PasswordValidationPolicy; + + /** + * Verifies a PasswordValidationPolicy message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PasswordValidationPolicy + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PasswordValidationPolicy; + + /** + * Creates a plain object from a PasswordValidationPolicy message. Also converts values to other types if specified. + * @param message PasswordValidationPolicy + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.PasswordValidationPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PasswordValidationPolicy to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PasswordValidationPolicy + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PasswordValidationPolicy { + + /** Complexity enum. */ + enum Complexity { + COMPLEXITY_UNSPECIFIED = 0, + COMPLEXITY_DEFAULT = 1 + } + } + + /** Properties of an OperationsListResponse. */ + interface IOperationsListResponse { + + /** OperationsListResponse kind */ + kind?: (string|null); + + /** OperationsListResponse items */ + items?: (google.cloud.sql.v1beta4.IOperation[]|null); + + /** OperationsListResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents an OperationsListResponse. */ + class OperationsListResponse implements IOperationsListResponse { + + /** + * Constructs a new OperationsListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IOperationsListResponse); + + /** OperationsListResponse kind. */ + public kind: string; + + /** OperationsListResponse items. */ + public items: google.cloud.sql.v1beta4.IOperation[]; + + /** OperationsListResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new OperationsListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns OperationsListResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IOperationsListResponse): google.cloud.sql.v1beta4.OperationsListResponse; + + /** + * Encodes the specified OperationsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationsListResponse.verify|verify} messages. + * @param message OperationsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IOperationsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OperationsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationsListResponse.verify|verify} messages. + * @param message OperationsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IOperationsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OperationsListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OperationsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.OperationsListResponse; + + /** + * Decodes an OperationsListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OperationsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.OperationsListResponse; + + /** + * Verifies an OperationsListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OperationsListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OperationsListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.OperationsListResponse; + + /** + * Creates a plain object from an OperationsListResponse message. Also converts values to other types if specified. + * @param message OperationsListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.OperationsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OperationsListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OperationsListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReplicaConfiguration. */ + interface IReplicaConfiguration { + + /** ReplicaConfiguration kind */ + kind?: (string|null); + + /** ReplicaConfiguration mysqlReplicaConfiguration */ + mysqlReplicaConfiguration?: (google.cloud.sql.v1beta4.IMySqlReplicaConfiguration|null); + + /** ReplicaConfiguration failoverTarget */ + failoverTarget?: (google.protobuf.IBoolValue|null); + + /** ReplicaConfiguration cascadableReplica */ + cascadableReplica?: (google.protobuf.IBoolValue|null); + } + + /** Represents a ReplicaConfiguration. */ + class ReplicaConfiguration implements IReplicaConfiguration { + + /** + * Constructs a new ReplicaConfiguration. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IReplicaConfiguration); + + /** ReplicaConfiguration kind. */ + public kind: string; + + /** ReplicaConfiguration mysqlReplicaConfiguration. */ + public mysqlReplicaConfiguration?: (google.cloud.sql.v1beta4.IMySqlReplicaConfiguration|null); + + /** ReplicaConfiguration failoverTarget. */ + public failoverTarget?: (google.protobuf.IBoolValue|null); + + /** ReplicaConfiguration cascadableReplica. */ + public cascadableReplica?: (google.protobuf.IBoolValue|null); + + /** + * Creates a new ReplicaConfiguration instance using the specified properties. + * @param [properties] Properties to set + * @returns ReplicaConfiguration instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IReplicaConfiguration): google.cloud.sql.v1beta4.ReplicaConfiguration; + + /** + * Encodes the specified ReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicaConfiguration.verify|verify} messages. + * @param message ReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicaConfiguration.verify|verify} messages. + * @param message ReplicaConfiguration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReplicaConfiguration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ReplicaConfiguration; + + /** + * Decodes a ReplicaConfiguration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ReplicaConfiguration; + + /** + * Verifies a ReplicaConfiguration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReplicaConfiguration + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ReplicaConfiguration; + + /** + * Creates a plain object from a ReplicaConfiguration message. Also converts values to other types if specified. + * @param message ReplicaConfiguration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReplicaConfiguration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReplicaConfiguration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RestoreBackupContext. */ + interface IRestoreBackupContext { + + /** RestoreBackupContext kind */ + kind?: (string|null); + + /** RestoreBackupContext backupRunId */ + backupRunId?: (number|Long|string|null); + + /** RestoreBackupContext instanceId */ + instanceId?: (string|null); + + /** RestoreBackupContext project */ + project?: (string|null); + } + + /** Represents a RestoreBackupContext. */ + class RestoreBackupContext implements IRestoreBackupContext { + + /** + * Constructs a new RestoreBackupContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IRestoreBackupContext); + + /** RestoreBackupContext kind. */ + public kind: string; + + /** RestoreBackupContext backupRunId. */ + public backupRunId: (number|Long|string); + + /** RestoreBackupContext instanceId. */ + public instanceId: string; + + /** RestoreBackupContext project. */ + public project: string; + + /** + * Creates a new RestoreBackupContext instance using the specified properties. + * @param [properties] Properties to set + * @returns RestoreBackupContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IRestoreBackupContext): google.cloud.sql.v1beta4.RestoreBackupContext; + + /** + * Encodes the specified RestoreBackupContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RestoreBackupContext.verify|verify} messages. + * @param message RestoreBackupContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IRestoreBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RestoreBackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RestoreBackupContext.verify|verify} messages. + * @param message RestoreBackupContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IRestoreBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RestoreBackupContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RestoreBackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.RestoreBackupContext; + + /** + * Decodes a RestoreBackupContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RestoreBackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.RestoreBackupContext; + + /** + * Verifies a RestoreBackupContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RestoreBackupContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RestoreBackupContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.RestoreBackupContext; + + /** + * Creates a plain object from a RestoreBackupContext message. Also converts values to other types if specified. + * @param message RestoreBackupContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.RestoreBackupContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RestoreBackupContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RestoreBackupContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RotateServerCaContext. */ + interface IRotateServerCaContext { + + /** RotateServerCaContext kind */ + kind?: (string|null); + + /** RotateServerCaContext nextVersion */ + nextVersion?: (string|null); + } + + /** Represents a RotateServerCaContext. */ + class RotateServerCaContext implements IRotateServerCaContext { + + /** + * Constructs a new RotateServerCaContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IRotateServerCaContext); + + /** RotateServerCaContext kind. */ + public kind: string; + + /** RotateServerCaContext nextVersion. */ + public nextVersion: string; + + /** + * Creates a new RotateServerCaContext instance using the specified properties. + * @param [properties] Properties to set + * @returns RotateServerCaContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IRotateServerCaContext): google.cloud.sql.v1beta4.RotateServerCaContext; + + /** + * Encodes the specified RotateServerCaContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCaContext.verify|verify} messages. + * @param message RotateServerCaContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IRotateServerCaContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RotateServerCaContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCaContext.verify|verify} messages. + * @param message RotateServerCaContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IRotateServerCaContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RotateServerCaContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RotateServerCaContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.RotateServerCaContext; + + /** + * Decodes a RotateServerCaContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RotateServerCaContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.RotateServerCaContext; + + /** + * Verifies a RotateServerCaContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RotateServerCaContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RotateServerCaContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.RotateServerCaContext; + + /** + * Creates a plain object from a RotateServerCaContext message. Also converts values to other types if specified. + * @param message RotateServerCaContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.RotateServerCaContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RotateServerCaContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RotateServerCaContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RotateServerCertificateContext. */ + interface IRotateServerCertificateContext { + + /** RotateServerCertificateContext kind */ + kind?: (string|null); + + /** RotateServerCertificateContext nextVersion */ + nextVersion?: (string|null); + } + + /** Represents a RotateServerCertificateContext. */ + class RotateServerCertificateContext implements IRotateServerCertificateContext { + + /** + * Constructs a new RotateServerCertificateContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IRotateServerCertificateContext); + + /** RotateServerCertificateContext kind. */ + public kind: string; + + /** RotateServerCertificateContext nextVersion. */ + public nextVersion: string; + + /** + * Creates a new RotateServerCertificateContext instance using the specified properties. + * @param [properties] Properties to set + * @returns RotateServerCertificateContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IRotateServerCertificateContext): google.cloud.sql.v1beta4.RotateServerCertificateContext; + + /** + * Encodes the specified RotateServerCertificateContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCertificateContext.verify|verify} messages. + * @param message RotateServerCertificateContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IRotateServerCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RotateServerCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCertificateContext.verify|verify} messages. + * @param message RotateServerCertificateContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IRotateServerCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RotateServerCertificateContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RotateServerCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.RotateServerCertificateContext; + + /** + * Decodes a RotateServerCertificateContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RotateServerCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.RotateServerCertificateContext; + + /** + * Verifies a RotateServerCertificateContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RotateServerCertificateContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RotateServerCertificateContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.RotateServerCertificateContext; + + /** + * Creates a plain object from a RotateServerCertificateContext message. Also converts values to other types if specified. + * @param message RotateServerCertificateContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.RotateServerCertificateContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RotateServerCertificateContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RotateServerCertificateContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RotateEntraIdCertificateContext. */ + interface IRotateEntraIdCertificateContext { + + /** RotateEntraIdCertificateContext kind */ + kind?: (string|null); + + /** RotateEntraIdCertificateContext nextVersion */ + nextVersion?: (string|null); + } + + /** Represents a RotateEntraIdCertificateContext. */ + class RotateEntraIdCertificateContext implements IRotateEntraIdCertificateContext { + + /** + * Constructs a new RotateEntraIdCertificateContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext); + + /** RotateEntraIdCertificateContext kind. */ + public kind: string; + + /** RotateEntraIdCertificateContext nextVersion. */ + public nextVersion: string; + + /** + * Creates a new RotateEntraIdCertificateContext instance using the specified properties. + * @param [properties] Properties to set + * @returns RotateEntraIdCertificateContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext): google.cloud.sql.v1beta4.RotateEntraIdCertificateContext; + + /** + * Encodes the specified RotateEntraIdCertificateContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.verify|verify} messages. + * @param message RotateEntraIdCertificateContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RotateEntraIdCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.verify|verify} messages. + * @param message RotateEntraIdCertificateContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RotateEntraIdCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.RotateEntraIdCertificateContext; + + /** + * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RotateEntraIdCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.RotateEntraIdCertificateContext; + + /** + * Verifies a RotateEntraIdCertificateContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RotateEntraIdCertificateContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RotateEntraIdCertificateContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.RotateEntraIdCertificateContext; + + /** + * Creates a plain object from a RotateEntraIdCertificateContext message. Also converts values to other types if specified. + * @param message RotateEntraIdCertificateContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.RotateEntraIdCertificateContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RotateEntraIdCertificateContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RotateEntraIdCertificateContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DataCacheConfig. */ + interface IDataCacheConfig { + + /** DataCacheConfig dataCacheEnabled */ + dataCacheEnabled?: (boolean|null); + } + + /** Represents a DataCacheConfig. */ + class DataCacheConfig implements IDataCacheConfig { + + /** + * Constructs a new DataCacheConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IDataCacheConfig); + + /** DataCacheConfig dataCacheEnabled. */ + public dataCacheEnabled: boolean; + + /** + * Creates a new DataCacheConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns DataCacheConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IDataCacheConfig): google.cloud.sql.v1beta4.DataCacheConfig; + + /** + * Encodes the specified DataCacheConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.DataCacheConfig.verify|verify} messages. + * @param message DataCacheConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IDataCacheConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DataCacheConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DataCacheConfig.verify|verify} messages. + * @param message DataCacheConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IDataCacheConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DataCacheConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DataCacheConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DataCacheConfig; + + /** + * Decodes a DataCacheConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DataCacheConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DataCacheConfig; + + /** + * Verifies a DataCacheConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DataCacheConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DataCacheConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DataCacheConfig; + + /** + * Creates a plain object from a DataCacheConfig message. Also converts values to other types if specified. + * @param message DataCacheConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.DataCacheConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DataCacheConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DataCacheConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FinalBackupConfig. */ + interface IFinalBackupConfig { + + /** FinalBackupConfig enabled */ + enabled?: (boolean|null); + + /** FinalBackupConfig retentionDays */ + retentionDays?: (number|null); + } + + /** Represents a FinalBackupConfig. */ + class FinalBackupConfig implements IFinalBackupConfig { + + /** + * Constructs a new FinalBackupConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IFinalBackupConfig); + + /** FinalBackupConfig enabled. */ + public enabled?: (boolean|null); + + /** FinalBackupConfig retentionDays. */ + public retentionDays?: (number|null); + + /** + * Creates a new FinalBackupConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns FinalBackupConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IFinalBackupConfig): google.cloud.sql.v1beta4.FinalBackupConfig; + + /** + * Encodes the specified FinalBackupConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.FinalBackupConfig.verify|verify} messages. + * @param message FinalBackupConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IFinalBackupConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FinalBackupConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FinalBackupConfig.verify|verify} messages. + * @param message FinalBackupConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IFinalBackupConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FinalBackupConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FinalBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.FinalBackupConfig; + + /** + * Decodes a FinalBackupConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FinalBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.FinalBackupConfig; + + /** + * Verifies a FinalBackupConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FinalBackupConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FinalBackupConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.FinalBackupConfig; + + /** + * Creates a plain object from a FinalBackupConfig message. Also converts values to other types if specified. + * @param message FinalBackupConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.FinalBackupConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FinalBackupConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FinalBackupConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Settings. */ + interface ISettings { + + /** Settings settingsVersion */ + settingsVersion?: (google.protobuf.IInt64Value|null); + + /** Settings authorizedGaeApplications */ + authorizedGaeApplications?: (string[]|null); + + /** Settings tier */ + tier?: (string|null); + + /** Settings kind */ + kind?: (string|null); + + /** Settings userLabels */ + userLabels?: ({ [k: string]: string }|null); + + /** Settings availabilityType */ + availabilityType?: (google.cloud.sql.v1beta4.SqlAvailabilityType|keyof typeof google.cloud.sql.v1beta4.SqlAvailabilityType|null); + + /** Settings pricingPlan */ + pricingPlan?: (google.cloud.sql.v1beta4.SqlPricingPlan|keyof typeof google.cloud.sql.v1beta4.SqlPricingPlan|null); + + /** Settings replicationType */ + replicationType?: (google.cloud.sql.v1beta4.SqlReplicationType|keyof typeof google.cloud.sql.v1beta4.SqlReplicationType|null); + + /** Settings storageAutoResizeLimit */ + storageAutoResizeLimit?: (google.protobuf.IInt64Value|null); + + /** Settings activationPolicy */ + activationPolicy?: (google.cloud.sql.v1beta4.Settings.SqlActivationPolicy|keyof typeof google.cloud.sql.v1beta4.Settings.SqlActivationPolicy|null); + + /** Settings ipConfiguration */ + ipConfiguration?: (google.cloud.sql.v1beta4.IIpConfiguration|null); + + /** Settings storageAutoResize */ + storageAutoResize?: (google.protobuf.IBoolValue|null); + + /** Settings locationPreference */ + locationPreference?: (google.cloud.sql.v1beta4.ILocationPreference|null); + + /** Settings databaseFlags */ + databaseFlags?: (google.cloud.sql.v1beta4.IDatabaseFlags[]|null); + + /** Settings dataDiskType */ + dataDiskType?: (google.cloud.sql.v1beta4.SqlDataDiskType|keyof typeof google.cloud.sql.v1beta4.SqlDataDiskType|null); + + /** Settings maintenanceWindow */ + maintenanceWindow?: (google.cloud.sql.v1beta4.IMaintenanceWindow|null); + + /** Settings backupConfiguration */ + backupConfiguration?: (google.cloud.sql.v1beta4.IBackupConfiguration|null); + + /** Settings databaseReplicationEnabled */ + databaseReplicationEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings crashSafeReplicationEnabled */ + crashSafeReplicationEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings dataDiskSizeGb */ + dataDiskSizeGb?: (google.protobuf.IInt64Value|null); + + /** Settings activeDirectoryConfig */ + activeDirectoryConfig?: (google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig|null); + + /** Settings collation */ + collation?: (string|null); + + /** Settings denyMaintenancePeriods */ + denyMaintenancePeriods?: (google.cloud.sql.v1beta4.IDenyMaintenancePeriod[]|null); + + /** Settings insightsConfig */ + insightsConfig?: (google.cloud.sql.v1beta4.IInsightsConfig|null); + + /** Settings passwordValidationPolicy */ + passwordValidationPolicy?: (google.cloud.sql.v1beta4.IPasswordValidationPolicy|null); + + /** Settings sqlServerAuditConfig */ + sqlServerAuditConfig?: (google.cloud.sql.v1beta4.ISqlServerAuditConfig|null); + + /** Settings edition */ + edition?: (google.cloud.sql.v1beta4.Settings.Edition|keyof typeof google.cloud.sql.v1beta4.Settings.Edition|null); + + /** Settings connectorEnforcement */ + connectorEnforcement?: (google.cloud.sql.v1beta4.Settings.ConnectorEnforcement|keyof typeof google.cloud.sql.v1beta4.Settings.ConnectorEnforcement|null); + + /** Settings deletionProtectionEnabled */ + deletionProtectionEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings timeZone */ + timeZone?: (string|null); + + /** Settings advancedMachineFeatures */ + advancedMachineFeatures?: (google.cloud.sql.v1beta4.IAdvancedMachineFeatures|null); + + /** Settings dataCacheConfig */ + dataCacheConfig?: (google.cloud.sql.v1beta4.IDataCacheConfig|null); + + /** Settings replicationLagMaxSeconds */ + replicationLagMaxSeconds?: (google.protobuf.IInt32Value|null); + + /** Settings enableGoogleMlIntegration */ + enableGoogleMlIntegration?: (google.protobuf.IBoolValue|null); + + /** Settings enableDataplexIntegration */ + enableDataplexIntegration?: (google.protobuf.IBoolValue|null); + + /** Settings retainBackupsOnDelete */ + retainBackupsOnDelete?: (google.protobuf.IBoolValue|null); + + /** Settings dataDiskProvisionedIops */ + dataDiskProvisionedIops?: (number|Long|string|null); + + /** Settings dataDiskProvisionedThroughput */ + dataDiskProvisionedThroughput?: (number|Long|string|null); + + /** Settings connectionPoolConfig */ + connectionPoolConfig?: (google.cloud.sql.v1beta4.IConnectionPoolConfig|null); + + /** Settings finalBackupConfig */ + finalBackupConfig?: (google.cloud.sql.v1beta4.IFinalBackupConfig|null); + + /** Settings readPoolAutoScaleConfig */ + readPoolAutoScaleConfig?: (google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig|null); + + /** Settings autoUpgradeEnabled */ + autoUpgradeEnabled?: (boolean|null); + + /** Settings entraidConfig */ + entraidConfig?: (google.cloud.sql.v1beta4.ISqlServerEntraIdConfig|null); + + /** Settings dataApiAccess */ + dataApiAccess?: (google.cloud.sql.v1beta4.Settings.DataApiAccess|keyof typeof google.cloud.sql.v1beta4.Settings.DataApiAccess|null); + + /** Settings performanceCaptureConfig */ + performanceCaptureConfig?: (google.cloud.sql.v1beta4.IPerformanceCaptureConfig|null); + } + + /** Represents a Settings. */ + class Settings implements ISettings { + + /** + * Constructs a new Settings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISettings); + + /** Settings settingsVersion. */ + public settingsVersion?: (google.protobuf.IInt64Value|null); + + /** Settings authorizedGaeApplications. */ + public authorizedGaeApplications: string[]; + + /** Settings tier. */ + public tier: string; + + /** Settings kind. */ + public kind: string; + + /** Settings userLabels. */ + public userLabels: { [k: string]: string }; + + /** Settings availabilityType. */ + public availabilityType: (google.cloud.sql.v1beta4.SqlAvailabilityType|keyof typeof google.cloud.sql.v1beta4.SqlAvailabilityType); + + /** Settings pricingPlan. */ + public pricingPlan: (google.cloud.sql.v1beta4.SqlPricingPlan|keyof typeof google.cloud.sql.v1beta4.SqlPricingPlan); + + /** Settings replicationType. */ + public replicationType: (google.cloud.sql.v1beta4.SqlReplicationType|keyof typeof google.cloud.sql.v1beta4.SqlReplicationType); + + /** Settings storageAutoResizeLimit. */ + public storageAutoResizeLimit?: (google.protobuf.IInt64Value|null); + + /** Settings activationPolicy. */ + public activationPolicy: (google.cloud.sql.v1beta4.Settings.SqlActivationPolicy|keyof typeof google.cloud.sql.v1beta4.Settings.SqlActivationPolicy); + + /** Settings ipConfiguration. */ + public ipConfiguration?: (google.cloud.sql.v1beta4.IIpConfiguration|null); + + /** Settings storageAutoResize. */ + public storageAutoResize?: (google.protobuf.IBoolValue|null); + + /** Settings locationPreference. */ + public locationPreference?: (google.cloud.sql.v1beta4.ILocationPreference|null); + + /** Settings databaseFlags. */ + public databaseFlags: google.cloud.sql.v1beta4.IDatabaseFlags[]; + + /** Settings dataDiskType. */ + public dataDiskType: (google.cloud.sql.v1beta4.SqlDataDiskType|keyof typeof google.cloud.sql.v1beta4.SqlDataDiskType); + + /** Settings maintenanceWindow. */ + public maintenanceWindow?: (google.cloud.sql.v1beta4.IMaintenanceWindow|null); + + /** Settings backupConfiguration. */ + public backupConfiguration?: (google.cloud.sql.v1beta4.IBackupConfiguration|null); + + /** Settings databaseReplicationEnabled. */ + public databaseReplicationEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings crashSafeReplicationEnabled. */ + public crashSafeReplicationEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings dataDiskSizeGb. */ + public dataDiskSizeGb?: (google.protobuf.IInt64Value|null); + + /** Settings activeDirectoryConfig. */ + public activeDirectoryConfig?: (google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig|null); + + /** Settings collation. */ + public collation: string; + + /** Settings denyMaintenancePeriods. */ + public denyMaintenancePeriods: google.cloud.sql.v1beta4.IDenyMaintenancePeriod[]; + + /** Settings insightsConfig. */ + public insightsConfig?: (google.cloud.sql.v1beta4.IInsightsConfig|null); + + /** Settings passwordValidationPolicy. */ + public passwordValidationPolicy?: (google.cloud.sql.v1beta4.IPasswordValidationPolicy|null); + + /** Settings sqlServerAuditConfig. */ + public sqlServerAuditConfig?: (google.cloud.sql.v1beta4.ISqlServerAuditConfig|null); + + /** Settings edition. */ + public edition: (google.cloud.sql.v1beta4.Settings.Edition|keyof typeof google.cloud.sql.v1beta4.Settings.Edition); + + /** Settings connectorEnforcement. */ + public connectorEnforcement: (google.cloud.sql.v1beta4.Settings.ConnectorEnforcement|keyof typeof google.cloud.sql.v1beta4.Settings.ConnectorEnforcement); + + /** Settings deletionProtectionEnabled. */ + public deletionProtectionEnabled?: (google.protobuf.IBoolValue|null); + + /** Settings timeZone. */ + public timeZone: string; + + /** Settings advancedMachineFeatures. */ + public advancedMachineFeatures?: (google.cloud.sql.v1beta4.IAdvancedMachineFeatures|null); + + /** Settings dataCacheConfig. */ + public dataCacheConfig?: (google.cloud.sql.v1beta4.IDataCacheConfig|null); + + /** Settings replicationLagMaxSeconds. */ + public replicationLagMaxSeconds?: (google.protobuf.IInt32Value|null); + + /** Settings enableGoogleMlIntegration. */ + public enableGoogleMlIntegration?: (google.protobuf.IBoolValue|null); + + /** Settings enableDataplexIntegration. */ + public enableDataplexIntegration?: (google.protobuf.IBoolValue|null); + + /** Settings retainBackupsOnDelete. */ + public retainBackupsOnDelete?: (google.protobuf.IBoolValue|null); + + /** Settings dataDiskProvisionedIops. */ + public dataDiskProvisionedIops?: (number|Long|string|null); + + /** Settings dataDiskProvisionedThroughput. */ + public dataDiskProvisionedThroughput?: (number|Long|string|null); + + /** Settings connectionPoolConfig. */ + public connectionPoolConfig?: (google.cloud.sql.v1beta4.IConnectionPoolConfig|null); + + /** Settings finalBackupConfig. */ + public finalBackupConfig?: (google.cloud.sql.v1beta4.IFinalBackupConfig|null); + + /** Settings readPoolAutoScaleConfig. */ + public readPoolAutoScaleConfig?: (google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig|null); + + /** Settings autoUpgradeEnabled. */ + public autoUpgradeEnabled?: (boolean|null); + + /** Settings entraidConfig. */ + public entraidConfig?: (google.cloud.sql.v1beta4.ISqlServerEntraIdConfig|null); + + /** Settings dataApiAccess. */ + public dataApiAccess?: (google.cloud.sql.v1beta4.Settings.DataApiAccess|keyof typeof google.cloud.sql.v1beta4.Settings.DataApiAccess|null); + + /** Settings performanceCaptureConfig. */ + public performanceCaptureConfig?: (google.cloud.sql.v1beta4.IPerformanceCaptureConfig|null); + + /** + * Creates a new Settings instance using the specified properties. + * @param [properties] Properties to set + * @returns Settings instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISettings): google.cloud.sql.v1beta4.Settings; + + /** + * Encodes the specified Settings message. Does not implicitly {@link google.cloud.sql.v1beta4.Settings.verify|verify} messages. + * @param message Settings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Settings.verify|verify} messages. + * @param message Settings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Settings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Settings; + + /** + * Decodes a Settings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Settings; + + /** + * Verifies a Settings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Settings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Settings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Settings; + + /** + * Creates a plain object from a Settings message. Also converts values to other types if specified. + * @param message Settings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.Settings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Settings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Settings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Settings { + + /** SqlActivationPolicy enum. */ + enum SqlActivationPolicy { + SQL_ACTIVATION_POLICY_UNSPECIFIED = 0, + ALWAYS = 1, + NEVER = 2, + ON_DEMAND = 3 + } + + /** Edition enum. */ + enum Edition { + EDITION_UNSPECIFIED = 0, + ENTERPRISE = 2, + ENTERPRISE_PLUS = 3 + } + + /** ConnectorEnforcement enum. */ + enum ConnectorEnforcement { + CONNECTOR_ENFORCEMENT_UNSPECIFIED = 0, + NOT_REQUIRED = 1, + REQUIRED = 2 + } + + /** DataApiAccess enum. */ + enum DataApiAccess { + DATA_API_ACCESS_UNSPECIFIED = 0, + DISALLOW_DATA_API = 1, + ALLOW_DATA_API = 2 + } + } + + /** Properties of a PerformanceCaptureConfig. */ + interface IPerformanceCaptureConfig { + + /** PerformanceCaptureConfig enabled */ + enabled?: (boolean|null); + + /** PerformanceCaptureConfig probingIntervalSeconds */ + probingIntervalSeconds?: (number|null); + + /** PerformanceCaptureConfig probeThreshold */ + probeThreshold?: (number|null); + + /** PerformanceCaptureConfig runningThreadsThreshold */ + runningThreadsThreshold?: (number|null); + + /** PerformanceCaptureConfig secondsBehindSourceThreshold */ + secondsBehindSourceThreshold?: (number|null); + + /** PerformanceCaptureConfig transactionDurationThreshold */ + transactionDurationThreshold?: (number|null); + } + + /** Represents a PerformanceCaptureConfig. */ + class PerformanceCaptureConfig implements IPerformanceCaptureConfig { + + /** + * Constructs a new PerformanceCaptureConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IPerformanceCaptureConfig); + + /** PerformanceCaptureConfig enabled. */ + public enabled?: (boolean|null); + + /** PerformanceCaptureConfig probingIntervalSeconds. */ + public probingIntervalSeconds?: (number|null); + + /** PerformanceCaptureConfig probeThreshold. */ + public probeThreshold?: (number|null); + + /** PerformanceCaptureConfig runningThreadsThreshold. */ + public runningThreadsThreshold?: (number|null); + + /** PerformanceCaptureConfig secondsBehindSourceThreshold. */ + public secondsBehindSourceThreshold?: (number|null); + + /** PerformanceCaptureConfig transactionDurationThreshold. */ + public transactionDurationThreshold?: (number|null); + + /** + * Creates a new PerformanceCaptureConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns PerformanceCaptureConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IPerformanceCaptureConfig): google.cloud.sql.v1beta4.PerformanceCaptureConfig; + + /** + * Encodes the specified PerformanceCaptureConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PerformanceCaptureConfig.verify|verify} messages. + * @param message PerformanceCaptureConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IPerformanceCaptureConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PerformanceCaptureConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PerformanceCaptureConfig.verify|verify} messages. + * @param message PerformanceCaptureConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IPerformanceCaptureConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PerformanceCaptureConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PerformanceCaptureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PerformanceCaptureConfig; + + /** + * Decodes a PerformanceCaptureConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PerformanceCaptureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PerformanceCaptureConfig; + + /** + * Verifies a PerformanceCaptureConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PerformanceCaptureConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PerformanceCaptureConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PerformanceCaptureConfig; + + /** + * Creates a plain object from a PerformanceCaptureConfig message. Also converts values to other types if specified. + * @param message PerformanceCaptureConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.PerformanceCaptureConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PerformanceCaptureConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PerformanceCaptureConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an AdvancedMachineFeatures. */ + interface IAdvancedMachineFeatures { + + /** AdvancedMachineFeatures threadsPerCore */ + threadsPerCore?: (number|null); + } + + /** Represents an AdvancedMachineFeatures. */ + class AdvancedMachineFeatures implements IAdvancedMachineFeatures { + + /** + * Constructs a new AdvancedMachineFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IAdvancedMachineFeatures); + + /** AdvancedMachineFeatures threadsPerCore. */ + public threadsPerCore: number; + + /** + * Creates a new AdvancedMachineFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns AdvancedMachineFeatures instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IAdvancedMachineFeatures): google.cloud.sql.v1beta4.AdvancedMachineFeatures; + + /** + * Encodes the specified AdvancedMachineFeatures message. Does not implicitly {@link google.cloud.sql.v1beta4.AdvancedMachineFeatures.verify|verify} messages. + * @param message AdvancedMachineFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IAdvancedMachineFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AdvancedMachineFeatures message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AdvancedMachineFeatures.verify|verify} messages. + * @param message AdvancedMachineFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IAdvancedMachineFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AdvancedMachineFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AdvancedMachineFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.AdvancedMachineFeatures; + + /** + * Decodes an AdvancedMachineFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AdvancedMachineFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.AdvancedMachineFeatures; + + /** + * Verifies an AdvancedMachineFeatures message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AdvancedMachineFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AdvancedMachineFeatures + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.AdvancedMachineFeatures; + + /** + * Creates a plain object from an AdvancedMachineFeatures message. Also converts values to other types if specified. + * @param message AdvancedMachineFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.AdvancedMachineFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AdvancedMachineFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AdvancedMachineFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCert. */ + interface ISslCert { + + /** SslCert kind */ + kind?: (string|null); + + /** SslCert certSerialNumber */ + certSerialNumber?: (string|null); + + /** SslCert cert */ + cert?: (string|null); + + /** SslCert createTime */ + createTime?: (google.protobuf.ITimestamp|null); + + /** SslCert commonName */ + commonName?: (string|null); + + /** SslCert expirationTime */ + expirationTime?: (google.protobuf.ITimestamp|null); + + /** SslCert sha1Fingerprint */ + sha1Fingerprint?: (string|null); + + /** SslCert instance */ + instance?: (string|null); + + /** SslCert selfLink */ + selfLink?: (string|null); + } + + /** Represents a SslCert. */ + class SslCert implements ISslCert { + + /** + * Constructs a new SslCert. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISslCert); + + /** SslCert kind. */ + public kind: string; + + /** SslCert certSerialNumber. */ + public certSerialNumber: string; + + /** SslCert cert. */ + public cert: string; + + /** SslCert createTime. */ + public createTime?: (google.protobuf.ITimestamp|null); + + /** SslCert commonName. */ + public commonName: string; + + /** SslCert expirationTime. */ + public expirationTime?: (google.protobuf.ITimestamp|null); + + /** SslCert sha1Fingerprint. */ + public sha1Fingerprint: string; + + /** SslCert instance. */ + public instance: string; + + /** SslCert selfLink. */ + public selfLink: string; + + /** + * Creates a new SslCert instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCert instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISslCert): google.cloud.sql.v1beta4.SslCert; + + /** + * Encodes the specified SslCert message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCert.verify|verify} messages. + * @param message SslCert message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISslCert, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCert message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCert.verify|verify} messages. + * @param message SslCert message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCert, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCert message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCert + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCert; + + /** + * Decodes a SslCert message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCert + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCert; + + /** + * Verifies a SslCert message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCert message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCert + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCert; + + /** + * Creates a plain object from a SslCert message. Also converts values to other types if specified. + * @param message SslCert + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SslCert, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCert to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCert + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCertDetail. */ + interface ISslCertDetail { + + /** SslCertDetail certInfo */ + certInfo?: (google.cloud.sql.v1beta4.ISslCert|null); + + /** SslCertDetail certPrivateKey */ + certPrivateKey?: (string|null); + } + + /** Represents a SslCertDetail. */ + class SslCertDetail implements ISslCertDetail { + + /** + * Constructs a new SslCertDetail. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISslCertDetail); + + /** SslCertDetail certInfo. */ + public certInfo?: (google.cloud.sql.v1beta4.ISslCert|null); + + /** SslCertDetail certPrivateKey. */ + public certPrivateKey: string; + + /** + * Creates a new SslCertDetail instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCertDetail instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISslCertDetail): google.cloud.sql.v1beta4.SslCertDetail; + + /** + * Encodes the specified SslCertDetail message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertDetail.verify|verify} messages. + * @param message SslCertDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISslCertDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCertDetail message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertDetail.verify|verify} messages. + * @param message SslCertDetail message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCertDetail, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCertDetail message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCertDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCertDetail; + + /** + * Decodes a SslCertDetail message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCertDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCertDetail; + + /** + * Verifies a SslCertDetail message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCertDetail message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCertDetail + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCertDetail; + + /** + * Creates a plain object from a SslCertDetail message. Also converts values to other types if specified. + * @param message SslCertDetail + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SslCertDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCertDetail to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCertDetail + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCertsCreateEphemeralRequest. */ + interface ISslCertsCreateEphemeralRequest { + + /** SslCertsCreateEphemeralRequest publicKey */ + publicKey?: (string|null); + + /** SslCertsCreateEphemeralRequest accessToken */ + accessToken?: (string|null); + } + + /** Represents a SslCertsCreateEphemeralRequest. */ + class SslCertsCreateEphemeralRequest implements ISslCertsCreateEphemeralRequest { + + /** + * Constructs a new SslCertsCreateEphemeralRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest); + + /** SslCertsCreateEphemeralRequest publicKey. */ + public publicKey: string; + + /** SslCertsCreateEphemeralRequest accessToken. */ + public accessToken: string; + + /** + * Creates a new SslCertsCreateEphemeralRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCertsCreateEphemeralRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest): google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest; + + /** + * Encodes the specified SslCertsCreateEphemeralRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.verify|verify} messages. + * @param message SslCertsCreateEphemeralRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCertsCreateEphemeralRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.verify|verify} messages. + * @param message SslCertsCreateEphemeralRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCertsCreateEphemeralRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest; + + /** + * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCertsCreateEphemeralRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest; + + /** + * Verifies a SslCertsCreateEphemeralRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCertsCreateEphemeralRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCertsCreateEphemeralRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest; + + /** + * Creates a plain object from a SslCertsCreateEphemeralRequest message. Also converts values to other types if specified. + * @param message SslCertsCreateEphemeralRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCertsCreateEphemeralRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCertsCreateEphemeralRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCertsInsertRequest. */ + interface ISslCertsInsertRequest { + + /** SslCertsInsertRequest commonName */ + commonName?: (string|null); + } + + /** Represents a SslCertsInsertRequest. */ + class SslCertsInsertRequest implements ISslCertsInsertRequest { + + /** + * Constructs a new SslCertsInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISslCertsInsertRequest); + + /** SslCertsInsertRequest commonName. */ + public commonName: string; + + /** + * Creates a new SslCertsInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCertsInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISslCertsInsertRequest): google.cloud.sql.v1beta4.SslCertsInsertRequest; + + /** + * Encodes the specified SslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertRequest.verify|verify} messages. + * @param message SslCertsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertRequest.verify|verify} messages. + * @param message SslCertsInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCertsInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCertsInsertRequest; + + /** + * Decodes a SslCertsInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCertsInsertRequest; + + /** + * Verifies a SslCertsInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCertsInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCertsInsertRequest; + + /** + * Creates a plain object from a SslCertsInsertRequest message. Also converts values to other types if specified. + * @param message SslCertsInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SslCertsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCertsInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCertsInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlInstancesRescheduleMaintenanceRequestBody. */ + interface ISqlInstancesRescheduleMaintenanceRequestBody { + + /** SqlInstancesRescheduleMaintenanceRequestBody reschedule */ + reschedule?: (google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null); + } + + /** Represents a SqlInstancesRescheduleMaintenanceRequestBody. */ + class SqlInstancesRescheduleMaintenanceRequestBody implements ISqlInstancesRescheduleMaintenanceRequestBody { + + /** + * Constructs a new SqlInstancesRescheduleMaintenanceRequestBody. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody); + + /** SqlInstancesRescheduleMaintenanceRequestBody reschedule. */ + public reschedule?: (google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null); + + /** + * Creates a new SqlInstancesRescheduleMaintenanceRequestBody instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlInstancesRescheduleMaintenanceRequestBody instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. + * @param message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. + * @param message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlInstancesRescheduleMaintenanceRequestBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlInstancesRescheduleMaintenanceRequestBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody; + + /** + * Verifies a SqlInstancesRescheduleMaintenanceRequestBody message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlInstancesRescheduleMaintenanceRequestBody message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlInstancesRescheduleMaintenanceRequestBody + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody; + + /** + * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequestBody message. Also converts values to other types if specified. + * @param message SqlInstancesRescheduleMaintenanceRequestBody + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlInstancesRescheduleMaintenanceRequestBody to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlInstancesRescheduleMaintenanceRequestBody + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlInstancesRescheduleMaintenanceRequestBody { + + /** RescheduleType enum. */ + enum RescheduleType { + RESCHEDULE_TYPE_UNSPECIFIED = 0, + IMMEDIATE = 1, + NEXT_AVAILABLE_WINDOW = 2, + SPECIFIC_TIME = 3 + } + + /** Properties of a Reschedule. */ + interface IReschedule { + + /** Reschedule rescheduleType */ + rescheduleType?: (google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|null); + + /** Reschedule scheduleTime */ + scheduleTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a Reschedule. */ + class Reschedule implements IReschedule { + + /** + * Constructs a new Reschedule. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule); + + /** Reschedule rescheduleType. */ + public rescheduleType: (google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType); + + /** Reschedule scheduleTime. */ + public scheduleTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new Reschedule instance using the specified properties. + * @param [properties] Properties to set + * @returns Reschedule instance + */ + public static create(properties?: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; + + /** + * Encodes the specified Reschedule message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. + * @param message Reschedule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Reschedule message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. + * @param message Reschedule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Reschedule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Reschedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; + + /** + * Decodes a Reschedule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Reschedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; + + /** + * Verifies a Reschedule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Reschedule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Reschedule + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; + + /** + * Creates a plain object from a Reschedule message. Also converts values to other types if specified. + * @param message Reschedule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Reschedule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Reschedule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SslCertsInsertResponse. */ + interface ISslCertsInsertResponse { + + /** SslCertsInsertResponse kind */ + kind?: (string|null); + + /** SslCertsInsertResponse operation */ + operation?: (google.cloud.sql.v1beta4.IOperation|null); + + /** SslCertsInsertResponse serverCaCert */ + serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); + + /** SslCertsInsertResponse clientCert */ + clientCert?: (google.cloud.sql.v1beta4.ISslCertDetail|null); + } + + /** Represents a SslCertsInsertResponse. */ + class SslCertsInsertResponse implements ISslCertsInsertResponse { + + /** + * Constructs a new SslCertsInsertResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISslCertsInsertResponse); + + /** SslCertsInsertResponse kind. */ + public kind: string; + + /** SslCertsInsertResponse operation. */ + public operation?: (google.cloud.sql.v1beta4.IOperation|null); + + /** SslCertsInsertResponse serverCaCert. */ + public serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); + + /** SslCertsInsertResponse clientCert. */ + public clientCert?: (google.cloud.sql.v1beta4.ISslCertDetail|null); + + /** + * Creates a new SslCertsInsertResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCertsInsertResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISslCertsInsertResponse): google.cloud.sql.v1beta4.SslCertsInsertResponse; + + /** + * Encodes the specified SslCertsInsertResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertResponse.verify|verify} messages. + * @param message SslCertsInsertResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISslCertsInsertResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCertsInsertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertResponse.verify|verify} messages. + * @param message SslCertsInsertResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCertsInsertResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCertsInsertResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCertsInsertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCertsInsertResponse; + + /** + * Decodes a SslCertsInsertResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCertsInsertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCertsInsertResponse; + + /** + * Verifies a SslCertsInsertResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCertsInsertResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCertsInsertResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCertsInsertResponse; + + /** + * Creates a plain object from a SslCertsInsertResponse message. Also converts values to other types if specified. + * @param message SslCertsInsertResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SslCertsInsertResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCertsInsertResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCertsInsertResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SslCertsListResponse. */ + interface ISslCertsListResponse { + + /** SslCertsListResponse kind */ + kind?: (string|null); + + /** SslCertsListResponse items */ + items?: (google.cloud.sql.v1beta4.ISslCert[]|null); + } + + /** Represents a SslCertsListResponse. */ + class SslCertsListResponse implements ISslCertsListResponse { + + /** + * Constructs a new SslCertsListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISslCertsListResponse); + + /** SslCertsListResponse kind. */ + public kind: string; + + /** SslCertsListResponse items. */ + public items: google.cloud.sql.v1beta4.ISslCert[]; + + /** + * Creates a new SslCertsListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns SslCertsListResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISslCertsListResponse): google.cloud.sql.v1beta4.SslCertsListResponse; + + /** + * Encodes the specified SslCertsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsListResponse.verify|verify} messages. + * @param message SslCertsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISslCertsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SslCertsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsListResponse.verify|verify} messages. + * @param message SslCertsListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCertsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SslCertsListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SslCertsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCertsListResponse; + + /** + * Decodes a SslCertsListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SslCertsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCertsListResponse; + + /** + * Verifies a SslCertsListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SslCertsListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SslCertsListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCertsListResponse; + + /** + * Creates a plain object from a SslCertsListResponse message. Also converts values to other types if specified. + * @param message SslCertsListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SslCertsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SslCertsListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SslCertsListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TruncateLogContext. */ + interface ITruncateLogContext { + + /** TruncateLogContext kind */ + kind?: (string|null); + + /** TruncateLogContext logType */ + logType?: (string|null); + } + + /** Represents a TruncateLogContext. */ + class TruncateLogContext implements ITruncateLogContext { + + /** + * Constructs a new TruncateLogContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ITruncateLogContext); + + /** TruncateLogContext kind. */ + public kind: string; + + /** TruncateLogContext logType. */ + public logType: string; + + /** + * Creates a new TruncateLogContext instance using the specified properties. + * @param [properties] Properties to set + * @returns TruncateLogContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ITruncateLogContext): google.cloud.sql.v1beta4.TruncateLogContext; + + /** + * Encodes the specified TruncateLogContext message. Does not implicitly {@link google.cloud.sql.v1beta4.TruncateLogContext.verify|verify} messages. + * @param message TruncateLogContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ITruncateLogContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TruncateLogContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.TruncateLogContext.verify|verify} messages. + * @param message TruncateLogContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ITruncateLogContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TruncateLogContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TruncateLogContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.TruncateLogContext; + + /** + * Decodes a TruncateLogContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TruncateLogContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.TruncateLogContext; + + /** + * Verifies a TruncateLogContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TruncateLogContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TruncateLogContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.TruncateLogContext; + + /** + * Creates a plain object from a TruncateLogContext message. Also converts values to other types if specified. + * @param message TruncateLogContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.TruncateLogContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TruncateLogContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TruncateLogContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlActiveDirectoryConfig. */ + interface ISqlActiveDirectoryConfig { + + /** SqlActiveDirectoryConfig kind */ + kind?: (string|null); + + /** SqlActiveDirectoryConfig domain */ + domain?: (string|null); + + /** SqlActiveDirectoryConfig mode */ + mode?: (google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode|keyof typeof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode|null); + + /** SqlActiveDirectoryConfig dnsServers */ + dnsServers?: (string[]|null); + + /** SqlActiveDirectoryConfig adminCredentialSecretName */ + adminCredentialSecretName?: (string|null); + + /** SqlActiveDirectoryConfig organizationalUnit */ + organizationalUnit?: (string|null); + } + + /** Represents a SqlActiveDirectoryConfig. */ + class SqlActiveDirectoryConfig implements ISqlActiveDirectoryConfig { + + /** + * Constructs a new SqlActiveDirectoryConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig); + + /** SqlActiveDirectoryConfig kind. */ + public kind: string; + + /** SqlActiveDirectoryConfig domain. */ + public domain: string; + + /** SqlActiveDirectoryConfig mode. */ + public mode: (google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode|keyof typeof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode); + + /** SqlActiveDirectoryConfig dnsServers. */ + public dnsServers: string[]; + + /** SqlActiveDirectoryConfig adminCredentialSecretName. */ + public adminCredentialSecretName: string; + + /** SqlActiveDirectoryConfig organizationalUnit. */ + public organizationalUnit: string; + + /** + * Creates a new SqlActiveDirectoryConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlActiveDirectoryConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig): google.cloud.sql.v1beta4.SqlActiveDirectoryConfig; + + /** + * Encodes the specified SqlActiveDirectoryConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.verify|verify} messages. + * @param message SqlActiveDirectoryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlActiveDirectoryConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.verify|verify} messages. + * @param message SqlActiveDirectoryConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlActiveDirectoryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlActiveDirectoryConfig; + + /** + * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlActiveDirectoryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlActiveDirectoryConfig; + + /** + * Verifies a SqlActiveDirectoryConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlActiveDirectoryConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlActiveDirectoryConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlActiveDirectoryConfig; + + /** + * Creates a plain object from a SqlActiveDirectoryConfig message. Also converts values to other types if specified. + * @param message SqlActiveDirectoryConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlActiveDirectoryConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlActiveDirectoryConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlActiveDirectoryConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SqlActiveDirectoryConfig { + + /** ActiveDirectoryMode enum. */ + enum ActiveDirectoryMode { + ACTIVE_DIRECTORY_MODE_UNSPECIFIED = 0, + MANAGED_ACTIVE_DIRECTORY = 1, + SELF_MANAGED_ACTIVE_DIRECTORY = 2, + CUSTOMER_MANAGED_ACTIVE_DIRECTORY = 3 + } + } + + /** Properties of a SqlServerAuditConfig. */ + interface ISqlServerAuditConfig { + + /** SqlServerAuditConfig kind */ + kind?: (string|null); + + /** SqlServerAuditConfig bucket */ + bucket?: (string|null); + + /** SqlServerAuditConfig retentionInterval */ + retentionInterval?: (google.protobuf.IDuration|null); + + /** SqlServerAuditConfig uploadInterval */ + uploadInterval?: (google.protobuf.IDuration|null); + } + + /** Represents a SqlServerAuditConfig. */ + class SqlServerAuditConfig implements ISqlServerAuditConfig { + + /** + * Constructs a new SqlServerAuditConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlServerAuditConfig); + + /** SqlServerAuditConfig kind. */ + public kind: string; + + /** SqlServerAuditConfig bucket. */ + public bucket: string; + + /** SqlServerAuditConfig retentionInterval. */ + public retentionInterval?: (google.protobuf.IDuration|null); + + /** SqlServerAuditConfig uploadInterval. */ + public uploadInterval?: (google.protobuf.IDuration|null); + + /** + * Creates a new SqlServerAuditConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlServerAuditConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlServerAuditConfig): google.cloud.sql.v1beta4.SqlServerAuditConfig; + + /** + * Encodes the specified SqlServerAuditConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerAuditConfig.verify|verify} messages. + * @param message SqlServerAuditConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlServerAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlServerAuditConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerAuditConfig.verify|verify} messages. + * @param message SqlServerAuditConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlServerAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlServerAuditConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlServerAuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlServerAuditConfig; + + /** + * Decodes a SqlServerAuditConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlServerAuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlServerAuditConfig; + + /** + * Verifies a SqlServerAuditConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlServerAuditConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlServerAuditConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlServerAuditConfig; + + /** + * Creates a plain object from a SqlServerAuditConfig message. Also converts values to other types if specified. + * @param message SqlServerAuditConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlServerAuditConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlServerAuditConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlServerAuditConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlServerEntraIdConfig. */ + interface ISqlServerEntraIdConfig { + + /** SqlServerEntraIdConfig kind */ + kind?: (string|null); + + /** SqlServerEntraIdConfig tenantId */ + tenantId?: (string|null); + + /** SqlServerEntraIdConfig applicationId */ + applicationId?: (string|null); + } + + /** Represents a SqlServerEntraIdConfig. */ + class SqlServerEntraIdConfig implements ISqlServerEntraIdConfig { + + /** + * Constructs a new SqlServerEntraIdConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlServerEntraIdConfig); + + /** SqlServerEntraIdConfig kind. */ + public kind: string; + + /** SqlServerEntraIdConfig tenantId. */ + public tenantId: string; + + /** SqlServerEntraIdConfig applicationId. */ + public applicationId: string; + + /** + * Creates a new SqlServerEntraIdConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlServerEntraIdConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlServerEntraIdConfig): google.cloud.sql.v1beta4.SqlServerEntraIdConfig; + + /** + * Encodes the specified SqlServerEntraIdConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerEntraIdConfig.verify|verify} messages. + * @param message SqlServerEntraIdConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlServerEntraIdConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlServerEntraIdConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerEntraIdConfig.verify|verify} messages. + * @param message SqlServerEntraIdConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlServerEntraIdConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlServerEntraIdConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlServerEntraIdConfig; + + /** + * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlServerEntraIdConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlServerEntraIdConfig; + + /** + * Verifies a SqlServerEntraIdConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlServerEntraIdConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlServerEntraIdConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlServerEntraIdConfig; + + /** + * Creates a plain object from a SqlServerEntraIdConfig message. Also converts values to other types if specified. + * @param message SqlServerEntraIdConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlServerEntraIdConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlServerEntraIdConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlServerEntraIdConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlBackupRunStatus enum. */ + enum SqlBackupRunStatus { + SQL_BACKUP_RUN_STATUS_UNSPECIFIED = 0, + ENQUEUED = 1, + OVERDUE = 2, + RUNNING = 3, + FAILED = 4, + SUCCESSFUL = 5, + SKIPPED = 6, + DELETION_PENDING = 7, + DELETION_FAILED = 8, + DELETED = 9 + } + + /** SqlBackupRunType enum. */ + enum SqlBackupRunType { + SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0, + AUTOMATED = 1, + ON_DEMAND = 2 + } + + /** SqlBackupKind enum. */ + enum SqlBackupKind { + SQL_BACKUP_KIND_UNSPECIFIED = 0, + SNAPSHOT = 1, + PHYSICAL = 2 + } + + /** SqlBackendType enum. */ + enum SqlBackendType { + SQL_BACKEND_TYPE_UNSPECIFIED = 0, + FIRST_GEN = 1, + SECOND_GEN = 2, + EXTERNAL = 3 + } + + /** SqlIpAddressType enum. */ + enum SqlIpAddressType { + SQL_IP_ADDRESS_TYPE_UNSPECIFIED = 0, + PRIMARY = 1, + OUTGOING = 2, + PRIVATE = 3, + MIGRATED_1ST_GEN = 4 + } + + /** SqlInstanceType enum. */ + enum SqlInstanceType { + SQL_INSTANCE_TYPE_UNSPECIFIED = 0, + CLOUD_SQL_INSTANCE = 1, + ON_PREMISES_INSTANCE = 2, + READ_REPLICA_INSTANCE = 3, + READ_POOL_INSTANCE = 5 + } + + /** Properties of a ConnectionPoolFlags. */ + interface IConnectionPoolFlags { + + /** ConnectionPoolFlags name */ + name?: (string|null); + + /** ConnectionPoolFlags value */ + value?: (string|null); + } + + /** Represents a ConnectionPoolFlags. */ + class ConnectionPoolFlags implements IConnectionPoolFlags { + + /** + * Constructs a new ConnectionPoolFlags. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IConnectionPoolFlags); + + /** ConnectionPoolFlags name. */ + public name: string; + + /** ConnectionPoolFlags value. */ + public value: string; + + /** + * Creates a new ConnectionPoolFlags instance using the specified properties. + * @param [properties] Properties to set + * @returns ConnectionPoolFlags instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IConnectionPoolFlags): google.cloud.sql.v1beta4.ConnectionPoolFlags; + + /** + * Encodes the specified ConnectionPoolFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolFlags.verify|verify} messages. + * @param message ConnectionPoolFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IConnectionPoolFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConnectionPoolFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolFlags.verify|verify} messages. + * @param message ConnectionPoolFlags message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IConnectionPoolFlags, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConnectionPoolFlags message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConnectionPoolFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ConnectionPoolFlags; + + /** + * Decodes a ConnectionPoolFlags message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConnectionPoolFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ConnectionPoolFlags; + + /** + * Verifies a ConnectionPoolFlags message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConnectionPoolFlags message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConnectionPoolFlags + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ConnectionPoolFlags; + + /** + * Creates a plain object from a ConnectionPoolFlags message. Also converts values to other types if specified. + * @param message ConnectionPoolFlags + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ConnectionPoolFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConnectionPoolFlags to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConnectionPoolFlags + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReadPoolAutoScaleConfig. */ + interface IReadPoolAutoScaleConfig { + + /** ReadPoolAutoScaleConfig enabled */ + enabled?: (boolean|null); + + /** ReadPoolAutoScaleConfig minNodeCount */ + minNodeCount?: (number|null); + + /** ReadPoolAutoScaleConfig maxNodeCount */ + maxNodeCount?: (number|null); + + /** ReadPoolAutoScaleConfig targetMetrics */ + targetMetrics?: (google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric[]|null); + + /** ReadPoolAutoScaleConfig disableScaleIn */ + disableScaleIn?: (boolean|null); + + /** ReadPoolAutoScaleConfig scaleInCooldownSeconds */ + scaleInCooldownSeconds?: (number|null); + + /** ReadPoolAutoScaleConfig scaleOutCooldownSeconds */ + scaleOutCooldownSeconds?: (number|null); + } + + /** Represents a ReadPoolAutoScaleConfig. */ + class ReadPoolAutoScaleConfig implements IReadPoolAutoScaleConfig { + + /** + * Constructs a new ReadPoolAutoScaleConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig); + + /** ReadPoolAutoScaleConfig enabled. */ + public enabled?: (boolean|null); + + /** ReadPoolAutoScaleConfig minNodeCount. */ + public minNodeCount?: (number|null); + + /** ReadPoolAutoScaleConfig maxNodeCount. */ + public maxNodeCount?: (number|null); + + /** ReadPoolAutoScaleConfig targetMetrics. */ + public targetMetrics: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric[]; + + /** ReadPoolAutoScaleConfig disableScaleIn. */ + public disableScaleIn?: (boolean|null); + + /** ReadPoolAutoScaleConfig scaleInCooldownSeconds. */ + public scaleInCooldownSeconds?: (number|null); + + /** ReadPoolAutoScaleConfig scaleOutCooldownSeconds. */ + public scaleOutCooldownSeconds?: (number|null); + + /** + * Creates a new ReadPoolAutoScaleConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ReadPoolAutoScaleConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig; + + /** + * Encodes the specified ReadPoolAutoScaleConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.verify|verify} messages. + * @param message ReadPoolAutoScaleConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReadPoolAutoScaleConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.verify|verify} messages. + * @param message ReadPoolAutoScaleConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReadPoolAutoScaleConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig; + + /** + * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReadPoolAutoScaleConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig; + + /** + * Verifies a ReadPoolAutoScaleConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReadPoolAutoScaleConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReadPoolAutoScaleConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig; + + /** + * Creates a plain object from a ReadPoolAutoScaleConfig message. Also converts values to other types if specified. + * @param message ReadPoolAutoScaleConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReadPoolAutoScaleConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReadPoolAutoScaleConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ReadPoolAutoScaleConfig { + + /** Properties of a TargetMetric. */ + interface ITargetMetric { + + /** TargetMetric metric */ + metric?: (string|null); + + /** TargetMetric targetValue */ + targetValue?: (number|null); + } + + /** Represents a TargetMetric. */ + class TargetMetric implements ITargetMetric { + + /** + * Constructs a new TargetMetric. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric); + + /** TargetMetric metric. */ + public metric?: (string|null); + + /** TargetMetric targetValue. */ + public targetValue?: (number|null); + + /** + * Creates a new TargetMetric instance using the specified properties. + * @param [properties] Properties to set + * @returns TargetMetric instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric; + + /** + * Encodes the specified TargetMetric message. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. + * @param message TargetMetric message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TargetMetric message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. + * @param message TargetMetric message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TargetMetric message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TargetMetric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric; + + /** + * Decodes a TargetMetric message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TargetMetric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric; + + /** + * Verifies a TargetMetric message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TargetMetric message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TargetMetric + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric; + + /** + * Creates a plain object from a TargetMetric message. Also converts values to other types if specified. + * @param message TargetMetric + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TargetMetric to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TargetMetric + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a ConnectionPoolConfig. */ + interface IConnectionPoolConfig { + + /** ConnectionPoolConfig connectionPoolingEnabled */ + connectionPoolingEnabled?: (boolean|null); + + /** ConnectionPoolConfig flags */ + flags?: (google.cloud.sql.v1beta4.IConnectionPoolFlags[]|null); + + /** ConnectionPoolConfig poolerCount */ + poolerCount?: (number|null); + } + + /** Represents a ConnectionPoolConfig. */ + class ConnectionPoolConfig implements IConnectionPoolConfig { + + /** + * Constructs a new ConnectionPoolConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IConnectionPoolConfig); + + /** ConnectionPoolConfig connectionPoolingEnabled. */ + public connectionPoolingEnabled?: (boolean|null); + + /** ConnectionPoolConfig flags. */ + public flags: google.cloud.sql.v1beta4.IConnectionPoolFlags[]; + + /** ConnectionPoolConfig poolerCount. */ + public poolerCount?: (number|null); + + /** + * Creates a new ConnectionPoolConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ConnectionPoolConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IConnectionPoolConfig): google.cloud.sql.v1beta4.ConnectionPoolConfig; + + /** + * Encodes the specified ConnectionPoolConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolConfig.verify|verify} messages. + * @param message ConnectionPoolConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IConnectionPoolConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConnectionPoolConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolConfig.verify|verify} messages. + * @param message ConnectionPoolConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IConnectionPoolConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConnectionPoolConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConnectionPoolConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ConnectionPoolConfig; + + /** + * Decodes a ConnectionPoolConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConnectionPoolConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ConnectionPoolConfig; + + /** + * Verifies a ConnectionPoolConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConnectionPoolConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConnectionPoolConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ConnectionPoolConfig; + + /** + * Creates a plain object from a ConnectionPoolConfig message. Also converts values to other types if specified. + * @param message ConnectionPoolConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ConnectionPoolConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConnectionPoolConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConnectionPoolConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlDatabaseVersion enum. */ + enum SqlDatabaseVersion { + SQL_DATABASE_VERSION_UNSPECIFIED = 0, + MYSQL_5_1 = 2, + MYSQL_5_5 = 3, + MYSQL_5_6 = 5, + MYSQL_5_7 = 6, + MYSQL_8_0 = 20, + MYSQL_8_0_18 = 41, + MYSQL_8_0_26 = 85, + MYSQL_8_0_27 = 111, + MYSQL_8_0_28 = 132, + MYSQL_8_0_29 = 148, + MYSQL_8_0_30 = 174, + MYSQL_8_0_31 = 197, + MYSQL_8_0_32 = 213, + MYSQL_8_0_33 = 238, + MYSQL_8_0_34 = 239, + MYSQL_8_0_35 = 240, + MYSQL_8_0_36 = 241, + MYSQL_8_0_37 = 355, + MYSQL_8_0_39 = 357, + MYSQL_8_0_40 = 358, + MYSQL_8_0_41 = 488, + MYSQL_8_0_42 = 489, + MYSQL_8_0_43 = 553, + MYSQL_8_0_44 = 554, + MYSQL_8_0_45 = 555, + MYSQL_8_0_46 = 556, + MYSQL_8_4 = 398, + MYSQL_9_7 = 654, + SQLSERVER_2017_STANDARD = 11, + SQLSERVER_2017_ENTERPRISE = 14, + SQLSERVER_2017_EXPRESS = 15, + SQLSERVER_2017_WEB = 16, + POSTGRES_9_6 = 9, + POSTGRES_10 = 18, + POSTGRES_11 = 10, + POSTGRES_12 = 19, + POSTGRES_13 = 23, + POSTGRES_14 = 110, + POSTGRES_15 = 172, + POSTGRES_16 = 272, + POSTGRES_17 = 408, + POSTGRES_18 = 557, + SQLSERVER_2019_STANDARD = 26, + SQLSERVER_2019_ENTERPRISE = 27, + SQLSERVER_2019_EXPRESS = 28, + SQLSERVER_2019_WEB = 29, + SQLSERVER_2022_STANDARD = 199, + SQLSERVER_2022_ENTERPRISE = 200, + SQLSERVER_2022_EXPRESS = 201, + SQLSERVER_2022_WEB = 202 + } + + /** SqlSuspensionReason enum. */ + enum SqlSuspensionReason { + SQL_SUSPENSION_REASON_UNSPECIFIED = 0, + BILLING_ISSUE = 2, + LEGAL_ISSUE = 3, + OPERATIONAL_ISSUE = 4, + KMS_KEY_ISSUE = 5 + } + + /** SqlPricingPlan enum. */ + enum SqlPricingPlan { + SQL_PRICING_PLAN_UNSPECIFIED = 0, + PACKAGE = 1, + PER_USE = 2 + } + + /** SqlReplicationType enum. */ + enum SqlReplicationType { + SQL_REPLICATION_TYPE_UNSPECIFIED = 0, + SYNCHRONOUS = 1, + ASYNCHRONOUS = 2 + } + + /** SqlDataDiskType enum. */ + enum SqlDataDiskType { + SQL_DATA_DISK_TYPE_UNSPECIFIED = 0, + PD_SSD = 1, + PD_HDD = 2, + OBSOLETE_LOCAL_SSD = 3, + HYPERDISK_BALANCED = 4 + } + + /** SqlAvailabilityType enum. */ + enum SqlAvailabilityType { + SQL_AVAILABILITY_TYPE_UNSPECIFIED = 0, + ZONAL = 1, + REGIONAL = 2 + } + + /** SqlUpdateTrack enum. */ + enum SqlUpdateTrack { + SQL_UPDATE_TRACK_UNSPECIFIED = 0, + canary = 1, + stable = 2, + week5 = 3 + } + + /** Properties of an AcquireSsrsLeaseContext. */ + interface IAcquireSsrsLeaseContext { + + /** AcquireSsrsLeaseContext setupLogin */ + setupLogin?: (string|null); + + /** AcquireSsrsLeaseContext serviceLogin */ + serviceLogin?: (string|null); + + /** AcquireSsrsLeaseContext reportDatabase */ + reportDatabase?: (string|null); + + /** AcquireSsrsLeaseContext duration */ + duration?: (google.protobuf.IDuration|null); + } + + /** Represents an AcquireSsrsLeaseContext. */ + class AcquireSsrsLeaseContext implements IAcquireSsrsLeaseContext { + + /** + * Constructs a new AcquireSsrsLeaseContext. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext); + + /** AcquireSsrsLeaseContext setupLogin. */ + public setupLogin?: (string|null); + + /** AcquireSsrsLeaseContext serviceLogin. */ + public serviceLogin?: (string|null); + + /** AcquireSsrsLeaseContext reportDatabase. */ + public reportDatabase?: (string|null); + + /** AcquireSsrsLeaseContext duration. */ + public duration?: (google.protobuf.IDuration|null); + + /** + * Creates a new AcquireSsrsLeaseContext instance using the specified properties. + * @param [properties] Properties to set + * @returns AcquireSsrsLeaseContext instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext): google.cloud.sql.v1beta4.AcquireSsrsLeaseContext; + + /** + * Encodes the specified AcquireSsrsLeaseContext message. Does not implicitly {@link google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify|verify} messages. + * @param message AcquireSsrsLeaseContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified AcquireSsrsLeaseContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify|verify} messages. + * @param message AcquireSsrsLeaseContext message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns AcquireSsrsLeaseContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.AcquireSsrsLeaseContext; + + /** + * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns AcquireSsrsLeaseContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.AcquireSsrsLeaseContext; + + /** + * Verifies an AcquireSsrsLeaseContext message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an AcquireSsrsLeaseContext message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns AcquireSsrsLeaseContext + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.AcquireSsrsLeaseContext; + + /** + * Creates a plain object from an AcquireSsrsLeaseContext message. Also converts values to other types if specified. + * @param message AcquireSsrsLeaseContext + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.AcquireSsrsLeaseContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this AcquireSsrsLeaseContext to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for AcquireSsrsLeaseContext + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** SqlFlagType enum. */ + enum SqlFlagType { + SQL_FLAG_TYPE_UNSPECIFIED = 0, + BOOLEAN = 1, + STRING = 2, + INTEGER = 3, + NONE = 4, + MYSQL_TIMEZONE_OFFSET = 5, + FLOAT = 6, + REPEATED_STRING = 7 + } + + /** SqlFlagScope enum. */ + enum SqlFlagScope { + SQL_FLAG_SCOPE_UNSPECIFIED = 0, + SQL_FLAG_SCOPE_DATABASE = 1, + SQL_FLAG_SCOPE_CONNECTION_POOL = 2 + } + + /** Represents a SqlConnectService */ + class SqlConnectService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlConnectService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlConnectService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlConnectService; + + /** + * Calls GetConnectSettings. + * @param request GetConnectSettingsRequest message or plain object + * @param callback Node-style callback called with the error, if any, and ConnectSettings + */ + public getConnectSettings(request: google.cloud.sql.v1beta4.IGetConnectSettingsRequest, callback: google.cloud.sql.v1beta4.SqlConnectService.GetConnectSettingsCallback): void; + + /** + * Calls GetConnectSettings. + * @param request GetConnectSettingsRequest message or plain object + * @returns Promise + */ + public getConnectSettings(request: google.cloud.sql.v1beta4.IGetConnectSettingsRequest): Promise; + + /** + * Calls GenerateEphemeralCert. + * @param request GenerateEphemeralCertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and GenerateEphemeralCertResponse + */ + public generateEphemeralCert(request: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, callback: google.cloud.sql.v1beta4.SqlConnectService.GenerateEphemeralCertCallback): void; + + /** + * Calls GenerateEphemeralCert. + * @param request GenerateEphemeralCertRequest message or plain object + * @returns Promise + */ + public generateEphemeralCert(request: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest): Promise; + } + + namespace SqlConnectService { + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlConnectService|getConnectSettings}. + * @param error Error, if any + * @param [response] ConnectSettings + */ + type GetConnectSettingsCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.ConnectSettings) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlConnectService|generateEphemeralCert}. + * @param error Error, if any + * @param [response] GenerateEphemeralCertResponse + */ + type GenerateEphemeralCertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.GenerateEphemeralCertResponse) => void; + } + + /** Properties of a GetConnectSettingsRequest. */ + interface IGetConnectSettingsRequest { + + /** GetConnectSettingsRequest instance */ + instance?: (string|null); + + /** GetConnectSettingsRequest project */ + project?: (string|null); + + /** GetConnectSettingsRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a GetConnectSettingsRequest. */ + class GetConnectSettingsRequest implements IGetConnectSettingsRequest { + + /** + * Constructs a new GetConnectSettingsRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IGetConnectSettingsRequest); + + /** GetConnectSettingsRequest instance. */ + public instance: string; + + /** GetConnectSettingsRequest project. */ + public project: string; + + /** GetConnectSettingsRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new GetConnectSettingsRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GetConnectSettingsRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IGetConnectSettingsRequest): google.cloud.sql.v1beta4.GetConnectSettingsRequest; + + /** + * Encodes the specified GetConnectSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GetConnectSettingsRequest.verify|verify} messages. + * @param message GetConnectSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IGetConnectSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GetConnectSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GetConnectSettingsRequest.verify|verify} messages. + * @param message GetConnectSettingsRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IGetConnectSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GetConnectSettingsRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GetConnectSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.GetConnectSettingsRequest; + + /** + * Decodes a GetConnectSettingsRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GetConnectSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.GetConnectSettingsRequest; + + /** + * Verifies a GetConnectSettingsRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GetConnectSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GetConnectSettingsRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.GetConnectSettingsRequest; + + /** + * Creates a plain object from a GetConnectSettingsRequest message. Also converts values to other types if specified. + * @param message GetConnectSettingsRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.GetConnectSettingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GetConnectSettingsRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GetConnectSettingsRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ConnectSettings. */ + interface IConnectSettings { + + /** ConnectSettings kind */ + kind?: (string|null); + + /** ConnectSettings serverCaCert */ + serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); + + /** ConnectSettings ipAddresses */ + ipAddresses?: (google.cloud.sql.v1beta4.IIpMapping[]|null); + + /** ConnectSettings region */ + region?: (string|null); + + /** ConnectSettings databaseVersion */ + databaseVersion?: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion|null); + + /** ConnectSettings backendType */ + backendType?: (google.cloud.sql.v1beta4.SqlBackendType|keyof typeof google.cloud.sql.v1beta4.SqlBackendType|null); + + /** ConnectSettings pscEnabled */ + pscEnabled?: (boolean|null); + + /** ConnectSettings dnsName */ + dnsName?: (string|null); + + /** ConnectSettings serverCaMode */ + serverCaMode?: (google.cloud.sql.v1beta4.ConnectSettings.CaMode|keyof typeof google.cloud.sql.v1beta4.ConnectSettings.CaMode|null); + + /** ConnectSettings customSubjectAlternativeNames */ + customSubjectAlternativeNames?: (string[]|null); + + /** ConnectSettings dnsNames */ + dnsNames?: (google.cloud.sql.v1beta4.IDnsNameMapping[]|null); + + /** ConnectSettings nodeCount */ + nodeCount?: (number|null); + + /** ConnectSettings nodes */ + nodes?: (google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig[]|null); + + /** ConnectSettings mdxProtocolSupport */ + mdxProtocolSupport?: (google.cloud.sql.v1beta4.ConnectSettings.MdxProtocolSupport[]|null); + } + + /** Represents a ConnectSettings. */ + class ConnectSettings implements IConnectSettings { + + /** + * Constructs a new ConnectSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IConnectSettings); + + /** ConnectSettings kind. */ + public kind: string; + + /** ConnectSettings serverCaCert. */ + public serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); + + /** ConnectSettings ipAddresses. */ + public ipAddresses: google.cloud.sql.v1beta4.IIpMapping[]; + + /** ConnectSettings region. */ + public region: string; + + /** ConnectSettings databaseVersion. */ + public databaseVersion: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion); + + /** ConnectSettings backendType. */ + public backendType: (google.cloud.sql.v1beta4.SqlBackendType|keyof typeof google.cloud.sql.v1beta4.SqlBackendType); + + /** ConnectSettings pscEnabled. */ + public pscEnabled: boolean; + + /** ConnectSettings dnsName. */ + public dnsName: string; + + /** ConnectSettings serverCaMode. */ + public serverCaMode: (google.cloud.sql.v1beta4.ConnectSettings.CaMode|keyof typeof google.cloud.sql.v1beta4.ConnectSettings.CaMode); + + /** ConnectSettings customSubjectAlternativeNames. */ + public customSubjectAlternativeNames: string[]; + + /** ConnectSettings dnsNames. */ + public dnsNames: google.cloud.sql.v1beta4.IDnsNameMapping[]; + + /** ConnectSettings nodeCount. */ + public nodeCount?: (number|null); + + /** ConnectSettings nodes. */ + public nodes: google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig[]; + + /** ConnectSettings mdxProtocolSupport. */ + public mdxProtocolSupport: google.cloud.sql.v1beta4.ConnectSettings.MdxProtocolSupport[]; + + /** + * Creates a new ConnectSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns ConnectSettings instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IConnectSettings): google.cloud.sql.v1beta4.ConnectSettings; + + /** + * Encodes the specified ConnectSettings message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.verify|verify} messages. + * @param message ConnectSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IConnectSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConnectSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.verify|verify} messages. + * @param message ConnectSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IConnectSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConnectSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConnectSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ConnectSettings; + + /** + * Decodes a ConnectSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConnectSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ConnectSettings; + + /** + * Verifies a ConnectSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConnectSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConnectSettings + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ConnectSettings; + + /** + * Creates a plain object from a ConnectSettings message. Also converts values to other types if specified. + * @param message ConnectSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ConnectSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConnectSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConnectSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ConnectSettings { + + /** CaMode enum. */ + enum CaMode { + CA_MODE_UNSPECIFIED = 0, + GOOGLE_MANAGED_INTERNAL_CA = 1, + GOOGLE_MANAGED_CAS_CA = 2, + CUSTOMER_MANAGED_CAS_CA = 3 + } + + /** Properties of a ConnectPoolNodeConfig. */ + interface IConnectPoolNodeConfig { + + /** ConnectPoolNodeConfig name */ + name?: (string|null); + + /** ConnectPoolNodeConfig ipAddresses */ + ipAddresses?: (google.cloud.sql.v1beta4.IIpMapping[]|null); + + /** ConnectPoolNodeConfig dnsName */ + dnsName?: (string|null); + + /** ConnectPoolNodeConfig dnsNames */ + dnsNames?: (google.cloud.sql.v1beta4.IDnsNameMapping[]|null); + } + + /** Represents a ConnectPoolNodeConfig. */ + class ConnectPoolNodeConfig implements IConnectPoolNodeConfig { + + /** + * Constructs a new ConnectPoolNodeConfig. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig); + + /** ConnectPoolNodeConfig name. */ + public name?: (string|null); + + /** ConnectPoolNodeConfig ipAddresses. */ + public ipAddresses: google.cloud.sql.v1beta4.IIpMapping[]; + + /** ConnectPoolNodeConfig dnsName. */ + public dnsName?: (string|null); + + /** ConnectPoolNodeConfig dnsNames. */ + public dnsNames: google.cloud.sql.v1beta4.IDnsNameMapping[]; + + /** + * Creates a new ConnectPoolNodeConfig instance using the specified properties. + * @param [properties] Properties to set + * @returns ConnectPoolNodeConfig instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig): google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig; + + /** + * Encodes the specified ConnectPoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. + * @param message ConnectPoolNodeConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ConnectPoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. + * @param message ConnectPoolNodeConfig message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ConnectPoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig; + + /** + * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ConnectPoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig; + + /** + * Verifies a ConnectPoolNodeConfig message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ConnectPoolNodeConfig message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ConnectPoolNodeConfig + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig; + + /** + * Creates a plain object from a ConnectPoolNodeConfig message. Also converts values to other types if specified. + * @param message ConnectPoolNodeConfig + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ConnectPoolNodeConfig to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ConnectPoolNodeConfig + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** MdxProtocolSupport enum. */ + enum MdxProtocolSupport { + MDX_PROTOCOL_SUPPORT_UNSPECIFIED = 0, + CLIENT_PROTOCOL_TYPE = 1 + } + } + + /** Properties of a GenerateEphemeralCertRequest. */ + interface IGenerateEphemeralCertRequest { + + /** GenerateEphemeralCertRequest instance */ + instance?: (string|null); + + /** GenerateEphemeralCertRequest project */ + project?: (string|null); + + /** GenerateEphemeralCertRequest publicKey */ + publicKey?: (string|null); + + /** GenerateEphemeralCertRequest accessToken */ + accessToken?: (string|null); + + /** GenerateEphemeralCertRequest readTime */ + readTime?: (google.protobuf.ITimestamp|null); + + /** GenerateEphemeralCertRequest validDuration */ + validDuration?: (google.protobuf.IDuration|null); + } + + /** Represents a GenerateEphemeralCertRequest. */ + class GenerateEphemeralCertRequest implements IGenerateEphemeralCertRequest { + + /** + * Constructs a new GenerateEphemeralCertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest); + + /** GenerateEphemeralCertRequest instance. */ + public instance: string; + + /** GenerateEphemeralCertRequest project. */ + public project: string; + + /** GenerateEphemeralCertRequest publicKey. */ + public publicKey: string; + + /** GenerateEphemeralCertRequest accessToken. */ + public accessToken: string; + + /** GenerateEphemeralCertRequest readTime. */ + public readTime?: (google.protobuf.ITimestamp|null); + + /** GenerateEphemeralCertRequest validDuration. */ + public validDuration?: (google.protobuf.IDuration|null); + + /** + * Creates a new GenerateEphemeralCertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateEphemeralCertRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest): google.cloud.sql.v1beta4.GenerateEphemeralCertRequest; + + /** + * Encodes the specified GenerateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.verify|verify} messages. + * @param message GenerateEphemeralCertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.verify|verify} messages. + * @param message GenerateEphemeralCertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.GenerateEphemeralCertRequest; + + /** + * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.GenerateEphemeralCertRequest; + + /** + * Verifies a GenerateEphemeralCertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateEphemeralCertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.GenerateEphemeralCertRequest; + + /** + * Creates a plain object from a GenerateEphemeralCertRequest message. Also converts values to other types if specified. + * @param message GenerateEphemeralCertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.GenerateEphemeralCertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateEphemeralCertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateEphemeralCertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GenerateEphemeralCertResponse. */ + interface IGenerateEphemeralCertResponse { + + /** GenerateEphemeralCertResponse ephemeralCert */ + ephemeralCert?: (google.cloud.sql.v1beta4.ISslCert|null); + } + + /** Represents a GenerateEphemeralCertResponse. */ + class GenerateEphemeralCertResponse implements IGenerateEphemeralCertResponse { + + /** + * Constructs a new GenerateEphemeralCertResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse); + + /** GenerateEphemeralCertResponse ephemeralCert. */ + public ephemeralCert?: (google.cloud.sql.v1beta4.ISslCert|null); + + /** + * Creates a new GenerateEphemeralCertResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns GenerateEphemeralCertResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse): google.cloud.sql.v1beta4.GenerateEphemeralCertResponse; + + /** + * Encodes the specified GenerateEphemeralCertResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertResponse.verify|verify} messages. + * @param message GenerateEphemeralCertResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GenerateEphemeralCertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertResponse.verify|verify} messages. + * @param message GenerateEphemeralCertResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GenerateEphemeralCertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.GenerateEphemeralCertResponse; + + /** + * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GenerateEphemeralCertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.GenerateEphemeralCertResponse; + + /** + * Verifies a GenerateEphemeralCertResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GenerateEphemeralCertResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GenerateEphemeralCertResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.GenerateEphemeralCertResponse; + + /** + * Creates a plain object from a GenerateEphemeralCertResponse message. Also converts values to other types if specified. + * @param message GenerateEphemeralCertResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.GenerateEphemeralCertResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GenerateEphemeralCertResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GenerateEphemeralCertResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a SqlIamPoliciesService */ + class SqlIamPoliciesService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlIamPoliciesService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlIamPoliciesService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlIamPoliciesService; + } + + /** Represents a SqlTiersService */ + class SqlTiersService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlTiersService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlTiersService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlTiersService; + + /** + * Calls List. + * @param request SqlTiersListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and TiersListResponse + */ + public list(request: google.cloud.sql.v1beta4.ISqlTiersListRequest, callback: google.cloud.sql.v1beta4.SqlTiersService.ListCallback): void; + + /** + * Calls List. + * @param request SqlTiersListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1beta4.ISqlTiersListRequest): Promise; + } + + namespace SqlTiersService { + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlTiersService|list}. + * @param error Error, if any + * @param [response] TiersListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.TiersListResponse) => void; + } + + /** Properties of a SqlTiersListRequest. */ + interface ISqlTiersListRequest { + + /** SqlTiersListRequest project */ + project?: (string|null); + } + + /** Represents a SqlTiersListRequest. */ + class SqlTiersListRequest implements ISqlTiersListRequest { + + /** + * Constructs a new SqlTiersListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlTiersListRequest); + + /** SqlTiersListRequest project. */ + public project: string; + + /** + * Creates a new SqlTiersListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlTiersListRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlTiersListRequest): google.cloud.sql.v1beta4.SqlTiersListRequest; + + /** + * Encodes the specified SqlTiersListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlTiersListRequest.verify|verify} messages. + * @param message SqlTiersListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlTiersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlTiersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlTiersListRequest.verify|verify} messages. + * @param message SqlTiersListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlTiersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlTiersListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlTiersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlTiersListRequest; + + /** + * Decodes a SqlTiersListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlTiersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlTiersListRequest; + + /** + * Verifies a SqlTiersListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlTiersListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlTiersListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlTiersListRequest; + + /** + * Creates a plain object from a SqlTiersListRequest message. Also converts values to other types if specified. + * @param message SqlTiersListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlTiersListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlTiersListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlTiersListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a TiersListResponse. */ + interface ITiersListResponse { + + /** TiersListResponse kind */ + kind?: (string|null); + + /** TiersListResponse items */ + items?: (google.cloud.sql.v1beta4.ITier[]|null); + } + + /** Represents a TiersListResponse. */ + class TiersListResponse implements ITiersListResponse { + + /** + * Constructs a new TiersListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ITiersListResponse); + + /** TiersListResponse kind. */ + public kind: string; + + /** TiersListResponse items. */ + public items: google.cloud.sql.v1beta4.ITier[]; + + /** + * Creates a new TiersListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns TiersListResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ITiersListResponse): google.cloud.sql.v1beta4.TiersListResponse; + + /** + * Encodes the specified TiersListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.TiersListResponse.verify|verify} messages. + * @param message TiersListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ITiersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TiersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.TiersListResponse.verify|verify} messages. + * @param message TiersListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ITiersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TiersListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TiersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.TiersListResponse; + + /** + * Decodes a TiersListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TiersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.TiersListResponse; + + /** + * Verifies a TiersListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TiersListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TiersListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.TiersListResponse; + + /** + * Creates a plain object from a TiersListResponse message. Also converts values to other types if specified. + * @param message TiersListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.TiersListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TiersListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TiersListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Tier. */ + interface ITier { + + /** Tier tier */ + tier?: (string|null); + + /** Tier RAM */ + RAM?: (number|Long|string|null); + + /** Tier kind */ + kind?: (string|null); + + /** Tier Disk_Quota */ + Disk_Quota?: (number|Long|string|null); + + /** Tier region */ + region?: (string[]|null); + } + + /** Represents a Tier. */ + class Tier implements ITier { + + /** + * Constructs a new Tier. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ITier); + + /** Tier tier. */ + public tier: string; + + /** Tier RAM. */ + public RAM: (number|Long|string); + + /** Tier kind. */ + public kind: string; + + /** Tier Disk_Quota. */ + public Disk_Quota: (number|Long|string); + + /** Tier region. */ + public region: string[]; + + /** + * Creates a new Tier instance using the specified properties. + * @param [properties] Properties to set + * @returns Tier instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ITier): google.cloud.sql.v1beta4.Tier; + + /** + * Encodes the specified Tier message. Does not implicitly {@link google.cloud.sql.v1beta4.Tier.verify|verify} messages. + * @param message Tier message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ITier, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Tier message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Tier.verify|verify} messages. + * @param message Tier message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ITier, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Tier message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Tier + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Tier; + + /** + * Decodes a Tier message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Tier + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Tier; + + /** + * Verifies a Tier message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Tier message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Tier + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Tier; + + /** + * Creates a plain object from a Tier message. Also converts values to other types if specified. + * @param message Tier + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.Tier, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Tier to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Tier + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Represents a SqlUsersService */ + class SqlUsersService extends $protobuf.rpc.Service { + + /** + * Constructs a new SqlUsersService service. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + */ + constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); + + /** + * Creates new SqlUsersService service using the specified rpc implementation. + * @param rpcImpl RPC implementation + * @param [requestDelimited=false] Whether requests are length-delimited + * @param [responseDelimited=false] Whether responses are length-delimited + * @returns RPC service. Useful where requests and/or responses are streamed. + */ + public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlUsersService; + + /** + * Calls Delete. + * @param request SqlUsersDeleteRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public delete(request: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, callback: google.cloud.sql.v1beta4.SqlUsersService.DeleteCallback): void; + + /** + * Calls Delete. + * @param request SqlUsersDeleteRequest message or plain object + * @returns Promise + */ + public delete(request: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest): Promise; + + /** + * Calls Get. + * @param request SqlUsersGetRequest message or plain object + * @param callback Node-style callback called with the error, if any, and User + */ + public get(request: google.cloud.sql.v1beta4.ISqlUsersGetRequest, callback: google.cloud.sql.v1beta4.SqlUsersService.GetCallback): void; + + /** + * Calls Get. + * @param request SqlUsersGetRequest message or plain object + * @returns Promise + */ + public get(request: google.cloud.sql.v1beta4.ISqlUsersGetRequest): Promise; + + /** + * Calls Insert. + * @param request SqlUsersInsertRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public insert(request: google.cloud.sql.v1beta4.ISqlUsersInsertRequest, callback: google.cloud.sql.v1beta4.SqlUsersService.InsertCallback): void; + + /** + * Calls Insert. + * @param request SqlUsersInsertRequest message or plain object + * @returns Promise + */ + public insert(request: google.cloud.sql.v1beta4.ISqlUsersInsertRequest): Promise; + + /** + * Calls List. + * @param request SqlUsersListRequest message or plain object + * @param callback Node-style callback called with the error, if any, and UsersListResponse + */ + public list(request: google.cloud.sql.v1beta4.ISqlUsersListRequest, callback: google.cloud.sql.v1beta4.SqlUsersService.ListCallback): void; + + /** + * Calls List. + * @param request SqlUsersListRequest message or plain object + * @returns Promise + */ + public list(request: google.cloud.sql.v1beta4.ISqlUsersListRequest): Promise; + + /** + * Calls Update. + * @param request SqlUsersUpdateRequest message or plain object + * @param callback Node-style callback called with the error, if any, and Operation + */ + public update(request: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, callback: google.cloud.sql.v1beta4.SqlUsersService.UpdateCallback): void; + + /** + * Calls Update. + * @param request SqlUsersUpdateRequest message or plain object + * @returns Promise + */ + public update(request: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest): Promise; + } + + namespace SqlUsersService { + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|delete_}. + * @param error Error, if any + * @param [response] Operation + */ + type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|get}. + * @param error Error, if any + * @param [response] User + */ + type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.User) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|insert}. + * @param error Error, if any + * @param [response] Operation + */ + type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|list}. + * @param error Error, if any + * @param [response] UsersListResponse + */ + type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.UsersListResponse) => void; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|update}. + * @param error Error, if any + * @param [response] Operation + */ + type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; + } + + /** Properties of a SqlUsersDeleteRequest. */ + interface ISqlUsersDeleteRequest { + + /** SqlUsersDeleteRequest host */ + host?: (string|null); + + /** SqlUsersDeleteRequest instance */ + instance?: (string|null); + + /** SqlUsersDeleteRequest name */ + name?: (string|null); + + /** SqlUsersDeleteRequest project */ + project?: (string|null); + } + + /** Represents a SqlUsersDeleteRequest. */ + class SqlUsersDeleteRequest implements ISqlUsersDeleteRequest { + + /** + * Constructs a new SqlUsersDeleteRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest); + + /** SqlUsersDeleteRequest host. */ + public host: string; + + /** SqlUsersDeleteRequest instance. */ + public instance: string; + + /** SqlUsersDeleteRequest name. */ + public name: string; + + /** SqlUsersDeleteRequest project. */ + public project: string; + + /** + * Creates a new SqlUsersDeleteRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlUsersDeleteRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest): google.cloud.sql.v1beta4.SqlUsersDeleteRequest; + + /** + * Encodes the specified SqlUsersDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersDeleteRequest.verify|verify} messages. + * @param message SqlUsersDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlUsersDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersDeleteRequest.verify|verify} messages. + * @param message SqlUsersDeleteRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlUsersDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlUsersDeleteRequest; + + /** + * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlUsersDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlUsersDeleteRequest; + + /** + * Verifies a SqlUsersDeleteRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlUsersDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlUsersDeleteRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlUsersDeleteRequest; + + /** + * Creates a plain object from a SqlUsersDeleteRequest message. Also converts values to other types if specified. + * @param message SqlUsersDeleteRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlUsersDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlUsersDeleteRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlUsersDeleteRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlUsersGetRequest. */ + interface ISqlUsersGetRequest { + + /** SqlUsersGetRequest instance */ + instance?: (string|null); + + /** SqlUsersGetRequest name */ + name?: (string|null); + + /** SqlUsersGetRequest project */ + project?: (string|null); + + /** SqlUsersGetRequest host */ + host?: (string|null); + } + + /** Represents a SqlUsersGetRequest. */ + class SqlUsersGetRequest implements ISqlUsersGetRequest { + + /** + * Constructs a new SqlUsersGetRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlUsersGetRequest); + + /** SqlUsersGetRequest instance. */ + public instance: string; + + /** SqlUsersGetRequest name. */ + public name: string; + + /** SqlUsersGetRequest project. */ + public project: string; + + /** SqlUsersGetRequest host. */ + public host: string; + + /** + * Creates a new SqlUsersGetRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlUsersGetRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlUsersGetRequest): google.cloud.sql.v1beta4.SqlUsersGetRequest; + + /** + * Encodes the specified SqlUsersGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersGetRequest.verify|verify} messages. + * @param message SqlUsersGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlUsersGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlUsersGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersGetRequest.verify|verify} messages. + * @param message SqlUsersGetRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlUsersGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlUsersGetRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlUsersGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlUsersGetRequest; + + /** + * Decodes a SqlUsersGetRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlUsersGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlUsersGetRequest; + + /** + * Verifies a SqlUsersGetRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlUsersGetRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlUsersGetRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlUsersGetRequest; + + /** + * Creates a plain object from a SqlUsersGetRequest message. Also converts values to other types if specified. + * @param message SqlUsersGetRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlUsersGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlUsersGetRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlUsersGetRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlUsersInsertRequest. */ + interface ISqlUsersInsertRequest { + + /** SqlUsersInsertRequest instance */ + instance?: (string|null); + + /** SqlUsersInsertRequest project */ + project?: (string|null); + + /** SqlUsersInsertRequest body */ + body?: (google.cloud.sql.v1beta4.IUser|null); + } + + /** Represents a SqlUsersInsertRequest. */ + class SqlUsersInsertRequest implements ISqlUsersInsertRequest { + + /** + * Constructs a new SqlUsersInsertRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlUsersInsertRequest); + + /** SqlUsersInsertRequest instance. */ + public instance: string; + + /** SqlUsersInsertRequest project. */ + public project: string; + + /** SqlUsersInsertRequest body. */ + public body?: (google.cloud.sql.v1beta4.IUser|null); + + /** + * Creates a new SqlUsersInsertRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlUsersInsertRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlUsersInsertRequest): google.cloud.sql.v1beta4.SqlUsersInsertRequest; + + /** + * Encodes the specified SqlUsersInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersInsertRequest.verify|verify} messages. + * @param message SqlUsersInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlUsersInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlUsersInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersInsertRequest.verify|verify} messages. + * @param message SqlUsersInsertRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlUsersInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlUsersInsertRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlUsersInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlUsersInsertRequest; + + /** + * Decodes a SqlUsersInsertRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlUsersInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlUsersInsertRequest; + + /** + * Verifies a SqlUsersInsertRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlUsersInsertRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlUsersInsertRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlUsersInsertRequest; + + /** + * Creates a plain object from a SqlUsersInsertRequest message. Also converts values to other types if specified. + * @param message SqlUsersInsertRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlUsersInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlUsersInsertRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlUsersInsertRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlUsersListRequest. */ + interface ISqlUsersListRequest { + + /** SqlUsersListRequest instance */ + instance?: (string|null); + + /** SqlUsersListRequest project */ + project?: (string|null); + } + + /** Represents a SqlUsersListRequest. */ + class SqlUsersListRequest implements ISqlUsersListRequest { + + /** + * Constructs a new SqlUsersListRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlUsersListRequest); + + /** SqlUsersListRequest instance. */ + public instance: string; + + /** SqlUsersListRequest project. */ + public project: string; + + /** + * Creates a new SqlUsersListRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlUsersListRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlUsersListRequest): google.cloud.sql.v1beta4.SqlUsersListRequest; + + /** + * Encodes the specified SqlUsersListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersListRequest.verify|verify} messages. + * @param message SqlUsersListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlUsersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlUsersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersListRequest.verify|verify} messages. + * @param message SqlUsersListRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlUsersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlUsersListRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlUsersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlUsersListRequest; + + /** + * Decodes a SqlUsersListRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlUsersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlUsersListRequest; + + /** + * Verifies a SqlUsersListRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlUsersListRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlUsersListRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlUsersListRequest; + + /** + * Creates a plain object from a SqlUsersListRequest message. Also converts values to other types if specified. + * @param message SqlUsersListRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlUsersListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlUsersListRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlUsersListRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a SqlUsersUpdateRequest. */ + interface ISqlUsersUpdateRequest { + + /** SqlUsersUpdateRequest host */ + host?: (string|null); + + /** SqlUsersUpdateRequest instance */ + instance?: (string|null); + + /** SqlUsersUpdateRequest name */ + name?: (string|null); + + /** SqlUsersUpdateRequest project */ + project?: (string|null); + + /** SqlUsersUpdateRequest databaseRoles */ + databaseRoles?: (string[]|null); + + /** SqlUsersUpdateRequest revokeExistingRoles */ + revokeExistingRoles?: (boolean|null); + + /** SqlUsersUpdateRequest body */ + body?: (google.cloud.sql.v1beta4.IUser|null); + } + + /** Represents a SqlUsersUpdateRequest. */ + class SqlUsersUpdateRequest implements ISqlUsersUpdateRequest { + + /** + * Constructs a new SqlUsersUpdateRequest. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest); + + /** SqlUsersUpdateRequest host. */ + public host: string; + + /** SqlUsersUpdateRequest instance. */ + public instance: string; + + /** SqlUsersUpdateRequest name. */ + public name: string; + + /** SqlUsersUpdateRequest project. */ + public project: string; + + /** SqlUsersUpdateRequest databaseRoles. */ + public databaseRoles: string[]; + + /** SqlUsersUpdateRequest revokeExistingRoles. */ + public revokeExistingRoles?: (boolean|null); + + /** SqlUsersUpdateRequest body. */ + public body?: (google.cloud.sql.v1beta4.IUser|null); + + /** + * Creates a new SqlUsersUpdateRequest instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlUsersUpdateRequest instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest): google.cloud.sql.v1beta4.SqlUsersUpdateRequest; + + /** + * Encodes the specified SqlUsersUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersUpdateRequest.verify|verify} messages. + * @param message SqlUsersUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlUsersUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersUpdateRequest.verify|verify} messages. + * @param message SqlUsersUpdateRequest message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlUsersUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlUsersUpdateRequest; + + /** + * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlUsersUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlUsersUpdateRequest; + + /** + * Verifies a SqlUsersUpdateRequest message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlUsersUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlUsersUpdateRequest + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlUsersUpdateRequest; + + /** + * Creates a plain object from a SqlUsersUpdateRequest message. Also converts values to other types if specified. + * @param message SqlUsersUpdateRequest + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlUsersUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlUsersUpdateRequest to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlUsersUpdateRequest + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UserPasswordValidationPolicy. */ + interface IUserPasswordValidationPolicy { + + /** UserPasswordValidationPolicy allowedFailedAttempts */ + allowedFailedAttempts?: (number|null); + + /** UserPasswordValidationPolicy passwordExpirationDuration */ + passwordExpirationDuration?: (google.protobuf.IDuration|null); + + /** UserPasswordValidationPolicy enableFailedAttemptsCheck */ + enableFailedAttemptsCheck?: (boolean|null); + + /** UserPasswordValidationPolicy status */ + status?: (google.cloud.sql.v1beta4.IPasswordStatus|null); + + /** UserPasswordValidationPolicy enablePasswordVerification */ + enablePasswordVerification?: (boolean|null); + } + + /** Represents a UserPasswordValidationPolicy. */ + class UserPasswordValidationPolicy implements IUserPasswordValidationPolicy { + + /** + * Constructs a new UserPasswordValidationPolicy. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IUserPasswordValidationPolicy); + + /** UserPasswordValidationPolicy allowedFailedAttempts. */ + public allowedFailedAttempts: number; + + /** UserPasswordValidationPolicy passwordExpirationDuration. */ + public passwordExpirationDuration?: (google.protobuf.IDuration|null); + + /** UserPasswordValidationPolicy enableFailedAttemptsCheck. */ + public enableFailedAttemptsCheck: boolean; + + /** UserPasswordValidationPolicy status. */ + public status?: (google.cloud.sql.v1beta4.IPasswordStatus|null); + + /** UserPasswordValidationPolicy enablePasswordVerification. */ + public enablePasswordVerification: boolean; + + /** + * Creates a new UserPasswordValidationPolicy instance using the specified properties. + * @param [properties] Properties to set + * @returns UserPasswordValidationPolicy instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IUserPasswordValidationPolicy): google.cloud.sql.v1beta4.UserPasswordValidationPolicy; + + /** + * Encodes the specified UserPasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1beta4.UserPasswordValidationPolicy.verify|verify} messages. + * @param message UserPasswordValidationPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IUserPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UserPasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UserPasswordValidationPolicy.verify|verify} messages. + * @param message UserPasswordValidationPolicy message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IUserPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UserPasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.UserPasswordValidationPolicy; + + /** + * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UserPasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.UserPasswordValidationPolicy; + + /** + * Verifies a UserPasswordValidationPolicy message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UserPasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UserPasswordValidationPolicy + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.UserPasswordValidationPolicy; + + /** + * Creates a plain object from a UserPasswordValidationPolicy message. Also converts values to other types if specified. + * @param message UserPasswordValidationPolicy + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.UserPasswordValidationPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UserPasswordValidationPolicy to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UserPasswordValidationPolicy + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PasswordStatus. */ + interface IPasswordStatus { + + /** PasswordStatus locked */ + locked?: (boolean|null); + + /** PasswordStatus passwordExpirationTime */ + passwordExpirationTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents a PasswordStatus. */ + class PasswordStatus implements IPasswordStatus { + + /** + * Constructs a new PasswordStatus. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IPasswordStatus); + + /** PasswordStatus locked. */ + public locked: boolean; + + /** PasswordStatus passwordExpirationTime. */ + public passwordExpirationTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new PasswordStatus instance using the specified properties. + * @param [properties] Properties to set + * @returns PasswordStatus instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IPasswordStatus): google.cloud.sql.v1beta4.PasswordStatus; + + /** + * Encodes the specified PasswordStatus message. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordStatus.verify|verify} messages. + * @param message PasswordStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IPasswordStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PasswordStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordStatus.verify|verify} messages. + * @param message PasswordStatus message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IPasswordStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PasswordStatus message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PasswordStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PasswordStatus; + + /** + * Decodes a PasswordStatus message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PasswordStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PasswordStatus; + + /** + * Verifies a PasswordStatus message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PasswordStatus message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PasswordStatus + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PasswordStatus; + + /** + * Creates a plain object from a PasswordStatus message. Also converts values to other types if specified. + * @param message PasswordStatus + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.PasswordStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PasswordStatus to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PasswordStatus + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a User. */ + interface IUser { + + /** User kind */ + kind?: (string|null); + + /** User password */ + password?: (string|null); + + /** User etag */ + etag?: (string|null); + + /** User name */ + name?: (string|null); + + /** User host */ + host?: (string|null); + + /** User instance */ + instance?: (string|null); + + /** User project */ + project?: (string|null); + + /** User type */ + type?: (google.cloud.sql.v1beta4.User.SqlUserType|keyof typeof google.cloud.sql.v1beta4.User.SqlUserType|null); + + /** User sqlserverUserDetails */ + sqlserverUserDetails?: (google.cloud.sql.v1beta4.ISqlServerUserDetails|null); + + /** User iamEmail */ + iamEmail?: (string|null); + + /** User passwordPolicy */ + passwordPolicy?: (google.cloud.sql.v1beta4.IUserPasswordValidationPolicy|null); + + /** User dualPasswordType */ + dualPasswordType?: (google.cloud.sql.v1beta4.User.DualPasswordType|keyof typeof google.cloud.sql.v1beta4.User.DualPasswordType|null); + + /** User iamStatus */ + iamStatus?: (google.cloud.sql.v1beta4.User.IamStatus|keyof typeof google.cloud.sql.v1beta4.User.IamStatus|null); + + /** User databaseRoles */ + databaseRoles?: (string[]|null); + } + + /** Represents a User. */ + class User implements IUser { + + /** + * Constructs a new User. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IUser); + + /** User kind. */ + public kind: string; + + /** User password. */ + public password: string; + + /** User etag. */ + public etag: string; + + /** User name. */ + public name: string; + + /** User host. */ + public host: string; + + /** User instance. */ + public instance: string; + + /** User project. */ + public project: string; + + /** User type. */ + public type: (google.cloud.sql.v1beta4.User.SqlUserType|keyof typeof google.cloud.sql.v1beta4.User.SqlUserType); + + /** User sqlserverUserDetails. */ + public sqlserverUserDetails?: (google.cloud.sql.v1beta4.ISqlServerUserDetails|null); + + /** User iamEmail. */ + public iamEmail: string; + + /** User passwordPolicy. */ + public passwordPolicy?: (google.cloud.sql.v1beta4.IUserPasswordValidationPolicy|null); + + /** User dualPasswordType. */ + public dualPasswordType?: (google.cloud.sql.v1beta4.User.DualPasswordType|keyof typeof google.cloud.sql.v1beta4.User.DualPasswordType|null); + + /** User iamStatus. */ + public iamStatus?: (google.cloud.sql.v1beta4.User.IamStatus|keyof typeof google.cloud.sql.v1beta4.User.IamStatus|null); + + /** User databaseRoles. */ + public databaseRoles: string[]; + + /** User userDetails. */ + public userDetails?: "sqlserverUserDetails"; + + /** + * Creates a new User instance using the specified properties. + * @param [properties] Properties to set + * @returns User instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IUser): google.cloud.sql.v1beta4.User; + + /** + * Encodes the specified User message. Does not implicitly {@link google.cloud.sql.v1beta4.User.verify|verify} messages. + * @param message User message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IUser, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified User message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.User.verify|verify} messages. + * @param message User message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IUser, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a User message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns User + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.User; + + /** + * Decodes a User message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns User + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.User; + + /** + * Verifies a User message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a User message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns User + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.User; + + /** + * Creates a plain object from a User message. Also converts values to other types if specified. + * @param message User + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.User, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this User to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for User + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace User { + + /** SqlUserType enum. */ + enum SqlUserType { + BUILT_IN = 0, + CLOUD_IAM_USER = 1, + CLOUD_IAM_SERVICE_ACCOUNT = 2, + CLOUD_IAM_GROUP = 3, + CLOUD_IAM_GROUP_USER = 4, + CLOUD_IAM_GROUP_SERVICE_ACCOUNT = 5, + ENTRAID_USER = 7 + } + + /** DualPasswordType enum. */ + enum DualPasswordType { + DUAL_PASSWORD_TYPE_UNSPECIFIED = 0, + NO_MODIFY_DUAL_PASSWORD = 1, + NO_DUAL_PASSWORD = 2, + DUAL_PASSWORD = 3 + } + + /** IamStatus enum. */ + enum IamStatus { + IAM_STATUS_UNSPECIFIED = 0, + INACTIVE = 1, + ACTIVE = 2 + } + } + + /** Properties of a SqlServerUserDetails. */ + interface ISqlServerUserDetails { + + /** SqlServerUserDetails disabled */ + disabled?: (boolean|null); + + /** SqlServerUserDetails serverRoles */ + serverRoles?: (string[]|null); + } + + /** Represents a SqlServerUserDetails. */ + class SqlServerUserDetails implements ISqlServerUserDetails { + + /** + * Constructs a new SqlServerUserDetails. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.ISqlServerUserDetails); + + /** SqlServerUserDetails disabled. */ + public disabled: boolean; + + /** SqlServerUserDetails serverRoles. */ + public serverRoles: string[]; + + /** + * Creates a new SqlServerUserDetails instance using the specified properties. + * @param [properties] Properties to set + * @returns SqlServerUserDetails instance + */ + public static create(properties?: google.cloud.sql.v1beta4.ISqlServerUserDetails): google.cloud.sql.v1beta4.SqlServerUserDetails; + + /** + * Encodes the specified SqlServerUserDetails message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerUserDetails.verify|verify} messages. + * @param message SqlServerUserDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.ISqlServerUserDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SqlServerUserDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerUserDetails.verify|verify} messages. + * @param message SqlServerUserDetails message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlServerUserDetails, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SqlServerUserDetails message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SqlServerUserDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlServerUserDetails; + + /** + * Decodes a SqlServerUserDetails message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SqlServerUserDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlServerUserDetails; + + /** + * Verifies a SqlServerUserDetails message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SqlServerUserDetails message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SqlServerUserDetails + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlServerUserDetails; + + /** + * Creates a plain object from a SqlServerUserDetails message. Also converts values to other types if specified. + * @param message SqlServerUserDetails + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.SqlServerUserDetails, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SqlServerUserDetails to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SqlServerUserDetails + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UsersListResponse. */ + interface IUsersListResponse { + + /** UsersListResponse kind */ + kind?: (string|null); + + /** UsersListResponse items */ + items?: (google.cloud.sql.v1beta4.IUser[]|null); + + /** UsersListResponse nextPageToken */ + nextPageToken?: (string|null); + } + + /** Represents a UsersListResponse. */ + class UsersListResponse implements IUsersListResponse { + + /** + * Constructs a new UsersListResponse. + * @param [properties] Properties to set + */ + constructor(properties?: google.cloud.sql.v1beta4.IUsersListResponse); + + /** UsersListResponse kind. */ + public kind: string; + + /** UsersListResponse items. */ + public items: google.cloud.sql.v1beta4.IUser[]; + + /** UsersListResponse nextPageToken. */ + public nextPageToken: string; + + /** + * Creates a new UsersListResponse instance using the specified properties. + * @param [properties] Properties to set + * @returns UsersListResponse instance + */ + public static create(properties?: google.cloud.sql.v1beta4.IUsersListResponse): google.cloud.sql.v1beta4.UsersListResponse; + + /** + * Encodes the specified UsersListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.UsersListResponse.verify|verify} messages. + * @param message UsersListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.cloud.sql.v1beta4.IUsersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UsersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UsersListResponse.verify|verify} messages. + * @param message UsersListResponse message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.cloud.sql.v1beta4.IUsersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UsersListResponse message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UsersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.UsersListResponse; + + /** + * Decodes a UsersListResponse message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UsersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.UsersListResponse; + + /** + * Verifies a UsersListResponse message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UsersListResponse message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UsersListResponse + */ + public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.UsersListResponse; + + /** + * Creates a plain object from a UsersListResponse message. Also converts values to other types if specified. + * @param message UsersListResponse + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.cloud.sql.v1beta4.UsersListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UsersListResponse to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UsersListResponse + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + } + } + + /** Namespace api. */ + namespace api { + + /** Properties of a Http. */ + interface IHttp { + + /** Http rules */ + rules?: (google.api.IHttpRule[]|null); + + /** Http fullyDecodeReservedExpansion */ + fullyDecodeReservedExpansion?: (boolean|null); + } + + /** Represents a Http. */ + class Http implements IHttp { + + /** + * Constructs a new Http. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttp); + + /** Http rules. */ + public rules: google.api.IHttpRule[]; + + /** Http fullyDecodeReservedExpansion. */ + public fullyDecodeReservedExpansion: boolean; + + /** + * Creates a new Http instance using the specified properties. + * @param [properties] Properties to set + * @returns Http instance + */ + public static create(properties?: google.api.IHttp): google.api.Http; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @param message Http message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Http message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Http; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Http; + + /** + * Verifies a Http message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Http + */ + public static fromObject(object: { [k: string]: any }): google.api.Http; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @param message Http + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Http to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Http + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a HttpRule. */ + interface IHttpRule { + + /** HttpRule selector */ + selector?: (string|null); + + /** HttpRule get */ + get?: (string|null); + + /** HttpRule put */ + put?: (string|null); + + /** HttpRule post */ + post?: (string|null); + + /** HttpRule delete */ + "delete"?: (string|null); + + /** HttpRule patch */ + patch?: (string|null); + + /** HttpRule custom */ + custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body */ + body?: (string|null); + + /** HttpRule responseBody */ + responseBody?: (string|null); + + /** HttpRule additionalBindings */ + additionalBindings?: (google.api.IHttpRule[]|null); + } + + /** Represents a HttpRule. */ + class HttpRule implements IHttpRule { + + /** + * Constructs a new HttpRule. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IHttpRule); + + /** HttpRule selector. */ + public selector: string; + + /** HttpRule get. */ + public get?: (string|null); + + /** HttpRule put. */ + public put?: (string|null); + + /** HttpRule post. */ + public post?: (string|null); + + /** HttpRule delete. */ + public delete?: (string|null); + + /** HttpRule patch. */ + public patch?: (string|null); + + /** HttpRule custom. */ + public custom?: (google.api.ICustomHttpPattern|null); + + /** HttpRule body. */ + public body: string; + + /** HttpRule responseBody. */ + public responseBody: string; + + /** HttpRule additionalBindings. */ + public additionalBindings: google.api.IHttpRule[]; + + /** HttpRule pattern. */ + public pattern?: ("get"|"put"|"post"|"delete"|"patch"|"custom"); + + /** + * Creates a new HttpRule instance using the specified properties. + * @param [properties] Properties to set + * @returns HttpRule instance + */ + public static create(properties?: google.api.IHttpRule): google.api.HttpRule; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @param message HttpRule message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.HttpRule; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.HttpRule; + + /** + * Verifies a HttpRule message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns HttpRule + */ + public static fromObject(object: { [k: string]: any }): google.api.HttpRule; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @param message HttpRule + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.HttpRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this HttpRule to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for HttpRule + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CustomHttpPattern. */ + interface ICustomHttpPattern { + + /** CustomHttpPattern kind */ + kind?: (string|null); + + /** CustomHttpPattern path */ + path?: (string|null); + } + + /** Represents a CustomHttpPattern. */ + class CustomHttpPattern implements ICustomHttpPattern { + + /** + * Constructs a new CustomHttpPattern. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICustomHttpPattern); + + /** CustomHttpPattern kind. */ + public kind: string; + + /** CustomHttpPattern path. */ + public path: string; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @param [properties] Properties to set + * @returns CustomHttpPattern instance + */ + public static create(properties?: google.api.ICustomHttpPattern): google.api.CustomHttpPattern; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @param message CustomHttpPattern message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CustomHttpPattern; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CustomHttpPattern; + + /** + * Verifies a CustomHttpPattern message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CustomHttpPattern + */ + public static fromObject(object: { [k: string]: any }): google.api.CustomHttpPattern; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @param message CustomHttpPattern + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CustomHttpPattern to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CustomHttpPattern + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CommonLanguageSettings. */ + interface ICommonLanguageSettings { + + /** CommonLanguageSettings referenceDocsUri */ + referenceDocsUri?: (string|null); + + /** CommonLanguageSettings destinations */ + destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + } + + /** Represents a CommonLanguageSettings. */ + class CommonLanguageSettings implements ICommonLanguageSettings { + + /** + * Constructs a new CommonLanguageSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICommonLanguageSettings); + + /** CommonLanguageSettings referenceDocsUri. */ + public referenceDocsUri: string; + + /** CommonLanguageSettings destinations. */ + public destinations: google.api.ClientLibraryDestination[]; + + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + + /** + * Creates a new CommonLanguageSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns CommonLanguageSettings instance + */ + public static create(properties?: google.api.ICommonLanguageSettings): google.api.CommonLanguageSettings; + + /** + * Encodes the specified CommonLanguageSettings message. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @param message CommonLanguageSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICommonLanguageSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CommonLanguageSettings message, length delimited. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @param message CommonLanguageSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICommonLanguageSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CommonLanguageSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CommonLanguageSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CommonLanguageSettings; + + /** + * Decodes a CommonLanguageSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CommonLanguageSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CommonLanguageSettings; + + /** + * Verifies a CommonLanguageSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CommonLanguageSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CommonLanguageSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.CommonLanguageSettings; + + /** + * Creates a plain object from a CommonLanguageSettings message. Also converts values to other types if specified. + * @param message CommonLanguageSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CommonLanguageSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CommonLanguageSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CommonLanguageSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ClientLibrarySettings. */ + interface IClientLibrarySettings { + + /** ClientLibrarySettings version */ + version?: (string|null); + + /** ClientLibrarySettings launchStage */ + launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); + + /** ClientLibrarySettings restNumericEnums */ + restNumericEnums?: (boolean|null); + + /** ClientLibrarySettings javaSettings */ + javaSettings?: (google.api.IJavaSettings|null); + + /** ClientLibrarySettings cppSettings */ + cppSettings?: (google.api.ICppSettings|null); + + /** ClientLibrarySettings phpSettings */ + phpSettings?: (google.api.IPhpSettings|null); + + /** ClientLibrarySettings pythonSettings */ + pythonSettings?: (google.api.IPythonSettings|null); + + /** ClientLibrarySettings nodeSettings */ + nodeSettings?: (google.api.INodeSettings|null); + + /** ClientLibrarySettings dotnetSettings */ + dotnetSettings?: (google.api.IDotnetSettings|null); + + /** ClientLibrarySettings rubySettings */ + rubySettings?: (google.api.IRubySettings|null); + + /** ClientLibrarySettings goSettings */ + goSettings?: (google.api.IGoSettings|null); + } + + /** Represents a ClientLibrarySettings. */ + class ClientLibrarySettings implements IClientLibrarySettings { + + /** + * Constructs a new ClientLibrarySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IClientLibrarySettings); + + /** ClientLibrarySettings version. */ + public version: string; + + /** ClientLibrarySettings launchStage. */ + public launchStage: (google.api.LaunchStage|keyof typeof google.api.LaunchStage); + + /** ClientLibrarySettings restNumericEnums. */ + public restNumericEnums: boolean; + + /** ClientLibrarySettings javaSettings. */ + public javaSettings?: (google.api.IJavaSettings|null); + + /** ClientLibrarySettings cppSettings. */ + public cppSettings?: (google.api.ICppSettings|null); + + /** ClientLibrarySettings phpSettings. */ + public phpSettings?: (google.api.IPhpSettings|null); + + /** ClientLibrarySettings pythonSettings. */ + public pythonSettings?: (google.api.IPythonSettings|null); + + /** ClientLibrarySettings nodeSettings. */ + public nodeSettings?: (google.api.INodeSettings|null); + + /** ClientLibrarySettings dotnetSettings. */ + public dotnetSettings?: (google.api.IDotnetSettings|null); + + /** ClientLibrarySettings rubySettings. */ + public rubySettings?: (google.api.IRubySettings|null); + + /** ClientLibrarySettings goSettings. */ + public goSettings?: (google.api.IGoSettings|null); + + /** + * Creates a new ClientLibrarySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns ClientLibrarySettings instance + */ + public static create(properties?: google.api.IClientLibrarySettings): google.api.ClientLibrarySettings; + + /** + * Encodes the specified ClientLibrarySettings message. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @param message ClientLibrarySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IClientLibrarySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ClientLibrarySettings message, length delimited. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @param message ClientLibrarySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IClientLibrarySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ClientLibrarySettings; + + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ClientLibrarySettings; + + /** + * Verifies a ClientLibrarySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ClientLibrarySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ClientLibrarySettings + */ + public static fromObject(object: { [k: string]: any }): google.api.ClientLibrarySettings; + + /** + * Creates a plain object from a ClientLibrarySettings message. Also converts values to other types if specified. + * @param message ClientLibrarySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ClientLibrarySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ClientLibrarySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ClientLibrarySettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Publishing. */ + interface IPublishing { + + /** Publishing methodSettings */ + methodSettings?: (google.api.IMethodSettings[]|null); + + /** Publishing newIssueUri */ + newIssueUri?: (string|null); + + /** Publishing documentationUri */ + documentationUri?: (string|null); + + /** Publishing apiShortName */ + apiShortName?: (string|null); + + /** Publishing githubLabel */ + githubLabel?: (string|null); + + /** Publishing codeownerGithubTeams */ + codeownerGithubTeams?: (string[]|null); + + /** Publishing docTagPrefix */ + docTagPrefix?: (string|null); + + /** Publishing organization */ + organization?: (google.api.ClientLibraryOrganization|keyof typeof google.api.ClientLibraryOrganization|null); + + /** Publishing librarySettings */ + librarySettings?: (google.api.IClientLibrarySettings[]|null); + + /** Publishing protoReferenceDocumentationUri */ + protoReferenceDocumentationUri?: (string|null); + + /** Publishing restReferenceDocumentationUri */ + restReferenceDocumentationUri?: (string|null); + } + + /** Represents a Publishing. */ + class Publishing implements IPublishing { + + /** + * Constructs a new Publishing. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IPublishing); + + /** Publishing methodSettings. */ + public methodSettings: google.api.IMethodSettings[]; + + /** Publishing newIssueUri. */ + public newIssueUri: string; + + /** Publishing documentationUri. */ + public documentationUri: string; + + /** Publishing apiShortName. */ + public apiShortName: string; + + /** Publishing githubLabel. */ + public githubLabel: string; + + /** Publishing codeownerGithubTeams. */ + public codeownerGithubTeams: string[]; + + /** Publishing docTagPrefix. */ + public docTagPrefix: string; + + /** Publishing organization. */ + public organization: (google.api.ClientLibraryOrganization|keyof typeof google.api.ClientLibraryOrganization); + + /** Publishing librarySettings. */ + public librarySettings: google.api.IClientLibrarySettings[]; + + /** Publishing protoReferenceDocumentationUri. */ + public protoReferenceDocumentationUri: string; + + /** Publishing restReferenceDocumentationUri. */ + public restReferenceDocumentationUri: string; + + /** + * Creates a new Publishing instance using the specified properties. + * @param [properties] Properties to set + * @returns Publishing instance + */ + public static create(properties?: google.api.IPublishing): google.api.Publishing; + + /** + * Encodes the specified Publishing message. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @param message Publishing message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IPublishing, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Publishing message, length delimited. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @param message Publishing message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IPublishing, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Publishing message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Publishing; + + /** + * Decodes a Publishing message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Publishing; + + /** + * Verifies a Publishing message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Publishing message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Publishing + */ + public static fromObject(object: { [k: string]: any }): google.api.Publishing; + + /** + * Creates a plain object from a Publishing message. Also converts values to other types if specified. + * @param message Publishing + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.Publishing, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Publishing to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Publishing + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a JavaSettings. */ + interface IJavaSettings { + + /** JavaSettings libraryPackage */ + libraryPackage?: (string|null); + + /** JavaSettings serviceClassNames */ + serviceClassNames?: ({ [k: string]: string }|null); + + /** JavaSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a JavaSettings. */ + class JavaSettings implements IJavaSettings { + + /** + * Constructs a new JavaSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IJavaSettings); + + /** JavaSettings libraryPackage. */ + public libraryPackage: string; + + /** JavaSettings serviceClassNames. */ + public serviceClassNames: { [k: string]: string }; + + /** JavaSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** + * Creates a new JavaSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns JavaSettings instance + */ + public static create(properties?: google.api.IJavaSettings): google.api.JavaSettings; + + /** + * Encodes the specified JavaSettings message. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @param message JavaSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IJavaSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified JavaSettings message, length delimited. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @param message JavaSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IJavaSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a JavaSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.JavaSettings; + + /** + * Decodes a JavaSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.JavaSettings; + + /** + * Verifies a JavaSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a JavaSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns JavaSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.JavaSettings; + + /** + * Creates a plain object from a JavaSettings message. Also converts values to other types if specified. + * @param message JavaSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.JavaSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this JavaSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for JavaSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a CppSettings. */ + interface ICppSettings { + + /** CppSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a CppSettings. */ + class CppSettings implements ICppSettings { + + /** + * Constructs a new CppSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ICppSettings); + + /** CppSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** + * Creates a new CppSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns CppSettings instance + */ + public static create(properties?: google.api.ICppSettings): google.api.CppSettings; + + /** + * Encodes the specified CppSettings message. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @param message CppSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ICppSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified CppSettings message, length delimited. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @param message CppSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ICppSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a CppSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CppSettings; + + /** + * Decodes a CppSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CppSettings; + + /** + * Verifies a CppSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a CppSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns CppSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.CppSettings; + + /** + * Creates a plain object from a CppSettings message. Also converts values to other types if specified. + * @param message CppSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.CppSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this CppSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for CppSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PhpSettings. */ + interface IPhpSettings { + + /** PhpSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a PhpSettings. */ + class PhpSettings implements IPhpSettings { + + /** + * Constructs a new PhpSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IPhpSettings); + + /** PhpSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** + * Creates a new PhpSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns PhpSettings instance + */ + public static create(properties?: google.api.IPhpSettings): google.api.PhpSettings; + + /** + * Encodes the specified PhpSettings message. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @param message PhpSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IPhpSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PhpSettings message, length delimited. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @param message PhpSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IPhpSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PhpSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PhpSettings; + + /** + * Decodes a PhpSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PhpSettings; + + /** + * Verifies a PhpSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PhpSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PhpSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.PhpSettings; + + /** + * Creates a plain object from a PhpSettings message. Also converts values to other types if specified. + * @param message PhpSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PhpSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PhpSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PhpSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a PythonSettings. */ + interface IPythonSettings { + + /** PythonSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + } + + /** Represents a PythonSettings. */ + class PythonSettings implements IPythonSettings { + + /** + * Constructs a new PythonSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IPythonSettings); + + /** PythonSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + + /** + * Creates a new PythonSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns PythonSettings instance + */ + public static create(properties?: google.api.IPythonSettings): google.api.PythonSettings; + + /** + * Encodes the specified PythonSettings message. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @param message PythonSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IPythonSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified PythonSettings message, length delimited. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @param message PythonSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IPythonSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a PythonSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PythonSettings; + + /** + * Decodes a PythonSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PythonSettings; + + /** + * Verifies a PythonSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a PythonSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns PythonSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings; + + /** + * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. + * @param message PythonSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this PythonSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for PythonSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a NodeSettings. */ + interface INodeSettings { + + /** NodeSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a NodeSettings. */ + class NodeSettings implements INodeSettings { + + /** + * Constructs a new NodeSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.INodeSettings); + + /** NodeSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** + * Creates a new NodeSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns NodeSettings instance + */ + public static create(properties?: google.api.INodeSettings): google.api.NodeSettings; + + /** + * Encodes the specified NodeSettings message. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @param message NodeSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.INodeSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NodeSettings message, length delimited. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @param message NodeSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.INodeSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NodeSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.NodeSettings; + + /** + * Decodes a NodeSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.NodeSettings; + + /** + * Verifies a NodeSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NodeSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NodeSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.NodeSettings; + + /** + * Creates a plain object from a NodeSettings message. Also converts values to other types if specified. + * @param message NodeSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.NodeSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NodeSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NodeSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DotnetSettings. */ + interface IDotnetSettings { + + /** DotnetSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + + /** DotnetSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); + + /** DotnetSettings renamedResources */ + renamedResources?: ({ [k: string]: string }|null); + + /** DotnetSettings ignoredResources */ + ignoredResources?: (string[]|null); + + /** DotnetSettings forcedNamespaceAliases */ + forcedNamespaceAliases?: (string[]|null); + + /** DotnetSettings handwrittenSignatures */ + handwrittenSignatures?: (string[]|null); + } + + /** Represents a DotnetSettings. */ + class DotnetSettings implements IDotnetSettings { + + /** + * Constructs a new DotnetSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IDotnetSettings); + + /** DotnetSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** DotnetSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + + /** DotnetSettings renamedResources. */ + public renamedResources: { [k: string]: string }; + + /** DotnetSettings ignoredResources. */ + public ignoredResources: string[]; + + /** DotnetSettings forcedNamespaceAliases. */ + public forcedNamespaceAliases: string[]; + + /** DotnetSettings handwrittenSignatures. */ + public handwrittenSignatures: string[]; + + /** + * Creates a new DotnetSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns DotnetSettings instance + */ + public static create(properties?: google.api.IDotnetSettings): google.api.DotnetSettings; + + /** + * Encodes the specified DotnetSettings message. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @param message DotnetSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IDotnetSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DotnetSettings message, length delimited. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @param message DotnetSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IDotnetSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.DotnetSettings; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.DotnetSettings; + + /** + * Verifies a DotnetSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DotnetSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DotnetSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.DotnetSettings; + + /** + * Creates a plain object from a DotnetSettings message. Also converts values to other types if specified. + * @param message DotnetSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.DotnetSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DotnetSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DotnetSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a RubySettings. */ + interface IRubySettings { + + /** RubySettings common */ + common?: (google.api.ICommonLanguageSettings|null); + } + + /** Represents a RubySettings. */ + class RubySettings implements IRubySettings { + + /** + * Constructs a new RubySettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IRubySettings); + + /** RubySettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** + * Creates a new RubySettings instance using the specified properties. + * @param [properties] Properties to set + * @returns RubySettings instance + */ + public static create(properties?: google.api.IRubySettings): google.api.RubySettings; + + /** + * Encodes the specified RubySettings message. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @param message RubySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IRubySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified RubySettings message, length delimited. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @param message RubySettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IRubySettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a RubySettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.RubySettings; + + /** + * Decodes a RubySettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.RubySettings; + + /** + * Verifies a RubySettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a RubySettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns RubySettings + */ + public static fromObject(object: { [k: string]: any }): google.api.RubySettings; + + /** + * Creates a plain object from a RubySettings message. Also converts values to other types if specified. + * @param message RubySettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.RubySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this RubySettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for RubySettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a GoSettings. */ + interface IGoSettings { + + /** GoSettings common */ + common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); + } + + /** Represents a GoSettings. */ + class GoSettings implements IGoSettings { + + /** + * Constructs a new GoSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IGoSettings); + + /** GoSettings common. */ + public common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + + /** + * Creates a new GoSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns GoSettings instance + */ + public static create(properties?: google.api.IGoSettings): google.api.GoSettings; + + /** + * Encodes the specified GoSettings message. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @param message GoSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IGoSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GoSettings message, length delimited. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @param message GoSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IGoSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GoSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.GoSettings; + + /** + * Decodes a GoSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.GoSettings; + + /** + * Verifies a GoSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GoSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GoSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.GoSettings; + + /** + * Creates a plain object from a GoSettings message. Also converts values to other types if specified. + * @param message GoSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.GoSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GoSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GoSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MethodSettings. */ + interface IMethodSettings { + + /** MethodSettings selector */ + selector?: (string|null); + + /** MethodSettings longRunning */ + longRunning?: (google.api.MethodSettings.ILongRunning|null); + + /** MethodSettings autoPopulatedFields */ + autoPopulatedFields?: (string[]|null); + } + + /** Represents a MethodSettings. */ + class MethodSettings implements IMethodSettings { + + /** + * Constructs a new MethodSettings. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IMethodSettings); + + /** MethodSettings selector. */ + public selector: string; + + /** MethodSettings longRunning. */ + public longRunning?: (google.api.MethodSettings.ILongRunning|null); + + /** MethodSettings autoPopulatedFields. */ + public autoPopulatedFields: string[]; + + /** + * Creates a new MethodSettings instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodSettings instance + */ + public static create(properties?: google.api.IMethodSettings): google.api.MethodSettings; + + /** + * Encodes the specified MethodSettings message. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @param message MethodSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IMethodSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodSettings message, length delimited. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @param message MethodSettings message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IMethodSettings, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodSettings message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.MethodSettings; + + /** + * Decodes a MethodSettings message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.MethodSettings; + + /** + * Verifies a MethodSettings message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodSettings message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodSettings + */ + public static fromObject(object: { [k: string]: any }): google.api.MethodSettings; + + /** + * Creates a plain object from a MethodSettings message. Also converts values to other types if specified. + * @param message MethodSettings + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.MethodSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodSettings to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodSettings + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace MethodSettings { + + /** Properties of a LongRunning. */ + interface ILongRunning { + + /** LongRunning initialPollDelay */ + initialPollDelay?: (google.protobuf.IDuration|null); + + /** LongRunning pollDelayMultiplier */ + pollDelayMultiplier?: (number|null); + + /** LongRunning maxPollDelay */ + maxPollDelay?: (google.protobuf.IDuration|null); + + /** LongRunning totalPollTimeout */ + totalPollTimeout?: (google.protobuf.IDuration|null); + } + + /** Represents a LongRunning. */ + class LongRunning implements ILongRunning { + + /** + * Constructs a new LongRunning. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.MethodSettings.ILongRunning); + + /** LongRunning initialPollDelay. */ + public initialPollDelay?: (google.protobuf.IDuration|null); + + /** LongRunning pollDelayMultiplier. */ + public pollDelayMultiplier: number; + + /** LongRunning maxPollDelay. */ + public maxPollDelay?: (google.protobuf.IDuration|null); + + /** LongRunning totalPollTimeout. */ + public totalPollTimeout?: (google.protobuf.IDuration|null); + + /** + * Creates a new LongRunning instance using the specified properties. + * @param [properties] Properties to set + * @returns LongRunning instance + */ + public static create(properties?: google.api.MethodSettings.ILongRunning): google.api.MethodSettings.LongRunning; + + /** + * Encodes the specified LongRunning message. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @param message LongRunning message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.MethodSettings.ILongRunning, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified LongRunning message, length delimited. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @param message LongRunning message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.MethodSettings.ILongRunning, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a LongRunning message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.MethodSettings.LongRunning; + + /** + * Decodes a LongRunning message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.MethodSettings.LongRunning; + + /** + * Verifies a LongRunning message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a LongRunning message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns LongRunning + */ + public static fromObject(object: { [k: string]: any }): google.api.MethodSettings.LongRunning; + + /** + * Creates a plain object from a LongRunning message. Also converts values to other types if specified. + * @param message LongRunning + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.MethodSettings.LongRunning, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this LongRunning to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for LongRunning + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** ClientLibraryOrganization enum. */ + enum ClientLibraryOrganization { + CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0, + CLOUD = 1, + ADS = 2, + PHOTOS = 3, + STREET_VIEW = 4, + SHOPPING = 5, + GEO = 6, + GENERATIVE_AI = 7 + } + + /** ClientLibraryDestination enum. */ + enum ClientLibraryDestination { + CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0, + GITHUB = 10, + PACKAGE_MANAGER = 20 + } + + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** LaunchStage enum. */ + enum LaunchStage { + LAUNCH_STAGE_UNSPECIFIED = 0, + UNIMPLEMENTED = 6, + PRELAUNCH = 7, + EARLY_ACCESS = 1, + ALPHA = 2, + BETA = 3, + GA = 4, + DEPRECATED = 5 + } + + /** FieldBehavior enum. */ + enum FieldBehavior { + FIELD_BEHAVIOR_UNSPECIFIED = 0, + OPTIONAL = 1, + REQUIRED = 2, + OUTPUT_ONLY = 3, + INPUT_ONLY = 4, + IMMUTABLE = 5, + UNORDERED_LIST = 6, + NON_EMPTY_DEFAULT = 7, + IDENTIFIER = 8 + } + + /** Properties of a ResourceDescriptor. */ + interface IResourceDescriptor { + + /** ResourceDescriptor type */ + type?: (string|null); + + /** ResourceDescriptor pattern */ + pattern?: (string[]|null); + + /** ResourceDescriptor nameField */ + nameField?: (string|null); + + /** ResourceDescriptor history */ + history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); + + /** ResourceDescriptor plural */ + plural?: (string|null); + + /** ResourceDescriptor singular */ + singular?: (string|null); + + /** ResourceDescriptor style */ + style?: (google.api.ResourceDescriptor.Style[]|null); + } + + /** Represents a ResourceDescriptor. */ + class ResourceDescriptor implements IResourceDescriptor { + + /** + * Constructs a new ResourceDescriptor. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceDescriptor); + + /** ResourceDescriptor type. */ + public type: string; + + /** ResourceDescriptor pattern. */ + public pattern: string[]; + + /** ResourceDescriptor nameField. */ + public nameField: string; + + /** ResourceDescriptor history. */ + public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); + + /** ResourceDescriptor plural. */ + public plural: string; + + /** ResourceDescriptor singular. */ + public singular: string; + + /** ResourceDescriptor style. */ + public style: google.api.ResourceDescriptor.Style[]; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceDescriptor instance + */ + public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @param message ResourceDescriptor message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; + + /** + * Verifies a ResourceDescriptor message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceDescriptor + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @param message ResourceDescriptor + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceDescriptor to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceDescriptor + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ResourceDescriptor { + + /** History enum. */ + enum History { + HISTORY_UNSPECIFIED = 0, + ORIGINALLY_SINGLE_PATTERN = 1, + FUTURE_MULTI_PATTERN = 2 + } + + /** Style enum. */ + enum Style { + STYLE_UNSPECIFIED = 0, + DECLARATIVE_FRIENDLY = 1 + } + } + + /** Properties of a ResourceReference. */ + interface IResourceReference { + + /** ResourceReference type */ + type?: (string|null); + + /** ResourceReference childType */ + childType?: (string|null); + } + + /** Represents a ResourceReference. */ + class ResourceReference implements IResourceReference { + + /** + * Constructs a new ResourceReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IResourceReference); + + /** ResourceReference type. */ + public type: string; + + /** ResourceReference childType. */ + public childType: string; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @param [properties] Properties to set + * @returns ResourceReference instance + */ + public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @param message ResourceReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; + + /** + * Verifies a ResourceReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ResourceReference + */ + public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @param message ResourceReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ResourceReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ResourceReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldInfo. */ + interface IFieldInfo { + + /** FieldInfo format */ + format?: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format|null); + + /** FieldInfo referencedTypes */ + referencedTypes?: (google.api.ITypeReference[]|null); + } + + /** Represents a FieldInfo. */ + class FieldInfo implements IFieldInfo { + + /** + * Constructs a new FieldInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.IFieldInfo); + + /** FieldInfo format. */ + public format: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format); + + /** FieldInfo referencedTypes. */ + public referencedTypes: google.api.ITypeReference[]; + + /** + * Creates a new FieldInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldInfo instance + */ + public static create(properties?: google.api.IFieldInfo): google.api.FieldInfo; + + /** + * Encodes the specified FieldInfo message. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. + * @param message FieldInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.IFieldInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldInfo message, length delimited. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. + * @param message FieldInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.IFieldInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.FieldInfo; + + /** + * Decodes a FieldInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.FieldInfo; + + /** + * Verifies a FieldInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldInfo + */ + public static fromObject(object: { [k: string]: any }): google.api.FieldInfo; + + /** + * Creates a plain object from a FieldInfo message. Also converts values to other types if specified. + * @param message FieldInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.FieldInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldInfo { + + /** Format enum. */ + enum Format { + FORMAT_UNSPECIFIED = 0, + UUID4 = 1, + IPV4 = 2, + IPV6 = 3, + IPV4_OR_IPV6 = 4 + } + } + + /** Properties of a TypeReference. */ + interface ITypeReference { + + /** TypeReference typeName */ + typeName?: (string|null); + } + + /** Represents a TypeReference. */ + class TypeReference implements ITypeReference { + + /** + * Constructs a new TypeReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ITypeReference); + + /** TypeReference typeName. */ + public typeName: string; + + /** + * Creates a new TypeReference instance using the specified properties. + * @param [properties] Properties to set + * @returns TypeReference instance + */ + public static create(properties?: google.api.ITypeReference): google.api.TypeReference; + + /** + * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @param message TypeReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @param message TypeReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TypeReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.TypeReference; + + /** + * Decodes a TypeReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.TypeReference; + + /** + * Verifies a TypeReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TypeReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TypeReference + */ + public static fromObject(object: { [k: string]: any }): google.api.TypeReference; + + /** + * Creates a plain object from a TypeReference message. Also converts values to other types if specified. + * @param message TypeReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.TypeReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TypeReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TypeReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace protobuf. */ + namespace protobuf { + + /** Properties of a FileDescriptorSet. */ + interface IFileDescriptorSet { + + /** FileDescriptorSet file */ + file?: (google.protobuf.IFileDescriptorProto[]|null); + } + + /** Represents a FileDescriptorSet. */ + class FileDescriptorSet implements IFileDescriptorSet { + + /** + * Constructs a new FileDescriptorSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorSet); + + /** FileDescriptorSet file. */ + public file: google.protobuf.IFileDescriptorProto[]; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorSet instance + */ + public static create(properties?: google.protobuf.IFileDescriptorSet): google.protobuf.FileDescriptorSet; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @param message FileDescriptorSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; + + /** + * Verifies a FileDescriptorSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorSet + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorSet; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @param message FileDescriptorSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Edition enum. */ + enum Edition { + EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + EDITION_2023 = 1000, + EDITION_2024 = 1001, + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + EDITION_MAX = 2147483647 + } + + /** Properties of a FileDescriptorProto. */ + interface IFileDescriptorProto { + + /** FileDescriptorProto name */ + name?: (string|null); + + /** FileDescriptorProto package */ + "package"?: (string|null); + + /** FileDescriptorProto dependency */ + dependency?: (string[]|null); + + /** FileDescriptorProto publicDependency */ + publicDependency?: (number[]|null); + + /** FileDescriptorProto weakDependency */ + weakDependency?: (number[]|null); + + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + + /** FileDescriptorProto messageType */ + messageType?: (google.protobuf.IDescriptorProto[]|null); + + /** FileDescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** FileDescriptorProto service */ + service?: (google.protobuf.IServiceDescriptorProto[]|null); + + /** FileDescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** FileDescriptorProto options */ + options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo */ + sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax */ + syntax?: (string|null); + + /** FileDescriptorProto edition */ + edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FileDescriptorProto. */ + class FileDescriptorProto implements IFileDescriptorProto { + + /** + * Constructs a new FileDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileDescriptorProto); + + /** FileDescriptorProto name. */ + public name: string; + + /** FileDescriptorProto package. */ + public package: string; + + /** FileDescriptorProto dependency. */ + public dependency: string[]; + + /** FileDescriptorProto publicDependency. */ + public publicDependency: number[]; + + /** FileDescriptorProto weakDependency. */ + public weakDependency: number[]; + + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + + /** FileDescriptorProto messageType. */ + public messageType: google.protobuf.IDescriptorProto[]; + + /** FileDescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** FileDescriptorProto service. */ + public service: google.protobuf.IServiceDescriptorProto[]; + + /** FileDescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** FileDescriptorProto options. */ + public options?: (google.protobuf.IFileOptions|null); + + /** FileDescriptorProto sourceCodeInfo. */ + public sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); + + /** FileDescriptorProto syntax. */ + public syntax: string; + + /** FileDescriptorProto edition. */ + public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FileDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFileDescriptorProto): google.protobuf.FileDescriptorProto; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @param message FileDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; + + /** + * Verifies a FileDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorProto; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @param message FileDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DescriptorProto. */ + interface IDescriptorProto { + + /** DescriptorProto name */ + name?: (string|null); + + /** DescriptorProto field */ + field?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto extension */ + extension?: (google.protobuf.IFieldDescriptorProto[]|null); + + /** DescriptorProto nestedType */ + nestedType?: (google.protobuf.IDescriptorProto[]|null); + + /** DescriptorProto enumType */ + enumType?: (google.protobuf.IEnumDescriptorProto[]|null); + + /** DescriptorProto extensionRange */ + extensionRange?: (google.protobuf.DescriptorProto.IExtensionRange[]|null); + + /** DescriptorProto oneofDecl */ + oneofDecl?: (google.protobuf.IOneofDescriptorProto[]|null); + + /** DescriptorProto options */ + options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange */ + reservedRange?: (google.protobuf.DescriptorProto.IReservedRange[]|null); + + /** DescriptorProto reservedName */ + reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); + } + + /** Represents a DescriptorProto. */ + class DescriptorProto implements IDescriptorProto { + + /** + * Constructs a new DescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDescriptorProto); + + /** DescriptorProto name. */ + public name: string; + + /** DescriptorProto field. */ + public field: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto extension. */ + public extension: google.protobuf.IFieldDescriptorProto[]; + + /** DescriptorProto nestedType. */ + public nestedType: google.protobuf.IDescriptorProto[]; + + /** DescriptorProto enumType. */ + public enumType: google.protobuf.IEnumDescriptorProto[]; + + /** DescriptorProto extensionRange. */ + public extensionRange: google.protobuf.DescriptorProto.IExtensionRange[]; + + /** DescriptorProto oneofDecl. */ + public oneofDecl: google.protobuf.IOneofDescriptorProto[]; + + /** DescriptorProto options. */ + public options?: (google.protobuf.IMessageOptions|null); + + /** DescriptorProto reservedRange. */ + public reservedRange: google.protobuf.DescriptorProto.IReservedRange[]; + + /** DescriptorProto reservedName. */ + public reservedName: string[]; + + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns DescriptorProto instance + */ + public static create(properties?: google.protobuf.IDescriptorProto): google.protobuf.DescriptorProto; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @param message DescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; + + /** + * Verifies a DescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @param message DescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace DescriptorProto { + + /** Properties of an ExtensionRange. */ + interface IExtensionRange { + + /** ExtensionRange start */ + start?: (number|null); + + /** ExtensionRange end */ + end?: (number|null); + + /** ExtensionRange options */ + options?: (google.protobuf.IExtensionRangeOptions|null); + } + + /** Represents an ExtensionRange. */ + class ExtensionRange implements IExtensionRange { + + /** + * Constructs a new ExtensionRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IExtensionRange); + + /** ExtensionRange start. */ + public start: number; + + /** ExtensionRange end. */ + public end: number; + + /** ExtensionRange options. */ + public options?: (google.protobuf.IExtensionRangeOptions|null); + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IExtensionRange): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @param message ExtensionRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Verifies an ExtensionRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ExtensionRange; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @param message ExtensionRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ExtensionRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ReservedRange. */ + interface IReservedRange { + + /** ReservedRange start */ + start?: (number|null); + + /** ReservedRange end */ + end?: (number|null); + } + + /** Represents a ReservedRange. */ + class ReservedRange implements IReservedRange { + + /** + * Constructs a new ReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.DescriptorProto.IReservedRange); + + /** ReservedRange start. */ + public start: number; + + /** ReservedRange end. */ + public end: number; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns ReservedRange instance + */ + public static create(properties?: google.protobuf.DescriptorProto.IReservedRange): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @param message ReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Verifies a ReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ReservedRange; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @param message ReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DescriptorProto.ReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an ExtensionRangeOptions. */ + interface IExtensionRangeOptions { + + /** ExtensionRangeOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** ExtensionRangeOptions declaration */ + declaration?: (google.protobuf.ExtensionRangeOptions.IDeclaration[]|null); + + /** ExtensionRangeOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** ExtensionRangeOptions verification */ + verification?: (google.protobuf.ExtensionRangeOptions.VerificationState|keyof typeof google.protobuf.ExtensionRangeOptions.VerificationState|null); + } + + /** Represents an ExtensionRangeOptions. */ + class ExtensionRangeOptions implements IExtensionRangeOptions { + + /** + * Constructs a new ExtensionRangeOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IExtensionRangeOptions); + + /** ExtensionRangeOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** ExtensionRangeOptions declaration. */ + public declaration: google.protobuf.ExtensionRangeOptions.IDeclaration[]; + + /** ExtensionRangeOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** ExtensionRangeOptions verification. */ + public verification: (google.protobuf.ExtensionRangeOptions.VerificationState|keyof typeof google.protobuf.ExtensionRangeOptions.VerificationState); + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ExtensionRangeOptions instance + */ + public static create(properties?: google.protobuf.IExtensionRangeOptions): google.protobuf.ExtensionRangeOptions; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @param message ExtensionRangeOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions; + + /** + * Verifies an ExtensionRangeOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExtensionRangeOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @param message ExtensionRangeOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ExtensionRangeOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace ExtensionRangeOptions { + + /** Properties of a Declaration. */ + interface IDeclaration { + + /** Declaration number */ + number?: (number|null); + + /** Declaration fullName */ + fullName?: (string|null); + + /** Declaration type */ + type?: (string|null); + + /** Declaration reserved */ + reserved?: (boolean|null); + + /** Declaration repeated */ + repeated?: (boolean|null); + } + + /** Represents a Declaration. */ + class Declaration implements IDeclaration { + + /** + * Constructs a new Declaration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ExtensionRangeOptions.IDeclaration); + + /** Declaration number. */ + public number: number; + + /** Declaration fullName. */ + public fullName: string; + + /** Declaration type. */ + public type: string; + + /** Declaration reserved. */ + public reserved: boolean; + + /** Declaration repeated. */ + public repeated: boolean; + + /** + * Creates a new Declaration instance using the specified properties. + * @param [properties] Properties to set + * @returns Declaration instance + */ + public static create(properties?: google.protobuf.ExtensionRangeOptions.IDeclaration): google.protobuf.ExtensionRangeOptions.Declaration; + + /** + * Encodes the specified Declaration message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @param message Declaration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ExtensionRangeOptions.IDeclaration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Declaration message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @param message Declaration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ExtensionRangeOptions.IDeclaration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Declaration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions.Declaration; + + /** + * Decodes a Declaration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions.Declaration; + + /** + * Verifies a Declaration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Declaration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Declaration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions.Declaration; + + /** + * Creates a plain object from a Declaration message. Also converts values to other types if specified. + * @param message Declaration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ExtensionRangeOptions.Declaration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Declaration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Declaration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** VerificationState enum. */ + enum VerificationState { + DECLARATION = 0, + UNVERIFIED = 1 + } + } + + /** Properties of a FieldDescriptorProto. */ + interface IFieldDescriptorProto { + + /** FieldDescriptorProto name */ + name?: (string|null); + + /** FieldDescriptorProto number */ + number?: (number|null); + + /** FieldDescriptorProto label */ + label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); + + /** FieldDescriptorProto type */ + type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); + + /** FieldDescriptorProto typeName */ + typeName?: (string|null); + + /** FieldDescriptorProto extendee */ + extendee?: (string|null); + + /** FieldDescriptorProto defaultValue */ + defaultValue?: (string|null); + + /** FieldDescriptorProto oneofIndex */ + oneofIndex?: (number|null); + + /** FieldDescriptorProto jsonName */ + jsonName?: (string|null); + + /** FieldDescriptorProto options */ + options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional */ + proto3Optional?: (boolean|null); + } + + /** Represents a FieldDescriptorProto. */ + class FieldDescriptorProto implements IFieldDescriptorProto { + + /** + * Constructs a new FieldDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldDescriptorProto); + + /** FieldDescriptorProto name. */ + public name: string; + + /** FieldDescriptorProto number. */ + public number: number; + + /** FieldDescriptorProto label. */ + public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); + + /** FieldDescriptorProto type. */ + public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); + + /** FieldDescriptorProto typeName. */ + public typeName: string; + + /** FieldDescriptorProto extendee. */ + public extendee: string; + + /** FieldDescriptorProto defaultValue. */ + public defaultValue: string; + + /** FieldDescriptorProto oneofIndex. */ + public oneofIndex: number; + + /** FieldDescriptorProto jsonName. */ + public jsonName: string; + + /** FieldDescriptorProto options. */ + public options?: (google.protobuf.IFieldOptions|null); + + /** FieldDescriptorProto proto3Optional. */ + public proto3Optional: boolean; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldDescriptorProto instance + */ + public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @param message FieldDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; + + /** + * Verifies a FieldDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @param message FieldDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldDescriptorProto { + + /** Type enum. */ + enum Type { + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + TYPE_SINT32 = 17, + TYPE_SINT64 = 18 + } + + /** Label enum. */ + enum Label { + LABEL_OPTIONAL = 1, + LABEL_REPEATED = 3, + LABEL_REQUIRED = 2 + } + } + + /** Properties of an OneofDescriptorProto. */ + interface IOneofDescriptorProto { + + /** OneofDescriptorProto name */ + name?: (string|null); + + /** OneofDescriptorProto options */ + options?: (google.protobuf.IOneofOptions|null); + } + + /** Represents an OneofDescriptorProto. */ + class OneofDescriptorProto implements IOneofDescriptorProto { + + /** + * Constructs a new OneofDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofDescriptorProto); + + /** OneofDescriptorProto name. */ + public name: string; + + /** OneofDescriptorProto options. */ + public options?: (google.protobuf.IOneofOptions|null); + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofDescriptorProto instance + */ + public static create(properties?: google.protobuf.IOneofDescriptorProto): google.protobuf.OneofDescriptorProto; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @param message OneofDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; + + /** + * Verifies an OneofDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofDescriptorProto; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @param message OneofDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumDescriptorProto. */ + interface IEnumDescriptorProto { + + /** EnumDescriptorProto name */ + name?: (string|null); + + /** EnumDescriptorProto value */ + value?: (google.protobuf.IEnumValueDescriptorProto[]|null); + + /** EnumDescriptorProto options */ + options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange */ + reservedRange?: (google.protobuf.EnumDescriptorProto.IEnumReservedRange[]|null); + + /** EnumDescriptorProto reservedName */ + reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); + } + + /** Represents an EnumDescriptorProto. */ + class EnumDescriptorProto implements IEnumDescriptorProto { + + /** + * Constructs a new EnumDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumDescriptorProto); + + /** EnumDescriptorProto name. */ + public name: string; + + /** EnumDescriptorProto value. */ + public value: google.protobuf.IEnumValueDescriptorProto[]; + + /** EnumDescriptorProto options. */ + public options?: (google.protobuf.IEnumOptions|null); + + /** EnumDescriptorProto reservedRange. */ + public reservedRange: google.protobuf.EnumDescriptorProto.IEnumReservedRange[]; + + /** EnumDescriptorProto reservedName. */ + public reservedName: string[]; + + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumDescriptorProto): google.protobuf.EnumDescriptorProto; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @param message EnumDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; + + /** + * Verifies an EnumDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @param message EnumDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace EnumDescriptorProto { + + /** Properties of an EnumReservedRange. */ + interface IEnumReservedRange { + + /** EnumReservedRange start */ + start?: (number|null); + + /** EnumReservedRange end */ + end?: (number|null); + } + + /** Represents an EnumReservedRange. */ + class EnumReservedRange implements IEnumReservedRange { + + /** + * Constructs a new EnumReservedRange. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange); + + /** EnumReservedRange start. */ + public start: number; + + /** EnumReservedRange end. */ + public end: number; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumReservedRange instance + */ + public static create(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @param message EnumReservedRange message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Verifies an EnumReservedRange message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumReservedRange + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto.EnumReservedRange; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @param message EnumReservedRange + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumDescriptorProto.EnumReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumReservedRange to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumReservedRange + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an EnumValueDescriptorProto. */ + interface IEnumValueDescriptorProto { + + /** EnumValueDescriptorProto name */ + name?: (string|null); + + /** EnumValueDescriptorProto number */ + number?: (number|null); + + /** EnumValueDescriptorProto options */ + options?: (google.protobuf.IEnumValueOptions|null); + } + + /** Represents an EnumValueDescriptorProto. */ + class EnumValueDescriptorProto implements IEnumValueDescriptorProto { + + /** + * Constructs a new EnumValueDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueDescriptorProto); + + /** EnumValueDescriptorProto name. */ + public name: string; + + /** EnumValueDescriptorProto number. */ + public number: number; + + /** EnumValueDescriptorProto options. */ + public options?: (google.protobuf.IEnumValueOptions|null); + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueDescriptorProto instance + */ + public static create(properties?: google.protobuf.IEnumValueDescriptorProto): google.protobuf.EnumValueDescriptorProto; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @param message EnumValueDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; + + /** + * Verifies an EnumValueDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueDescriptorProto; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @param message EnumValueDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ServiceDescriptorProto. */ + interface IServiceDescriptorProto { + + /** ServiceDescriptorProto name */ + name?: (string|null); + + /** ServiceDescriptorProto method */ + method?: (google.protobuf.IMethodDescriptorProto[]|null); + + /** ServiceDescriptorProto options */ + options?: (google.protobuf.IServiceOptions|null); + } + + /** Represents a ServiceDescriptorProto. */ + class ServiceDescriptorProto implements IServiceDescriptorProto { + + /** + * Constructs a new ServiceDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceDescriptorProto); + + /** ServiceDescriptorProto name. */ + public name: string; + + /** ServiceDescriptorProto method. */ + public method: google.protobuf.IMethodDescriptorProto[]; + + /** ServiceDescriptorProto options. */ + public options?: (google.protobuf.IServiceOptions|null); + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceDescriptorProto instance + */ + public static create(properties?: google.protobuf.IServiceDescriptorProto): google.protobuf.ServiceDescriptorProto; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @param message ServiceDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; + + /** + * Verifies a ServiceDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceDescriptorProto; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @param message ServiceDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MethodDescriptorProto. */ + interface IMethodDescriptorProto { + + /** MethodDescriptorProto name */ + name?: (string|null); + + /** MethodDescriptorProto inputType */ + inputType?: (string|null); + + /** MethodDescriptorProto outputType */ + outputType?: (string|null); + + /** MethodDescriptorProto options */ + options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming */ + clientStreaming?: (boolean|null); + + /** MethodDescriptorProto serverStreaming */ + serverStreaming?: (boolean|null); + } + + /** Represents a MethodDescriptorProto. */ + class MethodDescriptorProto implements IMethodDescriptorProto { + + /** + * Constructs a new MethodDescriptorProto. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodDescriptorProto); + + /** MethodDescriptorProto name. */ + public name: string; + + /** MethodDescriptorProto inputType. */ + public inputType: string; + + /** MethodDescriptorProto outputType. */ + public outputType: string; + + /** MethodDescriptorProto options. */ + public options?: (google.protobuf.IMethodOptions|null); + + /** MethodDescriptorProto clientStreaming. */ + public clientStreaming: boolean; + + /** MethodDescriptorProto serverStreaming. */ + public serverStreaming: boolean; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodDescriptorProto instance + */ + public static create(properties?: google.protobuf.IMethodDescriptorProto): google.protobuf.MethodDescriptorProto; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @param message MethodDescriptorProto message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; + + /** + * Verifies a MethodDescriptorProto message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodDescriptorProto + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodDescriptorProto; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @param message MethodDescriptorProto + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodDescriptorProto + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FileOptions. */ + interface IFileOptions { + + /** FileOptions javaPackage */ + javaPackage?: (string|null); + + /** FileOptions javaOuterClassname */ + javaOuterClassname?: (string|null); + + /** FileOptions javaMultipleFiles */ + javaMultipleFiles?: (boolean|null); + + /** FileOptions javaGenerateEqualsAndHash */ + javaGenerateEqualsAndHash?: (boolean|null); + + /** FileOptions javaStringCheckUtf8 */ + javaStringCheckUtf8?: (boolean|null); + + /** FileOptions optimizeFor */ + optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); + + /** FileOptions goPackage */ + goPackage?: (string|null); + + /** FileOptions ccGenericServices */ + ccGenericServices?: (boolean|null); + + /** FileOptions javaGenericServices */ + javaGenericServices?: (boolean|null); + + /** FileOptions pyGenericServices */ + pyGenericServices?: (boolean|null); + + /** FileOptions deprecated */ + deprecated?: (boolean|null); + + /** FileOptions ccEnableArenas */ + ccEnableArenas?: (boolean|null); + + /** FileOptions objcClassPrefix */ + objcClassPrefix?: (string|null); + + /** FileOptions csharpNamespace */ + csharpNamespace?: (string|null); + + /** FileOptions swiftPrefix */ + swiftPrefix?: (string|null); + + /** FileOptions phpClassPrefix */ + phpClassPrefix?: (string|null); + + /** FileOptions phpNamespace */ + phpNamespace?: (string|null); + + /** FileOptions phpMetadataNamespace */ + phpMetadataNamespace?: (string|null); + + /** FileOptions rubyPackage */ + rubyPackage?: (string|null); + + /** FileOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** FileOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FileOptions .google.api.resourceDefinition */ + ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); + } + + /** Represents a FileOptions. */ + class FileOptions implements IFileOptions { + + /** + * Constructs a new FileOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFileOptions); + + /** FileOptions javaPackage. */ + public javaPackage: string; + + /** FileOptions javaOuterClassname. */ + public javaOuterClassname: string; + + /** FileOptions javaMultipleFiles. */ + public javaMultipleFiles: boolean; + + /** FileOptions javaGenerateEqualsAndHash. */ + public javaGenerateEqualsAndHash: boolean; + + /** FileOptions javaStringCheckUtf8. */ + public javaStringCheckUtf8: boolean; + + /** FileOptions optimizeFor. */ + public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); + + /** FileOptions goPackage. */ + public goPackage: string; + + /** FileOptions ccGenericServices. */ + public ccGenericServices: boolean; + + /** FileOptions javaGenericServices. */ + public javaGenericServices: boolean; + + /** FileOptions pyGenericServices. */ + public pyGenericServices: boolean; + + /** FileOptions deprecated. */ + public deprecated: boolean; + + /** FileOptions ccEnableArenas. */ + public ccEnableArenas: boolean; + + /** FileOptions objcClassPrefix. */ + public objcClassPrefix: string; + + /** FileOptions csharpNamespace. */ + public csharpNamespace: string; + + /** FileOptions swiftPrefix. */ + public swiftPrefix: string; + + /** FileOptions phpClassPrefix. */ + public phpClassPrefix: string; + + /** FileOptions phpNamespace. */ + public phpNamespace: string; + + /** FileOptions phpMetadataNamespace. */ + public phpMetadataNamespace: string; + + /** FileOptions rubyPackage. */ + public rubyPackage: string; + + /** FileOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** FileOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FileOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FileOptions instance + */ + public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @param message FileOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; + + /** + * Verifies a FileOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FileOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @param message FileOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FileOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FileOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FileOptions { + + /** OptimizeMode enum. */ + enum OptimizeMode { + SPEED = 1, + CODE_SIZE = 2, + LITE_RUNTIME = 3 + } + } + + /** Properties of a MessageOptions. */ + interface IMessageOptions { + + /** MessageOptions messageSetWireFormat */ + messageSetWireFormat?: (boolean|null); + + /** MessageOptions noStandardDescriptorAccessor */ + noStandardDescriptorAccessor?: (boolean|null); + + /** MessageOptions deprecated */ + deprecated?: (boolean|null); + + /** MessageOptions mapEntry */ + mapEntry?: (boolean|null); + + /** MessageOptions deprecatedLegacyJsonFieldConflicts */ + deprecatedLegacyJsonFieldConflicts?: (boolean|null); + + /** MessageOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** MessageOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MessageOptions .google.api.resource */ + ".google.api.resource"?: (google.api.IResourceDescriptor|null); + } + + /** Represents a MessageOptions. */ + class MessageOptions implements IMessageOptions { + + /** + * Constructs a new MessageOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMessageOptions); + + /** MessageOptions messageSetWireFormat. */ + public messageSetWireFormat: boolean; + + /** MessageOptions noStandardDescriptorAccessor. */ + public noStandardDescriptorAccessor: boolean; + + /** MessageOptions deprecated. */ + public deprecated: boolean; + + /** MessageOptions mapEntry. */ + public mapEntry: boolean; + + /** MessageOptions deprecatedLegacyJsonFieldConflicts. */ + public deprecatedLegacyJsonFieldConflicts: boolean; + + /** MessageOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** MessageOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MessageOptions instance + */ + public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @param message MessageOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; + + /** + * Verifies a MessageOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MessageOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @param message MessageOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MessageOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MessageOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldOptions. */ + interface IFieldOptions { + + /** FieldOptions ctype */ + ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); + + /** FieldOptions packed */ + packed?: (boolean|null); + + /** FieldOptions jstype */ + jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); + + /** FieldOptions lazy */ + lazy?: (boolean|null); + + /** FieldOptions unverifiedLazy */ + unverifiedLazy?: (boolean|null); + + /** FieldOptions deprecated */ + deprecated?: (boolean|null); + + /** FieldOptions weak */ + weak?: (boolean|null); + + /** FieldOptions debugRedact */ + debugRedact?: (boolean|null); + + /** FieldOptions retention */ + retention?: (google.protobuf.FieldOptions.OptionRetention|keyof typeof google.protobuf.FieldOptions.OptionRetention|null); + + /** FieldOptions targets */ + targets?: (google.protobuf.FieldOptions.OptionTargetType[]|null); + + /** FieldOptions editionDefaults */ + editionDefaults?: (google.protobuf.FieldOptions.IEditionDefault[]|null); + + /** FieldOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + + /** FieldOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** FieldOptions .google.api.fieldBehavior */ + ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); + + /** FieldOptions .google.api.resourceReference */ + ".google.api.resourceReference"?: (google.api.IResourceReference|null); + + /** FieldOptions .google.api.fieldInfo */ + ".google.api.fieldInfo"?: (google.api.IFieldInfo|null); + } + + /** Represents a FieldOptions. */ + class FieldOptions implements IFieldOptions { + + /** + * Constructs a new FieldOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldOptions); + + /** FieldOptions ctype. */ + public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); + + /** FieldOptions packed. */ + public packed: boolean; + + /** FieldOptions jstype. */ + public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); + + /** FieldOptions lazy. */ + public lazy: boolean; + + /** FieldOptions unverifiedLazy. */ + public unverifiedLazy: boolean; + + /** FieldOptions deprecated. */ + public deprecated: boolean; + + /** FieldOptions weak. */ + public weak: boolean; + + /** FieldOptions debugRedact. */ + public debugRedact: boolean; + + /** FieldOptions retention. */ + public retention: (google.protobuf.FieldOptions.OptionRetention|keyof typeof google.protobuf.FieldOptions.OptionRetention); + + /** FieldOptions targets. */ + public targets: google.protobuf.FieldOptions.OptionTargetType[]; + + /** FieldOptions editionDefaults. */ + public editionDefaults: google.protobuf.FieldOptions.IEditionDefault[]; + + /** FieldOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + + /** FieldOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldOptions instance + */ + public static create(properties?: google.protobuf.IFieldOptions): google.protobuf.FieldOptions; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @param message FieldOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; + + /** + * Verifies a FieldOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @param message FieldOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FieldOptions { + + /** CType enum. */ + enum CType { + STRING = 0, + CORD = 1, + STRING_PIECE = 2 + } + + /** JSType enum. */ + enum JSType { + JS_NORMAL = 0, + JS_STRING = 1, + JS_NUMBER = 2 + } + + /** OptionRetention enum. */ + enum OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2 + } + + /** OptionTargetType enum. */ + enum OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9 + } + + /** Properties of an EditionDefault. */ + interface IEditionDefault { + + /** EditionDefault edition */ + edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** EditionDefault value */ + value?: (string|null); + } + + /** Represents an EditionDefault. */ + class EditionDefault implements IEditionDefault { + + /** + * Constructs a new EditionDefault. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IEditionDefault); + + /** EditionDefault edition. */ + public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** EditionDefault value. */ + public value: string; + + /** + * Creates a new EditionDefault instance using the specified properties. + * @param [properties] Properties to set + * @returns EditionDefault instance + */ + public static create(properties?: google.protobuf.FieldOptions.IEditionDefault): google.protobuf.FieldOptions.EditionDefault; + + /** + * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @param message EditionDefault message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @param message EditionDefault message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EditionDefault message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions.EditionDefault; + + /** + * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions.EditionDefault; + + /** + * Verifies an EditionDefault message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EditionDefault + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.EditionDefault; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @param message EditionDefault + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.EditionDefault, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EditionDefault to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EditionDefault + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of an OneofOptions. */ + interface IOneofOptions { + + /** OneofOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** OneofOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an OneofOptions. */ + class OneofOptions implements IOneofOptions { + + /** + * Constructs a new OneofOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IOneofOptions); + + /** OneofOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** OneofOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns OneofOptions instance + */ + public static create(properties?: google.protobuf.IOneofOptions): google.protobuf.OneofOptions; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @param message OneofOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; + + /** + * Verifies an OneofOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns OneofOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.OneofOptions; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @param message OneofOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.OneofOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this OneofOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for OneofOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumOptions. */ + interface IEnumOptions { + + /** EnumOptions allowAlias */ + allowAlias?: (boolean|null); + + /** EnumOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumOptions deprecatedLegacyJsonFieldConflicts */ + deprecatedLegacyJsonFieldConflicts?: (boolean|null); + + /** EnumOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** EnumOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumOptions. */ + class EnumOptions implements IEnumOptions { + + /** + * Constructs a new EnumOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumOptions); + + /** EnumOptions allowAlias. */ + public allowAlias: boolean; + + /** EnumOptions deprecated. */ + public deprecated: boolean; + + /** EnumOptions deprecatedLegacyJsonFieldConflicts. */ + public deprecatedLegacyJsonFieldConflicts: boolean; + + /** EnumOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** EnumOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumOptions instance + */ + public static create(properties?: google.protobuf.IEnumOptions): google.protobuf.EnumOptions; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @param message EnumOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; + + /** + * Verifies an EnumOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumOptions; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @param message EnumOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an EnumValueOptions. */ + interface IEnumValueOptions { + + /** EnumValueOptions deprecated */ + deprecated?: (boolean|null); + + /** EnumValueOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** EnumValueOptions debugRedact */ + debugRedact?: (boolean|null); + + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + + /** EnumValueOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + } + + /** Represents an EnumValueOptions. */ + class EnumValueOptions implements IEnumValueOptions { + + /** + * Constructs a new EnumValueOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEnumValueOptions); + + /** EnumValueOptions deprecated. */ + public deprecated: boolean; + + /** EnumValueOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** EnumValueOptions debugRedact. */ + public debugRedact: boolean; + + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + + /** EnumValueOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns EnumValueOptions instance + */ + public static create(properties?: google.protobuf.IEnumValueOptions): google.protobuf.EnumValueOptions; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @param message EnumValueOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; + + /** + * Verifies an EnumValueOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns EnumValueOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueOptions; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @param message EnumValueOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.EnumValueOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this EnumValueOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for EnumValueOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a ServiceOptions. */ + interface IServiceOptions { + + /** ServiceOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** ServiceOptions deprecated */ + deprecated?: (boolean|null); + + /** ServiceOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** ServiceOptions .google.api.defaultHost */ + ".google.api.defaultHost"?: (string|null); + + /** ServiceOptions .google.api.oauthScopes */ + ".google.api.oauthScopes"?: (string|null); + + /** ServiceOptions .google.api.apiVersion */ + ".google.api.apiVersion"?: (string|null); + } + + /** Represents a ServiceOptions. */ + class ServiceOptions implements IServiceOptions { + + /** + * Constructs a new ServiceOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IServiceOptions); + + /** ServiceOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** ServiceOptions deprecated. */ + public deprecated: boolean; + + /** ServiceOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns ServiceOptions instance + */ + public static create(properties?: google.protobuf.IServiceOptions): google.protobuf.ServiceOptions; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @param message ServiceOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; + + /** + * Verifies a ServiceOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ServiceOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @param message ServiceOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ServiceOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ServiceOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a MethodOptions. */ + interface IMethodOptions { + + /** MethodOptions deprecated */ + deprecated?: (boolean|null); + + /** MethodOptions idempotencyLevel */ + idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); + + /** MethodOptions features */ + features?: (google.protobuf.IFeatureSet|null); + + /** MethodOptions uninterpretedOption */ + uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); + + /** MethodOptions .google.api.http */ + ".google.api.http"?: (google.api.IHttpRule|null); + + /** MethodOptions .google.api.methodSignature */ + ".google.api.methodSignature"?: (string[]|null); + } + + /** Represents a MethodOptions. */ + class MethodOptions implements IMethodOptions { + + /** + * Constructs a new MethodOptions. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IMethodOptions); + + /** MethodOptions deprecated. */ + public deprecated: boolean; + + /** MethodOptions idempotencyLevel. */ + public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); + + /** MethodOptions features. */ + public features?: (google.protobuf.IFeatureSet|null); + + /** MethodOptions uninterpretedOption. */ + public uninterpretedOption: google.protobuf.IUninterpretedOption[]; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @param [properties] Properties to set + * @returns MethodOptions instance + */ + public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @param message MethodOptions message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; + + /** + * Verifies a MethodOptions message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns MethodOptions + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @param message MethodOptions + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this MethodOptions to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for MethodOptions + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace MethodOptions { + + /** IdempotencyLevel enum. */ + enum IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + NO_SIDE_EFFECTS = 1, + IDEMPOTENT = 2 + } + } + + /** Properties of an UninterpretedOption. */ + interface IUninterpretedOption { + + /** UninterpretedOption name */ + name?: (google.protobuf.UninterpretedOption.INamePart[]|null); + + /** UninterpretedOption identifierValue */ + identifierValue?: (string|null); + + /** UninterpretedOption positiveIntValue */ + positiveIntValue?: (number|Long|string|null); + + /** UninterpretedOption negativeIntValue */ + negativeIntValue?: (number|Long|string|null); + + /** UninterpretedOption doubleValue */ + doubleValue?: (number|null); + + /** UninterpretedOption stringValue */ + stringValue?: (Uint8Array|Buffer|string|null); + + /** UninterpretedOption aggregateValue */ + aggregateValue?: (string|null); + } + + /** Represents an UninterpretedOption. */ + class UninterpretedOption implements IUninterpretedOption { + + /** + * Constructs a new UninterpretedOption. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUninterpretedOption); + + /** UninterpretedOption name. */ + public name: google.protobuf.UninterpretedOption.INamePart[]; + + /** UninterpretedOption identifierValue. */ + public identifierValue: string; + + /** UninterpretedOption positiveIntValue. */ + public positiveIntValue: (number|Long|string); + + /** UninterpretedOption negativeIntValue. */ + public negativeIntValue: (number|Long|string); + + /** UninterpretedOption doubleValue. */ + public doubleValue: number; + + /** UninterpretedOption stringValue. */ + public stringValue: (Uint8Array|Buffer|string); + + /** UninterpretedOption aggregateValue. */ + public aggregateValue: string; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @param [properties] Properties to set + * @returns UninterpretedOption instance + */ + public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @param message UninterpretedOption message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; + + /** + * Verifies an UninterpretedOption message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UninterpretedOption + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @param message UninterpretedOption + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UninterpretedOption to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UninterpretedOption + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace UninterpretedOption { + + /** Properties of a NamePart. */ + interface INamePart { + + /** NamePart namePart */ + namePart: string; + + /** NamePart isExtension */ + isExtension: boolean; + } + + /** Represents a NamePart. */ + class NamePart implements INamePart { + + /** + * Constructs a new NamePart. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.UninterpretedOption.INamePart); + + /** NamePart namePart. */ + public namePart: string; + + /** NamePart isExtension. */ + public isExtension: boolean; + + /** + * Creates a new NamePart instance using the specified properties. + * @param [properties] Properties to set + * @returns NamePart instance + */ + public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @param message NamePart message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; + + /** + * Verifies a NamePart message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns NamePart + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @param message NamePart + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this NamePart to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for NamePart + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a FeatureSet. */ + interface IFeatureSet { + + /** FeatureSet fieldPresence */ + fieldPresence?: (google.protobuf.FeatureSet.FieldPresence|keyof typeof google.protobuf.FeatureSet.FieldPresence|null); + + /** FeatureSet enumType */ + enumType?: (google.protobuf.FeatureSet.EnumType|keyof typeof google.protobuf.FeatureSet.EnumType|null); + + /** FeatureSet repeatedFieldEncoding */ + repeatedFieldEncoding?: (google.protobuf.FeatureSet.RepeatedFieldEncoding|keyof typeof google.protobuf.FeatureSet.RepeatedFieldEncoding|null); + + /** FeatureSet utf8Validation */ + utf8Validation?: (google.protobuf.FeatureSet.Utf8Validation|keyof typeof google.protobuf.FeatureSet.Utf8Validation|null); + + /** FeatureSet messageEncoding */ + messageEncoding?: (google.protobuf.FeatureSet.MessageEncoding|keyof typeof google.protobuf.FeatureSet.MessageEncoding|null); + + /** FeatureSet jsonFormat */ + jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); + } + + /** Represents a FeatureSet. */ + class FeatureSet implements IFeatureSet { + + /** + * Constructs a new FeatureSet. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFeatureSet); + + /** FeatureSet fieldPresence. */ + public fieldPresence: (google.protobuf.FeatureSet.FieldPresence|keyof typeof google.protobuf.FeatureSet.FieldPresence); + + /** FeatureSet enumType. */ + public enumType: (google.protobuf.FeatureSet.EnumType|keyof typeof google.protobuf.FeatureSet.EnumType); + + /** FeatureSet repeatedFieldEncoding. */ + public repeatedFieldEncoding: (google.protobuf.FeatureSet.RepeatedFieldEncoding|keyof typeof google.protobuf.FeatureSet.RepeatedFieldEncoding); + + /** FeatureSet utf8Validation. */ + public utf8Validation: (google.protobuf.FeatureSet.Utf8Validation|keyof typeof google.protobuf.FeatureSet.Utf8Validation); + + /** FeatureSet messageEncoding. */ + public messageEncoding: (google.protobuf.FeatureSet.MessageEncoding|keyof typeof google.protobuf.FeatureSet.MessageEncoding); + + /** FeatureSet jsonFormat. */ + public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + + /** + * Creates a new FeatureSet instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSet instance + */ + public static create(properties?: google.protobuf.IFeatureSet): google.protobuf.FeatureSet; + + /** + * Encodes the specified FeatureSet message. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @param message FeatureSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFeatureSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSet message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @param message FeatureSet message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFeatureSet, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSet message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSet; + + /** + * Decodes a FeatureSet message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSet; + + /** + * Verifies a FeatureSet message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSet message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSet + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet; + + /** + * Creates a plain object from a FeatureSet message. Also converts values to other types if specified. + * @param message FeatureSet + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSet to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSet + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FeatureSet { + + /** FieldPresence enum. */ + enum FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3 + } + + /** EnumType enum. */ + enum EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2 + } + + /** RepeatedFieldEncoding enum. */ + enum RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2 + } + + /** Utf8Validation enum. */ + enum Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3 + } + + /** MessageEncoding enum. */ + enum MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2 + } + + /** JsonFormat enum. */ + enum JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2 + } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } + } + + /** Properties of a FeatureSetDefaults. */ + interface IFeatureSetDefaults { + + /** FeatureSetDefaults defaults */ + defaults?: (google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault[]|null); + + /** FeatureSetDefaults minimumEdition */ + minimumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSetDefaults maximumEdition */ + maximumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSetDefaults. */ + class FeatureSetDefaults implements IFeatureSetDefaults { + + /** + * Constructs a new FeatureSetDefaults. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFeatureSetDefaults); + + /** FeatureSetDefaults defaults. */ + public defaults: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault[]; + + /** FeatureSetDefaults minimumEdition. */ + public minimumEdition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSetDefaults maximumEdition. */ + public maximumEdition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSetDefaults instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSetDefaults instance + */ + public static create(properties?: google.protobuf.IFeatureSetDefaults): google.protobuf.FeatureSetDefaults; + + /** + * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @param message FeatureSetDefaults message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFeatureSetDefaults, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @param message FeatureSetDefaults message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFeatureSetDefaults, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSetDefaults; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSetDefaults; + + /** + * Verifies a FeatureSetDefaults message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSetDefaults + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSetDefaults; + + /** + * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. + * @param message FeatureSetDefaults + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSetDefaults, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSetDefaults to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSetDefaults + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace FeatureSetDefaults { + + /** Properties of a FeatureSetEditionDefault. */ + interface IFeatureSetEditionDefault { + + /** FeatureSetEditionDefault edition */ + edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); + } + + /** Represents a FeatureSetEditionDefault. */ + class FeatureSetEditionDefault implements IFeatureSetEditionDefault { + + /** + * Constructs a new FeatureSetEditionDefault. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault); + + /** FeatureSetEditionDefault edition. */ + public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); + + /** + * Creates a new FeatureSetEditionDefault instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSetEditionDefault instance + */ + public static create(properties?: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @param message FeatureSetEditionDefault message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @param message FeatureSetEditionDefault message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Verifies a FeatureSetEditionDefault message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSetEditionDefault + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; + + /** + * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. + * @param message FeatureSetEditionDefault + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSetEditionDefault to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSetEditionDefault + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a SourceCodeInfo. */ + interface ISourceCodeInfo { + + /** SourceCodeInfo location */ + location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); + } + + /** Represents a SourceCodeInfo. */ + class SourceCodeInfo implements ISourceCodeInfo { + + /** + * Constructs a new SourceCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ISourceCodeInfo); + + /** SourceCodeInfo location. */ + public location: google.protobuf.SourceCodeInfo.ILocation[]; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns SourceCodeInfo instance + */ + public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @param message SourceCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; + + /** + * Verifies a SourceCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SourceCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @param message SourceCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SourceCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SourceCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace SourceCodeInfo { + + /** Properties of a Location. */ + interface ILocation { + + /** Location path */ + path?: (number[]|null); + + /** Location span */ + span?: (number[]|null); + + /** Location leadingComments */ + leadingComments?: (string|null); + + /** Location trailingComments */ + trailingComments?: (string|null); + + /** Location leadingDetachedComments */ + leadingDetachedComments?: (string[]|null); + } + + /** Represents a Location. */ + class Location implements ILocation { + + /** + * Constructs a new Location. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); + + /** Location path. */ + public path: number[]; + + /** Location span. */ + public span: number[]; + + /** Location leadingComments. */ + public leadingComments: string; + + /** Location trailingComments. */ + public trailingComments: string; + + /** Location leadingDetachedComments. */ + public leadingDetachedComments: string[]; + + /** + * Creates a new Location instance using the specified properties. + * @param [properties] Properties to set + * @returns Location instance + */ + public static create(properties?: google.protobuf.SourceCodeInfo.ILocation): google.protobuf.SourceCodeInfo.Location; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @param message Location message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Location message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; + + /** + * Verifies a Location message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Location + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo.Location; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @param message Location + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.SourceCodeInfo.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Location to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Location + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Properties of a GeneratedCodeInfo. */ + interface IGeneratedCodeInfo { + + /** GeneratedCodeInfo annotation */ + annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); + } + + /** Represents a GeneratedCodeInfo. */ + class GeneratedCodeInfo implements IGeneratedCodeInfo { + + /** + * Constructs a new GeneratedCodeInfo. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IGeneratedCodeInfo); + + /** GeneratedCodeInfo annotation. */ + public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @param [properties] Properties to set + * @returns GeneratedCodeInfo instance + */ + public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @param message GeneratedCodeInfo message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; + + /** + * Verifies a GeneratedCodeInfo message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns GeneratedCodeInfo + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @param message GeneratedCodeInfo + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace GeneratedCodeInfo { + + /** Properties of an Annotation. */ + interface IAnnotation { + + /** Annotation path */ + path?: (number[]|null); + + /** Annotation sourceFile */ + sourceFile?: (string|null); + + /** Annotation begin */ + begin?: (number|null); + + /** Annotation end */ + end?: (number|null); + + /** Annotation semantic */ + semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null); + } + + /** Represents an Annotation. */ + class Annotation implements IAnnotation { + + /** + * Constructs a new Annotation. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); + + /** Annotation path. */ + public path: number[]; + + /** Annotation sourceFile. */ + public sourceFile: string; + + /** Annotation begin. */ + public begin: number; + + /** Annotation end. */ + public end: number; + + /** Annotation semantic. */ + public semantic: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic); + + /** + * Creates a new Annotation instance using the specified properties. + * @param [properties] Properties to set + * @returns Annotation instance + */ + public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @param message Annotation message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Verifies an Annotation message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Annotation + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @param message Annotation + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Annotation to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Annotation + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace Annotation { + + /** Semantic enum. */ + enum Semantic { + NONE = 0, + SET = 1, + ALIAS = 2 + } + } + } + + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + + /** Properties of a Duration. */ + interface IDuration { + + /** Duration seconds */ + seconds?: (number|Long|string|null); + + /** Duration nanos */ + nanos?: (number|null); + } + + /** Represents a Duration. */ + class Duration implements IDuration { + + /** + * Constructs a new Duration. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDuration); + + /** Duration seconds. */ + public seconds: (number|Long|string); + + /** Duration nanos. */ + public nanos: number; + + /** + * Creates a new Duration instance using the specified properties. + * @param [properties] Properties to set + * @returns Duration instance + */ + public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @param message Duration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; + + /** + * Verifies a Duration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Duration + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @param message Duration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Duration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Duration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a Timestamp. */ + interface ITimestamp { + + /** Timestamp seconds */ + seconds?: (number|Long|string|null); + + /** Timestamp nanos */ + nanos?: (number|null); + } + + /** Represents a Timestamp. */ + class Timestamp implements ITimestamp { + + /** + * Constructs a new Timestamp. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.ITimestamp); + + /** Timestamp seconds. */ + public seconds: (number|Long|string); + + /** Timestamp nanos. */ + public nanos: number; + + /** + * Creates a new Timestamp instance using the specified properties. + * @param [properties] Properties to set + * @returns Timestamp instance + */ + public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @param message Timestamp message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; + + /** + * Verifies a Timestamp message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Timestamp + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @param message Timestamp + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Timestamp to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Timestamp + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a DoubleValue. */ + interface IDoubleValue { + + /** DoubleValue value */ + value?: (number|null); + } + + /** Represents a DoubleValue. */ + class DoubleValue implements IDoubleValue { + + /** + * Constructs a new DoubleValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IDoubleValue); + + /** DoubleValue value. */ + public value: number; + + /** + * Creates a new DoubleValue instance using the specified properties. + * @param [properties] Properties to set + * @returns DoubleValue instance + */ + public static create(properties?: google.protobuf.IDoubleValue): google.protobuf.DoubleValue; + + /** + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @param message DoubleValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a DoubleValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DoubleValue; + + /** + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DoubleValue; + + /** + * Verifies a DoubleValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns DoubleValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.DoubleValue; + + /** + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @param message DoubleValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.DoubleValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this DoubleValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for DoubleValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FloatValue. */ + interface IFloatValue { + + /** FloatValue value */ + value?: (number|null); + } + + /** Represents a FloatValue. */ + class FloatValue implements IFloatValue { + + /** + * Constructs a new FloatValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFloatValue); + + /** FloatValue value. */ + public value: number; + + /** + * Creates a new FloatValue instance using the specified properties. + * @param [properties] Properties to set + * @returns FloatValue instance + */ + public static create(properties?: google.protobuf.IFloatValue): google.protobuf.FloatValue; + + /** + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @param message FloatValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @param message FloatValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FloatValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FloatValue; + + /** + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FloatValue; + + /** + * Verifies a FloatValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FloatValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FloatValue; + + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @param message FloatValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FloatValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FloatValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FloatValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Int64Value. */ + interface IInt64Value { + + /** Int64Value value */ + value?: (number|Long|string|null); + } + + /** Represents an Int64Value. */ + class Int64Value implements IInt64Value { + + /** + * Constructs a new Int64Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IInt64Value); + + /** Int64Value value. */ + public value: (number|Long|string); + + /** + * Creates a new Int64Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Int64Value instance + */ + public static create(properties?: google.protobuf.IInt64Value): google.protobuf.Int64Value; + + /** + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @param message Int64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @param message Int64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Int64Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Int64Value; + + /** + * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Int64Value; + + /** + * Verifies an Int64Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Int64Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Int64Value; + + /** + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @param message Int64Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Int64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Int64Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Int64Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UInt64Value. */ + interface IUInt64Value { + + /** UInt64Value value */ + value?: (number|Long|string|null); + } + + /** Represents a UInt64Value. */ + class UInt64Value implements IUInt64Value { + + /** + * Constructs a new UInt64Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUInt64Value); + + /** UInt64Value value. */ + public value: (number|Long|string); + + /** + * Creates a new UInt64Value instance using the specified properties. + * @param [properties] Properties to set + * @returns UInt64Value instance + */ + public static create(properties?: google.protobuf.IUInt64Value): google.protobuf.UInt64Value; + + /** + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @param message UInt64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @param message UInt64Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UInt64Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UInt64Value; + + /** + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UInt64Value; + + /** + * Verifies a UInt64Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UInt64Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt64Value; + + /** + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @param message UInt64Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UInt64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UInt64Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UInt64Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Int32Value. */ + interface IInt32Value { + + /** Int32Value value */ + value?: (number|null); + } + + /** Represents an Int32Value. */ + class Int32Value implements IInt32Value { + + /** + * Constructs a new Int32Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IInt32Value); + + /** Int32Value value. */ + public value: number; + + /** + * Creates a new Int32Value instance using the specified properties. + * @param [properties] Properties to set + * @returns Int32Value instance + */ + public static create(properties?: google.protobuf.IInt32Value): google.protobuf.Int32Value; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @param message Int32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @param message Int32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Int32Value; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Int32Value; + + /** + * Verifies an Int32Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Int32Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Int32Value; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @param message Int32Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Int32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Int32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Int32Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a UInt32Value. */ + interface IUInt32Value { + + /** UInt32Value value */ + value?: (number|null); + } + + /** Represents a UInt32Value. */ + class UInt32Value implements IUInt32Value { + + /** + * Constructs a new UInt32Value. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IUInt32Value); + + /** UInt32Value value. */ + public value: number; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @param [properties] Properties to set + * @returns UInt32Value instance + */ + public static create(properties?: google.protobuf.IUInt32Value): google.protobuf.UInt32Value; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @param message UInt32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @param message UInt32Value message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UInt32Value; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UInt32Value; + + /** + * Verifies a UInt32Value message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns UInt32Value + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.UInt32Value; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @param message UInt32Value + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.UInt32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this UInt32Value to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for UInt32Value + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BoolValue. */ + interface IBoolValue { + + /** BoolValue value */ + value?: (boolean|null); + } + + /** Represents a BoolValue. */ + class BoolValue implements IBoolValue { + + /** + * Constructs a new BoolValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IBoolValue); + + /** BoolValue value. */ + public value: boolean; + + /** + * Creates a new BoolValue instance using the specified properties. + * @param [properties] Properties to set + * @returns BoolValue instance + */ + public static create(properties?: google.protobuf.IBoolValue): google.protobuf.BoolValue; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @param message BoolValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @param message BoolValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.BoolValue; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.BoolValue; + + /** + * Verifies a BoolValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BoolValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.BoolValue; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @param message BoolValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.BoolValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BoolValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BoolValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a StringValue. */ + interface IStringValue { + + /** StringValue value */ + value?: (string|null); + } + + /** Represents a StringValue. */ + class StringValue implements IStringValue { + + /** + * Constructs a new StringValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IStringValue); + + /** StringValue value. */ + public value: string; + + /** + * Creates a new StringValue instance using the specified properties. + * @param [properties] Properties to set + * @returns StringValue instance + */ + public static create(properties?: google.protobuf.IStringValue): google.protobuf.StringValue; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @param message StringValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @param message StringValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.StringValue; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.StringValue; + + /** + * Verifies a StringValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns StringValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.StringValue; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @param message StringValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.StringValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this StringValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for StringValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a BytesValue. */ + interface IBytesValue { + + /** BytesValue value */ + value?: (Uint8Array|Buffer|string|null); + } + + /** Represents a BytesValue. */ + class BytesValue implements IBytesValue { + + /** + * Constructs a new BytesValue. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IBytesValue); + + /** BytesValue value. */ + public value: (Uint8Array|Buffer|string); + + /** + * Creates a new BytesValue instance using the specified properties. + * @param [properties] Properties to set + * @returns BytesValue instance + */ + public static create(properties?: google.protobuf.IBytesValue): google.protobuf.BytesValue; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @param message BytesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @param message BytesValue message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.BytesValue; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.BytesValue; + + /** + * Verifies a BytesValue message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns BytesValue + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.BytesValue; + + /** + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * @param message BytesValue + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.BytesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this BytesValue to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for BytesValue + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Any. */ + interface IAny { + + /** Any type_url */ + type_url?: (string|null); + + /** Any value */ + value?: (Uint8Array|Buffer|string|null); + } + + /** Represents an Any. */ + class Any implements IAny { + + /** + * Constructs a new Any. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IAny); + + /** Any type_url. */ + public type_url: string; + + /** Any value. */ + public value: (Uint8Array|Buffer|string); + + /** + * Creates a new Any instance using the specified properties. + * @param [properties] Properties to set + * @returns Any instance + */ + public static create(properties?: google.protobuf.IAny): google.protobuf.Any; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @param message Any message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Any message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; + + /** + * Verifies an Any message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Any + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Any; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @param message Any + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Any to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Any + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of a FieldMask. */ + interface IFieldMask { + + /** FieldMask paths */ + paths?: (string[]|null); + } + + /** Represents a FieldMask. */ + class FieldMask implements IFieldMask { + + /** + * Constructs a new FieldMask. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IFieldMask); + + /** FieldMask paths. */ + public paths: string[]; + + /** + * Creates a new FieldMask instance using the specified properties. + * @param [properties] Properties to set + * @returns FieldMask instance + */ + public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @param message FieldMask message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; + + /** + * Verifies a FieldMask message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FieldMask + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @param message FieldMask + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FieldMask to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FieldMask + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + /** Properties of an Empty. */ + interface IEmpty { + } + + /** Represents an Empty. */ + class Empty implements IEmpty { + + /** + * Constructs a new Empty. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.IEmpty); + + /** + * Creates a new Empty instance using the specified properties. + * @param [properties] Properties to set + * @returns Empty instance + */ + public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @param message Empty message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; + + /** + * Verifies an Empty message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Empty + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @param message Empty + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Empty to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Empty + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace rpc. */ + namespace rpc { + + /** Properties of a Status. */ + interface IStatus { + + /** Status code */ + code?: (number|null); + + /** Status message */ + message?: (string|null); + + /** Status details */ + details?: (google.protobuf.IAny[]|null); + } + + /** Represents a Status. */ + class Status implements IStatus { + + /** + * Constructs a new Status. + * @param [properties] Properties to set + */ + constructor(properties?: google.rpc.IStatus); + + /** Status code. */ + public code: number; + + /** Status message. */ + public message: string; + + /** Status details. */ + public details: google.protobuf.IAny[]; + + /** + * Creates a new Status instance using the specified properties. + * @param [properties] Properties to set + * @returns Status instance + */ + public static create(properties?: google.rpc.IStatus): google.rpc.Status; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @param message Status message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a Status message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.rpc.Status; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.rpc.Status; + + /** + * Verifies a Status message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Status + */ + public static fromObject(object: { [k: string]: any }): google.rpc.Status; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @param message Status + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Status to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Status + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + + /** Namespace type. */ + namespace type { + + /** Properties of an Interval. */ + interface IInterval { + + /** Interval startTime */ + startTime?: (google.protobuf.ITimestamp|null); + + /** Interval endTime */ + endTime?: (google.protobuf.ITimestamp|null); + } + + /** Represents an Interval. */ + class Interval implements IInterval { + + /** + * Constructs a new Interval. + * @param [properties] Properties to set + */ + constructor(properties?: google.type.IInterval); + + /** Interval startTime. */ + public startTime?: (google.protobuf.ITimestamp|null); + + /** Interval endTime. */ + public endTime?: (google.protobuf.ITimestamp|null); + + /** + * Creates a new Interval instance using the specified properties. + * @param [properties] Properties to set + * @returns Interval instance + */ + public static create(properties?: google.type.IInterval): google.type.Interval; + + /** + * Encodes the specified Interval message. Does not implicitly {@link google.type.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.type.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.type.Interval.verify|verify} messages. + * @param message Interval message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.type.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an Interval message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.type.Interval; + + /** + * Decodes an Interval message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.type.Interval; + + /** + * Verifies an Interval message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns Interval + */ + public static fromObject(object: { [k: string]: any }): google.type.Interval; + + /** + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @param message Interval + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.type.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this Interval to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for Interval + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/protos/protos.js b/owl-bot-staging/google-cloud-sql/protos/protos.js new file mode 100644 index 000000000000..654b059265f6 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/protos.js @@ -0,0 +1,167547 @@ +// Copyright 2026 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. + +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +(function(global, factory) { /* global define, require, module */ + + /* AMD */ if (typeof define === 'function' && define.amd) + define(["protobufjs/minimal"], factory); + + /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) + module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal); + +})(this, function($protobuf) { + "use strict"; + + // Common aliases + var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + + // Exported root namespace + var $root = $protobuf.roots._google_cloud_sql_protos || ($protobuf.roots._google_cloud_sql_protos = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.cloud = (function() { + + /** + * Namespace cloud. + * @memberof google + * @namespace + */ + var cloud = {}; + + cloud.sql = (function() { + + /** + * Namespace sql. + * @memberof google.cloud + * @namespace + */ + var sql = {}; + + sql.v1 = (function() { + + /** + * Namespace v1. + * @memberof google.cloud.sql + * @namespace + */ + var v1 = {}; + + v1.SqlAvailableDatabaseVersionsService = (function() { + + /** + * Constructs a new SqlAvailableDatabaseVersionsService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlAvailableDatabaseVersionsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlAvailableDatabaseVersionsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlAvailableDatabaseVersionsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlAvailableDatabaseVersionsService; + + /** + * Creates new SqlAvailableDatabaseVersionsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlAvailableDatabaseVersionsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlAvailableDatabaseVersionsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlAvailableDatabaseVersionsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + return SqlAvailableDatabaseVersionsService; + })(); + + v1.SqlBackupRunsService = (function() { + + /** + * Constructs a new SqlBackupRunsService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlBackupRunsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlBackupRunsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlBackupRunsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlBackupRunsService; + + /** + * Creates new SqlBackupRunsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlBackupRunsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlBackupRunsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|delete_}. + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @typedef DeleteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest} request SqlBackupRunsDeleteRequest message or plain object + * @param {google.cloud.sql.v1.SqlBackupRunsService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupRunsService.prototype["delete"] = function delete_(request, callback) { + return this.rpcCall(delete_, $root.google.cloud.sql.v1.SqlBackupRunsDeleteRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Delete" }); + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest} request SqlBackupRunsDeleteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|get}. + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.BackupRun} [response] BackupRun + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest} request SqlBackupRunsGetRequest message or plain object + * @param {google.cloud.sql.v1.SqlBackupRunsService.GetCallback} callback Node-style callback called with the error, if any, and BackupRun + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupRunsService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1.SqlBackupRunsGetRequest, $root.google.cloud.sql.v1.BackupRun, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest} request SqlBackupRunsGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|insert}. + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @typedef InsertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest} request SqlBackupRunsInsertRequest message or plain object + * @param {google.cloud.sql.v1.SqlBackupRunsService.InsertCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupRunsService.prototype.insert = function insert(request, callback) { + return this.rpcCall(insert, $root.google.cloud.sql.v1.SqlBackupRunsInsertRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Insert" }); + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest} request SqlBackupRunsInsertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|list}. + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.BackupRunsListResponse} [response] BackupRunsListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest} request SqlBackupRunsListRequest message or plain object + * @param {google.cloud.sql.v1.SqlBackupRunsService.ListCallback} callback Node-style callback called with the error, if any, and BackupRunsListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupRunsService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1.SqlBackupRunsListRequest, $root.google.cloud.sql.v1.BackupRunsListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest} request SqlBackupRunsListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlBackupRunsService; + })(); + + v1.SqlBackupRunsDeleteRequest = (function() { + + /** + * Properties of a SqlBackupRunsDeleteRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlBackupRunsDeleteRequest + * @property {number|Long|null} [id] SqlBackupRunsDeleteRequest id + * @property {string|null} [instance] SqlBackupRunsDeleteRequest instance + * @property {string|null} [project] SqlBackupRunsDeleteRequest project + */ + + /** + * Constructs a new SqlBackupRunsDeleteRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlBackupRunsDeleteRequest. + * @implements ISqlBackupRunsDeleteRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest=} [properties] Properties to set + */ + function SqlBackupRunsDeleteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBackupRunsDeleteRequest id. + * @member {number|Long} id + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @instance + */ + SqlBackupRunsDeleteRequest.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SqlBackupRunsDeleteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @instance + */ + SqlBackupRunsDeleteRequest.prototype.instance = ""; + + /** + * SqlBackupRunsDeleteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @instance + */ + SqlBackupRunsDeleteRequest.prototype.project = ""; + + /** + * Creates a new SqlBackupRunsDeleteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest instance + */ + SqlBackupRunsDeleteRequest.create = function create(properties) { + return new SqlBackupRunsDeleteRequest(properties); + }; + + /** + * Encodes the specified SqlBackupRunsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsDeleteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsDeleteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlBackupRunsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsDeleteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsDeleteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.id = reader.int64(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsDeleteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBackupRunsDeleteRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBackupRunsDeleteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlBackupRunsDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest + */ + SqlBackupRunsDeleteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlBackupRunsDeleteRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(); + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = false; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlBackupRunsDeleteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @static + * @param {google.cloud.sql.v1.SqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBackupRunsDeleteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + object.instance = ""; + object.project = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlBackupRunsDeleteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlBackupRunsDeleteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBackupRunsDeleteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBackupRunsDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlBackupRunsDeleteRequest"; + }; + + return SqlBackupRunsDeleteRequest; + })(); + + v1.SqlBackupRunsGetRequest = (function() { + + /** + * Properties of a SqlBackupRunsGetRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlBackupRunsGetRequest + * @property {number|Long|null} [id] SqlBackupRunsGetRequest id + * @property {string|null} [instance] SqlBackupRunsGetRequest instance + * @property {string|null} [project] SqlBackupRunsGetRequest project + */ + + /** + * Constructs a new SqlBackupRunsGetRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlBackupRunsGetRequest. + * @implements ISqlBackupRunsGetRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest=} [properties] Properties to set + */ + function SqlBackupRunsGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBackupRunsGetRequest id. + * @member {number|Long} id + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @instance + */ + SqlBackupRunsGetRequest.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SqlBackupRunsGetRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @instance + */ + SqlBackupRunsGetRequest.prototype.instance = ""; + + /** + * SqlBackupRunsGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @instance + */ + SqlBackupRunsGetRequest.prototype.project = ""; + + /** + * Creates a new SqlBackupRunsGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest instance + */ + SqlBackupRunsGetRequest.create = function create(properties) { + return new SqlBackupRunsGetRequest(properties); + }; + + /** + * Encodes the specified SqlBackupRunsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest} message SqlBackupRunsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlBackupRunsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest} message SqlBackupRunsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlBackupRunsGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.id = reader.int64(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBackupRunsGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBackupRunsGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlBackupRunsGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest + */ + SqlBackupRunsGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlBackupRunsGetRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlBackupRunsGetRequest(); + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = false; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlBackupRunsGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @static + * @param {google.cloud.sql.v1.SqlBackupRunsGetRequest} message SqlBackupRunsGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBackupRunsGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + object.instance = ""; + object.project = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlBackupRunsGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlBackupRunsGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBackupRunsGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBackupRunsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlBackupRunsGetRequest"; + }; + + return SqlBackupRunsGetRequest; + })(); + + v1.SqlBackupRunsInsertRequest = (function() { + + /** + * Properties of a SqlBackupRunsInsertRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlBackupRunsInsertRequest + * @property {string|null} [instance] SqlBackupRunsInsertRequest instance + * @property {string|null} [project] SqlBackupRunsInsertRequest project + * @property {google.cloud.sql.v1.IBackupRun|null} [body] SqlBackupRunsInsertRequest body + */ + + /** + * Constructs a new SqlBackupRunsInsertRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlBackupRunsInsertRequest. + * @implements ISqlBackupRunsInsertRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest=} [properties] Properties to set + */ + function SqlBackupRunsInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBackupRunsInsertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @instance + */ + SqlBackupRunsInsertRequest.prototype.instance = ""; + + /** + * SqlBackupRunsInsertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @instance + */ + SqlBackupRunsInsertRequest.prototype.project = ""; + + /** + * SqlBackupRunsInsertRequest body. + * @member {google.cloud.sql.v1.IBackupRun|null|undefined} body + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @instance + */ + SqlBackupRunsInsertRequest.prototype.body = null; + + /** + * Creates a new SqlBackupRunsInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest instance + */ + SqlBackupRunsInsertRequest.create = function create(properties) { + return new SqlBackupRunsInsertRequest(properties); + }; + + /** + * Encodes the specified SqlBackupRunsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.BackupRun.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlBackupRunsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlBackupRunsInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.BackupRun.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBackupRunsInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBackupRunsInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.BackupRun.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlBackupRunsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest + */ + SqlBackupRunsInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlBackupRunsInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlBackupRunsInsertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlBackupRunsInsertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.BackupRun.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlBackupRunsInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @static + * @param {google.cloud.sql.v1.SqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBackupRunsInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.BackupRun.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlBackupRunsInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlBackupRunsInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBackupRunsInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBackupRunsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlBackupRunsInsertRequest"; + }; + + return SqlBackupRunsInsertRequest; + })(); + + v1.SqlBackupRunsListRequest = (function() { + + /** + * Properties of a SqlBackupRunsListRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlBackupRunsListRequest + * @property {string|null} [instance] SqlBackupRunsListRequest instance + * @property {number|null} [maxResults] SqlBackupRunsListRequest maxResults + * @property {string|null} [pageToken] SqlBackupRunsListRequest pageToken + * @property {string|null} [project] SqlBackupRunsListRequest project + */ + + /** + * Constructs a new SqlBackupRunsListRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlBackupRunsListRequest. + * @implements ISqlBackupRunsListRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest=} [properties] Properties to set + */ + function SqlBackupRunsListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBackupRunsListRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @instance + */ + SqlBackupRunsListRequest.prototype.instance = ""; + + /** + * SqlBackupRunsListRequest maxResults. + * @member {number} maxResults + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @instance + */ + SqlBackupRunsListRequest.prototype.maxResults = 0; + + /** + * SqlBackupRunsListRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @instance + */ + SqlBackupRunsListRequest.prototype.pageToken = ""; + + /** + * SqlBackupRunsListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @instance + */ + SqlBackupRunsListRequest.prototype.project = ""; + + /** + * Creates a new SqlBackupRunsListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlBackupRunsListRequest} SqlBackupRunsListRequest instance + */ + SqlBackupRunsListRequest.create = function create(properties) { + return new SqlBackupRunsListRequest(properties); + }; + + /** + * Encodes the specified SqlBackupRunsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest} message SqlBackupRunsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlBackupRunsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest} message SqlBackupRunsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlBackupRunsListRequest} SqlBackupRunsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlBackupRunsListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.maxResults = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlBackupRunsListRequest} SqlBackupRunsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBackupRunsListRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBackupRunsListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlBackupRunsListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlBackupRunsListRequest} SqlBackupRunsListRequest + */ + SqlBackupRunsListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlBackupRunsListRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlBackupRunsListRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.maxResults != null) + message.maxResults = object.maxResults | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlBackupRunsListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @static + * @param {google.cloud.sql.v1.SqlBackupRunsListRequest} message SqlBackupRunsListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBackupRunsListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.maxResults = 0; + object.pageToken = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlBackupRunsListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlBackupRunsListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBackupRunsListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBackupRunsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlBackupRunsListRequest"; + }; + + return SqlBackupRunsListRequest; + })(); + + v1.BackupRun = (function() { + + /** + * Properties of a BackupRun. + * @memberof google.cloud.sql.v1 + * @interface IBackupRun + * @property {string|null} [kind] BackupRun kind + * @property {google.cloud.sql.v1.SqlBackupRunStatus|null} [status] BackupRun status + * @property {google.protobuf.ITimestamp|null} [enqueuedTime] BackupRun enqueuedTime + * @property {number|Long|null} [id] BackupRun id + * @property {google.protobuf.ITimestamp|null} [startTime] BackupRun startTime + * @property {google.protobuf.ITimestamp|null} [endTime] BackupRun endTime + * @property {google.cloud.sql.v1.IOperationError|null} [error] BackupRun error + * @property {google.cloud.sql.v1.SqlBackupRunType|null} [type] BackupRun type + * @property {string|null} [description] BackupRun description + * @property {google.protobuf.ITimestamp|null} [windowStartTime] BackupRun windowStartTime + * @property {string|null} [instance] BackupRun instance + * @property {string|null} [selfLink] BackupRun selfLink + * @property {string|null} [location] BackupRun location + * @property {google.cloud.sql.v1.SqlDatabaseVersion|null} [databaseVersion] BackupRun databaseVersion + * @property {google.cloud.sql.v1.IDiskEncryptionConfiguration|null} [diskEncryptionConfiguration] BackupRun diskEncryptionConfiguration + * @property {google.cloud.sql.v1.IDiskEncryptionStatus|null} [diskEncryptionStatus] BackupRun diskEncryptionStatus + * @property {google.cloud.sql.v1.SqlBackupKind|null} [backupKind] BackupRun backupKind + * @property {string|null} [timeZone] BackupRun timeZone + * @property {number|Long|null} [maxChargeableBytes] BackupRun maxChargeableBytes + */ + + /** + * Constructs a new BackupRun. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a BackupRun. + * @implements IBackupRun + * @constructor + * @param {google.cloud.sql.v1.IBackupRun=} [properties] Properties to set + */ + function BackupRun(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupRun kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.kind = ""; + + /** + * BackupRun status. + * @member {google.cloud.sql.v1.SqlBackupRunStatus} status + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.status = 0; + + /** + * BackupRun enqueuedTime. + * @member {google.protobuf.ITimestamp|null|undefined} enqueuedTime + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.enqueuedTime = null; + + /** + * BackupRun id. + * @member {number|Long} id + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BackupRun startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.startTime = null; + + /** + * BackupRun endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.endTime = null; + + /** + * BackupRun error. + * @member {google.cloud.sql.v1.IOperationError|null|undefined} error + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.error = null; + + /** + * BackupRun type. + * @member {google.cloud.sql.v1.SqlBackupRunType} type + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.type = 0; + + /** + * BackupRun description. + * @member {string} description + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.description = ""; + + /** + * BackupRun windowStartTime. + * @member {google.protobuf.ITimestamp|null|undefined} windowStartTime + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.windowStartTime = null; + + /** + * BackupRun instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.instance = ""; + + /** + * BackupRun selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.selfLink = ""; + + /** + * BackupRun location. + * @member {string} location + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.location = ""; + + /** + * BackupRun databaseVersion. + * @member {google.cloud.sql.v1.SqlDatabaseVersion} databaseVersion + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.databaseVersion = 0; + + /** + * BackupRun diskEncryptionConfiguration. + * @member {google.cloud.sql.v1.IDiskEncryptionConfiguration|null|undefined} diskEncryptionConfiguration + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.diskEncryptionConfiguration = null; + + /** + * BackupRun diskEncryptionStatus. + * @member {google.cloud.sql.v1.IDiskEncryptionStatus|null|undefined} diskEncryptionStatus + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.diskEncryptionStatus = null; + + /** + * BackupRun backupKind. + * @member {google.cloud.sql.v1.SqlBackupKind} backupKind + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.backupKind = 0; + + /** + * BackupRun timeZone. + * @member {string} timeZone + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.timeZone = ""; + + /** + * BackupRun maxChargeableBytes. + * @member {number|Long|null|undefined} maxChargeableBytes + * @memberof google.cloud.sql.v1.BackupRun + * @instance + */ + BackupRun.prototype.maxChargeableBytes = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BackupRun.prototype, "_maxChargeableBytes", { + get: $util.oneOfGetter($oneOfFields = ["maxChargeableBytes"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BackupRun instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.BackupRun + * @static + * @param {google.cloud.sql.v1.IBackupRun=} [properties] Properties to set + * @returns {google.cloud.sql.v1.BackupRun} BackupRun instance + */ + BackupRun.create = function create(properties) { + return new BackupRun(properties); + }; + + /** + * Encodes the specified BackupRun message. Does not implicitly {@link google.cloud.sql.v1.BackupRun.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.BackupRun + * @static + * @param {google.cloud.sql.v1.IBackupRun} message BackupRun message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRun.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.status); + if (message.enqueuedTime != null && Object.hasOwnProperty.call(message, "enqueuedTime")) + $root.google.protobuf.Timestamp.encode(message.enqueuedTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.id); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.cloud.sql.v1.OperationError.encode(message.error, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.type); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.description); + if (message.windowStartTime != null && Object.hasOwnProperty.call(message, "windowStartTime")) + $root.google.protobuf.Timestamp.encode(message.windowStartTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.instance); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.selfLink); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.location); + if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.databaseVersion); + if (message.diskEncryptionConfiguration != null && Object.hasOwnProperty.call(message, "diskEncryptionConfiguration")) + $root.google.cloud.sql.v1.DiskEncryptionConfiguration.encode(message.diskEncryptionConfiguration, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.diskEncryptionStatus != null && Object.hasOwnProperty.call(message, "diskEncryptionStatus")) + $root.google.cloud.sql.v1.DiskEncryptionStatus.encode(message.diskEncryptionStatus, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.backupKind != null && Object.hasOwnProperty.call(message, "backupKind")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.backupKind); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.timeZone); + if (message.maxChargeableBytes != null && Object.hasOwnProperty.call(message, "maxChargeableBytes")) + writer.uint32(/* id 24, wireType 0 =*/192).int64(message.maxChargeableBytes); + return writer; + }; + + /** + * Encodes the specified BackupRun message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRun.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.BackupRun + * @static + * @param {google.cloud.sql.v1.IBackupRun} message BackupRun message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRun.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupRun message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.BackupRun + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.BackupRun} BackupRun + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRun.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupRun(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.status = reader.int32(); + break; + } + case 3: { + message.enqueuedTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.id = reader.int64(); + break; + } + case 5: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.error = $root.google.cloud.sql.v1.OperationError.decode(reader, reader.uint32()); + break; + } + case 8: { + message.type = reader.int32(); + break; + } + case 9: { + message.description = reader.string(); + break; + } + case 10: { + message.windowStartTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 11: { + message.instance = reader.string(); + break; + } + case 12: { + message.selfLink = reader.string(); + break; + } + case 13: { + message.location = reader.string(); + break; + } + case 15: { + message.databaseVersion = reader.int32(); + break; + } + case 16: { + message.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.decode(reader, reader.uint32()); + break; + } + case 17: { + message.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.decode(reader, reader.uint32()); + break; + } + case 19: { + message.backupKind = reader.int32(); + break; + } + case 23: { + message.timeZone = reader.string(); + break; + } + case 24: { + message.maxChargeableBytes = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupRun message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.BackupRun + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.BackupRun} BackupRun + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRun.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupRun message. + * @function verify + * @memberof google.cloud.sql.v1.BackupRun + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupRun.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + break; + } + if (message.enqueuedTime != null && message.hasOwnProperty("enqueuedTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.enqueuedTime); + if (error) + return "enqueuedTime." + error; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.cloud.sql.v1.OperationError.verify(message.error); + if (error) + return "error." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.windowStartTime != null && message.hasOwnProperty("windowStartTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.windowStartTime); + if (error) + return "windowStartTime." + error; + } + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + switch (message.databaseVersion) { + default: + return "databaseVersion: enum value expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 684: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + case 549: + case 550: + case 551: + break; + } + if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) { + var error = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.verify(message.diskEncryptionConfiguration); + if (error) + return "diskEncryptionConfiguration." + error; + } + if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) { + var error = $root.google.cloud.sql.v1.DiskEncryptionStatus.verify(message.diskEncryptionStatus); + if (error) + return "diskEncryptionStatus." + error; + } + if (message.backupKind != null && message.hasOwnProperty("backupKind")) + switch (message.backupKind) { + default: + return "backupKind: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { + properties._maxChargeableBytes = 1; + if (!$util.isInteger(message.maxChargeableBytes) && !(message.maxChargeableBytes && $util.isInteger(message.maxChargeableBytes.low) && $util.isInteger(message.maxChargeableBytes.high))) + return "maxChargeableBytes: integer|Long expected"; + } + return null; + }; + + /** + * Creates a BackupRun message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.BackupRun + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.BackupRun} BackupRun + */ + BackupRun.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.BackupRun) + return object; + var message = new $root.google.cloud.sql.v1.BackupRun(); + if (object.kind != null) + message.kind = String(object.kind); + switch (object.status) { + default: + if (typeof object.status === "number") { + message.status = object.status; + break; + } + break; + case "SQL_BACKUP_RUN_STATUS_UNSPECIFIED": + case 0: + message.status = 0; + break; + case "ENQUEUED": + case 1: + message.status = 1; + break; + case "OVERDUE": + case 2: + message.status = 2; + break; + case "RUNNING": + case 3: + message.status = 3; + break; + case "FAILED": + case 4: + message.status = 4; + break; + case "SUCCESSFUL": + case 5: + message.status = 5; + break; + case "SKIPPED": + case 6: + message.status = 6; + break; + case "DELETION_PENDING": + case 7: + message.status = 7; + break; + case "DELETION_FAILED": + case 8: + message.status = 8; + break; + case "DELETED": + case 9: + message.status = 9; + break; + } + if (object.enqueuedTime != null) { + if (typeof object.enqueuedTime !== "object") + throw TypeError(".google.cloud.sql.v1.BackupRun.enqueuedTime: object expected"); + message.enqueuedTime = $root.google.protobuf.Timestamp.fromObject(object.enqueuedTime); + } + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = false; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.sql.v1.BackupRun.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.sql.v1.BackupRun.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.sql.v1.BackupRun.error: object expected"); + message.error = $root.google.cloud.sql.v1.OperationError.fromObject(object.error); + } + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SQL_BACKUP_RUN_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "AUTOMATED": + case 1: + message.type = 1; + break; + case "ON_DEMAND": + case 2: + message.type = 2; + break; + } + if (object.description != null) + message.description = String(object.description); + if (object.windowStartTime != null) { + if (typeof object.windowStartTime !== "object") + throw TypeError(".google.cloud.sql.v1.BackupRun.windowStartTime: object expected"); + message.windowStartTime = $root.google.protobuf.Timestamp.fromObject(object.windowStartTime); + } + if (object.instance != null) + message.instance = String(object.instance); + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + if (object.location != null) + message.location = String(object.location); + switch (object.databaseVersion) { + default: + if (typeof object.databaseVersion === "number") { + message.databaseVersion = object.databaseVersion; + break; + } + break; + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.databaseVersion = 0; + break; + case "MYSQL_5_1": + case 2: + message.databaseVersion = 2; + break; + case "MYSQL_5_5": + case 3: + message.databaseVersion = 3; + break; + case "MYSQL_5_6": + case 5: + message.databaseVersion = 5; + break; + case "MYSQL_5_7": + case 6: + message.databaseVersion = 6; + break; + case "MYSQL_8_0": + case 20: + message.databaseVersion = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.databaseVersion = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.databaseVersion = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.databaseVersion = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.databaseVersion = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.databaseVersion = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.databaseVersion = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.databaseVersion = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.databaseVersion = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.databaseVersion = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.databaseVersion = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.databaseVersion = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.databaseVersion = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.databaseVersion = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.databaseVersion = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.databaseVersion = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.databaseVersion = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.databaseVersion = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.databaseVersion = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.databaseVersion = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.databaseVersion = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.databaseVersion = 556; + break; + case "MYSQL_8_4": + case 398: + message.databaseVersion = 398; + break; + case "MYSQL_9_7": + case 654: + message.databaseVersion = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.databaseVersion = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.databaseVersion = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.databaseVersion = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.databaseVersion = 16; + break; + case "POSTGRES_9_6": + case 9: + message.databaseVersion = 9; + break; + case "POSTGRES_10": + case 18: + message.databaseVersion = 18; + break; + case "POSTGRES_11": + case 10: + message.databaseVersion = 10; + break; + case "POSTGRES_12": + case 19: + message.databaseVersion = 19; + break; + case "POSTGRES_13": + case 23: + message.databaseVersion = 23; + break; + case "POSTGRES_14": + case 110: + message.databaseVersion = 110; + break; + case "POSTGRES_15": + case 172: + message.databaseVersion = 172; + break; + case "POSTGRES_16": + case 272: + message.databaseVersion = 272; + break; + case "POSTGRES_17": + case 408: + message.databaseVersion = 408; + break; + case "POSTGRES_18": + case 557: + message.databaseVersion = 557; + break; + case "POSTGRES_19": + case 684: + message.databaseVersion = 684; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.databaseVersion = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.databaseVersion = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.databaseVersion = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.databaseVersion = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.databaseVersion = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.databaseVersion = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.databaseVersion = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.databaseVersion = 202; + break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.databaseVersion = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.databaseVersion = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.databaseVersion = 551; + break; + } + if (object.diskEncryptionConfiguration != null) { + if (typeof object.diskEncryptionConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1.BackupRun.diskEncryptionConfiguration: object expected"); + message.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.fromObject(object.diskEncryptionConfiguration); + } + if (object.diskEncryptionStatus != null) { + if (typeof object.diskEncryptionStatus !== "object") + throw TypeError(".google.cloud.sql.v1.BackupRun.diskEncryptionStatus: object expected"); + message.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.fromObject(object.diskEncryptionStatus); + } + switch (object.backupKind) { + default: + if (typeof object.backupKind === "number") { + message.backupKind = object.backupKind; + break; + } + break; + case "SQL_BACKUP_KIND_UNSPECIFIED": + case 0: + message.backupKind = 0; + break; + case "SNAPSHOT": + case 1: + message.backupKind = 1; + break; + case "PHYSICAL": + case 2: + message.backupKind = 2; + break; + } + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.maxChargeableBytes != null) + if ($util.Long) + (message.maxChargeableBytes = $util.Long.fromValue(object.maxChargeableBytes)).unsigned = false; + else if (typeof object.maxChargeableBytes === "string") + message.maxChargeableBytes = parseInt(object.maxChargeableBytes, 10); + else if (typeof object.maxChargeableBytes === "number") + message.maxChargeableBytes = object.maxChargeableBytes; + else if (typeof object.maxChargeableBytes === "object") + message.maxChargeableBytes = new $util.LongBits(object.maxChargeableBytes.low >>> 0, object.maxChargeableBytes.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a BackupRun message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.BackupRun + * @static + * @param {google.cloud.sql.v1.BackupRun} message BackupRun + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupRun.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.status = options.enums === String ? "SQL_BACKUP_RUN_STATUS_UNSPECIFIED" : 0; + object.enqueuedTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + object.startTime = null; + object.endTime = null; + object.error = null; + object.type = options.enums === String ? "SQL_BACKUP_RUN_TYPE_UNSPECIFIED" : 0; + object.description = ""; + object.windowStartTime = null; + object.instance = ""; + object.selfLink = ""; + object.location = ""; + object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; + object.diskEncryptionConfiguration = null; + object.diskEncryptionStatus = null; + object.backupKind = options.enums === String ? "SQL_BACKUP_KIND_UNSPECIFIED" : 0; + object.timeZone = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.google.cloud.sql.v1.SqlBackupRunStatus[message.status] === undefined ? message.status : $root.google.cloud.sql.v1.SqlBackupRunStatus[message.status] : message.status; + if (message.enqueuedTime != null && message.hasOwnProperty("enqueuedTime")) + object.enqueuedTime = $root.google.protobuf.Timestamp.toObject(message.enqueuedTime, options); + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.cloud.sql.v1.OperationError.toObject(message.error, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1.SqlBackupRunType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.SqlBackupRunType[message.type] : message.type; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.windowStartTime != null && message.hasOwnProperty("windowStartTime")) + object.windowStartTime = $root.google.protobuf.Timestamp.toObject(message.windowStartTime, options); + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; + if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) + object.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.toObject(message.diskEncryptionConfiguration, options); + if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) + object.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.toObject(message.diskEncryptionStatus, options); + if (message.backupKind != null && message.hasOwnProperty("backupKind")) + object.backupKind = options.enums === String ? $root.google.cloud.sql.v1.SqlBackupKind[message.backupKind] === undefined ? message.backupKind : $root.google.cloud.sql.v1.SqlBackupKind[message.backupKind] : message.backupKind; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { + if (typeof message.maxChargeableBytes === "number") + object.maxChargeableBytes = options.longs === String ? String(message.maxChargeableBytes) : message.maxChargeableBytes; + else + object.maxChargeableBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxChargeableBytes) : options.longs === Number ? new $util.LongBits(message.maxChargeableBytes.low >>> 0, message.maxChargeableBytes.high >>> 0).toNumber() : message.maxChargeableBytes; + if (options.oneofs) + object._maxChargeableBytes = "maxChargeableBytes"; + } + return object; + }; + + /** + * Converts this BackupRun to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.BackupRun + * @instance + * @returns {Object.} JSON object + */ + BackupRun.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupRun + * @function getTypeUrl + * @memberof google.cloud.sql.v1.BackupRun + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupRun.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.BackupRun"; + }; + + return BackupRun; + })(); + + v1.BackupRunsListResponse = (function() { + + /** + * Properties of a BackupRunsListResponse. + * @memberof google.cloud.sql.v1 + * @interface IBackupRunsListResponse + * @property {string|null} [kind] BackupRunsListResponse kind + * @property {Array.|null} [items] BackupRunsListResponse items + * @property {string|null} [nextPageToken] BackupRunsListResponse nextPageToken + */ + + /** + * Constructs a new BackupRunsListResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a BackupRunsListResponse. + * @implements IBackupRunsListResponse + * @constructor + * @param {google.cloud.sql.v1.IBackupRunsListResponse=} [properties] Properties to set + */ + function BackupRunsListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupRunsListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @instance + */ + BackupRunsListResponse.prototype.kind = ""; + + /** + * BackupRunsListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @instance + */ + BackupRunsListResponse.prototype.items = $util.emptyArray; + + /** + * BackupRunsListResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @instance + */ + BackupRunsListResponse.prototype.nextPageToken = ""; + + /** + * Creates a new BackupRunsListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @static + * @param {google.cloud.sql.v1.IBackupRunsListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.BackupRunsListResponse} BackupRunsListResponse instance + */ + BackupRunsListResponse.create = function create(properties) { + return new BackupRunsListResponse(properties); + }; + + /** + * Encodes the specified BackupRunsListResponse message. Does not implicitly {@link google.cloud.sql.v1.BackupRunsListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @static + * @param {google.cloud.sql.v1.IBackupRunsListResponse} message BackupRunsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRunsListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1.BackupRun.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified BackupRunsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRunsListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @static + * @param {google.cloud.sql.v1.IBackupRunsListResponse} message BackupRunsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRunsListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupRunsListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.BackupRunsListResponse} BackupRunsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRunsListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupRunsListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1.BackupRun.decode(reader, reader.uint32())); + break; + } + case 3: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupRunsListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.BackupRunsListResponse} BackupRunsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRunsListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupRunsListResponse message. + * @function verify + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupRunsListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1.BackupRun.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a BackupRunsListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.BackupRunsListResponse} BackupRunsListResponse + */ + BackupRunsListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.BackupRunsListResponse) + return object; + var message = new $root.google.cloud.sql.v1.BackupRunsListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1.BackupRunsListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1.BackupRunsListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1.BackupRun.fromObject(object.items[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a BackupRunsListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @static + * @param {google.cloud.sql.v1.BackupRunsListResponse} message BackupRunsListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupRunsListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) { + object.kind = ""; + object.nextPageToken = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1.BackupRun.toObject(message.items[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this BackupRunsListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @instance + * @returns {Object.} JSON object + */ + BackupRunsListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupRunsListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.BackupRunsListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupRunsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.BackupRunsListResponse"; + }; + + return BackupRunsListResponse; + })(); + + /** + * SqlBackupRunStatus enum. + * @name google.cloud.sql.v1.SqlBackupRunStatus + * @enum {number} + * @property {number} SQL_BACKUP_RUN_STATUS_UNSPECIFIED=0 SQL_BACKUP_RUN_STATUS_UNSPECIFIED value + * @property {number} ENQUEUED=1 ENQUEUED value + * @property {number} OVERDUE=2 OVERDUE value + * @property {number} RUNNING=3 RUNNING value + * @property {number} FAILED=4 FAILED value + * @property {number} SUCCESSFUL=5 SUCCESSFUL value + * @property {number} SKIPPED=6 SKIPPED value + * @property {number} DELETION_PENDING=7 DELETION_PENDING value + * @property {number} DELETION_FAILED=8 DELETION_FAILED value + * @property {number} DELETED=9 DELETED value + */ + v1.SqlBackupRunStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKUP_RUN_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENQUEUED"] = 1; + values[valuesById[2] = "OVERDUE"] = 2; + values[valuesById[3] = "RUNNING"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "SUCCESSFUL"] = 5; + values[valuesById[6] = "SKIPPED"] = 6; + values[valuesById[7] = "DELETION_PENDING"] = 7; + values[valuesById[8] = "DELETION_FAILED"] = 8; + values[valuesById[9] = "DELETED"] = 9; + return values; + })(); + + /** + * SqlBackupKind enum. + * @name google.cloud.sql.v1.SqlBackupKind + * @enum {number} + * @property {number} SQL_BACKUP_KIND_UNSPECIFIED=0 SQL_BACKUP_KIND_UNSPECIFIED value + * @property {number} SNAPSHOT=1 SNAPSHOT value + * @property {number} PHYSICAL=2 PHYSICAL value + */ + v1.SqlBackupKind = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKUP_KIND_UNSPECIFIED"] = 0; + values[valuesById[1] = "SNAPSHOT"] = 1; + values[valuesById[2] = "PHYSICAL"] = 2; + return values; + })(); + + /** + * SqlBackupRunType enum. + * @name google.cloud.sql.v1.SqlBackupRunType + * @enum {number} + * @property {number} SQL_BACKUP_RUN_TYPE_UNSPECIFIED=0 SQL_BACKUP_RUN_TYPE_UNSPECIFIED value + * @property {number} AUTOMATED=1 AUTOMATED value + * @property {number} ON_DEMAND=2 ON_DEMAND value + */ + v1.SqlBackupRunType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKUP_RUN_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATED"] = 1; + values[valuesById[2] = "ON_DEMAND"] = 2; + return values; + })(); + + v1.AclEntry = (function() { + + /** + * Properties of an AclEntry. + * @memberof google.cloud.sql.v1 + * @interface IAclEntry + * @property {string|null} [value] AclEntry value + * @property {google.protobuf.ITimestamp|null} [expirationTime] AclEntry expirationTime + * @property {string|null} [name] AclEntry name + * @property {string|null} [kind] AclEntry kind + */ + + /** + * Constructs a new AclEntry. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an AclEntry. + * @implements IAclEntry + * @constructor + * @param {google.cloud.sql.v1.IAclEntry=} [properties] Properties to set + */ + function AclEntry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AclEntry value. + * @member {string} value + * @memberof google.cloud.sql.v1.AclEntry + * @instance + */ + AclEntry.prototype.value = ""; + + /** + * AclEntry expirationTime. + * @member {google.protobuf.ITimestamp|null|undefined} expirationTime + * @memberof google.cloud.sql.v1.AclEntry + * @instance + */ + AclEntry.prototype.expirationTime = null; + + /** + * AclEntry name. + * @member {string} name + * @memberof google.cloud.sql.v1.AclEntry + * @instance + */ + AclEntry.prototype.name = ""; + + /** + * AclEntry kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.AclEntry + * @instance + */ + AclEntry.prototype.kind = ""; + + /** + * Creates a new AclEntry instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.AclEntry + * @static + * @param {google.cloud.sql.v1.IAclEntry=} [properties] Properties to set + * @returns {google.cloud.sql.v1.AclEntry} AclEntry instance + */ + AclEntry.create = function create(properties) { + return new AclEntry(properties); + }; + + /** + * Encodes the specified AclEntry message. Does not implicitly {@link google.cloud.sql.v1.AclEntry.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.AclEntry + * @static + * @param {google.cloud.sql.v1.IAclEntry} message AclEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AclEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.expirationTime != null && Object.hasOwnProperty.call(message, "expirationTime")) + $root.google.protobuf.Timestamp.encode(message.expirationTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); + return writer; + }; + + /** + * Encodes the specified AclEntry message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AclEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.AclEntry + * @static + * @param {google.cloud.sql.v1.IAclEntry} message AclEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AclEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AclEntry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.AclEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.AclEntry} AclEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AclEntry.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.AclEntry(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + case 2: { + message.expirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.name = reader.string(); + break; + } + case 4: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AclEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.AclEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.AclEntry} AclEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AclEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AclEntry message. + * @function verify + * @memberof google.cloud.sql.v1.AclEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AclEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expirationTime); + if (error) + return "expirationTime." + error; + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates an AclEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.AclEntry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.AclEntry} AclEntry + */ + AclEntry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.AclEntry) + return object; + var message = new $root.google.cloud.sql.v1.AclEntry(); + if (object.value != null) + message.value = String(object.value); + if (object.expirationTime != null) { + if (typeof object.expirationTime !== "object") + throw TypeError(".google.cloud.sql.v1.AclEntry.expirationTime: object expected"); + message.expirationTime = $root.google.protobuf.Timestamp.fromObject(object.expirationTime); + } + if (object.name != null) + message.name = String(object.name); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from an AclEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.AclEntry + * @static + * @param {google.cloud.sql.v1.AclEntry} message AclEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AclEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.expirationTime = null; + object.name = ""; + object.kind = ""; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) + object.expirationTime = $root.google.protobuf.Timestamp.toObject(message.expirationTime, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this AclEntry to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.AclEntry + * @instance + * @returns {Object.} JSON object + */ + AclEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AclEntry + * @function getTypeUrl + * @memberof google.cloud.sql.v1.AclEntry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AclEntry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.AclEntry"; + }; + + return AclEntry; + })(); + + v1.ApiWarning = (function() { + + /** + * Properties of an ApiWarning. + * @memberof google.cloud.sql.v1 + * @interface IApiWarning + * @property {google.cloud.sql.v1.ApiWarning.SqlApiWarningCode|null} [code] ApiWarning code + * @property {string|null} [message] ApiWarning message + * @property {string|null} [region] ApiWarning region + */ + + /** + * Constructs a new ApiWarning. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an ApiWarning. + * @implements IApiWarning + * @constructor + * @param {google.cloud.sql.v1.IApiWarning=} [properties] Properties to set + */ + function ApiWarning(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ApiWarning code. + * @member {google.cloud.sql.v1.ApiWarning.SqlApiWarningCode} code + * @memberof google.cloud.sql.v1.ApiWarning + * @instance + */ + ApiWarning.prototype.code = 0; + + /** + * ApiWarning message. + * @member {string} message + * @memberof google.cloud.sql.v1.ApiWarning + * @instance + */ + ApiWarning.prototype.message = ""; + + /** + * ApiWarning region. + * @member {string} region + * @memberof google.cloud.sql.v1.ApiWarning + * @instance + */ + ApiWarning.prototype.region = ""; + + /** + * Creates a new ApiWarning instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ApiWarning + * @static + * @param {google.cloud.sql.v1.IApiWarning=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ApiWarning} ApiWarning instance + */ + ApiWarning.create = function create(properties) { + return new ApiWarning(properties); + }; + + /** + * Encodes the specified ApiWarning message. Does not implicitly {@link google.cloud.sql.v1.ApiWarning.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ApiWarning + * @static + * @param {google.cloud.sql.v1.IApiWarning} message ApiWarning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ApiWarning.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.region); + return writer; + }; + + /** + * Encodes the specified ApiWarning message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ApiWarning.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ApiWarning + * @static + * @param {google.cloud.sql.v1.IApiWarning} message ApiWarning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ApiWarning.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ApiWarning message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ApiWarning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ApiWarning} ApiWarning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ApiWarning.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ApiWarning(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.code = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + message.region = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ApiWarning message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ApiWarning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ApiWarning} ApiWarning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ApiWarning.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ApiWarning message. + * @function verify + * @memberof google.cloud.sql.v1.ApiWarning + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ApiWarning.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + switch (message.code) { + default: + return "code: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.region != null && message.hasOwnProperty("region")) + if (!$util.isString(message.region)) + return "region: string expected"; + return null; + }; + + /** + * Creates an ApiWarning message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ApiWarning + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ApiWarning} ApiWarning + */ + ApiWarning.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ApiWarning) + return object; + var message = new $root.google.cloud.sql.v1.ApiWarning(); + switch (object.code) { + default: + if (typeof object.code === "number") { + message.code = object.code; + break; + } + break; + case "SQL_API_WARNING_CODE_UNSPECIFIED": + case 0: + message.code = 0; + break; + case "REGION_UNREACHABLE": + case 1: + message.code = 1; + break; + case "MAX_RESULTS_EXCEEDS_LIMIT": + case 2: + message.code = 2; + break; + case "COMPROMISED_CREDENTIALS": + case 3: + message.code = 3; + break; + case "INTERNAL_STATE_FAILURE": + case 4: + message.code = 4; + break; + } + if (object.message != null) + message.message = String(object.message); + if (object.region != null) + message.region = String(object.region); + return message; + }; + + /** + * Creates a plain object from an ApiWarning message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ApiWarning + * @static + * @param {google.cloud.sql.v1.ApiWarning} message ApiWarning + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ApiWarning.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.code = options.enums === String ? "SQL_API_WARNING_CODE_UNSPECIFIED" : 0; + object.message = ""; + object.region = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = options.enums === String ? $root.google.cloud.sql.v1.ApiWarning.SqlApiWarningCode[message.code] === undefined ? message.code : $root.google.cloud.sql.v1.ApiWarning.SqlApiWarningCode[message.code] : message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.region != null && message.hasOwnProperty("region")) + object.region = message.region; + return object; + }; + + /** + * Converts this ApiWarning to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ApiWarning + * @instance + * @returns {Object.} JSON object + */ + ApiWarning.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ApiWarning + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ApiWarning + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ApiWarning.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ApiWarning"; + }; + + /** + * SqlApiWarningCode enum. + * @name google.cloud.sql.v1.ApiWarning.SqlApiWarningCode + * @enum {number} + * @property {number} SQL_API_WARNING_CODE_UNSPECIFIED=0 SQL_API_WARNING_CODE_UNSPECIFIED value + * @property {number} REGION_UNREACHABLE=1 REGION_UNREACHABLE value + * @property {number} MAX_RESULTS_EXCEEDS_LIMIT=2 MAX_RESULTS_EXCEEDS_LIMIT value + * @property {number} COMPROMISED_CREDENTIALS=3 COMPROMISED_CREDENTIALS value + * @property {number} INTERNAL_STATE_FAILURE=4 INTERNAL_STATE_FAILURE value + */ + ApiWarning.SqlApiWarningCode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_API_WARNING_CODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "REGION_UNREACHABLE"] = 1; + values[valuesById[2] = "MAX_RESULTS_EXCEEDS_LIMIT"] = 2; + values[valuesById[3] = "COMPROMISED_CREDENTIALS"] = 3; + values[valuesById[4] = "INTERNAL_STATE_FAILURE"] = 4; + return values; + })(); + + return ApiWarning; + })(); + + v1.BackupRetentionSettings = (function() { + + /** + * Properties of a BackupRetentionSettings. + * @memberof google.cloud.sql.v1 + * @interface IBackupRetentionSettings + * @property {google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit|null} [retentionUnit] BackupRetentionSettings retentionUnit + * @property {google.protobuf.IInt32Value|null} [retainedBackups] BackupRetentionSettings retainedBackups + */ + + /** + * Constructs a new BackupRetentionSettings. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a BackupRetentionSettings. + * @implements IBackupRetentionSettings + * @constructor + * @param {google.cloud.sql.v1.IBackupRetentionSettings=} [properties] Properties to set + */ + function BackupRetentionSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupRetentionSettings retentionUnit. + * @member {google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit} retentionUnit + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @instance + */ + BackupRetentionSettings.prototype.retentionUnit = 0; + + /** + * BackupRetentionSettings retainedBackups. + * @member {google.protobuf.IInt32Value|null|undefined} retainedBackups + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @instance + */ + BackupRetentionSettings.prototype.retainedBackups = null; + + /** + * Creates a new BackupRetentionSettings instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @static + * @param {google.cloud.sql.v1.IBackupRetentionSettings=} [properties] Properties to set + * @returns {google.cloud.sql.v1.BackupRetentionSettings} BackupRetentionSettings instance + */ + BackupRetentionSettings.create = function create(properties) { + return new BackupRetentionSettings(properties); + }; + + /** + * Encodes the specified BackupRetentionSettings message. Does not implicitly {@link google.cloud.sql.v1.BackupRetentionSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @static + * @param {google.cloud.sql.v1.IBackupRetentionSettings} message BackupRetentionSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRetentionSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.retentionUnit != null && Object.hasOwnProperty.call(message, "retentionUnit")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.retentionUnit); + if (message.retainedBackups != null && Object.hasOwnProperty.call(message, "retainedBackups")) + $root.google.protobuf.Int32Value.encode(message.retainedBackups, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BackupRetentionSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRetentionSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @static + * @param {google.cloud.sql.v1.IBackupRetentionSettings} message BackupRetentionSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRetentionSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupRetentionSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.BackupRetentionSettings} BackupRetentionSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRetentionSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupRetentionSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.retentionUnit = reader.int32(); + break; + } + case 2: { + message.retainedBackups = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupRetentionSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.BackupRetentionSettings} BackupRetentionSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRetentionSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupRetentionSettings message. + * @function verify + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupRetentionSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.retentionUnit != null && message.hasOwnProperty("retentionUnit")) + switch (message.retentionUnit) { + default: + return "retentionUnit: enum value expected"; + case 0: + case 1: + break; + } + if (message.retainedBackups != null && message.hasOwnProperty("retainedBackups")) { + var error = $root.google.protobuf.Int32Value.verify(message.retainedBackups); + if (error) + return "retainedBackups." + error; + } + return null; + }; + + /** + * Creates a BackupRetentionSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.BackupRetentionSettings} BackupRetentionSettings + */ + BackupRetentionSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.BackupRetentionSettings) + return object; + var message = new $root.google.cloud.sql.v1.BackupRetentionSettings(); + switch (object.retentionUnit) { + default: + if (typeof object.retentionUnit === "number") { + message.retentionUnit = object.retentionUnit; + break; + } + break; + case "RETENTION_UNIT_UNSPECIFIED": + case 0: + message.retentionUnit = 0; + break; + case "COUNT": + case 1: + message.retentionUnit = 1; + break; + } + if (object.retainedBackups != null) { + if (typeof object.retainedBackups !== "object") + throw TypeError(".google.cloud.sql.v1.BackupRetentionSettings.retainedBackups: object expected"); + message.retainedBackups = $root.google.protobuf.Int32Value.fromObject(object.retainedBackups); + } + return message; + }; + + /** + * Creates a plain object from a BackupRetentionSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @static + * @param {google.cloud.sql.v1.BackupRetentionSettings} message BackupRetentionSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupRetentionSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.retentionUnit = options.enums === String ? "RETENTION_UNIT_UNSPECIFIED" : 0; + object.retainedBackups = null; + } + if (message.retentionUnit != null && message.hasOwnProperty("retentionUnit")) + object.retentionUnit = options.enums === String ? $root.google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit[message.retentionUnit] === undefined ? message.retentionUnit : $root.google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit[message.retentionUnit] : message.retentionUnit; + if (message.retainedBackups != null && message.hasOwnProperty("retainedBackups")) + object.retainedBackups = $root.google.protobuf.Int32Value.toObject(message.retainedBackups, options); + return object; + }; + + /** + * Converts this BackupRetentionSettings to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @instance + * @returns {Object.} JSON object + */ + BackupRetentionSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupRetentionSettings + * @function getTypeUrl + * @memberof google.cloud.sql.v1.BackupRetentionSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupRetentionSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.BackupRetentionSettings"; + }; + + /** + * RetentionUnit enum. + * @name google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit + * @enum {number} + * @property {number} RETENTION_UNIT_UNSPECIFIED=0 RETENTION_UNIT_UNSPECIFIED value + * @property {number} COUNT=1 COUNT value + */ + BackupRetentionSettings.RetentionUnit = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETENTION_UNIT_UNSPECIFIED"] = 0; + values[valuesById[1] = "COUNT"] = 1; + return values; + })(); + + return BackupRetentionSettings; + })(); + + v1.BackupConfiguration = (function() { + + /** + * Properties of a BackupConfiguration. + * @memberof google.cloud.sql.v1 + * @interface IBackupConfiguration + * @property {string|null} [startTime] BackupConfiguration startTime + * @property {google.protobuf.IBoolValue|null} [enabled] BackupConfiguration enabled + * @property {string|null} [kind] BackupConfiguration kind + * @property {google.protobuf.IBoolValue|null} [binaryLogEnabled] BackupConfiguration binaryLogEnabled + * @property {google.protobuf.IBoolValue|null} [replicationLogArchivingEnabled] BackupConfiguration replicationLogArchivingEnabled + * @property {string|null} [location] BackupConfiguration location + * @property {google.protobuf.IBoolValue|null} [pointInTimeRecoveryEnabled] BackupConfiguration pointInTimeRecoveryEnabled + * @property {google.cloud.sql.v1.IBackupRetentionSettings|null} [backupRetentionSettings] BackupConfiguration backupRetentionSettings + * @property {google.protobuf.IInt32Value|null} [transactionLogRetentionDays] BackupConfiguration transactionLogRetentionDays + * @property {google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|null} [transactionalLogStorageState] BackupConfiguration transactionalLogStorageState + * @property {google.cloud.sql.v1.BackupConfiguration.BackupTier|null} [backupTier] BackupConfiguration backupTier + */ + + /** + * Constructs a new BackupConfiguration. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a BackupConfiguration. + * @implements IBackupConfiguration + * @constructor + * @param {google.cloud.sql.v1.IBackupConfiguration=} [properties] Properties to set + */ + function BackupConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupConfiguration startTime. + * @member {string} startTime + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.startTime = ""; + + /** + * BackupConfiguration enabled. + * @member {google.protobuf.IBoolValue|null|undefined} enabled + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.enabled = null; + + /** + * BackupConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.kind = ""; + + /** + * BackupConfiguration binaryLogEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} binaryLogEnabled + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.binaryLogEnabled = null; + + /** + * BackupConfiguration replicationLogArchivingEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} replicationLogArchivingEnabled + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.replicationLogArchivingEnabled = null; + + /** + * BackupConfiguration location. + * @member {string} location + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.location = ""; + + /** + * BackupConfiguration pointInTimeRecoveryEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} pointInTimeRecoveryEnabled + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.pointInTimeRecoveryEnabled = null; + + /** + * BackupConfiguration backupRetentionSettings. + * @member {google.cloud.sql.v1.IBackupRetentionSettings|null|undefined} backupRetentionSettings + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.backupRetentionSettings = null; + + /** + * BackupConfiguration transactionLogRetentionDays. + * @member {google.protobuf.IInt32Value|null|undefined} transactionLogRetentionDays + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.transactionLogRetentionDays = null; + + /** + * BackupConfiguration transactionalLogStorageState. + * @member {google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|null|undefined} transactionalLogStorageState + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.transactionalLogStorageState = null; + + /** + * BackupConfiguration backupTier. + * @member {google.cloud.sql.v1.BackupConfiguration.BackupTier|null|undefined} backupTier + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.backupTier = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BackupConfiguration.prototype, "_transactionalLogStorageState", { + get: $util.oneOfGetter($oneOfFields = ["transactionalLogStorageState"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BackupConfiguration.prototype, "_backupTier", { + get: $util.oneOfGetter($oneOfFields = ["backupTier"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BackupConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.BackupConfiguration + * @static + * @param {google.cloud.sql.v1.IBackupConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1.BackupConfiguration} BackupConfiguration instance + */ + BackupConfiguration.create = function create(properties) { + return new BackupConfiguration(properties); + }; + + /** + * Encodes the specified BackupConfiguration message. Does not implicitly {@link google.cloud.sql.v1.BackupConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.BackupConfiguration + * @static + * @param {google.cloud.sql.v1.IBackupConfiguration} message BackupConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.startTime); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + $root.google.protobuf.BoolValue.encode(message.enabled, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + if (message.binaryLogEnabled != null && Object.hasOwnProperty.call(message, "binaryLogEnabled")) + $root.google.protobuf.BoolValue.encode(message.binaryLogEnabled, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.replicationLogArchivingEnabled != null && Object.hasOwnProperty.call(message, "replicationLogArchivingEnabled")) + $root.google.protobuf.BoolValue.encode(message.replicationLogArchivingEnabled, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.location); + if (message.pointInTimeRecoveryEnabled != null && Object.hasOwnProperty.call(message, "pointInTimeRecoveryEnabled")) + $root.google.protobuf.BoolValue.encode(message.pointInTimeRecoveryEnabled, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.backupRetentionSettings != null && Object.hasOwnProperty.call(message, "backupRetentionSettings")) + $root.google.cloud.sql.v1.BackupRetentionSettings.encode(message.backupRetentionSettings, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.transactionLogRetentionDays != null && Object.hasOwnProperty.call(message, "transactionLogRetentionDays")) + $root.google.protobuf.Int32Value.encode(message.transactionLogRetentionDays, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.transactionalLogStorageState != null && Object.hasOwnProperty.call(message, "transactionalLogStorageState")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.transactionalLogStorageState); + if (message.backupTier != null && Object.hasOwnProperty.call(message, "backupTier")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.backupTier); + return writer; + }; + + /** + * Encodes the specified BackupConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.BackupConfiguration + * @static + * @param {google.cloud.sql.v1.IBackupConfiguration} message BackupConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.BackupConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.BackupConfiguration} BackupConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = reader.string(); + break; + } + case 2: { + message.enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + case 4: { + message.binaryLogEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 5: { + message.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 6: { + message.location = reader.string(); + break; + } + case 7: { + message.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 8: { + message.backupRetentionSettings = $root.google.cloud.sql.v1.BackupRetentionSettings.decode(reader, reader.uint32()); + break; + } + case 9: { + message.transactionLogRetentionDays = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 10: { + message.transactionalLogStorageState = reader.int32(); + break; + } + case 11: { + message.backupTier = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.BackupConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.BackupConfiguration} BackupConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1.BackupConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.startTime != null && message.hasOwnProperty("startTime")) + if (!$util.isString(message.startTime)) + return "startTime: string expected"; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.enabled); + if (error) + return "enabled." + error; + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.binaryLogEnabled != null && message.hasOwnProperty("binaryLogEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.binaryLogEnabled); + if (error) + return "binaryLogEnabled." + error; + } + if (message.replicationLogArchivingEnabled != null && message.hasOwnProperty("replicationLogArchivingEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.replicationLogArchivingEnabled); + if (error) + return "replicationLogArchivingEnabled." + error; + } + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.pointInTimeRecoveryEnabled != null && message.hasOwnProperty("pointInTimeRecoveryEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.pointInTimeRecoveryEnabled); + if (error) + return "pointInTimeRecoveryEnabled." + error; + } + if (message.backupRetentionSettings != null && message.hasOwnProperty("backupRetentionSettings")) { + var error = $root.google.cloud.sql.v1.BackupRetentionSettings.verify(message.backupRetentionSettings); + if (error) + return "backupRetentionSettings." + error; + } + if (message.transactionLogRetentionDays != null && message.hasOwnProperty("transactionLogRetentionDays")) { + var error = $root.google.protobuf.Int32Value.verify(message.transactionLogRetentionDays); + if (error) + return "transactionLogRetentionDays." + error; + } + if (message.transactionalLogStorageState != null && message.hasOwnProperty("transactionalLogStorageState")) { + properties._transactionalLogStorageState = 1; + switch (message.transactionalLogStorageState) { + default: + return "transactionalLogStorageState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + } + if (message.backupTier != null && message.hasOwnProperty("backupTier")) { + properties._backupTier = 1; + switch (message.backupTier) { + default: + return "backupTier: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } + return null; + }; + + /** + * Creates a BackupConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.BackupConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.BackupConfiguration} BackupConfiguration + */ + BackupConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.BackupConfiguration) + return object; + var message = new $root.google.cloud.sql.v1.BackupConfiguration(); + if (object.startTime != null) + message.startTime = String(object.startTime); + if (object.enabled != null) { + if (typeof object.enabled !== "object") + throw TypeError(".google.cloud.sql.v1.BackupConfiguration.enabled: object expected"); + message.enabled = $root.google.protobuf.BoolValue.fromObject(object.enabled); + } + if (object.kind != null) + message.kind = String(object.kind); + if (object.binaryLogEnabled != null) { + if (typeof object.binaryLogEnabled !== "object") + throw TypeError(".google.cloud.sql.v1.BackupConfiguration.binaryLogEnabled: object expected"); + message.binaryLogEnabled = $root.google.protobuf.BoolValue.fromObject(object.binaryLogEnabled); + } + if (object.replicationLogArchivingEnabled != null) { + if (typeof object.replicationLogArchivingEnabled !== "object") + throw TypeError(".google.cloud.sql.v1.BackupConfiguration.replicationLogArchivingEnabled: object expected"); + message.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.fromObject(object.replicationLogArchivingEnabled); + } + if (object.location != null) + message.location = String(object.location); + if (object.pointInTimeRecoveryEnabled != null) { + if (typeof object.pointInTimeRecoveryEnabled !== "object") + throw TypeError(".google.cloud.sql.v1.BackupConfiguration.pointInTimeRecoveryEnabled: object expected"); + message.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.fromObject(object.pointInTimeRecoveryEnabled); + } + if (object.backupRetentionSettings != null) { + if (typeof object.backupRetentionSettings !== "object") + throw TypeError(".google.cloud.sql.v1.BackupConfiguration.backupRetentionSettings: object expected"); + message.backupRetentionSettings = $root.google.cloud.sql.v1.BackupRetentionSettings.fromObject(object.backupRetentionSettings); + } + if (object.transactionLogRetentionDays != null) { + if (typeof object.transactionLogRetentionDays !== "object") + throw TypeError(".google.cloud.sql.v1.BackupConfiguration.transactionLogRetentionDays: object expected"); + message.transactionLogRetentionDays = $root.google.protobuf.Int32Value.fromObject(object.transactionLogRetentionDays); + } + switch (object.transactionalLogStorageState) { + default: + if (typeof object.transactionalLogStorageState === "number") { + message.transactionalLogStorageState = object.transactionalLogStorageState; + break; + } + break; + case "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED": + case 0: + message.transactionalLogStorageState = 0; + break; + case "DISK": + case 1: + message.transactionalLogStorageState = 1; + break; + case "SWITCHING_TO_CLOUD_STORAGE": + case 2: + message.transactionalLogStorageState = 2; + break; + case "SWITCHED_TO_CLOUD_STORAGE": + case 3: + message.transactionalLogStorageState = 3; + break; + case "CLOUD_STORAGE": + case 4: + message.transactionalLogStorageState = 4; + break; + } + switch (object.backupTier) { + default: + if (typeof object.backupTier === "number") { + message.backupTier = object.backupTier; + break; + } + break; + case "BACKUP_TIER_UNSPECIFIED": + case 0: + message.backupTier = 0; + break; + case "STANDARD": + case 1: + message.backupTier = 1; + break; + case "ADVANCED": + case 2: + message.backupTier = 2; + break; + case "ENHANCED": + case 3: + message.backupTier = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a BackupConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.BackupConfiguration + * @static + * @param {google.cloud.sql.v1.BackupConfiguration} message BackupConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = ""; + object.enabled = null; + object.kind = ""; + object.binaryLogEnabled = null; + object.replicationLogArchivingEnabled = null; + object.location = ""; + object.pointInTimeRecoveryEnabled = null; + object.backupRetentionSettings = null; + object.transactionLogRetentionDays = null; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = message.startTime; + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = $root.google.protobuf.BoolValue.toObject(message.enabled, options); + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.binaryLogEnabled != null && message.hasOwnProperty("binaryLogEnabled")) + object.binaryLogEnabled = $root.google.protobuf.BoolValue.toObject(message.binaryLogEnabled, options); + if (message.replicationLogArchivingEnabled != null && message.hasOwnProperty("replicationLogArchivingEnabled")) + object.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.toObject(message.replicationLogArchivingEnabled, options); + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.pointInTimeRecoveryEnabled != null && message.hasOwnProperty("pointInTimeRecoveryEnabled")) + object.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.toObject(message.pointInTimeRecoveryEnabled, options); + if (message.backupRetentionSettings != null && message.hasOwnProperty("backupRetentionSettings")) + object.backupRetentionSettings = $root.google.cloud.sql.v1.BackupRetentionSettings.toObject(message.backupRetentionSettings, options); + if (message.transactionLogRetentionDays != null && message.hasOwnProperty("transactionLogRetentionDays")) + object.transactionLogRetentionDays = $root.google.protobuf.Int32Value.toObject(message.transactionLogRetentionDays, options); + if (message.transactionalLogStorageState != null && message.hasOwnProperty("transactionalLogStorageState")) { + object.transactionalLogStorageState = options.enums === String ? $root.google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState[message.transactionalLogStorageState] === undefined ? message.transactionalLogStorageState : $root.google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState[message.transactionalLogStorageState] : message.transactionalLogStorageState; + if (options.oneofs) + object._transactionalLogStorageState = "transactionalLogStorageState"; + } + if (message.backupTier != null && message.hasOwnProperty("backupTier")) { + object.backupTier = options.enums === String ? $root.google.cloud.sql.v1.BackupConfiguration.BackupTier[message.backupTier] === undefined ? message.backupTier : $root.google.cloud.sql.v1.BackupConfiguration.BackupTier[message.backupTier] : message.backupTier; + if (options.oneofs) + object._backupTier = "backupTier"; + } + return object; + }; + + /** + * Converts this BackupConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.BackupConfiguration + * @instance + * @returns {Object.} JSON object + */ + BackupConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1.BackupConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.BackupConfiguration"; + }; + + /** + * TransactionalLogStorageState enum. + * @name google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState + * @enum {number} + * @property {number} TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED=0 TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED value + * @property {number} DISK=1 DISK value + * @property {number} SWITCHING_TO_CLOUD_STORAGE=2 SWITCHING_TO_CLOUD_STORAGE value + * @property {number} SWITCHED_TO_CLOUD_STORAGE=3 SWITCHED_TO_CLOUD_STORAGE value + * @property {number} CLOUD_STORAGE=4 CLOUD_STORAGE value + */ + BackupConfiguration.TransactionalLogStorageState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISK"] = 1; + values[valuesById[2] = "SWITCHING_TO_CLOUD_STORAGE"] = 2; + values[valuesById[3] = "SWITCHED_TO_CLOUD_STORAGE"] = 3; + values[valuesById[4] = "CLOUD_STORAGE"] = 4; + return values; + })(); + + /** + * BackupTier enum. + * @name google.cloud.sql.v1.BackupConfiguration.BackupTier + * @enum {number} + * @property {number} BACKUP_TIER_UNSPECIFIED=0 BACKUP_TIER_UNSPECIFIED value + * @property {number} STANDARD=1 STANDARD value + * @property {number} ADVANCED=2 ADVANCED value + * @property {number} ENHANCED=3 ENHANCED value + */ + BackupConfiguration.BackupTier = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BACKUP_TIER_UNSPECIFIED"] = 0; + values[valuesById[1] = "STANDARD"] = 1; + values[valuesById[2] = "ADVANCED"] = 2; + values[valuesById[3] = "ENHANCED"] = 3; + return values; + })(); + + return BackupConfiguration; + })(); + + v1.PerformDiskShrinkContext = (function() { + + /** + * Properties of a PerformDiskShrinkContext. + * @memberof google.cloud.sql.v1 + * @interface IPerformDiskShrinkContext + * @property {number|Long|null} [targetSizeGb] PerformDiskShrinkContext targetSizeGb + */ + + /** + * Constructs a new PerformDiskShrinkContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a PerformDiskShrinkContext. + * @implements IPerformDiskShrinkContext + * @constructor + * @param {google.cloud.sql.v1.IPerformDiskShrinkContext=} [properties] Properties to set + */ + function PerformDiskShrinkContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PerformDiskShrinkContext targetSizeGb. + * @member {number|Long} targetSizeGb + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @instance + */ + PerformDiskShrinkContext.prototype.targetSizeGb = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PerformDiskShrinkContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @static + * @param {google.cloud.sql.v1.IPerformDiskShrinkContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.PerformDiskShrinkContext} PerformDiskShrinkContext instance + */ + PerformDiskShrinkContext.create = function create(properties) { + return new PerformDiskShrinkContext(properties); + }; + + /** + * Encodes the specified PerformDiskShrinkContext message. Does not implicitly {@link google.cloud.sql.v1.PerformDiskShrinkContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @static + * @param {google.cloud.sql.v1.IPerformDiskShrinkContext} message PerformDiskShrinkContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformDiskShrinkContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.targetSizeGb != null && Object.hasOwnProperty.call(message, "targetSizeGb")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.targetSizeGb); + return writer; + }; + + /** + * Encodes the specified PerformDiskShrinkContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PerformDiskShrinkContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @static + * @param {google.cloud.sql.v1.IPerformDiskShrinkContext} message PerformDiskShrinkContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformDiskShrinkContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PerformDiskShrinkContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.PerformDiskShrinkContext} PerformDiskShrinkContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformDiskShrinkContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PerformDiskShrinkContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.targetSizeGb = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PerformDiskShrinkContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.PerformDiskShrinkContext} PerformDiskShrinkContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformDiskShrinkContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PerformDiskShrinkContext message. + * @function verify + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PerformDiskShrinkContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.targetSizeGb != null && message.hasOwnProperty("targetSizeGb")) + if (!$util.isInteger(message.targetSizeGb) && !(message.targetSizeGb && $util.isInteger(message.targetSizeGb.low) && $util.isInteger(message.targetSizeGb.high))) + return "targetSizeGb: integer|Long expected"; + return null; + }; + + /** + * Creates a PerformDiskShrinkContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.PerformDiskShrinkContext} PerformDiskShrinkContext + */ + PerformDiskShrinkContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.PerformDiskShrinkContext) + return object; + var message = new $root.google.cloud.sql.v1.PerformDiskShrinkContext(); + if (object.targetSizeGb != null) + if ($util.Long) + (message.targetSizeGb = $util.Long.fromValue(object.targetSizeGb)).unsigned = false; + else if (typeof object.targetSizeGb === "string") + message.targetSizeGb = parseInt(object.targetSizeGb, 10); + else if (typeof object.targetSizeGb === "number") + message.targetSizeGb = object.targetSizeGb; + else if (typeof object.targetSizeGb === "object") + message.targetSizeGb = new $util.LongBits(object.targetSizeGb.low >>> 0, object.targetSizeGb.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PerformDiskShrinkContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @static + * @param {google.cloud.sql.v1.PerformDiskShrinkContext} message PerformDiskShrinkContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PerformDiskShrinkContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.targetSizeGb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.targetSizeGb = options.longs === String ? "0" : 0; + if (message.targetSizeGb != null && message.hasOwnProperty("targetSizeGb")) + if (typeof message.targetSizeGb === "number") + object.targetSizeGb = options.longs === String ? String(message.targetSizeGb) : message.targetSizeGb; + else + object.targetSizeGb = options.longs === String ? $util.Long.prototype.toString.call(message.targetSizeGb) : options.longs === Number ? new $util.LongBits(message.targetSizeGb.low >>> 0, message.targetSizeGb.high >>> 0).toNumber() : message.targetSizeGb; + return object; + }; + + /** + * Converts this PerformDiskShrinkContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @instance + * @returns {Object.} JSON object + */ + PerformDiskShrinkContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PerformDiskShrinkContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.PerformDiskShrinkContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PerformDiskShrinkContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.PerformDiskShrinkContext"; + }; + + return PerformDiskShrinkContext; + })(); + + v1.PreCheckResponse = (function() { + + /** + * Properties of a PreCheckResponse. + * @memberof google.cloud.sql.v1 + * @interface IPreCheckResponse + * @property {string|null} [message] PreCheckResponse message + * @property {google.cloud.sql.v1.PreCheckResponse.MessageType|null} [messageType] PreCheckResponse messageType + * @property {Array.|null} [actionsRequired] PreCheckResponse actionsRequired + */ + + /** + * Constructs a new PreCheckResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a PreCheckResponse. + * @implements IPreCheckResponse + * @constructor + * @param {google.cloud.sql.v1.IPreCheckResponse=} [properties] Properties to set + */ + function PreCheckResponse(properties) { + this.actionsRequired = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PreCheckResponse message. + * @member {string|null|undefined} message + * @memberof google.cloud.sql.v1.PreCheckResponse + * @instance + */ + PreCheckResponse.prototype.message = null; + + /** + * PreCheckResponse messageType. + * @member {google.cloud.sql.v1.PreCheckResponse.MessageType|null|undefined} messageType + * @memberof google.cloud.sql.v1.PreCheckResponse + * @instance + */ + PreCheckResponse.prototype.messageType = null; + + /** + * PreCheckResponse actionsRequired. + * @member {Array.} actionsRequired + * @memberof google.cloud.sql.v1.PreCheckResponse + * @instance + */ + PreCheckResponse.prototype.actionsRequired = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PreCheckResponse.prototype, "_message", { + get: $util.oneOfGetter($oneOfFields = ["message"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PreCheckResponse.prototype, "_messageType", { + get: $util.oneOfGetter($oneOfFields = ["messageType"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PreCheckResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.PreCheckResponse + * @static + * @param {google.cloud.sql.v1.IPreCheckResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.PreCheckResponse} PreCheckResponse instance + */ + PreCheckResponse.create = function create(properties) { + return new PreCheckResponse(properties); + }; + + /** + * Encodes the specified PreCheckResponse message. Does not implicitly {@link google.cloud.sql.v1.PreCheckResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.PreCheckResponse + * @static + * @param {google.cloud.sql.v1.IPreCheckResponse} message PreCheckResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PreCheckResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.messageType != null && Object.hasOwnProperty.call(message, "messageType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.messageType); + if (message.actionsRequired != null && message.actionsRequired.length) + for (var i = 0; i < message.actionsRequired.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.actionsRequired[i]); + return writer; + }; + + /** + * Encodes the specified PreCheckResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PreCheckResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.PreCheckResponse + * @static + * @param {google.cloud.sql.v1.IPreCheckResponse} message PreCheckResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PreCheckResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PreCheckResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.PreCheckResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.PreCheckResponse} PreCheckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PreCheckResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PreCheckResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.message = reader.string(); + break; + } + case 3: { + message.messageType = reader.int32(); + break; + } + case 4: { + if (!(message.actionsRequired && message.actionsRequired.length)) + message.actionsRequired = []; + message.actionsRequired.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PreCheckResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.PreCheckResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.PreCheckResponse} PreCheckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PreCheckResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PreCheckResponse message. + * @function verify + * @memberof google.cloud.sql.v1.PreCheckResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PreCheckResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.message != null && message.hasOwnProperty("message")) { + properties._message = 1; + if (!$util.isString(message.message)) + return "message: string expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + properties._messageType = 1; + switch (message.messageType) { + default: + return "messageType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } + if (message.actionsRequired != null && message.hasOwnProperty("actionsRequired")) { + if (!Array.isArray(message.actionsRequired)) + return "actionsRequired: array expected"; + for (var i = 0; i < message.actionsRequired.length; ++i) + if (!$util.isString(message.actionsRequired[i])) + return "actionsRequired: string[] expected"; + } + return null; + }; + + /** + * Creates a PreCheckResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.PreCheckResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.PreCheckResponse} PreCheckResponse + */ + PreCheckResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.PreCheckResponse) + return object; + var message = new $root.google.cloud.sql.v1.PreCheckResponse(); + if (object.message != null) + message.message = String(object.message); + switch (object.messageType) { + default: + if (typeof object.messageType === "number") { + message.messageType = object.messageType; + break; + } + break; + case "MESSAGE_TYPE_UNSPECIFIED": + case 0: + message.messageType = 0; + break; + case "INFO": + case 1: + message.messageType = 1; + break; + case "WARNING": + case 2: + message.messageType = 2; + break; + case "ERROR": + case 3: + message.messageType = 3; + break; + } + if (object.actionsRequired) { + if (!Array.isArray(object.actionsRequired)) + throw TypeError(".google.cloud.sql.v1.PreCheckResponse.actionsRequired: array expected"); + message.actionsRequired = []; + for (var i = 0; i < object.actionsRequired.length; ++i) + message.actionsRequired[i] = String(object.actionsRequired[i]); + } + return message; + }; + + /** + * Creates a plain object from a PreCheckResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.PreCheckResponse + * @static + * @param {google.cloud.sql.v1.PreCheckResponse} message PreCheckResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PreCheckResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.actionsRequired = []; + if (message.message != null && message.hasOwnProperty("message")) { + object.message = message.message; + if (options.oneofs) + object._message = "message"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + object.messageType = options.enums === String ? $root.google.cloud.sql.v1.PreCheckResponse.MessageType[message.messageType] === undefined ? message.messageType : $root.google.cloud.sql.v1.PreCheckResponse.MessageType[message.messageType] : message.messageType; + if (options.oneofs) + object._messageType = "messageType"; + } + if (message.actionsRequired && message.actionsRequired.length) { + object.actionsRequired = []; + for (var j = 0; j < message.actionsRequired.length; ++j) + object.actionsRequired[j] = message.actionsRequired[j]; + } + return object; + }; + + /** + * Converts this PreCheckResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.PreCheckResponse + * @instance + * @returns {Object.} JSON object + */ + PreCheckResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PreCheckResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.PreCheckResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PreCheckResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.PreCheckResponse"; + }; + + /** + * MessageType enum. + * @name google.cloud.sql.v1.PreCheckResponse.MessageType + * @enum {number} + * @property {number} MESSAGE_TYPE_UNSPECIFIED=0 MESSAGE_TYPE_UNSPECIFIED value + * @property {number} INFO=1 INFO value + * @property {number} WARNING=2 WARNING value + * @property {number} ERROR=3 ERROR value + */ + PreCheckResponse.MessageType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INFO"] = 1; + values[valuesById[2] = "WARNING"] = 2; + values[valuesById[3] = "ERROR"] = 3; + return values; + })(); + + return PreCheckResponse; + })(); + + v1.PreCheckMajorVersionUpgradeContext = (function() { + + /** + * Properties of a PreCheckMajorVersionUpgradeContext. + * @memberof google.cloud.sql.v1 + * @interface IPreCheckMajorVersionUpgradeContext + * @property {google.cloud.sql.v1.SqlDatabaseVersion|null} [targetDatabaseVersion] PreCheckMajorVersionUpgradeContext targetDatabaseVersion + * @property {Array.|null} [preCheckResponse] PreCheckMajorVersionUpgradeContext preCheckResponse + * @property {string|null} [kind] PreCheckMajorVersionUpgradeContext kind + */ + + /** + * Constructs a new PreCheckMajorVersionUpgradeContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a PreCheckMajorVersionUpgradeContext. + * @implements IPreCheckMajorVersionUpgradeContext + * @constructor + * @param {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext=} [properties] Properties to set + */ + function PreCheckMajorVersionUpgradeContext(properties) { + this.preCheckResponse = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PreCheckMajorVersionUpgradeContext targetDatabaseVersion. + * @member {google.cloud.sql.v1.SqlDatabaseVersion} targetDatabaseVersion + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @instance + */ + PreCheckMajorVersionUpgradeContext.prototype.targetDatabaseVersion = 0; + + /** + * PreCheckMajorVersionUpgradeContext preCheckResponse. + * @member {Array.} preCheckResponse + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @instance + */ + PreCheckMajorVersionUpgradeContext.prototype.preCheckResponse = $util.emptyArray; + + /** + * PreCheckMajorVersionUpgradeContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @instance + */ + PreCheckMajorVersionUpgradeContext.prototype.kind = ""; + + /** + * Creates a new PreCheckMajorVersionUpgradeContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @static + * @param {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext instance + */ + PreCheckMajorVersionUpgradeContext.create = function create(properties) { + return new PreCheckMajorVersionUpgradeContext(properties); + }; + + /** + * Encodes the specified PreCheckMajorVersionUpgradeContext message. Does not implicitly {@link google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @static + * @param {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PreCheckMajorVersionUpgradeContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.targetDatabaseVersion != null && Object.hasOwnProperty.call(message, "targetDatabaseVersion")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.targetDatabaseVersion); + if (message.preCheckResponse != null && message.preCheckResponse.length) + for (var i = 0; i < message.preCheckResponse.length; ++i) + $root.google.cloud.sql.v1.PreCheckResponse.encode(message.preCheckResponse[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + return writer; + }; + + /** + * Encodes the specified PreCheckMajorVersionUpgradeContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @static + * @param {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PreCheckMajorVersionUpgradeContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PreCheckMajorVersionUpgradeContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.targetDatabaseVersion = reader.int32(); + break; + } + case 2: { + if (!(message.preCheckResponse && message.preCheckResponse.length)) + message.preCheckResponse = []; + message.preCheckResponse.push($root.google.cloud.sql.v1.PreCheckResponse.decode(reader, reader.uint32())); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PreCheckMajorVersionUpgradeContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PreCheckMajorVersionUpgradeContext message. + * @function verify + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PreCheckMajorVersionUpgradeContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.targetDatabaseVersion != null && message.hasOwnProperty("targetDatabaseVersion")) + switch (message.targetDatabaseVersion) { + default: + return "targetDatabaseVersion: enum value expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 684: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + case 549: + case 550: + case 551: + break; + } + if (message.preCheckResponse != null && message.hasOwnProperty("preCheckResponse")) { + if (!Array.isArray(message.preCheckResponse)) + return "preCheckResponse: array expected"; + for (var i = 0; i < message.preCheckResponse.length; ++i) { + var error = $root.google.cloud.sql.v1.PreCheckResponse.verify(message.preCheckResponse[i]); + if (error) + return "preCheckResponse." + error; + } + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a PreCheckMajorVersionUpgradeContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext + */ + PreCheckMajorVersionUpgradeContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext) + return object; + var message = new $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext(); + switch (object.targetDatabaseVersion) { + default: + if (typeof object.targetDatabaseVersion === "number") { + message.targetDatabaseVersion = object.targetDatabaseVersion; + break; + } + break; + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.targetDatabaseVersion = 0; + break; + case "MYSQL_5_1": + case 2: + message.targetDatabaseVersion = 2; + break; + case "MYSQL_5_5": + case 3: + message.targetDatabaseVersion = 3; + break; + case "MYSQL_5_6": + case 5: + message.targetDatabaseVersion = 5; + break; + case "MYSQL_5_7": + case 6: + message.targetDatabaseVersion = 6; + break; + case "MYSQL_8_0": + case 20: + message.targetDatabaseVersion = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.targetDatabaseVersion = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.targetDatabaseVersion = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.targetDatabaseVersion = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.targetDatabaseVersion = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.targetDatabaseVersion = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.targetDatabaseVersion = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.targetDatabaseVersion = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.targetDatabaseVersion = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.targetDatabaseVersion = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.targetDatabaseVersion = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.targetDatabaseVersion = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.targetDatabaseVersion = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.targetDatabaseVersion = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.targetDatabaseVersion = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.targetDatabaseVersion = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.targetDatabaseVersion = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.targetDatabaseVersion = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.targetDatabaseVersion = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.targetDatabaseVersion = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.targetDatabaseVersion = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.targetDatabaseVersion = 556; + break; + case "MYSQL_8_4": + case 398: + message.targetDatabaseVersion = 398; + break; + case "MYSQL_9_7": + case 654: + message.targetDatabaseVersion = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.targetDatabaseVersion = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.targetDatabaseVersion = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.targetDatabaseVersion = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.targetDatabaseVersion = 16; + break; + case "POSTGRES_9_6": + case 9: + message.targetDatabaseVersion = 9; + break; + case "POSTGRES_10": + case 18: + message.targetDatabaseVersion = 18; + break; + case "POSTGRES_11": + case 10: + message.targetDatabaseVersion = 10; + break; + case "POSTGRES_12": + case 19: + message.targetDatabaseVersion = 19; + break; + case "POSTGRES_13": + case 23: + message.targetDatabaseVersion = 23; + break; + case "POSTGRES_14": + case 110: + message.targetDatabaseVersion = 110; + break; + case "POSTGRES_15": + case 172: + message.targetDatabaseVersion = 172; + break; + case "POSTGRES_16": + case 272: + message.targetDatabaseVersion = 272; + break; + case "POSTGRES_17": + case 408: + message.targetDatabaseVersion = 408; + break; + case "POSTGRES_18": + case 557: + message.targetDatabaseVersion = 557; + break; + case "POSTGRES_19": + case 684: + message.targetDatabaseVersion = 684; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.targetDatabaseVersion = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.targetDatabaseVersion = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.targetDatabaseVersion = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.targetDatabaseVersion = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.targetDatabaseVersion = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.targetDatabaseVersion = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.targetDatabaseVersion = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.targetDatabaseVersion = 202; + break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.targetDatabaseVersion = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.targetDatabaseVersion = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.targetDatabaseVersion = 551; + break; + } + if (object.preCheckResponse) { + if (!Array.isArray(object.preCheckResponse)) + throw TypeError(".google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.preCheckResponse: array expected"); + message.preCheckResponse = []; + for (var i = 0; i < object.preCheckResponse.length; ++i) { + if (typeof object.preCheckResponse[i] !== "object") + throw TypeError(".google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.preCheckResponse: object expected"); + message.preCheckResponse[i] = $root.google.cloud.sql.v1.PreCheckResponse.fromObject(object.preCheckResponse[i]); + } + } + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a PreCheckMajorVersionUpgradeContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @static + * @param {google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PreCheckMajorVersionUpgradeContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.preCheckResponse = []; + if (options.defaults) { + object.targetDatabaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; + object.kind = ""; + } + if (message.targetDatabaseVersion != null && message.hasOwnProperty("targetDatabaseVersion")) + object.targetDatabaseVersion = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.targetDatabaseVersion] === undefined ? message.targetDatabaseVersion : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.targetDatabaseVersion] : message.targetDatabaseVersion; + if (message.preCheckResponse && message.preCheckResponse.length) { + object.preCheckResponse = []; + for (var j = 0; j < message.preCheckResponse.length; ++j) + object.preCheckResponse[j] = $root.google.cloud.sql.v1.PreCheckResponse.toObject(message.preCheckResponse[j], options); + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this PreCheckMajorVersionUpgradeContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @instance + * @returns {Object.} JSON object + */ + PreCheckMajorVersionUpgradeContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PreCheckMajorVersionUpgradeContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PreCheckMajorVersionUpgradeContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext"; + }; + + return PreCheckMajorVersionUpgradeContext; + })(); + + v1.BackupContext = (function() { + + /** + * Properties of a BackupContext. + * @memberof google.cloud.sql.v1 + * @interface IBackupContext + * @property {number|Long|null} [backupId] BackupContext backupId + * @property {string|null} [kind] BackupContext kind + * @property {string|null} [name] BackupContext name + */ + + /** + * Constructs a new BackupContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a BackupContext. + * @implements IBackupContext + * @constructor + * @param {google.cloud.sql.v1.IBackupContext=} [properties] Properties to set + */ + function BackupContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupContext backupId. + * @member {number|Long} backupId + * @memberof google.cloud.sql.v1.BackupContext + * @instance + */ + BackupContext.prototype.backupId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BackupContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.BackupContext + * @instance + */ + BackupContext.prototype.kind = ""; + + /** + * BackupContext name. + * @member {string} name + * @memberof google.cloud.sql.v1.BackupContext + * @instance + */ + BackupContext.prototype.name = ""; + + /** + * Creates a new BackupContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.BackupContext + * @static + * @param {google.cloud.sql.v1.IBackupContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.BackupContext} BackupContext instance + */ + BackupContext.create = function create(properties) { + return new BackupContext(properties); + }; + + /** + * Encodes the specified BackupContext message. Does not implicitly {@link google.cloud.sql.v1.BackupContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.BackupContext + * @static + * @param {google.cloud.sql.v1.IBackupContext} message BackupContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backupId != null && Object.hasOwnProperty.call(message, "backupId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.backupId); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified BackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.BackupContext + * @static + * @param {google.cloud.sql.v1.IBackupContext} message BackupContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.BackupContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.BackupContext} BackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backupId = reader.int64(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + case 3: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.BackupContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.BackupContext} BackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupContext message. + * @function verify + * @memberof google.cloud.sql.v1.BackupContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.backupId != null && message.hasOwnProperty("backupId")) + if (!$util.isInteger(message.backupId) && !(message.backupId && $util.isInteger(message.backupId.low) && $util.isInteger(message.backupId.high))) + return "backupId: integer|Long expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a BackupContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.BackupContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.BackupContext} BackupContext + */ + BackupContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.BackupContext) + return object; + var message = new $root.google.cloud.sql.v1.BackupContext(); + if (object.backupId != null) + if ($util.Long) + (message.backupId = $util.Long.fromValue(object.backupId)).unsigned = false; + else if (typeof object.backupId === "string") + message.backupId = parseInt(object.backupId, 10); + else if (typeof object.backupId === "number") + message.backupId = object.backupId; + else if (typeof object.backupId === "object") + message.backupId = new $util.LongBits(object.backupId.low >>> 0, object.backupId.high >>> 0).toNumber(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a BackupContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.BackupContext + * @static + * @param {google.cloud.sql.v1.BackupContext} message BackupContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.backupId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.backupId = options.longs === String ? "0" : 0; + object.kind = ""; + object.name = ""; + } + if (message.backupId != null && message.hasOwnProperty("backupId")) + if (typeof message.backupId === "number") + object.backupId = options.longs === String ? String(message.backupId) : message.backupId; + else + object.backupId = options.longs === String ? $util.Long.prototype.toString.call(message.backupId) : options.longs === Number ? new $util.LongBits(message.backupId.low >>> 0, message.backupId.high >>> 0).toNumber() : message.backupId; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this BackupContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.BackupContext + * @instance + * @returns {Object.} JSON object + */ + BackupContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.BackupContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.BackupContext"; + }; + + return BackupContext; + })(); + + v1.Database = (function() { + + /** + * Properties of a Database. + * @memberof google.cloud.sql.v1 + * @interface IDatabase + * @property {string|null} [kind] Database kind + * @property {string|null} [charset] Database charset + * @property {string|null} [collation] Database collation + * @property {string|null} [etag] Database etag + * @property {string|null} [name] Database name + * @property {string|null} [instance] Database instance + * @property {string|null} [selfLink] Database selfLink + * @property {string|null} [project] Database project + * @property {google.cloud.sql.v1.ISqlServerDatabaseDetails|null} [sqlserverDatabaseDetails] Database sqlserverDatabaseDetails + */ + + /** + * Constructs a new Database. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a Database. + * @implements IDatabase + * @constructor + * @param {google.cloud.sql.v1.IDatabase=} [properties] Properties to set + */ + function Database(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Database kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.Database + * @instance + */ + Database.prototype.kind = ""; + + /** + * Database charset. + * @member {string} charset + * @memberof google.cloud.sql.v1.Database + * @instance + */ + Database.prototype.charset = ""; + + /** + * Database collation. + * @member {string} collation + * @memberof google.cloud.sql.v1.Database + * @instance + */ + Database.prototype.collation = ""; + + /** + * Database etag. + * @member {string} etag + * @memberof google.cloud.sql.v1.Database + * @instance + */ + Database.prototype.etag = ""; + + /** + * Database name. + * @member {string} name + * @memberof google.cloud.sql.v1.Database + * @instance + */ + Database.prototype.name = ""; + + /** + * Database instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.Database + * @instance + */ + Database.prototype.instance = ""; + + /** + * Database selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1.Database + * @instance + */ + Database.prototype.selfLink = ""; + + /** + * Database project. + * @member {string} project + * @memberof google.cloud.sql.v1.Database + * @instance + */ + Database.prototype.project = ""; + + /** + * Database sqlserverDatabaseDetails. + * @member {google.cloud.sql.v1.ISqlServerDatabaseDetails|null|undefined} sqlserverDatabaseDetails + * @memberof google.cloud.sql.v1.Database + * @instance + */ + Database.prototype.sqlserverDatabaseDetails = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Database databaseDetails. + * @member {"sqlserverDatabaseDetails"|undefined} databaseDetails + * @memberof google.cloud.sql.v1.Database + * @instance + */ + Object.defineProperty(Database.prototype, "databaseDetails", { + get: $util.oneOfGetter($oneOfFields = ["sqlserverDatabaseDetails"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Database instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.Database + * @static + * @param {google.cloud.sql.v1.IDatabase=} [properties] Properties to set + * @returns {google.cloud.sql.v1.Database} Database instance + */ + Database.create = function create(properties) { + return new Database(properties); + }; + + /** + * Encodes the specified Database message. Does not implicitly {@link google.cloud.sql.v1.Database.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.Database + * @static + * @param {google.cloud.sql.v1.IDatabase} message Database message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Database.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.charset != null && Object.hasOwnProperty.call(message, "charset")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.charset); + if (message.collation != null && Object.hasOwnProperty.call(message, "collation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.collation); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.etag); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.selfLink); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.project); + if (message.sqlserverDatabaseDetails != null && Object.hasOwnProperty.call(message, "sqlserverDatabaseDetails")) + $root.google.cloud.sql.v1.SqlServerDatabaseDetails.encode(message.sqlserverDatabaseDetails, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Database message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Database.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.Database + * @static + * @param {google.cloud.sql.v1.IDatabase} message Database message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Database.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Database message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.Database + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.Database} Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Database.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Database(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.charset = reader.string(); + break; + } + case 3: { + message.collation = reader.string(); + break; + } + case 4: { + message.etag = reader.string(); + break; + } + case 5: { + message.name = reader.string(); + break; + } + case 6: { + message.instance = reader.string(); + break; + } + case 7: { + message.selfLink = reader.string(); + break; + } + case 8: { + message.project = reader.string(); + break; + } + case 9: { + message.sqlserverDatabaseDetails = $root.google.cloud.sql.v1.SqlServerDatabaseDetails.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Database message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.Database + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.Database} Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Database.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Database message. + * @function verify + * @memberof google.cloud.sql.v1.Database + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Database.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.charset != null && message.hasOwnProperty("charset")) + if (!$util.isString(message.charset)) + return "charset: string expected"; + if (message.collation != null && message.hasOwnProperty("collation")) + if (!$util.isString(message.collation)) + return "collation: string expected"; + if (message.etag != null && message.hasOwnProperty("etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.sqlserverDatabaseDetails != null && message.hasOwnProperty("sqlserverDatabaseDetails")) { + properties.databaseDetails = 1; + { + var error = $root.google.cloud.sql.v1.SqlServerDatabaseDetails.verify(message.sqlserverDatabaseDetails); + if (error) + return "sqlserverDatabaseDetails." + error; + } + } + return null; + }; + + /** + * Creates a Database message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.Database + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.Database} Database + */ + Database.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.Database) + return object; + var message = new $root.google.cloud.sql.v1.Database(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.charset != null) + message.charset = String(object.charset); + if (object.collation != null) + message.collation = String(object.collation); + if (object.etag != null) + message.etag = String(object.etag); + if (object.name != null) + message.name = String(object.name); + if (object.instance != null) + message.instance = String(object.instance); + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + if (object.project != null) + message.project = String(object.project); + if (object.sqlserverDatabaseDetails != null) { + if (typeof object.sqlserverDatabaseDetails !== "object") + throw TypeError(".google.cloud.sql.v1.Database.sqlserverDatabaseDetails: object expected"); + message.sqlserverDatabaseDetails = $root.google.cloud.sql.v1.SqlServerDatabaseDetails.fromObject(object.sqlserverDatabaseDetails); + } + return message; + }; + + /** + * Creates a plain object from a Database message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.Database + * @static + * @param {google.cloud.sql.v1.Database} message Database + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Database.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.charset = ""; + object.collation = ""; + object.etag = ""; + object.name = ""; + object.instance = ""; + object.selfLink = ""; + object.project = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.charset != null && message.hasOwnProperty("charset")) + object.charset = message.charset; + if (message.collation != null && message.hasOwnProperty("collation")) + object.collation = message.collation; + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = message.etag; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.sqlserverDatabaseDetails != null && message.hasOwnProperty("sqlserverDatabaseDetails")) { + object.sqlserverDatabaseDetails = $root.google.cloud.sql.v1.SqlServerDatabaseDetails.toObject(message.sqlserverDatabaseDetails, options); + if (options.oneofs) + object.databaseDetails = "sqlserverDatabaseDetails"; + } + return object; + }; + + /** + * Converts this Database to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.Database + * @instance + * @returns {Object.} JSON object + */ + Database.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Database + * @function getTypeUrl + * @memberof google.cloud.sql.v1.Database + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Database.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.Database"; + }; + + return Database; + })(); + + v1.SqlServerDatabaseDetails = (function() { + + /** + * Properties of a SqlServerDatabaseDetails. + * @memberof google.cloud.sql.v1 + * @interface ISqlServerDatabaseDetails + * @property {number|null} [compatibilityLevel] SqlServerDatabaseDetails compatibilityLevel + * @property {string|null} [recoveryModel] SqlServerDatabaseDetails recoveryModel + */ + + /** + * Constructs a new SqlServerDatabaseDetails. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlServerDatabaseDetails. + * @implements ISqlServerDatabaseDetails + * @constructor + * @param {google.cloud.sql.v1.ISqlServerDatabaseDetails=} [properties] Properties to set + */ + function SqlServerDatabaseDetails(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlServerDatabaseDetails compatibilityLevel. + * @member {number} compatibilityLevel + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @instance + */ + SqlServerDatabaseDetails.prototype.compatibilityLevel = 0; + + /** + * SqlServerDatabaseDetails recoveryModel. + * @member {string} recoveryModel + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @instance + */ + SqlServerDatabaseDetails.prototype.recoveryModel = ""; + + /** + * Creates a new SqlServerDatabaseDetails instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @static + * @param {google.cloud.sql.v1.ISqlServerDatabaseDetails=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlServerDatabaseDetails} SqlServerDatabaseDetails instance + */ + SqlServerDatabaseDetails.create = function create(properties) { + return new SqlServerDatabaseDetails(properties); + }; + + /** + * Encodes the specified SqlServerDatabaseDetails message. Does not implicitly {@link google.cloud.sql.v1.SqlServerDatabaseDetails.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @static + * @param {google.cloud.sql.v1.ISqlServerDatabaseDetails} message SqlServerDatabaseDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerDatabaseDetails.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.compatibilityLevel != null && Object.hasOwnProperty.call(message, "compatibilityLevel")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.compatibilityLevel); + if (message.recoveryModel != null && Object.hasOwnProperty.call(message, "recoveryModel")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.recoveryModel); + return writer; + }; + + /** + * Encodes the specified SqlServerDatabaseDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerDatabaseDetails.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @static + * @param {google.cloud.sql.v1.ISqlServerDatabaseDetails} message SqlServerDatabaseDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerDatabaseDetails.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlServerDatabaseDetails} SqlServerDatabaseDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerDatabaseDetails.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlServerDatabaseDetails(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.compatibilityLevel = reader.int32(); + break; + } + case 2: { + message.recoveryModel = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlServerDatabaseDetails} SqlServerDatabaseDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerDatabaseDetails.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlServerDatabaseDetails message. + * @function verify + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlServerDatabaseDetails.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.compatibilityLevel != null && message.hasOwnProperty("compatibilityLevel")) + if (!$util.isInteger(message.compatibilityLevel)) + return "compatibilityLevel: integer expected"; + if (message.recoveryModel != null && message.hasOwnProperty("recoveryModel")) + if (!$util.isString(message.recoveryModel)) + return "recoveryModel: string expected"; + return null; + }; + + /** + * Creates a SqlServerDatabaseDetails message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlServerDatabaseDetails} SqlServerDatabaseDetails + */ + SqlServerDatabaseDetails.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlServerDatabaseDetails) + return object; + var message = new $root.google.cloud.sql.v1.SqlServerDatabaseDetails(); + if (object.compatibilityLevel != null) + message.compatibilityLevel = object.compatibilityLevel | 0; + if (object.recoveryModel != null) + message.recoveryModel = String(object.recoveryModel); + return message; + }; + + /** + * Creates a plain object from a SqlServerDatabaseDetails message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @static + * @param {google.cloud.sql.v1.SqlServerDatabaseDetails} message SqlServerDatabaseDetails + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlServerDatabaseDetails.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.compatibilityLevel = 0; + object.recoveryModel = ""; + } + if (message.compatibilityLevel != null && message.hasOwnProperty("compatibilityLevel")) + object.compatibilityLevel = message.compatibilityLevel; + if (message.recoveryModel != null && message.hasOwnProperty("recoveryModel")) + object.recoveryModel = message.recoveryModel; + return object; + }; + + /** + * Converts this SqlServerDatabaseDetails to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @instance + * @returns {Object.} JSON object + */ + SqlServerDatabaseDetails.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlServerDatabaseDetails + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlServerDatabaseDetails.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlServerDatabaseDetails"; + }; + + return SqlServerDatabaseDetails; + })(); + + v1.DatabaseFlags = (function() { + + /** + * Properties of a DatabaseFlags. + * @memberof google.cloud.sql.v1 + * @interface IDatabaseFlags + * @property {string|null} [name] DatabaseFlags name + * @property {string|null} [value] DatabaseFlags value + */ + + /** + * Constructs a new DatabaseFlags. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DatabaseFlags. + * @implements IDatabaseFlags + * @constructor + * @param {google.cloud.sql.v1.IDatabaseFlags=} [properties] Properties to set + */ + function DatabaseFlags(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DatabaseFlags name. + * @member {string} name + * @memberof google.cloud.sql.v1.DatabaseFlags + * @instance + */ + DatabaseFlags.prototype.name = ""; + + /** + * DatabaseFlags value. + * @member {string} value + * @memberof google.cloud.sql.v1.DatabaseFlags + * @instance + */ + DatabaseFlags.prototype.value = ""; + + /** + * Creates a new DatabaseFlags instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DatabaseFlags + * @static + * @param {google.cloud.sql.v1.IDatabaseFlags=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DatabaseFlags} DatabaseFlags instance + */ + DatabaseFlags.create = function create(properties) { + return new DatabaseFlags(properties); + }; + + /** + * Encodes the specified DatabaseFlags message. Does not implicitly {@link google.cloud.sql.v1.DatabaseFlags.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DatabaseFlags + * @static + * @param {google.cloud.sql.v1.IDatabaseFlags} message DatabaseFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabaseFlags.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + return writer; + }; + + /** + * Encodes the specified DatabaseFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseFlags.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DatabaseFlags + * @static + * @param {google.cloud.sql.v1.IDatabaseFlags} message DatabaseFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabaseFlags.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DatabaseFlags message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DatabaseFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DatabaseFlags} DatabaseFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabaseFlags.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseFlags(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DatabaseFlags message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DatabaseFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DatabaseFlags} DatabaseFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabaseFlags.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DatabaseFlags message. + * @function verify + * @memberof google.cloud.sql.v1.DatabaseFlags + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DatabaseFlags.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a DatabaseFlags message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DatabaseFlags + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DatabaseFlags} DatabaseFlags + */ + DatabaseFlags.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DatabaseFlags) + return object; + var message = new $root.google.cloud.sql.v1.DatabaseFlags(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a DatabaseFlags message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DatabaseFlags + * @static + * @param {google.cloud.sql.v1.DatabaseFlags} message DatabaseFlags + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DatabaseFlags.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.value = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this DatabaseFlags to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DatabaseFlags + * @instance + * @returns {Object.} JSON object + */ + DatabaseFlags.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DatabaseFlags + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DatabaseFlags + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DatabaseFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseFlags"; + }; + + return DatabaseFlags; + })(); + + v1.MySqlSyncConfig = (function() { + + /** + * Properties of a MySqlSyncConfig. + * @memberof google.cloud.sql.v1 + * @interface IMySqlSyncConfig + * @property {Array.|null} [initialSyncFlags] MySqlSyncConfig initialSyncFlags + */ + + /** + * Constructs a new MySqlSyncConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a MySqlSyncConfig. + * @implements IMySqlSyncConfig + * @constructor + * @param {google.cloud.sql.v1.IMySqlSyncConfig=} [properties] Properties to set + */ + function MySqlSyncConfig(properties) { + this.initialSyncFlags = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MySqlSyncConfig initialSyncFlags. + * @member {Array.} initialSyncFlags + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @instance + */ + MySqlSyncConfig.prototype.initialSyncFlags = $util.emptyArray; + + /** + * Creates a new MySqlSyncConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @static + * @param {google.cloud.sql.v1.IMySqlSyncConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.MySqlSyncConfig} MySqlSyncConfig instance + */ + MySqlSyncConfig.create = function create(properties) { + return new MySqlSyncConfig(properties); + }; + + /** + * Encodes the specified MySqlSyncConfig message. Does not implicitly {@link google.cloud.sql.v1.MySqlSyncConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @static + * @param {google.cloud.sql.v1.IMySqlSyncConfig} message MySqlSyncConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MySqlSyncConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.initialSyncFlags != null && message.initialSyncFlags.length) + for (var i = 0; i < message.initialSyncFlags.length; ++i) + $root.google.cloud.sql.v1.SyncFlags.encode(message.initialSyncFlags[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MySqlSyncConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MySqlSyncConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @static + * @param {google.cloud.sql.v1.IMySqlSyncConfig} message MySqlSyncConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MySqlSyncConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MySqlSyncConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.MySqlSyncConfig} MySqlSyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MySqlSyncConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.MySqlSyncConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.initialSyncFlags && message.initialSyncFlags.length)) + message.initialSyncFlags = []; + message.initialSyncFlags.push($root.google.cloud.sql.v1.SyncFlags.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MySqlSyncConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.MySqlSyncConfig} MySqlSyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MySqlSyncConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MySqlSyncConfig message. + * @function verify + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MySqlSyncConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.initialSyncFlags != null && message.hasOwnProperty("initialSyncFlags")) { + if (!Array.isArray(message.initialSyncFlags)) + return "initialSyncFlags: array expected"; + for (var i = 0; i < message.initialSyncFlags.length; ++i) { + var error = $root.google.cloud.sql.v1.SyncFlags.verify(message.initialSyncFlags[i]); + if (error) + return "initialSyncFlags." + error; + } + } + return null; + }; + + /** + * Creates a MySqlSyncConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.MySqlSyncConfig} MySqlSyncConfig + */ + MySqlSyncConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.MySqlSyncConfig) + return object; + var message = new $root.google.cloud.sql.v1.MySqlSyncConfig(); + if (object.initialSyncFlags) { + if (!Array.isArray(object.initialSyncFlags)) + throw TypeError(".google.cloud.sql.v1.MySqlSyncConfig.initialSyncFlags: array expected"); + message.initialSyncFlags = []; + for (var i = 0; i < object.initialSyncFlags.length; ++i) { + if (typeof object.initialSyncFlags[i] !== "object") + throw TypeError(".google.cloud.sql.v1.MySqlSyncConfig.initialSyncFlags: object expected"); + message.initialSyncFlags[i] = $root.google.cloud.sql.v1.SyncFlags.fromObject(object.initialSyncFlags[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MySqlSyncConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @static + * @param {google.cloud.sql.v1.MySqlSyncConfig} message MySqlSyncConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MySqlSyncConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.initialSyncFlags = []; + if (message.initialSyncFlags && message.initialSyncFlags.length) { + object.initialSyncFlags = []; + for (var j = 0; j < message.initialSyncFlags.length; ++j) + object.initialSyncFlags[j] = $root.google.cloud.sql.v1.SyncFlags.toObject(message.initialSyncFlags[j], options); + } + return object; + }; + + /** + * Converts this MySqlSyncConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @instance + * @returns {Object.} JSON object + */ + MySqlSyncConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MySqlSyncConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.MySqlSyncConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MySqlSyncConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.MySqlSyncConfig"; + }; + + return MySqlSyncConfig; + })(); + + v1.SyncFlags = (function() { + + /** + * Properties of a SyncFlags. + * @memberof google.cloud.sql.v1 + * @interface ISyncFlags + * @property {string|null} [name] SyncFlags name + * @property {string|null} [value] SyncFlags value + */ + + /** + * Constructs a new SyncFlags. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SyncFlags. + * @implements ISyncFlags + * @constructor + * @param {google.cloud.sql.v1.ISyncFlags=} [properties] Properties to set + */ + function SyncFlags(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncFlags name. + * @member {string} name + * @memberof google.cloud.sql.v1.SyncFlags + * @instance + */ + SyncFlags.prototype.name = ""; + + /** + * SyncFlags value. + * @member {string} value + * @memberof google.cloud.sql.v1.SyncFlags + * @instance + */ + SyncFlags.prototype.value = ""; + + /** + * Creates a new SyncFlags instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SyncFlags + * @static + * @param {google.cloud.sql.v1.ISyncFlags=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SyncFlags} SyncFlags instance + */ + SyncFlags.create = function create(properties) { + return new SyncFlags(properties); + }; + + /** + * Encodes the specified SyncFlags message. Does not implicitly {@link google.cloud.sql.v1.SyncFlags.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SyncFlags + * @static + * @param {google.cloud.sql.v1.ISyncFlags} message SyncFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncFlags.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + return writer; + }; + + /** + * Encodes the specified SyncFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SyncFlags.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SyncFlags + * @static + * @param {google.cloud.sql.v1.ISyncFlags} message SyncFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncFlags.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncFlags message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SyncFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SyncFlags} SyncFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncFlags.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SyncFlags(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncFlags message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SyncFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SyncFlags} SyncFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncFlags.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncFlags message. + * @function verify + * @memberof google.cloud.sql.v1.SyncFlags + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncFlags.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a SyncFlags message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SyncFlags + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SyncFlags} SyncFlags + */ + SyncFlags.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SyncFlags) + return object; + var message = new $root.google.cloud.sql.v1.SyncFlags(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a SyncFlags message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SyncFlags + * @static + * @param {google.cloud.sql.v1.SyncFlags} message SyncFlags + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncFlags.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.value = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this SyncFlags to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SyncFlags + * @instance + * @returns {Object.} JSON object + */ + SyncFlags.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SyncFlags + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SyncFlags + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SyncFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SyncFlags"; + }; + + return SyncFlags; + })(); + + v1.InstanceReference = (function() { + + /** + * Properties of an InstanceReference. + * @memberof google.cloud.sql.v1 + * @interface IInstanceReference + * @property {string|null} [name] InstanceReference name + * @property {string|null} [region] InstanceReference region + * @property {string|null} [project] InstanceReference project + */ + + /** + * Constructs a new InstanceReference. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstanceReference. + * @implements IInstanceReference + * @constructor + * @param {google.cloud.sql.v1.IInstanceReference=} [properties] Properties to set + */ + function InstanceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstanceReference name. + * @member {string} name + * @memberof google.cloud.sql.v1.InstanceReference + * @instance + */ + InstanceReference.prototype.name = ""; + + /** + * InstanceReference region. + * @member {string} region + * @memberof google.cloud.sql.v1.InstanceReference + * @instance + */ + InstanceReference.prototype.region = ""; + + /** + * InstanceReference project. + * @member {string} project + * @memberof google.cloud.sql.v1.InstanceReference + * @instance + */ + InstanceReference.prototype.project = ""; + + /** + * Creates a new InstanceReference instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstanceReference + * @static + * @param {google.cloud.sql.v1.IInstanceReference=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstanceReference} InstanceReference instance + */ + InstanceReference.create = function create(properties) { + return new InstanceReference(properties); + }; + + /** + * Encodes the specified InstanceReference message. Does not implicitly {@link google.cloud.sql.v1.InstanceReference.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstanceReference + * @static + * @param {google.cloud.sql.v1.IInstanceReference} message InstanceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstanceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.region); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + return writer; + }; + + /** + * Encodes the specified InstanceReference message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstanceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstanceReference + * @static + * @param {google.cloud.sql.v1.IInstanceReference} message InstanceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstanceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstanceReference message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstanceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstanceReference} InstanceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstanceReference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstanceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.region = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstanceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstanceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstanceReference} InstanceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstanceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstanceReference message. + * @function verify + * @memberof google.cloud.sql.v1.InstanceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstanceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.region != null && message.hasOwnProperty("region")) + if (!$util.isString(message.region)) + return "region: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates an InstanceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstanceReference + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstanceReference} InstanceReference + */ + InstanceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstanceReference) + return object; + var message = new $root.google.cloud.sql.v1.InstanceReference(); + if (object.name != null) + message.name = String(object.name); + if (object.region != null) + message.region = String(object.region); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from an InstanceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstanceReference + * @static + * @param {google.cloud.sql.v1.InstanceReference} message InstanceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstanceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.region = ""; + object.project = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.region != null && message.hasOwnProperty("region")) + object.region = message.region; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this InstanceReference to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstanceReference + * @instance + * @returns {Object.} JSON object + */ + InstanceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstanceReference + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstanceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstanceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstanceReference"; + }; + + return InstanceReference; + })(); + + v1.DemoteMasterConfiguration = (function() { + + /** + * Properties of a DemoteMasterConfiguration. + * @memberof google.cloud.sql.v1 + * @interface IDemoteMasterConfiguration + * @property {string|null} [kind] DemoteMasterConfiguration kind + * @property {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration|null} [mysqlReplicaConfiguration] DemoteMasterConfiguration mysqlReplicaConfiguration + */ + + /** + * Constructs a new DemoteMasterConfiguration. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DemoteMasterConfiguration. + * @implements IDemoteMasterConfiguration + * @constructor + * @param {google.cloud.sql.v1.IDemoteMasterConfiguration=} [properties] Properties to set + */ + function DemoteMasterConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DemoteMasterConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @instance + */ + DemoteMasterConfiguration.prototype.kind = ""; + + /** + * DemoteMasterConfiguration mysqlReplicaConfiguration. + * @member {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration|null|undefined} mysqlReplicaConfiguration + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @instance + */ + DemoteMasterConfiguration.prototype.mysqlReplicaConfiguration = null; + + /** + * Creates a new DemoteMasterConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @static + * @param {google.cloud.sql.v1.IDemoteMasterConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DemoteMasterConfiguration} DemoteMasterConfiguration instance + */ + DemoteMasterConfiguration.create = function create(properties) { + return new DemoteMasterConfiguration(properties); + }; + + /** + * Encodes the specified DemoteMasterConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @static + * @param {google.cloud.sql.v1.IDemoteMasterConfiguration} message DemoteMasterConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.mysqlReplicaConfiguration != null && Object.hasOwnProperty.call(message, "mysqlReplicaConfiguration")) + $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.encode(message.mysqlReplicaConfiguration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DemoteMasterConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @static + * @param {google.cloud.sql.v1.IDemoteMasterConfiguration} message DemoteMasterConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DemoteMasterConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DemoteMasterConfiguration} DemoteMasterConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DemoteMasterConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DemoteMasterConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DemoteMasterConfiguration} DemoteMasterConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DemoteMasterConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DemoteMasterConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) { + var error = $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.verify(message.mysqlReplicaConfiguration); + if (error) + return "mysqlReplicaConfiguration." + error; + } + return null; + }; + + /** + * Creates a DemoteMasterConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DemoteMasterConfiguration} DemoteMasterConfiguration + */ + DemoteMasterConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DemoteMasterConfiguration) + return object; + var message = new $root.google.cloud.sql.v1.DemoteMasterConfiguration(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.mysqlReplicaConfiguration != null) { + if (typeof object.mysqlReplicaConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1.DemoteMasterConfiguration.mysqlReplicaConfiguration: object expected"); + message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.fromObject(object.mysqlReplicaConfiguration); + } + return message; + }; + + /** + * Creates a plain object from a DemoteMasterConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @static + * @param {google.cloud.sql.v1.DemoteMasterConfiguration} message DemoteMasterConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DemoteMasterConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.mysqlReplicaConfiguration = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) + object.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.toObject(message.mysqlReplicaConfiguration, options); + return object; + }; + + /** + * Converts this DemoteMasterConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @instance + * @returns {Object.} JSON object + */ + DemoteMasterConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DemoteMasterConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DemoteMasterConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DemoteMasterConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DemoteMasterConfiguration"; + }; + + return DemoteMasterConfiguration; + })(); + + v1.DemoteMasterMySqlReplicaConfiguration = (function() { + + /** + * Properties of a DemoteMasterMySqlReplicaConfiguration. + * @memberof google.cloud.sql.v1 + * @interface IDemoteMasterMySqlReplicaConfiguration + * @property {string|null} [kind] DemoteMasterMySqlReplicaConfiguration kind + * @property {string|null} [username] DemoteMasterMySqlReplicaConfiguration username + * @property {string|null} [password] DemoteMasterMySqlReplicaConfiguration password + * @property {string|null} [clientKey] DemoteMasterMySqlReplicaConfiguration clientKey + * @property {string|null} [clientCertificate] DemoteMasterMySqlReplicaConfiguration clientCertificate + * @property {string|null} [caCertificate] DemoteMasterMySqlReplicaConfiguration caCertificate + */ + + /** + * Constructs a new DemoteMasterMySqlReplicaConfiguration. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DemoteMasterMySqlReplicaConfiguration. + * @implements IDemoteMasterMySqlReplicaConfiguration + * @constructor + * @param {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration=} [properties] Properties to set + */ + function DemoteMasterMySqlReplicaConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DemoteMasterMySqlReplicaConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.kind = ""; + + /** + * DemoteMasterMySqlReplicaConfiguration username. + * @member {string} username + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.username = ""; + + /** + * DemoteMasterMySqlReplicaConfiguration password. + * @member {string} password + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.password = ""; + + /** + * DemoteMasterMySqlReplicaConfiguration clientKey. + * @member {string} clientKey + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.clientKey = ""; + + /** + * DemoteMasterMySqlReplicaConfiguration clientCertificate. + * @member {string} clientCertificate + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.clientCertificate = ""; + + /** + * DemoteMasterMySqlReplicaConfiguration caCertificate. + * @member {string} caCertificate + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.caCertificate = ""; + + /** + * Creates a new DemoteMasterMySqlReplicaConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration instance + */ + DemoteMasterMySqlReplicaConfiguration.create = function create(properties) { + return new DemoteMasterMySqlReplicaConfiguration(properties); + }; + + /** + * Encodes the specified DemoteMasterMySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterMySqlReplicaConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); + if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.clientKey); + if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.clientCertificate); + if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.caCertificate); + return writer; + }; + + /** + * Encodes the specified DemoteMasterMySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterMySqlReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterMySqlReplicaConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.username = reader.string(); + break; + } + case 3: { + message.password = reader.string(); + break; + } + case 4: { + message.clientKey = reader.string(); + break; + } + case 5: { + message.clientCertificate = reader.string(); + break; + } + case 6: { + message.caCertificate = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterMySqlReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DemoteMasterMySqlReplicaConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DemoteMasterMySqlReplicaConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + if (!$util.isString(message.clientKey)) + return "clientKey: string expected"; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + if (!$util.isString(message.clientCertificate)) + return "clientCertificate: string expected"; + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + if (!$util.isString(message.caCertificate)) + return "caCertificate: string expected"; + return null; + }; + + /** + * Creates a DemoteMasterMySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration + */ + DemoteMasterMySqlReplicaConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration) + return object; + var message = new $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.username != null) + message.username = String(object.username); + if (object.password != null) + message.password = String(object.password); + if (object.clientKey != null) + message.clientKey = String(object.clientKey); + if (object.clientCertificate != null) + message.clientCertificate = String(object.clientCertificate); + if (object.caCertificate != null) + message.caCertificate = String(object.caCertificate); + return message; + }; + + /** + * Creates a plain object from a DemoteMasterMySqlReplicaConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DemoteMasterMySqlReplicaConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.username = ""; + object.password = ""; + object.clientKey = ""; + object.clientCertificate = ""; + object.caCertificate = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + object.clientKey = message.clientKey; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + object.clientCertificate = message.clientCertificate; + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + object.caCertificate = message.caCertificate; + return object; + }; + + /** + * Converts this DemoteMasterMySqlReplicaConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @instance + * @returns {Object.} JSON object + */ + DemoteMasterMySqlReplicaConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DemoteMasterMySqlReplicaConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DemoteMasterMySqlReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration"; + }; + + return DemoteMasterMySqlReplicaConfiguration; + })(); + + /** + * SqlFileType enum. + * @name google.cloud.sql.v1.SqlFileType + * @enum {number} + * @property {number} SQL_FILE_TYPE_UNSPECIFIED=0 SQL_FILE_TYPE_UNSPECIFIED value + * @property {number} SQL=1 SQL value + * @property {number} CSV=2 CSV value + * @property {number} BAK=4 BAK value + * @property {number} TDE=8 TDE value + */ + v1.SqlFileType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_FILE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SQL"] = 1; + values[valuesById[2] = "CSV"] = 2; + values[valuesById[4] = "BAK"] = 4; + values[valuesById[8] = "TDE"] = 8; + return values; + })(); + + v1.ExportContext = (function() { + + /** + * Properties of an ExportContext. + * @memberof google.cloud.sql.v1 + * @interface IExportContext + * @property {string|null} [uri] ExportContext uri + * @property {Array.|null} [databases] ExportContext databases + * @property {string|null} [kind] ExportContext kind + * @property {google.cloud.sql.v1.ExportContext.ISqlExportOptions|null} [sqlExportOptions] ExportContext sqlExportOptions + * @property {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions|null} [csvExportOptions] ExportContext csvExportOptions + * @property {google.cloud.sql.v1.SqlFileType|null} [fileType] ExportContext fileType + * @property {google.protobuf.IBoolValue|null} [offload] ExportContext offload + * @property {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions|null} [bakExportOptions] ExportContext bakExportOptions + * @property {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions|null} [tdeExportOptions] ExportContext tdeExportOptions + */ + + /** + * Constructs a new ExportContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an ExportContext. + * @implements IExportContext + * @constructor + * @param {google.cloud.sql.v1.IExportContext=} [properties] Properties to set + */ + function ExportContext(properties) { + this.databases = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportContext uri. + * @member {string} uri + * @memberof google.cloud.sql.v1.ExportContext + * @instance + */ + ExportContext.prototype.uri = ""; + + /** + * ExportContext databases. + * @member {Array.} databases + * @memberof google.cloud.sql.v1.ExportContext + * @instance + */ + ExportContext.prototype.databases = $util.emptyArray; + + /** + * ExportContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.ExportContext + * @instance + */ + ExportContext.prototype.kind = ""; + + /** + * ExportContext sqlExportOptions. + * @member {google.cloud.sql.v1.ExportContext.ISqlExportOptions|null|undefined} sqlExportOptions + * @memberof google.cloud.sql.v1.ExportContext + * @instance + */ + ExportContext.prototype.sqlExportOptions = null; + + /** + * ExportContext csvExportOptions. + * @member {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions|null|undefined} csvExportOptions + * @memberof google.cloud.sql.v1.ExportContext + * @instance + */ + ExportContext.prototype.csvExportOptions = null; + + /** + * ExportContext fileType. + * @member {google.cloud.sql.v1.SqlFileType} fileType + * @memberof google.cloud.sql.v1.ExportContext + * @instance + */ + ExportContext.prototype.fileType = 0; + + /** + * ExportContext offload. + * @member {google.protobuf.IBoolValue|null|undefined} offload + * @memberof google.cloud.sql.v1.ExportContext + * @instance + */ + ExportContext.prototype.offload = null; + + /** + * ExportContext bakExportOptions. + * @member {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions|null|undefined} bakExportOptions + * @memberof google.cloud.sql.v1.ExportContext + * @instance + */ + ExportContext.prototype.bakExportOptions = null; + + /** + * ExportContext tdeExportOptions. + * @member {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions|null|undefined} tdeExportOptions + * @memberof google.cloud.sql.v1.ExportContext + * @instance + */ + ExportContext.prototype.tdeExportOptions = null; + + /** + * Creates a new ExportContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ExportContext + * @static + * @param {google.cloud.sql.v1.IExportContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ExportContext} ExportContext instance + */ + ExportContext.create = function create(properties) { + return new ExportContext(properties); + }; + + /** + * Encodes the specified ExportContext message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ExportContext + * @static + * @param {google.cloud.sql.v1.IExportContext} message ExportContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.databases != null && message.databases.length) + for (var i = 0; i < message.databases.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.databases[i]); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + if (message.sqlExportOptions != null && Object.hasOwnProperty.call(message, "sqlExportOptions")) + $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.encode(message.sqlExportOptions, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.csvExportOptions != null && Object.hasOwnProperty.call(message, "csvExportOptions")) + $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.encode(message.csvExportOptions, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.fileType != null && Object.hasOwnProperty.call(message, "fileType")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.fileType); + if (message.offload != null && Object.hasOwnProperty.call(message, "offload")) + $root.google.protobuf.BoolValue.encode(message.offload, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.bakExportOptions != null && Object.hasOwnProperty.call(message, "bakExportOptions")) + $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions.encode(message.bakExportOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.tdeExportOptions != null && Object.hasOwnProperty.call(message, "tdeExportOptions")) + $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.encode(message.tdeExportOptions, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ExportContext + * @static + * @param {google.cloud.sql.v1.IExportContext} message ExportContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ExportContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ExportContext} ExportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + if (!(message.databases && message.databases.length)) + message.databases = []; + message.databases.push(reader.string()); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + case 4: { + message.sqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.csvExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.decode(reader, reader.uint32()); + break; + } + case 6: { + message.fileType = reader.int32(); + break; + } + case 8: { + message.offload = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 9: { + message.bakExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions.decode(reader, reader.uint32()); + break; + } + case 10: { + message.tdeExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ExportContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ExportContext} ExportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportContext message. + * @function verify + * @memberof google.cloud.sql.v1.ExportContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.databases != null && message.hasOwnProperty("databases")) { + if (!Array.isArray(message.databases)) + return "databases: array expected"; + for (var i = 0; i < message.databases.length; ++i) + if (!$util.isString(message.databases[i])) + return "databases: string[] expected"; + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.sqlExportOptions != null && message.hasOwnProperty("sqlExportOptions")) { + var error = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.verify(message.sqlExportOptions); + if (error) + return "sqlExportOptions." + error; + } + if (message.csvExportOptions != null && message.hasOwnProperty("csvExportOptions")) { + var error = $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.verify(message.csvExportOptions); + if (error) + return "csvExportOptions." + error; + } + if (message.fileType != null && message.hasOwnProperty("fileType")) + switch (message.fileType) { + default: + return "fileType: enum value expected"; + case 0: + case 1: + case 2: + case 4: + case 8: + break; + } + if (message.offload != null && message.hasOwnProperty("offload")) { + var error = $root.google.protobuf.BoolValue.verify(message.offload); + if (error) + return "offload." + error; + } + if (message.bakExportOptions != null && message.hasOwnProperty("bakExportOptions")) { + var error = $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions.verify(message.bakExportOptions); + if (error) + return "bakExportOptions." + error; + } + if (message.tdeExportOptions != null && message.hasOwnProperty("tdeExportOptions")) { + var error = $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.verify(message.tdeExportOptions); + if (error) + return "tdeExportOptions." + error; + } + return null; + }; + + /** + * Creates an ExportContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ExportContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ExportContext} ExportContext + */ + ExportContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ExportContext) + return object; + var message = new $root.google.cloud.sql.v1.ExportContext(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.databases) { + if (!Array.isArray(object.databases)) + throw TypeError(".google.cloud.sql.v1.ExportContext.databases: array expected"); + message.databases = []; + for (var i = 0; i < object.databases.length; ++i) + message.databases[i] = String(object.databases[i]); + } + if (object.kind != null) + message.kind = String(object.kind); + if (object.sqlExportOptions != null) { + if (typeof object.sqlExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.sqlExportOptions: object expected"); + message.sqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.fromObject(object.sqlExportOptions); + } + if (object.csvExportOptions != null) { + if (typeof object.csvExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.csvExportOptions: object expected"); + message.csvExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.fromObject(object.csvExportOptions); + } + switch (object.fileType) { + default: + if (typeof object.fileType === "number") { + message.fileType = object.fileType; + break; + } + break; + case "SQL_FILE_TYPE_UNSPECIFIED": + case 0: + message.fileType = 0; + break; + case "SQL": + case 1: + message.fileType = 1; + break; + case "CSV": + case 2: + message.fileType = 2; + break; + case "BAK": + case 4: + message.fileType = 4; + break; + case "TDE": + case 8: + message.fileType = 8; + break; + } + if (object.offload != null) { + if (typeof object.offload !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.offload: object expected"); + message.offload = $root.google.protobuf.BoolValue.fromObject(object.offload); + } + if (object.bakExportOptions != null) { + if (typeof object.bakExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.bakExportOptions: object expected"); + message.bakExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions.fromObject(object.bakExportOptions); + } + if (object.tdeExportOptions != null) { + if (typeof object.tdeExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.tdeExportOptions: object expected"); + message.tdeExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.fromObject(object.tdeExportOptions); + } + return message; + }; + + /** + * Creates a plain object from an ExportContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ExportContext + * @static + * @param {google.cloud.sql.v1.ExportContext} message ExportContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.databases = []; + if (options.defaults) { + object.uri = ""; + object.kind = ""; + object.sqlExportOptions = null; + object.csvExportOptions = null; + object.fileType = options.enums === String ? "SQL_FILE_TYPE_UNSPECIFIED" : 0; + object.offload = null; + object.bakExportOptions = null; + object.tdeExportOptions = null; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.databases && message.databases.length) { + object.databases = []; + for (var j = 0; j < message.databases.length; ++j) + object.databases[j] = message.databases[j]; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.sqlExportOptions != null && message.hasOwnProperty("sqlExportOptions")) + object.sqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.toObject(message.sqlExportOptions, options); + if (message.csvExportOptions != null && message.hasOwnProperty("csvExportOptions")) + object.csvExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.toObject(message.csvExportOptions, options); + if (message.fileType != null && message.hasOwnProperty("fileType")) + object.fileType = options.enums === String ? $root.google.cloud.sql.v1.SqlFileType[message.fileType] === undefined ? message.fileType : $root.google.cloud.sql.v1.SqlFileType[message.fileType] : message.fileType; + if (message.offload != null && message.hasOwnProperty("offload")) + object.offload = $root.google.protobuf.BoolValue.toObject(message.offload, options); + if (message.bakExportOptions != null && message.hasOwnProperty("bakExportOptions")) + object.bakExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions.toObject(message.bakExportOptions, options); + if (message.tdeExportOptions != null && message.hasOwnProperty("tdeExportOptions")) + object.tdeExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.toObject(message.tdeExportOptions, options); + return object; + }; + + /** + * Converts this ExportContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ExportContext + * @instance + * @returns {Object.} JSON object + */ + ExportContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ExportContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext"; + }; + + ExportContext.SqlCsvExportOptions = (function() { + + /** + * Properties of a SqlCsvExportOptions. + * @memberof google.cloud.sql.v1.ExportContext + * @interface ISqlCsvExportOptions + * @property {string|null} [selectQuery] SqlCsvExportOptions selectQuery + * @property {string|null} [escapeCharacter] SqlCsvExportOptions escapeCharacter + * @property {string|null} [quoteCharacter] SqlCsvExportOptions quoteCharacter + * @property {string|null} [fieldsTerminatedBy] SqlCsvExportOptions fieldsTerminatedBy + * @property {string|null} [linesTerminatedBy] SqlCsvExportOptions linesTerminatedBy + */ + + /** + * Constructs a new SqlCsvExportOptions. + * @memberof google.cloud.sql.v1.ExportContext + * @classdesc Represents a SqlCsvExportOptions. + * @implements ISqlCsvExportOptions + * @constructor + * @param {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions=} [properties] Properties to set + */ + function SqlCsvExportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlCsvExportOptions selectQuery. + * @member {string} selectQuery + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @instance + */ + SqlCsvExportOptions.prototype.selectQuery = ""; + + /** + * SqlCsvExportOptions escapeCharacter. + * @member {string} escapeCharacter + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @instance + */ + SqlCsvExportOptions.prototype.escapeCharacter = ""; + + /** + * SqlCsvExportOptions quoteCharacter. + * @member {string} quoteCharacter + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @instance + */ + SqlCsvExportOptions.prototype.quoteCharacter = ""; + + /** + * SqlCsvExportOptions fieldsTerminatedBy. + * @member {string} fieldsTerminatedBy + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @instance + */ + SqlCsvExportOptions.prototype.fieldsTerminatedBy = ""; + + /** + * SqlCsvExportOptions linesTerminatedBy. + * @member {string} linesTerminatedBy + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @instance + */ + SqlCsvExportOptions.prototype.linesTerminatedBy = ""; + + /** + * Creates a new SqlCsvExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions instance + */ + SqlCsvExportOptions.create = function create(properties) { + return new SqlCsvExportOptions(properties); + }; + + /** + * Encodes the specified SqlCsvExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions} message SqlCsvExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlCsvExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selectQuery != null && Object.hasOwnProperty.call(message, "selectQuery")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selectQuery); + if (message.escapeCharacter != null && Object.hasOwnProperty.call(message, "escapeCharacter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.escapeCharacter); + if (message.quoteCharacter != null && Object.hasOwnProperty.call(message, "quoteCharacter")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.quoteCharacter); + if (message.fieldsTerminatedBy != null && Object.hasOwnProperty.call(message, "fieldsTerminatedBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.fieldsTerminatedBy); + if (message.linesTerminatedBy != null && Object.hasOwnProperty.call(message, "linesTerminatedBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.linesTerminatedBy); + return writer; + }; + + /** + * Encodes the specified SqlCsvExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions} message SqlCsvExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlCsvExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlCsvExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlCsvExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.selectQuery = reader.string(); + break; + } + case 2: { + message.escapeCharacter = reader.string(); + break; + } + case 3: { + message.quoteCharacter = reader.string(); + break; + } + case 4: { + message.fieldsTerminatedBy = reader.string(); + break; + } + case 6: { + message.linesTerminatedBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlCsvExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlCsvExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlCsvExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlCsvExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.selectQuery != null && message.hasOwnProperty("selectQuery")) + if (!$util.isString(message.selectQuery)) + return "selectQuery: string expected"; + if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) + if (!$util.isString(message.escapeCharacter)) + return "escapeCharacter: string expected"; + if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) + if (!$util.isString(message.quoteCharacter)) + return "quoteCharacter: string expected"; + if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) + if (!$util.isString(message.fieldsTerminatedBy)) + return "fieldsTerminatedBy: string expected"; + if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) + if (!$util.isString(message.linesTerminatedBy)) + return "linesTerminatedBy: string expected"; + return null; + }; + + /** + * Creates a SqlCsvExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions + */ + SqlCsvExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions(); + if (object.selectQuery != null) + message.selectQuery = String(object.selectQuery); + if (object.escapeCharacter != null) + message.escapeCharacter = String(object.escapeCharacter); + if (object.quoteCharacter != null) + message.quoteCharacter = String(object.quoteCharacter); + if (object.fieldsTerminatedBy != null) + message.fieldsTerminatedBy = String(object.fieldsTerminatedBy); + if (object.linesTerminatedBy != null) + message.linesTerminatedBy = String(object.linesTerminatedBy); + return message; + }; + + /** + * Creates a plain object from a SqlCsvExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlCsvExportOptions} message SqlCsvExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlCsvExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.selectQuery = ""; + object.escapeCharacter = ""; + object.quoteCharacter = ""; + object.fieldsTerminatedBy = ""; + object.linesTerminatedBy = ""; + } + if (message.selectQuery != null && message.hasOwnProperty("selectQuery")) + object.selectQuery = message.selectQuery; + if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) + object.escapeCharacter = message.escapeCharacter; + if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) + object.quoteCharacter = message.quoteCharacter; + if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) + object.fieldsTerminatedBy = message.fieldsTerminatedBy; + if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) + object.linesTerminatedBy = message.linesTerminatedBy; + return object; + }; + + /** + * Converts this SqlCsvExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlCsvExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlCsvExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlCsvExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlCsvExportOptions"; + }; + + return SqlCsvExportOptions; + })(); + + ExportContext.SqlExportOptions = (function() { + + /** + * Properties of a SqlExportOptions. + * @memberof google.cloud.sql.v1.ExportContext + * @interface ISqlExportOptions + * @property {Array.|null} [tables] SqlExportOptions tables + * @property {google.protobuf.IBoolValue|null} [schemaOnly] SqlExportOptions schemaOnly + * @property {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions|null} [mysqlExportOptions] SqlExportOptions mysqlExportOptions + * @property {google.protobuf.IInt32Value|null} [threads] SqlExportOptions threads + * @property {google.protobuf.IBoolValue|null} [parallel] SqlExportOptions parallel + * @property {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions|null} [postgresExportOptions] SqlExportOptions postgresExportOptions + */ + + /** + * Constructs a new SqlExportOptions. + * @memberof google.cloud.sql.v1.ExportContext + * @classdesc Represents a SqlExportOptions. + * @implements ISqlExportOptions + * @constructor + * @param {google.cloud.sql.v1.ExportContext.ISqlExportOptions=} [properties] Properties to set + */ + function SqlExportOptions(properties) { + this.tables = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlExportOptions tables. + * @member {Array.} tables + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.tables = $util.emptyArray; + + /** + * SqlExportOptions schemaOnly. + * @member {google.protobuf.IBoolValue|null|undefined} schemaOnly + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.schemaOnly = null; + + /** + * SqlExportOptions mysqlExportOptions. + * @member {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions|null|undefined} mysqlExportOptions + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.mysqlExportOptions = null; + + /** + * SqlExportOptions threads. + * @member {google.protobuf.IInt32Value|null|undefined} threads + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.threads = null; + + /** + * SqlExportOptions parallel. + * @member {google.protobuf.IBoolValue|null|undefined} parallel + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.parallel = null; + + /** + * SqlExportOptions postgresExportOptions. + * @member {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions|null|undefined} postgresExportOptions + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.postgresExportOptions = null; + + /** + * Creates a new SqlExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions} SqlExportOptions instance + */ + SqlExportOptions.create = function create(properties) { + return new SqlExportOptions(properties); + }; + + /** + * Encodes the specified SqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlExportOptions} message SqlExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tables != null && message.tables.length) + for (var i = 0; i < message.tables.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.tables[i]); + if (message.schemaOnly != null && Object.hasOwnProperty.call(message, "schemaOnly")) + $root.google.protobuf.BoolValue.encode(message.schemaOnly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.mysqlExportOptions != null && Object.hasOwnProperty.call(message, "mysqlExportOptions")) + $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.encode(message.mysqlExportOptions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.threads != null && Object.hasOwnProperty.call(message, "threads")) + $root.google.protobuf.Int32Value.encode(message.threads, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.parallel != null && Object.hasOwnProperty.call(message, "parallel")) + $root.google.protobuf.BoolValue.encode(message.parallel, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.postgresExportOptions != null && Object.hasOwnProperty.call(message, "postgresExportOptions")) + $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.encode(message.postgresExportOptions, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlExportOptions} message SqlExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions} SqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.tables && message.tables.length)) + message.tables = []; + message.tables.push(reader.string()); + break; + } + case 2: { + message.schemaOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 3: { + message.mysqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + message.threads = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 5: { + message.parallel = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 6: { + message.postgresExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions} SqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tables != null && message.hasOwnProperty("tables")) { + if (!Array.isArray(message.tables)) + return "tables: array expected"; + for (var i = 0; i < message.tables.length; ++i) + if (!$util.isString(message.tables[i])) + return "tables: string[] expected"; + } + if (message.schemaOnly != null && message.hasOwnProperty("schemaOnly")) { + var error = $root.google.protobuf.BoolValue.verify(message.schemaOnly); + if (error) + return "schemaOnly." + error; + } + if (message.mysqlExportOptions != null && message.hasOwnProperty("mysqlExportOptions")) { + var error = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.verify(message.mysqlExportOptions); + if (error) + return "mysqlExportOptions." + error; + } + if (message.threads != null && message.hasOwnProperty("threads")) { + var error = $root.google.protobuf.Int32Value.verify(message.threads); + if (error) + return "threads." + error; + } + if (message.parallel != null && message.hasOwnProperty("parallel")) { + var error = $root.google.protobuf.BoolValue.verify(message.parallel); + if (error) + return "parallel." + error; + } + if (message.postgresExportOptions != null && message.hasOwnProperty("postgresExportOptions")) { + var error = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.verify(message.postgresExportOptions); + if (error) + return "postgresExportOptions." + error; + } + return null; + }; + + /** + * Creates a SqlExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions} SqlExportOptions + */ + SqlExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlExportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions(); + if (object.tables) { + if (!Array.isArray(object.tables)) + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.tables: array expected"); + message.tables = []; + for (var i = 0; i < object.tables.length; ++i) + message.tables[i] = String(object.tables[i]); + } + if (object.schemaOnly != null) { + if (typeof object.schemaOnly !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.schemaOnly: object expected"); + message.schemaOnly = $root.google.protobuf.BoolValue.fromObject(object.schemaOnly); + } + if (object.mysqlExportOptions != null) { + if (typeof object.mysqlExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.mysqlExportOptions: object expected"); + message.mysqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.fromObject(object.mysqlExportOptions); + } + if (object.threads != null) { + if (typeof object.threads !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.threads: object expected"); + message.threads = $root.google.protobuf.Int32Value.fromObject(object.threads); + } + if (object.parallel != null) { + if (typeof object.parallel !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.parallel: object expected"); + message.parallel = $root.google.protobuf.BoolValue.fromObject(object.parallel); + } + if (object.postgresExportOptions != null) { + if (typeof object.postgresExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.postgresExportOptions: object expected"); + message.postgresExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.fromObject(object.postgresExportOptions); + } + return message; + }; + + /** + * Creates a plain object from a SqlExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions} message SqlExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.tables = []; + if (options.defaults) { + object.schemaOnly = null; + object.mysqlExportOptions = null; + object.threads = null; + object.parallel = null; + object.postgresExportOptions = null; + } + if (message.tables && message.tables.length) { + object.tables = []; + for (var j = 0; j < message.tables.length; ++j) + object.tables[j] = message.tables[j]; + } + if (message.schemaOnly != null && message.hasOwnProperty("schemaOnly")) + object.schemaOnly = $root.google.protobuf.BoolValue.toObject(message.schemaOnly, options); + if (message.mysqlExportOptions != null && message.hasOwnProperty("mysqlExportOptions")) + object.mysqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.toObject(message.mysqlExportOptions, options); + if (message.threads != null && message.hasOwnProperty("threads")) + object.threads = $root.google.protobuf.Int32Value.toObject(message.threads, options); + if (message.parallel != null && message.hasOwnProperty("parallel")) + object.parallel = $root.google.protobuf.BoolValue.toObject(message.parallel, options); + if (message.postgresExportOptions != null && message.hasOwnProperty("postgresExportOptions")) + object.postgresExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.toObject(message.postgresExportOptions, options); + return object; + }; + + /** + * Converts this SqlExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlExportOptions"; + }; + + SqlExportOptions.MysqlExportOptions = (function() { + + /** + * Properties of a MysqlExportOptions. + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @interface IMysqlExportOptions + * @property {google.protobuf.IInt32Value|null} [masterData] MysqlExportOptions masterData + */ + + /** + * Constructs a new MysqlExportOptions. + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @classdesc Represents a MysqlExportOptions. + * @implements IMysqlExportOptions + * @constructor + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions=} [properties] Properties to set + */ + function MysqlExportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MysqlExportOptions masterData. + * @member {google.protobuf.IInt32Value|null|undefined} masterData + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @instance + */ + MysqlExportOptions.prototype.masterData = null; + + /** + * Creates a new MysqlExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions instance + */ + MysqlExportOptions.create = function create(properties) { + return new MysqlExportOptions(properties); + }; + + /** + * Encodes the specified MysqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions} message MysqlExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MysqlExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.masterData != null && Object.hasOwnProperty.call(message, "masterData")) + $root.google.protobuf.Int32Value.encode(message.masterData, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MysqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions} message MysqlExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MysqlExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MysqlExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MysqlExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.masterData = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MysqlExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MysqlExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MysqlExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MysqlExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.masterData != null && message.hasOwnProperty("masterData")) { + var error = $root.google.protobuf.Int32Value.verify(message.masterData); + if (error) + return "masterData." + error; + } + return null; + }; + + /** + * Creates a MysqlExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions + */ + MysqlExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions(); + if (object.masterData != null) { + if (typeof object.masterData !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.masterData: object expected"); + message.masterData = $root.google.protobuf.Int32Value.fromObject(object.masterData); + } + return message; + }; + + /** + * Creates a plain object from a MysqlExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions} message MysqlExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MysqlExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.masterData = null; + if (message.masterData != null && message.hasOwnProperty("masterData")) + object.masterData = $root.google.protobuf.Int32Value.toObject(message.masterData, options); + return object; + }; + + /** + * Converts this MysqlExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @instance + * @returns {Object.} JSON object + */ + MysqlExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MysqlExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MysqlExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions"; + }; + + return MysqlExportOptions; + })(); + + SqlExportOptions.PostgresExportOptions = (function() { + + /** + * Properties of a PostgresExportOptions. + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @interface IPostgresExportOptions + * @property {google.protobuf.IBoolValue|null} [clean] PostgresExportOptions clean + * @property {google.protobuf.IBoolValue|null} [ifExists] PostgresExportOptions ifExists + */ + + /** + * Constructs a new PostgresExportOptions. + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions + * @classdesc Represents a PostgresExportOptions. + * @implements IPostgresExportOptions + * @constructor + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions=} [properties] Properties to set + */ + function PostgresExportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PostgresExportOptions clean. + * @member {google.protobuf.IBoolValue|null|undefined} clean + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @instance + */ + PostgresExportOptions.prototype.clean = null; + + /** + * PostgresExportOptions ifExists. + * @member {google.protobuf.IBoolValue|null|undefined} ifExists + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @instance + */ + PostgresExportOptions.prototype.ifExists = null; + + /** + * Creates a new PostgresExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions instance + */ + PostgresExportOptions.create = function create(properties) { + return new PostgresExportOptions(properties); + }; + + /** + * Encodes the specified PostgresExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions} message PostgresExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PostgresExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.clean != null && Object.hasOwnProperty.call(message, "clean")) + $root.google.protobuf.BoolValue.encode(message.clean, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.ifExists != null && Object.hasOwnProperty.call(message, "ifExists")) + $root.google.protobuf.BoolValue.encode(message.ifExists, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PostgresExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions} message PostgresExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PostgresExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PostgresExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PostgresExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.clean = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 2: { + message.ifExists = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PostgresExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PostgresExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PostgresExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PostgresExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.clean != null && message.hasOwnProperty("clean")) { + var error = $root.google.protobuf.BoolValue.verify(message.clean); + if (error) + return "clean." + error; + } + if (message.ifExists != null && message.hasOwnProperty("ifExists")) { + var error = $root.google.protobuf.BoolValue.verify(message.ifExists); + if (error) + return "ifExists." + error; + } + return null; + }; + + /** + * Creates a PostgresExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions + */ + PostgresExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions(); + if (object.clean != null) { + if (typeof object.clean !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.clean: object expected"); + message.clean = $root.google.protobuf.BoolValue.fromObject(object.clean); + } + if (object.ifExists != null) { + if (typeof object.ifExists !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.ifExists: object expected"); + message.ifExists = $root.google.protobuf.BoolValue.fromObject(object.ifExists); + } + return message; + }; + + /** + * Creates a plain object from a PostgresExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions} message PostgresExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PostgresExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.clean = null; + object.ifExists = null; + } + if (message.clean != null && message.hasOwnProperty("clean")) + object.clean = $root.google.protobuf.BoolValue.toObject(message.clean, options); + if (message.ifExists != null && message.hasOwnProperty("ifExists")) + object.ifExists = $root.google.protobuf.BoolValue.toObject(message.ifExists, options); + return object; + }; + + /** + * Converts this PostgresExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @instance + * @returns {Object.} JSON object + */ + PostgresExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PostgresExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PostgresExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions"; + }; + + return PostgresExportOptions; + })(); + + return SqlExportOptions; + })(); + + ExportContext.SqlBakExportOptions = (function() { + + /** + * Properties of a SqlBakExportOptions. + * @memberof google.cloud.sql.v1.ExportContext + * @interface ISqlBakExportOptions + * @property {google.protobuf.IBoolValue|null} [striped] SqlBakExportOptions striped + * @property {google.protobuf.IInt32Value|null} [stripeCount] SqlBakExportOptions stripeCount + * @property {google.cloud.sql.v1.BakType|null} [bakType] SqlBakExportOptions bakType + * @property {google.protobuf.IBoolValue|null} [copyOnly] SqlBakExportOptions copyOnly + * @property {google.protobuf.IBoolValue|null} [differentialBase] SqlBakExportOptions differentialBase + * @property {google.protobuf.ITimestamp|null} [exportLogStartTime] SqlBakExportOptions exportLogStartTime + * @property {google.protobuf.ITimestamp|null} [exportLogEndTime] SqlBakExportOptions exportLogEndTime + */ + + /** + * Constructs a new SqlBakExportOptions. + * @memberof google.cloud.sql.v1.ExportContext + * @classdesc Represents a SqlBakExportOptions. + * @implements ISqlBakExportOptions + * @constructor + * @param {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions=} [properties] Properties to set + */ + function SqlBakExportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBakExportOptions striped. + * @member {google.protobuf.IBoolValue|null|undefined} striped + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.striped = null; + + /** + * SqlBakExportOptions stripeCount. + * @member {google.protobuf.IInt32Value|null|undefined} stripeCount + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.stripeCount = null; + + /** + * SqlBakExportOptions bakType. + * @member {google.cloud.sql.v1.BakType} bakType + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.bakType = 0; + + /** + * SqlBakExportOptions copyOnly. + * @member {google.protobuf.IBoolValue|null|undefined} copyOnly + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.copyOnly = null; + + /** + * SqlBakExportOptions differentialBase. + * @member {google.protobuf.IBoolValue|null|undefined} differentialBase + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.differentialBase = null; + + /** + * SqlBakExportOptions exportLogStartTime. + * @member {google.protobuf.ITimestamp|null|undefined} exportLogStartTime + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.exportLogStartTime = null; + + /** + * SqlBakExportOptions exportLogEndTime. + * @member {google.protobuf.ITimestamp|null|undefined} exportLogEndTime + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.exportLogEndTime = null; + + /** + * Creates a new SqlBakExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ExportContext.SqlBakExportOptions} SqlBakExportOptions instance + */ + SqlBakExportOptions.create = function create(properties) { + return new SqlBakExportOptions(properties); + }; + + /** + * Encodes the specified SqlBakExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlBakExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions} message SqlBakExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBakExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.striped != null && Object.hasOwnProperty.call(message, "striped")) + $root.google.protobuf.BoolValue.encode(message.striped, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.stripeCount != null && Object.hasOwnProperty.call(message, "stripeCount")) + $root.google.protobuf.Int32Value.encode(message.stripeCount, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bakType != null && Object.hasOwnProperty.call(message, "bakType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.bakType); + if (message.copyOnly != null && Object.hasOwnProperty.call(message, "copyOnly")) + $root.google.protobuf.BoolValue.encode(message.copyOnly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.differentialBase != null && Object.hasOwnProperty.call(message, "differentialBase")) + $root.google.protobuf.BoolValue.encode(message.differentialBase, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.exportLogStartTime != null && Object.hasOwnProperty.call(message, "exportLogStartTime")) + $root.google.protobuf.Timestamp.encode(message.exportLogStartTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.exportLogEndTime != null && Object.hasOwnProperty.call(message, "exportLogEndTime")) + $root.google.protobuf.Timestamp.encode(message.exportLogEndTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlBakExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlBakExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions} message SqlBakExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBakExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBakExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ExportContext.SqlBakExportOptions} SqlBakExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBakExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.striped = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 2: { + message.stripeCount = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 4: { + message.bakType = reader.int32(); + break; + } + case 5: { + message.copyOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 6: { + message.differentialBase = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 7: { + message.exportLogStartTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.exportLogEndTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBakExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ExportContext.SqlBakExportOptions} SqlBakExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBakExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBakExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBakExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.striped != null && message.hasOwnProperty("striped")) { + var error = $root.google.protobuf.BoolValue.verify(message.striped); + if (error) + return "striped." + error; + } + if (message.stripeCount != null && message.hasOwnProperty("stripeCount")) { + var error = $root.google.protobuf.Int32Value.verify(message.stripeCount); + if (error) + return "stripeCount." + error; + } + if (message.bakType != null && message.hasOwnProperty("bakType")) + switch (message.bakType) { + default: + return "bakType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.copyOnly != null && message.hasOwnProperty("copyOnly")) { + var error = $root.google.protobuf.BoolValue.verify(message.copyOnly); + if (error) + return "copyOnly." + error; + } + if (message.differentialBase != null && message.hasOwnProperty("differentialBase")) { + var error = $root.google.protobuf.BoolValue.verify(message.differentialBase); + if (error) + return "differentialBase." + error; + } + if (message.exportLogStartTime != null && message.hasOwnProperty("exportLogStartTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.exportLogStartTime); + if (error) + return "exportLogStartTime." + error; + } + if (message.exportLogEndTime != null && message.hasOwnProperty("exportLogEndTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.exportLogEndTime); + if (error) + return "exportLogEndTime." + error; + } + return null; + }; + + /** + * Creates a SqlBakExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ExportContext.SqlBakExportOptions} SqlBakExportOptions + */ + SqlBakExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions(); + if (object.striped != null) { + if (typeof object.striped !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.striped: object expected"); + message.striped = $root.google.protobuf.BoolValue.fromObject(object.striped); + } + if (object.stripeCount != null) { + if (typeof object.stripeCount !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.stripeCount: object expected"); + message.stripeCount = $root.google.protobuf.Int32Value.fromObject(object.stripeCount); + } + switch (object.bakType) { + default: + if (typeof object.bakType === "number") { + message.bakType = object.bakType; + break; + } + break; + case "BAK_TYPE_UNSPECIFIED": + case 0: + message.bakType = 0; + break; + case "FULL": + case 1: + message.bakType = 1; + break; + case "DIFF": + case 2: + message.bakType = 2; + break; + case "TLOG": + case 3: + message.bakType = 3; + break; + } + if (object.copyOnly != null) { + if (typeof object.copyOnly !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.copyOnly: object expected"); + message.copyOnly = $root.google.protobuf.BoolValue.fromObject(object.copyOnly); + } + if (object.differentialBase != null) { + if (typeof object.differentialBase !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.differentialBase: object expected"); + message.differentialBase = $root.google.protobuf.BoolValue.fromObject(object.differentialBase); + } + if (object.exportLogStartTime != null) { + if (typeof object.exportLogStartTime !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.exportLogStartTime: object expected"); + message.exportLogStartTime = $root.google.protobuf.Timestamp.fromObject(object.exportLogStartTime); + } + if (object.exportLogEndTime != null) { + if (typeof object.exportLogEndTime !== "object") + throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.exportLogEndTime: object expected"); + message.exportLogEndTime = $root.google.protobuf.Timestamp.fromObject(object.exportLogEndTime); + } + return message; + }; + + /** + * Creates a plain object from a SqlBakExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlBakExportOptions} message SqlBakExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBakExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.striped = null; + object.stripeCount = null; + object.bakType = options.enums === String ? "BAK_TYPE_UNSPECIFIED" : 0; + object.copyOnly = null; + object.differentialBase = null; + object.exportLogStartTime = null; + object.exportLogEndTime = null; + } + if (message.striped != null && message.hasOwnProperty("striped")) + object.striped = $root.google.protobuf.BoolValue.toObject(message.striped, options); + if (message.stripeCount != null && message.hasOwnProperty("stripeCount")) + object.stripeCount = $root.google.protobuf.Int32Value.toObject(message.stripeCount, options); + if (message.bakType != null && message.hasOwnProperty("bakType")) + object.bakType = options.enums === String ? $root.google.cloud.sql.v1.BakType[message.bakType] === undefined ? message.bakType : $root.google.cloud.sql.v1.BakType[message.bakType] : message.bakType; + if (message.copyOnly != null && message.hasOwnProperty("copyOnly")) + object.copyOnly = $root.google.protobuf.BoolValue.toObject(message.copyOnly, options); + if (message.differentialBase != null && message.hasOwnProperty("differentialBase")) + object.differentialBase = $root.google.protobuf.BoolValue.toObject(message.differentialBase, options); + if (message.exportLogStartTime != null && message.hasOwnProperty("exportLogStartTime")) + object.exportLogStartTime = $root.google.protobuf.Timestamp.toObject(message.exportLogStartTime, options); + if (message.exportLogEndTime != null && message.hasOwnProperty("exportLogEndTime")) + object.exportLogEndTime = $root.google.protobuf.Timestamp.toObject(message.exportLogEndTime, options); + return object; + }; + + /** + * Converts this SqlBakExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlBakExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBakExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBakExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlBakExportOptions"; + }; + + return SqlBakExportOptions; + })(); + + ExportContext.SqlTdeExportOptions = (function() { + + /** + * Properties of a SqlTdeExportOptions. + * @memberof google.cloud.sql.v1.ExportContext + * @interface ISqlTdeExportOptions + * @property {string|null} [certificatePath] SqlTdeExportOptions certificatePath + * @property {string|null} [privateKeyPath] SqlTdeExportOptions privateKeyPath + * @property {string|null} [privateKeyPassword] SqlTdeExportOptions privateKeyPassword + * @property {string|null} [name] SqlTdeExportOptions name + */ + + /** + * Constructs a new SqlTdeExportOptions. + * @memberof google.cloud.sql.v1.ExportContext + * @classdesc Represents a SqlTdeExportOptions. + * @implements ISqlTdeExportOptions + * @constructor + * @param {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions=} [properties] Properties to set + */ + function SqlTdeExportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlTdeExportOptions certificatePath. + * @member {string} certificatePath + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @instance + */ + SqlTdeExportOptions.prototype.certificatePath = ""; + + /** + * SqlTdeExportOptions privateKeyPath. + * @member {string} privateKeyPath + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @instance + */ + SqlTdeExportOptions.prototype.privateKeyPath = ""; + + /** + * SqlTdeExportOptions privateKeyPassword. + * @member {string} privateKeyPassword + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @instance + */ + SqlTdeExportOptions.prototype.privateKeyPassword = ""; + + /** + * SqlTdeExportOptions name. + * @member {string} name + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @instance + */ + SqlTdeExportOptions.prototype.name = ""; + + /** + * Creates a new SqlTdeExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions instance + */ + SqlTdeExportOptions.create = function create(properties) { + return new SqlTdeExportOptions(properties); + }; + + /** + * Encodes the specified SqlTdeExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions} message SqlTdeExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTdeExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certificatePath != null && Object.hasOwnProperty.call(message, "certificatePath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.certificatePath); + if (message.privateKeyPath != null && Object.hasOwnProperty.call(message, "privateKeyPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateKeyPath); + if (message.privateKeyPassword != null && Object.hasOwnProperty.call(message, "privateKeyPassword")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.privateKeyPassword); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + return writer; + }; + + /** + * Encodes the specified SqlTdeExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions} message SqlTdeExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTdeExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlTdeExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTdeExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.certificatePath = reader.string(); + break; + } + case 2: { + message.privateKeyPath = reader.string(); + break; + } + case 3: { + message.privateKeyPassword = reader.string(); + break; + } + case 5: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlTdeExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTdeExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlTdeExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlTdeExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) + if (!$util.isString(message.certificatePath)) + return "certificatePath: string expected"; + if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) + if (!$util.isString(message.privateKeyPath)) + return "privateKeyPath: string expected"; + if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) + if (!$util.isString(message.privateKeyPassword)) + return "privateKeyPassword: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a SqlTdeExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions + */ + SqlTdeExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions(); + if (object.certificatePath != null) + message.certificatePath = String(object.certificatePath); + if (object.privateKeyPath != null) + message.privateKeyPath = String(object.privateKeyPath); + if (object.privateKeyPassword != null) + message.privateKeyPassword = String(object.privateKeyPassword); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a SqlTdeExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @static + * @param {google.cloud.sql.v1.ExportContext.SqlTdeExportOptions} message SqlTdeExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlTdeExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.certificatePath = ""; + object.privateKeyPath = ""; + object.privateKeyPassword = ""; + object.name = ""; + } + if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) + object.certificatePath = message.certificatePath; + if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) + object.privateKeyPath = message.privateKeyPath; + if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) + object.privateKeyPassword = message.privateKeyPassword; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this SqlTdeExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlTdeExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlTdeExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlTdeExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlTdeExportOptions"; + }; + + return SqlTdeExportOptions; + })(); + + return ExportContext; + })(); + + v1.ImportContext = (function() { + + /** + * Properties of an ImportContext. + * @memberof google.cloud.sql.v1 + * @interface IImportContext + * @property {string|null} [uri] ImportContext uri + * @property {string|null} [database] ImportContext database + * @property {string|null} [kind] ImportContext kind + * @property {google.cloud.sql.v1.SqlFileType|null} [fileType] ImportContext fileType + * @property {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions|null} [csvImportOptions] ImportContext csvImportOptions + * @property {string|null} [importUser] ImportContext importUser + * @property {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions|null} [bakImportOptions] ImportContext bakImportOptions + * @property {google.cloud.sql.v1.ImportContext.ISqlImportOptions|null} [sqlImportOptions] ImportContext sqlImportOptions + * @property {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions|null} [tdeImportOptions] ImportContext tdeImportOptions + */ + + /** + * Constructs a new ImportContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an ImportContext. + * @implements IImportContext + * @constructor + * @param {google.cloud.sql.v1.IImportContext=} [properties] Properties to set + */ + function ImportContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportContext uri. + * @member {string} uri + * @memberof google.cloud.sql.v1.ImportContext + * @instance + */ + ImportContext.prototype.uri = ""; + + /** + * ImportContext database. + * @member {string} database + * @memberof google.cloud.sql.v1.ImportContext + * @instance + */ + ImportContext.prototype.database = ""; + + /** + * ImportContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.ImportContext + * @instance + */ + ImportContext.prototype.kind = ""; + + /** + * ImportContext fileType. + * @member {google.cloud.sql.v1.SqlFileType} fileType + * @memberof google.cloud.sql.v1.ImportContext + * @instance + */ + ImportContext.prototype.fileType = 0; + + /** + * ImportContext csvImportOptions. + * @member {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions|null|undefined} csvImportOptions + * @memberof google.cloud.sql.v1.ImportContext + * @instance + */ + ImportContext.prototype.csvImportOptions = null; + + /** + * ImportContext importUser. + * @member {string} importUser + * @memberof google.cloud.sql.v1.ImportContext + * @instance + */ + ImportContext.prototype.importUser = ""; + + /** + * ImportContext bakImportOptions. + * @member {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions|null|undefined} bakImportOptions + * @memberof google.cloud.sql.v1.ImportContext + * @instance + */ + ImportContext.prototype.bakImportOptions = null; + + /** + * ImportContext sqlImportOptions. + * @member {google.cloud.sql.v1.ImportContext.ISqlImportOptions|null|undefined} sqlImportOptions + * @memberof google.cloud.sql.v1.ImportContext + * @instance + */ + ImportContext.prototype.sqlImportOptions = null; + + /** + * ImportContext tdeImportOptions. + * @member {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions|null|undefined} tdeImportOptions + * @memberof google.cloud.sql.v1.ImportContext + * @instance + */ + ImportContext.prototype.tdeImportOptions = null; + + /** + * Creates a new ImportContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ImportContext + * @static + * @param {google.cloud.sql.v1.IImportContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ImportContext} ImportContext instance + */ + ImportContext.create = function create(properties) { + return new ImportContext(properties); + }; + + /** + * Encodes the specified ImportContext message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ImportContext + * @static + * @param {google.cloud.sql.v1.IImportContext} message ImportContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.database); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + if (message.fileType != null && Object.hasOwnProperty.call(message, "fileType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.fileType); + if (message.csvImportOptions != null && Object.hasOwnProperty.call(message, "csvImportOptions")) + $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.encode(message.csvImportOptions, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.importUser != null && Object.hasOwnProperty.call(message, "importUser")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.importUser); + if (message.bakImportOptions != null && Object.hasOwnProperty.call(message, "bakImportOptions")) + $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.encode(message.bakImportOptions, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.sqlImportOptions != null && Object.hasOwnProperty.call(message, "sqlImportOptions")) + $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.encode(message.sqlImportOptions, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.tdeImportOptions != null && Object.hasOwnProperty.call(message, "tdeImportOptions")) + $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.encode(message.tdeImportOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ImportContext + * @static + * @param {google.cloud.sql.v1.IImportContext} message ImportContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ImportContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ImportContext} ImportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.database = reader.string(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + case 4: { + message.fileType = reader.int32(); + break; + } + case 5: { + message.csvImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.decode(reader, reader.uint32()); + break; + } + case 6: { + message.importUser = reader.string(); + break; + } + case 7: { + message.bakImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.decode(reader, reader.uint32()); + break; + } + case 8: { + message.sqlImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.tdeImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ImportContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ImportContext} ImportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportContext message. + * @function verify + * @memberof google.cloud.sql.v1.ImportContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.fileType != null && message.hasOwnProperty("fileType")) + switch (message.fileType) { + default: + return "fileType: enum value expected"; + case 0: + case 1: + case 2: + case 4: + case 8: + break; + } + if (message.csvImportOptions != null && message.hasOwnProperty("csvImportOptions")) { + var error = $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.verify(message.csvImportOptions); + if (error) + return "csvImportOptions." + error; + } + if (message.importUser != null && message.hasOwnProperty("importUser")) + if (!$util.isString(message.importUser)) + return "importUser: string expected"; + if (message.bakImportOptions != null && message.hasOwnProperty("bakImportOptions")) { + var error = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.verify(message.bakImportOptions); + if (error) + return "bakImportOptions." + error; + } + if (message.sqlImportOptions != null && message.hasOwnProperty("sqlImportOptions")) { + var error = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.verify(message.sqlImportOptions); + if (error) + return "sqlImportOptions." + error; + } + if (message.tdeImportOptions != null && message.hasOwnProperty("tdeImportOptions")) { + var error = $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.verify(message.tdeImportOptions); + if (error) + return "tdeImportOptions." + error; + } + return null; + }; + + /** + * Creates an ImportContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ImportContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ImportContext} ImportContext + */ + ImportContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ImportContext) + return object; + var message = new $root.google.cloud.sql.v1.ImportContext(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.database != null) + message.database = String(object.database); + if (object.kind != null) + message.kind = String(object.kind); + switch (object.fileType) { + default: + if (typeof object.fileType === "number") { + message.fileType = object.fileType; + break; + } + break; + case "SQL_FILE_TYPE_UNSPECIFIED": + case 0: + message.fileType = 0; + break; + case "SQL": + case 1: + message.fileType = 1; + break; + case "CSV": + case 2: + message.fileType = 2; + break; + case "BAK": + case 4: + message.fileType = 4; + break; + case "TDE": + case 8: + message.fileType = 8; + break; + } + if (object.csvImportOptions != null) { + if (typeof object.csvImportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.csvImportOptions: object expected"); + message.csvImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.fromObject(object.csvImportOptions); + } + if (object.importUser != null) + message.importUser = String(object.importUser); + if (object.bakImportOptions != null) { + if (typeof object.bakImportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.bakImportOptions: object expected"); + message.bakImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.fromObject(object.bakImportOptions); + } + if (object.sqlImportOptions != null) { + if (typeof object.sqlImportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.sqlImportOptions: object expected"); + message.sqlImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.fromObject(object.sqlImportOptions); + } + if (object.tdeImportOptions != null) { + if (typeof object.tdeImportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.tdeImportOptions: object expected"); + message.tdeImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.fromObject(object.tdeImportOptions); + } + return message; + }; + + /** + * Creates a plain object from an ImportContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ImportContext + * @static + * @param {google.cloud.sql.v1.ImportContext} message ImportContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uri = ""; + object.database = ""; + object.kind = ""; + object.fileType = options.enums === String ? "SQL_FILE_TYPE_UNSPECIFIED" : 0; + object.csvImportOptions = null; + object.importUser = ""; + object.bakImportOptions = null; + object.sqlImportOptions = null; + object.tdeImportOptions = null; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.fileType != null && message.hasOwnProperty("fileType")) + object.fileType = options.enums === String ? $root.google.cloud.sql.v1.SqlFileType[message.fileType] === undefined ? message.fileType : $root.google.cloud.sql.v1.SqlFileType[message.fileType] : message.fileType; + if (message.csvImportOptions != null && message.hasOwnProperty("csvImportOptions")) + object.csvImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.toObject(message.csvImportOptions, options); + if (message.importUser != null && message.hasOwnProperty("importUser")) + object.importUser = message.importUser; + if (message.bakImportOptions != null && message.hasOwnProperty("bakImportOptions")) + object.bakImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.toObject(message.bakImportOptions, options); + if (message.sqlImportOptions != null && message.hasOwnProperty("sqlImportOptions")) + object.sqlImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.toObject(message.sqlImportOptions, options); + if (message.tdeImportOptions != null && message.hasOwnProperty("tdeImportOptions")) + object.tdeImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.toObject(message.tdeImportOptions, options); + return object; + }; + + /** + * Converts this ImportContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ImportContext + * @instance + * @returns {Object.} JSON object + */ + ImportContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ImportContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext"; + }; + + ImportContext.SqlImportOptions = (function() { + + /** + * Properties of a SqlImportOptions. + * @memberof google.cloud.sql.v1.ImportContext + * @interface ISqlImportOptions + * @property {google.protobuf.IInt32Value|null} [threads] SqlImportOptions threads + * @property {google.protobuf.IBoolValue|null} [parallel] SqlImportOptions parallel + * @property {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions|null} [postgresImportOptions] SqlImportOptions postgresImportOptions + */ + + /** + * Constructs a new SqlImportOptions. + * @memberof google.cloud.sql.v1.ImportContext + * @classdesc Represents a SqlImportOptions. + * @implements ISqlImportOptions + * @constructor + * @param {google.cloud.sql.v1.ImportContext.ISqlImportOptions=} [properties] Properties to set + */ + function SqlImportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlImportOptions threads. + * @member {google.protobuf.IInt32Value|null|undefined} threads + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @instance + */ + SqlImportOptions.prototype.threads = null; + + /** + * SqlImportOptions parallel. + * @member {google.protobuf.IBoolValue|null|undefined} parallel + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @instance + */ + SqlImportOptions.prototype.parallel = null; + + /** + * SqlImportOptions postgresImportOptions. + * @member {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions|null|undefined} postgresImportOptions + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @instance + */ + SqlImportOptions.prototype.postgresImportOptions = null; + + /** + * Creates a new SqlImportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlImportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions} SqlImportOptions instance + */ + SqlImportOptions.create = function create(properties) { + return new SqlImportOptions(properties); + }; + + /** + * Encodes the specified SqlImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlImportOptions} message SqlImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlImportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.threads != null && Object.hasOwnProperty.call(message, "threads")) + $root.google.protobuf.Int32Value.encode(message.threads, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parallel != null && Object.hasOwnProperty.call(message, "parallel")) + $root.google.protobuf.BoolValue.encode(message.parallel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.postgresImportOptions != null && Object.hasOwnProperty.call(message, "postgresImportOptions")) + $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.encode(message.postgresImportOptions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlImportOptions} message SqlImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlImportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlImportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions} SqlImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlImportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlImportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.threads = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 2: { + message.parallel = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 3: { + message.postgresImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlImportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions} SqlImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlImportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlImportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlImportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.threads != null && message.hasOwnProperty("threads")) { + var error = $root.google.protobuf.Int32Value.verify(message.threads); + if (error) + return "threads." + error; + } + if (message.parallel != null && message.hasOwnProperty("parallel")) { + var error = $root.google.protobuf.BoolValue.verify(message.parallel); + if (error) + return "parallel." + error; + } + if (message.postgresImportOptions != null && message.hasOwnProperty("postgresImportOptions")) { + var error = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.verify(message.postgresImportOptions); + if (error) + return "postgresImportOptions." + error; + } + return null; + }; + + /** + * Creates a SqlImportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions} SqlImportOptions + */ + SqlImportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlImportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ImportContext.SqlImportOptions(); + if (object.threads != null) { + if (typeof object.threads !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlImportOptions.threads: object expected"); + message.threads = $root.google.protobuf.Int32Value.fromObject(object.threads); + } + if (object.parallel != null) { + if (typeof object.parallel !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlImportOptions.parallel: object expected"); + message.parallel = $root.google.protobuf.BoolValue.fromObject(object.parallel); + } + if (object.postgresImportOptions != null) { + if (typeof object.postgresImportOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlImportOptions.postgresImportOptions: object expected"); + message.postgresImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.fromObject(object.postgresImportOptions); + } + return message; + }; + + /** + * Creates a plain object from a SqlImportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions} message SqlImportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlImportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.threads = null; + object.parallel = null; + object.postgresImportOptions = null; + } + if (message.threads != null && message.hasOwnProperty("threads")) + object.threads = $root.google.protobuf.Int32Value.toObject(message.threads, options); + if (message.parallel != null && message.hasOwnProperty("parallel")) + object.parallel = $root.google.protobuf.BoolValue.toObject(message.parallel, options); + if (message.postgresImportOptions != null && message.hasOwnProperty("postgresImportOptions")) + object.postgresImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.toObject(message.postgresImportOptions, options); + return object; + }; + + /** + * Converts this SqlImportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlImportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlImportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlImportOptions"; + }; + + SqlImportOptions.PostgresImportOptions = (function() { + + /** + * Properties of a PostgresImportOptions. + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @interface IPostgresImportOptions + * @property {google.protobuf.IBoolValue|null} [clean] PostgresImportOptions clean + * @property {google.protobuf.IBoolValue|null} [ifExists] PostgresImportOptions ifExists + */ + + /** + * Constructs a new PostgresImportOptions. + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions + * @classdesc Represents a PostgresImportOptions. + * @implements IPostgresImportOptions + * @constructor + * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions=} [properties] Properties to set + */ + function PostgresImportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PostgresImportOptions clean. + * @member {google.protobuf.IBoolValue|null|undefined} clean + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @instance + */ + PostgresImportOptions.prototype.clean = null; + + /** + * PostgresImportOptions ifExists. + * @member {google.protobuf.IBoolValue|null|undefined} ifExists + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @instance + */ + PostgresImportOptions.prototype.ifExists = null; + + /** + * Creates a new PostgresImportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions instance + */ + PostgresImportOptions.create = function create(properties) { + return new PostgresImportOptions(properties); + }; + + /** + * Encodes the specified PostgresImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions} message PostgresImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PostgresImportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.clean != null && Object.hasOwnProperty.call(message, "clean")) + $root.google.protobuf.BoolValue.encode(message.clean, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.ifExists != null && Object.hasOwnProperty.call(message, "ifExists")) + $root.google.protobuf.BoolValue.encode(message.ifExists, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PostgresImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions} message PostgresImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PostgresImportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PostgresImportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PostgresImportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.clean = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 2: { + message.ifExists = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PostgresImportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PostgresImportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PostgresImportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PostgresImportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.clean != null && message.hasOwnProperty("clean")) { + var error = $root.google.protobuf.BoolValue.verify(message.clean); + if (error) + return "clean." + error; + } + if (message.ifExists != null && message.hasOwnProperty("ifExists")) { + var error = $root.google.protobuf.BoolValue.verify(message.ifExists); + if (error) + return "ifExists." + error; + } + return null; + }; + + /** + * Creates a PostgresImportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions + */ + PostgresImportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions(); + if (object.clean != null) { + if (typeof object.clean !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.clean: object expected"); + message.clean = $root.google.protobuf.BoolValue.fromObject(object.clean); + } + if (object.ifExists != null) { + if (typeof object.ifExists !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.ifExists: object expected"); + message.ifExists = $root.google.protobuf.BoolValue.fromObject(object.ifExists); + } + return message; + }; + + /** + * Creates a plain object from a PostgresImportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions} message PostgresImportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PostgresImportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.clean = null; + object.ifExists = null; + } + if (message.clean != null && message.hasOwnProperty("clean")) + object.clean = $root.google.protobuf.BoolValue.toObject(message.clean, options); + if (message.ifExists != null && message.hasOwnProperty("ifExists")) + object.ifExists = $root.google.protobuf.BoolValue.toObject(message.ifExists, options); + return object; + }; + + /** + * Converts this PostgresImportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @instance + * @returns {Object.} JSON object + */ + PostgresImportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PostgresImportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PostgresImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions"; + }; + + return PostgresImportOptions; + })(); + + return SqlImportOptions; + })(); + + ImportContext.SqlCsvImportOptions = (function() { + + /** + * Properties of a SqlCsvImportOptions. + * @memberof google.cloud.sql.v1.ImportContext + * @interface ISqlCsvImportOptions + * @property {string|null} [table] SqlCsvImportOptions table + * @property {Array.|null} [columns] SqlCsvImportOptions columns + * @property {string|null} [escapeCharacter] SqlCsvImportOptions escapeCharacter + * @property {string|null} [quoteCharacter] SqlCsvImportOptions quoteCharacter + * @property {string|null} [fieldsTerminatedBy] SqlCsvImportOptions fieldsTerminatedBy + * @property {string|null} [linesTerminatedBy] SqlCsvImportOptions linesTerminatedBy + */ + + /** + * Constructs a new SqlCsvImportOptions. + * @memberof google.cloud.sql.v1.ImportContext + * @classdesc Represents a SqlCsvImportOptions. + * @implements ISqlCsvImportOptions + * @constructor + * @param {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions=} [properties] Properties to set + */ + function SqlCsvImportOptions(properties) { + this.columns = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlCsvImportOptions table. + * @member {string} table + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.table = ""; + + /** + * SqlCsvImportOptions columns. + * @member {Array.} columns + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.columns = $util.emptyArray; + + /** + * SqlCsvImportOptions escapeCharacter. + * @member {string} escapeCharacter + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.escapeCharacter = ""; + + /** + * SqlCsvImportOptions quoteCharacter. + * @member {string} quoteCharacter + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.quoteCharacter = ""; + + /** + * SqlCsvImportOptions fieldsTerminatedBy. + * @member {string} fieldsTerminatedBy + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.fieldsTerminatedBy = ""; + + /** + * SqlCsvImportOptions linesTerminatedBy. + * @member {string} linesTerminatedBy + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.linesTerminatedBy = ""; + + /** + * Creates a new SqlCsvImportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions instance + */ + SqlCsvImportOptions.create = function create(properties) { + return new SqlCsvImportOptions(properties); + }; + + /** + * Encodes the specified SqlCsvImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions} message SqlCsvImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlCsvImportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.table != null && Object.hasOwnProperty.call(message, "table")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.table); + if (message.columns != null && message.columns.length) + for (var i = 0; i < message.columns.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.columns[i]); + if (message.escapeCharacter != null && Object.hasOwnProperty.call(message, "escapeCharacter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.escapeCharacter); + if (message.quoteCharacter != null && Object.hasOwnProperty.call(message, "quoteCharacter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.quoteCharacter); + if (message.fieldsTerminatedBy != null && Object.hasOwnProperty.call(message, "fieldsTerminatedBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.fieldsTerminatedBy); + if (message.linesTerminatedBy != null && Object.hasOwnProperty.call(message, "linesTerminatedBy")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.linesTerminatedBy); + return writer; + }; + + /** + * Encodes the specified SqlCsvImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions} message SqlCsvImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlCsvImportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlCsvImportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlCsvImportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.table = reader.string(); + break; + } + case 2: { + if (!(message.columns && message.columns.length)) + message.columns = []; + message.columns.push(reader.string()); + break; + } + case 4: { + message.escapeCharacter = reader.string(); + break; + } + case 5: { + message.quoteCharacter = reader.string(); + break; + } + case 6: { + message.fieldsTerminatedBy = reader.string(); + break; + } + case 8: { + message.linesTerminatedBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlCsvImportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlCsvImportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlCsvImportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlCsvImportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.table != null && message.hasOwnProperty("table")) + if (!$util.isString(message.table)) + return "table: string expected"; + if (message.columns != null && message.hasOwnProperty("columns")) { + if (!Array.isArray(message.columns)) + return "columns: array expected"; + for (var i = 0; i < message.columns.length; ++i) + if (!$util.isString(message.columns[i])) + return "columns: string[] expected"; + } + if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) + if (!$util.isString(message.escapeCharacter)) + return "escapeCharacter: string expected"; + if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) + if (!$util.isString(message.quoteCharacter)) + return "quoteCharacter: string expected"; + if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) + if (!$util.isString(message.fieldsTerminatedBy)) + return "fieldsTerminatedBy: string expected"; + if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) + if (!$util.isString(message.linesTerminatedBy)) + return "linesTerminatedBy: string expected"; + return null; + }; + + /** + * Creates a SqlCsvImportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions + */ + SqlCsvImportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions(); + if (object.table != null) + message.table = String(object.table); + if (object.columns) { + if (!Array.isArray(object.columns)) + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.columns: array expected"); + message.columns = []; + for (var i = 0; i < object.columns.length; ++i) + message.columns[i] = String(object.columns[i]); + } + if (object.escapeCharacter != null) + message.escapeCharacter = String(object.escapeCharacter); + if (object.quoteCharacter != null) + message.quoteCharacter = String(object.quoteCharacter); + if (object.fieldsTerminatedBy != null) + message.fieldsTerminatedBy = String(object.fieldsTerminatedBy); + if (object.linesTerminatedBy != null) + message.linesTerminatedBy = String(object.linesTerminatedBy); + return message; + }; + + /** + * Creates a plain object from a SqlCsvImportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlCsvImportOptions} message SqlCsvImportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlCsvImportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.columns = []; + if (options.defaults) { + object.table = ""; + object.escapeCharacter = ""; + object.quoteCharacter = ""; + object.fieldsTerminatedBy = ""; + object.linesTerminatedBy = ""; + } + if (message.table != null && message.hasOwnProperty("table")) + object.table = message.table; + if (message.columns && message.columns.length) { + object.columns = []; + for (var j = 0; j < message.columns.length; ++j) + object.columns[j] = message.columns[j]; + } + if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) + object.escapeCharacter = message.escapeCharacter; + if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) + object.quoteCharacter = message.quoteCharacter; + if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) + object.fieldsTerminatedBy = message.fieldsTerminatedBy; + if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) + object.linesTerminatedBy = message.linesTerminatedBy; + return object; + }; + + /** + * Converts this SqlCsvImportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlCsvImportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlCsvImportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlCsvImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlCsvImportOptions"; + }; + + return SqlCsvImportOptions; + })(); + + ImportContext.SqlBakImportOptions = (function() { + + /** + * Properties of a SqlBakImportOptions. + * @memberof google.cloud.sql.v1.ImportContext + * @interface ISqlBakImportOptions + * @property {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions|null} [encryptionOptions] SqlBakImportOptions encryptionOptions + * @property {google.protobuf.IBoolValue|null} [striped] SqlBakImportOptions striped + * @property {google.protobuf.IBoolValue|null} [noRecovery] SqlBakImportOptions noRecovery + * @property {google.protobuf.IBoolValue|null} [recoveryOnly] SqlBakImportOptions recoveryOnly + * @property {google.cloud.sql.v1.BakType|null} [bakType] SqlBakImportOptions bakType + * @property {google.protobuf.ITimestamp|null} [stopAt] SqlBakImportOptions stopAt + * @property {string|null} [stopAtMark] SqlBakImportOptions stopAtMark + */ + + /** + * Constructs a new SqlBakImportOptions. + * @memberof google.cloud.sql.v1.ImportContext + * @classdesc Represents a SqlBakImportOptions. + * @implements ISqlBakImportOptions + * @constructor + * @param {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions=} [properties] Properties to set + */ + function SqlBakImportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBakImportOptions encryptionOptions. + * @member {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions|null|undefined} encryptionOptions + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.encryptionOptions = null; + + /** + * SqlBakImportOptions striped. + * @member {google.protobuf.IBoolValue|null|undefined} striped + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.striped = null; + + /** + * SqlBakImportOptions noRecovery. + * @member {google.protobuf.IBoolValue|null|undefined} noRecovery + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.noRecovery = null; + + /** + * SqlBakImportOptions recoveryOnly. + * @member {google.protobuf.IBoolValue|null|undefined} recoveryOnly + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.recoveryOnly = null; + + /** + * SqlBakImportOptions bakType. + * @member {google.cloud.sql.v1.BakType} bakType + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.bakType = 0; + + /** + * SqlBakImportOptions stopAt. + * @member {google.protobuf.ITimestamp|null|undefined} stopAt + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.stopAt = null; + + /** + * SqlBakImportOptions stopAtMark. + * @member {string} stopAtMark + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.stopAtMark = ""; + + /** + * Creates a new SqlBakImportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions} SqlBakImportOptions instance + */ + SqlBakImportOptions.create = function create(properties) { + return new SqlBakImportOptions(properties); + }; + + /** + * Encodes the specified SqlBakImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions} message SqlBakImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBakImportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.encryptionOptions != null && Object.hasOwnProperty.call(message, "encryptionOptions")) + $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.encode(message.encryptionOptions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.striped != null && Object.hasOwnProperty.call(message, "striped")) + $root.google.protobuf.BoolValue.encode(message.striped, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.noRecovery != null && Object.hasOwnProperty.call(message, "noRecovery")) + $root.google.protobuf.BoolValue.encode(message.noRecovery, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.recoveryOnly != null && Object.hasOwnProperty.call(message, "recoveryOnly")) + $root.google.protobuf.BoolValue.encode(message.recoveryOnly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.bakType != null && Object.hasOwnProperty.call(message, "bakType")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.bakType); + if (message.stopAt != null && Object.hasOwnProperty.call(message, "stopAt")) + $root.google.protobuf.Timestamp.encode(message.stopAt, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.stopAtMark != null && Object.hasOwnProperty.call(message, "stopAtMark")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.stopAtMark); + return writer; + }; + + /** + * Encodes the specified SqlBakImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions} message SqlBakImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBakImportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBakImportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions} SqlBakImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBakImportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.encryptionOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.decode(reader, reader.uint32()); + break; + } + case 2: { + message.striped = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 4: { + message.noRecovery = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 5: { + message.recoveryOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 6: { + message.bakType = reader.int32(); + break; + } + case 7: { + message.stopAt = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.stopAtMark = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBakImportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions} SqlBakImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBakImportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBakImportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBakImportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.encryptionOptions != null && message.hasOwnProperty("encryptionOptions")) { + var error = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.verify(message.encryptionOptions); + if (error) + return "encryptionOptions." + error; + } + if (message.striped != null && message.hasOwnProperty("striped")) { + var error = $root.google.protobuf.BoolValue.verify(message.striped); + if (error) + return "striped." + error; + } + if (message.noRecovery != null && message.hasOwnProperty("noRecovery")) { + var error = $root.google.protobuf.BoolValue.verify(message.noRecovery); + if (error) + return "noRecovery." + error; + } + if (message.recoveryOnly != null && message.hasOwnProperty("recoveryOnly")) { + var error = $root.google.protobuf.BoolValue.verify(message.recoveryOnly); + if (error) + return "recoveryOnly." + error; + } + if (message.bakType != null && message.hasOwnProperty("bakType")) + switch (message.bakType) { + default: + return "bakType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.stopAt != null && message.hasOwnProperty("stopAt")) { + var error = $root.google.protobuf.Timestamp.verify(message.stopAt); + if (error) + return "stopAt." + error; + } + if (message.stopAtMark != null && message.hasOwnProperty("stopAtMark")) + if (!$util.isString(message.stopAtMark)) + return "stopAtMark: string expected"; + return null; + }; + + /** + * Creates a SqlBakImportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions} SqlBakImportOptions + */ + SqlBakImportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions(); + if (object.encryptionOptions != null) { + if (typeof object.encryptionOptions !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.encryptionOptions: object expected"); + message.encryptionOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.fromObject(object.encryptionOptions); + } + if (object.striped != null) { + if (typeof object.striped !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.striped: object expected"); + message.striped = $root.google.protobuf.BoolValue.fromObject(object.striped); + } + if (object.noRecovery != null) { + if (typeof object.noRecovery !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.noRecovery: object expected"); + message.noRecovery = $root.google.protobuf.BoolValue.fromObject(object.noRecovery); + } + if (object.recoveryOnly != null) { + if (typeof object.recoveryOnly !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.recoveryOnly: object expected"); + message.recoveryOnly = $root.google.protobuf.BoolValue.fromObject(object.recoveryOnly); + } + switch (object.bakType) { + default: + if (typeof object.bakType === "number") { + message.bakType = object.bakType; + break; + } + break; + case "BAK_TYPE_UNSPECIFIED": + case 0: + message.bakType = 0; + break; + case "FULL": + case 1: + message.bakType = 1; + break; + case "DIFF": + case 2: + message.bakType = 2; + break; + case "TLOG": + case 3: + message.bakType = 3; + break; + } + if (object.stopAt != null) { + if (typeof object.stopAt !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.stopAt: object expected"); + message.stopAt = $root.google.protobuf.Timestamp.fromObject(object.stopAt); + } + if (object.stopAtMark != null) + message.stopAtMark = String(object.stopAtMark); + return message; + }; + + /** + * Creates a plain object from a SqlBakImportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions} message SqlBakImportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBakImportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.encryptionOptions = null; + object.striped = null; + object.noRecovery = null; + object.recoveryOnly = null; + object.bakType = options.enums === String ? "BAK_TYPE_UNSPECIFIED" : 0; + object.stopAt = null; + object.stopAtMark = ""; + } + if (message.encryptionOptions != null && message.hasOwnProperty("encryptionOptions")) + object.encryptionOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.toObject(message.encryptionOptions, options); + if (message.striped != null && message.hasOwnProperty("striped")) + object.striped = $root.google.protobuf.BoolValue.toObject(message.striped, options); + if (message.noRecovery != null && message.hasOwnProperty("noRecovery")) + object.noRecovery = $root.google.protobuf.BoolValue.toObject(message.noRecovery, options); + if (message.recoveryOnly != null && message.hasOwnProperty("recoveryOnly")) + object.recoveryOnly = $root.google.protobuf.BoolValue.toObject(message.recoveryOnly, options); + if (message.bakType != null && message.hasOwnProperty("bakType")) + object.bakType = options.enums === String ? $root.google.cloud.sql.v1.BakType[message.bakType] === undefined ? message.bakType : $root.google.cloud.sql.v1.BakType[message.bakType] : message.bakType; + if (message.stopAt != null && message.hasOwnProperty("stopAt")) + object.stopAt = $root.google.protobuf.Timestamp.toObject(message.stopAt, options); + if (message.stopAtMark != null && message.hasOwnProperty("stopAtMark")) + object.stopAtMark = message.stopAtMark; + return object; + }; + + /** + * Converts this SqlBakImportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlBakImportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBakImportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBakImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlBakImportOptions"; + }; + + SqlBakImportOptions.EncryptionOptions = (function() { + + /** + * Properties of an EncryptionOptions. + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @interface IEncryptionOptions + * @property {string|null} [certPath] EncryptionOptions certPath + * @property {string|null} [pvkPath] EncryptionOptions pvkPath + * @property {string|null} [pvkPassword] EncryptionOptions pvkPassword + * @property {google.protobuf.IBoolValue|null} [keepEncrypted] EncryptionOptions keepEncrypted + */ + + /** + * Constructs a new EncryptionOptions. + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions + * @classdesc Represents an EncryptionOptions. + * @implements IEncryptionOptions + * @constructor + * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions=} [properties] Properties to set + */ + function EncryptionOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EncryptionOptions certPath. + * @member {string} certPath + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @instance + */ + EncryptionOptions.prototype.certPath = ""; + + /** + * EncryptionOptions pvkPath. + * @member {string} pvkPath + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @instance + */ + EncryptionOptions.prototype.pvkPath = ""; + + /** + * EncryptionOptions pvkPassword. + * @member {string} pvkPassword + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @instance + */ + EncryptionOptions.prototype.pvkPassword = ""; + + /** + * EncryptionOptions keepEncrypted. + * @member {google.protobuf.IBoolValue|null|undefined} keepEncrypted + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @instance + */ + EncryptionOptions.prototype.keepEncrypted = null; + + /** + * Creates a new EncryptionOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions instance + */ + EncryptionOptions.create = function create(properties) { + return new EncryptionOptions(properties); + }; + + /** + * Encodes the specified EncryptionOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions} message EncryptionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncryptionOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certPath != null && Object.hasOwnProperty.call(message, "certPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.certPath); + if (message.pvkPath != null && Object.hasOwnProperty.call(message, "pvkPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pvkPath); + if (message.pvkPassword != null && Object.hasOwnProperty.call(message, "pvkPassword")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pvkPassword); + if (message.keepEncrypted != null && Object.hasOwnProperty.call(message, "keepEncrypted")) + $root.google.protobuf.BoolValue.encode(message.keepEncrypted, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EncryptionOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions} message EncryptionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncryptionOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EncryptionOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncryptionOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.certPath = reader.string(); + break; + } + case 2: { + message.pvkPath = reader.string(); + break; + } + case 3: { + message.pvkPassword = reader.string(); + break; + } + case 5: { + message.keepEncrypted = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EncryptionOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncryptionOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EncryptionOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EncryptionOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certPath != null && message.hasOwnProperty("certPath")) + if (!$util.isString(message.certPath)) + return "certPath: string expected"; + if (message.pvkPath != null && message.hasOwnProperty("pvkPath")) + if (!$util.isString(message.pvkPath)) + return "pvkPath: string expected"; + if (message.pvkPassword != null && message.hasOwnProperty("pvkPassword")) + if (!$util.isString(message.pvkPassword)) + return "pvkPassword: string expected"; + if (message.keepEncrypted != null && message.hasOwnProperty("keepEncrypted")) { + var error = $root.google.protobuf.BoolValue.verify(message.keepEncrypted); + if (error) + return "keepEncrypted." + error; + } + return null; + }; + + /** + * Creates an EncryptionOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions + */ + EncryptionOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions) + return object; + var message = new $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions(); + if (object.certPath != null) + message.certPath = String(object.certPath); + if (object.pvkPath != null) + message.pvkPath = String(object.pvkPath); + if (object.pvkPassword != null) + message.pvkPassword = String(object.pvkPassword); + if (object.keepEncrypted != null) { + if (typeof object.keepEncrypted !== "object") + throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.keepEncrypted: object expected"); + message.keepEncrypted = $root.google.protobuf.BoolValue.fromObject(object.keepEncrypted); + } + return message; + }; + + /** + * Creates a plain object from an EncryptionOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions} message EncryptionOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EncryptionOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.certPath = ""; + object.pvkPath = ""; + object.pvkPassword = ""; + object.keepEncrypted = null; + } + if (message.certPath != null && message.hasOwnProperty("certPath")) + object.certPath = message.certPath; + if (message.pvkPath != null && message.hasOwnProperty("pvkPath")) + object.pvkPath = message.pvkPath; + if (message.pvkPassword != null && message.hasOwnProperty("pvkPassword")) + object.pvkPassword = message.pvkPassword; + if (message.keepEncrypted != null && message.hasOwnProperty("keepEncrypted")) + object.keepEncrypted = $root.google.protobuf.BoolValue.toObject(message.keepEncrypted, options); + return object; + }; + + /** + * Converts this EncryptionOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @instance + * @returns {Object.} JSON object + */ + EncryptionOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EncryptionOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EncryptionOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions"; + }; + + return EncryptionOptions; + })(); + + return SqlBakImportOptions; + })(); + + ImportContext.SqlTdeImportOptions = (function() { + + /** + * Properties of a SqlTdeImportOptions. + * @memberof google.cloud.sql.v1.ImportContext + * @interface ISqlTdeImportOptions + * @property {string|null} [certificatePath] SqlTdeImportOptions certificatePath + * @property {string|null} [privateKeyPath] SqlTdeImportOptions privateKeyPath + * @property {string|null} [privateKeyPassword] SqlTdeImportOptions privateKeyPassword + * @property {string|null} [name] SqlTdeImportOptions name + */ + + /** + * Constructs a new SqlTdeImportOptions. + * @memberof google.cloud.sql.v1.ImportContext + * @classdesc Represents a SqlTdeImportOptions. + * @implements ISqlTdeImportOptions + * @constructor + * @param {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions=} [properties] Properties to set + */ + function SqlTdeImportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlTdeImportOptions certificatePath. + * @member {string} certificatePath + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @instance + */ + SqlTdeImportOptions.prototype.certificatePath = ""; + + /** + * SqlTdeImportOptions privateKeyPath. + * @member {string} privateKeyPath + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @instance + */ + SqlTdeImportOptions.prototype.privateKeyPath = ""; + + /** + * SqlTdeImportOptions privateKeyPassword. + * @member {string} privateKeyPassword + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @instance + */ + SqlTdeImportOptions.prototype.privateKeyPassword = ""; + + /** + * SqlTdeImportOptions name. + * @member {string} name + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @instance + */ + SqlTdeImportOptions.prototype.name = ""; + + /** + * Creates a new SqlTdeImportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions instance + */ + SqlTdeImportOptions.create = function create(properties) { + return new SqlTdeImportOptions(properties); + }; + + /** + * Encodes the specified SqlTdeImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions} message SqlTdeImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTdeImportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certificatePath != null && Object.hasOwnProperty.call(message, "certificatePath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.certificatePath); + if (message.privateKeyPath != null && Object.hasOwnProperty.call(message, "privateKeyPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateKeyPath); + if (message.privateKeyPassword != null && Object.hasOwnProperty.call(message, "privateKeyPassword")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.privateKeyPassword); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + return writer; + }; + + /** + * Encodes the specified SqlTdeImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions} message SqlTdeImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTdeImportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlTdeImportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTdeImportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.certificatePath = reader.string(); + break; + } + case 2: { + message.privateKeyPath = reader.string(); + break; + } + case 3: { + message.privateKeyPassword = reader.string(); + break; + } + case 5: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlTdeImportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTdeImportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlTdeImportOptions message. + * @function verify + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlTdeImportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) + if (!$util.isString(message.certificatePath)) + return "certificatePath: string expected"; + if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) + if (!$util.isString(message.privateKeyPath)) + return "privateKeyPath: string expected"; + if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) + if (!$util.isString(message.privateKeyPassword)) + return "privateKeyPassword: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a SqlTdeImportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions + */ + SqlTdeImportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions) + return object; + var message = new $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions(); + if (object.certificatePath != null) + message.certificatePath = String(object.certificatePath); + if (object.privateKeyPath != null) + message.privateKeyPath = String(object.privateKeyPath); + if (object.privateKeyPassword != null) + message.privateKeyPassword = String(object.privateKeyPassword); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a SqlTdeImportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @static + * @param {google.cloud.sql.v1.ImportContext.SqlTdeImportOptions} message SqlTdeImportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlTdeImportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.certificatePath = ""; + object.privateKeyPath = ""; + object.privateKeyPassword = ""; + object.name = ""; + } + if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) + object.certificatePath = message.certificatePath; + if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) + object.privateKeyPath = message.privateKeyPath; + if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) + object.privateKeyPassword = message.privateKeyPassword; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this SqlTdeImportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlTdeImportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlTdeImportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlTdeImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlTdeImportOptions"; + }; + + return SqlTdeImportOptions; + })(); + + return ImportContext; + })(); + + /** + * BakType enum. + * @name google.cloud.sql.v1.BakType + * @enum {number} + * @property {number} BAK_TYPE_UNSPECIFIED=0 BAK_TYPE_UNSPECIFIED value + * @property {number} FULL=1 FULL value + * @property {number} DIFF=2 DIFF value + * @property {number} TLOG=3 TLOG value + */ + v1.BakType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BAK_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FULL"] = 1; + values[valuesById[2] = "DIFF"] = 2; + values[valuesById[3] = "TLOG"] = 3; + return values; + })(); + + v1.IpConfiguration = (function() { + + /** + * Properties of an IpConfiguration. + * @memberof google.cloud.sql.v1 + * @interface IIpConfiguration + * @property {google.protobuf.IBoolValue|null} [ipv4Enabled] IpConfiguration ipv4Enabled + * @property {string|null} [privateNetwork] IpConfiguration privateNetwork + * @property {google.protobuf.IBoolValue|null} [requireSsl] IpConfiguration requireSsl + * @property {Array.|null} [authorizedNetworks] IpConfiguration authorizedNetworks + * @property {string|null} [allocatedIpRange] IpConfiguration allocatedIpRange + * @property {google.protobuf.IBoolValue|null} [enablePrivatePathForGoogleCloudServices] IpConfiguration enablePrivatePathForGoogleCloudServices + * @property {google.cloud.sql.v1.IpConfiguration.SslMode|null} [sslMode] IpConfiguration sslMode + * @property {google.cloud.sql.v1.IPscConfig|null} [pscConfig] IpConfiguration pscConfig + * @property {google.cloud.sql.v1.IpConfiguration.CaMode|null} [serverCaMode] IpConfiguration serverCaMode + * @property {Array.|null} [customSubjectAlternativeNames] IpConfiguration customSubjectAlternativeNames + * @property {string|null} [serverCaPool] IpConfiguration serverCaPool + * @property {google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|null} [serverCertificateRotationMode] IpConfiguration serverCertificateRotationMode + */ + + /** + * Constructs a new IpConfiguration. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an IpConfiguration. + * @implements IIpConfiguration + * @constructor + * @param {google.cloud.sql.v1.IIpConfiguration=} [properties] Properties to set + */ + function IpConfiguration(properties) { + this.authorizedNetworks = []; + this.customSubjectAlternativeNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IpConfiguration ipv4Enabled. + * @member {google.protobuf.IBoolValue|null|undefined} ipv4Enabled + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.ipv4Enabled = null; + + /** + * IpConfiguration privateNetwork. + * @member {string} privateNetwork + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.privateNetwork = ""; + + /** + * IpConfiguration requireSsl. + * @member {google.protobuf.IBoolValue|null|undefined} requireSsl + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.requireSsl = null; + + /** + * IpConfiguration authorizedNetworks. + * @member {Array.} authorizedNetworks + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.authorizedNetworks = $util.emptyArray; + + /** + * IpConfiguration allocatedIpRange. + * @member {string} allocatedIpRange + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.allocatedIpRange = ""; + + /** + * IpConfiguration enablePrivatePathForGoogleCloudServices. + * @member {google.protobuf.IBoolValue|null|undefined} enablePrivatePathForGoogleCloudServices + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.enablePrivatePathForGoogleCloudServices = null; + + /** + * IpConfiguration sslMode. + * @member {google.cloud.sql.v1.IpConfiguration.SslMode} sslMode + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.sslMode = 0; + + /** + * IpConfiguration pscConfig. + * @member {google.cloud.sql.v1.IPscConfig|null|undefined} pscConfig + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.pscConfig = null; + + /** + * IpConfiguration serverCaMode. + * @member {google.cloud.sql.v1.IpConfiguration.CaMode|null|undefined} serverCaMode + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.serverCaMode = null; + + /** + * IpConfiguration customSubjectAlternativeNames. + * @member {Array.} customSubjectAlternativeNames + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.customSubjectAlternativeNames = $util.emptyArray; + + /** + * IpConfiguration serverCaPool. + * @member {string|null|undefined} serverCaPool + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.serverCaPool = null; + + /** + * IpConfiguration serverCertificateRotationMode. + * @member {google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|null|undefined} serverCertificateRotationMode + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + */ + IpConfiguration.prototype.serverCertificateRotationMode = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(IpConfiguration.prototype, "_pscConfig", { + get: $util.oneOfGetter($oneOfFields = ["pscConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(IpConfiguration.prototype, "_serverCaMode", { + get: $util.oneOfGetter($oneOfFields = ["serverCaMode"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(IpConfiguration.prototype, "_serverCaPool", { + get: $util.oneOfGetter($oneOfFields = ["serverCaPool"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(IpConfiguration.prototype, "_serverCertificateRotationMode", { + get: $util.oneOfGetter($oneOfFields = ["serverCertificateRotationMode"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new IpConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.IpConfiguration + * @static + * @param {google.cloud.sql.v1.IIpConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1.IpConfiguration} IpConfiguration instance + */ + IpConfiguration.create = function create(properties) { + return new IpConfiguration(properties); + }; + + /** + * Encodes the specified IpConfiguration message. Does not implicitly {@link google.cloud.sql.v1.IpConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.IpConfiguration + * @static + * @param {google.cloud.sql.v1.IIpConfiguration} message IpConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IpConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ipv4Enabled != null && Object.hasOwnProperty.call(message, "ipv4Enabled")) + $root.google.protobuf.BoolValue.encode(message.ipv4Enabled, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.privateNetwork != null && Object.hasOwnProperty.call(message, "privateNetwork")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateNetwork); + if (message.requireSsl != null && Object.hasOwnProperty.call(message, "requireSsl")) + $root.google.protobuf.BoolValue.encode(message.requireSsl, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.authorizedNetworks != null && message.authorizedNetworks.length) + for (var i = 0; i < message.authorizedNetworks.length; ++i) + $root.google.cloud.sql.v1.AclEntry.encode(message.authorizedNetworks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.allocatedIpRange); + if (message.enablePrivatePathForGoogleCloudServices != null && Object.hasOwnProperty.call(message, "enablePrivatePathForGoogleCloudServices")) + $root.google.protobuf.BoolValue.encode(message.enablePrivatePathForGoogleCloudServices, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.sslMode != null && Object.hasOwnProperty.call(message, "sslMode")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.sslMode); + if (message.pscConfig != null && Object.hasOwnProperty.call(message, "pscConfig")) + $root.google.cloud.sql.v1.PscConfig.encode(message.pscConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.serverCaMode != null && Object.hasOwnProperty.call(message, "serverCaMode")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.serverCaMode); + if (message.customSubjectAlternativeNames != null && message.customSubjectAlternativeNames.length) + for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.customSubjectAlternativeNames[i]); + if (message.serverCaPool != null && Object.hasOwnProperty.call(message, "serverCaPool")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.serverCaPool); + if (message.serverCertificateRotationMode != null && Object.hasOwnProperty.call(message, "serverCertificateRotationMode")) + writer.uint32(/* id 16, wireType 0 =*/128).int32(message.serverCertificateRotationMode); + return writer; + }; + + /** + * Encodes the specified IpConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.IpConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.IpConfiguration + * @static + * @param {google.cloud.sql.v1.IIpConfiguration} message IpConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IpConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IpConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.IpConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.IpConfiguration} IpConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IpConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.IpConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.ipv4Enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 2: { + message.privateNetwork = reader.string(); + break; + } + case 3: { + message.requireSsl = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.authorizedNetworks && message.authorizedNetworks.length)) + message.authorizedNetworks = []; + message.authorizedNetworks.push($root.google.cloud.sql.v1.AclEntry.decode(reader, reader.uint32())); + break; + } + case 6: { + message.allocatedIpRange = reader.string(); + break; + } + case 7: { + message.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 8: { + message.sslMode = reader.int32(); + break; + } + case 9: { + message.pscConfig = $root.google.cloud.sql.v1.PscConfig.decode(reader, reader.uint32()); + break; + } + case 10: { + message.serverCaMode = reader.int32(); + break; + } + case 11: { + if (!(message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length)) + message.customSubjectAlternativeNames = []; + message.customSubjectAlternativeNames.push(reader.string()); + break; + } + case 12: { + message.serverCaPool = reader.string(); + break; + } + case 16: { + message.serverCertificateRotationMode = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IpConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.IpConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.IpConfiguration} IpConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IpConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IpConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1.IpConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IpConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.ipv4Enabled != null && message.hasOwnProperty("ipv4Enabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.ipv4Enabled); + if (error) + return "ipv4Enabled." + error; + } + if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) + if (!$util.isString(message.privateNetwork)) + return "privateNetwork: string expected"; + if (message.requireSsl != null && message.hasOwnProperty("requireSsl")) { + var error = $root.google.protobuf.BoolValue.verify(message.requireSsl); + if (error) + return "requireSsl." + error; + } + if (message.authorizedNetworks != null && message.hasOwnProperty("authorizedNetworks")) { + if (!Array.isArray(message.authorizedNetworks)) + return "authorizedNetworks: array expected"; + for (var i = 0; i < message.authorizedNetworks.length; ++i) { + var error = $root.google.cloud.sql.v1.AclEntry.verify(message.authorizedNetworks[i]); + if (error) + return "authorizedNetworks." + error; + } + } + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) + if (!$util.isString(message.allocatedIpRange)) + return "allocatedIpRange: string expected"; + if (message.enablePrivatePathForGoogleCloudServices != null && message.hasOwnProperty("enablePrivatePathForGoogleCloudServices")) { + var error = $root.google.protobuf.BoolValue.verify(message.enablePrivatePathForGoogleCloudServices); + if (error) + return "enablePrivatePathForGoogleCloudServices." + error; + } + if (message.sslMode != null && message.hasOwnProperty("sslMode")) + switch (message.sslMode) { + default: + return "sslMode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.pscConfig != null && message.hasOwnProperty("pscConfig")) { + properties._pscConfig = 1; + { + var error = $root.google.cloud.sql.v1.PscConfig.verify(message.pscConfig); + if (error) + return "pscConfig." + error; + } + } + if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) { + properties._serverCaMode = 1; + switch (message.serverCaMode) { + default: + return "serverCaMode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } + if (message.customSubjectAlternativeNames != null && message.hasOwnProperty("customSubjectAlternativeNames")) { + if (!Array.isArray(message.customSubjectAlternativeNames)) + return "customSubjectAlternativeNames: array expected"; + for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) + if (!$util.isString(message.customSubjectAlternativeNames[i])) + return "customSubjectAlternativeNames: string[] expected"; + } + if (message.serverCaPool != null && message.hasOwnProperty("serverCaPool")) { + properties._serverCaPool = 1; + if (!$util.isString(message.serverCaPool)) + return "serverCaPool: string expected"; + } + if (message.serverCertificateRotationMode != null && message.hasOwnProperty("serverCertificateRotationMode")) { + properties._serverCertificateRotationMode = 1; + switch (message.serverCertificateRotationMode) { + default: + return "serverCertificateRotationMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates an IpConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.IpConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.IpConfiguration} IpConfiguration + */ + IpConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.IpConfiguration) + return object; + var message = new $root.google.cloud.sql.v1.IpConfiguration(); + if (object.ipv4Enabled != null) { + if (typeof object.ipv4Enabled !== "object") + throw TypeError(".google.cloud.sql.v1.IpConfiguration.ipv4Enabled: object expected"); + message.ipv4Enabled = $root.google.protobuf.BoolValue.fromObject(object.ipv4Enabled); + } + if (object.privateNetwork != null) + message.privateNetwork = String(object.privateNetwork); + if (object.requireSsl != null) { + if (typeof object.requireSsl !== "object") + throw TypeError(".google.cloud.sql.v1.IpConfiguration.requireSsl: object expected"); + message.requireSsl = $root.google.protobuf.BoolValue.fromObject(object.requireSsl); + } + if (object.authorizedNetworks) { + if (!Array.isArray(object.authorizedNetworks)) + throw TypeError(".google.cloud.sql.v1.IpConfiguration.authorizedNetworks: array expected"); + message.authorizedNetworks = []; + for (var i = 0; i < object.authorizedNetworks.length; ++i) { + if (typeof object.authorizedNetworks[i] !== "object") + throw TypeError(".google.cloud.sql.v1.IpConfiguration.authorizedNetworks: object expected"); + message.authorizedNetworks[i] = $root.google.cloud.sql.v1.AclEntry.fromObject(object.authorizedNetworks[i]); + } + } + if (object.allocatedIpRange != null) + message.allocatedIpRange = String(object.allocatedIpRange); + if (object.enablePrivatePathForGoogleCloudServices != null) { + if (typeof object.enablePrivatePathForGoogleCloudServices !== "object") + throw TypeError(".google.cloud.sql.v1.IpConfiguration.enablePrivatePathForGoogleCloudServices: object expected"); + message.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.fromObject(object.enablePrivatePathForGoogleCloudServices); + } + switch (object.sslMode) { + default: + if (typeof object.sslMode === "number") { + message.sslMode = object.sslMode; + break; + } + break; + case "SSL_MODE_UNSPECIFIED": + case 0: + message.sslMode = 0; + break; + case "ALLOW_UNENCRYPTED_AND_ENCRYPTED": + case 1: + message.sslMode = 1; + break; + case "ENCRYPTED_ONLY": + case 2: + message.sslMode = 2; + break; + case "TRUSTED_CLIENT_CERTIFICATE_REQUIRED": + case 3: + message.sslMode = 3; + break; + } + if (object.pscConfig != null) { + if (typeof object.pscConfig !== "object") + throw TypeError(".google.cloud.sql.v1.IpConfiguration.pscConfig: object expected"); + message.pscConfig = $root.google.cloud.sql.v1.PscConfig.fromObject(object.pscConfig); + } + switch (object.serverCaMode) { + default: + if (typeof object.serverCaMode === "number") { + message.serverCaMode = object.serverCaMode; + break; + } + break; + case "CA_MODE_UNSPECIFIED": + case 0: + message.serverCaMode = 0; + break; + case "GOOGLE_MANAGED_INTERNAL_CA": + case 1: + message.serverCaMode = 1; + break; + case "GOOGLE_MANAGED_CAS_CA": + case 2: + message.serverCaMode = 2; + break; + case "CUSTOMER_MANAGED_CAS_CA": + case 3: + message.serverCaMode = 3; + break; + } + if (object.customSubjectAlternativeNames) { + if (!Array.isArray(object.customSubjectAlternativeNames)) + throw TypeError(".google.cloud.sql.v1.IpConfiguration.customSubjectAlternativeNames: array expected"); + message.customSubjectAlternativeNames = []; + for (var i = 0; i < object.customSubjectAlternativeNames.length; ++i) + message.customSubjectAlternativeNames[i] = String(object.customSubjectAlternativeNames[i]); + } + if (object.serverCaPool != null) + message.serverCaPool = String(object.serverCaPool); + switch (object.serverCertificateRotationMode) { + default: + if (typeof object.serverCertificateRotationMode === "number") { + message.serverCertificateRotationMode = object.serverCertificateRotationMode; + break; + } + break; + case "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED": + case 0: + message.serverCertificateRotationMode = 0; + break; + case "NO_AUTOMATIC_ROTATION": + case 1: + message.serverCertificateRotationMode = 1; + break; + case "AUTOMATIC_ROTATION_DURING_MAINTENANCE": + case 2: + message.serverCertificateRotationMode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an IpConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.IpConfiguration + * @static + * @param {google.cloud.sql.v1.IpConfiguration} message IpConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IpConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.authorizedNetworks = []; + object.customSubjectAlternativeNames = []; + } + if (options.defaults) { + object.ipv4Enabled = null; + object.privateNetwork = ""; + object.requireSsl = null; + object.allocatedIpRange = ""; + object.enablePrivatePathForGoogleCloudServices = null; + object.sslMode = options.enums === String ? "SSL_MODE_UNSPECIFIED" : 0; + } + if (message.ipv4Enabled != null && message.hasOwnProperty("ipv4Enabled")) + object.ipv4Enabled = $root.google.protobuf.BoolValue.toObject(message.ipv4Enabled, options); + if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) + object.privateNetwork = message.privateNetwork; + if (message.requireSsl != null && message.hasOwnProperty("requireSsl")) + object.requireSsl = $root.google.protobuf.BoolValue.toObject(message.requireSsl, options); + if (message.authorizedNetworks && message.authorizedNetworks.length) { + object.authorizedNetworks = []; + for (var j = 0; j < message.authorizedNetworks.length; ++j) + object.authorizedNetworks[j] = $root.google.cloud.sql.v1.AclEntry.toObject(message.authorizedNetworks[j], options); + } + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) + object.allocatedIpRange = message.allocatedIpRange; + if (message.enablePrivatePathForGoogleCloudServices != null && message.hasOwnProperty("enablePrivatePathForGoogleCloudServices")) + object.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.toObject(message.enablePrivatePathForGoogleCloudServices, options); + if (message.sslMode != null && message.hasOwnProperty("sslMode")) + object.sslMode = options.enums === String ? $root.google.cloud.sql.v1.IpConfiguration.SslMode[message.sslMode] === undefined ? message.sslMode : $root.google.cloud.sql.v1.IpConfiguration.SslMode[message.sslMode] : message.sslMode; + if (message.pscConfig != null && message.hasOwnProperty("pscConfig")) { + object.pscConfig = $root.google.cloud.sql.v1.PscConfig.toObject(message.pscConfig, options); + if (options.oneofs) + object._pscConfig = "pscConfig"; + } + if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) { + object.serverCaMode = options.enums === String ? $root.google.cloud.sql.v1.IpConfiguration.CaMode[message.serverCaMode] === undefined ? message.serverCaMode : $root.google.cloud.sql.v1.IpConfiguration.CaMode[message.serverCaMode] : message.serverCaMode; + if (options.oneofs) + object._serverCaMode = "serverCaMode"; + } + if (message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length) { + object.customSubjectAlternativeNames = []; + for (var j = 0; j < message.customSubjectAlternativeNames.length; ++j) + object.customSubjectAlternativeNames[j] = message.customSubjectAlternativeNames[j]; + } + if (message.serverCaPool != null && message.hasOwnProperty("serverCaPool")) { + object.serverCaPool = message.serverCaPool; + if (options.oneofs) + object._serverCaPool = "serverCaPool"; + } + if (message.serverCertificateRotationMode != null && message.hasOwnProperty("serverCertificateRotationMode")) { + object.serverCertificateRotationMode = options.enums === String ? $root.google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode[message.serverCertificateRotationMode] === undefined ? message.serverCertificateRotationMode : $root.google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode[message.serverCertificateRotationMode] : message.serverCertificateRotationMode; + if (options.oneofs) + object._serverCertificateRotationMode = "serverCertificateRotationMode"; + } + return object; + }; + + /** + * Converts this IpConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.IpConfiguration + * @instance + * @returns {Object.} JSON object + */ + IpConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IpConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1.IpConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IpConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.IpConfiguration"; + }; + + /** + * SslMode enum. + * @name google.cloud.sql.v1.IpConfiguration.SslMode + * @enum {number} + * @property {number} SSL_MODE_UNSPECIFIED=0 SSL_MODE_UNSPECIFIED value + * @property {number} ALLOW_UNENCRYPTED_AND_ENCRYPTED=1 ALLOW_UNENCRYPTED_AND_ENCRYPTED value + * @property {number} ENCRYPTED_ONLY=2 ENCRYPTED_ONLY value + * @property {number} TRUSTED_CLIENT_CERTIFICATE_REQUIRED=3 TRUSTED_CLIENT_CERTIFICATE_REQUIRED value + */ + IpConfiguration.SslMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SSL_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALLOW_UNENCRYPTED_AND_ENCRYPTED"] = 1; + values[valuesById[2] = "ENCRYPTED_ONLY"] = 2; + values[valuesById[3] = "TRUSTED_CLIENT_CERTIFICATE_REQUIRED"] = 3; + return values; + })(); + + /** + * CaMode enum. + * @name google.cloud.sql.v1.IpConfiguration.CaMode + * @enum {number} + * @property {number} CA_MODE_UNSPECIFIED=0 CA_MODE_UNSPECIFIED value + * @property {number} GOOGLE_MANAGED_INTERNAL_CA=1 GOOGLE_MANAGED_INTERNAL_CA value + * @property {number} GOOGLE_MANAGED_CAS_CA=2 GOOGLE_MANAGED_CAS_CA value + * @property {number} CUSTOMER_MANAGED_CAS_CA=3 CUSTOMER_MANAGED_CAS_CA value + */ + IpConfiguration.CaMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CA_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "GOOGLE_MANAGED_INTERNAL_CA"] = 1; + values[valuesById[2] = "GOOGLE_MANAGED_CAS_CA"] = 2; + values[valuesById[3] = "CUSTOMER_MANAGED_CAS_CA"] = 3; + return values; + })(); + + /** + * ServerCertificateRotationMode enum. + * @name google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode + * @enum {number} + * @property {number} SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED=0 SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED value + * @property {number} NO_AUTOMATIC_ROTATION=1 NO_AUTOMATIC_ROTATION value + * @property {number} AUTOMATIC_ROTATION_DURING_MAINTENANCE=2 AUTOMATIC_ROTATION_DURING_MAINTENANCE value + */ + IpConfiguration.ServerCertificateRotationMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NO_AUTOMATIC_ROTATION"] = 1; + values[valuesById[2] = "AUTOMATIC_ROTATION_DURING_MAINTENANCE"] = 2; + return values; + })(); + + return IpConfiguration; + })(); + + v1.PscConfig = (function() { + + /** + * Properties of a PscConfig. + * @memberof google.cloud.sql.v1 + * @interface IPscConfig + * @property {boolean|null} [pscEnabled] PscConfig pscEnabled + * @property {Array.|null} [allowedConsumerProjects] PscConfig allowedConsumerProjects + * @property {Array.|null} [pscAutoConnections] PscConfig pscAutoConnections + * @property {string|null} [networkAttachmentUri] PscConfig networkAttachmentUri + * @property {boolean|null} [pscAutoDnsEnabled] PscConfig pscAutoDnsEnabled + * @property {boolean|null} [pscWriteEndpointDnsEnabled] PscConfig pscWriteEndpointDnsEnabled + */ + + /** + * Constructs a new PscConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a PscConfig. + * @implements IPscConfig + * @constructor + * @param {google.cloud.sql.v1.IPscConfig=} [properties] Properties to set + */ + function PscConfig(properties) { + this.allowedConsumerProjects = []; + this.pscAutoConnections = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PscConfig pscEnabled. + * @member {boolean|null|undefined} pscEnabled + * @memberof google.cloud.sql.v1.PscConfig + * @instance + */ + PscConfig.prototype.pscEnabled = null; + + /** + * PscConfig allowedConsumerProjects. + * @member {Array.} allowedConsumerProjects + * @memberof google.cloud.sql.v1.PscConfig + * @instance + */ + PscConfig.prototype.allowedConsumerProjects = $util.emptyArray; + + /** + * PscConfig pscAutoConnections. + * @member {Array.} pscAutoConnections + * @memberof google.cloud.sql.v1.PscConfig + * @instance + */ + PscConfig.prototype.pscAutoConnections = $util.emptyArray; + + /** + * PscConfig networkAttachmentUri. + * @member {string} networkAttachmentUri + * @memberof google.cloud.sql.v1.PscConfig + * @instance + */ + PscConfig.prototype.networkAttachmentUri = ""; + + /** + * PscConfig pscAutoDnsEnabled. + * @member {boolean|null|undefined} pscAutoDnsEnabled + * @memberof google.cloud.sql.v1.PscConfig + * @instance + */ + PscConfig.prototype.pscAutoDnsEnabled = null; + + /** + * PscConfig pscWriteEndpointDnsEnabled. + * @member {boolean|null|undefined} pscWriteEndpointDnsEnabled + * @memberof google.cloud.sql.v1.PscConfig + * @instance + */ + PscConfig.prototype.pscWriteEndpointDnsEnabled = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscConfig.prototype, "_pscEnabled", { + get: $util.oneOfGetter($oneOfFields = ["pscEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscConfig.prototype, "_pscAutoDnsEnabled", { + get: $util.oneOfGetter($oneOfFields = ["pscAutoDnsEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscConfig.prototype, "_pscWriteEndpointDnsEnabled", { + get: $util.oneOfGetter($oneOfFields = ["pscWriteEndpointDnsEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PscConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.PscConfig + * @static + * @param {google.cloud.sql.v1.IPscConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.PscConfig} PscConfig instance + */ + PscConfig.create = function create(properties) { + return new PscConfig(properties); + }; + + /** + * Encodes the specified PscConfig message. Does not implicitly {@link google.cloud.sql.v1.PscConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.PscConfig + * @static + * @param {google.cloud.sql.v1.IPscConfig} message PscConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PscConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pscEnabled != null && Object.hasOwnProperty.call(message, "pscEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.pscEnabled); + if (message.allowedConsumerProjects != null && message.allowedConsumerProjects.length) + for (var i = 0; i < message.allowedConsumerProjects.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.allowedConsumerProjects[i]); + if (message.pscAutoConnections != null && message.pscAutoConnections.length) + for (var i = 0; i < message.pscAutoConnections.length; ++i) + $root.google.cloud.sql.v1.PscAutoConnectionConfig.encode(message.pscAutoConnections[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.networkAttachmentUri != null && Object.hasOwnProperty.call(message, "networkAttachmentUri")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.networkAttachmentUri); + if (message.pscAutoDnsEnabled != null && Object.hasOwnProperty.call(message, "pscAutoDnsEnabled")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.pscAutoDnsEnabled); + if (message.pscWriteEndpointDnsEnabled != null && Object.hasOwnProperty.call(message, "pscWriteEndpointDnsEnabled")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.pscWriteEndpointDnsEnabled); + return writer; + }; + + /** + * Encodes the specified PscConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PscConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.PscConfig + * @static + * @param {google.cloud.sql.v1.IPscConfig} message PscConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PscConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PscConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.PscConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.PscConfig} PscConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PscConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PscConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.pscEnabled = reader.bool(); + break; + } + case 2: { + if (!(message.allowedConsumerProjects && message.allowedConsumerProjects.length)) + message.allowedConsumerProjects = []; + message.allowedConsumerProjects.push(reader.string()); + break; + } + case 3: { + if (!(message.pscAutoConnections && message.pscAutoConnections.length)) + message.pscAutoConnections = []; + message.pscAutoConnections.push($root.google.cloud.sql.v1.PscAutoConnectionConfig.decode(reader, reader.uint32())); + break; + } + case 4: { + message.networkAttachmentUri = reader.string(); + break; + } + case 5: { + message.pscAutoDnsEnabled = reader.bool(); + break; + } + case 6: { + message.pscWriteEndpointDnsEnabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PscConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.PscConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.PscConfig} PscConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PscConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PscConfig message. + * @function verify + * @memberof google.cloud.sql.v1.PscConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PscConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) { + properties._pscEnabled = 1; + if (typeof message.pscEnabled !== "boolean") + return "pscEnabled: boolean expected"; + } + if (message.allowedConsumerProjects != null && message.hasOwnProperty("allowedConsumerProjects")) { + if (!Array.isArray(message.allowedConsumerProjects)) + return "allowedConsumerProjects: array expected"; + for (var i = 0; i < message.allowedConsumerProjects.length; ++i) + if (!$util.isString(message.allowedConsumerProjects[i])) + return "allowedConsumerProjects: string[] expected"; + } + if (message.pscAutoConnections != null && message.hasOwnProperty("pscAutoConnections")) { + if (!Array.isArray(message.pscAutoConnections)) + return "pscAutoConnections: array expected"; + for (var i = 0; i < message.pscAutoConnections.length; ++i) { + var error = $root.google.cloud.sql.v1.PscAutoConnectionConfig.verify(message.pscAutoConnections[i]); + if (error) + return "pscAutoConnections." + error; + } + } + if (message.networkAttachmentUri != null && message.hasOwnProperty("networkAttachmentUri")) + if (!$util.isString(message.networkAttachmentUri)) + return "networkAttachmentUri: string expected"; + if (message.pscAutoDnsEnabled != null && message.hasOwnProperty("pscAutoDnsEnabled")) { + properties._pscAutoDnsEnabled = 1; + if (typeof message.pscAutoDnsEnabled !== "boolean") + return "pscAutoDnsEnabled: boolean expected"; + } + if (message.pscWriteEndpointDnsEnabled != null && message.hasOwnProperty("pscWriteEndpointDnsEnabled")) { + properties._pscWriteEndpointDnsEnabled = 1; + if (typeof message.pscWriteEndpointDnsEnabled !== "boolean") + return "pscWriteEndpointDnsEnabled: boolean expected"; + } + return null; + }; + + /** + * Creates a PscConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.PscConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.PscConfig} PscConfig + */ + PscConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.PscConfig) + return object; + var message = new $root.google.cloud.sql.v1.PscConfig(); + if (object.pscEnabled != null) + message.pscEnabled = Boolean(object.pscEnabled); + if (object.allowedConsumerProjects) { + if (!Array.isArray(object.allowedConsumerProjects)) + throw TypeError(".google.cloud.sql.v1.PscConfig.allowedConsumerProjects: array expected"); + message.allowedConsumerProjects = []; + for (var i = 0; i < object.allowedConsumerProjects.length; ++i) + message.allowedConsumerProjects[i] = String(object.allowedConsumerProjects[i]); + } + if (object.pscAutoConnections) { + if (!Array.isArray(object.pscAutoConnections)) + throw TypeError(".google.cloud.sql.v1.PscConfig.pscAutoConnections: array expected"); + message.pscAutoConnections = []; + for (var i = 0; i < object.pscAutoConnections.length; ++i) { + if (typeof object.pscAutoConnections[i] !== "object") + throw TypeError(".google.cloud.sql.v1.PscConfig.pscAutoConnections: object expected"); + message.pscAutoConnections[i] = $root.google.cloud.sql.v1.PscAutoConnectionConfig.fromObject(object.pscAutoConnections[i]); + } + } + if (object.networkAttachmentUri != null) + message.networkAttachmentUri = String(object.networkAttachmentUri); + if (object.pscAutoDnsEnabled != null) + message.pscAutoDnsEnabled = Boolean(object.pscAutoDnsEnabled); + if (object.pscWriteEndpointDnsEnabled != null) + message.pscWriteEndpointDnsEnabled = Boolean(object.pscWriteEndpointDnsEnabled); + return message; + }; + + /** + * Creates a plain object from a PscConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.PscConfig + * @static + * @param {google.cloud.sql.v1.PscConfig} message PscConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PscConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.allowedConsumerProjects = []; + object.pscAutoConnections = []; + } + if (options.defaults) + object.networkAttachmentUri = ""; + if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) { + object.pscEnabled = message.pscEnabled; + if (options.oneofs) + object._pscEnabled = "pscEnabled"; + } + if (message.allowedConsumerProjects && message.allowedConsumerProjects.length) { + object.allowedConsumerProjects = []; + for (var j = 0; j < message.allowedConsumerProjects.length; ++j) + object.allowedConsumerProjects[j] = message.allowedConsumerProjects[j]; + } + if (message.pscAutoConnections && message.pscAutoConnections.length) { + object.pscAutoConnections = []; + for (var j = 0; j < message.pscAutoConnections.length; ++j) + object.pscAutoConnections[j] = $root.google.cloud.sql.v1.PscAutoConnectionConfig.toObject(message.pscAutoConnections[j], options); + } + if (message.networkAttachmentUri != null && message.hasOwnProperty("networkAttachmentUri")) + object.networkAttachmentUri = message.networkAttachmentUri; + if (message.pscAutoDnsEnabled != null && message.hasOwnProperty("pscAutoDnsEnabled")) { + object.pscAutoDnsEnabled = message.pscAutoDnsEnabled; + if (options.oneofs) + object._pscAutoDnsEnabled = "pscAutoDnsEnabled"; + } + if (message.pscWriteEndpointDnsEnabled != null && message.hasOwnProperty("pscWriteEndpointDnsEnabled")) { + object.pscWriteEndpointDnsEnabled = message.pscWriteEndpointDnsEnabled; + if (options.oneofs) + object._pscWriteEndpointDnsEnabled = "pscWriteEndpointDnsEnabled"; + } + return object; + }; + + /** + * Converts this PscConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.PscConfig + * @instance + * @returns {Object.} JSON object + */ + PscConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PscConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.PscConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PscConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.PscConfig"; + }; + + return PscConfig; + })(); + + v1.PscAutoConnectionConfig = (function() { + + /** + * Properties of a PscAutoConnectionConfig. + * @memberof google.cloud.sql.v1 + * @interface IPscAutoConnectionConfig + * @property {string|null} [consumerProject] PscAutoConnectionConfig consumerProject + * @property {string|null} [consumerNetwork] PscAutoConnectionConfig consumerNetwork + * @property {string|null} [ipAddress] PscAutoConnectionConfig ipAddress + * @property {string|null} [status] PscAutoConnectionConfig status + * @property {string|null} [consumerNetworkStatus] PscAutoConnectionConfig consumerNetworkStatus + */ + + /** + * Constructs a new PscAutoConnectionConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a PscAutoConnectionConfig. + * @implements IPscAutoConnectionConfig + * @constructor + * @param {google.cloud.sql.v1.IPscAutoConnectionConfig=} [properties] Properties to set + */ + function PscAutoConnectionConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PscAutoConnectionConfig consumerProject. + * @member {string} consumerProject + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @instance + */ + PscAutoConnectionConfig.prototype.consumerProject = ""; + + /** + * PscAutoConnectionConfig consumerNetwork. + * @member {string} consumerNetwork + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @instance + */ + PscAutoConnectionConfig.prototype.consumerNetwork = ""; + + /** + * PscAutoConnectionConfig ipAddress. + * @member {string|null|undefined} ipAddress + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @instance + */ + PscAutoConnectionConfig.prototype.ipAddress = null; + + /** + * PscAutoConnectionConfig status. + * @member {string|null|undefined} status + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @instance + */ + PscAutoConnectionConfig.prototype.status = null; + + /** + * PscAutoConnectionConfig consumerNetworkStatus. + * @member {string|null|undefined} consumerNetworkStatus + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @instance + */ + PscAutoConnectionConfig.prototype.consumerNetworkStatus = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscAutoConnectionConfig.prototype, "_ipAddress", { + get: $util.oneOfGetter($oneOfFields = ["ipAddress"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscAutoConnectionConfig.prototype, "_status", { + get: $util.oneOfGetter($oneOfFields = ["status"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscAutoConnectionConfig.prototype, "_consumerNetworkStatus", { + get: $util.oneOfGetter($oneOfFields = ["consumerNetworkStatus"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PscAutoConnectionConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @static + * @param {google.cloud.sql.v1.IPscAutoConnectionConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.PscAutoConnectionConfig} PscAutoConnectionConfig instance + */ + PscAutoConnectionConfig.create = function create(properties) { + return new PscAutoConnectionConfig(properties); + }; + + /** + * Encodes the specified PscAutoConnectionConfig message. Does not implicitly {@link google.cloud.sql.v1.PscAutoConnectionConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @static + * @param {google.cloud.sql.v1.IPscAutoConnectionConfig} message PscAutoConnectionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PscAutoConnectionConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.consumerProject != null && Object.hasOwnProperty.call(message, "consumerProject")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.consumerProject); + if (message.consumerNetwork != null && Object.hasOwnProperty.call(message, "consumerNetwork")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.consumerNetwork); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.ipAddress); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.status); + if (message.consumerNetworkStatus != null && Object.hasOwnProperty.call(message, "consumerNetworkStatus")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.consumerNetworkStatus); + return writer; + }; + + /** + * Encodes the specified PscAutoConnectionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PscAutoConnectionConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @static + * @param {google.cloud.sql.v1.IPscAutoConnectionConfig} message PscAutoConnectionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PscAutoConnectionConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PscAutoConnectionConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.PscAutoConnectionConfig} PscAutoConnectionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PscAutoConnectionConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PscAutoConnectionConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.consumerProject = reader.string(); + break; + } + case 2: { + message.consumerNetwork = reader.string(); + break; + } + case 3: { + message.ipAddress = reader.string(); + break; + } + case 4: { + message.status = reader.string(); + break; + } + case 5: { + message.consumerNetworkStatus = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PscAutoConnectionConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.PscAutoConnectionConfig} PscAutoConnectionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PscAutoConnectionConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PscAutoConnectionConfig message. + * @function verify + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PscAutoConnectionConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.consumerProject != null && message.hasOwnProperty("consumerProject")) + if (!$util.isString(message.consumerProject)) + return "consumerProject: string expected"; + if (message.consumerNetwork != null && message.hasOwnProperty("consumerNetwork")) + if (!$util.isString(message.consumerNetwork)) + return "consumerNetwork: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) { + properties._ipAddress = 1; + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + } + if (message.status != null && message.hasOwnProperty("status")) { + properties._status = 1; + if (!$util.isString(message.status)) + return "status: string expected"; + } + if (message.consumerNetworkStatus != null && message.hasOwnProperty("consumerNetworkStatus")) { + properties._consumerNetworkStatus = 1; + if (!$util.isString(message.consumerNetworkStatus)) + return "consumerNetworkStatus: string expected"; + } + return null; + }; + + /** + * Creates a PscAutoConnectionConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.PscAutoConnectionConfig} PscAutoConnectionConfig + */ + PscAutoConnectionConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.PscAutoConnectionConfig) + return object; + var message = new $root.google.cloud.sql.v1.PscAutoConnectionConfig(); + if (object.consumerProject != null) + message.consumerProject = String(object.consumerProject); + if (object.consumerNetwork != null) + message.consumerNetwork = String(object.consumerNetwork); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.status != null) + message.status = String(object.status); + if (object.consumerNetworkStatus != null) + message.consumerNetworkStatus = String(object.consumerNetworkStatus); + return message; + }; + + /** + * Creates a plain object from a PscAutoConnectionConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @static + * @param {google.cloud.sql.v1.PscAutoConnectionConfig} message PscAutoConnectionConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PscAutoConnectionConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.consumerProject = ""; + object.consumerNetwork = ""; + } + if (message.consumerProject != null && message.hasOwnProperty("consumerProject")) + object.consumerProject = message.consumerProject; + if (message.consumerNetwork != null && message.hasOwnProperty("consumerNetwork")) + object.consumerNetwork = message.consumerNetwork; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) { + object.ipAddress = message.ipAddress; + if (options.oneofs) + object._ipAddress = "ipAddress"; + } + if (message.status != null && message.hasOwnProperty("status")) { + object.status = message.status; + if (options.oneofs) + object._status = "status"; + } + if (message.consumerNetworkStatus != null && message.hasOwnProperty("consumerNetworkStatus")) { + object.consumerNetworkStatus = message.consumerNetworkStatus; + if (options.oneofs) + object._consumerNetworkStatus = "consumerNetworkStatus"; + } + return object; + }; + + /** + * Converts this PscAutoConnectionConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @instance + * @returns {Object.} JSON object + */ + PscAutoConnectionConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PscAutoConnectionConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.PscAutoConnectionConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PscAutoConnectionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.PscAutoConnectionConfig"; + }; + + return PscAutoConnectionConfig; + })(); + + v1.LocationPreference = (function() { + + /** + * Properties of a LocationPreference. + * @memberof google.cloud.sql.v1 + * @interface ILocationPreference + * @property {string|null} [followGaeApplication] LocationPreference followGaeApplication + * @property {string|null} [zone] LocationPreference zone + * @property {string|null} [secondaryZone] LocationPreference secondaryZone + * @property {string|null} [kind] LocationPreference kind + */ + + /** + * Constructs a new LocationPreference. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a LocationPreference. + * @implements ILocationPreference + * @constructor + * @param {google.cloud.sql.v1.ILocationPreference=} [properties] Properties to set + */ + function LocationPreference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocationPreference followGaeApplication. + * @member {string} followGaeApplication + * @memberof google.cloud.sql.v1.LocationPreference + * @instance + */ + LocationPreference.prototype.followGaeApplication = ""; + + /** + * LocationPreference zone. + * @member {string} zone + * @memberof google.cloud.sql.v1.LocationPreference + * @instance + */ + LocationPreference.prototype.zone = ""; + + /** + * LocationPreference secondaryZone. + * @member {string} secondaryZone + * @memberof google.cloud.sql.v1.LocationPreference + * @instance + */ + LocationPreference.prototype.secondaryZone = ""; + + /** + * LocationPreference kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.LocationPreference + * @instance + */ + LocationPreference.prototype.kind = ""; + + /** + * Creates a new LocationPreference instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.LocationPreference + * @static + * @param {google.cloud.sql.v1.ILocationPreference=} [properties] Properties to set + * @returns {google.cloud.sql.v1.LocationPreference} LocationPreference instance + */ + LocationPreference.create = function create(properties) { + return new LocationPreference(properties); + }; + + /** + * Encodes the specified LocationPreference message. Does not implicitly {@link google.cloud.sql.v1.LocationPreference.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.LocationPreference + * @static + * @param {google.cloud.sql.v1.ILocationPreference} message LocationPreference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationPreference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.followGaeApplication != null && Object.hasOwnProperty.call(message, "followGaeApplication")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.followGaeApplication); + if (message.zone != null && Object.hasOwnProperty.call(message, "zone")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.zone); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + if (message.secondaryZone != null && Object.hasOwnProperty.call(message, "secondaryZone")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.secondaryZone); + return writer; + }; + + /** + * Encodes the specified LocationPreference message, length delimited. Does not implicitly {@link google.cloud.sql.v1.LocationPreference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.LocationPreference + * @static + * @param {google.cloud.sql.v1.ILocationPreference} message LocationPreference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationPreference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocationPreference message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.LocationPreference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.LocationPreference} LocationPreference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationPreference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.LocationPreference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.followGaeApplication = reader.string(); + break; + } + case 2: { + message.zone = reader.string(); + break; + } + case 4: { + message.secondaryZone = reader.string(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocationPreference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.LocationPreference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.LocationPreference} LocationPreference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationPreference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocationPreference message. + * @function verify + * @memberof google.cloud.sql.v1.LocationPreference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocationPreference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.followGaeApplication != null && message.hasOwnProperty("followGaeApplication")) + if (!$util.isString(message.followGaeApplication)) + return "followGaeApplication: string expected"; + if (message.zone != null && message.hasOwnProperty("zone")) + if (!$util.isString(message.zone)) + return "zone: string expected"; + if (message.secondaryZone != null && message.hasOwnProperty("secondaryZone")) + if (!$util.isString(message.secondaryZone)) + return "secondaryZone: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a LocationPreference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.LocationPreference + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.LocationPreference} LocationPreference + */ + LocationPreference.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.LocationPreference) + return object; + var message = new $root.google.cloud.sql.v1.LocationPreference(); + if (object.followGaeApplication != null) + message.followGaeApplication = String(object.followGaeApplication); + if (object.zone != null) + message.zone = String(object.zone); + if (object.secondaryZone != null) + message.secondaryZone = String(object.secondaryZone); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a LocationPreference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.LocationPreference + * @static + * @param {google.cloud.sql.v1.LocationPreference} message LocationPreference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocationPreference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.followGaeApplication = ""; + object.zone = ""; + object.kind = ""; + object.secondaryZone = ""; + } + if (message.followGaeApplication != null && message.hasOwnProperty("followGaeApplication")) + object.followGaeApplication = message.followGaeApplication; + if (message.zone != null && message.hasOwnProperty("zone")) + object.zone = message.zone; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.secondaryZone != null && message.hasOwnProperty("secondaryZone")) + object.secondaryZone = message.secondaryZone; + return object; + }; + + /** + * Converts this LocationPreference to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.LocationPreference + * @instance + * @returns {Object.} JSON object + */ + LocationPreference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LocationPreference + * @function getTypeUrl + * @memberof google.cloud.sql.v1.LocationPreference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LocationPreference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.LocationPreference"; + }; + + return LocationPreference; + })(); + + v1.MaintenanceWindow = (function() { + + /** + * Properties of a MaintenanceWindow. + * @memberof google.cloud.sql.v1 + * @interface IMaintenanceWindow + * @property {google.protobuf.IInt32Value|null} [hour] MaintenanceWindow hour + * @property {google.protobuf.IInt32Value|null} [day] MaintenanceWindow day + * @property {google.cloud.sql.v1.SqlUpdateTrack|null} [updateTrack] MaintenanceWindow updateTrack + * @property {string|null} [kind] MaintenanceWindow kind + */ + + /** + * Constructs a new MaintenanceWindow. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a MaintenanceWindow. + * @implements IMaintenanceWindow + * @constructor + * @param {google.cloud.sql.v1.IMaintenanceWindow=} [properties] Properties to set + */ + function MaintenanceWindow(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MaintenanceWindow hour. + * @member {google.protobuf.IInt32Value|null|undefined} hour + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @instance + */ + MaintenanceWindow.prototype.hour = null; + + /** + * MaintenanceWindow day. + * @member {google.protobuf.IInt32Value|null|undefined} day + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @instance + */ + MaintenanceWindow.prototype.day = null; + + /** + * MaintenanceWindow updateTrack. + * @member {google.cloud.sql.v1.SqlUpdateTrack} updateTrack + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @instance + */ + MaintenanceWindow.prototype.updateTrack = 0; + + /** + * MaintenanceWindow kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @instance + */ + MaintenanceWindow.prototype.kind = ""; + + /** + * Creates a new MaintenanceWindow instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @static + * @param {google.cloud.sql.v1.IMaintenanceWindow=} [properties] Properties to set + * @returns {google.cloud.sql.v1.MaintenanceWindow} MaintenanceWindow instance + */ + MaintenanceWindow.create = function create(properties) { + return new MaintenanceWindow(properties); + }; + + /** + * Encodes the specified MaintenanceWindow message. Does not implicitly {@link google.cloud.sql.v1.MaintenanceWindow.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @static + * @param {google.cloud.sql.v1.IMaintenanceWindow} message MaintenanceWindow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MaintenanceWindow.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hour != null && Object.hasOwnProperty.call(message, "hour")) + $root.google.protobuf.Int32Value.encode(message.hour, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.day != null && Object.hasOwnProperty.call(message, "day")) + $root.google.protobuf.Int32Value.encode(message.day, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateTrack != null && Object.hasOwnProperty.call(message, "updateTrack")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.updateTrack); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); + return writer; + }; + + /** + * Encodes the specified MaintenanceWindow message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MaintenanceWindow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @static + * @param {google.cloud.sql.v1.IMaintenanceWindow} message MaintenanceWindow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MaintenanceWindow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MaintenanceWindow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.MaintenanceWindow} MaintenanceWindow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MaintenanceWindow.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.MaintenanceWindow(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.hour = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 2: { + message.day = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateTrack = reader.int32(); + break; + } + case 4: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MaintenanceWindow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.MaintenanceWindow} MaintenanceWindow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MaintenanceWindow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MaintenanceWindow message. + * @function verify + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MaintenanceWindow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hour != null && message.hasOwnProperty("hour")) { + var error = $root.google.protobuf.Int32Value.verify(message.hour); + if (error) + return "hour." + error; + } + if (message.day != null && message.hasOwnProperty("day")) { + var error = $root.google.protobuf.Int32Value.verify(message.day); + if (error) + return "day." + error; + } + if (message.updateTrack != null && message.hasOwnProperty("updateTrack")) + switch (message.updateTrack) { + default: + return "updateTrack: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a MaintenanceWindow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.MaintenanceWindow} MaintenanceWindow + */ + MaintenanceWindow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.MaintenanceWindow) + return object; + var message = new $root.google.cloud.sql.v1.MaintenanceWindow(); + if (object.hour != null) { + if (typeof object.hour !== "object") + throw TypeError(".google.cloud.sql.v1.MaintenanceWindow.hour: object expected"); + message.hour = $root.google.protobuf.Int32Value.fromObject(object.hour); + } + if (object.day != null) { + if (typeof object.day !== "object") + throw TypeError(".google.cloud.sql.v1.MaintenanceWindow.day: object expected"); + message.day = $root.google.protobuf.Int32Value.fromObject(object.day); + } + switch (object.updateTrack) { + default: + if (typeof object.updateTrack === "number") { + message.updateTrack = object.updateTrack; + break; + } + break; + case "SQL_UPDATE_TRACK_UNSPECIFIED": + case 0: + message.updateTrack = 0; + break; + case "canary": + case 1: + message.updateTrack = 1; + break; + case "stable": + case 2: + message.updateTrack = 2; + break; + case "week5": + case 3: + message.updateTrack = 3; + break; + } + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a MaintenanceWindow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @static + * @param {google.cloud.sql.v1.MaintenanceWindow} message MaintenanceWindow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MaintenanceWindow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.hour = null; + object.day = null; + object.updateTrack = options.enums === String ? "SQL_UPDATE_TRACK_UNSPECIFIED" : 0; + object.kind = ""; + } + if (message.hour != null && message.hasOwnProperty("hour")) + object.hour = $root.google.protobuf.Int32Value.toObject(message.hour, options); + if (message.day != null && message.hasOwnProperty("day")) + object.day = $root.google.protobuf.Int32Value.toObject(message.day, options); + if (message.updateTrack != null && message.hasOwnProperty("updateTrack")) + object.updateTrack = options.enums === String ? $root.google.cloud.sql.v1.SqlUpdateTrack[message.updateTrack] === undefined ? message.updateTrack : $root.google.cloud.sql.v1.SqlUpdateTrack[message.updateTrack] : message.updateTrack; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this MaintenanceWindow to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @instance + * @returns {Object.} JSON object + */ + MaintenanceWindow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MaintenanceWindow + * @function getTypeUrl + * @memberof google.cloud.sql.v1.MaintenanceWindow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MaintenanceWindow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.MaintenanceWindow"; + }; + + return MaintenanceWindow; + })(); + + v1.DenyMaintenancePeriod = (function() { + + /** + * Properties of a DenyMaintenancePeriod. + * @memberof google.cloud.sql.v1 + * @interface IDenyMaintenancePeriod + * @property {string|null} [startDate] DenyMaintenancePeriod startDate + * @property {string|null} [endDate] DenyMaintenancePeriod endDate + * @property {string|null} [time] DenyMaintenancePeriod time + */ + + /** + * Constructs a new DenyMaintenancePeriod. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DenyMaintenancePeriod. + * @implements IDenyMaintenancePeriod + * @constructor + * @param {google.cloud.sql.v1.IDenyMaintenancePeriod=} [properties] Properties to set + */ + function DenyMaintenancePeriod(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DenyMaintenancePeriod startDate. + * @member {string} startDate + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @instance + */ + DenyMaintenancePeriod.prototype.startDate = ""; + + /** + * DenyMaintenancePeriod endDate. + * @member {string} endDate + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @instance + */ + DenyMaintenancePeriod.prototype.endDate = ""; + + /** + * DenyMaintenancePeriod time. + * @member {string} time + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @instance + */ + DenyMaintenancePeriod.prototype.time = ""; + + /** + * Creates a new DenyMaintenancePeriod instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @static + * @param {google.cloud.sql.v1.IDenyMaintenancePeriod=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DenyMaintenancePeriod} DenyMaintenancePeriod instance + */ + DenyMaintenancePeriod.create = function create(properties) { + return new DenyMaintenancePeriod(properties); + }; + + /** + * Encodes the specified DenyMaintenancePeriod message. Does not implicitly {@link google.cloud.sql.v1.DenyMaintenancePeriod.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @static + * @param {google.cloud.sql.v1.IDenyMaintenancePeriod} message DenyMaintenancePeriod message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DenyMaintenancePeriod.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startDate != null && Object.hasOwnProperty.call(message, "startDate")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.startDate); + if (message.endDate != null && Object.hasOwnProperty.call(message, "endDate")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.endDate); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.time); + return writer; + }; + + /** + * Encodes the specified DenyMaintenancePeriod message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DenyMaintenancePeriod.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @static + * @param {google.cloud.sql.v1.IDenyMaintenancePeriod} message DenyMaintenancePeriod message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DenyMaintenancePeriod.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DenyMaintenancePeriod message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DenyMaintenancePeriod} DenyMaintenancePeriod + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DenyMaintenancePeriod.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DenyMaintenancePeriod(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startDate = reader.string(); + break; + } + case 2: { + message.endDate = reader.string(); + break; + } + case 3: { + message.time = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DenyMaintenancePeriod message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DenyMaintenancePeriod} DenyMaintenancePeriod + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DenyMaintenancePeriod.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DenyMaintenancePeriod message. + * @function verify + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DenyMaintenancePeriod.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startDate != null && message.hasOwnProperty("startDate")) + if (!$util.isString(message.startDate)) + return "startDate: string expected"; + if (message.endDate != null && message.hasOwnProperty("endDate")) + if (!$util.isString(message.endDate)) + return "endDate: string expected"; + if (message.time != null && message.hasOwnProperty("time")) + if (!$util.isString(message.time)) + return "time: string expected"; + return null; + }; + + /** + * Creates a DenyMaintenancePeriod message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DenyMaintenancePeriod} DenyMaintenancePeriod + */ + DenyMaintenancePeriod.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DenyMaintenancePeriod) + return object; + var message = new $root.google.cloud.sql.v1.DenyMaintenancePeriod(); + if (object.startDate != null) + message.startDate = String(object.startDate); + if (object.endDate != null) + message.endDate = String(object.endDate); + if (object.time != null) + message.time = String(object.time); + return message; + }; + + /** + * Creates a plain object from a DenyMaintenancePeriod message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @static + * @param {google.cloud.sql.v1.DenyMaintenancePeriod} message DenyMaintenancePeriod + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DenyMaintenancePeriod.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startDate = ""; + object.endDate = ""; + object.time = ""; + } + if (message.startDate != null && message.hasOwnProperty("startDate")) + object.startDate = message.startDate; + if (message.endDate != null && message.hasOwnProperty("endDate")) + object.endDate = message.endDate; + if (message.time != null && message.hasOwnProperty("time")) + object.time = message.time; + return object; + }; + + /** + * Converts this DenyMaintenancePeriod to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @instance + * @returns {Object.} JSON object + */ + DenyMaintenancePeriod.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DenyMaintenancePeriod + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DenyMaintenancePeriod + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DenyMaintenancePeriod.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DenyMaintenancePeriod"; + }; + + return DenyMaintenancePeriod; + })(); + + v1.InsightsConfig = (function() { + + /** + * Properties of an InsightsConfig. + * @memberof google.cloud.sql.v1 + * @interface IInsightsConfig + * @property {boolean|null} [queryInsightsEnabled] InsightsConfig queryInsightsEnabled + * @property {boolean|null} [recordClientAddress] InsightsConfig recordClientAddress + * @property {boolean|null} [recordApplicationTags] InsightsConfig recordApplicationTags + * @property {google.protobuf.IInt32Value|null} [queryStringLength] InsightsConfig queryStringLength + * @property {google.protobuf.IInt32Value|null} [queryPlansPerMinute] InsightsConfig queryPlansPerMinute + * @property {google.protobuf.IBoolValue|null} [enhancedQueryInsightsEnabled] InsightsConfig enhancedQueryInsightsEnabled + */ + + /** + * Constructs a new InsightsConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InsightsConfig. + * @implements IInsightsConfig + * @constructor + * @param {google.cloud.sql.v1.IInsightsConfig=} [properties] Properties to set + */ + function InsightsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InsightsConfig queryInsightsEnabled. + * @member {boolean} queryInsightsEnabled + * @memberof google.cloud.sql.v1.InsightsConfig + * @instance + */ + InsightsConfig.prototype.queryInsightsEnabled = false; + + /** + * InsightsConfig recordClientAddress. + * @member {boolean} recordClientAddress + * @memberof google.cloud.sql.v1.InsightsConfig + * @instance + */ + InsightsConfig.prototype.recordClientAddress = false; + + /** + * InsightsConfig recordApplicationTags. + * @member {boolean} recordApplicationTags + * @memberof google.cloud.sql.v1.InsightsConfig + * @instance + */ + InsightsConfig.prototype.recordApplicationTags = false; + + /** + * InsightsConfig queryStringLength. + * @member {google.protobuf.IInt32Value|null|undefined} queryStringLength + * @memberof google.cloud.sql.v1.InsightsConfig + * @instance + */ + InsightsConfig.prototype.queryStringLength = null; + + /** + * InsightsConfig queryPlansPerMinute. + * @member {google.protobuf.IInt32Value|null|undefined} queryPlansPerMinute + * @memberof google.cloud.sql.v1.InsightsConfig + * @instance + */ + InsightsConfig.prototype.queryPlansPerMinute = null; + + /** + * InsightsConfig enhancedQueryInsightsEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} enhancedQueryInsightsEnabled + * @memberof google.cloud.sql.v1.InsightsConfig + * @instance + */ + InsightsConfig.prototype.enhancedQueryInsightsEnabled = null; + + /** + * Creates a new InsightsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InsightsConfig + * @static + * @param {google.cloud.sql.v1.IInsightsConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InsightsConfig} InsightsConfig instance + */ + InsightsConfig.create = function create(properties) { + return new InsightsConfig(properties); + }; + + /** + * Encodes the specified InsightsConfig message. Does not implicitly {@link google.cloud.sql.v1.InsightsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InsightsConfig + * @static + * @param {google.cloud.sql.v1.IInsightsConfig} message InsightsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InsightsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryInsightsEnabled != null && Object.hasOwnProperty.call(message, "queryInsightsEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.queryInsightsEnabled); + if (message.recordClientAddress != null && Object.hasOwnProperty.call(message, "recordClientAddress")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.recordClientAddress); + if (message.recordApplicationTags != null && Object.hasOwnProperty.call(message, "recordApplicationTags")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.recordApplicationTags); + if (message.queryStringLength != null && Object.hasOwnProperty.call(message, "queryStringLength")) + $root.google.protobuf.Int32Value.encode(message.queryStringLength, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.queryPlansPerMinute != null && Object.hasOwnProperty.call(message, "queryPlansPerMinute")) + $root.google.protobuf.Int32Value.encode(message.queryPlansPerMinute, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.enhancedQueryInsightsEnabled != null && Object.hasOwnProperty.call(message, "enhancedQueryInsightsEnabled")) + $root.google.protobuf.BoolValue.encode(message.enhancedQueryInsightsEnabled, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InsightsConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InsightsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InsightsConfig + * @static + * @param {google.cloud.sql.v1.IInsightsConfig} message InsightsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InsightsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InsightsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InsightsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InsightsConfig} InsightsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InsightsConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InsightsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.queryInsightsEnabled = reader.bool(); + break; + } + case 2: { + message.recordClientAddress = reader.bool(); + break; + } + case 3: { + message.recordApplicationTags = reader.bool(); + break; + } + case 4: { + message.queryStringLength = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 5: { + message.queryPlansPerMinute = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 8: { + message.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InsightsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InsightsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InsightsConfig} InsightsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InsightsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InsightsConfig message. + * @function verify + * @memberof google.cloud.sql.v1.InsightsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InsightsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryInsightsEnabled != null && message.hasOwnProperty("queryInsightsEnabled")) + if (typeof message.queryInsightsEnabled !== "boolean") + return "queryInsightsEnabled: boolean expected"; + if (message.recordClientAddress != null && message.hasOwnProperty("recordClientAddress")) + if (typeof message.recordClientAddress !== "boolean") + return "recordClientAddress: boolean expected"; + if (message.recordApplicationTags != null && message.hasOwnProperty("recordApplicationTags")) + if (typeof message.recordApplicationTags !== "boolean") + return "recordApplicationTags: boolean expected"; + if (message.queryStringLength != null && message.hasOwnProperty("queryStringLength")) { + var error = $root.google.protobuf.Int32Value.verify(message.queryStringLength); + if (error) + return "queryStringLength." + error; + } + if (message.queryPlansPerMinute != null && message.hasOwnProperty("queryPlansPerMinute")) { + var error = $root.google.protobuf.Int32Value.verify(message.queryPlansPerMinute); + if (error) + return "queryPlansPerMinute." + error; + } + if (message.enhancedQueryInsightsEnabled != null && message.hasOwnProperty("enhancedQueryInsightsEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.enhancedQueryInsightsEnabled); + if (error) + return "enhancedQueryInsightsEnabled." + error; + } + return null; + }; + + /** + * Creates an InsightsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InsightsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InsightsConfig} InsightsConfig + */ + InsightsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InsightsConfig) + return object; + var message = new $root.google.cloud.sql.v1.InsightsConfig(); + if (object.queryInsightsEnabled != null) + message.queryInsightsEnabled = Boolean(object.queryInsightsEnabled); + if (object.recordClientAddress != null) + message.recordClientAddress = Boolean(object.recordClientAddress); + if (object.recordApplicationTags != null) + message.recordApplicationTags = Boolean(object.recordApplicationTags); + if (object.queryStringLength != null) { + if (typeof object.queryStringLength !== "object") + throw TypeError(".google.cloud.sql.v1.InsightsConfig.queryStringLength: object expected"); + message.queryStringLength = $root.google.protobuf.Int32Value.fromObject(object.queryStringLength); + } + if (object.queryPlansPerMinute != null) { + if (typeof object.queryPlansPerMinute !== "object") + throw TypeError(".google.cloud.sql.v1.InsightsConfig.queryPlansPerMinute: object expected"); + message.queryPlansPerMinute = $root.google.protobuf.Int32Value.fromObject(object.queryPlansPerMinute); + } + if (object.enhancedQueryInsightsEnabled != null) { + if (typeof object.enhancedQueryInsightsEnabled !== "object") + throw TypeError(".google.cloud.sql.v1.InsightsConfig.enhancedQueryInsightsEnabled: object expected"); + message.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.fromObject(object.enhancedQueryInsightsEnabled); + } + return message; + }; + + /** + * Creates a plain object from an InsightsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InsightsConfig + * @static + * @param {google.cloud.sql.v1.InsightsConfig} message InsightsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InsightsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.queryInsightsEnabled = false; + object.recordClientAddress = false; + object.recordApplicationTags = false; + object.queryStringLength = null; + object.queryPlansPerMinute = null; + object.enhancedQueryInsightsEnabled = null; + } + if (message.queryInsightsEnabled != null && message.hasOwnProperty("queryInsightsEnabled")) + object.queryInsightsEnabled = message.queryInsightsEnabled; + if (message.recordClientAddress != null && message.hasOwnProperty("recordClientAddress")) + object.recordClientAddress = message.recordClientAddress; + if (message.recordApplicationTags != null && message.hasOwnProperty("recordApplicationTags")) + object.recordApplicationTags = message.recordApplicationTags; + if (message.queryStringLength != null && message.hasOwnProperty("queryStringLength")) + object.queryStringLength = $root.google.protobuf.Int32Value.toObject(message.queryStringLength, options); + if (message.queryPlansPerMinute != null && message.hasOwnProperty("queryPlansPerMinute")) + object.queryPlansPerMinute = $root.google.protobuf.Int32Value.toObject(message.queryPlansPerMinute, options); + if (message.enhancedQueryInsightsEnabled != null && message.hasOwnProperty("enhancedQueryInsightsEnabled")) + object.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.toObject(message.enhancedQueryInsightsEnabled, options); + return object; + }; + + /** + * Converts this InsightsConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InsightsConfig + * @instance + * @returns {Object.} JSON object + */ + InsightsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InsightsConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InsightsConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InsightsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InsightsConfig"; + }; + + return InsightsConfig; + })(); + + v1.MySqlReplicaConfiguration = (function() { + + /** + * Properties of a MySqlReplicaConfiguration. + * @memberof google.cloud.sql.v1 + * @interface IMySqlReplicaConfiguration + * @property {string|null} [dumpFilePath] MySqlReplicaConfiguration dumpFilePath + * @property {string|null} [username] MySqlReplicaConfiguration username + * @property {string|null} [password] MySqlReplicaConfiguration password + * @property {google.protobuf.IInt32Value|null} [connectRetryInterval] MySqlReplicaConfiguration connectRetryInterval + * @property {google.protobuf.IInt64Value|null} [masterHeartbeatPeriod] MySqlReplicaConfiguration masterHeartbeatPeriod + * @property {string|null} [caCertificate] MySqlReplicaConfiguration caCertificate + * @property {string|null} [clientCertificate] MySqlReplicaConfiguration clientCertificate + * @property {string|null} [clientKey] MySqlReplicaConfiguration clientKey + * @property {string|null} [sslCipher] MySqlReplicaConfiguration sslCipher + * @property {google.protobuf.IBoolValue|null} [verifyServerCertificate] MySqlReplicaConfiguration verifyServerCertificate + * @property {string|null} [kind] MySqlReplicaConfiguration kind + */ + + /** + * Constructs a new MySqlReplicaConfiguration. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a MySqlReplicaConfiguration. + * @implements IMySqlReplicaConfiguration + * @constructor + * @param {google.cloud.sql.v1.IMySqlReplicaConfiguration=} [properties] Properties to set + */ + function MySqlReplicaConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MySqlReplicaConfiguration dumpFilePath. + * @member {string} dumpFilePath + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.dumpFilePath = ""; + + /** + * MySqlReplicaConfiguration username. + * @member {string} username + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.username = ""; + + /** + * MySqlReplicaConfiguration password. + * @member {string} password + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.password = ""; + + /** + * MySqlReplicaConfiguration connectRetryInterval. + * @member {google.protobuf.IInt32Value|null|undefined} connectRetryInterval + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.connectRetryInterval = null; + + /** + * MySqlReplicaConfiguration masterHeartbeatPeriod. + * @member {google.protobuf.IInt64Value|null|undefined} masterHeartbeatPeriod + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.masterHeartbeatPeriod = null; + + /** + * MySqlReplicaConfiguration caCertificate. + * @member {string} caCertificate + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.caCertificate = ""; + + /** + * MySqlReplicaConfiguration clientCertificate. + * @member {string} clientCertificate + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.clientCertificate = ""; + + /** + * MySqlReplicaConfiguration clientKey. + * @member {string} clientKey + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.clientKey = ""; + + /** + * MySqlReplicaConfiguration sslCipher. + * @member {string} sslCipher + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.sslCipher = ""; + + /** + * MySqlReplicaConfiguration verifyServerCertificate. + * @member {google.protobuf.IBoolValue|null|undefined} verifyServerCertificate + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.verifyServerCertificate = null; + + /** + * MySqlReplicaConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.kind = ""; + + /** + * Creates a new MySqlReplicaConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.IMySqlReplicaConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1.MySqlReplicaConfiguration} MySqlReplicaConfiguration instance + */ + MySqlReplicaConfiguration.create = function create(properties) { + return new MySqlReplicaConfiguration(properties); + }; + + /** + * Encodes the specified MySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.MySqlReplicaConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.IMySqlReplicaConfiguration} message MySqlReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MySqlReplicaConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dumpFilePath != null && Object.hasOwnProperty.call(message, "dumpFilePath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.dumpFilePath); + if (message.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); + if (message.connectRetryInterval != null && Object.hasOwnProperty.call(message, "connectRetryInterval")) + $root.google.protobuf.Int32Value.encode(message.connectRetryInterval, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.masterHeartbeatPeriod != null && Object.hasOwnProperty.call(message, "masterHeartbeatPeriod")) + $root.google.protobuf.Int64Value.encode(message.masterHeartbeatPeriod, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.caCertificate); + if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.clientCertificate); + if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.clientKey); + if (message.sslCipher != null && Object.hasOwnProperty.call(message, "sslCipher")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.sslCipher); + if (message.verifyServerCertificate != null && Object.hasOwnProperty.call(message, "verifyServerCertificate")) + $root.google.protobuf.BoolValue.encode(message.verifyServerCertificate, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.kind); + return writer; + }; + + /** + * Encodes the specified MySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MySqlReplicaConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.IMySqlReplicaConfiguration} message MySqlReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MySqlReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.MySqlReplicaConfiguration} MySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MySqlReplicaConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.MySqlReplicaConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.dumpFilePath = reader.string(); + break; + } + case 2: { + message.username = reader.string(); + break; + } + case 3: { + message.password = reader.string(); + break; + } + case 4: { + message.connectRetryInterval = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 5: { + message.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 6: { + message.caCertificate = reader.string(); + break; + } + case 7: { + message.clientCertificate = reader.string(); + break; + } + case 8: { + message.clientKey = reader.string(); + break; + } + case 9: { + message.sslCipher = reader.string(); + break; + } + case 10: { + message.verifyServerCertificate = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 11: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.MySqlReplicaConfiguration} MySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MySqlReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MySqlReplicaConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MySqlReplicaConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) + if (!$util.isString(message.dumpFilePath)) + return "dumpFilePath: string expected"; + if (message.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.connectRetryInterval != null && message.hasOwnProperty("connectRetryInterval")) { + var error = $root.google.protobuf.Int32Value.verify(message.connectRetryInterval); + if (error) + return "connectRetryInterval." + error; + } + if (message.masterHeartbeatPeriod != null && message.hasOwnProperty("masterHeartbeatPeriod")) { + var error = $root.google.protobuf.Int64Value.verify(message.masterHeartbeatPeriod); + if (error) + return "masterHeartbeatPeriod." + error; + } + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + if (!$util.isString(message.caCertificate)) + return "caCertificate: string expected"; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + if (!$util.isString(message.clientCertificate)) + return "clientCertificate: string expected"; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + if (!$util.isString(message.clientKey)) + return "clientKey: string expected"; + if (message.sslCipher != null && message.hasOwnProperty("sslCipher")) + if (!$util.isString(message.sslCipher)) + return "sslCipher: string expected"; + if (message.verifyServerCertificate != null && message.hasOwnProperty("verifyServerCertificate")) { + var error = $root.google.protobuf.BoolValue.verify(message.verifyServerCertificate); + if (error) + return "verifyServerCertificate." + error; + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a MySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.MySqlReplicaConfiguration} MySqlReplicaConfiguration + */ + MySqlReplicaConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.MySqlReplicaConfiguration) + return object; + var message = new $root.google.cloud.sql.v1.MySqlReplicaConfiguration(); + if (object.dumpFilePath != null) + message.dumpFilePath = String(object.dumpFilePath); + if (object.username != null) + message.username = String(object.username); + if (object.password != null) + message.password = String(object.password); + if (object.connectRetryInterval != null) { + if (typeof object.connectRetryInterval !== "object") + throw TypeError(".google.cloud.sql.v1.MySqlReplicaConfiguration.connectRetryInterval: object expected"); + message.connectRetryInterval = $root.google.protobuf.Int32Value.fromObject(object.connectRetryInterval); + } + if (object.masterHeartbeatPeriod != null) { + if (typeof object.masterHeartbeatPeriod !== "object") + throw TypeError(".google.cloud.sql.v1.MySqlReplicaConfiguration.masterHeartbeatPeriod: object expected"); + message.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.fromObject(object.masterHeartbeatPeriod); + } + if (object.caCertificate != null) + message.caCertificate = String(object.caCertificate); + if (object.clientCertificate != null) + message.clientCertificate = String(object.clientCertificate); + if (object.clientKey != null) + message.clientKey = String(object.clientKey); + if (object.sslCipher != null) + message.sslCipher = String(object.sslCipher); + if (object.verifyServerCertificate != null) { + if (typeof object.verifyServerCertificate !== "object") + throw TypeError(".google.cloud.sql.v1.MySqlReplicaConfiguration.verifyServerCertificate: object expected"); + message.verifyServerCertificate = $root.google.protobuf.BoolValue.fromObject(object.verifyServerCertificate); + } + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a MySqlReplicaConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.MySqlReplicaConfiguration} message MySqlReplicaConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MySqlReplicaConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.dumpFilePath = ""; + object.username = ""; + object.password = ""; + object.connectRetryInterval = null; + object.masterHeartbeatPeriod = null; + object.caCertificate = ""; + object.clientCertificate = ""; + object.clientKey = ""; + object.sslCipher = ""; + object.verifyServerCertificate = null; + object.kind = ""; + } + if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) + object.dumpFilePath = message.dumpFilePath; + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + if (message.connectRetryInterval != null && message.hasOwnProperty("connectRetryInterval")) + object.connectRetryInterval = $root.google.protobuf.Int32Value.toObject(message.connectRetryInterval, options); + if (message.masterHeartbeatPeriod != null && message.hasOwnProperty("masterHeartbeatPeriod")) + object.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.toObject(message.masterHeartbeatPeriod, options); + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + object.caCertificate = message.caCertificate; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + object.clientCertificate = message.clientCertificate; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + object.clientKey = message.clientKey; + if (message.sslCipher != null && message.hasOwnProperty("sslCipher")) + object.sslCipher = message.sslCipher; + if (message.verifyServerCertificate != null && message.hasOwnProperty("verifyServerCertificate")) + object.verifyServerCertificate = $root.google.protobuf.BoolValue.toObject(message.verifyServerCertificate, options); + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this MySqlReplicaConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @instance + * @returns {Object.} JSON object + */ + MySqlReplicaConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MySqlReplicaConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MySqlReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.MySqlReplicaConfiguration"; + }; + + return MySqlReplicaConfiguration; + })(); + + v1.DiskEncryptionConfiguration = (function() { + + /** + * Properties of a DiskEncryptionConfiguration. + * @memberof google.cloud.sql.v1 + * @interface IDiskEncryptionConfiguration + * @property {string|null} [kmsKeyName] DiskEncryptionConfiguration kmsKeyName + * @property {string|null} [kind] DiskEncryptionConfiguration kind + */ + + /** + * Constructs a new DiskEncryptionConfiguration. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DiskEncryptionConfiguration. + * @implements IDiskEncryptionConfiguration + * @constructor + * @param {google.cloud.sql.v1.IDiskEncryptionConfiguration=} [properties] Properties to set + */ + function DiskEncryptionConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DiskEncryptionConfiguration kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @instance + */ + DiskEncryptionConfiguration.prototype.kmsKeyName = ""; + + /** + * DiskEncryptionConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @instance + */ + DiskEncryptionConfiguration.prototype.kind = ""; + + /** + * Creates a new DiskEncryptionConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @static + * @param {google.cloud.sql.v1.IDiskEncryptionConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DiskEncryptionConfiguration} DiskEncryptionConfiguration instance + */ + DiskEncryptionConfiguration.create = function create(properties) { + return new DiskEncryptionConfiguration(properties); + }; + + /** + * Encodes the specified DiskEncryptionConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @static + * @param {google.cloud.sql.v1.IDiskEncryptionConfiguration} message DiskEncryptionConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DiskEncryptionConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kmsKeyName); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + return writer; + }; + + /** + * Encodes the specified DiskEncryptionConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @static + * @param {google.cloud.sql.v1.IDiskEncryptionConfiguration} message DiskEncryptionConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DiskEncryptionConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DiskEncryptionConfiguration} DiskEncryptionConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DiskEncryptionConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DiskEncryptionConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kmsKeyName = reader.string(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DiskEncryptionConfiguration} DiskEncryptionConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DiskEncryptionConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DiskEncryptionConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DiskEncryptionConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a DiskEncryptionConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DiskEncryptionConfiguration} DiskEncryptionConfiguration + */ + DiskEncryptionConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DiskEncryptionConfiguration) + return object; + var message = new $root.google.cloud.sql.v1.DiskEncryptionConfiguration(); + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a DiskEncryptionConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @static + * @param {google.cloud.sql.v1.DiskEncryptionConfiguration} message DiskEncryptionConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DiskEncryptionConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kmsKeyName = ""; + object.kind = ""; + } + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this DiskEncryptionConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @instance + * @returns {Object.} JSON object + */ + DiskEncryptionConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DiskEncryptionConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DiskEncryptionConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DiskEncryptionConfiguration"; + }; + + return DiskEncryptionConfiguration; + })(); + + v1.DiskEncryptionStatus = (function() { + + /** + * Properties of a DiskEncryptionStatus. + * @memberof google.cloud.sql.v1 + * @interface IDiskEncryptionStatus + * @property {string|null} [kmsKeyVersionName] DiskEncryptionStatus kmsKeyVersionName + * @property {string|null} [kind] DiskEncryptionStatus kind + */ + + /** + * Constructs a new DiskEncryptionStatus. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DiskEncryptionStatus. + * @implements IDiskEncryptionStatus + * @constructor + * @param {google.cloud.sql.v1.IDiskEncryptionStatus=} [properties] Properties to set + */ + function DiskEncryptionStatus(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DiskEncryptionStatus kmsKeyVersionName. + * @member {string} kmsKeyVersionName + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @instance + */ + DiskEncryptionStatus.prototype.kmsKeyVersionName = ""; + + /** + * DiskEncryptionStatus kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @instance + */ + DiskEncryptionStatus.prototype.kind = ""; + + /** + * Creates a new DiskEncryptionStatus instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @static + * @param {google.cloud.sql.v1.IDiskEncryptionStatus=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DiskEncryptionStatus} DiskEncryptionStatus instance + */ + DiskEncryptionStatus.create = function create(properties) { + return new DiskEncryptionStatus(properties); + }; + + /** + * Encodes the specified DiskEncryptionStatus message. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionStatus.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @static + * @param {google.cloud.sql.v1.IDiskEncryptionStatus} message DiskEncryptionStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DiskEncryptionStatus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kmsKeyVersionName != null && Object.hasOwnProperty.call(message, "kmsKeyVersionName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kmsKeyVersionName); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + return writer; + }; + + /** + * Encodes the specified DiskEncryptionStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @static + * @param {google.cloud.sql.v1.IDiskEncryptionStatus} message DiskEncryptionStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DiskEncryptionStatus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DiskEncryptionStatus message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DiskEncryptionStatus} DiskEncryptionStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DiskEncryptionStatus.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DiskEncryptionStatus(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kmsKeyVersionName = reader.string(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DiskEncryptionStatus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DiskEncryptionStatus} DiskEncryptionStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DiskEncryptionStatus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DiskEncryptionStatus message. + * @function verify + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DiskEncryptionStatus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + if (!$util.isString(message.kmsKeyVersionName)) + return "kmsKeyVersionName: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a DiskEncryptionStatus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DiskEncryptionStatus} DiskEncryptionStatus + */ + DiskEncryptionStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DiskEncryptionStatus) + return object; + var message = new $root.google.cloud.sql.v1.DiskEncryptionStatus(); + if (object.kmsKeyVersionName != null) + message.kmsKeyVersionName = String(object.kmsKeyVersionName); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a DiskEncryptionStatus message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @static + * @param {google.cloud.sql.v1.DiskEncryptionStatus} message DiskEncryptionStatus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DiskEncryptionStatus.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kmsKeyVersionName = ""; + object.kind = ""; + } + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + object.kmsKeyVersionName = message.kmsKeyVersionName; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this DiskEncryptionStatus to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @instance + * @returns {Object.} JSON object + */ + DiskEncryptionStatus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DiskEncryptionStatus + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DiskEncryptionStatus + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DiskEncryptionStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DiskEncryptionStatus"; + }; + + return DiskEncryptionStatus; + })(); + + v1.IpMapping = (function() { + + /** + * Properties of an IpMapping. + * @memberof google.cloud.sql.v1 + * @interface IIpMapping + * @property {google.cloud.sql.v1.SqlIpAddressType|null} [type] IpMapping type + * @property {string|null} [ipAddress] IpMapping ipAddress + * @property {google.protobuf.ITimestamp|null} [timeToRetire] IpMapping timeToRetire + */ + + /** + * Constructs a new IpMapping. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an IpMapping. + * @implements IIpMapping + * @constructor + * @param {google.cloud.sql.v1.IIpMapping=} [properties] Properties to set + */ + function IpMapping(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IpMapping type. + * @member {google.cloud.sql.v1.SqlIpAddressType} type + * @memberof google.cloud.sql.v1.IpMapping + * @instance + */ + IpMapping.prototype.type = 0; + + /** + * IpMapping ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.sql.v1.IpMapping + * @instance + */ + IpMapping.prototype.ipAddress = ""; + + /** + * IpMapping timeToRetire. + * @member {google.protobuf.ITimestamp|null|undefined} timeToRetire + * @memberof google.cloud.sql.v1.IpMapping + * @instance + */ + IpMapping.prototype.timeToRetire = null; + + /** + * Creates a new IpMapping instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.IpMapping + * @static + * @param {google.cloud.sql.v1.IIpMapping=} [properties] Properties to set + * @returns {google.cloud.sql.v1.IpMapping} IpMapping instance + */ + IpMapping.create = function create(properties) { + return new IpMapping(properties); + }; + + /** + * Encodes the specified IpMapping message. Does not implicitly {@link google.cloud.sql.v1.IpMapping.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.IpMapping + * @static + * @param {google.cloud.sql.v1.IIpMapping} message IpMapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IpMapping.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.timeToRetire != null && Object.hasOwnProperty.call(message, "timeToRetire")) + $root.google.protobuf.Timestamp.encode(message.timeToRetire, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified IpMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1.IpMapping.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.IpMapping + * @static + * @param {google.cloud.sql.v1.IIpMapping} message IpMapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IpMapping.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IpMapping message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.IpMapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.IpMapping} IpMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IpMapping.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.IpMapping(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.int32(); + break; + } + case 2: { + message.ipAddress = reader.string(); + break; + } + case 3: { + message.timeToRetire = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IpMapping message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.IpMapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.IpMapping} IpMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IpMapping.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IpMapping message. + * @function verify + * @memberof google.cloud.sql.v1.IpMapping + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IpMapping.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.timeToRetire != null && message.hasOwnProperty("timeToRetire")) { + var error = $root.google.protobuf.Timestamp.verify(message.timeToRetire); + if (error) + return "timeToRetire." + error; + } + return null; + }; + + /** + * Creates an IpMapping message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.IpMapping + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.IpMapping} IpMapping + */ + IpMapping.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.IpMapping) + return object; + var message = new $root.google.cloud.sql.v1.IpMapping(); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SQL_IP_ADDRESS_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRIMARY": + case 1: + message.type = 1; + break; + case "OUTGOING": + case 2: + message.type = 2; + break; + case "PRIVATE": + case 3: + message.type = 3; + break; + case "MIGRATED_1ST_GEN": + case 4: + message.type = 4; + break; + } + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.timeToRetire != null) { + if (typeof object.timeToRetire !== "object") + throw TypeError(".google.cloud.sql.v1.IpMapping.timeToRetire: object expected"); + message.timeToRetire = $root.google.protobuf.Timestamp.fromObject(object.timeToRetire); + } + return message; + }; + + /** + * Creates a plain object from an IpMapping message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.IpMapping + * @static + * @param {google.cloud.sql.v1.IpMapping} message IpMapping + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IpMapping.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = options.enums === String ? "SQL_IP_ADDRESS_TYPE_UNSPECIFIED" : 0; + object.ipAddress = ""; + object.timeToRetire = null; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1.SqlIpAddressType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.SqlIpAddressType[message.type] : message.type; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.timeToRetire != null && message.hasOwnProperty("timeToRetire")) + object.timeToRetire = $root.google.protobuf.Timestamp.toObject(message.timeToRetire, options); + return object; + }; + + /** + * Converts this IpMapping to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.IpMapping + * @instance + * @returns {Object.} JSON object + */ + IpMapping.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IpMapping + * @function getTypeUrl + * @memberof google.cloud.sql.v1.IpMapping + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IpMapping.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.IpMapping"; + }; + + return IpMapping; + })(); + + /** + * SqlMaintenanceType enum. + * @name google.cloud.sql.v1.SqlMaintenanceType + * @enum {number} + * @property {number} SQL_MAINTENANCE_TYPE_UNSPECIFIED=0 SQL_MAINTENANCE_TYPE_UNSPECIFIED value + * @property {number} INSTANCE_MAINTENANCE=1 INSTANCE_MAINTENANCE value + * @property {number} REPLICA_INCLUDED_MAINTENANCE=2 REPLICA_INCLUDED_MAINTENANCE value + * @property {number} INSTANCE_SELF_SERVICE_MAINTENANCE=3 INSTANCE_SELF_SERVICE_MAINTENANCE value + * @property {number} REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE=4 REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE value + */ + v1.SqlMaintenanceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_MAINTENANCE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INSTANCE_MAINTENANCE"] = 1; + values[valuesById[2] = "REPLICA_INCLUDED_MAINTENANCE"] = 2; + values[valuesById[3] = "INSTANCE_SELF_SERVICE_MAINTENANCE"] = 3; + values[valuesById[4] = "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE"] = 4; + return values; + })(); + + v1.SqlSubOperationType = (function() { + + /** + * Properties of a SqlSubOperationType. + * @memberof google.cloud.sql.v1 + * @interface ISqlSubOperationType + * @property {google.cloud.sql.v1.SqlMaintenanceType|null} [maintenanceType] SqlSubOperationType maintenanceType + */ + + /** + * Constructs a new SqlSubOperationType. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlSubOperationType. + * @implements ISqlSubOperationType + * @constructor + * @param {google.cloud.sql.v1.ISqlSubOperationType=} [properties] Properties to set + */ + function SqlSubOperationType(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlSubOperationType maintenanceType. + * @member {google.cloud.sql.v1.SqlMaintenanceType|null|undefined} maintenanceType + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @instance + */ + SqlSubOperationType.prototype.maintenanceType = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SqlSubOperationType subOperationDetails. + * @member {"maintenanceType"|undefined} subOperationDetails + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @instance + */ + Object.defineProperty(SqlSubOperationType.prototype, "subOperationDetails", { + get: $util.oneOfGetter($oneOfFields = ["maintenanceType"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlSubOperationType instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @static + * @param {google.cloud.sql.v1.ISqlSubOperationType=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlSubOperationType} SqlSubOperationType instance + */ + SqlSubOperationType.create = function create(properties) { + return new SqlSubOperationType(properties); + }; + + /** + * Encodes the specified SqlSubOperationType message. Does not implicitly {@link google.cloud.sql.v1.SqlSubOperationType.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @static + * @param {google.cloud.sql.v1.ISqlSubOperationType} message SqlSubOperationType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSubOperationType.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.maintenanceType != null && Object.hasOwnProperty.call(message, "maintenanceType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.maintenanceType); + return writer; + }; + + /** + * Encodes the specified SqlSubOperationType message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSubOperationType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @static + * @param {google.cloud.sql.v1.ISqlSubOperationType} message SqlSubOperationType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSubOperationType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlSubOperationType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlSubOperationType} SqlSubOperationType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSubOperationType.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlSubOperationType(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.maintenanceType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlSubOperationType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlSubOperationType} SqlSubOperationType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSubOperationType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlSubOperationType message. + * @function verify + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlSubOperationType.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.maintenanceType != null && message.hasOwnProperty("maintenanceType")) { + properties.subOperationDetails = 1; + switch (message.maintenanceType) { + default: + return "maintenanceType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + } + return null; + }; + + /** + * Creates a SqlSubOperationType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlSubOperationType} SqlSubOperationType + */ + SqlSubOperationType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlSubOperationType) + return object; + var message = new $root.google.cloud.sql.v1.SqlSubOperationType(); + switch (object.maintenanceType) { + default: + if (typeof object.maintenanceType === "number") { + message.maintenanceType = object.maintenanceType; + break; + } + break; + case "SQL_MAINTENANCE_TYPE_UNSPECIFIED": + case 0: + message.maintenanceType = 0; + break; + case "INSTANCE_MAINTENANCE": + case 1: + message.maintenanceType = 1; + break; + case "REPLICA_INCLUDED_MAINTENANCE": + case 2: + message.maintenanceType = 2; + break; + case "INSTANCE_SELF_SERVICE_MAINTENANCE": + case 3: + message.maintenanceType = 3; + break; + case "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE": + case 4: + message.maintenanceType = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a SqlSubOperationType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @static + * @param {google.cloud.sql.v1.SqlSubOperationType} message SqlSubOperationType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlSubOperationType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.maintenanceType != null && message.hasOwnProperty("maintenanceType")) { + object.maintenanceType = options.enums === String ? $root.google.cloud.sql.v1.SqlMaintenanceType[message.maintenanceType] === undefined ? message.maintenanceType : $root.google.cloud.sql.v1.SqlMaintenanceType[message.maintenanceType] : message.maintenanceType; + if (options.oneofs) + object.subOperationDetails = "maintenanceType"; + } + return object; + }; + + /** + * Converts this SqlSubOperationType to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @instance + * @returns {Object.} JSON object + */ + SqlSubOperationType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlSubOperationType + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlSubOperationType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlSubOperationType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlSubOperationType"; + }; + + return SqlSubOperationType; + })(); + + v1.Operation = (function() { + + /** + * Properties of an Operation. + * @memberof google.cloud.sql.v1 + * @interface IOperation + * @property {string|null} [kind] Operation kind + * @property {string|null} [targetLink] Operation targetLink + * @property {google.cloud.sql.v1.Operation.SqlOperationStatus|null} [status] Operation status + * @property {string|null} [user] Operation user + * @property {google.protobuf.ITimestamp|null} [insertTime] Operation insertTime + * @property {google.protobuf.ITimestamp|null} [startTime] Operation startTime + * @property {google.protobuf.ITimestamp|null} [endTime] Operation endTime + * @property {google.cloud.sql.v1.IOperationErrors|null} [error] Operation error + * @property {google.cloud.sql.v1.IApiWarning|null} [apiWarning] Operation apiWarning + * @property {google.cloud.sql.v1.Operation.SqlOperationType|null} [operationType] Operation operationType + * @property {google.cloud.sql.v1.IImportContext|null} [importContext] Operation importContext + * @property {google.cloud.sql.v1.IExportContext|null} [exportContext] Operation exportContext + * @property {google.cloud.sql.v1.IBackupContext|null} [backupContext] Operation backupContext + * @property {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null} [preCheckMajorVersionUpgradeContext] Operation preCheckMajorVersionUpgradeContext + * @property {string|null} [name] Operation name + * @property {string|null} [targetId] Operation targetId + * @property {string|null} [selfLink] Operation selfLink + * @property {string|null} [targetProject] Operation targetProject + * @property {google.cloud.sql.v1.IAcquireSsrsLeaseContext|null} [acquireSsrsLeaseContext] Operation acquireSsrsLeaseContext + * @property {google.cloud.sql.v1.ISqlSubOperationType|null} [subOperationType] Operation subOperationType + */ + + /** + * Constructs a new Operation. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an Operation. + * @implements IOperation + * @constructor + * @param {google.cloud.sql.v1.IOperation=} [properties] Properties to set + */ + function Operation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Operation kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.kind = ""; + + /** + * Operation targetLink. + * @member {string} targetLink + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.targetLink = ""; + + /** + * Operation status. + * @member {google.cloud.sql.v1.Operation.SqlOperationStatus} status + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.status = 0; + + /** + * Operation user. + * @member {string} user + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.user = ""; + + /** + * Operation insertTime. + * @member {google.protobuf.ITimestamp|null|undefined} insertTime + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.insertTime = null; + + /** + * Operation startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.startTime = null; + + /** + * Operation endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.endTime = null; + + /** + * Operation error. + * @member {google.cloud.sql.v1.IOperationErrors|null|undefined} error + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.error = null; + + /** + * Operation apiWarning. + * @member {google.cloud.sql.v1.IApiWarning|null|undefined} apiWarning + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.apiWarning = null; + + /** + * Operation operationType. + * @member {google.cloud.sql.v1.Operation.SqlOperationType} operationType + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.operationType = 0; + + /** + * Operation importContext. + * @member {google.cloud.sql.v1.IImportContext|null|undefined} importContext + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.importContext = null; + + /** + * Operation exportContext. + * @member {google.cloud.sql.v1.IExportContext|null|undefined} exportContext + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.exportContext = null; + + /** + * Operation backupContext. + * @member {google.cloud.sql.v1.IBackupContext|null|undefined} backupContext + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.backupContext = null; + + /** + * Operation preCheckMajorVersionUpgradeContext. + * @member {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null|undefined} preCheckMajorVersionUpgradeContext + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.preCheckMajorVersionUpgradeContext = null; + + /** + * Operation name. + * @member {string} name + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.name = ""; + + /** + * Operation targetId. + * @member {string} targetId + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.targetId = ""; + + /** + * Operation selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.selfLink = ""; + + /** + * Operation targetProject. + * @member {string} targetProject + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.targetProject = ""; + + /** + * Operation acquireSsrsLeaseContext. + * @member {google.cloud.sql.v1.IAcquireSsrsLeaseContext|null|undefined} acquireSsrsLeaseContext + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.acquireSsrsLeaseContext = null; + + /** + * Operation subOperationType. + * @member {google.cloud.sql.v1.ISqlSubOperationType|null|undefined} subOperationType + * @memberof google.cloud.sql.v1.Operation + * @instance + */ + Operation.prototype.subOperationType = null; + + /** + * Creates a new Operation instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.Operation + * @static + * @param {google.cloud.sql.v1.IOperation=} [properties] Properties to set + * @returns {google.cloud.sql.v1.Operation} Operation instance + */ + Operation.create = function create(properties) { + return new Operation(properties); + }; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.cloud.sql.v1.Operation.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.Operation + * @static + * @param {google.cloud.sql.v1.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.targetLink != null && Object.hasOwnProperty.call(message, "targetLink")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetLink); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.status); + if (message.user != null && Object.hasOwnProperty.call(message, "user")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.user); + if (message.insertTime != null && Object.hasOwnProperty.call(message, "insertTime")) + $root.google.protobuf.Timestamp.encode(message.insertTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.cloud.sql.v1.OperationErrors.encode(message.error, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.operationType != null && Object.hasOwnProperty.call(message, "operationType")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.operationType); + if (message.importContext != null && Object.hasOwnProperty.call(message, "importContext")) + $root.google.cloud.sql.v1.ImportContext.encode(message.importContext, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.exportContext != null && Object.hasOwnProperty.call(message, "exportContext")) + $root.google.cloud.sql.v1.ExportContext.encode(message.exportContext, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.name); + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.targetId); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.selfLink); + if (message.targetProject != null && Object.hasOwnProperty.call(message, "targetProject")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.targetProject); + if (message.backupContext != null && Object.hasOwnProperty.call(message, "backupContext")) + $root.google.cloud.sql.v1.BackupContext.encode(message.backupContext, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.apiWarning != null && Object.hasOwnProperty.call(message, "apiWarning")) + $root.google.cloud.sql.v1.ApiWarning.encode(message.apiWarning, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + if (message.acquireSsrsLeaseContext != null && Object.hasOwnProperty.call(message, "acquireSsrsLeaseContext")) + $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.encode(message.acquireSsrsLeaseContext, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.subOperationType != null && Object.hasOwnProperty.call(message, "subOperationType")) + $root.google.cloud.sql.v1.SqlSubOperationType.encode(message.subOperationType, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); + if (message.preCheckMajorVersionUpgradeContext != null && Object.hasOwnProperty.call(message, "preCheckMajorVersionUpgradeContext")) + $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.encode(message.preCheckMajorVersionUpgradeContext, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Operation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.Operation + * @static + * @param {google.cloud.sql.v1.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Operation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.targetLink = reader.string(); + break; + } + case 3: { + message.status = reader.int32(); + break; + } + case 4: { + message.user = reader.string(); + break; + } + case 5: { + message.insertTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.error = $root.google.cloud.sql.v1.OperationErrors.decode(reader, reader.uint32()); + break; + } + case 19: { + message.apiWarning = $root.google.cloud.sql.v1.ApiWarning.decode(reader, reader.uint32()); + break; + } + case 9: { + message.operationType = reader.int32(); + break; + } + case 10: { + message.importContext = $root.google.cloud.sql.v1.ImportContext.decode(reader, reader.uint32()); + break; + } + case 11: { + message.exportContext = $root.google.cloud.sql.v1.ExportContext.decode(reader, reader.uint32()); + break; + } + case 17: { + message.backupContext = $root.google.cloud.sql.v1.BackupContext.decode(reader, reader.uint32()); + break; + } + case 50: { + message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.decode(reader, reader.uint32()); + break; + } + case 12: { + message.name = reader.string(); + break; + } + case 13: { + message.targetId = reader.string(); + break; + } + case 14: { + message.selfLink = reader.string(); + break; + } + case 15: { + message.targetProject = reader.string(); + break; + } + case 20: { + message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.decode(reader, reader.uint32()); + break; + } + case 48: { + message.subOperationType = $root.google.cloud.sql.v1.SqlSubOperationType.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Operation message. + * @function verify + * @memberof google.cloud.sql.v1.Operation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Operation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.targetLink != null && message.hasOwnProperty("targetLink")) + if (!$util.isString(message.targetLink)) + return "targetLink: string expected"; + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.user != null && message.hasOwnProperty("user")) + if (!$util.isString(message.user)) + return "user: string expected"; + if (message.insertTime != null && message.hasOwnProperty("insertTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.insertTime); + if (error) + return "insertTime." + error; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.cloud.sql.v1.OperationErrors.verify(message.error); + if (error) + return "error." + error; + } + if (message.apiWarning != null && message.hasOwnProperty("apiWarning")) { + var error = $root.google.cloud.sql.v1.ApiWarning.verify(message.apiWarning); + if (error) + return "apiWarning." + error; + } + if (message.operationType != null && message.hasOwnProperty("operationType")) + switch (message.operationType) { + default: + return "operationType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + break; + } + if (message.importContext != null && message.hasOwnProperty("importContext")) { + var error = $root.google.cloud.sql.v1.ImportContext.verify(message.importContext); + if (error) + return "importContext." + error; + } + if (message.exportContext != null && message.hasOwnProperty("exportContext")) { + var error = $root.google.cloud.sql.v1.ExportContext.verify(message.exportContext); + if (error) + return "exportContext." + error; + } + if (message.backupContext != null && message.hasOwnProperty("backupContext")) { + var error = $root.google.cloud.sql.v1.BackupContext.verify(message.backupContext); + if (error) + return "backupContext." + error; + } + if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) { + var error = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify(message.preCheckMajorVersionUpgradeContext); + if (error) + return "preCheckMajorVersionUpgradeContext." + error; + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.targetId != null && message.hasOwnProperty("targetId")) + if (!$util.isString(message.targetId)) + return "targetId: string expected"; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + if (message.targetProject != null && message.hasOwnProperty("targetProject")) + if (!$util.isString(message.targetProject)) + return "targetProject: string expected"; + if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) { + var error = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.verify(message.acquireSsrsLeaseContext); + if (error) + return "acquireSsrsLeaseContext." + error; + } + if (message.subOperationType != null && message.hasOwnProperty("subOperationType")) { + var error = $root.google.cloud.sql.v1.SqlSubOperationType.verify(message.subOperationType); + if (error) + return "subOperationType." + error; + } + return null; + }; + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.Operation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.Operation} Operation + */ + Operation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.Operation) + return object; + var message = new $root.google.cloud.sql.v1.Operation(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.targetLink != null) + message.targetLink = String(object.targetLink); + switch (object.status) { + default: + if (typeof object.status === "number") { + message.status = object.status; + break; + } + break; + case "SQL_OPERATION_STATUS_UNSPECIFIED": + case 0: + message.status = 0; + break; + case "PENDING": + case 1: + message.status = 1; + break; + case "RUNNING": + case 2: + message.status = 2; + break; + case "DONE": + case 3: + message.status = 3; + break; + } + if (object.user != null) + message.user = String(object.user); + if (object.insertTime != null) { + if (typeof object.insertTime !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.insertTime: object expected"); + message.insertTime = $root.google.protobuf.Timestamp.fromObject(object.insertTime); + } + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.error: object expected"); + message.error = $root.google.cloud.sql.v1.OperationErrors.fromObject(object.error); + } + if (object.apiWarning != null) { + if (typeof object.apiWarning !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.apiWarning: object expected"); + message.apiWarning = $root.google.cloud.sql.v1.ApiWarning.fromObject(object.apiWarning); + } + switch (object.operationType) { + default: + if (typeof object.operationType === "number") { + message.operationType = object.operationType; + break; + } + break; + case "SQL_OPERATION_TYPE_UNSPECIFIED": + case 0: + message.operationType = 0; + break; + case "IMPORT": + case 1: + message.operationType = 1; + break; + case "EXPORT": + case 2: + message.operationType = 2; + break; + case "CREATE": + case 3: + message.operationType = 3; + break; + case "UPDATE": + case 4: + message.operationType = 4; + break; + case "DELETE": + case 5: + message.operationType = 5; + break; + case "RESTART": + case 6: + message.operationType = 6; + break; + case "BACKUP": + case 7: + message.operationType = 7; + break; + case "SNAPSHOT": + case 8: + message.operationType = 8; + break; + case "BACKUP_VOLUME": + case 9: + message.operationType = 9; + break; + case "DELETE_VOLUME": + case 10: + message.operationType = 10; + break; + case "RESTORE_VOLUME": + case 11: + message.operationType = 11; + break; + case "INJECT_USER": + case 12: + message.operationType = 12; + break; + case "CLONE": + case 14: + message.operationType = 14; + break; + case "STOP_REPLICA": + case 15: + message.operationType = 15; + break; + case "START_REPLICA": + case 16: + message.operationType = 16; + break; + case "PROMOTE_REPLICA": + case 17: + message.operationType = 17; + break; + case "CREATE_REPLICA": + case 18: + message.operationType = 18; + break; + case "CREATE_USER": + case 19: + message.operationType = 19; + break; + case "DELETE_USER": + case 20: + message.operationType = 20; + break; + case "UPDATE_USER": + case 21: + message.operationType = 21; + break; + case "CREATE_DATABASE": + case 22: + message.operationType = 22; + break; + case "DELETE_DATABASE": + case 23: + message.operationType = 23; + break; + case "UPDATE_DATABASE": + case 24: + message.operationType = 24; + break; + case "FAILOVER": + case 25: + message.operationType = 25; + break; + case "DELETE_BACKUP": + case 26: + message.operationType = 26; + break; + case "RECREATE_REPLICA": + case 27: + message.operationType = 27; + break; + case "TRUNCATE_LOG": + case 28: + message.operationType = 28; + break; + case "DEMOTE_MASTER": + case 29: + message.operationType = 29; + break; + case "MAINTENANCE": + case 30: + message.operationType = 30; + break; + case "ENABLE_PRIVATE_IP": + case 31: + message.operationType = 31; + break; + case "DEFER_MAINTENANCE": + case 32: + message.operationType = 32; + break; + case "CREATE_CLONE": + case 33: + message.operationType = 33; + break; + case "RESCHEDULE_MAINTENANCE": + case 34: + message.operationType = 34; + break; + case "START_EXTERNAL_SYNC": + case 35: + message.operationType = 35; + break; + case "LOG_CLEANUP": + case 36: + message.operationType = 36; + break; + case "AUTO_RESTART": + case 37: + message.operationType = 37; + break; + case "REENCRYPT": + case 38: + message.operationType = 38; + break; + case "SWITCHOVER": + case 39: + message.operationType = 39; + break; + case "UPDATE_BACKUP": + case 40: + message.operationType = 40; + break; + case "ACQUIRE_SSRS_LEASE": + case 42: + message.operationType = 42; + break; + case "RELEASE_SSRS_LEASE": + case 43: + message.operationType = 43; + break; + case "RECONFIGURE_OLD_PRIMARY": + case 44: + message.operationType = 44; + break; + case "CLUSTER_MAINTENANCE": + case 45: + message.operationType = 45; + break; + case "SELF_SERVICE_MAINTENANCE": + case 46: + message.operationType = 46; + break; + case "SWITCHOVER_TO_REPLICA": + case 47: + message.operationType = 47; + break; + case "MAJOR_VERSION_UPGRADE": + case 48: + message.operationType = 48; + break; + case "ADVANCED_BACKUP": + case 49: + message.operationType = 49; + break; + case "MANAGE_BACKUP": + case 50: + message.operationType = 50; + break; + case "ENHANCED_BACKUP": + case 51: + message.operationType = 51; + break; + case "REPAIR_READ_POOL": + case 52: + message.operationType = 52; + break; + case "CREATE_READ_POOL": + case 53: + message.operationType = 53; + break; + case "PRE_CHECK_MAJOR_VERSION_UPGRADE": + case 54: + message.operationType = 54; + break; + } + if (object.importContext != null) { + if (typeof object.importContext !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.importContext: object expected"); + message.importContext = $root.google.cloud.sql.v1.ImportContext.fromObject(object.importContext); + } + if (object.exportContext != null) { + if (typeof object.exportContext !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.exportContext: object expected"); + message.exportContext = $root.google.cloud.sql.v1.ExportContext.fromObject(object.exportContext); + } + if (object.backupContext != null) { + if (typeof object.backupContext !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.backupContext: object expected"); + message.backupContext = $root.google.cloud.sql.v1.BackupContext.fromObject(object.backupContext); + } + if (object.preCheckMajorVersionUpgradeContext != null) { + if (typeof object.preCheckMajorVersionUpgradeContext !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.preCheckMajorVersionUpgradeContext: object expected"); + message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.fromObject(object.preCheckMajorVersionUpgradeContext); + } + if (object.name != null) + message.name = String(object.name); + if (object.targetId != null) + message.targetId = String(object.targetId); + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + if (object.targetProject != null) + message.targetProject = String(object.targetProject); + if (object.acquireSsrsLeaseContext != null) { + if (typeof object.acquireSsrsLeaseContext !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.acquireSsrsLeaseContext: object expected"); + message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.fromObject(object.acquireSsrsLeaseContext); + } + if (object.subOperationType != null) { + if (typeof object.subOperationType !== "object") + throw TypeError(".google.cloud.sql.v1.Operation.subOperationType: object expected"); + message.subOperationType = $root.google.cloud.sql.v1.SqlSubOperationType.fromObject(object.subOperationType); + } + return message; + }; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.Operation + * @static + * @param {google.cloud.sql.v1.Operation} message Operation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Operation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.targetLink = ""; + object.status = options.enums === String ? "SQL_OPERATION_STATUS_UNSPECIFIED" : 0; + object.user = ""; + object.insertTime = null; + object.startTime = null; + object.endTime = null; + object.error = null; + object.operationType = options.enums === String ? "SQL_OPERATION_TYPE_UNSPECIFIED" : 0; + object.importContext = null; + object.exportContext = null; + object.name = ""; + object.targetId = ""; + object.selfLink = ""; + object.targetProject = ""; + object.backupContext = null; + object.apiWarning = null; + object.acquireSsrsLeaseContext = null; + object.subOperationType = null; + object.preCheckMajorVersionUpgradeContext = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.targetLink != null && message.hasOwnProperty("targetLink")) + object.targetLink = message.targetLink; + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.google.cloud.sql.v1.Operation.SqlOperationStatus[message.status] === undefined ? message.status : $root.google.cloud.sql.v1.Operation.SqlOperationStatus[message.status] : message.status; + if (message.user != null && message.hasOwnProperty("user")) + object.user = message.user; + if (message.insertTime != null && message.hasOwnProperty("insertTime")) + object.insertTime = $root.google.protobuf.Timestamp.toObject(message.insertTime, options); + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.cloud.sql.v1.OperationErrors.toObject(message.error, options); + if (message.operationType != null && message.hasOwnProperty("operationType")) + object.operationType = options.enums === String ? $root.google.cloud.sql.v1.Operation.SqlOperationType[message.operationType] === undefined ? message.operationType : $root.google.cloud.sql.v1.Operation.SqlOperationType[message.operationType] : message.operationType; + if (message.importContext != null && message.hasOwnProperty("importContext")) + object.importContext = $root.google.cloud.sql.v1.ImportContext.toObject(message.importContext, options); + if (message.exportContext != null && message.hasOwnProperty("exportContext")) + object.exportContext = $root.google.cloud.sql.v1.ExportContext.toObject(message.exportContext, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.targetId != null && message.hasOwnProperty("targetId")) + object.targetId = message.targetId; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + if (message.targetProject != null && message.hasOwnProperty("targetProject")) + object.targetProject = message.targetProject; + if (message.backupContext != null && message.hasOwnProperty("backupContext")) + object.backupContext = $root.google.cloud.sql.v1.BackupContext.toObject(message.backupContext, options); + if (message.apiWarning != null && message.hasOwnProperty("apiWarning")) + object.apiWarning = $root.google.cloud.sql.v1.ApiWarning.toObject(message.apiWarning, options); + if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) + object.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.toObject(message.acquireSsrsLeaseContext, options); + if (message.subOperationType != null && message.hasOwnProperty("subOperationType")) + object.subOperationType = $root.google.cloud.sql.v1.SqlSubOperationType.toObject(message.subOperationType, options); + if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) + object.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.toObject(message.preCheckMajorVersionUpgradeContext, options); + return object; + }; + + /** + * Converts this Operation to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.Operation + * @instance + * @returns {Object.} JSON object + */ + Operation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Operation + * @function getTypeUrl + * @memberof google.cloud.sql.v1.Operation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.Operation"; + }; + + /** + * SqlOperationType enum. + * @name google.cloud.sql.v1.Operation.SqlOperationType + * @enum {number} + * @property {number} SQL_OPERATION_TYPE_UNSPECIFIED=0 SQL_OPERATION_TYPE_UNSPECIFIED value + * @property {number} IMPORT=1 IMPORT value + * @property {number} EXPORT=2 EXPORT value + * @property {number} CREATE=3 CREATE value + * @property {number} UPDATE=4 UPDATE value + * @property {number} DELETE=5 DELETE value + * @property {number} RESTART=6 RESTART value + * @property {number} BACKUP=7 BACKUP value + * @property {number} SNAPSHOT=8 SNAPSHOT value + * @property {number} BACKUP_VOLUME=9 BACKUP_VOLUME value + * @property {number} DELETE_VOLUME=10 DELETE_VOLUME value + * @property {number} RESTORE_VOLUME=11 RESTORE_VOLUME value + * @property {number} INJECT_USER=12 INJECT_USER value + * @property {number} CLONE=14 CLONE value + * @property {number} STOP_REPLICA=15 STOP_REPLICA value + * @property {number} START_REPLICA=16 START_REPLICA value + * @property {number} PROMOTE_REPLICA=17 PROMOTE_REPLICA value + * @property {number} CREATE_REPLICA=18 CREATE_REPLICA value + * @property {number} CREATE_USER=19 CREATE_USER value + * @property {number} DELETE_USER=20 DELETE_USER value + * @property {number} UPDATE_USER=21 UPDATE_USER value + * @property {number} CREATE_DATABASE=22 CREATE_DATABASE value + * @property {number} DELETE_DATABASE=23 DELETE_DATABASE value + * @property {number} UPDATE_DATABASE=24 UPDATE_DATABASE value + * @property {number} FAILOVER=25 FAILOVER value + * @property {number} DELETE_BACKUP=26 DELETE_BACKUP value + * @property {number} RECREATE_REPLICA=27 RECREATE_REPLICA value + * @property {number} TRUNCATE_LOG=28 TRUNCATE_LOG value + * @property {number} DEMOTE_MASTER=29 DEMOTE_MASTER value + * @property {number} MAINTENANCE=30 MAINTENANCE value + * @property {number} ENABLE_PRIVATE_IP=31 ENABLE_PRIVATE_IP value + * @property {number} DEFER_MAINTENANCE=32 DEFER_MAINTENANCE value + * @property {number} CREATE_CLONE=33 CREATE_CLONE value + * @property {number} RESCHEDULE_MAINTENANCE=34 RESCHEDULE_MAINTENANCE value + * @property {number} START_EXTERNAL_SYNC=35 START_EXTERNAL_SYNC value + * @property {number} LOG_CLEANUP=36 LOG_CLEANUP value + * @property {number} AUTO_RESTART=37 AUTO_RESTART value + * @property {number} REENCRYPT=38 REENCRYPT value + * @property {number} SWITCHOVER=39 SWITCHOVER value + * @property {number} UPDATE_BACKUP=40 UPDATE_BACKUP value + * @property {number} ACQUIRE_SSRS_LEASE=42 ACQUIRE_SSRS_LEASE value + * @property {number} RELEASE_SSRS_LEASE=43 RELEASE_SSRS_LEASE value + * @property {number} RECONFIGURE_OLD_PRIMARY=44 RECONFIGURE_OLD_PRIMARY value + * @property {number} CLUSTER_MAINTENANCE=45 CLUSTER_MAINTENANCE value + * @property {number} SELF_SERVICE_MAINTENANCE=46 SELF_SERVICE_MAINTENANCE value + * @property {number} SWITCHOVER_TO_REPLICA=47 SWITCHOVER_TO_REPLICA value + * @property {number} MAJOR_VERSION_UPGRADE=48 MAJOR_VERSION_UPGRADE value + * @property {number} ADVANCED_BACKUP=49 ADVANCED_BACKUP value + * @property {number} MANAGE_BACKUP=50 MANAGE_BACKUP value + * @property {number} ENHANCED_BACKUP=51 ENHANCED_BACKUP value + * @property {number} REPAIR_READ_POOL=52 REPAIR_READ_POOL value + * @property {number} CREATE_READ_POOL=53 CREATE_READ_POOL value + * @property {number} PRE_CHECK_MAJOR_VERSION_UPGRADE=54 PRE_CHECK_MAJOR_VERSION_UPGRADE value + */ + Operation.SqlOperationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_OPERATION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "IMPORT"] = 1; + values[valuesById[2] = "EXPORT"] = 2; + values[valuesById[3] = "CREATE"] = 3; + values[valuesById[4] = "UPDATE"] = 4; + values[valuesById[5] = "DELETE"] = 5; + values[valuesById[6] = "RESTART"] = 6; + values[valuesById[7] = "BACKUP"] = 7; + values[valuesById[8] = "SNAPSHOT"] = 8; + values[valuesById[9] = "BACKUP_VOLUME"] = 9; + values[valuesById[10] = "DELETE_VOLUME"] = 10; + values[valuesById[11] = "RESTORE_VOLUME"] = 11; + values[valuesById[12] = "INJECT_USER"] = 12; + values[valuesById[14] = "CLONE"] = 14; + values[valuesById[15] = "STOP_REPLICA"] = 15; + values[valuesById[16] = "START_REPLICA"] = 16; + values[valuesById[17] = "PROMOTE_REPLICA"] = 17; + values[valuesById[18] = "CREATE_REPLICA"] = 18; + values[valuesById[19] = "CREATE_USER"] = 19; + values[valuesById[20] = "DELETE_USER"] = 20; + values[valuesById[21] = "UPDATE_USER"] = 21; + values[valuesById[22] = "CREATE_DATABASE"] = 22; + values[valuesById[23] = "DELETE_DATABASE"] = 23; + values[valuesById[24] = "UPDATE_DATABASE"] = 24; + values[valuesById[25] = "FAILOVER"] = 25; + values[valuesById[26] = "DELETE_BACKUP"] = 26; + values[valuesById[27] = "RECREATE_REPLICA"] = 27; + values[valuesById[28] = "TRUNCATE_LOG"] = 28; + values[valuesById[29] = "DEMOTE_MASTER"] = 29; + values[valuesById[30] = "MAINTENANCE"] = 30; + values[valuesById[31] = "ENABLE_PRIVATE_IP"] = 31; + values[valuesById[32] = "DEFER_MAINTENANCE"] = 32; + values[valuesById[33] = "CREATE_CLONE"] = 33; + values[valuesById[34] = "RESCHEDULE_MAINTENANCE"] = 34; + values[valuesById[35] = "START_EXTERNAL_SYNC"] = 35; + values[valuesById[36] = "LOG_CLEANUP"] = 36; + values[valuesById[37] = "AUTO_RESTART"] = 37; + values[valuesById[38] = "REENCRYPT"] = 38; + values[valuesById[39] = "SWITCHOVER"] = 39; + values[valuesById[40] = "UPDATE_BACKUP"] = 40; + values[valuesById[42] = "ACQUIRE_SSRS_LEASE"] = 42; + values[valuesById[43] = "RELEASE_SSRS_LEASE"] = 43; + values[valuesById[44] = "RECONFIGURE_OLD_PRIMARY"] = 44; + values[valuesById[45] = "CLUSTER_MAINTENANCE"] = 45; + values[valuesById[46] = "SELF_SERVICE_MAINTENANCE"] = 46; + values[valuesById[47] = "SWITCHOVER_TO_REPLICA"] = 47; + values[valuesById[48] = "MAJOR_VERSION_UPGRADE"] = 48; + values[valuesById[49] = "ADVANCED_BACKUP"] = 49; + values[valuesById[50] = "MANAGE_BACKUP"] = 50; + values[valuesById[51] = "ENHANCED_BACKUP"] = 51; + values[valuesById[52] = "REPAIR_READ_POOL"] = 52; + values[valuesById[53] = "CREATE_READ_POOL"] = 53; + values[valuesById[54] = "PRE_CHECK_MAJOR_VERSION_UPGRADE"] = 54; + return values; + })(); + + /** + * SqlOperationStatus enum. + * @name google.cloud.sql.v1.Operation.SqlOperationStatus + * @enum {number} + * @property {number} SQL_OPERATION_STATUS_UNSPECIFIED=0 SQL_OPERATION_STATUS_UNSPECIFIED value + * @property {number} PENDING=1 PENDING value + * @property {number} RUNNING=2 RUNNING value + * @property {number} DONE=3 DONE value + */ + Operation.SqlOperationStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_OPERATION_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "PENDING"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "DONE"] = 3; + return values; + })(); + + return Operation; + })(); + + v1.OperationError = (function() { + + /** + * Properties of an OperationError. + * @memberof google.cloud.sql.v1 + * @interface IOperationError + * @property {string|null} [kind] OperationError kind + * @property {string|null} [code] OperationError code + * @property {string|null} [message] OperationError message + */ + + /** + * Constructs a new OperationError. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an OperationError. + * @implements IOperationError + * @constructor + * @param {google.cloud.sql.v1.IOperationError=} [properties] Properties to set + */ + function OperationError(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationError kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.OperationError + * @instance + */ + OperationError.prototype.kind = ""; + + /** + * OperationError code. + * @member {string} code + * @memberof google.cloud.sql.v1.OperationError + * @instance + */ + OperationError.prototype.code = ""; + + /** + * OperationError message. + * @member {string} message + * @memberof google.cloud.sql.v1.OperationError + * @instance + */ + OperationError.prototype.message = ""; + + /** + * Creates a new OperationError instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.OperationError + * @static + * @param {google.cloud.sql.v1.IOperationError=} [properties] Properties to set + * @returns {google.cloud.sql.v1.OperationError} OperationError instance + */ + OperationError.create = function create(properties) { + return new OperationError(properties); + }; + + /** + * Encodes the specified OperationError message. Does not implicitly {@link google.cloud.sql.v1.OperationError.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.OperationError + * @static + * @param {google.cloud.sql.v1.IOperationError} message OperationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + return writer; + }; + + /** + * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.OperationError + * @static + * @param {google.cloud.sql.v1.IOperationError} message OperationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationError message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.OperationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.OperationError} OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationError.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.OperationError(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.code = reader.string(); + break; + } + case 3: { + message.message = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.OperationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.OperationError} OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationError message. + * @function verify + * @memberof google.cloud.sql.v1.OperationError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isString(message.code)) + return "code: string expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates an OperationError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.OperationError + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.OperationError} OperationError + */ + OperationError.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.OperationError) + return object; + var message = new $root.google.cloud.sql.v1.OperationError(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.code != null) + message.code = String(object.code); + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from an OperationError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.OperationError + * @static + * @param {google.cloud.sql.v1.OperationError} message OperationError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.code = ""; + object.message = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this OperationError to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.OperationError + * @instance + * @returns {Object.} JSON object + */ + OperationError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationError + * @function getTypeUrl + * @memberof google.cloud.sql.v1.OperationError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.OperationError"; + }; + + return OperationError; + })(); + + v1.OperationErrors = (function() { + + /** + * Properties of an OperationErrors. + * @memberof google.cloud.sql.v1 + * @interface IOperationErrors + * @property {string|null} [kind] OperationErrors kind + * @property {Array.|null} [errors] OperationErrors errors + */ + + /** + * Constructs a new OperationErrors. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an OperationErrors. + * @implements IOperationErrors + * @constructor + * @param {google.cloud.sql.v1.IOperationErrors=} [properties] Properties to set + */ + function OperationErrors(properties) { + this.errors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationErrors kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.OperationErrors + * @instance + */ + OperationErrors.prototype.kind = ""; + + /** + * OperationErrors errors. + * @member {Array.} errors + * @memberof google.cloud.sql.v1.OperationErrors + * @instance + */ + OperationErrors.prototype.errors = $util.emptyArray; + + /** + * Creates a new OperationErrors instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.OperationErrors + * @static + * @param {google.cloud.sql.v1.IOperationErrors=} [properties] Properties to set + * @returns {google.cloud.sql.v1.OperationErrors} OperationErrors instance + */ + OperationErrors.create = function create(properties) { + return new OperationErrors(properties); + }; + + /** + * Encodes the specified OperationErrors message. Does not implicitly {@link google.cloud.sql.v1.OperationErrors.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.OperationErrors + * @static + * @param {google.cloud.sql.v1.IOperationErrors} message OperationErrors message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationErrors.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.errors != null && message.errors.length) + for (var i = 0; i < message.errors.length; ++i) + $root.google.cloud.sql.v1.OperationError.encode(message.errors[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OperationErrors message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationErrors.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.OperationErrors + * @static + * @param {google.cloud.sql.v1.IOperationErrors} message OperationErrors message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationErrors.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationErrors message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.OperationErrors + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.OperationErrors} OperationErrors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationErrors.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.OperationErrors(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.errors && message.errors.length)) + message.errors = []; + message.errors.push($root.google.cloud.sql.v1.OperationError.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationErrors message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.OperationErrors + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.OperationErrors} OperationErrors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationErrors.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationErrors message. + * @function verify + * @memberof google.cloud.sql.v1.OperationErrors + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationErrors.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.errors != null && message.hasOwnProperty("errors")) { + if (!Array.isArray(message.errors)) + return "errors: array expected"; + for (var i = 0; i < message.errors.length; ++i) { + var error = $root.google.cloud.sql.v1.OperationError.verify(message.errors[i]); + if (error) + return "errors." + error; + } + } + return null; + }; + + /** + * Creates an OperationErrors message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.OperationErrors + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.OperationErrors} OperationErrors + */ + OperationErrors.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.OperationErrors) + return object; + var message = new $root.google.cloud.sql.v1.OperationErrors(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.errors) { + if (!Array.isArray(object.errors)) + throw TypeError(".google.cloud.sql.v1.OperationErrors.errors: array expected"); + message.errors = []; + for (var i = 0; i < object.errors.length; ++i) { + if (typeof object.errors[i] !== "object") + throw TypeError(".google.cloud.sql.v1.OperationErrors.errors: object expected"); + message.errors[i] = $root.google.cloud.sql.v1.OperationError.fromObject(object.errors[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OperationErrors message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.OperationErrors + * @static + * @param {google.cloud.sql.v1.OperationErrors} message OperationErrors + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationErrors.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errors = []; + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.errors && message.errors.length) { + object.errors = []; + for (var j = 0; j < message.errors.length; ++j) + object.errors[j] = $root.google.cloud.sql.v1.OperationError.toObject(message.errors[j], options); + } + return object; + }; + + /** + * Converts this OperationErrors to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.OperationErrors + * @instance + * @returns {Object.} JSON object + */ + OperationErrors.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationErrors + * @function getTypeUrl + * @memberof google.cloud.sql.v1.OperationErrors + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationErrors.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.OperationErrors"; + }; + + return OperationErrors; + })(); + + v1.PasswordValidationPolicy = (function() { + + /** + * Properties of a PasswordValidationPolicy. + * @memberof google.cloud.sql.v1 + * @interface IPasswordValidationPolicy + * @property {google.protobuf.IInt32Value|null} [minLength] PasswordValidationPolicy minLength + * @property {google.cloud.sql.v1.PasswordValidationPolicy.Complexity|null} [complexity] PasswordValidationPolicy complexity + * @property {google.protobuf.IInt32Value|null} [reuseInterval] PasswordValidationPolicy reuseInterval + * @property {google.protobuf.IBoolValue|null} [disallowUsernameSubstring] PasswordValidationPolicy disallowUsernameSubstring + * @property {google.protobuf.IDuration|null} [passwordChangeInterval] PasswordValidationPolicy passwordChangeInterval + * @property {google.protobuf.IBoolValue|null} [enablePasswordPolicy] PasswordValidationPolicy enablePasswordPolicy + * @property {google.protobuf.IBoolValue|null} [disallowCompromisedCredentials] PasswordValidationPolicy disallowCompromisedCredentials + */ + + /** + * Constructs a new PasswordValidationPolicy. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a PasswordValidationPolicy. + * @implements IPasswordValidationPolicy + * @constructor + * @param {google.cloud.sql.v1.IPasswordValidationPolicy=} [properties] Properties to set + */ + function PasswordValidationPolicy(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PasswordValidationPolicy minLength. + * @member {google.protobuf.IInt32Value|null|undefined} minLength + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.minLength = null; + + /** + * PasswordValidationPolicy complexity. + * @member {google.cloud.sql.v1.PasswordValidationPolicy.Complexity} complexity + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.complexity = 0; + + /** + * PasswordValidationPolicy reuseInterval. + * @member {google.protobuf.IInt32Value|null|undefined} reuseInterval + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.reuseInterval = null; + + /** + * PasswordValidationPolicy disallowUsernameSubstring. + * @member {google.protobuf.IBoolValue|null|undefined} disallowUsernameSubstring + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.disallowUsernameSubstring = null; + + /** + * PasswordValidationPolicy passwordChangeInterval. + * @member {google.protobuf.IDuration|null|undefined} passwordChangeInterval + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.passwordChangeInterval = null; + + /** + * PasswordValidationPolicy enablePasswordPolicy. + * @member {google.protobuf.IBoolValue|null|undefined} enablePasswordPolicy + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.enablePasswordPolicy = null; + + /** + * PasswordValidationPolicy disallowCompromisedCredentials. + * @member {google.protobuf.IBoolValue|null|undefined} disallowCompromisedCredentials + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.disallowCompromisedCredentials = null; + + /** + * Creates a new PasswordValidationPolicy instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1.IPasswordValidationPolicy=} [properties] Properties to set + * @returns {google.cloud.sql.v1.PasswordValidationPolicy} PasswordValidationPolicy instance + */ + PasswordValidationPolicy.create = function create(properties) { + return new PasswordValidationPolicy(properties); + }; + + /** + * Encodes the specified PasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1.PasswordValidationPolicy.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1.IPasswordValidationPolicy} message PasswordValidationPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordValidationPolicy.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.minLength != null && Object.hasOwnProperty.call(message, "minLength")) + $root.google.protobuf.Int32Value.encode(message.minLength, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.complexity != null && Object.hasOwnProperty.call(message, "complexity")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.complexity); + if (message.reuseInterval != null && Object.hasOwnProperty.call(message, "reuseInterval")) + $root.google.protobuf.Int32Value.encode(message.reuseInterval, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.disallowUsernameSubstring != null && Object.hasOwnProperty.call(message, "disallowUsernameSubstring")) + $root.google.protobuf.BoolValue.encode(message.disallowUsernameSubstring, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.passwordChangeInterval != null && Object.hasOwnProperty.call(message, "passwordChangeInterval")) + $root.google.protobuf.Duration.encode(message.passwordChangeInterval, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.enablePasswordPolicy != null && Object.hasOwnProperty.call(message, "enablePasswordPolicy")) + $root.google.protobuf.BoolValue.encode(message.enablePasswordPolicy, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.disallowCompromisedCredentials != null && Object.hasOwnProperty.call(message, "disallowCompromisedCredentials")) + $root.google.protobuf.BoolValue.encode(message.disallowCompromisedCredentials, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PasswordValidationPolicy.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1.IPasswordValidationPolicy} message PasswordValidationPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordValidationPolicy.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PasswordValidationPolicy message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.PasswordValidationPolicy} PasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordValidationPolicy.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PasswordValidationPolicy(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.minLength = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 2: { + message.complexity = reader.int32(); + break; + } + case 3: { + message.reuseInterval = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 4: { + message.disallowUsernameSubstring = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 5: { + message.passwordChangeInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 6: { + message.enablePasswordPolicy = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 7: { + message.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PasswordValidationPolicy message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.PasswordValidationPolicy} PasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordValidationPolicy.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PasswordValidationPolicy message. + * @function verify + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PasswordValidationPolicy.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.minLength != null && message.hasOwnProperty("minLength")) { + var error = $root.google.protobuf.Int32Value.verify(message.minLength); + if (error) + return "minLength." + error; + } + if (message.complexity != null && message.hasOwnProperty("complexity")) + switch (message.complexity) { + default: + return "complexity: enum value expected"; + case 0: + case 1: + break; + } + if (message.reuseInterval != null && message.hasOwnProperty("reuseInterval")) { + var error = $root.google.protobuf.Int32Value.verify(message.reuseInterval); + if (error) + return "reuseInterval." + error; + } + if (message.disallowUsernameSubstring != null && message.hasOwnProperty("disallowUsernameSubstring")) { + var error = $root.google.protobuf.BoolValue.verify(message.disallowUsernameSubstring); + if (error) + return "disallowUsernameSubstring." + error; + } + if (message.passwordChangeInterval != null && message.hasOwnProperty("passwordChangeInterval")) { + var error = $root.google.protobuf.Duration.verify(message.passwordChangeInterval); + if (error) + return "passwordChangeInterval." + error; + } + if (message.enablePasswordPolicy != null && message.hasOwnProperty("enablePasswordPolicy")) { + var error = $root.google.protobuf.BoolValue.verify(message.enablePasswordPolicy); + if (error) + return "enablePasswordPolicy." + error; + } + if (message.disallowCompromisedCredentials != null && message.hasOwnProperty("disallowCompromisedCredentials")) { + var error = $root.google.protobuf.BoolValue.verify(message.disallowCompromisedCredentials); + if (error) + return "disallowCompromisedCredentials." + error; + } + return null; + }; + + /** + * Creates a PasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.PasswordValidationPolicy} PasswordValidationPolicy + */ + PasswordValidationPolicy.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.PasswordValidationPolicy) + return object; + var message = new $root.google.cloud.sql.v1.PasswordValidationPolicy(); + if (object.minLength != null) { + if (typeof object.minLength !== "object") + throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.minLength: object expected"); + message.minLength = $root.google.protobuf.Int32Value.fromObject(object.minLength); + } + switch (object.complexity) { + default: + if (typeof object.complexity === "number") { + message.complexity = object.complexity; + break; + } + break; + case "COMPLEXITY_UNSPECIFIED": + case 0: + message.complexity = 0; + break; + case "COMPLEXITY_DEFAULT": + case 1: + message.complexity = 1; + break; + } + if (object.reuseInterval != null) { + if (typeof object.reuseInterval !== "object") + throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.reuseInterval: object expected"); + message.reuseInterval = $root.google.protobuf.Int32Value.fromObject(object.reuseInterval); + } + if (object.disallowUsernameSubstring != null) { + if (typeof object.disallowUsernameSubstring !== "object") + throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.disallowUsernameSubstring: object expected"); + message.disallowUsernameSubstring = $root.google.protobuf.BoolValue.fromObject(object.disallowUsernameSubstring); + } + if (object.passwordChangeInterval != null) { + if (typeof object.passwordChangeInterval !== "object") + throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.passwordChangeInterval: object expected"); + message.passwordChangeInterval = $root.google.protobuf.Duration.fromObject(object.passwordChangeInterval); + } + if (object.enablePasswordPolicy != null) { + if (typeof object.enablePasswordPolicy !== "object") + throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.enablePasswordPolicy: object expected"); + message.enablePasswordPolicy = $root.google.protobuf.BoolValue.fromObject(object.enablePasswordPolicy); + } + if (object.disallowCompromisedCredentials != null) { + if (typeof object.disallowCompromisedCredentials !== "object") + throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.disallowCompromisedCredentials: object expected"); + message.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.fromObject(object.disallowCompromisedCredentials); + } + return message; + }; + + /** + * Creates a plain object from a PasswordValidationPolicy message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1.PasswordValidationPolicy} message PasswordValidationPolicy + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PasswordValidationPolicy.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.minLength = null; + object.complexity = options.enums === String ? "COMPLEXITY_UNSPECIFIED" : 0; + object.reuseInterval = null; + object.disallowUsernameSubstring = null; + object.passwordChangeInterval = null; + object.enablePasswordPolicy = null; + object.disallowCompromisedCredentials = null; + } + if (message.minLength != null && message.hasOwnProperty("minLength")) + object.minLength = $root.google.protobuf.Int32Value.toObject(message.minLength, options); + if (message.complexity != null && message.hasOwnProperty("complexity")) + object.complexity = options.enums === String ? $root.google.cloud.sql.v1.PasswordValidationPolicy.Complexity[message.complexity] === undefined ? message.complexity : $root.google.cloud.sql.v1.PasswordValidationPolicy.Complexity[message.complexity] : message.complexity; + if (message.reuseInterval != null && message.hasOwnProperty("reuseInterval")) + object.reuseInterval = $root.google.protobuf.Int32Value.toObject(message.reuseInterval, options); + if (message.disallowUsernameSubstring != null && message.hasOwnProperty("disallowUsernameSubstring")) + object.disallowUsernameSubstring = $root.google.protobuf.BoolValue.toObject(message.disallowUsernameSubstring, options); + if (message.passwordChangeInterval != null && message.hasOwnProperty("passwordChangeInterval")) + object.passwordChangeInterval = $root.google.protobuf.Duration.toObject(message.passwordChangeInterval, options); + if (message.enablePasswordPolicy != null && message.hasOwnProperty("enablePasswordPolicy")) + object.enablePasswordPolicy = $root.google.protobuf.BoolValue.toObject(message.enablePasswordPolicy, options); + if (message.disallowCompromisedCredentials != null && message.hasOwnProperty("disallowCompromisedCredentials")) + object.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.toObject(message.disallowCompromisedCredentials, options); + return object; + }; + + /** + * Converts this PasswordValidationPolicy to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @instance + * @returns {Object.} JSON object + */ + PasswordValidationPolicy.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PasswordValidationPolicy + * @function getTypeUrl + * @memberof google.cloud.sql.v1.PasswordValidationPolicy + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PasswordValidationPolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.PasswordValidationPolicy"; + }; + + /** + * Complexity enum. + * @name google.cloud.sql.v1.PasswordValidationPolicy.Complexity + * @enum {number} + * @property {number} COMPLEXITY_UNSPECIFIED=0 COMPLEXITY_UNSPECIFIED value + * @property {number} COMPLEXITY_DEFAULT=1 COMPLEXITY_DEFAULT value + */ + PasswordValidationPolicy.Complexity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "COMPLEXITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "COMPLEXITY_DEFAULT"] = 1; + return values; + })(); + + return PasswordValidationPolicy; + })(); + + v1.DataCacheConfig = (function() { + + /** + * Properties of a DataCacheConfig. + * @memberof google.cloud.sql.v1 + * @interface IDataCacheConfig + * @property {boolean|null} [dataCacheEnabled] DataCacheConfig dataCacheEnabled + */ + + /** + * Constructs a new DataCacheConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DataCacheConfig. + * @implements IDataCacheConfig + * @constructor + * @param {google.cloud.sql.v1.IDataCacheConfig=} [properties] Properties to set + */ + function DataCacheConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DataCacheConfig dataCacheEnabled. + * @member {boolean} dataCacheEnabled + * @memberof google.cloud.sql.v1.DataCacheConfig + * @instance + */ + DataCacheConfig.prototype.dataCacheEnabled = false; + + /** + * Creates a new DataCacheConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DataCacheConfig + * @static + * @param {google.cloud.sql.v1.IDataCacheConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DataCacheConfig} DataCacheConfig instance + */ + DataCacheConfig.create = function create(properties) { + return new DataCacheConfig(properties); + }; + + /** + * Encodes the specified DataCacheConfig message. Does not implicitly {@link google.cloud.sql.v1.DataCacheConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DataCacheConfig + * @static + * @param {google.cloud.sql.v1.IDataCacheConfig} message DataCacheConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DataCacheConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dataCacheEnabled != null && Object.hasOwnProperty.call(message, "dataCacheEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.dataCacheEnabled); + return writer; + }; + + /** + * Encodes the specified DataCacheConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DataCacheConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DataCacheConfig + * @static + * @param {google.cloud.sql.v1.IDataCacheConfig} message DataCacheConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DataCacheConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DataCacheConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DataCacheConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DataCacheConfig} DataCacheConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DataCacheConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DataCacheConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.dataCacheEnabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DataCacheConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DataCacheConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DataCacheConfig} DataCacheConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DataCacheConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DataCacheConfig message. + * @function verify + * @memberof google.cloud.sql.v1.DataCacheConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DataCacheConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dataCacheEnabled != null && message.hasOwnProperty("dataCacheEnabled")) + if (typeof message.dataCacheEnabled !== "boolean") + return "dataCacheEnabled: boolean expected"; + return null; + }; + + /** + * Creates a DataCacheConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DataCacheConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DataCacheConfig} DataCacheConfig + */ + DataCacheConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DataCacheConfig) + return object; + var message = new $root.google.cloud.sql.v1.DataCacheConfig(); + if (object.dataCacheEnabled != null) + message.dataCacheEnabled = Boolean(object.dataCacheEnabled); + return message; + }; + + /** + * Creates a plain object from a DataCacheConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DataCacheConfig + * @static + * @param {google.cloud.sql.v1.DataCacheConfig} message DataCacheConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DataCacheConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.dataCacheEnabled = false; + if (message.dataCacheEnabled != null && message.hasOwnProperty("dataCacheEnabled")) + object.dataCacheEnabled = message.dataCacheEnabled; + return object; + }; + + /** + * Converts this DataCacheConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DataCacheConfig + * @instance + * @returns {Object.} JSON object + */ + DataCacheConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DataCacheConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DataCacheConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DataCacheConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DataCacheConfig"; + }; + + return DataCacheConfig; + })(); + + v1.FinalBackupConfig = (function() { + + /** + * Properties of a FinalBackupConfig. + * @memberof google.cloud.sql.v1 + * @interface IFinalBackupConfig + * @property {boolean|null} [enabled] FinalBackupConfig enabled + * @property {number|null} [retentionDays] FinalBackupConfig retentionDays + */ + + /** + * Constructs a new FinalBackupConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a FinalBackupConfig. + * @implements IFinalBackupConfig + * @constructor + * @param {google.cloud.sql.v1.IFinalBackupConfig=} [properties] Properties to set + */ + function FinalBackupConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FinalBackupConfig enabled. + * @member {boolean|null|undefined} enabled + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @instance + */ + FinalBackupConfig.prototype.enabled = null; + + /** + * FinalBackupConfig retentionDays. + * @member {number|null|undefined} retentionDays + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @instance + */ + FinalBackupConfig.prototype.retentionDays = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(FinalBackupConfig.prototype, "_enabled", { + get: $util.oneOfGetter($oneOfFields = ["enabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(FinalBackupConfig.prototype, "_retentionDays", { + get: $util.oneOfGetter($oneOfFields = ["retentionDays"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FinalBackupConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @static + * @param {google.cloud.sql.v1.IFinalBackupConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.FinalBackupConfig} FinalBackupConfig instance + */ + FinalBackupConfig.create = function create(properties) { + return new FinalBackupConfig(properties); + }; + + /** + * Encodes the specified FinalBackupConfig message. Does not implicitly {@link google.cloud.sql.v1.FinalBackupConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @static + * @param {google.cloud.sql.v1.IFinalBackupConfig} message FinalBackupConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FinalBackupConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.retentionDays != null && Object.hasOwnProperty.call(message, "retentionDays")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.retentionDays); + return writer; + }; + + /** + * Encodes the specified FinalBackupConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FinalBackupConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @static + * @param {google.cloud.sql.v1.IFinalBackupConfig} message FinalBackupConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FinalBackupConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FinalBackupConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.FinalBackupConfig} FinalBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FinalBackupConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.FinalBackupConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.enabled = reader.bool(); + break; + } + case 3: { + message.retentionDays = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FinalBackupConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.FinalBackupConfig} FinalBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FinalBackupConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FinalBackupConfig message. + * @function verify + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FinalBackupConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + properties._enabled = 1; + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + } + if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) { + properties._retentionDays = 1; + if (!$util.isInteger(message.retentionDays)) + return "retentionDays: integer expected"; + } + return null; + }; + + /** + * Creates a FinalBackupConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.FinalBackupConfig} FinalBackupConfig + */ + FinalBackupConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.FinalBackupConfig) + return object; + var message = new $root.google.cloud.sql.v1.FinalBackupConfig(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.retentionDays != null) + message.retentionDays = object.retentionDays | 0; + return message; + }; + + /** + * Creates a plain object from a FinalBackupConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @static + * @param {google.cloud.sql.v1.FinalBackupConfig} message FinalBackupConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FinalBackupConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + object.enabled = message.enabled; + if (options.oneofs) + object._enabled = "enabled"; + } + if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) { + object.retentionDays = message.retentionDays; + if (options.oneofs) + object._retentionDays = "retentionDays"; + } + return object; + }; + + /** + * Converts this FinalBackupConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @instance + * @returns {Object.} JSON object + */ + FinalBackupConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FinalBackupConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.FinalBackupConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FinalBackupConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.FinalBackupConfig"; + }; + + return FinalBackupConfig; + })(); + + v1.Settings = (function() { + + /** + * Properties of a Settings. + * @memberof google.cloud.sql.v1 + * @interface ISettings + * @property {google.protobuf.IInt64Value|null} [settingsVersion] Settings settingsVersion + * @property {Array.|null} [authorizedGaeApplications] Settings authorizedGaeApplications + * @property {string|null} [tier] Settings tier + * @property {string|null} [kind] Settings kind + * @property {Object.|null} [userLabels] Settings userLabels + * @property {google.cloud.sql.v1.SqlAvailabilityType|null} [availabilityType] Settings availabilityType + * @property {google.cloud.sql.v1.SqlPricingPlan|null} [pricingPlan] Settings pricingPlan + * @property {google.cloud.sql.v1.SqlReplicationType|null} [replicationType] Settings replicationType + * @property {google.protobuf.IInt64Value|null} [storageAutoResizeLimit] Settings storageAutoResizeLimit + * @property {google.cloud.sql.v1.Settings.SqlActivationPolicy|null} [activationPolicy] Settings activationPolicy + * @property {google.cloud.sql.v1.IIpConfiguration|null} [ipConfiguration] Settings ipConfiguration + * @property {google.protobuf.IBoolValue|null} [storageAutoResize] Settings storageAutoResize + * @property {google.cloud.sql.v1.ILocationPreference|null} [locationPreference] Settings locationPreference + * @property {Array.|null} [databaseFlags] Settings databaseFlags + * @property {google.cloud.sql.v1.SqlDataDiskType|null} [dataDiskType] Settings dataDiskType + * @property {google.cloud.sql.v1.IMaintenanceWindow|null} [maintenanceWindow] Settings maintenanceWindow + * @property {google.cloud.sql.v1.IBackupConfiguration|null} [backupConfiguration] Settings backupConfiguration + * @property {google.protobuf.IBoolValue|null} [databaseReplicationEnabled] Settings databaseReplicationEnabled + * @property {google.protobuf.IBoolValue|null} [crashSafeReplicationEnabled] Settings crashSafeReplicationEnabled + * @property {google.protobuf.IInt64Value|null} [dataDiskSizeGb] Settings dataDiskSizeGb + * @property {google.cloud.sql.v1.ISqlActiveDirectoryConfig|null} [activeDirectoryConfig] Settings activeDirectoryConfig + * @property {string|null} [collation] Settings collation + * @property {Array.|null} [denyMaintenancePeriods] Settings denyMaintenancePeriods + * @property {google.cloud.sql.v1.IInsightsConfig|null} [insightsConfig] Settings insightsConfig + * @property {google.cloud.sql.v1.IPasswordValidationPolicy|null} [passwordValidationPolicy] Settings passwordValidationPolicy + * @property {google.cloud.sql.v1.ISqlServerAuditConfig|null} [sqlServerAuditConfig] Settings sqlServerAuditConfig + * @property {google.cloud.sql.v1.Settings.Edition|null} [edition] Settings edition + * @property {google.cloud.sql.v1.Settings.ConnectorEnforcement|null} [connectorEnforcement] Settings connectorEnforcement + * @property {google.protobuf.IBoolValue|null} [deletionProtectionEnabled] Settings deletionProtectionEnabled + * @property {string|null} [timeZone] Settings timeZone + * @property {google.cloud.sql.v1.IAdvancedMachineFeatures|null} [advancedMachineFeatures] Settings advancedMachineFeatures + * @property {google.cloud.sql.v1.IDataCacheConfig|null} [dataCacheConfig] Settings dataCacheConfig + * @property {google.protobuf.IInt32Value|null} [replicationLagMaxSeconds] Settings replicationLagMaxSeconds + * @property {google.protobuf.IBoolValue|null} [enableGoogleMlIntegration] Settings enableGoogleMlIntegration + * @property {google.protobuf.IBoolValue|null} [enableDataplexIntegration] Settings enableDataplexIntegration + * @property {google.protobuf.IBoolValue|null} [retainBackupsOnDelete] Settings retainBackupsOnDelete + * @property {number|Long|null} [dataDiskProvisionedIops] Settings dataDiskProvisionedIops + * @property {number|Long|null} [dataDiskProvisionedThroughput] Settings dataDiskProvisionedThroughput + * @property {google.cloud.sql.v1.IConnectionPoolConfig|null} [connectionPoolConfig] Settings connectionPoolConfig + * @property {google.cloud.sql.v1.IFinalBackupConfig|null} [finalBackupConfig] Settings finalBackupConfig + * @property {google.cloud.sql.v1.IReadPoolAutoScaleConfig|null} [readPoolAutoScaleConfig] Settings readPoolAutoScaleConfig + * @property {google.protobuf.IBoolValue|null} [acceleratedReplicaMode] Settings acceleratedReplicaMode + * @property {boolean|null} [autoUpgradeEnabled] Settings autoUpgradeEnabled + * @property {google.cloud.sql.v1.ISqlServerEntraIdConfig|null} [entraidConfig] Settings entraidConfig + * @property {google.cloud.sql.v1.Settings.DataApiAccess|null} [dataApiAccess] Settings dataApiAccess + * @property {google.cloud.sql.v1.IPerformanceCaptureConfig|null} [performanceCaptureConfig] Settings performanceCaptureConfig + */ + + /** + * Constructs a new Settings. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a Settings. + * @implements ISettings + * @constructor + * @param {google.cloud.sql.v1.ISettings=} [properties] Properties to set + */ + function Settings(properties) { + this.authorizedGaeApplications = []; + this.userLabels = {}; + this.databaseFlags = []; + this.denyMaintenancePeriods = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Settings settingsVersion. + * @member {google.protobuf.IInt64Value|null|undefined} settingsVersion + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.settingsVersion = null; + + /** + * Settings authorizedGaeApplications. + * @member {Array.} authorizedGaeApplications + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.authorizedGaeApplications = $util.emptyArray; + + /** + * Settings tier. + * @member {string} tier + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.tier = ""; + + /** + * Settings kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.kind = ""; + + /** + * Settings userLabels. + * @member {Object.} userLabels + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.userLabels = $util.emptyObject; + + /** + * Settings availabilityType. + * @member {google.cloud.sql.v1.SqlAvailabilityType} availabilityType + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.availabilityType = 0; + + /** + * Settings pricingPlan. + * @member {google.cloud.sql.v1.SqlPricingPlan} pricingPlan + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.pricingPlan = 0; + + /** + * Settings replicationType. + * @member {google.cloud.sql.v1.SqlReplicationType} replicationType + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.replicationType = 0; + + /** + * Settings storageAutoResizeLimit. + * @member {google.protobuf.IInt64Value|null|undefined} storageAutoResizeLimit + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.storageAutoResizeLimit = null; + + /** + * Settings activationPolicy. + * @member {google.cloud.sql.v1.Settings.SqlActivationPolicy} activationPolicy + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.activationPolicy = 0; + + /** + * Settings ipConfiguration. + * @member {google.cloud.sql.v1.IIpConfiguration|null|undefined} ipConfiguration + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.ipConfiguration = null; + + /** + * Settings storageAutoResize. + * @member {google.protobuf.IBoolValue|null|undefined} storageAutoResize + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.storageAutoResize = null; + + /** + * Settings locationPreference. + * @member {google.cloud.sql.v1.ILocationPreference|null|undefined} locationPreference + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.locationPreference = null; + + /** + * Settings databaseFlags. + * @member {Array.} databaseFlags + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.databaseFlags = $util.emptyArray; + + /** + * Settings dataDiskType. + * @member {google.cloud.sql.v1.SqlDataDiskType} dataDiskType + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.dataDiskType = 0; + + /** + * Settings maintenanceWindow. + * @member {google.cloud.sql.v1.IMaintenanceWindow|null|undefined} maintenanceWindow + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.maintenanceWindow = null; + + /** + * Settings backupConfiguration. + * @member {google.cloud.sql.v1.IBackupConfiguration|null|undefined} backupConfiguration + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.backupConfiguration = null; + + /** + * Settings databaseReplicationEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} databaseReplicationEnabled + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.databaseReplicationEnabled = null; + + /** + * Settings crashSafeReplicationEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} crashSafeReplicationEnabled + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.crashSafeReplicationEnabled = null; + + /** + * Settings dataDiskSizeGb. + * @member {google.protobuf.IInt64Value|null|undefined} dataDiskSizeGb + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.dataDiskSizeGb = null; + + /** + * Settings activeDirectoryConfig. + * @member {google.cloud.sql.v1.ISqlActiveDirectoryConfig|null|undefined} activeDirectoryConfig + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.activeDirectoryConfig = null; + + /** + * Settings collation. + * @member {string} collation + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.collation = ""; + + /** + * Settings denyMaintenancePeriods. + * @member {Array.} denyMaintenancePeriods + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.denyMaintenancePeriods = $util.emptyArray; + + /** + * Settings insightsConfig. + * @member {google.cloud.sql.v1.IInsightsConfig|null|undefined} insightsConfig + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.insightsConfig = null; + + /** + * Settings passwordValidationPolicy. + * @member {google.cloud.sql.v1.IPasswordValidationPolicy|null|undefined} passwordValidationPolicy + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.passwordValidationPolicy = null; + + /** + * Settings sqlServerAuditConfig. + * @member {google.cloud.sql.v1.ISqlServerAuditConfig|null|undefined} sqlServerAuditConfig + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.sqlServerAuditConfig = null; + + /** + * Settings edition. + * @member {google.cloud.sql.v1.Settings.Edition} edition + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.edition = 0; + + /** + * Settings connectorEnforcement. + * @member {google.cloud.sql.v1.Settings.ConnectorEnforcement} connectorEnforcement + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.connectorEnforcement = 0; + + /** + * Settings deletionProtectionEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} deletionProtectionEnabled + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.deletionProtectionEnabled = null; + + /** + * Settings timeZone. + * @member {string} timeZone + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.timeZone = ""; + + /** + * Settings advancedMachineFeatures. + * @member {google.cloud.sql.v1.IAdvancedMachineFeatures|null|undefined} advancedMachineFeatures + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.advancedMachineFeatures = null; + + /** + * Settings dataCacheConfig. + * @member {google.cloud.sql.v1.IDataCacheConfig|null|undefined} dataCacheConfig + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.dataCacheConfig = null; + + /** + * Settings replicationLagMaxSeconds. + * @member {google.protobuf.IInt32Value|null|undefined} replicationLagMaxSeconds + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.replicationLagMaxSeconds = null; + + /** + * Settings enableGoogleMlIntegration. + * @member {google.protobuf.IBoolValue|null|undefined} enableGoogleMlIntegration + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.enableGoogleMlIntegration = null; + + /** + * Settings enableDataplexIntegration. + * @member {google.protobuf.IBoolValue|null|undefined} enableDataplexIntegration + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.enableDataplexIntegration = null; + + /** + * Settings retainBackupsOnDelete. + * @member {google.protobuf.IBoolValue|null|undefined} retainBackupsOnDelete + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.retainBackupsOnDelete = null; + + /** + * Settings dataDiskProvisionedIops. + * @member {number|Long|null|undefined} dataDiskProvisionedIops + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.dataDiskProvisionedIops = null; + + /** + * Settings dataDiskProvisionedThroughput. + * @member {number|Long|null|undefined} dataDiskProvisionedThroughput + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.dataDiskProvisionedThroughput = null; + + /** + * Settings connectionPoolConfig. + * @member {google.cloud.sql.v1.IConnectionPoolConfig|null|undefined} connectionPoolConfig + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.connectionPoolConfig = null; + + /** + * Settings finalBackupConfig. + * @member {google.cloud.sql.v1.IFinalBackupConfig|null|undefined} finalBackupConfig + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.finalBackupConfig = null; + + /** + * Settings readPoolAutoScaleConfig. + * @member {google.cloud.sql.v1.IReadPoolAutoScaleConfig|null|undefined} readPoolAutoScaleConfig + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.readPoolAutoScaleConfig = null; + + /** + * Settings acceleratedReplicaMode. + * @member {google.protobuf.IBoolValue|null|undefined} acceleratedReplicaMode + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.acceleratedReplicaMode = null; + + /** + * Settings autoUpgradeEnabled. + * @member {boolean|null|undefined} autoUpgradeEnabled + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.autoUpgradeEnabled = null; + + /** + * Settings entraidConfig. + * @member {google.cloud.sql.v1.ISqlServerEntraIdConfig|null|undefined} entraidConfig + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.entraidConfig = null; + + /** + * Settings dataApiAccess. + * @member {google.cloud.sql.v1.Settings.DataApiAccess|null|undefined} dataApiAccess + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.dataApiAccess = null; + + /** + * Settings performanceCaptureConfig. + * @member {google.cloud.sql.v1.IPerformanceCaptureConfig|null|undefined} performanceCaptureConfig + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.performanceCaptureConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_dataDiskProvisionedIops", { + get: $util.oneOfGetter($oneOfFields = ["dataDiskProvisionedIops"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_dataDiskProvisionedThroughput", { + get: $util.oneOfGetter($oneOfFields = ["dataDiskProvisionedThroughput"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_connectionPoolConfig", { + get: $util.oneOfGetter($oneOfFields = ["connectionPoolConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_finalBackupConfig", { + get: $util.oneOfGetter($oneOfFields = ["finalBackupConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_readPoolAutoScaleConfig", { + get: $util.oneOfGetter($oneOfFields = ["readPoolAutoScaleConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_autoUpgradeEnabled", { + get: $util.oneOfGetter($oneOfFields = ["autoUpgradeEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_dataApiAccess", { + get: $util.oneOfGetter($oneOfFields = ["dataApiAccess"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Settings instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.Settings + * @static + * @param {google.cloud.sql.v1.ISettings=} [properties] Properties to set + * @returns {google.cloud.sql.v1.Settings} Settings instance + */ + Settings.create = function create(properties) { + return new Settings(properties); + }; + + /** + * Encodes the specified Settings message. Does not implicitly {@link google.cloud.sql.v1.Settings.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.Settings + * @static + * @param {google.cloud.sql.v1.ISettings} message Settings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Settings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.settingsVersion != null && Object.hasOwnProperty.call(message, "settingsVersion")) + $root.google.protobuf.Int64Value.encode(message.settingsVersion, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.authorizedGaeApplications != null && message.authorizedGaeApplications.length) + for (var i = 0; i < message.authorizedGaeApplications.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.authorizedGaeApplications[i]); + if (message.tier != null && Object.hasOwnProperty.call(message, "tier")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.tier); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); + if (message.userLabels != null && Object.hasOwnProperty.call(message, "userLabels")) + for (var keys = Object.keys(message.userLabels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.userLabels[keys[i]]).ldelim(); + if (message.availabilityType != null && Object.hasOwnProperty.call(message, "availabilityType")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.availabilityType); + if (message.pricingPlan != null && Object.hasOwnProperty.call(message, "pricingPlan")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pricingPlan); + if (message.replicationType != null && Object.hasOwnProperty.call(message, "replicationType")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.replicationType); + if (message.storageAutoResizeLimit != null && Object.hasOwnProperty.call(message, "storageAutoResizeLimit")) + $root.google.protobuf.Int64Value.encode(message.storageAutoResizeLimit, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.activationPolicy != null && Object.hasOwnProperty.call(message, "activationPolicy")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.activationPolicy); + if (message.ipConfiguration != null && Object.hasOwnProperty.call(message, "ipConfiguration")) + $root.google.cloud.sql.v1.IpConfiguration.encode(message.ipConfiguration, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.storageAutoResize != null && Object.hasOwnProperty.call(message, "storageAutoResize")) + $root.google.protobuf.BoolValue.encode(message.storageAutoResize, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.locationPreference != null && Object.hasOwnProperty.call(message, "locationPreference")) + $root.google.cloud.sql.v1.LocationPreference.encode(message.locationPreference, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.databaseFlags != null && message.databaseFlags.length) + for (var i = 0; i < message.databaseFlags.length; ++i) + $root.google.cloud.sql.v1.DatabaseFlags.encode(message.databaseFlags[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.dataDiskType != null && Object.hasOwnProperty.call(message, "dataDiskType")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.dataDiskType); + if (message.maintenanceWindow != null && Object.hasOwnProperty.call(message, "maintenanceWindow")) + $root.google.cloud.sql.v1.MaintenanceWindow.encode(message.maintenanceWindow, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.backupConfiguration != null && Object.hasOwnProperty.call(message, "backupConfiguration")) + $root.google.cloud.sql.v1.BackupConfiguration.encode(message.backupConfiguration, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.databaseReplicationEnabled != null && Object.hasOwnProperty.call(message, "databaseReplicationEnabled")) + $root.google.protobuf.BoolValue.encode(message.databaseReplicationEnabled, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.crashSafeReplicationEnabled != null && Object.hasOwnProperty.call(message, "crashSafeReplicationEnabled")) + $root.google.protobuf.BoolValue.encode(message.crashSafeReplicationEnabled, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + if (message.dataDiskSizeGb != null && Object.hasOwnProperty.call(message, "dataDiskSizeGb")) + $root.google.protobuf.Int64Value.encode(message.dataDiskSizeGb, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.activeDirectoryConfig != null && Object.hasOwnProperty.call(message, "activeDirectoryConfig")) + $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.encode(message.activeDirectoryConfig, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.collation != null && Object.hasOwnProperty.call(message, "collation")) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.collation); + if (message.denyMaintenancePeriods != null && message.denyMaintenancePeriods.length) + for (var i = 0; i < message.denyMaintenancePeriods.length; ++i) + $root.google.cloud.sql.v1.DenyMaintenancePeriod.encode(message.denyMaintenancePeriods[i], writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.insightsConfig != null && Object.hasOwnProperty.call(message, "insightsConfig")) + $root.google.cloud.sql.v1.InsightsConfig.encode(message.insightsConfig, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.passwordValidationPolicy != null && Object.hasOwnProperty.call(message, "passwordValidationPolicy")) + $root.google.cloud.sql.v1.PasswordValidationPolicy.encode(message.passwordValidationPolicy, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + if (message.sqlServerAuditConfig != null && Object.hasOwnProperty.call(message, "sqlServerAuditConfig")) + $root.google.cloud.sql.v1.SqlServerAuditConfig.encode(message.sqlServerAuditConfig, writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim(); + if (message.connectorEnforcement != null && Object.hasOwnProperty.call(message, "connectorEnforcement")) + writer.uint32(/* id 32, wireType 0 =*/256).int32(message.connectorEnforcement); + if (message.deletionProtectionEnabled != null && Object.hasOwnProperty.call(message, "deletionProtectionEnabled")) + $root.google.protobuf.BoolValue.encode(message.deletionProtectionEnabled, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 34, wireType 2 =*/274).string(message.timeZone); + if (message.advancedMachineFeatures != null && Object.hasOwnProperty.call(message, "advancedMachineFeatures")) + $root.google.cloud.sql.v1.AdvancedMachineFeatures.encode(message.advancedMachineFeatures, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + if (message.dataCacheConfig != null && Object.hasOwnProperty.call(message, "dataCacheConfig")) + $root.google.cloud.sql.v1.DataCacheConfig.encode(message.dataCacheConfig, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim(); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 38, wireType 0 =*/304).int32(message.edition); + if (message.replicationLagMaxSeconds != null && Object.hasOwnProperty.call(message, "replicationLagMaxSeconds")) + $root.google.protobuf.Int32Value.encode(message.replicationLagMaxSeconds, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); + if (message.enableGoogleMlIntegration != null && Object.hasOwnProperty.call(message, "enableGoogleMlIntegration")) + $root.google.protobuf.BoolValue.encode(message.enableGoogleMlIntegration, writer.uint32(/* id 40, wireType 2 =*/322).fork()).ldelim(); + if (message.enableDataplexIntegration != null && Object.hasOwnProperty.call(message, "enableDataplexIntegration")) + $root.google.protobuf.BoolValue.encode(message.enableDataplexIntegration, writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); + if (message.retainBackupsOnDelete != null && Object.hasOwnProperty.call(message, "retainBackupsOnDelete")) + $root.google.protobuf.BoolValue.encode(message.retainBackupsOnDelete, writer.uint32(/* id 42, wireType 2 =*/338).fork()).ldelim(); + if (message.dataDiskProvisionedIops != null && Object.hasOwnProperty.call(message, "dataDiskProvisionedIops")) + writer.uint32(/* id 43, wireType 0 =*/344).int64(message.dataDiskProvisionedIops); + if (message.dataDiskProvisionedThroughput != null && Object.hasOwnProperty.call(message, "dataDiskProvisionedThroughput")) + writer.uint32(/* id 44, wireType 0 =*/352).int64(message.dataDiskProvisionedThroughput); + if (message.connectionPoolConfig != null && Object.hasOwnProperty.call(message, "connectionPoolConfig")) + $root.google.cloud.sql.v1.ConnectionPoolConfig.encode(message.connectionPoolConfig, writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); + if (message.finalBackupConfig != null && Object.hasOwnProperty.call(message, "finalBackupConfig")) + $root.google.cloud.sql.v1.FinalBackupConfig.encode(message.finalBackupConfig, writer.uint32(/* id 47, wireType 2 =*/378).fork()).ldelim(); + if (message.readPoolAutoScaleConfig != null && Object.hasOwnProperty.call(message, "readPoolAutoScaleConfig")) + $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.encode(message.readPoolAutoScaleConfig, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); + if (message.acceleratedReplicaMode != null && Object.hasOwnProperty.call(message, "acceleratedReplicaMode")) + $root.google.protobuf.BoolValue.encode(message.acceleratedReplicaMode, writer.uint32(/* id 49, wireType 2 =*/394).fork()).ldelim(); + if (message.autoUpgradeEnabled != null && Object.hasOwnProperty.call(message, "autoUpgradeEnabled")) + writer.uint32(/* id 50, wireType 0 =*/400).bool(message.autoUpgradeEnabled); + if (message.entraidConfig != null && Object.hasOwnProperty.call(message, "entraidConfig")) + $root.google.cloud.sql.v1.SqlServerEntraIdConfig.encode(message.entraidConfig, writer.uint32(/* id 52, wireType 2 =*/418).fork()).ldelim(); + if (message.dataApiAccess != null && Object.hasOwnProperty.call(message, "dataApiAccess")) + writer.uint32(/* id 53, wireType 0 =*/424).int32(message.dataApiAccess); + if (message.performanceCaptureConfig != null && Object.hasOwnProperty.call(message, "performanceCaptureConfig")) + $root.google.cloud.sql.v1.PerformanceCaptureConfig.encode(message.performanceCaptureConfig, writer.uint32(/* id 54, wireType 2 =*/434).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Settings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.Settings + * @static + * @param {google.cloud.sql.v1.ISettings} message Settings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Settings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Settings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.Settings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.Settings} Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Settings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Settings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.settingsVersion = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.authorizedGaeApplications && message.authorizedGaeApplications.length)) + message.authorizedGaeApplications = []; + message.authorizedGaeApplications.push(reader.string()); + break; + } + case 3: { + message.tier = reader.string(); + break; + } + case 4: { + message.kind = reader.string(); + break; + } + case 5: { + if (message.userLabels === $util.emptyObject) + message.userLabels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.userLabels[key] = value; + break; + } + case 6: { + message.availabilityType = reader.int32(); + break; + } + case 7: { + message.pricingPlan = reader.int32(); + break; + } + case 8: { + message.replicationType = reader.int32(); + break; + } + case 9: { + message.storageAutoResizeLimit = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 10: { + message.activationPolicy = reader.int32(); + break; + } + case 11: { + message.ipConfiguration = $root.google.cloud.sql.v1.IpConfiguration.decode(reader, reader.uint32()); + break; + } + case 12: { + message.storageAutoResize = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 13: { + message.locationPreference = $root.google.cloud.sql.v1.LocationPreference.decode(reader, reader.uint32()); + break; + } + case 14: { + if (!(message.databaseFlags && message.databaseFlags.length)) + message.databaseFlags = []; + message.databaseFlags.push($root.google.cloud.sql.v1.DatabaseFlags.decode(reader, reader.uint32())); + break; + } + case 15: { + message.dataDiskType = reader.int32(); + break; + } + case 16: { + message.maintenanceWindow = $root.google.cloud.sql.v1.MaintenanceWindow.decode(reader, reader.uint32()); + break; + } + case 17: { + message.backupConfiguration = $root.google.cloud.sql.v1.BackupConfiguration.decode(reader, reader.uint32()); + break; + } + case 18: { + message.databaseReplicationEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 19: { + message.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 20: { + message.dataDiskSizeGb = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 22: { + message.activeDirectoryConfig = $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.decode(reader, reader.uint32()); + break; + } + case 23: { + message.collation = reader.string(); + break; + } + case 24: { + if (!(message.denyMaintenancePeriods && message.denyMaintenancePeriods.length)) + message.denyMaintenancePeriods = []; + message.denyMaintenancePeriods.push($root.google.cloud.sql.v1.DenyMaintenancePeriod.decode(reader, reader.uint32())); + break; + } + case 25: { + message.insightsConfig = $root.google.cloud.sql.v1.InsightsConfig.decode(reader, reader.uint32()); + break; + } + case 27: { + message.passwordValidationPolicy = $root.google.cloud.sql.v1.PasswordValidationPolicy.decode(reader, reader.uint32()); + break; + } + case 29: { + message.sqlServerAuditConfig = $root.google.cloud.sql.v1.SqlServerAuditConfig.decode(reader, reader.uint32()); + break; + } + case 38: { + message.edition = reader.int32(); + break; + } + case 32: { + message.connectorEnforcement = reader.int32(); + break; + } + case 33: { + message.deletionProtectionEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 34: { + message.timeZone = reader.string(); + break; + } + case 35: { + message.advancedMachineFeatures = $root.google.cloud.sql.v1.AdvancedMachineFeatures.decode(reader, reader.uint32()); + break; + } + case 37: { + message.dataCacheConfig = $root.google.cloud.sql.v1.DataCacheConfig.decode(reader, reader.uint32()); + break; + } + case 39: { + message.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 40: { + message.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 41: { + message.enableDataplexIntegration = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 42: { + message.retainBackupsOnDelete = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 43: { + message.dataDiskProvisionedIops = reader.int64(); + break; + } + case 44: { + message.dataDiskProvisionedThroughput = reader.int64(); + break; + } + case 45: { + message.connectionPoolConfig = $root.google.cloud.sql.v1.ConnectionPoolConfig.decode(reader, reader.uint32()); + break; + } + case 47: { + message.finalBackupConfig = $root.google.cloud.sql.v1.FinalBackupConfig.decode(reader, reader.uint32()); + break; + } + case 48: { + message.readPoolAutoScaleConfig = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.decode(reader, reader.uint32()); + break; + } + case 49: { + message.acceleratedReplicaMode = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 50: { + message.autoUpgradeEnabled = reader.bool(); + break; + } + case 52: { + message.entraidConfig = $root.google.cloud.sql.v1.SqlServerEntraIdConfig.decode(reader, reader.uint32()); + break; + } + case 53: { + message.dataApiAccess = reader.int32(); + break; + } + case 54: { + message.performanceCaptureConfig = $root.google.cloud.sql.v1.PerformanceCaptureConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Settings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.Settings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.Settings} Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Settings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Settings message. + * @function verify + * @memberof google.cloud.sql.v1.Settings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Settings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) { + var error = $root.google.protobuf.Int64Value.verify(message.settingsVersion); + if (error) + return "settingsVersion." + error; + } + if (message.authorizedGaeApplications != null && message.hasOwnProperty("authorizedGaeApplications")) { + if (!Array.isArray(message.authorizedGaeApplications)) + return "authorizedGaeApplications: array expected"; + for (var i = 0; i < message.authorizedGaeApplications.length; ++i) + if (!$util.isString(message.authorizedGaeApplications[i])) + return "authorizedGaeApplications: string[] expected"; + } + if (message.tier != null && message.hasOwnProperty("tier")) + if (!$util.isString(message.tier)) + return "tier: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.userLabels != null && message.hasOwnProperty("userLabels")) { + if (!$util.isObject(message.userLabels)) + return "userLabels: object expected"; + var key = Object.keys(message.userLabels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.userLabels[key[i]])) + return "userLabels: string{k:string} expected"; + } + if (message.availabilityType != null && message.hasOwnProperty("availabilityType")) + switch (message.availabilityType) { + default: + return "availabilityType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.pricingPlan != null && message.hasOwnProperty("pricingPlan")) + switch (message.pricingPlan) { + default: + return "pricingPlan: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.replicationType != null && message.hasOwnProperty("replicationType")) + switch (message.replicationType) { + default: + return "replicationType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.storageAutoResizeLimit != null && message.hasOwnProperty("storageAutoResizeLimit")) { + var error = $root.google.protobuf.Int64Value.verify(message.storageAutoResizeLimit); + if (error) + return "storageAutoResizeLimit." + error; + } + if (message.activationPolicy != null && message.hasOwnProperty("activationPolicy")) + switch (message.activationPolicy) { + default: + return "activationPolicy: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.ipConfiguration != null && message.hasOwnProperty("ipConfiguration")) { + var error = $root.google.cloud.sql.v1.IpConfiguration.verify(message.ipConfiguration); + if (error) + return "ipConfiguration." + error; + } + if (message.storageAutoResize != null && message.hasOwnProperty("storageAutoResize")) { + var error = $root.google.protobuf.BoolValue.verify(message.storageAutoResize); + if (error) + return "storageAutoResize." + error; + } + if (message.locationPreference != null && message.hasOwnProperty("locationPreference")) { + var error = $root.google.cloud.sql.v1.LocationPreference.verify(message.locationPreference); + if (error) + return "locationPreference." + error; + } + if (message.databaseFlags != null && message.hasOwnProperty("databaseFlags")) { + if (!Array.isArray(message.databaseFlags)) + return "databaseFlags: array expected"; + for (var i = 0; i < message.databaseFlags.length; ++i) { + var error = $root.google.cloud.sql.v1.DatabaseFlags.verify(message.databaseFlags[i]); + if (error) + return "databaseFlags." + error; + } + } + if (message.dataDiskType != null && message.hasOwnProperty("dataDiskType")) + switch (message.dataDiskType) { + default: + return "dataDiskType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.maintenanceWindow != null && message.hasOwnProperty("maintenanceWindow")) { + var error = $root.google.cloud.sql.v1.MaintenanceWindow.verify(message.maintenanceWindow); + if (error) + return "maintenanceWindow." + error; + } + if (message.backupConfiguration != null && message.hasOwnProperty("backupConfiguration")) { + var error = $root.google.cloud.sql.v1.BackupConfiguration.verify(message.backupConfiguration); + if (error) + return "backupConfiguration." + error; + } + if (message.databaseReplicationEnabled != null && message.hasOwnProperty("databaseReplicationEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.databaseReplicationEnabled); + if (error) + return "databaseReplicationEnabled." + error; + } + if (message.crashSafeReplicationEnabled != null && message.hasOwnProperty("crashSafeReplicationEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.crashSafeReplicationEnabled); + if (error) + return "crashSafeReplicationEnabled." + error; + } + if (message.dataDiskSizeGb != null && message.hasOwnProperty("dataDiskSizeGb")) { + var error = $root.google.protobuf.Int64Value.verify(message.dataDiskSizeGb); + if (error) + return "dataDiskSizeGb." + error; + } + if (message.activeDirectoryConfig != null && message.hasOwnProperty("activeDirectoryConfig")) { + var error = $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.verify(message.activeDirectoryConfig); + if (error) + return "activeDirectoryConfig." + error; + } + if (message.collation != null && message.hasOwnProperty("collation")) + if (!$util.isString(message.collation)) + return "collation: string expected"; + if (message.denyMaintenancePeriods != null && message.hasOwnProperty("denyMaintenancePeriods")) { + if (!Array.isArray(message.denyMaintenancePeriods)) + return "denyMaintenancePeriods: array expected"; + for (var i = 0; i < message.denyMaintenancePeriods.length; ++i) { + var error = $root.google.cloud.sql.v1.DenyMaintenancePeriod.verify(message.denyMaintenancePeriods[i]); + if (error) + return "denyMaintenancePeriods." + error; + } + } + if (message.insightsConfig != null && message.hasOwnProperty("insightsConfig")) { + var error = $root.google.cloud.sql.v1.InsightsConfig.verify(message.insightsConfig); + if (error) + return "insightsConfig." + error; + } + if (message.passwordValidationPolicy != null && message.hasOwnProperty("passwordValidationPolicy")) { + var error = $root.google.cloud.sql.v1.PasswordValidationPolicy.verify(message.passwordValidationPolicy); + if (error) + return "passwordValidationPolicy." + error; + } + if (message.sqlServerAuditConfig != null && message.hasOwnProperty("sqlServerAuditConfig")) { + var error = $root.google.cloud.sql.v1.SqlServerAuditConfig.verify(message.sqlServerAuditConfig); + if (error) + return "sqlServerAuditConfig." + error; + } + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 2: + case 3: + break; + } + if (message.connectorEnforcement != null && message.hasOwnProperty("connectorEnforcement")) + switch (message.connectorEnforcement) { + default: + return "connectorEnforcement: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.deletionProtectionEnabled != null && message.hasOwnProperty("deletionProtectionEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.deletionProtectionEnabled); + if (error) + return "deletionProtectionEnabled." + error; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.advancedMachineFeatures != null && message.hasOwnProperty("advancedMachineFeatures")) { + var error = $root.google.cloud.sql.v1.AdvancedMachineFeatures.verify(message.advancedMachineFeatures); + if (error) + return "advancedMachineFeatures." + error; + } + if (message.dataCacheConfig != null && message.hasOwnProperty("dataCacheConfig")) { + var error = $root.google.cloud.sql.v1.DataCacheConfig.verify(message.dataCacheConfig); + if (error) + return "dataCacheConfig." + error; + } + if (message.replicationLagMaxSeconds != null && message.hasOwnProperty("replicationLagMaxSeconds")) { + var error = $root.google.protobuf.Int32Value.verify(message.replicationLagMaxSeconds); + if (error) + return "replicationLagMaxSeconds." + error; + } + if (message.enableGoogleMlIntegration != null && message.hasOwnProperty("enableGoogleMlIntegration")) { + var error = $root.google.protobuf.BoolValue.verify(message.enableGoogleMlIntegration); + if (error) + return "enableGoogleMlIntegration." + error; + } + if (message.enableDataplexIntegration != null && message.hasOwnProperty("enableDataplexIntegration")) { + var error = $root.google.protobuf.BoolValue.verify(message.enableDataplexIntegration); + if (error) + return "enableDataplexIntegration." + error; + } + if (message.retainBackupsOnDelete != null && message.hasOwnProperty("retainBackupsOnDelete")) { + var error = $root.google.protobuf.BoolValue.verify(message.retainBackupsOnDelete); + if (error) + return "retainBackupsOnDelete." + error; + } + if (message.dataDiskProvisionedIops != null && message.hasOwnProperty("dataDiskProvisionedIops")) { + properties._dataDiskProvisionedIops = 1; + if (!$util.isInteger(message.dataDiskProvisionedIops) && !(message.dataDiskProvisionedIops && $util.isInteger(message.dataDiskProvisionedIops.low) && $util.isInteger(message.dataDiskProvisionedIops.high))) + return "dataDiskProvisionedIops: integer|Long expected"; + } + if (message.dataDiskProvisionedThroughput != null && message.hasOwnProperty("dataDiskProvisionedThroughput")) { + properties._dataDiskProvisionedThroughput = 1; + if (!$util.isInteger(message.dataDiskProvisionedThroughput) && !(message.dataDiskProvisionedThroughput && $util.isInteger(message.dataDiskProvisionedThroughput.low) && $util.isInteger(message.dataDiskProvisionedThroughput.high))) + return "dataDiskProvisionedThroughput: integer|Long expected"; + } + if (message.connectionPoolConfig != null && message.hasOwnProperty("connectionPoolConfig")) { + properties._connectionPoolConfig = 1; + { + var error = $root.google.cloud.sql.v1.ConnectionPoolConfig.verify(message.connectionPoolConfig); + if (error) + return "connectionPoolConfig." + error; + } + } + if (message.finalBackupConfig != null && message.hasOwnProperty("finalBackupConfig")) { + properties._finalBackupConfig = 1; + { + var error = $root.google.cloud.sql.v1.FinalBackupConfig.verify(message.finalBackupConfig); + if (error) + return "finalBackupConfig." + error; + } + } + if (message.readPoolAutoScaleConfig != null && message.hasOwnProperty("readPoolAutoScaleConfig")) { + properties._readPoolAutoScaleConfig = 1; + { + var error = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.verify(message.readPoolAutoScaleConfig); + if (error) + return "readPoolAutoScaleConfig." + error; + } + } + if (message.acceleratedReplicaMode != null && message.hasOwnProperty("acceleratedReplicaMode")) { + var error = $root.google.protobuf.BoolValue.verify(message.acceleratedReplicaMode); + if (error) + return "acceleratedReplicaMode." + error; + } + if (message.autoUpgradeEnabled != null && message.hasOwnProperty("autoUpgradeEnabled")) { + properties._autoUpgradeEnabled = 1; + if (typeof message.autoUpgradeEnabled !== "boolean") + return "autoUpgradeEnabled: boolean expected"; + } + if (message.entraidConfig != null && message.hasOwnProperty("entraidConfig")) { + var error = $root.google.cloud.sql.v1.SqlServerEntraIdConfig.verify(message.entraidConfig); + if (error) + return "entraidConfig." + error; + } + if (message.dataApiAccess != null && message.hasOwnProperty("dataApiAccess")) { + properties._dataApiAccess = 1; + switch (message.dataApiAccess) { + default: + return "dataApiAccess: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.performanceCaptureConfig != null && message.hasOwnProperty("performanceCaptureConfig")) { + var error = $root.google.cloud.sql.v1.PerformanceCaptureConfig.verify(message.performanceCaptureConfig); + if (error) + return "performanceCaptureConfig." + error; + } + return null; + }; + + /** + * Creates a Settings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.Settings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.Settings} Settings + */ + Settings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.Settings) + return object; + var message = new $root.google.cloud.sql.v1.Settings(); + if (object.settingsVersion != null) { + if (typeof object.settingsVersion !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.settingsVersion: object expected"); + message.settingsVersion = $root.google.protobuf.Int64Value.fromObject(object.settingsVersion); + } + if (object.authorizedGaeApplications) { + if (!Array.isArray(object.authorizedGaeApplications)) + throw TypeError(".google.cloud.sql.v1.Settings.authorizedGaeApplications: array expected"); + message.authorizedGaeApplications = []; + for (var i = 0; i < object.authorizedGaeApplications.length; ++i) + message.authorizedGaeApplications[i] = String(object.authorizedGaeApplications[i]); + } + if (object.tier != null) + message.tier = String(object.tier); + if (object.kind != null) + message.kind = String(object.kind); + if (object.userLabels) { + if (typeof object.userLabels !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.userLabels: object expected"); + message.userLabels = {}; + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } + switch (object.availabilityType) { + default: + if (typeof object.availabilityType === "number") { + message.availabilityType = object.availabilityType; + break; + } + break; + case "SQL_AVAILABILITY_TYPE_UNSPECIFIED": + case 0: + message.availabilityType = 0; + break; + case "ZONAL": + case 1: + message.availabilityType = 1; + break; + case "REGIONAL": + case 2: + message.availabilityType = 2; + break; + } + switch (object.pricingPlan) { + default: + if (typeof object.pricingPlan === "number") { + message.pricingPlan = object.pricingPlan; + break; + } + break; + case "SQL_PRICING_PLAN_UNSPECIFIED": + case 0: + message.pricingPlan = 0; + break; + case "PACKAGE": + case 1: + message.pricingPlan = 1; + break; + case "PER_USE": + case 2: + message.pricingPlan = 2; + break; + } + switch (object.replicationType) { + default: + if (typeof object.replicationType === "number") { + message.replicationType = object.replicationType; + break; + } + break; + case "SQL_REPLICATION_TYPE_UNSPECIFIED": + case 0: + message.replicationType = 0; + break; + case "SYNCHRONOUS": + case 1: + message.replicationType = 1; + break; + case "ASYNCHRONOUS": + case 2: + message.replicationType = 2; + break; + } + if (object.storageAutoResizeLimit != null) { + if (typeof object.storageAutoResizeLimit !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.storageAutoResizeLimit: object expected"); + message.storageAutoResizeLimit = $root.google.protobuf.Int64Value.fromObject(object.storageAutoResizeLimit); + } + switch (object.activationPolicy) { + default: + if (typeof object.activationPolicy === "number") { + message.activationPolicy = object.activationPolicy; + break; + } + break; + case "SQL_ACTIVATION_POLICY_UNSPECIFIED": + case 0: + message.activationPolicy = 0; + break; + case "ALWAYS": + case 1: + message.activationPolicy = 1; + break; + case "NEVER": + case 2: + message.activationPolicy = 2; + break; + case "ON_DEMAND": + case 3: + message.activationPolicy = 3; + break; + } + if (object.ipConfiguration != null) { + if (typeof object.ipConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.ipConfiguration: object expected"); + message.ipConfiguration = $root.google.cloud.sql.v1.IpConfiguration.fromObject(object.ipConfiguration); + } + if (object.storageAutoResize != null) { + if (typeof object.storageAutoResize !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.storageAutoResize: object expected"); + message.storageAutoResize = $root.google.protobuf.BoolValue.fromObject(object.storageAutoResize); + } + if (object.locationPreference != null) { + if (typeof object.locationPreference !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.locationPreference: object expected"); + message.locationPreference = $root.google.cloud.sql.v1.LocationPreference.fromObject(object.locationPreference); + } + if (object.databaseFlags) { + if (!Array.isArray(object.databaseFlags)) + throw TypeError(".google.cloud.sql.v1.Settings.databaseFlags: array expected"); + message.databaseFlags = []; + for (var i = 0; i < object.databaseFlags.length; ++i) { + if (typeof object.databaseFlags[i] !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.databaseFlags: object expected"); + message.databaseFlags[i] = $root.google.cloud.sql.v1.DatabaseFlags.fromObject(object.databaseFlags[i]); + } + } + switch (object.dataDiskType) { + default: + if (typeof object.dataDiskType === "number") { + message.dataDiskType = object.dataDiskType; + break; + } + break; + case "SQL_DATA_DISK_TYPE_UNSPECIFIED": + case 0: + message.dataDiskType = 0; + break; + case "PD_SSD": + case 1: + message.dataDiskType = 1; + break; + case "PD_HDD": + case 2: + message.dataDiskType = 2; + break; + case "OBSOLETE_LOCAL_SSD": + case 3: + message.dataDiskType = 3; + break; + case "HYPERDISK_BALANCED": + case 4: + message.dataDiskType = 4; + break; + } + if (object.maintenanceWindow != null) { + if (typeof object.maintenanceWindow !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.maintenanceWindow: object expected"); + message.maintenanceWindow = $root.google.cloud.sql.v1.MaintenanceWindow.fromObject(object.maintenanceWindow); + } + if (object.backupConfiguration != null) { + if (typeof object.backupConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.backupConfiguration: object expected"); + message.backupConfiguration = $root.google.cloud.sql.v1.BackupConfiguration.fromObject(object.backupConfiguration); + } + if (object.databaseReplicationEnabled != null) { + if (typeof object.databaseReplicationEnabled !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.databaseReplicationEnabled: object expected"); + message.databaseReplicationEnabled = $root.google.protobuf.BoolValue.fromObject(object.databaseReplicationEnabled); + } + if (object.crashSafeReplicationEnabled != null) { + if (typeof object.crashSafeReplicationEnabled !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.crashSafeReplicationEnabled: object expected"); + message.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.fromObject(object.crashSafeReplicationEnabled); + } + if (object.dataDiskSizeGb != null) { + if (typeof object.dataDiskSizeGb !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.dataDiskSizeGb: object expected"); + message.dataDiskSizeGb = $root.google.protobuf.Int64Value.fromObject(object.dataDiskSizeGb); + } + if (object.activeDirectoryConfig != null) { + if (typeof object.activeDirectoryConfig !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.activeDirectoryConfig: object expected"); + message.activeDirectoryConfig = $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.fromObject(object.activeDirectoryConfig); + } + if (object.collation != null) + message.collation = String(object.collation); + if (object.denyMaintenancePeriods) { + if (!Array.isArray(object.denyMaintenancePeriods)) + throw TypeError(".google.cloud.sql.v1.Settings.denyMaintenancePeriods: array expected"); + message.denyMaintenancePeriods = []; + for (var i = 0; i < object.denyMaintenancePeriods.length; ++i) { + if (typeof object.denyMaintenancePeriods[i] !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.denyMaintenancePeriods: object expected"); + message.denyMaintenancePeriods[i] = $root.google.cloud.sql.v1.DenyMaintenancePeriod.fromObject(object.denyMaintenancePeriods[i]); + } + } + if (object.insightsConfig != null) { + if (typeof object.insightsConfig !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.insightsConfig: object expected"); + message.insightsConfig = $root.google.cloud.sql.v1.InsightsConfig.fromObject(object.insightsConfig); + } + if (object.passwordValidationPolicy != null) { + if (typeof object.passwordValidationPolicy !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.passwordValidationPolicy: object expected"); + message.passwordValidationPolicy = $root.google.cloud.sql.v1.PasswordValidationPolicy.fromObject(object.passwordValidationPolicy); + } + if (object.sqlServerAuditConfig != null) { + if (typeof object.sqlServerAuditConfig !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.sqlServerAuditConfig: object expected"); + message.sqlServerAuditConfig = $root.google.cloud.sql.v1.SqlServerAuditConfig.fromObject(object.sqlServerAuditConfig); + } + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNSPECIFIED": + case 0: + message.edition = 0; + break; + case "ENTERPRISE": + case 2: + message.edition = 2; + break; + case "ENTERPRISE_PLUS": + case 3: + message.edition = 3; + break; + } + switch (object.connectorEnforcement) { + default: + if (typeof object.connectorEnforcement === "number") { + message.connectorEnforcement = object.connectorEnforcement; + break; + } + break; + case "CONNECTOR_ENFORCEMENT_UNSPECIFIED": + case 0: + message.connectorEnforcement = 0; + break; + case "NOT_REQUIRED": + case 1: + message.connectorEnforcement = 1; + break; + case "REQUIRED": + case 2: + message.connectorEnforcement = 2; + break; + } + if (object.deletionProtectionEnabled != null) { + if (typeof object.deletionProtectionEnabled !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.deletionProtectionEnabled: object expected"); + message.deletionProtectionEnabled = $root.google.protobuf.BoolValue.fromObject(object.deletionProtectionEnabled); + } + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.advancedMachineFeatures != null) { + if (typeof object.advancedMachineFeatures !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.advancedMachineFeatures: object expected"); + message.advancedMachineFeatures = $root.google.cloud.sql.v1.AdvancedMachineFeatures.fromObject(object.advancedMachineFeatures); + } + if (object.dataCacheConfig != null) { + if (typeof object.dataCacheConfig !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.dataCacheConfig: object expected"); + message.dataCacheConfig = $root.google.cloud.sql.v1.DataCacheConfig.fromObject(object.dataCacheConfig); + } + if (object.replicationLagMaxSeconds != null) { + if (typeof object.replicationLagMaxSeconds !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.replicationLagMaxSeconds: object expected"); + message.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.fromObject(object.replicationLagMaxSeconds); + } + if (object.enableGoogleMlIntegration != null) { + if (typeof object.enableGoogleMlIntegration !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.enableGoogleMlIntegration: object expected"); + message.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.fromObject(object.enableGoogleMlIntegration); + } + if (object.enableDataplexIntegration != null) { + if (typeof object.enableDataplexIntegration !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.enableDataplexIntegration: object expected"); + message.enableDataplexIntegration = $root.google.protobuf.BoolValue.fromObject(object.enableDataplexIntegration); + } + if (object.retainBackupsOnDelete != null) { + if (typeof object.retainBackupsOnDelete !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.retainBackupsOnDelete: object expected"); + message.retainBackupsOnDelete = $root.google.protobuf.BoolValue.fromObject(object.retainBackupsOnDelete); + } + if (object.dataDiskProvisionedIops != null) + if ($util.Long) + (message.dataDiskProvisionedIops = $util.Long.fromValue(object.dataDiskProvisionedIops)).unsigned = false; + else if (typeof object.dataDiskProvisionedIops === "string") + message.dataDiskProvisionedIops = parseInt(object.dataDiskProvisionedIops, 10); + else if (typeof object.dataDiskProvisionedIops === "number") + message.dataDiskProvisionedIops = object.dataDiskProvisionedIops; + else if (typeof object.dataDiskProvisionedIops === "object") + message.dataDiskProvisionedIops = new $util.LongBits(object.dataDiskProvisionedIops.low >>> 0, object.dataDiskProvisionedIops.high >>> 0).toNumber(); + if (object.dataDiskProvisionedThroughput != null) + if ($util.Long) + (message.dataDiskProvisionedThroughput = $util.Long.fromValue(object.dataDiskProvisionedThroughput)).unsigned = false; + else if (typeof object.dataDiskProvisionedThroughput === "string") + message.dataDiskProvisionedThroughput = parseInt(object.dataDiskProvisionedThroughput, 10); + else if (typeof object.dataDiskProvisionedThroughput === "number") + message.dataDiskProvisionedThroughput = object.dataDiskProvisionedThroughput; + else if (typeof object.dataDiskProvisionedThroughput === "object") + message.dataDiskProvisionedThroughput = new $util.LongBits(object.dataDiskProvisionedThroughput.low >>> 0, object.dataDiskProvisionedThroughput.high >>> 0).toNumber(); + if (object.connectionPoolConfig != null) { + if (typeof object.connectionPoolConfig !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.connectionPoolConfig: object expected"); + message.connectionPoolConfig = $root.google.cloud.sql.v1.ConnectionPoolConfig.fromObject(object.connectionPoolConfig); + } + if (object.finalBackupConfig != null) { + if (typeof object.finalBackupConfig !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.finalBackupConfig: object expected"); + message.finalBackupConfig = $root.google.cloud.sql.v1.FinalBackupConfig.fromObject(object.finalBackupConfig); + } + if (object.readPoolAutoScaleConfig != null) { + if (typeof object.readPoolAutoScaleConfig !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.readPoolAutoScaleConfig: object expected"); + message.readPoolAutoScaleConfig = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.fromObject(object.readPoolAutoScaleConfig); + } + if (object.acceleratedReplicaMode != null) { + if (typeof object.acceleratedReplicaMode !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.acceleratedReplicaMode: object expected"); + message.acceleratedReplicaMode = $root.google.protobuf.BoolValue.fromObject(object.acceleratedReplicaMode); + } + if (object.autoUpgradeEnabled != null) + message.autoUpgradeEnabled = Boolean(object.autoUpgradeEnabled); + if (object.entraidConfig != null) { + if (typeof object.entraidConfig !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.entraidConfig: object expected"); + message.entraidConfig = $root.google.cloud.sql.v1.SqlServerEntraIdConfig.fromObject(object.entraidConfig); + } + switch (object.dataApiAccess) { + default: + if (typeof object.dataApiAccess === "number") { + message.dataApiAccess = object.dataApiAccess; + break; + } + break; + case "DATA_API_ACCESS_UNSPECIFIED": + case 0: + message.dataApiAccess = 0; + break; + case "DISALLOW_DATA_API": + case 1: + message.dataApiAccess = 1; + break; + case "ALLOW_DATA_API": + case 2: + message.dataApiAccess = 2; + break; + } + if (object.performanceCaptureConfig != null) { + if (typeof object.performanceCaptureConfig !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.performanceCaptureConfig: object expected"); + message.performanceCaptureConfig = $root.google.cloud.sql.v1.PerformanceCaptureConfig.fromObject(object.performanceCaptureConfig); + } + return message; + }; + + /** + * Creates a plain object from a Settings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.Settings + * @static + * @param {google.cloud.sql.v1.Settings} message Settings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Settings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.authorizedGaeApplications = []; + object.databaseFlags = []; + object.denyMaintenancePeriods = []; + } + if (options.objects || options.defaults) + object.userLabels = {}; + if (options.defaults) { + object.settingsVersion = null; + object.tier = ""; + object.kind = ""; + object.availabilityType = options.enums === String ? "SQL_AVAILABILITY_TYPE_UNSPECIFIED" : 0; + object.pricingPlan = options.enums === String ? "SQL_PRICING_PLAN_UNSPECIFIED" : 0; + object.replicationType = options.enums === String ? "SQL_REPLICATION_TYPE_UNSPECIFIED" : 0; + object.storageAutoResizeLimit = null; + object.activationPolicy = options.enums === String ? "SQL_ACTIVATION_POLICY_UNSPECIFIED" : 0; + object.ipConfiguration = null; + object.storageAutoResize = null; + object.locationPreference = null; + object.dataDiskType = options.enums === String ? "SQL_DATA_DISK_TYPE_UNSPECIFIED" : 0; + object.maintenanceWindow = null; + object.backupConfiguration = null; + object.databaseReplicationEnabled = null; + object.crashSafeReplicationEnabled = null; + object.dataDiskSizeGb = null; + object.activeDirectoryConfig = null; + object.collation = ""; + object.insightsConfig = null; + object.passwordValidationPolicy = null; + object.sqlServerAuditConfig = null; + object.connectorEnforcement = options.enums === String ? "CONNECTOR_ENFORCEMENT_UNSPECIFIED" : 0; + object.deletionProtectionEnabled = null; + object.timeZone = ""; + object.advancedMachineFeatures = null; + object.dataCacheConfig = null; + object.edition = options.enums === String ? "EDITION_UNSPECIFIED" : 0; + object.replicationLagMaxSeconds = null; + object.enableGoogleMlIntegration = null; + object.enableDataplexIntegration = null; + object.retainBackupsOnDelete = null; + object.acceleratedReplicaMode = null; + object.entraidConfig = null; + object.performanceCaptureConfig = null; + } + if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) + object.settingsVersion = $root.google.protobuf.Int64Value.toObject(message.settingsVersion, options); + if (message.authorizedGaeApplications && message.authorizedGaeApplications.length) { + object.authorizedGaeApplications = []; + for (var j = 0; j < message.authorizedGaeApplications.length; ++j) + object.authorizedGaeApplications[j] = message.authorizedGaeApplications[j]; + } + if (message.tier != null && message.hasOwnProperty("tier")) + object.tier = message.tier; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + var keys2; + if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { + object.userLabels = {}; + for (var j = 0; j < keys2.length; ++j) + object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } + if (message.availabilityType != null && message.hasOwnProperty("availabilityType")) + object.availabilityType = options.enums === String ? $root.google.cloud.sql.v1.SqlAvailabilityType[message.availabilityType] === undefined ? message.availabilityType : $root.google.cloud.sql.v1.SqlAvailabilityType[message.availabilityType] : message.availabilityType; + if (message.pricingPlan != null && message.hasOwnProperty("pricingPlan")) + object.pricingPlan = options.enums === String ? $root.google.cloud.sql.v1.SqlPricingPlan[message.pricingPlan] === undefined ? message.pricingPlan : $root.google.cloud.sql.v1.SqlPricingPlan[message.pricingPlan] : message.pricingPlan; + if (message.replicationType != null && message.hasOwnProperty("replicationType")) + object.replicationType = options.enums === String ? $root.google.cloud.sql.v1.SqlReplicationType[message.replicationType] === undefined ? message.replicationType : $root.google.cloud.sql.v1.SqlReplicationType[message.replicationType] : message.replicationType; + if (message.storageAutoResizeLimit != null && message.hasOwnProperty("storageAutoResizeLimit")) + object.storageAutoResizeLimit = $root.google.protobuf.Int64Value.toObject(message.storageAutoResizeLimit, options); + if (message.activationPolicy != null && message.hasOwnProperty("activationPolicy")) + object.activationPolicy = options.enums === String ? $root.google.cloud.sql.v1.Settings.SqlActivationPolicy[message.activationPolicy] === undefined ? message.activationPolicy : $root.google.cloud.sql.v1.Settings.SqlActivationPolicy[message.activationPolicy] : message.activationPolicy; + if (message.ipConfiguration != null && message.hasOwnProperty("ipConfiguration")) + object.ipConfiguration = $root.google.cloud.sql.v1.IpConfiguration.toObject(message.ipConfiguration, options); + if (message.storageAutoResize != null && message.hasOwnProperty("storageAutoResize")) + object.storageAutoResize = $root.google.protobuf.BoolValue.toObject(message.storageAutoResize, options); + if (message.locationPreference != null && message.hasOwnProperty("locationPreference")) + object.locationPreference = $root.google.cloud.sql.v1.LocationPreference.toObject(message.locationPreference, options); + if (message.databaseFlags && message.databaseFlags.length) { + object.databaseFlags = []; + for (var j = 0; j < message.databaseFlags.length; ++j) + object.databaseFlags[j] = $root.google.cloud.sql.v1.DatabaseFlags.toObject(message.databaseFlags[j], options); + } + if (message.dataDiskType != null && message.hasOwnProperty("dataDiskType")) + object.dataDiskType = options.enums === String ? $root.google.cloud.sql.v1.SqlDataDiskType[message.dataDiskType] === undefined ? message.dataDiskType : $root.google.cloud.sql.v1.SqlDataDiskType[message.dataDiskType] : message.dataDiskType; + if (message.maintenanceWindow != null && message.hasOwnProperty("maintenanceWindow")) + object.maintenanceWindow = $root.google.cloud.sql.v1.MaintenanceWindow.toObject(message.maintenanceWindow, options); + if (message.backupConfiguration != null && message.hasOwnProperty("backupConfiguration")) + object.backupConfiguration = $root.google.cloud.sql.v1.BackupConfiguration.toObject(message.backupConfiguration, options); + if (message.databaseReplicationEnabled != null && message.hasOwnProperty("databaseReplicationEnabled")) + object.databaseReplicationEnabled = $root.google.protobuf.BoolValue.toObject(message.databaseReplicationEnabled, options); + if (message.crashSafeReplicationEnabled != null && message.hasOwnProperty("crashSafeReplicationEnabled")) + object.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.toObject(message.crashSafeReplicationEnabled, options); + if (message.dataDiskSizeGb != null && message.hasOwnProperty("dataDiskSizeGb")) + object.dataDiskSizeGb = $root.google.protobuf.Int64Value.toObject(message.dataDiskSizeGb, options); + if (message.activeDirectoryConfig != null && message.hasOwnProperty("activeDirectoryConfig")) + object.activeDirectoryConfig = $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.toObject(message.activeDirectoryConfig, options); + if (message.collation != null && message.hasOwnProperty("collation")) + object.collation = message.collation; + if (message.denyMaintenancePeriods && message.denyMaintenancePeriods.length) { + object.denyMaintenancePeriods = []; + for (var j = 0; j < message.denyMaintenancePeriods.length; ++j) + object.denyMaintenancePeriods[j] = $root.google.cloud.sql.v1.DenyMaintenancePeriod.toObject(message.denyMaintenancePeriods[j], options); + } + if (message.insightsConfig != null && message.hasOwnProperty("insightsConfig")) + object.insightsConfig = $root.google.cloud.sql.v1.InsightsConfig.toObject(message.insightsConfig, options); + if (message.passwordValidationPolicy != null && message.hasOwnProperty("passwordValidationPolicy")) + object.passwordValidationPolicy = $root.google.cloud.sql.v1.PasswordValidationPolicy.toObject(message.passwordValidationPolicy, options); + if (message.sqlServerAuditConfig != null && message.hasOwnProperty("sqlServerAuditConfig")) + object.sqlServerAuditConfig = $root.google.cloud.sql.v1.SqlServerAuditConfig.toObject(message.sqlServerAuditConfig, options); + if (message.connectorEnforcement != null && message.hasOwnProperty("connectorEnforcement")) + object.connectorEnforcement = options.enums === String ? $root.google.cloud.sql.v1.Settings.ConnectorEnforcement[message.connectorEnforcement] === undefined ? message.connectorEnforcement : $root.google.cloud.sql.v1.Settings.ConnectorEnforcement[message.connectorEnforcement] : message.connectorEnforcement; + if (message.deletionProtectionEnabled != null && message.hasOwnProperty("deletionProtectionEnabled")) + object.deletionProtectionEnabled = $root.google.protobuf.BoolValue.toObject(message.deletionProtectionEnabled, options); + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.advancedMachineFeatures != null && message.hasOwnProperty("advancedMachineFeatures")) + object.advancedMachineFeatures = $root.google.cloud.sql.v1.AdvancedMachineFeatures.toObject(message.advancedMachineFeatures, options); + if (message.dataCacheConfig != null && message.hasOwnProperty("dataCacheConfig")) + object.dataCacheConfig = $root.google.cloud.sql.v1.DataCacheConfig.toObject(message.dataCacheConfig, options); + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.cloud.sql.v1.Settings.Edition[message.edition] === undefined ? message.edition : $root.google.cloud.sql.v1.Settings.Edition[message.edition] : message.edition; + if (message.replicationLagMaxSeconds != null && message.hasOwnProperty("replicationLagMaxSeconds")) + object.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.toObject(message.replicationLagMaxSeconds, options); + if (message.enableGoogleMlIntegration != null && message.hasOwnProperty("enableGoogleMlIntegration")) + object.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.toObject(message.enableGoogleMlIntegration, options); + if (message.enableDataplexIntegration != null && message.hasOwnProperty("enableDataplexIntegration")) + object.enableDataplexIntegration = $root.google.protobuf.BoolValue.toObject(message.enableDataplexIntegration, options); + if (message.retainBackupsOnDelete != null && message.hasOwnProperty("retainBackupsOnDelete")) + object.retainBackupsOnDelete = $root.google.protobuf.BoolValue.toObject(message.retainBackupsOnDelete, options); + if (message.dataDiskProvisionedIops != null && message.hasOwnProperty("dataDiskProvisionedIops")) { + if (typeof message.dataDiskProvisionedIops === "number") + object.dataDiskProvisionedIops = options.longs === String ? String(message.dataDiskProvisionedIops) : message.dataDiskProvisionedIops; + else + object.dataDiskProvisionedIops = options.longs === String ? $util.Long.prototype.toString.call(message.dataDiskProvisionedIops) : options.longs === Number ? new $util.LongBits(message.dataDiskProvisionedIops.low >>> 0, message.dataDiskProvisionedIops.high >>> 0).toNumber() : message.dataDiskProvisionedIops; + if (options.oneofs) + object._dataDiskProvisionedIops = "dataDiskProvisionedIops"; + } + if (message.dataDiskProvisionedThroughput != null && message.hasOwnProperty("dataDiskProvisionedThroughput")) { + if (typeof message.dataDiskProvisionedThroughput === "number") + object.dataDiskProvisionedThroughput = options.longs === String ? String(message.dataDiskProvisionedThroughput) : message.dataDiskProvisionedThroughput; + else + object.dataDiskProvisionedThroughput = options.longs === String ? $util.Long.prototype.toString.call(message.dataDiskProvisionedThroughput) : options.longs === Number ? new $util.LongBits(message.dataDiskProvisionedThroughput.low >>> 0, message.dataDiskProvisionedThroughput.high >>> 0).toNumber() : message.dataDiskProvisionedThroughput; + if (options.oneofs) + object._dataDiskProvisionedThroughput = "dataDiskProvisionedThroughput"; + } + if (message.connectionPoolConfig != null && message.hasOwnProperty("connectionPoolConfig")) { + object.connectionPoolConfig = $root.google.cloud.sql.v1.ConnectionPoolConfig.toObject(message.connectionPoolConfig, options); + if (options.oneofs) + object._connectionPoolConfig = "connectionPoolConfig"; + } + if (message.finalBackupConfig != null && message.hasOwnProperty("finalBackupConfig")) { + object.finalBackupConfig = $root.google.cloud.sql.v1.FinalBackupConfig.toObject(message.finalBackupConfig, options); + if (options.oneofs) + object._finalBackupConfig = "finalBackupConfig"; + } + if (message.readPoolAutoScaleConfig != null && message.hasOwnProperty("readPoolAutoScaleConfig")) { + object.readPoolAutoScaleConfig = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.toObject(message.readPoolAutoScaleConfig, options); + if (options.oneofs) + object._readPoolAutoScaleConfig = "readPoolAutoScaleConfig"; + } + if (message.acceleratedReplicaMode != null && message.hasOwnProperty("acceleratedReplicaMode")) + object.acceleratedReplicaMode = $root.google.protobuf.BoolValue.toObject(message.acceleratedReplicaMode, options); + if (message.autoUpgradeEnabled != null && message.hasOwnProperty("autoUpgradeEnabled")) { + object.autoUpgradeEnabled = message.autoUpgradeEnabled; + if (options.oneofs) + object._autoUpgradeEnabled = "autoUpgradeEnabled"; + } + if (message.entraidConfig != null && message.hasOwnProperty("entraidConfig")) + object.entraidConfig = $root.google.cloud.sql.v1.SqlServerEntraIdConfig.toObject(message.entraidConfig, options); + if (message.dataApiAccess != null && message.hasOwnProperty("dataApiAccess")) { + object.dataApiAccess = options.enums === String ? $root.google.cloud.sql.v1.Settings.DataApiAccess[message.dataApiAccess] === undefined ? message.dataApiAccess : $root.google.cloud.sql.v1.Settings.DataApiAccess[message.dataApiAccess] : message.dataApiAccess; + if (options.oneofs) + object._dataApiAccess = "dataApiAccess"; + } + if (message.performanceCaptureConfig != null && message.hasOwnProperty("performanceCaptureConfig")) + object.performanceCaptureConfig = $root.google.cloud.sql.v1.PerformanceCaptureConfig.toObject(message.performanceCaptureConfig, options); + return object; + }; + + /** + * Converts this Settings to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.Settings + * @instance + * @returns {Object.} JSON object + */ + Settings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Settings + * @function getTypeUrl + * @memberof google.cloud.sql.v1.Settings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Settings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.Settings"; + }; + + /** + * SqlActivationPolicy enum. + * @name google.cloud.sql.v1.Settings.SqlActivationPolicy + * @enum {number} + * @property {number} SQL_ACTIVATION_POLICY_UNSPECIFIED=0 SQL_ACTIVATION_POLICY_UNSPECIFIED value + * @property {number} ALWAYS=1 ALWAYS value + * @property {number} NEVER=2 NEVER value + * @property {number} ON_DEMAND=3 ON_DEMAND value + */ + Settings.SqlActivationPolicy = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_ACTIVATION_POLICY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALWAYS"] = 1; + values[valuesById[2] = "NEVER"] = 2; + values[valuesById[3] = "ON_DEMAND"] = 3; + return values; + })(); + + /** + * Edition enum. + * @name google.cloud.sql.v1.Settings.Edition + * @enum {number} + * @property {number} EDITION_UNSPECIFIED=0 EDITION_UNSPECIFIED value + * @property {number} ENTERPRISE=2 ENTERPRISE value + * @property {number} ENTERPRISE_PLUS=3 ENTERPRISE_PLUS value + */ + Settings.Edition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EDITION_UNSPECIFIED"] = 0; + values[valuesById[2] = "ENTERPRISE"] = 2; + values[valuesById[3] = "ENTERPRISE_PLUS"] = 3; + return values; + })(); + + /** + * ConnectorEnforcement enum. + * @name google.cloud.sql.v1.Settings.ConnectorEnforcement + * @enum {number} + * @property {number} CONNECTOR_ENFORCEMENT_UNSPECIFIED=0 CONNECTOR_ENFORCEMENT_UNSPECIFIED value + * @property {number} NOT_REQUIRED=1 NOT_REQUIRED value + * @property {number} REQUIRED=2 REQUIRED value + */ + Settings.ConnectorEnforcement = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONNECTOR_ENFORCEMENT_UNSPECIFIED"] = 0; + values[valuesById[1] = "NOT_REQUIRED"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + return values; + })(); + + /** + * DataApiAccess enum. + * @name google.cloud.sql.v1.Settings.DataApiAccess + * @enum {number} + * @property {number} DATA_API_ACCESS_UNSPECIFIED=0 DATA_API_ACCESS_UNSPECIFIED value + * @property {number} DISALLOW_DATA_API=1 DISALLOW_DATA_API value + * @property {number} ALLOW_DATA_API=2 ALLOW_DATA_API value + */ + Settings.DataApiAccess = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DATA_API_ACCESS_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISALLOW_DATA_API"] = 1; + values[valuesById[2] = "ALLOW_DATA_API"] = 2; + return values; + })(); + + return Settings; + })(); + + v1.PerformanceCaptureConfig = (function() { + + /** + * Properties of a PerformanceCaptureConfig. + * @memberof google.cloud.sql.v1 + * @interface IPerformanceCaptureConfig + * @property {boolean|null} [enabled] PerformanceCaptureConfig enabled + * @property {number|null} [probingIntervalSeconds] PerformanceCaptureConfig probingIntervalSeconds + * @property {number|null} [probeThreshold] PerformanceCaptureConfig probeThreshold + * @property {number|null} [runningThreadsThreshold] PerformanceCaptureConfig runningThreadsThreshold + * @property {number|null} [secondsBehindSourceThreshold] PerformanceCaptureConfig secondsBehindSourceThreshold + * @property {number|null} [transactionDurationThreshold] PerformanceCaptureConfig transactionDurationThreshold + */ + + /** + * Constructs a new PerformanceCaptureConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a PerformanceCaptureConfig. + * @implements IPerformanceCaptureConfig + * @constructor + * @param {google.cloud.sql.v1.IPerformanceCaptureConfig=} [properties] Properties to set + */ + function PerformanceCaptureConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PerformanceCaptureConfig enabled. + * @member {boolean|null|undefined} enabled + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.enabled = null; + + /** + * PerformanceCaptureConfig probingIntervalSeconds. + * @member {number|null|undefined} probingIntervalSeconds + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.probingIntervalSeconds = null; + + /** + * PerformanceCaptureConfig probeThreshold. + * @member {number|null|undefined} probeThreshold + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.probeThreshold = null; + + /** + * PerformanceCaptureConfig runningThreadsThreshold. + * @member {number|null|undefined} runningThreadsThreshold + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.runningThreadsThreshold = null; + + /** + * PerformanceCaptureConfig secondsBehindSourceThreshold. + * @member {number|null|undefined} secondsBehindSourceThreshold + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.secondsBehindSourceThreshold = null; + + /** + * PerformanceCaptureConfig transactionDurationThreshold. + * @member {number|null|undefined} transactionDurationThreshold + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.transactionDurationThreshold = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_enabled", { + get: $util.oneOfGetter($oneOfFields = ["enabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_probingIntervalSeconds", { + get: $util.oneOfGetter($oneOfFields = ["probingIntervalSeconds"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_probeThreshold", { + get: $util.oneOfGetter($oneOfFields = ["probeThreshold"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_runningThreadsThreshold", { + get: $util.oneOfGetter($oneOfFields = ["runningThreadsThreshold"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_secondsBehindSourceThreshold", { + get: $util.oneOfGetter($oneOfFields = ["secondsBehindSourceThreshold"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_transactionDurationThreshold", { + get: $util.oneOfGetter($oneOfFields = ["transactionDurationThreshold"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PerformanceCaptureConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @static + * @param {google.cloud.sql.v1.IPerformanceCaptureConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.PerformanceCaptureConfig} PerformanceCaptureConfig instance + */ + PerformanceCaptureConfig.create = function create(properties) { + return new PerformanceCaptureConfig(properties); + }; + + /** + * Encodes the specified PerformanceCaptureConfig message. Does not implicitly {@link google.cloud.sql.v1.PerformanceCaptureConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @static + * @param {google.cloud.sql.v1.IPerformanceCaptureConfig} message PerformanceCaptureConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformanceCaptureConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.probingIntervalSeconds != null && Object.hasOwnProperty.call(message, "probingIntervalSeconds")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.probingIntervalSeconds); + if (message.probeThreshold != null && Object.hasOwnProperty.call(message, "probeThreshold")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.probeThreshold); + if (message.runningThreadsThreshold != null && Object.hasOwnProperty.call(message, "runningThreadsThreshold")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.runningThreadsThreshold); + if (message.secondsBehindSourceThreshold != null && Object.hasOwnProperty.call(message, "secondsBehindSourceThreshold")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.secondsBehindSourceThreshold); + if (message.transactionDurationThreshold != null && Object.hasOwnProperty.call(message, "transactionDurationThreshold")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.transactionDurationThreshold); + return writer; + }; + + /** + * Encodes the specified PerformanceCaptureConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PerformanceCaptureConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @static + * @param {google.cloud.sql.v1.IPerformanceCaptureConfig} message PerformanceCaptureConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformanceCaptureConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PerformanceCaptureConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.PerformanceCaptureConfig} PerformanceCaptureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformanceCaptureConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PerformanceCaptureConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.enabled = reader.bool(); + break; + } + case 2: { + message.probingIntervalSeconds = reader.int32(); + break; + } + case 3: { + message.probeThreshold = reader.int32(); + break; + } + case 4: { + message.runningThreadsThreshold = reader.int32(); + break; + } + case 5: { + message.secondsBehindSourceThreshold = reader.int32(); + break; + } + case 8: { + message.transactionDurationThreshold = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PerformanceCaptureConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.PerformanceCaptureConfig} PerformanceCaptureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformanceCaptureConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PerformanceCaptureConfig message. + * @function verify + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PerformanceCaptureConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + properties._enabled = 1; + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + } + if (message.probingIntervalSeconds != null && message.hasOwnProperty("probingIntervalSeconds")) { + properties._probingIntervalSeconds = 1; + if (!$util.isInteger(message.probingIntervalSeconds)) + return "probingIntervalSeconds: integer expected"; + } + if (message.probeThreshold != null && message.hasOwnProperty("probeThreshold")) { + properties._probeThreshold = 1; + if (!$util.isInteger(message.probeThreshold)) + return "probeThreshold: integer expected"; + } + if (message.runningThreadsThreshold != null && message.hasOwnProperty("runningThreadsThreshold")) { + properties._runningThreadsThreshold = 1; + if (!$util.isInteger(message.runningThreadsThreshold)) + return "runningThreadsThreshold: integer expected"; + } + if (message.secondsBehindSourceThreshold != null && message.hasOwnProperty("secondsBehindSourceThreshold")) { + properties._secondsBehindSourceThreshold = 1; + if (!$util.isInteger(message.secondsBehindSourceThreshold)) + return "secondsBehindSourceThreshold: integer expected"; + } + if (message.transactionDurationThreshold != null && message.hasOwnProperty("transactionDurationThreshold")) { + properties._transactionDurationThreshold = 1; + if (!$util.isInteger(message.transactionDurationThreshold)) + return "transactionDurationThreshold: integer expected"; + } + return null; + }; + + /** + * Creates a PerformanceCaptureConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.PerformanceCaptureConfig} PerformanceCaptureConfig + */ + PerformanceCaptureConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.PerformanceCaptureConfig) + return object; + var message = new $root.google.cloud.sql.v1.PerformanceCaptureConfig(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.probingIntervalSeconds != null) + message.probingIntervalSeconds = object.probingIntervalSeconds | 0; + if (object.probeThreshold != null) + message.probeThreshold = object.probeThreshold | 0; + if (object.runningThreadsThreshold != null) + message.runningThreadsThreshold = object.runningThreadsThreshold | 0; + if (object.secondsBehindSourceThreshold != null) + message.secondsBehindSourceThreshold = object.secondsBehindSourceThreshold | 0; + if (object.transactionDurationThreshold != null) + message.transactionDurationThreshold = object.transactionDurationThreshold | 0; + return message; + }; + + /** + * Creates a plain object from a PerformanceCaptureConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @static + * @param {google.cloud.sql.v1.PerformanceCaptureConfig} message PerformanceCaptureConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PerformanceCaptureConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + object.enabled = message.enabled; + if (options.oneofs) + object._enabled = "enabled"; + } + if (message.probingIntervalSeconds != null && message.hasOwnProperty("probingIntervalSeconds")) { + object.probingIntervalSeconds = message.probingIntervalSeconds; + if (options.oneofs) + object._probingIntervalSeconds = "probingIntervalSeconds"; + } + if (message.probeThreshold != null && message.hasOwnProperty("probeThreshold")) { + object.probeThreshold = message.probeThreshold; + if (options.oneofs) + object._probeThreshold = "probeThreshold"; + } + if (message.runningThreadsThreshold != null && message.hasOwnProperty("runningThreadsThreshold")) { + object.runningThreadsThreshold = message.runningThreadsThreshold; + if (options.oneofs) + object._runningThreadsThreshold = "runningThreadsThreshold"; + } + if (message.secondsBehindSourceThreshold != null && message.hasOwnProperty("secondsBehindSourceThreshold")) { + object.secondsBehindSourceThreshold = message.secondsBehindSourceThreshold; + if (options.oneofs) + object._secondsBehindSourceThreshold = "secondsBehindSourceThreshold"; + } + if (message.transactionDurationThreshold != null && message.hasOwnProperty("transactionDurationThreshold")) { + object.transactionDurationThreshold = message.transactionDurationThreshold; + if (options.oneofs) + object._transactionDurationThreshold = "transactionDurationThreshold"; + } + return object; + }; + + /** + * Converts this PerformanceCaptureConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @instance + * @returns {Object.} JSON object + */ + PerformanceCaptureConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PerformanceCaptureConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.PerformanceCaptureConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PerformanceCaptureConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.PerformanceCaptureConfig"; + }; + + return PerformanceCaptureConfig; + })(); + + v1.ConnectionPoolFlags = (function() { + + /** + * Properties of a ConnectionPoolFlags. + * @memberof google.cloud.sql.v1 + * @interface IConnectionPoolFlags + * @property {string|null} [name] ConnectionPoolFlags name + * @property {string|null} [value] ConnectionPoolFlags value + */ + + /** + * Constructs a new ConnectionPoolFlags. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a ConnectionPoolFlags. + * @implements IConnectionPoolFlags + * @constructor + * @param {google.cloud.sql.v1.IConnectionPoolFlags=} [properties] Properties to set + */ + function ConnectionPoolFlags(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectionPoolFlags name. + * @member {string} name + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @instance + */ + ConnectionPoolFlags.prototype.name = ""; + + /** + * ConnectionPoolFlags value. + * @member {string} value + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @instance + */ + ConnectionPoolFlags.prototype.value = ""; + + /** + * Creates a new ConnectionPoolFlags instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @static + * @param {google.cloud.sql.v1.IConnectionPoolFlags=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ConnectionPoolFlags} ConnectionPoolFlags instance + */ + ConnectionPoolFlags.create = function create(properties) { + return new ConnectionPoolFlags(properties); + }; + + /** + * Encodes the specified ConnectionPoolFlags message. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolFlags.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @static + * @param {google.cloud.sql.v1.IConnectionPoolFlags} message ConnectionPoolFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionPoolFlags.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + return writer; + }; + + /** + * Encodes the specified ConnectionPoolFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolFlags.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @static + * @param {google.cloud.sql.v1.IConnectionPoolFlags} message ConnectionPoolFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionPoolFlags.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectionPoolFlags message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ConnectionPoolFlags} ConnectionPoolFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionPoolFlags.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ConnectionPoolFlags(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectionPoolFlags message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ConnectionPoolFlags} ConnectionPoolFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionPoolFlags.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectionPoolFlags message. + * @function verify + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectionPoolFlags.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a ConnectionPoolFlags message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ConnectionPoolFlags} ConnectionPoolFlags + */ + ConnectionPoolFlags.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ConnectionPoolFlags) + return object; + var message = new $root.google.cloud.sql.v1.ConnectionPoolFlags(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a ConnectionPoolFlags message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @static + * @param {google.cloud.sql.v1.ConnectionPoolFlags} message ConnectionPoolFlags + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectionPoolFlags.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.value = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this ConnectionPoolFlags to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @instance + * @returns {Object.} JSON object + */ + ConnectionPoolFlags.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConnectionPoolFlags + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ConnectionPoolFlags + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConnectionPoolFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ConnectionPoolFlags"; + }; + + return ConnectionPoolFlags; + })(); + + v1.ConnectionPoolConfig = (function() { + + /** + * Properties of a ConnectionPoolConfig. + * @memberof google.cloud.sql.v1 + * @interface IConnectionPoolConfig + * @property {boolean|null} [connectionPoolingEnabled] ConnectionPoolConfig connectionPoolingEnabled + * @property {Array.|null} [flags] ConnectionPoolConfig flags + * @property {number|null} [poolerCount] ConnectionPoolConfig poolerCount + */ + + /** + * Constructs a new ConnectionPoolConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a ConnectionPoolConfig. + * @implements IConnectionPoolConfig + * @constructor + * @param {google.cloud.sql.v1.IConnectionPoolConfig=} [properties] Properties to set + */ + function ConnectionPoolConfig(properties) { + this.flags = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectionPoolConfig connectionPoolingEnabled. + * @member {boolean|null|undefined} connectionPoolingEnabled + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @instance + */ + ConnectionPoolConfig.prototype.connectionPoolingEnabled = null; + + /** + * ConnectionPoolConfig flags. + * @member {Array.} flags + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @instance + */ + ConnectionPoolConfig.prototype.flags = $util.emptyArray; + + /** + * ConnectionPoolConfig poolerCount. + * @member {number|null|undefined} poolerCount + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @instance + */ + ConnectionPoolConfig.prototype.poolerCount = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ConnectionPoolConfig.prototype, "_connectionPoolingEnabled", { + get: $util.oneOfGetter($oneOfFields = ["connectionPoolingEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ConnectionPoolConfig.prototype, "_poolerCount", { + get: $util.oneOfGetter($oneOfFields = ["poolerCount"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ConnectionPoolConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @static + * @param {google.cloud.sql.v1.IConnectionPoolConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ConnectionPoolConfig} ConnectionPoolConfig instance + */ + ConnectionPoolConfig.create = function create(properties) { + return new ConnectionPoolConfig(properties); + }; + + /** + * Encodes the specified ConnectionPoolConfig message. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @static + * @param {google.cloud.sql.v1.IConnectionPoolConfig} message ConnectionPoolConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionPoolConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connectionPoolingEnabled != null && Object.hasOwnProperty.call(message, "connectionPoolingEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.connectionPoolingEnabled); + if (message.flags != null && message.flags.length) + for (var i = 0; i < message.flags.length; ++i) + $root.google.cloud.sql.v1.ConnectionPoolFlags.encode(message.flags[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.poolerCount != null && Object.hasOwnProperty.call(message, "poolerCount")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.poolerCount); + return writer; + }; + + /** + * Encodes the specified ConnectionPoolConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @static + * @param {google.cloud.sql.v1.IConnectionPoolConfig} message ConnectionPoolConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionPoolConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectionPoolConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ConnectionPoolConfig} ConnectionPoolConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionPoolConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ConnectionPoolConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.connectionPoolingEnabled = reader.bool(); + break; + } + case 8: { + if (!(message.flags && message.flags.length)) + message.flags = []; + message.flags.push($root.google.cloud.sql.v1.ConnectionPoolFlags.decode(reader, reader.uint32())); + break; + } + case 9: { + message.poolerCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectionPoolConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ConnectionPoolConfig} ConnectionPoolConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionPoolConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectionPoolConfig message. + * @function verify + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectionPoolConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.connectionPoolingEnabled != null && message.hasOwnProperty("connectionPoolingEnabled")) { + properties._connectionPoolingEnabled = 1; + if (typeof message.connectionPoolingEnabled !== "boolean") + return "connectionPoolingEnabled: boolean expected"; + } + if (message.flags != null && message.hasOwnProperty("flags")) { + if (!Array.isArray(message.flags)) + return "flags: array expected"; + for (var i = 0; i < message.flags.length; ++i) { + var error = $root.google.cloud.sql.v1.ConnectionPoolFlags.verify(message.flags[i]); + if (error) + return "flags." + error; + } + } + if (message.poolerCount != null && message.hasOwnProperty("poolerCount")) { + properties._poolerCount = 1; + if (!$util.isInteger(message.poolerCount)) + return "poolerCount: integer expected"; + } + return null; + }; + + /** + * Creates a ConnectionPoolConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ConnectionPoolConfig} ConnectionPoolConfig + */ + ConnectionPoolConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ConnectionPoolConfig) + return object; + var message = new $root.google.cloud.sql.v1.ConnectionPoolConfig(); + if (object.connectionPoolingEnabled != null) + message.connectionPoolingEnabled = Boolean(object.connectionPoolingEnabled); + if (object.flags) { + if (!Array.isArray(object.flags)) + throw TypeError(".google.cloud.sql.v1.ConnectionPoolConfig.flags: array expected"); + message.flags = []; + for (var i = 0; i < object.flags.length; ++i) { + if (typeof object.flags[i] !== "object") + throw TypeError(".google.cloud.sql.v1.ConnectionPoolConfig.flags: object expected"); + message.flags[i] = $root.google.cloud.sql.v1.ConnectionPoolFlags.fromObject(object.flags[i]); + } + } + if (object.poolerCount != null) + message.poolerCount = object.poolerCount | 0; + return message; + }; + + /** + * Creates a plain object from a ConnectionPoolConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @static + * @param {google.cloud.sql.v1.ConnectionPoolConfig} message ConnectionPoolConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectionPoolConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.flags = []; + if (message.connectionPoolingEnabled != null && message.hasOwnProperty("connectionPoolingEnabled")) { + object.connectionPoolingEnabled = message.connectionPoolingEnabled; + if (options.oneofs) + object._connectionPoolingEnabled = "connectionPoolingEnabled"; + } + if (message.flags && message.flags.length) { + object.flags = []; + for (var j = 0; j < message.flags.length; ++j) + object.flags[j] = $root.google.cloud.sql.v1.ConnectionPoolFlags.toObject(message.flags[j], options); + } + if (message.poolerCount != null && message.hasOwnProperty("poolerCount")) { + object.poolerCount = message.poolerCount; + if (options.oneofs) + object._poolerCount = "poolerCount"; + } + return object; + }; + + /** + * Converts this ConnectionPoolConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @instance + * @returns {Object.} JSON object + */ + ConnectionPoolConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConnectionPoolConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ConnectionPoolConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConnectionPoolConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ConnectionPoolConfig"; + }; + + return ConnectionPoolConfig; + })(); + + v1.ReadPoolAutoScaleConfig = (function() { + + /** + * Properties of a ReadPoolAutoScaleConfig. + * @memberof google.cloud.sql.v1 + * @interface IReadPoolAutoScaleConfig + * @property {boolean|null} [enabled] ReadPoolAutoScaleConfig enabled + * @property {number|null} [minNodeCount] ReadPoolAutoScaleConfig minNodeCount + * @property {number|null} [maxNodeCount] ReadPoolAutoScaleConfig maxNodeCount + * @property {Array.|null} [targetMetrics] ReadPoolAutoScaleConfig targetMetrics + * @property {boolean|null} [disableScaleIn] ReadPoolAutoScaleConfig disableScaleIn + * @property {number|null} [scaleInCooldownSeconds] ReadPoolAutoScaleConfig scaleInCooldownSeconds + * @property {number|null} [scaleOutCooldownSeconds] ReadPoolAutoScaleConfig scaleOutCooldownSeconds + */ + + /** + * Constructs a new ReadPoolAutoScaleConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a ReadPoolAutoScaleConfig. + * @implements IReadPoolAutoScaleConfig + * @constructor + * @param {google.cloud.sql.v1.IReadPoolAutoScaleConfig=} [properties] Properties to set + */ + function ReadPoolAutoScaleConfig(properties) { + this.targetMetrics = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReadPoolAutoScaleConfig enabled. + * @member {boolean|null|undefined} enabled + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.enabled = null; + + /** + * ReadPoolAutoScaleConfig minNodeCount. + * @member {number|null|undefined} minNodeCount + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.minNodeCount = null; + + /** + * ReadPoolAutoScaleConfig maxNodeCount. + * @member {number|null|undefined} maxNodeCount + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.maxNodeCount = null; + + /** + * ReadPoolAutoScaleConfig targetMetrics. + * @member {Array.} targetMetrics + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.targetMetrics = $util.emptyArray; + + /** + * ReadPoolAutoScaleConfig disableScaleIn. + * @member {boolean|null|undefined} disableScaleIn + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.disableScaleIn = null; + + /** + * ReadPoolAutoScaleConfig scaleInCooldownSeconds. + * @member {number|null|undefined} scaleInCooldownSeconds + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.scaleInCooldownSeconds = null; + + /** + * ReadPoolAutoScaleConfig scaleOutCooldownSeconds. + * @member {number|null|undefined} scaleOutCooldownSeconds + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.scaleOutCooldownSeconds = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_enabled", { + get: $util.oneOfGetter($oneOfFields = ["enabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_minNodeCount", { + get: $util.oneOfGetter($oneOfFields = ["minNodeCount"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_maxNodeCount", { + get: $util.oneOfGetter($oneOfFields = ["maxNodeCount"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_disableScaleIn", { + get: $util.oneOfGetter($oneOfFields = ["disableScaleIn"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_scaleInCooldownSeconds", { + get: $util.oneOfGetter($oneOfFields = ["scaleInCooldownSeconds"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_scaleOutCooldownSeconds", { + get: $util.oneOfGetter($oneOfFields = ["scaleOutCooldownSeconds"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReadPoolAutoScaleConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @static + * @param {google.cloud.sql.v1.IReadPoolAutoScaleConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig instance + */ + ReadPoolAutoScaleConfig.create = function create(properties) { + return new ReadPoolAutoScaleConfig(properties); + }; + + /** + * Encodes the specified ReadPoolAutoScaleConfig message. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @static + * @param {google.cloud.sql.v1.IReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadPoolAutoScaleConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.minNodeCount != null && Object.hasOwnProperty.call(message, "minNodeCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.minNodeCount); + if (message.maxNodeCount != null && Object.hasOwnProperty.call(message, "maxNodeCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxNodeCount); + if (message.targetMetrics != null && message.targetMetrics.length) + for (var i = 0; i < message.targetMetrics.length; ++i) + $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.encode(message.targetMetrics[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.disableScaleIn != null && Object.hasOwnProperty.call(message, "disableScaleIn")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.disableScaleIn); + if (message.scaleInCooldownSeconds != null && Object.hasOwnProperty.call(message, "scaleInCooldownSeconds")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.scaleInCooldownSeconds); + if (message.scaleOutCooldownSeconds != null && Object.hasOwnProperty.call(message, "scaleOutCooldownSeconds")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.scaleOutCooldownSeconds); + return writer; + }; + + /** + * Encodes the specified ReadPoolAutoScaleConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @static + * @param {google.cloud.sql.v1.IReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadPoolAutoScaleConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadPoolAutoScaleConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.enabled = reader.bool(); + break; + } + case 2: { + message.minNodeCount = reader.int32(); + break; + } + case 3: { + message.maxNodeCount = reader.int32(); + break; + } + case 4: { + if (!(message.targetMetrics && message.targetMetrics.length)) + message.targetMetrics = []; + message.targetMetrics.push($root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.decode(reader, reader.uint32())); + break; + } + case 5: { + message.disableScaleIn = reader.bool(); + break; + } + case 6: { + message.scaleInCooldownSeconds = reader.int32(); + break; + } + case 7: { + message.scaleOutCooldownSeconds = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadPoolAutoScaleConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReadPoolAutoScaleConfig message. + * @function verify + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadPoolAutoScaleConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + properties._enabled = 1; + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + } + if (message.minNodeCount != null && message.hasOwnProperty("minNodeCount")) { + properties._minNodeCount = 1; + if (!$util.isInteger(message.minNodeCount)) + return "minNodeCount: integer expected"; + } + if (message.maxNodeCount != null && message.hasOwnProperty("maxNodeCount")) { + properties._maxNodeCount = 1; + if (!$util.isInteger(message.maxNodeCount)) + return "maxNodeCount: integer expected"; + } + if (message.targetMetrics != null && message.hasOwnProperty("targetMetrics")) { + if (!Array.isArray(message.targetMetrics)) + return "targetMetrics: array expected"; + for (var i = 0; i < message.targetMetrics.length; ++i) { + var error = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.verify(message.targetMetrics[i]); + if (error) + return "targetMetrics." + error; + } + } + if (message.disableScaleIn != null && message.hasOwnProperty("disableScaleIn")) { + properties._disableScaleIn = 1; + if (typeof message.disableScaleIn !== "boolean") + return "disableScaleIn: boolean expected"; + } + if (message.scaleInCooldownSeconds != null && message.hasOwnProperty("scaleInCooldownSeconds")) { + properties._scaleInCooldownSeconds = 1; + if (!$util.isInteger(message.scaleInCooldownSeconds)) + return "scaleInCooldownSeconds: integer expected"; + } + if (message.scaleOutCooldownSeconds != null && message.hasOwnProperty("scaleOutCooldownSeconds")) { + properties._scaleOutCooldownSeconds = 1; + if (!$util.isInteger(message.scaleOutCooldownSeconds)) + return "scaleOutCooldownSeconds: integer expected"; + } + return null; + }; + + /** + * Creates a ReadPoolAutoScaleConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig + */ + ReadPoolAutoScaleConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig) + return object; + var message = new $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.minNodeCount != null) + message.minNodeCount = object.minNodeCount | 0; + if (object.maxNodeCount != null) + message.maxNodeCount = object.maxNodeCount | 0; + if (object.targetMetrics) { + if (!Array.isArray(object.targetMetrics)) + throw TypeError(".google.cloud.sql.v1.ReadPoolAutoScaleConfig.targetMetrics: array expected"); + message.targetMetrics = []; + for (var i = 0; i < object.targetMetrics.length; ++i) { + if (typeof object.targetMetrics[i] !== "object") + throw TypeError(".google.cloud.sql.v1.ReadPoolAutoScaleConfig.targetMetrics: object expected"); + message.targetMetrics[i] = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.fromObject(object.targetMetrics[i]); + } + } + if (object.disableScaleIn != null) + message.disableScaleIn = Boolean(object.disableScaleIn); + if (object.scaleInCooldownSeconds != null) + message.scaleInCooldownSeconds = object.scaleInCooldownSeconds | 0; + if (object.scaleOutCooldownSeconds != null) + message.scaleOutCooldownSeconds = object.scaleOutCooldownSeconds | 0; + return message; + }; + + /** + * Creates a plain object from a ReadPoolAutoScaleConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @static + * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadPoolAutoScaleConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.targetMetrics = []; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + object.enabled = message.enabled; + if (options.oneofs) + object._enabled = "enabled"; + } + if (message.minNodeCount != null && message.hasOwnProperty("minNodeCount")) { + object.minNodeCount = message.minNodeCount; + if (options.oneofs) + object._minNodeCount = "minNodeCount"; + } + if (message.maxNodeCount != null && message.hasOwnProperty("maxNodeCount")) { + object.maxNodeCount = message.maxNodeCount; + if (options.oneofs) + object._maxNodeCount = "maxNodeCount"; + } + if (message.targetMetrics && message.targetMetrics.length) { + object.targetMetrics = []; + for (var j = 0; j < message.targetMetrics.length; ++j) + object.targetMetrics[j] = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.toObject(message.targetMetrics[j], options); + } + if (message.disableScaleIn != null && message.hasOwnProperty("disableScaleIn")) { + object.disableScaleIn = message.disableScaleIn; + if (options.oneofs) + object._disableScaleIn = "disableScaleIn"; + } + if (message.scaleInCooldownSeconds != null && message.hasOwnProperty("scaleInCooldownSeconds")) { + object.scaleInCooldownSeconds = message.scaleInCooldownSeconds; + if (options.oneofs) + object._scaleInCooldownSeconds = "scaleInCooldownSeconds"; + } + if (message.scaleOutCooldownSeconds != null && message.hasOwnProperty("scaleOutCooldownSeconds")) { + object.scaleOutCooldownSeconds = message.scaleOutCooldownSeconds; + if (options.oneofs) + object._scaleOutCooldownSeconds = "scaleOutCooldownSeconds"; + } + return object; + }; + + /** + * Converts this ReadPoolAutoScaleConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @instance + * @returns {Object.} JSON object + */ + ReadPoolAutoScaleConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReadPoolAutoScaleConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadPoolAutoScaleConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ReadPoolAutoScaleConfig"; + }; + + ReadPoolAutoScaleConfig.TargetMetric = (function() { + + /** + * Properties of a TargetMetric. + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @interface ITargetMetric + * @property {string|null} [metric] TargetMetric metric + * @property {number|null} [targetValue] TargetMetric targetValue + */ + + /** + * Constructs a new TargetMetric. + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig + * @classdesc Represents a TargetMetric. + * @implements ITargetMetric + * @constructor + * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric=} [properties] Properties to set + */ + function TargetMetric(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TargetMetric metric. + * @member {string|null|undefined} metric + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @instance + */ + TargetMetric.prototype.metric = null; + + /** + * TargetMetric targetValue. + * @member {number|null|undefined} targetValue + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @instance + */ + TargetMetric.prototype.targetValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(TargetMetric.prototype, "_metric", { + get: $util.oneOfGetter($oneOfFields = ["metric"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(TargetMetric.prototype, "_targetValue", { + get: $util.oneOfGetter($oneOfFields = ["targetValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TargetMetric instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric instance + */ + TargetMetric.create = function create(properties) { + return new TargetMetric(properties); + }; + + /** + * Encodes the specified TargetMetric message. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric} message TargetMetric message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TargetMetric.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metric != null && Object.hasOwnProperty.call(message, "metric")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.metric); + if (message.targetValue != null && Object.hasOwnProperty.call(message, "targetValue")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.targetValue); + return writer; + }; + + /** + * Encodes the specified TargetMetric message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric} message TargetMetric message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TargetMetric.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TargetMetric message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TargetMetric.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.metric = reader.string(); + break; + } + case 2: { + message.targetValue = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TargetMetric message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TargetMetric.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TargetMetric message. + * @function verify + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TargetMetric.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.metric != null && message.hasOwnProperty("metric")) { + properties._metric = 1; + if (!$util.isString(message.metric)) + return "metric: string expected"; + } + if (message.targetValue != null && message.hasOwnProperty("targetValue")) { + properties._targetValue = 1; + if (typeof message.targetValue !== "number") + return "targetValue: number expected"; + } + return null; + }; + + /** + * Creates a TargetMetric message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric + */ + TargetMetric.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric) + return object; + var message = new $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric(); + if (object.metric != null) + message.metric = String(object.metric); + if (object.targetValue != null) + message.targetValue = Number(object.targetValue); + return message; + }; + + /** + * Creates a plain object from a TargetMetric message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric} message TargetMetric + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TargetMetric.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.metric != null && message.hasOwnProperty("metric")) { + object.metric = message.metric; + if (options.oneofs) + object._metric = "metric"; + } + if (message.targetValue != null && message.hasOwnProperty("targetValue")) { + object.targetValue = options.json && !isFinite(message.targetValue) ? String(message.targetValue) : message.targetValue; + if (options.oneofs) + object._targetValue = "targetValue"; + } + return object; + }; + + /** + * Converts this TargetMetric to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @instance + * @returns {Object.} JSON object + */ + TargetMetric.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TargetMetric + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TargetMetric.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric"; + }; + + return TargetMetric; + })(); + + return ReadPoolAutoScaleConfig; + })(); + + v1.AdvancedMachineFeatures = (function() { + + /** + * Properties of an AdvancedMachineFeatures. + * @memberof google.cloud.sql.v1 + * @interface IAdvancedMachineFeatures + * @property {number|null} [threadsPerCore] AdvancedMachineFeatures threadsPerCore + */ + + /** + * Constructs a new AdvancedMachineFeatures. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an AdvancedMachineFeatures. + * @implements IAdvancedMachineFeatures + * @constructor + * @param {google.cloud.sql.v1.IAdvancedMachineFeatures=} [properties] Properties to set + */ + function AdvancedMachineFeatures(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AdvancedMachineFeatures threadsPerCore. + * @member {number} threadsPerCore + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @instance + */ + AdvancedMachineFeatures.prototype.threadsPerCore = 0; + + /** + * Creates a new AdvancedMachineFeatures instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @static + * @param {google.cloud.sql.v1.IAdvancedMachineFeatures=} [properties] Properties to set + * @returns {google.cloud.sql.v1.AdvancedMachineFeatures} AdvancedMachineFeatures instance + */ + AdvancedMachineFeatures.create = function create(properties) { + return new AdvancedMachineFeatures(properties); + }; + + /** + * Encodes the specified AdvancedMachineFeatures message. Does not implicitly {@link google.cloud.sql.v1.AdvancedMachineFeatures.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @static + * @param {google.cloud.sql.v1.IAdvancedMachineFeatures} message AdvancedMachineFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AdvancedMachineFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.threadsPerCore != null && Object.hasOwnProperty.call(message, "threadsPerCore")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.threadsPerCore); + return writer; + }; + + /** + * Encodes the specified AdvancedMachineFeatures message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AdvancedMachineFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @static + * @param {google.cloud.sql.v1.IAdvancedMachineFeatures} message AdvancedMachineFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AdvancedMachineFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AdvancedMachineFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.AdvancedMachineFeatures} AdvancedMachineFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AdvancedMachineFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.AdvancedMachineFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.threadsPerCore = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AdvancedMachineFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.AdvancedMachineFeatures} AdvancedMachineFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AdvancedMachineFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AdvancedMachineFeatures message. + * @function verify + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AdvancedMachineFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.threadsPerCore != null && message.hasOwnProperty("threadsPerCore")) + if (!$util.isInteger(message.threadsPerCore)) + return "threadsPerCore: integer expected"; + return null; + }; + + /** + * Creates an AdvancedMachineFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.AdvancedMachineFeatures} AdvancedMachineFeatures + */ + AdvancedMachineFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.AdvancedMachineFeatures) + return object; + var message = new $root.google.cloud.sql.v1.AdvancedMachineFeatures(); + if (object.threadsPerCore != null) + message.threadsPerCore = object.threadsPerCore | 0; + return message; + }; + + /** + * Creates a plain object from an AdvancedMachineFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @static + * @param {google.cloud.sql.v1.AdvancedMachineFeatures} message AdvancedMachineFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AdvancedMachineFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.threadsPerCore = 0; + if (message.threadsPerCore != null && message.hasOwnProperty("threadsPerCore")) + object.threadsPerCore = message.threadsPerCore; + return object; + }; + + /** + * Converts this AdvancedMachineFeatures to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @instance + * @returns {Object.} JSON object + */ + AdvancedMachineFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AdvancedMachineFeatures + * @function getTypeUrl + * @memberof google.cloud.sql.v1.AdvancedMachineFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AdvancedMachineFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.AdvancedMachineFeatures"; + }; + + return AdvancedMachineFeatures; + })(); + + v1.SslCert = (function() { + + /** + * Properties of a SslCert. + * @memberof google.cloud.sql.v1 + * @interface ISslCert + * @property {string|null} [kind] SslCert kind + * @property {string|null} [certSerialNumber] SslCert certSerialNumber + * @property {string|null} [cert] SslCert cert + * @property {google.protobuf.ITimestamp|null} [createTime] SslCert createTime + * @property {string|null} [commonName] SslCert commonName + * @property {google.protobuf.ITimestamp|null} [expirationTime] SslCert expirationTime + * @property {string|null} [sha1Fingerprint] SslCert sha1Fingerprint + * @property {string|null} [instance] SslCert instance + * @property {string|null} [selfLink] SslCert selfLink + */ + + /** + * Constructs a new SslCert. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SslCert. + * @implements ISslCert + * @constructor + * @param {google.cloud.sql.v1.ISslCert=} [properties] Properties to set + */ + function SslCert(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCert kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.SslCert + * @instance + */ + SslCert.prototype.kind = ""; + + /** + * SslCert certSerialNumber. + * @member {string} certSerialNumber + * @memberof google.cloud.sql.v1.SslCert + * @instance + */ + SslCert.prototype.certSerialNumber = ""; + + /** + * SslCert cert. + * @member {string} cert + * @memberof google.cloud.sql.v1.SslCert + * @instance + */ + SslCert.prototype.cert = ""; + + /** + * SslCert createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.sql.v1.SslCert + * @instance + */ + SslCert.prototype.createTime = null; + + /** + * SslCert commonName. + * @member {string} commonName + * @memberof google.cloud.sql.v1.SslCert + * @instance + */ + SslCert.prototype.commonName = ""; + + /** + * SslCert expirationTime. + * @member {google.protobuf.ITimestamp|null|undefined} expirationTime + * @memberof google.cloud.sql.v1.SslCert + * @instance + */ + SslCert.prototype.expirationTime = null; + + /** + * SslCert sha1Fingerprint. + * @member {string} sha1Fingerprint + * @memberof google.cloud.sql.v1.SslCert + * @instance + */ + SslCert.prototype.sha1Fingerprint = ""; + + /** + * SslCert instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SslCert + * @instance + */ + SslCert.prototype.instance = ""; + + /** + * SslCert selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1.SslCert + * @instance + */ + SslCert.prototype.selfLink = ""; + + /** + * Creates a new SslCert instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SslCert + * @static + * @param {google.cloud.sql.v1.ISslCert=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SslCert} SslCert instance + */ + SslCert.create = function create(properties) { + return new SslCert(properties); + }; + + /** + * Encodes the specified SslCert message. Does not implicitly {@link google.cloud.sql.v1.SslCert.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SslCert + * @static + * @param {google.cloud.sql.v1.ISslCert} message SslCert message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCert.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.certSerialNumber != null && Object.hasOwnProperty.call(message, "certSerialNumber")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.certSerialNumber); + if (message.cert != null && Object.hasOwnProperty.call(message, "cert")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.cert); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.commonName != null && Object.hasOwnProperty.call(message, "commonName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.commonName); + if (message.expirationTime != null && Object.hasOwnProperty.call(message, "expirationTime")) + $root.google.protobuf.Timestamp.encode(message.expirationTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.sha1Fingerprint); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.instance); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.selfLink); + return writer; + }; + + /** + * Encodes the specified SslCert message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCert.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SslCert + * @static + * @param {google.cloud.sql.v1.ISslCert} message SslCert message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCert.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCert message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SslCert + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SslCert} SslCert + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCert.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCert(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.certSerialNumber = reader.string(); + break; + } + case 3: { + message.cert = reader.string(); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.commonName = reader.string(); + break; + } + case 6: { + message.expirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.sha1Fingerprint = reader.string(); + break; + } + case 8: { + message.instance = reader.string(); + break; + } + case 9: { + message.selfLink = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCert message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SslCert + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SslCert} SslCert + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCert.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCert message. + * @function verify + * @memberof google.cloud.sql.v1.SslCert + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCert.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.certSerialNumber != null && message.hasOwnProperty("certSerialNumber")) + if (!$util.isString(message.certSerialNumber)) + return "certSerialNumber: string expected"; + if (message.cert != null && message.hasOwnProperty("cert")) + if (!$util.isString(message.cert)) + return "cert: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.commonName != null && message.hasOwnProperty("commonName")) + if (!$util.isString(message.commonName)) + return "commonName: string expected"; + if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expirationTime); + if (error) + return "expirationTime." + error; + } + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + if (!$util.isString(message.sha1Fingerprint)) + return "sha1Fingerprint: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + return null; + }; + + /** + * Creates a SslCert message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SslCert + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SslCert} SslCert + */ + SslCert.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SslCert) + return object; + var message = new $root.google.cloud.sql.v1.SslCert(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.certSerialNumber != null) + message.certSerialNumber = String(object.certSerialNumber); + if (object.cert != null) + message.cert = String(object.cert); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.sql.v1.SslCert.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.commonName != null) + message.commonName = String(object.commonName); + if (object.expirationTime != null) { + if (typeof object.expirationTime !== "object") + throw TypeError(".google.cloud.sql.v1.SslCert.expirationTime: object expected"); + message.expirationTime = $root.google.protobuf.Timestamp.fromObject(object.expirationTime); + } + if (object.sha1Fingerprint != null) + message.sha1Fingerprint = String(object.sha1Fingerprint); + if (object.instance != null) + message.instance = String(object.instance); + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + return message; + }; + + /** + * Creates a plain object from a SslCert message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SslCert + * @static + * @param {google.cloud.sql.v1.SslCert} message SslCert + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCert.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.certSerialNumber = ""; + object.cert = ""; + object.createTime = null; + object.commonName = ""; + object.expirationTime = null; + object.sha1Fingerprint = ""; + object.instance = ""; + object.selfLink = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.certSerialNumber != null && message.hasOwnProperty("certSerialNumber")) + object.certSerialNumber = message.certSerialNumber; + if (message.cert != null && message.hasOwnProperty("cert")) + object.cert = message.cert; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.commonName != null && message.hasOwnProperty("commonName")) + object.commonName = message.commonName; + if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) + object.expirationTime = $root.google.protobuf.Timestamp.toObject(message.expirationTime, options); + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + object.sha1Fingerprint = message.sha1Fingerprint; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + return object; + }; + + /** + * Converts this SslCert to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SslCert + * @instance + * @returns {Object.} JSON object + */ + SslCert.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCert + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SslCert + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCert.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SslCert"; + }; + + return SslCert; + })(); + + v1.SslCertDetail = (function() { + + /** + * Properties of a SslCertDetail. + * @memberof google.cloud.sql.v1 + * @interface ISslCertDetail + * @property {google.cloud.sql.v1.ISslCert|null} [certInfo] SslCertDetail certInfo + * @property {string|null} [certPrivateKey] SslCertDetail certPrivateKey + */ + + /** + * Constructs a new SslCertDetail. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SslCertDetail. + * @implements ISslCertDetail + * @constructor + * @param {google.cloud.sql.v1.ISslCertDetail=} [properties] Properties to set + */ + function SslCertDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCertDetail certInfo. + * @member {google.cloud.sql.v1.ISslCert|null|undefined} certInfo + * @memberof google.cloud.sql.v1.SslCertDetail + * @instance + */ + SslCertDetail.prototype.certInfo = null; + + /** + * SslCertDetail certPrivateKey. + * @member {string} certPrivateKey + * @memberof google.cloud.sql.v1.SslCertDetail + * @instance + */ + SslCertDetail.prototype.certPrivateKey = ""; + + /** + * Creates a new SslCertDetail instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SslCertDetail + * @static + * @param {google.cloud.sql.v1.ISslCertDetail=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SslCertDetail} SslCertDetail instance + */ + SslCertDetail.create = function create(properties) { + return new SslCertDetail(properties); + }; + + /** + * Encodes the specified SslCertDetail message. Does not implicitly {@link google.cloud.sql.v1.SslCertDetail.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SslCertDetail + * @static + * @param {google.cloud.sql.v1.ISslCertDetail} message SslCertDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certInfo != null && Object.hasOwnProperty.call(message, "certInfo")) + $root.google.cloud.sql.v1.SslCert.encode(message.certInfo, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.certPrivateKey != null && Object.hasOwnProperty.call(message, "certPrivateKey")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.certPrivateKey); + return writer; + }; + + /** + * Encodes the specified SslCertDetail message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SslCertDetail + * @static + * @param {google.cloud.sql.v1.ISslCertDetail} message SslCertDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCertDetail message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SslCertDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SslCertDetail} SslCertDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertDetail.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCertDetail(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.certInfo = $root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32()); + break; + } + case 2: { + message.certPrivateKey = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCertDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SslCertDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SslCertDetail} SslCertDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCertDetail message. + * @function verify + * @memberof google.cloud.sql.v1.SslCertDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCertDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certInfo != null && message.hasOwnProperty("certInfo")) { + var error = $root.google.cloud.sql.v1.SslCert.verify(message.certInfo); + if (error) + return "certInfo." + error; + } + if (message.certPrivateKey != null && message.hasOwnProperty("certPrivateKey")) + if (!$util.isString(message.certPrivateKey)) + return "certPrivateKey: string expected"; + return null; + }; + + /** + * Creates a SslCertDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SslCertDetail + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SslCertDetail} SslCertDetail + */ + SslCertDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SslCertDetail) + return object; + var message = new $root.google.cloud.sql.v1.SslCertDetail(); + if (object.certInfo != null) { + if (typeof object.certInfo !== "object") + throw TypeError(".google.cloud.sql.v1.SslCertDetail.certInfo: object expected"); + message.certInfo = $root.google.cloud.sql.v1.SslCert.fromObject(object.certInfo); + } + if (object.certPrivateKey != null) + message.certPrivateKey = String(object.certPrivateKey); + return message; + }; + + /** + * Creates a plain object from a SslCertDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SslCertDetail + * @static + * @param {google.cloud.sql.v1.SslCertDetail} message SslCertDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCertDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.certInfo = null; + object.certPrivateKey = ""; + } + if (message.certInfo != null && message.hasOwnProperty("certInfo")) + object.certInfo = $root.google.cloud.sql.v1.SslCert.toObject(message.certInfo, options); + if (message.certPrivateKey != null && message.hasOwnProperty("certPrivateKey")) + object.certPrivateKey = message.certPrivateKey; + return object; + }; + + /** + * Converts this SslCertDetail to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SslCertDetail + * @instance + * @returns {Object.} JSON object + */ + SslCertDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCertDetail + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SslCertDetail + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCertDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SslCertDetail"; + }; + + return SslCertDetail; + })(); + + v1.SqlActiveDirectoryConfig = (function() { + + /** + * Properties of a SqlActiveDirectoryConfig. + * @memberof google.cloud.sql.v1 + * @interface ISqlActiveDirectoryConfig + * @property {string|null} [kind] SqlActiveDirectoryConfig kind + * @property {string|null} [domain] SqlActiveDirectoryConfig domain + * @property {google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode|null} [mode] SqlActiveDirectoryConfig mode + * @property {Array.|null} [dnsServers] SqlActiveDirectoryConfig dnsServers + * @property {string|null} [adminCredentialSecretName] SqlActiveDirectoryConfig adminCredentialSecretName + * @property {string|null} [organizationalUnit] SqlActiveDirectoryConfig organizationalUnit + */ + + /** + * Constructs a new SqlActiveDirectoryConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlActiveDirectoryConfig. + * @implements ISqlActiveDirectoryConfig + * @constructor + * @param {google.cloud.sql.v1.ISqlActiveDirectoryConfig=} [properties] Properties to set + */ + function SqlActiveDirectoryConfig(properties) { + this.dnsServers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlActiveDirectoryConfig kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.kind = ""; + + /** + * SqlActiveDirectoryConfig domain. + * @member {string} domain + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.domain = ""; + + /** + * SqlActiveDirectoryConfig mode. + * @member {google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode} mode + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.mode = 0; + + /** + * SqlActiveDirectoryConfig dnsServers. + * @member {Array.} dnsServers + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.dnsServers = $util.emptyArray; + + /** + * SqlActiveDirectoryConfig adminCredentialSecretName. + * @member {string} adminCredentialSecretName + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.adminCredentialSecretName = ""; + + /** + * SqlActiveDirectoryConfig organizationalUnit. + * @member {string} organizationalUnit + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.organizationalUnit = ""; + + /** + * Creates a new SqlActiveDirectoryConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @static + * @param {google.cloud.sql.v1.ISqlActiveDirectoryConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig instance + */ + SqlActiveDirectoryConfig.create = function create(properties) { + return new SqlActiveDirectoryConfig(properties); + }; + + /** + * Encodes the specified SqlActiveDirectoryConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlActiveDirectoryConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @static + * @param {google.cloud.sql.v1.ISqlActiveDirectoryConfig} message SqlActiveDirectoryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlActiveDirectoryConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.domain != null && Object.hasOwnProperty.call(message, "domain")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.domain); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mode); + if (message.dnsServers != null && message.dnsServers.length) + for (var i = 0; i < message.dnsServers.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dnsServers[i]); + if (message.adminCredentialSecretName != null && Object.hasOwnProperty.call(message, "adminCredentialSecretName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.adminCredentialSecretName); + if (message.organizationalUnit != null && Object.hasOwnProperty.call(message, "organizationalUnit")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.organizationalUnit); + return writer; + }; + + /** + * Encodes the specified SqlActiveDirectoryConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlActiveDirectoryConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @static + * @param {google.cloud.sql.v1.ISqlActiveDirectoryConfig} message SqlActiveDirectoryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlActiveDirectoryConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlActiveDirectoryConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlActiveDirectoryConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.domain = reader.string(); + break; + } + case 3: { + message.mode = reader.int32(); + break; + } + case 4: { + if (!(message.dnsServers && message.dnsServers.length)) + message.dnsServers = []; + message.dnsServers.push(reader.string()); + break; + } + case 5: { + message.adminCredentialSecretName = reader.string(); + break; + } + case 6: { + message.organizationalUnit = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlActiveDirectoryConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlActiveDirectoryConfig message. + * @function verify + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlActiveDirectoryConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.domain != null && message.hasOwnProperty("domain")) + if (!$util.isString(message.domain)) + return "domain: string expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.dnsServers != null && message.hasOwnProperty("dnsServers")) { + if (!Array.isArray(message.dnsServers)) + return "dnsServers: array expected"; + for (var i = 0; i < message.dnsServers.length; ++i) + if (!$util.isString(message.dnsServers[i])) + return "dnsServers: string[] expected"; + } + if (message.adminCredentialSecretName != null && message.hasOwnProperty("adminCredentialSecretName")) + if (!$util.isString(message.adminCredentialSecretName)) + return "adminCredentialSecretName: string expected"; + if (message.organizationalUnit != null && message.hasOwnProperty("organizationalUnit")) + if (!$util.isString(message.organizationalUnit)) + return "organizationalUnit: string expected"; + return null; + }; + + /** + * Creates a SqlActiveDirectoryConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig + */ + SqlActiveDirectoryConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlActiveDirectoryConfig) + return object; + var message = new $root.google.cloud.sql.v1.SqlActiveDirectoryConfig(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.domain != null) + message.domain = String(object.domain); + switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; + case "ACTIVE_DIRECTORY_MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "MANAGED_ACTIVE_DIRECTORY": + case 1: + message.mode = 1; + break; + case "SELF_MANAGED_ACTIVE_DIRECTORY": + case 2: + message.mode = 2; + break; + case "CUSTOMER_MANAGED_ACTIVE_DIRECTORY": + case 3: + message.mode = 3; + break; + } + if (object.dnsServers) { + if (!Array.isArray(object.dnsServers)) + throw TypeError(".google.cloud.sql.v1.SqlActiveDirectoryConfig.dnsServers: array expected"); + message.dnsServers = []; + for (var i = 0; i < object.dnsServers.length; ++i) + message.dnsServers[i] = String(object.dnsServers[i]); + } + if (object.adminCredentialSecretName != null) + message.adminCredentialSecretName = String(object.adminCredentialSecretName); + if (object.organizationalUnit != null) + message.organizationalUnit = String(object.organizationalUnit); + return message; + }; + + /** + * Creates a plain object from a SqlActiveDirectoryConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @static + * @param {google.cloud.sql.v1.SqlActiveDirectoryConfig} message SqlActiveDirectoryConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlActiveDirectoryConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.dnsServers = []; + if (options.defaults) { + object.kind = ""; + object.domain = ""; + object.mode = options.enums === String ? "ACTIVE_DIRECTORY_MODE_UNSPECIFIED" : 0; + object.adminCredentialSecretName = ""; + object.organizationalUnit = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.domain != null && message.hasOwnProperty("domain")) + object.domain = message.domain; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode[message.mode] === undefined ? message.mode : $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode[message.mode] : message.mode; + if (message.dnsServers && message.dnsServers.length) { + object.dnsServers = []; + for (var j = 0; j < message.dnsServers.length; ++j) + object.dnsServers[j] = message.dnsServers[j]; + } + if (message.adminCredentialSecretName != null && message.hasOwnProperty("adminCredentialSecretName")) + object.adminCredentialSecretName = message.adminCredentialSecretName; + if (message.organizationalUnit != null && message.hasOwnProperty("organizationalUnit")) + object.organizationalUnit = message.organizationalUnit; + return object; + }; + + /** + * Converts this SqlActiveDirectoryConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @instance + * @returns {Object.} JSON object + */ + SqlActiveDirectoryConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlActiveDirectoryConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlActiveDirectoryConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlActiveDirectoryConfig"; + }; + + /** + * ActiveDirectoryMode enum. + * @name google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode + * @enum {number} + * @property {number} ACTIVE_DIRECTORY_MODE_UNSPECIFIED=0 ACTIVE_DIRECTORY_MODE_UNSPECIFIED value + * @property {number} MANAGED_ACTIVE_DIRECTORY=1 MANAGED_ACTIVE_DIRECTORY value + * @property {number} SELF_MANAGED_ACTIVE_DIRECTORY=2 SELF_MANAGED_ACTIVE_DIRECTORY value + * @property {number} CUSTOMER_MANAGED_ACTIVE_DIRECTORY=3 CUSTOMER_MANAGED_ACTIVE_DIRECTORY value + */ + SqlActiveDirectoryConfig.ActiveDirectoryMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ACTIVE_DIRECTORY_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "MANAGED_ACTIVE_DIRECTORY"] = 1; + values[valuesById[2] = "SELF_MANAGED_ACTIVE_DIRECTORY"] = 2; + values[valuesById[3] = "CUSTOMER_MANAGED_ACTIVE_DIRECTORY"] = 3; + return values; + })(); + + return SqlActiveDirectoryConfig; + })(); + + v1.SqlServerAuditConfig = (function() { + + /** + * Properties of a SqlServerAuditConfig. + * @memberof google.cloud.sql.v1 + * @interface ISqlServerAuditConfig + * @property {string|null} [kind] SqlServerAuditConfig kind + * @property {string|null} [bucket] SqlServerAuditConfig bucket + * @property {google.protobuf.IDuration|null} [retentionInterval] SqlServerAuditConfig retentionInterval + * @property {google.protobuf.IDuration|null} [uploadInterval] SqlServerAuditConfig uploadInterval + */ + + /** + * Constructs a new SqlServerAuditConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlServerAuditConfig. + * @implements ISqlServerAuditConfig + * @constructor + * @param {google.cloud.sql.v1.ISqlServerAuditConfig=} [properties] Properties to set + */ + function SqlServerAuditConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlServerAuditConfig kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @instance + */ + SqlServerAuditConfig.prototype.kind = ""; + + /** + * SqlServerAuditConfig bucket. + * @member {string} bucket + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @instance + */ + SqlServerAuditConfig.prototype.bucket = ""; + + /** + * SqlServerAuditConfig retentionInterval. + * @member {google.protobuf.IDuration|null|undefined} retentionInterval + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @instance + */ + SqlServerAuditConfig.prototype.retentionInterval = null; + + /** + * SqlServerAuditConfig uploadInterval. + * @member {google.protobuf.IDuration|null|undefined} uploadInterval + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @instance + */ + SqlServerAuditConfig.prototype.uploadInterval = null; + + /** + * Creates a new SqlServerAuditConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @static + * @param {google.cloud.sql.v1.ISqlServerAuditConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlServerAuditConfig} SqlServerAuditConfig instance + */ + SqlServerAuditConfig.create = function create(properties) { + return new SqlServerAuditConfig(properties); + }; + + /** + * Encodes the specified SqlServerAuditConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlServerAuditConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @static + * @param {google.cloud.sql.v1.ISqlServerAuditConfig} message SqlServerAuditConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerAuditConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.bucket); + if (message.retentionInterval != null && Object.hasOwnProperty.call(message, "retentionInterval")) + $root.google.protobuf.Duration.encode(message.retentionInterval, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.uploadInterval != null && Object.hasOwnProperty.call(message, "uploadInterval")) + $root.google.protobuf.Duration.encode(message.uploadInterval, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlServerAuditConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerAuditConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @static + * @param {google.cloud.sql.v1.ISqlServerAuditConfig} message SqlServerAuditConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerAuditConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlServerAuditConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlServerAuditConfig} SqlServerAuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerAuditConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlServerAuditConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.bucket = reader.string(); + break; + } + case 3: { + message.retentionInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 4: { + message.uploadInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlServerAuditConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlServerAuditConfig} SqlServerAuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerAuditConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlServerAuditConfig message. + * @function verify + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlServerAuditConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.bucket != null && message.hasOwnProperty("bucket")) + if (!$util.isString(message.bucket)) + return "bucket: string expected"; + if (message.retentionInterval != null && message.hasOwnProperty("retentionInterval")) { + var error = $root.google.protobuf.Duration.verify(message.retentionInterval); + if (error) + return "retentionInterval." + error; + } + if (message.uploadInterval != null && message.hasOwnProperty("uploadInterval")) { + var error = $root.google.protobuf.Duration.verify(message.uploadInterval); + if (error) + return "uploadInterval." + error; + } + return null; + }; + + /** + * Creates a SqlServerAuditConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlServerAuditConfig} SqlServerAuditConfig + */ + SqlServerAuditConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlServerAuditConfig) + return object; + var message = new $root.google.cloud.sql.v1.SqlServerAuditConfig(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.bucket != null) + message.bucket = String(object.bucket); + if (object.retentionInterval != null) { + if (typeof object.retentionInterval !== "object") + throw TypeError(".google.cloud.sql.v1.SqlServerAuditConfig.retentionInterval: object expected"); + message.retentionInterval = $root.google.protobuf.Duration.fromObject(object.retentionInterval); + } + if (object.uploadInterval != null) { + if (typeof object.uploadInterval !== "object") + throw TypeError(".google.cloud.sql.v1.SqlServerAuditConfig.uploadInterval: object expected"); + message.uploadInterval = $root.google.protobuf.Duration.fromObject(object.uploadInterval); + } + return message; + }; + + /** + * Creates a plain object from a SqlServerAuditConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @static + * @param {google.cloud.sql.v1.SqlServerAuditConfig} message SqlServerAuditConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlServerAuditConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.bucket = ""; + object.retentionInterval = null; + object.uploadInterval = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.bucket != null && message.hasOwnProperty("bucket")) + object.bucket = message.bucket; + if (message.retentionInterval != null && message.hasOwnProperty("retentionInterval")) + object.retentionInterval = $root.google.protobuf.Duration.toObject(message.retentionInterval, options); + if (message.uploadInterval != null && message.hasOwnProperty("uploadInterval")) + object.uploadInterval = $root.google.protobuf.Duration.toObject(message.uploadInterval, options); + return object; + }; + + /** + * Converts this SqlServerAuditConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @instance + * @returns {Object.} JSON object + */ + SqlServerAuditConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlServerAuditConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlServerAuditConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlServerAuditConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlServerAuditConfig"; + }; + + return SqlServerAuditConfig; + })(); + + v1.SqlServerEntraIdConfig = (function() { + + /** + * Properties of a SqlServerEntraIdConfig. + * @memberof google.cloud.sql.v1 + * @interface ISqlServerEntraIdConfig + * @property {string|null} [kind] SqlServerEntraIdConfig kind + * @property {string|null} [tenantId] SqlServerEntraIdConfig tenantId + * @property {string|null} [applicationId] SqlServerEntraIdConfig applicationId + */ + + /** + * Constructs a new SqlServerEntraIdConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlServerEntraIdConfig. + * @implements ISqlServerEntraIdConfig + * @constructor + * @param {google.cloud.sql.v1.ISqlServerEntraIdConfig=} [properties] Properties to set + */ + function SqlServerEntraIdConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlServerEntraIdConfig kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @instance + */ + SqlServerEntraIdConfig.prototype.kind = ""; + + /** + * SqlServerEntraIdConfig tenantId. + * @member {string} tenantId + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @instance + */ + SqlServerEntraIdConfig.prototype.tenantId = ""; + + /** + * SqlServerEntraIdConfig applicationId. + * @member {string} applicationId + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @instance + */ + SqlServerEntraIdConfig.prototype.applicationId = ""; + + /** + * Creates a new SqlServerEntraIdConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @static + * @param {google.cloud.sql.v1.ISqlServerEntraIdConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlServerEntraIdConfig} SqlServerEntraIdConfig instance + */ + SqlServerEntraIdConfig.create = function create(properties) { + return new SqlServerEntraIdConfig(properties); + }; + + /** + * Encodes the specified SqlServerEntraIdConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlServerEntraIdConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @static + * @param {google.cloud.sql.v1.ISqlServerEntraIdConfig} message SqlServerEntraIdConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerEntraIdConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.tenantId != null && Object.hasOwnProperty.call(message, "tenantId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tenantId); + if (message.applicationId != null && Object.hasOwnProperty.call(message, "applicationId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.applicationId); + return writer; + }; + + /** + * Encodes the specified SqlServerEntraIdConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerEntraIdConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @static + * @param {google.cloud.sql.v1.ISqlServerEntraIdConfig} message SqlServerEntraIdConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerEntraIdConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlServerEntraIdConfig} SqlServerEntraIdConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerEntraIdConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlServerEntraIdConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.tenantId = reader.string(); + break; + } + case 3: { + message.applicationId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlServerEntraIdConfig} SqlServerEntraIdConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerEntraIdConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlServerEntraIdConfig message. + * @function verify + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlServerEntraIdConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.tenantId != null && message.hasOwnProperty("tenantId")) + if (!$util.isString(message.tenantId)) + return "tenantId: string expected"; + if (message.applicationId != null && message.hasOwnProperty("applicationId")) + if (!$util.isString(message.applicationId)) + return "applicationId: string expected"; + return null; + }; + + /** + * Creates a SqlServerEntraIdConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlServerEntraIdConfig} SqlServerEntraIdConfig + */ + SqlServerEntraIdConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlServerEntraIdConfig) + return object; + var message = new $root.google.cloud.sql.v1.SqlServerEntraIdConfig(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.tenantId != null) + message.tenantId = String(object.tenantId); + if (object.applicationId != null) + message.applicationId = String(object.applicationId); + return message; + }; + + /** + * Creates a plain object from a SqlServerEntraIdConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @static + * @param {google.cloud.sql.v1.SqlServerEntraIdConfig} message SqlServerEntraIdConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlServerEntraIdConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.tenantId = ""; + object.applicationId = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.tenantId != null && message.hasOwnProperty("tenantId")) + object.tenantId = message.tenantId; + if (message.applicationId != null && message.hasOwnProperty("applicationId")) + object.applicationId = message.applicationId; + return object; + }; + + /** + * Converts this SqlServerEntraIdConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @instance + * @returns {Object.} JSON object + */ + SqlServerEntraIdConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlServerEntraIdConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlServerEntraIdConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlServerEntraIdConfig"; + }; + + return SqlServerEntraIdConfig; + })(); + + /** + * SqlBackendType enum. + * @name google.cloud.sql.v1.SqlBackendType + * @enum {number} + * @property {number} SQL_BACKEND_TYPE_UNSPECIFIED=0 SQL_BACKEND_TYPE_UNSPECIFIED value + * @property {number} FIRST_GEN=1 FIRST_GEN value + * @property {number} SECOND_GEN=2 SECOND_GEN value + * @property {number} EXTERNAL=3 EXTERNAL value + */ + v1.SqlBackendType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKEND_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FIRST_GEN"] = 1; + values[valuesById[2] = "SECOND_GEN"] = 2; + values[valuesById[3] = "EXTERNAL"] = 3; + return values; + })(); + + /** + * SqlIpAddressType enum. + * @name google.cloud.sql.v1.SqlIpAddressType + * @enum {number} + * @property {number} SQL_IP_ADDRESS_TYPE_UNSPECIFIED=0 SQL_IP_ADDRESS_TYPE_UNSPECIFIED value + * @property {number} PRIMARY=1 PRIMARY value + * @property {number} OUTGOING=2 OUTGOING value + * @property {number} PRIVATE=3 PRIVATE value + * @property {number} MIGRATED_1ST_GEN=4 MIGRATED_1ST_GEN value + */ + v1.SqlIpAddressType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_IP_ADDRESS_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIMARY"] = 1; + values[valuesById[2] = "OUTGOING"] = 2; + values[valuesById[3] = "PRIVATE"] = 3; + values[valuesById[4] = "MIGRATED_1ST_GEN"] = 4; + return values; + })(); + + /** + * SqlDatabaseVersion enum. + * @name google.cloud.sql.v1.SqlDatabaseVersion + * @enum {number} + * @property {number} SQL_DATABASE_VERSION_UNSPECIFIED=0 SQL_DATABASE_VERSION_UNSPECIFIED value + * @property {number} MYSQL_5_1=2 MYSQL_5_1 value + * @property {number} MYSQL_5_5=3 MYSQL_5_5 value + * @property {number} MYSQL_5_6=5 MYSQL_5_6 value + * @property {number} MYSQL_5_7=6 MYSQL_5_7 value + * @property {number} MYSQL_8_0=20 MYSQL_8_0 value + * @property {number} MYSQL_8_0_18=41 MYSQL_8_0_18 value + * @property {number} MYSQL_8_0_26=85 MYSQL_8_0_26 value + * @property {number} MYSQL_8_0_27=111 MYSQL_8_0_27 value + * @property {number} MYSQL_8_0_28=132 MYSQL_8_0_28 value + * @property {number} MYSQL_8_0_29=148 MYSQL_8_0_29 value + * @property {number} MYSQL_8_0_30=174 MYSQL_8_0_30 value + * @property {number} MYSQL_8_0_31=197 MYSQL_8_0_31 value + * @property {number} MYSQL_8_0_32=213 MYSQL_8_0_32 value + * @property {number} MYSQL_8_0_33=238 MYSQL_8_0_33 value + * @property {number} MYSQL_8_0_34=239 MYSQL_8_0_34 value + * @property {number} MYSQL_8_0_35=240 MYSQL_8_0_35 value + * @property {number} MYSQL_8_0_36=241 MYSQL_8_0_36 value + * @property {number} MYSQL_8_0_37=355 MYSQL_8_0_37 value + * @property {number} MYSQL_8_0_39=357 MYSQL_8_0_39 value + * @property {number} MYSQL_8_0_40=358 MYSQL_8_0_40 value + * @property {number} MYSQL_8_0_41=488 MYSQL_8_0_41 value + * @property {number} MYSQL_8_0_42=489 MYSQL_8_0_42 value + * @property {number} MYSQL_8_0_43=553 MYSQL_8_0_43 value + * @property {number} MYSQL_8_0_44=554 MYSQL_8_0_44 value + * @property {number} MYSQL_8_0_45=555 MYSQL_8_0_45 value + * @property {number} MYSQL_8_0_46=556 MYSQL_8_0_46 value + * @property {number} MYSQL_8_4=398 MYSQL_8_4 value + * @property {number} MYSQL_9_7=654 MYSQL_9_7 value + * @property {number} SQLSERVER_2017_STANDARD=11 SQLSERVER_2017_STANDARD value + * @property {number} SQLSERVER_2017_ENTERPRISE=14 SQLSERVER_2017_ENTERPRISE value + * @property {number} SQLSERVER_2017_EXPRESS=15 SQLSERVER_2017_EXPRESS value + * @property {number} SQLSERVER_2017_WEB=16 SQLSERVER_2017_WEB value + * @property {number} POSTGRES_9_6=9 POSTGRES_9_6 value + * @property {number} POSTGRES_10=18 POSTGRES_10 value + * @property {number} POSTGRES_11=10 POSTGRES_11 value + * @property {number} POSTGRES_12=19 POSTGRES_12 value + * @property {number} POSTGRES_13=23 POSTGRES_13 value + * @property {number} POSTGRES_14=110 POSTGRES_14 value + * @property {number} POSTGRES_15=172 POSTGRES_15 value + * @property {number} POSTGRES_16=272 POSTGRES_16 value + * @property {number} POSTGRES_17=408 POSTGRES_17 value + * @property {number} POSTGRES_18=557 POSTGRES_18 value + * @property {number} POSTGRES_19=684 POSTGRES_19 value + * @property {number} SQLSERVER_2019_STANDARD=26 SQLSERVER_2019_STANDARD value + * @property {number} SQLSERVER_2019_ENTERPRISE=27 SQLSERVER_2019_ENTERPRISE value + * @property {number} SQLSERVER_2019_EXPRESS=28 SQLSERVER_2019_EXPRESS value + * @property {number} SQLSERVER_2019_WEB=29 SQLSERVER_2019_WEB value + * @property {number} SQLSERVER_2022_STANDARD=199 SQLSERVER_2022_STANDARD value + * @property {number} SQLSERVER_2022_ENTERPRISE=200 SQLSERVER_2022_ENTERPRISE value + * @property {number} SQLSERVER_2022_EXPRESS=201 SQLSERVER_2022_EXPRESS value + * @property {number} SQLSERVER_2022_WEB=202 SQLSERVER_2022_WEB value + * @property {number} SQLSERVER_2025_STANDARD=549 SQLSERVER_2025_STANDARD value + * @property {number} SQLSERVER_2025_ENTERPRISE=550 SQLSERVER_2025_ENTERPRISE value + * @property {number} SQLSERVER_2025_EXPRESS=551 SQLSERVER_2025_EXPRESS value + */ + v1.SqlDatabaseVersion = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_DATABASE_VERSION_UNSPECIFIED"] = 0; + values[valuesById[2] = "MYSQL_5_1"] = 2; + values[valuesById[3] = "MYSQL_5_5"] = 3; + values[valuesById[5] = "MYSQL_5_6"] = 5; + values[valuesById[6] = "MYSQL_5_7"] = 6; + values[valuesById[20] = "MYSQL_8_0"] = 20; + values[valuesById[41] = "MYSQL_8_0_18"] = 41; + values[valuesById[85] = "MYSQL_8_0_26"] = 85; + values[valuesById[111] = "MYSQL_8_0_27"] = 111; + values[valuesById[132] = "MYSQL_8_0_28"] = 132; + values[valuesById[148] = "MYSQL_8_0_29"] = 148; + values[valuesById[174] = "MYSQL_8_0_30"] = 174; + values[valuesById[197] = "MYSQL_8_0_31"] = 197; + values[valuesById[213] = "MYSQL_8_0_32"] = 213; + values[valuesById[238] = "MYSQL_8_0_33"] = 238; + values[valuesById[239] = "MYSQL_8_0_34"] = 239; + values[valuesById[240] = "MYSQL_8_0_35"] = 240; + values[valuesById[241] = "MYSQL_8_0_36"] = 241; + values[valuesById[355] = "MYSQL_8_0_37"] = 355; + values[valuesById[357] = "MYSQL_8_0_39"] = 357; + values[valuesById[358] = "MYSQL_8_0_40"] = 358; + values[valuesById[488] = "MYSQL_8_0_41"] = 488; + values[valuesById[489] = "MYSQL_8_0_42"] = 489; + values[valuesById[553] = "MYSQL_8_0_43"] = 553; + values[valuesById[554] = "MYSQL_8_0_44"] = 554; + values[valuesById[555] = "MYSQL_8_0_45"] = 555; + values[valuesById[556] = "MYSQL_8_0_46"] = 556; + values[valuesById[398] = "MYSQL_8_4"] = 398; + values[valuesById[654] = "MYSQL_9_7"] = 654; + values[valuesById[11] = "SQLSERVER_2017_STANDARD"] = 11; + values[valuesById[14] = "SQLSERVER_2017_ENTERPRISE"] = 14; + values[valuesById[15] = "SQLSERVER_2017_EXPRESS"] = 15; + values[valuesById[16] = "SQLSERVER_2017_WEB"] = 16; + values[valuesById[9] = "POSTGRES_9_6"] = 9; + values[valuesById[18] = "POSTGRES_10"] = 18; + values[valuesById[10] = "POSTGRES_11"] = 10; + values[valuesById[19] = "POSTGRES_12"] = 19; + values[valuesById[23] = "POSTGRES_13"] = 23; + values[valuesById[110] = "POSTGRES_14"] = 110; + values[valuesById[172] = "POSTGRES_15"] = 172; + values[valuesById[272] = "POSTGRES_16"] = 272; + values[valuesById[408] = "POSTGRES_17"] = 408; + values[valuesById[557] = "POSTGRES_18"] = 557; + values[valuesById[684] = "POSTGRES_19"] = 684; + values[valuesById[26] = "SQLSERVER_2019_STANDARD"] = 26; + values[valuesById[27] = "SQLSERVER_2019_ENTERPRISE"] = 27; + values[valuesById[28] = "SQLSERVER_2019_EXPRESS"] = 28; + values[valuesById[29] = "SQLSERVER_2019_WEB"] = 29; + values[valuesById[199] = "SQLSERVER_2022_STANDARD"] = 199; + values[valuesById[200] = "SQLSERVER_2022_ENTERPRISE"] = 200; + values[valuesById[201] = "SQLSERVER_2022_EXPRESS"] = 201; + values[valuesById[202] = "SQLSERVER_2022_WEB"] = 202; + values[valuesById[549] = "SQLSERVER_2025_STANDARD"] = 549; + values[valuesById[550] = "SQLSERVER_2025_ENTERPRISE"] = 550; + values[valuesById[551] = "SQLSERVER_2025_EXPRESS"] = 551; + return values; + })(); + + /** + * SqlPricingPlan enum. + * @name google.cloud.sql.v1.SqlPricingPlan + * @enum {number} + * @property {number} SQL_PRICING_PLAN_UNSPECIFIED=0 SQL_PRICING_PLAN_UNSPECIFIED value + * @property {number} PACKAGE=1 PACKAGE value + * @property {number} PER_USE=2 PER_USE value + */ + v1.SqlPricingPlan = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_PRICING_PLAN_UNSPECIFIED"] = 0; + values[valuesById[1] = "PACKAGE"] = 1; + values[valuesById[2] = "PER_USE"] = 2; + return values; + })(); + + /** + * SqlReplicationType enum. + * @name google.cloud.sql.v1.SqlReplicationType + * @enum {number} + * @property {number} SQL_REPLICATION_TYPE_UNSPECIFIED=0 SQL_REPLICATION_TYPE_UNSPECIFIED value + * @property {number} SYNCHRONOUS=1 SYNCHRONOUS value + * @property {number} ASYNCHRONOUS=2 ASYNCHRONOUS value + */ + v1.SqlReplicationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_REPLICATION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SYNCHRONOUS"] = 1; + values[valuesById[2] = "ASYNCHRONOUS"] = 2; + return values; + })(); + + /** + * SqlDataDiskType enum. + * @name google.cloud.sql.v1.SqlDataDiskType + * @enum {number} + * @property {number} SQL_DATA_DISK_TYPE_UNSPECIFIED=0 SQL_DATA_DISK_TYPE_UNSPECIFIED value + * @property {number} PD_SSD=1 PD_SSD value + * @property {number} PD_HDD=2 PD_HDD value + * @property {number} OBSOLETE_LOCAL_SSD=3 OBSOLETE_LOCAL_SSD value + * @property {number} HYPERDISK_BALANCED=4 HYPERDISK_BALANCED value + */ + v1.SqlDataDiskType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_DATA_DISK_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PD_SSD"] = 1; + values[valuesById[2] = "PD_HDD"] = 2; + values[valuesById[3] = "OBSOLETE_LOCAL_SSD"] = 3; + values[valuesById[4] = "HYPERDISK_BALANCED"] = 4; + return values; + })(); + + /** + * SqlAvailabilityType enum. + * @name google.cloud.sql.v1.SqlAvailabilityType + * @enum {number} + * @property {number} SQL_AVAILABILITY_TYPE_UNSPECIFIED=0 SQL_AVAILABILITY_TYPE_UNSPECIFIED value + * @property {number} ZONAL=1 ZONAL value + * @property {number} REGIONAL=2 REGIONAL value + */ + v1.SqlAvailabilityType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_AVAILABILITY_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ZONAL"] = 1; + values[valuesById[2] = "REGIONAL"] = 2; + return values; + })(); + + /** + * SqlUpdateTrack enum. + * @name google.cloud.sql.v1.SqlUpdateTrack + * @enum {number} + * @property {number} SQL_UPDATE_TRACK_UNSPECIFIED=0 SQL_UPDATE_TRACK_UNSPECIFIED value + * @property {number} canary=1 canary value + * @property {number} stable=2 stable value + * @property {number} week5=3 week5 value + */ + v1.SqlUpdateTrack = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_UPDATE_TRACK_UNSPECIFIED"] = 0; + values[valuesById[1] = "canary"] = 1; + values[valuesById[2] = "stable"] = 2; + values[valuesById[3] = "week5"] = 3; + return values; + })(); + + v1.AcquireSsrsLeaseContext = (function() { + + /** + * Properties of an AcquireSsrsLeaseContext. + * @memberof google.cloud.sql.v1 + * @interface IAcquireSsrsLeaseContext + * @property {string|null} [setupLogin] AcquireSsrsLeaseContext setupLogin + * @property {string|null} [serviceLogin] AcquireSsrsLeaseContext serviceLogin + * @property {string|null} [reportDatabase] AcquireSsrsLeaseContext reportDatabase + * @property {google.protobuf.IDuration|null} [duration] AcquireSsrsLeaseContext duration + */ + + /** + * Constructs a new AcquireSsrsLeaseContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an AcquireSsrsLeaseContext. + * @implements IAcquireSsrsLeaseContext + * @constructor + * @param {google.cloud.sql.v1.IAcquireSsrsLeaseContext=} [properties] Properties to set + */ + function AcquireSsrsLeaseContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AcquireSsrsLeaseContext setupLogin. + * @member {string|null|undefined} setupLogin + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @instance + */ + AcquireSsrsLeaseContext.prototype.setupLogin = null; + + /** + * AcquireSsrsLeaseContext serviceLogin. + * @member {string|null|undefined} serviceLogin + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @instance + */ + AcquireSsrsLeaseContext.prototype.serviceLogin = null; + + /** + * AcquireSsrsLeaseContext reportDatabase. + * @member {string|null|undefined} reportDatabase + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @instance + */ + AcquireSsrsLeaseContext.prototype.reportDatabase = null; + + /** + * AcquireSsrsLeaseContext duration. + * @member {google.protobuf.IDuration|null|undefined} duration + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @instance + */ + AcquireSsrsLeaseContext.prototype.duration = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_setupLogin", { + get: $util.oneOfGetter($oneOfFields = ["setupLogin"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_serviceLogin", { + get: $util.oneOfGetter($oneOfFields = ["serviceLogin"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_reportDatabase", { + get: $util.oneOfGetter($oneOfFields = ["reportDatabase"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_duration", { + get: $util.oneOfGetter($oneOfFields = ["duration"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AcquireSsrsLeaseContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @static + * @param {google.cloud.sql.v1.IAcquireSsrsLeaseContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext instance + */ + AcquireSsrsLeaseContext.create = function create(properties) { + return new AcquireSsrsLeaseContext(properties); + }; + + /** + * Encodes the specified AcquireSsrsLeaseContext message. Does not implicitly {@link google.cloud.sql.v1.AcquireSsrsLeaseContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @static + * @param {google.cloud.sql.v1.IAcquireSsrsLeaseContext} message AcquireSsrsLeaseContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcquireSsrsLeaseContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.setupLogin != null && Object.hasOwnProperty.call(message, "setupLogin")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.setupLogin); + if (message.serviceLogin != null && Object.hasOwnProperty.call(message, "serviceLogin")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.serviceLogin); + if (message.reportDatabase != null && Object.hasOwnProperty.call(message, "reportDatabase")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.reportDatabase); + if (message.duration != null && Object.hasOwnProperty.call(message, "duration")) + $root.google.protobuf.Duration.encode(message.duration, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AcquireSsrsLeaseContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AcquireSsrsLeaseContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @static + * @param {google.cloud.sql.v1.IAcquireSsrsLeaseContext} message AcquireSsrsLeaseContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcquireSsrsLeaseContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AcquireSsrsLeaseContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.AcquireSsrsLeaseContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.setupLogin = reader.string(); + break; + } + case 2: { + message.serviceLogin = reader.string(); + break; + } + case 3: { + message.reportDatabase = reader.string(); + break; + } + case 4: { + message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AcquireSsrsLeaseContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AcquireSsrsLeaseContext message. + * @function verify + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AcquireSsrsLeaseContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.setupLogin != null && message.hasOwnProperty("setupLogin")) { + properties._setupLogin = 1; + if (!$util.isString(message.setupLogin)) + return "setupLogin: string expected"; + } + if (message.serviceLogin != null && message.hasOwnProperty("serviceLogin")) { + properties._serviceLogin = 1; + if (!$util.isString(message.serviceLogin)) + return "serviceLogin: string expected"; + } + if (message.reportDatabase != null && message.hasOwnProperty("reportDatabase")) { + properties._reportDatabase = 1; + if (!$util.isString(message.reportDatabase)) + return "reportDatabase: string expected"; + } + if (message.duration != null && message.hasOwnProperty("duration")) { + properties._duration = 1; + { + var error = $root.google.protobuf.Duration.verify(message.duration); + if (error) + return "duration." + error; + } + } + return null; + }; + + /** + * Creates an AcquireSsrsLeaseContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext + */ + AcquireSsrsLeaseContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.AcquireSsrsLeaseContext) + return object; + var message = new $root.google.cloud.sql.v1.AcquireSsrsLeaseContext(); + if (object.setupLogin != null) + message.setupLogin = String(object.setupLogin); + if (object.serviceLogin != null) + message.serviceLogin = String(object.serviceLogin); + if (object.reportDatabase != null) + message.reportDatabase = String(object.reportDatabase); + if (object.duration != null) { + if (typeof object.duration !== "object") + throw TypeError(".google.cloud.sql.v1.AcquireSsrsLeaseContext.duration: object expected"); + message.duration = $root.google.protobuf.Duration.fromObject(object.duration); + } + return message; + }; + + /** + * Creates a plain object from an AcquireSsrsLeaseContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @static + * @param {google.cloud.sql.v1.AcquireSsrsLeaseContext} message AcquireSsrsLeaseContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AcquireSsrsLeaseContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.setupLogin != null && message.hasOwnProperty("setupLogin")) { + object.setupLogin = message.setupLogin; + if (options.oneofs) + object._setupLogin = "setupLogin"; + } + if (message.serviceLogin != null && message.hasOwnProperty("serviceLogin")) { + object.serviceLogin = message.serviceLogin; + if (options.oneofs) + object._serviceLogin = "serviceLogin"; + } + if (message.reportDatabase != null && message.hasOwnProperty("reportDatabase")) { + object.reportDatabase = message.reportDatabase; + if (options.oneofs) + object._reportDatabase = "reportDatabase"; + } + if (message.duration != null && message.hasOwnProperty("duration")) { + object.duration = $root.google.protobuf.Duration.toObject(message.duration, options); + if (options.oneofs) + object._duration = "duration"; + } + return object; + }; + + /** + * Converts this AcquireSsrsLeaseContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @instance + * @returns {Object.} JSON object + */ + AcquireSsrsLeaseContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AcquireSsrsLeaseContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AcquireSsrsLeaseContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.AcquireSsrsLeaseContext"; + }; + + return AcquireSsrsLeaseContext; + })(); + + v1.DnsNameMapping = (function() { + + /** + * Properties of a DnsNameMapping. + * @memberof google.cloud.sql.v1 + * @interface IDnsNameMapping + * @property {string|null} [name] DnsNameMapping name + * @property {google.cloud.sql.v1.DnsNameMapping.ConnectionType|null} [connectionType] DnsNameMapping connectionType + * @property {google.cloud.sql.v1.DnsNameMapping.DnsScope|null} [dnsScope] DnsNameMapping dnsScope + * @property {google.cloud.sql.v1.DnsNameMapping.RecordManager|null} [recordManager] DnsNameMapping recordManager + */ + + /** + * Constructs a new DnsNameMapping. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DnsNameMapping. + * @implements IDnsNameMapping + * @constructor + * @param {google.cloud.sql.v1.IDnsNameMapping=} [properties] Properties to set + */ + function DnsNameMapping(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DnsNameMapping name. + * @member {string} name + * @memberof google.cloud.sql.v1.DnsNameMapping + * @instance + */ + DnsNameMapping.prototype.name = ""; + + /** + * DnsNameMapping connectionType. + * @member {google.cloud.sql.v1.DnsNameMapping.ConnectionType} connectionType + * @memberof google.cloud.sql.v1.DnsNameMapping + * @instance + */ + DnsNameMapping.prototype.connectionType = 0; + + /** + * DnsNameMapping dnsScope. + * @member {google.cloud.sql.v1.DnsNameMapping.DnsScope} dnsScope + * @memberof google.cloud.sql.v1.DnsNameMapping + * @instance + */ + DnsNameMapping.prototype.dnsScope = 0; + + /** + * DnsNameMapping recordManager. + * @member {google.cloud.sql.v1.DnsNameMapping.RecordManager} recordManager + * @memberof google.cloud.sql.v1.DnsNameMapping + * @instance + */ + DnsNameMapping.prototype.recordManager = 0; + + /** + * Creates a new DnsNameMapping instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DnsNameMapping + * @static + * @param {google.cloud.sql.v1.IDnsNameMapping=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DnsNameMapping} DnsNameMapping instance + */ + DnsNameMapping.create = function create(properties) { + return new DnsNameMapping(properties); + }; + + /** + * Encodes the specified DnsNameMapping message. Does not implicitly {@link google.cloud.sql.v1.DnsNameMapping.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DnsNameMapping + * @static + * @param {google.cloud.sql.v1.IDnsNameMapping} message DnsNameMapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DnsNameMapping.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.connectionType != null && Object.hasOwnProperty.call(message, "connectionType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.connectionType); + if (message.dnsScope != null && Object.hasOwnProperty.call(message, "dnsScope")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.dnsScope); + if (message.recordManager != null && Object.hasOwnProperty.call(message, "recordManager")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.recordManager); + return writer; + }; + + /** + * Encodes the specified DnsNameMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DnsNameMapping.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DnsNameMapping + * @static + * @param {google.cloud.sql.v1.IDnsNameMapping} message DnsNameMapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DnsNameMapping.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DnsNameMapping message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DnsNameMapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DnsNameMapping} DnsNameMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DnsNameMapping.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DnsNameMapping(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.connectionType = reader.int32(); + break; + } + case 3: { + message.dnsScope = reader.int32(); + break; + } + case 4: { + message.recordManager = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DnsNameMapping message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DnsNameMapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DnsNameMapping} DnsNameMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DnsNameMapping.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DnsNameMapping message. + * @function verify + * @memberof google.cloud.sql.v1.DnsNameMapping + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DnsNameMapping.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.connectionType != null && message.hasOwnProperty("connectionType")) + switch (message.connectionType) { + default: + return "connectionType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.dnsScope != null && message.hasOwnProperty("dnsScope")) + switch (message.dnsScope) { + default: + return "dnsScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.recordManager != null && message.hasOwnProperty("recordManager")) + switch (message.recordManager) { + default: + return "recordManager: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DnsNameMapping message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DnsNameMapping + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DnsNameMapping} DnsNameMapping + */ + DnsNameMapping.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DnsNameMapping) + return object; + var message = new $root.google.cloud.sql.v1.DnsNameMapping(); + if (object.name != null) + message.name = String(object.name); + switch (object.connectionType) { + default: + if (typeof object.connectionType === "number") { + message.connectionType = object.connectionType; + break; + } + break; + case "CONNECTION_TYPE_UNSPECIFIED": + case 0: + message.connectionType = 0; + break; + case "PUBLIC": + case 1: + message.connectionType = 1; + break; + case "PRIVATE_SERVICES_ACCESS": + case 2: + message.connectionType = 2; + break; + case "PRIVATE_SERVICE_CONNECT": + case 3: + message.connectionType = 3; + break; + } + switch (object.dnsScope) { + default: + if (typeof object.dnsScope === "number") { + message.dnsScope = object.dnsScope; + break; + } + break; + case "DNS_SCOPE_UNSPECIFIED": + case 0: + message.dnsScope = 0; + break; + case "INSTANCE": + case 1: + message.dnsScope = 1; + break; + case "CLUSTER": + case 2: + message.dnsScope = 2; + break; + } + switch (object.recordManager) { + default: + if (typeof object.recordManager === "number") { + message.recordManager = object.recordManager; + break; + } + break; + case "RECORD_MANAGER_UNSPECIFIED": + case 0: + message.recordManager = 0; + break; + case "CUSTOMER": + case 1: + message.recordManager = 1; + break; + case "CLOUD_SQL_AUTOMATION": + case 2: + message.recordManager = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DnsNameMapping message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DnsNameMapping + * @static + * @param {google.cloud.sql.v1.DnsNameMapping} message DnsNameMapping + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DnsNameMapping.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.connectionType = options.enums === String ? "CONNECTION_TYPE_UNSPECIFIED" : 0; + object.dnsScope = options.enums === String ? "DNS_SCOPE_UNSPECIFIED" : 0; + object.recordManager = options.enums === String ? "RECORD_MANAGER_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.connectionType != null && message.hasOwnProperty("connectionType")) + object.connectionType = options.enums === String ? $root.google.cloud.sql.v1.DnsNameMapping.ConnectionType[message.connectionType] === undefined ? message.connectionType : $root.google.cloud.sql.v1.DnsNameMapping.ConnectionType[message.connectionType] : message.connectionType; + if (message.dnsScope != null && message.hasOwnProperty("dnsScope")) + object.dnsScope = options.enums === String ? $root.google.cloud.sql.v1.DnsNameMapping.DnsScope[message.dnsScope] === undefined ? message.dnsScope : $root.google.cloud.sql.v1.DnsNameMapping.DnsScope[message.dnsScope] : message.dnsScope; + if (message.recordManager != null && message.hasOwnProperty("recordManager")) + object.recordManager = options.enums === String ? $root.google.cloud.sql.v1.DnsNameMapping.RecordManager[message.recordManager] === undefined ? message.recordManager : $root.google.cloud.sql.v1.DnsNameMapping.RecordManager[message.recordManager] : message.recordManager; + return object; + }; + + /** + * Converts this DnsNameMapping to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DnsNameMapping + * @instance + * @returns {Object.} JSON object + */ + DnsNameMapping.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DnsNameMapping + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DnsNameMapping + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DnsNameMapping.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DnsNameMapping"; + }; + + /** + * ConnectionType enum. + * @name google.cloud.sql.v1.DnsNameMapping.ConnectionType + * @enum {number} + * @property {number} CONNECTION_TYPE_UNSPECIFIED=0 CONNECTION_TYPE_UNSPECIFIED value + * @property {number} PUBLIC=1 PUBLIC value + * @property {number} PRIVATE_SERVICES_ACCESS=2 PRIVATE_SERVICES_ACCESS value + * @property {number} PRIVATE_SERVICE_CONNECT=3 PRIVATE_SERVICE_CONNECT value + */ + DnsNameMapping.ConnectionType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONNECTION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PUBLIC"] = 1; + values[valuesById[2] = "PRIVATE_SERVICES_ACCESS"] = 2; + values[valuesById[3] = "PRIVATE_SERVICE_CONNECT"] = 3; + return values; + })(); + + /** + * DnsScope enum. + * @name google.cloud.sql.v1.DnsNameMapping.DnsScope + * @enum {number} + * @property {number} DNS_SCOPE_UNSPECIFIED=0 DNS_SCOPE_UNSPECIFIED value + * @property {number} INSTANCE=1 INSTANCE value + * @property {number} CLUSTER=2 CLUSTER value + */ + DnsNameMapping.DnsScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DNS_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INSTANCE"] = 1; + values[valuesById[2] = "CLUSTER"] = 2; + return values; + })(); + + /** + * RecordManager enum. + * @name google.cloud.sql.v1.DnsNameMapping.RecordManager + * @enum {number} + * @property {number} RECORD_MANAGER_UNSPECIFIED=0 RECORD_MANAGER_UNSPECIFIED value + * @property {number} CUSTOMER=1 CUSTOMER value + * @property {number} CLOUD_SQL_AUTOMATION=2 CLOUD_SQL_AUTOMATION value + */ + DnsNameMapping.RecordManager = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECORD_MANAGER_UNSPECIFIED"] = 0; + values[valuesById[1] = "CUSTOMER"] = 1; + values[valuesById[2] = "CLOUD_SQL_AUTOMATION"] = 2; + return values; + })(); + + return DnsNameMapping; + })(); + + v1.SqlBackupsService = (function() { + + /** + * Constructs a new SqlBackupsService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlBackupsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlBackupsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlBackupsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlBackupsService; + + /** + * Creates new SqlBackupsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlBackupsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlBackupsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlBackupsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|createBackup}. + * @memberof google.cloud.sql.v1.SqlBackupsService + * @typedef CreateBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls CreateBackup. + * @function createBackup + * @memberof google.cloud.sql.v1.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1.ICreateBackupRequest} request CreateBackupRequest message or plain object + * @param {google.cloud.sql.v1.SqlBackupsService.CreateBackupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupsService.prototype.createBackup = function createBackup(request, callback) { + return this.rpcCall(createBackup, $root.google.cloud.sql.v1.CreateBackupRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "CreateBackup" }); + + /** + * Calls CreateBackup. + * @function createBackup + * @memberof google.cloud.sql.v1.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1.ICreateBackupRequest} request CreateBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|getBackup}. + * @memberof google.cloud.sql.v1.SqlBackupsService + * @typedef GetBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Backup} [response] Backup + */ + + /** + * Calls GetBackup. + * @function getBackup + * @memberof google.cloud.sql.v1.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1.IGetBackupRequest} request GetBackupRequest message or plain object + * @param {google.cloud.sql.v1.SqlBackupsService.GetBackupCallback} callback Node-style callback called with the error, if any, and Backup + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupsService.prototype.getBackup = function getBackup(request, callback) { + return this.rpcCall(getBackup, $root.google.cloud.sql.v1.GetBackupRequest, $root.google.cloud.sql.v1.Backup, request, callback); + }, "name", { value: "GetBackup" }); + + /** + * Calls GetBackup. + * @function getBackup + * @memberof google.cloud.sql.v1.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1.IGetBackupRequest} request GetBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|listBackups}. + * @memberof google.cloud.sql.v1.SqlBackupsService + * @typedef ListBackupsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.ListBackupsResponse} [response] ListBackupsResponse + */ + + /** + * Calls ListBackups. + * @function listBackups + * @memberof google.cloud.sql.v1.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1.IListBackupsRequest} request ListBackupsRequest message or plain object + * @param {google.cloud.sql.v1.SqlBackupsService.ListBackupsCallback} callback Node-style callback called with the error, if any, and ListBackupsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupsService.prototype.listBackups = function listBackups(request, callback) { + return this.rpcCall(listBackups, $root.google.cloud.sql.v1.ListBackupsRequest, $root.google.cloud.sql.v1.ListBackupsResponse, request, callback); + }, "name", { value: "ListBackups" }); + + /** + * Calls ListBackups. + * @function listBackups + * @memberof google.cloud.sql.v1.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1.IListBackupsRequest} request ListBackupsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|updateBackup}. + * @memberof google.cloud.sql.v1.SqlBackupsService + * @typedef UpdateBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls UpdateBackup. + * @function updateBackup + * @memberof google.cloud.sql.v1.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1.IUpdateBackupRequest} request UpdateBackupRequest message or plain object + * @param {google.cloud.sql.v1.SqlBackupsService.UpdateBackupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupsService.prototype.updateBackup = function updateBackup(request, callback) { + return this.rpcCall(updateBackup, $root.google.cloud.sql.v1.UpdateBackupRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "UpdateBackup" }); + + /** + * Calls UpdateBackup. + * @function updateBackup + * @memberof google.cloud.sql.v1.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1.IUpdateBackupRequest} request UpdateBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|deleteBackup}. + * @memberof google.cloud.sql.v1.SqlBackupsService + * @typedef DeleteBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls DeleteBackup. + * @function deleteBackup + * @memberof google.cloud.sql.v1.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1.IDeleteBackupRequest} request DeleteBackupRequest message or plain object + * @param {google.cloud.sql.v1.SqlBackupsService.DeleteBackupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupsService.prototype.deleteBackup = function deleteBackup(request, callback) { + return this.rpcCall(deleteBackup, $root.google.cloud.sql.v1.DeleteBackupRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "DeleteBackup" }); + + /** + * Calls DeleteBackup. + * @function deleteBackup + * @memberof google.cloud.sql.v1.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1.IDeleteBackupRequest} request DeleteBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlBackupsService; + })(); + + v1.CreateBackupRequest = (function() { + + /** + * Properties of a CreateBackupRequest. + * @memberof google.cloud.sql.v1 + * @interface ICreateBackupRequest + * @property {string|null} [parent] CreateBackupRequest parent + * @property {google.cloud.sql.v1.IBackup|null} [backup] CreateBackupRequest backup + */ + + /** + * Constructs a new CreateBackupRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a CreateBackupRequest. + * @implements ICreateBackupRequest + * @constructor + * @param {google.cloud.sql.v1.ICreateBackupRequest=} [properties] Properties to set + */ + function CreateBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateBackupRequest parent. + * @member {string} parent + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @instance + */ + CreateBackupRequest.prototype.parent = ""; + + /** + * CreateBackupRequest backup. + * @member {google.cloud.sql.v1.IBackup|null|undefined} backup + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @instance + */ + CreateBackupRequest.prototype.backup = null; + + /** + * Creates a new CreateBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @static + * @param {google.cloud.sql.v1.ICreateBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.CreateBackupRequest} CreateBackupRequest instance + */ + CreateBackupRequest.create = function create(properties) { + return new CreateBackupRequest(properties); + }; + + /** + * Encodes the specified CreateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.CreateBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @static + * @param {google.cloud.sql.v1.ICreateBackupRequest} message CreateBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + $root.google.cloud.sql.v1.Backup.encode(message.backup, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.CreateBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @static + * @param {google.cloud.sql.v1.ICreateBackupRequest} message CreateBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.CreateBackupRequest} CreateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.CreateBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.backup = $root.google.cloud.sql.v1.Backup.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.CreateBackupRequest} CreateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.backup != null && message.hasOwnProperty("backup")) { + var error = $root.google.cloud.sql.v1.Backup.verify(message.backup); + if (error) + return "backup." + error; + } + return null; + }; + + /** + * Creates a CreateBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.CreateBackupRequest} CreateBackupRequest + */ + CreateBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.CreateBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1.CreateBackupRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.backup != null) { + if (typeof object.backup !== "object") + throw TypeError(".google.cloud.sql.v1.CreateBackupRequest.backup: object expected"); + message.backup = $root.google.cloud.sql.v1.Backup.fromObject(object.backup); + } + return message; + }; + + /** + * Creates a plain object from a CreateBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @static + * @param {google.cloud.sql.v1.CreateBackupRequest} message CreateBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.backup = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.backup != null && message.hasOwnProperty("backup")) + object.backup = $root.google.cloud.sql.v1.Backup.toObject(message.backup, options); + return object; + }; + + /** + * Converts this CreateBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @instance + * @returns {Object.} JSON object + */ + CreateBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.CreateBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.CreateBackupRequest"; + }; + + return CreateBackupRequest; + })(); + + v1.GetBackupRequest = (function() { + + /** + * Properties of a GetBackupRequest. + * @memberof google.cloud.sql.v1 + * @interface IGetBackupRequest + * @property {string|null} [name] GetBackupRequest name + */ + + /** + * Constructs a new GetBackupRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a GetBackupRequest. + * @implements IGetBackupRequest + * @constructor + * @param {google.cloud.sql.v1.IGetBackupRequest=} [properties] Properties to set + */ + function GetBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBackupRequest name. + * @member {string} name + * @memberof google.cloud.sql.v1.GetBackupRequest + * @instance + */ + GetBackupRequest.prototype.name = ""; + + /** + * Creates a new GetBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.GetBackupRequest + * @static + * @param {google.cloud.sql.v1.IGetBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.GetBackupRequest} GetBackupRequest instance + */ + GetBackupRequest.create = function create(properties) { + return new GetBackupRequest(properties); + }; + + /** + * Encodes the specified GetBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.GetBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.GetBackupRequest + * @static + * @param {google.cloud.sql.v1.IGetBackupRequest} message GetBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GetBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.GetBackupRequest + * @static + * @param {google.cloud.sql.v1.IGetBackupRequest} message GetBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.GetBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.GetBackupRequest} GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.GetBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.GetBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.GetBackupRequest} GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1.GetBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.GetBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.GetBackupRequest} GetBackupRequest + */ + GetBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.GetBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1.GetBackupRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.GetBackupRequest + * @static + * @param {google.cloud.sql.v1.GetBackupRequest} message GetBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.GetBackupRequest + * @instance + * @returns {Object.} JSON object + */ + GetBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.GetBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.GetBackupRequest"; + }; + + return GetBackupRequest; + })(); + + v1.ListBackupsRequest = (function() { + + /** + * Properties of a ListBackupsRequest. + * @memberof google.cloud.sql.v1 + * @interface IListBackupsRequest + * @property {string|null} [parent] ListBackupsRequest parent + * @property {number|null} [pageSize] ListBackupsRequest pageSize + * @property {string|null} [pageToken] ListBackupsRequest pageToken + * @property {string|null} [filter] ListBackupsRequest filter + */ + + /** + * Constructs a new ListBackupsRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a ListBackupsRequest. + * @implements IListBackupsRequest + * @constructor + * @param {google.cloud.sql.v1.IListBackupsRequest=} [properties] Properties to set + */ + function ListBackupsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBackupsRequest parent. + * @member {string} parent + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @instance + */ + ListBackupsRequest.prototype.parent = ""; + + /** + * ListBackupsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @instance + */ + ListBackupsRequest.prototype.pageSize = 0; + + /** + * ListBackupsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @instance + */ + ListBackupsRequest.prototype.pageToken = ""; + + /** + * ListBackupsRequest filter. + * @member {string} filter + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @instance + */ + ListBackupsRequest.prototype.filter = ""; + + /** + * Creates a new ListBackupsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @static + * @param {google.cloud.sql.v1.IListBackupsRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ListBackupsRequest} ListBackupsRequest instance + */ + ListBackupsRequest.create = function create(properties) { + return new ListBackupsRequest(properties); + }; + + /** + * Encodes the specified ListBackupsRequest message. Does not implicitly {@link google.cloud.sql.v1.ListBackupsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @static + * @param {google.cloud.sql.v1.IListBackupsRequest} message ListBackupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListBackupsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ListBackupsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @static + * @param {google.cloud.sql.v1.IListBackupsRequest} message ListBackupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ListBackupsRequest} ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ListBackupsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ListBackupsRequest} ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBackupsRequest message. + * @function verify + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBackupsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListBackupsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ListBackupsRequest} ListBackupsRequest + */ + ListBackupsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ListBackupsRequest) + return object; + var message = new $root.google.cloud.sql.v1.ListBackupsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListBackupsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @static + * @param {google.cloud.sql.v1.ListBackupsRequest} message ListBackupsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBackupsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListBackupsRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @instance + * @returns {Object.} JSON object + */ + ListBackupsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBackupsRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ListBackupsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBackupsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ListBackupsRequest"; + }; + + return ListBackupsRequest; + })(); + + v1.ListBackupsResponse = (function() { + + /** + * Properties of a ListBackupsResponse. + * @memberof google.cloud.sql.v1 + * @interface IListBackupsResponse + * @property {Array.|null} [backups] ListBackupsResponse backups + * @property {string|null} [nextPageToken] ListBackupsResponse nextPageToken + * @property {Array.|null} [warnings] ListBackupsResponse warnings + */ + + /** + * Constructs a new ListBackupsResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a ListBackupsResponse. + * @implements IListBackupsResponse + * @constructor + * @param {google.cloud.sql.v1.IListBackupsResponse=} [properties] Properties to set + */ + function ListBackupsResponse(properties) { + this.backups = []; + this.warnings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBackupsResponse backups. + * @member {Array.} backups + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @instance + */ + ListBackupsResponse.prototype.backups = $util.emptyArray; + + /** + * ListBackupsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @instance + */ + ListBackupsResponse.prototype.nextPageToken = ""; + + /** + * ListBackupsResponse warnings. + * @member {Array.} warnings + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @instance + */ + ListBackupsResponse.prototype.warnings = $util.emptyArray; + + /** + * Creates a new ListBackupsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @static + * @param {google.cloud.sql.v1.IListBackupsResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ListBackupsResponse} ListBackupsResponse instance + */ + ListBackupsResponse.create = function create(properties) { + return new ListBackupsResponse(properties); + }; + + /** + * Encodes the specified ListBackupsResponse message. Does not implicitly {@link google.cloud.sql.v1.ListBackupsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @static + * @param {google.cloud.sql.v1.IListBackupsResponse} message ListBackupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backups != null && message.backups.length) + for (var i = 0; i < message.backups.length; ++i) + $root.google.cloud.sql.v1.Backup.encode(message.backups[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + $root.google.cloud.sql.v1.ApiWarning.encode(message.warnings[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListBackupsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ListBackupsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @static + * @param {google.cloud.sql.v1.IListBackupsResponse} message ListBackupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ListBackupsResponse} ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ListBackupsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.backups && message.backups.length)) + message.backups = []; + message.backups.push($root.google.cloud.sql.v1.Backup.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push($root.google.cloud.sql.v1.ApiWarning.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ListBackupsResponse} ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBackupsResponse message. + * @function verify + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBackupsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.backups != null && message.hasOwnProperty("backups")) { + if (!Array.isArray(message.backups)) + return "backups: array expected"; + for (var i = 0; i < message.backups.length; ++i) { + var error = $root.google.cloud.sql.v1.Backup.verify(message.backups[i]); + if (error) + return "backups." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) { + var error = $root.google.cloud.sql.v1.ApiWarning.verify(message.warnings[i]); + if (error) + return "warnings." + error; + } + } + return null; + }; + + /** + * Creates a ListBackupsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ListBackupsResponse} ListBackupsResponse + */ + ListBackupsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ListBackupsResponse) + return object; + var message = new $root.google.cloud.sql.v1.ListBackupsResponse(); + if (object.backups) { + if (!Array.isArray(object.backups)) + throw TypeError(".google.cloud.sql.v1.ListBackupsResponse.backups: array expected"); + message.backups = []; + for (var i = 0; i < object.backups.length; ++i) { + if (typeof object.backups[i] !== "object") + throw TypeError(".google.cloud.sql.v1.ListBackupsResponse.backups: object expected"); + message.backups[i] = $root.google.cloud.sql.v1.Backup.fromObject(object.backups[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.sql.v1.ListBackupsResponse.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) { + if (typeof object.warnings[i] !== "object") + throw TypeError(".google.cloud.sql.v1.ListBackupsResponse.warnings: object expected"); + message.warnings[i] = $root.google.cloud.sql.v1.ApiWarning.fromObject(object.warnings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListBackupsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @static + * @param {google.cloud.sql.v1.ListBackupsResponse} message ListBackupsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBackupsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.backups = []; + object.warnings = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.backups && message.backups.length) { + object.backups = []; + for (var j = 0; j < message.backups.length; ++j) + object.backups[j] = $root.google.cloud.sql.v1.Backup.toObject(message.backups[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = $root.google.cloud.sql.v1.ApiWarning.toObject(message.warnings[j], options); + } + return object; + }; + + /** + * Converts this ListBackupsResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @instance + * @returns {Object.} JSON object + */ + ListBackupsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBackupsResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ListBackupsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBackupsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ListBackupsResponse"; + }; + + return ListBackupsResponse; + })(); + + v1.UpdateBackupRequest = (function() { + + /** + * Properties of an UpdateBackupRequest. + * @memberof google.cloud.sql.v1 + * @interface IUpdateBackupRequest + * @property {google.cloud.sql.v1.IBackup|null} [backup] UpdateBackupRequest backup + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateBackupRequest updateMask + */ + + /** + * Constructs a new UpdateBackupRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an UpdateBackupRequest. + * @implements IUpdateBackupRequest + * @constructor + * @param {google.cloud.sql.v1.IUpdateBackupRequest=} [properties] Properties to set + */ + function UpdateBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateBackupRequest backup. + * @member {google.cloud.sql.v1.IBackup|null|undefined} backup + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @instance + */ + UpdateBackupRequest.prototype.backup = null; + + /** + * UpdateBackupRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @instance + */ + UpdateBackupRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @static + * @param {google.cloud.sql.v1.IUpdateBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.UpdateBackupRequest} UpdateBackupRequest instance + */ + UpdateBackupRequest.create = function create(properties) { + return new UpdateBackupRequest(properties); + }; + + /** + * Encodes the specified UpdateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.UpdateBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @static + * @param {google.cloud.sql.v1.IUpdateBackupRequest} message UpdateBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + $root.google.cloud.sql.v1.Backup.encode(message.backup, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UpdateBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @static + * @param {google.cloud.sql.v1.IUpdateBackupRequest} message UpdateBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.UpdateBackupRequest} UpdateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.UpdateBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backup = $root.google.cloud.sql.v1.Backup.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.UpdateBackupRequest} UpdateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.backup != null && message.hasOwnProperty("backup")) { + var error = $root.google.cloud.sql.v1.Backup.verify(message.backup); + if (error) + return "backup." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.UpdateBackupRequest} UpdateBackupRequest + */ + UpdateBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.UpdateBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1.UpdateBackupRequest(); + if (object.backup != null) { + if (typeof object.backup !== "object") + throw TypeError(".google.cloud.sql.v1.UpdateBackupRequest.backup: object expected"); + message.backup = $root.google.cloud.sql.v1.Backup.fromObject(object.backup); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.sql.v1.UpdateBackupRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @static + * @param {google.cloud.sql.v1.UpdateBackupRequest} message UpdateBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.backup = null; + object.updateMask = null; + } + if (message.backup != null && message.hasOwnProperty("backup")) + object.backup = $root.google.cloud.sql.v1.Backup.toObject(message.backup, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.UpdateBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.UpdateBackupRequest"; + }; + + return UpdateBackupRequest; + })(); + + v1.DeleteBackupRequest = (function() { + + /** + * Properties of a DeleteBackupRequest. + * @memberof google.cloud.sql.v1 + * @interface IDeleteBackupRequest + * @property {string|null} [name] DeleteBackupRequest name + */ + + /** + * Constructs a new DeleteBackupRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DeleteBackupRequest. + * @implements IDeleteBackupRequest + * @constructor + * @param {google.cloud.sql.v1.IDeleteBackupRequest=} [properties] Properties to set + */ + function DeleteBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteBackupRequest name. + * @member {string} name + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @instance + */ + DeleteBackupRequest.prototype.name = ""; + + /** + * Creates a new DeleteBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @static + * @param {google.cloud.sql.v1.IDeleteBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DeleteBackupRequest} DeleteBackupRequest instance + */ + DeleteBackupRequest.create = function create(properties) { + return new DeleteBackupRequest(properties); + }; + + /** + * Encodes the specified DeleteBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.DeleteBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @static + * @param {google.cloud.sql.v1.IDeleteBackupRequest} message DeleteBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DeleteBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @static + * @param {google.cloud.sql.v1.IDeleteBackupRequest} message DeleteBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DeleteBackupRequest} DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DeleteBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DeleteBackupRequest} DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DeleteBackupRequest} DeleteBackupRequest + */ + DeleteBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DeleteBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1.DeleteBackupRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @static + * @param {google.cloud.sql.v1.DeleteBackupRequest} message DeleteBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DeleteBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DeleteBackupRequest"; + }; + + return DeleteBackupRequest; + })(); + + v1.Backup = (function() { + + /** + * Properties of a Backup. + * @memberof google.cloud.sql.v1 + * @interface IBackup + * @property {string|null} [name] Backup name + * @property {string|null} [kind] Backup kind + * @property {string|null} [selfLink] Backup selfLink + * @property {google.cloud.sql.v1.Backup.SqlBackupType|null} [type] Backup type + * @property {string|null} [description] Backup description + * @property {string|null} [instance] Backup instance + * @property {string|null} [location] Backup location + * @property {google.type.IInterval|null} [backupInterval] Backup backupInterval + * @property {google.cloud.sql.v1.Backup.SqlBackupState|null} [state] Backup state + * @property {google.cloud.sql.v1.IOperationError|null} [error] Backup error + * @property {string|null} [kmsKey] Backup kmsKey + * @property {string|null} [kmsKeyVersion] Backup kmsKeyVersion + * @property {google.cloud.sql.v1.SqlBackupKind|null} [backupKind] Backup backupKind + * @property {string|null} [timeZone] Backup timeZone + * @property {number|Long|null} [ttlDays] Backup ttlDays + * @property {google.protobuf.ITimestamp|null} [expiryTime] Backup expiryTime + * @property {google.cloud.sql.v1.SqlDatabaseVersion|null} [databaseVersion] Backup databaseVersion + * @property {number|Long|null} [maxChargeableBytes] Backup maxChargeableBytes + * @property {google.protobuf.ITimestamp|null} [instanceDeletionTime] Backup instanceDeletionTime + * @property {google.cloud.sql.v1.IDatabaseInstance|null} [instanceSettings] Backup instanceSettings + * @property {string|null} [backupRun] Backup backupRun + * @property {google.protobuf.IBoolValue|null} [satisfiesPzs] Backup satisfiesPzs + * @property {google.protobuf.IBoolValue|null} [satisfiesPzi] Backup satisfiesPzi + */ + + /** + * Constructs a new Backup. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a Backup. + * @implements IBackup + * @constructor + * @param {google.cloud.sql.v1.IBackup=} [properties] Properties to set + */ + function Backup(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Backup name. + * @member {string} name + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.name = ""; + + /** + * Backup kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.kind = ""; + + /** + * Backup selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.selfLink = ""; + + /** + * Backup type. + * @member {google.cloud.sql.v1.Backup.SqlBackupType} type + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.type = 0; + + /** + * Backup description. + * @member {string} description + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.description = ""; + + /** + * Backup instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.instance = ""; + + /** + * Backup location. + * @member {string} location + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.location = ""; + + /** + * Backup backupInterval. + * @member {google.type.IInterval|null|undefined} backupInterval + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.backupInterval = null; + + /** + * Backup state. + * @member {google.cloud.sql.v1.Backup.SqlBackupState} state + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.state = 0; + + /** + * Backup error. + * @member {google.cloud.sql.v1.IOperationError|null|undefined} error + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.error = null; + + /** + * Backup kmsKey. + * @member {string} kmsKey + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.kmsKey = ""; + + /** + * Backup kmsKeyVersion. + * @member {string} kmsKeyVersion + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.kmsKeyVersion = ""; + + /** + * Backup backupKind. + * @member {google.cloud.sql.v1.SqlBackupKind} backupKind + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.backupKind = 0; + + /** + * Backup timeZone. + * @member {string} timeZone + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.timeZone = ""; + + /** + * Backup ttlDays. + * @member {number|Long|null|undefined} ttlDays + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.ttlDays = null; + + /** + * Backup expiryTime. + * @member {google.protobuf.ITimestamp|null|undefined} expiryTime + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.expiryTime = null; + + /** + * Backup databaseVersion. + * @member {google.cloud.sql.v1.SqlDatabaseVersion} databaseVersion + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.databaseVersion = 0; + + /** + * Backup maxChargeableBytes. + * @member {number|Long|null|undefined} maxChargeableBytes + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.maxChargeableBytes = null; + + /** + * Backup instanceDeletionTime. + * @member {google.protobuf.ITimestamp|null|undefined} instanceDeletionTime + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.instanceDeletionTime = null; + + /** + * Backup instanceSettings. + * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} instanceSettings + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.instanceSettings = null; + + /** + * Backup backupRun. + * @member {string} backupRun + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.backupRun = ""; + + /** + * Backup satisfiesPzs. + * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzs + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.satisfiesPzs = null; + + /** + * Backup satisfiesPzi. + * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzi + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Backup.prototype.satisfiesPzi = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Backup expiration. + * @member {"ttlDays"|"expiryTime"|undefined} expiration + * @memberof google.cloud.sql.v1.Backup + * @instance + */ + Object.defineProperty(Backup.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["ttlDays", "expiryTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Backup.prototype, "_maxChargeableBytes", { + get: $util.oneOfGetter($oneOfFields = ["maxChargeableBytes"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Backup instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.Backup + * @static + * @param {google.cloud.sql.v1.IBackup=} [properties] Properties to set + * @returns {google.cloud.sql.v1.Backup} Backup instance + */ + Backup.create = function create(properties) { + return new Backup(properties); + }; + + /** + * Encodes the specified Backup message. Does not implicitly {@link google.cloud.sql.v1.Backup.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.Backup + * @static + * @param {google.cloud.sql.v1.IBackup} message Backup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Backup.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.selfLink); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.description); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.location); + if (message.backupInterval != null && Object.hasOwnProperty.call(message, "backupInterval")) + $root.google.type.Interval.encode(message.backupInterval, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.cloud.sql.v1.OperationError.encode(message.error, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.kmsKey != null && Object.hasOwnProperty.call(message, "kmsKey")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.kmsKey); + if (message.kmsKeyVersion != null && Object.hasOwnProperty.call(message, "kmsKeyVersion")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.kmsKeyVersion); + if (message.backupKind != null && Object.hasOwnProperty.call(message, "backupKind")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.backupKind); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.timeZone); + if (message.ttlDays != null && Object.hasOwnProperty.call(message, "ttlDays")) + writer.uint32(/* id 16, wireType 0 =*/128).int64(message.ttlDays); + if (message.expiryTime != null && Object.hasOwnProperty.call(message, "expiryTime")) + $root.google.protobuf.Timestamp.encode(message.expiryTime, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) + writer.uint32(/* id 20, wireType 0 =*/160).int32(message.databaseVersion); + if (message.maxChargeableBytes != null && Object.hasOwnProperty.call(message, "maxChargeableBytes")) + writer.uint32(/* id 23, wireType 0 =*/184).int64(message.maxChargeableBytes); + if (message.instanceDeletionTime != null && Object.hasOwnProperty.call(message, "instanceDeletionTime")) + $root.google.protobuf.Timestamp.encode(message.instanceDeletionTime, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.instanceSettings != null && Object.hasOwnProperty.call(message, "instanceSettings")) + $root.google.cloud.sql.v1.DatabaseInstance.encode(message.instanceSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.backupRun != null && Object.hasOwnProperty.call(message, "backupRun")) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.backupRun); + if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) + $root.google.protobuf.BoolValue.encode(message.satisfiesPzs, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + if (message.satisfiesPzi != null && Object.hasOwnProperty.call(message, "satisfiesPzi")) + $root.google.protobuf.BoolValue.encode(message.satisfiesPzi, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Backup message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Backup.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.Backup + * @static + * @param {google.cloud.sql.v1.IBackup} message Backup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Backup.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Backup message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.Backup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.Backup} Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Backup.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Backup(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + case 3: { + message.selfLink = reader.string(); + break; + } + case 4: { + message.type = reader.int32(); + break; + } + case 5: { + message.description = reader.string(); + break; + } + case 6: { + message.instance = reader.string(); + break; + } + case 7: { + message.location = reader.string(); + break; + } + case 8: { + message.backupInterval = $root.google.type.Interval.decode(reader, reader.uint32()); + break; + } + case 9: { + message.state = reader.int32(); + break; + } + case 10: { + message.error = $root.google.cloud.sql.v1.OperationError.decode(reader, reader.uint32()); + break; + } + case 11: { + message.kmsKey = reader.string(); + break; + } + case 12: { + message.kmsKeyVersion = reader.string(); + break; + } + case 13: { + message.backupKind = reader.int32(); + break; + } + case 15: { + message.timeZone = reader.string(); + break; + } + case 16: { + message.ttlDays = reader.int64(); + break; + } + case 17: { + message.expiryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 20: { + message.databaseVersion = reader.int32(); + break; + } + case 23: { + message.maxChargeableBytes = reader.int64(); + break; + } + case 24: { + message.instanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 25: { + message.instanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + case 26: { + message.backupRun = reader.string(); + break; + } + case 27: { + message.satisfiesPzs = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 28: { + message.satisfiesPzi = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Backup message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.Backup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.Backup} Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Backup.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Backup message. + * @function verify + * @memberof google.cloud.sql.v1.Backup + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Backup.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.backupInterval != null && message.hasOwnProperty("backupInterval")) { + var error = $root.google.type.Interval.verify(message.backupInterval); + if (error) + return "backupInterval." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.cloud.sql.v1.OperationError.verify(message.error); + if (error) + return "error." + error; + } + if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) + if (!$util.isString(message.kmsKey)) + return "kmsKey: string expected"; + if (message.kmsKeyVersion != null && message.hasOwnProperty("kmsKeyVersion")) + if (!$util.isString(message.kmsKeyVersion)) + return "kmsKeyVersion: string expected"; + if (message.backupKind != null && message.hasOwnProperty("backupKind")) + switch (message.backupKind) { + default: + return "backupKind: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.ttlDays != null && message.hasOwnProperty("ttlDays")) { + properties.expiration = 1; + if (!$util.isInteger(message.ttlDays) && !(message.ttlDays && $util.isInteger(message.ttlDays.low) && $util.isInteger(message.ttlDays.high))) + return "ttlDays: integer|Long expected"; + } + if (message.expiryTime != null && message.hasOwnProperty("expiryTime")) { + if (properties.expiration === 1) + return "expiration: multiple values"; + properties.expiration = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.expiryTime); + if (error) + return "expiryTime." + error; + } + } + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + switch (message.databaseVersion) { + default: + return "databaseVersion: enum value expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 684: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + case 549: + case 550: + case 551: + break; + } + if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { + properties._maxChargeableBytes = 1; + if (!$util.isInteger(message.maxChargeableBytes) && !(message.maxChargeableBytes && $util.isInteger(message.maxChargeableBytes.low) && $util.isInteger(message.maxChargeableBytes.high))) + return "maxChargeableBytes: integer|Long expected"; + } + if (message.instanceDeletionTime != null && message.hasOwnProperty("instanceDeletionTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.instanceDeletionTime); + if (error) + return "instanceDeletionTime." + error; + } + if (message.instanceSettings != null && message.hasOwnProperty("instanceSettings")) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.instanceSettings); + if (error) + return "instanceSettings." + error; + } + if (message.backupRun != null && message.hasOwnProperty("backupRun")) + if (!$util.isString(message.backupRun)) + return "backupRun: string expected"; + if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) { + var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzs); + if (error) + return "satisfiesPzs." + error; + } + if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) { + var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzi); + if (error) + return "satisfiesPzi." + error; + } + return null; + }; + + /** + * Creates a Backup message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.Backup + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.Backup} Backup + */ + Backup.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.Backup) + return object; + var message = new $root.google.cloud.sql.v1.Backup(); + if (object.name != null) + message.name = String(object.name); + if (object.kind != null) + message.kind = String(object.kind); + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SQL_BACKUP_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "AUTOMATED": + case 1: + message.type = 1; + break; + case "ON_DEMAND": + case 2: + message.type = 2; + break; + case "FINAL": + case 3: + message.type = 3; + break; + } + if (object.description != null) + message.description = String(object.description); + if (object.instance != null) + message.instance = String(object.instance); + if (object.location != null) + message.location = String(object.location); + if (object.backupInterval != null) { + if (typeof object.backupInterval !== "object") + throw TypeError(".google.cloud.sql.v1.Backup.backupInterval: object expected"); + message.backupInterval = $root.google.type.Interval.fromObject(object.backupInterval); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "SQL_BACKUP_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ENQUEUED": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "SUCCESSFUL": + case 4: + message.state = 4; + break; + case "DELETING": + case 5: + message.state = 5; + break; + case "DELETION_FAILED": + case 6: + message.state = 6; + break; + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.sql.v1.Backup.error: object expected"); + message.error = $root.google.cloud.sql.v1.OperationError.fromObject(object.error); + } + if (object.kmsKey != null) + message.kmsKey = String(object.kmsKey); + if (object.kmsKeyVersion != null) + message.kmsKeyVersion = String(object.kmsKeyVersion); + switch (object.backupKind) { + default: + if (typeof object.backupKind === "number") { + message.backupKind = object.backupKind; + break; + } + break; + case "SQL_BACKUP_KIND_UNSPECIFIED": + case 0: + message.backupKind = 0; + break; + case "SNAPSHOT": + case 1: + message.backupKind = 1; + break; + case "PHYSICAL": + case 2: + message.backupKind = 2; + break; + } + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.ttlDays != null) + if ($util.Long) + (message.ttlDays = $util.Long.fromValue(object.ttlDays)).unsigned = false; + else if (typeof object.ttlDays === "string") + message.ttlDays = parseInt(object.ttlDays, 10); + else if (typeof object.ttlDays === "number") + message.ttlDays = object.ttlDays; + else if (typeof object.ttlDays === "object") + message.ttlDays = new $util.LongBits(object.ttlDays.low >>> 0, object.ttlDays.high >>> 0).toNumber(); + if (object.expiryTime != null) { + if (typeof object.expiryTime !== "object") + throw TypeError(".google.cloud.sql.v1.Backup.expiryTime: object expected"); + message.expiryTime = $root.google.protobuf.Timestamp.fromObject(object.expiryTime); + } + switch (object.databaseVersion) { + default: + if (typeof object.databaseVersion === "number") { + message.databaseVersion = object.databaseVersion; + break; + } + break; + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.databaseVersion = 0; + break; + case "MYSQL_5_1": + case 2: + message.databaseVersion = 2; + break; + case "MYSQL_5_5": + case 3: + message.databaseVersion = 3; + break; + case "MYSQL_5_6": + case 5: + message.databaseVersion = 5; + break; + case "MYSQL_5_7": + case 6: + message.databaseVersion = 6; + break; + case "MYSQL_8_0": + case 20: + message.databaseVersion = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.databaseVersion = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.databaseVersion = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.databaseVersion = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.databaseVersion = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.databaseVersion = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.databaseVersion = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.databaseVersion = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.databaseVersion = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.databaseVersion = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.databaseVersion = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.databaseVersion = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.databaseVersion = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.databaseVersion = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.databaseVersion = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.databaseVersion = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.databaseVersion = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.databaseVersion = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.databaseVersion = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.databaseVersion = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.databaseVersion = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.databaseVersion = 556; + break; + case "MYSQL_8_4": + case 398: + message.databaseVersion = 398; + break; + case "MYSQL_9_7": + case 654: + message.databaseVersion = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.databaseVersion = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.databaseVersion = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.databaseVersion = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.databaseVersion = 16; + break; + case "POSTGRES_9_6": + case 9: + message.databaseVersion = 9; + break; + case "POSTGRES_10": + case 18: + message.databaseVersion = 18; + break; + case "POSTGRES_11": + case 10: + message.databaseVersion = 10; + break; + case "POSTGRES_12": + case 19: + message.databaseVersion = 19; + break; + case "POSTGRES_13": + case 23: + message.databaseVersion = 23; + break; + case "POSTGRES_14": + case 110: + message.databaseVersion = 110; + break; + case "POSTGRES_15": + case 172: + message.databaseVersion = 172; + break; + case "POSTGRES_16": + case 272: + message.databaseVersion = 272; + break; + case "POSTGRES_17": + case 408: + message.databaseVersion = 408; + break; + case "POSTGRES_18": + case 557: + message.databaseVersion = 557; + break; + case "POSTGRES_19": + case 684: + message.databaseVersion = 684; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.databaseVersion = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.databaseVersion = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.databaseVersion = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.databaseVersion = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.databaseVersion = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.databaseVersion = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.databaseVersion = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.databaseVersion = 202; + break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.databaseVersion = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.databaseVersion = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.databaseVersion = 551; + break; + } + if (object.maxChargeableBytes != null) + if ($util.Long) + (message.maxChargeableBytes = $util.Long.fromValue(object.maxChargeableBytes)).unsigned = false; + else if (typeof object.maxChargeableBytes === "string") + message.maxChargeableBytes = parseInt(object.maxChargeableBytes, 10); + else if (typeof object.maxChargeableBytes === "number") + message.maxChargeableBytes = object.maxChargeableBytes; + else if (typeof object.maxChargeableBytes === "object") + message.maxChargeableBytes = new $util.LongBits(object.maxChargeableBytes.low >>> 0, object.maxChargeableBytes.high >>> 0).toNumber(); + if (object.instanceDeletionTime != null) { + if (typeof object.instanceDeletionTime !== "object") + throw TypeError(".google.cloud.sql.v1.Backup.instanceDeletionTime: object expected"); + message.instanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.instanceDeletionTime); + } + if (object.instanceSettings != null) { + if (typeof object.instanceSettings !== "object") + throw TypeError(".google.cloud.sql.v1.Backup.instanceSettings: object expected"); + message.instanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.instanceSettings); + } + if (object.backupRun != null) + message.backupRun = String(object.backupRun); + if (object.satisfiesPzs != null) { + if (typeof object.satisfiesPzs !== "object") + throw TypeError(".google.cloud.sql.v1.Backup.satisfiesPzs: object expected"); + message.satisfiesPzs = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzs); + } + if (object.satisfiesPzi != null) { + if (typeof object.satisfiesPzi !== "object") + throw TypeError(".google.cloud.sql.v1.Backup.satisfiesPzi: object expected"); + message.satisfiesPzi = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzi); + } + return message; + }; + + /** + * Creates a plain object from a Backup message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.Backup + * @static + * @param {google.cloud.sql.v1.Backup} message Backup + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Backup.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.kind = ""; + object.selfLink = ""; + object.type = options.enums === String ? "SQL_BACKUP_TYPE_UNSPECIFIED" : 0; + object.description = ""; + object.instance = ""; + object.location = ""; + object.backupInterval = null; + object.state = options.enums === String ? "SQL_BACKUP_STATE_UNSPECIFIED" : 0; + object.error = null; + object.kmsKey = ""; + object.kmsKeyVersion = ""; + object.backupKind = options.enums === String ? "SQL_BACKUP_KIND_UNSPECIFIED" : 0; + object.timeZone = ""; + object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; + object.instanceDeletionTime = null; + object.instanceSettings = null; + object.backupRun = ""; + object.satisfiesPzs = null; + object.satisfiesPzi = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1.Backup.SqlBackupType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.Backup.SqlBackupType[message.type] : message.type; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.backupInterval != null && message.hasOwnProperty("backupInterval")) + object.backupInterval = $root.google.type.Interval.toObject(message.backupInterval, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.sql.v1.Backup.SqlBackupState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1.Backup.SqlBackupState[message.state] : message.state; + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.cloud.sql.v1.OperationError.toObject(message.error, options); + if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) + object.kmsKey = message.kmsKey; + if (message.kmsKeyVersion != null && message.hasOwnProperty("kmsKeyVersion")) + object.kmsKeyVersion = message.kmsKeyVersion; + if (message.backupKind != null && message.hasOwnProperty("backupKind")) + object.backupKind = options.enums === String ? $root.google.cloud.sql.v1.SqlBackupKind[message.backupKind] === undefined ? message.backupKind : $root.google.cloud.sql.v1.SqlBackupKind[message.backupKind] : message.backupKind; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.ttlDays != null && message.hasOwnProperty("ttlDays")) { + if (typeof message.ttlDays === "number") + object.ttlDays = options.longs === String ? String(message.ttlDays) : message.ttlDays; + else + object.ttlDays = options.longs === String ? $util.Long.prototype.toString.call(message.ttlDays) : options.longs === Number ? new $util.LongBits(message.ttlDays.low >>> 0, message.ttlDays.high >>> 0).toNumber() : message.ttlDays; + if (options.oneofs) + object.expiration = "ttlDays"; + } + if (message.expiryTime != null && message.hasOwnProperty("expiryTime")) { + object.expiryTime = $root.google.protobuf.Timestamp.toObject(message.expiryTime, options); + if (options.oneofs) + object.expiration = "expiryTime"; + } + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; + if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { + if (typeof message.maxChargeableBytes === "number") + object.maxChargeableBytes = options.longs === String ? String(message.maxChargeableBytes) : message.maxChargeableBytes; + else + object.maxChargeableBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxChargeableBytes) : options.longs === Number ? new $util.LongBits(message.maxChargeableBytes.low >>> 0, message.maxChargeableBytes.high >>> 0).toNumber() : message.maxChargeableBytes; + if (options.oneofs) + object._maxChargeableBytes = "maxChargeableBytes"; + } + if (message.instanceDeletionTime != null && message.hasOwnProperty("instanceDeletionTime")) + object.instanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.instanceDeletionTime, options); + if (message.instanceSettings != null && message.hasOwnProperty("instanceSettings")) + object.instanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.instanceSettings, options); + if (message.backupRun != null && message.hasOwnProperty("backupRun")) + object.backupRun = message.backupRun; + if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) + object.satisfiesPzs = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzs, options); + if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) + object.satisfiesPzi = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzi, options); + return object; + }; + + /** + * Converts this Backup to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.Backup + * @instance + * @returns {Object.} JSON object + */ + Backup.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Backup + * @function getTypeUrl + * @memberof google.cloud.sql.v1.Backup + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Backup.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.Backup"; + }; + + /** + * SqlBackupType enum. + * @name google.cloud.sql.v1.Backup.SqlBackupType + * @enum {number} + * @property {number} SQL_BACKUP_TYPE_UNSPECIFIED=0 SQL_BACKUP_TYPE_UNSPECIFIED value + * @property {number} AUTOMATED=1 AUTOMATED value + * @property {number} ON_DEMAND=2 ON_DEMAND value + * @property {number} FINAL=3 FINAL value + */ + Backup.SqlBackupType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKUP_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATED"] = 1; + values[valuesById[2] = "ON_DEMAND"] = 2; + values[valuesById[3] = "FINAL"] = 3; + return values; + })(); + + /** + * SqlBackupState enum. + * @name google.cloud.sql.v1.Backup.SqlBackupState + * @enum {number} + * @property {number} SQL_BACKUP_STATE_UNSPECIFIED=0 SQL_BACKUP_STATE_UNSPECIFIED value + * @property {number} ENQUEUED=1 ENQUEUED value + * @property {number} RUNNING=2 RUNNING value + * @property {number} FAILED=3 FAILED value + * @property {number} SUCCESSFUL=4 SUCCESSFUL value + * @property {number} DELETING=5 DELETING value + * @property {number} DELETION_FAILED=6 DELETION_FAILED value + */ + Backup.SqlBackupState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKUP_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENQUEUED"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "SUCCESSFUL"] = 4; + values[valuesById[5] = "DELETING"] = 5; + values[valuesById[6] = "DELETION_FAILED"] = 6; + return values; + })(); + + return Backup; + })(); + + v1.SqlInstancesService = (function() { + + /** + * Constructs a new SqlInstancesService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlInstancesService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlInstancesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlInstancesService; + + /** + * Creates new SqlInstancesService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlInstancesService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlInstancesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addServerCa}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef AddServerCaCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls AddServerCa. + * @function addServerCa + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest} request SqlInstancesAddServerCaRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.AddServerCaCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.addServerCa = function addServerCa(request, callback) { + return this.rpcCall(addServerCa, $root.google.cloud.sql.v1.SqlInstancesAddServerCaRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "AddServerCa" }); + + /** + * Calls AddServerCa. + * @function addServerCa + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest} request SqlInstancesAddServerCaRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addServerCertificate}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef AddServerCertificateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls AddServerCertificate. + * @function addServerCertificate + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest} request SqlInstancesAddServerCertificateRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.AddServerCertificateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.addServerCertificate = function addServerCertificate(request, callback) { + return this.rpcCall(addServerCertificate, $root.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "AddServerCertificate" }); + + /** + * Calls AddServerCertificate. + * @function addServerCertificate + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest} request SqlInstancesAddServerCertificateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addEntraIdCertificate}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef AddEntraIdCertificateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls AddEntraIdCertificate. + * @function addEntraIdCertificate + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest} request SqlInstancesAddEntraIdCertificateRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.AddEntraIdCertificateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.addEntraIdCertificate = function addEntraIdCertificate(request, callback) { + return this.rpcCall(addEntraIdCertificate, $root.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "AddEntraIdCertificate" }); + + /** + * Calls AddEntraIdCertificate. + * @function addEntraIdCertificate + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest} request SqlInstancesAddEntraIdCertificateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|clone}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef CloneCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Clone. + * @function clone + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest} request SqlInstancesCloneRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.CloneCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.clone = function clone(request, callback) { + return this.rpcCall(clone, $root.google.cloud.sql.v1.SqlInstancesCloneRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Clone" }); + + /** + * Calls Clone. + * @function clone + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest} request SqlInstancesCloneRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|delete_}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef DeleteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest} request SqlInstancesDeleteRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype["delete"] = function delete_(request, callback) { + return this.rpcCall(delete_, $root.google.cloud.sql.v1.SqlInstancesDeleteRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Delete" }); + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest} request SqlInstancesDeleteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|demoteMaster}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef DemoteMasterCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls DemoteMaster. + * @function demoteMaster + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest} request SqlInstancesDemoteMasterRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.DemoteMasterCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.demoteMaster = function demoteMaster(request, callback) { + return this.rpcCall(demoteMaster, $root.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "DemoteMaster" }); + + /** + * Calls DemoteMaster. + * @function demoteMaster + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest} request SqlInstancesDemoteMasterRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|demote}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef DemoteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Demote. + * @function demote + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest} request SqlInstancesDemoteRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.DemoteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.demote = function demote(request, callback) { + return this.rpcCall(demote, $root.google.cloud.sql.v1.SqlInstancesDemoteRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Demote" }); + + /** + * Calls Demote. + * @function demote + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest} request SqlInstancesDemoteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|export_}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ExportCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Export. + * @function export + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesExportRequest} request SqlInstancesExportRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ExportCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype["export"] = function export_(request, callback) { + return this.rpcCall(export_, $root.google.cloud.sql.v1.SqlInstancesExportRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Export" }); + + /** + * Calls Export. + * @function export + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesExportRequest} request SqlInstancesExportRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|failover}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef FailoverCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Failover. + * @function failover + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest} request SqlInstancesFailoverRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.FailoverCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.failover = function failover(request, callback) { + return this.rpcCall(failover, $root.google.cloud.sql.v1.SqlInstancesFailoverRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Failover" }); + + /** + * Calls Failover. + * @function failover + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest} request SqlInstancesFailoverRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|reencrypt}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ReencryptCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Reencrypt. + * @function reencrypt + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest} request SqlInstancesReencryptRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ReencryptCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.reencrypt = function reencrypt(request, callback) { + return this.rpcCall(reencrypt, $root.google.cloud.sql.v1.SqlInstancesReencryptRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Reencrypt" }); + + /** + * Calls Reencrypt. + * @function reencrypt + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest} request SqlInstancesReencryptRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|get}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.DatabaseInstance} [response] DatabaseInstance + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesGetRequest} request SqlInstancesGetRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.GetCallback} callback Node-style callback called with the error, if any, and DatabaseInstance + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1.SqlInstancesGetRequest, $root.google.cloud.sql.v1.DatabaseInstance, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesGetRequest} request SqlInstancesGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|import_}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ImportCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Import. + * @function import + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesImportRequest} request SqlInstancesImportRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ImportCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype["import"] = function import_(request, callback) { + return this.rpcCall(import_, $root.google.cloud.sql.v1.SqlInstancesImportRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Import" }); + + /** + * Calls Import. + * @function import + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesImportRequest} request SqlInstancesImportRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|insert}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef InsertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest} request SqlInstancesInsertRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.InsertCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.insert = function insert(request, callback) { + return this.rpcCall(insert, $root.google.cloud.sql.v1.SqlInstancesInsertRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Insert" }); + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest} request SqlInstancesInsertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|list}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.InstancesListResponse} [response] InstancesListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesListRequest} request SqlInstancesListRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ListCallback} callback Node-style callback called with the error, if any, and InstancesListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1.SqlInstancesListRequest, $root.google.cloud.sql.v1.InstancesListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesListRequest} request SqlInstancesListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listServerCas}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ListServerCasCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.InstancesListServerCasResponse} [response] InstancesListServerCasResponse + */ + + /** + * Calls ListServerCas. + * @function listServerCas + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest} request SqlInstancesListServerCasRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ListServerCasCallback} callback Node-style callback called with the error, if any, and InstancesListServerCasResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.listServerCas = function listServerCas(request, callback) { + return this.rpcCall(listServerCas, $root.google.cloud.sql.v1.SqlInstancesListServerCasRequest, $root.google.cloud.sql.v1.InstancesListServerCasResponse, request, callback); + }, "name", { value: "ListServerCas" }); + + /** + * Calls ListServerCas. + * @function listServerCas + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest} request SqlInstancesListServerCasRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listServerCertificates}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ListServerCertificatesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.InstancesListServerCertificatesResponse} [response] InstancesListServerCertificatesResponse + */ + + /** + * Calls ListServerCertificates. + * @function listServerCertificates + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest} request SqlInstancesListServerCertificatesRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ListServerCertificatesCallback} callback Node-style callback called with the error, if any, and InstancesListServerCertificatesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.listServerCertificates = function listServerCertificates(request, callback) { + return this.rpcCall(listServerCertificates, $root.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest, $root.google.cloud.sql.v1.InstancesListServerCertificatesResponse, request, callback); + }, "name", { value: "ListServerCertificates" }); + + /** + * Calls ListServerCertificates. + * @function listServerCertificates + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest} request SqlInstancesListServerCertificatesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listEntraIdCertificates}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ListEntraIdCertificatesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} [response] InstancesListEntraIdCertificatesResponse + */ + + /** + * Calls ListEntraIdCertificates. + * @function listEntraIdCertificates + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest} request SqlInstancesListEntraIdCertificatesRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ListEntraIdCertificatesCallback} callback Node-style callback called with the error, if any, and InstancesListEntraIdCertificatesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.listEntraIdCertificates = function listEntraIdCertificates(request, callback) { + return this.rpcCall(listEntraIdCertificates, $root.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest, $root.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse, request, callback); + }, "name", { value: "ListEntraIdCertificates" }); + + /** + * Calls ListEntraIdCertificates. + * @function listEntraIdCertificates + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest} request SqlInstancesListEntraIdCertificatesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|patch}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef PatchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Patch. + * @function patch + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest} request SqlInstancesPatchRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.PatchCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.patch = function patch(request, callback) { + return this.rpcCall(patch, $root.google.cloud.sql.v1.SqlInstancesPatchRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Patch" }); + + /** + * Calls Patch. + * @function patch + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest} request SqlInstancesPatchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|promoteReplica}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef PromoteReplicaCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls PromoteReplica. + * @function promoteReplica + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest} request SqlInstancesPromoteReplicaRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.PromoteReplicaCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.promoteReplica = function promoteReplica(request, callback) { + return this.rpcCall(promoteReplica, $root.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "PromoteReplica" }); + + /** + * Calls PromoteReplica. + * @function promoteReplica + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest} request SqlInstancesPromoteReplicaRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|switchover}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef SwitchoverCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Switchover. + * @function switchover + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest} request SqlInstancesSwitchoverRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.SwitchoverCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.switchover = function switchover(request, callback) { + return this.rpcCall(switchover, $root.google.cloud.sql.v1.SqlInstancesSwitchoverRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Switchover" }); + + /** + * Calls Switchover. + * @function switchover + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest} request SqlInstancesSwitchoverRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|resetSslConfig}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ResetSslConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls ResetSslConfig. + * @function resetSslConfig + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest} request SqlInstancesResetSslConfigRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ResetSslConfigCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.resetSslConfig = function resetSslConfig(request, callback) { + return this.rpcCall(resetSslConfig, $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "ResetSslConfig" }); + + /** + * Calls ResetSslConfig. + * @function resetSslConfig + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest} request SqlInstancesResetSslConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|restart}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef RestartCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Restart. + * @function restart + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest} request SqlInstancesRestartRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.RestartCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.restart = function restart(request, callback) { + return this.rpcCall(restart, $root.google.cloud.sql.v1.SqlInstancesRestartRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Restart" }); + + /** + * Calls Restart. + * @function restart + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest} request SqlInstancesRestartRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|restoreBackup}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef RestoreBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls RestoreBackup. + * @function restoreBackup + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest} request SqlInstancesRestoreBackupRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.RestoreBackupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.restoreBackup = function restoreBackup(request, callback) { + return this.rpcCall(restoreBackup, $root.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "RestoreBackup" }); + + /** + * Calls RestoreBackup. + * @function restoreBackup + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest} request SqlInstancesRestoreBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateServerCa}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef RotateServerCaCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls RotateServerCa. + * @function rotateServerCa + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest} request SqlInstancesRotateServerCaRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.RotateServerCaCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.rotateServerCa = function rotateServerCa(request, callback) { + return this.rpcCall(rotateServerCa, $root.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "RotateServerCa" }); + + /** + * Calls RotateServerCa. + * @function rotateServerCa + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest} request SqlInstancesRotateServerCaRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateServerCertificate}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef RotateServerCertificateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls RotateServerCertificate. + * @function rotateServerCertificate + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest} request SqlInstancesRotateServerCertificateRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.RotateServerCertificateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.rotateServerCertificate = function rotateServerCertificate(request, callback) { + return this.rpcCall(rotateServerCertificate, $root.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "RotateServerCertificate" }); + + /** + * Calls RotateServerCertificate. + * @function rotateServerCertificate + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest} request SqlInstancesRotateServerCertificateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateEntraIdCertificate}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef RotateEntraIdCertificateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls RotateEntraIdCertificate. + * @function rotateEntraIdCertificate + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest} request SqlInstancesRotateEntraIdCertificateRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.RotateEntraIdCertificateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.rotateEntraIdCertificate = function rotateEntraIdCertificate(request, callback) { + return this.rpcCall(rotateEntraIdCertificate, $root.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "RotateEntraIdCertificate" }); + + /** + * Calls RotateEntraIdCertificate. + * @function rotateEntraIdCertificate + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest} request SqlInstancesRotateEntraIdCertificateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|startReplica}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef StartReplicaCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls StartReplica. + * @function startReplica + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest} request SqlInstancesStartReplicaRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.StartReplicaCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.startReplica = function startReplica(request, callback) { + return this.rpcCall(startReplica, $root.google.cloud.sql.v1.SqlInstancesStartReplicaRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "StartReplica" }); + + /** + * Calls StartReplica. + * @function startReplica + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest} request SqlInstancesStartReplicaRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|stopReplica}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef StopReplicaCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls StopReplica. + * @function stopReplica + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest} request SqlInstancesStopReplicaRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.StopReplicaCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.stopReplica = function stopReplica(request, callback) { + return this.rpcCall(stopReplica, $root.google.cloud.sql.v1.SqlInstancesStopReplicaRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "StopReplica" }); + + /** + * Calls StopReplica. + * @function stopReplica + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest} request SqlInstancesStopReplicaRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|truncateLog}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef TruncateLogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls TruncateLog. + * @function truncateLog + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest} request SqlInstancesTruncateLogRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.TruncateLogCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.truncateLog = function truncateLog(request, callback) { + return this.rpcCall(truncateLog, $root.google.cloud.sql.v1.SqlInstancesTruncateLogRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "TruncateLog" }); + + /** + * Calls TruncateLog. + * @function truncateLog + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest} request SqlInstancesTruncateLogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|update}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef UpdateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest} request SqlInstancesUpdateRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.update = function update(request, callback) { + return this.rpcCall(update, $root.google.cloud.sql.v1.SqlInstancesUpdateRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Update" }); + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest} request SqlInstancesUpdateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|createEphemeral}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef CreateEphemeralCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.SslCert} [response] SslCert + */ + + /** + * Calls CreateEphemeral. + * @function createEphemeral + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest} request SqlInstancesCreateEphemeralCertRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.CreateEphemeralCallback} callback Node-style callback called with the error, if any, and SslCert + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.createEphemeral = function createEphemeral(request, callback) { + return this.rpcCall(createEphemeral, $root.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest, $root.google.cloud.sql.v1.SslCert, request, callback); + }, "name", { value: "CreateEphemeral" }); + + /** + * Calls CreateEphemeral. + * @function createEphemeral + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest} request SqlInstancesCreateEphemeralCertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rescheduleMaintenance}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef RescheduleMaintenanceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls RescheduleMaintenance. + * @function rescheduleMaintenance + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest} request SqlInstancesRescheduleMaintenanceRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.RescheduleMaintenanceCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.rescheduleMaintenance = function rescheduleMaintenance(request, callback) { + return this.rpcCall(rescheduleMaintenance, $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "RescheduleMaintenance" }); + + /** + * Calls RescheduleMaintenance. + * @function rescheduleMaintenance + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest} request SqlInstancesRescheduleMaintenanceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|verifyExternalSyncSettings}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef VerifyExternalSyncSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} [response] SqlInstancesVerifyExternalSyncSettingsResponse + */ + + /** + * Calls VerifyExternalSyncSettings. + * @function verifyExternalSyncSettings + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest} request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.VerifyExternalSyncSettingsCallback} callback Node-style callback called with the error, if any, and SqlInstancesVerifyExternalSyncSettingsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.verifyExternalSyncSettings = function verifyExternalSyncSettings(request, callback) { + return this.rpcCall(verifyExternalSyncSettings, $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest, $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse, request, callback); + }, "name", { value: "VerifyExternalSyncSettings" }); + + /** + * Calls VerifyExternalSyncSettings. + * @function verifyExternalSyncSettings + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest} request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|startExternalSync}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef StartExternalSyncCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls StartExternalSync. + * @function startExternalSync + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest} request SqlInstancesStartExternalSyncRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.StartExternalSyncCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.startExternalSync = function startExternalSync(request, callback) { + return this.rpcCall(startExternalSync, $root.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "StartExternalSync" }); + + /** + * Calls StartExternalSync. + * @function startExternalSync + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest} request SqlInstancesStartExternalSyncRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|performDiskShrink}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef PerformDiskShrinkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls PerformDiskShrink. + * @function performDiskShrink + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest} request SqlInstancesPerformDiskShrinkRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.PerformDiskShrinkCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.performDiskShrink = function performDiskShrink(request, callback) { + return this.rpcCall(performDiskShrink, $root.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "PerformDiskShrink" }); + + /** + * Calls PerformDiskShrink. + * @function performDiskShrink + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest} request SqlInstancesPerformDiskShrinkRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|getDiskShrinkConfig}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef GetDiskShrinkConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} [response] SqlInstancesGetDiskShrinkConfigResponse + */ + + /** + * Calls GetDiskShrinkConfig. + * @function getDiskShrinkConfig + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest} request SqlInstancesGetDiskShrinkConfigRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.GetDiskShrinkConfigCallback} callback Node-style callback called with the error, if any, and SqlInstancesGetDiskShrinkConfigResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.getDiskShrinkConfig = function getDiskShrinkConfig(request, callback) { + return this.rpcCall(getDiskShrinkConfig, $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest, $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse, request, callback); + }, "name", { value: "GetDiskShrinkConfig" }); + + /** + * Calls GetDiskShrinkConfig. + * @function getDiskShrinkConfig + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest} request SqlInstancesGetDiskShrinkConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|resetReplicaSize}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ResetReplicaSizeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls ResetReplicaSize. + * @function resetReplicaSize + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest} request SqlInstancesResetReplicaSizeRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ResetReplicaSizeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.resetReplicaSize = function resetReplicaSize(request, callback) { + return this.rpcCall(resetReplicaSize, $root.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "ResetReplicaSize" }); + + /** + * Calls ResetReplicaSize. + * @function resetReplicaSize + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest} request SqlInstancesResetReplicaSizeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|getLatestRecoveryTime}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef GetLatestRecoveryTimeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} [response] SqlInstancesGetLatestRecoveryTimeResponse + */ + + /** + * Calls GetLatestRecoveryTime. + * @function getLatestRecoveryTime + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest} request SqlInstancesGetLatestRecoveryTimeRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.GetLatestRecoveryTimeCallback} callback Node-style callback called with the error, if any, and SqlInstancesGetLatestRecoveryTimeResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.getLatestRecoveryTime = function getLatestRecoveryTime(request, callback) { + return this.rpcCall(getLatestRecoveryTime, $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest, $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse, request, callback); + }, "name", { value: "GetLatestRecoveryTime" }); + + /** + * Calls GetLatestRecoveryTime. + * @function getLatestRecoveryTime + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest} request SqlInstancesGetLatestRecoveryTimeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|executeSql}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ExecuteSqlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} [response] SqlInstancesExecuteSqlResponse + */ + + /** + * Calls ExecuteSql. + * @function executeSql + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest} request SqlInstancesExecuteSqlRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ExecuteSqlCallback} callback Node-style callback called with the error, if any, and SqlInstancesExecuteSqlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.executeSql = function executeSql(request, callback) { + return this.rpcCall(executeSql, $root.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest, $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse, request, callback); + }, "name", { value: "ExecuteSql" }); + + /** + * Calls ExecuteSql. + * @function executeSql + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest} request SqlInstancesExecuteSqlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|acquireSsrsLease}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef AcquireSsrsLeaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} [response] SqlInstancesAcquireSsrsLeaseResponse + */ + + /** + * Calls AcquireSsrsLease. + * @function acquireSsrsLease + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest} request SqlInstancesAcquireSsrsLeaseRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.AcquireSsrsLeaseCallback} callback Node-style callback called with the error, if any, and SqlInstancesAcquireSsrsLeaseResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.acquireSsrsLease = function acquireSsrsLease(request, callback) { + return this.rpcCall(acquireSsrsLease, $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest, $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse, request, callback); + }, "name", { value: "AcquireSsrsLease" }); + + /** + * Calls AcquireSsrsLease. + * @function acquireSsrsLease + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest} request SqlInstancesAcquireSsrsLeaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|releaseSsrsLease}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef ReleaseSsrsLeaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} [response] SqlInstancesReleaseSsrsLeaseResponse + */ + + /** + * Calls ReleaseSsrsLease. + * @function releaseSsrsLease + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest} request SqlInstancesReleaseSsrsLeaseRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.ReleaseSsrsLeaseCallback} callback Node-style callback called with the error, if any, and SqlInstancesReleaseSsrsLeaseResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.releaseSsrsLease = function releaseSsrsLease(request, callback) { + return this.rpcCall(releaseSsrsLease, $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest, $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse, request, callback); + }, "name", { value: "ReleaseSsrsLease" }); + + /** + * Calls ReleaseSsrsLease. + * @function releaseSsrsLease + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest} request SqlInstancesReleaseSsrsLeaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|preCheckMajorVersionUpgrade}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef PreCheckMajorVersionUpgradeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls PreCheckMajorVersionUpgrade. + * @function preCheckMajorVersionUpgrade + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest} request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.PreCheckMajorVersionUpgradeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.preCheckMajorVersionUpgrade = function preCheckMajorVersionUpgrade(request, callback) { + return this.rpcCall(preCheckMajorVersionUpgrade, $root.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "PreCheckMajorVersionUpgrade" }); + + /** + * Calls PreCheckMajorVersionUpgrade. + * @function preCheckMajorVersionUpgrade + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest} request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|pointInTimeRestore}. + * @memberof google.cloud.sql.v1.SqlInstancesService + * @typedef PointInTimeRestoreCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls PointInTimeRestore. + * @function pointInTimeRestore + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest} request SqlInstancesPointInTimeRestoreRequest message or plain object + * @param {google.cloud.sql.v1.SqlInstancesService.PointInTimeRestoreCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.pointInTimeRestore = function pointInTimeRestore(request, callback) { + return this.rpcCall(pointInTimeRestore, $root.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "PointInTimeRestore" }); + + /** + * Calls PointInTimeRestore. + * @function pointInTimeRestore + * @memberof google.cloud.sql.v1.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest} request SqlInstancesPointInTimeRestoreRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlInstancesService; + })(); + + v1.SqlInstancesAddServerCaRequest = (function() { + + /** + * Properties of a SqlInstancesAddServerCaRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesAddServerCaRequest + * @property {string|null} [instance] SqlInstancesAddServerCaRequest instance + * @property {string|null} [project] SqlInstancesAddServerCaRequest project + */ + + /** + * Constructs a new SqlInstancesAddServerCaRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesAddServerCaRequest. + * @implements ISqlInstancesAddServerCaRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest=} [properties] Properties to set + */ + function SqlInstancesAddServerCaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesAddServerCaRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @instance + */ + SqlInstancesAddServerCaRequest.prototype.instance = ""; + + /** + * SqlInstancesAddServerCaRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @instance + */ + SqlInstancesAddServerCaRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesAddServerCaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest instance + */ + SqlInstancesAddServerCaRequest.create = function create(properties) { + return new SqlInstancesAddServerCaRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesAddServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddServerCaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesAddServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddServerCaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddServerCaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesAddServerCaRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesAddServerCaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesAddServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest + */ + SqlInstancesAddServerCaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesAddServerCaRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesAddServerCaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesAddServerCaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesAddServerCaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesAddServerCaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesAddServerCaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesAddServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesAddServerCaRequest"; + }; + + return SqlInstancesAddServerCaRequest; + })(); + + v1.SqlInstancesAddServerCertificateRequest = (function() { + + /** + * Properties of a SqlInstancesAddServerCertificateRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesAddServerCertificateRequest + * @property {string|null} [instance] SqlInstancesAddServerCertificateRequest instance + * @property {string|null} [project] SqlInstancesAddServerCertificateRequest project + */ + + /** + * Constructs a new SqlInstancesAddServerCertificateRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesAddServerCertificateRequest. + * @implements ISqlInstancesAddServerCertificateRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest=} [properties] Properties to set + */ + function SqlInstancesAddServerCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesAddServerCertificateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @instance + */ + SqlInstancesAddServerCertificateRequest.prototype.instance = ""; + + /** + * SqlInstancesAddServerCertificateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @instance + */ + SqlInstancesAddServerCertificateRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesAddServerCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest instance + */ + SqlInstancesAddServerCertificateRequest.create = function create(properties) { + return new SqlInstancesAddServerCertificateRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesAddServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddServerCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesAddServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddServerCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesAddServerCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesAddServerCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesAddServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest + */ + SqlInstancesAddServerCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesAddServerCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesAddServerCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesAddServerCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesAddServerCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesAddServerCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesAddServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest"; + }; + + return SqlInstancesAddServerCertificateRequest; + })(); + + v1.SqlInstancesAddEntraIdCertificateRequest = (function() { + + /** + * Properties of a SqlInstancesAddEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesAddEntraIdCertificateRequest + * @property {string|null} [instance] SqlInstancesAddEntraIdCertificateRequest instance + * @property {string|null} [project] SqlInstancesAddEntraIdCertificateRequest project + */ + + /** + * Constructs a new SqlInstancesAddEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesAddEntraIdCertificateRequest. + * @implements ISqlInstancesAddEntraIdCertificateRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest=} [properties] Properties to set + */ + function SqlInstancesAddEntraIdCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesAddEntraIdCertificateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @instance + */ + SqlInstancesAddEntraIdCertificateRequest.prototype.instance = ""; + + /** + * SqlInstancesAddEntraIdCertificateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @instance + */ + SqlInstancesAddEntraIdCertificateRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesAddEntraIdCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest instance + */ + SqlInstancesAddEntraIdCertificateRequest.create = function create(properties) { + return new SqlInstancesAddEntraIdCertificateRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddEntraIdCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddEntraIdCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesAddEntraIdCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesAddEntraIdCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesAddEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest + */ + SqlInstancesAddEntraIdCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesAddEntraIdCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesAddEntraIdCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesAddEntraIdCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesAddEntraIdCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesAddEntraIdCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesAddEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest"; + }; + + return SqlInstancesAddEntraIdCertificateRequest; + })(); + + v1.SqlInstancesCloneRequest = (function() { + + /** + * Properties of a SqlInstancesCloneRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesCloneRequest + * @property {string|null} [instance] SqlInstancesCloneRequest instance + * @property {string|null} [project] SqlInstancesCloneRequest project + * @property {google.cloud.sql.v1.IInstancesCloneRequest|null} [body] SqlInstancesCloneRequest body + */ + + /** + * Constructs a new SqlInstancesCloneRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesCloneRequest. + * @implements ISqlInstancesCloneRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest=} [properties] Properties to set + */ + function SqlInstancesCloneRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesCloneRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @instance + */ + SqlInstancesCloneRequest.prototype.instance = ""; + + /** + * SqlInstancesCloneRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @instance + */ + SqlInstancesCloneRequest.prototype.project = ""; + + /** + * SqlInstancesCloneRequest body. + * @member {google.cloud.sql.v1.IInstancesCloneRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @instance + */ + SqlInstancesCloneRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesCloneRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesCloneRequest} SqlInstancesCloneRequest instance + */ + SqlInstancesCloneRequest.create = function create(properties) { + return new SqlInstancesCloneRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCloneRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest} message SqlInstancesCloneRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesCloneRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesCloneRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCloneRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest} message SqlInstancesCloneRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesCloneRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesCloneRequest} SqlInstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesCloneRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesCloneRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesCloneRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesCloneRequest} SqlInstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesCloneRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesCloneRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesCloneRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesCloneRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesCloneRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesCloneRequest} SqlInstancesCloneRequest + */ + SqlInstancesCloneRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesCloneRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesCloneRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesCloneRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesCloneRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesCloneRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesCloneRequest} message SqlInstancesCloneRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesCloneRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesCloneRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesCloneRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesCloneRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesCloneRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesCloneRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesCloneRequest"; + }; + + return SqlInstancesCloneRequest; + })(); + + v1.SqlInstancesDeleteRequest = (function() { + + /** + * Properties of a SqlInstancesDeleteRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesDeleteRequest + * @property {string|null} [instance] SqlInstancesDeleteRequest instance + * @property {string|null} [project] SqlInstancesDeleteRequest project + * @property {boolean|null} [enableFinalBackup] SqlInstancesDeleteRequest enableFinalBackup + * @property {number|Long|null} [finalBackupTtlDays] SqlInstancesDeleteRequest finalBackupTtlDays + * @property {google.protobuf.ITimestamp|null} [finalBackupExpiryTime] SqlInstancesDeleteRequest finalBackupExpiryTime + * @property {string|null} [finalBackupDescription] SqlInstancesDeleteRequest finalBackupDescription + */ + + /** + * Constructs a new SqlInstancesDeleteRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesDeleteRequest. + * @implements ISqlInstancesDeleteRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest=} [properties] Properties to set + */ + function SqlInstancesDeleteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesDeleteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.instance = ""; + + /** + * SqlInstancesDeleteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.project = ""; + + /** + * SqlInstancesDeleteRequest enableFinalBackup. + * @member {boolean|null|undefined} enableFinalBackup + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.enableFinalBackup = null; + + /** + * SqlInstancesDeleteRequest finalBackupTtlDays. + * @member {number|Long|null|undefined} finalBackupTtlDays + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.finalBackupTtlDays = null; + + /** + * SqlInstancesDeleteRequest finalBackupExpiryTime. + * @member {google.protobuf.ITimestamp|null|undefined} finalBackupExpiryTime + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.finalBackupExpiryTime = null; + + /** + * SqlInstancesDeleteRequest finalBackupDescription. + * @member {string} finalBackupDescription + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.finalBackupDescription = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlInstancesDeleteRequest.prototype, "_enableFinalBackup", { + get: $util.oneOfGetter($oneOfFields = ["enableFinalBackup"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * SqlInstancesDeleteRequest expiration. + * @member {"finalBackupTtlDays"|"finalBackupExpiryTime"|undefined} expiration + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @instance + */ + Object.defineProperty(SqlInstancesDeleteRequest.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["finalBackupTtlDays", "finalBackupExpiryTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlInstancesDeleteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest instance + */ + SqlInstancesDeleteRequest.create = function create(properties) { + return new SqlInstancesDeleteRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDeleteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest} message SqlInstancesDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDeleteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.finalBackupTtlDays != null && Object.hasOwnProperty.call(message, "finalBackupTtlDays")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.finalBackupTtlDays); + if (message.finalBackupDescription != null && Object.hasOwnProperty.call(message, "finalBackupDescription")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.finalBackupDescription); + if (message.finalBackupExpiryTime != null && Object.hasOwnProperty.call(message, "finalBackupExpiryTime")) + $root.google.protobuf.Timestamp.encode(message.finalBackupExpiryTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.enableFinalBackup != null && Object.hasOwnProperty.call(message, "enableFinalBackup")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.enableFinalBackup); + return writer; + }; + + /** + * Encodes the specified SqlInstancesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDeleteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest} message SqlInstancesDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDeleteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesDeleteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 7: { + message.enableFinalBackup = reader.bool(); + break; + } + case 4: { + message.finalBackupTtlDays = reader.int64(); + break; + } + case 6: { + message.finalBackupExpiryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.finalBackupDescription = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDeleteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesDeleteRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesDeleteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.enableFinalBackup != null && message.hasOwnProperty("enableFinalBackup")) { + properties._enableFinalBackup = 1; + if (typeof message.enableFinalBackup !== "boolean") + return "enableFinalBackup: boolean expected"; + } + if (message.finalBackupTtlDays != null && message.hasOwnProperty("finalBackupTtlDays")) { + properties.expiration = 1; + if (!$util.isInteger(message.finalBackupTtlDays) && !(message.finalBackupTtlDays && $util.isInteger(message.finalBackupTtlDays.low) && $util.isInteger(message.finalBackupTtlDays.high))) + return "finalBackupTtlDays: integer|Long expected"; + } + if (message.finalBackupExpiryTime != null && message.hasOwnProperty("finalBackupExpiryTime")) { + if (properties.expiration === 1) + return "expiration: multiple values"; + properties.expiration = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.finalBackupExpiryTime); + if (error) + return "finalBackupExpiryTime." + error; + } + } + if (message.finalBackupDescription != null && message.hasOwnProperty("finalBackupDescription")) + if (!$util.isString(message.finalBackupDescription)) + return "finalBackupDescription: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest + */ + SqlInstancesDeleteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesDeleteRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesDeleteRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.enableFinalBackup != null) + message.enableFinalBackup = Boolean(object.enableFinalBackup); + if (object.finalBackupTtlDays != null) + if ($util.Long) + (message.finalBackupTtlDays = $util.Long.fromValue(object.finalBackupTtlDays)).unsigned = false; + else if (typeof object.finalBackupTtlDays === "string") + message.finalBackupTtlDays = parseInt(object.finalBackupTtlDays, 10); + else if (typeof object.finalBackupTtlDays === "number") + message.finalBackupTtlDays = object.finalBackupTtlDays; + else if (typeof object.finalBackupTtlDays === "object") + message.finalBackupTtlDays = new $util.LongBits(object.finalBackupTtlDays.low >>> 0, object.finalBackupTtlDays.high >>> 0).toNumber(); + if (object.finalBackupExpiryTime != null) { + if (typeof object.finalBackupExpiryTime !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesDeleteRequest.finalBackupExpiryTime: object expected"); + message.finalBackupExpiryTime = $root.google.protobuf.Timestamp.fromObject(object.finalBackupExpiryTime); + } + if (object.finalBackupDescription != null) + message.finalBackupDescription = String(object.finalBackupDescription); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesDeleteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesDeleteRequest} message SqlInstancesDeleteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesDeleteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.finalBackupDescription = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.finalBackupTtlDays != null && message.hasOwnProperty("finalBackupTtlDays")) { + if (typeof message.finalBackupTtlDays === "number") + object.finalBackupTtlDays = options.longs === String ? String(message.finalBackupTtlDays) : message.finalBackupTtlDays; + else + object.finalBackupTtlDays = options.longs === String ? $util.Long.prototype.toString.call(message.finalBackupTtlDays) : options.longs === Number ? new $util.LongBits(message.finalBackupTtlDays.low >>> 0, message.finalBackupTtlDays.high >>> 0).toNumber() : message.finalBackupTtlDays; + if (options.oneofs) + object.expiration = "finalBackupTtlDays"; + } + if (message.finalBackupDescription != null && message.hasOwnProperty("finalBackupDescription")) + object.finalBackupDescription = message.finalBackupDescription; + if (message.finalBackupExpiryTime != null && message.hasOwnProperty("finalBackupExpiryTime")) { + object.finalBackupExpiryTime = $root.google.protobuf.Timestamp.toObject(message.finalBackupExpiryTime, options); + if (options.oneofs) + object.expiration = "finalBackupExpiryTime"; + } + if (message.enableFinalBackup != null && message.hasOwnProperty("enableFinalBackup")) { + object.enableFinalBackup = message.enableFinalBackup; + if (options.oneofs) + object._enableFinalBackup = "enableFinalBackup"; + } + return object; + }; + + /** + * Converts this SqlInstancesDeleteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesDeleteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesDeleteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesDeleteRequest"; + }; + + return SqlInstancesDeleteRequest; + })(); + + v1.SqlInstancesDemoteMasterRequest = (function() { + + /** + * Properties of a SqlInstancesDemoteMasterRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesDemoteMasterRequest + * @property {string|null} [instance] SqlInstancesDemoteMasterRequest instance + * @property {string|null} [project] SqlInstancesDemoteMasterRequest project + * @property {google.cloud.sql.v1.IInstancesDemoteMasterRequest|null} [body] SqlInstancesDemoteMasterRequest body + */ + + /** + * Constructs a new SqlInstancesDemoteMasterRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesDemoteMasterRequest. + * @implements ISqlInstancesDemoteMasterRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest=} [properties] Properties to set + */ + function SqlInstancesDemoteMasterRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesDemoteMasterRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @instance + */ + SqlInstancesDemoteMasterRequest.prototype.instance = ""; + + /** + * SqlInstancesDemoteMasterRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @instance + */ + SqlInstancesDemoteMasterRequest.prototype.project = ""; + + /** + * SqlInstancesDemoteMasterRequest body. + * @member {google.cloud.sql.v1.IInstancesDemoteMasterRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @instance + */ + SqlInstancesDemoteMasterRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesDemoteMasterRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest instance + */ + SqlInstancesDemoteMasterRequest.create = function create(properties) { + return new SqlInstancesDemoteMasterRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteMasterRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDemoteMasterRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesDemoteMasterRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteMasterRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDemoteMasterRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDemoteMasterRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesDemoteMasterRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDemoteMasterRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesDemoteMasterRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesDemoteMasterRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesDemoteMasterRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest + */ + SqlInstancesDemoteMasterRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesDemoteMasterRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesDemoteMasterRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesDemoteMasterRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesDemoteMasterRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesDemoteMasterRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesDemoteMasterRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesDemoteMasterRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesDemoteMasterRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesDemoteMasterRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesDemoteMasterRequest"; + }; + + return SqlInstancesDemoteMasterRequest; + })(); + + v1.SqlInstancesDemoteRequest = (function() { + + /** + * Properties of a SqlInstancesDemoteRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesDemoteRequest + * @property {string|null} [instance] SqlInstancesDemoteRequest instance + * @property {string|null} [project] SqlInstancesDemoteRequest project + * @property {google.cloud.sql.v1.IInstancesDemoteRequest|null} [body] SqlInstancesDemoteRequest body + */ + + /** + * Constructs a new SqlInstancesDemoteRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesDemoteRequest. + * @implements ISqlInstancesDemoteRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest=} [properties] Properties to set + */ + function SqlInstancesDemoteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesDemoteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @instance + */ + SqlInstancesDemoteRequest.prototype.instance = ""; + + /** + * SqlInstancesDemoteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @instance + */ + SqlInstancesDemoteRequest.prototype.project = ""; + + /** + * SqlInstancesDemoteRequest body. + * @member {google.cloud.sql.v1.IInstancesDemoteRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @instance + */ + SqlInstancesDemoteRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesDemoteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest instance + */ + SqlInstancesDemoteRequest.create = function create(properties) { + return new SqlInstancesDemoteRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest} message SqlInstancesDemoteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDemoteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesDemoteRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest} message SqlInstancesDemoteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDemoteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDemoteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesDemoteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesDemoteRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDemoteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesDemoteRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesDemoteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesDemoteRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest + */ + SqlInstancesDemoteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesDemoteRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesDemoteRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesDemoteRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesDemoteRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesDemoteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesDemoteRequest} message SqlInstancesDemoteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesDemoteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesDemoteRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesDemoteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesDemoteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesDemoteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesDemoteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesDemoteRequest"; + }; + + return SqlInstancesDemoteRequest; + })(); + + v1.SqlInstancesExportRequest = (function() { + + /** + * Properties of a SqlInstancesExportRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesExportRequest + * @property {string|null} [instance] SqlInstancesExportRequest instance + * @property {string|null} [project] SqlInstancesExportRequest project + * @property {google.cloud.sql.v1.IInstancesExportRequest|null} [body] SqlInstancesExportRequest body + */ + + /** + * Constructs a new SqlInstancesExportRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesExportRequest. + * @implements ISqlInstancesExportRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesExportRequest=} [properties] Properties to set + */ + function SqlInstancesExportRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesExportRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @instance + */ + SqlInstancesExportRequest.prototype.instance = ""; + + /** + * SqlInstancesExportRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @instance + */ + SqlInstancesExportRequest.prototype.project = ""; + + /** + * SqlInstancesExportRequest body. + * @member {google.cloud.sql.v1.IInstancesExportRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @instance + */ + SqlInstancesExportRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesExportRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesExportRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesExportRequest} SqlInstancesExportRequest instance + */ + SqlInstancesExportRequest.create = function create(properties) { + return new SqlInstancesExportRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExportRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesExportRequest} message SqlInstancesExportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExportRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesExportRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExportRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesExportRequest} message SqlInstancesExportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExportRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesExportRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesExportRequest} SqlInstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExportRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesExportRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesExportRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesExportRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesExportRequest} SqlInstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExportRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesExportRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesExportRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesExportRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesExportRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesExportRequest} SqlInstancesExportRequest + */ + SqlInstancesExportRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesExportRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesExportRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesExportRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesExportRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesExportRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesExportRequest} message SqlInstancesExportRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesExportRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesExportRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesExportRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesExportRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesExportRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesExportRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesExportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesExportRequest"; + }; + + return SqlInstancesExportRequest; + })(); + + v1.SqlInstancesFailoverRequest = (function() { + + /** + * Properties of a SqlInstancesFailoverRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesFailoverRequest + * @property {string|null} [instance] SqlInstancesFailoverRequest instance + * @property {string|null} [project] SqlInstancesFailoverRequest project + * @property {google.cloud.sql.v1.IInstancesFailoverRequest|null} [body] SqlInstancesFailoverRequest body + */ + + /** + * Constructs a new SqlInstancesFailoverRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesFailoverRequest. + * @implements ISqlInstancesFailoverRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest=} [properties] Properties to set + */ + function SqlInstancesFailoverRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesFailoverRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @instance + */ + SqlInstancesFailoverRequest.prototype.instance = ""; + + /** + * SqlInstancesFailoverRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @instance + */ + SqlInstancesFailoverRequest.prototype.project = ""; + + /** + * SqlInstancesFailoverRequest body. + * @member {google.cloud.sql.v1.IInstancesFailoverRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @instance + */ + SqlInstancesFailoverRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesFailoverRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest instance + */ + SqlInstancesFailoverRequest.create = function create(properties) { + return new SqlInstancesFailoverRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesFailoverRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest} message SqlInstancesFailoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesFailoverRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesFailoverRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesFailoverRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest} message SqlInstancesFailoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesFailoverRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesFailoverRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesFailoverRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesFailoverRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesFailoverRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesFailoverRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesFailoverRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesFailoverRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest + */ + SqlInstancesFailoverRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesFailoverRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesFailoverRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesFailoverRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesFailoverRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesFailoverRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesFailoverRequest} message SqlInstancesFailoverRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesFailoverRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesFailoverRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesFailoverRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesFailoverRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesFailoverRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesFailoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesFailoverRequest"; + }; + + return SqlInstancesFailoverRequest; + })(); + + v1.SqlInstancesGetRequest = (function() { + + /** + * Properties of a SqlInstancesGetRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesGetRequest + * @property {string|null} [instance] SqlInstancesGetRequest instance + * @property {string|null} [project] SqlInstancesGetRequest project + */ + + /** + * Constructs a new SqlInstancesGetRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesGetRequest. + * @implements ISqlInstancesGetRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesGetRequest=} [properties] Properties to set + */ + function SqlInstancesGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesGetRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @instance + */ + SqlInstancesGetRequest.prototype.instance = ""; + + /** + * SqlInstancesGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @instance + */ + SqlInstancesGetRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesGetRequest} SqlInstancesGetRequest instance + */ + SqlInstancesGetRequest.create = function create(properties) { + return new SqlInstancesGetRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetRequest} message SqlInstancesGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetRequest} message SqlInstancesGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesGetRequest} SqlInstancesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesGetRequest} SqlInstancesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesGetRequest} SqlInstancesGetRequest + */ + SqlInstancesGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesGetRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesGetRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesGetRequest} message SqlInstancesGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesGetRequest"; + }; + + return SqlInstancesGetRequest; + })(); + + v1.SqlInstancesImportRequest = (function() { + + /** + * Properties of a SqlInstancesImportRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesImportRequest + * @property {string|null} [instance] SqlInstancesImportRequest instance + * @property {string|null} [project] SqlInstancesImportRequest project + * @property {google.cloud.sql.v1.IInstancesImportRequest|null} [body] SqlInstancesImportRequest body + */ + + /** + * Constructs a new SqlInstancesImportRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesImportRequest. + * @implements ISqlInstancesImportRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesImportRequest=} [properties] Properties to set + */ + function SqlInstancesImportRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesImportRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @instance + */ + SqlInstancesImportRequest.prototype.instance = ""; + + /** + * SqlInstancesImportRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @instance + */ + SqlInstancesImportRequest.prototype.project = ""; + + /** + * SqlInstancesImportRequest body. + * @member {google.cloud.sql.v1.IInstancesImportRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @instance + */ + SqlInstancesImportRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesImportRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesImportRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesImportRequest} SqlInstancesImportRequest instance + */ + SqlInstancesImportRequest.create = function create(properties) { + return new SqlInstancesImportRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesImportRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesImportRequest} message SqlInstancesImportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesImportRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesImportRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesImportRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesImportRequest} message SqlInstancesImportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesImportRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesImportRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesImportRequest} SqlInstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesImportRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesImportRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesImportRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesImportRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesImportRequest} SqlInstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesImportRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesImportRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesImportRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesImportRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesImportRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesImportRequest} SqlInstancesImportRequest + */ + SqlInstancesImportRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesImportRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesImportRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesImportRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesImportRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesImportRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesImportRequest} message SqlInstancesImportRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesImportRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesImportRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesImportRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesImportRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesImportRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesImportRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesImportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesImportRequest"; + }; + + return SqlInstancesImportRequest; + })(); + + v1.SqlInstancesInsertRequest = (function() { + + /** + * Properties of a SqlInstancesInsertRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesInsertRequest + * @property {string|null} [project] SqlInstancesInsertRequest project + * @property {google.cloud.sql.v1.IDatabaseInstance|null} [body] SqlInstancesInsertRequest body + */ + + /** + * Constructs a new SqlInstancesInsertRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesInsertRequest. + * @implements ISqlInstancesInsertRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest=} [properties] Properties to set + */ + function SqlInstancesInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesInsertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @instance + */ + SqlInstancesInsertRequest.prototype.project = ""; + + /** + * SqlInstancesInsertRequest body. + * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @instance + */ + SqlInstancesInsertRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesInsertRequest} SqlInstancesInsertRequest instance + */ + SqlInstancesInsertRequest.create = function create(properties) { + return new SqlInstancesInsertRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest} message SqlInstancesInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest} message SqlInstancesInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesInsertRequest} SqlInstancesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesInsertRequest} SqlInstancesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesInsertRequest} SqlInstancesInsertRequest + */ + SqlInstancesInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesInsertRequest(); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesInsertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesInsertRequest} message SqlInstancesInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.project = ""; + object.body = null; + } + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesInsertRequest"; + }; + + return SqlInstancesInsertRequest; + })(); + + v1.SqlInstancesListRequest = (function() { + + /** + * Properties of a SqlInstancesListRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesListRequest + * @property {string|null} [filter] SqlInstancesListRequest filter + * @property {number|null} [maxResults] SqlInstancesListRequest maxResults + * @property {string|null} [pageToken] SqlInstancesListRequest pageToken + * @property {string|null} [project] SqlInstancesListRequest project + */ + + /** + * Constructs a new SqlInstancesListRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesListRequest. + * @implements ISqlInstancesListRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesListRequest=} [properties] Properties to set + */ + function SqlInstancesListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesListRequest filter. + * @member {string} filter + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @instance + */ + SqlInstancesListRequest.prototype.filter = ""; + + /** + * SqlInstancesListRequest maxResults. + * @member {number} maxResults + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @instance + */ + SqlInstancesListRequest.prototype.maxResults = 0; + + /** + * SqlInstancesListRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @instance + */ + SqlInstancesListRequest.prototype.pageToken = ""; + + /** + * SqlInstancesListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @instance + */ + SqlInstancesListRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesListRequest} SqlInstancesListRequest instance + */ + SqlInstancesListRequest.create = function create(properties) { + return new SqlInstancesListRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListRequest} message SqlInstancesListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.maxResults); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListRequest} message SqlInstancesListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesListRequest} SqlInstancesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.filter = reader.string(); + break; + } + case 2: { + message.maxResults = reader.uint32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesListRequest} SqlInstancesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesListRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesListRequest} SqlInstancesListRequest + */ + SqlInstancesListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesListRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesListRequest(); + if (object.filter != null) + message.filter = String(object.filter); + if (object.maxResults != null) + message.maxResults = object.maxResults >>> 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesListRequest} message SqlInstancesListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.filter = ""; + object.maxResults = 0; + object.pageToken = ""; + object.project = ""; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesListRequest"; + }; + + return SqlInstancesListRequest; + })(); + + v1.SqlInstancesListServerCasRequest = (function() { + + /** + * Properties of a SqlInstancesListServerCasRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesListServerCasRequest + * @property {string|null} [instance] SqlInstancesListServerCasRequest instance + * @property {string|null} [project] SqlInstancesListServerCasRequest project + */ + + /** + * Constructs a new SqlInstancesListServerCasRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesListServerCasRequest. + * @implements ISqlInstancesListServerCasRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest=} [properties] Properties to set + */ + function SqlInstancesListServerCasRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesListServerCasRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @instance + */ + SqlInstancesListServerCasRequest.prototype.instance = ""; + + /** + * SqlInstancesListServerCasRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @instance + */ + SqlInstancesListServerCasRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesListServerCasRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest instance + */ + SqlInstancesListServerCasRequest.create = function create(properties) { + return new SqlInstancesListServerCasRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesListServerCasRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCasRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListServerCasRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesListServerCasRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCasRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListServerCasRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListServerCasRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesListServerCasRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListServerCasRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesListServerCasRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesListServerCasRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesListServerCasRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest + */ + SqlInstancesListServerCasRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesListServerCasRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesListServerCasRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesListServerCasRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesListServerCasRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesListServerCasRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesListServerCasRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesListServerCasRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesListServerCasRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesListServerCasRequest"; + }; + + return SqlInstancesListServerCasRequest; + })(); + + v1.SqlInstancesListServerCertificatesRequest = (function() { + + /** + * Properties of a SqlInstancesListServerCertificatesRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesListServerCertificatesRequest + * @property {string|null} [instance] SqlInstancesListServerCertificatesRequest instance + * @property {string|null} [project] SqlInstancesListServerCertificatesRequest project + */ + + /** + * Constructs a new SqlInstancesListServerCertificatesRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesListServerCertificatesRequest. + * @implements ISqlInstancesListServerCertificatesRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest=} [properties] Properties to set + */ + function SqlInstancesListServerCertificatesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesListServerCertificatesRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @instance + */ + SqlInstancesListServerCertificatesRequest.prototype.instance = ""; + + /** + * SqlInstancesListServerCertificatesRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @instance + */ + SqlInstancesListServerCertificatesRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesListServerCertificatesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest instance + */ + SqlInstancesListServerCertificatesRequest.create = function create(properties) { + return new SqlInstancesListServerCertificatesRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesListServerCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListServerCertificatesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesListServerCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListServerCertificatesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListServerCertificatesRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListServerCertificatesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesListServerCertificatesRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesListServerCertificatesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesListServerCertificatesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest + */ + SqlInstancesListServerCertificatesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesListServerCertificatesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesListServerCertificatesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesListServerCertificatesRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesListServerCertificatesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesListServerCertificatesRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesListServerCertificatesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest"; + }; + + return SqlInstancesListServerCertificatesRequest; + })(); + + v1.SqlInstancesListEntraIdCertificatesRequest = (function() { + + /** + * Properties of a SqlInstancesListEntraIdCertificatesRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesListEntraIdCertificatesRequest + * @property {string|null} [instance] SqlInstancesListEntraIdCertificatesRequest instance + * @property {string|null} [project] SqlInstancesListEntraIdCertificatesRequest project + */ + + /** + * Constructs a new SqlInstancesListEntraIdCertificatesRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesListEntraIdCertificatesRequest. + * @implements ISqlInstancesListEntraIdCertificatesRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest=} [properties] Properties to set + */ + function SqlInstancesListEntraIdCertificatesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesListEntraIdCertificatesRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @instance + */ + SqlInstancesListEntraIdCertificatesRequest.prototype.instance = ""; + + /** + * SqlInstancesListEntraIdCertificatesRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @instance + */ + SqlInstancesListEntraIdCertificatesRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesListEntraIdCertificatesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest instance + */ + SqlInstancesListEntraIdCertificatesRequest.create = function create(properties) { + return new SqlInstancesListEntraIdCertificatesRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListEntraIdCertificatesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListEntraIdCertificatesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListEntraIdCertificatesRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListEntraIdCertificatesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesListEntraIdCertificatesRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesListEntraIdCertificatesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesListEntraIdCertificatesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest + */ + SqlInstancesListEntraIdCertificatesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesListEntraIdCertificatesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesListEntraIdCertificatesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesListEntraIdCertificatesRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesListEntraIdCertificatesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesListEntraIdCertificatesRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesListEntraIdCertificatesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest"; + }; + + return SqlInstancesListEntraIdCertificatesRequest; + })(); + + v1.SqlInstancesPatchRequest = (function() { + + /** + * Properties of a SqlInstancesPatchRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesPatchRequest + * @property {string|null} [instance] SqlInstancesPatchRequest instance + * @property {string|null} [project] SqlInstancesPatchRequest project + * @property {google.cloud.sql.v1.IDatabaseInstance|null} [body] SqlInstancesPatchRequest body + */ + + /** + * Constructs a new SqlInstancesPatchRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesPatchRequest. + * @implements ISqlInstancesPatchRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest=} [properties] Properties to set + */ + function SqlInstancesPatchRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesPatchRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @instance + */ + SqlInstancesPatchRequest.prototype.instance = ""; + + /** + * SqlInstancesPatchRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @instance + */ + SqlInstancesPatchRequest.prototype.project = ""; + + /** + * SqlInstancesPatchRequest body. + * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @instance + */ + SqlInstancesPatchRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesPatchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesPatchRequest} SqlInstancesPatchRequest instance + */ + SqlInstancesPatchRequest.create = function create(properties) { + return new SqlInstancesPatchRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesPatchRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPatchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest} message SqlInstancesPatchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPatchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesPatchRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPatchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest} message SqlInstancesPatchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPatchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesPatchRequest} SqlInstancesPatchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPatchRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesPatchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesPatchRequest} SqlInstancesPatchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPatchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesPatchRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesPatchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesPatchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesPatchRequest} SqlInstancesPatchRequest + */ + SqlInstancesPatchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesPatchRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesPatchRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesPatchRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesPatchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesPatchRequest} message SqlInstancesPatchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesPatchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesPatchRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesPatchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesPatchRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesPatchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesPatchRequest"; + }; + + return SqlInstancesPatchRequest; + })(); + + v1.SqlInstancesPromoteReplicaRequest = (function() { + + /** + * Properties of a SqlInstancesPromoteReplicaRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesPromoteReplicaRequest + * @property {string|null} [instance] SqlInstancesPromoteReplicaRequest instance + * @property {string|null} [project] SqlInstancesPromoteReplicaRequest project + * @property {boolean|null} [failover] SqlInstancesPromoteReplicaRequest failover + */ + + /** + * Constructs a new SqlInstancesPromoteReplicaRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesPromoteReplicaRequest. + * @implements ISqlInstancesPromoteReplicaRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest=} [properties] Properties to set + */ + function SqlInstancesPromoteReplicaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesPromoteReplicaRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @instance + */ + SqlInstancesPromoteReplicaRequest.prototype.instance = ""; + + /** + * SqlInstancesPromoteReplicaRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @instance + */ + SqlInstancesPromoteReplicaRequest.prototype.project = ""; + + /** + * SqlInstancesPromoteReplicaRequest failover. + * @member {boolean} failover + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @instance + */ + SqlInstancesPromoteReplicaRequest.prototype.failover = false; + + /** + * Creates a new SqlInstancesPromoteReplicaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest instance + */ + SqlInstancesPromoteReplicaRequest.create = function create(properties) { + return new SqlInstancesPromoteReplicaRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesPromoteReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPromoteReplicaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.failover != null && Object.hasOwnProperty.call(message, "failover")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.failover); + return writer; + }; + + /** + * Encodes the specified SqlInstancesPromoteReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPromoteReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPromoteReplicaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.failover = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPromoteReplicaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesPromoteReplicaRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesPromoteReplicaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.failover != null && message.hasOwnProperty("failover")) + if (typeof message.failover !== "boolean") + return "failover: boolean expected"; + return null; + }; + + /** + * Creates a SqlInstancesPromoteReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest + */ + SqlInstancesPromoteReplicaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.failover != null) + message.failover = Boolean(object.failover); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesPromoteReplicaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesPromoteReplicaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.failover = false; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.failover != null && message.hasOwnProperty("failover")) + object.failover = message.failover; + return object; + }; + + /** + * Converts this SqlInstancesPromoteReplicaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesPromoteReplicaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesPromoteReplicaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesPromoteReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest"; + }; + + return SqlInstancesPromoteReplicaRequest; + })(); + + v1.SqlInstancesSwitchoverRequest = (function() { + + /** + * Properties of a SqlInstancesSwitchoverRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesSwitchoverRequest + * @property {string|null} [instance] SqlInstancesSwitchoverRequest instance + * @property {string|null} [project] SqlInstancesSwitchoverRequest project + * @property {google.protobuf.IDuration|null} [dbTimeout] SqlInstancesSwitchoverRequest dbTimeout + */ + + /** + * Constructs a new SqlInstancesSwitchoverRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesSwitchoverRequest. + * @implements ISqlInstancesSwitchoverRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest=} [properties] Properties to set + */ + function SqlInstancesSwitchoverRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesSwitchoverRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @instance + */ + SqlInstancesSwitchoverRequest.prototype.instance = ""; + + /** + * SqlInstancesSwitchoverRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @instance + */ + SqlInstancesSwitchoverRequest.prototype.project = ""; + + /** + * SqlInstancesSwitchoverRequest dbTimeout. + * @member {google.protobuf.IDuration|null|undefined} dbTimeout + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @instance + */ + SqlInstancesSwitchoverRequest.prototype.dbTimeout = null; + + /** + * Creates a new SqlInstancesSwitchoverRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest instance + */ + SqlInstancesSwitchoverRequest.create = function create(properties) { + return new SqlInstancesSwitchoverRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesSwitchoverRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesSwitchoverRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesSwitchoverRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.dbTimeout != null && Object.hasOwnProperty.call(message, "dbTimeout")) + $root.google.protobuf.Duration.encode(message.dbTimeout, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesSwitchoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesSwitchoverRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesSwitchoverRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesSwitchoverRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.dbTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesSwitchoverRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesSwitchoverRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesSwitchoverRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.dbTimeout != null && message.hasOwnProperty("dbTimeout")) { + var error = $root.google.protobuf.Duration.verify(message.dbTimeout); + if (error) + return "dbTimeout." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesSwitchoverRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest + */ + SqlInstancesSwitchoverRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesSwitchoverRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.dbTimeout != null) { + if (typeof object.dbTimeout !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesSwitchoverRequest.dbTimeout: object expected"); + message.dbTimeout = $root.google.protobuf.Duration.fromObject(object.dbTimeout); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesSwitchoverRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesSwitchoverRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.dbTimeout = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.dbTimeout != null && message.hasOwnProperty("dbTimeout")) + object.dbTimeout = $root.google.protobuf.Duration.toObject(message.dbTimeout, options); + return object; + }; + + /** + * Converts this SqlInstancesSwitchoverRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesSwitchoverRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesSwitchoverRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesSwitchoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesSwitchoverRequest"; + }; + + return SqlInstancesSwitchoverRequest; + })(); + + v1.SqlInstancesResetSslConfigRequest = (function() { + + /** + * Properties of a SqlInstancesResetSslConfigRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesResetSslConfigRequest + * @property {string|null} [instance] SqlInstancesResetSslConfigRequest instance + * @property {string|null} [project] SqlInstancesResetSslConfigRequest project + * @property {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode|null} [mode] SqlInstancesResetSslConfigRequest mode + */ + + /** + * Constructs a new SqlInstancesResetSslConfigRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesResetSslConfigRequest. + * @implements ISqlInstancesResetSslConfigRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest=} [properties] Properties to set + */ + function SqlInstancesResetSslConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesResetSslConfigRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @instance + */ + SqlInstancesResetSslConfigRequest.prototype.instance = ""; + + /** + * SqlInstancesResetSslConfigRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @instance + */ + SqlInstancesResetSslConfigRequest.prototype.project = ""; + + /** + * SqlInstancesResetSslConfigRequest mode. + * @member {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode} mode + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @instance + */ + SqlInstancesResetSslConfigRequest.prototype.mode = 0; + + /** + * Creates a new SqlInstancesResetSslConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest instance + */ + SqlInstancesResetSslConfigRequest.create = function create(properties) { + return new SqlInstancesResetSslConfigRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesResetSslConfigRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesResetSslConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified SqlInstancesResetSslConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesResetSslConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesResetSslConfigRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.mode = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesResetSslConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesResetSslConfigRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesResetSslConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a SqlInstancesResetSslConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest + */ + SqlInstancesResetSslConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; + case "RESET_SSL_MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "ALL": + case 1: + message.mode = 1; + break; + case "SYNC_FROM_PRIMARY": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesResetSslConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesResetSslConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.mode = options.enums === String ? "RESET_SSL_MODE_UNSPECIFIED" : 0; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode[message.mode] === undefined ? message.mode : $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this SqlInstancesResetSslConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesResetSslConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesResetSslConfigRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesResetSslConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesResetSslConfigRequest"; + }; + + /** + * ResetSslMode enum. + * @name google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode + * @enum {number} + * @property {number} RESET_SSL_MODE_UNSPECIFIED=0 RESET_SSL_MODE_UNSPECIFIED value + * @property {number} ALL=1 ALL value + * @property {number} SYNC_FROM_PRIMARY=2 SYNC_FROM_PRIMARY value + */ + SqlInstancesResetSslConfigRequest.ResetSslMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RESET_SSL_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALL"] = 1; + values[valuesById[2] = "SYNC_FROM_PRIMARY"] = 2; + return values; + })(); + + return SqlInstancesResetSslConfigRequest; + })(); + + v1.SqlInstancesRestartRequest = (function() { + + /** + * Properties of a SqlInstancesRestartRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesRestartRequest + * @property {string|null} [instance] SqlInstancesRestartRequest instance + * @property {string|null} [project] SqlInstancesRestartRequest project + */ + + /** + * Constructs a new SqlInstancesRestartRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesRestartRequest. + * @implements ISqlInstancesRestartRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest=} [properties] Properties to set + */ + function SqlInstancesRestartRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRestartRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @instance + */ + SqlInstancesRestartRequest.prototype.instance = ""; + + /** + * SqlInstancesRestartRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @instance + */ + SqlInstancesRestartRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesRestartRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesRestartRequest} SqlInstancesRestartRequest instance + */ + SqlInstancesRestartRequest.create = function create(properties) { + return new SqlInstancesRestartRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRestartRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestartRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest} message SqlInstancesRestartRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRestartRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRestartRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestartRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest} message SqlInstancesRestartRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRestartRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesRestartRequest} SqlInstancesRestartRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRestartRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRestartRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesRestartRequest} SqlInstancesRestartRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRestartRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRestartRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRestartRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesRestartRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesRestartRequest} SqlInstancesRestartRequest + */ + SqlInstancesRestartRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRestartRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesRestartRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRestartRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesRestartRequest} message SqlInstancesRestartRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRestartRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesRestartRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRestartRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRestartRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRestartRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRestartRequest"; + }; + + return SqlInstancesRestartRequest; + })(); + + v1.SqlInstancesRestoreBackupRequest = (function() { + + /** + * Properties of a SqlInstancesRestoreBackupRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesRestoreBackupRequest + * @property {string|null} [instance] SqlInstancesRestoreBackupRequest instance + * @property {string|null} [project] SqlInstancesRestoreBackupRequest project + * @property {google.cloud.sql.v1.IInstancesRestoreBackupRequest|null} [body] SqlInstancesRestoreBackupRequest body + */ + + /** + * Constructs a new SqlInstancesRestoreBackupRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesRestoreBackupRequest. + * @implements ISqlInstancesRestoreBackupRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest=} [properties] Properties to set + */ + function SqlInstancesRestoreBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRestoreBackupRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @instance + */ + SqlInstancesRestoreBackupRequest.prototype.instance = ""; + + /** + * SqlInstancesRestoreBackupRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @instance + */ + SqlInstancesRestoreBackupRequest.prototype.project = ""; + + /** + * SqlInstancesRestoreBackupRequest body. + * @member {google.cloud.sql.v1.IInstancesRestoreBackupRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @instance + */ + SqlInstancesRestoreBackupRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesRestoreBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest instance + */ + SqlInstancesRestoreBackupRequest.create = function create(properties) { + return new SqlInstancesRestoreBackupRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestoreBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRestoreBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesRestoreBackupRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestoreBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRestoreBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRestoreBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesRestoreBackupRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRestoreBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRestoreBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRestoreBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesRestoreBackupRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest + */ + SqlInstancesRestoreBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesRestoreBackupRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesRestoreBackupRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRestoreBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRestoreBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesRestoreBackupRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesRestoreBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRestoreBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRestoreBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRestoreBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRestoreBackupRequest"; + }; + + return SqlInstancesRestoreBackupRequest; + })(); + + v1.SqlInstancesRotateServerCaRequest = (function() { + + /** + * Properties of a SqlInstancesRotateServerCaRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesRotateServerCaRequest + * @property {string|null} [instance] SqlInstancesRotateServerCaRequest instance + * @property {string|null} [project] SqlInstancesRotateServerCaRequest project + * @property {google.cloud.sql.v1.IInstancesRotateServerCaRequest|null} [body] SqlInstancesRotateServerCaRequest body + */ + + /** + * Constructs a new SqlInstancesRotateServerCaRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesRotateServerCaRequest. + * @implements ISqlInstancesRotateServerCaRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest=} [properties] Properties to set + */ + function SqlInstancesRotateServerCaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRotateServerCaRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @instance + */ + SqlInstancesRotateServerCaRequest.prototype.instance = ""; + + /** + * SqlInstancesRotateServerCaRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @instance + */ + SqlInstancesRotateServerCaRequest.prototype.project = ""; + + /** + * SqlInstancesRotateServerCaRequest body. + * @member {google.cloud.sql.v1.IInstancesRotateServerCaRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @instance + */ + SqlInstancesRotateServerCaRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesRotateServerCaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest instance + */ + SqlInstancesRotateServerCaRequest.create = function create(properties) { + return new SqlInstancesRotateServerCaRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateServerCaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesRotateServerCaRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateServerCaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesRotateServerCaRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateServerCaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRotateServerCaRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRotateServerCaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesRotateServerCaRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest + */ + SqlInstancesRotateServerCaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesRotateServerCaRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesRotateServerCaRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRotateServerCaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRotateServerCaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesRotateServerCaRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesRotateServerCaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRotateServerCaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRotateServerCaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRotateServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRotateServerCaRequest"; + }; + + return SqlInstancesRotateServerCaRequest; + })(); + + v1.SqlInstancesRotateServerCertificateRequest = (function() { + + /** + * Properties of a SqlInstancesRotateServerCertificateRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesRotateServerCertificateRequest + * @property {string|null} [instance] SqlInstancesRotateServerCertificateRequest instance + * @property {string|null} [project] SqlInstancesRotateServerCertificateRequest project + * @property {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest|null} [body] SqlInstancesRotateServerCertificateRequest body + */ + + /** + * Constructs a new SqlInstancesRotateServerCertificateRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesRotateServerCertificateRequest. + * @implements ISqlInstancesRotateServerCertificateRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest=} [properties] Properties to set + */ + function SqlInstancesRotateServerCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRotateServerCertificateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @instance + */ + SqlInstancesRotateServerCertificateRequest.prototype.instance = ""; + + /** + * SqlInstancesRotateServerCertificateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @instance + */ + SqlInstancesRotateServerCertificateRequest.prototype.project = ""; + + /** + * SqlInstancesRotateServerCertificateRequest body. + * @member {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @instance + */ + SqlInstancesRotateServerCertificateRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesRotateServerCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest instance + */ + SqlInstancesRotateServerCertificateRequest.create = function create(properties) { + return new SqlInstancesRotateServerCertificateRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateServerCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateServerCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRotateServerCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRotateServerCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest + */ + SqlInstancesRotateServerCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRotateServerCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRotateServerCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesRotateServerCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRotateServerCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRotateServerCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRotateServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest"; + }; + + return SqlInstancesRotateServerCertificateRequest; + })(); + + v1.SqlInstancesRotateEntraIdCertificateRequest = (function() { + + /** + * Properties of a SqlInstancesRotateEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesRotateEntraIdCertificateRequest + * @property {string|null} [instance] SqlInstancesRotateEntraIdCertificateRequest instance + * @property {string|null} [project] SqlInstancesRotateEntraIdCertificateRequest project + * @property {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest|null} [body] SqlInstancesRotateEntraIdCertificateRequest body + */ + + /** + * Constructs a new SqlInstancesRotateEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesRotateEntraIdCertificateRequest. + * @implements ISqlInstancesRotateEntraIdCertificateRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set + */ + function SqlInstancesRotateEntraIdCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRotateEntraIdCertificateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @instance + */ + SqlInstancesRotateEntraIdCertificateRequest.prototype.instance = ""; + + /** + * SqlInstancesRotateEntraIdCertificateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @instance + */ + SqlInstancesRotateEntraIdCertificateRequest.prototype.project = ""; + + /** + * SqlInstancesRotateEntraIdCertificateRequest body. + * @member {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @instance + */ + SqlInstancesRotateEntraIdCertificateRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesRotateEntraIdCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest instance + */ + SqlInstancesRotateEntraIdCertificateRequest.create = function create(properties) { + return new SqlInstancesRotateEntraIdCertificateRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateEntraIdCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateEntraIdCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRotateEntraIdCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRotateEntraIdCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest + */ + SqlInstancesRotateEntraIdCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRotateEntraIdCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesRotateEntraIdCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRotateEntraIdCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRotateEntraIdCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRotateEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest"; + }; + + return SqlInstancesRotateEntraIdCertificateRequest; + })(); + + v1.SqlInstancesStartReplicaRequest = (function() { + + /** + * Properties of a SqlInstancesStartReplicaRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesStartReplicaRequest + * @property {string|null} [instance] SqlInstancesStartReplicaRequest instance + * @property {string|null} [project] SqlInstancesStartReplicaRequest project + */ + + /** + * Constructs a new SqlInstancesStartReplicaRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesStartReplicaRequest. + * @implements ISqlInstancesStartReplicaRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest=} [properties] Properties to set + */ + function SqlInstancesStartReplicaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesStartReplicaRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @instance + */ + SqlInstancesStartReplicaRequest.prototype.instance = ""; + + /** + * SqlInstancesStartReplicaRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @instance + */ + SqlInstancesStartReplicaRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesStartReplicaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest instance + */ + SqlInstancesStartReplicaRequest.create = function create(properties) { + return new SqlInstancesStartReplicaRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesStartReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartReplicaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStartReplicaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesStartReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartReplicaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStartReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStartReplicaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStartReplicaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesStartReplicaRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesStartReplicaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesStartReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest + */ + SqlInstancesStartReplicaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesStartReplicaRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesStartReplicaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesStartReplicaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesStartReplicaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesStartReplicaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesStartReplicaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesStartReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesStartReplicaRequest"; + }; + + return SqlInstancesStartReplicaRequest; + })(); + + v1.SqlInstancesStopReplicaRequest = (function() { + + /** + * Properties of a SqlInstancesStopReplicaRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesStopReplicaRequest + * @property {string|null} [instance] SqlInstancesStopReplicaRequest instance + * @property {string|null} [project] SqlInstancesStopReplicaRequest project + */ + + /** + * Constructs a new SqlInstancesStopReplicaRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesStopReplicaRequest. + * @implements ISqlInstancesStopReplicaRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest=} [properties] Properties to set + */ + function SqlInstancesStopReplicaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesStopReplicaRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @instance + */ + SqlInstancesStopReplicaRequest.prototype.instance = ""; + + /** + * SqlInstancesStopReplicaRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @instance + */ + SqlInstancesStopReplicaRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesStopReplicaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest instance + */ + SqlInstancesStopReplicaRequest.create = function create(properties) { + return new SqlInstancesStopReplicaRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesStopReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStopReplicaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStopReplicaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesStopReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStopReplicaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStopReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStopReplicaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStopReplicaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesStopReplicaRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesStopReplicaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesStopReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest + */ + SqlInstancesStopReplicaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesStopReplicaRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesStopReplicaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesStopReplicaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesStopReplicaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesStopReplicaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesStopReplicaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesStopReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesStopReplicaRequest"; + }; + + return SqlInstancesStopReplicaRequest; + })(); + + v1.SqlInstancesTruncateLogRequest = (function() { + + /** + * Properties of a SqlInstancesTruncateLogRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesTruncateLogRequest + * @property {string|null} [instance] SqlInstancesTruncateLogRequest instance + * @property {string|null} [project] SqlInstancesTruncateLogRequest project + * @property {google.cloud.sql.v1.IInstancesTruncateLogRequest|null} [body] SqlInstancesTruncateLogRequest body + */ + + /** + * Constructs a new SqlInstancesTruncateLogRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesTruncateLogRequest. + * @implements ISqlInstancesTruncateLogRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest=} [properties] Properties to set + */ + function SqlInstancesTruncateLogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesTruncateLogRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @instance + */ + SqlInstancesTruncateLogRequest.prototype.instance = ""; + + /** + * SqlInstancesTruncateLogRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @instance + */ + SqlInstancesTruncateLogRequest.prototype.project = ""; + + /** + * SqlInstancesTruncateLogRequest body. + * @member {google.cloud.sql.v1.IInstancesTruncateLogRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @instance + */ + SqlInstancesTruncateLogRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesTruncateLogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest instance + */ + SqlInstancesTruncateLogRequest.create = function create(properties) { + return new SqlInstancesTruncateLogRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesTruncateLogRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesTruncateLogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesTruncateLogRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesTruncateLogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesTruncateLogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesTruncateLogRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesTruncateLogRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesTruncateLogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesTruncateLogRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesTruncateLogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesTruncateLogRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest + */ + SqlInstancesTruncateLogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesTruncateLogRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesTruncateLogRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesTruncateLogRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesTruncateLogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesTruncateLogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesTruncateLogRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesTruncateLogRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesTruncateLogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesTruncateLogRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesTruncateLogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesTruncateLogRequest"; + }; + + return SqlInstancesTruncateLogRequest; + })(); + + v1.SqlInstancesPerformDiskShrinkRequest = (function() { + + /** + * Properties of a SqlInstancesPerformDiskShrinkRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesPerformDiskShrinkRequest + * @property {string|null} [instance] SqlInstancesPerformDiskShrinkRequest instance + * @property {string|null} [project] SqlInstancesPerformDiskShrinkRequest project + * @property {google.cloud.sql.v1.IPerformDiskShrinkContext|null} [body] SqlInstancesPerformDiskShrinkRequest body + */ + + /** + * Constructs a new SqlInstancesPerformDiskShrinkRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesPerformDiskShrinkRequest. + * @implements ISqlInstancesPerformDiskShrinkRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest=} [properties] Properties to set + */ + function SqlInstancesPerformDiskShrinkRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesPerformDiskShrinkRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @instance + */ + SqlInstancesPerformDiskShrinkRequest.prototype.instance = ""; + + /** + * SqlInstancesPerformDiskShrinkRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @instance + */ + SqlInstancesPerformDiskShrinkRequest.prototype.project = ""; + + /** + * SqlInstancesPerformDiskShrinkRequest body. + * @member {google.cloud.sql.v1.IPerformDiskShrinkContext|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @instance + */ + SqlInstancesPerformDiskShrinkRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesPerformDiskShrinkRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest instance + */ + SqlInstancesPerformDiskShrinkRequest.create = function create(properties) { + return new SqlInstancesPerformDiskShrinkRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesPerformDiskShrinkRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPerformDiskShrinkRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.PerformDiskShrinkContext.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesPerformDiskShrinkRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPerformDiskShrinkRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPerformDiskShrinkRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.PerformDiskShrinkContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPerformDiskShrinkRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesPerformDiskShrinkRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesPerformDiskShrinkRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.PerformDiskShrinkContext.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesPerformDiskShrinkRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest + */ + SqlInstancesPerformDiskShrinkRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.PerformDiskShrinkContext.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesPerformDiskShrinkRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesPerformDiskShrinkRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.PerformDiskShrinkContext.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesPerformDiskShrinkRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesPerformDiskShrinkRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesPerformDiskShrinkRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesPerformDiskShrinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest"; + }; + + return SqlInstancesPerformDiskShrinkRequest; + })(); + + v1.SqlInstancesUpdateRequest = (function() { + + /** + * Properties of a SqlInstancesUpdateRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesUpdateRequest + * @property {string|null} [instance] SqlInstancesUpdateRequest instance + * @property {string|null} [project] SqlInstancesUpdateRequest project + * @property {google.cloud.sql.v1.IDatabaseInstance|null} [body] SqlInstancesUpdateRequest body + */ + + /** + * Constructs a new SqlInstancesUpdateRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesUpdateRequest. + * @implements ISqlInstancesUpdateRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest=} [properties] Properties to set + */ + function SqlInstancesUpdateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesUpdateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @instance + */ + SqlInstancesUpdateRequest.prototype.instance = ""; + + /** + * SqlInstancesUpdateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @instance + */ + SqlInstancesUpdateRequest.prototype.project = ""; + + /** + * SqlInstancesUpdateRequest body. + * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @instance + */ + SqlInstancesUpdateRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesUpdateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest instance + */ + SqlInstancesUpdateRequest.create = function create(properties) { + return new SqlInstancesUpdateRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesUpdateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest} message SqlInstancesUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesUpdateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesUpdateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest} message SqlInstancesUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesUpdateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesUpdateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesUpdateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesUpdateRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesUpdateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest + */ + SqlInstancesUpdateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesUpdateRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesUpdateRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesUpdateRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesUpdateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesUpdateRequest} message SqlInstancesUpdateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesUpdateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesUpdateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesUpdateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesUpdateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesUpdateRequest"; + }; + + return SqlInstancesUpdateRequest; + })(); + + v1.SqlInstancesRescheduleMaintenanceRequest = (function() { + + /** + * Properties of a SqlInstancesRescheduleMaintenanceRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesRescheduleMaintenanceRequest + * @property {string|null} [instance] SqlInstancesRescheduleMaintenanceRequest instance + * @property {string|null} [project] SqlInstancesRescheduleMaintenanceRequest project + * @property {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody|null} [body] SqlInstancesRescheduleMaintenanceRequest body + */ + + /** + * Constructs a new SqlInstancesRescheduleMaintenanceRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesRescheduleMaintenanceRequest. + * @implements ISqlInstancesRescheduleMaintenanceRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest=} [properties] Properties to set + */ + function SqlInstancesRescheduleMaintenanceRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRescheduleMaintenanceRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @instance + */ + SqlInstancesRescheduleMaintenanceRequest.prototype.instance = ""; + + /** + * SqlInstancesRescheduleMaintenanceRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @instance + */ + SqlInstancesRescheduleMaintenanceRequest.prototype.project = ""; + + /** + * SqlInstancesRescheduleMaintenanceRequest body. + * @member {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @instance + */ + SqlInstancesRescheduleMaintenanceRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesRescheduleMaintenanceRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest instance + */ + SqlInstancesRescheduleMaintenanceRequest.create = function create(properties) { + return new SqlInstancesRescheduleMaintenanceRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRescheduleMaintenanceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRescheduleMaintenanceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRescheduleMaintenanceRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRescheduleMaintenanceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRescheduleMaintenanceRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRescheduleMaintenanceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRescheduleMaintenanceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest + */ + SqlInstancesRescheduleMaintenanceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRescheduleMaintenanceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesRescheduleMaintenanceRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRescheduleMaintenanceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRescheduleMaintenanceRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRescheduleMaintenanceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest"; + }; + + return SqlInstancesRescheduleMaintenanceRequest; + })(); + + v1.SqlInstancesReencryptRequest = (function() { + + /** + * Properties of a SqlInstancesReencryptRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesReencryptRequest + * @property {string|null} [instance] SqlInstancesReencryptRequest instance + * @property {string|null} [project] SqlInstancesReencryptRequest project + * @property {google.cloud.sql.v1.IInstancesReencryptRequest|null} [body] SqlInstancesReencryptRequest body + */ + + /** + * Constructs a new SqlInstancesReencryptRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesReencryptRequest. + * @implements ISqlInstancesReencryptRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest=} [properties] Properties to set + */ + function SqlInstancesReencryptRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesReencryptRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @instance + */ + SqlInstancesReencryptRequest.prototype.instance = ""; + + /** + * SqlInstancesReencryptRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @instance + */ + SqlInstancesReencryptRequest.prototype.project = ""; + + /** + * SqlInstancesReencryptRequest body. + * @member {google.cloud.sql.v1.IInstancesReencryptRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @instance + */ + SqlInstancesReencryptRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesReencryptRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest instance + */ + SqlInstancesReencryptRequest.create = function create(properties) { + return new SqlInstancesReencryptRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReencryptRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest} message SqlInstancesReencryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReencryptRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesReencryptRequest.encode(message.body, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReencryptRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest} message SqlInstancesReencryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReencryptRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReencryptRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesReencryptRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.body = $root.google.cloud.sql.v1.InstancesReencryptRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReencryptRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesReencryptRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesReencryptRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesReencryptRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest + */ + SqlInstancesReencryptRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesReencryptRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesReencryptRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesReencryptRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesReencryptRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesReencryptRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesReencryptRequest} message SqlInstancesReencryptRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesReencryptRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesReencryptRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesReencryptRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesReencryptRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesReencryptRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesReencryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesReencryptRequest"; + }; + + return SqlInstancesReencryptRequest; + })(); + + v1.InstancesReencryptRequest = (function() { + + /** + * Properties of an InstancesReencryptRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesReencryptRequest + * @property {google.cloud.sql.v1.IBackupReencryptionConfig|null} [backupReencryptionConfig] InstancesReencryptRequest backupReencryptionConfig + */ + + /** + * Constructs a new InstancesReencryptRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesReencryptRequest. + * @implements IInstancesReencryptRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesReencryptRequest=} [properties] Properties to set + */ + function InstancesReencryptRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesReencryptRequest backupReencryptionConfig. + * @member {google.cloud.sql.v1.IBackupReencryptionConfig|null|undefined} backupReencryptionConfig + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @instance + */ + InstancesReencryptRequest.prototype.backupReencryptionConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(InstancesReencryptRequest.prototype, "_backupReencryptionConfig", { + get: $util.oneOfGetter($oneOfFields = ["backupReencryptionConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new InstancesReencryptRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1.IInstancesReencryptRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesReencryptRequest} InstancesReencryptRequest instance + */ + InstancesReencryptRequest.create = function create(properties) { + return new InstancesReencryptRequest(properties); + }; + + /** + * Encodes the specified InstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesReencryptRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1.IInstancesReencryptRequest} message InstancesReencryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesReencryptRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backupReencryptionConfig != null && Object.hasOwnProperty.call(message, "backupReencryptionConfig")) + $root.google.cloud.sql.v1.BackupReencryptionConfig.encode(message.backupReencryptionConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesReencryptRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1.IInstancesReencryptRequest} message InstancesReencryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesReencryptRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesReencryptRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesReencryptRequest} InstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesReencryptRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesReencryptRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backupReencryptionConfig = $root.google.cloud.sql.v1.BackupReencryptionConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesReencryptRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesReencryptRequest} InstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesReencryptRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesReencryptRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesReencryptRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.backupReencryptionConfig != null && message.hasOwnProperty("backupReencryptionConfig")) { + properties._backupReencryptionConfig = 1; + { + var error = $root.google.cloud.sql.v1.BackupReencryptionConfig.verify(message.backupReencryptionConfig); + if (error) + return "backupReencryptionConfig." + error; + } + } + return null; + }; + + /** + * Creates an InstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesReencryptRequest} InstancesReencryptRequest + */ + InstancesReencryptRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesReencryptRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesReencryptRequest(); + if (object.backupReencryptionConfig != null) { + if (typeof object.backupReencryptionConfig !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesReencryptRequest.backupReencryptionConfig: object expected"); + message.backupReencryptionConfig = $root.google.cloud.sql.v1.BackupReencryptionConfig.fromObject(object.backupReencryptionConfig); + } + return message; + }; + + /** + * Creates a plain object from an InstancesReencryptRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1.InstancesReencryptRequest} message InstancesReencryptRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesReencryptRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.backupReencryptionConfig != null && message.hasOwnProperty("backupReencryptionConfig")) { + object.backupReencryptionConfig = $root.google.cloud.sql.v1.BackupReencryptionConfig.toObject(message.backupReencryptionConfig, options); + if (options.oneofs) + object._backupReencryptionConfig = "backupReencryptionConfig"; + } + return object; + }; + + /** + * Converts this InstancesReencryptRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesReencryptRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesReencryptRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesReencryptRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesReencryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesReencryptRequest"; + }; + + return InstancesReencryptRequest; + })(); + + v1.BackupReencryptionConfig = (function() { + + /** + * Properties of a BackupReencryptionConfig. + * @memberof google.cloud.sql.v1 + * @interface IBackupReencryptionConfig + * @property {number|null} [backupLimit] BackupReencryptionConfig backupLimit + * @property {google.cloud.sql.v1.BackupReencryptionConfig.BackupType|null} [backupType] BackupReencryptionConfig backupType + */ + + /** + * Constructs a new BackupReencryptionConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a BackupReencryptionConfig. + * @implements IBackupReencryptionConfig + * @constructor + * @param {google.cloud.sql.v1.IBackupReencryptionConfig=} [properties] Properties to set + */ + function BackupReencryptionConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupReencryptionConfig backupLimit. + * @member {number|null|undefined} backupLimit + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @instance + */ + BackupReencryptionConfig.prototype.backupLimit = null; + + /** + * BackupReencryptionConfig backupType. + * @member {google.cloud.sql.v1.BackupReencryptionConfig.BackupType|null|undefined} backupType + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @instance + */ + BackupReencryptionConfig.prototype.backupType = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BackupReencryptionConfig.prototype, "_backupLimit", { + get: $util.oneOfGetter($oneOfFields = ["backupLimit"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BackupReencryptionConfig.prototype, "_backupType", { + get: $util.oneOfGetter($oneOfFields = ["backupType"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BackupReencryptionConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @static + * @param {google.cloud.sql.v1.IBackupReencryptionConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.BackupReencryptionConfig} BackupReencryptionConfig instance + */ + BackupReencryptionConfig.create = function create(properties) { + return new BackupReencryptionConfig(properties); + }; + + /** + * Encodes the specified BackupReencryptionConfig message. Does not implicitly {@link google.cloud.sql.v1.BackupReencryptionConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @static + * @param {google.cloud.sql.v1.IBackupReencryptionConfig} message BackupReencryptionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupReencryptionConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backupLimit != null && Object.hasOwnProperty.call(message, "backupLimit")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.backupLimit); + if (message.backupType != null && Object.hasOwnProperty.call(message, "backupType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.backupType); + return writer; + }; + + /** + * Encodes the specified BackupReencryptionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupReencryptionConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @static + * @param {google.cloud.sql.v1.IBackupReencryptionConfig} message BackupReencryptionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupReencryptionConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupReencryptionConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.BackupReencryptionConfig} BackupReencryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupReencryptionConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupReencryptionConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backupLimit = reader.int32(); + break; + } + case 2: { + message.backupType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupReencryptionConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.BackupReencryptionConfig} BackupReencryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupReencryptionConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupReencryptionConfig message. + * @function verify + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupReencryptionConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.backupLimit != null && message.hasOwnProperty("backupLimit")) { + properties._backupLimit = 1; + if (!$util.isInteger(message.backupLimit)) + return "backupLimit: integer expected"; + } + if (message.backupType != null && message.hasOwnProperty("backupType")) { + properties._backupType = 1; + switch (message.backupType) { + default: + return "backupType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates a BackupReencryptionConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.BackupReencryptionConfig} BackupReencryptionConfig + */ + BackupReencryptionConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.BackupReencryptionConfig) + return object; + var message = new $root.google.cloud.sql.v1.BackupReencryptionConfig(); + if (object.backupLimit != null) + message.backupLimit = object.backupLimit | 0; + switch (object.backupType) { + default: + if (typeof object.backupType === "number") { + message.backupType = object.backupType; + break; + } + break; + case "BACKUP_TYPE_UNSPECIFIED": + case 0: + message.backupType = 0; + break; + case "AUTOMATED": + case 1: + message.backupType = 1; + break; + case "ON_DEMAND": + case 2: + message.backupType = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a BackupReencryptionConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @static + * @param {google.cloud.sql.v1.BackupReencryptionConfig} message BackupReencryptionConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupReencryptionConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.backupLimit != null && message.hasOwnProperty("backupLimit")) { + object.backupLimit = message.backupLimit; + if (options.oneofs) + object._backupLimit = "backupLimit"; + } + if (message.backupType != null && message.hasOwnProperty("backupType")) { + object.backupType = options.enums === String ? $root.google.cloud.sql.v1.BackupReencryptionConfig.BackupType[message.backupType] === undefined ? message.backupType : $root.google.cloud.sql.v1.BackupReencryptionConfig.BackupType[message.backupType] : message.backupType; + if (options.oneofs) + object._backupType = "backupType"; + } + return object; + }; + + /** + * Converts this BackupReencryptionConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @instance + * @returns {Object.} JSON object + */ + BackupReencryptionConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupReencryptionConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.BackupReencryptionConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupReencryptionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.BackupReencryptionConfig"; + }; + + /** + * BackupType enum. + * @name google.cloud.sql.v1.BackupReencryptionConfig.BackupType + * @enum {number} + * @property {number} BACKUP_TYPE_UNSPECIFIED=0 BACKUP_TYPE_UNSPECIFIED value + * @property {number} AUTOMATED=1 AUTOMATED value + * @property {number} ON_DEMAND=2 ON_DEMAND value + */ + BackupReencryptionConfig.BackupType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BACKUP_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATED"] = 1; + values[valuesById[2] = "ON_DEMAND"] = 2; + return values; + })(); + + return BackupReencryptionConfig; + })(); + + /** + * ExternalSyncParallelLevel enum. + * @name google.cloud.sql.v1.ExternalSyncParallelLevel + * @enum {number} + * @property {number} EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED=0 EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED value + * @property {number} MIN=1 MIN value + * @property {number} OPTIMAL=2 OPTIMAL value + * @property {number} MAX=3 MAX value + */ + v1.ExternalSyncParallelLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "MIN"] = 1; + values[valuesById[2] = "OPTIMAL"] = 2; + values[valuesById[3] = "MAX"] = 3; + return values; + })(); + + v1.ExternalSyncSelectedObject = (function() { + + /** + * Properties of an ExternalSyncSelectedObject. + * @memberof google.cloud.sql.v1 + * @interface IExternalSyncSelectedObject + * @property {string|null} [database] ExternalSyncSelectedObject database + */ + + /** + * Constructs a new ExternalSyncSelectedObject. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an ExternalSyncSelectedObject. + * @implements IExternalSyncSelectedObject + * @constructor + * @param {google.cloud.sql.v1.IExternalSyncSelectedObject=} [properties] Properties to set + */ + function ExternalSyncSelectedObject(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExternalSyncSelectedObject database. + * @member {string} database + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @instance + */ + ExternalSyncSelectedObject.prototype.database = ""; + + /** + * Creates a new ExternalSyncSelectedObject instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @static + * @param {google.cloud.sql.v1.IExternalSyncSelectedObject=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ExternalSyncSelectedObject} ExternalSyncSelectedObject instance + */ + ExternalSyncSelectedObject.create = function create(properties) { + return new ExternalSyncSelectedObject(properties); + }; + + /** + * Encodes the specified ExternalSyncSelectedObject message. Does not implicitly {@link google.cloud.sql.v1.ExternalSyncSelectedObject.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @static + * @param {google.cloud.sql.v1.IExternalSyncSelectedObject} message ExternalSyncSelectedObject message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExternalSyncSelectedObject.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + return writer; + }; + + /** + * Encodes the specified ExternalSyncSelectedObject message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExternalSyncSelectedObject.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @static + * @param {google.cloud.sql.v1.IExternalSyncSelectedObject} message ExternalSyncSelectedObject message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExternalSyncSelectedObject.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ExternalSyncSelectedObject} ExternalSyncSelectedObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExternalSyncSelectedObject.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExternalSyncSelectedObject(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ExternalSyncSelectedObject} ExternalSyncSelectedObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExternalSyncSelectedObject.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExternalSyncSelectedObject message. + * @function verify + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExternalSyncSelectedObject.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + return null; + }; + + /** + * Creates an ExternalSyncSelectedObject message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ExternalSyncSelectedObject} ExternalSyncSelectedObject + */ + ExternalSyncSelectedObject.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ExternalSyncSelectedObject) + return object; + var message = new $root.google.cloud.sql.v1.ExternalSyncSelectedObject(); + if (object.database != null) + message.database = String(object.database); + return message; + }; + + /** + * Creates a plain object from an ExternalSyncSelectedObject message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @static + * @param {google.cloud.sql.v1.ExternalSyncSelectedObject} message ExternalSyncSelectedObject + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExternalSyncSelectedObject.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.database = ""; + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + return object; + }; + + /** + * Converts this ExternalSyncSelectedObject to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @instance + * @returns {Object.} JSON object + */ + ExternalSyncSelectedObject.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExternalSyncSelectedObject + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExternalSyncSelectedObject.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ExternalSyncSelectedObject"; + }; + + return ExternalSyncSelectedObject; + })(); + + v1.SqlInstancesGetDiskShrinkConfigRequest = (function() { + + /** + * Properties of a SqlInstancesGetDiskShrinkConfigRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesGetDiskShrinkConfigRequest + * @property {string|null} [instance] SqlInstancesGetDiskShrinkConfigRequest instance + * @property {string|null} [project] SqlInstancesGetDiskShrinkConfigRequest project + */ + + /** + * Constructs a new SqlInstancesGetDiskShrinkConfigRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesGetDiskShrinkConfigRequest. + * @implements ISqlInstancesGetDiskShrinkConfigRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest=} [properties] Properties to set + */ + function SqlInstancesGetDiskShrinkConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesGetDiskShrinkConfigRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @instance + */ + SqlInstancesGetDiskShrinkConfigRequest.prototype.instance = ""; + + /** + * SqlInstancesGetDiskShrinkConfigRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @instance + */ + SqlInstancesGetDiskShrinkConfigRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesGetDiskShrinkConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest instance + */ + SqlInstancesGetDiskShrinkConfigRequest.create = function create(properties) { + return new SqlInstancesGetDiskShrinkConfigRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetDiskShrinkConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetDiskShrinkConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetDiskShrinkConfigRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetDiskShrinkConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesGetDiskShrinkConfigRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesGetDiskShrinkConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesGetDiskShrinkConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest + */ + SqlInstancesGetDiskShrinkConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesGetDiskShrinkConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesGetDiskShrinkConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesGetDiskShrinkConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesGetDiskShrinkConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesGetDiskShrinkConfigRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesGetDiskShrinkConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest"; + }; + + return SqlInstancesGetDiskShrinkConfigRequest; + })(); + + v1.SqlInstancesVerifyExternalSyncSettingsRequest = (function() { + + /** + * Properties of a SqlInstancesVerifyExternalSyncSettingsRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesVerifyExternalSyncSettingsRequest + * @property {string|null} [instance] SqlInstancesVerifyExternalSyncSettingsRequest instance + * @property {string|null} [project] SqlInstancesVerifyExternalSyncSettingsRequest project + * @property {boolean|null} [verifyConnectionOnly] SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly + * @property {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null} [syncMode] SqlInstancesVerifyExternalSyncSettingsRequest syncMode + * @property {boolean|null} [verifyReplicationOnly] SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly + * @property {google.cloud.sql.v1.IMySqlSyncConfig|null} [mysqlSyncConfig] SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig + * @property {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null} [migrationType] SqlInstancesVerifyExternalSyncSettingsRequest migrationType + * @property {google.cloud.sql.v1.ExternalSyncParallelLevel|null} [syncParallelLevel] SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel + * @property {Array.|null} [selectedObjects] SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects + */ + + /** + * Constructs a new SqlInstancesVerifyExternalSyncSettingsRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesVerifyExternalSyncSettingsRequest. + * @implements ISqlInstancesVerifyExternalSyncSettingsRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest=} [properties] Properties to set + */ + function SqlInstancesVerifyExternalSyncSettingsRequest(properties) { + this.selectedObjects = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.instance = ""; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.project = ""; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly. + * @member {boolean} verifyConnectionOnly + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.verifyConnectionOnly = false; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest syncMode. + * @member {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} syncMode + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.syncMode = 0; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly. + * @member {boolean} verifyReplicationOnly + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.verifyReplicationOnly = false; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig. + * @member {google.cloud.sql.v1.IMySqlSyncConfig|null|undefined} mysqlSyncConfig + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.mysqlSyncConfig = null; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest migrationType. + * @member {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} migrationType + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.migrationType = 0; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel. + * @member {google.cloud.sql.v1.ExternalSyncParallelLevel} syncParallelLevel + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.syncParallelLevel = 0; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects. + * @member {Array.} selectedObjects + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.selectedObjects = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest syncConfig. + * @member {"mysqlSyncConfig"|undefined} syncConfig + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + Object.defineProperty(SqlInstancesVerifyExternalSyncSettingsRequest.prototype, "syncConfig", { + get: $util.oneOfGetter($oneOfFields = ["mysqlSyncConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlInstancesVerifyExternalSyncSettingsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.create = function create(properties) { + return new SqlInstancesVerifyExternalSyncSettingsRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesVerifyExternalSyncSettingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.verifyConnectionOnly != null && Object.hasOwnProperty.call(message, "verifyConnectionOnly")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.verifyConnectionOnly); + if (message.syncMode != null && Object.hasOwnProperty.call(message, "syncMode")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.syncMode); + if (message.verifyReplicationOnly != null && Object.hasOwnProperty.call(message, "verifyReplicationOnly")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.verifyReplicationOnly); + if (message.mysqlSyncConfig != null && Object.hasOwnProperty.call(message, "mysqlSyncConfig")) + $root.google.cloud.sql.v1.MySqlSyncConfig.encode(message.mysqlSyncConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.migrationType != null && Object.hasOwnProperty.call(message, "migrationType")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.migrationType); + if (message.syncParallelLevel != null && Object.hasOwnProperty.call(message, "syncParallelLevel")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.syncParallelLevel); + if (message.selectedObjects != null && message.selectedObjects.length) + for (var i = 0; i < message.selectedObjects.length; ++i) + $root.google.cloud.sql.v1.ExternalSyncSelectedObject.encode(message.selectedObjects[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesVerifyExternalSyncSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesVerifyExternalSyncSettingsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.verifyConnectionOnly = reader.bool(); + break; + } + case 4: { + message.syncMode = reader.int32(); + break; + } + case 5: { + message.verifyReplicationOnly = reader.bool(); + break; + } + case 6: { + message.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.migrationType = reader.int32(); + break; + } + case 8: { + message.syncParallelLevel = reader.int32(); + break; + } + case 9: { + if (!(message.selectedObjects && message.selectedObjects.length)) + message.selectedObjects = []; + message.selectedObjects.push($root.google.cloud.sql.v1.ExternalSyncSelectedObject.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesVerifyExternalSyncSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesVerifyExternalSyncSettingsRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesVerifyExternalSyncSettingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.verifyConnectionOnly != null && message.hasOwnProperty("verifyConnectionOnly")) + if (typeof message.verifyConnectionOnly !== "boolean") + return "verifyConnectionOnly: boolean expected"; + if (message.syncMode != null && message.hasOwnProperty("syncMode")) + switch (message.syncMode) { + default: + return "syncMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.verifyReplicationOnly != null && message.hasOwnProperty("verifyReplicationOnly")) + if (typeof message.verifyReplicationOnly !== "boolean") + return "verifyReplicationOnly: boolean expected"; + if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { + properties.syncConfig = 1; + { + var error = $root.google.cloud.sql.v1.MySqlSyncConfig.verify(message.mysqlSyncConfig); + if (error) + return "mysqlSyncConfig." + error; + } + } + if (message.migrationType != null && message.hasOwnProperty("migrationType")) + switch (message.migrationType) { + default: + return "migrationType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) + switch (message.syncParallelLevel) { + default: + return "syncParallelLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.selectedObjects != null && message.hasOwnProperty("selectedObjects")) { + if (!Array.isArray(message.selectedObjects)) + return "selectedObjects: array expected"; + for (var i = 0; i < message.selectedObjects.length; ++i) { + var error = $root.google.cloud.sql.v1.ExternalSyncSelectedObject.verify(message.selectedObjects[i]); + if (error) + return "selectedObjects." + error; + } + } + return null; + }; + + /** + * Creates a SqlInstancesVerifyExternalSyncSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest + */ + SqlInstancesVerifyExternalSyncSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.verifyConnectionOnly != null) + message.verifyConnectionOnly = Boolean(object.verifyConnectionOnly); + switch (object.syncMode) { + default: + if (typeof object.syncMode === "number") { + message.syncMode = object.syncMode; + break; + } + break; + case "EXTERNAL_SYNC_MODE_UNSPECIFIED": + case 0: + message.syncMode = 0; + break; + case "ONLINE": + case 1: + message.syncMode = 1; + break; + case "OFFLINE": + case 2: + message.syncMode = 2; + break; + } + if (object.verifyReplicationOnly != null) + message.verifyReplicationOnly = Boolean(object.verifyReplicationOnly); + if (object.mysqlSyncConfig != null) { + if (typeof object.mysqlSyncConfig !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.mysqlSyncConfig: object expected"); + message.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.fromObject(object.mysqlSyncConfig); + } + switch (object.migrationType) { + default: + if (typeof object.migrationType === "number") { + message.migrationType = object.migrationType; + break; + } + break; + case "MIGRATION_TYPE_UNSPECIFIED": + case 0: + message.migrationType = 0; + break; + case "LOGICAL": + case 1: + message.migrationType = 1; + break; + case "PHYSICAL": + case 2: + message.migrationType = 2; + break; + } + switch (object.syncParallelLevel) { + default: + if (typeof object.syncParallelLevel === "number") { + message.syncParallelLevel = object.syncParallelLevel; + break; + } + break; + case "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": + case 0: + message.syncParallelLevel = 0; + break; + case "MIN": + case 1: + message.syncParallelLevel = 1; + break; + case "OPTIMAL": + case 2: + message.syncParallelLevel = 2; + break; + case "MAX": + case 3: + message.syncParallelLevel = 3; + break; + } + if (object.selectedObjects) { + if (!Array.isArray(object.selectedObjects)) + throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.selectedObjects: array expected"); + message.selectedObjects = []; + for (var i = 0; i < object.selectedObjects.length; ++i) { + if (typeof object.selectedObjects[i] !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.selectedObjects: object expected"); + message.selectedObjects[i] = $root.google.cloud.sql.v1.ExternalSyncSelectedObject.fromObject(object.selectedObjects[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesVerifyExternalSyncSettingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.selectedObjects = []; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.verifyConnectionOnly = false; + object.syncMode = options.enums === String ? "EXTERNAL_SYNC_MODE_UNSPECIFIED" : 0; + object.verifyReplicationOnly = false; + object.migrationType = options.enums === String ? "MIGRATION_TYPE_UNSPECIFIED" : 0; + object.syncParallelLevel = options.enums === String ? "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" : 0; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.verifyConnectionOnly != null && message.hasOwnProperty("verifyConnectionOnly")) + object.verifyConnectionOnly = message.verifyConnectionOnly; + if (message.syncMode != null && message.hasOwnProperty("syncMode")) + object.syncMode = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] === undefined ? message.syncMode : $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] : message.syncMode; + if (message.verifyReplicationOnly != null && message.hasOwnProperty("verifyReplicationOnly")) + object.verifyReplicationOnly = message.verifyReplicationOnly; + if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { + object.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.toObject(message.mysqlSyncConfig, options); + if (options.oneofs) + object.syncConfig = "mysqlSyncConfig"; + } + if (message.migrationType != null && message.hasOwnProperty("migrationType")) + object.migrationType = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] === undefined ? message.migrationType : $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] : message.migrationType; + if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) + object.syncParallelLevel = options.enums === String ? $root.google.cloud.sql.v1.ExternalSyncParallelLevel[message.syncParallelLevel] === undefined ? message.syncParallelLevel : $root.google.cloud.sql.v1.ExternalSyncParallelLevel[message.syncParallelLevel] : message.syncParallelLevel; + if (message.selectedObjects && message.selectedObjects.length) { + object.selectedObjects = []; + for (var j = 0; j < message.selectedObjects.length; ++j) + object.selectedObjects[j] = $root.google.cloud.sql.v1.ExternalSyncSelectedObject.toObject(message.selectedObjects[j], options); + } + return object; + }; + + /** + * Converts this SqlInstancesVerifyExternalSyncSettingsRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesVerifyExternalSyncSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest"; + }; + + /** + * ExternalSyncMode enum. + * @name google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode + * @enum {number} + * @property {number} EXTERNAL_SYNC_MODE_UNSPECIFIED=0 EXTERNAL_SYNC_MODE_UNSPECIFIED value + * @property {number} ONLINE=1 ONLINE value + * @property {number} OFFLINE=2 OFFLINE value + */ + SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EXTERNAL_SYNC_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ONLINE"] = 1; + values[valuesById[2] = "OFFLINE"] = 2; + return values; + })(); + + /** + * MigrationType enum. + * @name google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType + * @enum {number} + * @property {number} MIGRATION_TYPE_UNSPECIFIED=0 MIGRATION_TYPE_UNSPECIFIED value + * @property {number} LOGICAL=1 LOGICAL value + * @property {number} PHYSICAL=2 PHYSICAL value + */ + SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MIGRATION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "LOGICAL"] = 1; + values[valuesById[2] = "PHYSICAL"] = 2; + return values; + })(); + + return SqlInstancesVerifyExternalSyncSettingsRequest; + })(); + + v1.SqlInstancesStartExternalSyncRequest = (function() { + + /** + * Properties of a SqlInstancesStartExternalSyncRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesStartExternalSyncRequest + * @property {string|null} [instance] SqlInstancesStartExternalSyncRequest instance + * @property {string|null} [project] SqlInstancesStartExternalSyncRequest project + * @property {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null} [syncMode] SqlInstancesStartExternalSyncRequest syncMode + * @property {boolean|null} [skipVerification] SqlInstancesStartExternalSyncRequest skipVerification + * @property {google.cloud.sql.v1.IMySqlSyncConfig|null} [mysqlSyncConfig] SqlInstancesStartExternalSyncRequest mysqlSyncConfig + * @property {google.cloud.sql.v1.ExternalSyncParallelLevel|null} [syncParallelLevel] SqlInstancesStartExternalSyncRequest syncParallelLevel + * @property {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null} [migrationType] SqlInstancesStartExternalSyncRequest migrationType + * @property {boolean|null} [replicaOverwriteEnabled] SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled + */ + + /** + * Constructs a new SqlInstancesStartExternalSyncRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesStartExternalSyncRequest. + * @implements ISqlInstancesStartExternalSyncRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest=} [properties] Properties to set + */ + function SqlInstancesStartExternalSyncRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesStartExternalSyncRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.instance = ""; + + /** + * SqlInstancesStartExternalSyncRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.project = ""; + + /** + * SqlInstancesStartExternalSyncRequest syncMode. + * @member {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} syncMode + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.syncMode = 0; + + /** + * SqlInstancesStartExternalSyncRequest skipVerification. + * @member {boolean} skipVerification + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.skipVerification = false; + + /** + * SqlInstancesStartExternalSyncRequest mysqlSyncConfig. + * @member {google.cloud.sql.v1.IMySqlSyncConfig|null|undefined} mysqlSyncConfig + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.mysqlSyncConfig = null; + + /** + * SqlInstancesStartExternalSyncRequest syncParallelLevel. + * @member {google.cloud.sql.v1.ExternalSyncParallelLevel} syncParallelLevel + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.syncParallelLevel = 0; + + /** + * SqlInstancesStartExternalSyncRequest migrationType. + * @member {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} migrationType + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.migrationType = 0; + + /** + * SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled. + * @member {boolean} replicaOverwriteEnabled + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.replicaOverwriteEnabled = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SqlInstancesStartExternalSyncRequest syncConfig. + * @member {"mysqlSyncConfig"|undefined} syncConfig + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @instance + */ + Object.defineProperty(SqlInstancesStartExternalSyncRequest.prototype, "syncConfig", { + get: $util.oneOfGetter($oneOfFields = ["mysqlSyncConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlInstancesStartExternalSyncRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest instance + */ + SqlInstancesStartExternalSyncRequest.create = function create(properties) { + return new SqlInstancesStartExternalSyncRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesStartExternalSyncRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStartExternalSyncRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.syncMode != null && Object.hasOwnProperty.call(message, "syncMode")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.syncMode); + if (message.skipVerification != null && Object.hasOwnProperty.call(message, "skipVerification")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.skipVerification); + if (message.mysqlSyncConfig != null && Object.hasOwnProperty.call(message, "mysqlSyncConfig")) + $root.google.cloud.sql.v1.MySqlSyncConfig.encode(message.mysqlSyncConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.syncParallelLevel != null && Object.hasOwnProperty.call(message, "syncParallelLevel")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.syncParallelLevel); + if (message.migrationType != null && Object.hasOwnProperty.call(message, "migrationType")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.migrationType); + if (message.replicaOverwriteEnabled != null && Object.hasOwnProperty.call(message, "replicaOverwriteEnabled")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.replicaOverwriteEnabled); + return writer; + }; + + /** + * Encodes the specified SqlInstancesStartExternalSyncRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStartExternalSyncRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStartExternalSyncRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.syncMode = reader.int32(); + break; + } + case 4: { + message.skipVerification = reader.bool(); + break; + } + case 6: { + message.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.syncParallelLevel = reader.int32(); + break; + } + case 8: { + message.migrationType = reader.int32(); + break; + } + case 9: { + message.replicaOverwriteEnabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStartExternalSyncRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesStartExternalSyncRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesStartExternalSyncRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.syncMode != null && message.hasOwnProperty("syncMode")) + switch (message.syncMode) { + default: + return "syncMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.skipVerification != null && message.hasOwnProperty("skipVerification")) + if (typeof message.skipVerification !== "boolean") + return "skipVerification: boolean expected"; + if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { + properties.syncConfig = 1; + { + var error = $root.google.cloud.sql.v1.MySqlSyncConfig.verify(message.mysqlSyncConfig); + if (error) + return "mysqlSyncConfig." + error; + } + } + if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) + switch (message.syncParallelLevel) { + default: + return "syncParallelLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.migrationType != null && message.hasOwnProperty("migrationType")) + switch (message.migrationType) { + default: + return "migrationType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.replicaOverwriteEnabled != null && message.hasOwnProperty("replicaOverwriteEnabled")) + if (typeof message.replicaOverwriteEnabled !== "boolean") + return "replicaOverwriteEnabled: boolean expected"; + return null; + }; + + /** + * Creates a SqlInstancesStartExternalSyncRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest + */ + SqlInstancesStartExternalSyncRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + switch (object.syncMode) { + default: + if (typeof object.syncMode === "number") { + message.syncMode = object.syncMode; + break; + } + break; + case "EXTERNAL_SYNC_MODE_UNSPECIFIED": + case 0: + message.syncMode = 0; + break; + case "ONLINE": + case 1: + message.syncMode = 1; + break; + case "OFFLINE": + case 2: + message.syncMode = 2; + break; + } + if (object.skipVerification != null) + message.skipVerification = Boolean(object.skipVerification); + if (object.mysqlSyncConfig != null) { + if (typeof object.mysqlSyncConfig !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.mysqlSyncConfig: object expected"); + message.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.fromObject(object.mysqlSyncConfig); + } + switch (object.syncParallelLevel) { + default: + if (typeof object.syncParallelLevel === "number") { + message.syncParallelLevel = object.syncParallelLevel; + break; + } + break; + case "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": + case 0: + message.syncParallelLevel = 0; + break; + case "MIN": + case 1: + message.syncParallelLevel = 1; + break; + case "OPTIMAL": + case 2: + message.syncParallelLevel = 2; + break; + case "MAX": + case 3: + message.syncParallelLevel = 3; + break; + } + switch (object.migrationType) { + default: + if (typeof object.migrationType === "number") { + message.migrationType = object.migrationType; + break; + } + break; + case "MIGRATION_TYPE_UNSPECIFIED": + case 0: + message.migrationType = 0; + break; + case "LOGICAL": + case 1: + message.migrationType = 1; + break; + case "PHYSICAL": + case 2: + message.migrationType = 2; + break; + } + if (object.replicaOverwriteEnabled != null) + message.replicaOverwriteEnabled = Boolean(object.replicaOverwriteEnabled); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesStartExternalSyncRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesStartExternalSyncRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.syncMode = options.enums === String ? "EXTERNAL_SYNC_MODE_UNSPECIFIED" : 0; + object.skipVerification = false; + object.syncParallelLevel = options.enums === String ? "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" : 0; + object.migrationType = options.enums === String ? "MIGRATION_TYPE_UNSPECIFIED" : 0; + object.replicaOverwriteEnabled = false; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.syncMode != null && message.hasOwnProperty("syncMode")) + object.syncMode = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] === undefined ? message.syncMode : $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] : message.syncMode; + if (message.skipVerification != null && message.hasOwnProperty("skipVerification")) + object.skipVerification = message.skipVerification; + if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { + object.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.toObject(message.mysqlSyncConfig, options); + if (options.oneofs) + object.syncConfig = "mysqlSyncConfig"; + } + if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) + object.syncParallelLevel = options.enums === String ? $root.google.cloud.sql.v1.ExternalSyncParallelLevel[message.syncParallelLevel] === undefined ? message.syncParallelLevel : $root.google.cloud.sql.v1.ExternalSyncParallelLevel[message.syncParallelLevel] : message.syncParallelLevel; + if (message.migrationType != null && message.hasOwnProperty("migrationType")) + object.migrationType = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] === undefined ? message.migrationType : $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] : message.migrationType; + if (message.replicaOverwriteEnabled != null && message.hasOwnProperty("replicaOverwriteEnabled")) + object.replicaOverwriteEnabled = message.replicaOverwriteEnabled; + return object; + }; + + /** + * Converts this SqlInstancesStartExternalSyncRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesStartExternalSyncRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesStartExternalSyncRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesStartExternalSyncRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest"; + }; + + return SqlInstancesStartExternalSyncRequest; + })(); + + v1.SqlInstancesResetReplicaSizeRequest = (function() { + + /** + * Properties of a SqlInstancesResetReplicaSizeRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesResetReplicaSizeRequest + * @property {string|null} [instance] SqlInstancesResetReplicaSizeRequest instance + * @property {string|null} [project] SqlInstancesResetReplicaSizeRequest project + */ + + /** + * Constructs a new SqlInstancesResetReplicaSizeRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesResetReplicaSizeRequest. + * @implements ISqlInstancesResetReplicaSizeRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest=} [properties] Properties to set + */ + function SqlInstancesResetReplicaSizeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesResetReplicaSizeRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @instance + */ + SqlInstancesResetReplicaSizeRequest.prototype.instance = ""; + + /** + * SqlInstancesResetReplicaSizeRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @instance + */ + SqlInstancesResetReplicaSizeRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesResetReplicaSizeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest instance + */ + SqlInstancesResetReplicaSizeRequest.create = function create(properties) { + return new SqlInstancesResetReplicaSizeRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesResetReplicaSizeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesResetReplicaSizeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesResetReplicaSizeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesResetReplicaSizeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesResetReplicaSizeRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesResetReplicaSizeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesResetReplicaSizeRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesResetReplicaSizeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesResetReplicaSizeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest + */ + SqlInstancesResetReplicaSizeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesResetReplicaSizeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesResetReplicaSizeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesResetReplicaSizeRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesResetReplicaSizeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesResetReplicaSizeRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesResetReplicaSizeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest"; + }; + + return SqlInstancesResetReplicaSizeRequest; + })(); + + v1.SqlInstancesCreateEphemeralCertRequest = (function() { + + /** + * Properties of a SqlInstancesCreateEphemeralCertRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesCreateEphemeralCertRequest + * @property {string|null} [instance] SqlInstancesCreateEphemeralCertRequest instance + * @property {string|null} [project] SqlInstancesCreateEphemeralCertRequest project + * @property {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest|null} [body] SqlInstancesCreateEphemeralCertRequest body + */ + + /** + * Constructs a new SqlInstancesCreateEphemeralCertRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesCreateEphemeralCertRequest. + * @implements ISqlInstancesCreateEphemeralCertRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest=} [properties] Properties to set + */ + function SqlInstancesCreateEphemeralCertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesCreateEphemeralCertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @instance + */ + SqlInstancesCreateEphemeralCertRequest.prototype.instance = ""; + + /** + * SqlInstancesCreateEphemeralCertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @instance + */ + SqlInstancesCreateEphemeralCertRequest.prototype.project = ""; + + /** + * SqlInstancesCreateEphemeralCertRequest body. + * @member {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @instance + */ + SqlInstancesCreateEphemeralCertRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesCreateEphemeralCertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest instance + */ + SqlInstancesCreateEphemeralCertRequest.create = function create(properties) { + return new SqlInstancesCreateEphemeralCertRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesCreateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesCreateEphemeralCertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesCreateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesCreateEphemeralCertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesCreateEphemeralCertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesCreateEphemeralCertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesCreateEphemeralCertRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesCreateEphemeralCertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesCreateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest + */ + SqlInstancesCreateEphemeralCertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesCreateEphemeralCertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesCreateEphemeralCertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesCreateEphemeralCertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesCreateEphemeralCertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesCreateEphemeralCertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesCreateEphemeralCertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest"; + }; + + return SqlInstancesCreateEphemeralCertRequest; + })(); + + v1.InstancesCloneRequest = (function() { + + /** + * Properties of an InstancesCloneRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesCloneRequest + * @property {google.cloud.sql.v1.ICloneContext|null} [cloneContext] InstancesCloneRequest cloneContext + */ + + /** + * Constructs a new InstancesCloneRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesCloneRequest. + * @implements IInstancesCloneRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesCloneRequest=} [properties] Properties to set + */ + function InstancesCloneRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesCloneRequest cloneContext. + * @member {google.cloud.sql.v1.ICloneContext|null|undefined} cloneContext + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @instance + */ + InstancesCloneRequest.prototype.cloneContext = null; + + /** + * Creates a new InstancesCloneRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @static + * @param {google.cloud.sql.v1.IInstancesCloneRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesCloneRequest} InstancesCloneRequest instance + */ + InstancesCloneRequest.create = function create(properties) { + return new InstancesCloneRequest(properties); + }; + + /** + * Encodes the specified InstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesCloneRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @static + * @param {google.cloud.sql.v1.IInstancesCloneRequest} message InstancesCloneRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesCloneRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cloneContext != null && Object.hasOwnProperty.call(message, "cloneContext")) + $root.google.cloud.sql.v1.CloneContext.encode(message.cloneContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesCloneRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @static + * @param {google.cloud.sql.v1.IInstancesCloneRequest} message InstancesCloneRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesCloneRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesCloneRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesCloneRequest} InstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesCloneRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesCloneRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.cloneContext = $root.google.cloud.sql.v1.CloneContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesCloneRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesCloneRequest} InstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesCloneRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesCloneRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesCloneRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cloneContext != null && message.hasOwnProperty("cloneContext")) { + var error = $root.google.cloud.sql.v1.CloneContext.verify(message.cloneContext); + if (error) + return "cloneContext." + error; + } + return null; + }; + + /** + * Creates an InstancesCloneRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesCloneRequest} InstancesCloneRequest + */ + InstancesCloneRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesCloneRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesCloneRequest(); + if (object.cloneContext != null) { + if (typeof object.cloneContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesCloneRequest.cloneContext: object expected"); + message.cloneContext = $root.google.cloud.sql.v1.CloneContext.fromObject(object.cloneContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesCloneRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @static + * @param {google.cloud.sql.v1.InstancesCloneRequest} message InstancesCloneRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesCloneRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.cloneContext = null; + if (message.cloneContext != null && message.hasOwnProperty("cloneContext")) + object.cloneContext = $root.google.cloud.sql.v1.CloneContext.toObject(message.cloneContext, options); + return object; + }; + + /** + * Converts this InstancesCloneRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesCloneRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesCloneRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesCloneRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesCloneRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesCloneRequest"; + }; + + return InstancesCloneRequest; + })(); + + v1.InstancesDemoteMasterRequest = (function() { + + /** + * Properties of an InstancesDemoteMasterRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesDemoteMasterRequest + * @property {google.cloud.sql.v1.IDemoteMasterContext|null} [demoteMasterContext] InstancesDemoteMasterRequest demoteMasterContext + */ + + /** + * Constructs a new InstancesDemoteMasterRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesDemoteMasterRequest. + * @implements IInstancesDemoteMasterRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesDemoteMasterRequest=} [properties] Properties to set + */ + function InstancesDemoteMasterRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesDemoteMasterRequest demoteMasterContext. + * @member {google.cloud.sql.v1.IDemoteMasterContext|null|undefined} demoteMasterContext + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @instance + */ + InstancesDemoteMasterRequest.prototype.demoteMasterContext = null; + + /** + * Creates a new InstancesDemoteMasterRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1.IInstancesDemoteMasterRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest instance + */ + InstancesDemoteMasterRequest.create = function create(properties) { + return new InstancesDemoteMasterRequest(properties); + }; + + /** + * Encodes the specified InstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteMasterRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1.IInstancesDemoteMasterRequest} message InstancesDemoteMasterRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesDemoteMasterRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.demoteMasterContext != null && Object.hasOwnProperty.call(message, "demoteMasterContext")) + $root.google.cloud.sql.v1.DemoteMasterContext.encode(message.demoteMasterContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteMasterRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1.IInstancesDemoteMasterRequest} message InstancesDemoteMasterRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesDemoteMasterRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesDemoteMasterRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesDemoteMasterRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.demoteMasterContext = $root.google.cloud.sql.v1.DemoteMasterContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesDemoteMasterRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesDemoteMasterRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesDemoteMasterRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.demoteMasterContext != null && message.hasOwnProperty("demoteMasterContext")) { + var error = $root.google.cloud.sql.v1.DemoteMasterContext.verify(message.demoteMasterContext); + if (error) + return "demoteMasterContext." + error; + } + return null; + }; + + /** + * Creates an InstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest + */ + InstancesDemoteMasterRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesDemoteMasterRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesDemoteMasterRequest(); + if (object.demoteMasterContext != null) { + if (typeof object.demoteMasterContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesDemoteMasterRequest.demoteMasterContext: object expected"); + message.demoteMasterContext = $root.google.cloud.sql.v1.DemoteMasterContext.fromObject(object.demoteMasterContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesDemoteMasterRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1.InstancesDemoteMasterRequest} message InstancesDemoteMasterRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesDemoteMasterRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.demoteMasterContext = null; + if (message.demoteMasterContext != null && message.hasOwnProperty("demoteMasterContext")) + object.demoteMasterContext = $root.google.cloud.sql.v1.DemoteMasterContext.toObject(message.demoteMasterContext, options); + return object; + }; + + /** + * Converts this InstancesDemoteMasterRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesDemoteMasterRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesDemoteMasterRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesDemoteMasterRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesDemoteMasterRequest"; + }; + + return InstancesDemoteMasterRequest; + })(); + + v1.InstancesDemoteRequest = (function() { + + /** + * Properties of an InstancesDemoteRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesDemoteRequest + * @property {google.cloud.sql.v1.IDemoteContext|null} [demoteContext] InstancesDemoteRequest demoteContext + */ + + /** + * Constructs a new InstancesDemoteRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesDemoteRequest. + * @implements IInstancesDemoteRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesDemoteRequest=} [properties] Properties to set + */ + function InstancesDemoteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesDemoteRequest demoteContext. + * @member {google.cloud.sql.v1.IDemoteContext|null|undefined} demoteContext + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @instance + */ + InstancesDemoteRequest.prototype.demoteContext = null; + + /** + * Creates a new InstancesDemoteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1.IInstancesDemoteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesDemoteRequest} InstancesDemoteRequest instance + */ + InstancesDemoteRequest.create = function create(properties) { + return new InstancesDemoteRequest(properties); + }; + + /** + * Encodes the specified InstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1.IInstancesDemoteRequest} message InstancesDemoteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesDemoteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.demoteContext != null && Object.hasOwnProperty.call(message, "demoteContext")) + $root.google.cloud.sql.v1.DemoteContext.encode(message.demoteContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1.IInstancesDemoteRequest} message InstancesDemoteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesDemoteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesDemoteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesDemoteRequest} InstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesDemoteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesDemoteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.demoteContext = $root.google.cloud.sql.v1.DemoteContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesDemoteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesDemoteRequest} InstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesDemoteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesDemoteRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesDemoteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.demoteContext != null && message.hasOwnProperty("demoteContext")) { + var error = $root.google.cloud.sql.v1.DemoteContext.verify(message.demoteContext); + if (error) + return "demoteContext." + error; + } + return null; + }; + + /** + * Creates an InstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesDemoteRequest} InstancesDemoteRequest + */ + InstancesDemoteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesDemoteRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesDemoteRequest(); + if (object.demoteContext != null) { + if (typeof object.demoteContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesDemoteRequest.demoteContext: object expected"); + message.demoteContext = $root.google.cloud.sql.v1.DemoteContext.fromObject(object.demoteContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesDemoteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1.InstancesDemoteRequest} message InstancesDemoteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesDemoteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.demoteContext = null; + if (message.demoteContext != null && message.hasOwnProperty("demoteContext")) + object.demoteContext = $root.google.cloud.sql.v1.DemoteContext.toObject(message.demoteContext, options); + return object; + }; + + /** + * Converts this InstancesDemoteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesDemoteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesDemoteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesDemoteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesDemoteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesDemoteRequest"; + }; + + return InstancesDemoteRequest; + })(); + + v1.InstancesExportRequest = (function() { + + /** + * Properties of an InstancesExportRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesExportRequest + * @property {google.cloud.sql.v1.IExportContext|null} [exportContext] InstancesExportRequest exportContext + */ + + /** + * Constructs a new InstancesExportRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesExportRequest. + * @implements IInstancesExportRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesExportRequest=} [properties] Properties to set + */ + function InstancesExportRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesExportRequest exportContext. + * @member {google.cloud.sql.v1.IExportContext|null|undefined} exportContext + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @instance + */ + InstancesExportRequest.prototype.exportContext = null; + + /** + * Creates a new InstancesExportRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @static + * @param {google.cloud.sql.v1.IInstancesExportRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesExportRequest} InstancesExportRequest instance + */ + InstancesExportRequest.create = function create(properties) { + return new InstancesExportRequest(properties); + }; + + /** + * Encodes the specified InstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesExportRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @static + * @param {google.cloud.sql.v1.IInstancesExportRequest} message InstancesExportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesExportRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exportContext != null && Object.hasOwnProperty.call(message, "exportContext")) + $root.google.cloud.sql.v1.ExportContext.encode(message.exportContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesExportRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @static + * @param {google.cloud.sql.v1.IInstancesExportRequest} message InstancesExportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesExportRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesExportRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesExportRequest} InstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesExportRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesExportRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.exportContext = $root.google.cloud.sql.v1.ExportContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesExportRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesExportRequest} InstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesExportRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesExportRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesExportRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.exportContext != null && message.hasOwnProperty("exportContext")) { + var error = $root.google.cloud.sql.v1.ExportContext.verify(message.exportContext); + if (error) + return "exportContext." + error; + } + return null; + }; + + /** + * Creates an InstancesExportRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesExportRequest} InstancesExportRequest + */ + InstancesExportRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesExportRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesExportRequest(); + if (object.exportContext != null) { + if (typeof object.exportContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesExportRequest.exportContext: object expected"); + message.exportContext = $root.google.cloud.sql.v1.ExportContext.fromObject(object.exportContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesExportRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @static + * @param {google.cloud.sql.v1.InstancesExportRequest} message InstancesExportRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesExportRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.exportContext = null; + if (message.exportContext != null && message.hasOwnProperty("exportContext")) + object.exportContext = $root.google.cloud.sql.v1.ExportContext.toObject(message.exportContext, options); + return object; + }; + + /** + * Converts this InstancesExportRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesExportRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesExportRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesExportRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesExportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesExportRequest"; + }; + + return InstancesExportRequest; + })(); + + v1.InstancesFailoverRequest = (function() { + + /** + * Properties of an InstancesFailoverRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesFailoverRequest + * @property {google.cloud.sql.v1.IFailoverContext|null} [failoverContext] InstancesFailoverRequest failoverContext + */ + + /** + * Constructs a new InstancesFailoverRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesFailoverRequest. + * @implements IInstancesFailoverRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesFailoverRequest=} [properties] Properties to set + */ + function InstancesFailoverRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesFailoverRequest failoverContext. + * @member {google.cloud.sql.v1.IFailoverContext|null|undefined} failoverContext + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @instance + */ + InstancesFailoverRequest.prototype.failoverContext = null; + + /** + * Creates a new InstancesFailoverRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1.IInstancesFailoverRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesFailoverRequest} InstancesFailoverRequest instance + */ + InstancesFailoverRequest.create = function create(properties) { + return new InstancesFailoverRequest(properties); + }; + + /** + * Encodes the specified InstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesFailoverRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1.IInstancesFailoverRequest} message InstancesFailoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesFailoverRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.failoverContext != null && Object.hasOwnProperty.call(message, "failoverContext")) + $root.google.cloud.sql.v1.FailoverContext.encode(message.failoverContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesFailoverRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1.IInstancesFailoverRequest} message InstancesFailoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesFailoverRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesFailoverRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesFailoverRequest} InstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesFailoverRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesFailoverRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.failoverContext = $root.google.cloud.sql.v1.FailoverContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesFailoverRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesFailoverRequest} InstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesFailoverRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesFailoverRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesFailoverRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.failoverContext != null && message.hasOwnProperty("failoverContext")) { + var error = $root.google.cloud.sql.v1.FailoverContext.verify(message.failoverContext); + if (error) + return "failoverContext." + error; + } + return null; + }; + + /** + * Creates an InstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesFailoverRequest} InstancesFailoverRequest + */ + InstancesFailoverRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesFailoverRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesFailoverRequest(); + if (object.failoverContext != null) { + if (typeof object.failoverContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesFailoverRequest.failoverContext: object expected"); + message.failoverContext = $root.google.cloud.sql.v1.FailoverContext.fromObject(object.failoverContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesFailoverRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1.InstancesFailoverRequest} message InstancesFailoverRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesFailoverRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.failoverContext = null; + if (message.failoverContext != null && message.hasOwnProperty("failoverContext")) + object.failoverContext = $root.google.cloud.sql.v1.FailoverContext.toObject(message.failoverContext, options); + return object; + }; + + /** + * Converts this InstancesFailoverRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesFailoverRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesFailoverRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesFailoverRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesFailoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesFailoverRequest"; + }; + + return InstancesFailoverRequest; + })(); + + v1.SslCertsCreateEphemeralRequest = (function() { + + /** + * Properties of a SslCertsCreateEphemeralRequest. + * @memberof google.cloud.sql.v1 + * @interface ISslCertsCreateEphemeralRequest + * @property {string|null} [publicKey] SslCertsCreateEphemeralRequest publicKey + * @property {string|null} [accessToken] SslCertsCreateEphemeralRequest accessToken + */ + + /** + * Constructs a new SslCertsCreateEphemeralRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SslCertsCreateEphemeralRequest. + * @implements ISslCertsCreateEphemeralRequest + * @constructor + * @param {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest=} [properties] Properties to set + */ + function SslCertsCreateEphemeralRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCertsCreateEphemeralRequest publicKey. + * @member {string} publicKey + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @instance + */ + SslCertsCreateEphemeralRequest.prototype.publicKey = ""; + + /** + * SslCertsCreateEphemeralRequest accessToken. + * @member {string} accessToken + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @instance + */ + SslCertsCreateEphemeralRequest.prototype.accessToken = ""; + + /** + * Creates a new SslCertsCreateEphemeralRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @static + * @param {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest instance + */ + SslCertsCreateEphemeralRequest.create = function create(properties) { + return new SslCertsCreateEphemeralRequest(properties); + }; + + /** + * Encodes the specified SslCertsCreateEphemeralRequest message. Does not implicitly {@link google.cloud.sql.v1.SslCertsCreateEphemeralRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @static + * @param {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsCreateEphemeralRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.publicKey); + if (message.accessToken != null && Object.hasOwnProperty.call(message, "accessToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.accessToken); + return writer; + }; + + /** + * Encodes the specified SslCertsCreateEphemeralRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsCreateEphemeralRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @static + * @param {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsCreateEphemeralRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsCreateEphemeralRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.publicKey = reader.string(); + break; + } + case 2: { + message.accessToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsCreateEphemeralRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCertsCreateEphemeralRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCertsCreateEphemeralRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + if (!$util.isString(message.publicKey)) + return "publicKey: string expected"; + if (message.accessToken != null && message.hasOwnProperty("accessToken")) + if (!$util.isString(message.accessToken)) + return "accessToken: string expected"; + return null; + }; + + /** + * Creates a SslCertsCreateEphemeralRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest + */ + SslCertsCreateEphemeralRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest) + return object; + var message = new $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest(); + if (object.publicKey != null) + message.publicKey = String(object.publicKey); + if (object.accessToken != null) + message.accessToken = String(object.accessToken); + return message; + }; + + /** + * Creates a plain object from a SslCertsCreateEphemeralRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @static + * @param {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCertsCreateEphemeralRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.publicKey = ""; + object.accessToken = ""; + } + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + object.publicKey = message.publicKey; + if (message.accessToken != null && message.hasOwnProperty("accessToken")) + object.accessToken = message.accessToken; + return object; + }; + + /** + * Converts this SslCertsCreateEphemeralRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @instance + * @returns {Object.} JSON object + */ + SslCertsCreateEphemeralRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCertsCreateEphemeralRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCertsCreateEphemeralRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SslCertsCreateEphemeralRequest"; + }; + + return SslCertsCreateEphemeralRequest; + })(); + + v1.InstancesImportRequest = (function() { + + /** + * Properties of an InstancesImportRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesImportRequest + * @property {google.cloud.sql.v1.IImportContext|null} [importContext] InstancesImportRequest importContext + */ + + /** + * Constructs a new InstancesImportRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesImportRequest. + * @implements IInstancesImportRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesImportRequest=} [properties] Properties to set + */ + function InstancesImportRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesImportRequest importContext. + * @member {google.cloud.sql.v1.IImportContext|null|undefined} importContext + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @instance + */ + InstancesImportRequest.prototype.importContext = null; + + /** + * Creates a new InstancesImportRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @static + * @param {google.cloud.sql.v1.IInstancesImportRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesImportRequest} InstancesImportRequest instance + */ + InstancesImportRequest.create = function create(properties) { + return new InstancesImportRequest(properties); + }; + + /** + * Encodes the specified InstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesImportRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @static + * @param {google.cloud.sql.v1.IInstancesImportRequest} message InstancesImportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesImportRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.importContext != null && Object.hasOwnProperty.call(message, "importContext")) + $root.google.cloud.sql.v1.ImportContext.encode(message.importContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesImportRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @static + * @param {google.cloud.sql.v1.IInstancesImportRequest} message InstancesImportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesImportRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesImportRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesImportRequest} InstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesImportRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesImportRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.importContext = $root.google.cloud.sql.v1.ImportContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesImportRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesImportRequest} InstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesImportRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesImportRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesImportRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.importContext != null && message.hasOwnProperty("importContext")) { + var error = $root.google.cloud.sql.v1.ImportContext.verify(message.importContext); + if (error) + return "importContext." + error; + } + return null; + }; + + /** + * Creates an InstancesImportRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesImportRequest} InstancesImportRequest + */ + InstancesImportRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesImportRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesImportRequest(); + if (object.importContext != null) { + if (typeof object.importContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesImportRequest.importContext: object expected"); + message.importContext = $root.google.cloud.sql.v1.ImportContext.fromObject(object.importContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesImportRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @static + * @param {google.cloud.sql.v1.InstancesImportRequest} message InstancesImportRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesImportRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.importContext = null; + if (message.importContext != null && message.hasOwnProperty("importContext")) + object.importContext = $root.google.cloud.sql.v1.ImportContext.toObject(message.importContext, options); + return object; + }; + + /** + * Converts this InstancesImportRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesImportRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesImportRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesImportRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesImportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesImportRequest"; + }; + + return InstancesImportRequest; + })(); + + v1.InstancesPreCheckMajorVersionUpgradeRequest = (function() { + + /** + * Properties of an InstancesPreCheckMajorVersionUpgradeRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesPreCheckMajorVersionUpgradeRequest + * @property {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null} [preCheckMajorVersionUpgradeContext] InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext + */ + + /** + * Constructs a new InstancesPreCheckMajorVersionUpgradeRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesPreCheckMajorVersionUpgradeRequest. + * @implements IInstancesPreCheckMajorVersionUpgradeRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set + */ + function InstancesPreCheckMajorVersionUpgradeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext. + * @member {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null|undefined} preCheckMajorVersionUpgradeContext + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @instance + */ + InstancesPreCheckMajorVersionUpgradeRequest.prototype.preCheckMajorVersionUpgradeContext = null; + + /** + * Creates a new InstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest instance + */ + InstancesPreCheckMajorVersionUpgradeRequest.create = function create(properties) { + return new InstancesPreCheckMajorVersionUpgradeRequest(properties); + }; + + /** + * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesPreCheckMajorVersionUpgradeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.preCheckMajorVersionUpgradeContext != null && Object.hasOwnProperty.call(message, "preCheckMajorVersionUpgradeContext")) + $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.encode(message.preCheckMajorVersionUpgradeContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesPreCheckMajorVersionUpgradeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesPreCheckMajorVersionUpgradeRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesPreCheckMajorVersionUpgradeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesPreCheckMajorVersionUpgradeRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesPreCheckMajorVersionUpgradeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) { + var error = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify(message.preCheckMajorVersionUpgradeContext); + if (error) + return "preCheckMajorVersionUpgradeContext." + error; + } + return null; + }; + + /** + * Creates an InstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest + */ + InstancesPreCheckMajorVersionUpgradeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest(); + if (object.preCheckMajorVersionUpgradeContext != null) { + if (typeof object.preCheckMajorVersionUpgradeContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.preCheckMajorVersionUpgradeContext: object expected"); + message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.fromObject(object.preCheckMajorVersionUpgradeContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesPreCheckMajorVersionUpgradeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.preCheckMajorVersionUpgradeContext = null; + if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) + object.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.toObject(message.preCheckMajorVersionUpgradeContext, options); + return object; + }; + + /** + * Converts this InstancesPreCheckMajorVersionUpgradeRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesPreCheckMajorVersionUpgradeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesPreCheckMajorVersionUpgradeRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesPreCheckMajorVersionUpgradeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest"; + }; + + return InstancesPreCheckMajorVersionUpgradeRequest; + })(); + + v1.InstancesListResponse = (function() { + + /** + * Properties of an InstancesListResponse. + * @memberof google.cloud.sql.v1 + * @interface IInstancesListResponse + * @property {string|null} [kind] InstancesListResponse kind + * @property {Array.|null} [warnings] InstancesListResponse warnings + * @property {Array.|null} [items] InstancesListResponse items + * @property {string|null} [nextPageToken] InstancesListResponse nextPageToken + */ + + /** + * Constructs a new InstancesListResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesListResponse. + * @implements IInstancesListResponse + * @constructor + * @param {google.cloud.sql.v1.IInstancesListResponse=} [properties] Properties to set + */ + function InstancesListResponse(properties) { + this.warnings = []; + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.InstancesListResponse + * @instance + */ + InstancesListResponse.prototype.kind = ""; + + /** + * InstancesListResponse warnings. + * @member {Array.} warnings + * @memberof google.cloud.sql.v1.InstancesListResponse + * @instance + */ + InstancesListResponse.prototype.warnings = $util.emptyArray; + + /** + * InstancesListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1.InstancesListResponse + * @instance + */ + InstancesListResponse.prototype.items = $util.emptyArray; + + /** + * InstancesListResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.sql.v1.InstancesListResponse + * @instance + */ + InstancesListResponse.prototype.nextPageToken = ""; + + /** + * Creates a new InstancesListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesListResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesListResponse} InstancesListResponse instance + */ + InstancesListResponse.create = function create(properties) { + return new InstancesListResponse(properties); + }; + + /** + * Encodes the specified InstancesListResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesListResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListResponse} message InstancesListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + $root.google.cloud.sql.v1.ApiWarning.encode(message.warnings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1.DatabaseInstance.encode(message.items[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified InstancesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesListResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListResponse} message InstancesListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesListResponse} InstancesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push($root.google.cloud.sql.v1.ApiWarning.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32())); + break; + } + case 4: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesListResponse} InstancesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesListResponse message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) { + var error = $root.google.cloud.sql.v1.ApiWarning.verify(message.warnings[i]); + if (error) + return "warnings." + error; + } + } + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates an InstancesListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesListResponse} InstancesListResponse + */ + InstancesListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesListResponse) + return object; + var message = new $root.google.cloud.sql.v1.InstancesListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.sql.v1.InstancesListResponse.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) { + if (typeof object.warnings[i] !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesListResponse.warnings: object expected"); + message.warnings[i] = $root.google.cloud.sql.v1.ApiWarning.fromObject(object.warnings[i]); + } + } + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1.InstancesListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.items[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from an InstancesListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesListResponse + * @static + * @param {google.cloud.sql.v1.InstancesListResponse} message InstancesListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.warnings = []; + object.items = []; + } + if (options.defaults) { + object.kind = ""; + object.nextPageToken = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = $root.google.cloud.sql.v1.ApiWarning.toObject(message.warnings[j], options); + } + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.items[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this InstancesListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesListResponse + * @instance + * @returns {Object.} JSON object + */ + InstancesListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesListResponse"; + }; + + return InstancesListResponse; + })(); + + v1.InstancesListServerCasResponse = (function() { + + /** + * Properties of an InstancesListServerCasResponse. + * @memberof google.cloud.sql.v1 + * @interface IInstancesListServerCasResponse + * @property {Array.|null} [certs] InstancesListServerCasResponse certs + * @property {string|null} [activeVersion] InstancesListServerCasResponse activeVersion + * @property {string|null} [kind] InstancesListServerCasResponse kind + */ + + /** + * Constructs a new InstancesListServerCasResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesListServerCasResponse. + * @implements IInstancesListServerCasResponse + * @constructor + * @param {google.cloud.sql.v1.IInstancesListServerCasResponse=} [properties] Properties to set + */ + function InstancesListServerCasResponse(properties) { + this.certs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesListServerCasResponse certs. + * @member {Array.} certs + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @instance + */ + InstancesListServerCasResponse.prototype.certs = $util.emptyArray; + + /** + * InstancesListServerCasResponse activeVersion. + * @member {string} activeVersion + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @instance + */ + InstancesListServerCasResponse.prototype.activeVersion = ""; + + /** + * InstancesListServerCasResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @instance + */ + InstancesListServerCasResponse.prototype.kind = ""; + + /** + * Creates a new InstancesListServerCasResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListServerCasResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesListServerCasResponse} InstancesListServerCasResponse instance + */ + InstancesListServerCasResponse.create = function create(properties) { + return new InstancesListServerCasResponse(properties); + }; + + /** + * Encodes the specified InstancesListServerCasResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCasResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListServerCasResponse} message InstancesListServerCasResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListServerCasResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certs != null && message.certs.length) + for (var i = 0; i < message.certs.length; ++i) + $root.google.cloud.sql.v1.SslCert.encode(message.certs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.activeVersion); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + return writer; + }; + + /** + * Encodes the specified InstancesListServerCasResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCasResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListServerCasResponse} message InstancesListServerCasResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListServerCasResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesListServerCasResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesListServerCasResponse} InstancesListServerCasResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListServerCasResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesListServerCasResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.certs && message.certs.length)) + message.certs = []; + message.certs.push($root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32())); + break; + } + case 2: { + message.activeVersion = reader.string(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesListServerCasResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesListServerCasResponse} InstancesListServerCasResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListServerCasResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesListServerCasResponse message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesListServerCasResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certs != null && message.hasOwnProperty("certs")) { + if (!Array.isArray(message.certs)) + return "certs: array expected"; + for (var i = 0; i < message.certs.length; ++i) { + var error = $root.google.cloud.sql.v1.SslCert.verify(message.certs[i]); + if (error) + return "certs." + error; + } + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + if (!$util.isString(message.activeVersion)) + return "activeVersion: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates an InstancesListServerCasResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesListServerCasResponse} InstancesListServerCasResponse + */ + InstancesListServerCasResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesListServerCasResponse) + return object; + var message = new $root.google.cloud.sql.v1.InstancesListServerCasResponse(); + if (object.certs) { + if (!Array.isArray(object.certs)) + throw TypeError(".google.cloud.sql.v1.InstancesListServerCasResponse.certs: array expected"); + message.certs = []; + for (var i = 0; i < object.certs.length; ++i) { + if (typeof object.certs[i] !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesListServerCasResponse.certs: object expected"); + message.certs[i] = $root.google.cloud.sql.v1.SslCert.fromObject(object.certs[i]); + } + } + if (object.activeVersion != null) + message.activeVersion = String(object.activeVersion); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from an InstancesListServerCasResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @static + * @param {google.cloud.sql.v1.InstancesListServerCasResponse} message InstancesListServerCasResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesListServerCasResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.certs = []; + if (options.defaults) { + object.activeVersion = ""; + object.kind = ""; + } + if (message.certs && message.certs.length) { + object.certs = []; + for (var j = 0; j < message.certs.length; ++j) + object.certs[j] = $root.google.cloud.sql.v1.SslCert.toObject(message.certs[j], options); + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + object.activeVersion = message.activeVersion; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this InstancesListServerCasResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @instance + * @returns {Object.} JSON object + */ + InstancesListServerCasResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesListServerCasResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesListServerCasResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesListServerCasResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesListServerCasResponse"; + }; + + return InstancesListServerCasResponse; + })(); + + v1.InstancesListServerCertificatesResponse = (function() { + + /** + * Properties of an InstancesListServerCertificatesResponse. + * @memberof google.cloud.sql.v1 + * @interface IInstancesListServerCertificatesResponse + * @property {Array.|null} [caCerts] InstancesListServerCertificatesResponse caCerts + * @property {Array.|null} [serverCerts] InstancesListServerCertificatesResponse serverCerts + * @property {string|null} [activeVersion] InstancesListServerCertificatesResponse activeVersion + * @property {string|null} [kind] InstancesListServerCertificatesResponse kind + */ + + /** + * Constructs a new InstancesListServerCertificatesResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesListServerCertificatesResponse. + * @implements IInstancesListServerCertificatesResponse + * @constructor + * @param {google.cloud.sql.v1.IInstancesListServerCertificatesResponse=} [properties] Properties to set + */ + function InstancesListServerCertificatesResponse(properties) { + this.caCerts = []; + this.serverCerts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesListServerCertificatesResponse caCerts. + * @member {Array.} caCerts + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @instance + */ + InstancesListServerCertificatesResponse.prototype.caCerts = $util.emptyArray; + + /** + * InstancesListServerCertificatesResponse serverCerts. + * @member {Array.} serverCerts + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @instance + */ + InstancesListServerCertificatesResponse.prototype.serverCerts = $util.emptyArray; + + /** + * InstancesListServerCertificatesResponse activeVersion. + * @member {string} activeVersion + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @instance + */ + InstancesListServerCertificatesResponse.prototype.activeVersion = ""; + + /** + * InstancesListServerCertificatesResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @instance + */ + InstancesListServerCertificatesResponse.prototype.kind = ""; + + /** + * Creates a new InstancesListServerCertificatesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListServerCertificatesResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse instance + */ + InstancesListServerCertificatesResponse.create = function create(properties) { + return new InstancesListServerCertificatesResponse(properties); + }; + + /** + * Encodes the specified InstancesListServerCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCertificatesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListServerCertificatesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.caCerts != null && message.caCerts.length) + for (var i = 0; i < message.caCerts.length; ++i) + $root.google.cloud.sql.v1.SslCert.encode(message.caCerts[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.serverCerts != null && message.serverCerts.length) + for (var i = 0; i < message.serverCerts.length; ++i) + $root.google.cloud.sql.v1.SslCert.encode(message.serverCerts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.activeVersion); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); + return writer; + }; + + /** + * Encodes the specified InstancesListServerCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCertificatesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListServerCertificatesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListServerCertificatesResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesListServerCertificatesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.caCerts && message.caCerts.length)) + message.caCerts = []; + message.caCerts.push($root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.serverCerts && message.serverCerts.length)) + message.serverCerts = []; + message.serverCerts.push($root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32())); + break; + } + case 3: { + message.activeVersion = reader.string(); + break; + } + case 4: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListServerCertificatesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesListServerCertificatesResponse message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesListServerCertificatesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.caCerts != null && message.hasOwnProperty("caCerts")) { + if (!Array.isArray(message.caCerts)) + return "caCerts: array expected"; + for (var i = 0; i < message.caCerts.length; ++i) { + var error = $root.google.cloud.sql.v1.SslCert.verify(message.caCerts[i]); + if (error) + return "caCerts." + error; + } + } + if (message.serverCerts != null && message.hasOwnProperty("serverCerts")) { + if (!Array.isArray(message.serverCerts)) + return "serverCerts: array expected"; + for (var i = 0; i < message.serverCerts.length; ++i) { + var error = $root.google.cloud.sql.v1.SslCert.verify(message.serverCerts[i]); + if (error) + return "serverCerts." + error; + } + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + if (!$util.isString(message.activeVersion)) + return "activeVersion: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates an InstancesListServerCertificatesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse + */ + InstancesListServerCertificatesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesListServerCertificatesResponse) + return object; + var message = new $root.google.cloud.sql.v1.InstancesListServerCertificatesResponse(); + if (object.caCerts) { + if (!Array.isArray(object.caCerts)) + throw TypeError(".google.cloud.sql.v1.InstancesListServerCertificatesResponse.caCerts: array expected"); + message.caCerts = []; + for (var i = 0; i < object.caCerts.length; ++i) { + if (typeof object.caCerts[i] !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesListServerCertificatesResponse.caCerts: object expected"); + message.caCerts[i] = $root.google.cloud.sql.v1.SslCert.fromObject(object.caCerts[i]); + } + } + if (object.serverCerts) { + if (!Array.isArray(object.serverCerts)) + throw TypeError(".google.cloud.sql.v1.InstancesListServerCertificatesResponse.serverCerts: array expected"); + message.serverCerts = []; + for (var i = 0; i < object.serverCerts.length; ++i) { + if (typeof object.serverCerts[i] !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesListServerCertificatesResponse.serverCerts: object expected"); + message.serverCerts[i] = $root.google.cloud.sql.v1.SslCert.fromObject(object.serverCerts[i]); + } + } + if (object.activeVersion != null) + message.activeVersion = String(object.activeVersion); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from an InstancesListServerCertificatesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @static + * @param {google.cloud.sql.v1.InstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesListServerCertificatesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.caCerts = []; + object.serverCerts = []; + } + if (options.defaults) { + object.activeVersion = ""; + object.kind = ""; + } + if (message.caCerts && message.caCerts.length) { + object.caCerts = []; + for (var j = 0; j < message.caCerts.length; ++j) + object.caCerts[j] = $root.google.cloud.sql.v1.SslCert.toObject(message.caCerts[j], options); + } + if (message.serverCerts && message.serverCerts.length) { + object.serverCerts = []; + for (var j = 0; j < message.serverCerts.length; ++j) + object.serverCerts[j] = $root.google.cloud.sql.v1.SslCert.toObject(message.serverCerts[j], options); + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + object.activeVersion = message.activeVersion; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this InstancesListServerCertificatesResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @instance + * @returns {Object.} JSON object + */ + InstancesListServerCertificatesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesListServerCertificatesResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesListServerCertificatesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesListServerCertificatesResponse"; + }; + + return InstancesListServerCertificatesResponse; + })(); + + v1.InstancesListEntraIdCertificatesResponse = (function() { + + /** + * Properties of an InstancesListEntraIdCertificatesResponse. + * @memberof google.cloud.sql.v1 + * @interface IInstancesListEntraIdCertificatesResponse + * @property {Array.|null} [certs] InstancesListEntraIdCertificatesResponse certs + * @property {string|null} [activeVersion] InstancesListEntraIdCertificatesResponse activeVersion + * @property {string|null} [kind] InstancesListEntraIdCertificatesResponse kind + */ + + /** + * Constructs a new InstancesListEntraIdCertificatesResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesListEntraIdCertificatesResponse. + * @implements IInstancesListEntraIdCertificatesResponse + * @constructor + * @param {google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse=} [properties] Properties to set + */ + function InstancesListEntraIdCertificatesResponse(properties) { + this.certs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesListEntraIdCertificatesResponse certs. + * @member {Array.} certs + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @instance + */ + InstancesListEntraIdCertificatesResponse.prototype.certs = $util.emptyArray; + + /** + * InstancesListEntraIdCertificatesResponse activeVersion. + * @member {string} activeVersion + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @instance + */ + InstancesListEntraIdCertificatesResponse.prototype.activeVersion = ""; + + /** + * InstancesListEntraIdCertificatesResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @instance + */ + InstancesListEntraIdCertificatesResponse.prototype.kind = ""; + + /** + * Creates a new InstancesListEntraIdCertificatesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse instance + */ + InstancesListEntraIdCertificatesResponse.create = function create(properties) { + return new InstancesListEntraIdCertificatesResponse(properties); + }; + + /** + * Encodes the specified InstancesListEntraIdCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListEntraIdCertificatesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certs != null && message.certs.length) + for (var i = 0; i < message.certs.length; ++i) + $root.google.cloud.sql.v1.SslCert.encode(message.certs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.activeVersion); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + return writer; + }; + + /** + * Encodes the specified InstancesListEntraIdCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @static + * @param {google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListEntraIdCertificatesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListEntraIdCertificatesResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.certs && message.certs.length)) + message.certs = []; + message.certs.push($root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32())); + break; + } + case 2: { + message.activeVersion = reader.string(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListEntraIdCertificatesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesListEntraIdCertificatesResponse message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesListEntraIdCertificatesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certs != null && message.hasOwnProperty("certs")) { + if (!Array.isArray(message.certs)) + return "certs: array expected"; + for (var i = 0; i < message.certs.length; ++i) { + var error = $root.google.cloud.sql.v1.SslCert.verify(message.certs[i]); + if (error) + return "certs." + error; + } + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + if (!$util.isString(message.activeVersion)) + return "activeVersion: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates an InstancesListEntraIdCertificatesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse + */ + InstancesListEntraIdCertificatesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse) + return object; + var message = new $root.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse(); + if (object.certs) { + if (!Array.isArray(object.certs)) + throw TypeError(".google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.certs: array expected"); + message.certs = []; + for (var i = 0; i < object.certs.length; ++i) { + if (typeof object.certs[i] !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.certs: object expected"); + message.certs[i] = $root.google.cloud.sql.v1.SslCert.fromObject(object.certs[i]); + } + } + if (object.activeVersion != null) + message.activeVersion = String(object.activeVersion); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from an InstancesListEntraIdCertificatesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @static + * @param {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesListEntraIdCertificatesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.certs = []; + if (options.defaults) { + object.activeVersion = ""; + object.kind = ""; + } + if (message.certs && message.certs.length) { + object.certs = []; + for (var j = 0; j < message.certs.length; ++j) + object.certs[j] = $root.google.cloud.sql.v1.SslCert.toObject(message.certs[j], options); + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + object.activeVersion = message.activeVersion; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this InstancesListEntraIdCertificatesResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @instance + * @returns {Object.} JSON object + */ + InstancesListEntraIdCertificatesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesListEntraIdCertificatesResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesListEntraIdCertificatesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse"; + }; + + return InstancesListEntraIdCertificatesResponse; + })(); + + v1.InstancesRestoreBackupRequest = (function() { + + /** + * Properties of an InstancesRestoreBackupRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesRestoreBackupRequest + * @property {google.cloud.sql.v1.IRestoreBackupContext|null} [restoreBackupContext] InstancesRestoreBackupRequest restoreBackupContext + * @property {string|null} [backup] InstancesRestoreBackupRequest backup + * @property {string|null} [backupdrBackup] InstancesRestoreBackupRequest backupdrBackup + * @property {google.cloud.sql.v1.IDatabaseInstance|null} [restoreInstanceSettings] InstancesRestoreBackupRequest restoreInstanceSettings + * @property {Array.|null} [restoreInstanceClearOverridesFieldNames] InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames + */ + + /** + * Constructs a new InstancesRestoreBackupRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesRestoreBackupRequest. + * @implements IInstancesRestoreBackupRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesRestoreBackupRequest=} [properties] Properties to set + */ + function InstancesRestoreBackupRequest(properties) { + this.restoreInstanceClearOverridesFieldNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesRestoreBackupRequest restoreBackupContext. + * @member {google.cloud.sql.v1.IRestoreBackupContext|null|undefined} restoreBackupContext + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @instance + */ + InstancesRestoreBackupRequest.prototype.restoreBackupContext = null; + + /** + * InstancesRestoreBackupRequest backup. + * @member {string} backup + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @instance + */ + InstancesRestoreBackupRequest.prototype.backup = ""; + + /** + * InstancesRestoreBackupRequest backupdrBackup. + * @member {string} backupdrBackup + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @instance + */ + InstancesRestoreBackupRequest.prototype.backupdrBackup = ""; + + /** + * InstancesRestoreBackupRequest restoreInstanceSettings. + * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} restoreInstanceSettings + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @instance + */ + InstancesRestoreBackupRequest.prototype.restoreInstanceSettings = null; + + /** + * InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames. + * @member {Array.} restoreInstanceClearOverridesFieldNames + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @instance + */ + InstancesRestoreBackupRequest.prototype.restoreInstanceClearOverridesFieldNames = $util.emptyArray; + + /** + * Creates a new InstancesRestoreBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRestoreBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest instance + */ + InstancesRestoreBackupRequest.create = function create(properties) { + return new InstancesRestoreBackupRequest(properties); + }; + + /** + * Encodes the specified InstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRestoreBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRestoreBackupRequest} message InstancesRestoreBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRestoreBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restoreBackupContext != null && Object.hasOwnProperty.call(message, "restoreBackupContext")) + $root.google.cloud.sql.v1.RestoreBackupContext.encode(message.restoreBackupContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.backup); + if (message.restoreInstanceSettings != null && Object.hasOwnProperty.call(message, "restoreInstanceSettings")) + $root.google.cloud.sql.v1.DatabaseInstance.encode(message.restoreInstanceSettings, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.backupdrBackup != null && Object.hasOwnProperty.call(message, "backupdrBackup")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.backupdrBackup); + if (message.restoreInstanceClearOverridesFieldNames != null && message.restoreInstanceClearOverridesFieldNames.length) + for (var i = 0; i < message.restoreInstanceClearOverridesFieldNames.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.restoreInstanceClearOverridesFieldNames[i]); + return writer; + }; + + /** + * Encodes the specified InstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRestoreBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRestoreBackupRequest} message InstancesRestoreBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRestoreBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRestoreBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesRestoreBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restoreBackupContext = $root.google.cloud.sql.v1.RestoreBackupContext.decode(reader, reader.uint32()); + break; + } + case 2: { + message.backup = reader.string(); + break; + } + case 4: { + message.backupdrBackup = reader.string(); + break; + } + case 3: { + message.restoreInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.restoreInstanceClearOverridesFieldNames && message.restoreInstanceClearOverridesFieldNames.length)) + message.restoreInstanceClearOverridesFieldNames = []; + message.restoreInstanceClearOverridesFieldNames.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRestoreBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesRestoreBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesRestoreBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restoreBackupContext != null && message.hasOwnProperty("restoreBackupContext")) { + var error = $root.google.cloud.sql.v1.RestoreBackupContext.verify(message.restoreBackupContext); + if (error) + return "restoreBackupContext." + error; + } + if (message.backup != null && message.hasOwnProperty("backup")) + if (!$util.isString(message.backup)) + return "backup: string expected"; + if (message.backupdrBackup != null && message.hasOwnProperty("backupdrBackup")) + if (!$util.isString(message.backupdrBackup)) + return "backupdrBackup: string expected"; + if (message.restoreInstanceSettings != null && message.hasOwnProperty("restoreInstanceSettings")) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.restoreInstanceSettings); + if (error) + return "restoreInstanceSettings." + error; + } + if (message.restoreInstanceClearOverridesFieldNames != null && message.hasOwnProperty("restoreInstanceClearOverridesFieldNames")) { + if (!Array.isArray(message.restoreInstanceClearOverridesFieldNames)) + return "restoreInstanceClearOverridesFieldNames: array expected"; + for (var i = 0; i < message.restoreInstanceClearOverridesFieldNames.length; ++i) + if (!$util.isString(message.restoreInstanceClearOverridesFieldNames[i])) + return "restoreInstanceClearOverridesFieldNames: string[] expected"; + } + return null; + }; + + /** + * Creates an InstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest + */ + InstancesRestoreBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesRestoreBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesRestoreBackupRequest(); + if (object.restoreBackupContext != null) { + if (typeof object.restoreBackupContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesRestoreBackupRequest.restoreBackupContext: object expected"); + message.restoreBackupContext = $root.google.cloud.sql.v1.RestoreBackupContext.fromObject(object.restoreBackupContext); + } + if (object.backup != null) + message.backup = String(object.backup); + if (object.backupdrBackup != null) + message.backupdrBackup = String(object.backupdrBackup); + if (object.restoreInstanceSettings != null) { + if (typeof object.restoreInstanceSettings !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesRestoreBackupRequest.restoreInstanceSettings: object expected"); + message.restoreInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.restoreInstanceSettings); + } + if (object.restoreInstanceClearOverridesFieldNames) { + if (!Array.isArray(object.restoreInstanceClearOverridesFieldNames)) + throw TypeError(".google.cloud.sql.v1.InstancesRestoreBackupRequest.restoreInstanceClearOverridesFieldNames: array expected"); + message.restoreInstanceClearOverridesFieldNames = []; + for (var i = 0; i < object.restoreInstanceClearOverridesFieldNames.length; ++i) + message.restoreInstanceClearOverridesFieldNames[i] = String(object.restoreInstanceClearOverridesFieldNames[i]); + } + return message; + }; + + /** + * Creates a plain object from an InstancesRestoreBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1.InstancesRestoreBackupRequest} message InstancesRestoreBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesRestoreBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.restoreInstanceClearOverridesFieldNames = []; + if (options.defaults) { + object.restoreBackupContext = null; + object.backup = ""; + object.restoreInstanceSettings = null; + object.backupdrBackup = ""; + } + if (message.restoreBackupContext != null && message.hasOwnProperty("restoreBackupContext")) + object.restoreBackupContext = $root.google.cloud.sql.v1.RestoreBackupContext.toObject(message.restoreBackupContext, options); + if (message.backup != null && message.hasOwnProperty("backup")) + object.backup = message.backup; + if (message.restoreInstanceSettings != null && message.hasOwnProperty("restoreInstanceSettings")) + object.restoreInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.restoreInstanceSettings, options); + if (message.backupdrBackup != null && message.hasOwnProperty("backupdrBackup")) + object.backupdrBackup = message.backupdrBackup; + if (message.restoreInstanceClearOverridesFieldNames && message.restoreInstanceClearOverridesFieldNames.length) { + object.restoreInstanceClearOverridesFieldNames = []; + for (var j = 0; j < message.restoreInstanceClearOverridesFieldNames.length; ++j) + object.restoreInstanceClearOverridesFieldNames[j] = message.restoreInstanceClearOverridesFieldNames[j]; + } + return object; + }; + + /** + * Converts this InstancesRestoreBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesRestoreBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesRestoreBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesRestoreBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesRestoreBackupRequest"; + }; + + return InstancesRestoreBackupRequest; + })(); + + v1.InstancesRotateServerCaRequest = (function() { + + /** + * Properties of an InstancesRotateServerCaRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesRotateServerCaRequest + * @property {google.cloud.sql.v1.IRotateServerCaContext|null} [rotateServerCaContext] InstancesRotateServerCaRequest rotateServerCaContext + */ + + /** + * Constructs a new InstancesRotateServerCaRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesRotateServerCaRequest. + * @implements IInstancesRotateServerCaRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesRotateServerCaRequest=} [properties] Properties to set + */ + function InstancesRotateServerCaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesRotateServerCaRequest rotateServerCaContext. + * @member {google.cloud.sql.v1.IRotateServerCaContext|null|undefined} rotateServerCaContext + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @instance + */ + InstancesRotateServerCaRequest.prototype.rotateServerCaContext = null; + + /** + * Creates a new InstancesRotateServerCaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRotateServerCaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest instance + */ + InstancesRotateServerCaRequest.create = function create(properties) { + return new InstancesRotateServerCaRequest(properties); + }; + + /** + * Encodes the specified InstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRotateServerCaRequest} message InstancesRotateServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateServerCaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rotateServerCaContext != null && Object.hasOwnProperty.call(message, "rotateServerCaContext")) + $root.google.cloud.sql.v1.RotateServerCaContext.encode(message.rotateServerCaContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRotateServerCaRequest} message InstancesRotateServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateServerCaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesRotateServerCaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.rotateServerCaContext = $root.google.cloud.sql.v1.RotateServerCaContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateServerCaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesRotateServerCaRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesRotateServerCaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rotateServerCaContext != null && message.hasOwnProperty("rotateServerCaContext")) { + var error = $root.google.cloud.sql.v1.RotateServerCaContext.verify(message.rotateServerCaContext); + if (error) + return "rotateServerCaContext." + error; + } + return null; + }; + + /** + * Creates an InstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest + */ + InstancesRotateServerCaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesRotateServerCaRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesRotateServerCaRequest(); + if (object.rotateServerCaContext != null) { + if (typeof object.rotateServerCaContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesRotateServerCaRequest.rotateServerCaContext: object expected"); + message.rotateServerCaContext = $root.google.cloud.sql.v1.RotateServerCaContext.fromObject(object.rotateServerCaContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesRotateServerCaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1.InstancesRotateServerCaRequest} message InstancesRotateServerCaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesRotateServerCaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.rotateServerCaContext = null; + if (message.rotateServerCaContext != null && message.hasOwnProperty("rotateServerCaContext")) + object.rotateServerCaContext = $root.google.cloud.sql.v1.RotateServerCaContext.toObject(message.rotateServerCaContext, options); + return object; + }; + + /** + * Converts this InstancesRotateServerCaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesRotateServerCaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesRotateServerCaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesRotateServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesRotateServerCaRequest"; + }; + + return InstancesRotateServerCaRequest; + })(); + + v1.InstancesRotateServerCertificateRequest = (function() { + + /** + * Properties of an InstancesRotateServerCertificateRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesRotateServerCertificateRequest + * @property {google.cloud.sql.v1.IRotateServerCertificateContext|null} [rotateServerCertificateContext] InstancesRotateServerCertificateRequest rotateServerCertificateContext + */ + + /** + * Constructs a new InstancesRotateServerCertificateRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesRotateServerCertificateRequest. + * @implements IInstancesRotateServerCertificateRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest=} [properties] Properties to set + */ + function InstancesRotateServerCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesRotateServerCertificateRequest rotateServerCertificateContext. + * @member {google.cloud.sql.v1.IRotateServerCertificateContext|null|undefined} rotateServerCertificateContext + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @instance + */ + InstancesRotateServerCertificateRequest.prototype.rotateServerCertificateContext = null; + + /** + * Creates a new InstancesRotateServerCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest instance + */ + InstancesRotateServerCertificateRequest.create = function create(properties) { + return new InstancesRotateServerCertificateRequest(properties); + }; + + /** + * Encodes the specified InstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateServerCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rotateServerCertificateContext != null && Object.hasOwnProperty.call(message, "rotateServerCertificateContext")) + $root.google.cloud.sql.v1.RotateServerCertificateContext.encode(message.rotateServerCertificateContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateServerCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.rotateServerCertificateContext = $root.google.cloud.sql.v1.RotateServerCertificateContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesRotateServerCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesRotateServerCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rotateServerCertificateContext != null && message.hasOwnProperty("rotateServerCertificateContext")) { + var error = $root.google.cloud.sql.v1.RotateServerCertificateContext.verify(message.rotateServerCertificateContext); + if (error) + return "rotateServerCertificateContext." + error; + } + return null; + }; + + /** + * Creates an InstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest + */ + InstancesRotateServerCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest(); + if (object.rotateServerCertificateContext != null) { + if (typeof object.rotateServerCertificateContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesRotateServerCertificateRequest.rotateServerCertificateContext: object expected"); + message.rotateServerCertificateContext = $root.google.cloud.sql.v1.RotateServerCertificateContext.fromObject(object.rotateServerCertificateContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesRotateServerCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesRotateServerCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.rotateServerCertificateContext = null; + if (message.rotateServerCertificateContext != null && message.hasOwnProperty("rotateServerCertificateContext")) + object.rotateServerCertificateContext = $root.google.cloud.sql.v1.RotateServerCertificateContext.toObject(message.rotateServerCertificateContext, options); + return object; + }; + + /** + * Converts this InstancesRotateServerCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesRotateServerCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesRotateServerCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesRotateServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesRotateServerCertificateRequest"; + }; + + return InstancesRotateServerCertificateRequest; + })(); + + v1.InstancesRotateEntraIdCertificateRequest = (function() { + + /** + * Properties of an InstancesRotateEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesRotateEntraIdCertificateRequest + * @property {google.cloud.sql.v1.IRotateEntraIdCertificateContext|null} [rotateEntraIdCertificateContext] InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext + */ + + /** + * Constructs a new InstancesRotateEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesRotateEntraIdCertificateRequest. + * @implements IInstancesRotateEntraIdCertificateRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set + */ + function InstancesRotateEntraIdCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext. + * @member {google.cloud.sql.v1.IRotateEntraIdCertificateContext|null|undefined} rotateEntraIdCertificateContext + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @instance + */ + InstancesRotateEntraIdCertificateRequest.prototype.rotateEntraIdCertificateContext = null; + + /** + * Creates a new InstancesRotateEntraIdCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest instance + */ + InstancesRotateEntraIdCertificateRequest.create = function create(properties) { + return new InstancesRotateEntraIdCertificateRequest(properties); + }; + + /** + * Encodes the specified InstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateEntraIdCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rotateEntraIdCertificateContext != null && Object.hasOwnProperty.call(message, "rotateEntraIdCertificateContext")) + $root.google.cloud.sql.v1.RotateEntraIdCertificateContext.encode(message.rotateEntraIdCertificateContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateEntraIdCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1.RotateEntraIdCertificateContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesRotateEntraIdCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesRotateEntraIdCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rotateEntraIdCertificateContext != null && message.hasOwnProperty("rotateEntraIdCertificateContext")) { + var error = $root.google.cloud.sql.v1.RotateEntraIdCertificateContext.verify(message.rotateEntraIdCertificateContext); + if (error) + return "rotateEntraIdCertificateContext." + error; + } + return null; + }; + + /** + * Creates an InstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest + */ + InstancesRotateEntraIdCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest(); + if (object.rotateEntraIdCertificateContext != null) { + if (typeof object.rotateEntraIdCertificateContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.rotateEntraIdCertificateContext: object expected"); + message.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1.RotateEntraIdCertificateContext.fromObject(object.rotateEntraIdCertificateContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesRotateEntraIdCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.rotateEntraIdCertificateContext = null; + if (message.rotateEntraIdCertificateContext != null && message.hasOwnProperty("rotateEntraIdCertificateContext")) + object.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1.RotateEntraIdCertificateContext.toObject(message.rotateEntraIdCertificateContext, options); + return object; + }; + + /** + * Converts this InstancesRotateEntraIdCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesRotateEntraIdCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesRotateEntraIdCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesRotateEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest"; + }; + + return InstancesRotateEntraIdCertificateRequest; + })(); + + v1.InstancesTruncateLogRequest = (function() { + + /** + * Properties of an InstancesTruncateLogRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesTruncateLogRequest + * @property {google.cloud.sql.v1.ITruncateLogContext|null} [truncateLogContext] InstancesTruncateLogRequest truncateLogContext + */ + + /** + * Constructs a new InstancesTruncateLogRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesTruncateLogRequest. + * @implements IInstancesTruncateLogRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesTruncateLogRequest=} [properties] Properties to set + */ + function InstancesTruncateLogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesTruncateLogRequest truncateLogContext. + * @member {google.cloud.sql.v1.ITruncateLogContext|null|undefined} truncateLogContext + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @instance + */ + InstancesTruncateLogRequest.prototype.truncateLogContext = null; + + /** + * Creates a new InstancesTruncateLogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1.IInstancesTruncateLogRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesTruncateLogRequest} InstancesTruncateLogRequest instance + */ + InstancesTruncateLogRequest.create = function create(properties) { + return new InstancesTruncateLogRequest(properties); + }; + + /** + * Encodes the specified InstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesTruncateLogRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1.IInstancesTruncateLogRequest} message InstancesTruncateLogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesTruncateLogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.truncateLogContext != null && Object.hasOwnProperty.call(message, "truncateLogContext")) + $root.google.cloud.sql.v1.TruncateLogContext.encode(message.truncateLogContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesTruncateLogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1.IInstancesTruncateLogRequest} message InstancesTruncateLogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesTruncateLogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesTruncateLogRequest} InstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesTruncateLogRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesTruncateLogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.truncateLogContext = $root.google.cloud.sql.v1.TruncateLogContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesTruncateLogRequest} InstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesTruncateLogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesTruncateLogRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesTruncateLogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.truncateLogContext != null && message.hasOwnProperty("truncateLogContext")) { + var error = $root.google.cloud.sql.v1.TruncateLogContext.verify(message.truncateLogContext); + if (error) + return "truncateLogContext." + error; + } + return null; + }; + + /** + * Creates an InstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesTruncateLogRequest} InstancesTruncateLogRequest + */ + InstancesTruncateLogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesTruncateLogRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesTruncateLogRequest(); + if (object.truncateLogContext != null) { + if (typeof object.truncateLogContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesTruncateLogRequest.truncateLogContext: object expected"); + message.truncateLogContext = $root.google.cloud.sql.v1.TruncateLogContext.fromObject(object.truncateLogContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesTruncateLogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1.InstancesTruncateLogRequest} message InstancesTruncateLogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesTruncateLogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.truncateLogContext = null; + if (message.truncateLogContext != null && message.hasOwnProperty("truncateLogContext")) + object.truncateLogContext = $root.google.cloud.sql.v1.TruncateLogContext.toObject(message.truncateLogContext, options); + return object; + }; + + /** + * Converts this InstancesTruncateLogRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesTruncateLogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesTruncateLogRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesTruncateLogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesTruncateLogRequest"; + }; + + return InstancesTruncateLogRequest; + })(); + + v1.InstancesAcquireSsrsLeaseRequest = (function() { + + /** + * Properties of an InstancesAcquireSsrsLeaseRequest. + * @memberof google.cloud.sql.v1 + * @interface IInstancesAcquireSsrsLeaseRequest + * @property {google.cloud.sql.v1.IAcquireSsrsLeaseContext|null} [acquireSsrsLeaseContext] InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext + */ + + /** + * Constructs a new InstancesAcquireSsrsLeaseRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an InstancesAcquireSsrsLeaseRequest. + * @implements IInstancesAcquireSsrsLeaseRequest + * @constructor + * @param {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set + */ + function InstancesAcquireSsrsLeaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext. + * @member {google.cloud.sql.v1.IAcquireSsrsLeaseContext|null|undefined} acquireSsrsLeaseContext + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @instance + */ + InstancesAcquireSsrsLeaseRequest.prototype.acquireSsrsLeaseContext = null; + + /** + * Creates a new InstancesAcquireSsrsLeaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest instance + */ + InstancesAcquireSsrsLeaseRequest.create = function create(properties) { + return new InstancesAcquireSsrsLeaseRequest(properties); + }; + + /** + * Encodes the specified InstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesAcquireSsrsLeaseRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.acquireSsrsLeaseContext != null && Object.hasOwnProperty.call(message, "acquireSsrsLeaseContext")) + $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.encode(message.acquireSsrsLeaseContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesAcquireSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesAcquireSsrsLeaseRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesAcquireSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesAcquireSsrsLeaseRequest message. + * @function verify + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesAcquireSsrsLeaseRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) { + var error = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.verify(message.acquireSsrsLeaseContext); + if (error) + return "acquireSsrsLeaseContext." + error; + } + return null; + }; + + /** + * Creates an InstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest + */ + InstancesAcquireSsrsLeaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest) + return object; + var message = new $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest(); + if (object.acquireSsrsLeaseContext != null) { + if (typeof object.acquireSsrsLeaseContext !== "object") + throw TypeError(".google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.acquireSsrsLeaseContext: object expected"); + message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.fromObject(object.acquireSsrsLeaseContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesAcquireSsrsLeaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.acquireSsrsLeaseContext = null; + if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) + object.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.toObject(message.acquireSsrsLeaseContext, options); + return object; + }; + + /** + * Converts this InstancesAcquireSsrsLeaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesAcquireSsrsLeaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesAcquireSsrsLeaseRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesAcquireSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest"; + }; + + return InstancesAcquireSsrsLeaseRequest; + })(); + + v1.SqlInstancesPreCheckMajorVersionUpgradeRequest = (function() { + + /** + * Properties of a SqlInstancesPreCheckMajorVersionUpgradeRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesPreCheckMajorVersionUpgradeRequest + * @property {string|null} [instance] SqlInstancesPreCheckMajorVersionUpgradeRequest instance + * @property {string|null} [project] SqlInstancesPreCheckMajorVersionUpgradeRequest project + * @property {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest|null} [body] SqlInstancesPreCheckMajorVersionUpgradeRequest body + */ + + /** + * Constructs a new SqlInstancesPreCheckMajorVersionUpgradeRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesPreCheckMajorVersionUpgradeRequest. + * @implements ISqlInstancesPreCheckMajorVersionUpgradeRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set + */ + function SqlInstancesPreCheckMajorVersionUpgradeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesPreCheckMajorVersionUpgradeRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @instance + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.instance = ""; + + /** + * SqlInstancesPreCheckMajorVersionUpgradeRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @instance + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.project = ""; + + /** + * SqlInstancesPreCheckMajorVersionUpgradeRequest body. + * @member {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @instance + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest instance + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.create = function create(properties) { + return new SqlInstancesPreCheckMajorVersionUpgradeRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.encode(message.body, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.body = $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesPreCheckMajorVersionUpgradeRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesPreCheckMajorVersionUpgradeRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesPreCheckMajorVersionUpgradeRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest"; + }; + + return SqlInstancesPreCheckMajorVersionUpgradeRequest; + })(); + + v1.SqlInstancesVerifyExternalSyncSettingsResponse = (function() { + + /** + * Properties of a SqlInstancesVerifyExternalSyncSettingsResponse. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesVerifyExternalSyncSettingsResponse + * @property {string|null} [kind] SqlInstancesVerifyExternalSyncSettingsResponse kind + * @property {Array.|null} [errors] SqlInstancesVerifyExternalSyncSettingsResponse errors + * @property {Array.|null} [warnings] SqlInstancesVerifyExternalSyncSettingsResponse warnings + */ + + /** + * Constructs a new SqlInstancesVerifyExternalSyncSettingsResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesVerifyExternalSyncSettingsResponse. + * @implements ISqlInstancesVerifyExternalSyncSettingsResponse + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse=} [properties] Properties to set + */ + function SqlInstancesVerifyExternalSyncSettingsResponse(properties) { + this.errors = []; + this.warnings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesVerifyExternalSyncSettingsResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsResponse.prototype.kind = ""; + + /** + * SqlInstancesVerifyExternalSyncSettingsResponse errors. + * @member {Array.} errors + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsResponse.prototype.errors = $util.emptyArray; + + /** + * SqlInstancesVerifyExternalSyncSettingsResponse warnings. + * @member {Array.} warnings + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsResponse.prototype.warnings = $util.emptyArray; + + /** + * Creates a new SqlInstancesVerifyExternalSyncSettingsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse instance + */ + SqlInstancesVerifyExternalSyncSettingsResponse.create = function create(properties) { + return new SqlInstancesVerifyExternalSyncSettingsResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesVerifyExternalSyncSettingsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.errors != null && message.errors.length) + for (var i = 0; i < message.errors.length; ++i) + $root.google.cloud.sql.v1.SqlExternalSyncSettingError.encode(message.errors[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + $root.google.cloud.sql.v1.SqlExternalSyncSettingError.encode(message.warnings[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesVerifyExternalSyncSettingsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesVerifyExternalSyncSettingsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.errors && message.errors.length)) + message.errors = []; + message.errors.push($root.google.cloud.sql.v1.SqlExternalSyncSettingError.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push($root.google.cloud.sql.v1.SqlExternalSyncSettingError.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesVerifyExternalSyncSettingsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesVerifyExternalSyncSettingsResponse message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesVerifyExternalSyncSettingsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.errors != null && message.hasOwnProperty("errors")) { + if (!Array.isArray(message.errors)) + return "errors: array expected"; + for (var i = 0; i < message.errors.length; ++i) { + var error = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.verify(message.errors[i]); + if (error) + return "errors." + error; + } + } + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) { + var error = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.verify(message.warnings[i]); + if (error) + return "warnings." + error; + } + } + return null; + }; + + /** + * Creates a SqlInstancesVerifyExternalSyncSettingsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse + */ + SqlInstancesVerifyExternalSyncSettingsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.errors) { + if (!Array.isArray(object.errors)) + throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.errors: array expected"); + message.errors = []; + for (var i = 0; i < object.errors.length; ++i) { + if (typeof object.errors[i] !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.errors: object expected"); + message.errors[i] = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.fromObject(object.errors[i]); + } + } + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) { + if (typeof object.warnings[i] !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.warnings: object expected"); + message.warnings[i] = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.fromObject(object.warnings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesVerifyExternalSyncSettingsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.errors = []; + object.warnings = []; + } + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.errors && message.errors.length) { + object.errors = []; + for (var j = 0; j < message.errors.length; ++j) + object.errors[j] = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.toObject(message.errors[j], options); + } + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.toObject(message.warnings[j], options); + } + return object; + }; + + /** + * Converts this SqlInstancesVerifyExternalSyncSettingsResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesVerifyExternalSyncSettingsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesVerifyExternalSyncSettingsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse"; + }; + + return SqlInstancesVerifyExternalSyncSettingsResponse; + })(); + + v1.SqlInstancesGetDiskShrinkConfigResponse = (function() { + + /** + * Properties of a SqlInstancesGetDiskShrinkConfigResponse. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesGetDiskShrinkConfigResponse + * @property {string|null} [kind] SqlInstancesGetDiskShrinkConfigResponse kind + * @property {number|Long|null} [minimalTargetSizeGb] SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb + * @property {string|null} [message] SqlInstancesGetDiskShrinkConfigResponse message + */ + + /** + * Constructs a new SqlInstancesGetDiskShrinkConfigResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesGetDiskShrinkConfigResponse. + * @implements ISqlInstancesGetDiskShrinkConfigResponse + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse=} [properties] Properties to set + */ + function SqlInstancesGetDiskShrinkConfigResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesGetDiskShrinkConfigResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @instance + */ + SqlInstancesGetDiskShrinkConfigResponse.prototype.kind = ""; + + /** + * SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb. + * @member {number|Long} minimalTargetSizeGb + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @instance + */ + SqlInstancesGetDiskShrinkConfigResponse.prototype.minimalTargetSizeGb = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SqlInstancesGetDiskShrinkConfigResponse message. + * @member {string} message + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @instance + */ + SqlInstancesGetDiskShrinkConfigResponse.prototype.message = ""; + + /** + * Creates a new SqlInstancesGetDiskShrinkConfigResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse instance + */ + SqlInstancesGetDiskShrinkConfigResponse.create = function create(properties) { + return new SqlInstancesGetDiskShrinkConfigResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetDiskShrinkConfigResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.minimalTargetSizeGb != null && Object.hasOwnProperty.call(message, "minimalTargetSizeGb")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.minimalTargetSizeGb); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + return writer; + }; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetDiskShrinkConfigResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetDiskShrinkConfigResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.minimalTargetSizeGb = reader.int64(); + break; + } + case 3: { + message.message = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetDiskShrinkConfigResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesGetDiskShrinkConfigResponse message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesGetDiskShrinkConfigResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.minimalTargetSizeGb != null && message.hasOwnProperty("minimalTargetSizeGb")) + if (!$util.isInteger(message.minimalTargetSizeGb) && !(message.minimalTargetSizeGb && $util.isInteger(message.minimalTargetSizeGb.low) && $util.isInteger(message.minimalTargetSizeGb.high))) + return "minimalTargetSizeGb: integer|Long expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesGetDiskShrinkConfigResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse + */ + SqlInstancesGetDiskShrinkConfigResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.minimalTargetSizeGb != null) + if ($util.Long) + (message.minimalTargetSizeGb = $util.Long.fromValue(object.minimalTargetSizeGb)).unsigned = false; + else if (typeof object.minimalTargetSizeGb === "string") + message.minimalTargetSizeGb = parseInt(object.minimalTargetSizeGb, 10); + else if (typeof object.minimalTargetSizeGb === "number") + message.minimalTargetSizeGb = object.minimalTargetSizeGb; + else if (typeof object.minimalTargetSizeGb === "object") + message.minimalTargetSizeGb = new $util.LongBits(object.minimalTargetSizeGb.low >>> 0, object.minimalTargetSizeGb.high >>> 0).toNumber(); + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesGetDiskShrinkConfigResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesGetDiskShrinkConfigResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.minimalTargetSizeGb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.minimalTargetSizeGb = options.longs === String ? "0" : 0; + object.message = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.minimalTargetSizeGb != null && message.hasOwnProperty("minimalTargetSizeGb")) + if (typeof message.minimalTargetSizeGb === "number") + object.minimalTargetSizeGb = options.longs === String ? String(message.minimalTargetSizeGb) : message.minimalTargetSizeGb; + else + object.minimalTargetSizeGb = options.longs === String ? $util.Long.prototype.toString.call(message.minimalTargetSizeGb) : options.longs === Number ? new $util.LongBits(message.minimalTargetSizeGb.low >>> 0, message.minimalTargetSizeGb.high >>> 0).toNumber() : message.minimalTargetSizeGb; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this SqlInstancesGetDiskShrinkConfigResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesGetDiskShrinkConfigResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesGetDiskShrinkConfigResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesGetDiskShrinkConfigResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse"; + }; + + return SqlInstancesGetDiskShrinkConfigResponse; + })(); + + v1.SqlInstancesGetLatestRecoveryTimeRequest = (function() { + + /** + * Properties of a SqlInstancesGetLatestRecoveryTimeRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesGetLatestRecoveryTimeRequest + * @property {string|null} [instance] SqlInstancesGetLatestRecoveryTimeRequest instance + * @property {string|null} [project] SqlInstancesGetLatestRecoveryTimeRequest project + * @property {google.protobuf.ITimestamp|null} [sourceInstanceDeletionTime] SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime + */ + + /** + * Constructs a new SqlInstancesGetLatestRecoveryTimeRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesGetLatestRecoveryTimeRequest. + * @implements ISqlInstancesGetLatestRecoveryTimeRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest=} [properties] Properties to set + */ + function SqlInstancesGetLatestRecoveryTimeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesGetLatestRecoveryTimeRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @instance + */ + SqlInstancesGetLatestRecoveryTimeRequest.prototype.instance = ""; + + /** + * SqlInstancesGetLatestRecoveryTimeRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @instance + */ + SqlInstancesGetLatestRecoveryTimeRequest.prototype.project = ""; + + /** + * SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime. + * @member {google.protobuf.ITimestamp|null|undefined} sourceInstanceDeletionTime + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @instance + */ + SqlInstancesGetLatestRecoveryTimeRequest.prototype.sourceInstanceDeletionTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlInstancesGetLatestRecoveryTimeRequest.prototype, "_sourceInstanceDeletionTime", { + get: $util.oneOfGetter($oneOfFields = ["sourceInstanceDeletionTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlInstancesGetLatestRecoveryTimeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest instance + */ + SqlInstancesGetLatestRecoveryTimeRequest.create = function create(properties) { + return new SqlInstancesGetLatestRecoveryTimeRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetLatestRecoveryTimeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.sourceInstanceDeletionTime != null && Object.hasOwnProperty.call(message, "sourceInstanceDeletionTime")) + $root.google.protobuf.Timestamp.encode(message.sourceInstanceDeletionTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetLatestRecoveryTimeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetLatestRecoveryTimeRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetLatestRecoveryTimeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesGetLatestRecoveryTimeRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesGetLatestRecoveryTimeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { + properties._sourceInstanceDeletionTime = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.sourceInstanceDeletionTime); + if (error) + return "sourceInstanceDeletionTime." + error; + } + } + return null; + }; + + /** + * Creates a SqlInstancesGetLatestRecoveryTimeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest + */ + SqlInstancesGetLatestRecoveryTimeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.sourceInstanceDeletionTime != null) { + if (typeof object.sourceInstanceDeletionTime !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest.sourceInstanceDeletionTime: object expected"); + message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.sourceInstanceDeletionTime); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesGetLatestRecoveryTimeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { + object.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.sourceInstanceDeletionTime, options); + if (options.oneofs) + object._sourceInstanceDeletionTime = "sourceInstanceDeletionTime"; + } + return object; + }; + + /** + * Converts this SqlInstancesGetLatestRecoveryTimeRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesGetLatestRecoveryTimeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesGetLatestRecoveryTimeRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesGetLatestRecoveryTimeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest"; + }; + + return SqlInstancesGetLatestRecoveryTimeRequest; + })(); + + v1.SqlInstancesGetLatestRecoveryTimeResponse = (function() { + + /** + * Properties of a SqlInstancesGetLatestRecoveryTimeResponse. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesGetLatestRecoveryTimeResponse + * @property {string|null} [kind] SqlInstancesGetLatestRecoveryTimeResponse kind + * @property {google.protobuf.ITimestamp|null} [latestRecoveryTime] SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime + * @property {google.protobuf.ITimestamp|null} [earliestRecoveryTime] SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime + */ + + /** + * Constructs a new SqlInstancesGetLatestRecoveryTimeResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesGetLatestRecoveryTimeResponse. + * @implements ISqlInstancesGetLatestRecoveryTimeResponse + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse=} [properties] Properties to set + */ + function SqlInstancesGetLatestRecoveryTimeResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesGetLatestRecoveryTimeResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @instance + */ + SqlInstancesGetLatestRecoveryTimeResponse.prototype.kind = ""; + + /** + * SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime. + * @member {google.protobuf.ITimestamp|null|undefined} latestRecoveryTime + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @instance + */ + SqlInstancesGetLatestRecoveryTimeResponse.prototype.latestRecoveryTime = null; + + /** + * SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime. + * @member {google.protobuf.ITimestamp|null|undefined} earliestRecoveryTime + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @instance + */ + SqlInstancesGetLatestRecoveryTimeResponse.prototype.earliestRecoveryTime = null; + + /** + * Creates a new SqlInstancesGetLatestRecoveryTimeResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse instance + */ + SqlInstancesGetLatestRecoveryTimeResponse.create = function create(properties) { + return new SqlInstancesGetLatestRecoveryTimeResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetLatestRecoveryTimeResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.latestRecoveryTime != null && Object.hasOwnProperty.call(message, "latestRecoveryTime")) + $root.google.protobuf.Timestamp.encode(message.latestRecoveryTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.earliestRecoveryTime != null && Object.hasOwnProperty.call(message, "earliestRecoveryTime")) + $root.google.protobuf.Timestamp.encode(message.earliestRecoveryTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetLatestRecoveryTimeResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetLatestRecoveryTimeResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.latestRecoveryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.earliestRecoveryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetLatestRecoveryTimeResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesGetLatestRecoveryTimeResponse message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesGetLatestRecoveryTimeResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.latestRecoveryTime != null && message.hasOwnProperty("latestRecoveryTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.latestRecoveryTime); + if (error) + return "latestRecoveryTime." + error; + } + if (message.earliestRecoveryTime != null && message.hasOwnProperty("earliestRecoveryTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.earliestRecoveryTime); + if (error) + return "earliestRecoveryTime." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesGetLatestRecoveryTimeResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse + */ + SqlInstancesGetLatestRecoveryTimeResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.latestRecoveryTime != null) { + if (typeof object.latestRecoveryTime !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.latestRecoveryTime: object expected"); + message.latestRecoveryTime = $root.google.protobuf.Timestamp.fromObject(object.latestRecoveryTime); + } + if (object.earliestRecoveryTime != null) { + if (typeof object.earliestRecoveryTime !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.earliestRecoveryTime: object expected"); + message.earliestRecoveryTime = $root.google.protobuf.Timestamp.fromObject(object.earliestRecoveryTime); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesGetLatestRecoveryTimeResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.latestRecoveryTime = null; + object.earliestRecoveryTime = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.latestRecoveryTime != null && message.hasOwnProperty("latestRecoveryTime")) + object.latestRecoveryTime = $root.google.protobuf.Timestamp.toObject(message.latestRecoveryTime, options); + if (message.earliestRecoveryTime != null && message.hasOwnProperty("earliestRecoveryTime")) + object.earliestRecoveryTime = $root.google.protobuf.Timestamp.toObject(message.earliestRecoveryTime, options); + return object; + }; + + /** + * Converts this SqlInstancesGetLatestRecoveryTimeResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesGetLatestRecoveryTimeResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesGetLatestRecoveryTimeResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesGetLatestRecoveryTimeResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse"; + }; + + return SqlInstancesGetLatestRecoveryTimeResponse; + })(); + + v1.CloneContext = (function() { + + /** + * Properties of a CloneContext. + * @memberof google.cloud.sql.v1 + * @interface ICloneContext + * @property {string|null} [kind] CloneContext kind + * @property {number|Long|null} [pitrTimestampMs] CloneContext pitrTimestampMs + * @property {string|null} [destinationInstanceName] CloneContext destinationInstanceName + * @property {google.cloud.sql.v1.IBinLogCoordinates|null} [binLogCoordinates] CloneContext binLogCoordinates + * @property {google.protobuf.ITimestamp|null} [pointInTime] CloneContext pointInTime + * @property {string|null} [allocatedIpRange] CloneContext allocatedIpRange + * @property {Array.|null} [databaseNames] CloneContext databaseNames + * @property {string|null} [preferredZone] CloneContext preferredZone + * @property {string|null} [preferredSecondaryZone] CloneContext preferredSecondaryZone + * @property {google.protobuf.ITimestamp|null} [sourceInstanceDeletionTime] CloneContext sourceInstanceDeletionTime + * @property {string|null} [destinationProject] CloneContext destinationProject + * @property {string|null} [destinationNetwork] CloneContext destinationNetwork + */ + + /** + * Constructs a new CloneContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a CloneContext. + * @implements ICloneContext + * @constructor + * @param {google.cloud.sql.v1.ICloneContext=} [properties] Properties to set + */ + function CloneContext(properties) { + this.databaseNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CloneContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.kind = ""; + + /** + * CloneContext pitrTimestampMs. + * @member {number|Long} pitrTimestampMs + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.pitrTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * CloneContext destinationInstanceName. + * @member {string} destinationInstanceName + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.destinationInstanceName = ""; + + /** + * CloneContext binLogCoordinates. + * @member {google.cloud.sql.v1.IBinLogCoordinates|null|undefined} binLogCoordinates + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.binLogCoordinates = null; + + /** + * CloneContext pointInTime. + * @member {google.protobuf.ITimestamp|null|undefined} pointInTime + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.pointInTime = null; + + /** + * CloneContext allocatedIpRange. + * @member {string} allocatedIpRange + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.allocatedIpRange = ""; + + /** + * CloneContext databaseNames. + * @member {Array.} databaseNames + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.databaseNames = $util.emptyArray; + + /** + * CloneContext preferredZone. + * @member {string|null|undefined} preferredZone + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.preferredZone = null; + + /** + * CloneContext preferredSecondaryZone. + * @member {string|null|undefined} preferredSecondaryZone + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.preferredSecondaryZone = null; + + /** + * CloneContext sourceInstanceDeletionTime. + * @member {google.protobuf.ITimestamp|null|undefined} sourceInstanceDeletionTime + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.sourceInstanceDeletionTime = null; + + /** + * CloneContext destinationProject. + * @member {string|null|undefined} destinationProject + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.destinationProject = null; + + /** + * CloneContext destinationNetwork. + * @member {string|null|undefined} destinationNetwork + * @memberof google.cloud.sql.v1.CloneContext + * @instance + */ + CloneContext.prototype.destinationNetwork = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CloneContext.prototype, "_preferredZone", { + get: $util.oneOfGetter($oneOfFields = ["preferredZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CloneContext.prototype, "_preferredSecondaryZone", { + get: $util.oneOfGetter($oneOfFields = ["preferredSecondaryZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CloneContext.prototype, "_sourceInstanceDeletionTime", { + get: $util.oneOfGetter($oneOfFields = ["sourceInstanceDeletionTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CloneContext.prototype, "_destinationProject", { + get: $util.oneOfGetter($oneOfFields = ["destinationProject"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CloneContext.prototype, "_destinationNetwork", { + get: $util.oneOfGetter($oneOfFields = ["destinationNetwork"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CloneContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.CloneContext + * @static + * @param {google.cloud.sql.v1.ICloneContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.CloneContext} CloneContext instance + */ + CloneContext.create = function create(properties) { + return new CloneContext(properties); + }; + + /** + * Encodes the specified CloneContext message. Does not implicitly {@link google.cloud.sql.v1.CloneContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.CloneContext + * @static + * @param {google.cloud.sql.v1.ICloneContext} message CloneContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloneContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.pitrTimestampMs != null && Object.hasOwnProperty.call(message, "pitrTimestampMs")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pitrTimestampMs); + if (message.destinationInstanceName != null && Object.hasOwnProperty.call(message, "destinationInstanceName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinationInstanceName); + if (message.binLogCoordinates != null && Object.hasOwnProperty.call(message, "binLogCoordinates")) + $root.google.cloud.sql.v1.BinLogCoordinates.encode(message.binLogCoordinates, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pointInTime != null && Object.hasOwnProperty.call(message, "pointInTime")) + $root.google.protobuf.Timestamp.encode(message.pointInTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.allocatedIpRange); + if (message.databaseNames != null && message.databaseNames.length) + for (var i = 0; i < message.databaseNames.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.databaseNames[i]); + if (message.preferredZone != null && Object.hasOwnProperty.call(message, "preferredZone")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.preferredZone); + if (message.preferredSecondaryZone != null && Object.hasOwnProperty.call(message, "preferredSecondaryZone")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.preferredSecondaryZone); + if (message.sourceInstanceDeletionTime != null && Object.hasOwnProperty.call(message, "sourceInstanceDeletionTime")) + $root.google.protobuf.Timestamp.encode(message.sourceInstanceDeletionTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.destinationProject != null && Object.hasOwnProperty.call(message, "destinationProject")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.destinationProject); + if (message.destinationNetwork != null && Object.hasOwnProperty.call(message, "destinationNetwork")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.destinationNetwork); + return writer; + }; + + /** + * Encodes the specified CloneContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.CloneContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.CloneContext + * @static + * @param {google.cloud.sql.v1.ICloneContext} message CloneContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloneContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CloneContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.CloneContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.CloneContext} CloneContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloneContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.CloneContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.pitrTimestampMs = reader.int64(); + break; + } + case 3: { + message.destinationInstanceName = reader.string(); + break; + } + case 4: { + message.binLogCoordinates = $root.google.cloud.sql.v1.BinLogCoordinates.decode(reader, reader.uint32()); + break; + } + case 5: { + message.pointInTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.allocatedIpRange = reader.string(); + break; + } + case 9: { + if (!(message.databaseNames && message.databaseNames.length)) + message.databaseNames = []; + message.databaseNames.push(reader.string()); + break; + } + case 10: { + message.preferredZone = reader.string(); + break; + } + case 11: { + message.preferredSecondaryZone = reader.string(); + break; + } + case 12: { + message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 13: { + message.destinationProject = reader.string(); + break; + } + case 14: { + message.destinationNetwork = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CloneContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.CloneContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.CloneContext} CloneContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloneContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CloneContext message. + * @function verify + * @memberof google.cloud.sql.v1.CloneContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CloneContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.pitrTimestampMs != null && message.hasOwnProperty("pitrTimestampMs")) + if (!$util.isInteger(message.pitrTimestampMs) && !(message.pitrTimestampMs && $util.isInteger(message.pitrTimestampMs.low) && $util.isInteger(message.pitrTimestampMs.high))) + return "pitrTimestampMs: integer|Long expected"; + if (message.destinationInstanceName != null && message.hasOwnProperty("destinationInstanceName")) + if (!$util.isString(message.destinationInstanceName)) + return "destinationInstanceName: string expected"; + if (message.binLogCoordinates != null && message.hasOwnProperty("binLogCoordinates")) { + var error = $root.google.cloud.sql.v1.BinLogCoordinates.verify(message.binLogCoordinates); + if (error) + return "binLogCoordinates." + error; + } + if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.pointInTime); + if (error) + return "pointInTime." + error; + } + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) + if (!$util.isString(message.allocatedIpRange)) + return "allocatedIpRange: string expected"; + if (message.databaseNames != null && message.hasOwnProperty("databaseNames")) { + if (!Array.isArray(message.databaseNames)) + return "databaseNames: array expected"; + for (var i = 0; i < message.databaseNames.length; ++i) + if (!$util.isString(message.databaseNames[i])) + return "databaseNames: string[] expected"; + } + if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { + properties._preferredZone = 1; + if (!$util.isString(message.preferredZone)) + return "preferredZone: string expected"; + } + if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { + properties._preferredSecondaryZone = 1; + if (!$util.isString(message.preferredSecondaryZone)) + return "preferredSecondaryZone: string expected"; + } + if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { + properties._sourceInstanceDeletionTime = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.sourceInstanceDeletionTime); + if (error) + return "sourceInstanceDeletionTime." + error; + } + } + if (message.destinationProject != null && message.hasOwnProperty("destinationProject")) { + properties._destinationProject = 1; + if (!$util.isString(message.destinationProject)) + return "destinationProject: string expected"; + } + if (message.destinationNetwork != null && message.hasOwnProperty("destinationNetwork")) { + properties._destinationNetwork = 1; + if (!$util.isString(message.destinationNetwork)) + return "destinationNetwork: string expected"; + } + return null; + }; + + /** + * Creates a CloneContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.CloneContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.CloneContext} CloneContext + */ + CloneContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.CloneContext) + return object; + var message = new $root.google.cloud.sql.v1.CloneContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.pitrTimestampMs != null) + if ($util.Long) + (message.pitrTimestampMs = $util.Long.fromValue(object.pitrTimestampMs)).unsigned = false; + else if (typeof object.pitrTimestampMs === "string") + message.pitrTimestampMs = parseInt(object.pitrTimestampMs, 10); + else if (typeof object.pitrTimestampMs === "number") + message.pitrTimestampMs = object.pitrTimestampMs; + else if (typeof object.pitrTimestampMs === "object") + message.pitrTimestampMs = new $util.LongBits(object.pitrTimestampMs.low >>> 0, object.pitrTimestampMs.high >>> 0).toNumber(); + if (object.destinationInstanceName != null) + message.destinationInstanceName = String(object.destinationInstanceName); + if (object.binLogCoordinates != null) { + if (typeof object.binLogCoordinates !== "object") + throw TypeError(".google.cloud.sql.v1.CloneContext.binLogCoordinates: object expected"); + message.binLogCoordinates = $root.google.cloud.sql.v1.BinLogCoordinates.fromObject(object.binLogCoordinates); + } + if (object.pointInTime != null) { + if (typeof object.pointInTime !== "object") + throw TypeError(".google.cloud.sql.v1.CloneContext.pointInTime: object expected"); + message.pointInTime = $root.google.protobuf.Timestamp.fromObject(object.pointInTime); + } + if (object.allocatedIpRange != null) + message.allocatedIpRange = String(object.allocatedIpRange); + if (object.databaseNames) { + if (!Array.isArray(object.databaseNames)) + throw TypeError(".google.cloud.sql.v1.CloneContext.databaseNames: array expected"); + message.databaseNames = []; + for (var i = 0; i < object.databaseNames.length; ++i) + message.databaseNames[i] = String(object.databaseNames[i]); + } + if (object.preferredZone != null) + message.preferredZone = String(object.preferredZone); + if (object.preferredSecondaryZone != null) + message.preferredSecondaryZone = String(object.preferredSecondaryZone); + if (object.sourceInstanceDeletionTime != null) { + if (typeof object.sourceInstanceDeletionTime !== "object") + throw TypeError(".google.cloud.sql.v1.CloneContext.sourceInstanceDeletionTime: object expected"); + message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.sourceInstanceDeletionTime); + } + if (object.destinationProject != null) + message.destinationProject = String(object.destinationProject); + if (object.destinationNetwork != null) + message.destinationNetwork = String(object.destinationNetwork); + return message; + }; + + /** + * Creates a plain object from a CloneContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.CloneContext + * @static + * @param {google.cloud.sql.v1.CloneContext} message CloneContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CloneContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.databaseNames = []; + if (options.defaults) { + object.kind = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.pitrTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pitrTimestampMs = options.longs === String ? "0" : 0; + object.destinationInstanceName = ""; + object.binLogCoordinates = null; + object.pointInTime = null; + object.allocatedIpRange = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.pitrTimestampMs != null && message.hasOwnProperty("pitrTimestampMs")) + if (typeof message.pitrTimestampMs === "number") + object.pitrTimestampMs = options.longs === String ? String(message.pitrTimestampMs) : message.pitrTimestampMs; + else + object.pitrTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.pitrTimestampMs) : options.longs === Number ? new $util.LongBits(message.pitrTimestampMs.low >>> 0, message.pitrTimestampMs.high >>> 0).toNumber() : message.pitrTimestampMs; + if (message.destinationInstanceName != null && message.hasOwnProperty("destinationInstanceName")) + object.destinationInstanceName = message.destinationInstanceName; + if (message.binLogCoordinates != null && message.hasOwnProperty("binLogCoordinates")) + object.binLogCoordinates = $root.google.cloud.sql.v1.BinLogCoordinates.toObject(message.binLogCoordinates, options); + if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) + object.pointInTime = $root.google.protobuf.Timestamp.toObject(message.pointInTime, options); + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) + object.allocatedIpRange = message.allocatedIpRange; + if (message.databaseNames && message.databaseNames.length) { + object.databaseNames = []; + for (var j = 0; j < message.databaseNames.length; ++j) + object.databaseNames[j] = message.databaseNames[j]; + } + if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { + object.preferredZone = message.preferredZone; + if (options.oneofs) + object._preferredZone = "preferredZone"; + } + if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { + object.preferredSecondaryZone = message.preferredSecondaryZone; + if (options.oneofs) + object._preferredSecondaryZone = "preferredSecondaryZone"; + } + if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { + object.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.sourceInstanceDeletionTime, options); + if (options.oneofs) + object._sourceInstanceDeletionTime = "sourceInstanceDeletionTime"; + } + if (message.destinationProject != null && message.hasOwnProperty("destinationProject")) { + object.destinationProject = message.destinationProject; + if (options.oneofs) + object._destinationProject = "destinationProject"; + } + if (message.destinationNetwork != null && message.hasOwnProperty("destinationNetwork")) { + object.destinationNetwork = message.destinationNetwork; + if (options.oneofs) + object._destinationNetwork = "destinationNetwork"; + } + return object; + }; + + /** + * Converts this CloneContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.CloneContext + * @instance + * @returns {Object.} JSON object + */ + CloneContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CloneContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.CloneContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CloneContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.CloneContext"; + }; + + return CloneContext; + })(); + + v1.PointInTimeRestoreContext = (function() { + + /** + * Properties of a PointInTimeRestoreContext. + * @memberof google.cloud.sql.v1 + * @interface IPointInTimeRestoreContext + * @property {string|null} [datasource] PointInTimeRestoreContext datasource + * @property {google.protobuf.ITimestamp|null} [pointInTime] PointInTimeRestoreContext pointInTime + * @property {string|null} [targetInstance] PointInTimeRestoreContext targetInstance + * @property {string|null} [privateNetwork] PointInTimeRestoreContext privateNetwork + * @property {string|null} [allocatedIpRange] PointInTimeRestoreContext allocatedIpRange + * @property {string|null} [preferredZone] PointInTimeRestoreContext preferredZone + * @property {string|null} [preferredSecondaryZone] PointInTimeRestoreContext preferredSecondaryZone + * @property {google.cloud.sql.v1.IDatabaseInstance|null} [targetInstanceSettings] PointInTimeRestoreContext targetInstanceSettings + * @property {Array.|null} [targetInstanceClearSettingsFieldNames] PointInTimeRestoreContext targetInstanceClearSettingsFieldNames + * @property {string|null} [region] PointInTimeRestoreContext region + */ + + /** + * Constructs a new PointInTimeRestoreContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a PointInTimeRestoreContext. + * @implements IPointInTimeRestoreContext + * @constructor + * @param {google.cloud.sql.v1.IPointInTimeRestoreContext=} [properties] Properties to set + */ + function PointInTimeRestoreContext(properties) { + this.targetInstanceClearSettingsFieldNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PointInTimeRestoreContext datasource. + * @member {string|null|undefined} datasource + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.datasource = null; + + /** + * PointInTimeRestoreContext pointInTime. + * @member {google.protobuf.ITimestamp|null|undefined} pointInTime + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.pointInTime = null; + + /** + * PointInTimeRestoreContext targetInstance. + * @member {string|null|undefined} targetInstance + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.targetInstance = null; + + /** + * PointInTimeRestoreContext privateNetwork. + * @member {string|null|undefined} privateNetwork + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.privateNetwork = null; + + /** + * PointInTimeRestoreContext allocatedIpRange. + * @member {string|null|undefined} allocatedIpRange + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.allocatedIpRange = null; + + /** + * PointInTimeRestoreContext preferredZone. + * @member {string|null|undefined} preferredZone + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.preferredZone = null; + + /** + * PointInTimeRestoreContext preferredSecondaryZone. + * @member {string|null|undefined} preferredSecondaryZone + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.preferredSecondaryZone = null; + + /** + * PointInTimeRestoreContext targetInstanceSettings. + * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} targetInstanceSettings + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.targetInstanceSettings = null; + + /** + * PointInTimeRestoreContext targetInstanceClearSettingsFieldNames. + * @member {Array.} targetInstanceClearSettingsFieldNames + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.targetInstanceClearSettingsFieldNames = $util.emptyArray; + + /** + * PointInTimeRestoreContext region. + * @member {string|null|undefined} region + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.region = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_datasource", { + get: $util.oneOfGetter($oneOfFields = ["datasource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_targetInstance", { + get: $util.oneOfGetter($oneOfFields = ["targetInstance"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_privateNetwork", { + get: $util.oneOfGetter($oneOfFields = ["privateNetwork"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_allocatedIpRange", { + get: $util.oneOfGetter($oneOfFields = ["allocatedIpRange"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_preferredZone", { + get: $util.oneOfGetter($oneOfFields = ["preferredZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_preferredSecondaryZone", { + get: $util.oneOfGetter($oneOfFields = ["preferredSecondaryZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_region", { + get: $util.oneOfGetter($oneOfFields = ["region"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PointInTimeRestoreContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @static + * @param {google.cloud.sql.v1.IPointInTimeRestoreContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.PointInTimeRestoreContext} PointInTimeRestoreContext instance + */ + PointInTimeRestoreContext.create = function create(properties) { + return new PointInTimeRestoreContext(properties); + }; + + /** + * Encodes the specified PointInTimeRestoreContext message. Does not implicitly {@link google.cloud.sql.v1.PointInTimeRestoreContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @static + * @param {google.cloud.sql.v1.IPointInTimeRestoreContext} message PointInTimeRestoreContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PointInTimeRestoreContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasource != null && Object.hasOwnProperty.call(message, "datasource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasource); + if (message.pointInTime != null && Object.hasOwnProperty.call(message, "pointInTime")) + $root.google.protobuf.Timestamp.encode(message.pointInTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.targetInstance != null && Object.hasOwnProperty.call(message, "targetInstance")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetInstance); + if (message.privateNetwork != null && Object.hasOwnProperty.call(message, "privateNetwork")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.privateNetwork); + if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.allocatedIpRange); + if (message.preferredZone != null && Object.hasOwnProperty.call(message, "preferredZone")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.preferredZone); + if (message.preferredSecondaryZone != null && Object.hasOwnProperty.call(message, "preferredSecondaryZone")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.preferredSecondaryZone); + if (message.targetInstanceSettings != null && Object.hasOwnProperty.call(message, "targetInstanceSettings")) + $root.google.cloud.sql.v1.DatabaseInstance.encode(message.targetInstanceSettings, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.targetInstanceClearSettingsFieldNames != null && message.targetInstanceClearSettingsFieldNames.length) + for (var i = 0; i < message.targetInstanceClearSettingsFieldNames.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.targetInstanceClearSettingsFieldNames[i]); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.region); + return writer; + }; + + /** + * Encodes the specified PointInTimeRestoreContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PointInTimeRestoreContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @static + * @param {google.cloud.sql.v1.IPointInTimeRestoreContext} message PointInTimeRestoreContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PointInTimeRestoreContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PointInTimeRestoreContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.PointInTimeRestoreContext} PointInTimeRestoreContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PointInTimeRestoreContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PointInTimeRestoreContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.datasource = reader.string(); + break; + } + case 2: { + message.pointInTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.targetInstance = reader.string(); + break; + } + case 4: { + message.privateNetwork = reader.string(); + break; + } + case 5: { + message.allocatedIpRange = reader.string(); + break; + } + case 6: { + message.preferredZone = reader.string(); + break; + } + case 9: { + message.preferredSecondaryZone = reader.string(); + break; + } + case 11: { + message.targetInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + case 12: { + if (!(message.targetInstanceClearSettingsFieldNames && message.targetInstanceClearSettingsFieldNames.length)) + message.targetInstanceClearSettingsFieldNames = []; + message.targetInstanceClearSettingsFieldNames.push(reader.string()); + break; + } + case 13: { + message.region = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PointInTimeRestoreContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.PointInTimeRestoreContext} PointInTimeRestoreContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PointInTimeRestoreContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PointInTimeRestoreContext message. + * @function verify + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PointInTimeRestoreContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.datasource != null && message.hasOwnProperty("datasource")) { + properties._datasource = 1; + if (!$util.isString(message.datasource)) + return "datasource: string expected"; + } + if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.pointInTime); + if (error) + return "pointInTime." + error; + } + if (message.targetInstance != null && message.hasOwnProperty("targetInstance")) { + properties._targetInstance = 1; + if (!$util.isString(message.targetInstance)) + return "targetInstance: string expected"; + } + if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) { + properties._privateNetwork = 1; + if (!$util.isString(message.privateNetwork)) + return "privateNetwork: string expected"; + } + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) { + properties._allocatedIpRange = 1; + if (!$util.isString(message.allocatedIpRange)) + return "allocatedIpRange: string expected"; + } + if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { + properties._preferredZone = 1; + if (!$util.isString(message.preferredZone)) + return "preferredZone: string expected"; + } + if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { + properties._preferredSecondaryZone = 1; + if (!$util.isString(message.preferredSecondaryZone)) + return "preferredSecondaryZone: string expected"; + } + if (message.targetInstanceSettings != null && message.hasOwnProperty("targetInstanceSettings")) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.targetInstanceSettings); + if (error) + return "targetInstanceSettings." + error; + } + if (message.targetInstanceClearSettingsFieldNames != null && message.hasOwnProperty("targetInstanceClearSettingsFieldNames")) { + if (!Array.isArray(message.targetInstanceClearSettingsFieldNames)) + return "targetInstanceClearSettingsFieldNames: array expected"; + for (var i = 0; i < message.targetInstanceClearSettingsFieldNames.length; ++i) + if (!$util.isString(message.targetInstanceClearSettingsFieldNames[i])) + return "targetInstanceClearSettingsFieldNames: string[] expected"; + } + if (message.region != null && message.hasOwnProperty("region")) { + properties._region = 1; + if (!$util.isString(message.region)) + return "region: string expected"; + } + return null; + }; + + /** + * Creates a PointInTimeRestoreContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.PointInTimeRestoreContext} PointInTimeRestoreContext + */ + PointInTimeRestoreContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.PointInTimeRestoreContext) + return object; + var message = new $root.google.cloud.sql.v1.PointInTimeRestoreContext(); + if (object.datasource != null) + message.datasource = String(object.datasource); + if (object.pointInTime != null) { + if (typeof object.pointInTime !== "object") + throw TypeError(".google.cloud.sql.v1.PointInTimeRestoreContext.pointInTime: object expected"); + message.pointInTime = $root.google.protobuf.Timestamp.fromObject(object.pointInTime); + } + if (object.targetInstance != null) + message.targetInstance = String(object.targetInstance); + if (object.privateNetwork != null) + message.privateNetwork = String(object.privateNetwork); + if (object.allocatedIpRange != null) + message.allocatedIpRange = String(object.allocatedIpRange); + if (object.preferredZone != null) + message.preferredZone = String(object.preferredZone); + if (object.preferredSecondaryZone != null) + message.preferredSecondaryZone = String(object.preferredSecondaryZone); + if (object.targetInstanceSettings != null) { + if (typeof object.targetInstanceSettings !== "object") + throw TypeError(".google.cloud.sql.v1.PointInTimeRestoreContext.targetInstanceSettings: object expected"); + message.targetInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.targetInstanceSettings); + } + if (object.targetInstanceClearSettingsFieldNames) { + if (!Array.isArray(object.targetInstanceClearSettingsFieldNames)) + throw TypeError(".google.cloud.sql.v1.PointInTimeRestoreContext.targetInstanceClearSettingsFieldNames: array expected"); + message.targetInstanceClearSettingsFieldNames = []; + for (var i = 0; i < object.targetInstanceClearSettingsFieldNames.length; ++i) + message.targetInstanceClearSettingsFieldNames[i] = String(object.targetInstanceClearSettingsFieldNames[i]); + } + if (object.region != null) + message.region = String(object.region); + return message; + }; + + /** + * Creates a plain object from a PointInTimeRestoreContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @static + * @param {google.cloud.sql.v1.PointInTimeRestoreContext} message PointInTimeRestoreContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PointInTimeRestoreContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.targetInstanceClearSettingsFieldNames = []; + if (options.defaults) { + object.pointInTime = null; + object.targetInstanceSettings = null; + } + if (message.datasource != null && message.hasOwnProperty("datasource")) { + object.datasource = message.datasource; + if (options.oneofs) + object._datasource = "datasource"; + } + if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) + object.pointInTime = $root.google.protobuf.Timestamp.toObject(message.pointInTime, options); + if (message.targetInstance != null && message.hasOwnProperty("targetInstance")) { + object.targetInstance = message.targetInstance; + if (options.oneofs) + object._targetInstance = "targetInstance"; + } + if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) { + object.privateNetwork = message.privateNetwork; + if (options.oneofs) + object._privateNetwork = "privateNetwork"; + } + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) { + object.allocatedIpRange = message.allocatedIpRange; + if (options.oneofs) + object._allocatedIpRange = "allocatedIpRange"; + } + if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { + object.preferredZone = message.preferredZone; + if (options.oneofs) + object._preferredZone = "preferredZone"; + } + if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { + object.preferredSecondaryZone = message.preferredSecondaryZone; + if (options.oneofs) + object._preferredSecondaryZone = "preferredSecondaryZone"; + } + if (message.targetInstanceSettings != null && message.hasOwnProperty("targetInstanceSettings")) + object.targetInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.targetInstanceSettings, options); + if (message.targetInstanceClearSettingsFieldNames && message.targetInstanceClearSettingsFieldNames.length) { + object.targetInstanceClearSettingsFieldNames = []; + for (var j = 0; j < message.targetInstanceClearSettingsFieldNames.length; ++j) + object.targetInstanceClearSettingsFieldNames[j] = message.targetInstanceClearSettingsFieldNames[j]; + } + if (message.region != null && message.hasOwnProperty("region")) { + object.region = message.region; + if (options.oneofs) + object._region = "region"; + } + return object; + }; + + /** + * Converts this PointInTimeRestoreContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + * @returns {Object.} JSON object + */ + PointInTimeRestoreContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PointInTimeRestoreContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PointInTimeRestoreContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.PointInTimeRestoreContext"; + }; + + return PointInTimeRestoreContext; + })(); + + v1.BinLogCoordinates = (function() { + + /** + * Properties of a BinLogCoordinates. + * @memberof google.cloud.sql.v1 + * @interface IBinLogCoordinates + * @property {string|null} [binLogFileName] BinLogCoordinates binLogFileName + * @property {number|Long|null} [binLogPosition] BinLogCoordinates binLogPosition + * @property {string|null} [kind] BinLogCoordinates kind + */ + + /** + * Constructs a new BinLogCoordinates. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a BinLogCoordinates. + * @implements IBinLogCoordinates + * @constructor + * @param {google.cloud.sql.v1.IBinLogCoordinates=} [properties] Properties to set + */ + function BinLogCoordinates(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BinLogCoordinates binLogFileName. + * @member {string} binLogFileName + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @instance + */ + BinLogCoordinates.prototype.binLogFileName = ""; + + /** + * BinLogCoordinates binLogPosition. + * @member {number|Long} binLogPosition + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @instance + */ + BinLogCoordinates.prototype.binLogPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BinLogCoordinates kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @instance + */ + BinLogCoordinates.prototype.kind = ""; + + /** + * Creates a new BinLogCoordinates instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @static + * @param {google.cloud.sql.v1.IBinLogCoordinates=} [properties] Properties to set + * @returns {google.cloud.sql.v1.BinLogCoordinates} BinLogCoordinates instance + */ + BinLogCoordinates.create = function create(properties) { + return new BinLogCoordinates(properties); + }; + + /** + * Encodes the specified BinLogCoordinates message. Does not implicitly {@link google.cloud.sql.v1.BinLogCoordinates.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @static + * @param {google.cloud.sql.v1.IBinLogCoordinates} message BinLogCoordinates message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BinLogCoordinates.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.binLogFileName != null && Object.hasOwnProperty.call(message, "binLogFileName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.binLogFileName); + if (message.binLogPosition != null && Object.hasOwnProperty.call(message, "binLogPosition")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.binLogPosition); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + return writer; + }; + + /** + * Encodes the specified BinLogCoordinates message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BinLogCoordinates.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @static + * @param {google.cloud.sql.v1.IBinLogCoordinates} message BinLogCoordinates message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BinLogCoordinates.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BinLogCoordinates message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.BinLogCoordinates} BinLogCoordinates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BinLogCoordinates.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BinLogCoordinates(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.binLogFileName = reader.string(); + break; + } + case 2: { + message.binLogPosition = reader.int64(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BinLogCoordinates message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.BinLogCoordinates} BinLogCoordinates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BinLogCoordinates.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BinLogCoordinates message. + * @function verify + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BinLogCoordinates.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.binLogFileName != null && message.hasOwnProperty("binLogFileName")) + if (!$util.isString(message.binLogFileName)) + return "binLogFileName: string expected"; + if (message.binLogPosition != null && message.hasOwnProperty("binLogPosition")) + if (!$util.isInteger(message.binLogPosition) && !(message.binLogPosition && $util.isInteger(message.binLogPosition.low) && $util.isInteger(message.binLogPosition.high))) + return "binLogPosition: integer|Long expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a BinLogCoordinates message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.BinLogCoordinates} BinLogCoordinates + */ + BinLogCoordinates.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.BinLogCoordinates) + return object; + var message = new $root.google.cloud.sql.v1.BinLogCoordinates(); + if (object.binLogFileName != null) + message.binLogFileName = String(object.binLogFileName); + if (object.binLogPosition != null) + if ($util.Long) + (message.binLogPosition = $util.Long.fromValue(object.binLogPosition)).unsigned = false; + else if (typeof object.binLogPosition === "string") + message.binLogPosition = parseInt(object.binLogPosition, 10); + else if (typeof object.binLogPosition === "number") + message.binLogPosition = object.binLogPosition; + else if (typeof object.binLogPosition === "object") + message.binLogPosition = new $util.LongBits(object.binLogPosition.low >>> 0, object.binLogPosition.high >>> 0).toNumber(); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a BinLogCoordinates message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @static + * @param {google.cloud.sql.v1.BinLogCoordinates} message BinLogCoordinates + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BinLogCoordinates.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.binLogFileName = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.binLogPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.binLogPosition = options.longs === String ? "0" : 0; + object.kind = ""; + } + if (message.binLogFileName != null && message.hasOwnProperty("binLogFileName")) + object.binLogFileName = message.binLogFileName; + if (message.binLogPosition != null && message.hasOwnProperty("binLogPosition")) + if (typeof message.binLogPosition === "number") + object.binLogPosition = options.longs === String ? String(message.binLogPosition) : message.binLogPosition; + else + object.binLogPosition = options.longs === String ? $util.Long.prototype.toString.call(message.binLogPosition) : options.longs === Number ? new $util.LongBits(message.binLogPosition.low >>> 0, message.binLogPosition.high >>> 0).toNumber() : message.binLogPosition; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this BinLogCoordinates to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @instance + * @returns {Object.} JSON object + */ + BinLogCoordinates.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BinLogCoordinates + * @function getTypeUrl + * @memberof google.cloud.sql.v1.BinLogCoordinates + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BinLogCoordinates.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.BinLogCoordinates"; + }; + + return BinLogCoordinates; + })(); + + v1.DatabaseInstance = (function() { + + /** + * Properties of a DatabaseInstance. + * @memberof google.cloud.sql.v1 + * @interface IDatabaseInstance + * @property {string|null} [kind] DatabaseInstance kind + * @property {google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null} [state] DatabaseInstance state + * @property {google.cloud.sql.v1.SqlDatabaseVersion|null} [databaseVersion] DatabaseInstance databaseVersion + * @property {google.cloud.sql.v1.ISettings|null} [settings] DatabaseInstance settings + * @property {string|null} [etag] DatabaseInstance etag + * @property {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica|null} [failoverReplica] DatabaseInstance failoverReplica + * @property {string|null} [masterInstanceName] DatabaseInstance masterInstanceName + * @property {Array.|null} [replicaNames] DatabaseInstance replicaNames + * @property {google.protobuf.IInt64Value|null} [maxDiskSize] DatabaseInstance maxDiskSize + * @property {google.protobuf.IInt64Value|null} [currentDiskSize] DatabaseInstance currentDiskSize + * @property {Array.|null} [ipAddresses] DatabaseInstance ipAddresses + * @property {google.cloud.sql.v1.ISslCert|null} [serverCaCert] DatabaseInstance serverCaCert + * @property {google.cloud.sql.v1.SqlInstanceType|null} [instanceType] DatabaseInstance instanceType + * @property {string|null} [project] DatabaseInstance project + * @property {string|null} [ipv6Address] DatabaseInstance ipv6Address + * @property {string|null} [serviceAccountEmailAddress] DatabaseInstance serviceAccountEmailAddress + * @property {google.cloud.sql.v1.IOnPremisesConfiguration|null} [onPremisesConfiguration] DatabaseInstance onPremisesConfiguration + * @property {google.cloud.sql.v1.IReplicaConfiguration|null} [replicaConfiguration] DatabaseInstance replicaConfiguration + * @property {google.cloud.sql.v1.SqlBackendType|null} [backendType] DatabaseInstance backendType + * @property {string|null} [selfLink] DatabaseInstance selfLink + * @property {Array.|null} [suspensionReason] DatabaseInstance suspensionReason + * @property {string|null} [connectionName] DatabaseInstance connectionName + * @property {string|null} [name] DatabaseInstance name + * @property {string|null} [region] DatabaseInstance region + * @property {string|null} [gceZone] DatabaseInstance gceZone + * @property {string|null} [secondaryGceZone] DatabaseInstance secondaryGceZone + * @property {google.cloud.sql.v1.IDiskEncryptionConfiguration|null} [diskEncryptionConfiguration] DatabaseInstance diskEncryptionConfiguration + * @property {google.cloud.sql.v1.IDiskEncryptionStatus|null} [diskEncryptionStatus] DatabaseInstance diskEncryptionStatus + * @property {string|null} [rootPassword] DatabaseInstance rootPassword + * @property {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance|null} [scheduledMaintenance] DatabaseInstance scheduledMaintenance + * @property {google.protobuf.IBoolValue|null} [satisfiesPzs] DatabaseInstance satisfiesPzs + * @property {string|null} [databaseInstalledVersion] DatabaseInstance databaseInstalledVersion + * @property {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport|null} [outOfDiskReport] DatabaseInstance outOfDiskReport + * @property {google.protobuf.ITimestamp|null} [createTime] DatabaseInstance createTime + * @property {Array.|null} [availableMaintenanceVersions] DatabaseInstance availableMaintenanceVersions + * @property {string|null} [maintenanceVersion] DatabaseInstance maintenanceVersion + * @property {Array.|null} [upgradableDatabaseVersions] DatabaseInstance upgradableDatabaseVersions + * @property {google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|null} [sqlNetworkArchitecture] DatabaseInstance sqlNetworkArchitecture + * @property {string|null} [pscServiceAttachmentLink] DatabaseInstance pscServiceAttachmentLink + * @property {string|null} [dnsName] DatabaseInstance dnsName + * @property {string|null} [primaryDnsName] DatabaseInstance primaryDnsName + * @property {string|null} [writeEndpoint] DatabaseInstance writeEndpoint + * @property {google.cloud.sql.v1.IReplicationCluster|null} [replicationCluster] DatabaseInstance replicationCluster + * @property {google.cloud.sql.v1.IGeminiInstanceConfig|null} [geminiConfig] DatabaseInstance geminiConfig + * @property {google.protobuf.IBoolValue|null} [satisfiesPzi] DatabaseInstance satisfiesPzi + * @property {google.protobuf.IBoolValue|null} [switchTransactionLogsToCloudStorageEnabled] DatabaseInstance switchTransactionLogsToCloudStorageEnabled + * @property {google.protobuf.IBoolValue|null} [includeReplicasForMajorVersionUpgrade] DatabaseInstance includeReplicasForMajorVersionUpgrade + * @property {Object.|null} [tags] DatabaseInstance tags + * @property {number|null} [nodeCount] DatabaseInstance nodeCount + * @property {Array.|null} [nodes] DatabaseInstance nodes + * @property {Array.|null} [dnsNames] DatabaseInstance dnsNames + */ + + /** + * Constructs a new DatabaseInstance. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DatabaseInstance. + * @implements IDatabaseInstance + * @constructor + * @param {google.cloud.sql.v1.IDatabaseInstance=} [properties] Properties to set + */ + function DatabaseInstance(properties) { + this.replicaNames = []; + this.ipAddresses = []; + this.suspensionReason = []; + this.availableMaintenanceVersions = []; + this.upgradableDatabaseVersions = []; + this.tags = {}; + this.nodes = []; + this.dnsNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DatabaseInstance kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.kind = ""; + + /** + * DatabaseInstance state. + * @member {google.cloud.sql.v1.DatabaseInstance.SqlInstanceState} state + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.state = 0; + + /** + * DatabaseInstance databaseVersion. + * @member {google.cloud.sql.v1.SqlDatabaseVersion} databaseVersion + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.databaseVersion = 0; + + /** + * DatabaseInstance settings. + * @member {google.cloud.sql.v1.ISettings|null|undefined} settings + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.settings = null; + + /** + * DatabaseInstance etag. + * @member {string} etag + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.etag = ""; + + /** + * DatabaseInstance failoverReplica. + * @member {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica|null|undefined} failoverReplica + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.failoverReplica = null; + + /** + * DatabaseInstance masterInstanceName. + * @member {string} masterInstanceName + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.masterInstanceName = ""; + + /** + * DatabaseInstance replicaNames. + * @member {Array.} replicaNames + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.replicaNames = $util.emptyArray; + + /** + * DatabaseInstance maxDiskSize. + * @member {google.protobuf.IInt64Value|null|undefined} maxDiskSize + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.maxDiskSize = null; + + /** + * DatabaseInstance currentDiskSize. + * @member {google.protobuf.IInt64Value|null|undefined} currentDiskSize + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.currentDiskSize = null; + + /** + * DatabaseInstance ipAddresses. + * @member {Array.} ipAddresses + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.ipAddresses = $util.emptyArray; + + /** + * DatabaseInstance serverCaCert. + * @member {google.cloud.sql.v1.ISslCert|null|undefined} serverCaCert + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.serverCaCert = null; + + /** + * DatabaseInstance instanceType. + * @member {google.cloud.sql.v1.SqlInstanceType} instanceType + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.instanceType = 0; + + /** + * DatabaseInstance project. + * @member {string} project + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.project = ""; + + /** + * DatabaseInstance ipv6Address. + * @member {string} ipv6Address + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.ipv6Address = ""; + + /** + * DatabaseInstance serviceAccountEmailAddress. + * @member {string} serviceAccountEmailAddress + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.serviceAccountEmailAddress = ""; + + /** + * DatabaseInstance onPremisesConfiguration. + * @member {google.cloud.sql.v1.IOnPremisesConfiguration|null|undefined} onPremisesConfiguration + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.onPremisesConfiguration = null; + + /** + * DatabaseInstance replicaConfiguration. + * @member {google.cloud.sql.v1.IReplicaConfiguration|null|undefined} replicaConfiguration + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.replicaConfiguration = null; + + /** + * DatabaseInstance backendType. + * @member {google.cloud.sql.v1.SqlBackendType} backendType + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.backendType = 0; + + /** + * DatabaseInstance selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.selfLink = ""; + + /** + * DatabaseInstance suspensionReason. + * @member {Array.} suspensionReason + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.suspensionReason = $util.emptyArray; + + /** + * DatabaseInstance connectionName. + * @member {string} connectionName + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.connectionName = ""; + + /** + * DatabaseInstance name. + * @member {string} name + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.name = ""; + + /** + * DatabaseInstance region. + * @member {string} region + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.region = ""; + + /** + * DatabaseInstance gceZone. + * @member {string} gceZone + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.gceZone = ""; + + /** + * DatabaseInstance secondaryGceZone. + * @member {string} secondaryGceZone + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.secondaryGceZone = ""; + + /** + * DatabaseInstance diskEncryptionConfiguration. + * @member {google.cloud.sql.v1.IDiskEncryptionConfiguration|null|undefined} diskEncryptionConfiguration + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.diskEncryptionConfiguration = null; + + /** + * DatabaseInstance diskEncryptionStatus. + * @member {google.cloud.sql.v1.IDiskEncryptionStatus|null|undefined} diskEncryptionStatus + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.diskEncryptionStatus = null; + + /** + * DatabaseInstance rootPassword. + * @member {string} rootPassword + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.rootPassword = ""; + + /** + * DatabaseInstance scheduledMaintenance. + * @member {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance|null|undefined} scheduledMaintenance + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.scheduledMaintenance = null; + + /** + * DatabaseInstance satisfiesPzs. + * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzs + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.satisfiesPzs = null; + + /** + * DatabaseInstance databaseInstalledVersion. + * @member {string} databaseInstalledVersion + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.databaseInstalledVersion = ""; + + /** + * DatabaseInstance outOfDiskReport. + * @member {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport|null|undefined} outOfDiskReport + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.outOfDiskReport = null; + + /** + * DatabaseInstance createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.createTime = null; + + /** + * DatabaseInstance availableMaintenanceVersions. + * @member {Array.} availableMaintenanceVersions + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.availableMaintenanceVersions = $util.emptyArray; + + /** + * DatabaseInstance maintenanceVersion. + * @member {string} maintenanceVersion + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.maintenanceVersion = ""; + + /** + * DatabaseInstance upgradableDatabaseVersions. + * @member {Array.} upgradableDatabaseVersions + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.upgradableDatabaseVersions = $util.emptyArray; + + /** + * DatabaseInstance sqlNetworkArchitecture. + * @member {google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|null|undefined} sqlNetworkArchitecture + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.sqlNetworkArchitecture = null; + + /** + * DatabaseInstance pscServiceAttachmentLink. + * @member {string|null|undefined} pscServiceAttachmentLink + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.pscServiceAttachmentLink = null; + + /** + * DatabaseInstance dnsName. + * @member {string|null|undefined} dnsName + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.dnsName = null; + + /** + * DatabaseInstance primaryDnsName. + * @member {string|null|undefined} primaryDnsName + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.primaryDnsName = null; + + /** + * DatabaseInstance writeEndpoint. + * @member {string|null|undefined} writeEndpoint + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.writeEndpoint = null; + + /** + * DatabaseInstance replicationCluster. + * @member {google.cloud.sql.v1.IReplicationCluster|null|undefined} replicationCluster + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.replicationCluster = null; + + /** + * DatabaseInstance geminiConfig. + * @member {google.cloud.sql.v1.IGeminiInstanceConfig|null|undefined} geminiConfig + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.geminiConfig = null; + + /** + * DatabaseInstance satisfiesPzi. + * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzi + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.satisfiesPzi = null; + + /** + * DatabaseInstance switchTransactionLogsToCloudStorageEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} switchTransactionLogsToCloudStorageEnabled + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.switchTransactionLogsToCloudStorageEnabled = null; + + /** + * DatabaseInstance includeReplicasForMajorVersionUpgrade. + * @member {google.protobuf.IBoolValue|null|undefined} includeReplicasForMajorVersionUpgrade + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.includeReplicasForMajorVersionUpgrade = null; + + /** + * DatabaseInstance tags. + * @member {Object.} tags + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.tags = $util.emptyObject; + + /** + * DatabaseInstance nodeCount. + * @member {number|null|undefined} nodeCount + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.nodeCount = null; + + /** + * DatabaseInstance nodes. + * @member {Array.} nodes + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.nodes = $util.emptyArray; + + /** + * DatabaseInstance dnsNames. + * @member {Array.} dnsNames + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.dnsNames = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_outOfDiskReport", { + get: $util.oneOfGetter($oneOfFields = ["outOfDiskReport"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_sqlNetworkArchitecture", { + get: $util.oneOfGetter($oneOfFields = ["sqlNetworkArchitecture"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_pscServiceAttachmentLink", { + get: $util.oneOfGetter($oneOfFields = ["pscServiceAttachmentLink"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_dnsName", { + get: $util.oneOfGetter($oneOfFields = ["dnsName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_primaryDnsName", { + get: $util.oneOfGetter($oneOfFields = ["primaryDnsName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_writeEndpoint", { + get: $util.oneOfGetter($oneOfFields = ["writeEndpoint"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_geminiConfig", { + get: $util.oneOfGetter($oneOfFields = ["geminiConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_switchTransactionLogsToCloudStorageEnabled", { + get: $util.oneOfGetter($oneOfFields = ["switchTransactionLogsToCloudStorageEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_includeReplicasForMajorVersionUpgrade", { + get: $util.oneOfGetter($oneOfFields = ["includeReplicasForMajorVersionUpgrade"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_nodeCount", { + get: $util.oneOfGetter($oneOfFields = ["nodeCount"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DatabaseInstance instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DatabaseInstance + * @static + * @param {google.cloud.sql.v1.IDatabaseInstance=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DatabaseInstance} DatabaseInstance instance + */ + DatabaseInstance.create = function create(properties) { + return new DatabaseInstance(properties); + }; + + /** + * Encodes the specified DatabaseInstance message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DatabaseInstance + * @static + * @param {google.cloud.sql.v1.IDatabaseInstance} message DatabaseInstance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabaseInstance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.databaseVersion); + if (message.settings != null && Object.hasOwnProperty.call(message, "settings")) + $root.google.cloud.sql.v1.Settings.encode(message.settings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.etag); + if (message.failoverReplica != null && Object.hasOwnProperty.call(message, "failoverReplica")) + $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.encode(message.failoverReplica, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.masterInstanceName != null && Object.hasOwnProperty.call(message, "masterInstanceName")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.masterInstanceName); + if (message.replicaNames != null && message.replicaNames.length) + for (var i = 0; i < message.replicaNames.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.replicaNames[i]); + if (message.maxDiskSize != null && Object.hasOwnProperty.call(message, "maxDiskSize")) + $root.google.protobuf.Int64Value.encode(message.maxDiskSize, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.currentDiskSize != null && Object.hasOwnProperty.call(message, "currentDiskSize")) + $root.google.protobuf.Int64Value.encode(message.currentDiskSize, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.ipAddresses != null && message.ipAddresses.length) + for (var i = 0; i < message.ipAddresses.length; ++i) + $root.google.cloud.sql.v1.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) + $root.google.cloud.sql.v1.SslCert.encode(message.serverCaCert, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.instanceType != null && Object.hasOwnProperty.call(message, "instanceType")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.instanceType); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.project); + if (message.ipv6Address != null && Object.hasOwnProperty.call(message, "ipv6Address")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.ipv6Address); + if (message.serviceAccountEmailAddress != null && Object.hasOwnProperty.call(message, "serviceAccountEmailAddress")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.serviceAccountEmailAddress); + if (message.onPremisesConfiguration != null && Object.hasOwnProperty.call(message, "onPremisesConfiguration")) + $root.google.cloud.sql.v1.OnPremisesConfiguration.encode(message.onPremisesConfiguration, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.replicaConfiguration != null && Object.hasOwnProperty.call(message, "replicaConfiguration")) + $root.google.cloud.sql.v1.ReplicaConfiguration.encode(message.replicaConfiguration, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.backendType != null && Object.hasOwnProperty.call(message, "backendType")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.backendType); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 20, wireType 2 =*/162).string(message.selfLink); + if (message.suspensionReason != null && message.suspensionReason.length) { + writer.uint32(/* id 21, wireType 2 =*/170).fork(); + for (var i = 0; i < message.suspensionReason.length; ++i) + writer.int32(message.suspensionReason[i]); + writer.ldelim(); + } + if (message.connectionName != null && Object.hasOwnProperty.call(message, "connectionName")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.connectionName); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.name); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 24, wireType 2 =*/194).string(message.region); + if (message.gceZone != null && Object.hasOwnProperty.call(message, "gceZone")) + writer.uint32(/* id 25, wireType 2 =*/202).string(message.gceZone); + if (message.diskEncryptionConfiguration != null && Object.hasOwnProperty.call(message, "diskEncryptionConfiguration")) + $root.google.cloud.sql.v1.DiskEncryptionConfiguration.encode(message.diskEncryptionConfiguration, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); + if (message.diskEncryptionStatus != null && Object.hasOwnProperty.call(message, "diskEncryptionStatus")) + $root.google.cloud.sql.v1.DiskEncryptionStatus.encode(message.diskEncryptionStatus, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + if (message.rootPassword != null && Object.hasOwnProperty.call(message, "rootPassword")) + writer.uint32(/* id 29, wireType 2 =*/234).string(message.rootPassword); + if (message.scheduledMaintenance != null && Object.hasOwnProperty.call(message, "scheduledMaintenance")) + $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.encode(message.scheduledMaintenance, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.secondaryGceZone != null && Object.hasOwnProperty.call(message, "secondaryGceZone")) + writer.uint32(/* id 34, wireType 2 =*/274).string(message.secondaryGceZone); + if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) + $root.google.protobuf.BoolValue.encode(message.satisfiesPzs, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + if (message.outOfDiskReport != null && Object.hasOwnProperty.call(message, "outOfDiskReport")) + $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.encode(message.outOfDiskReport, writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); + if (message.databaseInstalledVersion != null && Object.hasOwnProperty.call(message, "databaseInstalledVersion")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.databaseInstalledVersion); + if (message.availableMaintenanceVersions != null && message.availableMaintenanceVersions.length) + for (var i = 0; i < message.availableMaintenanceVersions.length; ++i) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.availableMaintenanceVersions[i]); + if (message.maintenanceVersion != null && Object.hasOwnProperty.call(message, "maintenanceVersion")) + writer.uint32(/* id 42, wireType 2 =*/338).string(message.maintenanceVersion); + if (message.upgradableDatabaseVersions != null && message.upgradableDatabaseVersions.length) + for (var i = 0; i < message.upgradableDatabaseVersions.length; ++i) + $root.google.cloud.sql.v1.AvailableDatabaseVersion.encode(message.upgradableDatabaseVersions[i], writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); + if (message.sqlNetworkArchitecture != null && Object.hasOwnProperty.call(message, "sqlNetworkArchitecture")) + writer.uint32(/* id 47, wireType 0 =*/376).int32(message.sqlNetworkArchitecture); + if (message.pscServiceAttachmentLink != null && Object.hasOwnProperty.call(message, "pscServiceAttachmentLink")) + writer.uint32(/* id 48, wireType 2 =*/386).string(message.pscServiceAttachmentLink); + if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) + writer.uint32(/* id 49, wireType 2 =*/394).string(message.dnsName); + if (message.primaryDnsName != null && Object.hasOwnProperty.call(message, "primaryDnsName")) + writer.uint32(/* id 51, wireType 2 =*/410).string(message.primaryDnsName); + if (message.writeEndpoint != null && Object.hasOwnProperty.call(message, "writeEndpoint")) + writer.uint32(/* id 52, wireType 2 =*/418).string(message.writeEndpoint); + if (message.replicationCluster != null && Object.hasOwnProperty.call(message, "replicationCluster")) + $root.google.cloud.sql.v1.ReplicationCluster.encode(message.replicationCluster, writer.uint32(/* id 54, wireType 2 =*/434).fork()).ldelim(); + if (message.geminiConfig != null && Object.hasOwnProperty.call(message, "geminiConfig")) + $root.google.cloud.sql.v1.GeminiInstanceConfig.encode(message.geminiConfig, writer.uint32(/* id 55, wireType 2 =*/442).fork()).ldelim(); + if (message.satisfiesPzi != null && Object.hasOwnProperty.call(message, "satisfiesPzi")) + $root.google.protobuf.BoolValue.encode(message.satisfiesPzi, writer.uint32(/* id 56, wireType 2 =*/450).fork()).ldelim(); + if (message.switchTransactionLogsToCloudStorageEnabled != null && Object.hasOwnProperty.call(message, "switchTransactionLogsToCloudStorageEnabled")) + $root.google.protobuf.BoolValue.encode(message.switchTransactionLogsToCloudStorageEnabled, writer.uint32(/* id 57, wireType 2 =*/458).fork()).ldelim(); + if (message.includeReplicasForMajorVersionUpgrade != null && Object.hasOwnProperty.call(message, "includeReplicasForMajorVersionUpgrade")) + $root.google.protobuf.BoolValue.encode(message.includeReplicasForMajorVersionUpgrade, writer.uint32(/* id 59, wireType 2 =*/474).fork()).ldelim(); + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) + for (var keys = Object.keys(message.tags), i = 0; i < keys.length; ++i) + writer.uint32(/* id 60, wireType 2 =*/482).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.tags[keys[i]]).ldelim(); + if (message.nodeCount != null && Object.hasOwnProperty.call(message, "nodeCount")) + writer.uint32(/* id 63, wireType 0 =*/504).int32(message.nodeCount); + if (message.nodes != null && message.nodes.length) + for (var i = 0; i < message.nodes.length; ++i) + $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.encode(message.nodes[i], writer.uint32(/* id 64, wireType 2 =*/514).fork()).ldelim(); + if (message.dnsNames != null && message.dnsNames.length) + for (var i = 0; i < message.dnsNames.length; ++i) + $root.google.cloud.sql.v1.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 67, wireType 2 =*/538).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DatabaseInstance message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DatabaseInstance + * @static + * @param {google.cloud.sql.v1.IDatabaseInstance} message DatabaseInstance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabaseInstance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DatabaseInstance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DatabaseInstance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DatabaseInstance} DatabaseInstance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabaseInstance.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseInstance(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.databaseVersion = reader.int32(); + break; + } + case 4: { + message.settings = $root.google.cloud.sql.v1.Settings.decode(reader, reader.uint32()); + break; + } + case 5: { + message.etag = reader.string(); + break; + } + case 6: { + message.failoverReplica = $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.decode(reader, reader.uint32()); + break; + } + case 7: { + message.masterInstanceName = reader.string(); + break; + } + case 8: { + if (!(message.replicaNames && message.replicaNames.length)) + message.replicaNames = []; + message.replicaNames.push(reader.string()); + break; + } + case 9: { + message.maxDiskSize = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 10: { + message.currentDiskSize = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 11: { + if (!(message.ipAddresses && message.ipAddresses.length)) + message.ipAddresses = []; + message.ipAddresses.push($root.google.cloud.sql.v1.IpMapping.decode(reader, reader.uint32())); + break; + } + case 12: { + message.serverCaCert = $root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32()); + break; + } + case 13: { + message.instanceType = reader.int32(); + break; + } + case 14: { + message.project = reader.string(); + break; + } + case 15: { + message.ipv6Address = reader.string(); + break; + } + case 16: { + message.serviceAccountEmailAddress = reader.string(); + break; + } + case 17: { + message.onPremisesConfiguration = $root.google.cloud.sql.v1.OnPremisesConfiguration.decode(reader, reader.uint32()); + break; + } + case 18: { + message.replicaConfiguration = $root.google.cloud.sql.v1.ReplicaConfiguration.decode(reader, reader.uint32()); + break; + } + case 19: { + message.backendType = reader.int32(); + break; + } + case 20: { + message.selfLink = reader.string(); + break; + } + case 21: { + if (!(message.suspensionReason && message.suspensionReason.length)) + message.suspensionReason = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.suspensionReason.push(reader.int32()); + } else + message.suspensionReason.push(reader.int32()); + break; + } + case 22: { + message.connectionName = reader.string(); + break; + } + case 23: { + message.name = reader.string(); + break; + } + case 24: { + message.region = reader.string(); + break; + } + case 25: { + message.gceZone = reader.string(); + break; + } + case 34: { + message.secondaryGceZone = reader.string(); + break; + } + case 26: { + message.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.decode(reader, reader.uint32()); + break; + } + case 27: { + message.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.decode(reader, reader.uint32()); + break; + } + case 29: { + message.rootPassword = reader.string(); + break; + } + case 30: { + message.scheduledMaintenance = $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.decode(reader, reader.uint32()); + break; + } + case 35: { + message.satisfiesPzs = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 40: { + message.databaseInstalledVersion = reader.string(); + break; + } + case 38: { + message.outOfDiskReport = $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.decode(reader, reader.uint32()); + break; + } + case 39: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 41: { + if (!(message.availableMaintenanceVersions && message.availableMaintenanceVersions.length)) + message.availableMaintenanceVersions = []; + message.availableMaintenanceVersions.push(reader.string()); + break; + } + case 42: { + message.maintenanceVersion = reader.string(); + break; + } + case 45: { + if (!(message.upgradableDatabaseVersions && message.upgradableDatabaseVersions.length)) + message.upgradableDatabaseVersions = []; + message.upgradableDatabaseVersions.push($root.google.cloud.sql.v1.AvailableDatabaseVersion.decode(reader, reader.uint32())); + break; + } + case 47: { + message.sqlNetworkArchitecture = reader.int32(); + break; + } + case 48: { + message.pscServiceAttachmentLink = reader.string(); + break; + } + case 49: { + message.dnsName = reader.string(); + break; + } + case 51: { + message.primaryDnsName = reader.string(); + break; + } + case 52: { + message.writeEndpoint = reader.string(); + break; + } + case 54: { + message.replicationCluster = $root.google.cloud.sql.v1.ReplicationCluster.decode(reader, reader.uint32()); + break; + } + case 55: { + message.geminiConfig = $root.google.cloud.sql.v1.GeminiInstanceConfig.decode(reader, reader.uint32()); + break; + } + case 56: { + message.satisfiesPzi = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 57: { + message.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 59: { + message.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 60: { + if (message.tags === $util.emptyObject) + message.tags = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.tags[key] = value; + break; + } + case 63: { + message.nodeCount = reader.int32(); + break; + } + case 64: { + if (!(message.nodes && message.nodes.length)) + message.nodes = []; + message.nodes.push($root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.decode(reader, reader.uint32())); + break; + } + case 67: { + if (!(message.dnsNames && message.dnsNames.length)) + message.dnsNames = []; + message.dnsNames.push($root.google.cloud.sql.v1.DnsNameMapping.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DatabaseInstance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DatabaseInstance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DatabaseInstance} DatabaseInstance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabaseInstance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DatabaseInstance message. + * @function verify + * @memberof google.cloud.sql.v1.DatabaseInstance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DatabaseInstance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + switch (message.databaseVersion) { + default: + return "databaseVersion: enum value expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 684: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + case 549: + case 550: + case 551: + break; + } + if (message.settings != null && message.hasOwnProperty("settings")) { + var error = $root.google.cloud.sql.v1.Settings.verify(message.settings); + if (error) + return "settings." + error; + } + if (message.etag != null && message.hasOwnProperty("etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + if (message.failoverReplica != null && message.hasOwnProperty("failoverReplica")) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.verify(message.failoverReplica); + if (error) + return "failoverReplica." + error; + } + if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) + if (!$util.isString(message.masterInstanceName)) + return "masterInstanceName: string expected"; + if (message.replicaNames != null && message.hasOwnProperty("replicaNames")) { + if (!Array.isArray(message.replicaNames)) + return "replicaNames: array expected"; + for (var i = 0; i < message.replicaNames.length; ++i) + if (!$util.isString(message.replicaNames[i])) + return "replicaNames: string[] expected"; + } + if (message.maxDiskSize != null && message.hasOwnProperty("maxDiskSize")) { + var error = $root.google.protobuf.Int64Value.verify(message.maxDiskSize); + if (error) + return "maxDiskSize." + error; + } + if (message.currentDiskSize != null && message.hasOwnProperty("currentDiskSize")) { + var error = $root.google.protobuf.Int64Value.verify(message.currentDiskSize); + if (error) + return "currentDiskSize." + error; + } + if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { + if (!Array.isArray(message.ipAddresses)) + return "ipAddresses: array expected"; + for (var i = 0; i < message.ipAddresses.length; ++i) { + var error = $root.google.cloud.sql.v1.IpMapping.verify(message.ipAddresses[i]); + if (error) + return "ipAddresses." + error; + } + } + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { + var error = $root.google.cloud.sql.v1.SslCert.verify(message.serverCaCert); + if (error) + return "serverCaCert." + error; + } + if (message.instanceType != null && message.hasOwnProperty("instanceType")) + switch (message.instanceType) { + default: + return "instanceType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 5: + break; + } + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.ipv6Address != null && message.hasOwnProperty("ipv6Address")) + if (!$util.isString(message.ipv6Address)) + return "ipv6Address: string expected"; + if (message.serviceAccountEmailAddress != null && message.hasOwnProperty("serviceAccountEmailAddress")) + if (!$util.isString(message.serviceAccountEmailAddress)) + return "serviceAccountEmailAddress: string expected"; + if (message.onPremisesConfiguration != null && message.hasOwnProperty("onPremisesConfiguration")) { + var error = $root.google.cloud.sql.v1.OnPremisesConfiguration.verify(message.onPremisesConfiguration); + if (error) + return "onPremisesConfiguration." + error; + } + if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) { + var error = $root.google.cloud.sql.v1.ReplicaConfiguration.verify(message.replicaConfiguration); + if (error) + return "replicaConfiguration." + error; + } + if (message.backendType != null && message.hasOwnProperty("backendType")) + switch (message.backendType) { + default: + return "backendType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + if (message.suspensionReason != null && message.hasOwnProperty("suspensionReason")) { + if (!Array.isArray(message.suspensionReason)) + return "suspensionReason: array expected"; + for (var i = 0; i < message.suspensionReason.length; ++i) + switch (message.suspensionReason[i]) { + default: + return "suspensionReason: enum value[] expected"; + case 0: + case 2: + case 3: + case 4: + case 5: + case 8: + break; + } + } + if (message.connectionName != null && message.hasOwnProperty("connectionName")) + if (!$util.isString(message.connectionName)) + return "connectionName: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.region != null && message.hasOwnProperty("region")) + if (!$util.isString(message.region)) + return "region: string expected"; + if (message.gceZone != null && message.hasOwnProperty("gceZone")) + if (!$util.isString(message.gceZone)) + return "gceZone: string expected"; + if (message.secondaryGceZone != null && message.hasOwnProperty("secondaryGceZone")) + if (!$util.isString(message.secondaryGceZone)) + return "secondaryGceZone: string expected"; + if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) { + var error = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.verify(message.diskEncryptionConfiguration); + if (error) + return "diskEncryptionConfiguration." + error; + } + if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) { + var error = $root.google.cloud.sql.v1.DiskEncryptionStatus.verify(message.diskEncryptionStatus); + if (error) + return "diskEncryptionStatus." + error; + } + if (message.rootPassword != null && message.hasOwnProperty("rootPassword")) + if (!$util.isString(message.rootPassword)) + return "rootPassword: string expected"; + if (message.scheduledMaintenance != null && message.hasOwnProperty("scheduledMaintenance")) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.verify(message.scheduledMaintenance); + if (error) + return "scheduledMaintenance." + error; + } + if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) { + var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzs); + if (error) + return "satisfiesPzs." + error; + } + if (message.databaseInstalledVersion != null && message.hasOwnProperty("databaseInstalledVersion")) + if (!$util.isString(message.databaseInstalledVersion)) + return "databaseInstalledVersion: string expected"; + if (message.outOfDiskReport != null && message.hasOwnProperty("outOfDiskReport")) { + properties._outOfDiskReport = 1; + { + var error = $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.verify(message.outOfDiskReport); + if (error) + return "outOfDiskReport." + error; + } + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.availableMaintenanceVersions != null && message.hasOwnProperty("availableMaintenanceVersions")) { + if (!Array.isArray(message.availableMaintenanceVersions)) + return "availableMaintenanceVersions: array expected"; + for (var i = 0; i < message.availableMaintenanceVersions.length; ++i) + if (!$util.isString(message.availableMaintenanceVersions[i])) + return "availableMaintenanceVersions: string[] expected"; + } + if (message.maintenanceVersion != null && message.hasOwnProperty("maintenanceVersion")) + if (!$util.isString(message.maintenanceVersion)) + return "maintenanceVersion: string expected"; + if (message.upgradableDatabaseVersions != null && message.hasOwnProperty("upgradableDatabaseVersions")) { + if (!Array.isArray(message.upgradableDatabaseVersions)) + return "upgradableDatabaseVersions: array expected"; + for (var i = 0; i < message.upgradableDatabaseVersions.length; ++i) { + var error = $root.google.cloud.sql.v1.AvailableDatabaseVersion.verify(message.upgradableDatabaseVersions[i]); + if (error) + return "upgradableDatabaseVersions." + error; + } + } + if (message.sqlNetworkArchitecture != null && message.hasOwnProperty("sqlNetworkArchitecture")) { + properties._sqlNetworkArchitecture = 1; + switch (message.sqlNetworkArchitecture) { + default: + return "sqlNetworkArchitecture: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { + properties._pscServiceAttachmentLink = 1; + if (!$util.isString(message.pscServiceAttachmentLink)) + return "pscServiceAttachmentLink: string expected"; + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + properties._dnsName = 1; + if (!$util.isString(message.dnsName)) + return "dnsName: string expected"; + } + if (message.primaryDnsName != null && message.hasOwnProperty("primaryDnsName")) { + properties._primaryDnsName = 1; + if (!$util.isString(message.primaryDnsName)) + return "primaryDnsName: string expected"; + } + if (message.writeEndpoint != null && message.hasOwnProperty("writeEndpoint")) { + properties._writeEndpoint = 1; + if (!$util.isString(message.writeEndpoint)) + return "writeEndpoint: string expected"; + } + if (message.replicationCluster != null && message.hasOwnProperty("replicationCluster")) { + var error = $root.google.cloud.sql.v1.ReplicationCluster.verify(message.replicationCluster); + if (error) + return "replicationCluster." + error; + } + if (message.geminiConfig != null && message.hasOwnProperty("geminiConfig")) { + properties._geminiConfig = 1; + { + var error = $root.google.cloud.sql.v1.GeminiInstanceConfig.verify(message.geminiConfig); + if (error) + return "geminiConfig." + error; + } + } + if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) { + var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzi); + if (error) + return "satisfiesPzi." + error; + } + if (message.switchTransactionLogsToCloudStorageEnabled != null && message.hasOwnProperty("switchTransactionLogsToCloudStorageEnabled")) { + properties._switchTransactionLogsToCloudStorageEnabled = 1; + { + var error = $root.google.protobuf.BoolValue.verify(message.switchTransactionLogsToCloudStorageEnabled); + if (error) + return "switchTransactionLogsToCloudStorageEnabled." + error; + } + } + if (message.includeReplicasForMajorVersionUpgrade != null && message.hasOwnProperty("includeReplicasForMajorVersionUpgrade")) { + properties._includeReplicasForMajorVersionUpgrade = 1; + { + var error = $root.google.protobuf.BoolValue.verify(message.includeReplicasForMajorVersionUpgrade); + if (error) + return "includeReplicasForMajorVersionUpgrade." + error; + } + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!$util.isObject(message.tags)) + return "tags: object expected"; + var key = Object.keys(message.tags); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.tags[key[i]])) + return "tags: string{k:string} expected"; + } + if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { + properties._nodeCount = 1; + if (!$util.isInteger(message.nodeCount)) + return "nodeCount: integer expected"; + } + if (message.nodes != null && message.hasOwnProperty("nodes")) { + if (!Array.isArray(message.nodes)) + return "nodes: array expected"; + for (var i = 0; i < message.nodes.length; ++i) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.verify(message.nodes[i]); + if (error) + return "nodes." + error; + } + } + if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { + if (!Array.isArray(message.dnsNames)) + return "dnsNames: array expected"; + for (var i = 0; i < message.dnsNames.length; ++i) { + var error = $root.google.cloud.sql.v1.DnsNameMapping.verify(message.dnsNames[i]); + if (error) + return "dnsNames." + error; + } + } + return null; + }; + + /** + * Creates a DatabaseInstance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DatabaseInstance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DatabaseInstance} DatabaseInstance + */ + DatabaseInstance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DatabaseInstance) + return object; + var message = new $root.google.cloud.sql.v1.DatabaseInstance(); + if (object.kind != null) + message.kind = String(object.kind); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "SQL_INSTANCE_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNABLE": + case 1: + message.state = 1; + break; + case "SUSPENDED": + case 2: + message.state = 2; + break; + case "PENDING_DELETE": + case 3: + message.state = 3; + break; + case "PENDING_CREATE": + case 4: + message.state = 4; + break; + case "MAINTENANCE": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + case "ONLINE_MAINTENANCE": + case 7: + message.state = 7; + break; + case "REPAIRING": + case 8: + message.state = 8; + break; + } + switch (object.databaseVersion) { + default: + if (typeof object.databaseVersion === "number") { + message.databaseVersion = object.databaseVersion; + break; + } + break; + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.databaseVersion = 0; + break; + case "MYSQL_5_1": + case 2: + message.databaseVersion = 2; + break; + case "MYSQL_5_5": + case 3: + message.databaseVersion = 3; + break; + case "MYSQL_5_6": + case 5: + message.databaseVersion = 5; + break; + case "MYSQL_5_7": + case 6: + message.databaseVersion = 6; + break; + case "MYSQL_8_0": + case 20: + message.databaseVersion = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.databaseVersion = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.databaseVersion = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.databaseVersion = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.databaseVersion = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.databaseVersion = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.databaseVersion = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.databaseVersion = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.databaseVersion = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.databaseVersion = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.databaseVersion = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.databaseVersion = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.databaseVersion = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.databaseVersion = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.databaseVersion = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.databaseVersion = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.databaseVersion = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.databaseVersion = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.databaseVersion = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.databaseVersion = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.databaseVersion = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.databaseVersion = 556; + break; + case "MYSQL_8_4": + case 398: + message.databaseVersion = 398; + break; + case "MYSQL_9_7": + case 654: + message.databaseVersion = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.databaseVersion = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.databaseVersion = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.databaseVersion = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.databaseVersion = 16; + break; + case "POSTGRES_9_6": + case 9: + message.databaseVersion = 9; + break; + case "POSTGRES_10": + case 18: + message.databaseVersion = 18; + break; + case "POSTGRES_11": + case 10: + message.databaseVersion = 10; + break; + case "POSTGRES_12": + case 19: + message.databaseVersion = 19; + break; + case "POSTGRES_13": + case 23: + message.databaseVersion = 23; + break; + case "POSTGRES_14": + case 110: + message.databaseVersion = 110; + break; + case "POSTGRES_15": + case 172: + message.databaseVersion = 172; + break; + case "POSTGRES_16": + case 272: + message.databaseVersion = 272; + break; + case "POSTGRES_17": + case 408: + message.databaseVersion = 408; + break; + case "POSTGRES_18": + case 557: + message.databaseVersion = 557; + break; + case "POSTGRES_19": + case 684: + message.databaseVersion = 684; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.databaseVersion = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.databaseVersion = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.databaseVersion = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.databaseVersion = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.databaseVersion = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.databaseVersion = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.databaseVersion = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.databaseVersion = 202; + break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.databaseVersion = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.databaseVersion = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.databaseVersion = 551; + break; + } + if (object.settings != null) { + if (typeof object.settings !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.settings: object expected"); + message.settings = $root.google.cloud.sql.v1.Settings.fromObject(object.settings); + } + if (object.etag != null) + message.etag = String(object.etag); + if (object.failoverReplica != null) { + if (typeof object.failoverReplica !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.failoverReplica: object expected"); + message.failoverReplica = $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.fromObject(object.failoverReplica); + } + if (object.masterInstanceName != null) + message.masterInstanceName = String(object.masterInstanceName); + if (object.replicaNames) { + if (!Array.isArray(object.replicaNames)) + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.replicaNames: array expected"); + message.replicaNames = []; + for (var i = 0; i < object.replicaNames.length; ++i) + message.replicaNames[i] = String(object.replicaNames[i]); + } + if (object.maxDiskSize != null) { + if (typeof object.maxDiskSize !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.maxDiskSize: object expected"); + message.maxDiskSize = $root.google.protobuf.Int64Value.fromObject(object.maxDiskSize); + } + if (object.currentDiskSize != null) { + if (typeof object.currentDiskSize !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.currentDiskSize: object expected"); + message.currentDiskSize = $root.google.protobuf.Int64Value.fromObject(object.currentDiskSize); + } + if (object.ipAddresses) { + if (!Array.isArray(object.ipAddresses)) + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.ipAddresses: array expected"); + message.ipAddresses = []; + for (var i = 0; i < object.ipAddresses.length; ++i) { + if (typeof object.ipAddresses[i] !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.ipAddresses: object expected"); + message.ipAddresses[i] = $root.google.cloud.sql.v1.IpMapping.fromObject(object.ipAddresses[i]); + } + } + if (object.serverCaCert != null) { + if (typeof object.serverCaCert !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.serverCaCert: object expected"); + message.serverCaCert = $root.google.cloud.sql.v1.SslCert.fromObject(object.serverCaCert); + } + switch (object.instanceType) { + default: + if (typeof object.instanceType === "number") { + message.instanceType = object.instanceType; + break; + } + break; + case "SQL_INSTANCE_TYPE_UNSPECIFIED": + case 0: + message.instanceType = 0; + break; + case "CLOUD_SQL_INSTANCE": + case 1: + message.instanceType = 1; + break; + case "ON_PREMISES_INSTANCE": + case 2: + message.instanceType = 2; + break; + case "READ_REPLICA_INSTANCE": + case 3: + message.instanceType = 3; + break; + case "READ_POOL_INSTANCE": + case 5: + message.instanceType = 5; + break; + } + if (object.project != null) + message.project = String(object.project); + if (object.ipv6Address != null) + message.ipv6Address = String(object.ipv6Address); + if (object.serviceAccountEmailAddress != null) + message.serviceAccountEmailAddress = String(object.serviceAccountEmailAddress); + if (object.onPremisesConfiguration != null) { + if (typeof object.onPremisesConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.onPremisesConfiguration: object expected"); + message.onPremisesConfiguration = $root.google.cloud.sql.v1.OnPremisesConfiguration.fromObject(object.onPremisesConfiguration); + } + if (object.replicaConfiguration != null) { + if (typeof object.replicaConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.replicaConfiguration: object expected"); + message.replicaConfiguration = $root.google.cloud.sql.v1.ReplicaConfiguration.fromObject(object.replicaConfiguration); + } + switch (object.backendType) { + default: + if (typeof object.backendType === "number") { + message.backendType = object.backendType; + break; + } + break; + case "SQL_BACKEND_TYPE_UNSPECIFIED": + case 0: + message.backendType = 0; + break; + case "FIRST_GEN": + case 1: + message.backendType = 1; + break; + case "SECOND_GEN": + case 2: + message.backendType = 2; + break; + case "EXTERNAL": + case 3: + message.backendType = 3; + break; + } + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + if (object.suspensionReason) { + if (!Array.isArray(object.suspensionReason)) + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.suspensionReason: array expected"); + message.suspensionReason = []; + for (var i = 0; i < object.suspensionReason.length; ++i) + switch (object.suspensionReason[i]) { + default: + if (typeof object.suspensionReason[i] === "number") { + message.suspensionReason[i] = object.suspensionReason[i]; + break; + } + case "SQL_SUSPENSION_REASON_UNSPECIFIED": + case 0: + message.suspensionReason[i] = 0; + break; + case "BILLING_ISSUE": + case 2: + message.suspensionReason[i] = 2; + break; + case "LEGAL_ISSUE": + case 3: + message.suspensionReason[i] = 3; + break; + case "OPERATIONAL_ISSUE": + case 4: + message.suspensionReason[i] = 4; + break; + case "KMS_KEY_ISSUE": + case 5: + message.suspensionReason[i] = 5; + break; + case "PROJECT_ABUSE": + case 8: + message.suspensionReason[i] = 8; + break; + } + } + if (object.connectionName != null) + message.connectionName = String(object.connectionName); + if (object.name != null) + message.name = String(object.name); + if (object.region != null) + message.region = String(object.region); + if (object.gceZone != null) + message.gceZone = String(object.gceZone); + if (object.secondaryGceZone != null) + message.secondaryGceZone = String(object.secondaryGceZone); + if (object.diskEncryptionConfiguration != null) { + if (typeof object.diskEncryptionConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.diskEncryptionConfiguration: object expected"); + message.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.fromObject(object.diskEncryptionConfiguration); + } + if (object.diskEncryptionStatus != null) { + if (typeof object.diskEncryptionStatus !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.diskEncryptionStatus: object expected"); + message.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.fromObject(object.diskEncryptionStatus); + } + if (object.rootPassword != null) + message.rootPassword = String(object.rootPassword); + if (object.scheduledMaintenance != null) { + if (typeof object.scheduledMaintenance !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.scheduledMaintenance: object expected"); + message.scheduledMaintenance = $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.fromObject(object.scheduledMaintenance); + } + if (object.satisfiesPzs != null) { + if (typeof object.satisfiesPzs !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.satisfiesPzs: object expected"); + message.satisfiesPzs = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzs); + } + if (object.databaseInstalledVersion != null) + message.databaseInstalledVersion = String(object.databaseInstalledVersion); + if (object.outOfDiskReport != null) { + if (typeof object.outOfDiskReport !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.outOfDiskReport: object expected"); + message.outOfDiskReport = $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.fromObject(object.outOfDiskReport); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.availableMaintenanceVersions) { + if (!Array.isArray(object.availableMaintenanceVersions)) + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.availableMaintenanceVersions: array expected"); + message.availableMaintenanceVersions = []; + for (var i = 0; i < object.availableMaintenanceVersions.length; ++i) + message.availableMaintenanceVersions[i] = String(object.availableMaintenanceVersions[i]); + } + if (object.maintenanceVersion != null) + message.maintenanceVersion = String(object.maintenanceVersion); + if (object.upgradableDatabaseVersions) { + if (!Array.isArray(object.upgradableDatabaseVersions)) + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.upgradableDatabaseVersions: array expected"); + message.upgradableDatabaseVersions = []; + for (var i = 0; i < object.upgradableDatabaseVersions.length; ++i) { + if (typeof object.upgradableDatabaseVersions[i] !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.upgradableDatabaseVersions: object expected"); + message.upgradableDatabaseVersions[i] = $root.google.cloud.sql.v1.AvailableDatabaseVersion.fromObject(object.upgradableDatabaseVersions[i]); + } + } + switch (object.sqlNetworkArchitecture) { + default: + if (typeof object.sqlNetworkArchitecture === "number") { + message.sqlNetworkArchitecture = object.sqlNetworkArchitecture; + break; + } + break; + case "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED": + case 0: + message.sqlNetworkArchitecture = 0; + break; + case "NEW_NETWORK_ARCHITECTURE": + case 1: + message.sqlNetworkArchitecture = 1; + break; + case "OLD_NETWORK_ARCHITECTURE": + case 2: + message.sqlNetworkArchitecture = 2; + break; + } + if (object.pscServiceAttachmentLink != null) + message.pscServiceAttachmentLink = String(object.pscServiceAttachmentLink); + if (object.dnsName != null) + message.dnsName = String(object.dnsName); + if (object.primaryDnsName != null) + message.primaryDnsName = String(object.primaryDnsName); + if (object.writeEndpoint != null) + message.writeEndpoint = String(object.writeEndpoint); + if (object.replicationCluster != null) { + if (typeof object.replicationCluster !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.replicationCluster: object expected"); + message.replicationCluster = $root.google.cloud.sql.v1.ReplicationCluster.fromObject(object.replicationCluster); + } + if (object.geminiConfig != null) { + if (typeof object.geminiConfig !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.geminiConfig: object expected"); + message.geminiConfig = $root.google.cloud.sql.v1.GeminiInstanceConfig.fromObject(object.geminiConfig); + } + if (object.satisfiesPzi != null) { + if (typeof object.satisfiesPzi !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.satisfiesPzi: object expected"); + message.satisfiesPzi = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzi); + } + if (object.switchTransactionLogsToCloudStorageEnabled != null) { + if (typeof object.switchTransactionLogsToCloudStorageEnabled !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.switchTransactionLogsToCloudStorageEnabled: object expected"); + message.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.fromObject(object.switchTransactionLogsToCloudStorageEnabled); + } + if (object.includeReplicasForMajorVersionUpgrade != null) { + if (typeof object.includeReplicasForMajorVersionUpgrade !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.includeReplicasForMajorVersionUpgrade: object expected"); + message.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.fromObject(object.includeReplicasForMajorVersionUpgrade); + } + if (object.tags) { + if (typeof object.tags !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.tags: object expected"); + message.tags = {}; + for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) + message.tags[keys[i]] = String(object.tags[keys[i]]); + } + if (object.nodeCount != null) + message.nodeCount = object.nodeCount | 0; + if (object.nodes) { + if (!Array.isArray(object.nodes)) + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.nodes: array expected"); + message.nodes = []; + for (var i = 0; i < object.nodes.length; ++i) { + if (typeof object.nodes[i] !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.nodes: object expected"); + message.nodes[i] = $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.fromObject(object.nodes[i]); + } + } + if (object.dnsNames) { + if (!Array.isArray(object.dnsNames)) + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.dnsNames: array expected"); + message.dnsNames = []; + for (var i = 0; i < object.dnsNames.length; ++i) { + if (typeof object.dnsNames[i] !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.dnsNames: object expected"); + message.dnsNames[i] = $root.google.cloud.sql.v1.DnsNameMapping.fromObject(object.dnsNames[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DatabaseInstance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DatabaseInstance + * @static + * @param {google.cloud.sql.v1.DatabaseInstance} message DatabaseInstance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DatabaseInstance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.replicaNames = []; + object.ipAddresses = []; + object.suspensionReason = []; + object.availableMaintenanceVersions = []; + object.upgradableDatabaseVersions = []; + object.nodes = []; + object.dnsNames = []; + } + if (options.objects || options.defaults) + object.tags = {}; + if (options.defaults) { + object.kind = ""; + object.state = options.enums === String ? "SQL_INSTANCE_STATE_UNSPECIFIED" : 0; + object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; + object.settings = null; + object.etag = ""; + object.failoverReplica = null; + object.masterInstanceName = ""; + object.maxDiskSize = null; + object.currentDiskSize = null; + object.serverCaCert = null; + object.instanceType = options.enums === String ? "SQL_INSTANCE_TYPE_UNSPECIFIED" : 0; + object.project = ""; + object.ipv6Address = ""; + object.serviceAccountEmailAddress = ""; + object.onPremisesConfiguration = null; + object.replicaConfiguration = null; + object.backendType = options.enums === String ? "SQL_BACKEND_TYPE_UNSPECIFIED" : 0; + object.selfLink = ""; + object.connectionName = ""; + object.name = ""; + object.region = ""; + object.gceZone = ""; + object.diskEncryptionConfiguration = null; + object.diskEncryptionStatus = null; + object.rootPassword = ""; + object.scheduledMaintenance = null; + object.secondaryGceZone = ""; + object.satisfiesPzs = null; + object.createTime = null; + object.databaseInstalledVersion = ""; + object.maintenanceVersion = ""; + object.replicationCluster = null; + object.satisfiesPzi = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.sql.v1.DatabaseInstance.SqlInstanceState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1.DatabaseInstance.SqlInstanceState[message.state] : message.state; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; + if (message.settings != null && message.hasOwnProperty("settings")) + object.settings = $root.google.cloud.sql.v1.Settings.toObject(message.settings, options); + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = message.etag; + if (message.failoverReplica != null && message.hasOwnProperty("failoverReplica")) + object.failoverReplica = $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.toObject(message.failoverReplica, options); + if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) + object.masterInstanceName = message.masterInstanceName; + if (message.replicaNames && message.replicaNames.length) { + object.replicaNames = []; + for (var j = 0; j < message.replicaNames.length; ++j) + object.replicaNames[j] = message.replicaNames[j]; + } + if (message.maxDiskSize != null && message.hasOwnProperty("maxDiskSize")) + object.maxDiskSize = $root.google.protobuf.Int64Value.toObject(message.maxDiskSize, options); + if (message.currentDiskSize != null && message.hasOwnProperty("currentDiskSize")) + object.currentDiskSize = $root.google.protobuf.Int64Value.toObject(message.currentDiskSize, options); + if (message.ipAddresses && message.ipAddresses.length) { + object.ipAddresses = []; + for (var j = 0; j < message.ipAddresses.length; ++j) + object.ipAddresses[j] = $root.google.cloud.sql.v1.IpMapping.toObject(message.ipAddresses[j], options); + } + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) + object.serverCaCert = $root.google.cloud.sql.v1.SslCert.toObject(message.serverCaCert, options); + if (message.instanceType != null && message.hasOwnProperty("instanceType")) + object.instanceType = options.enums === String ? $root.google.cloud.sql.v1.SqlInstanceType[message.instanceType] === undefined ? message.instanceType : $root.google.cloud.sql.v1.SqlInstanceType[message.instanceType] : message.instanceType; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.ipv6Address != null && message.hasOwnProperty("ipv6Address")) + object.ipv6Address = message.ipv6Address; + if (message.serviceAccountEmailAddress != null && message.hasOwnProperty("serviceAccountEmailAddress")) + object.serviceAccountEmailAddress = message.serviceAccountEmailAddress; + if (message.onPremisesConfiguration != null && message.hasOwnProperty("onPremisesConfiguration")) + object.onPremisesConfiguration = $root.google.cloud.sql.v1.OnPremisesConfiguration.toObject(message.onPremisesConfiguration, options); + if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) + object.replicaConfiguration = $root.google.cloud.sql.v1.ReplicaConfiguration.toObject(message.replicaConfiguration, options); + if (message.backendType != null && message.hasOwnProperty("backendType")) + object.backendType = options.enums === String ? $root.google.cloud.sql.v1.SqlBackendType[message.backendType] === undefined ? message.backendType : $root.google.cloud.sql.v1.SqlBackendType[message.backendType] : message.backendType; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + if (message.suspensionReason && message.suspensionReason.length) { + object.suspensionReason = []; + for (var j = 0; j < message.suspensionReason.length; ++j) + object.suspensionReason[j] = options.enums === String ? $root.google.cloud.sql.v1.SqlSuspensionReason[message.suspensionReason[j]] === undefined ? message.suspensionReason[j] : $root.google.cloud.sql.v1.SqlSuspensionReason[message.suspensionReason[j]] : message.suspensionReason[j]; + } + if (message.connectionName != null && message.hasOwnProperty("connectionName")) + object.connectionName = message.connectionName; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.region != null && message.hasOwnProperty("region")) + object.region = message.region; + if (message.gceZone != null && message.hasOwnProperty("gceZone")) + object.gceZone = message.gceZone; + if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) + object.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.toObject(message.diskEncryptionConfiguration, options); + if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) + object.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.toObject(message.diskEncryptionStatus, options); + if (message.rootPassword != null && message.hasOwnProperty("rootPassword")) + object.rootPassword = message.rootPassword; + if (message.scheduledMaintenance != null && message.hasOwnProperty("scheduledMaintenance")) + object.scheduledMaintenance = $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.toObject(message.scheduledMaintenance, options); + if (message.secondaryGceZone != null && message.hasOwnProperty("secondaryGceZone")) + object.secondaryGceZone = message.secondaryGceZone; + if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) + object.satisfiesPzs = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzs, options); + if (message.outOfDiskReport != null && message.hasOwnProperty("outOfDiskReport")) { + object.outOfDiskReport = $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.toObject(message.outOfDiskReport, options); + if (options.oneofs) + object._outOfDiskReport = "outOfDiskReport"; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.databaseInstalledVersion != null && message.hasOwnProperty("databaseInstalledVersion")) + object.databaseInstalledVersion = message.databaseInstalledVersion; + if (message.availableMaintenanceVersions && message.availableMaintenanceVersions.length) { + object.availableMaintenanceVersions = []; + for (var j = 0; j < message.availableMaintenanceVersions.length; ++j) + object.availableMaintenanceVersions[j] = message.availableMaintenanceVersions[j]; + } + if (message.maintenanceVersion != null && message.hasOwnProperty("maintenanceVersion")) + object.maintenanceVersion = message.maintenanceVersion; + if (message.upgradableDatabaseVersions && message.upgradableDatabaseVersions.length) { + object.upgradableDatabaseVersions = []; + for (var j = 0; j < message.upgradableDatabaseVersions.length; ++j) + object.upgradableDatabaseVersions[j] = $root.google.cloud.sql.v1.AvailableDatabaseVersion.toObject(message.upgradableDatabaseVersions[j], options); + } + if (message.sqlNetworkArchitecture != null && message.hasOwnProperty("sqlNetworkArchitecture")) { + object.sqlNetworkArchitecture = options.enums === String ? $root.google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture[message.sqlNetworkArchitecture] === undefined ? message.sqlNetworkArchitecture : $root.google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture[message.sqlNetworkArchitecture] : message.sqlNetworkArchitecture; + if (options.oneofs) + object._sqlNetworkArchitecture = "sqlNetworkArchitecture"; + } + if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { + object.pscServiceAttachmentLink = message.pscServiceAttachmentLink; + if (options.oneofs) + object._pscServiceAttachmentLink = "pscServiceAttachmentLink"; + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + object.dnsName = message.dnsName; + if (options.oneofs) + object._dnsName = "dnsName"; + } + if (message.primaryDnsName != null && message.hasOwnProperty("primaryDnsName")) { + object.primaryDnsName = message.primaryDnsName; + if (options.oneofs) + object._primaryDnsName = "primaryDnsName"; + } + if (message.writeEndpoint != null && message.hasOwnProperty("writeEndpoint")) { + object.writeEndpoint = message.writeEndpoint; + if (options.oneofs) + object._writeEndpoint = "writeEndpoint"; + } + if (message.replicationCluster != null && message.hasOwnProperty("replicationCluster")) + object.replicationCluster = $root.google.cloud.sql.v1.ReplicationCluster.toObject(message.replicationCluster, options); + if (message.geminiConfig != null && message.hasOwnProperty("geminiConfig")) { + object.geminiConfig = $root.google.cloud.sql.v1.GeminiInstanceConfig.toObject(message.geminiConfig, options); + if (options.oneofs) + object._geminiConfig = "geminiConfig"; + } + if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) + object.satisfiesPzi = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzi, options); + if (message.switchTransactionLogsToCloudStorageEnabled != null && message.hasOwnProperty("switchTransactionLogsToCloudStorageEnabled")) { + object.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.toObject(message.switchTransactionLogsToCloudStorageEnabled, options); + if (options.oneofs) + object._switchTransactionLogsToCloudStorageEnabled = "switchTransactionLogsToCloudStorageEnabled"; + } + if (message.includeReplicasForMajorVersionUpgrade != null && message.hasOwnProperty("includeReplicasForMajorVersionUpgrade")) { + object.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.toObject(message.includeReplicasForMajorVersionUpgrade, options); + if (options.oneofs) + object._includeReplicasForMajorVersionUpgrade = "includeReplicasForMajorVersionUpgrade"; + } + var keys2; + if (message.tags && (keys2 = Object.keys(message.tags)).length) { + object.tags = {}; + for (var j = 0; j < keys2.length; ++j) + object.tags[keys2[j]] = message.tags[keys2[j]]; + } + if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { + object.nodeCount = message.nodeCount; + if (options.oneofs) + object._nodeCount = "nodeCount"; + } + if (message.nodes && message.nodes.length) { + object.nodes = []; + for (var j = 0; j < message.nodes.length; ++j) + object.nodes[j] = $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.toObject(message.nodes[j], options); + } + if (message.dnsNames && message.dnsNames.length) { + object.dnsNames = []; + for (var j = 0; j < message.dnsNames.length; ++j) + object.dnsNames[j] = $root.google.cloud.sql.v1.DnsNameMapping.toObject(message.dnsNames[j], options); + } + return object; + }; + + /** + * Converts this DatabaseInstance to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DatabaseInstance + * @instance + * @returns {Object.} JSON object + */ + DatabaseInstance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DatabaseInstance + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DatabaseInstance + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DatabaseInstance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseInstance"; + }; + + /** + * SqlInstanceState enum. + * @name google.cloud.sql.v1.DatabaseInstance.SqlInstanceState + * @enum {number} + * @property {number} SQL_INSTANCE_STATE_UNSPECIFIED=0 SQL_INSTANCE_STATE_UNSPECIFIED value + * @property {number} RUNNABLE=1 RUNNABLE value + * @property {number} SUSPENDED=2 SUSPENDED value + * @property {number} PENDING_DELETE=3 PENDING_DELETE value + * @property {number} PENDING_CREATE=4 PENDING_CREATE value + * @property {number} MAINTENANCE=5 MAINTENANCE value + * @property {number} FAILED=6 FAILED value + * @property {number} ONLINE_MAINTENANCE=7 ONLINE_MAINTENANCE value + * @property {number} REPAIRING=8 REPAIRING value + */ + DatabaseInstance.SqlInstanceState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_INSTANCE_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNABLE"] = 1; + values[valuesById[2] = "SUSPENDED"] = 2; + values[valuesById[3] = "PENDING_DELETE"] = 3; + values[valuesById[4] = "PENDING_CREATE"] = 4; + values[valuesById[5] = "MAINTENANCE"] = 5; + values[valuesById[6] = "FAILED"] = 6; + values[valuesById[7] = "ONLINE_MAINTENANCE"] = 7; + values[valuesById[8] = "REPAIRING"] = 8; + return values; + })(); + + DatabaseInstance.SqlFailoverReplica = (function() { + + /** + * Properties of a SqlFailoverReplica. + * @memberof google.cloud.sql.v1.DatabaseInstance + * @interface ISqlFailoverReplica + * @property {string|null} [name] SqlFailoverReplica name + * @property {google.protobuf.IBoolValue|null} [available] SqlFailoverReplica available + */ + + /** + * Constructs a new SqlFailoverReplica. + * @memberof google.cloud.sql.v1.DatabaseInstance + * @classdesc Represents a SqlFailoverReplica. + * @implements ISqlFailoverReplica + * @constructor + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica=} [properties] Properties to set + */ + function SqlFailoverReplica(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlFailoverReplica name. + * @member {string} name + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @instance + */ + SqlFailoverReplica.prototype.name = ""; + + /** + * SqlFailoverReplica available. + * @member {google.protobuf.IBoolValue|null|undefined} available + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @instance + */ + SqlFailoverReplica.prototype.available = null; + + /** + * Creates a new SqlFailoverReplica instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica instance + */ + SqlFailoverReplica.create = function create(properties) { + return new SqlFailoverReplica(properties); + }; + + /** + * Encodes the specified SqlFailoverReplica message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica} message SqlFailoverReplica message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlFailoverReplica.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.available != null && Object.hasOwnProperty.call(message, "available")) + $root.google.protobuf.BoolValue.encode(message.available, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlFailoverReplica message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica} message SqlFailoverReplica message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlFailoverReplica.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlFailoverReplica message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlFailoverReplica.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.available = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlFailoverReplica message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlFailoverReplica.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlFailoverReplica message. + * @function verify + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlFailoverReplica.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.available != null && message.hasOwnProperty("available")) { + var error = $root.google.protobuf.BoolValue.verify(message.available); + if (error) + return "available." + error; + } + return null; + }; + + /** + * Creates a SqlFailoverReplica message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica + */ + SqlFailoverReplica.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica) + return object; + var message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica(); + if (object.name != null) + message.name = String(object.name); + if (object.available != null) { + if (typeof object.available !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.available: object expected"); + message.available = $root.google.protobuf.BoolValue.fromObject(object.available); + } + return message; + }; + + /** + * Creates a plain object from a SqlFailoverReplica message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica} message SqlFailoverReplica + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlFailoverReplica.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.available = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.available != null && message.hasOwnProperty("available")) + object.available = $root.google.protobuf.BoolValue.toObject(message.available, options); + return object; + }; + + /** + * Converts this SqlFailoverReplica to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @instance + * @returns {Object.} JSON object + */ + SqlFailoverReplica.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlFailoverReplica + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlFailoverReplica.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica"; + }; + + return SqlFailoverReplica; + })(); + + DatabaseInstance.SqlScheduledMaintenance = (function() { + + /** + * Properties of a SqlScheduledMaintenance. + * @memberof google.cloud.sql.v1.DatabaseInstance + * @interface ISqlScheduledMaintenance + * @property {google.protobuf.ITimestamp|null} [startTime] SqlScheduledMaintenance startTime + * @property {boolean|null} [canDefer] SqlScheduledMaintenance canDefer + * @property {boolean|null} [canReschedule] SqlScheduledMaintenance canReschedule + * @property {google.protobuf.ITimestamp|null} [scheduleDeadlineTime] SqlScheduledMaintenance scheduleDeadlineTime + */ + + /** + * Constructs a new SqlScheduledMaintenance. + * @memberof google.cloud.sql.v1.DatabaseInstance + * @classdesc Represents a SqlScheduledMaintenance. + * @implements ISqlScheduledMaintenance + * @constructor + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance=} [properties] Properties to set + */ + function SqlScheduledMaintenance(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlScheduledMaintenance startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @instance + */ + SqlScheduledMaintenance.prototype.startTime = null; + + /** + * SqlScheduledMaintenance canDefer. + * @member {boolean} canDefer + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @instance + */ + SqlScheduledMaintenance.prototype.canDefer = false; + + /** + * SqlScheduledMaintenance canReschedule. + * @member {boolean} canReschedule + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @instance + */ + SqlScheduledMaintenance.prototype.canReschedule = false; + + /** + * SqlScheduledMaintenance scheduleDeadlineTime. + * @member {google.protobuf.ITimestamp|null|undefined} scheduleDeadlineTime + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @instance + */ + SqlScheduledMaintenance.prototype.scheduleDeadlineTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlScheduledMaintenance.prototype, "_scheduleDeadlineTime", { + get: $util.oneOfGetter($oneOfFields = ["scheduleDeadlineTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlScheduledMaintenance instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance instance + */ + SqlScheduledMaintenance.create = function create(properties) { + return new SqlScheduledMaintenance(properties); + }; + + /** + * Encodes the specified SqlScheduledMaintenance message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance} message SqlScheduledMaintenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlScheduledMaintenance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.canDefer != null && Object.hasOwnProperty.call(message, "canDefer")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.canDefer); + if (message.canReschedule != null && Object.hasOwnProperty.call(message, "canReschedule")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.canReschedule); + if (message.scheduleDeadlineTime != null && Object.hasOwnProperty.call(message, "scheduleDeadlineTime")) + $root.google.protobuf.Timestamp.encode(message.scheduleDeadlineTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlScheduledMaintenance message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance} message SqlScheduledMaintenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlScheduledMaintenance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlScheduledMaintenance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlScheduledMaintenance.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.canDefer = reader.bool(); + break; + } + case 3: { + message.canReschedule = reader.bool(); + break; + } + case 4: { + message.scheduleDeadlineTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlScheduledMaintenance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlScheduledMaintenance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlScheduledMaintenance message. + * @function verify + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlScheduledMaintenance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.canDefer != null && message.hasOwnProperty("canDefer")) + if (typeof message.canDefer !== "boolean") + return "canDefer: boolean expected"; + if (message.canReschedule != null && message.hasOwnProperty("canReschedule")) + if (typeof message.canReschedule !== "boolean") + return "canReschedule: boolean expected"; + if (message.scheduleDeadlineTime != null && message.hasOwnProperty("scheduleDeadlineTime")) { + properties._scheduleDeadlineTime = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.scheduleDeadlineTime); + if (error) + return "scheduleDeadlineTime." + error; + } + } + return null; + }; + + /** + * Creates a SqlScheduledMaintenance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance + */ + SqlScheduledMaintenance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance) + return object; + var message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.canDefer != null) + message.canDefer = Boolean(object.canDefer); + if (object.canReschedule != null) + message.canReschedule = Boolean(object.canReschedule); + if (object.scheduleDeadlineTime != null) { + if (typeof object.scheduleDeadlineTime !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.scheduleDeadlineTime: object expected"); + message.scheduleDeadlineTime = $root.google.protobuf.Timestamp.fromObject(object.scheduleDeadlineTime); + } + return message; + }; + + /** + * Creates a plain object from a SqlScheduledMaintenance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance} message SqlScheduledMaintenance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlScheduledMaintenance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.canDefer = false; + object.canReschedule = false; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.canDefer != null && message.hasOwnProperty("canDefer")) + object.canDefer = message.canDefer; + if (message.canReschedule != null && message.hasOwnProperty("canReschedule")) + object.canReschedule = message.canReschedule; + if (message.scheduleDeadlineTime != null && message.hasOwnProperty("scheduleDeadlineTime")) { + object.scheduleDeadlineTime = $root.google.protobuf.Timestamp.toObject(message.scheduleDeadlineTime, options); + if (options.oneofs) + object._scheduleDeadlineTime = "scheduleDeadlineTime"; + } + return object; + }; + + /** + * Converts this SqlScheduledMaintenance to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @instance + * @returns {Object.} JSON object + */ + SqlScheduledMaintenance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlScheduledMaintenance + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlScheduledMaintenance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance"; + }; + + return SqlScheduledMaintenance; + })(); + + DatabaseInstance.SqlOutOfDiskReport = (function() { + + /** + * Properties of a SqlOutOfDiskReport. + * @memberof google.cloud.sql.v1.DatabaseInstance + * @interface ISqlOutOfDiskReport + * @property {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null} [sqlOutOfDiskState] SqlOutOfDiskReport sqlOutOfDiskState + * @property {number|null} [sqlMinRecommendedIncreaseSizeGb] SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb + */ + + /** + * Constructs a new SqlOutOfDiskReport. + * @memberof google.cloud.sql.v1.DatabaseInstance + * @classdesc Represents a SqlOutOfDiskReport. + * @implements ISqlOutOfDiskReport + * @constructor + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport=} [properties] Properties to set + */ + function SqlOutOfDiskReport(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlOutOfDiskReport sqlOutOfDiskState. + * @member {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null|undefined} sqlOutOfDiskState + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @instance + */ + SqlOutOfDiskReport.prototype.sqlOutOfDiskState = null; + + /** + * SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb. + * @member {number|null|undefined} sqlMinRecommendedIncreaseSizeGb + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @instance + */ + SqlOutOfDiskReport.prototype.sqlMinRecommendedIncreaseSizeGb = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlOutOfDiskReport.prototype, "_sqlOutOfDiskState", { + get: $util.oneOfGetter($oneOfFields = ["sqlOutOfDiskState"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlOutOfDiskReport.prototype, "_sqlMinRecommendedIncreaseSizeGb", { + get: $util.oneOfGetter($oneOfFields = ["sqlMinRecommendedIncreaseSizeGb"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlOutOfDiskReport instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport instance + */ + SqlOutOfDiskReport.create = function create(properties) { + return new SqlOutOfDiskReport(properties); + }; + + /** + * Encodes the specified SqlOutOfDiskReport message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport} message SqlOutOfDiskReport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOutOfDiskReport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sqlOutOfDiskState != null && Object.hasOwnProperty.call(message, "sqlOutOfDiskState")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.sqlOutOfDiskState); + if (message.sqlMinRecommendedIncreaseSizeGb != null && Object.hasOwnProperty.call(message, "sqlMinRecommendedIncreaseSizeGb")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sqlMinRecommendedIncreaseSizeGb); + return writer; + }; + + /** + * Encodes the specified SqlOutOfDiskReport message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport} message SqlOutOfDiskReport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOutOfDiskReport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlOutOfDiskReport message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOutOfDiskReport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.sqlOutOfDiskState = reader.int32(); + break; + } + case 2: { + message.sqlMinRecommendedIncreaseSizeGb = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlOutOfDiskReport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOutOfDiskReport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlOutOfDiskReport message. + * @function verify + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlOutOfDiskReport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.sqlOutOfDiskState != null && message.hasOwnProperty("sqlOutOfDiskState")) { + properties._sqlOutOfDiskState = 1; + switch (message.sqlOutOfDiskState) { + default: + return "sqlOutOfDiskState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.sqlMinRecommendedIncreaseSizeGb != null && message.hasOwnProperty("sqlMinRecommendedIncreaseSizeGb")) { + properties._sqlMinRecommendedIncreaseSizeGb = 1; + if (!$util.isInteger(message.sqlMinRecommendedIncreaseSizeGb)) + return "sqlMinRecommendedIncreaseSizeGb: integer expected"; + } + return null; + }; + + /** + * Creates a SqlOutOfDiskReport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport + */ + SqlOutOfDiskReport.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport) + return object; + var message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport(); + switch (object.sqlOutOfDiskState) { + default: + if (typeof object.sqlOutOfDiskState === "number") { + message.sqlOutOfDiskState = object.sqlOutOfDiskState; + break; + } + break; + case "SQL_OUT_OF_DISK_STATE_UNSPECIFIED": + case 0: + message.sqlOutOfDiskState = 0; + break; + case "NORMAL": + case 1: + message.sqlOutOfDiskState = 1; + break; + case "SOFT_SHUTDOWN": + case 2: + message.sqlOutOfDiskState = 2; + break; + } + if (object.sqlMinRecommendedIncreaseSizeGb != null) + message.sqlMinRecommendedIncreaseSizeGb = object.sqlMinRecommendedIncreaseSizeGb | 0; + return message; + }; + + /** + * Creates a plain object from a SqlOutOfDiskReport message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport} message SqlOutOfDiskReport + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlOutOfDiskReport.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.sqlOutOfDiskState != null && message.hasOwnProperty("sqlOutOfDiskState")) { + object.sqlOutOfDiskState = options.enums === String ? $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState[message.sqlOutOfDiskState] === undefined ? message.sqlOutOfDiskState : $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState[message.sqlOutOfDiskState] : message.sqlOutOfDiskState; + if (options.oneofs) + object._sqlOutOfDiskState = "sqlOutOfDiskState"; + } + if (message.sqlMinRecommendedIncreaseSizeGb != null && message.hasOwnProperty("sqlMinRecommendedIncreaseSizeGb")) { + object.sqlMinRecommendedIncreaseSizeGb = message.sqlMinRecommendedIncreaseSizeGb; + if (options.oneofs) + object._sqlMinRecommendedIncreaseSizeGb = "sqlMinRecommendedIncreaseSizeGb"; + } + return object; + }; + + /** + * Converts this SqlOutOfDiskReport to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @instance + * @returns {Object.} JSON object + */ + SqlOutOfDiskReport.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlOutOfDiskReport + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlOutOfDiskReport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport"; + }; + + /** + * SqlOutOfDiskState enum. + * @name google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState + * @enum {number} + * @property {number} SQL_OUT_OF_DISK_STATE_UNSPECIFIED=0 SQL_OUT_OF_DISK_STATE_UNSPECIFIED value + * @property {number} NORMAL=1 NORMAL value + * @property {number} SOFT_SHUTDOWN=2 SOFT_SHUTDOWN value + */ + SqlOutOfDiskReport.SqlOutOfDiskState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_OUT_OF_DISK_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NORMAL"] = 1; + values[valuesById[2] = "SOFT_SHUTDOWN"] = 2; + return values; + })(); + + return SqlOutOfDiskReport; + })(); + + /** + * SqlNetworkArchitecture enum. + * @name google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture + * @enum {number} + * @property {number} SQL_NETWORK_ARCHITECTURE_UNSPECIFIED=0 SQL_NETWORK_ARCHITECTURE_UNSPECIFIED value + * @property {number} NEW_NETWORK_ARCHITECTURE=1 NEW_NETWORK_ARCHITECTURE value + * @property {number} OLD_NETWORK_ARCHITECTURE=2 OLD_NETWORK_ARCHITECTURE value + */ + DatabaseInstance.SqlNetworkArchitecture = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NEW_NETWORK_ARCHITECTURE"] = 1; + values[valuesById[2] = "OLD_NETWORK_ARCHITECTURE"] = 2; + return values; + })(); + + DatabaseInstance.PoolNodeConfig = (function() { + + /** + * Properties of a PoolNodeConfig. + * @memberof google.cloud.sql.v1.DatabaseInstance + * @interface IPoolNodeConfig + * @property {string|null} [name] PoolNodeConfig name + * @property {string|null} [gceZone] PoolNodeConfig gceZone + * @property {Array.|null} [ipAddresses] PoolNodeConfig ipAddresses + * @property {string|null} [dnsName] PoolNodeConfig dnsName + * @property {google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null} [state] PoolNodeConfig state + * @property {Array.|null} [dnsNames] PoolNodeConfig dnsNames + * @property {string|null} [pscServiceAttachmentLink] PoolNodeConfig pscServiceAttachmentLink + * @property {Array.|null} [pscAutoConnections] PoolNodeConfig pscAutoConnections + */ + + /** + * Constructs a new PoolNodeConfig. + * @memberof google.cloud.sql.v1.DatabaseInstance + * @classdesc Represents a PoolNodeConfig. + * @implements IPoolNodeConfig + * @constructor + * @param {google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig=} [properties] Properties to set + */ + function PoolNodeConfig(properties) { + this.ipAddresses = []; + this.dnsNames = []; + this.pscAutoConnections = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PoolNodeConfig name. + * @member {string|null|undefined} name + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.name = null; + + /** + * PoolNodeConfig gceZone. + * @member {string|null|undefined} gceZone + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.gceZone = null; + + /** + * PoolNodeConfig ipAddresses. + * @member {Array.} ipAddresses + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.ipAddresses = $util.emptyArray; + + /** + * PoolNodeConfig dnsName. + * @member {string|null|undefined} dnsName + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.dnsName = null; + + /** + * PoolNodeConfig state. + * @member {google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null|undefined} state + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.state = null; + + /** + * PoolNodeConfig dnsNames. + * @member {Array.} dnsNames + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.dnsNames = $util.emptyArray; + + /** + * PoolNodeConfig pscServiceAttachmentLink. + * @member {string|null|undefined} pscServiceAttachmentLink + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.pscServiceAttachmentLink = null; + + /** + * PoolNodeConfig pscAutoConnections. + * @member {Array.} pscAutoConnections + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.pscAutoConnections = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PoolNodeConfig.prototype, "_name", { + get: $util.oneOfGetter($oneOfFields = ["name"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PoolNodeConfig.prototype, "_gceZone", { + get: $util.oneOfGetter($oneOfFields = ["gceZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PoolNodeConfig.prototype, "_dnsName", { + get: $util.oneOfGetter($oneOfFields = ["dnsName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PoolNodeConfig.prototype, "_state", { + get: $util.oneOfGetter($oneOfFields = ["state"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PoolNodeConfig.prototype, "_pscServiceAttachmentLink", { + get: $util.oneOfGetter($oneOfFields = ["pscServiceAttachmentLink"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PoolNodeConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig} PoolNodeConfig instance + */ + PoolNodeConfig.create = function create(properties) { + return new PoolNodeConfig(properties); + }; + + /** + * Encodes the specified PoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig} message PoolNodeConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PoolNodeConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.gceZone != null && Object.hasOwnProperty.call(message, "gceZone")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.gceZone); + if (message.ipAddresses != null && message.ipAddresses.length) + for (var i = 0; i < message.ipAddresses.length; ++i) + $root.google.cloud.sql.v1.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dnsName); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.state); + if (message.dnsNames != null && message.dnsNames.length) + for (var i = 0; i < message.dnsNames.length; ++i) + $root.google.cloud.sql.v1.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.pscServiceAttachmentLink != null && Object.hasOwnProperty.call(message, "pscServiceAttachmentLink")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.pscServiceAttachmentLink); + if (message.pscAutoConnections != null && message.pscAutoConnections.length) + for (var i = 0; i < message.pscAutoConnections.length; ++i) + $root.google.cloud.sql.v1.PscAutoConnectionConfig.encode(message.pscAutoConnections[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig} message PoolNodeConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PoolNodeConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PoolNodeConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig} PoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PoolNodeConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.gceZone = reader.string(); + break; + } + case 3: { + if (!(message.ipAddresses && message.ipAddresses.length)) + message.ipAddresses = []; + message.ipAddresses.push($root.google.cloud.sql.v1.IpMapping.decode(reader, reader.uint32())); + break; + } + case 4: { + message.dnsName = reader.string(); + break; + } + case 5: { + message.state = reader.int32(); + break; + } + case 6: { + if (!(message.dnsNames && message.dnsNames.length)) + message.dnsNames = []; + message.dnsNames.push($root.google.cloud.sql.v1.DnsNameMapping.decode(reader, reader.uint32())); + break; + } + case 7: { + message.pscServiceAttachmentLink = reader.string(); + break; + } + case 8: { + if (!(message.pscAutoConnections && message.pscAutoConnections.length)) + message.pscAutoConnections = []; + message.pscAutoConnections.push($root.google.cloud.sql.v1.PscAutoConnectionConfig.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PoolNodeConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig} PoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PoolNodeConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PoolNodeConfig message. + * @function verify + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PoolNodeConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) { + properties._name = 1; + if (!$util.isString(message.name)) + return "name: string expected"; + } + if (message.gceZone != null && message.hasOwnProperty("gceZone")) { + properties._gceZone = 1; + if (!$util.isString(message.gceZone)) + return "gceZone: string expected"; + } + if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { + if (!Array.isArray(message.ipAddresses)) + return "ipAddresses: array expected"; + for (var i = 0; i < message.ipAddresses.length; ++i) { + var error = $root.google.cloud.sql.v1.IpMapping.verify(message.ipAddresses[i]); + if (error) + return "ipAddresses." + error; + } + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + properties._dnsName = 1; + if (!$util.isString(message.dnsName)) + return "dnsName: string expected"; + } + if (message.state != null && message.hasOwnProperty("state")) { + properties._state = 1; + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + } + if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { + if (!Array.isArray(message.dnsNames)) + return "dnsNames: array expected"; + for (var i = 0; i < message.dnsNames.length; ++i) { + var error = $root.google.cloud.sql.v1.DnsNameMapping.verify(message.dnsNames[i]); + if (error) + return "dnsNames." + error; + } + } + if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { + properties._pscServiceAttachmentLink = 1; + if (!$util.isString(message.pscServiceAttachmentLink)) + return "pscServiceAttachmentLink: string expected"; + } + if (message.pscAutoConnections != null && message.hasOwnProperty("pscAutoConnections")) { + if (!Array.isArray(message.pscAutoConnections)) + return "pscAutoConnections: array expected"; + for (var i = 0; i < message.pscAutoConnections.length; ++i) { + var error = $root.google.cloud.sql.v1.PscAutoConnectionConfig.verify(message.pscAutoConnections[i]); + if (error) + return "pscAutoConnections." + error; + } + } + return null; + }; + + /** + * Creates a PoolNodeConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig} PoolNodeConfig + */ + PoolNodeConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig) + return object; + var message = new $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.gceZone != null) + message.gceZone = String(object.gceZone); + if (object.ipAddresses) { + if (!Array.isArray(object.ipAddresses)) + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.ipAddresses: array expected"); + message.ipAddresses = []; + for (var i = 0; i < object.ipAddresses.length; ++i) { + if (typeof object.ipAddresses[i] !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.ipAddresses: object expected"); + message.ipAddresses[i] = $root.google.cloud.sql.v1.IpMapping.fromObject(object.ipAddresses[i]); + } + } + if (object.dnsName != null) + message.dnsName = String(object.dnsName); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "SQL_INSTANCE_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNABLE": + case 1: + message.state = 1; + break; + case "SUSPENDED": + case 2: + message.state = 2; + break; + case "PENDING_DELETE": + case 3: + message.state = 3; + break; + case "PENDING_CREATE": + case 4: + message.state = 4; + break; + case "MAINTENANCE": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + case "ONLINE_MAINTENANCE": + case 7: + message.state = 7; + break; + case "REPAIRING": + case 8: + message.state = 8; + break; + } + if (object.dnsNames) { + if (!Array.isArray(object.dnsNames)) + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.dnsNames: array expected"); + message.dnsNames = []; + for (var i = 0; i < object.dnsNames.length; ++i) { + if (typeof object.dnsNames[i] !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.dnsNames: object expected"); + message.dnsNames[i] = $root.google.cloud.sql.v1.DnsNameMapping.fromObject(object.dnsNames[i]); + } + } + if (object.pscServiceAttachmentLink != null) + message.pscServiceAttachmentLink = String(object.pscServiceAttachmentLink); + if (object.pscAutoConnections) { + if (!Array.isArray(object.pscAutoConnections)) + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.pscAutoConnections: array expected"); + message.pscAutoConnections = []; + for (var i = 0; i < object.pscAutoConnections.length; ++i) { + if (typeof object.pscAutoConnections[i] !== "object") + throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.pscAutoConnections: object expected"); + message.pscAutoConnections[i] = $root.google.cloud.sql.v1.PscAutoConnectionConfig.fromObject(object.pscAutoConnections[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PoolNodeConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @static + * @param {google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig} message PoolNodeConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PoolNodeConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.ipAddresses = []; + object.dnsNames = []; + object.pscAutoConnections = []; + } + if (message.name != null && message.hasOwnProperty("name")) { + object.name = message.name; + if (options.oneofs) + object._name = "name"; + } + if (message.gceZone != null && message.hasOwnProperty("gceZone")) { + object.gceZone = message.gceZone; + if (options.oneofs) + object._gceZone = "gceZone"; + } + if (message.ipAddresses && message.ipAddresses.length) { + object.ipAddresses = []; + for (var j = 0; j < message.ipAddresses.length; ++j) + object.ipAddresses[j] = $root.google.cloud.sql.v1.IpMapping.toObject(message.ipAddresses[j], options); + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + object.dnsName = message.dnsName; + if (options.oneofs) + object._dnsName = "dnsName"; + } + if (message.state != null && message.hasOwnProperty("state")) { + object.state = options.enums === String ? $root.google.cloud.sql.v1.DatabaseInstance.SqlInstanceState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1.DatabaseInstance.SqlInstanceState[message.state] : message.state; + if (options.oneofs) + object._state = "state"; + } + if (message.dnsNames && message.dnsNames.length) { + object.dnsNames = []; + for (var j = 0; j < message.dnsNames.length; ++j) + object.dnsNames[j] = $root.google.cloud.sql.v1.DnsNameMapping.toObject(message.dnsNames[j], options); + } + if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { + object.pscServiceAttachmentLink = message.pscServiceAttachmentLink; + if (options.oneofs) + object._pscServiceAttachmentLink = "pscServiceAttachmentLink"; + } + if (message.pscAutoConnections && message.pscAutoConnections.length) { + object.pscAutoConnections = []; + for (var j = 0; j < message.pscAutoConnections.length; ++j) + object.pscAutoConnections[j] = $root.google.cloud.sql.v1.PscAutoConnectionConfig.toObject(message.pscAutoConnections[j], options); + } + return object; + }; + + /** + * Converts this PoolNodeConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @instance + * @returns {Object.} JSON object + */ + PoolNodeConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PoolNodeConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PoolNodeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig"; + }; + + return PoolNodeConfig; + })(); + + return DatabaseInstance; + })(); + + v1.GeminiInstanceConfig = (function() { + + /** + * Properties of a GeminiInstanceConfig. + * @memberof google.cloud.sql.v1 + * @interface IGeminiInstanceConfig + * @property {boolean|null} [entitled] GeminiInstanceConfig entitled + * @property {boolean|null} [googleVacuumMgmtEnabled] GeminiInstanceConfig googleVacuumMgmtEnabled + * @property {boolean|null} [oomSessionCancelEnabled] GeminiInstanceConfig oomSessionCancelEnabled + * @property {boolean|null} [activeQueryEnabled] GeminiInstanceConfig activeQueryEnabled + * @property {boolean|null} [indexAdvisorEnabled] GeminiInstanceConfig indexAdvisorEnabled + * @property {boolean|null} [flagRecommenderEnabled] GeminiInstanceConfig flagRecommenderEnabled + */ + + /** + * Constructs a new GeminiInstanceConfig. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a GeminiInstanceConfig. + * @implements IGeminiInstanceConfig + * @constructor + * @param {google.cloud.sql.v1.IGeminiInstanceConfig=} [properties] Properties to set + */ + function GeminiInstanceConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeminiInstanceConfig entitled. + * @member {boolean|null|undefined} entitled + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.entitled = null; + + /** + * GeminiInstanceConfig googleVacuumMgmtEnabled. + * @member {boolean|null|undefined} googleVacuumMgmtEnabled + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.googleVacuumMgmtEnabled = null; + + /** + * GeminiInstanceConfig oomSessionCancelEnabled. + * @member {boolean|null|undefined} oomSessionCancelEnabled + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.oomSessionCancelEnabled = null; + + /** + * GeminiInstanceConfig activeQueryEnabled. + * @member {boolean|null|undefined} activeQueryEnabled + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.activeQueryEnabled = null; + + /** + * GeminiInstanceConfig indexAdvisorEnabled. + * @member {boolean|null|undefined} indexAdvisorEnabled + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.indexAdvisorEnabled = null; + + /** + * GeminiInstanceConfig flagRecommenderEnabled. + * @member {boolean|null|undefined} flagRecommenderEnabled + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.flagRecommenderEnabled = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_entitled", { + get: $util.oneOfGetter($oneOfFields = ["entitled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_googleVacuumMgmtEnabled", { + get: $util.oneOfGetter($oneOfFields = ["googleVacuumMgmtEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_oomSessionCancelEnabled", { + get: $util.oneOfGetter($oneOfFields = ["oomSessionCancelEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_activeQueryEnabled", { + get: $util.oneOfGetter($oneOfFields = ["activeQueryEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_indexAdvisorEnabled", { + get: $util.oneOfGetter($oneOfFields = ["indexAdvisorEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_flagRecommenderEnabled", { + get: $util.oneOfGetter($oneOfFields = ["flagRecommenderEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GeminiInstanceConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @static + * @param {google.cloud.sql.v1.IGeminiInstanceConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.GeminiInstanceConfig} GeminiInstanceConfig instance + */ + GeminiInstanceConfig.create = function create(properties) { + return new GeminiInstanceConfig(properties); + }; + + /** + * Encodes the specified GeminiInstanceConfig message. Does not implicitly {@link google.cloud.sql.v1.GeminiInstanceConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @static + * @param {google.cloud.sql.v1.IGeminiInstanceConfig} message GeminiInstanceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeminiInstanceConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entitled != null && Object.hasOwnProperty.call(message, "entitled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.entitled); + if (message.googleVacuumMgmtEnabled != null && Object.hasOwnProperty.call(message, "googleVacuumMgmtEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.googleVacuumMgmtEnabled); + if (message.oomSessionCancelEnabled != null && Object.hasOwnProperty.call(message, "oomSessionCancelEnabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.oomSessionCancelEnabled); + if (message.activeQueryEnabled != null && Object.hasOwnProperty.call(message, "activeQueryEnabled")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.activeQueryEnabled); + if (message.indexAdvisorEnabled != null && Object.hasOwnProperty.call(message, "indexAdvisorEnabled")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.indexAdvisorEnabled); + if (message.flagRecommenderEnabled != null && Object.hasOwnProperty.call(message, "flagRecommenderEnabled")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.flagRecommenderEnabled); + return writer; + }; + + /** + * Encodes the specified GeminiInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GeminiInstanceConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @static + * @param {google.cloud.sql.v1.IGeminiInstanceConfig} message GeminiInstanceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeminiInstanceConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeminiInstanceConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.GeminiInstanceConfig} GeminiInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeminiInstanceConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.GeminiInstanceConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.entitled = reader.bool(); + break; + } + case 2: { + message.googleVacuumMgmtEnabled = reader.bool(); + break; + } + case 3: { + message.oomSessionCancelEnabled = reader.bool(); + break; + } + case 4: { + message.activeQueryEnabled = reader.bool(); + break; + } + case 5: { + message.indexAdvisorEnabled = reader.bool(); + break; + } + case 6: { + message.flagRecommenderEnabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeminiInstanceConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.GeminiInstanceConfig} GeminiInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeminiInstanceConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeminiInstanceConfig message. + * @function verify + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeminiInstanceConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.entitled != null && message.hasOwnProperty("entitled")) { + properties._entitled = 1; + if (typeof message.entitled !== "boolean") + return "entitled: boolean expected"; + } + if (message.googleVacuumMgmtEnabled != null && message.hasOwnProperty("googleVacuumMgmtEnabled")) { + properties._googleVacuumMgmtEnabled = 1; + if (typeof message.googleVacuumMgmtEnabled !== "boolean") + return "googleVacuumMgmtEnabled: boolean expected"; + } + if (message.oomSessionCancelEnabled != null && message.hasOwnProperty("oomSessionCancelEnabled")) { + properties._oomSessionCancelEnabled = 1; + if (typeof message.oomSessionCancelEnabled !== "boolean") + return "oomSessionCancelEnabled: boolean expected"; + } + if (message.activeQueryEnabled != null && message.hasOwnProperty("activeQueryEnabled")) { + properties._activeQueryEnabled = 1; + if (typeof message.activeQueryEnabled !== "boolean") + return "activeQueryEnabled: boolean expected"; + } + if (message.indexAdvisorEnabled != null && message.hasOwnProperty("indexAdvisorEnabled")) { + properties._indexAdvisorEnabled = 1; + if (typeof message.indexAdvisorEnabled !== "boolean") + return "indexAdvisorEnabled: boolean expected"; + } + if (message.flagRecommenderEnabled != null && message.hasOwnProperty("flagRecommenderEnabled")) { + properties._flagRecommenderEnabled = 1; + if (typeof message.flagRecommenderEnabled !== "boolean") + return "flagRecommenderEnabled: boolean expected"; + } + return null; + }; + + /** + * Creates a GeminiInstanceConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.GeminiInstanceConfig} GeminiInstanceConfig + */ + GeminiInstanceConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.GeminiInstanceConfig) + return object; + var message = new $root.google.cloud.sql.v1.GeminiInstanceConfig(); + if (object.entitled != null) + message.entitled = Boolean(object.entitled); + if (object.googleVacuumMgmtEnabled != null) + message.googleVacuumMgmtEnabled = Boolean(object.googleVacuumMgmtEnabled); + if (object.oomSessionCancelEnabled != null) + message.oomSessionCancelEnabled = Boolean(object.oomSessionCancelEnabled); + if (object.activeQueryEnabled != null) + message.activeQueryEnabled = Boolean(object.activeQueryEnabled); + if (object.indexAdvisorEnabled != null) + message.indexAdvisorEnabled = Boolean(object.indexAdvisorEnabled); + if (object.flagRecommenderEnabled != null) + message.flagRecommenderEnabled = Boolean(object.flagRecommenderEnabled); + return message; + }; + + /** + * Creates a plain object from a GeminiInstanceConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @static + * @param {google.cloud.sql.v1.GeminiInstanceConfig} message GeminiInstanceConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeminiInstanceConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.entitled != null && message.hasOwnProperty("entitled")) { + object.entitled = message.entitled; + if (options.oneofs) + object._entitled = "entitled"; + } + if (message.googleVacuumMgmtEnabled != null && message.hasOwnProperty("googleVacuumMgmtEnabled")) { + object.googleVacuumMgmtEnabled = message.googleVacuumMgmtEnabled; + if (options.oneofs) + object._googleVacuumMgmtEnabled = "googleVacuumMgmtEnabled"; + } + if (message.oomSessionCancelEnabled != null && message.hasOwnProperty("oomSessionCancelEnabled")) { + object.oomSessionCancelEnabled = message.oomSessionCancelEnabled; + if (options.oneofs) + object._oomSessionCancelEnabled = "oomSessionCancelEnabled"; + } + if (message.activeQueryEnabled != null && message.hasOwnProperty("activeQueryEnabled")) { + object.activeQueryEnabled = message.activeQueryEnabled; + if (options.oneofs) + object._activeQueryEnabled = "activeQueryEnabled"; + } + if (message.indexAdvisorEnabled != null && message.hasOwnProperty("indexAdvisorEnabled")) { + object.indexAdvisorEnabled = message.indexAdvisorEnabled; + if (options.oneofs) + object._indexAdvisorEnabled = "indexAdvisorEnabled"; + } + if (message.flagRecommenderEnabled != null && message.hasOwnProperty("flagRecommenderEnabled")) { + object.flagRecommenderEnabled = message.flagRecommenderEnabled; + if (options.oneofs) + object._flagRecommenderEnabled = "flagRecommenderEnabled"; + } + return object; + }; + + /** + * Converts this GeminiInstanceConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @instance + * @returns {Object.} JSON object + */ + GeminiInstanceConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GeminiInstanceConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.GeminiInstanceConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GeminiInstanceConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.GeminiInstanceConfig"; + }; + + return GeminiInstanceConfig; + })(); + + v1.ReplicationCluster = (function() { + + /** + * Properties of a ReplicationCluster. + * @memberof google.cloud.sql.v1 + * @interface IReplicationCluster + * @property {string|null} [psaWriteEndpoint] ReplicationCluster psaWriteEndpoint + * @property {string|null} [failoverDrReplicaName] ReplicationCluster failoverDrReplicaName + * @property {boolean|null} [drReplica] ReplicationCluster drReplica + */ + + /** + * Constructs a new ReplicationCluster. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a ReplicationCluster. + * @implements IReplicationCluster + * @constructor + * @param {google.cloud.sql.v1.IReplicationCluster=} [properties] Properties to set + */ + function ReplicationCluster(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReplicationCluster psaWriteEndpoint. + * @member {string} psaWriteEndpoint + * @memberof google.cloud.sql.v1.ReplicationCluster + * @instance + */ + ReplicationCluster.prototype.psaWriteEndpoint = ""; + + /** + * ReplicationCluster failoverDrReplicaName. + * @member {string} failoverDrReplicaName + * @memberof google.cloud.sql.v1.ReplicationCluster + * @instance + */ + ReplicationCluster.prototype.failoverDrReplicaName = ""; + + /** + * ReplicationCluster drReplica. + * @member {boolean} drReplica + * @memberof google.cloud.sql.v1.ReplicationCluster + * @instance + */ + ReplicationCluster.prototype.drReplica = false; + + /** + * Creates a new ReplicationCluster instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ReplicationCluster + * @static + * @param {google.cloud.sql.v1.IReplicationCluster=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ReplicationCluster} ReplicationCluster instance + */ + ReplicationCluster.create = function create(properties) { + return new ReplicationCluster(properties); + }; + + /** + * Encodes the specified ReplicationCluster message. Does not implicitly {@link google.cloud.sql.v1.ReplicationCluster.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ReplicationCluster + * @static + * @param {google.cloud.sql.v1.IReplicationCluster} message ReplicationCluster message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicationCluster.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.psaWriteEndpoint != null && Object.hasOwnProperty.call(message, "psaWriteEndpoint")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.psaWriteEndpoint); + if (message.failoverDrReplicaName != null && Object.hasOwnProperty.call(message, "failoverDrReplicaName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.failoverDrReplicaName); + if (message.drReplica != null && Object.hasOwnProperty.call(message, "drReplica")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.drReplica); + return writer; + }; + + /** + * Encodes the specified ReplicationCluster message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReplicationCluster.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ReplicationCluster + * @static + * @param {google.cloud.sql.v1.IReplicationCluster} message ReplicationCluster message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicationCluster.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplicationCluster message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ReplicationCluster + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ReplicationCluster} ReplicationCluster + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicationCluster.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ReplicationCluster(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.psaWriteEndpoint = reader.string(); + break; + } + case 2: { + message.failoverDrReplicaName = reader.string(); + break; + } + case 4: { + message.drReplica = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplicationCluster message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ReplicationCluster + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ReplicationCluster} ReplicationCluster + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicationCluster.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplicationCluster message. + * @function verify + * @memberof google.cloud.sql.v1.ReplicationCluster + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplicationCluster.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.psaWriteEndpoint != null && message.hasOwnProperty("psaWriteEndpoint")) + if (!$util.isString(message.psaWriteEndpoint)) + return "psaWriteEndpoint: string expected"; + if (message.failoverDrReplicaName != null && message.hasOwnProperty("failoverDrReplicaName")) + if (!$util.isString(message.failoverDrReplicaName)) + return "failoverDrReplicaName: string expected"; + if (message.drReplica != null && message.hasOwnProperty("drReplica")) + if (typeof message.drReplica !== "boolean") + return "drReplica: boolean expected"; + return null; + }; + + /** + * Creates a ReplicationCluster message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ReplicationCluster + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ReplicationCluster} ReplicationCluster + */ + ReplicationCluster.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ReplicationCluster) + return object; + var message = new $root.google.cloud.sql.v1.ReplicationCluster(); + if (object.psaWriteEndpoint != null) + message.psaWriteEndpoint = String(object.psaWriteEndpoint); + if (object.failoverDrReplicaName != null) + message.failoverDrReplicaName = String(object.failoverDrReplicaName); + if (object.drReplica != null) + message.drReplica = Boolean(object.drReplica); + return message; + }; + + /** + * Creates a plain object from a ReplicationCluster message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ReplicationCluster + * @static + * @param {google.cloud.sql.v1.ReplicationCluster} message ReplicationCluster + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplicationCluster.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.psaWriteEndpoint = ""; + object.failoverDrReplicaName = ""; + object.drReplica = false; + } + if (message.psaWriteEndpoint != null && message.hasOwnProperty("psaWriteEndpoint")) + object.psaWriteEndpoint = message.psaWriteEndpoint; + if (message.failoverDrReplicaName != null && message.hasOwnProperty("failoverDrReplicaName")) + object.failoverDrReplicaName = message.failoverDrReplicaName; + if (message.drReplica != null && message.hasOwnProperty("drReplica")) + object.drReplica = message.drReplica; + return object; + }; + + /** + * Converts this ReplicationCluster to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ReplicationCluster + * @instance + * @returns {Object.} JSON object + */ + ReplicationCluster.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReplicationCluster + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ReplicationCluster + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplicationCluster.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ReplicationCluster"; + }; + + return ReplicationCluster; + })(); + + v1.AvailableDatabaseVersion = (function() { + + /** + * Properties of an AvailableDatabaseVersion. + * @memberof google.cloud.sql.v1 + * @interface IAvailableDatabaseVersion + * @property {string|null} [majorVersion] AvailableDatabaseVersion majorVersion + * @property {string|null} [name] AvailableDatabaseVersion name + * @property {string|null} [displayName] AvailableDatabaseVersion displayName + */ + + /** + * Constructs a new AvailableDatabaseVersion. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an AvailableDatabaseVersion. + * @implements IAvailableDatabaseVersion + * @constructor + * @param {google.cloud.sql.v1.IAvailableDatabaseVersion=} [properties] Properties to set + */ + function AvailableDatabaseVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AvailableDatabaseVersion majorVersion. + * @member {string|null|undefined} majorVersion + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @instance + */ + AvailableDatabaseVersion.prototype.majorVersion = null; + + /** + * AvailableDatabaseVersion name. + * @member {string|null|undefined} name + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @instance + */ + AvailableDatabaseVersion.prototype.name = null; + + /** + * AvailableDatabaseVersion displayName. + * @member {string|null|undefined} displayName + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @instance + */ + AvailableDatabaseVersion.prototype.displayName = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AvailableDatabaseVersion.prototype, "_majorVersion", { + get: $util.oneOfGetter($oneOfFields = ["majorVersion"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AvailableDatabaseVersion.prototype, "_name", { + get: $util.oneOfGetter($oneOfFields = ["name"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AvailableDatabaseVersion.prototype, "_displayName", { + get: $util.oneOfGetter($oneOfFields = ["displayName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AvailableDatabaseVersion instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @static + * @param {google.cloud.sql.v1.IAvailableDatabaseVersion=} [properties] Properties to set + * @returns {google.cloud.sql.v1.AvailableDatabaseVersion} AvailableDatabaseVersion instance + */ + AvailableDatabaseVersion.create = function create(properties) { + return new AvailableDatabaseVersion(properties); + }; + + /** + * Encodes the specified AvailableDatabaseVersion message. Does not implicitly {@link google.cloud.sql.v1.AvailableDatabaseVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @static + * @param {google.cloud.sql.v1.IAvailableDatabaseVersion} message AvailableDatabaseVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AvailableDatabaseVersion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.majorVersion != null && Object.hasOwnProperty.call(message, "majorVersion")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.majorVersion); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.displayName); + return writer; + }; + + /** + * Encodes the specified AvailableDatabaseVersion message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AvailableDatabaseVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @static + * @param {google.cloud.sql.v1.IAvailableDatabaseVersion} message AvailableDatabaseVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AvailableDatabaseVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AvailableDatabaseVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.AvailableDatabaseVersion} AvailableDatabaseVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AvailableDatabaseVersion.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.AvailableDatabaseVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.majorVersion = reader.string(); + break; + } + case 8: { + message.name = reader.string(); + break; + } + case 9: { + message.displayName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AvailableDatabaseVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.AvailableDatabaseVersion} AvailableDatabaseVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AvailableDatabaseVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AvailableDatabaseVersion message. + * @function verify + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AvailableDatabaseVersion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.majorVersion != null && message.hasOwnProperty("majorVersion")) { + properties._majorVersion = 1; + if (!$util.isString(message.majorVersion)) + return "majorVersion: string expected"; + } + if (message.name != null && message.hasOwnProperty("name")) { + properties._name = 1; + if (!$util.isString(message.name)) + return "name: string expected"; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) { + properties._displayName = 1; + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + } + return null; + }; + + /** + * Creates an AvailableDatabaseVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.AvailableDatabaseVersion} AvailableDatabaseVersion + */ + AvailableDatabaseVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.AvailableDatabaseVersion) + return object; + var message = new $root.google.cloud.sql.v1.AvailableDatabaseVersion(); + if (object.majorVersion != null) + message.majorVersion = String(object.majorVersion); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + return message; + }; + + /** + * Creates a plain object from an AvailableDatabaseVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @static + * @param {google.cloud.sql.v1.AvailableDatabaseVersion} message AvailableDatabaseVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AvailableDatabaseVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.majorVersion != null && message.hasOwnProperty("majorVersion")) { + object.majorVersion = message.majorVersion; + if (options.oneofs) + object._majorVersion = "majorVersion"; + } + if (message.name != null && message.hasOwnProperty("name")) { + object.name = message.name; + if (options.oneofs) + object._name = "name"; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) { + object.displayName = message.displayName; + if (options.oneofs) + object._displayName = "displayName"; + } + return object; + }; + + /** + * Converts this AvailableDatabaseVersion to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @instance + * @returns {Object.} JSON object + */ + AvailableDatabaseVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AvailableDatabaseVersion + * @function getTypeUrl + * @memberof google.cloud.sql.v1.AvailableDatabaseVersion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AvailableDatabaseVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.AvailableDatabaseVersion"; + }; + + return AvailableDatabaseVersion; + })(); + + v1.SqlInstancesRescheduleMaintenanceRequestBody = (function() { + + /** + * Properties of a SqlInstancesRescheduleMaintenanceRequestBody. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesRescheduleMaintenanceRequestBody + * @property {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null} [reschedule] SqlInstancesRescheduleMaintenanceRequestBody reschedule + */ + + /** + * Constructs a new SqlInstancesRescheduleMaintenanceRequestBody. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesRescheduleMaintenanceRequestBody. + * @implements ISqlInstancesRescheduleMaintenanceRequestBody + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody=} [properties] Properties to set + */ + function SqlInstancesRescheduleMaintenanceRequestBody(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRescheduleMaintenanceRequestBody reschedule. + * @member {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null|undefined} reschedule + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @instance + */ + SqlInstancesRescheduleMaintenanceRequestBody.prototype.reschedule = null; + + /** + * Creates a new SqlInstancesRescheduleMaintenanceRequestBody instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody instance + */ + SqlInstancesRescheduleMaintenanceRequestBody.create = function create(properties) { + return new SqlInstancesRescheduleMaintenanceRequestBody(properties); + }; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRescheduleMaintenanceRequestBody.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.reschedule != null && Object.hasOwnProperty.call(message, "reschedule")) + $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.encode(message.reschedule, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRescheduleMaintenanceRequestBody.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRescheduleMaintenanceRequestBody.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.reschedule = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRescheduleMaintenanceRequestBody.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRescheduleMaintenanceRequestBody message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRescheduleMaintenanceRequestBody.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.reschedule != null && message.hasOwnProperty("reschedule")) { + var error = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify(message.reschedule); + if (error) + return "reschedule." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRescheduleMaintenanceRequestBody message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody + */ + SqlInstancesRescheduleMaintenanceRequestBody.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody(); + if (object.reschedule != null) { + if (typeof object.reschedule !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.reschedule: object expected"); + message.reschedule = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.fromObject(object.reschedule); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequestBody message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRescheduleMaintenanceRequestBody.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.reschedule = null; + if (message.reschedule != null && message.hasOwnProperty("reschedule")) + object.reschedule = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.toObject(message.reschedule, options); + return object; + }; + + /** + * Converts this SqlInstancesRescheduleMaintenanceRequestBody to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRescheduleMaintenanceRequestBody.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRescheduleMaintenanceRequestBody + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRescheduleMaintenanceRequestBody.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody"; + }; + + /** + * RescheduleType enum. + * @name google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType + * @enum {number} + * @property {number} RESCHEDULE_TYPE_UNSPECIFIED=0 RESCHEDULE_TYPE_UNSPECIFIED value + * @property {number} IMMEDIATE=1 IMMEDIATE value + * @property {number} NEXT_AVAILABLE_WINDOW=2 NEXT_AVAILABLE_WINDOW value + * @property {number} SPECIFIC_TIME=3 SPECIFIC_TIME value + */ + SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RESCHEDULE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "IMMEDIATE"] = 1; + values[valuesById[2] = "NEXT_AVAILABLE_WINDOW"] = 2; + values[valuesById[3] = "SPECIFIC_TIME"] = 3; + return values; + })(); + + SqlInstancesRescheduleMaintenanceRequestBody.Reschedule = (function() { + + /** + * Properties of a Reschedule. + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @interface IReschedule + * @property {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|null} [rescheduleType] Reschedule rescheduleType + * @property {google.protobuf.ITimestamp|null} [scheduleTime] Reschedule scheduleTime + */ + + /** + * Constructs a new Reschedule. + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody + * @classdesc Represents a Reschedule. + * @implements IReschedule + * @constructor + * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule=} [properties] Properties to set + */ + function Reschedule(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Reschedule rescheduleType. + * @member {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType} rescheduleType + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @instance + */ + Reschedule.prototype.rescheduleType = 0; + + /** + * Reschedule scheduleTime. + * @member {google.protobuf.ITimestamp|null|undefined} scheduleTime + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @instance + */ + Reschedule.prototype.scheduleTime = null; + + /** + * Creates a new Reschedule instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule instance + */ + Reschedule.create = function create(properties) { + return new Reschedule(properties); + }; + + /** + * Encodes the specified Reschedule message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule} message Reschedule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Reschedule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rescheduleType != null && Object.hasOwnProperty.call(message, "rescheduleType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.rescheduleType); + if (message.scheduleTime != null && Object.hasOwnProperty.call(message, "scheduleTime")) + $root.google.protobuf.Timestamp.encode(message.scheduleTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Reschedule message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule} message Reschedule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Reschedule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Reschedule message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Reschedule.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.rescheduleType = reader.int32(); + break; + } + case 2: { + message.scheduleTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Reschedule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Reschedule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Reschedule message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Reschedule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rescheduleType != null && message.hasOwnProperty("rescheduleType")) + switch (message.rescheduleType) { + default: + return "rescheduleType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.scheduleTime != null && message.hasOwnProperty("scheduleTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.scheduleTime); + if (error) + return "scheduleTime." + error; + } + return null; + }; + + /** + * Creates a Reschedule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule + */ + Reschedule.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule(); + switch (object.rescheduleType) { + default: + if (typeof object.rescheduleType === "number") { + message.rescheduleType = object.rescheduleType; + break; + } + break; + case "RESCHEDULE_TYPE_UNSPECIFIED": + case 0: + message.rescheduleType = 0; + break; + case "IMMEDIATE": + case 1: + message.rescheduleType = 1; + break; + case "NEXT_AVAILABLE_WINDOW": + case 2: + message.rescheduleType = 2; + break; + case "SPECIFIC_TIME": + case 3: + message.rescheduleType = 3; + break; + } + if (object.scheduleTime != null) { + if (typeof object.scheduleTime !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.scheduleTime: object expected"); + message.scheduleTime = $root.google.protobuf.Timestamp.fromObject(object.scheduleTime); + } + return message; + }; + + /** + * Creates a plain object from a Reschedule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} message Reschedule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Reschedule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.rescheduleType = options.enums === String ? "RESCHEDULE_TYPE_UNSPECIFIED" : 0; + object.scheduleTime = null; + } + if (message.rescheduleType != null && message.hasOwnProperty("rescheduleType")) + object.rescheduleType = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType[message.rescheduleType] === undefined ? message.rescheduleType : $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType[message.rescheduleType] : message.rescheduleType; + if (message.scheduleTime != null && message.hasOwnProperty("scheduleTime")) + object.scheduleTime = $root.google.protobuf.Timestamp.toObject(message.scheduleTime, options); + return object; + }; + + /** + * Converts this Reschedule to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @instance + * @returns {Object.} JSON object + */ + Reschedule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Reschedule + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Reschedule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule"; + }; + + return Reschedule; + })(); + + return SqlInstancesRescheduleMaintenanceRequestBody; + })(); + + v1.DemoteMasterContext = (function() { + + /** + * Properties of a DemoteMasterContext. + * @memberof google.cloud.sql.v1 + * @interface IDemoteMasterContext + * @property {string|null} [kind] DemoteMasterContext kind + * @property {google.protobuf.IBoolValue|null} [verifyGtidConsistency] DemoteMasterContext verifyGtidConsistency + * @property {string|null} [masterInstanceName] DemoteMasterContext masterInstanceName + * @property {google.cloud.sql.v1.IDemoteMasterConfiguration|null} [replicaConfiguration] DemoteMasterContext replicaConfiguration + * @property {boolean|null} [skipReplicationSetup] DemoteMasterContext skipReplicationSetup + */ + + /** + * Constructs a new DemoteMasterContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DemoteMasterContext. + * @implements IDemoteMasterContext + * @constructor + * @param {google.cloud.sql.v1.IDemoteMasterContext=} [properties] Properties to set + */ + function DemoteMasterContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DemoteMasterContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @instance + */ + DemoteMasterContext.prototype.kind = ""; + + /** + * DemoteMasterContext verifyGtidConsistency. + * @member {google.protobuf.IBoolValue|null|undefined} verifyGtidConsistency + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @instance + */ + DemoteMasterContext.prototype.verifyGtidConsistency = null; + + /** + * DemoteMasterContext masterInstanceName. + * @member {string} masterInstanceName + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @instance + */ + DemoteMasterContext.prototype.masterInstanceName = ""; + + /** + * DemoteMasterContext replicaConfiguration. + * @member {google.cloud.sql.v1.IDemoteMasterConfiguration|null|undefined} replicaConfiguration + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @instance + */ + DemoteMasterContext.prototype.replicaConfiguration = null; + + /** + * DemoteMasterContext skipReplicationSetup. + * @member {boolean} skipReplicationSetup + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @instance + */ + DemoteMasterContext.prototype.skipReplicationSetup = false; + + /** + * Creates a new DemoteMasterContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @static + * @param {google.cloud.sql.v1.IDemoteMasterContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DemoteMasterContext} DemoteMasterContext instance + */ + DemoteMasterContext.create = function create(properties) { + return new DemoteMasterContext(properties); + }; + + /** + * Encodes the specified DemoteMasterContext message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @static + * @param {google.cloud.sql.v1.IDemoteMasterContext} message DemoteMasterContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.verifyGtidConsistency != null && Object.hasOwnProperty.call(message, "verifyGtidConsistency")) + $root.google.protobuf.BoolValue.encode(message.verifyGtidConsistency, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.masterInstanceName != null && Object.hasOwnProperty.call(message, "masterInstanceName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.masterInstanceName); + if (message.replicaConfiguration != null && Object.hasOwnProperty.call(message, "replicaConfiguration")) + $root.google.cloud.sql.v1.DemoteMasterConfiguration.encode(message.replicaConfiguration, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.skipReplicationSetup != null && Object.hasOwnProperty.call(message, "skipReplicationSetup")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.skipReplicationSetup); + return writer; + }; + + /** + * Encodes the specified DemoteMasterContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @static + * @param {google.cloud.sql.v1.IDemoteMasterContext} message DemoteMasterContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DemoteMasterContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DemoteMasterContext} DemoteMasterContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DemoteMasterContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.verifyGtidConsistency = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 3: { + message.masterInstanceName = reader.string(); + break; + } + case 4: { + message.replicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterConfiguration.decode(reader, reader.uint32()); + break; + } + case 5: { + message.skipReplicationSetup = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DemoteMasterContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DemoteMasterContext} DemoteMasterContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DemoteMasterContext message. + * @function verify + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DemoteMasterContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.verifyGtidConsistency != null && message.hasOwnProperty("verifyGtidConsistency")) { + var error = $root.google.protobuf.BoolValue.verify(message.verifyGtidConsistency); + if (error) + return "verifyGtidConsistency." + error; + } + if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) + if (!$util.isString(message.masterInstanceName)) + return "masterInstanceName: string expected"; + if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) { + var error = $root.google.cloud.sql.v1.DemoteMasterConfiguration.verify(message.replicaConfiguration); + if (error) + return "replicaConfiguration." + error; + } + if (message.skipReplicationSetup != null && message.hasOwnProperty("skipReplicationSetup")) + if (typeof message.skipReplicationSetup !== "boolean") + return "skipReplicationSetup: boolean expected"; + return null; + }; + + /** + * Creates a DemoteMasterContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DemoteMasterContext} DemoteMasterContext + */ + DemoteMasterContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DemoteMasterContext) + return object; + var message = new $root.google.cloud.sql.v1.DemoteMasterContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.verifyGtidConsistency != null) { + if (typeof object.verifyGtidConsistency !== "object") + throw TypeError(".google.cloud.sql.v1.DemoteMasterContext.verifyGtidConsistency: object expected"); + message.verifyGtidConsistency = $root.google.protobuf.BoolValue.fromObject(object.verifyGtidConsistency); + } + if (object.masterInstanceName != null) + message.masterInstanceName = String(object.masterInstanceName); + if (object.replicaConfiguration != null) { + if (typeof object.replicaConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1.DemoteMasterContext.replicaConfiguration: object expected"); + message.replicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterConfiguration.fromObject(object.replicaConfiguration); + } + if (object.skipReplicationSetup != null) + message.skipReplicationSetup = Boolean(object.skipReplicationSetup); + return message; + }; + + /** + * Creates a plain object from a DemoteMasterContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @static + * @param {google.cloud.sql.v1.DemoteMasterContext} message DemoteMasterContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DemoteMasterContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.verifyGtidConsistency = null; + object.masterInstanceName = ""; + object.replicaConfiguration = null; + object.skipReplicationSetup = false; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.verifyGtidConsistency != null && message.hasOwnProperty("verifyGtidConsistency")) + object.verifyGtidConsistency = $root.google.protobuf.BoolValue.toObject(message.verifyGtidConsistency, options); + if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) + object.masterInstanceName = message.masterInstanceName; + if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) + object.replicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterConfiguration.toObject(message.replicaConfiguration, options); + if (message.skipReplicationSetup != null && message.hasOwnProperty("skipReplicationSetup")) + object.skipReplicationSetup = message.skipReplicationSetup; + return object; + }; + + /** + * Converts this DemoteMasterContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @instance + * @returns {Object.} JSON object + */ + DemoteMasterContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DemoteMasterContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DemoteMasterContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DemoteMasterContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DemoteMasterContext"; + }; + + return DemoteMasterContext; + })(); + + v1.DemoteContext = (function() { + + /** + * Properties of a DemoteContext. + * @memberof google.cloud.sql.v1 + * @interface IDemoteContext + * @property {string|null} [kind] DemoteContext kind + * @property {string|null} [sourceRepresentativeInstanceName] DemoteContext sourceRepresentativeInstanceName + */ + + /** + * Constructs a new DemoteContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DemoteContext. + * @implements IDemoteContext + * @constructor + * @param {google.cloud.sql.v1.IDemoteContext=} [properties] Properties to set + */ + function DemoteContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DemoteContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.DemoteContext + * @instance + */ + DemoteContext.prototype.kind = ""; + + /** + * DemoteContext sourceRepresentativeInstanceName. + * @member {string} sourceRepresentativeInstanceName + * @memberof google.cloud.sql.v1.DemoteContext + * @instance + */ + DemoteContext.prototype.sourceRepresentativeInstanceName = ""; + + /** + * Creates a new DemoteContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DemoteContext + * @static + * @param {google.cloud.sql.v1.IDemoteContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DemoteContext} DemoteContext instance + */ + DemoteContext.create = function create(properties) { + return new DemoteContext(properties); + }; + + /** + * Encodes the specified DemoteContext message. Does not implicitly {@link google.cloud.sql.v1.DemoteContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DemoteContext + * @static + * @param {google.cloud.sql.v1.IDemoteContext} message DemoteContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.sourceRepresentativeInstanceName != null && Object.hasOwnProperty.call(message, "sourceRepresentativeInstanceName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceRepresentativeInstanceName); + return writer; + }; + + /** + * Encodes the specified DemoteContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DemoteContext + * @static + * @param {google.cloud.sql.v1.IDemoteContext} message DemoteContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DemoteContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DemoteContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DemoteContext} DemoteContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DemoteContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.sourceRepresentativeInstanceName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DemoteContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DemoteContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DemoteContext} DemoteContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DemoteContext message. + * @function verify + * @memberof google.cloud.sql.v1.DemoteContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DemoteContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.sourceRepresentativeInstanceName != null && message.hasOwnProperty("sourceRepresentativeInstanceName")) + if (!$util.isString(message.sourceRepresentativeInstanceName)) + return "sourceRepresentativeInstanceName: string expected"; + return null; + }; + + /** + * Creates a DemoteContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DemoteContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DemoteContext} DemoteContext + */ + DemoteContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DemoteContext) + return object; + var message = new $root.google.cloud.sql.v1.DemoteContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.sourceRepresentativeInstanceName != null) + message.sourceRepresentativeInstanceName = String(object.sourceRepresentativeInstanceName); + return message; + }; + + /** + * Creates a plain object from a DemoteContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DemoteContext + * @static + * @param {google.cloud.sql.v1.DemoteContext} message DemoteContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DemoteContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.sourceRepresentativeInstanceName = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.sourceRepresentativeInstanceName != null && message.hasOwnProperty("sourceRepresentativeInstanceName")) + object.sourceRepresentativeInstanceName = message.sourceRepresentativeInstanceName; + return object; + }; + + /** + * Converts this DemoteContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DemoteContext + * @instance + * @returns {Object.} JSON object + */ + DemoteContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DemoteContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DemoteContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DemoteContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DemoteContext"; + }; + + return DemoteContext; + })(); + + v1.FailoverContext = (function() { + + /** + * Properties of a FailoverContext. + * @memberof google.cloud.sql.v1 + * @interface IFailoverContext + * @property {number|Long|null} [settingsVersion] FailoverContext settingsVersion + * @property {string|null} [kind] FailoverContext kind + */ + + /** + * Constructs a new FailoverContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a FailoverContext. + * @implements IFailoverContext + * @constructor + * @param {google.cloud.sql.v1.IFailoverContext=} [properties] Properties to set + */ + function FailoverContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FailoverContext settingsVersion. + * @member {number|Long} settingsVersion + * @memberof google.cloud.sql.v1.FailoverContext + * @instance + */ + FailoverContext.prototype.settingsVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * FailoverContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.FailoverContext + * @instance + */ + FailoverContext.prototype.kind = ""; + + /** + * Creates a new FailoverContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.FailoverContext + * @static + * @param {google.cloud.sql.v1.IFailoverContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.FailoverContext} FailoverContext instance + */ + FailoverContext.create = function create(properties) { + return new FailoverContext(properties); + }; + + /** + * Encodes the specified FailoverContext message. Does not implicitly {@link google.cloud.sql.v1.FailoverContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.FailoverContext + * @static + * @param {google.cloud.sql.v1.IFailoverContext} message FailoverContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FailoverContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.settingsVersion != null && Object.hasOwnProperty.call(message, "settingsVersion")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.settingsVersion); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + return writer; + }; + + /** + * Encodes the specified FailoverContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FailoverContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.FailoverContext + * @static + * @param {google.cloud.sql.v1.IFailoverContext} message FailoverContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FailoverContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FailoverContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.FailoverContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.FailoverContext} FailoverContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FailoverContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.FailoverContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.settingsVersion = reader.int64(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FailoverContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.FailoverContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.FailoverContext} FailoverContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FailoverContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FailoverContext message. + * @function verify + * @memberof google.cloud.sql.v1.FailoverContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FailoverContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) + if (!$util.isInteger(message.settingsVersion) && !(message.settingsVersion && $util.isInteger(message.settingsVersion.low) && $util.isInteger(message.settingsVersion.high))) + return "settingsVersion: integer|Long expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a FailoverContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.FailoverContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.FailoverContext} FailoverContext + */ + FailoverContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.FailoverContext) + return object; + var message = new $root.google.cloud.sql.v1.FailoverContext(); + if (object.settingsVersion != null) + if ($util.Long) + (message.settingsVersion = $util.Long.fromValue(object.settingsVersion)).unsigned = false; + else if (typeof object.settingsVersion === "string") + message.settingsVersion = parseInt(object.settingsVersion, 10); + else if (typeof object.settingsVersion === "number") + message.settingsVersion = object.settingsVersion; + else if (typeof object.settingsVersion === "object") + message.settingsVersion = new $util.LongBits(object.settingsVersion.low >>> 0, object.settingsVersion.high >>> 0).toNumber(); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a FailoverContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.FailoverContext + * @static + * @param {google.cloud.sql.v1.FailoverContext} message FailoverContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FailoverContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.settingsVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.settingsVersion = options.longs === String ? "0" : 0; + object.kind = ""; + } + if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) + if (typeof message.settingsVersion === "number") + object.settingsVersion = options.longs === String ? String(message.settingsVersion) : message.settingsVersion; + else + object.settingsVersion = options.longs === String ? $util.Long.prototype.toString.call(message.settingsVersion) : options.longs === Number ? new $util.LongBits(message.settingsVersion.low >>> 0, message.settingsVersion.high >>> 0).toNumber() : message.settingsVersion; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this FailoverContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.FailoverContext + * @instance + * @returns {Object.} JSON object + */ + FailoverContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FailoverContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.FailoverContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FailoverContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.FailoverContext"; + }; + + return FailoverContext; + })(); + + v1.RestoreBackupContext = (function() { + + /** + * Properties of a RestoreBackupContext. + * @memberof google.cloud.sql.v1 + * @interface IRestoreBackupContext + * @property {string|null} [kind] RestoreBackupContext kind + * @property {number|Long|null} [backupRunId] RestoreBackupContext backupRunId + * @property {string|null} [instanceId] RestoreBackupContext instanceId + * @property {string|null} [project] RestoreBackupContext project + */ + + /** + * Constructs a new RestoreBackupContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a RestoreBackupContext. + * @implements IRestoreBackupContext + * @constructor + * @param {google.cloud.sql.v1.IRestoreBackupContext=} [properties] Properties to set + */ + function RestoreBackupContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RestoreBackupContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @instance + */ + RestoreBackupContext.prototype.kind = ""; + + /** + * RestoreBackupContext backupRunId. + * @member {number|Long} backupRunId + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @instance + */ + RestoreBackupContext.prototype.backupRunId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * RestoreBackupContext instanceId. + * @member {string} instanceId + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @instance + */ + RestoreBackupContext.prototype.instanceId = ""; + + /** + * RestoreBackupContext project. + * @member {string} project + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @instance + */ + RestoreBackupContext.prototype.project = ""; + + /** + * Creates a new RestoreBackupContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @static + * @param {google.cloud.sql.v1.IRestoreBackupContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.RestoreBackupContext} RestoreBackupContext instance + */ + RestoreBackupContext.create = function create(properties) { + return new RestoreBackupContext(properties); + }; + + /** + * Encodes the specified RestoreBackupContext message. Does not implicitly {@link google.cloud.sql.v1.RestoreBackupContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @static + * @param {google.cloud.sql.v1.IRestoreBackupContext} message RestoreBackupContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreBackupContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.backupRunId != null && Object.hasOwnProperty.call(message, "backupRunId")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.backupRunId); + if (message.instanceId != null && Object.hasOwnProperty.call(message, "instanceId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.instanceId); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + return writer; + }; + + /** + * Encodes the specified RestoreBackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RestoreBackupContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @static + * @param {google.cloud.sql.v1.IRestoreBackupContext} message RestoreBackupContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreBackupContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RestoreBackupContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.RestoreBackupContext} RestoreBackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreBackupContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.RestoreBackupContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.backupRunId = reader.int64(); + break; + } + case 3: { + message.instanceId = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RestoreBackupContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.RestoreBackupContext} RestoreBackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreBackupContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RestoreBackupContext message. + * @function verify + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RestoreBackupContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.backupRunId != null && message.hasOwnProperty("backupRunId")) + if (!$util.isInteger(message.backupRunId) && !(message.backupRunId && $util.isInteger(message.backupRunId.low) && $util.isInteger(message.backupRunId.high))) + return "backupRunId: integer|Long expected"; + if (message.instanceId != null && message.hasOwnProperty("instanceId")) + if (!$util.isString(message.instanceId)) + return "instanceId: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a RestoreBackupContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.RestoreBackupContext} RestoreBackupContext + */ + RestoreBackupContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.RestoreBackupContext) + return object; + var message = new $root.google.cloud.sql.v1.RestoreBackupContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.backupRunId != null) + if ($util.Long) + (message.backupRunId = $util.Long.fromValue(object.backupRunId)).unsigned = false; + else if (typeof object.backupRunId === "string") + message.backupRunId = parseInt(object.backupRunId, 10); + else if (typeof object.backupRunId === "number") + message.backupRunId = object.backupRunId; + else if (typeof object.backupRunId === "object") + message.backupRunId = new $util.LongBits(object.backupRunId.low >>> 0, object.backupRunId.high >>> 0).toNumber(); + if (object.instanceId != null) + message.instanceId = String(object.instanceId); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a RestoreBackupContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @static + * @param {google.cloud.sql.v1.RestoreBackupContext} message RestoreBackupContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RestoreBackupContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.backupRunId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.backupRunId = options.longs === String ? "0" : 0; + object.instanceId = ""; + object.project = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.backupRunId != null && message.hasOwnProperty("backupRunId")) + if (typeof message.backupRunId === "number") + object.backupRunId = options.longs === String ? String(message.backupRunId) : message.backupRunId; + else + object.backupRunId = options.longs === String ? $util.Long.prototype.toString.call(message.backupRunId) : options.longs === Number ? new $util.LongBits(message.backupRunId.low >>> 0, message.backupRunId.high >>> 0).toNumber() : message.backupRunId; + if (message.instanceId != null && message.hasOwnProperty("instanceId")) + object.instanceId = message.instanceId; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this RestoreBackupContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @instance + * @returns {Object.} JSON object + */ + RestoreBackupContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RestoreBackupContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.RestoreBackupContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RestoreBackupContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.RestoreBackupContext"; + }; + + return RestoreBackupContext; + })(); + + v1.RotateServerCaContext = (function() { + + /** + * Properties of a RotateServerCaContext. + * @memberof google.cloud.sql.v1 + * @interface IRotateServerCaContext + * @property {string|null} [kind] RotateServerCaContext kind + * @property {string|null} [nextVersion] RotateServerCaContext nextVersion + */ + + /** + * Constructs a new RotateServerCaContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a RotateServerCaContext. + * @implements IRotateServerCaContext + * @constructor + * @param {google.cloud.sql.v1.IRotateServerCaContext=} [properties] Properties to set + */ + function RotateServerCaContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RotateServerCaContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @instance + */ + RotateServerCaContext.prototype.kind = ""; + + /** + * RotateServerCaContext nextVersion. + * @member {string} nextVersion + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @instance + */ + RotateServerCaContext.prototype.nextVersion = ""; + + /** + * Creates a new RotateServerCaContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @static + * @param {google.cloud.sql.v1.IRotateServerCaContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.RotateServerCaContext} RotateServerCaContext instance + */ + RotateServerCaContext.create = function create(properties) { + return new RotateServerCaContext(properties); + }; + + /** + * Encodes the specified RotateServerCaContext message. Does not implicitly {@link google.cloud.sql.v1.RotateServerCaContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @static + * @param {google.cloud.sql.v1.IRotateServerCaContext} message RotateServerCaContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateServerCaContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); + return writer; + }; + + /** + * Encodes the specified RotateServerCaContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateServerCaContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @static + * @param {google.cloud.sql.v1.IRotateServerCaContext} message RotateServerCaContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateServerCaContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RotateServerCaContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.RotateServerCaContext} RotateServerCaContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateServerCaContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.RotateServerCaContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.nextVersion = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RotateServerCaContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.RotateServerCaContext} RotateServerCaContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateServerCaContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RotateServerCaContext message. + * @function verify + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RotateServerCaContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + if (!$util.isString(message.nextVersion)) + return "nextVersion: string expected"; + return null; + }; + + /** + * Creates a RotateServerCaContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.RotateServerCaContext} RotateServerCaContext + */ + RotateServerCaContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.RotateServerCaContext) + return object; + var message = new $root.google.cloud.sql.v1.RotateServerCaContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.nextVersion != null) + message.nextVersion = String(object.nextVersion); + return message; + }; + + /** + * Creates a plain object from a RotateServerCaContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @static + * @param {google.cloud.sql.v1.RotateServerCaContext} message RotateServerCaContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RotateServerCaContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.nextVersion = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + object.nextVersion = message.nextVersion; + return object; + }; + + /** + * Converts this RotateServerCaContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @instance + * @returns {Object.} JSON object + */ + RotateServerCaContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RotateServerCaContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.RotateServerCaContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RotateServerCaContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.RotateServerCaContext"; + }; + + return RotateServerCaContext; + })(); + + v1.RotateServerCertificateContext = (function() { + + /** + * Properties of a RotateServerCertificateContext. + * @memberof google.cloud.sql.v1 + * @interface IRotateServerCertificateContext + * @property {string|null} [kind] RotateServerCertificateContext kind + * @property {string|null} [nextVersion] RotateServerCertificateContext nextVersion + */ + + /** + * Constructs a new RotateServerCertificateContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a RotateServerCertificateContext. + * @implements IRotateServerCertificateContext + * @constructor + * @param {google.cloud.sql.v1.IRotateServerCertificateContext=} [properties] Properties to set + */ + function RotateServerCertificateContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RotateServerCertificateContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @instance + */ + RotateServerCertificateContext.prototype.kind = ""; + + /** + * RotateServerCertificateContext nextVersion. + * @member {string} nextVersion + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @instance + */ + RotateServerCertificateContext.prototype.nextVersion = ""; + + /** + * Creates a new RotateServerCertificateContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @static + * @param {google.cloud.sql.v1.IRotateServerCertificateContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.RotateServerCertificateContext} RotateServerCertificateContext instance + */ + RotateServerCertificateContext.create = function create(properties) { + return new RotateServerCertificateContext(properties); + }; + + /** + * Encodes the specified RotateServerCertificateContext message. Does not implicitly {@link google.cloud.sql.v1.RotateServerCertificateContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @static + * @param {google.cloud.sql.v1.IRotateServerCertificateContext} message RotateServerCertificateContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateServerCertificateContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); + return writer; + }; + + /** + * Encodes the specified RotateServerCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateServerCertificateContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @static + * @param {google.cloud.sql.v1.IRotateServerCertificateContext} message RotateServerCertificateContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateServerCertificateContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RotateServerCertificateContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.RotateServerCertificateContext} RotateServerCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateServerCertificateContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.RotateServerCertificateContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.nextVersion = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RotateServerCertificateContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.RotateServerCertificateContext} RotateServerCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateServerCertificateContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RotateServerCertificateContext message. + * @function verify + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RotateServerCertificateContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + if (!$util.isString(message.nextVersion)) + return "nextVersion: string expected"; + return null; + }; + + /** + * Creates a RotateServerCertificateContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.RotateServerCertificateContext} RotateServerCertificateContext + */ + RotateServerCertificateContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.RotateServerCertificateContext) + return object; + var message = new $root.google.cloud.sql.v1.RotateServerCertificateContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.nextVersion != null) + message.nextVersion = String(object.nextVersion); + return message; + }; + + /** + * Creates a plain object from a RotateServerCertificateContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @static + * @param {google.cloud.sql.v1.RotateServerCertificateContext} message RotateServerCertificateContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RotateServerCertificateContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.nextVersion = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + object.nextVersion = message.nextVersion; + return object; + }; + + /** + * Converts this RotateServerCertificateContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @instance + * @returns {Object.} JSON object + */ + RotateServerCertificateContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RotateServerCertificateContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.RotateServerCertificateContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RotateServerCertificateContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.RotateServerCertificateContext"; + }; + + return RotateServerCertificateContext; + })(); + + v1.RotateEntraIdCertificateContext = (function() { + + /** + * Properties of a RotateEntraIdCertificateContext. + * @memberof google.cloud.sql.v1 + * @interface IRotateEntraIdCertificateContext + * @property {string|null} [kind] RotateEntraIdCertificateContext kind + * @property {string|null} [nextVersion] RotateEntraIdCertificateContext nextVersion + */ + + /** + * Constructs a new RotateEntraIdCertificateContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a RotateEntraIdCertificateContext. + * @implements IRotateEntraIdCertificateContext + * @constructor + * @param {google.cloud.sql.v1.IRotateEntraIdCertificateContext=} [properties] Properties to set + */ + function RotateEntraIdCertificateContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RotateEntraIdCertificateContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @instance + */ + RotateEntraIdCertificateContext.prototype.kind = ""; + + /** + * RotateEntraIdCertificateContext nextVersion. + * @member {string} nextVersion + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @instance + */ + RotateEntraIdCertificateContext.prototype.nextVersion = ""; + + /** + * Creates a new RotateEntraIdCertificateContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @static + * @param {google.cloud.sql.v1.IRotateEntraIdCertificateContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext instance + */ + RotateEntraIdCertificateContext.create = function create(properties) { + return new RotateEntraIdCertificateContext(properties); + }; + + /** + * Encodes the specified RotateEntraIdCertificateContext message. Does not implicitly {@link google.cloud.sql.v1.RotateEntraIdCertificateContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @static + * @param {google.cloud.sql.v1.IRotateEntraIdCertificateContext} message RotateEntraIdCertificateContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateEntraIdCertificateContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); + return writer; + }; + + /** + * Encodes the specified RotateEntraIdCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateEntraIdCertificateContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @static + * @param {google.cloud.sql.v1.IRotateEntraIdCertificateContext} message RotateEntraIdCertificateContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateEntraIdCertificateContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateEntraIdCertificateContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.RotateEntraIdCertificateContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.nextVersion = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateEntraIdCertificateContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RotateEntraIdCertificateContext message. + * @function verify + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RotateEntraIdCertificateContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + if (!$util.isString(message.nextVersion)) + return "nextVersion: string expected"; + return null; + }; + + /** + * Creates a RotateEntraIdCertificateContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext + */ + RotateEntraIdCertificateContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.RotateEntraIdCertificateContext) + return object; + var message = new $root.google.cloud.sql.v1.RotateEntraIdCertificateContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.nextVersion != null) + message.nextVersion = String(object.nextVersion); + return message; + }; + + /** + * Creates a plain object from a RotateEntraIdCertificateContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @static + * @param {google.cloud.sql.v1.RotateEntraIdCertificateContext} message RotateEntraIdCertificateContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RotateEntraIdCertificateContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.nextVersion = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + object.nextVersion = message.nextVersion; + return object; + }; + + /** + * Converts this RotateEntraIdCertificateContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @instance + * @returns {Object.} JSON object + */ + RotateEntraIdCertificateContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RotateEntraIdCertificateContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RotateEntraIdCertificateContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.RotateEntraIdCertificateContext"; + }; + + return RotateEntraIdCertificateContext; + })(); + + v1.TruncateLogContext = (function() { + + /** + * Properties of a TruncateLogContext. + * @memberof google.cloud.sql.v1 + * @interface ITruncateLogContext + * @property {string|null} [kind] TruncateLogContext kind + * @property {string|null} [logType] TruncateLogContext logType + */ + + /** + * Constructs a new TruncateLogContext. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a TruncateLogContext. + * @implements ITruncateLogContext + * @constructor + * @param {google.cloud.sql.v1.ITruncateLogContext=} [properties] Properties to set + */ + function TruncateLogContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TruncateLogContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.TruncateLogContext + * @instance + */ + TruncateLogContext.prototype.kind = ""; + + /** + * TruncateLogContext logType. + * @member {string} logType + * @memberof google.cloud.sql.v1.TruncateLogContext + * @instance + */ + TruncateLogContext.prototype.logType = ""; + + /** + * Creates a new TruncateLogContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.TruncateLogContext + * @static + * @param {google.cloud.sql.v1.ITruncateLogContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1.TruncateLogContext} TruncateLogContext instance + */ + TruncateLogContext.create = function create(properties) { + return new TruncateLogContext(properties); + }; + + /** + * Encodes the specified TruncateLogContext message. Does not implicitly {@link google.cloud.sql.v1.TruncateLogContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.TruncateLogContext + * @static + * @param {google.cloud.sql.v1.ITruncateLogContext} message TruncateLogContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TruncateLogContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.logType != null && Object.hasOwnProperty.call(message, "logType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.logType); + return writer; + }; + + /** + * Encodes the specified TruncateLogContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.TruncateLogContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.TruncateLogContext + * @static + * @param {google.cloud.sql.v1.ITruncateLogContext} message TruncateLogContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TruncateLogContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TruncateLogContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.TruncateLogContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.TruncateLogContext} TruncateLogContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TruncateLogContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.TruncateLogContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.logType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TruncateLogContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.TruncateLogContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.TruncateLogContext} TruncateLogContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TruncateLogContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TruncateLogContext message. + * @function verify + * @memberof google.cloud.sql.v1.TruncateLogContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TruncateLogContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.logType != null && message.hasOwnProperty("logType")) + if (!$util.isString(message.logType)) + return "logType: string expected"; + return null; + }; + + /** + * Creates a TruncateLogContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.TruncateLogContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.TruncateLogContext} TruncateLogContext + */ + TruncateLogContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.TruncateLogContext) + return object; + var message = new $root.google.cloud.sql.v1.TruncateLogContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.logType != null) + message.logType = String(object.logType); + return message; + }; + + /** + * Creates a plain object from a TruncateLogContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.TruncateLogContext + * @static + * @param {google.cloud.sql.v1.TruncateLogContext} message TruncateLogContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TruncateLogContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.logType = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.logType != null && message.hasOwnProperty("logType")) + object.logType = message.logType; + return object; + }; + + /** + * Converts this TruncateLogContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.TruncateLogContext + * @instance + * @returns {Object.} JSON object + */ + TruncateLogContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TruncateLogContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1.TruncateLogContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TruncateLogContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.TruncateLogContext"; + }; + + return TruncateLogContext; + })(); + + v1.SqlExternalSyncSettingError = (function() { + + /** + * Properties of a SqlExternalSyncSettingError. + * @memberof google.cloud.sql.v1 + * @interface ISqlExternalSyncSettingError + * @property {string|null} [kind] SqlExternalSyncSettingError kind + * @property {google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|null} [type] SqlExternalSyncSettingError type + * @property {string|null} [detail] SqlExternalSyncSettingError detail + */ + + /** + * Constructs a new SqlExternalSyncSettingError. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlExternalSyncSettingError. + * @implements ISqlExternalSyncSettingError + * @constructor + * @param {google.cloud.sql.v1.ISqlExternalSyncSettingError=} [properties] Properties to set + */ + function SqlExternalSyncSettingError(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlExternalSyncSettingError kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @instance + */ + SqlExternalSyncSettingError.prototype.kind = ""; + + /** + * SqlExternalSyncSettingError type. + * @member {google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType} type + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @instance + */ + SqlExternalSyncSettingError.prototype.type = 0; + + /** + * SqlExternalSyncSettingError detail. + * @member {string} detail + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @instance + */ + SqlExternalSyncSettingError.prototype.detail = ""; + + /** + * Creates a new SqlExternalSyncSettingError instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @static + * @param {google.cloud.sql.v1.ISqlExternalSyncSettingError=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlExternalSyncSettingError} SqlExternalSyncSettingError instance + */ + SqlExternalSyncSettingError.create = function create(properties) { + return new SqlExternalSyncSettingError(properties); + }; + + /** + * Encodes the specified SqlExternalSyncSettingError message. Does not implicitly {@link google.cloud.sql.v1.SqlExternalSyncSettingError.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @static + * @param {google.cloud.sql.v1.ISqlExternalSyncSettingError} message SqlExternalSyncSettingError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlExternalSyncSettingError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.detail != null && Object.hasOwnProperty.call(message, "detail")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.detail); + return writer; + }; + + /** + * Encodes the specified SqlExternalSyncSettingError message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlExternalSyncSettingError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @static + * @param {google.cloud.sql.v1.ISqlExternalSyncSettingError} message SqlExternalSyncSettingError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlExternalSyncSettingError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlExternalSyncSettingError} SqlExternalSyncSettingError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlExternalSyncSettingError.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlExternalSyncSettingError(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + message.detail = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlExternalSyncSettingError} SqlExternalSyncSettingError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlExternalSyncSettingError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlExternalSyncSettingError message. + * @function verify + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlExternalSyncSettingError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + break; + } + if (message.detail != null && message.hasOwnProperty("detail")) + if (!$util.isString(message.detail)) + return "detail: string expected"; + return null; + }; + + /** + * Creates a SqlExternalSyncSettingError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlExternalSyncSettingError} SqlExternalSyncSettingError + */ + SqlExternalSyncSettingError.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlExternalSyncSettingError) + return object; + var message = new $root.google.cloud.sql.v1.SqlExternalSyncSettingError(); + if (object.kind != null) + message.kind = String(object.kind); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "CONNECTION_FAILURE": + case 1: + message.type = 1; + break; + case "BINLOG_NOT_ENABLED": + case 2: + message.type = 2; + break; + case "INCOMPATIBLE_DATABASE_VERSION": + case 3: + message.type = 3; + break; + case "REPLICA_ALREADY_SETUP": + case 4: + message.type = 4; + break; + case "INSUFFICIENT_PRIVILEGE": + case 5: + message.type = 5; + break; + case "UNSUPPORTED_MIGRATION_TYPE": + case 6: + message.type = 6; + break; + case "NO_PGLOGICAL_INSTALLED": + case 7: + message.type = 7; + break; + case "PGLOGICAL_NODE_ALREADY_EXISTS": + case 8: + message.type = 8; + break; + case "INVALID_WAL_LEVEL": + case 9: + message.type = 9; + break; + case "INVALID_SHARED_PRELOAD_LIBRARY": + case 10: + message.type = 10; + break; + case "INSUFFICIENT_MAX_REPLICATION_SLOTS": + case 11: + message.type = 11; + break; + case "INSUFFICIENT_MAX_WAL_SENDERS": + case 12: + message.type = 12; + break; + case "INSUFFICIENT_MAX_WORKER_PROCESSES": + case 13: + message.type = 13; + break; + case "UNSUPPORTED_EXTENSIONS": + case 14: + message.type = 14; + break; + case "INVALID_RDS_LOGICAL_REPLICATION": + case 15: + message.type = 15; + break; + case "INVALID_LOGGING_SETUP": + case 16: + message.type = 16; + break; + case "INVALID_DB_PARAM": + case 17: + message.type = 17; + break; + case "UNSUPPORTED_GTID_MODE": + case 18: + message.type = 18; + break; + case "SQLSERVER_AGENT_NOT_RUNNING": + case 19: + message.type = 19; + break; + case "UNSUPPORTED_TABLE_DEFINITION": + case 20: + message.type = 20; + break; + case "UNSUPPORTED_DEFINER": + case 21: + message.type = 21; + break; + case "SQLSERVER_SERVERNAME_MISMATCH": + case 22: + message.type = 22; + break; + case "PRIMARY_ALREADY_SETUP": + case 23: + message.type = 23; + break; + case "UNSUPPORTED_BINLOG_FORMAT": + case 24: + message.type = 24; + break; + case "BINLOG_RETENTION_SETTING": + case 25: + message.type = 25; + break; + case "UNSUPPORTED_STORAGE_ENGINE": + case 26: + message.type = 26; + break; + case "LIMITED_SUPPORT_TABLES": + case 27: + message.type = 27; + break; + case "EXISTING_DATA_IN_REPLICA": + case 28: + message.type = 28; + break; + case "MISSING_OPTIONAL_PRIVILEGES": + case 29: + message.type = 29; + break; + case "RISKY_BACKUP_ADMIN_PRIVILEGE": + case 30: + message.type = 30; + break; + case "INSUFFICIENT_GCS_PERMISSIONS": + case 31: + message.type = 31; + break; + case "INVALID_FILE_INFO": + case 32: + message.type = 32; + break; + case "UNSUPPORTED_DATABASE_SETTINGS": + case 33: + message.type = 33; + break; + case "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE": + case 34: + message.type = 34; + break; + case "LOCAL_INFILE_OFF": + case 35: + message.type = 35; + break; + case "TURN_ON_PITR_AFTER_PROMOTE": + case 36: + message.type = 36; + break; + case "INCOMPATIBLE_DATABASE_MINOR_VERSION": + case 37: + message.type = 37; + break; + case "SOURCE_MAX_SUBSCRIPTIONS": + case 38: + message.type = 38; + break; + case "UNABLE_TO_VERIFY_DEFINERS": + case 39: + message.type = 39; + break; + case "SUBSCRIPTION_CALCULATION_STATUS": + case 40: + message.type = 40; + break; + case "PG_SUBSCRIPTION_COUNT": + case 41: + message.type = 41; + break; + case "PG_SYNC_PARALLEL_LEVEL": + case 42: + message.type = 42; + break; + case "INSUFFICIENT_DISK_SIZE": + case 43: + message.type = 43; + break; + case "INSUFFICIENT_MACHINE_TIER": + case 44: + message.type = 44; + break; + case "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED": + case 45: + message.type = 45; + break; + case "EXTENSIONS_NOT_MIGRATED": + case 46: + message.type = 46; + break; + case "PG_CRON_FLAG_ENABLED_IN_REPLICA": + case 47: + message.type = 47; + break; + case "EXTENSIONS_NOT_ENABLED_IN_REPLICA": + case 48: + message.type = 48; + break; + case "UNSUPPORTED_COLUMNS": + case 49: + message.type = 49; + break; + case "USERS_NOT_CREATED_IN_REPLICA": + case 50: + message.type = 50; + break; + case "UNSUPPORTED_SYSTEM_OBJECTS": + case 51: + message.type = 51; + break; + case "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY": + case 52: + message.type = 52; + break; + case "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE": + case 53: + message.type = 53; + break; + case "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI": + case 54: + message.type = 54; + break; + case "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS": + case 55: + message.type = 55; + break; + case "PROMPT_DELETE_EXISTING": + case 56: + message.type = 56; + break; + case "WILL_DELETE_EXISTING": + case 57: + message.type = 57; + break; + case "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE": + case 58: + message.type = 58; + break; + } + if (object.detail != null) + message.detail = String(object.detail); + return message; + }; + + /** + * Creates a plain object from a SqlExternalSyncSettingError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @static + * @param {google.cloud.sql.v1.SqlExternalSyncSettingError} message SqlExternalSyncSettingError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlExternalSyncSettingError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.type = options.enums === String ? "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED" : 0; + object.detail = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType[message.type] : message.type; + if (message.detail != null && message.hasOwnProperty("detail")) + object.detail = message.detail; + return object; + }; + + /** + * Converts this SqlExternalSyncSettingError to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @instance + * @returns {Object.} JSON object + */ + SqlExternalSyncSettingError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlExternalSyncSettingError + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlExternalSyncSettingError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlExternalSyncSettingError"; + }; + + /** + * SqlExternalSyncSettingErrorType enum. + * @name google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType + * @enum {number} + * @property {number} SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED=0 SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED value + * @property {number} CONNECTION_FAILURE=1 CONNECTION_FAILURE value + * @property {number} BINLOG_NOT_ENABLED=2 BINLOG_NOT_ENABLED value + * @property {number} INCOMPATIBLE_DATABASE_VERSION=3 INCOMPATIBLE_DATABASE_VERSION value + * @property {number} REPLICA_ALREADY_SETUP=4 REPLICA_ALREADY_SETUP value + * @property {number} INSUFFICIENT_PRIVILEGE=5 INSUFFICIENT_PRIVILEGE value + * @property {number} UNSUPPORTED_MIGRATION_TYPE=6 UNSUPPORTED_MIGRATION_TYPE value + * @property {number} NO_PGLOGICAL_INSTALLED=7 NO_PGLOGICAL_INSTALLED value + * @property {number} PGLOGICAL_NODE_ALREADY_EXISTS=8 PGLOGICAL_NODE_ALREADY_EXISTS value + * @property {number} INVALID_WAL_LEVEL=9 INVALID_WAL_LEVEL value + * @property {number} INVALID_SHARED_PRELOAD_LIBRARY=10 INVALID_SHARED_PRELOAD_LIBRARY value + * @property {number} INSUFFICIENT_MAX_REPLICATION_SLOTS=11 INSUFFICIENT_MAX_REPLICATION_SLOTS value + * @property {number} INSUFFICIENT_MAX_WAL_SENDERS=12 INSUFFICIENT_MAX_WAL_SENDERS value + * @property {number} INSUFFICIENT_MAX_WORKER_PROCESSES=13 INSUFFICIENT_MAX_WORKER_PROCESSES value + * @property {number} UNSUPPORTED_EXTENSIONS=14 UNSUPPORTED_EXTENSIONS value + * @property {number} INVALID_RDS_LOGICAL_REPLICATION=15 INVALID_RDS_LOGICAL_REPLICATION value + * @property {number} INVALID_LOGGING_SETUP=16 INVALID_LOGGING_SETUP value + * @property {number} INVALID_DB_PARAM=17 INVALID_DB_PARAM value + * @property {number} UNSUPPORTED_GTID_MODE=18 UNSUPPORTED_GTID_MODE value + * @property {number} SQLSERVER_AGENT_NOT_RUNNING=19 SQLSERVER_AGENT_NOT_RUNNING value + * @property {number} UNSUPPORTED_TABLE_DEFINITION=20 UNSUPPORTED_TABLE_DEFINITION value + * @property {number} UNSUPPORTED_DEFINER=21 UNSUPPORTED_DEFINER value + * @property {number} SQLSERVER_SERVERNAME_MISMATCH=22 SQLSERVER_SERVERNAME_MISMATCH value + * @property {number} PRIMARY_ALREADY_SETUP=23 PRIMARY_ALREADY_SETUP value + * @property {number} UNSUPPORTED_BINLOG_FORMAT=24 UNSUPPORTED_BINLOG_FORMAT value + * @property {number} BINLOG_RETENTION_SETTING=25 BINLOG_RETENTION_SETTING value + * @property {number} UNSUPPORTED_STORAGE_ENGINE=26 UNSUPPORTED_STORAGE_ENGINE value + * @property {number} LIMITED_SUPPORT_TABLES=27 LIMITED_SUPPORT_TABLES value + * @property {number} EXISTING_DATA_IN_REPLICA=28 EXISTING_DATA_IN_REPLICA value + * @property {number} MISSING_OPTIONAL_PRIVILEGES=29 MISSING_OPTIONAL_PRIVILEGES value + * @property {number} RISKY_BACKUP_ADMIN_PRIVILEGE=30 RISKY_BACKUP_ADMIN_PRIVILEGE value + * @property {number} INSUFFICIENT_GCS_PERMISSIONS=31 INSUFFICIENT_GCS_PERMISSIONS value + * @property {number} INVALID_FILE_INFO=32 INVALID_FILE_INFO value + * @property {number} UNSUPPORTED_DATABASE_SETTINGS=33 UNSUPPORTED_DATABASE_SETTINGS value + * @property {number} MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE=34 MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE value + * @property {number} LOCAL_INFILE_OFF=35 LOCAL_INFILE_OFF value + * @property {number} TURN_ON_PITR_AFTER_PROMOTE=36 TURN_ON_PITR_AFTER_PROMOTE value + * @property {number} INCOMPATIBLE_DATABASE_MINOR_VERSION=37 INCOMPATIBLE_DATABASE_MINOR_VERSION value + * @property {number} SOURCE_MAX_SUBSCRIPTIONS=38 SOURCE_MAX_SUBSCRIPTIONS value + * @property {number} UNABLE_TO_VERIFY_DEFINERS=39 UNABLE_TO_VERIFY_DEFINERS value + * @property {number} SUBSCRIPTION_CALCULATION_STATUS=40 SUBSCRIPTION_CALCULATION_STATUS value + * @property {number} PG_SUBSCRIPTION_COUNT=41 PG_SUBSCRIPTION_COUNT value + * @property {number} PG_SYNC_PARALLEL_LEVEL=42 PG_SYNC_PARALLEL_LEVEL value + * @property {number} INSUFFICIENT_DISK_SIZE=43 INSUFFICIENT_DISK_SIZE value + * @property {number} INSUFFICIENT_MACHINE_TIER=44 INSUFFICIENT_MACHINE_TIER value + * @property {number} UNSUPPORTED_EXTENSIONS_NOT_MIGRATED=45 UNSUPPORTED_EXTENSIONS_NOT_MIGRATED value + * @property {number} EXTENSIONS_NOT_MIGRATED=46 EXTENSIONS_NOT_MIGRATED value + * @property {number} PG_CRON_FLAG_ENABLED_IN_REPLICA=47 PG_CRON_FLAG_ENABLED_IN_REPLICA value + * @property {number} EXTENSIONS_NOT_ENABLED_IN_REPLICA=48 EXTENSIONS_NOT_ENABLED_IN_REPLICA value + * @property {number} UNSUPPORTED_COLUMNS=49 UNSUPPORTED_COLUMNS value + * @property {number} USERS_NOT_CREATED_IN_REPLICA=50 USERS_NOT_CREATED_IN_REPLICA value + * @property {number} UNSUPPORTED_SYSTEM_OBJECTS=51 UNSUPPORTED_SYSTEM_OBJECTS value + * @property {number} UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY=52 UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY value + * @property {number} SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE=53 SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE value + * @property {number} PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI=54 PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI value + * @property {number} SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS=55 SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS value + * @property {number} PROMPT_DELETE_EXISTING=56 PROMPT_DELETE_EXISTING value + * @property {number} WILL_DELETE_EXISTING=57 WILL_DELETE_EXISTING value + * @property {number} PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE=58 PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE value + */ + SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CONNECTION_FAILURE"] = 1; + values[valuesById[2] = "BINLOG_NOT_ENABLED"] = 2; + values[valuesById[3] = "INCOMPATIBLE_DATABASE_VERSION"] = 3; + values[valuesById[4] = "REPLICA_ALREADY_SETUP"] = 4; + values[valuesById[5] = "INSUFFICIENT_PRIVILEGE"] = 5; + values[valuesById[6] = "UNSUPPORTED_MIGRATION_TYPE"] = 6; + values[valuesById[7] = "NO_PGLOGICAL_INSTALLED"] = 7; + values[valuesById[8] = "PGLOGICAL_NODE_ALREADY_EXISTS"] = 8; + values[valuesById[9] = "INVALID_WAL_LEVEL"] = 9; + values[valuesById[10] = "INVALID_SHARED_PRELOAD_LIBRARY"] = 10; + values[valuesById[11] = "INSUFFICIENT_MAX_REPLICATION_SLOTS"] = 11; + values[valuesById[12] = "INSUFFICIENT_MAX_WAL_SENDERS"] = 12; + values[valuesById[13] = "INSUFFICIENT_MAX_WORKER_PROCESSES"] = 13; + values[valuesById[14] = "UNSUPPORTED_EXTENSIONS"] = 14; + values[valuesById[15] = "INVALID_RDS_LOGICAL_REPLICATION"] = 15; + values[valuesById[16] = "INVALID_LOGGING_SETUP"] = 16; + values[valuesById[17] = "INVALID_DB_PARAM"] = 17; + values[valuesById[18] = "UNSUPPORTED_GTID_MODE"] = 18; + values[valuesById[19] = "SQLSERVER_AGENT_NOT_RUNNING"] = 19; + values[valuesById[20] = "UNSUPPORTED_TABLE_DEFINITION"] = 20; + values[valuesById[21] = "UNSUPPORTED_DEFINER"] = 21; + values[valuesById[22] = "SQLSERVER_SERVERNAME_MISMATCH"] = 22; + values[valuesById[23] = "PRIMARY_ALREADY_SETUP"] = 23; + values[valuesById[24] = "UNSUPPORTED_BINLOG_FORMAT"] = 24; + values[valuesById[25] = "BINLOG_RETENTION_SETTING"] = 25; + values[valuesById[26] = "UNSUPPORTED_STORAGE_ENGINE"] = 26; + values[valuesById[27] = "LIMITED_SUPPORT_TABLES"] = 27; + values[valuesById[28] = "EXISTING_DATA_IN_REPLICA"] = 28; + values[valuesById[29] = "MISSING_OPTIONAL_PRIVILEGES"] = 29; + values[valuesById[30] = "RISKY_BACKUP_ADMIN_PRIVILEGE"] = 30; + values[valuesById[31] = "INSUFFICIENT_GCS_PERMISSIONS"] = 31; + values[valuesById[32] = "INVALID_FILE_INFO"] = 32; + values[valuesById[33] = "UNSUPPORTED_DATABASE_SETTINGS"] = 33; + values[valuesById[34] = "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE"] = 34; + values[valuesById[35] = "LOCAL_INFILE_OFF"] = 35; + values[valuesById[36] = "TURN_ON_PITR_AFTER_PROMOTE"] = 36; + values[valuesById[37] = "INCOMPATIBLE_DATABASE_MINOR_VERSION"] = 37; + values[valuesById[38] = "SOURCE_MAX_SUBSCRIPTIONS"] = 38; + values[valuesById[39] = "UNABLE_TO_VERIFY_DEFINERS"] = 39; + values[valuesById[40] = "SUBSCRIPTION_CALCULATION_STATUS"] = 40; + values[valuesById[41] = "PG_SUBSCRIPTION_COUNT"] = 41; + values[valuesById[42] = "PG_SYNC_PARALLEL_LEVEL"] = 42; + values[valuesById[43] = "INSUFFICIENT_DISK_SIZE"] = 43; + values[valuesById[44] = "INSUFFICIENT_MACHINE_TIER"] = 44; + values[valuesById[45] = "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED"] = 45; + values[valuesById[46] = "EXTENSIONS_NOT_MIGRATED"] = 46; + values[valuesById[47] = "PG_CRON_FLAG_ENABLED_IN_REPLICA"] = 47; + values[valuesById[48] = "EXTENSIONS_NOT_ENABLED_IN_REPLICA"] = 48; + values[valuesById[49] = "UNSUPPORTED_COLUMNS"] = 49; + values[valuesById[50] = "USERS_NOT_CREATED_IN_REPLICA"] = 50; + values[valuesById[51] = "UNSUPPORTED_SYSTEM_OBJECTS"] = 51; + values[valuesById[52] = "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY"] = 52; + values[valuesById[53] = "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE"] = 53; + values[valuesById[54] = "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI"] = 54; + values[valuesById[55] = "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS"] = 55; + values[valuesById[56] = "PROMPT_DELETE_EXISTING"] = 56; + values[valuesById[57] = "WILL_DELETE_EXISTING"] = 57; + values[valuesById[58] = "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE"] = 58; + return values; + })(); + + return SqlExternalSyncSettingError; + })(); + + v1.SelectedObjects = (function() { + + /** + * Properties of a SelectedObjects. + * @memberof google.cloud.sql.v1 + * @interface ISelectedObjects + * @property {string|null} [database] SelectedObjects database + */ + + /** + * Constructs a new SelectedObjects. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SelectedObjects. + * @implements ISelectedObjects + * @constructor + * @param {google.cloud.sql.v1.ISelectedObjects=} [properties] Properties to set + */ + function SelectedObjects(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SelectedObjects database. + * @member {string} database + * @memberof google.cloud.sql.v1.SelectedObjects + * @instance + */ + SelectedObjects.prototype.database = ""; + + /** + * Creates a new SelectedObjects instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SelectedObjects + * @static + * @param {google.cloud.sql.v1.ISelectedObjects=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SelectedObjects} SelectedObjects instance + */ + SelectedObjects.create = function create(properties) { + return new SelectedObjects(properties); + }; + + /** + * Encodes the specified SelectedObjects message. Does not implicitly {@link google.cloud.sql.v1.SelectedObjects.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SelectedObjects + * @static + * @param {google.cloud.sql.v1.ISelectedObjects} message SelectedObjects message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectedObjects.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + return writer; + }; + + /** + * Encodes the specified SelectedObjects message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SelectedObjects.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SelectedObjects + * @static + * @param {google.cloud.sql.v1.ISelectedObjects} message SelectedObjects message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectedObjects.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectedObjects message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SelectedObjects + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SelectedObjects} SelectedObjects + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectedObjects.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SelectedObjects(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectedObjects message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SelectedObjects + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SelectedObjects} SelectedObjects + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectedObjects.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectedObjects message. + * @function verify + * @memberof google.cloud.sql.v1.SelectedObjects + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectedObjects.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + return null; + }; + + /** + * Creates a SelectedObjects message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SelectedObjects + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SelectedObjects} SelectedObjects + */ + SelectedObjects.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SelectedObjects) + return object; + var message = new $root.google.cloud.sql.v1.SelectedObjects(); + if (object.database != null) + message.database = String(object.database); + return message; + }; + + /** + * Creates a plain object from a SelectedObjects message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SelectedObjects + * @static + * @param {google.cloud.sql.v1.SelectedObjects} message SelectedObjects + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectedObjects.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.database = ""; + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + return object; + }; + + /** + * Converts this SelectedObjects to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SelectedObjects + * @instance + * @returns {Object.} JSON object + */ + SelectedObjects.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectedObjects + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SelectedObjects + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectedObjects.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SelectedObjects"; + }; + + return SelectedObjects; + })(); + + v1.OnPremisesConfiguration = (function() { + + /** + * Properties of an OnPremisesConfiguration. + * @memberof google.cloud.sql.v1 + * @interface IOnPremisesConfiguration + * @property {string|null} [hostPort] OnPremisesConfiguration hostPort + * @property {string|null} [kind] OnPremisesConfiguration kind + * @property {string|null} [username] OnPremisesConfiguration username + * @property {string|null} [password] OnPremisesConfiguration password + * @property {string|null} [caCertificate] OnPremisesConfiguration caCertificate + * @property {string|null} [clientCertificate] OnPremisesConfiguration clientCertificate + * @property {string|null} [clientKey] OnPremisesConfiguration clientKey + * @property {string|null} [dumpFilePath] OnPremisesConfiguration dumpFilePath + * @property {google.cloud.sql.v1.IInstanceReference|null} [sourceInstance] OnPremisesConfiguration sourceInstance + * @property {Array.|null} [selectedObjects] OnPremisesConfiguration selectedObjects + * @property {google.cloud.sql.v1.OnPremisesConfiguration.SslOption|null} [sslOption] OnPremisesConfiguration sslOption + */ + + /** + * Constructs a new OnPremisesConfiguration. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an OnPremisesConfiguration. + * @implements IOnPremisesConfiguration + * @constructor + * @param {google.cloud.sql.v1.IOnPremisesConfiguration=} [properties] Properties to set + */ + function OnPremisesConfiguration(properties) { + this.selectedObjects = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OnPremisesConfiguration hostPort. + * @member {string} hostPort + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.hostPort = ""; + + /** + * OnPremisesConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.kind = ""; + + /** + * OnPremisesConfiguration username. + * @member {string} username + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.username = ""; + + /** + * OnPremisesConfiguration password. + * @member {string} password + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.password = ""; + + /** + * OnPremisesConfiguration caCertificate. + * @member {string} caCertificate + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.caCertificate = ""; + + /** + * OnPremisesConfiguration clientCertificate. + * @member {string} clientCertificate + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.clientCertificate = ""; + + /** + * OnPremisesConfiguration clientKey. + * @member {string} clientKey + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.clientKey = ""; + + /** + * OnPremisesConfiguration dumpFilePath. + * @member {string} dumpFilePath + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.dumpFilePath = ""; + + /** + * OnPremisesConfiguration sourceInstance. + * @member {google.cloud.sql.v1.IInstanceReference|null|undefined} sourceInstance + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.sourceInstance = null; + + /** + * OnPremisesConfiguration selectedObjects. + * @member {Array.} selectedObjects + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.selectedObjects = $util.emptyArray; + + /** + * OnPremisesConfiguration sslOption. + * @member {google.cloud.sql.v1.OnPremisesConfiguration.SslOption} sslOption + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.sslOption = 0; + + /** + * Creates a new OnPremisesConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @static + * @param {google.cloud.sql.v1.IOnPremisesConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1.OnPremisesConfiguration} OnPremisesConfiguration instance + */ + OnPremisesConfiguration.create = function create(properties) { + return new OnPremisesConfiguration(properties); + }; + + /** + * Encodes the specified OnPremisesConfiguration message. Does not implicitly {@link google.cloud.sql.v1.OnPremisesConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @static + * @param {google.cloud.sql.v1.IOnPremisesConfiguration} message OnPremisesConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnPremisesConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hostPort != null && Object.hasOwnProperty.call(message, "hostPort")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.hostPort); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + if (message.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.username); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.password); + if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.caCertificate); + if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.clientCertificate); + if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.clientKey); + if (message.dumpFilePath != null && Object.hasOwnProperty.call(message, "dumpFilePath")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.dumpFilePath); + if (message.sourceInstance != null && Object.hasOwnProperty.call(message, "sourceInstance")) + $root.google.cloud.sql.v1.InstanceReference.encode(message.sourceInstance, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.selectedObjects != null && message.selectedObjects.length) + for (var i = 0; i < message.selectedObjects.length; ++i) + $root.google.cloud.sql.v1.SelectedObjects.encode(message.selectedObjects[i], writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.sslOption != null && Object.hasOwnProperty.call(message, "sslOption")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.sslOption); + return writer; + }; + + /** + * Encodes the specified OnPremisesConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OnPremisesConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @static + * @param {google.cloud.sql.v1.IOnPremisesConfiguration} message OnPremisesConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnPremisesConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OnPremisesConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.OnPremisesConfiguration} OnPremisesConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnPremisesConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.OnPremisesConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.hostPort = reader.string(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + case 3: { + message.username = reader.string(); + break; + } + case 4: { + message.password = reader.string(); + break; + } + case 5: { + message.caCertificate = reader.string(); + break; + } + case 6: { + message.clientCertificate = reader.string(); + break; + } + case 7: { + message.clientKey = reader.string(); + break; + } + case 8: { + message.dumpFilePath = reader.string(); + break; + } + case 15: { + message.sourceInstance = $root.google.cloud.sql.v1.InstanceReference.decode(reader, reader.uint32()); + break; + } + case 16: { + if (!(message.selectedObjects && message.selectedObjects.length)) + message.selectedObjects = []; + message.selectedObjects.push($root.google.cloud.sql.v1.SelectedObjects.decode(reader, reader.uint32())); + break; + } + case 18: { + message.sslOption = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OnPremisesConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.OnPremisesConfiguration} OnPremisesConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnPremisesConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OnPremisesConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OnPremisesConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hostPort != null && message.hasOwnProperty("hostPort")) + if (!$util.isString(message.hostPort)) + return "hostPort: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + if (!$util.isString(message.caCertificate)) + return "caCertificate: string expected"; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + if (!$util.isString(message.clientCertificate)) + return "clientCertificate: string expected"; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + if (!$util.isString(message.clientKey)) + return "clientKey: string expected"; + if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) + if (!$util.isString(message.dumpFilePath)) + return "dumpFilePath: string expected"; + if (message.sourceInstance != null && message.hasOwnProperty("sourceInstance")) { + var error = $root.google.cloud.sql.v1.InstanceReference.verify(message.sourceInstance); + if (error) + return "sourceInstance." + error; + } + if (message.selectedObjects != null && message.hasOwnProperty("selectedObjects")) { + if (!Array.isArray(message.selectedObjects)) + return "selectedObjects: array expected"; + for (var i = 0; i < message.selectedObjects.length; ++i) { + var error = $root.google.cloud.sql.v1.SelectedObjects.verify(message.selectedObjects[i]); + if (error) + return "selectedObjects." + error; + } + } + if (message.sslOption != null && message.hasOwnProperty("sslOption")) + switch (message.sslOption) { + default: + return "sslOption: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates an OnPremisesConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.OnPremisesConfiguration} OnPremisesConfiguration + */ + OnPremisesConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.OnPremisesConfiguration) + return object; + var message = new $root.google.cloud.sql.v1.OnPremisesConfiguration(); + if (object.hostPort != null) + message.hostPort = String(object.hostPort); + if (object.kind != null) + message.kind = String(object.kind); + if (object.username != null) + message.username = String(object.username); + if (object.password != null) + message.password = String(object.password); + if (object.caCertificate != null) + message.caCertificate = String(object.caCertificate); + if (object.clientCertificate != null) + message.clientCertificate = String(object.clientCertificate); + if (object.clientKey != null) + message.clientKey = String(object.clientKey); + if (object.dumpFilePath != null) + message.dumpFilePath = String(object.dumpFilePath); + if (object.sourceInstance != null) { + if (typeof object.sourceInstance !== "object") + throw TypeError(".google.cloud.sql.v1.OnPremisesConfiguration.sourceInstance: object expected"); + message.sourceInstance = $root.google.cloud.sql.v1.InstanceReference.fromObject(object.sourceInstance); + } + if (object.selectedObjects) { + if (!Array.isArray(object.selectedObjects)) + throw TypeError(".google.cloud.sql.v1.OnPremisesConfiguration.selectedObjects: array expected"); + message.selectedObjects = []; + for (var i = 0; i < object.selectedObjects.length; ++i) { + if (typeof object.selectedObjects[i] !== "object") + throw TypeError(".google.cloud.sql.v1.OnPremisesConfiguration.selectedObjects: object expected"); + message.selectedObjects[i] = $root.google.cloud.sql.v1.SelectedObjects.fromObject(object.selectedObjects[i]); + } + } + switch (object.sslOption) { + default: + if (typeof object.sslOption === "number") { + message.sslOption = object.sslOption; + break; + } + break; + case "SSL_OPTION_UNSPECIFIED": + case 0: + message.sslOption = 0; + break; + case "DISABLE": + case 1: + message.sslOption = 1; + break; + case "REQUIRE": + case 2: + message.sslOption = 2; + break; + case "VERIFY_CA": + case 3: + message.sslOption = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from an OnPremisesConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @static + * @param {google.cloud.sql.v1.OnPremisesConfiguration} message OnPremisesConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OnPremisesConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.selectedObjects = []; + if (options.defaults) { + object.hostPort = ""; + object.kind = ""; + object.username = ""; + object.password = ""; + object.caCertificate = ""; + object.clientCertificate = ""; + object.clientKey = ""; + object.dumpFilePath = ""; + object.sourceInstance = null; + object.sslOption = options.enums === String ? "SSL_OPTION_UNSPECIFIED" : 0; + } + if (message.hostPort != null && message.hasOwnProperty("hostPort")) + object.hostPort = message.hostPort; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + object.caCertificate = message.caCertificate; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + object.clientCertificate = message.clientCertificate; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + object.clientKey = message.clientKey; + if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) + object.dumpFilePath = message.dumpFilePath; + if (message.sourceInstance != null && message.hasOwnProperty("sourceInstance")) + object.sourceInstance = $root.google.cloud.sql.v1.InstanceReference.toObject(message.sourceInstance, options); + if (message.selectedObjects && message.selectedObjects.length) { + object.selectedObjects = []; + for (var j = 0; j < message.selectedObjects.length; ++j) + object.selectedObjects[j] = $root.google.cloud.sql.v1.SelectedObjects.toObject(message.selectedObjects[j], options); + } + if (message.sslOption != null && message.hasOwnProperty("sslOption")) + object.sslOption = options.enums === String ? $root.google.cloud.sql.v1.OnPremisesConfiguration.SslOption[message.sslOption] === undefined ? message.sslOption : $root.google.cloud.sql.v1.OnPremisesConfiguration.SslOption[message.sslOption] : message.sslOption; + return object; + }; + + /** + * Converts this OnPremisesConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @instance + * @returns {Object.} JSON object + */ + OnPremisesConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OnPremisesConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1.OnPremisesConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OnPremisesConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.OnPremisesConfiguration"; + }; + + /** + * SslOption enum. + * @name google.cloud.sql.v1.OnPremisesConfiguration.SslOption + * @enum {number} + * @property {number} SSL_OPTION_UNSPECIFIED=0 SSL_OPTION_UNSPECIFIED value + * @property {number} DISABLE=1 DISABLE value + * @property {number} REQUIRE=2 REQUIRE value + * @property {number} VERIFY_CA=3 VERIFY_CA value + */ + OnPremisesConfiguration.SslOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SSL_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLE"] = 1; + values[valuesById[2] = "REQUIRE"] = 2; + values[valuesById[3] = "VERIFY_CA"] = 3; + return values; + })(); + + return OnPremisesConfiguration; + })(); + + v1.ReplicaConfiguration = (function() { + + /** + * Properties of a ReplicaConfiguration. + * @memberof google.cloud.sql.v1 + * @interface IReplicaConfiguration + * @property {string|null} [kind] ReplicaConfiguration kind + * @property {google.cloud.sql.v1.IMySqlReplicaConfiguration|null} [mysqlReplicaConfiguration] ReplicaConfiguration mysqlReplicaConfiguration + * @property {google.protobuf.IBoolValue|null} [failoverTarget] ReplicaConfiguration failoverTarget + * @property {google.protobuf.IBoolValue|null} [cascadableReplica] ReplicaConfiguration cascadableReplica + */ + + /** + * Constructs a new ReplicaConfiguration. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a ReplicaConfiguration. + * @implements IReplicaConfiguration + * @constructor + * @param {google.cloud.sql.v1.IReplicaConfiguration=} [properties] Properties to set + */ + function ReplicaConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReplicaConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @instance + */ + ReplicaConfiguration.prototype.kind = ""; + + /** + * ReplicaConfiguration mysqlReplicaConfiguration. + * @member {google.cloud.sql.v1.IMySqlReplicaConfiguration|null|undefined} mysqlReplicaConfiguration + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @instance + */ + ReplicaConfiguration.prototype.mysqlReplicaConfiguration = null; + + /** + * ReplicaConfiguration failoverTarget. + * @member {google.protobuf.IBoolValue|null|undefined} failoverTarget + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @instance + */ + ReplicaConfiguration.prototype.failoverTarget = null; + + /** + * ReplicaConfiguration cascadableReplica. + * @member {google.protobuf.IBoolValue|null|undefined} cascadableReplica + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @instance + */ + ReplicaConfiguration.prototype.cascadableReplica = null; + + /** + * Creates a new ReplicaConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.IReplicaConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ReplicaConfiguration} ReplicaConfiguration instance + */ + ReplicaConfiguration.create = function create(properties) { + return new ReplicaConfiguration(properties); + }; + + /** + * Encodes the specified ReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.ReplicaConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.IReplicaConfiguration} message ReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicaConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.mysqlReplicaConfiguration != null && Object.hasOwnProperty.call(message, "mysqlReplicaConfiguration")) + $root.google.cloud.sql.v1.MySqlReplicaConfiguration.encode(message.mysqlReplicaConfiguration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.failoverTarget != null && Object.hasOwnProperty.call(message, "failoverTarget")) + $root.google.protobuf.BoolValue.encode(message.failoverTarget, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.cascadableReplica != null && Object.hasOwnProperty.call(message, "cascadableReplica")) + $root.google.protobuf.BoolValue.encode(message.cascadableReplica, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReplicaConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.IReplicaConfiguration} message ReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplicaConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ReplicaConfiguration} ReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicaConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ReplicaConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.MySqlReplicaConfiguration.decode(reader, reader.uint32()); + break; + } + case 3: { + message.failoverTarget = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 5: { + message.cascadableReplica = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplicaConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ReplicaConfiguration} ReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplicaConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplicaConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) { + var error = $root.google.cloud.sql.v1.MySqlReplicaConfiguration.verify(message.mysqlReplicaConfiguration); + if (error) + return "mysqlReplicaConfiguration." + error; + } + if (message.failoverTarget != null && message.hasOwnProperty("failoverTarget")) { + var error = $root.google.protobuf.BoolValue.verify(message.failoverTarget); + if (error) + return "failoverTarget." + error; + } + if (message.cascadableReplica != null && message.hasOwnProperty("cascadableReplica")) { + var error = $root.google.protobuf.BoolValue.verify(message.cascadableReplica); + if (error) + return "cascadableReplica." + error; + } + return null; + }; + + /** + * Creates a ReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ReplicaConfiguration} ReplicaConfiguration + */ + ReplicaConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ReplicaConfiguration) + return object; + var message = new $root.google.cloud.sql.v1.ReplicaConfiguration(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.mysqlReplicaConfiguration != null) { + if (typeof object.mysqlReplicaConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1.ReplicaConfiguration.mysqlReplicaConfiguration: object expected"); + message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.MySqlReplicaConfiguration.fromObject(object.mysqlReplicaConfiguration); + } + if (object.failoverTarget != null) { + if (typeof object.failoverTarget !== "object") + throw TypeError(".google.cloud.sql.v1.ReplicaConfiguration.failoverTarget: object expected"); + message.failoverTarget = $root.google.protobuf.BoolValue.fromObject(object.failoverTarget); + } + if (object.cascadableReplica != null) { + if (typeof object.cascadableReplica !== "object") + throw TypeError(".google.cloud.sql.v1.ReplicaConfiguration.cascadableReplica: object expected"); + message.cascadableReplica = $root.google.protobuf.BoolValue.fromObject(object.cascadableReplica); + } + return message; + }; + + /** + * Creates a plain object from a ReplicaConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @static + * @param {google.cloud.sql.v1.ReplicaConfiguration} message ReplicaConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplicaConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.mysqlReplicaConfiguration = null; + object.failoverTarget = null; + object.cascadableReplica = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) + object.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.MySqlReplicaConfiguration.toObject(message.mysqlReplicaConfiguration, options); + if (message.failoverTarget != null && message.hasOwnProperty("failoverTarget")) + object.failoverTarget = $root.google.protobuf.BoolValue.toObject(message.failoverTarget, options); + if (message.cascadableReplica != null && message.hasOwnProperty("cascadableReplica")) + object.cascadableReplica = $root.google.protobuf.BoolValue.toObject(message.cascadableReplica, options); + return object; + }; + + /** + * Converts this ReplicaConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @instance + * @returns {Object.} JSON object + */ + ReplicaConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReplicaConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ReplicaConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ReplicaConfiguration"; + }; + + return ReplicaConfiguration; + })(); + + v1.SqlInstancesExecuteSqlRequest = (function() { + + /** + * Properties of a SqlInstancesExecuteSqlRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesExecuteSqlRequest + * @property {string|null} [instance] SqlInstancesExecuteSqlRequest instance + * @property {string|null} [project] SqlInstancesExecuteSqlRequest project + * @property {google.cloud.sql.v1.IExecuteSqlPayload|null} [body] SqlInstancesExecuteSqlRequest body + */ + + /** + * Constructs a new SqlInstancesExecuteSqlRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesExecuteSqlRequest. + * @implements ISqlInstancesExecuteSqlRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest=} [properties] Properties to set + */ + function SqlInstancesExecuteSqlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesExecuteSqlRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @instance + */ + SqlInstancesExecuteSqlRequest.prototype.instance = ""; + + /** + * SqlInstancesExecuteSqlRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @instance + */ + SqlInstancesExecuteSqlRequest.prototype.project = ""; + + /** + * SqlInstancesExecuteSqlRequest body. + * @member {google.cloud.sql.v1.IExecuteSqlPayload|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @instance + */ + SqlInstancesExecuteSqlRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesExecuteSqlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest instance + */ + SqlInstancesExecuteSqlRequest.create = function create(properties) { + return new SqlInstancesExecuteSqlRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesExecuteSqlRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExecuteSqlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.ExecuteSqlPayload.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesExecuteSqlRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExecuteSqlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExecuteSqlRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.ExecuteSqlPayload.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExecuteSqlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesExecuteSqlRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesExecuteSqlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.ExecuteSqlPayload.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesExecuteSqlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest + */ + SqlInstancesExecuteSqlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.ExecuteSqlPayload.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesExecuteSqlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesExecuteSqlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.ExecuteSqlPayload.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesExecuteSqlRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesExecuteSqlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesExecuteSqlRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesExecuteSqlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesExecuteSqlRequest"; + }; + + return SqlInstancesExecuteSqlRequest; + })(); + + v1.ExecuteSqlPayload = (function() { + + /** + * Properties of an ExecuteSqlPayload. + * @memberof google.cloud.sql.v1 + * @interface IExecuteSqlPayload + * @property {string|null} [user] ExecuteSqlPayload user + * @property {string|null} [sqlStatement] ExecuteSqlPayload sqlStatement + * @property {string|null} [database] ExecuteSqlPayload database + * @property {boolean|null} [autoIamAuthn] ExecuteSqlPayload autoIamAuthn + * @property {number|Long|null} [rowLimit] ExecuteSqlPayload rowLimit + * @property {google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode|null} [partialResultMode] ExecuteSqlPayload partialResultMode + * @property {string|null} [application] ExecuteSqlPayload application + */ + + /** + * Constructs a new ExecuteSqlPayload. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an ExecuteSqlPayload. + * @implements IExecuteSqlPayload + * @constructor + * @param {google.cloud.sql.v1.IExecuteSqlPayload=} [properties] Properties to set + */ + function ExecuteSqlPayload(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExecuteSqlPayload user. + * @member {string} user + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.user = ""; + + /** + * ExecuteSqlPayload sqlStatement. + * @member {string} sqlStatement + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.sqlStatement = ""; + + /** + * ExecuteSqlPayload database. + * @member {string} database + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.database = ""; + + /** + * ExecuteSqlPayload autoIamAuthn. + * @member {boolean|null|undefined} autoIamAuthn + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.autoIamAuthn = null; + + /** + * ExecuteSqlPayload rowLimit. + * @member {number|Long} rowLimit + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.rowLimit = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ExecuteSqlPayload partialResultMode. + * @member {google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode} partialResultMode + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.partialResultMode = 0; + + /** + * ExecuteSqlPayload application. + * @member {string} application + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.application = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExecuteSqlPayload userPassword. + * @member {"autoIamAuthn"|undefined} userPassword + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @instance + */ + Object.defineProperty(ExecuteSqlPayload.prototype, "userPassword", { + get: $util.oneOfGetter($oneOfFields = ["autoIamAuthn"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExecuteSqlPayload instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @static + * @param {google.cloud.sql.v1.IExecuteSqlPayload=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ExecuteSqlPayload} ExecuteSqlPayload instance + */ + ExecuteSqlPayload.create = function create(properties) { + return new ExecuteSqlPayload(properties); + }; + + /** + * Encodes the specified ExecuteSqlPayload message. Does not implicitly {@link google.cloud.sql.v1.ExecuteSqlPayload.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @static + * @param {google.cloud.sql.v1.IExecuteSqlPayload} message ExecuteSqlPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecuteSqlPayload.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.user != null && Object.hasOwnProperty.call(message, "user")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.user); + if (message.sqlStatement != null && Object.hasOwnProperty.call(message, "sqlStatement")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sqlStatement); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.database); + if (message.rowLimit != null && Object.hasOwnProperty.call(message, "rowLimit")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.rowLimit); + if (message.autoIamAuthn != null && Object.hasOwnProperty.call(message, "autoIamAuthn")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.autoIamAuthn); + if (message.partialResultMode != null && Object.hasOwnProperty.call(message, "partialResultMode")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.partialResultMode); + if (message.application != null && Object.hasOwnProperty.call(message, "application")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.application); + return writer; + }; + + /** + * Encodes the specified ExecuteSqlPayload message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExecuteSqlPayload.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @static + * @param {google.cloud.sql.v1.IExecuteSqlPayload} message ExecuteSqlPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecuteSqlPayload.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExecuteSqlPayload message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ExecuteSqlPayload} ExecuteSqlPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecuteSqlPayload.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExecuteSqlPayload(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.user = reader.string(); + break; + } + case 2: { + message.sqlStatement = reader.string(); + break; + } + case 3: { + message.database = reader.string(); + break; + } + case 11: { + message.autoIamAuthn = reader.bool(); + break; + } + case 10: { + message.rowLimit = reader.int64(); + break; + } + case 13: { + message.partialResultMode = reader.int32(); + break; + } + case 16: { + message.application = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExecuteSqlPayload message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ExecuteSqlPayload} ExecuteSqlPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecuteSqlPayload.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExecuteSqlPayload message. + * @function verify + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExecuteSqlPayload.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.user != null && message.hasOwnProperty("user")) + if (!$util.isString(message.user)) + return "user: string expected"; + if (message.sqlStatement != null && message.hasOwnProperty("sqlStatement")) + if (!$util.isString(message.sqlStatement)) + return "sqlStatement: string expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.autoIamAuthn != null && message.hasOwnProperty("autoIamAuthn")) { + properties.userPassword = 1; + if (typeof message.autoIamAuthn !== "boolean") + return "autoIamAuthn: boolean expected"; + } + if (message.rowLimit != null && message.hasOwnProperty("rowLimit")) + if (!$util.isInteger(message.rowLimit) && !(message.rowLimit && $util.isInteger(message.rowLimit.low) && $util.isInteger(message.rowLimit.high))) + return "rowLimit: integer|Long expected"; + if (message.partialResultMode != null && message.hasOwnProperty("partialResultMode")) + switch (message.partialResultMode) { + default: + return "partialResultMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.application != null && message.hasOwnProperty("application")) + if (!$util.isString(message.application)) + return "application: string expected"; + return null; + }; + + /** + * Creates an ExecuteSqlPayload message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ExecuteSqlPayload} ExecuteSqlPayload + */ + ExecuteSqlPayload.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ExecuteSqlPayload) + return object; + var message = new $root.google.cloud.sql.v1.ExecuteSqlPayload(); + if (object.user != null) + message.user = String(object.user); + if (object.sqlStatement != null) + message.sqlStatement = String(object.sqlStatement); + if (object.database != null) + message.database = String(object.database); + if (object.autoIamAuthn != null) + message.autoIamAuthn = Boolean(object.autoIamAuthn); + if (object.rowLimit != null) + if ($util.Long) + (message.rowLimit = $util.Long.fromValue(object.rowLimit)).unsigned = false; + else if (typeof object.rowLimit === "string") + message.rowLimit = parseInt(object.rowLimit, 10); + else if (typeof object.rowLimit === "number") + message.rowLimit = object.rowLimit; + else if (typeof object.rowLimit === "object") + message.rowLimit = new $util.LongBits(object.rowLimit.low >>> 0, object.rowLimit.high >>> 0).toNumber(); + switch (object.partialResultMode) { + default: + if (typeof object.partialResultMode === "number") { + message.partialResultMode = object.partialResultMode; + break; + } + break; + case "PARTIAL_RESULT_MODE_UNSPECIFIED": + case 0: + message.partialResultMode = 0; + break; + case "FAIL_PARTIAL_RESULT": + case 1: + message.partialResultMode = 1; + break; + case "ALLOW_PARTIAL_RESULT": + case 2: + message.partialResultMode = 2; + break; + } + if (object.application != null) + message.application = String(object.application); + return message; + }; + + /** + * Creates a plain object from an ExecuteSqlPayload message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @static + * @param {google.cloud.sql.v1.ExecuteSqlPayload} message ExecuteSqlPayload + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExecuteSqlPayload.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.user = ""; + object.sqlStatement = ""; + object.database = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.rowLimit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.rowLimit = options.longs === String ? "0" : 0; + object.partialResultMode = options.enums === String ? "PARTIAL_RESULT_MODE_UNSPECIFIED" : 0; + object.application = ""; + } + if (message.user != null && message.hasOwnProperty("user")) + object.user = message.user; + if (message.sqlStatement != null && message.hasOwnProperty("sqlStatement")) + object.sqlStatement = message.sqlStatement; + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + if (message.rowLimit != null && message.hasOwnProperty("rowLimit")) + if (typeof message.rowLimit === "number") + object.rowLimit = options.longs === String ? String(message.rowLimit) : message.rowLimit; + else + object.rowLimit = options.longs === String ? $util.Long.prototype.toString.call(message.rowLimit) : options.longs === Number ? new $util.LongBits(message.rowLimit.low >>> 0, message.rowLimit.high >>> 0).toNumber() : message.rowLimit; + if (message.autoIamAuthn != null && message.hasOwnProperty("autoIamAuthn")) { + object.autoIamAuthn = message.autoIamAuthn; + if (options.oneofs) + object.userPassword = "autoIamAuthn"; + } + if (message.partialResultMode != null && message.hasOwnProperty("partialResultMode")) + object.partialResultMode = options.enums === String ? $root.google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode[message.partialResultMode] === undefined ? message.partialResultMode : $root.google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode[message.partialResultMode] : message.partialResultMode; + if (message.application != null && message.hasOwnProperty("application")) + object.application = message.application; + return object; + }; + + /** + * Converts this ExecuteSqlPayload to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @instance + * @returns {Object.} JSON object + */ + ExecuteSqlPayload.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExecuteSqlPayload + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ExecuteSqlPayload + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExecuteSqlPayload.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ExecuteSqlPayload"; + }; + + /** + * PartialResultMode enum. + * @name google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode + * @enum {number} + * @property {number} PARTIAL_RESULT_MODE_UNSPECIFIED=0 PARTIAL_RESULT_MODE_UNSPECIFIED value + * @property {number} FAIL_PARTIAL_RESULT=1 FAIL_PARTIAL_RESULT value + * @property {number} ALLOW_PARTIAL_RESULT=2 ALLOW_PARTIAL_RESULT value + */ + ExecuteSqlPayload.PartialResultMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PARTIAL_RESULT_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FAIL_PARTIAL_RESULT"] = 1; + values[valuesById[2] = "ALLOW_PARTIAL_RESULT"] = 2; + return values; + })(); + + return ExecuteSqlPayload; + })(); + + v1.SqlInstancesExecuteSqlResponse = (function() { + + /** + * Properties of a SqlInstancesExecuteSqlResponse. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesExecuteSqlResponse + * @property {Array.|null} [messages] SqlInstancesExecuteSqlResponse messages + * @property {google.cloud.sql.v1.IMetadata|null} [metadata] SqlInstancesExecuteSqlResponse metadata + * @property {Array.|null} [results] SqlInstancesExecuteSqlResponse results + * @property {google.rpc.IStatus|null} [status] SqlInstancesExecuteSqlResponse status + */ + + /** + * Constructs a new SqlInstancesExecuteSqlResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesExecuteSqlResponse. + * @implements ISqlInstancesExecuteSqlResponse + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse=} [properties] Properties to set + */ + function SqlInstancesExecuteSqlResponse(properties) { + this.messages = []; + this.results = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesExecuteSqlResponse messages. + * @member {Array.} messages + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @instance + */ + SqlInstancesExecuteSqlResponse.prototype.messages = $util.emptyArray; + + /** + * SqlInstancesExecuteSqlResponse metadata. + * @member {google.cloud.sql.v1.IMetadata|null|undefined} metadata + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @instance + */ + SqlInstancesExecuteSqlResponse.prototype.metadata = null; + + /** + * SqlInstancesExecuteSqlResponse results. + * @member {Array.} results + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @instance + */ + SqlInstancesExecuteSqlResponse.prototype.results = $util.emptyArray; + + /** + * SqlInstancesExecuteSqlResponse status. + * @member {google.rpc.IStatus|null|undefined} status + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @instance + */ + SqlInstancesExecuteSqlResponse.prototype.status = null; + + /** + * Creates a new SqlInstancesExecuteSqlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse instance + */ + SqlInstancesExecuteSqlResponse.create = function create(properties) { + return new SqlInstancesExecuteSqlResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesExecuteSqlResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExecuteSqlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.cloud.sql.v1.Metadata.encode(message.metadata, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.sql.v1.QueryResult.encode(message.results[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.encode(message.messages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesExecuteSqlResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExecuteSqlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExecuteSqlResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 9: { + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.decode(reader, reader.uint32())); + break; + } + case 6: { + message.metadata = $root.google.cloud.sql.v1.Metadata.decode(reader, reader.uint32()); + break; + } + case 7: { + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.sql.v1.QueryResult.decode(reader, reader.uint32())); + break; + } + case 8: { + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExecuteSqlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesExecuteSqlResponse message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesExecuteSqlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.cloud.sql.v1.Metadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.sql.v1.QueryResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.rpc.Status.verify(message.status); + if (error) + return "status." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesExecuteSqlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse + */ + SqlInstancesExecuteSqlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse(); + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.messages: object expected"); + message.messages[i] = $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.fromObject(object.messages[i]); + } + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.metadata: object expected"); + message.metadata = $root.google.cloud.sql.v1.Metadata.fromObject(object.metadata); + } + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.results: object expected"); + message.results[i] = $root.google.cloud.sql.v1.QueryResult.fromObject(object.results[i]); + } + } + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.status: object expected"); + message.status = $root.google.rpc.Status.fromObject(object.status); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesExecuteSqlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @static + * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesExecuteSqlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.messages = []; + } + if (options.defaults) { + object.metadata = null; + object.status = null; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.cloud.sql.v1.Metadata.toObject(message.metadata, options); + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.sql.v1.QueryResult.toObject(message.results[j], options); + } + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.rpc.Status.toObject(message.status, options); + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.toObject(message.messages[j], options); + } + return object; + }; + + /** + * Converts this SqlInstancesExecuteSqlResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesExecuteSqlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesExecuteSqlResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesExecuteSqlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesExecuteSqlResponse"; + }; + + SqlInstancesExecuteSqlResponse.Message = (function() { + + /** + * Properties of a Message. + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @interface IMessage + * @property {string|null} [message] Message message + * @property {string|null} [severity] Message severity + */ + + /** + * Constructs a new Message. + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse + * @classdesc Represents a Message. + * @implements IMessage + * @constructor + * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage=} [properties] Properties to set + */ + function Message(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Message message. + * @member {string|null|undefined} message + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @instance + */ + Message.prototype.message = null; + + /** + * Message severity. + * @member {string|null|undefined} severity + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @instance + */ + Message.prototype.severity = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Message.prototype, "_message", { + get: $util.oneOfGetter($oneOfFields = ["message"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Message.prototype, "_severity", { + get: $util.oneOfGetter($oneOfFields = ["severity"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Message instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message} Message instance + */ + Message.create = function create(properties) { + return new Message(properties); + }; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.severity); + return writer; + }; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Message message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.message = reader.string(); + break; + } + case 2: { + message.severity = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Message message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Message.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.message != null && message.hasOwnProperty("message")) { + properties._message = 1; + if (!$util.isString(message.message)) + return "message: string expected"; + } + if (message.severity != null && message.hasOwnProperty("severity")) { + properties._severity = 1; + if (!$util.isString(message.severity)) + return "severity: string expected"; + } + return null; + }; + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message} Message + */ + Message.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message(); + if (object.message != null) + message.message = String(object.message); + if (object.severity != null) + message.severity = String(object.severity); + return message; + }; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message} message Message + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Message.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.message != null && message.hasOwnProperty("message")) { + object.message = message.message; + if (options.oneofs) + object._message = "message"; + } + if (message.severity != null && message.hasOwnProperty("severity")) { + object.severity = message.severity; + if (options.oneofs) + object._severity = "severity"; + } + return object; + }; + + /** + * Converts this Message to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @instance + * @returns {Object.} JSON object + */ + Message.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Message + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Message.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message"; + }; + + return Message; + })(); + + return SqlInstancesExecuteSqlResponse; + })(); + + v1.QueryResult = (function() { + + /** + * Properties of a QueryResult. + * @memberof google.cloud.sql.v1 + * @interface IQueryResult + * @property {Array.|null} [columns] QueryResult columns + * @property {Array.|null} [rows] QueryResult rows + * @property {string|null} [message] QueryResult message + * @property {boolean|null} [partialResult] QueryResult partialResult + * @property {google.rpc.IStatus|null} [status] QueryResult status + */ + + /** + * Constructs a new QueryResult. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a QueryResult. + * @implements IQueryResult + * @constructor + * @param {google.cloud.sql.v1.IQueryResult=} [properties] Properties to set + */ + function QueryResult(properties) { + this.columns = []; + this.rows = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryResult columns. + * @member {Array.} columns + * @memberof google.cloud.sql.v1.QueryResult + * @instance + */ + QueryResult.prototype.columns = $util.emptyArray; + + /** + * QueryResult rows. + * @member {Array.} rows + * @memberof google.cloud.sql.v1.QueryResult + * @instance + */ + QueryResult.prototype.rows = $util.emptyArray; + + /** + * QueryResult message. + * @member {string} message + * @memberof google.cloud.sql.v1.QueryResult + * @instance + */ + QueryResult.prototype.message = ""; + + /** + * QueryResult partialResult. + * @member {boolean} partialResult + * @memberof google.cloud.sql.v1.QueryResult + * @instance + */ + QueryResult.prototype.partialResult = false; + + /** + * QueryResult status. + * @member {google.rpc.IStatus|null|undefined} status + * @memberof google.cloud.sql.v1.QueryResult + * @instance + */ + QueryResult.prototype.status = null; + + /** + * Creates a new QueryResult instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.QueryResult + * @static + * @param {google.cloud.sql.v1.IQueryResult=} [properties] Properties to set + * @returns {google.cloud.sql.v1.QueryResult} QueryResult instance + */ + QueryResult.create = function create(properties) { + return new QueryResult(properties); + }; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.sql.v1.QueryResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.QueryResult + * @static + * @param {google.cloud.sql.v1.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.columns != null && message.columns.length) + for (var i = 0; i < message.columns.length; ++i) + $root.google.cloud.sql.v1.Column.encode(message.columns[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.rows != null && message.rows.length) + for (var i = 0; i < message.rows.length; ++i) + $root.google.cloud.sql.v1.Row.encode(message.rows[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + if (message.partialResult != null && Object.hasOwnProperty.call(message, "partialResult")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.partialResult); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.sql.v1.QueryResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.QueryResult + * @static + * @param {google.cloud.sql.v1.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.QueryResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.QueryResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.columns && message.columns.length)) + message.columns = []; + message.columns.push($root.google.cloud.sql.v1.Column.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.rows && message.rows.length)) + message.rows = []; + message.rows.push($root.google.cloud.sql.v1.Row.decode(reader, reader.uint32())); + break; + } + case 3: { + message.message = reader.string(); + break; + } + case 4: { + message.partialResult = reader.bool(); + break; + } + case 8: { + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.QueryResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryResult message. + * @function verify + * @memberof google.cloud.sql.v1.QueryResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.columns != null && message.hasOwnProperty("columns")) { + if (!Array.isArray(message.columns)) + return "columns: array expected"; + for (var i = 0; i < message.columns.length; ++i) { + var error = $root.google.cloud.sql.v1.Column.verify(message.columns[i]); + if (error) + return "columns." + error; + } + } + if (message.rows != null && message.hasOwnProperty("rows")) { + if (!Array.isArray(message.rows)) + return "rows: array expected"; + for (var i = 0; i < message.rows.length; ++i) { + var error = $root.google.cloud.sql.v1.Row.verify(message.rows[i]); + if (error) + return "rows." + error; + } + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.partialResult != null && message.hasOwnProperty("partialResult")) + if (typeof message.partialResult !== "boolean") + return "partialResult: boolean expected"; + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.rpc.Status.verify(message.status); + if (error) + return "status." + error; + } + return null; + }; + + /** + * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.QueryResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.QueryResult} QueryResult + */ + QueryResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.QueryResult) + return object; + var message = new $root.google.cloud.sql.v1.QueryResult(); + if (object.columns) { + if (!Array.isArray(object.columns)) + throw TypeError(".google.cloud.sql.v1.QueryResult.columns: array expected"); + message.columns = []; + for (var i = 0; i < object.columns.length; ++i) { + if (typeof object.columns[i] !== "object") + throw TypeError(".google.cloud.sql.v1.QueryResult.columns: object expected"); + message.columns[i] = $root.google.cloud.sql.v1.Column.fromObject(object.columns[i]); + } + } + if (object.rows) { + if (!Array.isArray(object.rows)) + throw TypeError(".google.cloud.sql.v1.QueryResult.rows: array expected"); + message.rows = []; + for (var i = 0; i < object.rows.length; ++i) { + if (typeof object.rows[i] !== "object") + throw TypeError(".google.cloud.sql.v1.QueryResult.rows: object expected"); + message.rows[i] = $root.google.cloud.sql.v1.Row.fromObject(object.rows[i]); + } + } + if (object.message != null) + message.message = String(object.message); + if (object.partialResult != null) + message.partialResult = Boolean(object.partialResult); + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.cloud.sql.v1.QueryResult.status: object expected"); + message.status = $root.google.rpc.Status.fromObject(object.status); + } + return message; + }; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.QueryResult + * @static + * @param {google.cloud.sql.v1.QueryResult} message QueryResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.columns = []; + object.rows = []; + } + if (options.defaults) { + object.message = ""; + object.partialResult = false; + object.status = null; + } + if (message.columns && message.columns.length) { + object.columns = []; + for (var j = 0; j < message.columns.length; ++j) + object.columns[j] = $root.google.cloud.sql.v1.Column.toObject(message.columns[j], options); + } + if (message.rows && message.rows.length) { + object.rows = []; + for (var j = 0; j < message.rows.length; ++j) + object.rows[j] = $root.google.cloud.sql.v1.Row.toObject(message.rows[j], options); + } + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.partialResult != null && message.hasOwnProperty("partialResult")) + object.partialResult = message.partialResult; + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.rpc.Status.toObject(message.status, options); + return object; + }; + + /** + * Converts this QueryResult to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.QueryResult + * @instance + * @returns {Object.} JSON object + */ + QueryResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryResult + * @function getTypeUrl + * @memberof google.cloud.sql.v1.QueryResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.QueryResult"; + }; + + return QueryResult; + })(); + + v1.Column = (function() { + + /** + * Properties of a Column. + * @memberof google.cloud.sql.v1 + * @interface IColumn + * @property {string|null} [name] Column name + * @property {string|null} [type] Column type + */ + + /** + * Constructs a new Column. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a Column. + * @implements IColumn + * @constructor + * @param {google.cloud.sql.v1.IColumn=} [properties] Properties to set + */ + function Column(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Column name. + * @member {string} name + * @memberof google.cloud.sql.v1.Column + * @instance + */ + Column.prototype.name = ""; + + /** + * Column type. + * @member {string} type + * @memberof google.cloud.sql.v1.Column + * @instance + */ + Column.prototype.type = ""; + + /** + * Creates a new Column instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.Column + * @static + * @param {google.cloud.sql.v1.IColumn=} [properties] Properties to set + * @returns {google.cloud.sql.v1.Column} Column instance + */ + Column.create = function create(properties) { + return new Column(properties); + }; + + /** + * Encodes the specified Column message. Does not implicitly {@link google.cloud.sql.v1.Column.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.Column + * @static + * @param {google.cloud.sql.v1.IColumn} message Column message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Column.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + return writer; + }; + + /** + * Encodes the specified Column message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Column.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.Column + * @static + * @param {google.cloud.sql.v1.IColumn} message Column message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Column.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Column message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.Column + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.Column} Column + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Column.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Column(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Column message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.Column + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.Column} Column + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Column.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Column message. + * @function verify + * @memberof google.cloud.sql.v1.Column + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Column.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + return null; + }; + + /** + * Creates a Column message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.Column + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.Column} Column + */ + Column.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.Column) + return object; + var message = new $root.google.cloud.sql.v1.Column(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + return message; + }; + + /** + * Creates a plain object from a Column message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.Column + * @static + * @param {google.cloud.sql.v1.Column} message Column + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Column.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.type = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + return object; + }; + + /** + * Converts this Column to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.Column + * @instance + * @returns {Object.} JSON object + */ + Column.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Column + * @function getTypeUrl + * @memberof google.cloud.sql.v1.Column + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Column.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.Column"; + }; + + return Column; + })(); + + v1.Row = (function() { + + /** + * Properties of a Row. + * @memberof google.cloud.sql.v1 + * @interface IRow + * @property {Array.|null} [values] Row values + */ + + /** + * Constructs a new Row. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a Row. + * @implements IRow + * @constructor + * @param {google.cloud.sql.v1.IRow=} [properties] Properties to set + */ + function Row(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Row values. + * @member {Array.} values + * @memberof google.cloud.sql.v1.Row + * @instance + */ + Row.prototype.values = $util.emptyArray; + + /** + * Creates a new Row instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.Row + * @static + * @param {google.cloud.sql.v1.IRow=} [properties] Properties to set + * @returns {google.cloud.sql.v1.Row} Row instance + */ + Row.create = function create(properties) { + return new Row(properties); + }; + + /** + * Encodes the specified Row message. Does not implicitly {@link google.cloud.sql.v1.Row.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.Row + * @static + * @param {google.cloud.sql.v1.IRow} message Row message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Row.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.cloud.sql.v1.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Row message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Row.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.Row + * @static + * @param {google.cloud.sql.v1.IRow} message Row message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Row.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Row message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.Row + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.Row} Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Row.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Row(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.sql.v1.Value.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Row message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.Row + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.Row} Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Row.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Row message. + * @function verify + * @memberof google.cloud.sql.v1.Row + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Row.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.cloud.sql.v1.Value.verify(message.values[i]); + if (error) + return "values." + error; + } + } + return null; + }; + + /** + * Creates a Row message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.Row + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.Row} Row + */ + Row.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.Row) + return object; + var message = new $root.google.cloud.sql.v1.Row(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.sql.v1.Row.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.cloud.sql.v1.Row.values: object expected"); + message.values[i] = $root.google.cloud.sql.v1.Value.fromObject(object.values[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Row message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.Row + * @static + * @param {google.cloud.sql.v1.Row} message Row + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Row.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.cloud.sql.v1.Value.toObject(message.values[j], options); + } + return object; + }; + + /** + * Converts this Row to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.Row + * @instance + * @returns {Object.} JSON object + */ + Row.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Row + * @function getTypeUrl + * @memberof google.cloud.sql.v1.Row + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Row.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.Row"; + }; + + return Row; + })(); + + v1.Value = (function() { + + /** + * Properties of a Value. + * @memberof google.cloud.sql.v1 + * @interface IValue + * @property {string|null} [value] Value value + * @property {boolean|null} [nullValue] Value nullValue + */ + + /** + * Constructs a new Value. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a Value. + * @implements IValue + * @constructor + * @param {google.cloud.sql.v1.IValue=} [properties] Properties to set + */ + function Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Value value. + * @member {string} value + * @memberof google.cloud.sql.v1.Value + * @instance + */ + Value.prototype.value = ""; + + /** + * Value nullValue. + * @member {boolean} nullValue + * @memberof google.cloud.sql.v1.Value + * @instance + */ + Value.prototype.nullValue = false; + + /** + * Creates a new Value instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.Value + * @static + * @param {google.cloud.sql.v1.IValue=} [properties] Properties to set + * @returns {google.cloud.sql.v1.Value} Value instance + */ + Value.create = function create(properties) { + return new Value(properties); + }; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.cloud.sql.v1.Value.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.Value + * @static + * @param {google.cloud.sql.v1.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.nullValue); + return writer; + }; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.Value + * @static + * @param {google.cloud.sql.v1.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Value message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + case 2: { + message.nullValue = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Value message. + * @function verify + * @memberof google.cloud.sql.v1.Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) + if (typeof message.nullValue !== "boolean") + return "nullValue: boolean expected"; + return null; + }; + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.Value + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.Value} Value + */ + Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.Value) + return object; + var message = new $root.google.cloud.sql.v1.Value(); + if (object.value != null) + message.value = String(object.value); + if (object.nullValue != null) + message.nullValue = Boolean(object.nullValue); + return message; + }; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.Value + * @static + * @param {google.cloud.sql.v1.Value} message Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.nullValue = false; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) + object.nullValue = message.nullValue; + return object; + }; + + /** + * Converts this Value to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.Value + * @instance + * @returns {Object.} JSON object + */ + Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Value + * @function getTypeUrl + * @memberof google.cloud.sql.v1.Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.Value"; + }; + + return Value; + })(); + + v1.Metadata = (function() { + + /** + * Properties of a Metadata. + * @memberof google.cloud.sql.v1 + * @interface IMetadata + * @property {google.protobuf.IDuration|null} [sqlStatementExecutionTime] Metadata sqlStatementExecutionTime + */ + + /** + * Constructs a new Metadata. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a Metadata. + * @implements IMetadata + * @constructor + * @param {google.cloud.sql.v1.IMetadata=} [properties] Properties to set + */ + function Metadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Metadata sqlStatementExecutionTime. + * @member {google.protobuf.IDuration|null|undefined} sqlStatementExecutionTime + * @memberof google.cloud.sql.v1.Metadata + * @instance + */ + Metadata.prototype.sqlStatementExecutionTime = null; + + /** + * Creates a new Metadata instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.Metadata + * @static + * @param {google.cloud.sql.v1.IMetadata=} [properties] Properties to set + * @returns {google.cloud.sql.v1.Metadata} Metadata instance + */ + Metadata.create = function create(properties) { + return new Metadata(properties); + }; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.sql.v1.Metadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.Metadata + * @static + * @param {google.cloud.sql.v1.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sqlStatementExecutionTime != null && Object.hasOwnProperty.call(message, "sqlStatementExecutionTime")) + $root.google.protobuf.Duration.encode(message.sqlStatementExecutionTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Metadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.Metadata + * @static + * @param {google.cloud.sql.v1.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Metadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.sqlStatementExecutionTime = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Metadata message. + * @function verify + * @memberof google.cloud.sql.v1.Metadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sqlStatementExecutionTime != null && message.hasOwnProperty("sqlStatementExecutionTime")) { + var error = $root.google.protobuf.Duration.verify(message.sqlStatementExecutionTime); + if (error) + return "sqlStatementExecutionTime." + error; + } + return null; + }; + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.Metadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.Metadata} Metadata + */ + Metadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.Metadata) + return object; + var message = new $root.google.cloud.sql.v1.Metadata(); + if (object.sqlStatementExecutionTime != null) { + if (typeof object.sqlStatementExecutionTime !== "object") + throw TypeError(".google.cloud.sql.v1.Metadata.sqlStatementExecutionTime: object expected"); + message.sqlStatementExecutionTime = $root.google.protobuf.Duration.fromObject(object.sqlStatementExecutionTime); + } + return message; + }; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.Metadata + * @static + * @param {google.cloud.sql.v1.Metadata} message Metadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.sqlStatementExecutionTime = null; + if (message.sqlStatementExecutionTime != null && message.hasOwnProperty("sqlStatementExecutionTime")) + object.sqlStatementExecutionTime = $root.google.protobuf.Duration.toObject(message.sqlStatementExecutionTime, options); + return object; + }; + + /** + * Converts this Metadata to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.Metadata + * @instance + * @returns {Object.} JSON object + */ + Metadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Metadata + * @function getTypeUrl + * @memberof google.cloud.sql.v1.Metadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Metadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.Metadata"; + }; + + return Metadata; + })(); + + v1.SqlInstancesAcquireSsrsLeaseRequest = (function() { + + /** + * Properties of a SqlInstancesAcquireSsrsLeaseRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesAcquireSsrsLeaseRequest + * @property {string|null} [instance] SqlInstancesAcquireSsrsLeaseRequest instance + * @property {string|null} [project] SqlInstancesAcquireSsrsLeaseRequest project + * @property {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest|null} [body] SqlInstancesAcquireSsrsLeaseRequest body + */ + + /** + * Constructs a new SqlInstancesAcquireSsrsLeaseRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesAcquireSsrsLeaseRequest. + * @implements ISqlInstancesAcquireSsrsLeaseRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set + */ + function SqlInstancesAcquireSsrsLeaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesAcquireSsrsLeaseRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @instance + */ + SqlInstancesAcquireSsrsLeaseRequest.prototype.instance = ""; + + /** + * SqlInstancesAcquireSsrsLeaseRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @instance + */ + SqlInstancesAcquireSsrsLeaseRequest.prototype.project = ""; + + /** + * SqlInstancesAcquireSsrsLeaseRequest body. + * @member {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @instance + */ + SqlInstancesAcquireSsrsLeaseRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesAcquireSsrsLeaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest instance + */ + SqlInstancesAcquireSsrsLeaseRequest.create = function create(properties) { + return new SqlInstancesAcquireSsrsLeaseRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAcquireSsrsLeaseRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAcquireSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAcquireSsrsLeaseRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAcquireSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesAcquireSsrsLeaseRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesAcquireSsrsLeaseRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest + */ + SqlInstancesAcquireSsrsLeaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesAcquireSsrsLeaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesAcquireSsrsLeaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesAcquireSsrsLeaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesAcquireSsrsLeaseRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesAcquireSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest"; + }; + + return SqlInstancesAcquireSsrsLeaseRequest; + })(); + + v1.SqlInstancesAcquireSsrsLeaseResponse = (function() { + + /** + * Properties of a SqlInstancesAcquireSsrsLeaseResponse. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesAcquireSsrsLeaseResponse + * @property {string|null} [operationId] SqlInstancesAcquireSsrsLeaseResponse operationId + */ + + /** + * Constructs a new SqlInstancesAcquireSsrsLeaseResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesAcquireSsrsLeaseResponse. + * @implements ISqlInstancesAcquireSsrsLeaseResponse + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse=} [properties] Properties to set + */ + function SqlInstancesAcquireSsrsLeaseResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesAcquireSsrsLeaseResponse operationId. + * @member {string} operationId + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @instance + */ + SqlInstancesAcquireSsrsLeaseResponse.prototype.operationId = ""; + + /** + * Creates a new SqlInstancesAcquireSsrsLeaseResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse instance + */ + SqlInstancesAcquireSsrsLeaseResponse.create = function create(properties) { + return new SqlInstancesAcquireSsrsLeaseResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAcquireSsrsLeaseResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operationId != null && Object.hasOwnProperty.call(message, "operationId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.operationId); + return writer; + }; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAcquireSsrsLeaseResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAcquireSsrsLeaseResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.operationId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAcquireSsrsLeaseResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesAcquireSsrsLeaseResponse message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesAcquireSsrsLeaseResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operationId != null && message.hasOwnProperty("operationId")) + if (!$util.isString(message.operationId)) + return "operationId: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesAcquireSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse + */ + SqlInstancesAcquireSsrsLeaseResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse(); + if (object.operationId != null) + message.operationId = String(object.operationId); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesAcquireSsrsLeaseResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesAcquireSsrsLeaseResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.operationId = ""; + if (message.operationId != null && message.hasOwnProperty("operationId")) + object.operationId = message.operationId; + return object; + }; + + /** + * Converts this SqlInstancesAcquireSsrsLeaseResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesAcquireSsrsLeaseResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesAcquireSsrsLeaseResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesAcquireSsrsLeaseResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse"; + }; + + return SqlInstancesAcquireSsrsLeaseResponse; + })(); + + v1.SqlInstancesReleaseSsrsLeaseRequest = (function() { + + /** + * Properties of a SqlInstancesReleaseSsrsLeaseRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesReleaseSsrsLeaseRequest + * @property {string|null} [instance] SqlInstancesReleaseSsrsLeaseRequest instance + * @property {string|null} [project] SqlInstancesReleaseSsrsLeaseRequest project + */ + + /** + * Constructs a new SqlInstancesReleaseSsrsLeaseRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesReleaseSsrsLeaseRequest. + * @implements ISqlInstancesReleaseSsrsLeaseRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest=} [properties] Properties to set + */ + function SqlInstancesReleaseSsrsLeaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesReleaseSsrsLeaseRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @instance + */ + SqlInstancesReleaseSsrsLeaseRequest.prototype.instance = ""; + + /** + * SqlInstancesReleaseSsrsLeaseRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @instance + */ + SqlInstancesReleaseSsrsLeaseRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesReleaseSsrsLeaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest instance + */ + SqlInstancesReleaseSsrsLeaseRequest.create = function create(properties) { + return new SqlInstancesReleaseSsrsLeaseRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReleaseSsrsLeaseRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReleaseSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReleaseSsrsLeaseRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReleaseSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesReleaseSsrsLeaseRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesReleaseSsrsLeaseRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesReleaseSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest + */ + SqlInstancesReleaseSsrsLeaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesReleaseSsrsLeaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesReleaseSsrsLeaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesReleaseSsrsLeaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesReleaseSsrsLeaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesReleaseSsrsLeaseRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesReleaseSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest"; + }; + + return SqlInstancesReleaseSsrsLeaseRequest; + })(); + + v1.SqlInstancesReleaseSsrsLeaseResponse = (function() { + + /** + * Properties of a SqlInstancesReleaseSsrsLeaseResponse. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesReleaseSsrsLeaseResponse + * @property {string|null} [operationId] SqlInstancesReleaseSsrsLeaseResponse operationId + */ + + /** + * Constructs a new SqlInstancesReleaseSsrsLeaseResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesReleaseSsrsLeaseResponse. + * @implements ISqlInstancesReleaseSsrsLeaseResponse + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse=} [properties] Properties to set + */ + function SqlInstancesReleaseSsrsLeaseResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesReleaseSsrsLeaseResponse operationId. + * @member {string} operationId + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @instance + */ + SqlInstancesReleaseSsrsLeaseResponse.prototype.operationId = ""; + + /** + * Creates a new SqlInstancesReleaseSsrsLeaseResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse instance + */ + SqlInstancesReleaseSsrsLeaseResponse.create = function create(properties) { + return new SqlInstancesReleaseSsrsLeaseResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReleaseSsrsLeaseResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operationId != null && Object.hasOwnProperty.call(message, "operationId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.operationId); + return writer; + }; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReleaseSsrsLeaseResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReleaseSsrsLeaseResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.operationId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReleaseSsrsLeaseResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesReleaseSsrsLeaseResponse message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesReleaseSsrsLeaseResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operationId != null && message.hasOwnProperty("operationId")) + if (!$util.isString(message.operationId)) + return "operationId: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesReleaseSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse + */ + SqlInstancesReleaseSsrsLeaseResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse(); + if (object.operationId != null) + message.operationId = String(object.operationId); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesReleaseSsrsLeaseResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesReleaseSsrsLeaseResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.operationId = ""; + if (message.operationId != null && message.hasOwnProperty("operationId")) + object.operationId = message.operationId; + return object; + }; + + /** + * Converts this SqlInstancesReleaseSsrsLeaseResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesReleaseSsrsLeaseResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesReleaseSsrsLeaseResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesReleaseSsrsLeaseResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse"; + }; + + return SqlInstancesReleaseSsrsLeaseResponse; + })(); + + v1.SqlInstancesPointInTimeRestoreRequest = (function() { + + /** + * Properties of a SqlInstancesPointInTimeRestoreRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlInstancesPointInTimeRestoreRequest + * @property {string|null} [parent] SqlInstancesPointInTimeRestoreRequest parent + * @property {google.cloud.sql.v1.IPointInTimeRestoreContext|null} [context] SqlInstancesPointInTimeRestoreRequest context + */ + + /** + * Constructs a new SqlInstancesPointInTimeRestoreRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstancesPointInTimeRestoreRequest. + * @implements ISqlInstancesPointInTimeRestoreRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest=} [properties] Properties to set + */ + function SqlInstancesPointInTimeRestoreRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesPointInTimeRestoreRequest parent. + * @member {string} parent + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @instance + */ + SqlInstancesPointInTimeRestoreRequest.prototype.parent = ""; + + /** + * SqlInstancesPointInTimeRestoreRequest context. + * @member {google.cloud.sql.v1.IPointInTimeRestoreContext|null|undefined} context + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @instance + */ + SqlInstancesPointInTimeRestoreRequest.prototype.context = null; + + /** + * Creates a new SqlInstancesPointInTimeRestoreRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest instance + */ + SqlInstancesPointInTimeRestoreRequest.create = function create(properties) { + return new SqlInstancesPointInTimeRestoreRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesPointInTimeRestoreRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPointInTimeRestoreRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.context != null && Object.hasOwnProperty.call(message, "context")) + $root.google.cloud.sql.v1.PointInTimeRestoreContext.encode(message.context, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesPointInTimeRestoreRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPointInTimeRestoreRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPointInTimeRestoreRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 100: { + message.context = $root.google.cloud.sql.v1.PointInTimeRestoreContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPointInTimeRestoreRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesPointInTimeRestoreRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesPointInTimeRestoreRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.context != null && message.hasOwnProperty("context")) { + var error = $root.google.cloud.sql.v1.PointInTimeRestoreContext.verify(message.context); + if (error) + return "context." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesPointInTimeRestoreRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest + */ + SqlInstancesPointInTimeRestoreRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.context != null) { + if (typeof object.context !== "object") + throw TypeError(".google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest.context: object expected"); + message.context = $root.google.cloud.sql.v1.PointInTimeRestoreContext.fromObject(object.context); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesPointInTimeRestoreRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesPointInTimeRestoreRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.context = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.context != null && message.hasOwnProperty("context")) + object.context = $root.google.cloud.sql.v1.PointInTimeRestoreContext.toObject(message.context, options); + return object; + }; + + /** + * Converts this SqlInstancesPointInTimeRestoreRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesPointInTimeRestoreRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesPointInTimeRestoreRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesPointInTimeRestoreRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest"; + }; + + return SqlInstancesPointInTimeRestoreRequest; + })(); + + /** + * SqlInstanceType enum. + * @name google.cloud.sql.v1.SqlInstanceType + * @enum {number} + * @property {number} SQL_INSTANCE_TYPE_UNSPECIFIED=0 SQL_INSTANCE_TYPE_UNSPECIFIED value + * @property {number} CLOUD_SQL_INSTANCE=1 CLOUD_SQL_INSTANCE value + * @property {number} ON_PREMISES_INSTANCE=2 ON_PREMISES_INSTANCE value + * @property {number} READ_REPLICA_INSTANCE=3 READ_REPLICA_INSTANCE value + * @property {number} READ_POOL_INSTANCE=5 READ_POOL_INSTANCE value + */ + v1.SqlInstanceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_INSTANCE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLOUD_SQL_INSTANCE"] = 1; + values[valuesById[2] = "ON_PREMISES_INSTANCE"] = 2; + values[valuesById[3] = "READ_REPLICA_INSTANCE"] = 3; + values[valuesById[5] = "READ_POOL_INSTANCE"] = 5; + return values; + })(); + + /** + * SqlSuspensionReason enum. + * @name google.cloud.sql.v1.SqlSuspensionReason + * @enum {number} + * @property {number} SQL_SUSPENSION_REASON_UNSPECIFIED=0 SQL_SUSPENSION_REASON_UNSPECIFIED value + * @property {number} BILLING_ISSUE=2 BILLING_ISSUE value + * @property {number} LEGAL_ISSUE=3 LEGAL_ISSUE value + * @property {number} OPERATIONAL_ISSUE=4 OPERATIONAL_ISSUE value + * @property {number} KMS_KEY_ISSUE=5 KMS_KEY_ISSUE value + * @property {number} PROJECT_ABUSE=8 PROJECT_ABUSE value + */ + v1.SqlSuspensionReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_SUSPENSION_REASON_UNSPECIFIED"] = 0; + values[valuesById[2] = "BILLING_ISSUE"] = 2; + values[valuesById[3] = "LEGAL_ISSUE"] = 3; + values[valuesById[4] = "OPERATIONAL_ISSUE"] = 4; + values[valuesById[5] = "KMS_KEY_ISSUE"] = 5; + values[valuesById[8] = "PROJECT_ABUSE"] = 8; + return values; + })(); + + v1.SqlConnectService = (function() { + + /** + * Constructs a new SqlConnectService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlConnectService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlConnectService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlConnectService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlConnectService; + + /** + * Creates new SqlConnectService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlConnectService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlConnectService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlConnectService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlConnectService|getConnectSettings}. + * @memberof google.cloud.sql.v1.SqlConnectService + * @typedef GetConnectSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.ConnectSettings} [response] ConnectSettings + */ + + /** + * Calls GetConnectSettings. + * @function getConnectSettings + * @memberof google.cloud.sql.v1.SqlConnectService + * @instance + * @param {google.cloud.sql.v1.IGetConnectSettingsRequest} request GetConnectSettingsRequest message or plain object + * @param {google.cloud.sql.v1.SqlConnectService.GetConnectSettingsCallback} callback Node-style callback called with the error, if any, and ConnectSettings + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlConnectService.prototype.getConnectSettings = function getConnectSettings(request, callback) { + return this.rpcCall(getConnectSettings, $root.google.cloud.sql.v1.GetConnectSettingsRequest, $root.google.cloud.sql.v1.ConnectSettings, request, callback); + }, "name", { value: "GetConnectSettings" }); + + /** + * Calls GetConnectSettings. + * @function getConnectSettings + * @memberof google.cloud.sql.v1.SqlConnectService + * @instance + * @param {google.cloud.sql.v1.IGetConnectSettingsRequest} request GetConnectSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlConnectService|generateEphemeralCert}. + * @memberof google.cloud.sql.v1.SqlConnectService + * @typedef GenerateEphemeralCertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.GenerateEphemeralCertResponse} [response] GenerateEphemeralCertResponse + */ + + /** + * Calls GenerateEphemeralCert. + * @function generateEphemeralCert + * @memberof google.cloud.sql.v1.SqlConnectService + * @instance + * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest} request GenerateEphemeralCertRequest message or plain object + * @param {google.cloud.sql.v1.SqlConnectService.GenerateEphemeralCertCallback} callback Node-style callback called with the error, if any, and GenerateEphemeralCertResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlConnectService.prototype.generateEphemeralCert = function generateEphemeralCert(request, callback) { + return this.rpcCall(generateEphemeralCert, $root.google.cloud.sql.v1.GenerateEphemeralCertRequest, $root.google.cloud.sql.v1.GenerateEphemeralCertResponse, request, callback); + }, "name", { value: "GenerateEphemeralCert" }); + + /** + * Calls GenerateEphemeralCert. + * @function generateEphemeralCert + * @memberof google.cloud.sql.v1.SqlConnectService + * @instance + * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest} request GenerateEphemeralCertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlConnectService; + })(); + + v1.GetConnectSettingsRequest = (function() { + + /** + * Properties of a GetConnectSettingsRequest. + * @memberof google.cloud.sql.v1 + * @interface IGetConnectSettingsRequest + * @property {string|null} [instance] GetConnectSettingsRequest instance + * @property {string|null} [project] GetConnectSettingsRequest project + * @property {google.protobuf.ITimestamp|null} [readTime] GetConnectSettingsRequest readTime + */ + + /** + * Constructs a new GetConnectSettingsRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a GetConnectSettingsRequest. + * @implements IGetConnectSettingsRequest + * @constructor + * @param {google.cloud.sql.v1.IGetConnectSettingsRequest=} [properties] Properties to set + */ + function GetConnectSettingsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConnectSettingsRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @instance + */ + GetConnectSettingsRequest.prototype.instance = ""; + + /** + * GetConnectSettingsRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @instance + */ + GetConnectSettingsRequest.prototype.project = ""; + + /** + * GetConnectSettingsRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @instance + */ + GetConnectSettingsRequest.prototype.readTime = null; + + /** + * Creates a new GetConnectSettingsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @static + * @param {google.cloud.sql.v1.IGetConnectSettingsRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.GetConnectSettingsRequest} GetConnectSettingsRequest instance + */ + GetConnectSettingsRequest.create = function create(properties) { + return new GetConnectSettingsRequest(properties); + }; + + /** + * Encodes the specified GetConnectSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1.GetConnectSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @static + * @param {google.cloud.sql.v1.IGetConnectSettingsRequest} message GetConnectSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConnectSettingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetConnectSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GetConnectSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @static + * @param {google.cloud.sql.v1.IGetConnectSettingsRequest} message GetConnectSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConnectSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConnectSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.GetConnectSettingsRequest} GetConnectSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConnectSettingsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.GetConnectSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 7: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetConnectSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.GetConnectSettingsRequest} GetConnectSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConnectSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConnectSettingsRequest message. + * @function verify + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConnectSettingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.readTime != null && message.hasOwnProperty("readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime); + if (error) + return "readTime." + error; + } + return null; + }; + + /** + * Creates a GetConnectSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.GetConnectSettingsRequest} GetConnectSettingsRequest + */ + GetConnectSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.GetConnectSettingsRequest) + return object; + var message = new $root.google.cloud.sql.v1.GetConnectSettingsRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.readTime != null) { + if (typeof object.readTime !== "object") + throw TypeError(".google.cloud.sql.v1.GetConnectSettingsRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime); + } + return message; + }; + + /** + * Creates a plain object from a GetConnectSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @static + * @param {google.cloud.sql.v1.GetConnectSettingsRequest} message GetConnectSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConnectSettingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.readTime = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.readTime != null && message.hasOwnProperty("readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options); + return object; + }; + + /** + * Converts this GetConnectSettingsRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @instance + * @returns {Object.} JSON object + */ + GetConnectSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetConnectSettingsRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.GetConnectSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetConnectSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.GetConnectSettingsRequest"; + }; + + return GetConnectSettingsRequest; + })(); + + v1.ConnectSettings = (function() { + + /** + * Properties of a ConnectSettings. + * @memberof google.cloud.sql.v1 + * @interface IConnectSettings + * @property {string|null} [kind] ConnectSettings kind + * @property {google.cloud.sql.v1.ISslCert|null} [serverCaCert] ConnectSettings serverCaCert + * @property {Array.|null} [ipAddresses] ConnectSettings ipAddresses + * @property {string|null} [region] ConnectSettings region + * @property {google.cloud.sql.v1.SqlDatabaseVersion|null} [databaseVersion] ConnectSettings databaseVersion + * @property {google.cloud.sql.v1.SqlBackendType|null} [backendType] ConnectSettings backendType + * @property {boolean|null} [pscEnabled] ConnectSettings pscEnabled + * @property {string|null} [dnsName] ConnectSettings dnsName + * @property {google.cloud.sql.v1.ConnectSettings.CaMode|null} [serverCaMode] ConnectSettings serverCaMode + * @property {Array.|null} [customSubjectAlternativeNames] ConnectSettings customSubjectAlternativeNames + * @property {Array.|null} [dnsNames] ConnectSettings dnsNames + * @property {number|null} [nodeCount] ConnectSettings nodeCount + * @property {Array.|null} [nodes] ConnectSettings nodes + * @property {Array.|null} [mdxProtocolSupport] ConnectSettings mdxProtocolSupport + */ + + /** + * Constructs a new ConnectSettings. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a ConnectSettings. + * @implements IConnectSettings + * @constructor + * @param {google.cloud.sql.v1.IConnectSettings=} [properties] Properties to set + */ + function ConnectSettings(properties) { + this.ipAddresses = []; + this.customSubjectAlternativeNames = []; + this.dnsNames = []; + this.nodes = []; + this.mdxProtocolSupport = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectSettings kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.kind = ""; + + /** + * ConnectSettings serverCaCert. + * @member {google.cloud.sql.v1.ISslCert|null|undefined} serverCaCert + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.serverCaCert = null; + + /** + * ConnectSettings ipAddresses. + * @member {Array.} ipAddresses + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.ipAddresses = $util.emptyArray; + + /** + * ConnectSettings region. + * @member {string} region + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.region = ""; + + /** + * ConnectSettings databaseVersion. + * @member {google.cloud.sql.v1.SqlDatabaseVersion} databaseVersion + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.databaseVersion = 0; + + /** + * ConnectSettings backendType. + * @member {google.cloud.sql.v1.SqlBackendType} backendType + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.backendType = 0; + + /** + * ConnectSettings pscEnabled. + * @member {boolean} pscEnabled + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.pscEnabled = false; + + /** + * ConnectSettings dnsName. + * @member {string} dnsName + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.dnsName = ""; + + /** + * ConnectSettings serverCaMode. + * @member {google.cloud.sql.v1.ConnectSettings.CaMode} serverCaMode + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.serverCaMode = 0; + + /** + * ConnectSettings customSubjectAlternativeNames. + * @member {Array.} customSubjectAlternativeNames + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.customSubjectAlternativeNames = $util.emptyArray; + + /** + * ConnectSettings dnsNames. + * @member {Array.} dnsNames + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.dnsNames = $util.emptyArray; + + /** + * ConnectSettings nodeCount. + * @member {number|null|undefined} nodeCount + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.nodeCount = null; + + /** + * ConnectSettings nodes. + * @member {Array.} nodes + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.nodes = $util.emptyArray; + + /** + * ConnectSettings mdxProtocolSupport. + * @member {Array.} mdxProtocolSupport + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + */ + ConnectSettings.prototype.mdxProtocolSupport = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ConnectSettings.prototype, "_nodeCount", { + get: $util.oneOfGetter($oneOfFields = ["nodeCount"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ConnectSettings instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ConnectSettings + * @static + * @param {google.cloud.sql.v1.IConnectSettings=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ConnectSettings} ConnectSettings instance + */ + ConnectSettings.create = function create(properties) { + return new ConnectSettings(properties); + }; + + /** + * Encodes the specified ConnectSettings message. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ConnectSettings + * @static + * @param {google.cloud.sql.v1.IConnectSettings} message ConnectSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) + $root.google.cloud.sql.v1.SslCert.encode(message.serverCaCert, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.ipAddresses != null && message.ipAddresses.length) + for (var i = 0; i < message.ipAddresses.length; ++i) + $root.google.cloud.sql.v1.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.region); + if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.databaseVersion); + if (message.backendType != null && Object.hasOwnProperty.call(message, "backendType")) + writer.uint32(/* id 32, wireType 0 =*/256).int32(message.backendType); + if (message.pscEnabled != null && Object.hasOwnProperty.call(message, "pscEnabled")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.pscEnabled); + if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) + writer.uint32(/* id 34, wireType 2 =*/274).string(message.dnsName); + if (message.serverCaMode != null && Object.hasOwnProperty.call(message, "serverCaMode")) + writer.uint32(/* id 35, wireType 0 =*/280).int32(message.serverCaMode); + if (message.customSubjectAlternativeNames != null && message.customSubjectAlternativeNames.length) + for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.customSubjectAlternativeNames[i]); + if (message.dnsNames != null && message.dnsNames.length) + for (var i = 0; i < message.dnsNames.length; ++i) + $root.google.cloud.sql.v1.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim(); + if (message.mdxProtocolSupport != null && message.mdxProtocolSupport.length) { + writer.uint32(/* id 39, wireType 2 =*/314).fork(); + for (var i = 0; i < message.mdxProtocolSupport.length; ++i) + writer.int32(message.mdxProtocolSupport[i]); + writer.ldelim(); + } + if (message.nodeCount != null && Object.hasOwnProperty.call(message, "nodeCount")) + writer.uint32(/* id 63, wireType 0 =*/504).int32(message.nodeCount); + if (message.nodes != null && message.nodes.length) + for (var i = 0; i < message.nodes.length; ++i) + $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.encode(message.nodes[i], writer.uint32(/* id 64, wireType 2 =*/514).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConnectSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ConnectSettings + * @static + * @param {google.cloud.sql.v1.IConnectSettings} message ConnectSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ConnectSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ConnectSettings} ConnectSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ConnectSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.serverCaCert = $root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.ipAddresses && message.ipAddresses.length)) + message.ipAddresses = []; + message.ipAddresses.push($root.google.cloud.sql.v1.IpMapping.decode(reader, reader.uint32())); + break; + } + case 4: { + message.region = reader.string(); + break; + } + case 31: { + message.databaseVersion = reader.int32(); + break; + } + case 32: { + message.backendType = reader.int32(); + break; + } + case 33: { + message.pscEnabled = reader.bool(); + break; + } + case 34: { + message.dnsName = reader.string(); + break; + } + case 35: { + message.serverCaMode = reader.int32(); + break; + } + case 37: { + if (!(message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length)) + message.customSubjectAlternativeNames = []; + message.customSubjectAlternativeNames.push(reader.string()); + break; + } + case 38: { + if (!(message.dnsNames && message.dnsNames.length)) + message.dnsNames = []; + message.dnsNames.push($root.google.cloud.sql.v1.DnsNameMapping.decode(reader, reader.uint32())); + break; + } + case 63: { + message.nodeCount = reader.int32(); + break; + } + case 64: { + if (!(message.nodes && message.nodes.length)) + message.nodes = []; + message.nodes.push($root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.decode(reader, reader.uint32())); + break; + } + case 39: { + if (!(message.mdxProtocolSupport && message.mdxProtocolSupport.length)) + message.mdxProtocolSupport = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.mdxProtocolSupport.push(reader.int32()); + } else + message.mdxProtocolSupport.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ConnectSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ConnectSettings} ConnectSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectSettings message. + * @function verify + * @memberof google.cloud.sql.v1.ConnectSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { + var error = $root.google.cloud.sql.v1.SslCert.verify(message.serverCaCert); + if (error) + return "serverCaCert." + error; + } + if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { + if (!Array.isArray(message.ipAddresses)) + return "ipAddresses: array expected"; + for (var i = 0; i < message.ipAddresses.length; ++i) { + var error = $root.google.cloud.sql.v1.IpMapping.verify(message.ipAddresses[i]); + if (error) + return "ipAddresses." + error; + } + } + if (message.region != null && message.hasOwnProperty("region")) + if (!$util.isString(message.region)) + return "region: string expected"; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + switch (message.databaseVersion) { + default: + return "databaseVersion: enum value expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 684: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + case 549: + case 550: + case 551: + break; + } + if (message.backendType != null && message.hasOwnProperty("backendType")) + switch (message.backendType) { + default: + return "backendType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) + if (typeof message.pscEnabled !== "boolean") + return "pscEnabled: boolean expected"; + if (message.dnsName != null && message.hasOwnProperty("dnsName")) + if (!$util.isString(message.dnsName)) + return "dnsName: string expected"; + if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) + switch (message.serverCaMode) { + default: + return "serverCaMode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.customSubjectAlternativeNames != null && message.hasOwnProperty("customSubjectAlternativeNames")) { + if (!Array.isArray(message.customSubjectAlternativeNames)) + return "customSubjectAlternativeNames: array expected"; + for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) + if (!$util.isString(message.customSubjectAlternativeNames[i])) + return "customSubjectAlternativeNames: string[] expected"; + } + if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { + if (!Array.isArray(message.dnsNames)) + return "dnsNames: array expected"; + for (var i = 0; i < message.dnsNames.length; ++i) { + var error = $root.google.cloud.sql.v1.DnsNameMapping.verify(message.dnsNames[i]); + if (error) + return "dnsNames." + error; + } + } + if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { + properties._nodeCount = 1; + if (!$util.isInteger(message.nodeCount)) + return "nodeCount: integer expected"; + } + if (message.nodes != null && message.hasOwnProperty("nodes")) { + if (!Array.isArray(message.nodes)) + return "nodes: array expected"; + for (var i = 0; i < message.nodes.length; ++i) { + var error = $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.verify(message.nodes[i]); + if (error) + return "nodes." + error; + } + } + if (message.mdxProtocolSupport != null && message.hasOwnProperty("mdxProtocolSupport")) { + if (!Array.isArray(message.mdxProtocolSupport)) + return "mdxProtocolSupport: array expected"; + for (var i = 0; i < message.mdxProtocolSupport.length; ++i) + switch (message.mdxProtocolSupport[i]) { + default: + return "mdxProtocolSupport: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ConnectSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ConnectSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ConnectSettings} ConnectSettings + */ + ConnectSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ConnectSettings) + return object; + var message = new $root.google.cloud.sql.v1.ConnectSettings(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.serverCaCert != null) { + if (typeof object.serverCaCert !== "object") + throw TypeError(".google.cloud.sql.v1.ConnectSettings.serverCaCert: object expected"); + message.serverCaCert = $root.google.cloud.sql.v1.SslCert.fromObject(object.serverCaCert); + } + if (object.ipAddresses) { + if (!Array.isArray(object.ipAddresses)) + throw TypeError(".google.cloud.sql.v1.ConnectSettings.ipAddresses: array expected"); + message.ipAddresses = []; + for (var i = 0; i < object.ipAddresses.length; ++i) { + if (typeof object.ipAddresses[i] !== "object") + throw TypeError(".google.cloud.sql.v1.ConnectSettings.ipAddresses: object expected"); + message.ipAddresses[i] = $root.google.cloud.sql.v1.IpMapping.fromObject(object.ipAddresses[i]); + } + } + if (object.region != null) + message.region = String(object.region); + switch (object.databaseVersion) { + default: + if (typeof object.databaseVersion === "number") { + message.databaseVersion = object.databaseVersion; + break; + } + break; + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.databaseVersion = 0; + break; + case "MYSQL_5_1": + case 2: + message.databaseVersion = 2; + break; + case "MYSQL_5_5": + case 3: + message.databaseVersion = 3; + break; + case "MYSQL_5_6": + case 5: + message.databaseVersion = 5; + break; + case "MYSQL_5_7": + case 6: + message.databaseVersion = 6; + break; + case "MYSQL_8_0": + case 20: + message.databaseVersion = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.databaseVersion = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.databaseVersion = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.databaseVersion = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.databaseVersion = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.databaseVersion = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.databaseVersion = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.databaseVersion = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.databaseVersion = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.databaseVersion = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.databaseVersion = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.databaseVersion = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.databaseVersion = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.databaseVersion = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.databaseVersion = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.databaseVersion = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.databaseVersion = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.databaseVersion = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.databaseVersion = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.databaseVersion = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.databaseVersion = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.databaseVersion = 556; + break; + case "MYSQL_8_4": + case 398: + message.databaseVersion = 398; + break; + case "MYSQL_9_7": + case 654: + message.databaseVersion = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.databaseVersion = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.databaseVersion = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.databaseVersion = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.databaseVersion = 16; + break; + case "POSTGRES_9_6": + case 9: + message.databaseVersion = 9; + break; + case "POSTGRES_10": + case 18: + message.databaseVersion = 18; + break; + case "POSTGRES_11": + case 10: + message.databaseVersion = 10; + break; + case "POSTGRES_12": + case 19: + message.databaseVersion = 19; + break; + case "POSTGRES_13": + case 23: + message.databaseVersion = 23; + break; + case "POSTGRES_14": + case 110: + message.databaseVersion = 110; + break; + case "POSTGRES_15": + case 172: + message.databaseVersion = 172; + break; + case "POSTGRES_16": + case 272: + message.databaseVersion = 272; + break; + case "POSTGRES_17": + case 408: + message.databaseVersion = 408; + break; + case "POSTGRES_18": + case 557: + message.databaseVersion = 557; + break; + case "POSTGRES_19": + case 684: + message.databaseVersion = 684; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.databaseVersion = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.databaseVersion = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.databaseVersion = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.databaseVersion = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.databaseVersion = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.databaseVersion = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.databaseVersion = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.databaseVersion = 202; + break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.databaseVersion = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.databaseVersion = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.databaseVersion = 551; + break; + } + switch (object.backendType) { + default: + if (typeof object.backendType === "number") { + message.backendType = object.backendType; + break; + } + break; + case "SQL_BACKEND_TYPE_UNSPECIFIED": + case 0: + message.backendType = 0; + break; + case "FIRST_GEN": + case 1: + message.backendType = 1; + break; + case "SECOND_GEN": + case 2: + message.backendType = 2; + break; + case "EXTERNAL": + case 3: + message.backendType = 3; + break; + } + if (object.pscEnabled != null) + message.pscEnabled = Boolean(object.pscEnabled); + if (object.dnsName != null) + message.dnsName = String(object.dnsName); + switch (object.serverCaMode) { + default: + if (typeof object.serverCaMode === "number") { + message.serverCaMode = object.serverCaMode; + break; + } + break; + case "CA_MODE_UNSPECIFIED": + case 0: + message.serverCaMode = 0; + break; + case "GOOGLE_MANAGED_INTERNAL_CA": + case 1: + message.serverCaMode = 1; + break; + case "GOOGLE_MANAGED_CAS_CA": + case 2: + message.serverCaMode = 2; + break; + case "CUSTOMER_MANAGED_CAS_CA": + case 3: + message.serverCaMode = 3; + break; + } + if (object.customSubjectAlternativeNames) { + if (!Array.isArray(object.customSubjectAlternativeNames)) + throw TypeError(".google.cloud.sql.v1.ConnectSettings.customSubjectAlternativeNames: array expected"); + message.customSubjectAlternativeNames = []; + for (var i = 0; i < object.customSubjectAlternativeNames.length; ++i) + message.customSubjectAlternativeNames[i] = String(object.customSubjectAlternativeNames[i]); + } + if (object.dnsNames) { + if (!Array.isArray(object.dnsNames)) + throw TypeError(".google.cloud.sql.v1.ConnectSettings.dnsNames: array expected"); + message.dnsNames = []; + for (var i = 0; i < object.dnsNames.length; ++i) { + if (typeof object.dnsNames[i] !== "object") + throw TypeError(".google.cloud.sql.v1.ConnectSettings.dnsNames: object expected"); + message.dnsNames[i] = $root.google.cloud.sql.v1.DnsNameMapping.fromObject(object.dnsNames[i]); + } + } + if (object.nodeCount != null) + message.nodeCount = object.nodeCount | 0; + if (object.nodes) { + if (!Array.isArray(object.nodes)) + throw TypeError(".google.cloud.sql.v1.ConnectSettings.nodes: array expected"); + message.nodes = []; + for (var i = 0; i < object.nodes.length; ++i) { + if (typeof object.nodes[i] !== "object") + throw TypeError(".google.cloud.sql.v1.ConnectSettings.nodes: object expected"); + message.nodes[i] = $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.fromObject(object.nodes[i]); + } + } + if (object.mdxProtocolSupport) { + if (!Array.isArray(object.mdxProtocolSupport)) + throw TypeError(".google.cloud.sql.v1.ConnectSettings.mdxProtocolSupport: array expected"); + message.mdxProtocolSupport = []; + for (var i = 0; i < object.mdxProtocolSupport.length; ++i) + switch (object.mdxProtocolSupport[i]) { + default: + if (typeof object.mdxProtocolSupport[i] === "number") { + message.mdxProtocolSupport[i] = object.mdxProtocolSupport[i]; + break; + } + case "MDX_PROTOCOL_SUPPORT_UNSPECIFIED": + case 0: + message.mdxProtocolSupport[i] = 0; + break; + case "CLIENT_PROTOCOL_TYPE": + case 1: + message.mdxProtocolSupport[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ConnectSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ConnectSettings + * @static + * @param {google.cloud.sql.v1.ConnectSettings} message ConnectSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.ipAddresses = []; + object.customSubjectAlternativeNames = []; + object.dnsNames = []; + object.mdxProtocolSupport = []; + object.nodes = []; + } + if (options.defaults) { + object.kind = ""; + object.serverCaCert = null; + object.region = ""; + object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; + object.backendType = options.enums === String ? "SQL_BACKEND_TYPE_UNSPECIFIED" : 0; + object.pscEnabled = false; + object.dnsName = ""; + object.serverCaMode = options.enums === String ? "CA_MODE_UNSPECIFIED" : 0; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) + object.serverCaCert = $root.google.cloud.sql.v1.SslCert.toObject(message.serverCaCert, options); + if (message.ipAddresses && message.ipAddresses.length) { + object.ipAddresses = []; + for (var j = 0; j < message.ipAddresses.length; ++j) + object.ipAddresses[j] = $root.google.cloud.sql.v1.IpMapping.toObject(message.ipAddresses[j], options); + } + if (message.region != null && message.hasOwnProperty("region")) + object.region = message.region; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; + if (message.backendType != null && message.hasOwnProperty("backendType")) + object.backendType = options.enums === String ? $root.google.cloud.sql.v1.SqlBackendType[message.backendType] === undefined ? message.backendType : $root.google.cloud.sql.v1.SqlBackendType[message.backendType] : message.backendType; + if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) + object.pscEnabled = message.pscEnabled; + if (message.dnsName != null && message.hasOwnProperty("dnsName")) + object.dnsName = message.dnsName; + if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) + object.serverCaMode = options.enums === String ? $root.google.cloud.sql.v1.ConnectSettings.CaMode[message.serverCaMode] === undefined ? message.serverCaMode : $root.google.cloud.sql.v1.ConnectSettings.CaMode[message.serverCaMode] : message.serverCaMode; + if (message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length) { + object.customSubjectAlternativeNames = []; + for (var j = 0; j < message.customSubjectAlternativeNames.length; ++j) + object.customSubjectAlternativeNames[j] = message.customSubjectAlternativeNames[j]; + } + if (message.dnsNames && message.dnsNames.length) { + object.dnsNames = []; + for (var j = 0; j < message.dnsNames.length; ++j) + object.dnsNames[j] = $root.google.cloud.sql.v1.DnsNameMapping.toObject(message.dnsNames[j], options); + } + if (message.mdxProtocolSupport && message.mdxProtocolSupport.length) { + object.mdxProtocolSupport = []; + for (var j = 0; j < message.mdxProtocolSupport.length; ++j) + object.mdxProtocolSupport[j] = options.enums === String ? $root.google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport[message.mdxProtocolSupport[j]] === undefined ? message.mdxProtocolSupport[j] : $root.google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport[message.mdxProtocolSupport[j]] : message.mdxProtocolSupport[j]; + } + if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { + object.nodeCount = message.nodeCount; + if (options.oneofs) + object._nodeCount = "nodeCount"; + } + if (message.nodes && message.nodes.length) { + object.nodes = []; + for (var j = 0; j < message.nodes.length; ++j) + object.nodes[j] = $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.toObject(message.nodes[j], options); + } + return object; + }; + + /** + * Converts this ConnectSettings to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ConnectSettings + * @instance + * @returns {Object.} JSON object + */ + ConnectSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConnectSettings + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ConnectSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConnectSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ConnectSettings"; + }; + + /** + * CaMode enum. + * @name google.cloud.sql.v1.ConnectSettings.CaMode + * @enum {number} + * @property {number} CA_MODE_UNSPECIFIED=0 CA_MODE_UNSPECIFIED value + * @property {number} GOOGLE_MANAGED_INTERNAL_CA=1 GOOGLE_MANAGED_INTERNAL_CA value + * @property {number} GOOGLE_MANAGED_CAS_CA=2 GOOGLE_MANAGED_CAS_CA value + * @property {number} CUSTOMER_MANAGED_CAS_CA=3 CUSTOMER_MANAGED_CAS_CA value + */ + ConnectSettings.CaMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CA_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "GOOGLE_MANAGED_INTERNAL_CA"] = 1; + values[valuesById[2] = "GOOGLE_MANAGED_CAS_CA"] = 2; + values[valuesById[3] = "CUSTOMER_MANAGED_CAS_CA"] = 3; + return values; + })(); + + ConnectSettings.ConnectPoolNodeConfig = (function() { + + /** + * Properties of a ConnectPoolNodeConfig. + * @memberof google.cloud.sql.v1.ConnectSettings + * @interface IConnectPoolNodeConfig + * @property {string|null} [name] ConnectPoolNodeConfig name + * @property {Array.|null} [ipAddresses] ConnectPoolNodeConfig ipAddresses + * @property {string|null} [dnsName] ConnectPoolNodeConfig dnsName + * @property {Array.|null} [dnsNames] ConnectPoolNodeConfig dnsNames + */ + + /** + * Constructs a new ConnectPoolNodeConfig. + * @memberof google.cloud.sql.v1.ConnectSettings + * @classdesc Represents a ConnectPoolNodeConfig. + * @implements IConnectPoolNodeConfig + * @constructor + * @param {google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig=} [properties] Properties to set + */ + function ConnectPoolNodeConfig(properties) { + this.ipAddresses = []; + this.dnsNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectPoolNodeConfig name. + * @member {string|null|undefined} name + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @instance + */ + ConnectPoolNodeConfig.prototype.name = null; + + /** + * ConnectPoolNodeConfig ipAddresses. + * @member {Array.} ipAddresses + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @instance + */ + ConnectPoolNodeConfig.prototype.ipAddresses = $util.emptyArray; + + /** + * ConnectPoolNodeConfig dnsName. + * @member {string|null|undefined} dnsName + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @instance + */ + ConnectPoolNodeConfig.prototype.dnsName = null; + + /** + * ConnectPoolNodeConfig dnsNames. + * @member {Array.} dnsNames + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @instance + */ + ConnectPoolNodeConfig.prototype.dnsNames = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ConnectPoolNodeConfig.prototype, "_name", { + get: $util.oneOfGetter($oneOfFields = ["name"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ConnectPoolNodeConfig.prototype, "_dnsName", { + get: $util.oneOfGetter($oneOfFields = ["dnsName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ConnectPoolNodeConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig instance + */ + ConnectPoolNodeConfig.create = function create(properties) { + return new ConnectPoolNodeConfig(properties); + }; + + /** + * Encodes the specified ConnectPoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig} message ConnectPoolNodeConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectPoolNodeConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.ipAddresses != null && message.ipAddresses.length) + for (var i = 0; i < message.ipAddresses.length; ++i) + $root.google.cloud.sql.v1.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dnsName); + if (message.dnsNames != null && message.dnsNames.length) + for (var i = 0; i < message.dnsNames.length; ++i) + $root.google.cloud.sql.v1.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConnectPoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig} message ConnectPoolNodeConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectPoolNodeConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectPoolNodeConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.ipAddresses && message.ipAddresses.length)) + message.ipAddresses = []; + message.ipAddresses.push($root.google.cloud.sql.v1.IpMapping.decode(reader, reader.uint32())); + break; + } + case 3: { + message.dnsName = reader.string(); + break; + } + case 4: { + if (!(message.dnsNames && message.dnsNames.length)) + message.dnsNames = []; + message.dnsNames.push($root.google.cloud.sql.v1.DnsNameMapping.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectPoolNodeConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectPoolNodeConfig message. + * @function verify + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectPoolNodeConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) { + properties._name = 1; + if (!$util.isString(message.name)) + return "name: string expected"; + } + if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { + if (!Array.isArray(message.ipAddresses)) + return "ipAddresses: array expected"; + for (var i = 0; i < message.ipAddresses.length; ++i) { + var error = $root.google.cloud.sql.v1.IpMapping.verify(message.ipAddresses[i]); + if (error) + return "ipAddresses." + error; + } + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + properties._dnsName = 1; + if (!$util.isString(message.dnsName)) + return "dnsName: string expected"; + } + if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { + if (!Array.isArray(message.dnsNames)) + return "dnsNames: array expected"; + for (var i = 0; i < message.dnsNames.length; ++i) { + var error = $root.google.cloud.sql.v1.DnsNameMapping.verify(message.dnsNames[i]); + if (error) + return "dnsNames." + error; + } + } + return null; + }; + + /** + * Creates a ConnectPoolNodeConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig + */ + ConnectPoolNodeConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig) + return object; + var message = new $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.ipAddresses) { + if (!Array.isArray(object.ipAddresses)) + throw TypeError(".google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.ipAddresses: array expected"); + message.ipAddresses = []; + for (var i = 0; i < object.ipAddresses.length; ++i) { + if (typeof object.ipAddresses[i] !== "object") + throw TypeError(".google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.ipAddresses: object expected"); + message.ipAddresses[i] = $root.google.cloud.sql.v1.IpMapping.fromObject(object.ipAddresses[i]); + } + } + if (object.dnsName != null) + message.dnsName = String(object.dnsName); + if (object.dnsNames) { + if (!Array.isArray(object.dnsNames)) + throw TypeError(".google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.dnsNames: array expected"); + message.dnsNames = []; + for (var i = 0; i < object.dnsNames.length; ++i) { + if (typeof object.dnsNames[i] !== "object") + throw TypeError(".google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.dnsNames: object expected"); + message.dnsNames[i] = $root.google.cloud.sql.v1.DnsNameMapping.fromObject(object.dnsNames[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ConnectPoolNodeConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig} message ConnectPoolNodeConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectPoolNodeConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.ipAddresses = []; + object.dnsNames = []; + } + if (message.name != null && message.hasOwnProperty("name")) { + object.name = message.name; + if (options.oneofs) + object._name = "name"; + } + if (message.ipAddresses && message.ipAddresses.length) { + object.ipAddresses = []; + for (var j = 0; j < message.ipAddresses.length; ++j) + object.ipAddresses[j] = $root.google.cloud.sql.v1.IpMapping.toObject(message.ipAddresses[j], options); + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + object.dnsName = message.dnsName; + if (options.oneofs) + object._dnsName = "dnsName"; + } + if (message.dnsNames && message.dnsNames.length) { + object.dnsNames = []; + for (var j = 0; j < message.dnsNames.length; ++j) + object.dnsNames[j] = $root.google.cloud.sql.v1.DnsNameMapping.toObject(message.dnsNames[j], options); + } + return object; + }; + + /** + * Converts this ConnectPoolNodeConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @instance + * @returns {Object.} JSON object + */ + ConnectPoolNodeConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConnectPoolNodeConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConnectPoolNodeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig"; + }; + + return ConnectPoolNodeConfig; + })(); + + /** + * MdxProtocolSupport enum. + * @name google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport + * @enum {number} + * @property {number} MDX_PROTOCOL_SUPPORT_UNSPECIFIED=0 MDX_PROTOCOL_SUPPORT_UNSPECIFIED value + * @property {number} CLIENT_PROTOCOL_TYPE=1 CLIENT_PROTOCOL_TYPE value + */ + ConnectSettings.MdxProtocolSupport = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MDX_PROTOCOL_SUPPORT_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLIENT_PROTOCOL_TYPE"] = 1; + return values; + })(); + + return ConnectSettings; + })(); + + v1.GenerateEphemeralCertRequest = (function() { + + /** + * Properties of a GenerateEphemeralCertRequest. + * @memberof google.cloud.sql.v1 + * @interface IGenerateEphemeralCertRequest + * @property {string|null} [instance] GenerateEphemeralCertRequest instance + * @property {string|null} [project] GenerateEphemeralCertRequest project + * @property {string|null} [publicKey] GenerateEphemeralCertRequest publicKey + * @property {string|null} [accessToken] GenerateEphemeralCertRequest accessToken + * @property {google.protobuf.ITimestamp|null} [readTime] GenerateEphemeralCertRequest readTime + * @property {google.protobuf.IDuration|null} [validDuration] GenerateEphemeralCertRequest validDuration + */ + + /** + * Constructs a new GenerateEphemeralCertRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a GenerateEphemeralCertRequest. + * @implements IGenerateEphemeralCertRequest + * @constructor + * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest=} [properties] Properties to set + */ + function GenerateEphemeralCertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateEphemeralCertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.instance = ""; + + /** + * GenerateEphemeralCertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.project = ""; + + /** + * GenerateEphemeralCertRequest publicKey. + * @member {string} publicKey + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.publicKey = ""; + + /** + * GenerateEphemeralCertRequest accessToken. + * @member {string} accessToken + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.accessToken = ""; + + /** + * GenerateEphemeralCertRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.readTime = null; + + /** + * GenerateEphemeralCertRequest validDuration. + * @member {google.protobuf.IDuration|null|undefined} validDuration + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.validDuration = null; + + /** + * Creates a new GenerateEphemeralCertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest instance + */ + GenerateEphemeralCertRequest.create = function create(properties) { + return new GenerateEphemeralCertRequest(properties); + }; + + /** + * Encodes the specified GenerateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest} message GenerateEphemeralCertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateEphemeralCertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.publicKey); + if (message.accessToken != null && Object.hasOwnProperty.call(message, "accessToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.accessToken); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.validDuration != null && Object.hasOwnProperty.call(message, "validDuration")) + $root.google.protobuf.Duration.encode(message.validDuration, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest} message GenerateEphemeralCertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateEphemeralCertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateEphemeralCertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.GenerateEphemeralCertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.publicKey = reader.string(); + break; + } + case 4: { + message.accessToken = reader.string(); + break; + } + case 7: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 12: { + message.validDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateEphemeralCertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateEphemeralCertRequest message. + * @function verify + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateEphemeralCertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + if (!$util.isString(message.publicKey)) + return "publicKey: string expected"; + if (message.accessToken != null && message.hasOwnProperty("accessToken")) + if (!$util.isString(message.accessToken)) + return "accessToken: string expected"; + if (message.readTime != null && message.hasOwnProperty("readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime); + if (error) + return "readTime." + error; + } + if (message.validDuration != null && message.hasOwnProperty("validDuration")) { + var error = $root.google.protobuf.Duration.verify(message.validDuration); + if (error) + return "validDuration." + error; + } + return null; + }; + + /** + * Creates a GenerateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest + */ + GenerateEphemeralCertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.GenerateEphemeralCertRequest) + return object; + var message = new $root.google.cloud.sql.v1.GenerateEphemeralCertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.publicKey != null) + message.publicKey = String(object.publicKey); + if (object.accessToken != null) + message.accessToken = String(object.accessToken); + if (object.readTime != null) { + if (typeof object.readTime !== "object") + throw TypeError(".google.cloud.sql.v1.GenerateEphemeralCertRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime); + } + if (object.validDuration != null) { + if (typeof object.validDuration !== "object") + throw TypeError(".google.cloud.sql.v1.GenerateEphemeralCertRequest.validDuration: object expected"); + message.validDuration = $root.google.protobuf.Duration.fromObject(object.validDuration); + } + return message; + }; + + /** + * Creates a plain object from a GenerateEphemeralCertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1.GenerateEphemeralCertRequest} message GenerateEphemeralCertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateEphemeralCertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.publicKey = ""; + object.accessToken = ""; + object.readTime = null; + object.validDuration = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + object.publicKey = message.publicKey; + if (message.accessToken != null && message.hasOwnProperty("accessToken")) + object.accessToken = message.accessToken; + if (message.readTime != null && message.hasOwnProperty("readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options); + if (message.validDuration != null && message.hasOwnProperty("validDuration")) + object.validDuration = $root.google.protobuf.Duration.toObject(message.validDuration, options); + return object; + }; + + /** + * Converts this GenerateEphemeralCertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateEphemeralCertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GenerateEphemeralCertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateEphemeralCertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.GenerateEphemeralCertRequest"; + }; + + return GenerateEphemeralCertRequest; + })(); + + v1.GenerateEphemeralCertResponse = (function() { + + /** + * Properties of a GenerateEphemeralCertResponse. + * @memberof google.cloud.sql.v1 + * @interface IGenerateEphemeralCertResponse + * @property {google.cloud.sql.v1.ISslCert|null} [ephemeralCert] GenerateEphemeralCertResponse ephemeralCert + */ + + /** + * Constructs a new GenerateEphemeralCertResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a GenerateEphemeralCertResponse. + * @implements IGenerateEphemeralCertResponse + * @constructor + * @param {google.cloud.sql.v1.IGenerateEphemeralCertResponse=} [properties] Properties to set + */ + function GenerateEphemeralCertResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateEphemeralCertResponse ephemeralCert. + * @member {google.cloud.sql.v1.ISslCert|null|undefined} ephemeralCert + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @instance + */ + GenerateEphemeralCertResponse.prototype.ephemeralCert = null; + + /** + * Creates a new GenerateEphemeralCertResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @static + * @param {google.cloud.sql.v1.IGenerateEphemeralCertResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse instance + */ + GenerateEphemeralCertResponse.create = function create(properties) { + return new GenerateEphemeralCertResponse(properties); + }; + + /** + * Encodes the specified GenerateEphemeralCertResponse message. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @static + * @param {google.cloud.sql.v1.IGenerateEphemeralCertResponse} message GenerateEphemeralCertResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateEphemeralCertResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ephemeralCert != null && Object.hasOwnProperty.call(message, "ephemeralCert")) + $root.google.cloud.sql.v1.SslCert.encode(message.ephemeralCert, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateEphemeralCertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @static + * @param {google.cloud.sql.v1.IGenerateEphemeralCertResponse} message GenerateEphemeralCertResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateEphemeralCertResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateEphemeralCertResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.GenerateEphemeralCertResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.ephemeralCert = $root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateEphemeralCertResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateEphemeralCertResponse message. + * @function verify + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateEphemeralCertResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ephemeralCert != null && message.hasOwnProperty("ephemeralCert")) { + var error = $root.google.cloud.sql.v1.SslCert.verify(message.ephemeralCert); + if (error) + return "ephemeralCert." + error; + } + return null; + }; + + /** + * Creates a GenerateEphemeralCertResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse + */ + GenerateEphemeralCertResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.GenerateEphemeralCertResponse) + return object; + var message = new $root.google.cloud.sql.v1.GenerateEphemeralCertResponse(); + if (object.ephemeralCert != null) { + if (typeof object.ephemeralCert !== "object") + throw TypeError(".google.cloud.sql.v1.GenerateEphemeralCertResponse.ephemeralCert: object expected"); + message.ephemeralCert = $root.google.cloud.sql.v1.SslCert.fromObject(object.ephemeralCert); + } + return message; + }; + + /** + * Creates a plain object from a GenerateEphemeralCertResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @static + * @param {google.cloud.sql.v1.GenerateEphemeralCertResponse} message GenerateEphemeralCertResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateEphemeralCertResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.ephemeralCert = null; + if (message.ephemeralCert != null && message.hasOwnProperty("ephemeralCert")) + object.ephemeralCert = $root.google.cloud.sql.v1.SslCert.toObject(message.ephemeralCert, options); + return object; + }; + + /** + * Converts this GenerateEphemeralCertResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateEphemeralCertResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GenerateEphemeralCertResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateEphemeralCertResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.GenerateEphemeralCertResponse"; + }; + + return GenerateEphemeralCertResponse; + })(); + + v1.SqlDatabasesService = (function() { + + /** + * Constructs a new SqlDatabasesService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlDatabasesService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlDatabasesService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlDatabasesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlDatabasesService; + + /** + * Creates new SqlDatabasesService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlDatabasesService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlDatabasesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|delete_}. + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @typedef DeleteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest} request SqlDatabasesDeleteRequest message or plain object + * @param {google.cloud.sql.v1.SqlDatabasesService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype["delete"] = function delete_(request, callback) { + return this.rpcCall(delete_, $root.google.cloud.sql.v1.SqlDatabasesDeleteRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Delete" }); + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest} request SqlDatabasesDeleteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|get}. + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Database} [response] Database + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest} request SqlDatabasesGetRequest message or plain object + * @param {google.cloud.sql.v1.SqlDatabasesService.GetCallback} callback Node-style callback called with the error, if any, and Database + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1.SqlDatabasesGetRequest, $root.google.cloud.sql.v1.Database, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest} request SqlDatabasesGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|insert}. + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @typedef InsertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest} request SqlDatabasesInsertRequest message or plain object + * @param {google.cloud.sql.v1.SqlDatabasesService.InsertCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype.insert = function insert(request, callback) { + return this.rpcCall(insert, $root.google.cloud.sql.v1.SqlDatabasesInsertRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Insert" }); + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest} request SqlDatabasesInsertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|list}. + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.DatabasesListResponse} [response] DatabasesListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesListRequest} request SqlDatabasesListRequest message or plain object + * @param {google.cloud.sql.v1.SqlDatabasesService.ListCallback} callback Node-style callback called with the error, if any, and DatabasesListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1.SqlDatabasesListRequest, $root.google.cloud.sql.v1.DatabasesListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesListRequest} request SqlDatabasesListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|patch}. + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @typedef PatchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Patch. + * @function patch + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object + * @param {google.cloud.sql.v1.SqlDatabasesService.PatchCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype.patch = function patch(request, callback) { + return this.rpcCall(patch, $root.google.cloud.sql.v1.SqlDatabasesUpdateRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Patch" }); + + /** + * Calls Patch. + * @function patch + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|update}. + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @typedef UpdateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object + * @param {google.cloud.sql.v1.SqlDatabasesService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype.update = function update(request, callback) { + return this.rpcCall(update, $root.google.cloud.sql.v1.SqlDatabasesUpdateRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Update" }); + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlDatabasesService; + })(); + + v1.SqlDatabasesDeleteRequest = (function() { + + /** + * Properties of a SqlDatabasesDeleteRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlDatabasesDeleteRequest + * @property {string|null} [database] SqlDatabasesDeleteRequest database + * @property {string|null} [instance] SqlDatabasesDeleteRequest instance + * @property {string|null} [project] SqlDatabasesDeleteRequest project + */ + + /** + * Constructs a new SqlDatabasesDeleteRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlDatabasesDeleteRequest. + * @implements ISqlDatabasesDeleteRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest=} [properties] Properties to set + */ + function SqlDatabasesDeleteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlDatabasesDeleteRequest database. + * @member {string} database + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @instance + */ + SqlDatabasesDeleteRequest.prototype.database = ""; + + /** + * SqlDatabasesDeleteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @instance + */ + SqlDatabasesDeleteRequest.prototype.instance = ""; + + /** + * SqlDatabasesDeleteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @instance + */ + SqlDatabasesDeleteRequest.prototype.project = ""; + + /** + * Creates a new SqlDatabasesDeleteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest instance + */ + SqlDatabasesDeleteRequest.create = function create(properties) { + return new SqlDatabasesDeleteRequest(properties); + }; + + /** + * Encodes the specified SqlDatabasesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesDeleteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesDeleteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlDatabasesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesDeleteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesDeleteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlDatabasesDeleteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesDeleteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlDatabasesDeleteRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlDatabasesDeleteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlDatabasesDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest + */ + SqlDatabasesDeleteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlDatabasesDeleteRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlDatabasesDeleteRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlDatabasesDeleteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @static + * @param {google.cloud.sql.v1.SqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlDatabasesDeleteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.database = ""; + object.instance = ""; + object.project = ""; + } + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlDatabasesDeleteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlDatabasesDeleteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlDatabasesDeleteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlDatabasesDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlDatabasesDeleteRequest"; + }; + + return SqlDatabasesDeleteRequest; + })(); + + v1.SqlDatabasesGetRequest = (function() { + + /** + * Properties of a SqlDatabasesGetRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlDatabasesGetRequest + * @property {string|null} [database] SqlDatabasesGetRequest database + * @property {string|null} [instance] SqlDatabasesGetRequest instance + * @property {string|null} [project] SqlDatabasesGetRequest project + */ + + /** + * Constructs a new SqlDatabasesGetRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlDatabasesGetRequest. + * @implements ISqlDatabasesGetRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest=} [properties] Properties to set + */ + function SqlDatabasesGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlDatabasesGetRequest database. + * @member {string} database + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @instance + */ + SqlDatabasesGetRequest.prototype.database = ""; + + /** + * SqlDatabasesGetRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @instance + */ + SqlDatabasesGetRequest.prototype.instance = ""; + + /** + * SqlDatabasesGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @instance + */ + SqlDatabasesGetRequest.prototype.project = ""; + + /** + * Creates a new SqlDatabasesGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlDatabasesGetRequest} SqlDatabasesGetRequest instance + */ + SqlDatabasesGetRequest.create = function create(properties) { + return new SqlDatabasesGetRequest(properties); + }; + + /** + * Encodes the specified SqlDatabasesGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest} message SqlDatabasesGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlDatabasesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest} message SqlDatabasesGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlDatabasesGetRequest} SqlDatabasesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlDatabasesGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlDatabasesGetRequest} SqlDatabasesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlDatabasesGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlDatabasesGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlDatabasesGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlDatabasesGetRequest} SqlDatabasesGetRequest + */ + SqlDatabasesGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlDatabasesGetRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlDatabasesGetRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlDatabasesGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @static + * @param {google.cloud.sql.v1.SqlDatabasesGetRequest} message SqlDatabasesGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlDatabasesGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.database = ""; + object.instance = ""; + object.project = ""; + } + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlDatabasesGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlDatabasesGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlDatabasesGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlDatabasesGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlDatabasesGetRequest"; + }; + + return SqlDatabasesGetRequest; + })(); + + v1.SqlDatabasesInsertRequest = (function() { + + /** + * Properties of a SqlDatabasesInsertRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlDatabasesInsertRequest + * @property {string|null} [instance] SqlDatabasesInsertRequest instance + * @property {string|null} [project] SqlDatabasesInsertRequest project + * @property {google.cloud.sql.v1.IDatabase|null} [body] SqlDatabasesInsertRequest body + */ + + /** + * Constructs a new SqlDatabasesInsertRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlDatabasesInsertRequest. + * @implements ISqlDatabasesInsertRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest=} [properties] Properties to set + */ + function SqlDatabasesInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlDatabasesInsertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @instance + */ + SqlDatabasesInsertRequest.prototype.instance = ""; + + /** + * SqlDatabasesInsertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @instance + */ + SqlDatabasesInsertRequest.prototype.project = ""; + + /** + * SqlDatabasesInsertRequest body. + * @member {google.cloud.sql.v1.IDatabase|null|undefined} body + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @instance + */ + SqlDatabasesInsertRequest.prototype.body = null; + + /** + * Creates a new SqlDatabasesInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest instance + */ + SqlDatabasesInsertRequest.create = function create(properties) { + return new SqlDatabasesInsertRequest(properties); + }; + + /** + * Encodes the specified SqlDatabasesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest} message SqlDatabasesInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.Database.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlDatabasesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest} message SqlDatabasesInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlDatabasesInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.Database.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlDatabasesInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlDatabasesInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.Database.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlDatabasesInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest + */ + SqlDatabasesInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlDatabasesInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlDatabasesInsertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlDatabasesInsertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.Database.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlDatabasesInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @static + * @param {google.cloud.sql.v1.SqlDatabasesInsertRequest} message SqlDatabasesInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlDatabasesInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.Database.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlDatabasesInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlDatabasesInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlDatabasesInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlDatabasesInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlDatabasesInsertRequest"; + }; + + return SqlDatabasesInsertRequest; + })(); + + v1.SqlDatabasesListRequest = (function() { + + /** + * Properties of a SqlDatabasesListRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlDatabasesListRequest + * @property {string|null} [instance] SqlDatabasesListRequest instance + * @property {string|null} [project] SqlDatabasesListRequest project + */ + + /** + * Constructs a new SqlDatabasesListRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlDatabasesListRequest. + * @implements ISqlDatabasesListRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlDatabasesListRequest=} [properties] Properties to set + */ + function SqlDatabasesListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlDatabasesListRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @instance + */ + SqlDatabasesListRequest.prototype.instance = ""; + + /** + * SqlDatabasesListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @instance + */ + SqlDatabasesListRequest.prototype.project = ""; + + /** + * Creates a new SqlDatabasesListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlDatabasesListRequest} SqlDatabasesListRequest instance + */ + SqlDatabasesListRequest.create = function create(properties) { + return new SqlDatabasesListRequest(properties); + }; + + /** + * Encodes the specified SqlDatabasesListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesListRequest} message SqlDatabasesListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlDatabasesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesListRequest} message SqlDatabasesListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlDatabasesListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlDatabasesListRequest} SqlDatabasesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlDatabasesListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlDatabasesListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlDatabasesListRequest} SqlDatabasesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlDatabasesListRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlDatabasesListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlDatabasesListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlDatabasesListRequest} SqlDatabasesListRequest + */ + SqlDatabasesListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlDatabasesListRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlDatabasesListRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlDatabasesListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @static + * @param {google.cloud.sql.v1.SqlDatabasesListRequest} message SqlDatabasesListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlDatabasesListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlDatabasesListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlDatabasesListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlDatabasesListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlDatabasesListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlDatabasesListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlDatabasesListRequest"; + }; + + return SqlDatabasesListRequest; + })(); + + v1.SqlDatabasesUpdateRequest = (function() { + + /** + * Properties of a SqlDatabasesUpdateRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlDatabasesUpdateRequest + * @property {string|null} [database] SqlDatabasesUpdateRequest database + * @property {string|null} [instance] SqlDatabasesUpdateRequest instance + * @property {string|null} [project] SqlDatabasesUpdateRequest project + * @property {google.cloud.sql.v1.IDatabase|null} [body] SqlDatabasesUpdateRequest body + */ + + /** + * Constructs a new SqlDatabasesUpdateRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlDatabasesUpdateRequest. + * @implements ISqlDatabasesUpdateRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest=} [properties] Properties to set + */ + function SqlDatabasesUpdateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlDatabasesUpdateRequest database. + * @member {string} database + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @instance + */ + SqlDatabasesUpdateRequest.prototype.database = ""; + + /** + * SqlDatabasesUpdateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @instance + */ + SqlDatabasesUpdateRequest.prototype.instance = ""; + + /** + * SqlDatabasesUpdateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @instance + */ + SqlDatabasesUpdateRequest.prototype.project = ""; + + /** + * SqlDatabasesUpdateRequest body. + * @member {google.cloud.sql.v1.IDatabase|null|undefined} body + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @instance + */ + SqlDatabasesUpdateRequest.prototype.body = null; + + /** + * Creates a new SqlDatabasesUpdateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest instance + */ + SqlDatabasesUpdateRequest.create = function create(properties) { + return new SqlDatabasesUpdateRequest(properties); + }; + + /** + * Encodes the specified SqlDatabasesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesUpdateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesUpdateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.Database.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlDatabasesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesUpdateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @static + * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesUpdateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlDatabasesUpdateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.Database.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesUpdateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlDatabasesUpdateRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlDatabasesUpdateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.Database.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlDatabasesUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest + */ + SqlDatabasesUpdateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlDatabasesUpdateRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlDatabasesUpdateRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlDatabasesUpdateRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.Database.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlDatabasesUpdateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @static + * @param {google.cloud.sql.v1.SqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlDatabasesUpdateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.database = ""; + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.Database.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlDatabasesUpdateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlDatabasesUpdateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlDatabasesUpdateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlDatabasesUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlDatabasesUpdateRequest"; + }; + + return SqlDatabasesUpdateRequest; + })(); + + v1.DatabasesListResponse = (function() { + + /** + * Properties of a DatabasesListResponse. + * @memberof google.cloud.sql.v1 + * @interface IDatabasesListResponse + * @property {string|null} [kind] DatabasesListResponse kind + * @property {Array.|null} [items] DatabasesListResponse items + */ + + /** + * Constructs a new DatabasesListResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a DatabasesListResponse. + * @implements IDatabasesListResponse + * @constructor + * @param {google.cloud.sql.v1.IDatabasesListResponse=} [properties] Properties to set + */ + function DatabasesListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DatabasesListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @instance + */ + DatabasesListResponse.prototype.kind = ""; + + /** + * DatabasesListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @instance + */ + DatabasesListResponse.prototype.items = $util.emptyArray; + + /** + * Creates a new DatabasesListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @static + * @param {google.cloud.sql.v1.IDatabasesListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.DatabasesListResponse} DatabasesListResponse instance + */ + DatabasesListResponse.create = function create(properties) { + return new DatabasesListResponse(properties); + }; + + /** + * Encodes the specified DatabasesListResponse message. Does not implicitly {@link google.cloud.sql.v1.DatabasesListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @static + * @param {google.cloud.sql.v1.IDatabasesListResponse} message DatabasesListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabasesListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1.Database.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DatabasesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabasesListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @static + * @param {google.cloud.sql.v1.IDatabasesListResponse} message DatabasesListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabasesListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DatabasesListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.DatabasesListResponse} DatabasesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabasesListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabasesListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1.Database.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DatabasesListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.DatabasesListResponse} DatabasesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabasesListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DatabasesListResponse message. + * @function verify + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DatabasesListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1.Database.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a DatabasesListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.DatabasesListResponse} DatabasesListResponse + */ + DatabasesListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.DatabasesListResponse) + return object; + var message = new $root.google.cloud.sql.v1.DatabasesListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1.DatabasesListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1.DatabasesListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1.Database.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DatabasesListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @static + * @param {google.cloud.sql.v1.DatabasesListResponse} message DatabasesListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DatabasesListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1.Database.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this DatabasesListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @instance + * @returns {Object.} JSON object + */ + DatabasesListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DatabasesListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.DatabasesListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DatabasesListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.DatabasesListResponse"; + }; + + return DatabasesListResponse; + })(); + + v1.SqlEventsService = (function() { + + /** + * Constructs a new SqlEventsService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlEventsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlEventsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlEventsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlEventsService; + + /** + * Creates new SqlEventsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlEventsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlEventsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlEventsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + return SqlEventsService; + })(); + + v1.SqlFeatureEligibilityService = (function() { + + /** + * Constructs a new SqlFeatureEligibilityService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlFeatureEligibilityService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlFeatureEligibilityService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlFeatureEligibilityService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlFeatureEligibilityService; + + /** + * Creates new SqlFeatureEligibilityService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlFeatureEligibilityService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlFeatureEligibilityService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlFeatureEligibilityService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + return SqlFeatureEligibilityService; + })(); + + v1.SqlFlagsService = (function() { + + /** + * Constructs a new SqlFlagsService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlFlagsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlFlagsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlFlagsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlFlagsService; + + /** + * Creates new SqlFlagsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlFlagsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlFlagsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlFlagsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlFlagsService|list}. + * @memberof google.cloud.sql.v1.SqlFlagsService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.FlagsListResponse} [response] FlagsListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlFlagsService + * @instance + * @param {google.cloud.sql.v1.ISqlFlagsListRequest} request SqlFlagsListRequest message or plain object + * @param {google.cloud.sql.v1.SqlFlagsService.ListCallback} callback Node-style callback called with the error, if any, and FlagsListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlFlagsService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1.SqlFlagsListRequest, $root.google.cloud.sql.v1.FlagsListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlFlagsService + * @instance + * @param {google.cloud.sql.v1.ISqlFlagsListRequest} request SqlFlagsListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlFlagsService; + })(); + + v1.SqlFlagsListRequest = (function() { + + /** + * Properties of a SqlFlagsListRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlFlagsListRequest + * @property {string|null} [databaseVersion] SqlFlagsListRequest databaseVersion + * @property {google.cloud.sql.v1.SqlFlagScope|null} [flagScope] SqlFlagsListRequest flagScope + */ + + /** + * Constructs a new SqlFlagsListRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlFlagsListRequest. + * @implements ISqlFlagsListRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlFlagsListRequest=} [properties] Properties to set + */ + function SqlFlagsListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlFlagsListRequest databaseVersion. + * @member {string} databaseVersion + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @instance + */ + SqlFlagsListRequest.prototype.databaseVersion = ""; + + /** + * SqlFlagsListRequest flagScope. + * @member {google.cloud.sql.v1.SqlFlagScope|null|undefined} flagScope + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @instance + */ + SqlFlagsListRequest.prototype.flagScope = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlFlagsListRequest.prototype, "_flagScope", { + get: $util.oneOfGetter($oneOfFields = ["flagScope"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlFlagsListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlFlagsListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlFlagsListRequest} SqlFlagsListRequest instance + */ + SqlFlagsListRequest.create = function create(properties) { + return new SqlFlagsListRequest(properties); + }; + + /** + * Encodes the specified SqlFlagsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlFlagsListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlFlagsListRequest} message SqlFlagsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlFlagsListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.databaseVersion); + if (message.flagScope != null && Object.hasOwnProperty.call(message, "flagScope")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.flagScope); + return writer; + }; + + /** + * Encodes the specified SqlFlagsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlFlagsListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlFlagsListRequest} message SqlFlagsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlFlagsListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlFlagsListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlFlagsListRequest} SqlFlagsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlFlagsListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlFlagsListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.databaseVersion = reader.string(); + break; + } + case 3: { + message.flagScope = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlFlagsListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlFlagsListRequest} SqlFlagsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlFlagsListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlFlagsListRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlFlagsListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + if (!$util.isString(message.databaseVersion)) + return "databaseVersion: string expected"; + if (message.flagScope != null && message.hasOwnProperty("flagScope")) { + properties._flagScope = 1; + switch (message.flagScope) { + default: + return "flagScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates a SqlFlagsListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlFlagsListRequest} SqlFlagsListRequest + */ + SqlFlagsListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlFlagsListRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlFlagsListRequest(); + if (object.databaseVersion != null) + message.databaseVersion = String(object.databaseVersion); + switch (object.flagScope) { + default: + if (typeof object.flagScope === "number") { + message.flagScope = object.flagScope; + break; + } + break; + case "SQL_FLAG_SCOPE_UNSPECIFIED": + case 0: + message.flagScope = 0; + break; + case "SQL_FLAG_SCOPE_DATABASE": + case 1: + message.flagScope = 1; + break; + case "SQL_FLAG_SCOPE_CONNECTION_POOL": + case 2: + message.flagScope = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a SqlFlagsListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @static + * @param {google.cloud.sql.v1.SqlFlagsListRequest} message SqlFlagsListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlFlagsListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.databaseVersion = ""; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + object.databaseVersion = message.databaseVersion; + if (message.flagScope != null && message.hasOwnProperty("flagScope")) { + object.flagScope = options.enums === String ? $root.google.cloud.sql.v1.SqlFlagScope[message.flagScope] === undefined ? message.flagScope : $root.google.cloud.sql.v1.SqlFlagScope[message.flagScope] : message.flagScope; + if (options.oneofs) + object._flagScope = "flagScope"; + } + return object; + }; + + /** + * Converts this SqlFlagsListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlFlagsListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlFlagsListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlFlagsListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlFlagsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlFlagsListRequest"; + }; + + return SqlFlagsListRequest; + })(); + + v1.FlagsListResponse = (function() { + + /** + * Properties of a FlagsListResponse. + * @memberof google.cloud.sql.v1 + * @interface IFlagsListResponse + * @property {string|null} [kind] FlagsListResponse kind + * @property {Array.|null} [items] FlagsListResponse items + */ + + /** + * Constructs a new FlagsListResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a FlagsListResponse. + * @implements IFlagsListResponse + * @constructor + * @param {google.cloud.sql.v1.IFlagsListResponse=} [properties] Properties to set + */ + function FlagsListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FlagsListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.FlagsListResponse + * @instance + */ + FlagsListResponse.prototype.kind = ""; + + /** + * FlagsListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1.FlagsListResponse + * @instance + */ + FlagsListResponse.prototype.items = $util.emptyArray; + + /** + * Creates a new FlagsListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.FlagsListResponse + * @static + * @param {google.cloud.sql.v1.IFlagsListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.FlagsListResponse} FlagsListResponse instance + */ + FlagsListResponse.create = function create(properties) { + return new FlagsListResponse(properties); + }; + + /** + * Encodes the specified FlagsListResponse message. Does not implicitly {@link google.cloud.sql.v1.FlagsListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.FlagsListResponse + * @static + * @param {google.cloud.sql.v1.IFlagsListResponse} message FlagsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FlagsListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1.Flag.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FlagsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FlagsListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.FlagsListResponse + * @static + * @param {google.cloud.sql.v1.IFlagsListResponse} message FlagsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FlagsListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FlagsListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.FlagsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.FlagsListResponse} FlagsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FlagsListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.FlagsListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1.Flag.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FlagsListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.FlagsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.FlagsListResponse} FlagsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FlagsListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FlagsListResponse message. + * @function verify + * @memberof google.cloud.sql.v1.FlagsListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FlagsListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1.Flag.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a FlagsListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.FlagsListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.FlagsListResponse} FlagsListResponse + */ + FlagsListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.FlagsListResponse) + return object; + var message = new $root.google.cloud.sql.v1.FlagsListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1.FlagsListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1.FlagsListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1.Flag.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FlagsListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.FlagsListResponse + * @static + * @param {google.cloud.sql.v1.FlagsListResponse} message FlagsListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FlagsListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1.Flag.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this FlagsListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.FlagsListResponse + * @instance + * @returns {Object.} JSON object + */ + FlagsListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FlagsListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.FlagsListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FlagsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.FlagsListResponse"; + }; + + return FlagsListResponse; + })(); + + v1.Flag = (function() { + + /** + * Properties of a Flag. + * @memberof google.cloud.sql.v1 + * @interface IFlag + * @property {string|null} [name] Flag name + * @property {google.cloud.sql.v1.SqlFlagType|null} [type] Flag type + * @property {Array.|null} [appliesTo] Flag appliesTo + * @property {Array.|null} [allowedStringValues] Flag allowedStringValues + * @property {google.protobuf.IInt64Value|null} [minValue] Flag minValue + * @property {google.protobuf.IInt64Value|null} [maxValue] Flag maxValue + * @property {google.protobuf.IBoolValue|null} [requiresRestart] Flag requiresRestart + * @property {string|null} [kind] Flag kind + * @property {google.protobuf.IBoolValue|null} [inBeta] Flag inBeta + * @property {Array.|null} [allowedIntValues] Flag allowedIntValues + * @property {google.cloud.sql.v1.SqlFlagScope|null} [flagScope] Flag flagScope + * @property {string|null} [recommendedStringValue] Flag recommendedStringValue + * @property {google.protobuf.IInt64Value|null} [recommendedIntValue] Flag recommendedIntValue + */ + + /** + * Constructs a new Flag. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a Flag. + * @implements IFlag + * @constructor + * @param {google.cloud.sql.v1.IFlag=} [properties] Properties to set + */ + function Flag(properties) { + this.appliesTo = []; + this.allowedStringValues = []; + this.allowedIntValues = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Flag name. + * @member {string} name + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.name = ""; + + /** + * Flag type. + * @member {google.cloud.sql.v1.SqlFlagType} type + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.type = 0; + + /** + * Flag appliesTo. + * @member {Array.} appliesTo + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.appliesTo = $util.emptyArray; + + /** + * Flag allowedStringValues. + * @member {Array.} allowedStringValues + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.allowedStringValues = $util.emptyArray; + + /** + * Flag minValue. + * @member {google.protobuf.IInt64Value|null|undefined} minValue + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.minValue = null; + + /** + * Flag maxValue. + * @member {google.protobuf.IInt64Value|null|undefined} maxValue + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.maxValue = null; + + /** + * Flag requiresRestart. + * @member {google.protobuf.IBoolValue|null|undefined} requiresRestart + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.requiresRestart = null; + + /** + * Flag kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.kind = ""; + + /** + * Flag inBeta. + * @member {google.protobuf.IBoolValue|null|undefined} inBeta + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.inBeta = null; + + /** + * Flag allowedIntValues. + * @member {Array.} allowedIntValues + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.allowedIntValues = $util.emptyArray; + + /** + * Flag flagScope. + * @member {google.cloud.sql.v1.SqlFlagScope} flagScope + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.flagScope = 0; + + /** + * Flag recommendedStringValue. + * @member {string|null|undefined} recommendedStringValue + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.recommendedStringValue = null; + + /** + * Flag recommendedIntValue. + * @member {google.protobuf.IInt64Value|null|undefined} recommendedIntValue + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Flag.prototype.recommendedIntValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Flag recommendedValue. + * @member {"recommendedStringValue"|"recommendedIntValue"|undefined} recommendedValue + * @memberof google.cloud.sql.v1.Flag + * @instance + */ + Object.defineProperty(Flag.prototype, "recommendedValue", { + get: $util.oneOfGetter($oneOfFields = ["recommendedStringValue", "recommendedIntValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Flag instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.Flag + * @static + * @param {google.cloud.sql.v1.IFlag=} [properties] Properties to set + * @returns {google.cloud.sql.v1.Flag} Flag instance + */ + Flag.create = function create(properties) { + return new Flag(properties); + }; + + /** + * Encodes the specified Flag message. Does not implicitly {@link google.cloud.sql.v1.Flag.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.Flag + * @static + * @param {google.cloud.sql.v1.IFlag} message Flag message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Flag.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.appliesTo != null && message.appliesTo.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.appliesTo.length; ++i) + writer.int32(message.appliesTo[i]); + writer.ldelim(); + } + if (message.allowedStringValues != null && message.allowedStringValues.length) + for (var i = 0; i < message.allowedStringValues.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.allowedStringValues[i]); + if (message.minValue != null && Object.hasOwnProperty.call(message, "minValue")) + $root.google.protobuf.Int64Value.encode(message.minValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.maxValue != null && Object.hasOwnProperty.call(message, "maxValue")) + $root.google.protobuf.Int64Value.encode(message.maxValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.requiresRestart != null && Object.hasOwnProperty.call(message, "requiresRestart")) + $root.google.protobuf.BoolValue.encode(message.requiresRestart, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.kind); + if (message.inBeta != null && Object.hasOwnProperty.call(message, "inBeta")) + $root.google.protobuf.BoolValue.encode(message.inBeta, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.allowedIntValues != null && message.allowedIntValues.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.allowedIntValues.length; ++i) + writer.int64(message.allowedIntValues[i]); + writer.ldelim(); + } + if (message.flagScope != null && Object.hasOwnProperty.call(message, "flagScope")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.flagScope); + if (message.recommendedStringValue != null && Object.hasOwnProperty.call(message, "recommendedStringValue")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.recommendedStringValue); + if (message.recommendedIntValue != null && Object.hasOwnProperty.call(message, "recommendedIntValue")) + $root.google.protobuf.Int64Value.encode(message.recommendedIntValue, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Flag message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Flag.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.Flag + * @static + * @param {google.cloud.sql.v1.IFlag} message Flag message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Flag.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Flag message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.Flag + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.Flag} Flag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Flag.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Flag(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + if (!(message.appliesTo && message.appliesTo.length)) + message.appliesTo = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.appliesTo.push(reader.int32()); + } else + message.appliesTo.push(reader.int32()); + break; + } + case 4: { + if (!(message.allowedStringValues && message.allowedStringValues.length)) + message.allowedStringValues = []; + message.allowedStringValues.push(reader.string()); + break; + } + case 5: { + message.minValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 6: { + message.maxValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 7: { + message.requiresRestart = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 8: { + message.kind = reader.string(); + break; + } + case 9: { + message.inBeta = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 10: { + if (!(message.allowedIntValues && message.allowedIntValues.length)) + message.allowedIntValues = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.allowedIntValues.push(reader.int64()); + } else + message.allowedIntValues.push(reader.int64()); + break; + } + case 15: { + message.flagScope = reader.int32(); + break; + } + case 16: { + message.recommendedStringValue = reader.string(); + break; + } + case 17: { + message.recommendedIntValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Flag message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.Flag + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.Flag} Flag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Flag.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Flag message. + * @function verify + * @memberof google.cloud.sql.v1.Flag + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Flag.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.appliesTo != null && message.hasOwnProperty("appliesTo")) { + if (!Array.isArray(message.appliesTo)) + return "appliesTo: array expected"; + for (var i = 0; i < message.appliesTo.length; ++i) + switch (message.appliesTo[i]) { + default: + return "appliesTo: enum value[] expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 684: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + case 549: + case 550: + case 551: + break; + } + } + if (message.allowedStringValues != null && message.hasOwnProperty("allowedStringValues")) { + if (!Array.isArray(message.allowedStringValues)) + return "allowedStringValues: array expected"; + for (var i = 0; i < message.allowedStringValues.length; ++i) + if (!$util.isString(message.allowedStringValues[i])) + return "allowedStringValues: string[] expected"; + } + if (message.minValue != null && message.hasOwnProperty("minValue")) { + var error = $root.google.protobuf.Int64Value.verify(message.minValue); + if (error) + return "minValue." + error; + } + if (message.maxValue != null && message.hasOwnProperty("maxValue")) { + var error = $root.google.protobuf.Int64Value.verify(message.maxValue); + if (error) + return "maxValue." + error; + } + if (message.requiresRestart != null && message.hasOwnProperty("requiresRestart")) { + var error = $root.google.protobuf.BoolValue.verify(message.requiresRestart); + if (error) + return "requiresRestart." + error; + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.inBeta != null && message.hasOwnProperty("inBeta")) { + var error = $root.google.protobuf.BoolValue.verify(message.inBeta); + if (error) + return "inBeta." + error; + } + if (message.allowedIntValues != null && message.hasOwnProperty("allowedIntValues")) { + if (!Array.isArray(message.allowedIntValues)) + return "allowedIntValues: array expected"; + for (var i = 0; i < message.allowedIntValues.length; ++i) + if (!$util.isInteger(message.allowedIntValues[i]) && !(message.allowedIntValues[i] && $util.isInteger(message.allowedIntValues[i].low) && $util.isInteger(message.allowedIntValues[i].high))) + return "allowedIntValues: integer|Long[] expected"; + } + if (message.flagScope != null && message.hasOwnProperty("flagScope")) + switch (message.flagScope) { + default: + return "flagScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.recommendedStringValue != null && message.hasOwnProperty("recommendedStringValue")) { + properties.recommendedValue = 1; + if (!$util.isString(message.recommendedStringValue)) + return "recommendedStringValue: string expected"; + } + if (message.recommendedIntValue != null && message.hasOwnProperty("recommendedIntValue")) { + if (properties.recommendedValue === 1) + return "recommendedValue: multiple values"; + properties.recommendedValue = 1; + { + var error = $root.google.protobuf.Int64Value.verify(message.recommendedIntValue); + if (error) + return "recommendedIntValue." + error; + } + } + return null; + }; + + /** + * Creates a Flag message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.Flag + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.Flag} Flag + */ + Flag.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.Flag) + return object; + var message = new $root.google.cloud.sql.v1.Flag(); + if (object.name != null) + message.name = String(object.name); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SQL_FLAG_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "BOOLEAN": + case 1: + message.type = 1; + break; + case "STRING": + case 2: + message.type = 2; + break; + case "INTEGER": + case 3: + message.type = 3; + break; + case "NONE": + case 4: + message.type = 4; + break; + case "MYSQL_TIMEZONE_OFFSET": + case 5: + message.type = 5; + break; + case "FLOAT": + case 6: + message.type = 6; + break; + case "REPEATED_STRING": + case 7: + message.type = 7; + break; + } + if (object.appliesTo) { + if (!Array.isArray(object.appliesTo)) + throw TypeError(".google.cloud.sql.v1.Flag.appliesTo: array expected"); + message.appliesTo = []; + for (var i = 0; i < object.appliesTo.length; ++i) + switch (object.appliesTo[i]) { + default: + if (typeof object.appliesTo[i] === "number") { + message.appliesTo[i] = object.appliesTo[i]; + break; + } + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.appliesTo[i] = 0; + break; + case "MYSQL_5_1": + case 2: + message.appliesTo[i] = 2; + break; + case "MYSQL_5_5": + case 3: + message.appliesTo[i] = 3; + break; + case "MYSQL_5_6": + case 5: + message.appliesTo[i] = 5; + break; + case "MYSQL_5_7": + case 6: + message.appliesTo[i] = 6; + break; + case "MYSQL_8_0": + case 20: + message.appliesTo[i] = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.appliesTo[i] = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.appliesTo[i] = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.appliesTo[i] = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.appliesTo[i] = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.appliesTo[i] = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.appliesTo[i] = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.appliesTo[i] = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.appliesTo[i] = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.appliesTo[i] = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.appliesTo[i] = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.appliesTo[i] = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.appliesTo[i] = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.appliesTo[i] = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.appliesTo[i] = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.appliesTo[i] = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.appliesTo[i] = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.appliesTo[i] = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.appliesTo[i] = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.appliesTo[i] = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.appliesTo[i] = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.appliesTo[i] = 556; + break; + case "MYSQL_8_4": + case 398: + message.appliesTo[i] = 398; + break; + case "MYSQL_9_7": + case 654: + message.appliesTo[i] = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.appliesTo[i] = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.appliesTo[i] = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.appliesTo[i] = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.appliesTo[i] = 16; + break; + case "POSTGRES_9_6": + case 9: + message.appliesTo[i] = 9; + break; + case "POSTGRES_10": + case 18: + message.appliesTo[i] = 18; + break; + case "POSTGRES_11": + case 10: + message.appliesTo[i] = 10; + break; + case "POSTGRES_12": + case 19: + message.appliesTo[i] = 19; + break; + case "POSTGRES_13": + case 23: + message.appliesTo[i] = 23; + break; + case "POSTGRES_14": + case 110: + message.appliesTo[i] = 110; + break; + case "POSTGRES_15": + case 172: + message.appliesTo[i] = 172; + break; + case "POSTGRES_16": + case 272: + message.appliesTo[i] = 272; + break; + case "POSTGRES_17": + case 408: + message.appliesTo[i] = 408; + break; + case "POSTGRES_18": + case 557: + message.appliesTo[i] = 557; + break; + case "POSTGRES_19": + case 684: + message.appliesTo[i] = 684; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.appliesTo[i] = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.appliesTo[i] = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.appliesTo[i] = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.appliesTo[i] = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.appliesTo[i] = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.appliesTo[i] = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.appliesTo[i] = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.appliesTo[i] = 202; + break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.appliesTo[i] = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.appliesTo[i] = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.appliesTo[i] = 551; + break; + } + } + if (object.allowedStringValues) { + if (!Array.isArray(object.allowedStringValues)) + throw TypeError(".google.cloud.sql.v1.Flag.allowedStringValues: array expected"); + message.allowedStringValues = []; + for (var i = 0; i < object.allowedStringValues.length; ++i) + message.allowedStringValues[i] = String(object.allowedStringValues[i]); + } + if (object.minValue != null) { + if (typeof object.minValue !== "object") + throw TypeError(".google.cloud.sql.v1.Flag.minValue: object expected"); + message.minValue = $root.google.protobuf.Int64Value.fromObject(object.minValue); + } + if (object.maxValue != null) { + if (typeof object.maxValue !== "object") + throw TypeError(".google.cloud.sql.v1.Flag.maxValue: object expected"); + message.maxValue = $root.google.protobuf.Int64Value.fromObject(object.maxValue); + } + if (object.requiresRestart != null) { + if (typeof object.requiresRestart !== "object") + throw TypeError(".google.cloud.sql.v1.Flag.requiresRestart: object expected"); + message.requiresRestart = $root.google.protobuf.BoolValue.fromObject(object.requiresRestart); + } + if (object.kind != null) + message.kind = String(object.kind); + if (object.inBeta != null) { + if (typeof object.inBeta !== "object") + throw TypeError(".google.cloud.sql.v1.Flag.inBeta: object expected"); + message.inBeta = $root.google.protobuf.BoolValue.fromObject(object.inBeta); + } + if (object.allowedIntValues) { + if (!Array.isArray(object.allowedIntValues)) + throw TypeError(".google.cloud.sql.v1.Flag.allowedIntValues: array expected"); + message.allowedIntValues = []; + for (var i = 0; i < object.allowedIntValues.length; ++i) + if ($util.Long) + (message.allowedIntValues[i] = $util.Long.fromValue(object.allowedIntValues[i])).unsigned = false; + else if (typeof object.allowedIntValues[i] === "string") + message.allowedIntValues[i] = parseInt(object.allowedIntValues[i], 10); + else if (typeof object.allowedIntValues[i] === "number") + message.allowedIntValues[i] = object.allowedIntValues[i]; + else if (typeof object.allowedIntValues[i] === "object") + message.allowedIntValues[i] = new $util.LongBits(object.allowedIntValues[i].low >>> 0, object.allowedIntValues[i].high >>> 0).toNumber(); + } + switch (object.flagScope) { + default: + if (typeof object.flagScope === "number") { + message.flagScope = object.flagScope; + break; + } + break; + case "SQL_FLAG_SCOPE_UNSPECIFIED": + case 0: + message.flagScope = 0; + break; + case "SQL_FLAG_SCOPE_DATABASE": + case 1: + message.flagScope = 1; + break; + case "SQL_FLAG_SCOPE_CONNECTION_POOL": + case 2: + message.flagScope = 2; + break; + } + if (object.recommendedStringValue != null) + message.recommendedStringValue = String(object.recommendedStringValue); + if (object.recommendedIntValue != null) { + if (typeof object.recommendedIntValue !== "object") + throw TypeError(".google.cloud.sql.v1.Flag.recommendedIntValue: object expected"); + message.recommendedIntValue = $root.google.protobuf.Int64Value.fromObject(object.recommendedIntValue); + } + return message; + }; + + /** + * Creates a plain object from a Flag message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.Flag + * @static + * @param {google.cloud.sql.v1.Flag} message Flag + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Flag.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.appliesTo = []; + object.allowedStringValues = []; + object.allowedIntValues = []; + } + if (options.defaults) { + object.name = ""; + object.type = options.enums === String ? "SQL_FLAG_TYPE_UNSPECIFIED" : 0; + object.minValue = null; + object.maxValue = null; + object.requiresRestart = null; + object.kind = ""; + object.inBeta = null; + object.flagScope = options.enums === String ? "SQL_FLAG_SCOPE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1.SqlFlagType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.SqlFlagType[message.type] : message.type; + if (message.appliesTo && message.appliesTo.length) { + object.appliesTo = []; + for (var j = 0; j < message.appliesTo.length; ++j) + object.appliesTo[j] = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.appliesTo[j]] === undefined ? message.appliesTo[j] : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.appliesTo[j]] : message.appliesTo[j]; + } + if (message.allowedStringValues && message.allowedStringValues.length) { + object.allowedStringValues = []; + for (var j = 0; j < message.allowedStringValues.length; ++j) + object.allowedStringValues[j] = message.allowedStringValues[j]; + } + if (message.minValue != null && message.hasOwnProperty("minValue")) + object.minValue = $root.google.protobuf.Int64Value.toObject(message.minValue, options); + if (message.maxValue != null && message.hasOwnProperty("maxValue")) + object.maxValue = $root.google.protobuf.Int64Value.toObject(message.maxValue, options); + if (message.requiresRestart != null && message.hasOwnProperty("requiresRestart")) + object.requiresRestart = $root.google.protobuf.BoolValue.toObject(message.requiresRestart, options); + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.inBeta != null && message.hasOwnProperty("inBeta")) + object.inBeta = $root.google.protobuf.BoolValue.toObject(message.inBeta, options); + if (message.allowedIntValues && message.allowedIntValues.length) { + object.allowedIntValues = []; + for (var j = 0; j < message.allowedIntValues.length; ++j) + if (typeof message.allowedIntValues[j] === "number") + object.allowedIntValues[j] = options.longs === String ? String(message.allowedIntValues[j]) : message.allowedIntValues[j]; + else + object.allowedIntValues[j] = options.longs === String ? $util.Long.prototype.toString.call(message.allowedIntValues[j]) : options.longs === Number ? new $util.LongBits(message.allowedIntValues[j].low >>> 0, message.allowedIntValues[j].high >>> 0).toNumber() : message.allowedIntValues[j]; + } + if (message.flagScope != null && message.hasOwnProperty("flagScope")) + object.flagScope = options.enums === String ? $root.google.cloud.sql.v1.SqlFlagScope[message.flagScope] === undefined ? message.flagScope : $root.google.cloud.sql.v1.SqlFlagScope[message.flagScope] : message.flagScope; + if (message.recommendedStringValue != null && message.hasOwnProperty("recommendedStringValue")) { + object.recommendedStringValue = message.recommendedStringValue; + if (options.oneofs) + object.recommendedValue = "recommendedStringValue"; + } + if (message.recommendedIntValue != null && message.hasOwnProperty("recommendedIntValue")) { + object.recommendedIntValue = $root.google.protobuf.Int64Value.toObject(message.recommendedIntValue, options); + if (options.oneofs) + object.recommendedValue = "recommendedIntValue"; + } + return object; + }; + + /** + * Converts this Flag to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.Flag + * @instance + * @returns {Object.} JSON object + */ + Flag.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Flag + * @function getTypeUrl + * @memberof google.cloud.sql.v1.Flag + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Flag.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.Flag"; + }; + + return Flag; + })(); + + /** + * SqlFlagType enum. + * @name google.cloud.sql.v1.SqlFlagType + * @enum {number} + * @property {number} SQL_FLAG_TYPE_UNSPECIFIED=0 SQL_FLAG_TYPE_UNSPECIFIED value + * @property {number} BOOLEAN=1 BOOLEAN value + * @property {number} STRING=2 STRING value + * @property {number} INTEGER=3 INTEGER value + * @property {number} NONE=4 NONE value + * @property {number} MYSQL_TIMEZONE_OFFSET=5 MYSQL_TIMEZONE_OFFSET value + * @property {number} FLOAT=6 FLOAT value + * @property {number} REPEATED_STRING=7 REPEATED_STRING value + */ + v1.SqlFlagType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_FLAG_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "BOOLEAN"] = 1; + values[valuesById[2] = "STRING"] = 2; + values[valuesById[3] = "INTEGER"] = 3; + values[valuesById[4] = "NONE"] = 4; + values[valuesById[5] = "MYSQL_TIMEZONE_OFFSET"] = 5; + values[valuesById[6] = "FLOAT"] = 6; + values[valuesById[7] = "REPEATED_STRING"] = 7; + return values; + })(); + + /** + * SqlFlagScope enum. + * @name google.cloud.sql.v1.SqlFlagScope + * @enum {number} + * @property {number} SQL_FLAG_SCOPE_UNSPECIFIED=0 SQL_FLAG_SCOPE_UNSPECIFIED value + * @property {number} SQL_FLAG_SCOPE_DATABASE=1 SQL_FLAG_SCOPE_DATABASE value + * @property {number} SQL_FLAG_SCOPE_CONNECTION_POOL=2 SQL_FLAG_SCOPE_CONNECTION_POOL value + */ + v1.SqlFlagScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_FLAG_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SQL_FLAG_SCOPE_DATABASE"] = 1; + values[valuesById[2] = "SQL_FLAG_SCOPE_CONNECTION_POOL"] = 2; + return values; + })(); + + v1.SqlIamPoliciesService = (function() { + + /** + * Constructs a new SqlIamPoliciesService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlIamPoliciesService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlIamPoliciesService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlIamPoliciesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlIamPoliciesService; + + /** + * Creates new SqlIamPoliciesService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlIamPoliciesService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlIamPoliciesService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlIamPoliciesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + return SqlIamPoliciesService; + })(); + + v1.SqlInstanceNamesService = (function() { + + /** + * Constructs a new SqlInstanceNamesService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlInstanceNamesService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlInstanceNamesService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlInstanceNamesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlInstanceNamesService; + + /** + * Creates new SqlInstanceNamesService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlInstanceNamesService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlInstanceNamesService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlInstanceNamesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + return SqlInstanceNamesService; + })(); + + v1.SqlOperationsService = (function() { + + /** + * Constructs a new SqlOperationsService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlOperationsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlOperationsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlOperationsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlOperationsService; + + /** + * Creates new SqlOperationsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlOperationsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlOperationsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlOperationsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|get}. + * @memberof google.cloud.sql.v1.SqlOperationsService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1.ISqlOperationsGetRequest} request SqlOperationsGetRequest message or plain object + * @param {google.cloud.sql.v1.SqlOperationsService.GetCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlOperationsService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1.SqlOperationsGetRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1.ISqlOperationsGetRequest} request SqlOperationsGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|list}. + * @memberof google.cloud.sql.v1.SqlOperationsService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.OperationsListResponse} [response] OperationsListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1.ISqlOperationsListRequest} request SqlOperationsListRequest message or plain object + * @param {google.cloud.sql.v1.SqlOperationsService.ListCallback} callback Node-style callback called with the error, if any, and OperationsListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlOperationsService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1.SqlOperationsListRequest, $root.google.cloud.sql.v1.OperationsListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1.ISqlOperationsListRequest} request SqlOperationsListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|cancel}. + * @memberof google.cloud.sql.v1.SqlOperationsService + * @typedef CancelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls Cancel. + * @function cancel + * @memberof google.cloud.sql.v1.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest} request SqlOperationsCancelRequest message or plain object + * @param {google.cloud.sql.v1.SqlOperationsService.CancelCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlOperationsService.prototype.cancel = function cancel(request, callback) { + return this.rpcCall(cancel, $root.google.cloud.sql.v1.SqlOperationsCancelRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "Cancel" }); + + /** + * Calls Cancel. + * @function cancel + * @memberof google.cloud.sql.v1.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest} request SqlOperationsCancelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlOperationsService; + })(); + + v1.SqlOperationsGetRequest = (function() { + + /** + * Properties of a SqlOperationsGetRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlOperationsGetRequest + * @property {string|null} [operation] SqlOperationsGetRequest operation + * @property {string|null} [project] SqlOperationsGetRequest project + */ + + /** + * Constructs a new SqlOperationsGetRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlOperationsGetRequest. + * @implements ISqlOperationsGetRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlOperationsGetRequest=} [properties] Properties to set + */ + function SqlOperationsGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlOperationsGetRequest operation. + * @member {string} operation + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @instance + */ + SqlOperationsGetRequest.prototype.operation = ""; + + /** + * SqlOperationsGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @instance + */ + SqlOperationsGetRequest.prototype.project = ""; + + /** + * Creates a new SqlOperationsGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlOperationsGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlOperationsGetRequest} SqlOperationsGetRequest instance + */ + SqlOperationsGetRequest.create = function create(properties) { + return new SqlOperationsGetRequest(properties); + }; + + /** + * Encodes the specified SqlOperationsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlOperationsGetRequest} message SqlOperationsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.operation); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlOperationsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlOperationsGetRequest} message SqlOperationsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlOperationsGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlOperationsGetRequest} SqlOperationsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlOperationsGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.operation = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlOperationsGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlOperationsGetRequest} SqlOperationsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlOperationsGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlOperationsGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operation != null && message.hasOwnProperty("operation")) + if (!$util.isString(message.operation)) + return "operation: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlOperationsGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlOperationsGetRequest} SqlOperationsGetRequest + */ + SqlOperationsGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlOperationsGetRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlOperationsGetRequest(); + if (object.operation != null) + message.operation = String(object.operation); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlOperationsGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @static + * @param {google.cloud.sql.v1.SqlOperationsGetRequest} message SqlOperationsGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlOperationsGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.operation = ""; + object.project = ""; + } + if (message.operation != null && message.hasOwnProperty("operation")) + object.operation = message.operation; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlOperationsGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlOperationsGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlOperationsGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlOperationsGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlOperationsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlOperationsGetRequest"; + }; + + return SqlOperationsGetRequest; + })(); + + v1.SqlOperationsListRequest = (function() { + + /** + * Properties of a SqlOperationsListRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlOperationsListRequest + * @property {string|null} [instance] SqlOperationsListRequest instance + * @property {number|null} [maxResults] SqlOperationsListRequest maxResults + * @property {string|null} [pageToken] SqlOperationsListRequest pageToken + * @property {string|null} [project] SqlOperationsListRequest project + */ + + /** + * Constructs a new SqlOperationsListRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlOperationsListRequest. + * @implements ISqlOperationsListRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlOperationsListRequest=} [properties] Properties to set + */ + function SqlOperationsListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlOperationsListRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @instance + */ + SqlOperationsListRequest.prototype.instance = ""; + + /** + * SqlOperationsListRequest maxResults. + * @member {number} maxResults + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @instance + */ + SqlOperationsListRequest.prototype.maxResults = 0; + + /** + * SqlOperationsListRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @instance + */ + SqlOperationsListRequest.prototype.pageToken = ""; + + /** + * SqlOperationsListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @instance + */ + SqlOperationsListRequest.prototype.project = ""; + + /** + * Creates a new SqlOperationsListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlOperationsListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlOperationsListRequest} SqlOperationsListRequest instance + */ + SqlOperationsListRequest.create = function create(properties) { + return new SqlOperationsListRequest(properties); + }; + + /** + * Encodes the specified SqlOperationsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlOperationsListRequest} message SqlOperationsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.maxResults); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlOperationsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlOperationsListRequest} message SqlOperationsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlOperationsListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlOperationsListRequest} SqlOperationsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlOperationsListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.maxResults = reader.uint32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlOperationsListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlOperationsListRequest} SqlOperationsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlOperationsListRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlOperationsListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlOperationsListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlOperationsListRequest} SqlOperationsListRequest + */ + SqlOperationsListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlOperationsListRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlOperationsListRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.maxResults != null) + message.maxResults = object.maxResults >>> 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlOperationsListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @static + * @param {google.cloud.sql.v1.SqlOperationsListRequest} message SqlOperationsListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlOperationsListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.maxResults = 0; + object.pageToken = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlOperationsListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlOperationsListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlOperationsListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlOperationsListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlOperationsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlOperationsListRequest"; + }; + + return SqlOperationsListRequest; + })(); + + v1.OperationsListResponse = (function() { + + /** + * Properties of an OperationsListResponse. + * @memberof google.cloud.sql.v1 + * @interface IOperationsListResponse + * @property {string|null} [kind] OperationsListResponse kind + * @property {Array.|null} [items] OperationsListResponse items + * @property {string|null} [nextPageToken] OperationsListResponse nextPageToken + */ + + /** + * Constructs a new OperationsListResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents an OperationsListResponse. + * @implements IOperationsListResponse + * @constructor + * @param {google.cloud.sql.v1.IOperationsListResponse=} [properties] Properties to set + */ + function OperationsListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationsListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.OperationsListResponse + * @instance + */ + OperationsListResponse.prototype.kind = ""; + + /** + * OperationsListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1.OperationsListResponse + * @instance + */ + OperationsListResponse.prototype.items = $util.emptyArray; + + /** + * OperationsListResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.sql.v1.OperationsListResponse + * @instance + */ + OperationsListResponse.prototype.nextPageToken = ""; + + /** + * Creates a new OperationsListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.OperationsListResponse + * @static + * @param {google.cloud.sql.v1.IOperationsListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.OperationsListResponse} OperationsListResponse instance + */ + OperationsListResponse.create = function create(properties) { + return new OperationsListResponse(properties); + }; + + /** + * Encodes the specified OperationsListResponse message. Does not implicitly {@link google.cloud.sql.v1.OperationsListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.OperationsListResponse + * @static + * @param {google.cloud.sql.v1.IOperationsListResponse} message OperationsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationsListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1.Operation.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified OperationsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationsListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.OperationsListResponse + * @static + * @param {google.cloud.sql.v1.IOperationsListResponse} message OperationsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationsListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationsListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.OperationsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.OperationsListResponse} OperationsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationsListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.OperationsListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1.Operation.decode(reader, reader.uint32())); + break; + } + case 3: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationsListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.OperationsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.OperationsListResponse} OperationsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationsListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationsListResponse message. + * @function verify + * @memberof google.cloud.sql.v1.OperationsListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationsListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1.Operation.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates an OperationsListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.OperationsListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.OperationsListResponse} OperationsListResponse + */ + OperationsListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.OperationsListResponse) + return object; + var message = new $root.google.cloud.sql.v1.OperationsListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1.OperationsListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1.OperationsListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1.Operation.fromObject(object.items[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from an OperationsListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.OperationsListResponse + * @static + * @param {google.cloud.sql.v1.OperationsListResponse} message OperationsListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationsListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) { + object.kind = ""; + object.nextPageToken = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1.Operation.toObject(message.items[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this OperationsListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.OperationsListResponse + * @instance + * @returns {Object.} JSON object + */ + OperationsListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationsListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.OperationsListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.OperationsListResponse"; + }; + + return OperationsListResponse; + })(); + + v1.SqlOperationsCancelRequest = (function() { + + /** + * Properties of a SqlOperationsCancelRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlOperationsCancelRequest + * @property {string|null} [operation] SqlOperationsCancelRequest operation + * @property {string|null} [project] SqlOperationsCancelRequest project + */ + + /** + * Constructs a new SqlOperationsCancelRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlOperationsCancelRequest. + * @implements ISqlOperationsCancelRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest=} [properties] Properties to set + */ + function SqlOperationsCancelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlOperationsCancelRequest operation. + * @member {string} operation + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @instance + */ + SqlOperationsCancelRequest.prototype.operation = ""; + + /** + * SqlOperationsCancelRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @instance + */ + SqlOperationsCancelRequest.prototype.project = ""; + + /** + * Creates a new SqlOperationsCancelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @static + * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlOperationsCancelRequest} SqlOperationsCancelRequest instance + */ + SqlOperationsCancelRequest.create = function create(properties) { + return new SqlOperationsCancelRequest(properties); + }; + + /** + * Encodes the specified SqlOperationsCancelRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsCancelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @static + * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest} message SqlOperationsCancelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsCancelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.operation); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlOperationsCancelRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsCancelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @static + * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest} message SqlOperationsCancelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsCancelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlOperationsCancelRequest} SqlOperationsCancelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsCancelRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlOperationsCancelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.operation = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlOperationsCancelRequest} SqlOperationsCancelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsCancelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlOperationsCancelRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlOperationsCancelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operation != null && message.hasOwnProperty("operation")) + if (!$util.isString(message.operation)) + return "operation: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlOperationsCancelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlOperationsCancelRequest} SqlOperationsCancelRequest + */ + SqlOperationsCancelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlOperationsCancelRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlOperationsCancelRequest(); + if (object.operation != null) + message.operation = String(object.operation); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlOperationsCancelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @static + * @param {google.cloud.sql.v1.SqlOperationsCancelRequest} message SqlOperationsCancelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlOperationsCancelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.operation = ""; + object.project = ""; + } + if (message.operation != null && message.hasOwnProperty("operation")) + object.operation = message.operation; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlOperationsCancelRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @instance + * @returns {Object.} JSON object + */ + SqlOperationsCancelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlOperationsCancelRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlOperationsCancelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlOperationsCancelRequest"; + }; + + return SqlOperationsCancelRequest; + })(); + + v1.SqlRegionsService = (function() { + + /** + * Constructs a new SqlRegionsService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlRegionsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlRegionsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlRegionsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlRegionsService; + + /** + * Creates new SqlRegionsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlRegionsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlRegionsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlRegionsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + return SqlRegionsService; + })(); + + v1.SqlSslCertsService = (function() { + + /** + * Constructs a new SqlSslCertsService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlSslCertsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlSslCertsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlSslCertsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlSslCertsService; + + /** + * Creates new SqlSslCertsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlSslCertsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlSslCertsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|delete_}. + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @typedef DeleteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest} request SqlSslCertsDeleteRequest message or plain object + * @param {google.cloud.sql.v1.SqlSslCertsService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlSslCertsService.prototype["delete"] = function delete_(request, callback) { + return this.rpcCall(delete_, $root.google.cloud.sql.v1.SqlSslCertsDeleteRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Delete" }); + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest} request SqlSslCertsDeleteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|get}. + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.SslCert} [response] SslCert + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest} request SqlSslCertsGetRequest message or plain object + * @param {google.cloud.sql.v1.SqlSslCertsService.GetCallback} callback Node-style callback called with the error, if any, and SslCert + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlSslCertsService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1.SqlSslCertsGetRequest, $root.google.cloud.sql.v1.SslCert, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest} request SqlSslCertsGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|insert}. + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @typedef InsertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.SslCertsInsertResponse} [response] SslCertsInsertResponse + */ + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest} request SqlSslCertsInsertRequest message or plain object + * @param {google.cloud.sql.v1.SqlSslCertsService.InsertCallback} callback Node-style callback called with the error, if any, and SslCertsInsertResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlSslCertsService.prototype.insert = function insert(request, callback) { + return this.rpcCall(insert, $root.google.cloud.sql.v1.SqlSslCertsInsertRequest, $root.google.cloud.sql.v1.SslCertsInsertResponse, request, callback); + }, "name", { value: "Insert" }); + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest} request SqlSslCertsInsertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|list}. + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.SslCertsListResponse} [response] SslCertsListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1.ISqlSslCertsListRequest} request SqlSslCertsListRequest message or plain object + * @param {google.cloud.sql.v1.SqlSslCertsService.ListCallback} callback Node-style callback called with the error, if any, and SslCertsListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlSslCertsService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1.SqlSslCertsListRequest, $root.google.cloud.sql.v1.SslCertsListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1.ISqlSslCertsListRequest} request SqlSslCertsListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlSslCertsService; + })(); + + v1.SqlSslCertsDeleteRequest = (function() { + + /** + * Properties of a SqlSslCertsDeleteRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlSslCertsDeleteRequest + * @property {string|null} [instance] SqlSslCertsDeleteRequest instance + * @property {string|null} [project] SqlSslCertsDeleteRequest project + * @property {string|null} [sha1Fingerprint] SqlSslCertsDeleteRequest sha1Fingerprint + */ + + /** + * Constructs a new SqlSslCertsDeleteRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlSslCertsDeleteRequest. + * @implements ISqlSslCertsDeleteRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest=} [properties] Properties to set + */ + function SqlSslCertsDeleteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlSslCertsDeleteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @instance + */ + SqlSslCertsDeleteRequest.prototype.instance = ""; + + /** + * SqlSslCertsDeleteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @instance + */ + SqlSslCertsDeleteRequest.prototype.project = ""; + + /** + * SqlSslCertsDeleteRequest sha1Fingerprint. + * @member {string} sha1Fingerprint + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @instance + */ + SqlSslCertsDeleteRequest.prototype.sha1Fingerprint = ""; + + /** + * Creates a new SqlSslCertsDeleteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest instance + */ + SqlSslCertsDeleteRequest.create = function create(properties) { + return new SqlSslCertsDeleteRequest(properties); + }; + + /** + * Encodes the specified SqlSslCertsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsDeleteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsDeleteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sha1Fingerprint); + return writer; + }; + + /** + * Encodes the specified SqlSslCertsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsDeleteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsDeleteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlSslCertsDeleteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.sha1Fingerprint = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsDeleteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlSslCertsDeleteRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlSslCertsDeleteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + if (!$util.isString(message.sha1Fingerprint)) + return "sha1Fingerprint: string expected"; + return null; + }; + + /** + * Creates a SqlSslCertsDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest + */ + SqlSslCertsDeleteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlSslCertsDeleteRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlSslCertsDeleteRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.sha1Fingerprint != null) + message.sha1Fingerprint = String(object.sha1Fingerprint); + return message; + }; + + /** + * Creates a plain object from a SqlSslCertsDeleteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @static + * @param {google.cloud.sql.v1.SqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlSslCertsDeleteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.sha1Fingerprint = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + object.sha1Fingerprint = message.sha1Fingerprint; + return object; + }; + + /** + * Converts this SqlSslCertsDeleteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlSslCertsDeleteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlSslCertsDeleteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlSslCertsDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlSslCertsDeleteRequest"; + }; + + return SqlSslCertsDeleteRequest; + })(); + + v1.SqlSslCertsGetRequest = (function() { + + /** + * Properties of a SqlSslCertsGetRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlSslCertsGetRequest + * @property {string|null} [instance] SqlSslCertsGetRequest instance + * @property {string|null} [project] SqlSslCertsGetRequest project + * @property {string|null} [sha1Fingerprint] SqlSslCertsGetRequest sha1Fingerprint + */ + + /** + * Constructs a new SqlSslCertsGetRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlSslCertsGetRequest. + * @implements ISqlSslCertsGetRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest=} [properties] Properties to set + */ + function SqlSslCertsGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlSslCertsGetRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @instance + */ + SqlSslCertsGetRequest.prototype.instance = ""; + + /** + * SqlSslCertsGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @instance + */ + SqlSslCertsGetRequest.prototype.project = ""; + + /** + * SqlSslCertsGetRequest sha1Fingerprint. + * @member {string} sha1Fingerprint + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @instance + */ + SqlSslCertsGetRequest.prototype.sha1Fingerprint = ""; + + /** + * Creates a new SqlSslCertsGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlSslCertsGetRequest} SqlSslCertsGetRequest instance + */ + SqlSslCertsGetRequest.create = function create(properties) { + return new SqlSslCertsGetRequest(properties); + }; + + /** + * Encodes the specified SqlSslCertsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest} message SqlSslCertsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sha1Fingerprint); + return writer; + }; + + /** + * Encodes the specified SqlSslCertsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest} message SqlSslCertsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlSslCertsGetRequest} SqlSslCertsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlSslCertsGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.sha1Fingerprint = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlSslCertsGetRequest} SqlSslCertsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlSslCertsGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlSslCertsGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + if (!$util.isString(message.sha1Fingerprint)) + return "sha1Fingerprint: string expected"; + return null; + }; + + /** + * Creates a SqlSslCertsGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlSslCertsGetRequest} SqlSslCertsGetRequest + */ + SqlSslCertsGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlSslCertsGetRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlSslCertsGetRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.sha1Fingerprint != null) + message.sha1Fingerprint = String(object.sha1Fingerprint); + return message; + }; + + /** + * Creates a plain object from a SqlSslCertsGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @static + * @param {google.cloud.sql.v1.SqlSslCertsGetRequest} message SqlSslCertsGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlSslCertsGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.sha1Fingerprint = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + object.sha1Fingerprint = message.sha1Fingerprint; + return object; + }; + + /** + * Converts this SqlSslCertsGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlSslCertsGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlSslCertsGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlSslCertsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlSslCertsGetRequest"; + }; + + return SqlSslCertsGetRequest; + })(); + + v1.SqlSslCertsInsertRequest = (function() { + + /** + * Properties of a SqlSslCertsInsertRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlSslCertsInsertRequest + * @property {string|null} [instance] SqlSslCertsInsertRequest instance + * @property {string|null} [project] SqlSslCertsInsertRequest project + * @property {google.cloud.sql.v1.ISslCertsInsertRequest|null} [body] SqlSslCertsInsertRequest body + */ + + /** + * Constructs a new SqlSslCertsInsertRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlSslCertsInsertRequest. + * @implements ISqlSslCertsInsertRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest=} [properties] Properties to set + */ + function SqlSslCertsInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlSslCertsInsertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @instance + */ + SqlSslCertsInsertRequest.prototype.instance = ""; + + /** + * SqlSslCertsInsertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @instance + */ + SqlSslCertsInsertRequest.prototype.project = ""; + + /** + * SqlSslCertsInsertRequest body. + * @member {google.cloud.sql.v1.ISslCertsInsertRequest|null|undefined} body + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @instance + */ + SqlSslCertsInsertRequest.prototype.body = null; + + /** + * Creates a new SqlSslCertsInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest instance + */ + SqlSslCertsInsertRequest.create = function create(properties) { + return new SqlSslCertsInsertRequest(properties); + }; + + /** + * Encodes the specified SqlSslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest} message SqlSslCertsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.SslCertsInsertRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlSslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest} message SqlSslCertsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlSslCertsInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.SslCertsInsertRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlSslCertsInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlSslCertsInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.SslCertsInsertRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlSslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest + */ + SqlSslCertsInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlSslCertsInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlSslCertsInsertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlSslCertsInsertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.SslCertsInsertRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlSslCertsInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1.SqlSslCertsInsertRequest} message SqlSslCertsInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlSslCertsInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.SslCertsInsertRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlSslCertsInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlSslCertsInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlSslCertsInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlSslCertsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlSslCertsInsertRequest"; + }; + + return SqlSslCertsInsertRequest; + })(); + + v1.SqlSslCertsListRequest = (function() { + + /** + * Properties of a SqlSslCertsListRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlSslCertsListRequest + * @property {string|null} [instance] SqlSslCertsListRequest instance + * @property {string|null} [project] SqlSslCertsListRequest project + */ + + /** + * Constructs a new SqlSslCertsListRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlSslCertsListRequest. + * @implements ISqlSslCertsListRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlSslCertsListRequest=} [properties] Properties to set + */ + function SqlSslCertsListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlSslCertsListRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @instance + */ + SqlSslCertsListRequest.prototype.instance = ""; + + /** + * SqlSslCertsListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @instance + */ + SqlSslCertsListRequest.prototype.project = ""; + + /** + * Creates a new SqlSslCertsListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlSslCertsListRequest} SqlSslCertsListRequest instance + */ + SqlSslCertsListRequest.create = function create(properties) { + return new SqlSslCertsListRequest(properties); + }; + + /** + * Encodes the specified SqlSslCertsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsListRequest} message SqlSslCertsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlSslCertsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @static + * @param {google.cloud.sql.v1.ISqlSslCertsListRequest} message SqlSslCertsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlSslCertsListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlSslCertsListRequest} SqlSslCertsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlSslCertsListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlSslCertsListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlSslCertsListRequest} SqlSslCertsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlSslCertsListRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlSslCertsListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlSslCertsListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlSslCertsListRequest} SqlSslCertsListRequest + */ + SqlSslCertsListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlSslCertsListRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlSslCertsListRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlSslCertsListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @static + * @param {google.cloud.sql.v1.SqlSslCertsListRequest} message SqlSslCertsListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlSslCertsListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlSslCertsListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlSslCertsListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlSslCertsListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlSslCertsListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlSslCertsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlSslCertsListRequest"; + }; + + return SqlSslCertsListRequest; + })(); + + v1.SslCertsInsertRequest = (function() { + + /** + * Properties of a SslCertsInsertRequest. + * @memberof google.cloud.sql.v1 + * @interface ISslCertsInsertRequest + * @property {string|null} [commonName] SslCertsInsertRequest commonName + */ + + /** + * Constructs a new SslCertsInsertRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SslCertsInsertRequest. + * @implements ISslCertsInsertRequest + * @constructor + * @param {google.cloud.sql.v1.ISslCertsInsertRequest=} [properties] Properties to set + */ + function SslCertsInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCertsInsertRequest commonName. + * @member {string} commonName + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @instance + */ + SslCertsInsertRequest.prototype.commonName = ""; + + /** + * Creates a new SslCertsInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1.ISslCertsInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SslCertsInsertRequest} SslCertsInsertRequest instance + */ + SslCertsInsertRequest.create = function create(properties) { + return new SslCertsInsertRequest(properties); + }; + + /** + * Encodes the specified SslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1.ISslCertsInsertRequest} message SslCertsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonName != null && Object.hasOwnProperty.call(message, "commonName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.commonName); + return writer; + }; + + /** + * Encodes the specified SslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1.ISslCertsInsertRequest} message SslCertsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCertsInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SslCertsInsertRequest} SslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCertsInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.commonName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCertsInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SslCertsInsertRequest} SslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCertsInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCertsInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonName != null && message.hasOwnProperty("commonName")) + if (!$util.isString(message.commonName)) + return "commonName: string expected"; + return null; + }; + + /** + * Creates a SslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SslCertsInsertRequest} SslCertsInsertRequest + */ + SslCertsInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SslCertsInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1.SslCertsInsertRequest(); + if (object.commonName != null) + message.commonName = String(object.commonName); + return message; + }; + + /** + * Creates a plain object from a SslCertsInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1.SslCertsInsertRequest} message SslCertsInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCertsInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonName = ""; + if (message.commonName != null && message.hasOwnProperty("commonName")) + object.commonName = message.commonName; + return object; + }; + + /** + * Converts this SslCertsInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SslCertsInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCertsInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SslCertsInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCertsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SslCertsInsertRequest"; + }; + + return SslCertsInsertRequest; + })(); + + v1.SslCertsInsertResponse = (function() { + + /** + * Properties of a SslCertsInsertResponse. + * @memberof google.cloud.sql.v1 + * @interface ISslCertsInsertResponse + * @property {string|null} [kind] SslCertsInsertResponse kind + * @property {google.cloud.sql.v1.IOperation|null} [operation] SslCertsInsertResponse operation + * @property {google.cloud.sql.v1.ISslCert|null} [serverCaCert] SslCertsInsertResponse serverCaCert + * @property {google.cloud.sql.v1.ISslCertDetail|null} [clientCert] SslCertsInsertResponse clientCert + */ + + /** + * Constructs a new SslCertsInsertResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SslCertsInsertResponse. + * @implements ISslCertsInsertResponse + * @constructor + * @param {google.cloud.sql.v1.ISslCertsInsertResponse=} [properties] Properties to set + */ + function SslCertsInsertResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCertsInsertResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @instance + */ + SslCertsInsertResponse.prototype.kind = ""; + + /** + * SslCertsInsertResponse operation. + * @member {google.cloud.sql.v1.IOperation|null|undefined} operation + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @instance + */ + SslCertsInsertResponse.prototype.operation = null; + + /** + * SslCertsInsertResponse serverCaCert. + * @member {google.cloud.sql.v1.ISslCert|null|undefined} serverCaCert + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @instance + */ + SslCertsInsertResponse.prototype.serverCaCert = null; + + /** + * SslCertsInsertResponse clientCert. + * @member {google.cloud.sql.v1.ISslCertDetail|null|undefined} clientCert + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @instance + */ + SslCertsInsertResponse.prototype.clientCert = null; + + /** + * Creates a new SslCertsInsertResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @static + * @param {google.cloud.sql.v1.ISslCertsInsertResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SslCertsInsertResponse} SslCertsInsertResponse instance + */ + SslCertsInsertResponse.create = function create(properties) { + return new SslCertsInsertResponse(properties); + }; + + /** + * Encodes the specified SslCertsInsertResponse message. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @static + * @param {google.cloud.sql.v1.ISslCertsInsertResponse} message SslCertsInsertResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsInsertResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + $root.google.cloud.sql.v1.Operation.encode(message.operation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) + $root.google.cloud.sql.v1.SslCert.encode(message.serverCaCert, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.clientCert != null && Object.hasOwnProperty.call(message, "clientCert")) + $root.google.cloud.sql.v1.SslCertDetail.encode(message.clientCert, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SslCertsInsertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @static + * @param {google.cloud.sql.v1.ISslCertsInsertResponse} message SslCertsInsertResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsInsertResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCertsInsertResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SslCertsInsertResponse} SslCertsInsertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsInsertResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCertsInsertResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.operation = $root.google.cloud.sql.v1.Operation.decode(reader, reader.uint32()); + break; + } + case 3: { + message.serverCaCert = $root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32()); + break; + } + case 4: { + message.clientCert = $root.google.cloud.sql.v1.SslCertDetail.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCertsInsertResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SslCertsInsertResponse} SslCertsInsertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsInsertResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCertsInsertResponse message. + * @function verify + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCertsInsertResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.operation != null && message.hasOwnProperty("operation")) { + var error = $root.google.cloud.sql.v1.Operation.verify(message.operation); + if (error) + return "operation." + error; + } + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { + var error = $root.google.cloud.sql.v1.SslCert.verify(message.serverCaCert); + if (error) + return "serverCaCert." + error; + } + if (message.clientCert != null && message.hasOwnProperty("clientCert")) { + var error = $root.google.cloud.sql.v1.SslCertDetail.verify(message.clientCert); + if (error) + return "clientCert." + error; + } + return null; + }; + + /** + * Creates a SslCertsInsertResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SslCertsInsertResponse} SslCertsInsertResponse + */ + SslCertsInsertResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SslCertsInsertResponse) + return object; + var message = new $root.google.cloud.sql.v1.SslCertsInsertResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.operation != null) { + if (typeof object.operation !== "object") + throw TypeError(".google.cloud.sql.v1.SslCertsInsertResponse.operation: object expected"); + message.operation = $root.google.cloud.sql.v1.Operation.fromObject(object.operation); + } + if (object.serverCaCert != null) { + if (typeof object.serverCaCert !== "object") + throw TypeError(".google.cloud.sql.v1.SslCertsInsertResponse.serverCaCert: object expected"); + message.serverCaCert = $root.google.cloud.sql.v1.SslCert.fromObject(object.serverCaCert); + } + if (object.clientCert != null) { + if (typeof object.clientCert !== "object") + throw TypeError(".google.cloud.sql.v1.SslCertsInsertResponse.clientCert: object expected"); + message.clientCert = $root.google.cloud.sql.v1.SslCertDetail.fromObject(object.clientCert); + } + return message; + }; + + /** + * Creates a plain object from a SslCertsInsertResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @static + * @param {google.cloud.sql.v1.SslCertsInsertResponse} message SslCertsInsertResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCertsInsertResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.operation = null; + object.serverCaCert = null; + object.clientCert = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.operation != null && message.hasOwnProperty("operation")) + object.operation = $root.google.cloud.sql.v1.Operation.toObject(message.operation, options); + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) + object.serverCaCert = $root.google.cloud.sql.v1.SslCert.toObject(message.serverCaCert, options); + if (message.clientCert != null && message.hasOwnProperty("clientCert")) + object.clientCert = $root.google.cloud.sql.v1.SslCertDetail.toObject(message.clientCert, options); + return object; + }; + + /** + * Converts this SslCertsInsertResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @instance + * @returns {Object.} JSON object + */ + SslCertsInsertResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCertsInsertResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SslCertsInsertResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCertsInsertResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SslCertsInsertResponse"; + }; + + return SslCertsInsertResponse; + })(); + + v1.SslCertsListResponse = (function() { + + /** + * Properties of a SslCertsListResponse. + * @memberof google.cloud.sql.v1 + * @interface ISslCertsListResponse + * @property {string|null} [kind] SslCertsListResponse kind + * @property {Array.|null} [items] SslCertsListResponse items + */ + + /** + * Constructs a new SslCertsListResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SslCertsListResponse. + * @implements ISslCertsListResponse + * @constructor + * @param {google.cloud.sql.v1.ISslCertsListResponse=} [properties] Properties to set + */ + function SslCertsListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCertsListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @instance + */ + SslCertsListResponse.prototype.kind = ""; + + /** + * SslCertsListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @instance + */ + SslCertsListResponse.prototype.items = $util.emptyArray; + + /** + * Creates a new SslCertsListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @static + * @param {google.cloud.sql.v1.ISslCertsListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SslCertsListResponse} SslCertsListResponse instance + */ + SslCertsListResponse.create = function create(properties) { + return new SslCertsListResponse(properties); + }; + + /** + * Encodes the specified SslCertsListResponse message. Does not implicitly {@link google.cloud.sql.v1.SslCertsListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @static + * @param {google.cloud.sql.v1.ISslCertsListResponse} message SslCertsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1.SslCert.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SslCertsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @static + * @param {google.cloud.sql.v1.ISslCertsListResponse} message SslCertsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCertsListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SslCertsListResponse} SslCertsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCertsListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCertsListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SslCertsListResponse} SslCertsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCertsListResponse message. + * @function verify + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCertsListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1.SslCert.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a SslCertsListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SslCertsListResponse} SslCertsListResponse + */ + SslCertsListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SslCertsListResponse) + return object; + var message = new $root.google.cloud.sql.v1.SslCertsListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1.SslCertsListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1.SslCertsListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1.SslCert.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SslCertsListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @static + * @param {google.cloud.sql.v1.SslCertsListResponse} message SslCertsListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCertsListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1.SslCert.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this SslCertsListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @instance + * @returns {Object.} JSON object + */ + SslCertsListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCertsListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SslCertsListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCertsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SslCertsListResponse"; + }; + + return SslCertsListResponse; + })(); + + v1.SqlTiersService = (function() { + + /** + * Constructs a new SqlTiersService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlTiersService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlTiersService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlTiersService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlTiersService; + + /** + * Creates new SqlTiersService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlTiersService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlTiersService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlTiersService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlTiersService|list}. + * @memberof google.cloud.sql.v1.SqlTiersService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.TiersListResponse} [response] TiersListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlTiersService + * @instance + * @param {google.cloud.sql.v1.ISqlTiersListRequest} request SqlTiersListRequest message or plain object + * @param {google.cloud.sql.v1.SqlTiersService.ListCallback} callback Node-style callback called with the error, if any, and TiersListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlTiersService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1.SqlTiersListRequest, $root.google.cloud.sql.v1.TiersListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlTiersService + * @instance + * @param {google.cloud.sql.v1.ISqlTiersListRequest} request SqlTiersListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlTiersService; + })(); + + v1.SqlTiersListRequest = (function() { + + /** + * Properties of a SqlTiersListRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlTiersListRequest + * @property {string|null} [project] SqlTiersListRequest project + */ + + /** + * Constructs a new SqlTiersListRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlTiersListRequest. + * @implements ISqlTiersListRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlTiersListRequest=} [properties] Properties to set + */ + function SqlTiersListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlTiersListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @instance + */ + SqlTiersListRequest.prototype.project = ""; + + /** + * Creates a new SqlTiersListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @static + * @param {google.cloud.sql.v1.ISqlTiersListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlTiersListRequest} SqlTiersListRequest instance + */ + SqlTiersListRequest.create = function create(properties) { + return new SqlTiersListRequest(properties); + }; + + /** + * Encodes the specified SqlTiersListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlTiersListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @static + * @param {google.cloud.sql.v1.ISqlTiersListRequest} message SqlTiersListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTiersListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlTiersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlTiersListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @static + * @param {google.cloud.sql.v1.ISqlTiersListRequest} message SqlTiersListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTiersListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlTiersListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlTiersListRequest} SqlTiersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTiersListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlTiersListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlTiersListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlTiersListRequest} SqlTiersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTiersListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlTiersListRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlTiersListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlTiersListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlTiersListRequest} SqlTiersListRequest + */ + SqlTiersListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlTiersListRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlTiersListRequest(); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlTiersListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @static + * @param {google.cloud.sql.v1.SqlTiersListRequest} message SqlTiersListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlTiersListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.project = ""; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlTiersListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlTiersListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlTiersListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlTiersListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlTiersListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlTiersListRequest"; + }; + + return SqlTiersListRequest; + })(); + + v1.TiersListResponse = (function() { + + /** + * Properties of a TiersListResponse. + * @memberof google.cloud.sql.v1 + * @interface ITiersListResponse + * @property {string|null} [kind] TiersListResponse kind + * @property {Array.|null} [items] TiersListResponse items + */ + + /** + * Constructs a new TiersListResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a TiersListResponse. + * @implements ITiersListResponse + * @constructor + * @param {google.cloud.sql.v1.ITiersListResponse=} [properties] Properties to set + */ + function TiersListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TiersListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.TiersListResponse + * @instance + */ + TiersListResponse.prototype.kind = ""; + + /** + * TiersListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1.TiersListResponse + * @instance + */ + TiersListResponse.prototype.items = $util.emptyArray; + + /** + * Creates a new TiersListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.TiersListResponse + * @static + * @param {google.cloud.sql.v1.ITiersListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.TiersListResponse} TiersListResponse instance + */ + TiersListResponse.create = function create(properties) { + return new TiersListResponse(properties); + }; + + /** + * Encodes the specified TiersListResponse message. Does not implicitly {@link google.cloud.sql.v1.TiersListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.TiersListResponse + * @static + * @param {google.cloud.sql.v1.ITiersListResponse} message TiersListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TiersListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1.Tier.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TiersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.TiersListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.TiersListResponse + * @static + * @param {google.cloud.sql.v1.ITiersListResponse} message TiersListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TiersListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TiersListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.TiersListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.TiersListResponse} TiersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TiersListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.TiersListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1.Tier.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TiersListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.TiersListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.TiersListResponse} TiersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TiersListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TiersListResponse message. + * @function verify + * @memberof google.cloud.sql.v1.TiersListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TiersListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1.Tier.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a TiersListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.TiersListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.TiersListResponse} TiersListResponse + */ + TiersListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.TiersListResponse) + return object; + var message = new $root.google.cloud.sql.v1.TiersListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1.TiersListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1.TiersListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1.Tier.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TiersListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.TiersListResponse + * @static + * @param {google.cloud.sql.v1.TiersListResponse} message TiersListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TiersListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1.Tier.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this TiersListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.TiersListResponse + * @instance + * @returns {Object.} JSON object + */ + TiersListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TiersListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.TiersListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TiersListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.TiersListResponse"; + }; + + return TiersListResponse; + })(); + + v1.Tier = (function() { + + /** + * Properties of a Tier. + * @memberof google.cloud.sql.v1 + * @interface ITier + * @property {string|null} [tier] Tier tier + * @property {number|Long|null} [RAM] Tier RAM + * @property {string|null} [kind] Tier kind + * @property {number|Long|null} [Disk_Quota] Tier Disk_Quota + * @property {Array.|null} [region] Tier region + */ + + /** + * Constructs a new Tier. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a Tier. + * @implements ITier + * @constructor + * @param {google.cloud.sql.v1.ITier=} [properties] Properties to set + */ + function Tier(properties) { + this.region = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Tier tier. + * @member {string} tier + * @memberof google.cloud.sql.v1.Tier + * @instance + */ + Tier.prototype.tier = ""; + + /** + * Tier RAM. + * @member {number|Long} RAM + * @memberof google.cloud.sql.v1.Tier + * @instance + */ + Tier.prototype.RAM = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Tier kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.Tier + * @instance + */ + Tier.prototype.kind = ""; + + /** + * Tier Disk_Quota. + * @member {number|Long} Disk_Quota + * @memberof google.cloud.sql.v1.Tier + * @instance + */ + Tier.prototype.Disk_Quota = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Tier region. + * @member {Array.} region + * @memberof google.cloud.sql.v1.Tier + * @instance + */ + Tier.prototype.region = $util.emptyArray; + + /** + * Creates a new Tier instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.Tier + * @static + * @param {google.cloud.sql.v1.ITier=} [properties] Properties to set + * @returns {google.cloud.sql.v1.Tier} Tier instance + */ + Tier.create = function create(properties) { + return new Tier(properties); + }; + + /** + * Encodes the specified Tier message. Does not implicitly {@link google.cloud.sql.v1.Tier.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.Tier + * @static + * @param {google.cloud.sql.v1.ITier} message Tier message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Tier.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tier != null && Object.hasOwnProperty.call(message, "tier")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.tier); + if (message.RAM != null && Object.hasOwnProperty.call(message, "RAM")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.RAM); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + if (message.Disk_Quota != null && Object.hasOwnProperty.call(message, "Disk_Quota")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.Disk_Quota); + if (message.region != null && message.region.length) + for (var i = 0; i < message.region.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.region[i]); + return writer; + }; + + /** + * Encodes the specified Tier message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Tier.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.Tier + * @static + * @param {google.cloud.sql.v1.ITier} message Tier message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Tier.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Tier message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.Tier + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.Tier} Tier + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Tier.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Tier(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.tier = reader.string(); + break; + } + case 2: { + message.RAM = reader.int64(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + case 4: { + message.Disk_Quota = reader.int64(); + break; + } + case 5: { + if (!(message.region && message.region.length)) + message.region = []; + message.region.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Tier message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.Tier + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.Tier} Tier + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Tier.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Tier message. + * @function verify + * @memberof google.cloud.sql.v1.Tier + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Tier.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tier != null && message.hasOwnProperty("tier")) + if (!$util.isString(message.tier)) + return "tier: string expected"; + if (message.RAM != null && message.hasOwnProperty("RAM")) + if (!$util.isInteger(message.RAM) && !(message.RAM && $util.isInteger(message.RAM.low) && $util.isInteger(message.RAM.high))) + return "RAM: integer|Long expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.Disk_Quota != null && message.hasOwnProperty("Disk_Quota")) + if (!$util.isInteger(message.Disk_Quota) && !(message.Disk_Quota && $util.isInteger(message.Disk_Quota.low) && $util.isInteger(message.Disk_Quota.high))) + return "Disk_Quota: integer|Long expected"; + if (message.region != null && message.hasOwnProperty("region")) { + if (!Array.isArray(message.region)) + return "region: array expected"; + for (var i = 0; i < message.region.length; ++i) + if (!$util.isString(message.region[i])) + return "region: string[] expected"; + } + return null; + }; + + /** + * Creates a Tier message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.Tier + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.Tier} Tier + */ + Tier.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.Tier) + return object; + var message = new $root.google.cloud.sql.v1.Tier(); + if (object.tier != null) + message.tier = String(object.tier); + if (object.RAM != null) + if ($util.Long) + (message.RAM = $util.Long.fromValue(object.RAM)).unsigned = false; + else if (typeof object.RAM === "string") + message.RAM = parseInt(object.RAM, 10); + else if (typeof object.RAM === "number") + message.RAM = object.RAM; + else if (typeof object.RAM === "object") + message.RAM = new $util.LongBits(object.RAM.low >>> 0, object.RAM.high >>> 0).toNumber(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.Disk_Quota != null) + if ($util.Long) + (message.Disk_Quota = $util.Long.fromValue(object.Disk_Quota)).unsigned = false; + else if (typeof object.Disk_Quota === "string") + message.Disk_Quota = parseInt(object.Disk_Quota, 10); + else if (typeof object.Disk_Quota === "number") + message.Disk_Quota = object.Disk_Quota; + else if (typeof object.Disk_Quota === "object") + message.Disk_Quota = new $util.LongBits(object.Disk_Quota.low >>> 0, object.Disk_Quota.high >>> 0).toNumber(); + if (object.region) { + if (!Array.isArray(object.region)) + throw TypeError(".google.cloud.sql.v1.Tier.region: array expected"); + message.region = []; + for (var i = 0; i < object.region.length; ++i) + message.region[i] = String(object.region[i]); + } + return message; + }; + + /** + * Creates a plain object from a Tier message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.Tier + * @static + * @param {google.cloud.sql.v1.Tier} message Tier + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Tier.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.region = []; + if (options.defaults) { + object.tier = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.RAM = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.RAM = options.longs === String ? "0" : 0; + object.kind = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.Disk_Quota = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.Disk_Quota = options.longs === String ? "0" : 0; + } + if (message.tier != null && message.hasOwnProperty("tier")) + object.tier = message.tier; + if (message.RAM != null && message.hasOwnProperty("RAM")) + if (typeof message.RAM === "number") + object.RAM = options.longs === String ? String(message.RAM) : message.RAM; + else + object.RAM = options.longs === String ? $util.Long.prototype.toString.call(message.RAM) : options.longs === Number ? new $util.LongBits(message.RAM.low >>> 0, message.RAM.high >>> 0).toNumber() : message.RAM; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.Disk_Quota != null && message.hasOwnProperty("Disk_Quota")) + if (typeof message.Disk_Quota === "number") + object.Disk_Quota = options.longs === String ? String(message.Disk_Quota) : message.Disk_Quota; + else + object.Disk_Quota = options.longs === String ? $util.Long.prototype.toString.call(message.Disk_Quota) : options.longs === Number ? new $util.LongBits(message.Disk_Quota.low >>> 0, message.Disk_Quota.high >>> 0).toNumber() : message.Disk_Quota; + if (message.region && message.region.length) { + object.region = []; + for (var j = 0; j < message.region.length; ++j) + object.region[j] = message.region[j]; + } + return object; + }; + + /** + * Converts this Tier to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.Tier + * @instance + * @returns {Object.} JSON object + */ + Tier.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Tier + * @function getTypeUrl + * @memberof google.cloud.sql.v1.Tier + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Tier.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.Tier"; + }; + + return Tier; + })(); + + v1.SqlUsersService = (function() { + + /** + * Constructs a new SqlUsersService service. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlUsersService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlUsersService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlUsersService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlUsersService; + + /** + * Creates new SqlUsersService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1.SqlUsersService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlUsersService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlUsersService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|delete_}. + * @memberof google.cloud.sql.v1.SqlUsersService + * @typedef DeleteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1.SqlUsersService + * @instance + * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest} request SqlUsersDeleteRequest message or plain object + * @param {google.cloud.sql.v1.SqlUsersService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlUsersService.prototype["delete"] = function delete_(request, callback) { + return this.rpcCall(delete_, $root.google.cloud.sql.v1.SqlUsersDeleteRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Delete" }); + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1.SqlUsersService + * @instance + * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest} request SqlUsersDeleteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|get}. + * @memberof google.cloud.sql.v1.SqlUsersService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.User} [response] User + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlUsersService + * @instance + * @param {google.cloud.sql.v1.ISqlUsersGetRequest} request SqlUsersGetRequest message or plain object + * @param {google.cloud.sql.v1.SqlUsersService.GetCallback} callback Node-style callback called with the error, if any, and User + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlUsersService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1.SqlUsersGetRequest, $root.google.cloud.sql.v1.User, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1.SqlUsersService + * @instance + * @param {google.cloud.sql.v1.ISqlUsersGetRequest} request SqlUsersGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|insert}. + * @memberof google.cloud.sql.v1.SqlUsersService + * @typedef InsertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1.SqlUsersService + * @instance + * @param {google.cloud.sql.v1.ISqlUsersInsertRequest} request SqlUsersInsertRequest message or plain object + * @param {google.cloud.sql.v1.SqlUsersService.InsertCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlUsersService.prototype.insert = function insert(request, callback) { + return this.rpcCall(insert, $root.google.cloud.sql.v1.SqlUsersInsertRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Insert" }); + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1.SqlUsersService + * @instance + * @param {google.cloud.sql.v1.ISqlUsersInsertRequest} request SqlUsersInsertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|list}. + * @memberof google.cloud.sql.v1.SqlUsersService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.UsersListResponse} [response] UsersListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlUsersService + * @instance + * @param {google.cloud.sql.v1.ISqlUsersListRequest} request SqlUsersListRequest message or plain object + * @param {google.cloud.sql.v1.SqlUsersService.ListCallback} callback Node-style callback called with the error, if any, and UsersListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlUsersService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1.SqlUsersListRequest, $root.google.cloud.sql.v1.UsersListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1.SqlUsersService + * @instance + * @param {google.cloud.sql.v1.ISqlUsersListRequest} request SqlUsersListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|update}. + * @memberof google.cloud.sql.v1.SqlUsersService + * @typedef UpdateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1.Operation} [response] Operation + */ + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1.SqlUsersService + * @instance + * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest} request SqlUsersUpdateRequest message or plain object + * @param {google.cloud.sql.v1.SqlUsersService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlUsersService.prototype.update = function update(request, callback) { + return this.rpcCall(update, $root.google.cloud.sql.v1.SqlUsersUpdateRequest, $root.google.cloud.sql.v1.Operation, request, callback); + }, "name", { value: "Update" }); + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1.SqlUsersService + * @instance + * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest} request SqlUsersUpdateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlUsersService; + })(); + + v1.SqlUsersDeleteRequest = (function() { + + /** + * Properties of a SqlUsersDeleteRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlUsersDeleteRequest + * @property {string|null} [host] SqlUsersDeleteRequest host + * @property {string|null} [instance] SqlUsersDeleteRequest instance + * @property {string|null} [name] SqlUsersDeleteRequest name + * @property {string|null} [project] SqlUsersDeleteRequest project + */ + + /** + * Constructs a new SqlUsersDeleteRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlUsersDeleteRequest. + * @implements ISqlUsersDeleteRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest=} [properties] Properties to set + */ + function SqlUsersDeleteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlUsersDeleteRequest host. + * @member {string} host + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @instance + */ + SqlUsersDeleteRequest.prototype.host = ""; + + /** + * SqlUsersDeleteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @instance + */ + SqlUsersDeleteRequest.prototype.instance = ""; + + /** + * SqlUsersDeleteRequest name. + * @member {string} name + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @instance + */ + SqlUsersDeleteRequest.prototype.name = ""; + + /** + * SqlUsersDeleteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @instance + */ + SqlUsersDeleteRequest.prototype.project = ""; + + /** + * Creates a new SqlUsersDeleteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlUsersDeleteRequest} SqlUsersDeleteRequest instance + */ + SqlUsersDeleteRequest.create = function create(properties) { + return new SqlUsersDeleteRequest(properties); + }; + + /** + * Encodes the specified SqlUsersDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersDeleteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest} message SqlUsersDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersDeleteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.host != null && Object.hasOwnProperty.call(message, "host")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.host); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlUsersDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersDeleteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest} message SqlUsersDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlUsersDeleteRequest} SqlUsersDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersDeleteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlUsersDeleteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.host = reader.string(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.name = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlUsersDeleteRequest} SqlUsersDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersDeleteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlUsersDeleteRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlUsersDeleteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.host != null && message.hasOwnProperty("host")) + if (!$util.isString(message.host)) + return "host: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlUsersDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlUsersDeleteRequest} SqlUsersDeleteRequest + */ + SqlUsersDeleteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlUsersDeleteRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlUsersDeleteRequest(); + if (object.host != null) + message.host = String(object.host); + if (object.instance != null) + message.instance = String(object.instance); + if (object.name != null) + message.name = String(object.name); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlUsersDeleteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @static + * @param {google.cloud.sql.v1.SqlUsersDeleteRequest} message SqlUsersDeleteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlUsersDeleteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.host = ""; + object.instance = ""; + object.name = ""; + object.project = ""; + } + if (message.host != null && message.hasOwnProperty("host")) + object.host = message.host; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlUsersDeleteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlUsersDeleteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlUsersDeleteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlUsersDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlUsersDeleteRequest"; + }; + + return SqlUsersDeleteRequest; + })(); + + v1.SqlUsersGetRequest = (function() { + + /** + * Properties of a SqlUsersGetRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlUsersGetRequest + * @property {string|null} [instance] SqlUsersGetRequest instance + * @property {string|null} [name] SqlUsersGetRequest name + * @property {string|null} [project] SqlUsersGetRequest project + * @property {string|null} [host] SqlUsersGetRequest host + */ + + /** + * Constructs a new SqlUsersGetRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlUsersGetRequest. + * @implements ISqlUsersGetRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlUsersGetRequest=} [properties] Properties to set + */ + function SqlUsersGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlUsersGetRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @instance + */ + SqlUsersGetRequest.prototype.instance = ""; + + /** + * SqlUsersGetRequest name. + * @member {string} name + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @instance + */ + SqlUsersGetRequest.prototype.name = ""; + + /** + * SqlUsersGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @instance + */ + SqlUsersGetRequest.prototype.project = ""; + + /** + * SqlUsersGetRequest host. + * @member {string} host + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @instance + */ + SqlUsersGetRequest.prototype.host = ""; + + /** + * Creates a new SqlUsersGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlUsersGetRequest} SqlUsersGetRequest instance + */ + SqlUsersGetRequest.create = function create(properties) { + return new SqlUsersGetRequest(properties); + }; + + /** + * Encodes the specified SqlUsersGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersGetRequest} message SqlUsersGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + if (message.host != null && Object.hasOwnProperty.call(message, "host")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.host); + return writer; + }; + + /** + * Encodes the specified SqlUsersGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersGetRequest} message SqlUsersGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlUsersGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlUsersGetRequest} SqlUsersGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlUsersGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.name = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + case 4: { + message.host = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlUsersGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlUsersGetRequest} SqlUsersGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlUsersGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlUsersGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.host != null && message.hasOwnProperty("host")) + if (!$util.isString(message.host)) + return "host: string expected"; + return null; + }; + + /** + * Creates a SqlUsersGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlUsersGetRequest} SqlUsersGetRequest + */ + SqlUsersGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlUsersGetRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlUsersGetRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.name != null) + message.name = String(object.name); + if (object.project != null) + message.project = String(object.project); + if (object.host != null) + message.host = String(object.host); + return message; + }; + + /** + * Creates a plain object from a SqlUsersGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @static + * @param {google.cloud.sql.v1.SqlUsersGetRequest} message SqlUsersGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlUsersGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.name = ""; + object.project = ""; + object.host = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.host != null && message.hasOwnProperty("host")) + object.host = message.host; + return object; + }; + + /** + * Converts this SqlUsersGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlUsersGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlUsersGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlUsersGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlUsersGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlUsersGetRequest"; + }; + + return SqlUsersGetRequest; + })(); + + v1.SqlUsersInsertRequest = (function() { + + /** + * Properties of a SqlUsersInsertRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlUsersInsertRequest + * @property {string|null} [instance] SqlUsersInsertRequest instance + * @property {string|null} [project] SqlUsersInsertRequest project + * @property {google.cloud.sql.v1.IUser|null} [body] SqlUsersInsertRequest body + */ + + /** + * Constructs a new SqlUsersInsertRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlUsersInsertRequest. + * @implements ISqlUsersInsertRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlUsersInsertRequest=} [properties] Properties to set + */ + function SqlUsersInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlUsersInsertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @instance + */ + SqlUsersInsertRequest.prototype.instance = ""; + + /** + * SqlUsersInsertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @instance + */ + SqlUsersInsertRequest.prototype.project = ""; + + /** + * SqlUsersInsertRequest body. + * @member {google.cloud.sql.v1.IUser|null|undefined} body + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @instance + */ + SqlUsersInsertRequest.prototype.body = null; + + /** + * Creates a new SqlUsersInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlUsersInsertRequest} SqlUsersInsertRequest instance + */ + SqlUsersInsertRequest.create = function create(properties) { + return new SqlUsersInsertRequest(properties); + }; + + /** + * Encodes the specified SqlUsersInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersInsertRequest} message SqlUsersInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.User.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlUsersInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersInsertRequest} message SqlUsersInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlUsersInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlUsersInsertRequest} SqlUsersInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlUsersInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.User.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlUsersInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlUsersInsertRequest} SqlUsersInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlUsersInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlUsersInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.User.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlUsersInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlUsersInsertRequest} SqlUsersInsertRequest + */ + SqlUsersInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlUsersInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlUsersInsertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlUsersInsertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.User.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlUsersInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @static + * @param {google.cloud.sql.v1.SqlUsersInsertRequest} message SqlUsersInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlUsersInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.User.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlUsersInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlUsersInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlUsersInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlUsersInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlUsersInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlUsersInsertRequest"; + }; + + return SqlUsersInsertRequest; + })(); + + v1.SqlUsersListRequest = (function() { + + /** + * Properties of a SqlUsersListRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlUsersListRequest + * @property {string|null} [instance] SqlUsersListRequest instance + * @property {string|null} [project] SqlUsersListRequest project + */ + + /** + * Constructs a new SqlUsersListRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlUsersListRequest. + * @implements ISqlUsersListRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlUsersListRequest=} [properties] Properties to set + */ + function SqlUsersListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlUsersListRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @instance + */ + SqlUsersListRequest.prototype.instance = ""; + + /** + * SqlUsersListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @instance + */ + SqlUsersListRequest.prototype.project = ""; + + /** + * Creates a new SqlUsersListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlUsersListRequest} SqlUsersListRequest instance + */ + SqlUsersListRequest.create = function create(properties) { + return new SqlUsersListRequest(properties); + }; + + /** + * Encodes the specified SqlUsersListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersListRequest} message SqlUsersListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlUsersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersListRequest} message SqlUsersListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlUsersListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlUsersListRequest} SqlUsersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlUsersListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlUsersListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlUsersListRequest} SqlUsersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlUsersListRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlUsersListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlUsersListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlUsersListRequest} SqlUsersListRequest + */ + SqlUsersListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlUsersListRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlUsersListRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlUsersListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @static + * @param {google.cloud.sql.v1.SqlUsersListRequest} message SqlUsersListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlUsersListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlUsersListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlUsersListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlUsersListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlUsersListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlUsersListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlUsersListRequest"; + }; + + return SqlUsersListRequest; + })(); + + v1.SqlUsersUpdateRequest = (function() { + + /** + * Properties of a SqlUsersUpdateRequest. + * @memberof google.cloud.sql.v1 + * @interface ISqlUsersUpdateRequest + * @property {string|null} [host] SqlUsersUpdateRequest host + * @property {string|null} [instance] SqlUsersUpdateRequest instance + * @property {string|null} [name] SqlUsersUpdateRequest name + * @property {string|null} [project] SqlUsersUpdateRequest project + * @property {Array.|null} [databaseRoles] SqlUsersUpdateRequest databaseRoles + * @property {boolean|null} [revokeExistingRoles] SqlUsersUpdateRequest revokeExistingRoles + * @property {google.cloud.sql.v1.IUser|null} [body] SqlUsersUpdateRequest body + */ + + /** + * Constructs a new SqlUsersUpdateRequest. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlUsersUpdateRequest. + * @implements ISqlUsersUpdateRequest + * @constructor + * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest=} [properties] Properties to set + */ + function SqlUsersUpdateRequest(properties) { + this.databaseRoles = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlUsersUpdateRequest host. + * @member {string} host + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.host = ""; + + /** + * SqlUsersUpdateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.instance = ""; + + /** + * SqlUsersUpdateRequest name. + * @member {string} name + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.name = ""; + + /** + * SqlUsersUpdateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.project = ""; + + /** + * SqlUsersUpdateRequest databaseRoles. + * @member {Array.} databaseRoles + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.databaseRoles = $util.emptyArray; + + /** + * SqlUsersUpdateRequest revokeExistingRoles. + * @member {boolean|null|undefined} revokeExistingRoles + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.revokeExistingRoles = null; + + /** + * SqlUsersUpdateRequest body. + * @member {google.cloud.sql.v1.IUser|null|undefined} body + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.body = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlUsersUpdateRequest.prototype, "_revokeExistingRoles", { + get: $util.oneOfGetter($oneOfFields = ["revokeExistingRoles"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlUsersUpdateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlUsersUpdateRequest} SqlUsersUpdateRequest instance + */ + SqlUsersUpdateRequest.create = function create(properties) { + return new SqlUsersUpdateRequest(properties); + }; + + /** + * Encodes the specified SqlUsersUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersUpdateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest} message SqlUsersUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersUpdateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.host != null && Object.hasOwnProperty.call(message, "host")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.host); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + if (message.databaseRoles != null && message.databaseRoles.length) + for (var i = 0; i < message.databaseRoles.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.databaseRoles[i]); + if (message.revokeExistingRoles != null && Object.hasOwnProperty.call(message, "revokeExistingRoles")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.revokeExistingRoles); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1.User.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlUsersUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersUpdateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @static + * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest} message SqlUsersUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlUsersUpdateRequest} SqlUsersUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersUpdateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlUsersUpdateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.host = reader.string(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.name = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + case 5: { + if (!(message.databaseRoles && message.databaseRoles.length)) + message.databaseRoles = []; + message.databaseRoles.push(reader.string()); + break; + } + case 6: { + message.revokeExistingRoles = reader.bool(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1.User.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlUsersUpdateRequest} SqlUsersUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersUpdateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlUsersUpdateRequest message. + * @function verify + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlUsersUpdateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.host != null && message.hasOwnProperty("host")) + if (!$util.isString(message.host)) + return "host: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.databaseRoles != null && message.hasOwnProperty("databaseRoles")) { + if (!Array.isArray(message.databaseRoles)) + return "databaseRoles: array expected"; + for (var i = 0; i < message.databaseRoles.length; ++i) + if (!$util.isString(message.databaseRoles[i])) + return "databaseRoles: string[] expected"; + } + if (message.revokeExistingRoles != null && message.hasOwnProperty("revokeExistingRoles")) { + properties._revokeExistingRoles = 1; + if (typeof message.revokeExistingRoles !== "boolean") + return "revokeExistingRoles: boolean expected"; + } + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1.User.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlUsersUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlUsersUpdateRequest} SqlUsersUpdateRequest + */ + SqlUsersUpdateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlUsersUpdateRequest) + return object; + var message = new $root.google.cloud.sql.v1.SqlUsersUpdateRequest(); + if (object.host != null) + message.host = String(object.host); + if (object.instance != null) + message.instance = String(object.instance); + if (object.name != null) + message.name = String(object.name); + if (object.project != null) + message.project = String(object.project); + if (object.databaseRoles) { + if (!Array.isArray(object.databaseRoles)) + throw TypeError(".google.cloud.sql.v1.SqlUsersUpdateRequest.databaseRoles: array expected"); + message.databaseRoles = []; + for (var i = 0; i < object.databaseRoles.length; ++i) + message.databaseRoles[i] = String(object.databaseRoles[i]); + } + if (object.revokeExistingRoles != null) + message.revokeExistingRoles = Boolean(object.revokeExistingRoles); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1.SqlUsersUpdateRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1.User.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlUsersUpdateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @static + * @param {google.cloud.sql.v1.SqlUsersUpdateRequest} message SqlUsersUpdateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlUsersUpdateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.databaseRoles = []; + if (options.defaults) { + object.host = ""; + object.instance = ""; + object.name = ""; + object.project = ""; + object.body = null; + } + if (message.host != null && message.hasOwnProperty("host")) + object.host = message.host; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.databaseRoles && message.databaseRoles.length) { + object.databaseRoles = []; + for (var j = 0; j < message.databaseRoles.length; ++j) + object.databaseRoles[j] = message.databaseRoles[j]; + } + if (message.revokeExistingRoles != null && message.hasOwnProperty("revokeExistingRoles")) { + object.revokeExistingRoles = message.revokeExistingRoles; + if (options.oneofs) + object._revokeExistingRoles = "revokeExistingRoles"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1.User.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlUsersUpdateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlUsersUpdateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlUsersUpdateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlUsersUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlUsersUpdateRequest"; + }; + + return SqlUsersUpdateRequest; + })(); + + v1.UserPasswordValidationPolicy = (function() { + + /** + * Properties of a UserPasswordValidationPolicy. + * @memberof google.cloud.sql.v1 + * @interface IUserPasswordValidationPolicy + * @property {number|null} [allowedFailedAttempts] UserPasswordValidationPolicy allowedFailedAttempts + * @property {google.protobuf.IDuration|null} [passwordExpirationDuration] UserPasswordValidationPolicy passwordExpirationDuration + * @property {boolean|null} [enableFailedAttemptsCheck] UserPasswordValidationPolicy enableFailedAttemptsCheck + * @property {google.cloud.sql.v1.IPasswordStatus|null} [status] UserPasswordValidationPolicy status + * @property {boolean|null} [enablePasswordVerification] UserPasswordValidationPolicy enablePasswordVerification + */ + + /** + * Constructs a new UserPasswordValidationPolicy. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a UserPasswordValidationPolicy. + * @implements IUserPasswordValidationPolicy + * @constructor + * @param {google.cloud.sql.v1.IUserPasswordValidationPolicy=} [properties] Properties to set + */ + function UserPasswordValidationPolicy(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserPasswordValidationPolicy allowedFailedAttempts. + * @member {number} allowedFailedAttempts + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @instance + */ + UserPasswordValidationPolicy.prototype.allowedFailedAttempts = 0; + + /** + * UserPasswordValidationPolicy passwordExpirationDuration. + * @member {google.protobuf.IDuration|null|undefined} passwordExpirationDuration + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @instance + */ + UserPasswordValidationPolicy.prototype.passwordExpirationDuration = null; + + /** + * UserPasswordValidationPolicy enableFailedAttemptsCheck. + * @member {boolean} enableFailedAttemptsCheck + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @instance + */ + UserPasswordValidationPolicy.prototype.enableFailedAttemptsCheck = false; + + /** + * UserPasswordValidationPolicy status. + * @member {google.cloud.sql.v1.IPasswordStatus|null|undefined} status + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @instance + */ + UserPasswordValidationPolicy.prototype.status = null; + + /** + * UserPasswordValidationPolicy enablePasswordVerification. + * @member {boolean} enablePasswordVerification + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @instance + */ + UserPasswordValidationPolicy.prototype.enablePasswordVerification = false; + + /** + * Creates a new UserPasswordValidationPolicy instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1.IUserPasswordValidationPolicy=} [properties] Properties to set + * @returns {google.cloud.sql.v1.UserPasswordValidationPolicy} UserPasswordValidationPolicy instance + */ + UserPasswordValidationPolicy.create = function create(properties) { + return new UserPasswordValidationPolicy(properties); + }; + + /** + * Encodes the specified UserPasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1.UserPasswordValidationPolicy.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1.IUserPasswordValidationPolicy} message UserPasswordValidationPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserPasswordValidationPolicy.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowedFailedAttempts != null && Object.hasOwnProperty.call(message, "allowedFailedAttempts")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.allowedFailedAttempts); + if (message.passwordExpirationDuration != null && Object.hasOwnProperty.call(message, "passwordExpirationDuration")) + $root.google.protobuf.Duration.encode(message.passwordExpirationDuration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.enableFailedAttemptsCheck != null && Object.hasOwnProperty.call(message, "enableFailedAttemptsCheck")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableFailedAttemptsCheck); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.cloud.sql.v1.PasswordStatus.encode(message.status, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enablePasswordVerification != null && Object.hasOwnProperty.call(message, "enablePasswordVerification")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.enablePasswordVerification); + return writer; + }; + + /** + * Encodes the specified UserPasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UserPasswordValidationPolicy.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1.IUserPasswordValidationPolicy} message UserPasswordValidationPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserPasswordValidationPolicy.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.UserPasswordValidationPolicy} UserPasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserPasswordValidationPolicy.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.UserPasswordValidationPolicy(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.allowedFailedAttempts = reader.int32(); + break; + } + case 2: { + message.passwordExpirationDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 3: { + message.enableFailedAttemptsCheck = reader.bool(); + break; + } + case 4: { + message.status = $root.google.cloud.sql.v1.PasswordStatus.decode(reader, reader.uint32()); + break; + } + case 5: { + message.enablePasswordVerification = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.UserPasswordValidationPolicy} UserPasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserPasswordValidationPolicy.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserPasswordValidationPolicy message. + * @function verify + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserPasswordValidationPolicy.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowedFailedAttempts != null && message.hasOwnProperty("allowedFailedAttempts")) + if (!$util.isInteger(message.allowedFailedAttempts)) + return "allowedFailedAttempts: integer expected"; + if (message.passwordExpirationDuration != null && message.hasOwnProperty("passwordExpirationDuration")) { + var error = $root.google.protobuf.Duration.verify(message.passwordExpirationDuration); + if (error) + return "passwordExpirationDuration." + error; + } + if (message.enableFailedAttemptsCheck != null && message.hasOwnProperty("enableFailedAttemptsCheck")) + if (typeof message.enableFailedAttemptsCheck !== "boolean") + return "enableFailedAttemptsCheck: boolean expected"; + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.cloud.sql.v1.PasswordStatus.verify(message.status); + if (error) + return "status." + error; + } + if (message.enablePasswordVerification != null && message.hasOwnProperty("enablePasswordVerification")) + if (typeof message.enablePasswordVerification !== "boolean") + return "enablePasswordVerification: boolean expected"; + return null; + }; + + /** + * Creates a UserPasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.UserPasswordValidationPolicy} UserPasswordValidationPolicy + */ + UserPasswordValidationPolicy.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.UserPasswordValidationPolicy) + return object; + var message = new $root.google.cloud.sql.v1.UserPasswordValidationPolicy(); + if (object.allowedFailedAttempts != null) + message.allowedFailedAttempts = object.allowedFailedAttempts | 0; + if (object.passwordExpirationDuration != null) { + if (typeof object.passwordExpirationDuration !== "object") + throw TypeError(".google.cloud.sql.v1.UserPasswordValidationPolicy.passwordExpirationDuration: object expected"); + message.passwordExpirationDuration = $root.google.protobuf.Duration.fromObject(object.passwordExpirationDuration); + } + if (object.enableFailedAttemptsCheck != null) + message.enableFailedAttemptsCheck = Boolean(object.enableFailedAttemptsCheck); + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.cloud.sql.v1.UserPasswordValidationPolicy.status: object expected"); + message.status = $root.google.cloud.sql.v1.PasswordStatus.fromObject(object.status); + } + if (object.enablePasswordVerification != null) + message.enablePasswordVerification = Boolean(object.enablePasswordVerification); + return message; + }; + + /** + * Creates a plain object from a UserPasswordValidationPolicy message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1.UserPasswordValidationPolicy} message UserPasswordValidationPolicy + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserPasswordValidationPolicy.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.allowedFailedAttempts = 0; + object.passwordExpirationDuration = null; + object.enableFailedAttemptsCheck = false; + object.status = null; + object.enablePasswordVerification = false; + } + if (message.allowedFailedAttempts != null && message.hasOwnProperty("allowedFailedAttempts")) + object.allowedFailedAttempts = message.allowedFailedAttempts; + if (message.passwordExpirationDuration != null && message.hasOwnProperty("passwordExpirationDuration")) + object.passwordExpirationDuration = $root.google.protobuf.Duration.toObject(message.passwordExpirationDuration, options); + if (message.enableFailedAttemptsCheck != null && message.hasOwnProperty("enableFailedAttemptsCheck")) + object.enableFailedAttemptsCheck = message.enableFailedAttemptsCheck; + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.cloud.sql.v1.PasswordStatus.toObject(message.status, options); + if (message.enablePasswordVerification != null && message.hasOwnProperty("enablePasswordVerification")) + object.enablePasswordVerification = message.enablePasswordVerification; + return object; + }; + + /** + * Converts this UserPasswordValidationPolicy to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @instance + * @returns {Object.} JSON object + */ + UserPasswordValidationPolicy.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UserPasswordValidationPolicy + * @function getTypeUrl + * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserPasswordValidationPolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.UserPasswordValidationPolicy"; + }; + + return UserPasswordValidationPolicy; + })(); + + v1.PasswordStatus = (function() { + + /** + * Properties of a PasswordStatus. + * @memberof google.cloud.sql.v1 + * @interface IPasswordStatus + * @property {boolean|null} [locked] PasswordStatus locked + * @property {google.protobuf.ITimestamp|null} [passwordExpirationTime] PasswordStatus passwordExpirationTime + */ + + /** + * Constructs a new PasswordStatus. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a PasswordStatus. + * @implements IPasswordStatus + * @constructor + * @param {google.cloud.sql.v1.IPasswordStatus=} [properties] Properties to set + */ + function PasswordStatus(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PasswordStatus locked. + * @member {boolean} locked + * @memberof google.cloud.sql.v1.PasswordStatus + * @instance + */ + PasswordStatus.prototype.locked = false; + + /** + * PasswordStatus passwordExpirationTime. + * @member {google.protobuf.ITimestamp|null|undefined} passwordExpirationTime + * @memberof google.cloud.sql.v1.PasswordStatus + * @instance + */ + PasswordStatus.prototype.passwordExpirationTime = null; + + /** + * Creates a new PasswordStatus instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.PasswordStatus + * @static + * @param {google.cloud.sql.v1.IPasswordStatus=} [properties] Properties to set + * @returns {google.cloud.sql.v1.PasswordStatus} PasswordStatus instance + */ + PasswordStatus.create = function create(properties) { + return new PasswordStatus(properties); + }; + + /** + * Encodes the specified PasswordStatus message. Does not implicitly {@link google.cloud.sql.v1.PasswordStatus.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.PasswordStatus + * @static + * @param {google.cloud.sql.v1.IPasswordStatus} message PasswordStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordStatus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.locked != null && Object.hasOwnProperty.call(message, "locked")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.locked); + if (message.passwordExpirationTime != null && Object.hasOwnProperty.call(message, "passwordExpirationTime")) + $root.google.protobuf.Timestamp.encode(message.passwordExpirationTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PasswordStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PasswordStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.PasswordStatus + * @static + * @param {google.cloud.sql.v1.IPasswordStatus} message PasswordStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordStatus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PasswordStatus message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.PasswordStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.PasswordStatus} PasswordStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordStatus.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PasswordStatus(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.locked = reader.bool(); + break; + } + case 2: { + message.passwordExpirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PasswordStatus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.PasswordStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.PasswordStatus} PasswordStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordStatus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PasswordStatus message. + * @function verify + * @memberof google.cloud.sql.v1.PasswordStatus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PasswordStatus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.locked != null && message.hasOwnProperty("locked")) + if (typeof message.locked !== "boolean") + return "locked: boolean expected"; + if (message.passwordExpirationTime != null && message.hasOwnProperty("passwordExpirationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.passwordExpirationTime); + if (error) + return "passwordExpirationTime." + error; + } + return null; + }; + + /** + * Creates a PasswordStatus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.PasswordStatus + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.PasswordStatus} PasswordStatus + */ + PasswordStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.PasswordStatus) + return object; + var message = new $root.google.cloud.sql.v1.PasswordStatus(); + if (object.locked != null) + message.locked = Boolean(object.locked); + if (object.passwordExpirationTime != null) { + if (typeof object.passwordExpirationTime !== "object") + throw TypeError(".google.cloud.sql.v1.PasswordStatus.passwordExpirationTime: object expected"); + message.passwordExpirationTime = $root.google.protobuf.Timestamp.fromObject(object.passwordExpirationTime); + } + return message; + }; + + /** + * Creates a plain object from a PasswordStatus message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.PasswordStatus + * @static + * @param {google.cloud.sql.v1.PasswordStatus} message PasswordStatus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PasswordStatus.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.locked = false; + object.passwordExpirationTime = null; + } + if (message.locked != null && message.hasOwnProperty("locked")) + object.locked = message.locked; + if (message.passwordExpirationTime != null && message.hasOwnProperty("passwordExpirationTime")) + object.passwordExpirationTime = $root.google.protobuf.Timestamp.toObject(message.passwordExpirationTime, options); + return object; + }; + + /** + * Converts this PasswordStatus to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.PasswordStatus + * @instance + * @returns {Object.} JSON object + */ + PasswordStatus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PasswordStatus + * @function getTypeUrl + * @memberof google.cloud.sql.v1.PasswordStatus + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PasswordStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.PasswordStatus"; + }; + + return PasswordStatus; + })(); + + v1.User = (function() { + + /** + * Properties of a User. + * @memberof google.cloud.sql.v1 + * @interface IUser + * @property {string|null} [kind] User kind + * @property {string|null} [password] User password + * @property {string|null} [etag] User etag + * @property {string|null} [name] User name + * @property {string|null} [host] User host + * @property {string|null} [instance] User instance + * @property {string|null} [project] User project + * @property {google.cloud.sql.v1.User.SqlUserType|null} [type] User type + * @property {google.cloud.sql.v1.ISqlServerUserDetails|null} [sqlserverUserDetails] User sqlserverUserDetails + * @property {string|null} [iamEmail] User iamEmail + * @property {google.cloud.sql.v1.IUserPasswordValidationPolicy|null} [passwordPolicy] User passwordPolicy + * @property {google.cloud.sql.v1.User.DualPasswordType|null} [dualPasswordType] User dualPasswordType + * @property {google.cloud.sql.v1.User.IamStatus|null} [iamStatus] User iamStatus + * @property {Array.|null} [databaseRoles] User databaseRoles + */ + + /** + * Constructs a new User. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a User. + * @implements IUser + * @constructor + * @param {google.cloud.sql.v1.IUser=} [properties] Properties to set + */ + function User(properties) { + this.databaseRoles = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * User kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.kind = ""; + + /** + * User password. + * @member {string} password + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.password = ""; + + /** + * User etag. + * @member {string} etag + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.etag = ""; + + /** + * User name. + * @member {string} name + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.name = ""; + + /** + * User host. + * @member {string} host + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.host = ""; + + /** + * User instance. + * @member {string} instance + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.instance = ""; + + /** + * User project. + * @member {string} project + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.project = ""; + + /** + * User type. + * @member {google.cloud.sql.v1.User.SqlUserType} type + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.type = 0; + + /** + * User sqlserverUserDetails. + * @member {google.cloud.sql.v1.ISqlServerUserDetails|null|undefined} sqlserverUserDetails + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.sqlserverUserDetails = null; + + /** + * User iamEmail. + * @member {string} iamEmail + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.iamEmail = ""; + + /** + * User passwordPolicy. + * @member {google.cloud.sql.v1.IUserPasswordValidationPolicy|null|undefined} passwordPolicy + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.passwordPolicy = null; + + /** + * User dualPasswordType. + * @member {google.cloud.sql.v1.User.DualPasswordType|null|undefined} dualPasswordType + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.dualPasswordType = null; + + /** + * User iamStatus. + * @member {google.cloud.sql.v1.User.IamStatus|null|undefined} iamStatus + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.iamStatus = null; + + /** + * User databaseRoles. + * @member {Array.} databaseRoles + * @memberof google.cloud.sql.v1.User + * @instance + */ + User.prototype.databaseRoles = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * User userDetails. + * @member {"sqlserverUserDetails"|undefined} userDetails + * @memberof google.cloud.sql.v1.User + * @instance + */ + Object.defineProperty(User.prototype, "userDetails", { + get: $util.oneOfGetter($oneOfFields = ["sqlserverUserDetails"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(User.prototype, "_dualPasswordType", { + get: $util.oneOfGetter($oneOfFields = ["dualPasswordType"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(User.prototype, "_iamStatus", { + get: $util.oneOfGetter($oneOfFields = ["iamStatus"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new User instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.User + * @static + * @param {google.cloud.sql.v1.IUser=} [properties] Properties to set + * @returns {google.cloud.sql.v1.User} User instance + */ + User.create = function create(properties) { + return new User(properties); + }; + + /** + * Encodes the specified User message. Does not implicitly {@link google.cloud.sql.v1.User.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.User + * @static + * @param {google.cloud.sql.v1.IUser} message User message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + User.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.password); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.etag); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + if (message.host != null && Object.hasOwnProperty.call(message, "host")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.host); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.project); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.type); + if (message.sqlserverUserDetails != null && Object.hasOwnProperty.call(message, "sqlserverUserDetails")) + $root.google.cloud.sql.v1.SqlServerUserDetails.encode(message.sqlserverUserDetails, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.iamEmail != null && Object.hasOwnProperty.call(message, "iamEmail")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.iamEmail); + if (message.passwordPolicy != null && Object.hasOwnProperty.call(message, "passwordPolicy")) + $root.google.cloud.sql.v1.UserPasswordValidationPolicy.encode(message.passwordPolicy, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.dualPasswordType != null && Object.hasOwnProperty.call(message, "dualPasswordType")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.dualPasswordType); + if (message.iamStatus != null && Object.hasOwnProperty.call(message, "iamStatus")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.iamStatus); + if (message.databaseRoles != null && message.databaseRoles.length) + for (var i = 0; i < message.databaseRoles.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.databaseRoles[i]); + return writer; + }; + + /** + * Encodes the specified User message, length delimited. Does not implicitly {@link google.cloud.sql.v1.User.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.User + * @static + * @param {google.cloud.sql.v1.IUser} message User message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + User.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a User message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.User + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.User} User + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + User.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.User(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.password = reader.string(); + break; + } + case 3: { + message.etag = reader.string(); + break; + } + case 4: { + message.name = reader.string(); + break; + } + case 5: { + message.host = reader.string(); + break; + } + case 6: { + message.instance = reader.string(); + break; + } + case 7: { + message.project = reader.string(); + break; + } + case 8: { + message.type = reader.int32(); + break; + } + case 9: { + message.sqlserverUserDetails = $root.google.cloud.sql.v1.SqlServerUserDetails.decode(reader, reader.uint32()); + break; + } + case 11: { + message.iamEmail = reader.string(); + break; + } + case 12: { + message.passwordPolicy = $root.google.cloud.sql.v1.UserPasswordValidationPolicy.decode(reader, reader.uint32()); + break; + } + case 13: { + message.dualPasswordType = reader.int32(); + break; + } + case 14: { + message.iamStatus = reader.int32(); + break; + } + case 15: { + if (!(message.databaseRoles && message.databaseRoles.length)) + message.databaseRoles = []; + message.databaseRoles.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a User message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.User + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.User} User + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + User.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a User message. + * @function verify + * @memberof google.cloud.sql.v1.User + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + User.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.etag != null && message.hasOwnProperty("etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.host != null && message.hasOwnProperty("host")) + if (!$util.isString(message.host)) + return "host: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 7: + break; + } + if (message.sqlserverUserDetails != null && message.hasOwnProperty("sqlserverUserDetails")) { + properties.userDetails = 1; + { + var error = $root.google.cloud.sql.v1.SqlServerUserDetails.verify(message.sqlserverUserDetails); + if (error) + return "sqlserverUserDetails." + error; + } + } + if (message.iamEmail != null && message.hasOwnProperty("iamEmail")) + if (!$util.isString(message.iamEmail)) + return "iamEmail: string expected"; + if (message.passwordPolicy != null && message.hasOwnProperty("passwordPolicy")) { + var error = $root.google.cloud.sql.v1.UserPasswordValidationPolicy.verify(message.passwordPolicy); + if (error) + return "passwordPolicy." + error; + } + if (message.dualPasswordType != null && message.hasOwnProperty("dualPasswordType")) { + properties._dualPasswordType = 1; + switch (message.dualPasswordType) { + default: + return "dualPasswordType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } + if (message.iamStatus != null && message.hasOwnProperty("iamStatus")) { + properties._iamStatus = 1; + switch (message.iamStatus) { + default: + return "iamStatus: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.databaseRoles != null && message.hasOwnProperty("databaseRoles")) { + if (!Array.isArray(message.databaseRoles)) + return "databaseRoles: array expected"; + for (var i = 0; i < message.databaseRoles.length; ++i) + if (!$util.isString(message.databaseRoles[i])) + return "databaseRoles: string[] expected"; + } + return null; + }; + + /** + * Creates a User message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.User + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.User} User + */ + User.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.User) + return object; + var message = new $root.google.cloud.sql.v1.User(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.password != null) + message.password = String(object.password); + if (object.etag != null) + message.etag = String(object.etag); + if (object.name != null) + message.name = String(object.name); + if (object.host != null) + message.host = String(object.host); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "BUILT_IN": + case 0: + message.type = 0; + break; + case "CLOUD_IAM_USER": + case 1: + message.type = 1; + break; + case "CLOUD_IAM_SERVICE_ACCOUNT": + case 2: + message.type = 2; + break; + case "CLOUD_IAM_GROUP": + case 3: + message.type = 3; + break; + case "CLOUD_IAM_GROUP_USER": + case 4: + message.type = 4; + break; + case "CLOUD_IAM_GROUP_SERVICE_ACCOUNT": + case 5: + message.type = 5; + break; + case "ENTRAID_USER": + case 7: + message.type = 7; + break; + } + if (object.sqlserverUserDetails != null) { + if (typeof object.sqlserverUserDetails !== "object") + throw TypeError(".google.cloud.sql.v1.User.sqlserverUserDetails: object expected"); + message.sqlserverUserDetails = $root.google.cloud.sql.v1.SqlServerUserDetails.fromObject(object.sqlserverUserDetails); + } + if (object.iamEmail != null) + message.iamEmail = String(object.iamEmail); + if (object.passwordPolicy != null) { + if (typeof object.passwordPolicy !== "object") + throw TypeError(".google.cloud.sql.v1.User.passwordPolicy: object expected"); + message.passwordPolicy = $root.google.cloud.sql.v1.UserPasswordValidationPolicy.fromObject(object.passwordPolicy); + } + switch (object.dualPasswordType) { + default: + if (typeof object.dualPasswordType === "number") { + message.dualPasswordType = object.dualPasswordType; + break; + } + break; + case "DUAL_PASSWORD_TYPE_UNSPECIFIED": + case 0: + message.dualPasswordType = 0; + break; + case "NO_MODIFY_DUAL_PASSWORD": + case 1: + message.dualPasswordType = 1; + break; + case "NO_DUAL_PASSWORD": + case 2: + message.dualPasswordType = 2; + break; + case "DUAL_PASSWORD": + case 3: + message.dualPasswordType = 3; + break; + } + switch (object.iamStatus) { + default: + if (typeof object.iamStatus === "number") { + message.iamStatus = object.iamStatus; + break; + } + break; + case "IAM_STATUS_UNSPECIFIED": + case 0: + message.iamStatus = 0; + break; + case "INACTIVE": + case 1: + message.iamStatus = 1; + break; + case "ACTIVE": + case 2: + message.iamStatus = 2; + break; + } + if (object.databaseRoles) { + if (!Array.isArray(object.databaseRoles)) + throw TypeError(".google.cloud.sql.v1.User.databaseRoles: array expected"); + message.databaseRoles = []; + for (var i = 0; i < object.databaseRoles.length; ++i) + message.databaseRoles[i] = String(object.databaseRoles[i]); + } + return message; + }; + + /** + * Creates a plain object from a User message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.User + * @static + * @param {google.cloud.sql.v1.User} message User + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + User.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.databaseRoles = []; + if (options.defaults) { + object.kind = ""; + object.password = ""; + object.etag = ""; + object.name = ""; + object.host = ""; + object.instance = ""; + object.project = ""; + object.type = options.enums === String ? "BUILT_IN" : 0; + object.iamEmail = ""; + object.passwordPolicy = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = message.etag; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.host != null && message.hasOwnProperty("host")) + object.host = message.host; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1.User.SqlUserType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.User.SqlUserType[message.type] : message.type; + if (message.sqlserverUserDetails != null && message.hasOwnProperty("sqlserverUserDetails")) { + object.sqlserverUserDetails = $root.google.cloud.sql.v1.SqlServerUserDetails.toObject(message.sqlserverUserDetails, options); + if (options.oneofs) + object.userDetails = "sqlserverUserDetails"; + } + if (message.iamEmail != null && message.hasOwnProperty("iamEmail")) + object.iamEmail = message.iamEmail; + if (message.passwordPolicy != null && message.hasOwnProperty("passwordPolicy")) + object.passwordPolicy = $root.google.cloud.sql.v1.UserPasswordValidationPolicy.toObject(message.passwordPolicy, options); + if (message.dualPasswordType != null && message.hasOwnProperty("dualPasswordType")) { + object.dualPasswordType = options.enums === String ? $root.google.cloud.sql.v1.User.DualPasswordType[message.dualPasswordType] === undefined ? message.dualPasswordType : $root.google.cloud.sql.v1.User.DualPasswordType[message.dualPasswordType] : message.dualPasswordType; + if (options.oneofs) + object._dualPasswordType = "dualPasswordType"; + } + if (message.iamStatus != null && message.hasOwnProperty("iamStatus")) { + object.iamStatus = options.enums === String ? $root.google.cloud.sql.v1.User.IamStatus[message.iamStatus] === undefined ? message.iamStatus : $root.google.cloud.sql.v1.User.IamStatus[message.iamStatus] : message.iamStatus; + if (options.oneofs) + object._iamStatus = "iamStatus"; + } + if (message.databaseRoles && message.databaseRoles.length) { + object.databaseRoles = []; + for (var j = 0; j < message.databaseRoles.length; ++j) + object.databaseRoles[j] = message.databaseRoles[j]; + } + return object; + }; + + /** + * Converts this User to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.User + * @instance + * @returns {Object.} JSON object + */ + User.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for User + * @function getTypeUrl + * @memberof google.cloud.sql.v1.User + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + User.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.User"; + }; + + /** + * SqlUserType enum. + * @name google.cloud.sql.v1.User.SqlUserType + * @enum {number} + * @property {number} BUILT_IN=0 BUILT_IN value + * @property {number} CLOUD_IAM_USER=1 CLOUD_IAM_USER value + * @property {number} CLOUD_IAM_SERVICE_ACCOUNT=2 CLOUD_IAM_SERVICE_ACCOUNT value + * @property {number} CLOUD_IAM_GROUP=3 CLOUD_IAM_GROUP value + * @property {number} CLOUD_IAM_GROUP_USER=4 CLOUD_IAM_GROUP_USER value + * @property {number} CLOUD_IAM_GROUP_SERVICE_ACCOUNT=5 CLOUD_IAM_GROUP_SERVICE_ACCOUNT value + * @property {number} ENTRAID_USER=7 ENTRAID_USER value + */ + User.SqlUserType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BUILT_IN"] = 0; + values[valuesById[1] = "CLOUD_IAM_USER"] = 1; + values[valuesById[2] = "CLOUD_IAM_SERVICE_ACCOUNT"] = 2; + values[valuesById[3] = "CLOUD_IAM_GROUP"] = 3; + values[valuesById[4] = "CLOUD_IAM_GROUP_USER"] = 4; + values[valuesById[5] = "CLOUD_IAM_GROUP_SERVICE_ACCOUNT"] = 5; + values[valuesById[7] = "ENTRAID_USER"] = 7; + return values; + })(); + + /** + * DualPasswordType enum. + * @name google.cloud.sql.v1.User.DualPasswordType + * @enum {number} + * @property {number} DUAL_PASSWORD_TYPE_UNSPECIFIED=0 DUAL_PASSWORD_TYPE_UNSPECIFIED value + * @property {number} NO_MODIFY_DUAL_PASSWORD=1 NO_MODIFY_DUAL_PASSWORD value + * @property {number} NO_DUAL_PASSWORD=2 NO_DUAL_PASSWORD value + * @property {number} DUAL_PASSWORD=3 DUAL_PASSWORD value + */ + User.DualPasswordType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DUAL_PASSWORD_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NO_MODIFY_DUAL_PASSWORD"] = 1; + values[valuesById[2] = "NO_DUAL_PASSWORD"] = 2; + values[valuesById[3] = "DUAL_PASSWORD"] = 3; + return values; + })(); + + /** + * IamStatus enum. + * @name google.cloud.sql.v1.User.IamStatus + * @enum {number} + * @property {number} IAM_STATUS_UNSPECIFIED=0 IAM_STATUS_UNSPECIFIED value + * @property {number} INACTIVE=1 INACTIVE value + * @property {number} ACTIVE=2 ACTIVE value + */ + User.IamStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IAM_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "INACTIVE"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + return values; + })(); + + return User; + })(); + + v1.SqlServerUserDetails = (function() { + + /** + * Properties of a SqlServerUserDetails. + * @memberof google.cloud.sql.v1 + * @interface ISqlServerUserDetails + * @property {boolean|null} [disabled] SqlServerUserDetails disabled + * @property {Array.|null} [serverRoles] SqlServerUserDetails serverRoles + */ + + /** + * Constructs a new SqlServerUserDetails. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a SqlServerUserDetails. + * @implements ISqlServerUserDetails + * @constructor + * @param {google.cloud.sql.v1.ISqlServerUserDetails=} [properties] Properties to set + */ + function SqlServerUserDetails(properties) { + this.serverRoles = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlServerUserDetails disabled. + * @member {boolean} disabled + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @instance + */ + SqlServerUserDetails.prototype.disabled = false; + + /** + * SqlServerUserDetails serverRoles. + * @member {Array.} serverRoles + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @instance + */ + SqlServerUserDetails.prototype.serverRoles = $util.emptyArray; + + /** + * Creates a new SqlServerUserDetails instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @static + * @param {google.cloud.sql.v1.ISqlServerUserDetails=} [properties] Properties to set + * @returns {google.cloud.sql.v1.SqlServerUserDetails} SqlServerUserDetails instance + */ + SqlServerUserDetails.create = function create(properties) { + return new SqlServerUserDetails(properties); + }; + + /** + * Encodes the specified SqlServerUserDetails message. Does not implicitly {@link google.cloud.sql.v1.SqlServerUserDetails.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @static + * @param {google.cloud.sql.v1.ISqlServerUserDetails} message SqlServerUserDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerUserDetails.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.disabled); + if (message.serverRoles != null && message.serverRoles.length) + for (var i = 0; i < message.serverRoles.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.serverRoles[i]); + return writer; + }; + + /** + * Encodes the specified SqlServerUserDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerUserDetails.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @static + * @param {google.cloud.sql.v1.ISqlServerUserDetails} message SqlServerUserDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerUserDetails.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlServerUserDetails message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.SqlServerUserDetails} SqlServerUserDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerUserDetails.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlServerUserDetails(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.disabled = reader.bool(); + break; + } + case 2: { + if (!(message.serverRoles && message.serverRoles.length)) + message.serverRoles = []; + message.serverRoles.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlServerUserDetails message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.SqlServerUserDetails} SqlServerUserDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerUserDetails.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlServerUserDetails message. + * @function verify + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlServerUserDetails.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.disabled != null && message.hasOwnProperty("disabled")) + if (typeof message.disabled !== "boolean") + return "disabled: boolean expected"; + if (message.serverRoles != null && message.hasOwnProperty("serverRoles")) { + if (!Array.isArray(message.serverRoles)) + return "serverRoles: array expected"; + for (var i = 0; i < message.serverRoles.length; ++i) + if (!$util.isString(message.serverRoles[i])) + return "serverRoles: string[] expected"; + } + return null; + }; + + /** + * Creates a SqlServerUserDetails message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.SqlServerUserDetails} SqlServerUserDetails + */ + SqlServerUserDetails.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.SqlServerUserDetails) + return object; + var message = new $root.google.cloud.sql.v1.SqlServerUserDetails(); + if (object.disabled != null) + message.disabled = Boolean(object.disabled); + if (object.serverRoles) { + if (!Array.isArray(object.serverRoles)) + throw TypeError(".google.cloud.sql.v1.SqlServerUserDetails.serverRoles: array expected"); + message.serverRoles = []; + for (var i = 0; i < object.serverRoles.length; ++i) + message.serverRoles[i] = String(object.serverRoles[i]); + } + return message; + }; + + /** + * Creates a plain object from a SqlServerUserDetails message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @static + * @param {google.cloud.sql.v1.SqlServerUserDetails} message SqlServerUserDetails + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlServerUserDetails.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.serverRoles = []; + if (options.defaults) + object.disabled = false; + if (message.disabled != null && message.hasOwnProperty("disabled")) + object.disabled = message.disabled; + if (message.serverRoles && message.serverRoles.length) { + object.serverRoles = []; + for (var j = 0; j < message.serverRoles.length; ++j) + object.serverRoles[j] = message.serverRoles[j]; + } + return object; + }; + + /** + * Converts this SqlServerUserDetails to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @instance + * @returns {Object.} JSON object + */ + SqlServerUserDetails.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlServerUserDetails + * @function getTypeUrl + * @memberof google.cloud.sql.v1.SqlServerUserDetails + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlServerUserDetails.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.SqlServerUserDetails"; + }; + + return SqlServerUserDetails; + })(); + + v1.UsersListResponse = (function() { + + /** + * Properties of a UsersListResponse. + * @memberof google.cloud.sql.v1 + * @interface IUsersListResponse + * @property {string|null} [kind] UsersListResponse kind + * @property {Array.|null} [items] UsersListResponse items + * @property {string|null} [nextPageToken] UsersListResponse nextPageToken + */ + + /** + * Constructs a new UsersListResponse. + * @memberof google.cloud.sql.v1 + * @classdesc Represents a UsersListResponse. + * @implements IUsersListResponse + * @constructor + * @param {google.cloud.sql.v1.IUsersListResponse=} [properties] Properties to set + */ + function UsersListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UsersListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1.UsersListResponse + * @instance + */ + UsersListResponse.prototype.kind = ""; + + /** + * UsersListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1.UsersListResponse + * @instance + */ + UsersListResponse.prototype.items = $util.emptyArray; + + /** + * UsersListResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.sql.v1.UsersListResponse + * @instance + */ + UsersListResponse.prototype.nextPageToken = ""; + + /** + * Creates a new UsersListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1.UsersListResponse + * @static + * @param {google.cloud.sql.v1.IUsersListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1.UsersListResponse} UsersListResponse instance + */ + UsersListResponse.create = function create(properties) { + return new UsersListResponse(properties); + }; + + /** + * Encodes the specified UsersListResponse message. Does not implicitly {@link google.cloud.sql.v1.UsersListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1.UsersListResponse + * @static + * @param {google.cloud.sql.v1.IUsersListResponse} message UsersListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UsersListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1.User.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified UsersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UsersListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1.UsersListResponse + * @static + * @param {google.cloud.sql.v1.IUsersListResponse} message UsersListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UsersListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UsersListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1.UsersListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1.UsersListResponse} UsersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UsersListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.UsersListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1.User.decode(reader, reader.uint32())); + break; + } + case 3: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UsersListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1.UsersListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1.UsersListResponse} UsersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UsersListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UsersListResponse message. + * @function verify + * @memberof google.cloud.sql.v1.UsersListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UsersListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1.User.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a UsersListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1.UsersListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1.UsersListResponse} UsersListResponse + */ + UsersListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1.UsersListResponse) + return object; + var message = new $root.google.cloud.sql.v1.UsersListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1.UsersListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1.UsersListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1.User.fromObject(object.items[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a UsersListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1.UsersListResponse + * @static + * @param {google.cloud.sql.v1.UsersListResponse} message UsersListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UsersListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) { + object.kind = ""; + object.nextPageToken = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1.User.toObject(message.items[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this UsersListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1.UsersListResponse + * @instance + * @returns {Object.} JSON object + */ + UsersListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UsersListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1.UsersListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UsersListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1.UsersListResponse"; + }; + + return UsersListResponse; + })(); + + return v1; + })(); + + sql.v1beta4 = (function() { + + /** + * Namespace v1beta4. + * @memberof google.cloud.sql + * @namespace + */ + var v1beta4 = {}; + + v1beta4.SqlBackupRunsService = (function() { + + /** + * Constructs a new SqlBackupRunsService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlBackupRunsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlBackupRunsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlBackupRunsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlBackupRunsService; + + /** + * Creates new SqlBackupRunsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlBackupRunsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlBackupRunsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|delete_}. + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @typedef DeleteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest} request SqlBackupRunsDeleteRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlBackupRunsService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupRunsService.prototype["delete"] = function delete_(request, callback) { + return this.rpcCall(delete_, $root.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Delete" }); + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest} request SqlBackupRunsDeleteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|get}. + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.BackupRun} [response] BackupRun + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest} request SqlBackupRunsGetRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlBackupRunsService.GetCallback} callback Node-style callback called with the error, if any, and BackupRun + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupRunsService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest, $root.google.cloud.sql.v1beta4.BackupRun, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest} request SqlBackupRunsGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|insert}. + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @typedef InsertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest} request SqlBackupRunsInsertRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlBackupRunsService.InsertCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupRunsService.prototype.insert = function insert(request, callback) { + return this.rpcCall(insert, $root.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Insert" }); + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest} request SqlBackupRunsInsertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|list}. + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.BackupRunsListResponse} [response] BackupRunsListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest} request SqlBackupRunsListRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlBackupRunsService.ListCallback} callback Node-style callback called with the error, if any, and BackupRunsListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupRunsService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlBackupRunsListRequest, $root.google.cloud.sql.v1beta4.BackupRunsListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest} request SqlBackupRunsListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlBackupRunsService; + })(); + + v1beta4.SqlDatabasesService = (function() { + + /** + * Constructs a new SqlDatabasesService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlDatabasesService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlDatabasesService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlDatabasesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlDatabasesService; + + /** + * Creates new SqlDatabasesService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlDatabasesService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlDatabasesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|delete_}. + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @typedef DeleteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest} request SqlDatabasesDeleteRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlDatabasesService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype["delete"] = function delete_(request, callback) { + return this.rpcCall(delete_, $root.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Delete" }); + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest} request SqlDatabasesDeleteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|get}. + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Database} [response] Database + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest} request SqlDatabasesGetRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlDatabasesService.GetCallback} callback Node-style callback called with the error, if any, and Database + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlDatabasesGetRequest, $root.google.cloud.sql.v1beta4.Database, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest} request SqlDatabasesGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|insert}. + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @typedef InsertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest} request SqlDatabasesInsertRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlDatabasesService.InsertCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype.insert = function insert(request, callback) { + return this.rpcCall(insert, $root.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Insert" }); + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest} request SqlDatabasesInsertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|list}. + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.DatabasesListResponse} [response] DatabasesListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest} request SqlDatabasesListRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlDatabasesService.ListCallback} callback Node-style callback called with the error, if any, and DatabasesListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlDatabasesListRequest, $root.google.cloud.sql.v1beta4.DatabasesListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest} request SqlDatabasesListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|patch}. + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @typedef PatchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Patch. + * @function patch + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlDatabasesService.PatchCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype.patch = function patch(request, callback) { + return this.rpcCall(patch, $root.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Patch" }); + + /** + * Calls Patch. + * @function patch + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|update}. + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @typedef UpdateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlDatabasesService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlDatabasesService.prototype.update = function update(request, callback) { + return this.rpcCall(update, $root.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Update" }); + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1beta4.SqlDatabasesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlDatabasesService; + })(); + + v1beta4.SqlFlagsService = (function() { + + /** + * Constructs a new SqlFlagsService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlFlagsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlFlagsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlFlagsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlFlagsService; + + /** + * Creates new SqlFlagsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlFlagsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlFlagsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlFlagsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlFlagsService|list}. + * @memberof google.cloud.sql.v1beta4.SqlFlagsService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.FlagsListResponse} [response] FlagsListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlFlagsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest} request SqlFlagsListRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlFlagsService.ListCallback} callback Node-style callback called with the error, if any, and FlagsListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlFlagsService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlFlagsListRequest, $root.google.cloud.sql.v1beta4.FlagsListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlFlagsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest} request SqlFlagsListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlFlagsService; + })(); + + v1beta4.SqlInstancesService = (function() { + + /** + * Constructs a new SqlInstancesService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlInstancesService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlInstancesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlInstancesService; + + /** + * Creates new SqlInstancesService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlInstancesService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlInstancesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addServerCa}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef AddServerCaCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls AddServerCa. + * @function addServerCa + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest} request SqlInstancesAddServerCaRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.AddServerCaCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.addServerCa = function addServerCa(request, callback) { + return this.rpcCall(addServerCa, $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "AddServerCa" }); + + /** + * Calls AddServerCa. + * @function addServerCa + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest} request SqlInstancesAddServerCaRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addServerCertificate}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef AddServerCertificateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls AddServerCertificate. + * @function addServerCertificate + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest} request SqlInstancesAddServerCertificateRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.AddServerCertificateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.addServerCertificate = function addServerCertificate(request, callback) { + return this.rpcCall(addServerCertificate, $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "AddServerCertificate" }); + + /** + * Calls AddServerCertificate. + * @function addServerCertificate + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest} request SqlInstancesAddServerCertificateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addEntraIdCertificate}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef AddEntraIdCertificateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls AddEntraIdCertificate. + * @function addEntraIdCertificate + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest} request SqlInstancesAddEntraIdCertificateRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.AddEntraIdCertificateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.addEntraIdCertificate = function addEntraIdCertificate(request, callback) { + return this.rpcCall(addEntraIdCertificate, $root.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "AddEntraIdCertificate" }); + + /** + * Calls AddEntraIdCertificate. + * @function addEntraIdCertificate + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest} request SqlInstancesAddEntraIdCertificateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|clone}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef CloneCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Clone. + * @function clone + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest} request SqlInstancesCloneRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.CloneCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.clone = function clone(request, callback) { + return this.rpcCall(clone, $root.google.cloud.sql.v1beta4.SqlInstancesCloneRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Clone" }); + + /** + * Calls Clone. + * @function clone + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest} request SqlInstancesCloneRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|delete_}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef DeleteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest} request SqlInstancesDeleteRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype["delete"] = function delete_(request, callback) { + return this.rpcCall(delete_, $root.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Delete" }); + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest} request SqlInstancesDeleteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|demoteMaster}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef DemoteMasterCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls DemoteMaster. + * @function demoteMaster + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest} request SqlInstancesDemoteMasterRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.DemoteMasterCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.demoteMaster = function demoteMaster(request, callback) { + return this.rpcCall(demoteMaster, $root.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "DemoteMaster" }); + + /** + * Calls DemoteMaster. + * @function demoteMaster + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest} request SqlInstancesDemoteMasterRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|demote}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef DemoteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Demote. + * @function demote + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest} request SqlInstancesDemoteRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.DemoteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.demote = function demote(request, callback) { + return this.rpcCall(demote, $root.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Demote" }); + + /** + * Calls Demote. + * @function demote + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest} request SqlInstancesDemoteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|export_}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ExportCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Export. + * @function export + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest} request SqlInstancesExportRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ExportCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype["export"] = function export_(request, callback) { + return this.rpcCall(export_, $root.google.cloud.sql.v1beta4.SqlInstancesExportRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Export" }); + + /** + * Calls Export. + * @function export + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest} request SqlInstancesExportRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|failover}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef FailoverCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Failover. + * @function failover + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest} request SqlInstancesFailoverRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.FailoverCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.failover = function failover(request, callback) { + return this.rpcCall(failover, $root.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Failover" }); + + /** + * Calls Failover. + * @function failover + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest} request SqlInstancesFailoverRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|reencrypt}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ReencryptCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Reencrypt. + * @function reencrypt + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest} request SqlInstancesReencryptRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ReencryptCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.reencrypt = function reencrypt(request, callback) { + return this.rpcCall(reencrypt, $root.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Reencrypt" }); + + /** + * Calls Reencrypt. + * @function reencrypt + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest} request SqlInstancesReencryptRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|get}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.DatabaseInstance} [response] DatabaseInstance + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest} request SqlInstancesGetRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.GetCallback} callback Node-style callback called with the error, if any, and DatabaseInstance + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlInstancesGetRequest, $root.google.cloud.sql.v1beta4.DatabaseInstance, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest} request SqlInstancesGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|import_}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ImportCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Import. + * @function import + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest} request SqlInstancesImportRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ImportCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype["import"] = function import_(request, callback) { + return this.rpcCall(import_, $root.google.cloud.sql.v1beta4.SqlInstancesImportRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Import" }); + + /** + * Calls Import. + * @function import + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest} request SqlInstancesImportRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|insert}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef InsertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest} request SqlInstancesInsertRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.InsertCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.insert = function insert(request, callback) { + return this.rpcCall(insert, $root.google.cloud.sql.v1beta4.SqlInstancesInsertRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Insert" }); + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest} request SqlInstancesInsertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|list}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.InstancesListResponse} [response] InstancesListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest} request SqlInstancesListRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ListCallback} callback Node-style callback called with the error, if any, and InstancesListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlInstancesListRequest, $root.google.cloud.sql.v1beta4.InstancesListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest} request SqlInstancesListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listServerCas}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ListServerCasCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.InstancesListServerCasResponse} [response] InstancesListServerCasResponse + */ + + /** + * Calls ListServerCas. + * @function listServerCas + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest} request SqlInstancesListServerCasRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ListServerCasCallback} callback Node-style callback called with the error, if any, and InstancesListServerCasResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.listServerCas = function listServerCas(request, callback) { + return this.rpcCall(listServerCas, $root.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest, $root.google.cloud.sql.v1beta4.InstancesListServerCasResponse, request, callback); + }, "name", { value: "ListServerCas" }); + + /** + * Calls ListServerCas. + * @function listServerCas + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest} request SqlInstancesListServerCasRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listServerCertificates}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ListServerCertificatesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} [response] InstancesListServerCertificatesResponse + */ + + /** + * Calls ListServerCertificates. + * @function listServerCertificates + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest} request SqlInstancesListServerCertificatesRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ListServerCertificatesCallback} callback Node-style callback called with the error, if any, and InstancesListServerCertificatesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.listServerCertificates = function listServerCertificates(request, callback) { + return this.rpcCall(listServerCertificates, $root.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest, $root.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse, request, callback); + }, "name", { value: "ListServerCertificates" }); + + /** + * Calls ListServerCertificates. + * @function listServerCertificates + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest} request SqlInstancesListServerCertificatesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listEntraIdCertificates}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ListEntraIdCertificatesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} [response] InstancesListEntraIdCertificatesResponse + */ + + /** + * Calls ListEntraIdCertificates. + * @function listEntraIdCertificates + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest} request SqlInstancesListEntraIdCertificatesRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ListEntraIdCertificatesCallback} callback Node-style callback called with the error, if any, and InstancesListEntraIdCertificatesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.listEntraIdCertificates = function listEntraIdCertificates(request, callback) { + return this.rpcCall(listEntraIdCertificates, $root.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest, $root.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse, request, callback); + }, "name", { value: "ListEntraIdCertificates" }); + + /** + * Calls ListEntraIdCertificates. + * @function listEntraIdCertificates + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest} request SqlInstancesListEntraIdCertificatesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|patch}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef PatchCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Patch. + * @function patch + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest} request SqlInstancesPatchRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.PatchCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.patch = function patch(request, callback) { + return this.rpcCall(patch, $root.google.cloud.sql.v1beta4.SqlInstancesPatchRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Patch" }); + + /** + * Calls Patch. + * @function patch + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest} request SqlInstancesPatchRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|promoteReplica}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef PromoteReplicaCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls PromoteReplica. + * @function promoteReplica + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest} request SqlInstancesPromoteReplicaRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.PromoteReplicaCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.promoteReplica = function promoteReplica(request, callback) { + return this.rpcCall(promoteReplica, $root.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "PromoteReplica" }); + + /** + * Calls PromoteReplica. + * @function promoteReplica + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest} request SqlInstancesPromoteReplicaRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|switchover}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef SwitchoverCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Switchover. + * @function switchover + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest} request SqlInstancesSwitchoverRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.SwitchoverCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.switchover = function switchover(request, callback) { + return this.rpcCall(switchover, $root.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Switchover" }); + + /** + * Calls Switchover. + * @function switchover + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest} request SqlInstancesSwitchoverRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|resetSslConfig}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ResetSslConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls ResetSslConfig. + * @function resetSslConfig + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest} request SqlInstancesResetSslConfigRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ResetSslConfigCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.resetSslConfig = function resetSslConfig(request, callback) { + return this.rpcCall(resetSslConfig, $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "ResetSslConfig" }); + + /** + * Calls ResetSslConfig. + * @function resetSslConfig + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest} request SqlInstancesResetSslConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|restart}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef RestartCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Restart. + * @function restart + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest} request SqlInstancesRestartRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.RestartCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.restart = function restart(request, callback) { + return this.rpcCall(restart, $root.google.cloud.sql.v1beta4.SqlInstancesRestartRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Restart" }); + + /** + * Calls Restart. + * @function restart + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest} request SqlInstancesRestartRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|restoreBackup}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef RestoreBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls RestoreBackup. + * @function restoreBackup + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest} request SqlInstancesRestoreBackupRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.RestoreBackupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.restoreBackup = function restoreBackup(request, callback) { + return this.rpcCall(restoreBackup, $root.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "RestoreBackup" }); + + /** + * Calls RestoreBackup. + * @function restoreBackup + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest} request SqlInstancesRestoreBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateServerCa}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef RotateServerCaCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls RotateServerCa. + * @function rotateServerCa + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest} request SqlInstancesRotateServerCaRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCaCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.rotateServerCa = function rotateServerCa(request, callback) { + return this.rpcCall(rotateServerCa, $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "RotateServerCa" }); + + /** + * Calls RotateServerCa. + * @function rotateServerCa + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest} request SqlInstancesRotateServerCaRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateServerCertificate}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef RotateServerCertificateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls RotateServerCertificate. + * @function rotateServerCertificate + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest} request SqlInstancesRotateServerCertificateRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCertificateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.rotateServerCertificate = function rotateServerCertificate(request, callback) { + return this.rpcCall(rotateServerCertificate, $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "RotateServerCertificate" }); + + /** + * Calls RotateServerCertificate. + * @function rotateServerCertificate + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest} request SqlInstancesRotateServerCertificateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateEntraIdCertificate}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef RotateEntraIdCertificateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls RotateEntraIdCertificate. + * @function rotateEntraIdCertificate + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest} request SqlInstancesRotateEntraIdCertificateRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.RotateEntraIdCertificateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.rotateEntraIdCertificate = function rotateEntraIdCertificate(request, callback) { + return this.rpcCall(rotateEntraIdCertificate, $root.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "RotateEntraIdCertificate" }); + + /** + * Calls RotateEntraIdCertificate. + * @function rotateEntraIdCertificate + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest} request SqlInstancesRotateEntraIdCertificateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|startReplica}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef StartReplicaCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls StartReplica. + * @function startReplica + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest} request SqlInstancesStartReplicaRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.StartReplicaCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.startReplica = function startReplica(request, callback) { + return this.rpcCall(startReplica, $root.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "StartReplica" }); + + /** + * Calls StartReplica. + * @function startReplica + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest} request SqlInstancesStartReplicaRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|stopReplica}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef StopReplicaCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls StopReplica. + * @function stopReplica + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest} request SqlInstancesStopReplicaRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.StopReplicaCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.stopReplica = function stopReplica(request, callback) { + return this.rpcCall(stopReplica, $root.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "StopReplica" }); + + /** + * Calls StopReplica. + * @function stopReplica + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest} request SqlInstancesStopReplicaRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|truncateLog}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef TruncateLogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls TruncateLog. + * @function truncateLog + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest} request SqlInstancesTruncateLogRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.TruncateLogCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.truncateLog = function truncateLog(request, callback) { + return this.rpcCall(truncateLog, $root.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "TruncateLog" }); + + /** + * Calls TruncateLog. + * @function truncateLog + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest} request SqlInstancesTruncateLogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|update}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef UpdateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest} request SqlInstancesUpdateRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.update = function update(request, callback) { + return this.rpcCall(update, $root.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Update" }); + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest} request SqlInstancesUpdateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|createEphemeral}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef CreateEphemeralCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.SslCert} [response] SslCert + */ + + /** + * Calls CreateEphemeral. + * @function createEphemeral + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest} request SqlInstancesCreateEphemeralCertRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.CreateEphemeralCallback} callback Node-style callback called with the error, if any, and SslCert + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.createEphemeral = function createEphemeral(request, callback) { + return this.rpcCall(createEphemeral, $root.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest, $root.google.cloud.sql.v1beta4.SslCert, request, callback); + }, "name", { value: "CreateEphemeral" }); + + /** + * Calls CreateEphemeral. + * @function createEphemeral + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest} request SqlInstancesCreateEphemeralCertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rescheduleMaintenance}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef RescheduleMaintenanceCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls RescheduleMaintenance. + * @function rescheduleMaintenance + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest} request SqlInstancesRescheduleMaintenanceRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.RescheduleMaintenanceCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.rescheduleMaintenance = function rescheduleMaintenance(request, callback) { + return this.rpcCall(rescheduleMaintenance, $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "RescheduleMaintenance" }); + + /** + * Calls RescheduleMaintenance. + * @function rescheduleMaintenance + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest} request SqlInstancesRescheduleMaintenanceRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|verifyExternalSyncSettings}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef VerifyExternalSyncSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} [response] SqlInstancesVerifyExternalSyncSettingsResponse + */ + + /** + * Calls VerifyExternalSyncSettings. + * @function verifyExternalSyncSettings + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest} request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.VerifyExternalSyncSettingsCallback} callback Node-style callback called with the error, if any, and SqlInstancesVerifyExternalSyncSettingsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.verifyExternalSyncSettings = function verifyExternalSyncSettings(request, callback) { + return this.rpcCall(verifyExternalSyncSettings, $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest, $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse, request, callback); + }, "name", { value: "VerifyExternalSyncSettings" }); + + /** + * Calls VerifyExternalSyncSettings. + * @function verifyExternalSyncSettings + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest} request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|startExternalSync}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef StartExternalSyncCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls StartExternalSync. + * @function startExternalSync + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest} request SqlInstancesStartExternalSyncRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.StartExternalSyncCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.startExternalSync = function startExternalSync(request, callback) { + return this.rpcCall(startExternalSync, $root.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "StartExternalSync" }); + + /** + * Calls StartExternalSync. + * @function startExternalSync + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest} request SqlInstancesStartExternalSyncRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|performDiskShrink}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef PerformDiskShrinkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls PerformDiskShrink. + * @function performDiskShrink + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest} request SqlInstancesPerformDiskShrinkRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.PerformDiskShrinkCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.performDiskShrink = function performDiskShrink(request, callback) { + return this.rpcCall(performDiskShrink, $root.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "PerformDiskShrink" }); + + /** + * Calls PerformDiskShrink. + * @function performDiskShrink + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest} request SqlInstancesPerformDiskShrinkRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|getDiskShrinkConfig}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef GetDiskShrinkConfigCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} [response] SqlInstancesGetDiskShrinkConfigResponse + */ + + /** + * Calls GetDiskShrinkConfig. + * @function getDiskShrinkConfig + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest} request SqlInstancesGetDiskShrinkConfigRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.GetDiskShrinkConfigCallback} callback Node-style callback called with the error, if any, and SqlInstancesGetDiskShrinkConfigResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.getDiskShrinkConfig = function getDiskShrinkConfig(request, callback) { + return this.rpcCall(getDiskShrinkConfig, $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest, $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse, request, callback); + }, "name", { value: "GetDiskShrinkConfig" }); + + /** + * Calls GetDiskShrinkConfig. + * @function getDiskShrinkConfig + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest} request SqlInstancesGetDiskShrinkConfigRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|resetReplicaSize}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ResetReplicaSizeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls ResetReplicaSize. + * @function resetReplicaSize + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest} request SqlInstancesResetReplicaSizeRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ResetReplicaSizeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.resetReplicaSize = function resetReplicaSize(request, callback) { + return this.rpcCall(resetReplicaSize, $root.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "ResetReplicaSize" }); + + /** + * Calls ResetReplicaSize. + * @function resetReplicaSize + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest} request SqlInstancesResetReplicaSizeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|getLatestRecoveryTime}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef GetLatestRecoveryTimeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} [response] SqlInstancesGetLatestRecoveryTimeResponse + */ + + /** + * Calls GetLatestRecoveryTime. + * @function getLatestRecoveryTime + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest} request SqlInstancesGetLatestRecoveryTimeRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.GetLatestRecoveryTimeCallback} callback Node-style callback called with the error, if any, and SqlInstancesGetLatestRecoveryTimeResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.getLatestRecoveryTime = function getLatestRecoveryTime(request, callback) { + return this.rpcCall(getLatestRecoveryTime, $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest, $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse, request, callback); + }, "name", { value: "GetLatestRecoveryTime" }); + + /** + * Calls GetLatestRecoveryTime. + * @function getLatestRecoveryTime + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest} request SqlInstancesGetLatestRecoveryTimeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|executeSql}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ExecuteSqlCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} [response] SqlInstancesExecuteSqlResponse + */ + + /** + * Calls ExecuteSql. + * @function executeSql + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest} request SqlInstancesExecuteSqlRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ExecuteSqlCallback} callback Node-style callback called with the error, if any, and SqlInstancesExecuteSqlResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.executeSql = function executeSql(request, callback) { + return this.rpcCall(executeSql, $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest, $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse, request, callback); + }, "name", { value: "ExecuteSql" }); + + /** + * Calls ExecuteSql. + * @function executeSql + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest} request SqlInstancesExecuteSqlRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|acquireSsrsLease}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef AcquireSsrsLeaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} [response] SqlInstancesAcquireSsrsLeaseResponse + */ + + /** + * Calls AcquireSsrsLease. + * @function acquireSsrsLease + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest} request SqlInstancesAcquireSsrsLeaseRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.AcquireSsrsLeaseCallback} callback Node-style callback called with the error, if any, and SqlInstancesAcquireSsrsLeaseResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.acquireSsrsLease = function acquireSsrsLease(request, callback) { + return this.rpcCall(acquireSsrsLease, $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest, $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse, request, callback); + }, "name", { value: "AcquireSsrsLease" }); + + /** + * Calls AcquireSsrsLease. + * @function acquireSsrsLease + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest} request SqlInstancesAcquireSsrsLeaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|releaseSsrsLease}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef ReleaseSsrsLeaseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} [response] SqlInstancesReleaseSsrsLeaseResponse + */ + + /** + * Calls ReleaseSsrsLease. + * @function releaseSsrsLease + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest} request SqlInstancesReleaseSsrsLeaseRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.ReleaseSsrsLeaseCallback} callback Node-style callback called with the error, if any, and SqlInstancesReleaseSsrsLeaseResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.releaseSsrsLease = function releaseSsrsLease(request, callback) { + return this.rpcCall(releaseSsrsLease, $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest, $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse, request, callback); + }, "name", { value: "ReleaseSsrsLease" }); + + /** + * Calls ReleaseSsrsLease. + * @function releaseSsrsLease + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest} request SqlInstancesReleaseSsrsLeaseRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|preCheckMajorVersionUpgrade}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef PreCheckMajorVersionUpgradeCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls PreCheckMajorVersionUpgrade. + * @function preCheckMajorVersionUpgrade + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest} request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.PreCheckMajorVersionUpgradeCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.preCheckMajorVersionUpgrade = function preCheckMajorVersionUpgrade(request, callback) { + return this.rpcCall(preCheckMajorVersionUpgrade, $root.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "PreCheckMajorVersionUpgrade" }); + + /** + * Calls PreCheckMajorVersionUpgrade. + * @function preCheckMajorVersionUpgrade + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest} request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|pointInTimeRestore}. + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @typedef PointInTimeRestoreCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls PointInTimeRestore. + * @function pointInTimeRestore + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest} request SqlInstancesPointInTimeRestoreRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlInstancesService.PointInTimeRestoreCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlInstancesService.prototype.pointInTimeRestore = function pointInTimeRestore(request, callback) { + return this.rpcCall(pointInTimeRestore, $root.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "PointInTimeRestore" }); + + /** + * Calls PointInTimeRestore. + * @function pointInTimeRestore + * @memberof google.cloud.sql.v1beta4.SqlInstancesService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest} request SqlInstancesPointInTimeRestoreRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlInstancesService; + })(); + + v1beta4.SqlOperationsService = (function() { + + /** + * Constructs a new SqlOperationsService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlOperationsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlOperationsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlOperationsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlOperationsService; + + /** + * Creates new SqlOperationsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlOperationsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlOperationsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlOperationsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|get}. + * @memberof google.cloud.sql.v1beta4.SqlOperationsService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest} request SqlOperationsGetRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlOperationsService.GetCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlOperationsService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlOperationsGetRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest} request SqlOperationsGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|list}. + * @memberof google.cloud.sql.v1beta4.SqlOperationsService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.OperationsListResponse} [response] OperationsListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest} request SqlOperationsListRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlOperationsService.ListCallback} callback Node-style callback called with the error, if any, and OperationsListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlOperationsService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlOperationsListRequest, $root.google.cloud.sql.v1beta4.OperationsListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest} request SqlOperationsListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|cancel}. + * @memberof google.cloud.sql.v1beta4.SqlOperationsService + * @typedef CancelCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls Cancel. + * @function cancel + * @memberof google.cloud.sql.v1beta4.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest} request SqlOperationsCancelRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlOperationsService.CancelCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlOperationsService.prototype.cancel = function cancel(request, callback) { + return this.rpcCall(cancel, $root.google.cloud.sql.v1beta4.SqlOperationsCancelRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "Cancel" }); + + /** + * Calls Cancel. + * @function cancel + * @memberof google.cloud.sql.v1beta4.SqlOperationsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest} request SqlOperationsCancelRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlOperationsService; + })(); + + v1beta4.SqlSslCertsService = (function() { + + /** + * Constructs a new SqlSslCertsService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlSslCertsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlSslCertsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlSslCertsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlSslCertsService; + + /** + * Creates new SqlSslCertsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlSslCertsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlSslCertsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|delete_}. + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @typedef DeleteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest} request SqlSslCertsDeleteRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlSslCertsService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlSslCertsService.prototype["delete"] = function delete_(request, callback) { + return this.rpcCall(delete_, $root.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Delete" }); + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest} request SqlSslCertsDeleteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|get}. + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.SslCert} [response] SslCert + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest} request SqlSslCertsGetRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlSslCertsService.GetCallback} callback Node-style callback called with the error, if any, and SslCert + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlSslCertsService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlSslCertsGetRequest, $root.google.cloud.sql.v1beta4.SslCert, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest} request SqlSslCertsGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|insert}. + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @typedef InsertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.SslCertsInsertResponse} [response] SslCertsInsertResponse + */ + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest} request SqlSslCertsInsertRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlSslCertsService.InsertCallback} callback Node-style callback called with the error, if any, and SslCertsInsertResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlSslCertsService.prototype.insert = function insert(request, callback) { + return this.rpcCall(insert, $root.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest, $root.google.cloud.sql.v1beta4.SslCertsInsertResponse, request, callback); + }, "name", { value: "Insert" }); + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest} request SqlSslCertsInsertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|list}. + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.SslCertsListResponse} [response] SslCertsListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest} request SqlSslCertsListRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlSslCertsService.ListCallback} callback Node-style callback called with the error, if any, and SslCertsListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlSslCertsService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlSslCertsListRequest, $root.google.cloud.sql.v1beta4.SslCertsListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlSslCertsService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest} request SqlSslCertsListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlSslCertsService; + })(); + + v1beta4.SqlBackupsService = (function() { + + /** + * Constructs a new SqlBackupsService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlBackupsService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlBackupsService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlBackupsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlBackupsService; + + /** + * Creates new SqlBackupsService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlBackupsService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlBackupsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|createBackup}. + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @typedef CreateBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls CreateBackup. + * @function createBackup + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1beta4.ICreateBackupRequest} request CreateBackupRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlBackupsService.CreateBackupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupsService.prototype.createBackup = function createBackup(request, callback) { + return this.rpcCall(createBackup, $root.google.cloud.sql.v1beta4.CreateBackupRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "CreateBackup" }); + + /** + * Calls CreateBackup. + * @function createBackup + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1beta4.ICreateBackupRequest} request CreateBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|getBackup}. + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @typedef GetBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Backup} [response] Backup + */ + + /** + * Calls GetBackup. + * @function getBackup + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1beta4.IGetBackupRequest} request GetBackupRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlBackupsService.GetBackupCallback} callback Node-style callback called with the error, if any, and Backup + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupsService.prototype.getBackup = function getBackup(request, callback) { + return this.rpcCall(getBackup, $root.google.cloud.sql.v1beta4.GetBackupRequest, $root.google.cloud.sql.v1beta4.Backup, request, callback); + }, "name", { value: "GetBackup" }); + + /** + * Calls GetBackup. + * @function getBackup + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1beta4.IGetBackupRequest} request GetBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|listBackups}. + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @typedef ListBackupsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.ListBackupsResponse} [response] ListBackupsResponse + */ + + /** + * Calls ListBackups. + * @function listBackups + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1beta4.IListBackupsRequest} request ListBackupsRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlBackupsService.ListBackupsCallback} callback Node-style callback called with the error, if any, and ListBackupsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupsService.prototype.listBackups = function listBackups(request, callback) { + return this.rpcCall(listBackups, $root.google.cloud.sql.v1beta4.ListBackupsRequest, $root.google.cloud.sql.v1beta4.ListBackupsResponse, request, callback); + }, "name", { value: "ListBackups" }); + + /** + * Calls ListBackups. + * @function listBackups + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1beta4.IListBackupsRequest} request ListBackupsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|updateBackup}. + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @typedef UpdateBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls UpdateBackup. + * @function updateBackup + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest} request UpdateBackupRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlBackupsService.UpdateBackupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupsService.prototype.updateBackup = function updateBackup(request, callback) { + return this.rpcCall(updateBackup, $root.google.cloud.sql.v1beta4.UpdateBackupRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "UpdateBackup" }); + + /** + * Calls UpdateBackup. + * @function updateBackup + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest} request UpdateBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|deleteBackup}. + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @typedef DeleteBackupCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls DeleteBackup. + * @function deleteBackup + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest} request DeleteBackupRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlBackupsService.DeleteBackupCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlBackupsService.prototype.deleteBackup = function deleteBackup(request, callback) { + return this.rpcCall(deleteBackup, $root.google.cloud.sql.v1beta4.DeleteBackupRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "DeleteBackup" }); + + /** + * Calls DeleteBackup. + * @function deleteBackup + * @memberof google.cloud.sql.v1beta4.SqlBackupsService + * @instance + * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest} request DeleteBackupRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlBackupsService; + })(); + + v1beta4.CreateBackupRequest = (function() { + + /** + * Properties of a CreateBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ICreateBackupRequest + * @property {string|null} [parent] CreateBackupRequest parent + * @property {google.cloud.sql.v1beta4.IBackup|null} [backup] CreateBackupRequest backup + */ + + /** + * Constructs a new CreateBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a CreateBackupRequest. + * @implements ICreateBackupRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ICreateBackupRequest=} [properties] Properties to set + */ + function CreateBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateBackupRequest parent. + * @member {string} parent + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @instance + */ + CreateBackupRequest.prototype.parent = ""; + + /** + * CreateBackupRequest backup. + * @member {google.cloud.sql.v1beta4.IBackup|null|undefined} backup + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @instance + */ + CreateBackupRequest.prototype.backup = null; + + /** + * Creates a new CreateBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.ICreateBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.CreateBackupRequest} CreateBackupRequest instance + */ + CreateBackupRequest.create = function create(properties) { + return new CreateBackupRequest(properties); + }; + + /** + * Encodes the specified CreateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.CreateBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.ICreateBackupRequest} message CreateBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + $root.google.cloud.sql.v1beta4.Backup.encode(message.backup, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.CreateBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.ICreateBackupRequest} message CreateBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.CreateBackupRequest} CreateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.CreateBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.backup = $root.google.cloud.sql.v1beta4.Backup.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.CreateBackupRequest} CreateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.backup != null && message.hasOwnProperty("backup")) { + var error = $root.google.cloud.sql.v1beta4.Backup.verify(message.backup); + if (error) + return "backup." + error; + } + return null; + }; + + /** + * Creates a CreateBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.CreateBackupRequest} CreateBackupRequest + */ + CreateBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.CreateBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.CreateBackupRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.backup != null) { + if (typeof object.backup !== "object") + throw TypeError(".google.cloud.sql.v1beta4.CreateBackupRequest.backup: object expected"); + message.backup = $root.google.cloud.sql.v1beta4.Backup.fromObject(object.backup); + } + return message; + }; + + /** + * Creates a plain object from a CreateBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.CreateBackupRequest} message CreateBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.backup = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.backup != null && message.hasOwnProperty("backup")) + object.backup = $root.google.cloud.sql.v1beta4.Backup.toObject(message.backup, options); + return object; + }; + + /** + * Converts this CreateBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @instance + * @returns {Object.} JSON object + */ + CreateBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.CreateBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.CreateBackupRequest"; + }; + + return CreateBackupRequest; + })(); + + v1beta4.GetBackupRequest = (function() { + + /** + * Properties of a GetBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IGetBackupRequest + * @property {string|null} [name] GetBackupRequest name + */ + + /** + * Constructs a new GetBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a GetBackupRequest. + * @implements IGetBackupRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IGetBackupRequest=} [properties] Properties to set + */ + function GetBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBackupRequest name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @instance + */ + GetBackupRequest.prototype.name = ""; + + /** + * Creates a new GetBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IGetBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.GetBackupRequest} GetBackupRequest instance + */ + GetBackupRequest.create = function create(properties) { + return new GetBackupRequest(properties); + }; + + /** + * Encodes the specified GetBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GetBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IGetBackupRequest} message GetBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GetBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IGetBackupRequest} message GetBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.GetBackupRequest} GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.GetBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.GetBackupRequest} GetBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.GetBackupRequest} GetBackupRequest + */ + GetBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.GetBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.GetBackupRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.GetBackupRequest} message GetBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @instance + * @returns {Object.} JSON object + */ + GetBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.GetBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.GetBackupRequest"; + }; + + return GetBackupRequest; + })(); + + v1beta4.ListBackupsRequest = (function() { + + /** + * Properties of a ListBackupsRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IListBackupsRequest + * @property {string|null} [parent] ListBackupsRequest parent + * @property {number|null} [pageSize] ListBackupsRequest pageSize + * @property {string|null} [pageToken] ListBackupsRequest pageToken + * @property {string|null} [filter] ListBackupsRequest filter + */ + + /** + * Constructs a new ListBackupsRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a ListBackupsRequest. + * @implements IListBackupsRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IListBackupsRequest=} [properties] Properties to set + */ + function ListBackupsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBackupsRequest parent. + * @member {string} parent + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @instance + */ + ListBackupsRequest.prototype.parent = ""; + + /** + * ListBackupsRequest pageSize. + * @member {number} pageSize + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @instance + */ + ListBackupsRequest.prototype.pageSize = 0; + + /** + * ListBackupsRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @instance + */ + ListBackupsRequest.prototype.pageToken = ""; + + /** + * ListBackupsRequest filter. + * @member {string} filter + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @instance + */ + ListBackupsRequest.prototype.filter = ""; + + /** + * Creates a new ListBackupsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @static + * @param {google.cloud.sql.v1beta4.IListBackupsRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ListBackupsRequest} ListBackupsRequest instance + */ + ListBackupsRequest.create = function create(properties) { + return new ListBackupsRequest(properties); + }; + + /** + * Encodes the specified ListBackupsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @static + * @param {google.cloud.sql.v1beta4.IListBackupsRequest} message ListBackupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); + return writer; + }; + + /** + * Encodes the specified ListBackupsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @static + * @param {google.cloud.sql.v1beta4.IListBackupsRequest} message ListBackupsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ListBackupsRequest} ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ListBackupsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListBackupsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ListBackupsRequest} ListBackupsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBackupsRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBackupsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a ListBackupsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ListBackupsRequest} ListBackupsRequest + */ + ListBackupsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ListBackupsRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.ListBackupsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a ListBackupsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @static + * @param {google.cloud.sql.v1beta4.ListBackupsRequest} message ListBackupsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBackupsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + object.filter = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this ListBackupsRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @instance + * @returns {Object.} JSON object + */ + ListBackupsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBackupsRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ListBackupsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBackupsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ListBackupsRequest"; + }; + + return ListBackupsRequest; + })(); + + v1beta4.ListBackupsResponse = (function() { + + /** + * Properties of a ListBackupsResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IListBackupsResponse + * @property {Array.|null} [backups] ListBackupsResponse backups + * @property {string|null} [nextPageToken] ListBackupsResponse nextPageToken + * @property {Array.|null} [warnings] ListBackupsResponse warnings + */ + + /** + * Constructs a new ListBackupsResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a ListBackupsResponse. + * @implements IListBackupsResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IListBackupsResponse=} [properties] Properties to set + */ + function ListBackupsResponse(properties) { + this.backups = []; + this.warnings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBackupsResponse backups. + * @member {Array.} backups + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @instance + */ + ListBackupsResponse.prototype.backups = $util.emptyArray; + + /** + * ListBackupsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @instance + */ + ListBackupsResponse.prototype.nextPageToken = ""; + + /** + * ListBackupsResponse warnings. + * @member {Array.} warnings + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @instance + */ + ListBackupsResponse.prototype.warnings = $util.emptyArray; + + /** + * Creates a new ListBackupsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @static + * @param {google.cloud.sql.v1beta4.IListBackupsResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ListBackupsResponse} ListBackupsResponse instance + */ + ListBackupsResponse.create = function create(properties) { + return new ListBackupsResponse(properties); + }; + + /** + * Encodes the specified ListBackupsResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @static + * @param {google.cloud.sql.v1beta4.IListBackupsResponse} message ListBackupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backups != null && message.backups.length) + for (var i = 0; i < message.backups.length; ++i) + $root.google.cloud.sql.v1beta4.Backup.encode(message.backups[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + $root.google.cloud.sql.v1beta4.ApiWarning.encode(message.warnings[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListBackupsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @static + * @param {google.cloud.sql.v1beta4.IListBackupsResponse} message ListBackupsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBackupsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ListBackupsResponse} ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ListBackupsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.backups && message.backups.length)) + message.backups = []; + message.backups.push($root.google.cloud.sql.v1beta4.Backup.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + case 3: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push($root.google.cloud.sql.v1beta4.ApiWarning.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListBackupsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ListBackupsResponse} ListBackupsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBackupsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBackupsResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBackupsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.backups != null && message.hasOwnProperty("backups")) { + if (!Array.isArray(message.backups)) + return "backups: array expected"; + for (var i = 0; i < message.backups.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.Backup.verify(message.backups[i]); + if (error) + return "backups." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.ApiWarning.verify(message.warnings[i]); + if (error) + return "warnings." + error; + } + } + return null; + }; + + /** + * Creates a ListBackupsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ListBackupsResponse} ListBackupsResponse + */ + ListBackupsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ListBackupsResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.ListBackupsResponse(); + if (object.backups) { + if (!Array.isArray(object.backups)) + throw TypeError(".google.cloud.sql.v1beta4.ListBackupsResponse.backups: array expected"); + message.backups = []; + for (var i = 0; i < object.backups.length; ++i) { + if (typeof object.backups[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ListBackupsResponse.backups: object expected"); + message.backups[i] = $root.google.cloud.sql.v1beta4.Backup.fromObject(object.backups[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.sql.v1beta4.ListBackupsResponse.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) { + if (typeof object.warnings[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ListBackupsResponse.warnings: object expected"); + message.warnings[i] = $root.google.cloud.sql.v1beta4.ApiWarning.fromObject(object.warnings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListBackupsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @static + * @param {google.cloud.sql.v1beta4.ListBackupsResponse} message ListBackupsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBackupsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.backups = []; + object.warnings = []; + } + if (options.defaults) + object.nextPageToken = ""; + if (message.backups && message.backups.length) { + object.backups = []; + for (var j = 0; j < message.backups.length; ++j) + object.backups[j] = $root.google.cloud.sql.v1beta4.Backup.toObject(message.backups[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = $root.google.cloud.sql.v1beta4.ApiWarning.toObject(message.warnings[j], options); + } + return object; + }; + + /** + * Converts this ListBackupsResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @instance + * @returns {Object.} JSON object + */ + ListBackupsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBackupsResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ListBackupsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBackupsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ListBackupsResponse"; + }; + + return ListBackupsResponse; + })(); + + v1beta4.UpdateBackupRequest = (function() { + + /** + * Properties of an UpdateBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IUpdateBackupRequest + * @property {google.cloud.sql.v1beta4.IBackup|null} [backup] UpdateBackupRequest backup + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateBackupRequest updateMask + */ + + /** + * Constructs a new UpdateBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an UpdateBackupRequest. + * @implements IUpdateBackupRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest=} [properties] Properties to set + */ + function UpdateBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateBackupRequest backup. + * @member {google.cloud.sql.v1beta4.IBackup|null|undefined} backup + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @instance + */ + UpdateBackupRequest.prototype.backup = null; + + /** + * UpdateBackupRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @instance + */ + UpdateBackupRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.UpdateBackupRequest} UpdateBackupRequest instance + */ + UpdateBackupRequest.create = function create(properties) { + return new UpdateBackupRequest(properties); + }; + + /** + * Encodes the specified UpdateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.UpdateBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest} message UpdateBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + $root.google.cloud.sql.v1beta4.Backup.encode(message.backup, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UpdateBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest} message UpdateBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.UpdateBackupRequest} UpdateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.UpdateBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backup = $root.google.cloud.sql.v1beta4.Backup.decode(reader, reader.uint32()); + break; + } + case 2: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.UpdateBackupRequest} UpdateBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.backup != null && message.hasOwnProperty("backup")) { + var error = $root.google.cloud.sql.v1beta4.Backup.verify(message.backup); + if (error) + return "backup." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.UpdateBackupRequest} UpdateBackupRequest + */ + UpdateBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.UpdateBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.UpdateBackupRequest(); + if (object.backup != null) { + if (typeof object.backup !== "object") + throw TypeError(".google.cloud.sql.v1beta4.UpdateBackupRequest.backup: object expected"); + message.backup = $root.google.cloud.sql.v1beta4.Backup.fromObject(object.backup); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.cloud.sql.v1beta4.UpdateBackupRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.UpdateBackupRequest} message UpdateBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.backup = null; + object.updateMask = null; + } + if (message.backup != null && message.hasOwnProperty("backup")) + object.backup = $root.google.cloud.sql.v1beta4.Backup.toObject(message.backup, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.UpdateBackupRequest"; + }; + + return UpdateBackupRequest; + })(); + + v1beta4.DeleteBackupRequest = (function() { + + /** + * Properties of a DeleteBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IDeleteBackupRequest + * @property {string|null} [name] DeleteBackupRequest name + */ + + /** + * Constructs a new DeleteBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DeleteBackupRequest. + * @implements IDeleteBackupRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest=} [properties] Properties to set + */ + function DeleteBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteBackupRequest name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @instance + */ + DeleteBackupRequest.prototype.name = ""; + + /** + * Creates a new DeleteBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DeleteBackupRequest} DeleteBackupRequest instance + */ + DeleteBackupRequest.create = function create(properties) { + return new DeleteBackupRequest(properties); + }; + + /** + * Encodes the specified DeleteBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.DeleteBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest} message DeleteBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DeleteBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest} message DeleteBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DeleteBackupRequest} DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DeleteBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DeleteBackupRequest} DeleteBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DeleteBackupRequest} DeleteBackupRequest + */ + DeleteBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DeleteBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.DeleteBackupRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.DeleteBackupRequest} message DeleteBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DeleteBackupRequest"; + }; + + return DeleteBackupRequest; + })(); + + v1beta4.SqlBackupRunsDeleteRequest = (function() { + + /** + * Properties of a SqlBackupRunsDeleteRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlBackupRunsDeleteRequest + * @property {number|Long|null} [id] SqlBackupRunsDeleteRequest id + * @property {string|null} [instance] SqlBackupRunsDeleteRequest instance + * @property {string|null} [project] SqlBackupRunsDeleteRequest project + */ + + /** + * Constructs a new SqlBackupRunsDeleteRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlBackupRunsDeleteRequest. + * @implements ISqlBackupRunsDeleteRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest=} [properties] Properties to set + */ + function SqlBackupRunsDeleteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBackupRunsDeleteRequest id. + * @member {number|Long} id + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @instance + */ + SqlBackupRunsDeleteRequest.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SqlBackupRunsDeleteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @instance + */ + SqlBackupRunsDeleteRequest.prototype.instance = ""; + + /** + * SqlBackupRunsDeleteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @instance + */ + SqlBackupRunsDeleteRequest.prototype.project = ""; + + /** + * Creates a new SqlBackupRunsDeleteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest instance + */ + SqlBackupRunsDeleteRequest.create = function create(properties) { + return new SqlBackupRunsDeleteRequest(properties); + }; + + /** + * Encodes the specified SqlBackupRunsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsDeleteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlBackupRunsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsDeleteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.id = reader.int64(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsDeleteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBackupRunsDeleteRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBackupRunsDeleteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlBackupRunsDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest + */ + SqlBackupRunsDeleteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(); + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = false; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlBackupRunsDeleteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBackupRunsDeleteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + object.instance = ""; + object.project = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlBackupRunsDeleteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlBackupRunsDeleteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBackupRunsDeleteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBackupRunsDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest"; + }; + + return SqlBackupRunsDeleteRequest; + })(); + + v1beta4.SqlBackupRunsGetRequest = (function() { + + /** + * Properties of a SqlBackupRunsGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlBackupRunsGetRequest + * @property {number|Long|null} [id] SqlBackupRunsGetRequest id + * @property {string|null} [instance] SqlBackupRunsGetRequest instance + * @property {string|null} [project] SqlBackupRunsGetRequest project + */ + + /** + * Constructs a new SqlBackupRunsGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlBackupRunsGetRequest. + * @implements ISqlBackupRunsGetRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest=} [properties] Properties to set + */ + function SqlBackupRunsGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBackupRunsGetRequest id. + * @member {number|Long} id + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @instance + */ + SqlBackupRunsGetRequest.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SqlBackupRunsGetRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @instance + */ + SqlBackupRunsGetRequest.prototype.instance = ""; + + /** + * SqlBackupRunsGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @instance + */ + SqlBackupRunsGetRequest.prototype.project = ""; + + /** + * Creates a new SqlBackupRunsGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest instance + */ + SqlBackupRunsGetRequest.create = function create(properties) { + return new SqlBackupRunsGetRequest(properties); + }; + + /** + * Encodes the specified SqlBackupRunsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest} message SqlBackupRunsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlBackupRunsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest} message SqlBackupRunsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.id = reader.int64(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBackupRunsGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBackupRunsGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlBackupRunsGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest + */ + SqlBackupRunsGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(); + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = false; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlBackupRunsGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlBackupRunsGetRequest} message SqlBackupRunsGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBackupRunsGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + object.instance = ""; + object.project = ""; + } + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlBackupRunsGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlBackupRunsGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBackupRunsGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBackupRunsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlBackupRunsGetRequest"; + }; + + return SqlBackupRunsGetRequest; + })(); + + v1beta4.SqlBackupRunsInsertRequest = (function() { + + /** + * Properties of a SqlBackupRunsInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlBackupRunsInsertRequest + * @property {string|null} [instance] SqlBackupRunsInsertRequest instance + * @property {string|null} [project] SqlBackupRunsInsertRequest project + * @property {google.cloud.sql.v1beta4.IBackupRun|null} [body] SqlBackupRunsInsertRequest body + */ + + /** + * Constructs a new SqlBackupRunsInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlBackupRunsInsertRequest. + * @implements ISqlBackupRunsInsertRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest=} [properties] Properties to set + */ + function SqlBackupRunsInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBackupRunsInsertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @instance + */ + SqlBackupRunsInsertRequest.prototype.instance = ""; + + /** + * SqlBackupRunsInsertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @instance + */ + SqlBackupRunsInsertRequest.prototype.project = ""; + + /** + * SqlBackupRunsInsertRequest body. + * @member {google.cloud.sql.v1beta4.IBackupRun|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @instance + */ + SqlBackupRunsInsertRequest.prototype.body = null; + + /** + * Creates a new SqlBackupRunsInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest instance + */ + SqlBackupRunsInsertRequest.create = function create(properties) { + return new SqlBackupRunsInsertRequest(properties); + }; + + /** + * Encodes the specified SqlBackupRunsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.BackupRun.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlBackupRunsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.BackupRun.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBackupRunsInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBackupRunsInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.BackupRun.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlBackupRunsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest + */ + SqlBackupRunsInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.BackupRun.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlBackupRunsInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBackupRunsInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.BackupRun.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlBackupRunsInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlBackupRunsInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBackupRunsInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBackupRunsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest"; + }; + + return SqlBackupRunsInsertRequest; + })(); + + v1beta4.SqlBackupRunsListRequest = (function() { + + /** + * Properties of a SqlBackupRunsListRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlBackupRunsListRequest + * @property {string|null} [instance] SqlBackupRunsListRequest instance + * @property {number|null} [maxResults] SqlBackupRunsListRequest maxResults + * @property {string|null} [pageToken] SqlBackupRunsListRequest pageToken + * @property {string|null} [project] SqlBackupRunsListRequest project + */ + + /** + * Constructs a new SqlBackupRunsListRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlBackupRunsListRequest. + * @implements ISqlBackupRunsListRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest=} [properties] Properties to set + */ + function SqlBackupRunsListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBackupRunsListRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @instance + */ + SqlBackupRunsListRequest.prototype.instance = ""; + + /** + * SqlBackupRunsListRequest maxResults. + * @member {number} maxResults + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @instance + */ + SqlBackupRunsListRequest.prototype.maxResults = 0; + + /** + * SqlBackupRunsListRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @instance + */ + SqlBackupRunsListRequest.prototype.pageToken = ""; + + /** + * SqlBackupRunsListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @instance + */ + SqlBackupRunsListRequest.prototype.project = ""; + + /** + * Creates a new SqlBackupRunsListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsListRequest} SqlBackupRunsListRequest instance + */ + SqlBackupRunsListRequest.create = function create(properties) { + return new SqlBackupRunsListRequest(properties); + }; + + /** + * Encodes the specified SqlBackupRunsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest} message SqlBackupRunsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlBackupRunsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest} message SqlBackupRunsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBackupRunsListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsListRequest} SqlBackupRunsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.maxResults = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsListRequest} SqlBackupRunsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBackupRunsListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBackupRunsListRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBackupRunsListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlBackupRunsListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlBackupRunsListRequest} SqlBackupRunsListRequest + */ + SqlBackupRunsListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlBackupRunsListRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.maxResults != null) + message.maxResults = object.maxResults | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlBackupRunsListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlBackupRunsListRequest} message SqlBackupRunsListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBackupRunsListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.maxResults = 0; + object.pageToken = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlBackupRunsListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlBackupRunsListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBackupRunsListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBackupRunsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlBackupRunsListRequest"; + }; + + return SqlBackupRunsListRequest; + })(); + + v1beta4.SqlDatabasesDeleteRequest = (function() { + + /** + * Properties of a SqlDatabasesDeleteRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlDatabasesDeleteRequest + * @property {string|null} [database] SqlDatabasesDeleteRequest database + * @property {string|null} [instance] SqlDatabasesDeleteRequest instance + * @property {string|null} [project] SqlDatabasesDeleteRequest project + */ + + /** + * Constructs a new SqlDatabasesDeleteRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlDatabasesDeleteRequest. + * @implements ISqlDatabasesDeleteRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest=} [properties] Properties to set + */ + function SqlDatabasesDeleteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlDatabasesDeleteRequest database. + * @member {string} database + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @instance + */ + SqlDatabasesDeleteRequest.prototype.database = ""; + + /** + * SqlDatabasesDeleteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @instance + */ + SqlDatabasesDeleteRequest.prototype.instance = ""; + + /** + * SqlDatabasesDeleteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @instance + */ + SqlDatabasesDeleteRequest.prototype.project = ""; + + /** + * Creates a new SqlDatabasesDeleteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest instance + */ + SqlDatabasesDeleteRequest.create = function create(properties) { + return new SqlDatabasesDeleteRequest(properties); + }; + + /** + * Encodes the specified SqlDatabasesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesDeleteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlDatabasesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesDeleteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesDeleteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlDatabasesDeleteRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlDatabasesDeleteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlDatabasesDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest + */ + SqlDatabasesDeleteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlDatabasesDeleteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlDatabasesDeleteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.database = ""; + object.instance = ""; + object.project = ""; + } + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlDatabasesDeleteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlDatabasesDeleteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlDatabasesDeleteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlDatabasesDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest"; + }; + + return SqlDatabasesDeleteRequest; + })(); + + v1beta4.SqlDatabasesGetRequest = (function() { + + /** + * Properties of a SqlDatabasesGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlDatabasesGetRequest + * @property {string|null} [database] SqlDatabasesGetRequest database + * @property {string|null} [instance] SqlDatabasesGetRequest instance + * @property {string|null} [project] SqlDatabasesGetRequest project + */ + + /** + * Constructs a new SqlDatabasesGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlDatabasesGetRequest. + * @implements ISqlDatabasesGetRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest=} [properties] Properties to set + */ + function SqlDatabasesGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlDatabasesGetRequest database. + * @member {string} database + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @instance + */ + SqlDatabasesGetRequest.prototype.database = ""; + + /** + * SqlDatabasesGetRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @instance + */ + SqlDatabasesGetRequest.prototype.instance = ""; + + /** + * SqlDatabasesGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @instance + */ + SqlDatabasesGetRequest.prototype.project = ""; + + /** + * Creates a new SqlDatabasesGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlDatabasesGetRequest} SqlDatabasesGetRequest instance + */ + SqlDatabasesGetRequest.create = function create(properties) { + return new SqlDatabasesGetRequest(properties); + }; + + /** + * Encodes the specified SqlDatabasesGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest} message SqlDatabasesGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlDatabasesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest} message SqlDatabasesGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlDatabasesGetRequest} SqlDatabasesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlDatabasesGetRequest} SqlDatabasesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlDatabasesGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlDatabasesGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlDatabasesGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlDatabasesGetRequest} SqlDatabasesGetRequest + */ + SqlDatabasesGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlDatabasesGetRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlDatabasesGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlDatabasesGetRequest} message SqlDatabasesGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlDatabasesGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.database = ""; + object.instance = ""; + object.project = ""; + } + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlDatabasesGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlDatabasesGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlDatabasesGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlDatabasesGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlDatabasesGetRequest"; + }; + + return SqlDatabasesGetRequest; + })(); + + v1beta4.SqlDatabasesInsertRequest = (function() { + + /** + * Properties of a SqlDatabasesInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlDatabasesInsertRequest + * @property {string|null} [instance] SqlDatabasesInsertRequest instance + * @property {string|null} [project] SqlDatabasesInsertRequest project + * @property {google.cloud.sql.v1beta4.IDatabase|null} [body] SqlDatabasesInsertRequest body + */ + + /** + * Constructs a new SqlDatabasesInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlDatabasesInsertRequest. + * @implements ISqlDatabasesInsertRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest=} [properties] Properties to set + */ + function SqlDatabasesInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlDatabasesInsertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @instance + */ + SqlDatabasesInsertRequest.prototype.instance = ""; + + /** + * SqlDatabasesInsertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @instance + */ + SqlDatabasesInsertRequest.prototype.project = ""; + + /** + * SqlDatabasesInsertRequest body. + * @member {google.cloud.sql.v1beta4.IDatabase|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @instance + */ + SqlDatabasesInsertRequest.prototype.body = null; + + /** + * Creates a new SqlDatabasesInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest instance + */ + SqlDatabasesInsertRequest.create = function create(properties) { + return new SqlDatabasesInsertRequest(properties); + }; + + /** + * Encodes the specified SqlDatabasesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest} message SqlDatabasesInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.Database.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlDatabasesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest} message SqlDatabasesInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.Database.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlDatabasesInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlDatabasesInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.Database.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlDatabasesInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest + */ + SqlDatabasesInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlDatabasesInsertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.Database.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlDatabasesInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlDatabasesInsertRequest} message SqlDatabasesInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlDatabasesInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.Database.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlDatabasesInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlDatabasesInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlDatabasesInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlDatabasesInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlDatabasesInsertRequest"; + }; + + return SqlDatabasesInsertRequest; + })(); + + v1beta4.SqlDatabasesListRequest = (function() { + + /** + * Properties of a SqlDatabasesListRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlDatabasesListRequest + * @property {string|null} [instance] SqlDatabasesListRequest instance + * @property {string|null} [project] SqlDatabasesListRequest project + */ + + /** + * Constructs a new SqlDatabasesListRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlDatabasesListRequest. + * @implements ISqlDatabasesListRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest=} [properties] Properties to set + */ + function SqlDatabasesListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlDatabasesListRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @instance + */ + SqlDatabasesListRequest.prototype.instance = ""; + + /** + * SqlDatabasesListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @instance + */ + SqlDatabasesListRequest.prototype.project = ""; + + /** + * Creates a new SqlDatabasesListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlDatabasesListRequest} SqlDatabasesListRequest instance + */ + SqlDatabasesListRequest.create = function create(properties) { + return new SqlDatabasesListRequest(properties); + }; + + /** + * Encodes the specified SqlDatabasesListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest} message SqlDatabasesListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlDatabasesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest} message SqlDatabasesListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlDatabasesListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlDatabasesListRequest} SqlDatabasesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlDatabasesListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlDatabasesListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlDatabasesListRequest} SqlDatabasesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlDatabasesListRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlDatabasesListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlDatabasesListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlDatabasesListRequest} SqlDatabasesListRequest + */ + SqlDatabasesListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlDatabasesListRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlDatabasesListRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlDatabasesListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlDatabasesListRequest} message SqlDatabasesListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlDatabasesListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlDatabasesListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlDatabasesListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlDatabasesListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlDatabasesListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlDatabasesListRequest"; + }; + + return SqlDatabasesListRequest; + })(); + + v1beta4.SqlDatabasesUpdateRequest = (function() { + + /** + * Properties of a SqlDatabasesUpdateRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlDatabasesUpdateRequest + * @property {string|null} [database] SqlDatabasesUpdateRequest database + * @property {string|null} [instance] SqlDatabasesUpdateRequest instance + * @property {string|null} [project] SqlDatabasesUpdateRequest project + * @property {google.cloud.sql.v1beta4.IDatabase|null} [body] SqlDatabasesUpdateRequest body + */ + + /** + * Constructs a new SqlDatabasesUpdateRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlDatabasesUpdateRequest. + * @implements ISqlDatabasesUpdateRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest=} [properties] Properties to set + */ + function SqlDatabasesUpdateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlDatabasesUpdateRequest database. + * @member {string} database + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @instance + */ + SqlDatabasesUpdateRequest.prototype.database = ""; + + /** + * SqlDatabasesUpdateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @instance + */ + SqlDatabasesUpdateRequest.prototype.instance = ""; + + /** + * SqlDatabasesUpdateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @instance + */ + SqlDatabasesUpdateRequest.prototype.project = ""; + + /** + * SqlDatabasesUpdateRequest body. + * @member {google.cloud.sql.v1beta4.IDatabase|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @instance + */ + SqlDatabasesUpdateRequest.prototype.body = null; + + /** + * Creates a new SqlDatabasesUpdateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest instance + */ + SqlDatabasesUpdateRequest.create = function create(properties) { + return new SqlDatabasesUpdateRequest(properties); + }; + + /** + * Encodes the specified SqlDatabasesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesUpdateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.Database.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlDatabasesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlDatabasesUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesUpdateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.Database.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlDatabasesUpdateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlDatabasesUpdateRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlDatabasesUpdateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.Database.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlDatabasesUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest + */ + SqlDatabasesUpdateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(); + if (object.database != null) + message.database = String(object.database); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.Database.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlDatabasesUpdateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlDatabasesUpdateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.database = ""; + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.Database.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlDatabasesUpdateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlDatabasesUpdateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlDatabasesUpdateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlDatabasesUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest"; + }; + + return SqlDatabasesUpdateRequest; + })(); + + v1beta4.SqlFlagsListRequest = (function() { + + /** + * Properties of a SqlFlagsListRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlFlagsListRequest + * @property {string|null} [databaseVersion] SqlFlagsListRequest databaseVersion + * @property {google.cloud.sql.v1beta4.SqlFlagScope|null} [flagScope] SqlFlagsListRequest flagScope + */ + + /** + * Constructs a new SqlFlagsListRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlFlagsListRequest. + * @implements ISqlFlagsListRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest=} [properties] Properties to set + */ + function SqlFlagsListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlFlagsListRequest databaseVersion. + * @member {string} databaseVersion + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @instance + */ + SqlFlagsListRequest.prototype.databaseVersion = ""; + + /** + * SqlFlagsListRequest flagScope. + * @member {google.cloud.sql.v1beta4.SqlFlagScope|null|undefined} flagScope + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @instance + */ + SqlFlagsListRequest.prototype.flagScope = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlFlagsListRequest.prototype, "_flagScope", { + get: $util.oneOfGetter($oneOfFields = ["flagScope"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlFlagsListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlFlagsListRequest} SqlFlagsListRequest instance + */ + SqlFlagsListRequest.create = function create(properties) { + return new SqlFlagsListRequest(properties); + }; + + /** + * Encodes the specified SqlFlagsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlFlagsListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest} message SqlFlagsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlFlagsListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.databaseVersion); + if (message.flagScope != null && Object.hasOwnProperty.call(message, "flagScope")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.flagScope); + return writer; + }; + + /** + * Encodes the specified SqlFlagsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlFlagsListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest} message SqlFlagsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlFlagsListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlFlagsListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlFlagsListRequest} SqlFlagsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlFlagsListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlFlagsListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.databaseVersion = reader.string(); + break; + } + case 3: { + message.flagScope = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlFlagsListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlFlagsListRequest} SqlFlagsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlFlagsListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlFlagsListRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlFlagsListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + if (!$util.isString(message.databaseVersion)) + return "databaseVersion: string expected"; + if (message.flagScope != null && message.hasOwnProperty("flagScope")) { + properties._flagScope = 1; + switch (message.flagScope) { + default: + return "flagScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates a SqlFlagsListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlFlagsListRequest} SqlFlagsListRequest + */ + SqlFlagsListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlFlagsListRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlFlagsListRequest(); + if (object.databaseVersion != null) + message.databaseVersion = String(object.databaseVersion); + switch (object.flagScope) { + default: + if (typeof object.flagScope === "number") { + message.flagScope = object.flagScope; + break; + } + break; + case "SQL_FLAG_SCOPE_UNSPECIFIED": + case 0: + message.flagScope = 0; + break; + case "SQL_FLAG_SCOPE_DATABASE": + case 1: + message.flagScope = 1; + break; + case "SQL_FLAG_SCOPE_CONNECTION_POOL": + case 2: + message.flagScope = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a SqlFlagsListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlFlagsListRequest} message SqlFlagsListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlFlagsListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.databaseVersion = ""; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + object.databaseVersion = message.databaseVersion; + if (message.flagScope != null && message.hasOwnProperty("flagScope")) { + object.flagScope = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlFlagScope[message.flagScope] === undefined ? message.flagScope : $root.google.cloud.sql.v1beta4.SqlFlagScope[message.flagScope] : message.flagScope; + if (options.oneofs) + object._flagScope = "flagScope"; + } + return object; + }; + + /** + * Converts this SqlFlagsListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlFlagsListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlFlagsListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlFlagsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlFlagsListRequest"; + }; + + return SqlFlagsListRequest; + })(); + + v1beta4.SqlInstancesAddServerCaRequest = (function() { + + /** + * Properties of a SqlInstancesAddServerCaRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesAddServerCaRequest + * @property {string|null} [instance] SqlInstancesAddServerCaRequest instance + * @property {string|null} [project] SqlInstancesAddServerCaRequest project + */ + + /** + * Constructs a new SqlInstancesAddServerCaRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesAddServerCaRequest. + * @implements ISqlInstancesAddServerCaRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest=} [properties] Properties to set + */ + function SqlInstancesAddServerCaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesAddServerCaRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @instance + */ + SqlInstancesAddServerCaRequest.prototype.instance = ""; + + /** + * SqlInstancesAddServerCaRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @instance + */ + SqlInstancesAddServerCaRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesAddServerCaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest instance + */ + SqlInstancesAddServerCaRequest.create = function create(properties) { + return new SqlInstancesAddServerCaRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesAddServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddServerCaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesAddServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddServerCaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddServerCaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesAddServerCaRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesAddServerCaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesAddServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest + */ + SqlInstancesAddServerCaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesAddServerCaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesAddServerCaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesAddServerCaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesAddServerCaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesAddServerCaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesAddServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest"; + }; + + return SqlInstancesAddServerCaRequest; + })(); + + v1beta4.SqlInstancesAddServerCertificateRequest = (function() { + + /** + * Properties of a SqlInstancesAddServerCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesAddServerCertificateRequest + * @property {string|null} [instance] SqlInstancesAddServerCertificateRequest instance + * @property {string|null} [project] SqlInstancesAddServerCertificateRequest project + */ + + /** + * Constructs a new SqlInstancesAddServerCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesAddServerCertificateRequest. + * @implements ISqlInstancesAddServerCertificateRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest=} [properties] Properties to set + */ + function SqlInstancesAddServerCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesAddServerCertificateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @instance + */ + SqlInstancesAddServerCertificateRequest.prototype.instance = ""; + + /** + * SqlInstancesAddServerCertificateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @instance + */ + SqlInstancesAddServerCertificateRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesAddServerCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest instance + */ + SqlInstancesAddServerCertificateRequest.create = function create(properties) { + return new SqlInstancesAddServerCertificateRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesAddServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddServerCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesAddServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddServerCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesAddServerCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesAddServerCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesAddServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest + */ + SqlInstancesAddServerCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesAddServerCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesAddServerCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesAddServerCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesAddServerCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesAddServerCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesAddServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest"; + }; + + return SqlInstancesAddServerCertificateRequest; + })(); + + v1beta4.SqlInstancesAddEntraIdCertificateRequest = (function() { + + /** + * Properties of a SqlInstancesAddEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesAddEntraIdCertificateRequest + * @property {string|null} [instance] SqlInstancesAddEntraIdCertificateRequest instance + * @property {string|null} [project] SqlInstancesAddEntraIdCertificateRequest project + */ + + /** + * Constructs a new SqlInstancesAddEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesAddEntraIdCertificateRequest. + * @implements ISqlInstancesAddEntraIdCertificateRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest=} [properties] Properties to set + */ + function SqlInstancesAddEntraIdCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesAddEntraIdCertificateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @instance + */ + SqlInstancesAddEntraIdCertificateRequest.prototype.instance = ""; + + /** + * SqlInstancesAddEntraIdCertificateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @instance + */ + SqlInstancesAddEntraIdCertificateRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesAddEntraIdCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest instance + */ + SqlInstancesAddEntraIdCertificateRequest.create = function create(properties) { + return new SqlInstancesAddEntraIdCertificateRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddEntraIdCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAddEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddEntraIdCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAddEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesAddEntraIdCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesAddEntraIdCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesAddEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest + */ + SqlInstancesAddEntraIdCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesAddEntraIdCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesAddEntraIdCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesAddEntraIdCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesAddEntraIdCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesAddEntraIdCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesAddEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest"; + }; + + return SqlInstancesAddEntraIdCertificateRequest; + })(); + + v1beta4.SqlInstancesCloneRequest = (function() { + + /** + * Properties of a SqlInstancesCloneRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesCloneRequest + * @property {string|null} [instance] SqlInstancesCloneRequest instance + * @property {string|null} [project] SqlInstancesCloneRequest project + * @property {google.cloud.sql.v1beta4.IInstancesCloneRequest|null} [body] SqlInstancesCloneRequest body + */ + + /** + * Constructs a new SqlInstancesCloneRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesCloneRequest. + * @implements ISqlInstancesCloneRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest=} [properties] Properties to set + */ + function SqlInstancesCloneRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesCloneRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @instance + */ + SqlInstancesCloneRequest.prototype.instance = ""; + + /** + * SqlInstancesCloneRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @instance + */ + SqlInstancesCloneRequest.prototype.project = ""; + + /** + * SqlInstancesCloneRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesCloneRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @instance + */ + SqlInstancesCloneRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesCloneRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesCloneRequest} SqlInstancesCloneRequest instance + */ + SqlInstancesCloneRequest.create = function create(properties) { + return new SqlInstancesCloneRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCloneRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest} message SqlInstancesCloneRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesCloneRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesCloneRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCloneRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest} message SqlInstancesCloneRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesCloneRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesCloneRequest} SqlInstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesCloneRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesCloneRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesCloneRequest} SqlInstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesCloneRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesCloneRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesCloneRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesCloneRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesCloneRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesCloneRequest} SqlInstancesCloneRequest + */ + SqlInstancesCloneRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesCloneRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesCloneRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesCloneRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesCloneRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesCloneRequest} message SqlInstancesCloneRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesCloneRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesCloneRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesCloneRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesCloneRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesCloneRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesCloneRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesCloneRequest"; + }; + + return SqlInstancesCloneRequest; + })(); + + v1beta4.SqlInstancesDeleteRequest = (function() { + + /** + * Properties of a SqlInstancesDeleteRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesDeleteRequest + * @property {string|null} [instance] SqlInstancesDeleteRequest instance + * @property {string|null} [project] SqlInstancesDeleteRequest project + * @property {boolean|null} [enableFinalBackup] SqlInstancesDeleteRequest enableFinalBackup + * @property {number|Long|null} [finalBackupTtlDays] SqlInstancesDeleteRequest finalBackupTtlDays + * @property {google.protobuf.ITimestamp|null} [finalBackupExpiryTime] SqlInstancesDeleteRequest finalBackupExpiryTime + * @property {string|null} [finalBackupDescription] SqlInstancesDeleteRequest finalBackupDescription + */ + + /** + * Constructs a new SqlInstancesDeleteRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesDeleteRequest. + * @implements ISqlInstancesDeleteRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest=} [properties] Properties to set + */ + function SqlInstancesDeleteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesDeleteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.instance = ""; + + /** + * SqlInstancesDeleteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.project = ""; + + /** + * SqlInstancesDeleteRequest enableFinalBackup. + * @member {boolean|null|undefined} enableFinalBackup + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.enableFinalBackup = null; + + /** + * SqlInstancesDeleteRequest finalBackupTtlDays. + * @member {number|Long|null|undefined} finalBackupTtlDays + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.finalBackupTtlDays = null; + + /** + * SqlInstancesDeleteRequest finalBackupExpiryTime. + * @member {google.protobuf.ITimestamp|null|undefined} finalBackupExpiryTime + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.finalBackupExpiryTime = null; + + /** + * SqlInstancesDeleteRequest finalBackupDescription. + * @member {string} finalBackupDescription + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @instance + */ + SqlInstancesDeleteRequest.prototype.finalBackupDescription = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlInstancesDeleteRequest.prototype, "_enableFinalBackup", { + get: $util.oneOfGetter($oneOfFields = ["enableFinalBackup"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * SqlInstancesDeleteRequest expiration. + * @member {"finalBackupTtlDays"|"finalBackupExpiryTime"|undefined} expiration + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @instance + */ + Object.defineProperty(SqlInstancesDeleteRequest.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["finalBackupTtlDays", "finalBackupExpiryTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlInstancesDeleteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest instance + */ + SqlInstancesDeleteRequest.create = function create(properties) { + return new SqlInstancesDeleteRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDeleteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest} message SqlInstancesDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDeleteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.finalBackupTtlDays != null && Object.hasOwnProperty.call(message, "finalBackupTtlDays")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.finalBackupTtlDays); + if (message.finalBackupDescription != null && Object.hasOwnProperty.call(message, "finalBackupDescription")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.finalBackupDescription); + if (message.finalBackupExpiryTime != null && Object.hasOwnProperty.call(message, "finalBackupExpiryTime")) + $root.google.protobuf.Timestamp.encode(message.finalBackupExpiryTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.enableFinalBackup != null && Object.hasOwnProperty.call(message, "enableFinalBackup")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.enableFinalBackup); + return writer; + }; + + /** + * Encodes the specified SqlInstancesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDeleteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest} message SqlInstancesDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDeleteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 7: { + message.enableFinalBackup = reader.bool(); + break; + } + case 4: { + message.finalBackupTtlDays = reader.int64(); + break; + } + case 6: { + message.finalBackupExpiryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.finalBackupDescription = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDeleteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesDeleteRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesDeleteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.enableFinalBackup != null && message.hasOwnProperty("enableFinalBackup")) { + properties._enableFinalBackup = 1; + if (typeof message.enableFinalBackup !== "boolean") + return "enableFinalBackup: boolean expected"; + } + if (message.finalBackupTtlDays != null && message.hasOwnProperty("finalBackupTtlDays")) { + properties.expiration = 1; + if (!$util.isInteger(message.finalBackupTtlDays) && !(message.finalBackupTtlDays && $util.isInteger(message.finalBackupTtlDays.low) && $util.isInteger(message.finalBackupTtlDays.high))) + return "finalBackupTtlDays: integer|Long expected"; + } + if (message.finalBackupExpiryTime != null && message.hasOwnProperty("finalBackupExpiryTime")) { + if (properties.expiration === 1) + return "expiration: multiple values"; + properties.expiration = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.finalBackupExpiryTime); + if (error) + return "finalBackupExpiryTime." + error; + } + } + if (message.finalBackupDescription != null && message.hasOwnProperty("finalBackupDescription")) + if (!$util.isString(message.finalBackupDescription)) + return "finalBackupDescription: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest + */ + SqlInstancesDeleteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.enableFinalBackup != null) + message.enableFinalBackup = Boolean(object.enableFinalBackup); + if (object.finalBackupTtlDays != null) + if ($util.Long) + (message.finalBackupTtlDays = $util.Long.fromValue(object.finalBackupTtlDays)).unsigned = false; + else if (typeof object.finalBackupTtlDays === "string") + message.finalBackupTtlDays = parseInt(object.finalBackupTtlDays, 10); + else if (typeof object.finalBackupTtlDays === "number") + message.finalBackupTtlDays = object.finalBackupTtlDays; + else if (typeof object.finalBackupTtlDays === "object") + message.finalBackupTtlDays = new $util.LongBits(object.finalBackupTtlDays.low >>> 0, object.finalBackupTtlDays.high >>> 0).toNumber(); + if (object.finalBackupExpiryTime != null) { + if (typeof object.finalBackupExpiryTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesDeleteRequest.finalBackupExpiryTime: object expected"); + message.finalBackupExpiryTime = $root.google.protobuf.Timestamp.fromObject(object.finalBackupExpiryTime); + } + if (object.finalBackupDescription != null) + message.finalBackupDescription = String(object.finalBackupDescription); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesDeleteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesDeleteRequest} message SqlInstancesDeleteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesDeleteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.finalBackupDescription = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.finalBackupTtlDays != null && message.hasOwnProperty("finalBackupTtlDays")) { + if (typeof message.finalBackupTtlDays === "number") + object.finalBackupTtlDays = options.longs === String ? String(message.finalBackupTtlDays) : message.finalBackupTtlDays; + else + object.finalBackupTtlDays = options.longs === String ? $util.Long.prototype.toString.call(message.finalBackupTtlDays) : options.longs === Number ? new $util.LongBits(message.finalBackupTtlDays.low >>> 0, message.finalBackupTtlDays.high >>> 0).toNumber() : message.finalBackupTtlDays; + if (options.oneofs) + object.expiration = "finalBackupTtlDays"; + } + if (message.finalBackupDescription != null && message.hasOwnProperty("finalBackupDescription")) + object.finalBackupDescription = message.finalBackupDescription; + if (message.finalBackupExpiryTime != null && message.hasOwnProperty("finalBackupExpiryTime")) { + object.finalBackupExpiryTime = $root.google.protobuf.Timestamp.toObject(message.finalBackupExpiryTime, options); + if (options.oneofs) + object.expiration = "finalBackupExpiryTime"; + } + if (message.enableFinalBackup != null && message.hasOwnProperty("enableFinalBackup")) { + object.enableFinalBackup = message.enableFinalBackup; + if (options.oneofs) + object._enableFinalBackup = "enableFinalBackup"; + } + return object; + }; + + /** + * Converts this SqlInstancesDeleteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesDeleteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesDeleteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesDeleteRequest"; + }; + + return SqlInstancesDeleteRequest; + })(); + + v1beta4.SqlInstancesDemoteMasterRequest = (function() { + + /** + * Properties of a SqlInstancesDemoteMasterRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesDemoteMasterRequest + * @property {string|null} [instance] SqlInstancesDemoteMasterRequest instance + * @property {string|null} [project] SqlInstancesDemoteMasterRequest project + * @property {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest|null} [body] SqlInstancesDemoteMasterRequest body + */ + + /** + * Constructs a new SqlInstancesDemoteMasterRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesDemoteMasterRequest. + * @implements ISqlInstancesDemoteMasterRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest=} [properties] Properties to set + */ + function SqlInstancesDemoteMasterRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesDemoteMasterRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @instance + */ + SqlInstancesDemoteMasterRequest.prototype.instance = ""; + + /** + * SqlInstancesDemoteMasterRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @instance + */ + SqlInstancesDemoteMasterRequest.prototype.project = ""; + + /** + * SqlInstancesDemoteMasterRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @instance + */ + SqlInstancesDemoteMasterRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesDemoteMasterRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest instance + */ + SqlInstancesDemoteMasterRequest.create = function create(properties) { + return new SqlInstancesDemoteMasterRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDemoteMasterRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDemoteMasterRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDemoteMasterRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDemoteMasterRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesDemoteMasterRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesDemoteMasterRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest + */ + SqlInstancesDemoteMasterRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesDemoteMasterRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesDemoteMasterRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesDemoteMasterRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesDemoteMasterRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesDemoteMasterRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesDemoteMasterRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest"; + }; + + return SqlInstancesDemoteMasterRequest; + })(); + + v1beta4.SqlInstancesDemoteRequest = (function() { + + /** + * Properties of a SqlInstancesDemoteRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesDemoteRequest + * @property {string|null} [instance] SqlInstancesDemoteRequest instance + * @property {string|null} [project] SqlInstancesDemoteRequest project + * @property {google.cloud.sql.v1beta4.IInstancesDemoteRequest|null} [body] SqlInstancesDemoteRequest body + */ + + /** + * Constructs a new SqlInstancesDemoteRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesDemoteRequest. + * @implements ISqlInstancesDemoteRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest=} [properties] Properties to set + */ + function SqlInstancesDemoteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesDemoteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @instance + */ + SqlInstancesDemoteRequest.prototype.instance = ""; + + /** + * SqlInstancesDemoteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @instance + */ + SqlInstancesDemoteRequest.prototype.project = ""; + + /** + * SqlInstancesDemoteRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesDemoteRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @instance + */ + SqlInstancesDemoteRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesDemoteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest instance + */ + SqlInstancesDemoteRequest.create = function create(properties) { + return new SqlInstancesDemoteRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest} message SqlInstancesDemoteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDemoteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesDemoteRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest} message SqlInstancesDemoteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesDemoteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDemoteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesDemoteRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesDemoteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesDemoteRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesDemoteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesDemoteRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest + */ + SqlInstancesDemoteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesDemoteRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesDemoteRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesDemoteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesDemoteRequest} message SqlInstancesDemoteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesDemoteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesDemoteRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesDemoteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesDemoteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesDemoteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesDemoteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesDemoteRequest"; + }; + + return SqlInstancesDemoteRequest; + })(); + + v1beta4.SqlInstancesExportRequest = (function() { + + /** + * Properties of a SqlInstancesExportRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesExportRequest + * @property {string|null} [instance] SqlInstancesExportRequest instance + * @property {string|null} [project] SqlInstancesExportRequest project + * @property {google.cloud.sql.v1beta4.IInstancesExportRequest|null} [body] SqlInstancesExportRequest body + */ + + /** + * Constructs a new SqlInstancesExportRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesExportRequest. + * @implements ISqlInstancesExportRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest=} [properties] Properties to set + */ + function SqlInstancesExportRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesExportRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @instance + */ + SqlInstancesExportRequest.prototype.instance = ""; + + /** + * SqlInstancesExportRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @instance + */ + SqlInstancesExportRequest.prototype.project = ""; + + /** + * SqlInstancesExportRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesExportRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @instance + */ + SqlInstancesExportRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesExportRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesExportRequest} SqlInstancesExportRequest instance + */ + SqlInstancesExportRequest.create = function create(properties) { + return new SqlInstancesExportRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExportRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest} message SqlInstancesExportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExportRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesExportRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExportRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest} message SqlInstancesExportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExportRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesExportRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesExportRequest} SqlInstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExportRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesExportRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesExportRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesExportRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesExportRequest} SqlInstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExportRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesExportRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesExportRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesExportRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesExportRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesExportRequest} SqlInstancesExportRequest + */ + SqlInstancesExportRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesExportRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesExportRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExportRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesExportRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesExportRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesExportRequest} message SqlInstancesExportRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesExportRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesExportRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesExportRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesExportRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesExportRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesExportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesExportRequest"; + }; + + return SqlInstancesExportRequest; + })(); + + v1beta4.SqlInstancesFailoverRequest = (function() { + + /** + * Properties of a SqlInstancesFailoverRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesFailoverRequest + * @property {string|null} [instance] SqlInstancesFailoverRequest instance + * @property {string|null} [project] SqlInstancesFailoverRequest project + * @property {google.cloud.sql.v1beta4.IInstancesFailoverRequest|null} [body] SqlInstancesFailoverRequest body + */ + + /** + * Constructs a new SqlInstancesFailoverRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesFailoverRequest. + * @implements ISqlInstancesFailoverRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest=} [properties] Properties to set + */ + function SqlInstancesFailoverRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesFailoverRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @instance + */ + SqlInstancesFailoverRequest.prototype.instance = ""; + + /** + * SqlInstancesFailoverRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @instance + */ + SqlInstancesFailoverRequest.prototype.project = ""; + + /** + * SqlInstancesFailoverRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesFailoverRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @instance + */ + SqlInstancesFailoverRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesFailoverRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest instance + */ + SqlInstancesFailoverRequest.create = function create(properties) { + return new SqlInstancesFailoverRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesFailoverRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest} message SqlInstancesFailoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesFailoverRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesFailoverRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesFailoverRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest} message SqlInstancesFailoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesFailoverRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesFailoverRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesFailoverRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesFailoverRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesFailoverRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesFailoverRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesFailoverRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest + */ + SqlInstancesFailoverRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesFailoverRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesFailoverRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesFailoverRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesFailoverRequest} message SqlInstancesFailoverRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesFailoverRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesFailoverRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesFailoverRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesFailoverRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesFailoverRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesFailoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesFailoverRequest"; + }; + + return SqlInstancesFailoverRequest; + })(); + + v1beta4.SqlInstancesGetRequest = (function() { + + /** + * Properties of a SqlInstancesGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesGetRequest + * @property {string|null} [instance] SqlInstancesGetRequest instance + * @property {string|null} [project] SqlInstancesGetRequest project + */ + + /** + * Constructs a new SqlInstancesGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesGetRequest. + * @implements ISqlInstancesGetRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest=} [properties] Properties to set + */ + function SqlInstancesGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesGetRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @instance + */ + SqlInstancesGetRequest.prototype.instance = ""; + + /** + * SqlInstancesGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @instance + */ + SqlInstancesGetRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetRequest} SqlInstancesGetRequest instance + */ + SqlInstancesGetRequest.create = function create(properties) { + return new SqlInstancesGetRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest} message SqlInstancesGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest} message SqlInstancesGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetRequest} SqlInstancesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetRequest} SqlInstancesGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetRequest} SqlInstancesGetRequest + */ + SqlInstancesGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesGetRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesGetRequest} message SqlInstancesGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesGetRequest"; + }; + + return SqlInstancesGetRequest; + })(); + + v1beta4.SqlInstancesImportRequest = (function() { + + /** + * Properties of a SqlInstancesImportRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesImportRequest + * @property {string|null} [instance] SqlInstancesImportRequest instance + * @property {string|null} [project] SqlInstancesImportRequest project + * @property {google.cloud.sql.v1beta4.IInstancesImportRequest|null} [body] SqlInstancesImportRequest body + */ + + /** + * Constructs a new SqlInstancesImportRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesImportRequest. + * @implements ISqlInstancesImportRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest=} [properties] Properties to set + */ + function SqlInstancesImportRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesImportRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @instance + */ + SqlInstancesImportRequest.prototype.instance = ""; + + /** + * SqlInstancesImportRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @instance + */ + SqlInstancesImportRequest.prototype.project = ""; + + /** + * SqlInstancesImportRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesImportRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @instance + */ + SqlInstancesImportRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesImportRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesImportRequest} SqlInstancesImportRequest instance + */ + SqlInstancesImportRequest.create = function create(properties) { + return new SqlInstancesImportRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesImportRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest} message SqlInstancesImportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesImportRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesImportRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesImportRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest} message SqlInstancesImportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesImportRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesImportRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesImportRequest} SqlInstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesImportRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesImportRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesImportRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesImportRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesImportRequest} SqlInstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesImportRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesImportRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesImportRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesImportRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesImportRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesImportRequest} SqlInstancesImportRequest + */ + SqlInstancesImportRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesImportRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesImportRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesImportRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesImportRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesImportRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesImportRequest} message SqlInstancesImportRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesImportRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesImportRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesImportRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesImportRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesImportRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesImportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesImportRequest"; + }; + + return SqlInstancesImportRequest; + })(); + + v1beta4.SqlInstancesInsertRequest = (function() { + + /** + * Properties of a SqlInstancesInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesInsertRequest + * @property {string|null} [project] SqlInstancesInsertRequest project + * @property {google.cloud.sql.v1beta4.IDatabaseInstance|null} [body] SqlInstancesInsertRequest body + */ + + /** + * Constructs a new SqlInstancesInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesInsertRequest. + * @implements ISqlInstancesInsertRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest=} [properties] Properties to set + */ + function SqlInstancesInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesInsertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @instance + */ + SqlInstancesInsertRequest.prototype.project = ""; + + /** + * SqlInstancesInsertRequest body. + * @member {google.cloud.sql.v1beta4.IDatabaseInstance|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @instance + */ + SqlInstancesInsertRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesInsertRequest} SqlInstancesInsertRequest instance + */ + SqlInstancesInsertRequest.create = function create(properties) { + return new SqlInstancesInsertRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest} message SqlInstancesInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest} message SqlInstancesInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesInsertRequest} SqlInstancesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesInsertRequest} SqlInstancesInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesInsertRequest} SqlInstancesInsertRequest + */ + SqlInstancesInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesInsertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesInsertRequest} message SqlInstancesInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.project = ""; + object.body = null; + } + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesInsertRequest"; + }; + + return SqlInstancesInsertRequest; + })(); + + v1beta4.SqlInstancesListRequest = (function() { + + /** + * Properties of a SqlInstancesListRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesListRequest + * @property {string|null} [filter] SqlInstancesListRequest filter + * @property {number|null} [maxResults] SqlInstancesListRequest maxResults + * @property {string|null} [pageToken] SqlInstancesListRequest pageToken + * @property {string|null} [project] SqlInstancesListRequest project + */ + + /** + * Constructs a new SqlInstancesListRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesListRequest. + * @implements ISqlInstancesListRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest=} [properties] Properties to set + */ + function SqlInstancesListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesListRequest filter. + * @member {string} filter + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @instance + */ + SqlInstancesListRequest.prototype.filter = ""; + + /** + * SqlInstancesListRequest maxResults. + * @member {number} maxResults + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @instance + */ + SqlInstancesListRequest.prototype.maxResults = 0; + + /** + * SqlInstancesListRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @instance + */ + SqlInstancesListRequest.prototype.pageToken = ""; + + /** + * SqlInstancesListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @instance + */ + SqlInstancesListRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesListRequest} SqlInstancesListRequest instance + */ + SqlInstancesListRequest.create = function create(properties) { + return new SqlInstancesListRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest} message SqlInstancesListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.maxResults); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest} message SqlInstancesListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesListRequest} SqlInstancesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.filter = reader.string(); + break; + } + case 2: { + message.maxResults = reader.uint32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesListRequest} SqlInstancesListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesListRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesListRequest} SqlInstancesListRequest + */ + SqlInstancesListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesListRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesListRequest(); + if (object.filter != null) + message.filter = String(object.filter); + if (object.maxResults != null) + message.maxResults = object.maxResults >>> 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesListRequest} message SqlInstancesListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.filter = ""; + object.maxResults = 0; + object.pageToken = ""; + object.project = ""; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesListRequest"; + }; + + return SqlInstancesListRequest; + })(); + + v1beta4.SqlInstancesListServerCasRequest = (function() { + + /** + * Properties of a SqlInstancesListServerCasRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesListServerCasRequest + * @property {string|null} [instance] SqlInstancesListServerCasRequest instance + * @property {string|null} [project] SqlInstancesListServerCasRequest project + */ + + /** + * Constructs a new SqlInstancesListServerCasRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesListServerCasRequest. + * @implements ISqlInstancesListServerCasRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest=} [properties] Properties to set + */ + function SqlInstancesListServerCasRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesListServerCasRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @instance + */ + SqlInstancesListServerCasRequest.prototype.instance = ""; + + /** + * SqlInstancesListServerCasRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @instance + */ + SqlInstancesListServerCasRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesListServerCasRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest instance + */ + SqlInstancesListServerCasRequest.create = function create(properties) { + return new SqlInstancesListServerCasRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesListServerCasRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListServerCasRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesListServerCasRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListServerCasRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListServerCasRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListServerCasRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesListServerCasRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesListServerCasRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesListServerCasRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest + */ + SqlInstancesListServerCasRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesListServerCasRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesListServerCasRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesListServerCasRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesListServerCasRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesListServerCasRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesListServerCasRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest"; + }; + + return SqlInstancesListServerCasRequest; + })(); + + v1beta4.SqlInstancesListServerCertificatesRequest = (function() { + + /** + * Properties of a SqlInstancesListServerCertificatesRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesListServerCertificatesRequest + * @property {string|null} [instance] SqlInstancesListServerCertificatesRequest instance + * @property {string|null} [project] SqlInstancesListServerCertificatesRequest project + */ + + /** + * Constructs a new SqlInstancesListServerCertificatesRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesListServerCertificatesRequest. + * @implements ISqlInstancesListServerCertificatesRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest=} [properties] Properties to set + */ + function SqlInstancesListServerCertificatesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesListServerCertificatesRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @instance + */ + SqlInstancesListServerCertificatesRequest.prototype.instance = ""; + + /** + * SqlInstancesListServerCertificatesRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @instance + */ + SqlInstancesListServerCertificatesRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesListServerCertificatesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest instance + */ + SqlInstancesListServerCertificatesRequest.create = function create(properties) { + return new SqlInstancesListServerCertificatesRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesListServerCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListServerCertificatesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesListServerCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListServerCertificatesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListServerCertificatesRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListServerCertificatesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesListServerCertificatesRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesListServerCertificatesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesListServerCertificatesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest + */ + SqlInstancesListServerCertificatesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesListServerCertificatesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesListServerCertificatesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesListServerCertificatesRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesListServerCertificatesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesListServerCertificatesRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesListServerCertificatesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest"; + }; + + return SqlInstancesListServerCertificatesRequest; + })(); + + v1beta4.SqlInstancesListEntraIdCertificatesRequest = (function() { + + /** + * Properties of a SqlInstancesListEntraIdCertificatesRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesListEntraIdCertificatesRequest + * @property {string|null} [instance] SqlInstancesListEntraIdCertificatesRequest instance + * @property {string|null} [project] SqlInstancesListEntraIdCertificatesRequest project + */ + + /** + * Constructs a new SqlInstancesListEntraIdCertificatesRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesListEntraIdCertificatesRequest. + * @implements ISqlInstancesListEntraIdCertificatesRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest=} [properties] Properties to set + */ + function SqlInstancesListEntraIdCertificatesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesListEntraIdCertificatesRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @instance + */ + SqlInstancesListEntraIdCertificatesRequest.prototype.instance = ""; + + /** + * SqlInstancesListEntraIdCertificatesRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @instance + */ + SqlInstancesListEntraIdCertificatesRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesListEntraIdCertificatesRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest instance + */ + SqlInstancesListEntraIdCertificatesRequest.create = function create(properties) { + return new SqlInstancesListEntraIdCertificatesRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListEntraIdCertificatesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesListEntraIdCertificatesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListEntraIdCertificatesRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesListEntraIdCertificatesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesListEntraIdCertificatesRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesListEntraIdCertificatesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesListEntraIdCertificatesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest + */ + SqlInstancesListEntraIdCertificatesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesListEntraIdCertificatesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesListEntraIdCertificatesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesListEntraIdCertificatesRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesListEntraIdCertificatesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesListEntraIdCertificatesRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesListEntraIdCertificatesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest"; + }; + + return SqlInstancesListEntraIdCertificatesRequest; + })(); + + v1beta4.SqlInstancesPatchRequest = (function() { + + /** + * Properties of a SqlInstancesPatchRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesPatchRequest + * @property {string|null} [instance] SqlInstancesPatchRequest instance + * @property {string|null} [project] SqlInstancesPatchRequest project + * @property {google.cloud.sql.v1beta4.IDatabaseInstance|null} [body] SqlInstancesPatchRequest body + */ + + /** + * Constructs a new SqlInstancesPatchRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesPatchRequest. + * @implements ISqlInstancesPatchRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest=} [properties] Properties to set + */ + function SqlInstancesPatchRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesPatchRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @instance + */ + SqlInstancesPatchRequest.prototype.instance = ""; + + /** + * SqlInstancesPatchRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @instance + */ + SqlInstancesPatchRequest.prototype.project = ""; + + /** + * SqlInstancesPatchRequest body. + * @member {google.cloud.sql.v1beta4.IDatabaseInstance|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @instance + */ + SqlInstancesPatchRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesPatchRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesPatchRequest} SqlInstancesPatchRequest instance + */ + SqlInstancesPatchRequest.create = function create(properties) { + return new SqlInstancesPatchRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesPatchRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPatchRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest} message SqlInstancesPatchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPatchRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesPatchRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPatchRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest} message SqlInstancesPatchRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPatchRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesPatchRequest} SqlInstancesPatchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPatchRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesPatchRequest} SqlInstancesPatchRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPatchRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesPatchRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesPatchRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesPatchRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesPatchRequest} SqlInstancesPatchRequest + */ + SqlInstancesPatchRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesPatchRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesPatchRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesPatchRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesPatchRequest} message SqlInstancesPatchRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesPatchRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesPatchRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesPatchRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesPatchRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesPatchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesPatchRequest"; + }; + + return SqlInstancesPatchRequest; + })(); + + v1beta4.SqlInstancesPromoteReplicaRequest = (function() { + + /** + * Properties of a SqlInstancesPromoteReplicaRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesPromoteReplicaRequest + * @property {string|null} [instance] SqlInstancesPromoteReplicaRequest instance + * @property {string|null} [project] SqlInstancesPromoteReplicaRequest project + * @property {boolean|null} [failover] SqlInstancesPromoteReplicaRequest failover + */ + + /** + * Constructs a new SqlInstancesPromoteReplicaRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesPromoteReplicaRequest. + * @implements ISqlInstancesPromoteReplicaRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest=} [properties] Properties to set + */ + function SqlInstancesPromoteReplicaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesPromoteReplicaRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @instance + */ + SqlInstancesPromoteReplicaRequest.prototype.instance = ""; + + /** + * SqlInstancesPromoteReplicaRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @instance + */ + SqlInstancesPromoteReplicaRequest.prototype.project = ""; + + /** + * SqlInstancesPromoteReplicaRequest failover. + * @member {boolean} failover + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @instance + */ + SqlInstancesPromoteReplicaRequest.prototype.failover = false; + + /** + * Creates a new SqlInstancesPromoteReplicaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest instance + */ + SqlInstancesPromoteReplicaRequest.create = function create(properties) { + return new SqlInstancesPromoteReplicaRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesPromoteReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPromoteReplicaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.failover != null && Object.hasOwnProperty.call(message, "failover")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.failover); + return writer; + }; + + /** + * Encodes the specified SqlInstancesPromoteReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPromoteReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPromoteReplicaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.failover = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPromoteReplicaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesPromoteReplicaRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesPromoteReplicaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.failover != null && message.hasOwnProperty("failover")) + if (typeof message.failover !== "boolean") + return "failover: boolean expected"; + return null; + }; + + /** + * Creates a SqlInstancesPromoteReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest + */ + SqlInstancesPromoteReplicaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.failover != null) + message.failover = Boolean(object.failover); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesPromoteReplicaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesPromoteReplicaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.failover = false; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.failover != null && message.hasOwnProperty("failover")) + object.failover = message.failover; + return object; + }; + + /** + * Converts this SqlInstancesPromoteReplicaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesPromoteReplicaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesPromoteReplicaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesPromoteReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest"; + }; + + return SqlInstancesPromoteReplicaRequest; + })(); + + v1beta4.SqlInstancesSwitchoverRequest = (function() { + + /** + * Properties of a SqlInstancesSwitchoverRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesSwitchoverRequest + * @property {string|null} [instance] SqlInstancesSwitchoverRequest instance + * @property {string|null} [project] SqlInstancesSwitchoverRequest project + * @property {google.protobuf.IDuration|null} [dbTimeout] SqlInstancesSwitchoverRequest dbTimeout + */ + + /** + * Constructs a new SqlInstancesSwitchoverRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesSwitchoverRequest. + * @implements ISqlInstancesSwitchoverRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest=} [properties] Properties to set + */ + function SqlInstancesSwitchoverRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesSwitchoverRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @instance + */ + SqlInstancesSwitchoverRequest.prototype.instance = ""; + + /** + * SqlInstancesSwitchoverRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @instance + */ + SqlInstancesSwitchoverRequest.prototype.project = ""; + + /** + * SqlInstancesSwitchoverRequest dbTimeout. + * @member {google.protobuf.IDuration|null|undefined} dbTimeout + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @instance + */ + SqlInstancesSwitchoverRequest.prototype.dbTimeout = null; + + /** + * Creates a new SqlInstancesSwitchoverRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest instance + */ + SqlInstancesSwitchoverRequest.create = function create(properties) { + return new SqlInstancesSwitchoverRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesSwitchoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesSwitchoverRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.dbTimeout != null && Object.hasOwnProperty.call(message, "dbTimeout")) + $root.google.protobuf.Duration.encode(message.dbTimeout, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesSwitchoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesSwitchoverRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesSwitchoverRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.dbTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesSwitchoverRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesSwitchoverRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesSwitchoverRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.dbTimeout != null && message.hasOwnProperty("dbTimeout")) { + var error = $root.google.protobuf.Duration.verify(message.dbTimeout); + if (error) + return "dbTimeout." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesSwitchoverRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest + */ + SqlInstancesSwitchoverRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.dbTimeout != null) { + if (typeof object.dbTimeout !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest.dbTimeout: object expected"); + message.dbTimeout = $root.google.protobuf.Duration.fromObject(object.dbTimeout); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesSwitchoverRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesSwitchoverRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.dbTimeout = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.dbTimeout != null && message.hasOwnProperty("dbTimeout")) + object.dbTimeout = $root.google.protobuf.Duration.toObject(message.dbTimeout, options); + return object; + }; + + /** + * Converts this SqlInstancesSwitchoverRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesSwitchoverRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesSwitchoverRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesSwitchoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest"; + }; + + return SqlInstancesSwitchoverRequest; + })(); + + v1beta4.SqlInstancesResetSslConfigRequest = (function() { + + /** + * Properties of a SqlInstancesResetSslConfigRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesResetSslConfigRequest + * @property {string|null} [instance] SqlInstancesResetSslConfigRequest instance + * @property {string|null} [project] SqlInstancesResetSslConfigRequest project + * @property {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode|null} [mode] SqlInstancesResetSslConfigRequest mode + */ + + /** + * Constructs a new SqlInstancesResetSslConfigRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesResetSslConfigRequest. + * @implements ISqlInstancesResetSslConfigRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest=} [properties] Properties to set + */ + function SqlInstancesResetSslConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesResetSslConfigRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @instance + */ + SqlInstancesResetSslConfigRequest.prototype.instance = ""; + + /** + * SqlInstancesResetSslConfigRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @instance + */ + SqlInstancesResetSslConfigRequest.prototype.project = ""; + + /** + * SqlInstancesResetSslConfigRequest mode. + * @member {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode} mode + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @instance + */ + SqlInstancesResetSslConfigRequest.prototype.mode = 0; + + /** + * Creates a new SqlInstancesResetSslConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest instance + */ + SqlInstancesResetSslConfigRequest.create = function create(properties) { + return new SqlInstancesResetSslConfigRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesResetSslConfigRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesResetSslConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mode); + return writer; + }; + + /** + * Encodes the specified SqlInstancesResetSslConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesResetSslConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesResetSslConfigRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.mode = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesResetSslConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesResetSslConfigRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesResetSslConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a SqlInstancesResetSslConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest + */ + SqlInstancesResetSslConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; + case "RESET_SSL_MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "ALL": + case 1: + message.mode = 1; + break; + case "SYNC_FROM_PRIMARY": + case 2: + message.mode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesResetSslConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesResetSslConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.mode = options.enums === String ? "RESET_SSL_MODE_UNSPECIFIED" : 0; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode[message.mode] === undefined ? message.mode : $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode[message.mode] : message.mode; + return object; + }; + + /** + * Converts this SqlInstancesResetSslConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesResetSslConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesResetSslConfigRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesResetSslConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest"; + }; + + /** + * ResetSslMode enum. + * @name google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode + * @enum {number} + * @property {number} RESET_SSL_MODE_UNSPECIFIED=0 RESET_SSL_MODE_UNSPECIFIED value + * @property {number} ALL=1 ALL value + * @property {number} SYNC_FROM_PRIMARY=2 SYNC_FROM_PRIMARY value + */ + SqlInstancesResetSslConfigRequest.ResetSslMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RESET_SSL_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALL"] = 1; + values[valuesById[2] = "SYNC_FROM_PRIMARY"] = 2; + return values; + })(); + + return SqlInstancesResetSslConfigRequest; + })(); + + v1beta4.SqlInstancesRestartRequest = (function() { + + /** + * Properties of a SqlInstancesRestartRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesRestartRequest + * @property {string|null} [instance] SqlInstancesRestartRequest instance + * @property {string|null} [project] SqlInstancesRestartRequest project + */ + + /** + * Constructs a new SqlInstancesRestartRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesRestartRequest. + * @implements ISqlInstancesRestartRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest=} [properties] Properties to set + */ + function SqlInstancesRestartRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRestartRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @instance + */ + SqlInstancesRestartRequest.prototype.instance = ""; + + /** + * SqlInstancesRestartRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @instance + */ + SqlInstancesRestartRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesRestartRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesRestartRequest} SqlInstancesRestartRequest instance + */ + SqlInstancesRestartRequest.create = function create(properties) { + return new SqlInstancesRestartRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRestartRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestartRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest} message SqlInstancesRestartRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRestartRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRestartRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestartRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest} message SqlInstancesRestartRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRestartRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesRestartRequest} SqlInstancesRestartRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRestartRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesRestartRequest} SqlInstancesRestartRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRestartRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRestartRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRestartRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesRestartRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesRestartRequest} SqlInstancesRestartRequest + */ + SqlInstancesRestartRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRestartRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRestartRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRestartRequest} message SqlInstancesRestartRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRestartRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesRestartRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRestartRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRestartRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRestartRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRestartRequest"; + }; + + return SqlInstancesRestartRequest; + })(); + + v1beta4.SqlInstancesRestoreBackupRequest = (function() { + + /** + * Properties of a SqlInstancesRestoreBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesRestoreBackupRequest + * @property {string|null} [instance] SqlInstancesRestoreBackupRequest instance + * @property {string|null} [project] SqlInstancesRestoreBackupRequest project + * @property {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest|null} [body] SqlInstancesRestoreBackupRequest body + */ + + /** + * Constructs a new SqlInstancesRestoreBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesRestoreBackupRequest. + * @implements ISqlInstancesRestoreBackupRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest=} [properties] Properties to set + */ + function SqlInstancesRestoreBackupRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRestoreBackupRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @instance + */ + SqlInstancesRestoreBackupRequest.prototype.instance = ""; + + /** + * SqlInstancesRestoreBackupRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @instance + */ + SqlInstancesRestoreBackupRequest.prototype.project = ""; + + /** + * SqlInstancesRestoreBackupRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @instance + */ + SqlInstancesRestoreBackupRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesRestoreBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest instance + */ + SqlInstancesRestoreBackupRequest.create = function create(properties) { + return new SqlInstancesRestoreBackupRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRestoreBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRestoreBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRestoreBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRestoreBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRestoreBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRestoreBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest + */ + SqlInstancesRestoreBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRestoreBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRestoreBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesRestoreBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRestoreBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRestoreBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRestoreBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest"; + }; + + return SqlInstancesRestoreBackupRequest; + })(); + + v1beta4.SqlInstancesRotateServerCaRequest = (function() { + + /** + * Properties of a SqlInstancesRotateServerCaRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesRotateServerCaRequest + * @property {string|null} [instance] SqlInstancesRotateServerCaRequest instance + * @property {string|null} [project] SqlInstancesRotateServerCaRequest project + * @property {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest|null} [body] SqlInstancesRotateServerCaRequest body + */ + + /** + * Constructs a new SqlInstancesRotateServerCaRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesRotateServerCaRequest. + * @implements ISqlInstancesRotateServerCaRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest=} [properties] Properties to set + */ + function SqlInstancesRotateServerCaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRotateServerCaRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @instance + */ + SqlInstancesRotateServerCaRequest.prototype.instance = ""; + + /** + * SqlInstancesRotateServerCaRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @instance + */ + SqlInstancesRotateServerCaRequest.prototype.project = ""; + + /** + * SqlInstancesRotateServerCaRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @instance + */ + SqlInstancesRotateServerCaRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesRotateServerCaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest instance + */ + SqlInstancesRotateServerCaRequest.create = function create(properties) { + return new SqlInstancesRotateServerCaRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateServerCaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateServerCaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateServerCaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRotateServerCaRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRotateServerCaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest + */ + SqlInstancesRotateServerCaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRotateServerCaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRotateServerCaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesRotateServerCaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRotateServerCaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRotateServerCaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRotateServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest"; + }; + + return SqlInstancesRotateServerCaRequest; + })(); + + v1beta4.SqlInstancesRotateServerCertificateRequest = (function() { + + /** + * Properties of a SqlInstancesRotateServerCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesRotateServerCertificateRequest + * @property {string|null} [instance] SqlInstancesRotateServerCertificateRequest instance + * @property {string|null} [project] SqlInstancesRotateServerCertificateRequest project + * @property {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest|null} [body] SqlInstancesRotateServerCertificateRequest body + */ + + /** + * Constructs a new SqlInstancesRotateServerCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesRotateServerCertificateRequest. + * @implements ISqlInstancesRotateServerCertificateRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest=} [properties] Properties to set + */ + function SqlInstancesRotateServerCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRotateServerCertificateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @instance + */ + SqlInstancesRotateServerCertificateRequest.prototype.instance = ""; + + /** + * SqlInstancesRotateServerCertificateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @instance + */ + SqlInstancesRotateServerCertificateRequest.prototype.project = ""; + + /** + * SqlInstancesRotateServerCertificateRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @instance + */ + SqlInstancesRotateServerCertificateRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesRotateServerCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest instance + */ + SqlInstancesRotateServerCertificateRequest.create = function create(properties) { + return new SqlInstancesRotateServerCertificateRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateServerCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateServerCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRotateServerCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRotateServerCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest + */ + SqlInstancesRotateServerCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRotateServerCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRotateServerCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesRotateServerCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRotateServerCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRotateServerCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRotateServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest"; + }; + + return SqlInstancesRotateServerCertificateRequest; + })(); + + v1beta4.SqlInstancesRotateEntraIdCertificateRequest = (function() { + + /** + * Properties of a SqlInstancesRotateEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesRotateEntraIdCertificateRequest + * @property {string|null} [instance] SqlInstancesRotateEntraIdCertificateRequest instance + * @property {string|null} [project] SqlInstancesRotateEntraIdCertificateRequest project + * @property {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest|null} [body] SqlInstancesRotateEntraIdCertificateRequest body + */ + + /** + * Constructs a new SqlInstancesRotateEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesRotateEntraIdCertificateRequest. + * @implements ISqlInstancesRotateEntraIdCertificateRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set + */ + function SqlInstancesRotateEntraIdCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRotateEntraIdCertificateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @instance + */ + SqlInstancesRotateEntraIdCertificateRequest.prototype.instance = ""; + + /** + * SqlInstancesRotateEntraIdCertificateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @instance + */ + SqlInstancesRotateEntraIdCertificateRequest.prototype.project = ""; + + /** + * SqlInstancesRotateEntraIdCertificateRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @instance + */ + SqlInstancesRotateEntraIdCertificateRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesRotateEntraIdCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest instance + */ + SqlInstancesRotateEntraIdCertificateRequest.create = function create(properties) { + return new SqlInstancesRotateEntraIdCertificateRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateEntraIdCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRotateEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateEntraIdCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRotateEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRotateEntraIdCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRotateEntraIdCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest + */ + SqlInstancesRotateEntraIdCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRotateEntraIdCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesRotateEntraIdCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRotateEntraIdCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRotateEntraIdCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRotateEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest"; + }; + + return SqlInstancesRotateEntraIdCertificateRequest; + })(); + + v1beta4.SqlInstancesStartReplicaRequest = (function() { + + /** + * Properties of a SqlInstancesStartReplicaRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesStartReplicaRequest + * @property {string|null} [instance] SqlInstancesStartReplicaRequest instance + * @property {string|null} [project] SqlInstancesStartReplicaRequest project + */ + + /** + * Constructs a new SqlInstancesStartReplicaRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesStartReplicaRequest. + * @implements ISqlInstancesStartReplicaRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest=} [properties] Properties to set + */ + function SqlInstancesStartReplicaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesStartReplicaRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @instance + */ + SqlInstancesStartReplicaRequest.prototype.instance = ""; + + /** + * SqlInstancesStartReplicaRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @instance + */ + SqlInstancesStartReplicaRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesStartReplicaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest instance + */ + SqlInstancesStartReplicaRequest.create = function create(properties) { + return new SqlInstancesStartReplicaRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesStartReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStartReplicaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesStartReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStartReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStartReplicaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStartReplicaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesStartReplicaRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesStartReplicaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesStartReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest + */ + SqlInstancesStartReplicaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesStartReplicaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesStartReplicaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesStartReplicaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesStartReplicaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesStartReplicaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesStartReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest"; + }; + + return SqlInstancesStartReplicaRequest; + })(); + + v1beta4.SqlInstancesStopReplicaRequest = (function() { + + /** + * Properties of a SqlInstancesStopReplicaRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesStopReplicaRequest + * @property {string|null} [instance] SqlInstancesStopReplicaRequest instance + * @property {string|null} [project] SqlInstancesStopReplicaRequest project + */ + + /** + * Constructs a new SqlInstancesStopReplicaRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesStopReplicaRequest. + * @implements ISqlInstancesStopReplicaRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest=} [properties] Properties to set + */ + function SqlInstancesStopReplicaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesStopReplicaRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @instance + */ + SqlInstancesStopReplicaRequest.prototype.instance = ""; + + /** + * SqlInstancesStopReplicaRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @instance + */ + SqlInstancesStopReplicaRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesStopReplicaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest instance + */ + SqlInstancesStopReplicaRequest.create = function create(properties) { + return new SqlInstancesStopReplicaRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesStopReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStopReplicaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesStopReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStopReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStopReplicaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStopReplicaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesStopReplicaRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesStopReplicaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesStopReplicaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest + */ + SqlInstancesStopReplicaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesStopReplicaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesStopReplicaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesStopReplicaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesStopReplicaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesStopReplicaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesStopReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest"; + }; + + return SqlInstancesStopReplicaRequest; + })(); + + v1beta4.SqlInstancesTruncateLogRequest = (function() { + + /** + * Properties of a SqlInstancesTruncateLogRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesTruncateLogRequest + * @property {string|null} [instance] SqlInstancesTruncateLogRequest instance + * @property {string|null} [project] SqlInstancesTruncateLogRequest project + * @property {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest|null} [body] SqlInstancesTruncateLogRequest body + */ + + /** + * Constructs a new SqlInstancesTruncateLogRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesTruncateLogRequest. + * @implements ISqlInstancesTruncateLogRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest=} [properties] Properties to set + */ + function SqlInstancesTruncateLogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesTruncateLogRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @instance + */ + SqlInstancesTruncateLogRequest.prototype.instance = ""; + + /** + * SqlInstancesTruncateLogRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @instance + */ + SqlInstancesTruncateLogRequest.prototype.project = ""; + + /** + * SqlInstancesTruncateLogRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @instance + */ + SqlInstancesTruncateLogRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesTruncateLogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest instance + */ + SqlInstancesTruncateLogRequest.create = function create(properties) { + return new SqlInstancesTruncateLogRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesTruncateLogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesTruncateLogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesTruncateLogRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesTruncateLogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesTruncateLogRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesTruncateLogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest + */ + SqlInstancesTruncateLogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesTruncateLogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesTruncateLogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesTruncateLogRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesTruncateLogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesTruncateLogRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesTruncateLogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest"; + }; + + return SqlInstancesTruncateLogRequest; + })(); + + v1beta4.SqlInstancesUpdateRequest = (function() { + + /** + * Properties of a SqlInstancesUpdateRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesUpdateRequest + * @property {string|null} [instance] SqlInstancesUpdateRequest instance + * @property {string|null} [project] SqlInstancesUpdateRequest project + * @property {google.cloud.sql.v1beta4.IDatabaseInstance|null} [body] SqlInstancesUpdateRequest body + */ + + /** + * Constructs a new SqlInstancesUpdateRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesUpdateRequest. + * @implements ISqlInstancesUpdateRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest=} [properties] Properties to set + */ + function SqlInstancesUpdateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesUpdateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @instance + */ + SqlInstancesUpdateRequest.prototype.instance = ""; + + /** + * SqlInstancesUpdateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @instance + */ + SqlInstancesUpdateRequest.prototype.project = ""; + + /** + * SqlInstancesUpdateRequest body. + * @member {google.cloud.sql.v1beta4.IDatabaseInstance|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @instance + */ + SqlInstancesUpdateRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesUpdateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest instance + */ + SqlInstancesUpdateRequest.create = function create(properties) { + return new SqlInstancesUpdateRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesUpdateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest} message SqlInstancesUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesUpdateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesUpdateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest} message SqlInstancesUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesUpdateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesUpdateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesUpdateRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesUpdateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest + */ + SqlInstancesUpdateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesUpdateRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesUpdateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesUpdateRequest} message SqlInstancesUpdateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesUpdateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesUpdateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesUpdateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesUpdateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesUpdateRequest"; + }; + + return SqlInstancesUpdateRequest; + })(); + + v1beta4.SqlInstancesReencryptRequest = (function() { + + /** + * Properties of a SqlInstancesReencryptRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesReencryptRequest + * @property {string|null} [instance] SqlInstancesReencryptRequest instance + * @property {string|null} [project] SqlInstancesReencryptRequest project + * @property {google.cloud.sql.v1beta4.IInstancesReencryptRequest|null} [body] SqlInstancesReencryptRequest body + */ + + /** + * Constructs a new SqlInstancesReencryptRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesReencryptRequest. + * @implements ISqlInstancesReencryptRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest=} [properties] Properties to set + */ + function SqlInstancesReencryptRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesReencryptRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @instance + */ + SqlInstancesReencryptRequest.prototype.instance = ""; + + /** + * SqlInstancesReencryptRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @instance + */ + SqlInstancesReencryptRequest.prototype.project = ""; + + /** + * SqlInstancesReencryptRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesReencryptRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @instance + */ + SqlInstancesReencryptRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesReencryptRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest instance + */ + SqlInstancesReencryptRequest.create = function create(properties) { + return new SqlInstancesReencryptRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReencryptRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest} message SqlInstancesReencryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReencryptRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesReencryptRequest.encode(message.body, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReencryptRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest} message SqlInstancesReencryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReencryptRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReencryptRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.body = $root.google.cloud.sql.v1beta4.InstancesReencryptRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReencryptRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesReencryptRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesReencryptRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesReencryptRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest + */ + SqlInstancesReencryptRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesReencryptRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesReencryptRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesReencryptRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesReencryptRequest} message SqlInstancesReencryptRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesReencryptRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesReencryptRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesReencryptRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesReencryptRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesReencryptRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesReencryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesReencryptRequest"; + }; + + return SqlInstancesReencryptRequest; + })(); + + v1beta4.InstancesReencryptRequest = (function() { + + /** + * Properties of an InstancesReencryptRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesReencryptRequest + * @property {google.cloud.sql.v1beta4.IBackupReencryptionConfig|null} [backupReencryptionConfig] InstancesReencryptRequest backupReencryptionConfig + */ + + /** + * Constructs a new InstancesReencryptRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesReencryptRequest. + * @implements IInstancesReencryptRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesReencryptRequest=} [properties] Properties to set + */ + function InstancesReencryptRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesReencryptRequest backupReencryptionConfig. + * @member {google.cloud.sql.v1beta4.IBackupReencryptionConfig|null|undefined} backupReencryptionConfig + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @instance + */ + InstancesReencryptRequest.prototype.backupReencryptionConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(InstancesReencryptRequest.prototype, "_backupReencryptionConfig", { + get: $util.oneOfGetter($oneOfFields = ["backupReencryptionConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new InstancesReencryptRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesReencryptRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesReencryptRequest} InstancesReencryptRequest instance + */ + InstancesReencryptRequest.create = function create(properties) { + return new InstancesReencryptRequest(properties); + }; + + /** + * Encodes the specified InstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesReencryptRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesReencryptRequest} message InstancesReencryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesReencryptRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backupReencryptionConfig != null && Object.hasOwnProperty.call(message, "backupReencryptionConfig")) + $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.encode(message.backupReencryptionConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesReencryptRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesReencryptRequest} message InstancesReencryptRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesReencryptRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesReencryptRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesReencryptRequest} InstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesReencryptRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesReencryptRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backupReencryptionConfig = $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesReencryptRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesReencryptRequest} InstancesReencryptRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesReencryptRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesReencryptRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesReencryptRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.backupReencryptionConfig != null && message.hasOwnProperty("backupReencryptionConfig")) { + properties._backupReencryptionConfig = 1; + { + var error = $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.verify(message.backupReencryptionConfig); + if (error) + return "backupReencryptionConfig." + error; + } + } + return null; + }; + + /** + * Creates an InstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesReencryptRequest} InstancesReencryptRequest + */ + InstancesReencryptRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesReencryptRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesReencryptRequest(); + if (object.backupReencryptionConfig != null) { + if (typeof object.backupReencryptionConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesReencryptRequest.backupReencryptionConfig: object expected"); + message.backupReencryptionConfig = $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.fromObject(object.backupReencryptionConfig); + } + return message; + }; + + /** + * Creates a plain object from an InstancesReencryptRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesReencryptRequest} message InstancesReencryptRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesReencryptRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.backupReencryptionConfig != null && message.hasOwnProperty("backupReencryptionConfig")) { + object.backupReencryptionConfig = $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.toObject(message.backupReencryptionConfig, options); + if (options.oneofs) + object._backupReencryptionConfig = "backupReencryptionConfig"; + } + return object; + }; + + /** + * Converts this InstancesReencryptRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesReencryptRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesReencryptRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesReencryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesReencryptRequest"; + }; + + return InstancesReencryptRequest; + })(); + + v1beta4.BackupReencryptionConfig = (function() { + + /** + * Properties of a BackupReencryptionConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IBackupReencryptionConfig + * @property {number|null} [backupLimit] BackupReencryptionConfig backupLimit + * @property {google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|null} [backupType] BackupReencryptionConfig backupType + */ + + /** + * Constructs a new BackupReencryptionConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a BackupReencryptionConfig. + * @implements IBackupReencryptionConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IBackupReencryptionConfig=} [properties] Properties to set + */ + function BackupReencryptionConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupReencryptionConfig backupLimit. + * @member {number|null|undefined} backupLimit + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @instance + */ + BackupReencryptionConfig.prototype.backupLimit = null; + + /** + * BackupReencryptionConfig backupType. + * @member {google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|null|undefined} backupType + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @instance + */ + BackupReencryptionConfig.prototype.backupType = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BackupReencryptionConfig.prototype, "_backupLimit", { + get: $util.oneOfGetter($oneOfFields = ["backupLimit"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BackupReencryptionConfig.prototype, "_backupType", { + get: $util.oneOfGetter($oneOfFields = ["backupType"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BackupReencryptionConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @static + * @param {google.cloud.sql.v1beta4.IBackupReencryptionConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.BackupReencryptionConfig} BackupReencryptionConfig instance + */ + BackupReencryptionConfig.create = function create(properties) { + return new BackupReencryptionConfig(properties); + }; + + /** + * Encodes the specified BackupReencryptionConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupReencryptionConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @static + * @param {google.cloud.sql.v1beta4.IBackupReencryptionConfig} message BackupReencryptionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupReencryptionConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backupLimit != null && Object.hasOwnProperty.call(message, "backupLimit")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.backupLimit); + if (message.backupType != null && Object.hasOwnProperty.call(message, "backupType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.backupType); + return writer; + }; + + /** + * Encodes the specified BackupReencryptionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupReencryptionConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @static + * @param {google.cloud.sql.v1beta4.IBackupReencryptionConfig} message BackupReencryptionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupReencryptionConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupReencryptionConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.BackupReencryptionConfig} BackupReencryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupReencryptionConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupReencryptionConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backupLimit = reader.int32(); + break; + } + case 2: { + message.backupType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupReencryptionConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.BackupReencryptionConfig} BackupReencryptionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupReencryptionConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupReencryptionConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupReencryptionConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.backupLimit != null && message.hasOwnProperty("backupLimit")) { + properties._backupLimit = 1; + if (!$util.isInteger(message.backupLimit)) + return "backupLimit: integer expected"; + } + if (message.backupType != null && message.hasOwnProperty("backupType")) { + properties._backupType = 1; + switch (message.backupType) { + default: + return "backupType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates a BackupReencryptionConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.BackupReencryptionConfig} BackupReencryptionConfig + */ + BackupReencryptionConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.BackupReencryptionConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.BackupReencryptionConfig(); + if (object.backupLimit != null) + message.backupLimit = object.backupLimit | 0; + switch (object.backupType) { + default: + if (typeof object.backupType === "number") { + message.backupType = object.backupType; + break; + } + break; + case "BACKUP_TYPE_UNSPECIFIED": + case 0: + message.backupType = 0; + break; + case "AUTOMATED": + case 1: + message.backupType = 1; + break; + case "ON_DEMAND": + case 2: + message.backupType = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a BackupReencryptionConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @static + * @param {google.cloud.sql.v1beta4.BackupReencryptionConfig} message BackupReencryptionConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupReencryptionConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.backupLimit != null && message.hasOwnProperty("backupLimit")) { + object.backupLimit = message.backupLimit; + if (options.oneofs) + object._backupLimit = "backupLimit"; + } + if (message.backupType != null && message.hasOwnProperty("backupType")) { + object.backupType = options.enums === String ? $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType[message.backupType] === undefined ? message.backupType : $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType[message.backupType] : message.backupType; + if (options.oneofs) + object._backupType = "backupType"; + } + return object; + }; + + /** + * Converts this BackupReencryptionConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @instance + * @returns {Object.} JSON object + */ + BackupReencryptionConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupReencryptionConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupReencryptionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupReencryptionConfig"; + }; + + /** + * BackupType enum. + * @name google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType + * @enum {number} + * @property {number} BACKUP_TYPE_UNSPECIFIED=0 BACKUP_TYPE_UNSPECIFIED value + * @property {number} AUTOMATED=1 AUTOMATED value + * @property {number} ON_DEMAND=2 ON_DEMAND value + */ + BackupReencryptionConfig.BackupType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BACKUP_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATED"] = 1; + values[valuesById[2] = "ON_DEMAND"] = 2; + return values; + })(); + + return BackupReencryptionConfig; + })(); + + v1beta4.SqlInstancesRescheduleMaintenanceRequest = (function() { + + /** + * Properties of a SqlInstancesRescheduleMaintenanceRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesRescheduleMaintenanceRequest + * @property {string|null} [instance] SqlInstancesRescheduleMaintenanceRequest instance + * @property {string|null} [project] SqlInstancesRescheduleMaintenanceRequest project + * @property {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody|null} [body] SqlInstancesRescheduleMaintenanceRequest body + */ + + /** + * Constructs a new SqlInstancesRescheduleMaintenanceRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesRescheduleMaintenanceRequest. + * @implements ISqlInstancesRescheduleMaintenanceRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest=} [properties] Properties to set + */ + function SqlInstancesRescheduleMaintenanceRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRescheduleMaintenanceRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @instance + */ + SqlInstancesRescheduleMaintenanceRequest.prototype.instance = ""; + + /** + * SqlInstancesRescheduleMaintenanceRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @instance + */ + SqlInstancesRescheduleMaintenanceRequest.prototype.project = ""; + + /** + * SqlInstancesRescheduleMaintenanceRequest body. + * @member {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @instance + */ + SqlInstancesRescheduleMaintenanceRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesRescheduleMaintenanceRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest instance + */ + SqlInstancesRescheduleMaintenanceRequest.create = function create(properties) { + return new SqlInstancesRescheduleMaintenanceRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRescheduleMaintenanceRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRescheduleMaintenanceRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRescheduleMaintenanceRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRescheduleMaintenanceRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRescheduleMaintenanceRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRescheduleMaintenanceRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRescheduleMaintenanceRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest + */ + SqlInstancesRescheduleMaintenanceRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRescheduleMaintenanceRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesRescheduleMaintenanceRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRescheduleMaintenanceRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRescheduleMaintenanceRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRescheduleMaintenanceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest"; + }; + + return SqlInstancesRescheduleMaintenanceRequest; + })(); + + v1beta4.SqlInstancesPerformDiskShrinkRequest = (function() { + + /** + * Properties of a SqlInstancesPerformDiskShrinkRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesPerformDiskShrinkRequest + * @property {string|null} [instance] SqlInstancesPerformDiskShrinkRequest instance + * @property {string|null} [project] SqlInstancesPerformDiskShrinkRequest project + * @property {google.cloud.sql.v1beta4.IPerformDiskShrinkContext|null} [body] SqlInstancesPerformDiskShrinkRequest body + */ + + /** + * Constructs a new SqlInstancesPerformDiskShrinkRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesPerformDiskShrinkRequest. + * @implements ISqlInstancesPerformDiskShrinkRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest=} [properties] Properties to set + */ + function SqlInstancesPerformDiskShrinkRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesPerformDiskShrinkRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @instance + */ + SqlInstancesPerformDiskShrinkRequest.prototype.instance = ""; + + /** + * SqlInstancesPerformDiskShrinkRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @instance + */ + SqlInstancesPerformDiskShrinkRequest.prototype.project = ""; + + /** + * SqlInstancesPerformDiskShrinkRequest body. + * @member {google.cloud.sql.v1beta4.IPerformDiskShrinkContext|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @instance + */ + SqlInstancesPerformDiskShrinkRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesPerformDiskShrinkRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest instance + */ + SqlInstancesPerformDiskShrinkRequest.create = function create(properties) { + return new SqlInstancesPerformDiskShrinkRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesPerformDiskShrinkRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPerformDiskShrinkRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesPerformDiskShrinkRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPerformDiskShrinkRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPerformDiskShrinkRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPerformDiskShrinkRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesPerformDiskShrinkRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesPerformDiskShrinkRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesPerformDiskShrinkRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest + */ + SqlInstancesPerformDiskShrinkRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesPerformDiskShrinkRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesPerformDiskShrinkRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesPerformDiskShrinkRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesPerformDiskShrinkRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesPerformDiskShrinkRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesPerformDiskShrinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest"; + }; + + return SqlInstancesPerformDiskShrinkRequest; + })(); + + /** + * ExternalSyncParallelLevel enum. + * @name google.cloud.sql.v1beta4.ExternalSyncParallelLevel + * @enum {number} + * @property {number} EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED=0 EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED value + * @property {number} MIN=1 MIN value + * @property {number} OPTIMAL=2 OPTIMAL value + * @property {number} MAX=3 MAX value + */ + v1beta4.ExternalSyncParallelLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED"] = 0; + values[valuesById[1] = "MIN"] = 1; + values[valuesById[2] = "OPTIMAL"] = 2; + values[valuesById[3] = "MAX"] = 3; + return values; + })(); + + v1beta4.ExternalSyncSelectedObject = (function() { + + /** + * Properties of an ExternalSyncSelectedObject. + * @memberof google.cloud.sql.v1beta4 + * @interface IExternalSyncSelectedObject + * @property {string|null} [database] ExternalSyncSelectedObject database + */ + + /** + * Constructs a new ExternalSyncSelectedObject. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an ExternalSyncSelectedObject. + * @implements IExternalSyncSelectedObject + * @constructor + * @param {google.cloud.sql.v1beta4.IExternalSyncSelectedObject=} [properties] Properties to set + */ + function ExternalSyncSelectedObject(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExternalSyncSelectedObject database. + * @member {string} database + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @instance + */ + ExternalSyncSelectedObject.prototype.database = ""; + + /** + * Creates a new ExternalSyncSelectedObject instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @static + * @param {google.cloud.sql.v1beta4.IExternalSyncSelectedObject=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ExternalSyncSelectedObject} ExternalSyncSelectedObject instance + */ + ExternalSyncSelectedObject.create = function create(properties) { + return new ExternalSyncSelectedObject(properties); + }; + + /** + * Encodes the specified ExternalSyncSelectedObject message. Does not implicitly {@link google.cloud.sql.v1beta4.ExternalSyncSelectedObject.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @static + * @param {google.cloud.sql.v1beta4.IExternalSyncSelectedObject} message ExternalSyncSelectedObject message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExternalSyncSelectedObject.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + return writer; + }; + + /** + * Encodes the specified ExternalSyncSelectedObject message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExternalSyncSelectedObject.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @static + * @param {google.cloud.sql.v1beta4.IExternalSyncSelectedObject} message ExternalSyncSelectedObject message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExternalSyncSelectedObject.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ExternalSyncSelectedObject} ExternalSyncSelectedObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExternalSyncSelectedObject.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ExternalSyncSelectedObject} ExternalSyncSelectedObject + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExternalSyncSelectedObject.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExternalSyncSelectedObject message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExternalSyncSelectedObject.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + return null; + }; + + /** + * Creates an ExternalSyncSelectedObject message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ExternalSyncSelectedObject} ExternalSyncSelectedObject + */ + ExternalSyncSelectedObject.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject) + return object; + var message = new $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject(); + if (object.database != null) + message.database = String(object.database); + return message; + }; + + /** + * Creates a plain object from an ExternalSyncSelectedObject message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @static + * @param {google.cloud.sql.v1beta4.ExternalSyncSelectedObject} message ExternalSyncSelectedObject + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExternalSyncSelectedObject.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.database = ""; + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + return object; + }; + + /** + * Converts this ExternalSyncSelectedObject to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @instance + * @returns {Object.} JSON object + */ + ExternalSyncSelectedObject.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExternalSyncSelectedObject + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExternalSyncSelectedObject.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExternalSyncSelectedObject"; + }; + + return ExternalSyncSelectedObject; + })(); + + v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest = (function() { + + /** + * Properties of a SqlInstancesVerifyExternalSyncSettingsRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesVerifyExternalSyncSettingsRequest + * @property {string|null} [instance] SqlInstancesVerifyExternalSyncSettingsRequest instance + * @property {string|null} [project] SqlInstancesVerifyExternalSyncSettingsRequest project + * @property {boolean|null} [verifyConnectionOnly] SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly + * @property {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null} [syncMode] SqlInstancesVerifyExternalSyncSettingsRequest syncMode + * @property {boolean|null} [verifyReplicationOnly] SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly + * @property {google.cloud.sql.v1beta4.IMySqlSyncConfig|null} [mysqlSyncConfig] SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig + * @property {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null} [migrationType] SqlInstancesVerifyExternalSyncSettingsRequest migrationType + * @property {google.cloud.sql.v1beta4.ExternalSyncParallelLevel|null} [syncParallelLevel] SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel + * @property {Array.|null} [selectedObjects] SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects + */ + + /** + * Constructs a new SqlInstancesVerifyExternalSyncSettingsRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesVerifyExternalSyncSettingsRequest. + * @implements ISqlInstancesVerifyExternalSyncSettingsRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest=} [properties] Properties to set + */ + function SqlInstancesVerifyExternalSyncSettingsRequest(properties) { + this.selectedObjects = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.instance = ""; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.project = ""; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly. + * @member {boolean} verifyConnectionOnly + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.verifyConnectionOnly = false; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest syncMode. + * @member {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} syncMode + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.syncMode = 0; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly. + * @member {boolean} verifyReplicationOnly + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.verifyReplicationOnly = false; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig. + * @member {google.cloud.sql.v1beta4.IMySqlSyncConfig|null|undefined} mysqlSyncConfig + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.mysqlSyncConfig = null; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest migrationType. + * @member {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} migrationType + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.migrationType = 0; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel. + * @member {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} syncParallelLevel + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.syncParallelLevel = 0; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects. + * @member {Array.} selectedObjects + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.selectedObjects = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SqlInstancesVerifyExternalSyncSettingsRequest syncConfig. + * @member {"mysqlSyncConfig"|undefined} syncConfig + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + */ + Object.defineProperty(SqlInstancesVerifyExternalSyncSettingsRequest.prototype, "syncConfig", { + get: $util.oneOfGetter($oneOfFields = ["mysqlSyncConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlInstancesVerifyExternalSyncSettingsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest instance + */ + SqlInstancesVerifyExternalSyncSettingsRequest.create = function create(properties) { + return new SqlInstancesVerifyExternalSyncSettingsRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesVerifyExternalSyncSettingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.verifyConnectionOnly != null && Object.hasOwnProperty.call(message, "verifyConnectionOnly")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.verifyConnectionOnly); + if (message.syncMode != null && Object.hasOwnProperty.call(message, "syncMode")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.syncMode); + if (message.verifyReplicationOnly != null && Object.hasOwnProperty.call(message, "verifyReplicationOnly")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.verifyReplicationOnly); + if (message.mysqlSyncConfig != null && Object.hasOwnProperty.call(message, "mysqlSyncConfig")) + $root.google.cloud.sql.v1beta4.MySqlSyncConfig.encode(message.mysqlSyncConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.migrationType != null && Object.hasOwnProperty.call(message, "migrationType")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.migrationType); + if (message.syncParallelLevel != null && Object.hasOwnProperty.call(message, "syncParallelLevel")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.syncParallelLevel); + if (message.selectedObjects != null && message.selectedObjects.length) + for (var i = 0; i < message.selectedObjects.length; ++i) + $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject.encode(message.selectedObjects[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesVerifyExternalSyncSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesVerifyExternalSyncSettingsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.verifyConnectionOnly = reader.bool(); + break; + } + case 4: { + message.syncMode = reader.int32(); + break; + } + case 5: { + message.verifyReplicationOnly = reader.bool(); + break; + } + case 6: { + message.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.migrationType = reader.int32(); + break; + } + case 8: { + message.syncParallelLevel = reader.int32(); + break; + } + case 9: { + if (!(message.selectedObjects && message.selectedObjects.length)) + message.selectedObjects = []; + message.selectedObjects.push($root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesVerifyExternalSyncSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesVerifyExternalSyncSettingsRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesVerifyExternalSyncSettingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.verifyConnectionOnly != null && message.hasOwnProperty("verifyConnectionOnly")) + if (typeof message.verifyConnectionOnly !== "boolean") + return "verifyConnectionOnly: boolean expected"; + if (message.syncMode != null && message.hasOwnProperty("syncMode")) + switch (message.syncMode) { + default: + return "syncMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.verifyReplicationOnly != null && message.hasOwnProperty("verifyReplicationOnly")) + if (typeof message.verifyReplicationOnly !== "boolean") + return "verifyReplicationOnly: boolean expected"; + if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { + properties.syncConfig = 1; + { + var error = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.verify(message.mysqlSyncConfig); + if (error) + return "mysqlSyncConfig." + error; + } + } + if (message.migrationType != null && message.hasOwnProperty("migrationType")) + switch (message.migrationType) { + default: + return "migrationType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) + switch (message.syncParallelLevel) { + default: + return "syncParallelLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.selectedObjects != null && message.hasOwnProperty("selectedObjects")) { + if (!Array.isArray(message.selectedObjects)) + return "selectedObjects: array expected"; + for (var i = 0; i < message.selectedObjects.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject.verify(message.selectedObjects[i]); + if (error) + return "selectedObjects." + error; + } + } + return null; + }; + + /** + * Creates a SqlInstancesVerifyExternalSyncSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest + */ + SqlInstancesVerifyExternalSyncSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.verifyConnectionOnly != null) + message.verifyConnectionOnly = Boolean(object.verifyConnectionOnly); + switch (object.syncMode) { + default: + if (typeof object.syncMode === "number") { + message.syncMode = object.syncMode; + break; + } + break; + case "EXTERNAL_SYNC_MODE_UNSPECIFIED": + case 0: + message.syncMode = 0; + break; + case "ONLINE": + case 1: + message.syncMode = 1; + break; + case "OFFLINE": + case 2: + message.syncMode = 2; + break; + } + if (object.verifyReplicationOnly != null) + message.verifyReplicationOnly = Boolean(object.verifyReplicationOnly); + if (object.mysqlSyncConfig != null) { + if (typeof object.mysqlSyncConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.mysqlSyncConfig: object expected"); + message.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.fromObject(object.mysqlSyncConfig); + } + switch (object.migrationType) { + default: + if (typeof object.migrationType === "number") { + message.migrationType = object.migrationType; + break; + } + break; + case "MIGRATION_TYPE_UNSPECIFIED": + case 0: + message.migrationType = 0; + break; + case "LOGICAL": + case 1: + message.migrationType = 1; + break; + case "PHYSICAL": + case 2: + message.migrationType = 2; + break; + } + switch (object.syncParallelLevel) { + default: + if (typeof object.syncParallelLevel === "number") { + message.syncParallelLevel = object.syncParallelLevel; + break; + } + break; + case "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": + case 0: + message.syncParallelLevel = 0; + break; + case "MIN": + case 1: + message.syncParallelLevel = 1; + break; + case "OPTIMAL": + case 2: + message.syncParallelLevel = 2; + break; + case "MAX": + case 3: + message.syncParallelLevel = 3; + break; + } + if (object.selectedObjects) { + if (!Array.isArray(object.selectedObjects)) + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.selectedObjects: array expected"); + message.selectedObjects = []; + for (var i = 0; i < object.selectedObjects.length; ++i) { + if (typeof object.selectedObjects[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.selectedObjects: object expected"); + message.selectedObjects[i] = $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject.fromObject(object.selectedObjects[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesVerifyExternalSyncSettingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.selectedObjects = []; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.verifyConnectionOnly = false; + object.syncMode = options.enums === String ? "EXTERNAL_SYNC_MODE_UNSPECIFIED" : 0; + object.verifyReplicationOnly = false; + object.migrationType = options.enums === String ? "MIGRATION_TYPE_UNSPECIFIED" : 0; + object.syncParallelLevel = options.enums === String ? "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" : 0; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.verifyConnectionOnly != null && message.hasOwnProperty("verifyConnectionOnly")) + object.verifyConnectionOnly = message.verifyConnectionOnly; + if (message.syncMode != null && message.hasOwnProperty("syncMode")) + object.syncMode = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] === undefined ? message.syncMode : $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] : message.syncMode; + if (message.verifyReplicationOnly != null && message.hasOwnProperty("verifyReplicationOnly")) + object.verifyReplicationOnly = message.verifyReplicationOnly; + if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { + object.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.toObject(message.mysqlSyncConfig, options); + if (options.oneofs) + object.syncConfig = "mysqlSyncConfig"; + } + if (message.migrationType != null && message.hasOwnProperty("migrationType")) + object.migrationType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] === undefined ? message.migrationType : $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] : message.migrationType; + if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) + object.syncParallelLevel = options.enums === String ? $root.google.cloud.sql.v1beta4.ExternalSyncParallelLevel[message.syncParallelLevel] === undefined ? message.syncParallelLevel : $root.google.cloud.sql.v1beta4.ExternalSyncParallelLevel[message.syncParallelLevel] : message.syncParallelLevel; + if (message.selectedObjects && message.selectedObjects.length) { + object.selectedObjects = []; + for (var j = 0; j < message.selectedObjects.length; ++j) + object.selectedObjects[j] = $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject.toObject(message.selectedObjects[j], options); + } + return object; + }; + + /** + * Converts this SqlInstancesVerifyExternalSyncSettingsRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesVerifyExternalSyncSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesVerifyExternalSyncSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest"; + }; + + /** + * ExternalSyncMode enum. + * @name google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode + * @enum {number} + * @property {number} EXTERNAL_SYNC_MODE_UNSPECIFIED=0 EXTERNAL_SYNC_MODE_UNSPECIFIED value + * @property {number} ONLINE=1 ONLINE value + * @property {number} OFFLINE=2 OFFLINE value + */ + SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EXTERNAL_SYNC_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ONLINE"] = 1; + values[valuesById[2] = "OFFLINE"] = 2; + return values; + })(); + + /** + * MigrationType enum. + * @name google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType + * @enum {number} + * @property {number} MIGRATION_TYPE_UNSPECIFIED=0 MIGRATION_TYPE_UNSPECIFIED value + * @property {number} LOGICAL=1 LOGICAL value + * @property {number} PHYSICAL=2 PHYSICAL value + */ + SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MIGRATION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "LOGICAL"] = 1; + values[valuesById[2] = "PHYSICAL"] = 2; + return values; + })(); + + return SqlInstancesVerifyExternalSyncSettingsRequest; + })(); + + v1beta4.SqlInstancesStartExternalSyncRequest = (function() { + + /** + * Properties of a SqlInstancesStartExternalSyncRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesStartExternalSyncRequest + * @property {string|null} [instance] SqlInstancesStartExternalSyncRequest instance + * @property {string|null} [project] SqlInstancesStartExternalSyncRequest project + * @property {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null} [syncMode] SqlInstancesStartExternalSyncRequest syncMode + * @property {boolean|null} [skipVerification] SqlInstancesStartExternalSyncRequest skipVerification + * @property {google.cloud.sql.v1beta4.IMySqlSyncConfig|null} [mysqlSyncConfig] SqlInstancesStartExternalSyncRequest mysqlSyncConfig + * @property {google.cloud.sql.v1beta4.ExternalSyncParallelLevel|null} [syncParallelLevel] SqlInstancesStartExternalSyncRequest syncParallelLevel + * @property {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null} [migrationType] SqlInstancesStartExternalSyncRequest migrationType + * @property {boolean|null} [replicaOverwriteEnabled] SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled + */ + + /** + * Constructs a new SqlInstancesStartExternalSyncRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesStartExternalSyncRequest. + * @implements ISqlInstancesStartExternalSyncRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest=} [properties] Properties to set + */ + function SqlInstancesStartExternalSyncRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesStartExternalSyncRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.instance = ""; + + /** + * SqlInstancesStartExternalSyncRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.project = ""; + + /** + * SqlInstancesStartExternalSyncRequest syncMode. + * @member {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} syncMode + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.syncMode = 0; + + /** + * SqlInstancesStartExternalSyncRequest skipVerification. + * @member {boolean} skipVerification + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.skipVerification = false; + + /** + * SqlInstancesStartExternalSyncRequest mysqlSyncConfig. + * @member {google.cloud.sql.v1beta4.IMySqlSyncConfig|null|undefined} mysqlSyncConfig + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.mysqlSyncConfig = null; + + /** + * SqlInstancesStartExternalSyncRequest syncParallelLevel. + * @member {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} syncParallelLevel + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.syncParallelLevel = 0; + + /** + * SqlInstancesStartExternalSyncRequest migrationType. + * @member {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} migrationType + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.migrationType = 0; + + /** + * SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled. + * @member {boolean} replicaOverwriteEnabled + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @instance + */ + SqlInstancesStartExternalSyncRequest.prototype.replicaOverwriteEnabled = false; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SqlInstancesStartExternalSyncRequest syncConfig. + * @member {"mysqlSyncConfig"|undefined} syncConfig + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @instance + */ + Object.defineProperty(SqlInstancesStartExternalSyncRequest.prototype, "syncConfig", { + get: $util.oneOfGetter($oneOfFields = ["mysqlSyncConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlInstancesStartExternalSyncRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest instance + */ + SqlInstancesStartExternalSyncRequest.create = function create(properties) { + return new SqlInstancesStartExternalSyncRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesStartExternalSyncRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStartExternalSyncRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.syncMode != null && Object.hasOwnProperty.call(message, "syncMode")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.syncMode); + if (message.skipVerification != null && Object.hasOwnProperty.call(message, "skipVerification")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.skipVerification); + if (message.mysqlSyncConfig != null && Object.hasOwnProperty.call(message, "mysqlSyncConfig")) + $root.google.cloud.sql.v1beta4.MySqlSyncConfig.encode(message.mysqlSyncConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.syncParallelLevel != null && Object.hasOwnProperty.call(message, "syncParallelLevel")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.syncParallelLevel); + if (message.migrationType != null && Object.hasOwnProperty.call(message, "migrationType")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.migrationType); + if (message.replicaOverwriteEnabled != null && Object.hasOwnProperty.call(message, "replicaOverwriteEnabled")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.replicaOverwriteEnabled); + return writer; + }; + + /** + * Encodes the specified SqlInstancesStartExternalSyncRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesStartExternalSyncRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStartExternalSyncRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.syncMode = reader.int32(); + break; + } + case 4: { + message.skipVerification = reader.bool(); + break; + } + case 6: { + message.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.decode(reader, reader.uint32()); + break; + } + case 7: { + message.syncParallelLevel = reader.int32(); + break; + } + case 8: { + message.migrationType = reader.int32(); + break; + } + case 9: { + message.replicaOverwriteEnabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesStartExternalSyncRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesStartExternalSyncRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesStartExternalSyncRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.syncMode != null && message.hasOwnProperty("syncMode")) + switch (message.syncMode) { + default: + return "syncMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.skipVerification != null && message.hasOwnProperty("skipVerification")) + if (typeof message.skipVerification !== "boolean") + return "skipVerification: boolean expected"; + if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { + properties.syncConfig = 1; + { + var error = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.verify(message.mysqlSyncConfig); + if (error) + return "mysqlSyncConfig." + error; + } + } + if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) + switch (message.syncParallelLevel) { + default: + return "syncParallelLevel: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.migrationType != null && message.hasOwnProperty("migrationType")) + switch (message.migrationType) { + default: + return "migrationType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.replicaOverwriteEnabled != null && message.hasOwnProperty("replicaOverwriteEnabled")) + if (typeof message.replicaOverwriteEnabled !== "boolean") + return "replicaOverwriteEnabled: boolean expected"; + return null; + }; + + /** + * Creates a SqlInstancesStartExternalSyncRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest + */ + SqlInstancesStartExternalSyncRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + switch (object.syncMode) { + default: + if (typeof object.syncMode === "number") { + message.syncMode = object.syncMode; + break; + } + break; + case "EXTERNAL_SYNC_MODE_UNSPECIFIED": + case 0: + message.syncMode = 0; + break; + case "ONLINE": + case 1: + message.syncMode = 1; + break; + case "OFFLINE": + case 2: + message.syncMode = 2; + break; + } + if (object.skipVerification != null) + message.skipVerification = Boolean(object.skipVerification); + if (object.mysqlSyncConfig != null) { + if (typeof object.mysqlSyncConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.mysqlSyncConfig: object expected"); + message.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.fromObject(object.mysqlSyncConfig); + } + switch (object.syncParallelLevel) { + default: + if (typeof object.syncParallelLevel === "number") { + message.syncParallelLevel = object.syncParallelLevel; + break; + } + break; + case "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": + case 0: + message.syncParallelLevel = 0; + break; + case "MIN": + case 1: + message.syncParallelLevel = 1; + break; + case "OPTIMAL": + case 2: + message.syncParallelLevel = 2; + break; + case "MAX": + case 3: + message.syncParallelLevel = 3; + break; + } + switch (object.migrationType) { + default: + if (typeof object.migrationType === "number") { + message.migrationType = object.migrationType; + break; + } + break; + case "MIGRATION_TYPE_UNSPECIFIED": + case 0: + message.migrationType = 0; + break; + case "LOGICAL": + case 1: + message.migrationType = 1; + break; + case "PHYSICAL": + case 2: + message.migrationType = 2; + break; + } + if (object.replicaOverwriteEnabled != null) + message.replicaOverwriteEnabled = Boolean(object.replicaOverwriteEnabled); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesStartExternalSyncRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesStartExternalSyncRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.syncMode = options.enums === String ? "EXTERNAL_SYNC_MODE_UNSPECIFIED" : 0; + object.skipVerification = false; + object.syncParallelLevel = options.enums === String ? "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" : 0; + object.migrationType = options.enums === String ? "MIGRATION_TYPE_UNSPECIFIED" : 0; + object.replicaOverwriteEnabled = false; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.syncMode != null && message.hasOwnProperty("syncMode")) + object.syncMode = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] === undefined ? message.syncMode : $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] : message.syncMode; + if (message.skipVerification != null && message.hasOwnProperty("skipVerification")) + object.skipVerification = message.skipVerification; + if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { + object.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.toObject(message.mysqlSyncConfig, options); + if (options.oneofs) + object.syncConfig = "mysqlSyncConfig"; + } + if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) + object.syncParallelLevel = options.enums === String ? $root.google.cloud.sql.v1beta4.ExternalSyncParallelLevel[message.syncParallelLevel] === undefined ? message.syncParallelLevel : $root.google.cloud.sql.v1beta4.ExternalSyncParallelLevel[message.syncParallelLevel] : message.syncParallelLevel; + if (message.migrationType != null && message.hasOwnProperty("migrationType")) + object.migrationType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] === undefined ? message.migrationType : $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] : message.migrationType; + if (message.replicaOverwriteEnabled != null && message.hasOwnProperty("replicaOverwriteEnabled")) + object.replicaOverwriteEnabled = message.replicaOverwriteEnabled; + return object; + }; + + /** + * Converts this SqlInstancesStartExternalSyncRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesStartExternalSyncRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesStartExternalSyncRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesStartExternalSyncRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest"; + }; + + return SqlInstancesStartExternalSyncRequest; + })(); + + v1beta4.SqlInstancesResetReplicaSizeRequest = (function() { + + /** + * Properties of a SqlInstancesResetReplicaSizeRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesResetReplicaSizeRequest + * @property {string|null} [instance] SqlInstancesResetReplicaSizeRequest instance + * @property {string|null} [project] SqlInstancesResetReplicaSizeRequest project + */ + + /** + * Constructs a new SqlInstancesResetReplicaSizeRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesResetReplicaSizeRequest. + * @implements ISqlInstancesResetReplicaSizeRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest=} [properties] Properties to set + */ + function SqlInstancesResetReplicaSizeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesResetReplicaSizeRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @instance + */ + SqlInstancesResetReplicaSizeRequest.prototype.instance = ""; + + /** + * SqlInstancesResetReplicaSizeRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @instance + */ + SqlInstancesResetReplicaSizeRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesResetReplicaSizeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest instance + */ + SqlInstancesResetReplicaSizeRequest.create = function create(properties) { + return new SqlInstancesResetReplicaSizeRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesResetReplicaSizeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesResetReplicaSizeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesResetReplicaSizeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesResetReplicaSizeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesResetReplicaSizeRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesResetReplicaSizeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesResetReplicaSizeRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesResetReplicaSizeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesResetReplicaSizeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest + */ + SqlInstancesResetReplicaSizeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesResetReplicaSizeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesResetReplicaSizeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesResetReplicaSizeRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesResetReplicaSizeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesResetReplicaSizeRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesResetReplicaSizeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest"; + }; + + return SqlInstancesResetReplicaSizeRequest; + })(); + + v1beta4.SqlOperationsGetRequest = (function() { + + /** + * Properties of a SqlOperationsGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlOperationsGetRequest + * @property {string|null} [operation] SqlOperationsGetRequest operation + * @property {string|null} [project] SqlOperationsGetRequest project + */ + + /** + * Constructs a new SqlOperationsGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlOperationsGetRequest. + * @implements ISqlOperationsGetRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest=} [properties] Properties to set + */ + function SqlOperationsGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlOperationsGetRequest operation. + * @member {string} operation + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @instance + */ + SqlOperationsGetRequest.prototype.operation = ""; + + /** + * SqlOperationsGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @instance + */ + SqlOperationsGetRequest.prototype.project = ""; + + /** + * Creates a new SqlOperationsGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlOperationsGetRequest} SqlOperationsGetRequest instance + */ + SqlOperationsGetRequest.create = function create(properties) { + return new SqlOperationsGetRequest(properties); + }; + + /** + * Encodes the specified SqlOperationsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest} message SqlOperationsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.operation); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlOperationsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest} message SqlOperationsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlOperationsGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlOperationsGetRequest} SqlOperationsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlOperationsGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.operation = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlOperationsGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlOperationsGetRequest} SqlOperationsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlOperationsGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlOperationsGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operation != null && message.hasOwnProperty("operation")) + if (!$util.isString(message.operation)) + return "operation: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlOperationsGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlOperationsGetRequest} SqlOperationsGetRequest + */ + SqlOperationsGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlOperationsGetRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlOperationsGetRequest(); + if (object.operation != null) + message.operation = String(object.operation); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlOperationsGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlOperationsGetRequest} message SqlOperationsGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlOperationsGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.operation = ""; + object.project = ""; + } + if (message.operation != null && message.hasOwnProperty("operation")) + object.operation = message.operation; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlOperationsGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlOperationsGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlOperationsGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlOperationsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlOperationsGetRequest"; + }; + + return SqlOperationsGetRequest; + })(); + + v1beta4.SqlOperationsListRequest = (function() { + + /** + * Properties of a SqlOperationsListRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlOperationsListRequest + * @property {string|null} [instance] SqlOperationsListRequest instance + * @property {number|null} [maxResults] SqlOperationsListRequest maxResults + * @property {string|null} [pageToken] SqlOperationsListRequest pageToken + * @property {string|null} [project] SqlOperationsListRequest project + */ + + /** + * Constructs a new SqlOperationsListRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlOperationsListRequest. + * @implements ISqlOperationsListRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest=} [properties] Properties to set + */ + function SqlOperationsListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlOperationsListRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @instance + */ + SqlOperationsListRequest.prototype.instance = ""; + + /** + * SqlOperationsListRequest maxResults. + * @member {number} maxResults + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @instance + */ + SqlOperationsListRequest.prototype.maxResults = 0; + + /** + * SqlOperationsListRequest pageToken. + * @member {string} pageToken + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @instance + */ + SqlOperationsListRequest.prototype.pageToken = ""; + + /** + * SqlOperationsListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @instance + */ + SqlOperationsListRequest.prototype.project = ""; + + /** + * Creates a new SqlOperationsListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlOperationsListRequest} SqlOperationsListRequest instance + */ + SqlOperationsListRequest.create = function create(properties) { + return new SqlOperationsListRequest(properties); + }; + + /** + * Encodes the specified SqlOperationsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest} message SqlOperationsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) + writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.maxResults); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlOperationsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest} message SqlOperationsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlOperationsListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlOperationsListRequest} SqlOperationsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlOperationsListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.maxResults = reader.uint32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlOperationsListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlOperationsListRequest} SqlOperationsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlOperationsListRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlOperationsListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + if (!$util.isInteger(message.maxResults)) + return "maxResults: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlOperationsListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlOperationsListRequest} SqlOperationsListRequest + */ + SqlOperationsListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlOperationsListRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlOperationsListRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.maxResults != null) + message.maxResults = object.maxResults >>> 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlOperationsListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlOperationsListRequest} message SqlOperationsListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlOperationsListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.maxResults = 0; + object.pageToken = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.maxResults != null && message.hasOwnProperty("maxResults")) + object.maxResults = message.maxResults; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlOperationsListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlOperationsListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlOperationsListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlOperationsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlOperationsListRequest"; + }; + + return SqlOperationsListRequest; + })(); + + v1beta4.SqlOperationsCancelRequest = (function() { + + /** + * Properties of a SqlOperationsCancelRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlOperationsCancelRequest + * @property {string|null} [operation] SqlOperationsCancelRequest operation + * @property {string|null} [project] SqlOperationsCancelRequest project + */ + + /** + * Constructs a new SqlOperationsCancelRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlOperationsCancelRequest. + * @implements ISqlOperationsCancelRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest=} [properties] Properties to set + */ + function SqlOperationsCancelRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlOperationsCancelRequest operation. + * @member {string} operation + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @instance + */ + SqlOperationsCancelRequest.prototype.operation = ""; + + /** + * SqlOperationsCancelRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @instance + */ + SqlOperationsCancelRequest.prototype.project = ""; + + /** + * Creates a new SqlOperationsCancelRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlOperationsCancelRequest} SqlOperationsCancelRequest instance + */ + SqlOperationsCancelRequest.create = function create(properties) { + return new SqlOperationsCancelRequest(properties); + }; + + /** + * Encodes the specified SqlOperationsCancelRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsCancelRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest} message SqlOperationsCancelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsCancelRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.operation); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlOperationsCancelRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsCancelRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest} message SqlOperationsCancelRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOperationsCancelRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlOperationsCancelRequest} SqlOperationsCancelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsCancelRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.operation = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlOperationsCancelRequest} SqlOperationsCancelRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOperationsCancelRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlOperationsCancelRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlOperationsCancelRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operation != null && message.hasOwnProperty("operation")) + if (!$util.isString(message.operation)) + return "operation: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlOperationsCancelRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlOperationsCancelRequest} SqlOperationsCancelRequest + */ + SqlOperationsCancelRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlOperationsCancelRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(); + if (object.operation != null) + message.operation = String(object.operation); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlOperationsCancelRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlOperationsCancelRequest} message SqlOperationsCancelRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlOperationsCancelRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.operation = ""; + object.project = ""; + } + if (message.operation != null && message.hasOwnProperty("operation")) + object.operation = message.operation; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlOperationsCancelRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @instance + * @returns {Object.} JSON object + */ + SqlOperationsCancelRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlOperationsCancelRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlOperationsCancelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlOperationsCancelRequest"; + }; + + return SqlOperationsCancelRequest; + })(); + + v1beta4.SqlInstancesCreateEphemeralCertRequest = (function() { + + /** + * Properties of a SqlInstancesCreateEphemeralCertRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesCreateEphemeralCertRequest + * @property {string|null} [instance] SqlInstancesCreateEphemeralCertRequest instance + * @property {string|null} [project] SqlInstancesCreateEphemeralCertRequest project + * @property {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest|null} [body] SqlInstancesCreateEphemeralCertRequest body + */ + + /** + * Constructs a new SqlInstancesCreateEphemeralCertRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesCreateEphemeralCertRequest. + * @implements ISqlInstancesCreateEphemeralCertRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest=} [properties] Properties to set + */ + function SqlInstancesCreateEphemeralCertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesCreateEphemeralCertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @instance + */ + SqlInstancesCreateEphemeralCertRequest.prototype.instance = ""; + + /** + * SqlInstancesCreateEphemeralCertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @instance + */ + SqlInstancesCreateEphemeralCertRequest.prototype.project = ""; + + /** + * SqlInstancesCreateEphemeralCertRequest body. + * @member {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @instance + */ + SqlInstancesCreateEphemeralCertRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesCreateEphemeralCertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest instance + */ + SqlInstancesCreateEphemeralCertRequest.create = function create(properties) { + return new SqlInstancesCreateEphemeralCertRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesCreateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesCreateEphemeralCertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesCreateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesCreateEphemeralCertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesCreateEphemeralCertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesCreateEphemeralCertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesCreateEphemeralCertRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesCreateEphemeralCertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesCreateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest + */ + SqlInstancesCreateEphemeralCertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesCreateEphemeralCertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesCreateEphemeralCertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesCreateEphemeralCertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesCreateEphemeralCertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesCreateEphemeralCertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesCreateEphemeralCertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest"; + }; + + return SqlInstancesCreateEphemeralCertRequest; + })(); + + v1beta4.SqlSslCertsDeleteRequest = (function() { + + /** + * Properties of a SqlSslCertsDeleteRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlSslCertsDeleteRequest + * @property {string|null} [instance] SqlSslCertsDeleteRequest instance + * @property {string|null} [project] SqlSslCertsDeleteRequest project + * @property {string|null} [sha1Fingerprint] SqlSslCertsDeleteRequest sha1Fingerprint + */ + + /** + * Constructs a new SqlSslCertsDeleteRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlSslCertsDeleteRequest. + * @implements ISqlSslCertsDeleteRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest=} [properties] Properties to set + */ + function SqlSslCertsDeleteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlSslCertsDeleteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @instance + */ + SqlSslCertsDeleteRequest.prototype.instance = ""; + + /** + * SqlSslCertsDeleteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @instance + */ + SqlSslCertsDeleteRequest.prototype.project = ""; + + /** + * SqlSslCertsDeleteRequest sha1Fingerprint. + * @member {string} sha1Fingerprint + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @instance + */ + SqlSslCertsDeleteRequest.prototype.sha1Fingerprint = ""; + + /** + * Creates a new SqlSslCertsDeleteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest instance + */ + SqlSslCertsDeleteRequest.create = function create(properties) { + return new SqlSslCertsDeleteRequest(properties); + }; + + /** + * Encodes the specified SqlSslCertsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsDeleteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sha1Fingerprint); + return writer; + }; + + /** + * Encodes the specified SqlSslCertsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsDeleteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.sha1Fingerprint = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsDeleteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlSslCertsDeleteRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlSslCertsDeleteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + if (!$util.isString(message.sha1Fingerprint)) + return "sha1Fingerprint: string expected"; + return null; + }; + + /** + * Creates a SqlSslCertsDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest + */ + SqlSslCertsDeleteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.sha1Fingerprint != null) + message.sha1Fingerprint = String(object.sha1Fingerprint); + return message; + }; + + /** + * Creates a plain object from a SqlSslCertsDeleteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlSslCertsDeleteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.sha1Fingerprint = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + object.sha1Fingerprint = message.sha1Fingerprint; + return object; + }; + + /** + * Converts this SqlSslCertsDeleteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlSslCertsDeleteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlSslCertsDeleteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlSslCertsDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest"; + }; + + return SqlSslCertsDeleteRequest; + })(); + + v1beta4.SqlSslCertsGetRequest = (function() { + + /** + * Properties of a SqlSslCertsGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlSslCertsGetRequest + * @property {string|null} [instance] SqlSslCertsGetRequest instance + * @property {string|null} [project] SqlSslCertsGetRequest project + * @property {string|null} [sha1Fingerprint] SqlSslCertsGetRequest sha1Fingerprint + */ + + /** + * Constructs a new SqlSslCertsGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlSslCertsGetRequest. + * @implements ISqlSslCertsGetRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest=} [properties] Properties to set + */ + function SqlSslCertsGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlSslCertsGetRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @instance + */ + SqlSslCertsGetRequest.prototype.instance = ""; + + /** + * SqlSslCertsGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @instance + */ + SqlSslCertsGetRequest.prototype.project = ""; + + /** + * SqlSslCertsGetRequest sha1Fingerprint. + * @member {string} sha1Fingerprint + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @instance + */ + SqlSslCertsGetRequest.prototype.sha1Fingerprint = ""; + + /** + * Creates a new SqlSslCertsGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlSslCertsGetRequest} SqlSslCertsGetRequest instance + */ + SqlSslCertsGetRequest.create = function create(properties) { + return new SqlSslCertsGetRequest(properties); + }; + + /** + * Encodes the specified SqlSslCertsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest} message SqlSslCertsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.sha1Fingerprint); + return writer; + }; + + /** + * Encodes the specified SqlSslCertsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest} message SqlSslCertsGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlSslCertsGetRequest} SqlSslCertsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.sha1Fingerprint = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlSslCertsGetRequest} SqlSslCertsGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlSslCertsGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlSslCertsGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + if (!$util.isString(message.sha1Fingerprint)) + return "sha1Fingerprint: string expected"; + return null; + }; + + /** + * Creates a SqlSslCertsGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlSslCertsGetRequest} SqlSslCertsGetRequest + */ + SqlSslCertsGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlSslCertsGetRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.sha1Fingerprint != null) + message.sha1Fingerprint = String(object.sha1Fingerprint); + return message; + }; + + /** + * Creates a plain object from a SqlSslCertsGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlSslCertsGetRequest} message SqlSslCertsGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlSslCertsGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.sha1Fingerprint = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + object.sha1Fingerprint = message.sha1Fingerprint; + return object; + }; + + /** + * Converts this SqlSslCertsGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlSslCertsGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlSslCertsGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlSslCertsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlSslCertsGetRequest"; + }; + + return SqlSslCertsGetRequest; + })(); + + v1beta4.SqlSslCertsInsertRequest = (function() { + + /** + * Properties of a SqlSslCertsInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlSslCertsInsertRequest + * @property {string|null} [instance] SqlSslCertsInsertRequest instance + * @property {string|null} [project] SqlSslCertsInsertRequest project + * @property {google.cloud.sql.v1beta4.ISslCertsInsertRequest|null} [body] SqlSslCertsInsertRequest body + */ + + /** + * Constructs a new SqlSslCertsInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlSslCertsInsertRequest. + * @implements ISqlSslCertsInsertRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest=} [properties] Properties to set + */ + function SqlSslCertsInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlSslCertsInsertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @instance + */ + SqlSslCertsInsertRequest.prototype.instance = ""; + + /** + * SqlSslCertsInsertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @instance + */ + SqlSslCertsInsertRequest.prototype.project = ""; + + /** + * SqlSslCertsInsertRequest body. + * @member {google.cloud.sql.v1beta4.ISslCertsInsertRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @instance + */ + SqlSslCertsInsertRequest.prototype.body = null; + + /** + * Creates a new SqlSslCertsInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest instance + */ + SqlSslCertsInsertRequest.create = function create(properties) { + return new SqlSslCertsInsertRequest(properties); + }; + + /** + * Encodes the specified SqlSslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest} message SqlSslCertsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.SslCertsInsertRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlSslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest} message SqlSslCertsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.SslCertsInsertRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlSslCertsInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlSslCertsInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.SslCertsInsertRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlSslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest + */ + SqlSslCertsInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlSslCertsInsertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.SslCertsInsertRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlSslCertsInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlSslCertsInsertRequest} message SqlSslCertsInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlSslCertsInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.SslCertsInsertRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlSslCertsInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlSslCertsInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlSslCertsInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlSslCertsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlSslCertsInsertRequest"; + }; + + return SqlSslCertsInsertRequest; + })(); + + v1beta4.SqlSslCertsListRequest = (function() { + + /** + * Properties of a SqlSslCertsListRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlSslCertsListRequest + * @property {string|null} [instance] SqlSslCertsListRequest instance + * @property {string|null} [project] SqlSslCertsListRequest project + */ + + /** + * Constructs a new SqlSslCertsListRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlSslCertsListRequest. + * @implements ISqlSslCertsListRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest=} [properties] Properties to set + */ + function SqlSslCertsListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlSslCertsListRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @instance + */ + SqlSslCertsListRequest.prototype.instance = ""; + + /** + * SqlSslCertsListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @instance + */ + SqlSslCertsListRequest.prototype.project = ""; + + /** + * Creates a new SqlSslCertsListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlSslCertsListRequest} SqlSslCertsListRequest instance + */ + SqlSslCertsListRequest.create = function create(properties) { + return new SqlSslCertsListRequest(properties); + }; + + /** + * Encodes the specified SqlSslCertsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest} message SqlSslCertsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlSslCertsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest} message SqlSslCertsListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSslCertsListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlSslCertsListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlSslCertsListRequest} SqlSslCertsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlSslCertsListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlSslCertsListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlSslCertsListRequest} SqlSslCertsListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSslCertsListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlSslCertsListRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlSslCertsListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlSslCertsListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlSslCertsListRequest} SqlSslCertsListRequest + */ + SqlSslCertsListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlSslCertsListRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlSslCertsListRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlSslCertsListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlSslCertsListRequest} message SqlSslCertsListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlSslCertsListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlSslCertsListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlSslCertsListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlSslCertsListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlSslCertsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlSslCertsListRequest"; + }; + + return SqlSslCertsListRequest; + })(); + + v1beta4.SqlInstancesGetDiskShrinkConfigRequest = (function() { + + /** + * Properties of a SqlInstancesGetDiskShrinkConfigRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesGetDiskShrinkConfigRequest + * @property {string|null} [instance] SqlInstancesGetDiskShrinkConfigRequest instance + * @property {string|null} [project] SqlInstancesGetDiskShrinkConfigRequest project + */ + + /** + * Constructs a new SqlInstancesGetDiskShrinkConfigRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesGetDiskShrinkConfigRequest. + * @implements ISqlInstancesGetDiskShrinkConfigRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest=} [properties] Properties to set + */ + function SqlInstancesGetDiskShrinkConfigRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesGetDiskShrinkConfigRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @instance + */ + SqlInstancesGetDiskShrinkConfigRequest.prototype.instance = ""; + + /** + * SqlInstancesGetDiskShrinkConfigRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @instance + */ + SqlInstancesGetDiskShrinkConfigRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesGetDiskShrinkConfigRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest instance + */ + SqlInstancesGetDiskShrinkConfigRequest.create = function create(properties) { + return new SqlInstancesGetDiskShrinkConfigRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetDiskShrinkConfigRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetDiskShrinkConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetDiskShrinkConfigRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetDiskShrinkConfigRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesGetDiskShrinkConfigRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesGetDiskShrinkConfigRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesGetDiskShrinkConfigRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest + */ + SqlInstancesGetDiskShrinkConfigRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesGetDiskShrinkConfigRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesGetDiskShrinkConfigRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesGetDiskShrinkConfigRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesGetDiskShrinkConfigRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesGetDiskShrinkConfigRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesGetDiskShrinkConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest"; + }; + + return SqlInstancesGetDiskShrinkConfigRequest; + })(); + + v1beta4.SqlInstancesGetLatestRecoveryTimeRequest = (function() { + + /** + * Properties of a SqlInstancesGetLatestRecoveryTimeRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesGetLatestRecoveryTimeRequest + * @property {string|null} [instance] SqlInstancesGetLatestRecoveryTimeRequest instance + * @property {string|null} [project] SqlInstancesGetLatestRecoveryTimeRequest project + * @property {google.protobuf.ITimestamp|null} [sourceInstanceDeletionTime] SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime + */ + + /** + * Constructs a new SqlInstancesGetLatestRecoveryTimeRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesGetLatestRecoveryTimeRequest. + * @implements ISqlInstancesGetLatestRecoveryTimeRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest=} [properties] Properties to set + */ + function SqlInstancesGetLatestRecoveryTimeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesGetLatestRecoveryTimeRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @instance + */ + SqlInstancesGetLatestRecoveryTimeRequest.prototype.instance = ""; + + /** + * SqlInstancesGetLatestRecoveryTimeRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @instance + */ + SqlInstancesGetLatestRecoveryTimeRequest.prototype.project = ""; + + /** + * SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime. + * @member {google.protobuf.ITimestamp|null|undefined} sourceInstanceDeletionTime + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @instance + */ + SqlInstancesGetLatestRecoveryTimeRequest.prototype.sourceInstanceDeletionTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlInstancesGetLatestRecoveryTimeRequest.prototype, "_sourceInstanceDeletionTime", { + get: $util.oneOfGetter($oneOfFields = ["sourceInstanceDeletionTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlInstancesGetLatestRecoveryTimeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest instance + */ + SqlInstancesGetLatestRecoveryTimeRequest.create = function create(properties) { + return new SqlInstancesGetLatestRecoveryTimeRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetLatestRecoveryTimeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.sourceInstanceDeletionTime != null && Object.hasOwnProperty.call(message, "sourceInstanceDeletionTime")) + $root.google.protobuf.Timestamp.encode(message.sourceInstanceDeletionTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetLatestRecoveryTimeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetLatestRecoveryTimeRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetLatestRecoveryTimeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesGetLatestRecoveryTimeRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesGetLatestRecoveryTimeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { + properties._sourceInstanceDeletionTime = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.sourceInstanceDeletionTime); + if (error) + return "sourceInstanceDeletionTime." + error; + } + } + return null; + }; + + /** + * Creates a SqlInstancesGetLatestRecoveryTimeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest + */ + SqlInstancesGetLatestRecoveryTimeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.sourceInstanceDeletionTime != null) { + if (typeof object.sourceInstanceDeletionTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest.sourceInstanceDeletionTime: object expected"); + message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.sourceInstanceDeletionTime); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesGetLatestRecoveryTimeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { + object.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.sourceInstanceDeletionTime, options); + if (options.oneofs) + object._sourceInstanceDeletionTime = "sourceInstanceDeletionTime"; + } + return object; + }; + + /** + * Converts this SqlInstancesGetLatestRecoveryTimeRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesGetLatestRecoveryTimeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesGetLatestRecoveryTimeRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesGetLatestRecoveryTimeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest"; + }; + + return SqlInstancesGetLatestRecoveryTimeRequest; + })(); + + v1beta4.SqlInstancesGetLatestRecoveryTimeResponse = (function() { + + /** + * Properties of a SqlInstancesGetLatestRecoveryTimeResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesGetLatestRecoveryTimeResponse + * @property {string|null} [kind] SqlInstancesGetLatestRecoveryTimeResponse kind + * @property {google.protobuf.ITimestamp|null} [latestRecoveryTime] SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime + * @property {google.protobuf.ITimestamp|null} [earliestRecoveryTime] SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime + */ + + /** + * Constructs a new SqlInstancesGetLatestRecoveryTimeResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesGetLatestRecoveryTimeResponse. + * @implements ISqlInstancesGetLatestRecoveryTimeResponse + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse=} [properties] Properties to set + */ + function SqlInstancesGetLatestRecoveryTimeResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesGetLatestRecoveryTimeResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @instance + */ + SqlInstancesGetLatestRecoveryTimeResponse.prototype.kind = ""; + + /** + * SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime. + * @member {google.protobuf.ITimestamp|null|undefined} latestRecoveryTime + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @instance + */ + SqlInstancesGetLatestRecoveryTimeResponse.prototype.latestRecoveryTime = null; + + /** + * SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime. + * @member {google.protobuf.ITimestamp|null|undefined} earliestRecoveryTime + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @instance + */ + SqlInstancesGetLatestRecoveryTimeResponse.prototype.earliestRecoveryTime = null; + + /** + * Creates a new SqlInstancesGetLatestRecoveryTimeResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse instance + */ + SqlInstancesGetLatestRecoveryTimeResponse.create = function create(properties) { + return new SqlInstancesGetLatestRecoveryTimeResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetLatestRecoveryTimeResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.latestRecoveryTime != null && Object.hasOwnProperty.call(message, "latestRecoveryTime")) + $root.google.protobuf.Timestamp.encode(message.latestRecoveryTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.earliestRecoveryTime != null && Object.hasOwnProperty.call(message, "earliestRecoveryTime")) + $root.google.protobuf.Timestamp.encode(message.earliestRecoveryTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetLatestRecoveryTimeResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetLatestRecoveryTimeResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.latestRecoveryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.earliestRecoveryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetLatestRecoveryTimeResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesGetLatestRecoveryTimeResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesGetLatestRecoveryTimeResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.latestRecoveryTime != null && message.hasOwnProperty("latestRecoveryTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.latestRecoveryTime); + if (error) + return "latestRecoveryTime." + error; + } + if (message.earliestRecoveryTime != null && message.hasOwnProperty("earliestRecoveryTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.earliestRecoveryTime); + if (error) + return "earliestRecoveryTime." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesGetLatestRecoveryTimeResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse + */ + SqlInstancesGetLatestRecoveryTimeResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.latestRecoveryTime != null) { + if (typeof object.latestRecoveryTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.latestRecoveryTime: object expected"); + message.latestRecoveryTime = $root.google.protobuf.Timestamp.fromObject(object.latestRecoveryTime); + } + if (object.earliestRecoveryTime != null) { + if (typeof object.earliestRecoveryTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.earliestRecoveryTime: object expected"); + message.earliestRecoveryTime = $root.google.protobuf.Timestamp.fromObject(object.earliestRecoveryTime); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesGetLatestRecoveryTimeResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.latestRecoveryTime = null; + object.earliestRecoveryTime = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.latestRecoveryTime != null && message.hasOwnProperty("latestRecoveryTime")) + object.latestRecoveryTime = $root.google.protobuf.Timestamp.toObject(message.latestRecoveryTime, options); + if (message.earliestRecoveryTime != null && message.hasOwnProperty("earliestRecoveryTime")) + object.earliestRecoveryTime = $root.google.protobuf.Timestamp.toObject(message.earliestRecoveryTime, options); + return object; + }; + + /** + * Converts this SqlInstancesGetLatestRecoveryTimeResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesGetLatestRecoveryTimeResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesGetLatestRecoveryTimeResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesGetLatestRecoveryTimeResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse"; + }; + + return SqlInstancesGetLatestRecoveryTimeResponse; + })(); + + v1beta4.SqlInstancesExecuteSqlRequest = (function() { + + /** + * Properties of a SqlInstancesExecuteSqlRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesExecuteSqlRequest + * @property {string|null} [instance] SqlInstancesExecuteSqlRequest instance + * @property {string|null} [project] SqlInstancesExecuteSqlRequest project + * @property {google.cloud.sql.v1beta4.IExecuteSqlPayload|null} [body] SqlInstancesExecuteSqlRequest body + */ + + /** + * Constructs a new SqlInstancesExecuteSqlRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesExecuteSqlRequest. + * @implements ISqlInstancesExecuteSqlRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest=} [properties] Properties to set + */ + function SqlInstancesExecuteSqlRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesExecuteSqlRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @instance + */ + SqlInstancesExecuteSqlRequest.prototype.instance = ""; + + /** + * SqlInstancesExecuteSqlRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @instance + */ + SqlInstancesExecuteSqlRequest.prototype.project = ""; + + /** + * SqlInstancesExecuteSqlRequest body. + * @member {google.cloud.sql.v1beta4.IExecuteSqlPayload|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @instance + */ + SqlInstancesExecuteSqlRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesExecuteSqlRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest instance + */ + SqlInstancesExecuteSqlRequest.create = function create(properties) { + return new SqlInstancesExecuteSqlRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesExecuteSqlRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExecuteSqlRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesExecuteSqlRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExecuteSqlRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExecuteSqlRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExecuteSqlRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesExecuteSqlRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesExecuteSqlRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesExecuteSqlRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest + */ + SqlInstancesExecuteSqlRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesExecuteSqlRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesExecuteSqlRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesExecuteSqlRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesExecuteSqlRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesExecuteSqlRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesExecuteSqlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest"; + }; + + return SqlInstancesExecuteSqlRequest; + })(); + + v1beta4.SqlInstancesReleaseSsrsLeaseRequest = (function() { + + /** + * Properties of a SqlInstancesReleaseSsrsLeaseRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesReleaseSsrsLeaseRequest + * @property {string|null} [instance] SqlInstancesReleaseSsrsLeaseRequest instance + * @property {string|null} [project] SqlInstancesReleaseSsrsLeaseRequest project + */ + + /** + * Constructs a new SqlInstancesReleaseSsrsLeaseRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesReleaseSsrsLeaseRequest. + * @implements ISqlInstancesReleaseSsrsLeaseRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest=} [properties] Properties to set + */ + function SqlInstancesReleaseSsrsLeaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesReleaseSsrsLeaseRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @instance + */ + SqlInstancesReleaseSsrsLeaseRequest.prototype.instance = ""; + + /** + * SqlInstancesReleaseSsrsLeaseRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @instance + */ + SqlInstancesReleaseSsrsLeaseRequest.prototype.project = ""; + + /** + * Creates a new SqlInstancesReleaseSsrsLeaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest instance + */ + SqlInstancesReleaseSsrsLeaseRequest.create = function create(properties) { + return new SqlInstancesReleaseSsrsLeaseRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReleaseSsrsLeaseRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReleaseSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReleaseSsrsLeaseRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReleaseSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesReleaseSsrsLeaseRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesReleaseSsrsLeaseRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesReleaseSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest + */ + SqlInstancesReleaseSsrsLeaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesReleaseSsrsLeaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesReleaseSsrsLeaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlInstancesReleaseSsrsLeaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesReleaseSsrsLeaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesReleaseSsrsLeaseRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesReleaseSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest"; + }; + + return SqlInstancesReleaseSsrsLeaseRequest; + })(); + + v1beta4.SqlInstancesReleaseSsrsLeaseResponse = (function() { + + /** + * Properties of a SqlInstancesReleaseSsrsLeaseResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesReleaseSsrsLeaseResponse + * @property {string|null} [operationId] SqlInstancesReleaseSsrsLeaseResponse operationId + */ + + /** + * Constructs a new SqlInstancesReleaseSsrsLeaseResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesReleaseSsrsLeaseResponse. + * @implements ISqlInstancesReleaseSsrsLeaseResponse + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse=} [properties] Properties to set + */ + function SqlInstancesReleaseSsrsLeaseResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesReleaseSsrsLeaseResponse operationId. + * @member {string} operationId + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @instance + */ + SqlInstancesReleaseSsrsLeaseResponse.prototype.operationId = ""; + + /** + * Creates a new SqlInstancesReleaseSsrsLeaseResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse instance + */ + SqlInstancesReleaseSsrsLeaseResponse.create = function create(properties) { + return new SqlInstancesReleaseSsrsLeaseResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReleaseSsrsLeaseResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operationId != null && Object.hasOwnProperty.call(message, "operationId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.operationId); + return writer; + }; + + /** + * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesReleaseSsrsLeaseResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReleaseSsrsLeaseResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.operationId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesReleaseSsrsLeaseResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesReleaseSsrsLeaseResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesReleaseSsrsLeaseResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operationId != null && message.hasOwnProperty("operationId")) + if (!$util.isString(message.operationId)) + return "operationId: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesReleaseSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse + */ + SqlInstancesReleaseSsrsLeaseResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse(); + if (object.operationId != null) + message.operationId = String(object.operationId); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesReleaseSsrsLeaseResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesReleaseSsrsLeaseResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.operationId = ""; + if (message.operationId != null && message.hasOwnProperty("operationId")) + object.operationId = message.operationId; + return object; + }; + + /** + * Converts this SqlInstancesReleaseSsrsLeaseResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesReleaseSsrsLeaseResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesReleaseSsrsLeaseResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesReleaseSsrsLeaseResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse"; + }; + + return SqlInstancesReleaseSsrsLeaseResponse; + })(); + + v1beta4.ExecuteSqlPayload = (function() { + + /** + * Properties of an ExecuteSqlPayload. + * @memberof google.cloud.sql.v1beta4 + * @interface IExecuteSqlPayload + * @property {string|null} [user] ExecuteSqlPayload user + * @property {string|null} [sqlStatement] ExecuteSqlPayload sqlStatement + * @property {string|null} [database] ExecuteSqlPayload database + * @property {boolean|null} [autoIamAuthn] ExecuteSqlPayload autoIamAuthn + * @property {number|Long|null} [rowLimit] ExecuteSqlPayload rowLimit + * @property {google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode|null} [partialResultMode] ExecuteSqlPayload partialResultMode + * @property {string|null} [application] ExecuteSqlPayload application + */ + + /** + * Constructs a new ExecuteSqlPayload. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an ExecuteSqlPayload. + * @implements IExecuteSqlPayload + * @constructor + * @param {google.cloud.sql.v1beta4.IExecuteSqlPayload=} [properties] Properties to set + */ + function ExecuteSqlPayload(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExecuteSqlPayload user. + * @member {string} user + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.user = ""; + + /** + * ExecuteSqlPayload sqlStatement. + * @member {string} sqlStatement + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.sqlStatement = ""; + + /** + * ExecuteSqlPayload database. + * @member {string} database + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.database = ""; + + /** + * ExecuteSqlPayload autoIamAuthn. + * @member {boolean|null|undefined} autoIamAuthn + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.autoIamAuthn = null; + + /** + * ExecuteSqlPayload rowLimit. + * @member {number|Long} rowLimit + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.rowLimit = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * ExecuteSqlPayload partialResultMode. + * @member {google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode} partialResultMode + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.partialResultMode = 0; + + /** + * ExecuteSqlPayload application. + * @member {string} application + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @instance + */ + ExecuteSqlPayload.prototype.application = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * ExecuteSqlPayload userPassword. + * @member {"autoIamAuthn"|undefined} userPassword + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @instance + */ + Object.defineProperty(ExecuteSqlPayload.prototype, "userPassword", { + get: $util.oneOfGetter($oneOfFields = ["autoIamAuthn"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ExecuteSqlPayload instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @static + * @param {google.cloud.sql.v1beta4.IExecuteSqlPayload=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ExecuteSqlPayload} ExecuteSqlPayload instance + */ + ExecuteSqlPayload.create = function create(properties) { + return new ExecuteSqlPayload(properties); + }; + + /** + * Encodes the specified ExecuteSqlPayload message. Does not implicitly {@link google.cloud.sql.v1beta4.ExecuteSqlPayload.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @static + * @param {google.cloud.sql.v1beta4.IExecuteSqlPayload} message ExecuteSqlPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecuteSqlPayload.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.user != null && Object.hasOwnProperty.call(message, "user")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.user); + if (message.sqlStatement != null && Object.hasOwnProperty.call(message, "sqlStatement")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sqlStatement); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.database); + if (message.rowLimit != null && Object.hasOwnProperty.call(message, "rowLimit")) + writer.uint32(/* id 10, wireType 0 =*/80).int64(message.rowLimit); + if (message.autoIamAuthn != null && Object.hasOwnProperty.call(message, "autoIamAuthn")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.autoIamAuthn); + if (message.partialResultMode != null && Object.hasOwnProperty.call(message, "partialResultMode")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.partialResultMode); + if (message.application != null && Object.hasOwnProperty.call(message, "application")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.application); + return writer; + }; + + /** + * Encodes the specified ExecuteSqlPayload message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExecuteSqlPayload.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @static + * @param {google.cloud.sql.v1beta4.IExecuteSqlPayload} message ExecuteSqlPayload message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExecuteSqlPayload.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExecuteSqlPayload message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ExecuteSqlPayload} ExecuteSqlPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecuteSqlPayload.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExecuteSqlPayload(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.user = reader.string(); + break; + } + case 2: { + message.sqlStatement = reader.string(); + break; + } + case 3: { + message.database = reader.string(); + break; + } + case 11: { + message.autoIamAuthn = reader.bool(); + break; + } + case 10: { + message.rowLimit = reader.int64(); + break; + } + case 13: { + message.partialResultMode = reader.int32(); + break; + } + case 16: { + message.application = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExecuteSqlPayload message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ExecuteSqlPayload} ExecuteSqlPayload + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExecuteSqlPayload.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExecuteSqlPayload message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExecuteSqlPayload.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.user != null && message.hasOwnProperty("user")) + if (!$util.isString(message.user)) + return "user: string expected"; + if (message.sqlStatement != null && message.hasOwnProperty("sqlStatement")) + if (!$util.isString(message.sqlStatement)) + return "sqlStatement: string expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.autoIamAuthn != null && message.hasOwnProperty("autoIamAuthn")) { + properties.userPassword = 1; + if (typeof message.autoIamAuthn !== "boolean") + return "autoIamAuthn: boolean expected"; + } + if (message.rowLimit != null && message.hasOwnProperty("rowLimit")) + if (!$util.isInteger(message.rowLimit) && !(message.rowLimit && $util.isInteger(message.rowLimit.low) && $util.isInteger(message.rowLimit.high))) + return "rowLimit: integer|Long expected"; + if (message.partialResultMode != null && message.hasOwnProperty("partialResultMode")) + switch (message.partialResultMode) { + default: + return "partialResultMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.application != null && message.hasOwnProperty("application")) + if (!$util.isString(message.application)) + return "application: string expected"; + return null; + }; + + /** + * Creates an ExecuteSqlPayload message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ExecuteSqlPayload} ExecuteSqlPayload + */ + ExecuteSqlPayload.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ExecuteSqlPayload) + return object; + var message = new $root.google.cloud.sql.v1beta4.ExecuteSqlPayload(); + if (object.user != null) + message.user = String(object.user); + if (object.sqlStatement != null) + message.sqlStatement = String(object.sqlStatement); + if (object.database != null) + message.database = String(object.database); + if (object.autoIamAuthn != null) + message.autoIamAuthn = Boolean(object.autoIamAuthn); + if (object.rowLimit != null) + if ($util.Long) + (message.rowLimit = $util.Long.fromValue(object.rowLimit)).unsigned = false; + else if (typeof object.rowLimit === "string") + message.rowLimit = parseInt(object.rowLimit, 10); + else if (typeof object.rowLimit === "number") + message.rowLimit = object.rowLimit; + else if (typeof object.rowLimit === "object") + message.rowLimit = new $util.LongBits(object.rowLimit.low >>> 0, object.rowLimit.high >>> 0).toNumber(); + switch (object.partialResultMode) { + default: + if (typeof object.partialResultMode === "number") { + message.partialResultMode = object.partialResultMode; + break; + } + break; + case "PARTIAL_RESULT_MODE_UNSPECIFIED": + case 0: + message.partialResultMode = 0; + break; + case "FAIL_PARTIAL_RESULT": + case 1: + message.partialResultMode = 1; + break; + case "ALLOW_PARTIAL_RESULT": + case 2: + message.partialResultMode = 2; + break; + } + if (object.application != null) + message.application = String(object.application); + return message; + }; + + /** + * Creates a plain object from an ExecuteSqlPayload message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @static + * @param {google.cloud.sql.v1beta4.ExecuteSqlPayload} message ExecuteSqlPayload + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExecuteSqlPayload.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.user = ""; + object.sqlStatement = ""; + object.database = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.rowLimit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.rowLimit = options.longs === String ? "0" : 0; + object.partialResultMode = options.enums === String ? "PARTIAL_RESULT_MODE_UNSPECIFIED" : 0; + object.application = ""; + } + if (message.user != null && message.hasOwnProperty("user")) + object.user = message.user; + if (message.sqlStatement != null && message.hasOwnProperty("sqlStatement")) + object.sqlStatement = message.sqlStatement; + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + if (message.rowLimit != null && message.hasOwnProperty("rowLimit")) + if (typeof message.rowLimit === "number") + object.rowLimit = options.longs === String ? String(message.rowLimit) : message.rowLimit; + else + object.rowLimit = options.longs === String ? $util.Long.prototype.toString.call(message.rowLimit) : options.longs === Number ? new $util.LongBits(message.rowLimit.low >>> 0, message.rowLimit.high >>> 0).toNumber() : message.rowLimit; + if (message.autoIamAuthn != null && message.hasOwnProperty("autoIamAuthn")) { + object.autoIamAuthn = message.autoIamAuthn; + if (options.oneofs) + object.userPassword = "autoIamAuthn"; + } + if (message.partialResultMode != null && message.hasOwnProperty("partialResultMode")) + object.partialResultMode = options.enums === String ? $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode[message.partialResultMode] === undefined ? message.partialResultMode : $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode[message.partialResultMode] : message.partialResultMode; + if (message.application != null && message.hasOwnProperty("application")) + object.application = message.application; + return object; + }; + + /** + * Converts this ExecuteSqlPayload to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @instance + * @returns {Object.} JSON object + */ + ExecuteSqlPayload.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExecuteSqlPayload + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExecuteSqlPayload.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExecuteSqlPayload"; + }; + + /** + * PartialResultMode enum. + * @name google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode + * @enum {number} + * @property {number} PARTIAL_RESULT_MODE_UNSPECIFIED=0 PARTIAL_RESULT_MODE_UNSPECIFIED value + * @property {number} FAIL_PARTIAL_RESULT=1 FAIL_PARTIAL_RESULT value + * @property {number} ALLOW_PARTIAL_RESULT=2 ALLOW_PARTIAL_RESULT value + */ + ExecuteSqlPayload.PartialResultMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "PARTIAL_RESULT_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FAIL_PARTIAL_RESULT"] = 1; + values[valuesById[2] = "ALLOW_PARTIAL_RESULT"] = 2; + return values; + })(); + + return ExecuteSqlPayload; + })(); + + v1beta4.SqlInstancesExecuteSqlResponse = (function() { + + /** + * Properties of a SqlInstancesExecuteSqlResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesExecuteSqlResponse + * @property {Array.|null} [messages] SqlInstancesExecuteSqlResponse messages + * @property {google.cloud.sql.v1beta4.IMetadata|null} [metadata] SqlInstancesExecuteSqlResponse metadata + * @property {Array.|null} [results] SqlInstancesExecuteSqlResponse results + * @property {google.rpc.IStatus|null} [status] SqlInstancesExecuteSqlResponse status + */ + + /** + * Constructs a new SqlInstancesExecuteSqlResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesExecuteSqlResponse. + * @implements ISqlInstancesExecuteSqlResponse + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse=} [properties] Properties to set + */ + function SqlInstancesExecuteSqlResponse(properties) { + this.messages = []; + this.results = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesExecuteSqlResponse messages. + * @member {Array.} messages + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @instance + */ + SqlInstancesExecuteSqlResponse.prototype.messages = $util.emptyArray; + + /** + * SqlInstancesExecuteSqlResponse metadata. + * @member {google.cloud.sql.v1beta4.IMetadata|null|undefined} metadata + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @instance + */ + SqlInstancesExecuteSqlResponse.prototype.metadata = null; + + /** + * SqlInstancesExecuteSqlResponse results. + * @member {Array.} results + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @instance + */ + SqlInstancesExecuteSqlResponse.prototype.results = $util.emptyArray; + + /** + * SqlInstancesExecuteSqlResponse status. + * @member {google.rpc.IStatus|null|undefined} status + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @instance + */ + SqlInstancesExecuteSqlResponse.prototype.status = null; + + /** + * Creates a new SqlInstancesExecuteSqlResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse instance + */ + SqlInstancesExecuteSqlResponse.create = function create(properties) { + return new SqlInstancesExecuteSqlResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesExecuteSqlResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExecuteSqlResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.cloud.sql.v1beta4.Metadata.encode(message.metadata, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.results != null && message.results.length) + for (var i = 0; i < message.results.length; ++i) + $root.google.cloud.sql.v1beta4.QueryResult.encode(message.results[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.messages != null && message.messages.length) + for (var i = 0; i < message.messages.length; ++i) + $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.encode(message.messages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesExecuteSqlResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesExecuteSqlResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExecuteSqlResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 9: { + if (!(message.messages && message.messages.length)) + message.messages = []; + message.messages.push($root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.decode(reader, reader.uint32())); + break; + } + case 6: { + message.metadata = $root.google.cloud.sql.v1beta4.Metadata.decode(reader, reader.uint32()); + break; + } + case 7: { + if (!(message.results && message.results.length)) + message.results = []; + message.results.push($root.google.cloud.sql.v1beta4.QueryResult.decode(reader, reader.uint32())); + break; + } + case 8: { + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesExecuteSqlResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesExecuteSqlResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesExecuteSqlResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messages != null && message.hasOwnProperty("messages")) { + if (!Array.isArray(message.messages)) + return "messages: array expected"; + for (var i = 0; i < message.messages.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.verify(message.messages[i]); + if (error) + return "messages." + error; + } + } + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.cloud.sql.v1beta4.Metadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.results != null && message.hasOwnProperty("results")) { + if (!Array.isArray(message.results)) + return "results: array expected"; + for (var i = 0; i < message.results.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.QueryResult.verify(message.results[i]); + if (error) + return "results." + error; + } + } + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.rpc.Status.verify(message.status); + if (error) + return "status." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesExecuteSqlResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse + */ + SqlInstancesExecuteSqlResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse(); + if (object.messages) { + if (!Array.isArray(object.messages)) + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.messages: array expected"); + message.messages = []; + for (var i = 0; i < object.messages.length; ++i) { + if (typeof object.messages[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.messages: object expected"); + message.messages[i] = $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.fromObject(object.messages[i]); + } + } + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.metadata: object expected"); + message.metadata = $root.google.cloud.sql.v1beta4.Metadata.fromObject(object.metadata); + } + if (object.results) { + if (!Array.isArray(object.results)) + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.results: array expected"); + message.results = []; + for (var i = 0; i < object.results.length; ++i) { + if (typeof object.results[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.results: object expected"); + message.results[i] = $root.google.cloud.sql.v1beta4.QueryResult.fromObject(object.results[i]); + } + } + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.status: object expected"); + message.status = $root.google.rpc.Status.fromObject(object.status); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesExecuteSqlResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesExecuteSqlResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.results = []; + object.messages = []; + } + if (options.defaults) { + object.metadata = null; + object.status = null; + } + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.cloud.sql.v1beta4.Metadata.toObject(message.metadata, options); + if (message.results && message.results.length) { + object.results = []; + for (var j = 0; j < message.results.length; ++j) + object.results[j] = $root.google.cloud.sql.v1beta4.QueryResult.toObject(message.results[j], options); + } + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.rpc.Status.toObject(message.status, options); + if (message.messages && message.messages.length) { + object.messages = []; + for (var j = 0; j < message.messages.length; ++j) + object.messages[j] = $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.toObject(message.messages[j], options); + } + return object; + }; + + /** + * Converts this SqlInstancesExecuteSqlResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesExecuteSqlResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesExecuteSqlResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesExecuteSqlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse"; + }; + + SqlInstancesExecuteSqlResponse.Message = (function() { + + /** + * Properties of a Message. + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @interface IMessage + * @property {string|null} [message] Message message + * @property {string|null} [severity] Message severity + */ + + /** + * Constructs a new Message. + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse + * @classdesc Represents a Message. + * @implements IMessage + * @constructor + * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage=} [properties] Properties to set + */ + function Message(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Message message. + * @member {string|null|undefined} message + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @instance + */ + Message.prototype.message = null; + + /** + * Message severity. + * @member {string|null|undefined} severity + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @instance + */ + Message.prototype.severity = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Message.prototype, "_message", { + get: $util.oneOfGetter($oneOfFields = ["message"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Message.prototype, "_severity", { + get: $util.oneOfGetter($oneOfFields = ["severity"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Message instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message} Message instance + */ + Message.create = function create(properties) { + return new Message(properties); + }; + + /** + * Encodes the specified Message message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.severity); + return writer; + }; + + /** + * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage} message Message message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Message.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Message message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.message = reader.string(); + break; + } + case 2: { + message.severity = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Message message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message} Message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Message.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Message message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Message.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.message != null && message.hasOwnProperty("message")) { + properties._message = 1; + if (!$util.isString(message.message)) + return "message: string expected"; + } + if (message.severity != null && message.hasOwnProperty("severity")) { + properties._severity = 1; + if (!$util.isString(message.severity)) + return "severity: string expected"; + } + return null; + }; + + /** + * Creates a Message message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message} Message + */ + Message.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message(); + if (object.message != null) + message.message = String(object.message); + if (object.severity != null) + message.severity = String(object.severity); + return message; + }; + + /** + * Creates a plain object from a Message message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message} message Message + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Message.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.message != null && message.hasOwnProperty("message")) { + object.message = message.message; + if (options.oneofs) + object._message = "message"; + } + if (message.severity != null && message.hasOwnProperty("severity")) { + object.severity = message.severity; + if (options.oneofs) + object._severity = "severity"; + } + return object; + }; + + /** + * Converts this Message to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @instance + * @returns {Object.} JSON object + */ + Message.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Message + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Message.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message"; + }; + + return Message; + })(); + + return SqlInstancesExecuteSqlResponse; + })(); + + v1beta4.QueryResult = (function() { + + /** + * Properties of a QueryResult. + * @memberof google.cloud.sql.v1beta4 + * @interface IQueryResult + * @property {Array.|null} [columns] QueryResult columns + * @property {Array.|null} [rows] QueryResult rows + * @property {string|null} [message] QueryResult message + * @property {boolean|null} [partialResult] QueryResult partialResult + * @property {google.rpc.IStatus|null} [status] QueryResult status + */ + + /** + * Constructs a new QueryResult. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a QueryResult. + * @implements IQueryResult + * @constructor + * @param {google.cloud.sql.v1beta4.IQueryResult=} [properties] Properties to set + */ + function QueryResult(properties) { + this.columns = []; + this.rows = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * QueryResult columns. + * @member {Array.} columns + * @memberof google.cloud.sql.v1beta4.QueryResult + * @instance + */ + QueryResult.prototype.columns = $util.emptyArray; + + /** + * QueryResult rows. + * @member {Array.} rows + * @memberof google.cloud.sql.v1beta4.QueryResult + * @instance + */ + QueryResult.prototype.rows = $util.emptyArray; + + /** + * QueryResult message. + * @member {string} message + * @memberof google.cloud.sql.v1beta4.QueryResult + * @instance + */ + QueryResult.prototype.message = ""; + + /** + * QueryResult partialResult. + * @member {boolean} partialResult + * @memberof google.cloud.sql.v1beta4.QueryResult + * @instance + */ + QueryResult.prototype.partialResult = false; + + /** + * QueryResult status. + * @member {google.rpc.IStatus|null|undefined} status + * @memberof google.cloud.sql.v1beta4.QueryResult + * @instance + */ + QueryResult.prototype.status = null; + + /** + * Creates a new QueryResult instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.QueryResult + * @static + * @param {google.cloud.sql.v1beta4.IQueryResult=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.QueryResult} QueryResult instance + */ + QueryResult.create = function create(properties) { + return new QueryResult(properties); + }; + + /** + * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.sql.v1beta4.QueryResult.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.QueryResult + * @static + * @param {google.cloud.sql.v1beta4.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.columns != null && message.columns.length) + for (var i = 0; i < message.columns.length; ++i) + $root.google.cloud.sql.v1beta4.Column.encode(message.columns[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.rows != null && message.rows.length) + for (var i = 0; i < message.rows.length; ++i) + $root.google.cloud.sql.v1beta4.Row.encode(message.rows[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + if (message.partialResult != null && Object.hasOwnProperty.call(message, "partialResult")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.partialResult); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.QueryResult.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.QueryResult + * @static + * @param {google.cloud.sql.v1beta4.IQueryResult} message QueryResult message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + QueryResult.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.QueryResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.QueryResult(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.columns && message.columns.length)) + message.columns = []; + message.columns.push($root.google.cloud.sql.v1beta4.Column.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.rows && message.rows.length)) + message.rows = []; + message.rows.push($root.google.cloud.sql.v1beta4.Row.decode(reader, reader.uint32())); + break; + } + case 3: { + message.message = reader.string(); + break; + } + case 4: { + message.partialResult = reader.bool(); + break; + } + case 8: { + message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a QueryResult message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.QueryResult + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.QueryResult} QueryResult + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + QueryResult.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a QueryResult message. + * @function verify + * @memberof google.cloud.sql.v1beta4.QueryResult + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + QueryResult.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.columns != null && message.hasOwnProperty("columns")) { + if (!Array.isArray(message.columns)) + return "columns: array expected"; + for (var i = 0; i < message.columns.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.Column.verify(message.columns[i]); + if (error) + return "columns." + error; + } + } + if (message.rows != null && message.hasOwnProperty("rows")) { + if (!Array.isArray(message.rows)) + return "rows: array expected"; + for (var i = 0; i < message.rows.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.Row.verify(message.rows[i]); + if (error) + return "rows." + error; + } + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.partialResult != null && message.hasOwnProperty("partialResult")) + if (typeof message.partialResult !== "boolean") + return "partialResult: boolean expected"; + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.rpc.Status.verify(message.status); + if (error) + return "status." + error; + } + return null; + }; + + /** + * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.QueryResult + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.QueryResult} QueryResult + */ + QueryResult.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.QueryResult) + return object; + var message = new $root.google.cloud.sql.v1beta4.QueryResult(); + if (object.columns) { + if (!Array.isArray(object.columns)) + throw TypeError(".google.cloud.sql.v1beta4.QueryResult.columns: array expected"); + message.columns = []; + for (var i = 0; i < object.columns.length; ++i) { + if (typeof object.columns[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.QueryResult.columns: object expected"); + message.columns[i] = $root.google.cloud.sql.v1beta4.Column.fromObject(object.columns[i]); + } + } + if (object.rows) { + if (!Array.isArray(object.rows)) + throw TypeError(".google.cloud.sql.v1beta4.QueryResult.rows: array expected"); + message.rows = []; + for (var i = 0; i < object.rows.length; ++i) { + if (typeof object.rows[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.QueryResult.rows: object expected"); + message.rows[i] = $root.google.cloud.sql.v1beta4.Row.fromObject(object.rows[i]); + } + } + if (object.message != null) + message.message = String(object.message); + if (object.partialResult != null) + message.partialResult = Boolean(object.partialResult); + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.cloud.sql.v1beta4.QueryResult.status: object expected"); + message.status = $root.google.rpc.Status.fromObject(object.status); + } + return message; + }; + + /** + * Creates a plain object from a QueryResult message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.QueryResult + * @static + * @param {google.cloud.sql.v1beta4.QueryResult} message QueryResult + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + QueryResult.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.columns = []; + object.rows = []; + } + if (options.defaults) { + object.message = ""; + object.partialResult = false; + object.status = null; + } + if (message.columns && message.columns.length) { + object.columns = []; + for (var j = 0; j < message.columns.length; ++j) + object.columns[j] = $root.google.cloud.sql.v1beta4.Column.toObject(message.columns[j], options); + } + if (message.rows && message.rows.length) { + object.rows = []; + for (var j = 0; j < message.rows.length; ++j) + object.rows[j] = $root.google.cloud.sql.v1beta4.Row.toObject(message.rows[j], options); + } + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.partialResult != null && message.hasOwnProperty("partialResult")) + object.partialResult = message.partialResult; + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.rpc.Status.toObject(message.status, options); + return object; + }; + + /** + * Converts this QueryResult to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.QueryResult + * @instance + * @returns {Object.} JSON object + */ + QueryResult.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for QueryResult + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.QueryResult + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + QueryResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.QueryResult"; + }; + + return QueryResult; + })(); + + v1beta4.Column = (function() { + + /** + * Properties of a Column. + * @memberof google.cloud.sql.v1beta4 + * @interface IColumn + * @property {string|null} [name] Column name + * @property {string|null} [type] Column type + */ + + /** + * Constructs a new Column. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a Column. + * @implements IColumn + * @constructor + * @param {google.cloud.sql.v1beta4.IColumn=} [properties] Properties to set + */ + function Column(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Column name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.Column + * @instance + */ + Column.prototype.name = ""; + + /** + * Column type. + * @member {string} type + * @memberof google.cloud.sql.v1beta4.Column + * @instance + */ + Column.prototype.type = ""; + + /** + * Creates a new Column instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.Column + * @static + * @param {google.cloud.sql.v1beta4.IColumn=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.Column} Column instance + */ + Column.create = function create(properties) { + return new Column(properties); + }; + + /** + * Encodes the specified Column message. Does not implicitly {@link google.cloud.sql.v1beta4.Column.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.Column + * @static + * @param {google.cloud.sql.v1beta4.IColumn} message Column message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Column.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); + return writer; + }; + + /** + * Encodes the specified Column message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Column.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.Column + * @static + * @param {google.cloud.sql.v1beta4.IColumn} message Column message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Column.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Column message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.Column + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.Column} Column + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Column.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Column(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Column message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.Column + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.Column} Column + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Column.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Column message. + * @function verify + * @memberof google.cloud.sql.v1beta4.Column + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Column.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + return null; + }; + + /** + * Creates a Column message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.Column + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.Column} Column + */ + Column.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.Column) + return object; + var message = new $root.google.cloud.sql.v1beta4.Column(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + return message; + }; + + /** + * Creates a plain object from a Column message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.Column + * @static + * @param {google.cloud.sql.v1beta4.Column} message Column + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Column.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.type = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + return object; + }; + + /** + * Converts this Column to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.Column + * @instance + * @returns {Object.} JSON object + */ + Column.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Column + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.Column + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Column.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.Column"; + }; + + return Column; + })(); + + v1beta4.Row = (function() { + + /** + * Properties of a Row. + * @memberof google.cloud.sql.v1beta4 + * @interface IRow + * @property {Array.|null} [values] Row values + */ + + /** + * Constructs a new Row. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a Row. + * @implements IRow + * @constructor + * @param {google.cloud.sql.v1beta4.IRow=} [properties] Properties to set + */ + function Row(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Row values. + * @member {Array.} values + * @memberof google.cloud.sql.v1beta4.Row + * @instance + */ + Row.prototype.values = $util.emptyArray; + + /** + * Creates a new Row instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.Row + * @static + * @param {google.cloud.sql.v1beta4.IRow=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.Row} Row instance + */ + Row.create = function create(properties) { + return new Row(properties); + }; + + /** + * Encodes the specified Row message. Does not implicitly {@link google.cloud.sql.v1beta4.Row.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.Row + * @static + * @param {google.cloud.sql.v1beta4.IRow} message Row message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Row.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.cloud.sql.v1beta4.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Row message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Row.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.Row + * @static + * @param {google.cloud.sql.v1beta4.IRow} message Row message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Row.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Row message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.Row + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.Row} Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Row.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Row(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.cloud.sql.v1beta4.Value.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Row message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.Row + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.Row} Row + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Row.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Row message. + * @function verify + * @memberof google.cloud.sql.v1beta4.Row + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Row.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.Value.verify(message.values[i]); + if (error) + return "values." + error; + } + } + return null; + }; + + /** + * Creates a Row message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.Row + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.Row} Row + */ + Row.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.Row) + return object; + var message = new $root.google.cloud.sql.v1beta4.Row(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.cloud.sql.v1beta4.Row.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Row.values: object expected"); + message.values[i] = $root.google.cloud.sql.v1beta4.Value.fromObject(object.values[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Row message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.Row + * @static + * @param {google.cloud.sql.v1beta4.Row} message Row + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Row.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.cloud.sql.v1beta4.Value.toObject(message.values[j], options); + } + return object; + }; + + /** + * Converts this Row to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.Row + * @instance + * @returns {Object.} JSON object + */ + Row.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Row + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.Row + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Row.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.Row"; + }; + + return Row; + })(); + + v1beta4.Value = (function() { + + /** + * Properties of a Value. + * @memberof google.cloud.sql.v1beta4 + * @interface IValue + * @property {string|null} [value] Value value + * @property {boolean|null} [nullValue] Value nullValue + */ + + /** + * Constructs a new Value. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a Value. + * @implements IValue + * @constructor + * @param {google.cloud.sql.v1beta4.IValue=} [properties] Properties to set + */ + function Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Value value. + * @member {string} value + * @memberof google.cloud.sql.v1beta4.Value + * @instance + */ + Value.prototype.value = ""; + + /** + * Value nullValue. + * @member {boolean} nullValue + * @memberof google.cloud.sql.v1beta4.Value + * @instance + */ + Value.prototype.nullValue = false; + + /** + * Creates a new Value instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.Value + * @static + * @param {google.cloud.sql.v1beta4.IValue=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.Value} Value instance + */ + Value.create = function create(properties) { + return new Value(properties); + }; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.cloud.sql.v1beta4.Value.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.Value + * @static + * @param {google.cloud.sql.v1beta4.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.nullValue); + return writer; + }; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.Value + * @static + * @param {google.cloud.sql.v1beta4.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Value message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + case 2: { + message.nullValue = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Value message. + * @function verify + * @memberof google.cloud.sql.v1beta4.Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) + if (typeof message.nullValue !== "boolean") + return "nullValue: boolean expected"; + return null; + }; + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.Value + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.Value} Value + */ + Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.Value) + return object; + var message = new $root.google.cloud.sql.v1beta4.Value(); + if (object.value != null) + message.value = String(object.value); + if (object.nullValue != null) + message.nullValue = Boolean(object.nullValue); + return message; + }; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.Value + * @static + * @param {google.cloud.sql.v1beta4.Value} message Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.nullValue = false; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) + object.nullValue = message.nullValue; + return object; + }; + + /** + * Converts this Value to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.Value + * @instance + * @returns {Object.} JSON object + */ + Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Value + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.Value"; + }; + + return Value; + })(); + + v1beta4.Metadata = (function() { + + /** + * Properties of a Metadata. + * @memberof google.cloud.sql.v1beta4 + * @interface IMetadata + * @property {google.protobuf.IDuration|null} [sqlStatementExecutionTime] Metadata sqlStatementExecutionTime + */ + + /** + * Constructs a new Metadata. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a Metadata. + * @implements IMetadata + * @constructor + * @param {google.cloud.sql.v1beta4.IMetadata=} [properties] Properties to set + */ + function Metadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Metadata sqlStatementExecutionTime. + * @member {google.protobuf.IDuration|null|undefined} sqlStatementExecutionTime + * @memberof google.cloud.sql.v1beta4.Metadata + * @instance + */ + Metadata.prototype.sqlStatementExecutionTime = null; + + /** + * Creates a new Metadata instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.Metadata + * @static + * @param {google.cloud.sql.v1beta4.IMetadata=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.Metadata} Metadata instance + */ + Metadata.create = function create(properties) { + return new Metadata(properties); + }; + + /** + * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.sql.v1beta4.Metadata.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.Metadata + * @static + * @param {google.cloud.sql.v1beta4.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sqlStatementExecutionTime != null && Object.hasOwnProperty.call(message, "sqlStatementExecutionTime")) + $root.google.protobuf.Duration.encode(message.sqlStatementExecutionTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Metadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.Metadata + * @static + * @param {google.cloud.sql.v1beta4.IMetadata} message Metadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metadata message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Metadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.sqlStatementExecutionTime = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Metadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.Metadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.Metadata} Metadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Metadata message. + * @function verify + * @memberof google.cloud.sql.v1beta4.Metadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sqlStatementExecutionTime != null && message.hasOwnProperty("sqlStatementExecutionTime")) { + var error = $root.google.protobuf.Duration.verify(message.sqlStatementExecutionTime); + if (error) + return "sqlStatementExecutionTime." + error; + } + return null; + }; + + /** + * Creates a Metadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.Metadata + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.Metadata} Metadata + */ + Metadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.Metadata) + return object; + var message = new $root.google.cloud.sql.v1beta4.Metadata(); + if (object.sqlStatementExecutionTime != null) { + if (typeof object.sqlStatementExecutionTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Metadata.sqlStatementExecutionTime: object expected"); + message.sqlStatementExecutionTime = $root.google.protobuf.Duration.fromObject(object.sqlStatementExecutionTime); + } + return message; + }; + + /** + * Creates a plain object from a Metadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.Metadata + * @static + * @param {google.cloud.sql.v1beta4.Metadata} message Metadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.sqlStatementExecutionTime = null; + if (message.sqlStatementExecutionTime != null && message.hasOwnProperty("sqlStatementExecutionTime")) + object.sqlStatementExecutionTime = $root.google.protobuf.Duration.toObject(message.sqlStatementExecutionTime, options); + return object; + }; + + /** + * Converts this Metadata to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.Metadata + * @instance + * @returns {Object.} JSON object + */ + Metadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Metadata + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.Metadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Metadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.Metadata"; + }; + + return Metadata; + })(); + + v1beta4.SqlInstancesAcquireSsrsLeaseRequest = (function() { + + /** + * Properties of a SqlInstancesAcquireSsrsLeaseRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesAcquireSsrsLeaseRequest + * @property {string|null} [instance] SqlInstancesAcquireSsrsLeaseRequest instance + * @property {string|null} [project] SqlInstancesAcquireSsrsLeaseRequest project + * @property {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest|null} [body] SqlInstancesAcquireSsrsLeaseRequest body + */ + + /** + * Constructs a new SqlInstancesAcquireSsrsLeaseRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesAcquireSsrsLeaseRequest. + * @implements ISqlInstancesAcquireSsrsLeaseRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set + */ + function SqlInstancesAcquireSsrsLeaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesAcquireSsrsLeaseRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @instance + */ + SqlInstancesAcquireSsrsLeaseRequest.prototype.instance = ""; + + /** + * SqlInstancesAcquireSsrsLeaseRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @instance + */ + SqlInstancesAcquireSsrsLeaseRequest.prototype.project = ""; + + /** + * SqlInstancesAcquireSsrsLeaseRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @instance + */ + SqlInstancesAcquireSsrsLeaseRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesAcquireSsrsLeaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest instance + */ + SqlInstancesAcquireSsrsLeaseRequest.create = function create(properties) { + return new SqlInstancesAcquireSsrsLeaseRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAcquireSsrsLeaseRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAcquireSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAcquireSsrsLeaseRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAcquireSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesAcquireSsrsLeaseRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesAcquireSsrsLeaseRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest + */ + SqlInstancesAcquireSsrsLeaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesAcquireSsrsLeaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesAcquireSsrsLeaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesAcquireSsrsLeaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesAcquireSsrsLeaseRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesAcquireSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest"; + }; + + return SqlInstancesAcquireSsrsLeaseRequest; + })(); + + v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest = (function() { + + /** + * Properties of a SqlInstancesPreCheckMajorVersionUpgradeRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesPreCheckMajorVersionUpgradeRequest + * @property {string|null} [instance] SqlInstancesPreCheckMajorVersionUpgradeRequest instance + * @property {string|null} [project] SqlInstancesPreCheckMajorVersionUpgradeRequest project + * @property {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest|null} [body] SqlInstancesPreCheckMajorVersionUpgradeRequest body + */ + + /** + * Constructs a new SqlInstancesPreCheckMajorVersionUpgradeRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesPreCheckMajorVersionUpgradeRequest. + * @implements ISqlInstancesPreCheckMajorVersionUpgradeRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set + */ + function SqlInstancesPreCheckMajorVersionUpgradeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesPreCheckMajorVersionUpgradeRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @instance + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.instance = ""; + + /** + * SqlInstancesPreCheckMajorVersionUpgradeRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @instance + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.project = ""; + + /** + * SqlInstancesPreCheckMajorVersionUpgradeRequest body. + * @member {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @instance + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.body = null; + + /** + * Creates a new SqlInstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest instance + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.create = function create(properties) { + return new SqlInstancesPreCheckMajorVersionUpgradeRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.encode(message.body, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.body = $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesPreCheckMajorVersionUpgradeRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlInstancesPreCheckMajorVersionUpgradeRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesPreCheckMajorVersionUpgradeRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesPreCheckMajorVersionUpgradeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest"; + }; + + return SqlInstancesPreCheckMajorVersionUpgradeRequest; + })(); + + v1beta4.SqlInstancesAcquireSsrsLeaseResponse = (function() { + + /** + * Properties of a SqlInstancesAcquireSsrsLeaseResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesAcquireSsrsLeaseResponse + * @property {string|null} [operationId] SqlInstancesAcquireSsrsLeaseResponse operationId + */ + + /** + * Constructs a new SqlInstancesAcquireSsrsLeaseResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesAcquireSsrsLeaseResponse. + * @implements ISqlInstancesAcquireSsrsLeaseResponse + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse=} [properties] Properties to set + */ + function SqlInstancesAcquireSsrsLeaseResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesAcquireSsrsLeaseResponse operationId. + * @member {string|null|undefined} operationId + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @instance + */ + SqlInstancesAcquireSsrsLeaseResponse.prototype.operationId = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlInstancesAcquireSsrsLeaseResponse.prototype, "_operationId", { + get: $util.oneOfGetter($oneOfFields = ["operationId"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlInstancesAcquireSsrsLeaseResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse instance + */ + SqlInstancesAcquireSsrsLeaseResponse.create = function create(properties) { + return new SqlInstancesAcquireSsrsLeaseResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAcquireSsrsLeaseResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operationId != null && Object.hasOwnProperty.call(message, "operationId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.operationId); + return writer; + }; + + /** + * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesAcquireSsrsLeaseResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAcquireSsrsLeaseResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.operationId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesAcquireSsrsLeaseResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesAcquireSsrsLeaseResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesAcquireSsrsLeaseResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.operationId != null && message.hasOwnProperty("operationId")) { + properties._operationId = 1; + if (!$util.isString(message.operationId)) + return "operationId: string expected"; + } + return null; + }; + + /** + * Creates a SqlInstancesAcquireSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse + */ + SqlInstancesAcquireSsrsLeaseResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse(); + if (object.operationId != null) + message.operationId = String(object.operationId); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesAcquireSsrsLeaseResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesAcquireSsrsLeaseResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.operationId != null && message.hasOwnProperty("operationId")) { + object.operationId = message.operationId; + if (options.oneofs) + object._operationId = "operationId"; + } + return object; + }; + + /** + * Converts this SqlInstancesAcquireSsrsLeaseResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesAcquireSsrsLeaseResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesAcquireSsrsLeaseResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesAcquireSsrsLeaseResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse"; + }; + + return SqlInstancesAcquireSsrsLeaseResponse; + })(); + + v1beta4.SqlInstancesPointInTimeRestoreRequest = (function() { + + /** + * Properties of a SqlInstancesPointInTimeRestoreRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesPointInTimeRestoreRequest + * @property {string|null} [parent] SqlInstancesPointInTimeRestoreRequest parent + * @property {google.cloud.sql.v1beta4.IPointInTimeRestoreContext|null} [context] SqlInstancesPointInTimeRestoreRequest context + */ + + /** + * Constructs a new SqlInstancesPointInTimeRestoreRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesPointInTimeRestoreRequest. + * @implements ISqlInstancesPointInTimeRestoreRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest=} [properties] Properties to set + */ + function SqlInstancesPointInTimeRestoreRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesPointInTimeRestoreRequest parent. + * @member {string} parent + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @instance + */ + SqlInstancesPointInTimeRestoreRequest.prototype.parent = ""; + + /** + * SqlInstancesPointInTimeRestoreRequest context. + * @member {google.cloud.sql.v1beta4.IPointInTimeRestoreContext|null|undefined} context + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @instance + */ + SqlInstancesPointInTimeRestoreRequest.prototype.context = null; + + /** + * Creates a new SqlInstancesPointInTimeRestoreRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest instance + */ + SqlInstancesPointInTimeRestoreRequest.create = function create(properties) { + return new SqlInstancesPointInTimeRestoreRequest(properties); + }; + + /** + * Encodes the specified SqlInstancesPointInTimeRestoreRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPointInTimeRestoreRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.context != null && Object.hasOwnProperty.call(message, "context")) + $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext.encode(message.context, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesPointInTimeRestoreRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesPointInTimeRestoreRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPointInTimeRestoreRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 100: { + message.context = $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesPointInTimeRestoreRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesPointInTimeRestoreRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesPointInTimeRestoreRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.context != null && message.hasOwnProperty("context")) { + var error = $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext.verify(message.context); + if (error) + return "context." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesPointInTimeRestoreRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest + */ + SqlInstancesPointInTimeRestoreRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.context != null) { + if (typeof object.context !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest.context: object expected"); + message.context = $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext.fromObject(object.context); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesPointInTimeRestoreRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesPointInTimeRestoreRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.context = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.context != null && message.hasOwnProperty("context")) + object.context = $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext.toObject(message.context, options); + return object; + }; + + /** + * Converts this SqlInstancesPointInTimeRestoreRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesPointInTimeRestoreRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesPointInTimeRestoreRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesPointInTimeRestoreRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest"; + }; + + return SqlInstancesPointInTimeRestoreRequest; + })(); + + v1beta4.AclEntry = (function() { + + /** + * Properties of an AclEntry. + * @memberof google.cloud.sql.v1beta4 + * @interface IAclEntry + * @property {string|null} [value] AclEntry value + * @property {google.protobuf.ITimestamp|null} [expirationTime] AclEntry expirationTime + * @property {string|null} [name] AclEntry name + * @property {string|null} [kind] AclEntry kind + */ + + /** + * Constructs a new AclEntry. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an AclEntry. + * @implements IAclEntry + * @constructor + * @param {google.cloud.sql.v1beta4.IAclEntry=} [properties] Properties to set + */ + function AclEntry(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AclEntry value. + * @member {string} value + * @memberof google.cloud.sql.v1beta4.AclEntry + * @instance + */ + AclEntry.prototype.value = ""; + + /** + * AclEntry expirationTime. + * @member {google.protobuf.ITimestamp|null|undefined} expirationTime + * @memberof google.cloud.sql.v1beta4.AclEntry + * @instance + */ + AclEntry.prototype.expirationTime = null; + + /** + * AclEntry name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.AclEntry + * @instance + */ + AclEntry.prototype.name = ""; + + /** + * AclEntry kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.AclEntry + * @instance + */ + AclEntry.prototype.kind = ""; + + /** + * Creates a new AclEntry instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.AclEntry + * @static + * @param {google.cloud.sql.v1beta4.IAclEntry=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.AclEntry} AclEntry instance + */ + AclEntry.create = function create(properties) { + return new AclEntry(properties); + }; + + /** + * Encodes the specified AclEntry message. Does not implicitly {@link google.cloud.sql.v1beta4.AclEntry.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.AclEntry + * @static + * @param {google.cloud.sql.v1beta4.IAclEntry} message AclEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AclEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + if (message.expirationTime != null && Object.hasOwnProperty.call(message, "expirationTime")) + $root.google.protobuf.Timestamp.encode(message.expirationTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); + return writer; + }; + + /** + * Encodes the specified AclEntry message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AclEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.AclEntry + * @static + * @param {google.cloud.sql.v1beta4.IAclEntry} message AclEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AclEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AclEntry message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.AclEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.AclEntry} AclEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AclEntry.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.AclEntry(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + case 2: { + message.expirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.name = reader.string(); + break; + } + case 4: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AclEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.AclEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.AclEntry} AclEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AclEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AclEntry message. + * @function verify + * @memberof google.cloud.sql.v1beta4.AclEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AclEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expirationTime); + if (error) + return "expirationTime." + error; + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates an AclEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.AclEntry + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.AclEntry} AclEntry + */ + AclEntry.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.AclEntry) + return object; + var message = new $root.google.cloud.sql.v1beta4.AclEntry(); + if (object.value != null) + message.value = String(object.value); + if (object.expirationTime != null) { + if (typeof object.expirationTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.AclEntry.expirationTime: object expected"); + message.expirationTime = $root.google.protobuf.Timestamp.fromObject(object.expirationTime); + } + if (object.name != null) + message.name = String(object.name); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from an AclEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.AclEntry + * @static + * @param {google.cloud.sql.v1beta4.AclEntry} message AclEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AclEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.expirationTime = null; + object.name = ""; + object.kind = ""; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) + object.expirationTime = $root.google.protobuf.Timestamp.toObject(message.expirationTime, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this AclEntry to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.AclEntry + * @instance + * @returns {Object.} JSON object + */ + AclEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AclEntry + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.AclEntry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AclEntry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.AclEntry"; + }; + + return AclEntry; + })(); + + v1beta4.ApiWarning = (function() { + + /** + * Properties of an ApiWarning. + * @memberof google.cloud.sql.v1beta4 + * @interface IApiWarning + * @property {google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode|null} [code] ApiWarning code + * @property {string|null} [message] ApiWarning message + * @property {string|null} [region] ApiWarning region + */ + + /** + * Constructs a new ApiWarning. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an ApiWarning. + * @implements IApiWarning + * @constructor + * @param {google.cloud.sql.v1beta4.IApiWarning=} [properties] Properties to set + */ + function ApiWarning(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ApiWarning code. + * @member {google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode} code + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @instance + */ + ApiWarning.prototype.code = 0; + + /** + * ApiWarning message. + * @member {string} message + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @instance + */ + ApiWarning.prototype.message = ""; + + /** + * ApiWarning region. + * @member {string} region + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @instance + */ + ApiWarning.prototype.region = ""; + + /** + * Creates a new ApiWarning instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @static + * @param {google.cloud.sql.v1beta4.IApiWarning=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ApiWarning} ApiWarning instance + */ + ApiWarning.create = function create(properties) { + return new ApiWarning(properties); + }; + + /** + * Encodes the specified ApiWarning message. Does not implicitly {@link google.cloud.sql.v1beta4.ApiWarning.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @static + * @param {google.cloud.sql.v1beta4.IApiWarning} message ApiWarning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ApiWarning.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.region); + return writer; + }; + + /** + * Encodes the specified ApiWarning message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ApiWarning.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @static + * @param {google.cloud.sql.v1beta4.IApiWarning} message ApiWarning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ApiWarning.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ApiWarning message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ApiWarning} ApiWarning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ApiWarning.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ApiWarning(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.code = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + message.region = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ApiWarning message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ApiWarning} ApiWarning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ApiWarning.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ApiWarning message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ApiWarning.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + switch (message.code) { + default: + return "code: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.region != null && message.hasOwnProperty("region")) + if (!$util.isString(message.region)) + return "region: string expected"; + return null; + }; + + /** + * Creates an ApiWarning message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ApiWarning} ApiWarning + */ + ApiWarning.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ApiWarning) + return object; + var message = new $root.google.cloud.sql.v1beta4.ApiWarning(); + switch (object.code) { + default: + if (typeof object.code === "number") { + message.code = object.code; + break; + } + break; + case "SQL_API_WARNING_CODE_UNSPECIFIED": + case 0: + message.code = 0; + break; + case "REGION_UNREACHABLE": + case 1: + message.code = 1; + break; + case "MAX_RESULTS_EXCEEDS_LIMIT": + case 2: + message.code = 2; + break; + case "COMPROMISED_CREDENTIALS": + case 3: + message.code = 3; + break; + case "INTERNAL_STATE_FAILURE": + case 4: + message.code = 4; + break; + } + if (object.message != null) + message.message = String(object.message); + if (object.region != null) + message.region = String(object.region); + return message; + }; + + /** + * Creates a plain object from an ApiWarning message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @static + * @param {google.cloud.sql.v1beta4.ApiWarning} message ApiWarning + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ApiWarning.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.code = options.enums === String ? "SQL_API_WARNING_CODE_UNSPECIFIED" : 0; + object.message = ""; + object.region = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = options.enums === String ? $root.google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode[message.code] === undefined ? message.code : $root.google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode[message.code] : message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.region != null && message.hasOwnProperty("region")) + object.region = message.region; + return object; + }; + + /** + * Converts this ApiWarning to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @instance + * @returns {Object.} JSON object + */ + ApiWarning.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ApiWarning + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ApiWarning + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ApiWarning.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ApiWarning"; + }; + + /** + * SqlApiWarningCode enum. + * @name google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode + * @enum {number} + * @property {number} SQL_API_WARNING_CODE_UNSPECIFIED=0 SQL_API_WARNING_CODE_UNSPECIFIED value + * @property {number} REGION_UNREACHABLE=1 REGION_UNREACHABLE value + * @property {number} MAX_RESULTS_EXCEEDS_LIMIT=2 MAX_RESULTS_EXCEEDS_LIMIT value + * @property {number} COMPROMISED_CREDENTIALS=3 COMPROMISED_CREDENTIALS value + * @property {number} INTERNAL_STATE_FAILURE=4 INTERNAL_STATE_FAILURE value + */ + ApiWarning.SqlApiWarningCode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_API_WARNING_CODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "REGION_UNREACHABLE"] = 1; + values[valuesById[2] = "MAX_RESULTS_EXCEEDS_LIMIT"] = 2; + values[valuesById[3] = "COMPROMISED_CREDENTIALS"] = 3; + values[valuesById[4] = "INTERNAL_STATE_FAILURE"] = 4; + return values; + })(); + + return ApiWarning; + })(); + + v1beta4.BackupRetentionSettings = (function() { + + /** + * Properties of a BackupRetentionSettings. + * @memberof google.cloud.sql.v1beta4 + * @interface IBackupRetentionSettings + * @property {google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit|null} [retentionUnit] BackupRetentionSettings retentionUnit + * @property {google.protobuf.IInt32Value|null} [retainedBackups] BackupRetentionSettings retainedBackups + */ + + /** + * Constructs a new BackupRetentionSettings. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a BackupRetentionSettings. + * @implements IBackupRetentionSettings + * @constructor + * @param {google.cloud.sql.v1beta4.IBackupRetentionSettings=} [properties] Properties to set + */ + function BackupRetentionSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupRetentionSettings retentionUnit. + * @member {google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit} retentionUnit + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @instance + */ + BackupRetentionSettings.prototype.retentionUnit = 0; + + /** + * BackupRetentionSettings retainedBackups. + * @member {google.protobuf.IInt32Value|null|undefined} retainedBackups + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @instance + */ + BackupRetentionSettings.prototype.retainedBackups = null; + + /** + * Creates a new BackupRetentionSettings instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @static + * @param {google.cloud.sql.v1beta4.IBackupRetentionSettings=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.BackupRetentionSettings} BackupRetentionSettings instance + */ + BackupRetentionSettings.create = function create(properties) { + return new BackupRetentionSettings(properties); + }; + + /** + * Encodes the specified BackupRetentionSettings message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRetentionSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @static + * @param {google.cloud.sql.v1beta4.IBackupRetentionSettings} message BackupRetentionSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRetentionSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.retentionUnit != null && Object.hasOwnProperty.call(message, "retentionUnit")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.retentionUnit); + if (message.retainedBackups != null && Object.hasOwnProperty.call(message, "retainedBackups")) + $root.google.protobuf.Int32Value.encode(message.retainedBackups, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BackupRetentionSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRetentionSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @static + * @param {google.cloud.sql.v1beta4.IBackupRetentionSettings} message BackupRetentionSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRetentionSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupRetentionSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.BackupRetentionSettings} BackupRetentionSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRetentionSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupRetentionSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.retentionUnit = reader.int32(); + break; + } + case 2: { + message.retainedBackups = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupRetentionSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.BackupRetentionSettings} BackupRetentionSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRetentionSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupRetentionSettings message. + * @function verify + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupRetentionSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.retentionUnit != null && message.hasOwnProperty("retentionUnit")) + switch (message.retentionUnit) { + default: + return "retentionUnit: enum value expected"; + case 0: + case 1: + break; + } + if (message.retainedBackups != null && message.hasOwnProperty("retainedBackups")) { + var error = $root.google.protobuf.Int32Value.verify(message.retainedBackups); + if (error) + return "retainedBackups." + error; + } + return null; + }; + + /** + * Creates a BackupRetentionSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.BackupRetentionSettings} BackupRetentionSettings + */ + BackupRetentionSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.BackupRetentionSettings) + return object; + var message = new $root.google.cloud.sql.v1beta4.BackupRetentionSettings(); + switch (object.retentionUnit) { + default: + if (typeof object.retentionUnit === "number") { + message.retentionUnit = object.retentionUnit; + break; + } + break; + case "RETENTION_UNIT_UNSPECIFIED": + case 0: + message.retentionUnit = 0; + break; + case "COUNT": + case 1: + message.retentionUnit = 1; + break; + } + if (object.retainedBackups != null) { + if (typeof object.retainedBackups !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupRetentionSettings.retainedBackups: object expected"); + message.retainedBackups = $root.google.protobuf.Int32Value.fromObject(object.retainedBackups); + } + return message; + }; + + /** + * Creates a plain object from a BackupRetentionSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @static + * @param {google.cloud.sql.v1beta4.BackupRetentionSettings} message BackupRetentionSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupRetentionSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.retentionUnit = options.enums === String ? "RETENTION_UNIT_UNSPECIFIED" : 0; + object.retainedBackups = null; + } + if (message.retentionUnit != null && message.hasOwnProperty("retentionUnit")) + object.retentionUnit = options.enums === String ? $root.google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit[message.retentionUnit] === undefined ? message.retentionUnit : $root.google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit[message.retentionUnit] : message.retentionUnit; + if (message.retainedBackups != null && message.hasOwnProperty("retainedBackups")) + object.retainedBackups = $root.google.protobuf.Int32Value.toObject(message.retainedBackups, options); + return object; + }; + + /** + * Converts this BackupRetentionSettings to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @instance + * @returns {Object.} JSON object + */ + BackupRetentionSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupRetentionSettings + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupRetentionSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupRetentionSettings"; + }; + + /** + * RetentionUnit enum. + * @name google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit + * @enum {number} + * @property {number} RETENTION_UNIT_UNSPECIFIED=0 RETENTION_UNIT_UNSPECIFIED value + * @property {number} COUNT=1 COUNT value + */ + BackupRetentionSettings.RetentionUnit = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETENTION_UNIT_UNSPECIFIED"] = 0; + values[valuesById[1] = "COUNT"] = 1; + return values; + })(); + + return BackupRetentionSettings; + })(); + + v1beta4.BackupConfiguration = (function() { + + /** + * Properties of a BackupConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @interface IBackupConfiguration + * @property {string|null} [startTime] BackupConfiguration startTime + * @property {google.protobuf.IBoolValue|null} [enabled] BackupConfiguration enabled + * @property {string|null} [kind] BackupConfiguration kind + * @property {google.protobuf.IBoolValue|null} [binaryLogEnabled] BackupConfiguration binaryLogEnabled + * @property {google.protobuf.IBoolValue|null} [replicationLogArchivingEnabled] BackupConfiguration replicationLogArchivingEnabled + * @property {string|null} [location] BackupConfiguration location + * @property {google.protobuf.IBoolValue|null} [pointInTimeRecoveryEnabled] BackupConfiguration pointInTimeRecoveryEnabled + * @property {google.protobuf.IInt32Value|null} [transactionLogRetentionDays] BackupConfiguration transactionLogRetentionDays + * @property {google.cloud.sql.v1beta4.IBackupRetentionSettings|null} [backupRetentionSettings] BackupConfiguration backupRetentionSettings + * @property {google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|null} [transactionalLogStorageState] BackupConfiguration transactionalLogStorageState + * @property {google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|null} [backupTier] BackupConfiguration backupTier + */ + + /** + * Constructs a new BackupConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a BackupConfiguration. + * @implements IBackupConfiguration + * @constructor + * @param {google.cloud.sql.v1beta4.IBackupConfiguration=} [properties] Properties to set + */ + function BackupConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupConfiguration startTime. + * @member {string} startTime + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.startTime = ""; + + /** + * BackupConfiguration enabled. + * @member {google.protobuf.IBoolValue|null|undefined} enabled + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.enabled = null; + + /** + * BackupConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.kind = ""; + + /** + * BackupConfiguration binaryLogEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} binaryLogEnabled + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.binaryLogEnabled = null; + + /** + * BackupConfiguration replicationLogArchivingEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} replicationLogArchivingEnabled + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.replicationLogArchivingEnabled = null; + + /** + * BackupConfiguration location. + * @member {string} location + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.location = ""; + + /** + * BackupConfiguration pointInTimeRecoveryEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} pointInTimeRecoveryEnabled + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.pointInTimeRecoveryEnabled = null; + + /** + * BackupConfiguration transactionLogRetentionDays. + * @member {google.protobuf.IInt32Value|null|undefined} transactionLogRetentionDays + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.transactionLogRetentionDays = null; + + /** + * BackupConfiguration backupRetentionSettings. + * @member {google.cloud.sql.v1beta4.IBackupRetentionSettings|null|undefined} backupRetentionSettings + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.backupRetentionSettings = null; + + /** + * BackupConfiguration transactionalLogStorageState. + * @member {google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|null|undefined} transactionalLogStorageState + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.transactionalLogStorageState = null; + + /** + * BackupConfiguration backupTier. + * @member {google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|null|undefined} backupTier + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + */ + BackupConfiguration.prototype.backupTier = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BackupConfiguration.prototype, "_transactionalLogStorageState", { + get: $util.oneOfGetter($oneOfFields = ["transactionalLogStorageState"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BackupConfiguration.prototype, "_backupTier", { + get: $util.oneOfGetter($oneOfFields = ["backupTier"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BackupConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IBackupConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.BackupConfiguration} BackupConfiguration instance + */ + BackupConfiguration.create = function create(properties) { + return new BackupConfiguration(properties); + }; + + /** + * Encodes the specified BackupConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IBackupConfiguration} message BackupConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.startTime); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + $root.google.protobuf.BoolValue.encode(message.enabled, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + if (message.binaryLogEnabled != null && Object.hasOwnProperty.call(message, "binaryLogEnabled")) + $root.google.protobuf.BoolValue.encode(message.binaryLogEnabled, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.replicationLogArchivingEnabled != null && Object.hasOwnProperty.call(message, "replicationLogArchivingEnabled")) + $root.google.protobuf.BoolValue.encode(message.replicationLogArchivingEnabled, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.location); + if (message.pointInTimeRecoveryEnabled != null && Object.hasOwnProperty.call(message, "pointInTimeRecoveryEnabled")) + $root.google.protobuf.BoolValue.encode(message.pointInTimeRecoveryEnabled, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.transactionLogRetentionDays != null && Object.hasOwnProperty.call(message, "transactionLogRetentionDays")) + $root.google.protobuf.Int32Value.encode(message.transactionLogRetentionDays, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.backupRetentionSettings != null && Object.hasOwnProperty.call(message, "backupRetentionSettings")) + $root.google.cloud.sql.v1beta4.BackupRetentionSettings.encode(message.backupRetentionSettings, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.transactionalLogStorageState != null && Object.hasOwnProperty.call(message, "transactionalLogStorageState")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.transactionalLogStorageState); + if (message.backupTier != null && Object.hasOwnProperty.call(message, "backupTier")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.backupTier); + return writer; + }; + + /** + * Encodes the specified BackupConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IBackupConfiguration} message BackupConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.BackupConfiguration} BackupConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = reader.string(); + break; + } + case 2: { + message.enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + case 4: { + message.binaryLogEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 5: { + message.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 6: { + message.location = reader.string(); + break; + } + case 7: { + message.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 9: { + message.transactionLogRetentionDays = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 10: { + message.backupRetentionSettings = $root.google.cloud.sql.v1beta4.BackupRetentionSettings.decode(reader, reader.uint32()); + break; + } + case 11: { + message.transactionalLogStorageState = reader.int32(); + break; + } + case 12: { + message.backupTier = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.BackupConfiguration} BackupConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.startTime != null && message.hasOwnProperty("startTime")) + if (!$util.isString(message.startTime)) + return "startTime: string expected"; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.enabled); + if (error) + return "enabled." + error; + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.binaryLogEnabled != null && message.hasOwnProperty("binaryLogEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.binaryLogEnabled); + if (error) + return "binaryLogEnabled." + error; + } + if (message.replicationLogArchivingEnabled != null && message.hasOwnProperty("replicationLogArchivingEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.replicationLogArchivingEnabled); + if (error) + return "replicationLogArchivingEnabled." + error; + } + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.pointInTimeRecoveryEnabled != null && message.hasOwnProperty("pointInTimeRecoveryEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.pointInTimeRecoveryEnabled); + if (error) + return "pointInTimeRecoveryEnabled." + error; + } + if (message.transactionLogRetentionDays != null && message.hasOwnProperty("transactionLogRetentionDays")) { + var error = $root.google.protobuf.Int32Value.verify(message.transactionLogRetentionDays); + if (error) + return "transactionLogRetentionDays." + error; + } + if (message.backupRetentionSettings != null && message.hasOwnProperty("backupRetentionSettings")) { + var error = $root.google.cloud.sql.v1beta4.BackupRetentionSettings.verify(message.backupRetentionSettings); + if (error) + return "backupRetentionSettings." + error; + } + if (message.transactionalLogStorageState != null && message.hasOwnProperty("transactionalLogStorageState")) { + properties._transactionalLogStorageState = 1; + switch (message.transactionalLogStorageState) { + default: + return "transactionalLogStorageState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + } + if (message.backupTier != null && message.hasOwnProperty("backupTier")) { + properties._backupTier = 1; + switch (message.backupTier) { + default: + return "backupTier: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } + return null; + }; + + /** + * Creates a BackupConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.BackupConfiguration} BackupConfiguration + */ + BackupConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.BackupConfiguration) + return object; + var message = new $root.google.cloud.sql.v1beta4.BackupConfiguration(); + if (object.startTime != null) + message.startTime = String(object.startTime); + if (object.enabled != null) { + if (typeof object.enabled !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.enabled: object expected"); + message.enabled = $root.google.protobuf.BoolValue.fromObject(object.enabled); + } + if (object.kind != null) + message.kind = String(object.kind); + if (object.binaryLogEnabled != null) { + if (typeof object.binaryLogEnabled !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.binaryLogEnabled: object expected"); + message.binaryLogEnabled = $root.google.protobuf.BoolValue.fromObject(object.binaryLogEnabled); + } + if (object.replicationLogArchivingEnabled != null) { + if (typeof object.replicationLogArchivingEnabled !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.replicationLogArchivingEnabled: object expected"); + message.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.fromObject(object.replicationLogArchivingEnabled); + } + if (object.location != null) + message.location = String(object.location); + if (object.pointInTimeRecoveryEnabled != null) { + if (typeof object.pointInTimeRecoveryEnabled !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.pointInTimeRecoveryEnabled: object expected"); + message.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.fromObject(object.pointInTimeRecoveryEnabled); + } + if (object.transactionLogRetentionDays != null) { + if (typeof object.transactionLogRetentionDays !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.transactionLogRetentionDays: object expected"); + message.transactionLogRetentionDays = $root.google.protobuf.Int32Value.fromObject(object.transactionLogRetentionDays); + } + if (object.backupRetentionSettings != null) { + if (typeof object.backupRetentionSettings !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.backupRetentionSettings: object expected"); + message.backupRetentionSettings = $root.google.cloud.sql.v1beta4.BackupRetentionSettings.fromObject(object.backupRetentionSettings); + } + switch (object.transactionalLogStorageState) { + default: + if (typeof object.transactionalLogStorageState === "number") { + message.transactionalLogStorageState = object.transactionalLogStorageState; + break; + } + break; + case "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED": + case 0: + message.transactionalLogStorageState = 0; + break; + case "DISK": + case 1: + message.transactionalLogStorageState = 1; + break; + case "SWITCHING_TO_CLOUD_STORAGE": + case 2: + message.transactionalLogStorageState = 2; + break; + case "SWITCHED_TO_CLOUD_STORAGE": + case 3: + message.transactionalLogStorageState = 3; + break; + case "CLOUD_STORAGE": + case 4: + message.transactionalLogStorageState = 4; + break; + } + switch (object.backupTier) { + default: + if (typeof object.backupTier === "number") { + message.backupTier = object.backupTier; + break; + } + break; + case "BACKUP_TIER_UNSPECIFIED": + case 0: + message.backupTier = 0; + break; + case "STANDARD": + case 1: + message.backupTier = 1; + break; + case "ADVANCED": + case 2: + message.backupTier = 2; + break; + case "ENHANCED": + case 3: + message.backupTier = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from a BackupConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @static + * @param {google.cloud.sql.v1beta4.BackupConfiguration} message BackupConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = ""; + object.enabled = null; + object.kind = ""; + object.binaryLogEnabled = null; + object.replicationLogArchivingEnabled = null; + object.location = ""; + object.pointInTimeRecoveryEnabled = null; + object.transactionLogRetentionDays = null; + object.backupRetentionSettings = null; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = message.startTime; + if (message.enabled != null && message.hasOwnProperty("enabled")) + object.enabled = $root.google.protobuf.BoolValue.toObject(message.enabled, options); + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.binaryLogEnabled != null && message.hasOwnProperty("binaryLogEnabled")) + object.binaryLogEnabled = $root.google.protobuf.BoolValue.toObject(message.binaryLogEnabled, options); + if (message.replicationLogArchivingEnabled != null && message.hasOwnProperty("replicationLogArchivingEnabled")) + object.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.toObject(message.replicationLogArchivingEnabled, options); + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.pointInTimeRecoveryEnabled != null && message.hasOwnProperty("pointInTimeRecoveryEnabled")) + object.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.toObject(message.pointInTimeRecoveryEnabled, options); + if (message.transactionLogRetentionDays != null && message.hasOwnProperty("transactionLogRetentionDays")) + object.transactionLogRetentionDays = $root.google.protobuf.Int32Value.toObject(message.transactionLogRetentionDays, options); + if (message.backupRetentionSettings != null && message.hasOwnProperty("backupRetentionSettings")) + object.backupRetentionSettings = $root.google.cloud.sql.v1beta4.BackupRetentionSettings.toObject(message.backupRetentionSettings, options); + if (message.transactionalLogStorageState != null && message.hasOwnProperty("transactionalLogStorageState")) { + object.transactionalLogStorageState = options.enums === String ? $root.google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState[message.transactionalLogStorageState] === undefined ? message.transactionalLogStorageState : $root.google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState[message.transactionalLogStorageState] : message.transactionalLogStorageState; + if (options.oneofs) + object._transactionalLogStorageState = "transactionalLogStorageState"; + } + if (message.backupTier != null && message.hasOwnProperty("backupTier")) { + object.backupTier = options.enums === String ? $root.google.cloud.sql.v1beta4.BackupConfiguration.BackupTier[message.backupTier] === undefined ? message.backupTier : $root.google.cloud.sql.v1beta4.BackupConfiguration.BackupTier[message.backupTier] : message.backupTier; + if (options.oneofs) + object._backupTier = "backupTier"; + } + return object; + }; + + /** + * Converts this BackupConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @instance + * @returns {Object.} JSON object + */ + BackupConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.BackupConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupConfiguration"; + }; + + /** + * TransactionalLogStorageState enum. + * @name google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState + * @enum {number} + * @property {number} TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED=0 TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED value + * @property {number} DISK=1 DISK value + * @property {number} SWITCHING_TO_CLOUD_STORAGE=2 SWITCHING_TO_CLOUD_STORAGE value + * @property {number} SWITCHED_TO_CLOUD_STORAGE=3 SWITCHED_TO_CLOUD_STORAGE value + * @property {number} CLOUD_STORAGE=4 CLOUD_STORAGE value + */ + BackupConfiguration.TransactionalLogStorageState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISK"] = 1; + values[valuesById[2] = "SWITCHING_TO_CLOUD_STORAGE"] = 2; + values[valuesById[3] = "SWITCHED_TO_CLOUD_STORAGE"] = 3; + values[valuesById[4] = "CLOUD_STORAGE"] = 4; + return values; + })(); + + /** + * BackupTier enum. + * @name google.cloud.sql.v1beta4.BackupConfiguration.BackupTier + * @enum {number} + * @property {number} BACKUP_TIER_UNSPECIFIED=0 BACKUP_TIER_UNSPECIFIED value + * @property {number} STANDARD=1 STANDARD value + * @property {number} ADVANCED=2 ADVANCED value + * @property {number} ENHANCED=3 ENHANCED value + */ + BackupConfiguration.BackupTier = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BACKUP_TIER_UNSPECIFIED"] = 0; + values[valuesById[1] = "STANDARD"] = 1; + values[valuesById[2] = "ADVANCED"] = 2; + values[valuesById[3] = "ENHANCED"] = 3; + return values; + })(); + + return BackupConfiguration; + })(); + + v1beta4.BackupRun = (function() { + + /** + * Properties of a BackupRun. + * @memberof google.cloud.sql.v1beta4 + * @interface IBackupRun + * @property {string|null} [kind] BackupRun kind + * @property {google.cloud.sql.v1beta4.SqlBackupRunStatus|null} [status] BackupRun status + * @property {google.protobuf.ITimestamp|null} [enqueuedTime] BackupRun enqueuedTime + * @property {number|Long|null} [id] BackupRun id + * @property {google.protobuf.ITimestamp|null} [startTime] BackupRun startTime + * @property {google.protobuf.ITimestamp|null} [endTime] BackupRun endTime + * @property {google.cloud.sql.v1beta4.IOperationError|null} [error] BackupRun error + * @property {google.cloud.sql.v1beta4.SqlBackupRunType|null} [type] BackupRun type + * @property {string|null} [description] BackupRun description + * @property {google.protobuf.ITimestamp|null} [windowStartTime] BackupRun windowStartTime + * @property {string|null} [instance] BackupRun instance + * @property {string|null} [selfLink] BackupRun selfLink + * @property {string|null} [location] BackupRun location + * @property {google.cloud.sql.v1beta4.SqlDatabaseVersion|null} [databaseVersion] BackupRun databaseVersion + * @property {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null} [diskEncryptionConfiguration] BackupRun diskEncryptionConfiguration + * @property {google.cloud.sql.v1beta4.IDiskEncryptionStatus|null} [diskEncryptionStatus] BackupRun diskEncryptionStatus + * @property {google.cloud.sql.v1beta4.SqlBackupKind|null} [backupKind] BackupRun backupKind + * @property {string|null} [timeZone] BackupRun timeZone + * @property {number|Long|null} [maxChargeableBytes] BackupRun maxChargeableBytes + */ + + /** + * Constructs a new BackupRun. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a BackupRun. + * @implements IBackupRun + * @constructor + * @param {google.cloud.sql.v1beta4.IBackupRun=} [properties] Properties to set + */ + function BackupRun(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupRun kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.kind = ""; + + /** + * BackupRun status. + * @member {google.cloud.sql.v1beta4.SqlBackupRunStatus} status + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.status = 0; + + /** + * BackupRun enqueuedTime. + * @member {google.protobuf.ITimestamp|null|undefined} enqueuedTime + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.enqueuedTime = null; + + /** + * BackupRun id. + * @member {number|Long} id + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BackupRun startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.startTime = null; + + /** + * BackupRun endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.endTime = null; + + /** + * BackupRun error. + * @member {google.cloud.sql.v1beta4.IOperationError|null|undefined} error + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.error = null; + + /** + * BackupRun type. + * @member {google.cloud.sql.v1beta4.SqlBackupRunType} type + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.type = 0; + + /** + * BackupRun description. + * @member {string} description + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.description = ""; + + /** + * BackupRun windowStartTime. + * @member {google.protobuf.ITimestamp|null|undefined} windowStartTime + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.windowStartTime = null; + + /** + * BackupRun instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.instance = ""; + + /** + * BackupRun selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.selfLink = ""; + + /** + * BackupRun location. + * @member {string} location + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.location = ""; + + /** + * BackupRun databaseVersion. + * @member {google.cloud.sql.v1beta4.SqlDatabaseVersion} databaseVersion + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.databaseVersion = 0; + + /** + * BackupRun diskEncryptionConfiguration. + * @member {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null|undefined} diskEncryptionConfiguration + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.diskEncryptionConfiguration = null; + + /** + * BackupRun diskEncryptionStatus. + * @member {google.cloud.sql.v1beta4.IDiskEncryptionStatus|null|undefined} diskEncryptionStatus + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.diskEncryptionStatus = null; + + /** + * BackupRun backupKind. + * @member {google.cloud.sql.v1beta4.SqlBackupKind} backupKind + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.backupKind = 0; + + /** + * BackupRun timeZone. + * @member {string} timeZone + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.timeZone = ""; + + /** + * BackupRun maxChargeableBytes. + * @member {number|Long|null|undefined} maxChargeableBytes + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + */ + BackupRun.prototype.maxChargeableBytes = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(BackupRun.prototype, "_maxChargeableBytes", { + get: $util.oneOfGetter($oneOfFields = ["maxChargeableBytes"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BackupRun instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.BackupRun + * @static + * @param {google.cloud.sql.v1beta4.IBackupRun=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.BackupRun} BackupRun instance + */ + BackupRun.create = function create(properties) { + return new BackupRun(properties); + }; + + /** + * Encodes the specified BackupRun message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRun.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.BackupRun + * @static + * @param {google.cloud.sql.v1beta4.IBackupRun} message BackupRun message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRun.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.status); + if (message.enqueuedTime != null && Object.hasOwnProperty.call(message, "enqueuedTime")) + $root.google.protobuf.Timestamp.encode(message.enqueuedTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.id); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.cloud.sql.v1beta4.OperationError.encode(message.error, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.type); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.description); + if (message.windowStartTime != null && Object.hasOwnProperty.call(message, "windowStartTime")) + $root.google.protobuf.Timestamp.encode(message.windowStartTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.instance); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.selfLink); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.location); + if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.databaseVersion); + if (message.diskEncryptionConfiguration != null && Object.hasOwnProperty.call(message, "diskEncryptionConfiguration")) + $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.encode(message.diskEncryptionConfiguration, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.diskEncryptionStatus != null && Object.hasOwnProperty.call(message, "diskEncryptionStatus")) + $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.encode(message.diskEncryptionStatus, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.backupKind != null && Object.hasOwnProperty.call(message, "backupKind")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.backupKind); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.timeZone); + if (message.maxChargeableBytes != null && Object.hasOwnProperty.call(message, "maxChargeableBytes")) + writer.uint32(/* id 24, wireType 0 =*/192).int64(message.maxChargeableBytes); + return writer; + }; + + /** + * Encodes the specified BackupRun message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRun.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupRun + * @static + * @param {google.cloud.sql.v1beta4.IBackupRun} message BackupRun message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRun.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupRun message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.BackupRun + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.BackupRun} BackupRun + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRun.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupRun(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.status = reader.int32(); + break; + } + case 3: { + message.enqueuedTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.id = reader.int64(); + break; + } + case 5: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.error = $root.google.cloud.sql.v1beta4.OperationError.decode(reader, reader.uint32()); + break; + } + case 8: { + message.type = reader.int32(); + break; + } + case 9: { + message.description = reader.string(); + break; + } + case 10: { + message.windowStartTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 11: { + message.instance = reader.string(); + break; + } + case 12: { + message.selfLink = reader.string(); + break; + } + case 13: { + message.location = reader.string(); + break; + } + case 15: { + message.databaseVersion = reader.int32(); + break; + } + case 16: { + message.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.decode(reader, reader.uint32()); + break; + } + case 17: { + message.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.decode(reader, reader.uint32()); + break; + } + case 19: { + message.backupKind = reader.int32(); + break; + } + case 23: { + message.timeZone = reader.string(); + break; + } + case 24: { + message.maxChargeableBytes = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupRun message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupRun + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.BackupRun} BackupRun + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRun.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupRun message. + * @function verify + * @memberof google.cloud.sql.v1beta4.BackupRun + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupRun.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + break; + } + if (message.enqueuedTime != null && message.hasOwnProperty("enqueuedTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.enqueuedTime); + if (error) + return "enqueuedTime." + error; + } + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) + return "id: integer|Long expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.cloud.sql.v1beta4.OperationError.verify(message.error); + if (error) + return "error." + error; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.windowStartTime != null && message.hasOwnProperty("windowStartTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.windowStartTime); + if (error) + return "windowStartTime." + error; + } + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + switch (message.databaseVersion) { + default: + return "databaseVersion: enum value expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + break; + } + if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) { + var error = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify(message.diskEncryptionConfiguration); + if (error) + return "diskEncryptionConfiguration." + error; + } + if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) { + var error = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.verify(message.diskEncryptionStatus); + if (error) + return "diskEncryptionStatus." + error; + } + if (message.backupKind != null && message.hasOwnProperty("backupKind")) + switch (message.backupKind) { + default: + return "backupKind: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { + properties._maxChargeableBytes = 1; + if (!$util.isInteger(message.maxChargeableBytes) && !(message.maxChargeableBytes && $util.isInteger(message.maxChargeableBytes.low) && $util.isInteger(message.maxChargeableBytes.high))) + return "maxChargeableBytes: integer|Long expected"; + } + return null; + }; + + /** + * Creates a BackupRun message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.BackupRun + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.BackupRun} BackupRun + */ + BackupRun.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.BackupRun) + return object; + var message = new $root.google.cloud.sql.v1beta4.BackupRun(); + if (object.kind != null) + message.kind = String(object.kind); + switch (object.status) { + default: + if (typeof object.status === "number") { + message.status = object.status; + break; + } + break; + case "SQL_BACKUP_RUN_STATUS_UNSPECIFIED": + case 0: + message.status = 0; + break; + case "ENQUEUED": + case 1: + message.status = 1; + break; + case "OVERDUE": + case 2: + message.status = 2; + break; + case "RUNNING": + case 3: + message.status = 3; + break; + case "FAILED": + case 4: + message.status = 4; + break; + case "SUCCESSFUL": + case 5: + message.status = 5; + break; + case "SKIPPED": + case 6: + message.status = 6; + break; + case "DELETION_PENDING": + case 7: + message.status = 7; + break; + case "DELETION_FAILED": + case 8: + message.status = 8; + break; + case "DELETED": + case 9: + message.status = 9; + break; + } + if (object.enqueuedTime != null) { + if (typeof object.enqueuedTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupRun.enqueuedTime: object expected"); + message.enqueuedTime = $root.google.protobuf.Timestamp.fromObject(object.enqueuedTime); + } + if (object.id != null) + if ($util.Long) + (message.id = $util.Long.fromValue(object.id)).unsigned = false; + else if (typeof object.id === "string") + message.id = parseInt(object.id, 10); + else if (typeof object.id === "number") + message.id = object.id; + else if (typeof object.id === "object") + message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupRun.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupRun.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupRun.error: object expected"); + message.error = $root.google.cloud.sql.v1beta4.OperationError.fromObject(object.error); + } + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SQL_BACKUP_RUN_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "AUTOMATED": + case 1: + message.type = 1; + break; + case "ON_DEMAND": + case 2: + message.type = 2; + break; + } + if (object.description != null) + message.description = String(object.description); + if (object.windowStartTime != null) { + if (typeof object.windowStartTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupRun.windowStartTime: object expected"); + message.windowStartTime = $root.google.protobuf.Timestamp.fromObject(object.windowStartTime); + } + if (object.instance != null) + message.instance = String(object.instance); + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + if (object.location != null) + message.location = String(object.location); + switch (object.databaseVersion) { + default: + if (typeof object.databaseVersion === "number") { + message.databaseVersion = object.databaseVersion; + break; + } + break; + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.databaseVersion = 0; + break; + case "MYSQL_5_1": + case 2: + message.databaseVersion = 2; + break; + case "MYSQL_5_5": + case 3: + message.databaseVersion = 3; + break; + case "MYSQL_5_6": + case 5: + message.databaseVersion = 5; + break; + case "MYSQL_5_7": + case 6: + message.databaseVersion = 6; + break; + case "MYSQL_8_0": + case 20: + message.databaseVersion = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.databaseVersion = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.databaseVersion = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.databaseVersion = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.databaseVersion = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.databaseVersion = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.databaseVersion = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.databaseVersion = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.databaseVersion = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.databaseVersion = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.databaseVersion = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.databaseVersion = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.databaseVersion = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.databaseVersion = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.databaseVersion = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.databaseVersion = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.databaseVersion = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.databaseVersion = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.databaseVersion = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.databaseVersion = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.databaseVersion = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.databaseVersion = 556; + break; + case "MYSQL_8_4": + case 398: + message.databaseVersion = 398; + break; + case "MYSQL_9_7": + case 654: + message.databaseVersion = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.databaseVersion = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.databaseVersion = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.databaseVersion = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.databaseVersion = 16; + break; + case "POSTGRES_9_6": + case 9: + message.databaseVersion = 9; + break; + case "POSTGRES_10": + case 18: + message.databaseVersion = 18; + break; + case "POSTGRES_11": + case 10: + message.databaseVersion = 10; + break; + case "POSTGRES_12": + case 19: + message.databaseVersion = 19; + break; + case "POSTGRES_13": + case 23: + message.databaseVersion = 23; + break; + case "POSTGRES_14": + case 110: + message.databaseVersion = 110; + break; + case "POSTGRES_15": + case 172: + message.databaseVersion = 172; + break; + case "POSTGRES_16": + case 272: + message.databaseVersion = 272; + break; + case "POSTGRES_17": + case 408: + message.databaseVersion = 408; + break; + case "POSTGRES_18": + case 557: + message.databaseVersion = 557; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.databaseVersion = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.databaseVersion = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.databaseVersion = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.databaseVersion = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.databaseVersion = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.databaseVersion = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.databaseVersion = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.databaseVersion = 202; + break; + } + if (object.diskEncryptionConfiguration != null) { + if (typeof object.diskEncryptionConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupRun.diskEncryptionConfiguration: object expected"); + message.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.fromObject(object.diskEncryptionConfiguration); + } + if (object.diskEncryptionStatus != null) { + if (typeof object.diskEncryptionStatus !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupRun.diskEncryptionStatus: object expected"); + message.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.fromObject(object.diskEncryptionStatus); + } + switch (object.backupKind) { + default: + if (typeof object.backupKind === "number") { + message.backupKind = object.backupKind; + break; + } + break; + case "SQL_BACKUP_KIND_UNSPECIFIED": + case 0: + message.backupKind = 0; + break; + case "SNAPSHOT": + case 1: + message.backupKind = 1; + break; + case "PHYSICAL": + case 2: + message.backupKind = 2; + break; + } + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.maxChargeableBytes != null) + if ($util.Long) + (message.maxChargeableBytes = $util.Long.fromValue(object.maxChargeableBytes)).unsigned = false; + else if (typeof object.maxChargeableBytes === "string") + message.maxChargeableBytes = parseInt(object.maxChargeableBytes, 10); + else if (typeof object.maxChargeableBytes === "number") + message.maxChargeableBytes = object.maxChargeableBytes; + else if (typeof object.maxChargeableBytes === "object") + message.maxChargeableBytes = new $util.LongBits(object.maxChargeableBytes.low >>> 0, object.maxChargeableBytes.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a BackupRun message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.BackupRun + * @static + * @param {google.cloud.sql.v1beta4.BackupRun} message BackupRun + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupRun.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.status = options.enums === String ? "SQL_BACKUP_RUN_STATUS_UNSPECIFIED" : 0; + object.enqueuedTime = null; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.id = options.longs === String ? "0" : 0; + object.startTime = null; + object.endTime = null; + object.error = null; + object.type = options.enums === String ? "SQL_BACKUP_RUN_TYPE_UNSPECIFIED" : 0; + object.description = ""; + object.windowStartTime = null; + object.instance = ""; + object.selfLink = ""; + object.location = ""; + object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; + object.diskEncryptionConfiguration = null; + object.diskEncryptionStatus = null; + object.backupKind = options.enums === String ? "SQL_BACKUP_KIND_UNSPECIFIED" : 0; + object.timeZone = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackupRunStatus[message.status] === undefined ? message.status : $root.google.cloud.sql.v1beta4.SqlBackupRunStatus[message.status] : message.status; + if (message.enqueuedTime != null && message.hasOwnProperty("enqueuedTime")) + object.enqueuedTime = $root.google.protobuf.Timestamp.toObject(message.enqueuedTime, options); + if (message.id != null && message.hasOwnProperty("id")) + if (typeof message.id === "number") + object.id = options.longs === String ? String(message.id) : message.id; + else + object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.cloud.sql.v1beta4.OperationError.toObject(message.error, options); + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackupRunType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.SqlBackupRunType[message.type] : message.type; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.windowStartTime != null && message.hasOwnProperty("windowStartTime")) + object.windowStartTime = $root.google.protobuf.Timestamp.toObject(message.windowStartTime, options); + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; + if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) + object.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.toObject(message.diskEncryptionConfiguration, options); + if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) + object.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.toObject(message.diskEncryptionStatus, options); + if (message.backupKind != null && message.hasOwnProperty("backupKind")) + object.backupKind = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackupKind[message.backupKind] === undefined ? message.backupKind : $root.google.cloud.sql.v1beta4.SqlBackupKind[message.backupKind] : message.backupKind; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { + if (typeof message.maxChargeableBytes === "number") + object.maxChargeableBytes = options.longs === String ? String(message.maxChargeableBytes) : message.maxChargeableBytes; + else + object.maxChargeableBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxChargeableBytes) : options.longs === Number ? new $util.LongBits(message.maxChargeableBytes.low >>> 0, message.maxChargeableBytes.high >>> 0).toNumber() : message.maxChargeableBytes; + if (options.oneofs) + object._maxChargeableBytes = "maxChargeableBytes"; + } + return object; + }; + + /** + * Converts this BackupRun to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.BackupRun + * @instance + * @returns {Object.} JSON object + */ + BackupRun.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupRun + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.BackupRun + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupRun.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupRun"; + }; + + return BackupRun; + })(); + + v1beta4.Backup = (function() { + + /** + * Properties of a Backup. + * @memberof google.cloud.sql.v1beta4 + * @interface IBackup + * @property {string|null} [name] Backup name + * @property {string|null} [kind] Backup kind + * @property {string|null} [selfLink] Backup selfLink + * @property {google.cloud.sql.v1beta4.Backup.SqlBackupType|null} [type] Backup type + * @property {string|null} [description] Backup description + * @property {string|null} [instance] Backup instance + * @property {string|null} [location] Backup location + * @property {google.type.IInterval|null} [backupInterval] Backup backupInterval + * @property {google.cloud.sql.v1beta4.Backup.SqlBackupState|null} [state] Backup state + * @property {google.cloud.sql.v1beta4.IOperationError|null} [error] Backup error + * @property {string|null} [kmsKey] Backup kmsKey + * @property {string|null} [kmsKeyVersion] Backup kmsKeyVersion + * @property {google.cloud.sql.v1beta4.SqlBackupKind|null} [backupKind] Backup backupKind + * @property {string|null} [timeZone] Backup timeZone + * @property {number|Long|null} [ttlDays] Backup ttlDays + * @property {google.protobuf.ITimestamp|null} [expiryTime] Backup expiryTime + * @property {google.cloud.sql.v1beta4.SqlDatabaseVersion|null} [databaseVersion] Backup databaseVersion + * @property {number|Long|null} [maxChargeableBytes] Backup maxChargeableBytes + * @property {google.protobuf.ITimestamp|null} [instanceDeletionTime] Backup instanceDeletionTime + * @property {google.cloud.sql.v1beta4.IDatabaseInstance|null} [instanceSettings] Backup instanceSettings + * @property {string|null} [backupRun] Backup backupRun + * @property {google.protobuf.IBoolValue|null} [satisfiesPzs] Backup satisfiesPzs + * @property {google.protobuf.IBoolValue|null} [satisfiesPzi] Backup satisfiesPzi + */ + + /** + * Constructs a new Backup. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a Backup. + * @implements IBackup + * @constructor + * @param {google.cloud.sql.v1beta4.IBackup=} [properties] Properties to set + */ + function Backup(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Backup name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.name = ""; + + /** + * Backup kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.kind = ""; + + /** + * Backup selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.selfLink = ""; + + /** + * Backup type. + * @member {google.cloud.sql.v1beta4.Backup.SqlBackupType} type + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.type = 0; + + /** + * Backup description. + * @member {string} description + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.description = ""; + + /** + * Backup instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.instance = ""; + + /** + * Backup location. + * @member {string} location + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.location = ""; + + /** + * Backup backupInterval. + * @member {google.type.IInterval|null|undefined} backupInterval + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.backupInterval = null; + + /** + * Backup state. + * @member {google.cloud.sql.v1beta4.Backup.SqlBackupState} state + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.state = 0; + + /** + * Backup error. + * @member {google.cloud.sql.v1beta4.IOperationError|null|undefined} error + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.error = null; + + /** + * Backup kmsKey. + * @member {string} kmsKey + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.kmsKey = ""; + + /** + * Backup kmsKeyVersion. + * @member {string} kmsKeyVersion + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.kmsKeyVersion = ""; + + /** + * Backup backupKind. + * @member {google.cloud.sql.v1beta4.SqlBackupKind} backupKind + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.backupKind = 0; + + /** + * Backup timeZone. + * @member {string} timeZone + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.timeZone = ""; + + /** + * Backup ttlDays. + * @member {number|Long|null|undefined} ttlDays + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.ttlDays = null; + + /** + * Backup expiryTime. + * @member {google.protobuf.ITimestamp|null|undefined} expiryTime + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.expiryTime = null; + + /** + * Backup databaseVersion. + * @member {google.cloud.sql.v1beta4.SqlDatabaseVersion} databaseVersion + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.databaseVersion = 0; + + /** + * Backup maxChargeableBytes. + * @member {number|Long|null|undefined} maxChargeableBytes + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.maxChargeableBytes = null; + + /** + * Backup instanceDeletionTime. + * @member {google.protobuf.ITimestamp|null|undefined} instanceDeletionTime + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.instanceDeletionTime = null; + + /** + * Backup instanceSettings. + * @member {google.cloud.sql.v1beta4.IDatabaseInstance|null|undefined} instanceSettings + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.instanceSettings = null; + + /** + * Backup backupRun. + * @member {string} backupRun + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.backupRun = ""; + + /** + * Backup satisfiesPzs. + * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzs + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.satisfiesPzs = null; + + /** + * Backup satisfiesPzi. + * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzi + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Backup.prototype.satisfiesPzi = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Backup expiration. + * @member {"ttlDays"|"expiryTime"|undefined} expiration + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + */ + Object.defineProperty(Backup.prototype, "expiration", { + get: $util.oneOfGetter($oneOfFields = ["ttlDays", "expiryTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Backup.prototype, "_maxChargeableBytes", { + get: $util.oneOfGetter($oneOfFields = ["maxChargeableBytes"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Backup instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.Backup + * @static + * @param {google.cloud.sql.v1beta4.IBackup=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.Backup} Backup instance + */ + Backup.create = function create(properties) { + return new Backup(properties); + }; + + /** + * Encodes the specified Backup message. Does not implicitly {@link google.cloud.sql.v1beta4.Backup.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.Backup + * @static + * @param {google.cloud.sql.v1beta4.IBackup} message Backup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Backup.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.selfLink); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.description); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); + if (message.location != null && Object.hasOwnProperty.call(message, "location")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.location); + if (message.backupInterval != null && Object.hasOwnProperty.call(message, "backupInterval")) + $root.google.type.Interval.encode(message.backupInterval, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.cloud.sql.v1beta4.OperationError.encode(message.error, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.kmsKey != null && Object.hasOwnProperty.call(message, "kmsKey")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.kmsKey); + if (message.kmsKeyVersion != null && Object.hasOwnProperty.call(message, "kmsKeyVersion")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.kmsKeyVersion); + if (message.backupKind != null && Object.hasOwnProperty.call(message, "backupKind")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.backupKind); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.timeZone); + if (message.ttlDays != null && Object.hasOwnProperty.call(message, "ttlDays")) + writer.uint32(/* id 16, wireType 0 =*/128).int64(message.ttlDays); + if (message.expiryTime != null && Object.hasOwnProperty.call(message, "expiryTime")) + $root.google.protobuf.Timestamp.encode(message.expiryTime, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) + writer.uint32(/* id 20, wireType 0 =*/160).int32(message.databaseVersion); + if (message.maxChargeableBytes != null && Object.hasOwnProperty.call(message, "maxChargeableBytes")) + writer.uint32(/* id 23, wireType 0 =*/184).int64(message.maxChargeableBytes); + if (message.instanceDeletionTime != null && Object.hasOwnProperty.call(message, "instanceDeletionTime")) + $root.google.protobuf.Timestamp.encode(message.instanceDeletionTime, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.instanceSettings != null && Object.hasOwnProperty.call(message, "instanceSettings")) + $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.instanceSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.backupRun != null && Object.hasOwnProperty.call(message, "backupRun")) + writer.uint32(/* id 26, wireType 2 =*/210).string(message.backupRun); + if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) + $root.google.protobuf.BoolValue.encode(message.satisfiesPzs, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + if (message.satisfiesPzi != null && Object.hasOwnProperty.call(message, "satisfiesPzi")) + $root.google.protobuf.BoolValue.encode(message.satisfiesPzi, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Backup message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Backup.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.Backup + * @static + * @param {google.cloud.sql.v1beta4.IBackup} message Backup message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Backup.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Backup message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.Backup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.Backup} Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Backup.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Backup(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + case 3: { + message.selfLink = reader.string(); + break; + } + case 4: { + message.type = reader.int32(); + break; + } + case 5: { + message.description = reader.string(); + break; + } + case 6: { + message.instance = reader.string(); + break; + } + case 7: { + message.location = reader.string(); + break; + } + case 8: { + message.backupInterval = $root.google.type.Interval.decode(reader, reader.uint32()); + break; + } + case 9: { + message.state = reader.int32(); + break; + } + case 10: { + message.error = $root.google.cloud.sql.v1beta4.OperationError.decode(reader, reader.uint32()); + break; + } + case 11: { + message.kmsKey = reader.string(); + break; + } + case 12: { + message.kmsKeyVersion = reader.string(); + break; + } + case 13: { + message.backupKind = reader.int32(); + break; + } + case 15: { + message.timeZone = reader.string(); + break; + } + case 16: { + message.ttlDays = reader.int64(); + break; + } + case 17: { + message.expiryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 20: { + message.databaseVersion = reader.int32(); + break; + } + case 23: { + message.maxChargeableBytes = reader.int64(); + break; + } + case 24: { + message.instanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 25: { + message.instanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + case 26: { + message.backupRun = reader.string(); + break; + } + case 27: { + message.satisfiesPzs = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 28: { + message.satisfiesPzi = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Backup message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.Backup + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.Backup} Backup + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Backup.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Backup message. + * @function verify + * @memberof google.cloud.sql.v1beta4.Backup + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Backup.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.location != null && message.hasOwnProperty("location")) + if (!$util.isString(message.location)) + return "location: string expected"; + if (message.backupInterval != null && message.hasOwnProperty("backupInterval")) { + var error = $root.google.type.Interval.verify(message.backupInterval); + if (error) + return "backupInterval." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.cloud.sql.v1beta4.OperationError.verify(message.error); + if (error) + return "error." + error; + } + if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) + if (!$util.isString(message.kmsKey)) + return "kmsKey: string expected"; + if (message.kmsKeyVersion != null && message.hasOwnProperty("kmsKeyVersion")) + if (!$util.isString(message.kmsKeyVersion)) + return "kmsKeyVersion: string expected"; + if (message.backupKind != null && message.hasOwnProperty("backupKind")) + switch (message.backupKind) { + default: + return "backupKind: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.ttlDays != null && message.hasOwnProperty("ttlDays")) { + properties.expiration = 1; + if (!$util.isInteger(message.ttlDays) && !(message.ttlDays && $util.isInteger(message.ttlDays.low) && $util.isInteger(message.ttlDays.high))) + return "ttlDays: integer|Long expected"; + } + if (message.expiryTime != null && message.hasOwnProperty("expiryTime")) { + if (properties.expiration === 1) + return "expiration: multiple values"; + properties.expiration = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.expiryTime); + if (error) + return "expiryTime." + error; + } + } + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + switch (message.databaseVersion) { + default: + return "databaseVersion: enum value expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + break; + } + if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { + properties._maxChargeableBytes = 1; + if (!$util.isInteger(message.maxChargeableBytes) && !(message.maxChargeableBytes && $util.isInteger(message.maxChargeableBytes.low) && $util.isInteger(message.maxChargeableBytes.high))) + return "maxChargeableBytes: integer|Long expected"; + } + if (message.instanceDeletionTime != null && message.hasOwnProperty("instanceDeletionTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.instanceDeletionTime); + if (error) + return "instanceDeletionTime." + error; + } + if (message.instanceSettings != null && message.hasOwnProperty("instanceSettings")) { + var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.instanceSettings); + if (error) + return "instanceSettings." + error; + } + if (message.backupRun != null && message.hasOwnProperty("backupRun")) + if (!$util.isString(message.backupRun)) + return "backupRun: string expected"; + if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) { + var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzs); + if (error) + return "satisfiesPzs." + error; + } + if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) { + var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzi); + if (error) + return "satisfiesPzi." + error; + } + return null; + }; + + /** + * Creates a Backup message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.Backup + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.Backup} Backup + */ + Backup.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.Backup) + return object; + var message = new $root.google.cloud.sql.v1beta4.Backup(); + if (object.name != null) + message.name = String(object.name); + if (object.kind != null) + message.kind = String(object.kind); + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SQL_BACKUP_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "AUTOMATED": + case 1: + message.type = 1; + break; + case "ON_DEMAND": + case 2: + message.type = 2; + break; + case "FINAL": + case 3: + message.type = 3; + break; + } + if (object.description != null) + message.description = String(object.description); + if (object.instance != null) + message.instance = String(object.instance); + if (object.location != null) + message.location = String(object.location); + if (object.backupInterval != null) { + if (typeof object.backupInterval !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Backup.backupInterval: object expected"); + message.backupInterval = $root.google.type.Interval.fromObject(object.backupInterval); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "SQL_BACKUP_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "ENQUEUED": + case 1: + message.state = 1; + break; + case "RUNNING": + case 2: + message.state = 2; + break; + case "FAILED": + case 3: + message.state = 3; + break; + case "SUCCESSFUL": + case 4: + message.state = 4; + break; + case "DELETING": + case 5: + message.state = 5; + break; + case "DELETION_FAILED": + case 6: + message.state = 6; + break; + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Backup.error: object expected"); + message.error = $root.google.cloud.sql.v1beta4.OperationError.fromObject(object.error); + } + if (object.kmsKey != null) + message.kmsKey = String(object.kmsKey); + if (object.kmsKeyVersion != null) + message.kmsKeyVersion = String(object.kmsKeyVersion); + switch (object.backupKind) { + default: + if (typeof object.backupKind === "number") { + message.backupKind = object.backupKind; + break; + } + break; + case "SQL_BACKUP_KIND_UNSPECIFIED": + case 0: + message.backupKind = 0; + break; + case "SNAPSHOT": + case 1: + message.backupKind = 1; + break; + case "PHYSICAL": + case 2: + message.backupKind = 2; + break; + } + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.ttlDays != null) + if ($util.Long) + (message.ttlDays = $util.Long.fromValue(object.ttlDays)).unsigned = false; + else if (typeof object.ttlDays === "string") + message.ttlDays = parseInt(object.ttlDays, 10); + else if (typeof object.ttlDays === "number") + message.ttlDays = object.ttlDays; + else if (typeof object.ttlDays === "object") + message.ttlDays = new $util.LongBits(object.ttlDays.low >>> 0, object.ttlDays.high >>> 0).toNumber(); + if (object.expiryTime != null) { + if (typeof object.expiryTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Backup.expiryTime: object expected"); + message.expiryTime = $root.google.protobuf.Timestamp.fromObject(object.expiryTime); + } + switch (object.databaseVersion) { + default: + if (typeof object.databaseVersion === "number") { + message.databaseVersion = object.databaseVersion; + break; + } + break; + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.databaseVersion = 0; + break; + case "MYSQL_5_1": + case 2: + message.databaseVersion = 2; + break; + case "MYSQL_5_5": + case 3: + message.databaseVersion = 3; + break; + case "MYSQL_5_6": + case 5: + message.databaseVersion = 5; + break; + case "MYSQL_5_7": + case 6: + message.databaseVersion = 6; + break; + case "MYSQL_8_0": + case 20: + message.databaseVersion = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.databaseVersion = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.databaseVersion = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.databaseVersion = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.databaseVersion = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.databaseVersion = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.databaseVersion = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.databaseVersion = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.databaseVersion = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.databaseVersion = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.databaseVersion = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.databaseVersion = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.databaseVersion = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.databaseVersion = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.databaseVersion = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.databaseVersion = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.databaseVersion = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.databaseVersion = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.databaseVersion = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.databaseVersion = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.databaseVersion = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.databaseVersion = 556; + break; + case "MYSQL_8_4": + case 398: + message.databaseVersion = 398; + break; + case "MYSQL_9_7": + case 654: + message.databaseVersion = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.databaseVersion = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.databaseVersion = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.databaseVersion = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.databaseVersion = 16; + break; + case "POSTGRES_9_6": + case 9: + message.databaseVersion = 9; + break; + case "POSTGRES_10": + case 18: + message.databaseVersion = 18; + break; + case "POSTGRES_11": + case 10: + message.databaseVersion = 10; + break; + case "POSTGRES_12": + case 19: + message.databaseVersion = 19; + break; + case "POSTGRES_13": + case 23: + message.databaseVersion = 23; + break; + case "POSTGRES_14": + case 110: + message.databaseVersion = 110; + break; + case "POSTGRES_15": + case 172: + message.databaseVersion = 172; + break; + case "POSTGRES_16": + case 272: + message.databaseVersion = 272; + break; + case "POSTGRES_17": + case 408: + message.databaseVersion = 408; + break; + case "POSTGRES_18": + case 557: + message.databaseVersion = 557; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.databaseVersion = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.databaseVersion = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.databaseVersion = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.databaseVersion = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.databaseVersion = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.databaseVersion = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.databaseVersion = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.databaseVersion = 202; + break; + } + if (object.maxChargeableBytes != null) + if ($util.Long) + (message.maxChargeableBytes = $util.Long.fromValue(object.maxChargeableBytes)).unsigned = false; + else if (typeof object.maxChargeableBytes === "string") + message.maxChargeableBytes = parseInt(object.maxChargeableBytes, 10); + else if (typeof object.maxChargeableBytes === "number") + message.maxChargeableBytes = object.maxChargeableBytes; + else if (typeof object.maxChargeableBytes === "object") + message.maxChargeableBytes = new $util.LongBits(object.maxChargeableBytes.low >>> 0, object.maxChargeableBytes.high >>> 0).toNumber(); + if (object.instanceDeletionTime != null) { + if (typeof object.instanceDeletionTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Backup.instanceDeletionTime: object expected"); + message.instanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.instanceDeletionTime); + } + if (object.instanceSettings != null) { + if (typeof object.instanceSettings !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Backup.instanceSettings: object expected"); + message.instanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.instanceSettings); + } + if (object.backupRun != null) + message.backupRun = String(object.backupRun); + if (object.satisfiesPzs != null) { + if (typeof object.satisfiesPzs !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Backup.satisfiesPzs: object expected"); + message.satisfiesPzs = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzs); + } + if (object.satisfiesPzi != null) { + if (typeof object.satisfiesPzi !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Backup.satisfiesPzi: object expected"); + message.satisfiesPzi = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzi); + } + return message; + }; + + /** + * Creates a plain object from a Backup message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.Backup + * @static + * @param {google.cloud.sql.v1beta4.Backup} message Backup + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Backup.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.kind = ""; + object.selfLink = ""; + object.type = options.enums === String ? "SQL_BACKUP_TYPE_UNSPECIFIED" : 0; + object.description = ""; + object.instance = ""; + object.location = ""; + object.backupInterval = null; + object.state = options.enums === String ? "SQL_BACKUP_STATE_UNSPECIFIED" : 0; + object.error = null; + object.kmsKey = ""; + object.kmsKeyVersion = ""; + object.backupKind = options.enums === String ? "SQL_BACKUP_KIND_UNSPECIFIED" : 0; + object.timeZone = ""; + object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; + object.instanceDeletionTime = null; + object.instanceSettings = null; + object.backupRun = ""; + object.satisfiesPzs = null; + object.satisfiesPzi = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.Backup.SqlBackupType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.Backup.SqlBackupType[message.type] : message.type; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.location != null && message.hasOwnProperty("location")) + object.location = message.location; + if (message.backupInterval != null && message.hasOwnProperty("backupInterval")) + object.backupInterval = $root.google.type.Interval.toObject(message.backupInterval, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.sql.v1beta4.Backup.SqlBackupState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1beta4.Backup.SqlBackupState[message.state] : message.state; + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.cloud.sql.v1beta4.OperationError.toObject(message.error, options); + if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) + object.kmsKey = message.kmsKey; + if (message.kmsKeyVersion != null && message.hasOwnProperty("kmsKeyVersion")) + object.kmsKeyVersion = message.kmsKeyVersion; + if (message.backupKind != null && message.hasOwnProperty("backupKind")) + object.backupKind = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackupKind[message.backupKind] === undefined ? message.backupKind : $root.google.cloud.sql.v1beta4.SqlBackupKind[message.backupKind] : message.backupKind; + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.ttlDays != null && message.hasOwnProperty("ttlDays")) { + if (typeof message.ttlDays === "number") + object.ttlDays = options.longs === String ? String(message.ttlDays) : message.ttlDays; + else + object.ttlDays = options.longs === String ? $util.Long.prototype.toString.call(message.ttlDays) : options.longs === Number ? new $util.LongBits(message.ttlDays.low >>> 0, message.ttlDays.high >>> 0).toNumber() : message.ttlDays; + if (options.oneofs) + object.expiration = "ttlDays"; + } + if (message.expiryTime != null && message.hasOwnProperty("expiryTime")) { + object.expiryTime = $root.google.protobuf.Timestamp.toObject(message.expiryTime, options); + if (options.oneofs) + object.expiration = "expiryTime"; + } + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; + if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { + if (typeof message.maxChargeableBytes === "number") + object.maxChargeableBytes = options.longs === String ? String(message.maxChargeableBytes) : message.maxChargeableBytes; + else + object.maxChargeableBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxChargeableBytes) : options.longs === Number ? new $util.LongBits(message.maxChargeableBytes.low >>> 0, message.maxChargeableBytes.high >>> 0).toNumber() : message.maxChargeableBytes; + if (options.oneofs) + object._maxChargeableBytes = "maxChargeableBytes"; + } + if (message.instanceDeletionTime != null && message.hasOwnProperty("instanceDeletionTime")) + object.instanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.instanceDeletionTime, options); + if (message.instanceSettings != null && message.hasOwnProperty("instanceSettings")) + object.instanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.instanceSettings, options); + if (message.backupRun != null && message.hasOwnProperty("backupRun")) + object.backupRun = message.backupRun; + if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) + object.satisfiesPzs = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzs, options); + if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) + object.satisfiesPzi = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzi, options); + return object; + }; + + /** + * Converts this Backup to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.Backup + * @instance + * @returns {Object.} JSON object + */ + Backup.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Backup + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.Backup + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Backup.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.Backup"; + }; + + /** + * SqlBackupType enum. + * @name google.cloud.sql.v1beta4.Backup.SqlBackupType + * @enum {number} + * @property {number} SQL_BACKUP_TYPE_UNSPECIFIED=0 SQL_BACKUP_TYPE_UNSPECIFIED value + * @property {number} AUTOMATED=1 AUTOMATED value + * @property {number} ON_DEMAND=2 ON_DEMAND value + * @property {number} FINAL=3 FINAL value + */ + Backup.SqlBackupType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKUP_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATED"] = 1; + values[valuesById[2] = "ON_DEMAND"] = 2; + values[valuesById[3] = "FINAL"] = 3; + return values; + })(); + + /** + * SqlBackupState enum. + * @name google.cloud.sql.v1beta4.Backup.SqlBackupState + * @enum {number} + * @property {number} SQL_BACKUP_STATE_UNSPECIFIED=0 SQL_BACKUP_STATE_UNSPECIFIED value + * @property {number} ENQUEUED=1 ENQUEUED value + * @property {number} RUNNING=2 RUNNING value + * @property {number} FAILED=3 FAILED value + * @property {number} SUCCESSFUL=4 SUCCESSFUL value + * @property {number} DELETING=5 DELETING value + * @property {number} DELETION_FAILED=6 DELETION_FAILED value + */ + Backup.SqlBackupState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKUP_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENQUEUED"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "FAILED"] = 3; + values[valuesById[4] = "SUCCESSFUL"] = 4; + values[valuesById[5] = "DELETING"] = 5; + values[valuesById[6] = "DELETION_FAILED"] = 6; + return values; + })(); + + return Backup; + })(); + + v1beta4.BackupRunsListResponse = (function() { + + /** + * Properties of a BackupRunsListResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IBackupRunsListResponse + * @property {string|null} [kind] BackupRunsListResponse kind + * @property {Array.|null} [items] BackupRunsListResponse items + * @property {string|null} [nextPageToken] BackupRunsListResponse nextPageToken + */ + + /** + * Constructs a new BackupRunsListResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a BackupRunsListResponse. + * @implements IBackupRunsListResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IBackupRunsListResponse=} [properties] Properties to set + */ + function BackupRunsListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupRunsListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @instance + */ + BackupRunsListResponse.prototype.kind = ""; + + /** + * BackupRunsListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @instance + */ + BackupRunsListResponse.prototype.items = $util.emptyArray; + + /** + * BackupRunsListResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @instance + */ + BackupRunsListResponse.prototype.nextPageToken = ""; + + /** + * Creates a new BackupRunsListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @static + * @param {google.cloud.sql.v1beta4.IBackupRunsListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.BackupRunsListResponse} BackupRunsListResponse instance + */ + BackupRunsListResponse.create = function create(properties) { + return new BackupRunsListResponse(properties); + }; + + /** + * Encodes the specified BackupRunsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRunsListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @static + * @param {google.cloud.sql.v1beta4.IBackupRunsListResponse} message BackupRunsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRunsListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1beta4.BackupRun.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified BackupRunsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRunsListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @static + * @param {google.cloud.sql.v1beta4.IBackupRunsListResponse} message BackupRunsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupRunsListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupRunsListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.BackupRunsListResponse} BackupRunsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRunsListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupRunsListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1beta4.BackupRun.decode(reader, reader.uint32())); + break; + } + case 3: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupRunsListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.BackupRunsListResponse} BackupRunsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupRunsListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupRunsListResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupRunsListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.BackupRun.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a BackupRunsListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.BackupRunsListResponse} BackupRunsListResponse + */ + BackupRunsListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.BackupRunsListResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.BackupRunsListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1beta4.BackupRunsListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.BackupRunsListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1beta4.BackupRun.fromObject(object.items[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a BackupRunsListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @static + * @param {google.cloud.sql.v1beta4.BackupRunsListResponse} message BackupRunsListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupRunsListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) { + object.kind = ""; + object.nextPageToken = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1beta4.BackupRun.toObject(message.items[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this BackupRunsListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @instance + * @returns {Object.} JSON object + */ + BackupRunsListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupRunsListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupRunsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupRunsListResponse"; + }; + + return BackupRunsListResponse; + })(); + + v1beta4.BinLogCoordinates = (function() { + + /** + * Properties of a BinLogCoordinates. + * @memberof google.cloud.sql.v1beta4 + * @interface IBinLogCoordinates + * @property {string|null} [binLogFileName] BinLogCoordinates binLogFileName + * @property {number|Long|null} [binLogPosition] BinLogCoordinates binLogPosition + * @property {string|null} [kind] BinLogCoordinates kind + */ + + /** + * Constructs a new BinLogCoordinates. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a BinLogCoordinates. + * @implements IBinLogCoordinates + * @constructor + * @param {google.cloud.sql.v1beta4.IBinLogCoordinates=} [properties] Properties to set + */ + function BinLogCoordinates(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BinLogCoordinates binLogFileName. + * @member {string} binLogFileName + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @instance + */ + BinLogCoordinates.prototype.binLogFileName = ""; + + /** + * BinLogCoordinates binLogPosition. + * @member {number|Long} binLogPosition + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @instance + */ + BinLogCoordinates.prototype.binLogPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BinLogCoordinates kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @instance + */ + BinLogCoordinates.prototype.kind = ""; + + /** + * Creates a new BinLogCoordinates instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @static + * @param {google.cloud.sql.v1beta4.IBinLogCoordinates=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.BinLogCoordinates} BinLogCoordinates instance + */ + BinLogCoordinates.create = function create(properties) { + return new BinLogCoordinates(properties); + }; + + /** + * Encodes the specified BinLogCoordinates message. Does not implicitly {@link google.cloud.sql.v1beta4.BinLogCoordinates.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @static + * @param {google.cloud.sql.v1beta4.IBinLogCoordinates} message BinLogCoordinates message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BinLogCoordinates.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.binLogFileName != null && Object.hasOwnProperty.call(message, "binLogFileName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.binLogFileName); + if (message.binLogPosition != null && Object.hasOwnProperty.call(message, "binLogPosition")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.binLogPosition); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + return writer; + }; + + /** + * Encodes the specified BinLogCoordinates message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BinLogCoordinates.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @static + * @param {google.cloud.sql.v1beta4.IBinLogCoordinates} message BinLogCoordinates message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BinLogCoordinates.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BinLogCoordinates message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.BinLogCoordinates} BinLogCoordinates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BinLogCoordinates.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BinLogCoordinates(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.binLogFileName = reader.string(); + break; + } + case 2: { + message.binLogPosition = reader.int64(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BinLogCoordinates message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.BinLogCoordinates} BinLogCoordinates + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BinLogCoordinates.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BinLogCoordinates message. + * @function verify + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BinLogCoordinates.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.binLogFileName != null && message.hasOwnProperty("binLogFileName")) + if (!$util.isString(message.binLogFileName)) + return "binLogFileName: string expected"; + if (message.binLogPosition != null && message.hasOwnProperty("binLogPosition")) + if (!$util.isInteger(message.binLogPosition) && !(message.binLogPosition && $util.isInteger(message.binLogPosition.low) && $util.isInteger(message.binLogPosition.high))) + return "binLogPosition: integer|Long expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a BinLogCoordinates message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.BinLogCoordinates} BinLogCoordinates + */ + BinLogCoordinates.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.BinLogCoordinates) + return object; + var message = new $root.google.cloud.sql.v1beta4.BinLogCoordinates(); + if (object.binLogFileName != null) + message.binLogFileName = String(object.binLogFileName); + if (object.binLogPosition != null) + if ($util.Long) + (message.binLogPosition = $util.Long.fromValue(object.binLogPosition)).unsigned = false; + else if (typeof object.binLogPosition === "string") + message.binLogPosition = parseInt(object.binLogPosition, 10); + else if (typeof object.binLogPosition === "number") + message.binLogPosition = object.binLogPosition; + else if (typeof object.binLogPosition === "object") + message.binLogPosition = new $util.LongBits(object.binLogPosition.low >>> 0, object.binLogPosition.high >>> 0).toNumber(); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a BinLogCoordinates message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @static + * @param {google.cloud.sql.v1beta4.BinLogCoordinates} message BinLogCoordinates + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BinLogCoordinates.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.binLogFileName = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.binLogPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.binLogPosition = options.longs === String ? "0" : 0; + object.kind = ""; + } + if (message.binLogFileName != null && message.hasOwnProperty("binLogFileName")) + object.binLogFileName = message.binLogFileName; + if (message.binLogPosition != null && message.hasOwnProperty("binLogPosition")) + if (typeof message.binLogPosition === "number") + object.binLogPosition = options.longs === String ? String(message.binLogPosition) : message.binLogPosition; + else + object.binLogPosition = options.longs === String ? $util.Long.prototype.toString.call(message.binLogPosition) : options.longs === Number ? new $util.LongBits(message.binLogPosition.low >>> 0, message.binLogPosition.high >>> 0).toNumber() : message.binLogPosition; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this BinLogCoordinates to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @instance + * @returns {Object.} JSON object + */ + BinLogCoordinates.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BinLogCoordinates + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.BinLogCoordinates + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BinLogCoordinates.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.BinLogCoordinates"; + }; + + return BinLogCoordinates; + })(); + + v1beta4.BackupContext = (function() { + + /** + * Properties of a BackupContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IBackupContext + * @property {number|Long|null} [backupId] BackupContext backupId + * @property {string|null} [kind] BackupContext kind + * @property {string|null} [name] BackupContext name + */ + + /** + * Constructs a new BackupContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a BackupContext. + * @implements IBackupContext + * @constructor + * @param {google.cloud.sql.v1beta4.IBackupContext=} [properties] Properties to set + */ + function BackupContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BackupContext backupId. + * @member {number|Long} backupId + * @memberof google.cloud.sql.v1beta4.BackupContext + * @instance + */ + BackupContext.prototype.backupId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * BackupContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.BackupContext + * @instance + */ + BackupContext.prototype.kind = ""; + + /** + * BackupContext name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.BackupContext + * @instance + */ + BackupContext.prototype.name = ""; + + /** + * Creates a new BackupContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.BackupContext + * @static + * @param {google.cloud.sql.v1beta4.IBackupContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.BackupContext} BackupContext instance + */ + BackupContext.create = function create(properties) { + return new BackupContext(properties); + }; + + /** + * Encodes the specified BackupContext message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.BackupContext + * @static + * @param {google.cloud.sql.v1beta4.IBackupContext} message BackupContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.backupId != null && Object.hasOwnProperty.call(message, "backupId")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.backupId); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + return writer; + }; + + /** + * Encodes the specified BackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupContext + * @static + * @param {google.cloud.sql.v1beta4.IBackupContext} message BackupContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BackupContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BackupContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.BackupContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.BackupContext} BackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.backupId = reader.int64(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + case 3: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BackupContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.BackupContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.BackupContext} BackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BackupContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BackupContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.BackupContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BackupContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.backupId != null && message.hasOwnProperty("backupId")) + if (!$util.isInteger(message.backupId) && !(message.backupId && $util.isInteger(message.backupId.low) && $util.isInteger(message.backupId.high))) + return "backupId: integer|Long expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a BackupContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.BackupContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.BackupContext} BackupContext + */ + BackupContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.BackupContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.BackupContext(); + if (object.backupId != null) + if ($util.Long) + (message.backupId = $util.Long.fromValue(object.backupId)).unsigned = false; + else if (typeof object.backupId === "string") + message.backupId = parseInt(object.backupId, 10); + else if (typeof object.backupId === "number") + message.backupId = object.backupId; + else if (typeof object.backupId === "object") + message.backupId = new $util.LongBits(object.backupId.low >>> 0, object.backupId.high >>> 0).toNumber(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a BackupContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.BackupContext + * @static + * @param {google.cloud.sql.v1beta4.BackupContext} message BackupContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BackupContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.backupId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.backupId = options.longs === String ? "0" : 0; + object.kind = ""; + object.name = ""; + } + if (message.backupId != null && message.hasOwnProperty("backupId")) + if (typeof message.backupId === "number") + object.backupId = options.longs === String ? String(message.backupId) : message.backupId; + else + object.backupId = options.longs === String ? $util.Long.prototype.toString.call(message.backupId) : options.longs === Number ? new $util.LongBits(message.backupId.low >>> 0, message.backupId.high >>> 0).toNumber() : message.backupId; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this BackupContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.BackupContext + * @instance + * @returns {Object.} JSON object + */ + BackupContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BackupContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.BackupContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BackupContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupContext"; + }; + + return BackupContext; + })(); + + v1beta4.CloneContext = (function() { + + /** + * Properties of a CloneContext. + * @memberof google.cloud.sql.v1beta4 + * @interface ICloneContext + * @property {string|null} [kind] CloneContext kind + * @property {number|Long|null} [pitrTimestampMs] CloneContext pitrTimestampMs + * @property {string|null} [destinationInstanceName] CloneContext destinationInstanceName + * @property {google.cloud.sql.v1beta4.IBinLogCoordinates|null} [binLogCoordinates] CloneContext binLogCoordinates + * @property {google.protobuf.ITimestamp|null} [pointInTime] CloneContext pointInTime + * @property {string|null} [allocatedIpRange] CloneContext allocatedIpRange + * @property {Array.|null} [databaseNames] CloneContext databaseNames + * @property {string|null} [preferredZone] CloneContext preferredZone + * @property {string|null} [preferredSecondaryZone] CloneContext preferredSecondaryZone + * @property {google.protobuf.ITimestamp|null} [sourceInstanceDeletionTime] CloneContext sourceInstanceDeletionTime + * @property {string|null} [destinationProject] CloneContext destinationProject + * @property {string|null} [destinationNetwork] CloneContext destinationNetwork + */ + + /** + * Constructs a new CloneContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a CloneContext. + * @implements ICloneContext + * @constructor + * @param {google.cloud.sql.v1beta4.ICloneContext=} [properties] Properties to set + */ + function CloneContext(properties) { + this.databaseNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CloneContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.kind = ""; + + /** + * CloneContext pitrTimestampMs. + * @member {number|Long} pitrTimestampMs + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.pitrTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * CloneContext destinationInstanceName. + * @member {string} destinationInstanceName + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.destinationInstanceName = ""; + + /** + * CloneContext binLogCoordinates. + * @member {google.cloud.sql.v1beta4.IBinLogCoordinates|null|undefined} binLogCoordinates + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.binLogCoordinates = null; + + /** + * CloneContext pointInTime. + * @member {google.protobuf.ITimestamp|null|undefined} pointInTime + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.pointInTime = null; + + /** + * CloneContext allocatedIpRange. + * @member {string} allocatedIpRange + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.allocatedIpRange = ""; + + /** + * CloneContext databaseNames. + * @member {Array.} databaseNames + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.databaseNames = $util.emptyArray; + + /** + * CloneContext preferredZone. + * @member {string|null|undefined} preferredZone + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.preferredZone = null; + + /** + * CloneContext preferredSecondaryZone. + * @member {string|null|undefined} preferredSecondaryZone + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.preferredSecondaryZone = null; + + /** + * CloneContext sourceInstanceDeletionTime. + * @member {google.protobuf.ITimestamp|null|undefined} sourceInstanceDeletionTime + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.sourceInstanceDeletionTime = null; + + /** + * CloneContext destinationProject. + * @member {string|null|undefined} destinationProject + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.destinationProject = null; + + /** + * CloneContext destinationNetwork. + * @member {string|null|undefined} destinationNetwork + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + */ + CloneContext.prototype.destinationNetwork = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CloneContext.prototype, "_preferredZone", { + get: $util.oneOfGetter($oneOfFields = ["preferredZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CloneContext.prototype, "_preferredSecondaryZone", { + get: $util.oneOfGetter($oneOfFields = ["preferredSecondaryZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CloneContext.prototype, "_sourceInstanceDeletionTime", { + get: $util.oneOfGetter($oneOfFields = ["sourceInstanceDeletionTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CloneContext.prototype, "_destinationProject", { + get: $util.oneOfGetter($oneOfFields = ["destinationProject"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(CloneContext.prototype, "_destinationNetwork", { + get: $util.oneOfGetter($oneOfFields = ["destinationNetwork"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new CloneContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.CloneContext + * @static + * @param {google.cloud.sql.v1beta4.ICloneContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.CloneContext} CloneContext instance + */ + CloneContext.create = function create(properties) { + return new CloneContext(properties); + }; + + /** + * Encodes the specified CloneContext message. Does not implicitly {@link google.cloud.sql.v1beta4.CloneContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.CloneContext + * @static + * @param {google.cloud.sql.v1beta4.ICloneContext} message CloneContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloneContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.pitrTimestampMs != null && Object.hasOwnProperty.call(message, "pitrTimestampMs")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pitrTimestampMs); + if (message.destinationInstanceName != null && Object.hasOwnProperty.call(message, "destinationInstanceName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinationInstanceName); + if (message.binLogCoordinates != null && Object.hasOwnProperty.call(message, "binLogCoordinates")) + $root.google.cloud.sql.v1beta4.BinLogCoordinates.encode(message.binLogCoordinates, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.pointInTime != null && Object.hasOwnProperty.call(message, "pointInTime")) + $root.google.protobuf.Timestamp.encode(message.pointInTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.allocatedIpRange); + if (message.databaseNames != null && message.databaseNames.length) + for (var i = 0; i < message.databaseNames.length; ++i) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.databaseNames[i]); + if (message.preferredZone != null && Object.hasOwnProperty.call(message, "preferredZone")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.preferredZone); + if (message.preferredSecondaryZone != null && Object.hasOwnProperty.call(message, "preferredSecondaryZone")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.preferredSecondaryZone); + if (message.sourceInstanceDeletionTime != null && Object.hasOwnProperty.call(message, "sourceInstanceDeletionTime")) + $root.google.protobuf.Timestamp.encode(message.sourceInstanceDeletionTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.destinationProject != null && Object.hasOwnProperty.call(message, "destinationProject")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.destinationProject); + if (message.destinationNetwork != null && Object.hasOwnProperty.call(message, "destinationNetwork")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.destinationNetwork); + return writer; + }; + + /** + * Encodes the specified CloneContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.CloneContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.CloneContext + * @static + * @param {google.cloud.sql.v1beta4.ICloneContext} message CloneContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CloneContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CloneContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.CloneContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.CloneContext} CloneContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloneContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.CloneContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.pitrTimestampMs = reader.int64(); + break; + } + case 3: { + message.destinationInstanceName = reader.string(); + break; + } + case 4: { + message.binLogCoordinates = $root.google.cloud.sql.v1beta4.BinLogCoordinates.decode(reader, reader.uint32()); + break; + } + case 5: { + message.pointInTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.allocatedIpRange = reader.string(); + break; + } + case 9: { + if (!(message.databaseNames && message.databaseNames.length)) + message.databaseNames = []; + message.databaseNames.push(reader.string()); + break; + } + case 10: { + message.preferredZone = reader.string(); + break; + } + case 11: { + message.preferredSecondaryZone = reader.string(); + break; + } + case 12: { + message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 13: { + message.destinationProject = reader.string(); + break; + } + case 14: { + message.destinationNetwork = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CloneContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.CloneContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.CloneContext} CloneContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CloneContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CloneContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.CloneContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CloneContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.pitrTimestampMs != null && message.hasOwnProperty("pitrTimestampMs")) + if (!$util.isInteger(message.pitrTimestampMs) && !(message.pitrTimestampMs && $util.isInteger(message.pitrTimestampMs.low) && $util.isInteger(message.pitrTimestampMs.high))) + return "pitrTimestampMs: integer|Long expected"; + if (message.destinationInstanceName != null && message.hasOwnProperty("destinationInstanceName")) + if (!$util.isString(message.destinationInstanceName)) + return "destinationInstanceName: string expected"; + if (message.binLogCoordinates != null && message.hasOwnProperty("binLogCoordinates")) { + var error = $root.google.cloud.sql.v1beta4.BinLogCoordinates.verify(message.binLogCoordinates); + if (error) + return "binLogCoordinates." + error; + } + if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.pointInTime); + if (error) + return "pointInTime." + error; + } + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) + if (!$util.isString(message.allocatedIpRange)) + return "allocatedIpRange: string expected"; + if (message.databaseNames != null && message.hasOwnProperty("databaseNames")) { + if (!Array.isArray(message.databaseNames)) + return "databaseNames: array expected"; + for (var i = 0; i < message.databaseNames.length; ++i) + if (!$util.isString(message.databaseNames[i])) + return "databaseNames: string[] expected"; + } + if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { + properties._preferredZone = 1; + if (!$util.isString(message.preferredZone)) + return "preferredZone: string expected"; + } + if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { + properties._preferredSecondaryZone = 1; + if (!$util.isString(message.preferredSecondaryZone)) + return "preferredSecondaryZone: string expected"; + } + if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { + properties._sourceInstanceDeletionTime = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.sourceInstanceDeletionTime); + if (error) + return "sourceInstanceDeletionTime." + error; + } + } + if (message.destinationProject != null && message.hasOwnProperty("destinationProject")) { + properties._destinationProject = 1; + if (!$util.isString(message.destinationProject)) + return "destinationProject: string expected"; + } + if (message.destinationNetwork != null && message.hasOwnProperty("destinationNetwork")) { + properties._destinationNetwork = 1; + if (!$util.isString(message.destinationNetwork)) + return "destinationNetwork: string expected"; + } + return null; + }; + + /** + * Creates a CloneContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.CloneContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.CloneContext} CloneContext + */ + CloneContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.CloneContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.CloneContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.pitrTimestampMs != null) + if ($util.Long) + (message.pitrTimestampMs = $util.Long.fromValue(object.pitrTimestampMs)).unsigned = false; + else if (typeof object.pitrTimestampMs === "string") + message.pitrTimestampMs = parseInt(object.pitrTimestampMs, 10); + else if (typeof object.pitrTimestampMs === "number") + message.pitrTimestampMs = object.pitrTimestampMs; + else if (typeof object.pitrTimestampMs === "object") + message.pitrTimestampMs = new $util.LongBits(object.pitrTimestampMs.low >>> 0, object.pitrTimestampMs.high >>> 0).toNumber(); + if (object.destinationInstanceName != null) + message.destinationInstanceName = String(object.destinationInstanceName); + if (object.binLogCoordinates != null) { + if (typeof object.binLogCoordinates !== "object") + throw TypeError(".google.cloud.sql.v1beta4.CloneContext.binLogCoordinates: object expected"); + message.binLogCoordinates = $root.google.cloud.sql.v1beta4.BinLogCoordinates.fromObject(object.binLogCoordinates); + } + if (object.pointInTime != null) { + if (typeof object.pointInTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.CloneContext.pointInTime: object expected"); + message.pointInTime = $root.google.protobuf.Timestamp.fromObject(object.pointInTime); + } + if (object.allocatedIpRange != null) + message.allocatedIpRange = String(object.allocatedIpRange); + if (object.databaseNames) { + if (!Array.isArray(object.databaseNames)) + throw TypeError(".google.cloud.sql.v1beta4.CloneContext.databaseNames: array expected"); + message.databaseNames = []; + for (var i = 0; i < object.databaseNames.length; ++i) + message.databaseNames[i] = String(object.databaseNames[i]); + } + if (object.preferredZone != null) + message.preferredZone = String(object.preferredZone); + if (object.preferredSecondaryZone != null) + message.preferredSecondaryZone = String(object.preferredSecondaryZone); + if (object.sourceInstanceDeletionTime != null) { + if (typeof object.sourceInstanceDeletionTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.CloneContext.sourceInstanceDeletionTime: object expected"); + message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.sourceInstanceDeletionTime); + } + if (object.destinationProject != null) + message.destinationProject = String(object.destinationProject); + if (object.destinationNetwork != null) + message.destinationNetwork = String(object.destinationNetwork); + return message; + }; + + /** + * Creates a plain object from a CloneContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.CloneContext + * @static + * @param {google.cloud.sql.v1beta4.CloneContext} message CloneContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CloneContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.databaseNames = []; + if (options.defaults) { + object.kind = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.pitrTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.pitrTimestampMs = options.longs === String ? "0" : 0; + object.destinationInstanceName = ""; + object.binLogCoordinates = null; + object.pointInTime = null; + object.allocatedIpRange = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.pitrTimestampMs != null && message.hasOwnProperty("pitrTimestampMs")) + if (typeof message.pitrTimestampMs === "number") + object.pitrTimestampMs = options.longs === String ? String(message.pitrTimestampMs) : message.pitrTimestampMs; + else + object.pitrTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.pitrTimestampMs) : options.longs === Number ? new $util.LongBits(message.pitrTimestampMs.low >>> 0, message.pitrTimestampMs.high >>> 0).toNumber() : message.pitrTimestampMs; + if (message.destinationInstanceName != null && message.hasOwnProperty("destinationInstanceName")) + object.destinationInstanceName = message.destinationInstanceName; + if (message.binLogCoordinates != null && message.hasOwnProperty("binLogCoordinates")) + object.binLogCoordinates = $root.google.cloud.sql.v1beta4.BinLogCoordinates.toObject(message.binLogCoordinates, options); + if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) + object.pointInTime = $root.google.protobuf.Timestamp.toObject(message.pointInTime, options); + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) + object.allocatedIpRange = message.allocatedIpRange; + if (message.databaseNames && message.databaseNames.length) { + object.databaseNames = []; + for (var j = 0; j < message.databaseNames.length; ++j) + object.databaseNames[j] = message.databaseNames[j]; + } + if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { + object.preferredZone = message.preferredZone; + if (options.oneofs) + object._preferredZone = "preferredZone"; + } + if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { + object.preferredSecondaryZone = message.preferredSecondaryZone; + if (options.oneofs) + object._preferredSecondaryZone = "preferredSecondaryZone"; + } + if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { + object.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.sourceInstanceDeletionTime, options); + if (options.oneofs) + object._sourceInstanceDeletionTime = "sourceInstanceDeletionTime"; + } + if (message.destinationProject != null && message.hasOwnProperty("destinationProject")) { + object.destinationProject = message.destinationProject; + if (options.oneofs) + object._destinationProject = "destinationProject"; + } + if (message.destinationNetwork != null && message.hasOwnProperty("destinationNetwork")) { + object.destinationNetwork = message.destinationNetwork; + if (options.oneofs) + object._destinationNetwork = "destinationNetwork"; + } + return object; + }; + + /** + * Converts this CloneContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.CloneContext + * @instance + * @returns {Object.} JSON object + */ + CloneContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CloneContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.CloneContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CloneContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.CloneContext"; + }; + + return CloneContext; + })(); + + v1beta4.Database = (function() { + + /** + * Properties of a Database. + * @memberof google.cloud.sql.v1beta4 + * @interface IDatabase + * @property {string|null} [kind] Database kind + * @property {string|null} [charset] Database charset + * @property {string|null} [collation] Database collation + * @property {string|null} [etag] Database etag + * @property {string|null} [name] Database name + * @property {string|null} [instance] Database instance + * @property {string|null} [selfLink] Database selfLink + * @property {string|null} [project] Database project + * @property {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails|null} [sqlserverDatabaseDetails] Database sqlserverDatabaseDetails + */ + + /** + * Constructs a new Database. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a Database. + * @implements IDatabase + * @constructor + * @param {google.cloud.sql.v1beta4.IDatabase=} [properties] Properties to set + */ + function Database(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Database kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.Database + * @instance + */ + Database.prototype.kind = ""; + + /** + * Database charset. + * @member {string} charset + * @memberof google.cloud.sql.v1beta4.Database + * @instance + */ + Database.prototype.charset = ""; + + /** + * Database collation. + * @member {string} collation + * @memberof google.cloud.sql.v1beta4.Database + * @instance + */ + Database.prototype.collation = ""; + + /** + * Database etag. + * @member {string} etag + * @memberof google.cloud.sql.v1beta4.Database + * @instance + */ + Database.prototype.etag = ""; + + /** + * Database name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.Database + * @instance + */ + Database.prototype.name = ""; + + /** + * Database instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.Database + * @instance + */ + Database.prototype.instance = ""; + + /** + * Database selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1beta4.Database + * @instance + */ + Database.prototype.selfLink = ""; + + /** + * Database project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.Database + * @instance + */ + Database.prototype.project = ""; + + /** + * Database sqlserverDatabaseDetails. + * @member {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails|null|undefined} sqlserverDatabaseDetails + * @memberof google.cloud.sql.v1beta4.Database + * @instance + */ + Database.prototype.sqlserverDatabaseDetails = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Database databaseDetails. + * @member {"sqlserverDatabaseDetails"|undefined} databaseDetails + * @memberof google.cloud.sql.v1beta4.Database + * @instance + */ + Object.defineProperty(Database.prototype, "databaseDetails", { + get: $util.oneOfGetter($oneOfFields = ["sqlserverDatabaseDetails"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Database instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.Database + * @static + * @param {google.cloud.sql.v1beta4.IDatabase=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.Database} Database instance + */ + Database.create = function create(properties) { + return new Database(properties); + }; + + /** + * Encodes the specified Database message. Does not implicitly {@link google.cloud.sql.v1beta4.Database.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.Database + * @static + * @param {google.cloud.sql.v1beta4.IDatabase} message Database message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Database.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.charset != null && Object.hasOwnProperty.call(message, "charset")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.charset); + if (message.collation != null && Object.hasOwnProperty.call(message, "collation")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.collation); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.etag); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.selfLink); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.project); + if (message.sqlserverDatabaseDetails != null && Object.hasOwnProperty.call(message, "sqlserverDatabaseDetails")) + $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails.encode(message.sqlserverDatabaseDetails, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Database message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Database.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.Database + * @static + * @param {google.cloud.sql.v1beta4.IDatabase} message Database message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Database.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Database message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.Database + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.Database} Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Database.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Database(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.charset = reader.string(); + break; + } + case 3: { + message.collation = reader.string(); + break; + } + case 4: { + message.etag = reader.string(); + break; + } + case 5: { + message.name = reader.string(); + break; + } + case 6: { + message.instance = reader.string(); + break; + } + case 7: { + message.selfLink = reader.string(); + break; + } + case 8: { + message.project = reader.string(); + break; + } + case 9: { + message.sqlserverDatabaseDetails = $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Database message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.Database + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.Database} Database + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Database.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Database message. + * @function verify + * @memberof google.cloud.sql.v1beta4.Database + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Database.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.charset != null && message.hasOwnProperty("charset")) + if (!$util.isString(message.charset)) + return "charset: string expected"; + if (message.collation != null && message.hasOwnProperty("collation")) + if (!$util.isString(message.collation)) + return "collation: string expected"; + if (message.etag != null && message.hasOwnProperty("etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.sqlserverDatabaseDetails != null && message.hasOwnProperty("sqlserverDatabaseDetails")) { + properties.databaseDetails = 1; + { + var error = $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails.verify(message.sqlserverDatabaseDetails); + if (error) + return "sqlserverDatabaseDetails." + error; + } + } + return null; + }; + + /** + * Creates a Database message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.Database + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.Database} Database + */ + Database.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.Database) + return object; + var message = new $root.google.cloud.sql.v1beta4.Database(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.charset != null) + message.charset = String(object.charset); + if (object.collation != null) + message.collation = String(object.collation); + if (object.etag != null) + message.etag = String(object.etag); + if (object.name != null) + message.name = String(object.name); + if (object.instance != null) + message.instance = String(object.instance); + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + if (object.project != null) + message.project = String(object.project); + if (object.sqlserverDatabaseDetails != null) { + if (typeof object.sqlserverDatabaseDetails !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Database.sqlserverDatabaseDetails: object expected"); + message.sqlserverDatabaseDetails = $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails.fromObject(object.sqlserverDatabaseDetails); + } + return message; + }; + + /** + * Creates a plain object from a Database message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.Database + * @static + * @param {google.cloud.sql.v1beta4.Database} message Database + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Database.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.charset = ""; + object.collation = ""; + object.etag = ""; + object.name = ""; + object.instance = ""; + object.selfLink = ""; + object.project = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.charset != null && message.hasOwnProperty("charset")) + object.charset = message.charset; + if (message.collation != null && message.hasOwnProperty("collation")) + object.collation = message.collation; + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = message.etag; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.sqlserverDatabaseDetails != null && message.hasOwnProperty("sqlserverDatabaseDetails")) { + object.sqlserverDatabaseDetails = $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails.toObject(message.sqlserverDatabaseDetails, options); + if (options.oneofs) + object.databaseDetails = "sqlserverDatabaseDetails"; + } + return object; + }; + + /** + * Converts this Database to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.Database + * @instance + * @returns {Object.} JSON object + */ + Database.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Database + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.Database + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Database.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.Database"; + }; + + return Database; + })(); + + v1beta4.SqlServerDatabaseDetails = (function() { + + /** + * Properties of a SqlServerDatabaseDetails. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlServerDatabaseDetails + * @property {number|null} [compatibilityLevel] SqlServerDatabaseDetails compatibilityLevel + * @property {string|null} [recoveryModel] SqlServerDatabaseDetails recoveryModel + */ + + /** + * Constructs a new SqlServerDatabaseDetails. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlServerDatabaseDetails. + * @implements ISqlServerDatabaseDetails + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails=} [properties] Properties to set + */ + function SqlServerDatabaseDetails(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlServerDatabaseDetails compatibilityLevel. + * @member {number} compatibilityLevel + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @instance + */ + SqlServerDatabaseDetails.prototype.compatibilityLevel = 0; + + /** + * SqlServerDatabaseDetails recoveryModel. + * @member {string} recoveryModel + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @instance + */ + SqlServerDatabaseDetails.prototype.recoveryModel = ""; + + /** + * Creates a new SqlServerDatabaseDetails instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlServerDatabaseDetails} SqlServerDatabaseDetails instance + */ + SqlServerDatabaseDetails.create = function create(properties) { + return new SqlServerDatabaseDetails(properties); + }; + + /** + * Encodes the specified SqlServerDatabaseDetails message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerDatabaseDetails.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails} message SqlServerDatabaseDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerDatabaseDetails.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.compatibilityLevel != null && Object.hasOwnProperty.call(message, "compatibilityLevel")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.compatibilityLevel); + if (message.recoveryModel != null && Object.hasOwnProperty.call(message, "recoveryModel")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.recoveryModel); + return writer; + }; + + /** + * Encodes the specified SqlServerDatabaseDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerDatabaseDetails.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails} message SqlServerDatabaseDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerDatabaseDetails.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlServerDatabaseDetails} SqlServerDatabaseDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerDatabaseDetails.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.compatibilityLevel = reader.int32(); + break; + } + case 2: { + message.recoveryModel = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlServerDatabaseDetails} SqlServerDatabaseDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerDatabaseDetails.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlServerDatabaseDetails message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlServerDatabaseDetails.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.compatibilityLevel != null && message.hasOwnProperty("compatibilityLevel")) + if (!$util.isInteger(message.compatibilityLevel)) + return "compatibilityLevel: integer expected"; + if (message.recoveryModel != null && message.hasOwnProperty("recoveryModel")) + if (!$util.isString(message.recoveryModel)) + return "recoveryModel: string expected"; + return null; + }; + + /** + * Creates a SqlServerDatabaseDetails message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlServerDatabaseDetails} SqlServerDatabaseDetails + */ + SqlServerDatabaseDetails.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails(); + if (object.compatibilityLevel != null) + message.compatibilityLevel = object.compatibilityLevel | 0; + if (object.recoveryModel != null) + message.recoveryModel = String(object.recoveryModel); + return message; + }; + + /** + * Creates a plain object from a SqlServerDatabaseDetails message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @static + * @param {google.cloud.sql.v1beta4.SqlServerDatabaseDetails} message SqlServerDatabaseDetails + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlServerDatabaseDetails.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.compatibilityLevel = 0; + object.recoveryModel = ""; + } + if (message.compatibilityLevel != null && message.hasOwnProperty("compatibilityLevel")) + object.compatibilityLevel = message.compatibilityLevel; + if (message.recoveryModel != null && message.hasOwnProperty("recoveryModel")) + object.recoveryModel = message.recoveryModel; + return object; + }; + + /** + * Converts this SqlServerDatabaseDetails to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @instance + * @returns {Object.} JSON object + */ + SqlServerDatabaseDetails.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlServerDatabaseDetails + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlServerDatabaseDetails.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlServerDatabaseDetails"; + }; + + return SqlServerDatabaseDetails; + })(); + + v1beta4.DatabaseFlags = (function() { + + /** + * Properties of a DatabaseFlags. + * @memberof google.cloud.sql.v1beta4 + * @interface IDatabaseFlags + * @property {string|null} [name] DatabaseFlags name + * @property {string|null} [value] DatabaseFlags value + */ + + /** + * Constructs a new DatabaseFlags. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DatabaseFlags. + * @implements IDatabaseFlags + * @constructor + * @param {google.cloud.sql.v1beta4.IDatabaseFlags=} [properties] Properties to set + */ + function DatabaseFlags(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DatabaseFlags name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @instance + */ + DatabaseFlags.prototype.name = ""; + + /** + * DatabaseFlags value. + * @member {string} value + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @instance + */ + DatabaseFlags.prototype.value = ""; + + /** + * Creates a new DatabaseFlags instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @static + * @param {google.cloud.sql.v1beta4.IDatabaseFlags=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DatabaseFlags} DatabaseFlags instance + */ + DatabaseFlags.create = function create(properties) { + return new DatabaseFlags(properties); + }; + + /** + * Encodes the specified DatabaseFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseFlags.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @static + * @param {google.cloud.sql.v1beta4.IDatabaseFlags} message DatabaseFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabaseFlags.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + return writer; + }; + + /** + * Encodes the specified DatabaseFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseFlags.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @static + * @param {google.cloud.sql.v1beta4.IDatabaseFlags} message DatabaseFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabaseFlags.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DatabaseFlags message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DatabaseFlags} DatabaseFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabaseFlags.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseFlags(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DatabaseFlags message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DatabaseFlags} DatabaseFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabaseFlags.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DatabaseFlags message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DatabaseFlags.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a DatabaseFlags message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DatabaseFlags} DatabaseFlags + */ + DatabaseFlags.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseFlags) + return object; + var message = new $root.google.cloud.sql.v1beta4.DatabaseFlags(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a DatabaseFlags message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @static + * @param {google.cloud.sql.v1beta4.DatabaseFlags} message DatabaseFlags + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DatabaseFlags.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.value = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this DatabaseFlags to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @instance + * @returns {Object.} JSON object + */ + DatabaseFlags.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DatabaseFlags + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DatabaseFlags + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DatabaseFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseFlags"; + }; + + return DatabaseFlags; + })(); + + v1beta4.SyncFlags = (function() { + + /** + * Properties of a SyncFlags. + * @memberof google.cloud.sql.v1beta4 + * @interface ISyncFlags + * @property {string|null} [name] SyncFlags name + * @property {string|null} [value] SyncFlags value + */ + + /** + * Constructs a new SyncFlags. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SyncFlags. + * @implements ISyncFlags + * @constructor + * @param {google.cloud.sql.v1beta4.ISyncFlags=} [properties] Properties to set + */ + function SyncFlags(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SyncFlags name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @instance + */ + SyncFlags.prototype.name = ""; + + /** + * SyncFlags value. + * @member {string} value + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @instance + */ + SyncFlags.prototype.value = ""; + + /** + * Creates a new SyncFlags instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @static + * @param {google.cloud.sql.v1beta4.ISyncFlags=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SyncFlags} SyncFlags instance + */ + SyncFlags.create = function create(properties) { + return new SyncFlags(properties); + }; + + /** + * Encodes the specified SyncFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.SyncFlags.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @static + * @param {google.cloud.sql.v1beta4.ISyncFlags} message SyncFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncFlags.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + return writer; + }; + + /** + * Encodes the specified SyncFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SyncFlags.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @static + * @param {google.cloud.sql.v1beta4.ISyncFlags} message SyncFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SyncFlags.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SyncFlags message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SyncFlags} SyncFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncFlags.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SyncFlags(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SyncFlags message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SyncFlags} SyncFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SyncFlags.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SyncFlags message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SyncFlags.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a SyncFlags message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SyncFlags} SyncFlags + */ + SyncFlags.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SyncFlags) + return object; + var message = new $root.google.cloud.sql.v1beta4.SyncFlags(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a SyncFlags message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @static + * @param {google.cloud.sql.v1beta4.SyncFlags} message SyncFlags + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SyncFlags.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.value = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this SyncFlags to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @instance + * @returns {Object.} JSON object + */ + SyncFlags.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SyncFlags + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SyncFlags + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SyncFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SyncFlags"; + }; + + return SyncFlags; + })(); + + v1beta4.InstanceReference = (function() { + + /** + * Properties of an InstanceReference. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstanceReference + * @property {string|null} [name] InstanceReference name + * @property {string|null} [region] InstanceReference region + * @property {string|null} [project] InstanceReference project + */ + + /** + * Constructs a new InstanceReference. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstanceReference. + * @implements IInstanceReference + * @constructor + * @param {google.cloud.sql.v1beta4.IInstanceReference=} [properties] Properties to set + */ + function InstanceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstanceReference name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @instance + */ + InstanceReference.prototype.name = ""; + + /** + * InstanceReference region. + * @member {string} region + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @instance + */ + InstanceReference.prototype.region = ""; + + /** + * InstanceReference project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @instance + */ + InstanceReference.prototype.project = ""; + + /** + * Creates a new InstanceReference instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @static + * @param {google.cloud.sql.v1beta4.IInstanceReference=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstanceReference} InstanceReference instance + */ + InstanceReference.create = function create(properties) { + return new InstanceReference(properties); + }; + + /** + * Encodes the specified InstanceReference message. Does not implicitly {@link google.cloud.sql.v1beta4.InstanceReference.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @static + * @param {google.cloud.sql.v1beta4.IInstanceReference} message InstanceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstanceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.region); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + return writer; + }; + + /** + * Encodes the specified InstanceReference message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstanceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @static + * @param {google.cloud.sql.v1beta4.IInstanceReference} message InstanceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstanceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstanceReference message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstanceReference} InstanceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstanceReference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstanceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.region = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstanceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstanceReference} InstanceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstanceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstanceReference message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstanceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.region != null && message.hasOwnProperty("region")) + if (!$util.isString(message.region)) + return "region: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates an InstanceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstanceReference} InstanceReference + */ + InstanceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstanceReference) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstanceReference(); + if (object.name != null) + message.name = String(object.name); + if (object.region != null) + message.region = String(object.region); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from an InstanceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @static + * @param {google.cloud.sql.v1beta4.InstanceReference} message InstanceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstanceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.region = ""; + object.project = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.region != null && message.hasOwnProperty("region")) + object.region = message.region; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this InstanceReference to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @instance + * @returns {Object.} JSON object + */ + InstanceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstanceReference + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstanceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstanceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstanceReference"; + }; + + return InstanceReference; + })(); + + v1beta4.DatabaseInstance = (function() { + + /** + * Properties of a DatabaseInstance. + * @memberof google.cloud.sql.v1beta4 + * @interface IDatabaseInstance + * @property {string|null} [kind] DatabaseInstance kind + * @property {google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null} [state] DatabaseInstance state + * @property {google.cloud.sql.v1beta4.SqlDatabaseVersion|null} [databaseVersion] DatabaseInstance databaseVersion + * @property {google.cloud.sql.v1beta4.ISettings|null} [settings] DatabaseInstance settings + * @property {string|null} [etag] DatabaseInstance etag + * @property {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica|null} [failoverReplica] DatabaseInstance failoverReplica + * @property {string|null} [masterInstanceName] DatabaseInstance masterInstanceName + * @property {Array.|null} [replicaNames] DatabaseInstance replicaNames + * @property {google.protobuf.IInt64Value|null} [maxDiskSize] DatabaseInstance maxDiskSize + * @property {google.protobuf.IInt64Value|null} [currentDiskSize] DatabaseInstance currentDiskSize + * @property {Array.|null} [ipAddresses] DatabaseInstance ipAddresses + * @property {google.cloud.sql.v1beta4.ISslCert|null} [serverCaCert] DatabaseInstance serverCaCert + * @property {google.cloud.sql.v1beta4.SqlInstanceType|null} [instanceType] DatabaseInstance instanceType + * @property {string|null} [project] DatabaseInstance project + * @property {string|null} [ipv6Address] DatabaseInstance ipv6Address + * @property {string|null} [serviceAccountEmailAddress] DatabaseInstance serviceAccountEmailAddress + * @property {google.cloud.sql.v1beta4.IOnPremisesConfiguration|null} [onPremisesConfiguration] DatabaseInstance onPremisesConfiguration + * @property {google.cloud.sql.v1beta4.IReplicaConfiguration|null} [replicaConfiguration] DatabaseInstance replicaConfiguration + * @property {google.cloud.sql.v1beta4.SqlBackendType|null} [backendType] DatabaseInstance backendType + * @property {string|null} [selfLink] DatabaseInstance selfLink + * @property {Array.|null} [suspensionReason] DatabaseInstance suspensionReason + * @property {string|null} [connectionName] DatabaseInstance connectionName + * @property {string|null} [name] DatabaseInstance name + * @property {string|null} [region] DatabaseInstance region + * @property {string|null} [gceZone] DatabaseInstance gceZone + * @property {string|null} [secondaryGceZone] DatabaseInstance secondaryGceZone + * @property {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null} [diskEncryptionConfiguration] DatabaseInstance diskEncryptionConfiguration + * @property {google.cloud.sql.v1beta4.IDiskEncryptionStatus|null} [diskEncryptionStatus] DatabaseInstance diskEncryptionStatus + * @property {string|null} [rootPassword] DatabaseInstance rootPassword + * @property {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance|null} [scheduledMaintenance] DatabaseInstance scheduledMaintenance + * @property {google.protobuf.IBoolValue|null} [satisfiesPzs] DatabaseInstance satisfiesPzs + * @property {string|null} [databaseInstalledVersion] DatabaseInstance databaseInstalledVersion + * @property {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport|null} [outOfDiskReport] DatabaseInstance outOfDiskReport + * @property {google.protobuf.ITimestamp|null} [createTime] DatabaseInstance createTime + * @property {Array.|null} [availableMaintenanceVersions] DatabaseInstance availableMaintenanceVersions + * @property {string|null} [maintenanceVersion] DatabaseInstance maintenanceVersion + * @property {Array.|null} [upgradableDatabaseVersions] DatabaseInstance upgradableDatabaseVersions + * @property {google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|null} [sqlNetworkArchitecture] DatabaseInstance sqlNetworkArchitecture + * @property {string|null} [pscServiceAttachmentLink] DatabaseInstance pscServiceAttachmentLink + * @property {string|null} [dnsName] DatabaseInstance dnsName + * @property {string|null} [primaryDnsName] DatabaseInstance primaryDnsName + * @property {string|null} [writeEndpoint] DatabaseInstance writeEndpoint + * @property {google.cloud.sql.v1beta4.IReplicationCluster|null} [replicationCluster] DatabaseInstance replicationCluster + * @property {google.cloud.sql.v1beta4.IGeminiInstanceConfig|null} [geminiConfig] DatabaseInstance geminiConfig + * @property {google.protobuf.IBoolValue|null} [satisfiesPzi] DatabaseInstance satisfiesPzi + * @property {google.protobuf.IBoolValue|null} [switchTransactionLogsToCloudStorageEnabled] DatabaseInstance switchTransactionLogsToCloudStorageEnabled + * @property {google.protobuf.IBoolValue|null} [includeReplicasForMajorVersionUpgrade] DatabaseInstance includeReplicasForMajorVersionUpgrade + * @property {Object.|null} [tags] DatabaseInstance tags + * @property {number|null} [nodeCount] DatabaseInstance nodeCount + * @property {Array.|null} [nodes] DatabaseInstance nodes + * @property {Array.|null} [dnsNames] DatabaseInstance dnsNames + */ + + /** + * Constructs a new DatabaseInstance. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DatabaseInstance. + * @implements IDatabaseInstance + * @constructor + * @param {google.cloud.sql.v1beta4.IDatabaseInstance=} [properties] Properties to set + */ + function DatabaseInstance(properties) { + this.replicaNames = []; + this.ipAddresses = []; + this.suspensionReason = []; + this.availableMaintenanceVersions = []; + this.upgradableDatabaseVersions = []; + this.tags = {}; + this.nodes = []; + this.dnsNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DatabaseInstance kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.kind = ""; + + /** + * DatabaseInstance state. + * @member {google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState} state + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.state = 0; + + /** + * DatabaseInstance databaseVersion. + * @member {google.cloud.sql.v1beta4.SqlDatabaseVersion} databaseVersion + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.databaseVersion = 0; + + /** + * DatabaseInstance settings. + * @member {google.cloud.sql.v1beta4.ISettings|null|undefined} settings + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.settings = null; + + /** + * DatabaseInstance etag. + * @member {string} etag + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.etag = ""; + + /** + * DatabaseInstance failoverReplica. + * @member {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica|null|undefined} failoverReplica + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.failoverReplica = null; + + /** + * DatabaseInstance masterInstanceName. + * @member {string} masterInstanceName + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.masterInstanceName = ""; + + /** + * DatabaseInstance replicaNames. + * @member {Array.} replicaNames + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.replicaNames = $util.emptyArray; + + /** + * DatabaseInstance maxDiskSize. + * @member {google.protobuf.IInt64Value|null|undefined} maxDiskSize + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.maxDiskSize = null; + + /** + * DatabaseInstance currentDiskSize. + * @member {google.protobuf.IInt64Value|null|undefined} currentDiskSize + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.currentDiskSize = null; + + /** + * DatabaseInstance ipAddresses. + * @member {Array.} ipAddresses + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.ipAddresses = $util.emptyArray; + + /** + * DatabaseInstance serverCaCert. + * @member {google.cloud.sql.v1beta4.ISslCert|null|undefined} serverCaCert + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.serverCaCert = null; + + /** + * DatabaseInstance instanceType. + * @member {google.cloud.sql.v1beta4.SqlInstanceType} instanceType + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.instanceType = 0; + + /** + * DatabaseInstance project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.project = ""; + + /** + * DatabaseInstance ipv6Address. + * @member {string} ipv6Address + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.ipv6Address = ""; + + /** + * DatabaseInstance serviceAccountEmailAddress. + * @member {string} serviceAccountEmailAddress + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.serviceAccountEmailAddress = ""; + + /** + * DatabaseInstance onPremisesConfiguration. + * @member {google.cloud.sql.v1beta4.IOnPremisesConfiguration|null|undefined} onPremisesConfiguration + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.onPremisesConfiguration = null; + + /** + * DatabaseInstance replicaConfiguration. + * @member {google.cloud.sql.v1beta4.IReplicaConfiguration|null|undefined} replicaConfiguration + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.replicaConfiguration = null; + + /** + * DatabaseInstance backendType. + * @member {google.cloud.sql.v1beta4.SqlBackendType} backendType + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.backendType = 0; + + /** + * DatabaseInstance selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.selfLink = ""; + + /** + * DatabaseInstance suspensionReason. + * @member {Array.} suspensionReason + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.suspensionReason = $util.emptyArray; + + /** + * DatabaseInstance connectionName. + * @member {string} connectionName + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.connectionName = ""; + + /** + * DatabaseInstance name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.name = ""; + + /** + * DatabaseInstance region. + * @member {string} region + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.region = ""; + + /** + * DatabaseInstance gceZone. + * @member {string} gceZone + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.gceZone = ""; + + /** + * DatabaseInstance secondaryGceZone. + * @member {string} secondaryGceZone + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.secondaryGceZone = ""; + + /** + * DatabaseInstance diskEncryptionConfiguration. + * @member {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null|undefined} diskEncryptionConfiguration + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.diskEncryptionConfiguration = null; + + /** + * DatabaseInstance diskEncryptionStatus. + * @member {google.cloud.sql.v1beta4.IDiskEncryptionStatus|null|undefined} diskEncryptionStatus + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.diskEncryptionStatus = null; + + /** + * DatabaseInstance rootPassword. + * @member {string} rootPassword + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.rootPassword = ""; + + /** + * DatabaseInstance scheduledMaintenance. + * @member {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance|null|undefined} scheduledMaintenance + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.scheduledMaintenance = null; + + /** + * DatabaseInstance satisfiesPzs. + * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzs + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.satisfiesPzs = null; + + /** + * DatabaseInstance databaseInstalledVersion. + * @member {string} databaseInstalledVersion + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.databaseInstalledVersion = ""; + + /** + * DatabaseInstance outOfDiskReport. + * @member {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport|null|undefined} outOfDiskReport + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.outOfDiskReport = null; + + /** + * DatabaseInstance createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.createTime = null; + + /** + * DatabaseInstance availableMaintenanceVersions. + * @member {Array.} availableMaintenanceVersions + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.availableMaintenanceVersions = $util.emptyArray; + + /** + * DatabaseInstance maintenanceVersion. + * @member {string} maintenanceVersion + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.maintenanceVersion = ""; + + /** + * DatabaseInstance upgradableDatabaseVersions. + * @member {Array.} upgradableDatabaseVersions + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.upgradableDatabaseVersions = $util.emptyArray; + + /** + * DatabaseInstance sqlNetworkArchitecture. + * @member {google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|null|undefined} sqlNetworkArchitecture + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.sqlNetworkArchitecture = null; + + /** + * DatabaseInstance pscServiceAttachmentLink. + * @member {string|null|undefined} pscServiceAttachmentLink + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.pscServiceAttachmentLink = null; + + /** + * DatabaseInstance dnsName. + * @member {string|null|undefined} dnsName + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.dnsName = null; + + /** + * DatabaseInstance primaryDnsName. + * @member {string|null|undefined} primaryDnsName + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.primaryDnsName = null; + + /** + * DatabaseInstance writeEndpoint. + * @member {string|null|undefined} writeEndpoint + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.writeEndpoint = null; + + /** + * DatabaseInstance replicationCluster. + * @member {google.cloud.sql.v1beta4.IReplicationCluster|null|undefined} replicationCluster + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.replicationCluster = null; + + /** + * DatabaseInstance geminiConfig. + * @member {google.cloud.sql.v1beta4.IGeminiInstanceConfig|null|undefined} geminiConfig + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.geminiConfig = null; + + /** + * DatabaseInstance satisfiesPzi. + * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzi + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.satisfiesPzi = null; + + /** + * DatabaseInstance switchTransactionLogsToCloudStorageEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} switchTransactionLogsToCloudStorageEnabled + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.switchTransactionLogsToCloudStorageEnabled = null; + + /** + * DatabaseInstance includeReplicasForMajorVersionUpgrade. + * @member {google.protobuf.IBoolValue|null|undefined} includeReplicasForMajorVersionUpgrade + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.includeReplicasForMajorVersionUpgrade = null; + + /** + * DatabaseInstance tags. + * @member {Object.} tags + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.tags = $util.emptyObject; + + /** + * DatabaseInstance nodeCount. + * @member {number|null|undefined} nodeCount + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.nodeCount = null; + + /** + * DatabaseInstance nodes. + * @member {Array.} nodes + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.nodes = $util.emptyArray; + + /** + * DatabaseInstance dnsNames. + * @member {Array.} dnsNames + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + */ + DatabaseInstance.prototype.dnsNames = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_outOfDiskReport", { + get: $util.oneOfGetter($oneOfFields = ["outOfDiskReport"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_sqlNetworkArchitecture", { + get: $util.oneOfGetter($oneOfFields = ["sqlNetworkArchitecture"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_pscServiceAttachmentLink", { + get: $util.oneOfGetter($oneOfFields = ["pscServiceAttachmentLink"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_dnsName", { + get: $util.oneOfGetter($oneOfFields = ["dnsName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_primaryDnsName", { + get: $util.oneOfGetter($oneOfFields = ["primaryDnsName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_writeEndpoint", { + get: $util.oneOfGetter($oneOfFields = ["writeEndpoint"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_replicationCluster", { + get: $util.oneOfGetter($oneOfFields = ["replicationCluster"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_geminiConfig", { + get: $util.oneOfGetter($oneOfFields = ["geminiConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_switchTransactionLogsToCloudStorageEnabled", { + get: $util.oneOfGetter($oneOfFields = ["switchTransactionLogsToCloudStorageEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_includeReplicasForMajorVersionUpgrade", { + get: $util.oneOfGetter($oneOfFields = ["includeReplicasForMajorVersionUpgrade"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(DatabaseInstance.prototype, "_nodeCount", { + get: $util.oneOfGetter($oneOfFields = ["nodeCount"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new DatabaseInstance instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @static + * @param {google.cloud.sql.v1beta4.IDatabaseInstance=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DatabaseInstance} DatabaseInstance instance + */ + DatabaseInstance.create = function create(properties) { + return new DatabaseInstance(properties); + }; + + /** + * Encodes the specified DatabaseInstance message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @static + * @param {google.cloud.sql.v1beta4.IDatabaseInstance} message DatabaseInstance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabaseInstance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); + if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.databaseVersion); + if (message.settings != null && Object.hasOwnProperty.call(message, "settings")) + $root.google.cloud.sql.v1beta4.Settings.encode(message.settings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.etag); + if (message.failoverReplica != null && Object.hasOwnProperty.call(message, "failoverReplica")) + $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.encode(message.failoverReplica, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.masterInstanceName != null && Object.hasOwnProperty.call(message, "masterInstanceName")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.masterInstanceName); + if (message.replicaNames != null && message.replicaNames.length) + for (var i = 0; i < message.replicaNames.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.replicaNames[i]); + if (message.maxDiskSize != null && Object.hasOwnProperty.call(message, "maxDiskSize")) + $root.google.protobuf.Int64Value.encode(message.maxDiskSize, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.currentDiskSize != null && Object.hasOwnProperty.call(message, "currentDiskSize")) + $root.google.protobuf.Int64Value.encode(message.currentDiskSize, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.ipAddresses != null && message.ipAddresses.length) + for (var i = 0; i < message.ipAddresses.length; ++i) + $root.google.cloud.sql.v1beta4.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) + $root.google.cloud.sql.v1beta4.SslCert.encode(message.serverCaCert, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.instanceType != null && Object.hasOwnProperty.call(message, "instanceType")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.instanceType); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.project); + if (message.ipv6Address != null && Object.hasOwnProperty.call(message, "ipv6Address")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.ipv6Address); + if (message.serviceAccountEmailAddress != null && Object.hasOwnProperty.call(message, "serviceAccountEmailAddress")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.serviceAccountEmailAddress); + if (message.onPremisesConfiguration != null && Object.hasOwnProperty.call(message, "onPremisesConfiguration")) + $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.encode(message.onPremisesConfiguration, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.replicaConfiguration != null && Object.hasOwnProperty.call(message, "replicaConfiguration")) + $root.google.cloud.sql.v1beta4.ReplicaConfiguration.encode(message.replicaConfiguration, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.backendType != null && Object.hasOwnProperty.call(message, "backendType")) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.backendType); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 20, wireType 2 =*/162).string(message.selfLink); + if (message.suspensionReason != null && message.suspensionReason.length) { + writer.uint32(/* id 21, wireType 2 =*/170).fork(); + for (var i = 0; i < message.suspensionReason.length; ++i) + writer.int32(message.suspensionReason[i]); + writer.ldelim(); + } + if (message.connectionName != null && Object.hasOwnProperty.call(message, "connectionName")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.connectionName); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.name); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 24, wireType 2 =*/194).string(message.region); + if (message.gceZone != null && Object.hasOwnProperty.call(message, "gceZone")) + writer.uint32(/* id 25, wireType 2 =*/202).string(message.gceZone); + if (message.diskEncryptionConfiguration != null && Object.hasOwnProperty.call(message, "diskEncryptionConfiguration")) + $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.encode(message.diskEncryptionConfiguration, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); + if (message.diskEncryptionStatus != null && Object.hasOwnProperty.call(message, "diskEncryptionStatus")) + $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.encode(message.diskEncryptionStatus, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + if (message.rootPassword != null && Object.hasOwnProperty.call(message, "rootPassword")) + writer.uint32(/* id 29, wireType 2 =*/234).string(message.rootPassword); + if (message.scheduledMaintenance != null && Object.hasOwnProperty.call(message, "scheduledMaintenance")) + $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.encode(message.scheduledMaintenance, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); + if (message.secondaryGceZone != null && Object.hasOwnProperty.call(message, "secondaryGceZone")) + writer.uint32(/* id 34, wireType 2 =*/274).string(message.secondaryGceZone); + if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) + $root.google.protobuf.BoolValue.encode(message.satisfiesPzs, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + if (message.outOfDiskReport != null && Object.hasOwnProperty.call(message, "outOfDiskReport")) + $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.encode(message.outOfDiskReport, writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); + if (message.databaseInstalledVersion != null && Object.hasOwnProperty.call(message, "databaseInstalledVersion")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.databaseInstalledVersion); + if (message.availableMaintenanceVersions != null && message.availableMaintenanceVersions.length) + for (var i = 0; i < message.availableMaintenanceVersions.length; ++i) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.availableMaintenanceVersions[i]); + if (message.maintenanceVersion != null && Object.hasOwnProperty.call(message, "maintenanceVersion")) + writer.uint32(/* id 42, wireType 2 =*/338).string(message.maintenanceVersion); + if (message.upgradableDatabaseVersions != null && message.upgradableDatabaseVersions.length) + for (var i = 0; i < message.upgradableDatabaseVersions.length; ++i) + $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion.encode(message.upgradableDatabaseVersions[i], writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); + if (message.sqlNetworkArchitecture != null && Object.hasOwnProperty.call(message, "sqlNetworkArchitecture")) + writer.uint32(/* id 47, wireType 0 =*/376).int32(message.sqlNetworkArchitecture); + if (message.pscServiceAttachmentLink != null && Object.hasOwnProperty.call(message, "pscServiceAttachmentLink")) + writer.uint32(/* id 48, wireType 2 =*/386).string(message.pscServiceAttachmentLink); + if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) + writer.uint32(/* id 49, wireType 2 =*/394).string(message.dnsName); + if (message.primaryDnsName != null && Object.hasOwnProperty.call(message, "primaryDnsName")) + writer.uint32(/* id 51, wireType 2 =*/410).string(message.primaryDnsName); + if (message.writeEndpoint != null && Object.hasOwnProperty.call(message, "writeEndpoint")) + writer.uint32(/* id 52, wireType 2 =*/418).string(message.writeEndpoint); + if (message.replicationCluster != null && Object.hasOwnProperty.call(message, "replicationCluster")) + $root.google.cloud.sql.v1beta4.ReplicationCluster.encode(message.replicationCluster, writer.uint32(/* id 54, wireType 2 =*/434).fork()).ldelim(); + if (message.geminiConfig != null && Object.hasOwnProperty.call(message, "geminiConfig")) + $root.google.cloud.sql.v1beta4.GeminiInstanceConfig.encode(message.geminiConfig, writer.uint32(/* id 55, wireType 2 =*/442).fork()).ldelim(); + if (message.satisfiesPzi != null && Object.hasOwnProperty.call(message, "satisfiesPzi")) + $root.google.protobuf.BoolValue.encode(message.satisfiesPzi, writer.uint32(/* id 56, wireType 2 =*/450).fork()).ldelim(); + if (message.switchTransactionLogsToCloudStorageEnabled != null && Object.hasOwnProperty.call(message, "switchTransactionLogsToCloudStorageEnabled")) + $root.google.protobuf.BoolValue.encode(message.switchTransactionLogsToCloudStorageEnabled, writer.uint32(/* id 57, wireType 2 =*/458).fork()).ldelim(); + if (message.includeReplicasForMajorVersionUpgrade != null && Object.hasOwnProperty.call(message, "includeReplicasForMajorVersionUpgrade")) + $root.google.protobuf.BoolValue.encode(message.includeReplicasForMajorVersionUpgrade, writer.uint32(/* id 59, wireType 2 =*/474).fork()).ldelim(); + if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) + for (var keys = Object.keys(message.tags), i = 0; i < keys.length; ++i) + writer.uint32(/* id 60, wireType 2 =*/482).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.tags[keys[i]]).ldelim(); + if (message.nodeCount != null && Object.hasOwnProperty.call(message, "nodeCount")) + writer.uint32(/* id 63, wireType 0 =*/504).int32(message.nodeCount); + if (message.nodes != null && message.nodes.length) + for (var i = 0; i < message.nodes.length; ++i) + $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.encode(message.nodes[i], writer.uint32(/* id 64, wireType 2 =*/514).fork()).ldelim(); + if (message.dnsNames != null && message.dnsNames.length) + for (var i = 0; i < message.dnsNames.length; ++i) + $root.google.cloud.sql.v1beta4.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 67, wireType 2 =*/538).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DatabaseInstance message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @static + * @param {google.cloud.sql.v1beta4.IDatabaseInstance} message DatabaseInstance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabaseInstance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DatabaseInstance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DatabaseInstance} DatabaseInstance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabaseInstance.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseInstance(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.state = reader.int32(); + break; + } + case 3: { + message.databaseVersion = reader.int32(); + break; + } + case 4: { + message.settings = $root.google.cloud.sql.v1beta4.Settings.decode(reader, reader.uint32()); + break; + } + case 5: { + message.etag = reader.string(); + break; + } + case 6: { + message.failoverReplica = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.decode(reader, reader.uint32()); + break; + } + case 7: { + message.masterInstanceName = reader.string(); + break; + } + case 8: { + if (!(message.replicaNames && message.replicaNames.length)) + message.replicaNames = []; + message.replicaNames.push(reader.string()); + break; + } + case 9: { + message.maxDiskSize = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 10: { + message.currentDiskSize = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 11: { + if (!(message.ipAddresses && message.ipAddresses.length)) + message.ipAddresses = []; + message.ipAddresses.push($root.google.cloud.sql.v1beta4.IpMapping.decode(reader, reader.uint32())); + break; + } + case 12: { + message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32()); + break; + } + case 13: { + message.instanceType = reader.int32(); + break; + } + case 14: { + message.project = reader.string(); + break; + } + case 15: { + message.ipv6Address = reader.string(); + break; + } + case 16: { + message.serviceAccountEmailAddress = reader.string(); + break; + } + case 17: { + message.onPremisesConfiguration = $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.decode(reader, reader.uint32()); + break; + } + case 18: { + message.replicaConfiguration = $root.google.cloud.sql.v1beta4.ReplicaConfiguration.decode(reader, reader.uint32()); + break; + } + case 19: { + message.backendType = reader.int32(); + break; + } + case 20: { + message.selfLink = reader.string(); + break; + } + case 21: { + if (!(message.suspensionReason && message.suspensionReason.length)) + message.suspensionReason = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.suspensionReason.push(reader.int32()); + } else + message.suspensionReason.push(reader.int32()); + break; + } + case 22: { + message.connectionName = reader.string(); + break; + } + case 23: { + message.name = reader.string(); + break; + } + case 24: { + message.region = reader.string(); + break; + } + case 25: { + message.gceZone = reader.string(); + break; + } + case 34: { + message.secondaryGceZone = reader.string(); + break; + } + case 26: { + message.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.decode(reader, reader.uint32()); + break; + } + case 27: { + message.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.decode(reader, reader.uint32()); + break; + } + case 29: { + message.rootPassword = reader.string(); + break; + } + case 30: { + message.scheduledMaintenance = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.decode(reader, reader.uint32()); + break; + } + case 35: { + message.satisfiesPzs = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 40: { + message.databaseInstalledVersion = reader.string(); + break; + } + case 38: { + message.outOfDiskReport = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.decode(reader, reader.uint32()); + break; + } + case 39: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 41: { + if (!(message.availableMaintenanceVersions && message.availableMaintenanceVersions.length)) + message.availableMaintenanceVersions = []; + message.availableMaintenanceVersions.push(reader.string()); + break; + } + case 42: { + message.maintenanceVersion = reader.string(); + break; + } + case 45: { + if (!(message.upgradableDatabaseVersions && message.upgradableDatabaseVersions.length)) + message.upgradableDatabaseVersions = []; + message.upgradableDatabaseVersions.push($root.google.cloud.sql.v1beta4.AvailableDatabaseVersion.decode(reader, reader.uint32())); + break; + } + case 47: { + message.sqlNetworkArchitecture = reader.int32(); + break; + } + case 48: { + message.pscServiceAttachmentLink = reader.string(); + break; + } + case 49: { + message.dnsName = reader.string(); + break; + } + case 51: { + message.primaryDnsName = reader.string(); + break; + } + case 52: { + message.writeEndpoint = reader.string(); + break; + } + case 54: { + message.replicationCluster = $root.google.cloud.sql.v1beta4.ReplicationCluster.decode(reader, reader.uint32()); + break; + } + case 55: { + message.geminiConfig = $root.google.cloud.sql.v1beta4.GeminiInstanceConfig.decode(reader, reader.uint32()); + break; + } + case 56: { + message.satisfiesPzi = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 57: { + message.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 59: { + message.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 60: { + if (message.tags === $util.emptyObject) + message.tags = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.tags[key] = value; + break; + } + case 63: { + message.nodeCount = reader.int32(); + break; + } + case 64: { + if (!(message.nodes && message.nodes.length)) + message.nodes = []; + message.nodes.push($root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.decode(reader, reader.uint32())); + break; + } + case 67: { + if (!(message.dnsNames && message.dnsNames.length)) + message.dnsNames = []; + message.dnsNames.push($root.google.cloud.sql.v1beta4.DnsNameMapping.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DatabaseInstance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DatabaseInstance} DatabaseInstance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabaseInstance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DatabaseInstance message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DatabaseInstance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + switch (message.databaseVersion) { + default: + return "databaseVersion: enum value expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + break; + } + if (message.settings != null && message.hasOwnProperty("settings")) { + var error = $root.google.cloud.sql.v1beta4.Settings.verify(message.settings); + if (error) + return "settings." + error; + } + if (message.etag != null && message.hasOwnProperty("etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + if (message.failoverReplica != null && message.hasOwnProperty("failoverReplica")) { + var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.verify(message.failoverReplica); + if (error) + return "failoverReplica." + error; + } + if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) + if (!$util.isString(message.masterInstanceName)) + return "masterInstanceName: string expected"; + if (message.replicaNames != null && message.hasOwnProperty("replicaNames")) { + if (!Array.isArray(message.replicaNames)) + return "replicaNames: array expected"; + for (var i = 0; i < message.replicaNames.length; ++i) + if (!$util.isString(message.replicaNames[i])) + return "replicaNames: string[] expected"; + } + if (message.maxDiskSize != null && message.hasOwnProperty("maxDiskSize")) { + var error = $root.google.protobuf.Int64Value.verify(message.maxDiskSize); + if (error) + return "maxDiskSize." + error; + } + if (message.currentDiskSize != null && message.hasOwnProperty("currentDiskSize")) { + var error = $root.google.protobuf.Int64Value.verify(message.currentDiskSize); + if (error) + return "currentDiskSize." + error; + } + if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { + if (!Array.isArray(message.ipAddresses)) + return "ipAddresses: array expected"; + for (var i = 0; i < message.ipAddresses.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.IpMapping.verify(message.ipAddresses[i]); + if (error) + return "ipAddresses." + error; + } + } + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { + var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.serverCaCert); + if (error) + return "serverCaCert." + error; + } + if (message.instanceType != null && message.hasOwnProperty("instanceType")) + switch (message.instanceType) { + default: + return "instanceType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 5: + break; + } + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.ipv6Address != null && message.hasOwnProperty("ipv6Address")) + if (!$util.isString(message.ipv6Address)) + return "ipv6Address: string expected"; + if (message.serviceAccountEmailAddress != null && message.hasOwnProperty("serviceAccountEmailAddress")) + if (!$util.isString(message.serviceAccountEmailAddress)) + return "serviceAccountEmailAddress: string expected"; + if (message.onPremisesConfiguration != null && message.hasOwnProperty("onPremisesConfiguration")) { + var error = $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.verify(message.onPremisesConfiguration); + if (error) + return "onPremisesConfiguration." + error; + } + if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) { + var error = $root.google.cloud.sql.v1beta4.ReplicaConfiguration.verify(message.replicaConfiguration); + if (error) + return "replicaConfiguration." + error; + } + if (message.backendType != null && message.hasOwnProperty("backendType")) + switch (message.backendType) { + default: + return "backendType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + if (message.suspensionReason != null && message.hasOwnProperty("suspensionReason")) { + if (!Array.isArray(message.suspensionReason)) + return "suspensionReason: array expected"; + for (var i = 0; i < message.suspensionReason.length; ++i) + switch (message.suspensionReason[i]) { + default: + return "suspensionReason: enum value[] expected"; + case 0: + case 2: + case 3: + case 4: + case 5: + break; + } + } + if (message.connectionName != null && message.hasOwnProperty("connectionName")) + if (!$util.isString(message.connectionName)) + return "connectionName: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.region != null && message.hasOwnProperty("region")) + if (!$util.isString(message.region)) + return "region: string expected"; + if (message.gceZone != null && message.hasOwnProperty("gceZone")) + if (!$util.isString(message.gceZone)) + return "gceZone: string expected"; + if (message.secondaryGceZone != null && message.hasOwnProperty("secondaryGceZone")) + if (!$util.isString(message.secondaryGceZone)) + return "secondaryGceZone: string expected"; + if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) { + var error = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify(message.diskEncryptionConfiguration); + if (error) + return "diskEncryptionConfiguration." + error; + } + if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) { + var error = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.verify(message.diskEncryptionStatus); + if (error) + return "diskEncryptionStatus." + error; + } + if (message.rootPassword != null && message.hasOwnProperty("rootPassword")) + if (!$util.isString(message.rootPassword)) + return "rootPassword: string expected"; + if (message.scheduledMaintenance != null && message.hasOwnProperty("scheduledMaintenance")) { + var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.verify(message.scheduledMaintenance); + if (error) + return "scheduledMaintenance." + error; + } + if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) { + var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzs); + if (error) + return "satisfiesPzs." + error; + } + if (message.databaseInstalledVersion != null && message.hasOwnProperty("databaseInstalledVersion")) + if (!$util.isString(message.databaseInstalledVersion)) + return "databaseInstalledVersion: string expected"; + if (message.outOfDiskReport != null && message.hasOwnProperty("outOfDiskReport")) { + properties._outOfDiskReport = 1; + { + var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.verify(message.outOfDiskReport); + if (error) + return "outOfDiskReport." + error; + } + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.availableMaintenanceVersions != null && message.hasOwnProperty("availableMaintenanceVersions")) { + if (!Array.isArray(message.availableMaintenanceVersions)) + return "availableMaintenanceVersions: array expected"; + for (var i = 0; i < message.availableMaintenanceVersions.length; ++i) + if (!$util.isString(message.availableMaintenanceVersions[i])) + return "availableMaintenanceVersions: string[] expected"; + } + if (message.maintenanceVersion != null && message.hasOwnProperty("maintenanceVersion")) + if (!$util.isString(message.maintenanceVersion)) + return "maintenanceVersion: string expected"; + if (message.upgradableDatabaseVersions != null && message.hasOwnProperty("upgradableDatabaseVersions")) { + if (!Array.isArray(message.upgradableDatabaseVersions)) + return "upgradableDatabaseVersions: array expected"; + for (var i = 0; i < message.upgradableDatabaseVersions.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion.verify(message.upgradableDatabaseVersions[i]); + if (error) + return "upgradableDatabaseVersions." + error; + } + } + if (message.sqlNetworkArchitecture != null && message.hasOwnProperty("sqlNetworkArchitecture")) { + properties._sqlNetworkArchitecture = 1; + switch (message.sqlNetworkArchitecture) { + default: + return "sqlNetworkArchitecture: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { + properties._pscServiceAttachmentLink = 1; + if (!$util.isString(message.pscServiceAttachmentLink)) + return "pscServiceAttachmentLink: string expected"; + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + properties._dnsName = 1; + if (!$util.isString(message.dnsName)) + return "dnsName: string expected"; + } + if (message.primaryDnsName != null && message.hasOwnProperty("primaryDnsName")) { + properties._primaryDnsName = 1; + if (!$util.isString(message.primaryDnsName)) + return "primaryDnsName: string expected"; + } + if (message.writeEndpoint != null && message.hasOwnProperty("writeEndpoint")) { + properties._writeEndpoint = 1; + if (!$util.isString(message.writeEndpoint)) + return "writeEndpoint: string expected"; + } + if (message.replicationCluster != null && message.hasOwnProperty("replicationCluster")) { + properties._replicationCluster = 1; + { + var error = $root.google.cloud.sql.v1beta4.ReplicationCluster.verify(message.replicationCluster); + if (error) + return "replicationCluster." + error; + } + } + if (message.geminiConfig != null && message.hasOwnProperty("geminiConfig")) { + properties._geminiConfig = 1; + { + var error = $root.google.cloud.sql.v1beta4.GeminiInstanceConfig.verify(message.geminiConfig); + if (error) + return "geminiConfig." + error; + } + } + if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) { + var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzi); + if (error) + return "satisfiesPzi." + error; + } + if (message.switchTransactionLogsToCloudStorageEnabled != null && message.hasOwnProperty("switchTransactionLogsToCloudStorageEnabled")) { + properties._switchTransactionLogsToCloudStorageEnabled = 1; + { + var error = $root.google.protobuf.BoolValue.verify(message.switchTransactionLogsToCloudStorageEnabled); + if (error) + return "switchTransactionLogsToCloudStorageEnabled." + error; + } + } + if (message.includeReplicasForMajorVersionUpgrade != null && message.hasOwnProperty("includeReplicasForMajorVersionUpgrade")) { + properties._includeReplicasForMajorVersionUpgrade = 1; + { + var error = $root.google.protobuf.BoolValue.verify(message.includeReplicasForMajorVersionUpgrade); + if (error) + return "includeReplicasForMajorVersionUpgrade." + error; + } + } + if (message.tags != null && message.hasOwnProperty("tags")) { + if (!$util.isObject(message.tags)) + return "tags: object expected"; + var key = Object.keys(message.tags); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.tags[key[i]])) + return "tags: string{k:string} expected"; + } + if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { + properties._nodeCount = 1; + if (!$util.isInteger(message.nodeCount)) + return "nodeCount: integer expected"; + } + if (message.nodes != null && message.hasOwnProperty("nodes")) { + if (!Array.isArray(message.nodes)) + return "nodes: array expected"; + for (var i = 0; i < message.nodes.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.verify(message.nodes[i]); + if (error) + return "nodes." + error; + } + } + if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { + if (!Array.isArray(message.dnsNames)) + return "dnsNames: array expected"; + for (var i = 0; i < message.dnsNames.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.DnsNameMapping.verify(message.dnsNames[i]); + if (error) + return "dnsNames." + error; + } + } + return null; + }; + + /** + * Creates a DatabaseInstance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DatabaseInstance} DatabaseInstance + */ + DatabaseInstance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseInstance) + return object; + var message = new $root.google.cloud.sql.v1beta4.DatabaseInstance(); + if (object.kind != null) + message.kind = String(object.kind); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "SQL_INSTANCE_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNABLE": + case 1: + message.state = 1; + break; + case "SUSPENDED": + case 2: + message.state = 2; + break; + case "PENDING_DELETE": + case 3: + message.state = 3; + break; + case "PENDING_CREATE": + case 4: + message.state = 4; + break; + case "MAINTENANCE": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + case "ONLINE_MAINTENANCE": + case 7: + message.state = 7; + break; + case "REPAIRING": + case 8: + message.state = 8; + break; + } + switch (object.databaseVersion) { + default: + if (typeof object.databaseVersion === "number") { + message.databaseVersion = object.databaseVersion; + break; + } + break; + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.databaseVersion = 0; + break; + case "MYSQL_5_1": + case 2: + message.databaseVersion = 2; + break; + case "MYSQL_5_5": + case 3: + message.databaseVersion = 3; + break; + case "MYSQL_5_6": + case 5: + message.databaseVersion = 5; + break; + case "MYSQL_5_7": + case 6: + message.databaseVersion = 6; + break; + case "MYSQL_8_0": + case 20: + message.databaseVersion = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.databaseVersion = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.databaseVersion = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.databaseVersion = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.databaseVersion = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.databaseVersion = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.databaseVersion = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.databaseVersion = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.databaseVersion = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.databaseVersion = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.databaseVersion = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.databaseVersion = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.databaseVersion = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.databaseVersion = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.databaseVersion = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.databaseVersion = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.databaseVersion = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.databaseVersion = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.databaseVersion = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.databaseVersion = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.databaseVersion = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.databaseVersion = 556; + break; + case "MYSQL_8_4": + case 398: + message.databaseVersion = 398; + break; + case "MYSQL_9_7": + case 654: + message.databaseVersion = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.databaseVersion = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.databaseVersion = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.databaseVersion = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.databaseVersion = 16; + break; + case "POSTGRES_9_6": + case 9: + message.databaseVersion = 9; + break; + case "POSTGRES_10": + case 18: + message.databaseVersion = 18; + break; + case "POSTGRES_11": + case 10: + message.databaseVersion = 10; + break; + case "POSTGRES_12": + case 19: + message.databaseVersion = 19; + break; + case "POSTGRES_13": + case 23: + message.databaseVersion = 23; + break; + case "POSTGRES_14": + case 110: + message.databaseVersion = 110; + break; + case "POSTGRES_15": + case 172: + message.databaseVersion = 172; + break; + case "POSTGRES_16": + case 272: + message.databaseVersion = 272; + break; + case "POSTGRES_17": + case 408: + message.databaseVersion = 408; + break; + case "POSTGRES_18": + case 557: + message.databaseVersion = 557; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.databaseVersion = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.databaseVersion = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.databaseVersion = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.databaseVersion = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.databaseVersion = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.databaseVersion = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.databaseVersion = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.databaseVersion = 202; + break; + } + if (object.settings != null) { + if (typeof object.settings !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.settings: object expected"); + message.settings = $root.google.cloud.sql.v1beta4.Settings.fromObject(object.settings); + } + if (object.etag != null) + message.etag = String(object.etag); + if (object.failoverReplica != null) { + if (typeof object.failoverReplica !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.failoverReplica: object expected"); + message.failoverReplica = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.fromObject(object.failoverReplica); + } + if (object.masterInstanceName != null) + message.masterInstanceName = String(object.masterInstanceName); + if (object.replicaNames) { + if (!Array.isArray(object.replicaNames)) + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.replicaNames: array expected"); + message.replicaNames = []; + for (var i = 0; i < object.replicaNames.length; ++i) + message.replicaNames[i] = String(object.replicaNames[i]); + } + if (object.maxDiskSize != null) { + if (typeof object.maxDiskSize !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.maxDiskSize: object expected"); + message.maxDiskSize = $root.google.protobuf.Int64Value.fromObject(object.maxDiskSize); + } + if (object.currentDiskSize != null) { + if (typeof object.currentDiskSize !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.currentDiskSize: object expected"); + message.currentDiskSize = $root.google.protobuf.Int64Value.fromObject(object.currentDiskSize); + } + if (object.ipAddresses) { + if (!Array.isArray(object.ipAddresses)) + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.ipAddresses: array expected"); + message.ipAddresses = []; + for (var i = 0; i < object.ipAddresses.length; ++i) { + if (typeof object.ipAddresses[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.ipAddresses: object expected"); + message.ipAddresses[i] = $root.google.cloud.sql.v1beta4.IpMapping.fromObject(object.ipAddresses[i]); + } + } + if (object.serverCaCert != null) { + if (typeof object.serverCaCert !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.serverCaCert: object expected"); + message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.serverCaCert); + } + switch (object.instanceType) { + default: + if (typeof object.instanceType === "number") { + message.instanceType = object.instanceType; + break; + } + break; + case "SQL_INSTANCE_TYPE_UNSPECIFIED": + case 0: + message.instanceType = 0; + break; + case "CLOUD_SQL_INSTANCE": + case 1: + message.instanceType = 1; + break; + case "ON_PREMISES_INSTANCE": + case 2: + message.instanceType = 2; + break; + case "READ_REPLICA_INSTANCE": + case 3: + message.instanceType = 3; + break; + case "READ_POOL_INSTANCE": + case 5: + message.instanceType = 5; + break; + } + if (object.project != null) + message.project = String(object.project); + if (object.ipv6Address != null) + message.ipv6Address = String(object.ipv6Address); + if (object.serviceAccountEmailAddress != null) + message.serviceAccountEmailAddress = String(object.serviceAccountEmailAddress); + if (object.onPremisesConfiguration != null) { + if (typeof object.onPremisesConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.onPremisesConfiguration: object expected"); + message.onPremisesConfiguration = $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.fromObject(object.onPremisesConfiguration); + } + if (object.replicaConfiguration != null) { + if (typeof object.replicaConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.replicaConfiguration: object expected"); + message.replicaConfiguration = $root.google.cloud.sql.v1beta4.ReplicaConfiguration.fromObject(object.replicaConfiguration); + } + switch (object.backendType) { + default: + if (typeof object.backendType === "number") { + message.backendType = object.backendType; + break; + } + break; + case "SQL_BACKEND_TYPE_UNSPECIFIED": + case 0: + message.backendType = 0; + break; + case "FIRST_GEN": + case 1: + message.backendType = 1; + break; + case "SECOND_GEN": + case 2: + message.backendType = 2; + break; + case "EXTERNAL": + case 3: + message.backendType = 3; + break; + } + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + if (object.suspensionReason) { + if (!Array.isArray(object.suspensionReason)) + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.suspensionReason: array expected"); + message.suspensionReason = []; + for (var i = 0; i < object.suspensionReason.length; ++i) + switch (object.suspensionReason[i]) { + default: + if (typeof object.suspensionReason[i] === "number") { + message.suspensionReason[i] = object.suspensionReason[i]; + break; + } + case "SQL_SUSPENSION_REASON_UNSPECIFIED": + case 0: + message.suspensionReason[i] = 0; + break; + case "BILLING_ISSUE": + case 2: + message.suspensionReason[i] = 2; + break; + case "LEGAL_ISSUE": + case 3: + message.suspensionReason[i] = 3; + break; + case "OPERATIONAL_ISSUE": + case 4: + message.suspensionReason[i] = 4; + break; + case "KMS_KEY_ISSUE": + case 5: + message.suspensionReason[i] = 5; + break; + } + } + if (object.connectionName != null) + message.connectionName = String(object.connectionName); + if (object.name != null) + message.name = String(object.name); + if (object.region != null) + message.region = String(object.region); + if (object.gceZone != null) + message.gceZone = String(object.gceZone); + if (object.secondaryGceZone != null) + message.secondaryGceZone = String(object.secondaryGceZone); + if (object.diskEncryptionConfiguration != null) { + if (typeof object.diskEncryptionConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.diskEncryptionConfiguration: object expected"); + message.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.fromObject(object.diskEncryptionConfiguration); + } + if (object.diskEncryptionStatus != null) { + if (typeof object.diskEncryptionStatus !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.diskEncryptionStatus: object expected"); + message.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.fromObject(object.diskEncryptionStatus); + } + if (object.rootPassword != null) + message.rootPassword = String(object.rootPassword); + if (object.scheduledMaintenance != null) { + if (typeof object.scheduledMaintenance !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.scheduledMaintenance: object expected"); + message.scheduledMaintenance = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.fromObject(object.scheduledMaintenance); + } + if (object.satisfiesPzs != null) { + if (typeof object.satisfiesPzs !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.satisfiesPzs: object expected"); + message.satisfiesPzs = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzs); + } + if (object.databaseInstalledVersion != null) + message.databaseInstalledVersion = String(object.databaseInstalledVersion); + if (object.outOfDiskReport != null) { + if (typeof object.outOfDiskReport !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.outOfDiskReport: object expected"); + message.outOfDiskReport = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.fromObject(object.outOfDiskReport); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.availableMaintenanceVersions) { + if (!Array.isArray(object.availableMaintenanceVersions)) + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.availableMaintenanceVersions: array expected"); + message.availableMaintenanceVersions = []; + for (var i = 0; i < object.availableMaintenanceVersions.length; ++i) + message.availableMaintenanceVersions[i] = String(object.availableMaintenanceVersions[i]); + } + if (object.maintenanceVersion != null) + message.maintenanceVersion = String(object.maintenanceVersion); + if (object.upgradableDatabaseVersions) { + if (!Array.isArray(object.upgradableDatabaseVersions)) + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.upgradableDatabaseVersions: array expected"); + message.upgradableDatabaseVersions = []; + for (var i = 0; i < object.upgradableDatabaseVersions.length; ++i) { + if (typeof object.upgradableDatabaseVersions[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.upgradableDatabaseVersions: object expected"); + message.upgradableDatabaseVersions[i] = $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion.fromObject(object.upgradableDatabaseVersions[i]); + } + } + switch (object.sqlNetworkArchitecture) { + default: + if (typeof object.sqlNetworkArchitecture === "number") { + message.sqlNetworkArchitecture = object.sqlNetworkArchitecture; + break; + } + break; + case "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED": + case 0: + message.sqlNetworkArchitecture = 0; + break; + case "NEW_NETWORK_ARCHITECTURE": + case 1: + message.sqlNetworkArchitecture = 1; + break; + case "OLD_NETWORK_ARCHITECTURE": + case 2: + message.sqlNetworkArchitecture = 2; + break; + } + if (object.pscServiceAttachmentLink != null) + message.pscServiceAttachmentLink = String(object.pscServiceAttachmentLink); + if (object.dnsName != null) + message.dnsName = String(object.dnsName); + if (object.primaryDnsName != null) + message.primaryDnsName = String(object.primaryDnsName); + if (object.writeEndpoint != null) + message.writeEndpoint = String(object.writeEndpoint); + if (object.replicationCluster != null) { + if (typeof object.replicationCluster !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.replicationCluster: object expected"); + message.replicationCluster = $root.google.cloud.sql.v1beta4.ReplicationCluster.fromObject(object.replicationCluster); + } + if (object.geminiConfig != null) { + if (typeof object.geminiConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.geminiConfig: object expected"); + message.geminiConfig = $root.google.cloud.sql.v1beta4.GeminiInstanceConfig.fromObject(object.geminiConfig); + } + if (object.satisfiesPzi != null) { + if (typeof object.satisfiesPzi !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.satisfiesPzi: object expected"); + message.satisfiesPzi = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzi); + } + if (object.switchTransactionLogsToCloudStorageEnabled != null) { + if (typeof object.switchTransactionLogsToCloudStorageEnabled !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.switchTransactionLogsToCloudStorageEnabled: object expected"); + message.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.fromObject(object.switchTransactionLogsToCloudStorageEnabled); + } + if (object.includeReplicasForMajorVersionUpgrade != null) { + if (typeof object.includeReplicasForMajorVersionUpgrade !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.includeReplicasForMajorVersionUpgrade: object expected"); + message.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.fromObject(object.includeReplicasForMajorVersionUpgrade); + } + if (object.tags) { + if (typeof object.tags !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.tags: object expected"); + message.tags = {}; + for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) + message.tags[keys[i]] = String(object.tags[keys[i]]); + } + if (object.nodeCount != null) + message.nodeCount = object.nodeCount | 0; + if (object.nodes) { + if (!Array.isArray(object.nodes)) + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.nodes: array expected"); + message.nodes = []; + for (var i = 0; i < object.nodes.length; ++i) { + if (typeof object.nodes[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.nodes: object expected"); + message.nodes[i] = $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.fromObject(object.nodes[i]); + } + } + if (object.dnsNames) { + if (!Array.isArray(object.dnsNames)) + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.dnsNames: array expected"); + message.dnsNames = []; + for (var i = 0; i < object.dnsNames.length; ++i) { + if (typeof object.dnsNames[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.dnsNames: object expected"); + message.dnsNames[i] = $root.google.cloud.sql.v1beta4.DnsNameMapping.fromObject(object.dnsNames[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DatabaseInstance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance} message DatabaseInstance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DatabaseInstance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.replicaNames = []; + object.ipAddresses = []; + object.suspensionReason = []; + object.availableMaintenanceVersions = []; + object.upgradableDatabaseVersions = []; + object.nodes = []; + object.dnsNames = []; + } + if (options.objects || options.defaults) + object.tags = {}; + if (options.defaults) { + object.kind = ""; + object.state = options.enums === String ? "SQL_INSTANCE_STATE_UNSPECIFIED" : 0; + object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; + object.settings = null; + object.etag = ""; + object.failoverReplica = null; + object.masterInstanceName = ""; + object.maxDiskSize = null; + object.currentDiskSize = null; + object.serverCaCert = null; + object.instanceType = options.enums === String ? "SQL_INSTANCE_TYPE_UNSPECIFIED" : 0; + object.project = ""; + object.ipv6Address = ""; + object.serviceAccountEmailAddress = ""; + object.onPremisesConfiguration = null; + object.replicaConfiguration = null; + object.backendType = options.enums === String ? "SQL_BACKEND_TYPE_UNSPECIFIED" : 0; + object.selfLink = ""; + object.connectionName = ""; + object.name = ""; + object.region = ""; + object.gceZone = ""; + object.diskEncryptionConfiguration = null; + object.diskEncryptionStatus = null; + object.rootPassword = ""; + object.scheduledMaintenance = null; + object.secondaryGceZone = ""; + object.satisfiesPzs = null; + object.createTime = null; + object.databaseInstalledVersion = ""; + object.maintenanceVersion = ""; + object.satisfiesPzi = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState[message.state] : message.state; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; + if (message.settings != null && message.hasOwnProperty("settings")) + object.settings = $root.google.cloud.sql.v1beta4.Settings.toObject(message.settings, options); + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = message.etag; + if (message.failoverReplica != null && message.hasOwnProperty("failoverReplica")) + object.failoverReplica = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.toObject(message.failoverReplica, options); + if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) + object.masterInstanceName = message.masterInstanceName; + if (message.replicaNames && message.replicaNames.length) { + object.replicaNames = []; + for (var j = 0; j < message.replicaNames.length; ++j) + object.replicaNames[j] = message.replicaNames[j]; + } + if (message.maxDiskSize != null && message.hasOwnProperty("maxDiskSize")) + object.maxDiskSize = $root.google.protobuf.Int64Value.toObject(message.maxDiskSize, options); + if (message.currentDiskSize != null && message.hasOwnProperty("currentDiskSize")) + object.currentDiskSize = $root.google.protobuf.Int64Value.toObject(message.currentDiskSize, options); + if (message.ipAddresses && message.ipAddresses.length) { + object.ipAddresses = []; + for (var j = 0; j < message.ipAddresses.length; ++j) + object.ipAddresses[j] = $root.google.cloud.sql.v1beta4.IpMapping.toObject(message.ipAddresses[j], options); + } + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) + object.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.serverCaCert, options); + if (message.instanceType != null && message.hasOwnProperty("instanceType")) + object.instanceType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstanceType[message.instanceType] === undefined ? message.instanceType : $root.google.cloud.sql.v1beta4.SqlInstanceType[message.instanceType] : message.instanceType; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.ipv6Address != null && message.hasOwnProperty("ipv6Address")) + object.ipv6Address = message.ipv6Address; + if (message.serviceAccountEmailAddress != null && message.hasOwnProperty("serviceAccountEmailAddress")) + object.serviceAccountEmailAddress = message.serviceAccountEmailAddress; + if (message.onPremisesConfiguration != null && message.hasOwnProperty("onPremisesConfiguration")) + object.onPremisesConfiguration = $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.toObject(message.onPremisesConfiguration, options); + if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) + object.replicaConfiguration = $root.google.cloud.sql.v1beta4.ReplicaConfiguration.toObject(message.replicaConfiguration, options); + if (message.backendType != null && message.hasOwnProperty("backendType")) + object.backendType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackendType[message.backendType] === undefined ? message.backendType : $root.google.cloud.sql.v1beta4.SqlBackendType[message.backendType] : message.backendType; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + if (message.suspensionReason && message.suspensionReason.length) { + object.suspensionReason = []; + for (var j = 0; j < message.suspensionReason.length; ++j) + object.suspensionReason[j] = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlSuspensionReason[message.suspensionReason[j]] === undefined ? message.suspensionReason[j] : $root.google.cloud.sql.v1beta4.SqlSuspensionReason[message.suspensionReason[j]] : message.suspensionReason[j]; + } + if (message.connectionName != null && message.hasOwnProperty("connectionName")) + object.connectionName = message.connectionName; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.region != null && message.hasOwnProperty("region")) + object.region = message.region; + if (message.gceZone != null && message.hasOwnProperty("gceZone")) + object.gceZone = message.gceZone; + if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) + object.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.toObject(message.diskEncryptionConfiguration, options); + if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) + object.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.toObject(message.diskEncryptionStatus, options); + if (message.rootPassword != null && message.hasOwnProperty("rootPassword")) + object.rootPassword = message.rootPassword; + if (message.scheduledMaintenance != null && message.hasOwnProperty("scheduledMaintenance")) + object.scheduledMaintenance = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.toObject(message.scheduledMaintenance, options); + if (message.secondaryGceZone != null && message.hasOwnProperty("secondaryGceZone")) + object.secondaryGceZone = message.secondaryGceZone; + if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) + object.satisfiesPzs = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzs, options); + if (message.outOfDiskReport != null && message.hasOwnProperty("outOfDiskReport")) { + object.outOfDiskReport = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.toObject(message.outOfDiskReport, options); + if (options.oneofs) + object._outOfDiskReport = "outOfDiskReport"; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.databaseInstalledVersion != null && message.hasOwnProperty("databaseInstalledVersion")) + object.databaseInstalledVersion = message.databaseInstalledVersion; + if (message.availableMaintenanceVersions && message.availableMaintenanceVersions.length) { + object.availableMaintenanceVersions = []; + for (var j = 0; j < message.availableMaintenanceVersions.length; ++j) + object.availableMaintenanceVersions[j] = message.availableMaintenanceVersions[j]; + } + if (message.maintenanceVersion != null && message.hasOwnProperty("maintenanceVersion")) + object.maintenanceVersion = message.maintenanceVersion; + if (message.upgradableDatabaseVersions && message.upgradableDatabaseVersions.length) { + object.upgradableDatabaseVersions = []; + for (var j = 0; j < message.upgradableDatabaseVersions.length; ++j) + object.upgradableDatabaseVersions[j] = $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion.toObject(message.upgradableDatabaseVersions[j], options); + } + if (message.sqlNetworkArchitecture != null && message.hasOwnProperty("sqlNetworkArchitecture")) { + object.sqlNetworkArchitecture = options.enums === String ? $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture[message.sqlNetworkArchitecture] === undefined ? message.sqlNetworkArchitecture : $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture[message.sqlNetworkArchitecture] : message.sqlNetworkArchitecture; + if (options.oneofs) + object._sqlNetworkArchitecture = "sqlNetworkArchitecture"; + } + if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { + object.pscServiceAttachmentLink = message.pscServiceAttachmentLink; + if (options.oneofs) + object._pscServiceAttachmentLink = "pscServiceAttachmentLink"; + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + object.dnsName = message.dnsName; + if (options.oneofs) + object._dnsName = "dnsName"; + } + if (message.primaryDnsName != null && message.hasOwnProperty("primaryDnsName")) { + object.primaryDnsName = message.primaryDnsName; + if (options.oneofs) + object._primaryDnsName = "primaryDnsName"; + } + if (message.writeEndpoint != null && message.hasOwnProperty("writeEndpoint")) { + object.writeEndpoint = message.writeEndpoint; + if (options.oneofs) + object._writeEndpoint = "writeEndpoint"; + } + if (message.replicationCluster != null && message.hasOwnProperty("replicationCluster")) { + object.replicationCluster = $root.google.cloud.sql.v1beta4.ReplicationCluster.toObject(message.replicationCluster, options); + if (options.oneofs) + object._replicationCluster = "replicationCluster"; + } + if (message.geminiConfig != null && message.hasOwnProperty("geminiConfig")) { + object.geminiConfig = $root.google.cloud.sql.v1beta4.GeminiInstanceConfig.toObject(message.geminiConfig, options); + if (options.oneofs) + object._geminiConfig = "geminiConfig"; + } + if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) + object.satisfiesPzi = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzi, options); + if (message.switchTransactionLogsToCloudStorageEnabled != null && message.hasOwnProperty("switchTransactionLogsToCloudStorageEnabled")) { + object.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.toObject(message.switchTransactionLogsToCloudStorageEnabled, options); + if (options.oneofs) + object._switchTransactionLogsToCloudStorageEnabled = "switchTransactionLogsToCloudStorageEnabled"; + } + if (message.includeReplicasForMajorVersionUpgrade != null && message.hasOwnProperty("includeReplicasForMajorVersionUpgrade")) { + object.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.toObject(message.includeReplicasForMajorVersionUpgrade, options); + if (options.oneofs) + object._includeReplicasForMajorVersionUpgrade = "includeReplicasForMajorVersionUpgrade"; + } + var keys2; + if (message.tags && (keys2 = Object.keys(message.tags)).length) { + object.tags = {}; + for (var j = 0; j < keys2.length; ++j) + object.tags[keys2[j]] = message.tags[keys2[j]]; + } + if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { + object.nodeCount = message.nodeCount; + if (options.oneofs) + object._nodeCount = "nodeCount"; + } + if (message.nodes && message.nodes.length) { + object.nodes = []; + for (var j = 0; j < message.nodes.length; ++j) + object.nodes[j] = $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.toObject(message.nodes[j], options); + } + if (message.dnsNames && message.dnsNames.length) { + object.dnsNames = []; + for (var j = 0; j < message.dnsNames.length; ++j) + object.dnsNames[j] = $root.google.cloud.sql.v1beta4.DnsNameMapping.toObject(message.dnsNames[j], options); + } + return object; + }; + + /** + * Converts this DatabaseInstance to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @instance + * @returns {Object.} JSON object + */ + DatabaseInstance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DatabaseInstance + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DatabaseInstance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseInstance"; + }; + + /** + * SqlInstanceState enum. + * @name google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState + * @enum {number} + * @property {number} SQL_INSTANCE_STATE_UNSPECIFIED=0 SQL_INSTANCE_STATE_UNSPECIFIED value + * @property {number} RUNNABLE=1 RUNNABLE value + * @property {number} SUSPENDED=2 SUSPENDED value + * @property {number} PENDING_DELETE=3 PENDING_DELETE value + * @property {number} PENDING_CREATE=4 PENDING_CREATE value + * @property {number} MAINTENANCE=5 MAINTENANCE value + * @property {number} FAILED=6 FAILED value + * @property {number} ONLINE_MAINTENANCE=7 ONLINE_MAINTENANCE value + * @property {number} REPAIRING=8 REPAIRING value + */ + DatabaseInstance.SqlInstanceState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_INSTANCE_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "RUNNABLE"] = 1; + values[valuesById[2] = "SUSPENDED"] = 2; + values[valuesById[3] = "PENDING_DELETE"] = 3; + values[valuesById[4] = "PENDING_CREATE"] = 4; + values[valuesById[5] = "MAINTENANCE"] = 5; + values[valuesById[6] = "FAILED"] = 6; + values[valuesById[7] = "ONLINE_MAINTENANCE"] = 7; + values[valuesById[8] = "REPAIRING"] = 8; + return values; + })(); + + DatabaseInstance.SqlFailoverReplica = (function() { + + /** + * Properties of a SqlFailoverReplica. + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @interface ISqlFailoverReplica + * @property {string|null} [name] SqlFailoverReplica name + * @property {google.protobuf.IBoolValue|null} [available] SqlFailoverReplica available + */ + + /** + * Constructs a new SqlFailoverReplica. + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @classdesc Represents a SqlFailoverReplica. + * @implements ISqlFailoverReplica + * @constructor + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica=} [properties] Properties to set + */ + function SqlFailoverReplica(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlFailoverReplica name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @instance + */ + SqlFailoverReplica.prototype.name = ""; + + /** + * SqlFailoverReplica available. + * @member {google.protobuf.IBoolValue|null|undefined} available + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @instance + */ + SqlFailoverReplica.prototype.available = null; + + /** + * Creates a new SqlFailoverReplica instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica instance + */ + SqlFailoverReplica.create = function create(properties) { + return new SqlFailoverReplica(properties); + }; + + /** + * Encodes the specified SqlFailoverReplica message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica} message SqlFailoverReplica message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlFailoverReplica.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.available != null && Object.hasOwnProperty.call(message, "available")) + $root.google.protobuf.BoolValue.encode(message.available, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlFailoverReplica message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica} message SqlFailoverReplica message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlFailoverReplica.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlFailoverReplica message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlFailoverReplica.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.available = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlFailoverReplica message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlFailoverReplica.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlFailoverReplica message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlFailoverReplica.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.available != null && message.hasOwnProperty("available")) { + var error = $root.google.protobuf.BoolValue.verify(message.available); + if (error) + return "available." + error; + } + return null; + }; + + /** + * Creates a SqlFailoverReplica message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica + */ + SqlFailoverReplica.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica) + return object; + var message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica(); + if (object.name != null) + message.name = String(object.name); + if (object.available != null) { + if (typeof object.available !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.available: object expected"); + message.available = $root.google.protobuf.BoolValue.fromObject(object.available); + } + return message; + }; + + /** + * Creates a plain object from a SqlFailoverReplica message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica} message SqlFailoverReplica + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlFailoverReplica.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.available = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.available != null && message.hasOwnProperty("available")) + object.available = $root.google.protobuf.BoolValue.toObject(message.available, options); + return object; + }; + + /** + * Converts this SqlFailoverReplica to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @instance + * @returns {Object.} JSON object + */ + SqlFailoverReplica.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlFailoverReplica + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlFailoverReplica.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica"; + }; + + return SqlFailoverReplica; + })(); + + DatabaseInstance.SqlScheduledMaintenance = (function() { + + /** + * Properties of a SqlScheduledMaintenance. + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @interface ISqlScheduledMaintenance + * @property {google.protobuf.ITimestamp|null} [startTime] SqlScheduledMaintenance startTime + * @property {boolean|null} [canDefer] SqlScheduledMaintenance canDefer + * @property {boolean|null} [canReschedule] SqlScheduledMaintenance canReschedule + * @property {google.protobuf.ITimestamp|null} [scheduleDeadlineTime] SqlScheduledMaintenance scheduleDeadlineTime + */ + + /** + * Constructs a new SqlScheduledMaintenance. + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @classdesc Represents a SqlScheduledMaintenance. + * @implements ISqlScheduledMaintenance + * @constructor + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance=} [properties] Properties to set + */ + function SqlScheduledMaintenance(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlScheduledMaintenance startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @instance + */ + SqlScheduledMaintenance.prototype.startTime = null; + + /** + * SqlScheduledMaintenance canDefer. + * @member {boolean} canDefer + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @instance + */ + SqlScheduledMaintenance.prototype.canDefer = false; + + /** + * SqlScheduledMaintenance canReschedule. + * @member {boolean} canReschedule + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @instance + */ + SqlScheduledMaintenance.prototype.canReschedule = false; + + /** + * SqlScheduledMaintenance scheduleDeadlineTime. + * @member {google.protobuf.ITimestamp|null|undefined} scheduleDeadlineTime + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @instance + */ + SqlScheduledMaintenance.prototype.scheduleDeadlineTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlScheduledMaintenance.prototype, "_scheduleDeadlineTime", { + get: $util.oneOfGetter($oneOfFields = ["scheduleDeadlineTime"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlScheduledMaintenance instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance instance + */ + SqlScheduledMaintenance.create = function create(properties) { + return new SqlScheduledMaintenance(properties); + }; + + /** + * Encodes the specified SqlScheduledMaintenance message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance} message SqlScheduledMaintenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlScheduledMaintenance.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.canDefer != null && Object.hasOwnProperty.call(message, "canDefer")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.canDefer); + if (message.canReschedule != null && Object.hasOwnProperty.call(message, "canReschedule")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.canReschedule); + if (message.scheduleDeadlineTime != null && Object.hasOwnProperty.call(message, "scheduleDeadlineTime")) + $root.google.protobuf.Timestamp.encode(message.scheduleDeadlineTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlScheduledMaintenance message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance} message SqlScheduledMaintenance message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlScheduledMaintenance.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlScheduledMaintenance message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlScheduledMaintenance.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.canDefer = reader.bool(); + break; + } + case 3: { + message.canReschedule = reader.bool(); + break; + } + case 4: { + message.scheduleDeadlineTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlScheduledMaintenance message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlScheduledMaintenance.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlScheduledMaintenance message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlScheduledMaintenance.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.canDefer != null && message.hasOwnProperty("canDefer")) + if (typeof message.canDefer !== "boolean") + return "canDefer: boolean expected"; + if (message.canReschedule != null && message.hasOwnProperty("canReschedule")) + if (typeof message.canReschedule !== "boolean") + return "canReschedule: boolean expected"; + if (message.scheduleDeadlineTime != null && message.hasOwnProperty("scheduleDeadlineTime")) { + properties._scheduleDeadlineTime = 1; + { + var error = $root.google.protobuf.Timestamp.verify(message.scheduleDeadlineTime); + if (error) + return "scheduleDeadlineTime." + error; + } + } + return null; + }; + + /** + * Creates a SqlScheduledMaintenance message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance + */ + SqlScheduledMaintenance.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance) + return object; + var message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.canDefer != null) + message.canDefer = Boolean(object.canDefer); + if (object.canReschedule != null) + message.canReschedule = Boolean(object.canReschedule); + if (object.scheduleDeadlineTime != null) { + if (typeof object.scheduleDeadlineTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.scheduleDeadlineTime: object expected"); + message.scheduleDeadlineTime = $root.google.protobuf.Timestamp.fromObject(object.scheduleDeadlineTime); + } + return message; + }; + + /** + * Creates a plain object from a SqlScheduledMaintenance message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance} message SqlScheduledMaintenance + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlScheduledMaintenance.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.canDefer = false; + object.canReschedule = false; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.canDefer != null && message.hasOwnProperty("canDefer")) + object.canDefer = message.canDefer; + if (message.canReschedule != null && message.hasOwnProperty("canReschedule")) + object.canReschedule = message.canReschedule; + if (message.scheduleDeadlineTime != null && message.hasOwnProperty("scheduleDeadlineTime")) { + object.scheduleDeadlineTime = $root.google.protobuf.Timestamp.toObject(message.scheduleDeadlineTime, options); + if (options.oneofs) + object._scheduleDeadlineTime = "scheduleDeadlineTime"; + } + return object; + }; + + /** + * Converts this SqlScheduledMaintenance to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @instance + * @returns {Object.} JSON object + */ + SqlScheduledMaintenance.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlScheduledMaintenance + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlScheduledMaintenance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance"; + }; + + return SqlScheduledMaintenance; + })(); + + DatabaseInstance.SqlOutOfDiskReport = (function() { + + /** + * Properties of a SqlOutOfDiskReport. + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @interface ISqlOutOfDiskReport + * @property {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null} [sqlOutOfDiskState] SqlOutOfDiskReport sqlOutOfDiskState + * @property {number|null} [sqlMinRecommendedIncreaseSizeGb] SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb + */ + + /** + * Constructs a new SqlOutOfDiskReport. + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @classdesc Represents a SqlOutOfDiskReport. + * @implements ISqlOutOfDiskReport + * @constructor + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport=} [properties] Properties to set + */ + function SqlOutOfDiskReport(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlOutOfDiskReport sqlOutOfDiskState. + * @member {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null|undefined} sqlOutOfDiskState + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @instance + */ + SqlOutOfDiskReport.prototype.sqlOutOfDiskState = null; + + /** + * SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb. + * @member {number|null|undefined} sqlMinRecommendedIncreaseSizeGb + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @instance + */ + SqlOutOfDiskReport.prototype.sqlMinRecommendedIncreaseSizeGb = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlOutOfDiskReport.prototype, "_sqlOutOfDiskState", { + get: $util.oneOfGetter($oneOfFields = ["sqlOutOfDiskState"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlOutOfDiskReport.prototype, "_sqlMinRecommendedIncreaseSizeGb", { + get: $util.oneOfGetter($oneOfFields = ["sqlMinRecommendedIncreaseSizeGb"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlOutOfDiskReport instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport instance + */ + SqlOutOfDiskReport.create = function create(properties) { + return new SqlOutOfDiskReport(properties); + }; + + /** + * Encodes the specified SqlOutOfDiskReport message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport} message SqlOutOfDiskReport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOutOfDiskReport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sqlOutOfDiskState != null && Object.hasOwnProperty.call(message, "sqlOutOfDiskState")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.sqlOutOfDiskState); + if (message.sqlMinRecommendedIncreaseSizeGb != null && Object.hasOwnProperty.call(message, "sqlMinRecommendedIncreaseSizeGb")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sqlMinRecommendedIncreaseSizeGb); + return writer; + }; + + /** + * Encodes the specified SqlOutOfDiskReport message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport} message SqlOutOfDiskReport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlOutOfDiskReport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlOutOfDiskReport message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOutOfDiskReport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.sqlOutOfDiskState = reader.int32(); + break; + } + case 2: { + message.sqlMinRecommendedIncreaseSizeGb = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlOutOfDiskReport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlOutOfDiskReport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlOutOfDiskReport message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlOutOfDiskReport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.sqlOutOfDiskState != null && message.hasOwnProperty("sqlOutOfDiskState")) { + properties._sqlOutOfDiskState = 1; + switch (message.sqlOutOfDiskState) { + default: + return "sqlOutOfDiskState: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.sqlMinRecommendedIncreaseSizeGb != null && message.hasOwnProperty("sqlMinRecommendedIncreaseSizeGb")) { + properties._sqlMinRecommendedIncreaseSizeGb = 1; + if (!$util.isInteger(message.sqlMinRecommendedIncreaseSizeGb)) + return "sqlMinRecommendedIncreaseSizeGb: integer expected"; + } + return null; + }; + + /** + * Creates a SqlOutOfDiskReport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport + */ + SqlOutOfDiskReport.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport) + return object; + var message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport(); + switch (object.sqlOutOfDiskState) { + default: + if (typeof object.sqlOutOfDiskState === "number") { + message.sqlOutOfDiskState = object.sqlOutOfDiskState; + break; + } + break; + case "SQL_OUT_OF_DISK_STATE_UNSPECIFIED": + case 0: + message.sqlOutOfDiskState = 0; + break; + case "NORMAL": + case 1: + message.sqlOutOfDiskState = 1; + break; + case "SOFT_SHUTDOWN": + case 2: + message.sqlOutOfDiskState = 2; + break; + } + if (object.sqlMinRecommendedIncreaseSizeGb != null) + message.sqlMinRecommendedIncreaseSizeGb = object.sqlMinRecommendedIncreaseSizeGb | 0; + return message; + }; + + /** + * Creates a plain object from a SqlOutOfDiskReport message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport} message SqlOutOfDiskReport + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlOutOfDiskReport.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.sqlOutOfDiskState != null && message.hasOwnProperty("sqlOutOfDiskState")) { + object.sqlOutOfDiskState = options.enums === String ? $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState[message.sqlOutOfDiskState] === undefined ? message.sqlOutOfDiskState : $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState[message.sqlOutOfDiskState] : message.sqlOutOfDiskState; + if (options.oneofs) + object._sqlOutOfDiskState = "sqlOutOfDiskState"; + } + if (message.sqlMinRecommendedIncreaseSizeGb != null && message.hasOwnProperty("sqlMinRecommendedIncreaseSizeGb")) { + object.sqlMinRecommendedIncreaseSizeGb = message.sqlMinRecommendedIncreaseSizeGb; + if (options.oneofs) + object._sqlMinRecommendedIncreaseSizeGb = "sqlMinRecommendedIncreaseSizeGb"; + } + return object; + }; + + /** + * Converts this SqlOutOfDiskReport to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @instance + * @returns {Object.} JSON object + */ + SqlOutOfDiskReport.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlOutOfDiskReport + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlOutOfDiskReport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport"; + }; + + /** + * SqlOutOfDiskState enum. + * @name google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState + * @enum {number} + * @property {number} SQL_OUT_OF_DISK_STATE_UNSPECIFIED=0 SQL_OUT_OF_DISK_STATE_UNSPECIFIED value + * @property {number} NORMAL=1 NORMAL value + * @property {number} SOFT_SHUTDOWN=2 SOFT_SHUTDOWN value + */ + SqlOutOfDiskReport.SqlOutOfDiskState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_OUT_OF_DISK_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NORMAL"] = 1; + values[valuesById[2] = "SOFT_SHUTDOWN"] = 2; + return values; + })(); + + return SqlOutOfDiskReport; + })(); + + /** + * SqlNetworkArchitecture enum. + * @name google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture + * @enum {number} + * @property {number} SQL_NETWORK_ARCHITECTURE_UNSPECIFIED=0 SQL_NETWORK_ARCHITECTURE_UNSPECIFIED value + * @property {number} NEW_NETWORK_ARCHITECTURE=1 NEW_NETWORK_ARCHITECTURE value + * @property {number} OLD_NETWORK_ARCHITECTURE=2 OLD_NETWORK_ARCHITECTURE value + */ + DatabaseInstance.SqlNetworkArchitecture = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NEW_NETWORK_ARCHITECTURE"] = 1; + values[valuesById[2] = "OLD_NETWORK_ARCHITECTURE"] = 2; + return values; + })(); + + DatabaseInstance.PoolNodeConfig = (function() { + + /** + * Properties of a PoolNodeConfig. + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @interface IPoolNodeConfig + * @property {string|null} [name] PoolNodeConfig name + * @property {string|null} [gceZone] PoolNodeConfig gceZone + * @property {Array.|null} [ipAddresses] PoolNodeConfig ipAddresses + * @property {string|null} [dnsName] PoolNodeConfig dnsName + * @property {google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null} [state] PoolNodeConfig state + * @property {Array.|null} [dnsNames] PoolNodeConfig dnsNames + * @property {string|null} [pscServiceAttachmentLink] PoolNodeConfig pscServiceAttachmentLink + * @property {Array.|null} [pscAutoConnections] PoolNodeConfig pscAutoConnections + */ + + /** + * Constructs a new PoolNodeConfig. + * @memberof google.cloud.sql.v1beta4.DatabaseInstance + * @classdesc Represents a PoolNodeConfig. + * @implements IPoolNodeConfig + * @constructor + * @param {google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig=} [properties] Properties to set + */ + function PoolNodeConfig(properties) { + this.ipAddresses = []; + this.dnsNames = []; + this.pscAutoConnections = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PoolNodeConfig name. + * @member {string|null|undefined} name + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.name = null; + + /** + * PoolNodeConfig gceZone. + * @member {string|null|undefined} gceZone + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.gceZone = null; + + /** + * PoolNodeConfig ipAddresses. + * @member {Array.} ipAddresses + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.ipAddresses = $util.emptyArray; + + /** + * PoolNodeConfig dnsName. + * @member {string|null|undefined} dnsName + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.dnsName = null; + + /** + * PoolNodeConfig state. + * @member {google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null|undefined} state + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.state = null; + + /** + * PoolNodeConfig dnsNames. + * @member {Array.} dnsNames + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.dnsNames = $util.emptyArray; + + /** + * PoolNodeConfig pscServiceAttachmentLink. + * @member {string|null|undefined} pscServiceAttachmentLink + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.pscServiceAttachmentLink = null; + + /** + * PoolNodeConfig pscAutoConnections. + * @member {Array.} pscAutoConnections + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @instance + */ + PoolNodeConfig.prototype.pscAutoConnections = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PoolNodeConfig.prototype, "_name", { + get: $util.oneOfGetter($oneOfFields = ["name"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PoolNodeConfig.prototype, "_gceZone", { + get: $util.oneOfGetter($oneOfFields = ["gceZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PoolNodeConfig.prototype, "_dnsName", { + get: $util.oneOfGetter($oneOfFields = ["dnsName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PoolNodeConfig.prototype, "_state", { + get: $util.oneOfGetter($oneOfFields = ["state"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PoolNodeConfig.prototype, "_pscServiceAttachmentLink", { + get: $util.oneOfGetter($oneOfFields = ["pscServiceAttachmentLink"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PoolNodeConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig} PoolNodeConfig instance + */ + PoolNodeConfig.create = function create(properties) { + return new PoolNodeConfig(properties); + }; + + /** + * Encodes the specified PoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig} message PoolNodeConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PoolNodeConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.gceZone != null && Object.hasOwnProperty.call(message, "gceZone")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.gceZone); + if (message.ipAddresses != null && message.ipAddresses.length) + for (var i = 0; i < message.ipAddresses.length; ++i) + $root.google.cloud.sql.v1beta4.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dnsName); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.state); + if (message.dnsNames != null && message.dnsNames.length) + for (var i = 0; i < message.dnsNames.length; ++i) + $root.google.cloud.sql.v1beta4.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.pscServiceAttachmentLink != null && Object.hasOwnProperty.call(message, "pscServiceAttachmentLink")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.pscServiceAttachmentLink); + if (message.pscAutoConnections != null && message.pscAutoConnections.length) + for (var i = 0; i < message.pscAutoConnections.length; ++i) + $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.encode(message.pscAutoConnections[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig} message PoolNodeConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PoolNodeConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PoolNodeConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig} PoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PoolNodeConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.gceZone = reader.string(); + break; + } + case 3: { + if (!(message.ipAddresses && message.ipAddresses.length)) + message.ipAddresses = []; + message.ipAddresses.push($root.google.cloud.sql.v1beta4.IpMapping.decode(reader, reader.uint32())); + break; + } + case 4: { + message.dnsName = reader.string(); + break; + } + case 5: { + message.state = reader.int32(); + break; + } + case 6: { + if (!(message.dnsNames && message.dnsNames.length)) + message.dnsNames = []; + message.dnsNames.push($root.google.cloud.sql.v1beta4.DnsNameMapping.decode(reader, reader.uint32())); + break; + } + case 7: { + message.pscServiceAttachmentLink = reader.string(); + break; + } + case 8: { + if (!(message.pscAutoConnections && message.pscAutoConnections.length)) + message.pscAutoConnections = []; + message.pscAutoConnections.push($root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PoolNodeConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig} PoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PoolNodeConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PoolNodeConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PoolNodeConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) { + properties._name = 1; + if (!$util.isString(message.name)) + return "name: string expected"; + } + if (message.gceZone != null && message.hasOwnProperty("gceZone")) { + properties._gceZone = 1; + if (!$util.isString(message.gceZone)) + return "gceZone: string expected"; + } + if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { + if (!Array.isArray(message.ipAddresses)) + return "ipAddresses: array expected"; + for (var i = 0; i < message.ipAddresses.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.IpMapping.verify(message.ipAddresses[i]); + if (error) + return "ipAddresses." + error; + } + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + properties._dnsName = 1; + if (!$util.isString(message.dnsName)) + return "dnsName: string expected"; + } + if (message.state != null && message.hasOwnProperty("state")) { + properties._state = 1; + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + } + if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { + if (!Array.isArray(message.dnsNames)) + return "dnsNames: array expected"; + for (var i = 0; i < message.dnsNames.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.DnsNameMapping.verify(message.dnsNames[i]); + if (error) + return "dnsNames." + error; + } + } + if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { + properties._pscServiceAttachmentLink = 1; + if (!$util.isString(message.pscServiceAttachmentLink)) + return "pscServiceAttachmentLink: string expected"; + } + if (message.pscAutoConnections != null && message.hasOwnProperty("pscAutoConnections")) { + if (!Array.isArray(message.pscAutoConnections)) + return "pscAutoConnections: array expected"; + for (var i = 0; i < message.pscAutoConnections.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify(message.pscAutoConnections[i]); + if (error) + return "pscAutoConnections." + error; + } + } + return null; + }; + + /** + * Creates a PoolNodeConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig} PoolNodeConfig + */ + PoolNodeConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.gceZone != null) + message.gceZone = String(object.gceZone); + if (object.ipAddresses) { + if (!Array.isArray(object.ipAddresses)) + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.ipAddresses: array expected"); + message.ipAddresses = []; + for (var i = 0; i < object.ipAddresses.length; ++i) { + if (typeof object.ipAddresses[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.ipAddresses: object expected"); + message.ipAddresses[i] = $root.google.cloud.sql.v1beta4.IpMapping.fromObject(object.ipAddresses[i]); + } + } + if (object.dnsName != null) + message.dnsName = String(object.dnsName); + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "SQL_INSTANCE_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "RUNNABLE": + case 1: + message.state = 1; + break; + case "SUSPENDED": + case 2: + message.state = 2; + break; + case "PENDING_DELETE": + case 3: + message.state = 3; + break; + case "PENDING_CREATE": + case 4: + message.state = 4; + break; + case "MAINTENANCE": + case 5: + message.state = 5; + break; + case "FAILED": + case 6: + message.state = 6; + break; + case "ONLINE_MAINTENANCE": + case 7: + message.state = 7; + break; + case "REPAIRING": + case 8: + message.state = 8; + break; + } + if (object.dnsNames) { + if (!Array.isArray(object.dnsNames)) + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.dnsNames: array expected"); + message.dnsNames = []; + for (var i = 0; i < object.dnsNames.length; ++i) { + if (typeof object.dnsNames[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.dnsNames: object expected"); + message.dnsNames[i] = $root.google.cloud.sql.v1beta4.DnsNameMapping.fromObject(object.dnsNames[i]); + } + } + if (object.pscServiceAttachmentLink != null) + message.pscServiceAttachmentLink = String(object.pscServiceAttachmentLink); + if (object.pscAutoConnections) { + if (!Array.isArray(object.pscAutoConnections)) + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.pscAutoConnections: array expected"); + message.pscAutoConnections = []; + for (var i = 0; i < object.pscAutoConnections.length; ++i) { + if (typeof object.pscAutoConnections[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.pscAutoConnections: object expected"); + message.pscAutoConnections[i] = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.fromObject(object.pscAutoConnections[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a PoolNodeConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @static + * @param {google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig} message PoolNodeConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PoolNodeConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.ipAddresses = []; + object.dnsNames = []; + object.pscAutoConnections = []; + } + if (message.name != null && message.hasOwnProperty("name")) { + object.name = message.name; + if (options.oneofs) + object._name = "name"; + } + if (message.gceZone != null && message.hasOwnProperty("gceZone")) { + object.gceZone = message.gceZone; + if (options.oneofs) + object._gceZone = "gceZone"; + } + if (message.ipAddresses && message.ipAddresses.length) { + object.ipAddresses = []; + for (var j = 0; j < message.ipAddresses.length; ++j) + object.ipAddresses[j] = $root.google.cloud.sql.v1beta4.IpMapping.toObject(message.ipAddresses[j], options); + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + object.dnsName = message.dnsName; + if (options.oneofs) + object._dnsName = "dnsName"; + } + if (message.state != null && message.hasOwnProperty("state")) { + object.state = options.enums === String ? $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState[message.state] : message.state; + if (options.oneofs) + object._state = "state"; + } + if (message.dnsNames && message.dnsNames.length) { + object.dnsNames = []; + for (var j = 0; j < message.dnsNames.length; ++j) + object.dnsNames[j] = $root.google.cloud.sql.v1beta4.DnsNameMapping.toObject(message.dnsNames[j], options); + } + if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { + object.pscServiceAttachmentLink = message.pscServiceAttachmentLink; + if (options.oneofs) + object._pscServiceAttachmentLink = "pscServiceAttachmentLink"; + } + if (message.pscAutoConnections && message.pscAutoConnections.length) { + object.pscAutoConnections = []; + for (var j = 0; j < message.pscAutoConnections.length; ++j) + object.pscAutoConnections[j] = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.toObject(message.pscAutoConnections[j], options); + } + return object; + }; + + /** + * Converts this PoolNodeConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @instance + * @returns {Object.} JSON object + */ + PoolNodeConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PoolNodeConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PoolNodeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig"; + }; + + return PoolNodeConfig; + })(); + + return DatabaseInstance; + })(); + + v1beta4.DnsNameMapping = (function() { + + /** + * Properties of a DnsNameMapping. + * @memberof google.cloud.sql.v1beta4 + * @interface IDnsNameMapping + * @property {string|null} [name] DnsNameMapping name + * @property {google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType|null} [connectionType] DnsNameMapping connectionType + * @property {google.cloud.sql.v1beta4.DnsNameMapping.DnsScope|null} [dnsScope] DnsNameMapping dnsScope + * @property {google.cloud.sql.v1beta4.DnsNameMapping.RecordManager|null} [recordManager] DnsNameMapping recordManager + */ + + /** + * Constructs a new DnsNameMapping. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DnsNameMapping. + * @implements IDnsNameMapping + * @constructor + * @param {google.cloud.sql.v1beta4.IDnsNameMapping=} [properties] Properties to set + */ + function DnsNameMapping(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DnsNameMapping name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @instance + */ + DnsNameMapping.prototype.name = ""; + + /** + * DnsNameMapping connectionType. + * @member {google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType} connectionType + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @instance + */ + DnsNameMapping.prototype.connectionType = 0; + + /** + * DnsNameMapping dnsScope. + * @member {google.cloud.sql.v1beta4.DnsNameMapping.DnsScope} dnsScope + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @instance + */ + DnsNameMapping.prototype.dnsScope = 0; + + /** + * DnsNameMapping recordManager. + * @member {google.cloud.sql.v1beta4.DnsNameMapping.RecordManager} recordManager + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @instance + */ + DnsNameMapping.prototype.recordManager = 0; + + /** + * Creates a new DnsNameMapping instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @static + * @param {google.cloud.sql.v1beta4.IDnsNameMapping=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DnsNameMapping} DnsNameMapping instance + */ + DnsNameMapping.create = function create(properties) { + return new DnsNameMapping(properties); + }; + + /** + * Encodes the specified DnsNameMapping message. Does not implicitly {@link google.cloud.sql.v1beta4.DnsNameMapping.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @static + * @param {google.cloud.sql.v1beta4.IDnsNameMapping} message DnsNameMapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DnsNameMapping.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.connectionType != null && Object.hasOwnProperty.call(message, "connectionType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.connectionType); + if (message.dnsScope != null && Object.hasOwnProperty.call(message, "dnsScope")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.dnsScope); + if (message.recordManager != null && Object.hasOwnProperty.call(message, "recordManager")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.recordManager); + return writer; + }; + + /** + * Encodes the specified DnsNameMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DnsNameMapping.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @static + * @param {google.cloud.sql.v1beta4.IDnsNameMapping} message DnsNameMapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DnsNameMapping.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DnsNameMapping message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DnsNameMapping} DnsNameMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DnsNameMapping.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DnsNameMapping(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.connectionType = reader.int32(); + break; + } + case 3: { + message.dnsScope = reader.int32(); + break; + } + case 4: { + message.recordManager = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DnsNameMapping message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DnsNameMapping} DnsNameMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DnsNameMapping.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DnsNameMapping message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DnsNameMapping.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.connectionType != null && message.hasOwnProperty("connectionType")) + switch (message.connectionType) { + default: + return "connectionType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.dnsScope != null && message.hasOwnProperty("dnsScope")) + switch (message.dnsScope) { + default: + return "dnsScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.recordManager != null && message.hasOwnProperty("recordManager")) + switch (message.recordManager) { + default: + return "recordManager: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DnsNameMapping message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DnsNameMapping} DnsNameMapping + */ + DnsNameMapping.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DnsNameMapping) + return object; + var message = new $root.google.cloud.sql.v1beta4.DnsNameMapping(); + if (object.name != null) + message.name = String(object.name); + switch (object.connectionType) { + default: + if (typeof object.connectionType === "number") { + message.connectionType = object.connectionType; + break; + } + break; + case "CONNECTION_TYPE_UNSPECIFIED": + case 0: + message.connectionType = 0; + break; + case "PUBLIC": + case 1: + message.connectionType = 1; + break; + case "PRIVATE_SERVICES_ACCESS": + case 2: + message.connectionType = 2; + break; + case "PRIVATE_SERVICE_CONNECT": + case 3: + message.connectionType = 3; + break; + } + switch (object.dnsScope) { + default: + if (typeof object.dnsScope === "number") { + message.dnsScope = object.dnsScope; + break; + } + break; + case "DNS_SCOPE_UNSPECIFIED": + case 0: + message.dnsScope = 0; + break; + case "INSTANCE": + case 1: + message.dnsScope = 1; + break; + case "CLUSTER": + case 2: + message.dnsScope = 2; + break; + } + switch (object.recordManager) { + default: + if (typeof object.recordManager === "number") { + message.recordManager = object.recordManager; + break; + } + break; + case "RECORD_MANAGER_UNSPECIFIED": + case 0: + message.recordManager = 0; + break; + case "CUSTOMER": + case 1: + message.recordManager = 1; + break; + case "CLOUD_SQL_AUTOMATION": + case 2: + message.recordManager = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DnsNameMapping message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @static + * @param {google.cloud.sql.v1beta4.DnsNameMapping} message DnsNameMapping + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DnsNameMapping.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.connectionType = options.enums === String ? "CONNECTION_TYPE_UNSPECIFIED" : 0; + object.dnsScope = options.enums === String ? "DNS_SCOPE_UNSPECIFIED" : 0; + object.recordManager = options.enums === String ? "RECORD_MANAGER_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.connectionType != null && message.hasOwnProperty("connectionType")) + object.connectionType = options.enums === String ? $root.google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType[message.connectionType] === undefined ? message.connectionType : $root.google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType[message.connectionType] : message.connectionType; + if (message.dnsScope != null && message.hasOwnProperty("dnsScope")) + object.dnsScope = options.enums === String ? $root.google.cloud.sql.v1beta4.DnsNameMapping.DnsScope[message.dnsScope] === undefined ? message.dnsScope : $root.google.cloud.sql.v1beta4.DnsNameMapping.DnsScope[message.dnsScope] : message.dnsScope; + if (message.recordManager != null && message.hasOwnProperty("recordManager")) + object.recordManager = options.enums === String ? $root.google.cloud.sql.v1beta4.DnsNameMapping.RecordManager[message.recordManager] === undefined ? message.recordManager : $root.google.cloud.sql.v1beta4.DnsNameMapping.RecordManager[message.recordManager] : message.recordManager; + return object; + }; + + /** + * Converts this DnsNameMapping to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @instance + * @returns {Object.} JSON object + */ + DnsNameMapping.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DnsNameMapping + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DnsNameMapping + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DnsNameMapping.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DnsNameMapping"; + }; + + /** + * ConnectionType enum. + * @name google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType + * @enum {number} + * @property {number} CONNECTION_TYPE_UNSPECIFIED=0 CONNECTION_TYPE_UNSPECIFIED value + * @property {number} PUBLIC=1 PUBLIC value + * @property {number} PRIVATE_SERVICES_ACCESS=2 PRIVATE_SERVICES_ACCESS value + * @property {number} PRIVATE_SERVICE_CONNECT=3 PRIVATE_SERVICE_CONNECT value + */ + DnsNameMapping.ConnectionType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONNECTION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PUBLIC"] = 1; + values[valuesById[2] = "PRIVATE_SERVICES_ACCESS"] = 2; + values[valuesById[3] = "PRIVATE_SERVICE_CONNECT"] = 3; + return values; + })(); + + /** + * DnsScope enum. + * @name google.cloud.sql.v1beta4.DnsNameMapping.DnsScope + * @enum {number} + * @property {number} DNS_SCOPE_UNSPECIFIED=0 DNS_SCOPE_UNSPECIFIED value + * @property {number} INSTANCE=1 INSTANCE value + * @property {number} CLUSTER=2 CLUSTER value + */ + DnsNameMapping.DnsScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DNS_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INSTANCE"] = 1; + values[valuesById[2] = "CLUSTER"] = 2; + return values; + })(); + + /** + * RecordManager enum. + * @name google.cloud.sql.v1beta4.DnsNameMapping.RecordManager + * @enum {number} + * @property {number} RECORD_MANAGER_UNSPECIFIED=0 RECORD_MANAGER_UNSPECIFIED value + * @property {number} CUSTOMER=1 CUSTOMER value + * @property {number} CLOUD_SQL_AUTOMATION=2 CLOUD_SQL_AUTOMATION value + */ + DnsNameMapping.RecordManager = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RECORD_MANAGER_UNSPECIFIED"] = 0; + values[valuesById[1] = "CUSTOMER"] = 1; + values[valuesById[2] = "CLOUD_SQL_AUTOMATION"] = 2; + return values; + })(); + + return DnsNameMapping; + })(); + + v1beta4.GeminiInstanceConfig = (function() { + + /** + * Properties of a GeminiInstanceConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IGeminiInstanceConfig + * @property {boolean|null} [entitled] GeminiInstanceConfig entitled + * @property {boolean|null} [googleVacuumMgmtEnabled] GeminiInstanceConfig googleVacuumMgmtEnabled + * @property {boolean|null} [oomSessionCancelEnabled] GeminiInstanceConfig oomSessionCancelEnabled + * @property {boolean|null} [activeQueryEnabled] GeminiInstanceConfig activeQueryEnabled + * @property {boolean|null} [indexAdvisorEnabled] GeminiInstanceConfig indexAdvisorEnabled + * @property {boolean|null} [flagRecommenderEnabled] GeminiInstanceConfig flagRecommenderEnabled + */ + + /** + * Constructs a new GeminiInstanceConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a GeminiInstanceConfig. + * @implements IGeminiInstanceConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IGeminiInstanceConfig=} [properties] Properties to set + */ + function GeminiInstanceConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeminiInstanceConfig entitled. + * @member {boolean|null|undefined} entitled + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.entitled = null; + + /** + * GeminiInstanceConfig googleVacuumMgmtEnabled. + * @member {boolean|null|undefined} googleVacuumMgmtEnabled + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.googleVacuumMgmtEnabled = null; + + /** + * GeminiInstanceConfig oomSessionCancelEnabled. + * @member {boolean|null|undefined} oomSessionCancelEnabled + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.oomSessionCancelEnabled = null; + + /** + * GeminiInstanceConfig activeQueryEnabled. + * @member {boolean|null|undefined} activeQueryEnabled + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.activeQueryEnabled = null; + + /** + * GeminiInstanceConfig indexAdvisorEnabled. + * @member {boolean|null|undefined} indexAdvisorEnabled + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.indexAdvisorEnabled = null; + + /** + * GeminiInstanceConfig flagRecommenderEnabled. + * @member {boolean|null|undefined} flagRecommenderEnabled + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @instance + */ + GeminiInstanceConfig.prototype.flagRecommenderEnabled = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_entitled", { + get: $util.oneOfGetter($oneOfFields = ["entitled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_googleVacuumMgmtEnabled", { + get: $util.oneOfGetter($oneOfFields = ["googleVacuumMgmtEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_oomSessionCancelEnabled", { + get: $util.oneOfGetter($oneOfFields = ["oomSessionCancelEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_activeQueryEnabled", { + get: $util.oneOfGetter($oneOfFields = ["activeQueryEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_indexAdvisorEnabled", { + get: $util.oneOfGetter($oneOfFields = ["indexAdvisorEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(GeminiInstanceConfig.prototype, "_flagRecommenderEnabled", { + get: $util.oneOfGetter($oneOfFields = ["flagRecommenderEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new GeminiInstanceConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @static + * @param {google.cloud.sql.v1beta4.IGeminiInstanceConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.GeminiInstanceConfig} GeminiInstanceConfig instance + */ + GeminiInstanceConfig.create = function create(properties) { + return new GeminiInstanceConfig(properties); + }; + + /** + * Encodes the specified GeminiInstanceConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.GeminiInstanceConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @static + * @param {google.cloud.sql.v1beta4.IGeminiInstanceConfig} message GeminiInstanceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeminiInstanceConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entitled != null && Object.hasOwnProperty.call(message, "entitled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.entitled); + if (message.googleVacuumMgmtEnabled != null && Object.hasOwnProperty.call(message, "googleVacuumMgmtEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.googleVacuumMgmtEnabled); + if (message.oomSessionCancelEnabled != null && Object.hasOwnProperty.call(message, "oomSessionCancelEnabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.oomSessionCancelEnabled); + if (message.activeQueryEnabled != null && Object.hasOwnProperty.call(message, "activeQueryEnabled")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.activeQueryEnabled); + if (message.indexAdvisorEnabled != null && Object.hasOwnProperty.call(message, "indexAdvisorEnabled")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.indexAdvisorEnabled); + if (message.flagRecommenderEnabled != null && Object.hasOwnProperty.call(message, "flagRecommenderEnabled")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.flagRecommenderEnabled); + return writer; + }; + + /** + * Encodes the specified GeminiInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GeminiInstanceConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @static + * @param {google.cloud.sql.v1beta4.IGeminiInstanceConfig} message GeminiInstanceConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeminiInstanceConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeminiInstanceConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.GeminiInstanceConfig} GeminiInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeminiInstanceConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.GeminiInstanceConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.entitled = reader.bool(); + break; + } + case 2: { + message.googleVacuumMgmtEnabled = reader.bool(); + break; + } + case 3: { + message.oomSessionCancelEnabled = reader.bool(); + break; + } + case 4: { + message.activeQueryEnabled = reader.bool(); + break; + } + case 5: { + message.indexAdvisorEnabled = reader.bool(); + break; + } + case 6: { + message.flagRecommenderEnabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeminiInstanceConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.GeminiInstanceConfig} GeminiInstanceConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeminiInstanceConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeminiInstanceConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeminiInstanceConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.entitled != null && message.hasOwnProperty("entitled")) { + properties._entitled = 1; + if (typeof message.entitled !== "boolean") + return "entitled: boolean expected"; + } + if (message.googleVacuumMgmtEnabled != null && message.hasOwnProperty("googleVacuumMgmtEnabled")) { + properties._googleVacuumMgmtEnabled = 1; + if (typeof message.googleVacuumMgmtEnabled !== "boolean") + return "googleVacuumMgmtEnabled: boolean expected"; + } + if (message.oomSessionCancelEnabled != null && message.hasOwnProperty("oomSessionCancelEnabled")) { + properties._oomSessionCancelEnabled = 1; + if (typeof message.oomSessionCancelEnabled !== "boolean") + return "oomSessionCancelEnabled: boolean expected"; + } + if (message.activeQueryEnabled != null && message.hasOwnProperty("activeQueryEnabled")) { + properties._activeQueryEnabled = 1; + if (typeof message.activeQueryEnabled !== "boolean") + return "activeQueryEnabled: boolean expected"; + } + if (message.indexAdvisorEnabled != null && message.hasOwnProperty("indexAdvisorEnabled")) { + properties._indexAdvisorEnabled = 1; + if (typeof message.indexAdvisorEnabled !== "boolean") + return "indexAdvisorEnabled: boolean expected"; + } + if (message.flagRecommenderEnabled != null && message.hasOwnProperty("flagRecommenderEnabled")) { + properties._flagRecommenderEnabled = 1; + if (typeof message.flagRecommenderEnabled !== "boolean") + return "flagRecommenderEnabled: boolean expected"; + } + return null; + }; + + /** + * Creates a GeminiInstanceConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.GeminiInstanceConfig} GeminiInstanceConfig + */ + GeminiInstanceConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.GeminiInstanceConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.GeminiInstanceConfig(); + if (object.entitled != null) + message.entitled = Boolean(object.entitled); + if (object.googleVacuumMgmtEnabled != null) + message.googleVacuumMgmtEnabled = Boolean(object.googleVacuumMgmtEnabled); + if (object.oomSessionCancelEnabled != null) + message.oomSessionCancelEnabled = Boolean(object.oomSessionCancelEnabled); + if (object.activeQueryEnabled != null) + message.activeQueryEnabled = Boolean(object.activeQueryEnabled); + if (object.indexAdvisorEnabled != null) + message.indexAdvisorEnabled = Boolean(object.indexAdvisorEnabled); + if (object.flagRecommenderEnabled != null) + message.flagRecommenderEnabled = Boolean(object.flagRecommenderEnabled); + return message; + }; + + /** + * Creates a plain object from a GeminiInstanceConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @static + * @param {google.cloud.sql.v1beta4.GeminiInstanceConfig} message GeminiInstanceConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeminiInstanceConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.entitled != null && message.hasOwnProperty("entitled")) { + object.entitled = message.entitled; + if (options.oneofs) + object._entitled = "entitled"; + } + if (message.googleVacuumMgmtEnabled != null && message.hasOwnProperty("googleVacuumMgmtEnabled")) { + object.googleVacuumMgmtEnabled = message.googleVacuumMgmtEnabled; + if (options.oneofs) + object._googleVacuumMgmtEnabled = "googleVacuumMgmtEnabled"; + } + if (message.oomSessionCancelEnabled != null && message.hasOwnProperty("oomSessionCancelEnabled")) { + object.oomSessionCancelEnabled = message.oomSessionCancelEnabled; + if (options.oneofs) + object._oomSessionCancelEnabled = "oomSessionCancelEnabled"; + } + if (message.activeQueryEnabled != null && message.hasOwnProperty("activeQueryEnabled")) { + object.activeQueryEnabled = message.activeQueryEnabled; + if (options.oneofs) + object._activeQueryEnabled = "activeQueryEnabled"; + } + if (message.indexAdvisorEnabled != null && message.hasOwnProperty("indexAdvisorEnabled")) { + object.indexAdvisorEnabled = message.indexAdvisorEnabled; + if (options.oneofs) + object._indexAdvisorEnabled = "indexAdvisorEnabled"; + } + if (message.flagRecommenderEnabled != null && message.hasOwnProperty("flagRecommenderEnabled")) { + object.flagRecommenderEnabled = message.flagRecommenderEnabled; + if (options.oneofs) + object._flagRecommenderEnabled = "flagRecommenderEnabled"; + } + return object; + }; + + /** + * Converts this GeminiInstanceConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @instance + * @returns {Object.} JSON object + */ + GeminiInstanceConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GeminiInstanceConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GeminiInstanceConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.GeminiInstanceConfig"; + }; + + return GeminiInstanceConfig; + })(); + + v1beta4.ReplicationCluster = (function() { + + /** + * Properties of a ReplicationCluster. + * @memberof google.cloud.sql.v1beta4 + * @interface IReplicationCluster + * @property {string|null} [psaWriteEndpoint] ReplicationCluster psaWriteEndpoint + * @property {string|null} [failoverDrReplicaName] ReplicationCluster failoverDrReplicaName + * @property {boolean|null} [drReplica] ReplicationCluster drReplica + */ + + /** + * Constructs a new ReplicationCluster. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a ReplicationCluster. + * @implements IReplicationCluster + * @constructor + * @param {google.cloud.sql.v1beta4.IReplicationCluster=} [properties] Properties to set + */ + function ReplicationCluster(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReplicationCluster psaWriteEndpoint. + * @member {string|null|undefined} psaWriteEndpoint + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @instance + */ + ReplicationCluster.prototype.psaWriteEndpoint = null; + + /** + * ReplicationCluster failoverDrReplicaName. + * @member {string|null|undefined} failoverDrReplicaName + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @instance + */ + ReplicationCluster.prototype.failoverDrReplicaName = null; + + /** + * ReplicationCluster drReplica. + * @member {boolean|null|undefined} drReplica + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @instance + */ + ReplicationCluster.prototype.drReplica = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReplicationCluster.prototype, "_psaWriteEndpoint", { + get: $util.oneOfGetter($oneOfFields = ["psaWriteEndpoint"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReplicationCluster.prototype, "_failoverDrReplicaName", { + get: $util.oneOfGetter($oneOfFields = ["failoverDrReplicaName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReplicationCluster.prototype, "_drReplica", { + get: $util.oneOfGetter($oneOfFields = ["drReplica"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReplicationCluster instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @static + * @param {google.cloud.sql.v1beta4.IReplicationCluster=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ReplicationCluster} ReplicationCluster instance + */ + ReplicationCluster.create = function create(properties) { + return new ReplicationCluster(properties); + }; + + /** + * Encodes the specified ReplicationCluster message. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicationCluster.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @static + * @param {google.cloud.sql.v1beta4.IReplicationCluster} message ReplicationCluster message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicationCluster.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.psaWriteEndpoint != null && Object.hasOwnProperty.call(message, "psaWriteEndpoint")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.psaWriteEndpoint); + if (message.failoverDrReplicaName != null && Object.hasOwnProperty.call(message, "failoverDrReplicaName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.failoverDrReplicaName); + if (message.drReplica != null && Object.hasOwnProperty.call(message, "drReplica")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.drReplica); + return writer; + }; + + /** + * Encodes the specified ReplicationCluster message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicationCluster.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @static + * @param {google.cloud.sql.v1beta4.IReplicationCluster} message ReplicationCluster message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicationCluster.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplicationCluster message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ReplicationCluster} ReplicationCluster + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicationCluster.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ReplicationCluster(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.psaWriteEndpoint = reader.string(); + break; + } + case 2: { + message.failoverDrReplicaName = reader.string(); + break; + } + case 4: { + message.drReplica = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplicationCluster message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ReplicationCluster} ReplicationCluster + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicationCluster.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplicationCluster message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplicationCluster.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.psaWriteEndpoint != null && message.hasOwnProperty("psaWriteEndpoint")) { + properties._psaWriteEndpoint = 1; + if (!$util.isString(message.psaWriteEndpoint)) + return "psaWriteEndpoint: string expected"; + } + if (message.failoverDrReplicaName != null && message.hasOwnProperty("failoverDrReplicaName")) { + properties._failoverDrReplicaName = 1; + if (!$util.isString(message.failoverDrReplicaName)) + return "failoverDrReplicaName: string expected"; + } + if (message.drReplica != null && message.hasOwnProperty("drReplica")) { + properties._drReplica = 1; + if (typeof message.drReplica !== "boolean") + return "drReplica: boolean expected"; + } + return null; + }; + + /** + * Creates a ReplicationCluster message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ReplicationCluster} ReplicationCluster + */ + ReplicationCluster.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ReplicationCluster) + return object; + var message = new $root.google.cloud.sql.v1beta4.ReplicationCluster(); + if (object.psaWriteEndpoint != null) + message.psaWriteEndpoint = String(object.psaWriteEndpoint); + if (object.failoverDrReplicaName != null) + message.failoverDrReplicaName = String(object.failoverDrReplicaName); + if (object.drReplica != null) + message.drReplica = Boolean(object.drReplica); + return message; + }; + + /** + * Creates a plain object from a ReplicationCluster message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @static + * @param {google.cloud.sql.v1beta4.ReplicationCluster} message ReplicationCluster + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplicationCluster.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.psaWriteEndpoint != null && message.hasOwnProperty("psaWriteEndpoint")) { + object.psaWriteEndpoint = message.psaWriteEndpoint; + if (options.oneofs) + object._psaWriteEndpoint = "psaWriteEndpoint"; + } + if (message.failoverDrReplicaName != null && message.hasOwnProperty("failoverDrReplicaName")) { + object.failoverDrReplicaName = message.failoverDrReplicaName; + if (options.oneofs) + object._failoverDrReplicaName = "failoverDrReplicaName"; + } + if (message.drReplica != null && message.hasOwnProperty("drReplica")) { + object.drReplica = message.drReplica; + if (options.oneofs) + object._drReplica = "drReplica"; + } + return object; + }; + + /** + * Converts this ReplicationCluster to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @instance + * @returns {Object.} JSON object + */ + ReplicationCluster.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReplicationCluster + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ReplicationCluster + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplicationCluster.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ReplicationCluster"; + }; + + return ReplicationCluster; + })(); + + v1beta4.AvailableDatabaseVersion = (function() { + + /** + * Properties of an AvailableDatabaseVersion. + * @memberof google.cloud.sql.v1beta4 + * @interface IAvailableDatabaseVersion + * @property {string|null} [majorVersion] AvailableDatabaseVersion majorVersion + * @property {string|null} [name] AvailableDatabaseVersion name + * @property {string|null} [displayName] AvailableDatabaseVersion displayName + */ + + /** + * Constructs a new AvailableDatabaseVersion. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an AvailableDatabaseVersion. + * @implements IAvailableDatabaseVersion + * @constructor + * @param {google.cloud.sql.v1beta4.IAvailableDatabaseVersion=} [properties] Properties to set + */ + function AvailableDatabaseVersion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AvailableDatabaseVersion majorVersion. + * @member {string|null|undefined} majorVersion + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @instance + */ + AvailableDatabaseVersion.prototype.majorVersion = null; + + /** + * AvailableDatabaseVersion name. + * @member {string|null|undefined} name + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @instance + */ + AvailableDatabaseVersion.prototype.name = null; + + /** + * AvailableDatabaseVersion displayName. + * @member {string|null|undefined} displayName + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @instance + */ + AvailableDatabaseVersion.prototype.displayName = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AvailableDatabaseVersion.prototype, "_majorVersion", { + get: $util.oneOfGetter($oneOfFields = ["majorVersion"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AvailableDatabaseVersion.prototype, "_name", { + get: $util.oneOfGetter($oneOfFields = ["name"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AvailableDatabaseVersion.prototype, "_displayName", { + get: $util.oneOfGetter($oneOfFields = ["displayName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AvailableDatabaseVersion instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @static + * @param {google.cloud.sql.v1beta4.IAvailableDatabaseVersion=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.AvailableDatabaseVersion} AvailableDatabaseVersion instance + */ + AvailableDatabaseVersion.create = function create(properties) { + return new AvailableDatabaseVersion(properties); + }; + + /** + * Encodes the specified AvailableDatabaseVersion message. Does not implicitly {@link google.cloud.sql.v1beta4.AvailableDatabaseVersion.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @static + * @param {google.cloud.sql.v1beta4.IAvailableDatabaseVersion} message AvailableDatabaseVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AvailableDatabaseVersion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.majorVersion != null && Object.hasOwnProperty.call(message, "majorVersion")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.majorVersion); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.name); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.displayName); + return writer; + }; + + /** + * Encodes the specified AvailableDatabaseVersion message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AvailableDatabaseVersion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @static + * @param {google.cloud.sql.v1beta4.IAvailableDatabaseVersion} message AvailableDatabaseVersion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AvailableDatabaseVersion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AvailableDatabaseVersion message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.AvailableDatabaseVersion} AvailableDatabaseVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AvailableDatabaseVersion.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.majorVersion = reader.string(); + break; + } + case 8: { + message.name = reader.string(); + break; + } + case 9: { + message.displayName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AvailableDatabaseVersion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.AvailableDatabaseVersion} AvailableDatabaseVersion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AvailableDatabaseVersion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AvailableDatabaseVersion message. + * @function verify + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AvailableDatabaseVersion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.majorVersion != null && message.hasOwnProperty("majorVersion")) { + properties._majorVersion = 1; + if (!$util.isString(message.majorVersion)) + return "majorVersion: string expected"; + } + if (message.name != null && message.hasOwnProperty("name")) { + properties._name = 1; + if (!$util.isString(message.name)) + return "name: string expected"; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) { + properties._displayName = 1; + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + } + return null; + }; + + /** + * Creates an AvailableDatabaseVersion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.AvailableDatabaseVersion} AvailableDatabaseVersion + */ + AvailableDatabaseVersion.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion) + return object; + var message = new $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion(); + if (object.majorVersion != null) + message.majorVersion = String(object.majorVersion); + if (object.name != null) + message.name = String(object.name); + if (object.displayName != null) + message.displayName = String(object.displayName); + return message; + }; + + /** + * Creates a plain object from an AvailableDatabaseVersion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @static + * @param {google.cloud.sql.v1beta4.AvailableDatabaseVersion} message AvailableDatabaseVersion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AvailableDatabaseVersion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.majorVersion != null && message.hasOwnProperty("majorVersion")) { + object.majorVersion = message.majorVersion; + if (options.oneofs) + object._majorVersion = "majorVersion"; + } + if (message.name != null && message.hasOwnProperty("name")) { + object.name = message.name; + if (options.oneofs) + object._name = "name"; + } + if (message.displayName != null && message.hasOwnProperty("displayName")) { + object.displayName = message.displayName; + if (options.oneofs) + object._displayName = "displayName"; + } + return object; + }; + + /** + * Converts this AvailableDatabaseVersion to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @instance + * @returns {Object.} JSON object + */ + AvailableDatabaseVersion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AvailableDatabaseVersion + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AvailableDatabaseVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.AvailableDatabaseVersion"; + }; + + return AvailableDatabaseVersion; + })(); + + v1beta4.DatabasesListResponse = (function() { + + /** + * Properties of a DatabasesListResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IDatabasesListResponse + * @property {string|null} [kind] DatabasesListResponse kind + * @property {Array.|null} [items] DatabasesListResponse items + */ + + /** + * Constructs a new DatabasesListResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DatabasesListResponse. + * @implements IDatabasesListResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IDatabasesListResponse=} [properties] Properties to set + */ + function DatabasesListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DatabasesListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @instance + */ + DatabasesListResponse.prototype.kind = ""; + + /** + * DatabasesListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @instance + */ + DatabasesListResponse.prototype.items = $util.emptyArray; + + /** + * Creates a new DatabasesListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @static + * @param {google.cloud.sql.v1beta4.IDatabasesListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DatabasesListResponse} DatabasesListResponse instance + */ + DatabasesListResponse.create = function create(properties) { + return new DatabasesListResponse(properties); + }; + + /** + * Encodes the specified DatabasesListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabasesListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @static + * @param {google.cloud.sql.v1beta4.IDatabasesListResponse} message DatabasesListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabasesListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1beta4.Database.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DatabasesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabasesListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @static + * @param {google.cloud.sql.v1beta4.IDatabasesListResponse} message DatabasesListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DatabasesListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DatabasesListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DatabasesListResponse} DatabasesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabasesListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabasesListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1beta4.Database.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DatabasesListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DatabasesListResponse} DatabasesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DatabasesListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DatabasesListResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DatabasesListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.Database.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a DatabasesListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DatabasesListResponse} DatabasesListResponse + */ + DatabasesListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DatabasesListResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.DatabasesListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1beta4.DatabasesListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DatabasesListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1beta4.Database.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a DatabasesListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @static + * @param {google.cloud.sql.v1beta4.DatabasesListResponse} message DatabasesListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DatabasesListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1beta4.Database.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this DatabasesListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @instance + * @returns {Object.} JSON object + */ + DatabasesListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DatabasesListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DatabasesListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DatabasesListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabasesListResponse"; + }; + + return DatabasesListResponse; + })(); + + v1beta4.DemoteMasterConfiguration = (function() { + + /** + * Properties of a DemoteMasterConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @interface IDemoteMasterConfiguration + * @property {string|null} [kind] DemoteMasterConfiguration kind + * @property {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration|null} [mysqlReplicaConfiguration] DemoteMasterConfiguration mysqlReplicaConfiguration + */ + + /** + * Constructs a new DemoteMasterConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DemoteMasterConfiguration. + * @implements IDemoteMasterConfiguration + * @constructor + * @param {google.cloud.sql.v1beta4.IDemoteMasterConfiguration=} [properties] Properties to set + */ + function DemoteMasterConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DemoteMasterConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @instance + */ + DemoteMasterConfiguration.prototype.kind = ""; + + /** + * DemoteMasterConfiguration mysqlReplicaConfiguration. + * @member {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration|null|undefined} mysqlReplicaConfiguration + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @instance + */ + DemoteMasterConfiguration.prototype.mysqlReplicaConfiguration = null; + + /** + * Creates a new DemoteMasterConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IDemoteMasterConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DemoteMasterConfiguration} DemoteMasterConfiguration instance + */ + DemoteMasterConfiguration.create = function create(properties) { + return new DemoteMasterConfiguration(properties); + }; + + /** + * Encodes the specified DemoteMasterConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IDemoteMasterConfiguration} message DemoteMasterConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.mysqlReplicaConfiguration != null && Object.hasOwnProperty.call(message, "mysqlReplicaConfiguration")) + $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.encode(message.mysqlReplicaConfiguration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified DemoteMasterConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IDemoteMasterConfiguration} message DemoteMasterConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DemoteMasterConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DemoteMasterConfiguration} DemoteMasterConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DemoteMasterConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DemoteMasterConfiguration} DemoteMasterConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DemoteMasterConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DemoteMasterConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) { + var error = $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.verify(message.mysqlReplicaConfiguration); + if (error) + return "mysqlReplicaConfiguration." + error; + } + return null; + }; + + /** + * Creates a DemoteMasterConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DemoteMasterConfiguration} DemoteMasterConfiguration + */ + DemoteMasterConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration) + return object; + var message = new $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.mysqlReplicaConfiguration != null) { + if (typeof object.mysqlReplicaConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DemoteMasterConfiguration.mysqlReplicaConfiguration: object expected"); + message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.fromObject(object.mysqlReplicaConfiguration); + } + return message; + }; + + /** + * Creates a plain object from a DemoteMasterConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @static + * @param {google.cloud.sql.v1beta4.DemoteMasterConfiguration} message DemoteMasterConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DemoteMasterConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.mysqlReplicaConfiguration = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) + object.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.toObject(message.mysqlReplicaConfiguration, options); + return object; + }; + + /** + * Converts this DemoteMasterConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @instance + * @returns {Object.} JSON object + */ + DemoteMasterConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DemoteMasterConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DemoteMasterConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DemoteMasterConfiguration"; + }; + + return DemoteMasterConfiguration; + })(); + + v1beta4.DemoteMasterContext = (function() { + + /** + * Properties of a DemoteMasterContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IDemoteMasterContext + * @property {string|null} [kind] DemoteMasterContext kind + * @property {google.protobuf.IBoolValue|null} [verifyGtidConsistency] DemoteMasterContext verifyGtidConsistency + * @property {string|null} [masterInstanceName] DemoteMasterContext masterInstanceName + * @property {google.cloud.sql.v1beta4.IDemoteMasterConfiguration|null} [replicaConfiguration] DemoteMasterContext replicaConfiguration + * @property {boolean|null} [skipReplicationSetup] DemoteMasterContext skipReplicationSetup + */ + + /** + * Constructs a new DemoteMasterContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DemoteMasterContext. + * @implements IDemoteMasterContext + * @constructor + * @param {google.cloud.sql.v1beta4.IDemoteMasterContext=} [properties] Properties to set + */ + function DemoteMasterContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DemoteMasterContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @instance + */ + DemoteMasterContext.prototype.kind = ""; + + /** + * DemoteMasterContext verifyGtidConsistency. + * @member {google.protobuf.IBoolValue|null|undefined} verifyGtidConsistency + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @instance + */ + DemoteMasterContext.prototype.verifyGtidConsistency = null; + + /** + * DemoteMasterContext masterInstanceName. + * @member {string} masterInstanceName + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @instance + */ + DemoteMasterContext.prototype.masterInstanceName = ""; + + /** + * DemoteMasterContext replicaConfiguration. + * @member {google.cloud.sql.v1beta4.IDemoteMasterConfiguration|null|undefined} replicaConfiguration + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @instance + */ + DemoteMasterContext.prototype.replicaConfiguration = null; + + /** + * DemoteMasterContext skipReplicationSetup. + * @member {boolean} skipReplicationSetup + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @instance + */ + DemoteMasterContext.prototype.skipReplicationSetup = false; + + /** + * Creates a new DemoteMasterContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @static + * @param {google.cloud.sql.v1beta4.IDemoteMasterContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DemoteMasterContext} DemoteMasterContext instance + */ + DemoteMasterContext.create = function create(properties) { + return new DemoteMasterContext(properties); + }; + + /** + * Encodes the specified DemoteMasterContext message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @static + * @param {google.cloud.sql.v1beta4.IDemoteMasterContext} message DemoteMasterContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.verifyGtidConsistency != null && Object.hasOwnProperty.call(message, "verifyGtidConsistency")) + $root.google.protobuf.BoolValue.encode(message.verifyGtidConsistency, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.masterInstanceName != null && Object.hasOwnProperty.call(message, "masterInstanceName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.masterInstanceName); + if (message.replicaConfiguration != null && Object.hasOwnProperty.call(message, "replicaConfiguration")) + $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration.encode(message.replicaConfiguration, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.skipReplicationSetup != null && Object.hasOwnProperty.call(message, "skipReplicationSetup")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.skipReplicationSetup); + return writer; + }; + + /** + * Encodes the specified DemoteMasterContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @static + * @param {google.cloud.sql.v1beta4.IDemoteMasterContext} message DemoteMasterContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DemoteMasterContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DemoteMasterContext} DemoteMasterContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DemoteMasterContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.verifyGtidConsistency = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 3: { + message.masterInstanceName = reader.string(); + break; + } + case 4: { + message.replicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration.decode(reader, reader.uint32()); + break; + } + case 5: { + message.skipReplicationSetup = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DemoteMasterContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DemoteMasterContext} DemoteMasterContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DemoteMasterContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DemoteMasterContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.verifyGtidConsistency != null && message.hasOwnProperty("verifyGtidConsistency")) { + var error = $root.google.protobuf.BoolValue.verify(message.verifyGtidConsistency); + if (error) + return "verifyGtidConsistency." + error; + } + if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) + if (!$util.isString(message.masterInstanceName)) + return "masterInstanceName: string expected"; + if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) { + var error = $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration.verify(message.replicaConfiguration); + if (error) + return "replicaConfiguration." + error; + } + if (message.skipReplicationSetup != null && message.hasOwnProperty("skipReplicationSetup")) + if (typeof message.skipReplicationSetup !== "boolean") + return "skipReplicationSetup: boolean expected"; + return null; + }; + + /** + * Creates a DemoteMasterContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DemoteMasterContext} DemoteMasterContext + */ + DemoteMasterContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DemoteMasterContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.DemoteMasterContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.verifyGtidConsistency != null) { + if (typeof object.verifyGtidConsistency !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DemoteMasterContext.verifyGtidConsistency: object expected"); + message.verifyGtidConsistency = $root.google.protobuf.BoolValue.fromObject(object.verifyGtidConsistency); + } + if (object.masterInstanceName != null) + message.masterInstanceName = String(object.masterInstanceName); + if (object.replicaConfiguration != null) { + if (typeof object.replicaConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.DemoteMasterContext.replicaConfiguration: object expected"); + message.replicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration.fromObject(object.replicaConfiguration); + } + if (object.skipReplicationSetup != null) + message.skipReplicationSetup = Boolean(object.skipReplicationSetup); + return message; + }; + + /** + * Creates a plain object from a DemoteMasterContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @static + * @param {google.cloud.sql.v1beta4.DemoteMasterContext} message DemoteMasterContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DemoteMasterContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.verifyGtidConsistency = null; + object.masterInstanceName = ""; + object.replicaConfiguration = null; + object.skipReplicationSetup = false; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.verifyGtidConsistency != null && message.hasOwnProperty("verifyGtidConsistency")) + object.verifyGtidConsistency = $root.google.protobuf.BoolValue.toObject(message.verifyGtidConsistency, options); + if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) + object.masterInstanceName = message.masterInstanceName; + if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) + object.replicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration.toObject(message.replicaConfiguration, options); + if (message.skipReplicationSetup != null && message.hasOwnProperty("skipReplicationSetup")) + object.skipReplicationSetup = message.skipReplicationSetup; + return object; + }; + + /** + * Converts this DemoteMasterContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @instance + * @returns {Object.} JSON object + */ + DemoteMasterContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DemoteMasterContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DemoteMasterContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DemoteMasterContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DemoteMasterContext"; + }; + + return DemoteMasterContext; + })(); + + v1beta4.DemoteMasterMySqlReplicaConfiguration = (function() { + + /** + * Properties of a DemoteMasterMySqlReplicaConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @interface IDemoteMasterMySqlReplicaConfiguration + * @property {string|null} [kind] DemoteMasterMySqlReplicaConfiguration kind + * @property {string|null} [username] DemoteMasterMySqlReplicaConfiguration username + * @property {string|null} [password] DemoteMasterMySqlReplicaConfiguration password + * @property {string|null} [clientKey] DemoteMasterMySqlReplicaConfiguration clientKey + * @property {string|null} [clientCertificate] DemoteMasterMySqlReplicaConfiguration clientCertificate + * @property {string|null} [caCertificate] DemoteMasterMySqlReplicaConfiguration caCertificate + */ + + /** + * Constructs a new DemoteMasterMySqlReplicaConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DemoteMasterMySqlReplicaConfiguration. + * @implements IDemoteMasterMySqlReplicaConfiguration + * @constructor + * @param {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration=} [properties] Properties to set + */ + function DemoteMasterMySqlReplicaConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DemoteMasterMySqlReplicaConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.kind = ""; + + /** + * DemoteMasterMySqlReplicaConfiguration username. + * @member {string} username + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.username = ""; + + /** + * DemoteMasterMySqlReplicaConfiguration password. + * @member {string} password + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.password = ""; + + /** + * DemoteMasterMySqlReplicaConfiguration clientKey. + * @member {string} clientKey + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.clientKey = ""; + + /** + * DemoteMasterMySqlReplicaConfiguration clientCertificate. + * @member {string} clientCertificate + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.clientCertificate = ""; + + /** + * DemoteMasterMySqlReplicaConfiguration caCertificate. + * @member {string} caCertificate + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @instance + */ + DemoteMasterMySqlReplicaConfiguration.prototype.caCertificate = ""; + + /** + * Creates a new DemoteMasterMySqlReplicaConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration instance + */ + DemoteMasterMySqlReplicaConfiguration.create = function create(properties) { + return new DemoteMasterMySqlReplicaConfiguration(properties); + }; + + /** + * Encodes the specified DemoteMasterMySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterMySqlReplicaConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); + if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.clientKey); + if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.clientCertificate); + if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.caCertificate); + return writer; + }; + + /** + * Encodes the specified DemoteMasterMySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteMasterMySqlReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterMySqlReplicaConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.username = reader.string(); + break; + } + case 3: { + message.password = reader.string(); + break; + } + case 4: { + message.clientKey = reader.string(); + break; + } + case 5: { + message.clientCertificate = reader.string(); + break; + } + case 6: { + message.caCertificate = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteMasterMySqlReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DemoteMasterMySqlReplicaConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DemoteMasterMySqlReplicaConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + if (!$util.isString(message.clientKey)) + return "clientKey: string expected"; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + if (!$util.isString(message.clientCertificate)) + return "clientCertificate: string expected"; + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + if (!$util.isString(message.caCertificate)) + return "caCertificate: string expected"; + return null; + }; + + /** + * Creates a DemoteMasterMySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration + */ + DemoteMasterMySqlReplicaConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration) + return object; + var message = new $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.username != null) + message.username = String(object.username); + if (object.password != null) + message.password = String(object.password); + if (object.clientKey != null) + message.clientKey = String(object.clientKey); + if (object.clientCertificate != null) + message.clientCertificate = String(object.clientCertificate); + if (object.caCertificate != null) + message.caCertificate = String(object.caCertificate); + return message; + }; + + /** + * Creates a plain object from a DemoteMasterMySqlReplicaConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DemoteMasterMySqlReplicaConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.username = ""; + object.password = ""; + object.clientKey = ""; + object.clientCertificate = ""; + object.caCertificate = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + object.clientKey = message.clientKey; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + object.clientCertificate = message.clientCertificate; + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + object.caCertificate = message.caCertificate; + return object; + }; + + /** + * Converts this DemoteMasterMySqlReplicaConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @instance + * @returns {Object.} JSON object + */ + DemoteMasterMySqlReplicaConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DemoteMasterMySqlReplicaConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DemoteMasterMySqlReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration"; + }; + + return DemoteMasterMySqlReplicaConfiguration; + })(); + + v1beta4.DemoteContext = (function() { + + /** + * Properties of a DemoteContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IDemoteContext + * @property {string|null} [kind] DemoteContext kind + * @property {string|null} [sourceRepresentativeInstanceName] DemoteContext sourceRepresentativeInstanceName + */ + + /** + * Constructs a new DemoteContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DemoteContext. + * @implements IDemoteContext + * @constructor + * @param {google.cloud.sql.v1beta4.IDemoteContext=} [properties] Properties to set + */ + function DemoteContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DemoteContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @instance + */ + DemoteContext.prototype.kind = ""; + + /** + * DemoteContext sourceRepresentativeInstanceName. + * @member {string} sourceRepresentativeInstanceName + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @instance + */ + DemoteContext.prototype.sourceRepresentativeInstanceName = ""; + + /** + * Creates a new DemoteContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @static + * @param {google.cloud.sql.v1beta4.IDemoteContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DemoteContext} DemoteContext instance + */ + DemoteContext.create = function create(properties) { + return new DemoteContext(properties); + }; + + /** + * Encodes the specified DemoteContext message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @static + * @param {google.cloud.sql.v1beta4.IDemoteContext} message DemoteContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.sourceRepresentativeInstanceName != null && Object.hasOwnProperty.call(message, "sourceRepresentativeInstanceName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceRepresentativeInstanceName); + return writer; + }; + + /** + * Encodes the specified DemoteContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @static + * @param {google.cloud.sql.v1beta4.IDemoteContext} message DemoteContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DemoteContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DemoteContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DemoteContext} DemoteContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DemoteContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.sourceRepresentativeInstanceName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DemoteContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DemoteContext} DemoteContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DemoteContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DemoteContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DemoteContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.sourceRepresentativeInstanceName != null && message.hasOwnProperty("sourceRepresentativeInstanceName")) + if (!$util.isString(message.sourceRepresentativeInstanceName)) + return "sourceRepresentativeInstanceName: string expected"; + return null; + }; + + /** + * Creates a DemoteContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DemoteContext} DemoteContext + */ + DemoteContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DemoteContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.DemoteContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.sourceRepresentativeInstanceName != null) + message.sourceRepresentativeInstanceName = String(object.sourceRepresentativeInstanceName); + return message; + }; + + /** + * Creates a plain object from a DemoteContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @static + * @param {google.cloud.sql.v1beta4.DemoteContext} message DemoteContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DemoteContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.sourceRepresentativeInstanceName = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.sourceRepresentativeInstanceName != null && message.hasOwnProperty("sourceRepresentativeInstanceName")) + object.sourceRepresentativeInstanceName = message.sourceRepresentativeInstanceName; + return object; + }; + + /** + * Converts this DemoteContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @instance + * @returns {Object.} JSON object + */ + DemoteContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DemoteContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DemoteContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DemoteContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DemoteContext"; + }; + + return DemoteContext; + })(); + + /** + * SqlFileType enum. + * @name google.cloud.sql.v1beta4.SqlFileType + * @enum {number} + * @property {number} SQL_FILE_TYPE_UNSPECIFIED=0 SQL_FILE_TYPE_UNSPECIFIED value + * @property {number} SQL=1 SQL value + * @property {number} CSV=2 CSV value + * @property {number} BAK=4 BAK value + * @property {number} TDE=8 TDE value + */ + v1beta4.SqlFileType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_FILE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SQL"] = 1; + values[valuesById[2] = "CSV"] = 2; + values[valuesById[4] = "BAK"] = 4; + values[valuesById[8] = "TDE"] = 8; + return values; + })(); + + v1beta4.ExportContext = (function() { + + /** + * Properties of an ExportContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IExportContext + * @property {string|null} [uri] ExportContext uri + * @property {Array.|null} [databases] ExportContext databases + * @property {string|null} [kind] ExportContext kind + * @property {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions|null} [sqlExportOptions] ExportContext sqlExportOptions + * @property {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions|null} [csvExportOptions] ExportContext csvExportOptions + * @property {google.cloud.sql.v1beta4.SqlFileType|null} [fileType] ExportContext fileType + * @property {google.protobuf.IBoolValue|null} [offload] ExportContext offload + * @property {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions|null} [bakExportOptions] ExportContext bakExportOptions + * @property {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions|null} [tdeExportOptions] ExportContext tdeExportOptions + */ + + /** + * Constructs a new ExportContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an ExportContext. + * @implements IExportContext + * @constructor + * @param {google.cloud.sql.v1beta4.IExportContext=} [properties] Properties to set + */ + function ExportContext(properties) { + this.databases = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExportContext uri. + * @member {string} uri + * @memberof google.cloud.sql.v1beta4.ExportContext + * @instance + */ + ExportContext.prototype.uri = ""; + + /** + * ExportContext databases. + * @member {Array.} databases + * @memberof google.cloud.sql.v1beta4.ExportContext + * @instance + */ + ExportContext.prototype.databases = $util.emptyArray; + + /** + * ExportContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.ExportContext + * @instance + */ + ExportContext.prototype.kind = ""; + + /** + * ExportContext sqlExportOptions. + * @member {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions|null|undefined} sqlExportOptions + * @memberof google.cloud.sql.v1beta4.ExportContext + * @instance + */ + ExportContext.prototype.sqlExportOptions = null; + + /** + * ExportContext csvExportOptions. + * @member {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions|null|undefined} csvExportOptions + * @memberof google.cloud.sql.v1beta4.ExportContext + * @instance + */ + ExportContext.prototype.csvExportOptions = null; + + /** + * ExportContext fileType. + * @member {google.cloud.sql.v1beta4.SqlFileType} fileType + * @memberof google.cloud.sql.v1beta4.ExportContext + * @instance + */ + ExportContext.prototype.fileType = 0; + + /** + * ExportContext offload. + * @member {google.protobuf.IBoolValue|null|undefined} offload + * @memberof google.cloud.sql.v1beta4.ExportContext + * @instance + */ + ExportContext.prototype.offload = null; + + /** + * ExportContext bakExportOptions. + * @member {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions|null|undefined} bakExportOptions + * @memberof google.cloud.sql.v1beta4.ExportContext + * @instance + */ + ExportContext.prototype.bakExportOptions = null; + + /** + * ExportContext tdeExportOptions. + * @member {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions|null|undefined} tdeExportOptions + * @memberof google.cloud.sql.v1beta4.ExportContext + * @instance + */ + ExportContext.prototype.tdeExportOptions = null; + + /** + * Creates a new ExportContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ExportContext + * @static + * @param {google.cloud.sql.v1beta4.IExportContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ExportContext} ExportContext instance + */ + ExportContext.create = function create(properties) { + return new ExportContext(properties); + }; + + /** + * Encodes the specified ExportContext message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ExportContext + * @static + * @param {google.cloud.sql.v1beta4.IExportContext} message ExportContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.databases != null && message.databases.length) + for (var i = 0; i < message.databases.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.databases[i]); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + if (message.sqlExportOptions != null && Object.hasOwnProperty.call(message, "sqlExportOptions")) + $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.encode(message.sqlExportOptions, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.csvExportOptions != null && Object.hasOwnProperty.call(message, "csvExportOptions")) + $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.encode(message.csvExportOptions, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.fileType != null && Object.hasOwnProperty.call(message, "fileType")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.fileType); + if (message.offload != null && Object.hasOwnProperty.call(message, "offload")) + $root.google.protobuf.BoolValue.encode(message.offload, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.bakExportOptions != null && Object.hasOwnProperty.call(message, "bakExportOptions")) + $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.encode(message.bakExportOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.tdeExportOptions != null && Object.hasOwnProperty.call(message, "tdeExportOptions")) + $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.encode(message.tdeExportOptions, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext + * @static + * @param {google.cloud.sql.v1beta4.IExportContext} message ExportContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExportContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExportContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ExportContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ExportContext} ExportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + if (!(message.databases && message.databases.length)) + message.databases = []; + message.databases.push(reader.string()); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + case 4: { + message.sqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.csvExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.decode(reader, reader.uint32()); + break; + } + case 6: { + message.fileType = reader.int32(); + break; + } + case 8: { + message.offload = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 9: { + message.bakExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.decode(reader, reader.uint32()); + break; + } + case 10: { + message.tdeExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExportContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ExportContext} ExportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExportContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExportContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ExportContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExportContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.databases != null && message.hasOwnProperty("databases")) { + if (!Array.isArray(message.databases)) + return "databases: array expected"; + for (var i = 0; i < message.databases.length; ++i) + if (!$util.isString(message.databases[i])) + return "databases: string[] expected"; + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.sqlExportOptions != null && message.hasOwnProperty("sqlExportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.verify(message.sqlExportOptions); + if (error) + return "sqlExportOptions." + error; + } + if (message.csvExportOptions != null && message.hasOwnProperty("csvExportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.verify(message.csvExportOptions); + if (error) + return "csvExportOptions." + error; + } + if (message.fileType != null && message.hasOwnProperty("fileType")) + switch (message.fileType) { + default: + return "fileType: enum value expected"; + case 0: + case 1: + case 2: + case 4: + case 8: + break; + } + if (message.offload != null && message.hasOwnProperty("offload")) { + var error = $root.google.protobuf.BoolValue.verify(message.offload); + if (error) + return "offload." + error; + } + if (message.bakExportOptions != null && message.hasOwnProperty("bakExportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.verify(message.bakExportOptions); + if (error) + return "bakExportOptions." + error; + } + if (message.tdeExportOptions != null && message.hasOwnProperty("tdeExportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.verify(message.tdeExportOptions); + if (error) + return "tdeExportOptions." + error; + } + return null; + }; + + /** + * Creates an ExportContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ExportContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ExportContext} ExportContext + */ + ExportContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.ExportContext(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.databases) { + if (!Array.isArray(object.databases)) + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.databases: array expected"); + message.databases = []; + for (var i = 0; i < object.databases.length; ++i) + message.databases[i] = String(object.databases[i]); + } + if (object.kind != null) + message.kind = String(object.kind); + if (object.sqlExportOptions != null) { + if (typeof object.sqlExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.sqlExportOptions: object expected"); + message.sqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.fromObject(object.sqlExportOptions); + } + if (object.csvExportOptions != null) { + if (typeof object.csvExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.csvExportOptions: object expected"); + message.csvExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.fromObject(object.csvExportOptions); + } + switch (object.fileType) { + default: + if (typeof object.fileType === "number") { + message.fileType = object.fileType; + break; + } + break; + case "SQL_FILE_TYPE_UNSPECIFIED": + case 0: + message.fileType = 0; + break; + case "SQL": + case 1: + message.fileType = 1; + break; + case "CSV": + case 2: + message.fileType = 2; + break; + case "BAK": + case 4: + message.fileType = 4; + break; + case "TDE": + case 8: + message.fileType = 8; + break; + } + if (object.offload != null) { + if (typeof object.offload !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.offload: object expected"); + message.offload = $root.google.protobuf.BoolValue.fromObject(object.offload); + } + if (object.bakExportOptions != null) { + if (typeof object.bakExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.bakExportOptions: object expected"); + message.bakExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.fromObject(object.bakExportOptions); + } + if (object.tdeExportOptions != null) { + if (typeof object.tdeExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.tdeExportOptions: object expected"); + message.tdeExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.fromObject(object.tdeExportOptions); + } + return message; + }; + + /** + * Creates a plain object from an ExportContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ExportContext + * @static + * @param {google.cloud.sql.v1beta4.ExportContext} message ExportContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExportContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.databases = []; + if (options.defaults) { + object.uri = ""; + object.kind = ""; + object.sqlExportOptions = null; + object.csvExportOptions = null; + object.fileType = options.enums === String ? "SQL_FILE_TYPE_UNSPECIFIED" : 0; + object.offload = null; + object.bakExportOptions = null; + object.tdeExportOptions = null; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.databases && message.databases.length) { + object.databases = []; + for (var j = 0; j < message.databases.length; ++j) + object.databases[j] = message.databases[j]; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.sqlExportOptions != null && message.hasOwnProperty("sqlExportOptions")) + object.sqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.toObject(message.sqlExportOptions, options); + if (message.csvExportOptions != null && message.hasOwnProperty("csvExportOptions")) + object.csvExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.toObject(message.csvExportOptions, options); + if (message.fileType != null && message.hasOwnProperty("fileType")) + object.fileType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlFileType[message.fileType] === undefined ? message.fileType : $root.google.cloud.sql.v1beta4.SqlFileType[message.fileType] : message.fileType; + if (message.offload != null && message.hasOwnProperty("offload")) + object.offload = $root.google.protobuf.BoolValue.toObject(message.offload, options); + if (message.bakExportOptions != null && message.hasOwnProperty("bakExportOptions")) + object.bakExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.toObject(message.bakExportOptions, options); + if (message.tdeExportOptions != null && message.hasOwnProperty("tdeExportOptions")) + object.tdeExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.toObject(message.tdeExportOptions, options); + return object; + }; + + /** + * Converts this ExportContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ExportContext + * @instance + * @returns {Object.} JSON object + */ + ExportContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExportContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ExportContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExportContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext"; + }; + + ExportContext.SqlCsvExportOptions = (function() { + + /** + * Properties of a SqlCsvExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext + * @interface ISqlCsvExportOptions + * @property {string|null} [selectQuery] SqlCsvExportOptions selectQuery + * @property {string|null} [escapeCharacter] SqlCsvExportOptions escapeCharacter + * @property {string|null} [quoteCharacter] SqlCsvExportOptions quoteCharacter + * @property {string|null} [fieldsTerminatedBy] SqlCsvExportOptions fieldsTerminatedBy + * @property {string|null} [linesTerminatedBy] SqlCsvExportOptions linesTerminatedBy + */ + + /** + * Constructs a new SqlCsvExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext + * @classdesc Represents a SqlCsvExportOptions. + * @implements ISqlCsvExportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions=} [properties] Properties to set + */ + function SqlCsvExportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlCsvExportOptions selectQuery. + * @member {string} selectQuery + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @instance + */ + SqlCsvExportOptions.prototype.selectQuery = ""; + + /** + * SqlCsvExportOptions escapeCharacter. + * @member {string} escapeCharacter + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @instance + */ + SqlCsvExportOptions.prototype.escapeCharacter = ""; + + /** + * SqlCsvExportOptions quoteCharacter. + * @member {string} quoteCharacter + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @instance + */ + SqlCsvExportOptions.prototype.quoteCharacter = ""; + + /** + * SqlCsvExportOptions fieldsTerminatedBy. + * @member {string} fieldsTerminatedBy + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @instance + */ + SqlCsvExportOptions.prototype.fieldsTerminatedBy = ""; + + /** + * SqlCsvExportOptions linesTerminatedBy. + * @member {string} linesTerminatedBy + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @instance + */ + SqlCsvExportOptions.prototype.linesTerminatedBy = ""; + + /** + * Creates a new SqlCsvExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions instance + */ + SqlCsvExportOptions.create = function create(properties) { + return new SqlCsvExportOptions(properties); + }; + + /** + * Encodes the specified SqlCsvExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions} message SqlCsvExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlCsvExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selectQuery != null && Object.hasOwnProperty.call(message, "selectQuery")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selectQuery); + if (message.escapeCharacter != null && Object.hasOwnProperty.call(message, "escapeCharacter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.escapeCharacter); + if (message.quoteCharacter != null && Object.hasOwnProperty.call(message, "quoteCharacter")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.quoteCharacter); + if (message.fieldsTerminatedBy != null && Object.hasOwnProperty.call(message, "fieldsTerminatedBy")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.fieldsTerminatedBy); + if (message.linesTerminatedBy != null && Object.hasOwnProperty.call(message, "linesTerminatedBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.linesTerminatedBy); + return writer; + }; + + /** + * Encodes the specified SqlCsvExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions} message SqlCsvExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlCsvExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlCsvExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlCsvExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.selectQuery = reader.string(); + break; + } + case 2: { + message.escapeCharacter = reader.string(); + break; + } + case 3: { + message.quoteCharacter = reader.string(); + break; + } + case 4: { + message.fieldsTerminatedBy = reader.string(); + break; + } + case 6: { + message.linesTerminatedBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlCsvExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlCsvExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlCsvExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlCsvExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.selectQuery != null && message.hasOwnProperty("selectQuery")) + if (!$util.isString(message.selectQuery)) + return "selectQuery: string expected"; + if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) + if (!$util.isString(message.escapeCharacter)) + return "escapeCharacter: string expected"; + if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) + if (!$util.isString(message.quoteCharacter)) + return "quoteCharacter: string expected"; + if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) + if (!$util.isString(message.fieldsTerminatedBy)) + return "fieldsTerminatedBy: string expected"; + if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) + if (!$util.isString(message.linesTerminatedBy)) + return "linesTerminatedBy: string expected"; + return null; + }; + + /** + * Creates a SqlCsvExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions + */ + SqlCsvExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions(); + if (object.selectQuery != null) + message.selectQuery = String(object.selectQuery); + if (object.escapeCharacter != null) + message.escapeCharacter = String(object.escapeCharacter); + if (object.quoteCharacter != null) + message.quoteCharacter = String(object.quoteCharacter); + if (object.fieldsTerminatedBy != null) + message.fieldsTerminatedBy = String(object.fieldsTerminatedBy); + if (object.linesTerminatedBy != null) + message.linesTerminatedBy = String(object.linesTerminatedBy); + return message; + }; + + /** + * Creates a plain object from a SqlCsvExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions} message SqlCsvExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlCsvExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.selectQuery = ""; + object.escapeCharacter = ""; + object.quoteCharacter = ""; + object.fieldsTerminatedBy = ""; + object.linesTerminatedBy = ""; + } + if (message.selectQuery != null && message.hasOwnProperty("selectQuery")) + object.selectQuery = message.selectQuery; + if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) + object.escapeCharacter = message.escapeCharacter; + if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) + object.quoteCharacter = message.quoteCharacter; + if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) + object.fieldsTerminatedBy = message.fieldsTerminatedBy; + if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) + object.linesTerminatedBy = message.linesTerminatedBy; + return object; + }; + + /** + * Converts this SqlCsvExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlCsvExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlCsvExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlCsvExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions"; + }; + + return SqlCsvExportOptions; + })(); + + ExportContext.SqlExportOptions = (function() { + + /** + * Properties of a SqlExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext + * @interface ISqlExportOptions + * @property {Array.|null} [tables] SqlExportOptions tables + * @property {google.protobuf.IBoolValue|null} [schemaOnly] SqlExportOptions schemaOnly + * @property {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions|null} [mysqlExportOptions] SqlExportOptions mysqlExportOptions + * @property {google.protobuf.IInt32Value|null} [threads] SqlExportOptions threads + * @property {google.protobuf.IBoolValue|null} [parallel] SqlExportOptions parallel + * @property {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions|null} [postgresExportOptions] SqlExportOptions postgresExportOptions + */ + + /** + * Constructs a new SqlExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext + * @classdesc Represents a SqlExportOptions. + * @implements ISqlExportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions=} [properties] Properties to set + */ + function SqlExportOptions(properties) { + this.tables = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlExportOptions tables. + * @member {Array.} tables + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.tables = $util.emptyArray; + + /** + * SqlExportOptions schemaOnly. + * @member {google.protobuf.IBoolValue|null|undefined} schemaOnly + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.schemaOnly = null; + + /** + * SqlExportOptions mysqlExportOptions. + * @member {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions|null|undefined} mysqlExportOptions + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.mysqlExportOptions = null; + + /** + * SqlExportOptions threads. + * @member {google.protobuf.IInt32Value|null|undefined} threads + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.threads = null; + + /** + * SqlExportOptions parallel. + * @member {google.protobuf.IBoolValue|null|undefined} parallel + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.parallel = null; + + /** + * SqlExportOptions postgresExportOptions. + * @member {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions|null|undefined} postgresExportOptions + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @instance + */ + SqlExportOptions.prototype.postgresExportOptions = null; + + /** + * Creates a new SqlExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions} SqlExportOptions instance + */ + SqlExportOptions.create = function create(properties) { + return new SqlExportOptions(properties); + }; + + /** + * Encodes the specified SqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions} message SqlExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tables != null && message.tables.length) + for (var i = 0; i < message.tables.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.tables[i]); + if (message.schemaOnly != null && Object.hasOwnProperty.call(message, "schemaOnly")) + $root.google.protobuf.BoolValue.encode(message.schemaOnly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.mysqlExportOptions != null && Object.hasOwnProperty.call(message, "mysqlExportOptions")) + $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.encode(message.mysqlExportOptions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.threads != null && Object.hasOwnProperty.call(message, "threads")) + $root.google.protobuf.Int32Value.encode(message.threads, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.parallel != null && Object.hasOwnProperty.call(message, "parallel")) + $root.google.protobuf.BoolValue.encode(message.parallel, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.postgresExportOptions != null && Object.hasOwnProperty.call(message, "postgresExportOptions")) + $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.encode(message.postgresExportOptions, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions} message SqlExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions} SqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.tables && message.tables.length)) + message.tables = []; + message.tables.push(reader.string()); + break; + } + case 2: { + message.schemaOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 3: { + message.mysqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + message.threads = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 5: { + message.parallel = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 6: { + message.postgresExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions} SqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tables != null && message.hasOwnProperty("tables")) { + if (!Array.isArray(message.tables)) + return "tables: array expected"; + for (var i = 0; i < message.tables.length; ++i) + if (!$util.isString(message.tables[i])) + return "tables: string[] expected"; + } + if (message.schemaOnly != null && message.hasOwnProperty("schemaOnly")) { + var error = $root.google.protobuf.BoolValue.verify(message.schemaOnly); + if (error) + return "schemaOnly." + error; + } + if (message.mysqlExportOptions != null && message.hasOwnProperty("mysqlExportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.verify(message.mysqlExportOptions); + if (error) + return "mysqlExportOptions." + error; + } + if (message.threads != null && message.hasOwnProperty("threads")) { + var error = $root.google.protobuf.Int32Value.verify(message.threads); + if (error) + return "threads." + error; + } + if (message.parallel != null && message.hasOwnProperty("parallel")) { + var error = $root.google.protobuf.BoolValue.verify(message.parallel); + if (error) + return "parallel." + error; + } + if (message.postgresExportOptions != null && message.hasOwnProperty("postgresExportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.verify(message.postgresExportOptions); + if (error) + return "postgresExportOptions." + error; + } + return null; + }; + + /** + * Creates a SqlExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions} SqlExportOptions + */ + SqlExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions(); + if (object.tables) { + if (!Array.isArray(object.tables)) + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.tables: array expected"); + message.tables = []; + for (var i = 0; i < object.tables.length; ++i) + message.tables[i] = String(object.tables[i]); + } + if (object.schemaOnly != null) { + if (typeof object.schemaOnly !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.schemaOnly: object expected"); + message.schemaOnly = $root.google.protobuf.BoolValue.fromObject(object.schemaOnly); + } + if (object.mysqlExportOptions != null) { + if (typeof object.mysqlExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.mysqlExportOptions: object expected"); + message.mysqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.fromObject(object.mysqlExportOptions); + } + if (object.threads != null) { + if (typeof object.threads !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.threads: object expected"); + message.threads = $root.google.protobuf.Int32Value.fromObject(object.threads); + } + if (object.parallel != null) { + if (typeof object.parallel !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.parallel: object expected"); + message.parallel = $root.google.protobuf.BoolValue.fromObject(object.parallel); + } + if (object.postgresExportOptions != null) { + if (typeof object.postgresExportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.postgresExportOptions: object expected"); + message.postgresExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.fromObject(object.postgresExportOptions); + } + return message; + }; + + /** + * Creates a plain object from a SqlExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions} message SqlExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.tables = []; + if (options.defaults) { + object.schemaOnly = null; + object.mysqlExportOptions = null; + object.threads = null; + object.parallel = null; + object.postgresExportOptions = null; + } + if (message.tables && message.tables.length) { + object.tables = []; + for (var j = 0; j < message.tables.length; ++j) + object.tables[j] = message.tables[j]; + } + if (message.schemaOnly != null && message.hasOwnProperty("schemaOnly")) + object.schemaOnly = $root.google.protobuf.BoolValue.toObject(message.schemaOnly, options); + if (message.mysqlExportOptions != null && message.hasOwnProperty("mysqlExportOptions")) + object.mysqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.toObject(message.mysqlExportOptions, options); + if (message.threads != null && message.hasOwnProperty("threads")) + object.threads = $root.google.protobuf.Int32Value.toObject(message.threads, options); + if (message.parallel != null && message.hasOwnProperty("parallel")) + object.parallel = $root.google.protobuf.BoolValue.toObject(message.parallel, options); + if (message.postgresExportOptions != null && message.hasOwnProperty("postgresExportOptions")) + object.postgresExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.toObject(message.postgresExportOptions, options); + return object; + }; + + /** + * Converts this SqlExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlExportOptions"; + }; + + SqlExportOptions.MysqlExportOptions = (function() { + + /** + * Properties of a MysqlExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @interface IMysqlExportOptions + * @property {google.protobuf.IInt32Value|null} [masterData] MysqlExportOptions masterData + */ + + /** + * Constructs a new MysqlExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @classdesc Represents a MysqlExportOptions. + * @implements IMysqlExportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions=} [properties] Properties to set + */ + function MysqlExportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MysqlExportOptions masterData. + * @member {google.protobuf.IInt32Value|null|undefined} masterData + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @instance + */ + MysqlExportOptions.prototype.masterData = null; + + /** + * Creates a new MysqlExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions instance + */ + MysqlExportOptions.create = function create(properties) { + return new MysqlExportOptions(properties); + }; + + /** + * Encodes the specified MysqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions} message MysqlExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MysqlExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.masterData != null && Object.hasOwnProperty.call(message, "masterData")) + $root.google.protobuf.Int32Value.encode(message.masterData, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MysqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions} message MysqlExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MysqlExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MysqlExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MysqlExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.masterData = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MysqlExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MysqlExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MysqlExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MysqlExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.masterData != null && message.hasOwnProperty("masterData")) { + var error = $root.google.protobuf.Int32Value.verify(message.masterData); + if (error) + return "masterData." + error; + } + return null; + }; + + /** + * Creates a MysqlExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions + */ + MysqlExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions(); + if (object.masterData != null) { + if (typeof object.masterData !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.masterData: object expected"); + message.masterData = $root.google.protobuf.Int32Value.fromObject(object.masterData); + } + return message; + }; + + /** + * Creates a plain object from a MysqlExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions} message MysqlExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MysqlExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.masterData = null; + if (message.masterData != null && message.hasOwnProperty("masterData")) + object.masterData = $root.google.protobuf.Int32Value.toObject(message.masterData, options); + return object; + }; + + /** + * Converts this MysqlExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @instance + * @returns {Object.} JSON object + */ + MysqlExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MysqlExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MysqlExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions"; + }; + + return MysqlExportOptions; + })(); + + SqlExportOptions.PostgresExportOptions = (function() { + + /** + * Properties of a PostgresExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @interface IPostgresExportOptions + * @property {google.protobuf.IBoolValue|null} [clean] PostgresExportOptions clean + * @property {google.protobuf.IBoolValue|null} [ifExists] PostgresExportOptions ifExists + */ + + /** + * Constructs a new PostgresExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions + * @classdesc Represents a PostgresExportOptions. + * @implements IPostgresExportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions=} [properties] Properties to set + */ + function PostgresExportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PostgresExportOptions clean. + * @member {google.protobuf.IBoolValue|null|undefined} clean + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @instance + */ + PostgresExportOptions.prototype.clean = null; + + /** + * PostgresExportOptions ifExists. + * @member {google.protobuf.IBoolValue|null|undefined} ifExists + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @instance + */ + PostgresExportOptions.prototype.ifExists = null; + + /** + * Creates a new PostgresExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions instance + */ + PostgresExportOptions.create = function create(properties) { + return new PostgresExportOptions(properties); + }; + + /** + * Encodes the specified PostgresExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions} message PostgresExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PostgresExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.clean != null && Object.hasOwnProperty.call(message, "clean")) + $root.google.protobuf.BoolValue.encode(message.clean, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.ifExists != null && Object.hasOwnProperty.call(message, "ifExists")) + $root.google.protobuf.BoolValue.encode(message.ifExists, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PostgresExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions} message PostgresExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PostgresExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PostgresExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PostgresExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.clean = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 2: { + message.ifExists = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PostgresExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PostgresExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PostgresExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PostgresExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.clean != null && message.hasOwnProperty("clean")) { + var error = $root.google.protobuf.BoolValue.verify(message.clean); + if (error) + return "clean." + error; + } + if (message.ifExists != null && message.hasOwnProperty("ifExists")) { + var error = $root.google.protobuf.BoolValue.verify(message.ifExists); + if (error) + return "ifExists." + error; + } + return null; + }; + + /** + * Creates a PostgresExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions + */ + PostgresExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions(); + if (object.clean != null) { + if (typeof object.clean !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.clean: object expected"); + message.clean = $root.google.protobuf.BoolValue.fromObject(object.clean); + } + if (object.ifExists != null) { + if (typeof object.ifExists !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.ifExists: object expected"); + message.ifExists = $root.google.protobuf.BoolValue.fromObject(object.ifExists); + } + return message; + }; + + /** + * Creates a plain object from a PostgresExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions} message PostgresExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PostgresExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.clean = null; + object.ifExists = null; + } + if (message.clean != null && message.hasOwnProperty("clean")) + object.clean = $root.google.protobuf.BoolValue.toObject(message.clean, options); + if (message.ifExists != null && message.hasOwnProperty("ifExists")) + object.ifExists = $root.google.protobuf.BoolValue.toObject(message.ifExists, options); + return object; + }; + + /** + * Converts this PostgresExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @instance + * @returns {Object.} JSON object + */ + PostgresExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PostgresExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PostgresExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions"; + }; + + return PostgresExportOptions; + })(); + + return SqlExportOptions; + })(); + + ExportContext.SqlBakExportOptions = (function() { + + /** + * Properties of a SqlBakExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext + * @interface ISqlBakExportOptions + * @property {google.protobuf.IBoolValue|null} [striped] SqlBakExportOptions striped + * @property {google.protobuf.IInt32Value|null} [stripeCount] SqlBakExportOptions stripeCount + * @property {google.cloud.sql.v1beta4.BakType|null} [bakType] SqlBakExportOptions bakType + * @property {google.protobuf.IBoolValue|null} [copyOnly] SqlBakExportOptions copyOnly + * @property {google.protobuf.IBoolValue|null} [differentialBase] SqlBakExportOptions differentialBase + * @property {google.protobuf.ITimestamp|null} [exportLogStartTime] SqlBakExportOptions exportLogStartTime + * @property {google.protobuf.ITimestamp|null} [exportLogEndTime] SqlBakExportOptions exportLogEndTime + */ + + /** + * Constructs a new SqlBakExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext + * @classdesc Represents a SqlBakExportOptions. + * @implements ISqlBakExportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions=} [properties] Properties to set + */ + function SqlBakExportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBakExportOptions striped. + * @member {google.protobuf.IBoolValue|null|undefined} striped + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.striped = null; + + /** + * SqlBakExportOptions stripeCount. + * @member {google.protobuf.IInt32Value|null|undefined} stripeCount + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.stripeCount = null; + + /** + * SqlBakExportOptions bakType. + * @member {google.cloud.sql.v1beta4.BakType} bakType + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.bakType = 0; + + /** + * SqlBakExportOptions copyOnly. + * @member {google.protobuf.IBoolValue|null|undefined} copyOnly + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.copyOnly = null; + + /** + * SqlBakExportOptions differentialBase. + * @member {google.protobuf.IBoolValue|null|undefined} differentialBase + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.differentialBase = null; + + /** + * SqlBakExportOptions exportLogStartTime. + * @member {google.protobuf.ITimestamp|null|undefined} exportLogStartTime + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.exportLogStartTime = null; + + /** + * SqlBakExportOptions exportLogEndTime. + * @member {google.protobuf.ITimestamp|null|undefined} exportLogEndTime + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @instance + */ + SqlBakExportOptions.prototype.exportLogEndTime = null; + + /** + * Creates a new SqlBakExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions} SqlBakExportOptions instance + */ + SqlBakExportOptions.create = function create(properties) { + return new SqlBakExportOptions(properties); + }; + + /** + * Encodes the specified SqlBakExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions} message SqlBakExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBakExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.striped != null && Object.hasOwnProperty.call(message, "striped")) + $root.google.protobuf.BoolValue.encode(message.striped, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.stripeCount != null && Object.hasOwnProperty.call(message, "stripeCount")) + $root.google.protobuf.Int32Value.encode(message.stripeCount, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.bakType != null && Object.hasOwnProperty.call(message, "bakType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.bakType); + if (message.copyOnly != null && Object.hasOwnProperty.call(message, "copyOnly")) + $root.google.protobuf.BoolValue.encode(message.copyOnly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.differentialBase != null && Object.hasOwnProperty.call(message, "differentialBase")) + $root.google.protobuf.BoolValue.encode(message.differentialBase, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.exportLogStartTime != null && Object.hasOwnProperty.call(message, "exportLogStartTime")) + $root.google.protobuf.Timestamp.encode(message.exportLogStartTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.exportLogEndTime != null && Object.hasOwnProperty.call(message, "exportLogEndTime")) + $root.google.protobuf.Timestamp.encode(message.exportLogEndTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlBakExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions} message SqlBakExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBakExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBakExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions} SqlBakExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBakExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.striped = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 2: { + message.stripeCount = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 4: { + message.bakType = reader.int32(); + break; + } + case 5: { + message.copyOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 6: { + message.differentialBase = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 7: { + message.exportLogStartTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.exportLogEndTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBakExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions} SqlBakExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBakExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBakExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBakExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.striped != null && message.hasOwnProperty("striped")) { + var error = $root.google.protobuf.BoolValue.verify(message.striped); + if (error) + return "striped." + error; + } + if (message.stripeCount != null && message.hasOwnProperty("stripeCount")) { + var error = $root.google.protobuf.Int32Value.verify(message.stripeCount); + if (error) + return "stripeCount." + error; + } + if (message.bakType != null && message.hasOwnProperty("bakType")) + switch (message.bakType) { + default: + return "bakType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.copyOnly != null && message.hasOwnProperty("copyOnly")) { + var error = $root.google.protobuf.BoolValue.verify(message.copyOnly); + if (error) + return "copyOnly." + error; + } + if (message.differentialBase != null && message.hasOwnProperty("differentialBase")) { + var error = $root.google.protobuf.BoolValue.verify(message.differentialBase); + if (error) + return "differentialBase." + error; + } + if (message.exportLogStartTime != null && message.hasOwnProperty("exportLogStartTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.exportLogStartTime); + if (error) + return "exportLogStartTime." + error; + } + if (message.exportLogEndTime != null && message.hasOwnProperty("exportLogEndTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.exportLogEndTime); + if (error) + return "exportLogEndTime." + error; + } + return null; + }; + + /** + * Creates a SqlBakExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions} SqlBakExportOptions + */ + SqlBakExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions(); + if (object.striped != null) { + if (typeof object.striped !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.striped: object expected"); + message.striped = $root.google.protobuf.BoolValue.fromObject(object.striped); + } + if (object.stripeCount != null) { + if (typeof object.stripeCount !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.stripeCount: object expected"); + message.stripeCount = $root.google.protobuf.Int32Value.fromObject(object.stripeCount); + } + switch (object.bakType) { + default: + if (typeof object.bakType === "number") { + message.bakType = object.bakType; + break; + } + break; + case "BAK_TYPE_UNSPECIFIED": + case 0: + message.bakType = 0; + break; + case "FULL": + case 1: + message.bakType = 1; + break; + case "DIFF": + case 2: + message.bakType = 2; + break; + case "TLOG": + case 3: + message.bakType = 3; + break; + } + if (object.copyOnly != null) { + if (typeof object.copyOnly !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.copyOnly: object expected"); + message.copyOnly = $root.google.protobuf.BoolValue.fromObject(object.copyOnly); + } + if (object.differentialBase != null) { + if (typeof object.differentialBase !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.differentialBase: object expected"); + message.differentialBase = $root.google.protobuf.BoolValue.fromObject(object.differentialBase); + } + if (object.exportLogStartTime != null) { + if (typeof object.exportLogStartTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.exportLogStartTime: object expected"); + message.exportLogStartTime = $root.google.protobuf.Timestamp.fromObject(object.exportLogStartTime); + } + if (object.exportLogEndTime != null) { + if (typeof object.exportLogEndTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.exportLogEndTime: object expected"); + message.exportLogEndTime = $root.google.protobuf.Timestamp.fromObject(object.exportLogEndTime); + } + return message; + }; + + /** + * Creates a plain object from a SqlBakExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions} message SqlBakExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBakExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.striped = null; + object.stripeCount = null; + object.bakType = options.enums === String ? "BAK_TYPE_UNSPECIFIED" : 0; + object.copyOnly = null; + object.differentialBase = null; + object.exportLogStartTime = null; + object.exportLogEndTime = null; + } + if (message.striped != null && message.hasOwnProperty("striped")) + object.striped = $root.google.protobuf.BoolValue.toObject(message.striped, options); + if (message.stripeCount != null && message.hasOwnProperty("stripeCount")) + object.stripeCount = $root.google.protobuf.Int32Value.toObject(message.stripeCount, options); + if (message.bakType != null && message.hasOwnProperty("bakType")) + object.bakType = options.enums === String ? $root.google.cloud.sql.v1beta4.BakType[message.bakType] === undefined ? message.bakType : $root.google.cloud.sql.v1beta4.BakType[message.bakType] : message.bakType; + if (message.copyOnly != null && message.hasOwnProperty("copyOnly")) + object.copyOnly = $root.google.protobuf.BoolValue.toObject(message.copyOnly, options); + if (message.differentialBase != null && message.hasOwnProperty("differentialBase")) + object.differentialBase = $root.google.protobuf.BoolValue.toObject(message.differentialBase, options); + if (message.exportLogStartTime != null && message.hasOwnProperty("exportLogStartTime")) + object.exportLogStartTime = $root.google.protobuf.Timestamp.toObject(message.exportLogStartTime, options); + if (message.exportLogEndTime != null && message.hasOwnProperty("exportLogEndTime")) + object.exportLogEndTime = $root.google.protobuf.Timestamp.toObject(message.exportLogEndTime, options); + return object; + }; + + /** + * Converts this SqlBakExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlBakExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBakExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBakExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions"; + }; + + return SqlBakExportOptions; + })(); + + ExportContext.SqlTdeExportOptions = (function() { + + /** + * Properties of a SqlTdeExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext + * @interface ISqlTdeExportOptions + * @property {string|null} [certificatePath] SqlTdeExportOptions certificatePath + * @property {string|null} [privateKeyPath] SqlTdeExportOptions privateKeyPath + * @property {string|null} [privateKeyPassword] SqlTdeExportOptions privateKeyPassword + * @property {string|null} [name] SqlTdeExportOptions name + */ + + /** + * Constructs a new SqlTdeExportOptions. + * @memberof google.cloud.sql.v1beta4.ExportContext + * @classdesc Represents a SqlTdeExportOptions. + * @implements ISqlTdeExportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions=} [properties] Properties to set + */ + function SqlTdeExportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlTdeExportOptions certificatePath. + * @member {string} certificatePath + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @instance + */ + SqlTdeExportOptions.prototype.certificatePath = ""; + + /** + * SqlTdeExportOptions privateKeyPath. + * @member {string} privateKeyPath + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @instance + */ + SqlTdeExportOptions.prototype.privateKeyPath = ""; + + /** + * SqlTdeExportOptions privateKeyPassword. + * @member {string} privateKeyPassword + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @instance + */ + SqlTdeExportOptions.prototype.privateKeyPassword = ""; + + /** + * SqlTdeExportOptions name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @instance + */ + SqlTdeExportOptions.prototype.name = ""; + + /** + * Creates a new SqlTdeExportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions instance + */ + SqlTdeExportOptions.create = function create(properties) { + return new SqlTdeExportOptions(properties); + }; + + /** + * Encodes the specified SqlTdeExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions} message SqlTdeExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTdeExportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certificatePath != null && Object.hasOwnProperty.call(message, "certificatePath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.certificatePath); + if (message.privateKeyPath != null && Object.hasOwnProperty.call(message, "privateKeyPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateKeyPath); + if (message.privateKeyPassword != null && Object.hasOwnProperty.call(message, "privateKeyPassword")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.privateKeyPassword); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + return writer; + }; + + /** + * Encodes the specified SqlTdeExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions} message SqlTdeExportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTdeExportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlTdeExportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTdeExportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.certificatePath = reader.string(); + break; + } + case 2: { + message.privateKeyPath = reader.string(); + break; + } + case 3: { + message.privateKeyPassword = reader.string(); + break; + } + case 5: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlTdeExportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTdeExportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlTdeExportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlTdeExportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) + if (!$util.isString(message.certificatePath)) + return "certificatePath: string expected"; + if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) + if (!$util.isString(message.privateKeyPath)) + return "privateKeyPath: string expected"; + if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) + if (!$util.isString(message.privateKeyPassword)) + return "privateKeyPassword: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a SqlTdeExportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions + */ + SqlTdeExportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions(); + if (object.certificatePath != null) + message.certificatePath = String(object.certificatePath); + if (object.privateKeyPath != null) + message.privateKeyPath = String(object.privateKeyPath); + if (object.privateKeyPassword != null) + message.privateKeyPassword = String(object.privateKeyPassword); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a SqlTdeExportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @static + * @param {google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions} message SqlTdeExportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlTdeExportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.certificatePath = ""; + object.privateKeyPath = ""; + object.privateKeyPassword = ""; + object.name = ""; + } + if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) + object.certificatePath = message.certificatePath; + if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) + object.privateKeyPath = message.privateKeyPath; + if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) + object.privateKeyPassword = message.privateKeyPassword; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this SqlTdeExportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlTdeExportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlTdeExportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlTdeExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions"; + }; + + return SqlTdeExportOptions; + })(); + + return ExportContext; + })(); + + v1beta4.FailoverContext = (function() { + + /** + * Properties of a FailoverContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IFailoverContext + * @property {number|Long|null} [settingsVersion] FailoverContext settingsVersion + * @property {string|null} [kind] FailoverContext kind + */ + + /** + * Constructs a new FailoverContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a FailoverContext. + * @implements IFailoverContext + * @constructor + * @param {google.cloud.sql.v1beta4.IFailoverContext=} [properties] Properties to set + */ + function FailoverContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FailoverContext settingsVersion. + * @member {number|Long} settingsVersion + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @instance + */ + FailoverContext.prototype.settingsVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * FailoverContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @instance + */ + FailoverContext.prototype.kind = ""; + + /** + * Creates a new FailoverContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @static + * @param {google.cloud.sql.v1beta4.IFailoverContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.FailoverContext} FailoverContext instance + */ + FailoverContext.create = function create(properties) { + return new FailoverContext(properties); + }; + + /** + * Encodes the specified FailoverContext message. Does not implicitly {@link google.cloud.sql.v1beta4.FailoverContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @static + * @param {google.cloud.sql.v1beta4.IFailoverContext} message FailoverContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FailoverContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.settingsVersion != null && Object.hasOwnProperty.call(message, "settingsVersion")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.settingsVersion); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + return writer; + }; + + /** + * Encodes the specified FailoverContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FailoverContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @static + * @param {google.cloud.sql.v1beta4.IFailoverContext} message FailoverContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FailoverContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FailoverContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.FailoverContext} FailoverContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FailoverContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.FailoverContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.settingsVersion = reader.int64(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FailoverContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.FailoverContext} FailoverContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FailoverContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FailoverContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FailoverContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) + if (!$util.isInteger(message.settingsVersion) && !(message.settingsVersion && $util.isInteger(message.settingsVersion.low) && $util.isInteger(message.settingsVersion.high))) + return "settingsVersion: integer|Long expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a FailoverContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.FailoverContext} FailoverContext + */ + FailoverContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.FailoverContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.FailoverContext(); + if (object.settingsVersion != null) + if ($util.Long) + (message.settingsVersion = $util.Long.fromValue(object.settingsVersion)).unsigned = false; + else if (typeof object.settingsVersion === "string") + message.settingsVersion = parseInt(object.settingsVersion, 10); + else if (typeof object.settingsVersion === "number") + message.settingsVersion = object.settingsVersion; + else if (typeof object.settingsVersion === "object") + message.settingsVersion = new $util.LongBits(object.settingsVersion.low >>> 0, object.settingsVersion.high >>> 0).toNumber(); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a FailoverContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @static + * @param {google.cloud.sql.v1beta4.FailoverContext} message FailoverContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FailoverContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.settingsVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.settingsVersion = options.longs === String ? "0" : 0; + object.kind = ""; + } + if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) + if (typeof message.settingsVersion === "number") + object.settingsVersion = options.longs === String ? String(message.settingsVersion) : message.settingsVersion; + else + object.settingsVersion = options.longs === String ? $util.Long.prototype.toString.call(message.settingsVersion) : options.longs === Number ? new $util.LongBits(message.settingsVersion.low >>> 0, message.settingsVersion.high >>> 0).toNumber() : message.settingsVersion; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this FailoverContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @instance + * @returns {Object.} JSON object + */ + FailoverContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FailoverContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.FailoverContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FailoverContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.FailoverContext"; + }; + + return FailoverContext; + })(); + + v1beta4.Flag = (function() { + + /** + * Properties of a Flag. + * @memberof google.cloud.sql.v1beta4 + * @interface IFlag + * @property {string|null} [name] Flag name + * @property {google.cloud.sql.v1beta4.SqlFlagType|null} [type] Flag type + * @property {Array.|null} [appliesTo] Flag appliesTo + * @property {Array.|null} [allowedStringValues] Flag allowedStringValues + * @property {google.protobuf.IInt64Value|null} [minValue] Flag minValue + * @property {google.protobuf.IInt64Value|null} [maxValue] Flag maxValue + * @property {google.protobuf.IBoolValue|null} [requiresRestart] Flag requiresRestart + * @property {string|null} [kind] Flag kind + * @property {google.protobuf.IBoolValue|null} [inBeta] Flag inBeta + * @property {Array.|null} [allowedIntValues] Flag allowedIntValues + * @property {google.cloud.sql.v1beta4.SqlFlagScope|null} [flagScope] Flag flagScope + * @property {string|null} [recommendedStringValue] Flag recommendedStringValue + * @property {google.protobuf.IInt64Value|null} [recommendedIntValue] Flag recommendedIntValue + */ + + /** + * Constructs a new Flag. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a Flag. + * @implements IFlag + * @constructor + * @param {google.cloud.sql.v1beta4.IFlag=} [properties] Properties to set + */ + function Flag(properties) { + this.appliesTo = []; + this.allowedStringValues = []; + this.allowedIntValues = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Flag name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.name = ""; + + /** + * Flag type. + * @member {google.cloud.sql.v1beta4.SqlFlagType} type + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.type = 0; + + /** + * Flag appliesTo. + * @member {Array.} appliesTo + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.appliesTo = $util.emptyArray; + + /** + * Flag allowedStringValues. + * @member {Array.} allowedStringValues + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.allowedStringValues = $util.emptyArray; + + /** + * Flag minValue. + * @member {google.protobuf.IInt64Value|null|undefined} minValue + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.minValue = null; + + /** + * Flag maxValue. + * @member {google.protobuf.IInt64Value|null|undefined} maxValue + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.maxValue = null; + + /** + * Flag requiresRestart. + * @member {google.protobuf.IBoolValue|null|undefined} requiresRestart + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.requiresRestart = null; + + /** + * Flag kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.kind = ""; + + /** + * Flag inBeta. + * @member {google.protobuf.IBoolValue|null|undefined} inBeta + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.inBeta = null; + + /** + * Flag allowedIntValues. + * @member {Array.} allowedIntValues + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.allowedIntValues = $util.emptyArray; + + /** + * Flag flagScope. + * @member {google.cloud.sql.v1beta4.SqlFlagScope} flagScope + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.flagScope = 0; + + /** + * Flag recommendedStringValue. + * @member {string|null|undefined} recommendedStringValue + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.recommendedStringValue = null; + + /** + * Flag recommendedIntValue. + * @member {google.protobuf.IInt64Value|null|undefined} recommendedIntValue + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Flag.prototype.recommendedIntValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Flag recommendedValue. + * @member {"recommendedStringValue"|"recommendedIntValue"|undefined} recommendedValue + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + */ + Object.defineProperty(Flag.prototype, "recommendedValue", { + get: $util.oneOfGetter($oneOfFields = ["recommendedStringValue", "recommendedIntValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Flag instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.Flag + * @static + * @param {google.cloud.sql.v1beta4.IFlag=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.Flag} Flag instance + */ + Flag.create = function create(properties) { + return new Flag(properties); + }; + + /** + * Encodes the specified Flag message. Does not implicitly {@link google.cloud.sql.v1beta4.Flag.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.Flag + * @static + * @param {google.cloud.sql.v1beta4.IFlag} message Flag message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Flag.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.appliesTo != null && message.appliesTo.length) { + writer.uint32(/* id 3, wireType 2 =*/26).fork(); + for (var i = 0; i < message.appliesTo.length; ++i) + writer.int32(message.appliesTo[i]); + writer.ldelim(); + } + if (message.allowedStringValues != null && message.allowedStringValues.length) + for (var i = 0; i < message.allowedStringValues.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.allowedStringValues[i]); + if (message.minValue != null && Object.hasOwnProperty.call(message, "minValue")) + $root.google.protobuf.Int64Value.encode(message.minValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.maxValue != null && Object.hasOwnProperty.call(message, "maxValue")) + $root.google.protobuf.Int64Value.encode(message.maxValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.requiresRestart != null && Object.hasOwnProperty.call(message, "requiresRestart")) + $root.google.protobuf.BoolValue.encode(message.requiresRestart, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.kind); + if (message.inBeta != null && Object.hasOwnProperty.call(message, "inBeta")) + $root.google.protobuf.BoolValue.encode(message.inBeta, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.allowedIntValues != null && message.allowedIntValues.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.allowedIntValues.length; ++i) + writer.int64(message.allowedIntValues[i]); + writer.ldelim(); + } + if (message.flagScope != null && Object.hasOwnProperty.call(message, "flagScope")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.flagScope); + if (message.recommendedStringValue != null && Object.hasOwnProperty.call(message, "recommendedStringValue")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.recommendedStringValue); + if (message.recommendedIntValue != null && Object.hasOwnProperty.call(message, "recommendedIntValue")) + $root.google.protobuf.Int64Value.encode(message.recommendedIntValue, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Flag message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Flag.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.Flag + * @static + * @param {google.cloud.sql.v1beta4.IFlag} message Flag message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Flag.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Flag message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.Flag + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.Flag} Flag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Flag.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Flag(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + if (!(message.appliesTo && message.appliesTo.length)) + message.appliesTo = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.appliesTo.push(reader.int32()); + } else + message.appliesTo.push(reader.int32()); + break; + } + case 4: { + if (!(message.allowedStringValues && message.allowedStringValues.length)) + message.allowedStringValues = []; + message.allowedStringValues.push(reader.string()); + break; + } + case 5: { + message.minValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 6: { + message.maxValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 7: { + message.requiresRestart = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 8: { + message.kind = reader.string(); + break; + } + case 9: { + message.inBeta = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 10: { + if (!(message.allowedIntValues && message.allowedIntValues.length)) + message.allowedIntValues = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.allowedIntValues.push(reader.int64()); + } else + message.allowedIntValues.push(reader.int64()); + break; + } + case 15: { + message.flagScope = reader.int32(); + break; + } + case 16: { + message.recommendedStringValue = reader.string(); + break; + } + case 17: { + message.recommendedIntValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Flag message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.Flag + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.Flag} Flag + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Flag.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Flag message. + * @function verify + * @memberof google.cloud.sql.v1beta4.Flag + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Flag.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.appliesTo != null && message.hasOwnProperty("appliesTo")) { + if (!Array.isArray(message.appliesTo)) + return "appliesTo: array expected"; + for (var i = 0; i < message.appliesTo.length; ++i) + switch (message.appliesTo[i]) { + default: + return "appliesTo: enum value[] expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + break; + } + } + if (message.allowedStringValues != null && message.hasOwnProperty("allowedStringValues")) { + if (!Array.isArray(message.allowedStringValues)) + return "allowedStringValues: array expected"; + for (var i = 0; i < message.allowedStringValues.length; ++i) + if (!$util.isString(message.allowedStringValues[i])) + return "allowedStringValues: string[] expected"; + } + if (message.minValue != null && message.hasOwnProperty("minValue")) { + var error = $root.google.protobuf.Int64Value.verify(message.minValue); + if (error) + return "minValue." + error; + } + if (message.maxValue != null && message.hasOwnProperty("maxValue")) { + var error = $root.google.protobuf.Int64Value.verify(message.maxValue); + if (error) + return "maxValue." + error; + } + if (message.requiresRestart != null && message.hasOwnProperty("requiresRestart")) { + var error = $root.google.protobuf.BoolValue.verify(message.requiresRestart); + if (error) + return "requiresRestart." + error; + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.inBeta != null && message.hasOwnProperty("inBeta")) { + var error = $root.google.protobuf.BoolValue.verify(message.inBeta); + if (error) + return "inBeta." + error; + } + if (message.allowedIntValues != null && message.hasOwnProperty("allowedIntValues")) { + if (!Array.isArray(message.allowedIntValues)) + return "allowedIntValues: array expected"; + for (var i = 0; i < message.allowedIntValues.length; ++i) + if (!$util.isInteger(message.allowedIntValues[i]) && !(message.allowedIntValues[i] && $util.isInteger(message.allowedIntValues[i].low) && $util.isInteger(message.allowedIntValues[i].high))) + return "allowedIntValues: integer|Long[] expected"; + } + if (message.flagScope != null && message.hasOwnProperty("flagScope")) + switch (message.flagScope) { + default: + return "flagScope: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.recommendedStringValue != null && message.hasOwnProperty("recommendedStringValue")) { + properties.recommendedValue = 1; + if (!$util.isString(message.recommendedStringValue)) + return "recommendedStringValue: string expected"; + } + if (message.recommendedIntValue != null && message.hasOwnProperty("recommendedIntValue")) { + if (properties.recommendedValue === 1) + return "recommendedValue: multiple values"; + properties.recommendedValue = 1; + { + var error = $root.google.protobuf.Int64Value.verify(message.recommendedIntValue); + if (error) + return "recommendedIntValue." + error; + } + } + return null; + }; + + /** + * Creates a Flag message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.Flag + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.Flag} Flag + */ + Flag.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.Flag) + return object; + var message = new $root.google.cloud.sql.v1beta4.Flag(); + if (object.name != null) + message.name = String(object.name); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SQL_FLAG_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "BOOLEAN": + case 1: + message.type = 1; + break; + case "STRING": + case 2: + message.type = 2; + break; + case "INTEGER": + case 3: + message.type = 3; + break; + case "NONE": + case 4: + message.type = 4; + break; + case "MYSQL_TIMEZONE_OFFSET": + case 5: + message.type = 5; + break; + case "FLOAT": + case 6: + message.type = 6; + break; + case "REPEATED_STRING": + case 7: + message.type = 7; + break; + } + if (object.appliesTo) { + if (!Array.isArray(object.appliesTo)) + throw TypeError(".google.cloud.sql.v1beta4.Flag.appliesTo: array expected"); + message.appliesTo = []; + for (var i = 0; i < object.appliesTo.length; ++i) + switch (object.appliesTo[i]) { + default: + if (typeof object.appliesTo[i] === "number") { + message.appliesTo[i] = object.appliesTo[i]; + break; + } + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.appliesTo[i] = 0; + break; + case "MYSQL_5_1": + case 2: + message.appliesTo[i] = 2; + break; + case "MYSQL_5_5": + case 3: + message.appliesTo[i] = 3; + break; + case "MYSQL_5_6": + case 5: + message.appliesTo[i] = 5; + break; + case "MYSQL_5_7": + case 6: + message.appliesTo[i] = 6; + break; + case "MYSQL_8_0": + case 20: + message.appliesTo[i] = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.appliesTo[i] = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.appliesTo[i] = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.appliesTo[i] = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.appliesTo[i] = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.appliesTo[i] = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.appliesTo[i] = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.appliesTo[i] = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.appliesTo[i] = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.appliesTo[i] = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.appliesTo[i] = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.appliesTo[i] = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.appliesTo[i] = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.appliesTo[i] = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.appliesTo[i] = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.appliesTo[i] = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.appliesTo[i] = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.appliesTo[i] = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.appliesTo[i] = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.appliesTo[i] = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.appliesTo[i] = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.appliesTo[i] = 556; + break; + case "MYSQL_8_4": + case 398: + message.appliesTo[i] = 398; + break; + case "MYSQL_9_7": + case 654: + message.appliesTo[i] = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.appliesTo[i] = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.appliesTo[i] = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.appliesTo[i] = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.appliesTo[i] = 16; + break; + case "POSTGRES_9_6": + case 9: + message.appliesTo[i] = 9; + break; + case "POSTGRES_10": + case 18: + message.appliesTo[i] = 18; + break; + case "POSTGRES_11": + case 10: + message.appliesTo[i] = 10; + break; + case "POSTGRES_12": + case 19: + message.appliesTo[i] = 19; + break; + case "POSTGRES_13": + case 23: + message.appliesTo[i] = 23; + break; + case "POSTGRES_14": + case 110: + message.appliesTo[i] = 110; + break; + case "POSTGRES_15": + case 172: + message.appliesTo[i] = 172; + break; + case "POSTGRES_16": + case 272: + message.appliesTo[i] = 272; + break; + case "POSTGRES_17": + case 408: + message.appliesTo[i] = 408; + break; + case "POSTGRES_18": + case 557: + message.appliesTo[i] = 557; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.appliesTo[i] = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.appliesTo[i] = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.appliesTo[i] = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.appliesTo[i] = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.appliesTo[i] = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.appliesTo[i] = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.appliesTo[i] = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.appliesTo[i] = 202; + break; + } + } + if (object.allowedStringValues) { + if (!Array.isArray(object.allowedStringValues)) + throw TypeError(".google.cloud.sql.v1beta4.Flag.allowedStringValues: array expected"); + message.allowedStringValues = []; + for (var i = 0; i < object.allowedStringValues.length; ++i) + message.allowedStringValues[i] = String(object.allowedStringValues[i]); + } + if (object.minValue != null) { + if (typeof object.minValue !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Flag.minValue: object expected"); + message.minValue = $root.google.protobuf.Int64Value.fromObject(object.minValue); + } + if (object.maxValue != null) { + if (typeof object.maxValue !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Flag.maxValue: object expected"); + message.maxValue = $root.google.protobuf.Int64Value.fromObject(object.maxValue); + } + if (object.requiresRestart != null) { + if (typeof object.requiresRestart !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Flag.requiresRestart: object expected"); + message.requiresRestart = $root.google.protobuf.BoolValue.fromObject(object.requiresRestart); + } + if (object.kind != null) + message.kind = String(object.kind); + if (object.inBeta != null) { + if (typeof object.inBeta !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Flag.inBeta: object expected"); + message.inBeta = $root.google.protobuf.BoolValue.fromObject(object.inBeta); + } + if (object.allowedIntValues) { + if (!Array.isArray(object.allowedIntValues)) + throw TypeError(".google.cloud.sql.v1beta4.Flag.allowedIntValues: array expected"); + message.allowedIntValues = []; + for (var i = 0; i < object.allowedIntValues.length; ++i) + if ($util.Long) + (message.allowedIntValues[i] = $util.Long.fromValue(object.allowedIntValues[i])).unsigned = false; + else if (typeof object.allowedIntValues[i] === "string") + message.allowedIntValues[i] = parseInt(object.allowedIntValues[i], 10); + else if (typeof object.allowedIntValues[i] === "number") + message.allowedIntValues[i] = object.allowedIntValues[i]; + else if (typeof object.allowedIntValues[i] === "object") + message.allowedIntValues[i] = new $util.LongBits(object.allowedIntValues[i].low >>> 0, object.allowedIntValues[i].high >>> 0).toNumber(); + } + switch (object.flagScope) { + default: + if (typeof object.flagScope === "number") { + message.flagScope = object.flagScope; + break; + } + break; + case "SQL_FLAG_SCOPE_UNSPECIFIED": + case 0: + message.flagScope = 0; + break; + case "SQL_FLAG_SCOPE_DATABASE": + case 1: + message.flagScope = 1; + break; + case "SQL_FLAG_SCOPE_CONNECTION_POOL": + case 2: + message.flagScope = 2; + break; + } + if (object.recommendedStringValue != null) + message.recommendedStringValue = String(object.recommendedStringValue); + if (object.recommendedIntValue != null) { + if (typeof object.recommendedIntValue !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Flag.recommendedIntValue: object expected"); + message.recommendedIntValue = $root.google.protobuf.Int64Value.fromObject(object.recommendedIntValue); + } + return message; + }; + + /** + * Creates a plain object from a Flag message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.Flag + * @static + * @param {google.cloud.sql.v1beta4.Flag} message Flag + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Flag.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.appliesTo = []; + object.allowedStringValues = []; + object.allowedIntValues = []; + } + if (options.defaults) { + object.name = ""; + object.type = options.enums === String ? "SQL_FLAG_TYPE_UNSPECIFIED" : 0; + object.minValue = null; + object.maxValue = null; + object.requiresRestart = null; + object.kind = ""; + object.inBeta = null; + object.flagScope = options.enums === String ? "SQL_FLAG_SCOPE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlFlagType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.SqlFlagType[message.type] : message.type; + if (message.appliesTo && message.appliesTo.length) { + object.appliesTo = []; + for (var j = 0; j < message.appliesTo.length; ++j) + object.appliesTo[j] = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.appliesTo[j]] === undefined ? message.appliesTo[j] : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.appliesTo[j]] : message.appliesTo[j]; + } + if (message.allowedStringValues && message.allowedStringValues.length) { + object.allowedStringValues = []; + for (var j = 0; j < message.allowedStringValues.length; ++j) + object.allowedStringValues[j] = message.allowedStringValues[j]; + } + if (message.minValue != null && message.hasOwnProperty("minValue")) + object.minValue = $root.google.protobuf.Int64Value.toObject(message.minValue, options); + if (message.maxValue != null && message.hasOwnProperty("maxValue")) + object.maxValue = $root.google.protobuf.Int64Value.toObject(message.maxValue, options); + if (message.requiresRestart != null && message.hasOwnProperty("requiresRestart")) + object.requiresRestart = $root.google.protobuf.BoolValue.toObject(message.requiresRestart, options); + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.inBeta != null && message.hasOwnProperty("inBeta")) + object.inBeta = $root.google.protobuf.BoolValue.toObject(message.inBeta, options); + if (message.allowedIntValues && message.allowedIntValues.length) { + object.allowedIntValues = []; + for (var j = 0; j < message.allowedIntValues.length; ++j) + if (typeof message.allowedIntValues[j] === "number") + object.allowedIntValues[j] = options.longs === String ? String(message.allowedIntValues[j]) : message.allowedIntValues[j]; + else + object.allowedIntValues[j] = options.longs === String ? $util.Long.prototype.toString.call(message.allowedIntValues[j]) : options.longs === Number ? new $util.LongBits(message.allowedIntValues[j].low >>> 0, message.allowedIntValues[j].high >>> 0).toNumber() : message.allowedIntValues[j]; + } + if (message.flagScope != null && message.hasOwnProperty("flagScope")) + object.flagScope = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlFlagScope[message.flagScope] === undefined ? message.flagScope : $root.google.cloud.sql.v1beta4.SqlFlagScope[message.flagScope] : message.flagScope; + if (message.recommendedStringValue != null && message.hasOwnProperty("recommendedStringValue")) { + object.recommendedStringValue = message.recommendedStringValue; + if (options.oneofs) + object.recommendedValue = "recommendedStringValue"; + } + if (message.recommendedIntValue != null && message.hasOwnProperty("recommendedIntValue")) { + object.recommendedIntValue = $root.google.protobuf.Int64Value.toObject(message.recommendedIntValue, options); + if (options.oneofs) + object.recommendedValue = "recommendedIntValue"; + } + return object; + }; + + /** + * Converts this Flag to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.Flag + * @instance + * @returns {Object.} JSON object + */ + Flag.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Flag + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.Flag + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Flag.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.Flag"; + }; + + return Flag; + })(); + + v1beta4.FlagsListResponse = (function() { + + /** + * Properties of a FlagsListResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IFlagsListResponse + * @property {string|null} [kind] FlagsListResponse kind + * @property {Array.|null} [items] FlagsListResponse items + */ + + /** + * Constructs a new FlagsListResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a FlagsListResponse. + * @implements IFlagsListResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IFlagsListResponse=} [properties] Properties to set + */ + function FlagsListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FlagsListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @instance + */ + FlagsListResponse.prototype.kind = ""; + + /** + * FlagsListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @instance + */ + FlagsListResponse.prototype.items = $util.emptyArray; + + /** + * Creates a new FlagsListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @static + * @param {google.cloud.sql.v1beta4.IFlagsListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.FlagsListResponse} FlagsListResponse instance + */ + FlagsListResponse.create = function create(properties) { + return new FlagsListResponse(properties); + }; + + /** + * Encodes the specified FlagsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.FlagsListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @static + * @param {google.cloud.sql.v1beta4.IFlagsListResponse} message FlagsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FlagsListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1beta4.Flag.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FlagsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FlagsListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @static + * @param {google.cloud.sql.v1beta4.IFlagsListResponse} message FlagsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FlagsListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FlagsListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.FlagsListResponse} FlagsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FlagsListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.FlagsListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1beta4.Flag.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FlagsListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.FlagsListResponse} FlagsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FlagsListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FlagsListResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FlagsListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.Flag.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a FlagsListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.FlagsListResponse} FlagsListResponse + */ + FlagsListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.FlagsListResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.FlagsListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1beta4.FlagsListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.FlagsListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1beta4.Flag.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FlagsListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @static + * @param {google.cloud.sql.v1beta4.FlagsListResponse} message FlagsListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FlagsListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1beta4.Flag.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this FlagsListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @instance + * @returns {Object.} JSON object + */ + FlagsListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FlagsListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.FlagsListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FlagsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.FlagsListResponse"; + }; + + return FlagsListResponse; + })(); + + v1beta4.ImportContext = (function() { + + /** + * Properties of an ImportContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IImportContext + * @property {string|null} [uri] ImportContext uri + * @property {string|null} [database] ImportContext database + * @property {string|null} [kind] ImportContext kind + * @property {google.cloud.sql.v1beta4.SqlFileType|null} [fileType] ImportContext fileType + * @property {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions|null} [csvImportOptions] ImportContext csvImportOptions + * @property {string|null} [importUser] ImportContext importUser + * @property {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions|null} [bakImportOptions] ImportContext bakImportOptions + * @property {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions|null} [sqlImportOptions] ImportContext sqlImportOptions + * @property {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions|null} [tdeImportOptions] ImportContext tdeImportOptions + */ + + /** + * Constructs a new ImportContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an ImportContext. + * @implements IImportContext + * @constructor + * @param {google.cloud.sql.v1beta4.IImportContext=} [properties] Properties to set + */ + function ImportContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ImportContext uri. + * @member {string} uri + * @memberof google.cloud.sql.v1beta4.ImportContext + * @instance + */ + ImportContext.prototype.uri = ""; + + /** + * ImportContext database. + * @member {string} database + * @memberof google.cloud.sql.v1beta4.ImportContext + * @instance + */ + ImportContext.prototype.database = ""; + + /** + * ImportContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.ImportContext + * @instance + */ + ImportContext.prototype.kind = ""; + + /** + * ImportContext fileType. + * @member {google.cloud.sql.v1beta4.SqlFileType} fileType + * @memberof google.cloud.sql.v1beta4.ImportContext + * @instance + */ + ImportContext.prototype.fileType = 0; + + /** + * ImportContext csvImportOptions. + * @member {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions|null|undefined} csvImportOptions + * @memberof google.cloud.sql.v1beta4.ImportContext + * @instance + */ + ImportContext.prototype.csvImportOptions = null; + + /** + * ImportContext importUser. + * @member {string} importUser + * @memberof google.cloud.sql.v1beta4.ImportContext + * @instance + */ + ImportContext.prototype.importUser = ""; + + /** + * ImportContext bakImportOptions. + * @member {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions|null|undefined} bakImportOptions + * @memberof google.cloud.sql.v1beta4.ImportContext + * @instance + */ + ImportContext.prototype.bakImportOptions = null; + + /** + * ImportContext sqlImportOptions. + * @member {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions|null|undefined} sqlImportOptions + * @memberof google.cloud.sql.v1beta4.ImportContext + * @instance + */ + ImportContext.prototype.sqlImportOptions = null; + + /** + * ImportContext tdeImportOptions. + * @member {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions|null|undefined} tdeImportOptions + * @memberof google.cloud.sql.v1beta4.ImportContext + * @instance + */ + ImportContext.prototype.tdeImportOptions = null; + + /** + * Creates a new ImportContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ImportContext + * @static + * @param {google.cloud.sql.v1beta4.IImportContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ImportContext} ImportContext instance + */ + ImportContext.create = function create(properties) { + return new ImportContext(properties); + }; + + /** + * Encodes the specified ImportContext message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ImportContext + * @static + * @param {google.cloud.sql.v1beta4.IImportContext} message ImportContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.database); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + if (message.fileType != null && Object.hasOwnProperty.call(message, "fileType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.fileType); + if (message.csvImportOptions != null && Object.hasOwnProperty.call(message, "csvImportOptions")) + $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.encode(message.csvImportOptions, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.importUser != null && Object.hasOwnProperty.call(message, "importUser")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.importUser); + if (message.bakImportOptions != null && Object.hasOwnProperty.call(message, "bakImportOptions")) + $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.encode(message.bakImportOptions, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.sqlImportOptions != null && Object.hasOwnProperty.call(message, "sqlImportOptions")) + $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.encode(message.sqlImportOptions, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.tdeImportOptions != null && Object.hasOwnProperty.call(message, "tdeImportOptions")) + $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.encode(message.tdeImportOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ImportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext + * @static + * @param {google.cloud.sql.v1beta4.IImportContext} message ImportContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ImportContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ImportContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ImportContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ImportContext} ImportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.uri = reader.string(); + break; + } + case 2: { + message.database = reader.string(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + case 4: { + message.fileType = reader.int32(); + break; + } + case 5: { + message.csvImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.decode(reader, reader.uint32()); + break; + } + case 6: { + message.importUser = reader.string(); + break; + } + case 7: { + message.bakImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.decode(reader, reader.uint32()); + break; + } + case 8: { + message.sqlImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.tdeImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ImportContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ImportContext} ImportContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ImportContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ImportContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ImportContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ImportContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uri != null && message.hasOwnProperty("uri")) + if (!$util.isString(message.uri)) + return "uri: string expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.fileType != null && message.hasOwnProperty("fileType")) + switch (message.fileType) { + default: + return "fileType: enum value expected"; + case 0: + case 1: + case 2: + case 4: + case 8: + break; + } + if (message.csvImportOptions != null && message.hasOwnProperty("csvImportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.verify(message.csvImportOptions); + if (error) + return "csvImportOptions." + error; + } + if (message.importUser != null && message.hasOwnProperty("importUser")) + if (!$util.isString(message.importUser)) + return "importUser: string expected"; + if (message.bakImportOptions != null && message.hasOwnProperty("bakImportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.verify(message.bakImportOptions); + if (error) + return "bakImportOptions." + error; + } + if (message.sqlImportOptions != null && message.hasOwnProperty("sqlImportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.verify(message.sqlImportOptions); + if (error) + return "sqlImportOptions." + error; + } + if (message.tdeImportOptions != null && message.hasOwnProperty("tdeImportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.verify(message.tdeImportOptions); + if (error) + return "tdeImportOptions." + error; + } + return null; + }; + + /** + * Creates an ImportContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ImportContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ImportContext} ImportContext + */ + ImportContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.ImportContext(); + if (object.uri != null) + message.uri = String(object.uri); + if (object.database != null) + message.database = String(object.database); + if (object.kind != null) + message.kind = String(object.kind); + switch (object.fileType) { + default: + if (typeof object.fileType === "number") { + message.fileType = object.fileType; + break; + } + break; + case "SQL_FILE_TYPE_UNSPECIFIED": + case 0: + message.fileType = 0; + break; + case "SQL": + case 1: + message.fileType = 1; + break; + case "CSV": + case 2: + message.fileType = 2; + break; + case "BAK": + case 4: + message.fileType = 4; + break; + case "TDE": + case 8: + message.fileType = 8; + break; + } + if (object.csvImportOptions != null) { + if (typeof object.csvImportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.csvImportOptions: object expected"); + message.csvImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.fromObject(object.csvImportOptions); + } + if (object.importUser != null) + message.importUser = String(object.importUser); + if (object.bakImportOptions != null) { + if (typeof object.bakImportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.bakImportOptions: object expected"); + message.bakImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.fromObject(object.bakImportOptions); + } + if (object.sqlImportOptions != null) { + if (typeof object.sqlImportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.sqlImportOptions: object expected"); + message.sqlImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.fromObject(object.sqlImportOptions); + } + if (object.tdeImportOptions != null) { + if (typeof object.tdeImportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.tdeImportOptions: object expected"); + message.tdeImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.fromObject(object.tdeImportOptions); + } + return message; + }; + + /** + * Creates a plain object from an ImportContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ImportContext + * @static + * @param {google.cloud.sql.v1beta4.ImportContext} message ImportContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ImportContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uri = ""; + object.database = ""; + object.kind = ""; + object.fileType = options.enums === String ? "SQL_FILE_TYPE_UNSPECIFIED" : 0; + object.csvImportOptions = null; + object.importUser = ""; + object.bakImportOptions = null; + object.sqlImportOptions = null; + object.tdeImportOptions = null; + } + if (message.uri != null && message.hasOwnProperty("uri")) + object.uri = message.uri; + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.fileType != null && message.hasOwnProperty("fileType")) + object.fileType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlFileType[message.fileType] === undefined ? message.fileType : $root.google.cloud.sql.v1beta4.SqlFileType[message.fileType] : message.fileType; + if (message.csvImportOptions != null && message.hasOwnProperty("csvImportOptions")) + object.csvImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.toObject(message.csvImportOptions, options); + if (message.importUser != null && message.hasOwnProperty("importUser")) + object.importUser = message.importUser; + if (message.bakImportOptions != null && message.hasOwnProperty("bakImportOptions")) + object.bakImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.toObject(message.bakImportOptions, options); + if (message.sqlImportOptions != null && message.hasOwnProperty("sqlImportOptions")) + object.sqlImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.toObject(message.sqlImportOptions, options); + if (message.tdeImportOptions != null && message.hasOwnProperty("tdeImportOptions")) + object.tdeImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.toObject(message.tdeImportOptions, options); + return object; + }; + + /** + * Converts this ImportContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ImportContext + * @instance + * @returns {Object.} JSON object + */ + ImportContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ImportContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ImportContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ImportContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext"; + }; + + ImportContext.SqlImportOptions = (function() { + + /** + * Properties of a SqlImportOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext + * @interface ISqlImportOptions + * @property {google.protobuf.IInt32Value|null} [threads] SqlImportOptions threads + * @property {google.protobuf.IBoolValue|null} [parallel] SqlImportOptions parallel + * @property {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions|null} [postgresImportOptions] SqlImportOptions postgresImportOptions + */ + + /** + * Constructs a new SqlImportOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext + * @classdesc Represents a SqlImportOptions. + * @implements ISqlImportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions=} [properties] Properties to set + */ + function SqlImportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlImportOptions threads. + * @member {google.protobuf.IInt32Value|null|undefined} threads + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @instance + */ + SqlImportOptions.prototype.threads = null; + + /** + * SqlImportOptions parallel. + * @member {google.protobuf.IBoolValue|null|undefined} parallel + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @instance + */ + SqlImportOptions.prototype.parallel = null; + + /** + * SqlImportOptions postgresImportOptions. + * @member {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions|null|undefined} postgresImportOptions + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @instance + */ + SqlImportOptions.prototype.postgresImportOptions = null; + + /** + * Creates a new SqlImportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions} SqlImportOptions instance + */ + SqlImportOptions.create = function create(properties) { + return new SqlImportOptions(properties); + }; + + /** + * Encodes the specified SqlImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions} message SqlImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlImportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.threads != null && Object.hasOwnProperty.call(message, "threads")) + $root.google.protobuf.Int32Value.encode(message.threads, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.parallel != null && Object.hasOwnProperty.call(message, "parallel")) + $root.google.protobuf.BoolValue.encode(message.parallel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.postgresImportOptions != null && Object.hasOwnProperty.call(message, "postgresImportOptions")) + $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.encode(message.postgresImportOptions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions} message SqlImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlImportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlImportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions} SqlImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlImportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.threads = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 2: { + message.parallel = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 3: { + message.postgresImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlImportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions} SqlImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlImportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlImportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlImportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.threads != null && message.hasOwnProperty("threads")) { + var error = $root.google.protobuf.Int32Value.verify(message.threads); + if (error) + return "threads." + error; + } + if (message.parallel != null && message.hasOwnProperty("parallel")) { + var error = $root.google.protobuf.BoolValue.verify(message.parallel); + if (error) + return "parallel." + error; + } + if (message.postgresImportOptions != null && message.hasOwnProperty("postgresImportOptions")) { + var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.verify(message.postgresImportOptions); + if (error) + return "postgresImportOptions." + error; + } + return null; + }; + + /** + * Creates a SqlImportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions} SqlImportOptions + */ + SqlImportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions(); + if (object.threads != null) { + if (typeof object.threads !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.threads: object expected"); + message.threads = $root.google.protobuf.Int32Value.fromObject(object.threads); + } + if (object.parallel != null) { + if (typeof object.parallel !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.parallel: object expected"); + message.parallel = $root.google.protobuf.BoolValue.fromObject(object.parallel); + } + if (object.postgresImportOptions != null) { + if (typeof object.postgresImportOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.postgresImportOptions: object expected"); + message.postgresImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.fromObject(object.postgresImportOptions); + } + return message; + }; + + /** + * Creates a plain object from a SqlImportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions} message SqlImportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlImportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.threads = null; + object.parallel = null; + object.postgresImportOptions = null; + } + if (message.threads != null && message.hasOwnProperty("threads")) + object.threads = $root.google.protobuf.Int32Value.toObject(message.threads, options); + if (message.parallel != null && message.hasOwnProperty("parallel")) + object.parallel = $root.google.protobuf.BoolValue.toObject(message.parallel, options); + if (message.postgresImportOptions != null && message.hasOwnProperty("postgresImportOptions")) + object.postgresImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.toObject(message.postgresImportOptions, options); + return object; + }; + + /** + * Converts this SqlImportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlImportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlImportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlImportOptions"; + }; + + SqlImportOptions.PostgresImportOptions = (function() { + + /** + * Properties of a PostgresImportOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @interface IPostgresImportOptions + * @property {google.protobuf.IBoolValue|null} [clean] PostgresImportOptions clean + * @property {google.protobuf.IBoolValue|null} [ifExists] PostgresImportOptions ifExists + */ + + /** + * Constructs a new PostgresImportOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions + * @classdesc Represents a PostgresImportOptions. + * @implements IPostgresImportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions=} [properties] Properties to set + */ + function PostgresImportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PostgresImportOptions clean. + * @member {google.protobuf.IBoolValue|null|undefined} clean + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @instance + */ + PostgresImportOptions.prototype.clean = null; + + /** + * PostgresImportOptions ifExists. + * @member {google.protobuf.IBoolValue|null|undefined} ifExists + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @instance + */ + PostgresImportOptions.prototype.ifExists = null; + + /** + * Creates a new PostgresImportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions instance + */ + PostgresImportOptions.create = function create(properties) { + return new PostgresImportOptions(properties); + }; + + /** + * Encodes the specified PostgresImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions} message PostgresImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PostgresImportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.clean != null && Object.hasOwnProperty.call(message, "clean")) + $root.google.protobuf.BoolValue.encode(message.clean, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.ifExists != null && Object.hasOwnProperty.call(message, "ifExists")) + $root.google.protobuf.BoolValue.encode(message.ifExists, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PostgresImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions} message PostgresImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PostgresImportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PostgresImportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PostgresImportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.clean = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 2: { + message.ifExists = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PostgresImportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PostgresImportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PostgresImportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PostgresImportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.clean != null && message.hasOwnProperty("clean")) { + var error = $root.google.protobuf.BoolValue.verify(message.clean); + if (error) + return "clean." + error; + } + if (message.ifExists != null && message.hasOwnProperty("ifExists")) { + var error = $root.google.protobuf.BoolValue.verify(message.ifExists); + if (error) + return "ifExists." + error; + } + return null; + }; + + /** + * Creates a PostgresImportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions + */ + PostgresImportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions(); + if (object.clean != null) { + if (typeof object.clean !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.clean: object expected"); + message.clean = $root.google.protobuf.BoolValue.fromObject(object.clean); + } + if (object.ifExists != null) { + if (typeof object.ifExists !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.ifExists: object expected"); + message.ifExists = $root.google.protobuf.BoolValue.fromObject(object.ifExists); + } + return message; + }; + + /** + * Creates a plain object from a PostgresImportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions} message PostgresImportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PostgresImportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.clean = null; + object.ifExists = null; + } + if (message.clean != null && message.hasOwnProperty("clean")) + object.clean = $root.google.protobuf.BoolValue.toObject(message.clean, options); + if (message.ifExists != null && message.hasOwnProperty("ifExists")) + object.ifExists = $root.google.protobuf.BoolValue.toObject(message.ifExists, options); + return object; + }; + + /** + * Converts this PostgresImportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @instance + * @returns {Object.} JSON object + */ + PostgresImportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PostgresImportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PostgresImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions"; + }; + + return PostgresImportOptions; + })(); + + return SqlImportOptions; + })(); + + ImportContext.SqlCsvImportOptions = (function() { + + /** + * Properties of a SqlCsvImportOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext + * @interface ISqlCsvImportOptions + * @property {string|null} [table] SqlCsvImportOptions table + * @property {Array.|null} [columns] SqlCsvImportOptions columns + * @property {string|null} [escapeCharacter] SqlCsvImportOptions escapeCharacter + * @property {string|null} [quoteCharacter] SqlCsvImportOptions quoteCharacter + * @property {string|null} [fieldsTerminatedBy] SqlCsvImportOptions fieldsTerminatedBy + * @property {string|null} [linesTerminatedBy] SqlCsvImportOptions linesTerminatedBy + */ + + /** + * Constructs a new SqlCsvImportOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext + * @classdesc Represents a SqlCsvImportOptions. + * @implements ISqlCsvImportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions=} [properties] Properties to set + */ + function SqlCsvImportOptions(properties) { + this.columns = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlCsvImportOptions table. + * @member {string} table + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.table = ""; + + /** + * SqlCsvImportOptions columns. + * @member {Array.} columns + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.columns = $util.emptyArray; + + /** + * SqlCsvImportOptions escapeCharacter. + * @member {string} escapeCharacter + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.escapeCharacter = ""; + + /** + * SqlCsvImportOptions quoteCharacter. + * @member {string} quoteCharacter + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.quoteCharacter = ""; + + /** + * SqlCsvImportOptions fieldsTerminatedBy. + * @member {string} fieldsTerminatedBy + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.fieldsTerminatedBy = ""; + + /** + * SqlCsvImportOptions linesTerminatedBy. + * @member {string} linesTerminatedBy + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @instance + */ + SqlCsvImportOptions.prototype.linesTerminatedBy = ""; + + /** + * Creates a new SqlCsvImportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions instance + */ + SqlCsvImportOptions.create = function create(properties) { + return new SqlCsvImportOptions(properties); + }; + + /** + * Encodes the specified SqlCsvImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions} message SqlCsvImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlCsvImportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.table != null && Object.hasOwnProperty.call(message, "table")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.table); + if (message.columns != null && message.columns.length) + for (var i = 0; i < message.columns.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.columns[i]); + if (message.escapeCharacter != null && Object.hasOwnProperty.call(message, "escapeCharacter")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.escapeCharacter); + if (message.quoteCharacter != null && Object.hasOwnProperty.call(message, "quoteCharacter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.quoteCharacter); + if (message.fieldsTerminatedBy != null && Object.hasOwnProperty.call(message, "fieldsTerminatedBy")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.fieldsTerminatedBy); + if (message.linesTerminatedBy != null && Object.hasOwnProperty.call(message, "linesTerminatedBy")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.linesTerminatedBy); + return writer; + }; + + /** + * Encodes the specified SqlCsvImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions} message SqlCsvImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlCsvImportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlCsvImportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlCsvImportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.table = reader.string(); + break; + } + case 2: { + if (!(message.columns && message.columns.length)) + message.columns = []; + message.columns.push(reader.string()); + break; + } + case 4: { + message.escapeCharacter = reader.string(); + break; + } + case 5: { + message.quoteCharacter = reader.string(); + break; + } + case 6: { + message.fieldsTerminatedBy = reader.string(); + break; + } + case 8: { + message.linesTerminatedBy = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlCsvImportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlCsvImportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlCsvImportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlCsvImportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.table != null && message.hasOwnProperty("table")) + if (!$util.isString(message.table)) + return "table: string expected"; + if (message.columns != null && message.hasOwnProperty("columns")) { + if (!Array.isArray(message.columns)) + return "columns: array expected"; + for (var i = 0; i < message.columns.length; ++i) + if (!$util.isString(message.columns[i])) + return "columns: string[] expected"; + } + if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) + if (!$util.isString(message.escapeCharacter)) + return "escapeCharacter: string expected"; + if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) + if (!$util.isString(message.quoteCharacter)) + return "quoteCharacter: string expected"; + if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) + if (!$util.isString(message.fieldsTerminatedBy)) + return "fieldsTerminatedBy: string expected"; + if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) + if (!$util.isString(message.linesTerminatedBy)) + return "linesTerminatedBy: string expected"; + return null; + }; + + /** + * Creates a SqlCsvImportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions + */ + SqlCsvImportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions(); + if (object.table != null) + message.table = String(object.table); + if (object.columns) { + if (!Array.isArray(object.columns)) + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.columns: array expected"); + message.columns = []; + for (var i = 0; i < object.columns.length; ++i) + message.columns[i] = String(object.columns[i]); + } + if (object.escapeCharacter != null) + message.escapeCharacter = String(object.escapeCharacter); + if (object.quoteCharacter != null) + message.quoteCharacter = String(object.quoteCharacter); + if (object.fieldsTerminatedBy != null) + message.fieldsTerminatedBy = String(object.fieldsTerminatedBy); + if (object.linesTerminatedBy != null) + message.linesTerminatedBy = String(object.linesTerminatedBy); + return message; + }; + + /** + * Creates a plain object from a SqlCsvImportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions} message SqlCsvImportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlCsvImportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.columns = []; + if (options.defaults) { + object.table = ""; + object.escapeCharacter = ""; + object.quoteCharacter = ""; + object.fieldsTerminatedBy = ""; + object.linesTerminatedBy = ""; + } + if (message.table != null && message.hasOwnProperty("table")) + object.table = message.table; + if (message.columns && message.columns.length) { + object.columns = []; + for (var j = 0; j < message.columns.length; ++j) + object.columns[j] = message.columns[j]; + } + if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) + object.escapeCharacter = message.escapeCharacter; + if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) + object.quoteCharacter = message.quoteCharacter; + if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) + object.fieldsTerminatedBy = message.fieldsTerminatedBy; + if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) + object.linesTerminatedBy = message.linesTerminatedBy; + return object; + }; + + /** + * Converts this SqlCsvImportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlCsvImportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlCsvImportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlCsvImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions"; + }; + + return SqlCsvImportOptions; + })(); + + ImportContext.SqlBakImportOptions = (function() { + + /** + * Properties of a SqlBakImportOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext + * @interface ISqlBakImportOptions + * @property {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions|null} [encryptionOptions] SqlBakImportOptions encryptionOptions + * @property {google.protobuf.IBoolValue|null} [striped] SqlBakImportOptions striped + * @property {google.protobuf.IBoolValue|null} [noRecovery] SqlBakImportOptions noRecovery + * @property {google.protobuf.IBoolValue|null} [recoveryOnly] SqlBakImportOptions recoveryOnly + * @property {google.cloud.sql.v1beta4.BakType|null} [bakType] SqlBakImportOptions bakType + * @property {google.protobuf.ITimestamp|null} [stopAt] SqlBakImportOptions stopAt + * @property {string|null} [stopAtMark] SqlBakImportOptions stopAtMark + */ + + /** + * Constructs a new SqlBakImportOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext + * @classdesc Represents a SqlBakImportOptions. + * @implements ISqlBakImportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions=} [properties] Properties to set + */ + function SqlBakImportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlBakImportOptions encryptionOptions. + * @member {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions|null|undefined} encryptionOptions + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.encryptionOptions = null; + + /** + * SqlBakImportOptions striped. + * @member {google.protobuf.IBoolValue|null|undefined} striped + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.striped = null; + + /** + * SqlBakImportOptions noRecovery. + * @member {google.protobuf.IBoolValue|null|undefined} noRecovery + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.noRecovery = null; + + /** + * SqlBakImportOptions recoveryOnly. + * @member {google.protobuf.IBoolValue|null|undefined} recoveryOnly + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.recoveryOnly = null; + + /** + * SqlBakImportOptions bakType. + * @member {google.cloud.sql.v1beta4.BakType} bakType + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.bakType = 0; + + /** + * SqlBakImportOptions stopAt. + * @member {google.protobuf.ITimestamp|null|undefined} stopAt + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.stopAt = null; + + /** + * SqlBakImportOptions stopAtMark. + * @member {string} stopAtMark + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @instance + */ + SqlBakImportOptions.prototype.stopAtMark = ""; + + /** + * Creates a new SqlBakImportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions} SqlBakImportOptions instance + */ + SqlBakImportOptions.create = function create(properties) { + return new SqlBakImportOptions(properties); + }; + + /** + * Encodes the specified SqlBakImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions} message SqlBakImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBakImportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.encryptionOptions != null && Object.hasOwnProperty.call(message, "encryptionOptions")) + $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.encode(message.encryptionOptions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.striped != null && Object.hasOwnProperty.call(message, "striped")) + $root.google.protobuf.BoolValue.encode(message.striped, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.noRecovery != null && Object.hasOwnProperty.call(message, "noRecovery")) + $root.google.protobuf.BoolValue.encode(message.noRecovery, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.recoveryOnly != null && Object.hasOwnProperty.call(message, "recoveryOnly")) + $root.google.protobuf.BoolValue.encode(message.recoveryOnly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.bakType != null && Object.hasOwnProperty.call(message, "bakType")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.bakType); + if (message.stopAt != null && Object.hasOwnProperty.call(message, "stopAt")) + $root.google.protobuf.Timestamp.encode(message.stopAt, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.stopAtMark != null && Object.hasOwnProperty.call(message, "stopAtMark")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.stopAtMark); + return writer; + }; + + /** + * Encodes the specified SqlBakImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions} message SqlBakImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlBakImportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlBakImportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions} SqlBakImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBakImportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.encryptionOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.decode(reader, reader.uint32()); + break; + } + case 2: { + message.striped = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 4: { + message.noRecovery = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 5: { + message.recoveryOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 6: { + message.bakType = reader.int32(); + break; + } + case 7: { + message.stopAt = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.stopAtMark = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlBakImportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions} SqlBakImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlBakImportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlBakImportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlBakImportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.encryptionOptions != null && message.hasOwnProperty("encryptionOptions")) { + var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.verify(message.encryptionOptions); + if (error) + return "encryptionOptions." + error; + } + if (message.striped != null && message.hasOwnProperty("striped")) { + var error = $root.google.protobuf.BoolValue.verify(message.striped); + if (error) + return "striped." + error; + } + if (message.noRecovery != null && message.hasOwnProperty("noRecovery")) { + var error = $root.google.protobuf.BoolValue.verify(message.noRecovery); + if (error) + return "noRecovery." + error; + } + if (message.recoveryOnly != null && message.hasOwnProperty("recoveryOnly")) { + var error = $root.google.protobuf.BoolValue.verify(message.recoveryOnly); + if (error) + return "recoveryOnly." + error; + } + if (message.bakType != null && message.hasOwnProperty("bakType")) + switch (message.bakType) { + default: + return "bakType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.stopAt != null && message.hasOwnProperty("stopAt")) { + var error = $root.google.protobuf.Timestamp.verify(message.stopAt); + if (error) + return "stopAt." + error; + } + if (message.stopAtMark != null && message.hasOwnProperty("stopAtMark")) + if (!$util.isString(message.stopAtMark)) + return "stopAtMark: string expected"; + return null; + }; + + /** + * Creates a SqlBakImportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions} SqlBakImportOptions + */ + SqlBakImportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions(); + if (object.encryptionOptions != null) { + if (typeof object.encryptionOptions !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.encryptionOptions: object expected"); + message.encryptionOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.fromObject(object.encryptionOptions); + } + if (object.striped != null) { + if (typeof object.striped !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.striped: object expected"); + message.striped = $root.google.protobuf.BoolValue.fromObject(object.striped); + } + if (object.noRecovery != null) { + if (typeof object.noRecovery !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.noRecovery: object expected"); + message.noRecovery = $root.google.protobuf.BoolValue.fromObject(object.noRecovery); + } + if (object.recoveryOnly != null) { + if (typeof object.recoveryOnly !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.recoveryOnly: object expected"); + message.recoveryOnly = $root.google.protobuf.BoolValue.fromObject(object.recoveryOnly); + } + switch (object.bakType) { + default: + if (typeof object.bakType === "number") { + message.bakType = object.bakType; + break; + } + break; + case "BAK_TYPE_UNSPECIFIED": + case 0: + message.bakType = 0; + break; + case "FULL": + case 1: + message.bakType = 1; + break; + case "DIFF": + case 2: + message.bakType = 2; + break; + case "TLOG": + case 3: + message.bakType = 3; + break; + } + if (object.stopAt != null) { + if (typeof object.stopAt !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.stopAt: object expected"); + message.stopAt = $root.google.protobuf.Timestamp.fromObject(object.stopAt); + } + if (object.stopAtMark != null) + message.stopAtMark = String(object.stopAtMark); + return message; + }; + + /** + * Creates a plain object from a SqlBakImportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions} message SqlBakImportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlBakImportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.encryptionOptions = null; + object.striped = null; + object.noRecovery = null; + object.recoveryOnly = null; + object.bakType = options.enums === String ? "BAK_TYPE_UNSPECIFIED" : 0; + object.stopAt = null; + object.stopAtMark = ""; + } + if (message.encryptionOptions != null && message.hasOwnProperty("encryptionOptions")) + object.encryptionOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.toObject(message.encryptionOptions, options); + if (message.striped != null && message.hasOwnProperty("striped")) + object.striped = $root.google.protobuf.BoolValue.toObject(message.striped, options); + if (message.noRecovery != null && message.hasOwnProperty("noRecovery")) + object.noRecovery = $root.google.protobuf.BoolValue.toObject(message.noRecovery, options); + if (message.recoveryOnly != null && message.hasOwnProperty("recoveryOnly")) + object.recoveryOnly = $root.google.protobuf.BoolValue.toObject(message.recoveryOnly, options); + if (message.bakType != null && message.hasOwnProperty("bakType")) + object.bakType = options.enums === String ? $root.google.cloud.sql.v1beta4.BakType[message.bakType] === undefined ? message.bakType : $root.google.cloud.sql.v1beta4.BakType[message.bakType] : message.bakType; + if (message.stopAt != null && message.hasOwnProperty("stopAt")) + object.stopAt = $root.google.protobuf.Timestamp.toObject(message.stopAt, options); + if (message.stopAtMark != null && message.hasOwnProperty("stopAtMark")) + object.stopAtMark = message.stopAtMark; + return object; + }; + + /** + * Converts this SqlBakImportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlBakImportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlBakImportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlBakImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions"; + }; + + SqlBakImportOptions.EncryptionOptions = (function() { + + /** + * Properties of an EncryptionOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @interface IEncryptionOptions + * @property {string|null} [certPath] EncryptionOptions certPath + * @property {string|null} [pvkPath] EncryptionOptions pvkPath + * @property {string|null} [pvkPassword] EncryptionOptions pvkPassword + * @property {google.protobuf.IBoolValue|null} [keepEncrypted] EncryptionOptions keepEncrypted + */ + + /** + * Constructs a new EncryptionOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions + * @classdesc Represents an EncryptionOptions. + * @implements IEncryptionOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions=} [properties] Properties to set + */ + function EncryptionOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EncryptionOptions certPath. + * @member {string} certPath + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @instance + */ + EncryptionOptions.prototype.certPath = ""; + + /** + * EncryptionOptions pvkPath. + * @member {string} pvkPath + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @instance + */ + EncryptionOptions.prototype.pvkPath = ""; + + /** + * EncryptionOptions pvkPassword. + * @member {string} pvkPassword + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @instance + */ + EncryptionOptions.prototype.pvkPassword = ""; + + /** + * EncryptionOptions keepEncrypted. + * @member {google.protobuf.IBoolValue|null|undefined} keepEncrypted + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @instance + */ + EncryptionOptions.prototype.keepEncrypted = null; + + /** + * Creates a new EncryptionOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions instance + */ + EncryptionOptions.create = function create(properties) { + return new EncryptionOptions(properties); + }; + + /** + * Encodes the specified EncryptionOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions} message EncryptionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncryptionOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certPath != null && Object.hasOwnProperty.call(message, "certPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.certPath); + if (message.pvkPath != null && Object.hasOwnProperty.call(message, "pvkPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pvkPath); + if (message.pvkPassword != null && Object.hasOwnProperty.call(message, "pvkPassword")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pvkPassword); + if (message.keepEncrypted != null && Object.hasOwnProperty.call(message, "keepEncrypted")) + $root.google.protobuf.BoolValue.encode(message.keepEncrypted, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EncryptionOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions} message EncryptionOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EncryptionOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EncryptionOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncryptionOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.certPath = reader.string(); + break; + } + case 2: { + message.pvkPath = reader.string(); + break; + } + case 3: { + message.pvkPassword = reader.string(); + break; + } + case 5: { + message.keepEncrypted = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EncryptionOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EncryptionOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EncryptionOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EncryptionOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certPath != null && message.hasOwnProperty("certPath")) + if (!$util.isString(message.certPath)) + return "certPath: string expected"; + if (message.pvkPath != null && message.hasOwnProperty("pvkPath")) + if (!$util.isString(message.pvkPath)) + return "pvkPath: string expected"; + if (message.pvkPassword != null && message.hasOwnProperty("pvkPassword")) + if (!$util.isString(message.pvkPassword)) + return "pvkPassword: string expected"; + if (message.keepEncrypted != null && message.hasOwnProperty("keepEncrypted")) { + var error = $root.google.protobuf.BoolValue.verify(message.keepEncrypted); + if (error) + return "keepEncrypted." + error; + } + return null; + }; + + /** + * Creates an EncryptionOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions + */ + EncryptionOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions(); + if (object.certPath != null) + message.certPath = String(object.certPath); + if (object.pvkPath != null) + message.pvkPath = String(object.pvkPath); + if (object.pvkPassword != null) + message.pvkPassword = String(object.pvkPassword); + if (object.keepEncrypted != null) { + if (typeof object.keepEncrypted !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.keepEncrypted: object expected"); + message.keepEncrypted = $root.google.protobuf.BoolValue.fromObject(object.keepEncrypted); + } + return message; + }; + + /** + * Creates a plain object from an EncryptionOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions} message EncryptionOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EncryptionOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.certPath = ""; + object.pvkPath = ""; + object.pvkPassword = ""; + object.keepEncrypted = null; + } + if (message.certPath != null && message.hasOwnProperty("certPath")) + object.certPath = message.certPath; + if (message.pvkPath != null && message.hasOwnProperty("pvkPath")) + object.pvkPath = message.pvkPath; + if (message.pvkPassword != null && message.hasOwnProperty("pvkPassword")) + object.pvkPassword = message.pvkPassword; + if (message.keepEncrypted != null && message.hasOwnProperty("keepEncrypted")) + object.keepEncrypted = $root.google.protobuf.BoolValue.toObject(message.keepEncrypted, options); + return object; + }; + + /** + * Converts this EncryptionOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @instance + * @returns {Object.} JSON object + */ + EncryptionOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EncryptionOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EncryptionOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions"; + }; + + return EncryptionOptions; + })(); + + return SqlBakImportOptions; + })(); + + ImportContext.SqlTdeImportOptions = (function() { + + /** + * Properties of a SqlTdeImportOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext + * @interface ISqlTdeImportOptions + * @property {string|null} [certificatePath] SqlTdeImportOptions certificatePath + * @property {string|null} [privateKeyPath] SqlTdeImportOptions privateKeyPath + * @property {string|null} [privateKeyPassword] SqlTdeImportOptions privateKeyPassword + * @property {string|null} [name] SqlTdeImportOptions name + */ + + /** + * Constructs a new SqlTdeImportOptions. + * @memberof google.cloud.sql.v1beta4.ImportContext + * @classdesc Represents a SqlTdeImportOptions. + * @implements ISqlTdeImportOptions + * @constructor + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions=} [properties] Properties to set + */ + function SqlTdeImportOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlTdeImportOptions certificatePath. + * @member {string} certificatePath + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @instance + */ + SqlTdeImportOptions.prototype.certificatePath = ""; + + /** + * SqlTdeImportOptions privateKeyPath. + * @member {string} privateKeyPath + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @instance + */ + SqlTdeImportOptions.prototype.privateKeyPath = ""; + + /** + * SqlTdeImportOptions privateKeyPassword. + * @member {string} privateKeyPassword + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @instance + */ + SqlTdeImportOptions.prototype.privateKeyPassword = ""; + + /** + * SqlTdeImportOptions name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @instance + */ + SqlTdeImportOptions.prototype.name = ""; + + /** + * Creates a new SqlTdeImportOptions instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions instance + */ + SqlTdeImportOptions.create = function create(properties) { + return new SqlTdeImportOptions(properties); + }; + + /** + * Encodes the specified SqlTdeImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions} message SqlTdeImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTdeImportOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certificatePath != null && Object.hasOwnProperty.call(message, "certificatePath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.certificatePath); + if (message.privateKeyPath != null && Object.hasOwnProperty.call(message, "privateKeyPath")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateKeyPath); + if (message.privateKeyPassword != null && Object.hasOwnProperty.call(message, "privateKeyPassword")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.privateKeyPassword); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + return writer; + }; + + /** + * Encodes the specified SqlTdeImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions} message SqlTdeImportOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTdeImportOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlTdeImportOptions message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTdeImportOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.certificatePath = reader.string(); + break; + } + case 2: { + message.privateKeyPath = reader.string(); + break; + } + case 3: { + message.privateKeyPassword = reader.string(); + break; + } + case 5: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlTdeImportOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTdeImportOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlTdeImportOptions message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlTdeImportOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) + if (!$util.isString(message.certificatePath)) + return "certificatePath: string expected"; + if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) + if (!$util.isString(message.privateKeyPath)) + return "privateKeyPath: string expected"; + if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) + if (!$util.isString(message.privateKeyPassword)) + return "privateKeyPassword: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a SqlTdeImportOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions + */ + SqlTdeImportOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions) + return object; + var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions(); + if (object.certificatePath != null) + message.certificatePath = String(object.certificatePath); + if (object.privateKeyPath != null) + message.privateKeyPath = String(object.privateKeyPath); + if (object.privateKeyPassword != null) + message.privateKeyPassword = String(object.privateKeyPassword); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a SqlTdeImportOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @static + * @param {google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions} message SqlTdeImportOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlTdeImportOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.certificatePath = ""; + object.privateKeyPath = ""; + object.privateKeyPassword = ""; + object.name = ""; + } + if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) + object.certificatePath = message.certificatePath; + if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) + object.privateKeyPath = message.privateKeyPath; + if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) + object.privateKeyPassword = message.privateKeyPassword; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this SqlTdeImportOptions to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @instance + * @returns {Object.} JSON object + */ + SqlTdeImportOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlTdeImportOptions + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlTdeImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions"; + }; + + return SqlTdeImportOptions; + })(); + + return ImportContext; + })(); + + /** + * BakType enum. + * @name google.cloud.sql.v1beta4.BakType + * @enum {number} + * @property {number} BAK_TYPE_UNSPECIFIED=0 BAK_TYPE_UNSPECIFIED value + * @property {number} FULL=1 FULL value + * @property {number} DIFF=2 DIFF value + * @property {number} TLOG=3 TLOG value + */ + v1beta4.BakType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BAK_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FULL"] = 1; + values[valuesById[2] = "DIFF"] = 2; + values[valuesById[3] = "TLOG"] = 3; + return values; + })(); + + v1beta4.InstancesCloneRequest = (function() { + + /** + * Properties of an InstancesCloneRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesCloneRequest + * @property {google.cloud.sql.v1beta4.ICloneContext|null} [cloneContext] InstancesCloneRequest cloneContext + */ + + /** + * Constructs a new InstancesCloneRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesCloneRequest. + * @implements IInstancesCloneRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesCloneRequest=} [properties] Properties to set + */ + function InstancesCloneRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesCloneRequest cloneContext. + * @member {google.cloud.sql.v1beta4.ICloneContext|null|undefined} cloneContext + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @instance + */ + InstancesCloneRequest.prototype.cloneContext = null; + + /** + * Creates a new InstancesCloneRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesCloneRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesCloneRequest} InstancesCloneRequest instance + */ + InstancesCloneRequest.create = function create(properties) { + return new InstancesCloneRequest(properties); + }; + + /** + * Encodes the specified InstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesCloneRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesCloneRequest} message InstancesCloneRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesCloneRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.cloneContext != null && Object.hasOwnProperty.call(message, "cloneContext")) + $root.google.cloud.sql.v1beta4.CloneContext.encode(message.cloneContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesCloneRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesCloneRequest} message InstancesCloneRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesCloneRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesCloneRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesCloneRequest} InstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesCloneRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesCloneRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.cloneContext = $root.google.cloud.sql.v1beta4.CloneContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesCloneRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesCloneRequest} InstancesCloneRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesCloneRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesCloneRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesCloneRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.cloneContext != null && message.hasOwnProperty("cloneContext")) { + var error = $root.google.cloud.sql.v1beta4.CloneContext.verify(message.cloneContext); + if (error) + return "cloneContext." + error; + } + return null; + }; + + /** + * Creates an InstancesCloneRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesCloneRequest} InstancesCloneRequest + */ + InstancesCloneRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesCloneRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesCloneRequest(); + if (object.cloneContext != null) { + if (typeof object.cloneContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesCloneRequest.cloneContext: object expected"); + message.cloneContext = $root.google.cloud.sql.v1beta4.CloneContext.fromObject(object.cloneContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesCloneRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesCloneRequest} message InstancesCloneRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesCloneRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.cloneContext = null; + if (message.cloneContext != null && message.hasOwnProperty("cloneContext")) + object.cloneContext = $root.google.cloud.sql.v1beta4.CloneContext.toObject(message.cloneContext, options); + return object; + }; + + /** + * Converts this InstancesCloneRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesCloneRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesCloneRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesCloneRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesCloneRequest"; + }; + + return InstancesCloneRequest; + })(); + + v1beta4.InstancesDemoteMasterRequest = (function() { + + /** + * Properties of an InstancesDemoteMasterRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesDemoteMasterRequest + * @property {google.cloud.sql.v1beta4.IDemoteMasterContext|null} [demoteMasterContext] InstancesDemoteMasterRequest demoteMasterContext + */ + + /** + * Constructs a new InstancesDemoteMasterRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesDemoteMasterRequest. + * @implements IInstancesDemoteMasterRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest=} [properties] Properties to set + */ + function InstancesDemoteMasterRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesDemoteMasterRequest demoteMasterContext. + * @member {google.cloud.sql.v1beta4.IDemoteMasterContext|null|undefined} demoteMasterContext + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @instance + */ + InstancesDemoteMasterRequest.prototype.demoteMasterContext = null; + + /** + * Creates a new InstancesDemoteMasterRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest instance + */ + InstancesDemoteMasterRequest.create = function create(properties) { + return new InstancesDemoteMasterRequest(properties); + }; + + /** + * Encodes the specified InstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest} message InstancesDemoteMasterRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesDemoteMasterRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.demoteMasterContext != null && Object.hasOwnProperty.call(message, "demoteMasterContext")) + $root.google.cloud.sql.v1beta4.DemoteMasterContext.encode(message.demoteMasterContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest} message InstancesDemoteMasterRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesDemoteMasterRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesDemoteMasterRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.demoteMasterContext = $root.google.cloud.sql.v1beta4.DemoteMasterContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesDemoteMasterRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesDemoteMasterRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesDemoteMasterRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.demoteMasterContext != null && message.hasOwnProperty("demoteMasterContext")) { + var error = $root.google.cloud.sql.v1beta4.DemoteMasterContext.verify(message.demoteMasterContext); + if (error) + return "demoteMasterContext." + error; + } + return null; + }; + + /** + * Creates an InstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest + */ + InstancesDemoteMasterRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest(); + if (object.demoteMasterContext != null) { + if (typeof object.demoteMasterContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.demoteMasterContext: object expected"); + message.demoteMasterContext = $root.google.cloud.sql.v1beta4.DemoteMasterContext.fromObject(object.demoteMasterContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesDemoteMasterRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} message InstancesDemoteMasterRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesDemoteMasterRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.demoteMasterContext = null; + if (message.demoteMasterContext != null && message.hasOwnProperty("demoteMasterContext")) + object.demoteMasterContext = $root.google.cloud.sql.v1beta4.DemoteMasterContext.toObject(message.demoteMasterContext, options); + return object; + }; + + /** + * Converts this InstancesDemoteMasterRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesDemoteMasterRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesDemoteMasterRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesDemoteMasterRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesDemoteMasterRequest"; + }; + + return InstancesDemoteMasterRequest; + })(); + + v1beta4.InstancesDemoteRequest = (function() { + + /** + * Properties of an InstancesDemoteRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesDemoteRequest + * @property {google.cloud.sql.v1beta4.IDemoteContext|null} [demoteContext] InstancesDemoteRequest demoteContext + */ + + /** + * Constructs a new InstancesDemoteRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesDemoteRequest. + * @implements IInstancesDemoteRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesDemoteRequest=} [properties] Properties to set + */ + function InstancesDemoteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesDemoteRequest demoteContext. + * @member {google.cloud.sql.v1beta4.IDemoteContext|null|undefined} demoteContext + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @instance + */ + InstancesDemoteRequest.prototype.demoteContext = null; + + /** + * Creates a new InstancesDemoteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesDemoteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesDemoteRequest} InstancesDemoteRequest instance + */ + InstancesDemoteRequest.create = function create(properties) { + return new InstancesDemoteRequest(properties); + }; + + /** + * Encodes the specified InstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesDemoteRequest} message InstancesDemoteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesDemoteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.demoteContext != null && Object.hasOwnProperty.call(message, "demoteContext")) + $root.google.cloud.sql.v1beta4.DemoteContext.encode(message.demoteContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesDemoteRequest} message InstancesDemoteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesDemoteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesDemoteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesDemoteRequest} InstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesDemoteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesDemoteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.demoteContext = $root.google.cloud.sql.v1beta4.DemoteContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesDemoteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesDemoteRequest} InstancesDemoteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesDemoteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesDemoteRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesDemoteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.demoteContext != null && message.hasOwnProperty("demoteContext")) { + var error = $root.google.cloud.sql.v1beta4.DemoteContext.verify(message.demoteContext); + if (error) + return "demoteContext." + error; + } + return null; + }; + + /** + * Creates an InstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesDemoteRequest} InstancesDemoteRequest + */ + InstancesDemoteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesDemoteRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesDemoteRequest(); + if (object.demoteContext != null) { + if (typeof object.demoteContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesDemoteRequest.demoteContext: object expected"); + message.demoteContext = $root.google.cloud.sql.v1beta4.DemoteContext.fromObject(object.demoteContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesDemoteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesDemoteRequest} message InstancesDemoteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesDemoteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.demoteContext = null; + if (message.demoteContext != null && message.hasOwnProperty("demoteContext")) + object.demoteContext = $root.google.cloud.sql.v1beta4.DemoteContext.toObject(message.demoteContext, options); + return object; + }; + + /** + * Converts this InstancesDemoteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesDemoteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesDemoteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesDemoteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesDemoteRequest"; + }; + + return InstancesDemoteRequest; + })(); + + v1beta4.InstancesExportRequest = (function() { + + /** + * Properties of an InstancesExportRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesExportRequest + * @property {google.cloud.sql.v1beta4.IExportContext|null} [exportContext] InstancesExportRequest exportContext + */ + + /** + * Constructs a new InstancesExportRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesExportRequest. + * @implements IInstancesExportRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesExportRequest=} [properties] Properties to set + */ + function InstancesExportRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesExportRequest exportContext. + * @member {google.cloud.sql.v1beta4.IExportContext|null|undefined} exportContext + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @instance + */ + InstancesExportRequest.prototype.exportContext = null; + + /** + * Creates a new InstancesExportRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesExportRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesExportRequest} InstancesExportRequest instance + */ + InstancesExportRequest.create = function create(properties) { + return new InstancesExportRequest(properties); + }; + + /** + * Encodes the specified InstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesExportRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesExportRequest} message InstancesExportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesExportRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exportContext != null && Object.hasOwnProperty.call(message, "exportContext")) + $root.google.cloud.sql.v1beta4.ExportContext.encode(message.exportContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesExportRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesExportRequest} message InstancesExportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesExportRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesExportRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesExportRequest} InstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesExportRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesExportRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesExportRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesExportRequest} InstancesExportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesExportRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesExportRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesExportRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.exportContext != null && message.hasOwnProperty("exportContext")) { + var error = $root.google.cloud.sql.v1beta4.ExportContext.verify(message.exportContext); + if (error) + return "exportContext." + error; + } + return null; + }; + + /** + * Creates an InstancesExportRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesExportRequest} InstancesExportRequest + */ + InstancesExportRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesExportRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesExportRequest(); + if (object.exportContext != null) { + if (typeof object.exportContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesExportRequest.exportContext: object expected"); + message.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.fromObject(object.exportContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesExportRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesExportRequest} message InstancesExportRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesExportRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.exportContext = null; + if (message.exportContext != null && message.hasOwnProperty("exportContext")) + object.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.toObject(message.exportContext, options); + return object; + }; + + /** + * Converts this InstancesExportRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesExportRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesExportRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesExportRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesExportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesExportRequest"; + }; + + return InstancesExportRequest; + })(); + + v1beta4.InstancesFailoverRequest = (function() { + + /** + * Properties of an InstancesFailoverRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesFailoverRequest + * @property {google.cloud.sql.v1beta4.IFailoverContext|null} [failoverContext] InstancesFailoverRequest failoverContext + */ + + /** + * Constructs a new InstancesFailoverRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesFailoverRequest. + * @implements IInstancesFailoverRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesFailoverRequest=} [properties] Properties to set + */ + function InstancesFailoverRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesFailoverRequest failoverContext. + * @member {google.cloud.sql.v1beta4.IFailoverContext|null|undefined} failoverContext + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @instance + */ + InstancesFailoverRequest.prototype.failoverContext = null; + + /** + * Creates a new InstancesFailoverRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesFailoverRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesFailoverRequest} InstancesFailoverRequest instance + */ + InstancesFailoverRequest.create = function create(properties) { + return new InstancesFailoverRequest(properties); + }; + + /** + * Encodes the specified InstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesFailoverRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesFailoverRequest} message InstancesFailoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesFailoverRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.failoverContext != null && Object.hasOwnProperty.call(message, "failoverContext")) + $root.google.cloud.sql.v1beta4.FailoverContext.encode(message.failoverContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesFailoverRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesFailoverRequest} message InstancesFailoverRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesFailoverRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesFailoverRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesFailoverRequest} InstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesFailoverRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesFailoverRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.failoverContext = $root.google.cloud.sql.v1beta4.FailoverContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesFailoverRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesFailoverRequest} InstancesFailoverRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesFailoverRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesFailoverRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesFailoverRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.failoverContext != null && message.hasOwnProperty("failoverContext")) { + var error = $root.google.cloud.sql.v1beta4.FailoverContext.verify(message.failoverContext); + if (error) + return "failoverContext." + error; + } + return null; + }; + + /** + * Creates an InstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesFailoverRequest} InstancesFailoverRequest + */ + InstancesFailoverRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesFailoverRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesFailoverRequest(); + if (object.failoverContext != null) { + if (typeof object.failoverContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesFailoverRequest.failoverContext: object expected"); + message.failoverContext = $root.google.cloud.sql.v1beta4.FailoverContext.fromObject(object.failoverContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesFailoverRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesFailoverRequest} message InstancesFailoverRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesFailoverRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.failoverContext = null; + if (message.failoverContext != null && message.hasOwnProperty("failoverContext")) + object.failoverContext = $root.google.cloud.sql.v1beta4.FailoverContext.toObject(message.failoverContext, options); + return object; + }; + + /** + * Converts this InstancesFailoverRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesFailoverRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesFailoverRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesFailoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesFailoverRequest"; + }; + + return InstancesFailoverRequest; + })(); + + v1beta4.InstancesImportRequest = (function() { + + /** + * Properties of an InstancesImportRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesImportRequest + * @property {google.cloud.sql.v1beta4.IImportContext|null} [importContext] InstancesImportRequest importContext + */ + + /** + * Constructs a new InstancesImportRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesImportRequest. + * @implements IInstancesImportRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesImportRequest=} [properties] Properties to set + */ + function InstancesImportRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesImportRequest importContext. + * @member {google.cloud.sql.v1beta4.IImportContext|null|undefined} importContext + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @instance + */ + InstancesImportRequest.prototype.importContext = null; + + /** + * Creates a new InstancesImportRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesImportRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesImportRequest} InstancesImportRequest instance + */ + InstancesImportRequest.create = function create(properties) { + return new InstancesImportRequest(properties); + }; + + /** + * Encodes the specified InstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesImportRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesImportRequest} message InstancesImportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesImportRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.importContext != null && Object.hasOwnProperty.call(message, "importContext")) + $root.google.cloud.sql.v1beta4.ImportContext.encode(message.importContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesImportRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesImportRequest} message InstancesImportRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesImportRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesImportRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesImportRequest} InstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesImportRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesImportRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.importContext = $root.google.cloud.sql.v1beta4.ImportContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesImportRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesImportRequest} InstancesImportRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesImportRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesImportRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesImportRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.importContext != null && message.hasOwnProperty("importContext")) { + var error = $root.google.cloud.sql.v1beta4.ImportContext.verify(message.importContext); + if (error) + return "importContext." + error; + } + return null; + }; + + /** + * Creates an InstancesImportRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesImportRequest} InstancesImportRequest + */ + InstancesImportRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesImportRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesImportRequest(); + if (object.importContext != null) { + if (typeof object.importContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesImportRequest.importContext: object expected"); + message.importContext = $root.google.cloud.sql.v1beta4.ImportContext.fromObject(object.importContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesImportRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesImportRequest} message InstancesImportRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesImportRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.importContext = null; + if (message.importContext != null && message.hasOwnProperty("importContext")) + object.importContext = $root.google.cloud.sql.v1beta4.ImportContext.toObject(message.importContext, options); + return object; + }; + + /** + * Converts this InstancesImportRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesImportRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesImportRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesImportRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesImportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesImportRequest"; + }; + + return InstancesImportRequest; + })(); + + v1beta4.InstancesPreCheckMajorVersionUpgradeRequest = (function() { + + /** + * Properties of an InstancesPreCheckMajorVersionUpgradeRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesPreCheckMajorVersionUpgradeRequest + * @property {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null} [preCheckMajorVersionUpgradeContext] InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext + */ + + /** + * Constructs a new InstancesPreCheckMajorVersionUpgradeRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesPreCheckMajorVersionUpgradeRequest. + * @implements IInstancesPreCheckMajorVersionUpgradeRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set + */ + function InstancesPreCheckMajorVersionUpgradeRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext. + * @member {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null|undefined} preCheckMajorVersionUpgradeContext + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @instance + */ + InstancesPreCheckMajorVersionUpgradeRequest.prototype.preCheckMajorVersionUpgradeContext = null; + + /** + * Creates a new InstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest instance + */ + InstancesPreCheckMajorVersionUpgradeRequest.create = function create(properties) { + return new InstancesPreCheckMajorVersionUpgradeRequest(properties); + }; + + /** + * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesPreCheckMajorVersionUpgradeRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.preCheckMajorVersionUpgradeContext != null && Object.hasOwnProperty.call(message, "preCheckMajorVersionUpgradeContext")) + $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.encode(message.preCheckMajorVersionUpgradeContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesPreCheckMajorVersionUpgradeRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesPreCheckMajorVersionUpgradeRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesPreCheckMajorVersionUpgradeRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesPreCheckMajorVersionUpgradeRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesPreCheckMajorVersionUpgradeRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) { + var error = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify(message.preCheckMajorVersionUpgradeContext); + if (error) + return "preCheckMajorVersionUpgradeContext." + error; + } + return null; + }; + + /** + * Creates an InstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest + */ + InstancesPreCheckMajorVersionUpgradeRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest(); + if (object.preCheckMajorVersionUpgradeContext != null) { + if (typeof object.preCheckMajorVersionUpgradeContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.preCheckMajorVersionUpgradeContext: object expected"); + message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.fromObject(object.preCheckMajorVersionUpgradeContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesPreCheckMajorVersionUpgradeRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.preCheckMajorVersionUpgradeContext = null; + if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) + object.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.toObject(message.preCheckMajorVersionUpgradeContext, options); + return object; + }; + + /** + * Converts this InstancesPreCheckMajorVersionUpgradeRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesPreCheckMajorVersionUpgradeRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesPreCheckMajorVersionUpgradeRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesPreCheckMajorVersionUpgradeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest"; + }; + + return InstancesPreCheckMajorVersionUpgradeRequest; + })(); + + v1beta4.MySqlSyncConfig = (function() { + + /** + * Properties of a MySqlSyncConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IMySqlSyncConfig + * @property {Array.|null} [initialSyncFlags] MySqlSyncConfig initialSyncFlags + */ + + /** + * Constructs a new MySqlSyncConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a MySqlSyncConfig. + * @implements IMySqlSyncConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IMySqlSyncConfig=} [properties] Properties to set + */ + function MySqlSyncConfig(properties) { + this.initialSyncFlags = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MySqlSyncConfig initialSyncFlags. + * @member {Array.} initialSyncFlags + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @instance + */ + MySqlSyncConfig.prototype.initialSyncFlags = $util.emptyArray; + + /** + * Creates a new MySqlSyncConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @static + * @param {google.cloud.sql.v1beta4.IMySqlSyncConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.MySqlSyncConfig} MySqlSyncConfig instance + */ + MySqlSyncConfig.create = function create(properties) { + return new MySqlSyncConfig(properties); + }; + + /** + * Encodes the specified MySqlSyncConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlSyncConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @static + * @param {google.cloud.sql.v1beta4.IMySqlSyncConfig} message MySqlSyncConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MySqlSyncConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.initialSyncFlags != null && message.initialSyncFlags.length) + for (var i = 0; i < message.initialSyncFlags.length; ++i) + $root.google.cloud.sql.v1beta4.SyncFlags.encode(message.initialSyncFlags[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MySqlSyncConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlSyncConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @static + * @param {google.cloud.sql.v1beta4.IMySqlSyncConfig} message MySqlSyncConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MySqlSyncConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MySqlSyncConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.MySqlSyncConfig} MySqlSyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MySqlSyncConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.MySqlSyncConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.initialSyncFlags && message.initialSyncFlags.length)) + message.initialSyncFlags = []; + message.initialSyncFlags.push($root.google.cloud.sql.v1beta4.SyncFlags.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MySqlSyncConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.MySqlSyncConfig} MySqlSyncConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MySqlSyncConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MySqlSyncConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MySqlSyncConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.initialSyncFlags != null && message.hasOwnProperty("initialSyncFlags")) { + if (!Array.isArray(message.initialSyncFlags)) + return "initialSyncFlags: array expected"; + for (var i = 0; i < message.initialSyncFlags.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.SyncFlags.verify(message.initialSyncFlags[i]); + if (error) + return "initialSyncFlags." + error; + } + } + return null; + }; + + /** + * Creates a MySqlSyncConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.MySqlSyncConfig} MySqlSyncConfig + */ + MySqlSyncConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.MySqlSyncConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.MySqlSyncConfig(); + if (object.initialSyncFlags) { + if (!Array.isArray(object.initialSyncFlags)) + throw TypeError(".google.cloud.sql.v1beta4.MySqlSyncConfig.initialSyncFlags: array expected"); + message.initialSyncFlags = []; + for (var i = 0; i < object.initialSyncFlags.length; ++i) { + if (typeof object.initialSyncFlags[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.MySqlSyncConfig.initialSyncFlags: object expected"); + message.initialSyncFlags[i] = $root.google.cloud.sql.v1beta4.SyncFlags.fromObject(object.initialSyncFlags[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a MySqlSyncConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @static + * @param {google.cloud.sql.v1beta4.MySqlSyncConfig} message MySqlSyncConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MySqlSyncConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.initialSyncFlags = []; + if (message.initialSyncFlags && message.initialSyncFlags.length) { + object.initialSyncFlags = []; + for (var j = 0; j < message.initialSyncFlags.length; ++j) + object.initialSyncFlags[j] = $root.google.cloud.sql.v1beta4.SyncFlags.toObject(message.initialSyncFlags[j], options); + } + return object; + }; + + /** + * Converts this MySqlSyncConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @instance + * @returns {Object.} JSON object + */ + MySqlSyncConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MySqlSyncConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MySqlSyncConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.MySqlSyncConfig"; + }; + + return MySqlSyncConfig; + })(); + + v1beta4.InstancesListResponse = (function() { + + /** + * Properties of an InstancesListResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesListResponse + * @property {string|null} [kind] InstancesListResponse kind + * @property {Array.|null} [warnings] InstancesListResponse warnings + * @property {Array.|null} [items] InstancesListResponse items + * @property {string|null} [nextPageToken] InstancesListResponse nextPageToken + */ + + /** + * Constructs a new InstancesListResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesListResponse. + * @implements IInstancesListResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesListResponse=} [properties] Properties to set + */ + function InstancesListResponse(properties) { + this.warnings = []; + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @instance + */ + InstancesListResponse.prototype.kind = ""; + + /** + * InstancesListResponse warnings. + * @member {Array.} warnings + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @instance + */ + InstancesListResponse.prototype.warnings = $util.emptyArray; + + /** + * InstancesListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @instance + */ + InstancesListResponse.prototype.items = $util.emptyArray; + + /** + * InstancesListResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @instance + */ + InstancesListResponse.prototype.nextPageToken = ""; + + /** + * Creates a new InstancesListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesListResponse} InstancesListResponse instance + */ + InstancesListResponse.create = function create(properties) { + return new InstancesListResponse(properties); + }; + + /** + * Encodes the specified InstancesListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListResponse} message InstancesListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + $root.google.cloud.sql.v1beta4.ApiWarning.encode(message.warnings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.items[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified InstancesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListResponse} message InstancesListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesListResponse} InstancesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push($root.google.cloud.sql.v1beta4.ApiWarning.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32())); + break; + } + case 4: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesListResponse} InstancesListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesListResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.ApiWarning.verify(message.warnings[i]); + if (error) + return "warnings." + error; + } + } + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates an InstancesListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesListResponse} InstancesListResponse + */ + InstancesListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesListResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.sql.v1beta4.InstancesListResponse.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) { + if (typeof object.warnings[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesListResponse.warnings: object expected"); + message.warnings[i] = $root.google.cloud.sql.v1beta4.ApiWarning.fromObject(object.warnings[i]); + } + } + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1beta4.InstancesListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.items[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from an InstancesListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @static + * @param {google.cloud.sql.v1beta4.InstancesListResponse} message InstancesListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.warnings = []; + object.items = []; + } + if (options.defaults) { + object.kind = ""; + object.nextPageToken = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = $root.google.cloud.sql.v1beta4.ApiWarning.toObject(message.warnings[j], options); + } + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.items[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this InstancesListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @instance + * @returns {Object.} JSON object + */ + InstancesListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesListResponse"; + }; + + return InstancesListResponse; + })(); + + v1beta4.InstancesListServerCasResponse = (function() { + + /** + * Properties of an InstancesListServerCasResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesListServerCasResponse + * @property {Array.|null} [certs] InstancesListServerCasResponse certs + * @property {string|null} [activeVersion] InstancesListServerCasResponse activeVersion + * @property {string|null} [kind] InstancesListServerCasResponse kind + */ + + /** + * Constructs a new InstancesListServerCasResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesListServerCasResponse. + * @implements IInstancesListServerCasResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesListServerCasResponse=} [properties] Properties to set + */ + function InstancesListServerCasResponse(properties) { + this.certs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesListServerCasResponse certs. + * @member {Array.} certs + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @instance + */ + InstancesListServerCasResponse.prototype.certs = $util.emptyArray; + + /** + * InstancesListServerCasResponse activeVersion. + * @member {string} activeVersion + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @instance + */ + InstancesListServerCasResponse.prototype.activeVersion = ""; + + /** + * InstancesListServerCasResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @instance + */ + InstancesListServerCasResponse.prototype.kind = ""; + + /** + * Creates a new InstancesListServerCasResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListServerCasResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesListServerCasResponse} InstancesListServerCasResponse instance + */ + InstancesListServerCasResponse.create = function create(properties) { + return new InstancesListServerCasResponse(properties); + }; + + /** + * Encodes the specified InstancesListServerCasResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCasResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListServerCasResponse} message InstancesListServerCasResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListServerCasResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certs != null && message.certs.length) + for (var i = 0; i < message.certs.length; ++i) + $root.google.cloud.sql.v1beta4.SslCert.encode(message.certs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.activeVersion); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + return writer; + }; + + /** + * Encodes the specified InstancesListServerCasResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCasResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListServerCasResponse} message InstancesListServerCasResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListServerCasResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesListServerCasResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesListServerCasResponse} InstancesListServerCasResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListServerCasResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesListServerCasResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.certs && message.certs.length)) + message.certs = []; + message.certs.push($root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32())); + break; + } + case 2: { + message.activeVersion = reader.string(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesListServerCasResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesListServerCasResponse} InstancesListServerCasResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListServerCasResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesListServerCasResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesListServerCasResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certs != null && message.hasOwnProperty("certs")) { + if (!Array.isArray(message.certs)) + return "certs: array expected"; + for (var i = 0; i < message.certs.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.certs[i]); + if (error) + return "certs." + error; + } + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + if (!$util.isString(message.activeVersion)) + return "activeVersion: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates an InstancesListServerCasResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesListServerCasResponse} InstancesListServerCasResponse + */ + InstancesListServerCasResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesListServerCasResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesListServerCasResponse(); + if (object.certs) { + if (!Array.isArray(object.certs)) + throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCasResponse.certs: array expected"); + message.certs = []; + for (var i = 0; i < object.certs.length; ++i) { + if (typeof object.certs[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCasResponse.certs: object expected"); + message.certs[i] = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.certs[i]); + } + } + if (object.activeVersion != null) + message.activeVersion = String(object.activeVersion); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from an InstancesListServerCasResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @static + * @param {google.cloud.sql.v1beta4.InstancesListServerCasResponse} message InstancesListServerCasResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesListServerCasResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.certs = []; + if (options.defaults) { + object.activeVersion = ""; + object.kind = ""; + } + if (message.certs && message.certs.length) { + object.certs = []; + for (var j = 0; j < message.certs.length; ++j) + object.certs[j] = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.certs[j], options); + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + object.activeVersion = message.activeVersion; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this InstancesListServerCasResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @instance + * @returns {Object.} JSON object + */ + InstancesListServerCasResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesListServerCasResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesListServerCasResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesListServerCasResponse"; + }; + + return InstancesListServerCasResponse; + })(); + + v1beta4.InstancesListServerCertificatesResponse = (function() { + + /** + * Properties of an InstancesListServerCertificatesResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesListServerCertificatesResponse + * @property {Array.|null} [caCerts] InstancesListServerCertificatesResponse caCerts + * @property {Array.|null} [serverCerts] InstancesListServerCertificatesResponse serverCerts + * @property {string|null} [activeVersion] InstancesListServerCertificatesResponse activeVersion + * @property {string|null} [kind] InstancesListServerCertificatesResponse kind + */ + + /** + * Constructs a new InstancesListServerCertificatesResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesListServerCertificatesResponse. + * @implements IInstancesListServerCertificatesResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse=} [properties] Properties to set + */ + function InstancesListServerCertificatesResponse(properties) { + this.caCerts = []; + this.serverCerts = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesListServerCertificatesResponse caCerts. + * @member {Array.} caCerts + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @instance + */ + InstancesListServerCertificatesResponse.prototype.caCerts = $util.emptyArray; + + /** + * InstancesListServerCertificatesResponse serverCerts. + * @member {Array.} serverCerts + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @instance + */ + InstancesListServerCertificatesResponse.prototype.serverCerts = $util.emptyArray; + + /** + * InstancesListServerCertificatesResponse activeVersion. + * @member {string} activeVersion + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @instance + */ + InstancesListServerCertificatesResponse.prototype.activeVersion = ""; + + /** + * InstancesListServerCertificatesResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @instance + */ + InstancesListServerCertificatesResponse.prototype.kind = ""; + + /** + * Creates a new InstancesListServerCertificatesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse instance + */ + InstancesListServerCertificatesResponse.create = function create(properties) { + return new InstancesListServerCertificatesResponse(properties); + }; + + /** + * Encodes the specified InstancesListServerCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListServerCertificatesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.caCerts != null && message.caCerts.length) + for (var i = 0; i < message.caCerts.length; ++i) + $root.google.cloud.sql.v1beta4.SslCert.encode(message.caCerts[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.serverCerts != null && message.serverCerts.length) + for (var i = 0; i < message.serverCerts.length; ++i) + $root.google.cloud.sql.v1beta4.SslCert.encode(message.serverCerts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.activeVersion); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); + return writer; + }; + + /** + * Encodes the specified InstancesListServerCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListServerCertificatesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListServerCertificatesResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.caCerts && message.caCerts.length)) + message.caCerts = []; + message.caCerts.push($root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.serverCerts && message.serverCerts.length)) + message.serverCerts = []; + message.serverCerts.push($root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32())); + break; + } + case 3: { + message.activeVersion = reader.string(); + break; + } + case 4: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListServerCertificatesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesListServerCertificatesResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesListServerCertificatesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.caCerts != null && message.hasOwnProperty("caCerts")) { + if (!Array.isArray(message.caCerts)) + return "caCerts: array expected"; + for (var i = 0; i < message.caCerts.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.caCerts[i]); + if (error) + return "caCerts." + error; + } + } + if (message.serverCerts != null && message.hasOwnProperty("serverCerts")) { + if (!Array.isArray(message.serverCerts)) + return "serverCerts: array expected"; + for (var i = 0; i < message.serverCerts.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.serverCerts[i]); + if (error) + return "serverCerts." + error; + } + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + if (!$util.isString(message.activeVersion)) + return "activeVersion: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates an InstancesListServerCertificatesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse + */ + InstancesListServerCertificatesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse(); + if (object.caCerts) { + if (!Array.isArray(object.caCerts)) + throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.caCerts: array expected"); + message.caCerts = []; + for (var i = 0; i < object.caCerts.length; ++i) { + if (typeof object.caCerts[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.caCerts: object expected"); + message.caCerts[i] = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.caCerts[i]); + } + } + if (object.serverCerts) { + if (!Array.isArray(object.serverCerts)) + throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.serverCerts: array expected"); + message.serverCerts = []; + for (var i = 0; i < object.serverCerts.length; ++i) { + if (typeof object.serverCerts[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.serverCerts: object expected"); + message.serverCerts[i] = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.serverCerts[i]); + } + } + if (object.activeVersion != null) + message.activeVersion = String(object.activeVersion); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from an InstancesListServerCertificatesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @static + * @param {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesListServerCertificatesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.caCerts = []; + object.serverCerts = []; + } + if (options.defaults) { + object.activeVersion = ""; + object.kind = ""; + } + if (message.caCerts && message.caCerts.length) { + object.caCerts = []; + for (var j = 0; j < message.caCerts.length; ++j) + object.caCerts[j] = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.caCerts[j], options); + } + if (message.serverCerts && message.serverCerts.length) { + object.serverCerts = []; + for (var j = 0; j < message.serverCerts.length; ++j) + object.serverCerts[j] = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.serverCerts[j], options); + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + object.activeVersion = message.activeVersion; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this InstancesListServerCertificatesResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @instance + * @returns {Object.} JSON object + */ + InstancesListServerCertificatesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesListServerCertificatesResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesListServerCertificatesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse"; + }; + + return InstancesListServerCertificatesResponse; + })(); + + v1beta4.InstancesListEntraIdCertificatesResponse = (function() { + + /** + * Properties of an InstancesListEntraIdCertificatesResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesListEntraIdCertificatesResponse + * @property {Array.|null} [certs] InstancesListEntraIdCertificatesResponse certs + * @property {string|null} [activeVersion] InstancesListEntraIdCertificatesResponse activeVersion + * @property {string|null} [kind] InstancesListEntraIdCertificatesResponse kind + */ + + /** + * Constructs a new InstancesListEntraIdCertificatesResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesListEntraIdCertificatesResponse. + * @implements IInstancesListEntraIdCertificatesResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse=} [properties] Properties to set + */ + function InstancesListEntraIdCertificatesResponse(properties) { + this.certs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesListEntraIdCertificatesResponse certs. + * @member {Array.} certs + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @instance + */ + InstancesListEntraIdCertificatesResponse.prototype.certs = $util.emptyArray; + + /** + * InstancesListEntraIdCertificatesResponse activeVersion. + * @member {string} activeVersion + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @instance + */ + InstancesListEntraIdCertificatesResponse.prototype.activeVersion = ""; + + /** + * InstancesListEntraIdCertificatesResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @instance + */ + InstancesListEntraIdCertificatesResponse.prototype.kind = ""; + + /** + * Creates a new InstancesListEntraIdCertificatesResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse instance + */ + InstancesListEntraIdCertificatesResponse.create = function create(properties) { + return new InstancesListEntraIdCertificatesResponse(properties); + }; + + /** + * Encodes the specified InstancesListEntraIdCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListEntraIdCertificatesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certs != null && message.certs.length) + for (var i = 0; i < message.certs.length; ++i) + $root.google.cloud.sql.v1beta4.SslCert.encode(message.certs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.activeVersion); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + return writer; + }; + + /** + * Encodes the specified InstancesListEntraIdCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @static + * @param {google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesListEntraIdCertificatesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListEntraIdCertificatesResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.certs && message.certs.length)) + message.certs = []; + message.certs.push($root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32())); + break; + } + case 2: { + message.activeVersion = reader.string(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesListEntraIdCertificatesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesListEntraIdCertificatesResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesListEntraIdCertificatesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certs != null && message.hasOwnProperty("certs")) { + if (!Array.isArray(message.certs)) + return "certs: array expected"; + for (var i = 0; i < message.certs.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.certs[i]); + if (error) + return "certs." + error; + } + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + if (!$util.isString(message.activeVersion)) + return "activeVersion: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates an InstancesListEntraIdCertificatesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse + */ + InstancesListEntraIdCertificatesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse(); + if (object.certs) { + if (!Array.isArray(object.certs)) + throw TypeError(".google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.certs: array expected"); + message.certs = []; + for (var i = 0; i < object.certs.length; ++i) { + if (typeof object.certs[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.certs: object expected"); + message.certs[i] = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.certs[i]); + } + } + if (object.activeVersion != null) + message.activeVersion = String(object.activeVersion); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from an InstancesListEntraIdCertificatesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @static + * @param {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesListEntraIdCertificatesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.certs = []; + if (options.defaults) { + object.activeVersion = ""; + object.kind = ""; + } + if (message.certs && message.certs.length) { + object.certs = []; + for (var j = 0; j < message.certs.length; ++j) + object.certs[j] = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.certs[j], options); + } + if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) + object.activeVersion = message.activeVersion; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this InstancesListEntraIdCertificatesResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @instance + * @returns {Object.} JSON object + */ + InstancesListEntraIdCertificatesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesListEntraIdCertificatesResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesListEntraIdCertificatesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse"; + }; + + return InstancesListEntraIdCertificatesResponse; + })(); + + v1beta4.InstancesRestoreBackupRequest = (function() { + + /** + * Properties of an InstancesRestoreBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesRestoreBackupRequest + * @property {google.cloud.sql.v1beta4.IRestoreBackupContext|null} [restoreBackupContext] InstancesRestoreBackupRequest restoreBackupContext + * @property {string|null} [backup] InstancesRestoreBackupRequest backup + * @property {string|null} [backupdrBackup] InstancesRestoreBackupRequest backupdrBackup + * @property {google.cloud.sql.v1beta4.IDatabaseInstance|null} [restoreInstanceSettings] InstancesRestoreBackupRequest restoreInstanceSettings + * @property {Array.|null} [restoreInstanceClearOverridesFieldNames] InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames + */ + + /** + * Constructs a new InstancesRestoreBackupRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesRestoreBackupRequest. + * @implements IInstancesRestoreBackupRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest=} [properties] Properties to set + */ + function InstancesRestoreBackupRequest(properties) { + this.restoreInstanceClearOverridesFieldNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesRestoreBackupRequest restoreBackupContext. + * @member {google.cloud.sql.v1beta4.IRestoreBackupContext|null|undefined} restoreBackupContext + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @instance + */ + InstancesRestoreBackupRequest.prototype.restoreBackupContext = null; + + /** + * InstancesRestoreBackupRequest backup. + * @member {string} backup + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @instance + */ + InstancesRestoreBackupRequest.prototype.backup = ""; + + /** + * InstancesRestoreBackupRequest backupdrBackup. + * @member {string} backupdrBackup + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @instance + */ + InstancesRestoreBackupRequest.prototype.backupdrBackup = ""; + + /** + * InstancesRestoreBackupRequest restoreInstanceSettings. + * @member {google.cloud.sql.v1beta4.IDatabaseInstance|null|undefined} restoreInstanceSettings + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @instance + */ + InstancesRestoreBackupRequest.prototype.restoreInstanceSettings = null; + + /** + * InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames. + * @member {Array.} restoreInstanceClearOverridesFieldNames + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @instance + */ + InstancesRestoreBackupRequest.prototype.restoreInstanceClearOverridesFieldNames = $util.emptyArray; + + /** + * Creates a new InstancesRestoreBackupRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest instance + */ + InstancesRestoreBackupRequest.create = function create(properties) { + return new InstancesRestoreBackupRequest(properties); + }; + + /** + * Encodes the specified InstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest} message InstancesRestoreBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRestoreBackupRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restoreBackupContext != null && Object.hasOwnProperty.call(message, "restoreBackupContext")) + $root.google.cloud.sql.v1beta4.RestoreBackupContext.encode(message.restoreBackupContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.backup); + if (message.restoreInstanceSettings != null && Object.hasOwnProperty.call(message, "restoreInstanceSettings")) + $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.restoreInstanceSettings, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.backupdrBackup != null && Object.hasOwnProperty.call(message, "backupdrBackup")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.backupdrBackup); + if (message.restoreInstanceClearOverridesFieldNames != null && message.restoreInstanceClearOverridesFieldNames.length) + for (var i = 0; i < message.restoreInstanceClearOverridesFieldNames.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.restoreInstanceClearOverridesFieldNames[i]); + return writer; + }; + + /** + * Encodes the specified InstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest} message InstancesRestoreBackupRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRestoreBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRestoreBackupRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restoreBackupContext = $root.google.cloud.sql.v1beta4.RestoreBackupContext.decode(reader, reader.uint32()); + break; + } + case 2: { + message.backup = reader.string(); + break; + } + case 4: { + message.backupdrBackup = reader.string(); + break; + } + case 3: { + message.restoreInstanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + case 5: { + if (!(message.restoreInstanceClearOverridesFieldNames && message.restoreInstanceClearOverridesFieldNames.length)) + message.restoreInstanceClearOverridesFieldNames = []; + message.restoreInstanceClearOverridesFieldNames.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRestoreBackupRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesRestoreBackupRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesRestoreBackupRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restoreBackupContext != null && message.hasOwnProperty("restoreBackupContext")) { + var error = $root.google.cloud.sql.v1beta4.RestoreBackupContext.verify(message.restoreBackupContext); + if (error) + return "restoreBackupContext." + error; + } + if (message.backup != null && message.hasOwnProperty("backup")) + if (!$util.isString(message.backup)) + return "backup: string expected"; + if (message.backupdrBackup != null && message.hasOwnProperty("backupdrBackup")) + if (!$util.isString(message.backupdrBackup)) + return "backupdrBackup: string expected"; + if (message.restoreInstanceSettings != null && message.hasOwnProperty("restoreInstanceSettings")) { + var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.restoreInstanceSettings); + if (error) + return "restoreInstanceSettings." + error; + } + if (message.restoreInstanceClearOverridesFieldNames != null && message.hasOwnProperty("restoreInstanceClearOverridesFieldNames")) { + if (!Array.isArray(message.restoreInstanceClearOverridesFieldNames)) + return "restoreInstanceClearOverridesFieldNames: array expected"; + for (var i = 0; i < message.restoreInstanceClearOverridesFieldNames.length; ++i) + if (!$util.isString(message.restoreInstanceClearOverridesFieldNames[i])) + return "restoreInstanceClearOverridesFieldNames: string[] expected"; + } + return null; + }; + + /** + * Creates an InstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest + */ + InstancesRestoreBackupRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest(); + if (object.restoreBackupContext != null) { + if (typeof object.restoreBackupContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.restoreBackupContext: object expected"); + message.restoreBackupContext = $root.google.cloud.sql.v1beta4.RestoreBackupContext.fromObject(object.restoreBackupContext); + } + if (object.backup != null) + message.backup = String(object.backup); + if (object.backupdrBackup != null) + message.backupdrBackup = String(object.backupdrBackup); + if (object.restoreInstanceSettings != null) { + if (typeof object.restoreInstanceSettings !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.restoreInstanceSettings: object expected"); + message.restoreInstanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.restoreInstanceSettings); + } + if (object.restoreInstanceClearOverridesFieldNames) { + if (!Array.isArray(object.restoreInstanceClearOverridesFieldNames)) + throw TypeError(".google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.restoreInstanceClearOverridesFieldNames: array expected"); + message.restoreInstanceClearOverridesFieldNames = []; + for (var i = 0; i < object.restoreInstanceClearOverridesFieldNames.length; ++i) + message.restoreInstanceClearOverridesFieldNames[i] = String(object.restoreInstanceClearOverridesFieldNames[i]); + } + return message; + }; + + /** + * Creates a plain object from an InstancesRestoreBackupRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} message InstancesRestoreBackupRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesRestoreBackupRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.restoreInstanceClearOverridesFieldNames = []; + if (options.defaults) { + object.restoreBackupContext = null; + object.backup = ""; + object.restoreInstanceSettings = null; + object.backupdrBackup = ""; + } + if (message.restoreBackupContext != null && message.hasOwnProperty("restoreBackupContext")) + object.restoreBackupContext = $root.google.cloud.sql.v1beta4.RestoreBackupContext.toObject(message.restoreBackupContext, options); + if (message.backup != null && message.hasOwnProperty("backup")) + object.backup = message.backup; + if (message.restoreInstanceSettings != null && message.hasOwnProperty("restoreInstanceSettings")) + object.restoreInstanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.restoreInstanceSettings, options); + if (message.backupdrBackup != null && message.hasOwnProperty("backupdrBackup")) + object.backupdrBackup = message.backupdrBackup; + if (message.restoreInstanceClearOverridesFieldNames && message.restoreInstanceClearOverridesFieldNames.length) { + object.restoreInstanceClearOverridesFieldNames = []; + for (var j = 0; j < message.restoreInstanceClearOverridesFieldNames.length; ++j) + object.restoreInstanceClearOverridesFieldNames[j] = message.restoreInstanceClearOverridesFieldNames[j]; + } + return object; + }; + + /** + * Converts this InstancesRestoreBackupRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesRestoreBackupRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesRestoreBackupRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesRestoreBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesRestoreBackupRequest"; + }; + + return InstancesRestoreBackupRequest; + })(); + + v1beta4.InstancesRotateServerCaRequest = (function() { + + /** + * Properties of an InstancesRotateServerCaRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesRotateServerCaRequest + * @property {google.cloud.sql.v1beta4.IRotateServerCaContext|null} [rotateServerCaContext] InstancesRotateServerCaRequest rotateServerCaContext + */ + + /** + * Constructs a new InstancesRotateServerCaRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesRotateServerCaRequest. + * @implements IInstancesRotateServerCaRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest=} [properties] Properties to set + */ + function InstancesRotateServerCaRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesRotateServerCaRequest rotateServerCaContext. + * @member {google.cloud.sql.v1beta4.IRotateServerCaContext|null|undefined} rotateServerCaContext + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @instance + */ + InstancesRotateServerCaRequest.prototype.rotateServerCaContext = null; + + /** + * Creates a new InstancesRotateServerCaRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest instance + */ + InstancesRotateServerCaRequest.create = function create(properties) { + return new InstancesRotateServerCaRequest(properties); + }; + + /** + * Encodes the specified InstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest} message InstancesRotateServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateServerCaRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rotateServerCaContext != null && Object.hasOwnProperty.call(message, "rotateServerCaContext")) + $root.google.cloud.sql.v1beta4.RotateServerCaContext.encode(message.rotateServerCaContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest} message InstancesRotateServerCaRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateServerCaRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.rotateServerCaContext = $root.google.cloud.sql.v1beta4.RotateServerCaContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateServerCaRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesRotateServerCaRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesRotateServerCaRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rotateServerCaContext != null && message.hasOwnProperty("rotateServerCaContext")) { + var error = $root.google.cloud.sql.v1beta4.RotateServerCaContext.verify(message.rotateServerCaContext); + if (error) + return "rotateServerCaContext." + error; + } + return null; + }; + + /** + * Creates an InstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest + */ + InstancesRotateServerCaRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest(); + if (object.rotateServerCaContext != null) { + if (typeof object.rotateServerCaContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.rotateServerCaContext: object expected"); + message.rotateServerCaContext = $root.google.cloud.sql.v1beta4.RotateServerCaContext.fromObject(object.rotateServerCaContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesRotateServerCaRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} message InstancesRotateServerCaRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesRotateServerCaRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.rotateServerCaContext = null; + if (message.rotateServerCaContext != null && message.hasOwnProperty("rotateServerCaContext")) + object.rotateServerCaContext = $root.google.cloud.sql.v1beta4.RotateServerCaContext.toObject(message.rotateServerCaContext, options); + return object; + }; + + /** + * Converts this InstancesRotateServerCaRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesRotateServerCaRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesRotateServerCaRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesRotateServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesRotateServerCaRequest"; + }; + + return InstancesRotateServerCaRequest; + })(); + + v1beta4.InstancesRotateServerCertificateRequest = (function() { + + /** + * Properties of an InstancesRotateServerCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesRotateServerCertificateRequest + * @property {google.cloud.sql.v1beta4.IRotateServerCertificateContext|null} [rotateServerCertificateContext] InstancesRotateServerCertificateRequest rotateServerCertificateContext + */ + + /** + * Constructs a new InstancesRotateServerCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesRotateServerCertificateRequest. + * @implements IInstancesRotateServerCertificateRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest=} [properties] Properties to set + */ + function InstancesRotateServerCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesRotateServerCertificateRequest rotateServerCertificateContext. + * @member {google.cloud.sql.v1beta4.IRotateServerCertificateContext|null|undefined} rotateServerCertificateContext + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @instance + */ + InstancesRotateServerCertificateRequest.prototype.rotateServerCertificateContext = null; + + /** + * Creates a new InstancesRotateServerCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest instance + */ + InstancesRotateServerCertificateRequest.create = function create(properties) { + return new InstancesRotateServerCertificateRequest(properties); + }; + + /** + * Encodes the specified InstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateServerCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rotateServerCertificateContext != null && Object.hasOwnProperty.call(message, "rotateServerCertificateContext")) + $root.google.cloud.sql.v1beta4.RotateServerCertificateContext.encode(message.rotateServerCertificateContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateServerCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.rotateServerCertificateContext = $root.google.cloud.sql.v1beta4.RotateServerCertificateContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesRotateServerCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesRotateServerCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rotateServerCertificateContext != null && message.hasOwnProperty("rotateServerCertificateContext")) { + var error = $root.google.cloud.sql.v1beta4.RotateServerCertificateContext.verify(message.rotateServerCertificateContext); + if (error) + return "rotateServerCertificateContext." + error; + } + return null; + }; + + /** + * Creates an InstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest + */ + InstancesRotateServerCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest(); + if (object.rotateServerCertificateContext != null) { + if (typeof object.rotateServerCertificateContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.rotateServerCertificateContext: object expected"); + message.rotateServerCertificateContext = $root.google.cloud.sql.v1beta4.RotateServerCertificateContext.fromObject(object.rotateServerCertificateContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesRotateServerCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesRotateServerCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.rotateServerCertificateContext = null; + if (message.rotateServerCertificateContext != null && message.hasOwnProperty("rotateServerCertificateContext")) + object.rotateServerCertificateContext = $root.google.cloud.sql.v1beta4.RotateServerCertificateContext.toObject(message.rotateServerCertificateContext, options); + return object; + }; + + /** + * Converts this InstancesRotateServerCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesRotateServerCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesRotateServerCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesRotateServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest"; + }; + + return InstancesRotateServerCertificateRequest; + })(); + + v1beta4.InstancesRotateEntraIdCertificateRequest = (function() { + + /** + * Properties of an InstancesRotateEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesRotateEntraIdCertificateRequest + * @property {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext|null} [rotateEntraIdCertificateContext] InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext + */ + + /** + * Constructs a new InstancesRotateEntraIdCertificateRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesRotateEntraIdCertificateRequest. + * @implements IInstancesRotateEntraIdCertificateRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set + */ + function InstancesRotateEntraIdCertificateRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext. + * @member {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext|null|undefined} rotateEntraIdCertificateContext + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @instance + */ + InstancesRotateEntraIdCertificateRequest.prototype.rotateEntraIdCertificateContext = null; + + /** + * Creates a new InstancesRotateEntraIdCertificateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest instance + */ + InstancesRotateEntraIdCertificateRequest.create = function create(properties) { + return new InstancesRotateEntraIdCertificateRequest(properties); + }; + + /** + * Encodes the specified InstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateEntraIdCertificateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rotateEntraIdCertificateContext != null && Object.hasOwnProperty.call(message, "rotateEntraIdCertificateContext")) + $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.encode(message.rotateEntraIdCertificateContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesRotateEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateEntraIdCertificateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesRotateEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesRotateEntraIdCertificateRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesRotateEntraIdCertificateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rotateEntraIdCertificateContext != null && message.hasOwnProperty("rotateEntraIdCertificateContext")) { + var error = $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.verify(message.rotateEntraIdCertificateContext); + if (error) + return "rotateEntraIdCertificateContext." + error; + } + return null; + }; + + /** + * Creates an InstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest + */ + InstancesRotateEntraIdCertificateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest(); + if (object.rotateEntraIdCertificateContext != null) { + if (typeof object.rotateEntraIdCertificateContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.rotateEntraIdCertificateContext: object expected"); + message.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.fromObject(object.rotateEntraIdCertificateContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesRotateEntraIdCertificateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.rotateEntraIdCertificateContext = null; + if (message.rotateEntraIdCertificateContext != null && message.hasOwnProperty("rotateEntraIdCertificateContext")) + object.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.toObject(message.rotateEntraIdCertificateContext, options); + return object; + }; + + /** + * Converts this InstancesRotateEntraIdCertificateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesRotateEntraIdCertificateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesRotateEntraIdCertificateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesRotateEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest"; + }; + + return InstancesRotateEntraIdCertificateRequest; + })(); + + v1beta4.InstancesTruncateLogRequest = (function() { + + /** + * Properties of an InstancesTruncateLogRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesTruncateLogRequest + * @property {google.cloud.sql.v1beta4.ITruncateLogContext|null} [truncateLogContext] InstancesTruncateLogRequest truncateLogContext + */ + + /** + * Constructs a new InstancesTruncateLogRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesTruncateLogRequest. + * @implements IInstancesTruncateLogRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest=} [properties] Properties to set + */ + function InstancesTruncateLogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesTruncateLogRequest truncateLogContext. + * @member {google.cloud.sql.v1beta4.ITruncateLogContext|null|undefined} truncateLogContext + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @instance + */ + InstancesTruncateLogRequest.prototype.truncateLogContext = null; + + /** + * Creates a new InstancesTruncateLogRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} InstancesTruncateLogRequest instance + */ + InstancesTruncateLogRequest.create = function create(properties) { + return new InstancesTruncateLogRequest(properties); + }; + + /** + * Encodes the specified InstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesTruncateLogRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest} message InstancesTruncateLogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesTruncateLogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.truncateLogContext != null && Object.hasOwnProperty.call(message, "truncateLogContext")) + $root.google.cloud.sql.v1beta4.TruncateLogContext.encode(message.truncateLogContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesTruncateLogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest} message InstancesTruncateLogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesTruncateLogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} InstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesTruncateLogRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.truncateLogContext = $root.google.cloud.sql.v1beta4.TruncateLogContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} InstancesTruncateLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesTruncateLogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesTruncateLogRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesTruncateLogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.truncateLogContext != null && message.hasOwnProperty("truncateLogContext")) { + var error = $root.google.cloud.sql.v1beta4.TruncateLogContext.verify(message.truncateLogContext); + if (error) + return "truncateLogContext." + error; + } + return null; + }; + + /** + * Creates an InstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} InstancesTruncateLogRequest + */ + InstancesTruncateLogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest(); + if (object.truncateLogContext != null) { + if (typeof object.truncateLogContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesTruncateLogRequest.truncateLogContext: object expected"); + message.truncateLogContext = $root.google.cloud.sql.v1beta4.TruncateLogContext.fromObject(object.truncateLogContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesTruncateLogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} message InstancesTruncateLogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesTruncateLogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.truncateLogContext = null; + if (message.truncateLogContext != null && message.hasOwnProperty("truncateLogContext")) + object.truncateLogContext = $root.google.cloud.sql.v1beta4.TruncateLogContext.toObject(message.truncateLogContext, options); + return object; + }; + + /** + * Converts this InstancesTruncateLogRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesTruncateLogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesTruncateLogRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesTruncateLogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesTruncateLogRequest"; + }; + + return InstancesTruncateLogRequest; + })(); + + v1beta4.InstancesAcquireSsrsLeaseRequest = (function() { + + /** + * Properties of an InstancesAcquireSsrsLeaseRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IInstancesAcquireSsrsLeaseRequest + * @property {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null} [acquireSsrsLeaseContext] InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext + */ + + /** + * Constructs a new InstancesAcquireSsrsLeaseRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InstancesAcquireSsrsLeaseRequest. + * @implements IInstancesAcquireSsrsLeaseRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set + */ + function InstancesAcquireSsrsLeaseRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext. + * @member {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null|undefined} acquireSsrsLeaseContext + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @instance + */ + InstancesAcquireSsrsLeaseRequest.prototype.acquireSsrsLeaseContext = null; + + /** + * Creates a new InstancesAcquireSsrsLeaseRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest instance + */ + InstancesAcquireSsrsLeaseRequest.create = function create(properties) { + return new InstancesAcquireSsrsLeaseRequest(properties); + }; + + /** + * Encodes the specified InstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesAcquireSsrsLeaseRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.acquireSsrsLeaseContext != null && Object.hasOwnProperty.call(message, "acquireSsrsLeaseContext")) + $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.encode(message.acquireSsrsLeaseContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InstancesAcquireSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesAcquireSsrsLeaseRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InstancesAcquireSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InstancesAcquireSsrsLeaseRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InstancesAcquireSsrsLeaseRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) { + var error = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify(message.acquireSsrsLeaseContext); + if (error) + return "acquireSsrsLeaseContext." + error; + } + return null; + }; + + /** + * Creates an InstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest + */ + InstancesAcquireSsrsLeaseRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest(); + if (object.acquireSsrsLeaseContext != null) { + if (typeof object.acquireSsrsLeaseContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.acquireSsrsLeaseContext: object expected"); + message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.fromObject(object.acquireSsrsLeaseContext); + } + return message; + }; + + /** + * Creates a plain object from an InstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @static + * @param {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InstancesAcquireSsrsLeaseRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.acquireSsrsLeaseContext = null; + if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) + object.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.toObject(message.acquireSsrsLeaseContext, options); + return object; + }; + + /** + * Converts this InstancesAcquireSsrsLeaseRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @instance + * @returns {Object.} JSON object + */ + InstancesAcquireSsrsLeaseRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InstancesAcquireSsrsLeaseRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InstancesAcquireSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest"; + }; + + return InstancesAcquireSsrsLeaseRequest; + })(); + + v1beta4.PointInTimeRestoreContext = (function() { + + /** + * Properties of a PointInTimeRestoreContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IPointInTimeRestoreContext + * @property {string|null} [datasource] PointInTimeRestoreContext datasource + * @property {google.protobuf.ITimestamp|null} [pointInTime] PointInTimeRestoreContext pointInTime + * @property {string|null} [targetInstance] PointInTimeRestoreContext targetInstance + * @property {string|null} [privateNetwork] PointInTimeRestoreContext privateNetwork + * @property {string|null} [allocatedIpRange] PointInTimeRestoreContext allocatedIpRange + * @property {string|null} [preferredZone] PointInTimeRestoreContext preferredZone + * @property {string|null} [preferredSecondaryZone] PointInTimeRestoreContext preferredSecondaryZone + */ + + /** + * Constructs a new PointInTimeRestoreContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a PointInTimeRestoreContext. + * @implements IPointInTimeRestoreContext + * @constructor + * @param {google.cloud.sql.v1beta4.IPointInTimeRestoreContext=} [properties] Properties to set + */ + function PointInTimeRestoreContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PointInTimeRestoreContext datasource. + * @member {string|null|undefined} datasource + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.datasource = null; + + /** + * PointInTimeRestoreContext pointInTime. + * @member {google.protobuf.ITimestamp|null|undefined} pointInTime + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.pointInTime = null; + + /** + * PointInTimeRestoreContext targetInstance. + * @member {string|null|undefined} targetInstance + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.targetInstance = null; + + /** + * PointInTimeRestoreContext privateNetwork. + * @member {string|null|undefined} privateNetwork + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.privateNetwork = null; + + /** + * PointInTimeRestoreContext allocatedIpRange. + * @member {string|null|undefined} allocatedIpRange + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.allocatedIpRange = null; + + /** + * PointInTimeRestoreContext preferredZone. + * @member {string|null|undefined} preferredZone + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.preferredZone = null; + + /** + * PointInTimeRestoreContext preferredSecondaryZone. + * @member {string|null|undefined} preferredSecondaryZone + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.preferredSecondaryZone = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_datasource", { + get: $util.oneOfGetter($oneOfFields = ["datasource"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_targetInstance", { + get: $util.oneOfGetter($oneOfFields = ["targetInstance"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_privateNetwork", { + get: $util.oneOfGetter($oneOfFields = ["privateNetwork"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_allocatedIpRange", { + get: $util.oneOfGetter($oneOfFields = ["allocatedIpRange"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_preferredZone", { + get: $util.oneOfGetter($oneOfFields = ["preferredZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_preferredSecondaryZone", { + get: $util.oneOfGetter($oneOfFields = ["preferredSecondaryZone"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PointInTimeRestoreContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @static + * @param {google.cloud.sql.v1beta4.IPointInTimeRestoreContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.PointInTimeRestoreContext} PointInTimeRestoreContext instance + */ + PointInTimeRestoreContext.create = function create(properties) { + return new PointInTimeRestoreContext(properties); + }; + + /** + * Encodes the specified PointInTimeRestoreContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PointInTimeRestoreContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @static + * @param {google.cloud.sql.v1beta4.IPointInTimeRestoreContext} message PointInTimeRestoreContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PointInTimeRestoreContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasource != null && Object.hasOwnProperty.call(message, "datasource")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasource); + if (message.pointInTime != null && Object.hasOwnProperty.call(message, "pointInTime")) + $root.google.protobuf.Timestamp.encode(message.pointInTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.targetInstance != null && Object.hasOwnProperty.call(message, "targetInstance")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetInstance); + if (message.privateNetwork != null && Object.hasOwnProperty.call(message, "privateNetwork")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.privateNetwork); + if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.allocatedIpRange); + if (message.preferredZone != null && Object.hasOwnProperty.call(message, "preferredZone")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.preferredZone); + if (message.preferredSecondaryZone != null && Object.hasOwnProperty.call(message, "preferredSecondaryZone")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.preferredSecondaryZone); + return writer; + }; + + /** + * Encodes the specified PointInTimeRestoreContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PointInTimeRestoreContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @static + * @param {google.cloud.sql.v1beta4.IPointInTimeRestoreContext} message PointInTimeRestoreContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PointInTimeRestoreContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PointInTimeRestoreContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.PointInTimeRestoreContext} PointInTimeRestoreContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PointInTimeRestoreContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.datasource = reader.string(); + break; + } + case 2: { + message.pointInTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.targetInstance = reader.string(); + break; + } + case 4: { + message.privateNetwork = reader.string(); + break; + } + case 5: { + message.allocatedIpRange = reader.string(); + break; + } + case 6: { + message.preferredZone = reader.string(); + break; + } + case 9: { + message.preferredSecondaryZone = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PointInTimeRestoreContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.PointInTimeRestoreContext} PointInTimeRestoreContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PointInTimeRestoreContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PointInTimeRestoreContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PointInTimeRestoreContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.datasource != null && message.hasOwnProperty("datasource")) { + properties._datasource = 1; + if (!$util.isString(message.datasource)) + return "datasource: string expected"; + } + if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.pointInTime); + if (error) + return "pointInTime." + error; + } + if (message.targetInstance != null && message.hasOwnProperty("targetInstance")) { + properties._targetInstance = 1; + if (!$util.isString(message.targetInstance)) + return "targetInstance: string expected"; + } + if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) { + properties._privateNetwork = 1; + if (!$util.isString(message.privateNetwork)) + return "privateNetwork: string expected"; + } + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) { + properties._allocatedIpRange = 1; + if (!$util.isString(message.allocatedIpRange)) + return "allocatedIpRange: string expected"; + } + if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { + properties._preferredZone = 1; + if (!$util.isString(message.preferredZone)) + return "preferredZone: string expected"; + } + if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { + properties._preferredSecondaryZone = 1; + if (!$util.isString(message.preferredSecondaryZone)) + return "preferredSecondaryZone: string expected"; + } + return null; + }; + + /** + * Creates a PointInTimeRestoreContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.PointInTimeRestoreContext} PointInTimeRestoreContext + */ + PointInTimeRestoreContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext(); + if (object.datasource != null) + message.datasource = String(object.datasource); + if (object.pointInTime != null) { + if (typeof object.pointInTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.PointInTimeRestoreContext.pointInTime: object expected"); + message.pointInTime = $root.google.protobuf.Timestamp.fromObject(object.pointInTime); + } + if (object.targetInstance != null) + message.targetInstance = String(object.targetInstance); + if (object.privateNetwork != null) + message.privateNetwork = String(object.privateNetwork); + if (object.allocatedIpRange != null) + message.allocatedIpRange = String(object.allocatedIpRange); + if (object.preferredZone != null) + message.preferredZone = String(object.preferredZone); + if (object.preferredSecondaryZone != null) + message.preferredSecondaryZone = String(object.preferredSecondaryZone); + return message; + }; + + /** + * Creates a plain object from a PointInTimeRestoreContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @static + * @param {google.cloud.sql.v1beta4.PointInTimeRestoreContext} message PointInTimeRestoreContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PointInTimeRestoreContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.pointInTime = null; + if (message.datasource != null && message.hasOwnProperty("datasource")) { + object.datasource = message.datasource; + if (options.oneofs) + object._datasource = "datasource"; + } + if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) + object.pointInTime = $root.google.protobuf.Timestamp.toObject(message.pointInTime, options); + if (message.targetInstance != null && message.hasOwnProperty("targetInstance")) { + object.targetInstance = message.targetInstance; + if (options.oneofs) + object._targetInstance = "targetInstance"; + } + if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) { + object.privateNetwork = message.privateNetwork; + if (options.oneofs) + object._privateNetwork = "privateNetwork"; + } + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) { + object.allocatedIpRange = message.allocatedIpRange; + if (options.oneofs) + object._allocatedIpRange = "allocatedIpRange"; + } + if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { + object.preferredZone = message.preferredZone; + if (options.oneofs) + object._preferredZone = "preferredZone"; + } + if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { + object.preferredSecondaryZone = message.preferredSecondaryZone; + if (options.oneofs) + object._preferredSecondaryZone = "preferredSecondaryZone"; + } + return object; + }; + + /** + * Converts this PointInTimeRestoreContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @instance + * @returns {Object.} JSON object + */ + PointInTimeRestoreContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PointInTimeRestoreContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PointInTimeRestoreContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.PointInTimeRestoreContext"; + }; + + return PointInTimeRestoreContext; + })(); + + v1beta4.PerformDiskShrinkContext = (function() { + + /** + * Properties of a PerformDiskShrinkContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IPerformDiskShrinkContext + * @property {number|Long|null} [targetSizeGb] PerformDiskShrinkContext targetSizeGb + */ + + /** + * Constructs a new PerformDiskShrinkContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a PerformDiskShrinkContext. + * @implements IPerformDiskShrinkContext + * @constructor + * @param {google.cloud.sql.v1beta4.IPerformDiskShrinkContext=} [properties] Properties to set + */ + function PerformDiskShrinkContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PerformDiskShrinkContext targetSizeGb. + * @member {number|Long} targetSizeGb + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @instance + */ + PerformDiskShrinkContext.prototype.targetSizeGb = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new PerformDiskShrinkContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @static + * @param {google.cloud.sql.v1beta4.IPerformDiskShrinkContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.PerformDiskShrinkContext} PerformDiskShrinkContext instance + */ + PerformDiskShrinkContext.create = function create(properties) { + return new PerformDiskShrinkContext(properties); + }; + + /** + * Encodes the specified PerformDiskShrinkContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PerformDiskShrinkContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @static + * @param {google.cloud.sql.v1beta4.IPerformDiskShrinkContext} message PerformDiskShrinkContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformDiskShrinkContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.targetSizeGb != null && Object.hasOwnProperty.call(message, "targetSizeGb")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.targetSizeGb); + return writer; + }; + + /** + * Encodes the specified PerformDiskShrinkContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PerformDiskShrinkContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @static + * @param {google.cloud.sql.v1beta4.IPerformDiskShrinkContext} message PerformDiskShrinkContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformDiskShrinkContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PerformDiskShrinkContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.PerformDiskShrinkContext} PerformDiskShrinkContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformDiskShrinkContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.targetSizeGb = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PerformDiskShrinkContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.PerformDiskShrinkContext} PerformDiskShrinkContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformDiskShrinkContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PerformDiskShrinkContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PerformDiskShrinkContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.targetSizeGb != null && message.hasOwnProperty("targetSizeGb")) + if (!$util.isInteger(message.targetSizeGb) && !(message.targetSizeGb && $util.isInteger(message.targetSizeGb.low) && $util.isInteger(message.targetSizeGb.high))) + return "targetSizeGb: integer|Long expected"; + return null; + }; + + /** + * Creates a PerformDiskShrinkContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.PerformDiskShrinkContext} PerformDiskShrinkContext + */ + PerformDiskShrinkContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext(); + if (object.targetSizeGb != null) + if ($util.Long) + (message.targetSizeGb = $util.Long.fromValue(object.targetSizeGb)).unsigned = false; + else if (typeof object.targetSizeGb === "string") + message.targetSizeGb = parseInt(object.targetSizeGb, 10); + else if (typeof object.targetSizeGb === "number") + message.targetSizeGb = object.targetSizeGb; + else if (typeof object.targetSizeGb === "object") + message.targetSizeGb = new $util.LongBits(object.targetSizeGb.low >>> 0, object.targetSizeGb.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a PerformDiskShrinkContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @static + * @param {google.cloud.sql.v1beta4.PerformDiskShrinkContext} message PerformDiskShrinkContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PerformDiskShrinkContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.targetSizeGb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.targetSizeGb = options.longs === String ? "0" : 0; + if (message.targetSizeGb != null && message.hasOwnProperty("targetSizeGb")) + if (typeof message.targetSizeGb === "number") + object.targetSizeGb = options.longs === String ? String(message.targetSizeGb) : message.targetSizeGb; + else + object.targetSizeGb = options.longs === String ? $util.Long.prototype.toString.call(message.targetSizeGb) : options.longs === Number ? new $util.LongBits(message.targetSizeGb.low >>> 0, message.targetSizeGb.high >>> 0).toNumber() : message.targetSizeGb; + return object; + }; + + /** + * Converts this PerformDiskShrinkContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @instance + * @returns {Object.} JSON object + */ + PerformDiskShrinkContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PerformDiskShrinkContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PerformDiskShrinkContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.PerformDiskShrinkContext"; + }; + + return PerformDiskShrinkContext; + })(); + + v1beta4.PreCheckResponse = (function() { + + /** + * Properties of a PreCheckResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IPreCheckResponse + * @property {string|null} [message] PreCheckResponse message + * @property {google.cloud.sql.v1beta4.PreCheckResponse.MessageType|null} [messageType] PreCheckResponse messageType + * @property {Array.|null} [actionsRequired] PreCheckResponse actionsRequired + */ + + /** + * Constructs a new PreCheckResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a PreCheckResponse. + * @implements IPreCheckResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IPreCheckResponse=} [properties] Properties to set + */ + function PreCheckResponse(properties) { + this.actionsRequired = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PreCheckResponse message. + * @member {string|null|undefined} message + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @instance + */ + PreCheckResponse.prototype.message = null; + + /** + * PreCheckResponse messageType. + * @member {google.cloud.sql.v1beta4.PreCheckResponse.MessageType|null|undefined} messageType + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @instance + */ + PreCheckResponse.prototype.messageType = null; + + /** + * PreCheckResponse actionsRequired. + * @member {Array.} actionsRequired + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @instance + */ + PreCheckResponse.prototype.actionsRequired = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PreCheckResponse.prototype, "_message", { + get: $util.oneOfGetter($oneOfFields = ["message"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PreCheckResponse.prototype, "_messageType", { + get: $util.oneOfGetter($oneOfFields = ["messageType"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PreCheckResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @static + * @param {google.cloud.sql.v1beta4.IPreCheckResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.PreCheckResponse} PreCheckResponse instance + */ + PreCheckResponse.create = function create(properties) { + return new PreCheckResponse(properties); + }; + + /** + * Encodes the specified PreCheckResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @static + * @param {google.cloud.sql.v1beta4.IPreCheckResponse} message PreCheckResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PreCheckResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.messageType != null && Object.hasOwnProperty.call(message, "messageType")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.messageType); + if (message.actionsRequired != null && message.actionsRequired.length) + for (var i = 0; i < message.actionsRequired.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.actionsRequired[i]); + return writer; + }; + + /** + * Encodes the specified PreCheckResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @static + * @param {google.cloud.sql.v1beta4.IPreCheckResponse} message PreCheckResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PreCheckResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PreCheckResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.PreCheckResponse} PreCheckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PreCheckResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PreCheckResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.message = reader.string(); + break; + } + case 3: { + message.messageType = reader.int32(); + break; + } + case 4: { + if (!(message.actionsRequired && message.actionsRequired.length)) + message.actionsRequired = []; + message.actionsRequired.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PreCheckResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.PreCheckResponse} PreCheckResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PreCheckResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PreCheckResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PreCheckResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.message != null && message.hasOwnProperty("message")) { + properties._message = 1; + if (!$util.isString(message.message)) + return "message: string expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + properties._messageType = 1; + switch (message.messageType) { + default: + return "messageType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } + if (message.actionsRequired != null && message.hasOwnProperty("actionsRequired")) { + if (!Array.isArray(message.actionsRequired)) + return "actionsRequired: array expected"; + for (var i = 0; i < message.actionsRequired.length; ++i) + if (!$util.isString(message.actionsRequired[i])) + return "actionsRequired: string[] expected"; + } + return null; + }; + + /** + * Creates a PreCheckResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.PreCheckResponse} PreCheckResponse + */ + PreCheckResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.PreCheckResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.PreCheckResponse(); + if (object.message != null) + message.message = String(object.message); + switch (object.messageType) { + default: + if (typeof object.messageType === "number") { + message.messageType = object.messageType; + break; + } + break; + case "MESSAGE_TYPE_UNSPECIFIED": + case 0: + message.messageType = 0; + break; + case "INFO": + case 1: + message.messageType = 1; + break; + case "WARNING": + case 2: + message.messageType = 2; + break; + case "ERROR": + case 3: + message.messageType = 3; + break; + } + if (object.actionsRequired) { + if (!Array.isArray(object.actionsRequired)) + throw TypeError(".google.cloud.sql.v1beta4.PreCheckResponse.actionsRequired: array expected"); + message.actionsRequired = []; + for (var i = 0; i < object.actionsRequired.length; ++i) + message.actionsRequired[i] = String(object.actionsRequired[i]); + } + return message; + }; + + /** + * Creates a plain object from a PreCheckResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @static + * @param {google.cloud.sql.v1beta4.PreCheckResponse} message PreCheckResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PreCheckResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.actionsRequired = []; + if (message.message != null && message.hasOwnProperty("message")) { + object.message = message.message; + if (options.oneofs) + object._message = "message"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + object.messageType = options.enums === String ? $root.google.cloud.sql.v1beta4.PreCheckResponse.MessageType[message.messageType] === undefined ? message.messageType : $root.google.cloud.sql.v1beta4.PreCheckResponse.MessageType[message.messageType] : message.messageType; + if (options.oneofs) + object._messageType = "messageType"; + } + if (message.actionsRequired && message.actionsRequired.length) { + object.actionsRequired = []; + for (var j = 0; j < message.actionsRequired.length; ++j) + object.actionsRequired[j] = message.actionsRequired[j]; + } + return object; + }; + + /** + * Converts this PreCheckResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @instance + * @returns {Object.} JSON object + */ + PreCheckResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PreCheckResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.PreCheckResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PreCheckResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.PreCheckResponse"; + }; + + /** + * MessageType enum. + * @name google.cloud.sql.v1beta4.PreCheckResponse.MessageType + * @enum {number} + * @property {number} MESSAGE_TYPE_UNSPECIFIED=0 MESSAGE_TYPE_UNSPECIFIED value + * @property {number} INFO=1 INFO value + * @property {number} WARNING=2 WARNING value + * @property {number} ERROR=3 ERROR value + */ + PreCheckResponse.MessageType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INFO"] = 1; + values[valuesById[2] = "WARNING"] = 2; + values[valuesById[3] = "ERROR"] = 3; + return values; + })(); + + return PreCheckResponse; + })(); + + v1beta4.PreCheckMajorVersionUpgradeContext = (function() { + + /** + * Properties of a PreCheckMajorVersionUpgradeContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IPreCheckMajorVersionUpgradeContext + * @property {google.cloud.sql.v1beta4.SqlDatabaseVersion|null} [targetDatabaseVersion] PreCheckMajorVersionUpgradeContext targetDatabaseVersion + * @property {Array.|null} [preCheckResponse] PreCheckMajorVersionUpgradeContext preCheckResponse + * @property {string|null} [kind] PreCheckMajorVersionUpgradeContext kind + */ + + /** + * Constructs a new PreCheckMajorVersionUpgradeContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a PreCheckMajorVersionUpgradeContext. + * @implements IPreCheckMajorVersionUpgradeContext + * @constructor + * @param {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext=} [properties] Properties to set + */ + function PreCheckMajorVersionUpgradeContext(properties) { + this.preCheckResponse = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PreCheckMajorVersionUpgradeContext targetDatabaseVersion. + * @member {google.cloud.sql.v1beta4.SqlDatabaseVersion} targetDatabaseVersion + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @instance + */ + PreCheckMajorVersionUpgradeContext.prototype.targetDatabaseVersion = 0; + + /** + * PreCheckMajorVersionUpgradeContext preCheckResponse. + * @member {Array.} preCheckResponse + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @instance + */ + PreCheckMajorVersionUpgradeContext.prototype.preCheckResponse = $util.emptyArray; + + /** + * PreCheckMajorVersionUpgradeContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @instance + */ + PreCheckMajorVersionUpgradeContext.prototype.kind = ""; + + /** + * Creates a new PreCheckMajorVersionUpgradeContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @static + * @param {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext instance + */ + PreCheckMajorVersionUpgradeContext.create = function create(properties) { + return new PreCheckMajorVersionUpgradeContext(properties); + }; + + /** + * Encodes the specified PreCheckMajorVersionUpgradeContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @static + * @param {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PreCheckMajorVersionUpgradeContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.targetDatabaseVersion != null && Object.hasOwnProperty.call(message, "targetDatabaseVersion")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.targetDatabaseVersion); + if (message.preCheckResponse != null && message.preCheckResponse.length) + for (var i = 0; i < message.preCheckResponse.length; ++i) + $root.google.cloud.sql.v1beta4.PreCheckResponse.encode(message.preCheckResponse[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + return writer; + }; + + /** + * Encodes the specified PreCheckMajorVersionUpgradeContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @static + * @param {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PreCheckMajorVersionUpgradeContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PreCheckMajorVersionUpgradeContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.targetDatabaseVersion = reader.int32(); + break; + } + case 2: { + if (!(message.preCheckResponse && message.preCheckResponse.length)) + message.preCheckResponse = []; + message.preCheckResponse.push($root.google.cloud.sql.v1beta4.PreCheckResponse.decode(reader, reader.uint32())); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PreCheckMajorVersionUpgradeContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PreCheckMajorVersionUpgradeContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PreCheckMajorVersionUpgradeContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.targetDatabaseVersion != null && message.hasOwnProperty("targetDatabaseVersion")) + switch (message.targetDatabaseVersion) { + default: + return "targetDatabaseVersion: enum value expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + break; + } + if (message.preCheckResponse != null && message.hasOwnProperty("preCheckResponse")) { + if (!Array.isArray(message.preCheckResponse)) + return "preCheckResponse: array expected"; + for (var i = 0; i < message.preCheckResponse.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.PreCheckResponse.verify(message.preCheckResponse[i]); + if (error) + return "preCheckResponse." + error; + } + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a PreCheckMajorVersionUpgradeContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext + */ + PreCheckMajorVersionUpgradeContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext(); + switch (object.targetDatabaseVersion) { + default: + if (typeof object.targetDatabaseVersion === "number") { + message.targetDatabaseVersion = object.targetDatabaseVersion; + break; + } + break; + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.targetDatabaseVersion = 0; + break; + case "MYSQL_5_1": + case 2: + message.targetDatabaseVersion = 2; + break; + case "MYSQL_5_5": + case 3: + message.targetDatabaseVersion = 3; + break; + case "MYSQL_5_6": + case 5: + message.targetDatabaseVersion = 5; + break; + case "MYSQL_5_7": + case 6: + message.targetDatabaseVersion = 6; + break; + case "MYSQL_8_0": + case 20: + message.targetDatabaseVersion = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.targetDatabaseVersion = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.targetDatabaseVersion = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.targetDatabaseVersion = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.targetDatabaseVersion = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.targetDatabaseVersion = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.targetDatabaseVersion = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.targetDatabaseVersion = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.targetDatabaseVersion = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.targetDatabaseVersion = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.targetDatabaseVersion = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.targetDatabaseVersion = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.targetDatabaseVersion = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.targetDatabaseVersion = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.targetDatabaseVersion = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.targetDatabaseVersion = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.targetDatabaseVersion = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.targetDatabaseVersion = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.targetDatabaseVersion = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.targetDatabaseVersion = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.targetDatabaseVersion = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.targetDatabaseVersion = 556; + break; + case "MYSQL_8_4": + case 398: + message.targetDatabaseVersion = 398; + break; + case "MYSQL_9_7": + case 654: + message.targetDatabaseVersion = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.targetDatabaseVersion = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.targetDatabaseVersion = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.targetDatabaseVersion = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.targetDatabaseVersion = 16; + break; + case "POSTGRES_9_6": + case 9: + message.targetDatabaseVersion = 9; + break; + case "POSTGRES_10": + case 18: + message.targetDatabaseVersion = 18; + break; + case "POSTGRES_11": + case 10: + message.targetDatabaseVersion = 10; + break; + case "POSTGRES_12": + case 19: + message.targetDatabaseVersion = 19; + break; + case "POSTGRES_13": + case 23: + message.targetDatabaseVersion = 23; + break; + case "POSTGRES_14": + case 110: + message.targetDatabaseVersion = 110; + break; + case "POSTGRES_15": + case 172: + message.targetDatabaseVersion = 172; + break; + case "POSTGRES_16": + case 272: + message.targetDatabaseVersion = 272; + break; + case "POSTGRES_17": + case 408: + message.targetDatabaseVersion = 408; + break; + case "POSTGRES_18": + case 557: + message.targetDatabaseVersion = 557; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.targetDatabaseVersion = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.targetDatabaseVersion = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.targetDatabaseVersion = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.targetDatabaseVersion = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.targetDatabaseVersion = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.targetDatabaseVersion = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.targetDatabaseVersion = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.targetDatabaseVersion = 202; + break; + } + if (object.preCheckResponse) { + if (!Array.isArray(object.preCheckResponse)) + throw TypeError(".google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.preCheckResponse: array expected"); + message.preCheckResponse = []; + for (var i = 0; i < object.preCheckResponse.length; ++i) { + if (typeof object.preCheckResponse[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.preCheckResponse: object expected"); + message.preCheckResponse[i] = $root.google.cloud.sql.v1beta4.PreCheckResponse.fromObject(object.preCheckResponse[i]); + } + } + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a PreCheckMajorVersionUpgradeContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @static + * @param {google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PreCheckMajorVersionUpgradeContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.preCheckResponse = []; + if (options.defaults) { + object.targetDatabaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; + object.kind = ""; + } + if (message.targetDatabaseVersion != null && message.hasOwnProperty("targetDatabaseVersion")) + object.targetDatabaseVersion = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.targetDatabaseVersion] === undefined ? message.targetDatabaseVersion : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.targetDatabaseVersion] : message.targetDatabaseVersion; + if (message.preCheckResponse && message.preCheckResponse.length) { + object.preCheckResponse = []; + for (var j = 0; j < message.preCheckResponse.length; ++j) + object.preCheckResponse[j] = $root.google.cloud.sql.v1beta4.PreCheckResponse.toObject(message.preCheckResponse[j], options); + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this PreCheckMajorVersionUpgradeContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @instance + * @returns {Object.} JSON object + */ + PreCheckMajorVersionUpgradeContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PreCheckMajorVersionUpgradeContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PreCheckMajorVersionUpgradeContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext"; + }; + + return PreCheckMajorVersionUpgradeContext; + })(); + + v1beta4.SqlInstancesGetDiskShrinkConfigResponse = (function() { + + /** + * Properties of a SqlInstancesGetDiskShrinkConfigResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesGetDiskShrinkConfigResponse + * @property {string|null} [kind] SqlInstancesGetDiskShrinkConfigResponse kind + * @property {number|Long|null} [minimalTargetSizeGb] SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb + * @property {string|null} [message] SqlInstancesGetDiskShrinkConfigResponse message + */ + + /** + * Constructs a new SqlInstancesGetDiskShrinkConfigResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesGetDiskShrinkConfigResponse. + * @implements ISqlInstancesGetDiskShrinkConfigResponse + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse=} [properties] Properties to set + */ + function SqlInstancesGetDiskShrinkConfigResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesGetDiskShrinkConfigResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @instance + */ + SqlInstancesGetDiskShrinkConfigResponse.prototype.kind = ""; + + /** + * SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb. + * @member {number|Long} minimalTargetSizeGb + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @instance + */ + SqlInstancesGetDiskShrinkConfigResponse.prototype.minimalTargetSizeGb = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * SqlInstancesGetDiskShrinkConfigResponse message. + * @member {string} message + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @instance + */ + SqlInstancesGetDiskShrinkConfigResponse.prototype.message = ""; + + /** + * Creates a new SqlInstancesGetDiskShrinkConfigResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse instance + */ + SqlInstancesGetDiskShrinkConfigResponse.create = function create(properties) { + return new SqlInstancesGetDiskShrinkConfigResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetDiskShrinkConfigResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.minimalTargetSizeGb != null && Object.hasOwnProperty.call(message, "minimalTargetSizeGb")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.minimalTargetSizeGb); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + return writer; + }; + + /** + * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesGetDiskShrinkConfigResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetDiskShrinkConfigResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.minimalTargetSizeGb = reader.int64(); + break; + } + case 3: { + message.message = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesGetDiskShrinkConfigResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesGetDiskShrinkConfigResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesGetDiskShrinkConfigResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.minimalTargetSizeGb != null && message.hasOwnProperty("minimalTargetSizeGb")) + if (!$util.isInteger(message.minimalTargetSizeGb) && !(message.minimalTargetSizeGb && $util.isInteger(message.minimalTargetSizeGb.low) && $util.isInteger(message.minimalTargetSizeGb.high))) + return "minimalTargetSizeGb: integer|Long expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates a SqlInstancesGetDiskShrinkConfigResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse + */ + SqlInstancesGetDiskShrinkConfigResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.minimalTargetSizeGb != null) + if ($util.Long) + (message.minimalTargetSizeGb = $util.Long.fromValue(object.minimalTargetSizeGb)).unsigned = false; + else if (typeof object.minimalTargetSizeGb === "string") + message.minimalTargetSizeGb = parseInt(object.minimalTargetSizeGb, 10); + else if (typeof object.minimalTargetSizeGb === "number") + message.minimalTargetSizeGb = object.minimalTargetSizeGb; + else if (typeof object.minimalTargetSizeGb === "object") + message.minimalTargetSizeGb = new $util.LongBits(object.minimalTargetSizeGb.low >>> 0, object.minimalTargetSizeGb.high >>> 0).toNumber(); + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from a SqlInstancesGetDiskShrinkConfigResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesGetDiskShrinkConfigResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.minimalTargetSizeGb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.minimalTargetSizeGb = options.longs === String ? "0" : 0; + object.message = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.minimalTargetSizeGb != null && message.hasOwnProperty("minimalTargetSizeGb")) + if (typeof message.minimalTargetSizeGb === "number") + object.minimalTargetSizeGb = options.longs === String ? String(message.minimalTargetSizeGb) : message.minimalTargetSizeGb; + else + object.minimalTargetSizeGb = options.longs === String ? $util.Long.prototype.toString.call(message.minimalTargetSizeGb) : options.longs === Number ? new $util.LongBits(message.minimalTargetSizeGb.low >>> 0, message.minimalTargetSizeGb.high >>> 0).toNumber() : message.minimalTargetSizeGb; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this SqlInstancesGetDiskShrinkConfigResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesGetDiskShrinkConfigResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesGetDiskShrinkConfigResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesGetDiskShrinkConfigResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse"; + }; + + return SqlInstancesGetDiskShrinkConfigResponse; + })(); + + v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse = (function() { + + /** + * Properties of a SqlInstancesVerifyExternalSyncSettingsResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesVerifyExternalSyncSettingsResponse + * @property {string|null} [kind] SqlInstancesVerifyExternalSyncSettingsResponse kind + * @property {Array.|null} [errors] SqlInstancesVerifyExternalSyncSettingsResponse errors + * @property {Array.|null} [warnings] SqlInstancesVerifyExternalSyncSettingsResponse warnings + */ + + /** + * Constructs a new SqlInstancesVerifyExternalSyncSettingsResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesVerifyExternalSyncSettingsResponse. + * @implements ISqlInstancesVerifyExternalSyncSettingsResponse + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse=} [properties] Properties to set + */ + function SqlInstancesVerifyExternalSyncSettingsResponse(properties) { + this.errors = []; + this.warnings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesVerifyExternalSyncSettingsResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsResponse.prototype.kind = ""; + + /** + * SqlInstancesVerifyExternalSyncSettingsResponse errors. + * @member {Array.} errors + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsResponse.prototype.errors = $util.emptyArray; + + /** + * SqlInstancesVerifyExternalSyncSettingsResponse warnings. + * @member {Array.} warnings + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @instance + */ + SqlInstancesVerifyExternalSyncSettingsResponse.prototype.warnings = $util.emptyArray; + + /** + * Creates a new SqlInstancesVerifyExternalSyncSettingsResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse instance + */ + SqlInstancesVerifyExternalSyncSettingsResponse.create = function create(properties) { + return new SqlInstancesVerifyExternalSyncSettingsResponse(properties); + }; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesVerifyExternalSyncSettingsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.errors != null && message.errors.length) + for (var i = 0; i < message.errors.length; ++i) + $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.encode(message.errors[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.warnings != null && message.warnings.length) + for (var i = 0; i < message.warnings.length; ++i) + $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.encode(message.warnings[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesVerifyExternalSyncSettingsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesVerifyExternalSyncSettingsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.errors && message.errors.length)) + message.errors = []; + message.errors.push($root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.warnings && message.warnings.length)) + message.warnings = []; + message.warnings.push($root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesVerifyExternalSyncSettingsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesVerifyExternalSyncSettingsResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesVerifyExternalSyncSettingsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.errors != null && message.hasOwnProperty("errors")) { + if (!Array.isArray(message.errors)) + return "errors: array expected"; + for (var i = 0; i < message.errors.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify(message.errors[i]); + if (error) + return "errors." + error; + } + } + if (message.warnings != null && message.hasOwnProperty("warnings")) { + if (!Array.isArray(message.warnings)) + return "warnings: array expected"; + for (var i = 0; i < message.warnings.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify(message.warnings[i]); + if (error) + return "warnings." + error; + } + } + return null; + }; + + /** + * Creates a SqlInstancesVerifyExternalSyncSettingsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse + */ + SqlInstancesVerifyExternalSyncSettingsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.errors) { + if (!Array.isArray(object.errors)) + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.errors: array expected"); + message.errors = []; + for (var i = 0; i < object.errors.length; ++i) { + if (typeof object.errors[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.errors: object expected"); + message.errors[i] = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.fromObject(object.errors[i]); + } + } + if (object.warnings) { + if (!Array.isArray(object.warnings)) + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.warnings: array expected"); + message.warnings = []; + for (var i = 0; i < object.warnings.length; ++i) { + if (typeof object.warnings[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.warnings: object expected"); + message.warnings[i] = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.fromObject(object.warnings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesVerifyExternalSyncSettingsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.errors = []; + object.warnings = []; + } + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.errors && message.errors.length) { + object.errors = []; + for (var j = 0; j < message.errors.length; ++j) + object.errors[j] = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.toObject(message.errors[j], options); + } + if (message.warnings && message.warnings.length) { + object.warnings = []; + for (var j = 0; j < message.warnings.length; ++j) + object.warnings[j] = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.toObject(message.warnings[j], options); + } + return object; + }; + + /** + * Converts this SqlInstancesVerifyExternalSyncSettingsResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesVerifyExternalSyncSettingsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesVerifyExternalSyncSettingsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse"; + }; + + return SqlInstancesVerifyExternalSyncSettingsResponse; + })(); + + v1beta4.SqlExternalSyncSettingError = (function() { + + /** + * Properties of a SqlExternalSyncSettingError. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlExternalSyncSettingError + * @property {string|null} [kind] SqlExternalSyncSettingError kind + * @property {google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|null} [type] SqlExternalSyncSettingError type + * @property {string|null} [detail] SqlExternalSyncSettingError detail + */ + + /** + * Constructs a new SqlExternalSyncSettingError. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlExternalSyncSettingError. + * @implements ISqlExternalSyncSettingError + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlExternalSyncSettingError=} [properties] Properties to set + */ + function SqlExternalSyncSettingError(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlExternalSyncSettingError kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @instance + */ + SqlExternalSyncSettingError.prototype.kind = ""; + + /** + * SqlExternalSyncSettingError type. + * @member {google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType} type + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @instance + */ + SqlExternalSyncSettingError.prototype.type = 0; + + /** + * SqlExternalSyncSettingError detail. + * @member {string} detail + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @instance + */ + SqlExternalSyncSettingError.prototype.detail = ""; + + /** + * Creates a new SqlExternalSyncSettingError instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @static + * @param {google.cloud.sql.v1beta4.ISqlExternalSyncSettingError=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlExternalSyncSettingError} SqlExternalSyncSettingError instance + */ + SqlExternalSyncSettingError.create = function create(properties) { + return new SqlExternalSyncSettingError(properties); + }; + + /** + * Encodes the specified SqlExternalSyncSettingError message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @static + * @param {google.cloud.sql.v1beta4.ISqlExternalSyncSettingError} message SqlExternalSyncSettingError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlExternalSyncSettingError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.detail != null && Object.hasOwnProperty.call(message, "detail")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.detail); + return writer; + }; + + /** + * Encodes the specified SqlExternalSyncSettingError message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @static + * @param {google.cloud.sql.v1beta4.ISqlExternalSyncSettingError} message SqlExternalSyncSettingError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlExternalSyncSettingError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlExternalSyncSettingError} SqlExternalSyncSettingError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlExternalSyncSettingError.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + message.detail = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlExternalSyncSettingError} SqlExternalSyncSettingError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlExternalSyncSettingError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlExternalSyncSettingError message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlExternalSyncSettingError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + break; + } + if (message.detail != null && message.hasOwnProperty("detail")) + if (!$util.isString(message.detail)) + return "detail: string expected"; + return null; + }; + + /** + * Creates a SqlExternalSyncSettingError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlExternalSyncSettingError} SqlExternalSyncSettingError + */ + SqlExternalSyncSettingError.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError(); + if (object.kind != null) + message.kind = String(object.kind); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "CONNECTION_FAILURE": + case 1: + message.type = 1; + break; + case "BINLOG_NOT_ENABLED": + case 2: + message.type = 2; + break; + case "INCOMPATIBLE_DATABASE_VERSION": + case 3: + message.type = 3; + break; + case "REPLICA_ALREADY_SETUP": + case 4: + message.type = 4; + break; + case "INSUFFICIENT_PRIVILEGE": + case 5: + message.type = 5; + break; + case "UNSUPPORTED_MIGRATION_TYPE": + case 6: + message.type = 6; + break; + case "NO_PGLOGICAL_INSTALLED": + case 7: + message.type = 7; + break; + case "PGLOGICAL_NODE_ALREADY_EXISTS": + case 8: + message.type = 8; + break; + case "INVALID_WAL_LEVEL": + case 9: + message.type = 9; + break; + case "INVALID_SHARED_PRELOAD_LIBRARY": + case 10: + message.type = 10; + break; + case "INSUFFICIENT_MAX_REPLICATION_SLOTS": + case 11: + message.type = 11; + break; + case "INSUFFICIENT_MAX_WAL_SENDERS": + case 12: + message.type = 12; + break; + case "INSUFFICIENT_MAX_WORKER_PROCESSES": + case 13: + message.type = 13; + break; + case "UNSUPPORTED_EXTENSIONS": + case 14: + message.type = 14; + break; + case "INVALID_RDS_LOGICAL_REPLICATION": + case 15: + message.type = 15; + break; + case "INVALID_LOGGING_SETUP": + case 16: + message.type = 16; + break; + case "INVALID_DB_PARAM": + case 17: + message.type = 17; + break; + case "UNSUPPORTED_GTID_MODE": + case 18: + message.type = 18; + break; + case "SQLSERVER_AGENT_NOT_RUNNING": + case 19: + message.type = 19; + break; + case "UNSUPPORTED_TABLE_DEFINITION": + case 20: + message.type = 20; + break; + case "UNSUPPORTED_DEFINER": + case 21: + message.type = 21; + break; + case "SQLSERVER_SERVERNAME_MISMATCH": + case 22: + message.type = 22; + break; + case "PRIMARY_ALREADY_SETUP": + case 23: + message.type = 23; + break; + case "UNSUPPORTED_BINLOG_FORMAT": + case 24: + message.type = 24; + break; + case "BINLOG_RETENTION_SETTING": + case 25: + message.type = 25; + break; + case "UNSUPPORTED_STORAGE_ENGINE": + case 26: + message.type = 26; + break; + case "LIMITED_SUPPORT_TABLES": + case 27: + message.type = 27; + break; + case "EXISTING_DATA_IN_REPLICA": + case 28: + message.type = 28; + break; + case "MISSING_OPTIONAL_PRIVILEGES": + case 29: + message.type = 29; + break; + case "RISKY_BACKUP_ADMIN_PRIVILEGE": + case 30: + message.type = 30; + break; + case "INSUFFICIENT_GCS_PERMISSIONS": + case 31: + message.type = 31; + break; + case "INVALID_FILE_INFO": + case 32: + message.type = 32; + break; + case "UNSUPPORTED_DATABASE_SETTINGS": + case 33: + message.type = 33; + break; + case "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE": + case 34: + message.type = 34; + break; + case "LOCAL_INFILE_OFF": + case 35: + message.type = 35; + break; + case "TURN_ON_PITR_AFTER_PROMOTE": + case 36: + message.type = 36; + break; + case "INCOMPATIBLE_DATABASE_MINOR_VERSION": + case 37: + message.type = 37; + break; + case "SOURCE_MAX_SUBSCRIPTIONS": + case 38: + message.type = 38; + break; + case "UNABLE_TO_VERIFY_DEFINERS": + case 39: + message.type = 39; + break; + case "SUBSCRIPTION_CALCULATION_STATUS": + case 40: + message.type = 40; + break; + case "PG_SUBSCRIPTION_COUNT": + case 41: + message.type = 41; + break; + case "PG_SYNC_PARALLEL_LEVEL": + case 42: + message.type = 42; + break; + case "INSUFFICIENT_DISK_SIZE": + case 43: + message.type = 43; + break; + case "INSUFFICIENT_MACHINE_TIER": + case 44: + message.type = 44; + break; + case "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED": + case 45: + message.type = 45; + break; + case "EXTENSIONS_NOT_MIGRATED": + case 46: + message.type = 46; + break; + case "PG_CRON_FLAG_ENABLED_IN_REPLICA": + case 47: + message.type = 47; + break; + case "EXTENSIONS_NOT_ENABLED_IN_REPLICA": + case 48: + message.type = 48; + break; + case "UNSUPPORTED_COLUMNS": + case 49: + message.type = 49; + break; + case "USERS_NOT_CREATED_IN_REPLICA": + case 50: + message.type = 50; + break; + case "UNSUPPORTED_SYSTEM_OBJECTS": + case 51: + message.type = 51; + break; + case "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY": + case 52: + message.type = 52; + break; + case "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE": + case 53: + message.type = 53; + break; + case "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI": + case 54: + message.type = 54; + break; + case "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS": + case 55: + message.type = 55; + break; + case "PROMPT_DELETE_EXISTING": + case 56: + message.type = 56; + break; + case "WILL_DELETE_EXISTING": + case 57: + message.type = 57; + break; + case "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE": + case 58: + message.type = 58; + break; + } + if (object.detail != null) + message.detail = String(object.detail); + return message; + }; + + /** + * Creates a plain object from a SqlExternalSyncSettingError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @static + * @param {google.cloud.sql.v1beta4.SqlExternalSyncSettingError} message SqlExternalSyncSettingError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlExternalSyncSettingError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.type = options.enums === String ? "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED" : 0; + object.detail = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType[message.type] : message.type; + if (message.detail != null && message.hasOwnProperty("detail")) + object.detail = message.detail; + return object; + }; + + /** + * Converts this SqlExternalSyncSettingError to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @instance + * @returns {Object.} JSON object + */ + SqlExternalSyncSettingError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlExternalSyncSettingError + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlExternalSyncSettingError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlExternalSyncSettingError"; + }; + + /** + * SqlExternalSyncSettingErrorType enum. + * @name google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType + * @enum {number} + * @property {number} SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED=0 SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED value + * @property {number} CONNECTION_FAILURE=1 CONNECTION_FAILURE value + * @property {number} BINLOG_NOT_ENABLED=2 BINLOG_NOT_ENABLED value + * @property {number} INCOMPATIBLE_DATABASE_VERSION=3 INCOMPATIBLE_DATABASE_VERSION value + * @property {number} REPLICA_ALREADY_SETUP=4 REPLICA_ALREADY_SETUP value + * @property {number} INSUFFICIENT_PRIVILEGE=5 INSUFFICIENT_PRIVILEGE value + * @property {number} UNSUPPORTED_MIGRATION_TYPE=6 UNSUPPORTED_MIGRATION_TYPE value + * @property {number} NO_PGLOGICAL_INSTALLED=7 NO_PGLOGICAL_INSTALLED value + * @property {number} PGLOGICAL_NODE_ALREADY_EXISTS=8 PGLOGICAL_NODE_ALREADY_EXISTS value + * @property {number} INVALID_WAL_LEVEL=9 INVALID_WAL_LEVEL value + * @property {number} INVALID_SHARED_PRELOAD_LIBRARY=10 INVALID_SHARED_PRELOAD_LIBRARY value + * @property {number} INSUFFICIENT_MAX_REPLICATION_SLOTS=11 INSUFFICIENT_MAX_REPLICATION_SLOTS value + * @property {number} INSUFFICIENT_MAX_WAL_SENDERS=12 INSUFFICIENT_MAX_WAL_SENDERS value + * @property {number} INSUFFICIENT_MAX_WORKER_PROCESSES=13 INSUFFICIENT_MAX_WORKER_PROCESSES value + * @property {number} UNSUPPORTED_EXTENSIONS=14 UNSUPPORTED_EXTENSIONS value + * @property {number} INVALID_RDS_LOGICAL_REPLICATION=15 INVALID_RDS_LOGICAL_REPLICATION value + * @property {number} INVALID_LOGGING_SETUP=16 INVALID_LOGGING_SETUP value + * @property {number} INVALID_DB_PARAM=17 INVALID_DB_PARAM value + * @property {number} UNSUPPORTED_GTID_MODE=18 UNSUPPORTED_GTID_MODE value + * @property {number} SQLSERVER_AGENT_NOT_RUNNING=19 SQLSERVER_AGENT_NOT_RUNNING value + * @property {number} UNSUPPORTED_TABLE_DEFINITION=20 UNSUPPORTED_TABLE_DEFINITION value + * @property {number} UNSUPPORTED_DEFINER=21 UNSUPPORTED_DEFINER value + * @property {number} SQLSERVER_SERVERNAME_MISMATCH=22 SQLSERVER_SERVERNAME_MISMATCH value + * @property {number} PRIMARY_ALREADY_SETUP=23 PRIMARY_ALREADY_SETUP value + * @property {number} UNSUPPORTED_BINLOG_FORMAT=24 UNSUPPORTED_BINLOG_FORMAT value + * @property {number} BINLOG_RETENTION_SETTING=25 BINLOG_RETENTION_SETTING value + * @property {number} UNSUPPORTED_STORAGE_ENGINE=26 UNSUPPORTED_STORAGE_ENGINE value + * @property {number} LIMITED_SUPPORT_TABLES=27 LIMITED_SUPPORT_TABLES value + * @property {number} EXISTING_DATA_IN_REPLICA=28 EXISTING_DATA_IN_REPLICA value + * @property {number} MISSING_OPTIONAL_PRIVILEGES=29 MISSING_OPTIONAL_PRIVILEGES value + * @property {number} RISKY_BACKUP_ADMIN_PRIVILEGE=30 RISKY_BACKUP_ADMIN_PRIVILEGE value + * @property {number} INSUFFICIENT_GCS_PERMISSIONS=31 INSUFFICIENT_GCS_PERMISSIONS value + * @property {number} INVALID_FILE_INFO=32 INVALID_FILE_INFO value + * @property {number} UNSUPPORTED_DATABASE_SETTINGS=33 UNSUPPORTED_DATABASE_SETTINGS value + * @property {number} MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE=34 MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE value + * @property {number} LOCAL_INFILE_OFF=35 LOCAL_INFILE_OFF value + * @property {number} TURN_ON_PITR_AFTER_PROMOTE=36 TURN_ON_PITR_AFTER_PROMOTE value + * @property {number} INCOMPATIBLE_DATABASE_MINOR_VERSION=37 INCOMPATIBLE_DATABASE_MINOR_VERSION value + * @property {number} SOURCE_MAX_SUBSCRIPTIONS=38 SOURCE_MAX_SUBSCRIPTIONS value + * @property {number} UNABLE_TO_VERIFY_DEFINERS=39 UNABLE_TO_VERIFY_DEFINERS value + * @property {number} SUBSCRIPTION_CALCULATION_STATUS=40 SUBSCRIPTION_CALCULATION_STATUS value + * @property {number} PG_SUBSCRIPTION_COUNT=41 PG_SUBSCRIPTION_COUNT value + * @property {number} PG_SYNC_PARALLEL_LEVEL=42 PG_SYNC_PARALLEL_LEVEL value + * @property {number} INSUFFICIENT_DISK_SIZE=43 INSUFFICIENT_DISK_SIZE value + * @property {number} INSUFFICIENT_MACHINE_TIER=44 INSUFFICIENT_MACHINE_TIER value + * @property {number} UNSUPPORTED_EXTENSIONS_NOT_MIGRATED=45 UNSUPPORTED_EXTENSIONS_NOT_MIGRATED value + * @property {number} EXTENSIONS_NOT_MIGRATED=46 EXTENSIONS_NOT_MIGRATED value + * @property {number} PG_CRON_FLAG_ENABLED_IN_REPLICA=47 PG_CRON_FLAG_ENABLED_IN_REPLICA value + * @property {number} EXTENSIONS_NOT_ENABLED_IN_REPLICA=48 EXTENSIONS_NOT_ENABLED_IN_REPLICA value + * @property {number} UNSUPPORTED_COLUMNS=49 UNSUPPORTED_COLUMNS value + * @property {number} USERS_NOT_CREATED_IN_REPLICA=50 USERS_NOT_CREATED_IN_REPLICA value + * @property {number} UNSUPPORTED_SYSTEM_OBJECTS=51 UNSUPPORTED_SYSTEM_OBJECTS value + * @property {number} UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY=52 UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY value + * @property {number} SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE=53 SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE value + * @property {number} PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI=54 PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI value + * @property {number} SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS=55 SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS value + * @property {number} PROMPT_DELETE_EXISTING=56 PROMPT_DELETE_EXISTING value + * @property {number} WILL_DELETE_EXISTING=57 WILL_DELETE_EXISTING value + * @property {number} PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE=58 PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE value + */ + SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CONNECTION_FAILURE"] = 1; + values[valuesById[2] = "BINLOG_NOT_ENABLED"] = 2; + values[valuesById[3] = "INCOMPATIBLE_DATABASE_VERSION"] = 3; + values[valuesById[4] = "REPLICA_ALREADY_SETUP"] = 4; + values[valuesById[5] = "INSUFFICIENT_PRIVILEGE"] = 5; + values[valuesById[6] = "UNSUPPORTED_MIGRATION_TYPE"] = 6; + values[valuesById[7] = "NO_PGLOGICAL_INSTALLED"] = 7; + values[valuesById[8] = "PGLOGICAL_NODE_ALREADY_EXISTS"] = 8; + values[valuesById[9] = "INVALID_WAL_LEVEL"] = 9; + values[valuesById[10] = "INVALID_SHARED_PRELOAD_LIBRARY"] = 10; + values[valuesById[11] = "INSUFFICIENT_MAX_REPLICATION_SLOTS"] = 11; + values[valuesById[12] = "INSUFFICIENT_MAX_WAL_SENDERS"] = 12; + values[valuesById[13] = "INSUFFICIENT_MAX_WORKER_PROCESSES"] = 13; + values[valuesById[14] = "UNSUPPORTED_EXTENSIONS"] = 14; + values[valuesById[15] = "INVALID_RDS_LOGICAL_REPLICATION"] = 15; + values[valuesById[16] = "INVALID_LOGGING_SETUP"] = 16; + values[valuesById[17] = "INVALID_DB_PARAM"] = 17; + values[valuesById[18] = "UNSUPPORTED_GTID_MODE"] = 18; + values[valuesById[19] = "SQLSERVER_AGENT_NOT_RUNNING"] = 19; + values[valuesById[20] = "UNSUPPORTED_TABLE_DEFINITION"] = 20; + values[valuesById[21] = "UNSUPPORTED_DEFINER"] = 21; + values[valuesById[22] = "SQLSERVER_SERVERNAME_MISMATCH"] = 22; + values[valuesById[23] = "PRIMARY_ALREADY_SETUP"] = 23; + values[valuesById[24] = "UNSUPPORTED_BINLOG_FORMAT"] = 24; + values[valuesById[25] = "BINLOG_RETENTION_SETTING"] = 25; + values[valuesById[26] = "UNSUPPORTED_STORAGE_ENGINE"] = 26; + values[valuesById[27] = "LIMITED_SUPPORT_TABLES"] = 27; + values[valuesById[28] = "EXISTING_DATA_IN_REPLICA"] = 28; + values[valuesById[29] = "MISSING_OPTIONAL_PRIVILEGES"] = 29; + values[valuesById[30] = "RISKY_BACKUP_ADMIN_PRIVILEGE"] = 30; + values[valuesById[31] = "INSUFFICIENT_GCS_PERMISSIONS"] = 31; + values[valuesById[32] = "INVALID_FILE_INFO"] = 32; + values[valuesById[33] = "UNSUPPORTED_DATABASE_SETTINGS"] = 33; + values[valuesById[34] = "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE"] = 34; + values[valuesById[35] = "LOCAL_INFILE_OFF"] = 35; + values[valuesById[36] = "TURN_ON_PITR_AFTER_PROMOTE"] = 36; + values[valuesById[37] = "INCOMPATIBLE_DATABASE_MINOR_VERSION"] = 37; + values[valuesById[38] = "SOURCE_MAX_SUBSCRIPTIONS"] = 38; + values[valuesById[39] = "UNABLE_TO_VERIFY_DEFINERS"] = 39; + values[valuesById[40] = "SUBSCRIPTION_CALCULATION_STATUS"] = 40; + values[valuesById[41] = "PG_SUBSCRIPTION_COUNT"] = 41; + values[valuesById[42] = "PG_SYNC_PARALLEL_LEVEL"] = 42; + values[valuesById[43] = "INSUFFICIENT_DISK_SIZE"] = 43; + values[valuesById[44] = "INSUFFICIENT_MACHINE_TIER"] = 44; + values[valuesById[45] = "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED"] = 45; + values[valuesById[46] = "EXTENSIONS_NOT_MIGRATED"] = 46; + values[valuesById[47] = "PG_CRON_FLAG_ENABLED_IN_REPLICA"] = 47; + values[valuesById[48] = "EXTENSIONS_NOT_ENABLED_IN_REPLICA"] = 48; + values[valuesById[49] = "UNSUPPORTED_COLUMNS"] = 49; + values[valuesById[50] = "USERS_NOT_CREATED_IN_REPLICA"] = 50; + values[valuesById[51] = "UNSUPPORTED_SYSTEM_OBJECTS"] = 51; + values[valuesById[52] = "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY"] = 52; + values[valuesById[53] = "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE"] = 53; + values[valuesById[54] = "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI"] = 54; + values[valuesById[55] = "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS"] = 55; + values[valuesById[56] = "PROMPT_DELETE_EXISTING"] = 56; + values[valuesById[57] = "WILL_DELETE_EXISTING"] = 57; + values[valuesById[58] = "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE"] = 58; + return values; + })(); + + return SqlExternalSyncSettingError; + })(); + + v1beta4.IpConfiguration = (function() { + + /** + * Properties of an IpConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @interface IIpConfiguration + * @property {google.protobuf.IBoolValue|null} [ipv4Enabled] IpConfiguration ipv4Enabled + * @property {string|null} [privateNetwork] IpConfiguration privateNetwork + * @property {google.protobuf.IBoolValue|null} [requireSsl] IpConfiguration requireSsl + * @property {Array.|null} [authorizedNetworks] IpConfiguration authorizedNetworks + * @property {string|null} [allocatedIpRange] IpConfiguration allocatedIpRange + * @property {google.protobuf.IBoolValue|null} [enablePrivatePathForGoogleCloudServices] IpConfiguration enablePrivatePathForGoogleCloudServices + * @property {google.cloud.sql.v1beta4.IpConfiguration.SslMode|null} [sslMode] IpConfiguration sslMode + * @property {google.cloud.sql.v1beta4.IPscConfig|null} [pscConfig] IpConfiguration pscConfig + * @property {google.cloud.sql.v1beta4.IpConfiguration.CaMode|null} [serverCaMode] IpConfiguration serverCaMode + * @property {Array.|null} [customSubjectAlternativeNames] IpConfiguration customSubjectAlternativeNames + * @property {string|null} [serverCaPool] IpConfiguration serverCaPool + * @property {google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|null} [serverCertificateRotationMode] IpConfiguration serverCertificateRotationMode + */ + + /** + * Constructs a new IpConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an IpConfiguration. + * @implements IIpConfiguration + * @constructor + * @param {google.cloud.sql.v1beta4.IIpConfiguration=} [properties] Properties to set + */ + function IpConfiguration(properties) { + this.authorizedNetworks = []; + this.customSubjectAlternativeNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IpConfiguration ipv4Enabled. + * @member {google.protobuf.IBoolValue|null|undefined} ipv4Enabled + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.ipv4Enabled = null; + + /** + * IpConfiguration privateNetwork. + * @member {string} privateNetwork + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.privateNetwork = ""; + + /** + * IpConfiguration requireSsl. + * @member {google.protobuf.IBoolValue|null|undefined} requireSsl + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.requireSsl = null; + + /** + * IpConfiguration authorizedNetworks. + * @member {Array.} authorizedNetworks + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.authorizedNetworks = $util.emptyArray; + + /** + * IpConfiguration allocatedIpRange. + * @member {string} allocatedIpRange + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.allocatedIpRange = ""; + + /** + * IpConfiguration enablePrivatePathForGoogleCloudServices. + * @member {google.protobuf.IBoolValue|null|undefined} enablePrivatePathForGoogleCloudServices + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.enablePrivatePathForGoogleCloudServices = null; + + /** + * IpConfiguration sslMode. + * @member {google.cloud.sql.v1beta4.IpConfiguration.SslMode} sslMode + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.sslMode = 0; + + /** + * IpConfiguration pscConfig. + * @member {google.cloud.sql.v1beta4.IPscConfig|null|undefined} pscConfig + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.pscConfig = null; + + /** + * IpConfiguration serverCaMode. + * @member {google.cloud.sql.v1beta4.IpConfiguration.CaMode|null|undefined} serverCaMode + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.serverCaMode = null; + + /** + * IpConfiguration customSubjectAlternativeNames. + * @member {Array.} customSubjectAlternativeNames + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.customSubjectAlternativeNames = $util.emptyArray; + + /** + * IpConfiguration serverCaPool. + * @member {string|null|undefined} serverCaPool + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.serverCaPool = null; + + /** + * IpConfiguration serverCertificateRotationMode. + * @member {google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|null|undefined} serverCertificateRotationMode + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + */ + IpConfiguration.prototype.serverCertificateRotationMode = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(IpConfiguration.prototype, "_pscConfig", { + get: $util.oneOfGetter($oneOfFields = ["pscConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(IpConfiguration.prototype, "_serverCaMode", { + get: $util.oneOfGetter($oneOfFields = ["serverCaMode"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(IpConfiguration.prototype, "_serverCaPool", { + get: $util.oneOfGetter($oneOfFields = ["serverCaPool"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(IpConfiguration.prototype, "_serverCertificateRotationMode", { + get: $util.oneOfGetter($oneOfFields = ["serverCertificateRotationMode"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new IpConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IIpConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.IpConfiguration} IpConfiguration instance + */ + IpConfiguration.create = function create(properties) { + return new IpConfiguration(properties); + }; + + /** + * Encodes the specified IpConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.IpConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IIpConfiguration} message IpConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IpConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ipv4Enabled != null && Object.hasOwnProperty.call(message, "ipv4Enabled")) + $root.google.protobuf.BoolValue.encode(message.ipv4Enabled, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.privateNetwork != null && Object.hasOwnProperty.call(message, "privateNetwork")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateNetwork); + if (message.requireSsl != null && Object.hasOwnProperty.call(message, "requireSsl")) + $root.google.protobuf.BoolValue.encode(message.requireSsl, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.authorizedNetworks != null && message.authorizedNetworks.length) + for (var i = 0; i < message.authorizedNetworks.length; ++i) + $root.google.cloud.sql.v1beta4.AclEntry.encode(message.authorizedNetworks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.allocatedIpRange); + if (message.enablePrivatePathForGoogleCloudServices != null && Object.hasOwnProperty.call(message, "enablePrivatePathForGoogleCloudServices")) + $root.google.protobuf.BoolValue.encode(message.enablePrivatePathForGoogleCloudServices, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.sslMode != null && Object.hasOwnProperty.call(message, "sslMode")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.sslMode); + if (message.pscConfig != null && Object.hasOwnProperty.call(message, "pscConfig")) + $root.google.cloud.sql.v1beta4.PscConfig.encode(message.pscConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.serverCaMode != null && Object.hasOwnProperty.call(message, "serverCaMode")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.serverCaMode); + if (message.customSubjectAlternativeNames != null && message.customSubjectAlternativeNames.length) + for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.customSubjectAlternativeNames[i]); + if (message.serverCaPool != null && Object.hasOwnProperty.call(message, "serverCaPool")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.serverCaPool); + if (message.serverCertificateRotationMode != null && Object.hasOwnProperty.call(message, "serverCertificateRotationMode")) + writer.uint32(/* id 16, wireType 0 =*/128).int32(message.serverCertificateRotationMode); + return writer; + }; + + /** + * Encodes the specified IpConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.IpConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IIpConfiguration} message IpConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IpConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IpConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.IpConfiguration} IpConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IpConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.IpConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.ipv4Enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 2: { + message.privateNetwork = reader.string(); + break; + } + case 3: { + message.requireSsl = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.authorizedNetworks && message.authorizedNetworks.length)) + message.authorizedNetworks = []; + message.authorizedNetworks.push($root.google.cloud.sql.v1beta4.AclEntry.decode(reader, reader.uint32())); + break; + } + case 6: { + message.allocatedIpRange = reader.string(); + break; + } + case 7: { + message.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 8: { + message.sslMode = reader.int32(); + break; + } + case 9: { + message.pscConfig = $root.google.cloud.sql.v1beta4.PscConfig.decode(reader, reader.uint32()); + break; + } + case 10: { + message.serverCaMode = reader.int32(); + break; + } + case 11: { + if (!(message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length)) + message.customSubjectAlternativeNames = []; + message.customSubjectAlternativeNames.push(reader.string()); + break; + } + case 12: { + message.serverCaPool = reader.string(); + break; + } + case 16: { + message.serverCertificateRotationMode = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IpConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.IpConfiguration} IpConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IpConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IpConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IpConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.ipv4Enabled != null && message.hasOwnProperty("ipv4Enabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.ipv4Enabled); + if (error) + return "ipv4Enabled." + error; + } + if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) + if (!$util.isString(message.privateNetwork)) + return "privateNetwork: string expected"; + if (message.requireSsl != null && message.hasOwnProperty("requireSsl")) { + var error = $root.google.protobuf.BoolValue.verify(message.requireSsl); + if (error) + return "requireSsl." + error; + } + if (message.authorizedNetworks != null && message.hasOwnProperty("authorizedNetworks")) { + if (!Array.isArray(message.authorizedNetworks)) + return "authorizedNetworks: array expected"; + for (var i = 0; i < message.authorizedNetworks.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.AclEntry.verify(message.authorizedNetworks[i]); + if (error) + return "authorizedNetworks." + error; + } + } + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) + if (!$util.isString(message.allocatedIpRange)) + return "allocatedIpRange: string expected"; + if (message.enablePrivatePathForGoogleCloudServices != null && message.hasOwnProperty("enablePrivatePathForGoogleCloudServices")) { + var error = $root.google.protobuf.BoolValue.verify(message.enablePrivatePathForGoogleCloudServices); + if (error) + return "enablePrivatePathForGoogleCloudServices." + error; + } + if (message.sslMode != null && message.hasOwnProperty("sslMode")) + switch (message.sslMode) { + default: + return "sslMode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.pscConfig != null && message.hasOwnProperty("pscConfig")) { + properties._pscConfig = 1; + { + var error = $root.google.cloud.sql.v1beta4.PscConfig.verify(message.pscConfig); + if (error) + return "pscConfig." + error; + } + } + if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) { + properties._serverCaMode = 1; + switch (message.serverCaMode) { + default: + return "serverCaMode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } + if (message.customSubjectAlternativeNames != null && message.hasOwnProperty("customSubjectAlternativeNames")) { + if (!Array.isArray(message.customSubjectAlternativeNames)) + return "customSubjectAlternativeNames: array expected"; + for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) + if (!$util.isString(message.customSubjectAlternativeNames[i])) + return "customSubjectAlternativeNames: string[] expected"; + } + if (message.serverCaPool != null && message.hasOwnProperty("serverCaPool")) { + properties._serverCaPool = 1; + if (!$util.isString(message.serverCaPool)) + return "serverCaPool: string expected"; + } + if (message.serverCertificateRotationMode != null && message.hasOwnProperty("serverCertificateRotationMode")) { + properties._serverCertificateRotationMode = 1; + switch (message.serverCertificateRotationMode) { + default: + return "serverCertificateRotationMode: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + return null; + }; + + /** + * Creates an IpConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.IpConfiguration} IpConfiguration + */ + IpConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.IpConfiguration) + return object; + var message = new $root.google.cloud.sql.v1beta4.IpConfiguration(); + if (object.ipv4Enabled != null) { + if (typeof object.ipv4Enabled !== "object") + throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.ipv4Enabled: object expected"); + message.ipv4Enabled = $root.google.protobuf.BoolValue.fromObject(object.ipv4Enabled); + } + if (object.privateNetwork != null) + message.privateNetwork = String(object.privateNetwork); + if (object.requireSsl != null) { + if (typeof object.requireSsl !== "object") + throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.requireSsl: object expected"); + message.requireSsl = $root.google.protobuf.BoolValue.fromObject(object.requireSsl); + } + if (object.authorizedNetworks) { + if (!Array.isArray(object.authorizedNetworks)) + throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.authorizedNetworks: array expected"); + message.authorizedNetworks = []; + for (var i = 0; i < object.authorizedNetworks.length; ++i) { + if (typeof object.authorizedNetworks[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.authorizedNetworks: object expected"); + message.authorizedNetworks[i] = $root.google.cloud.sql.v1beta4.AclEntry.fromObject(object.authorizedNetworks[i]); + } + } + if (object.allocatedIpRange != null) + message.allocatedIpRange = String(object.allocatedIpRange); + if (object.enablePrivatePathForGoogleCloudServices != null) { + if (typeof object.enablePrivatePathForGoogleCloudServices !== "object") + throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.enablePrivatePathForGoogleCloudServices: object expected"); + message.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.fromObject(object.enablePrivatePathForGoogleCloudServices); + } + switch (object.sslMode) { + default: + if (typeof object.sslMode === "number") { + message.sslMode = object.sslMode; + break; + } + break; + case "SSL_MODE_UNSPECIFIED": + case 0: + message.sslMode = 0; + break; + case "ALLOW_UNENCRYPTED_AND_ENCRYPTED": + case 1: + message.sslMode = 1; + break; + case "ENCRYPTED_ONLY": + case 2: + message.sslMode = 2; + break; + case "TRUSTED_CLIENT_CERTIFICATE_REQUIRED": + case 3: + message.sslMode = 3; + break; + } + if (object.pscConfig != null) { + if (typeof object.pscConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.pscConfig: object expected"); + message.pscConfig = $root.google.cloud.sql.v1beta4.PscConfig.fromObject(object.pscConfig); + } + switch (object.serverCaMode) { + default: + if (typeof object.serverCaMode === "number") { + message.serverCaMode = object.serverCaMode; + break; + } + break; + case "CA_MODE_UNSPECIFIED": + case 0: + message.serverCaMode = 0; + break; + case "GOOGLE_MANAGED_INTERNAL_CA": + case 1: + message.serverCaMode = 1; + break; + case "GOOGLE_MANAGED_CAS_CA": + case 2: + message.serverCaMode = 2; + break; + case "CUSTOMER_MANAGED_CAS_CA": + case 3: + message.serverCaMode = 3; + break; + } + if (object.customSubjectAlternativeNames) { + if (!Array.isArray(object.customSubjectAlternativeNames)) + throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.customSubjectAlternativeNames: array expected"); + message.customSubjectAlternativeNames = []; + for (var i = 0; i < object.customSubjectAlternativeNames.length; ++i) + message.customSubjectAlternativeNames[i] = String(object.customSubjectAlternativeNames[i]); + } + if (object.serverCaPool != null) + message.serverCaPool = String(object.serverCaPool); + switch (object.serverCertificateRotationMode) { + default: + if (typeof object.serverCertificateRotationMode === "number") { + message.serverCertificateRotationMode = object.serverCertificateRotationMode; + break; + } + break; + case "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED": + case 0: + message.serverCertificateRotationMode = 0; + break; + case "NO_AUTOMATIC_ROTATION": + case 1: + message.serverCertificateRotationMode = 1; + break; + case "AUTOMATIC_ROTATION_DURING_MAINTENANCE": + case 2: + message.serverCertificateRotationMode = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an IpConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IpConfiguration} message IpConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IpConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.authorizedNetworks = []; + object.customSubjectAlternativeNames = []; + } + if (options.defaults) { + object.ipv4Enabled = null; + object.privateNetwork = ""; + object.requireSsl = null; + object.allocatedIpRange = ""; + object.enablePrivatePathForGoogleCloudServices = null; + object.sslMode = options.enums === String ? "SSL_MODE_UNSPECIFIED" : 0; + } + if (message.ipv4Enabled != null && message.hasOwnProperty("ipv4Enabled")) + object.ipv4Enabled = $root.google.protobuf.BoolValue.toObject(message.ipv4Enabled, options); + if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) + object.privateNetwork = message.privateNetwork; + if (message.requireSsl != null && message.hasOwnProperty("requireSsl")) + object.requireSsl = $root.google.protobuf.BoolValue.toObject(message.requireSsl, options); + if (message.authorizedNetworks && message.authorizedNetworks.length) { + object.authorizedNetworks = []; + for (var j = 0; j < message.authorizedNetworks.length; ++j) + object.authorizedNetworks[j] = $root.google.cloud.sql.v1beta4.AclEntry.toObject(message.authorizedNetworks[j], options); + } + if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) + object.allocatedIpRange = message.allocatedIpRange; + if (message.enablePrivatePathForGoogleCloudServices != null && message.hasOwnProperty("enablePrivatePathForGoogleCloudServices")) + object.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.toObject(message.enablePrivatePathForGoogleCloudServices, options); + if (message.sslMode != null && message.hasOwnProperty("sslMode")) + object.sslMode = options.enums === String ? $root.google.cloud.sql.v1beta4.IpConfiguration.SslMode[message.sslMode] === undefined ? message.sslMode : $root.google.cloud.sql.v1beta4.IpConfiguration.SslMode[message.sslMode] : message.sslMode; + if (message.pscConfig != null && message.hasOwnProperty("pscConfig")) { + object.pscConfig = $root.google.cloud.sql.v1beta4.PscConfig.toObject(message.pscConfig, options); + if (options.oneofs) + object._pscConfig = "pscConfig"; + } + if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) { + object.serverCaMode = options.enums === String ? $root.google.cloud.sql.v1beta4.IpConfiguration.CaMode[message.serverCaMode] === undefined ? message.serverCaMode : $root.google.cloud.sql.v1beta4.IpConfiguration.CaMode[message.serverCaMode] : message.serverCaMode; + if (options.oneofs) + object._serverCaMode = "serverCaMode"; + } + if (message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length) { + object.customSubjectAlternativeNames = []; + for (var j = 0; j < message.customSubjectAlternativeNames.length; ++j) + object.customSubjectAlternativeNames[j] = message.customSubjectAlternativeNames[j]; + } + if (message.serverCaPool != null && message.hasOwnProperty("serverCaPool")) { + object.serverCaPool = message.serverCaPool; + if (options.oneofs) + object._serverCaPool = "serverCaPool"; + } + if (message.serverCertificateRotationMode != null && message.hasOwnProperty("serverCertificateRotationMode")) { + object.serverCertificateRotationMode = options.enums === String ? $root.google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode[message.serverCertificateRotationMode] === undefined ? message.serverCertificateRotationMode : $root.google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode[message.serverCertificateRotationMode] : message.serverCertificateRotationMode; + if (options.oneofs) + object._serverCertificateRotationMode = "serverCertificateRotationMode"; + } + return object; + }; + + /** + * Converts this IpConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @instance + * @returns {Object.} JSON object + */ + IpConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IpConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.IpConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IpConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.IpConfiguration"; + }; + + /** + * SslMode enum. + * @name google.cloud.sql.v1beta4.IpConfiguration.SslMode + * @enum {number} + * @property {number} SSL_MODE_UNSPECIFIED=0 SSL_MODE_UNSPECIFIED value + * @property {number} ALLOW_UNENCRYPTED_AND_ENCRYPTED=1 ALLOW_UNENCRYPTED_AND_ENCRYPTED value + * @property {number} ENCRYPTED_ONLY=2 ENCRYPTED_ONLY value + * @property {number} TRUSTED_CLIENT_CERTIFICATE_REQUIRED=3 TRUSTED_CLIENT_CERTIFICATE_REQUIRED value + */ + IpConfiguration.SslMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SSL_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALLOW_UNENCRYPTED_AND_ENCRYPTED"] = 1; + values[valuesById[2] = "ENCRYPTED_ONLY"] = 2; + values[valuesById[3] = "TRUSTED_CLIENT_CERTIFICATE_REQUIRED"] = 3; + return values; + })(); + + /** + * CaMode enum. + * @name google.cloud.sql.v1beta4.IpConfiguration.CaMode + * @enum {number} + * @property {number} CA_MODE_UNSPECIFIED=0 CA_MODE_UNSPECIFIED value + * @property {number} GOOGLE_MANAGED_INTERNAL_CA=1 GOOGLE_MANAGED_INTERNAL_CA value + * @property {number} GOOGLE_MANAGED_CAS_CA=2 GOOGLE_MANAGED_CAS_CA value + * @property {number} CUSTOMER_MANAGED_CAS_CA=3 CUSTOMER_MANAGED_CAS_CA value + */ + IpConfiguration.CaMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CA_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "GOOGLE_MANAGED_INTERNAL_CA"] = 1; + values[valuesById[2] = "GOOGLE_MANAGED_CAS_CA"] = 2; + values[valuesById[3] = "CUSTOMER_MANAGED_CAS_CA"] = 3; + return values; + })(); + + /** + * ServerCertificateRotationMode enum. + * @name google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode + * @enum {number} + * @property {number} SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED=0 SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED value + * @property {number} NO_AUTOMATIC_ROTATION=1 NO_AUTOMATIC_ROTATION value + * @property {number} AUTOMATIC_ROTATION_DURING_MAINTENANCE=2 AUTOMATIC_ROTATION_DURING_MAINTENANCE value + */ + IpConfiguration.ServerCertificateRotationMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NO_AUTOMATIC_ROTATION"] = 1; + values[valuesById[2] = "AUTOMATIC_ROTATION_DURING_MAINTENANCE"] = 2; + return values; + })(); + + return IpConfiguration; + })(); + + v1beta4.PscConfig = (function() { + + /** + * Properties of a PscConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IPscConfig + * @property {boolean|null} [pscEnabled] PscConfig pscEnabled + * @property {Array.|null} [allowedConsumerProjects] PscConfig allowedConsumerProjects + * @property {Array.|null} [pscAutoConnections] PscConfig pscAutoConnections + * @property {string|null} [networkAttachmentUri] PscConfig networkAttachmentUri + */ + + /** + * Constructs a new PscConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a PscConfig. + * @implements IPscConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IPscConfig=} [properties] Properties to set + */ + function PscConfig(properties) { + this.allowedConsumerProjects = []; + this.pscAutoConnections = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PscConfig pscEnabled. + * @member {boolean|null|undefined} pscEnabled + * @memberof google.cloud.sql.v1beta4.PscConfig + * @instance + */ + PscConfig.prototype.pscEnabled = null; + + /** + * PscConfig allowedConsumerProjects. + * @member {Array.} allowedConsumerProjects + * @memberof google.cloud.sql.v1beta4.PscConfig + * @instance + */ + PscConfig.prototype.allowedConsumerProjects = $util.emptyArray; + + /** + * PscConfig pscAutoConnections. + * @member {Array.} pscAutoConnections + * @memberof google.cloud.sql.v1beta4.PscConfig + * @instance + */ + PscConfig.prototype.pscAutoConnections = $util.emptyArray; + + /** + * PscConfig networkAttachmentUri. + * @member {string} networkAttachmentUri + * @memberof google.cloud.sql.v1beta4.PscConfig + * @instance + */ + PscConfig.prototype.networkAttachmentUri = ""; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscConfig.prototype, "_pscEnabled", { + get: $util.oneOfGetter($oneOfFields = ["pscEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PscConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.PscConfig + * @static + * @param {google.cloud.sql.v1beta4.IPscConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.PscConfig} PscConfig instance + */ + PscConfig.create = function create(properties) { + return new PscConfig(properties); + }; + + /** + * Encodes the specified PscConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PscConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.PscConfig + * @static + * @param {google.cloud.sql.v1beta4.IPscConfig} message PscConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PscConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pscEnabled != null && Object.hasOwnProperty.call(message, "pscEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.pscEnabled); + if (message.allowedConsumerProjects != null && message.allowedConsumerProjects.length) + for (var i = 0; i < message.allowedConsumerProjects.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.allowedConsumerProjects[i]); + if (message.pscAutoConnections != null && message.pscAutoConnections.length) + for (var i = 0; i < message.pscAutoConnections.length; ++i) + $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.encode(message.pscAutoConnections[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.networkAttachmentUri != null && Object.hasOwnProperty.call(message, "networkAttachmentUri")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.networkAttachmentUri); + return writer; + }; + + /** + * Encodes the specified PscConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PscConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.PscConfig + * @static + * @param {google.cloud.sql.v1beta4.IPscConfig} message PscConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PscConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PscConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.PscConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.PscConfig} PscConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PscConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PscConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.pscEnabled = reader.bool(); + break; + } + case 2: { + if (!(message.allowedConsumerProjects && message.allowedConsumerProjects.length)) + message.allowedConsumerProjects = []; + message.allowedConsumerProjects.push(reader.string()); + break; + } + case 3: { + if (!(message.pscAutoConnections && message.pscAutoConnections.length)) + message.pscAutoConnections = []; + message.pscAutoConnections.push($root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.decode(reader, reader.uint32())); + break; + } + case 4: { + message.networkAttachmentUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PscConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.PscConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.PscConfig} PscConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PscConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PscConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.PscConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PscConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) { + properties._pscEnabled = 1; + if (typeof message.pscEnabled !== "boolean") + return "pscEnabled: boolean expected"; + } + if (message.allowedConsumerProjects != null && message.hasOwnProperty("allowedConsumerProjects")) { + if (!Array.isArray(message.allowedConsumerProjects)) + return "allowedConsumerProjects: array expected"; + for (var i = 0; i < message.allowedConsumerProjects.length; ++i) + if (!$util.isString(message.allowedConsumerProjects[i])) + return "allowedConsumerProjects: string[] expected"; + } + if (message.pscAutoConnections != null && message.hasOwnProperty("pscAutoConnections")) { + if (!Array.isArray(message.pscAutoConnections)) + return "pscAutoConnections: array expected"; + for (var i = 0; i < message.pscAutoConnections.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify(message.pscAutoConnections[i]); + if (error) + return "pscAutoConnections." + error; + } + } + if (message.networkAttachmentUri != null && message.hasOwnProperty("networkAttachmentUri")) + if (!$util.isString(message.networkAttachmentUri)) + return "networkAttachmentUri: string expected"; + return null; + }; + + /** + * Creates a PscConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.PscConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.PscConfig} PscConfig + */ + PscConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.PscConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.PscConfig(); + if (object.pscEnabled != null) + message.pscEnabled = Boolean(object.pscEnabled); + if (object.allowedConsumerProjects) { + if (!Array.isArray(object.allowedConsumerProjects)) + throw TypeError(".google.cloud.sql.v1beta4.PscConfig.allowedConsumerProjects: array expected"); + message.allowedConsumerProjects = []; + for (var i = 0; i < object.allowedConsumerProjects.length; ++i) + message.allowedConsumerProjects[i] = String(object.allowedConsumerProjects[i]); + } + if (object.pscAutoConnections) { + if (!Array.isArray(object.pscAutoConnections)) + throw TypeError(".google.cloud.sql.v1beta4.PscConfig.pscAutoConnections: array expected"); + message.pscAutoConnections = []; + for (var i = 0; i < object.pscAutoConnections.length; ++i) { + if (typeof object.pscAutoConnections[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.PscConfig.pscAutoConnections: object expected"); + message.pscAutoConnections[i] = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.fromObject(object.pscAutoConnections[i]); + } + } + if (object.networkAttachmentUri != null) + message.networkAttachmentUri = String(object.networkAttachmentUri); + return message; + }; + + /** + * Creates a plain object from a PscConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.PscConfig + * @static + * @param {google.cloud.sql.v1beta4.PscConfig} message PscConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PscConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.allowedConsumerProjects = []; + object.pscAutoConnections = []; + } + if (options.defaults) + object.networkAttachmentUri = ""; + if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) { + object.pscEnabled = message.pscEnabled; + if (options.oneofs) + object._pscEnabled = "pscEnabled"; + } + if (message.allowedConsumerProjects && message.allowedConsumerProjects.length) { + object.allowedConsumerProjects = []; + for (var j = 0; j < message.allowedConsumerProjects.length; ++j) + object.allowedConsumerProjects[j] = message.allowedConsumerProjects[j]; + } + if (message.pscAutoConnections && message.pscAutoConnections.length) { + object.pscAutoConnections = []; + for (var j = 0; j < message.pscAutoConnections.length; ++j) + object.pscAutoConnections[j] = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.toObject(message.pscAutoConnections[j], options); + } + if (message.networkAttachmentUri != null && message.hasOwnProperty("networkAttachmentUri")) + object.networkAttachmentUri = message.networkAttachmentUri; + return object; + }; + + /** + * Converts this PscConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.PscConfig + * @instance + * @returns {Object.} JSON object + */ + PscConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PscConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.PscConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PscConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.PscConfig"; + }; + + return PscConfig; + })(); + + v1beta4.PscAutoConnectionConfig = (function() { + + /** + * Properties of a PscAutoConnectionConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IPscAutoConnectionConfig + * @property {string|null} [consumerProject] PscAutoConnectionConfig consumerProject + * @property {string|null} [consumerNetwork] PscAutoConnectionConfig consumerNetwork + * @property {string|null} [ipAddress] PscAutoConnectionConfig ipAddress + * @property {string|null} [status] PscAutoConnectionConfig status + * @property {string|null} [consumerNetworkStatus] PscAutoConnectionConfig consumerNetworkStatus + */ + + /** + * Constructs a new PscAutoConnectionConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a PscAutoConnectionConfig. + * @implements IPscAutoConnectionConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IPscAutoConnectionConfig=} [properties] Properties to set + */ + function PscAutoConnectionConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PscAutoConnectionConfig consumerProject. + * @member {string} consumerProject + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @instance + */ + PscAutoConnectionConfig.prototype.consumerProject = ""; + + /** + * PscAutoConnectionConfig consumerNetwork. + * @member {string} consumerNetwork + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @instance + */ + PscAutoConnectionConfig.prototype.consumerNetwork = ""; + + /** + * PscAutoConnectionConfig ipAddress. + * @member {string|null|undefined} ipAddress + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @instance + */ + PscAutoConnectionConfig.prototype.ipAddress = null; + + /** + * PscAutoConnectionConfig status. + * @member {string|null|undefined} status + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @instance + */ + PscAutoConnectionConfig.prototype.status = null; + + /** + * PscAutoConnectionConfig consumerNetworkStatus. + * @member {string|null|undefined} consumerNetworkStatus + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @instance + */ + PscAutoConnectionConfig.prototype.consumerNetworkStatus = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscAutoConnectionConfig.prototype, "_ipAddress", { + get: $util.oneOfGetter($oneOfFields = ["ipAddress"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscAutoConnectionConfig.prototype, "_status", { + get: $util.oneOfGetter($oneOfFields = ["status"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscAutoConnectionConfig.prototype, "_consumerNetworkStatus", { + get: $util.oneOfGetter($oneOfFields = ["consumerNetworkStatus"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PscAutoConnectionConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @static + * @param {google.cloud.sql.v1beta4.IPscAutoConnectionConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.PscAutoConnectionConfig} PscAutoConnectionConfig instance + */ + PscAutoConnectionConfig.create = function create(properties) { + return new PscAutoConnectionConfig(properties); + }; + + /** + * Encodes the specified PscAutoConnectionConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @static + * @param {google.cloud.sql.v1beta4.IPscAutoConnectionConfig} message PscAutoConnectionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PscAutoConnectionConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.consumerProject != null && Object.hasOwnProperty.call(message, "consumerProject")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.consumerProject); + if (message.consumerNetwork != null && Object.hasOwnProperty.call(message, "consumerNetwork")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.consumerNetwork); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.ipAddress); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.status); + if (message.consumerNetworkStatus != null && Object.hasOwnProperty.call(message, "consumerNetworkStatus")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.consumerNetworkStatus); + return writer; + }; + + /** + * Encodes the specified PscAutoConnectionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @static + * @param {google.cloud.sql.v1beta4.IPscAutoConnectionConfig} message PscAutoConnectionConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PscAutoConnectionConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PscAutoConnectionConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.PscAutoConnectionConfig} PscAutoConnectionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PscAutoConnectionConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.consumerProject = reader.string(); + break; + } + case 2: { + message.consumerNetwork = reader.string(); + break; + } + case 3: { + message.ipAddress = reader.string(); + break; + } + case 4: { + message.status = reader.string(); + break; + } + case 5: { + message.consumerNetworkStatus = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PscAutoConnectionConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.PscAutoConnectionConfig} PscAutoConnectionConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PscAutoConnectionConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PscAutoConnectionConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PscAutoConnectionConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.consumerProject != null && message.hasOwnProperty("consumerProject")) + if (!$util.isString(message.consumerProject)) + return "consumerProject: string expected"; + if (message.consumerNetwork != null && message.hasOwnProperty("consumerNetwork")) + if (!$util.isString(message.consumerNetwork)) + return "consumerNetwork: string expected"; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) { + properties._ipAddress = 1; + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + } + if (message.status != null && message.hasOwnProperty("status")) { + properties._status = 1; + if (!$util.isString(message.status)) + return "status: string expected"; + } + if (message.consumerNetworkStatus != null && message.hasOwnProperty("consumerNetworkStatus")) { + properties._consumerNetworkStatus = 1; + if (!$util.isString(message.consumerNetworkStatus)) + return "consumerNetworkStatus: string expected"; + } + return null; + }; + + /** + * Creates a PscAutoConnectionConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.PscAutoConnectionConfig} PscAutoConnectionConfig + */ + PscAutoConnectionConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig(); + if (object.consumerProject != null) + message.consumerProject = String(object.consumerProject); + if (object.consumerNetwork != null) + message.consumerNetwork = String(object.consumerNetwork); + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.status != null) + message.status = String(object.status); + if (object.consumerNetworkStatus != null) + message.consumerNetworkStatus = String(object.consumerNetworkStatus); + return message; + }; + + /** + * Creates a plain object from a PscAutoConnectionConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @static + * @param {google.cloud.sql.v1beta4.PscAutoConnectionConfig} message PscAutoConnectionConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PscAutoConnectionConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.consumerProject = ""; + object.consumerNetwork = ""; + } + if (message.consumerProject != null && message.hasOwnProperty("consumerProject")) + object.consumerProject = message.consumerProject; + if (message.consumerNetwork != null && message.hasOwnProperty("consumerNetwork")) + object.consumerNetwork = message.consumerNetwork; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) { + object.ipAddress = message.ipAddress; + if (options.oneofs) + object._ipAddress = "ipAddress"; + } + if (message.status != null && message.hasOwnProperty("status")) { + object.status = message.status; + if (options.oneofs) + object._status = "status"; + } + if (message.consumerNetworkStatus != null && message.hasOwnProperty("consumerNetworkStatus")) { + object.consumerNetworkStatus = message.consumerNetworkStatus; + if (options.oneofs) + object._consumerNetworkStatus = "consumerNetworkStatus"; + } + return object; + }; + + /** + * Converts this PscAutoConnectionConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @instance + * @returns {Object.} JSON object + */ + PscAutoConnectionConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PscAutoConnectionConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PscAutoConnectionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.PscAutoConnectionConfig"; + }; + + return PscAutoConnectionConfig; + })(); + + v1beta4.IpMapping = (function() { + + /** + * Properties of an IpMapping. + * @memberof google.cloud.sql.v1beta4 + * @interface IIpMapping + * @property {google.cloud.sql.v1beta4.SqlIpAddressType|null} [type] IpMapping type + * @property {string|null} [ipAddress] IpMapping ipAddress + * @property {google.protobuf.ITimestamp|null} [timeToRetire] IpMapping timeToRetire + */ + + /** + * Constructs a new IpMapping. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an IpMapping. + * @implements IIpMapping + * @constructor + * @param {google.cloud.sql.v1beta4.IIpMapping=} [properties] Properties to set + */ + function IpMapping(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IpMapping type. + * @member {google.cloud.sql.v1beta4.SqlIpAddressType} type + * @memberof google.cloud.sql.v1beta4.IpMapping + * @instance + */ + IpMapping.prototype.type = 0; + + /** + * IpMapping ipAddress. + * @member {string} ipAddress + * @memberof google.cloud.sql.v1beta4.IpMapping + * @instance + */ + IpMapping.prototype.ipAddress = ""; + + /** + * IpMapping timeToRetire. + * @member {google.protobuf.ITimestamp|null|undefined} timeToRetire + * @memberof google.cloud.sql.v1beta4.IpMapping + * @instance + */ + IpMapping.prototype.timeToRetire = null; + + /** + * Creates a new IpMapping instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.IpMapping + * @static + * @param {google.cloud.sql.v1beta4.IIpMapping=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.IpMapping} IpMapping instance + */ + IpMapping.create = function create(properties) { + return new IpMapping(properties); + }; + + /** + * Encodes the specified IpMapping message. Does not implicitly {@link google.cloud.sql.v1beta4.IpMapping.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.IpMapping + * @static + * @param {google.cloud.sql.v1beta4.IIpMapping} message IpMapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IpMapping.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); + if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); + if (message.timeToRetire != null && Object.hasOwnProperty.call(message, "timeToRetire")) + $root.google.protobuf.Timestamp.encode(message.timeToRetire, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified IpMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.IpMapping.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.IpMapping + * @static + * @param {google.cloud.sql.v1beta4.IIpMapping} message IpMapping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IpMapping.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IpMapping message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.IpMapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.IpMapping} IpMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IpMapping.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.IpMapping(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.int32(); + break; + } + case 2: { + message.ipAddress = reader.string(); + break; + } + case 3: { + message.timeToRetire = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IpMapping message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.IpMapping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.IpMapping} IpMapping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IpMapping.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IpMapping message. + * @function verify + * @memberof google.cloud.sql.v1beta4.IpMapping + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IpMapping.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + if (!$util.isString(message.ipAddress)) + return "ipAddress: string expected"; + if (message.timeToRetire != null && message.hasOwnProperty("timeToRetire")) { + var error = $root.google.protobuf.Timestamp.verify(message.timeToRetire); + if (error) + return "timeToRetire." + error; + } + return null; + }; + + /** + * Creates an IpMapping message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.IpMapping + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.IpMapping} IpMapping + */ + IpMapping.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.IpMapping) + return object; + var message = new $root.google.cloud.sql.v1beta4.IpMapping(); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "SQL_IP_ADDRESS_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "PRIMARY": + case 1: + message.type = 1; + break; + case "OUTGOING": + case 2: + message.type = 2; + break; + case "PRIVATE": + case 3: + message.type = 3; + break; + case "MIGRATED_1ST_GEN": + case 4: + message.type = 4; + break; + } + if (object.ipAddress != null) + message.ipAddress = String(object.ipAddress); + if (object.timeToRetire != null) { + if (typeof object.timeToRetire !== "object") + throw TypeError(".google.cloud.sql.v1beta4.IpMapping.timeToRetire: object expected"); + message.timeToRetire = $root.google.protobuf.Timestamp.fromObject(object.timeToRetire); + } + return message; + }; + + /** + * Creates a plain object from an IpMapping message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.IpMapping + * @static + * @param {google.cloud.sql.v1beta4.IpMapping} message IpMapping + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IpMapping.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = options.enums === String ? "SQL_IP_ADDRESS_TYPE_UNSPECIFIED" : 0; + object.ipAddress = ""; + object.timeToRetire = null; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlIpAddressType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.SqlIpAddressType[message.type] : message.type; + if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) + object.ipAddress = message.ipAddress; + if (message.timeToRetire != null && message.hasOwnProperty("timeToRetire")) + object.timeToRetire = $root.google.protobuf.Timestamp.toObject(message.timeToRetire, options); + return object; + }; + + /** + * Converts this IpMapping to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.IpMapping + * @instance + * @returns {Object.} JSON object + */ + IpMapping.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IpMapping + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.IpMapping + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IpMapping.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.IpMapping"; + }; + + return IpMapping; + })(); + + v1beta4.LocationPreference = (function() { + + /** + * Properties of a LocationPreference. + * @memberof google.cloud.sql.v1beta4 + * @interface ILocationPreference + * @property {string|null} [followGaeApplication] LocationPreference followGaeApplication + * @property {string|null} [zone] LocationPreference zone + * @property {string|null} [secondaryZone] LocationPreference secondaryZone + * @property {string|null} [kind] LocationPreference kind + */ + + /** + * Constructs a new LocationPreference. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a LocationPreference. + * @implements ILocationPreference + * @constructor + * @param {google.cloud.sql.v1beta4.ILocationPreference=} [properties] Properties to set + */ + function LocationPreference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocationPreference followGaeApplication. + * @member {string} followGaeApplication + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @instance + */ + LocationPreference.prototype.followGaeApplication = ""; + + /** + * LocationPreference zone. + * @member {string} zone + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @instance + */ + LocationPreference.prototype.zone = ""; + + /** + * LocationPreference secondaryZone. + * @member {string} secondaryZone + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @instance + */ + LocationPreference.prototype.secondaryZone = ""; + + /** + * LocationPreference kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @instance + */ + LocationPreference.prototype.kind = ""; + + /** + * Creates a new LocationPreference instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @static + * @param {google.cloud.sql.v1beta4.ILocationPreference=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.LocationPreference} LocationPreference instance + */ + LocationPreference.create = function create(properties) { + return new LocationPreference(properties); + }; + + /** + * Encodes the specified LocationPreference message. Does not implicitly {@link google.cloud.sql.v1beta4.LocationPreference.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @static + * @param {google.cloud.sql.v1beta4.ILocationPreference} message LocationPreference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationPreference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.followGaeApplication != null && Object.hasOwnProperty.call(message, "followGaeApplication")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.followGaeApplication); + if (message.zone != null && Object.hasOwnProperty.call(message, "zone")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.zone); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + if (message.secondaryZone != null && Object.hasOwnProperty.call(message, "secondaryZone")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.secondaryZone); + return writer; + }; + + /** + * Encodes the specified LocationPreference message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.LocationPreference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @static + * @param {google.cloud.sql.v1beta4.ILocationPreference} message LocationPreference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationPreference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocationPreference message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.LocationPreference} LocationPreference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationPreference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.LocationPreference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.followGaeApplication = reader.string(); + break; + } + case 2: { + message.zone = reader.string(); + break; + } + case 4: { + message.secondaryZone = reader.string(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocationPreference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.LocationPreference} LocationPreference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationPreference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocationPreference message. + * @function verify + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocationPreference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.followGaeApplication != null && message.hasOwnProperty("followGaeApplication")) + if (!$util.isString(message.followGaeApplication)) + return "followGaeApplication: string expected"; + if (message.zone != null && message.hasOwnProperty("zone")) + if (!$util.isString(message.zone)) + return "zone: string expected"; + if (message.secondaryZone != null && message.hasOwnProperty("secondaryZone")) + if (!$util.isString(message.secondaryZone)) + return "secondaryZone: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a LocationPreference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.LocationPreference} LocationPreference + */ + LocationPreference.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.LocationPreference) + return object; + var message = new $root.google.cloud.sql.v1beta4.LocationPreference(); + if (object.followGaeApplication != null) + message.followGaeApplication = String(object.followGaeApplication); + if (object.zone != null) + message.zone = String(object.zone); + if (object.secondaryZone != null) + message.secondaryZone = String(object.secondaryZone); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a LocationPreference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @static + * @param {google.cloud.sql.v1beta4.LocationPreference} message LocationPreference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocationPreference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.followGaeApplication = ""; + object.zone = ""; + object.kind = ""; + object.secondaryZone = ""; + } + if (message.followGaeApplication != null && message.hasOwnProperty("followGaeApplication")) + object.followGaeApplication = message.followGaeApplication; + if (message.zone != null && message.hasOwnProperty("zone")) + object.zone = message.zone; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.secondaryZone != null && message.hasOwnProperty("secondaryZone")) + object.secondaryZone = message.secondaryZone; + return object; + }; + + /** + * Converts this LocationPreference to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @instance + * @returns {Object.} JSON object + */ + LocationPreference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LocationPreference + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.LocationPreference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LocationPreference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.LocationPreference"; + }; + + return LocationPreference; + })(); + + v1beta4.MaintenanceWindow = (function() { + + /** + * Properties of a MaintenanceWindow. + * @memberof google.cloud.sql.v1beta4 + * @interface IMaintenanceWindow + * @property {google.protobuf.IInt32Value|null} [hour] MaintenanceWindow hour + * @property {google.protobuf.IInt32Value|null} [day] MaintenanceWindow day + * @property {google.cloud.sql.v1beta4.SqlUpdateTrack|null} [updateTrack] MaintenanceWindow updateTrack + * @property {string|null} [kind] MaintenanceWindow kind + */ + + /** + * Constructs a new MaintenanceWindow. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a MaintenanceWindow. + * @implements IMaintenanceWindow + * @constructor + * @param {google.cloud.sql.v1beta4.IMaintenanceWindow=} [properties] Properties to set + */ + function MaintenanceWindow(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MaintenanceWindow hour. + * @member {google.protobuf.IInt32Value|null|undefined} hour + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @instance + */ + MaintenanceWindow.prototype.hour = null; + + /** + * MaintenanceWindow day. + * @member {google.protobuf.IInt32Value|null|undefined} day + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @instance + */ + MaintenanceWindow.prototype.day = null; + + /** + * MaintenanceWindow updateTrack. + * @member {google.cloud.sql.v1beta4.SqlUpdateTrack} updateTrack + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @instance + */ + MaintenanceWindow.prototype.updateTrack = 0; + + /** + * MaintenanceWindow kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @instance + */ + MaintenanceWindow.prototype.kind = ""; + + /** + * Creates a new MaintenanceWindow instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @static + * @param {google.cloud.sql.v1beta4.IMaintenanceWindow=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.MaintenanceWindow} MaintenanceWindow instance + */ + MaintenanceWindow.create = function create(properties) { + return new MaintenanceWindow(properties); + }; + + /** + * Encodes the specified MaintenanceWindow message. Does not implicitly {@link google.cloud.sql.v1beta4.MaintenanceWindow.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @static + * @param {google.cloud.sql.v1beta4.IMaintenanceWindow} message MaintenanceWindow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MaintenanceWindow.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hour != null && Object.hasOwnProperty.call(message, "hour")) + $root.google.protobuf.Int32Value.encode(message.hour, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.day != null && Object.hasOwnProperty.call(message, "day")) + $root.google.protobuf.Int32Value.encode(message.day, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateTrack != null && Object.hasOwnProperty.call(message, "updateTrack")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.updateTrack); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); + return writer; + }; + + /** + * Encodes the specified MaintenanceWindow message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MaintenanceWindow.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @static + * @param {google.cloud.sql.v1beta4.IMaintenanceWindow} message MaintenanceWindow message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MaintenanceWindow.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MaintenanceWindow message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.MaintenanceWindow} MaintenanceWindow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MaintenanceWindow.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.MaintenanceWindow(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.hour = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 2: { + message.day = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateTrack = reader.int32(); + break; + } + case 4: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MaintenanceWindow message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.MaintenanceWindow} MaintenanceWindow + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MaintenanceWindow.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MaintenanceWindow message. + * @function verify + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MaintenanceWindow.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hour != null && message.hasOwnProperty("hour")) { + var error = $root.google.protobuf.Int32Value.verify(message.hour); + if (error) + return "hour." + error; + } + if (message.day != null && message.hasOwnProperty("day")) { + var error = $root.google.protobuf.Int32Value.verify(message.day); + if (error) + return "day." + error; + } + if (message.updateTrack != null && message.hasOwnProperty("updateTrack")) + switch (message.updateTrack) { + default: + return "updateTrack: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a MaintenanceWindow message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.MaintenanceWindow} MaintenanceWindow + */ + MaintenanceWindow.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.MaintenanceWindow) + return object; + var message = new $root.google.cloud.sql.v1beta4.MaintenanceWindow(); + if (object.hour != null) { + if (typeof object.hour !== "object") + throw TypeError(".google.cloud.sql.v1beta4.MaintenanceWindow.hour: object expected"); + message.hour = $root.google.protobuf.Int32Value.fromObject(object.hour); + } + if (object.day != null) { + if (typeof object.day !== "object") + throw TypeError(".google.cloud.sql.v1beta4.MaintenanceWindow.day: object expected"); + message.day = $root.google.protobuf.Int32Value.fromObject(object.day); + } + switch (object.updateTrack) { + default: + if (typeof object.updateTrack === "number") { + message.updateTrack = object.updateTrack; + break; + } + break; + case "SQL_UPDATE_TRACK_UNSPECIFIED": + case 0: + message.updateTrack = 0; + break; + case "canary": + case 1: + message.updateTrack = 1; + break; + case "stable": + case 2: + message.updateTrack = 2; + break; + case "week5": + case 3: + message.updateTrack = 3; + break; + } + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a MaintenanceWindow message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @static + * @param {google.cloud.sql.v1beta4.MaintenanceWindow} message MaintenanceWindow + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MaintenanceWindow.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.hour = null; + object.day = null; + object.updateTrack = options.enums === String ? "SQL_UPDATE_TRACK_UNSPECIFIED" : 0; + object.kind = ""; + } + if (message.hour != null && message.hasOwnProperty("hour")) + object.hour = $root.google.protobuf.Int32Value.toObject(message.hour, options); + if (message.day != null && message.hasOwnProperty("day")) + object.day = $root.google.protobuf.Int32Value.toObject(message.day, options); + if (message.updateTrack != null && message.hasOwnProperty("updateTrack")) + object.updateTrack = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlUpdateTrack[message.updateTrack] === undefined ? message.updateTrack : $root.google.cloud.sql.v1beta4.SqlUpdateTrack[message.updateTrack] : message.updateTrack; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this MaintenanceWindow to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @instance + * @returns {Object.} JSON object + */ + MaintenanceWindow.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MaintenanceWindow + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.MaintenanceWindow + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MaintenanceWindow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.MaintenanceWindow"; + }; + + return MaintenanceWindow; + })(); + + v1beta4.DenyMaintenancePeriod = (function() { + + /** + * Properties of a DenyMaintenancePeriod. + * @memberof google.cloud.sql.v1beta4 + * @interface IDenyMaintenancePeriod + * @property {string|null} [startDate] DenyMaintenancePeriod startDate + * @property {string|null} [endDate] DenyMaintenancePeriod endDate + * @property {string|null} [time] DenyMaintenancePeriod time + */ + + /** + * Constructs a new DenyMaintenancePeriod. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DenyMaintenancePeriod. + * @implements IDenyMaintenancePeriod + * @constructor + * @param {google.cloud.sql.v1beta4.IDenyMaintenancePeriod=} [properties] Properties to set + */ + function DenyMaintenancePeriod(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DenyMaintenancePeriod startDate. + * @member {string} startDate + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @instance + */ + DenyMaintenancePeriod.prototype.startDate = ""; + + /** + * DenyMaintenancePeriod endDate. + * @member {string} endDate + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @instance + */ + DenyMaintenancePeriod.prototype.endDate = ""; + + /** + * DenyMaintenancePeriod time. + * @member {string} time + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @instance + */ + DenyMaintenancePeriod.prototype.time = ""; + + /** + * Creates a new DenyMaintenancePeriod instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @static + * @param {google.cloud.sql.v1beta4.IDenyMaintenancePeriod=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DenyMaintenancePeriod} DenyMaintenancePeriod instance + */ + DenyMaintenancePeriod.create = function create(properties) { + return new DenyMaintenancePeriod(properties); + }; + + /** + * Encodes the specified DenyMaintenancePeriod message. Does not implicitly {@link google.cloud.sql.v1beta4.DenyMaintenancePeriod.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @static + * @param {google.cloud.sql.v1beta4.IDenyMaintenancePeriod} message DenyMaintenancePeriod message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DenyMaintenancePeriod.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startDate != null && Object.hasOwnProperty.call(message, "startDate")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.startDate); + if (message.endDate != null && Object.hasOwnProperty.call(message, "endDate")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.endDate); + if (message.time != null && Object.hasOwnProperty.call(message, "time")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.time); + return writer; + }; + + /** + * Encodes the specified DenyMaintenancePeriod message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DenyMaintenancePeriod.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @static + * @param {google.cloud.sql.v1beta4.IDenyMaintenancePeriod} message DenyMaintenancePeriod message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DenyMaintenancePeriod.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DenyMaintenancePeriod message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DenyMaintenancePeriod} DenyMaintenancePeriod + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DenyMaintenancePeriod.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startDate = reader.string(); + break; + } + case 2: { + message.endDate = reader.string(); + break; + } + case 3: { + message.time = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DenyMaintenancePeriod message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DenyMaintenancePeriod} DenyMaintenancePeriod + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DenyMaintenancePeriod.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DenyMaintenancePeriod message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DenyMaintenancePeriod.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startDate != null && message.hasOwnProperty("startDate")) + if (!$util.isString(message.startDate)) + return "startDate: string expected"; + if (message.endDate != null && message.hasOwnProperty("endDate")) + if (!$util.isString(message.endDate)) + return "endDate: string expected"; + if (message.time != null && message.hasOwnProperty("time")) + if (!$util.isString(message.time)) + return "time: string expected"; + return null; + }; + + /** + * Creates a DenyMaintenancePeriod message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DenyMaintenancePeriod} DenyMaintenancePeriod + */ + DenyMaintenancePeriod.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod) + return object; + var message = new $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod(); + if (object.startDate != null) + message.startDate = String(object.startDate); + if (object.endDate != null) + message.endDate = String(object.endDate); + if (object.time != null) + message.time = String(object.time); + return message; + }; + + /** + * Creates a plain object from a DenyMaintenancePeriod message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @static + * @param {google.cloud.sql.v1beta4.DenyMaintenancePeriod} message DenyMaintenancePeriod + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DenyMaintenancePeriod.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startDate = ""; + object.endDate = ""; + object.time = ""; + } + if (message.startDate != null && message.hasOwnProperty("startDate")) + object.startDate = message.startDate; + if (message.endDate != null && message.hasOwnProperty("endDate")) + object.endDate = message.endDate; + if (message.time != null && message.hasOwnProperty("time")) + object.time = message.time; + return object; + }; + + /** + * Converts this DenyMaintenancePeriod to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @instance + * @returns {Object.} JSON object + */ + DenyMaintenancePeriod.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DenyMaintenancePeriod + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DenyMaintenancePeriod.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DenyMaintenancePeriod"; + }; + + return DenyMaintenancePeriod; + })(); + + v1beta4.InsightsConfig = (function() { + + /** + * Properties of an InsightsConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IInsightsConfig + * @property {boolean|null} [queryInsightsEnabled] InsightsConfig queryInsightsEnabled + * @property {boolean|null} [recordClientAddress] InsightsConfig recordClientAddress + * @property {boolean|null} [recordApplicationTags] InsightsConfig recordApplicationTags + * @property {google.protobuf.IInt32Value|null} [queryStringLength] InsightsConfig queryStringLength + * @property {google.protobuf.IInt32Value|null} [queryPlansPerMinute] InsightsConfig queryPlansPerMinute + * @property {google.protobuf.IBoolValue|null} [enhancedQueryInsightsEnabled] InsightsConfig enhancedQueryInsightsEnabled + */ + + /** + * Constructs a new InsightsConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an InsightsConfig. + * @implements IInsightsConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IInsightsConfig=} [properties] Properties to set + */ + function InsightsConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * InsightsConfig queryInsightsEnabled. + * @member {boolean} queryInsightsEnabled + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @instance + */ + InsightsConfig.prototype.queryInsightsEnabled = false; + + /** + * InsightsConfig recordClientAddress. + * @member {boolean} recordClientAddress + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @instance + */ + InsightsConfig.prototype.recordClientAddress = false; + + /** + * InsightsConfig recordApplicationTags. + * @member {boolean} recordApplicationTags + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @instance + */ + InsightsConfig.prototype.recordApplicationTags = false; + + /** + * InsightsConfig queryStringLength. + * @member {google.protobuf.IInt32Value|null|undefined} queryStringLength + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @instance + */ + InsightsConfig.prototype.queryStringLength = null; + + /** + * InsightsConfig queryPlansPerMinute. + * @member {google.protobuf.IInt32Value|null|undefined} queryPlansPerMinute + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @instance + */ + InsightsConfig.prototype.queryPlansPerMinute = null; + + /** + * InsightsConfig enhancedQueryInsightsEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} enhancedQueryInsightsEnabled + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @instance + */ + InsightsConfig.prototype.enhancedQueryInsightsEnabled = null; + + /** + * Creates a new InsightsConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @static + * @param {google.cloud.sql.v1beta4.IInsightsConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.InsightsConfig} InsightsConfig instance + */ + InsightsConfig.create = function create(properties) { + return new InsightsConfig(properties); + }; + + /** + * Encodes the specified InsightsConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.InsightsConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @static + * @param {google.cloud.sql.v1beta4.IInsightsConfig} message InsightsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InsightsConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.queryInsightsEnabled != null && Object.hasOwnProperty.call(message, "queryInsightsEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.queryInsightsEnabled); + if (message.recordClientAddress != null && Object.hasOwnProperty.call(message, "recordClientAddress")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.recordClientAddress); + if (message.recordApplicationTags != null && Object.hasOwnProperty.call(message, "recordApplicationTags")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.recordApplicationTags); + if (message.queryStringLength != null && Object.hasOwnProperty.call(message, "queryStringLength")) + $root.google.protobuf.Int32Value.encode(message.queryStringLength, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.queryPlansPerMinute != null && Object.hasOwnProperty.call(message, "queryPlansPerMinute")) + $root.google.protobuf.Int32Value.encode(message.queryPlansPerMinute, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.enhancedQueryInsightsEnabled != null && Object.hasOwnProperty.call(message, "enhancedQueryInsightsEnabled")) + $root.google.protobuf.BoolValue.encode(message.enhancedQueryInsightsEnabled, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified InsightsConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InsightsConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @static + * @param {google.cloud.sql.v1beta4.IInsightsConfig} message InsightsConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + InsightsConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an InsightsConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.InsightsConfig} InsightsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InsightsConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InsightsConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.queryInsightsEnabled = reader.bool(); + break; + } + case 2: { + message.recordClientAddress = reader.bool(); + break; + } + case 3: { + message.recordApplicationTags = reader.bool(); + break; + } + case 4: { + message.queryStringLength = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 5: { + message.queryPlansPerMinute = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 8: { + message.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an InsightsConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.InsightsConfig} InsightsConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + InsightsConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an InsightsConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + InsightsConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.queryInsightsEnabled != null && message.hasOwnProperty("queryInsightsEnabled")) + if (typeof message.queryInsightsEnabled !== "boolean") + return "queryInsightsEnabled: boolean expected"; + if (message.recordClientAddress != null && message.hasOwnProperty("recordClientAddress")) + if (typeof message.recordClientAddress !== "boolean") + return "recordClientAddress: boolean expected"; + if (message.recordApplicationTags != null && message.hasOwnProperty("recordApplicationTags")) + if (typeof message.recordApplicationTags !== "boolean") + return "recordApplicationTags: boolean expected"; + if (message.queryStringLength != null && message.hasOwnProperty("queryStringLength")) { + var error = $root.google.protobuf.Int32Value.verify(message.queryStringLength); + if (error) + return "queryStringLength." + error; + } + if (message.queryPlansPerMinute != null && message.hasOwnProperty("queryPlansPerMinute")) { + var error = $root.google.protobuf.Int32Value.verify(message.queryPlansPerMinute); + if (error) + return "queryPlansPerMinute." + error; + } + if (message.enhancedQueryInsightsEnabled != null && message.hasOwnProperty("enhancedQueryInsightsEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.enhancedQueryInsightsEnabled); + if (error) + return "enhancedQueryInsightsEnabled." + error; + } + return null; + }; + + /** + * Creates an InsightsConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.InsightsConfig} InsightsConfig + */ + InsightsConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.InsightsConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.InsightsConfig(); + if (object.queryInsightsEnabled != null) + message.queryInsightsEnabled = Boolean(object.queryInsightsEnabled); + if (object.recordClientAddress != null) + message.recordClientAddress = Boolean(object.recordClientAddress); + if (object.recordApplicationTags != null) + message.recordApplicationTags = Boolean(object.recordApplicationTags); + if (object.queryStringLength != null) { + if (typeof object.queryStringLength !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InsightsConfig.queryStringLength: object expected"); + message.queryStringLength = $root.google.protobuf.Int32Value.fromObject(object.queryStringLength); + } + if (object.queryPlansPerMinute != null) { + if (typeof object.queryPlansPerMinute !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InsightsConfig.queryPlansPerMinute: object expected"); + message.queryPlansPerMinute = $root.google.protobuf.Int32Value.fromObject(object.queryPlansPerMinute); + } + if (object.enhancedQueryInsightsEnabled != null) { + if (typeof object.enhancedQueryInsightsEnabled !== "object") + throw TypeError(".google.cloud.sql.v1beta4.InsightsConfig.enhancedQueryInsightsEnabled: object expected"); + message.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.fromObject(object.enhancedQueryInsightsEnabled); + } + return message; + }; + + /** + * Creates a plain object from an InsightsConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @static + * @param {google.cloud.sql.v1beta4.InsightsConfig} message InsightsConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + InsightsConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.queryInsightsEnabled = false; + object.recordClientAddress = false; + object.recordApplicationTags = false; + object.queryStringLength = null; + object.queryPlansPerMinute = null; + object.enhancedQueryInsightsEnabled = null; + } + if (message.queryInsightsEnabled != null && message.hasOwnProperty("queryInsightsEnabled")) + object.queryInsightsEnabled = message.queryInsightsEnabled; + if (message.recordClientAddress != null && message.hasOwnProperty("recordClientAddress")) + object.recordClientAddress = message.recordClientAddress; + if (message.recordApplicationTags != null && message.hasOwnProperty("recordApplicationTags")) + object.recordApplicationTags = message.recordApplicationTags; + if (message.queryStringLength != null && message.hasOwnProperty("queryStringLength")) + object.queryStringLength = $root.google.protobuf.Int32Value.toObject(message.queryStringLength, options); + if (message.queryPlansPerMinute != null && message.hasOwnProperty("queryPlansPerMinute")) + object.queryPlansPerMinute = $root.google.protobuf.Int32Value.toObject(message.queryPlansPerMinute, options); + if (message.enhancedQueryInsightsEnabled != null && message.hasOwnProperty("enhancedQueryInsightsEnabled")) + object.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.toObject(message.enhancedQueryInsightsEnabled, options); + return object; + }; + + /** + * Converts this InsightsConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @instance + * @returns {Object.} JSON object + */ + InsightsConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for InsightsConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.InsightsConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + InsightsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.InsightsConfig"; + }; + + return InsightsConfig; + })(); + + v1beta4.MySqlReplicaConfiguration = (function() { + + /** + * Properties of a MySqlReplicaConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @interface IMySqlReplicaConfiguration + * @property {string|null} [dumpFilePath] MySqlReplicaConfiguration dumpFilePath + * @property {string|null} [username] MySqlReplicaConfiguration username + * @property {string|null} [password] MySqlReplicaConfiguration password + * @property {google.protobuf.IInt32Value|null} [connectRetryInterval] MySqlReplicaConfiguration connectRetryInterval + * @property {google.protobuf.IInt64Value|null} [masterHeartbeatPeriod] MySqlReplicaConfiguration masterHeartbeatPeriod + * @property {string|null} [caCertificate] MySqlReplicaConfiguration caCertificate + * @property {string|null} [clientCertificate] MySqlReplicaConfiguration clientCertificate + * @property {string|null} [clientKey] MySqlReplicaConfiguration clientKey + * @property {string|null} [sslCipher] MySqlReplicaConfiguration sslCipher + * @property {google.protobuf.IBoolValue|null} [verifyServerCertificate] MySqlReplicaConfiguration verifyServerCertificate + * @property {string|null} [kind] MySqlReplicaConfiguration kind + */ + + /** + * Constructs a new MySqlReplicaConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a MySqlReplicaConfiguration. + * @implements IMySqlReplicaConfiguration + * @constructor + * @param {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration=} [properties] Properties to set + */ + function MySqlReplicaConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MySqlReplicaConfiguration dumpFilePath. + * @member {string} dumpFilePath + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.dumpFilePath = ""; + + /** + * MySqlReplicaConfiguration username. + * @member {string} username + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.username = ""; + + /** + * MySqlReplicaConfiguration password. + * @member {string} password + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.password = ""; + + /** + * MySqlReplicaConfiguration connectRetryInterval. + * @member {google.protobuf.IInt32Value|null|undefined} connectRetryInterval + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.connectRetryInterval = null; + + /** + * MySqlReplicaConfiguration masterHeartbeatPeriod. + * @member {google.protobuf.IInt64Value|null|undefined} masterHeartbeatPeriod + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.masterHeartbeatPeriod = null; + + /** + * MySqlReplicaConfiguration caCertificate. + * @member {string} caCertificate + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.caCertificate = ""; + + /** + * MySqlReplicaConfiguration clientCertificate. + * @member {string} clientCertificate + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.clientCertificate = ""; + + /** + * MySqlReplicaConfiguration clientKey. + * @member {string} clientKey + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.clientKey = ""; + + /** + * MySqlReplicaConfiguration sslCipher. + * @member {string} sslCipher + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.sslCipher = ""; + + /** + * MySqlReplicaConfiguration verifyServerCertificate. + * @member {google.protobuf.IBoolValue|null|undefined} verifyServerCertificate + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.verifyServerCertificate = null; + + /** + * MySqlReplicaConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + */ + MySqlReplicaConfiguration.prototype.kind = ""; + + /** + * Creates a new MySqlReplicaConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.MySqlReplicaConfiguration} MySqlReplicaConfiguration instance + */ + MySqlReplicaConfiguration.create = function create(properties) { + return new MySqlReplicaConfiguration(properties); + }; + + /** + * Encodes the specified MySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration} message MySqlReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MySqlReplicaConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dumpFilePath != null && Object.hasOwnProperty.call(message, "dumpFilePath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.dumpFilePath); + if (message.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); + if (message.connectRetryInterval != null && Object.hasOwnProperty.call(message, "connectRetryInterval")) + $root.google.protobuf.Int32Value.encode(message.connectRetryInterval, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.masterHeartbeatPeriod != null && Object.hasOwnProperty.call(message, "masterHeartbeatPeriod")) + $root.google.protobuf.Int64Value.encode(message.masterHeartbeatPeriod, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.caCertificate); + if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.clientCertificate); + if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.clientKey); + if (message.sslCipher != null && Object.hasOwnProperty.call(message, "sslCipher")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.sslCipher); + if (message.verifyServerCertificate != null && Object.hasOwnProperty.call(message, "verifyServerCertificate")) + $root.google.protobuf.BoolValue.encode(message.verifyServerCertificate, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.kind); + return writer; + }; + + /** + * Encodes the specified MySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration} message MySqlReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MySqlReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.MySqlReplicaConfiguration} MySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MySqlReplicaConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.dumpFilePath = reader.string(); + break; + } + case 2: { + message.username = reader.string(); + break; + } + case 3: { + message.password = reader.string(); + break; + } + case 4: { + message.connectRetryInterval = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 5: { + message.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 6: { + message.caCertificate = reader.string(); + break; + } + case 7: { + message.clientCertificate = reader.string(); + break; + } + case 8: { + message.clientKey = reader.string(); + break; + } + case 9: { + message.sslCipher = reader.string(); + break; + } + case 10: { + message.verifyServerCertificate = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 11: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.MySqlReplicaConfiguration} MySqlReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MySqlReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MySqlReplicaConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MySqlReplicaConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) + if (!$util.isString(message.dumpFilePath)) + return "dumpFilePath: string expected"; + if (message.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.connectRetryInterval != null && message.hasOwnProperty("connectRetryInterval")) { + var error = $root.google.protobuf.Int32Value.verify(message.connectRetryInterval); + if (error) + return "connectRetryInterval." + error; + } + if (message.masterHeartbeatPeriod != null && message.hasOwnProperty("masterHeartbeatPeriod")) { + var error = $root.google.protobuf.Int64Value.verify(message.masterHeartbeatPeriod); + if (error) + return "masterHeartbeatPeriod." + error; + } + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + if (!$util.isString(message.caCertificate)) + return "caCertificate: string expected"; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + if (!$util.isString(message.clientCertificate)) + return "clientCertificate: string expected"; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + if (!$util.isString(message.clientKey)) + return "clientKey: string expected"; + if (message.sslCipher != null && message.hasOwnProperty("sslCipher")) + if (!$util.isString(message.sslCipher)) + return "sslCipher: string expected"; + if (message.verifyServerCertificate != null && message.hasOwnProperty("verifyServerCertificate")) { + var error = $root.google.protobuf.BoolValue.verify(message.verifyServerCertificate); + if (error) + return "verifyServerCertificate." + error; + } + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a MySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.MySqlReplicaConfiguration} MySqlReplicaConfiguration + */ + MySqlReplicaConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration) + return object; + var message = new $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration(); + if (object.dumpFilePath != null) + message.dumpFilePath = String(object.dumpFilePath); + if (object.username != null) + message.username = String(object.username); + if (object.password != null) + message.password = String(object.password); + if (object.connectRetryInterval != null) { + if (typeof object.connectRetryInterval !== "object") + throw TypeError(".google.cloud.sql.v1beta4.MySqlReplicaConfiguration.connectRetryInterval: object expected"); + message.connectRetryInterval = $root.google.protobuf.Int32Value.fromObject(object.connectRetryInterval); + } + if (object.masterHeartbeatPeriod != null) { + if (typeof object.masterHeartbeatPeriod !== "object") + throw TypeError(".google.cloud.sql.v1beta4.MySqlReplicaConfiguration.masterHeartbeatPeriod: object expected"); + message.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.fromObject(object.masterHeartbeatPeriod); + } + if (object.caCertificate != null) + message.caCertificate = String(object.caCertificate); + if (object.clientCertificate != null) + message.clientCertificate = String(object.clientCertificate); + if (object.clientKey != null) + message.clientKey = String(object.clientKey); + if (object.sslCipher != null) + message.sslCipher = String(object.sslCipher); + if (object.verifyServerCertificate != null) { + if (typeof object.verifyServerCertificate !== "object") + throw TypeError(".google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verifyServerCertificate: object expected"); + message.verifyServerCertificate = $root.google.protobuf.BoolValue.fromObject(object.verifyServerCertificate); + } + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a MySqlReplicaConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.MySqlReplicaConfiguration} message MySqlReplicaConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MySqlReplicaConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.dumpFilePath = ""; + object.username = ""; + object.password = ""; + object.connectRetryInterval = null; + object.masterHeartbeatPeriod = null; + object.caCertificate = ""; + object.clientCertificate = ""; + object.clientKey = ""; + object.sslCipher = ""; + object.verifyServerCertificate = null; + object.kind = ""; + } + if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) + object.dumpFilePath = message.dumpFilePath; + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + if (message.connectRetryInterval != null && message.hasOwnProperty("connectRetryInterval")) + object.connectRetryInterval = $root.google.protobuf.Int32Value.toObject(message.connectRetryInterval, options); + if (message.masterHeartbeatPeriod != null && message.hasOwnProperty("masterHeartbeatPeriod")) + object.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.toObject(message.masterHeartbeatPeriod, options); + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + object.caCertificate = message.caCertificate; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + object.clientCertificate = message.clientCertificate; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + object.clientKey = message.clientKey; + if (message.sslCipher != null && message.hasOwnProperty("sslCipher")) + object.sslCipher = message.sslCipher; + if (message.verifyServerCertificate != null && message.hasOwnProperty("verifyServerCertificate")) + object.verifyServerCertificate = $root.google.protobuf.BoolValue.toObject(message.verifyServerCertificate, options); + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this MySqlReplicaConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @instance + * @returns {Object.} JSON object + */ + MySqlReplicaConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MySqlReplicaConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MySqlReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.MySqlReplicaConfiguration"; + }; + + return MySqlReplicaConfiguration; + })(); + + v1beta4.SelectedObjects = (function() { + + /** + * Properties of a SelectedObjects. + * @memberof google.cloud.sql.v1beta4 + * @interface ISelectedObjects + * @property {string|null} [database] SelectedObjects database + */ + + /** + * Constructs a new SelectedObjects. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SelectedObjects. + * @implements ISelectedObjects + * @constructor + * @param {google.cloud.sql.v1beta4.ISelectedObjects=} [properties] Properties to set + */ + function SelectedObjects(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SelectedObjects database. + * @member {string} database + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @instance + */ + SelectedObjects.prototype.database = ""; + + /** + * Creates a new SelectedObjects instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @static + * @param {google.cloud.sql.v1beta4.ISelectedObjects=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SelectedObjects} SelectedObjects instance + */ + SelectedObjects.create = function create(properties) { + return new SelectedObjects(properties); + }; + + /** + * Encodes the specified SelectedObjects message. Does not implicitly {@link google.cloud.sql.v1beta4.SelectedObjects.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @static + * @param {google.cloud.sql.v1beta4.ISelectedObjects} message SelectedObjects message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectedObjects.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.database != null && Object.hasOwnProperty.call(message, "database")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); + return writer; + }; + + /** + * Encodes the specified SelectedObjects message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SelectedObjects.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @static + * @param {google.cloud.sql.v1beta4.ISelectedObjects} message SelectedObjects message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectedObjects.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectedObjects message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SelectedObjects} SelectedObjects + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectedObjects.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SelectedObjects(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.database = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectedObjects message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SelectedObjects} SelectedObjects + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectedObjects.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectedObjects message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectedObjects.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.database != null && message.hasOwnProperty("database")) + if (!$util.isString(message.database)) + return "database: string expected"; + return null; + }; + + /** + * Creates a SelectedObjects message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SelectedObjects} SelectedObjects + */ + SelectedObjects.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SelectedObjects) + return object; + var message = new $root.google.cloud.sql.v1beta4.SelectedObjects(); + if (object.database != null) + message.database = String(object.database); + return message; + }; + + /** + * Creates a plain object from a SelectedObjects message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @static + * @param {google.cloud.sql.v1beta4.SelectedObjects} message SelectedObjects + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectedObjects.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.database = ""; + if (message.database != null && message.hasOwnProperty("database")) + object.database = message.database; + return object; + }; + + /** + * Converts this SelectedObjects to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @instance + * @returns {Object.} JSON object + */ + SelectedObjects.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectedObjects + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SelectedObjects + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectedObjects.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SelectedObjects"; + }; + + return SelectedObjects; + })(); + + v1beta4.OnPremisesConfiguration = (function() { + + /** + * Properties of an OnPremisesConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @interface IOnPremisesConfiguration + * @property {string|null} [hostPort] OnPremisesConfiguration hostPort + * @property {string|null} [kind] OnPremisesConfiguration kind + * @property {string|null} [username] OnPremisesConfiguration username + * @property {string|null} [password] OnPremisesConfiguration password + * @property {string|null} [caCertificate] OnPremisesConfiguration caCertificate + * @property {string|null} [clientCertificate] OnPremisesConfiguration clientCertificate + * @property {string|null} [clientKey] OnPremisesConfiguration clientKey + * @property {string|null} [dumpFilePath] OnPremisesConfiguration dumpFilePath + * @property {google.cloud.sql.v1beta4.IInstanceReference|null} [sourceInstance] OnPremisesConfiguration sourceInstance + * @property {Array.|null} [selectedObjects] OnPremisesConfiguration selectedObjects + * @property {google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption|null} [sslOption] OnPremisesConfiguration sslOption + */ + + /** + * Constructs a new OnPremisesConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an OnPremisesConfiguration. + * @implements IOnPremisesConfiguration + * @constructor + * @param {google.cloud.sql.v1beta4.IOnPremisesConfiguration=} [properties] Properties to set + */ + function OnPremisesConfiguration(properties) { + this.selectedObjects = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OnPremisesConfiguration hostPort. + * @member {string} hostPort + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.hostPort = ""; + + /** + * OnPremisesConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.kind = ""; + + /** + * OnPremisesConfiguration username. + * @member {string} username + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.username = ""; + + /** + * OnPremisesConfiguration password. + * @member {string} password + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.password = ""; + + /** + * OnPremisesConfiguration caCertificate. + * @member {string} caCertificate + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.caCertificate = ""; + + /** + * OnPremisesConfiguration clientCertificate. + * @member {string} clientCertificate + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.clientCertificate = ""; + + /** + * OnPremisesConfiguration clientKey. + * @member {string} clientKey + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.clientKey = ""; + + /** + * OnPremisesConfiguration dumpFilePath. + * @member {string} dumpFilePath + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.dumpFilePath = ""; + + /** + * OnPremisesConfiguration sourceInstance. + * @member {google.cloud.sql.v1beta4.IInstanceReference|null|undefined} sourceInstance + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.sourceInstance = null; + + /** + * OnPremisesConfiguration selectedObjects. + * @member {Array.} selectedObjects + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.selectedObjects = $util.emptyArray; + + /** + * OnPremisesConfiguration sslOption. + * @member {google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption} sslOption + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + */ + OnPremisesConfiguration.prototype.sslOption = 0; + + /** + * Creates a new OnPremisesConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IOnPremisesConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.OnPremisesConfiguration} OnPremisesConfiguration instance + */ + OnPremisesConfiguration.create = function create(properties) { + return new OnPremisesConfiguration(properties); + }; + + /** + * Encodes the specified OnPremisesConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.OnPremisesConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IOnPremisesConfiguration} message OnPremisesConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnPremisesConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hostPort != null && Object.hasOwnProperty.call(message, "hostPort")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.hostPort); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + if (message.username != null && Object.hasOwnProperty.call(message, "username")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.username); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.password); + if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.caCertificate); + if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.clientCertificate); + if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.clientKey); + if (message.dumpFilePath != null && Object.hasOwnProperty.call(message, "dumpFilePath")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.dumpFilePath); + if (message.sourceInstance != null && Object.hasOwnProperty.call(message, "sourceInstance")) + $root.google.cloud.sql.v1beta4.InstanceReference.encode(message.sourceInstance, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.selectedObjects != null && message.selectedObjects.length) + for (var i = 0; i < message.selectedObjects.length; ++i) + $root.google.cloud.sql.v1beta4.SelectedObjects.encode(message.selectedObjects[i], writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.sslOption != null && Object.hasOwnProperty.call(message, "sslOption")) + writer.uint32(/* id 18, wireType 0 =*/144).int32(message.sslOption); + return writer; + }; + + /** + * Encodes the specified OnPremisesConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OnPremisesConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IOnPremisesConfiguration} message OnPremisesConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OnPremisesConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OnPremisesConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.OnPremisesConfiguration} OnPremisesConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnPremisesConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.OnPremisesConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.hostPort = reader.string(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + case 3: { + message.username = reader.string(); + break; + } + case 4: { + message.password = reader.string(); + break; + } + case 5: { + message.caCertificate = reader.string(); + break; + } + case 6: { + message.clientCertificate = reader.string(); + break; + } + case 7: { + message.clientKey = reader.string(); + break; + } + case 8: { + message.dumpFilePath = reader.string(); + break; + } + case 15: { + message.sourceInstance = $root.google.cloud.sql.v1beta4.InstanceReference.decode(reader, reader.uint32()); + break; + } + case 16: { + if (!(message.selectedObjects && message.selectedObjects.length)) + message.selectedObjects = []; + message.selectedObjects.push($root.google.cloud.sql.v1beta4.SelectedObjects.decode(reader, reader.uint32())); + break; + } + case 18: { + message.sslOption = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OnPremisesConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.OnPremisesConfiguration} OnPremisesConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OnPremisesConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OnPremisesConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OnPremisesConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hostPort != null && message.hasOwnProperty("hostPort")) + if (!$util.isString(message.hostPort)) + return "hostPort: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.username != null && message.hasOwnProperty("username")) + if (!$util.isString(message.username)) + return "username: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + if (!$util.isString(message.caCertificate)) + return "caCertificate: string expected"; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + if (!$util.isString(message.clientCertificate)) + return "clientCertificate: string expected"; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + if (!$util.isString(message.clientKey)) + return "clientKey: string expected"; + if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) + if (!$util.isString(message.dumpFilePath)) + return "dumpFilePath: string expected"; + if (message.sourceInstance != null && message.hasOwnProperty("sourceInstance")) { + var error = $root.google.cloud.sql.v1beta4.InstanceReference.verify(message.sourceInstance); + if (error) + return "sourceInstance." + error; + } + if (message.selectedObjects != null && message.hasOwnProperty("selectedObjects")) { + if (!Array.isArray(message.selectedObjects)) + return "selectedObjects: array expected"; + for (var i = 0; i < message.selectedObjects.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.SelectedObjects.verify(message.selectedObjects[i]); + if (error) + return "selectedObjects." + error; + } + } + if (message.sslOption != null && message.hasOwnProperty("sslOption")) + switch (message.sslOption) { + default: + return "sslOption: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + return null; + }; + + /** + * Creates an OnPremisesConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.OnPremisesConfiguration} OnPremisesConfiguration + */ + OnPremisesConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.OnPremisesConfiguration) + return object; + var message = new $root.google.cloud.sql.v1beta4.OnPremisesConfiguration(); + if (object.hostPort != null) + message.hostPort = String(object.hostPort); + if (object.kind != null) + message.kind = String(object.kind); + if (object.username != null) + message.username = String(object.username); + if (object.password != null) + message.password = String(object.password); + if (object.caCertificate != null) + message.caCertificate = String(object.caCertificate); + if (object.clientCertificate != null) + message.clientCertificate = String(object.clientCertificate); + if (object.clientKey != null) + message.clientKey = String(object.clientKey); + if (object.dumpFilePath != null) + message.dumpFilePath = String(object.dumpFilePath); + if (object.sourceInstance != null) { + if (typeof object.sourceInstance !== "object") + throw TypeError(".google.cloud.sql.v1beta4.OnPremisesConfiguration.sourceInstance: object expected"); + message.sourceInstance = $root.google.cloud.sql.v1beta4.InstanceReference.fromObject(object.sourceInstance); + } + if (object.selectedObjects) { + if (!Array.isArray(object.selectedObjects)) + throw TypeError(".google.cloud.sql.v1beta4.OnPremisesConfiguration.selectedObjects: array expected"); + message.selectedObjects = []; + for (var i = 0; i < object.selectedObjects.length; ++i) { + if (typeof object.selectedObjects[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.OnPremisesConfiguration.selectedObjects: object expected"); + message.selectedObjects[i] = $root.google.cloud.sql.v1beta4.SelectedObjects.fromObject(object.selectedObjects[i]); + } + } + switch (object.sslOption) { + default: + if (typeof object.sslOption === "number") { + message.sslOption = object.sslOption; + break; + } + break; + case "SSL_OPTION_UNSPECIFIED": + case 0: + message.sslOption = 0; + break; + case "DISABLE": + case 1: + message.sslOption = 1; + break; + case "REQUIRE": + case 2: + message.sslOption = 2; + break; + case "VERIFY_CA": + case 3: + message.sslOption = 3; + break; + } + return message; + }; + + /** + * Creates a plain object from an OnPremisesConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @static + * @param {google.cloud.sql.v1beta4.OnPremisesConfiguration} message OnPremisesConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OnPremisesConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.selectedObjects = []; + if (options.defaults) { + object.hostPort = ""; + object.kind = ""; + object.username = ""; + object.password = ""; + object.caCertificate = ""; + object.clientCertificate = ""; + object.clientKey = ""; + object.dumpFilePath = ""; + object.sourceInstance = null; + object.sslOption = options.enums === String ? "SSL_OPTION_UNSPECIFIED" : 0; + } + if (message.hostPort != null && message.hasOwnProperty("hostPort")) + object.hostPort = message.hostPort; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.username != null && message.hasOwnProperty("username")) + object.username = message.username; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) + object.caCertificate = message.caCertificate; + if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) + object.clientCertificate = message.clientCertificate; + if (message.clientKey != null && message.hasOwnProperty("clientKey")) + object.clientKey = message.clientKey; + if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) + object.dumpFilePath = message.dumpFilePath; + if (message.sourceInstance != null && message.hasOwnProperty("sourceInstance")) + object.sourceInstance = $root.google.cloud.sql.v1beta4.InstanceReference.toObject(message.sourceInstance, options); + if (message.selectedObjects && message.selectedObjects.length) { + object.selectedObjects = []; + for (var j = 0; j < message.selectedObjects.length; ++j) + object.selectedObjects[j] = $root.google.cloud.sql.v1beta4.SelectedObjects.toObject(message.selectedObjects[j], options); + } + if (message.sslOption != null && message.hasOwnProperty("sslOption")) + object.sslOption = options.enums === String ? $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption[message.sslOption] === undefined ? message.sslOption : $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption[message.sslOption] : message.sslOption; + return object; + }; + + /** + * Converts this OnPremisesConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @instance + * @returns {Object.} JSON object + */ + OnPremisesConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OnPremisesConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OnPremisesConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.OnPremisesConfiguration"; + }; + + /** + * SslOption enum. + * @name google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption + * @enum {number} + * @property {number} SSL_OPTION_UNSPECIFIED=0 SSL_OPTION_UNSPECIFIED value + * @property {number} DISABLE=1 DISABLE value + * @property {number} REQUIRE=2 REQUIRE value + * @property {number} VERIFY_CA=3 VERIFY_CA value + */ + OnPremisesConfiguration.SslOption = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SSL_OPTION_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISABLE"] = 1; + values[valuesById[2] = "REQUIRE"] = 2; + values[valuesById[3] = "VERIFY_CA"] = 3; + return values; + })(); + + return OnPremisesConfiguration; + })(); + + v1beta4.DiskEncryptionConfiguration = (function() { + + /** + * Properties of a DiskEncryptionConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @interface IDiskEncryptionConfiguration + * @property {string|null} [kmsKeyName] DiskEncryptionConfiguration kmsKeyName + * @property {string|null} [kind] DiskEncryptionConfiguration kind + */ + + /** + * Constructs a new DiskEncryptionConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DiskEncryptionConfiguration. + * @implements IDiskEncryptionConfiguration + * @constructor + * @param {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration=} [properties] Properties to set + */ + function DiskEncryptionConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DiskEncryptionConfiguration kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @instance + */ + DiskEncryptionConfiguration.prototype.kmsKeyName = ""; + + /** + * DiskEncryptionConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @instance + */ + DiskEncryptionConfiguration.prototype.kind = ""; + + /** + * Creates a new DiskEncryptionConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DiskEncryptionConfiguration} DiskEncryptionConfiguration instance + */ + DiskEncryptionConfiguration.create = function create(properties) { + return new DiskEncryptionConfiguration(properties); + }; + + /** + * Encodes the specified DiskEncryptionConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration} message DiskEncryptionConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DiskEncryptionConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kmsKeyName); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + return writer; + }; + + /** + * Encodes the specified DiskEncryptionConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration} message DiskEncryptionConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DiskEncryptionConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DiskEncryptionConfiguration} DiskEncryptionConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DiskEncryptionConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kmsKeyName = reader.string(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DiskEncryptionConfiguration} DiskEncryptionConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DiskEncryptionConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DiskEncryptionConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DiskEncryptionConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a DiskEncryptionConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DiskEncryptionConfiguration} DiskEncryptionConfiguration + */ + DiskEncryptionConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration) + return object; + var message = new $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration(); + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a DiskEncryptionConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @static + * @param {google.cloud.sql.v1beta4.DiskEncryptionConfiguration} message DiskEncryptionConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DiskEncryptionConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kmsKeyName = ""; + object.kind = ""; + } + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this DiskEncryptionConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @instance + * @returns {Object.} JSON object + */ + DiskEncryptionConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DiskEncryptionConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DiskEncryptionConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DiskEncryptionConfiguration"; + }; + + return DiskEncryptionConfiguration; + })(); + + v1beta4.DiskEncryptionStatus = (function() { + + /** + * Properties of a DiskEncryptionStatus. + * @memberof google.cloud.sql.v1beta4 + * @interface IDiskEncryptionStatus + * @property {string|null} [kmsKeyVersionName] DiskEncryptionStatus kmsKeyVersionName + * @property {string|null} [kind] DiskEncryptionStatus kind + */ + + /** + * Constructs a new DiskEncryptionStatus. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DiskEncryptionStatus. + * @implements IDiskEncryptionStatus + * @constructor + * @param {google.cloud.sql.v1beta4.IDiskEncryptionStatus=} [properties] Properties to set + */ + function DiskEncryptionStatus(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DiskEncryptionStatus kmsKeyVersionName. + * @member {string} kmsKeyVersionName + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @instance + */ + DiskEncryptionStatus.prototype.kmsKeyVersionName = ""; + + /** + * DiskEncryptionStatus kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @instance + */ + DiskEncryptionStatus.prototype.kind = ""; + + /** + * Creates a new DiskEncryptionStatus instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @static + * @param {google.cloud.sql.v1beta4.IDiskEncryptionStatus=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DiskEncryptionStatus} DiskEncryptionStatus instance + */ + DiskEncryptionStatus.create = function create(properties) { + return new DiskEncryptionStatus(properties); + }; + + /** + * Encodes the specified DiskEncryptionStatus message. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionStatus.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @static + * @param {google.cloud.sql.v1beta4.IDiskEncryptionStatus} message DiskEncryptionStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DiskEncryptionStatus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kmsKeyVersionName != null && Object.hasOwnProperty.call(message, "kmsKeyVersionName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kmsKeyVersionName); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); + return writer; + }; + + /** + * Encodes the specified DiskEncryptionStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @static + * @param {google.cloud.sql.v1beta4.IDiskEncryptionStatus} message DiskEncryptionStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DiskEncryptionStatus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DiskEncryptionStatus message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DiskEncryptionStatus} DiskEncryptionStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DiskEncryptionStatus.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DiskEncryptionStatus(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kmsKeyVersionName = reader.string(); + break; + } + case 2: { + message.kind = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DiskEncryptionStatus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DiskEncryptionStatus} DiskEncryptionStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DiskEncryptionStatus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DiskEncryptionStatus message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DiskEncryptionStatus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + if (!$util.isString(message.kmsKeyVersionName)) + return "kmsKeyVersionName: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + return null; + }; + + /** + * Creates a DiskEncryptionStatus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DiskEncryptionStatus} DiskEncryptionStatus + */ + DiskEncryptionStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DiskEncryptionStatus) + return object; + var message = new $root.google.cloud.sql.v1beta4.DiskEncryptionStatus(); + if (object.kmsKeyVersionName != null) + message.kmsKeyVersionName = String(object.kmsKeyVersionName); + if (object.kind != null) + message.kind = String(object.kind); + return message; + }; + + /** + * Creates a plain object from a DiskEncryptionStatus message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @static + * @param {google.cloud.sql.v1beta4.DiskEncryptionStatus} message DiskEncryptionStatus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DiskEncryptionStatus.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kmsKeyVersionName = ""; + object.kind = ""; + } + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + object.kmsKeyVersionName = message.kmsKeyVersionName; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + return object; + }; + + /** + * Converts this DiskEncryptionStatus to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @instance + * @returns {Object.} JSON object + */ + DiskEncryptionStatus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DiskEncryptionStatus + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DiskEncryptionStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DiskEncryptionStatus"; + }; + + return DiskEncryptionStatus; + })(); + + /** + * SqlMaintenanceType enum. + * @name google.cloud.sql.v1beta4.SqlMaintenanceType + * @enum {number} + * @property {number} SQL_MAINTENANCE_TYPE_UNSPECIFIED=0 SQL_MAINTENANCE_TYPE_UNSPECIFIED value + * @property {number} INSTANCE_MAINTENANCE=1 INSTANCE_MAINTENANCE value + * @property {number} REPLICA_INCLUDED_MAINTENANCE=2 REPLICA_INCLUDED_MAINTENANCE value + * @property {number} INSTANCE_SELF_SERVICE_MAINTENANCE=3 INSTANCE_SELF_SERVICE_MAINTENANCE value + * @property {number} REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE=4 REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE value + */ + v1beta4.SqlMaintenanceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_MAINTENANCE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INSTANCE_MAINTENANCE"] = 1; + values[valuesById[2] = "REPLICA_INCLUDED_MAINTENANCE"] = 2; + values[valuesById[3] = "INSTANCE_SELF_SERVICE_MAINTENANCE"] = 3; + values[valuesById[4] = "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE"] = 4; + return values; + })(); + + v1beta4.SqlSubOperationType = (function() { + + /** + * Properties of a SqlSubOperationType. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlSubOperationType + * @property {google.cloud.sql.v1beta4.SqlMaintenanceType|null} [maintenanceType] SqlSubOperationType maintenanceType + */ + + /** + * Constructs a new SqlSubOperationType. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlSubOperationType. + * @implements ISqlSubOperationType + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlSubOperationType=} [properties] Properties to set + */ + function SqlSubOperationType(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlSubOperationType maintenanceType. + * @member {google.cloud.sql.v1beta4.SqlMaintenanceType|null|undefined} maintenanceType + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @instance + */ + SqlSubOperationType.prototype.maintenanceType = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * SqlSubOperationType subOperationDetails. + * @member {"maintenanceType"|undefined} subOperationDetails + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @instance + */ + Object.defineProperty(SqlSubOperationType.prototype, "subOperationDetails", { + get: $util.oneOfGetter($oneOfFields = ["maintenanceType"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlSubOperationType instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @static + * @param {google.cloud.sql.v1beta4.ISqlSubOperationType=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlSubOperationType} SqlSubOperationType instance + */ + SqlSubOperationType.create = function create(properties) { + return new SqlSubOperationType(properties); + }; + + /** + * Encodes the specified SqlSubOperationType message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSubOperationType.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @static + * @param {google.cloud.sql.v1beta4.ISqlSubOperationType} message SqlSubOperationType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSubOperationType.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.maintenanceType != null && Object.hasOwnProperty.call(message, "maintenanceType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.maintenanceType); + return writer; + }; + + /** + * Encodes the specified SqlSubOperationType message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSubOperationType.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @static + * @param {google.cloud.sql.v1beta4.ISqlSubOperationType} message SqlSubOperationType message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlSubOperationType.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlSubOperationType message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlSubOperationType} SqlSubOperationType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSubOperationType.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlSubOperationType(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.maintenanceType = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlSubOperationType message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlSubOperationType} SqlSubOperationType + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlSubOperationType.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlSubOperationType message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlSubOperationType.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.maintenanceType != null && message.hasOwnProperty("maintenanceType")) { + properties.subOperationDetails = 1; + switch (message.maintenanceType) { + default: + return "maintenanceType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + } + return null; + }; + + /** + * Creates a SqlSubOperationType message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlSubOperationType} SqlSubOperationType + */ + SqlSubOperationType.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlSubOperationType) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlSubOperationType(); + switch (object.maintenanceType) { + default: + if (typeof object.maintenanceType === "number") { + message.maintenanceType = object.maintenanceType; + break; + } + break; + case "SQL_MAINTENANCE_TYPE_UNSPECIFIED": + case 0: + message.maintenanceType = 0; + break; + case "INSTANCE_MAINTENANCE": + case 1: + message.maintenanceType = 1; + break; + case "REPLICA_INCLUDED_MAINTENANCE": + case 2: + message.maintenanceType = 2; + break; + case "INSTANCE_SELF_SERVICE_MAINTENANCE": + case 3: + message.maintenanceType = 3; + break; + case "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE": + case 4: + message.maintenanceType = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a SqlSubOperationType message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @static + * @param {google.cloud.sql.v1beta4.SqlSubOperationType} message SqlSubOperationType + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlSubOperationType.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.maintenanceType != null && message.hasOwnProperty("maintenanceType")) { + object.maintenanceType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlMaintenanceType[message.maintenanceType] === undefined ? message.maintenanceType : $root.google.cloud.sql.v1beta4.SqlMaintenanceType[message.maintenanceType] : message.maintenanceType; + if (options.oneofs) + object.subOperationDetails = "maintenanceType"; + } + return object; + }; + + /** + * Converts this SqlSubOperationType to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @instance + * @returns {Object.} JSON object + */ + SqlSubOperationType.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlSubOperationType + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlSubOperationType + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlSubOperationType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlSubOperationType"; + }; + + return SqlSubOperationType; + })(); + + v1beta4.Operation = (function() { + + /** + * Properties of an Operation. + * @memberof google.cloud.sql.v1beta4 + * @interface IOperation + * @property {string|null} [kind] Operation kind + * @property {string|null} [targetLink] Operation targetLink + * @property {google.cloud.sql.v1beta4.Operation.SqlOperationStatus|null} [status] Operation status + * @property {string|null} [user] Operation user + * @property {google.protobuf.ITimestamp|null} [insertTime] Operation insertTime + * @property {google.protobuf.ITimestamp|null} [startTime] Operation startTime + * @property {google.protobuf.ITimestamp|null} [endTime] Operation endTime + * @property {google.cloud.sql.v1beta4.IOperationErrors|null} [error] Operation error + * @property {google.cloud.sql.v1beta4.IApiWarning|null} [apiWarning] Operation apiWarning + * @property {google.cloud.sql.v1beta4.Operation.SqlOperationType|null} [operationType] Operation operationType + * @property {google.cloud.sql.v1beta4.IImportContext|null} [importContext] Operation importContext + * @property {google.cloud.sql.v1beta4.IExportContext|null} [exportContext] Operation exportContext + * @property {google.cloud.sql.v1beta4.IBackupContext|null} [backupContext] Operation backupContext + * @property {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null} [preCheckMajorVersionUpgradeContext] Operation preCheckMajorVersionUpgradeContext + * @property {string|null} [name] Operation name + * @property {string|null} [targetId] Operation targetId + * @property {string|null} [selfLink] Operation selfLink + * @property {string|null} [targetProject] Operation targetProject + * @property {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null} [acquireSsrsLeaseContext] Operation acquireSsrsLeaseContext + * @property {google.cloud.sql.v1beta4.ISqlSubOperationType|null} [subOperationType] Operation subOperationType + */ + + /** + * Constructs a new Operation. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an Operation. + * @implements IOperation + * @constructor + * @param {google.cloud.sql.v1beta4.IOperation=} [properties] Properties to set + */ + function Operation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Operation kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.kind = ""; + + /** + * Operation targetLink. + * @member {string} targetLink + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.targetLink = ""; + + /** + * Operation status. + * @member {google.cloud.sql.v1beta4.Operation.SqlOperationStatus} status + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.status = 0; + + /** + * Operation user. + * @member {string} user + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.user = ""; + + /** + * Operation insertTime. + * @member {google.protobuf.ITimestamp|null|undefined} insertTime + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.insertTime = null; + + /** + * Operation startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.startTime = null; + + /** + * Operation endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.endTime = null; + + /** + * Operation error. + * @member {google.cloud.sql.v1beta4.IOperationErrors|null|undefined} error + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.error = null; + + /** + * Operation apiWarning. + * @member {google.cloud.sql.v1beta4.IApiWarning|null|undefined} apiWarning + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.apiWarning = null; + + /** + * Operation operationType. + * @member {google.cloud.sql.v1beta4.Operation.SqlOperationType} operationType + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.operationType = 0; + + /** + * Operation importContext. + * @member {google.cloud.sql.v1beta4.IImportContext|null|undefined} importContext + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.importContext = null; + + /** + * Operation exportContext. + * @member {google.cloud.sql.v1beta4.IExportContext|null|undefined} exportContext + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.exportContext = null; + + /** + * Operation backupContext. + * @member {google.cloud.sql.v1beta4.IBackupContext|null|undefined} backupContext + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.backupContext = null; + + /** + * Operation preCheckMajorVersionUpgradeContext. + * @member {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null|undefined} preCheckMajorVersionUpgradeContext + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.preCheckMajorVersionUpgradeContext = null; + + /** + * Operation name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.name = ""; + + /** + * Operation targetId. + * @member {string} targetId + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.targetId = ""; + + /** + * Operation selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.selfLink = ""; + + /** + * Operation targetProject. + * @member {string} targetProject + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.targetProject = ""; + + /** + * Operation acquireSsrsLeaseContext. + * @member {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null|undefined} acquireSsrsLeaseContext + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.acquireSsrsLeaseContext = null; + + /** + * Operation subOperationType. + * @member {google.cloud.sql.v1beta4.ISqlSubOperationType|null|undefined} subOperationType + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + */ + Operation.prototype.subOperationType = null; + + /** + * Creates a new Operation instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.Operation + * @static + * @param {google.cloud.sql.v1beta4.IOperation=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.Operation} Operation instance + */ + Operation.create = function create(properties) { + return new Operation(properties); + }; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.cloud.sql.v1beta4.Operation.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.Operation + * @static + * @param {google.cloud.sql.v1beta4.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.targetLink != null && Object.hasOwnProperty.call(message, "targetLink")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetLink); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.status); + if (message.user != null && Object.hasOwnProperty.call(message, "user")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.user); + if (message.insertTime != null && Object.hasOwnProperty.call(message, "insertTime")) + $root.google.protobuf.Timestamp.encode(message.insertTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.cloud.sql.v1beta4.OperationErrors.encode(message.error, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.operationType != null && Object.hasOwnProperty.call(message, "operationType")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.operationType); + if (message.importContext != null && Object.hasOwnProperty.call(message, "importContext")) + $root.google.cloud.sql.v1beta4.ImportContext.encode(message.importContext, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.exportContext != null && Object.hasOwnProperty.call(message, "exportContext")) + $root.google.cloud.sql.v1beta4.ExportContext.encode(message.exportContext, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.name); + if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.targetId); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 14, wireType 2 =*/114).string(message.selfLink); + if (message.targetProject != null && Object.hasOwnProperty.call(message, "targetProject")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.targetProject); + if (message.backupContext != null && Object.hasOwnProperty.call(message, "backupContext")) + $root.google.cloud.sql.v1beta4.BackupContext.encode(message.backupContext, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.apiWarning != null && Object.hasOwnProperty.call(message, "apiWarning")) + $root.google.cloud.sql.v1beta4.ApiWarning.encode(message.apiWarning, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + if (message.acquireSsrsLeaseContext != null && Object.hasOwnProperty.call(message, "acquireSsrsLeaseContext")) + $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.encode(message.acquireSsrsLeaseContext, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.subOperationType != null && Object.hasOwnProperty.call(message, "subOperationType")) + $root.google.cloud.sql.v1beta4.SqlSubOperationType.encode(message.subOperationType, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); + if (message.preCheckMajorVersionUpgradeContext != null && Object.hasOwnProperty.call(message, "preCheckMajorVersionUpgradeContext")) + $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.encode(message.preCheckMajorVersionUpgradeContext, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Operation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.Operation + * @static + * @param {google.cloud.sql.v1beta4.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Operation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.targetLink = reader.string(); + break; + } + case 3: { + message.status = reader.int32(); + break; + } + case 4: { + message.user = reader.string(); + break; + } + case 5: { + message.insertTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 8: { + message.error = $root.google.cloud.sql.v1beta4.OperationErrors.decode(reader, reader.uint32()); + break; + } + case 19: { + message.apiWarning = $root.google.cloud.sql.v1beta4.ApiWarning.decode(reader, reader.uint32()); + break; + } + case 9: { + message.operationType = reader.int32(); + break; + } + case 10: { + message.importContext = $root.google.cloud.sql.v1beta4.ImportContext.decode(reader, reader.uint32()); + break; + } + case 11: { + message.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.decode(reader, reader.uint32()); + break; + } + case 17: { + message.backupContext = $root.google.cloud.sql.v1beta4.BackupContext.decode(reader, reader.uint32()); + break; + } + case 50: { + message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.decode(reader, reader.uint32()); + break; + } + case 12: { + message.name = reader.string(); + break; + } + case 13: { + message.targetId = reader.string(); + break; + } + case 14: { + message.selfLink = reader.string(); + break; + } + case 15: { + message.targetProject = reader.string(); + break; + } + case 20: { + message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.decode(reader, reader.uint32()); + break; + } + case 48: { + message.subOperationType = $root.google.cloud.sql.v1beta4.SqlSubOperationType.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Operation message. + * @function verify + * @memberof google.cloud.sql.v1beta4.Operation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Operation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.targetLink != null && message.hasOwnProperty("targetLink")) + if (!$util.isString(message.targetLink)) + return "targetLink: string expected"; + if (message.status != null && message.hasOwnProperty("status")) + switch (message.status) { + default: + return "status: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.user != null && message.hasOwnProperty("user")) + if (!$util.isString(message.user)) + return "user: string expected"; + if (message.insertTime != null && message.hasOwnProperty("insertTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.insertTime); + if (error) + return "insertTime." + error; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.error != null && message.hasOwnProperty("error")) { + var error = $root.google.cloud.sql.v1beta4.OperationErrors.verify(message.error); + if (error) + return "error." + error; + } + if (message.apiWarning != null && message.hasOwnProperty("apiWarning")) { + var error = $root.google.cloud.sql.v1beta4.ApiWarning.verify(message.apiWarning); + if (error) + return "apiWarning." + error; + } + if (message.operationType != null && message.hasOwnProperty("operationType")) + switch (message.operationType) { + default: + return "operationType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + break; + } + if (message.importContext != null && message.hasOwnProperty("importContext")) { + var error = $root.google.cloud.sql.v1beta4.ImportContext.verify(message.importContext); + if (error) + return "importContext." + error; + } + if (message.exportContext != null && message.hasOwnProperty("exportContext")) { + var error = $root.google.cloud.sql.v1beta4.ExportContext.verify(message.exportContext); + if (error) + return "exportContext." + error; + } + if (message.backupContext != null && message.hasOwnProperty("backupContext")) { + var error = $root.google.cloud.sql.v1beta4.BackupContext.verify(message.backupContext); + if (error) + return "backupContext." + error; + } + if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) { + var error = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify(message.preCheckMajorVersionUpgradeContext); + if (error) + return "preCheckMajorVersionUpgradeContext." + error; + } + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.targetId != null && message.hasOwnProperty("targetId")) + if (!$util.isString(message.targetId)) + return "targetId: string expected"; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + if (message.targetProject != null && message.hasOwnProperty("targetProject")) + if (!$util.isString(message.targetProject)) + return "targetProject: string expected"; + if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) { + var error = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify(message.acquireSsrsLeaseContext); + if (error) + return "acquireSsrsLeaseContext." + error; + } + if (message.subOperationType != null && message.hasOwnProperty("subOperationType")) { + var error = $root.google.cloud.sql.v1beta4.SqlSubOperationType.verify(message.subOperationType); + if (error) + return "subOperationType." + error; + } + return null; + }; + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.Operation + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.Operation} Operation + */ + Operation.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.Operation) + return object; + var message = new $root.google.cloud.sql.v1beta4.Operation(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.targetLink != null) + message.targetLink = String(object.targetLink); + switch (object.status) { + default: + if (typeof object.status === "number") { + message.status = object.status; + break; + } + break; + case "SQL_OPERATION_STATUS_UNSPECIFIED": + case 0: + message.status = 0; + break; + case "PENDING": + case 1: + message.status = 1; + break; + case "RUNNING": + case 2: + message.status = 2; + break; + case "DONE": + case 3: + message.status = 3; + break; + } + if (object.user != null) + message.user = String(object.user); + if (object.insertTime != null) { + if (typeof object.insertTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.insertTime: object expected"); + message.insertTime = $root.google.protobuf.Timestamp.fromObject(object.insertTime); + } + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.error: object expected"); + message.error = $root.google.cloud.sql.v1beta4.OperationErrors.fromObject(object.error); + } + if (object.apiWarning != null) { + if (typeof object.apiWarning !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.apiWarning: object expected"); + message.apiWarning = $root.google.cloud.sql.v1beta4.ApiWarning.fromObject(object.apiWarning); + } + switch (object.operationType) { + default: + if (typeof object.operationType === "number") { + message.operationType = object.operationType; + break; + } + break; + case "SQL_OPERATION_TYPE_UNSPECIFIED": + case 0: + message.operationType = 0; + break; + case "IMPORT": + case 1: + message.operationType = 1; + break; + case "EXPORT": + case 2: + message.operationType = 2; + break; + case "CREATE": + case 3: + message.operationType = 3; + break; + case "UPDATE": + case 4: + message.operationType = 4; + break; + case "DELETE": + case 5: + message.operationType = 5; + break; + case "RESTART": + case 6: + message.operationType = 6; + break; + case "BACKUP": + case 7: + message.operationType = 7; + break; + case "SNAPSHOT": + case 8: + message.operationType = 8; + break; + case "BACKUP_VOLUME": + case 9: + message.operationType = 9; + break; + case "DELETE_VOLUME": + case 10: + message.operationType = 10; + break; + case "RESTORE_VOLUME": + case 11: + message.operationType = 11; + break; + case "INJECT_USER": + case 12: + message.operationType = 12; + break; + case "CLONE": + case 14: + message.operationType = 14; + break; + case "STOP_REPLICA": + case 15: + message.operationType = 15; + break; + case "START_REPLICA": + case 16: + message.operationType = 16; + break; + case "PROMOTE_REPLICA": + case 17: + message.operationType = 17; + break; + case "CREATE_REPLICA": + case 18: + message.operationType = 18; + break; + case "CREATE_USER": + case 19: + message.operationType = 19; + break; + case "DELETE_USER": + case 20: + message.operationType = 20; + break; + case "UPDATE_USER": + case 21: + message.operationType = 21; + break; + case "CREATE_DATABASE": + case 22: + message.operationType = 22; + break; + case "DELETE_DATABASE": + case 23: + message.operationType = 23; + break; + case "UPDATE_DATABASE": + case 24: + message.operationType = 24; + break; + case "FAILOVER": + case 25: + message.operationType = 25; + break; + case "DELETE_BACKUP": + case 26: + message.operationType = 26; + break; + case "RECREATE_REPLICA": + case 27: + message.operationType = 27; + break; + case "TRUNCATE_LOG": + case 28: + message.operationType = 28; + break; + case "DEMOTE_MASTER": + case 29: + message.operationType = 29; + break; + case "MAINTENANCE": + case 30: + message.operationType = 30; + break; + case "ENABLE_PRIVATE_IP": + case 31: + message.operationType = 31; + break; + case "DEFER_MAINTENANCE": + case 32: + message.operationType = 32; + break; + case "CREATE_CLONE": + case 33: + message.operationType = 33; + break; + case "RESCHEDULE_MAINTENANCE": + case 34: + message.operationType = 34; + break; + case "START_EXTERNAL_SYNC": + case 35: + message.operationType = 35; + break; + case "LOG_CLEANUP": + case 36: + message.operationType = 36; + break; + case "AUTO_RESTART": + case 37: + message.operationType = 37; + break; + case "REENCRYPT": + case 38: + message.operationType = 38; + break; + case "SWITCHOVER": + case 39: + message.operationType = 39; + break; + case "UPDATE_BACKUP": + case 40: + message.operationType = 40; + break; + case "ACQUIRE_SSRS_LEASE": + case 42: + message.operationType = 42; + break; + case "RELEASE_SSRS_LEASE": + case 43: + message.operationType = 43; + break; + case "RECONFIGURE_OLD_PRIMARY": + case 44: + message.operationType = 44; + break; + case "CLUSTER_MAINTENANCE": + case 45: + message.operationType = 45; + break; + case "SELF_SERVICE_MAINTENANCE": + case 46: + message.operationType = 46; + break; + case "SWITCHOVER_TO_REPLICA": + case 47: + message.operationType = 47; + break; + case "MAJOR_VERSION_UPGRADE": + case 48: + message.operationType = 48; + break; + case "ADVANCED_BACKUP": + case 49: + message.operationType = 49; + break; + case "MANAGE_BACKUP": + case 50: + message.operationType = 50; + break; + case "ENHANCED_BACKUP": + case 51: + message.operationType = 51; + break; + case "REPAIR_READ_POOL": + case 52: + message.operationType = 52; + break; + case "CREATE_READ_POOL": + case 53: + message.operationType = 53; + break; + } + if (object.importContext != null) { + if (typeof object.importContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.importContext: object expected"); + message.importContext = $root.google.cloud.sql.v1beta4.ImportContext.fromObject(object.importContext); + } + if (object.exportContext != null) { + if (typeof object.exportContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.exportContext: object expected"); + message.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.fromObject(object.exportContext); + } + if (object.backupContext != null) { + if (typeof object.backupContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.backupContext: object expected"); + message.backupContext = $root.google.cloud.sql.v1beta4.BackupContext.fromObject(object.backupContext); + } + if (object.preCheckMajorVersionUpgradeContext != null) { + if (typeof object.preCheckMajorVersionUpgradeContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.preCheckMajorVersionUpgradeContext: object expected"); + message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.fromObject(object.preCheckMajorVersionUpgradeContext); + } + if (object.name != null) + message.name = String(object.name); + if (object.targetId != null) + message.targetId = String(object.targetId); + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + if (object.targetProject != null) + message.targetProject = String(object.targetProject); + if (object.acquireSsrsLeaseContext != null) { + if (typeof object.acquireSsrsLeaseContext !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.acquireSsrsLeaseContext: object expected"); + message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.fromObject(object.acquireSsrsLeaseContext); + } + if (object.subOperationType != null) { + if (typeof object.subOperationType !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Operation.subOperationType: object expected"); + message.subOperationType = $root.google.cloud.sql.v1beta4.SqlSubOperationType.fromObject(object.subOperationType); + } + return message; + }; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.Operation + * @static + * @param {google.cloud.sql.v1beta4.Operation} message Operation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Operation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.targetLink = ""; + object.status = options.enums === String ? "SQL_OPERATION_STATUS_UNSPECIFIED" : 0; + object.user = ""; + object.insertTime = null; + object.startTime = null; + object.endTime = null; + object.error = null; + object.operationType = options.enums === String ? "SQL_OPERATION_TYPE_UNSPECIFIED" : 0; + object.importContext = null; + object.exportContext = null; + object.name = ""; + object.targetId = ""; + object.selfLink = ""; + object.targetProject = ""; + object.backupContext = null; + object.apiWarning = null; + object.acquireSsrsLeaseContext = null; + object.subOperationType = null; + object.preCheckMajorVersionUpgradeContext = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.targetLink != null && message.hasOwnProperty("targetLink")) + object.targetLink = message.targetLink; + if (message.status != null && message.hasOwnProperty("status")) + object.status = options.enums === String ? $root.google.cloud.sql.v1beta4.Operation.SqlOperationStatus[message.status] === undefined ? message.status : $root.google.cloud.sql.v1beta4.Operation.SqlOperationStatus[message.status] : message.status; + if (message.user != null && message.hasOwnProperty("user")) + object.user = message.user; + if (message.insertTime != null && message.hasOwnProperty("insertTime")) + object.insertTime = $root.google.protobuf.Timestamp.toObject(message.insertTime, options); + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.error != null && message.hasOwnProperty("error")) + object.error = $root.google.cloud.sql.v1beta4.OperationErrors.toObject(message.error, options); + if (message.operationType != null && message.hasOwnProperty("operationType")) + object.operationType = options.enums === String ? $root.google.cloud.sql.v1beta4.Operation.SqlOperationType[message.operationType] === undefined ? message.operationType : $root.google.cloud.sql.v1beta4.Operation.SqlOperationType[message.operationType] : message.operationType; + if (message.importContext != null && message.hasOwnProperty("importContext")) + object.importContext = $root.google.cloud.sql.v1beta4.ImportContext.toObject(message.importContext, options); + if (message.exportContext != null && message.hasOwnProperty("exportContext")) + object.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.toObject(message.exportContext, options); + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.targetId != null && message.hasOwnProperty("targetId")) + object.targetId = message.targetId; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + if (message.targetProject != null && message.hasOwnProperty("targetProject")) + object.targetProject = message.targetProject; + if (message.backupContext != null && message.hasOwnProperty("backupContext")) + object.backupContext = $root.google.cloud.sql.v1beta4.BackupContext.toObject(message.backupContext, options); + if (message.apiWarning != null && message.hasOwnProperty("apiWarning")) + object.apiWarning = $root.google.cloud.sql.v1beta4.ApiWarning.toObject(message.apiWarning, options); + if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) + object.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.toObject(message.acquireSsrsLeaseContext, options); + if (message.subOperationType != null && message.hasOwnProperty("subOperationType")) + object.subOperationType = $root.google.cloud.sql.v1beta4.SqlSubOperationType.toObject(message.subOperationType, options); + if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) + object.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.toObject(message.preCheckMajorVersionUpgradeContext, options); + return object; + }; + + /** + * Converts this Operation to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.Operation + * @instance + * @returns {Object.} JSON object + */ + Operation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Operation + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.Operation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.Operation"; + }; + + /** + * SqlOperationType enum. + * @name google.cloud.sql.v1beta4.Operation.SqlOperationType + * @enum {number} + * @property {number} SQL_OPERATION_TYPE_UNSPECIFIED=0 SQL_OPERATION_TYPE_UNSPECIFIED value + * @property {number} IMPORT=1 IMPORT value + * @property {number} EXPORT=2 EXPORT value + * @property {number} CREATE=3 CREATE value + * @property {number} UPDATE=4 UPDATE value + * @property {number} DELETE=5 DELETE value + * @property {number} RESTART=6 RESTART value + * @property {number} BACKUP=7 BACKUP value + * @property {number} SNAPSHOT=8 SNAPSHOT value + * @property {number} BACKUP_VOLUME=9 BACKUP_VOLUME value + * @property {number} DELETE_VOLUME=10 DELETE_VOLUME value + * @property {number} RESTORE_VOLUME=11 RESTORE_VOLUME value + * @property {number} INJECT_USER=12 INJECT_USER value + * @property {number} CLONE=14 CLONE value + * @property {number} STOP_REPLICA=15 STOP_REPLICA value + * @property {number} START_REPLICA=16 START_REPLICA value + * @property {number} PROMOTE_REPLICA=17 PROMOTE_REPLICA value + * @property {number} CREATE_REPLICA=18 CREATE_REPLICA value + * @property {number} CREATE_USER=19 CREATE_USER value + * @property {number} DELETE_USER=20 DELETE_USER value + * @property {number} UPDATE_USER=21 UPDATE_USER value + * @property {number} CREATE_DATABASE=22 CREATE_DATABASE value + * @property {number} DELETE_DATABASE=23 DELETE_DATABASE value + * @property {number} UPDATE_DATABASE=24 UPDATE_DATABASE value + * @property {number} FAILOVER=25 FAILOVER value + * @property {number} DELETE_BACKUP=26 DELETE_BACKUP value + * @property {number} RECREATE_REPLICA=27 RECREATE_REPLICA value + * @property {number} TRUNCATE_LOG=28 TRUNCATE_LOG value + * @property {number} DEMOTE_MASTER=29 DEMOTE_MASTER value + * @property {number} MAINTENANCE=30 MAINTENANCE value + * @property {number} ENABLE_PRIVATE_IP=31 ENABLE_PRIVATE_IP value + * @property {number} DEFER_MAINTENANCE=32 DEFER_MAINTENANCE value + * @property {number} CREATE_CLONE=33 CREATE_CLONE value + * @property {number} RESCHEDULE_MAINTENANCE=34 RESCHEDULE_MAINTENANCE value + * @property {number} START_EXTERNAL_SYNC=35 START_EXTERNAL_SYNC value + * @property {number} LOG_CLEANUP=36 LOG_CLEANUP value + * @property {number} AUTO_RESTART=37 AUTO_RESTART value + * @property {number} REENCRYPT=38 REENCRYPT value + * @property {number} SWITCHOVER=39 SWITCHOVER value + * @property {number} UPDATE_BACKUP=40 UPDATE_BACKUP value + * @property {number} ACQUIRE_SSRS_LEASE=42 ACQUIRE_SSRS_LEASE value + * @property {number} RELEASE_SSRS_LEASE=43 RELEASE_SSRS_LEASE value + * @property {number} RECONFIGURE_OLD_PRIMARY=44 RECONFIGURE_OLD_PRIMARY value + * @property {number} CLUSTER_MAINTENANCE=45 CLUSTER_MAINTENANCE value + * @property {number} SELF_SERVICE_MAINTENANCE=46 SELF_SERVICE_MAINTENANCE value + * @property {number} SWITCHOVER_TO_REPLICA=47 SWITCHOVER_TO_REPLICA value + * @property {number} MAJOR_VERSION_UPGRADE=48 MAJOR_VERSION_UPGRADE value + * @property {number} ADVANCED_BACKUP=49 ADVANCED_BACKUP value + * @property {number} MANAGE_BACKUP=50 MANAGE_BACKUP value + * @property {number} ENHANCED_BACKUP=51 ENHANCED_BACKUP value + * @property {number} REPAIR_READ_POOL=52 REPAIR_READ_POOL value + * @property {number} CREATE_READ_POOL=53 CREATE_READ_POOL value + */ + Operation.SqlOperationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_OPERATION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "IMPORT"] = 1; + values[valuesById[2] = "EXPORT"] = 2; + values[valuesById[3] = "CREATE"] = 3; + values[valuesById[4] = "UPDATE"] = 4; + values[valuesById[5] = "DELETE"] = 5; + values[valuesById[6] = "RESTART"] = 6; + values[valuesById[7] = "BACKUP"] = 7; + values[valuesById[8] = "SNAPSHOT"] = 8; + values[valuesById[9] = "BACKUP_VOLUME"] = 9; + values[valuesById[10] = "DELETE_VOLUME"] = 10; + values[valuesById[11] = "RESTORE_VOLUME"] = 11; + values[valuesById[12] = "INJECT_USER"] = 12; + values[valuesById[14] = "CLONE"] = 14; + values[valuesById[15] = "STOP_REPLICA"] = 15; + values[valuesById[16] = "START_REPLICA"] = 16; + values[valuesById[17] = "PROMOTE_REPLICA"] = 17; + values[valuesById[18] = "CREATE_REPLICA"] = 18; + values[valuesById[19] = "CREATE_USER"] = 19; + values[valuesById[20] = "DELETE_USER"] = 20; + values[valuesById[21] = "UPDATE_USER"] = 21; + values[valuesById[22] = "CREATE_DATABASE"] = 22; + values[valuesById[23] = "DELETE_DATABASE"] = 23; + values[valuesById[24] = "UPDATE_DATABASE"] = 24; + values[valuesById[25] = "FAILOVER"] = 25; + values[valuesById[26] = "DELETE_BACKUP"] = 26; + values[valuesById[27] = "RECREATE_REPLICA"] = 27; + values[valuesById[28] = "TRUNCATE_LOG"] = 28; + values[valuesById[29] = "DEMOTE_MASTER"] = 29; + values[valuesById[30] = "MAINTENANCE"] = 30; + values[valuesById[31] = "ENABLE_PRIVATE_IP"] = 31; + values[valuesById[32] = "DEFER_MAINTENANCE"] = 32; + values[valuesById[33] = "CREATE_CLONE"] = 33; + values[valuesById[34] = "RESCHEDULE_MAINTENANCE"] = 34; + values[valuesById[35] = "START_EXTERNAL_SYNC"] = 35; + values[valuesById[36] = "LOG_CLEANUP"] = 36; + values[valuesById[37] = "AUTO_RESTART"] = 37; + values[valuesById[38] = "REENCRYPT"] = 38; + values[valuesById[39] = "SWITCHOVER"] = 39; + values[valuesById[40] = "UPDATE_BACKUP"] = 40; + values[valuesById[42] = "ACQUIRE_SSRS_LEASE"] = 42; + values[valuesById[43] = "RELEASE_SSRS_LEASE"] = 43; + values[valuesById[44] = "RECONFIGURE_OLD_PRIMARY"] = 44; + values[valuesById[45] = "CLUSTER_MAINTENANCE"] = 45; + values[valuesById[46] = "SELF_SERVICE_MAINTENANCE"] = 46; + values[valuesById[47] = "SWITCHOVER_TO_REPLICA"] = 47; + values[valuesById[48] = "MAJOR_VERSION_UPGRADE"] = 48; + values[valuesById[49] = "ADVANCED_BACKUP"] = 49; + values[valuesById[50] = "MANAGE_BACKUP"] = 50; + values[valuesById[51] = "ENHANCED_BACKUP"] = 51; + values[valuesById[52] = "REPAIR_READ_POOL"] = 52; + values[valuesById[53] = "CREATE_READ_POOL"] = 53; + return values; + })(); + + /** + * SqlOperationStatus enum. + * @name google.cloud.sql.v1beta4.Operation.SqlOperationStatus + * @enum {number} + * @property {number} SQL_OPERATION_STATUS_UNSPECIFIED=0 SQL_OPERATION_STATUS_UNSPECIFIED value + * @property {number} PENDING=1 PENDING value + * @property {number} RUNNING=2 RUNNING value + * @property {number} DONE=3 DONE value + */ + Operation.SqlOperationStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_OPERATION_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "PENDING"] = 1; + values[valuesById[2] = "RUNNING"] = 2; + values[valuesById[3] = "DONE"] = 3; + return values; + })(); + + return Operation; + })(); + + v1beta4.OperationError = (function() { + + /** + * Properties of an OperationError. + * @memberof google.cloud.sql.v1beta4 + * @interface IOperationError + * @property {string|null} [kind] OperationError kind + * @property {string|null} [code] OperationError code + * @property {string|null} [message] OperationError message + */ + + /** + * Constructs a new OperationError. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an OperationError. + * @implements IOperationError + * @constructor + * @param {google.cloud.sql.v1beta4.IOperationError=} [properties] Properties to set + */ + function OperationError(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationError kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.OperationError + * @instance + */ + OperationError.prototype.kind = ""; + + /** + * OperationError code. + * @member {string} code + * @memberof google.cloud.sql.v1beta4.OperationError + * @instance + */ + OperationError.prototype.code = ""; + + /** + * OperationError message. + * @member {string} message + * @memberof google.cloud.sql.v1beta4.OperationError + * @instance + */ + OperationError.prototype.message = ""; + + /** + * Creates a new OperationError instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.OperationError + * @static + * @param {google.cloud.sql.v1beta4.IOperationError=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.OperationError} OperationError instance + */ + OperationError.create = function create(properties) { + return new OperationError(properties); + }; + + /** + * Encodes the specified OperationError message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationError.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.OperationError + * @static + * @param {google.cloud.sql.v1beta4.IOperationError} message OperationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationError.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); + return writer; + }; + + /** + * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationError.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.OperationError + * @static + * @param {google.cloud.sql.v1beta4.IOperationError} message OperationError message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationError.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationError message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.OperationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.OperationError} OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationError.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.OperationError(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.code = reader.string(); + break; + } + case 3: { + message.message = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationError message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.OperationError + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.OperationError} OperationError + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationError.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationError message. + * @function verify + * @memberof google.cloud.sql.v1beta4.OperationError + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationError.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isString(message.code)) + return "code: string expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + return null; + }; + + /** + * Creates an OperationError message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.OperationError + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.OperationError} OperationError + */ + OperationError.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.OperationError) + return object; + var message = new $root.google.cloud.sql.v1beta4.OperationError(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.code != null) + message.code = String(object.code); + if (object.message != null) + message.message = String(object.message); + return message; + }; + + /** + * Creates a plain object from an OperationError message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.OperationError + * @static + * @param {google.cloud.sql.v1beta4.OperationError} message OperationError + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationError.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.code = ""; + object.message = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + return object; + }; + + /** + * Converts this OperationError to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.OperationError + * @instance + * @returns {Object.} JSON object + */ + OperationError.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationError + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.OperationError + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.OperationError"; + }; + + return OperationError; + })(); + + v1beta4.OperationErrors = (function() { + + /** + * Properties of an OperationErrors. + * @memberof google.cloud.sql.v1beta4 + * @interface IOperationErrors + * @property {string|null} [kind] OperationErrors kind + * @property {Array.|null} [errors] OperationErrors errors + */ + + /** + * Constructs a new OperationErrors. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an OperationErrors. + * @implements IOperationErrors + * @constructor + * @param {google.cloud.sql.v1beta4.IOperationErrors=} [properties] Properties to set + */ + function OperationErrors(properties) { + this.errors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationErrors kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @instance + */ + OperationErrors.prototype.kind = ""; + + /** + * OperationErrors errors. + * @member {Array.} errors + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @instance + */ + OperationErrors.prototype.errors = $util.emptyArray; + + /** + * Creates a new OperationErrors instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @static + * @param {google.cloud.sql.v1beta4.IOperationErrors=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.OperationErrors} OperationErrors instance + */ + OperationErrors.create = function create(properties) { + return new OperationErrors(properties); + }; + + /** + * Encodes the specified OperationErrors message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationErrors.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @static + * @param {google.cloud.sql.v1beta4.IOperationErrors} message OperationErrors message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationErrors.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.errors != null && message.errors.length) + for (var i = 0; i < message.errors.length; ++i) + $root.google.cloud.sql.v1beta4.OperationError.encode(message.errors[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OperationErrors message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationErrors.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @static + * @param {google.cloud.sql.v1beta4.IOperationErrors} message OperationErrors message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationErrors.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationErrors message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.OperationErrors} OperationErrors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationErrors.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.OperationErrors(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.errors && message.errors.length)) + message.errors = []; + message.errors.push($root.google.cloud.sql.v1beta4.OperationError.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationErrors message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.OperationErrors} OperationErrors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationErrors.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationErrors message. + * @function verify + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationErrors.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.errors != null && message.hasOwnProperty("errors")) { + if (!Array.isArray(message.errors)) + return "errors: array expected"; + for (var i = 0; i < message.errors.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.OperationError.verify(message.errors[i]); + if (error) + return "errors." + error; + } + } + return null; + }; + + /** + * Creates an OperationErrors message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.OperationErrors} OperationErrors + */ + OperationErrors.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.OperationErrors) + return object; + var message = new $root.google.cloud.sql.v1beta4.OperationErrors(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.errors) { + if (!Array.isArray(object.errors)) + throw TypeError(".google.cloud.sql.v1beta4.OperationErrors.errors: array expected"); + message.errors = []; + for (var i = 0; i < object.errors.length; ++i) { + if (typeof object.errors[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.OperationErrors.errors: object expected"); + message.errors[i] = $root.google.cloud.sql.v1beta4.OperationError.fromObject(object.errors[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OperationErrors message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @static + * @param {google.cloud.sql.v1beta4.OperationErrors} message OperationErrors + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationErrors.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.errors = []; + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.errors && message.errors.length) { + object.errors = []; + for (var j = 0; j < message.errors.length; ++j) + object.errors[j] = $root.google.cloud.sql.v1beta4.OperationError.toObject(message.errors[j], options); + } + return object; + }; + + /** + * Converts this OperationErrors to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @instance + * @returns {Object.} JSON object + */ + OperationErrors.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationErrors + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.OperationErrors + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationErrors.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.OperationErrors"; + }; + + return OperationErrors; + })(); + + v1beta4.PasswordValidationPolicy = (function() { + + /** + * Properties of a PasswordValidationPolicy. + * @memberof google.cloud.sql.v1beta4 + * @interface IPasswordValidationPolicy + * @property {google.protobuf.IInt32Value|null} [minLength] PasswordValidationPolicy minLength + * @property {google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity|null} [complexity] PasswordValidationPolicy complexity + * @property {google.protobuf.IInt32Value|null} [reuseInterval] PasswordValidationPolicy reuseInterval + * @property {google.protobuf.IBoolValue|null} [disallowUsernameSubstring] PasswordValidationPolicy disallowUsernameSubstring + * @property {google.protobuf.IDuration|null} [passwordChangeInterval] PasswordValidationPolicy passwordChangeInterval + * @property {google.protobuf.IBoolValue|null} [enablePasswordPolicy] PasswordValidationPolicy enablePasswordPolicy + * @property {google.protobuf.IBoolValue|null} [disallowCompromisedCredentials] PasswordValidationPolicy disallowCompromisedCredentials + */ + + /** + * Constructs a new PasswordValidationPolicy. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a PasswordValidationPolicy. + * @implements IPasswordValidationPolicy + * @constructor + * @param {google.cloud.sql.v1beta4.IPasswordValidationPolicy=} [properties] Properties to set + */ + function PasswordValidationPolicy(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PasswordValidationPolicy minLength. + * @member {google.protobuf.IInt32Value|null|undefined} minLength + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.minLength = null; + + /** + * PasswordValidationPolicy complexity. + * @member {google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity} complexity + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.complexity = 0; + + /** + * PasswordValidationPolicy reuseInterval. + * @member {google.protobuf.IInt32Value|null|undefined} reuseInterval + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.reuseInterval = null; + + /** + * PasswordValidationPolicy disallowUsernameSubstring. + * @member {google.protobuf.IBoolValue|null|undefined} disallowUsernameSubstring + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.disallowUsernameSubstring = null; + + /** + * PasswordValidationPolicy passwordChangeInterval. + * @member {google.protobuf.IDuration|null|undefined} passwordChangeInterval + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.passwordChangeInterval = null; + + /** + * PasswordValidationPolicy enablePasswordPolicy. + * @member {google.protobuf.IBoolValue|null|undefined} enablePasswordPolicy + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.enablePasswordPolicy = null; + + /** + * PasswordValidationPolicy disallowCompromisedCredentials. + * @member {google.protobuf.IBoolValue|null|undefined} disallowCompromisedCredentials + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @instance + */ + PasswordValidationPolicy.prototype.disallowCompromisedCredentials = null; + + /** + * Creates a new PasswordValidationPolicy instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1beta4.IPasswordValidationPolicy=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.PasswordValidationPolicy} PasswordValidationPolicy instance + */ + PasswordValidationPolicy.create = function create(properties) { + return new PasswordValidationPolicy(properties); + }; + + /** + * Encodes the specified PasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordValidationPolicy.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1beta4.IPasswordValidationPolicy} message PasswordValidationPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordValidationPolicy.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.minLength != null && Object.hasOwnProperty.call(message, "minLength")) + $root.google.protobuf.Int32Value.encode(message.minLength, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.complexity != null && Object.hasOwnProperty.call(message, "complexity")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.complexity); + if (message.reuseInterval != null && Object.hasOwnProperty.call(message, "reuseInterval")) + $root.google.protobuf.Int32Value.encode(message.reuseInterval, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.disallowUsernameSubstring != null && Object.hasOwnProperty.call(message, "disallowUsernameSubstring")) + $root.google.protobuf.BoolValue.encode(message.disallowUsernameSubstring, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.passwordChangeInterval != null && Object.hasOwnProperty.call(message, "passwordChangeInterval")) + $root.google.protobuf.Duration.encode(message.passwordChangeInterval, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.enablePasswordPolicy != null && Object.hasOwnProperty.call(message, "enablePasswordPolicy")) + $root.google.protobuf.BoolValue.encode(message.enablePasswordPolicy, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.disallowCompromisedCredentials != null && Object.hasOwnProperty.call(message, "disallowCompromisedCredentials")) + $root.google.protobuf.BoolValue.encode(message.disallowCompromisedCredentials, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordValidationPolicy.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1beta4.IPasswordValidationPolicy} message PasswordValidationPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordValidationPolicy.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PasswordValidationPolicy message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.PasswordValidationPolicy} PasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordValidationPolicy.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PasswordValidationPolicy(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.minLength = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 2: { + message.complexity = reader.int32(); + break; + } + case 3: { + message.reuseInterval = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 4: { + message.disallowUsernameSubstring = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 5: { + message.passwordChangeInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 6: { + message.enablePasswordPolicy = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 7: { + message.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PasswordValidationPolicy message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.PasswordValidationPolicy} PasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordValidationPolicy.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PasswordValidationPolicy message. + * @function verify + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PasswordValidationPolicy.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.minLength != null && message.hasOwnProperty("minLength")) { + var error = $root.google.protobuf.Int32Value.verify(message.minLength); + if (error) + return "minLength." + error; + } + if (message.complexity != null && message.hasOwnProperty("complexity")) + switch (message.complexity) { + default: + return "complexity: enum value expected"; + case 0: + case 1: + break; + } + if (message.reuseInterval != null && message.hasOwnProperty("reuseInterval")) { + var error = $root.google.protobuf.Int32Value.verify(message.reuseInterval); + if (error) + return "reuseInterval." + error; + } + if (message.disallowUsernameSubstring != null && message.hasOwnProperty("disallowUsernameSubstring")) { + var error = $root.google.protobuf.BoolValue.verify(message.disallowUsernameSubstring); + if (error) + return "disallowUsernameSubstring." + error; + } + if (message.passwordChangeInterval != null && message.hasOwnProperty("passwordChangeInterval")) { + var error = $root.google.protobuf.Duration.verify(message.passwordChangeInterval); + if (error) + return "passwordChangeInterval." + error; + } + if (message.enablePasswordPolicy != null && message.hasOwnProperty("enablePasswordPolicy")) { + var error = $root.google.protobuf.BoolValue.verify(message.enablePasswordPolicy); + if (error) + return "enablePasswordPolicy." + error; + } + if (message.disallowCompromisedCredentials != null && message.hasOwnProperty("disallowCompromisedCredentials")) { + var error = $root.google.protobuf.BoolValue.verify(message.disallowCompromisedCredentials); + if (error) + return "disallowCompromisedCredentials." + error; + } + return null; + }; + + /** + * Creates a PasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.PasswordValidationPolicy} PasswordValidationPolicy + */ + PasswordValidationPolicy.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.PasswordValidationPolicy) + return object; + var message = new $root.google.cloud.sql.v1beta4.PasswordValidationPolicy(); + if (object.minLength != null) { + if (typeof object.minLength !== "object") + throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.minLength: object expected"); + message.minLength = $root.google.protobuf.Int32Value.fromObject(object.minLength); + } + switch (object.complexity) { + default: + if (typeof object.complexity === "number") { + message.complexity = object.complexity; + break; + } + break; + case "COMPLEXITY_UNSPECIFIED": + case 0: + message.complexity = 0; + break; + case "COMPLEXITY_DEFAULT": + case 1: + message.complexity = 1; + break; + } + if (object.reuseInterval != null) { + if (typeof object.reuseInterval !== "object") + throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.reuseInterval: object expected"); + message.reuseInterval = $root.google.protobuf.Int32Value.fromObject(object.reuseInterval); + } + if (object.disallowUsernameSubstring != null) { + if (typeof object.disallowUsernameSubstring !== "object") + throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.disallowUsernameSubstring: object expected"); + message.disallowUsernameSubstring = $root.google.protobuf.BoolValue.fromObject(object.disallowUsernameSubstring); + } + if (object.passwordChangeInterval != null) { + if (typeof object.passwordChangeInterval !== "object") + throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.passwordChangeInterval: object expected"); + message.passwordChangeInterval = $root.google.protobuf.Duration.fromObject(object.passwordChangeInterval); + } + if (object.enablePasswordPolicy != null) { + if (typeof object.enablePasswordPolicy !== "object") + throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.enablePasswordPolicy: object expected"); + message.enablePasswordPolicy = $root.google.protobuf.BoolValue.fromObject(object.enablePasswordPolicy); + } + if (object.disallowCompromisedCredentials != null) { + if (typeof object.disallowCompromisedCredentials !== "object") + throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.disallowCompromisedCredentials: object expected"); + message.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.fromObject(object.disallowCompromisedCredentials); + } + return message; + }; + + /** + * Creates a plain object from a PasswordValidationPolicy message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1beta4.PasswordValidationPolicy} message PasswordValidationPolicy + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PasswordValidationPolicy.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.minLength = null; + object.complexity = options.enums === String ? "COMPLEXITY_UNSPECIFIED" : 0; + object.reuseInterval = null; + object.disallowUsernameSubstring = null; + object.passwordChangeInterval = null; + object.enablePasswordPolicy = null; + object.disallowCompromisedCredentials = null; + } + if (message.minLength != null && message.hasOwnProperty("minLength")) + object.minLength = $root.google.protobuf.Int32Value.toObject(message.minLength, options); + if (message.complexity != null && message.hasOwnProperty("complexity")) + object.complexity = options.enums === String ? $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity[message.complexity] === undefined ? message.complexity : $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity[message.complexity] : message.complexity; + if (message.reuseInterval != null && message.hasOwnProperty("reuseInterval")) + object.reuseInterval = $root.google.protobuf.Int32Value.toObject(message.reuseInterval, options); + if (message.disallowUsernameSubstring != null && message.hasOwnProperty("disallowUsernameSubstring")) + object.disallowUsernameSubstring = $root.google.protobuf.BoolValue.toObject(message.disallowUsernameSubstring, options); + if (message.passwordChangeInterval != null && message.hasOwnProperty("passwordChangeInterval")) + object.passwordChangeInterval = $root.google.protobuf.Duration.toObject(message.passwordChangeInterval, options); + if (message.enablePasswordPolicy != null && message.hasOwnProperty("enablePasswordPolicy")) + object.enablePasswordPolicy = $root.google.protobuf.BoolValue.toObject(message.enablePasswordPolicy, options); + if (message.disallowCompromisedCredentials != null && message.hasOwnProperty("disallowCompromisedCredentials")) + object.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.toObject(message.disallowCompromisedCredentials, options); + return object; + }; + + /** + * Converts this PasswordValidationPolicy to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @instance + * @returns {Object.} JSON object + */ + PasswordValidationPolicy.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PasswordValidationPolicy + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PasswordValidationPolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.PasswordValidationPolicy"; + }; + + /** + * Complexity enum. + * @name google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity + * @enum {number} + * @property {number} COMPLEXITY_UNSPECIFIED=0 COMPLEXITY_UNSPECIFIED value + * @property {number} COMPLEXITY_DEFAULT=1 COMPLEXITY_DEFAULT value + */ + PasswordValidationPolicy.Complexity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "COMPLEXITY_UNSPECIFIED"] = 0; + values[valuesById[1] = "COMPLEXITY_DEFAULT"] = 1; + return values; + })(); + + return PasswordValidationPolicy; + })(); + + v1beta4.OperationsListResponse = (function() { + + /** + * Properties of an OperationsListResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IOperationsListResponse + * @property {string|null} [kind] OperationsListResponse kind + * @property {Array.|null} [items] OperationsListResponse items + * @property {string|null} [nextPageToken] OperationsListResponse nextPageToken + */ + + /** + * Constructs a new OperationsListResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an OperationsListResponse. + * @implements IOperationsListResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IOperationsListResponse=} [properties] Properties to set + */ + function OperationsListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationsListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @instance + */ + OperationsListResponse.prototype.kind = ""; + + /** + * OperationsListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @instance + */ + OperationsListResponse.prototype.items = $util.emptyArray; + + /** + * OperationsListResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @instance + */ + OperationsListResponse.prototype.nextPageToken = ""; + + /** + * Creates a new OperationsListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @static + * @param {google.cloud.sql.v1beta4.IOperationsListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.OperationsListResponse} OperationsListResponse instance + */ + OperationsListResponse.create = function create(properties) { + return new OperationsListResponse(properties); + }; + + /** + * Encodes the specified OperationsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationsListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @static + * @param {google.cloud.sql.v1beta4.IOperationsListResponse} message OperationsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationsListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1beta4.Operation.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified OperationsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationsListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @static + * @param {google.cloud.sql.v1beta4.IOperationsListResponse} message OperationsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationsListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationsListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.OperationsListResponse} OperationsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationsListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.OperationsListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1beta4.Operation.decode(reader, reader.uint32())); + break; + } + case 3: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationsListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.OperationsListResponse} OperationsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationsListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationsListResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationsListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.Operation.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates an OperationsListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.OperationsListResponse} OperationsListResponse + */ + OperationsListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.OperationsListResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.OperationsListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1beta4.OperationsListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.OperationsListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1beta4.Operation.fromObject(object.items[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from an OperationsListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @static + * @param {google.cloud.sql.v1beta4.OperationsListResponse} message OperationsListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationsListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) { + object.kind = ""; + object.nextPageToken = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1beta4.Operation.toObject(message.items[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this OperationsListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @instance + * @returns {Object.} JSON object + */ + OperationsListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationsListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.OperationsListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.OperationsListResponse"; + }; + + return OperationsListResponse; + })(); + + v1beta4.ReplicaConfiguration = (function() { + + /** + * Properties of a ReplicaConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @interface IReplicaConfiguration + * @property {string|null} [kind] ReplicaConfiguration kind + * @property {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration|null} [mysqlReplicaConfiguration] ReplicaConfiguration mysqlReplicaConfiguration + * @property {google.protobuf.IBoolValue|null} [failoverTarget] ReplicaConfiguration failoverTarget + * @property {google.protobuf.IBoolValue|null} [cascadableReplica] ReplicaConfiguration cascadableReplica + */ + + /** + * Constructs a new ReplicaConfiguration. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a ReplicaConfiguration. + * @implements IReplicaConfiguration + * @constructor + * @param {google.cloud.sql.v1beta4.IReplicaConfiguration=} [properties] Properties to set + */ + function ReplicaConfiguration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReplicaConfiguration kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @instance + */ + ReplicaConfiguration.prototype.kind = ""; + + /** + * ReplicaConfiguration mysqlReplicaConfiguration. + * @member {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration|null|undefined} mysqlReplicaConfiguration + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @instance + */ + ReplicaConfiguration.prototype.mysqlReplicaConfiguration = null; + + /** + * ReplicaConfiguration failoverTarget. + * @member {google.protobuf.IBoolValue|null|undefined} failoverTarget + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @instance + */ + ReplicaConfiguration.prototype.failoverTarget = null; + + /** + * ReplicaConfiguration cascadableReplica. + * @member {google.protobuf.IBoolValue|null|undefined} cascadableReplica + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @instance + */ + ReplicaConfiguration.prototype.cascadableReplica = null; + + /** + * Creates a new ReplicaConfiguration instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IReplicaConfiguration=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ReplicaConfiguration} ReplicaConfiguration instance + */ + ReplicaConfiguration.create = function create(properties) { + return new ReplicaConfiguration(properties); + }; + + /** + * Encodes the specified ReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicaConfiguration.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IReplicaConfiguration} message ReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicaConfiguration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.mysqlReplicaConfiguration != null && Object.hasOwnProperty.call(message, "mysqlReplicaConfiguration")) + $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration.encode(message.mysqlReplicaConfiguration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.failoverTarget != null && Object.hasOwnProperty.call(message, "failoverTarget")) + $root.google.protobuf.BoolValue.encode(message.failoverTarget, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.cascadableReplica != null && Object.hasOwnProperty.call(message, "cascadableReplica")) + $root.google.protobuf.BoolValue.encode(message.cascadableReplica, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicaConfiguration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.IReplicaConfiguration} message ReplicaConfiguration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReplicaConfiguration message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ReplicaConfiguration} ReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicaConfiguration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ReplicaConfiguration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration.decode(reader, reader.uint32()); + break; + } + case 3: { + message.failoverTarget = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 5: { + message.cascadableReplica = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReplicaConfiguration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ReplicaConfiguration} ReplicaConfiguration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReplicaConfiguration message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReplicaConfiguration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) { + var error = $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verify(message.mysqlReplicaConfiguration); + if (error) + return "mysqlReplicaConfiguration." + error; + } + if (message.failoverTarget != null && message.hasOwnProperty("failoverTarget")) { + var error = $root.google.protobuf.BoolValue.verify(message.failoverTarget); + if (error) + return "failoverTarget." + error; + } + if (message.cascadableReplica != null && message.hasOwnProperty("cascadableReplica")) { + var error = $root.google.protobuf.BoolValue.verify(message.cascadableReplica); + if (error) + return "cascadableReplica." + error; + } + return null; + }; + + /** + * Creates a ReplicaConfiguration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ReplicaConfiguration} ReplicaConfiguration + */ + ReplicaConfiguration.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ReplicaConfiguration) + return object; + var message = new $root.google.cloud.sql.v1beta4.ReplicaConfiguration(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.mysqlReplicaConfiguration != null) { + if (typeof object.mysqlReplicaConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ReplicaConfiguration.mysqlReplicaConfiguration: object expected"); + message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration.fromObject(object.mysqlReplicaConfiguration); + } + if (object.failoverTarget != null) { + if (typeof object.failoverTarget !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ReplicaConfiguration.failoverTarget: object expected"); + message.failoverTarget = $root.google.protobuf.BoolValue.fromObject(object.failoverTarget); + } + if (object.cascadableReplica != null) { + if (typeof object.cascadableReplica !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ReplicaConfiguration.cascadableReplica: object expected"); + message.cascadableReplica = $root.google.protobuf.BoolValue.fromObject(object.cascadableReplica); + } + return message; + }; + + /** + * Creates a plain object from a ReplicaConfiguration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @static + * @param {google.cloud.sql.v1beta4.ReplicaConfiguration} message ReplicaConfiguration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReplicaConfiguration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.mysqlReplicaConfiguration = null; + object.failoverTarget = null; + object.cascadableReplica = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) + object.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration.toObject(message.mysqlReplicaConfiguration, options); + if (message.failoverTarget != null && message.hasOwnProperty("failoverTarget")) + object.failoverTarget = $root.google.protobuf.BoolValue.toObject(message.failoverTarget, options); + if (message.cascadableReplica != null && message.hasOwnProperty("cascadableReplica")) + object.cascadableReplica = $root.google.protobuf.BoolValue.toObject(message.cascadableReplica, options); + return object; + }; + + /** + * Converts this ReplicaConfiguration to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @instance + * @returns {Object.} JSON object + */ + ReplicaConfiguration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReplicaConfiguration + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ReplicaConfiguration"; + }; + + return ReplicaConfiguration; + })(); + + v1beta4.RestoreBackupContext = (function() { + + /** + * Properties of a RestoreBackupContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IRestoreBackupContext + * @property {string|null} [kind] RestoreBackupContext kind + * @property {number|Long|null} [backupRunId] RestoreBackupContext backupRunId + * @property {string|null} [instanceId] RestoreBackupContext instanceId + * @property {string|null} [project] RestoreBackupContext project + */ + + /** + * Constructs a new RestoreBackupContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a RestoreBackupContext. + * @implements IRestoreBackupContext + * @constructor + * @param {google.cloud.sql.v1beta4.IRestoreBackupContext=} [properties] Properties to set + */ + function RestoreBackupContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RestoreBackupContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @instance + */ + RestoreBackupContext.prototype.kind = ""; + + /** + * RestoreBackupContext backupRunId. + * @member {number|Long} backupRunId + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @instance + */ + RestoreBackupContext.prototype.backupRunId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * RestoreBackupContext instanceId. + * @member {string} instanceId + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @instance + */ + RestoreBackupContext.prototype.instanceId = ""; + + /** + * RestoreBackupContext project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @instance + */ + RestoreBackupContext.prototype.project = ""; + + /** + * Creates a new RestoreBackupContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @static + * @param {google.cloud.sql.v1beta4.IRestoreBackupContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.RestoreBackupContext} RestoreBackupContext instance + */ + RestoreBackupContext.create = function create(properties) { + return new RestoreBackupContext(properties); + }; + + /** + * Encodes the specified RestoreBackupContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RestoreBackupContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @static + * @param {google.cloud.sql.v1beta4.IRestoreBackupContext} message RestoreBackupContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreBackupContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.backupRunId != null && Object.hasOwnProperty.call(message, "backupRunId")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.backupRunId); + if (message.instanceId != null && Object.hasOwnProperty.call(message, "instanceId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.instanceId); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + return writer; + }; + + /** + * Encodes the specified RestoreBackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RestoreBackupContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @static + * @param {google.cloud.sql.v1beta4.IRestoreBackupContext} message RestoreBackupContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RestoreBackupContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RestoreBackupContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.RestoreBackupContext} RestoreBackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreBackupContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.RestoreBackupContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.backupRunId = reader.int64(); + break; + } + case 3: { + message.instanceId = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RestoreBackupContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.RestoreBackupContext} RestoreBackupContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RestoreBackupContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RestoreBackupContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RestoreBackupContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.backupRunId != null && message.hasOwnProperty("backupRunId")) + if (!$util.isInteger(message.backupRunId) && !(message.backupRunId && $util.isInteger(message.backupRunId.low) && $util.isInteger(message.backupRunId.high))) + return "backupRunId: integer|Long expected"; + if (message.instanceId != null && message.hasOwnProperty("instanceId")) + if (!$util.isString(message.instanceId)) + return "instanceId: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a RestoreBackupContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.RestoreBackupContext} RestoreBackupContext + */ + RestoreBackupContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.RestoreBackupContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.RestoreBackupContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.backupRunId != null) + if ($util.Long) + (message.backupRunId = $util.Long.fromValue(object.backupRunId)).unsigned = false; + else if (typeof object.backupRunId === "string") + message.backupRunId = parseInt(object.backupRunId, 10); + else if (typeof object.backupRunId === "number") + message.backupRunId = object.backupRunId; + else if (typeof object.backupRunId === "object") + message.backupRunId = new $util.LongBits(object.backupRunId.low >>> 0, object.backupRunId.high >>> 0).toNumber(); + if (object.instanceId != null) + message.instanceId = String(object.instanceId); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a RestoreBackupContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @static + * @param {google.cloud.sql.v1beta4.RestoreBackupContext} message RestoreBackupContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RestoreBackupContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.backupRunId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.backupRunId = options.longs === String ? "0" : 0; + object.instanceId = ""; + object.project = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.backupRunId != null && message.hasOwnProperty("backupRunId")) + if (typeof message.backupRunId === "number") + object.backupRunId = options.longs === String ? String(message.backupRunId) : message.backupRunId; + else + object.backupRunId = options.longs === String ? $util.Long.prototype.toString.call(message.backupRunId) : options.longs === Number ? new $util.LongBits(message.backupRunId.low >>> 0, message.backupRunId.high >>> 0).toNumber() : message.backupRunId; + if (message.instanceId != null && message.hasOwnProperty("instanceId")) + object.instanceId = message.instanceId; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this RestoreBackupContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @instance + * @returns {Object.} JSON object + */ + RestoreBackupContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RestoreBackupContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.RestoreBackupContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RestoreBackupContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.RestoreBackupContext"; + }; + + return RestoreBackupContext; + })(); + + v1beta4.RotateServerCaContext = (function() { + + /** + * Properties of a RotateServerCaContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IRotateServerCaContext + * @property {string|null} [kind] RotateServerCaContext kind + * @property {string|null} [nextVersion] RotateServerCaContext nextVersion + */ + + /** + * Constructs a new RotateServerCaContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a RotateServerCaContext. + * @implements IRotateServerCaContext + * @constructor + * @param {google.cloud.sql.v1beta4.IRotateServerCaContext=} [properties] Properties to set + */ + function RotateServerCaContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RotateServerCaContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @instance + */ + RotateServerCaContext.prototype.kind = ""; + + /** + * RotateServerCaContext nextVersion. + * @member {string} nextVersion + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @instance + */ + RotateServerCaContext.prototype.nextVersion = ""; + + /** + * Creates a new RotateServerCaContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @static + * @param {google.cloud.sql.v1beta4.IRotateServerCaContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.RotateServerCaContext} RotateServerCaContext instance + */ + RotateServerCaContext.create = function create(properties) { + return new RotateServerCaContext(properties); + }; + + /** + * Encodes the specified RotateServerCaContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCaContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @static + * @param {google.cloud.sql.v1beta4.IRotateServerCaContext} message RotateServerCaContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateServerCaContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); + return writer; + }; + + /** + * Encodes the specified RotateServerCaContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCaContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @static + * @param {google.cloud.sql.v1beta4.IRotateServerCaContext} message RotateServerCaContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateServerCaContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RotateServerCaContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.RotateServerCaContext} RotateServerCaContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateServerCaContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.RotateServerCaContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.nextVersion = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RotateServerCaContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.RotateServerCaContext} RotateServerCaContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateServerCaContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RotateServerCaContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RotateServerCaContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + if (!$util.isString(message.nextVersion)) + return "nextVersion: string expected"; + return null; + }; + + /** + * Creates a RotateServerCaContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.RotateServerCaContext} RotateServerCaContext + */ + RotateServerCaContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.RotateServerCaContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.RotateServerCaContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.nextVersion != null) + message.nextVersion = String(object.nextVersion); + return message; + }; + + /** + * Creates a plain object from a RotateServerCaContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @static + * @param {google.cloud.sql.v1beta4.RotateServerCaContext} message RotateServerCaContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RotateServerCaContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.nextVersion = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + object.nextVersion = message.nextVersion; + return object; + }; + + /** + * Converts this RotateServerCaContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @instance + * @returns {Object.} JSON object + */ + RotateServerCaContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RotateServerCaContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.RotateServerCaContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RotateServerCaContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.RotateServerCaContext"; + }; + + return RotateServerCaContext; + })(); + + v1beta4.RotateServerCertificateContext = (function() { + + /** + * Properties of a RotateServerCertificateContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IRotateServerCertificateContext + * @property {string|null} [kind] RotateServerCertificateContext kind + * @property {string|null} [nextVersion] RotateServerCertificateContext nextVersion + */ + + /** + * Constructs a new RotateServerCertificateContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a RotateServerCertificateContext. + * @implements IRotateServerCertificateContext + * @constructor + * @param {google.cloud.sql.v1beta4.IRotateServerCertificateContext=} [properties] Properties to set + */ + function RotateServerCertificateContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RotateServerCertificateContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @instance + */ + RotateServerCertificateContext.prototype.kind = ""; + + /** + * RotateServerCertificateContext nextVersion. + * @member {string} nextVersion + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @instance + */ + RotateServerCertificateContext.prototype.nextVersion = ""; + + /** + * Creates a new RotateServerCertificateContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @static + * @param {google.cloud.sql.v1beta4.IRotateServerCertificateContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.RotateServerCertificateContext} RotateServerCertificateContext instance + */ + RotateServerCertificateContext.create = function create(properties) { + return new RotateServerCertificateContext(properties); + }; + + /** + * Encodes the specified RotateServerCertificateContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCertificateContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @static + * @param {google.cloud.sql.v1beta4.IRotateServerCertificateContext} message RotateServerCertificateContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateServerCertificateContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); + return writer; + }; + + /** + * Encodes the specified RotateServerCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCertificateContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @static + * @param {google.cloud.sql.v1beta4.IRotateServerCertificateContext} message RotateServerCertificateContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateServerCertificateContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RotateServerCertificateContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.RotateServerCertificateContext} RotateServerCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateServerCertificateContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.RotateServerCertificateContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.nextVersion = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RotateServerCertificateContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.RotateServerCertificateContext} RotateServerCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateServerCertificateContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RotateServerCertificateContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RotateServerCertificateContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + if (!$util.isString(message.nextVersion)) + return "nextVersion: string expected"; + return null; + }; + + /** + * Creates a RotateServerCertificateContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.RotateServerCertificateContext} RotateServerCertificateContext + */ + RotateServerCertificateContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.RotateServerCertificateContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.RotateServerCertificateContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.nextVersion != null) + message.nextVersion = String(object.nextVersion); + return message; + }; + + /** + * Creates a plain object from a RotateServerCertificateContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @static + * @param {google.cloud.sql.v1beta4.RotateServerCertificateContext} message RotateServerCertificateContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RotateServerCertificateContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.nextVersion = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + object.nextVersion = message.nextVersion; + return object; + }; + + /** + * Converts this RotateServerCertificateContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @instance + * @returns {Object.} JSON object + */ + RotateServerCertificateContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RotateServerCertificateContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RotateServerCertificateContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.RotateServerCertificateContext"; + }; + + return RotateServerCertificateContext; + })(); + + v1beta4.RotateEntraIdCertificateContext = (function() { + + /** + * Properties of a RotateEntraIdCertificateContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IRotateEntraIdCertificateContext + * @property {string|null} [kind] RotateEntraIdCertificateContext kind + * @property {string|null} [nextVersion] RotateEntraIdCertificateContext nextVersion + */ + + /** + * Constructs a new RotateEntraIdCertificateContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a RotateEntraIdCertificateContext. + * @implements IRotateEntraIdCertificateContext + * @constructor + * @param {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext=} [properties] Properties to set + */ + function RotateEntraIdCertificateContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RotateEntraIdCertificateContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @instance + */ + RotateEntraIdCertificateContext.prototype.kind = ""; + + /** + * RotateEntraIdCertificateContext nextVersion. + * @member {string} nextVersion + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @instance + */ + RotateEntraIdCertificateContext.prototype.nextVersion = ""; + + /** + * Creates a new RotateEntraIdCertificateContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @static + * @param {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext instance + */ + RotateEntraIdCertificateContext.create = function create(properties) { + return new RotateEntraIdCertificateContext(properties); + }; + + /** + * Encodes the specified RotateEntraIdCertificateContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @static + * @param {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext} message RotateEntraIdCertificateContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateEntraIdCertificateContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); + return writer; + }; + + /** + * Encodes the specified RotateEntraIdCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @static + * @param {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext} message RotateEntraIdCertificateContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RotateEntraIdCertificateContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateEntraIdCertificateContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.nextVersion = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RotateEntraIdCertificateContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RotateEntraIdCertificateContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RotateEntraIdCertificateContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + if (!$util.isString(message.nextVersion)) + return "nextVersion: string expected"; + return null; + }; + + /** + * Creates a RotateEntraIdCertificateContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext + */ + RotateEntraIdCertificateContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.nextVersion != null) + message.nextVersion = String(object.nextVersion); + return message; + }; + + /** + * Creates a plain object from a RotateEntraIdCertificateContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @static + * @param {google.cloud.sql.v1beta4.RotateEntraIdCertificateContext} message RotateEntraIdCertificateContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RotateEntraIdCertificateContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.nextVersion = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) + object.nextVersion = message.nextVersion; + return object; + }; + + /** + * Converts this RotateEntraIdCertificateContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @instance + * @returns {Object.} JSON object + */ + RotateEntraIdCertificateContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RotateEntraIdCertificateContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RotateEntraIdCertificateContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.RotateEntraIdCertificateContext"; + }; + + return RotateEntraIdCertificateContext; + })(); + + v1beta4.DataCacheConfig = (function() { + + /** + * Properties of a DataCacheConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IDataCacheConfig + * @property {boolean|null} [dataCacheEnabled] DataCacheConfig dataCacheEnabled + */ + + /** + * Constructs a new DataCacheConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a DataCacheConfig. + * @implements IDataCacheConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IDataCacheConfig=} [properties] Properties to set + */ + function DataCacheConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DataCacheConfig dataCacheEnabled. + * @member {boolean} dataCacheEnabled + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @instance + */ + DataCacheConfig.prototype.dataCacheEnabled = false; + + /** + * Creates a new DataCacheConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @static + * @param {google.cloud.sql.v1beta4.IDataCacheConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.DataCacheConfig} DataCacheConfig instance + */ + DataCacheConfig.create = function create(properties) { + return new DataCacheConfig(properties); + }; + + /** + * Encodes the specified DataCacheConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.DataCacheConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @static + * @param {google.cloud.sql.v1beta4.IDataCacheConfig} message DataCacheConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DataCacheConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.dataCacheEnabled != null && Object.hasOwnProperty.call(message, "dataCacheEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.dataCacheEnabled); + return writer; + }; + + /** + * Encodes the specified DataCacheConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DataCacheConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @static + * @param {google.cloud.sql.v1beta4.IDataCacheConfig} message DataCacheConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DataCacheConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DataCacheConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.DataCacheConfig} DataCacheConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DataCacheConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DataCacheConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.dataCacheEnabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DataCacheConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.DataCacheConfig} DataCacheConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DataCacheConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DataCacheConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DataCacheConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.dataCacheEnabled != null && message.hasOwnProperty("dataCacheEnabled")) + if (typeof message.dataCacheEnabled !== "boolean") + return "dataCacheEnabled: boolean expected"; + return null; + }; + + /** + * Creates a DataCacheConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.DataCacheConfig} DataCacheConfig + */ + DataCacheConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.DataCacheConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.DataCacheConfig(); + if (object.dataCacheEnabled != null) + message.dataCacheEnabled = Boolean(object.dataCacheEnabled); + return message; + }; + + /** + * Creates a plain object from a DataCacheConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @static + * @param {google.cloud.sql.v1beta4.DataCacheConfig} message DataCacheConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DataCacheConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.dataCacheEnabled = false; + if (message.dataCacheEnabled != null && message.hasOwnProperty("dataCacheEnabled")) + object.dataCacheEnabled = message.dataCacheEnabled; + return object; + }; + + /** + * Converts this DataCacheConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @instance + * @returns {Object.} JSON object + */ + DataCacheConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DataCacheConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.DataCacheConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DataCacheConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.DataCacheConfig"; + }; + + return DataCacheConfig; + })(); + + v1beta4.FinalBackupConfig = (function() { + + /** + * Properties of a FinalBackupConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IFinalBackupConfig + * @property {boolean|null} [enabled] FinalBackupConfig enabled + * @property {number|null} [retentionDays] FinalBackupConfig retentionDays + */ + + /** + * Constructs a new FinalBackupConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a FinalBackupConfig. + * @implements IFinalBackupConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IFinalBackupConfig=} [properties] Properties to set + */ + function FinalBackupConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FinalBackupConfig enabled. + * @member {boolean|null|undefined} enabled + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @instance + */ + FinalBackupConfig.prototype.enabled = null; + + /** + * FinalBackupConfig retentionDays. + * @member {number|null|undefined} retentionDays + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @instance + */ + FinalBackupConfig.prototype.retentionDays = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(FinalBackupConfig.prototype, "_enabled", { + get: $util.oneOfGetter($oneOfFields = ["enabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(FinalBackupConfig.prototype, "_retentionDays", { + get: $util.oneOfGetter($oneOfFields = ["retentionDays"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new FinalBackupConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @static + * @param {google.cloud.sql.v1beta4.IFinalBackupConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.FinalBackupConfig} FinalBackupConfig instance + */ + FinalBackupConfig.create = function create(properties) { + return new FinalBackupConfig(properties); + }; + + /** + * Encodes the specified FinalBackupConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.FinalBackupConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @static + * @param {google.cloud.sql.v1beta4.IFinalBackupConfig} message FinalBackupConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FinalBackupConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.retentionDays != null && Object.hasOwnProperty.call(message, "retentionDays")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.retentionDays); + return writer; + }; + + /** + * Encodes the specified FinalBackupConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FinalBackupConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @static + * @param {google.cloud.sql.v1beta4.IFinalBackupConfig} message FinalBackupConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FinalBackupConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FinalBackupConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.FinalBackupConfig} FinalBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FinalBackupConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.FinalBackupConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.enabled = reader.bool(); + break; + } + case 3: { + message.retentionDays = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FinalBackupConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.FinalBackupConfig} FinalBackupConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FinalBackupConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FinalBackupConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FinalBackupConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + properties._enabled = 1; + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + } + if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) { + properties._retentionDays = 1; + if (!$util.isInteger(message.retentionDays)) + return "retentionDays: integer expected"; + } + return null; + }; + + /** + * Creates a FinalBackupConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.FinalBackupConfig} FinalBackupConfig + */ + FinalBackupConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.FinalBackupConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.FinalBackupConfig(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.retentionDays != null) + message.retentionDays = object.retentionDays | 0; + return message; + }; + + /** + * Creates a plain object from a FinalBackupConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @static + * @param {google.cloud.sql.v1beta4.FinalBackupConfig} message FinalBackupConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FinalBackupConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + object.enabled = message.enabled; + if (options.oneofs) + object._enabled = "enabled"; + } + if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) { + object.retentionDays = message.retentionDays; + if (options.oneofs) + object._retentionDays = "retentionDays"; + } + return object; + }; + + /** + * Converts this FinalBackupConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @instance + * @returns {Object.} JSON object + */ + FinalBackupConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FinalBackupConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.FinalBackupConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FinalBackupConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.FinalBackupConfig"; + }; + + return FinalBackupConfig; + })(); + + v1beta4.Settings = (function() { + + /** + * Properties of a Settings. + * @memberof google.cloud.sql.v1beta4 + * @interface ISettings + * @property {google.protobuf.IInt64Value|null} [settingsVersion] Settings settingsVersion + * @property {Array.|null} [authorizedGaeApplications] Settings authorizedGaeApplications + * @property {string|null} [tier] Settings tier + * @property {string|null} [kind] Settings kind + * @property {Object.|null} [userLabels] Settings userLabels + * @property {google.cloud.sql.v1beta4.SqlAvailabilityType|null} [availabilityType] Settings availabilityType + * @property {google.cloud.sql.v1beta4.SqlPricingPlan|null} [pricingPlan] Settings pricingPlan + * @property {google.cloud.sql.v1beta4.SqlReplicationType|null} [replicationType] Settings replicationType + * @property {google.protobuf.IInt64Value|null} [storageAutoResizeLimit] Settings storageAutoResizeLimit + * @property {google.cloud.sql.v1beta4.Settings.SqlActivationPolicy|null} [activationPolicy] Settings activationPolicy + * @property {google.cloud.sql.v1beta4.IIpConfiguration|null} [ipConfiguration] Settings ipConfiguration + * @property {google.protobuf.IBoolValue|null} [storageAutoResize] Settings storageAutoResize + * @property {google.cloud.sql.v1beta4.ILocationPreference|null} [locationPreference] Settings locationPreference + * @property {Array.|null} [databaseFlags] Settings databaseFlags + * @property {google.cloud.sql.v1beta4.SqlDataDiskType|null} [dataDiskType] Settings dataDiskType + * @property {google.cloud.sql.v1beta4.IMaintenanceWindow|null} [maintenanceWindow] Settings maintenanceWindow + * @property {google.cloud.sql.v1beta4.IBackupConfiguration|null} [backupConfiguration] Settings backupConfiguration + * @property {google.protobuf.IBoolValue|null} [databaseReplicationEnabled] Settings databaseReplicationEnabled + * @property {google.protobuf.IBoolValue|null} [crashSafeReplicationEnabled] Settings crashSafeReplicationEnabled + * @property {google.protobuf.IInt64Value|null} [dataDiskSizeGb] Settings dataDiskSizeGb + * @property {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig|null} [activeDirectoryConfig] Settings activeDirectoryConfig + * @property {string|null} [collation] Settings collation + * @property {Array.|null} [denyMaintenancePeriods] Settings denyMaintenancePeriods + * @property {google.cloud.sql.v1beta4.IInsightsConfig|null} [insightsConfig] Settings insightsConfig + * @property {google.cloud.sql.v1beta4.IPasswordValidationPolicy|null} [passwordValidationPolicy] Settings passwordValidationPolicy + * @property {google.cloud.sql.v1beta4.ISqlServerAuditConfig|null} [sqlServerAuditConfig] Settings sqlServerAuditConfig + * @property {google.cloud.sql.v1beta4.Settings.Edition|null} [edition] Settings edition + * @property {google.cloud.sql.v1beta4.Settings.ConnectorEnforcement|null} [connectorEnforcement] Settings connectorEnforcement + * @property {google.protobuf.IBoolValue|null} [deletionProtectionEnabled] Settings deletionProtectionEnabled + * @property {string|null} [timeZone] Settings timeZone + * @property {google.cloud.sql.v1beta4.IAdvancedMachineFeatures|null} [advancedMachineFeatures] Settings advancedMachineFeatures + * @property {google.cloud.sql.v1beta4.IDataCacheConfig|null} [dataCacheConfig] Settings dataCacheConfig + * @property {google.protobuf.IInt32Value|null} [replicationLagMaxSeconds] Settings replicationLagMaxSeconds + * @property {google.protobuf.IBoolValue|null} [enableGoogleMlIntegration] Settings enableGoogleMlIntegration + * @property {google.protobuf.IBoolValue|null} [enableDataplexIntegration] Settings enableDataplexIntegration + * @property {google.protobuf.IBoolValue|null} [retainBackupsOnDelete] Settings retainBackupsOnDelete + * @property {number|Long|null} [dataDiskProvisionedIops] Settings dataDiskProvisionedIops + * @property {number|Long|null} [dataDiskProvisionedThroughput] Settings dataDiskProvisionedThroughput + * @property {google.cloud.sql.v1beta4.IConnectionPoolConfig|null} [connectionPoolConfig] Settings connectionPoolConfig + * @property {google.cloud.sql.v1beta4.IFinalBackupConfig|null} [finalBackupConfig] Settings finalBackupConfig + * @property {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig|null} [readPoolAutoScaleConfig] Settings readPoolAutoScaleConfig + * @property {boolean|null} [autoUpgradeEnabled] Settings autoUpgradeEnabled + * @property {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig|null} [entraidConfig] Settings entraidConfig + * @property {google.cloud.sql.v1beta4.Settings.DataApiAccess|null} [dataApiAccess] Settings dataApiAccess + * @property {google.cloud.sql.v1beta4.IPerformanceCaptureConfig|null} [performanceCaptureConfig] Settings performanceCaptureConfig + */ + + /** + * Constructs a new Settings. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a Settings. + * @implements ISettings + * @constructor + * @param {google.cloud.sql.v1beta4.ISettings=} [properties] Properties to set + */ + function Settings(properties) { + this.authorizedGaeApplications = []; + this.userLabels = {}; + this.databaseFlags = []; + this.denyMaintenancePeriods = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Settings settingsVersion. + * @member {google.protobuf.IInt64Value|null|undefined} settingsVersion + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.settingsVersion = null; + + /** + * Settings authorizedGaeApplications. + * @member {Array.} authorizedGaeApplications + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.authorizedGaeApplications = $util.emptyArray; + + /** + * Settings tier. + * @member {string} tier + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.tier = ""; + + /** + * Settings kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.kind = ""; + + /** + * Settings userLabels. + * @member {Object.} userLabels + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.userLabels = $util.emptyObject; + + /** + * Settings availabilityType. + * @member {google.cloud.sql.v1beta4.SqlAvailabilityType} availabilityType + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.availabilityType = 0; + + /** + * Settings pricingPlan. + * @member {google.cloud.sql.v1beta4.SqlPricingPlan} pricingPlan + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.pricingPlan = 0; + + /** + * Settings replicationType. + * @member {google.cloud.sql.v1beta4.SqlReplicationType} replicationType + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.replicationType = 0; + + /** + * Settings storageAutoResizeLimit. + * @member {google.protobuf.IInt64Value|null|undefined} storageAutoResizeLimit + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.storageAutoResizeLimit = null; + + /** + * Settings activationPolicy. + * @member {google.cloud.sql.v1beta4.Settings.SqlActivationPolicy} activationPolicy + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.activationPolicy = 0; + + /** + * Settings ipConfiguration. + * @member {google.cloud.sql.v1beta4.IIpConfiguration|null|undefined} ipConfiguration + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.ipConfiguration = null; + + /** + * Settings storageAutoResize. + * @member {google.protobuf.IBoolValue|null|undefined} storageAutoResize + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.storageAutoResize = null; + + /** + * Settings locationPreference. + * @member {google.cloud.sql.v1beta4.ILocationPreference|null|undefined} locationPreference + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.locationPreference = null; + + /** + * Settings databaseFlags. + * @member {Array.} databaseFlags + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.databaseFlags = $util.emptyArray; + + /** + * Settings dataDiskType. + * @member {google.cloud.sql.v1beta4.SqlDataDiskType} dataDiskType + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.dataDiskType = 0; + + /** + * Settings maintenanceWindow. + * @member {google.cloud.sql.v1beta4.IMaintenanceWindow|null|undefined} maintenanceWindow + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.maintenanceWindow = null; + + /** + * Settings backupConfiguration. + * @member {google.cloud.sql.v1beta4.IBackupConfiguration|null|undefined} backupConfiguration + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.backupConfiguration = null; + + /** + * Settings databaseReplicationEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} databaseReplicationEnabled + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.databaseReplicationEnabled = null; + + /** + * Settings crashSafeReplicationEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} crashSafeReplicationEnabled + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.crashSafeReplicationEnabled = null; + + /** + * Settings dataDiskSizeGb. + * @member {google.protobuf.IInt64Value|null|undefined} dataDiskSizeGb + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.dataDiskSizeGb = null; + + /** + * Settings activeDirectoryConfig. + * @member {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig|null|undefined} activeDirectoryConfig + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.activeDirectoryConfig = null; + + /** + * Settings collation. + * @member {string} collation + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.collation = ""; + + /** + * Settings denyMaintenancePeriods. + * @member {Array.} denyMaintenancePeriods + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.denyMaintenancePeriods = $util.emptyArray; + + /** + * Settings insightsConfig. + * @member {google.cloud.sql.v1beta4.IInsightsConfig|null|undefined} insightsConfig + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.insightsConfig = null; + + /** + * Settings passwordValidationPolicy. + * @member {google.cloud.sql.v1beta4.IPasswordValidationPolicy|null|undefined} passwordValidationPolicy + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.passwordValidationPolicy = null; + + /** + * Settings sqlServerAuditConfig. + * @member {google.cloud.sql.v1beta4.ISqlServerAuditConfig|null|undefined} sqlServerAuditConfig + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.sqlServerAuditConfig = null; + + /** + * Settings edition. + * @member {google.cloud.sql.v1beta4.Settings.Edition} edition + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.edition = 0; + + /** + * Settings connectorEnforcement. + * @member {google.cloud.sql.v1beta4.Settings.ConnectorEnforcement} connectorEnforcement + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.connectorEnforcement = 0; + + /** + * Settings deletionProtectionEnabled. + * @member {google.protobuf.IBoolValue|null|undefined} deletionProtectionEnabled + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.deletionProtectionEnabled = null; + + /** + * Settings timeZone. + * @member {string} timeZone + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.timeZone = ""; + + /** + * Settings advancedMachineFeatures. + * @member {google.cloud.sql.v1beta4.IAdvancedMachineFeatures|null|undefined} advancedMachineFeatures + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.advancedMachineFeatures = null; + + /** + * Settings dataCacheConfig. + * @member {google.cloud.sql.v1beta4.IDataCacheConfig|null|undefined} dataCacheConfig + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.dataCacheConfig = null; + + /** + * Settings replicationLagMaxSeconds. + * @member {google.protobuf.IInt32Value|null|undefined} replicationLagMaxSeconds + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.replicationLagMaxSeconds = null; + + /** + * Settings enableGoogleMlIntegration. + * @member {google.protobuf.IBoolValue|null|undefined} enableGoogleMlIntegration + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.enableGoogleMlIntegration = null; + + /** + * Settings enableDataplexIntegration. + * @member {google.protobuf.IBoolValue|null|undefined} enableDataplexIntegration + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.enableDataplexIntegration = null; + + /** + * Settings retainBackupsOnDelete. + * @member {google.protobuf.IBoolValue|null|undefined} retainBackupsOnDelete + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.retainBackupsOnDelete = null; + + /** + * Settings dataDiskProvisionedIops. + * @member {number|Long|null|undefined} dataDiskProvisionedIops + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.dataDiskProvisionedIops = null; + + /** + * Settings dataDiskProvisionedThroughput. + * @member {number|Long|null|undefined} dataDiskProvisionedThroughput + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.dataDiskProvisionedThroughput = null; + + /** + * Settings connectionPoolConfig. + * @member {google.cloud.sql.v1beta4.IConnectionPoolConfig|null|undefined} connectionPoolConfig + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.connectionPoolConfig = null; + + /** + * Settings finalBackupConfig. + * @member {google.cloud.sql.v1beta4.IFinalBackupConfig|null|undefined} finalBackupConfig + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.finalBackupConfig = null; + + /** + * Settings readPoolAutoScaleConfig. + * @member {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig|null|undefined} readPoolAutoScaleConfig + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.readPoolAutoScaleConfig = null; + + /** + * Settings autoUpgradeEnabled. + * @member {boolean|null|undefined} autoUpgradeEnabled + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.autoUpgradeEnabled = null; + + /** + * Settings entraidConfig. + * @member {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig|null|undefined} entraidConfig + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.entraidConfig = null; + + /** + * Settings dataApiAccess. + * @member {google.cloud.sql.v1beta4.Settings.DataApiAccess|null|undefined} dataApiAccess + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.dataApiAccess = null; + + /** + * Settings performanceCaptureConfig. + * @member {google.cloud.sql.v1beta4.IPerformanceCaptureConfig|null|undefined} performanceCaptureConfig + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + */ + Settings.prototype.performanceCaptureConfig = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_dataDiskProvisionedIops", { + get: $util.oneOfGetter($oneOfFields = ["dataDiskProvisionedIops"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_dataDiskProvisionedThroughput", { + get: $util.oneOfGetter($oneOfFields = ["dataDiskProvisionedThroughput"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_connectionPoolConfig", { + get: $util.oneOfGetter($oneOfFields = ["connectionPoolConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_finalBackupConfig", { + get: $util.oneOfGetter($oneOfFields = ["finalBackupConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_readPoolAutoScaleConfig", { + get: $util.oneOfGetter($oneOfFields = ["readPoolAutoScaleConfig"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_autoUpgradeEnabled", { + get: $util.oneOfGetter($oneOfFields = ["autoUpgradeEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(Settings.prototype, "_dataApiAccess", { + get: $util.oneOfGetter($oneOfFields = ["dataApiAccess"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Settings instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.Settings + * @static + * @param {google.cloud.sql.v1beta4.ISettings=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.Settings} Settings instance + */ + Settings.create = function create(properties) { + return new Settings(properties); + }; + + /** + * Encodes the specified Settings message. Does not implicitly {@link google.cloud.sql.v1beta4.Settings.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.Settings + * @static + * @param {google.cloud.sql.v1beta4.ISettings} message Settings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Settings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.settingsVersion != null && Object.hasOwnProperty.call(message, "settingsVersion")) + $root.google.protobuf.Int64Value.encode(message.settingsVersion, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.authorizedGaeApplications != null && message.authorizedGaeApplications.length) + for (var i = 0; i < message.authorizedGaeApplications.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.authorizedGaeApplications[i]); + if (message.tier != null && Object.hasOwnProperty.call(message, "tier")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.tier); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); + if (message.userLabels != null && Object.hasOwnProperty.call(message, "userLabels")) + for (var keys = Object.keys(message.userLabels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.userLabels[keys[i]]).ldelim(); + if (message.availabilityType != null && Object.hasOwnProperty.call(message, "availabilityType")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.availabilityType); + if (message.pricingPlan != null && Object.hasOwnProperty.call(message, "pricingPlan")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pricingPlan); + if (message.replicationType != null && Object.hasOwnProperty.call(message, "replicationType")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.replicationType); + if (message.storageAutoResizeLimit != null && Object.hasOwnProperty.call(message, "storageAutoResizeLimit")) + $root.google.protobuf.Int64Value.encode(message.storageAutoResizeLimit, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.activationPolicy != null && Object.hasOwnProperty.call(message, "activationPolicy")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.activationPolicy); + if (message.ipConfiguration != null && Object.hasOwnProperty.call(message, "ipConfiguration")) + $root.google.cloud.sql.v1beta4.IpConfiguration.encode(message.ipConfiguration, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.storageAutoResize != null && Object.hasOwnProperty.call(message, "storageAutoResize")) + $root.google.protobuf.BoolValue.encode(message.storageAutoResize, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.locationPreference != null && Object.hasOwnProperty.call(message, "locationPreference")) + $root.google.cloud.sql.v1beta4.LocationPreference.encode(message.locationPreference, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.databaseFlags != null && message.databaseFlags.length) + for (var i = 0; i < message.databaseFlags.length; ++i) + $root.google.cloud.sql.v1beta4.DatabaseFlags.encode(message.databaseFlags[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.dataDiskType != null && Object.hasOwnProperty.call(message, "dataDiskType")) + writer.uint32(/* id 15, wireType 0 =*/120).int32(message.dataDiskType); + if (message.maintenanceWindow != null && Object.hasOwnProperty.call(message, "maintenanceWindow")) + $root.google.cloud.sql.v1beta4.MaintenanceWindow.encode(message.maintenanceWindow, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.backupConfiguration != null && Object.hasOwnProperty.call(message, "backupConfiguration")) + $root.google.cloud.sql.v1beta4.BackupConfiguration.encode(message.backupConfiguration, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.databaseReplicationEnabled != null && Object.hasOwnProperty.call(message, "databaseReplicationEnabled")) + $root.google.protobuf.BoolValue.encode(message.databaseReplicationEnabled, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); + if (message.crashSafeReplicationEnabled != null && Object.hasOwnProperty.call(message, "crashSafeReplicationEnabled")) + $root.google.protobuf.BoolValue.encode(message.crashSafeReplicationEnabled, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + if (message.dataDiskSizeGb != null && Object.hasOwnProperty.call(message, "dataDiskSizeGb")) + $root.google.protobuf.Int64Value.encode(message.dataDiskSizeGb, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.activeDirectoryConfig != null && Object.hasOwnProperty.call(message, "activeDirectoryConfig")) + $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.encode(message.activeDirectoryConfig, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.collation != null && Object.hasOwnProperty.call(message, "collation")) + writer.uint32(/* id 23, wireType 2 =*/186).string(message.collation); + if (message.denyMaintenancePeriods != null && message.denyMaintenancePeriods.length) + for (var i = 0; i < message.denyMaintenancePeriods.length; ++i) + $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod.encode(message.denyMaintenancePeriods[i], writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.insightsConfig != null && Object.hasOwnProperty.call(message, "insightsConfig")) + $root.google.cloud.sql.v1beta4.InsightsConfig.encode(message.insightsConfig, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.passwordValidationPolicy != null && Object.hasOwnProperty.call(message, "passwordValidationPolicy")) + $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.encode(message.passwordValidationPolicy, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + if (message.sqlServerAuditConfig != null && Object.hasOwnProperty.call(message, "sqlServerAuditConfig")) + $root.google.cloud.sql.v1beta4.SqlServerAuditConfig.encode(message.sqlServerAuditConfig, writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim(); + if (message.connectorEnforcement != null && Object.hasOwnProperty.call(message, "connectorEnforcement")) + writer.uint32(/* id 32, wireType 0 =*/256).int32(message.connectorEnforcement); + if (message.deletionProtectionEnabled != null && Object.hasOwnProperty.call(message, "deletionProtectionEnabled")) + $root.google.protobuf.BoolValue.encode(message.deletionProtectionEnabled, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); + if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) + writer.uint32(/* id 34, wireType 2 =*/274).string(message.timeZone); + if (message.advancedMachineFeatures != null && Object.hasOwnProperty.call(message, "advancedMachineFeatures")) + $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures.encode(message.advancedMachineFeatures, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + if (message.dataCacheConfig != null && Object.hasOwnProperty.call(message, "dataCacheConfig")) + $root.google.cloud.sql.v1beta4.DataCacheConfig.encode(message.dataCacheConfig, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim(); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 38, wireType 0 =*/304).int32(message.edition); + if (message.replicationLagMaxSeconds != null && Object.hasOwnProperty.call(message, "replicationLagMaxSeconds")) + $root.google.protobuf.Int32Value.encode(message.replicationLagMaxSeconds, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); + if (message.enableGoogleMlIntegration != null && Object.hasOwnProperty.call(message, "enableGoogleMlIntegration")) + $root.google.protobuf.BoolValue.encode(message.enableGoogleMlIntegration, writer.uint32(/* id 40, wireType 2 =*/322).fork()).ldelim(); + if (message.enableDataplexIntegration != null && Object.hasOwnProperty.call(message, "enableDataplexIntegration")) + $root.google.protobuf.BoolValue.encode(message.enableDataplexIntegration, writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); + if (message.retainBackupsOnDelete != null && Object.hasOwnProperty.call(message, "retainBackupsOnDelete")) + $root.google.protobuf.BoolValue.encode(message.retainBackupsOnDelete, writer.uint32(/* id 42, wireType 2 =*/338).fork()).ldelim(); + if (message.dataDiskProvisionedIops != null && Object.hasOwnProperty.call(message, "dataDiskProvisionedIops")) + writer.uint32(/* id 43, wireType 0 =*/344).int64(message.dataDiskProvisionedIops); + if (message.dataDiskProvisionedThroughput != null && Object.hasOwnProperty.call(message, "dataDiskProvisionedThroughput")) + writer.uint32(/* id 44, wireType 0 =*/352).int64(message.dataDiskProvisionedThroughput); + if (message.connectionPoolConfig != null && Object.hasOwnProperty.call(message, "connectionPoolConfig")) + $root.google.cloud.sql.v1beta4.ConnectionPoolConfig.encode(message.connectionPoolConfig, writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); + if (message.finalBackupConfig != null && Object.hasOwnProperty.call(message, "finalBackupConfig")) + $root.google.cloud.sql.v1beta4.FinalBackupConfig.encode(message.finalBackupConfig, writer.uint32(/* id 47, wireType 2 =*/378).fork()).ldelim(); + if (message.readPoolAutoScaleConfig != null && Object.hasOwnProperty.call(message, "readPoolAutoScaleConfig")) + $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.encode(message.readPoolAutoScaleConfig, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); + if (message.autoUpgradeEnabled != null && Object.hasOwnProperty.call(message, "autoUpgradeEnabled")) + writer.uint32(/* id 50, wireType 0 =*/400).bool(message.autoUpgradeEnabled); + if (message.entraidConfig != null && Object.hasOwnProperty.call(message, "entraidConfig")) + $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig.encode(message.entraidConfig, writer.uint32(/* id 52, wireType 2 =*/418).fork()).ldelim(); + if (message.dataApiAccess != null && Object.hasOwnProperty.call(message, "dataApiAccess")) + writer.uint32(/* id 53, wireType 0 =*/424).int32(message.dataApiAccess); + if (message.performanceCaptureConfig != null && Object.hasOwnProperty.call(message, "performanceCaptureConfig")) + $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig.encode(message.performanceCaptureConfig, writer.uint32(/* id 54, wireType 2 =*/434).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Settings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.Settings + * @static + * @param {google.cloud.sql.v1beta4.ISettings} message Settings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Settings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Settings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.Settings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.Settings} Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Settings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Settings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.settingsVersion = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 2: { + if (!(message.authorizedGaeApplications && message.authorizedGaeApplications.length)) + message.authorizedGaeApplications = []; + message.authorizedGaeApplications.push(reader.string()); + break; + } + case 3: { + message.tier = reader.string(); + break; + } + case 4: { + message.kind = reader.string(); + break; + } + case 5: { + if (message.userLabels === $util.emptyObject) + message.userLabels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.userLabels[key] = value; + break; + } + case 6: { + message.availabilityType = reader.int32(); + break; + } + case 7: { + message.pricingPlan = reader.int32(); + break; + } + case 8: { + message.replicationType = reader.int32(); + break; + } + case 9: { + message.storageAutoResizeLimit = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 10: { + message.activationPolicy = reader.int32(); + break; + } + case 11: { + message.ipConfiguration = $root.google.cloud.sql.v1beta4.IpConfiguration.decode(reader, reader.uint32()); + break; + } + case 12: { + message.storageAutoResize = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 13: { + message.locationPreference = $root.google.cloud.sql.v1beta4.LocationPreference.decode(reader, reader.uint32()); + break; + } + case 14: { + if (!(message.databaseFlags && message.databaseFlags.length)) + message.databaseFlags = []; + message.databaseFlags.push($root.google.cloud.sql.v1beta4.DatabaseFlags.decode(reader, reader.uint32())); + break; + } + case 15: { + message.dataDiskType = reader.int32(); + break; + } + case 16: { + message.maintenanceWindow = $root.google.cloud.sql.v1beta4.MaintenanceWindow.decode(reader, reader.uint32()); + break; + } + case 17: { + message.backupConfiguration = $root.google.cloud.sql.v1beta4.BackupConfiguration.decode(reader, reader.uint32()); + break; + } + case 18: { + message.databaseReplicationEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 19: { + message.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 20: { + message.dataDiskSizeGb = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); + break; + } + case 22: { + message.activeDirectoryConfig = $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.decode(reader, reader.uint32()); + break; + } + case 23: { + message.collation = reader.string(); + break; + } + case 24: { + if (!(message.denyMaintenancePeriods && message.denyMaintenancePeriods.length)) + message.denyMaintenancePeriods = []; + message.denyMaintenancePeriods.push($root.google.cloud.sql.v1beta4.DenyMaintenancePeriod.decode(reader, reader.uint32())); + break; + } + case 25: { + message.insightsConfig = $root.google.cloud.sql.v1beta4.InsightsConfig.decode(reader, reader.uint32()); + break; + } + case 27: { + message.passwordValidationPolicy = $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.decode(reader, reader.uint32()); + break; + } + case 29: { + message.sqlServerAuditConfig = $root.google.cloud.sql.v1beta4.SqlServerAuditConfig.decode(reader, reader.uint32()); + break; + } + case 38: { + message.edition = reader.int32(); + break; + } + case 32: { + message.connectorEnforcement = reader.int32(); + break; + } + case 33: { + message.deletionProtectionEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 34: { + message.timeZone = reader.string(); + break; + } + case 35: { + message.advancedMachineFeatures = $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures.decode(reader, reader.uint32()); + break; + } + case 37: { + message.dataCacheConfig = $root.google.cloud.sql.v1beta4.DataCacheConfig.decode(reader, reader.uint32()); + break; + } + case 39: { + message.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); + break; + } + case 40: { + message.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 41: { + message.enableDataplexIntegration = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 42: { + message.retainBackupsOnDelete = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } + case 43: { + message.dataDiskProvisionedIops = reader.int64(); + break; + } + case 44: { + message.dataDiskProvisionedThroughput = reader.int64(); + break; + } + case 45: { + message.connectionPoolConfig = $root.google.cloud.sql.v1beta4.ConnectionPoolConfig.decode(reader, reader.uint32()); + break; + } + case 47: { + message.finalBackupConfig = $root.google.cloud.sql.v1beta4.FinalBackupConfig.decode(reader, reader.uint32()); + break; + } + case 48: { + message.readPoolAutoScaleConfig = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.decode(reader, reader.uint32()); + break; + } + case 50: { + message.autoUpgradeEnabled = reader.bool(); + break; + } + case 52: { + message.entraidConfig = $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig.decode(reader, reader.uint32()); + break; + } + case 53: { + message.dataApiAccess = reader.int32(); + break; + } + case 54: { + message.performanceCaptureConfig = $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Settings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.Settings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.Settings} Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Settings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Settings message. + * @function verify + * @memberof google.cloud.sql.v1beta4.Settings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Settings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) { + var error = $root.google.protobuf.Int64Value.verify(message.settingsVersion); + if (error) + return "settingsVersion." + error; + } + if (message.authorizedGaeApplications != null && message.hasOwnProperty("authorizedGaeApplications")) { + if (!Array.isArray(message.authorizedGaeApplications)) + return "authorizedGaeApplications: array expected"; + for (var i = 0; i < message.authorizedGaeApplications.length; ++i) + if (!$util.isString(message.authorizedGaeApplications[i])) + return "authorizedGaeApplications: string[] expected"; + } + if (message.tier != null && message.hasOwnProperty("tier")) + if (!$util.isString(message.tier)) + return "tier: string expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.userLabels != null && message.hasOwnProperty("userLabels")) { + if (!$util.isObject(message.userLabels)) + return "userLabels: object expected"; + var key = Object.keys(message.userLabels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.userLabels[key[i]])) + return "userLabels: string{k:string} expected"; + } + if (message.availabilityType != null && message.hasOwnProperty("availabilityType")) + switch (message.availabilityType) { + default: + return "availabilityType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.pricingPlan != null && message.hasOwnProperty("pricingPlan")) + switch (message.pricingPlan) { + default: + return "pricingPlan: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.replicationType != null && message.hasOwnProperty("replicationType")) + switch (message.replicationType) { + default: + return "replicationType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.storageAutoResizeLimit != null && message.hasOwnProperty("storageAutoResizeLimit")) { + var error = $root.google.protobuf.Int64Value.verify(message.storageAutoResizeLimit); + if (error) + return "storageAutoResizeLimit." + error; + } + if (message.activationPolicy != null && message.hasOwnProperty("activationPolicy")) + switch (message.activationPolicy) { + default: + return "activationPolicy: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.ipConfiguration != null && message.hasOwnProperty("ipConfiguration")) { + var error = $root.google.cloud.sql.v1beta4.IpConfiguration.verify(message.ipConfiguration); + if (error) + return "ipConfiguration." + error; + } + if (message.storageAutoResize != null && message.hasOwnProperty("storageAutoResize")) { + var error = $root.google.protobuf.BoolValue.verify(message.storageAutoResize); + if (error) + return "storageAutoResize." + error; + } + if (message.locationPreference != null && message.hasOwnProperty("locationPreference")) { + var error = $root.google.cloud.sql.v1beta4.LocationPreference.verify(message.locationPreference); + if (error) + return "locationPreference." + error; + } + if (message.databaseFlags != null && message.hasOwnProperty("databaseFlags")) { + if (!Array.isArray(message.databaseFlags)) + return "databaseFlags: array expected"; + for (var i = 0; i < message.databaseFlags.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.DatabaseFlags.verify(message.databaseFlags[i]); + if (error) + return "databaseFlags." + error; + } + } + if (message.dataDiskType != null && message.hasOwnProperty("dataDiskType")) + switch (message.dataDiskType) { + default: + return "dataDiskType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.maintenanceWindow != null && message.hasOwnProperty("maintenanceWindow")) { + var error = $root.google.cloud.sql.v1beta4.MaintenanceWindow.verify(message.maintenanceWindow); + if (error) + return "maintenanceWindow." + error; + } + if (message.backupConfiguration != null && message.hasOwnProperty("backupConfiguration")) { + var error = $root.google.cloud.sql.v1beta4.BackupConfiguration.verify(message.backupConfiguration); + if (error) + return "backupConfiguration." + error; + } + if (message.databaseReplicationEnabled != null && message.hasOwnProperty("databaseReplicationEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.databaseReplicationEnabled); + if (error) + return "databaseReplicationEnabled." + error; + } + if (message.crashSafeReplicationEnabled != null && message.hasOwnProperty("crashSafeReplicationEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.crashSafeReplicationEnabled); + if (error) + return "crashSafeReplicationEnabled." + error; + } + if (message.dataDiskSizeGb != null && message.hasOwnProperty("dataDiskSizeGb")) { + var error = $root.google.protobuf.Int64Value.verify(message.dataDiskSizeGb); + if (error) + return "dataDiskSizeGb." + error; + } + if (message.activeDirectoryConfig != null && message.hasOwnProperty("activeDirectoryConfig")) { + var error = $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.verify(message.activeDirectoryConfig); + if (error) + return "activeDirectoryConfig." + error; + } + if (message.collation != null && message.hasOwnProperty("collation")) + if (!$util.isString(message.collation)) + return "collation: string expected"; + if (message.denyMaintenancePeriods != null && message.hasOwnProperty("denyMaintenancePeriods")) { + if (!Array.isArray(message.denyMaintenancePeriods)) + return "denyMaintenancePeriods: array expected"; + for (var i = 0; i < message.denyMaintenancePeriods.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod.verify(message.denyMaintenancePeriods[i]); + if (error) + return "denyMaintenancePeriods." + error; + } + } + if (message.insightsConfig != null && message.hasOwnProperty("insightsConfig")) { + var error = $root.google.cloud.sql.v1beta4.InsightsConfig.verify(message.insightsConfig); + if (error) + return "insightsConfig." + error; + } + if (message.passwordValidationPolicy != null && message.hasOwnProperty("passwordValidationPolicy")) { + var error = $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.verify(message.passwordValidationPolicy); + if (error) + return "passwordValidationPolicy." + error; + } + if (message.sqlServerAuditConfig != null && message.hasOwnProperty("sqlServerAuditConfig")) { + var error = $root.google.cloud.sql.v1beta4.SqlServerAuditConfig.verify(message.sqlServerAuditConfig); + if (error) + return "sqlServerAuditConfig." + error; + } + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 2: + case 3: + break; + } + if (message.connectorEnforcement != null && message.hasOwnProperty("connectorEnforcement")) + switch (message.connectorEnforcement) { + default: + return "connectorEnforcement: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.deletionProtectionEnabled != null && message.hasOwnProperty("deletionProtectionEnabled")) { + var error = $root.google.protobuf.BoolValue.verify(message.deletionProtectionEnabled); + if (error) + return "deletionProtectionEnabled." + error; + } + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + if (!$util.isString(message.timeZone)) + return "timeZone: string expected"; + if (message.advancedMachineFeatures != null && message.hasOwnProperty("advancedMachineFeatures")) { + var error = $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures.verify(message.advancedMachineFeatures); + if (error) + return "advancedMachineFeatures." + error; + } + if (message.dataCacheConfig != null && message.hasOwnProperty("dataCacheConfig")) { + var error = $root.google.cloud.sql.v1beta4.DataCacheConfig.verify(message.dataCacheConfig); + if (error) + return "dataCacheConfig." + error; + } + if (message.replicationLagMaxSeconds != null && message.hasOwnProperty("replicationLagMaxSeconds")) { + var error = $root.google.protobuf.Int32Value.verify(message.replicationLagMaxSeconds); + if (error) + return "replicationLagMaxSeconds." + error; + } + if (message.enableGoogleMlIntegration != null && message.hasOwnProperty("enableGoogleMlIntegration")) { + var error = $root.google.protobuf.BoolValue.verify(message.enableGoogleMlIntegration); + if (error) + return "enableGoogleMlIntegration." + error; + } + if (message.enableDataplexIntegration != null && message.hasOwnProperty("enableDataplexIntegration")) { + var error = $root.google.protobuf.BoolValue.verify(message.enableDataplexIntegration); + if (error) + return "enableDataplexIntegration." + error; + } + if (message.retainBackupsOnDelete != null && message.hasOwnProperty("retainBackupsOnDelete")) { + var error = $root.google.protobuf.BoolValue.verify(message.retainBackupsOnDelete); + if (error) + return "retainBackupsOnDelete." + error; + } + if (message.dataDiskProvisionedIops != null && message.hasOwnProperty("dataDiskProvisionedIops")) { + properties._dataDiskProvisionedIops = 1; + if (!$util.isInteger(message.dataDiskProvisionedIops) && !(message.dataDiskProvisionedIops && $util.isInteger(message.dataDiskProvisionedIops.low) && $util.isInteger(message.dataDiskProvisionedIops.high))) + return "dataDiskProvisionedIops: integer|Long expected"; + } + if (message.dataDiskProvisionedThroughput != null && message.hasOwnProperty("dataDiskProvisionedThroughput")) { + properties._dataDiskProvisionedThroughput = 1; + if (!$util.isInteger(message.dataDiskProvisionedThroughput) && !(message.dataDiskProvisionedThroughput && $util.isInteger(message.dataDiskProvisionedThroughput.low) && $util.isInteger(message.dataDiskProvisionedThroughput.high))) + return "dataDiskProvisionedThroughput: integer|Long expected"; + } + if (message.connectionPoolConfig != null && message.hasOwnProperty("connectionPoolConfig")) { + properties._connectionPoolConfig = 1; + { + var error = $root.google.cloud.sql.v1beta4.ConnectionPoolConfig.verify(message.connectionPoolConfig); + if (error) + return "connectionPoolConfig." + error; + } + } + if (message.finalBackupConfig != null && message.hasOwnProperty("finalBackupConfig")) { + properties._finalBackupConfig = 1; + { + var error = $root.google.cloud.sql.v1beta4.FinalBackupConfig.verify(message.finalBackupConfig); + if (error) + return "finalBackupConfig." + error; + } + } + if (message.readPoolAutoScaleConfig != null && message.hasOwnProperty("readPoolAutoScaleConfig")) { + properties._readPoolAutoScaleConfig = 1; + { + var error = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.verify(message.readPoolAutoScaleConfig); + if (error) + return "readPoolAutoScaleConfig." + error; + } + } + if (message.autoUpgradeEnabled != null && message.hasOwnProperty("autoUpgradeEnabled")) { + properties._autoUpgradeEnabled = 1; + if (typeof message.autoUpgradeEnabled !== "boolean") + return "autoUpgradeEnabled: boolean expected"; + } + if (message.entraidConfig != null && message.hasOwnProperty("entraidConfig")) { + var error = $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig.verify(message.entraidConfig); + if (error) + return "entraidConfig." + error; + } + if (message.dataApiAccess != null && message.hasOwnProperty("dataApiAccess")) { + properties._dataApiAccess = 1; + switch (message.dataApiAccess) { + default: + return "dataApiAccess: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.performanceCaptureConfig != null && message.hasOwnProperty("performanceCaptureConfig")) { + var error = $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig.verify(message.performanceCaptureConfig); + if (error) + return "performanceCaptureConfig." + error; + } + return null; + }; + + /** + * Creates a Settings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.Settings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.Settings} Settings + */ + Settings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.Settings) + return object; + var message = new $root.google.cloud.sql.v1beta4.Settings(); + if (object.settingsVersion != null) { + if (typeof object.settingsVersion !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.settingsVersion: object expected"); + message.settingsVersion = $root.google.protobuf.Int64Value.fromObject(object.settingsVersion); + } + if (object.authorizedGaeApplications) { + if (!Array.isArray(object.authorizedGaeApplications)) + throw TypeError(".google.cloud.sql.v1beta4.Settings.authorizedGaeApplications: array expected"); + message.authorizedGaeApplications = []; + for (var i = 0; i < object.authorizedGaeApplications.length; ++i) + message.authorizedGaeApplications[i] = String(object.authorizedGaeApplications[i]); + } + if (object.tier != null) + message.tier = String(object.tier); + if (object.kind != null) + message.kind = String(object.kind); + if (object.userLabels) { + if (typeof object.userLabels !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.userLabels: object expected"); + message.userLabels = {}; + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } + switch (object.availabilityType) { + default: + if (typeof object.availabilityType === "number") { + message.availabilityType = object.availabilityType; + break; + } + break; + case "SQL_AVAILABILITY_TYPE_UNSPECIFIED": + case 0: + message.availabilityType = 0; + break; + case "ZONAL": + case 1: + message.availabilityType = 1; + break; + case "REGIONAL": + case 2: + message.availabilityType = 2; + break; + } + switch (object.pricingPlan) { + default: + if (typeof object.pricingPlan === "number") { + message.pricingPlan = object.pricingPlan; + break; + } + break; + case "SQL_PRICING_PLAN_UNSPECIFIED": + case 0: + message.pricingPlan = 0; + break; + case "PACKAGE": + case 1: + message.pricingPlan = 1; + break; + case "PER_USE": + case 2: + message.pricingPlan = 2; + break; + } + switch (object.replicationType) { + default: + if (typeof object.replicationType === "number") { + message.replicationType = object.replicationType; + break; + } + break; + case "SQL_REPLICATION_TYPE_UNSPECIFIED": + case 0: + message.replicationType = 0; + break; + case "SYNCHRONOUS": + case 1: + message.replicationType = 1; + break; + case "ASYNCHRONOUS": + case 2: + message.replicationType = 2; + break; + } + if (object.storageAutoResizeLimit != null) { + if (typeof object.storageAutoResizeLimit !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.storageAutoResizeLimit: object expected"); + message.storageAutoResizeLimit = $root.google.protobuf.Int64Value.fromObject(object.storageAutoResizeLimit); + } + switch (object.activationPolicy) { + default: + if (typeof object.activationPolicy === "number") { + message.activationPolicy = object.activationPolicy; + break; + } + break; + case "SQL_ACTIVATION_POLICY_UNSPECIFIED": + case 0: + message.activationPolicy = 0; + break; + case "ALWAYS": + case 1: + message.activationPolicy = 1; + break; + case "NEVER": + case 2: + message.activationPolicy = 2; + break; + case "ON_DEMAND": + case 3: + message.activationPolicy = 3; + break; + } + if (object.ipConfiguration != null) { + if (typeof object.ipConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.ipConfiguration: object expected"); + message.ipConfiguration = $root.google.cloud.sql.v1beta4.IpConfiguration.fromObject(object.ipConfiguration); + } + if (object.storageAutoResize != null) { + if (typeof object.storageAutoResize !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.storageAutoResize: object expected"); + message.storageAutoResize = $root.google.protobuf.BoolValue.fromObject(object.storageAutoResize); + } + if (object.locationPreference != null) { + if (typeof object.locationPreference !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.locationPreference: object expected"); + message.locationPreference = $root.google.cloud.sql.v1beta4.LocationPreference.fromObject(object.locationPreference); + } + if (object.databaseFlags) { + if (!Array.isArray(object.databaseFlags)) + throw TypeError(".google.cloud.sql.v1beta4.Settings.databaseFlags: array expected"); + message.databaseFlags = []; + for (var i = 0; i < object.databaseFlags.length; ++i) { + if (typeof object.databaseFlags[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.databaseFlags: object expected"); + message.databaseFlags[i] = $root.google.cloud.sql.v1beta4.DatabaseFlags.fromObject(object.databaseFlags[i]); + } + } + switch (object.dataDiskType) { + default: + if (typeof object.dataDiskType === "number") { + message.dataDiskType = object.dataDiskType; + break; + } + break; + case "SQL_DATA_DISK_TYPE_UNSPECIFIED": + case 0: + message.dataDiskType = 0; + break; + case "PD_SSD": + case 1: + message.dataDiskType = 1; + break; + case "PD_HDD": + case 2: + message.dataDiskType = 2; + break; + case "OBSOLETE_LOCAL_SSD": + case 3: + message.dataDiskType = 3; + break; + case "HYPERDISK_BALANCED": + case 4: + message.dataDiskType = 4; + break; + } + if (object.maintenanceWindow != null) { + if (typeof object.maintenanceWindow !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.maintenanceWindow: object expected"); + message.maintenanceWindow = $root.google.cloud.sql.v1beta4.MaintenanceWindow.fromObject(object.maintenanceWindow); + } + if (object.backupConfiguration != null) { + if (typeof object.backupConfiguration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.backupConfiguration: object expected"); + message.backupConfiguration = $root.google.cloud.sql.v1beta4.BackupConfiguration.fromObject(object.backupConfiguration); + } + if (object.databaseReplicationEnabled != null) { + if (typeof object.databaseReplicationEnabled !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.databaseReplicationEnabled: object expected"); + message.databaseReplicationEnabled = $root.google.protobuf.BoolValue.fromObject(object.databaseReplicationEnabled); + } + if (object.crashSafeReplicationEnabled != null) { + if (typeof object.crashSafeReplicationEnabled !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.crashSafeReplicationEnabled: object expected"); + message.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.fromObject(object.crashSafeReplicationEnabled); + } + if (object.dataDiskSizeGb != null) { + if (typeof object.dataDiskSizeGb !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.dataDiskSizeGb: object expected"); + message.dataDiskSizeGb = $root.google.protobuf.Int64Value.fromObject(object.dataDiskSizeGb); + } + if (object.activeDirectoryConfig != null) { + if (typeof object.activeDirectoryConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.activeDirectoryConfig: object expected"); + message.activeDirectoryConfig = $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.fromObject(object.activeDirectoryConfig); + } + if (object.collation != null) + message.collation = String(object.collation); + if (object.denyMaintenancePeriods) { + if (!Array.isArray(object.denyMaintenancePeriods)) + throw TypeError(".google.cloud.sql.v1beta4.Settings.denyMaintenancePeriods: array expected"); + message.denyMaintenancePeriods = []; + for (var i = 0; i < object.denyMaintenancePeriods.length; ++i) { + if (typeof object.denyMaintenancePeriods[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.denyMaintenancePeriods: object expected"); + message.denyMaintenancePeriods[i] = $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod.fromObject(object.denyMaintenancePeriods[i]); + } + } + if (object.insightsConfig != null) { + if (typeof object.insightsConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.insightsConfig: object expected"); + message.insightsConfig = $root.google.cloud.sql.v1beta4.InsightsConfig.fromObject(object.insightsConfig); + } + if (object.passwordValidationPolicy != null) { + if (typeof object.passwordValidationPolicy !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.passwordValidationPolicy: object expected"); + message.passwordValidationPolicy = $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.fromObject(object.passwordValidationPolicy); + } + if (object.sqlServerAuditConfig != null) { + if (typeof object.sqlServerAuditConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.sqlServerAuditConfig: object expected"); + message.sqlServerAuditConfig = $root.google.cloud.sql.v1beta4.SqlServerAuditConfig.fromObject(object.sqlServerAuditConfig); + } + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNSPECIFIED": + case 0: + message.edition = 0; + break; + case "ENTERPRISE": + case 2: + message.edition = 2; + break; + case "ENTERPRISE_PLUS": + case 3: + message.edition = 3; + break; + } + switch (object.connectorEnforcement) { + default: + if (typeof object.connectorEnforcement === "number") { + message.connectorEnforcement = object.connectorEnforcement; + break; + } + break; + case "CONNECTOR_ENFORCEMENT_UNSPECIFIED": + case 0: + message.connectorEnforcement = 0; + break; + case "NOT_REQUIRED": + case 1: + message.connectorEnforcement = 1; + break; + case "REQUIRED": + case 2: + message.connectorEnforcement = 2; + break; + } + if (object.deletionProtectionEnabled != null) { + if (typeof object.deletionProtectionEnabled !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.deletionProtectionEnabled: object expected"); + message.deletionProtectionEnabled = $root.google.protobuf.BoolValue.fromObject(object.deletionProtectionEnabled); + } + if (object.timeZone != null) + message.timeZone = String(object.timeZone); + if (object.advancedMachineFeatures != null) { + if (typeof object.advancedMachineFeatures !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.advancedMachineFeatures: object expected"); + message.advancedMachineFeatures = $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures.fromObject(object.advancedMachineFeatures); + } + if (object.dataCacheConfig != null) { + if (typeof object.dataCacheConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.dataCacheConfig: object expected"); + message.dataCacheConfig = $root.google.cloud.sql.v1beta4.DataCacheConfig.fromObject(object.dataCacheConfig); + } + if (object.replicationLagMaxSeconds != null) { + if (typeof object.replicationLagMaxSeconds !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.replicationLagMaxSeconds: object expected"); + message.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.fromObject(object.replicationLagMaxSeconds); + } + if (object.enableGoogleMlIntegration != null) { + if (typeof object.enableGoogleMlIntegration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.enableGoogleMlIntegration: object expected"); + message.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.fromObject(object.enableGoogleMlIntegration); + } + if (object.enableDataplexIntegration != null) { + if (typeof object.enableDataplexIntegration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.enableDataplexIntegration: object expected"); + message.enableDataplexIntegration = $root.google.protobuf.BoolValue.fromObject(object.enableDataplexIntegration); + } + if (object.retainBackupsOnDelete != null) { + if (typeof object.retainBackupsOnDelete !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.retainBackupsOnDelete: object expected"); + message.retainBackupsOnDelete = $root.google.protobuf.BoolValue.fromObject(object.retainBackupsOnDelete); + } + if (object.dataDiskProvisionedIops != null) + if ($util.Long) + (message.dataDiskProvisionedIops = $util.Long.fromValue(object.dataDiskProvisionedIops)).unsigned = false; + else if (typeof object.dataDiskProvisionedIops === "string") + message.dataDiskProvisionedIops = parseInt(object.dataDiskProvisionedIops, 10); + else if (typeof object.dataDiskProvisionedIops === "number") + message.dataDiskProvisionedIops = object.dataDiskProvisionedIops; + else if (typeof object.dataDiskProvisionedIops === "object") + message.dataDiskProvisionedIops = new $util.LongBits(object.dataDiskProvisionedIops.low >>> 0, object.dataDiskProvisionedIops.high >>> 0).toNumber(); + if (object.dataDiskProvisionedThroughput != null) + if ($util.Long) + (message.dataDiskProvisionedThroughput = $util.Long.fromValue(object.dataDiskProvisionedThroughput)).unsigned = false; + else if (typeof object.dataDiskProvisionedThroughput === "string") + message.dataDiskProvisionedThroughput = parseInt(object.dataDiskProvisionedThroughput, 10); + else if (typeof object.dataDiskProvisionedThroughput === "number") + message.dataDiskProvisionedThroughput = object.dataDiskProvisionedThroughput; + else if (typeof object.dataDiskProvisionedThroughput === "object") + message.dataDiskProvisionedThroughput = new $util.LongBits(object.dataDiskProvisionedThroughput.low >>> 0, object.dataDiskProvisionedThroughput.high >>> 0).toNumber(); + if (object.connectionPoolConfig != null) { + if (typeof object.connectionPoolConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.connectionPoolConfig: object expected"); + message.connectionPoolConfig = $root.google.cloud.sql.v1beta4.ConnectionPoolConfig.fromObject(object.connectionPoolConfig); + } + if (object.finalBackupConfig != null) { + if (typeof object.finalBackupConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.finalBackupConfig: object expected"); + message.finalBackupConfig = $root.google.cloud.sql.v1beta4.FinalBackupConfig.fromObject(object.finalBackupConfig); + } + if (object.readPoolAutoScaleConfig != null) { + if (typeof object.readPoolAutoScaleConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.readPoolAutoScaleConfig: object expected"); + message.readPoolAutoScaleConfig = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.fromObject(object.readPoolAutoScaleConfig); + } + if (object.autoUpgradeEnabled != null) + message.autoUpgradeEnabled = Boolean(object.autoUpgradeEnabled); + if (object.entraidConfig != null) { + if (typeof object.entraidConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.entraidConfig: object expected"); + message.entraidConfig = $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig.fromObject(object.entraidConfig); + } + switch (object.dataApiAccess) { + default: + if (typeof object.dataApiAccess === "number") { + message.dataApiAccess = object.dataApiAccess; + break; + } + break; + case "DATA_API_ACCESS_UNSPECIFIED": + case 0: + message.dataApiAccess = 0; + break; + case "DISALLOW_DATA_API": + case 1: + message.dataApiAccess = 1; + break; + case "ALLOW_DATA_API": + case 2: + message.dataApiAccess = 2; + break; + } + if (object.performanceCaptureConfig != null) { + if (typeof object.performanceCaptureConfig !== "object") + throw TypeError(".google.cloud.sql.v1beta4.Settings.performanceCaptureConfig: object expected"); + message.performanceCaptureConfig = $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig.fromObject(object.performanceCaptureConfig); + } + return message; + }; + + /** + * Creates a plain object from a Settings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.Settings + * @static + * @param {google.cloud.sql.v1beta4.Settings} message Settings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Settings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.authorizedGaeApplications = []; + object.databaseFlags = []; + object.denyMaintenancePeriods = []; + } + if (options.objects || options.defaults) + object.userLabels = {}; + if (options.defaults) { + object.settingsVersion = null; + object.tier = ""; + object.kind = ""; + object.availabilityType = options.enums === String ? "SQL_AVAILABILITY_TYPE_UNSPECIFIED" : 0; + object.pricingPlan = options.enums === String ? "SQL_PRICING_PLAN_UNSPECIFIED" : 0; + object.replicationType = options.enums === String ? "SQL_REPLICATION_TYPE_UNSPECIFIED" : 0; + object.storageAutoResizeLimit = null; + object.activationPolicy = options.enums === String ? "SQL_ACTIVATION_POLICY_UNSPECIFIED" : 0; + object.ipConfiguration = null; + object.storageAutoResize = null; + object.locationPreference = null; + object.dataDiskType = options.enums === String ? "SQL_DATA_DISK_TYPE_UNSPECIFIED" : 0; + object.maintenanceWindow = null; + object.backupConfiguration = null; + object.databaseReplicationEnabled = null; + object.crashSafeReplicationEnabled = null; + object.dataDiskSizeGb = null; + object.activeDirectoryConfig = null; + object.collation = ""; + object.insightsConfig = null; + object.passwordValidationPolicy = null; + object.sqlServerAuditConfig = null; + object.connectorEnforcement = options.enums === String ? "CONNECTOR_ENFORCEMENT_UNSPECIFIED" : 0; + object.deletionProtectionEnabled = null; + object.timeZone = ""; + object.advancedMachineFeatures = null; + object.dataCacheConfig = null; + object.edition = options.enums === String ? "EDITION_UNSPECIFIED" : 0; + object.replicationLagMaxSeconds = null; + object.enableGoogleMlIntegration = null; + object.enableDataplexIntegration = null; + object.retainBackupsOnDelete = null; + object.entraidConfig = null; + object.performanceCaptureConfig = null; + } + if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) + object.settingsVersion = $root.google.protobuf.Int64Value.toObject(message.settingsVersion, options); + if (message.authorizedGaeApplications && message.authorizedGaeApplications.length) { + object.authorizedGaeApplications = []; + for (var j = 0; j < message.authorizedGaeApplications.length; ++j) + object.authorizedGaeApplications[j] = message.authorizedGaeApplications[j]; + } + if (message.tier != null && message.hasOwnProperty("tier")) + object.tier = message.tier; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + var keys2; + if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { + object.userLabels = {}; + for (var j = 0; j < keys2.length; ++j) + object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } + if (message.availabilityType != null && message.hasOwnProperty("availabilityType")) + object.availabilityType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlAvailabilityType[message.availabilityType] === undefined ? message.availabilityType : $root.google.cloud.sql.v1beta4.SqlAvailabilityType[message.availabilityType] : message.availabilityType; + if (message.pricingPlan != null && message.hasOwnProperty("pricingPlan")) + object.pricingPlan = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlPricingPlan[message.pricingPlan] === undefined ? message.pricingPlan : $root.google.cloud.sql.v1beta4.SqlPricingPlan[message.pricingPlan] : message.pricingPlan; + if (message.replicationType != null && message.hasOwnProperty("replicationType")) + object.replicationType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlReplicationType[message.replicationType] === undefined ? message.replicationType : $root.google.cloud.sql.v1beta4.SqlReplicationType[message.replicationType] : message.replicationType; + if (message.storageAutoResizeLimit != null && message.hasOwnProperty("storageAutoResizeLimit")) + object.storageAutoResizeLimit = $root.google.protobuf.Int64Value.toObject(message.storageAutoResizeLimit, options); + if (message.activationPolicy != null && message.hasOwnProperty("activationPolicy")) + object.activationPolicy = options.enums === String ? $root.google.cloud.sql.v1beta4.Settings.SqlActivationPolicy[message.activationPolicy] === undefined ? message.activationPolicy : $root.google.cloud.sql.v1beta4.Settings.SqlActivationPolicy[message.activationPolicy] : message.activationPolicy; + if (message.ipConfiguration != null && message.hasOwnProperty("ipConfiguration")) + object.ipConfiguration = $root.google.cloud.sql.v1beta4.IpConfiguration.toObject(message.ipConfiguration, options); + if (message.storageAutoResize != null && message.hasOwnProperty("storageAutoResize")) + object.storageAutoResize = $root.google.protobuf.BoolValue.toObject(message.storageAutoResize, options); + if (message.locationPreference != null && message.hasOwnProperty("locationPreference")) + object.locationPreference = $root.google.cloud.sql.v1beta4.LocationPreference.toObject(message.locationPreference, options); + if (message.databaseFlags && message.databaseFlags.length) { + object.databaseFlags = []; + for (var j = 0; j < message.databaseFlags.length; ++j) + object.databaseFlags[j] = $root.google.cloud.sql.v1beta4.DatabaseFlags.toObject(message.databaseFlags[j], options); + } + if (message.dataDiskType != null && message.hasOwnProperty("dataDiskType")) + object.dataDiskType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDataDiskType[message.dataDiskType] === undefined ? message.dataDiskType : $root.google.cloud.sql.v1beta4.SqlDataDiskType[message.dataDiskType] : message.dataDiskType; + if (message.maintenanceWindow != null && message.hasOwnProperty("maintenanceWindow")) + object.maintenanceWindow = $root.google.cloud.sql.v1beta4.MaintenanceWindow.toObject(message.maintenanceWindow, options); + if (message.backupConfiguration != null && message.hasOwnProperty("backupConfiguration")) + object.backupConfiguration = $root.google.cloud.sql.v1beta4.BackupConfiguration.toObject(message.backupConfiguration, options); + if (message.databaseReplicationEnabled != null && message.hasOwnProperty("databaseReplicationEnabled")) + object.databaseReplicationEnabled = $root.google.protobuf.BoolValue.toObject(message.databaseReplicationEnabled, options); + if (message.crashSafeReplicationEnabled != null && message.hasOwnProperty("crashSafeReplicationEnabled")) + object.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.toObject(message.crashSafeReplicationEnabled, options); + if (message.dataDiskSizeGb != null && message.hasOwnProperty("dataDiskSizeGb")) + object.dataDiskSizeGb = $root.google.protobuf.Int64Value.toObject(message.dataDiskSizeGb, options); + if (message.activeDirectoryConfig != null && message.hasOwnProperty("activeDirectoryConfig")) + object.activeDirectoryConfig = $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.toObject(message.activeDirectoryConfig, options); + if (message.collation != null && message.hasOwnProperty("collation")) + object.collation = message.collation; + if (message.denyMaintenancePeriods && message.denyMaintenancePeriods.length) { + object.denyMaintenancePeriods = []; + for (var j = 0; j < message.denyMaintenancePeriods.length; ++j) + object.denyMaintenancePeriods[j] = $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod.toObject(message.denyMaintenancePeriods[j], options); + } + if (message.insightsConfig != null && message.hasOwnProperty("insightsConfig")) + object.insightsConfig = $root.google.cloud.sql.v1beta4.InsightsConfig.toObject(message.insightsConfig, options); + if (message.passwordValidationPolicy != null && message.hasOwnProperty("passwordValidationPolicy")) + object.passwordValidationPolicy = $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.toObject(message.passwordValidationPolicy, options); + if (message.sqlServerAuditConfig != null && message.hasOwnProperty("sqlServerAuditConfig")) + object.sqlServerAuditConfig = $root.google.cloud.sql.v1beta4.SqlServerAuditConfig.toObject(message.sqlServerAuditConfig, options); + if (message.connectorEnforcement != null && message.hasOwnProperty("connectorEnforcement")) + object.connectorEnforcement = options.enums === String ? $root.google.cloud.sql.v1beta4.Settings.ConnectorEnforcement[message.connectorEnforcement] === undefined ? message.connectorEnforcement : $root.google.cloud.sql.v1beta4.Settings.ConnectorEnforcement[message.connectorEnforcement] : message.connectorEnforcement; + if (message.deletionProtectionEnabled != null && message.hasOwnProperty("deletionProtectionEnabled")) + object.deletionProtectionEnabled = $root.google.protobuf.BoolValue.toObject(message.deletionProtectionEnabled, options); + if (message.timeZone != null && message.hasOwnProperty("timeZone")) + object.timeZone = message.timeZone; + if (message.advancedMachineFeatures != null && message.hasOwnProperty("advancedMachineFeatures")) + object.advancedMachineFeatures = $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures.toObject(message.advancedMachineFeatures, options); + if (message.dataCacheConfig != null && message.hasOwnProperty("dataCacheConfig")) + object.dataCacheConfig = $root.google.cloud.sql.v1beta4.DataCacheConfig.toObject(message.dataCacheConfig, options); + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.cloud.sql.v1beta4.Settings.Edition[message.edition] === undefined ? message.edition : $root.google.cloud.sql.v1beta4.Settings.Edition[message.edition] : message.edition; + if (message.replicationLagMaxSeconds != null && message.hasOwnProperty("replicationLagMaxSeconds")) + object.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.toObject(message.replicationLagMaxSeconds, options); + if (message.enableGoogleMlIntegration != null && message.hasOwnProperty("enableGoogleMlIntegration")) + object.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.toObject(message.enableGoogleMlIntegration, options); + if (message.enableDataplexIntegration != null && message.hasOwnProperty("enableDataplexIntegration")) + object.enableDataplexIntegration = $root.google.protobuf.BoolValue.toObject(message.enableDataplexIntegration, options); + if (message.retainBackupsOnDelete != null && message.hasOwnProperty("retainBackupsOnDelete")) + object.retainBackupsOnDelete = $root.google.protobuf.BoolValue.toObject(message.retainBackupsOnDelete, options); + if (message.dataDiskProvisionedIops != null && message.hasOwnProperty("dataDiskProvisionedIops")) { + if (typeof message.dataDiskProvisionedIops === "number") + object.dataDiskProvisionedIops = options.longs === String ? String(message.dataDiskProvisionedIops) : message.dataDiskProvisionedIops; + else + object.dataDiskProvisionedIops = options.longs === String ? $util.Long.prototype.toString.call(message.dataDiskProvisionedIops) : options.longs === Number ? new $util.LongBits(message.dataDiskProvisionedIops.low >>> 0, message.dataDiskProvisionedIops.high >>> 0).toNumber() : message.dataDiskProvisionedIops; + if (options.oneofs) + object._dataDiskProvisionedIops = "dataDiskProvisionedIops"; + } + if (message.dataDiskProvisionedThroughput != null && message.hasOwnProperty("dataDiskProvisionedThroughput")) { + if (typeof message.dataDiskProvisionedThroughput === "number") + object.dataDiskProvisionedThroughput = options.longs === String ? String(message.dataDiskProvisionedThroughput) : message.dataDiskProvisionedThroughput; + else + object.dataDiskProvisionedThroughput = options.longs === String ? $util.Long.prototype.toString.call(message.dataDiskProvisionedThroughput) : options.longs === Number ? new $util.LongBits(message.dataDiskProvisionedThroughput.low >>> 0, message.dataDiskProvisionedThroughput.high >>> 0).toNumber() : message.dataDiskProvisionedThroughput; + if (options.oneofs) + object._dataDiskProvisionedThroughput = "dataDiskProvisionedThroughput"; + } + if (message.connectionPoolConfig != null && message.hasOwnProperty("connectionPoolConfig")) { + object.connectionPoolConfig = $root.google.cloud.sql.v1beta4.ConnectionPoolConfig.toObject(message.connectionPoolConfig, options); + if (options.oneofs) + object._connectionPoolConfig = "connectionPoolConfig"; + } + if (message.finalBackupConfig != null && message.hasOwnProperty("finalBackupConfig")) { + object.finalBackupConfig = $root.google.cloud.sql.v1beta4.FinalBackupConfig.toObject(message.finalBackupConfig, options); + if (options.oneofs) + object._finalBackupConfig = "finalBackupConfig"; + } + if (message.readPoolAutoScaleConfig != null && message.hasOwnProperty("readPoolAutoScaleConfig")) { + object.readPoolAutoScaleConfig = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.toObject(message.readPoolAutoScaleConfig, options); + if (options.oneofs) + object._readPoolAutoScaleConfig = "readPoolAutoScaleConfig"; + } + if (message.autoUpgradeEnabled != null && message.hasOwnProperty("autoUpgradeEnabled")) { + object.autoUpgradeEnabled = message.autoUpgradeEnabled; + if (options.oneofs) + object._autoUpgradeEnabled = "autoUpgradeEnabled"; + } + if (message.entraidConfig != null && message.hasOwnProperty("entraidConfig")) + object.entraidConfig = $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig.toObject(message.entraidConfig, options); + if (message.dataApiAccess != null && message.hasOwnProperty("dataApiAccess")) { + object.dataApiAccess = options.enums === String ? $root.google.cloud.sql.v1beta4.Settings.DataApiAccess[message.dataApiAccess] === undefined ? message.dataApiAccess : $root.google.cloud.sql.v1beta4.Settings.DataApiAccess[message.dataApiAccess] : message.dataApiAccess; + if (options.oneofs) + object._dataApiAccess = "dataApiAccess"; + } + if (message.performanceCaptureConfig != null && message.hasOwnProperty("performanceCaptureConfig")) + object.performanceCaptureConfig = $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig.toObject(message.performanceCaptureConfig, options); + return object; + }; + + /** + * Converts this Settings to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.Settings + * @instance + * @returns {Object.} JSON object + */ + Settings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Settings + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.Settings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Settings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.Settings"; + }; + + /** + * SqlActivationPolicy enum. + * @name google.cloud.sql.v1beta4.Settings.SqlActivationPolicy + * @enum {number} + * @property {number} SQL_ACTIVATION_POLICY_UNSPECIFIED=0 SQL_ACTIVATION_POLICY_UNSPECIFIED value + * @property {number} ALWAYS=1 ALWAYS value + * @property {number} NEVER=2 NEVER value + * @property {number} ON_DEMAND=3 ON_DEMAND value + */ + Settings.SqlActivationPolicy = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_ACTIVATION_POLICY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ALWAYS"] = 1; + values[valuesById[2] = "NEVER"] = 2; + values[valuesById[3] = "ON_DEMAND"] = 3; + return values; + })(); + + /** + * Edition enum. + * @name google.cloud.sql.v1beta4.Settings.Edition + * @enum {number} + * @property {number} EDITION_UNSPECIFIED=0 EDITION_UNSPECIFIED value + * @property {number} ENTERPRISE=2 ENTERPRISE value + * @property {number} ENTERPRISE_PLUS=3 ENTERPRISE_PLUS value + */ + Settings.Edition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EDITION_UNSPECIFIED"] = 0; + values[valuesById[2] = "ENTERPRISE"] = 2; + values[valuesById[3] = "ENTERPRISE_PLUS"] = 3; + return values; + })(); + + /** + * ConnectorEnforcement enum. + * @name google.cloud.sql.v1beta4.Settings.ConnectorEnforcement + * @enum {number} + * @property {number} CONNECTOR_ENFORCEMENT_UNSPECIFIED=0 CONNECTOR_ENFORCEMENT_UNSPECIFIED value + * @property {number} NOT_REQUIRED=1 NOT_REQUIRED value + * @property {number} REQUIRED=2 REQUIRED value + */ + Settings.ConnectorEnforcement = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CONNECTOR_ENFORCEMENT_UNSPECIFIED"] = 0; + values[valuesById[1] = "NOT_REQUIRED"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + return values; + })(); + + /** + * DataApiAccess enum. + * @name google.cloud.sql.v1beta4.Settings.DataApiAccess + * @enum {number} + * @property {number} DATA_API_ACCESS_UNSPECIFIED=0 DATA_API_ACCESS_UNSPECIFIED value + * @property {number} DISALLOW_DATA_API=1 DISALLOW_DATA_API value + * @property {number} ALLOW_DATA_API=2 ALLOW_DATA_API value + */ + Settings.DataApiAccess = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DATA_API_ACCESS_UNSPECIFIED"] = 0; + values[valuesById[1] = "DISALLOW_DATA_API"] = 1; + values[valuesById[2] = "ALLOW_DATA_API"] = 2; + return values; + })(); + + return Settings; + })(); + + v1beta4.PerformanceCaptureConfig = (function() { + + /** + * Properties of a PerformanceCaptureConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IPerformanceCaptureConfig + * @property {boolean|null} [enabled] PerformanceCaptureConfig enabled + * @property {number|null} [probingIntervalSeconds] PerformanceCaptureConfig probingIntervalSeconds + * @property {number|null} [probeThreshold] PerformanceCaptureConfig probeThreshold + * @property {number|null} [runningThreadsThreshold] PerformanceCaptureConfig runningThreadsThreshold + * @property {number|null} [secondsBehindSourceThreshold] PerformanceCaptureConfig secondsBehindSourceThreshold + * @property {number|null} [transactionDurationThreshold] PerformanceCaptureConfig transactionDurationThreshold + */ + + /** + * Constructs a new PerformanceCaptureConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a PerformanceCaptureConfig. + * @implements IPerformanceCaptureConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IPerformanceCaptureConfig=} [properties] Properties to set + */ + function PerformanceCaptureConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PerformanceCaptureConfig enabled. + * @member {boolean|null|undefined} enabled + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.enabled = null; + + /** + * PerformanceCaptureConfig probingIntervalSeconds. + * @member {number|null|undefined} probingIntervalSeconds + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.probingIntervalSeconds = null; + + /** + * PerformanceCaptureConfig probeThreshold. + * @member {number|null|undefined} probeThreshold + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.probeThreshold = null; + + /** + * PerformanceCaptureConfig runningThreadsThreshold. + * @member {number|null|undefined} runningThreadsThreshold + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.runningThreadsThreshold = null; + + /** + * PerformanceCaptureConfig secondsBehindSourceThreshold. + * @member {number|null|undefined} secondsBehindSourceThreshold + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.secondsBehindSourceThreshold = null; + + /** + * PerformanceCaptureConfig transactionDurationThreshold. + * @member {number|null|undefined} transactionDurationThreshold + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @instance + */ + PerformanceCaptureConfig.prototype.transactionDurationThreshold = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_enabled", { + get: $util.oneOfGetter($oneOfFields = ["enabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_probingIntervalSeconds", { + get: $util.oneOfGetter($oneOfFields = ["probingIntervalSeconds"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_probeThreshold", { + get: $util.oneOfGetter($oneOfFields = ["probeThreshold"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_runningThreadsThreshold", { + get: $util.oneOfGetter($oneOfFields = ["runningThreadsThreshold"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_secondsBehindSourceThreshold", { + get: $util.oneOfGetter($oneOfFields = ["secondsBehindSourceThreshold"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PerformanceCaptureConfig.prototype, "_transactionDurationThreshold", { + get: $util.oneOfGetter($oneOfFields = ["transactionDurationThreshold"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new PerformanceCaptureConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @static + * @param {google.cloud.sql.v1beta4.IPerformanceCaptureConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.PerformanceCaptureConfig} PerformanceCaptureConfig instance + */ + PerformanceCaptureConfig.create = function create(properties) { + return new PerformanceCaptureConfig(properties); + }; + + /** + * Encodes the specified PerformanceCaptureConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PerformanceCaptureConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @static + * @param {google.cloud.sql.v1beta4.IPerformanceCaptureConfig} message PerformanceCaptureConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformanceCaptureConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.probingIntervalSeconds != null && Object.hasOwnProperty.call(message, "probingIntervalSeconds")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.probingIntervalSeconds); + if (message.probeThreshold != null && Object.hasOwnProperty.call(message, "probeThreshold")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.probeThreshold); + if (message.runningThreadsThreshold != null && Object.hasOwnProperty.call(message, "runningThreadsThreshold")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.runningThreadsThreshold); + if (message.secondsBehindSourceThreshold != null && Object.hasOwnProperty.call(message, "secondsBehindSourceThreshold")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.secondsBehindSourceThreshold); + if (message.transactionDurationThreshold != null && Object.hasOwnProperty.call(message, "transactionDurationThreshold")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.transactionDurationThreshold); + return writer; + }; + + /** + * Encodes the specified PerformanceCaptureConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PerformanceCaptureConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @static + * @param {google.cloud.sql.v1beta4.IPerformanceCaptureConfig} message PerformanceCaptureConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PerformanceCaptureConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PerformanceCaptureConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.PerformanceCaptureConfig} PerformanceCaptureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformanceCaptureConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.enabled = reader.bool(); + break; + } + case 2: { + message.probingIntervalSeconds = reader.int32(); + break; + } + case 3: { + message.probeThreshold = reader.int32(); + break; + } + case 4: { + message.runningThreadsThreshold = reader.int32(); + break; + } + case 5: { + message.secondsBehindSourceThreshold = reader.int32(); + break; + } + case 8: { + message.transactionDurationThreshold = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PerformanceCaptureConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.PerformanceCaptureConfig} PerformanceCaptureConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PerformanceCaptureConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PerformanceCaptureConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PerformanceCaptureConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + properties._enabled = 1; + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + } + if (message.probingIntervalSeconds != null && message.hasOwnProperty("probingIntervalSeconds")) { + properties._probingIntervalSeconds = 1; + if (!$util.isInteger(message.probingIntervalSeconds)) + return "probingIntervalSeconds: integer expected"; + } + if (message.probeThreshold != null && message.hasOwnProperty("probeThreshold")) { + properties._probeThreshold = 1; + if (!$util.isInteger(message.probeThreshold)) + return "probeThreshold: integer expected"; + } + if (message.runningThreadsThreshold != null && message.hasOwnProperty("runningThreadsThreshold")) { + properties._runningThreadsThreshold = 1; + if (!$util.isInteger(message.runningThreadsThreshold)) + return "runningThreadsThreshold: integer expected"; + } + if (message.secondsBehindSourceThreshold != null && message.hasOwnProperty("secondsBehindSourceThreshold")) { + properties._secondsBehindSourceThreshold = 1; + if (!$util.isInteger(message.secondsBehindSourceThreshold)) + return "secondsBehindSourceThreshold: integer expected"; + } + if (message.transactionDurationThreshold != null && message.hasOwnProperty("transactionDurationThreshold")) { + properties._transactionDurationThreshold = 1; + if (!$util.isInteger(message.transactionDurationThreshold)) + return "transactionDurationThreshold: integer expected"; + } + return null; + }; + + /** + * Creates a PerformanceCaptureConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.PerformanceCaptureConfig} PerformanceCaptureConfig + */ + PerformanceCaptureConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.probingIntervalSeconds != null) + message.probingIntervalSeconds = object.probingIntervalSeconds | 0; + if (object.probeThreshold != null) + message.probeThreshold = object.probeThreshold | 0; + if (object.runningThreadsThreshold != null) + message.runningThreadsThreshold = object.runningThreadsThreshold | 0; + if (object.secondsBehindSourceThreshold != null) + message.secondsBehindSourceThreshold = object.secondsBehindSourceThreshold | 0; + if (object.transactionDurationThreshold != null) + message.transactionDurationThreshold = object.transactionDurationThreshold | 0; + return message; + }; + + /** + * Creates a plain object from a PerformanceCaptureConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @static + * @param {google.cloud.sql.v1beta4.PerformanceCaptureConfig} message PerformanceCaptureConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PerformanceCaptureConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + object.enabled = message.enabled; + if (options.oneofs) + object._enabled = "enabled"; + } + if (message.probingIntervalSeconds != null && message.hasOwnProperty("probingIntervalSeconds")) { + object.probingIntervalSeconds = message.probingIntervalSeconds; + if (options.oneofs) + object._probingIntervalSeconds = "probingIntervalSeconds"; + } + if (message.probeThreshold != null && message.hasOwnProperty("probeThreshold")) { + object.probeThreshold = message.probeThreshold; + if (options.oneofs) + object._probeThreshold = "probeThreshold"; + } + if (message.runningThreadsThreshold != null && message.hasOwnProperty("runningThreadsThreshold")) { + object.runningThreadsThreshold = message.runningThreadsThreshold; + if (options.oneofs) + object._runningThreadsThreshold = "runningThreadsThreshold"; + } + if (message.secondsBehindSourceThreshold != null && message.hasOwnProperty("secondsBehindSourceThreshold")) { + object.secondsBehindSourceThreshold = message.secondsBehindSourceThreshold; + if (options.oneofs) + object._secondsBehindSourceThreshold = "secondsBehindSourceThreshold"; + } + if (message.transactionDurationThreshold != null && message.hasOwnProperty("transactionDurationThreshold")) { + object.transactionDurationThreshold = message.transactionDurationThreshold; + if (options.oneofs) + object._transactionDurationThreshold = "transactionDurationThreshold"; + } + return object; + }; + + /** + * Converts this PerformanceCaptureConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @instance + * @returns {Object.} JSON object + */ + PerformanceCaptureConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PerformanceCaptureConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PerformanceCaptureConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.PerformanceCaptureConfig"; + }; + + return PerformanceCaptureConfig; + })(); + + v1beta4.AdvancedMachineFeatures = (function() { + + /** + * Properties of an AdvancedMachineFeatures. + * @memberof google.cloud.sql.v1beta4 + * @interface IAdvancedMachineFeatures + * @property {number|null} [threadsPerCore] AdvancedMachineFeatures threadsPerCore + */ + + /** + * Constructs a new AdvancedMachineFeatures. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an AdvancedMachineFeatures. + * @implements IAdvancedMachineFeatures + * @constructor + * @param {google.cloud.sql.v1beta4.IAdvancedMachineFeatures=} [properties] Properties to set + */ + function AdvancedMachineFeatures(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AdvancedMachineFeatures threadsPerCore. + * @member {number} threadsPerCore + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @instance + */ + AdvancedMachineFeatures.prototype.threadsPerCore = 0; + + /** + * Creates a new AdvancedMachineFeatures instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @static + * @param {google.cloud.sql.v1beta4.IAdvancedMachineFeatures=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.AdvancedMachineFeatures} AdvancedMachineFeatures instance + */ + AdvancedMachineFeatures.create = function create(properties) { + return new AdvancedMachineFeatures(properties); + }; + + /** + * Encodes the specified AdvancedMachineFeatures message. Does not implicitly {@link google.cloud.sql.v1beta4.AdvancedMachineFeatures.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @static + * @param {google.cloud.sql.v1beta4.IAdvancedMachineFeatures} message AdvancedMachineFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AdvancedMachineFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.threadsPerCore != null && Object.hasOwnProperty.call(message, "threadsPerCore")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.threadsPerCore); + return writer; + }; + + /** + * Encodes the specified AdvancedMachineFeatures message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AdvancedMachineFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @static + * @param {google.cloud.sql.v1beta4.IAdvancedMachineFeatures} message AdvancedMachineFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AdvancedMachineFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AdvancedMachineFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.AdvancedMachineFeatures} AdvancedMachineFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AdvancedMachineFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.threadsPerCore = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AdvancedMachineFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.AdvancedMachineFeatures} AdvancedMachineFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AdvancedMachineFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AdvancedMachineFeatures message. + * @function verify + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AdvancedMachineFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.threadsPerCore != null && message.hasOwnProperty("threadsPerCore")) + if (!$util.isInteger(message.threadsPerCore)) + return "threadsPerCore: integer expected"; + return null; + }; + + /** + * Creates an AdvancedMachineFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.AdvancedMachineFeatures} AdvancedMachineFeatures + */ + AdvancedMachineFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures) + return object; + var message = new $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures(); + if (object.threadsPerCore != null) + message.threadsPerCore = object.threadsPerCore | 0; + return message; + }; + + /** + * Creates a plain object from an AdvancedMachineFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @static + * @param {google.cloud.sql.v1beta4.AdvancedMachineFeatures} message AdvancedMachineFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AdvancedMachineFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.threadsPerCore = 0; + if (message.threadsPerCore != null && message.hasOwnProperty("threadsPerCore")) + object.threadsPerCore = message.threadsPerCore; + return object; + }; + + /** + * Converts this AdvancedMachineFeatures to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @instance + * @returns {Object.} JSON object + */ + AdvancedMachineFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AdvancedMachineFeatures + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AdvancedMachineFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.AdvancedMachineFeatures"; + }; + + return AdvancedMachineFeatures; + })(); + + v1beta4.SslCert = (function() { + + /** + * Properties of a SslCert. + * @memberof google.cloud.sql.v1beta4 + * @interface ISslCert + * @property {string|null} [kind] SslCert kind + * @property {string|null} [certSerialNumber] SslCert certSerialNumber + * @property {string|null} [cert] SslCert cert + * @property {google.protobuf.ITimestamp|null} [createTime] SslCert createTime + * @property {string|null} [commonName] SslCert commonName + * @property {google.protobuf.ITimestamp|null} [expirationTime] SslCert expirationTime + * @property {string|null} [sha1Fingerprint] SslCert sha1Fingerprint + * @property {string|null} [instance] SslCert instance + * @property {string|null} [selfLink] SslCert selfLink + */ + + /** + * Constructs a new SslCert. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SslCert. + * @implements ISslCert + * @constructor + * @param {google.cloud.sql.v1beta4.ISslCert=} [properties] Properties to set + */ + function SslCert(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCert kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.SslCert + * @instance + */ + SslCert.prototype.kind = ""; + + /** + * SslCert certSerialNumber. + * @member {string} certSerialNumber + * @memberof google.cloud.sql.v1beta4.SslCert + * @instance + */ + SslCert.prototype.certSerialNumber = ""; + + /** + * SslCert cert. + * @member {string} cert + * @memberof google.cloud.sql.v1beta4.SslCert + * @instance + */ + SslCert.prototype.cert = ""; + + /** + * SslCert createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.cloud.sql.v1beta4.SslCert + * @instance + */ + SslCert.prototype.createTime = null; + + /** + * SslCert commonName. + * @member {string} commonName + * @memberof google.cloud.sql.v1beta4.SslCert + * @instance + */ + SslCert.prototype.commonName = ""; + + /** + * SslCert expirationTime. + * @member {google.protobuf.ITimestamp|null|undefined} expirationTime + * @memberof google.cloud.sql.v1beta4.SslCert + * @instance + */ + SslCert.prototype.expirationTime = null; + + /** + * SslCert sha1Fingerprint. + * @member {string} sha1Fingerprint + * @memberof google.cloud.sql.v1beta4.SslCert + * @instance + */ + SslCert.prototype.sha1Fingerprint = ""; + + /** + * SslCert instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SslCert + * @instance + */ + SslCert.prototype.instance = ""; + + /** + * SslCert selfLink. + * @member {string} selfLink + * @memberof google.cloud.sql.v1beta4.SslCert + * @instance + */ + SslCert.prototype.selfLink = ""; + + /** + * Creates a new SslCert instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SslCert + * @static + * @param {google.cloud.sql.v1beta4.ISslCert=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SslCert} SslCert instance + */ + SslCert.create = function create(properties) { + return new SslCert(properties); + }; + + /** + * Encodes the specified SslCert message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCert.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SslCert + * @static + * @param {google.cloud.sql.v1beta4.ISslCert} message SslCert message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCert.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.certSerialNumber != null && Object.hasOwnProperty.call(message, "certSerialNumber")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.certSerialNumber); + if (message.cert != null && Object.hasOwnProperty.call(message, "cert")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.cert); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.commonName != null && Object.hasOwnProperty.call(message, "commonName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.commonName); + if (message.expirationTime != null && Object.hasOwnProperty.call(message, "expirationTime")) + $root.google.protobuf.Timestamp.encode(message.expirationTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.sha1Fingerprint); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.instance); + if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.selfLink); + return writer; + }; + + /** + * Encodes the specified SslCert message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCert.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCert + * @static + * @param {google.cloud.sql.v1beta4.ISslCert} message SslCert message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCert.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCert message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SslCert + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SslCert} SslCert + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCert.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCert(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.certSerialNumber = reader.string(); + break; + } + case 3: { + message.cert = reader.string(); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.commonName = reader.string(); + break; + } + case 6: { + message.expirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.sha1Fingerprint = reader.string(); + break; + } + case 8: { + message.instance = reader.string(); + break; + } + case 9: { + message.selfLink = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCert message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCert + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SslCert} SslCert + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCert.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCert message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SslCert + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCert.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.certSerialNumber != null && message.hasOwnProperty("certSerialNumber")) + if (!$util.isString(message.certSerialNumber)) + return "certSerialNumber: string expected"; + if (message.cert != null && message.hasOwnProperty("cert")) + if (!$util.isString(message.cert)) + return "cert: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.commonName != null && message.hasOwnProperty("commonName")) + if (!$util.isString(message.commonName)) + return "commonName: string expected"; + if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.expirationTime); + if (error) + return "expirationTime." + error; + } + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + if (!$util.isString(message.sha1Fingerprint)) + return "sha1Fingerprint: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + if (!$util.isString(message.selfLink)) + return "selfLink: string expected"; + return null; + }; + + /** + * Creates a SslCert message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SslCert + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SslCert} SslCert + */ + SslCert.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SslCert) + return object; + var message = new $root.google.cloud.sql.v1beta4.SslCert(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.certSerialNumber != null) + message.certSerialNumber = String(object.certSerialNumber); + if (object.cert != null) + message.cert = String(object.cert); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SslCert.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.commonName != null) + message.commonName = String(object.commonName); + if (object.expirationTime != null) { + if (typeof object.expirationTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SslCert.expirationTime: object expected"); + message.expirationTime = $root.google.protobuf.Timestamp.fromObject(object.expirationTime); + } + if (object.sha1Fingerprint != null) + message.sha1Fingerprint = String(object.sha1Fingerprint); + if (object.instance != null) + message.instance = String(object.instance); + if (object.selfLink != null) + message.selfLink = String(object.selfLink); + return message; + }; + + /** + * Creates a plain object from a SslCert message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SslCert + * @static + * @param {google.cloud.sql.v1beta4.SslCert} message SslCert + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCert.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.certSerialNumber = ""; + object.cert = ""; + object.createTime = null; + object.commonName = ""; + object.expirationTime = null; + object.sha1Fingerprint = ""; + object.instance = ""; + object.selfLink = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.certSerialNumber != null && message.hasOwnProperty("certSerialNumber")) + object.certSerialNumber = message.certSerialNumber; + if (message.cert != null && message.hasOwnProperty("cert")) + object.cert = message.cert; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.commonName != null && message.hasOwnProperty("commonName")) + object.commonName = message.commonName; + if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) + object.expirationTime = $root.google.protobuf.Timestamp.toObject(message.expirationTime, options); + if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) + object.sha1Fingerprint = message.sha1Fingerprint; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.selfLink != null && message.hasOwnProperty("selfLink")) + object.selfLink = message.selfLink; + return object; + }; + + /** + * Converts this SslCert to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SslCert + * @instance + * @returns {Object.} JSON object + */ + SslCert.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCert + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SslCert + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCert.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCert"; + }; + + return SslCert; + })(); + + v1beta4.SslCertDetail = (function() { + + /** + * Properties of a SslCertDetail. + * @memberof google.cloud.sql.v1beta4 + * @interface ISslCertDetail + * @property {google.cloud.sql.v1beta4.ISslCert|null} [certInfo] SslCertDetail certInfo + * @property {string|null} [certPrivateKey] SslCertDetail certPrivateKey + */ + + /** + * Constructs a new SslCertDetail. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SslCertDetail. + * @implements ISslCertDetail + * @constructor + * @param {google.cloud.sql.v1beta4.ISslCertDetail=} [properties] Properties to set + */ + function SslCertDetail(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCertDetail certInfo. + * @member {google.cloud.sql.v1beta4.ISslCert|null|undefined} certInfo + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @instance + */ + SslCertDetail.prototype.certInfo = null; + + /** + * SslCertDetail certPrivateKey. + * @member {string} certPrivateKey + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @instance + */ + SslCertDetail.prototype.certPrivateKey = ""; + + /** + * Creates a new SslCertDetail instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @static + * @param {google.cloud.sql.v1beta4.ISslCertDetail=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SslCertDetail} SslCertDetail instance + */ + SslCertDetail.create = function create(properties) { + return new SslCertDetail(properties); + }; + + /** + * Encodes the specified SslCertDetail message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertDetail.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @static + * @param {google.cloud.sql.v1beta4.ISslCertDetail} message SslCertDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertDetail.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.certInfo != null && Object.hasOwnProperty.call(message, "certInfo")) + $root.google.cloud.sql.v1beta4.SslCert.encode(message.certInfo, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.certPrivateKey != null && Object.hasOwnProperty.call(message, "certPrivateKey")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.certPrivateKey); + return writer; + }; + + /** + * Encodes the specified SslCertDetail message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertDetail.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @static + * @param {google.cloud.sql.v1beta4.ISslCertDetail} message SslCertDetail message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertDetail.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCertDetail message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SslCertDetail} SslCertDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertDetail.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCertDetail(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.certInfo = $root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32()); + break; + } + case 2: { + message.certPrivateKey = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCertDetail message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SslCertDetail} SslCertDetail + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertDetail.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCertDetail message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCertDetail.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.certInfo != null && message.hasOwnProperty("certInfo")) { + var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.certInfo); + if (error) + return "certInfo." + error; + } + if (message.certPrivateKey != null && message.hasOwnProperty("certPrivateKey")) + if (!$util.isString(message.certPrivateKey)) + return "certPrivateKey: string expected"; + return null; + }; + + /** + * Creates a SslCertDetail message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SslCertDetail} SslCertDetail + */ + SslCertDetail.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SslCertDetail) + return object; + var message = new $root.google.cloud.sql.v1beta4.SslCertDetail(); + if (object.certInfo != null) { + if (typeof object.certInfo !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SslCertDetail.certInfo: object expected"); + message.certInfo = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.certInfo); + } + if (object.certPrivateKey != null) + message.certPrivateKey = String(object.certPrivateKey); + return message; + }; + + /** + * Creates a plain object from a SslCertDetail message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @static + * @param {google.cloud.sql.v1beta4.SslCertDetail} message SslCertDetail + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCertDetail.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.certInfo = null; + object.certPrivateKey = ""; + } + if (message.certInfo != null && message.hasOwnProperty("certInfo")) + object.certInfo = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.certInfo, options); + if (message.certPrivateKey != null && message.hasOwnProperty("certPrivateKey")) + object.certPrivateKey = message.certPrivateKey; + return object; + }; + + /** + * Converts this SslCertDetail to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @instance + * @returns {Object.} JSON object + */ + SslCertDetail.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCertDetail + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SslCertDetail + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCertDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCertDetail"; + }; + + return SslCertDetail; + })(); + + v1beta4.SslCertsCreateEphemeralRequest = (function() { + + /** + * Properties of a SslCertsCreateEphemeralRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISslCertsCreateEphemeralRequest + * @property {string|null} [publicKey] SslCertsCreateEphemeralRequest publicKey + * @property {string|null} [accessToken] SslCertsCreateEphemeralRequest accessToken + */ + + /** + * Constructs a new SslCertsCreateEphemeralRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SslCertsCreateEphemeralRequest. + * @implements ISslCertsCreateEphemeralRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest=} [properties] Properties to set + */ + function SslCertsCreateEphemeralRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCertsCreateEphemeralRequest publicKey. + * @member {string} publicKey + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @instance + */ + SslCertsCreateEphemeralRequest.prototype.publicKey = ""; + + /** + * SslCertsCreateEphemeralRequest accessToken. + * @member {string} accessToken + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @instance + */ + SslCertsCreateEphemeralRequest.prototype.accessToken = ""; + + /** + * Creates a new SslCertsCreateEphemeralRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest instance + */ + SslCertsCreateEphemeralRequest.create = function create(properties) { + return new SslCertsCreateEphemeralRequest(properties); + }; + + /** + * Encodes the specified SslCertsCreateEphemeralRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsCreateEphemeralRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.publicKey); + if (message.accessToken != null && Object.hasOwnProperty.call(message, "accessToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.accessToken); + return writer; + }; + + /** + * Encodes the specified SslCertsCreateEphemeralRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsCreateEphemeralRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsCreateEphemeralRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.publicKey = reader.string(); + break; + } + case 2: { + message.accessToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsCreateEphemeralRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCertsCreateEphemeralRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCertsCreateEphemeralRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + if (!$util.isString(message.publicKey)) + return "publicKey: string expected"; + if (message.accessToken != null && message.hasOwnProperty("accessToken")) + if (!$util.isString(message.accessToken)) + return "accessToken: string expected"; + return null; + }; + + /** + * Creates a SslCertsCreateEphemeralRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest + */ + SslCertsCreateEphemeralRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest(); + if (object.publicKey != null) + message.publicKey = String(object.publicKey); + if (object.accessToken != null) + message.accessToken = String(object.accessToken); + return message; + }; + + /** + * Creates a plain object from a SslCertsCreateEphemeralRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @static + * @param {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCertsCreateEphemeralRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.publicKey = ""; + object.accessToken = ""; + } + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + object.publicKey = message.publicKey; + if (message.accessToken != null && message.hasOwnProperty("accessToken")) + object.accessToken = message.accessToken; + return object; + }; + + /** + * Converts this SslCertsCreateEphemeralRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @instance + * @returns {Object.} JSON object + */ + SslCertsCreateEphemeralRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCertsCreateEphemeralRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCertsCreateEphemeralRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest"; + }; + + return SslCertsCreateEphemeralRequest; + })(); + + v1beta4.SslCertsInsertRequest = (function() { + + /** + * Properties of a SslCertsInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISslCertsInsertRequest + * @property {string|null} [commonName] SslCertsInsertRequest commonName + */ + + /** + * Constructs a new SslCertsInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SslCertsInsertRequest. + * @implements ISslCertsInsertRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISslCertsInsertRequest=} [properties] Properties to set + */ + function SslCertsInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCertsInsertRequest commonName. + * @member {string} commonName + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @instance + */ + SslCertsInsertRequest.prototype.commonName = ""; + + /** + * Creates a new SslCertsInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SslCertsInsertRequest} SslCertsInsertRequest instance + */ + SslCertsInsertRequest.create = function create(properties) { + return new SslCertsInsertRequest(properties); + }; + + /** + * Encodes the specified SslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsInsertRequest} message SslCertsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.commonName != null && Object.hasOwnProperty.call(message, "commonName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.commonName); + return writer; + }; + + /** + * Encodes the specified SslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsInsertRequest} message SslCertsInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCertsInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SslCertsInsertRequest} SslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCertsInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.commonName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCertsInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SslCertsInsertRequest} SslCertsInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCertsInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCertsInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.commonName != null && message.hasOwnProperty("commonName")) + if (!$util.isString(message.commonName)) + return "commonName: string expected"; + return null; + }; + + /** + * Creates a SslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SslCertsInsertRequest} SslCertsInsertRequest + */ + SslCertsInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SslCertsInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SslCertsInsertRequest(); + if (object.commonName != null) + message.commonName = String(object.commonName); + return message; + }; + + /** + * Creates a plain object from a SslCertsInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.SslCertsInsertRequest} message SslCertsInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCertsInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.commonName = ""; + if (message.commonName != null && message.hasOwnProperty("commonName")) + object.commonName = message.commonName; + return object; + }; + + /** + * Converts this SslCertsInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SslCertsInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCertsInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCertsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCertsInsertRequest"; + }; + + return SslCertsInsertRequest; + })(); + + v1beta4.SqlInstancesRescheduleMaintenanceRequestBody = (function() { + + /** + * Properties of a SqlInstancesRescheduleMaintenanceRequestBody. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlInstancesRescheduleMaintenanceRequestBody + * @property {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null} [reschedule] SqlInstancesRescheduleMaintenanceRequestBody reschedule + */ + + /** + * Constructs a new SqlInstancesRescheduleMaintenanceRequestBody. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlInstancesRescheduleMaintenanceRequestBody. + * @implements ISqlInstancesRescheduleMaintenanceRequestBody + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody=} [properties] Properties to set + */ + function SqlInstancesRescheduleMaintenanceRequestBody(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlInstancesRescheduleMaintenanceRequestBody reschedule. + * @member {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null|undefined} reschedule + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @instance + */ + SqlInstancesRescheduleMaintenanceRequestBody.prototype.reschedule = null; + + /** + * Creates a new SqlInstancesRescheduleMaintenanceRequestBody instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody instance + */ + SqlInstancesRescheduleMaintenanceRequestBody.create = function create(properties) { + return new SqlInstancesRescheduleMaintenanceRequestBody(properties); + }; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRescheduleMaintenanceRequestBody.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.reschedule != null && Object.hasOwnProperty.call(message, "reschedule")) + $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.encode(message.reschedule, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlInstancesRescheduleMaintenanceRequestBody.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRescheduleMaintenanceRequestBody.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.reschedule = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlInstancesRescheduleMaintenanceRequestBody.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlInstancesRescheduleMaintenanceRequestBody message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlInstancesRescheduleMaintenanceRequestBody.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.reschedule != null && message.hasOwnProperty("reschedule")) { + var error = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify(message.reschedule); + if (error) + return "reschedule." + error; + } + return null; + }; + + /** + * Creates a SqlInstancesRescheduleMaintenanceRequestBody message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody + */ + SqlInstancesRescheduleMaintenanceRequestBody.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody(); + if (object.reschedule != null) { + if (typeof object.reschedule !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.reschedule: object expected"); + message.reschedule = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.fromObject(object.reschedule); + } + return message; + }; + + /** + * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequestBody message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlInstancesRescheduleMaintenanceRequestBody.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.reschedule = null; + if (message.reschedule != null && message.hasOwnProperty("reschedule")) + object.reschedule = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.toObject(message.reschedule, options); + return object; + }; + + /** + * Converts this SqlInstancesRescheduleMaintenanceRequestBody to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @instance + * @returns {Object.} JSON object + */ + SqlInstancesRescheduleMaintenanceRequestBody.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlInstancesRescheduleMaintenanceRequestBody + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlInstancesRescheduleMaintenanceRequestBody.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody"; + }; + + /** + * RescheduleType enum. + * @name google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType + * @enum {number} + * @property {number} RESCHEDULE_TYPE_UNSPECIFIED=0 RESCHEDULE_TYPE_UNSPECIFIED value + * @property {number} IMMEDIATE=1 IMMEDIATE value + * @property {number} NEXT_AVAILABLE_WINDOW=2 NEXT_AVAILABLE_WINDOW value + * @property {number} SPECIFIC_TIME=3 SPECIFIC_TIME value + */ + SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RESCHEDULE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "IMMEDIATE"] = 1; + values[valuesById[2] = "NEXT_AVAILABLE_WINDOW"] = 2; + values[valuesById[3] = "SPECIFIC_TIME"] = 3; + return values; + })(); + + SqlInstancesRescheduleMaintenanceRequestBody.Reschedule = (function() { + + /** + * Properties of a Reschedule. + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @interface IReschedule + * @property {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|null} [rescheduleType] Reschedule rescheduleType + * @property {google.protobuf.ITimestamp|null} [scheduleTime] Reschedule scheduleTime + */ + + /** + * Constructs a new Reschedule. + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody + * @classdesc Represents a Reschedule. + * @implements IReschedule + * @constructor + * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule=} [properties] Properties to set + */ + function Reschedule(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Reschedule rescheduleType. + * @member {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType} rescheduleType + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @instance + */ + Reschedule.prototype.rescheduleType = 0; + + /** + * Reschedule scheduleTime. + * @member {google.protobuf.ITimestamp|null|undefined} scheduleTime + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @instance + */ + Reschedule.prototype.scheduleTime = null; + + /** + * Creates a new Reschedule instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule instance + */ + Reschedule.create = function create(properties) { + return new Reschedule(properties); + }; + + /** + * Encodes the specified Reschedule message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule} message Reschedule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Reschedule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rescheduleType != null && Object.hasOwnProperty.call(message, "rescheduleType")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.rescheduleType); + if (message.scheduleTime != null && Object.hasOwnProperty.call(message, "scheduleTime")) + $root.google.protobuf.Timestamp.encode(message.scheduleTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Reschedule message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule} message Reschedule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Reschedule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Reschedule message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Reschedule.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.rescheduleType = reader.int32(); + break; + } + case 2: { + message.scheduleTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Reschedule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Reschedule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Reschedule message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Reschedule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rescheduleType != null && message.hasOwnProperty("rescheduleType")) + switch (message.rescheduleType) { + default: + return "rescheduleType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.scheduleTime != null && message.hasOwnProperty("scheduleTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.scheduleTime); + if (error) + return "scheduleTime." + error; + } + return null; + }; + + /** + * Creates a Reschedule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule + */ + Reschedule.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule(); + switch (object.rescheduleType) { + default: + if (typeof object.rescheduleType === "number") { + message.rescheduleType = object.rescheduleType; + break; + } + break; + case "RESCHEDULE_TYPE_UNSPECIFIED": + case 0: + message.rescheduleType = 0; + break; + case "IMMEDIATE": + case 1: + message.rescheduleType = 1; + break; + case "NEXT_AVAILABLE_WINDOW": + case 2: + message.rescheduleType = 2; + break; + case "SPECIFIC_TIME": + case 3: + message.rescheduleType = 3; + break; + } + if (object.scheduleTime != null) { + if (typeof object.scheduleTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.scheduleTime: object expected"); + message.scheduleTime = $root.google.protobuf.Timestamp.fromObject(object.scheduleTime); + } + return message; + }; + + /** + * Creates a plain object from a Reschedule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} message Reschedule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Reschedule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.rescheduleType = options.enums === String ? "RESCHEDULE_TYPE_UNSPECIFIED" : 0; + object.scheduleTime = null; + } + if (message.rescheduleType != null && message.hasOwnProperty("rescheduleType")) + object.rescheduleType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType[message.rescheduleType] === undefined ? message.rescheduleType : $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType[message.rescheduleType] : message.rescheduleType; + if (message.scheduleTime != null && message.hasOwnProperty("scheduleTime")) + object.scheduleTime = $root.google.protobuf.Timestamp.toObject(message.scheduleTime, options); + return object; + }; + + /** + * Converts this Reschedule to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @instance + * @returns {Object.} JSON object + */ + Reschedule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Reschedule + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Reschedule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule"; + }; + + return Reschedule; + })(); + + return SqlInstancesRescheduleMaintenanceRequestBody; + })(); + + v1beta4.SslCertsInsertResponse = (function() { + + /** + * Properties of a SslCertsInsertResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface ISslCertsInsertResponse + * @property {string|null} [kind] SslCertsInsertResponse kind + * @property {google.cloud.sql.v1beta4.IOperation|null} [operation] SslCertsInsertResponse operation + * @property {google.cloud.sql.v1beta4.ISslCert|null} [serverCaCert] SslCertsInsertResponse serverCaCert + * @property {google.cloud.sql.v1beta4.ISslCertDetail|null} [clientCert] SslCertsInsertResponse clientCert + */ + + /** + * Constructs a new SslCertsInsertResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SslCertsInsertResponse. + * @implements ISslCertsInsertResponse + * @constructor + * @param {google.cloud.sql.v1beta4.ISslCertsInsertResponse=} [properties] Properties to set + */ + function SslCertsInsertResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCertsInsertResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @instance + */ + SslCertsInsertResponse.prototype.kind = ""; + + /** + * SslCertsInsertResponse operation. + * @member {google.cloud.sql.v1beta4.IOperation|null|undefined} operation + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @instance + */ + SslCertsInsertResponse.prototype.operation = null; + + /** + * SslCertsInsertResponse serverCaCert. + * @member {google.cloud.sql.v1beta4.ISslCert|null|undefined} serverCaCert + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @instance + */ + SslCertsInsertResponse.prototype.serverCaCert = null; + + /** + * SslCertsInsertResponse clientCert. + * @member {google.cloud.sql.v1beta4.ISslCertDetail|null|undefined} clientCert + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @instance + */ + SslCertsInsertResponse.prototype.clientCert = null; + + /** + * Creates a new SslCertsInsertResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsInsertResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SslCertsInsertResponse} SslCertsInsertResponse instance + */ + SslCertsInsertResponse.create = function create(properties) { + return new SslCertsInsertResponse(properties); + }; + + /** + * Encodes the specified SslCertsInsertResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsInsertResponse} message SslCertsInsertResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsInsertResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + $root.google.cloud.sql.v1beta4.Operation.encode(message.operation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) + $root.google.cloud.sql.v1beta4.SslCert.encode(message.serverCaCert, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.clientCert != null && Object.hasOwnProperty.call(message, "clientCert")) + $root.google.cloud.sql.v1beta4.SslCertDetail.encode(message.clientCert, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SslCertsInsertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsInsertResponse} message SslCertsInsertResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsInsertResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCertsInsertResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SslCertsInsertResponse} SslCertsInsertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsInsertResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCertsInsertResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.operation = $root.google.cloud.sql.v1beta4.Operation.decode(reader, reader.uint32()); + break; + } + case 3: { + message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32()); + break; + } + case 4: { + message.clientCert = $root.google.cloud.sql.v1beta4.SslCertDetail.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCertsInsertResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SslCertsInsertResponse} SslCertsInsertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsInsertResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCertsInsertResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCertsInsertResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.operation != null && message.hasOwnProperty("operation")) { + var error = $root.google.cloud.sql.v1beta4.Operation.verify(message.operation); + if (error) + return "operation." + error; + } + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { + var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.serverCaCert); + if (error) + return "serverCaCert." + error; + } + if (message.clientCert != null && message.hasOwnProperty("clientCert")) { + var error = $root.google.cloud.sql.v1beta4.SslCertDetail.verify(message.clientCert); + if (error) + return "clientCert." + error; + } + return null; + }; + + /** + * Creates a SslCertsInsertResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SslCertsInsertResponse} SslCertsInsertResponse + */ + SslCertsInsertResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SslCertsInsertResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.SslCertsInsertResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.operation != null) { + if (typeof object.operation !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SslCertsInsertResponse.operation: object expected"); + message.operation = $root.google.cloud.sql.v1beta4.Operation.fromObject(object.operation); + } + if (object.serverCaCert != null) { + if (typeof object.serverCaCert !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SslCertsInsertResponse.serverCaCert: object expected"); + message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.serverCaCert); + } + if (object.clientCert != null) { + if (typeof object.clientCert !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SslCertsInsertResponse.clientCert: object expected"); + message.clientCert = $root.google.cloud.sql.v1beta4.SslCertDetail.fromObject(object.clientCert); + } + return message; + }; + + /** + * Creates a plain object from a SslCertsInsertResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @static + * @param {google.cloud.sql.v1beta4.SslCertsInsertResponse} message SslCertsInsertResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCertsInsertResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.operation = null; + object.serverCaCert = null; + object.clientCert = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.operation != null && message.hasOwnProperty("operation")) + object.operation = $root.google.cloud.sql.v1beta4.Operation.toObject(message.operation, options); + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) + object.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.serverCaCert, options); + if (message.clientCert != null && message.hasOwnProperty("clientCert")) + object.clientCert = $root.google.cloud.sql.v1beta4.SslCertDetail.toObject(message.clientCert, options); + return object; + }; + + /** + * Converts this SslCertsInsertResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @instance + * @returns {Object.} JSON object + */ + SslCertsInsertResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCertsInsertResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCertsInsertResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCertsInsertResponse"; + }; + + return SslCertsInsertResponse; + })(); + + v1beta4.SslCertsListResponse = (function() { + + /** + * Properties of a SslCertsListResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface ISslCertsListResponse + * @property {string|null} [kind] SslCertsListResponse kind + * @property {Array.|null} [items] SslCertsListResponse items + */ + + /** + * Constructs a new SslCertsListResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SslCertsListResponse. + * @implements ISslCertsListResponse + * @constructor + * @param {google.cloud.sql.v1beta4.ISslCertsListResponse=} [properties] Properties to set + */ + function SslCertsListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SslCertsListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @instance + */ + SslCertsListResponse.prototype.kind = ""; + + /** + * SslCertsListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @instance + */ + SslCertsListResponse.prototype.items = $util.emptyArray; + + /** + * Creates a new SslCertsListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SslCertsListResponse} SslCertsListResponse instance + */ + SslCertsListResponse.create = function create(properties) { + return new SslCertsListResponse(properties); + }; + + /** + * Encodes the specified SslCertsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsListResponse} message SslCertsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1beta4.SslCert.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SslCertsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @static + * @param {google.cloud.sql.v1beta4.ISslCertsListResponse} message SslCertsListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SslCertsListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SslCertsListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SslCertsListResponse} SslCertsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCertsListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SslCertsListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SslCertsListResponse} SslCertsListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SslCertsListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SslCertsListResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SslCertsListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a SslCertsListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SslCertsListResponse} SslCertsListResponse + */ + SslCertsListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SslCertsListResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.SslCertsListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1beta4.SslCertsListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SslCertsListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SslCertsListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @static + * @param {google.cloud.sql.v1beta4.SslCertsListResponse} message SslCertsListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SslCertsListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this SslCertsListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @instance + * @returns {Object.} JSON object + */ + SslCertsListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SslCertsListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SslCertsListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SslCertsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCertsListResponse"; + }; + + return SslCertsListResponse; + })(); + + v1beta4.TruncateLogContext = (function() { + + /** + * Properties of a TruncateLogContext. + * @memberof google.cloud.sql.v1beta4 + * @interface ITruncateLogContext + * @property {string|null} [kind] TruncateLogContext kind + * @property {string|null} [logType] TruncateLogContext logType + */ + + /** + * Constructs a new TruncateLogContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a TruncateLogContext. + * @implements ITruncateLogContext + * @constructor + * @param {google.cloud.sql.v1beta4.ITruncateLogContext=} [properties] Properties to set + */ + function TruncateLogContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TruncateLogContext kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @instance + */ + TruncateLogContext.prototype.kind = ""; + + /** + * TruncateLogContext logType. + * @member {string} logType + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @instance + */ + TruncateLogContext.prototype.logType = ""; + + /** + * Creates a new TruncateLogContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @static + * @param {google.cloud.sql.v1beta4.ITruncateLogContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.TruncateLogContext} TruncateLogContext instance + */ + TruncateLogContext.create = function create(properties) { + return new TruncateLogContext(properties); + }; + + /** + * Encodes the specified TruncateLogContext message. Does not implicitly {@link google.cloud.sql.v1beta4.TruncateLogContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @static + * @param {google.cloud.sql.v1beta4.ITruncateLogContext} message TruncateLogContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TruncateLogContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.logType != null && Object.hasOwnProperty.call(message, "logType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.logType); + return writer; + }; + + /** + * Encodes the specified TruncateLogContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.TruncateLogContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @static + * @param {google.cloud.sql.v1beta4.ITruncateLogContext} message TruncateLogContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TruncateLogContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TruncateLogContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.TruncateLogContext} TruncateLogContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TruncateLogContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.TruncateLogContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.logType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TruncateLogContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.TruncateLogContext} TruncateLogContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TruncateLogContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TruncateLogContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TruncateLogContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.logType != null && message.hasOwnProperty("logType")) + if (!$util.isString(message.logType)) + return "logType: string expected"; + return null; + }; + + /** + * Creates a TruncateLogContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.TruncateLogContext} TruncateLogContext + */ + TruncateLogContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.TruncateLogContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.TruncateLogContext(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.logType != null) + message.logType = String(object.logType); + return message; + }; + + /** + * Creates a plain object from a TruncateLogContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @static + * @param {google.cloud.sql.v1beta4.TruncateLogContext} message TruncateLogContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TruncateLogContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.logType = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.logType != null && message.hasOwnProperty("logType")) + object.logType = message.logType; + return object; + }; + + /** + * Converts this TruncateLogContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @instance + * @returns {Object.} JSON object + */ + TruncateLogContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TruncateLogContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.TruncateLogContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TruncateLogContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.TruncateLogContext"; + }; + + return TruncateLogContext; + })(); + + v1beta4.SqlActiveDirectoryConfig = (function() { + + /** + * Properties of a SqlActiveDirectoryConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlActiveDirectoryConfig + * @property {string|null} [kind] SqlActiveDirectoryConfig kind + * @property {string|null} [domain] SqlActiveDirectoryConfig domain + * @property {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode|null} [mode] SqlActiveDirectoryConfig mode + * @property {Array.|null} [dnsServers] SqlActiveDirectoryConfig dnsServers + * @property {string|null} [adminCredentialSecretName] SqlActiveDirectoryConfig adminCredentialSecretName + * @property {string|null} [organizationalUnit] SqlActiveDirectoryConfig organizationalUnit + */ + + /** + * Constructs a new SqlActiveDirectoryConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlActiveDirectoryConfig. + * @implements ISqlActiveDirectoryConfig + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig=} [properties] Properties to set + */ + function SqlActiveDirectoryConfig(properties) { + this.dnsServers = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlActiveDirectoryConfig kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.kind = ""; + + /** + * SqlActiveDirectoryConfig domain. + * @member {string} domain + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.domain = ""; + + /** + * SqlActiveDirectoryConfig mode. + * @member {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode} mode + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.mode = 0; + + /** + * SqlActiveDirectoryConfig dnsServers. + * @member {Array.} dnsServers + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.dnsServers = $util.emptyArray; + + /** + * SqlActiveDirectoryConfig adminCredentialSecretName. + * @member {string} adminCredentialSecretName + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.adminCredentialSecretName = ""; + + /** + * SqlActiveDirectoryConfig organizationalUnit. + * @member {string} organizationalUnit + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @instance + */ + SqlActiveDirectoryConfig.prototype.organizationalUnit = ""; + + /** + * Creates a new SqlActiveDirectoryConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @static + * @param {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig instance + */ + SqlActiveDirectoryConfig.create = function create(properties) { + return new SqlActiveDirectoryConfig(properties); + }; + + /** + * Encodes the specified SqlActiveDirectoryConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @static + * @param {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig} message SqlActiveDirectoryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlActiveDirectoryConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.domain != null && Object.hasOwnProperty.call(message, "domain")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.domain); + if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mode); + if (message.dnsServers != null && message.dnsServers.length) + for (var i = 0; i < message.dnsServers.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.dnsServers[i]); + if (message.adminCredentialSecretName != null && Object.hasOwnProperty.call(message, "adminCredentialSecretName")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.adminCredentialSecretName); + if (message.organizationalUnit != null && Object.hasOwnProperty.call(message, "organizationalUnit")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.organizationalUnit); + return writer; + }; + + /** + * Encodes the specified SqlActiveDirectoryConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @static + * @param {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig} message SqlActiveDirectoryConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlActiveDirectoryConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlActiveDirectoryConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.domain = reader.string(); + break; + } + case 3: { + message.mode = reader.int32(); + break; + } + case 4: { + if (!(message.dnsServers && message.dnsServers.length)) + message.dnsServers = []; + message.dnsServers.push(reader.string()); + break; + } + case 5: { + message.adminCredentialSecretName = reader.string(); + break; + } + case 6: { + message.organizationalUnit = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlActiveDirectoryConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlActiveDirectoryConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlActiveDirectoryConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.domain != null && message.hasOwnProperty("domain")) + if (!$util.isString(message.domain)) + return "domain: string expected"; + if (message.mode != null && message.hasOwnProperty("mode")) + switch (message.mode) { + default: + return "mode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.dnsServers != null && message.hasOwnProperty("dnsServers")) { + if (!Array.isArray(message.dnsServers)) + return "dnsServers: array expected"; + for (var i = 0; i < message.dnsServers.length; ++i) + if (!$util.isString(message.dnsServers[i])) + return "dnsServers: string[] expected"; + } + if (message.adminCredentialSecretName != null && message.hasOwnProperty("adminCredentialSecretName")) + if (!$util.isString(message.adminCredentialSecretName)) + return "adminCredentialSecretName: string expected"; + if (message.organizationalUnit != null && message.hasOwnProperty("organizationalUnit")) + if (!$util.isString(message.organizationalUnit)) + return "organizationalUnit: string expected"; + return null; + }; + + /** + * Creates a SqlActiveDirectoryConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig + */ + SqlActiveDirectoryConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.domain != null) + message.domain = String(object.domain); + switch (object.mode) { + default: + if (typeof object.mode === "number") { + message.mode = object.mode; + break; + } + break; + case "ACTIVE_DIRECTORY_MODE_UNSPECIFIED": + case 0: + message.mode = 0; + break; + case "MANAGED_ACTIVE_DIRECTORY": + case 1: + message.mode = 1; + break; + case "SELF_MANAGED_ACTIVE_DIRECTORY": + case 2: + message.mode = 2; + break; + case "CUSTOMER_MANAGED_ACTIVE_DIRECTORY": + case 3: + message.mode = 3; + break; + } + if (object.dnsServers) { + if (!Array.isArray(object.dnsServers)) + throw TypeError(".google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.dnsServers: array expected"); + message.dnsServers = []; + for (var i = 0; i < object.dnsServers.length; ++i) + message.dnsServers[i] = String(object.dnsServers[i]); + } + if (object.adminCredentialSecretName != null) + message.adminCredentialSecretName = String(object.adminCredentialSecretName); + if (object.organizationalUnit != null) + message.organizationalUnit = String(object.organizationalUnit); + return message; + }; + + /** + * Creates a plain object from a SqlActiveDirectoryConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @static + * @param {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig} message SqlActiveDirectoryConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlActiveDirectoryConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.dnsServers = []; + if (options.defaults) { + object.kind = ""; + object.domain = ""; + object.mode = options.enums === String ? "ACTIVE_DIRECTORY_MODE_UNSPECIFIED" : 0; + object.adminCredentialSecretName = ""; + object.organizationalUnit = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.domain != null && message.hasOwnProperty("domain")) + object.domain = message.domain; + if (message.mode != null && message.hasOwnProperty("mode")) + object.mode = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode[message.mode] === undefined ? message.mode : $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode[message.mode] : message.mode; + if (message.dnsServers && message.dnsServers.length) { + object.dnsServers = []; + for (var j = 0; j < message.dnsServers.length; ++j) + object.dnsServers[j] = message.dnsServers[j]; + } + if (message.adminCredentialSecretName != null && message.hasOwnProperty("adminCredentialSecretName")) + object.adminCredentialSecretName = message.adminCredentialSecretName; + if (message.organizationalUnit != null && message.hasOwnProperty("organizationalUnit")) + object.organizationalUnit = message.organizationalUnit; + return object; + }; + + /** + * Converts this SqlActiveDirectoryConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @instance + * @returns {Object.} JSON object + */ + SqlActiveDirectoryConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlActiveDirectoryConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlActiveDirectoryConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlActiveDirectoryConfig"; + }; + + /** + * ActiveDirectoryMode enum. + * @name google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode + * @enum {number} + * @property {number} ACTIVE_DIRECTORY_MODE_UNSPECIFIED=0 ACTIVE_DIRECTORY_MODE_UNSPECIFIED value + * @property {number} MANAGED_ACTIVE_DIRECTORY=1 MANAGED_ACTIVE_DIRECTORY value + * @property {number} SELF_MANAGED_ACTIVE_DIRECTORY=2 SELF_MANAGED_ACTIVE_DIRECTORY value + * @property {number} CUSTOMER_MANAGED_ACTIVE_DIRECTORY=3 CUSTOMER_MANAGED_ACTIVE_DIRECTORY value + */ + SqlActiveDirectoryConfig.ActiveDirectoryMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ACTIVE_DIRECTORY_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "MANAGED_ACTIVE_DIRECTORY"] = 1; + values[valuesById[2] = "SELF_MANAGED_ACTIVE_DIRECTORY"] = 2; + values[valuesById[3] = "CUSTOMER_MANAGED_ACTIVE_DIRECTORY"] = 3; + return values; + })(); + + return SqlActiveDirectoryConfig; + })(); + + v1beta4.SqlServerAuditConfig = (function() { + + /** + * Properties of a SqlServerAuditConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlServerAuditConfig + * @property {string|null} [kind] SqlServerAuditConfig kind + * @property {string|null} [bucket] SqlServerAuditConfig bucket + * @property {google.protobuf.IDuration|null} [retentionInterval] SqlServerAuditConfig retentionInterval + * @property {google.protobuf.IDuration|null} [uploadInterval] SqlServerAuditConfig uploadInterval + */ + + /** + * Constructs a new SqlServerAuditConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlServerAuditConfig. + * @implements ISqlServerAuditConfig + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlServerAuditConfig=} [properties] Properties to set + */ + function SqlServerAuditConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlServerAuditConfig kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @instance + */ + SqlServerAuditConfig.prototype.kind = ""; + + /** + * SqlServerAuditConfig bucket. + * @member {string} bucket + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @instance + */ + SqlServerAuditConfig.prototype.bucket = ""; + + /** + * SqlServerAuditConfig retentionInterval. + * @member {google.protobuf.IDuration|null|undefined} retentionInterval + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @instance + */ + SqlServerAuditConfig.prototype.retentionInterval = null; + + /** + * SqlServerAuditConfig uploadInterval. + * @member {google.protobuf.IDuration|null|undefined} uploadInterval + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @instance + */ + SqlServerAuditConfig.prototype.uploadInterval = null; + + /** + * Creates a new SqlServerAuditConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerAuditConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlServerAuditConfig} SqlServerAuditConfig instance + */ + SqlServerAuditConfig.create = function create(properties) { + return new SqlServerAuditConfig(properties); + }; + + /** + * Encodes the specified SqlServerAuditConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerAuditConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerAuditConfig} message SqlServerAuditConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerAuditConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.bucket); + if (message.retentionInterval != null && Object.hasOwnProperty.call(message, "retentionInterval")) + $root.google.protobuf.Duration.encode(message.retentionInterval, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.uploadInterval != null && Object.hasOwnProperty.call(message, "uploadInterval")) + $root.google.protobuf.Duration.encode(message.uploadInterval, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlServerAuditConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerAuditConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerAuditConfig} message SqlServerAuditConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerAuditConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlServerAuditConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlServerAuditConfig} SqlServerAuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerAuditConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlServerAuditConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.bucket = reader.string(); + break; + } + case 3: { + message.retentionInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 4: { + message.uploadInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlServerAuditConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlServerAuditConfig} SqlServerAuditConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerAuditConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlServerAuditConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlServerAuditConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.bucket != null && message.hasOwnProperty("bucket")) + if (!$util.isString(message.bucket)) + return "bucket: string expected"; + if (message.retentionInterval != null && message.hasOwnProperty("retentionInterval")) { + var error = $root.google.protobuf.Duration.verify(message.retentionInterval); + if (error) + return "retentionInterval." + error; + } + if (message.uploadInterval != null && message.hasOwnProperty("uploadInterval")) { + var error = $root.google.protobuf.Duration.verify(message.uploadInterval); + if (error) + return "uploadInterval." + error; + } + return null; + }; + + /** + * Creates a SqlServerAuditConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlServerAuditConfig} SqlServerAuditConfig + */ + SqlServerAuditConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlServerAuditConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlServerAuditConfig(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.bucket != null) + message.bucket = String(object.bucket); + if (object.retentionInterval != null) { + if (typeof object.retentionInterval !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlServerAuditConfig.retentionInterval: object expected"); + message.retentionInterval = $root.google.protobuf.Duration.fromObject(object.retentionInterval); + } + if (object.uploadInterval != null) { + if (typeof object.uploadInterval !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlServerAuditConfig.uploadInterval: object expected"); + message.uploadInterval = $root.google.protobuf.Duration.fromObject(object.uploadInterval); + } + return message; + }; + + /** + * Creates a plain object from a SqlServerAuditConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @static + * @param {google.cloud.sql.v1beta4.SqlServerAuditConfig} message SqlServerAuditConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlServerAuditConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.bucket = ""; + object.retentionInterval = null; + object.uploadInterval = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.bucket != null && message.hasOwnProperty("bucket")) + object.bucket = message.bucket; + if (message.retentionInterval != null && message.hasOwnProperty("retentionInterval")) + object.retentionInterval = $root.google.protobuf.Duration.toObject(message.retentionInterval, options); + if (message.uploadInterval != null && message.hasOwnProperty("uploadInterval")) + object.uploadInterval = $root.google.protobuf.Duration.toObject(message.uploadInterval, options); + return object; + }; + + /** + * Converts this SqlServerAuditConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @instance + * @returns {Object.} JSON object + */ + SqlServerAuditConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlServerAuditConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlServerAuditConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlServerAuditConfig"; + }; + + return SqlServerAuditConfig; + })(); + + v1beta4.SqlServerEntraIdConfig = (function() { + + /** + * Properties of a SqlServerEntraIdConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlServerEntraIdConfig + * @property {string|null} [kind] SqlServerEntraIdConfig kind + * @property {string|null} [tenantId] SqlServerEntraIdConfig tenantId + * @property {string|null} [applicationId] SqlServerEntraIdConfig applicationId + */ + + /** + * Constructs a new SqlServerEntraIdConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlServerEntraIdConfig. + * @implements ISqlServerEntraIdConfig + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig=} [properties] Properties to set + */ + function SqlServerEntraIdConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlServerEntraIdConfig kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @instance + */ + SqlServerEntraIdConfig.prototype.kind = ""; + + /** + * SqlServerEntraIdConfig tenantId. + * @member {string} tenantId + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @instance + */ + SqlServerEntraIdConfig.prototype.tenantId = ""; + + /** + * SqlServerEntraIdConfig applicationId. + * @member {string} applicationId + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @instance + */ + SqlServerEntraIdConfig.prototype.applicationId = ""; + + /** + * Creates a new SqlServerEntraIdConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlServerEntraIdConfig} SqlServerEntraIdConfig instance + */ + SqlServerEntraIdConfig.create = function create(properties) { + return new SqlServerEntraIdConfig(properties); + }; + + /** + * Encodes the specified SqlServerEntraIdConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerEntraIdConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig} message SqlServerEntraIdConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerEntraIdConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.tenantId != null && Object.hasOwnProperty.call(message, "tenantId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.tenantId); + if (message.applicationId != null && Object.hasOwnProperty.call(message, "applicationId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.applicationId); + return writer; + }; + + /** + * Encodes the specified SqlServerEntraIdConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerEntraIdConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig} message SqlServerEntraIdConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerEntraIdConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlServerEntraIdConfig} SqlServerEntraIdConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerEntraIdConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.tenantId = reader.string(); + break; + } + case 3: { + message.applicationId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlServerEntraIdConfig} SqlServerEntraIdConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerEntraIdConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlServerEntraIdConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlServerEntraIdConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.tenantId != null && message.hasOwnProperty("tenantId")) + if (!$util.isString(message.tenantId)) + return "tenantId: string expected"; + if (message.applicationId != null && message.hasOwnProperty("applicationId")) + if (!$util.isString(message.applicationId)) + return "applicationId: string expected"; + return null; + }; + + /** + * Creates a SqlServerEntraIdConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlServerEntraIdConfig} SqlServerEntraIdConfig + */ + SqlServerEntraIdConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.tenantId != null) + message.tenantId = String(object.tenantId); + if (object.applicationId != null) + message.applicationId = String(object.applicationId); + return message; + }; + + /** + * Creates a plain object from a SqlServerEntraIdConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @static + * @param {google.cloud.sql.v1beta4.SqlServerEntraIdConfig} message SqlServerEntraIdConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlServerEntraIdConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.tenantId = ""; + object.applicationId = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.tenantId != null && message.hasOwnProperty("tenantId")) + object.tenantId = message.tenantId; + if (message.applicationId != null && message.hasOwnProperty("applicationId")) + object.applicationId = message.applicationId; + return object; + }; + + /** + * Converts this SqlServerEntraIdConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @instance + * @returns {Object.} JSON object + */ + SqlServerEntraIdConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlServerEntraIdConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlServerEntraIdConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlServerEntraIdConfig"; + }; + + return SqlServerEntraIdConfig; + })(); + + /** + * SqlBackupRunStatus enum. + * @name google.cloud.sql.v1beta4.SqlBackupRunStatus + * @enum {number} + * @property {number} SQL_BACKUP_RUN_STATUS_UNSPECIFIED=0 SQL_BACKUP_RUN_STATUS_UNSPECIFIED value + * @property {number} ENQUEUED=1 ENQUEUED value + * @property {number} OVERDUE=2 OVERDUE value + * @property {number} RUNNING=3 RUNNING value + * @property {number} FAILED=4 FAILED value + * @property {number} SUCCESSFUL=5 SUCCESSFUL value + * @property {number} SKIPPED=6 SKIPPED value + * @property {number} DELETION_PENDING=7 DELETION_PENDING value + * @property {number} DELETION_FAILED=8 DELETION_FAILED value + * @property {number} DELETED=9 DELETED value + */ + v1beta4.SqlBackupRunStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKUP_RUN_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "ENQUEUED"] = 1; + values[valuesById[2] = "OVERDUE"] = 2; + values[valuesById[3] = "RUNNING"] = 3; + values[valuesById[4] = "FAILED"] = 4; + values[valuesById[5] = "SUCCESSFUL"] = 5; + values[valuesById[6] = "SKIPPED"] = 6; + values[valuesById[7] = "DELETION_PENDING"] = 7; + values[valuesById[8] = "DELETION_FAILED"] = 8; + values[valuesById[9] = "DELETED"] = 9; + return values; + })(); + + /** + * SqlBackupRunType enum. + * @name google.cloud.sql.v1beta4.SqlBackupRunType + * @enum {number} + * @property {number} SQL_BACKUP_RUN_TYPE_UNSPECIFIED=0 SQL_BACKUP_RUN_TYPE_UNSPECIFIED value + * @property {number} AUTOMATED=1 AUTOMATED value + * @property {number} ON_DEMAND=2 ON_DEMAND value + */ + v1beta4.SqlBackupRunType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKUP_RUN_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "AUTOMATED"] = 1; + values[valuesById[2] = "ON_DEMAND"] = 2; + return values; + })(); + + /** + * SqlBackupKind enum. + * @name google.cloud.sql.v1beta4.SqlBackupKind + * @enum {number} + * @property {number} SQL_BACKUP_KIND_UNSPECIFIED=0 SQL_BACKUP_KIND_UNSPECIFIED value + * @property {number} SNAPSHOT=1 SNAPSHOT value + * @property {number} PHYSICAL=2 PHYSICAL value + */ + v1beta4.SqlBackupKind = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKUP_KIND_UNSPECIFIED"] = 0; + values[valuesById[1] = "SNAPSHOT"] = 1; + values[valuesById[2] = "PHYSICAL"] = 2; + return values; + })(); + + /** + * SqlBackendType enum. + * @name google.cloud.sql.v1beta4.SqlBackendType + * @enum {number} + * @property {number} SQL_BACKEND_TYPE_UNSPECIFIED=0 SQL_BACKEND_TYPE_UNSPECIFIED value + * @property {number} FIRST_GEN=1 FIRST_GEN value + * @property {number} SECOND_GEN=2 SECOND_GEN value + * @property {number} EXTERNAL=3 EXTERNAL value + */ + v1beta4.SqlBackendType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_BACKEND_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "FIRST_GEN"] = 1; + values[valuesById[2] = "SECOND_GEN"] = 2; + values[valuesById[3] = "EXTERNAL"] = 3; + return values; + })(); + + /** + * SqlIpAddressType enum. + * @name google.cloud.sql.v1beta4.SqlIpAddressType + * @enum {number} + * @property {number} SQL_IP_ADDRESS_TYPE_UNSPECIFIED=0 SQL_IP_ADDRESS_TYPE_UNSPECIFIED value + * @property {number} PRIMARY=1 PRIMARY value + * @property {number} OUTGOING=2 OUTGOING value + * @property {number} PRIVATE=3 PRIVATE value + * @property {number} MIGRATED_1ST_GEN=4 MIGRATED_1ST_GEN value + */ + v1beta4.SqlIpAddressType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_IP_ADDRESS_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PRIMARY"] = 1; + values[valuesById[2] = "OUTGOING"] = 2; + values[valuesById[3] = "PRIVATE"] = 3; + values[valuesById[4] = "MIGRATED_1ST_GEN"] = 4; + return values; + })(); + + /** + * SqlInstanceType enum. + * @name google.cloud.sql.v1beta4.SqlInstanceType + * @enum {number} + * @property {number} SQL_INSTANCE_TYPE_UNSPECIFIED=0 SQL_INSTANCE_TYPE_UNSPECIFIED value + * @property {number} CLOUD_SQL_INSTANCE=1 CLOUD_SQL_INSTANCE value + * @property {number} ON_PREMISES_INSTANCE=2 ON_PREMISES_INSTANCE value + * @property {number} READ_REPLICA_INSTANCE=3 READ_REPLICA_INSTANCE value + * @property {number} READ_POOL_INSTANCE=5 READ_POOL_INSTANCE value + */ + v1beta4.SqlInstanceType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_INSTANCE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLOUD_SQL_INSTANCE"] = 1; + values[valuesById[2] = "ON_PREMISES_INSTANCE"] = 2; + values[valuesById[3] = "READ_REPLICA_INSTANCE"] = 3; + values[valuesById[5] = "READ_POOL_INSTANCE"] = 5; + return values; + })(); + + v1beta4.ConnectionPoolFlags = (function() { + + /** + * Properties of a ConnectionPoolFlags. + * @memberof google.cloud.sql.v1beta4 + * @interface IConnectionPoolFlags + * @property {string|null} [name] ConnectionPoolFlags name + * @property {string|null} [value] ConnectionPoolFlags value + */ + + /** + * Constructs a new ConnectionPoolFlags. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a ConnectionPoolFlags. + * @implements IConnectionPoolFlags + * @constructor + * @param {google.cloud.sql.v1beta4.IConnectionPoolFlags=} [properties] Properties to set + */ + function ConnectionPoolFlags(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectionPoolFlags name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @instance + */ + ConnectionPoolFlags.prototype.name = ""; + + /** + * ConnectionPoolFlags value. + * @member {string} value + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @instance + */ + ConnectionPoolFlags.prototype.value = ""; + + /** + * Creates a new ConnectionPoolFlags instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @static + * @param {google.cloud.sql.v1beta4.IConnectionPoolFlags=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ConnectionPoolFlags} ConnectionPoolFlags instance + */ + ConnectionPoolFlags.create = function create(properties) { + return new ConnectionPoolFlags(properties); + }; + + /** + * Encodes the specified ConnectionPoolFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolFlags.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @static + * @param {google.cloud.sql.v1beta4.IConnectionPoolFlags} message ConnectionPoolFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionPoolFlags.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + return writer; + }; + + /** + * Encodes the specified ConnectionPoolFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolFlags.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @static + * @param {google.cloud.sql.v1beta4.IConnectionPoolFlags} message ConnectionPoolFlags message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionPoolFlags.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectionPoolFlags message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ConnectionPoolFlags} ConnectionPoolFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionPoolFlags.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ConnectionPoolFlags(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectionPoolFlags message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ConnectionPoolFlags} ConnectionPoolFlags + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionPoolFlags.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectionPoolFlags message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectionPoolFlags.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a ConnectionPoolFlags message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ConnectionPoolFlags} ConnectionPoolFlags + */ + ConnectionPoolFlags.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ConnectionPoolFlags) + return object; + var message = new $root.google.cloud.sql.v1beta4.ConnectionPoolFlags(); + if (object.name != null) + message.name = String(object.name); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a ConnectionPoolFlags message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @static + * @param {google.cloud.sql.v1beta4.ConnectionPoolFlags} message ConnectionPoolFlags + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectionPoolFlags.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.value = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this ConnectionPoolFlags to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @instance + * @returns {Object.} JSON object + */ + ConnectionPoolFlags.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConnectionPoolFlags + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConnectionPoolFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ConnectionPoolFlags"; + }; + + return ConnectionPoolFlags; + })(); + + v1beta4.ReadPoolAutoScaleConfig = (function() { + + /** + * Properties of a ReadPoolAutoScaleConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IReadPoolAutoScaleConfig + * @property {boolean|null} [enabled] ReadPoolAutoScaleConfig enabled + * @property {number|null} [minNodeCount] ReadPoolAutoScaleConfig minNodeCount + * @property {number|null} [maxNodeCount] ReadPoolAutoScaleConfig maxNodeCount + * @property {Array.|null} [targetMetrics] ReadPoolAutoScaleConfig targetMetrics + * @property {boolean|null} [disableScaleIn] ReadPoolAutoScaleConfig disableScaleIn + * @property {number|null} [scaleInCooldownSeconds] ReadPoolAutoScaleConfig scaleInCooldownSeconds + * @property {number|null} [scaleOutCooldownSeconds] ReadPoolAutoScaleConfig scaleOutCooldownSeconds + */ + + /** + * Constructs a new ReadPoolAutoScaleConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a ReadPoolAutoScaleConfig. + * @implements IReadPoolAutoScaleConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig=} [properties] Properties to set + */ + function ReadPoolAutoScaleConfig(properties) { + this.targetMetrics = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReadPoolAutoScaleConfig enabled. + * @member {boolean|null|undefined} enabled + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.enabled = null; + + /** + * ReadPoolAutoScaleConfig minNodeCount. + * @member {number|null|undefined} minNodeCount + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.minNodeCount = null; + + /** + * ReadPoolAutoScaleConfig maxNodeCount. + * @member {number|null|undefined} maxNodeCount + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.maxNodeCount = null; + + /** + * ReadPoolAutoScaleConfig targetMetrics. + * @member {Array.} targetMetrics + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.targetMetrics = $util.emptyArray; + + /** + * ReadPoolAutoScaleConfig disableScaleIn. + * @member {boolean|null|undefined} disableScaleIn + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.disableScaleIn = null; + + /** + * ReadPoolAutoScaleConfig scaleInCooldownSeconds. + * @member {number|null|undefined} scaleInCooldownSeconds + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.scaleInCooldownSeconds = null; + + /** + * ReadPoolAutoScaleConfig scaleOutCooldownSeconds. + * @member {number|null|undefined} scaleOutCooldownSeconds + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @instance + */ + ReadPoolAutoScaleConfig.prototype.scaleOutCooldownSeconds = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_enabled", { + get: $util.oneOfGetter($oneOfFields = ["enabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_minNodeCount", { + get: $util.oneOfGetter($oneOfFields = ["minNodeCount"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_maxNodeCount", { + get: $util.oneOfGetter($oneOfFields = ["maxNodeCount"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_disableScaleIn", { + get: $util.oneOfGetter($oneOfFields = ["disableScaleIn"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_scaleInCooldownSeconds", { + get: $util.oneOfGetter($oneOfFields = ["scaleInCooldownSeconds"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_scaleOutCooldownSeconds", { + get: $util.oneOfGetter($oneOfFields = ["scaleOutCooldownSeconds"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ReadPoolAutoScaleConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @static + * @param {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig instance + */ + ReadPoolAutoScaleConfig.create = function create(properties) { + return new ReadPoolAutoScaleConfig(properties); + }; + + /** + * Encodes the specified ReadPoolAutoScaleConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @static + * @param {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadPoolAutoScaleConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); + if (message.minNodeCount != null && Object.hasOwnProperty.call(message, "minNodeCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.minNodeCount); + if (message.maxNodeCount != null && Object.hasOwnProperty.call(message, "maxNodeCount")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxNodeCount); + if (message.targetMetrics != null && message.targetMetrics.length) + for (var i = 0; i < message.targetMetrics.length; ++i) + $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.encode(message.targetMetrics[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.disableScaleIn != null && Object.hasOwnProperty.call(message, "disableScaleIn")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.disableScaleIn); + if (message.scaleInCooldownSeconds != null && Object.hasOwnProperty.call(message, "scaleInCooldownSeconds")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.scaleInCooldownSeconds); + if (message.scaleOutCooldownSeconds != null && Object.hasOwnProperty.call(message, "scaleOutCooldownSeconds")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.scaleOutCooldownSeconds); + return writer; + }; + + /** + * Encodes the specified ReadPoolAutoScaleConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @static + * @param {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReadPoolAutoScaleConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadPoolAutoScaleConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.enabled = reader.bool(); + break; + } + case 2: { + message.minNodeCount = reader.int32(); + break; + } + case 3: { + message.maxNodeCount = reader.int32(); + break; + } + case 4: { + if (!(message.targetMetrics && message.targetMetrics.length)) + message.targetMetrics = []; + message.targetMetrics.push($root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.decode(reader, reader.uint32())); + break; + } + case 5: { + message.disableScaleIn = reader.bool(); + break; + } + case 6: { + message.scaleInCooldownSeconds = reader.int32(); + break; + } + case 7: { + message.scaleOutCooldownSeconds = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReadPoolAutoScaleConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReadPoolAutoScaleConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReadPoolAutoScaleConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + properties._enabled = 1; + if (typeof message.enabled !== "boolean") + return "enabled: boolean expected"; + } + if (message.minNodeCount != null && message.hasOwnProperty("minNodeCount")) { + properties._minNodeCount = 1; + if (!$util.isInteger(message.minNodeCount)) + return "minNodeCount: integer expected"; + } + if (message.maxNodeCount != null && message.hasOwnProperty("maxNodeCount")) { + properties._maxNodeCount = 1; + if (!$util.isInteger(message.maxNodeCount)) + return "maxNodeCount: integer expected"; + } + if (message.targetMetrics != null && message.hasOwnProperty("targetMetrics")) { + if (!Array.isArray(message.targetMetrics)) + return "targetMetrics: array expected"; + for (var i = 0; i < message.targetMetrics.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.verify(message.targetMetrics[i]); + if (error) + return "targetMetrics." + error; + } + } + if (message.disableScaleIn != null && message.hasOwnProperty("disableScaleIn")) { + properties._disableScaleIn = 1; + if (typeof message.disableScaleIn !== "boolean") + return "disableScaleIn: boolean expected"; + } + if (message.scaleInCooldownSeconds != null && message.hasOwnProperty("scaleInCooldownSeconds")) { + properties._scaleInCooldownSeconds = 1; + if (!$util.isInteger(message.scaleInCooldownSeconds)) + return "scaleInCooldownSeconds: integer expected"; + } + if (message.scaleOutCooldownSeconds != null && message.hasOwnProperty("scaleOutCooldownSeconds")) { + properties._scaleOutCooldownSeconds = 1; + if (!$util.isInteger(message.scaleOutCooldownSeconds)) + return "scaleOutCooldownSeconds: integer expected"; + } + return null; + }; + + /** + * Creates a ReadPoolAutoScaleConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig + */ + ReadPoolAutoScaleConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig(); + if (object.enabled != null) + message.enabled = Boolean(object.enabled); + if (object.minNodeCount != null) + message.minNodeCount = object.minNodeCount | 0; + if (object.maxNodeCount != null) + message.maxNodeCount = object.maxNodeCount | 0; + if (object.targetMetrics) { + if (!Array.isArray(object.targetMetrics)) + throw TypeError(".google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.targetMetrics: array expected"); + message.targetMetrics = []; + for (var i = 0; i < object.targetMetrics.length; ++i) { + if (typeof object.targetMetrics[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.targetMetrics: object expected"); + message.targetMetrics[i] = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.fromObject(object.targetMetrics[i]); + } + } + if (object.disableScaleIn != null) + message.disableScaleIn = Boolean(object.disableScaleIn); + if (object.scaleInCooldownSeconds != null) + message.scaleInCooldownSeconds = object.scaleInCooldownSeconds | 0; + if (object.scaleOutCooldownSeconds != null) + message.scaleOutCooldownSeconds = object.scaleOutCooldownSeconds | 0; + return message; + }; + + /** + * Creates a plain object from a ReadPoolAutoScaleConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @static + * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReadPoolAutoScaleConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.targetMetrics = []; + if (message.enabled != null && message.hasOwnProperty("enabled")) { + object.enabled = message.enabled; + if (options.oneofs) + object._enabled = "enabled"; + } + if (message.minNodeCount != null && message.hasOwnProperty("minNodeCount")) { + object.minNodeCount = message.minNodeCount; + if (options.oneofs) + object._minNodeCount = "minNodeCount"; + } + if (message.maxNodeCount != null && message.hasOwnProperty("maxNodeCount")) { + object.maxNodeCount = message.maxNodeCount; + if (options.oneofs) + object._maxNodeCount = "maxNodeCount"; + } + if (message.targetMetrics && message.targetMetrics.length) { + object.targetMetrics = []; + for (var j = 0; j < message.targetMetrics.length; ++j) + object.targetMetrics[j] = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.toObject(message.targetMetrics[j], options); + } + if (message.disableScaleIn != null && message.hasOwnProperty("disableScaleIn")) { + object.disableScaleIn = message.disableScaleIn; + if (options.oneofs) + object._disableScaleIn = "disableScaleIn"; + } + if (message.scaleInCooldownSeconds != null && message.hasOwnProperty("scaleInCooldownSeconds")) { + object.scaleInCooldownSeconds = message.scaleInCooldownSeconds; + if (options.oneofs) + object._scaleInCooldownSeconds = "scaleInCooldownSeconds"; + } + if (message.scaleOutCooldownSeconds != null && message.hasOwnProperty("scaleOutCooldownSeconds")) { + object.scaleOutCooldownSeconds = message.scaleOutCooldownSeconds; + if (options.oneofs) + object._scaleOutCooldownSeconds = "scaleOutCooldownSeconds"; + } + return object; + }; + + /** + * Converts this ReadPoolAutoScaleConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @instance + * @returns {Object.} JSON object + */ + ReadPoolAutoScaleConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReadPoolAutoScaleConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReadPoolAutoScaleConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig"; + }; + + ReadPoolAutoScaleConfig.TargetMetric = (function() { + + /** + * Properties of a TargetMetric. + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @interface ITargetMetric + * @property {string|null} [metric] TargetMetric metric + * @property {number|null} [targetValue] TargetMetric targetValue + */ + + /** + * Constructs a new TargetMetric. + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig + * @classdesc Represents a TargetMetric. + * @implements ITargetMetric + * @constructor + * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric=} [properties] Properties to set + */ + function TargetMetric(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TargetMetric metric. + * @member {string|null|undefined} metric + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @instance + */ + TargetMetric.prototype.metric = null; + + /** + * TargetMetric targetValue. + * @member {number|null|undefined} targetValue + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @instance + */ + TargetMetric.prototype.targetValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(TargetMetric.prototype, "_metric", { + get: $util.oneOfGetter($oneOfFields = ["metric"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(TargetMetric.prototype, "_targetValue", { + get: $util.oneOfGetter($oneOfFields = ["targetValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new TargetMetric instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric instance + */ + TargetMetric.create = function create(properties) { + return new TargetMetric(properties); + }; + + /** + * Encodes the specified TargetMetric message. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric} message TargetMetric message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TargetMetric.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metric != null && Object.hasOwnProperty.call(message, "metric")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.metric); + if (message.targetValue != null && Object.hasOwnProperty.call(message, "targetValue")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.targetValue); + return writer; + }; + + /** + * Encodes the specified TargetMetric message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric} message TargetMetric message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TargetMetric.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TargetMetric message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TargetMetric.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.metric = reader.string(); + break; + } + case 2: { + message.targetValue = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TargetMetric message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TargetMetric.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TargetMetric message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TargetMetric.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.metric != null && message.hasOwnProperty("metric")) { + properties._metric = 1; + if (!$util.isString(message.metric)) + return "metric: string expected"; + } + if (message.targetValue != null && message.hasOwnProperty("targetValue")) { + properties._targetValue = 1; + if (typeof message.targetValue !== "number") + return "targetValue: number expected"; + } + return null; + }; + + /** + * Creates a TargetMetric message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric + */ + TargetMetric.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric) + return object; + var message = new $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric(); + if (object.metric != null) + message.metric = String(object.metric); + if (object.targetValue != null) + message.targetValue = Number(object.targetValue); + return message; + }; + + /** + * Creates a plain object from a TargetMetric message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric} message TargetMetric + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TargetMetric.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.metric != null && message.hasOwnProperty("metric")) { + object.metric = message.metric; + if (options.oneofs) + object._metric = "metric"; + } + if (message.targetValue != null && message.hasOwnProperty("targetValue")) { + object.targetValue = options.json && !isFinite(message.targetValue) ? String(message.targetValue) : message.targetValue; + if (options.oneofs) + object._targetValue = "targetValue"; + } + return object; + }; + + /** + * Converts this TargetMetric to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @instance + * @returns {Object.} JSON object + */ + TargetMetric.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TargetMetric + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TargetMetric.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric"; + }; + + return TargetMetric; + })(); + + return ReadPoolAutoScaleConfig; + })(); + + v1beta4.ConnectionPoolConfig = (function() { + + /** + * Properties of a ConnectionPoolConfig. + * @memberof google.cloud.sql.v1beta4 + * @interface IConnectionPoolConfig + * @property {boolean|null} [connectionPoolingEnabled] ConnectionPoolConfig connectionPoolingEnabled + * @property {Array.|null} [flags] ConnectionPoolConfig flags + * @property {number|null} [poolerCount] ConnectionPoolConfig poolerCount + */ + + /** + * Constructs a new ConnectionPoolConfig. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a ConnectionPoolConfig. + * @implements IConnectionPoolConfig + * @constructor + * @param {google.cloud.sql.v1beta4.IConnectionPoolConfig=} [properties] Properties to set + */ + function ConnectionPoolConfig(properties) { + this.flags = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectionPoolConfig connectionPoolingEnabled. + * @member {boolean|null|undefined} connectionPoolingEnabled + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @instance + */ + ConnectionPoolConfig.prototype.connectionPoolingEnabled = null; + + /** + * ConnectionPoolConfig flags. + * @member {Array.} flags + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @instance + */ + ConnectionPoolConfig.prototype.flags = $util.emptyArray; + + /** + * ConnectionPoolConfig poolerCount. + * @member {number|null|undefined} poolerCount + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @instance + */ + ConnectionPoolConfig.prototype.poolerCount = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ConnectionPoolConfig.prototype, "_connectionPoolingEnabled", { + get: $util.oneOfGetter($oneOfFields = ["connectionPoolingEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ConnectionPoolConfig.prototype, "_poolerCount", { + get: $util.oneOfGetter($oneOfFields = ["poolerCount"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ConnectionPoolConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @static + * @param {google.cloud.sql.v1beta4.IConnectionPoolConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ConnectionPoolConfig} ConnectionPoolConfig instance + */ + ConnectionPoolConfig.create = function create(properties) { + return new ConnectionPoolConfig(properties); + }; + + /** + * Encodes the specified ConnectionPoolConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @static + * @param {google.cloud.sql.v1beta4.IConnectionPoolConfig} message ConnectionPoolConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionPoolConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.connectionPoolingEnabled != null && Object.hasOwnProperty.call(message, "connectionPoolingEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.connectionPoolingEnabled); + if (message.flags != null && message.flags.length) + for (var i = 0; i < message.flags.length; ++i) + $root.google.cloud.sql.v1beta4.ConnectionPoolFlags.encode(message.flags[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.poolerCount != null && Object.hasOwnProperty.call(message, "poolerCount")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.poolerCount); + return writer; + }; + + /** + * Encodes the specified ConnectionPoolConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @static + * @param {google.cloud.sql.v1beta4.IConnectionPoolConfig} message ConnectionPoolConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectionPoolConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectionPoolConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ConnectionPoolConfig} ConnectionPoolConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionPoolConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ConnectionPoolConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.connectionPoolingEnabled = reader.bool(); + break; + } + case 8: { + if (!(message.flags && message.flags.length)) + message.flags = []; + message.flags.push($root.google.cloud.sql.v1beta4.ConnectionPoolFlags.decode(reader, reader.uint32())); + break; + } + case 9: { + message.poolerCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectionPoolConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ConnectionPoolConfig} ConnectionPoolConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectionPoolConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectionPoolConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectionPoolConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.connectionPoolingEnabled != null && message.hasOwnProperty("connectionPoolingEnabled")) { + properties._connectionPoolingEnabled = 1; + if (typeof message.connectionPoolingEnabled !== "boolean") + return "connectionPoolingEnabled: boolean expected"; + } + if (message.flags != null && message.hasOwnProperty("flags")) { + if (!Array.isArray(message.flags)) + return "flags: array expected"; + for (var i = 0; i < message.flags.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.ConnectionPoolFlags.verify(message.flags[i]); + if (error) + return "flags." + error; + } + } + if (message.poolerCount != null && message.hasOwnProperty("poolerCount")) { + properties._poolerCount = 1; + if (!$util.isInteger(message.poolerCount)) + return "poolerCount: integer expected"; + } + return null; + }; + + /** + * Creates a ConnectionPoolConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ConnectionPoolConfig} ConnectionPoolConfig + */ + ConnectionPoolConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ConnectionPoolConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.ConnectionPoolConfig(); + if (object.connectionPoolingEnabled != null) + message.connectionPoolingEnabled = Boolean(object.connectionPoolingEnabled); + if (object.flags) { + if (!Array.isArray(object.flags)) + throw TypeError(".google.cloud.sql.v1beta4.ConnectionPoolConfig.flags: array expected"); + message.flags = []; + for (var i = 0; i < object.flags.length; ++i) { + if (typeof object.flags[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ConnectionPoolConfig.flags: object expected"); + message.flags[i] = $root.google.cloud.sql.v1beta4.ConnectionPoolFlags.fromObject(object.flags[i]); + } + } + if (object.poolerCount != null) + message.poolerCount = object.poolerCount | 0; + return message; + }; + + /** + * Creates a plain object from a ConnectionPoolConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @static + * @param {google.cloud.sql.v1beta4.ConnectionPoolConfig} message ConnectionPoolConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectionPoolConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.flags = []; + if (message.connectionPoolingEnabled != null && message.hasOwnProperty("connectionPoolingEnabled")) { + object.connectionPoolingEnabled = message.connectionPoolingEnabled; + if (options.oneofs) + object._connectionPoolingEnabled = "connectionPoolingEnabled"; + } + if (message.flags && message.flags.length) { + object.flags = []; + for (var j = 0; j < message.flags.length; ++j) + object.flags[j] = $root.google.cloud.sql.v1beta4.ConnectionPoolFlags.toObject(message.flags[j], options); + } + if (message.poolerCount != null && message.hasOwnProperty("poolerCount")) { + object.poolerCount = message.poolerCount; + if (options.oneofs) + object._poolerCount = "poolerCount"; + } + return object; + }; + + /** + * Converts this ConnectionPoolConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @instance + * @returns {Object.} JSON object + */ + ConnectionPoolConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConnectionPoolConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConnectionPoolConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ConnectionPoolConfig"; + }; + + return ConnectionPoolConfig; + })(); + + /** + * SqlDatabaseVersion enum. + * @name google.cloud.sql.v1beta4.SqlDatabaseVersion + * @enum {number} + * @property {number} SQL_DATABASE_VERSION_UNSPECIFIED=0 SQL_DATABASE_VERSION_UNSPECIFIED value + * @property {number} MYSQL_5_1=2 MYSQL_5_1 value + * @property {number} MYSQL_5_5=3 MYSQL_5_5 value + * @property {number} MYSQL_5_6=5 MYSQL_5_6 value + * @property {number} MYSQL_5_7=6 MYSQL_5_7 value + * @property {number} MYSQL_8_0=20 MYSQL_8_0 value + * @property {number} MYSQL_8_0_18=41 MYSQL_8_0_18 value + * @property {number} MYSQL_8_0_26=85 MYSQL_8_0_26 value + * @property {number} MYSQL_8_0_27=111 MYSQL_8_0_27 value + * @property {number} MYSQL_8_0_28=132 MYSQL_8_0_28 value + * @property {number} MYSQL_8_0_29=148 MYSQL_8_0_29 value + * @property {number} MYSQL_8_0_30=174 MYSQL_8_0_30 value + * @property {number} MYSQL_8_0_31=197 MYSQL_8_0_31 value + * @property {number} MYSQL_8_0_32=213 MYSQL_8_0_32 value + * @property {number} MYSQL_8_0_33=238 MYSQL_8_0_33 value + * @property {number} MYSQL_8_0_34=239 MYSQL_8_0_34 value + * @property {number} MYSQL_8_0_35=240 MYSQL_8_0_35 value + * @property {number} MYSQL_8_0_36=241 MYSQL_8_0_36 value + * @property {number} MYSQL_8_0_37=355 MYSQL_8_0_37 value + * @property {number} MYSQL_8_0_39=357 MYSQL_8_0_39 value + * @property {number} MYSQL_8_0_40=358 MYSQL_8_0_40 value + * @property {number} MYSQL_8_0_41=488 MYSQL_8_0_41 value + * @property {number} MYSQL_8_0_42=489 MYSQL_8_0_42 value + * @property {number} MYSQL_8_0_43=553 MYSQL_8_0_43 value + * @property {number} MYSQL_8_0_44=554 MYSQL_8_0_44 value + * @property {number} MYSQL_8_0_45=555 MYSQL_8_0_45 value + * @property {number} MYSQL_8_0_46=556 MYSQL_8_0_46 value + * @property {number} MYSQL_8_4=398 MYSQL_8_4 value + * @property {number} MYSQL_9_7=654 MYSQL_9_7 value + * @property {number} SQLSERVER_2017_STANDARD=11 SQLSERVER_2017_STANDARD value + * @property {number} SQLSERVER_2017_ENTERPRISE=14 SQLSERVER_2017_ENTERPRISE value + * @property {number} SQLSERVER_2017_EXPRESS=15 SQLSERVER_2017_EXPRESS value + * @property {number} SQLSERVER_2017_WEB=16 SQLSERVER_2017_WEB value + * @property {number} POSTGRES_9_6=9 POSTGRES_9_6 value + * @property {number} POSTGRES_10=18 POSTGRES_10 value + * @property {number} POSTGRES_11=10 POSTGRES_11 value + * @property {number} POSTGRES_12=19 POSTGRES_12 value + * @property {number} POSTGRES_13=23 POSTGRES_13 value + * @property {number} POSTGRES_14=110 POSTGRES_14 value + * @property {number} POSTGRES_15=172 POSTGRES_15 value + * @property {number} POSTGRES_16=272 POSTGRES_16 value + * @property {number} POSTGRES_17=408 POSTGRES_17 value + * @property {number} POSTGRES_18=557 POSTGRES_18 value + * @property {number} SQLSERVER_2019_STANDARD=26 SQLSERVER_2019_STANDARD value + * @property {number} SQLSERVER_2019_ENTERPRISE=27 SQLSERVER_2019_ENTERPRISE value + * @property {number} SQLSERVER_2019_EXPRESS=28 SQLSERVER_2019_EXPRESS value + * @property {number} SQLSERVER_2019_WEB=29 SQLSERVER_2019_WEB value + * @property {number} SQLSERVER_2022_STANDARD=199 SQLSERVER_2022_STANDARD value + * @property {number} SQLSERVER_2022_ENTERPRISE=200 SQLSERVER_2022_ENTERPRISE value + * @property {number} SQLSERVER_2022_EXPRESS=201 SQLSERVER_2022_EXPRESS value + * @property {number} SQLSERVER_2022_WEB=202 SQLSERVER_2022_WEB value + */ + v1beta4.SqlDatabaseVersion = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_DATABASE_VERSION_UNSPECIFIED"] = 0; + values[valuesById[2] = "MYSQL_5_1"] = 2; + values[valuesById[3] = "MYSQL_5_5"] = 3; + values[valuesById[5] = "MYSQL_5_6"] = 5; + values[valuesById[6] = "MYSQL_5_7"] = 6; + values[valuesById[20] = "MYSQL_8_0"] = 20; + values[valuesById[41] = "MYSQL_8_0_18"] = 41; + values[valuesById[85] = "MYSQL_8_0_26"] = 85; + values[valuesById[111] = "MYSQL_8_0_27"] = 111; + values[valuesById[132] = "MYSQL_8_0_28"] = 132; + values[valuesById[148] = "MYSQL_8_0_29"] = 148; + values[valuesById[174] = "MYSQL_8_0_30"] = 174; + values[valuesById[197] = "MYSQL_8_0_31"] = 197; + values[valuesById[213] = "MYSQL_8_0_32"] = 213; + values[valuesById[238] = "MYSQL_8_0_33"] = 238; + values[valuesById[239] = "MYSQL_8_0_34"] = 239; + values[valuesById[240] = "MYSQL_8_0_35"] = 240; + values[valuesById[241] = "MYSQL_8_0_36"] = 241; + values[valuesById[355] = "MYSQL_8_0_37"] = 355; + values[valuesById[357] = "MYSQL_8_0_39"] = 357; + values[valuesById[358] = "MYSQL_8_0_40"] = 358; + values[valuesById[488] = "MYSQL_8_0_41"] = 488; + values[valuesById[489] = "MYSQL_8_0_42"] = 489; + values[valuesById[553] = "MYSQL_8_0_43"] = 553; + values[valuesById[554] = "MYSQL_8_0_44"] = 554; + values[valuesById[555] = "MYSQL_8_0_45"] = 555; + values[valuesById[556] = "MYSQL_8_0_46"] = 556; + values[valuesById[398] = "MYSQL_8_4"] = 398; + values[valuesById[654] = "MYSQL_9_7"] = 654; + values[valuesById[11] = "SQLSERVER_2017_STANDARD"] = 11; + values[valuesById[14] = "SQLSERVER_2017_ENTERPRISE"] = 14; + values[valuesById[15] = "SQLSERVER_2017_EXPRESS"] = 15; + values[valuesById[16] = "SQLSERVER_2017_WEB"] = 16; + values[valuesById[9] = "POSTGRES_9_6"] = 9; + values[valuesById[18] = "POSTGRES_10"] = 18; + values[valuesById[10] = "POSTGRES_11"] = 10; + values[valuesById[19] = "POSTGRES_12"] = 19; + values[valuesById[23] = "POSTGRES_13"] = 23; + values[valuesById[110] = "POSTGRES_14"] = 110; + values[valuesById[172] = "POSTGRES_15"] = 172; + values[valuesById[272] = "POSTGRES_16"] = 272; + values[valuesById[408] = "POSTGRES_17"] = 408; + values[valuesById[557] = "POSTGRES_18"] = 557; + values[valuesById[26] = "SQLSERVER_2019_STANDARD"] = 26; + values[valuesById[27] = "SQLSERVER_2019_ENTERPRISE"] = 27; + values[valuesById[28] = "SQLSERVER_2019_EXPRESS"] = 28; + values[valuesById[29] = "SQLSERVER_2019_WEB"] = 29; + values[valuesById[199] = "SQLSERVER_2022_STANDARD"] = 199; + values[valuesById[200] = "SQLSERVER_2022_ENTERPRISE"] = 200; + values[valuesById[201] = "SQLSERVER_2022_EXPRESS"] = 201; + values[valuesById[202] = "SQLSERVER_2022_WEB"] = 202; + return values; + })(); + + /** + * SqlSuspensionReason enum. + * @name google.cloud.sql.v1beta4.SqlSuspensionReason + * @enum {number} + * @property {number} SQL_SUSPENSION_REASON_UNSPECIFIED=0 SQL_SUSPENSION_REASON_UNSPECIFIED value + * @property {number} BILLING_ISSUE=2 BILLING_ISSUE value + * @property {number} LEGAL_ISSUE=3 LEGAL_ISSUE value + * @property {number} OPERATIONAL_ISSUE=4 OPERATIONAL_ISSUE value + * @property {number} KMS_KEY_ISSUE=5 KMS_KEY_ISSUE value + */ + v1beta4.SqlSuspensionReason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_SUSPENSION_REASON_UNSPECIFIED"] = 0; + values[valuesById[2] = "BILLING_ISSUE"] = 2; + values[valuesById[3] = "LEGAL_ISSUE"] = 3; + values[valuesById[4] = "OPERATIONAL_ISSUE"] = 4; + values[valuesById[5] = "KMS_KEY_ISSUE"] = 5; + return values; + })(); + + /** + * SqlPricingPlan enum. + * @name google.cloud.sql.v1beta4.SqlPricingPlan + * @enum {number} + * @property {number} SQL_PRICING_PLAN_UNSPECIFIED=0 SQL_PRICING_PLAN_UNSPECIFIED value + * @property {number} PACKAGE=1 PACKAGE value + * @property {number} PER_USE=2 PER_USE value + */ + v1beta4.SqlPricingPlan = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_PRICING_PLAN_UNSPECIFIED"] = 0; + values[valuesById[1] = "PACKAGE"] = 1; + values[valuesById[2] = "PER_USE"] = 2; + return values; + })(); + + /** + * SqlReplicationType enum. + * @name google.cloud.sql.v1beta4.SqlReplicationType + * @enum {number} + * @property {number} SQL_REPLICATION_TYPE_UNSPECIFIED=0 SQL_REPLICATION_TYPE_UNSPECIFIED value + * @property {number} SYNCHRONOUS=1 SYNCHRONOUS value + * @property {number} ASYNCHRONOUS=2 ASYNCHRONOUS value + */ + v1beta4.SqlReplicationType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_REPLICATION_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SYNCHRONOUS"] = 1; + values[valuesById[2] = "ASYNCHRONOUS"] = 2; + return values; + })(); + + /** + * SqlDataDiskType enum. + * @name google.cloud.sql.v1beta4.SqlDataDiskType + * @enum {number} + * @property {number} SQL_DATA_DISK_TYPE_UNSPECIFIED=0 SQL_DATA_DISK_TYPE_UNSPECIFIED value + * @property {number} PD_SSD=1 PD_SSD value + * @property {number} PD_HDD=2 PD_HDD value + * @property {number} OBSOLETE_LOCAL_SSD=3 OBSOLETE_LOCAL_SSD value + * @property {number} HYPERDISK_BALANCED=4 HYPERDISK_BALANCED value + */ + v1beta4.SqlDataDiskType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_DATA_DISK_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "PD_SSD"] = 1; + values[valuesById[2] = "PD_HDD"] = 2; + values[valuesById[3] = "OBSOLETE_LOCAL_SSD"] = 3; + values[valuesById[4] = "HYPERDISK_BALANCED"] = 4; + return values; + })(); + + /** + * SqlAvailabilityType enum. + * @name google.cloud.sql.v1beta4.SqlAvailabilityType + * @enum {number} + * @property {number} SQL_AVAILABILITY_TYPE_UNSPECIFIED=0 SQL_AVAILABILITY_TYPE_UNSPECIFIED value + * @property {number} ZONAL=1 ZONAL value + * @property {number} REGIONAL=2 REGIONAL value + */ + v1beta4.SqlAvailabilityType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_AVAILABILITY_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ZONAL"] = 1; + values[valuesById[2] = "REGIONAL"] = 2; + return values; + })(); + + /** + * SqlUpdateTrack enum. + * @name google.cloud.sql.v1beta4.SqlUpdateTrack + * @enum {number} + * @property {number} SQL_UPDATE_TRACK_UNSPECIFIED=0 SQL_UPDATE_TRACK_UNSPECIFIED value + * @property {number} canary=1 canary value + * @property {number} stable=2 stable value + * @property {number} week5=3 week5 value + */ + v1beta4.SqlUpdateTrack = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_UPDATE_TRACK_UNSPECIFIED"] = 0; + values[valuesById[1] = "canary"] = 1; + values[valuesById[2] = "stable"] = 2; + values[valuesById[3] = "week5"] = 3; + return values; + })(); + + v1beta4.AcquireSsrsLeaseContext = (function() { + + /** + * Properties of an AcquireSsrsLeaseContext. + * @memberof google.cloud.sql.v1beta4 + * @interface IAcquireSsrsLeaseContext + * @property {string|null} [setupLogin] AcquireSsrsLeaseContext setupLogin + * @property {string|null} [serviceLogin] AcquireSsrsLeaseContext serviceLogin + * @property {string|null} [reportDatabase] AcquireSsrsLeaseContext reportDatabase + * @property {google.protobuf.IDuration|null} [duration] AcquireSsrsLeaseContext duration + */ + + /** + * Constructs a new AcquireSsrsLeaseContext. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents an AcquireSsrsLeaseContext. + * @implements IAcquireSsrsLeaseContext + * @constructor + * @param {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext=} [properties] Properties to set + */ + function AcquireSsrsLeaseContext(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * AcquireSsrsLeaseContext setupLogin. + * @member {string|null|undefined} setupLogin + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @instance + */ + AcquireSsrsLeaseContext.prototype.setupLogin = null; + + /** + * AcquireSsrsLeaseContext serviceLogin. + * @member {string|null|undefined} serviceLogin + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @instance + */ + AcquireSsrsLeaseContext.prototype.serviceLogin = null; + + /** + * AcquireSsrsLeaseContext reportDatabase. + * @member {string|null|undefined} reportDatabase + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @instance + */ + AcquireSsrsLeaseContext.prototype.reportDatabase = null; + + /** + * AcquireSsrsLeaseContext duration. + * @member {google.protobuf.IDuration|null|undefined} duration + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @instance + */ + AcquireSsrsLeaseContext.prototype.duration = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_setupLogin", { + get: $util.oneOfGetter($oneOfFields = ["setupLogin"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_serviceLogin", { + get: $util.oneOfGetter($oneOfFields = ["serviceLogin"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_reportDatabase", { + get: $util.oneOfGetter($oneOfFields = ["reportDatabase"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_duration", { + get: $util.oneOfGetter($oneOfFields = ["duration"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new AcquireSsrsLeaseContext instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @static + * @param {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext instance + */ + AcquireSsrsLeaseContext.create = function create(properties) { + return new AcquireSsrsLeaseContext(properties); + }; + + /** + * Encodes the specified AcquireSsrsLeaseContext message. Does not implicitly {@link google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @static + * @param {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext} message AcquireSsrsLeaseContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcquireSsrsLeaseContext.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.setupLogin != null && Object.hasOwnProperty.call(message, "setupLogin")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.setupLogin); + if (message.serviceLogin != null && Object.hasOwnProperty.call(message, "serviceLogin")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.serviceLogin); + if (message.reportDatabase != null && Object.hasOwnProperty.call(message, "reportDatabase")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.reportDatabase); + if (message.duration != null && Object.hasOwnProperty.call(message, "duration")) + $root.google.protobuf.Duration.encode(message.duration, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified AcquireSsrsLeaseContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @static + * @param {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext} message AcquireSsrsLeaseContext message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + AcquireSsrsLeaseContext.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AcquireSsrsLeaseContext.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.setupLogin = reader.string(); + break; + } + case 2: { + message.serviceLogin = reader.string(); + break; + } + case 3: { + message.reportDatabase = reader.string(); + break; + } + case 4: { + message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + AcquireSsrsLeaseContext.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an AcquireSsrsLeaseContext message. + * @function verify + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + AcquireSsrsLeaseContext.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.setupLogin != null && message.hasOwnProperty("setupLogin")) { + properties._setupLogin = 1; + if (!$util.isString(message.setupLogin)) + return "setupLogin: string expected"; + } + if (message.serviceLogin != null && message.hasOwnProperty("serviceLogin")) { + properties._serviceLogin = 1; + if (!$util.isString(message.serviceLogin)) + return "serviceLogin: string expected"; + } + if (message.reportDatabase != null && message.hasOwnProperty("reportDatabase")) { + properties._reportDatabase = 1; + if (!$util.isString(message.reportDatabase)) + return "reportDatabase: string expected"; + } + if (message.duration != null && message.hasOwnProperty("duration")) { + properties._duration = 1; + { + var error = $root.google.protobuf.Duration.verify(message.duration); + if (error) + return "duration." + error; + } + } + return null; + }; + + /** + * Creates an AcquireSsrsLeaseContext message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext + */ + AcquireSsrsLeaseContext.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext) + return object; + var message = new $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext(); + if (object.setupLogin != null) + message.setupLogin = String(object.setupLogin); + if (object.serviceLogin != null) + message.serviceLogin = String(object.serviceLogin); + if (object.reportDatabase != null) + message.reportDatabase = String(object.reportDatabase); + if (object.duration != null) { + if (typeof object.duration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.duration: object expected"); + message.duration = $root.google.protobuf.Duration.fromObject(object.duration); + } + return message; + }; + + /** + * Creates a plain object from an AcquireSsrsLeaseContext message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @static + * @param {google.cloud.sql.v1beta4.AcquireSsrsLeaseContext} message AcquireSsrsLeaseContext + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + AcquireSsrsLeaseContext.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.setupLogin != null && message.hasOwnProperty("setupLogin")) { + object.setupLogin = message.setupLogin; + if (options.oneofs) + object._setupLogin = "setupLogin"; + } + if (message.serviceLogin != null && message.hasOwnProperty("serviceLogin")) { + object.serviceLogin = message.serviceLogin; + if (options.oneofs) + object._serviceLogin = "serviceLogin"; + } + if (message.reportDatabase != null && message.hasOwnProperty("reportDatabase")) { + object.reportDatabase = message.reportDatabase; + if (options.oneofs) + object._reportDatabase = "reportDatabase"; + } + if (message.duration != null && message.hasOwnProperty("duration")) { + object.duration = $root.google.protobuf.Duration.toObject(message.duration, options); + if (options.oneofs) + object._duration = "duration"; + } + return object; + }; + + /** + * Converts this AcquireSsrsLeaseContext to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @instance + * @returns {Object.} JSON object + */ + AcquireSsrsLeaseContext.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for AcquireSsrsLeaseContext + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + AcquireSsrsLeaseContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.AcquireSsrsLeaseContext"; + }; + + return AcquireSsrsLeaseContext; + })(); + + /** + * SqlFlagType enum. + * @name google.cloud.sql.v1beta4.SqlFlagType + * @enum {number} + * @property {number} SQL_FLAG_TYPE_UNSPECIFIED=0 SQL_FLAG_TYPE_UNSPECIFIED value + * @property {number} BOOLEAN=1 BOOLEAN value + * @property {number} STRING=2 STRING value + * @property {number} INTEGER=3 INTEGER value + * @property {number} NONE=4 NONE value + * @property {number} MYSQL_TIMEZONE_OFFSET=5 MYSQL_TIMEZONE_OFFSET value + * @property {number} FLOAT=6 FLOAT value + * @property {number} REPEATED_STRING=7 REPEATED_STRING value + */ + v1beta4.SqlFlagType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_FLAG_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "BOOLEAN"] = 1; + values[valuesById[2] = "STRING"] = 2; + values[valuesById[3] = "INTEGER"] = 3; + values[valuesById[4] = "NONE"] = 4; + values[valuesById[5] = "MYSQL_TIMEZONE_OFFSET"] = 5; + values[valuesById[6] = "FLOAT"] = 6; + values[valuesById[7] = "REPEATED_STRING"] = 7; + return values; + })(); + + /** + * SqlFlagScope enum. + * @name google.cloud.sql.v1beta4.SqlFlagScope + * @enum {number} + * @property {number} SQL_FLAG_SCOPE_UNSPECIFIED=0 SQL_FLAG_SCOPE_UNSPECIFIED value + * @property {number} SQL_FLAG_SCOPE_DATABASE=1 SQL_FLAG_SCOPE_DATABASE value + * @property {number} SQL_FLAG_SCOPE_CONNECTION_POOL=2 SQL_FLAG_SCOPE_CONNECTION_POOL value + */ + v1beta4.SqlFlagScope = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "SQL_FLAG_SCOPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "SQL_FLAG_SCOPE_DATABASE"] = 1; + values[valuesById[2] = "SQL_FLAG_SCOPE_CONNECTION_POOL"] = 2; + return values; + })(); + + v1beta4.SqlConnectService = (function() { + + /** + * Constructs a new SqlConnectService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlConnectService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlConnectService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlConnectService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlConnectService; + + /** + * Creates new SqlConnectService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlConnectService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlConnectService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlConnectService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlConnectService|getConnectSettings}. + * @memberof google.cloud.sql.v1beta4.SqlConnectService + * @typedef GetConnectSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.ConnectSettings} [response] ConnectSettings + */ + + /** + * Calls GetConnectSettings. + * @function getConnectSettings + * @memberof google.cloud.sql.v1beta4.SqlConnectService + * @instance + * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest} request GetConnectSettingsRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlConnectService.GetConnectSettingsCallback} callback Node-style callback called with the error, if any, and ConnectSettings + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlConnectService.prototype.getConnectSettings = function getConnectSettings(request, callback) { + return this.rpcCall(getConnectSettings, $root.google.cloud.sql.v1beta4.GetConnectSettingsRequest, $root.google.cloud.sql.v1beta4.ConnectSettings, request, callback); + }, "name", { value: "GetConnectSettings" }); + + /** + * Calls GetConnectSettings. + * @function getConnectSettings + * @memberof google.cloud.sql.v1beta4.SqlConnectService + * @instance + * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest} request GetConnectSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlConnectService|generateEphemeralCert}. + * @memberof google.cloud.sql.v1beta4.SqlConnectService + * @typedef GenerateEphemeralCertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} [response] GenerateEphemeralCertResponse + */ + + /** + * Calls GenerateEphemeralCert. + * @function generateEphemeralCert + * @memberof google.cloud.sql.v1beta4.SqlConnectService + * @instance + * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest} request GenerateEphemeralCertRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlConnectService.GenerateEphemeralCertCallback} callback Node-style callback called with the error, if any, and GenerateEphemeralCertResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlConnectService.prototype.generateEphemeralCert = function generateEphemeralCert(request, callback) { + return this.rpcCall(generateEphemeralCert, $root.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest, $root.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse, request, callback); + }, "name", { value: "GenerateEphemeralCert" }); + + /** + * Calls GenerateEphemeralCert. + * @function generateEphemeralCert + * @memberof google.cloud.sql.v1beta4.SqlConnectService + * @instance + * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest} request GenerateEphemeralCertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlConnectService; + })(); + + v1beta4.GetConnectSettingsRequest = (function() { + + /** + * Properties of a GetConnectSettingsRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IGetConnectSettingsRequest + * @property {string|null} [instance] GetConnectSettingsRequest instance + * @property {string|null} [project] GetConnectSettingsRequest project + * @property {google.protobuf.ITimestamp|null} [readTime] GetConnectSettingsRequest readTime + */ + + /** + * Constructs a new GetConnectSettingsRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a GetConnectSettingsRequest. + * @implements IGetConnectSettingsRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest=} [properties] Properties to set + */ + function GetConnectSettingsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetConnectSettingsRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @instance + */ + GetConnectSettingsRequest.prototype.instance = ""; + + /** + * GetConnectSettingsRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @instance + */ + GetConnectSettingsRequest.prototype.project = ""; + + /** + * GetConnectSettingsRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @instance + */ + GetConnectSettingsRequest.prototype.readTime = null; + + /** + * Creates a new GetConnectSettingsRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @static + * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.GetConnectSettingsRequest} GetConnectSettingsRequest instance + */ + GetConnectSettingsRequest.create = function create(properties) { + return new GetConnectSettingsRequest(properties); + }; + + /** + * Encodes the specified GetConnectSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GetConnectSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @static + * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest} message GetConnectSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConnectSettingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GetConnectSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GetConnectSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @static + * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest} message GetConnectSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetConnectSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetConnectSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.GetConnectSettingsRequest} GetConnectSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConnectSettingsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.GetConnectSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 7: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetConnectSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.GetConnectSettingsRequest} GetConnectSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetConnectSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetConnectSettingsRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetConnectSettingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.readTime != null && message.hasOwnProperty("readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime); + if (error) + return "readTime." + error; + } + return null; + }; + + /** + * Creates a GetConnectSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.GetConnectSettingsRequest} GetConnectSettingsRequest + */ + GetConnectSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.GetConnectSettingsRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.GetConnectSettingsRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.readTime != null) { + if (typeof object.readTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.GetConnectSettingsRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime); + } + return message; + }; + + /** + * Creates a plain object from a GetConnectSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @static + * @param {google.cloud.sql.v1beta4.GetConnectSettingsRequest} message GetConnectSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetConnectSettingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.readTime = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.readTime != null && message.hasOwnProperty("readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options); + return object; + }; + + /** + * Converts this GetConnectSettingsRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @instance + * @returns {Object.} JSON object + */ + GetConnectSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetConnectSettingsRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetConnectSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.GetConnectSettingsRequest"; + }; + + return GetConnectSettingsRequest; + })(); + + v1beta4.ConnectSettings = (function() { + + /** + * Properties of a ConnectSettings. + * @memberof google.cloud.sql.v1beta4 + * @interface IConnectSettings + * @property {string|null} [kind] ConnectSettings kind + * @property {google.cloud.sql.v1beta4.ISslCert|null} [serverCaCert] ConnectSettings serverCaCert + * @property {Array.|null} [ipAddresses] ConnectSettings ipAddresses + * @property {string|null} [region] ConnectSettings region + * @property {google.cloud.sql.v1beta4.SqlDatabaseVersion|null} [databaseVersion] ConnectSettings databaseVersion + * @property {google.cloud.sql.v1beta4.SqlBackendType|null} [backendType] ConnectSettings backendType + * @property {boolean|null} [pscEnabled] ConnectSettings pscEnabled + * @property {string|null} [dnsName] ConnectSettings dnsName + * @property {google.cloud.sql.v1beta4.ConnectSettings.CaMode|null} [serverCaMode] ConnectSettings serverCaMode + * @property {Array.|null} [customSubjectAlternativeNames] ConnectSettings customSubjectAlternativeNames + * @property {Array.|null} [dnsNames] ConnectSettings dnsNames + * @property {number|null} [nodeCount] ConnectSettings nodeCount + * @property {Array.|null} [nodes] ConnectSettings nodes + * @property {Array.|null} [mdxProtocolSupport] ConnectSettings mdxProtocolSupport + */ + + /** + * Constructs a new ConnectSettings. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a ConnectSettings. + * @implements IConnectSettings + * @constructor + * @param {google.cloud.sql.v1beta4.IConnectSettings=} [properties] Properties to set + */ + function ConnectSettings(properties) { + this.ipAddresses = []; + this.customSubjectAlternativeNames = []; + this.dnsNames = []; + this.nodes = []; + this.mdxProtocolSupport = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectSettings kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.kind = ""; + + /** + * ConnectSettings serverCaCert. + * @member {google.cloud.sql.v1beta4.ISslCert|null|undefined} serverCaCert + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.serverCaCert = null; + + /** + * ConnectSettings ipAddresses. + * @member {Array.} ipAddresses + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.ipAddresses = $util.emptyArray; + + /** + * ConnectSettings region. + * @member {string} region + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.region = ""; + + /** + * ConnectSettings databaseVersion. + * @member {google.cloud.sql.v1beta4.SqlDatabaseVersion} databaseVersion + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.databaseVersion = 0; + + /** + * ConnectSettings backendType. + * @member {google.cloud.sql.v1beta4.SqlBackendType} backendType + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.backendType = 0; + + /** + * ConnectSettings pscEnabled. + * @member {boolean} pscEnabled + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.pscEnabled = false; + + /** + * ConnectSettings dnsName. + * @member {string} dnsName + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.dnsName = ""; + + /** + * ConnectSettings serverCaMode. + * @member {google.cloud.sql.v1beta4.ConnectSettings.CaMode} serverCaMode + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.serverCaMode = 0; + + /** + * ConnectSettings customSubjectAlternativeNames. + * @member {Array.} customSubjectAlternativeNames + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.customSubjectAlternativeNames = $util.emptyArray; + + /** + * ConnectSettings dnsNames. + * @member {Array.} dnsNames + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.dnsNames = $util.emptyArray; + + /** + * ConnectSettings nodeCount. + * @member {number|null|undefined} nodeCount + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.nodeCount = null; + + /** + * ConnectSettings nodes. + * @member {Array.} nodes + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.nodes = $util.emptyArray; + + /** + * ConnectSettings mdxProtocolSupport. + * @member {Array.} mdxProtocolSupport + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + */ + ConnectSettings.prototype.mdxProtocolSupport = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ConnectSettings.prototype, "_nodeCount", { + get: $util.oneOfGetter($oneOfFields = ["nodeCount"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ConnectSettings instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @static + * @param {google.cloud.sql.v1beta4.IConnectSettings=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ConnectSettings} ConnectSettings instance + */ + ConnectSettings.create = function create(properties) { + return new ConnectSettings(properties); + }; + + /** + * Encodes the specified ConnectSettings message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @static + * @param {google.cloud.sql.v1beta4.IConnectSettings} message ConnectSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) + $root.google.cloud.sql.v1beta4.SslCert.encode(message.serverCaCert, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.ipAddresses != null && message.ipAddresses.length) + for (var i = 0; i < message.ipAddresses.length; ++i) + $root.google.cloud.sql.v1beta4.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.region); + if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) + writer.uint32(/* id 31, wireType 0 =*/248).int32(message.databaseVersion); + if (message.backendType != null && Object.hasOwnProperty.call(message, "backendType")) + writer.uint32(/* id 32, wireType 0 =*/256).int32(message.backendType); + if (message.pscEnabled != null && Object.hasOwnProperty.call(message, "pscEnabled")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.pscEnabled); + if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) + writer.uint32(/* id 34, wireType 2 =*/274).string(message.dnsName); + if (message.serverCaMode != null && Object.hasOwnProperty.call(message, "serverCaMode")) + writer.uint32(/* id 35, wireType 0 =*/280).int32(message.serverCaMode); + if (message.customSubjectAlternativeNames != null && message.customSubjectAlternativeNames.length) + for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.customSubjectAlternativeNames[i]); + if (message.dnsNames != null && message.dnsNames.length) + for (var i = 0; i < message.dnsNames.length; ++i) + $root.google.cloud.sql.v1beta4.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim(); + if (message.mdxProtocolSupport != null && message.mdxProtocolSupport.length) { + writer.uint32(/* id 39, wireType 2 =*/314).fork(); + for (var i = 0; i < message.mdxProtocolSupport.length; ++i) + writer.int32(message.mdxProtocolSupport[i]); + writer.ldelim(); + } + if (message.nodeCount != null && Object.hasOwnProperty.call(message, "nodeCount")) + writer.uint32(/* id 63, wireType 0 =*/504).int32(message.nodeCount); + if (message.nodes != null && message.nodes.length) + for (var i = 0; i < message.nodes.length; ++i) + $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.encode(message.nodes[i], writer.uint32(/* id 64, wireType 2 =*/514).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConnectSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @static + * @param {google.cloud.sql.v1beta4.IConnectSettings} message ConnectSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectSettings message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ConnectSettings} ConnectSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ConnectSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.ipAddresses && message.ipAddresses.length)) + message.ipAddresses = []; + message.ipAddresses.push($root.google.cloud.sql.v1beta4.IpMapping.decode(reader, reader.uint32())); + break; + } + case 4: { + message.region = reader.string(); + break; + } + case 31: { + message.databaseVersion = reader.int32(); + break; + } + case 32: { + message.backendType = reader.int32(); + break; + } + case 33: { + message.pscEnabled = reader.bool(); + break; + } + case 34: { + message.dnsName = reader.string(); + break; + } + case 35: { + message.serverCaMode = reader.int32(); + break; + } + case 37: { + if (!(message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length)) + message.customSubjectAlternativeNames = []; + message.customSubjectAlternativeNames.push(reader.string()); + break; + } + case 38: { + if (!(message.dnsNames && message.dnsNames.length)) + message.dnsNames = []; + message.dnsNames.push($root.google.cloud.sql.v1beta4.DnsNameMapping.decode(reader, reader.uint32())); + break; + } + case 63: { + message.nodeCount = reader.int32(); + break; + } + case 64: { + if (!(message.nodes && message.nodes.length)) + message.nodes = []; + message.nodes.push($root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.decode(reader, reader.uint32())); + break; + } + case 39: { + if (!(message.mdxProtocolSupport && message.mdxProtocolSupport.length)) + message.mdxProtocolSupport = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.mdxProtocolSupport.push(reader.int32()); + } else + message.mdxProtocolSupport.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ConnectSettings} ConnectSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectSettings message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { + var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.serverCaCert); + if (error) + return "serverCaCert." + error; + } + if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { + if (!Array.isArray(message.ipAddresses)) + return "ipAddresses: array expected"; + for (var i = 0; i < message.ipAddresses.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.IpMapping.verify(message.ipAddresses[i]); + if (error) + return "ipAddresses." + error; + } + } + if (message.region != null && message.hasOwnProperty("region")) + if (!$util.isString(message.region)) + return "region: string expected"; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + switch (message.databaseVersion) { + default: + return "databaseVersion: enum value expected"; + case 0: + case 2: + case 3: + case 5: + case 6: + case 20: + case 41: + case 85: + case 111: + case 132: + case 148: + case 174: + case 197: + case 213: + case 238: + case 239: + case 240: + case 241: + case 355: + case 357: + case 358: + case 488: + case 489: + case 553: + case 554: + case 555: + case 556: + case 398: + case 654: + case 11: + case 14: + case 15: + case 16: + case 9: + case 18: + case 10: + case 19: + case 23: + case 110: + case 172: + case 272: + case 408: + case 557: + case 26: + case 27: + case 28: + case 29: + case 199: + case 200: + case 201: + case 202: + break; + } + if (message.backendType != null && message.hasOwnProperty("backendType")) + switch (message.backendType) { + default: + return "backendType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) + if (typeof message.pscEnabled !== "boolean") + return "pscEnabled: boolean expected"; + if (message.dnsName != null && message.hasOwnProperty("dnsName")) + if (!$util.isString(message.dnsName)) + return "dnsName: string expected"; + if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) + switch (message.serverCaMode) { + default: + return "serverCaMode: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.customSubjectAlternativeNames != null && message.hasOwnProperty("customSubjectAlternativeNames")) { + if (!Array.isArray(message.customSubjectAlternativeNames)) + return "customSubjectAlternativeNames: array expected"; + for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) + if (!$util.isString(message.customSubjectAlternativeNames[i])) + return "customSubjectAlternativeNames: string[] expected"; + } + if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { + if (!Array.isArray(message.dnsNames)) + return "dnsNames: array expected"; + for (var i = 0; i < message.dnsNames.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.DnsNameMapping.verify(message.dnsNames[i]); + if (error) + return "dnsNames." + error; + } + } + if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { + properties._nodeCount = 1; + if (!$util.isInteger(message.nodeCount)) + return "nodeCount: integer expected"; + } + if (message.nodes != null && message.hasOwnProperty("nodes")) { + if (!Array.isArray(message.nodes)) + return "nodes: array expected"; + for (var i = 0; i < message.nodes.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.verify(message.nodes[i]); + if (error) + return "nodes." + error; + } + } + if (message.mdxProtocolSupport != null && message.hasOwnProperty("mdxProtocolSupport")) { + if (!Array.isArray(message.mdxProtocolSupport)) + return "mdxProtocolSupport: array expected"; + for (var i = 0; i < message.mdxProtocolSupport.length; ++i) + switch (message.mdxProtocolSupport[i]) { + default: + return "mdxProtocolSupport: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ConnectSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ConnectSettings} ConnectSettings + */ + ConnectSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ConnectSettings) + return object; + var message = new $root.google.cloud.sql.v1beta4.ConnectSettings(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.serverCaCert != null) { + if (typeof object.serverCaCert !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.serverCaCert: object expected"); + message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.serverCaCert); + } + if (object.ipAddresses) { + if (!Array.isArray(object.ipAddresses)) + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ipAddresses: array expected"); + message.ipAddresses = []; + for (var i = 0; i < object.ipAddresses.length; ++i) { + if (typeof object.ipAddresses[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ipAddresses: object expected"); + message.ipAddresses[i] = $root.google.cloud.sql.v1beta4.IpMapping.fromObject(object.ipAddresses[i]); + } + } + if (object.region != null) + message.region = String(object.region); + switch (object.databaseVersion) { + default: + if (typeof object.databaseVersion === "number") { + message.databaseVersion = object.databaseVersion; + break; + } + break; + case "SQL_DATABASE_VERSION_UNSPECIFIED": + case 0: + message.databaseVersion = 0; + break; + case "MYSQL_5_1": + case 2: + message.databaseVersion = 2; + break; + case "MYSQL_5_5": + case 3: + message.databaseVersion = 3; + break; + case "MYSQL_5_6": + case 5: + message.databaseVersion = 5; + break; + case "MYSQL_5_7": + case 6: + message.databaseVersion = 6; + break; + case "MYSQL_8_0": + case 20: + message.databaseVersion = 20; + break; + case "MYSQL_8_0_18": + case 41: + message.databaseVersion = 41; + break; + case "MYSQL_8_0_26": + case 85: + message.databaseVersion = 85; + break; + case "MYSQL_8_0_27": + case 111: + message.databaseVersion = 111; + break; + case "MYSQL_8_0_28": + case 132: + message.databaseVersion = 132; + break; + case "MYSQL_8_0_29": + case 148: + message.databaseVersion = 148; + break; + case "MYSQL_8_0_30": + case 174: + message.databaseVersion = 174; + break; + case "MYSQL_8_0_31": + case 197: + message.databaseVersion = 197; + break; + case "MYSQL_8_0_32": + case 213: + message.databaseVersion = 213; + break; + case "MYSQL_8_0_33": + case 238: + message.databaseVersion = 238; + break; + case "MYSQL_8_0_34": + case 239: + message.databaseVersion = 239; + break; + case "MYSQL_8_0_35": + case 240: + message.databaseVersion = 240; + break; + case "MYSQL_8_0_36": + case 241: + message.databaseVersion = 241; + break; + case "MYSQL_8_0_37": + case 355: + message.databaseVersion = 355; + break; + case "MYSQL_8_0_39": + case 357: + message.databaseVersion = 357; + break; + case "MYSQL_8_0_40": + case 358: + message.databaseVersion = 358; + break; + case "MYSQL_8_0_41": + case 488: + message.databaseVersion = 488; + break; + case "MYSQL_8_0_42": + case 489: + message.databaseVersion = 489; + break; + case "MYSQL_8_0_43": + case 553: + message.databaseVersion = 553; + break; + case "MYSQL_8_0_44": + case 554: + message.databaseVersion = 554; + break; + case "MYSQL_8_0_45": + case 555: + message.databaseVersion = 555; + break; + case "MYSQL_8_0_46": + case 556: + message.databaseVersion = 556; + break; + case "MYSQL_8_4": + case 398: + message.databaseVersion = 398; + break; + case "MYSQL_9_7": + case 654: + message.databaseVersion = 654; + break; + case "SQLSERVER_2017_STANDARD": + case 11: + message.databaseVersion = 11; + break; + case "SQLSERVER_2017_ENTERPRISE": + case 14: + message.databaseVersion = 14; + break; + case "SQLSERVER_2017_EXPRESS": + case 15: + message.databaseVersion = 15; + break; + case "SQLSERVER_2017_WEB": + case 16: + message.databaseVersion = 16; + break; + case "POSTGRES_9_6": + case 9: + message.databaseVersion = 9; + break; + case "POSTGRES_10": + case 18: + message.databaseVersion = 18; + break; + case "POSTGRES_11": + case 10: + message.databaseVersion = 10; + break; + case "POSTGRES_12": + case 19: + message.databaseVersion = 19; + break; + case "POSTGRES_13": + case 23: + message.databaseVersion = 23; + break; + case "POSTGRES_14": + case 110: + message.databaseVersion = 110; + break; + case "POSTGRES_15": + case 172: + message.databaseVersion = 172; + break; + case "POSTGRES_16": + case 272: + message.databaseVersion = 272; + break; + case "POSTGRES_17": + case 408: + message.databaseVersion = 408; + break; + case "POSTGRES_18": + case 557: + message.databaseVersion = 557; + break; + case "SQLSERVER_2019_STANDARD": + case 26: + message.databaseVersion = 26; + break; + case "SQLSERVER_2019_ENTERPRISE": + case 27: + message.databaseVersion = 27; + break; + case "SQLSERVER_2019_EXPRESS": + case 28: + message.databaseVersion = 28; + break; + case "SQLSERVER_2019_WEB": + case 29: + message.databaseVersion = 29; + break; + case "SQLSERVER_2022_STANDARD": + case 199: + message.databaseVersion = 199; + break; + case "SQLSERVER_2022_ENTERPRISE": + case 200: + message.databaseVersion = 200; + break; + case "SQLSERVER_2022_EXPRESS": + case 201: + message.databaseVersion = 201; + break; + case "SQLSERVER_2022_WEB": + case 202: + message.databaseVersion = 202; + break; + } + switch (object.backendType) { + default: + if (typeof object.backendType === "number") { + message.backendType = object.backendType; + break; + } + break; + case "SQL_BACKEND_TYPE_UNSPECIFIED": + case 0: + message.backendType = 0; + break; + case "FIRST_GEN": + case 1: + message.backendType = 1; + break; + case "SECOND_GEN": + case 2: + message.backendType = 2; + break; + case "EXTERNAL": + case 3: + message.backendType = 3; + break; + } + if (object.pscEnabled != null) + message.pscEnabled = Boolean(object.pscEnabled); + if (object.dnsName != null) + message.dnsName = String(object.dnsName); + switch (object.serverCaMode) { + default: + if (typeof object.serverCaMode === "number") { + message.serverCaMode = object.serverCaMode; + break; + } + break; + case "CA_MODE_UNSPECIFIED": + case 0: + message.serverCaMode = 0; + break; + case "GOOGLE_MANAGED_INTERNAL_CA": + case 1: + message.serverCaMode = 1; + break; + case "GOOGLE_MANAGED_CAS_CA": + case 2: + message.serverCaMode = 2; + break; + case "CUSTOMER_MANAGED_CAS_CA": + case 3: + message.serverCaMode = 3; + break; + } + if (object.customSubjectAlternativeNames) { + if (!Array.isArray(object.customSubjectAlternativeNames)) + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.customSubjectAlternativeNames: array expected"); + message.customSubjectAlternativeNames = []; + for (var i = 0; i < object.customSubjectAlternativeNames.length; ++i) + message.customSubjectAlternativeNames[i] = String(object.customSubjectAlternativeNames[i]); + } + if (object.dnsNames) { + if (!Array.isArray(object.dnsNames)) + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.dnsNames: array expected"); + message.dnsNames = []; + for (var i = 0; i < object.dnsNames.length; ++i) { + if (typeof object.dnsNames[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.dnsNames: object expected"); + message.dnsNames[i] = $root.google.cloud.sql.v1beta4.DnsNameMapping.fromObject(object.dnsNames[i]); + } + } + if (object.nodeCount != null) + message.nodeCount = object.nodeCount | 0; + if (object.nodes) { + if (!Array.isArray(object.nodes)) + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.nodes: array expected"); + message.nodes = []; + for (var i = 0; i < object.nodes.length; ++i) { + if (typeof object.nodes[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.nodes: object expected"); + message.nodes[i] = $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.fromObject(object.nodes[i]); + } + } + if (object.mdxProtocolSupport) { + if (!Array.isArray(object.mdxProtocolSupport)) + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.mdxProtocolSupport: array expected"); + message.mdxProtocolSupport = []; + for (var i = 0; i < object.mdxProtocolSupport.length; ++i) + switch (object.mdxProtocolSupport[i]) { + default: + if (typeof object.mdxProtocolSupport[i] === "number") { + message.mdxProtocolSupport[i] = object.mdxProtocolSupport[i]; + break; + } + case "MDX_PROTOCOL_SUPPORT_UNSPECIFIED": + case 0: + message.mdxProtocolSupport[i] = 0; + break; + case "CLIENT_PROTOCOL_TYPE": + case 1: + message.mdxProtocolSupport[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ConnectSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @static + * @param {google.cloud.sql.v1beta4.ConnectSettings} message ConnectSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.ipAddresses = []; + object.customSubjectAlternativeNames = []; + object.dnsNames = []; + object.mdxProtocolSupport = []; + object.nodes = []; + } + if (options.defaults) { + object.kind = ""; + object.serverCaCert = null; + object.region = ""; + object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; + object.backendType = options.enums === String ? "SQL_BACKEND_TYPE_UNSPECIFIED" : 0; + object.pscEnabled = false; + object.dnsName = ""; + object.serverCaMode = options.enums === String ? "CA_MODE_UNSPECIFIED" : 0; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) + object.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.serverCaCert, options); + if (message.ipAddresses && message.ipAddresses.length) { + object.ipAddresses = []; + for (var j = 0; j < message.ipAddresses.length; ++j) + object.ipAddresses[j] = $root.google.cloud.sql.v1beta4.IpMapping.toObject(message.ipAddresses[j], options); + } + if (message.region != null && message.hasOwnProperty("region")) + object.region = message.region; + if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) + object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; + if (message.backendType != null && message.hasOwnProperty("backendType")) + object.backendType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackendType[message.backendType] === undefined ? message.backendType : $root.google.cloud.sql.v1beta4.SqlBackendType[message.backendType] : message.backendType; + if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) + object.pscEnabled = message.pscEnabled; + if (message.dnsName != null && message.hasOwnProperty("dnsName")) + object.dnsName = message.dnsName; + if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) + object.serverCaMode = options.enums === String ? $root.google.cloud.sql.v1beta4.ConnectSettings.CaMode[message.serverCaMode] === undefined ? message.serverCaMode : $root.google.cloud.sql.v1beta4.ConnectSettings.CaMode[message.serverCaMode] : message.serverCaMode; + if (message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length) { + object.customSubjectAlternativeNames = []; + for (var j = 0; j < message.customSubjectAlternativeNames.length; ++j) + object.customSubjectAlternativeNames[j] = message.customSubjectAlternativeNames[j]; + } + if (message.dnsNames && message.dnsNames.length) { + object.dnsNames = []; + for (var j = 0; j < message.dnsNames.length; ++j) + object.dnsNames[j] = $root.google.cloud.sql.v1beta4.DnsNameMapping.toObject(message.dnsNames[j], options); + } + if (message.mdxProtocolSupport && message.mdxProtocolSupport.length) { + object.mdxProtocolSupport = []; + for (var j = 0; j < message.mdxProtocolSupport.length; ++j) + object.mdxProtocolSupport[j] = options.enums === String ? $root.google.cloud.sql.v1beta4.ConnectSettings.MdxProtocolSupport[message.mdxProtocolSupport[j]] === undefined ? message.mdxProtocolSupport[j] : $root.google.cloud.sql.v1beta4.ConnectSettings.MdxProtocolSupport[message.mdxProtocolSupport[j]] : message.mdxProtocolSupport[j]; + } + if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { + object.nodeCount = message.nodeCount; + if (options.oneofs) + object._nodeCount = "nodeCount"; + } + if (message.nodes && message.nodes.length) { + object.nodes = []; + for (var j = 0; j < message.nodes.length; ++j) + object.nodes[j] = $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.toObject(message.nodes[j], options); + } + return object; + }; + + /** + * Converts this ConnectSettings to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @instance + * @returns {Object.} JSON object + */ + ConnectSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConnectSettings + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConnectSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ConnectSettings"; + }; + + /** + * CaMode enum. + * @name google.cloud.sql.v1beta4.ConnectSettings.CaMode + * @enum {number} + * @property {number} CA_MODE_UNSPECIFIED=0 CA_MODE_UNSPECIFIED value + * @property {number} GOOGLE_MANAGED_INTERNAL_CA=1 GOOGLE_MANAGED_INTERNAL_CA value + * @property {number} GOOGLE_MANAGED_CAS_CA=2 GOOGLE_MANAGED_CAS_CA value + * @property {number} CUSTOMER_MANAGED_CAS_CA=3 CUSTOMER_MANAGED_CAS_CA value + */ + ConnectSettings.CaMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CA_MODE_UNSPECIFIED"] = 0; + values[valuesById[1] = "GOOGLE_MANAGED_INTERNAL_CA"] = 1; + values[valuesById[2] = "GOOGLE_MANAGED_CAS_CA"] = 2; + values[valuesById[3] = "CUSTOMER_MANAGED_CAS_CA"] = 3; + return values; + })(); + + ConnectSettings.ConnectPoolNodeConfig = (function() { + + /** + * Properties of a ConnectPoolNodeConfig. + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @interface IConnectPoolNodeConfig + * @property {string|null} [name] ConnectPoolNodeConfig name + * @property {Array.|null} [ipAddresses] ConnectPoolNodeConfig ipAddresses + * @property {string|null} [dnsName] ConnectPoolNodeConfig dnsName + * @property {Array.|null} [dnsNames] ConnectPoolNodeConfig dnsNames + */ + + /** + * Constructs a new ConnectPoolNodeConfig. + * @memberof google.cloud.sql.v1beta4.ConnectSettings + * @classdesc Represents a ConnectPoolNodeConfig. + * @implements IConnectPoolNodeConfig + * @constructor + * @param {google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig=} [properties] Properties to set + */ + function ConnectPoolNodeConfig(properties) { + this.ipAddresses = []; + this.dnsNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ConnectPoolNodeConfig name. + * @member {string|null|undefined} name + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @instance + */ + ConnectPoolNodeConfig.prototype.name = null; + + /** + * ConnectPoolNodeConfig ipAddresses. + * @member {Array.} ipAddresses + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @instance + */ + ConnectPoolNodeConfig.prototype.ipAddresses = $util.emptyArray; + + /** + * ConnectPoolNodeConfig dnsName. + * @member {string|null|undefined} dnsName + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @instance + */ + ConnectPoolNodeConfig.prototype.dnsName = null; + + /** + * ConnectPoolNodeConfig dnsNames. + * @member {Array.} dnsNames + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @instance + */ + ConnectPoolNodeConfig.prototype.dnsNames = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ConnectPoolNodeConfig.prototype, "_name", { + get: $util.oneOfGetter($oneOfFields = ["name"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(ConnectPoolNodeConfig.prototype, "_dnsName", { + get: $util.oneOfGetter($oneOfFields = ["dnsName"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new ConnectPoolNodeConfig instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig instance + */ + ConnectPoolNodeConfig.create = function create(properties) { + return new ConnectPoolNodeConfig(properties); + }; + + /** + * Encodes the specified ConnectPoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig} message ConnectPoolNodeConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectPoolNodeConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.ipAddresses != null && message.ipAddresses.length) + for (var i = 0; i < message.ipAddresses.length; ++i) + $root.google.cloud.sql.v1beta4.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dnsName); + if (message.dnsNames != null && message.dnsNames.length) + for (var i = 0; i < message.dnsNames.length; ++i) + $root.google.cloud.sql.v1beta4.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ConnectPoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig} message ConnectPoolNodeConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ConnectPoolNodeConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectPoolNodeConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.ipAddresses && message.ipAddresses.length)) + message.ipAddresses = []; + message.ipAddresses.push($root.google.cloud.sql.v1beta4.IpMapping.decode(reader, reader.uint32())); + break; + } + case 3: { + message.dnsName = reader.string(); + break; + } + case 4: { + if (!(message.dnsNames && message.dnsNames.length)) + message.dnsNames = []; + message.dnsNames.push($root.google.cloud.sql.v1beta4.DnsNameMapping.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ConnectPoolNodeConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ConnectPoolNodeConfig message. + * @function verify + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ConnectPoolNodeConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) { + properties._name = 1; + if (!$util.isString(message.name)) + return "name: string expected"; + } + if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { + if (!Array.isArray(message.ipAddresses)) + return "ipAddresses: array expected"; + for (var i = 0; i < message.ipAddresses.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.IpMapping.verify(message.ipAddresses[i]); + if (error) + return "ipAddresses." + error; + } + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + properties._dnsName = 1; + if (!$util.isString(message.dnsName)) + return "dnsName: string expected"; + } + if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { + if (!Array.isArray(message.dnsNames)) + return "dnsNames: array expected"; + for (var i = 0; i < message.dnsNames.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.DnsNameMapping.verify(message.dnsNames[i]); + if (error) + return "dnsNames." + error; + } + } + return null; + }; + + /** + * Creates a ConnectPoolNodeConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig + */ + ConnectPoolNodeConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig) + return object; + var message = new $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig(); + if (object.name != null) + message.name = String(object.name); + if (object.ipAddresses) { + if (!Array.isArray(object.ipAddresses)) + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.ipAddresses: array expected"); + message.ipAddresses = []; + for (var i = 0; i < object.ipAddresses.length; ++i) { + if (typeof object.ipAddresses[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.ipAddresses: object expected"); + message.ipAddresses[i] = $root.google.cloud.sql.v1beta4.IpMapping.fromObject(object.ipAddresses[i]); + } + } + if (object.dnsName != null) + message.dnsName = String(object.dnsName); + if (object.dnsNames) { + if (!Array.isArray(object.dnsNames)) + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.dnsNames: array expected"); + message.dnsNames = []; + for (var i = 0; i < object.dnsNames.length; ++i) { + if (typeof object.dnsNames[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.dnsNames: object expected"); + message.dnsNames[i] = $root.google.cloud.sql.v1beta4.DnsNameMapping.fromObject(object.dnsNames[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ConnectPoolNodeConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig} message ConnectPoolNodeConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ConnectPoolNodeConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.ipAddresses = []; + object.dnsNames = []; + } + if (message.name != null && message.hasOwnProperty("name")) { + object.name = message.name; + if (options.oneofs) + object._name = "name"; + } + if (message.ipAddresses && message.ipAddresses.length) { + object.ipAddresses = []; + for (var j = 0; j < message.ipAddresses.length; ++j) + object.ipAddresses[j] = $root.google.cloud.sql.v1beta4.IpMapping.toObject(message.ipAddresses[j], options); + } + if (message.dnsName != null && message.hasOwnProperty("dnsName")) { + object.dnsName = message.dnsName; + if (options.oneofs) + object._dnsName = "dnsName"; + } + if (message.dnsNames && message.dnsNames.length) { + object.dnsNames = []; + for (var j = 0; j < message.dnsNames.length; ++j) + object.dnsNames[j] = $root.google.cloud.sql.v1beta4.DnsNameMapping.toObject(message.dnsNames[j], options); + } + return object; + }; + + /** + * Converts this ConnectPoolNodeConfig to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @instance + * @returns {Object.} JSON object + */ + ConnectPoolNodeConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ConnectPoolNodeConfig + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ConnectPoolNodeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig"; + }; + + return ConnectPoolNodeConfig; + })(); + + /** + * MdxProtocolSupport enum. + * @name google.cloud.sql.v1beta4.ConnectSettings.MdxProtocolSupport + * @enum {number} + * @property {number} MDX_PROTOCOL_SUPPORT_UNSPECIFIED=0 MDX_PROTOCOL_SUPPORT_UNSPECIFIED value + * @property {number} CLIENT_PROTOCOL_TYPE=1 CLIENT_PROTOCOL_TYPE value + */ + ConnectSettings.MdxProtocolSupport = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MDX_PROTOCOL_SUPPORT_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLIENT_PROTOCOL_TYPE"] = 1; + return values; + })(); + + return ConnectSettings; + })(); + + v1beta4.GenerateEphemeralCertRequest = (function() { + + /** + * Properties of a GenerateEphemeralCertRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface IGenerateEphemeralCertRequest + * @property {string|null} [instance] GenerateEphemeralCertRequest instance + * @property {string|null} [project] GenerateEphemeralCertRequest project + * @property {string|null} [publicKey] GenerateEphemeralCertRequest publicKey + * @property {string|null} [accessToken] GenerateEphemeralCertRequest accessToken + * @property {google.protobuf.ITimestamp|null} [readTime] GenerateEphemeralCertRequest readTime + * @property {google.protobuf.IDuration|null} [validDuration] GenerateEphemeralCertRequest validDuration + */ + + /** + * Constructs a new GenerateEphemeralCertRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a GenerateEphemeralCertRequest. + * @implements IGenerateEphemeralCertRequest + * @constructor + * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest=} [properties] Properties to set + */ + function GenerateEphemeralCertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateEphemeralCertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.instance = ""; + + /** + * GenerateEphemeralCertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.project = ""; + + /** + * GenerateEphemeralCertRequest publicKey. + * @member {string} publicKey + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.publicKey = ""; + + /** + * GenerateEphemeralCertRequest accessToken. + * @member {string} accessToken + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.accessToken = ""; + + /** + * GenerateEphemeralCertRequest readTime. + * @member {google.protobuf.ITimestamp|null|undefined} readTime + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.readTime = null; + + /** + * GenerateEphemeralCertRequest validDuration. + * @member {google.protobuf.IDuration|null|undefined} validDuration + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @instance + */ + GenerateEphemeralCertRequest.prototype.validDuration = null; + + /** + * Creates a new GenerateEphemeralCertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest instance + */ + GenerateEphemeralCertRequest.create = function create(properties) { + return new GenerateEphemeralCertRequest(properties); + }; + + /** + * Encodes the specified GenerateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest} message GenerateEphemeralCertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateEphemeralCertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.publicKey); + if (message.accessToken != null && Object.hasOwnProperty.call(message, "accessToken")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.accessToken); + if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) + $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.validDuration != null && Object.hasOwnProperty.call(message, "validDuration")) + $root.google.protobuf.Duration.encode(message.validDuration, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest} message GenerateEphemeralCertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateEphemeralCertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateEphemeralCertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 3: { + message.publicKey = reader.string(); + break; + } + case 4: { + message.accessToken = reader.string(); + break; + } + case 7: { + message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 12: { + message.validDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateEphemeralCertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateEphemeralCertRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateEphemeralCertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + if (!$util.isString(message.publicKey)) + return "publicKey: string expected"; + if (message.accessToken != null && message.hasOwnProperty("accessToken")) + if (!$util.isString(message.accessToken)) + return "accessToken: string expected"; + if (message.readTime != null && message.hasOwnProperty("readTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.readTime); + if (error) + return "readTime." + error; + } + if (message.validDuration != null && message.hasOwnProperty("validDuration")) { + var error = $root.google.protobuf.Duration.verify(message.validDuration); + if (error) + return "validDuration." + error; + } + return null; + }; + + /** + * Creates a GenerateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest + */ + GenerateEphemeralCertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.publicKey != null) + message.publicKey = String(object.publicKey); + if (object.accessToken != null) + message.accessToken = String(object.accessToken); + if (object.readTime != null) { + if (typeof object.readTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.readTime: object expected"); + message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime); + } + if (object.validDuration != null) { + if (typeof object.validDuration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.validDuration: object expected"); + message.validDuration = $root.google.protobuf.Duration.fromObject(object.validDuration); + } + return message; + }; + + /** + * Creates a plain object from a GenerateEphemeralCertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @static + * @param {google.cloud.sql.v1beta4.GenerateEphemeralCertRequest} message GenerateEphemeralCertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateEphemeralCertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.publicKey = ""; + object.accessToken = ""; + object.readTime = null; + object.validDuration = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.publicKey != null && message.hasOwnProperty("publicKey")) + object.publicKey = message.publicKey; + if (message.accessToken != null && message.hasOwnProperty("accessToken")) + object.accessToken = message.accessToken; + if (message.readTime != null && message.hasOwnProperty("readTime")) + object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options); + if (message.validDuration != null && message.hasOwnProperty("validDuration")) + object.validDuration = $root.google.protobuf.Duration.toObject(message.validDuration, options); + return object; + }; + + /** + * Converts this GenerateEphemeralCertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @instance + * @returns {Object.} JSON object + */ + GenerateEphemeralCertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GenerateEphemeralCertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateEphemeralCertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.GenerateEphemeralCertRequest"; + }; + + return GenerateEphemeralCertRequest; + })(); + + v1beta4.GenerateEphemeralCertResponse = (function() { + + /** + * Properties of a GenerateEphemeralCertResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IGenerateEphemeralCertResponse + * @property {google.cloud.sql.v1beta4.ISslCert|null} [ephemeralCert] GenerateEphemeralCertResponse ephemeralCert + */ + + /** + * Constructs a new GenerateEphemeralCertResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a GenerateEphemeralCertResponse. + * @implements IGenerateEphemeralCertResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse=} [properties] Properties to set + */ + function GenerateEphemeralCertResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GenerateEphemeralCertResponse ephemeralCert. + * @member {google.cloud.sql.v1beta4.ISslCert|null|undefined} ephemeralCert + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @instance + */ + GenerateEphemeralCertResponse.prototype.ephemeralCert = null; + + /** + * Creates a new GenerateEphemeralCertResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @static + * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse instance + */ + GenerateEphemeralCertResponse.create = function create(properties) { + return new GenerateEphemeralCertResponse(properties); + }; + + /** + * Encodes the specified GenerateEphemeralCertResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @static + * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse} message GenerateEphemeralCertResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateEphemeralCertResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ephemeralCert != null && Object.hasOwnProperty.call(message, "ephemeralCert")) + $root.google.cloud.sql.v1beta4.SslCert.encode(message.ephemeralCert, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GenerateEphemeralCertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @static + * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse} message GenerateEphemeralCertResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GenerateEphemeralCertResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateEphemeralCertResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.ephemeralCert = $root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GenerateEphemeralCertResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GenerateEphemeralCertResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GenerateEphemeralCertResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ephemeralCert != null && message.hasOwnProperty("ephemeralCert")) { + var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.ephemeralCert); + if (error) + return "ephemeralCert." + error; + } + return null; + }; + + /** + * Creates a GenerateEphemeralCertResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse + */ + GenerateEphemeralCertResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse(); + if (object.ephemeralCert != null) { + if (typeof object.ephemeralCert !== "object") + throw TypeError(".google.cloud.sql.v1beta4.GenerateEphemeralCertResponse.ephemeralCert: object expected"); + message.ephemeralCert = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.ephemeralCert); + } + return message; + }; + + /** + * Creates a plain object from a GenerateEphemeralCertResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @static + * @param {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} message GenerateEphemeralCertResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GenerateEphemeralCertResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.ephemeralCert = null; + if (message.ephemeralCert != null && message.hasOwnProperty("ephemeralCert")) + object.ephemeralCert = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.ephemeralCert, options); + return object; + }; + + /** + * Converts this GenerateEphemeralCertResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @instance + * @returns {Object.} JSON object + */ + GenerateEphemeralCertResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GenerateEphemeralCertResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GenerateEphemeralCertResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.GenerateEphemeralCertResponse"; + }; + + return GenerateEphemeralCertResponse; + })(); + + v1beta4.SqlIamPoliciesService = (function() { + + /** + * Constructs a new SqlIamPoliciesService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlIamPoliciesService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlIamPoliciesService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlIamPoliciesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlIamPoliciesService; + + /** + * Creates new SqlIamPoliciesService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlIamPoliciesService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlIamPoliciesService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlIamPoliciesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + return SqlIamPoliciesService; + })(); + + v1beta4.SqlTiersService = (function() { + + /** + * Constructs a new SqlTiersService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlTiersService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlTiersService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlTiersService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlTiersService; + + /** + * Creates new SqlTiersService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlTiersService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlTiersService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlTiersService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlTiersService|list}. + * @memberof google.cloud.sql.v1beta4.SqlTiersService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.TiersListResponse} [response] TiersListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlTiersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest} request SqlTiersListRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlTiersService.ListCallback} callback Node-style callback called with the error, if any, and TiersListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlTiersService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlTiersListRequest, $root.google.cloud.sql.v1beta4.TiersListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlTiersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest} request SqlTiersListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlTiersService; + })(); + + v1beta4.SqlTiersListRequest = (function() { + + /** + * Properties of a SqlTiersListRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlTiersListRequest + * @property {string|null} [project] SqlTiersListRequest project + */ + + /** + * Constructs a new SqlTiersListRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlTiersListRequest. + * @implements ISqlTiersListRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest=} [properties] Properties to set + */ + function SqlTiersListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlTiersListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @instance + */ + SqlTiersListRequest.prototype.project = ""; + + /** + * Creates a new SqlTiersListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlTiersListRequest} SqlTiersListRequest instance + */ + SqlTiersListRequest.create = function create(properties) { + return new SqlTiersListRequest(properties); + }; + + /** + * Encodes the specified SqlTiersListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlTiersListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest} message SqlTiersListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTiersListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlTiersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlTiersListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest} message SqlTiersListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlTiersListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlTiersListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlTiersListRequest} SqlTiersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTiersListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlTiersListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlTiersListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlTiersListRequest} SqlTiersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlTiersListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlTiersListRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlTiersListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlTiersListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlTiersListRequest} SqlTiersListRequest + */ + SqlTiersListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlTiersListRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlTiersListRequest(); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlTiersListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlTiersListRequest} message SqlTiersListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlTiersListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.project = ""; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlTiersListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlTiersListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlTiersListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlTiersListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlTiersListRequest"; + }; + + return SqlTiersListRequest; + })(); + + v1beta4.TiersListResponse = (function() { + + /** + * Properties of a TiersListResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface ITiersListResponse + * @property {string|null} [kind] TiersListResponse kind + * @property {Array.|null} [items] TiersListResponse items + */ + + /** + * Constructs a new TiersListResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a TiersListResponse. + * @implements ITiersListResponse + * @constructor + * @param {google.cloud.sql.v1beta4.ITiersListResponse=} [properties] Properties to set + */ + function TiersListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TiersListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @instance + */ + TiersListResponse.prototype.kind = ""; + + /** + * TiersListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @instance + */ + TiersListResponse.prototype.items = $util.emptyArray; + + /** + * Creates a new TiersListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @static + * @param {google.cloud.sql.v1beta4.ITiersListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.TiersListResponse} TiersListResponse instance + */ + TiersListResponse.create = function create(properties) { + return new TiersListResponse(properties); + }; + + /** + * Encodes the specified TiersListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.TiersListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @static + * @param {google.cloud.sql.v1beta4.ITiersListResponse} message TiersListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TiersListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1beta4.Tier.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TiersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.TiersListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @static + * @param {google.cloud.sql.v1beta4.ITiersListResponse} message TiersListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TiersListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TiersListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.TiersListResponse} TiersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TiersListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.TiersListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1beta4.Tier.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TiersListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.TiersListResponse} TiersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TiersListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TiersListResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TiersListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.Tier.verify(message.items[i]); + if (error) + return "items." + error; + } + } + return null; + }; + + /** + * Creates a TiersListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.TiersListResponse} TiersListResponse + */ + TiersListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.TiersListResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.TiersListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1beta4.TiersListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.TiersListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1beta4.Tier.fromObject(object.items[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TiersListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @static + * @param {google.cloud.sql.v1beta4.TiersListResponse} message TiersListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TiersListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) + object.kind = ""; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1beta4.Tier.toObject(message.items[j], options); + } + return object; + }; + + /** + * Converts this TiersListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @instance + * @returns {Object.} JSON object + */ + TiersListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TiersListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.TiersListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TiersListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.TiersListResponse"; + }; + + return TiersListResponse; + })(); + + v1beta4.Tier = (function() { + + /** + * Properties of a Tier. + * @memberof google.cloud.sql.v1beta4 + * @interface ITier + * @property {string|null} [tier] Tier tier + * @property {number|Long|null} [RAM] Tier RAM + * @property {string|null} [kind] Tier kind + * @property {number|Long|null} [Disk_Quota] Tier Disk_Quota + * @property {Array.|null} [region] Tier region + */ + + /** + * Constructs a new Tier. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a Tier. + * @implements ITier + * @constructor + * @param {google.cloud.sql.v1beta4.ITier=} [properties] Properties to set + */ + function Tier(properties) { + this.region = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Tier tier. + * @member {string} tier + * @memberof google.cloud.sql.v1beta4.Tier + * @instance + */ + Tier.prototype.tier = ""; + + /** + * Tier RAM. + * @member {number|Long} RAM + * @memberof google.cloud.sql.v1beta4.Tier + * @instance + */ + Tier.prototype.RAM = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Tier kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.Tier + * @instance + */ + Tier.prototype.kind = ""; + + /** + * Tier Disk_Quota. + * @member {number|Long} Disk_Quota + * @memberof google.cloud.sql.v1beta4.Tier + * @instance + */ + Tier.prototype.Disk_Quota = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Tier region. + * @member {Array.} region + * @memberof google.cloud.sql.v1beta4.Tier + * @instance + */ + Tier.prototype.region = $util.emptyArray; + + /** + * Creates a new Tier instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.Tier + * @static + * @param {google.cloud.sql.v1beta4.ITier=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.Tier} Tier instance + */ + Tier.create = function create(properties) { + return new Tier(properties); + }; + + /** + * Encodes the specified Tier message. Does not implicitly {@link google.cloud.sql.v1beta4.Tier.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.Tier + * @static + * @param {google.cloud.sql.v1beta4.ITier} message Tier message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Tier.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.tier != null && Object.hasOwnProperty.call(message, "tier")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.tier); + if (message.RAM != null && Object.hasOwnProperty.call(message, "RAM")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.RAM); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); + if (message.Disk_Quota != null && Object.hasOwnProperty.call(message, "Disk_Quota")) + writer.uint32(/* id 4, wireType 0 =*/32).int64(message.Disk_Quota); + if (message.region != null && message.region.length) + for (var i = 0; i < message.region.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.region[i]); + return writer; + }; + + /** + * Encodes the specified Tier message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Tier.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.Tier + * @static + * @param {google.cloud.sql.v1beta4.ITier} message Tier message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Tier.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Tier message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.Tier + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.Tier} Tier + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Tier.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Tier(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.tier = reader.string(); + break; + } + case 2: { + message.RAM = reader.int64(); + break; + } + case 3: { + message.kind = reader.string(); + break; + } + case 4: { + message.Disk_Quota = reader.int64(); + break; + } + case 5: { + if (!(message.region && message.region.length)) + message.region = []; + message.region.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Tier message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.Tier + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.Tier} Tier + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Tier.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Tier message. + * @function verify + * @memberof google.cloud.sql.v1beta4.Tier + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Tier.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.tier != null && message.hasOwnProperty("tier")) + if (!$util.isString(message.tier)) + return "tier: string expected"; + if (message.RAM != null && message.hasOwnProperty("RAM")) + if (!$util.isInteger(message.RAM) && !(message.RAM && $util.isInteger(message.RAM.low) && $util.isInteger(message.RAM.high))) + return "RAM: integer|Long expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.Disk_Quota != null && message.hasOwnProperty("Disk_Quota")) + if (!$util.isInteger(message.Disk_Quota) && !(message.Disk_Quota && $util.isInteger(message.Disk_Quota.low) && $util.isInteger(message.Disk_Quota.high))) + return "Disk_Quota: integer|Long expected"; + if (message.region != null && message.hasOwnProperty("region")) { + if (!Array.isArray(message.region)) + return "region: array expected"; + for (var i = 0; i < message.region.length; ++i) + if (!$util.isString(message.region[i])) + return "region: string[] expected"; + } + return null; + }; + + /** + * Creates a Tier message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.Tier + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.Tier} Tier + */ + Tier.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.Tier) + return object; + var message = new $root.google.cloud.sql.v1beta4.Tier(); + if (object.tier != null) + message.tier = String(object.tier); + if (object.RAM != null) + if ($util.Long) + (message.RAM = $util.Long.fromValue(object.RAM)).unsigned = false; + else if (typeof object.RAM === "string") + message.RAM = parseInt(object.RAM, 10); + else if (typeof object.RAM === "number") + message.RAM = object.RAM; + else if (typeof object.RAM === "object") + message.RAM = new $util.LongBits(object.RAM.low >>> 0, object.RAM.high >>> 0).toNumber(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.Disk_Quota != null) + if ($util.Long) + (message.Disk_Quota = $util.Long.fromValue(object.Disk_Quota)).unsigned = false; + else if (typeof object.Disk_Quota === "string") + message.Disk_Quota = parseInt(object.Disk_Quota, 10); + else if (typeof object.Disk_Quota === "number") + message.Disk_Quota = object.Disk_Quota; + else if (typeof object.Disk_Quota === "object") + message.Disk_Quota = new $util.LongBits(object.Disk_Quota.low >>> 0, object.Disk_Quota.high >>> 0).toNumber(); + if (object.region) { + if (!Array.isArray(object.region)) + throw TypeError(".google.cloud.sql.v1beta4.Tier.region: array expected"); + message.region = []; + for (var i = 0; i < object.region.length; ++i) + message.region[i] = String(object.region[i]); + } + return message; + }; + + /** + * Creates a plain object from a Tier message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.Tier + * @static + * @param {google.cloud.sql.v1beta4.Tier} message Tier + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Tier.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.region = []; + if (options.defaults) { + object.tier = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.RAM = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.RAM = options.longs === String ? "0" : 0; + object.kind = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.Disk_Quota = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.Disk_Quota = options.longs === String ? "0" : 0; + } + if (message.tier != null && message.hasOwnProperty("tier")) + object.tier = message.tier; + if (message.RAM != null && message.hasOwnProperty("RAM")) + if (typeof message.RAM === "number") + object.RAM = options.longs === String ? String(message.RAM) : message.RAM; + else + object.RAM = options.longs === String ? $util.Long.prototype.toString.call(message.RAM) : options.longs === Number ? new $util.LongBits(message.RAM.low >>> 0, message.RAM.high >>> 0).toNumber() : message.RAM; + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.Disk_Quota != null && message.hasOwnProperty("Disk_Quota")) + if (typeof message.Disk_Quota === "number") + object.Disk_Quota = options.longs === String ? String(message.Disk_Quota) : message.Disk_Quota; + else + object.Disk_Quota = options.longs === String ? $util.Long.prototype.toString.call(message.Disk_Quota) : options.longs === Number ? new $util.LongBits(message.Disk_Quota.low >>> 0, message.Disk_Quota.high >>> 0).toNumber() : message.Disk_Quota; + if (message.region && message.region.length) { + object.region = []; + for (var j = 0; j < message.region.length; ++j) + object.region[j] = message.region[j]; + } + return object; + }; + + /** + * Converts this Tier to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.Tier + * @instance + * @returns {Object.} JSON object + */ + Tier.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Tier + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.Tier + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Tier.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.Tier"; + }; + + return Tier; + })(); + + v1beta4.SqlUsersService = (function() { + + /** + * Constructs a new SqlUsersService service. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlUsersService + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function SqlUsersService(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (SqlUsersService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlUsersService; + + /** + * Creates new SqlUsersService service using the specified rpc implementation. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {SqlUsersService} RPC service. Useful where requests and/or responses are streamed. + */ + SqlUsersService.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|delete_}. + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @typedef DeleteCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest} request SqlUsersDeleteRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlUsersService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlUsersService.prototype["delete"] = function delete_(request, callback) { + return this.rpcCall(delete_, $root.google.cloud.sql.v1beta4.SqlUsersDeleteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Delete" }); + + /** + * Calls Delete. + * @function delete + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest} request SqlUsersDeleteRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|get}. + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @typedef GetCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.User} [response] User + */ + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest} request SqlUsersGetRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlUsersService.GetCallback} callback Node-style callback called with the error, if any, and User + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlUsersService.prototype.get = function get(request, callback) { + return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlUsersGetRequest, $root.google.cloud.sql.v1beta4.User, request, callback); + }, "name", { value: "Get" }); + + /** + * Calls Get. + * @function get + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest} request SqlUsersGetRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|insert}. + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @typedef InsertCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest} request SqlUsersInsertRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlUsersService.InsertCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlUsersService.prototype.insert = function insert(request, callback) { + return this.rpcCall(insert, $root.google.cloud.sql.v1beta4.SqlUsersInsertRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Insert" }); + + /** + * Calls Insert. + * @function insert + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest} request SqlUsersInsertRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|list}. + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @typedef ListCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.UsersListResponse} [response] UsersListResponse + */ + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest} request SqlUsersListRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlUsersService.ListCallback} callback Node-style callback called with the error, if any, and UsersListResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlUsersService.prototype.list = function list(request, callback) { + return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlUsersListRequest, $root.google.cloud.sql.v1beta4.UsersListResponse, request, callback); + }, "name", { value: "List" }); + + /** + * Calls List. + * @function list + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest} request SqlUsersListRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|update}. + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @typedef UpdateCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.cloud.sql.v1beta4.Operation} [response] Operation + */ + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest} request SqlUsersUpdateRequest message or plain object + * @param {google.cloud.sql.v1beta4.SqlUsersService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(SqlUsersService.prototype.update = function update(request, callback) { + return this.rpcCall(update, $root.google.cloud.sql.v1beta4.SqlUsersUpdateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); + }, "name", { value: "Update" }); + + /** + * Calls Update. + * @function update + * @memberof google.cloud.sql.v1beta4.SqlUsersService + * @instance + * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest} request SqlUsersUpdateRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return SqlUsersService; + })(); + + v1beta4.SqlUsersDeleteRequest = (function() { + + /** + * Properties of a SqlUsersDeleteRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlUsersDeleteRequest + * @property {string|null} [host] SqlUsersDeleteRequest host + * @property {string|null} [instance] SqlUsersDeleteRequest instance + * @property {string|null} [name] SqlUsersDeleteRequest name + * @property {string|null} [project] SqlUsersDeleteRequest project + */ + + /** + * Constructs a new SqlUsersDeleteRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlUsersDeleteRequest. + * @implements ISqlUsersDeleteRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest=} [properties] Properties to set + */ + function SqlUsersDeleteRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlUsersDeleteRequest host. + * @member {string} host + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @instance + */ + SqlUsersDeleteRequest.prototype.host = ""; + + /** + * SqlUsersDeleteRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @instance + */ + SqlUsersDeleteRequest.prototype.instance = ""; + + /** + * SqlUsersDeleteRequest name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @instance + */ + SqlUsersDeleteRequest.prototype.name = ""; + + /** + * SqlUsersDeleteRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @instance + */ + SqlUsersDeleteRequest.prototype.project = ""; + + /** + * Creates a new SqlUsersDeleteRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlUsersDeleteRequest} SqlUsersDeleteRequest instance + */ + SqlUsersDeleteRequest.create = function create(properties) { + return new SqlUsersDeleteRequest(properties); + }; + + /** + * Encodes the specified SqlUsersDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersDeleteRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest} message SqlUsersDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersDeleteRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.host != null && Object.hasOwnProperty.call(message, "host")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.host); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlUsersDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersDeleteRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest} message SqlUsersDeleteRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlUsersDeleteRequest} SqlUsersDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersDeleteRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.host = reader.string(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.name = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlUsersDeleteRequest} SqlUsersDeleteRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersDeleteRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlUsersDeleteRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlUsersDeleteRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.host != null && message.hasOwnProperty("host")) + if (!$util.isString(message.host)) + return "host: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlUsersDeleteRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlUsersDeleteRequest} SqlUsersDeleteRequest + */ + SqlUsersDeleteRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlUsersDeleteRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(); + if (object.host != null) + message.host = String(object.host); + if (object.instance != null) + message.instance = String(object.instance); + if (object.name != null) + message.name = String(object.name); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlUsersDeleteRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlUsersDeleteRequest} message SqlUsersDeleteRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlUsersDeleteRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.host = ""; + object.instance = ""; + object.name = ""; + object.project = ""; + } + if (message.host != null && message.hasOwnProperty("host")) + object.host = message.host; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlUsersDeleteRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @instance + * @returns {Object.} JSON object + */ + SqlUsersDeleteRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlUsersDeleteRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlUsersDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlUsersDeleteRequest"; + }; + + return SqlUsersDeleteRequest; + })(); + + v1beta4.SqlUsersGetRequest = (function() { + + /** + * Properties of a SqlUsersGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlUsersGetRequest + * @property {string|null} [instance] SqlUsersGetRequest instance + * @property {string|null} [name] SqlUsersGetRequest name + * @property {string|null} [project] SqlUsersGetRequest project + * @property {string|null} [host] SqlUsersGetRequest host + */ + + /** + * Constructs a new SqlUsersGetRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlUsersGetRequest. + * @implements ISqlUsersGetRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest=} [properties] Properties to set + */ + function SqlUsersGetRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlUsersGetRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @instance + */ + SqlUsersGetRequest.prototype.instance = ""; + + /** + * SqlUsersGetRequest name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @instance + */ + SqlUsersGetRequest.prototype.name = ""; + + /** + * SqlUsersGetRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @instance + */ + SqlUsersGetRequest.prototype.project = ""; + + /** + * SqlUsersGetRequest host. + * @member {string} host + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @instance + */ + SqlUsersGetRequest.prototype.host = ""; + + /** + * Creates a new SqlUsersGetRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlUsersGetRequest} SqlUsersGetRequest instance + */ + SqlUsersGetRequest.create = function create(properties) { + return new SqlUsersGetRequest(properties); + }; + + /** + * Encodes the specified SqlUsersGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersGetRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest} message SqlUsersGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersGetRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); + if (message.host != null && Object.hasOwnProperty.call(message, "host")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.host); + return writer; + }; + + /** + * Encodes the specified SqlUsersGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersGetRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest} message SqlUsersGetRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersGetRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlUsersGetRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlUsersGetRequest} SqlUsersGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersGetRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlUsersGetRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.name = reader.string(); + break; + } + case 3: { + message.project = reader.string(); + break; + } + case 4: { + message.host = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlUsersGetRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlUsersGetRequest} SqlUsersGetRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersGetRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlUsersGetRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlUsersGetRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.host != null && message.hasOwnProperty("host")) + if (!$util.isString(message.host)) + return "host: string expected"; + return null; + }; + + /** + * Creates a SqlUsersGetRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlUsersGetRequest} SqlUsersGetRequest + */ + SqlUsersGetRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlUsersGetRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlUsersGetRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.name != null) + message.name = String(object.name); + if (object.project != null) + message.project = String(object.project); + if (object.host != null) + message.host = String(object.host); + return message; + }; + + /** + * Creates a plain object from a SqlUsersGetRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlUsersGetRequest} message SqlUsersGetRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlUsersGetRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.name = ""; + object.project = ""; + object.host = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.host != null && message.hasOwnProperty("host")) + object.host = message.host; + return object; + }; + + /** + * Converts this SqlUsersGetRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @instance + * @returns {Object.} JSON object + */ + SqlUsersGetRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlUsersGetRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlUsersGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlUsersGetRequest"; + }; + + return SqlUsersGetRequest; + })(); + + v1beta4.SqlUsersInsertRequest = (function() { + + /** + * Properties of a SqlUsersInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlUsersInsertRequest + * @property {string|null} [instance] SqlUsersInsertRequest instance + * @property {string|null} [project] SqlUsersInsertRequest project + * @property {google.cloud.sql.v1beta4.IUser|null} [body] SqlUsersInsertRequest body + */ + + /** + * Constructs a new SqlUsersInsertRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlUsersInsertRequest. + * @implements ISqlUsersInsertRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest=} [properties] Properties to set + */ + function SqlUsersInsertRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlUsersInsertRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @instance + */ + SqlUsersInsertRequest.prototype.instance = ""; + + /** + * SqlUsersInsertRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @instance + */ + SqlUsersInsertRequest.prototype.project = ""; + + /** + * SqlUsersInsertRequest body. + * @member {google.cloud.sql.v1beta4.IUser|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @instance + */ + SqlUsersInsertRequest.prototype.body = null; + + /** + * Creates a new SqlUsersInsertRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlUsersInsertRequest} SqlUsersInsertRequest instance + */ + SqlUsersInsertRequest.create = function create(properties) { + return new SqlUsersInsertRequest(properties); + }; + + /** + * Encodes the specified SqlUsersInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersInsertRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest} message SqlUsersInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersInsertRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.User.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlUsersInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersInsertRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest} message SqlUsersInsertRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlUsersInsertRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlUsersInsertRequest} SqlUsersInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersInsertRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlUsersInsertRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.User.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlUsersInsertRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlUsersInsertRequest} SqlUsersInsertRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersInsertRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlUsersInsertRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlUsersInsertRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.User.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlUsersInsertRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlUsersInsertRequest} SqlUsersInsertRequest + */ + SqlUsersInsertRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlUsersInsertRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlUsersInsertRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlUsersInsertRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.User.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlUsersInsertRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlUsersInsertRequest} message SqlUsersInsertRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlUsersInsertRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + object.body = null; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.User.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlUsersInsertRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @instance + * @returns {Object.} JSON object + */ + SqlUsersInsertRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlUsersInsertRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlUsersInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlUsersInsertRequest"; + }; + + return SqlUsersInsertRequest; + })(); + + v1beta4.SqlUsersListRequest = (function() { + + /** + * Properties of a SqlUsersListRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlUsersListRequest + * @property {string|null} [instance] SqlUsersListRequest instance + * @property {string|null} [project] SqlUsersListRequest project + */ + + /** + * Constructs a new SqlUsersListRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlUsersListRequest. + * @implements ISqlUsersListRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest=} [properties] Properties to set + */ + function SqlUsersListRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlUsersListRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @instance + */ + SqlUsersListRequest.prototype.instance = ""; + + /** + * SqlUsersListRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @instance + */ + SqlUsersListRequest.prototype.project = ""; + + /** + * Creates a new SqlUsersListRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlUsersListRequest} SqlUsersListRequest instance + */ + SqlUsersListRequest.create = function create(properties) { + return new SqlUsersListRequest(properties); + }; + + /** + * Encodes the specified SqlUsersListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersListRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest} message SqlUsersListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersListRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); + return writer; + }; + + /** + * Encodes the specified SqlUsersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersListRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest} message SqlUsersListRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersListRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlUsersListRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlUsersListRequest} SqlUsersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersListRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlUsersListRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.instance = reader.string(); + break; + } + case 2: { + message.project = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlUsersListRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlUsersListRequest} SqlUsersListRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersListRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlUsersListRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlUsersListRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + return null; + }; + + /** + * Creates a SqlUsersListRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlUsersListRequest} SqlUsersListRequest + */ + SqlUsersListRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlUsersListRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlUsersListRequest(); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + return message; + }; + + /** + * Creates a plain object from a SqlUsersListRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlUsersListRequest} message SqlUsersListRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlUsersListRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.instance = ""; + object.project = ""; + } + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + return object; + }; + + /** + * Converts this SqlUsersListRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @instance + * @returns {Object.} JSON object + */ + SqlUsersListRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlUsersListRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlUsersListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlUsersListRequest"; + }; + + return SqlUsersListRequest; + })(); + + v1beta4.SqlUsersUpdateRequest = (function() { + + /** + * Properties of a SqlUsersUpdateRequest. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlUsersUpdateRequest + * @property {string|null} [host] SqlUsersUpdateRequest host + * @property {string|null} [instance] SqlUsersUpdateRequest instance + * @property {string|null} [name] SqlUsersUpdateRequest name + * @property {string|null} [project] SqlUsersUpdateRequest project + * @property {Array.|null} [databaseRoles] SqlUsersUpdateRequest databaseRoles + * @property {boolean|null} [revokeExistingRoles] SqlUsersUpdateRequest revokeExistingRoles + * @property {google.cloud.sql.v1beta4.IUser|null} [body] SqlUsersUpdateRequest body + */ + + /** + * Constructs a new SqlUsersUpdateRequest. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlUsersUpdateRequest. + * @implements ISqlUsersUpdateRequest + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest=} [properties] Properties to set + */ + function SqlUsersUpdateRequest(properties) { + this.databaseRoles = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlUsersUpdateRequest host. + * @member {string} host + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.host = ""; + + /** + * SqlUsersUpdateRequest instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.instance = ""; + + /** + * SqlUsersUpdateRequest name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.name = ""; + + /** + * SqlUsersUpdateRequest project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.project = ""; + + /** + * SqlUsersUpdateRequest databaseRoles. + * @member {Array.} databaseRoles + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.databaseRoles = $util.emptyArray; + + /** + * SqlUsersUpdateRequest revokeExistingRoles. + * @member {boolean|null|undefined} revokeExistingRoles + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.revokeExistingRoles = null; + + /** + * SqlUsersUpdateRequest body. + * @member {google.cloud.sql.v1beta4.IUser|null|undefined} body + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @instance + */ + SqlUsersUpdateRequest.prototype.body = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + // Virtual OneOf for proto3 optional field + Object.defineProperty(SqlUsersUpdateRequest.prototype, "_revokeExistingRoles", { + get: $util.oneOfGetter($oneOfFields = ["revokeExistingRoles"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new SqlUsersUpdateRequest instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlUsersUpdateRequest} SqlUsersUpdateRequest instance + */ + SqlUsersUpdateRequest.create = function create(properties) { + return new SqlUsersUpdateRequest(properties); + }; + + /** + * Encodes the specified SqlUsersUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersUpdateRequest.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest} message SqlUsersUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersUpdateRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.host != null && Object.hasOwnProperty.call(message, "host")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.host); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); + if (message.databaseRoles != null && message.databaseRoles.length) + for (var i = 0; i < message.databaseRoles.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.databaseRoles[i]); + if (message.revokeExistingRoles != null && Object.hasOwnProperty.call(message, "revokeExistingRoles")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.revokeExistingRoles); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + $root.google.cloud.sql.v1beta4.User.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SqlUsersUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersUpdateRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest} message SqlUsersUpdateRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlUsersUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlUsersUpdateRequest} SqlUsersUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersUpdateRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.host = reader.string(); + break; + } + case 2: { + message.instance = reader.string(); + break; + } + case 3: { + message.name = reader.string(); + break; + } + case 4: { + message.project = reader.string(); + break; + } + case 5: { + if (!(message.databaseRoles && message.databaseRoles.length)) + message.databaseRoles = []; + message.databaseRoles.push(reader.string()); + break; + } + case 6: { + message.revokeExistingRoles = reader.bool(); + break; + } + case 100: { + message.body = $root.google.cloud.sql.v1beta4.User.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlUsersUpdateRequest} SqlUsersUpdateRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlUsersUpdateRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlUsersUpdateRequest message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlUsersUpdateRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.host != null && message.hasOwnProperty("host")) + if (!$util.isString(message.host)) + return "host: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.databaseRoles != null && message.hasOwnProperty("databaseRoles")) { + if (!Array.isArray(message.databaseRoles)) + return "databaseRoles: array expected"; + for (var i = 0; i < message.databaseRoles.length; ++i) + if (!$util.isString(message.databaseRoles[i])) + return "databaseRoles: string[] expected"; + } + if (message.revokeExistingRoles != null && message.hasOwnProperty("revokeExistingRoles")) { + properties._revokeExistingRoles = 1; + if (typeof message.revokeExistingRoles !== "boolean") + return "revokeExistingRoles: boolean expected"; + } + if (message.body != null && message.hasOwnProperty("body")) { + var error = $root.google.cloud.sql.v1beta4.User.verify(message.body); + if (error) + return "body." + error; + } + return null; + }; + + /** + * Creates a SqlUsersUpdateRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlUsersUpdateRequest} SqlUsersUpdateRequest + */ + SqlUsersUpdateRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlUsersUpdateRequest) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(); + if (object.host != null) + message.host = String(object.host); + if (object.instance != null) + message.instance = String(object.instance); + if (object.name != null) + message.name = String(object.name); + if (object.project != null) + message.project = String(object.project); + if (object.databaseRoles) { + if (!Array.isArray(object.databaseRoles)) + throw TypeError(".google.cloud.sql.v1beta4.SqlUsersUpdateRequest.databaseRoles: array expected"); + message.databaseRoles = []; + for (var i = 0; i < object.databaseRoles.length; ++i) + message.databaseRoles[i] = String(object.databaseRoles[i]); + } + if (object.revokeExistingRoles != null) + message.revokeExistingRoles = Boolean(object.revokeExistingRoles); + if (object.body != null) { + if (typeof object.body !== "object") + throw TypeError(".google.cloud.sql.v1beta4.SqlUsersUpdateRequest.body: object expected"); + message.body = $root.google.cloud.sql.v1beta4.User.fromObject(object.body); + } + return message; + }; + + /** + * Creates a plain object from a SqlUsersUpdateRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @static + * @param {google.cloud.sql.v1beta4.SqlUsersUpdateRequest} message SqlUsersUpdateRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlUsersUpdateRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.databaseRoles = []; + if (options.defaults) { + object.host = ""; + object.instance = ""; + object.name = ""; + object.project = ""; + object.body = null; + } + if (message.host != null && message.hasOwnProperty("host")) + object.host = message.host; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.databaseRoles && message.databaseRoles.length) { + object.databaseRoles = []; + for (var j = 0; j < message.databaseRoles.length; ++j) + object.databaseRoles[j] = message.databaseRoles[j]; + } + if (message.revokeExistingRoles != null && message.hasOwnProperty("revokeExistingRoles")) { + object.revokeExistingRoles = message.revokeExistingRoles; + if (options.oneofs) + object._revokeExistingRoles = "revokeExistingRoles"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = $root.google.cloud.sql.v1beta4.User.toObject(message.body, options); + return object; + }; + + /** + * Converts this SqlUsersUpdateRequest to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @instance + * @returns {Object.} JSON object + */ + SqlUsersUpdateRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlUsersUpdateRequest + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlUsersUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlUsersUpdateRequest"; + }; + + return SqlUsersUpdateRequest; + })(); + + v1beta4.UserPasswordValidationPolicy = (function() { + + /** + * Properties of a UserPasswordValidationPolicy. + * @memberof google.cloud.sql.v1beta4 + * @interface IUserPasswordValidationPolicy + * @property {number|null} [allowedFailedAttempts] UserPasswordValidationPolicy allowedFailedAttempts + * @property {google.protobuf.IDuration|null} [passwordExpirationDuration] UserPasswordValidationPolicy passwordExpirationDuration + * @property {boolean|null} [enableFailedAttemptsCheck] UserPasswordValidationPolicy enableFailedAttemptsCheck + * @property {google.cloud.sql.v1beta4.IPasswordStatus|null} [status] UserPasswordValidationPolicy status + * @property {boolean|null} [enablePasswordVerification] UserPasswordValidationPolicy enablePasswordVerification + */ + + /** + * Constructs a new UserPasswordValidationPolicy. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a UserPasswordValidationPolicy. + * @implements IUserPasswordValidationPolicy + * @constructor + * @param {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy=} [properties] Properties to set + */ + function UserPasswordValidationPolicy(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UserPasswordValidationPolicy allowedFailedAttempts. + * @member {number} allowedFailedAttempts + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @instance + */ + UserPasswordValidationPolicy.prototype.allowedFailedAttempts = 0; + + /** + * UserPasswordValidationPolicy passwordExpirationDuration. + * @member {google.protobuf.IDuration|null|undefined} passwordExpirationDuration + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @instance + */ + UserPasswordValidationPolicy.prototype.passwordExpirationDuration = null; + + /** + * UserPasswordValidationPolicy enableFailedAttemptsCheck. + * @member {boolean} enableFailedAttemptsCheck + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @instance + */ + UserPasswordValidationPolicy.prototype.enableFailedAttemptsCheck = false; + + /** + * UserPasswordValidationPolicy status. + * @member {google.cloud.sql.v1beta4.IPasswordStatus|null|undefined} status + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @instance + */ + UserPasswordValidationPolicy.prototype.status = null; + + /** + * UserPasswordValidationPolicy enablePasswordVerification. + * @member {boolean} enablePasswordVerification + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @instance + */ + UserPasswordValidationPolicy.prototype.enablePasswordVerification = false; + + /** + * Creates a new UserPasswordValidationPolicy instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.UserPasswordValidationPolicy} UserPasswordValidationPolicy instance + */ + UserPasswordValidationPolicy.create = function create(properties) { + return new UserPasswordValidationPolicy(properties); + }; + + /** + * Encodes the specified UserPasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1beta4.UserPasswordValidationPolicy.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy} message UserPasswordValidationPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserPasswordValidationPolicy.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowedFailedAttempts != null && Object.hasOwnProperty.call(message, "allowedFailedAttempts")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.allowedFailedAttempts); + if (message.passwordExpirationDuration != null && Object.hasOwnProperty.call(message, "passwordExpirationDuration")) + $root.google.protobuf.Duration.encode(message.passwordExpirationDuration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.enableFailedAttemptsCheck != null && Object.hasOwnProperty.call(message, "enableFailedAttemptsCheck")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableFailedAttemptsCheck); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + $root.google.cloud.sql.v1beta4.PasswordStatus.encode(message.status, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enablePasswordVerification != null && Object.hasOwnProperty.call(message, "enablePasswordVerification")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.enablePasswordVerification); + return writer; + }; + + /** + * Encodes the specified UserPasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UserPasswordValidationPolicy.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy} message UserPasswordValidationPolicy message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UserPasswordValidationPolicy.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.UserPasswordValidationPolicy} UserPasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserPasswordValidationPolicy.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.allowedFailedAttempts = reader.int32(); + break; + } + case 2: { + message.passwordExpirationDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 3: { + message.enableFailedAttemptsCheck = reader.bool(); + break; + } + case 4: { + message.status = $root.google.cloud.sql.v1beta4.PasswordStatus.decode(reader, reader.uint32()); + break; + } + case 5: { + message.enablePasswordVerification = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.UserPasswordValidationPolicy} UserPasswordValidationPolicy + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UserPasswordValidationPolicy.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UserPasswordValidationPolicy message. + * @function verify + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UserPasswordValidationPolicy.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowedFailedAttempts != null && message.hasOwnProperty("allowedFailedAttempts")) + if (!$util.isInteger(message.allowedFailedAttempts)) + return "allowedFailedAttempts: integer expected"; + if (message.passwordExpirationDuration != null && message.hasOwnProperty("passwordExpirationDuration")) { + var error = $root.google.protobuf.Duration.verify(message.passwordExpirationDuration); + if (error) + return "passwordExpirationDuration." + error; + } + if (message.enableFailedAttemptsCheck != null && message.hasOwnProperty("enableFailedAttemptsCheck")) + if (typeof message.enableFailedAttemptsCheck !== "boolean") + return "enableFailedAttemptsCheck: boolean expected"; + if (message.status != null && message.hasOwnProperty("status")) { + var error = $root.google.cloud.sql.v1beta4.PasswordStatus.verify(message.status); + if (error) + return "status." + error; + } + if (message.enablePasswordVerification != null && message.hasOwnProperty("enablePasswordVerification")) + if (typeof message.enablePasswordVerification !== "boolean") + return "enablePasswordVerification: boolean expected"; + return null; + }; + + /** + * Creates a UserPasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.UserPasswordValidationPolicy} UserPasswordValidationPolicy + */ + UserPasswordValidationPolicy.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy) + return object; + var message = new $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy(); + if (object.allowedFailedAttempts != null) + message.allowedFailedAttempts = object.allowedFailedAttempts | 0; + if (object.passwordExpirationDuration != null) { + if (typeof object.passwordExpirationDuration !== "object") + throw TypeError(".google.cloud.sql.v1beta4.UserPasswordValidationPolicy.passwordExpirationDuration: object expected"); + message.passwordExpirationDuration = $root.google.protobuf.Duration.fromObject(object.passwordExpirationDuration); + } + if (object.enableFailedAttemptsCheck != null) + message.enableFailedAttemptsCheck = Boolean(object.enableFailedAttemptsCheck); + if (object.status != null) { + if (typeof object.status !== "object") + throw TypeError(".google.cloud.sql.v1beta4.UserPasswordValidationPolicy.status: object expected"); + message.status = $root.google.cloud.sql.v1beta4.PasswordStatus.fromObject(object.status); + } + if (object.enablePasswordVerification != null) + message.enablePasswordVerification = Boolean(object.enablePasswordVerification); + return message; + }; + + /** + * Creates a plain object from a UserPasswordValidationPolicy message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @static + * @param {google.cloud.sql.v1beta4.UserPasswordValidationPolicy} message UserPasswordValidationPolicy + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UserPasswordValidationPolicy.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.allowedFailedAttempts = 0; + object.passwordExpirationDuration = null; + object.enableFailedAttemptsCheck = false; + object.status = null; + object.enablePasswordVerification = false; + } + if (message.allowedFailedAttempts != null && message.hasOwnProperty("allowedFailedAttempts")) + object.allowedFailedAttempts = message.allowedFailedAttempts; + if (message.passwordExpirationDuration != null && message.hasOwnProperty("passwordExpirationDuration")) + object.passwordExpirationDuration = $root.google.protobuf.Duration.toObject(message.passwordExpirationDuration, options); + if (message.enableFailedAttemptsCheck != null && message.hasOwnProperty("enableFailedAttemptsCheck")) + object.enableFailedAttemptsCheck = message.enableFailedAttemptsCheck; + if (message.status != null && message.hasOwnProperty("status")) + object.status = $root.google.cloud.sql.v1beta4.PasswordStatus.toObject(message.status, options); + if (message.enablePasswordVerification != null && message.hasOwnProperty("enablePasswordVerification")) + object.enablePasswordVerification = message.enablePasswordVerification; + return object; + }; + + /** + * Converts this UserPasswordValidationPolicy to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @instance + * @returns {Object.} JSON object + */ + UserPasswordValidationPolicy.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UserPasswordValidationPolicy + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UserPasswordValidationPolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.UserPasswordValidationPolicy"; + }; + + return UserPasswordValidationPolicy; + })(); + + v1beta4.PasswordStatus = (function() { + + /** + * Properties of a PasswordStatus. + * @memberof google.cloud.sql.v1beta4 + * @interface IPasswordStatus + * @property {boolean|null} [locked] PasswordStatus locked + * @property {google.protobuf.ITimestamp|null} [passwordExpirationTime] PasswordStatus passwordExpirationTime + */ + + /** + * Constructs a new PasswordStatus. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a PasswordStatus. + * @implements IPasswordStatus + * @constructor + * @param {google.cloud.sql.v1beta4.IPasswordStatus=} [properties] Properties to set + */ + function PasswordStatus(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PasswordStatus locked. + * @member {boolean} locked + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @instance + */ + PasswordStatus.prototype.locked = false; + + /** + * PasswordStatus passwordExpirationTime. + * @member {google.protobuf.ITimestamp|null|undefined} passwordExpirationTime + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @instance + */ + PasswordStatus.prototype.passwordExpirationTime = null; + + /** + * Creates a new PasswordStatus instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @static + * @param {google.cloud.sql.v1beta4.IPasswordStatus=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.PasswordStatus} PasswordStatus instance + */ + PasswordStatus.create = function create(properties) { + return new PasswordStatus(properties); + }; + + /** + * Encodes the specified PasswordStatus message. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordStatus.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @static + * @param {google.cloud.sql.v1beta4.IPasswordStatus} message PasswordStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordStatus.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.locked != null && Object.hasOwnProperty.call(message, "locked")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.locked); + if (message.passwordExpirationTime != null && Object.hasOwnProperty.call(message, "passwordExpirationTime")) + $root.google.protobuf.Timestamp.encode(message.passwordExpirationTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PasswordStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordStatus.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @static + * @param {google.cloud.sql.v1beta4.IPasswordStatus} message PasswordStatus message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PasswordStatus.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PasswordStatus message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.PasswordStatus} PasswordStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordStatus.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PasswordStatus(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.locked = reader.bool(); + break; + } + case 2: { + message.passwordExpirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PasswordStatus message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.PasswordStatus} PasswordStatus + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PasswordStatus.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PasswordStatus message. + * @function verify + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PasswordStatus.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.locked != null && message.hasOwnProperty("locked")) + if (typeof message.locked !== "boolean") + return "locked: boolean expected"; + if (message.passwordExpirationTime != null && message.hasOwnProperty("passwordExpirationTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.passwordExpirationTime); + if (error) + return "passwordExpirationTime." + error; + } + return null; + }; + + /** + * Creates a PasswordStatus message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.PasswordStatus} PasswordStatus + */ + PasswordStatus.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.PasswordStatus) + return object; + var message = new $root.google.cloud.sql.v1beta4.PasswordStatus(); + if (object.locked != null) + message.locked = Boolean(object.locked); + if (object.passwordExpirationTime != null) { + if (typeof object.passwordExpirationTime !== "object") + throw TypeError(".google.cloud.sql.v1beta4.PasswordStatus.passwordExpirationTime: object expected"); + message.passwordExpirationTime = $root.google.protobuf.Timestamp.fromObject(object.passwordExpirationTime); + } + return message; + }; + + /** + * Creates a plain object from a PasswordStatus message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @static + * @param {google.cloud.sql.v1beta4.PasswordStatus} message PasswordStatus + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PasswordStatus.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.locked = false; + object.passwordExpirationTime = null; + } + if (message.locked != null && message.hasOwnProperty("locked")) + object.locked = message.locked; + if (message.passwordExpirationTime != null && message.hasOwnProperty("passwordExpirationTime")) + object.passwordExpirationTime = $root.google.protobuf.Timestamp.toObject(message.passwordExpirationTime, options); + return object; + }; + + /** + * Converts this PasswordStatus to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @instance + * @returns {Object.} JSON object + */ + PasswordStatus.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PasswordStatus + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.PasswordStatus + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PasswordStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.PasswordStatus"; + }; + + return PasswordStatus; + })(); + + v1beta4.User = (function() { + + /** + * Properties of a User. + * @memberof google.cloud.sql.v1beta4 + * @interface IUser + * @property {string|null} [kind] User kind + * @property {string|null} [password] User password + * @property {string|null} [etag] User etag + * @property {string|null} [name] User name + * @property {string|null} [host] User host + * @property {string|null} [instance] User instance + * @property {string|null} [project] User project + * @property {google.cloud.sql.v1beta4.User.SqlUserType|null} [type] User type + * @property {google.cloud.sql.v1beta4.ISqlServerUserDetails|null} [sqlserverUserDetails] User sqlserverUserDetails + * @property {string|null} [iamEmail] User iamEmail + * @property {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy|null} [passwordPolicy] User passwordPolicy + * @property {google.cloud.sql.v1beta4.User.DualPasswordType|null} [dualPasswordType] User dualPasswordType + * @property {google.cloud.sql.v1beta4.User.IamStatus|null} [iamStatus] User iamStatus + * @property {Array.|null} [databaseRoles] User databaseRoles + */ + + /** + * Constructs a new User. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a User. + * @implements IUser + * @constructor + * @param {google.cloud.sql.v1beta4.IUser=} [properties] Properties to set + */ + function User(properties) { + this.databaseRoles = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * User kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.kind = ""; + + /** + * User password. + * @member {string} password + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.password = ""; + + /** + * User etag. + * @member {string} etag + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.etag = ""; + + /** + * User name. + * @member {string} name + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.name = ""; + + /** + * User host. + * @member {string} host + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.host = ""; + + /** + * User instance. + * @member {string} instance + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.instance = ""; + + /** + * User project. + * @member {string} project + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.project = ""; + + /** + * User type. + * @member {google.cloud.sql.v1beta4.User.SqlUserType} type + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.type = 0; + + /** + * User sqlserverUserDetails. + * @member {google.cloud.sql.v1beta4.ISqlServerUserDetails|null|undefined} sqlserverUserDetails + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.sqlserverUserDetails = null; + + /** + * User iamEmail. + * @member {string} iamEmail + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.iamEmail = ""; + + /** + * User passwordPolicy. + * @member {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy|null|undefined} passwordPolicy + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.passwordPolicy = null; + + /** + * User dualPasswordType. + * @member {google.cloud.sql.v1beta4.User.DualPasswordType|null|undefined} dualPasswordType + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.dualPasswordType = null; + + /** + * User iamStatus. + * @member {google.cloud.sql.v1beta4.User.IamStatus|null|undefined} iamStatus + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.iamStatus = null; + + /** + * User databaseRoles. + * @member {Array.} databaseRoles + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + User.prototype.databaseRoles = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * User userDetails. + * @member {"sqlserverUserDetails"|undefined} userDetails + * @memberof google.cloud.sql.v1beta4.User + * @instance + */ + Object.defineProperty(User.prototype, "userDetails", { + get: $util.oneOfGetter($oneOfFields = ["sqlserverUserDetails"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(User.prototype, "_dualPasswordType", { + get: $util.oneOfGetter($oneOfFields = ["dualPasswordType"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(User.prototype, "_iamStatus", { + get: $util.oneOfGetter($oneOfFields = ["iamStatus"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new User instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.User + * @static + * @param {google.cloud.sql.v1beta4.IUser=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.User} User instance + */ + User.create = function create(properties) { + return new User(properties); + }; + + /** + * Encodes the specified User message. Does not implicitly {@link google.cloud.sql.v1beta4.User.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.User + * @static + * @param {google.cloud.sql.v1beta4.IUser} message User message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + User.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.password != null && Object.hasOwnProperty.call(message, "password")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.password); + if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.etag); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + if (message.host != null && Object.hasOwnProperty.call(message, "host")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.host); + if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); + if (message.project != null && Object.hasOwnProperty.call(message, "project")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.project); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.type); + if (message.sqlserverUserDetails != null && Object.hasOwnProperty.call(message, "sqlserverUserDetails")) + $root.google.cloud.sql.v1beta4.SqlServerUserDetails.encode(message.sqlserverUserDetails, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.iamEmail != null && Object.hasOwnProperty.call(message, "iamEmail")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.iamEmail); + if (message.passwordPolicy != null && Object.hasOwnProperty.call(message, "passwordPolicy")) + $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy.encode(message.passwordPolicy, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.dualPasswordType != null && Object.hasOwnProperty.call(message, "dualPasswordType")) + writer.uint32(/* id 13, wireType 0 =*/104).int32(message.dualPasswordType); + if (message.iamStatus != null && Object.hasOwnProperty.call(message, "iamStatus")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.iamStatus); + if (message.databaseRoles != null && message.databaseRoles.length) + for (var i = 0; i < message.databaseRoles.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.databaseRoles[i]); + return writer; + }; + + /** + * Encodes the specified User message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.User.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.User + * @static + * @param {google.cloud.sql.v1beta4.IUser} message User message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + User.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a User message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.User + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.User} User + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + User.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.User(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.password = reader.string(); + break; + } + case 3: { + message.etag = reader.string(); + break; + } + case 4: { + message.name = reader.string(); + break; + } + case 5: { + message.host = reader.string(); + break; + } + case 6: { + message.instance = reader.string(); + break; + } + case 7: { + message.project = reader.string(); + break; + } + case 8: { + message.type = reader.int32(); + break; + } + case 9: { + message.sqlserverUserDetails = $root.google.cloud.sql.v1beta4.SqlServerUserDetails.decode(reader, reader.uint32()); + break; + } + case 11: { + message.iamEmail = reader.string(); + break; + } + case 12: { + message.passwordPolicy = $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy.decode(reader, reader.uint32()); + break; + } + case 13: { + message.dualPasswordType = reader.int32(); + break; + } + case 14: { + message.iamStatus = reader.int32(); + break; + } + case 15: { + if (!(message.databaseRoles && message.databaseRoles.length)) + message.databaseRoles = []; + message.databaseRoles.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a User message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.User + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.User} User + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + User.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a User message. + * @function verify + * @memberof google.cloud.sql.v1beta4.User + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + User.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.password != null && message.hasOwnProperty("password")) + if (!$util.isString(message.password)) + return "password: string expected"; + if (message.etag != null && message.hasOwnProperty("etag")) + if (!$util.isString(message.etag)) + return "etag: string expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.host != null && message.hasOwnProperty("host")) + if (!$util.isString(message.host)) + return "host: string expected"; + if (message.instance != null && message.hasOwnProperty("instance")) + if (!$util.isString(message.instance)) + return "instance: string expected"; + if (message.project != null && message.hasOwnProperty("project")) + if (!$util.isString(message.project)) + return "project: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 7: + break; + } + if (message.sqlserverUserDetails != null && message.hasOwnProperty("sqlserverUserDetails")) { + properties.userDetails = 1; + { + var error = $root.google.cloud.sql.v1beta4.SqlServerUserDetails.verify(message.sqlserverUserDetails); + if (error) + return "sqlserverUserDetails." + error; + } + } + if (message.iamEmail != null && message.hasOwnProperty("iamEmail")) + if (!$util.isString(message.iamEmail)) + return "iamEmail: string expected"; + if (message.passwordPolicy != null && message.hasOwnProperty("passwordPolicy")) { + var error = $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy.verify(message.passwordPolicy); + if (error) + return "passwordPolicy." + error; + } + if (message.dualPasswordType != null && message.hasOwnProperty("dualPasswordType")) { + properties._dualPasswordType = 1; + switch (message.dualPasswordType) { + default: + return "dualPasswordType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + } + if (message.iamStatus != null && message.hasOwnProperty("iamStatus")) { + properties._iamStatus = 1; + switch (message.iamStatus) { + default: + return "iamStatus: enum value expected"; + case 0: + case 1: + case 2: + break; + } + } + if (message.databaseRoles != null && message.hasOwnProperty("databaseRoles")) { + if (!Array.isArray(message.databaseRoles)) + return "databaseRoles: array expected"; + for (var i = 0; i < message.databaseRoles.length; ++i) + if (!$util.isString(message.databaseRoles[i])) + return "databaseRoles: string[] expected"; + } + return null; + }; + + /** + * Creates a User message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.User + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.User} User + */ + User.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.User) + return object; + var message = new $root.google.cloud.sql.v1beta4.User(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.password != null) + message.password = String(object.password); + if (object.etag != null) + message.etag = String(object.etag); + if (object.name != null) + message.name = String(object.name); + if (object.host != null) + message.host = String(object.host); + if (object.instance != null) + message.instance = String(object.instance); + if (object.project != null) + message.project = String(object.project); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "BUILT_IN": + case 0: + message.type = 0; + break; + case "CLOUD_IAM_USER": + case 1: + message.type = 1; + break; + case "CLOUD_IAM_SERVICE_ACCOUNT": + case 2: + message.type = 2; + break; + case "CLOUD_IAM_GROUP": + case 3: + message.type = 3; + break; + case "CLOUD_IAM_GROUP_USER": + case 4: + message.type = 4; + break; + case "CLOUD_IAM_GROUP_SERVICE_ACCOUNT": + case 5: + message.type = 5; + break; + case "ENTRAID_USER": + case 7: + message.type = 7; + break; + } + if (object.sqlserverUserDetails != null) { + if (typeof object.sqlserverUserDetails !== "object") + throw TypeError(".google.cloud.sql.v1beta4.User.sqlserverUserDetails: object expected"); + message.sqlserverUserDetails = $root.google.cloud.sql.v1beta4.SqlServerUserDetails.fromObject(object.sqlserverUserDetails); + } + if (object.iamEmail != null) + message.iamEmail = String(object.iamEmail); + if (object.passwordPolicy != null) { + if (typeof object.passwordPolicy !== "object") + throw TypeError(".google.cloud.sql.v1beta4.User.passwordPolicy: object expected"); + message.passwordPolicy = $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy.fromObject(object.passwordPolicy); + } + switch (object.dualPasswordType) { + default: + if (typeof object.dualPasswordType === "number") { + message.dualPasswordType = object.dualPasswordType; + break; + } + break; + case "DUAL_PASSWORD_TYPE_UNSPECIFIED": + case 0: + message.dualPasswordType = 0; + break; + case "NO_MODIFY_DUAL_PASSWORD": + case 1: + message.dualPasswordType = 1; + break; + case "NO_DUAL_PASSWORD": + case 2: + message.dualPasswordType = 2; + break; + case "DUAL_PASSWORD": + case 3: + message.dualPasswordType = 3; + break; + } + switch (object.iamStatus) { + default: + if (typeof object.iamStatus === "number") { + message.iamStatus = object.iamStatus; + break; + } + break; + case "IAM_STATUS_UNSPECIFIED": + case 0: + message.iamStatus = 0; + break; + case "INACTIVE": + case 1: + message.iamStatus = 1; + break; + case "ACTIVE": + case 2: + message.iamStatus = 2; + break; + } + if (object.databaseRoles) { + if (!Array.isArray(object.databaseRoles)) + throw TypeError(".google.cloud.sql.v1beta4.User.databaseRoles: array expected"); + message.databaseRoles = []; + for (var i = 0; i < object.databaseRoles.length; ++i) + message.databaseRoles[i] = String(object.databaseRoles[i]); + } + return message; + }; + + /** + * Creates a plain object from a User message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.User + * @static + * @param {google.cloud.sql.v1beta4.User} message User + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + User.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.databaseRoles = []; + if (options.defaults) { + object.kind = ""; + object.password = ""; + object.etag = ""; + object.name = ""; + object.host = ""; + object.instance = ""; + object.project = ""; + object.type = options.enums === String ? "BUILT_IN" : 0; + object.iamEmail = ""; + object.passwordPolicy = null; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.password != null && message.hasOwnProperty("password")) + object.password = message.password; + if (message.etag != null && message.hasOwnProperty("etag")) + object.etag = message.etag; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.host != null && message.hasOwnProperty("host")) + object.host = message.host; + if (message.instance != null && message.hasOwnProperty("instance")) + object.instance = message.instance; + if (message.project != null && message.hasOwnProperty("project")) + object.project = message.project; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.User.SqlUserType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.User.SqlUserType[message.type] : message.type; + if (message.sqlserverUserDetails != null && message.hasOwnProperty("sqlserverUserDetails")) { + object.sqlserverUserDetails = $root.google.cloud.sql.v1beta4.SqlServerUserDetails.toObject(message.sqlserverUserDetails, options); + if (options.oneofs) + object.userDetails = "sqlserverUserDetails"; + } + if (message.iamEmail != null && message.hasOwnProperty("iamEmail")) + object.iamEmail = message.iamEmail; + if (message.passwordPolicy != null && message.hasOwnProperty("passwordPolicy")) + object.passwordPolicy = $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy.toObject(message.passwordPolicy, options); + if (message.dualPasswordType != null && message.hasOwnProperty("dualPasswordType")) { + object.dualPasswordType = options.enums === String ? $root.google.cloud.sql.v1beta4.User.DualPasswordType[message.dualPasswordType] === undefined ? message.dualPasswordType : $root.google.cloud.sql.v1beta4.User.DualPasswordType[message.dualPasswordType] : message.dualPasswordType; + if (options.oneofs) + object._dualPasswordType = "dualPasswordType"; + } + if (message.iamStatus != null && message.hasOwnProperty("iamStatus")) { + object.iamStatus = options.enums === String ? $root.google.cloud.sql.v1beta4.User.IamStatus[message.iamStatus] === undefined ? message.iamStatus : $root.google.cloud.sql.v1beta4.User.IamStatus[message.iamStatus] : message.iamStatus; + if (options.oneofs) + object._iamStatus = "iamStatus"; + } + if (message.databaseRoles && message.databaseRoles.length) { + object.databaseRoles = []; + for (var j = 0; j < message.databaseRoles.length; ++j) + object.databaseRoles[j] = message.databaseRoles[j]; + } + return object; + }; + + /** + * Converts this User to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.User + * @instance + * @returns {Object.} JSON object + */ + User.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for User + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.User + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + User.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.User"; + }; + + /** + * SqlUserType enum. + * @name google.cloud.sql.v1beta4.User.SqlUserType + * @enum {number} + * @property {number} BUILT_IN=0 BUILT_IN value + * @property {number} CLOUD_IAM_USER=1 CLOUD_IAM_USER value + * @property {number} CLOUD_IAM_SERVICE_ACCOUNT=2 CLOUD_IAM_SERVICE_ACCOUNT value + * @property {number} CLOUD_IAM_GROUP=3 CLOUD_IAM_GROUP value + * @property {number} CLOUD_IAM_GROUP_USER=4 CLOUD_IAM_GROUP_USER value + * @property {number} CLOUD_IAM_GROUP_SERVICE_ACCOUNT=5 CLOUD_IAM_GROUP_SERVICE_ACCOUNT value + * @property {number} ENTRAID_USER=7 ENTRAID_USER value + */ + User.SqlUserType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "BUILT_IN"] = 0; + values[valuesById[1] = "CLOUD_IAM_USER"] = 1; + values[valuesById[2] = "CLOUD_IAM_SERVICE_ACCOUNT"] = 2; + values[valuesById[3] = "CLOUD_IAM_GROUP"] = 3; + values[valuesById[4] = "CLOUD_IAM_GROUP_USER"] = 4; + values[valuesById[5] = "CLOUD_IAM_GROUP_SERVICE_ACCOUNT"] = 5; + values[valuesById[7] = "ENTRAID_USER"] = 7; + return values; + })(); + + /** + * DualPasswordType enum. + * @name google.cloud.sql.v1beta4.User.DualPasswordType + * @enum {number} + * @property {number} DUAL_PASSWORD_TYPE_UNSPECIFIED=0 DUAL_PASSWORD_TYPE_UNSPECIFIED value + * @property {number} NO_MODIFY_DUAL_PASSWORD=1 NO_MODIFY_DUAL_PASSWORD value + * @property {number} NO_DUAL_PASSWORD=2 NO_DUAL_PASSWORD value + * @property {number} DUAL_PASSWORD=3 DUAL_PASSWORD value + */ + User.DualPasswordType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DUAL_PASSWORD_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "NO_MODIFY_DUAL_PASSWORD"] = 1; + values[valuesById[2] = "NO_DUAL_PASSWORD"] = 2; + values[valuesById[3] = "DUAL_PASSWORD"] = 3; + return values; + })(); + + /** + * IamStatus enum. + * @name google.cloud.sql.v1beta4.User.IamStatus + * @enum {number} + * @property {number} IAM_STATUS_UNSPECIFIED=0 IAM_STATUS_UNSPECIFIED value + * @property {number} INACTIVE=1 INACTIVE value + * @property {number} ACTIVE=2 ACTIVE value + */ + User.IamStatus = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IAM_STATUS_UNSPECIFIED"] = 0; + values[valuesById[1] = "INACTIVE"] = 1; + values[valuesById[2] = "ACTIVE"] = 2; + return values; + })(); + + return User; + })(); + + v1beta4.SqlServerUserDetails = (function() { + + /** + * Properties of a SqlServerUserDetails. + * @memberof google.cloud.sql.v1beta4 + * @interface ISqlServerUserDetails + * @property {boolean|null} [disabled] SqlServerUserDetails disabled + * @property {Array.|null} [serverRoles] SqlServerUserDetails serverRoles + */ + + /** + * Constructs a new SqlServerUserDetails. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a SqlServerUserDetails. + * @implements ISqlServerUserDetails + * @constructor + * @param {google.cloud.sql.v1beta4.ISqlServerUserDetails=} [properties] Properties to set + */ + function SqlServerUserDetails(properties) { + this.serverRoles = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SqlServerUserDetails disabled. + * @member {boolean} disabled + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @instance + */ + SqlServerUserDetails.prototype.disabled = false; + + /** + * SqlServerUserDetails serverRoles. + * @member {Array.} serverRoles + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @instance + */ + SqlServerUserDetails.prototype.serverRoles = $util.emptyArray; + + /** + * Creates a new SqlServerUserDetails instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerUserDetails=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.SqlServerUserDetails} SqlServerUserDetails instance + */ + SqlServerUserDetails.create = function create(properties) { + return new SqlServerUserDetails(properties); + }; + + /** + * Encodes the specified SqlServerUserDetails message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerUserDetails.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerUserDetails} message SqlServerUserDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerUserDetails.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.disabled); + if (message.serverRoles != null && message.serverRoles.length) + for (var i = 0; i < message.serverRoles.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.serverRoles[i]); + return writer; + }; + + /** + * Encodes the specified SqlServerUserDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerUserDetails.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @static + * @param {google.cloud.sql.v1beta4.ISqlServerUserDetails} message SqlServerUserDetails message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SqlServerUserDetails.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SqlServerUserDetails message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.SqlServerUserDetails} SqlServerUserDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerUserDetails.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlServerUserDetails(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.disabled = reader.bool(); + break; + } + case 2: { + if (!(message.serverRoles && message.serverRoles.length)) + message.serverRoles = []; + message.serverRoles.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SqlServerUserDetails message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.SqlServerUserDetails} SqlServerUserDetails + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SqlServerUserDetails.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SqlServerUserDetails message. + * @function verify + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SqlServerUserDetails.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.disabled != null && message.hasOwnProperty("disabled")) + if (typeof message.disabled !== "boolean") + return "disabled: boolean expected"; + if (message.serverRoles != null && message.hasOwnProperty("serverRoles")) { + if (!Array.isArray(message.serverRoles)) + return "serverRoles: array expected"; + for (var i = 0; i < message.serverRoles.length; ++i) + if (!$util.isString(message.serverRoles[i])) + return "serverRoles: string[] expected"; + } + return null; + }; + + /** + * Creates a SqlServerUserDetails message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.SqlServerUserDetails} SqlServerUserDetails + */ + SqlServerUserDetails.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.SqlServerUserDetails) + return object; + var message = new $root.google.cloud.sql.v1beta4.SqlServerUserDetails(); + if (object.disabled != null) + message.disabled = Boolean(object.disabled); + if (object.serverRoles) { + if (!Array.isArray(object.serverRoles)) + throw TypeError(".google.cloud.sql.v1beta4.SqlServerUserDetails.serverRoles: array expected"); + message.serverRoles = []; + for (var i = 0; i < object.serverRoles.length; ++i) + message.serverRoles[i] = String(object.serverRoles[i]); + } + return message; + }; + + /** + * Creates a plain object from a SqlServerUserDetails message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @static + * @param {google.cloud.sql.v1beta4.SqlServerUserDetails} message SqlServerUserDetails + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SqlServerUserDetails.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.serverRoles = []; + if (options.defaults) + object.disabled = false; + if (message.disabled != null && message.hasOwnProperty("disabled")) + object.disabled = message.disabled; + if (message.serverRoles && message.serverRoles.length) { + object.serverRoles = []; + for (var j = 0; j < message.serverRoles.length; ++j) + object.serverRoles[j] = message.serverRoles[j]; + } + return object; + }; + + /** + * Converts this SqlServerUserDetails to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @instance + * @returns {Object.} JSON object + */ + SqlServerUserDetails.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SqlServerUserDetails + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SqlServerUserDetails.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlServerUserDetails"; + }; + + return SqlServerUserDetails; + })(); + + v1beta4.UsersListResponse = (function() { + + /** + * Properties of a UsersListResponse. + * @memberof google.cloud.sql.v1beta4 + * @interface IUsersListResponse + * @property {string|null} [kind] UsersListResponse kind + * @property {Array.|null} [items] UsersListResponse items + * @property {string|null} [nextPageToken] UsersListResponse nextPageToken + */ + + /** + * Constructs a new UsersListResponse. + * @memberof google.cloud.sql.v1beta4 + * @classdesc Represents a UsersListResponse. + * @implements IUsersListResponse + * @constructor + * @param {google.cloud.sql.v1beta4.IUsersListResponse=} [properties] Properties to set + */ + function UsersListResponse(properties) { + this.items = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UsersListResponse kind. + * @member {string} kind + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @instance + */ + UsersListResponse.prototype.kind = ""; + + /** + * UsersListResponse items. + * @member {Array.} items + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @instance + */ + UsersListResponse.prototype.items = $util.emptyArray; + + /** + * UsersListResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @instance + */ + UsersListResponse.prototype.nextPageToken = ""; + + /** + * Creates a new UsersListResponse instance using the specified properties. + * @function create + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @static + * @param {google.cloud.sql.v1beta4.IUsersListResponse=} [properties] Properties to set + * @returns {google.cloud.sql.v1beta4.UsersListResponse} UsersListResponse instance + */ + UsersListResponse.create = function create(properties) { + return new UsersListResponse(properties); + }; + + /** + * Encodes the specified UsersListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.UsersListResponse.verify|verify} messages. + * @function encode + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @static + * @param {google.cloud.sql.v1beta4.IUsersListResponse} message UsersListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UsersListResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.items != null && message.items.length) + for (var i = 0; i < message.items.length; ++i) + $root.google.cloud.sql.v1beta4.User.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified UsersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UsersListResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @static + * @param {google.cloud.sql.v1beta4.IUsersListResponse} message UsersListResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UsersListResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UsersListResponse message from the specified reader or buffer. + * @function decode + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.cloud.sql.v1beta4.UsersListResponse} UsersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UsersListResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.UsersListResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + if (!(message.items && message.items.length)) + message.items = []; + message.items.push($root.google.cloud.sql.v1beta4.User.decode(reader, reader.uint32())); + break; + } + case 3: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UsersListResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.cloud.sql.v1beta4.UsersListResponse} UsersListResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UsersListResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UsersListResponse message. + * @function verify + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UsersListResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.items != null && message.hasOwnProperty("items")) { + if (!Array.isArray(message.items)) + return "items: array expected"; + for (var i = 0; i < message.items.length; ++i) { + var error = $root.google.cloud.sql.v1beta4.User.verify(message.items[i]); + if (error) + return "items." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a UsersListResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @static + * @param {Object.} object Plain object + * @returns {google.cloud.sql.v1beta4.UsersListResponse} UsersListResponse + */ + UsersListResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.cloud.sql.v1beta4.UsersListResponse) + return object; + var message = new $root.google.cloud.sql.v1beta4.UsersListResponse(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.items) { + if (!Array.isArray(object.items)) + throw TypeError(".google.cloud.sql.v1beta4.UsersListResponse.items: array expected"); + message.items = []; + for (var i = 0; i < object.items.length; ++i) { + if (typeof object.items[i] !== "object") + throw TypeError(".google.cloud.sql.v1beta4.UsersListResponse.items: object expected"); + message.items[i] = $root.google.cloud.sql.v1beta4.User.fromObject(object.items[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a UsersListResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @static + * @param {google.cloud.sql.v1beta4.UsersListResponse} message UsersListResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UsersListResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.items = []; + if (options.defaults) { + object.kind = ""; + object.nextPageToken = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.items && message.items.length) { + object.items = []; + for (var j = 0; j < message.items.length; ++j) + object.items[j] = $root.google.cloud.sql.v1beta4.User.toObject(message.items[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this UsersListResponse to JSON. + * @function toJSON + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @instance + * @returns {Object.} JSON object + */ + UsersListResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UsersListResponse + * @function getTypeUrl + * @memberof google.cloud.sql.v1beta4.UsersListResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UsersListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.cloud.sql.v1beta4.UsersListResponse"; + }; + + return UsersListResponse; + })(); + + return v1beta4; + })(); + + return sql; + })(); + + return cloud; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http + * @instance + */ + Http.prototype.fullyDecodeReservedExpansion = false; + + /** + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance + */ + Http.create = function create(properties) { + return new Http(properties); + }; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + case 2: { + message.fullyDecodeReservedExpansion = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Http + * @function getTypeUrl + * @memberof google.api.Http + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Http"; + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule get. + * @member {string|null|undefined} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = null; + + /** + * HttpRule put. + * @member {string|null|undefined} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = null; + + /** + * HttpRule post. + * @member {string|null|undefined} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = null; + + /** + * HttpRule delete. + * @member {string|null|undefined} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = null; + + /** + * HttpRule patch. + * @member {string|null|undefined} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = null; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. + * @function create + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance + */ + HttpRule.create = function create(properties) { + return new HttpRule(properties); + }; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.get = reader.string(); + break; + } + case 3: { + message.put = reader.string(); + break; + } + case 4: { + message.post = reader.string(); + break; + } + case 5: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.patch = reader.string(); + break; + } + case 8: { + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + } + case 7: { + message.body = reader.string(); + break; + } + case 12: { + message.responseBody = reader.string(); + break; + } + case 11: { + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) + return object; + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + object.responseBody = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HttpRule + * @function getTypeUrl + * @memberof google.api.HttpRule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.HttpRule"; + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @function create + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + */ + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); + }; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomHttpPattern message. + * @function verify + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomHttpPattern.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} object Plain object + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + */ + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) + return object; + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CustomHttpPattern + * @function getTypeUrl + * @memberof google.api.CustomHttpPattern + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CustomHttpPattern"; + }; + + return CustomHttpPattern; + })(); + + api.CommonLanguageSettings = (function() { + + /** + * Properties of a CommonLanguageSettings. + * @memberof google.api + * @interface ICommonLanguageSettings + * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri + * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration + */ + + /** + * Constructs a new CommonLanguageSettings. + * @memberof google.api + * @classdesc Represents a CommonLanguageSettings. + * @implements ICommonLanguageSettings + * @constructor + * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set + */ + function CommonLanguageSettings(properties) { + this.destinations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommonLanguageSettings referenceDocsUri. + * @member {string} referenceDocsUri + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.referenceDocsUri = ""; + + /** + * CommonLanguageSettings destinations. + * @member {Array.} destinations + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.destinations = $util.emptyArray; + + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + + /** + * Creates a new CommonLanguageSettings instance using the specified properties. + * @function create + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings instance + */ + CommonLanguageSettings.create = function create(properties) { + return new CommonLanguageSettings(properties); + }; + + /** + * Encodes the specified CommonLanguageSettings message. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @function encode + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonLanguageSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.referenceDocsUri); + if (message.destinations != null && message.destinations.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.destinations.length; ++i) + writer.int32(message.destinations[i]); + writer.ldelim(); + } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CommonLanguageSettings message, length delimited. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonLanguageSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommonLanguageSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.CommonLanguageSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonLanguageSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CommonLanguageSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.referenceDocsUri = reader.string(); + break; + } + case 2: { + if (!(message.destinations && message.destinations.length)) + message.destinations = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.destinations.push(reader.int32()); + } else + message.destinations.push(reader.int32()); + break; + } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommonLanguageSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CommonLanguageSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonLanguageSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommonLanguageSettings message. + * @function verify + * @memberof google.api.CommonLanguageSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommonLanguageSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) + if (!$util.isString(message.referenceDocsUri)) + return "referenceDocsUri: string expected"; + if (message.destinations != null && message.hasOwnProperty("destinations")) { + if (!Array.isArray(message.destinations)) + return "destinations: array expected"; + for (var i = 0; i < message.destinations.length; ++i) + switch (message.destinations[i]) { + default: + return "destinations: enum value[] expected"; + case 0: + case 10: + case 20: + break; + } + } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } + return null; + }; + + /** + * Creates a CommonLanguageSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CommonLanguageSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings + */ + CommonLanguageSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CommonLanguageSettings) + return object; + var message = new $root.google.api.CommonLanguageSettings(); + if (object.referenceDocsUri != null) + message.referenceDocsUri = String(object.referenceDocsUri); + if (object.destinations) { + if (!Array.isArray(object.destinations)) + throw TypeError(".google.api.CommonLanguageSettings.destinations: array expected"); + message.destinations = []; + for (var i = 0; i < object.destinations.length; ++i) + switch (object.destinations[i]) { + default: + if (typeof object.destinations[i] === "number") { + message.destinations[i] = object.destinations[i]; + break; + } + case "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": + case 0: + message.destinations[i] = 0; + break; + case "GITHUB": + case 10: + message.destinations[i] = 10; + break; + case "PACKAGE_MANAGER": + case 20: + message.destinations[i] = 20; + break; + } + } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } + return message; + }; + + /** + * Creates a plain object from a CommonLanguageSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.CommonLanguageSettings} message CommonLanguageSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommonLanguageSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.destinations = []; + if (options.defaults) { + object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } + if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) + object.referenceDocsUri = message.referenceDocsUri; + if (message.destinations && message.destinations.length) { + object.destinations = []; + for (var j = 0; j < message.destinations.length; ++j) + object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; + } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); + return object; + }; + + /** + * Converts this CommonLanguageSettings to JSON. + * @function toJSON + * @memberof google.api.CommonLanguageSettings + * @instance + * @returns {Object.} JSON object + */ + CommonLanguageSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CommonLanguageSettings + * @function getTypeUrl + * @memberof google.api.CommonLanguageSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CommonLanguageSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CommonLanguageSettings"; + }; + + return CommonLanguageSettings; + })(); + + api.ClientLibrarySettings = (function() { + + /** + * Properties of a ClientLibrarySettings. + * @memberof google.api + * @interface IClientLibrarySettings + * @property {string|null} [version] ClientLibrarySettings version + * @property {google.api.LaunchStage|null} [launchStage] ClientLibrarySettings launchStage + * @property {boolean|null} [restNumericEnums] ClientLibrarySettings restNumericEnums + * @property {google.api.IJavaSettings|null} [javaSettings] ClientLibrarySettings javaSettings + * @property {google.api.ICppSettings|null} [cppSettings] ClientLibrarySettings cppSettings + * @property {google.api.IPhpSettings|null} [phpSettings] ClientLibrarySettings phpSettings + * @property {google.api.IPythonSettings|null} [pythonSettings] ClientLibrarySettings pythonSettings + * @property {google.api.INodeSettings|null} [nodeSettings] ClientLibrarySettings nodeSettings + * @property {google.api.IDotnetSettings|null} [dotnetSettings] ClientLibrarySettings dotnetSettings + * @property {google.api.IRubySettings|null} [rubySettings] ClientLibrarySettings rubySettings + * @property {google.api.IGoSettings|null} [goSettings] ClientLibrarySettings goSettings + */ + + /** + * Constructs a new ClientLibrarySettings. + * @memberof google.api + * @classdesc Represents a ClientLibrarySettings. + * @implements IClientLibrarySettings + * @constructor + * @param {google.api.IClientLibrarySettings=} [properties] Properties to set + */ + function ClientLibrarySettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientLibrarySettings version. + * @member {string} version + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.version = ""; + + /** + * ClientLibrarySettings launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.launchStage = 0; + + /** + * ClientLibrarySettings restNumericEnums. + * @member {boolean} restNumericEnums + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.restNumericEnums = false; + + /** + * ClientLibrarySettings javaSettings. + * @member {google.api.IJavaSettings|null|undefined} javaSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.javaSettings = null; + + /** + * ClientLibrarySettings cppSettings. + * @member {google.api.ICppSettings|null|undefined} cppSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.cppSettings = null; + + /** + * ClientLibrarySettings phpSettings. + * @member {google.api.IPhpSettings|null|undefined} phpSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.phpSettings = null; + + /** + * ClientLibrarySettings pythonSettings. + * @member {google.api.IPythonSettings|null|undefined} pythonSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.pythonSettings = null; + + /** + * ClientLibrarySettings nodeSettings. + * @member {google.api.INodeSettings|null|undefined} nodeSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.nodeSettings = null; + + /** + * ClientLibrarySettings dotnetSettings. + * @member {google.api.IDotnetSettings|null|undefined} dotnetSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.dotnetSettings = null; + + /** + * ClientLibrarySettings rubySettings. + * @member {google.api.IRubySettings|null|undefined} rubySettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.rubySettings = null; + + /** + * ClientLibrarySettings goSettings. + * @member {google.api.IGoSettings|null|undefined} goSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.goSettings = null; + + /** + * Creates a new ClientLibrarySettings instance using the specified properties. + * @function create + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings=} [properties] Properties to set + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings instance + */ + ClientLibrarySettings.create = function create(properties) { + return new ClientLibrarySettings(properties); + }; + + /** + * Encodes the specified ClientLibrarySettings message. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @function encode + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientLibrarySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.launchStage); + if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.restNumericEnums); + if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) + $root.google.api.JavaSettings.encode(message.javaSettings, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) + $root.google.api.CppSettings.encode(message.cppSettings, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) + $root.google.api.PhpSettings.encode(message.phpSettings, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) + $root.google.api.PythonSettings.encode(message.pythonSettings, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) + $root.google.api.NodeSettings.encode(message.nodeSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) + $root.google.api.DotnetSettings.encode(message.dotnetSettings, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); + if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) + $root.google.api.RubySettings.encode(message.rubySettings, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) + $root.google.api.GoSettings.encode(message.goSettings, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ClientLibrarySettings message, length delimited. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientLibrarySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.ClientLibrarySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientLibrarySettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ClientLibrarySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.version = reader.string(); + break; + } + case 2: { + message.launchStage = reader.int32(); + break; + } + case 3: { + message.restNumericEnums = reader.bool(); + break; + } + case 21: { + message.javaSettings = $root.google.api.JavaSettings.decode(reader, reader.uint32()); + break; + } + case 22: { + message.cppSettings = $root.google.api.CppSettings.decode(reader, reader.uint32()); + break; + } + case 23: { + message.phpSettings = $root.google.api.PhpSettings.decode(reader, reader.uint32()); + break; + } + case 24: { + message.pythonSettings = $root.google.api.PythonSettings.decode(reader, reader.uint32()); + break; + } + case 25: { + message.nodeSettings = $root.google.api.NodeSettings.decode(reader, reader.uint32()); + break; + } + case 26: { + message.dotnetSettings = $root.google.api.DotnetSettings.decode(reader, reader.uint32()); + break; + } + case 27: { + message.rubySettings = $root.google.api.RubySettings.decode(reader, reader.uint32()); + break; + } + case 28: { + message.goSettings = $root.google.api.GoSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ClientLibrarySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientLibrarySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientLibrarySettings message. + * @function verify + * @memberof google.api.ClientLibrarySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientLibrarySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) + if (typeof message.restNumericEnums !== "boolean") + return "restNumericEnums: boolean expected"; + if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) { + var error = $root.google.api.JavaSettings.verify(message.javaSettings); + if (error) + return "javaSettings." + error; + } + if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) { + var error = $root.google.api.CppSettings.verify(message.cppSettings); + if (error) + return "cppSettings." + error; + } + if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) { + var error = $root.google.api.PhpSettings.verify(message.phpSettings); + if (error) + return "phpSettings." + error; + } + if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) { + var error = $root.google.api.PythonSettings.verify(message.pythonSettings); + if (error) + return "pythonSettings." + error; + } + if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) { + var error = $root.google.api.NodeSettings.verify(message.nodeSettings); + if (error) + return "nodeSettings." + error; + } + if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) { + var error = $root.google.api.DotnetSettings.verify(message.dotnetSettings); + if (error) + return "dotnetSettings." + error; + } + if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) { + var error = $root.google.api.RubySettings.verify(message.rubySettings); + if (error) + return "rubySettings." + error; + } + if (message.goSettings != null && message.hasOwnProperty("goSettings")) { + var error = $root.google.api.GoSettings.verify(message.goSettings); + if (error) + return "goSettings." + error; + } + return null; + }; + + /** + * Creates a ClientLibrarySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ClientLibrarySettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + */ + ClientLibrarySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ClientLibrarySettings) + return object; + var message = new $root.google.api.ClientLibrarySettings(); + if (object.version != null) + message.version = String(object.version); + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } + if (object.restNumericEnums != null) + message.restNumericEnums = Boolean(object.restNumericEnums); + if (object.javaSettings != null) { + if (typeof object.javaSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.javaSettings: object expected"); + message.javaSettings = $root.google.api.JavaSettings.fromObject(object.javaSettings); + } + if (object.cppSettings != null) { + if (typeof object.cppSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.cppSettings: object expected"); + message.cppSettings = $root.google.api.CppSettings.fromObject(object.cppSettings); + } + if (object.phpSettings != null) { + if (typeof object.phpSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.phpSettings: object expected"); + message.phpSettings = $root.google.api.PhpSettings.fromObject(object.phpSettings); + } + if (object.pythonSettings != null) { + if (typeof object.pythonSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.pythonSettings: object expected"); + message.pythonSettings = $root.google.api.PythonSettings.fromObject(object.pythonSettings); + } + if (object.nodeSettings != null) { + if (typeof object.nodeSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.nodeSettings: object expected"); + message.nodeSettings = $root.google.api.NodeSettings.fromObject(object.nodeSettings); + } + if (object.dotnetSettings != null) { + if (typeof object.dotnetSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.dotnetSettings: object expected"); + message.dotnetSettings = $root.google.api.DotnetSettings.fromObject(object.dotnetSettings); + } + if (object.rubySettings != null) { + if (typeof object.rubySettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.rubySettings: object expected"); + message.rubySettings = $root.google.api.RubySettings.fromObject(object.rubySettings); + } + if (object.goSettings != null) { + if (typeof object.goSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.goSettings: object expected"); + message.goSettings = $root.google.api.GoSettings.fromObject(object.goSettings); + } + return message; + }; + + /** + * Creates a plain object from a ClientLibrarySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.ClientLibrarySettings} message ClientLibrarySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientLibrarySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = ""; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + object.restNumericEnums = false; + object.javaSettings = null; + object.cppSettings = null; + object.phpSettings = null; + object.pythonSettings = null; + object.nodeSettings = null; + object.dotnetSettings = null; + object.rubySettings = null; + object.goSettings = null; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) + object.restNumericEnums = message.restNumericEnums; + if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) + object.javaSettings = $root.google.api.JavaSettings.toObject(message.javaSettings, options); + if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) + object.cppSettings = $root.google.api.CppSettings.toObject(message.cppSettings, options); + if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) + object.phpSettings = $root.google.api.PhpSettings.toObject(message.phpSettings, options); + if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) + object.pythonSettings = $root.google.api.PythonSettings.toObject(message.pythonSettings, options); + if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) + object.nodeSettings = $root.google.api.NodeSettings.toObject(message.nodeSettings, options); + if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) + object.dotnetSettings = $root.google.api.DotnetSettings.toObject(message.dotnetSettings, options); + if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) + object.rubySettings = $root.google.api.RubySettings.toObject(message.rubySettings, options); + if (message.goSettings != null && message.hasOwnProperty("goSettings")) + object.goSettings = $root.google.api.GoSettings.toObject(message.goSettings, options); + return object; + }; + + /** + * Converts this ClientLibrarySettings to JSON. + * @function toJSON + * @memberof google.api.ClientLibrarySettings + * @instance + * @returns {Object.} JSON object + */ + ClientLibrarySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ClientLibrarySettings + * @function getTypeUrl + * @memberof google.api.ClientLibrarySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ClientLibrarySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ClientLibrarySettings"; + }; + + return ClientLibrarySettings; + })(); + + api.Publishing = (function() { + + /** + * Properties of a Publishing. + * @memberof google.api + * @interface IPublishing + * @property {Array.|null} [methodSettings] Publishing methodSettings + * @property {string|null} [newIssueUri] Publishing newIssueUri + * @property {string|null} [documentationUri] Publishing documentationUri + * @property {string|null} [apiShortName] Publishing apiShortName + * @property {string|null} [githubLabel] Publishing githubLabel + * @property {Array.|null} [codeownerGithubTeams] Publishing codeownerGithubTeams + * @property {string|null} [docTagPrefix] Publishing docTagPrefix + * @property {google.api.ClientLibraryOrganization|null} [organization] Publishing organization + * @property {Array.|null} [librarySettings] Publishing librarySettings + * @property {string|null} [protoReferenceDocumentationUri] Publishing protoReferenceDocumentationUri + * @property {string|null} [restReferenceDocumentationUri] Publishing restReferenceDocumentationUri + */ + + /** + * Constructs a new Publishing. + * @memberof google.api + * @classdesc Represents a Publishing. + * @implements IPublishing + * @constructor + * @param {google.api.IPublishing=} [properties] Properties to set + */ + function Publishing(properties) { + this.methodSettings = []; + this.codeownerGithubTeams = []; + this.librarySettings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Publishing methodSettings. + * @member {Array.} methodSettings + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.methodSettings = $util.emptyArray; + + /** + * Publishing newIssueUri. + * @member {string} newIssueUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.newIssueUri = ""; + + /** + * Publishing documentationUri. + * @member {string} documentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.documentationUri = ""; + + /** + * Publishing apiShortName. + * @member {string} apiShortName + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.apiShortName = ""; + + /** + * Publishing githubLabel. + * @member {string} githubLabel + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.githubLabel = ""; + + /** + * Publishing codeownerGithubTeams. + * @member {Array.} codeownerGithubTeams + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.codeownerGithubTeams = $util.emptyArray; + + /** + * Publishing docTagPrefix. + * @member {string} docTagPrefix + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.docTagPrefix = ""; + + /** + * Publishing organization. + * @member {google.api.ClientLibraryOrganization} organization + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.organization = 0; + + /** + * Publishing librarySettings. + * @member {Array.} librarySettings + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.librarySettings = $util.emptyArray; + + /** + * Publishing protoReferenceDocumentationUri. + * @member {string} protoReferenceDocumentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.protoReferenceDocumentationUri = ""; + + /** + * Publishing restReferenceDocumentationUri. + * @member {string} restReferenceDocumentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.restReferenceDocumentationUri = ""; + + /** + * Creates a new Publishing instance using the specified properties. + * @function create + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing=} [properties] Properties to set + * @returns {google.api.Publishing} Publishing instance + */ + Publishing.create = function create(properties) { + return new Publishing(properties); + }; + + /** + * Encodes the specified Publishing message. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @function encode + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing} message Publishing message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Publishing.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methodSettings != null && message.methodSettings.length) + for (var i = 0; i < message.methodSettings.length; ++i) + $root.google.api.MethodSettings.encode(message.methodSettings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) + writer.uint32(/* id 101, wireType 2 =*/810).string(message.newIssueUri); + if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) + writer.uint32(/* id 102, wireType 2 =*/818).string(message.documentationUri); + if (message.apiShortName != null && Object.hasOwnProperty.call(message, "apiShortName")) + writer.uint32(/* id 103, wireType 2 =*/826).string(message.apiShortName); + if (message.githubLabel != null && Object.hasOwnProperty.call(message, "githubLabel")) + writer.uint32(/* id 104, wireType 2 =*/834).string(message.githubLabel); + if (message.codeownerGithubTeams != null && message.codeownerGithubTeams.length) + for (var i = 0; i < message.codeownerGithubTeams.length; ++i) + writer.uint32(/* id 105, wireType 2 =*/842).string(message.codeownerGithubTeams[i]); + if (message.docTagPrefix != null && Object.hasOwnProperty.call(message, "docTagPrefix")) + writer.uint32(/* id 106, wireType 2 =*/850).string(message.docTagPrefix); + if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) + writer.uint32(/* id 107, wireType 0 =*/856).int32(message.organization); + if (message.librarySettings != null && message.librarySettings.length) + for (var i = 0; i < message.librarySettings.length; ++i) + $root.google.api.ClientLibrarySettings.encode(message.librarySettings[i], writer.uint32(/* id 109, wireType 2 =*/874).fork()).ldelim(); + if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) + writer.uint32(/* id 110, wireType 2 =*/882).string(message.protoReferenceDocumentationUri); + if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) + writer.uint32(/* id 111, wireType 2 =*/890).string(message.restReferenceDocumentationUri); + return writer; + }; + + /** + * Encodes the specified Publishing message, length delimited. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing} message Publishing message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Publishing.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Publishing message from the specified reader or buffer. + * @function decode + * @memberof google.api.Publishing + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Publishing} Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Publishing.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Publishing(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.methodSettings && message.methodSettings.length)) + message.methodSettings = []; + message.methodSettings.push($root.google.api.MethodSettings.decode(reader, reader.uint32())); + break; + } + case 101: { + message.newIssueUri = reader.string(); + break; + } + case 102: { + message.documentationUri = reader.string(); + break; + } + case 103: { + message.apiShortName = reader.string(); + break; + } + case 104: { + message.githubLabel = reader.string(); + break; + } + case 105: { + if (!(message.codeownerGithubTeams && message.codeownerGithubTeams.length)) + message.codeownerGithubTeams = []; + message.codeownerGithubTeams.push(reader.string()); + break; + } + case 106: { + message.docTagPrefix = reader.string(); + break; + } + case 107: { + message.organization = reader.int32(); + break; + } + case 109: { + if (!(message.librarySettings && message.librarySettings.length)) + message.librarySettings = []; + message.librarySettings.push($root.google.api.ClientLibrarySettings.decode(reader, reader.uint32())); + break; + } + case 110: { + message.protoReferenceDocumentationUri = reader.string(); + break; + } + case 111: { + message.restReferenceDocumentationUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Publishing message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Publishing + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Publishing} Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Publishing.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Publishing message. + * @function verify + * @memberof google.api.Publishing + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Publishing.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methodSettings != null && message.hasOwnProperty("methodSettings")) { + if (!Array.isArray(message.methodSettings)) + return "methodSettings: array expected"; + for (var i = 0; i < message.methodSettings.length; ++i) { + var error = $root.google.api.MethodSettings.verify(message.methodSettings[i]); + if (error) + return "methodSettings." + error; + } + } + if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) + if (!$util.isString(message.newIssueUri)) + return "newIssueUri: string expected"; + if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) + if (!$util.isString(message.documentationUri)) + return "documentationUri: string expected"; + if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) + if (!$util.isString(message.apiShortName)) + return "apiShortName: string expected"; + if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) + if (!$util.isString(message.githubLabel)) + return "githubLabel: string expected"; + if (message.codeownerGithubTeams != null && message.hasOwnProperty("codeownerGithubTeams")) { + if (!Array.isArray(message.codeownerGithubTeams)) + return "codeownerGithubTeams: array expected"; + for (var i = 0; i < message.codeownerGithubTeams.length; ++i) + if (!$util.isString(message.codeownerGithubTeams[i])) + return "codeownerGithubTeams: string[] expected"; + } + if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) + if (!$util.isString(message.docTagPrefix)) + return "docTagPrefix: string expected"; + if (message.organization != null && message.hasOwnProperty("organization")) + switch (message.organization) { + default: + return "organization: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.librarySettings != null && message.hasOwnProperty("librarySettings")) { + if (!Array.isArray(message.librarySettings)) + return "librarySettings: array expected"; + for (var i = 0; i < message.librarySettings.length; ++i) { + var error = $root.google.api.ClientLibrarySettings.verify(message.librarySettings[i]); + if (error) + return "librarySettings." + error; + } + } + if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) + if (!$util.isString(message.protoReferenceDocumentationUri)) + return "protoReferenceDocumentationUri: string expected"; + if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) + if (!$util.isString(message.restReferenceDocumentationUri)) + return "restReferenceDocumentationUri: string expected"; + return null; + }; + + /** + * Creates a Publishing message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Publishing + * @static + * @param {Object.} object Plain object + * @returns {google.api.Publishing} Publishing + */ + Publishing.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Publishing) + return object; + var message = new $root.google.api.Publishing(); + if (object.methodSettings) { + if (!Array.isArray(object.methodSettings)) + throw TypeError(".google.api.Publishing.methodSettings: array expected"); + message.methodSettings = []; + for (var i = 0; i < object.methodSettings.length; ++i) { + if (typeof object.methodSettings[i] !== "object") + throw TypeError(".google.api.Publishing.methodSettings: object expected"); + message.methodSettings[i] = $root.google.api.MethodSettings.fromObject(object.methodSettings[i]); + } + } + if (object.newIssueUri != null) + message.newIssueUri = String(object.newIssueUri); + if (object.documentationUri != null) + message.documentationUri = String(object.documentationUri); + if (object.apiShortName != null) + message.apiShortName = String(object.apiShortName); + if (object.githubLabel != null) + message.githubLabel = String(object.githubLabel); + if (object.codeownerGithubTeams) { + if (!Array.isArray(object.codeownerGithubTeams)) + throw TypeError(".google.api.Publishing.codeownerGithubTeams: array expected"); + message.codeownerGithubTeams = []; + for (var i = 0; i < object.codeownerGithubTeams.length; ++i) + message.codeownerGithubTeams[i] = String(object.codeownerGithubTeams[i]); + } + if (object.docTagPrefix != null) + message.docTagPrefix = String(object.docTagPrefix); + switch (object.organization) { + default: + if (typeof object.organization === "number") { + message.organization = object.organization; + break; + } + break; + case "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": + case 0: + message.organization = 0; + break; + case "CLOUD": + case 1: + message.organization = 1; + break; + case "ADS": + case 2: + message.organization = 2; + break; + case "PHOTOS": + case 3: + message.organization = 3; + break; + case "STREET_VIEW": + case 4: + message.organization = 4; + break; + case "SHOPPING": + case 5: + message.organization = 5; + break; + case "GEO": + case 6: + message.organization = 6; + break; + case "GENERATIVE_AI": + case 7: + message.organization = 7; + break; + } + if (object.librarySettings) { + if (!Array.isArray(object.librarySettings)) + throw TypeError(".google.api.Publishing.librarySettings: array expected"); + message.librarySettings = []; + for (var i = 0; i < object.librarySettings.length; ++i) { + if (typeof object.librarySettings[i] !== "object") + throw TypeError(".google.api.Publishing.librarySettings: object expected"); + message.librarySettings[i] = $root.google.api.ClientLibrarySettings.fromObject(object.librarySettings[i]); + } + } + if (object.protoReferenceDocumentationUri != null) + message.protoReferenceDocumentationUri = String(object.protoReferenceDocumentationUri); + if (object.restReferenceDocumentationUri != null) + message.restReferenceDocumentationUri = String(object.restReferenceDocumentationUri); + return message; + }; + + /** + * Creates a plain object from a Publishing message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Publishing + * @static + * @param {google.api.Publishing} message Publishing + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Publishing.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.methodSettings = []; + object.codeownerGithubTeams = []; + object.librarySettings = []; + } + if (options.defaults) { + object.newIssueUri = ""; + object.documentationUri = ""; + object.apiShortName = ""; + object.githubLabel = ""; + object.docTagPrefix = ""; + object.organization = options.enums === String ? "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" : 0; + object.protoReferenceDocumentationUri = ""; + object.restReferenceDocumentationUri = ""; + } + if (message.methodSettings && message.methodSettings.length) { + object.methodSettings = []; + for (var j = 0; j < message.methodSettings.length; ++j) + object.methodSettings[j] = $root.google.api.MethodSettings.toObject(message.methodSettings[j], options); + } + if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) + object.newIssueUri = message.newIssueUri; + if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) + object.documentationUri = message.documentationUri; + if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) + object.apiShortName = message.apiShortName; + if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) + object.githubLabel = message.githubLabel; + if (message.codeownerGithubTeams && message.codeownerGithubTeams.length) { + object.codeownerGithubTeams = []; + for (var j = 0; j < message.codeownerGithubTeams.length; ++j) + object.codeownerGithubTeams[j] = message.codeownerGithubTeams[j]; + } + if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) + object.docTagPrefix = message.docTagPrefix; + if (message.organization != null && message.hasOwnProperty("organization")) + object.organization = options.enums === String ? $root.google.api.ClientLibraryOrganization[message.organization] === undefined ? message.organization : $root.google.api.ClientLibraryOrganization[message.organization] : message.organization; + if (message.librarySettings && message.librarySettings.length) { + object.librarySettings = []; + for (var j = 0; j < message.librarySettings.length; ++j) + object.librarySettings[j] = $root.google.api.ClientLibrarySettings.toObject(message.librarySettings[j], options); + } + if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) + object.protoReferenceDocumentationUri = message.protoReferenceDocumentationUri; + if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) + object.restReferenceDocumentationUri = message.restReferenceDocumentationUri; + return object; + }; + + /** + * Converts this Publishing to JSON. + * @function toJSON + * @memberof google.api.Publishing + * @instance + * @returns {Object.} JSON object + */ + Publishing.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Publishing + * @function getTypeUrl + * @memberof google.api.Publishing + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Publishing.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Publishing"; + }; + + return Publishing; + })(); + + api.JavaSettings = (function() { + + /** + * Properties of a JavaSettings. + * @memberof google.api + * @interface IJavaSettings + * @property {string|null} [libraryPackage] JavaSettings libraryPackage + * @property {Object.|null} [serviceClassNames] JavaSettings serviceClassNames + * @property {google.api.ICommonLanguageSettings|null} [common] JavaSettings common + */ + + /** + * Constructs a new JavaSettings. + * @memberof google.api + * @classdesc Represents a JavaSettings. + * @implements IJavaSettings + * @constructor + * @param {google.api.IJavaSettings=} [properties] Properties to set + */ + function JavaSettings(properties) { + this.serviceClassNames = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * JavaSettings libraryPackage. + * @member {string} libraryPackage + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.libraryPackage = ""; + + /** + * JavaSettings serviceClassNames. + * @member {Object.} serviceClassNames + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.serviceClassNames = $util.emptyObject; + + /** + * JavaSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.common = null; + + /** + * Creates a new JavaSettings instance using the specified properties. + * @function create + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings=} [properties] Properties to set + * @returns {google.api.JavaSettings} JavaSettings instance + */ + JavaSettings.create = function create(properties) { + return new JavaSettings(properties); + }; + + /** + * Encodes the specified JavaSettings message. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @function encode + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + JavaSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.libraryPackage); + if (message.serviceClassNames != null && Object.hasOwnProperty.call(message, "serviceClassNames")) + for (var keys = Object.keys(message.serviceClassNames), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.serviceClassNames[keys[i]]).ldelim(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified JavaSettings message, length delimited. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + JavaSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a JavaSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.JavaSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.JavaSettings} JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + JavaSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.JavaSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.libraryPackage = reader.string(); + break; + } + case 2: { + if (message.serviceClassNames === $util.emptyObject) + message.serviceClassNames = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.serviceClassNames[key] = value; + break; + } + case 3: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a JavaSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.JavaSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.JavaSettings} JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + JavaSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a JavaSettings message. + * @function verify + * @memberof google.api.JavaSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + JavaSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) + if (!$util.isString(message.libraryPackage)) + return "libraryPackage: string expected"; + if (message.serviceClassNames != null && message.hasOwnProperty("serviceClassNames")) { + if (!$util.isObject(message.serviceClassNames)) + return "serviceClassNames: object expected"; + var key = Object.keys(message.serviceClassNames); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.serviceClassNames[key[i]])) + return "serviceClassNames: string{k:string} expected"; + } + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a JavaSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.JavaSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.JavaSettings} JavaSettings + */ + JavaSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.JavaSettings) + return object; + var message = new $root.google.api.JavaSettings(); + if (object.libraryPackage != null) + message.libraryPackage = String(object.libraryPackage); + if (object.serviceClassNames) { + if (typeof object.serviceClassNames !== "object") + throw TypeError(".google.api.JavaSettings.serviceClassNames: object expected"); + message.serviceClassNames = {}; + for (var keys = Object.keys(object.serviceClassNames), i = 0; i < keys.length; ++i) + message.serviceClassNames[keys[i]] = String(object.serviceClassNames[keys[i]]); + } + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.JavaSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a JavaSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.JavaSettings + * @static + * @param {google.api.JavaSettings} message JavaSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + JavaSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.serviceClassNames = {}; + if (options.defaults) { + object.libraryPackage = ""; + object.common = null; + } + if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) + object.libraryPackage = message.libraryPackage; + var keys2; + if (message.serviceClassNames && (keys2 = Object.keys(message.serviceClassNames)).length) { + object.serviceClassNames = {}; + for (var j = 0; j < keys2.length; ++j) + object.serviceClassNames[keys2[j]] = message.serviceClassNames[keys2[j]]; + } + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this JavaSettings to JSON. + * @function toJSON + * @memberof google.api.JavaSettings + * @instance + * @returns {Object.} JSON object + */ + JavaSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for JavaSettings + * @function getTypeUrl + * @memberof google.api.JavaSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + JavaSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.JavaSettings"; + }; + + return JavaSettings; + })(); + + api.CppSettings = (function() { + + /** + * Properties of a CppSettings. + * @memberof google.api + * @interface ICppSettings + * @property {google.api.ICommonLanguageSettings|null} [common] CppSettings common + */ + + /** + * Constructs a new CppSettings. + * @memberof google.api + * @classdesc Represents a CppSettings. + * @implements ICppSettings + * @constructor + * @param {google.api.ICppSettings=} [properties] Properties to set + */ + function CppSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CppSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.CppSettings + * @instance + */ + CppSettings.prototype.common = null; + + /** + * Creates a new CppSettings instance using the specified properties. + * @function create + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings=} [properties] Properties to set + * @returns {google.api.CppSettings} CppSettings instance + */ + CppSettings.create = function create(properties) { + return new CppSettings(properties); + }; + + /** + * Encodes the specified CppSettings message. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @function encode + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings} message CppSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CppSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CppSettings message, length delimited. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings} message CppSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CppSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CppSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.CppSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CppSettings} CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CppSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CppSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CppSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CppSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CppSettings} CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CppSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CppSettings message. + * @function verify + * @memberof google.api.CppSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CppSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a CppSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CppSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.CppSettings} CppSettings + */ + CppSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CppSettings) + return object; + var message = new $root.google.api.CppSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.CppSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a CppSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CppSettings + * @static + * @param {google.api.CppSettings} message CppSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CppSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this CppSettings to JSON. + * @function toJSON + * @memberof google.api.CppSettings + * @instance + * @returns {Object.} JSON object + */ + CppSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CppSettings + * @function getTypeUrl + * @memberof google.api.CppSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CppSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CppSettings"; + }; + + return CppSettings; + })(); + + api.PhpSettings = (function() { + + /** + * Properties of a PhpSettings. + * @memberof google.api + * @interface IPhpSettings + * @property {google.api.ICommonLanguageSettings|null} [common] PhpSettings common + */ + + /** + * Constructs a new PhpSettings. + * @memberof google.api + * @classdesc Represents a PhpSettings. + * @implements IPhpSettings + * @constructor + * @param {google.api.IPhpSettings=} [properties] Properties to set + */ + function PhpSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PhpSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.PhpSettings + * @instance + */ + PhpSettings.prototype.common = null; + + /** + * Creates a new PhpSettings instance using the specified properties. + * @function create + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings=} [properties] Properties to set + * @returns {google.api.PhpSettings} PhpSettings instance + */ + PhpSettings.create = function create(properties) { + return new PhpSettings(properties); + }; + + /** + * Encodes the specified PhpSettings message. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @function encode + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhpSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PhpSettings message, length delimited. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhpSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PhpSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.PhpSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PhpSettings} PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhpSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PhpSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PhpSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PhpSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PhpSettings} PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhpSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PhpSettings message. + * @function verify + * @memberof google.api.PhpSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PhpSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a PhpSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PhpSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.PhpSettings} PhpSettings + */ + PhpSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PhpSettings) + return object; + var message = new $root.google.api.PhpSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.PhpSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a PhpSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PhpSettings + * @static + * @param {google.api.PhpSettings} message PhpSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PhpSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this PhpSettings to JSON. + * @function toJSON + * @memberof google.api.PhpSettings + * @instance + * @returns {Object.} JSON object + */ + PhpSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PhpSettings + * @function getTypeUrl + * @memberof google.api.PhpSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PhpSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PhpSettings"; + }; + + return PhpSettings; + })(); + + api.PythonSettings = (function() { + + /** + * Properties of a PythonSettings. + * @memberof google.api + * @interface IPythonSettings + * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures + */ + + /** + * Constructs a new PythonSettings. + * @memberof google.api + * @classdesc Represents a PythonSettings. + * @implements IPythonSettings + * @constructor + * @param {google.api.IPythonSettings=} [properties] Properties to set + */ + function PythonSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PythonSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.common = null; + + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + + /** + * Creates a new PythonSettings instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings=} [properties] Properties to set + * @returns {google.api.PythonSettings} PythonSettings instance + */ + PythonSettings.create = function create(properties) { + return new PythonSettings(properties); + }; + + /** + * Encodes the specified PythonSettings message. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PythonSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PythonSettings message, length delimited. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PythonSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PythonSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings} PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PythonSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PythonSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings} PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PythonSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PythonSettings message. + * @function verify + * @memberof google.api.PythonSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PythonSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } + return null; + }; + + /** + * Creates a PythonSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings} PythonSettings + */ + PythonSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings) + return object; + var message = new $root.google.api.PythonSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.PythonSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } + return message; + }; + + /** + * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings + * @static + * @param {google.api.PythonSettings} message PythonSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PythonSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.common = null; + object.experimentalFeatures = null; + } + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); + return object; + }; + + /** + * Converts this PythonSettings to JSON. + * @function toJSON + * @memberof google.api.PythonSettings + * @instance + * @returns {Object.} JSON object + */ + PythonSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PythonSettings + * @function getTypeUrl + * @memberof google.api.PythonSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PythonSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings"; + }; + + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + + return PythonSettings; + })(); + + api.NodeSettings = (function() { + + /** + * Properties of a NodeSettings. + * @memberof google.api + * @interface INodeSettings + * @property {google.api.ICommonLanguageSettings|null} [common] NodeSettings common + */ + + /** + * Constructs a new NodeSettings. + * @memberof google.api + * @classdesc Represents a NodeSettings. + * @implements INodeSettings + * @constructor + * @param {google.api.INodeSettings=} [properties] Properties to set + */ + function NodeSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NodeSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.NodeSettings + * @instance + */ + NodeSettings.prototype.common = null; + + /** + * Creates a new NodeSettings instance using the specified properties. + * @function create + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings=} [properties] Properties to set + * @returns {google.api.NodeSettings} NodeSettings instance + */ + NodeSettings.create = function create(properties) { + return new NodeSettings(properties); + }; + + /** + * Encodes the specified NodeSettings message. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @function encode + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NodeSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified NodeSettings message, length delimited. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NodeSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NodeSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.NodeSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.NodeSettings} NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NodeSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.NodeSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NodeSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.NodeSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.NodeSettings} NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NodeSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NodeSettings message. + * @function verify + * @memberof google.api.NodeSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NodeSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a NodeSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.NodeSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.NodeSettings} NodeSettings + */ + NodeSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.NodeSettings) + return object; + var message = new $root.google.api.NodeSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.NodeSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a NodeSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.NodeSettings + * @static + * @param {google.api.NodeSettings} message NodeSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NodeSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this NodeSettings to JSON. + * @function toJSON + * @memberof google.api.NodeSettings + * @instance + * @returns {Object.} JSON object + */ + NodeSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NodeSettings + * @function getTypeUrl + * @memberof google.api.NodeSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NodeSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.NodeSettings"; + }; + + return NodeSettings; + })(); + + api.DotnetSettings = (function() { + + /** + * Properties of a DotnetSettings. + * @memberof google.api + * @interface IDotnetSettings + * @property {google.api.ICommonLanguageSettings|null} [common] DotnetSettings common + * @property {Object.|null} [renamedServices] DotnetSettings renamedServices + * @property {Object.|null} [renamedResources] DotnetSettings renamedResources + * @property {Array.|null} [ignoredResources] DotnetSettings ignoredResources + * @property {Array.|null} [forcedNamespaceAliases] DotnetSettings forcedNamespaceAliases + * @property {Array.|null} [handwrittenSignatures] DotnetSettings handwrittenSignatures + */ + + /** + * Constructs a new DotnetSettings. + * @memberof google.api + * @classdesc Represents a DotnetSettings. + * @implements IDotnetSettings + * @constructor + * @param {google.api.IDotnetSettings=} [properties] Properties to set + */ + function DotnetSettings(properties) { + this.renamedServices = {}; + this.renamedResources = {}; + this.ignoredResources = []; + this.forcedNamespaceAliases = []; + this.handwrittenSignatures = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DotnetSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.common = null; + + /** + * DotnetSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.renamedServices = $util.emptyObject; + + /** + * DotnetSettings renamedResources. + * @member {Object.} renamedResources + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.renamedResources = $util.emptyObject; + + /** + * DotnetSettings ignoredResources. + * @member {Array.} ignoredResources + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.ignoredResources = $util.emptyArray; + + /** + * DotnetSettings forcedNamespaceAliases. + * @member {Array.} forcedNamespaceAliases + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.forcedNamespaceAliases = $util.emptyArray; + + /** + * DotnetSettings handwrittenSignatures. + * @member {Array.} handwrittenSignatures + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.handwrittenSignatures = $util.emptyArray; + + /** + * Creates a new DotnetSettings instance using the specified properties. + * @function create + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings=} [properties] Properties to set + * @returns {google.api.DotnetSettings} DotnetSettings instance + */ + DotnetSettings.create = function create(properties) { + return new DotnetSettings(properties); + }; + + /** + * Encodes the specified DotnetSettings message. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @function encode + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DotnetSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); + if (message.renamedResources != null && Object.hasOwnProperty.call(message, "renamedResources")) + for (var keys = Object.keys(message.renamedResources), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedResources[keys[i]]).ldelim(); + if (message.ignoredResources != null && message.ignoredResources.length) + for (var i = 0; i < message.ignoredResources.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.ignoredResources[i]); + if (message.forcedNamespaceAliases != null && message.forcedNamespaceAliases.length) + for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.forcedNamespaceAliases[i]); + if (message.handwrittenSignatures != null && message.handwrittenSignatures.length) + for (var i = 0; i < message.handwrittenSignatures.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.handwrittenSignatures[i]); + return writer; + }; + + /** + * Encodes the specified DotnetSettings message, length delimited. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DotnetSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.DotnetSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.DotnetSettings} DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DotnetSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.DotnetSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } + case 3: { + if (message.renamedResources === $util.emptyObject) + message.renamedResources = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedResources[key] = value; + break; + } + case 4: { + if (!(message.ignoredResources && message.ignoredResources.length)) + message.ignoredResources = []; + message.ignoredResources.push(reader.string()); + break; + } + case 5: { + if (!(message.forcedNamespaceAliases && message.forcedNamespaceAliases.length)) + message.forcedNamespaceAliases = []; + message.forcedNamespaceAliases.push(reader.string()); + break; + } + case 6: { + if (!(message.handwrittenSignatures && message.handwrittenSignatures.length)) + message.handwrittenSignatures = []; + message.handwrittenSignatures.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.DotnetSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.DotnetSettings} DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DotnetSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DotnetSettings message. + * @function verify + * @memberof google.api.DotnetSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DotnetSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } + if (message.renamedResources != null && message.hasOwnProperty("renamedResources")) { + if (!$util.isObject(message.renamedResources)) + return "renamedResources: object expected"; + var key = Object.keys(message.renamedResources); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedResources[key[i]])) + return "renamedResources: string{k:string} expected"; + } + if (message.ignoredResources != null && message.hasOwnProperty("ignoredResources")) { + if (!Array.isArray(message.ignoredResources)) + return "ignoredResources: array expected"; + for (var i = 0; i < message.ignoredResources.length; ++i) + if (!$util.isString(message.ignoredResources[i])) + return "ignoredResources: string[] expected"; + } + if (message.forcedNamespaceAliases != null && message.hasOwnProperty("forcedNamespaceAliases")) { + if (!Array.isArray(message.forcedNamespaceAliases)) + return "forcedNamespaceAliases: array expected"; + for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) + if (!$util.isString(message.forcedNamespaceAliases[i])) + return "forcedNamespaceAliases: string[] expected"; + } + if (message.handwrittenSignatures != null && message.hasOwnProperty("handwrittenSignatures")) { + if (!Array.isArray(message.handwrittenSignatures)) + return "handwrittenSignatures: array expected"; + for (var i = 0; i < message.handwrittenSignatures.length; ++i) + if (!$util.isString(message.handwrittenSignatures[i])) + return "handwrittenSignatures: string[] expected"; + } + return null; + }; + + /** + * Creates a DotnetSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.DotnetSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.DotnetSettings} DotnetSettings + */ + DotnetSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.DotnetSettings) + return object; + var message = new $root.google.api.DotnetSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.DotnetSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.DotnetSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } + if (object.renamedResources) { + if (typeof object.renamedResources !== "object") + throw TypeError(".google.api.DotnetSettings.renamedResources: object expected"); + message.renamedResources = {}; + for (var keys = Object.keys(object.renamedResources), i = 0; i < keys.length; ++i) + message.renamedResources[keys[i]] = String(object.renamedResources[keys[i]]); + } + if (object.ignoredResources) { + if (!Array.isArray(object.ignoredResources)) + throw TypeError(".google.api.DotnetSettings.ignoredResources: array expected"); + message.ignoredResources = []; + for (var i = 0; i < object.ignoredResources.length; ++i) + message.ignoredResources[i] = String(object.ignoredResources[i]); + } + if (object.forcedNamespaceAliases) { + if (!Array.isArray(object.forcedNamespaceAliases)) + throw TypeError(".google.api.DotnetSettings.forcedNamespaceAliases: array expected"); + message.forcedNamespaceAliases = []; + for (var i = 0; i < object.forcedNamespaceAliases.length; ++i) + message.forcedNamespaceAliases[i] = String(object.forcedNamespaceAliases[i]); + } + if (object.handwrittenSignatures) { + if (!Array.isArray(object.handwrittenSignatures)) + throw TypeError(".google.api.DotnetSettings.handwrittenSignatures: array expected"); + message.handwrittenSignatures = []; + for (var i = 0; i < object.handwrittenSignatures.length; ++i) + message.handwrittenSignatures[i] = String(object.handwrittenSignatures[i]); + } + return message; + }; + + /** + * Creates a plain object from a DotnetSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.DotnetSettings} message DotnetSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DotnetSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.ignoredResources = []; + object.forcedNamespaceAliases = []; + object.handwrittenSignatures = []; + } + if (options.objects || options.defaults) { + object.renamedServices = {}; + object.renamedResources = {}; + } + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } + if (message.renamedResources && (keys2 = Object.keys(message.renamedResources)).length) { + object.renamedResources = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedResources[keys2[j]] = message.renamedResources[keys2[j]]; + } + if (message.ignoredResources && message.ignoredResources.length) { + object.ignoredResources = []; + for (var j = 0; j < message.ignoredResources.length; ++j) + object.ignoredResources[j] = message.ignoredResources[j]; + } + if (message.forcedNamespaceAliases && message.forcedNamespaceAliases.length) { + object.forcedNamespaceAliases = []; + for (var j = 0; j < message.forcedNamespaceAliases.length; ++j) + object.forcedNamespaceAliases[j] = message.forcedNamespaceAliases[j]; + } + if (message.handwrittenSignatures && message.handwrittenSignatures.length) { + object.handwrittenSignatures = []; + for (var j = 0; j < message.handwrittenSignatures.length; ++j) + object.handwrittenSignatures[j] = message.handwrittenSignatures[j]; + } + return object; + }; + + /** + * Converts this DotnetSettings to JSON. + * @function toJSON + * @memberof google.api.DotnetSettings + * @instance + * @returns {Object.} JSON object + */ + DotnetSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DotnetSettings + * @function getTypeUrl + * @memberof google.api.DotnetSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DotnetSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.DotnetSettings"; + }; + + return DotnetSettings; + })(); + + api.RubySettings = (function() { + + /** + * Properties of a RubySettings. + * @memberof google.api + * @interface IRubySettings + * @property {google.api.ICommonLanguageSettings|null} [common] RubySettings common + */ + + /** + * Constructs a new RubySettings. + * @memberof google.api + * @classdesc Represents a RubySettings. + * @implements IRubySettings + * @constructor + * @param {google.api.IRubySettings=} [properties] Properties to set + */ + function RubySettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RubySettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.RubySettings + * @instance + */ + RubySettings.prototype.common = null; + + /** + * Creates a new RubySettings instance using the specified properties. + * @function create + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings=} [properties] Properties to set + * @returns {google.api.RubySettings} RubySettings instance + */ + RubySettings.create = function create(properties) { + return new RubySettings(properties); + }; + + /** + * Encodes the specified RubySettings message. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @function encode + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings} message RubySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RubySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RubySettings message, length delimited. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings} message RubySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RubySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RubySettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.RubySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.RubySettings} RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RubySettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.RubySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RubySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.RubySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.RubySettings} RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RubySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RubySettings message. + * @function verify + * @memberof google.api.RubySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RubySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a RubySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.RubySettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.RubySettings} RubySettings + */ + RubySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.RubySettings) + return object; + var message = new $root.google.api.RubySettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.RubySettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a RubySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.RubySettings + * @static + * @param {google.api.RubySettings} message RubySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RubySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this RubySettings to JSON. + * @function toJSON + * @memberof google.api.RubySettings + * @instance + * @returns {Object.} JSON object + */ + RubySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RubySettings + * @function getTypeUrl + * @memberof google.api.RubySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RubySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.RubySettings"; + }; + + return RubySettings; + })(); + + api.GoSettings = (function() { + + /** + * Properties of a GoSettings. + * @memberof google.api + * @interface IGoSettings + * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices + */ + + /** + * Constructs a new GoSettings. + * @memberof google.api + * @classdesc Represents a GoSettings. + * @implements IGoSettings + * @constructor + * @param {google.api.IGoSettings=} [properties] Properties to set + */ + function GoSettings(properties) { + this.renamedServices = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GoSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.common = null; + + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + + /** + * Creates a new GoSettings instance using the specified properties. + * @function create + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings=} [properties] Properties to set + * @returns {google.api.GoSettings} GoSettings instance + */ + GoSettings.create = function create(properties) { + return new GoSettings(properties); + }; + + /** + * Encodes the specified GoSettings message. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @function encode + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings} message GoSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GoSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified GoSettings message, length delimited. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings} message GoSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GoSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GoSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.GoSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.GoSettings} GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GoSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GoSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.GoSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.GoSettings} GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GoSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GoSettings message. + * @function verify + * @memberof google.api.GoSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GoSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a GoSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.GoSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.GoSettings} GoSettings + */ + GoSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.GoSettings) + return object; + var message = new $root.google.api.GoSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.GoSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a GoSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.GoSettings + * @static + * @param {google.api.GoSettings} message GoSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GoSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } + return object; + }; + + /** + * Converts this GoSettings to JSON. + * @function toJSON + * @memberof google.api.GoSettings + * @instance + * @returns {Object.} JSON object + */ + GoSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GoSettings + * @function getTypeUrl + * @memberof google.api.GoSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GoSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.GoSettings"; + }; + + return GoSettings; + })(); + + api.MethodSettings = (function() { + + /** + * Properties of a MethodSettings. + * @memberof google.api + * @interface IMethodSettings + * @property {string|null} [selector] MethodSettings selector + * @property {google.api.MethodSettings.ILongRunning|null} [longRunning] MethodSettings longRunning + * @property {Array.|null} [autoPopulatedFields] MethodSettings autoPopulatedFields + */ + + /** + * Constructs a new MethodSettings. + * @memberof google.api + * @classdesc Represents a MethodSettings. + * @implements IMethodSettings + * @constructor + * @param {google.api.IMethodSettings=} [properties] Properties to set + */ + function MethodSettings(properties) { + this.autoPopulatedFields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodSettings selector. + * @member {string} selector + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.selector = ""; + + /** + * MethodSettings longRunning. + * @member {google.api.MethodSettings.ILongRunning|null|undefined} longRunning + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.longRunning = null; + + /** + * MethodSettings autoPopulatedFields. + * @member {Array.} autoPopulatedFields + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.autoPopulatedFields = $util.emptyArray; + + /** + * Creates a new MethodSettings instance using the specified properties. + * @function create + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings=} [properties] Properties to set + * @returns {google.api.MethodSettings} MethodSettings instance + */ + MethodSettings.create = function create(properties) { + return new MethodSettings(properties); + }; + + /** + * Encodes the specified MethodSettings message. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @function encode + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) + $root.google.api.MethodSettings.LongRunning.encode(message.longRunning, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.autoPopulatedFields != null && message.autoPopulatedFields.length) + for (var i = 0; i < message.autoPopulatedFields.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.autoPopulatedFields[i]); + return writer; + }; + + /** + * Encodes the specified MethodSettings message, length delimited. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.MethodSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MethodSettings} MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.longRunning = $root.google.api.MethodSettings.LongRunning.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.autoPopulatedFields && message.autoPopulatedFields.length)) + message.autoPopulatedFields = []; + message.autoPopulatedFields.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MethodSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MethodSettings} MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodSettings message. + * @function verify + * @memberof google.api.MethodSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.longRunning != null && message.hasOwnProperty("longRunning")) { + var error = $root.google.api.MethodSettings.LongRunning.verify(message.longRunning); + if (error) + return "longRunning." + error; + } + if (message.autoPopulatedFields != null && message.hasOwnProperty("autoPopulatedFields")) { + if (!Array.isArray(message.autoPopulatedFields)) + return "autoPopulatedFields: array expected"; + for (var i = 0; i < message.autoPopulatedFields.length; ++i) + if (!$util.isString(message.autoPopulatedFields[i])) + return "autoPopulatedFields: string[] expected"; + } + return null; + }; + + /** + * Creates a MethodSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MethodSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.MethodSettings} MethodSettings + */ + MethodSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MethodSettings) + return object; + var message = new $root.google.api.MethodSettings(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.longRunning != null) { + if (typeof object.longRunning !== "object") + throw TypeError(".google.api.MethodSettings.longRunning: object expected"); + message.longRunning = $root.google.api.MethodSettings.LongRunning.fromObject(object.longRunning); + } + if (object.autoPopulatedFields) { + if (!Array.isArray(object.autoPopulatedFields)) + throw TypeError(".google.api.MethodSettings.autoPopulatedFields: array expected"); + message.autoPopulatedFields = []; + for (var i = 0; i < object.autoPopulatedFields.length; ++i) + message.autoPopulatedFields[i] = String(object.autoPopulatedFields[i]); + } + return message; + }; + + /** + * Creates a plain object from a MethodSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MethodSettings + * @static + * @param {google.api.MethodSettings} message MethodSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.autoPopulatedFields = []; + if (options.defaults) { + object.selector = ""; + object.longRunning = null; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.longRunning != null && message.hasOwnProperty("longRunning")) + object.longRunning = $root.google.api.MethodSettings.LongRunning.toObject(message.longRunning, options); + if (message.autoPopulatedFields && message.autoPopulatedFields.length) { + object.autoPopulatedFields = []; + for (var j = 0; j < message.autoPopulatedFields.length; ++j) + object.autoPopulatedFields[j] = message.autoPopulatedFields[j]; + } + return object; + }; + + /** + * Converts this MethodSettings to JSON. + * @function toJSON + * @memberof google.api.MethodSettings + * @instance + * @returns {Object.} JSON object + */ + MethodSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodSettings + * @function getTypeUrl + * @memberof google.api.MethodSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MethodSettings"; + }; + + MethodSettings.LongRunning = (function() { + + /** + * Properties of a LongRunning. + * @memberof google.api.MethodSettings + * @interface ILongRunning + * @property {google.protobuf.IDuration|null} [initialPollDelay] LongRunning initialPollDelay + * @property {number|null} [pollDelayMultiplier] LongRunning pollDelayMultiplier + * @property {google.protobuf.IDuration|null} [maxPollDelay] LongRunning maxPollDelay + * @property {google.protobuf.IDuration|null} [totalPollTimeout] LongRunning totalPollTimeout + */ + + /** + * Constructs a new LongRunning. + * @memberof google.api.MethodSettings + * @classdesc Represents a LongRunning. + * @implements ILongRunning + * @constructor + * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set + */ + function LongRunning(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LongRunning initialPollDelay. + * @member {google.protobuf.IDuration|null|undefined} initialPollDelay + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.initialPollDelay = null; + + /** + * LongRunning pollDelayMultiplier. + * @member {number} pollDelayMultiplier + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.pollDelayMultiplier = 0; + + /** + * LongRunning maxPollDelay. + * @member {google.protobuf.IDuration|null|undefined} maxPollDelay + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.maxPollDelay = null; + + /** + * LongRunning totalPollTimeout. + * @member {google.protobuf.IDuration|null|undefined} totalPollTimeout + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.totalPollTimeout = null; + + /** + * Creates a new LongRunning instance using the specified properties. + * @function create + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set + * @returns {google.api.MethodSettings.LongRunning} LongRunning instance + */ + LongRunning.create = function create(properties) { + return new LongRunning(properties); + }; + + /** + * Encodes the specified LongRunning message. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @function encode + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LongRunning.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) + $root.google.protobuf.Duration.encode(message.initialPollDelay, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.pollDelayMultiplier); + if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) + $root.google.protobuf.Duration.encode(message.maxPollDelay, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) + $root.google.protobuf.Duration.encode(message.totalPollTimeout, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LongRunning message, length delimited. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LongRunning.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LongRunning message from the specified reader or buffer. + * @function decode + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MethodSettings.LongRunning} LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LongRunning.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings.LongRunning(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.initialPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 2: { + message.pollDelayMultiplier = reader.float(); + break; + } + case 3: { + message.maxPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 4: { + message.totalPollTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LongRunning message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MethodSettings.LongRunning} LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LongRunning.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LongRunning message. + * @function verify + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LongRunning.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) { + var error = $root.google.protobuf.Duration.verify(message.initialPollDelay); + if (error) + return "initialPollDelay." + error; + } + if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) + if (typeof message.pollDelayMultiplier !== "number") + return "pollDelayMultiplier: number expected"; + if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) { + var error = $root.google.protobuf.Duration.verify(message.maxPollDelay); + if (error) + return "maxPollDelay." + error; + } + if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) { + var error = $root.google.protobuf.Duration.verify(message.totalPollTimeout); + if (error) + return "totalPollTimeout." + error; + } + return null; + }; + + /** + * Creates a LongRunning message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {Object.} object Plain object + * @returns {google.api.MethodSettings.LongRunning} LongRunning + */ + LongRunning.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MethodSettings.LongRunning) + return object; + var message = new $root.google.api.MethodSettings.LongRunning(); + if (object.initialPollDelay != null) { + if (typeof object.initialPollDelay !== "object") + throw TypeError(".google.api.MethodSettings.LongRunning.initialPollDelay: object expected"); + message.initialPollDelay = $root.google.protobuf.Duration.fromObject(object.initialPollDelay); + } + if (object.pollDelayMultiplier != null) + message.pollDelayMultiplier = Number(object.pollDelayMultiplier); + if (object.maxPollDelay != null) { + if (typeof object.maxPollDelay !== "object") + throw TypeError(".google.api.MethodSettings.LongRunning.maxPollDelay: object expected"); + message.maxPollDelay = $root.google.protobuf.Duration.fromObject(object.maxPollDelay); + } + if (object.totalPollTimeout != null) { + if (typeof object.totalPollTimeout !== "object") + throw TypeError(".google.api.MethodSettings.LongRunning.totalPollTimeout: object expected"); + message.totalPollTimeout = $root.google.protobuf.Duration.fromObject(object.totalPollTimeout); + } + return message; + }; + + /** + * Creates a plain object from a LongRunning message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.LongRunning} message LongRunning + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LongRunning.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.initialPollDelay = null; + object.pollDelayMultiplier = 0; + object.maxPollDelay = null; + object.totalPollTimeout = null; + } + if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) + object.initialPollDelay = $root.google.protobuf.Duration.toObject(message.initialPollDelay, options); + if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) + object.pollDelayMultiplier = options.json && !isFinite(message.pollDelayMultiplier) ? String(message.pollDelayMultiplier) : message.pollDelayMultiplier; + if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) + object.maxPollDelay = $root.google.protobuf.Duration.toObject(message.maxPollDelay, options); + if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) + object.totalPollTimeout = $root.google.protobuf.Duration.toObject(message.totalPollTimeout, options); + return object; + }; + + /** + * Converts this LongRunning to JSON. + * @function toJSON + * @memberof google.api.MethodSettings.LongRunning + * @instance + * @returns {Object.} JSON object + */ + LongRunning.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LongRunning + * @function getTypeUrl + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LongRunning.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MethodSettings.LongRunning"; + }; + + return LongRunning; + })(); + + return MethodSettings; + })(); + + /** + * ClientLibraryOrganization enum. + * @name google.api.ClientLibraryOrganization + * @enum {number} + * @property {number} CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED=0 CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED value + * @property {number} CLOUD=1 CLOUD value + * @property {number} ADS=2 ADS value + * @property {number} PHOTOS=3 PHOTOS value + * @property {number} STREET_VIEW=4 STREET_VIEW value + * @property {number} SHOPPING=5 SHOPPING value + * @property {number} GEO=6 GEO value + * @property {number} GENERATIVE_AI=7 GENERATIVE_AI value + */ + api.ClientLibraryOrganization = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLOUD"] = 1; + values[valuesById[2] = "ADS"] = 2; + values[valuesById[3] = "PHOTOS"] = 3; + values[valuesById[4] = "STREET_VIEW"] = 4; + values[valuesById[5] = "SHOPPING"] = 5; + values[valuesById[6] = "GEO"] = 6; + values[valuesById[7] = "GENERATIVE_AI"] = 7; + return values; + })(); + + /** + * ClientLibraryDestination enum. + * @name google.api.ClientLibraryDestination + * @enum {number} + * @property {number} CLIENT_LIBRARY_DESTINATION_UNSPECIFIED=0 CLIENT_LIBRARY_DESTINATION_UNSPECIFIED value + * @property {number} GITHUB=10 GITHUB value + * @property {number} PACKAGE_MANAGER=20 PACKAGE_MANAGER value + */ + api.ClientLibraryDestination = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED"] = 0; + values[valuesById[10] = "GITHUB"] = 10; + values[valuesById[20] = "PACKAGE_MANAGER"] = 20; + return values; + })(); + + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; + })(); + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value + * @property {number} IDENTIFIER=8 IDENTIFIER value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + values[valuesById[8] = "IDENTIFIER"] = 8; + return values; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + } + case 3: { + message.nameField = reader.string(); + break; + } + case 4: { + message.history = reader.int32(); + break; + } + case 5: { + message.plural = reader.string(); + break; + } + case 6: { + message.singular = reader.string(); + break; + } + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; + } + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceDescriptor + * @function getTypeUrl + * @memberof google.api.ResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceDescriptor"; + }; + + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceReference + * @function getTypeUrl + * @memberof google.api.ResourceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceReference"; + }; + + return ResourceReference; + })(); + + api.FieldInfo = (function() { + + /** + * Properties of a FieldInfo. + * @memberof google.api + * @interface IFieldInfo + * @property {google.api.FieldInfo.Format|null} [format] FieldInfo format + * @property {Array.|null} [referencedTypes] FieldInfo referencedTypes + */ + + /** + * Constructs a new FieldInfo. + * @memberof google.api + * @classdesc Represents a FieldInfo. + * @implements IFieldInfo + * @constructor + * @param {google.api.IFieldInfo=} [properties] Properties to set + */ + function FieldInfo(properties) { + this.referencedTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldInfo format. + * @member {google.api.FieldInfo.Format} format + * @memberof google.api.FieldInfo + * @instance + */ + FieldInfo.prototype.format = 0; + + /** + * FieldInfo referencedTypes. + * @member {Array.} referencedTypes + * @memberof google.api.FieldInfo + * @instance + */ + FieldInfo.prototype.referencedTypes = $util.emptyArray; + + /** + * Creates a new FieldInfo instance using the specified properties. + * @function create + * @memberof google.api.FieldInfo + * @static + * @param {google.api.IFieldInfo=} [properties] Properties to set + * @returns {google.api.FieldInfo} FieldInfo instance + */ + FieldInfo.create = function create(properties) { + return new FieldInfo(properties); + }; + + /** + * Encodes the specified FieldInfo message. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. + * @function encode + * @memberof google.api.FieldInfo + * @static + * @param {google.api.IFieldInfo} message FieldInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.format != null && Object.hasOwnProperty.call(message, "format")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.format); + if (message.referencedTypes != null && message.referencedTypes.length) + for (var i = 0; i < message.referencedTypes.length; ++i) + $root.google.api.TypeReference.encode(message.referencedTypes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldInfo message, length delimited. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.FieldInfo + * @static + * @param {google.api.IFieldInfo} message FieldInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldInfo message from the specified reader or buffer. + * @function decode + * @memberof google.api.FieldInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.FieldInfo} FieldInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldInfo.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.FieldInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.format = reader.int32(); + break; + } + case 2: { + if (!(message.referencedTypes && message.referencedTypes.length)) + message.referencedTypes = []; + message.referencedTypes.push($root.google.api.TypeReference.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.FieldInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.FieldInfo} FieldInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldInfo message. + * @function verify + * @memberof google.api.FieldInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.format != null && message.hasOwnProperty("format")) + switch (message.format) { + default: + return "format: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + if (message.referencedTypes != null && message.hasOwnProperty("referencedTypes")) { + if (!Array.isArray(message.referencedTypes)) + return "referencedTypes: array expected"; + for (var i = 0; i < message.referencedTypes.length; ++i) { + var error = $root.google.api.TypeReference.verify(message.referencedTypes[i]); + if (error) + return "referencedTypes." + error; + } + } + return null; + }; + + /** + * Creates a FieldInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.FieldInfo + * @static + * @param {Object.} object Plain object + * @returns {google.api.FieldInfo} FieldInfo + */ + FieldInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.FieldInfo) + return object; + var message = new $root.google.api.FieldInfo(); + switch (object.format) { + default: + if (typeof object.format === "number") { + message.format = object.format; + break; + } + break; + case "FORMAT_UNSPECIFIED": + case 0: + message.format = 0; + break; + case "UUID4": + case 1: + message.format = 1; + break; + case "IPV4": + case 2: + message.format = 2; + break; + case "IPV6": + case 3: + message.format = 3; + break; + case "IPV4_OR_IPV6": + case 4: + message.format = 4; + break; + } + if (object.referencedTypes) { + if (!Array.isArray(object.referencedTypes)) + throw TypeError(".google.api.FieldInfo.referencedTypes: array expected"); + message.referencedTypes = []; + for (var i = 0; i < object.referencedTypes.length; ++i) { + if (typeof object.referencedTypes[i] !== "object") + throw TypeError(".google.api.FieldInfo.referencedTypes: object expected"); + message.referencedTypes[i] = $root.google.api.TypeReference.fromObject(object.referencedTypes[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FieldInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.FieldInfo + * @static + * @param {google.api.FieldInfo} message FieldInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.referencedTypes = []; + if (options.defaults) + object.format = options.enums === String ? "FORMAT_UNSPECIFIED" : 0; + if (message.format != null && message.hasOwnProperty("format")) + object.format = options.enums === String ? $root.google.api.FieldInfo.Format[message.format] === undefined ? message.format : $root.google.api.FieldInfo.Format[message.format] : message.format; + if (message.referencedTypes && message.referencedTypes.length) { + object.referencedTypes = []; + for (var j = 0; j < message.referencedTypes.length; ++j) + object.referencedTypes[j] = $root.google.api.TypeReference.toObject(message.referencedTypes[j], options); + } + return object; + }; + + /** + * Converts this FieldInfo to JSON. + * @function toJSON + * @memberof google.api.FieldInfo + * @instance + * @returns {Object.} JSON object + */ + FieldInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldInfo + * @function getTypeUrl + * @memberof google.api.FieldInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.FieldInfo"; + }; + + /** + * Format enum. + * @name google.api.FieldInfo.Format + * @enum {number} + * @property {number} FORMAT_UNSPECIFIED=0 FORMAT_UNSPECIFIED value + * @property {number} UUID4=1 UUID4 value + * @property {number} IPV4=2 IPV4 value + * @property {number} IPV6=3 IPV6 value + * @property {number} IPV4_OR_IPV6=4 IPV4_OR_IPV6 value + */ + FieldInfo.Format = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FORMAT_UNSPECIFIED"] = 0; + values[valuesById[1] = "UUID4"] = 1; + values[valuesById[2] = "IPV4"] = 2; + values[valuesById[3] = "IPV6"] = 3; + values[valuesById[4] = "IPV4_OR_IPV6"] = 4; + return values; + })(); + + return FieldInfo; + })(); + + api.TypeReference = (function() { + + /** + * Properties of a TypeReference. + * @memberof google.api + * @interface ITypeReference + * @property {string|null} [typeName] TypeReference typeName + */ + + /** + * Constructs a new TypeReference. + * @memberof google.api + * @classdesc Represents a TypeReference. + * @implements ITypeReference + * @constructor + * @param {google.api.ITypeReference=} [properties] Properties to set + */ + function TypeReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TypeReference typeName. + * @member {string} typeName + * @memberof google.api.TypeReference + * @instance + */ + TypeReference.prototype.typeName = ""; + + /** + * Creates a new TypeReference instance using the specified properties. + * @function create + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference=} [properties] Properties to set + * @returns {google.api.TypeReference} TypeReference instance + */ + TypeReference.create = function create(properties) { + return new TypeReference(properties); + }; + + /** + * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @function encode + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference} message TypeReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TypeReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.typeName); + return writer; + }; + + /** + * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference} message TypeReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TypeReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TypeReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.TypeReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.TypeReference} TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TypeReference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.TypeReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.typeName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TypeReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.TypeReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.TypeReference} TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TypeReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TypeReference message. + * @function verify + * @memberof google.api.TypeReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TypeReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + return null; + }; + + /** + * Creates a TypeReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.TypeReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.TypeReference} TypeReference + */ + TypeReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.TypeReference) + return object; + var message = new $root.google.api.TypeReference(); + if (object.typeName != null) + message.typeName = String(object.typeName); + return message; + }; + + /** + * Creates a plain object from a TypeReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.TypeReference + * @static + * @param {google.api.TypeReference} message TypeReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TypeReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.typeName = ""; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + return object; + }; + + /** + * Converts this TypeReference to JSON. + * @function toJSON + * @memberof google.api.TypeReference + * @instance + * @returns {Object.} JSON object + */ + TypeReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TypeReference + * @function getTypeUrl + * @memberof google.api.TypeReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TypeReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.TypeReference"; + }; + + return TypeReference; + })(); + + return api; + })(); + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + var protobuf = {}; + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.|null} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @implements IFileDescriptorSet + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.} file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + */ + FileDescriptorSet.create = function create(properties) { + return new FileDescriptorSet(properties); + }; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && message.file.length) + for (var i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (var i = 0; i < message.file.length; ++i) { + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + var message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (var i = 0; i < object.file.length; ++i) { + if (typeof object.file[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (var j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorSet + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; + }; + + return FileDescriptorSet; + })(); + + /** + * Edition enum. + * @name google.protobuf.Edition + * @enum {number} + * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value + * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value + * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value + * @property {number} EDITION_2023=1000 EDITION_2023 value + * @property {number} EDITION_2024=1001 EDITION_2024 value + * @property {number} EDITION_1_TEST_ONLY=1 EDITION_1_TEST_ONLY value + * @property {number} EDITION_2_TEST_ONLY=2 EDITION_2_TEST_ONLY value + * @property {number} EDITION_99997_TEST_ONLY=99997 EDITION_99997_TEST_ONLY value + * @property {number} EDITION_99998_TEST_ONLY=99998 EDITION_99998_TEST_ONLY value + * @property {number} EDITION_99999_TEST_ONLY=99999 EDITION_99999_TEST_ONLY value + * @property {number} EDITION_MAX=2147483647 EDITION_MAX value + */ + protobuf.Edition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; + values[valuesById[998] = "EDITION_PROTO2"] = 998; + values[valuesById[999] = "EDITION_PROTO3"] = 999; + values[valuesById[1000] = "EDITION_2023"] = 1000; + values[valuesById[1001] = "EDITION_2024"] = 1001; + values[valuesById[1] = "EDITION_1_TEST_ONLY"] = 1; + values[valuesById[2] = "EDITION_2_TEST_ONLY"] = 2; + values[valuesById[99997] = "EDITION_99997_TEST_ONLY"] = 99997; + values[valuesById[99998] = "EDITION_99998_TEST_ONLY"] = 99998; + values[valuesById[99999] = "EDITION_99999_TEST_ONLY"] = 99999; + values[valuesById[2147483647] = "EDITION_MAX"] = 2147483647; + return values; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string|null} [name] FileDescriptorProto name + * @property {string|null} ["package"] FileDescriptorProto package + * @property {Array.|null} [dependency] FileDescriptorProto dependency + * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency + * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency + * @property {Array.|null} [messageType] FileDescriptorProto messageType + * @property {Array.|null} [enumType] FileDescriptorProto enumType + * @property {Array.|null} [service] FileDescriptorProto service + * @property {Array.|null} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo + * @property {string|null} [syntax] FileDescriptorProto syntax + * @property {google.protobuf.Edition|null} [edition] FileDescriptorProto edition + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @implements IFileDescriptorProto + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.publicDependency = []; + this.weakDependency = []; + this.optionDependency = []; + this.messageType = []; + this.enumType = []; + this.service = []; + this.extension = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string} package + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.} dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto publicDependency. + * @member {Array.} publicDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + + /** + * FileDescriptorProto weakDependency. + * @member {Array.} weakDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + + /** + * FileDescriptorProto messageType. + * @member {Array.} messageType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.messageType = $util.emptyArray; + + /** + * FileDescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.} service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {google.protobuf.IFileOptions|null|undefined} options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto sourceCodeInfo. + * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.sourceCodeInfo = null; + + /** + * FileDescriptorProto syntax. + * @member {string} syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * FileDescriptorProto edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = 0; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + */ + FileDescriptorProto.create = function create(properties) { + return new FileDescriptorProto(properties); + }; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); + if (message.dependency != null && message.dependency.length) + for (var i = 0; i < message.dependency.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); + if (message.messageType != null && message.messageType.length) + for (var i = 0; i < message.messageType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.service != null && message.service.length) + for (var i = 0; i < message.service.length; ++i) + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) + $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.publicDependency != null && message.publicDependency.length) + for (var i = 0; i < message.publicDependency.length; ++i) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); + if (message.weakDependency != null && message.weakDependency.length) + for (var i = 0; i < message.weakDependency.length; ++i) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message["package"] = reader.string(); + break; + } + case 3: { + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + } + case 10: { + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else + message.publicDependency.push(reader.int32()); + break; + } + case 11: { + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else + message.weakDependency.push(reader.int32()); + break; + } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } + case 4: { + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 8: { + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + } + case 12: { + message.syntax = reader.string(); + break; + } + case 14: { + message.edition = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message["package"] != null && message.hasOwnProperty("package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (var i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { + if (!Array.isArray(message.publicDependency)) + return "publicDependency: array expected"; + for (var i = 0; i < message.publicDependency.length; ++i) + if (!$util.isInteger(message.publicDependency[i])) + return "publicDependency: integer[] expected"; + } + if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { + if (!Array.isArray(message.weakDependency)) + return "weakDependency: array expected"; + for (var i = 0; i < message.weakDependency.length; ++i) + if (!$util.isInteger(message.weakDependency[i])) + return "weakDependency: integer[] expected"; + } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + if (!Array.isArray(message.messageType)) + return "messageType: array expected"; + for (var i = 0; i < message.messageType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); + if (error) + return "messageType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.service != null && message.hasOwnProperty("service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (var i = 0; i < message.service.length; ++i) { + var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + if (error) + return "service." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FileOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { + var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); + if (error) + return "sourceCodeInfo." + error; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + var message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (var i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.publicDependency) { + if (!Array.isArray(object.publicDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); + message.publicDependency = []; + for (var i = 0; i < object.publicDependency.length; ++i) + message.publicDependency[i] = object.publicDependency[i] | 0; + } + if (object.weakDependency) { + if (!Array.isArray(object.weakDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); + message.weakDependency = []; + for (var i = 0; i < object.weakDependency.length; ++i) + message.weakDependency[i] = object.weakDependency[i] | 0; + } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } + if (object.messageType) { + if (!Array.isArray(object.messageType)) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); + message.messageType = []; + for (var i = 0; i < object.messageType.length; ++i) { + if (typeof object.messageType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (var i = 0; i < object.service.length; ++i) { + if (typeof object.service[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + } + if (object.sourceCodeInfo != null) { + if (typeof object.sourceCodeInfo !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.messageType = []; + object.enumType = []; + object.service = []; + object.extension = []; + object.publicDependency = []; + object.weakDependency = []; + object.optionDependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.sourceCodeInfo = null; + object.syntax = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message["package"] != null && message.hasOwnProperty("package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (var j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.messageType && message.messageType.length) { + object.messageType = []; + for (var j = 0; j < message.messageType.length; ++j) + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.service && message.service.length) { + object.service = []; + for (var j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); + if (message.publicDependency && message.publicDependency.length) { + object.publicDependency = []; + for (var j = 0; j < message.publicDependency.length; ++j) + object.publicDependency[j] = message.publicDependency[j]; + } + if (message.weakDependency && message.weakDependency.length) { + object.weakDependency = []; + for (var j = 0; j < message.weakDependency.length; ++j) + object.weakDependency[j] = message.weakDependency[j]; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + object.syntax = message.syntax; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nestedType] DescriptorProto nestedType + * @property {Array.|null} [enumType] DescriptorProto enumType + * @property {Array.|null} [extensionRange] DescriptorProto extensionRange + * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reservedRange] DescriptorProto reservedRange + * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.field != null && message.field.length) + for (var i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nestedType != null && message.nestedType.length) + for (var i = 0; i < message.nestedType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.extensionRange != null && message.extensionRange.length) + for (var i = 0; i < message.extensionRange.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + case 11: { + message.visibility = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (typeof object.nestedType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (typeof object.extensionRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (typeof object.oneofDecl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto"; + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * ExtensionRange options. + * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.options = null; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + object.options = null; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReservedRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.ExtensionRangeOptions = (function() { + + /** + * Properties of an ExtensionRangeOptions. + * @memberof google.protobuf + * @interface IExtensionRangeOptions + * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption + * @property {Array.|null} [declaration] ExtensionRangeOptions declaration + * @property {google.protobuf.IFeatureSet|null} [features] ExtensionRangeOptions features + * @property {google.protobuf.ExtensionRangeOptions.VerificationState|null} [verification] ExtensionRangeOptions verification + */ + + /** + * Constructs a new ExtensionRangeOptions. + * @memberof google.protobuf + * @classdesc Represents an ExtensionRangeOptions. + * @implements IExtensionRangeOptions + * @constructor + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + */ + function ExtensionRangeOptions(properties) { + this.uninterpretedOption = []; + this.declaration = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRangeOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ExtensionRangeOptions declaration. + * @member {Array.} declaration + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.declaration = $util.emptyArray; + + /** + * ExtensionRangeOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.features = null; + + /** + * ExtensionRangeOptions verification. + * @member {google.protobuf.ExtensionRangeOptions.VerificationState} verification + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.verification = 1; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance + */ + ExtensionRangeOptions.create = function create(properties) { + return new ExtensionRangeOptions(properties); + }; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.declaration != null && message.declaration.length) + for (var i = 0; i < message.declaration.length; ++i) + $root.google.protobuf.ExtensionRangeOptions.Declaration.encode(message.declaration[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.verification); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.declaration && message.declaration.length)) + message.declaration = []; + message.declaration.push($root.google.protobuf.ExtensionRangeOptions.Declaration.decode(reader, reader.uint32())); + break; + } + case 50: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 3: { + message.verification = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRangeOptions message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRangeOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message.declaration != null && message.hasOwnProperty("declaration")) { + if (!Array.isArray(message.declaration)) + return "declaration: array expected"; + for (var i = 0; i < message.declaration.length; ++i) { + var error = $root.google.protobuf.ExtensionRangeOptions.Declaration.verify(message.declaration[i]); + if (error) + return "declaration." + error; + } + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.verification != null && message.hasOwnProperty("verification")) + switch (message.verification) { + default: + return "verification: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + */ + ExtensionRangeOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object.declaration) { + if (!Array.isArray(object.declaration)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: array expected"); + message.declaration = []; + for (var i = 0; i < object.declaration.length; ++i) { + if (typeof object.declaration[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: object expected"); + message.declaration[i] = $root.google.protobuf.ExtensionRangeOptions.Declaration.fromObject(object.declaration[i]); + } + } + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + switch (object.verification) { + case "DECLARATION": + case 0: + message.verification = 0; + break; + default: + if (typeof object.verification === "number") { + message.verification = object.verification; + break; + } + break; + case "UNVERIFIED": + case 1: + message.verification = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRangeOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.declaration = []; + object.uninterpretedOption = []; + } + if (options.defaults) { + object.verification = options.enums === String ? "UNVERIFIED" : 1; + object.features = null; + } + if (message.declaration && message.declaration.length) { + object.declaration = []; + for (var j = 0; j < message.declaration.length; ++j) + object.declaration[j] = $root.google.protobuf.ExtensionRangeOptions.Declaration.toObject(message.declaration[j], options); + } + if (message.verification != null && message.hasOwnProperty("verification")) + object.verification = options.enums === String ? $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] === undefined ? message.verification : $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] : message.verification; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + * @returns {Object.} JSON object + */ + ExtensionRangeOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; + }; + + ExtensionRangeOptions.Declaration = (function() { + + /** + * Properties of a Declaration. + * @memberof google.protobuf.ExtensionRangeOptions + * @interface IDeclaration + * @property {number|null} [number] Declaration number + * @property {string|null} [fullName] Declaration fullName + * @property {string|null} [type] Declaration type + * @property {boolean|null} [reserved] Declaration reserved + * @property {boolean|null} [repeated] Declaration repeated + */ + + /** + * Constructs a new Declaration. + * @memberof google.protobuf.ExtensionRangeOptions + * @classdesc Represents a Declaration. + * @implements IDeclaration + * @constructor + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set + */ + function Declaration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Declaration number. + * @member {number} number + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.number = 0; + + /** + * Declaration fullName. + * @member {string} fullName + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.fullName = ""; + + /** + * Declaration type. + * @member {string} type + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.type = ""; + + /** + * Declaration reserved. + * @member {boolean} reserved + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.reserved = false; + + /** + * Declaration repeated. + * @member {boolean} repeated + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.repeated = false; + + /** + * Creates a new Declaration instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration instance + */ + Declaration.create = function create(properties) { + return new Declaration(properties); + }; + + /** + * Encodes the specified Declaration message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Declaration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.number); + if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.fullName); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.type); + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.reserved); + if (message.repeated != null && Object.hasOwnProperty.call(message, "repeated")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.repeated); + return writer; + }; + + /** + * Encodes the specified Declaration message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Declaration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Declaration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Declaration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.number = reader.int32(); + break; + } + case 2: { + message.fullName = reader.string(); + break; + } + case 3: { + message.type = reader.string(); + break; + } + case 5: { + message.reserved = reader.bool(); + break; + } + case 6: { + message.repeated = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Declaration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Declaration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Declaration message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Declaration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.fullName != null && message.hasOwnProperty("fullName")) + if (!$util.isString(message.fullName)) + return "fullName: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.reserved != null && message.hasOwnProperty("reserved")) + if (typeof message.reserved !== "boolean") + return "reserved: boolean expected"; + if (message.repeated != null && message.hasOwnProperty("repeated")) + if (typeof message.repeated !== "boolean") + return "repeated: boolean expected"; + return null; + }; + + /** + * Creates a Declaration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + */ + Declaration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions.Declaration) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); + if (object.number != null) + message.number = object.number | 0; + if (object.fullName != null) + message.fullName = String(object.fullName); + if (object.type != null) + message.type = String(object.type); + if (object.reserved != null) + message.reserved = Boolean(object.reserved); + if (object.repeated != null) + message.repeated = Boolean(object.repeated); + return message; + }; + + /** + * Creates a plain object from a Declaration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.Declaration} message Declaration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Declaration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.number = 0; + object.fullName = ""; + object.type = ""; + object.reserved = false; + object.repeated = false; + } + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.fullName != null && message.hasOwnProperty("fullName")) + object.fullName = message.fullName; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.reserved != null && message.hasOwnProperty("reserved")) + object.reserved = message.reserved; + if (message.repeated != null && message.hasOwnProperty("repeated")) + object.repeated = message.repeated; + return object; + }; + + /** + * Converts this Declaration to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + * @returns {Object.} JSON object + */ + Declaration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Declaration + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Declaration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions.Declaration"; + }; + + return Declaration; + })(); + + /** + * VerificationState enum. + * @name google.protobuf.ExtensionRangeOptions.VerificationState + * @enum {number} + * @property {number} DECLARATION=0 DECLARATION value + * @property {number} UNVERIFIED=1 UNVERIFIED value + */ + ExtensionRangeOptions.VerificationState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DECLARATION"] = 0; + values[valuesById[1] = "UNVERIFIED"] = 1; + return values; + })(); + + return ExtensionRangeOptions; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [typeName] FieldDescriptorProto typeName + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue + * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string|null} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto typeName. + * @member {string} typeName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.typeName = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto defaultValue. + * @member {string} defaultValue + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.defaultValue = ""; + + /** + * FieldDescriptorProto oneofIndex. + * @member {number} oneofIndex + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneofIndex = 0; + + /** + * FieldDescriptorProto jsonName. + * @member {string} jsonName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.jsonName = ""; + + /** + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * FieldDescriptorProto proto3Optional. + * @member {boolean} proto3Optional + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.proto3Optional = false; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + */ + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(properties); + }; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.number = reader.int32(); + break; + } + case 4: { + message.label = reader.int32(); + break; + } + case 5: { + message.type = reader.int32(); + break; + } + case 6: { + message.typeName = reader.string(); + break; + } + case 2: { + message.extendee = reader.string(); + break; + } + case 7: { + message.defaultValue = reader.string(); + break; + } + case 9: { + message.oneofIndex = reader.int32(); + break; + } + case 10: { + message.jsonName = reader.string(); + break; + } + case 8: { + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + } + case 17: { + message.proto3Optional = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 3: + case 2: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + if (message.extendee != null && message.hasOwnProperty("extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (!$util.isInteger(message.oneofIndex)) + return "oneofIndex: integer expected"; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (!$util.isString(message.jsonName)) + return "jsonName: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FieldOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + } + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + if (object.proto3Optional != null) + message.proto3Optional = Boolean(object.proto3Optional); + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.typeName = ""; + object.defaultValue = ""; + object.options = null; + object.oneofIndex = 0; + object.jsonName = ""; + object.proto3Optional = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + object.jsonName = message.jsonName; + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + object.proto3Optional = message.proto3Optional; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; + }; + + /** + * Type enum. + * @name google.protobuf.FieldDescriptorProto.Type + * @enum {number} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @name google.protobuf.FieldDescriptorProto.Label + * @enum {number} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + */ + FieldDescriptorProto.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + */ + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); + }; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange + * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * EnumDescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * EnumDescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.value.length) + for (var i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + case 6: { + message.visibility = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.value = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; + }; + + EnumDescriptorProto.EnumReservedRange = (function() { + + /** + * Properties of an EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @interface IEnumReservedRange + * @property {number|null} [start] EnumReservedRange start + * @property {number|null} [end] EnumReservedRange end + */ + + /** + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange + * @constructor + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + */ + function EnumReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumReservedRange start. + * @member {number} start + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.start = 0; + + /** + * EnumReservedRange end. + * @member {number} end + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.end = 0; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + */ + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); + }; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumReservedRange message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + */ + EnumReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this EnumReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + * @returns {Object.} JSON object + */ + EnumReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumReservedRange + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; + }; + + return EnumReservedRange; + })(); + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.number = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [inputType] MethodDescriptorProto inputType + * @property {string|null} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean} serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputType = reader.string(); + break; + } + case 3: { + message.outputType = reader.string(); + break; + } + case 4: { + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.clientStreaming = reader.bool(); + break; + } + case 6: { + message.serverStreaming = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.inputType != null && message.hasOwnProperty("inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && message.hasOwnProperty("outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputType != null && message.hasOwnProperty("inputType")) + object.inputType = message.inputType; + if (message.outputType != null && message.hasOwnProperty("outputType")) + object.outputType = message.outputType; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [javaPackage] FileOptions javaPackage + * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor + * @property {string|null} [goPackage] FileOptions goPackage + * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string|null} [csharpNamespace] FileOptions csharpNamespace + * @property {string|null} [swiftPrefix] FileOptions swiftPrefix + * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix + * @property {string|null} [phpNamespace] FileOptions phpNamespace + * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace + * @property {string|null} [rubyPackage] FileOptions rubyPackage + * @property {google.protobuf.IFeatureSet|null} [features] FileOptions features + * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions javaPackage. + * @member {string} javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string} javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean} javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean} javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean} javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = true; + + /** + * FileOptions objcClassPrefix. + * @member {string} objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; + + /** + * FileOptions csharpNamespace. + * @member {string} csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; + + /** + * FileOptions swiftPrefix. + * @member {string} swiftPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.swiftPrefix = ""; + + /** + * FileOptions phpClassPrefix. + * @member {string} phpClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpClassPrefix = ""; + + /** + * FileOptions phpNamespace. + * @member {string} phpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpNamespace = ""; + + /** + * FileOptions phpMetadataNamespace. + * @member {string} phpMetadataNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpMetadataNamespace = ""; + + /** + * FileOptions rubyPackage. + * @member {string} rubyPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.rubyPackage = ""; + + /** + * FileOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.features = null; + + /** + * FileOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + + /** + * Creates a new FileOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance + */ + FileOptions.create = function create(properties) { + return new FileOptions(properties); + }; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.javaPackage = reader.string(); + break; + } + case 8: { + message.javaOuterClassname = reader.string(); + break; + } + case 10: { + message.javaMultipleFiles = reader.bool(); + break; + } + case 20: { + message.javaGenerateEqualsAndHash = reader.bool(); + break; + } + case 27: { + message.javaStringCheckUtf8 = reader.bool(); + break; + } + case 9: { + message.optimizeFor = reader.int32(); + break; + } + case 11: { + message.goPackage = reader.string(); + break; + } + case 16: { + message.ccGenericServices = reader.bool(); + break; + } + case 17: { + message.javaGenericServices = reader.bool(); + break; + } + case 18: { + message.pyGenericServices = reader.bool(); + break; + } + case 23: { + message.deprecated = reader.bool(); + break; + } + case 31: { + message.ccEnableArenas = reader.bool(); + break; + } + case 36: { + message.objcClassPrefix = reader.string(); + break; + } + case 37: { + message.csharpNamespace = reader.string(); + break; + } + case 39: { + message.swiftPrefix = reader.string(); + break; + } + case 40: { + message.phpClassPrefix = reader.string(); + break; + } + case 41: { + message.phpNamespace = reader.string(); + break; + } + case 44: { + message.phpMetadataNamespace = reader.string(); + break; + } + case 45: { + message.rubyPackage = reader.string(); + break; + } + case 50: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (!$util.isString(message.swiftPrefix)) + return "swiftPrefix: string expected"; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (!$util.isString(message.phpClassPrefix)) + return "phpClassPrefix: string expected"; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (!$util.isString(message.phpNamespace)) + return "phpNamespace: string expected"; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (!$util.isString(message.phpMetadataNamespace)) + return "phpMetadataNamespace: string expected"; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (!$util.isString(message.rubyPackage)) + return "rubyPackage: string expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; + case "SPEED": + case 1: + message.optimizeFor = 1; + break; + case "CODE_SIZE": + case 2: + message.optimizeFor = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimizeFor = 3; + break; + } + if (object.goPackage != null) + message.goPackage = String(object.goPackage); + if (object.ccGenericServices != null) + message.ccGenericServices = Boolean(object.ccGenericServices); + if (object.javaGenericServices != null) + message.javaGenericServices = Boolean(object.javaGenericServices); + if (object.pyGenericServices != null) + message.pyGenericServices = Boolean(object.pyGenericServices); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.ccEnableArenas != null) + message.ccEnableArenas = Boolean(object.ccEnableArenas); + if (object.objcClassPrefix != null) + message.objcClassPrefix = String(object.objcClassPrefix); + if (object.csharpNamespace != null) + message.csharpNamespace = String(object.csharpNamespace); + if (object.swiftPrefix != null) + message.swiftPrefix = String(object.swiftPrefix); + if (object.phpClassPrefix != null) + message.phpClassPrefix = String(object.phpClassPrefix); + if (object.phpNamespace != null) + message.phpNamespace = String(object.phpNamespace); + if (object.phpMetadataNamespace != null) + message.phpMetadataNamespace = String(object.phpMetadataNamespace); + if (object.rubyPackage != null) + message.rubyPackage = String(object.rubyPackage); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.FileOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (typeof object[".google.api.resourceDefinition"][i] !== "object") + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } + if (options.defaults) { + object.javaPackage = ""; + object.javaOuterClassname = ""; + object.optimizeFor = options.enums === String ? "SPEED" : 1; + object.javaMultipleFiles = false; + object.goPackage = ""; + object.ccGenericServices = false; + object.javaGenericServices = false; + object.pyGenericServices = false; + object.javaGenerateEqualsAndHash = false; + object.deprecated = false; + object.javaStringCheckUtf8 = false; + object.ccEnableArenas = true; + object.objcClassPrefix = ""; + object.csharpNamespace = ""; + object.swiftPrefix = ""; + object.phpClassPrefix = ""; + object.phpNamespace = ""; + object.phpMetadataNamespace = ""; + object.rubyPackage = ""; + object.features = null; + } + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + object.javaPackage = message.javaPackage; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + object.javaOuterClassname = message.javaOuterClassname; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + object.javaMultipleFiles = message.javaMultipleFiles; + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + object.swiftPrefix = message.swiftPrefix; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + object.phpClassPrefix = message.phpClassPrefix; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + object.phpNamespace = message.phpNamespace; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + object.phpMetadataNamespace = message.phpMetadataNamespace; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + object.rubyPackage = message.rubyPackage; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileOptions + * @function getTypeUrl + * @memberof google.protobuf.FileOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileOptions"; + }; + + /** + * OptimizeMode enum. + * @name google.protobuf.FileOptions.OptimizeMode + * @enum {number} + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value + */ + FileOptions.OptimizeMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; + return values; + })(); + + return FileOptions; + })(); + + protobuf.MessageOptions = (function() { + + /** + * Properties of a MessageOptions. + * @memberof google.protobuf + * @interface IMessageOptions + * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat + * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor + * @property {boolean|null} [deprecated] MessageOptions deprecated + * @property {boolean|null} [mapEntry] MessageOptions mapEntry + * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] MessageOptions deprecatedLegacyJsonFieldConflicts + * @property {google.protobuf.IFeatureSet|null} [features] MessageOptions features + * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource + */ + + /** + * Constructs a new MessageOptions. + * @memberof google.protobuf + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions + * @constructor + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + */ + function MessageOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageOptions messageSetWireFormat. + * @member {boolean} messageSetWireFormat + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.messageSetWireFormat = false; + + /** + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean} noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.noStandardDescriptorAccessor = false; + + /** + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecated = false; + + /** + * MessageOptions mapEntry. + * @member {boolean} mapEntry + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.mapEntry = false; + + /** + * MessageOptions deprecatedLegacyJsonFieldConflicts. + * @member {boolean} deprecatedLegacyJsonFieldConflicts + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; + + /** + * MessageOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.features = null; + + /** + * MessageOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".google.api.resource"] = null; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance + */ + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); + }; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.deprecatedLegacyJsonFieldConflicts); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.messageSetWireFormat = reader.bool(); + break; + } + case 2: { + message.noStandardDescriptorAccessor = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 7: { + message.mapEntry = reader.bool(); + break; + } + case 11: { + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; + } + case 12: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") + return "deprecatedLegacyJsonFieldConflicts: boolean expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + if (error) + return ".google.api.resource." + error; + } + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.deprecatedLegacyJsonFieldConflicts != null) + message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.MessageOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + } + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object.deprecatedLegacyJsonFieldConflicts = false; + object.features = null; + object[".google.api.resource"] = null; + } + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + object.mapEntry = message.mapEntry; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MessageOptions + * @function getTypeUrl + * @memberof google.protobuf.MessageOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MessageOptions"; + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype + * @property {boolean|null} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype + * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {boolean|null} [debugRedact] FieldOptions debugRedact + * @property {google.protobuf.FieldOptions.OptionRetention|null} [retention] FieldOptions retention + * @property {Array.|null} [targets] FieldOptions targets + * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults + * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport + * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption + * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + * @property {google.api.IFieldInfo|null} [".google.api.fieldInfo"] FieldOptions .google.api.fieldInfo + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.targets = []; + this.editionDefaults = []; + this.uninterpretedOption = []; + this[".google.api.fieldBehavior"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions debugRedact. + * @member {boolean} debugRedact + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.debugRedact = false; + + /** + * FieldOptions retention. + * @member {google.protobuf.FieldOptions.OptionRetention} retention + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.retention = 0; + + /** + * FieldOptions targets. + * @member {Array.} targets + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.targets = $util.emptyArray; + + /** + * FieldOptions editionDefaults. + * @member {Array.} editionDefaults + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.editionDefaults = $util.emptyArray; + + /** + * FieldOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.features = null; + + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + + /** + * FieldOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FieldOptions .google.api.fieldBehavior. + * @member {Array.} .google.api.fieldBehavior + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + + /** + * FieldOptions .google.api.fieldInfo. + * @member {google.api.IFieldInfo|null|undefined} .google.api.fieldInfo + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldInfo"] = null; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.debugRedact); + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) + writer.uint32(/* id 17, wireType 0 =*/136).int32(message.retention); + if (message.targets != null && message.targets.length) + for (var i = 0; i < message.targets.length; ++i) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.targets[i]); + if (message.editionDefaults != null && message.editionDefaults.length) + for (var i = 0; i < message.editionDefaults.length; ++i) + $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + writer.uint32(/* id 1052, wireType 0 =*/8416).int32(message[".google.api.fieldBehavior"][i]); + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + if (message[".google.api.fieldInfo"] != null && Object.hasOwnProperty.call(message, ".google.api.fieldInfo")) + $root.google.api.FieldInfo.encode(message[".google.api.fieldInfo"], writer.uint32(/* id 291403980, wireType 2 =*/2331231842).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.ctype = reader.int32(); + break; + } + case 2: { + message.packed = reader.bool(); + break; + } + case 6: { + message.jstype = reader.int32(); + break; + } + case 5: { + message.lazy = reader.bool(); + break; + } + case 15: { + message.unverifiedLazy = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 10: { + message.weak = reader.bool(); + break; + } + case 16: { + message.debugRedact = reader.bool(); + break; + } + case 17: { + message.retention = reader.int32(); + break; + } + case 19: { + if (!(message.targets && message.targets.length)) + message.targets = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.targets.push(reader.int32()); + } else + message.targets.push(reader.int32()); + break; + } + case 20: { + if (!(message.editionDefaults && message.editionDefaults.length)) + message.editionDefaults = []; + message.editionDefaults.push($root.google.protobuf.FieldOptions.EditionDefault.decode(reader, reader.uint32())); + break; + } + case 21: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1052: { + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else + message[".google.api.fieldBehavior"].push(reader.int32()); + break; + } + case 1055: { + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + } + case 291403980: { + message[".google.api.fieldInfo"] = $root.google.api.FieldInfo.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (typeof message.unverifiedLazy !== "boolean") + return "unverifiedLazy: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && message.hasOwnProperty("weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + if (typeof message.debugRedact !== "boolean") + return "debugRedact: boolean expected"; + if (message.retention != null && message.hasOwnProperty("retention")) + switch (message.retention) { + default: + return "retention: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.targets != null && message.hasOwnProperty("targets")) { + if (!Array.isArray(message.targets)) + return "targets: array expected"; + for (var i = 0; i < message.targets.length; ++i) + switch (message.targets[i]) { + default: + return "targets: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + break; + } + } + if (message.editionDefaults != null && message.hasOwnProperty("editionDefaults")) { + if (!Array.isArray(message.editionDefaults)) + return "editionDefaults: array expected"; + for (var i = 0; i < message.editionDefaults.length; ++i) { + var error = $root.google.protobuf.FieldOptions.EditionDefault.verify(message.editionDefaults[i]); + if (error) + return "editionDefaults." + error; + } + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { + if (!Array.isArray(message[".google.api.fieldBehavior"])) + return ".google.api.fieldBehavior: array expected"; + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + switch (message[".google.api.fieldBehavior"][i]) { + default: + return ".google.api.fieldBehavior: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } + if (message[".google.api.fieldInfo"] != null && message.hasOwnProperty(".google.api.fieldInfo")) { + var error = $root.google.api.FieldInfo.verify(message[".google.api.fieldInfo"]); + if (error) + return ".google.api.fieldInfo." + error; + } + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; + break; + } + break; + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.debugRedact != null) + message.debugRedact = Boolean(object.debugRedact); + switch (object.retention) { + default: + if (typeof object.retention === "number") { + message.retention = object.retention; + break; + } + break; + case "RETENTION_UNKNOWN": + case 0: + message.retention = 0; + break; + case "RETENTION_RUNTIME": + case 1: + message.retention = 1; + break; + case "RETENTION_SOURCE": + case 2: + message.retention = 2; + break; + } + if (object.targets) { + if (!Array.isArray(object.targets)) + throw TypeError(".google.protobuf.FieldOptions.targets: array expected"); + message.targets = []; + for (var i = 0; i < object.targets.length; ++i) + switch (object.targets[i]) { + default: + if (typeof object.targets[i] === "number") { + message.targets[i] = object.targets[i]; + break; + } + case "TARGET_TYPE_UNKNOWN": + case 0: + message.targets[i] = 0; + break; + case "TARGET_TYPE_FILE": + case 1: + message.targets[i] = 1; + break; + case "TARGET_TYPE_EXTENSION_RANGE": + case 2: + message.targets[i] = 2; + break; + case "TARGET_TYPE_MESSAGE": + case 3: + message.targets[i] = 3; + break; + case "TARGET_TYPE_FIELD": + case 4: + message.targets[i] = 4; + break; + case "TARGET_TYPE_ONEOF": + case 5: + message.targets[i] = 5; + break; + case "TARGET_TYPE_ENUM": + case 6: + message.targets[i] = 6; + break; + case "TARGET_TYPE_ENUM_ENTRY": + case 7: + message.targets[i] = 7; + break; + case "TARGET_TYPE_SERVICE": + case 8: + message.targets[i] = 8; + break; + case "TARGET_TYPE_METHOD": + case 9: + message.targets[i] = 9; + break; + } + } + if (object.editionDefaults) { + if (!Array.isArray(object.editionDefaults)) + throw TypeError(".google.protobuf.FieldOptions.editionDefaults: array expected"); + message.editionDefaults = []; + for (var i = 0; i < object.editionDefaults.length; ++i) { + if (typeof object.editionDefaults[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.editionDefaults: object expected"); + message.editionDefaults[i] = $root.google.protobuf.FieldOptions.EditionDefault.fromObject(object.editionDefaults[i]); + } + } + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.FieldOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.fieldBehavior"]) { + if (!Array.isArray(object[".google.api.fieldBehavior"])) + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); + message[".google.api.fieldBehavior"] = []; + for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) + switch (object[".google.api.fieldBehavior"][i]) { + default: + if (typeof object[".google.api.fieldBehavior"][i] === "number") { + message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; + break; + } + case "FIELD_BEHAVIOR_UNSPECIFIED": + case 0: + message[".google.api.fieldBehavior"][i] = 0; + break; + case "OPTIONAL": + case 1: + message[".google.api.fieldBehavior"][i] = 1; + break; + case "REQUIRED": + case 2: + message[".google.api.fieldBehavior"][i] = 2; + break; + case "OUTPUT_ONLY": + case 3: + message[".google.api.fieldBehavior"][i] = 3; + break; + case "INPUT_ONLY": + case 4: + message[".google.api.fieldBehavior"][i] = 4; + break; + case "IMMUTABLE": + case 5: + message[".google.api.fieldBehavior"][i] = 5; + break; + case "UNORDERED_LIST": + case 6: + message[".google.api.fieldBehavior"][i] = 6; + break; + case "NON_EMPTY_DEFAULT": + case 7: + message[".google.api.fieldBehavior"][i] = 7; + break; + case "IDENTIFIER": + case 8: + message[".google.api.fieldBehavior"][i] = 8; + break; + } + } + if (object[".google.api.resourceReference"] != null) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + } + if (object[".google.api.fieldInfo"] != null) { + if (typeof object[".google.api.fieldInfo"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldInfo: object expected"); + message[".google.api.fieldInfo"] = $root.google.api.FieldInfo.fromObject(object[".google.api.fieldInfo"]); + } + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.targets = []; + object.editionDefaults = []; + object.uninterpretedOption = []; + object[".google.api.fieldBehavior"] = []; + } + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object.unverifiedLazy = false; + object.debugRedact = false; + object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; + object.features = null; + object.featureSupport = null; + object[".google.api.resourceReference"] = null; + object[".google.api.fieldInfo"] = null; + } + if (message.ctype != null && message.hasOwnProperty("ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && message.hasOwnProperty("packed")) + object.packed = message.packed; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && message.hasOwnProperty("lazy")) + object.lazy = message.lazy; + if (message.jstype != null && message.hasOwnProperty("jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && message.hasOwnProperty("weak")) + object.weak = message.weak; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + object.unverifiedLazy = message.unverifiedLazy; + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + object.debugRedact = message.debugRedact; + if (message.retention != null && message.hasOwnProperty("retention")) + object.retention = options.enums === String ? $root.google.protobuf.FieldOptions.OptionRetention[message.retention] === undefined ? message.retention : $root.google.protobuf.FieldOptions.OptionRetention[message.retention] : message.retention; + if (message.targets && message.targets.length) { + object.targets = []; + for (var j = 0; j < message.targets.length; ++j) + object.targets[j] = options.enums === String ? $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] === undefined ? message.targets[j] : $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] : message.targets[j]; + } + if (message.editionDefaults && message.editionDefaults.length) { + object.editionDefaults = []; + for (var j = 0; j < message.editionDefaults.length; ++j) + object.editionDefaults[j] = $root.google.protobuf.FieldOptions.EditionDefault.toObject(message.editionDefaults[j], options); + } + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { + object[".google.api.fieldBehavior"] = []; + for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + if (message[".google.api.fieldInfo"] != null && message.hasOwnProperty(".google.api.fieldInfo")) + object[".google.api.fieldInfo"] = $root.google.api.FieldInfo.toObject(message[".google.api.fieldInfo"], options); + return object; + }; + + /** + * Converts this FieldOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions + * @instance + * @returns {Object.} JSON object + */ + FieldOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldOptions + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions"; + }; + + /** + * CType enum. + * @name google.protobuf.FieldOptions.CType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value + */ + FieldOptions.CType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); + + /** + * JSType enum. + * @name google.protobuf.FieldOptions.JSType + * @enum {number} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + /** + * OptionRetention enum. + * @name google.protobuf.FieldOptions.OptionRetention + * @enum {number} + * @property {number} RETENTION_UNKNOWN=0 RETENTION_UNKNOWN value + * @property {number} RETENTION_RUNTIME=1 RETENTION_RUNTIME value + * @property {number} RETENTION_SOURCE=2 RETENTION_SOURCE value + */ + FieldOptions.OptionRetention = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETENTION_UNKNOWN"] = 0; + values[valuesById[1] = "RETENTION_RUNTIME"] = 1; + values[valuesById[2] = "RETENTION_SOURCE"] = 2; + return values; + })(); + + /** + * OptionTargetType enum. + * @name google.protobuf.FieldOptions.OptionTargetType + * @enum {number} + * @property {number} TARGET_TYPE_UNKNOWN=0 TARGET_TYPE_UNKNOWN value + * @property {number} TARGET_TYPE_FILE=1 TARGET_TYPE_FILE value + * @property {number} TARGET_TYPE_EXTENSION_RANGE=2 TARGET_TYPE_EXTENSION_RANGE value + * @property {number} TARGET_TYPE_MESSAGE=3 TARGET_TYPE_MESSAGE value + * @property {number} TARGET_TYPE_FIELD=4 TARGET_TYPE_FIELD value + * @property {number} TARGET_TYPE_ONEOF=5 TARGET_TYPE_ONEOF value + * @property {number} TARGET_TYPE_ENUM=6 TARGET_TYPE_ENUM value + * @property {number} TARGET_TYPE_ENUM_ENTRY=7 TARGET_TYPE_ENUM_ENTRY value + * @property {number} TARGET_TYPE_SERVICE=8 TARGET_TYPE_SERVICE value + * @property {number} TARGET_TYPE_METHOD=9 TARGET_TYPE_METHOD value + */ + FieldOptions.OptionTargetType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TARGET_TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "TARGET_TYPE_FILE"] = 1; + values[valuesById[2] = "TARGET_TYPE_EXTENSION_RANGE"] = 2; + values[valuesById[3] = "TARGET_TYPE_MESSAGE"] = 3; + values[valuesById[4] = "TARGET_TYPE_FIELD"] = 4; + values[valuesById[5] = "TARGET_TYPE_ONEOF"] = 5; + values[valuesById[6] = "TARGET_TYPE_ENUM"] = 6; + values[valuesById[7] = "TARGET_TYPE_ENUM_ENTRY"] = 7; + values[valuesById[8] = "TARGET_TYPE_SERVICE"] = 8; + values[valuesById[9] = "TARGET_TYPE_METHOD"] = 9; + return values; + })(); + + FieldOptions.EditionDefault = (function() { + + /** + * Properties of an EditionDefault. + * @memberof google.protobuf.FieldOptions + * @interface IEditionDefault + * @property {google.protobuf.Edition|null} [edition] EditionDefault edition + * @property {string|null} [value] EditionDefault value + */ + + /** + * Constructs a new EditionDefault. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents an EditionDefault. + * @implements IEditionDefault + * @constructor + * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + */ + function EditionDefault(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EditionDefault edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + */ + EditionDefault.prototype.edition = 0; + + /** + * EditionDefault value. + * @member {string} value + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + */ + EditionDefault.prototype.value = ""; + + /** + * Creates a new EditionDefault instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault instance + */ + EditionDefault.create = function create(properties) { + return new EditionDefault(properties); + }; + + /** + * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + return writer; + }; + + /** + * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.edition = reader.int32(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EditionDefault message. + * @function verify + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EditionDefault.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + */ + EditionDefault.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) + return object; + var message = new $root.google.protobuf.FieldOptions.EditionDefault(); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; + + return EditionDefault; + })(); + + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.editionIntroduced = reader.int32(); + break; + } + case 2: { + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSupport message. + * @function verify + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSupport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + */ + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) + return object; + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; + break; + case "EDITION_2023": + case 1000: + message.editionRemoved = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionRemoved = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionRemoved = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionRemoved = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionRemoved = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionRemoved = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionRemoved = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionRemoved = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSupport.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; + return object; + }; + + /** + * Converts this FeatureSupport to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + * @returns {Object.} JSON object + */ + FeatureSupport.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSupport + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; + }; + + return FeatureSupport; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {google.protobuf.IFeatureSet|null} [features] OneofOptions features + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.features = null; + + /** + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + var message = new $root.google.protobuf.OneofOptions(); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.OneofOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.features = null; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofOptions + * @function getTypeUrl + * @memberof google.protobuf.OneofOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofOptions"; + }; + + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean|null} [allowAlias] EnumOptions allowAlias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] EnumOptions deprecatedLegacyJsonFieldConflicts + * @property {google.protobuf.IFeatureSet|null} [features] EnumOptions features + * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allowAlias = false; + + /** + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions deprecatedLegacyJsonFieldConflicts. + * @member {boolean} deprecatedLegacyJsonFieldConflicts + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; + + /** + * EnumOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.features = null; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance + */ + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); + }; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.deprecatedLegacyJsonFieldConflicts); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.allowAlias = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 6: { + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; + } + case 7: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") + return "deprecatedLegacyJsonFieldConflicts: boolean expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.deprecatedLegacyJsonFieldConflicts != null) + message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.EnumOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.allowAlias = false; + object.deprecated = false; + object.deprecatedLegacyJsonFieldConflicts = false; + object.features = null; + } + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumOptions"; + }; + + return EnumOptions; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features + * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.features = null; + + /** + * EnumValueOptions debugRedact. + * @member {boolean} debugRedact + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.debugRedact = false; + + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + */ + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); + }; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.deprecated = reader.bool(); + break; + } + case 2: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 3: { + message.debugRedact = reader.bool(); + break; + } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + if (typeof message.debugRedact !== "boolean") + return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.debugRedact != null) + message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object.features = null; + object.debugRedact = false; + object.featureSupport = null; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; + }; + + return EnumValueOptions; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {google.protobuf.IFeatureSet|null} [features] ServiceOptions features + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption + * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost + * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + * @property {string|null} [".google.api.apiVersion"] ServiceOptions .google.api.apiVersion + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.features = null; + + /** + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.defaultHost"] = ""; + + /** + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + + /** + * ServiceOptions .google.api.apiVersion. + * @member {string} .google.api.apiVersion + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.apiVersion"] = ""; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + */ + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); + }; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) + writer.uint32(/* id 525000001, wireType 2 =*/4200000010).string(message[".google.api.apiVersion"]); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 34: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 33: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1049: { + message[".google.api.defaultHost"] = reader.string(); + break; + } + case 1050: { + message[".google.api.oauthScopes"] = reader.string(); + break; + } + case 525000001: { + message[".google.api.apiVersion"] = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (!$util.isString(message[".google.api.defaultHost"])) + return ".google.api.defaultHost: string expected"; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (!$util.isString(message[".google.api.oauthScopes"])) + return ".google.api.oauthScopes: string expected"; + if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) + if (!$util.isString(message[".google.api.apiVersion"])) + return ".google.api.apiVersion: string expected"; + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + var message = new $root.google.protobuf.ServiceOptions(); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.ServiceOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.defaultHost"] != null) + message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); + if (object[".google.api.oauthScopes"] != null) + message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + if (object[".google.api.apiVersion"] != null) + message[".google.api.apiVersion"] = String(object[".google.api.apiVersion"]); + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object.features = null; + object[".google.api.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; + object[".google.api.apiVersion"] = ""; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) + object[".google.api.apiVersion"] = message[".google.api.apiVersion"]; + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceOptions + * @function getTypeUrl + * @memberof google.protobuf.ServiceOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceOptions"; + }; + + return ServiceOptions; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel + * @property {google.protobuf.IFeatureSet|null} [features] MethodOptions features + * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + */ + + /** + * Constructs a new MethodOptions. + * @memberof google.protobuf + * @classdesc Represents a MethodOptions. + * @implements IMethodOptions + * @constructor + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + */ + function MethodOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.methodSignature"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.deprecated = false; + + /** + * MethodOptions idempotencyLevel. + * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.idempotencyLevel = 0; + + /** + * MethodOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.features = null; + + /** + * MethodOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MethodOptions .google.api.http. + * @member {google.api.IHttpRule|null|undefined} .google.api.http + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.http"] = null; + + /** + * MethodOptions .google.api.methodSignature. + * @member {Array.} .google.api.methodSignature + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + * @returns {google.protobuf.MethodOptions} MethodOptions instance + */ + MethodOptions.create = function create(properties) { + return new MethodOptions(properties); + }; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) + writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 33: { + message.deprecated = reader.bool(); + break; + } + case 34: { + message.idempotencyLevel = reader.int32(); + break; + } + case 35: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 72295728: { + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + } + case 1051: { + if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) + message[".google.api.methodSignature"] = []; + message[".google.api.methodSignature"].push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodOptions message. + * @function verify + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + switch (message.idempotencyLevel) { + default: + return "idempotencyLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { + var error = $root.google.api.HttpRule.verify(message[".google.api.http"]); + if (error) + return ".google.api.http." + error; + } + if (message[".google.api.methodSignature"] != null && message.hasOwnProperty(".google.api.methodSignature")) { + if (!Array.isArray(message[".google.api.methodSignature"])) + return ".google.api.methodSignature: array expected"; + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + if (!$util.isString(message[".google.api.methodSignature"][i])) + return ".google.api.methodSignature: string[] expected"; + } + return null; + }; + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodOptions} MethodOptions + */ + MethodOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodOptions) + return object; + var message = new $root.google.protobuf.MethodOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + switch (object.idempotencyLevel) { + default: + if (typeof object.idempotencyLevel === "number") { + message.idempotencyLevel = object.idempotencyLevel; + break; + } + break; + case "IDEMPOTENCY_UNKNOWN": + case 0: + message.idempotencyLevel = 0; + break; + case "NO_SIDE_EFFECTS": + case 1: + message.idempotencyLevel = 1; + break; + case "IDEMPOTENT": + case 2: + message.idempotencyLevel = 2; + break; + } + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.MethodOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.http"] != null) { + if (typeof object[".google.api.http"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); + } + if (object[".google.api.methodSignature"]) { + if (!Array.isArray(object[".google.api.methodSignature"])) + throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); + message[".google.api.methodSignature"] = []; + for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) + message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); + } + return message; + }; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.MethodOptions} message MethodOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.methodSignature"] = []; + } + if (options.defaults) { + object.deprecated = false; + object.idempotencyLevel = options.enums === String ? "IDEMPOTENCY_UNKNOWN" : 0; + object.features = null; + object[".google.api.http"] = null; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { + object[".google.api.methodSignature"] = []; + for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) + object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + return object; + }; + + /** + * Converts this MethodOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MethodOptions + * @instance + * @returns {Object.} JSON object + */ + MethodOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodOptions + * @function getTypeUrl + * @memberof google.protobuf.MethodOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodOptions"; + }; + + /** + * IdempotencyLevel enum. + * @name google.protobuf.MethodOptions.IdempotencyLevel + * @enum {number} + * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value + * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value + * @property {number} IDEMPOTENT=2 IDEMPOTENT value + */ + MethodOptions.IdempotencyLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; + values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; + values[valuesById[2] = "IDEMPOTENT"] = 2; + return values; + })(); + + return MethodOptions; + })(); + + protobuf.UninterpretedOption = (function() { + + /** + * Properties of an UninterpretedOption. + * @memberof google.protobuf + * @interface IUninterpretedOption + * @property {Array.|null} [name] UninterpretedOption name + * @property {string|null} [identifierValue] UninterpretedOption identifierValue + * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue + * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue + * @property {number|null} [doubleValue] UninterpretedOption doubleValue + * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue + * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue + */ + + /** + * Constructs a new UninterpretedOption. + * @memberof google.protobuf + * @classdesc Represents an UninterpretedOption. + * @implements IUninterpretedOption + * @constructor + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + */ + function UninterpretedOption(properties) { + this.name = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UninterpretedOption name. + * @member {Array.} name + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.name = $util.emptyArray; + + /** + * UninterpretedOption identifierValue. + * @member {string} identifierValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.identifierValue = ""; + + /** + * UninterpretedOption positiveIntValue. + * @member {number|Long} positiveIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * UninterpretedOption negativeIntValue. + * @member {number|Long} negativeIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UninterpretedOption doubleValue. + * @member {number} doubleValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.doubleValue = 0; + + /** + * UninterpretedOption stringValue. + * @member {Uint8Array} stringValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.stringValue = $util.newBuffer([]); + + /** + * UninterpretedOption aggregateValue. + * @member {string} aggregateValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.aggregateValue = ""; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + */ + UninterpretedOption.create = function create(properties) { + return new UninterpretedOption(properties); + }; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.name.length) + for (var i = 0; i < message.name.length; ++i) + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); + return writer; + }; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + } + case 3: { + message.identifierValue = reader.string(); + break; + } + case 4: { + message.positiveIntValue = reader.uint64(); + break; + } + case 5: { + message.negativeIntValue = reader.int64(); + break; + } + case 6: { + message.doubleValue = reader.double(); + break; + } + case 7: { + message.stringValue = reader.bytes(); + break; + } + case 8: { + message.aggregateValue = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UninterpretedOption message. + * @function verify + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (var i = 0; i < message.name.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); + if (error) + return "name." + error; + } + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (!$util.isString(message.identifierValue)) + return "identifierValue: string expected"; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) + return "positiveIntValue: integer|Long expected"; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) + return "negativeIntValue: integer|Long expected"; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) + return "stringValue: buffer expected"; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (!$util.isString(message.aggregateValue)) + return "aggregateValue: string expected"; + return null; + }; + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + */ + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) + return object; + var message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (var i = 0; i < object.name.length; ++i) { + if (typeof object.name[i] !== "object") + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); + } + } + if (object.identifierValue != null) + message.identifierValue = String(object.identifierValue); + if (object.positiveIntValue != null) + if ($util.Long) + (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; + else if (typeof object.positiveIntValue === "string") + message.positiveIntValue = parseInt(object.positiveIntValue, 10); + else if (typeof object.positiveIntValue === "number") + message.positiveIntValue = object.positiveIntValue; + else if (typeof object.positiveIntValue === "object") + message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); + if (object.negativeIntValue != null) + if ($util.Long) + (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; + else if (typeof object.negativeIntValue === "string") + message.negativeIntValue = parseInt(object.negativeIntValue, 10); + else if (typeof object.negativeIntValue === "number") + message.negativeIntValue = object.negativeIntValue; + else if (typeof object.negativeIntValue === "object") + message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + if (typeof object.stringValue === "string") + $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); + else if (object.stringValue.length >= 0) + message.stringValue = object.stringValue; + if (object.aggregateValue != null) + message.aggregateValue = String(object.aggregateValue); + return message; + }; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UninterpretedOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.name = []; + if (options.defaults) { + object.identifierValue = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.positiveIntValue = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.negativeIntValue = options.longs === String ? "0" : 0; + object.doubleValue = 0; + if (options.bytes === String) + object.stringValue = ""; + else { + object.stringValue = []; + if (options.bytes !== Array) + object.stringValue = $util.newBuffer(object.stringValue); + } + object.aggregateValue = ""; + } + if (message.name && message.name.length) { + object.name = []; + for (var j = 0; j < message.name.length; ++j) + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + object.identifierValue = message.identifierValue; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (typeof message.positiveIntValue === "number") + object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; + else + object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (typeof message.negativeIntValue === "number") + object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; + else + object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + object.aggregateValue = message.aggregateValue; + return object; + }; + + /** + * Converts this UninterpretedOption to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption + * @instance + * @returns {Object.} JSON object + */ + UninterpretedOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UninterpretedOption + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; + }; + + UninterpretedOption.NamePart = (function() { + + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} namePart NamePart namePart + * @property {boolean} isExtension NamePart isExtension + */ + + /** + * Constructs a new NamePart. + * @memberof google.protobuf.UninterpretedOption + * @classdesc Represents a NamePart. + * @implements INamePart + * @constructor + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + */ + function NamePart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NamePart namePart. + * @member {string} namePart + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.namePart = ""; + + /** + * NamePart isExtension. + * @member {boolean} isExtension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.isExtension = false; + + /** + * Creates a new NamePart instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance + */ + NamePart.create = function create(properties) { + return new NamePart(properties); + }; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); + return writer; + }; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.namePart = reader.string(); + break; + } + case 2: { + message.isExtension = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("namePart")) + throw $util.ProtocolError("missing required 'namePart'", { instance: message }); + if (!message.hasOwnProperty("isExtension")) + throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); + return message; + }; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NamePart message. + * @function verify + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NamePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.namePart)) + return "namePart: string expected"; + if (typeof message.isExtension !== "boolean") + return "isExtension: boolean expected"; + return null; + }; + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + */ + NamePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) + return object; + var message = new $root.google.protobuf.UninterpretedOption.NamePart(); + if (object.namePart != null) + message.namePart = String(object.namePart); + if (object.isExtension != null) + message.isExtension = Boolean(object.isExtension); + return message; + }; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NamePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.namePart = ""; + object.isExtension = false; + } + if (message.namePart != null && message.hasOwnProperty("namePart")) + object.namePart = message.namePart; + if (message.isExtension != null && message.hasOwnProperty("isExtension")) + object.isExtension = message.isExtension; + return object; + }; + + /** + * Converts this NamePart to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + * @returns {Object.} JSON object + */ + NamePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NamePart + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; + }; + + return NamePart; + })(); + + return UninterpretedOption; + })(); + + protobuf.FeatureSet = (function() { + + /** + * Properties of a FeatureSet. + * @memberof google.protobuf + * @interface IFeatureSet + * @property {google.protobuf.FeatureSet.FieldPresence|null} [fieldPresence] FeatureSet fieldPresence + * @property {google.protobuf.FeatureSet.EnumType|null} [enumType] FeatureSet enumType + * @property {google.protobuf.FeatureSet.RepeatedFieldEncoding|null} [repeatedFieldEncoding] FeatureSet repeatedFieldEncoding + * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation + * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding + * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility + */ + + /** + * Constructs a new FeatureSet. + * @memberof google.protobuf + * @classdesc Represents a FeatureSet. + * @implements IFeatureSet + * @constructor + * @param {google.protobuf.IFeatureSet=} [properties] Properties to set + */ + function FeatureSet(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSet fieldPresence. + * @member {google.protobuf.FeatureSet.FieldPresence} fieldPresence + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.fieldPresence = 0; + + /** + * FeatureSet enumType. + * @member {google.protobuf.FeatureSet.EnumType} enumType + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enumType = 0; + + /** + * FeatureSet repeatedFieldEncoding. + * @member {google.protobuf.FeatureSet.RepeatedFieldEncoding} repeatedFieldEncoding + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.repeatedFieldEncoding = 0; + + /** + * FeatureSet utf8Validation. + * @member {google.protobuf.FeatureSet.Utf8Validation} utf8Validation + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.utf8Validation = 0; + + /** + * FeatureSet messageEncoding. + * @member {google.protobuf.FeatureSet.MessageEncoding} messageEncoding + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.messageEncoding = 0; + + /** + * FeatureSet jsonFormat. + * @member {google.protobuf.FeatureSet.JsonFormat} jsonFormat + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.jsonFormat = 0; + + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + + /** + * Creates a new FeatureSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet} FeatureSet instance + */ + FeatureSet.create = function create(properties) { + return new FeatureSet(properties); + }; + + /** + * Encodes the specified FeatureSet message. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.fieldPresence); + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.enumType); + if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.repeatedFieldEncoding); + if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.utf8Validation); + if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); + if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); + return writer; + }; + + /** + * Encodes the specified FeatureSet message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet} FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSet.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.fieldPresence = reader.int32(); + break; + } + case 2: { + message.enumType = reader.int32(); + break; + } + case 3: { + message.repeatedFieldEncoding = reader.int32(); + break; + } + case 4: { + message.utf8Validation = reader.int32(); + break; + } + case 5: { + message.messageEncoding = reader.int32(); + break; + } + case 6: { + message.jsonFormat = reader.int32(); + break; + } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet} FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSet message. + * @function verify + * @memberof google.protobuf.FeatureSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) + switch (message.fieldPresence) { + default: + return "fieldPresence: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.enumType != null && message.hasOwnProperty("enumType")) + switch (message.enumType) { + default: + return "enumType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) + switch (message.repeatedFieldEncoding) { + default: + return "repeatedFieldEncoding: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) + switch (message.utf8Validation) { + default: + return "utf8Validation: enum value expected"; + case 0: + case 2: + case 3: + break; + } + if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) + switch (message.messageEncoding) { + default: + return "messageEncoding: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) + switch (message.jsonFormat) { + default: + return "jsonFormat: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } + return null; + }; + + /** + * Creates a FeatureSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet} FeatureSet + */ + FeatureSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet) + return object; + var message = new $root.google.protobuf.FeatureSet(); + switch (object.fieldPresence) { + default: + if (typeof object.fieldPresence === "number") { + message.fieldPresence = object.fieldPresence; + break; + } + break; + case "FIELD_PRESENCE_UNKNOWN": + case 0: + message.fieldPresence = 0; + break; + case "EXPLICIT": + case 1: + message.fieldPresence = 1; + break; + case "IMPLICIT": + case 2: + message.fieldPresence = 2; + break; + case "LEGACY_REQUIRED": + case 3: + message.fieldPresence = 3; + break; + } + switch (object.enumType) { + default: + if (typeof object.enumType === "number") { + message.enumType = object.enumType; + break; + } + break; + case "ENUM_TYPE_UNKNOWN": + case 0: + message.enumType = 0; + break; + case "OPEN": + case 1: + message.enumType = 1; + break; + case "CLOSED": + case 2: + message.enumType = 2; + break; + } + switch (object.repeatedFieldEncoding) { + default: + if (typeof object.repeatedFieldEncoding === "number") { + message.repeatedFieldEncoding = object.repeatedFieldEncoding; + break; + } + break; + case "REPEATED_FIELD_ENCODING_UNKNOWN": + case 0: + message.repeatedFieldEncoding = 0; + break; + case "PACKED": + case 1: + message.repeatedFieldEncoding = 1; + break; + case "EXPANDED": + case 2: + message.repeatedFieldEncoding = 2; + break; + } + switch (object.utf8Validation) { + default: + if (typeof object.utf8Validation === "number") { + message.utf8Validation = object.utf8Validation; + break; + } + break; + case "UTF8_VALIDATION_UNKNOWN": + case 0: + message.utf8Validation = 0; + break; + case "VERIFY": + case 2: + message.utf8Validation = 2; + break; + case "NONE": + case 3: + message.utf8Validation = 3; + break; + } + switch (object.messageEncoding) { + default: + if (typeof object.messageEncoding === "number") { + message.messageEncoding = object.messageEncoding; + break; + } + break; + case "MESSAGE_ENCODING_UNKNOWN": + case 0: + message.messageEncoding = 0; + break; + case "LENGTH_PREFIXED": + case 1: + message.messageEncoding = 1; + break; + case "DELIMITED": + case 2: + message.messageEncoding = 2; + break; + } + switch (object.jsonFormat) { + default: + if (typeof object.jsonFormat === "number") { + message.jsonFormat = object.jsonFormat; + break; + } + break; + case "JSON_FORMAT_UNKNOWN": + case 0: + message.jsonFormat = 0; + break; + case "ALLOW": + case 1: + message.jsonFormat = 1; + break; + case "LEGACY_BEST_EFFORT": + case 2: + message.jsonFormat = 2; + break; + } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.FeatureSet} message FeatureSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fieldPresence = options.enums === String ? "FIELD_PRESENCE_UNKNOWN" : 0; + object.enumType = options.enums === String ? "ENUM_TYPE_UNKNOWN" : 0; + object.repeatedFieldEncoding = options.enums === String ? "REPEATED_FIELD_ENCODING_UNKNOWN" : 0; + object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; + object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; + object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; + } + if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) + object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; + if (message.enumType != null && message.hasOwnProperty("enumType")) + object.enumType = options.enums === String ? $root.google.protobuf.FeatureSet.EnumType[message.enumType] === undefined ? message.enumType : $root.google.protobuf.FeatureSet.EnumType[message.enumType] : message.enumType; + if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) + object.repeatedFieldEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] === undefined ? message.repeatedFieldEncoding : $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] : message.repeatedFieldEncoding; + if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) + object.utf8Validation = options.enums === String ? $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] === undefined ? message.utf8Validation : $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] : message.utf8Validation; + if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) + object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; + if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) + object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; + return object; + }; + + /** + * Converts this FeatureSet to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet + * @instance + * @returns {Object.} JSON object + */ + FeatureSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSet + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet"; + }; + + /** + * FieldPresence enum. + * @name google.protobuf.FeatureSet.FieldPresence + * @enum {number} + * @property {number} FIELD_PRESENCE_UNKNOWN=0 FIELD_PRESENCE_UNKNOWN value + * @property {number} EXPLICIT=1 EXPLICIT value + * @property {number} IMPLICIT=2 IMPLICIT value + * @property {number} LEGACY_REQUIRED=3 LEGACY_REQUIRED value + */ + FeatureSet.FieldPresence = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_PRESENCE_UNKNOWN"] = 0; + values[valuesById[1] = "EXPLICIT"] = 1; + values[valuesById[2] = "IMPLICIT"] = 2; + values[valuesById[3] = "LEGACY_REQUIRED"] = 3; + return values; + })(); + + /** + * EnumType enum. + * @name google.protobuf.FeatureSet.EnumType + * @enum {number} + * @property {number} ENUM_TYPE_UNKNOWN=0 ENUM_TYPE_UNKNOWN value + * @property {number} OPEN=1 OPEN value + * @property {number} CLOSED=2 CLOSED value + */ + FeatureSet.EnumType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENUM_TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "OPEN"] = 1; + values[valuesById[2] = "CLOSED"] = 2; + return values; + })(); + + /** + * RepeatedFieldEncoding enum. + * @name google.protobuf.FeatureSet.RepeatedFieldEncoding + * @enum {number} + * @property {number} REPEATED_FIELD_ENCODING_UNKNOWN=0 REPEATED_FIELD_ENCODING_UNKNOWN value + * @property {number} PACKED=1 PACKED value + * @property {number} EXPANDED=2 EXPANDED value + */ + FeatureSet.RepeatedFieldEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REPEATED_FIELD_ENCODING_UNKNOWN"] = 0; + values[valuesById[1] = "PACKED"] = 1; + values[valuesById[2] = "EXPANDED"] = 2; + return values; + })(); + + /** + * Utf8Validation enum. + * @name google.protobuf.FeatureSet.Utf8Validation + * @enum {number} + * @property {number} UTF8_VALIDATION_UNKNOWN=0 UTF8_VALIDATION_UNKNOWN value + * @property {number} VERIFY=2 VERIFY value + * @property {number} NONE=3 NONE value + */ + FeatureSet.Utf8Validation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UTF8_VALIDATION_UNKNOWN"] = 0; + values[valuesById[2] = "VERIFY"] = 2; + values[valuesById[3] = "NONE"] = 3; + return values; + })(); + + /** + * MessageEncoding enum. + * @name google.protobuf.FeatureSet.MessageEncoding + * @enum {number} + * @property {number} MESSAGE_ENCODING_UNKNOWN=0 MESSAGE_ENCODING_UNKNOWN value + * @property {number} LENGTH_PREFIXED=1 LENGTH_PREFIXED value + * @property {number} DELIMITED=2 DELIMITED value + */ + FeatureSet.MessageEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_ENCODING_UNKNOWN"] = 0; + values[valuesById[1] = "LENGTH_PREFIXED"] = 1; + values[valuesById[2] = "DELIMITED"] = 2; + return values; + })(); + + /** + * JsonFormat enum. + * @name google.protobuf.FeatureSet.JsonFormat + * @enum {number} + * @property {number} JSON_FORMAT_UNKNOWN=0 JSON_FORMAT_UNKNOWN value + * @property {number} ALLOW=1 ALLOW value + * @property {number} LEGACY_BEST_EFFORT=2 LEGACY_BEST_EFFORT value + */ + FeatureSet.JsonFormat = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JSON_FORMAT_UNKNOWN"] = 0; + values[valuesById[1] = "ALLOW"] = 1; + values[valuesById[2] = "LEGACY_BEST_EFFORT"] = 2; + return values; + })(); + + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + + return FeatureSet; + })(); + + protobuf.FeatureSetDefaults = (function() { + + /** + * Properties of a FeatureSetDefaults. + * @memberof google.protobuf + * @interface IFeatureSetDefaults + * @property {Array.|null} [defaults] FeatureSetDefaults defaults + * @property {google.protobuf.Edition|null} [minimumEdition] FeatureSetDefaults minimumEdition + * @property {google.protobuf.Edition|null} [maximumEdition] FeatureSetDefaults maximumEdition + */ + + /** + * Constructs a new FeatureSetDefaults. + * @memberof google.protobuf + * @classdesc Represents a FeatureSetDefaults. + * @implements IFeatureSetDefaults + * @constructor + * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set + */ + function FeatureSetDefaults(properties) { + this.defaults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSetDefaults defaults. + * @member {Array.} defaults + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.defaults = $util.emptyArray; + + /** + * FeatureSetDefaults minimumEdition. + * @member {google.protobuf.Edition} minimumEdition + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.minimumEdition = 0; + + /** + * FeatureSetDefaults maximumEdition. + * @member {google.protobuf.Edition} maximumEdition + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.maximumEdition = 0; + + /** + * Creates a new FeatureSetDefaults instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults instance + */ + FeatureSetDefaults.create = function create(properties) { + return new FeatureSetDefaults(properties); + }; + + /** + * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetDefaults.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.defaults != null && message.defaults.length) + for (var i = 0; i < message.defaults.length; ++i) + $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.encode(message.defaults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minimumEdition); + if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maximumEdition); + return writer; + }; + + /** + * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetDefaults.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetDefaults.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.defaults && message.defaults.length)) + message.defaults = []; + message.defaults.push($root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.decode(reader, reader.uint32())); + break; + } + case 4: { + message.minimumEdition = reader.int32(); + break; + } + case 5: { + message.maximumEdition = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetDefaults.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSetDefaults message. + * @function verify + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSetDefaults.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.defaults != null && message.hasOwnProperty("defaults")) { + if (!Array.isArray(message.defaults)) + return "defaults: array expected"; + for (var i = 0; i < message.defaults.length; ++i) { + var error = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify(message.defaults[i]); + if (error) + return "defaults." + error; + } + } + if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) + switch (message.minimumEdition) { + default: + return "minimumEdition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) + switch (message.maximumEdition) { + default: + return "maximumEdition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + */ + FeatureSetDefaults.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSetDefaults) + return object; + var message = new $root.google.protobuf.FeatureSetDefaults(); + if (object.defaults) { + if (!Array.isArray(object.defaults)) + throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: array expected"); + message.defaults = []; + for (var i = 0; i < object.defaults.length; ++i) { + if (typeof object.defaults[i] !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: object expected"); + message.defaults[i] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fromObject(object.defaults[i]); + } + } + switch (object.minimumEdition) { + default: + if (typeof object.minimumEdition === "number") { + message.minimumEdition = object.minimumEdition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.minimumEdition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.minimumEdition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.minimumEdition = 999; + break; + case "EDITION_2023": + case 1000: + message.minimumEdition = 1000; + break; + case "EDITION_2024": + case 1001: + message.minimumEdition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.minimumEdition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.minimumEdition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.minimumEdition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.minimumEdition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.minimumEdition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.minimumEdition = 2147483647; + break; + } + switch (object.maximumEdition) { + default: + if (typeof object.maximumEdition === "number") { + message.maximumEdition = object.maximumEdition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.maximumEdition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.maximumEdition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.maximumEdition = 999; + break; + case "EDITION_2023": + case 1000: + message.maximumEdition = 1000; + break; + case "EDITION_2024": + case 1001: + message.maximumEdition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.maximumEdition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.maximumEdition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.maximumEdition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.maximumEdition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.maximumEdition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.maximumEdition = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.FeatureSetDefaults} message FeatureSetDefaults + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSetDefaults.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.defaults = []; + if (options.defaults) { + object.minimumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.maximumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.defaults && message.defaults.length) { + object.defaults = []; + for (var j = 0; j < message.defaults.length; ++j) + object.defaults[j] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.toObject(message.defaults[j], options); + } + if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) + object.minimumEdition = options.enums === String ? $root.google.protobuf.Edition[message.minimumEdition] === undefined ? message.minimumEdition : $root.google.protobuf.Edition[message.minimumEdition] : message.minimumEdition; + if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) + object.maximumEdition = options.enums === String ? $root.google.protobuf.Edition[message.maximumEdition] === undefined ? message.maximumEdition : $root.google.protobuf.Edition[message.maximumEdition] : message.maximumEdition; + return object; + }; + + /** + * Converts this FeatureSetDefaults to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSetDefaults + * @instance + * @returns {Object.} JSON object + */ + FeatureSetDefaults.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSetDefaults + * @function getTypeUrl + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSetDefaults.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults"; + }; + + FeatureSetDefaults.FeatureSetEditionDefault = (function() { + + /** + * Properties of a FeatureSetEditionDefault. + * @memberof google.protobuf.FeatureSetDefaults + * @interface IFeatureSetEditionDefault + * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures + */ + + /** + * Constructs a new FeatureSetEditionDefault. + * @memberof google.protobuf.FeatureSetDefaults + * @classdesc Represents a FeatureSetEditionDefault. + * @implements IFeatureSetEditionDefault + * @constructor + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set + */ + function FeatureSetEditionDefault(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSetEditionDefault edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.edition = 0; + + /** + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.fixedFeatures = null; + + /** + * Creates a new FeatureSetEditionDefault instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault instance + */ + FeatureSetEditionDefault.create = function create(properties) { + return new FeatureSetEditionDefault(properties); + }; + + /** + * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetEditionDefault.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetEditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetEditionDefault.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.edition = reader.int32(); + break; + } + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetEditionDefault.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSetEditionDefault message. + * @function verify + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSetEditionDefault.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); + if (error) + return "fixedFeatures." + error; + } + return null; + }; + + /** + * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + */ + FeatureSetEditionDefault.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) + return object; + var message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); + } + return message; + }; + + /** + * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} message FeatureSetEditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSetEditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; + } + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); + return object; + }; + + /** + * Converts this FeatureSetEditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + * @returns {Object.} JSON object + */ + FeatureSetEditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSetEditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSetEditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"; + }; + + return FeatureSetEditionDefault; + })(); + + return FeatureSetDefaults; + })(); + + protobuf.SourceCodeInfo = (function() { + + /** + * Properties of a SourceCodeInfo. + * @memberof google.protobuf + * @interface ISourceCodeInfo + * @property {Array.|null} [location] SourceCodeInfo location + */ + + /** + * Constructs a new SourceCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a SourceCodeInfo. + * @implements ISourceCodeInfo + * @constructor + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + */ + function SourceCodeInfo(properties) { + this.location = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceCodeInfo location. + * @member {Array.} location + * @memberof google.protobuf.SourceCodeInfo + * @instance + */ + SourceCodeInfo.prototype.location = $util.emptyArray; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance + */ + SourceCodeInfo.create = function create(properties) { + return new SourceCodeInfo(properties); + }; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceCodeInfo message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (var i = 0; i < message.location.length; ++i) { + var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); + if (error) + return "location." + error; + } + } + return null; + }; + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + */ + SourceCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) + return object; + var message = new $root.google.protobuf.SourceCodeInfo(); + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.location = []; + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); + } + return object; + }; + + /** + * Converts this SourceCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo + * @instance + * @returns {Object.} JSON object + */ + SourceCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SourceCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; + }; + + SourceCodeInfo.Location = (function() { + + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.|null} [path] Location path + * @property {Array.|null} [span] Location span + * @property {string|null} [leadingComments] Location leadingComments + * @property {string|null} [trailingComments] Location trailingComments + * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments + */ + + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leadingDetachedComments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location path. + * @member {Array.} path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; + + /** + * Location span. + * @member {Array.} span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; + + /** + * Location leadingComments. + * @member {string} leadingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingComments = ""; + + /** + * Location trailingComments. + * @member {string} trailingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailingComments = ""; + + /** + * Location leadingDetachedComments. + * @member {Array.} leadingDetachedComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingDetachedComments = $util.emptyArray; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); + if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + } + case 3: { + message.leadingComments = reader.string(); + break; + } + case 4: { + message.trailingComments = reader.string(); + break; + } + case 6: { + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && message.hasOwnProperty("span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (var i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (!$util.isString(message.leadingComments)) + return "leadingComments: string expected"; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (!$util.isString(message.trailingComments)) + return "trailingComments: string expected"; + if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { + if (!Array.isArray(message.leadingDetachedComments)) + return "leadingDetachedComments: array expected"; + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + if (!$util.isString(message.leadingDetachedComments[i])) + return "leadingDetachedComments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + var message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (var i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leadingComments != null) + message.leadingComments = String(object.leadingComments); + if (object.trailingComments != null) + message.trailingComments = String(object.trailingComments); + if (object.leadingDetachedComments) { + if (!Array.isArray(object.leadingDetachedComments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); + message.leadingDetachedComments = []; + for (var i = 0; i < object.leadingDetachedComments.length; ++i) + message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leadingDetachedComments = []; + } + if (options.defaults) { + object.leadingComments = ""; + object.trailingComments = ""; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (var j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + object.leadingComments = message.leadingComments; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + object.trailingComments = message.trailingComments; + if (message.leadingDetachedComments && message.leadingDetachedComments.length) { + object.leadingDetachedComments = []; + for (var j = 0; j < message.leadingDetachedComments.length; ++j) + object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Location + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; + }; + + return Location; + })(); + + return SourceCodeInfo; + })(); + + protobuf.GeneratedCodeInfo = (function() { + + /** + * Properties of a GeneratedCodeInfo. + * @memberof google.protobuf + * @interface IGeneratedCodeInfo + * @property {Array.|null} [annotation] GeneratedCodeInfo annotation + */ + + /** + * Constructs a new GeneratedCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a GeneratedCodeInfo. + * @implements IGeneratedCodeInfo + * @constructor + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + */ + function GeneratedCodeInfo(properties) { + this.annotation = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeneratedCodeInfo annotation. + * @member {Array.} annotation + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + */ + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance + */ + GeneratedCodeInfo.create = function create(properties) { + return new GeneratedCodeInfo(properties); + }; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.annotation != null && message.annotation.length) + for (var i = 0; i < message.annotation.length; ++i) + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeneratedCodeInfo message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeneratedCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.annotation != null && message.hasOwnProperty("annotation")) { + if (!Array.isArray(message.annotation)) + return "annotation: array expected"; + for (var i = 0; i < message.annotation.length; ++i) { + var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); + if (error) + return "annotation." + error; + } + } + return null; + }; + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + */ + GeneratedCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo(); + if (object.annotation) { + if (!Array.isArray(object.annotation)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); + message.annotation = []; + for (var i = 0; i < object.annotation.length; ++i) { + if (typeof object.annotation[i] !== "object") + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeneratedCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.annotation = []; + if (message.annotation && message.annotation.length) { + object.annotation = []; + for (var j = 0; j < message.annotation.length; ++j) + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); + } + return object; + }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + * @returns {Object.} JSON object + */ + GeneratedCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; + }; + + GeneratedCodeInfo.Annotation = (function() { + + /** + * Properties of an Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @interface IAnnotation + * @property {Array.|null} [path] Annotation path + * @property {string|null} [sourceFile] Annotation sourceFile + * @property {number|null} [begin] Annotation begin + * @property {number|null} [end] Annotation end + * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic + */ + + /** + * Constructs a new Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @classdesc Represents an Annotation. + * @implements IAnnotation + * @constructor + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + */ + function Annotation(properties) { + this.path = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Annotation path. + * @member {Array.} path + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.path = $util.emptyArray; + + /** + * Annotation sourceFile. + * @member {string} sourceFile + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.sourceFile = ""; + + /** + * Annotation begin. + * @member {number} begin + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.begin = 0; + + /** + * Annotation end. + * @member {number} end + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.end = 0; + + /** + * Annotation semantic. + * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.semantic = 0; + + /** + * Creates a new Annotation instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance + */ + Annotation.create = function create(properties) { + return new Annotation(properties); + }; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); + return writer; + }; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + message.sourceFile = reader.string(); + break; + } + case 3: { + message.begin = reader.int32(); + break; + } + case 4: { + message.end = reader.int32(); + break; + } + case 5: { + message.semantic = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Annotation message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Annotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (!$util.isString(message.sourceFile)) + return "sourceFile: string expected"; + if (message.begin != null && message.hasOwnProperty("begin")) + if (!$util.isInteger(message.begin)) + return "begin: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.semantic != null && message.hasOwnProperty("semantic")) + switch (message.semantic) { + default: + return "semantic: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + */ + Annotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.sourceFile != null) + message.sourceFile = String(object.sourceFile); + if (object.begin != null) + message.begin = object.begin | 0; + if (object.end != null) + message.end = object.end | 0; + switch (object.semantic) { + default: + if (typeof object.semantic === "number") { + message.semantic = object.semantic; + break; + } + break; + case "NONE": + case 0: + message.semantic = 0; + break; + case "SET": + case 1: + message.semantic = 1; + break; + case "ALIAS": + case 2: + message.semantic = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Annotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + object.sourceFile = ""; + object.begin = 0; + object.end = 0; + object.semantic = options.enums === String ? "NONE" : 0; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + object.sourceFile = message.sourceFile; + if (message.begin != null && message.hasOwnProperty("begin")) + object.begin = message.begin; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.semantic != null && message.hasOwnProperty("semantic")) + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; + return object; + }; + + /** + * Converts this Annotation to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + * @returns {Object.} JSON object + */ + Annotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Annotation + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Annotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo.Annotation"; + }; + + /** + * Semantic enum. + * @name google.protobuf.GeneratedCodeInfo.Annotation.Semantic + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} SET=1 SET value + * @property {number} ALIAS=2 ALIAS value + */ + Annotation.Semantic = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "SET"] = 1; + values[valuesById[2] = "ALIAS"] = 2; + return values; + })(); + + return Annotation; + })(); + + return GeneratedCodeInfo; + })(); + + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + + protobuf.Duration = (function() { + + /** + * Properties of a Duration. + * @memberof google.protobuf + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos + */ + + /** + * Constructs a new Duration. + * @memberof google.protobuf + * @classdesc Represents a Duration. + * @implements IDuration + * @constructor + * @param {google.protobuf.IDuration=} [properties] Properties to set + */ + function Duration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Creates a new Duration instance using the specified properties. + * @function create + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance + */ + Duration.create = function create(properties) { + return new Duration(properties); + }; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Duration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Duration} Duration + */ + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) + return object; + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.Duration} message Duration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Duration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Duration to JSON. + * @function toJSON + * @memberof google.protobuf.Duration + * @instance + * @returns {Object.} JSON object + */ + Duration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Duration + * @function getTypeUrl + * @memberof google.protobuf.Duration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Duration"; + }; + + return Duration; + })(); + + protobuf.Timestamp = (function() { + + /** + * Properties of a Timestamp. + * @memberof google.protobuf + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos + */ + + /** + * Constructs a new Timestamp. + * @memberof google.protobuf + * @classdesc Represents a Timestamp. + * @implements ITimestamp + * @constructor + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + */ + function Timestamp(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.nanos = 0; + + /** + * Creates a new Timestamp instance using the specified properties. + * @function create + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance + */ + Timestamp.create = function create(properties) { + return new Timestamp(properties); + }; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Timestamp message. + * @function verify + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Timestamp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Timestamp} Timestamp + */ + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) + return object; + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.Timestamp} message Timestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Timestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Timestamp to JSON. + * @function toJSON + * @memberof google.protobuf.Timestamp + * @instance + * @returns {Object.} JSON object + */ + Timestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Timestamp + * @function getTypeUrl + * @memberof google.protobuf.Timestamp + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Timestamp"; + }; + + return Timestamp; + })(); + + protobuf.DoubleValue = (function() { + + /** + * Properties of a DoubleValue. + * @memberof google.protobuf + * @interface IDoubleValue + * @property {number|null} [value] DoubleValue value + */ + + /** + * Constructs a new DoubleValue. + * @memberof google.protobuf + * @classdesc Represents a DoubleValue. + * @implements IDoubleValue + * @constructor + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + */ + function DoubleValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DoubleValue value. + * @member {number} value + * @memberof google.protobuf.DoubleValue + * @instance + */ + DoubleValue.prototype.value = 0; + + /** + * Creates a new DoubleValue instance using the specified properties. + * @function create + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue=} [properties] Properties to set + * @returns {google.protobuf.DoubleValue} DoubleValue instance + */ + DoubleValue.create = function create(properties) { + return new DoubleValue(properties); + }; + + /** + * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoubleValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); + return writer; + }; + + /** + * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DoubleValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DoubleValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DoubleValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DoubleValue} DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoubleValue.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DoubleValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DoubleValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DoubleValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DoubleValue} DoubleValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DoubleValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DoubleValue message. + * @function verify + * @memberof google.protobuf.DoubleValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DoubleValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DoubleValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DoubleValue} DoubleValue + */ + DoubleValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DoubleValue) + return object; + var message = new $root.google.protobuf.DoubleValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DoubleValue + * @static + * @param {google.protobuf.DoubleValue} message DoubleValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DoubleValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this DoubleValue to JSON. + * @function toJSON + * @memberof google.protobuf.DoubleValue + * @instance + * @returns {Object.} JSON object + */ + DoubleValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DoubleValue + * @function getTypeUrl + * @memberof google.protobuf.DoubleValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DoubleValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DoubleValue"; + }; + + return DoubleValue; + })(); + + protobuf.FloatValue = (function() { + + /** + * Properties of a FloatValue. + * @memberof google.protobuf + * @interface IFloatValue + * @property {number|null} [value] FloatValue value + */ + + /** + * Constructs a new FloatValue. + * @memberof google.protobuf + * @classdesc Represents a FloatValue. + * @implements IFloatValue + * @constructor + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + */ + function FloatValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FloatValue value. + * @member {number} value + * @memberof google.protobuf.FloatValue + * @instance + */ + FloatValue.prototype.value = 0; + + /** + * Creates a new FloatValue instance using the specified properties. + * @function create + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue=} [properties] Properties to set + * @returns {google.protobuf.FloatValue} FloatValue instance + */ + FloatValue.create = function create(properties) { + return new FloatValue(properties); + }; + + /** + * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 5 =*/13).float(message.value); + return writer; + }; + + /** + * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FloatValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FloatValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.float(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FloatValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FloatValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FloatValue} FloatValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FloatValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FloatValue message. + * @function verify + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FloatValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + return null; + }; + + /** + * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FloatValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FloatValue} FloatValue + */ + FloatValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FloatValue) + return object; + var message = new $root.google.protobuf.FloatValue(); + if (object.value != null) + message.value = Number(object.value); + return message; + }; + + /** + * Creates a plain object from a FloatValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FloatValue + * @static + * @param {google.protobuf.FloatValue} message FloatValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FloatValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + return object; + }; + + /** + * Converts this FloatValue to JSON. + * @function toJSON + * @memberof google.protobuf.FloatValue + * @instance + * @returns {Object.} JSON object + */ + FloatValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FloatValue + * @function getTypeUrl + * @memberof google.protobuf.FloatValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FloatValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FloatValue"; + }; + + return FloatValue; + })(); + + protobuf.Int64Value = (function() { + + /** + * Properties of an Int64Value. + * @memberof google.protobuf + * @interface IInt64Value + * @property {number|Long|null} [value] Int64Value value + */ + + /** + * Constructs a new Int64Value. + * @memberof google.protobuf + * @classdesc Represents an Int64Value. + * @implements IInt64Value + * @constructor + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + */ + function Int64Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Int64Value value. + * @member {number|Long} value + * @memberof google.protobuf.Int64Value + * @instance + */ + Int64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new Int64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value=} [properties] Properties to set + * @returns {google.protobuf.Int64Value} Int64Value instance + */ + Int64Value.create = function create(properties) { + return new Int64Value(properties); + }; + + /** + * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); + return writer; + }; + + /** + * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Int64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int64Value} Int64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int64Value message. + * @function verify + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int64Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int64Value} Int64Value + */ + Int64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Int64Value) + return object; + var message = new $root.google.protobuf.Int64Value(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = false; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from an Int64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int64Value + * @static + * @param {google.protobuf.Int64Value} message Int64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int64Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value; + return object; + }; + + /** + * Converts this Int64Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int64Value + * @instance + * @returns {Object.} JSON object + */ + Int64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Int64Value + * @function getTypeUrl + * @memberof google.protobuf.Int64Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Int64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Int64Value"; + }; + + return Int64Value; + })(); + + protobuf.UInt64Value = (function() { + + /** + * Properties of a UInt64Value. + * @memberof google.protobuf + * @interface IUInt64Value + * @property {number|Long|null} [value] UInt64Value value + */ + + /** + * Constructs a new UInt64Value. + * @memberof google.protobuf + * @classdesc Represents a UInt64Value. + * @implements IUInt64Value + * @constructor + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + */ + function UInt64Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UInt64Value value. + * @member {number|Long} value + * @memberof google.protobuf.UInt64Value + * @instance + */ + UInt64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * Creates a new UInt64Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value=} [properties] Properties to set + * @returns {google.protobuf.UInt64Value} UInt64Value instance + */ + UInt64Value.create = function create(properties) { + return new UInt64Value(properties); + }; + + /** + * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.value); + return writer; + }; + + /** + * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt64Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt64Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.uint64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UInt64Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt64Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt64Value} UInt64Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt64Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt64Value message. + * @function verify + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt64Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) + return "value: integer|Long expected"; + return null; + }; + + /** + * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt64Value} UInt64Value + */ + UInt64Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt64Value) + return object; + var message = new $root.google.protobuf.UInt64Value(); + if (object.value != null) + if ($util.Long) + (message.value = $util.Long.fromValue(object.value)).unsigned = true; + else if (typeof object.value === "string") + message.value = parseInt(object.value, 10); + else if (typeof object.value === "number") + message.value = object.value; + else if (typeof object.value === "object") + message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(true); + return message; + }; + + /** + * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt64Value + * @static + * @param {google.protobuf.UInt64Value} message UInt64Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt64Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.value = options.longs === String ? "0" : 0; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value === "number") + object.value = options.longs === String ? String(message.value) : message.value; + else + object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber(true) : message.value; + return object; + }; + + /** + * Converts this UInt64Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt64Value + * @instance + * @returns {Object.} JSON object + */ + UInt64Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UInt64Value + * @function getTypeUrl + * @memberof google.protobuf.UInt64Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UInt64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UInt64Value"; + }; + + return UInt64Value; + })(); + + protobuf.Int32Value = (function() { + + /** + * Properties of an Int32Value. + * @memberof google.protobuf + * @interface IInt32Value + * @property {number|null} [value] Int32Value value + */ + + /** + * Constructs a new Int32Value. + * @memberof google.protobuf + * @classdesc Represents an Int32Value. + * @implements IInt32Value + * @constructor + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + */ + function Int32Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Int32Value value. + * @member {number} value + * @memberof google.protobuf.Int32Value + * @instance + */ + Int32Value.prototype.value = 0; + + /** + * Creates a new Int32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value=} [properties] Properties to set + * @returns {google.protobuf.Int32Value} Int32Value instance + */ + Int32Value.create = function create(properties) { + return new Int32Value(properties); + }; + + /** + * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value); + return writer; + }; + + /** + * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Int32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Int32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Int32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Int32Value} Int32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Int32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Int32Value message. + * @function verify + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Int32Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Int32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Int32Value} Int32Value + */ + Int32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Int32Value) + return object; + var message = new $root.google.protobuf.Int32Value(); + if (object.value != null) + message.value = object.value | 0; + return message; + }; + + /** + * Creates a plain object from an Int32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Int32Value + * @static + * @param {google.protobuf.Int32Value} message Int32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Int32Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this Int32Value to JSON. + * @function toJSON + * @memberof google.protobuf.Int32Value + * @instance + * @returns {Object.} JSON object + */ + Int32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Int32Value + * @function getTypeUrl + * @memberof google.protobuf.Int32Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Int32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Int32Value"; + }; + + return Int32Value; + })(); + + protobuf.UInt32Value = (function() { + + /** + * Properties of a UInt32Value. + * @memberof google.protobuf + * @interface IUInt32Value + * @property {number|null} [value] UInt32Value value + */ + + /** + * Constructs a new UInt32Value. + * @memberof google.protobuf + * @classdesc Represents a UInt32Value. + * @implements IUInt32Value + * @constructor + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + */ + function UInt32Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UInt32Value value. + * @member {number} value + * @memberof google.protobuf.UInt32Value + * @instance + */ + UInt32Value.prototype.value = 0; + + /** + * Creates a new UInt32Value instance using the specified properties. + * @function create + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value=} [properties] Properties to set + * @returns {google.protobuf.UInt32Value} UInt32Value instance + */ + UInt32Value.create = function create(properties) { + return new UInt32Value(properties); + }; + + /** + * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.value); + return writer; + }; + + /** + * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UInt32Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt32Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.uint32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a UInt32Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UInt32Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UInt32Value} UInt32Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UInt32Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a UInt32Value message. + * @function verify + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UInt32Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isInteger(message.value)) + return "value: integer expected"; + return null; + }; + + /** + * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UInt32Value} UInt32Value + */ + UInt32Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UInt32Value) + return object; + var message = new $root.google.protobuf.UInt32Value(); + if (object.value != null) + message.value = object.value >>> 0; + return message; + }; + + /** + * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UInt32Value + * @static + * @param {google.protobuf.UInt32Value} message UInt32Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UInt32Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = 0; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this UInt32Value to JSON. + * @function toJSON + * @memberof google.protobuf.UInt32Value + * @instance + * @returns {Object.} JSON object + */ + UInt32Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UInt32Value + * @function getTypeUrl + * @memberof google.protobuf.UInt32Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UInt32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UInt32Value"; + }; + + return UInt32Value; + })(); + + protobuf.BoolValue = (function() { + + /** + * Properties of a BoolValue. + * @memberof google.protobuf + * @interface IBoolValue + * @property {boolean|null} [value] BoolValue value + */ + + /** + * Constructs a new BoolValue. + * @memberof google.protobuf + * @classdesc Represents a BoolValue. + * @implements IBoolValue + * @constructor + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + */ + function BoolValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BoolValue value. + * @member {boolean} value + * @memberof google.protobuf.BoolValue + * @instance + */ + BoolValue.prototype.value = false; + + /** + * Creates a new BoolValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue=} [properties] Properties to set + * @returns {google.protobuf.BoolValue} BoolValue instance + */ + BoolValue.create = function create(properties) { + return new BoolValue(properties); + }; + + /** + * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.value); + return writer; + }; + + /** + * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BoolValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BoolValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BoolValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BoolValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BoolValue} BoolValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BoolValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BoolValue message. + * @function verify + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BoolValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "boolean") + return "value: boolean expected"; + return null; + }; + + /** + * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BoolValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BoolValue} BoolValue + */ + BoolValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BoolValue) + return object; + var message = new $root.google.protobuf.BoolValue(); + if (object.value != null) + message.value = Boolean(object.value); + return message; + }; + + /** + * Creates a plain object from a BoolValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BoolValue + * @static + * @param {google.protobuf.BoolValue} message BoolValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BoolValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = false; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this BoolValue to JSON. + * @function toJSON + * @memberof google.protobuf.BoolValue + * @instance + * @returns {Object.} JSON object + */ + BoolValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BoolValue + * @function getTypeUrl + * @memberof google.protobuf.BoolValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BoolValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.BoolValue"; + }; + + return BoolValue; + })(); + + protobuf.StringValue = (function() { + + /** + * Properties of a StringValue. + * @memberof google.protobuf + * @interface IStringValue + * @property {string|null} [value] StringValue value + */ + + /** + * Constructs a new StringValue. + * @memberof google.protobuf + * @classdesc Represents a StringValue. + * @implements IStringValue + * @constructor + * @param {google.protobuf.IStringValue=} [properties] Properties to set + */ + function StringValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * StringValue value. + * @member {string} value + * @memberof google.protobuf.StringValue + * @instance + */ + StringValue.prototype.value = ""; + + /** + * Creates a new StringValue instance using the specified properties. + * @function create + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue=} [properties] Properties to set + * @returns {google.protobuf.StringValue} StringValue instance + */ + StringValue.create = function create(properties) { + return new StringValue(properties); + }; + + /** + * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); + return writer; + }; + + /** + * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + StringValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a StringValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.StringValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a StringValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.StringValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.StringValue} StringValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + StringValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a StringValue message. + * @function verify + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + StringValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates a StringValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.StringValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.StringValue} StringValue + */ + StringValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.StringValue) + return object; + var message = new $root.google.protobuf.StringValue(); + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from a StringValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.StringValue + * @static + * @param {google.protobuf.StringValue} message StringValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + StringValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.value = ""; + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + return object; + }; + + /** + * Converts this StringValue to JSON. + * @function toJSON + * @memberof google.protobuf.StringValue + * @instance + * @returns {Object.} JSON object + */ + StringValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for StringValue + * @function getTypeUrl + * @memberof google.protobuf.StringValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + StringValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.StringValue"; + }; + + return StringValue; + })(); + + protobuf.BytesValue = (function() { + + /** + * Properties of a BytesValue. + * @memberof google.protobuf + * @interface IBytesValue + * @property {Uint8Array|null} [value] BytesValue value + */ + + /** + * Constructs a new BytesValue. + * @memberof google.protobuf + * @classdesc Represents a BytesValue. + * @implements IBytesValue + * @constructor + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + */ + function BytesValue(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BytesValue value. + * @member {Uint8Array} value + * @memberof google.protobuf.BytesValue + * @instance + */ + BytesValue.prototype.value = $util.newBuffer([]); + + /** + * Creates a new BytesValue instance using the specified properties. + * @function create + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue=} [properties] Properties to set + * @returns {google.protobuf.BytesValue} BytesValue instance + */ + BytesValue.create = function create(properties) { + return new BytesValue(properties); + }; + + /** + * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BytesValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BytesValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BytesValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.BytesValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.BytesValue} BytesValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BytesValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BytesValue message. + * @function verify + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BytesValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.BytesValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.BytesValue} BytesValue + */ + BytesValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.BytesValue) + return object; + var message = new $root.google.protobuf.BytesValue(); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from a BytesValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.BytesValue + * @static + * @param {google.protobuf.BytesValue} message BytesValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BytesValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this BytesValue to JSON. + * @function toJSON + * @memberof google.protobuf.BytesValue + * @instance + * @returns {Object.} JSON object + */ + BytesValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BytesValue + * @function getTypeUrl + * @memberof google.protobuf.BytesValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BytesValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.BytesValue"; + }; + + return BytesValue; + })(); + + protobuf.Any = (function() { + + /** + * Properties of an Any. + * @memberof google.protobuf + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value + */ + + /** + * Constructs a new Any. + * @memberof google.protobuf + * @classdesc Represents an Any. + * @implements IAny + * @constructor + * @param {google.protobuf.IAny=} [properties] Properties to set + */ + function Any(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.type_url = ""; + + /** + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.value = $util.newBuffer([]); + + /** + * Creates a new Any instance using the specified properties. + * @function create + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance + */ + Any.create = function create(properties) { + return new Any(properties); + }; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Any message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type_url = reader.string(); + break; + } + case 2: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Any message. + * @function verify + * @memberof google.protobuf.Any + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Any.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type_url != null && message.hasOwnProperty("type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Any + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Any} Any + */ + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) + return object; + var message = new $root.google.protobuf.Any(); + if (object.type_url != null) + message.type_url = String(object.type_url); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.Any} message Any + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Any.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type_url = ""; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.type_url != null && message.hasOwnProperty("type_url")) + object.type_url = message.type_url; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this Any to JSON. + * @function toJSON + * @memberof google.protobuf.Any + * @instance + * @returns {Object.} JSON object + */ + Any.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Any + * @function getTypeUrl + * @memberof google.protobuf.Any + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Any"; + }; + + return Any; + })(); + + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldMask + * @function getTypeUrl + * @memberof google.protobuf.FieldMask + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldMask"; + }; + + return FieldMask; + })(); + + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Empty"; + }; + + return Empty; + })(); + + return protobuf; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { + + /** + * Properties of a Status. + * @memberof google.rpc + * @interface IStatus + * @property {number|null} [code] Status code + * @property {string|null} [message] Status message + * @property {Array.|null} [details] Status details + */ + + /** + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus + * @constructor + * @param {google.rpc.IStatus=} [properties] Properties to set + */ + function Status(properties) { + this.details = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Status code. + * @member {number} code + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.code = 0; + + /** + * Status message. + * @member {string} message + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.message = ""; + + /** + * Status details. + * @member {Array.} details + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.details = $util.emptyArray; + + /** + * Creates a new Status instance using the specified properties. + * @function create + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance + */ + Status.create = function create(properties) { + return new Status(properties); + }; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encode + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.details != null && message.details.length) + for (var i = 0; i < message.details.length; ++i) + $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encodeDelimited + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Status message from the specified reader or buffer. + * @function decode + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.code = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Status message. + * @function verify + * @memberof google.rpc.Status + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Status.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.details != null && message.hasOwnProperty("details")) { + if (!Array.isArray(message.details)) + return "details: array expected"; + for (var i = 0; i < message.details.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.details[i]); + if (error) + return "details." + error; + } + } + return null; + }; + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.rpc.Status + * @static + * @param {Object.} object Plain object + * @returns {google.rpc.Status} Status + */ + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) + return object; + var message = new $root.google.rpc.Status(); + if (object.code != null) + message.code = object.code | 0; + if (object.message != null) + message.message = String(object.message); + if (object.details) { + if (!Array.isArray(object.details)) + throw TypeError(".google.rpc.Status.details: array expected"); + message.details = []; + for (var i = 0; i < object.details.length; ++i) { + if (typeof object.details[i] !== "object") + throw TypeError(".google.rpc.Status.details: object expected"); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @function toObject + * @memberof google.rpc.Status + * @static + * @param {google.rpc.Status} message Status + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Status.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.details = []; + if (options.defaults) { + object.code = 0; + object.message = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.details && message.details.length) { + object.details = []; + for (var j = 0; j < message.details.length; ++j) + object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); + } + return object; + }; + + /** + * Converts this Status to JSON. + * @function toJSON + * @memberof google.rpc.Status + * @instance + * @returns {Object.} JSON object + */ + Status.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Status + * @function getTypeUrl + * @memberof google.rpc.Status + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.rpc.Status"; + }; + + return Status; + })(); + + return rpc; + })(); + + google.type = (function() { + + /** + * Namespace type. + * @memberof google + * @namespace + */ + var type = {}; + + type.Interval = (function() { + + /** + * Properties of an Interval. + * @memberof google.type + * @interface IInterval + * @property {google.protobuf.ITimestamp|null} [startTime] Interval startTime + * @property {google.protobuf.ITimestamp|null} [endTime] Interval endTime + */ + + /** + * Constructs a new Interval. + * @memberof google.type + * @classdesc Represents an Interval. + * @implements IInterval + * @constructor + * @param {google.type.IInterval=} [properties] Properties to set + */ + function Interval(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Interval startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.type.Interval + * @instance + */ + Interval.prototype.startTime = null; + + /** + * Interval endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.type.Interval + * @instance + */ + Interval.prototype.endTime = null; + + /** + * Creates a new Interval instance using the specified properties. + * @function create + * @memberof google.type.Interval + * @static + * @param {google.type.IInterval=} [properties] Properties to set + * @returns {google.type.Interval} Interval instance + */ + Interval.create = function create(properties) { + return new Interval(properties); + }; + + /** + * Encodes the specified Interval message. Does not implicitly {@link google.type.Interval.verify|verify} messages. + * @function encode + * @memberof google.type.Interval + * @static + * @param {google.type.IInterval} message Interval message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Interval.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.type.Interval.verify|verify} messages. + * @function encodeDelimited + * @memberof google.type.Interval + * @static + * @param {google.type.IInterval} message Interval message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Interval.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Interval message from the specified reader or buffer. + * @function decode + * @memberof google.type.Interval + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.type.Interval} Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Interval.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.Interval(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Interval message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.type.Interval + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.type.Interval} Interval + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Interval.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Interval message. + * @function verify + * @memberof google.type.Interval + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Interval.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + return null; + }; + + /** + * Creates an Interval message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.type.Interval + * @static + * @param {Object.} object Plain object + * @returns {google.type.Interval} Interval + */ + Interval.fromObject = function fromObject(object) { + if (object instanceof $root.google.type.Interval) + return object; + var message = new $root.google.type.Interval(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.type.Interval.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.type.Interval.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + return message; + }; + + /** + * Creates a plain object from an Interval message. Also converts values to other types if specified. + * @function toObject + * @memberof google.type.Interval + * @static + * @param {google.type.Interval} message Interval + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Interval.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + return object; + }; + + /** + * Converts this Interval to JSON. + * @function toJSON + * @memberof google.type.Interval + * @instance + * @returns {Object.} JSON object + */ + Interval.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Interval + * @function getTypeUrl + * @memberof google.type.Interval + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Interval.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.type.Interval"; + }; + + return Interval; + })(); + + return type; + })(); + + return google; + })(); + + return $root; +}); diff --git a/owl-bot-staging/google-cloud-sql/protos/protos.json b/owl-bot-staging/google-cloud-sql/protos/protos.json new file mode 100644 index 000000000000..d3a8e054dbf8 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/protos/protos.json @@ -0,0 +1,18221 @@ +{ + "nested": { + "google": { + "nested": { + "cloud": { + "nested": { + "sql": { + "nested": { + "v1": { + "options": { + "go_package": "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb", + "java_multiple_files": true, + "java_outer_classname": "CloudSqlUsersProto", + "java_package": "com.google.cloud.sql.v1", + "(google.api.resource_definition).type": "compute.googleapis.com/Network", + "(google.api.resource_definition).pattern": "projects/{project}/global/networks/{network}" + }, + "nested": { + "SqlAvailableDatabaseVersionsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com" + }, + "methods": {} + }, + "SqlBackupRunsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "Delete": { + "requestType": "SqlBackupRunsDeleteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" + } + } + ] + }, + "Get": { + "requestType": "SqlBackupRunsGetRequest", + "responseType": "BackupRun", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" + } + } + ] + }, + "Insert": { + "requestType": "SqlBackupRunsInsertRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/backupRuns", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/backupRuns", + "body": "body" + } + } + ] + }, + "List": { + "requestType": "SqlBackupRunsListRequest", + "responseType": "BackupRunsListResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/backupRuns" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/backupRuns" + } + } + ] + } + } + }, + "SqlBackupRunsDeleteRequest": { + "fields": { + "id": { + "type": "int64", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + } + } + }, + "SqlBackupRunsGetRequest": { + "fields": { + "id": { + "type": "int64", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + } + } + }, + "SqlBackupRunsInsertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "BackupRun", + "id": 100 + } + } + }, + "SqlBackupRunsListRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "maxResults": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + } + } + }, + "BackupRun": { + "oneofs": { + "_maxChargeableBytes": { + "oneof": [ + "maxChargeableBytes" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "status": { + "type": "SqlBackupRunStatus", + "id": 2 + }, + "enqueuedTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "id": { + "type": "int64", + "id": 4 + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "error": { + "type": "OperationError", + "id": 7 + }, + "type": { + "type": "SqlBackupRunType", + "id": 8 + }, + "description": { + "type": "string", + "id": 9 + }, + "windowStartTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + }, + "instance": { + "type": "string", + "id": 11 + }, + "selfLink": { + "type": "string", + "id": 12 + }, + "location": { + "type": "string", + "id": 13 + }, + "databaseVersion": { + "type": "SqlDatabaseVersion", + "id": 15, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "diskEncryptionConfiguration": { + "type": "DiskEncryptionConfiguration", + "id": 16 + }, + "diskEncryptionStatus": { + "type": "DiskEncryptionStatus", + "id": 17 + }, + "backupKind": { + "type": "SqlBackupKind", + "id": 19 + }, + "timeZone": { + "type": "string", + "id": 23 + }, + "maxChargeableBytes": { + "type": "int64", + "id": 24, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + } + } + }, + "BackupRunsListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "BackupRun", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3 + } + } + }, + "SqlBackupRunStatus": { + "values": { + "SQL_BACKUP_RUN_STATUS_UNSPECIFIED": 0, + "ENQUEUED": 1, + "OVERDUE": 2, + "RUNNING": 3, + "FAILED": 4, + "SUCCESSFUL": 5, + "SKIPPED": 6, + "DELETION_PENDING": 7, + "DELETION_FAILED": 8, + "DELETED": 9 + } + }, + "SqlBackupKind": { + "values": { + "SQL_BACKUP_KIND_UNSPECIFIED": 0, + "SNAPSHOT": 1, + "PHYSICAL": 2 + } + }, + "SqlBackupRunType": { + "values": { + "SQL_BACKUP_RUN_TYPE_UNSPECIFIED": 0, + "AUTOMATED": 1, + "ON_DEMAND": 2 + } + }, + "AclEntry": { + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "expirationTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "kind": { + "type": "string", + "id": 4 + } + } + }, + "ApiWarning": { + "fields": { + "code": { + "type": "SqlApiWarningCode", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "region": { + "type": "string", + "id": 3 + } + }, + "nested": { + "SqlApiWarningCode": { + "values": { + "SQL_API_WARNING_CODE_UNSPECIFIED": 0, + "REGION_UNREACHABLE": 1, + "MAX_RESULTS_EXCEEDS_LIMIT": 2, + "COMPROMISED_CREDENTIALS": 3, + "INTERNAL_STATE_FAILURE": 4 + } + } + } + }, + "BackupRetentionSettings": { + "fields": { + "retentionUnit": { + "type": "RetentionUnit", + "id": 1 + }, + "retainedBackups": { + "type": "google.protobuf.Int32Value", + "id": 2 + } + }, + "nested": { + "RetentionUnit": { + "values": { + "RETENTION_UNIT_UNSPECIFIED": 0, + "COUNT": 1 + } + } + } + }, + "BackupConfiguration": { + "oneofs": { + "_transactionalLogStorageState": { + "oneof": [ + "transactionalLogStorageState" + ] + }, + "_backupTier": { + "oneof": [ + "backupTier" + ] + } + }, + "fields": { + "startTime": { + "type": "string", + "id": 1 + }, + "enabled": { + "type": "google.protobuf.BoolValue", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + }, + "binaryLogEnabled": { + "type": "google.protobuf.BoolValue", + "id": 4 + }, + "replicationLogArchivingEnabled": { + "type": "google.protobuf.BoolValue", + "id": 5 + }, + "location": { + "type": "string", + "id": 6 + }, + "pointInTimeRecoveryEnabled": { + "type": "google.protobuf.BoolValue", + "id": 7 + }, + "backupRetentionSettings": { + "type": "BackupRetentionSettings", + "id": 8 + }, + "transactionLogRetentionDays": { + "type": "google.protobuf.Int32Value", + "id": 9 + }, + "transactionalLogStorageState": { + "type": "TransactionalLogStorageState", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "backupTier": { + "type": "BackupTier", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + } + }, + "nested": { + "TransactionalLogStorageState": { + "values": { + "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED": 0, + "DISK": 1, + "SWITCHING_TO_CLOUD_STORAGE": 2, + "SWITCHED_TO_CLOUD_STORAGE": 3, + "CLOUD_STORAGE": 4 + } + }, + "BackupTier": { + "valuesOptions": { + "ADVANCED": { + "deprecated": true + } + }, + "values": { + "BACKUP_TIER_UNSPECIFIED": 0, + "STANDARD": 1, + "ADVANCED": 2, + "ENHANCED": 3 + } + } + } + }, + "PerformDiskShrinkContext": { + "fields": { + "targetSizeGb": { + "type": "int64", + "id": 1 + } + } + }, + "PreCheckResponse": { + "oneofs": { + "_message": { + "oneof": [ + "message" + ] + }, + "_messageType": { + "oneof": [ + "messageType" + ] + } + }, + "fields": { + "message": { + "type": "string", + "id": 2, + "options": { + "proto3_optional": true + } + }, + "messageType": { + "type": "MessageType", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "actionsRequired": { + "rule": "repeated", + "type": "string", + "id": 4 + } + }, + "nested": { + "MessageType": { + "values": { + "MESSAGE_TYPE_UNSPECIFIED": 0, + "INFO": 1, + "WARNING": 2, + "ERROR": 3 + } + } + } + }, + "PreCheckMajorVersionUpgradeContext": { + "fields": { + "targetDatabaseVersion": { + "type": "SqlDatabaseVersion", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "preCheckResponse": { + "rule": "repeated", + "type": "PreCheckResponse", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "kind": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "BackupContext": { + "fields": { + "backupId": { + "type": "int64", + "id": 1 + }, + "kind": { + "type": "string", + "id": 2 + }, + "name": { + "type": "string", + "id": 3 + } + } + }, + "Database": { + "oneofs": { + "databaseDetails": { + "oneof": [ + "sqlserverDatabaseDetails" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "charset": { + "type": "string", + "id": 2 + }, + "collation": { + "type": "string", + "id": 3 + }, + "etag": { + "type": "string", + "id": 4 + }, + "name": { + "type": "string", + "id": 5 + }, + "instance": { + "type": "string", + "id": 6 + }, + "selfLink": { + "type": "string", + "id": 7 + }, + "project": { + "type": "string", + "id": 8 + }, + "sqlserverDatabaseDetails": { + "type": "SqlServerDatabaseDetails", + "id": 9 + } + } + }, + "SqlServerDatabaseDetails": { + "fields": { + "compatibilityLevel": { + "type": "int32", + "id": 1 + }, + "recoveryModel": { + "type": "string", + "id": 2 + } + } + }, + "DatabaseFlags": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "type": "string", + "id": 2 + } + } + }, + "MySqlSyncConfig": { + "fields": { + "initialSyncFlags": { + "rule": "repeated", + "type": "SyncFlags", + "id": 1 + } + } + }, + "SyncFlags": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "type": "string", + "id": 2 + } + } + }, + "InstanceReference": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "region": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + } + } + }, + "DemoteMasterConfiguration": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "mysqlReplicaConfiguration": { + "type": "DemoteMasterMySqlReplicaConfiguration", + "id": 2 + } + } + }, + "DemoteMasterMySqlReplicaConfiguration": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "username": { + "type": "string", + "id": 2 + }, + "password": { + "type": "string", + "id": 3 + }, + "clientKey": { + "type": "string", + "id": 4 + }, + "clientCertificate": { + "type": "string", + "id": 5 + }, + "caCertificate": { + "type": "string", + "id": 6 + } + } + }, + "SqlFileType": { + "values": { + "SQL_FILE_TYPE_UNSPECIFIED": 0, + "SQL": 1, + "CSV": 2, + "BAK": 4, + "TDE": 8 + } + }, + "ExportContext": { + "fields": { + "uri": { + "type": "string", + "id": 1 + }, + "databases": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + }, + "sqlExportOptions": { + "type": "SqlExportOptions", + "id": 4 + }, + "csvExportOptions": { + "type": "SqlCsvExportOptions", + "id": 5 + }, + "fileType": { + "type": "SqlFileType", + "id": 6 + }, + "offload": { + "type": "google.protobuf.BoolValue", + "id": 8 + }, + "bakExportOptions": { + "type": "SqlBakExportOptions", + "id": 9 + }, + "tdeExportOptions": { + "type": "SqlTdeExportOptions", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SqlCsvExportOptions": { + "fields": { + "selectQuery": { + "type": "string", + "id": 1 + }, + "escapeCharacter": { + "type": "string", + "id": 2 + }, + "quoteCharacter": { + "type": "string", + "id": 3 + }, + "fieldsTerminatedBy": { + "type": "string", + "id": 4 + }, + "linesTerminatedBy": { + "type": "string", + "id": 6 + } + } + }, + "SqlExportOptions": { + "fields": { + "tables": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "schemaOnly": { + "type": "google.protobuf.BoolValue", + "id": 2 + }, + "mysqlExportOptions": { + "type": "MysqlExportOptions", + "id": 3 + }, + "threads": { + "type": "google.protobuf.Int32Value", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "parallel": { + "type": "google.protobuf.BoolValue", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "postgresExportOptions": { + "type": "PostgresExportOptions", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "MysqlExportOptions": { + "fields": { + "masterData": { + "type": "google.protobuf.Int32Value", + "id": 1 + } + } + }, + "PostgresExportOptions": { + "fields": { + "clean": { + "type": "google.protobuf.BoolValue", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "ifExists": { + "type": "google.protobuf.BoolValue", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "SqlBakExportOptions": { + "fields": { + "striped": { + "type": "google.protobuf.BoolValue", + "id": 1 + }, + "stripeCount": { + "type": "google.protobuf.Int32Value", + "id": 2 + }, + "bakType": { + "type": "BakType", + "id": 4 + }, + "copyOnly": { + "type": "google.protobuf.BoolValue", + "id": 5, + "options": { + "deprecated": true + } + }, + "differentialBase": { + "type": "google.protobuf.BoolValue", + "id": 6 + }, + "exportLogStartTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "exportLogEndTime": { + "type": "google.protobuf.Timestamp", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlTdeExportOptions": { + "fields": { + "certificatePath": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "privateKeyPath": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "privateKeyPassword": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "name": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "ImportContext": { + "fields": { + "uri": { + "type": "string", + "id": 1 + }, + "database": { + "type": "string", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + }, + "fileType": { + "type": "SqlFileType", + "id": 4 + }, + "csvImportOptions": { + "type": "SqlCsvImportOptions", + "id": 5 + }, + "importUser": { + "type": "string", + "id": 6 + }, + "bakImportOptions": { + "type": "SqlBakImportOptions", + "id": 7 + }, + "sqlImportOptions": { + "type": "SqlImportOptions", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "tdeImportOptions": { + "type": "SqlTdeImportOptions", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SqlImportOptions": { + "fields": { + "threads": { + "type": "google.protobuf.Int32Value", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "parallel": { + "type": "google.protobuf.BoolValue", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "postgresImportOptions": { + "type": "PostgresImportOptions", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "PostgresImportOptions": { + "fields": { + "clean": { + "type": "google.protobuf.BoolValue", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "ifExists": { + "type": "google.protobuf.BoolValue", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "SqlCsvImportOptions": { + "fields": { + "table": { + "type": "string", + "id": 1 + }, + "columns": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "escapeCharacter": { + "type": "string", + "id": 4 + }, + "quoteCharacter": { + "type": "string", + "id": 5 + }, + "fieldsTerminatedBy": { + "type": "string", + "id": 6 + }, + "linesTerminatedBy": { + "type": "string", + "id": 8 + } + } + }, + "SqlBakImportOptions": { + "fields": { + "encryptionOptions": { + "type": "EncryptionOptions", + "id": 1 + }, + "striped": { + "type": "google.protobuf.BoolValue", + "id": 2 + }, + "noRecovery": { + "type": "google.protobuf.BoolValue", + "id": 4 + }, + "recoveryOnly": { + "type": "google.protobuf.BoolValue", + "id": 5 + }, + "bakType": { + "type": "BakType", + "id": 6 + }, + "stopAt": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "stopAtMark": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "EncryptionOptions": { + "fields": { + "certPath": { + "type": "string", + "id": 1 + }, + "pvkPath": { + "type": "string", + "id": 2 + }, + "pvkPassword": { + "type": "string", + "id": 3 + }, + "keepEncrypted": { + "type": "google.protobuf.BoolValue", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "SqlTdeImportOptions": { + "fields": { + "certificatePath": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "privateKeyPath": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "privateKeyPassword": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "name": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "BakType": { + "values": { + "BAK_TYPE_UNSPECIFIED": 0, + "FULL": 1, + "DIFF": 2, + "TLOG": 3 + } + }, + "IpConfiguration": { + "oneofs": { + "_pscConfig": { + "oneof": [ + "pscConfig" + ] + }, + "_serverCaMode": { + "oneof": [ + "serverCaMode" + ] + }, + "_serverCaPool": { + "oneof": [ + "serverCaPool" + ] + }, + "_serverCertificateRotationMode": { + "oneof": [ + "serverCertificateRotationMode" + ] + } + }, + "fields": { + "ipv4Enabled": { + "type": "google.protobuf.BoolValue", + "id": 1 + }, + "privateNetwork": { + "type": "string", + "id": 2 + }, + "requireSsl": { + "type": "google.protobuf.BoolValue", + "id": 3 + }, + "authorizedNetworks": { + "rule": "repeated", + "type": "AclEntry", + "id": 4 + }, + "allocatedIpRange": { + "type": "string", + "id": 6 + }, + "enablePrivatePathForGoogleCloudServices": { + "type": "google.protobuf.BoolValue", + "id": 7 + }, + "sslMode": { + "type": "SslMode", + "id": 8 + }, + "pscConfig": { + "type": "PscConfig", + "id": 9, + "options": { + "proto3_optional": true + } + }, + "serverCaMode": { + "type": "CaMode", + "id": 10, + "options": { + "proto3_optional": true + } + }, + "customSubjectAlternativeNames": { + "rule": "repeated", + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "serverCaPool": { + "type": "string", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "serverCertificateRotationMode": { + "type": "ServerCertificateRotationMode", + "id": 16, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + }, + "nested": { + "SslMode": { + "values": { + "SSL_MODE_UNSPECIFIED": 0, + "ALLOW_UNENCRYPTED_AND_ENCRYPTED": 1, + "ENCRYPTED_ONLY": 2, + "TRUSTED_CLIENT_CERTIFICATE_REQUIRED": 3 + } + }, + "CaMode": { + "values": { + "CA_MODE_UNSPECIFIED": 0, + "GOOGLE_MANAGED_INTERNAL_CA": 1, + "GOOGLE_MANAGED_CAS_CA": 2, + "CUSTOMER_MANAGED_CAS_CA": 3 + } + }, + "ServerCertificateRotationMode": { + "values": { + "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED": 0, + "NO_AUTOMATIC_ROTATION": 1, + "AUTOMATIC_ROTATION_DURING_MAINTENANCE": 2 + } + } + } + }, + "PscConfig": { + "oneofs": { + "_pscEnabled": { + "oneof": [ + "pscEnabled" + ] + }, + "_pscAutoDnsEnabled": { + "oneof": [ + "pscAutoDnsEnabled" + ] + }, + "_pscWriteEndpointDnsEnabled": { + "oneof": [ + "pscWriteEndpointDnsEnabled" + ] + } + }, + "fields": { + "pscEnabled": { + "type": "bool", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "allowedConsumerProjects": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pscAutoConnections": { + "rule": "repeated", + "type": "PscAutoConnectionConfig", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "networkAttachmentUri": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pscAutoDnsEnabled": { + "type": "bool", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "pscWriteEndpointDnsEnabled": { + "type": "bool", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + } + }, + "PscAutoConnectionConfig": { + "oneofs": { + "_ipAddress": { + "oneof": [ + "ipAddress" + ] + }, + "_status": { + "oneof": [ + "status" + ] + }, + "_consumerNetworkStatus": { + "oneof": [ + "consumerNetworkStatus" + ] + } + }, + "fields": { + "consumerProject": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "consumerNetwork": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "ipAddress": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_info).format": "IPV4_OR_IPV6", + "proto3_optional": true + } + }, + "status": { + "type": "string", + "id": 4, + "options": { + "proto3_optional": true + } + }, + "consumerNetworkStatus": { + "type": "string", + "id": 5, + "options": { + "proto3_optional": true + } + } + } + }, + "LocationPreference": { + "fields": { + "followGaeApplication": { + "type": "string", + "id": 1, + "options": { + "deprecated": true + } + }, + "zone": { + "type": "string", + "id": 2 + }, + "secondaryZone": { + "type": "string", + "id": 4 + }, + "kind": { + "type": "string", + "id": 3 + } + } + }, + "MaintenanceWindow": { + "fields": { + "hour": { + "type": "google.protobuf.Int32Value", + "id": 1 + }, + "day": { + "type": "google.protobuf.Int32Value", + "id": 2 + }, + "updateTrack": { + "type": "SqlUpdateTrack", + "id": 3 + }, + "kind": { + "type": "string", + "id": 4 + } + } + }, + "DenyMaintenancePeriod": { + "fields": { + "startDate": { + "type": "string", + "id": 1 + }, + "endDate": { + "type": "string", + "id": 2 + }, + "time": { + "type": "string", + "id": 3 + } + } + }, + "InsightsConfig": { + "fields": { + "queryInsightsEnabled": { + "type": "bool", + "id": 1 + }, + "recordClientAddress": { + "type": "bool", + "id": 2 + }, + "recordApplicationTags": { + "type": "bool", + "id": 3 + }, + "queryStringLength": { + "type": "google.protobuf.Int32Value", + "id": 4 + }, + "queryPlansPerMinute": { + "type": "google.protobuf.Int32Value", + "id": 5 + }, + "enhancedQueryInsightsEnabled": { + "type": "google.protobuf.BoolValue", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "MySqlReplicaConfiguration": { + "fields": { + "dumpFilePath": { + "type": "string", + "id": 1 + }, + "username": { + "type": "string", + "id": 2 + }, + "password": { + "type": "string", + "id": 3 + }, + "connectRetryInterval": { + "type": "google.protobuf.Int32Value", + "id": 4 + }, + "masterHeartbeatPeriod": { + "type": "google.protobuf.Int64Value", + "id": 5 + }, + "caCertificate": { + "type": "string", + "id": 6 + }, + "clientCertificate": { + "type": "string", + "id": 7 + }, + "clientKey": { + "type": "string", + "id": 8 + }, + "sslCipher": { + "type": "string", + "id": 9 + }, + "verifyServerCertificate": { + "type": "google.protobuf.BoolValue", + "id": 10 + }, + "kind": { + "type": "string", + "id": 11 + } + } + }, + "DiskEncryptionConfiguration": { + "fields": { + "kmsKeyName": { + "type": "string", + "id": 1 + }, + "kind": { + "type": "string", + "id": 2 + } + } + }, + "DiskEncryptionStatus": { + "fields": { + "kmsKeyVersionName": { + "type": "string", + "id": 1 + }, + "kind": { + "type": "string", + "id": 2 + } + } + }, + "IpMapping": { + "fields": { + "type": { + "type": "SqlIpAddressType", + "id": 1 + }, + "ipAddress": { + "type": "string", + "id": 2 + }, + "timeToRetire": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "SqlMaintenanceType": { + "values": { + "SQL_MAINTENANCE_TYPE_UNSPECIFIED": 0, + "INSTANCE_MAINTENANCE": 1, + "REPLICA_INCLUDED_MAINTENANCE": 2, + "INSTANCE_SELF_SERVICE_MAINTENANCE": 3, + "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE": 4 + } + }, + "SqlSubOperationType": { + "oneofs": { + "subOperationDetails": { + "oneof": [ + "maintenanceType" + ] + } + }, + "fields": { + "maintenanceType": { + "type": "SqlMaintenanceType", + "id": 1 + } + } + }, + "Operation": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "targetLink": { + "type": "string", + "id": 2 + }, + "status": { + "type": "SqlOperationStatus", + "id": 3 + }, + "user": { + "type": "string", + "id": 4 + }, + "insertTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + }, + "error": { + "type": "OperationErrors", + "id": 8 + }, + "apiWarning": { + "type": "ApiWarning", + "id": 19 + }, + "operationType": { + "type": "SqlOperationType", + "id": 9 + }, + "importContext": { + "type": "ImportContext", + "id": 10 + }, + "exportContext": { + "type": "ExportContext", + "id": 11 + }, + "backupContext": { + "type": "BackupContext", + "id": 17 + }, + "preCheckMajorVersionUpgradeContext": { + "type": "PreCheckMajorVersionUpgradeContext", + "id": 50 + }, + "name": { + "type": "string", + "id": 12 + }, + "targetId": { + "type": "string", + "id": 13 + }, + "selfLink": { + "type": "string", + "id": 14 + }, + "targetProject": { + "type": "string", + "id": 15 + }, + "acquireSsrsLeaseContext": { + "type": "AcquireSsrsLeaseContext", + "id": 20 + }, + "subOperationType": { + "type": "SqlSubOperationType", + "id": 48, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SqlOperationType": { + "valuesOptions": { + "BACKUP": { + "deprecated": true + }, + "SNAPSHOT": { + "deprecated": true + }, + "ENABLE_PRIVATE_IP": { + "deprecated": true + }, + "DEFER_MAINTENANCE": { + "deprecated": true + }, + "CREATE_CLONE": { + "deprecated": true + }, + "CLUSTER_MAINTENANCE": { + "deprecated": true + }, + "SELF_SERVICE_MAINTENANCE": { + "deprecated": true + }, + "ADVANCED_BACKUP": { + "deprecated": true + } + }, + "values": { + "SQL_OPERATION_TYPE_UNSPECIFIED": 0, + "IMPORT": 1, + "EXPORT": 2, + "CREATE": 3, + "UPDATE": 4, + "DELETE": 5, + "RESTART": 6, + "BACKUP": 7, + "SNAPSHOT": 8, + "BACKUP_VOLUME": 9, + "DELETE_VOLUME": 10, + "RESTORE_VOLUME": 11, + "INJECT_USER": 12, + "CLONE": 14, + "STOP_REPLICA": 15, + "START_REPLICA": 16, + "PROMOTE_REPLICA": 17, + "CREATE_REPLICA": 18, + "CREATE_USER": 19, + "DELETE_USER": 20, + "UPDATE_USER": 21, + "CREATE_DATABASE": 22, + "DELETE_DATABASE": 23, + "UPDATE_DATABASE": 24, + "FAILOVER": 25, + "DELETE_BACKUP": 26, + "RECREATE_REPLICA": 27, + "TRUNCATE_LOG": 28, + "DEMOTE_MASTER": 29, + "MAINTENANCE": 30, + "ENABLE_PRIVATE_IP": 31, + "DEFER_MAINTENANCE": 32, + "CREATE_CLONE": 33, + "RESCHEDULE_MAINTENANCE": 34, + "START_EXTERNAL_SYNC": 35, + "LOG_CLEANUP": 36, + "AUTO_RESTART": 37, + "REENCRYPT": 38, + "SWITCHOVER": 39, + "UPDATE_BACKUP": 40, + "ACQUIRE_SSRS_LEASE": 42, + "RELEASE_SSRS_LEASE": 43, + "RECONFIGURE_OLD_PRIMARY": 44, + "CLUSTER_MAINTENANCE": 45, + "SELF_SERVICE_MAINTENANCE": 46, + "SWITCHOVER_TO_REPLICA": 47, + "MAJOR_VERSION_UPGRADE": 48, + "ADVANCED_BACKUP": 49, + "MANAGE_BACKUP": 50, + "ENHANCED_BACKUP": 51, + "REPAIR_READ_POOL": 52, + "CREATE_READ_POOL": 53, + "PRE_CHECK_MAJOR_VERSION_UPGRADE": 54 + } + }, + "SqlOperationStatus": { + "values": { + "SQL_OPERATION_STATUS_UNSPECIFIED": 0, + "PENDING": 1, + "RUNNING": 2, + "DONE": 3 + } + } + } + }, + "OperationError": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "code": { + "type": "string", + "id": 2 + }, + "message": { + "type": "string", + "id": 3 + } + } + }, + "OperationErrors": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "errors": { + "rule": "repeated", + "type": "OperationError", + "id": 2 + } + } + }, + "PasswordValidationPolicy": { + "fields": { + "minLength": { + "type": "google.protobuf.Int32Value", + "id": 1 + }, + "complexity": { + "type": "Complexity", + "id": 2 + }, + "reuseInterval": { + "type": "google.protobuf.Int32Value", + "id": 3 + }, + "disallowUsernameSubstring": { + "type": "google.protobuf.BoolValue", + "id": 4 + }, + "passwordChangeInterval": { + "type": "google.protobuf.Duration", + "id": 5 + }, + "enablePasswordPolicy": { + "type": "google.protobuf.BoolValue", + "id": 6 + }, + "disallowCompromisedCredentials": { + "type": "google.protobuf.BoolValue", + "id": 7, + "options": { + "deprecated": true + } + } + }, + "nested": { + "Complexity": { + "values": { + "COMPLEXITY_UNSPECIFIED": 0, + "COMPLEXITY_DEFAULT": 1 + } + } + } + }, + "DataCacheConfig": { + "fields": { + "dataCacheEnabled": { + "type": "bool", + "id": 1 + } + } + }, + "FinalBackupConfig": { + "oneofs": { + "_enabled": { + "oneof": [ + "enabled" + ] + }, + "_retentionDays": { + "oneof": [ + "retentionDays" + ] + } + }, + "fields": { + "enabled": { + "type": "bool", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "retentionDays": { + "type": "int32", + "id": 3, + "options": { + "proto3_optional": true + } + } + } + }, + "Settings": { + "oneofs": { + "_dataDiskProvisionedIops": { + "oneof": [ + "dataDiskProvisionedIops" + ] + }, + "_dataDiskProvisionedThroughput": { + "oneof": [ + "dataDiskProvisionedThroughput" + ] + }, + "_connectionPoolConfig": { + "oneof": [ + "connectionPoolConfig" + ] + }, + "_finalBackupConfig": { + "oneof": [ + "finalBackupConfig" + ] + }, + "_readPoolAutoScaleConfig": { + "oneof": [ + "readPoolAutoScaleConfig" + ] + }, + "_autoUpgradeEnabled": { + "oneof": [ + "autoUpgradeEnabled" + ] + }, + "_dataApiAccess": { + "oneof": [ + "dataApiAccess" + ] + } + }, + "fields": { + "settingsVersion": { + "type": "google.protobuf.Int64Value", + "id": 1 + }, + "authorizedGaeApplications": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "deprecated": true + } + }, + "tier": { + "type": "string", + "id": 3 + }, + "kind": { + "type": "string", + "id": 4 + }, + "userLabels": { + "keyType": "string", + "type": "string", + "id": 5 + }, + "availabilityType": { + "type": "SqlAvailabilityType", + "id": 6 + }, + "pricingPlan": { + "type": "SqlPricingPlan", + "id": 7 + }, + "replicationType": { + "type": "SqlReplicationType", + "id": 8, + "options": { + "deprecated": true + } + }, + "storageAutoResizeLimit": { + "type": "google.protobuf.Int64Value", + "id": 9 + }, + "activationPolicy": { + "type": "SqlActivationPolicy", + "id": 10 + }, + "ipConfiguration": { + "type": "IpConfiguration", + "id": 11 + }, + "storageAutoResize": { + "type": "google.protobuf.BoolValue", + "id": 12 + }, + "locationPreference": { + "type": "LocationPreference", + "id": 13 + }, + "databaseFlags": { + "rule": "repeated", + "type": "DatabaseFlags", + "id": 14 + }, + "dataDiskType": { + "type": "SqlDataDiskType", + "id": 15 + }, + "maintenanceWindow": { + "type": "MaintenanceWindow", + "id": 16 + }, + "backupConfiguration": { + "type": "BackupConfiguration", + "id": 17 + }, + "databaseReplicationEnabled": { + "type": "google.protobuf.BoolValue", + "id": 18 + }, + "crashSafeReplicationEnabled": { + "type": "google.protobuf.BoolValue", + "id": 19, + "options": { + "deprecated": true + } + }, + "dataDiskSizeGb": { + "type": "google.protobuf.Int64Value", + "id": 20 + }, + "activeDirectoryConfig": { + "type": "SqlActiveDirectoryConfig", + "id": 22 + }, + "collation": { + "type": "string", + "id": 23 + }, + "denyMaintenancePeriods": { + "rule": "repeated", + "type": "DenyMaintenancePeriod", + "id": 24 + }, + "insightsConfig": { + "type": "InsightsConfig", + "id": 25 + }, + "passwordValidationPolicy": { + "type": "PasswordValidationPolicy", + "id": 27 + }, + "sqlServerAuditConfig": { + "type": "SqlServerAuditConfig", + "id": 29 + }, + "edition": { + "type": "Edition", + "id": 38, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "connectorEnforcement": { + "type": "ConnectorEnforcement", + "id": 32 + }, + "deletionProtectionEnabled": { + "type": "google.protobuf.BoolValue", + "id": 33 + }, + "timeZone": { + "type": "string", + "id": 34 + }, + "advancedMachineFeatures": { + "type": "AdvancedMachineFeatures", + "id": 35 + }, + "dataCacheConfig": { + "type": "DataCacheConfig", + "id": 37 + }, + "replicationLagMaxSeconds": { + "type": "google.protobuf.Int32Value", + "id": 39, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "enableGoogleMlIntegration": { + "type": "google.protobuf.BoolValue", + "id": 40, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "enableDataplexIntegration": { + "type": "google.protobuf.BoolValue", + "id": 41, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "retainBackupsOnDelete": { + "type": "google.protobuf.BoolValue", + "id": 42, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "dataDiskProvisionedIops": { + "type": "int64", + "id": 43, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "dataDiskProvisionedThroughput": { + "type": "int64", + "id": 44, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "connectionPoolConfig": { + "type": "ConnectionPoolConfig", + "id": 45, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "finalBackupConfig": { + "type": "FinalBackupConfig", + "id": 47, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "readPoolAutoScaleConfig": { + "type": "ReadPoolAutoScaleConfig", + "id": 48, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "acceleratedReplicaMode": { + "type": "google.protobuf.BoolValue", + "id": 49, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "autoUpgradeEnabled": { + "type": "bool", + "id": 50, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "entraidConfig": { + "type": "SqlServerEntraIdConfig", + "id": 52, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "dataApiAccess": { + "type": "DataApiAccess", + "id": 53, + "options": { + "proto3_optional": true + } + }, + "performanceCaptureConfig": { + "type": "PerformanceCaptureConfig", + "id": 54, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SqlActivationPolicy": { + "valuesOptions": { + "ON_DEMAND": { + "deprecated": true + } + }, + "values": { + "SQL_ACTIVATION_POLICY_UNSPECIFIED": 0, + "ALWAYS": 1, + "NEVER": 2, + "ON_DEMAND": 3 + } + }, + "Edition": { + "values": { + "EDITION_UNSPECIFIED": 0, + "ENTERPRISE": 2, + "ENTERPRISE_PLUS": 3 + } + }, + "ConnectorEnforcement": { + "values": { + "CONNECTOR_ENFORCEMENT_UNSPECIFIED": 0, + "NOT_REQUIRED": 1, + "REQUIRED": 2 + } + }, + "DataApiAccess": { + "values": { + "DATA_API_ACCESS_UNSPECIFIED": 0, + "DISALLOW_DATA_API": 1, + "ALLOW_DATA_API": 2 + } + } + } + }, + "PerformanceCaptureConfig": { + "oneofs": { + "_enabled": { + "oneof": [ + "enabled" + ] + }, + "_probingIntervalSeconds": { + "oneof": [ + "probingIntervalSeconds" + ] + }, + "_probeThreshold": { + "oneof": [ + "probeThreshold" + ] + }, + "_runningThreadsThreshold": { + "oneof": [ + "runningThreadsThreshold" + ] + }, + "_secondsBehindSourceThreshold": { + "oneof": [ + "secondsBehindSourceThreshold" + ] + }, + "_transactionDurationThreshold": { + "oneof": [ + "transactionDurationThreshold" + ] + } + }, + "fields": { + "enabled": { + "type": "bool", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "probingIntervalSeconds": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "probeThreshold": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "runningThreadsThreshold": { + "type": "int32", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "secondsBehindSourceThreshold": { + "type": "int32", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "transactionDurationThreshold": { + "type": "int32", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + } + }, + "ConnectionPoolFlags": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "value": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ConnectionPoolConfig": { + "oneofs": { + "_connectionPoolingEnabled": { + "oneof": [ + "connectionPoolingEnabled" + ] + }, + "_poolerCount": { + "oneof": [ + "poolerCount" + ] + } + }, + "fields": { + "connectionPoolingEnabled": { + "type": "bool", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "flags": { + "rule": "repeated", + "type": "ConnectionPoolFlags", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "poolerCount": { + "type": "int32", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + } + } + }, + "ReadPoolAutoScaleConfig": { + "oneofs": { + "_enabled": { + "oneof": [ + "enabled" + ] + }, + "_minNodeCount": { + "oneof": [ + "minNodeCount" + ] + }, + "_maxNodeCount": { + "oneof": [ + "maxNodeCount" + ] + }, + "_disableScaleIn": { + "oneof": [ + "disableScaleIn" + ] + }, + "_scaleInCooldownSeconds": { + "oneof": [ + "scaleInCooldownSeconds" + ] + }, + "_scaleOutCooldownSeconds": { + "oneof": [ + "scaleOutCooldownSeconds" + ] + } + }, + "fields": { + "enabled": { + "type": "bool", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "minNodeCount": { + "type": "int32", + "id": 2, + "options": { + "proto3_optional": true + } + }, + "maxNodeCount": { + "type": "int32", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "targetMetrics": { + "rule": "repeated", + "type": "TargetMetric", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "disableScaleIn": { + "type": "bool", + "id": 5, + "options": { + "proto3_optional": true + } + }, + "scaleInCooldownSeconds": { + "type": "int32", + "id": 6, + "options": { + "proto3_optional": true + } + }, + "scaleOutCooldownSeconds": { + "type": "int32", + "id": 7, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "TargetMetric": { + "oneofs": { + "_metric": { + "oneof": [ + "metric" + ] + }, + "_targetValue": { + "oneof": [ + "targetValue" + ] + } + }, + "fields": { + "metric": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "targetValue": { + "type": "float", + "id": 2, + "options": { + "proto3_optional": true + } + } + } + } + } + }, + "AdvancedMachineFeatures": { + "fields": { + "threadsPerCore": { + "type": "int32", + "id": 1 + } + } + }, + "SslCert": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "certSerialNumber": { + "type": "string", + "id": 2 + }, + "cert": { + "type": "string", + "id": 3 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "commonName": { + "type": "string", + "id": 5 + }, + "expirationTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "sha1Fingerprint": { + "type": "string", + "id": 7 + }, + "instance": { + "type": "string", + "id": 8 + }, + "selfLink": { + "type": "string", + "id": 9 + } + } + }, + "SslCertDetail": { + "fields": { + "certInfo": { + "type": "SslCert", + "id": 1 + }, + "certPrivateKey": { + "type": "string", + "id": 2 + } + } + }, + "SqlActiveDirectoryConfig": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "domain": { + "type": "string", + "id": 2 + }, + "mode": { + "type": "ActiveDirectoryMode", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "dnsServers": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "(google.api.field_info).format": "IPV4", + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "adminCredentialSecretName": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "organizationalUnit": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "ActiveDirectoryMode": { + "valuesOptions": { + "SELF_MANAGED_ACTIVE_DIRECTORY": { + "deprecated": true + } + }, + "values": { + "ACTIVE_DIRECTORY_MODE_UNSPECIFIED": 0, + "MANAGED_ACTIVE_DIRECTORY": 1, + "SELF_MANAGED_ACTIVE_DIRECTORY": 2, + "CUSTOMER_MANAGED_ACTIVE_DIRECTORY": 3 + } + } + } + }, + "SqlServerAuditConfig": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "bucket": { + "type": "string", + "id": 2 + }, + "retentionInterval": { + "type": "google.protobuf.Duration", + "id": 3 + }, + "uploadInterval": { + "type": "google.protobuf.Duration", + "id": 4 + } + } + }, + "SqlServerEntraIdConfig": { + "fields": { + "kind": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "tenantId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "applicationId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlBackendType": { + "valuesOptions": { + "FIRST_GEN": { + "deprecated": true + } + }, + "values": { + "SQL_BACKEND_TYPE_UNSPECIFIED": 0, + "FIRST_GEN": 1, + "SECOND_GEN": 2, + "EXTERNAL": 3 + } + }, + "SqlIpAddressType": { + "values": { + "SQL_IP_ADDRESS_TYPE_UNSPECIFIED": 0, + "PRIMARY": 1, + "OUTGOING": 2, + "PRIVATE": 3, + "MIGRATED_1ST_GEN": 4 + } + }, + "SqlDatabaseVersion": { + "valuesOptions": { + "MYSQL_5_1": { + "deprecated": true + }, + "MYSQL_5_5": { + "deprecated": true + }, + "MYSQL_8_0_29": { + "deprecated": true + } + }, + "values": { + "SQL_DATABASE_VERSION_UNSPECIFIED": 0, + "MYSQL_5_1": 2, + "MYSQL_5_5": 3, + "MYSQL_5_6": 5, + "MYSQL_5_7": 6, + "MYSQL_8_0": 20, + "MYSQL_8_0_18": 41, + "MYSQL_8_0_26": 85, + "MYSQL_8_0_27": 111, + "MYSQL_8_0_28": 132, + "MYSQL_8_0_29": 148, + "MYSQL_8_0_30": 174, + "MYSQL_8_0_31": 197, + "MYSQL_8_0_32": 213, + "MYSQL_8_0_33": 238, + "MYSQL_8_0_34": 239, + "MYSQL_8_0_35": 240, + "MYSQL_8_0_36": 241, + "MYSQL_8_0_37": 355, + "MYSQL_8_0_39": 357, + "MYSQL_8_0_40": 358, + "MYSQL_8_0_41": 488, + "MYSQL_8_0_42": 489, + "MYSQL_8_0_43": 553, + "MYSQL_8_0_44": 554, + "MYSQL_8_0_45": 555, + "MYSQL_8_0_46": 556, + "MYSQL_8_4": 398, + "MYSQL_9_7": 654, + "SQLSERVER_2017_STANDARD": 11, + "SQLSERVER_2017_ENTERPRISE": 14, + "SQLSERVER_2017_EXPRESS": 15, + "SQLSERVER_2017_WEB": 16, + "POSTGRES_9_6": 9, + "POSTGRES_10": 18, + "POSTGRES_11": 10, + "POSTGRES_12": 19, + "POSTGRES_13": 23, + "POSTGRES_14": 110, + "POSTGRES_15": 172, + "POSTGRES_16": 272, + "POSTGRES_17": 408, + "POSTGRES_18": 557, + "POSTGRES_19": 684, + "SQLSERVER_2019_STANDARD": 26, + "SQLSERVER_2019_ENTERPRISE": 27, + "SQLSERVER_2019_EXPRESS": 28, + "SQLSERVER_2019_WEB": 29, + "SQLSERVER_2022_STANDARD": 199, + "SQLSERVER_2022_ENTERPRISE": 200, + "SQLSERVER_2022_EXPRESS": 201, + "SQLSERVER_2022_WEB": 202, + "SQLSERVER_2025_STANDARD": 549, + "SQLSERVER_2025_ENTERPRISE": 550, + "SQLSERVER_2025_EXPRESS": 551 + } + }, + "SqlPricingPlan": { + "values": { + "SQL_PRICING_PLAN_UNSPECIFIED": 0, + "PACKAGE": 1, + "PER_USE": 2 + } + }, + "SqlReplicationType": { + "values": { + "SQL_REPLICATION_TYPE_UNSPECIFIED": 0, + "SYNCHRONOUS": 1, + "ASYNCHRONOUS": 2 + } + }, + "SqlDataDiskType": { + "valuesOptions": { + "OBSOLETE_LOCAL_SSD": { + "deprecated": true + } + }, + "values": { + "SQL_DATA_DISK_TYPE_UNSPECIFIED": 0, + "PD_SSD": 1, + "PD_HDD": 2, + "OBSOLETE_LOCAL_SSD": 3, + "HYPERDISK_BALANCED": 4 + } + }, + "SqlAvailabilityType": { + "values": { + "SQL_AVAILABILITY_TYPE_UNSPECIFIED": 0, + "ZONAL": 1, + "REGIONAL": 2 + } + }, + "SqlUpdateTrack": { + "values": { + "SQL_UPDATE_TRACK_UNSPECIFIED": 0, + "canary": 1, + "stable": 2, + "week5": 3 + } + }, + "AcquireSsrsLeaseContext": { + "oneofs": { + "_setupLogin": { + "oneof": [ + "setupLogin" + ] + }, + "_serviceLogin": { + "oneof": [ + "serviceLogin" + ] + }, + "_reportDatabase": { + "oneof": [ + "reportDatabase" + ] + }, + "_duration": { + "oneof": [ + "duration" + ] + } + }, + "fields": { + "setupLogin": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "serviceLogin": { + "type": "string", + "id": 2, + "options": { + "proto3_optional": true + } + }, + "reportDatabase": { + "type": "string", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "duration": { + "type": "google.protobuf.Duration", + "id": 4, + "options": { + "proto3_optional": true + } + } + } + }, + "DnsNameMapping": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "connectionType": { + "type": "ConnectionType", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dnsScope": { + "type": "DnsScope", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "recordManager": { + "type": "RecordManager", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "ConnectionType": { + "values": { + "CONNECTION_TYPE_UNSPECIFIED": 0, + "PUBLIC": 1, + "PRIVATE_SERVICES_ACCESS": 2, + "PRIVATE_SERVICE_CONNECT": 3 + } + }, + "DnsScope": { + "values": { + "DNS_SCOPE_UNSPECIFIED": 0, + "INSTANCE": 1, + "CLUSTER": 2 + } + }, + "RecordManager": { + "values": { + "RECORD_MANAGER_UNSPECIFIED": 0, + "CUSTOMER": 1, + "CLOUD_SQL_AUTOMATION": 2 + } + } + } + }, + "SqlBackupsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "CreateBackup": { + "requestType": "CreateBackupRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*}/backups", + "(google.api.http).body": "backup", + "(google.api.method_signature)": "parent, backup" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}/backups", + "body": "backup" + } + }, + { + "(google.api.method_signature)": "parent, backup" + } + ] + }, + "GetBackup": { + "requestType": "GetBackupRequest", + "responseType": "Backup", + "options": { + "(google.api.http).get": "/v1/{name=projects/*/backups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{name=projects/*/backups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListBackups": { + "requestType": "ListBackupsRequest", + "responseType": "ListBackupsResponse", + "options": { + "(google.api.http).get": "/v1/{parent=projects/*}/backups", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/{parent=projects/*}/backups" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateBackup": { + "requestType": "UpdateBackupRequest", + "responseType": "Operation", + "options": { + "(google.api.http).patch": "/v1/{backup.name=projects/*/backups/*}", + "(google.api.http).body": "backup", + "(google.api.method_signature)": "backup, update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/{backup.name=projects/*/backups/*}", + "body": "backup" + } + }, + { + "(google.api.method_signature)": "backup, update_mask" + } + ] + }, + "DeleteBackup": { + "requestType": "DeleteBackupRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/v1/{name=projects/*/backups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/{name=projects/*/backups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "CreateBackupRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "sqladmin.googleapis.com/Backup" + } + }, + "backup": { + "type": "Backup", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetBackupRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" + } + } + } + }, + "ListBackupsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "sqladmin.googleapis.com/Backup" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + } + } + }, + "ListBackupsResponse": { + "fields": { + "backups": { + "rule": "repeated", + "type": "Backup", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "warnings": { + "rule": "repeated", + "type": "ApiWarning", + "id": 3 + } + } + }, + "UpdateBackupRequest": { + "fields": { + "backup": { + "type": "Backup", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteBackupRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" + } + } + } + }, + "Backup": { + "options": { + "(google.api.resource).type": "sqladmin.googleapis.com/Backup", + "(google.api.resource).pattern": "projects/{project}/backups/{backup}" + }, + "oneofs": { + "expiration": { + "oneof": [ + "ttlDays", + "expiryTime" + ] + }, + "_maxChargeableBytes": { + "oneof": [ + "maxChargeableBytes" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "kind": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "selfLink": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "type": { + "type": "SqlBackupType", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "description": { + "type": "string", + "id": 5 + }, + "instance": { + "type": "string", + "id": 6 + }, + "location": { + "type": "string", + "id": 7 + }, + "backupInterval": { + "type": "google.type.Interval", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "SqlBackupState", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "error": { + "type": "OperationError", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "kmsKey": { + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "kmsKeyVersion": { + "type": "string", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "backupKind": { + "type": "SqlBackupKind", + "id": 13, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "timeZone": { + "type": "string", + "id": 15, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "ttlDays": { + "type": "int64", + "id": 16, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } + }, + "expiryTime": { + "type": "google.protobuf.Timestamp", + "id": 17 + }, + "databaseVersion": { + "type": "SqlDatabaseVersion", + "id": 20, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "maxChargeableBytes": { + "type": "int64", + "id": 23, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "instanceDeletionTime": { + "type": "google.protobuf.Timestamp", + "id": 24, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "instanceSettings": { + "type": "DatabaseInstance", + "id": 25, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "backupRun": { + "type": "string", + "id": 26, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "satisfiesPzs": { + "type": "google.protobuf.BoolValue", + "id": 27, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "satisfiesPzi": { + "type": "google.protobuf.BoolValue", + "id": 28, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "SqlBackupType": { + "values": { + "SQL_BACKUP_TYPE_UNSPECIFIED": 0, + "AUTOMATED": 1, + "ON_DEMAND": 2, + "FINAL": 3 + } + }, + "SqlBackupState": { + "values": { + "SQL_BACKUP_STATE_UNSPECIFIED": 0, + "ENQUEUED": 1, + "RUNNING": 2, + "FAILED": 3, + "SUCCESSFUL": 4, + "DELETING": 5, + "DELETION_FAILED": 6 + } + } + } + }, + "SqlInstancesService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "AddServerCa": { + "requestType": "SqlInstancesAddServerCaRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/addServerCa" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/addServerCa" + } + } + ] + }, + "AddServerCertificate": { + "requestType": "SqlInstancesAddServerCertificateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/addServerCertificate" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/addServerCertificate" + } + } + ] + }, + "AddEntraIdCertificate": { + "requestType": "SqlInstancesAddEntraIdCertificateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/addEntraIdCertificate" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/addEntraIdCertificate" + } + } + ] + }, + "Clone": { + "requestType": "SqlInstancesCloneRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/clone", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/clone", + "body": "body" + } + } + ] + }, + "Delete": { + "requestType": "SqlInstancesDeleteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/v1/projects/{project}/instances/{instance}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/projects/{project}/instances/{instance}" + } + } + ] + }, + "DemoteMaster": { + "requestType": "SqlInstancesDemoteMasterRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/demoteMaster", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/demoteMaster", + "body": "body" + } + } + ] + }, + "Demote": { + "requestType": "SqlInstancesDemoteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/demote", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/demote", + "body": "body" + } + } + ] + }, + "Export": { + "requestType": "SqlInstancesExportRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/export", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/export", + "body": "body" + } + } + ] + }, + "Failover": { + "requestType": "SqlInstancesFailoverRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/failover", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/failover", + "body": "body" + } + } + ] + }, + "Reencrypt": { + "requestType": "SqlInstancesReencryptRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/reencrypt", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/reencrypt", + "body": "body" + } + } + ] + }, + "Get": { + "requestType": "SqlInstancesGetRequest", + "responseType": "DatabaseInstance", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}" + } + } + ] + }, + "Import": { + "requestType": "SqlInstancesImportRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/import", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/import", + "body": "body" + } + } + ] + }, + "Insert": { + "requestType": "SqlInstancesInsertRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances", + "body": "body" + } + } + ] + }, + "List": { + "requestType": "SqlInstancesListRequest", + "responseType": "InstancesListResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances" + } + } + ] + }, + "ListServerCas": { + "requestType": "SqlInstancesListServerCasRequest", + "responseType": "InstancesListServerCasResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/listServerCas" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/listServerCas" + } + } + ] + }, + "ListServerCertificates": { + "requestType": "SqlInstancesListServerCertificatesRequest", + "responseType": "InstancesListServerCertificatesResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/listServerCertificates" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/listServerCertificates" + } + } + ] + }, + "ListEntraIdCertificates": { + "requestType": "SqlInstancesListEntraIdCertificatesRequest", + "responseType": "InstancesListEntraIdCertificatesResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/listEntraIdCertificates" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/listEntraIdCertificates" + } + } + ] + }, + "Patch": { + "requestType": "SqlInstancesPatchRequest", + "responseType": "Operation", + "options": { + "(google.api.http).patch": "/v1/projects/{project}/instances/{instance}", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/projects/{project}/instances/{instance}", + "body": "body" + } + } + ] + }, + "PromoteReplica": { + "requestType": "SqlInstancesPromoteReplicaRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/promoteReplica" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/promoteReplica" + } + } + ] + }, + "Switchover": { + "requestType": "SqlInstancesSwitchoverRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/switchover" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/switchover" + } + } + ] + }, + "ResetSslConfig": { + "requestType": "SqlInstancesResetSslConfigRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/resetSslConfig" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/resetSslConfig" + } + } + ] + }, + "Restart": { + "requestType": "SqlInstancesRestartRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/restart" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/restart" + } + } + ] + }, + "RestoreBackup": { + "requestType": "SqlInstancesRestoreBackupRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/restoreBackup", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/restoreBackup", + "body": "body" + } + } + ] + }, + "RotateServerCa": { + "requestType": "SqlInstancesRotateServerCaRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/rotateServerCa", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/rotateServerCa", + "body": "body" + } + } + ] + }, + "RotateServerCertificate": { + "requestType": "SqlInstancesRotateServerCertificateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/rotateServerCertificate", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/rotateServerCertificate", + "body": "body" + } + } + ] + }, + "RotateEntraIdCertificate": { + "requestType": "SqlInstancesRotateEntraIdCertificateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/rotateEntraIdCertificate", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/rotateEntraIdCertificate", + "body": "body" + } + } + ] + }, + "StartReplica": { + "requestType": "SqlInstancesStartReplicaRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/startReplica" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/startReplica" + } + } + ] + }, + "StopReplica": { + "requestType": "SqlInstancesStopReplicaRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/stopReplica" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/stopReplica" + } + } + ] + }, + "TruncateLog": { + "requestType": "SqlInstancesTruncateLogRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/truncateLog", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/truncateLog", + "body": "body" + } + } + ] + }, + "Update": { + "requestType": "SqlInstancesUpdateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).put": "/v1/projects/{project}/instances/{instance}", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "put": "/v1/projects/{project}/instances/{instance}", + "body": "body" + } + } + ] + }, + "CreateEphemeral": { + "requestType": "SqlInstancesCreateEphemeralCertRequest", + "responseType": "SslCert", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/createEphemeral", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/createEphemeral", + "body": "body" + } + } + ] + }, + "RescheduleMaintenance": { + "requestType": "SqlInstancesRescheduleMaintenanceRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/rescheduleMaintenance", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/rescheduleMaintenance", + "body": "body" + } + } + ] + }, + "VerifyExternalSyncSettings": { + "requestType": "SqlInstancesVerifyExternalSyncSettingsRequest", + "responseType": "SqlInstancesVerifyExternalSyncSettingsResponse", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/verifyExternalSyncSettings", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/verifyExternalSyncSettings", + "body": "*" + } + } + ] + }, + "StartExternalSync": { + "requestType": "SqlInstancesStartExternalSyncRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/startExternalSync", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/startExternalSync", + "body": "*" + } + } + ] + }, + "PerformDiskShrink": { + "requestType": "SqlInstancesPerformDiskShrinkRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/performDiskShrink", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/performDiskShrink", + "body": "body" + } + } + ] + }, + "GetDiskShrinkConfig": { + "requestType": "SqlInstancesGetDiskShrinkConfigRequest", + "responseType": "SqlInstancesGetDiskShrinkConfigResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/getDiskShrinkConfig" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/getDiskShrinkConfig" + } + } + ] + }, + "ResetReplicaSize": { + "requestType": "SqlInstancesResetReplicaSizeRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/resetReplicaSize", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/resetReplicaSize", + "body": "*" + } + } + ] + }, + "GetLatestRecoveryTime": { + "requestType": "SqlInstancesGetLatestRecoveryTimeRequest", + "responseType": "SqlInstancesGetLatestRecoveryTimeResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/getLatestRecoveryTime" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/getLatestRecoveryTime" + } + } + ] + }, + "ExecuteSql": { + "requestType": "SqlInstancesExecuteSqlRequest", + "responseType": "SqlInstancesExecuteSqlResponse", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/executeSql", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/executeSql", + "body": "body" + } + } + ] + }, + "AcquireSsrsLease": { + "requestType": "SqlInstancesAcquireSsrsLeaseRequest", + "responseType": "SqlInstancesAcquireSsrsLeaseResponse", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/acquireSsrsLease", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/acquireSsrsLease", + "body": "body" + } + } + ] + }, + "ReleaseSsrsLease": { + "requestType": "SqlInstancesReleaseSsrsLeaseRequest", + "responseType": "SqlInstancesReleaseSsrsLeaseResponse", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/releaseSsrsLease" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/releaseSsrsLease" + } + } + ] + }, + "PreCheckMajorVersionUpgrade": { + "requestType": "SqlInstancesPreCheckMajorVersionUpgradeRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade", + "body": "body" + } + } + ] + }, + "PointInTimeRestore": { + "requestType": "SqlInstancesPointInTimeRestoreRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/{parent=projects/*}:pointInTimeRestore", + "(google.api.http).body": "context" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/{parent=projects/*}:pointInTimeRestore", + "body": "context" + } + } + ] + } + } + }, + "SqlInstancesAddServerCaRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesAddServerCertificateRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesAddEntraIdCertificateRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesCloneRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesCloneRequest", + "id": 100, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesDeleteRequest": { + "oneofs": { + "_enableFinalBackup": { + "oneof": [ + "enableFinalBackup" + ] + }, + "expiration": { + "oneof": [ + "finalBackupTtlDays", + "finalBackupExpiryTime" + ] + } + }, + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "enableFinalBackup": { + "type": "bool", + "id": 7, + "options": { + "proto3_optional": true + } + }, + "finalBackupTtlDays": { + "type": "int64", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "finalBackupExpiryTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "finalBackupDescription": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlInstancesDemoteMasterRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesDemoteMasterRequest", + "id": 100 + } + } + }, + "SqlInstancesDemoteRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesDemoteRequest", + "id": 100, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesExportRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesExportRequest", + "id": 100 + } + } + }, + "SqlInstancesFailoverRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesFailoverRequest", + "id": 100 + } + } + }, + "SqlInstancesGetRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesImportRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesImportRequest", + "id": 100 + } + } + }, + "SqlInstancesInsertRequest": { + "fields": { + "project": { + "type": "string", + "id": 1 + }, + "body": { + "type": "DatabaseInstance", + "id": 100 + } + } + }, + "SqlInstancesListRequest": { + "fields": { + "filter": { + "type": "string", + "id": 1 + }, + "maxResults": { + "type": "uint32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + } + } + }, + "SqlInstancesListServerCasRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesListServerCertificatesRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesListEntraIdCertificatesRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesPatchRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "DatabaseInstance", + "id": 100 + } + } + }, + "SqlInstancesPromoteReplicaRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "failover": { + "type": "bool", + "id": 3 + } + } + }, + "SqlInstancesSwitchoverRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "dbTimeout": { + "type": "google.protobuf.Duration", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlInstancesResetSslConfigRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "mode": { + "type": "ResetSslMode", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "ResetSslMode": { + "values": { + "RESET_SSL_MODE_UNSPECIFIED": 0, + "ALL": 1, + "SYNC_FROM_PRIMARY": 2 + } + } + } + }, + "SqlInstancesRestartRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesRestoreBackupRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesRestoreBackupRequest", + "id": 100 + } + } + }, + "SqlInstancesRotateServerCaRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesRotateServerCaRequest", + "id": 100 + } + } + }, + "SqlInstancesRotateServerCertificateRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesRotateServerCertificateRequest", + "id": 100, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlInstancesRotateEntraIdCertificateRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesRotateEntraIdCertificateRequest", + "id": 100, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlInstancesStartReplicaRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesStopReplicaRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesTruncateLogRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesTruncateLogRequest", + "id": 100 + } + } + }, + "SqlInstancesPerformDiskShrinkRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "PerformDiskShrinkContext", + "id": 100 + } + } + }, + "SqlInstancesUpdateRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "DatabaseInstance", + "id": 100 + } + } + }, + "SqlInstancesRescheduleMaintenanceRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "SqlInstancesRescheduleMaintenanceRequestBody", + "id": 100 + } + } + }, + "SqlInstancesReencryptRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesReencryptRequest", + "id": 3 + } + } + }, + "InstancesReencryptRequest": { + "oneofs": { + "_backupReencryptionConfig": { + "oneof": [ + "backupReencryptionConfig" + ] + } + }, + "fields": { + "backupReencryptionConfig": { + "type": "BackupReencryptionConfig", + "id": 1, + "options": { + "proto3_optional": true + } + } + } + }, + "BackupReencryptionConfig": { + "oneofs": { + "_backupLimit": { + "oneof": [ + "backupLimit" + ] + }, + "_backupType": { + "oneof": [ + "backupType" + ] + } + }, + "fields": { + "backupLimit": { + "type": "int32", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "backupType": { + "type": "BackupType", + "id": 2, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "BackupType": { + "values": { + "BACKUP_TYPE_UNSPECIFIED": 0, + "AUTOMATED": 1, + "ON_DEMAND": 2 + } + } + } + }, + "ExternalSyncParallelLevel": { + "values": { + "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": 0, + "MIN": 1, + "OPTIMAL": 2, + "MAX": 3 + } + }, + "ExternalSyncSelectedObject": { + "fields": { + "database": { + "type": "string", + "id": 1 + } + } + }, + "SqlInstancesGetDiskShrinkConfigRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesVerifyExternalSyncSettingsRequest": { + "oneofs": { + "syncConfig": { + "oneof": [ + "mysqlSyncConfig" + ] + } + }, + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "verifyConnectionOnly": { + "type": "bool", + "id": 3 + }, + "syncMode": { + "type": "ExternalSyncMode", + "id": 4 + }, + "verifyReplicationOnly": { + "type": "bool", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mysqlSyncConfig": { + "type": "MySqlSyncConfig", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "migrationType": { + "type": "MigrationType", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "syncParallelLevel": { + "type": "ExternalSyncParallelLevel", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "selectedObjects": { + "rule": "repeated", + "type": "ExternalSyncSelectedObject", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "ExternalSyncMode": { + "values": { + "EXTERNAL_SYNC_MODE_UNSPECIFIED": 0, + "ONLINE": 1, + "OFFLINE": 2 + } + }, + "MigrationType": { + "values": { + "MIGRATION_TYPE_UNSPECIFIED": 0, + "LOGICAL": 1, + "PHYSICAL": 2 + } + } + } + }, + "SqlInstancesStartExternalSyncRequest": { + "oneofs": { + "syncConfig": { + "oneof": [ + "mysqlSyncConfig" + ] + } + }, + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "syncMode": { + "type": "SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode", + "id": 3 + }, + "skipVerification": { + "type": "bool", + "id": 4 + }, + "mysqlSyncConfig": { + "type": "MySqlSyncConfig", + "id": 6 + }, + "syncParallelLevel": { + "type": "ExternalSyncParallelLevel", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "migrationType": { + "type": "SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "replicaOverwriteEnabled": { + "type": "bool", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlInstancesResetReplicaSizeRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesCreateEphemeralCertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "SslCertsCreateEphemeralRequest", + "id": 100 + } + } + }, + "InstancesCloneRequest": { + "fields": { + "cloneContext": { + "type": "CloneContext", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "InstancesDemoteMasterRequest": { + "fields": { + "demoteMasterContext": { + "type": "DemoteMasterContext", + "id": 1 + } + } + }, + "InstancesDemoteRequest": { + "fields": { + "demoteContext": { + "type": "DemoteContext", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "InstancesExportRequest": { + "fields": { + "exportContext": { + "type": "ExportContext", + "id": 1 + } + } + }, + "InstancesFailoverRequest": { + "fields": { + "failoverContext": { + "type": "FailoverContext", + "id": 1 + } + } + }, + "SslCertsCreateEphemeralRequest": { + "fields": { + "publicKey": { + "type": "string", + "id": 1, + "options": { + "json_name": "public_key" + } + }, + "accessToken": { + "type": "string", + "id": 2, + "options": { + "json_name": "access_token" + } + } + } + }, + "InstancesImportRequest": { + "fields": { + "importContext": { + "type": "ImportContext", + "id": 1 + } + } + }, + "InstancesPreCheckMajorVersionUpgradeRequest": { + "fields": { + "preCheckMajorVersionUpgradeContext": { + "type": "PreCheckMajorVersionUpgradeContext", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "InstancesListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "warnings": { + "rule": "repeated", + "type": "ApiWarning", + "id": 2 + }, + "items": { + "rule": "repeated", + "type": "DatabaseInstance", + "id": 3 + }, + "nextPageToken": { + "type": "string", + "id": 4 + } + } + }, + "InstancesListServerCasResponse": { + "fields": { + "certs": { + "rule": "repeated", + "type": "SslCert", + "id": 1 + }, + "activeVersion": { + "type": "string", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + } + } + }, + "InstancesListServerCertificatesResponse": { + "fields": { + "caCerts": { + "rule": "repeated", + "type": "SslCert", + "id": 1 + }, + "serverCerts": { + "rule": "repeated", + "type": "SslCert", + "id": 2 + }, + "activeVersion": { + "type": "string", + "id": 3 + }, + "kind": { + "type": "string", + "id": 4 + } + } + }, + "InstancesListEntraIdCertificatesResponse": { + "fields": { + "certs": { + "rule": "repeated", + "type": "SslCert", + "id": 1 + }, + "activeVersion": { + "type": "string", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + } + } + }, + "InstancesRestoreBackupRequest": { + "fields": { + "restoreBackupContext": { + "type": "RestoreBackupContext", + "id": 1 + }, + "backup": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" + } + }, + "backupdrBackup": { + "type": "string", + "id": 4, + "options": { + "(google.api.resource_reference).type": "backupdr.googleapis.com/Backup" + } + }, + "restoreInstanceSettings": { + "type": "DatabaseInstance", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "restoreInstanceClearOverridesFieldNames": { + "rule": "repeated", + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "InstancesRotateServerCaRequest": { + "fields": { + "rotateServerCaContext": { + "type": "RotateServerCaContext", + "id": 1 + } + } + }, + "InstancesRotateServerCertificateRequest": { + "fields": { + "rotateServerCertificateContext": { + "type": "RotateServerCertificateContext", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "InstancesRotateEntraIdCertificateRequest": { + "fields": { + "rotateEntraIdCertificateContext": { + "type": "RotateEntraIdCertificateContext", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "InstancesTruncateLogRequest": { + "fields": { + "truncateLogContext": { + "type": "TruncateLogContext", + "id": 1 + } + } + }, + "InstancesAcquireSsrsLeaseRequest": { + "fields": { + "acquireSsrsLeaseContext": { + "type": "AcquireSsrsLeaseContext", + "id": 1 + } + } + }, + "SqlInstancesPreCheckMajorVersionUpgradeRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesPreCheckMajorVersionUpgradeRequest", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesVerifyExternalSyncSettingsResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "errors": { + "rule": "repeated", + "type": "SqlExternalSyncSettingError", + "id": 2 + }, + "warnings": { + "rule": "repeated", + "type": "SqlExternalSyncSettingError", + "id": 3 + } + } + }, + "SqlInstancesGetDiskShrinkConfigResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "minimalTargetSizeGb": { + "type": "int64", + "id": 2 + }, + "message": { + "type": "string", + "id": 3 + } + } + }, + "SqlInstancesGetLatestRecoveryTimeRequest": { + "oneofs": { + "_sourceInstanceDeletionTime": { + "oneof": [ + "sourceInstanceDeletionTime" + ] + } + }, + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "sourceInstanceDeletionTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "proto3_optional": true + } + } + } + }, + "SqlInstancesGetLatestRecoveryTimeResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "latestRecoveryTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "earliestRecoveryTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "CloneContext": { + "oneofs": { + "_preferredZone": { + "oneof": [ + "preferredZone" + ] + }, + "_preferredSecondaryZone": { + "oneof": [ + "preferredSecondaryZone" + ] + }, + "_sourceInstanceDeletionTime": { + "oneof": [ + "sourceInstanceDeletionTime" + ] + }, + "_destinationProject": { + "oneof": [ + "destinationProject" + ] + }, + "_destinationNetwork": { + "oneof": [ + "destinationNetwork" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "pitrTimestampMs": { + "type": "int64", + "id": 2 + }, + "destinationInstanceName": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "binLogCoordinates": { + "type": "BinLogCoordinates", + "id": 4 + }, + "pointInTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allocatedIpRange": { + "type": "string", + "id": 6 + }, + "databaseNames": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "preferredZone": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "preferredSecondaryZone": { + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "sourceInstanceDeletionTime": { + "type": "google.protobuf.Timestamp", + "id": 12, + "options": { + "proto3_optional": true + } + }, + "destinationProject": { + "type": "string", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "destinationNetwork": { + "type": "string", + "id": 14, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "compute.googleapis.com/Network", + "proto3_optional": true + } + } + } + }, + "PointInTimeRestoreContext": { + "oneofs": { + "_datasource": { + "oneof": [ + "datasource" + ] + }, + "_targetInstance": { + "oneof": [ + "targetInstance" + ] + }, + "_privateNetwork": { + "oneof": [ + "privateNetwork" + ] + }, + "_allocatedIpRange": { + "oneof": [ + "allocatedIpRange" + ] + }, + "_preferredZone": { + "oneof": [ + "preferredZone" + ] + }, + "_preferredSecondaryZone": { + "oneof": [ + "preferredSecondaryZone" + ] + }, + "_region": { + "oneof": [ + "region" + ] + } + }, + "fields": { + "datasource": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "pointInTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "targetInstance": { + "type": "string", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "privateNetwork": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "allocatedIpRange": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "preferredZone": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "preferredSecondaryZone": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "targetInstanceSettings": { + "type": "DatabaseInstance", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "targetInstanceClearSettingsFieldNames": { + "rule": "repeated", + "type": "string", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "region": { + "type": "string", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + } + }, + "BinLogCoordinates": { + "fields": { + "binLogFileName": { + "type": "string", + "id": 1 + }, + "binLogPosition": { + "type": "int64", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + } + } + }, + "DatabaseInstance": { + "oneofs": { + "_outOfDiskReport": { + "oneof": [ + "outOfDiskReport" + ] + }, + "_sqlNetworkArchitecture": { + "oneof": [ + "sqlNetworkArchitecture" + ] + }, + "_pscServiceAttachmentLink": { + "oneof": [ + "pscServiceAttachmentLink" + ] + }, + "_dnsName": { + "oneof": [ + "dnsName" + ] + }, + "_primaryDnsName": { + "oneof": [ + "primaryDnsName" + ] + }, + "_writeEndpoint": { + "oneof": [ + "writeEndpoint" + ] + }, + "_geminiConfig": { + "oneof": [ + "geminiConfig" + ] + }, + "_switchTransactionLogsToCloudStorageEnabled": { + "oneof": [ + "switchTransactionLogsToCloudStorageEnabled" + ] + }, + "_includeReplicasForMajorVersionUpgrade": { + "oneof": [ + "includeReplicasForMajorVersionUpgrade" + ] + }, + "_nodeCount": { + "oneof": [ + "nodeCount" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "state": { + "type": "SqlInstanceState", + "id": 2 + }, + "databaseVersion": { + "type": "SqlDatabaseVersion", + "id": 3 + }, + "settings": { + "type": "Settings", + "id": 4 + }, + "etag": { + "type": "string", + "id": 5 + }, + "failoverReplica": { + "type": "SqlFailoverReplica", + "id": 6 + }, + "masterInstanceName": { + "type": "string", + "id": 7 + }, + "replicaNames": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "maxDiskSize": { + "type": "google.protobuf.Int64Value", + "id": 9, + "options": { + "deprecated": true + } + }, + "currentDiskSize": { + "type": "google.protobuf.Int64Value", + "id": 10, + "options": { + "deprecated": true + } + }, + "ipAddresses": { + "rule": "repeated", + "type": "IpMapping", + "id": 11 + }, + "serverCaCert": { + "type": "SslCert", + "id": 12 + }, + "instanceType": { + "type": "SqlInstanceType", + "id": 13 + }, + "project": { + "type": "string", + "id": 14 + }, + "ipv6Address": { + "type": "string", + "id": 15, + "options": { + "deprecated": true + } + }, + "serviceAccountEmailAddress": { + "type": "string", + "id": 16 + }, + "onPremisesConfiguration": { + "type": "OnPremisesConfiguration", + "id": 17 + }, + "replicaConfiguration": { + "type": "ReplicaConfiguration", + "id": 18 + }, + "backendType": { + "type": "SqlBackendType", + "id": 19 + }, + "selfLink": { + "type": "string", + "id": 20 + }, + "suspensionReason": { + "rule": "repeated", + "type": "SqlSuspensionReason", + "id": 21 + }, + "connectionName": { + "type": "string", + "id": 22 + }, + "name": { + "type": "string", + "id": 23 + }, + "region": { + "type": "string", + "id": 24 + }, + "gceZone": { + "type": "string", + "id": 25 + }, + "secondaryGceZone": { + "type": "string", + "id": 34 + }, + "diskEncryptionConfiguration": { + "type": "DiskEncryptionConfiguration", + "id": 26 + }, + "diskEncryptionStatus": { + "type": "DiskEncryptionStatus", + "id": 27 + }, + "rootPassword": { + "type": "string", + "id": 29 + }, + "scheduledMaintenance": { + "type": "SqlScheduledMaintenance", + "id": 30 + }, + "satisfiesPzs": { + "type": "google.protobuf.BoolValue", + "id": 35 + }, + "databaseInstalledVersion": { + "type": "string", + "id": 40, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "outOfDiskReport": { + "type": "SqlOutOfDiskReport", + "id": 38, + "options": { + "proto3_optional": true + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 39, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "availableMaintenanceVersions": { + "rule": "repeated", + "type": "string", + "id": 41, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "maintenanceVersion": { + "type": "string", + "id": 42 + }, + "upgradableDatabaseVersions": { + "rule": "repeated", + "type": "AvailableDatabaseVersion", + "id": 45, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "sqlNetworkArchitecture": { + "type": "SqlNetworkArchitecture", + "id": 47, + "options": { + "proto3_optional": true + } + }, + "pscServiceAttachmentLink": { + "type": "string", + "id": 48, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "dnsName": { + "type": "string", + "id": 49, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "primaryDnsName": { + "type": "string", + "id": 51, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "writeEndpoint": { + "type": "string", + "id": 52, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "replicationCluster": { + "type": "ReplicationCluster", + "id": 54, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "geminiConfig": { + "type": "GeminiInstanceConfig", + "id": 55, + "options": { + "proto3_optional": true + } + }, + "satisfiesPzi": { + "type": "google.protobuf.BoolValue", + "id": 56, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "switchTransactionLogsToCloudStorageEnabled": { + "type": "google.protobuf.BoolValue", + "id": 57, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY", + "proto3_optional": true + } + }, + "includeReplicasForMajorVersionUpgrade": { + "type": "google.protobuf.BoolValue", + "id": 59, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY", + "proto3_optional": true + } + }, + "tags": { + "keyType": "string", + "type": "string", + "id": 60, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "nodeCount": { + "type": "int32", + "id": 63, + "options": { + "proto3_optional": true + } + }, + "nodes": { + "rule": "repeated", + "type": "PoolNodeConfig", + "id": 64, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dnsNames": { + "rule": "repeated", + "type": "DnsNameMapping", + "id": 67, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "SqlInstanceState": { + "valuesOptions": { + "ONLINE_MAINTENANCE": { + "deprecated": true + } + }, + "values": { + "SQL_INSTANCE_STATE_UNSPECIFIED": 0, + "RUNNABLE": 1, + "SUSPENDED": 2, + "PENDING_DELETE": 3, + "PENDING_CREATE": 4, + "MAINTENANCE": 5, + "FAILED": 6, + "ONLINE_MAINTENANCE": 7, + "REPAIRING": 8 + } + }, + "SqlFailoverReplica": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "available": { + "type": "google.protobuf.BoolValue", + "id": 2 + } + } + }, + "SqlScheduledMaintenance": { + "oneofs": { + "_scheduleDeadlineTime": { + "oneof": [ + "scheduleDeadlineTime" + ] + } + }, + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "canDefer": { + "type": "bool", + "id": 2, + "options": { + "deprecated": true + } + }, + "canReschedule": { + "type": "bool", + "id": 3 + }, + "scheduleDeadlineTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "proto3_optional": true + } + } + } + }, + "SqlOutOfDiskReport": { + "oneofs": { + "_sqlOutOfDiskState": { + "oneof": [ + "sqlOutOfDiskState" + ] + }, + "_sqlMinRecommendedIncreaseSizeGb": { + "oneof": [ + "sqlMinRecommendedIncreaseSizeGb" + ] + } + }, + "fields": { + "sqlOutOfDiskState": { + "type": "SqlOutOfDiskState", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "sqlMinRecommendedIncreaseSizeGb": { + "type": "int32", + "id": 2, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "SqlOutOfDiskState": { + "values": { + "SQL_OUT_OF_DISK_STATE_UNSPECIFIED": 0, + "NORMAL": 1, + "SOFT_SHUTDOWN": 2 + } + } + } + }, + "SqlNetworkArchitecture": { + "values": { + "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED": 0, + "NEW_NETWORK_ARCHITECTURE": 1, + "OLD_NETWORK_ARCHITECTURE": 2 + } + }, + "PoolNodeConfig": { + "oneofs": { + "_name": { + "oneof": [ + "name" + ] + }, + "_gceZone": { + "oneof": [ + "gceZone" + ] + }, + "_dnsName": { + "oneof": [ + "dnsName" + ] + }, + "_state": { + "oneof": [ + "state" + ] + }, + "_pscServiceAttachmentLink": { + "oneof": [ + "pscServiceAttachmentLink" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "gceZone": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "ipAddresses": { + "rule": "repeated", + "type": "IpMapping", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dnsName": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "state": { + "type": "SqlInstanceState", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "dnsNames": { + "rule": "repeated", + "type": "DnsNameMapping", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "pscServiceAttachmentLink": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "pscAutoConnections": { + "rule": "repeated", + "type": "PscAutoConnectionConfig", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + } + } + }, + "GeminiInstanceConfig": { + "oneofs": { + "_entitled": { + "oneof": [ + "entitled" + ] + }, + "_googleVacuumMgmtEnabled": { + "oneof": [ + "googleVacuumMgmtEnabled" + ] + }, + "_oomSessionCancelEnabled": { + "oneof": [ + "oomSessionCancelEnabled" + ] + }, + "_activeQueryEnabled": { + "oneof": [ + "activeQueryEnabled" + ] + }, + "_indexAdvisorEnabled": { + "oneof": [ + "indexAdvisorEnabled" + ] + }, + "_flagRecommenderEnabled": { + "oneof": [ + "flagRecommenderEnabled" + ] + } + }, + "fields": { + "entitled": { + "type": "bool", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "googleVacuumMgmtEnabled": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "oomSessionCancelEnabled": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "activeQueryEnabled": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "indexAdvisorEnabled": { + "type": "bool", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "flagRecommenderEnabled": { + "type": "bool", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + } + } + }, + "ReplicationCluster": { + "fields": { + "psaWriteEndpoint": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "failoverDrReplicaName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "drReplica": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "AvailableDatabaseVersion": { + "oneofs": { + "_majorVersion": { + "oneof": [ + "majorVersion" + ] + }, + "_name": { + "oneof": [ + "name" + ] + }, + "_displayName": { + "oneof": [ + "displayName" + ] + } + }, + "fields": { + "majorVersion": { + "type": "string", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "name": { + "type": "string", + "id": 8, + "options": { + "proto3_optional": true + } + }, + "displayName": { + "type": "string", + "id": 9, + "options": { + "proto3_optional": true + } + } + } + }, + "SqlInstancesRescheduleMaintenanceRequestBody": { + "fields": { + "reschedule": { + "type": "Reschedule", + "id": 3 + } + }, + "nested": { + "RescheduleType": { + "values": { + "RESCHEDULE_TYPE_UNSPECIFIED": 0, + "IMMEDIATE": 1, + "NEXT_AVAILABLE_WINDOW": 2, + "SPECIFIC_TIME": 3 + } + }, + "Reschedule": { + "fields": { + "rescheduleType": { + "type": "RescheduleType", + "id": 1 + }, + "scheduleTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "DemoteMasterContext": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "verifyGtidConsistency": { + "type": "google.protobuf.BoolValue", + "id": 2 + }, + "masterInstanceName": { + "type": "string", + "id": 3 + }, + "replicaConfiguration": { + "type": "DemoteMasterConfiguration", + "id": 4 + }, + "skipReplicationSetup": { + "type": "bool", + "id": 5 + } + } + }, + "DemoteContext": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "sourceRepresentativeInstanceName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "FailoverContext": { + "fields": { + "settingsVersion": { + "type": "int64", + "id": 1 + }, + "kind": { + "type": "string", + "id": 2 + } + } + }, + "RestoreBackupContext": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "backupRunId": { + "type": "int64", + "id": 2 + }, + "instanceId": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + } + } + }, + "RotateServerCaContext": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "nextVersion": { + "type": "string", + "id": 2 + } + } + }, + "RotateServerCertificateContext": { + "fields": { + "kind": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "nextVersion": { + "type": "string", + "id": 2 + } + } + }, + "RotateEntraIdCertificateContext": { + "fields": { + "kind": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "nextVersion": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "TruncateLogContext": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "logType": { + "type": "string", + "id": 2 + } + } + }, + "SqlExternalSyncSettingError": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "type": { + "type": "SqlExternalSyncSettingErrorType", + "id": 2 + }, + "detail": { + "type": "string", + "id": 3 + } + }, + "nested": { + "SqlExternalSyncSettingErrorType": { + "values": { + "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED": 0, + "CONNECTION_FAILURE": 1, + "BINLOG_NOT_ENABLED": 2, + "INCOMPATIBLE_DATABASE_VERSION": 3, + "REPLICA_ALREADY_SETUP": 4, + "INSUFFICIENT_PRIVILEGE": 5, + "UNSUPPORTED_MIGRATION_TYPE": 6, + "NO_PGLOGICAL_INSTALLED": 7, + "PGLOGICAL_NODE_ALREADY_EXISTS": 8, + "INVALID_WAL_LEVEL": 9, + "INVALID_SHARED_PRELOAD_LIBRARY": 10, + "INSUFFICIENT_MAX_REPLICATION_SLOTS": 11, + "INSUFFICIENT_MAX_WAL_SENDERS": 12, + "INSUFFICIENT_MAX_WORKER_PROCESSES": 13, + "UNSUPPORTED_EXTENSIONS": 14, + "INVALID_RDS_LOGICAL_REPLICATION": 15, + "INVALID_LOGGING_SETUP": 16, + "INVALID_DB_PARAM": 17, + "UNSUPPORTED_GTID_MODE": 18, + "SQLSERVER_AGENT_NOT_RUNNING": 19, + "UNSUPPORTED_TABLE_DEFINITION": 20, + "UNSUPPORTED_DEFINER": 21, + "SQLSERVER_SERVERNAME_MISMATCH": 22, + "PRIMARY_ALREADY_SETUP": 23, + "UNSUPPORTED_BINLOG_FORMAT": 24, + "BINLOG_RETENTION_SETTING": 25, + "UNSUPPORTED_STORAGE_ENGINE": 26, + "LIMITED_SUPPORT_TABLES": 27, + "EXISTING_DATA_IN_REPLICA": 28, + "MISSING_OPTIONAL_PRIVILEGES": 29, + "RISKY_BACKUP_ADMIN_PRIVILEGE": 30, + "INSUFFICIENT_GCS_PERMISSIONS": 31, + "INVALID_FILE_INFO": 32, + "UNSUPPORTED_DATABASE_SETTINGS": 33, + "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE": 34, + "LOCAL_INFILE_OFF": 35, + "TURN_ON_PITR_AFTER_PROMOTE": 36, + "INCOMPATIBLE_DATABASE_MINOR_VERSION": 37, + "SOURCE_MAX_SUBSCRIPTIONS": 38, + "UNABLE_TO_VERIFY_DEFINERS": 39, + "SUBSCRIPTION_CALCULATION_STATUS": 40, + "PG_SUBSCRIPTION_COUNT": 41, + "PG_SYNC_PARALLEL_LEVEL": 42, + "INSUFFICIENT_DISK_SIZE": 43, + "INSUFFICIENT_MACHINE_TIER": 44, + "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED": 45, + "EXTENSIONS_NOT_MIGRATED": 46, + "PG_CRON_FLAG_ENABLED_IN_REPLICA": 47, + "EXTENSIONS_NOT_ENABLED_IN_REPLICA": 48, + "UNSUPPORTED_COLUMNS": 49, + "USERS_NOT_CREATED_IN_REPLICA": 50, + "UNSUPPORTED_SYSTEM_OBJECTS": 51, + "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY": 52, + "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE": 53, + "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI": 54, + "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS": 55, + "PROMPT_DELETE_EXISTING": 56, + "WILL_DELETE_EXISTING": 57, + "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE": 58 + } + } + } + }, + "SelectedObjects": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "OnPremisesConfiguration": { + "fields": { + "hostPort": { + "type": "string", + "id": 1 + }, + "kind": { + "type": "string", + "id": 2 + }, + "username": { + "type": "string", + "id": 3 + }, + "password": { + "type": "string", + "id": 4 + }, + "caCertificate": { + "type": "string", + "id": 5 + }, + "clientCertificate": { + "type": "string", + "id": 6 + }, + "clientKey": { + "type": "string", + "id": 7 + }, + "dumpFilePath": { + "type": "string", + "id": 8 + }, + "sourceInstance": { + "type": "InstanceReference", + "id": 15 + }, + "selectedObjects": { + "rule": "repeated", + "type": "SelectedObjects", + "id": 16, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "sslOption": { + "type": "SslOption", + "id": 18, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SslOption": { + "values": { + "SSL_OPTION_UNSPECIFIED": 0, + "DISABLE": 1, + "REQUIRE": 2, + "VERIFY_CA": 3 + } + } + } + }, + "ReplicaConfiguration": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "mysqlReplicaConfiguration": { + "type": "MySqlReplicaConfiguration", + "id": 2 + }, + "failoverTarget": { + "type": "google.protobuf.BoolValue", + "id": 3 + }, + "cascadableReplica": { + "type": "google.protobuf.BoolValue", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlInstancesExecuteSqlRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "ExecuteSqlPayload", + "id": 100 + } + } + }, + "ExecuteSqlPayload": { + "oneofs": { + "userPassword": { + "oneof": [ + "autoIamAuthn" + ] + } + }, + "fields": { + "user": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "sqlStatement": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "database": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "autoIamAuthn": { + "type": "bool", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "rowLimit": { + "type": "int64", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "partialResultMode": { + "type": "PartialResultMode", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "application": { + "type": "string", + "id": 16, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "PartialResultMode": { + "values": { + "PARTIAL_RESULT_MODE_UNSPECIFIED": 0, + "FAIL_PARTIAL_RESULT": 1, + "ALLOW_PARTIAL_RESULT": 2 + } + } + } + }, + "SqlInstancesExecuteSqlResponse": { + "fields": { + "messages": { + "rule": "repeated", + "type": "Message", + "id": 9 + }, + "metadata": { + "type": "Metadata", + "id": 6 + }, + "results": { + "rule": "repeated", + "type": "QueryResult", + "id": 7 + }, + "status": { + "type": "google.rpc.Status", + "id": 8 + } + }, + "nested": { + "Message": { + "oneofs": { + "_message": { + "oneof": [ + "message" + ] + }, + "_severity": { + "oneof": [ + "severity" + ] + } + }, + "fields": { + "message": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "severity": { + "type": "string", + "id": 2, + "options": { + "proto3_optional": true + } + } + } + } + } + }, + "QueryResult": { + "fields": { + "columns": { + "rule": "repeated", + "type": "Column", + "id": 1 + }, + "rows": { + "rule": "repeated", + "type": "Row", + "id": 2 + }, + "message": { + "type": "string", + "id": 3 + }, + "partialResult": { + "type": "bool", + "id": 4 + }, + "status": { + "type": "google.rpc.Status", + "id": 8 + } + } + }, + "Column": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + } + } + }, + "Row": { + "fields": { + "values": { + "rule": "repeated", + "type": "Value", + "id": 1 + } + } + }, + "Value": { + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "nullValue": { + "type": "bool", + "id": 2 + } + } + }, + "Metadata": { + "fields": { + "sqlStatementExecutionTime": { + "type": "google.protobuf.Duration", + "id": 1 + } + } + }, + "SqlInstancesAcquireSsrsLeaseRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesAcquireSsrsLeaseRequest", + "id": 100, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesAcquireSsrsLeaseResponse": { + "fields": { + "operationId": { + "type": "string", + "id": 1 + } + } + }, + "SqlInstancesReleaseSsrsLeaseRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesReleaseSsrsLeaseResponse": { + "fields": { + "operationId": { + "type": "string", + "id": 1 + } + } + }, + "SqlInstancesPointInTimeRestoreRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "context": { + "type": "PointInTimeRestoreContext", + "id": 100, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstanceType": { + "values": { + "SQL_INSTANCE_TYPE_UNSPECIFIED": 0, + "CLOUD_SQL_INSTANCE": 1, + "ON_PREMISES_INSTANCE": 2, + "READ_REPLICA_INSTANCE": 3, + "READ_POOL_INSTANCE": 5 + } + }, + "SqlSuspensionReason": { + "values": { + "SQL_SUSPENSION_REASON_UNSPECIFIED": 0, + "BILLING_ISSUE": 2, + "LEGAL_ISSUE": 3, + "OPERATIONAL_ISSUE": 4, + "KMS_KEY_ISSUE": 5, + "PROJECT_ABUSE": 8 + } + }, + "SqlConnectService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "GetConnectSettings": { + "requestType": "GetConnectSettingsRequest", + "responseType": "ConnectSettings", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/connectSettings" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/connectSettings" + } + } + ] + }, + "GenerateEphemeralCert": { + "requestType": "GenerateEphemeralCertRequest", + "responseType": "GenerateEphemeralCertResponse", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}:generateEphemeralCert", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}:generateEphemeralCert", + "body": "*" + } + } + ] + } + } + }, + "GetConnectSettingsRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ConnectSettings": { + "oneofs": { + "_nodeCount": { + "oneof": [ + "nodeCount" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "serverCaCert": { + "type": "SslCert", + "id": 2 + }, + "ipAddresses": { + "rule": "repeated", + "type": "IpMapping", + "id": 3 + }, + "region": { + "type": "string", + "id": 4 + }, + "databaseVersion": { + "type": "SqlDatabaseVersion", + "id": 31 + }, + "backendType": { + "type": "SqlBackendType", + "id": 32 + }, + "pscEnabled": { + "type": "bool", + "id": 33 + }, + "dnsName": { + "type": "string", + "id": 34 + }, + "serverCaMode": { + "type": "CaMode", + "id": 35 + }, + "customSubjectAlternativeNames": { + "rule": "repeated", + "type": "string", + "id": 37 + }, + "dnsNames": { + "rule": "repeated", + "type": "DnsNameMapping", + "id": 38, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "nodeCount": { + "type": "int32", + "id": 63, + "options": { + "proto3_optional": true + } + }, + "nodes": { + "rule": "repeated", + "type": "ConnectPoolNodeConfig", + "id": 64, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "mdxProtocolSupport": { + "rule": "repeated", + "type": "MdxProtocolSupport", + "id": 39, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "CaMode": { + "values": { + "CA_MODE_UNSPECIFIED": 0, + "GOOGLE_MANAGED_INTERNAL_CA": 1, + "GOOGLE_MANAGED_CAS_CA": 2, + "CUSTOMER_MANAGED_CAS_CA": 3 + } + }, + "ConnectPoolNodeConfig": { + "oneofs": { + "_name": { + "oneof": [ + "name" + ] + }, + "_dnsName": { + "oneof": [ + "dnsName" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "ipAddresses": { + "rule": "repeated", + "type": "IpMapping", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dnsName": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "dnsNames": { + "rule": "repeated", + "type": "DnsNameMapping", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "MdxProtocolSupport": { + "values": { + "MDX_PROTOCOL_SUPPORT_UNSPECIFIED": 0, + "CLIENT_PROTOCOL_TYPE": 1 + } + } + } + }, + "GenerateEphemeralCertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "publicKey": { + "type": "string", + "id": 3, + "options": { + "json_name": "public_key" + } + }, + "accessToken": { + "type": "string", + "id": 4, + "options": { + "json_name": "access_token", + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "validDuration": { + "type": "google.protobuf.Duration", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "GenerateEphemeralCertResponse": { + "fields": { + "ephemeralCert": { + "type": "SslCert", + "id": 1 + } + } + }, + "SqlDatabasesService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "Delete": { + "requestType": "SqlDatabasesDeleteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/v1/projects/{project}/instances/{instance}/databases/{database}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/projects/{project}/instances/{instance}/databases/{database}" + } + } + ] + }, + "Get": { + "requestType": "SqlDatabasesGetRequest", + "responseType": "Database", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/databases/{database}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/databases/{database}" + } + } + ] + }, + "Insert": { + "requestType": "SqlDatabasesInsertRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/databases", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/databases", + "body": "body" + } + } + ] + }, + "List": { + "requestType": "SqlDatabasesListRequest", + "responseType": "DatabasesListResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/databases" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/databases" + } + } + ] + }, + "Patch": { + "requestType": "SqlDatabasesUpdateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).patch": "/v1/projects/{project}/instances/{instance}/databases/{database}", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/v1/projects/{project}/instances/{instance}/databases/{database}", + "body": "body" + } + } + ] + }, + "Update": { + "requestType": "SqlDatabasesUpdateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).put": "/v1/projects/{project}/instances/{instance}/databases/{database}", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "put": "/v1/projects/{project}/instances/{instance}/databases/{database}", + "body": "body" + } + } + ] + } + } + }, + "SqlDatabasesDeleteRequest": { + "fields": { + "database": { + "type": "string", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + } + } + }, + "SqlDatabasesGetRequest": { + "fields": { + "database": { + "type": "string", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + } + } + }, + "SqlDatabasesInsertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "Database", + "id": 100 + } + } + }, + "SqlDatabasesListRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlDatabasesUpdateRequest": { + "fields": { + "database": { + "type": "string", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + }, + "body": { + "type": "Database", + "id": 100 + } + } + }, + "DatabasesListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "Database", + "id": 2 + } + } + }, + "SqlEventsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com" + }, + "methods": {} + }, + "SqlFeatureEligibilityService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com" + }, + "methods": {} + }, + "SqlFlagsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "List": { + "requestType": "SqlFlagsListRequest", + "responseType": "FlagsListResponse", + "options": { + "(google.api.http).get": "/v1/flags" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/flags" + } + } + ] + } + } + }, + "SqlFlagsListRequest": { + "oneofs": { + "_flagScope": { + "oneof": [ + "flagScope" + ] + } + }, + "fields": { + "databaseVersion": { + "type": "string", + "id": 1 + }, + "flagScope": { + "type": "SqlFlagScope", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + } + }, + "FlagsListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "Flag", + "id": 2 + } + } + }, + "Flag": { + "oneofs": { + "recommendedValue": { + "oneof": [ + "recommendedStringValue", + "recommendedIntValue" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "type": { + "type": "SqlFlagType", + "id": 2 + }, + "appliesTo": { + "rule": "repeated", + "type": "SqlDatabaseVersion", + "id": 3 + }, + "allowedStringValues": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "minValue": { + "type": "google.protobuf.Int64Value", + "id": 5 + }, + "maxValue": { + "type": "google.protobuf.Int64Value", + "id": 6 + }, + "requiresRestart": { + "type": "google.protobuf.BoolValue", + "id": 7 + }, + "kind": { + "type": "string", + "id": 8 + }, + "inBeta": { + "type": "google.protobuf.BoolValue", + "id": 9 + }, + "allowedIntValues": { + "rule": "repeated", + "type": "int64", + "id": 10 + }, + "flagScope": { + "type": "SqlFlagScope", + "id": 15 + }, + "recommendedStringValue": { + "type": "string", + "id": 16 + }, + "recommendedIntValue": { + "type": "google.protobuf.Int64Value", + "id": 17 + } + } + }, + "SqlFlagType": { + "values": { + "SQL_FLAG_TYPE_UNSPECIFIED": 0, + "BOOLEAN": 1, + "STRING": 2, + "INTEGER": 3, + "NONE": 4, + "MYSQL_TIMEZONE_OFFSET": 5, + "FLOAT": 6, + "REPEATED_STRING": 7 + } + }, + "SqlFlagScope": { + "values": { + "SQL_FLAG_SCOPE_UNSPECIFIED": 0, + "SQL_FLAG_SCOPE_DATABASE": 1, + "SQL_FLAG_SCOPE_CONNECTION_POOL": 2 + } + }, + "SqlIamPoliciesService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com" + }, + "methods": {} + }, + "SqlInstanceNamesService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com" + }, + "methods": {} + }, + "SqlOperationsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "Get": { + "requestType": "SqlOperationsGetRequest", + "responseType": "Operation", + "options": { + "(google.api.http).get": "/v1/projects/{project}/operations/{operation}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/operations/{operation}" + } + } + ] + }, + "List": { + "requestType": "SqlOperationsListRequest", + "responseType": "OperationsListResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/operations" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/operations" + } + } + ] + }, + "Cancel": { + "requestType": "SqlOperationsCancelRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/v1/projects/{project}/operations/{operation}/cancel" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/operations/{operation}/cancel" + } + } + ] + } + } + }, + "SqlOperationsGetRequest": { + "fields": { + "operation": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlOperationsListRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "maxResults": { + "type": "uint32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + } + } + }, + "OperationsListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "Operation", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3 + } + } + }, + "SqlOperationsCancelRequest": { + "fields": { + "operation": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlRegionsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com" + }, + "methods": {} + }, + "SqlSslCertsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "Delete": { + "requestType": "SqlSslCertsDeleteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + } + } + ] + }, + "Get": { + "requestType": "SqlSslCertsGetRequest", + "responseType": "SslCert", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + } + } + ] + }, + "Insert": { + "requestType": "SqlSslCertsInsertRequest", + "responseType": "SslCertsInsertResponse", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/sslCerts", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/sslCerts", + "body": "body" + } + } + ] + }, + "List": { + "requestType": "SqlSslCertsListRequest", + "responseType": "SslCertsListResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/sslCerts" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/sslCerts" + } + } + ] + } + } + }, + "SqlSslCertsDeleteRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "sha1Fingerprint": { + "type": "string", + "id": 3 + } + } + }, + "SqlSslCertsGetRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "sha1Fingerprint": { + "type": "string", + "id": 3 + } + } + }, + "SqlSslCertsInsertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "SslCertsInsertRequest", + "id": 100 + } + } + }, + "SqlSslCertsListRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SslCertsInsertRequest": { + "fields": { + "commonName": { + "type": "string", + "id": 1 + } + } + }, + "SslCertsInsertResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "operation": { + "type": "Operation", + "id": 2 + }, + "serverCaCert": { + "type": "SslCert", + "id": 3 + }, + "clientCert": { + "type": "SslCertDetail", + "id": 4 + } + } + }, + "SslCertsListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "SslCert", + "id": 2 + } + } + }, + "SqlTiersService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "List": { + "requestType": "SqlTiersListRequest", + "responseType": "TiersListResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/tiers" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/tiers" + } + } + ] + } + } + }, + "SqlTiersListRequest": { + "fields": { + "project": { + "type": "string", + "id": 1 + } + } + }, + "TiersListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "Tier", + "id": 2 + } + } + }, + "Tier": { + "fields": { + "tier": { + "type": "string", + "id": 1 + }, + "RAM": { + "type": "int64", + "id": 2, + "options": { + "json_name": "RAM" + } + }, + "kind": { + "type": "string", + "id": 3 + }, + "Disk_Quota": { + "type": "int64", + "id": 4, + "options": { + "json_name": "DiskQuota" + } + }, + "region": { + "rule": "repeated", + "type": "string", + "id": 5 + } + } + }, + "SqlUsersService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "Delete": { + "requestType": "SqlUsersDeleteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/v1/projects/{project}/instances/{instance}/users" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/v1/projects/{project}/instances/{instance}/users" + } + } + ] + }, + "Get": { + "requestType": "SqlUsersGetRequest", + "responseType": "User", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/users/{name}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/users/{name}" + } + } + ] + }, + "Insert": { + "requestType": "SqlUsersInsertRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/users", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/v1/projects/{project}/instances/{instance}/users", + "body": "body" + } + } + ] + }, + "List": { + "requestType": "SqlUsersListRequest", + "responseType": "UsersListResponse", + "options": { + "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/users" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/v1/projects/{project}/instances/{instance}/users" + } + } + ] + }, + "Update": { + "requestType": "SqlUsersUpdateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).put": "/v1/projects/{project}/instances/{instance}/users", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "put": "/v1/projects/{project}/instances/{instance}/users", + "body": "body" + } + } + ] + } + } + }, + "SqlUsersDeleteRequest": { + "fields": { + "host": { + "type": "string", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "name": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + } + } + }, + "SqlUsersGetRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "name": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + }, + "host": { + "type": "string", + "id": 4 + } + } + }, + "SqlUsersInsertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "User", + "id": 100 + } + } + }, + "SqlUsersListRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlUsersUpdateRequest": { + "oneofs": { + "_revokeExistingRoles": { + "oneof": [ + "revokeExistingRoles" + ] + } + }, + "fields": { + "host": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "instance": { + "type": "string", + "id": 2 + }, + "name": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + }, + "databaseRoles": { + "rule": "repeated", + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "revokeExistingRoles": { + "type": "bool", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "body": { + "type": "User", + "id": 100 + } + } + }, + "UserPasswordValidationPolicy": { + "fields": { + "allowedFailedAttempts": { + "type": "int32", + "id": 1 + }, + "passwordExpirationDuration": { + "type": "google.protobuf.Duration", + "id": 2 + }, + "enableFailedAttemptsCheck": { + "type": "bool", + "id": 3 + }, + "status": { + "type": "PasswordStatus", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "enablePasswordVerification": { + "type": "bool", + "id": 5 + } + } + }, + "PasswordStatus": { + "fields": { + "locked": { + "type": "bool", + "id": 1 + }, + "passwordExpirationTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "User": { + "oneofs": { + "userDetails": { + "oneof": [ + "sqlserverUserDetails" + ] + }, + "_dualPasswordType": { + "oneof": [ + "dualPasswordType" + ] + }, + "_iamStatus": { + "oneof": [ + "iamStatus" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "password": { + "type": "string", + "id": 2 + }, + "etag": { + "type": "string", + "id": 3 + }, + "name": { + "type": "string", + "id": 4 + }, + "host": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "instance": { + "type": "string", + "id": 6 + }, + "project": { + "type": "string", + "id": 7 + }, + "type": { + "type": "SqlUserType", + "id": 8 + }, + "sqlserverUserDetails": { + "type": "SqlServerUserDetails", + "id": 9 + }, + "iamEmail": { + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "passwordPolicy": { + "type": "UserPasswordValidationPolicy", + "id": 12 + }, + "dualPasswordType": { + "type": "DualPasswordType", + "id": 13, + "options": { + "proto3_optional": true + } + }, + "iamStatus": { + "type": "IamStatus", + "id": 14, + "options": { + "proto3_optional": true + } + }, + "databaseRoles": { + "rule": "repeated", + "type": "string", + "id": 15, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SqlUserType": { + "values": { + "BUILT_IN": 0, + "CLOUD_IAM_USER": 1, + "CLOUD_IAM_SERVICE_ACCOUNT": 2, + "CLOUD_IAM_GROUP": 3, + "CLOUD_IAM_GROUP_USER": 4, + "CLOUD_IAM_GROUP_SERVICE_ACCOUNT": 5, + "ENTRAID_USER": 7 + } + }, + "DualPasswordType": { + "values": { + "DUAL_PASSWORD_TYPE_UNSPECIFIED": 0, + "NO_MODIFY_DUAL_PASSWORD": 1, + "NO_DUAL_PASSWORD": 2, + "DUAL_PASSWORD": 3 + } + }, + "IamStatus": { + "values": { + "IAM_STATUS_UNSPECIFIED": 0, + "INACTIVE": 1, + "ACTIVE": 2 + } + } + } + }, + "SqlServerUserDetails": { + "fields": { + "disabled": { + "type": "bool", + "id": 1 + }, + "serverRoles": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "UsersListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "User", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3, + "options": { + "deprecated": true + } + } + } + } + } + }, + "v1beta4": { + "options": { + "go_package": "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb", + "java_multiple_files": true, + "java_outer_classname": "CloudSqlUsersProto", + "java_package": "com.google.cloud.sql.v1beta4", + "(google.api.resource_definition).type": "compute.googleapis.com/Network", + "(google.api.resource_definition).pattern": "projects/{project}/global/networks/{network}" + }, + "nested": { + "SqlBackupRunsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "Delete": { + "requestType": "SqlBackupRunsDeleteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" + } + } + ] + }, + "Get": { + "requestType": "SqlBackupRunsGetRequest", + "responseType": "BackupRun", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" + } + } + ] + }, + "Insert": { + "requestType": "SqlBackupRunsInsertRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns", + "body": "body" + } + } + ] + }, + "List": { + "requestType": "SqlBackupRunsListRequest", + "responseType": "BackupRunsListResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns" + } + } + ] + } + } + }, + "SqlDatabasesService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "Delete": { + "requestType": "SqlDatabasesDeleteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" + } + } + ] + }, + "Get": { + "requestType": "SqlDatabasesGetRequest", + "responseType": "Database", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" + } + } + ] + }, + "Insert": { + "requestType": "SqlDatabasesInsertRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/databases", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/databases", + "body": "body" + } + } + ] + }, + "List": { + "requestType": "SqlDatabasesListRequest", + "responseType": "DatabasesListResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/databases" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/databases" + } + } + ] + }, + "Patch": { + "requestType": "SqlDatabasesUpdateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).patch": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}", + "body": "body" + } + } + ] + }, + "Update": { + "requestType": "SqlDatabasesUpdateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).put": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "put": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}", + "body": "body" + } + } + ] + } + } + }, + "SqlFlagsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "List": { + "requestType": "SqlFlagsListRequest", + "responseType": "FlagsListResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/flags" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/flags" + } + } + ] + } + } + }, + "SqlInstancesService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "AddServerCa": { + "requestType": "SqlInstancesAddServerCaRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCa" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCa" + } + } + ] + }, + "AddServerCertificate": { + "requestType": "SqlInstancesAddServerCertificateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCertificate" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCertificate" + } + } + ] + }, + "AddEntraIdCertificate": { + "requestType": "SqlInstancesAddEntraIdCertificateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/addEntraIdCertificate" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/addEntraIdCertificate" + } + } + ] + }, + "Clone": { + "requestType": "SqlInstancesCloneRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/clone", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/clone", + "body": "body" + } + } + ] + }, + "Delete": { + "requestType": "SqlInstancesDeleteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/sql/v1beta4/projects/{project}/instances/{instance}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/sql/v1beta4/projects/{project}/instances/{instance}" + } + } + ] + }, + "DemoteMaster": { + "requestType": "SqlInstancesDemoteMasterRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/demoteMaster", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/demoteMaster", + "body": "body" + } + } + ] + }, + "Demote": { + "requestType": "SqlInstancesDemoteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/demote", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/demote", + "body": "body" + } + } + ] + }, + "Export": { + "requestType": "SqlInstancesExportRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/export", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/export", + "body": "body" + } + } + ] + }, + "Failover": { + "requestType": "SqlInstancesFailoverRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/failover", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/failover", + "body": "body" + } + } + ] + }, + "Reencrypt": { + "requestType": "SqlInstancesReencryptRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/reencrypt", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/reencrypt", + "body": "body" + } + } + ] + }, + "Get": { + "requestType": "SqlInstancesGetRequest", + "responseType": "DatabaseInstance", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}" + } + } + ] + }, + "Import": { + "requestType": "SqlInstancesImportRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/import", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/import", + "body": "body" + } + } + ] + }, + "Insert": { + "requestType": "SqlInstancesInsertRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances", + "body": "body" + } + } + ] + }, + "List": { + "requestType": "SqlInstancesListRequest", + "responseType": "InstancesListResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances" + } + } + ] + }, + "ListServerCas": { + "requestType": "SqlInstancesListServerCasRequest", + "responseType": "InstancesListServerCasResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCas" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCas" + } + } + ] + }, + "ListServerCertificates": { + "requestType": "SqlInstancesListServerCertificatesRequest", + "responseType": "InstancesListServerCertificatesResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCertificates" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCertificates" + } + } + ] + }, + "ListEntraIdCertificates": { + "requestType": "SqlInstancesListEntraIdCertificatesRequest", + "responseType": "InstancesListEntraIdCertificatesResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/listEntraIdCertificates" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/listEntraIdCertificates" + } + } + ] + }, + "Patch": { + "requestType": "SqlInstancesPatchRequest", + "responseType": "Operation", + "options": { + "(google.api.http).patch": "/sql/v1beta4/projects/{project}/instances/{instance}", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/sql/v1beta4/projects/{project}/instances/{instance}", + "body": "body" + } + } + ] + }, + "PromoteReplica": { + "requestType": "SqlInstancesPromoteReplicaRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/promoteReplica" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/promoteReplica" + } + } + ] + }, + "Switchover": { + "requestType": "SqlInstancesSwitchoverRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/switchover" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/switchover" + } + } + ] + }, + "ResetSslConfig": { + "requestType": "SqlInstancesResetSslConfigRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/resetSslConfig" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/resetSslConfig" + } + } + ] + }, + "Restart": { + "requestType": "SqlInstancesRestartRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/restart" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/restart" + } + } + ] + }, + "RestoreBackup": { + "requestType": "SqlInstancesRestoreBackupRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/restoreBackup", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/restoreBackup", + "body": "body" + } + } + ] + }, + "RotateServerCa": { + "requestType": "SqlInstancesRotateServerCaRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCa", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCa", + "body": "body" + } + } + ] + }, + "RotateServerCertificate": { + "requestType": "SqlInstancesRotateServerCertificateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCertificate", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCertificate", + "body": "body" + } + } + ] + }, + "RotateEntraIdCertificate": { + "requestType": "SqlInstancesRotateEntraIdCertificateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateEntraIdCertificate", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateEntraIdCertificate", + "body": "body" + } + } + ] + }, + "StartReplica": { + "requestType": "SqlInstancesStartReplicaRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/startReplica" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/startReplica" + } + } + ] + }, + "StopReplica": { + "requestType": "SqlInstancesStopReplicaRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/stopReplica" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/stopReplica" + } + } + ] + }, + "TruncateLog": { + "requestType": "SqlInstancesTruncateLogRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/truncateLog", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/truncateLog", + "body": "body" + } + } + ] + }, + "Update": { + "requestType": "SqlInstancesUpdateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).put": "/sql/v1beta4/projects/{project}/instances/{instance}", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "put": "/sql/v1beta4/projects/{project}/instances/{instance}", + "body": "body" + } + } + ] + }, + "CreateEphemeral": { + "requestType": "SqlInstancesCreateEphemeralCertRequest", + "responseType": "SslCert", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/createEphemeral", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/createEphemeral", + "body": "body" + } + } + ] + }, + "RescheduleMaintenance": { + "requestType": "SqlInstancesRescheduleMaintenanceRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/rescheduleMaintenance", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/rescheduleMaintenance", + "body": "body" + } + } + ] + }, + "VerifyExternalSyncSettings": { + "requestType": "SqlInstancesVerifyExternalSyncSettingsRequest", + "responseType": "SqlInstancesVerifyExternalSyncSettingsResponse", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/verifyExternalSyncSettings", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/verifyExternalSyncSettings", + "body": "*" + } + } + ] + }, + "StartExternalSync": { + "requestType": "SqlInstancesStartExternalSyncRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/startExternalSync", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/startExternalSync", + "body": "*" + } + } + ] + }, + "PerformDiskShrink": { + "requestType": "SqlInstancesPerformDiskShrinkRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/performDiskShrink", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/performDiskShrink", + "body": "body" + } + } + ] + }, + "GetDiskShrinkConfig": { + "requestType": "SqlInstancesGetDiskShrinkConfigRequest", + "responseType": "SqlInstancesGetDiskShrinkConfigResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/getDiskShrinkConfig" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/getDiskShrinkConfig" + } + } + ] + }, + "ResetReplicaSize": { + "requestType": "SqlInstancesResetReplicaSizeRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/resetReplicaSize", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/resetReplicaSize", + "body": "*" + } + } + ] + }, + "GetLatestRecoveryTime": { + "requestType": "SqlInstancesGetLatestRecoveryTimeRequest", + "responseType": "SqlInstancesGetLatestRecoveryTimeResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/getLatestRecoveryTime" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/getLatestRecoveryTime" + } + } + ] + }, + "ExecuteSql": { + "requestType": "SqlInstancesExecuteSqlRequest", + "responseType": "SqlInstancesExecuteSqlResponse", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/executeSql", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/executeSql", + "body": "body" + } + } + ] + }, + "AcquireSsrsLease": { + "requestType": "SqlInstancesAcquireSsrsLeaseRequest", + "responseType": "SqlInstancesAcquireSsrsLeaseResponse", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/acquireSsrsLease", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/acquireSsrsLease", + "body": "body" + } + } + ] + }, + "ReleaseSsrsLease": { + "requestType": "SqlInstancesReleaseSsrsLeaseRequest", + "responseType": "SqlInstancesReleaseSsrsLeaseResponse", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/releaseSsrsLease" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/releaseSsrsLease" + } + } + ] + }, + "PreCheckMajorVersionUpgrade": { + "requestType": "SqlInstancesPreCheckMajorVersionUpgradeRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade", + "body": "body" + } + } + ] + }, + "PointInTimeRestore": { + "requestType": "SqlInstancesPointInTimeRestoreRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/{parent=projects/*}:pointInTimeRestore", + "(google.api.http).body": "context" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/{parent=projects/*}:pointInTimeRestore", + "body": "context" + } + } + ] + } + } + }, + "SqlOperationsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "Get": { + "requestType": "SqlOperationsGetRequest", + "responseType": "Operation", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/operations/{operation}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/operations/{operation}" + } + } + ] + }, + "List": { + "requestType": "SqlOperationsListRequest", + "responseType": "OperationsListResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/operations" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/operations" + } + } + ] + }, + "Cancel": { + "requestType": "SqlOperationsCancelRequest", + "responseType": "google.protobuf.Empty", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/operations/{operation}/cancel" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/operations/{operation}/cancel" + } + } + ] + } + } + }, + "SqlSslCertsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "Delete": { + "requestType": "SqlSslCertsDeleteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + } + } + ] + }, + "Get": { + "requestType": "SqlSslCertsGetRequest", + "responseType": "SslCert", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" + } + } + ] + }, + "Insert": { + "requestType": "SqlSslCertsInsertRequest", + "responseType": "SslCertsInsertResponse", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts", + "body": "body" + } + } + ] + }, + "List": { + "requestType": "SqlSslCertsListRequest", + "responseType": "SslCertsListResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts" + } + } + ] + } + } + }, + "SqlBackupsService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "CreateBackup": { + "requestType": "CreateBackupRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/{parent=projects/*}/backups", + "(google.api.http).body": "backup", + "(google.api.method_signature)": "parent, backup" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/{parent=projects/*}/backups", + "body": "backup" + } + }, + { + "(google.api.method_signature)": "parent, backup" + } + ] + }, + "GetBackup": { + "requestType": "GetBackupRequest", + "responseType": "Backup", + "options": { + "(google.api.http).get": "/sql/v1beta4/{name=projects/*/backups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/{name=projects/*/backups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + }, + "ListBackups": { + "requestType": "ListBackupsRequest", + "responseType": "ListBackupsResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/{parent=projects/*}/backups", + "(google.api.method_signature)": "parent" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/{parent=projects/*}/backups" + } + }, + { + "(google.api.method_signature)": "parent" + } + ] + }, + "UpdateBackup": { + "requestType": "UpdateBackupRequest", + "responseType": "Operation", + "options": { + "(google.api.http).patch": "/sql/v1beta4/{backup.name=projects/*/backups/*}", + "(google.api.http).body": "backup", + "(google.api.method_signature)": "backup, update_mask" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "patch": "/sql/v1beta4/{backup.name=projects/*/backups/*}", + "body": "backup" + } + }, + { + "(google.api.method_signature)": "backup, update_mask" + } + ] + }, + "DeleteBackup": { + "requestType": "DeleteBackupRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/sql/v1beta4/{name=projects/*/backups/*}", + "(google.api.method_signature)": "name" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/sql/v1beta4/{name=projects/*/backups/*}" + } + }, + { + "(google.api.method_signature)": "name" + } + ] + } + } + }, + "CreateBackupRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "sqladmin.googleapis.com/Backup" + } + }, + "backup": { + "type": "Backup", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "GetBackupRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" + } + } + } + }, + "ListBackupsRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).child_type": "sqladmin.googleapis.com/Backup" + } + }, + "pageSize": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "filter": { + "type": "string", + "id": 4 + } + } + }, + "ListBackupsResponse": { + "fields": { + "backups": { + "rule": "repeated", + "type": "Backup", + "id": 1 + }, + "nextPageToken": { + "type": "string", + "id": 2 + }, + "warnings": { + "rule": "repeated", + "type": "ApiWarning", + "id": 3 + } + } + }, + "UpdateBackupRequest": { + "fields": { + "backup": { + "type": "Backup", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "updateMask": { + "type": "google.protobuf.FieldMask", + "id": 2 + } + } + }, + "DeleteBackupRequest": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED", + "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" + } + } + } + }, + "SqlBackupRunsDeleteRequest": { + "fields": { + "id": { + "type": "int64", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + } + } + }, + "SqlBackupRunsGetRequest": { + "fields": { + "id": { + "type": "int64", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + } + } + }, + "SqlBackupRunsInsertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "BackupRun", + "id": 100 + } + } + }, + "SqlBackupRunsListRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "maxResults": { + "type": "int32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + } + } + }, + "SqlDatabasesDeleteRequest": { + "fields": { + "database": { + "type": "string", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + } + } + }, + "SqlDatabasesGetRequest": { + "fields": { + "database": { + "type": "string", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + } + } + }, + "SqlDatabasesInsertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "Database", + "id": 100 + } + } + }, + "SqlDatabasesListRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlDatabasesUpdateRequest": { + "fields": { + "database": { + "type": "string", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + }, + "body": { + "type": "Database", + "id": 100 + } + } + }, + "SqlFlagsListRequest": { + "oneofs": { + "_flagScope": { + "oneof": [ + "flagScope" + ] + } + }, + "fields": { + "databaseVersion": { + "type": "string", + "id": 1 + }, + "flagScope": { + "type": "SqlFlagScope", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + } + }, + "SqlInstancesAddServerCaRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesAddServerCertificateRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesAddEntraIdCertificateRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesCloneRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesCloneRequest", + "id": 100 + } + } + }, + "SqlInstancesDeleteRequest": { + "oneofs": { + "_enableFinalBackup": { + "oneof": [ + "enableFinalBackup" + ] + }, + "expiration": { + "oneof": [ + "finalBackupTtlDays", + "finalBackupExpiryTime" + ] + } + }, + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "enableFinalBackup": { + "type": "bool", + "id": 7, + "options": { + "proto3_optional": true + } + }, + "finalBackupTtlDays": { + "type": "int64", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "finalBackupExpiryTime": { + "type": "google.protobuf.Timestamp", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "finalBackupDescription": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlInstancesDemoteMasterRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesDemoteMasterRequest", + "id": 100 + } + } + }, + "SqlInstancesDemoteRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesDemoteRequest", + "id": 100 + } + } + }, + "SqlInstancesExportRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesExportRequest", + "id": 100 + } + } + }, + "SqlInstancesFailoverRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesFailoverRequest", + "id": 100 + } + } + }, + "SqlInstancesGetRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesImportRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesImportRequest", + "id": 100 + } + } + }, + "SqlInstancesInsertRequest": { + "fields": { + "project": { + "type": "string", + "id": 1 + }, + "body": { + "type": "DatabaseInstance", + "id": 100 + } + } + }, + "SqlInstancesListRequest": { + "fields": { + "filter": { + "type": "string", + "id": 1 + }, + "maxResults": { + "type": "uint32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + } + } + }, + "SqlInstancesListServerCasRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesListServerCertificatesRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesListEntraIdCertificatesRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesPatchRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "DatabaseInstance", + "id": 100 + } + } + }, + "SqlInstancesPromoteReplicaRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "failover": { + "type": "bool", + "id": 3 + } + } + }, + "SqlInstancesSwitchoverRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "dbTimeout": { + "type": "google.protobuf.Duration", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlInstancesResetSslConfigRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "mode": { + "type": "ResetSslMode", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "ResetSslMode": { + "values": { + "RESET_SSL_MODE_UNSPECIFIED": 0, + "ALL": 1, + "SYNC_FROM_PRIMARY": 2 + } + } + } + }, + "SqlInstancesRestartRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesRestoreBackupRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesRestoreBackupRequest", + "id": 100 + } + } + }, + "SqlInstancesRotateServerCaRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesRotateServerCaRequest", + "id": 100 + } + } + }, + "SqlInstancesRotateServerCertificateRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesRotateServerCertificateRequest", + "id": 100, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesRotateEntraIdCertificateRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesRotateEntraIdCertificateRequest", + "id": 100, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesStartReplicaRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesStopReplicaRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesTruncateLogRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesTruncateLogRequest", + "id": 100 + } + } + }, + "SqlInstancesUpdateRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "DatabaseInstance", + "id": 100 + } + } + }, + "SqlInstancesReencryptRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "InstancesReencryptRequest", + "id": 3 + } + } + }, + "InstancesReencryptRequest": { + "oneofs": { + "_backupReencryptionConfig": { + "oneof": [ + "backupReencryptionConfig" + ] + } + }, + "fields": { + "backupReencryptionConfig": { + "type": "BackupReencryptionConfig", + "id": 1, + "options": { + "proto3_optional": true + } + } + } + }, + "BackupReencryptionConfig": { + "oneofs": { + "_backupLimit": { + "oneof": [ + "backupLimit" + ] + }, + "_backupType": { + "oneof": [ + "backupType" + ] + } + }, + "fields": { + "backupLimit": { + "type": "int32", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "backupType": { + "type": "BackupType", + "id": 2, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "BackupType": { + "values": { + "BACKUP_TYPE_UNSPECIFIED": 0, + "AUTOMATED": 1, + "ON_DEMAND": 2 + } + } + } + }, + "SqlInstancesRescheduleMaintenanceRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "SqlInstancesRescheduleMaintenanceRequestBody", + "id": 100 + } + } + }, + "SqlInstancesPerformDiskShrinkRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "PerformDiskShrinkContext", + "id": 100 + } + } + }, + "ExternalSyncParallelLevel": { + "values": { + "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": 0, + "MIN": 1, + "OPTIMAL": 2, + "MAX": 3 + } + }, + "ExternalSyncSelectedObject": { + "fields": { + "database": { + "type": "string", + "id": 1 + } + } + }, + "SqlInstancesVerifyExternalSyncSettingsRequest": { + "oneofs": { + "syncConfig": { + "oneof": [ + "mysqlSyncConfig" + ] + } + }, + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "verifyConnectionOnly": { + "type": "bool", + "id": 3 + }, + "syncMode": { + "type": "ExternalSyncMode", + "id": 4 + }, + "verifyReplicationOnly": { + "type": "bool", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "mysqlSyncConfig": { + "type": "MySqlSyncConfig", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "migrationType": { + "type": "MigrationType", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "syncParallelLevel": { + "type": "ExternalSyncParallelLevel", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "selectedObjects": { + "rule": "repeated", + "type": "ExternalSyncSelectedObject", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "ExternalSyncMode": { + "values": { + "EXTERNAL_SYNC_MODE_UNSPECIFIED": 0, + "ONLINE": 1, + "OFFLINE": 2 + } + }, + "MigrationType": { + "values": { + "MIGRATION_TYPE_UNSPECIFIED": 0, + "LOGICAL": 1, + "PHYSICAL": 2 + } + } + } + }, + "SqlInstancesStartExternalSyncRequest": { + "oneofs": { + "syncConfig": { + "oneof": [ + "mysqlSyncConfig" + ] + } + }, + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "syncMode": { + "type": "SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode", + "id": 3 + }, + "skipVerification": { + "type": "bool", + "id": 4 + }, + "mysqlSyncConfig": { + "type": "MySqlSyncConfig", + "id": 6 + }, + "syncParallelLevel": { + "type": "ExternalSyncParallelLevel", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "migrationType": { + "type": "SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "replicaOverwriteEnabled": { + "type": "bool", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlInstancesResetReplicaSizeRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlOperationsGetRequest": { + "fields": { + "operation": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlOperationsListRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "maxResults": { + "type": "uint32", + "id": 2 + }, + "pageToken": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + } + } + }, + "SqlOperationsCancelRequest": { + "fields": { + "operation": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesCreateEphemeralCertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "SslCertsCreateEphemeralRequest", + "id": 100 + } + } + }, + "SqlSslCertsDeleteRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "sha1Fingerprint": { + "type": "string", + "id": 3 + } + } + }, + "SqlSslCertsGetRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "sha1Fingerprint": { + "type": "string", + "id": 3 + } + } + }, + "SqlSslCertsInsertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "SslCertsInsertRequest", + "id": 100 + } + } + }, + "SqlSslCertsListRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesGetDiskShrinkConfigRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlInstancesGetLatestRecoveryTimeRequest": { + "oneofs": { + "_sourceInstanceDeletionTime": { + "oneof": [ + "sourceInstanceDeletionTime" + ] + } + }, + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "sourceInstanceDeletionTime": { + "type": "google.protobuf.Timestamp", + "id": 3, + "options": { + "proto3_optional": true + } + } + } + }, + "SqlInstancesGetLatestRecoveryTimeResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "latestRecoveryTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "earliestRecoveryTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "SqlInstancesExecuteSqlRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "ExecuteSqlPayload", + "id": 100 + } + } + }, + "SqlInstancesReleaseSsrsLeaseRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesReleaseSsrsLeaseResponse": { + "fields": { + "operationId": { + "type": "string", + "id": 1 + } + } + }, + "ExecuteSqlPayload": { + "oneofs": { + "userPassword": { + "oneof": [ + "autoIamAuthn" + ] + } + }, + "fields": { + "user": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "sqlStatement": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "database": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "autoIamAuthn": { + "type": "bool", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "rowLimit": { + "type": "int64", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "partialResultMode": { + "type": "PartialResultMode", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "application": { + "type": "string", + "id": 16, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "PartialResultMode": { + "values": { + "PARTIAL_RESULT_MODE_UNSPECIFIED": 0, + "FAIL_PARTIAL_RESULT": 1, + "ALLOW_PARTIAL_RESULT": 2 + } + } + } + }, + "SqlInstancesExecuteSqlResponse": { + "fields": { + "messages": { + "rule": "repeated", + "type": "Message", + "id": 9 + }, + "metadata": { + "type": "Metadata", + "id": 6 + }, + "results": { + "rule": "repeated", + "type": "QueryResult", + "id": 7 + }, + "status": { + "type": "google.rpc.Status", + "id": 8 + } + }, + "nested": { + "Message": { + "oneofs": { + "_message": { + "oneof": [ + "message" + ] + }, + "_severity": { + "oneof": [ + "severity" + ] + } + }, + "fields": { + "message": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "severity": { + "type": "string", + "id": 2, + "options": { + "proto3_optional": true + } + } + } + } + } + }, + "QueryResult": { + "fields": { + "columns": { + "rule": "repeated", + "type": "Column", + "id": 1 + }, + "rows": { + "rule": "repeated", + "type": "Row", + "id": 2 + }, + "message": { + "type": "string", + "id": 3 + }, + "partialResult": { + "type": "bool", + "id": 4 + }, + "status": { + "type": "google.rpc.Status", + "id": 8 + } + } + }, + "Column": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "type": { + "type": "string", + "id": 2 + } + } + }, + "Row": { + "fields": { + "values": { + "rule": "repeated", + "type": "Value", + "id": 1 + } + } + }, + "Value": { + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "nullValue": { + "type": "bool", + "id": 2 + } + } + }, + "Metadata": { + "fields": { + "sqlStatementExecutionTime": { + "type": "google.protobuf.Duration", + "id": 1 + } + } + }, + "SqlInstancesAcquireSsrsLeaseRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesAcquireSsrsLeaseRequest", + "id": 100 + } + } + }, + "SqlInstancesPreCheckMajorVersionUpgradeRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "project": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "body": { + "type": "InstancesPreCheckMajorVersionUpgradeRequest", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlInstancesAcquireSsrsLeaseResponse": { + "oneofs": { + "_operationId": { + "oneof": [ + "operationId" + ] + } + }, + "fields": { + "operationId": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + } + } + }, + "SqlInstancesPointInTimeRestoreRequest": { + "fields": { + "parent": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "context": { + "type": "PointInTimeRestoreContext", + "id": 100, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "AclEntry": { + "fields": { + "value": { + "type": "string", + "id": 1 + }, + "expirationTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + }, + "name": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "kind": { + "type": "string", + "id": 4 + } + } + }, + "ApiWarning": { + "fields": { + "code": { + "type": "SqlApiWarningCode", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "region": { + "type": "string", + "id": 3 + } + }, + "nested": { + "SqlApiWarningCode": { + "values": { + "SQL_API_WARNING_CODE_UNSPECIFIED": 0, + "REGION_UNREACHABLE": 1, + "MAX_RESULTS_EXCEEDS_LIMIT": 2, + "COMPROMISED_CREDENTIALS": 3, + "INTERNAL_STATE_FAILURE": 4 + } + } + } + }, + "BackupRetentionSettings": { + "fields": { + "retentionUnit": { + "type": "RetentionUnit", + "id": 1 + }, + "retainedBackups": { + "type": "google.protobuf.Int32Value", + "id": 2 + } + }, + "nested": { + "RetentionUnit": { + "values": { + "RETENTION_UNIT_UNSPECIFIED": 0, + "COUNT": 1 + } + } + } + }, + "BackupConfiguration": { + "oneofs": { + "_transactionalLogStorageState": { + "oneof": [ + "transactionalLogStorageState" + ] + }, + "_backupTier": { + "oneof": [ + "backupTier" + ] + } + }, + "fields": { + "startTime": { + "type": "string", + "id": 1 + }, + "enabled": { + "type": "google.protobuf.BoolValue", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + }, + "binaryLogEnabled": { + "type": "google.protobuf.BoolValue", + "id": 4 + }, + "replicationLogArchivingEnabled": { + "type": "google.protobuf.BoolValue", + "id": 5 + }, + "location": { + "type": "string", + "id": 6 + }, + "pointInTimeRecoveryEnabled": { + "type": "google.protobuf.BoolValue", + "id": 7 + }, + "transactionLogRetentionDays": { + "type": "google.protobuf.Int32Value", + "id": 9 + }, + "backupRetentionSettings": { + "type": "BackupRetentionSettings", + "id": 10 + }, + "transactionalLogStorageState": { + "type": "TransactionalLogStorageState", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "backupTier": { + "type": "BackupTier", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + } + }, + "nested": { + "TransactionalLogStorageState": { + "values": { + "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED": 0, + "DISK": 1, + "SWITCHING_TO_CLOUD_STORAGE": 2, + "SWITCHED_TO_CLOUD_STORAGE": 3, + "CLOUD_STORAGE": 4 + } + }, + "BackupTier": { + "valuesOptions": { + "ADVANCED": { + "deprecated": true + } + }, + "values": { + "BACKUP_TIER_UNSPECIFIED": 0, + "STANDARD": 1, + "ADVANCED": 2, + "ENHANCED": 3 + } + } + } + }, + "BackupRun": { + "oneofs": { + "_maxChargeableBytes": { + "oneof": [ + "maxChargeableBytes" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "status": { + "type": "SqlBackupRunStatus", + "id": 2 + }, + "enqueuedTime": { + "type": "google.protobuf.Timestamp", + "id": 3 + }, + "id": { + "type": "int64", + "id": 4 + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "error": { + "type": "OperationError", + "id": 7 + }, + "type": { + "type": "SqlBackupRunType", + "id": 8 + }, + "description": { + "type": "string", + "id": 9 + }, + "windowStartTime": { + "type": "google.protobuf.Timestamp", + "id": 10 + }, + "instance": { + "type": "string", + "id": 11 + }, + "selfLink": { + "type": "string", + "id": 12 + }, + "location": { + "type": "string", + "id": 13 + }, + "databaseVersion": { + "type": "SqlDatabaseVersion", + "id": 15, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "diskEncryptionConfiguration": { + "type": "DiskEncryptionConfiguration", + "id": 16 + }, + "diskEncryptionStatus": { + "type": "DiskEncryptionStatus", + "id": 17 + }, + "backupKind": { + "type": "SqlBackupKind", + "id": 19 + }, + "timeZone": { + "type": "string", + "id": 23 + }, + "maxChargeableBytes": { + "type": "int64", + "id": 24, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + } + } + }, + "Backup": { + "options": { + "(google.api.resource).type": "sqladmin.googleapis.com/Backup", + "(google.api.resource).pattern": "projects/{project}/backups/{backup}" + }, + "oneofs": { + "expiration": { + "oneof": [ + "ttlDays", + "expiryTime" + ] + }, + "_maxChargeableBytes": { + "oneof": [ + "maxChargeableBytes" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "kind": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "selfLink": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "type": { + "type": "SqlBackupType", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "description": { + "type": "string", + "id": 5 + }, + "instance": { + "type": "string", + "id": 6 + }, + "location": { + "type": "string", + "id": 7 + }, + "backupInterval": { + "type": "google.type.Interval", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "state": { + "type": "SqlBackupState", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "error": { + "type": "OperationError", + "id": 10, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "kmsKey": { + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "kmsKeyVersion": { + "type": "string", + "id": 12, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "backupKind": { + "type": "SqlBackupKind", + "id": 13, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "timeZone": { + "type": "string", + "id": 15, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "ttlDays": { + "type": "int64", + "id": 16, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY" + } + }, + "expiryTime": { + "type": "google.protobuf.Timestamp", + "id": 17 + }, + "databaseVersion": { + "type": "SqlDatabaseVersion", + "id": 20, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "maxChargeableBytes": { + "type": "int64", + "id": 23, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "instanceDeletionTime": { + "type": "google.protobuf.Timestamp", + "id": 24, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "instanceSettings": { + "type": "DatabaseInstance", + "id": 25, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "backupRun": { + "type": "string", + "id": 26, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "satisfiesPzs": { + "type": "google.protobuf.BoolValue", + "id": 27, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "satisfiesPzi": { + "type": "google.protobuf.BoolValue", + "id": 28, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "SqlBackupType": { + "values": { + "SQL_BACKUP_TYPE_UNSPECIFIED": 0, + "AUTOMATED": 1, + "ON_DEMAND": 2, + "FINAL": 3 + } + }, + "SqlBackupState": { + "values": { + "SQL_BACKUP_STATE_UNSPECIFIED": 0, + "ENQUEUED": 1, + "RUNNING": 2, + "FAILED": 3, + "SUCCESSFUL": 4, + "DELETING": 5, + "DELETION_FAILED": 6 + } + } + } + }, + "BackupRunsListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "BackupRun", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3 + } + } + }, + "BinLogCoordinates": { + "fields": { + "binLogFileName": { + "type": "string", + "id": 1 + }, + "binLogPosition": { + "type": "int64", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + } + } + }, + "BackupContext": { + "fields": { + "backupId": { + "type": "int64", + "id": 1 + }, + "kind": { + "type": "string", + "id": 2 + }, + "name": { + "type": "string", + "id": 3 + } + } + }, + "CloneContext": { + "oneofs": { + "_preferredZone": { + "oneof": [ + "preferredZone" + ] + }, + "_preferredSecondaryZone": { + "oneof": [ + "preferredSecondaryZone" + ] + }, + "_sourceInstanceDeletionTime": { + "oneof": [ + "sourceInstanceDeletionTime" + ] + }, + "_destinationProject": { + "oneof": [ + "destinationProject" + ] + }, + "_destinationNetwork": { + "oneof": [ + "destinationNetwork" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "pitrTimestampMs": { + "type": "int64", + "id": 2 + }, + "destinationInstanceName": { + "type": "string", + "id": 3 + }, + "binLogCoordinates": { + "type": "BinLogCoordinates", + "id": 4 + }, + "pointInTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "allocatedIpRange": { + "type": "string", + "id": 6 + }, + "databaseNames": { + "rule": "repeated", + "type": "string", + "id": 9 + }, + "preferredZone": { + "type": "string", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "preferredSecondaryZone": { + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "sourceInstanceDeletionTime": { + "type": "google.protobuf.Timestamp", + "id": 12, + "options": { + "proto3_optional": true + } + }, + "destinationProject": { + "type": "string", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "destinationNetwork": { + "type": "string", + "id": 14, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "(google.api.resource_reference).type": "compute.googleapis.com/Network", + "proto3_optional": true + } + } + } + }, + "Database": { + "oneofs": { + "databaseDetails": { + "oneof": [ + "sqlserverDatabaseDetails" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "charset": { + "type": "string", + "id": 2 + }, + "collation": { + "type": "string", + "id": 3 + }, + "etag": { + "type": "string", + "id": 4 + }, + "name": { + "type": "string", + "id": 5 + }, + "instance": { + "type": "string", + "id": 6 + }, + "selfLink": { + "type": "string", + "id": 7 + }, + "project": { + "type": "string", + "id": 8 + }, + "sqlserverDatabaseDetails": { + "type": "SqlServerDatabaseDetails", + "id": 9 + } + } + }, + "SqlServerDatabaseDetails": { + "fields": { + "compatibilityLevel": { + "type": "int32", + "id": 1 + }, + "recoveryModel": { + "type": "string", + "id": 2 + } + } + }, + "DatabaseFlags": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "type": "string", + "id": 2 + } + } + }, + "SyncFlags": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "type": "string", + "id": 2 + } + } + }, + "InstanceReference": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "region": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + } + } + }, + "DatabaseInstance": { + "oneofs": { + "_outOfDiskReport": { + "oneof": [ + "outOfDiskReport" + ] + }, + "_sqlNetworkArchitecture": { + "oneof": [ + "sqlNetworkArchitecture" + ] + }, + "_pscServiceAttachmentLink": { + "oneof": [ + "pscServiceAttachmentLink" + ] + }, + "_dnsName": { + "oneof": [ + "dnsName" + ] + }, + "_primaryDnsName": { + "oneof": [ + "primaryDnsName" + ] + }, + "_writeEndpoint": { + "oneof": [ + "writeEndpoint" + ] + }, + "_replicationCluster": { + "oneof": [ + "replicationCluster" + ] + }, + "_geminiConfig": { + "oneof": [ + "geminiConfig" + ] + }, + "_switchTransactionLogsToCloudStorageEnabled": { + "oneof": [ + "switchTransactionLogsToCloudStorageEnabled" + ] + }, + "_includeReplicasForMajorVersionUpgrade": { + "oneof": [ + "includeReplicasForMajorVersionUpgrade" + ] + }, + "_nodeCount": { + "oneof": [ + "nodeCount" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "state": { + "type": "SqlInstanceState", + "id": 2 + }, + "databaseVersion": { + "type": "SqlDatabaseVersion", + "id": 3 + }, + "settings": { + "type": "Settings", + "id": 4 + }, + "etag": { + "type": "string", + "id": 5 + }, + "failoverReplica": { + "type": "SqlFailoverReplica", + "id": 6 + }, + "masterInstanceName": { + "type": "string", + "id": 7 + }, + "replicaNames": { + "rule": "repeated", + "type": "string", + "id": 8 + }, + "maxDiskSize": { + "type": "google.protobuf.Int64Value", + "id": 9, + "options": { + "deprecated": true + } + }, + "currentDiskSize": { + "type": "google.protobuf.Int64Value", + "id": 10, + "options": { + "deprecated": true + } + }, + "ipAddresses": { + "rule": "repeated", + "type": "IpMapping", + "id": 11 + }, + "serverCaCert": { + "type": "SslCert", + "id": 12 + }, + "instanceType": { + "type": "SqlInstanceType", + "id": 13 + }, + "project": { + "type": "string", + "id": 14 + }, + "ipv6Address": { + "type": "string", + "id": 15, + "options": { + "deprecated": true + } + }, + "serviceAccountEmailAddress": { + "type": "string", + "id": 16 + }, + "onPremisesConfiguration": { + "type": "OnPremisesConfiguration", + "id": 17 + }, + "replicaConfiguration": { + "type": "ReplicaConfiguration", + "id": 18 + }, + "backendType": { + "type": "SqlBackendType", + "id": 19 + }, + "selfLink": { + "type": "string", + "id": 20 + }, + "suspensionReason": { + "rule": "repeated", + "type": "SqlSuspensionReason", + "id": 21 + }, + "connectionName": { + "type": "string", + "id": 22 + }, + "name": { + "type": "string", + "id": 23 + }, + "region": { + "type": "string", + "id": 24 + }, + "gceZone": { + "type": "string", + "id": 25 + }, + "secondaryGceZone": { + "type": "string", + "id": 34 + }, + "diskEncryptionConfiguration": { + "type": "DiskEncryptionConfiguration", + "id": 26 + }, + "diskEncryptionStatus": { + "type": "DiskEncryptionStatus", + "id": 27 + }, + "rootPassword": { + "type": "string", + "id": 29 + }, + "scheduledMaintenance": { + "type": "SqlScheduledMaintenance", + "id": 30 + }, + "satisfiesPzs": { + "type": "google.protobuf.BoolValue", + "id": 35 + }, + "databaseInstalledVersion": { + "type": "string", + "id": 40, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "outOfDiskReport": { + "type": "SqlOutOfDiskReport", + "id": 38, + "options": { + "proto3_optional": true + } + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 39, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "availableMaintenanceVersions": { + "rule": "repeated", + "type": "string", + "id": 41, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "maintenanceVersion": { + "type": "string", + "id": 42 + }, + "upgradableDatabaseVersions": { + "rule": "repeated", + "type": "AvailableDatabaseVersion", + "id": 45, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "sqlNetworkArchitecture": { + "type": "SqlNetworkArchitecture", + "id": 47, + "options": { + "proto3_optional": true + } + }, + "pscServiceAttachmentLink": { + "type": "string", + "id": 48, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "dnsName": { + "type": "string", + "id": 49, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "primaryDnsName": { + "type": "string", + "id": 51, + "options": { + "deprecated": true, + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "writeEndpoint": { + "type": "string", + "id": 52, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "replicationCluster": { + "type": "ReplicationCluster", + "id": 54, + "options": { + "proto3_optional": true + } + }, + "geminiConfig": { + "type": "GeminiInstanceConfig", + "id": 55, + "options": { + "proto3_optional": true + } + }, + "satisfiesPzi": { + "type": "google.protobuf.BoolValue", + "id": 56, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "switchTransactionLogsToCloudStorageEnabled": { + "type": "google.protobuf.BoolValue", + "id": 57, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY", + "proto3_optional": true + } + }, + "includeReplicasForMajorVersionUpgrade": { + "type": "google.protobuf.BoolValue", + "id": 59, + "options": { + "(google.api.field_behavior)": "INPUT_ONLY", + "proto3_optional": true + } + }, + "tags": { + "keyType": "string", + "type": "string", + "id": 60, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "nodeCount": { + "type": "int32", + "id": 63, + "options": { + "proto3_optional": true + } + }, + "nodes": { + "rule": "repeated", + "type": "PoolNodeConfig", + "id": 64, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dnsNames": { + "rule": "repeated", + "type": "DnsNameMapping", + "id": 67, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "SqlInstanceState": { + "valuesOptions": { + "ONLINE_MAINTENANCE": { + "deprecated": true + } + }, + "values": { + "SQL_INSTANCE_STATE_UNSPECIFIED": 0, + "RUNNABLE": 1, + "SUSPENDED": 2, + "PENDING_DELETE": 3, + "PENDING_CREATE": 4, + "MAINTENANCE": 5, + "FAILED": 6, + "ONLINE_MAINTENANCE": 7, + "REPAIRING": 8 + } + }, + "SqlFailoverReplica": { + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "available": { + "type": "google.protobuf.BoolValue", + "id": 2 + } + } + }, + "SqlScheduledMaintenance": { + "oneofs": { + "_scheduleDeadlineTime": { + "oneof": [ + "scheduleDeadlineTime" + ] + } + }, + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "canDefer": { + "type": "bool", + "id": 2, + "options": { + "deprecated": true + } + }, + "canReschedule": { + "type": "bool", + "id": 3 + }, + "scheduleDeadlineTime": { + "type": "google.protobuf.Timestamp", + "id": 4, + "options": { + "proto3_optional": true + } + } + } + }, + "SqlOutOfDiskReport": { + "oneofs": { + "_sqlOutOfDiskState": { + "oneof": [ + "sqlOutOfDiskState" + ] + }, + "_sqlMinRecommendedIncreaseSizeGb": { + "oneof": [ + "sqlMinRecommendedIncreaseSizeGb" + ] + } + }, + "fields": { + "sqlOutOfDiskState": { + "type": "SqlOutOfDiskState", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "sqlMinRecommendedIncreaseSizeGb": { + "type": "int32", + "id": 2, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "SqlOutOfDiskState": { + "values": { + "SQL_OUT_OF_DISK_STATE_UNSPECIFIED": 0, + "NORMAL": 1, + "SOFT_SHUTDOWN": 2 + } + } + } + }, + "SqlNetworkArchitecture": { + "values": { + "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED": 0, + "NEW_NETWORK_ARCHITECTURE": 1, + "OLD_NETWORK_ARCHITECTURE": 2 + } + }, + "PoolNodeConfig": { + "oneofs": { + "_name": { + "oneof": [ + "name" + ] + }, + "_gceZone": { + "oneof": [ + "gceZone" + ] + }, + "_dnsName": { + "oneof": [ + "dnsName" + ] + }, + "_state": { + "oneof": [ + "state" + ] + }, + "_pscServiceAttachmentLink": { + "oneof": [ + "pscServiceAttachmentLink" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "gceZone": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "ipAddresses": { + "rule": "repeated", + "type": "IpMapping", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dnsName": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "state": { + "type": "SqlInstanceState", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "dnsNames": { + "rule": "repeated", + "type": "DnsNameMapping", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "pscServiceAttachmentLink": { + "type": "string", + "id": 7, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "pscAutoConnections": { + "rule": "repeated", + "type": "PscAutoConnectionConfig", + "id": 8, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + } + } + }, + "DnsNameMapping": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "connectionType": { + "type": "ConnectionType", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dnsScope": { + "type": "DnsScope", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "recordManager": { + "type": "RecordManager", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + }, + "nested": { + "ConnectionType": { + "values": { + "CONNECTION_TYPE_UNSPECIFIED": 0, + "PUBLIC": 1, + "PRIVATE_SERVICES_ACCESS": 2, + "PRIVATE_SERVICE_CONNECT": 3 + } + }, + "DnsScope": { + "values": { + "DNS_SCOPE_UNSPECIFIED": 0, + "INSTANCE": 1, + "CLUSTER": 2 + } + }, + "RecordManager": { + "values": { + "RECORD_MANAGER_UNSPECIFIED": 0, + "CUSTOMER": 1, + "CLOUD_SQL_AUTOMATION": 2 + } + } + } + }, + "GeminiInstanceConfig": { + "oneofs": { + "_entitled": { + "oneof": [ + "entitled" + ] + }, + "_googleVacuumMgmtEnabled": { + "oneof": [ + "googleVacuumMgmtEnabled" + ] + }, + "_oomSessionCancelEnabled": { + "oneof": [ + "oomSessionCancelEnabled" + ] + }, + "_activeQueryEnabled": { + "oneof": [ + "activeQueryEnabled" + ] + }, + "_indexAdvisorEnabled": { + "oneof": [ + "indexAdvisorEnabled" + ] + }, + "_flagRecommenderEnabled": { + "oneof": [ + "flagRecommenderEnabled" + ] + } + }, + "fields": { + "entitled": { + "type": "bool", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "googleVacuumMgmtEnabled": { + "type": "bool", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "oomSessionCancelEnabled": { + "type": "bool", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "activeQueryEnabled": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "indexAdvisorEnabled": { + "type": "bool", + "id": 5, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "flagRecommenderEnabled": { + "type": "bool", + "id": 6, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + } + } + }, + "ReplicationCluster": { + "oneofs": { + "_psaWriteEndpoint": { + "oneof": [ + "psaWriteEndpoint" + ] + }, + "_failoverDrReplicaName": { + "oneof": [ + "failoverDrReplicaName" + ] + }, + "_drReplica": { + "oneof": [ + "drReplica" + ] + } + }, + "fields": { + "psaWriteEndpoint": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "failoverDrReplicaName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "drReplica": { + "type": "bool", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + } + } + }, + "AvailableDatabaseVersion": { + "oneofs": { + "_majorVersion": { + "oneof": [ + "majorVersion" + ] + }, + "_name": { + "oneof": [ + "name" + ] + }, + "_displayName": { + "oneof": [ + "displayName" + ] + } + }, + "fields": { + "majorVersion": { + "type": "string", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "name": { + "type": "string", + "id": 8, + "options": { + "proto3_optional": true + } + }, + "displayName": { + "type": "string", + "id": 9, + "options": { + "proto3_optional": true + } + } + } + }, + "DatabasesListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "Database", + "id": 2 + } + } + }, + "DemoteMasterConfiguration": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "mysqlReplicaConfiguration": { + "type": "DemoteMasterMySqlReplicaConfiguration", + "id": 2 + } + } + }, + "DemoteMasterContext": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "verifyGtidConsistency": { + "type": "google.protobuf.BoolValue", + "id": 2 + }, + "masterInstanceName": { + "type": "string", + "id": 3 + }, + "replicaConfiguration": { + "type": "DemoteMasterConfiguration", + "id": 4 + }, + "skipReplicationSetup": { + "type": "bool", + "id": 5 + } + } + }, + "DemoteMasterMySqlReplicaConfiguration": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "username": { + "type": "string", + "id": 2 + }, + "password": { + "type": "string", + "id": 3 + }, + "clientKey": { + "type": "string", + "id": 4 + }, + "clientCertificate": { + "type": "string", + "id": 5 + }, + "caCertificate": { + "type": "string", + "id": 6 + } + } + }, + "DemoteContext": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "sourceRepresentativeInstanceName": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "SqlFileType": { + "values": { + "SQL_FILE_TYPE_UNSPECIFIED": 0, + "SQL": 1, + "CSV": 2, + "BAK": 4, + "TDE": 8 + } + }, + "ExportContext": { + "fields": { + "uri": { + "type": "string", + "id": 1 + }, + "databases": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + }, + "sqlExportOptions": { + "type": "SqlExportOptions", + "id": 4 + }, + "csvExportOptions": { + "type": "SqlCsvExportOptions", + "id": 5 + }, + "fileType": { + "type": "SqlFileType", + "id": 6 + }, + "offload": { + "type": "google.protobuf.BoolValue", + "id": 8 + }, + "bakExportOptions": { + "type": "SqlBakExportOptions", + "id": 9 + }, + "tdeExportOptions": { + "type": "SqlTdeExportOptions", + "id": 10, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SqlCsvExportOptions": { + "fields": { + "selectQuery": { + "type": "string", + "id": 1 + }, + "escapeCharacter": { + "type": "string", + "id": 2 + }, + "quoteCharacter": { + "type": "string", + "id": 3 + }, + "fieldsTerminatedBy": { + "type": "string", + "id": 4 + }, + "linesTerminatedBy": { + "type": "string", + "id": 6 + } + } + }, + "SqlExportOptions": { + "fields": { + "tables": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "schemaOnly": { + "type": "google.protobuf.BoolValue", + "id": 2 + }, + "mysqlExportOptions": { + "type": "MysqlExportOptions", + "id": 3 + }, + "threads": { + "type": "google.protobuf.Int32Value", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "parallel": { + "type": "google.protobuf.BoolValue", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "postgresExportOptions": { + "type": "PostgresExportOptions", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "MysqlExportOptions": { + "fields": { + "masterData": { + "type": "google.protobuf.Int32Value", + "id": 1 + } + } + }, + "PostgresExportOptions": { + "fields": { + "clean": { + "type": "google.protobuf.BoolValue", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "ifExists": { + "type": "google.protobuf.BoolValue", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "SqlBakExportOptions": { + "fields": { + "striped": { + "type": "google.protobuf.BoolValue", + "id": 1 + }, + "stripeCount": { + "type": "google.protobuf.Int32Value", + "id": 2 + }, + "bakType": { + "type": "BakType", + "id": 4 + }, + "copyOnly": { + "type": "google.protobuf.BoolValue", + "id": 5, + "options": { + "deprecated": true + } + }, + "differentialBase": { + "type": "google.protobuf.BoolValue", + "id": 6 + }, + "exportLogStartTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "exportLogEndTime": { + "type": "google.protobuf.Timestamp", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlTdeExportOptions": { + "fields": { + "certificatePath": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "privateKeyPath": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "privateKeyPassword": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "name": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "FailoverContext": { + "fields": { + "settingsVersion": { + "type": "int64", + "id": 1 + }, + "kind": { + "type": "string", + "id": 2 + } + } + }, + "Flag": { + "oneofs": { + "recommendedValue": { + "oneof": [ + "recommendedStringValue", + "recommendedIntValue" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "type": { + "type": "SqlFlagType", + "id": 2 + }, + "appliesTo": { + "rule": "repeated", + "type": "SqlDatabaseVersion", + "id": 3 + }, + "allowedStringValues": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "minValue": { + "type": "google.protobuf.Int64Value", + "id": 5 + }, + "maxValue": { + "type": "google.protobuf.Int64Value", + "id": 6 + }, + "requiresRestart": { + "type": "google.protobuf.BoolValue", + "id": 7 + }, + "kind": { + "type": "string", + "id": 8 + }, + "inBeta": { + "type": "google.protobuf.BoolValue", + "id": 9 + }, + "allowedIntValues": { + "rule": "repeated", + "type": "int64", + "id": 10 + }, + "flagScope": { + "type": "SqlFlagScope", + "id": 15 + }, + "recommendedStringValue": { + "type": "string", + "id": 16 + }, + "recommendedIntValue": { + "type": "google.protobuf.Int64Value", + "id": 17 + } + } + }, + "FlagsListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "Flag", + "id": 2 + } + } + }, + "ImportContext": { + "fields": { + "uri": { + "type": "string", + "id": 1 + }, + "database": { + "type": "string", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + }, + "fileType": { + "type": "SqlFileType", + "id": 4 + }, + "csvImportOptions": { + "type": "SqlCsvImportOptions", + "id": 5 + }, + "importUser": { + "type": "string", + "id": 6 + }, + "bakImportOptions": { + "type": "SqlBakImportOptions", + "id": 7 + }, + "sqlImportOptions": { + "type": "SqlImportOptions", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "tdeImportOptions": { + "type": "SqlTdeImportOptions", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SqlImportOptions": { + "fields": { + "threads": { + "type": "google.protobuf.Int32Value", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "parallel": { + "type": "google.protobuf.BoolValue", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "postgresImportOptions": { + "type": "PostgresImportOptions", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "PostgresImportOptions": { + "fields": { + "clean": { + "type": "google.protobuf.BoolValue", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "ifExists": { + "type": "google.protobuf.BoolValue", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "SqlCsvImportOptions": { + "fields": { + "table": { + "type": "string", + "id": 1 + }, + "columns": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "escapeCharacter": { + "type": "string", + "id": 4 + }, + "quoteCharacter": { + "type": "string", + "id": 5 + }, + "fieldsTerminatedBy": { + "type": "string", + "id": 6 + }, + "linesTerminatedBy": { + "type": "string", + "id": 8 + } + } + }, + "SqlBakImportOptions": { + "fields": { + "encryptionOptions": { + "type": "EncryptionOptions", + "id": 1 + }, + "striped": { + "type": "google.protobuf.BoolValue", + "id": 2 + }, + "noRecovery": { + "type": "google.protobuf.BoolValue", + "id": 4 + }, + "recoveryOnly": { + "type": "google.protobuf.BoolValue", + "id": 5 + }, + "bakType": { + "type": "BakType", + "id": 6 + }, + "stopAt": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "stopAtMark": { + "type": "string", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "EncryptionOptions": { + "fields": { + "certPath": { + "type": "string", + "id": 1 + }, + "pvkPath": { + "type": "string", + "id": 2 + }, + "pvkPassword": { + "type": "string", + "id": 3 + }, + "keepEncrypted": { + "type": "google.protobuf.BoolValue", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "SqlTdeImportOptions": { + "fields": { + "certificatePath": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "privateKeyPath": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "privateKeyPassword": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "name": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + } + } + }, + "BakType": { + "values": { + "BAK_TYPE_UNSPECIFIED": 0, + "FULL": 1, + "DIFF": 2, + "TLOG": 3 + } + }, + "InstancesCloneRequest": { + "fields": { + "cloneContext": { + "type": "CloneContext", + "id": 1 + } + } + }, + "InstancesDemoteMasterRequest": { + "fields": { + "demoteMasterContext": { + "type": "DemoteMasterContext", + "id": 1 + } + } + }, + "InstancesDemoteRequest": { + "fields": { + "demoteContext": { + "type": "DemoteContext", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "InstancesExportRequest": { + "fields": { + "exportContext": { + "type": "ExportContext", + "id": 1 + } + } + }, + "InstancesFailoverRequest": { + "fields": { + "failoverContext": { + "type": "FailoverContext", + "id": 1 + } + } + }, + "InstancesImportRequest": { + "fields": { + "importContext": { + "type": "ImportContext", + "id": 1 + } + } + }, + "InstancesPreCheckMajorVersionUpgradeRequest": { + "fields": { + "preCheckMajorVersionUpgradeContext": { + "type": "PreCheckMajorVersionUpgradeContext", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "MySqlSyncConfig": { + "fields": { + "initialSyncFlags": { + "rule": "repeated", + "type": "SyncFlags", + "id": 1 + } + } + }, + "InstancesListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "warnings": { + "rule": "repeated", + "type": "ApiWarning", + "id": 2 + }, + "items": { + "rule": "repeated", + "type": "DatabaseInstance", + "id": 3 + }, + "nextPageToken": { + "type": "string", + "id": 4 + } + } + }, + "InstancesListServerCasResponse": { + "fields": { + "certs": { + "rule": "repeated", + "type": "SslCert", + "id": 1 + }, + "activeVersion": { + "type": "string", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + } + } + }, + "InstancesListServerCertificatesResponse": { + "fields": { + "caCerts": { + "rule": "repeated", + "type": "SslCert", + "id": 1 + }, + "serverCerts": { + "rule": "repeated", + "type": "SslCert", + "id": 2 + }, + "activeVersion": { + "type": "string", + "id": 3 + }, + "kind": { + "type": "string", + "id": 4 + } + } + }, + "InstancesListEntraIdCertificatesResponse": { + "fields": { + "certs": { + "rule": "repeated", + "type": "SslCert", + "id": 1 + }, + "activeVersion": { + "type": "string", + "id": 2 + }, + "kind": { + "type": "string", + "id": 3 + } + } + }, + "InstancesRestoreBackupRequest": { + "fields": { + "restoreBackupContext": { + "type": "RestoreBackupContext", + "id": 1 + }, + "backup": { + "type": "string", + "id": 2, + "options": { + "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" + } + }, + "backupdrBackup": { + "type": "string", + "id": 4, + "options": { + "(google.api.resource_reference).type": "backupdr.googleapis.com/Backup" + } + }, + "restoreInstanceSettings": { + "type": "DatabaseInstance", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "restoreInstanceClearOverridesFieldNames": { + "rule": "repeated", + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "InstancesRotateServerCaRequest": { + "fields": { + "rotateServerCaContext": { + "type": "RotateServerCaContext", + "id": 1 + } + } + }, + "InstancesRotateServerCertificateRequest": { + "fields": { + "rotateServerCertificateContext": { + "type": "RotateServerCertificateContext", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "InstancesRotateEntraIdCertificateRequest": { + "fields": { + "rotateEntraIdCertificateContext": { + "type": "RotateEntraIdCertificateContext", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "InstancesTruncateLogRequest": { + "fields": { + "truncateLogContext": { + "type": "TruncateLogContext", + "id": 1 + } + } + }, + "InstancesAcquireSsrsLeaseRequest": { + "fields": { + "acquireSsrsLeaseContext": { + "type": "AcquireSsrsLeaseContext", + "id": 1 + } + } + }, + "PointInTimeRestoreContext": { + "oneofs": { + "_datasource": { + "oneof": [ + "datasource" + ] + }, + "_targetInstance": { + "oneof": [ + "targetInstance" + ] + }, + "_privateNetwork": { + "oneof": [ + "privateNetwork" + ] + }, + "_allocatedIpRange": { + "oneof": [ + "allocatedIpRange" + ] + }, + "_preferredZone": { + "oneof": [ + "preferredZone" + ] + }, + "_preferredSecondaryZone": { + "oneof": [ + "preferredSecondaryZone" + ] + } + }, + "fields": { + "datasource": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "pointInTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "targetInstance": { + "type": "string", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "privateNetwork": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "allocatedIpRange": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "preferredZone": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "preferredSecondaryZone": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + } + }, + "PerformDiskShrinkContext": { + "fields": { + "targetSizeGb": { + "type": "int64", + "id": 1 + } + } + }, + "PreCheckResponse": { + "oneofs": { + "_message": { + "oneof": [ + "message" + ] + }, + "_messageType": { + "oneof": [ + "messageType" + ] + } + }, + "fields": { + "message": { + "type": "string", + "id": 2, + "options": { + "proto3_optional": true + } + }, + "messageType": { + "type": "MessageType", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "actionsRequired": { + "rule": "repeated", + "type": "string", + "id": 4 + } + }, + "nested": { + "MessageType": { + "values": { + "MESSAGE_TYPE_UNSPECIFIED": 0, + "INFO": 1, + "WARNING": 2, + "ERROR": 3 + } + } + } + }, + "PreCheckMajorVersionUpgradeContext": { + "fields": { + "targetDatabaseVersion": { + "type": "SqlDatabaseVersion", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "preCheckResponse": { + "rule": "repeated", + "type": "PreCheckResponse", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "kind": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlInstancesGetDiskShrinkConfigResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "minimalTargetSizeGb": { + "type": "int64", + "id": 2 + }, + "message": { + "type": "string", + "id": 3 + } + } + }, + "SqlInstancesVerifyExternalSyncSettingsResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "errors": { + "rule": "repeated", + "type": "SqlExternalSyncSettingError", + "id": 2 + }, + "warnings": { + "rule": "repeated", + "type": "SqlExternalSyncSettingError", + "id": 3 + } + } + }, + "SqlExternalSyncSettingError": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "type": { + "type": "SqlExternalSyncSettingErrorType", + "id": 2 + }, + "detail": { + "type": "string", + "id": 3 + } + }, + "nested": { + "SqlExternalSyncSettingErrorType": { + "values": { + "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED": 0, + "CONNECTION_FAILURE": 1, + "BINLOG_NOT_ENABLED": 2, + "INCOMPATIBLE_DATABASE_VERSION": 3, + "REPLICA_ALREADY_SETUP": 4, + "INSUFFICIENT_PRIVILEGE": 5, + "UNSUPPORTED_MIGRATION_TYPE": 6, + "NO_PGLOGICAL_INSTALLED": 7, + "PGLOGICAL_NODE_ALREADY_EXISTS": 8, + "INVALID_WAL_LEVEL": 9, + "INVALID_SHARED_PRELOAD_LIBRARY": 10, + "INSUFFICIENT_MAX_REPLICATION_SLOTS": 11, + "INSUFFICIENT_MAX_WAL_SENDERS": 12, + "INSUFFICIENT_MAX_WORKER_PROCESSES": 13, + "UNSUPPORTED_EXTENSIONS": 14, + "INVALID_RDS_LOGICAL_REPLICATION": 15, + "INVALID_LOGGING_SETUP": 16, + "INVALID_DB_PARAM": 17, + "UNSUPPORTED_GTID_MODE": 18, + "SQLSERVER_AGENT_NOT_RUNNING": 19, + "UNSUPPORTED_TABLE_DEFINITION": 20, + "UNSUPPORTED_DEFINER": 21, + "SQLSERVER_SERVERNAME_MISMATCH": 22, + "PRIMARY_ALREADY_SETUP": 23, + "UNSUPPORTED_BINLOG_FORMAT": 24, + "BINLOG_RETENTION_SETTING": 25, + "UNSUPPORTED_STORAGE_ENGINE": 26, + "LIMITED_SUPPORT_TABLES": 27, + "EXISTING_DATA_IN_REPLICA": 28, + "MISSING_OPTIONAL_PRIVILEGES": 29, + "RISKY_BACKUP_ADMIN_PRIVILEGE": 30, + "INSUFFICIENT_GCS_PERMISSIONS": 31, + "INVALID_FILE_INFO": 32, + "UNSUPPORTED_DATABASE_SETTINGS": 33, + "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE": 34, + "LOCAL_INFILE_OFF": 35, + "TURN_ON_PITR_AFTER_PROMOTE": 36, + "INCOMPATIBLE_DATABASE_MINOR_VERSION": 37, + "SOURCE_MAX_SUBSCRIPTIONS": 38, + "UNABLE_TO_VERIFY_DEFINERS": 39, + "SUBSCRIPTION_CALCULATION_STATUS": 40, + "PG_SUBSCRIPTION_COUNT": 41, + "PG_SYNC_PARALLEL_LEVEL": 42, + "INSUFFICIENT_DISK_SIZE": 43, + "INSUFFICIENT_MACHINE_TIER": 44, + "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED": 45, + "EXTENSIONS_NOT_MIGRATED": 46, + "PG_CRON_FLAG_ENABLED_IN_REPLICA": 47, + "EXTENSIONS_NOT_ENABLED_IN_REPLICA": 48, + "UNSUPPORTED_COLUMNS": 49, + "USERS_NOT_CREATED_IN_REPLICA": 50, + "UNSUPPORTED_SYSTEM_OBJECTS": 51, + "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY": 52, + "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE": 53, + "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI": 54, + "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS": 55, + "PROMPT_DELETE_EXISTING": 56, + "WILL_DELETE_EXISTING": 57, + "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE": 58 + } + } + } + }, + "IpConfiguration": { + "oneofs": { + "_pscConfig": { + "oneof": [ + "pscConfig" + ] + }, + "_serverCaMode": { + "oneof": [ + "serverCaMode" + ] + }, + "_serverCaPool": { + "oneof": [ + "serverCaPool" + ] + }, + "_serverCertificateRotationMode": { + "oneof": [ + "serverCertificateRotationMode" + ] + } + }, + "fields": { + "ipv4Enabled": { + "type": "google.protobuf.BoolValue", + "id": 1 + }, + "privateNetwork": { + "type": "string", + "id": 2 + }, + "requireSsl": { + "type": "google.protobuf.BoolValue", + "id": 3 + }, + "authorizedNetworks": { + "rule": "repeated", + "type": "AclEntry", + "id": 4 + }, + "allocatedIpRange": { + "type": "string", + "id": 6 + }, + "enablePrivatePathForGoogleCloudServices": { + "type": "google.protobuf.BoolValue", + "id": 7 + }, + "sslMode": { + "type": "SslMode", + "id": 8 + }, + "pscConfig": { + "type": "PscConfig", + "id": 9, + "options": { + "proto3_optional": true + } + }, + "serverCaMode": { + "type": "CaMode", + "id": 10, + "options": { + "proto3_optional": true + } + }, + "customSubjectAlternativeNames": { + "rule": "repeated", + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "serverCaPool": { + "type": "string", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "serverCertificateRotationMode": { + "type": "ServerCertificateRotationMode", + "id": 16, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + }, + "nested": { + "SslMode": { + "values": { + "SSL_MODE_UNSPECIFIED": 0, + "ALLOW_UNENCRYPTED_AND_ENCRYPTED": 1, + "ENCRYPTED_ONLY": 2, + "TRUSTED_CLIENT_CERTIFICATE_REQUIRED": 3 + } + }, + "CaMode": { + "values": { + "CA_MODE_UNSPECIFIED": 0, + "GOOGLE_MANAGED_INTERNAL_CA": 1, + "GOOGLE_MANAGED_CAS_CA": 2, + "CUSTOMER_MANAGED_CAS_CA": 3 + } + }, + "ServerCertificateRotationMode": { + "values": { + "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED": 0, + "NO_AUTOMATIC_ROTATION": 1, + "AUTOMATIC_ROTATION_DURING_MAINTENANCE": 2 + } + } + } + }, + "PscConfig": { + "oneofs": { + "_pscEnabled": { + "oneof": [ + "pscEnabled" + ] + } + }, + "fields": { + "pscEnabled": { + "type": "bool", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "allowedConsumerProjects": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "pscAutoConnections": { + "rule": "repeated", + "type": "PscAutoConnectionConfig", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "networkAttachmentUri": { + "type": "string", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "PscAutoConnectionConfig": { + "oneofs": { + "_ipAddress": { + "oneof": [ + "ipAddress" + ] + }, + "_status": { + "oneof": [ + "status" + ] + }, + "_consumerNetworkStatus": { + "oneof": [ + "consumerNetworkStatus" + ] + } + }, + "fields": { + "consumerProject": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "consumerNetwork": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "ipAddress": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_info).format": "IPV4_OR_IPV6", + "proto3_optional": true + } + }, + "status": { + "type": "string", + "id": 4, + "options": { + "proto3_optional": true + } + }, + "consumerNetworkStatus": { + "type": "string", + "id": 5, + "options": { + "proto3_optional": true + } + } + } + }, + "IpMapping": { + "fields": { + "type": { + "type": "SqlIpAddressType", + "id": 1 + }, + "ipAddress": { + "type": "string", + "id": 2 + }, + "timeToRetire": { + "type": "google.protobuf.Timestamp", + "id": 3 + } + } + }, + "LocationPreference": { + "fields": { + "followGaeApplication": { + "type": "string", + "id": 1, + "options": { + "deprecated": true + } + }, + "zone": { + "type": "string", + "id": 2 + }, + "secondaryZone": { + "type": "string", + "id": 4 + }, + "kind": { + "type": "string", + "id": 3 + } + } + }, + "MaintenanceWindow": { + "fields": { + "hour": { + "type": "google.protobuf.Int32Value", + "id": 1 + }, + "day": { + "type": "google.protobuf.Int32Value", + "id": 2 + }, + "updateTrack": { + "type": "SqlUpdateTrack", + "id": 3 + }, + "kind": { + "type": "string", + "id": 4 + } + } + }, + "DenyMaintenancePeriod": { + "fields": { + "startDate": { + "type": "string", + "id": 1 + }, + "endDate": { + "type": "string", + "id": 2 + }, + "time": { + "type": "string", + "id": 3 + } + } + }, + "InsightsConfig": { + "fields": { + "queryInsightsEnabled": { + "type": "bool", + "id": 1 + }, + "recordClientAddress": { + "type": "bool", + "id": 2 + }, + "recordApplicationTags": { + "type": "bool", + "id": 3 + }, + "queryStringLength": { + "type": "google.protobuf.Int32Value", + "id": 4 + }, + "queryPlansPerMinute": { + "type": "google.protobuf.Int32Value", + "id": 5 + }, + "enhancedQueryInsightsEnabled": { + "type": "google.protobuf.BoolValue", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "MySqlReplicaConfiguration": { + "fields": { + "dumpFilePath": { + "type": "string", + "id": 1 + }, + "username": { + "type": "string", + "id": 2 + }, + "password": { + "type": "string", + "id": 3 + }, + "connectRetryInterval": { + "type": "google.protobuf.Int32Value", + "id": 4 + }, + "masterHeartbeatPeriod": { + "type": "google.protobuf.Int64Value", + "id": 5 + }, + "caCertificate": { + "type": "string", + "id": 6 + }, + "clientCertificate": { + "type": "string", + "id": 7 + }, + "clientKey": { + "type": "string", + "id": 8 + }, + "sslCipher": { + "type": "string", + "id": 9 + }, + "verifyServerCertificate": { + "type": "google.protobuf.BoolValue", + "id": 10 + }, + "kind": { + "type": "string", + "id": 11 + } + } + }, + "SelectedObjects": { + "fields": { + "database": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "OnPremisesConfiguration": { + "fields": { + "hostPort": { + "type": "string", + "id": 1 + }, + "kind": { + "type": "string", + "id": 2 + }, + "username": { + "type": "string", + "id": 3 + }, + "password": { + "type": "string", + "id": 4 + }, + "caCertificate": { + "type": "string", + "id": 5 + }, + "clientCertificate": { + "type": "string", + "id": 6 + }, + "clientKey": { + "type": "string", + "id": 7 + }, + "dumpFilePath": { + "type": "string", + "id": 8 + }, + "sourceInstance": { + "type": "InstanceReference", + "id": 15 + }, + "selectedObjects": { + "rule": "repeated", + "type": "SelectedObjects", + "id": 16, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "sslOption": { + "type": "SslOption", + "id": 18, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SslOption": { + "values": { + "SSL_OPTION_UNSPECIFIED": 0, + "DISABLE": 1, + "REQUIRE": 2, + "VERIFY_CA": 3 + } + } + } + }, + "DiskEncryptionConfiguration": { + "fields": { + "kmsKeyName": { + "type": "string", + "id": 1 + }, + "kind": { + "type": "string", + "id": 2 + } + } + }, + "DiskEncryptionStatus": { + "fields": { + "kmsKeyVersionName": { + "type": "string", + "id": 1 + }, + "kind": { + "type": "string", + "id": 2 + } + } + }, + "SqlMaintenanceType": { + "values": { + "SQL_MAINTENANCE_TYPE_UNSPECIFIED": 0, + "INSTANCE_MAINTENANCE": 1, + "REPLICA_INCLUDED_MAINTENANCE": 2, + "INSTANCE_SELF_SERVICE_MAINTENANCE": 3, + "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE": 4 + } + }, + "SqlSubOperationType": { + "oneofs": { + "subOperationDetails": { + "oneof": [ + "maintenanceType" + ] + } + }, + "fields": { + "maintenanceType": { + "type": "SqlMaintenanceType", + "id": 1 + } + } + }, + "Operation": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "targetLink": { + "type": "string", + "id": 2 + }, + "status": { + "type": "SqlOperationStatus", + "id": 3 + }, + "user": { + "type": "string", + "id": 4 + }, + "insertTime": { + "type": "google.protobuf.Timestamp", + "id": 5 + }, + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 7 + }, + "error": { + "type": "OperationErrors", + "id": 8 + }, + "apiWarning": { + "type": "ApiWarning", + "id": 19 + }, + "operationType": { + "type": "SqlOperationType", + "id": 9 + }, + "importContext": { + "type": "ImportContext", + "id": 10 + }, + "exportContext": { + "type": "ExportContext", + "id": 11 + }, + "backupContext": { + "type": "BackupContext", + "id": 17 + }, + "preCheckMajorVersionUpgradeContext": { + "type": "PreCheckMajorVersionUpgradeContext", + "id": 50 + }, + "name": { + "type": "string", + "id": 12 + }, + "targetId": { + "type": "string", + "id": 13 + }, + "selfLink": { + "type": "string", + "id": 14 + }, + "targetProject": { + "type": "string", + "id": 15 + }, + "acquireSsrsLeaseContext": { + "type": "AcquireSsrsLeaseContext", + "id": 20 + }, + "subOperationType": { + "type": "SqlSubOperationType", + "id": 48, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SqlOperationType": { + "valuesOptions": { + "BACKUP": { + "deprecated": true + }, + "SNAPSHOT": { + "deprecated": true + }, + "ENABLE_PRIVATE_IP": { + "deprecated": true + }, + "DEFER_MAINTENANCE": { + "deprecated": true + }, + "CREATE_CLONE": { + "deprecated": true + }, + "CLUSTER_MAINTENANCE": { + "deprecated": true + }, + "SELF_SERVICE_MAINTENANCE": { + "deprecated": true + }, + "ADVANCED_BACKUP": { + "deprecated": true + } + }, + "values": { + "SQL_OPERATION_TYPE_UNSPECIFIED": 0, + "IMPORT": 1, + "EXPORT": 2, + "CREATE": 3, + "UPDATE": 4, + "DELETE": 5, + "RESTART": 6, + "BACKUP": 7, + "SNAPSHOT": 8, + "BACKUP_VOLUME": 9, + "DELETE_VOLUME": 10, + "RESTORE_VOLUME": 11, + "INJECT_USER": 12, + "CLONE": 14, + "STOP_REPLICA": 15, + "START_REPLICA": 16, + "PROMOTE_REPLICA": 17, + "CREATE_REPLICA": 18, + "CREATE_USER": 19, + "DELETE_USER": 20, + "UPDATE_USER": 21, + "CREATE_DATABASE": 22, + "DELETE_DATABASE": 23, + "UPDATE_DATABASE": 24, + "FAILOVER": 25, + "DELETE_BACKUP": 26, + "RECREATE_REPLICA": 27, + "TRUNCATE_LOG": 28, + "DEMOTE_MASTER": 29, + "MAINTENANCE": 30, + "ENABLE_PRIVATE_IP": 31, + "DEFER_MAINTENANCE": 32, + "CREATE_CLONE": 33, + "RESCHEDULE_MAINTENANCE": 34, + "START_EXTERNAL_SYNC": 35, + "LOG_CLEANUP": 36, + "AUTO_RESTART": 37, + "REENCRYPT": 38, + "SWITCHOVER": 39, + "UPDATE_BACKUP": 40, + "ACQUIRE_SSRS_LEASE": 42, + "RELEASE_SSRS_LEASE": 43, + "RECONFIGURE_OLD_PRIMARY": 44, + "CLUSTER_MAINTENANCE": 45, + "SELF_SERVICE_MAINTENANCE": 46, + "SWITCHOVER_TO_REPLICA": 47, + "MAJOR_VERSION_UPGRADE": 48, + "ADVANCED_BACKUP": 49, + "MANAGE_BACKUP": 50, + "ENHANCED_BACKUP": 51, + "REPAIR_READ_POOL": 52, + "CREATE_READ_POOL": 53 + } + }, + "SqlOperationStatus": { + "values": { + "SQL_OPERATION_STATUS_UNSPECIFIED": 0, + "PENDING": 1, + "RUNNING": 2, + "DONE": 3 + } + } + } + }, + "OperationError": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "code": { + "type": "string", + "id": 2 + }, + "message": { + "type": "string", + "id": 3 + } + } + }, + "OperationErrors": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "errors": { + "rule": "repeated", + "type": "OperationError", + "id": 2 + } + } + }, + "PasswordValidationPolicy": { + "fields": { + "minLength": { + "type": "google.protobuf.Int32Value", + "id": 1 + }, + "complexity": { + "type": "Complexity", + "id": 2 + }, + "reuseInterval": { + "type": "google.protobuf.Int32Value", + "id": 3 + }, + "disallowUsernameSubstring": { + "type": "google.protobuf.BoolValue", + "id": 4 + }, + "passwordChangeInterval": { + "type": "google.protobuf.Duration", + "id": 5 + }, + "enablePasswordPolicy": { + "type": "google.protobuf.BoolValue", + "id": 6 + }, + "disallowCompromisedCredentials": { + "type": "google.protobuf.BoolValue", + "id": 7, + "options": { + "deprecated": true + } + } + }, + "nested": { + "Complexity": { + "values": { + "COMPLEXITY_UNSPECIFIED": 0, + "COMPLEXITY_DEFAULT": 1 + } + } + } + }, + "OperationsListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "Operation", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3 + } + } + }, + "ReplicaConfiguration": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "mysqlReplicaConfiguration": { + "type": "MySqlReplicaConfiguration", + "id": 2 + }, + "failoverTarget": { + "type": "google.protobuf.BoolValue", + "id": 3 + }, + "cascadableReplica": { + "type": "google.protobuf.BoolValue", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "RestoreBackupContext": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "backupRunId": { + "type": "int64", + "id": 2 + }, + "instanceId": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + } + } + }, + "RotateServerCaContext": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "nextVersion": { + "type": "string", + "id": 2 + } + } + }, + "RotateServerCertificateContext": { + "fields": { + "kind": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "nextVersion": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "RotateEntraIdCertificateContext": { + "fields": { + "kind": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "nextVersion": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "DataCacheConfig": { + "fields": { + "dataCacheEnabled": { + "type": "bool", + "id": 1 + } + } + }, + "FinalBackupConfig": { + "oneofs": { + "_enabled": { + "oneof": [ + "enabled" + ] + }, + "_retentionDays": { + "oneof": [ + "retentionDays" + ] + } + }, + "fields": { + "enabled": { + "type": "bool", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "retentionDays": { + "type": "int32", + "id": 3, + "options": { + "proto3_optional": true + } + } + } + }, + "Settings": { + "oneofs": { + "_dataDiskProvisionedIops": { + "oneof": [ + "dataDiskProvisionedIops" + ] + }, + "_dataDiskProvisionedThroughput": { + "oneof": [ + "dataDiskProvisionedThroughput" + ] + }, + "_connectionPoolConfig": { + "oneof": [ + "connectionPoolConfig" + ] + }, + "_finalBackupConfig": { + "oneof": [ + "finalBackupConfig" + ] + }, + "_readPoolAutoScaleConfig": { + "oneof": [ + "readPoolAutoScaleConfig" + ] + }, + "_autoUpgradeEnabled": { + "oneof": [ + "autoUpgradeEnabled" + ] + }, + "_dataApiAccess": { + "oneof": [ + "dataApiAccess" + ] + } + }, + "fields": { + "settingsVersion": { + "type": "google.protobuf.Int64Value", + "id": 1 + }, + "authorizedGaeApplications": { + "rule": "repeated", + "type": "string", + "id": 2, + "options": { + "deprecated": true + } + }, + "tier": { + "type": "string", + "id": 3 + }, + "kind": { + "type": "string", + "id": 4 + }, + "userLabels": { + "keyType": "string", + "type": "string", + "id": 5 + }, + "availabilityType": { + "type": "SqlAvailabilityType", + "id": 6 + }, + "pricingPlan": { + "type": "SqlPricingPlan", + "id": 7 + }, + "replicationType": { + "type": "SqlReplicationType", + "id": 8, + "options": { + "deprecated": true + } + }, + "storageAutoResizeLimit": { + "type": "google.protobuf.Int64Value", + "id": 9 + }, + "activationPolicy": { + "type": "SqlActivationPolicy", + "id": 10 + }, + "ipConfiguration": { + "type": "IpConfiguration", + "id": 11 + }, + "storageAutoResize": { + "type": "google.protobuf.BoolValue", + "id": 12 + }, + "locationPreference": { + "type": "LocationPreference", + "id": 13 + }, + "databaseFlags": { + "rule": "repeated", + "type": "DatabaseFlags", + "id": 14 + }, + "dataDiskType": { + "type": "SqlDataDiskType", + "id": 15 + }, + "maintenanceWindow": { + "type": "MaintenanceWindow", + "id": 16 + }, + "backupConfiguration": { + "type": "BackupConfiguration", + "id": 17 + }, + "databaseReplicationEnabled": { + "type": "google.protobuf.BoolValue", + "id": 18 + }, + "crashSafeReplicationEnabled": { + "type": "google.protobuf.BoolValue", + "id": 19, + "options": { + "deprecated": true + } + }, + "dataDiskSizeGb": { + "type": "google.protobuf.Int64Value", + "id": 20 + }, + "activeDirectoryConfig": { + "type": "SqlActiveDirectoryConfig", + "id": 22 + }, + "collation": { + "type": "string", + "id": 23 + }, + "denyMaintenancePeriods": { + "rule": "repeated", + "type": "DenyMaintenancePeriod", + "id": 24 + }, + "insightsConfig": { + "type": "InsightsConfig", + "id": 25 + }, + "passwordValidationPolicy": { + "type": "PasswordValidationPolicy", + "id": 27 + }, + "sqlServerAuditConfig": { + "type": "SqlServerAuditConfig", + "id": 29 + }, + "edition": { + "type": "Edition", + "id": 38, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "connectorEnforcement": { + "type": "ConnectorEnforcement", + "id": 32 + }, + "deletionProtectionEnabled": { + "type": "google.protobuf.BoolValue", + "id": 33 + }, + "timeZone": { + "type": "string", + "id": 34 + }, + "advancedMachineFeatures": { + "type": "AdvancedMachineFeatures", + "id": 35 + }, + "dataCacheConfig": { + "type": "DataCacheConfig", + "id": 37 + }, + "replicationLagMaxSeconds": { + "type": "google.protobuf.Int32Value", + "id": 39, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "enableGoogleMlIntegration": { + "type": "google.protobuf.BoolValue", + "id": 40, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "enableDataplexIntegration": { + "type": "google.protobuf.BoolValue", + "id": 41, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "retainBackupsOnDelete": { + "type": "google.protobuf.BoolValue", + "id": 42, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "dataDiskProvisionedIops": { + "type": "int64", + "id": 43, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "dataDiskProvisionedThroughput": { + "type": "int64", + "id": 44, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "connectionPoolConfig": { + "type": "ConnectionPoolConfig", + "id": 45, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "finalBackupConfig": { + "type": "FinalBackupConfig", + "id": 47, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "readPoolAutoScaleConfig": { + "type": "ReadPoolAutoScaleConfig", + "id": 48, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "autoUpgradeEnabled": { + "type": "bool", + "id": 50, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "entraidConfig": { + "type": "SqlServerEntraIdConfig", + "id": 52, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "dataApiAccess": { + "type": "DataApiAccess", + "id": 53, + "options": { + "proto3_optional": true + } + }, + "performanceCaptureConfig": { + "type": "PerformanceCaptureConfig", + "id": 54, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SqlActivationPolicy": { + "valuesOptions": { + "ON_DEMAND": { + "deprecated": true + } + }, + "values": { + "SQL_ACTIVATION_POLICY_UNSPECIFIED": 0, + "ALWAYS": 1, + "NEVER": 2, + "ON_DEMAND": 3 + } + }, + "Edition": { + "values": { + "EDITION_UNSPECIFIED": 0, + "ENTERPRISE": 2, + "ENTERPRISE_PLUS": 3 + } + }, + "ConnectorEnforcement": { + "values": { + "CONNECTOR_ENFORCEMENT_UNSPECIFIED": 0, + "NOT_REQUIRED": 1, + "REQUIRED": 2 + } + }, + "DataApiAccess": { + "values": { + "DATA_API_ACCESS_UNSPECIFIED": 0, + "DISALLOW_DATA_API": 1, + "ALLOW_DATA_API": 2 + } + } + } + }, + "PerformanceCaptureConfig": { + "oneofs": { + "_enabled": { + "oneof": [ + "enabled" + ] + }, + "_probingIntervalSeconds": { + "oneof": [ + "probingIntervalSeconds" + ] + }, + "_probeThreshold": { + "oneof": [ + "probeThreshold" + ] + }, + "_runningThreadsThreshold": { + "oneof": [ + "runningThreadsThreshold" + ] + }, + "_secondsBehindSourceThreshold": { + "oneof": [ + "secondsBehindSourceThreshold" + ] + }, + "_transactionDurationThreshold": { + "oneof": [ + "transactionDurationThreshold" + ] + } + }, + "fields": { + "enabled": { + "type": "bool", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "probingIntervalSeconds": { + "type": "int32", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "probeThreshold": { + "type": "int32", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "runningThreadsThreshold": { + "type": "int32", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "secondsBehindSourceThreshold": { + "type": "int32", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "transactionDurationThreshold": { + "type": "int32", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + } + } + }, + "AdvancedMachineFeatures": { + "fields": { + "threadsPerCore": { + "type": "int32", + "id": 1 + } + } + }, + "SslCert": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "certSerialNumber": { + "type": "string", + "id": 2 + }, + "cert": { + "type": "string", + "id": 3 + }, + "createTime": { + "type": "google.protobuf.Timestamp", + "id": 4 + }, + "commonName": { + "type": "string", + "id": 5 + }, + "expirationTime": { + "type": "google.protobuf.Timestamp", + "id": 6 + }, + "sha1Fingerprint": { + "type": "string", + "id": 7 + }, + "instance": { + "type": "string", + "id": 8 + }, + "selfLink": { + "type": "string", + "id": 9 + } + } + }, + "SslCertDetail": { + "fields": { + "certInfo": { + "type": "SslCert", + "id": 1 + }, + "certPrivateKey": { + "type": "string", + "id": 2 + } + } + }, + "SslCertsCreateEphemeralRequest": { + "fields": { + "publicKey": { + "type": "string", + "id": 1, + "options": { + "json_name": "public_key" + } + }, + "accessToken": { + "type": "string", + "id": 2, + "options": { + "json_name": "access_token" + } + } + } + }, + "SslCertsInsertRequest": { + "fields": { + "commonName": { + "type": "string", + "id": 1 + } + } + }, + "SqlInstancesRescheduleMaintenanceRequestBody": { + "fields": { + "reschedule": { + "type": "Reschedule", + "id": 3 + } + }, + "nested": { + "RescheduleType": { + "values": { + "RESCHEDULE_TYPE_UNSPECIFIED": 0, + "IMMEDIATE": 1, + "NEXT_AVAILABLE_WINDOW": 2, + "SPECIFIC_TIME": 3 + } + }, + "Reschedule": { + "fields": { + "rescheduleType": { + "type": "RescheduleType", + "id": 1 + }, + "scheduleTime": { + "type": "google.protobuf.Timestamp", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + } + } + }, + "SslCertsInsertResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "operation": { + "type": "Operation", + "id": 2 + }, + "serverCaCert": { + "type": "SslCert", + "id": 3 + }, + "clientCert": { + "type": "SslCertDetail", + "id": 4 + } + } + }, + "SslCertsListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "SslCert", + "id": 2 + } + } + }, + "TruncateLogContext": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "logType": { + "type": "string", + "id": 2 + } + } + }, + "SqlActiveDirectoryConfig": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "domain": { + "type": "string", + "id": 2 + }, + "mode": { + "type": "ActiveDirectoryMode", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "dnsServers": { + "rule": "repeated", + "type": "string", + "id": 4, + "options": { + "(google.api.field_info).format": "IPV4", + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "adminCredentialSecretName": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "organizationalUnit": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "ActiveDirectoryMode": { + "valuesOptions": { + "SELF_MANAGED_ACTIVE_DIRECTORY": { + "deprecated": true + } + }, + "values": { + "ACTIVE_DIRECTORY_MODE_UNSPECIFIED": 0, + "MANAGED_ACTIVE_DIRECTORY": 1, + "SELF_MANAGED_ACTIVE_DIRECTORY": 2, + "CUSTOMER_MANAGED_ACTIVE_DIRECTORY": 3 + } + } + } + }, + "SqlServerAuditConfig": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "bucket": { + "type": "string", + "id": 2 + }, + "retentionInterval": { + "type": "google.protobuf.Duration", + "id": 3 + }, + "uploadInterval": { + "type": "google.protobuf.Duration", + "id": 4 + } + } + }, + "SqlServerEntraIdConfig": { + "fields": { + "kind": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "tenantId": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "applicationId": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "SqlBackupRunStatus": { + "values": { + "SQL_BACKUP_RUN_STATUS_UNSPECIFIED": 0, + "ENQUEUED": 1, + "OVERDUE": 2, + "RUNNING": 3, + "FAILED": 4, + "SUCCESSFUL": 5, + "SKIPPED": 6, + "DELETION_PENDING": 7, + "DELETION_FAILED": 8, + "DELETED": 9 + } + }, + "SqlBackupRunType": { + "values": { + "SQL_BACKUP_RUN_TYPE_UNSPECIFIED": 0, + "AUTOMATED": 1, + "ON_DEMAND": 2 + } + }, + "SqlBackupKind": { + "values": { + "SQL_BACKUP_KIND_UNSPECIFIED": 0, + "SNAPSHOT": 1, + "PHYSICAL": 2 + } + }, + "SqlBackendType": { + "valuesOptions": { + "FIRST_GEN": { + "deprecated": true + } + }, + "values": { + "SQL_BACKEND_TYPE_UNSPECIFIED": 0, + "FIRST_GEN": 1, + "SECOND_GEN": 2, + "EXTERNAL": 3 + } + }, + "SqlIpAddressType": { + "values": { + "SQL_IP_ADDRESS_TYPE_UNSPECIFIED": 0, + "PRIMARY": 1, + "OUTGOING": 2, + "PRIVATE": 3, + "MIGRATED_1ST_GEN": 4 + } + }, + "SqlInstanceType": { + "values": { + "SQL_INSTANCE_TYPE_UNSPECIFIED": 0, + "CLOUD_SQL_INSTANCE": 1, + "ON_PREMISES_INSTANCE": 2, + "READ_REPLICA_INSTANCE": 3, + "READ_POOL_INSTANCE": 5 + } + }, + "ConnectionPoolFlags": { + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + }, + "value": { + "type": "string", + "id": 2, + "options": { + "(google.api.field_behavior)": "REQUIRED" + } + } + } + }, + "ReadPoolAutoScaleConfig": { + "oneofs": { + "_enabled": { + "oneof": [ + "enabled" + ] + }, + "_minNodeCount": { + "oneof": [ + "minNodeCount" + ] + }, + "_maxNodeCount": { + "oneof": [ + "maxNodeCount" + ] + }, + "_disableScaleIn": { + "oneof": [ + "disableScaleIn" + ] + }, + "_scaleInCooldownSeconds": { + "oneof": [ + "scaleInCooldownSeconds" + ] + }, + "_scaleOutCooldownSeconds": { + "oneof": [ + "scaleOutCooldownSeconds" + ] + } + }, + "fields": { + "enabled": { + "type": "bool", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "minNodeCount": { + "type": "int32", + "id": 2, + "options": { + "proto3_optional": true + } + }, + "maxNodeCount": { + "type": "int32", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "targetMetrics": { + "rule": "repeated", + "type": "TargetMetric", + "id": 4, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "disableScaleIn": { + "type": "bool", + "id": 5, + "options": { + "proto3_optional": true + } + }, + "scaleInCooldownSeconds": { + "type": "int32", + "id": 6, + "options": { + "proto3_optional": true + } + }, + "scaleOutCooldownSeconds": { + "type": "int32", + "id": 7, + "options": { + "proto3_optional": true + } + } + }, + "nested": { + "TargetMetric": { + "oneofs": { + "_metric": { + "oneof": [ + "metric" + ] + }, + "_targetValue": { + "oneof": [ + "targetValue" + ] + } + }, + "fields": { + "metric": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "targetValue": { + "type": "float", + "id": 2, + "options": { + "proto3_optional": true + } + } + } + } + } + }, + "ConnectionPoolConfig": { + "oneofs": { + "_connectionPoolingEnabled": { + "oneof": [ + "connectionPoolingEnabled" + ] + }, + "_poolerCount": { + "oneof": [ + "poolerCount" + ] + } + }, + "fields": { + "connectionPoolingEnabled": { + "type": "bool", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "flags": { + "rule": "repeated", + "type": "ConnectionPoolFlags", + "id": 8, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "poolerCount": { + "type": "int32", + "id": 9, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + } + } + }, + "SqlDatabaseVersion": { + "valuesOptions": { + "MYSQL_5_1": { + "deprecated": true + }, + "MYSQL_5_5": { + "deprecated": true + }, + "MYSQL_8_0_29": { + "deprecated": true + } + }, + "values": { + "SQL_DATABASE_VERSION_UNSPECIFIED": 0, + "MYSQL_5_1": 2, + "MYSQL_5_5": 3, + "MYSQL_5_6": 5, + "MYSQL_5_7": 6, + "MYSQL_8_0": 20, + "MYSQL_8_0_18": 41, + "MYSQL_8_0_26": 85, + "MYSQL_8_0_27": 111, + "MYSQL_8_0_28": 132, + "MYSQL_8_0_29": 148, + "MYSQL_8_0_30": 174, + "MYSQL_8_0_31": 197, + "MYSQL_8_0_32": 213, + "MYSQL_8_0_33": 238, + "MYSQL_8_0_34": 239, + "MYSQL_8_0_35": 240, + "MYSQL_8_0_36": 241, + "MYSQL_8_0_37": 355, + "MYSQL_8_0_39": 357, + "MYSQL_8_0_40": 358, + "MYSQL_8_0_41": 488, + "MYSQL_8_0_42": 489, + "MYSQL_8_0_43": 553, + "MYSQL_8_0_44": 554, + "MYSQL_8_0_45": 555, + "MYSQL_8_0_46": 556, + "MYSQL_8_4": 398, + "MYSQL_9_7": 654, + "SQLSERVER_2017_STANDARD": 11, + "SQLSERVER_2017_ENTERPRISE": 14, + "SQLSERVER_2017_EXPRESS": 15, + "SQLSERVER_2017_WEB": 16, + "POSTGRES_9_6": 9, + "POSTGRES_10": 18, + "POSTGRES_11": 10, + "POSTGRES_12": 19, + "POSTGRES_13": 23, + "POSTGRES_14": 110, + "POSTGRES_15": 172, + "POSTGRES_16": 272, + "POSTGRES_17": 408, + "POSTGRES_18": 557, + "SQLSERVER_2019_STANDARD": 26, + "SQLSERVER_2019_ENTERPRISE": 27, + "SQLSERVER_2019_EXPRESS": 28, + "SQLSERVER_2019_WEB": 29, + "SQLSERVER_2022_STANDARD": 199, + "SQLSERVER_2022_ENTERPRISE": 200, + "SQLSERVER_2022_EXPRESS": 201, + "SQLSERVER_2022_WEB": 202 + } + }, + "SqlSuspensionReason": { + "values": { + "SQL_SUSPENSION_REASON_UNSPECIFIED": 0, + "BILLING_ISSUE": 2, + "LEGAL_ISSUE": 3, + "OPERATIONAL_ISSUE": 4, + "KMS_KEY_ISSUE": 5 + } + }, + "SqlPricingPlan": { + "values": { + "SQL_PRICING_PLAN_UNSPECIFIED": 0, + "PACKAGE": 1, + "PER_USE": 2 + } + }, + "SqlReplicationType": { + "values": { + "SQL_REPLICATION_TYPE_UNSPECIFIED": 0, + "SYNCHRONOUS": 1, + "ASYNCHRONOUS": 2 + } + }, + "SqlDataDiskType": { + "valuesOptions": { + "OBSOLETE_LOCAL_SSD": { + "deprecated": true + } + }, + "values": { + "SQL_DATA_DISK_TYPE_UNSPECIFIED": 0, + "PD_SSD": 1, + "PD_HDD": 2, + "OBSOLETE_LOCAL_SSD": 3, + "HYPERDISK_BALANCED": 4 + } + }, + "SqlAvailabilityType": { + "values": { + "SQL_AVAILABILITY_TYPE_UNSPECIFIED": 0, + "ZONAL": 1, + "REGIONAL": 2 + } + }, + "SqlUpdateTrack": { + "values": { + "SQL_UPDATE_TRACK_UNSPECIFIED": 0, + "canary": 1, + "stable": 2, + "week5": 3 + } + }, + "AcquireSsrsLeaseContext": { + "oneofs": { + "_setupLogin": { + "oneof": [ + "setupLogin" + ] + }, + "_serviceLogin": { + "oneof": [ + "serviceLogin" + ] + }, + "_reportDatabase": { + "oneof": [ + "reportDatabase" + ] + }, + "_duration": { + "oneof": [ + "duration" + ] + } + }, + "fields": { + "setupLogin": { + "type": "string", + "id": 1, + "options": { + "proto3_optional": true + } + }, + "serviceLogin": { + "type": "string", + "id": 2, + "options": { + "proto3_optional": true + } + }, + "reportDatabase": { + "type": "string", + "id": 3, + "options": { + "proto3_optional": true + } + }, + "duration": { + "type": "google.protobuf.Duration", + "id": 4, + "options": { + "proto3_optional": true + } + } + } + }, + "SqlFlagType": { + "values": { + "SQL_FLAG_TYPE_UNSPECIFIED": 0, + "BOOLEAN": 1, + "STRING": 2, + "INTEGER": 3, + "NONE": 4, + "MYSQL_TIMEZONE_OFFSET": 5, + "FLOAT": 6, + "REPEATED_STRING": 7 + } + }, + "SqlFlagScope": { + "values": { + "SQL_FLAG_SCOPE_UNSPECIFIED": 0, + "SQL_FLAG_SCOPE_DATABASE": 1, + "SQL_FLAG_SCOPE_CONNECTION_POOL": 2 + } + }, + "SqlConnectService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "GetConnectSettings": { + "requestType": "GetConnectSettingsRequest", + "responseType": "ConnectSettings", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/connectSettings" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/connectSettings" + } + } + ] + }, + "GenerateEphemeralCert": { + "requestType": "GenerateEphemeralCertRequest", + "responseType": "GenerateEphemeralCertResponse", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}:generateEphemeralCert", + "(google.api.http).body": "*" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}:generateEphemeralCert", + "body": "*" + } + } + ] + } + } + }, + "GetConnectSettingsRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "ConnectSettings": { + "oneofs": { + "_nodeCount": { + "oneof": [ + "nodeCount" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "serverCaCert": { + "type": "SslCert", + "id": 2 + }, + "ipAddresses": { + "rule": "repeated", + "type": "IpMapping", + "id": 3 + }, + "region": { + "type": "string", + "id": 4 + }, + "databaseVersion": { + "type": "SqlDatabaseVersion", + "id": 31 + }, + "backendType": { + "type": "SqlBackendType", + "id": 32 + }, + "pscEnabled": { + "type": "bool", + "id": 33 + }, + "dnsName": { + "type": "string", + "id": 34 + }, + "serverCaMode": { + "type": "CaMode", + "id": 35 + }, + "customSubjectAlternativeNames": { + "rule": "repeated", + "type": "string", + "id": 37 + }, + "dnsNames": { + "rule": "repeated", + "type": "DnsNameMapping", + "id": 38, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "nodeCount": { + "type": "int32", + "id": 63, + "options": { + "proto3_optional": true + } + }, + "nodes": { + "rule": "repeated", + "type": "ConnectPoolNodeConfig", + "id": 64, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "mdxProtocolSupport": { + "rule": "repeated", + "type": "MdxProtocolSupport", + "id": 39, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "CaMode": { + "values": { + "CA_MODE_UNSPECIFIED": 0, + "GOOGLE_MANAGED_INTERNAL_CA": 1, + "GOOGLE_MANAGED_CAS_CA": 2, + "CUSTOMER_MANAGED_CAS_CA": 3 + } + }, + "ConnectPoolNodeConfig": { + "oneofs": { + "_name": { + "oneof": [ + "name" + ] + }, + "_dnsName": { + "oneof": [ + "dnsName" + ] + } + }, + "fields": { + "name": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "ipAddresses": { + "rule": "repeated", + "type": "IpMapping", + "id": 2, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "dnsName": { + "type": "string", + "id": 3, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY", + "proto3_optional": true + } + }, + "dnsNames": { + "rule": "repeated", + "type": "DnsNameMapping", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + } + } + }, + "MdxProtocolSupport": { + "values": { + "MDX_PROTOCOL_SUPPORT_UNSPECIFIED": 0, + "CLIENT_PROTOCOL_TYPE": 1 + } + } + } + }, + "GenerateEphemeralCertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "publicKey": { + "type": "string", + "id": 3, + "options": { + "json_name": "public_key" + } + }, + "accessToken": { + "type": "string", + "id": 4, + "options": { + "json_name": "access_token", + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "readTime": { + "type": "google.protobuf.Timestamp", + "id": 7, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "validDuration": { + "type": "google.protobuf.Duration", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + } + }, + "GenerateEphemeralCertResponse": { + "fields": { + "ephemeralCert": { + "type": "SslCert", + "id": 1 + } + } + }, + "SqlIamPoliciesService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com" + }, + "methods": {} + }, + "SqlTiersService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "List": { + "requestType": "SqlTiersListRequest", + "responseType": "TiersListResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/tiers" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/tiers" + } + } + ] + } + } + }, + "SqlTiersListRequest": { + "fields": { + "project": { + "type": "string", + "id": 1 + } + } + }, + "TiersListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "Tier", + "id": 2 + } + } + }, + "Tier": { + "fields": { + "tier": { + "type": "string", + "id": 1 + }, + "RAM": { + "type": "int64", + "id": 2, + "options": { + "json_name": "RAM" + } + }, + "kind": { + "type": "string", + "id": 3 + }, + "Disk_Quota": { + "type": "int64", + "id": 4, + "options": { + "json_name": "DiskQuota" + } + }, + "region": { + "rule": "repeated", + "type": "string", + "id": 5 + } + } + }, + "SqlUsersService": { + "options": { + "(google.api.default_host)": "sqladmin.googleapis.com", + "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" + }, + "methods": { + "Delete": { + "requestType": "SqlUsersDeleteRequest", + "responseType": "Operation", + "options": { + "(google.api.http).delete": "/sql/v1beta4/projects/{project}/instances/{instance}/users" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "delete": "/sql/v1beta4/projects/{project}/instances/{instance}/users" + } + } + ] + }, + "Get": { + "requestType": "SqlUsersGetRequest", + "responseType": "User", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/users/{name}" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/users/{name}" + } + } + ] + }, + "Insert": { + "requestType": "SqlUsersInsertRequest", + "responseType": "Operation", + "options": { + "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/users", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "post": "/sql/v1beta4/projects/{project}/instances/{instance}/users", + "body": "body" + } + } + ] + }, + "List": { + "requestType": "SqlUsersListRequest", + "responseType": "UsersListResponse", + "options": { + "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/users" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "get": "/sql/v1beta4/projects/{project}/instances/{instance}/users" + } + } + ] + }, + "Update": { + "requestType": "SqlUsersUpdateRequest", + "responseType": "Operation", + "options": { + "(google.api.http).put": "/sql/v1beta4/projects/{project}/instances/{instance}/users", + "(google.api.http).body": "body" + }, + "parsedOptions": [ + { + "(google.api.http)": { + "put": "/sql/v1beta4/projects/{project}/instances/{instance}/users", + "body": "body" + } + } + ] + } + } + }, + "SqlUsersDeleteRequest": { + "fields": { + "host": { + "type": "string", + "id": 1 + }, + "instance": { + "type": "string", + "id": 2 + }, + "name": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + } + } + }, + "SqlUsersGetRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "name": { + "type": "string", + "id": 2 + }, + "project": { + "type": "string", + "id": 3 + }, + "host": { + "type": "string", + "id": 4 + } + } + }, + "SqlUsersInsertRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + }, + "body": { + "type": "User", + "id": 100 + } + } + }, + "SqlUsersListRequest": { + "fields": { + "instance": { + "type": "string", + "id": 1 + }, + "project": { + "type": "string", + "id": 2 + } + } + }, + "SqlUsersUpdateRequest": { + "oneofs": { + "_revokeExistingRoles": { + "oneof": [ + "revokeExistingRoles" + ] + } + }, + "fields": { + "host": { + "type": "string", + "id": 1, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "instance": { + "type": "string", + "id": 2 + }, + "name": { + "type": "string", + "id": 3 + }, + "project": { + "type": "string", + "id": 4 + }, + "databaseRoles": { + "rule": "repeated", + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "revokeExistingRoles": { + "type": "bool", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "body": { + "type": "User", + "id": 100 + } + } + }, + "UserPasswordValidationPolicy": { + "fields": { + "allowedFailedAttempts": { + "type": "int32", + "id": 1 + }, + "passwordExpirationDuration": { + "type": "google.protobuf.Duration", + "id": 2 + }, + "enableFailedAttemptsCheck": { + "type": "bool", + "id": 3 + }, + "status": { + "type": "PasswordStatus", + "id": 4, + "options": { + "(google.api.field_behavior)": "OUTPUT_ONLY" + } + }, + "enablePasswordVerification": { + "type": "bool", + "id": 5 + } + } + }, + "PasswordStatus": { + "fields": { + "locked": { + "type": "bool", + "id": 1 + }, + "passwordExpirationTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + }, + "User": { + "oneofs": { + "userDetails": { + "oneof": [ + "sqlserverUserDetails" + ] + }, + "_dualPasswordType": { + "oneof": [ + "dualPasswordType" + ] + }, + "_iamStatus": { + "oneof": [ + "iamStatus" + ] + } + }, + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "password": { + "type": "string", + "id": 2 + }, + "etag": { + "type": "string", + "id": 3 + }, + "name": { + "type": "string", + "id": 4 + }, + "host": { + "type": "string", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "instance": { + "type": "string", + "id": 6 + }, + "project": { + "type": "string", + "id": 7 + }, + "type": { + "type": "SqlUserType", + "id": 8 + }, + "sqlserverUserDetails": { + "type": "SqlServerUserDetails", + "id": 9 + }, + "iamEmail": { + "type": "string", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "passwordPolicy": { + "type": "UserPasswordValidationPolicy", + "id": 12 + }, + "dualPasswordType": { + "type": "DualPasswordType", + "id": 13, + "options": { + "proto3_optional": true + } + }, + "iamStatus": { + "type": "IamStatus", + "id": 14, + "options": { + "proto3_optional": true + } + }, + "databaseRoles": { + "rule": "repeated", + "type": "string", + "id": 15, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + } + }, + "nested": { + "SqlUserType": { + "values": { + "BUILT_IN": 0, + "CLOUD_IAM_USER": 1, + "CLOUD_IAM_SERVICE_ACCOUNT": 2, + "CLOUD_IAM_GROUP": 3, + "CLOUD_IAM_GROUP_USER": 4, + "CLOUD_IAM_GROUP_SERVICE_ACCOUNT": 5, + "ENTRAID_USER": 7 + } + }, + "DualPasswordType": { + "values": { + "DUAL_PASSWORD_TYPE_UNSPECIFIED": 0, + "NO_MODIFY_DUAL_PASSWORD": 1, + "NO_DUAL_PASSWORD": 2, + "DUAL_PASSWORD": 3 + } + }, + "IamStatus": { + "values": { + "IAM_STATUS_UNSPECIFIED": 0, + "INACTIVE": 1, + "ACTIVE": 2 + } + } + } + }, + "SqlServerUserDetails": { + "fields": { + "disabled": { + "type": "bool", + "id": 1 + }, + "serverRoles": { + "rule": "repeated", + "type": "string", + "id": 2 + } + } + }, + "UsersListResponse": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "items": { + "rule": "repeated", + "type": "User", + "id": 2 + }, + "nextPageToken": { + "type": "string", + "id": 3, + "options": { + "deprecated": true + } + } + } + } + } + } + } + } + } + }, + "api": { + "options": { + "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", + "java_multiple_files": true, + "java_outer_classname": "FieldInfoProto", + "java_package": "com.google.api", + "objc_class_prefix": "GAPI" + }, + "nested": { + "http": { + "type": "HttpRule", + "id": 72295728, + "extend": "google.protobuf.MethodOptions" + }, + "Http": { + "fields": { + "rules": { + "rule": "repeated", + "type": "HttpRule", + "id": 1 + }, + "fullyDecodeReservedExpansion": { + "type": "bool", + "id": 2 + } + } + }, + "HttpRule": { + "oneofs": { + "pattern": { + "oneof": [ + "get", + "put", + "post", + "delete", + "patch", + "custom" + ] + } + }, + "fields": { + "selector": { + "type": "string", + "id": 1 + }, + "get": { + "type": "string", + "id": 2 + }, + "put": { + "type": "string", + "id": 3 + }, + "post": { + "type": "string", + "id": 4 + }, + "delete": { + "type": "string", + "id": 5 + }, + "patch": { + "type": "string", + "id": 6 + }, + "custom": { + "type": "CustomHttpPattern", + "id": 8 + }, + "body": { + "type": "string", + "id": 7 + }, + "responseBody": { + "type": "string", + "id": 12 + }, + "additionalBindings": { + "rule": "repeated", + "type": "HttpRule", + "id": 11 + } + } + }, + "CustomHttpPattern": { + "fields": { + "kind": { + "type": "string", + "id": 1 + }, + "path": { + "type": "string", + "id": 2 + } + } + }, + "methodSignature": { + "rule": "repeated", + "type": "string", + "id": 1051, + "extend": "google.protobuf.MethodOptions" + }, + "defaultHost": { + "type": "string", + "id": 1049, + "extend": "google.protobuf.ServiceOptions" + }, + "oauthScopes": { + "type": "string", + "id": 1050, + "extend": "google.protobuf.ServiceOptions" + }, + "apiVersion": { + "type": "string", + "id": 525000001, + "extend": "google.protobuf.ServiceOptions" + }, + "CommonLanguageSettings": { + "fields": { + "referenceDocsUri": { + "type": "string", + "id": 1, + "options": { + "deprecated": true + } + }, + "destinations": { + "rule": "repeated", + "type": "ClientLibraryDestination", + "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 + } + } + }, + "ClientLibrarySettings": { + "fields": { + "version": { + "type": "string", + "id": 1 + }, + "launchStage": { + "type": "LaunchStage", + "id": 2 + }, + "restNumericEnums": { + "type": "bool", + "id": 3 + }, + "javaSettings": { + "type": "JavaSettings", + "id": 21 + }, + "cppSettings": { + "type": "CppSettings", + "id": 22 + }, + "phpSettings": { + "type": "PhpSettings", + "id": 23 + }, + "pythonSettings": { + "type": "PythonSettings", + "id": 24 + }, + "nodeSettings": { + "type": "NodeSettings", + "id": 25 + }, + "dotnetSettings": { + "type": "DotnetSettings", + "id": 26 + }, + "rubySettings": { + "type": "RubySettings", + "id": 27 + }, + "goSettings": { + "type": "GoSettings", + "id": 28 + } + } + }, + "Publishing": { + "fields": { + "methodSettings": { + "rule": "repeated", + "type": "MethodSettings", + "id": 2 + }, + "newIssueUri": { + "type": "string", + "id": 101 + }, + "documentationUri": { + "type": "string", + "id": 102 + }, + "apiShortName": { + "type": "string", + "id": 103 + }, + "githubLabel": { + "type": "string", + "id": 104 + }, + "codeownerGithubTeams": { + "rule": "repeated", + "type": "string", + "id": 105 + }, + "docTagPrefix": { + "type": "string", + "id": 106 + }, + "organization": { + "type": "ClientLibraryOrganization", + "id": 107 + }, + "librarySettings": { + "rule": "repeated", + "type": "ClientLibrarySettings", + "id": 109 + }, + "protoReferenceDocumentationUri": { + "type": "string", + "id": 110 + }, + "restReferenceDocumentationUri": { + "type": "string", + "id": 111 + } + } + }, + "JavaSettings": { + "fields": { + "libraryPackage": { + "type": "string", + "id": 1 + }, + "serviceClassNames": { + "keyType": "string", + "type": "string", + "id": 2 + }, + "common": { + "type": "CommonLanguageSettings", + "id": 3 + } + } + }, + "CppSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + } + } + }, + "PhpSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + } + } + }, + "PythonSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } + } + } + }, + "NodeSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + } + } + }, + "DotnetSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 + }, + "renamedResources": { + "keyType": "string", + "type": "string", + "id": 3 + }, + "ignoredResources": { + "rule": "repeated", + "type": "string", + "id": 4 + }, + "forcedNamespaceAliases": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "handwrittenSignatures": { + "rule": "repeated", + "type": "string", + "id": 6 + } + } + }, + "RubySettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + } + } + }, + "GoSettings": { + "fields": { + "common": { + "type": "CommonLanguageSettings", + "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 + } + } + }, + "MethodSettings": { + "fields": { + "selector": { + "type": "string", + "id": 1 + }, + "longRunning": { + "type": "LongRunning", + "id": 2 + }, + "autoPopulatedFields": { + "rule": "repeated", + "type": "string", + "id": 3 + } + }, + "nested": { + "LongRunning": { + "fields": { + "initialPollDelay": { + "type": "google.protobuf.Duration", + "id": 1 + }, + "pollDelayMultiplier": { + "type": "float", + "id": 2 + }, + "maxPollDelay": { + "type": "google.protobuf.Duration", + "id": 3 + }, + "totalPollTimeout": { + "type": "google.protobuf.Duration", + "id": 4 + } + } + } + } + }, + "ClientLibraryOrganization": { + "values": { + "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": 0, + "CLOUD": 1, + "ADS": 2, + "PHOTOS": 3, + "STREET_VIEW": 4, + "SHOPPING": 5, + "GEO": 6, + "GENERATIVE_AI": 7 + } + }, + "ClientLibraryDestination": { + "values": { + "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": 0, + "GITHUB": 10, + "PACKAGE_MANAGER": 20 + } + }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, + "LaunchStage": { + "values": { + "LAUNCH_STAGE_UNSPECIFIED": 0, + "UNIMPLEMENTED": 6, + "PRELAUNCH": 7, + "EARLY_ACCESS": 1, + "ALPHA": 2, + "BETA": 3, + "GA": 4, + "DEPRECATED": 5 + } + }, + "fieldBehavior": { + "rule": "repeated", + "type": "google.api.FieldBehavior", + "id": 1052, + "extend": "google.protobuf.FieldOptions", + "options": { + "packed": false + } + }, + "FieldBehavior": { + "values": { + "FIELD_BEHAVIOR_UNSPECIFIED": 0, + "OPTIONAL": 1, + "REQUIRED": 2, + "OUTPUT_ONLY": 3, + "INPUT_ONLY": 4, + "IMMUTABLE": 5, + "UNORDERED_LIST": 6, + "NON_EMPTY_DEFAULT": 7, + "IDENTIFIER": 8 + } + }, + "resourceReference": { + "type": "google.api.ResourceReference", + "id": 1055, + "extend": "google.protobuf.FieldOptions" + }, + "resourceDefinition": { + "rule": "repeated", + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.FileOptions" + }, + "resource": { + "type": "google.api.ResourceDescriptor", + "id": 1053, + "extend": "google.protobuf.MessageOptions" + }, + "ResourceDescriptor": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "pattern": { + "rule": "repeated", + "type": "string", + "id": 2 + }, + "nameField": { + "type": "string", + "id": 3 + }, + "history": { + "type": "History", + "id": 4 + }, + "plural": { + "type": "string", + "id": 5 + }, + "singular": { + "type": "string", + "id": 6 + }, + "style": { + "rule": "repeated", + "type": "Style", + "id": 10 + } + }, + "nested": { + "History": { + "values": { + "HISTORY_UNSPECIFIED": 0, + "ORIGINALLY_SINGLE_PATTERN": 1, + "FUTURE_MULTI_PATTERN": 2 + } + }, + "Style": { + "values": { + "STYLE_UNSPECIFIED": 0, + "DECLARATIVE_FRIENDLY": 1 + } + } + } + }, + "ResourceReference": { + "fields": { + "type": { + "type": "string", + "id": 1 + }, + "childType": { + "type": "string", + "id": 2 + } + } + }, + "fieldInfo": { + "type": "google.api.FieldInfo", + "id": 291403980, + "extend": "google.protobuf.FieldOptions" + }, + "FieldInfo": { + "fields": { + "format": { + "type": "Format", + "id": 1 + }, + "referencedTypes": { + "rule": "repeated", + "type": "TypeReference", + "id": 2 + } + }, + "nested": { + "Format": { + "values": { + "FORMAT_UNSPECIFIED": 0, + "UUID4": 1, + "IPV4": 2, + "IPV6": 3, + "IPV4_OR_IPV6": 4 + } + } + } + }, + "TypeReference": { + "fields": { + "typeName": { + "type": "string", + "id": 1 + } + } + } + } + }, + "protobuf": { + "options": { + "go_package": "google.golang.org/protobuf/types/descriptorpb", + "java_package": "com.google.protobuf", + "java_outer_classname": "DescriptorProtos", + "csharp_namespace": "Google.Protobuf.Reflection", + "objc_class_prefix": "GPB", + "cc_enable_arenas": true, + "optimize_for": "SPEED" + }, + "nested": { + "FileDescriptorSet": { + "edition": "proto2", + "fields": { + "file": { + "rule": "repeated", + "type": "FileDescriptorProto", + "id": 1 + } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] + }, + "Edition": { + "edition": "proto2", + "values": { + "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, + "EDITION_PROTO2": 998, + "EDITION_PROTO3": 999, + "EDITION_2023": 1000, + "EDITION_2024": 1001, + "EDITION_1_TEST_ONLY": 1, + "EDITION_2_TEST_ONLY": 2, + "EDITION_99997_TEST_ONLY": 99997, + "EDITION_99998_TEST_ONLY": 99998, + "EDITION_99999_TEST_ONLY": 99999, + "EDITION_MAX": 2147483647 + } + }, + "FileDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "package": { + "type": "string", + "id": 2 + }, + "dependency": { + "rule": "repeated", + "type": "string", + "id": 3 + }, + "publicDependency": { + "rule": "repeated", + "type": "int32", + "id": 10 + }, + "weakDependency": { + "rule": "repeated", + "type": "int32", + "id": 11 + }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, + "messageType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 4 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 5 + }, + "service": { + "rule": "repeated", + "type": "ServiceDescriptorProto", + "id": 6 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 7 + }, + "options": { + "type": "FileOptions", + "id": 8 + }, + "sourceCodeInfo": { + "type": "SourceCodeInfo", + "id": 9 + }, + "syntax": { + "type": "string", + "id": 12 + }, + "edition": { + "type": "Edition", + "id": 14 + } + } + }, + "DescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "field": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 2 + }, + "extension": { + "rule": "repeated", + "type": "FieldDescriptorProto", + "id": 6 + }, + "nestedType": { + "rule": "repeated", + "type": "DescriptorProto", + "id": 3 + }, + "enumType": { + "rule": "repeated", + "type": "EnumDescriptorProto", + "id": 4 + }, + "extensionRange": { + "rule": "repeated", + "type": "ExtensionRange", + "id": 5 + }, + "oneofDecl": { + "rule": "repeated", + "type": "OneofDescriptorProto", + "id": 8 + }, + "options": { + "type": "MessageOptions", + "id": 7 + }, + "reservedRange": { + "rule": "repeated", + "type": "ReservedRange", + "id": 9 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 + } + }, + "nested": { + "ExtensionRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "ExtensionRangeOptions", + "id": 3 + } + } + }, + "ReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "ExtensionRangeOptions": { + "edition": "proto2", + "fields": { + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + }, + "declaration": { + "rule": "repeated", + "type": "Declaration", + "id": 2, + "options": { + "retention": "RETENTION_SOURCE" + } + }, + "features": { + "type": "FeatureSet", + "id": 50 + }, + "verification": { + "type": "VerificationState", + "id": 3, + "options": { + "default": "UNVERIFIED", + "retention": "RETENTION_SOURCE" + } + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "nested": { + "Declaration": { + "fields": { + "number": { + "type": "int32", + "id": 1 + }, + "fullName": { + "type": "string", + "id": 2 + }, + "type": { + "type": "string", + "id": 3 + }, + "reserved": { + "type": "bool", + "id": 5 + }, + "repeated": { + "type": "bool", + "id": 6 + } + }, + "reserved": [ + [ + 4, + 4 + ] + ] + }, + "VerificationState": { + "values": { + "DECLARATION": 0, + "UNVERIFIED": 1 + } + } + } + }, + "FieldDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 3 + }, + "label": { + "type": "Label", + "id": 4 + }, + "type": { + "type": "Type", + "id": 5 + }, + "typeName": { + "type": "string", + "id": 6 + }, + "extendee": { + "type": "string", + "id": 2 + }, + "defaultValue": { + "type": "string", + "id": 7 + }, + "oneofIndex": { + "type": "int32", + "id": 9 + }, + "jsonName": { + "type": "string", + "id": 10 + }, + "options": { + "type": "FieldOptions", + "id": 8 + }, + "proto3Optional": { + "type": "bool", + "id": 17 + } + }, + "nested": { + "Type": { + "values": { + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18 + } + }, + "Label": { + "values": { + "LABEL_OPTIONAL": 1, + "LABEL_REPEATED": 3, + "LABEL_REQUIRED": 2 + } + } + } + }, + "OneofDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "options": { + "type": "OneofOptions", + "id": 2 + } + } + }, + "EnumDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "value": { + "rule": "repeated", + "type": "EnumValueDescriptorProto", + "id": 2 + }, + "options": { + "type": "EnumOptions", + "id": 3 + }, + "reservedRange": { + "rule": "repeated", + "type": "EnumReservedRange", + "id": 4 + }, + "reservedName": { + "rule": "repeated", + "type": "string", + "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 + } + }, + "nested": { + "EnumReservedRange": { + "fields": { + "start": { + "type": "int32", + "id": 1 + }, + "end": { + "type": "int32", + "id": 2 + } + } + } + } + }, + "EnumValueDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "number": { + "type": "int32", + "id": 2 + }, + "options": { + "type": "EnumValueOptions", + "id": 3 + } + } + }, + "ServiceDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "method": { + "rule": "repeated", + "type": "MethodDescriptorProto", + "id": 2 + }, + "options": { + "type": "ServiceOptions", + "id": 3 + } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] + }, + "MethodDescriptorProto": { + "edition": "proto2", + "fields": { + "name": { + "type": "string", + "id": 1 + }, + "inputType": { + "type": "string", + "id": 2 + }, + "outputType": { + "type": "string", + "id": 3 + }, + "options": { + "type": "MethodOptions", + "id": 4 + }, + "clientStreaming": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "serverStreaming": { + "type": "bool", + "id": 6, + "options": { + "default": false + } + } + } + }, + "FileOptions": { + "edition": "proto2", + "fields": { + "javaPackage": { + "type": "string", + "id": 1 + }, + "javaOuterClassname": { + "type": "string", + "id": 8 + }, + "javaMultipleFiles": { + "type": "bool", + "id": 10, + "options": { + "default": false + } + }, + "javaGenerateEqualsAndHash": { + "type": "bool", + "id": 20, + "options": { + "deprecated": true + } + }, + "javaStringCheckUtf8": { + "type": "bool", + "id": 27, + "options": { + "default": false + } + }, + "optimizeFor": { + "type": "OptimizeMode", + "id": 9, + "options": { + "default": "SPEED" + } + }, + "goPackage": { + "type": "string", + "id": 11 + }, + "ccGenericServices": { + "type": "bool", + "id": 16, + "options": { + "default": false + } + }, + "javaGenericServices": { + "type": "bool", + "id": 17, + "options": { + "default": false + } + }, + "pyGenericServices": { + "type": "bool", + "id": 18, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 23, + "options": { + "default": false + } + }, + "ccEnableArenas": { + "type": "bool", + "id": 31, + "options": { + "default": true + } + }, + "objcClassPrefix": { + "type": "string", + "id": 36 + }, + "csharpNamespace": { + "type": "string", + "id": 37 + }, + "swiftPrefix": { + "type": "string", + "id": 39 + }, + "phpClassPrefix": { + "type": "string", + "id": 40 + }, + "phpNamespace": { + "type": "string", + "id": 41 + }, + "phpMetadataNamespace": { + "type": "string", + "id": 44 + }, + "rubyPackage": { + "type": "string", + "id": 45 + }, + "features": { + "type": "FeatureSet", + "id": 50 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 42, + 42 + ], + "php_generic_services", + [ + 38, + 38 + ] + ], + "nested": { + "OptimizeMode": { + "values": { + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3 + } + } + } + }, + "MessageOptions": { + "edition": "proto2", + "fields": { + "messageSetWireFormat": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "noStandardDescriptorAccessor": { + "type": "bool", + "id": 2, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "mapEntry": { + "type": "bool", + "id": 7 + }, + "deprecatedLegacyJsonFieldConflicts": { + "type": "bool", + "id": 11, + "options": { + "deprecated": true + } + }, + "features": { + "type": "FeatureSet", + "id": 12 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ], + [ + 5, + 5 + ], + [ + 6, + 6 + ], + [ + 8, + 8 + ], + [ + 9, + 9 + ] + ] + }, + "FieldOptions": { + "edition": "proto2", + "fields": { + "ctype": { + "type": "CType", + "id": 1, + "options": { + "default": "STRING" + } + }, + "packed": { + "type": "bool", + "id": 2 + }, + "jstype": { + "type": "JSType", + "id": 6, + "options": { + "default": "JS_NORMAL" + } + }, + "lazy": { + "type": "bool", + "id": 5, + "options": { + "default": false + } + }, + "unverifiedLazy": { + "type": "bool", + "id": 15, + "options": { + "default": false + } + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "weak": { + "type": "bool", + "id": 10, + "options": { + "default": false, + "deprecated": true + } + }, + "debugRedact": { + "type": "bool", + "id": 16, + "options": { + "default": false + } + }, + "retention": { + "type": "OptionRetention", + "id": 17 + }, + "targets": { + "rule": "repeated", + "type": "OptionTargetType", + "id": 19 + }, + "editionDefaults": { + "rule": "repeated", + "type": "EditionDefault", + "id": 20 + }, + "features": { + "type": "FeatureSet", + "id": 21 + }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 4, + 4 + ], + [ + 18, + 18 + ] + ], + "nested": { + "CType": { + "values": { + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2 + } + }, + "JSType": { + "values": { + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2 + } + }, + "OptionRetention": { + "values": { + "RETENTION_UNKNOWN": 0, + "RETENTION_RUNTIME": 1, + "RETENTION_SOURCE": 2 + } + }, + "OptionTargetType": { + "values": { + "TARGET_TYPE_UNKNOWN": 0, + "TARGET_TYPE_FILE": 1, + "TARGET_TYPE_EXTENSION_RANGE": 2, + "TARGET_TYPE_MESSAGE": 3, + "TARGET_TYPE_FIELD": 4, + "TARGET_TYPE_ONEOF": 5, + "TARGET_TYPE_ENUM": 6, + "TARGET_TYPE_ENUM_ENTRY": 7, + "TARGET_TYPE_SERVICE": 8, + "TARGET_TYPE_METHOD": 9 + } + }, + "EditionDefault": { + "fields": { + "edition": { + "type": "Edition", + "id": 3 + }, + "value": { + "type": "string", + "id": 2 + } + } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } + } + } + }, + "OneofOptions": { + "edition": "proto2", + "fields": { + "features": { + "type": "FeatureSet", + "id": 1 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "EnumOptions": { + "edition": "proto2", + "fields": { + "allowAlias": { + "type": "bool", + "id": 2 + }, + "deprecated": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "deprecatedLegacyJsonFieldConflicts": { + "type": "bool", + "id": 6, + "options": { + "deprecated": true + } + }, + "features": { + "type": "FeatureSet", + "id": 7 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "reserved": [ + [ + 5, + 5 + ] + ] + }, + "EnumValueOptions": { + "edition": "proto2", + "fields": { + "deprecated": { + "type": "bool", + "id": 1, + "options": { + "default": false + } + }, + "features": { + "type": "FeatureSet", + "id": 2 + }, + "debugRedact": { + "type": "bool", + "id": 3, + "options": { + "default": false + } + }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "ServiceOptions": { + "edition": "proto2", + "fields": { + "features": { + "type": "FeatureSet", + "id": 34 + }, + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ] + }, + "MethodOptions": { + "edition": "proto2", + "fields": { + "deprecated": { + "type": "bool", + "id": 33, + "options": { + "default": false + } + }, + "idempotencyLevel": { + "type": "IdempotencyLevel", + "id": 34, + "options": { + "default": "IDEMPOTENCY_UNKNOWN" + } + }, + "features": { + "type": "FeatureSet", + "id": 35 + }, + "uninterpretedOption": { + "rule": "repeated", + "type": "UninterpretedOption", + "id": 999 + } + }, + "extensions": [ + [ + 1000, + 536870911 + ] + ], + "nested": { + "IdempotencyLevel": { + "values": { + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2 + } + } + } + }, + "UninterpretedOption": { + "edition": "proto2", + "fields": { + "name": { + "rule": "repeated", + "type": "NamePart", + "id": 2 + }, + "identifierValue": { + "type": "string", + "id": 3 + }, + "positiveIntValue": { + "type": "uint64", + "id": 4 + }, + "negativeIntValue": { + "type": "int64", + "id": 5 + }, + "doubleValue": { + "type": "double", + "id": 6 + }, + "stringValue": { + "type": "bytes", + "id": 7 + }, + "aggregateValue": { + "type": "string", + "id": 8 + } + }, + "nested": { + "NamePart": { + "fields": { + "namePart": { + "rule": "required", + "type": "string", + "id": 1 + }, + "isExtension": { + "rule": "required", + "type": "bool", + "id": 2 + } + } + } + } + }, + "FeatureSet": { + "edition": "proto2", + "fields": { + "fieldPresence": { + "type": "FieldPresence", + "id": 1, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_2023", + "edition_defaults.value": "EXPLICIT" + } + }, + "enumType": { + "type": "EnumType", + "id": 2, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_PROTO3", + "edition_defaults.value": "OPEN" + } + }, + "repeatedFieldEncoding": { + "type": "RepeatedFieldEncoding", + "id": 3, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_PROTO3", + "edition_defaults.value": "PACKED" + } + }, + "utf8Validation": { + "type": "Utf8Validation", + "id": 4, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_PROTO3", + "edition_defaults.value": "VERIFY" + } + }, + "messageEncoding": { + "type": "MessageEncoding", + "id": 5, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", + "edition_defaults.value": "LENGTH_PREFIXED" + } + }, + "jsonFormat": { + "type": "JsonFormat", + "id": 6, + "options": { + "retention": "RETENTION_RUNTIME", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_PROTO3", + "edition_defaults.value": "ALLOW" + } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } + } + }, + "extensions": [ + [ + 1000, + 9994 + ], + [ + 9995, + 9999 + ], + [ + 10000, + 10000 + ] + ], + "reserved": [ + [ + 999, + 999 + ] + ], + "nested": { + "FieldPresence": { + "values": { + "FIELD_PRESENCE_UNKNOWN": 0, + "EXPLICIT": 1, + "IMPLICIT": 2, + "LEGACY_REQUIRED": 3 + } + }, + "EnumType": { + "values": { + "ENUM_TYPE_UNKNOWN": 0, + "OPEN": 1, + "CLOSED": 2 + } + }, + "RepeatedFieldEncoding": { + "values": { + "REPEATED_FIELD_ENCODING_UNKNOWN": 0, + "PACKED": 1, + "EXPANDED": 2 + } + }, + "Utf8Validation": { + "values": { + "UTF8_VALIDATION_UNKNOWN": 0, + "VERIFY": 2, + "NONE": 3 + }, + "reserved": [ + [ + 1, + 1 + ] + ] + }, + "MessageEncoding": { + "values": { + "MESSAGE_ENCODING_UNKNOWN": 0, + "LENGTH_PREFIXED": 1, + "DELIMITED": 2 + } + }, + "JsonFormat": { + "values": { + "JSON_FORMAT_UNKNOWN": 0, + "ALLOW": 1, + "LEGACY_BEST_EFFORT": 2 + } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } + } + } + }, + "FeatureSetDefaults": { + "edition": "proto2", + "fields": { + "defaults": { + "rule": "repeated", + "type": "FeatureSetEditionDefault", + "id": 1 + }, + "minimumEdition": { + "type": "Edition", + "id": 4 + }, + "maximumEdition": { + "type": "Edition", + "id": 5 + } + }, + "nested": { + "FeatureSetEditionDefault": { + "fields": { + "edition": { + "type": "Edition", + "id": 3 + }, + "overridableFeatures": { + "type": "FeatureSet", + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 + } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] + } + } + }, + "SourceCodeInfo": { + "edition": "proto2", + "fields": { + "location": { + "rule": "repeated", + "type": "Location", + "id": 1 + } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], + "nested": { + "Location": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1, + "options": { + "packed": true + } + }, + "span": { + "rule": "repeated", + "type": "int32", + "id": 2, + "options": { + "packed": true + } + }, + "leadingComments": { + "type": "string", + "id": 3 + }, + "trailingComments": { + "type": "string", + "id": 4 + }, + "leadingDetachedComments": { + "rule": "repeated", + "type": "string", + "id": 6 + } + } + } + } + }, + "GeneratedCodeInfo": { + "edition": "proto2", + "fields": { + "annotation": { + "rule": "repeated", + "type": "Annotation", + "id": 1 + } + }, + "nested": { + "Annotation": { + "fields": { + "path": { + "rule": "repeated", + "type": "int32", + "id": 1, + "options": { + "packed": true + } + }, + "sourceFile": { + "type": "string", + "id": 2 + }, + "begin": { + "type": "int32", + "id": 3 + }, + "end": { + "type": "int32", + "id": 4 + }, + "semantic": { + "type": "Semantic", + "id": 5 + } + }, + "nested": { + "Semantic": { + "values": { + "NONE": 0, + "SET": 1, + "ALIAS": 2 + } + } + } + } + } + }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, + "Duration": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "Timestamp": { + "fields": { + "seconds": { + "type": "int64", + "id": 1 + }, + "nanos": { + "type": "int32", + "id": 2 + } + } + }, + "DoubleValue": { + "fields": { + "value": { + "type": "double", + "id": 1 + } + } + }, + "FloatValue": { + "fields": { + "value": { + "type": "float", + "id": 1 + } + } + }, + "Int64Value": { + "fields": { + "value": { + "type": "int64", + "id": 1 + } + } + }, + "UInt64Value": { + "fields": { + "value": { + "type": "uint64", + "id": 1 + } + } + }, + "Int32Value": { + "fields": { + "value": { + "type": "int32", + "id": 1 + } + } + }, + "UInt32Value": { + "fields": { + "value": { + "type": "uint32", + "id": 1 + } + } + }, + "BoolValue": { + "fields": { + "value": { + "type": "bool", + "id": 1 + } + } + }, + "StringValue": { + "fields": { + "value": { + "type": "string", + "id": 1 + } + } + }, + "BytesValue": { + "fields": { + "value": { + "type": "bytes", + "id": 1 + } + } + }, + "Any": { + "fields": { + "type_url": { + "type": "string", + "id": 1 + }, + "value": { + "type": "bytes", + "id": 2 + } + } + }, + "FieldMask": { + "fields": { + "paths": { + "rule": "repeated", + "type": "string", + "id": 1 + } + } + }, + "Empty": { + "fields": {} + } + } + }, + "rpc": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", + "java_multiple_files": true, + "java_outer_classname": "StatusProto", + "java_package": "com.google.rpc", + "objc_class_prefix": "RPC" + }, + "nested": { + "Status": { + "fields": { + "code": { + "type": "int32", + "id": 1 + }, + "message": { + "type": "string", + "id": 2 + }, + "details": { + "rule": "repeated", + "type": "google.protobuf.Any", + "id": 3 + } + } + } + } + }, + "type": { + "options": { + "cc_enable_arenas": true, + "go_package": "google.golang.org/genproto/googleapis/type/interval;interval", + "java_multiple_files": true, + "java_outer_classname": "IntervalProto", + "java_package": "com.google.type", + "objc_class_prefix": "GTP" + }, + "nested": { + "Interval": { + "fields": { + "startTime": { + "type": "google.protobuf.Timestamp", + "id": 1 + }, + "endTime": { + "type": "google.protobuf.Timestamp", + "id": 2 + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json b/owl-bot-staging/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json new file mode 100644 index 000000000000..76103b57b6ed --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json @@ -0,0 +1,3567 @@ +{ + "clientLibrary": { + "name": "nodejs-sql", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.sql.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "sqladmin_v1_generated_SqlBackupRunsService_Delete_async", + "title": "SqlAvailableDatabaseVersionsService delete Sample", + "origin": "API_DEFINITION", + "description": " Deletes the backup taken by a backup run.", + "canonical": true, + "file": "sql_backup_runs_service.delete.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Delete", + "async": true, + "parameters": [ + { + "name": "id", + "type": "TYPE_INT64" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlBackupRunsServiceClient", + "fullName": "google.cloud.sql.v1.SqlBackupRunsServiceClient" + }, + "method": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Delete", + "service": { + "shortName": "SqlBackupRunsService", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlBackupRunsService_Get_async", + "title": "SqlAvailableDatabaseVersionsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a resource containing information about a backup run.", + "canonical": true, + "file": "sql_backup_runs_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Get", + "async": true, + "parameters": [ + { + "name": "id", + "type": "TYPE_INT64" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.BackupRun", + "client": { + "shortName": "SqlBackupRunsServiceClient", + "fullName": "google.cloud.sql.v1.SqlBackupRunsServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Get", + "service": { + "shortName": "SqlBackupRunsService", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlBackupRunsService_Insert_async", + "title": "SqlAvailableDatabaseVersionsService insert Sample", + "origin": "API_DEFINITION", + "description": " Creates a new backup run on demand.", + "canonical": true, + "file": "sql_backup_runs_service.insert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Insert", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.BackupRun" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlBackupRunsServiceClient", + "fullName": "google.cloud.sql.v1.SqlBackupRunsServiceClient" + }, + "method": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Insert", + "service": { + "shortName": "SqlBackupRunsService", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlBackupRunsService_List_async", + "title": "SqlAvailableDatabaseVersionsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists all backup runs associated with the project or a given instance and configuration in the reverse chronological order of the backup initiation time.", + "canonical": true, + "file": "sql_backup_runs_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService.List", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "max_results", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.BackupRunsListResponse", + "client": { + "shortName": "SqlBackupRunsServiceClient", + "fullName": "google.cloud.sql.v1.SqlBackupRunsServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService.List", + "service": { + "shortName": "SqlBackupRunsService", + "fullName": "google.cloud.sql.v1.SqlBackupRunsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlBackupsService_CreateBackup_async", + "title": "SqlAvailableDatabaseVersionsService createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.", + "canonical": true, + "file": "sql_backups_service.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.sql.v1.SqlBackupsService.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.sql.v1.Backup" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlBackupsServiceClient", + "fullName": "google.cloud.sql.v1.SqlBackupsServiceClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.sql.v1.SqlBackupsService.CreateBackup", + "service": { + "shortName": "SqlBackupsService", + "fullName": "google.cloud.sql.v1.SqlBackupsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlBackupsService_GetBackup_async", + "title": "SqlAvailableDatabaseVersionsService getBackup Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a resource containing information about a backup.", + "canonical": true, + "file": "sql_backups_service.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.sql.v1.SqlBackupsService.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Backup", + "client": { + "shortName": "SqlBackupsServiceClient", + "fullName": "google.cloud.sql.v1.SqlBackupsServiceClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.sql.v1.SqlBackupsService.GetBackup", + "service": { + "shortName": "SqlBackupsService", + "fullName": "google.cloud.sql.v1.SqlBackupsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlBackupsService_ListBackups_async", + "title": "SqlAvailableDatabaseVersionsService listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists all backups associated with the project.", + "canonical": true, + "file": "sql_backups_service.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.sql.v1.SqlBackupsService.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.ListBackupsResponse", + "client": { + "shortName": "SqlBackupsServiceClient", + "fullName": "google.cloud.sql.v1.SqlBackupsServiceClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.sql.v1.SqlBackupsService.ListBackups", + "service": { + "shortName": "SqlBackupsService", + "fullName": "google.cloud.sql.v1.SqlBackupsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlBackupsService_UpdateBackup_async", + "title": "SqlAvailableDatabaseVersionsService updateBackup Sample", + "origin": "API_DEFINITION", + "description": " Updates the retention period and description of the backup. You can use this API to update final backups only.", + "canonical": true, + "file": "sql_backups_service.update_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBackup", + "fullName": "google.cloud.sql.v1.SqlBackupsService.UpdateBackup", + "async": true, + "parameters": [ + { + "name": "backup", + "type": ".google.cloud.sql.v1.Backup" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlBackupsServiceClient", + "fullName": "google.cloud.sql.v1.SqlBackupsServiceClient" + }, + "method": { + "shortName": "UpdateBackup", + "fullName": "google.cloud.sql.v1.SqlBackupsService.UpdateBackup", + "service": { + "shortName": "SqlBackupsService", + "fullName": "google.cloud.sql.v1.SqlBackupsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlBackupsService_DeleteBackup_async", + "title": "SqlAvailableDatabaseVersionsService deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes the backup.", + "canonical": true, + "file": "sql_backups_service.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.sql.v1.SqlBackupsService.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlBackupsServiceClient", + "fullName": "google.cloud.sql.v1.SqlBackupsServiceClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.sql.v1.SqlBackupsService.DeleteBackup", + "service": { + "shortName": "SqlBackupsService", + "fullName": "google.cloud.sql.v1.SqlBackupsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlConnectService_GetConnectSettings_async", + "title": "SqlAvailableDatabaseVersionsService getConnectSettings Sample", + "origin": "API_DEFINITION", + "description": " Retrieves connect settings about a Cloud SQL instance.", + "canonical": true, + "file": "sql_connect_service.get_connect_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConnectSettings", + "fullName": "google.cloud.sql.v1.SqlConnectService.GetConnectSettings", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.sql.v1.ConnectSettings", + "client": { + "shortName": "SqlConnectServiceClient", + "fullName": "google.cloud.sql.v1.SqlConnectServiceClient" + }, + "method": { + "shortName": "GetConnectSettings", + "fullName": "google.cloud.sql.v1.SqlConnectService.GetConnectSettings", + "service": { + "shortName": "SqlConnectService", + "fullName": "google.cloud.sql.v1.SqlConnectService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_async", + "title": "SqlAvailableDatabaseVersionsService generateEphemeralCert Sample", + "origin": "API_DEFINITION", + "description": " Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.", + "canonical": true, + "file": "sql_connect_service.generate_ephemeral_cert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateEphemeralCert", + "fullName": "google.cloud.sql.v1.SqlConnectService.GenerateEphemeralCert", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "public_key", + "type": "TYPE_STRING" + }, + { + "name": "access_token", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "valid_duration", + "type": ".google.protobuf.Duration" + } + ], + "resultType": ".google.cloud.sql.v1.GenerateEphemeralCertResponse", + "client": { + "shortName": "SqlConnectServiceClient", + "fullName": "google.cloud.sql.v1.SqlConnectServiceClient" + }, + "method": { + "shortName": "GenerateEphemeralCert", + "fullName": "google.cloud.sql.v1.SqlConnectService.GenerateEphemeralCert", + "service": { + "shortName": "SqlConnectService", + "fullName": "google.cloud.sql.v1.SqlConnectService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlDatabasesService_Delete_async", + "title": "SqlAvailableDatabaseVersionsService delete Sample", + "origin": "API_DEFINITION", + "description": " Deletes a database from a Cloud SQL instance.", + "canonical": true, + "file": "sql_databases_service.delete.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.Delete", + "async": true, + "parameters": [ + { + "name": "database", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.Delete", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlDatabasesService_Get_async", + "title": "SqlAvailableDatabaseVersionsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a resource containing information about a database inside a Cloud SQL instance.", + "canonical": true, + "file": "sql_databases_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.Get", + "async": true, + "parameters": [ + { + "name": "database", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Database", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.Get", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlDatabasesService_Insert_async", + "title": "SqlAvailableDatabaseVersionsService insert Sample", + "origin": "API_DEFINITION", + "description": " Inserts a resource containing information about a database inside a Cloud SQL instance. **Note:** You can't modify the default character set and collation.", + "canonical": true, + "file": "sql_databases_service.insert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.Insert", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.Database" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.Insert", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlDatabasesService_List_async", + "title": "SqlAvailableDatabaseVersionsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists databases in the specified Cloud SQL instance.", + "canonical": true, + "file": "sql_databases_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.List", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.DatabasesListResponse", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.List", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlDatabasesService_Patch_async", + "title": "SqlAvailableDatabaseVersionsService patch Sample", + "origin": "API_DEFINITION", + "description": " Partially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.", + "canonical": true, + "file": "sql_databases_service.patch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Patch", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.Patch", + "async": true, + "parameters": [ + { + "name": "database", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.Database" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "Patch", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.Patch", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlDatabasesService_Update_async", + "title": "SqlAvailableDatabaseVersionsService update Sample", + "origin": "API_DEFINITION", + "description": " Updates a resource containing information about a database inside a Cloud SQL instance.", + "canonical": true, + "file": "sql_databases_service.update.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.Update", + "async": true, + "parameters": [ + { + "name": "database", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.Database" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1.SqlDatabasesService.Update", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlFlagsService_List_async", + "title": "SqlAvailableDatabaseVersionsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists all available database flags for Cloud SQL instances.", + "canonical": true, + "file": "sql_flags_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlFlagsService.List", + "async": true, + "parameters": [ + { + "name": "database_version", + "type": "TYPE_STRING" + }, + { + "name": "flag_scope", + "type": ".google.cloud.sql.v1.SqlFlagScope" + } + ], + "resultType": ".google.cloud.sql.v1.FlagsListResponse", + "client": { + "shortName": "SqlFlagsServiceClient", + "fullName": "google.cloud.sql.v1.SqlFlagsServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlFlagsService.List", + "service": { + "shortName": "SqlFlagsService", + "fullName": "google.cloud.sql.v1.SqlFlagsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_AddServerCa_async", + "title": "SqlAvailableDatabaseVersionsService addServerCa Sample", + "origin": "API_DEFINITION", + "description": " Adds a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in. For instances that have enabled Certificate Authority Service (CAS) based server CA, use AddServerCertificate to add a new server certificate.", + "canonical": true, + "file": "sql_instances_service.add_server_ca.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddServerCa", + "fullName": "google.cloud.sql.v1.SqlInstancesService.AddServerCa", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "AddServerCa", + "fullName": "google.cloud.sql.v1.SqlInstancesService.AddServerCa", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_async", + "title": "SqlAvailableDatabaseVersionsService addServerCertificate Sample", + "origin": "API_DEFINITION", + "description": " Add a new trusted server certificate version for the specified instance using Certificate Authority Service (CAS) server CA. Required to prepare for a certificate rotation. If a server certificate version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one certificate version waiting to be rotated in. For instances not using CAS server CA, use AddServerCa instead.", + "canonical": true, + "file": "sql_instances_service.add_server_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddServerCertificate", + "fullName": "google.cloud.sql.v1.SqlInstancesService.AddServerCertificate", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "AddServerCertificate", + "fullName": "google.cloud.sql.v1.SqlInstancesService.AddServerCertificate", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_async", + "title": "SqlAvailableDatabaseVersionsService addEntraIdCertificate Sample", + "origin": "API_DEFINITION", + "description": " Adds a new Entra ID certificate for the specified instance. If an Entra ID certificate was previously added but never used in a certificate rotation, this operation replaces that version.", + "canonical": true, + "file": "sql_instances_service.add_entra_id_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddEntraIdCertificate", + "fullName": "google.cloud.sql.v1.SqlInstancesService.AddEntraIdCertificate", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "AddEntraIdCertificate", + "fullName": "google.cloud.sql.v1.SqlInstancesService.AddEntraIdCertificate", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Clone_async", + "title": "SqlAvailableDatabaseVersionsService clone Sample", + "origin": "API_DEFINITION", + "description": " Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.", + "canonical": true, + "file": "sql_instances_service.clone.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Clone", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Clone", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesCloneRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Clone", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Clone", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Delete_async", + "title": "SqlAvailableDatabaseVersionsService delete Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Cloud SQL instance.", + "canonical": true, + "file": "sql_instances_service.delete.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Delete", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "enable_final_backup", + "type": "TYPE_BOOL" + }, + { + "name": "final_backup_ttl_days", + "type": "TYPE_INT64" + }, + { + "name": "final_backup_expiry_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "final_backup_description", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Delete", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_DemoteMaster_async", + "title": "SqlAvailableDatabaseVersionsService demoteMaster Sample", + "origin": "API_DEFINITION", + "description": " Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.", + "canonical": true, + "file": "sql_instances_service.demote_master.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DemoteMaster", + "fullName": "google.cloud.sql.v1.SqlInstancesService.DemoteMaster", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesDemoteMasterRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "DemoteMaster", + "fullName": "google.cloud.sql.v1.SqlInstancesService.DemoteMaster", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Demote_async", + "title": "SqlAvailableDatabaseVersionsService demote Sample", + "origin": "API_DEFINITION", + "description": " Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server.", + "canonical": true, + "file": "sql_instances_service.demote.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Demote", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Demote", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesDemoteRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Demote", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Demote", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Export_async", + "title": "SqlAvailableDatabaseVersionsService export Sample", + "origin": "API_DEFINITION", + "description": " Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.", + "canonical": true, + "file": "sql_instances_service.export.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Export", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Export", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesExportRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Export", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Export", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Failover_async", + "title": "SqlAvailableDatabaseVersionsService failover Sample", + "origin": "API_DEFINITION", + "description": " Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the [Overview of high availability](https://cloud.google.com/sql/docs/mysql/high-availability) page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.", + "canonical": true, + "file": "sql_instances_service.failover.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Failover", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Failover", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesFailoverRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Failover", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Failover", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Reencrypt_async", + "title": "SqlAvailableDatabaseVersionsService reencrypt Sample", + "origin": "API_DEFINITION", + "description": " Reencrypt CMEK instance with latest key version.", + "canonical": true, + "file": "sql_instances_service.reencrypt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Reencrypt", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Reencrypt", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesReencryptRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Reencrypt", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Reencrypt", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Get_async", + "title": "SqlAvailableDatabaseVersionsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a resource containing information about a Cloud SQL instance.", + "canonical": true, + "file": "sql_instances_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Get", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.DatabaseInstance", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Get", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Import_async", + "title": "SqlAvailableDatabaseVersionsService import Sample", + "origin": "API_DEFINITION", + "description": " Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.", + "canonical": true, + "file": "sql_instances_service.import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Import", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Import", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesImportRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Import", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Import", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Insert_async", + "title": "SqlAvailableDatabaseVersionsService insert Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Cloud SQL instance.", + "canonical": true, + "file": "sql_instances_service.insert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Insert", + "async": true, + "parameters": [ + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.DatabaseInstance" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Insert", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_List_async", + "title": "SqlAvailableDatabaseVersionsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists instances under a given project.", + "canonical": true, + "file": "sql_instances_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlInstancesService.List", + "async": true, + "parameters": [ + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "max_results", + "type": "TYPE_UINT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.InstancesListResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlInstancesService.List", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_ListServerCas_async", + "title": "SqlAvailableDatabaseVersionsService listServerCas Sample", + "origin": "API_DEFINITION", + "description": " Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.", + "canonical": true, + "file": "sql_instances_service.list_server_cas.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServerCas", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ListServerCas", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.InstancesListServerCasResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ListServerCas", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ListServerCas", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_async", + "title": "SqlAvailableDatabaseVersionsService listServerCertificates Sample", + "origin": "API_DEFINITION", + "description": " Lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead.", + "canonical": true, + "file": "sql_instances_service.list_server_certificates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServerCertificates", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ListServerCertificates", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.InstancesListServerCertificatesResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ListServerCertificates", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ListServerCertificates", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_async", + "title": "SqlAvailableDatabaseVersionsService listEntraIdCertificates Sample", + "origin": "API_DEFINITION", + "description": " Lists all versions of EntraID certificates for the specified instance. There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out.", + "canonical": true, + "file": "sql_instances_service.list_entra_id_certificates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEntraIdCertificates", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ListEntraIdCertificates", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ListEntraIdCertificates", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ListEntraIdCertificates", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Patch_async", + "title": "SqlAvailableDatabaseVersionsService patch Sample", + "origin": "API_DEFINITION", + "description": " Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.", + "canonical": true, + "file": "sql_instances_service.patch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Patch", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Patch", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.DatabaseInstance" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Patch", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Patch", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_PromoteReplica_async", + "title": "SqlAvailableDatabaseVersionsService promoteReplica Sample", + "origin": "API_DEFINITION", + "description": " Promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.", + "canonical": true, + "file": "sql_instances_service.promote_replica.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PromoteReplica", + "fullName": "google.cloud.sql.v1.SqlInstancesService.PromoteReplica", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "failover", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "PromoteReplica", + "fullName": "google.cloud.sql.v1.SqlInstancesService.PromoteReplica", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Switchover_async", + "title": "SqlAvailableDatabaseVersionsService switchover Sample", + "origin": "API_DEFINITION", + "description": " Switches over from the primary instance to the DR replica instance.", + "canonical": true, + "file": "sql_instances_service.switchover.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Switchover", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Switchover", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "db_timeout", + "type": ".google.protobuf.Duration" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Switchover", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Switchover", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_async", + "title": "SqlAvailableDatabaseVersionsService resetSslConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes all client certificates and generates a new server SSL certificate for the instance.", + "canonical": true, + "file": "sql_instances_service.reset_ssl_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetSslConfig", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ResetSslConfig", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "mode", + "type": ".google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ResetSslConfig", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ResetSslConfig", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Restart_async", + "title": "SqlAvailableDatabaseVersionsService restart Sample", + "origin": "API_DEFINITION", + "description": " Restarts a Cloud SQL instance.", + "canonical": true, + "file": "sql_instances_service.restart.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Restart", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Restart", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Restart", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Restart", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_RestoreBackup_async", + "title": "SqlAvailableDatabaseVersionsService restoreBackup Sample", + "origin": "API_DEFINITION", + "description": " Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.", + "canonical": true, + "file": "sql_instances_service.restore_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreBackup", + "fullName": "google.cloud.sql.v1.SqlInstancesService.RestoreBackup", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesRestoreBackupRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "RestoreBackup", + "fullName": "google.cloud.sql.v1.SqlInstancesService.RestoreBackup", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_RotateServerCa_async", + "title": "SqlAvailableDatabaseVersionsService rotateServerCa Sample", + "origin": "API_DEFINITION", + "description": " Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use RotateServerCertificate to rotate the server certificate.", + "canonical": true, + "file": "sql_instances_service.rotate_server_ca.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RotateServerCa", + "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateServerCa", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesRotateServerCaRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "RotateServerCa", + "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateServerCa", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_async", + "title": "SqlAvailableDatabaseVersionsService rotateServerCertificate Sample", + "origin": "API_DEFINITION", + "description": " Rotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead.", + "canonical": true, + "file": "sql_instances_service.rotate_server_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RotateServerCertificate", + "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateServerCertificate", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesRotateServerCertificateRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "RotateServerCertificate", + "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateServerCertificate", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_async", + "title": "SqlAvailableDatabaseVersionsService rotateEntraIdCertificate Sample", + "origin": "API_DEFINITION", + "description": " Rotates the server certificate version to one previously added with the addEntraIdCertificate method.", + "canonical": true, + "file": "sql_instances_service.rotate_entra_id_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RotateEntraIdCertificate", + "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateEntraIdCertificate", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "RotateEntraIdCertificate", + "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateEntraIdCertificate", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_StartReplica_async", + "title": "SqlAvailableDatabaseVersionsService startReplica Sample", + "origin": "API_DEFINITION", + "description": " Starts the replication in the read replica instance.", + "canonical": true, + "file": "sql_instances_service.start_replica.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartReplica", + "fullName": "google.cloud.sql.v1.SqlInstancesService.StartReplica", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "StartReplica", + "fullName": "google.cloud.sql.v1.SqlInstancesService.StartReplica", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_StopReplica_async", + "title": "SqlAvailableDatabaseVersionsService stopReplica Sample", + "origin": "API_DEFINITION", + "description": " Stops the replication in the read replica instance.", + "canonical": true, + "file": "sql_instances_service.stop_replica.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopReplica", + "fullName": "google.cloud.sql.v1.SqlInstancesService.StopReplica", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "StopReplica", + "fullName": "google.cloud.sql.v1.SqlInstancesService.StopReplica", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_TruncateLog_async", + "title": "SqlAvailableDatabaseVersionsService truncateLog Sample", + "origin": "API_DEFINITION", + "description": " Truncate MySQL general and slow query log tables MySQL only.", + "canonical": true, + "file": "sql_instances_service.truncate_log.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TruncateLog", + "fullName": "google.cloud.sql.v1.SqlInstancesService.TruncateLog", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesTruncateLogRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "TruncateLog", + "fullName": "google.cloud.sql.v1.SqlInstancesService.TruncateLog", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_Update_async", + "title": "SqlAvailableDatabaseVersionsService update Sample", + "origin": "API_DEFINITION", + "description": " Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.", + "canonical": true, + "file": "sql_instances_service.update.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Update", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.DatabaseInstance" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1.SqlInstancesService.Update", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_async", + "title": "SqlAvailableDatabaseVersionsService createEphemeral Sample", + "origin": "API_DEFINITION", + "description": " Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.", + "canonical": true, + "file": "sql_instances_service.create_ephemeral.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEphemeral", + "fullName": "google.cloud.sql.v1.SqlInstancesService.CreateEphemeral", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.SslCertsCreateEphemeralRequest" + } + ], + "resultType": ".google.cloud.sql.v1.SslCert", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "CreateEphemeral", + "fullName": "google.cloud.sql.v1.SqlInstancesService.CreateEphemeral", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_async", + "title": "SqlAvailableDatabaseVersionsService rescheduleMaintenance Sample", + "origin": "API_DEFINITION", + "description": " Reschedules the maintenance on the given instance.", + "canonical": true, + "file": "sql_instances_service.reschedule_maintenance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RescheduleMaintenance", + "fullName": "google.cloud.sql.v1.SqlInstancesService.RescheduleMaintenance", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "RescheduleMaintenance", + "fullName": "google.cloud.sql.v1.SqlInstancesService.RescheduleMaintenance", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_async", + "title": "SqlAvailableDatabaseVersionsService verifyExternalSyncSettings Sample", + "origin": "API_DEFINITION", + "description": " Verify External primary instance external sync settings.", + "canonical": true, + "file": "sql_instances_service.verify_external_sync_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 88, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "VerifyExternalSyncSettings", + "fullName": "google.cloud.sql.v1.SqlInstancesService.VerifyExternalSyncSettings", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "verify_connection_only", + "type": "TYPE_BOOL" + }, + { + "name": "sync_mode", + "type": ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode" + }, + { + "name": "verify_replication_only", + "type": "TYPE_BOOL" + }, + { + "name": "mysql_sync_config", + "type": ".google.cloud.sql.v1.MySqlSyncConfig" + }, + { + "name": "migration_type", + "type": ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType" + }, + { + "name": "sync_parallel_level", + "type": ".google.cloud.sql.v1.ExternalSyncParallelLevel" + }, + { + "name": "selected_objects", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "VerifyExternalSyncSettings", + "fullName": "google.cloud.sql.v1.SqlInstancesService.VerifyExternalSyncSettings", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_StartExternalSync_async", + "title": "SqlAvailableDatabaseVersionsService startExternalSync Sample", + "origin": "API_DEFINITION", + "description": " Start External primary instance migration.", + "canonical": true, + "file": "sql_instances_service.start_external_sync.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartExternalSync", + "fullName": "google.cloud.sql.v1.SqlInstancesService.StartExternalSync", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "sync_mode", + "type": ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode" + }, + { + "name": "skip_verification", + "type": "TYPE_BOOL" + }, + { + "name": "mysql_sync_config", + "type": ".google.cloud.sql.v1.MySqlSyncConfig" + }, + { + "name": "sync_parallel_level", + "type": ".google.cloud.sql.v1.ExternalSyncParallelLevel" + }, + { + "name": "migration_type", + "type": ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType" + }, + { + "name": "replica_overwrite_enabled", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "StartExternalSync", + "fullName": "google.cloud.sql.v1.SqlInstancesService.StartExternalSync", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_async", + "title": "SqlAvailableDatabaseVersionsService performDiskShrink Sample", + "origin": "API_DEFINITION", + "description": " Perform Disk Shrink on primary instance.", + "canonical": true, + "file": "sql_instances_service.perform_disk_shrink.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PerformDiskShrink", + "fullName": "google.cloud.sql.v1.SqlInstancesService.PerformDiskShrink", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.PerformDiskShrinkContext" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "PerformDiskShrink", + "fullName": "google.cloud.sql.v1.SqlInstancesService.PerformDiskShrink", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_async", + "title": "SqlAvailableDatabaseVersionsService getDiskShrinkConfig Sample", + "origin": "API_DEFINITION", + "description": " Get Disk Shrink Config for a given instance.", + "canonical": true, + "file": "sql_instances_service.get_disk_shrink_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDiskShrinkConfig", + "fullName": "google.cloud.sql.v1.SqlInstancesService.GetDiskShrinkConfig", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "GetDiskShrinkConfig", + "fullName": "google.cloud.sql.v1.SqlInstancesService.GetDiskShrinkConfig", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_async", + "title": "SqlAvailableDatabaseVersionsService resetReplicaSize Sample", + "origin": "API_DEFINITION", + "description": " Reset Replica Size to primary instance disk size.", + "canonical": true, + "file": "sql_instances_service.reset_replica_size.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetReplicaSize", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ResetReplicaSize", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ResetReplicaSize", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ResetReplicaSize", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_async", + "title": "SqlAvailableDatabaseVersionsService getLatestRecoveryTime Sample", + "origin": "API_DEFINITION", + "description": " Get Latest Recovery Time for a given instance.", + "canonical": true, + "file": "sql_instances_service.get_latest_recovery_time.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetLatestRecoveryTime", + "fullName": "google.cloud.sql.v1.SqlInstancesService.GetLatestRecoveryTime", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "source_instance_deletion_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "GetLatestRecoveryTime", + "fullName": "google.cloud.sql.v1.SqlInstancesService.GetLatestRecoveryTime", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_ExecuteSql_async", + "title": "SqlAvailableDatabaseVersionsService executeSql Sample", + "origin": "API_DEFINITION", + "description": " Execute SQL statements.", + "canonical": true, + "file": "sql_instances_service.execute_sql.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExecuteSql", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ExecuteSql", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.ExecuteSqlPayload" + } + ], + "resultType": ".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ExecuteSql", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ExecuteSql", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_async", + "title": "SqlAvailableDatabaseVersionsService acquireSsrsLease Sample", + "origin": "API_DEFINITION", + "description": " Acquire a lease for the setup of SQL Server Reporting Services (SSRS).", + "canonical": true, + "file": "sql_instances_service.acquire_ssrs_lease.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 67, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AcquireSsrsLease", + "fullName": "google.cloud.sql.v1.SqlInstancesService.AcquireSsrsLease", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest" + } + ], + "resultType": ".google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "AcquireSsrsLease", + "fullName": "google.cloud.sql.v1.SqlInstancesService.AcquireSsrsLease", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_async", + "title": "SqlAvailableDatabaseVersionsService releaseSsrsLease Sample", + "origin": "API_DEFINITION", + "description": " Release a lease for the setup of SQL Server Reporting Services (SSRS).", + "canonical": true, + "file": "sql_instances_service.release_ssrs_lease.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReleaseSsrsLease", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ReleaseSsrsLease", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ReleaseSsrsLease", + "fullName": "google.cloud.sql.v1.SqlInstancesService.ReleaseSsrsLease", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async", + "title": "SqlAvailableDatabaseVersionsService preCheckMajorVersionUpgrade Sample", + "origin": "API_DEFINITION", + "description": " Execute MVU Pre-checks", + "canonical": true, + "file": "sql_instances_service.pre_check_major_version_upgrade.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreCheckMajorVersionUpgrade", + "fullName": "google.cloud.sql.v1.SqlInstancesService.PreCheckMajorVersionUpgrade", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "PreCheckMajorVersionUpgrade", + "fullName": "google.cloud.sql.v1.SqlInstancesService.PreCheckMajorVersionUpgrade", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_async", + "title": "SqlAvailableDatabaseVersionsService pointInTimeRestore Sample", + "origin": "API_DEFINITION", + "description": " Point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery.", + "canonical": true, + "file": "sql_instances_service.point_in_time_restore.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PointInTimeRestore", + "fullName": "google.cloud.sql.v1.SqlInstancesService.PointInTimeRestore", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "context", + "type": ".google.cloud.sql.v1.PointInTimeRestoreContext" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" + }, + "method": { + "shortName": "PointInTimeRestore", + "fullName": "google.cloud.sql.v1.SqlInstancesService.PointInTimeRestore", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlOperationsService_Get_async", + "title": "SqlAvailableDatabaseVersionsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves an instance operation that has been performed on an instance.", + "canonical": true, + "file": "sql_operations_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlOperationsService.Get", + "async": true, + "parameters": [ + { + "name": "operation", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlOperationsServiceClient", + "fullName": "google.cloud.sql.v1.SqlOperationsServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlOperationsService.Get", + "service": { + "shortName": "SqlOperationsService", + "fullName": "google.cloud.sql.v1.SqlOperationsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlOperationsService_List_async", + "title": "SqlAvailableDatabaseVersionsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.", + "canonical": true, + "file": "sql_operations_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlOperationsService.List", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "max_results", + "type": "TYPE_UINT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.OperationsListResponse", + "client": { + "shortName": "SqlOperationsServiceClient", + "fullName": "google.cloud.sql.v1.SqlOperationsServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlOperationsService.List", + "service": { + "shortName": "SqlOperationsService", + "fullName": "google.cloud.sql.v1.SqlOperationsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlOperationsService_Cancel_async", + "title": "SqlAvailableDatabaseVersionsService cancel Sample", + "origin": "API_DEFINITION", + "description": " Cancels an instance operation that has been performed on an instance.", + "canonical": true, + "file": "sql_operations_service.cancel.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Cancel", + "fullName": "google.cloud.sql.v1.SqlOperationsService.Cancel", + "async": true, + "parameters": [ + { + "name": "operation", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SqlOperationsServiceClient", + "fullName": "google.cloud.sql.v1.SqlOperationsServiceClient" + }, + "method": { + "shortName": "Cancel", + "fullName": "google.cloud.sql.v1.SqlOperationsService.Cancel", + "service": { + "shortName": "SqlOperationsService", + "fullName": "google.cloud.sql.v1.SqlOperationsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlSslCertsService_Delete_async", + "title": "SqlAvailableDatabaseVersionsService delete Sample", + "origin": "API_DEFINITION", + "description": " Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.", + "canonical": true, + "file": "sql_ssl_certs_service.delete.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1.SqlSslCertsService.Delete", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "sha1_fingerprint", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlSslCertsServiceClient", + "fullName": "google.cloud.sql.v1.SqlSslCertsServiceClient" + }, + "method": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1.SqlSslCertsService.Delete", + "service": { + "shortName": "SqlSslCertsService", + "fullName": "google.cloud.sql.v1.SqlSslCertsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlSslCertsService_Get_async", + "title": "SqlAvailableDatabaseVersionsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.", + "canonical": true, + "file": "sql_ssl_certs_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlSslCertsService.Get", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "sha1_fingerprint", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.SslCert", + "client": { + "shortName": "SqlSslCertsServiceClient", + "fullName": "google.cloud.sql.v1.SqlSslCertsServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlSslCertsService.Get", + "service": { + "shortName": "SqlSslCertsService", + "fullName": "google.cloud.sql.v1.SqlSslCertsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlSslCertsService_Insert_async", + "title": "SqlAvailableDatabaseVersionsService insert Sample", + "origin": "API_DEFINITION", + "description": " Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.", + "canonical": true, + "file": "sql_ssl_certs_service.insert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1.SqlSslCertsService.Insert", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.SslCertsInsertRequest" + } + ], + "resultType": ".google.cloud.sql.v1.SslCertsInsertResponse", + "client": { + "shortName": "SqlSslCertsServiceClient", + "fullName": "google.cloud.sql.v1.SqlSslCertsServiceClient" + }, + "method": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1.SqlSslCertsService.Insert", + "service": { + "shortName": "SqlSslCertsService", + "fullName": "google.cloud.sql.v1.SqlSslCertsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlSslCertsService_List_async", + "title": "SqlAvailableDatabaseVersionsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists all of the current SSL certificates for the instance.", + "canonical": true, + "file": "sql_ssl_certs_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlSslCertsService.List", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.SslCertsListResponse", + "client": { + "shortName": "SqlSslCertsServiceClient", + "fullName": "google.cloud.sql.v1.SqlSslCertsServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlSslCertsService.List", + "service": { + "shortName": "SqlSslCertsService", + "fullName": "google.cloud.sql.v1.SqlSslCertsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlTiersService_List_async", + "title": "SqlAvailableDatabaseVersionsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists all available machine types (tiers) for Cloud SQL, for example, `db-custom-1-3840`. For more information, see https://cloud.google.com/sql/pricing.", + "canonical": true, + "file": "sql_tiers_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlTiersService.List", + "async": true, + "parameters": [ + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.TiersListResponse", + "client": { + "shortName": "SqlTiersServiceClient", + "fullName": "google.cloud.sql.v1.SqlTiersServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlTiersService.List", + "service": { + "shortName": "SqlTiersService", + "fullName": "google.cloud.sql.v1.SqlTiersService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlUsersService_Delete_async", + "title": "SqlAvailableDatabaseVersionsService delete Sample", + "origin": "API_DEFINITION", + "description": " Deletes a user from a Cloud SQL instance.", + "canonical": true, + "file": "sql_users_service.delete.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1.SqlUsersService.Delete", + "async": true, + "parameters": [ + { + "name": "host", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlUsersServiceClient", + "fullName": "google.cloud.sql.v1.SqlUsersServiceClient" + }, + "method": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1.SqlUsersService.Delete", + "service": { + "shortName": "SqlUsersService", + "fullName": "google.cloud.sql.v1.SqlUsersService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlUsersService_Get_async", + "title": "SqlAvailableDatabaseVersionsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a resource containing information about a user.", + "canonical": true, + "file": "sql_users_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlUsersService.Get", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "host", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.User", + "client": { + "shortName": "SqlUsersServiceClient", + "fullName": "google.cloud.sql.v1.SqlUsersServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1.SqlUsersService.Get", + "service": { + "shortName": "SqlUsersService", + "fullName": "google.cloud.sql.v1.SqlUsersService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlUsersService_Insert_async", + "title": "SqlAvailableDatabaseVersionsService insert Sample", + "origin": "API_DEFINITION", + "description": " Creates a new user in a Cloud SQL instance.", + "canonical": true, + "file": "sql_users_service.insert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1.SqlUsersService.Insert", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.User" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlUsersServiceClient", + "fullName": "google.cloud.sql.v1.SqlUsersServiceClient" + }, + "method": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1.SqlUsersService.Insert", + "service": { + "shortName": "SqlUsersService", + "fullName": "google.cloud.sql.v1.SqlUsersService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlUsersService_List_async", + "title": "SqlAvailableDatabaseVersionsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists users in the specified Cloud SQL instance.", + "canonical": true, + "file": "sql_users_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlUsersService.List", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1.UsersListResponse", + "client": { + "shortName": "SqlUsersServiceClient", + "fullName": "google.cloud.sql.v1.SqlUsersServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1.SqlUsersService.List", + "service": { + "shortName": "SqlUsersService", + "fullName": "google.cloud.sql.v1.SqlUsersService" + } + } + } + }, + { + "regionTag": "sqladmin_v1_generated_SqlUsersService_Update_async", + "title": "SqlAvailableDatabaseVersionsService update Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing user in a Cloud SQL instance.", + "canonical": true, + "file": "sql_users_service.update.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1.SqlUsersService.Update", + "async": true, + "parameters": [ + { + "name": "host", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "database_roles", + "type": "TYPE_STRING[]" + }, + { + "name": "revoke_existing_roles", + "type": "TYPE_BOOL" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1.User" + } + ], + "resultType": ".google.cloud.sql.v1.Operation", + "client": { + "shortName": "SqlUsersServiceClient", + "fullName": "google.cloud.sql.v1.SqlUsersServiceClient" + }, + "method": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1.SqlUsersService.Update", + "service": { + "shortName": "SqlUsersService", + "fullName": "google.cloud.sql.v1.SqlUsersService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.delete.js new file mode 100644 index 000000000000..c03ebf2c57b1 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.delete.js @@ -0,0 +1,70 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlBackupRunsService_Delete_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The ID of the backup run to delete. To find a backup run ID, use the + * list (https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list) + * method. + */ + // const id = 1234 + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlBackupRunsServiceClient(); + + async function callDelete() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.delete(request); + console.log(response); + } + + callDelete(); + // [END sqladmin_v1_generated_SqlBackupRunsService_Delete_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.get.js new file mode 100644 index 000000000000..867147b44057 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.get.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlBackupRunsService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The ID of this backup run. + */ + // const id = 1234 + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlBackupRunsServiceClient(); + + async function callGet() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1_generated_SqlBackupRunsService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.insert.js new file mode 100644 index 000000000000..a01b73476709 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.insert.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlBackupRunsService_Insert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlBackupRunsServiceClient(); + + async function callInsert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.insert(request); + console.log(response); + } + + callInsert(); + // [END sqladmin_v1_generated_SqlBackupRunsService_Insert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.list.js new file mode 100644 index 000000000000..627d76725262 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.list.js @@ -0,0 +1,74 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlBackupRunsService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID, or "-" for all instances. This does not include + * the project ID. + */ + // const instance = 'abc123' + /** + * Maximum number of backup runs per response. + */ + // const maxResults = 1234 + /** + * A previously-returned page token representing part of the larger set of + * results to view. + */ + // const pageToken = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlBackupRunsServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1_generated_SqlBackupRunsService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.create_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.create_backup.js new file mode 100644 index 000000000000..466f37bf8bb3 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.create_backup.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, backup) { + // [START sqladmin_v1_generated_SqlBackupsService_CreateBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource where this backup is created. + * Format: projects/{project} + */ + // const parent = 'abc123' + /** + * Required. The Backup to create. + */ + // const backup = {} + + // Imports the Sql library + const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlBackupsServiceClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backup, + }; + + // Run request + const response = await sqlClient.createBackup(request); + console.log(response); + } + + callCreateBackup(); + // [END sqladmin_v1_generated_SqlBackupsService_CreateBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.delete_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.delete_backup.js new file mode 100644 index 000000000000..497ecbdf237b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.delete_backup.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START sqladmin_v1_generated_SqlBackupsService_DeleteBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the backup to delete. + * Format: projects/{project}/backups/{backup} + */ + // const name = 'abc123' + + // Imports the Sql library + const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlBackupsServiceClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await sqlClient.deleteBackup(request); + console.log(response); + } + + callDeleteBackup(); + // [END sqladmin_v1_generated_SqlBackupsService_DeleteBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.get_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.get_backup.js new file mode 100644 index 000000000000..110e6dc6f41f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.get_backup.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START sqladmin_v1_generated_SqlBackupsService_GetBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the backup to retrieve. + * Format: projects/{project}/backups/{backup} + */ + // const name = 'abc123' + + // Imports the Sql library + const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlBackupsServiceClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await sqlClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END sqladmin_v1_generated_SqlBackupsService_GetBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.list_backups.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.list_backups.js new file mode 100644 index 000000000000..a0aac56639b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.list_backups.js @@ -0,0 +1,86 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START sqladmin_v1_generated_SqlBackupsService_ListBackups_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + */ + // const parent = 'abc123' + /** + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + */ + // const filter = 'abc123' + + // Imports the Sql library + const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlBackupsServiceClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = sqlClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END sqladmin_v1_generated_SqlBackupsService_ListBackups_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.update_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.update_backup.js new file mode 100644 index 000000000000..704bbba7616d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.update_backup.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(backup) { + // [START sqladmin_v1_generated_SqlBackupsService_UpdateBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The backup to update. + * The backup’s `name` field is used to identify the backup to update. + * Format: projects/{project}/backups/{backup} + */ + // const backup = {} + /** + * The list of fields that you can update. You can update only the description + * and retention period of the final backup. + */ + // const updateMask = {} + + // Imports the Sql library + const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlBackupsServiceClient(); + + async function callUpdateBackup() { + // Construct request + const request = { + backup, + }; + + // Run request + const response = await sqlClient.updateBackup(request); + console.log(response); + } + + callUpdateBackup(); + // [END sqladmin_v1_generated_SqlBackupsService_UpdateBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js new file mode 100644 index 000000000000..0f587bb4183c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js @@ -0,0 +1,81 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * PEM encoded public key to include in the signed certificate. + */ + // const publicKey = 'abc123' + /** + * Optional. Access token to include in the signed certificate. + */ + // const accessToken = 'abc123' + /** + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + */ + // const readTime = {} + /** + * Optional. If set, it will contain the cert valid duration. + */ + // const validDuration = {} + + // Imports the Sql library + const {SqlConnectServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlConnectServiceClient(); + + async function callGenerateEphemeralCert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.generateEphemeralCert(request); + console.log(response); + } + + callGenerateEphemeralCert(); + // [END sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.get_connect_settings.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.get_connect_settings.js new file mode 100644 index 000000000000..60e53daeec94 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.get_connect_settings.js @@ -0,0 +1,69 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlConnectService_GetConnectSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + */ + // const readTime = {} + + // Imports the Sql library + const {SqlConnectServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlConnectServiceClient(); + + async function callGetConnectSettings() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.getConnectSettings(request); + console.log(response); + } + + callGetConnectSettings(); + // [END sqladmin_v1_generated_SqlConnectService_GetConnectSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.delete.js new file mode 100644 index 000000000000..6430023a18b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.delete.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlDatabasesService_Delete_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the database to be deleted in the instance. + */ + // const database = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callDelete() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.delete(request); + console.log(response); + } + + callDelete(); + // [END sqladmin_v1_generated_SqlDatabasesService_Delete_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.get.js new file mode 100644 index 000000000000..86762f7225f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.get.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlDatabasesService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the database in the instance. + */ + // const database = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callGet() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1_generated_SqlDatabasesService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.insert.js new file mode 100644 index 000000000000..7bbb93000a88 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.insert.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlDatabasesService_Insert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callInsert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.insert(request); + console.log(response); + } + + callInsert(); + // [END sqladmin_v1_generated_SqlDatabasesService_Insert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.list.js new file mode 100644 index 000000000000..73b3f149793c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.list.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlDatabasesService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1_generated_SqlDatabasesService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.patch.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.patch.js new file mode 100644 index 000000000000..4918b9ad5950 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.patch.js @@ -0,0 +1,71 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlDatabasesService_Patch_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the database to be updated in the instance. + */ + // const database = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callPatch() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.patch(request); + console.log(response); + } + + callPatch(); + // [END sqladmin_v1_generated_SqlDatabasesService_Patch_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.update.js new file mode 100644 index 000000000000..07f453ad6eaa --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.update.js @@ -0,0 +1,71 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlDatabasesService_Update_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the database to be updated in the instance. + */ + // const database = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callUpdate() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.update(request); + console.log(response); + } + + callUpdate(); + // [END sqladmin_v1_generated_SqlDatabasesService_Update_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_flags_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_flags_service.list.js new file mode 100644 index 000000000000..29b61a2e573b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_flags_service.list.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlFlagsService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database type and version you want to retrieve flags for. By default, this + * method returns flags for all database types and versions. + */ + // const databaseVersion = 'abc123' + /** + * Optional. Specify the scope of flags to be returned by SqlFlagsListService. + * Return list of database flags if unspecified. + */ + // const flagScope = {} + + // Imports the Sql library + const {SqlFlagsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlFlagsServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1_generated_SqlFlagsService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js new file mode 100644 index 000000000000..59784cd77f78 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js @@ -0,0 +1,75 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project, body) { + // [START sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This doesn't include the project ID. It's + * composed of lowercase letters, numbers, and hyphens, and it must start with + * a letter. The total length must be 98 characters or less (Example: + * instance-id). + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance (Example: + * project-id). + */ + // const project = 'my-project' + /** + * Required. The request body. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callAcquireSsrsLease() { + // Construct request + const request = { + instance, + project, + body, + }; + + // Run request + const response = await sqlClient.acquireSsrsLease(request); + console.log(response); + } + + callAcquireSsrsLease(); + // [END sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_entra_id_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_entra_id_certificate.js new file mode 100644 index 000000000000..9f6f8628f622 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_entra_id_certificate.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callAddEntraIdCertificate() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.addEntraIdCertificate(request); + console.log(response); + } + + callAddEntraIdCertificate(); + // [END sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_ca.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_ca.js new file mode 100644 index 000000000000..40e9895d5e0d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_ca.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_AddServerCa_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callAddServerCa() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.addServerCa(request); + console.log(response); + } + + callAddServerCa(); + // [END sqladmin_v1_generated_SqlInstancesService_AddServerCa_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_certificate.js new file mode 100644 index 000000000000..622d2b0bf852 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_certificate.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callAddServerCertificate() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.addServerCertificate(request); + console.log(response); + } + + callAddServerCertificate(); + // [END sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js new file mode 100644 index 000000000000..e8213ce4277d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js @@ -0,0 +1,71 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project, body) { + // [START sqladmin_v1_generated_SqlInstancesService_Clone_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The ID of the Cloud SQL instance to be cloned (source). This does + * not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the source Cloud SQL instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callClone() { + // Construct request + const request = { + instance, + project, + body, + }; + + // Run request + const response = await sqlClient.clone(request); + console.log(response); + } + + callClone(); + // [END sqladmin_v1_generated_SqlInstancesService_Clone_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.create_ephemeral.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.create_ephemeral.js new file mode 100644 index 000000000000..eae442f73c52 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.create_ephemeral.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the Cloud SQL project. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callCreateEphemeral() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.createEphemeral(request); + console.log(response); + } + + callCreateEphemeral(); + // [END sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.delete.js new file mode 100644 index 000000000000..a7a0883bc2c5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.delete.js @@ -0,0 +1,81 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_Delete_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance to be deleted. + */ + // const project = 'my-project' + /** + * Flag to opt-in for final backup. By default, it is turned off. + */ + // const enableFinalBackup = true + /** + * Optional. Retention period of the final backup. + */ + // const finalBackupTtlDays = 1234 + /** + * Optional. Final Backup expiration time. + * Timestamp in UTC of when this resource is considered expired. + */ + // const finalBackupExpiryTime = {} + /** + * Optional. The description of the final backup. + */ + // const finalBackupDescription = 'abc123' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callDelete() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.delete(request); + console.log(response); + } + + callDelete(); + // [END sqladmin_v1_generated_SqlInstancesService_Delete_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote.js new file mode 100644 index 000000000000..070c22f1f15d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote.js @@ -0,0 +1,71 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project, body) { + // [START sqladmin_v1_generated_SqlInstancesService_Demote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance name. + */ + // const instance = 'abc123' + /** + * Required. ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Required. The request body. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callDemote() { + // Construct request + const request = { + instance, + project, + body, + }; + + // Run request + const response = await sqlClient.demote(request); + console.log(response); + } + + callDemote(); + // [END sqladmin_v1_generated_SqlInstancesService_Demote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote_master.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote_master.js new file mode 100644 index 000000000000..248458e43531 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote_master.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_DemoteMaster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callDemoteMaster() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.demoteMaster(request); + console.log(response); + } + + callDemoteMaster(); + // [END sqladmin_v1_generated_SqlInstancesService_DemoteMaster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.execute_sql.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.execute_sql.js new file mode 100644 index 000000000000..2baf4e163477 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.execute_sql.js @@ -0,0 +1,70 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1_generated_SqlInstancesService_ExecuteSql_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * The request body. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callExecuteSql() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.executeSql(request); + console.log(response); + } + + callExecuteSql(); + // [END sqladmin_v1_generated_SqlInstancesService_ExecuteSql_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.export.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.export.js new file mode 100644 index 000000000000..ec4a82c0a385 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.export.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_Export_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance to be exported. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callExport() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.export(request); + console.log(response); + } + + callExport(); + // [END sqladmin_v1_generated_SqlInstancesService_Export_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.failover.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.failover.js new file mode 100644 index 000000000000..fc9afe077c5b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.failover.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_Failover_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the read replica. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callFailover() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.failover(request); + console.log(response); + } + + callFailover(); + // [END sqladmin_v1_generated_SqlInstancesService_Failover_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get.js new file mode 100644 index 000000000000..90bfac74cbca --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1_generated_SqlInstancesService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callGet() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1_generated_SqlInstancesService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_disk_shrink_config.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_disk_shrink_config.js new file mode 100644 index 000000000000..1c470900f368 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_disk_shrink_config.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callGetDiskShrinkConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.getDiskShrinkConfig(request); + console.log(response); + } + + callGetDiskShrinkConfig(); + // [END sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_latest_recovery_time.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_latest_recovery_time.js new file mode 100644 index 000000000000..88b574468ec1 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_latest_recovery_time.js @@ -0,0 +1,69 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * The timestamp used to identify the time when the source instance is + * deleted. If this instance is deleted, then you must set the timestamp. + */ + // const sourceInstanceDeletionTime = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callGetLatestRecoveryTime() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.getLatestRecoveryTime(request); + console.log(response); + } + + callGetLatestRecoveryTime(); + // [END sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.import.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.import.js new file mode 100644 index 000000000000..3c2f8afb1990 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.import.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_Import_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callImport() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.import(request); + console.log(response); + } + + callImport(); + // [END sqladmin_v1_generated_SqlInstancesService_Import_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.insert.js new file mode 100644 index 000000000000..4ca794e4e729 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.insert.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_Insert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Project ID of the project to which the newly created Cloud SQL instances + * should belong. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callInsert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.insert(request); + console.log(response); + } + + callInsert(); + // [END sqladmin_v1_generated_SqlInstancesService_Insert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list.js new file mode 100644 index 000000000000..5ed7ab3c662a --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list.js @@ -0,0 +1,83 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * A filter expression that filters resources listed in the response. + * The expression is in the form of field:value. For example, + * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per + * their JSON representation, such as 'settings.userLabels.auto_start:true'. + * Multiple filter queries are space-separated. For example. + * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each + * expression is an AND expression. However, you can include AND and OR + * expressions explicitly. + */ + // const filter = 'abc123' + /** + * The maximum number of instances to return. The service may return fewer + * than this value. + * If unspecified, at most 500 instances are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + */ + // const maxResults = 1234 + /** + * A previously-returned page token representing part of the larger set of + * results to view. + */ + // const pageToken = 'abc123' + /** + * Project ID of the project for which to list Cloud SQL instances. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1_generated_SqlInstancesService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_entra_id_certificates.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_entra_id_certificates.js new file mode 100644 index 000000000000..30a74340cd6d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_entra_id_certificates.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callListEntraIdCertificates() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.listEntraIdCertificates(request); + console.log(response); + } + + callListEntraIdCertificates(); + // [END sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_cas.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_cas.js new file mode 100644 index 000000000000..f08365357218 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_cas.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_ListServerCas_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callListServerCas() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.listServerCas(request); + console.log(response); + } + + callListServerCas(); + // [END sqladmin_v1_generated_SqlInstancesService_ListServerCas_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_certificates.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_certificates.js new file mode 100644 index 000000000000..f4d91f9d8703 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_certificates.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callListServerCertificates() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.listServerCertificates(request); + console.log(response); + } + + callListServerCertificates(); + // [END sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.patch.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.patch.js new file mode 100644 index 000000000000..8cc125fc4492 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.patch.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_Patch_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callPatch() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.patch(request); + console.log(response); + } + + callPatch(); + // [END sqladmin_v1_generated_SqlInstancesService_Patch_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.perform_disk_shrink.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.perform_disk_shrink.js new file mode 100644 index 000000000000..bea8a94fdbb3 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.perform_disk_shrink.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Perform disk shrink context. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callPerformDiskShrink() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.performDiskShrink(request); + console.log(response); + } + + callPerformDiskShrink(); + // [END sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.point_in_time_restore.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.point_in_time_restore.js new file mode 100644 index 000000000000..f58df2ca7d9a --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.point_in_time_restore.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, context) { + // [START sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource where you created this instance. + * Format: projects/{project} + */ + // const parent = 'abc123' + /** + * Required. The context for request to perform a PITR on a Google Cloud + * Backup and Disaster Recovery managed instance. + */ + // const context = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callPointInTimeRestore() { + // Construct request + const request = { + parent, + context, + }; + + // Run request + const response = await sqlClient.pointInTimeRestore(request); + console.log(response); + } + + callPointInTimeRestore(); + // [END sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js new file mode 100644 index 000000000000..7bfbd08b94d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js @@ -0,0 +1,72 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project, body) { + // [START sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Required. The context for request to perform the pre-check major version + * upgrade operation. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callPreCheckMajorVersionUpgrade() { + // Construct request + const request = { + instance, + project, + body, + }; + + // Run request + const response = await sqlClient.preCheckMajorVersionUpgrade(request); + console.log(response); + } + + callPreCheckMajorVersionUpgrade(); + // [END sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.promote_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.promote_replica.js new file mode 100644 index 000000000000..c97cde80216e --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.promote_replica.js @@ -0,0 +1,73 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_PromoteReplica_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL read replica instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the read replica. + */ + // const project = 'my-project' + /** + * Set to true to invoke a replica failover to the DR + * replica. As part of replica failover, the promote operation attempts + * to add the original primary instance as a replica of the promoted + * DR replica when the original primary instance comes back online. + * If set to false or not specified, then the original primary + * instance becomes an independent Cloud SQL primary instance. + */ + // const failover = true + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callPromoteReplica() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.promoteReplica(request); + console.log(response); + } + + callPromoteReplica(); + // [END sqladmin_v1_generated_SqlInstancesService_PromoteReplica_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reencrypt.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reencrypt.js new file mode 100644 index 000000000000..02836183f717 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reencrypt.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_Reencrypt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Reencrypt body that users request + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callReencrypt() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.reencrypt(request); + console.log(response); + } + + callReencrypt(); + // [END sqladmin_v1_generated_SqlInstancesService_Reencrypt_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.release_ssrs_lease.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.release_ssrs_lease.js new file mode 100644 index 000000000000..ee402959f3bf --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.release_ssrs_lease.js @@ -0,0 +1,69 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Cloud SQL instance ID. This doesn't include the project ID. + * The instance ID contains lowercase letters, numbers, and hyphens, and it + * must start with a letter. This ID can have a maximum length of 98 + * characters. + */ + // const instance = 'abc123' + /** + * Required. The project ID that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callReleaseSsrsLease() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.releaseSsrsLease(request); + console.log(response); + } + + callReleaseSsrsLease(); + // [END sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reschedule_maintenance.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reschedule_maintenance.js new file mode 100644 index 000000000000..ee85f3286055 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reschedule_maintenance.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRescheduleMaintenance() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.rescheduleMaintenance(request); + console.log(response); + } + + callRescheduleMaintenance(); + // [END sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_replica_size.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_replica_size.js new file mode 100644 index 000000000000..81e4bb4b4f5b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_replica_size.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL read replica instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the read replica. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callResetReplicaSize() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.resetReplicaSize(request); + console.log(response); + } + + callResetReplicaSize(); + // [END sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_ssl_config.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_ssl_config.js new file mode 100644 index 000000000000..059f10bc1f89 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_ssl_config.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Optional. Reset SSL mode to use. + */ + // const mode = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callResetSslConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.resetSslConfig(request); + console.log(response); + } + + callResetSslConfig(); + // [END sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restart.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restart.js new file mode 100644 index 000000000000..2c91617c87fa --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restart.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_Restart_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance to be restarted. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRestart() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.restart(request); + console.log(response); + } + + callRestart(); + // [END sqladmin_v1_generated_SqlInstancesService_Restart_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restore_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restore_backup.js new file mode 100644 index 000000000000..401b5ad08d8c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restore_backup.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_RestoreBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRestoreBackup() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.restoreBackup(request); + console.log(response); + } + + callRestoreBackup(); + // [END sqladmin_v1_generated_SqlInstancesService_RestoreBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js new file mode 100644 index 000000000000..00835e932fb5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js @@ -0,0 +1,70 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Optional. Rotate Entra ID certificate request body. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRotateEntraIdCertificate() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.rotateEntraIdCertificate(request); + console.log(response); + } + + callRotateEntraIdCertificate(); + // [END sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_ca.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_ca.js new file mode 100644 index 000000000000..4fd54a95b9d4 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_ca.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_RotateServerCa_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRotateServerCa() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.rotateServerCa(request); + console.log(response); + } + + callRotateServerCa(); + // [END sqladmin_v1_generated_SqlInstancesService_RotateServerCa_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_certificate.js new file mode 100644 index 000000000000..96260974d5b1 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_certificate.js @@ -0,0 +1,70 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Optional. Rotate server certificate request body. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRotateServerCertificate() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.rotateServerCertificate(request); + console.log(response); + } + + callRotateServerCertificate(); + // [END sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_external_sync.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_external_sync.js new file mode 100644 index 000000000000..e092b5da92fb --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_external_sync.js @@ -0,0 +1,94 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_StartExternalSync_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * External sync mode. + */ + // const syncMode = {} + /** + * Whether to skip the verification step (VESS). + */ + // const skipVerification = true + /** + * MySQL-specific settings for start external sync. + */ + // const mysqlSyncConfig = {} + /** + * Optional. Parallel level for initial data sync. Currently only applicable + * for MySQL. + */ + // const syncParallelLevel = {} + /** + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + */ + // const migrationType = {} + /** + * Optional. MySQL only. True if end-user has confirmed that this SES call + * will wipe replica databases overlapping with the proposed selected_objects. + * If this field is not set and there are both overlapping and additional + * databases proposed, an error will be returned. + */ + // const replicaOverwriteEnabled = true + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callStartExternalSync() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.startExternalSync(request); + console.log(response); + } + + callStartExternalSync(); + // [END sqladmin_v1_generated_SqlInstancesService_StartExternalSync_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_replica.js new file mode 100644 index 000000000000..45042f654198 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_replica.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_StartReplica_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL read replica instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the read replica. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callStartReplica() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.startReplica(request); + console.log(response); + } + + callStartReplica(); + // [END sqladmin_v1_generated_SqlInstancesService_StartReplica_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.stop_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.stop_replica.js new file mode 100644 index 000000000000..ea2fe1fe0f91 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.stop_replica.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_StopReplica_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL read replica instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the read replica. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callStopReplica() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.stopReplica(request); + console.log(response); + } + + callStopReplica(); + // [END sqladmin_v1_generated_SqlInstancesService_StopReplica_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.switchover.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.switchover.js new file mode 100644 index 000000000000..044709c588b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.switchover.js @@ -0,0 +1,70 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_Switchover_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL read replica instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the replica. + */ + // const project = 'my-project' + /** + * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations + * timeout, which is a sum of all database operations. Default value is 10 + * minutes and can be modified to a maximum value of 24 hours. + */ + // const dbTimeout = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callSwitchover() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.switchover(request); + console.log(response); + } + + callSwitchover(); + // [END sqladmin_v1_generated_SqlInstancesService_Switchover_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.truncate_log.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.truncate_log.js new file mode 100644 index 000000000000..c062db6cfd65 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.truncate_log.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_TruncateLog_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the Cloud SQL project. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callTruncateLog() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.truncateLog(request); + console.log(response); + } + + callTruncateLog(); + // [END sqladmin_v1_generated_SqlInstancesService_TruncateLog_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.update.js new file mode 100644 index 000000000000..2d50f4e4f277 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.update.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_Update_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callUpdate() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.update(request); + console.log(response); + } + + callUpdate(); + // [END sqladmin_v1_generated_SqlInstancesService_Update_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.verify_external_sync_settings.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.verify_external_sync_settings.js new file mode 100644 index 000000000000..d8fe16160719 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.verify_external_sync_settings.js @@ -0,0 +1,96 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Flag to enable verifying connection only + */ + // const verifyConnectionOnly = true + /** + * External sync mode + */ + // const syncMode = {} + /** + * Optional. Flag to verify settings required by replication setup only + */ + // const verifyReplicationOnly = true + /** + * Optional. MySQL-specific settings for start external sync. + */ + // const mysqlSyncConfig = {} + /** + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + */ + // const migrationType = {} + /** + * Optional. Parallel level for initial data sync. Only applicable for + * PostgreSQL. + */ + // const syncParallelLevel = {} + /** + * Optional. Migrate only the specified objects from the source instance. If + * this field is empty, then migrate all objects. + */ + // const selectedObjects = [1,2,3,4] + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callVerifyExternalSyncSettings() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.verifyExternalSyncSettings(request); + console.log(response); + } + + callVerifyExternalSyncSettings(); + // [END sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.cancel.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.cancel.js new file mode 100644 index 000000000000..90a6025243d5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.cancel.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlOperationsService_Cancel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Instance operation ID. + */ + // const operation = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlOperationsServiceClient(); + + async function callCancel() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.cancel(request); + console.log(response); + } + + callCancel(); + // [END sqladmin_v1_generated_SqlOperationsService_Cancel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.get.js new file mode 100644 index 000000000000..ffe5ebf842ec --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.get.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(operation, project) { + // [START sqladmin_v1_generated_SqlOperationsService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Instance operation ID. + */ + // const operation = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlOperationsServiceClient(); + + async function callGet() { + // Construct request + const request = { + operation, + project, + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1_generated_SqlOperationsService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.list.js new file mode 100644 index 000000000000..ab7710090943 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.list.js @@ -0,0 +1,73 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlOperationsService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Maximum number of operations per response. + */ + // const maxResults = 1234 + /** + * A previously-returned page token representing part of the larger set of + * results to view. + */ + // const pageToken = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlOperationsServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1_generated_SqlOperationsService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.delete.js new file mode 100644 index 000000000000..1b9e728c99b0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.delete.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlSslCertsService_Delete_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Sha1 FingerPrint. + */ + // const sha1Fingerprint = 'abc123' + + // Imports the Sql library + const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlSslCertsServiceClient(); + + async function callDelete() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.delete(request); + console.log(response); + } + + callDelete(); + // [END sqladmin_v1_generated_SqlSslCertsService_Delete_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.get.js new file mode 100644 index 000000000000..30ec37159783 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.get.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlSslCertsService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Sha1 FingerPrint. + */ + // const sha1Fingerprint = 'abc123' + + // Imports the Sql library + const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlSslCertsServiceClient(); + + async function callGet() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1_generated_SqlSslCertsService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.insert.js new file mode 100644 index 000000000000..42dae5471039 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.insert.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlSslCertsService_Insert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlSslCertsServiceClient(); + + async function callInsert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.insert(request); + console.log(response); + } + + callInsert(); + // [END sqladmin_v1_generated_SqlSslCertsService_Insert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.list.js new file mode 100644 index 000000000000..3a55f77a1426 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.list.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlSslCertsService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlSslCertsServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1_generated_SqlSslCertsService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_tiers_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_tiers_service.list.js new file mode 100644 index 000000000000..f3ab61587d33 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_tiers_service.list.js @@ -0,0 +1,60 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlTiersService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Project ID of the project for which to list tiers. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlTiersServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlTiersServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1_generated_SqlTiersService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.delete.js new file mode 100644 index 000000000000..7da3027f3ed2 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.delete.js @@ -0,0 +1,72 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlUsersService_Delete_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Host of the user in the instance. + */ + // const host = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Name of the user in the instance. + */ + // const name = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlUsersServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlUsersServiceClient(); + + async function callDelete() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.delete(request); + console.log(response); + } + + callDelete(); + // [END sqladmin_v1_generated_SqlUsersService_Delete_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.get.js new file mode 100644 index 000000000000..e43ccc5a1d96 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.get.js @@ -0,0 +1,72 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlUsersService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * User of the instance. + */ + // const name = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Host of a user of the instance. + */ + // const host = 'abc123' + + // Imports the Sql library + const {SqlUsersServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlUsersServiceClient(); + + async function callGet() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1_generated_SqlUsersService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.insert.js new file mode 100644 index 000000000000..6a1b0e7c0ca3 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.insert.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlUsersService_Insert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlUsersServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlUsersServiceClient(); + + async function callInsert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.insert(request); + console.log(response); + } + + callInsert(); + // [END sqladmin_v1_generated_SqlUsersService_Insert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.list.js new file mode 100644 index 000000000000..5c2ed4306dde --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.list.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlUsersService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlUsersServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlUsersServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1_generated_SqlUsersService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.update.js new file mode 100644 index 000000000000..2db92883fbaa --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.update.js @@ -0,0 +1,86 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1_generated_SqlUsersService_Update_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. Host of the user in the instance. + */ + // const host = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Name of the user in the instance. + */ + // const name = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Optional. List of database roles to grant to the user. body.database_roles + * will be ignored for update request. + */ + // const databaseRoles = ['abc','def'] + /** + * Optional. Specifies whether to revoke existing roles that are not present + * in the `database_roles` field. If `false` or unset, the database roles + * specified in `database_roles` are added to the user's existing roles. + */ + // const revokeExistingRoles = true + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlUsersServiceClient} = require('@google-cloud/sql').v1; + + // Instantiates a client + const sqlClient = new SqlUsersServiceClient(); + + async function callUpdate() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.update(request); + console.log(response); + } + + callUpdate(); + // [END sqladmin_v1_generated_SqlUsersService_Update_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json new file mode 100644 index 000000000000..3806a1cf62ff --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json @@ -0,0 +1,3567 @@ +{ + "clientLibrary": { + "name": "nodejs-sql", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.sql.v1beta4", + "version": "v1beta4" + } + ] + }, + "snippets": [ + { + "regionTag": "sqladmin_v1beta4_generated_SqlBackupRunsService_Delete_async", + "title": "SqlBackupRunsService delete Sample", + "origin": "API_DEFINITION", + "description": " Deletes the backup taken by a backup run.", + "canonical": true, + "file": "sql_backup_runs_service.delete.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Delete", + "async": true, + "parameters": [ + { + "name": "id", + "type": "TYPE_INT64" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlBackupRunsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsServiceClient" + }, + "method": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Delete", + "service": { + "shortName": "SqlBackupRunsService", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlBackupRunsService_Get_async", + "title": "SqlBackupRunsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a resource containing information about a backup run.", + "canonical": true, + "file": "sql_backup_runs_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Get", + "async": true, + "parameters": [ + { + "name": "id", + "type": "TYPE_INT64" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.BackupRun", + "client": { + "shortName": "SqlBackupRunsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Get", + "service": { + "shortName": "SqlBackupRunsService", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlBackupRunsService_Insert_async", + "title": "SqlBackupRunsService insert Sample", + "origin": "API_DEFINITION", + "description": " Creates a new backup run on demand.", + "canonical": true, + "file": "sql_backup_runs_service.insert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Insert", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.BackupRun" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlBackupRunsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsServiceClient" + }, + "method": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Insert", + "service": { + "shortName": "SqlBackupRunsService", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlBackupRunsService_List_async", + "title": "SqlBackupRunsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists all backup runs associated with the project or a given instance and configuration in the reverse chronological order of the backup initiation time.", + "canonical": true, + "file": "sql_backup_runs_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.List", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "max_results", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.BackupRunsListResponse", + "client": { + "shortName": "SqlBackupRunsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.List", + "service": { + "shortName": "SqlBackupRunsService", + "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlBackupsService_CreateBackup_async", + "title": "SqlBackupRunsService createBackup Sample", + "origin": "API_DEFINITION", + "description": " Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.", + "canonical": true, + "file": "sql_backups_service.create_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateBackup", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.CreateBackup", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "backup", + "type": ".google.cloud.sql.v1beta4.Backup" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlBackupsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsServiceClient" + }, + "method": { + "shortName": "CreateBackup", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.CreateBackup", + "service": { + "shortName": "SqlBackupsService", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlBackupsService_GetBackup_async", + "title": "SqlBackupRunsService getBackup Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a resource containing information about a backup.", + "canonical": true, + "file": "sql_backups_service.get_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetBackup", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.GetBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Backup", + "client": { + "shortName": "SqlBackupsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsServiceClient" + }, + "method": { + "shortName": "GetBackup", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.GetBackup", + "service": { + "shortName": "SqlBackupsService", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlBackupsService_ListBackups_async", + "title": "SqlBackupRunsService listBackups Sample", + "origin": "API_DEFINITION", + "description": " Lists all backups associated with the project.", + "canonical": true, + "file": "sql_backups_service.list_backups.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListBackups", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.ListBackups", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.ListBackupsResponse", + "client": { + "shortName": "SqlBackupsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsServiceClient" + }, + "method": { + "shortName": "ListBackups", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.ListBackups", + "service": { + "shortName": "SqlBackupsService", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlBackupsService_UpdateBackup_async", + "title": "SqlBackupRunsService updateBackup Sample", + "origin": "API_DEFINITION", + "description": " Updates the retention period and the description of the backup. You can use this API to update final backups only.", + "canonical": true, + "file": "sql_backups_service.update_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateBackup", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.UpdateBackup", + "async": true, + "parameters": [ + { + "name": "backup", + "type": ".google.cloud.sql.v1beta4.Backup" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlBackupsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsServiceClient" + }, + "method": { + "shortName": "UpdateBackup", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.UpdateBackup", + "service": { + "shortName": "SqlBackupsService", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlBackupsService_DeleteBackup_async", + "title": "SqlBackupRunsService deleteBackup Sample", + "origin": "API_DEFINITION", + "description": " Deletes the backup.", + "canonical": true, + "file": "sql_backups_service.delete_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.DeleteBackup", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlBackupsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsServiceClient" + }, + "method": { + "shortName": "DeleteBackup", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.DeleteBackup", + "service": { + "shortName": "SqlBackupsService", + "fullName": "google.cloud.sql.v1beta4.SqlBackupsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlConnectService_GetConnectSettings_async", + "title": "SqlBackupRunsService getConnectSettings Sample", + "origin": "API_DEFINITION", + "description": " Retrieves connect settings about a Cloud SQL instance.", + "canonical": true, + "file": "sql_connect_service.get_connect_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConnectSettings", + "fullName": "google.cloud.sql.v1beta4.SqlConnectService.GetConnectSettings", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.sql.v1beta4.ConnectSettings", + "client": { + "shortName": "SqlConnectServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlConnectServiceClient" + }, + "method": { + "shortName": "GetConnectSettings", + "fullName": "google.cloud.sql.v1beta4.SqlConnectService.GetConnectSettings", + "service": { + "shortName": "SqlConnectService", + "fullName": "google.cloud.sql.v1beta4.SqlConnectService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlConnectService_GenerateEphemeralCert_async", + "title": "SqlBackupRunsService generateEphemeralCert Sample", + "origin": "API_DEFINITION", + "description": " Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.", + "canonical": true, + "file": "sql_connect_service.generate_ephemeral_cert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GenerateEphemeralCert", + "fullName": "google.cloud.sql.v1beta4.SqlConnectService.GenerateEphemeralCert", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "public_key", + "type": "TYPE_STRING" + }, + { + "name": "access_token", + "type": "TYPE_STRING" + }, + { + "name": "read_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "valid_duration", + "type": ".google.protobuf.Duration" + } + ], + "resultType": ".google.cloud.sql.v1beta4.GenerateEphemeralCertResponse", + "client": { + "shortName": "SqlConnectServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlConnectServiceClient" + }, + "method": { + "shortName": "GenerateEphemeralCert", + "fullName": "google.cloud.sql.v1beta4.SqlConnectService.GenerateEphemeralCert", + "service": { + "shortName": "SqlConnectService", + "fullName": "google.cloud.sql.v1beta4.SqlConnectService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_Delete_async", + "title": "SqlBackupRunsService delete Sample", + "origin": "API_DEFINITION", + "description": " Deletes a database from a Cloud SQL instance.", + "canonical": true, + "file": "sql_databases_service.delete.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Delete", + "async": true, + "parameters": [ + { + "name": "database", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Delete", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_Get_async", + "title": "SqlBackupRunsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a resource containing information about a database inside a Cloud SQL instance.", + "canonical": true, + "file": "sql_databases_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Get", + "async": true, + "parameters": [ + { + "name": "database", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Database", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Get", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_Insert_async", + "title": "SqlBackupRunsService insert Sample", + "origin": "API_DEFINITION", + "description": " Inserts a resource containing information about a database inside a Cloud SQL instance. **Note:** You can't modify the default character set and collation.", + "canonical": true, + "file": "sql_databases_service.insert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Insert", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.Database" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Insert", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_List_async", + "title": "SqlBackupRunsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists databases in the specified Cloud SQL instance.", + "canonical": true, + "file": "sql_databases_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.List", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.DatabasesListResponse", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.List", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_Patch_async", + "title": "SqlBackupRunsService patch Sample", + "origin": "API_DEFINITION", + "description": " Partially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.", + "canonical": true, + "file": "sql_databases_service.patch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Patch", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Patch", + "async": true, + "parameters": [ + { + "name": "database", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.Database" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "Patch", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Patch", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_Update_async", + "title": "SqlBackupRunsService update Sample", + "origin": "API_DEFINITION", + "description": " Updates a resource containing information about a database inside a Cloud SQL instance.", + "canonical": true, + "file": "sql_databases_service.update.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Update", + "async": true, + "parameters": [ + { + "name": "database", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.Database" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlDatabasesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" + }, + "method": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Update", + "service": { + "shortName": "SqlDatabasesService", + "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlFlagsService_List_async", + "title": "SqlBackupRunsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists all available database flags for Cloud SQL instances.", + "canonical": true, + "file": "sql_flags_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlFlagsService.List", + "async": true, + "parameters": [ + { + "name": "database_version", + "type": "TYPE_STRING" + }, + { + "name": "flag_scope", + "type": ".google.cloud.sql.v1beta4.SqlFlagScope" + } + ], + "resultType": ".google.cloud.sql.v1beta4.FlagsListResponse", + "client": { + "shortName": "SqlFlagsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlFlagsServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlFlagsService.List", + "service": { + "shortName": "SqlFlagsService", + "fullName": "google.cloud.sql.v1beta4.SqlFlagsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_AddServerCa_async", + "title": "SqlBackupRunsService addServerCa Sample", + "origin": "API_DEFINITION", + "description": " Add a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in. For instances that have enabled Certificate Authority Service (CAS) based server CA, use AddServerCertificate to add a new server certificate.", + "canonical": true, + "file": "sql_instances_service.add_server_ca.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddServerCa", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddServerCa", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "AddServerCa", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddServerCa", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_AddServerCertificate_async", + "title": "SqlBackupRunsService addServerCertificate Sample", + "origin": "API_DEFINITION", + "description": " Add a new trusted server certificate version for the specified instance using Certificate Authority Service (CAS) server CA. Required to prepare for a certificate rotation. If a server certificate version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one certificate version waiting to be rotated in. For instances not using CAS server CA, use AddServerCa instead.", + "canonical": true, + "file": "sql_instances_service.add_server_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddServerCertificate", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddServerCertificate", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "AddServerCertificate", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddServerCertificate", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_AddEntraIdCertificate_async", + "title": "SqlBackupRunsService addEntraIdCertificate Sample", + "origin": "API_DEFINITION", + "description": " Adds a new Entra ID certificate for the specified instance. If an Entra ID certificate was previously added but never used in a certificate rotation, this operation replaces that version.", + "canonical": true, + "file": "sql_instances_service.add_entra_id_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddEntraIdCertificate", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddEntraIdCertificate", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "AddEntraIdCertificate", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddEntraIdCertificate", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Clone_async", + "title": "SqlBackupRunsService clone Sample", + "origin": "API_DEFINITION", + "description": " Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.", + "canonical": true, + "file": "sql_instances_service.clone.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Clone", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Clone", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesCloneRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Clone", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Clone", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Delete_async", + "title": "SqlBackupRunsService delete Sample", + "origin": "API_DEFINITION", + "description": " Deletes a Cloud SQL instance.", + "canonical": true, + "file": "sql_instances_service.delete.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Delete", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "enable_final_backup", + "type": "TYPE_BOOL" + }, + { + "name": "final_backup_ttl_days", + "type": "TYPE_INT64" + }, + { + "name": "final_backup_expiry_time", + "type": ".google.protobuf.Timestamp" + }, + { + "name": "final_backup_description", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Delete", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_DemoteMaster_async", + "title": "SqlBackupRunsService demoteMaster Sample", + "origin": "API_DEFINITION", + "description": " Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.", + "canonical": true, + "file": "sql_instances_service.demote_master.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DemoteMaster", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.DemoteMaster", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesDemoteMasterRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "DemoteMaster", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.DemoteMaster", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Demote_async", + "title": "SqlBackupRunsService demote Sample", + "origin": "API_DEFINITION", + "description": " Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server.", + "canonical": true, + "file": "sql_instances_service.demote.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Demote", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Demote", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesDemoteRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Demote", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Demote", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Export_async", + "title": "SqlBackupRunsService export Sample", + "origin": "API_DEFINITION", + "description": " Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.", + "canonical": true, + "file": "sql_instances_service.export.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Export", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Export", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesExportRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Export", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Export", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Failover_async", + "title": "SqlBackupRunsService failover Sample", + "origin": "API_DEFINITION", + "description": " Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the [Overview of high availability](https://cloud.google.com/sql/docs/mysql/high-availability) page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.", + "canonical": true, + "file": "sql_instances_service.failover.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Failover", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Failover", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesFailoverRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Failover", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Failover", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Reencrypt_async", + "title": "SqlBackupRunsService reencrypt Sample", + "origin": "API_DEFINITION", + "description": " Reencrypt CMEK instance with latest key version.", + "canonical": true, + "file": "sql_instances_service.reencrypt.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Reencrypt", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Reencrypt", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesReencryptRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Reencrypt", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Reencrypt", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Get_async", + "title": "SqlBackupRunsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a resource containing information about a Cloud SQL instance.", + "canonical": true, + "file": "sql_instances_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Get", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.DatabaseInstance", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Get", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Import_async", + "title": "SqlBackupRunsService import Sample", + "origin": "API_DEFINITION", + "description": " Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.", + "canonical": true, + "file": "sql_instances_service.import.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Import", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Import", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesImportRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Import", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Import", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Insert_async", + "title": "SqlBackupRunsService insert Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Cloud SQL instance.", + "canonical": true, + "file": "sql_instances_service.insert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Insert", + "async": true, + "parameters": [ + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.DatabaseInstance" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Insert", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_List_async", + "title": "SqlBackupRunsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists instances under a given project.", + "canonical": true, + "file": "sql_instances_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 75, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.List", + "async": true, + "parameters": [ + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "max_results", + "type": "TYPE_UINT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.InstancesListResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.List", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ListServerCas_async", + "title": "SqlBackupRunsService listServerCas Sample", + "origin": "API_DEFINITION", + "description": " Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.", + "canonical": true, + "file": "sql_instances_service.list_server_cas.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServerCas", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListServerCas", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.InstancesListServerCasResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ListServerCas", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListServerCas", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ListServerCertificates_async", + "title": "SqlBackupRunsService listServerCertificates Sample", + "origin": "API_DEFINITION", + "description": " Lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead.", + "canonical": true, + "file": "sql_instances_service.list_server_certificates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListServerCertificates", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListServerCertificates", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ListServerCertificates", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListServerCertificates", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ListEntraIdCertificates_async", + "title": "SqlBackupRunsService listEntraIdCertificates Sample", + "origin": "API_DEFINITION", + "description": " Lists all versions of EntraID certificates for the specified instance. There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out.", + "canonical": true, + "file": "sql_instances_service.list_entra_id_certificates.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListEntraIdCertificates", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListEntraIdCertificates", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ListEntraIdCertificates", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListEntraIdCertificates", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Patch_async", + "title": "SqlBackupRunsService patch Sample", + "origin": "API_DEFINITION", + "description": " Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.", + "canonical": true, + "file": "sql_instances_service.patch.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Patch", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Patch", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.DatabaseInstance" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Patch", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Patch", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_PromoteReplica_async", + "title": "SqlBackupRunsService promoteReplica Sample", + "origin": "API_DEFINITION", + "description": " Promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.", + "canonical": true, + "file": "sql_instances_service.promote_replica.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PromoteReplica", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PromoteReplica", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "failover", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "PromoteReplica", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PromoteReplica", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Switchover_async", + "title": "SqlBackupRunsService switchover Sample", + "origin": "API_DEFINITION", + "description": " Switches over from the primary instance to the DR replica instance.", + "canonical": true, + "file": "sql_instances_service.switchover.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Switchover", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Switchover", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "db_timeout", + "type": ".google.protobuf.Duration" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Switchover", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Switchover", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ResetSslConfig_async", + "title": "SqlBackupRunsService resetSslConfig Sample", + "origin": "API_DEFINITION", + "description": " Deletes all client certificates and generates a new server SSL certificate for the instance.", + "canonical": true, + "file": "sql_instances_service.reset_ssl_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetSslConfig", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ResetSslConfig", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "mode", + "type": ".google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ResetSslConfig", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ResetSslConfig", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Restart_async", + "title": "SqlBackupRunsService restart Sample", + "origin": "API_DEFINITION", + "description": " Restarts a Cloud SQL instance.", + "canonical": true, + "file": "sql_instances_service.restart.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Restart", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Restart", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Restart", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Restart", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_RestoreBackup_async", + "title": "SqlBackupRunsService restoreBackup Sample", + "origin": "API_DEFINITION", + "description": " Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.", + "canonical": true, + "file": "sql_instances_service.restore_backup.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RestoreBackup", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RestoreBackup", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesRestoreBackupRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "RestoreBackup", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RestoreBackup", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCa_async", + "title": "SqlBackupRunsService rotateServerCa Sample", + "origin": "API_DEFINITION", + "description": " Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use RotateServerCertificate to rotate the server certificate.", + "canonical": true, + "file": "sql_instances_service.rotate_server_ca.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RotateServerCa", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCa", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesRotateServerCaRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "RotateServerCa", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCa", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCertificate_async", + "title": "SqlBackupRunsService rotateServerCertificate Sample", + "origin": "API_DEFINITION", + "description": " Rotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead.", + "canonical": true, + "file": "sql_instances_service.rotate_server_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RotateServerCertificate", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCertificate", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "RotateServerCertificate", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCertificate", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_RotateEntraIdCertificate_async", + "title": "SqlBackupRunsService rotateEntraIdCertificate Sample", + "origin": "API_DEFINITION", + "description": " Rotates the Entra Id certificate version to one previously added with the addEntraIdCertificate method.", + "canonical": true, + "file": "sql_instances_service.rotate_entra_id_certificate.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 63, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RotateEntraIdCertificate", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateEntraIdCertificate", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "RotateEntraIdCertificate", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateEntraIdCertificate", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_StartReplica_async", + "title": "SqlBackupRunsService startReplica Sample", + "origin": "API_DEFINITION", + "description": " Starts the replication in the read replica instance.", + "canonical": true, + "file": "sql_instances_service.start_replica.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartReplica", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StartReplica", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "StartReplica", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StartReplica", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_StopReplica_async", + "title": "SqlBackupRunsService stopReplica Sample", + "origin": "API_DEFINITION", + "description": " Stops the replication in the read replica instance.", + "canonical": true, + "file": "sql_instances_service.stop_replica.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopReplica", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StopReplica", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "StopReplica", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StopReplica", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_TruncateLog_async", + "title": "SqlBackupRunsService truncateLog Sample", + "origin": "API_DEFINITION", + "description": " Truncate MySQL general and slow query log tables MySQL only.", + "canonical": true, + "file": "sql_instances_service.truncate_log.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TruncateLog", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.TruncateLog", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesTruncateLogRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "TruncateLog", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.TruncateLog", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Update_async", + "title": "SqlBackupRunsService update Sample", + "origin": "API_DEFINITION", + "description": " Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.", + "canonical": true, + "file": "sql_instances_service.update.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Update", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.DatabaseInstance" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Update", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_CreateEphemeral_async", + "title": "SqlBackupRunsService createEphemeral Sample", + "origin": "API_DEFINITION", + "description": " Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.", + "canonical": true, + "file": "sql_instances_service.create_ephemeral.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateEphemeral", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.CreateEphemeral", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.SslCert", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "CreateEphemeral", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.CreateEphemeral", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_RescheduleMaintenance_async", + "title": "SqlBackupRunsService rescheduleMaintenance Sample", + "origin": "API_DEFINITION", + "description": " Reschedules the maintenance on the given instance.", + "canonical": true, + "file": "sql_instances_service.reschedule_maintenance.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "RescheduleMaintenance", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RescheduleMaintenance", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "RescheduleMaintenance", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RescheduleMaintenance", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_VerifyExternalSyncSettings_async", + "title": "SqlBackupRunsService verifyExternalSyncSettings Sample", + "origin": "API_DEFINITION", + "description": " Verify External primary instance external sync settings.", + "canonical": true, + "file": "sql_instances_service.verify_external_sync_settings.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 88, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "VerifyExternalSyncSettings", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.VerifyExternalSyncSettings", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "verify_connection_only", + "type": "TYPE_BOOL" + }, + { + "name": "sync_mode", + "type": ".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode" + }, + { + "name": "verify_replication_only", + "type": "TYPE_BOOL" + }, + { + "name": "mysql_sync_config", + "type": ".google.cloud.sql.v1beta4.MySqlSyncConfig" + }, + { + "name": "migration_type", + "type": ".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType" + }, + { + "name": "sync_parallel_level", + "type": ".google.cloud.sql.v1beta4.ExternalSyncParallelLevel" + }, + { + "name": "selected_objects", + "type": "TYPE_MESSAGE[]" + } + ], + "resultType": ".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "VerifyExternalSyncSettings", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.VerifyExternalSyncSettings", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_StartExternalSync_async", + "title": "SqlBackupRunsService startExternalSync Sample", + "origin": "API_DEFINITION", + "description": " Start External primary instance migration.", + "canonical": true, + "file": "sql_instances_service.start_external_sync.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 86, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartExternalSync", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StartExternalSync", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "sync_mode", + "type": ".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode" + }, + { + "name": "skip_verification", + "type": "TYPE_BOOL" + }, + { + "name": "mysql_sync_config", + "type": ".google.cloud.sql.v1beta4.MySqlSyncConfig" + }, + { + "name": "sync_parallel_level", + "type": ".google.cloud.sql.v1beta4.ExternalSyncParallelLevel" + }, + { + "name": "migration_type", + "type": ".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType" + }, + { + "name": "replica_overwrite_enabled", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "StartExternalSync", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StartExternalSync", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_PerformDiskShrink_async", + "title": "SqlBackupRunsService performDiskShrink Sample", + "origin": "API_DEFINITION", + "description": " Perform Disk Shrink on primary instance.", + "canonical": true, + "file": "sql_instances_service.perform_disk_shrink.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PerformDiskShrink", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PerformDiskShrink", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.PerformDiskShrinkContext" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "PerformDiskShrink", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PerformDiskShrink", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_GetDiskShrinkConfig_async", + "title": "SqlBackupRunsService getDiskShrinkConfig Sample", + "origin": "API_DEFINITION", + "description": " Get Disk Shrink Config for a given instance.", + "canonical": true, + "file": "sql_instances_service.get_disk_shrink_config.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetDiskShrinkConfig", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.GetDiskShrinkConfig", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "GetDiskShrinkConfig", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.GetDiskShrinkConfig", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ResetReplicaSize_async", + "title": "SqlBackupRunsService resetReplicaSize Sample", + "origin": "API_DEFINITION", + "description": " Reset Replica Size to primary instance disk size.", + "canonical": true, + "file": "sql_instances_service.reset_replica_size.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ResetReplicaSize", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ResetReplicaSize", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ResetReplicaSize", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ResetReplicaSize", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_GetLatestRecoveryTime_async", + "title": "SqlBackupRunsService getLatestRecoveryTime Sample", + "origin": "API_DEFINITION", + "description": " Get Latest Recovery Time for a given instance.", + "canonical": true, + "file": "sql_instances_service.get_latest_recovery_time.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 61, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetLatestRecoveryTime", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.GetLatestRecoveryTime", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "source_instance_deletion_time", + "type": ".google.protobuf.Timestamp" + } + ], + "resultType": ".google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "GetLatestRecoveryTime", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.GetLatestRecoveryTime", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ExecuteSql_async", + "title": "SqlBackupRunsService executeSql Sample", + "origin": "API_DEFINITION", + "description": " Execute SQL statements.", + "canonical": true, + "file": "sql_instances_service.execute_sql.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ExecuteSql", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ExecuteSql", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.ExecuteSqlPayload" + } + ], + "resultType": ".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ExecuteSql", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ExecuteSql", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_async", + "title": "SqlBackupRunsService acquireSsrsLease Sample", + "origin": "API_DEFINITION", + "description": " Acquire a lease for the setup of SQL Server Reporting Services (SSRS).", + "canonical": true, + "file": "sql_instances_service.acquire_ssrs_lease.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AcquireSsrsLease", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AcquireSsrsLease", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "AcquireSsrsLease", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AcquireSsrsLease", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_async", + "title": "SqlBackupRunsService releaseSsrsLease Sample", + "origin": "API_DEFINITION", + "description": " Release a lease for the setup of SQL Server Reporting Services (SSRS).", + "canonical": true, + "file": "sql_instances_service.release_ssrs_lease.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 62, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ReleaseSsrsLease", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ReleaseSsrsLease", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "ReleaseSsrsLease", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ReleaseSsrsLease", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async", + "title": "SqlBackupRunsService preCheckMajorVersionUpgrade Sample", + "origin": "API_DEFINITION", + "description": " Execute MVU Pre-checks", + "canonical": true, + "file": "sql_instances_service.pre_check_major_version_upgrade.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PreCheckMajorVersionUpgrade", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PreCheckMajorVersionUpgrade", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "PreCheckMajorVersionUpgrade", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PreCheckMajorVersionUpgrade", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_PointInTimeRestore_async", + "title": "SqlBackupRunsService pointInTimeRestore Sample", + "origin": "API_DEFINITION", + "description": " Point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery.", + "canonical": true, + "file": "sql_instances_service.point_in_time_restore.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "PointInTimeRestore", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PointInTimeRestore", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "context", + "type": ".google.cloud.sql.v1beta4.PointInTimeRestoreContext" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlInstancesServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" + }, + "method": { + "shortName": "PointInTimeRestore", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PointInTimeRestore", + "service": { + "shortName": "SqlInstancesService", + "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlOperationsService_Get_async", + "title": "SqlBackupRunsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves an instance operation that has been performed on an instance.", + "canonical": true, + "file": "sql_operations_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.Get", + "async": true, + "parameters": [ + { + "name": "operation", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlOperationsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.Get", + "service": { + "shortName": "SqlOperationsService", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlOperationsService_List_async", + "title": "SqlBackupRunsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.", + "canonical": true, + "file": "sql_operations_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.List", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "max_results", + "type": "TYPE_UINT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.OperationsListResponse", + "client": { + "shortName": "SqlOperationsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.List", + "service": { + "shortName": "SqlOperationsService", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlOperationsService_Cancel_async", + "title": "SqlBackupRunsService cancel Sample", + "origin": "API_DEFINITION", + "description": " Cancels an instance operation that has been performed on an instance. Ordinarily, this method name should be `CancelSqlOperation`.", + "canonical": true, + "file": "sql_operations_service.cancel.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Cancel", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.Cancel", + "async": true, + "parameters": [ + { + "name": "operation", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SqlOperationsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsServiceClient" + }, + "method": { + "shortName": "Cancel", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.Cancel", + "service": { + "shortName": "SqlOperationsService", + "fullName": "google.cloud.sql.v1beta4.SqlOperationsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlSslCertsService_Delete_async", + "title": "SqlBackupRunsService delete Sample", + "origin": "API_DEFINITION", + "description": " Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.", + "canonical": true, + "file": "sql_ssl_certs_service.delete.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Delete", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "sha1_fingerprint", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlSslCertsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsServiceClient" + }, + "method": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Delete", + "service": { + "shortName": "SqlSslCertsService", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlSslCertsService_Get_async", + "title": "SqlBackupRunsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.", + "canonical": true, + "file": "sql_ssl_certs_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 60, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Get", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "sha1_fingerprint", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.SslCert", + "client": { + "shortName": "SqlSslCertsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Get", + "service": { + "shortName": "SqlSslCertsService", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlSslCertsService_Insert_async", + "title": "SqlBackupRunsService insert Sample", + "origin": "API_DEFINITION", + "description": " Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.", + "canonical": true, + "file": "sql_ssl_certs_service.insert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Insert", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.SslCertsInsertRequest" + } + ], + "resultType": ".google.cloud.sql.v1beta4.SslCertsInsertResponse", + "client": { + "shortName": "SqlSslCertsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsServiceClient" + }, + "method": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Insert", + "service": { + "shortName": "SqlSslCertsService", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlSslCertsService_List_async", + "title": "SqlBackupRunsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists all of the current SSL certificates for the instance.", + "canonical": true, + "file": "sql_ssl_certs_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.List", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.SslCertsListResponse", + "client": { + "shortName": "SqlSslCertsServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.List", + "service": { + "shortName": "SqlSslCertsService", + "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlTiersService_List_async", + "title": "SqlBackupRunsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists all available machine types (tiers) for Cloud SQL, for example, `db-custom-1-3840`. For related information, see [Pricing](/sql/pricing).", + "canonical": true, + "file": "sql_tiers_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 52, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlTiersService.List", + "async": true, + "parameters": [ + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.TiersListResponse", + "client": { + "shortName": "SqlTiersServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlTiersServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlTiersService.List", + "service": { + "shortName": "SqlTiersService", + "fullName": "google.cloud.sql.v1beta4.SqlTiersService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlUsersService_Delete_async", + "title": "SqlBackupRunsService delete Sample", + "origin": "API_DEFINITION", + "description": " Deletes a user from a Cloud SQL instance.", + "canonical": true, + "file": "sql_users_service.delete.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Delete", + "async": true, + "parameters": [ + { + "name": "host", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlUsersServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlUsersServiceClient" + }, + "method": { + "shortName": "Delete", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Delete", + "service": { + "shortName": "SqlUsersService", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlUsersService_Get_async", + "title": "SqlBackupRunsService get Sample", + "origin": "API_DEFINITION", + "description": " Retrieves a resource containing information about a user.", + "canonical": true, + "file": "sql_users_service.get.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Get", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "host", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.User", + "client": { + "shortName": "SqlUsersServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlUsersServiceClient" + }, + "method": { + "shortName": "Get", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Get", + "service": { + "shortName": "SqlUsersService", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlUsersService_Insert_async", + "title": "SqlBackupRunsService insert Sample", + "origin": "API_DEFINITION", + "description": " Creates a new user in a Cloud SQL instance.", + "canonical": true, + "file": "sql_users_service.insert.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Insert", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.User" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlUsersServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlUsersServiceClient" + }, + "method": { + "shortName": "Insert", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Insert", + "service": { + "shortName": "SqlUsersService", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlUsersService_List_async", + "title": "SqlBackupRunsService list Sample", + "origin": "API_DEFINITION", + "description": " Lists users in the specified Cloud SQL instance.", + "canonical": true, + "file": "sql_users_service.list.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService.List", + "async": true, + "parameters": [ + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.sql.v1beta4.UsersListResponse", + "client": { + "shortName": "SqlUsersServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlUsersServiceClient" + }, + "method": { + "shortName": "List", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService.List", + "service": { + "shortName": "SqlUsersService", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService" + } + } + } + }, + { + "regionTag": "sqladmin_v1beta4_generated_SqlUsersService_Update_async", + "title": "SqlBackupRunsService update Sample", + "origin": "API_DEFINITION", + "description": " Updates an existing user in a Cloud SQL instance.", + "canonical": true, + "file": "sql_users_service.update.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Update", + "async": true, + "parameters": [ + { + "name": "host", + "type": "TYPE_STRING" + }, + { + "name": "instance", + "type": "TYPE_STRING" + }, + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "project", + "type": "TYPE_STRING" + }, + { + "name": "database_roles", + "type": "TYPE_STRING[]" + }, + { + "name": "revoke_existing_roles", + "type": "TYPE_BOOL" + }, + { + "name": "body", + "type": ".google.cloud.sql.v1beta4.User" + } + ], + "resultType": ".google.cloud.sql.v1beta4.Operation", + "client": { + "shortName": "SqlUsersServiceClient", + "fullName": "google.cloud.sql.v1beta4.SqlUsersServiceClient" + }, + "method": { + "shortName": "Update", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Update", + "service": { + "shortName": "SqlUsersService", + "fullName": "google.cloud.sql.v1beta4.SqlUsersService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.delete.js new file mode 100644 index 000000000000..6d910a7eb173 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.delete.js @@ -0,0 +1,70 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlBackupRunsService_Delete_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The ID of the backup run to delete. To find a backup run ID, use the + * list (https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/backupRuns/list) + * method. + */ + // const id = 1234 + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlBackupRunsServiceClient(); + + async function callDelete() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.delete(request); + console.log(response); + } + + callDelete(); + // [END sqladmin_v1beta4_generated_SqlBackupRunsService_Delete_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.get.js new file mode 100644 index 000000000000..6f78ee22e833 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.get.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlBackupRunsService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The ID of this backup run. + */ + // const id = 1234 + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlBackupRunsServiceClient(); + + async function callGet() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1beta4_generated_SqlBackupRunsService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.insert.js new file mode 100644 index 000000000000..248373d1f14b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.insert.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlBackupRunsService_Insert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlBackupRunsServiceClient(); + + async function callInsert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.insert(request); + console.log(response); + } + + callInsert(); + // [END sqladmin_v1beta4_generated_SqlBackupRunsService_Insert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.list.js new file mode 100644 index 000000000000..350d99758a34 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.list.js @@ -0,0 +1,74 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlBackupRunsService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID, or "-" for all instances. This does not include + * the project ID. + */ + // const instance = 'abc123' + /** + * Maximum number of backup runs per response. + */ + // const maxResults = 1234 + /** + * A previously-returned page token representing part of the larger set of + * results to view. + */ + // const pageToken = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlBackupRunsServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1beta4_generated_SqlBackupRunsService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.create_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.create_backup.js new file mode 100644 index 000000000000..41c5c2493b92 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.create_backup.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, backup) { + // [START sqladmin_v1beta4_generated_SqlBackupsService_CreateBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource where this backup is created. + * Format: projects/{project} + */ + // const parent = 'abc123' + /** + * Required. The Backup to create. + */ + // const backup = {} + + // Imports the Sql library + const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlBackupsServiceClient(); + + async function callCreateBackup() { + // Construct request + const request = { + parent, + backup, + }; + + // Run request + const response = await sqlClient.createBackup(request); + console.log(response); + } + + callCreateBackup(); + // [END sqladmin_v1beta4_generated_SqlBackupsService_CreateBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.delete_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.delete_backup.js new file mode 100644 index 000000000000..f9cac8481cc9 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.delete_backup.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START sqladmin_v1beta4_generated_SqlBackupsService_DeleteBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the backup to delete. + * Format: projects/{project}/backups/{backup} + */ + // const name = 'abc123' + + // Imports the Sql library + const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlBackupsServiceClient(); + + async function callDeleteBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await sqlClient.deleteBackup(request); + console.log(response); + } + + callDeleteBackup(); + // [END sqladmin_v1beta4_generated_SqlBackupsService_DeleteBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.get_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.get_backup.js new file mode 100644 index 000000000000..3f5643b41546 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.get_backup.js @@ -0,0 +1,62 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START sqladmin_v1beta4_generated_SqlBackupsService_GetBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the backup to retrieve. + * Format: projects/{project}/backups/{backup} + */ + // const name = 'abc123' + + // Imports the Sql library + const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlBackupsServiceClient(); + + async function callGetBackup() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await sqlClient.getBackup(request); + console.log(response); + } + + callGetBackup(); + // [END sqladmin_v1beta4_generated_SqlBackupsService_GetBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.list_backups.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.list_backups.js new file mode 100644 index 000000000000..3c1f03669b74 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.list_backups.js @@ -0,0 +1,86 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START sqladmin_v1beta4_generated_SqlBackupsService_ListBackups_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + */ + // const parent = 'abc123' + /** + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + */ + // const filter = 'abc123' + + // Imports the Sql library + const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlBackupsServiceClient(); + + async function callListBackups() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = sqlClient.listBackupsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListBackups(); + // [END sqladmin_v1beta4_generated_SqlBackupsService_ListBackups_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.update_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.update_backup.js new file mode 100644 index 000000000000..f1cf80b18613 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.update_backup.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(backup) { + // [START sqladmin_v1beta4_generated_SqlBackupsService_UpdateBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The backup to update. + * The backup’s `name` field is used to identify the backup to update. + * Format: projects/{project}/backups/{backup} + */ + // const backup = {} + /** + * The list of fields that you can update. You can update only the description + * and retention period of the final backup. + */ + // const updateMask = {} + + // Imports the Sql library + const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlBackupsServiceClient(); + + async function callUpdateBackup() { + // Construct request + const request = { + backup, + }; + + // Run request + const response = await sqlClient.updateBackup(request); + console.log(response); + } + + callUpdateBackup(); + // [END sqladmin_v1beta4_generated_SqlBackupsService_UpdateBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js new file mode 100644 index 000000000000..f6345625a97f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js @@ -0,0 +1,81 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlConnectService_GenerateEphemeralCert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * PEM encoded public key to include in the signed certificate. + */ + // const publicKey = 'abc123' + /** + * Optional. Access token to include in the signed certificate. + */ + // const accessToken = 'abc123' + /** + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + */ + // const readTime = {} + /** + * Optional. If set, it will contain the cert valid duration. + */ + // const validDuration = {} + + // Imports the Sql library + const {SqlConnectServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlConnectServiceClient(); + + async function callGenerateEphemeralCert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.generateEphemeralCert(request); + console.log(response); + } + + callGenerateEphemeralCert(); + // [END sqladmin_v1beta4_generated_SqlConnectService_GenerateEphemeralCert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.get_connect_settings.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.get_connect_settings.js new file mode 100644 index 000000000000..da577017b14d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.get_connect_settings.js @@ -0,0 +1,69 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlConnectService_GetConnectSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + */ + // const readTime = {} + + // Imports the Sql library + const {SqlConnectServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlConnectServiceClient(); + + async function callGetConnectSettings() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.getConnectSettings(request); + console.log(response); + } + + callGetConnectSettings(); + // [END sqladmin_v1beta4_generated_SqlConnectService_GetConnectSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.delete.js new file mode 100644 index 000000000000..4ff659ed03e6 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.delete.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlDatabasesService_Delete_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the database to be deleted in the instance. + */ + // const database = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callDelete() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.delete(request); + console.log(response); + } + + callDelete(); + // [END sqladmin_v1beta4_generated_SqlDatabasesService_Delete_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.get.js new file mode 100644 index 000000000000..2463810c3ef7 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.get.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlDatabasesService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the database in the instance. + */ + // const database = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callGet() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1beta4_generated_SqlDatabasesService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.insert.js new file mode 100644 index 000000000000..e8b3c3eb2a54 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.insert.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlDatabasesService_Insert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callInsert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.insert(request); + console.log(response); + } + + callInsert(); + // [END sqladmin_v1beta4_generated_SqlDatabasesService_Insert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.list.js new file mode 100644 index 000000000000..45ca6768014b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.list.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlDatabasesService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1beta4_generated_SqlDatabasesService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.patch.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.patch.js new file mode 100644 index 000000000000..b3225e6fffa2 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.patch.js @@ -0,0 +1,71 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlDatabasesService_Patch_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the database to be updated in the instance. + */ + // const database = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callPatch() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.patch(request); + console.log(response); + } + + callPatch(); + // [END sqladmin_v1beta4_generated_SqlDatabasesService_Patch_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.update.js new file mode 100644 index 000000000000..d55fcfe7efde --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.update.js @@ -0,0 +1,71 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlDatabasesService_Update_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the database to be updated in the instance. + */ + // const database = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlDatabasesServiceClient(); + + async function callUpdate() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.update(request); + console.log(response); + } + + callUpdate(); + // [END sqladmin_v1beta4_generated_SqlDatabasesService_Update_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_flags_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_flags_service.list.js new file mode 100644 index 000000000000..5b6db0e04fd5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_flags_service.list.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlFlagsService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database type and version you want to retrieve flags for. By default, this + * method returns flags for all database types and versions. + */ + // const databaseVersion = 'abc123' + /** + * Optional. Specify the scope of flags to be returned by SqlFlagsListService. + * Return list of database flags if unspecified. + */ + // const flagScope = {} + + // Imports the Sql library + const {SqlFlagsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlFlagsServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1beta4_generated_SqlFlagsService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js new file mode 100644 index 000000000000..1e52e20412a7 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js @@ -0,0 +1,74 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This doesn't include the project ID. It's + * composed of lowercase letters, numbers, and hyphens, and it must start with + * a letter. The total length must be 98 characters or less (Example: + * instance-id). + */ + // const instance = 'abc123' + /** + * Required. ID of the project that contains the instance (Example: + * project-id). + */ + // const project = 'my-project' + /** + * The body for request to acquire an SSRS lease. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callAcquireSsrsLease() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.acquireSsrsLease(request); + console.log(response); + } + + callAcquireSsrsLease(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js new file mode 100644 index 000000000000..c9b6b9b21203 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_AddEntraIdCertificate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callAddEntraIdCertificate() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.addEntraIdCertificate(request); + console.log(response); + } + + callAddEntraIdCertificate(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_AddEntraIdCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_ca.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_ca.js new file mode 100644 index 000000000000..4f1f748491ef --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_ca.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_AddServerCa_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callAddServerCa() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.addServerCa(request); + console.log(response); + } + + callAddServerCa(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_AddServerCa_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_certificate.js new file mode 100644 index 000000000000..a7f9401f65f5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_certificate.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_AddServerCertificate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callAddServerCertificate() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.addServerCertificate(request); + console.log(response); + } + + callAddServerCertificate(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_AddServerCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.clone.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.clone.js new file mode 100644 index 000000000000..2be0c22e236c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.clone.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Clone_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The ID of the Cloud SQL instance to be cloned (source). This does not + * include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the source as well as the clone Cloud SQL instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callClone() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.clone(request); + console.log(response); + } + + callClone(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Clone_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.create_ephemeral.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.create_ephemeral.js new file mode 100644 index 000000000000..3f65f841bcb3 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.create_ephemeral.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_CreateEphemeral_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the Cloud SQL project. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callCreateEphemeral() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.createEphemeral(request); + console.log(response); + } + + callCreateEphemeral(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_CreateEphemeral_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.delete.js new file mode 100644 index 000000000000..bc9edd5e4a59 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.delete.js @@ -0,0 +1,81 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Delete_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance to be deleted. + */ + // const project = 'my-project' + /** + * Flag to opt-in for final backup. By default, it is turned off. + */ + // const enableFinalBackup = true + /** + * Optional. Retention period of the final backup. + */ + // const finalBackupTtlDays = 1234 + /** + * Optional. Final Backup expiration time. + * Timestamp in UTC of when this resource is considered expired. + */ + // const finalBackupExpiryTime = {} + /** + * Optional. The description of the final backup. + */ + // const finalBackupDescription = 'abc123' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callDelete() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.delete(request); + console.log(response); + } + + callDelete(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Delete_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote.js new file mode 100644 index 000000000000..2a1ffc1ee99b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote.js @@ -0,0 +1,70 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Demote_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Cloud SQL instance. + */ + // const instance = 'abc123' + /** + * Required. The project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * The request body. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callDemote() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.demote(request); + console.log(response); + } + + callDemote(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Demote_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote_master.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote_master.js new file mode 100644 index 000000000000..9bec02241936 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote_master.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_DemoteMaster_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callDemoteMaster() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.demoteMaster(request); + console.log(response); + } + + callDemoteMaster(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_DemoteMaster_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.execute_sql.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.execute_sql.js new file mode 100644 index 000000000000..67a670fbe80d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.execute_sql.js @@ -0,0 +1,70 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_ExecuteSql_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * The request body. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callExecuteSql() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.executeSql(request); + console.log(response); + } + + callExecuteSql(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_ExecuteSql_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.export.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.export.js new file mode 100644 index 000000000000..50001a31bfd8 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.export.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Export_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * The Cloud SQL instance ID. This doesn't include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance to be exported. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callExport() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.export(request); + console.log(response); + } + + callExport(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Export_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.failover.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.failover.js new file mode 100644 index 000000000000..84347d5a403d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.failover.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Failover_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the read replica. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callFailover() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.failover(request); + console.log(response); + } + + callFailover(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Failover_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get.js new file mode 100644 index 000000000000..2d4eec000577 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callGet() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js new file mode 100644 index 000000000000..fc11cfaa9753 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_GetDiskShrinkConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callGetDiskShrinkConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.getDiskShrinkConfig(request); + console.log(response); + } + + callGetDiskShrinkConfig(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_GetDiskShrinkConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js new file mode 100644 index 000000000000..adedab1cefca --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js @@ -0,0 +1,69 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_GetLatestRecoveryTime_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * The timestamp used to identify the time when the source instance is + * deleted. If this instance is deleted, then you must set the timestamp. + */ + // const sourceInstanceDeletionTime = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callGetLatestRecoveryTime() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.getLatestRecoveryTime(request); + console.log(response); + } + + callGetLatestRecoveryTime(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_GetLatestRecoveryTime_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.import.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.import.js new file mode 100644 index 000000000000..33e10c080fc9 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.import.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Import_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callImport() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.import(request); + console.log(response); + } + + callImport(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Import_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.insert.js new file mode 100644 index 000000000000..40a80c80194c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.insert.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Insert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Project ID of the project to which the newly created Cloud SQL instances + * should belong. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callInsert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.insert(request); + console.log(response); + } + + callInsert(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Insert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list.js new file mode 100644 index 000000000000..eb3d26e3bdd7 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list.js @@ -0,0 +1,83 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * A filter expression that filters resources listed in the response. + * The expression is in the form of field:value. For example, + * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per + * their JSON representation, such as 'settings.userLabels.auto_start:true'. + * Multiple filter queries are space-separated. For example. + * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each + * expression is an AND expression. However, you can include AND and OR + * expressions explicitly. + */ + // const filter = 'abc123' + /** + * The maximum number of instances to return. The service may return fewer + * than this value. + * If unspecified, at most 500 instances are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + */ + // const maxResults = 1234 + /** + * A previously-returned page token representing part of the larger set of + * results to view. + */ + // const pageToken = 'abc123' + /** + * Project ID of the project for which to list Cloud SQL instances. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js new file mode 100644 index 000000000000..bc7553ad21d5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_ListEntraIdCertificates_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callListEntraIdCertificates() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.listEntraIdCertificates(request); + console.log(response); + } + + callListEntraIdCertificates(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_ListEntraIdCertificates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_cas.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_cas.js new file mode 100644 index 000000000000..7f2de74c79c6 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_cas.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_ListServerCas_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callListServerCas() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.listServerCas(request); + console.log(response); + } + + callListServerCas(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_ListServerCas_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_certificates.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_certificates.js new file mode 100644 index 000000000000..165fb7e0710c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_certificates.js @@ -0,0 +1,66 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_ListServerCertificates_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callListServerCertificates() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.listServerCertificates(request); + console.log(response); + } + + callListServerCertificates(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_ListServerCertificates_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.patch.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.patch.js new file mode 100644 index 000000000000..6fb24aff35df --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.patch.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Patch_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callPatch() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.patch(request); + console.log(response); + } + + callPatch(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Patch_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js new file mode 100644 index 000000000000..7b1cb17bdc8d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_PerformDiskShrink_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Perform disk shrink context. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callPerformDiskShrink() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.performDiskShrink(request); + console.log(response); + } + + callPerformDiskShrink(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_PerformDiskShrink_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js new file mode 100644 index 000000000000..9372f05a8cef --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, context) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_PointInTimeRestore_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource where you created this instance. + * Format: projects/{project} + */ + // const parent = 'abc123' + /** + * Required. The context for request to perform a PITR on a Google Cloud + * Backup and Disaster Recovery managed instance. + */ + // const context = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callPointInTimeRestore() { + // Construct request + const request = { + parent, + context, + }; + + // Run request + const response = await sqlClient.pointInTimeRestore(request); + console.log(response); + } + + callPointInTimeRestore(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_PointInTimeRestore_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js new file mode 100644 index 000000000000..bb210e2f508c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js @@ -0,0 +1,72 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project, body) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Required. The context for request to perform the pre-check major version + * upgrade operation. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callPreCheckMajorVersionUpgrade() { + // Construct request + const request = { + instance, + project, + body, + }; + + // Run request + const response = await sqlClient.preCheckMajorVersionUpgrade(request); + console.log(response); + } + + callPreCheckMajorVersionUpgrade(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.promote_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.promote_replica.js new file mode 100644 index 000000000000..dcebee252a7f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.promote_replica.js @@ -0,0 +1,73 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_PromoteReplica_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL read replica instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the read replica. + */ + // const project = 'my-project' + /** + * Set to true to invoke a replica failover to the DR replica. + * As part of replica failover, the promote operation attempts + * to add the original primary instance as a replica of the promoted + * DR replica when the original primary instance comes back online. + * If set to false or not specified, then the original primary + * instance becomes an independent Cloud SQL primary instance. + */ + // const failover = true + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callPromoteReplica() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.promoteReplica(request); + console.log(response); + } + + callPromoteReplica(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_PromoteReplica_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reencrypt.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reencrypt.js new file mode 100644 index 000000000000..c6f76335f8c4 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reencrypt.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Reencrypt_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Reencrypt body that users request + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callReencrypt() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.reencrypt(request); + console.log(response); + } + + callReencrypt(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Reencrypt_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js new file mode 100644 index 000000000000..4acdbfdd9bb7 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js @@ -0,0 +1,70 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The Cloud SQL instance ID. This doesn't include the project ID. + * It's composed of lowercase letters, numbers, and hyphens, and it must start + * with a letter. The total length must be 98 characters or less (Example: + * instance-id). + */ + // const instance = 'abc123' + /** + * Required. The ID of the project that contains the instance (Example: + * project-id). + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callReleaseSsrsLease() { + // Construct request + const request = { + instance, + project, + }; + + // Run request + const response = await sqlClient.releaseSsrsLease(request); + console.log(response); + } + + callReleaseSsrsLease(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js new file mode 100644 index 000000000000..324e51aa3152 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_RescheduleMaintenance_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRescheduleMaintenance() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.rescheduleMaintenance(request); + console.log(response); + } + + callRescheduleMaintenance(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_RescheduleMaintenance_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_replica_size.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_replica_size.js new file mode 100644 index 000000000000..cc922cc39d5c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_replica_size.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_ResetReplicaSize_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL read replica instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the read replica. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callResetReplicaSize() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.resetReplicaSize(request); + console.log(response); + } + + callResetReplicaSize(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_ResetReplicaSize_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js new file mode 100644 index 000000000000..45f4a4964100 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_ResetSslConfig_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Optional. Reset SSL mode to use. + */ + // const mode = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callResetSslConfig() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.resetSslConfig(request); + console.log(response); + } + + callResetSslConfig(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_ResetSslConfig_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restart.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restart.js new file mode 100644 index 000000000000..a87242f8b5f9 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restart.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Restart_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance to be restarted. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRestart() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.restart(request); + console.log(response); + } + + callRestart(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Restart_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restore_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restore_backup.js new file mode 100644 index 000000000000..367c8547b92a --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restore_backup.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_RestoreBackup_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRestoreBackup() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.restoreBackup(request); + console.log(response); + } + + callRestoreBackup(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_RestoreBackup_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js new file mode 100644 index 000000000000..5ed5fd80eb6e --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js @@ -0,0 +1,71 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project, body) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_RotateEntraIdCertificate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Required. Rotate Entra ID certificate request body. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRotateEntraIdCertificate() { + // Construct request + const request = { + instance, + project, + body, + }; + + // Run request + const response = await sqlClient.rotateEntraIdCertificate(request); + console.log(response); + } + + callRotateEntraIdCertificate(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_RotateEntraIdCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js new file mode 100644 index 000000000000..984e44b16dbb --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCa_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRotateServerCa() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.rotateServerCa(request); + console.log(response); + } + + callRotateServerCa(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCa_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js new file mode 100644 index 000000000000..6754ebe9ea53 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js @@ -0,0 +1,71 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(instance, project, body) { + // [START sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCertificate_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Required. Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Required. Rotate server certificate request body. + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callRotateServerCertificate() { + // Construct request + const request = { + instance, + project, + body, + }; + + // Run request + const response = await sqlClient.rotateServerCertificate(request); + console.log(response); + } + + callRotateServerCertificate(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCertificate_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_external_sync.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_external_sync.js new file mode 100644 index 000000000000..01d29c1b2be0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_external_sync.js @@ -0,0 +1,94 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_StartExternalSync_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * External sync mode. + */ + // const syncMode = {} + /** + * Whether to skip the verification step (VESS). + */ + // const skipVerification = true + /** + * MySQL-specific settings for start external sync. + */ + // const mysqlSyncConfig = {} + /** + * Optional. Parallel level for initial data sync. Currently only applicable + * for MySQL. + */ + // const syncParallelLevel = {} + /** + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + */ + // const migrationType = {} + /** + * Optional. MySQL only. True if end-user has confirmed that this SES call + * will wipe replica databases overlapping with the proposed selected_objects. + * If this field is not set and there are both overlapping and additional + * databases proposed, an error will be returned. + */ + // const replicaOverwriteEnabled = true + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callStartExternalSync() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.startExternalSync(request); + console.log(response); + } + + callStartExternalSync(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_StartExternalSync_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_replica.js new file mode 100644 index 000000000000..1e906e0c302b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_replica.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_StartReplica_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL read replica instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the read replica. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callStartReplica() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.startReplica(request); + console.log(response); + } + + callStartReplica(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_StartReplica_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.stop_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.stop_replica.js new file mode 100644 index 000000000000..2517fd4803fe --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.stop_replica.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_StopReplica_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL read replica instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the read replica. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callStopReplica() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.stopReplica(request); + console.log(response); + } + + callStopReplica(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_StopReplica_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.switchover.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.switchover.js new file mode 100644 index 000000000000..93436f4de622 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.switchover.js @@ -0,0 +1,70 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Switchover_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL read replica instance name. + */ + // const instance = 'abc123' + /** + * ID of the project that contains the replica. + */ + // const project = 'my-project' + /** + * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations + * timeout, which is a sum of all database operations. Default value is 10 + * minutes and can be modified to a maximum value of 24 hours. + */ + // const dbTimeout = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callSwitchover() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.switchover(request); + console.log(response); + } + + callSwitchover(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Switchover_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.truncate_log.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.truncate_log.js new file mode 100644 index 000000000000..c3bf9807d7dc --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.truncate_log.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_TruncateLog_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the Cloud SQL project. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callTruncateLog() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.truncateLog(request); + console.log(response); + } + + callTruncateLog(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_TruncateLog_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.update.js new file mode 100644 index 000000000000..fd835af1de02 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.update.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_Update_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callUpdate() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.update(request); + console.log(response); + } + + callUpdate(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_Update_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js new file mode 100644 index 000000000000..76ee9570376b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js @@ -0,0 +1,96 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlInstancesService_VerifyExternalSyncSettings_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Flag to enable verifying connection only + */ + // const verifyConnectionOnly = true + /** + * External sync mode + */ + // const syncMode = {} + /** + * Optional. Flag to verify settings required by replication setup only + */ + // const verifyReplicationOnly = true + /** + * Optional. MySQL-specific settings for start external sync. + */ + // const mysqlSyncConfig = {} + /** + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + */ + // const migrationType = {} + /** + * Optional. Parallel level for initial data sync. Only applicable for + * PostgreSQL. + */ + // const syncParallelLevel = {} + /** + * Optional. Migrate only the specified objects from the source instance. If + * this field is empty, then migrate all objects. + */ + // const selectedObjects = [1,2,3,4] + + // Imports the Sql library + const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlInstancesServiceClient(); + + async function callVerifyExternalSyncSettings() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.verifyExternalSyncSettings(request); + console.log(response); + } + + callVerifyExternalSyncSettings(); + // [END sqladmin_v1beta4_generated_SqlInstancesService_VerifyExternalSyncSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.cancel.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.cancel.js new file mode 100644 index 000000000000..a4cbea7a20b5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.cancel.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlOperationsService_Cancel_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Instance operation ID. + */ + // const operation = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlOperationsServiceClient(); + + async function callCancel() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.cancel(request); + console.log(response); + } + + callCancel(); + // [END sqladmin_v1beta4_generated_SqlOperationsService_Cancel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.get.js new file mode 100644 index 000000000000..46c55c814033 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.get.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlOperationsService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Instance operation ID. + */ + // const operation = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlOperationsServiceClient(); + + async function callGet() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1beta4_generated_SqlOperationsService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.list.js new file mode 100644 index 000000000000..d89f33948954 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.list.js @@ -0,0 +1,73 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlOperationsService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Maximum number of operations per response. + */ + // const maxResults = 1234 + /** + * A previously-returned page token representing part of the larger set of + * results to view. + */ + // const pageToken = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlOperationsServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1beta4_generated_SqlOperationsService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.delete.js new file mode 100644 index 000000000000..84f8522c7913 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.delete.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlSslCertsService_Delete_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Sha1 FingerPrint. + */ + // const sha1Fingerprint = 'abc123' + + // Imports the Sql library + const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlSslCertsServiceClient(); + + async function callDelete() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.delete(request); + console.log(response); + } + + callDelete(); + // [END sqladmin_v1beta4_generated_SqlSslCertsService_Delete_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.get.js new file mode 100644 index 000000000000..7e0d6708b9ac --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.get.js @@ -0,0 +1,68 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlSslCertsService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Sha1 FingerPrint. + */ + // const sha1Fingerprint = 'abc123' + + // Imports the Sql library + const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlSslCertsServiceClient(); + + async function callGet() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1beta4_generated_SqlSslCertsService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.insert.js new file mode 100644 index 000000000000..8d3655001f7f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.insert.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlSslCertsService_Insert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlSslCertsServiceClient(); + + async function callInsert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.insert(request); + console.log(response); + } + + callInsert(); + // [END sqladmin_v1beta4_generated_SqlSslCertsService_Insert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.list.js new file mode 100644 index 000000000000..b923f87f9954 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.list.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlSslCertsService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Cloud SQL instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlSslCertsServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1beta4_generated_SqlSslCertsService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_tiers_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_tiers_service.list.js new file mode 100644 index 000000000000..0662bbd45615 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_tiers_service.list.js @@ -0,0 +1,60 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlTiersService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Project ID of the project for which to list tiers. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlTiersServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlTiersServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1beta4_generated_SqlTiersService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.delete.js new file mode 100644 index 000000000000..bd7bbaa38d2f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.delete.js @@ -0,0 +1,72 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlUsersService_Delete_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Host of the user in the instance. + */ + // const host = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Name of the user in the instance. + */ + // const name = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlUsersServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlUsersServiceClient(); + + async function callDelete() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.delete(request); + console.log(response); + } + + callDelete(); + // [END sqladmin_v1beta4_generated_SqlUsersService_Delete_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.get.js new file mode 100644 index 000000000000..b91e97ad4345 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.get.js @@ -0,0 +1,72 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlUsersService_Get_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * User of the instance. + */ + // const name = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Host of a user of the instance. + */ + // const host = 'abc123' + + // Imports the Sql library + const {SqlUsersServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlUsersServiceClient(); + + async function callGet() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.get(request); + console.log(response); + } + + callGet(); + // [END sqladmin_v1beta4_generated_SqlUsersService_Get_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.insert.js new file mode 100644 index 000000000000..7fc7f777810b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.insert.js @@ -0,0 +1,67 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlUsersService_Insert_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlUsersServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlUsersServiceClient(); + + async function callInsert() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.insert(request); + console.log(response); + } + + callInsert(); + // [END sqladmin_v1beta4_generated_SqlUsersService_Insert_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.list.js new file mode 100644 index 000000000000..0e2b304ec68b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.list.js @@ -0,0 +1,64 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlUsersService_List_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + + // Imports the Sql library + const {SqlUsersServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlUsersServiceClient(); + + async function callList() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.list(request); + console.log(response); + } + + callList(); + // [END sqladmin_v1beta4_generated_SqlUsersService_List_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.update.js new file mode 100644 index 000000000000..4ba5a10adcac --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.update.js @@ -0,0 +1,86 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START sqladmin_v1beta4_generated_SqlUsersService_Update_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. Host of the user in the instance. + */ + // const host = 'abc123' + /** + * Database instance ID. This does not include the project ID. + */ + // const instance = 'abc123' + /** + * Name of the user in the instance. + */ + // const name = 'abc123' + /** + * Project ID of the project that contains the instance. + */ + // const project = 'my-project' + /** + * Optional. List of database roles to grant to the user. body.database_roles + * will be ignored for update request. + */ + // const databaseRoles = ['abc','def'] + /** + * Optional. Specifies whether to revoke existing roles that are not present + * in the `database_roles` field. If `false` or unset, the database roles + * specified in `database_roles` are added to the user's existing roles. + */ + // const revokeExistingRoles = true + /** + */ + // const body = {} + + // Imports the Sql library + const {SqlUsersServiceClient} = require('@google-cloud/sql').v1beta4; + + // Instantiates a client + const sqlClient = new SqlUsersServiceClient(); + + async function callUpdate() { + // Construct request + const request = { + }; + + // Run request + const response = await sqlClient.update(request); + console.log(response); + } + + callUpdate(); + // [END sqladmin_v1beta4_generated_SqlUsersService_Update_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-sql/src/v1/gapic_metadata.json new file mode 100644 index 000000000000..b6405eb0be3c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/gapic_metadata.json @@ -0,0 +1,965 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.sql.v1", + "libraryPackage": "@google-cloud/sql", + "services": { + "SqlAvailableDatabaseVersionsService": { + "clients": { + "grpc": { + "libraryClient": "SqlAvailableDatabaseVersionsServiceClient", + "rpcs": {} + }, + "grpc-fallback": { + "libraryClient": "SqlAvailableDatabaseVersionsServiceClient", + "rpcs": {} + } + } + }, + "SqlBackupRunsService": { + "clients": { + "grpc": { + "libraryClient": "SqlBackupRunsServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlBackupRunsServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlBackupsService": { + "clients": { + "grpc": { + "libraryClient": "SqlBackupsServiceClient", + "rpcs": { + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlBackupsServiceClient", + "rpcs": { + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + }, + "SqlConnectService": { + "clients": { + "grpc": { + "libraryClient": "SqlConnectServiceClient", + "rpcs": { + "GetConnectSettings": { + "methods": [ + "getConnectSettings" + ] + }, + "GenerateEphemeralCert": { + "methods": [ + "generateEphemeralCert" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlConnectServiceClient", + "rpcs": { + "GetConnectSettings": { + "methods": [ + "getConnectSettings" + ] + }, + "GenerateEphemeralCert": { + "methods": [ + "generateEphemeralCert" + ] + } + } + } + } + }, + "SqlDatabasesService": { + "clients": { + "grpc": { + "libraryClient": "SqlDatabasesServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "Update": { + "methods": [ + "update" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlDatabasesServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "Update": { + "methods": [ + "update" + ] + } + } + } + } + }, + "SqlEventsService": { + "clients": { + "grpc": { + "libraryClient": "SqlEventsServiceClient", + "rpcs": {} + }, + "grpc-fallback": { + "libraryClient": "SqlEventsServiceClient", + "rpcs": {} + } + } + }, + "SqlFeatureEligibilityService": { + "clients": { + "grpc": { + "libraryClient": "SqlFeatureEligibilityServiceClient", + "rpcs": {} + }, + "grpc-fallback": { + "libraryClient": "SqlFeatureEligibilityServiceClient", + "rpcs": {} + } + } + }, + "SqlFlagsService": { + "clients": { + "grpc": { + "libraryClient": "SqlFlagsServiceClient", + "rpcs": { + "List": { + "methods": [ + "list" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlFlagsServiceClient", + "rpcs": { + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlIamPoliciesService": { + "clients": { + "grpc": { + "libraryClient": "SqlIamPoliciesServiceClient", + "rpcs": {} + }, + "grpc-fallback": { + "libraryClient": "SqlIamPoliciesServiceClient", + "rpcs": {} + } + } + }, + "SqlInstanceNamesService": { + "clients": { + "grpc": { + "libraryClient": "SqlInstanceNamesServiceClient", + "rpcs": {} + }, + "grpc-fallback": { + "libraryClient": "SqlInstanceNamesServiceClient", + "rpcs": {} + } + } + }, + "SqlInstancesService": { + "clients": { + "grpc": { + "libraryClient": "SqlInstancesServiceClient", + "rpcs": { + "AddServerCa": { + "methods": [ + "addServerCa" + ] + }, + "AddServerCertificate": { + "methods": [ + "addServerCertificate" + ] + }, + "AddEntraIdCertificate": { + "methods": [ + "addEntraIdCertificate" + ] + }, + "Clone": { + "methods": [ + "clone" + ] + }, + "Delete": { + "methods": [ + "delete" + ] + }, + "DemoteMaster": { + "methods": [ + "demoteMaster" + ] + }, + "Demote": { + "methods": [ + "demote" + ] + }, + "Export": { + "methods": [ + "export" + ] + }, + "Failover": { + "methods": [ + "failover" + ] + }, + "Reencrypt": { + "methods": [ + "reencrypt" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Import": { + "methods": [ + "import" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "ListServerCas": { + "methods": [ + "listServerCas" + ] + }, + "ListServerCertificates": { + "methods": [ + "listServerCertificates" + ] + }, + "ListEntraIdCertificates": { + "methods": [ + "listEntraIdCertificates" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "PromoteReplica": { + "methods": [ + "promoteReplica" + ] + }, + "Switchover": { + "methods": [ + "switchover" + ] + }, + "ResetSslConfig": { + "methods": [ + "resetSslConfig" + ] + }, + "Restart": { + "methods": [ + "restart" + ] + }, + "RestoreBackup": { + "methods": [ + "restoreBackup" + ] + }, + "RotateServerCa": { + "methods": [ + "rotateServerCa" + ] + }, + "RotateServerCertificate": { + "methods": [ + "rotateServerCertificate" + ] + }, + "RotateEntraIdCertificate": { + "methods": [ + "rotateEntraIdCertificate" + ] + }, + "StartReplica": { + "methods": [ + "startReplica" + ] + }, + "StopReplica": { + "methods": [ + "stopReplica" + ] + }, + "TruncateLog": { + "methods": [ + "truncateLog" + ] + }, + "Update": { + "methods": [ + "update" + ] + }, + "CreateEphemeral": { + "methods": [ + "createEphemeral" + ] + }, + "RescheduleMaintenance": { + "methods": [ + "rescheduleMaintenance" + ] + }, + "VerifyExternalSyncSettings": { + "methods": [ + "verifyExternalSyncSettings" + ] + }, + "StartExternalSync": { + "methods": [ + "startExternalSync" + ] + }, + "PerformDiskShrink": { + "methods": [ + "performDiskShrink" + ] + }, + "GetDiskShrinkConfig": { + "methods": [ + "getDiskShrinkConfig" + ] + }, + "ResetReplicaSize": { + "methods": [ + "resetReplicaSize" + ] + }, + "GetLatestRecoveryTime": { + "methods": [ + "getLatestRecoveryTime" + ] + }, + "ExecuteSql": { + "methods": [ + "executeSql" + ] + }, + "AcquireSsrsLease": { + "methods": [ + "acquireSsrsLease" + ] + }, + "ReleaseSsrsLease": { + "methods": [ + "releaseSsrsLease" + ] + }, + "PreCheckMajorVersionUpgrade": { + "methods": [ + "preCheckMajorVersionUpgrade" + ] + }, + "PointInTimeRestore": { + "methods": [ + "pointInTimeRestore" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlInstancesServiceClient", + "rpcs": { + "AddServerCa": { + "methods": [ + "addServerCa" + ] + }, + "AddServerCertificate": { + "methods": [ + "addServerCertificate" + ] + }, + "AddEntraIdCertificate": { + "methods": [ + "addEntraIdCertificate" + ] + }, + "Clone": { + "methods": [ + "clone" + ] + }, + "Delete": { + "methods": [ + "delete" + ] + }, + "DemoteMaster": { + "methods": [ + "demoteMaster" + ] + }, + "Demote": { + "methods": [ + "demote" + ] + }, + "Export": { + "methods": [ + "export" + ] + }, + "Failover": { + "methods": [ + "failover" + ] + }, + "Reencrypt": { + "methods": [ + "reencrypt" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Import": { + "methods": [ + "import" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "ListServerCas": { + "methods": [ + "listServerCas" + ] + }, + "ListServerCertificates": { + "methods": [ + "listServerCertificates" + ] + }, + "ListEntraIdCertificates": { + "methods": [ + "listEntraIdCertificates" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "PromoteReplica": { + "methods": [ + "promoteReplica" + ] + }, + "Switchover": { + "methods": [ + "switchover" + ] + }, + "ResetSslConfig": { + "methods": [ + "resetSslConfig" + ] + }, + "Restart": { + "methods": [ + "restart" + ] + }, + "RestoreBackup": { + "methods": [ + "restoreBackup" + ] + }, + "RotateServerCa": { + "methods": [ + "rotateServerCa" + ] + }, + "RotateServerCertificate": { + "methods": [ + "rotateServerCertificate" + ] + }, + "RotateEntraIdCertificate": { + "methods": [ + "rotateEntraIdCertificate" + ] + }, + "StartReplica": { + "methods": [ + "startReplica" + ] + }, + "StopReplica": { + "methods": [ + "stopReplica" + ] + }, + "TruncateLog": { + "methods": [ + "truncateLog" + ] + }, + "Update": { + "methods": [ + "update" + ] + }, + "CreateEphemeral": { + "methods": [ + "createEphemeral" + ] + }, + "RescheduleMaintenance": { + "methods": [ + "rescheduleMaintenance" + ] + }, + "VerifyExternalSyncSettings": { + "methods": [ + "verifyExternalSyncSettings" + ] + }, + "StartExternalSync": { + "methods": [ + "startExternalSync" + ] + }, + "PerformDiskShrink": { + "methods": [ + "performDiskShrink" + ] + }, + "GetDiskShrinkConfig": { + "methods": [ + "getDiskShrinkConfig" + ] + }, + "ResetReplicaSize": { + "methods": [ + "resetReplicaSize" + ] + }, + "GetLatestRecoveryTime": { + "methods": [ + "getLatestRecoveryTime" + ] + }, + "ExecuteSql": { + "methods": [ + "executeSql" + ] + }, + "AcquireSsrsLease": { + "methods": [ + "acquireSsrsLease" + ] + }, + "ReleaseSsrsLease": { + "methods": [ + "releaseSsrsLease" + ] + }, + "PreCheckMajorVersionUpgrade": { + "methods": [ + "preCheckMajorVersionUpgrade" + ] + }, + "PointInTimeRestore": { + "methods": [ + "pointInTimeRestore" + ] + } + } + } + } + }, + "SqlOperationsService": { + "clients": { + "grpc": { + "libraryClient": "SqlOperationsServiceClient", + "rpcs": { + "Get": { + "methods": [ + "get" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Cancel": { + "methods": [ + "cancel" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlOperationsServiceClient", + "rpcs": { + "Get": { + "methods": [ + "get" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Cancel": { + "methods": [ + "cancel" + ] + } + } + } + } + }, + "SqlRegionsService": { + "clients": { + "grpc": { + "libraryClient": "SqlRegionsServiceClient", + "rpcs": {} + }, + "grpc-fallback": { + "libraryClient": "SqlRegionsServiceClient", + "rpcs": {} + } + } + }, + "SqlSslCertsService": { + "clients": { + "grpc": { + "libraryClient": "SqlSslCertsServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlSslCertsServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlTiersService": { + "clients": { + "grpc": { + "libraryClient": "SqlTiersServiceClient", + "rpcs": { + "List": { + "methods": [ + "list" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlTiersServiceClient", + "rpcs": { + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlUsersService": { + "clients": { + "grpc": { + "libraryClient": "SqlUsersServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Update": { + "methods": [ + "update" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlUsersServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Update": { + "methods": [ + "update" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/index.ts b/owl-bot-staging/google-cloud-sql/src/v1/index.ts new file mode 100644 index 000000000000..3e843e173570 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/index.ts @@ -0,0 +1,34 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export { SqlAvailableDatabaseVersionsServiceClient } from './sql_available_database_versions_service_client'; +export { SqlBackupRunsServiceClient } from './sql_backup_runs_service_client'; +export { SqlBackupsServiceClient } from './sql_backups_service_client'; +export { SqlConnectServiceClient } from './sql_connect_service_client'; +export { SqlDatabasesServiceClient } from './sql_databases_service_client'; +export { SqlEventsServiceClient } from './sql_events_service_client'; +export { SqlFeatureEligibilityServiceClient } from './sql_feature_eligibility_service_client'; +export { SqlFlagsServiceClient } from './sql_flags_service_client'; +export { SqlIamPoliciesServiceClient } from './sql_iam_policies_service_client'; +export { SqlInstanceNamesServiceClient } from './sql_instance_names_service_client'; +export { SqlInstancesServiceClient } from './sql_instances_service_client'; +export { SqlOperationsServiceClient } from './sql_operations_service_client'; +export { SqlRegionsServiceClient } from './sql_regions_service_client'; +export { SqlSslCertsServiceClient } from './sql_ssl_certs_service_client'; +export { SqlTiersServiceClient } from './sql_tiers_service_client'; +export { SqlUsersServiceClient } from './sql_users_service_client'; diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client.ts new file mode 100644 index 000000000000..651f749adb05 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client.ts @@ -0,0 +1,491 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_available_database_versions_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_available_database_versions_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service that exposes Cloud SQL database versions information. This + * service is only used internally. + * @class + * @memberof v1 + */ +export class SqlAvailableDatabaseVersionsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlAvailableDatabaseVersionsServiceStub?: Promise<{ + [name: string]: Function; + }>; + + /** + * Construct an instance of SqlAvailableDatabaseVersionsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlAvailableDatabaseVersionsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this + .constructor as typeof SqlAvailableDatabaseVersionsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlAvailableDatabaseVersionsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlAvailableDatabaseVersionsServiceStub) { + return this.sqlAvailableDatabaseVersionsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlAvailableDatabaseVersionsService. + this.sqlAvailableDatabaseVersionsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlAvailableDatabaseVersionsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1 + .SqlAvailableDatabaseVersionsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + return this.sqlAvailableDatabaseVersionsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlAvailableDatabaseVersionsServiceStub && !this._terminated) { + return this.sqlAvailableDatabaseVersionsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client_config.json new file mode 100644 index 000000000000..40ce241a885e --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client_config.json @@ -0,0 +1,25 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlAvailableDatabaseVersionsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": {} + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts new file mode 100644 index 000000000000..582b1c1f4ae2 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts @@ -0,0 +1,1059 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_backup_runs_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_backup_runs_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for managing database backups. + * @class + * @memberof v1 + */ +export class SqlBackupRunsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlBackupRunsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlBackupRunsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlBackupRunsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlBackupRunsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlBackupRunsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlBackupRunsServiceStub) { + return this.sqlBackupRunsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlBackupRunsService. + this.sqlBackupRunsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlBackupRunsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlBackupRunsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlBackupRunsServiceStubMethods = ['delete', 'get', 'insert', 'list']; + for (const methodName of sqlBackupRunsServiceStubMethods) { + const callPromise = this.sqlBackupRunsServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlBackupRunsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Deletes the backup taken by a backup run. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.id + * The ID of the backup run to delete. To find a backup run ID, use the + * [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list) + * method. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backup_runs_service.delete.js + * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Delete_async + */ + delete( + request?: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | undefined, + {} | undefined, + ] + >; + delete( + request: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request?: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + id: request.id?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('delete request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('delete response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a resource containing information about a backup run. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.id + * The ID of this backup run. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.BackupRun|BackupRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backup_runs_service.get.js + * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IBackupRun, + | protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + id: request.id?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IBackupRun, + | protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a new backup run on demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.BackupRun} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backup_runs_service.insert.js + * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Insert_async + */ + insert( + request?: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | undefined, + {} | undefined, + ] + >; + insert( + request: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request?: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('insert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('insert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all backup runs associated with the project or a given instance + * and configuration in the reverse chronological order of the backup + * initiation time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID, or "-" for all instances. This does not include + * the project ID. + * @param {number} request.maxResults + * Maximum number of backup runs per response. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.BackupRunsListResponse|BackupRunsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backup_runs_service.list.js + * region_tag:sqladmin_v1_generated_SqlBackupRunsService_List_async + */ + list( + request?: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IBackupRunsListResponse, + | protos.google.cloud.sql.v1.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IBackupRunsListResponse, + | protos.google.cloud.sql.v1.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlBackupRunsServiceStub && !this._terminated) { + return this.sqlBackupRunsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client_config.json new file mode 100644 index 000000000000..2bca0549c5aa --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlBackupRunsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Delete": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Insert": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client.ts new file mode 100644 index 000000000000..1931f7ec4f63 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client.ts @@ -0,0 +1,1323 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_backups_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_backups_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1 + */ +export class SqlBackupsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlBackupsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlBackupsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlBackupsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlBackupsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listBackups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'backups', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlBackupsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlBackupsServiceStub) { + return this.sqlBackupsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlBackupsService. + this.sqlBackupsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlBackupsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlBackupsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlBackupsServiceStubMethods = [ + 'createBackup', + 'getBackup', + 'listBackups', + 'updateBackup', + 'deleteBackup', + ]; + for (const methodName of sqlBackupsServiceStubMethods) { + const callPromise = this.sqlBackupsServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlBackupsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Creates a backup for a Cloud SQL instance. This API can be used only to + * create on-demand backups. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this backup is created. + * Format: projects/{project} + * @param {google.cloud.sql.v1.Backup} request.backup + * Required. The Backup to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backups_service.create_backup.js + * region_tag:sqladmin_v1_generated_SqlBackupsService_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.sql.v1.ICreateBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | undefined, + {} | undefined, + ] + >; + createBackup( + request: protos.google.cloud.sql.v1.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + createBackup( + request: protos.google.cloud.sql.v1.ICreateBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + createBackup( + request?: protos.google.cloud.sql.v1.ICreateBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a resource containing information about a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the backup to retrieve. + * Format: projects/{project}/backups/{backup} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Backup|Backup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backups_service.get_backup.js + * region_tag:sqladmin_v1_generated_SqlBackupsService_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.sql.v1.IGetBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | undefined, + {} | undefined, + ] + >; + getBackup( + request: protos.google.cloud.sql.v1.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + getBackup( + request: protos.google.cloud.sql.v1.IGetBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + getBackup( + request?: protos.google.cloud.sql.v1.IGetBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates the retention period and description of the backup. You can use + * this API to update final backups only. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.sql.v1.Backup} request.backup + * Required. The backup to update. + * The backup’s `name` field is used to identify the backup to update. + * Format: projects/{project}/backups/{backup} + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields that you can update. You can update only the description + * and retention period of the final backup. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backups_service.update_backup.js + * region_tag:sqladmin_v1_generated_SqlBackupsService_UpdateBackup_async + */ + updateBackup( + request?: protos.google.cloud.sql.v1.IUpdateBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined, + {} | undefined, + ] + >; + updateBackup( + request: protos.google.cloud.sql.v1.IUpdateBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + updateBackup( + request: protos.google.cloud.sql.v1.IUpdateBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + updateBackup( + request?: protos.google.cloud.sql.v1.IUpdateBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'backup.name': request.backup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes the backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the backup to delete. + * Format: projects/{project}/backups/{backup} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backups_service.delete_backup.js + * region_tag:sqladmin_v1_generated_SqlBackupsService_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.sql.v1.IDeleteBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined, + {} | undefined, + ] + >; + deleteBackup( + request: protos.google.cloud.sql.v1.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteBackup( + request: protos.google.cloud.sql.v1.IDeleteBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteBackup( + request?: protos.google.cloud.sql.v1.IDeleteBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Lists all backups associated with the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.sql.v1.Backup|Backup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.sql.v1.IListBackupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackup[], + protos.google.cloud.sql.v1.IListBackupsRequest | null, + protos.google.cloud.sql.v1.IListBackupsResponse, + ] + >; + listBackups( + request: protos.google.cloud.sql.v1.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.sql.v1.IListBackupsRequest, + protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1.IBackup + >, + ): void; + listBackups( + request: protos.google.cloud.sql.v1.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.sql.v1.IListBackupsRequest, + protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1.IBackup + >, + ): void; + listBackups( + request?: protos.google.cloud.sql.v1.IListBackupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.sql.v1.IListBackupsRequest, + protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1.IBackup + >, + callback?: PaginationCallback< + protos.google.cloud.sql.v1.IListBackupsRequest, + protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1.IBackup + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackup[], + protos.google.cloud.sql.v1.IListBackupsRequest | null, + protos.google.cloud.sql.v1.IListBackupsResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.sql.v1.IListBackupsRequest, + protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1.IBackup + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listBackups values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listBackups request %j', request); + return this.innerApiCalls + .listBackups(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.cloud.sql.v1.IBackup[], + protos.google.cloud.sql.v1.IListBackupsRequest | null, + protos.google.cloud.sql.v1.IListBackupsResponse, + ]) => { + this._log.info('listBackups values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listBackups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.sql.v1.Backup|Backup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.sql.v1.IListBackupsRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listBackups stream %j', request); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.sql.v1.Backup|Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backups_service.list_backups.js + * region_tag:sqladmin_v1_generated_SqlBackupsService_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.sql.v1.IListBackupsRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listBackups iterate %j', request); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlBackupsServiceStub && !this._terminated) { + return this.sqlBackupsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client_config.json new file mode 100644 index 000000000000..4d1231dc69cc --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlBackupsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client.ts new file mode 100644 index 000000000000..55bcc54b96ae --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client.ts @@ -0,0 +1,804 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_connect_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_connect_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Cloud SQL connect service. + * @class + * @memberof v1 + */ +export class SqlConnectServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlConnectServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlConnectServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlConnectServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlConnectServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlConnectService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlConnectServiceStub) { + return this.sqlConnectServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlConnectService. + this.sqlConnectServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlConnectService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlConnectService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlConnectServiceStubMethods = [ + 'getConnectSettings', + 'generateEphemeralCert', + ]; + for (const methodName of sqlConnectServiceStubMethods) { + const callPromise = this.sqlConnectServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlConnectServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Retrieves connect settings about a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.protobuf.Timestamp} [request.readTime] + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.ConnectSettings|ConnectSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_connect_service.get_connect_settings.js + * region_tag:sqladmin_v1_generated_SqlConnectService_GetConnectSettings_async + */ + getConnectSettings( + request?: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | undefined, + {} | undefined, + ] + >; + getConnectSettings( + request: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | null | undefined, + {} | null | undefined + >, + ): void; + getConnectSettings( + request: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, + callback: Callback< + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | null | undefined, + {} | null | undefined + >, + ): void; + getConnectSettings( + request?: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IConnectSettings, + | protos.google.cloud.sql.v1.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getConnectSettings request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IConnectSettings, + | protos.google.cloud.sql.v1.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getConnectSettings response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getConnectSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getConnectSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Generates a short-lived X509 certificate containing the provided public key + * and signed by a private key specific to the target instance. Users may use + * the certificate to authenticate as themselves when connecting to the + * database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.publicKey + * PEM encoded public key to include in the signed certificate. + * @param {string} [request.accessToken] + * Optional. Access token to include in the signed certificate. + * @param {google.protobuf.Timestamp} [request.readTime] + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + * @param {google.protobuf.Duration} [request.validDuration] + * Optional. If set, it will contain the cert valid duration. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.GenerateEphemeralCertResponse|GenerateEphemeralCertResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js + * region_tag:sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_async + */ + generateEphemeralCert( + request?: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest | undefined, + {} | undefined, + ] + >; + generateEphemeralCert( + request: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + generateEphemeralCert( + request: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, + callback: Callback< + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + generateEphemeralCert( + request?: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('generateEphemeralCert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('generateEphemeralCert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .generateEphemeralCert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('generateEphemeralCert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlConnectServiceStub && !this._terminated) { + return this.sqlConnectServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client_config.json new file mode 100644 index 000000000000..73a1cb931033 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client_config.json @@ -0,0 +1,34 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlConnectService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetConnectSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateEphemeralCert": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client.ts new file mode 100644 index 000000000000..6b679b46644a --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client.ts @@ -0,0 +1,1328 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_databases_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_databases_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service to manage databases. + * @class + * @memberof v1 + */ +export class SqlDatabasesServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlDatabasesServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlDatabasesServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlDatabasesServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlDatabasesServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlDatabasesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlDatabasesServiceStub) { + return this.sqlDatabasesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlDatabasesService. + this.sqlDatabasesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlDatabasesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlDatabasesService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlDatabasesServiceStubMethods = [ + 'delete', + 'get', + 'insert', + 'list', + 'patch', + 'update', + ]; + for (const methodName of sqlDatabasesServiceStubMethods) { + const callPromise = this.sqlDatabasesServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlDatabasesServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Deletes a database from a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be deleted in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.delete.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_Delete_async + */ + delete( + request?: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | undefined, + {} | undefined, + ] + >; + delete( + request: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request?: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('delete request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('delete response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a resource containing information about a database inside a Cloud + * SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Database|Database}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.get.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Inserts a resource containing information about a database inside a Cloud + * SQL instance. + * + * **Note:** You can't modify the default character set and collation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.insert.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_Insert_async + */ + insert( + request?: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | undefined, + {} | undefined, + ] + >; + insert( + request: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request?: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('insert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('insert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists databases in the specified Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.DatabasesListResponse|DatabasesListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.list.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_List_async + */ + list( + request?: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IDatabasesListResponse, + | protos.google.cloud.sql.v1.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IDatabasesListResponse, + | protos.google.cloud.sql.v1.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Partially updates a resource containing information about a database inside + * a Cloud SQL instance. This method supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be updated in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.patch.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_Patch_async + */ + patch( + request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + >; + patch( + request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; + patch( + request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; + patch( + request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('patch request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('patch response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .patch(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ]) => { + this._log.info('patch response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates a resource containing information about a database inside a Cloud + * SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be updated in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.update.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_Update_async + */ + update( + request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + >; + update( + request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; + update( + request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; + update( + request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('update request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('update response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlDatabasesServiceStub && !this._terminated) { + return this.sqlDatabasesServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client_config.json new file mode 100644 index 000000000000..24fb6c91fbad --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client_config.json @@ -0,0 +1,56 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlDatabasesService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Delete": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Insert": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Patch": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Update": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client.ts new file mode 100644 index 000000000000..0fd43b09b555 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client.ts @@ -0,0 +1,487 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_events_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_events_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service that exposes Cloud SQL event information. This + * service is only used internally. + * @class + * @memberof v1 + */ +export class SqlEventsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlEventsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlEventsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlEventsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlEventsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlEventsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlEventsServiceStub) { + return this.sqlEventsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlEventsService. + this.sqlEventsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlEventsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlEventsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + return this.sqlEventsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlEventsServiceStub && !this._terminated) { + return this.sqlEventsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client_config.json new file mode 100644 index 000000000000..f23b6be99173 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client_config.json @@ -0,0 +1,25 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlEventsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": {} + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts new file mode 100644 index 000000000000..55b053d0a121 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts @@ -0,0 +1,488 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_feature_eligibility_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_feature_eligibility_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service to verify the eligibility of an instance for a given operation. + * @class + * @memberof v1 + */ +export class SqlFeatureEligibilityServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlFeatureEligibilityServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlFeatureEligibilityServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlFeatureEligibilityServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this + .constructor as typeof SqlFeatureEligibilityServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlFeatureEligibilityService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlFeatureEligibilityServiceStub) { + return this.sqlFeatureEligibilityServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlFeatureEligibilityService. + this.sqlFeatureEligibilityServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlFeatureEligibilityService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1 + .SqlFeatureEligibilityService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + return this.sqlFeatureEligibilityServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlFeatureEligibilityServiceStub && !this._terminated) { + return this.sqlFeatureEligibilityServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client_config.json new file mode 100644 index 000000000000..ee61d8115ba2 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client_config.json @@ -0,0 +1,25 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlFeatureEligibilityService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": {} + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client.ts new file mode 100644 index 000000000000..b30f40542afd --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client.ts @@ -0,0 +1,642 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_flags_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_flags_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service to manage database flags for Cloud SQL instances. + * @class + * @memberof v1 + */ +export class SqlFlagsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlFlagsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlFlagsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlFlagsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlFlagsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlFlagsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlFlagsServiceStub) { + return this.sqlFlagsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlFlagsService. + this.sqlFlagsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlFlagsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlFlagsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlFlagsServiceStubMethods = ['list']; + for (const methodName of sqlFlagsServiceStubMethods) { + const callPromise = this.sqlFlagsServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlFlagsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Lists all available database flags for Cloud SQL instances. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.databaseVersion + * Database type and version you want to retrieve flags for. By default, this + * method returns flags for all database types and versions. + * @param {google.cloud.sql.v1.SqlFlagScope} [request.flagScope] + * Optional. Specify the scope of flags to be returned by SqlFlagsListService. + * Return list of database flags if unspecified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.FlagsListResponse|FlagsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_flags_service.list.js + * region_tag:sqladmin_v1_generated_SqlFlagsService_List_async + */ + list( + request?: protos.google.cloud.sql.v1.ISqlFlagsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1.ISqlFlagsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1.ISqlFlagsListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1.ISqlFlagsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlFlagsServiceStub && !this._terminated) { + return this.sqlFlagsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client_config.json new file mode 100644 index 000000000000..cf4ddd3729ab --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlFlagsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client.ts new file mode 100644 index 000000000000..2990a9bd3732 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client.ts @@ -0,0 +1,487 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_iam_policies_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_iam_policies_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for providing IAM Meta APIs for Cloud SQL. + * @class + * @memberof v1 + */ +export class SqlIamPoliciesServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlIamPoliciesServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlIamPoliciesServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlIamPoliciesServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this + .constructor as typeof SqlIamPoliciesServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlIamPoliciesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlIamPoliciesServiceStub) { + return this.sqlIamPoliciesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlIamPoliciesService. + this.sqlIamPoliciesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlIamPoliciesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlIamPoliciesService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + return this.sqlIamPoliciesServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlIamPoliciesServiceStub && !this._terminated) { + return this.sqlIamPoliciesServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client_config.json new file mode 100644 index 000000000000..2f2bb90fda5b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client_config.json @@ -0,0 +1,25 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlIamPoliciesService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": {} + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client.ts new file mode 100644 index 000000000000..d92149ed7a0b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client.ts @@ -0,0 +1,487 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_instance_names_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_instance_names_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Cloud SQL instance names service. + * @class + * @memberof v1 + */ +export class SqlInstanceNamesServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlInstanceNamesServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlInstanceNamesServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlInstanceNamesServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this + .constructor as typeof SqlInstanceNamesServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlInstanceNamesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlInstanceNamesServiceStub) { + return this.sqlInstanceNamesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlInstanceNamesService. + this.sqlInstanceNamesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlInstanceNamesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlInstanceNamesService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + return this.sqlInstanceNamesServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlInstanceNamesServiceStub && !this._terminated) { + return this.sqlInstanceNamesServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client_config.json new file mode 100644 index 000000000000..5c4fb4184d13 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client_config.json @@ -0,0 +1,25 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlInstanceNamesService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": {} + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client.ts new file mode 100644 index 000000000000..e4e372e22ccb --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client.ts @@ -0,0 +1,6827 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_instances_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_instances_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1 + */ +export class SqlInstancesServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlInstancesServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlInstancesServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlInstancesServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlInstancesServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}', + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{network}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlInstancesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlInstancesServiceStub) { + return this.sqlInstancesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlInstancesService. + this.sqlInstancesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlInstancesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlInstancesService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlInstancesServiceStubMethods = [ + 'addServerCa', + 'addServerCertificate', + 'addEntraIdCertificate', + 'clone', + 'delete', + 'demoteMaster', + 'demote', + 'export', + 'failover', + 'reencrypt', + 'get', + 'import', + 'insert', + 'list', + 'listServerCas', + 'listServerCertificates', + 'listEntraIdCertificates', + 'patch', + 'promoteReplica', + 'switchover', + 'resetSslConfig', + 'restart', + 'restoreBackup', + 'rotateServerCa', + 'rotateServerCertificate', + 'rotateEntraIdCertificate', + 'startReplica', + 'stopReplica', + 'truncateLog', + 'update', + 'createEphemeral', + 'rescheduleMaintenance', + 'verifyExternalSyncSettings', + 'startExternalSync', + 'performDiskShrink', + 'getDiskShrinkConfig', + 'resetReplicaSize', + 'getLatestRecoveryTime', + 'executeSql', + 'acquireSsrsLease', + 'releaseSsrsLease', + 'preCheckMajorVersionUpgrade', + 'pointInTimeRestore', + ]; + for (const methodName of sqlInstancesServiceStubMethods) { + const callPromise = this.sqlInstancesServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlInstancesServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Adds a new trusted Certificate Authority (CA) version for the specified + * instance. Required to prepare for a certificate rotation. If a CA version + * was previously added but never used in a certificate rotation, this + * operation replaces that version. There cannot be more than one CA version + * waiting to be rotated in. For instances that have enabled Certificate + * Authority Service (CAS) based server CA, use AddServerCertificate to add a + * new server certificate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.add_server_ca.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_AddServerCa_async + */ + addServerCa( + request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | undefined, + {} | undefined, + ] + >; + addServerCa( + request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addServerCa( + request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addServerCa( + request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('addServerCa request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('addServerCa response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .addServerCa(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addServerCa response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Add a new trusted server certificate version for the specified instance + * using Certificate Authority Service (CAS) server CA. Required to prepare + * for a certificate rotation. If a server certificate version was previously + * added but never used in a certificate rotation, this operation replaces + * that version. There cannot be more than one certificate version waiting to + * be rotated in. For instances not using CAS server CA, use AddServerCa + * instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.add_server_certificate.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_async + */ + addServerCertificate( + request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ] + >; + addServerCertificate( + request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addServerCertificate( + request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addServerCertificate( + request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('addServerCertificate request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('addServerCertificate response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .addServerCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addServerCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Adds a new Entra ID certificate for the specified instance. If an Entra ID + * certificate was previously added but never used in a certificate rotation, + * this operation replaces that version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.add_entra_id_certificate.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_async + */ + addEntraIdCertificate( + request?: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + >; + addEntraIdCertificate( + request: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addEntraIdCertificate( + request: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addEntraIdCertificate( + request?: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('addEntraIdCertificate request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('addEntraIdCertificate response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .addEntraIdCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addEntraIdCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a Cloud SQL instance as a clone of the source instance. Using this + * operation might cause your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. The ID of the Cloud SQL instance to be cloned (source). This does + * not include the project ID. + * @param {string} request.project + * Required. Project ID of the source Cloud SQL instance. + * @param {google.cloud.sql.v1.InstancesCloneRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.clone.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Clone_async + */ + clone( + request?: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ] + >; + clone( + request: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, + {} | null | undefined + >, + ): void; + clone( + request: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, + {} | null | undefined + >, + ): void; + clone( + request?: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('clone request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('clone response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .clone(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ]) => { + this._log.info('clone response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be deleted. + * @param {boolean} request.enableFinalBackup + * Flag to opt-in for final backup. By default, it is turned off. + * @param {number} [request.finalBackupTtlDays] + * Optional. Retention period of the final backup. + * @param {google.protobuf.Timestamp} [request.finalBackupExpiryTime] + * Optional. Final Backup expiration time. + * Timestamp in UTC of when this resource is considered expired. + * @param {string} [request.finalBackupDescription] + * Optional. The description of the final backup. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.delete.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Delete_async + */ + delete( + request?: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined, + {} | undefined, + ] + >; + delete( + request: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request?: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('delete request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('delete response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Demotes the stand-alone instance to be a Cloud SQL read replica for an + * external database server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance name. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesDemoteMasterRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.demote_master.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_DemoteMaster_async + */ + demoteMaster( + request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | undefined, + {} | undefined, + ] + >; + demoteMaster( + request: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + demoteMaster( + request: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + demoteMaster( + request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('demoteMaster request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('demoteMaster response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .demoteMaster(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('demoteMaster response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Demotes an existing standalone instance to be a Cloud SQL read replica + * for an external database server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance name. + * @param {string} request.project + * Required. ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesDemoteRequest} request.body + * Required. The request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.demote.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Demote_async + */ + demote( + request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined, + {} | undefined, + ] + >; + demote( + request: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, + {} | null | undefined + >, + ): void; + demote( + request: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, + {} | null | undefined + >, + ): void; + demote( + request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('demote request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('demote response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .demote(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('demote response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL + * dump or CSV file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be exported. + * @param {google.cloud.sql.v1.InstancesExportRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.export.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Export_async + */ + export( + request?: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined, + {} | undefined, + ] + >; + export( + request: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, + {} | null | undefined + >, + ): void; + export( + request: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, + {} | null | undefined + >, + ): void; + export( + request?: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('export request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('export response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .export(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined, + {} | undefined, + ]) => { + this._log.info('export response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Initiates a manual failover of a high availability (HA) primary instance + * to a standby instance, which becomes the primary instance. Users are + * then rerouted to the new primary. For more information, see the + * [Overview of high + * availability](https://cloud.google.com/sql/docs/mysql/high-availability) + * page in the Cloud SQL documentation. + * If using Legacy HA (MySQL only), this causes the instance to failover to + * its failover replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {google.cloud.sql.v1.InstancesFailoverRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.failover.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Failover_async + */ + failover( + request?: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined, + {} | undefined, + ] + >; + failover( + request: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + failover( + request: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + failover( + request?: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('failover request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('failover response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .failover(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined, + {} | undefined, + ]) => { + this._log.info('failover response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Reencrypt CMEK instance with latest key version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesReencryptRequest} request.body + * Reencrypt body that users request + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.reencrypt.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Reencrypt_async + */ + reencrypt( + request?: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined, + {} | undefined, + ] + >; + reencrypt( + request: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + reencrypt( + request: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + reencrypt( + request?: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('reencrypt request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('reencrypt response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .reencrypt(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined, + {} | undefined, + ]) => { + this._log.info('reencrypt response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a resource containing information about a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Database instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.DatabaseInstance|DatabaseInstance}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.get.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Imports data into a Cloud SQL instance from a SQL dump or CSV file in + * Cloud Storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesImportRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.import.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Import_async + */ + import( + request?: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined, + {} | undefined, + ] + >; + import( + request: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, + {} | null | undefined + >, + ): void; + import( + request: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, + {} | null | undefined + >, + ): void; + import( + request?: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('import request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('import response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .import(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined, + {} | undefined, + ]) => { + this._log.info('import response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a new Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.project + * Project ID of the project to which the newly created Cloud SQL instances + * should belong. + * @param {google.cloud.sql.v1.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.insert.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Insert_async + */ + insert( + request?: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined, + {} | undefined, + ] + >; + insert( + request: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request?: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('insert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('insert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists instances under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.filter + * A filter expression that filters resources listed in the response. + * The expression is in the form of field:value. For example, + * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per + * their JSON representation, such as 'settings.userLabels.auto_start:true'. + * + * Multiple filter queries are space-separated. For example. + * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each + * expression is an AND expression. However, you can include AND and OR + * expressions explicitly. + * @param {number} request.maxResults + * The maximum number of instances to return. The service may return fewer + * than this value. + * If unspecified, at most 500 instances are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project for which to list Cloud SQL instances. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListResponse|InstancesListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.list.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_List_async + */ + list( + request?: protos.google.cloud.sql.v1.ISqlInstancesListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1.ISqlInstancesListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1.ISqlInstancesListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1.ISqlInstancesListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IInstancesListResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IInstancesListResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all of the trusted Certificate Authorities (CAs) for the specified + * instance. There can be up to three CAs listed: the CA that was used to sign + * the certificate that is currently in use, a CA that has been added but not + * yet used to sign a certificate, and a CA used to sign a certificate that + * has previously rotated out. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListServerCasResponse|InstancesListServerCasResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.list_server_cas.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ListServerCas_async + */ + listServerCas( + request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | undefined, + {} | undefined, + ] + >; + listServerCas( + request: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listServerCas( + request: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listServerCas( + request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listServerCas request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('listServerCas response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .listServerCas(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listServerCas response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all versions of server certificates and certificate authorities (CAs) + * for the specified instance. There can be up to three sets of certs listed: + * the certificate that is currently in use, a future that has been added but + * not yet used to sign a certificate, and a certificate that has been rotated + * out. For instances not using Certificate Authority Service (CAS) server CA, + * use ListServerCas instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse|InstancesListServerCertificatesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.list_server_certificates.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_async + */ + listServerCertificates( + request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ] + >; + listServerCertificates( + request: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listServerCertificates( + request: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listServerCertificates( + request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listServerCertificates request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('listServerCertificates response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .listServerCertificates(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listServerCertificates response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all versions of EntraID certificates for the specified instance. + * There can be up to three sets of certificates listed: the certificate that + * is currently in use, a future that has been added but not yet used to sign + * a certificate, and a certificate that has been rotated out. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse|InstancesListEntraIdCertificatesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.list_entra_id_certificates.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_async + */ + listEntraIdCertificates( + request?: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ] + >; + listEntraIdCertificates( + request: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listEntraIdCertificates( + request: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listEntraIdCertificates( + request?: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listEntraIdCertificates request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('listEntraIdCertificates response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .listEntraIdCertificates(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listEntraIdCertificates response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Partially updates settings of a Cloud SQL instance by merging the request + * with the current configuration. This method supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.patch.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Patch_async + */ + patch( + request?: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ] + >; + patch( + request: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, + {} | null | undefined + >, + ): void; + patch( + request: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, + {} | null | undefined + >, + ): void; + patch( + request?: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('patch request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('patch response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .patch(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ]) => { + this._log.info('patch response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Promotes the read replica instance to be an independent Cloud SQL + * primary instance. + * Using this operation might cause your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {boolean} request.failover + * Set to true to invoke a replica failover to the DR + * replica. As part of replica failover, the promote operation attempts + * to add the original primary instance as a replica of the promoted + * DR replica when the original primary instance comes back online. + * If set to false or not specified, then the original primary + * instance becomes an independent Cloud SQL primary instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.promote_replica.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_PromoteReplica_async + */ + promoteReplica( + request?: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | undefined, + {} | undefined, + ] + >; + promoteReplica( + request: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + promoteReplica( + request: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + promoteReplica( + request?: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('promoteReplica request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('promoteReplica response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .promoteReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('promoteReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Switches over from the primary instance to the DR replica + * instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the replica. + * @param {google.protobuf.Duration} [request.dbTimeout] + * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations + * timeout, which is a sum of all database operations. Default value is 10 + * minutes and can be modified to a maximum value of 24 hours. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.switchover.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Switchover_async + */ + switchover( + request?: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined, + {} | undefined, + ] + >; + switchover( + request: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + switchover( + request: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + switchover( + request?: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('switchover request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('switchover response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .switchover(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined, + {} | undefined, + ]) => { + this._log.info('switchover response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes all client certificates and generates a new server SSL certificate + * for the instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode} [request.mode] + * Optional. Reset SSL mode to use. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.reset_ssl_config.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_async + */ + resetSslConfig( + request?: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | undefined, + {} | undefined, + ] + >; + resetSslConfig( + request: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + resetSslConfig( + request: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + resetSslConfig( + request?: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('resetSslConfig request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('resetSslConfig response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .resetSslConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resetSslConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Restarts a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be restarted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.restart.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Restart_async + */ + restart( + request?: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined, + {} | undefined, + ] + >; + restart( + request: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, + {} | null | undefined + >, + ): void; + restart( + request: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, + {} | null | undefined + >, + ): void; + restart( + request?: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('restart request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('restart response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .restart(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined, + {} | undefined, + ]) => { + this._log.info('restart response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Restores a backup of a Cloud SQL instance. Using this operation might cause + * your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesRestoreBackupRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.restore_backup.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_RestoreBackup_async + */ + restoreBackup( + request?: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | undefined, + {} | undefined, + ] + >; + restoreBackup( + request: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + restoreBackup( + request: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + restoreBackup( + request?: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('restoreBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('restoreBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .restoreBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('restoreBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Rotates the server certificate to one signed by the Certificate Authority + * (CA) version previously added with the addServerCA method. For instances + * that have enabled Certificate Authority Service (CAS) based server CA, + * use RotateServerCertificate to rotate the server certificate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesRotateServerCaRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.rotate_server_ca.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateServerCa_async + */ + rotateServerCa( + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | undefined, + {} | undefined, + ] + >; + rotateServerCa( + request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateServerCa( + request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateServerCa( + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('rotateServerCa request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('rotateServerCa response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .rotateServerCa(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateServerCa response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Rotates the server certificate version to one previously added with the + * addServerCertificate method. For instances not using Certificate Authority + * Service (CAS) server CA, use RotateServerCa instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} [request.body] + * Optional. Rotate server certificate request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.rotate_server_certificate.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_async + */ + rotateServerCertificate( + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ] + >; + rotateServerCertificate( + request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateServerCertificate( + request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateServerCertificate( + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('rotateServerCertificate request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('rotateServerCertificate response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .rotateServerCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateServerCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Rotates the server certificate version to one previously added with the + * addEntraIdCertificate method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} [request.body] + * Optional. Rotate Entra ID certificate request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_async + */ + rotateEntraIdCertificate( + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + >; + rotateEntraIdCertificate( + request: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateEntraIdCertificate( + request: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateEntraIdCertificate( + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('rotateEntraIdCertificate request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('rotateEntraIdCertificate response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .rotateEntraIdCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateEntraIdCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Starts the replication in the read replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.start_replica.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_StartReplica_async + */ + startReplica( + request?: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | undefined, + {} | undefined, + ] + >; + startReplica( + request: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + startReplica( + request: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + startReplica( + request?: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('startReplica request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('startReplica response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .startReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Stops the replication in the read replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.stop_replica.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_StopReplica_async + */ + stopReplica( + request?: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | undefined, + {} | undefined, + ] + >; + stopReplica( + request: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + stopReplica( + request: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + stopReplica( + request?: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('stopReplica request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('stopReplica response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .stopReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('stopReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Truncate MySQL general and slow query log tables + * MySQL only. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the Cloud SQL project. + * @param {google.cloud.sql.v1.InstancesTruncateLogRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.truncate_log.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_TruncateLog_async + */ + truncateLog( + request?: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | undefined, + {} | undefined, + ] + >; + truncateLog( + request: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + truncateLog( + request: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + truncateLog( + request?: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('truncateLog request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('truncateLog response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .truncateLog(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('truncateLog response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates settings of a Cloud SQL instance. Using this operation might cause + * your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.update.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Update_async + */ + update( + request?: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined, + {} | undefined, + ] + >; + update( + request: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; + update( + request: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; + update( + request?: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('update request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('update response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined, + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Generates a short-lived X509 certificate containing the provided public key + * and signed by a private key specific to the target instance. Users may use + * the certificate to authenticate as themselves when connecting to the + * database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the Cloud SQL project. + * @param {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCert|SslCert}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.create_ephemeral.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_async + */ + createEphemeral( + request?: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCert, + ( + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ] + >; + createEphemeral( + request: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISslCert, + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + createEphemeral( + request: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISslCert, + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + createEphemeral( + request?: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ISslCert, + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISslCert, + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCert, + ( + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createEphemeral request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISslCert, + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createEphemeral response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createEphemeral(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISslCert, + ( + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createEphemeral response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Reschedules the maintenance on the given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.reschedule_maintenance.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_async + */ + rescheduleMaintenance( + request?: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ] + >; + rescheduleMaintenance( + request: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rescheduleMaintenance( + request: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rescheduleMaintenance( + request?: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('rescheduleMaintenance request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('rescheduleMaintenance response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .rescheduleMaintenance(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rescheduleMaintenance response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Verify External primary instance external sync settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {boolean} request.verifyConnectionOnly + * Flag to enable verifying connection only + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode + * External sync mode + * @param {boolean} [request.verifyReplicationOnly] + * Optional. Flag to verify settings required by replication setup only + * @param {google.cloud.sql.v1.MySqlSyncConfig} [request.mysqlSyncConfig] + * Optional. MySQL-specific settings for start external sync. + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + * @param {google.cloud.sql.v1.ExternalSyncParallelLevel} [request.syncParallelLevel] + * Optional. Parallel level for initial data sync. Only applicable for + * PostgreSQL. + * @param {number[]} [request.selectedObjects] + * Optional. Migrate only the specified objects from the source instance. If + * this field is empty, then migrate all objects. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse|SqlInstancesVerifyExternalSyncSettingsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.verify_external_sync_settings.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_async + */ + verifyExternalSyncSettings( + request?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ] + >; + verifyExternalSyncSettings( + request: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + verifyExternalSyncSettings( + request: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + verifyExternalSyncSettings( + request?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('verifyExternalSyncSettings request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('verifyExternalSyncSettings response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .verifyExternalSyncSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('verifyExternalSyncSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Start External primary instance migration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode + * External sync mode. + * @param {boolean} request.skipVerification + * Whether to skip the verification step (VESS). + * @param {google.cloud.sql.v1.MySqlSyncConfig} request.mysqlSyncConfig + * MySQL-specific settings for start external sync. + * @param {google.cloud.sql.v1.ExternalSyncParallelLevel} [request.syncParallelLevel] + * Optional. Parallel level for initial data sync. Currently only applicable + * for MySQL. + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + * @param {boolean} [request.replicaOverwriteEnabled] + * Optional. MySQL only. True if end-user has confirmed that this SES call + * will wipe replica databases overlapping with the proposed selected_objects. + * If this field is not set and there are both overlapping and additional + * databases proposed, an error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.start_external_sync.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_StartExternalSync_async + */ + startExternalSync( + request?: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ] + >; + startExternalSync( + request: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + startExternalSync( + request: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + startExternalSync( + request?: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('startExternalSync request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('startExternalSync response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .startExternalSync(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startExternalSync response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Perform Disk Shrink on primary instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.PerformDiskShrinkContext} request.body + * Perform disk shrink context. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.perform_disk_shrink.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_async + */ + performDiskShrink( + request?: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ] + >; + performDiskShrink( + request: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + performDiskShrink( + request: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + performDiskShrink( + request?: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('performDiskShrink request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('performDiskShrink response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .performDiskShrink(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('performDiskShrink response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Get Disk Shrink Config for a given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse|SqlInstancesGetDiskShrinkConfigResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.get_disk_shrink_config.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_async + */ + getDiskShrinkConfig( + request?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ] + >; + getDiskShrinkConfig( + request: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getDiskShrinkConfig( + request: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getDiskShrinkConfig( + request?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getDiskShrinkConfig request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getDiskShrinkConfig response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getDiskShrinkConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDiskShrinkConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Reset Replica Size to primary instance disk size. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.reset_replica_size.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_async + */ + resetReplicaSize( + request?: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ] + >; + resetReplicaSize( + request: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + resetReplicaSize( + request: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + resetReplicaSize( + request?: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('resetReplicaSize request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('resetReplicaSize response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .resetReplicaSize(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resetReplicaSize response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Get Latest Recovery Time for a given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.protobuf.Timestamp} request.sourceInstanceDeletionTime + * The timestamp used to identify the time when the source instance is + * deleted. If this instance is deleted, then you must set the timestamp. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse|SqlInstancesGetLatestRecoveryTimeResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.get_latest_recovery_time.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_async + */ + getLatestRecoveryTime( + request?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ] + >; + getLatestRecoveryTime( + request: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getLatestRecoveryTime( + request: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getLatestRecoveryTime( + request?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getLatestRecoveryTime request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getLatestRecoveryTime response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getLatestRecoveryTime(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getLatestRecoveryTime response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Execute SQL statements. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Database instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.ExecuteSqlPayload} request.body + * The request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse|SqlInstancesExecuteSqlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.execute_sql.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ExecuteSql_async + */ + executeSql( + request?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest | undefined, + {} | undefined, + ] + >; + executeSql( + request: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + executeSql( + request: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + executeSql( + request?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('executeSql request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('executeSql response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .executeSql(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest | undefined, + {} | undefined, + ]) => { + this._log.info('executeSql response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This doesn't include the project ID. It's + * composed of lowercase letters, numbers, and hyphens, and it must start with + * a letter. The total length must be 98 characters or less (Example: + * instance-id). + * @param {string} request.project + * Required. Project ID of the project that contains the instance (Example: + * project-id). + * @param {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} request.body + * Required. The request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse|SqlInstancesAcquireSsrsLeaseResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_async + */ + acquireSsrsLease( + request?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + >; + acquireSsrsLease( + request: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + acquireSsrsLease( + request: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + acquireSsrsLease( + request?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('acquireSsrsLease request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('acquireSsrsLease response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .acquireSsrsLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('acquireSsrsLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Release a lease for the setup of SQL Server Reporting Services (SSRS). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. The Cloud SQL instance ID. This doesn't include the project ID. + * The instance ID contains lowercase letters, numbers, and hyphens, and it + * must start with a letter. This ID can have a maximum length of 98 + * characters. + * @param {string} request.project + * Required. The project ID that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse|SqlInstancesReleaseSsrsLeaseResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.release_ssrs_lease.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_async + */ + releaseSsrsLease( + request?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + >; + releaseSsrsLease( + request: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + releaseSsrsLease( + request: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + releaseSsrsLease( + request?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('releaseSsrsLease request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('releaseSsrsLease response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .releaseSsrsLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('releaseSsrsLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Execute MVU Pre-checks + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} request.body + * Required. The context for request to perform the pre-check major version + * upgrade operation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async + */ + preCheckMajorVersionUpgrade( + request?: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ] + >; + preCheckMajorVersionUpgrade( + request: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + preCheckMajorVersionUpgrade( + request: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + preCheckMajorVersionUpgrade( + request?: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('preCheckMajorVersionUpgrade request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('preCheckMajorVersionUpgrade response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .preCheckMajorVersionUpgrade(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('preCheckMajorVersionUpgrade response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Point in time restore for an instance managed by Google Cloud Backup and + * Disaster Recovery. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where you created this instance. + * Format: projects/{project} + * @param {google.cloud.sql.v1.PointInTimeRestoreContext} request.context + * Required. The context for request to perform a PITR on a Google Cloud + * Backup and Disaster Recovery managed instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.point_in_time_restore.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_async + */ + pointInTimeRestore( + request?: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ] + >; + pointInTimeRestore( + request: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + pointInTimeRestore( + request: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + pointInTimeRestore( + request?: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('pointInTimeRestore request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('pointInTimeRestore response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .pointInTimeRestore(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('pointInTimeRestore response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} backupvault + * @param {string} datasource + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath( + project: string, + location: string, + backupvault: string, + datasource: string, + backup: string, + ) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + location: location, + backupvault: backupvault, + datasource: datasource, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the location from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).location; + } + + /** + * Parse the backupvault from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backupvault. + */ + matchBackupvaultFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backupvault; + } + + /** + * Parse the datasource from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the datasource. + */ + matchDatasourceFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).datasource; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified network resource name string. + * + * @param {string} project + * @param {string} network + * @returns {string} Resource name string. + */ + networkPath(project: string, network: string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + network: network, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the network from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the network. + */ + matchNetworkFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).network; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlInstancesServiceStub && !this._terminated) { + return this.sqlInstancesServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client_config.json new file mode 100644 index 000000000000..d0194e6ed30d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client_config.json @@ -0,0 +1,241 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlInstancesService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "AddServerCa": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AddServerCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AddEntraIdCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Clone": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Delete": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DemoteMaster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Demote": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Export": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Failover": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Reencrypt": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Import": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Insert": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListServerCas": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListServerCertificates": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListEntraIdCertificates": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Patch": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PromoteReplica": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Switchover": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetSslConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Restart": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RotateServerCa": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RotateServerCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RotateEntraIdCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartReplica": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StopReplica": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TruncateLog": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Update": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateEphemeral": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RescheduleMaintenance": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "VerifyExternalSyncSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartExternalSync": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PerformDiskShrink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDiskShrinkConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetReplicaSize": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetLatestRecoveryTime": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ExecuteSql": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AcquireSsrsLease": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReleaseSsrsLease": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PreCheckMajorVersionUpgrade": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PointInTimeRestore": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client.ts new file mode 100644 index 000000000000..4d9599d37c13 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client.ts @@ -0,0 +1,916 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_operations_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_operations_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service to fetch operations for database instances. + * @class + * @memberof v1 + */ +export class SqlOperationsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlOperationsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlOperationsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlOperationsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlOperationsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlOperationsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlOperationsServiceStub) { + return this.sqlOperationsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlOperationsService. + this.sqlOperationsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlOperationsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlOperationsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlOperationsServiceStubMethods = ['get', 'list', 'cancel']; + for (const methodName of sqlOperationsServiceStubMethods) { + const callPromise = this.sqlOperationsServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlOperationsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Retrieves an instance operation that has been performed on an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.operation + * Required. Instance operation ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_operations_service.get.js + * region_tag:sqladmin_v1_generated_SqlOperationsService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + operation: request.operation ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all instance operations that have been performed on the given Cloud + * SQL instance in the reverse chronological order of the start time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {number} request.maxResults + * Maximum number of operations per response. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.OperationsListResponse|OperationsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_operations_service.list.js + * region_tag:sqladmin_v1_generated_SqlOperationsService_List_async + */ + list( + request?: protos.google.cloud.sql.v1.ISqlOperationsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1.ISqlOperationsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1.ISqlOperationsListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1.ISqlOperationsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperationsListResponse, + | protos.google.cloud.sql.v1.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperationsListResponse, + | protos.google.cloud.sql.v1.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Cancels an instance operation that has been performed on an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.operation + * Instance operation ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_operations_service.cancel.js + * region_tag:sqladmin_v1_generated_SqlOperationsService_Cancel_async + */ + cancel( + request?: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | undefined, + {} | undefined, + ] + >; + cancel( + request: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, + {} | null | undefined + >, + ): void; + cancel( + request: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, + {} | null | undefined + >, + ): void; + cancel( + request?: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + operation: request.operation ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('cancel request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('cancel response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .cancel(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | undefined, + {} | undefined, + ]) => { + this._log.info('cancel response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlOperationsServiceStub && !this._terminated) { + return this.sqlOperationsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client_config.json new file mode 100644 index 000000000000..c743c87fcf3c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client_config.json @@ -0,0 +1,41 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlOperationsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Cancel": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client.ts new file mode 100644 index 000000000000..a473e37048d6 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client.ts @@ -0,0 +1,487 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_regions_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_regions_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service that exposes Cloud SQL region information. This service is only used + * internally and does not follow the same patterns as the other v1 RPCs. + * @class + * @memberof v1 + */ +export class SqlRegionsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlRegionsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlRegionsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlRegionsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlRegionsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlRegionsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlRegionsServiceStub) { + return this.sqlRegionsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlRegionsService. + this.sqlRegionsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlRegionsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlRegionsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + return this.sqlRegionsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlRegionsServiceStub && !this._terminated) { + return this.sqlRegionsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client_config.json new file mode 100644 index 000000000000..a44241cc3d99 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client_config.json @@ -0,0 +1,25 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlRegionsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": {} + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts new file mode 100644 index 000000000000..e820b8c0dff9 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts @@ -0,0 +1,1046 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_ssl_certs_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_ssl_certs_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service to manage SSL certs for Cloud SQL instances. + * @class + * @memberof v1 + */ +export class SqlSslCertsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlSslCertsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlSslCertsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlSslCertsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlSslCertsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlSslCertsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlSslCertsServiceStub) { + return this.sqlSslCertsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlSslCertsService. + this.sqlSslCertsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlSslCertsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlSslCertsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlSslCertsServiceStubMethods = ['delete', 'get', 'insert', 'list']; + for (const methodName of sqlSslCertsServiceStubMethods) { + const callPromise = this.sqlSslCertsServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlSslCertsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Deletes the SSL certificate. For First Generation instances, the + * certificate remains valid until the instance is restarted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.sha1Fingerprint + * Sha1 FingerPrint. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_ssl_certs_service.delete.js + * region_tag:sqladmin_v1_generated_SqlSslCertsService_Delete_async + */ + delete( + request?: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ] + >; + delete( + request: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request?: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + sha1_fingerprint: request.sha1Fingerprint ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('delete request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('delete response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a particular SSL certificate. Does not include the private key + * (required for usage). The private key must be saved from the response to + * initial creation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.sha1Fingerprint + * Sha1 FingerPrint. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCert|SslCert}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_ssl_certs_service.get.js + * region_tag:sqladmin_v1_generated_SqlSslCertsService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + sha1_fingerprint: request.sha1Fingerprint ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates an SSL certificate and returns it along with the private key and + * server certificate authority. The new certificate will not be usable until + * the instance is restarted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.SslCertsInsertRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCertsInsertResponse|SslCertsInsertResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_ssl_certs_service.insert.js + * region_tag:sqladmin_v1_generated_SqlSslCertsService_Insert_async + */ + insert( + request?: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ] + >; + insert( + request: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request?: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('insert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('insert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all of the current SSL certificates for the instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCertsListResponse|SslCertsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_ssl_certs_service.list.js + * region_tag:sqladmin_v1_generated_SqlSslCertsService_List_async + */ + list( + request?: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlSslCertsServiceStub && !this._terminated) { + return this.sqlSslCertsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client_config.json new file mode 100644 index 000000000000..c16ba4e25f84 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlSslCertsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Delete": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Insert": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client.ts new file mode 100644 index 000000000000..559916f53617 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client.ts @@ -0,0 +1,644 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_tiers_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_tiers_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for providing machine types (tiers) for Cloud SQL instances. + * @class + * @memberof v1 + */ +export class SqlTiersServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlTiersServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlTiersServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlTiersServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlTiersServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlTiersService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlTiersServiceStub) { + return this.sqlTiersServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlTiersService. + this.sqlTiersServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlTiersService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlTiersService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlTiersServiceStubMethods = ['list']; + for (const methodName of sqlTiersServiceStubMethods) { + const callPromise = this.sqlTiersServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlTiersServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Lists all available machine types (tiers) for Cloud SQL, for example, + * `db-custom-1-3840`. For more information, see + * https://cloud.google.com/sql/pricing. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.project + * Project ID of the project for which to list tiers. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.TiersListResponse|TiersListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_tiers_service.list.js + * region_tag:sqladmin_v1_generated_SqlTiersService_List_async + */ + list( + request?: protos.google.cloud.sql.v1.ISqlTiersListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1.ISqlTiersListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1.ISqlTiersListRequest, + callback: Callback< + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1.ISqlTiersListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlTiersServiceStub && !this._terminated) { + return this.sqlTiersServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client_config.json new file mode 100644 index 000000000000..e68965701bb8 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlTiersService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client.ts new file mode 100644 index 000000000000..4ef6422ba951 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client.ts @@ -0,0 +1,1181 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1/sql_users_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_users_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Cloud SQL users service. + * @class + * @memberof v1 + */ +export class SqlUsersServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlUsersServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlUsersServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlUsersServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlUsersServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1.SqlUsersService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlUsersServiceStub) { + return this.sqlUsersServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1.SqlUsersService. + this.sqlUsersServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlUsersService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1.SqlUsersService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlUsersServiceStubMethods = [ + 'delete', + 'get', + 'insert', + 'list', + 'update', + ]; + for (const methodName of sqlUsersServiceStubMethods) { + const callPromise = this.sqlUsersServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlUsersServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Deletes a user from a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.host + * Host of the user in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * Name of the user in the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_users_service.delete.js + * region_tag:sqladmin_v1_generated_SqlUsersService_Delete_async + */ + delete( + request?: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ] + >; + delete( + request: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request?: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('delete request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('delete response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a resource containing information about a user. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * User of the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.host + * Host of a user of the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.User|User}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_users_service.get.js + * region_tag:sqladmin_v1_generated_SqlUsersService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1.ISqlUsersGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1.ISqlUsersGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1.ISqlUsersGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1.ISqlUsersGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a new user in a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.User} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_users_service.insert.js + * region_tag:sqladmin_v1_generated_SqlUsersService_Insert_async + */ + insert( + request?: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | undefined, + {} | undefined, + ] + >; + insert( + request: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request?: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('insert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('insert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists users in the specified Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.UsersListResponse|UsersListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_users_service.list.js + * region_tag:sqladmin_v1_generated_SqlUsersService_List_async + */ + list( + request?: protos.google.cloud.sql.v1.ISqlUsersListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1.ISqlUsersListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1.ISqlUsersListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1.ISqlUsersListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates an existing user in a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} [request.host] + * Optional. Host of the user in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * Name of the user in the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string[]} [request.databaseRoles] + * Optional. List of database roles to grant to the user. body.database_roles + * will be ignored for update request. + * @param {boolean} [request.revokeExistingRoles] + * Optional. Specifies whether to revoke existing roles that are not present + * in the `database_roles` field. If `false` or unset, the database roles + * specified in `database_roles` are added to the user's existing roles. + * @param {google.cloud.sql.v1.User} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_users_service.update.js + * region_tag:sqladmin_v1_generated_SqlUsersService_Update_async + */ + update( + request?: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ] + >; + update( + request: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; + update( + request: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; + update( + request?: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('update request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('update response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlUsersServiceStub && !this._terminated) { + return this.sqlUsersServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client_config.json new file mode 100644 index 000000000000..154c5021b316 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.sql.v1.SqlUsersService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Delete": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Insert": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Update": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_proto_list.json new file mode 100644 index 000000000000..b01e564537f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_proto_list.json @@ -0,0 +1,19 @@ +[ + "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/gapic_metadata.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/gapic_metadata.json new file mode 100644 index 000000000000..6c656c511fee --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/gapic_metadata.json @@ -0,0 +1,905 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.sql.v1beta4", + "libraryPackage": "@google-cloud/sql", + "services": { + "SqlBackupRunsService": { + "clients": { + "grpc": { + "libraryClient": "SqlBackupRunsServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlBackupRunsServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlBackupsService": { + "clients": { + "grpc": { + "libraryClient": "SqlBackupsServiceClient", + "rpcs": { + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlBackupsServiceClient", + "rpcs": { + "CreateBackup": { + "methods": [ + "createBackup" + ] + }, + "GetBackup": { + "methods": [ + "getBackup" + ] + }, + "UpdateBackup": { + "methods": [ + "updateBackup" + ] + }, + "DeleteBackup": { + "methods": [ + "deleteBackup" + ] + }, + "ListBackups": { + "methods": [ + "listBackups", + "listBackupsStream", + "listBackupsAsync" + ] + } + } + } + } + }, + "SqlConnectService": { + "clients": { + "grpc": { + "libraryClient": "SqlConnectServiceClient", + "rpcs": { + "GetConnectSettings": { + "methods": [ + "getConnectSettings" + ] + }, + "GenerateEphemeralCert": { + "methods": [ + "generateEphemeralCert" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlConnectServiceClient", + "rpcs": { + "GetConnectSettings": { + "methods": [ + "getConnectSettings" + ] + }, + "GenerateEphemeralCert": { + "methods": [ + "generateEphemeralCert" + ] + } + } + } + } + }, + "SqlDatabasesService": { + "clients": { + "grpc": { + "libraryClient": "SqlDatabasesServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "Update": { + "methods": [ + "update" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlDatabasesServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "Update": { + "methods": [ + "update" + ] + } + } + } + } + }, + "SqlFlagsService": { + "clients": { + "grpc": { + "libraryClient": "SqlFlagsServiceClient", + "rpcs": { + "List": { + "methods": [ + "list" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlFlagsServiceClient", + "rpcs": { + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlIamPoliciesService": { + "clients": { + "grpc": { + "libraryClient": "SqlIamPoliciesServiceClient", + "rpcs": {} + }, + "grpc-fallback": { + "libraryClient": "SqlIamPoliciesServiceClient", + "rpcs": {} + } + } + }, + "SqlInstancesService": { + "clients": { + "grpc": { + "libraryClient": "SqlInstancesServiceClient", + "rpcs": { + "AddServerCa": { + "methods": [ + "addServerCa" + ] + }, + "AddServerCertificate": { + "methods": [ + "addServerCertificate" + ] + }, + "AddEntraIdCertificate": { + "methods": [ + "addEntraIdCertificate" + ] + }, + "Clone": { + "methods": [ + "clone" + ] + }, + "Delete": { + "methods": [ + "delete" + ] + }, + "DemoteMaster": { + "methods": [ + "demoteMaster" + ] + }, + "Demote": { + "methods": [ + "demote" + ] + }, + "Export": { + "methods": [ + "export" + ] + }, + "Failover": { + "methods": [ + "failover" + ] + }, + "Reencrypt": { + "methods": [ + "reencrypt" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Import": { + "methods": [ + "import" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "ListServerCas": { + "methods": [ + "listServerCas" + ] + }, + "ListServerCertificates": { + "methods": [ + "listServerCertificates" + ] + }, + "ListEntraIdCertificates": { + "methods": [ + "listEntraIdCertificates" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "PromoteReplica": { + "methods": [ + "promoteReplica" + ] + }, + "Switchover": { + "methods": [ + "switchover" + ] + }, + "ResetSslConfig": { + "methods": [ + "resetSslConfig" + ] + }, + "Restart": { + "methods": [ + "restart" + ] + }, + "RestoreBackup": { + "methods": [ + "restoreBackup" + ] + }, + "RotateServerCa": { + "methods": [ + "rotateServerCa" + ] + }, + "RotateServerCertificate": { + "methods": [ + "rotateServerCertificate" + ] + }, + "RotateEntraIdCertificate": { + "methods": [ + "rotateEntraIdCertificate" + ] + }, + "StartReplica": { + "methods": [ + "startReplica" + ] + }, + "StopReplica": { + "methods": [ + "stopReplica" + ] + }, + "TruncateLog": { + "methods": [ + "truncateLog" + ] + }, + "Update": { + "methods": [ + "update" + ] + }, + "CreateEphemeral": { + "methods": [ + "createEphemeral" + ] + }, + "RescheduleMaintenance": { + "methods": [ + "rescheduleMaintenance" + ] + }, + "VerifyExternalSyncSettings": { + "methods": [ + "verifyExternalSyncSettings" + ] + }, + "StartExternalSync": { + "methods": [ + "startExternalSync" + ] + }, + "PerformDiskShrink": { + "methods": [ + "performDiskShrink" + ] + }, + "GetDiskShrinkConfig": { + "methods": [ + "getDiskShrinkConfig" + ] + }, + "ResetReplicaSize": { + "methods": [ + "resetReplicaSize" + ] + }, + "GetLatestRecoveryTime": { + "methods": [ + "getLatestRecoveryTime" + ] + }, + "ExecuteSql": { + "methods": [ + "executeSql" + ] + }, + "AcquireSsrsLease": { + "methods": [ + "acquireSsrsLease" + ] + }, + "ReleaseSsrsLease": { + "methods": [ + "releaseSsrsLease" + ] + }, + "PreCheckMajorVersionUpgrade": { + "methods": [ + "preCheckMajorVersionUpgrade" + ] + }, + "PointInTimeRestore": { + "methods": [ + "pointInTimeRestore" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlInstancesServiceClient", + "rpcs": { + "AddServerCa": { + "methods": [ + "addServerCa" + ] + }, + "AddServerCertificate": { + "methods": [ + "addServerCertificate" + ] + }, + "AddEntraIdCertificate": { + "methods": [ + "addEntraIdCertificate" + ] + }, + "Clone": { + "methods": [ + "clone" + ] + }, + "Delete": { + "methods": [ + "delete" + ] + }, + "DemoteMaster": { + "methods": [ + "demoteMaster" + ] + }, + "Demote": { + "methods": [ + "demote" + ] + }, + "Export": { + "methods": [ + "export" + ] + }, + "Failover": { + "methods": [ + "failover" + ] + }, + "Reencrypt": { + "methods": [ + "reencrypt" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Import": { + "methods": [ + "import" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "ListServerCas": { + "methods": [ + "listServerCas" + ] + }, + "ListServerCertificates": { + "methods": [ + "listServerCertificates" + ] + }, + "ListEntraIdCertificates": { + "methods": [ + "listEntraIdCertificates" + ] + }, + "Patch": { + "methods": [ + "patch" + ] + }, + "PromoteReplica": { + "methods": [ + "promoteReplica" + ] + }, + "Switchover": { + "methods": [ + "switchover" + ] + }, + "ResetSslConfig": { + "methods": [ + "resetSslConfig" + ] + }, + "Restart": { + "methods": [ + "restart" + ] + }, + "RestoreBackup": { + "methods": [ + "restoreBackup" + ] + }, + "RotateServerCa": { + "methods": [ + "rotateServerCa" + ] + }, + "RotateServerCertificate": { + "methods": [ + "rotateServerCertificate" + ] + }, + "RotateEntraIdCertificate": { + "methods": [ + "rotateEntraIdCertificate" + ] + }, + "StartReplica": { + "methods": [ + "startReplica" + ] + }, + "StopReplica": { + "methods": [ + "stopReplica" + ] + }, + "TruncateLog": { + "methods": [ + "truncateLog" + ] + }, + "Update": { + "methods": [ + "update" + ] + }, + "CreateEphemeral": { + "methods": [ + "createEphemeral" + ] + }, + "RescheduleMaintenance": { + "methods": [ + "rescheduleMaintenance" + ] + }, + "VerifyExternalSyncSettings": { + "methods": [ + "verifyExternalSyncSettings" + ] + }, + "StartExternalSync": { + "methods": [ + "startExternalSync" + ] + }, + "PerformDiskShrink": { + "methods": [ + "performDiskShrink" + ] + }, + "GetDiskShrinkConfig": { + "methods": [ + "getDiskShrinkConfig" + ] + }, + "ResetReplicaSize": { + "methods": [ + "resetReplicaSize" + ] + }, + "GetLatestRecoveryTime": { + "methods": [ + "getLatestRecoveryTime" + ] + }, + "ExecuteSql": { + "methods": [ + "executeSql" + ] + }, + "AcquireSsrsLease": { + "methods": [ + "acquireSsrsLease" + ] + }, + "ReleaseSsrsLease": { + "methods": [ + "releaseSsrsLease" + ] + }, + "PreCheckMajorVersionUpgrade": { + "methods": [ + "preCheckMajorVersionUpgrade" + ] + }, + "PointInTimeRestore": { + "methods": [ + "pointInTimeRestore" + ] + } + } + } + } + }, + "SqlOperationsService": { + "clients": { + "grpc": { + "libraryClient": "SqlOperationsServiceClient", + "rpcs": { + "Get": { + "methods": [ + "get" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Cancel": { + "methods": [ + "cancel" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlOperationsServiceClient", + "rpcs": { + "Get": { + "methods": [ + "get" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Cancel": { + "methods": [ + "cancel" + ] + } + } + } + } + }, + "SqlSslCertsService": { + "clients": { + "grpc": { + "libraryClient": "SqlSslCertsServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlSslCertsServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlTiersService": { + "clients": { + "grpc": { + "libraryClient": "SqlTiersServiceClient", + "rpcs": { + "List": { + "methods": [ + "list" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlTiersServiceClient", + "rpcs": { + "List": { + "methods": [ + "list" + ] + } + } + } + } + }, + "SqlUsersService": { + "clients": { + "grpc": { + "libraryClient": "SqlUsersServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Update": { + "methods": [ + "update" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SqlUsersServiceClient", + "rpcs": { + "Delete": { + "methods": [ + "delete" + ] + }, + "Get": { + "methods": [ + "get" + ] + }, + "Insert": { + "methods": [ + "insert" + ] + }, + "List": { + "methods": [ + "list" + ] + }, + "Update": { + "methods": [ + "update" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/index.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/index.ts new file mode 100644 index 000000000000..d8f42f199ca2 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/index.ts @@ -0,0 +1,29 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export { SqlBackupRunsServiceClient } from './sql_backup_runs_service_client'; +export { SqlBackupsServiceClient } from './sql_backups_service_client'; +export { SqlConnectServiceClient } from './sql_connect_service_client'; +export { SqlDatabasesServiceClient } from './sql_databases_service_client'; +export { SqlFlagsServiceClient } from './sql_flags_service_client'; +export { SqlIamPoliciesServiceClient } from './sql_iam_policies_service_client'; +export { SqlInstancesServiceClient } from './sql_instances_service_client'; +export { SqlOperationsServiceClient } from './sql_operations_service_client'; +export { SqlSslCertsServiceClient } from './sql_ssl_certs_service_client'; +export { SqlTiersServiceClient } from './sql_tiers_service_client'; +export { SqlUsersServiceClient } from './sql_users_service_client'; diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts new file mode 100644 index 000000000000..1d8a6b7aca1a --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts @@ -0,0 +1,1114 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_backup_runs_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_backup_runs_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta4 + */ +export class SqlBackupRunsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlBackupRunsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlBackupRunsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlBackupRunsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlBackupRunsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlBackupRunsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlBackupRunsServiceStub) { + return this.sqlBackupRunsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlBackupRunsService. + this.sqlBackupRunsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlBackupRunsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlBackupRunsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlBackupRunsServiceStubMethods = ['delete', 'get', 'insert', 'list']; + for (const methodName of sqlBackupRunsServiceStubMethods) { + const callPromise = this.sqlBackupRunsServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlBackupRunsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Deletes the backup taken by a backup run. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.id + * The ID of the backup run to delete. To find a backup run ID, use the + * [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/backupRuns/list) + * method. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backup_runs_service.delete.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Delete_async + */ + delete( + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest | undefined, + {} | undefined, + ] + >; + delete( + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + delete( + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + delete( + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + id: request.id?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('delete request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('delete response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a resource containing information about a backup run. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.id + * The ID of this backup run. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.BackupRun|BackupRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backup_runs_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackupRun, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackupRun, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackupRun, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IBackupRun, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IBackupRun, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackupRun, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + id: request.id?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IBackupRun, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IBackupRun, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a new backup run on demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.BackupRun} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backup_runs_service.insert.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Insert_async + */ + insert( + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest | undefined, + {} | undefined, + ] + >; + insert( + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + insert( + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + insert( + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('insert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('insert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all backup runs associated with the project or a given instance and + * configuration in the reverse chronological order of the backup initiation + * time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID, or "-" for all instances. This does not include + * the project ID. + * @param {number} request.maxResults + * Maximum number of backup runs per response. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.BackupRunsListResponse|BackupRunsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backup_runs_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_List_async + */ + list( + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlBackupRunsServiceStub && !this._terminated) { + return this.sqlBackupRunsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client_config.json new file mode 100644 index 000000000000..809d41f9fddc --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlBackupRunsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Delete": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Insert": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts new file mode 100644 index 000000000000..8c51bd7530ed --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts @@ -0,0 +1,1339 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_backups_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_backups_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta4 + */ +export class SqlBackupsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlBackupsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlBackupsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlBackupsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlBackupsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listBackups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'backups', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlBackupsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlBackupsServiceStub) { + return this.sqlBackupsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlBackupsService. + this.sqlBackupsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlBackupsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlBackupsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlBackupsServiceStubMethods = [ + 'createBackup', + 'getBackup', + 'listBackups', + 'updateBackup', + 'deleteBackup', + ]; + for (const methodName of sqlBackupsServiceStubMethods) { + const callPromise = this.sqlBackupsServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlBackupsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Creates a backup for a Cloud SQL instance. This API can be used only to + * create on-demand backups. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this backup is created. + * Format: projects/{project} + * @param {google.cloud.sql.v1beta4.Backup} request.backup + * Required. The Backup to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backups_service.create_backup.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_CreateBackup_async + */ + createBackup( + request?: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | undefined, + {} | undefined, + ] + >; + createBackup( + request: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + createBackup( + request: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + createBackup( + request?: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ICreateBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ICreateBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a resource containing information about a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the backup to retrieve. + * Format: projects/{project}/backups/{backup} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backups_service.get_backup.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_GetBackup_async + */ + getBackup( + request?: protos.google.cloud.sql.v1beta4.IGetBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | undefined, + {} | undefined, + ] + >; + getBackup( + request: protos.google.cloud.sql.v1beta4.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + getBackup( + request: protos.google.cloud.sql.v1beta4.IGetBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + getBackup( + request?: protos.google.cloud.sql.v1beta4.IGetBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates the retention period and the description of the backup. You can use + * this API to update final backups only. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.sql.v1beta4.Backup} request.backup + * Required. The backup to update. + * The backup’s `name` field is used to identify the backup to update. + * Format: projects/{project}/backups/{backup} + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields that you can update. You can update only the description + * and retention period of the final backup. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backups_service.update_backup.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_UpdateBackup_async + */ + updateBackup( + request?: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | undefined, + {} | undefined, + ] + >; + updateBackup( + request: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + updateBackup( + request: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + updateBackup( + request?: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.IUpdateBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'backup.name': request.backup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('updateBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.IUpdateBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('updateBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .updateBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes the backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the backup to delete. + * Format: projects/{project}/backups/{backup} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backups_service.delete_backup.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_DeleteBackup_async + */ + deleteBackup( + request?: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | undefined, + {} | undefined, + ] + >; + deleteBackup( + request: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteBackup( + request: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; + deleteBackup( + request?: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.IDeleteBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('deleteBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.IDeleteBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('deleteBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .deleteBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Lists all backups associated with the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackups( + request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackup[], + protos.google.cloud.sql.v1beta4.IListBackupsRequest | null, + protos.google.cloud.sql.v1beta4.IListBackupsResponse, + ] + >; + listBackups( + request: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.sql.v1beta4.IListBackupsRequest, + protos.google.cloud.sql.v1beta4.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1beta4.IBackup + >, + ): void; + listBackups( + request: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.sql.v1beta4.IListBackupsRequest, + protos.google.cloud.sql.v1beta4.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1beta4.IBackup + >, + ): void; + listBackups( + request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< + protos.google.cloud.sql.v1beta4.IListBackupsRequest, + | protos.google.cloud.sql.v1beta4.IListBackupsResponse + | null + | undefined, + protos.google.cloud.sql.v1beta4.IBackup + >, + callback?: PaginationCallback< + protos.google.cloud.sql.v1beta4.IListBackupsRequest, + protos.google.cloud.sql.v1beta4.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1beta4.IBackup + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackup[], + protos.google.cloud.sql.v1beta4.IListBackupsRequest | null, + protos.google.cloud.sql.v1beta4.IListBackupsResponse, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.sql.v1beta4.IListBackupsRequest, + | protos.google.cloud.sql.v1beta4.IListBackupsResponse + | null + | undefined, + protos.google.cloud.sql.v1beta4.IBackup + > + | undefined = callback + ? (error, values, nextPageRequest, rawResponse) => { + this._log.info('listBackups values %j', values); + callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. + } + : undefined; + this._log.info('listBackups request %j', request); + return this.innerApiCalls + .listBackups(request, options, wrappedCallback) + ?.then( + ([response, input, output]: [ + protos.google.cloud.sql.v1beta4.IBackup[], + protos.google.cloud.sql.v1beta4.IListBackupsRequest | null, + protos.google.cloud.sql.v1beta4.IListBackupsResponse, + ]) => { + this._log.info('listBackups values %j', response); + return [response, input, output]; + }, + ); + } + + /** + * Equivalent to `listBackups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.sql.v1beta4.Backup|Backup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBackupsStream( + request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + options?: CallOptions, + ): Transform { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listBackups stream %j', request); + return this.descriptors.page.listBackups.createStream( + this.innerApiCalls.listBackups as GaxCall, + request, + callSettings, + ); + } + + /** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backups_service.list_backups.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_ListBackups_async + */ + listBackupsAsync( + request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + options?: CallOptions, + ): AsyncIterable { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listBackups']; + const callSettings = defaultCallSettings.merge(options); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listBackups iterate %j', request); + return this.descriptors.page.listBackups.asyncIterate( + this.innerApiCalls['listBackups'] as GaxCall, + request as {}, + callSettings, + ) as AsyncIterable; + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlBackupsServiceStub && !this._terminated) { + return this.sqlBackupsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client_config.json new file mode 100644 index 000000000000..bb2f7167b21d --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlBackupsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "CreateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListBackups": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts new file mode 100644 index 000000000000..98f4fcbdfa17 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts @@ -0,0 +1,816 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_connect_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_connect_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Cloud SQL connect service. + * @class + * @memberof v1beta4 + */ +export class SqlConnectServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlConnectServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlConnectServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlConnectServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlConnectServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlConnectService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlConnectServiceStub) { + return this.sqlConnectServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlConnectService. + this.sqlConnectServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlConnectService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlConnectService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlConnectServiceStubMethods = [ + 'getConnectSettings', + 'generateEphemeralCert', + ]; + for (const methodName of sqlConnectServiceStubMethods) { + const callPromise = this.sqlConnectServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlConnectServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Retrieves connect settings about a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.protobuf.Timestamp} [request.readTime] + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.ConnectSettings|ConnectSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_connect_service.get_connect_settings.js + * region_tag:sqladmin_v1beta4_generated_SqlConnectService_GetConnectSettings_async + */ + getConnectSettings( + request?: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IConnectSettings, + protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest | undefined, + {} | undefined, + ] + >; + getConnectSettings( + request: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IConnectSettings, + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getConnectSettings( + request: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IConnectSettings, + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getConnectSettings( + request?: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IConnectSettings, + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IConnectSettings, + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IConnectSettings, + protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getConnectSettings request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IConnectSettings, + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getConnectSettings response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getConnectSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IConnectSettings, + ( + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getConnectSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Generates a short-lived X509 certificate containing the provided public key + * and signed by a private key specific to the target instance. Users may use + * the certificate to authenticate as themselves when connecting to the + * database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.publicKey + * PEM encoded public key to include in the signed certificate. + * @param {string} [request.accessToken] + * Optional. Access token to include in the signed certificate. + * @param {google.protobuf.Timestamp} [request.readTime] + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + * @param {google.protobuf.Duration} [request.validDuration] + * Optional. If set, it will contain the cert valid duration. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse|GenerateEphemeralCertResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js + * region_tag:sqladmin_v1beta4_generated_SqlConnectService_GenerateEphemeralCert_async + */ + generateEphemeralCert( + request?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest | undefined, + {} | undefined, + ] + >; + generateEphemeralCert( + request: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + generateEphemeralCert( + request: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + generateEphemeralCert( + request?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('generateEphemeralCert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('generateEphemeralCert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .generateEphemeralCert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + ( + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('generateEphemeralCert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlConnectServiceStub && !this._terminated) { + return this.sqlConnectServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client_config.json new file mode 100644 index 000000000000..6d2f142ab0d5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client_config.json @@ -0,0 +1,34 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlConnectService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "GetConnectSettings": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GenerateEphemeralCert": { + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts new file mode 100644 index 000000000000..acc2d5a1d7c3 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts @@ -0,0 +1,1405 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_databases_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_databases_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta4 + */ +export class SqlDatabasesServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlDatabasesServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlDatabasesServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlDatabasesServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlDatabasesServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlDatabasesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlDatabasesServiceStub) { + return this.sqlDatabasesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlDatabasesService. + this.sqlDatabasesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlDatabasesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlDatabasesService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlDatabasesServiceStubMethods = [ + 'delete', + 'get', + 'insert', + 'list', + 'patch', + 'update', + ]; + for (const methodName of sqlDatabasesServiceStubMethods) { + const callPromise = this.sqlDatabasesServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlDatabasesServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Deletes a database from a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be deleted in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.delete.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Delete_async + */ + delete( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest | undefined, + {} | undefined, + ] + >; + delete( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + delete( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + delete( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('delete request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('delete response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a resource containing information about a database inside a Cloud + * SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Database|Database}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabase, + protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabase, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabase, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IDatabase, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IDatabase, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabase, + protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IDatabase, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IDatabase, + protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Inserts a resource containing information about a database inside a Cloud + * SQL instance. + * + * **Note:** You can't modify the default character set and collation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.insert.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Insert_async + */ + insert( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest | undefined, + {} | undefined, + ] + >; + insert( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + insert( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + insert( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('insert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('insert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists databases in the specified Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.DatabasesListResponse|DatabasesListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_List_async + */ + list( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Partially updates a resource containing information about a database inside + * a Cloud SQL instance. This method supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be updated in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.patch.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Patch_async + */ + patch( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + >; + patch( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + patch( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + patch( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('patch request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('patch response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .patch(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('patch response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates a resource containing information about a database inside a Cloud + * SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be updated in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.update.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Update_async + */ + update( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + >; + update( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + update( + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + update( + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('update request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('update response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlDatabasesServiceStub && !this._terminated) { + return this.sqlDatabasesServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client_config.json new file mode 100644 index 000000000000..21a09f6de4ff --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client_config.json @@ -0,0 +1,56 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlDatabasesService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Delete": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Insert": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Patch": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Update": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts new file mode 100644 index 000000000000..2ada4fa5a4c1 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts @@ -0,0 +1,671 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_flags_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_flags_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta4 + */ +export class SqlFlagsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlFlagsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlFlagsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlFlagsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlFlagsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlFlagsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlFlagsServiceStub) { + return this.sqlFlagsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlFlagsService. + this.sqlFlagsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlFlagsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlFlagsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlFlagsServiceStubMethods = ['list']; + for (const methodName of sqlFlagsServiceStubMethods) { + const callPromise = this.sqlFlagsServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlFlagsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Lists all available database flags for Cloud SQL instances. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.databaseVersion + * Database type and version you want to retrieve flags for. By default, this + * method returns flags for all database types and versions. + * @param {google.cloud.sql.v1beta4.SqlFlagScope} [request.flagScope] + * Optional. Specify the scope of flags to be returned by SqlFlagsListService. + * Return list of database flags if unspecified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.FlagsListResponse|FlagsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_flags_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlFlagsService_List_async + */ + list( + request?: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlFlagsServiceStub && !this._terminated) { + return this.sqlFlagsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client_config.json new file mode 100644 index 000000000000..55a4437b0a0f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlFlagsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client.ts new file mode 100644 index 000000000000..17b3569e3d57 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client.ts @@ -0,0 +1,487 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_iam_policies_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_iam_policies_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for providing IAM Meta APIs for Cloud SQL. + * @class + * @memberof v1beta4 + */ +export class SqlIamPoliciesServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlIamPoliciesServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlIamPoliciesServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlIamPoliciesServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this + .constructor as typeof SqlIamPoliciesServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlIamPoliciesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlIamPoliciesServiceStub) { + return this.sqlIamPoliciesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlIamPoliciesService. + this.sqlIamPoliciesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlIamPoliciesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlIamPoliciesService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + return this.sqlIamPoliciesServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return []; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlIamPoliciesServiceStub && !this._terminated) { + return this.sqlIamPoliciesServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client_config.json new file mode 100644 index 000000000000..8db77c020b9e --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client_config.json @@ -0,0 +1,25 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlIamPoliciesService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": {} + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts new file mode 100644 index 000000000000..a487606fd449 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts @@ -0,0 +1,6945 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_instances_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_instances_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta4 + */ +export class SqlInstancesServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlInstancesServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlInstancesServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlInstancesServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlInstancesServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlInstancesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlInstancesServiceStub) { + return this.sqlInstancesServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlInstancesService. + this.sqlInstancesServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlInstancesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlInstancesService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlInstancesServiceStubMethods = [ + 'addServerCa', + 'addServerCertificate', + 'addEntraIdCertificate', + 'clone', + 'delete', + 'demoteMaster', + 'demote', + 'export', + 'failover', + 'reencrypt', + 'get', + 'import', + 'insert', + 'list', + 'listServerCas', + 'listServerCertificates', + 'listEntraIdCertificates', + 'patch', + 'promoteReplica', + 'switchover', + 'resetSslConfig', + 'restart', + 'restoreBackup', + 'rotateServerCa', + 'rotateServerCertificate', + 'rotateEntraIdCertificate', + 'startReplica', + 'stopReplica', + 'truncateLog', + 'update', + 'createEphemeral', + 'rescheduleMaintenance', + 'verifyExternalSyncSettings', + 'startExternalSync', + 'performDiskShrink', + 'getDiskShrinkConfig', + 'resetReplicaSize', + 'getLatestRecoveryTime', + 'executeSql', + 'acquireSsrsLease', + 'releaseSsrsLease', + 'preCheckMajorVersionUpgrade', + 'pointInTimeRestore', + ]; + for (const methodName of sqlInstancesServiceStubMethods) { + const callPromise = this.sqlInstancesServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlInstancesServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Add a new trusted Certificate Authority (CA) version for the specified + * instance. Required to prepare for a certificate rotation. If a CA version + * was previously added but never used in a certificate rotation, this + * operation replaces that version. There cannot be more than one CA version + * waiting to be rotated in. For instances that have enabled Certificate + * Authority Service (CAS) based server CA, use AddServerCertificate to add a + * new server certificate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.add_server_ca.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddServerCa_async + */ + addServerCa( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | undefined + ), + {} | undefined, + ] + >; + addServerCa( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addServerCa( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addServerCa( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('addServerCa request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('addServerCa response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .addServerCa(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addServerCa response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Add a new trusted server certificate version for the specified instance + * using Certificate Authority Service (CAS) server CA. Required to prepare + * for a certificate rotation. If a server certificate version was previously + * added but never used in a certificate rotation, this operation replaces + * that version. There cannot be more than one certificate version waiting to + * be rotated in. For instances not using CAS server CA, use AddServerCa + * instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.add_server_certificate.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddServerCertificate_async + */ + addServerCertificate( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ] + >; + addServerCertificate( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addServerCertificate( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addServerCertificate( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('addServerCertificate request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('addServerCertificate response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .addServerCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addServerCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Adds a new Entra ID certificate for the specified instance. If an Entra ID + * certificate was previously added but never used in a certificate rotation, + * this operation replaces that version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddEntraIdCertificate_async + */ + addEntraIdCertificate( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + >; + addEntraIdCertificate( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addEntraIdCertificate( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + addEntraIdCertificate( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('addEntraIdCertificate request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('addEntraIdCertificate response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .addEntraIdCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addEntraIdCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a Cloud SQL instance as a clone of the source instance. Using this + * operation might cause your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * The ID of the Cloud SQL instance to be cloned (source). This does not + * include the project ID. + * @param {string} request.project + * Project ID of the source as well as the clone Cloud SQL instance. + * @param {google.cloud.sql.v1beta4.InstancesCloneRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.clone.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Clone_async + */ + clone( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ] + >; + clone( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + clone( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + clone( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('clone request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('clone response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .clone(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ]) => { + this._log.info('clone response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be deleted. + * @param {boolean} request.enableFinalBackup + * Flag to opt-in for final backup. By default, it is turned off. + * @param {number} [request.finalBackupTtlDays] + * Optional. Retention period of the final backup. + * @param {google.protobuf.Timestamp} [request.finalBackupExpiryTime] + * Optional. Final Backup expiration time. + * Timestamp in UTC of when this resource is considered expired. + * @param {string} [request.finalBackupDescription] + * Optional. The description of the final backup. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.delete.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Delete_async + */ + delete( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest | undefined, + {} | undefined, + ] + >; + delete( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + delete( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + delete( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('delete request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('delete response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Demotes the stand-alone instance to be a Cloud SQL read replica for an + * external database server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance name. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.demote_master.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_DemoteMaster_async + */ + demoteMaster( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | undefined + ), + {} | undefined, + ] + >; + demoteMaster( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + demoteMaster( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + demoteMaster( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('demoteMaster request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('demoteMaster response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .demoteMaster(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('demoteMaster response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Demotes an existing standalone instance to be a Cloud SQL read replica + * for an external database server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. The name of the Cloud SQL instance. + * @param {string} request.project + * Required. The project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesDemoteRequest} request.body + * The request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.demote.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Demote_async + */ + demote( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest | undefined, + {} | undefined, + ] + >; + demote( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + demote( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + demote( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('demote request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('demote response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .demote(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('demote response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL + * dump or CSV file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * The Cloud SQL instance ID. This doesn't include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be exported. + * @param {google.cloud.sql.v1beta4.InstancesExportRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.export.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Export_async + */ + export( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest | undefined, + {} | undefined, + ] + >; + export( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + export( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + export( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('export request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('export response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .export(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('export response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Initiates a manual failover of a high availability (HA) primary instance + * to a standby instance, which becomes the primary instance. Users are + * then rerouted to the new primary. For more information, see the + * [Overview of high + * availability](https://cloud.google.com/sql/docs/mysql/high-availability) + * page in the Cloud SQL documentation. + * If using Legacy HA (MySQL only), this causes the instance to failover to + * its failover replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {google.cloud.sql.v1beta4.InstancesFailoverRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.failover.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Failover_async + */ + failover( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest | undefined, + {} | undefined, + ] + >; + failover( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + failover( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + failover( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('failover request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('failover response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .failover(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('failover response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Reencrypt CMEK instance with latest key version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesReencryptRequest} request.body + * Reencrypt body that users request + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.reencrypt.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Reencrypt_async + */ + reencrypt( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest | undefined, + {} | undefined, + ] + >; + reencrypt( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + reencrypt( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + reencrypt( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('reencrypt request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('reencrypt response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .reencrypt(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('reencrypt response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a resource containing information about a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.DatabaseInstance|DatabaseInstance}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Imports data into a Cloud SQL instance from a SQL dump or CSV file in + * Cloud Storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesImportRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.import.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Import_async + */ + import( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest | undefined, + {} | undefined, + ] + >; + import( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + import( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + import( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('import request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('import response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .import(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('import response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a new Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.project + * Project ID of the project to which the newly created Cloud SQL instances + * should belong. + * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.insert.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Insert_async + */ + insert( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest | undefined, + {} | undefined, + ] + >; + insert( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + insert( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + insert( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('insert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('insert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists instances under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.filter + * A filter expression that filters resources listed in the response. + * The expression is in the form of field:value. For example, + * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per + * their JSON representation, such as 'settings.userLabels.auto_start:true'. + * + * Multiple filter queries are space-separated. For example. + * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each + * expression is an AND expression. However, you can include AND and OR + * expressions explicitly. + * @param {number} request.maxResults + * The maximum number of instances to return. The service may return fewer + * than this value. + * If unspecified, at most 500 instances are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project for which to list Cloud SQL instances. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListResponse|InstancesListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_List_async + */ + list( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all of the trusted Certificate Authorities (CAs) for the specified + * instance. There can be up to three CAs listed: the CA that was used to sign + * the certificate that is currently in use, a CA that has been added but not + * yet used to sign a certificate, and a CA used to sign a certificate that + * has previously rotated out. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse|InstancesListServerCasResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.list_server_cas.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListServerCas_async + */ + listServerCas( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | undefined + ), + {} | undefined, + ] + >; + listServerCas( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listServerCas( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listServerCas( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listServerCas request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('listServerCas response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .listServerCas(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listServerCas response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all versions of server certificates and certificate authorities (CAs) + * for the specified instance. There can be up to three sets of certs listed: + * the certificate that is currently in use, a future that has been added but + * not yet used to sign a certificate, and a certificate that has been rotated + * out. For instances not using Certificate Authority Service (CAS) server CA, + * use ListServerCas instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse|InstancesListServerCertificatesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.list_server_certificates.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListServerCertificates_async + */ + listServerCertificates( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ] + >; + listServerCertificates( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listServerCertificates( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listServerCertificates( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listServerCertificates request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('listServerCertificates response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .listServerCertificates(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listServerCertificates response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all versions of EntraID certificates for the specified instance. + * There can be up to three sets of certificates listed: the certificate that + * is currently in use, a future that has been added but not yet used to sign + * a certificate, and a certificate that has been rotated out. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse|InstancesListEntraIdCertificatesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListEntraIdCertificates_async + */ + listEntraIdCertificates( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ] + >; + listEntraIdCertificates( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listEntraIdCertificates( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + listEntraIdCertificates( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('listEntraIdCertificates request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('listEntraIdCertificates response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .listEntraIdCertificates(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listEntraIdCertificates response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Partially updates settings of a Cloud SQL instance by merging the request + * with the current configuration. This method supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.patch.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Patch_async + */ + patch( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ] + >; + patch( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + patch( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + patch( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('patch request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('patch response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .patch(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ]) => { + this._log.info('patch response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Promotes the read replica instance to be an independent Cloud SQL + * primary instance. + * Using this operation might cause your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {boolean} request.failover + * Set to true to invoke a replica failover to the DR replica. + * As part of replica failover, the promote operation attempts + * to add the original primary instance as a replica of the promoted + * DR replica when the original primary instance comes back online. + * If set to false or not specified, then the original primary + * instance becomes an independent Cloud SQL primary instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.promote_replica.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PromoteReplica_async + */ + promoteReplica( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | undefined + ), + {} | undefined, + ] + >; + promoteReplica( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + promoteReplica( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + promoteReplica( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('promoteReplica request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('promoteReplica response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .promoteReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('promoteReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Switches over from the primary instance to the DR replica + * instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the replica. + * @param {google.protobuf.Duration} [request.dbTimeout] + * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations + * timeout, which is a sum of all database operations. Default value is 10 + * minutes and can be modified to a maximum value of 24 hours. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.switchover.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Switchover_async + */ + switchover( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | undefined + ), + {} | undefined, + ] + >; + switchover( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + switchover( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + switchover( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('switchover request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('switchover response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .switchover(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('switchover response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Deletes all client certificates and generates a new server SSL certificate + * for the instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode} [request.mode] + * Optional. Reset SSL mode to use. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ResetSslConfig_async + */ + resetSslConfig( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | undefined + ), + {} | undefined, + ] + >; + resetSslConfig( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + resetSslConfig( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + resetSslConfig( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('resetSslConfig request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('resetSslConfig response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .resetSslConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resetSslConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Restarts a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be restarted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.restart.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Restart_async + */ + restart( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest | undefined, + {} | undefined, + ] + >; + restart( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + restart( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + restart( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('restart request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('restart response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .restart(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('restart response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Restores a backup of a Cloud SQL instance. Using this operation might cause + * your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.restore_backup.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RestoreBackup_async + */ + restoreBackup( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | undefined + ), + {} | undefined, + ] + >; + restoreBackup( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + restoreBackup( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + restoreBackup( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('restoreBackup request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('restoreBackup response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .restoreBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('restoreBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Rotates the server certificate to one signed by the Certificate Authority + * (CA) version previously added with the addServerCA method. For instances + * that have enabled Certificate Authority Service (CAS) based server CA, + * use RotateServerCertificate to rotate the server certificate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCa_async + */ + rotateServerCa( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | undefined + ), + {} | undefined, + ] + >; + rotateServerCa( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateServerCa( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateServerCa( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('rotateServerCa request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('rotateServerCa response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .rotateServerCa(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateServerCa response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Rotates the server certificate version to one previously added with the + * addServerCertificate method. For instances not using Certificate Authority + * Service (CAS) server CA, use RotateServerCa instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} request.body + * Required. Rotate server certificate request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCertificate_async + */ + rotateServerCertificate( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ] + >; + rotateServerCertificate( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateServerCertificate( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateServerCertificate( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('rotateServerCertificate request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('rotateServerCertificate response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .rotateServerCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateServerCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Rotates the Entra Id certificate version to one previously added with the + * addEntraIdCertificate method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} request.body + * Required. Rotate Entra ID certificate request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateEntraIdCertificate_async + */ + rotateEntraIdCertificate( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + >; + rotateEntraIdCertificate( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateEntraIdCertificate( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rotateEntraIdCertificate( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('rotateEntraIdCertificate request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('rotateEntraIdCertificate response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .rotateEntraIdCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateEntraIdCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Starts the replication in the read replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.start_replica.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StartReplica_async + */ + startReplica( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | undefined + ), + {} | undefined, + ] + >; + startReplica( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + startReplica( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + startReplica( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('startReplica request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('startReplica response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .startReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Stops the replication in the read replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.stop_replica.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StopReplica_async + */ + stopReplica( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | undefined + ), + {} | undefined, + ] + >; + stopReplica( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + stopReplica( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + stopReplica( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('stopReplica request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('stopReplica response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .stopReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('stopReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Truncate MySQL general and slow query log tables + * MySQL only. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the Cloud SQL project. + * @param {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.truncate_log.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_TruncateLog_async + */ + truncateLog( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | undefined + ), + {} | undefined, + ] + >; + truncateLog( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + truncateLog( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + truncateLog( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('truncateLog request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('truncateLog response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .truncateLog(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('truncateLog response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates settings of a Cloud SQL instance. Using this operation might cause + * your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.update.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Update_async + */ + update( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest | undefined, + {} | undefined, + ] + >; + update( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + update( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + update( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('update request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('update response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Generates a short-lived X509 certificate containing the provided public key + * and signed by a private key specific to the target instance. Users may use + * the certificate to authenticate as themselves when connecting to the + * database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the Cloud SQL project. + * @param {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCert|SslCert}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.create_ephemeral.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_CreateEphemeral_async + */ + createEphemeral( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCert, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ] + >; + createEphemeral( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + createEphemeral( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + createEphemeral( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCert, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('createEphemeral request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('createEphemeral response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .createEphemeral(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISslCert, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createEphemeral response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Reschedules the maintenance on the given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RescheduleMaintenance_async + */ + rescheduleMaintenance( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ] + >; + rescheduleMaintenance( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rescheduleMaintenance( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + rescheduleMaintenance( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('rescheduleMaintenance request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('rescheduleMaintenance response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .rescheduleMaintenance(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rescheduleMaintenance response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Verify External primary instance external sync settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {boolean} request.verifyConnectionOnly + * Flag to enable verifying connection only + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode + * External sync mode + * @param {boolean} [request.verifyReplicationOnly] + * Optional. Flag to verify settings required by replication setup only + * @param {google.cloud.sql.v1beta4.MySqlSyncConfig} [request.mysqlSyncConfig] + * Optional. MySQL-specific settings for start external sync. + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + * @param {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} [request.syncParallelLevel] + * Optional. Parallel level for initial data sync. Only applicable for + * PostgreSQL. + * @param {number[]} [request.selectedObjects] + * Optional. Migrate only the specified objects from the source instance. If + * this field is empty, then migrate all objects. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse|SqlInstancesVerifyExternalSyncSettingsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_VerifyExternalSyncSettings_async + */ + verifyExternalSyncSettings( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ] + >; + verifyExternalSyncSettings( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + verifyExternalSyncSettings( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + verifyExternalSyncSettings( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('verifyExternalSyncSettings request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('verifyExternalSyncSettings response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .verifyExternalSyncSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('verifyExternalSyncSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Start External primary instance migration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode + * External sync mode. + * @param {boolean} request.skipVerification + * Whether to skip the verification step (VESS). + * @param {google.cloud.sql.v1beta4.MySqlSyncConfig} request.mysqlSyncConfig + * MySQL-specific settings for start external sync. + * @param {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} [request.syncParallelLevel] + * Optional. Parallel level for initial data sync. Currently only applicable + * for MySQL. + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + * @param {boolean} [request.replicaOverwriteEnabled] + * Optional. MySQL only. True if end-user has confirmed that this SES call + * will wipe replica databases overlapping with the proposed selected_objects. + * If this field is not set and there are both overlapping and additional + * databases proposed, an error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.start_external_sync.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StartExternalSync_async + */ + startExternalSync( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ] + >; + startExternalSync( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + startExternalSync( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + startExternalSync( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('startExternalSync request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('startExternalSync response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .startExternalSync(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startExternalSync response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Perform Disk Shrink on primary instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.PerformDiskShrinkContext} request.body + * Perform disk shrink context. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PerformDiskShrink_async + */ + performDiskShrink( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ] + >; + performDiskShrink( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + performDiskShrink( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + performDiskShrink( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('performDiskShrink request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('performDiskShrink response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .performDiskShrink(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('performDiskShrink response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Get Disk Shrink Config for a given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse|SqlInstancesGetDiskShrinkConfigResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_GetDiskShrinkConfig_async + */ + getDiskShrinkConfig( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ] + >; + getDiskShrinkConfig( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getDiskShrinkConfig( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getDiskShrinkConfig( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getDiskShrinkConfig request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getDiskShrinkConfig response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getDiskShrinkConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDiskShrinkConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Reset Replica Size to primary instance disk size. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.reset_replica_size.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ResetReplicaSize_async + */ + resetReplicaSize( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ] + >; + resetReplicaSize( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + resetReplicaSize( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + resetReplicaSize( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('resetReplicaSize request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('resetReplicaSize response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .resetReplicaSize(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resetReplicaSize response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Get Latest Recovery Time for a given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.protobuf.Timestamp} request.sourceInstanceDeletionTime + * The timestamp used to identify the time when the source instance is + * deleted. If this instance is deleted, then you must set the timestamp. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse|SqlInstancesGetLatestRecoveryTimeResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_GetLatestRecoveryTime_async + */ + getLatestRecoveryTime( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ] + >; + getLatestRecoveryTime( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getLatestRecoveryTime( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + getLatestRecoveryTime( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('getLatestRecoveryTime request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('getLatestRecoveryTime response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .getLatestRecoveryTime(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getLatestRecoveryTime response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Execute SQL statements. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Database instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.ExecuteSqlPayload} request.body + * The request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse|SqlInstancesExecuteSqlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.execute_sql.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ExecuteSql_async + */ + executeSql( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | undefined + ), + {} | undefined, + ] + >; + executeSql( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + executeSql( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + executeSql( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('executeSql request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('executeSql response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .executeSql(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('executeSql response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This doesn't include the project ID. It's + * composed of lowercase letters, numbers, and hyphens, and it must start with + * a letter. The total length must be 98 characters or less (Example: + * instance-id). + * @param {string} request.project + * Required. ID of the project that contains the instance (Example: + * project-id). + * @param {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} request.body + * The body for request to acquire an SSRS lease. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse|SqlInstancesAcquireSsrsLeaseResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_async + */ + acquireSsrsLease( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + >; + acquireSsrsLease( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + acquireSsrsLease( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + acquireSsrsLease( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('acquireSsrsLease request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('acquireSsrsLease response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .acquireSsrsLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('acquireSsrsLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Release a lease for the setup of SQL Server Reporting Services (SSRS). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. The Cloud SQL instance ID. This doesn't include the project ID. + * It's composed of lowercase letters, numbers, and hyphens, and it must start + * with a letter. The total length must be 98 characters or less (Example: + * instance-id). + * @param {string} request.project + * Required. The ID of the project that contains the instance (Example: + * project-id). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse|SqlInstancesReleaseSsrsLeaseResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_async + */ + releaseSsrsLease( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + >; + releaseSsrsLease( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + releaseSsrsLease( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + releaseSsrsLease( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('releaseSsrsLease request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('releaseSsrsLease response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .releaseSsrsLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('releaseSsrsLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Execute MVU Pre-checks + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} request.body + * Required. The context for request to perform the pre-check major version + * upgrade operation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async + */ + preCheckMajorVersionUpgrade( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ] + >; + preCheckMajorVersionUpgrade( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + preCheckMajorVersionUpgrade( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + preCheckMajorVersionUpgrade( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('preCheckMajorVersionUpgrade request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('preCheckMajorVersionUpgrade response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .preCheckMajorVersionUpgrade(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('preCheckMajorVersionUpgrade response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Point in time restore for an instance managed by Google Cloud Backup and + * Disaster Recovery. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where you created this instance. + * Format: projects/{project} + * @param {google.cloud.sql.v1beta4.PointInTimeRestoreContext} request.context + * Required. The context for request to perform a PITR on a Google Cloud + * Backup and Disaster Recovery managed instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PointInTimeRestore_async + */ + pointInTimeRestore( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ] + >; + pointInTimeRestore( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + pointInTimeRestore( + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + pointInTimeRestore( + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('pointInTimeRestore request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('pointInTimeRestore response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .pointInTimeRestore(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('pointInTimeRestore response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlInstancesServiceStub && !this._terminated) { + return this.sqlInstancesServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client_config.json new file mode 100644 index 000000000000..6ed07a6bbffd --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client_config.json @@ -0,0 +1,241 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlInstancesService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "AddServerCa": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AddServerCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AddEntraIdCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Clone": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Delete": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DemoteMaster": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Demote": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Export": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Failover": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Reencrypt": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Import": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Insert": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListServerCas": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListServerCertificates": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListEntraIdCertificates": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Patch": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PromoteReplica": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Switchover": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetSslConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Restart": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RestoreBackup": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RotateServerCa": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RotateServerCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RotateEntraIdCertificate": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartReplica": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StopReplica": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TruncateLog": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Update": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateEphemeral": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "RescheduleMaintenance": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "VerifyExternalSyncSettings": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "StartExternalSync": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PerformDiskShrink": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDiskShrinkConfig": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ResetReplicaSize": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetLatestRecoveryTime": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ExecuteSql": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AcquireSsrsLease": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ReleaseSsrsLease": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PreCheckMajorVersionUpgrade": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "PointInTimeRestore": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts new file mode 100644 index 000000000000..ceb1fa381192 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts @@ -0,0 +1,963 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_operations_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_operations_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta4 + */ +export class SqlOperationsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlOperationsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlOperationsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlOperationsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlOperationsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlOperationsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlOperationsServiceStub) { + return this.sqlOperationsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlOperationsService. + this.sqlOperationsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlOperationsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlOperationsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlOperationsServiceStubMethods = ['get', 'list', 'cancel']; + for (const methodName of sqlOperationsServiceStubMethods) { + const callPromise = this.sqlOperationsServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlOperationsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Retrieves an instance operation that has been performed on an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.operation + * Instance operation ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_operations_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + operation: request.operation ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all instance operations that have been performed on the given Cloud + * SQL instance in the reverse chronological order of the start time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {number} request.maxResults + * Maximum number of operations per response. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.OperationsListResponse|OperationsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_operations_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_List_async + */ + list( + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Cancels an instance operation that has been performed on an instance. + * Ordinarily, this method name should be `CancelSqlOperation`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.operation + * Instance operation ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_operations_service.cancel.js + * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_Cancel_async + */ + cancel( + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest | undefined, + {} | undefined, + ] + >; + cancel( + request: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + cancel( + request: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + cancel( + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + operation: request.operation ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('cancel request %j', request); + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('cancel response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .cancel(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('cancel response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlOperationsServiceStub && !this._terminated) { + return this.sqlOperationsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client_config.json new file mode 100644 index 000000000000..3386709574c2 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client_config.json @@ -0,0 +1,41 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlOperationsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Cancel": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts new file mode 100644 index 000000000000..aeb3ba6c3aa3 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts @@ -0,0 +1,1097 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_ssl_certs_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_ssl_certs_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta4 + */ +export class SqlSslCertsServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlSslCertsServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlSslCertsServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlSslCertsServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlSslCertsServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlSslCertsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlSslCertsServiceStub) { + return this.sqlSslCertsServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlSslCertsService. + this.sqlSslCertsServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlSslCertsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlSslCertsService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlSslCertsServiceStubMethods = ['delete', 'get', 'insert', 'list']; + for (const methodName of sqlSslCertsServiceStubMethods) { + const callPromise = this.sqlSslCertsServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlSslCertsServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Deletes the SSL certificate. For First Generation instances, the + * certificate remains valid until the instance is restarted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.sha1Fingerprint + * Sha1 FingerPrint. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_ssl_certs_service.delete.js + * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Delete_async + */ + delete( + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ] + >; + delete( + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + delete( + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + delete( + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + sha1_fingerprint: request.sha1Fingerprint ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('delete request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('delete response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a particular SSL certificate. Does not include the private key + * (required for usage). The private key must be saved from the response to + * initial creation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.sha1Fingerprint + * Sha1 FingerPrint. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCert|SslCert}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_ssl_certs_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + sha1_fingerprint: request.sha1Fingerprint ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates an SSL certificate and returns it along with the private key and + * server certificate authority. The new certificate will not be usable until + * the instance is restarted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.SslCertsInsertRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCertsInsertResponse|SslCertsInsertResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_ssl_certs_service.insert.js + * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Insert_async + */ + insert( + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ] + >; + insert( + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + insert( + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + insert( + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('insert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('insert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists all of the current SSL certificates for the instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCertsListResponse|SslCertsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_ssl_certs_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_List_async + */ + list( + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project: string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlSslCertsServiceStub && !this._terminated) { + return this.sqlSslCertsServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client_config.json new file mode 100644 index 000000000000..1b19ca0da53b --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client_config.json @@ -0,0 +1,46 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlSslCertsService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Delete": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Insert": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts new file mode 100644 index 000000000000..599f74109a04 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts @@ -0,0 +1,647 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_tiers_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_tiers_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Service for providing machine types (tiers) for Cloud SQL. + * @class + * @memberof v1beta4 + */ +export class SqlTiersServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlTiersServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlTiersServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlTiersServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlTiersServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlTiersService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlTiersServiceStub) { + return this.sqlTiersServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlTiersService. + this.sqlTiersServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlTiersService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlTiersService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlTiersServiceStubMethods = ['list']; + for (const methodName of sqlTiersServiceStubMethods) { + const callPromise = this.sqlTiersServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlTiersServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Lists all available machine types (tiers) for Cloud SQL, for example, + * `db-custom-1-3840`. For related information, see [Pricing](/sql/pricing). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.project + * Project ID of the project for which to list tiers. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.TiersListResponse|TiersListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_tiers_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlTiersService_List_async + */ + list( + request?: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.ITiersListResponse, + | protos.google.cloud.sql.v1beta4.ISqlTiersListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ITiersListResponse, + | protos.google.cloud.sql.v1beta4.ISqlTiersListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlTiersServiceStub && !this._terminated) { + return this.sqlTiersServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client_config.json new file mode 100644 index 000000000000..21ed94c448ef --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client_config.json @@ -0,0 +1,31 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlTiersService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client.ts new file mode 100644 index 000000000000..2f95c603fe50 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client.ts @@ -0,0 +1,1200 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; + +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; + +/** + * Client JSON configuration object, loaded from + * `src/v1beta4/sql_users_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './sql_users_service_client_config.json'; +const version = require('../../../package.json').version; + +/** + * @class + * @memberof v1beta4 + */ +export class SqlUsersServiceClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: { [method: string]: gax.CallSettings }; + private _universeDomain: string; + private _servicePath: string; + private _log = logging.log('sql'); + + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: { [name: string]: Function }; + locationsClient: LocationsClient; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlUsersServiceStub?: Promise<{ [name: string]: Function }>; + + /** + * Construct an instance of SqlUsersServiceClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new SqlUsersServiceClient({fallback: true}, gax); + * ``` + */ + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof SqlUsersServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); + } + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; + this._servicePath = 'sqladmin.' + this._universeDomain; + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts, + ); + + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + backupPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/backups/{backup}', + ), + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.sql.v1beta4.SqlUsersService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.sqlUsersServiceStub) { + return this.sqlUsersServiceStub; + } + + // Put together the "service stub" for + // google.cloud.sql.v1beta4.SqlUsersService. + this.sqlUsersServiceStub = this._gaxGrpc.createStub( + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlUsersService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1beta4.SqlUsersService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const sqlUsersServiceStubMethods = [ + 'delete', + 'get', + 'insert', + 'list', + 'update', + ]; + for (const methodName of sqlUsersServiceStubMethods) { + const callPromise = this.sqlUsersServiceStub.then( + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { + throw err; + }, + ); + + const descriptor = undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback, + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.sqlUsersServiceStub; + } + + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); + } + return 'sqladmin.googleapis.com'; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + + get universeDomain() { + return this._universeDomain; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/sqlservice.admin', + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId( + callback?: Callback, + ): Promise | void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- + /** + * Deletes a user from a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.host + * Host of the user in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * Name of the user in the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_users_service.delete.js + * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Delete_async + */ + delete( + request?: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ] + >; + delete( + request: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; + delete( + request?: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('delete request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('delete response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Retrieves a resource containing information about a user. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * User of the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.host + * Host of a user of the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.User|User}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_users_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Get_async + */ + get( + request?: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | undefined, + {} | undefined, + ] + >; + get( + request: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): void; + get( + request?: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IUser, + | protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('get request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IUser, + | protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('get response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Creates a new user in a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.User} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_users_service.insert.js + * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Insert_async + */ + insert( + request?: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | undefined, + {} | undefined, + ] + >; + insert( + request: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; + insert( + request?: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('insert request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('insert response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Lists users in the specified Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.UsersListResponse|UsersListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_users_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlUsersService_List_async + */ + list( + request?: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | undefined, + {} | undefined, + ] + >; + list( + request: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IUsersListResponse, + | protos.google.cloud.sql.v1beta4.ISqlUsersListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('list request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IUsersListResponse, + | protos.google.cloud.sql.v1beta4.ISqlUsersListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('list response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + /** + * Updates an existing user in a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} [request.host] + * Optional. Host of the user in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * Name of the user in the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string[]} [request.databaseRoles] + * Optional. List of database roles to grant to the user. body.database_roles + * will be ignored for update request. + * @param {boolean} [request.revokeExistingRoles] + * Optional. Specifies whether to revoke existing roles that are not present + * in the `database_roles` field. If `false` or unset, the database roles + * specified in `database_roles` are added to the user's existing roles. + * @param {google.cloud.sql.v1beta4.User} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_users_service.update.js + * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Update_async + */ + update( + request?: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ] + >; + update( + request: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; + update( + request: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; + update( + request?: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ] + > | void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; + }); + this._log.info('update request %j', request); + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback + ? (error, response, options, rawResponse) => { + this._log.info('update response %j', response); + callback!(error, response, options, rawResponse); // We verified callback above. + } + : undefined; + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); + } + throw error; + }); + } + + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions, + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified backup resource name string. + * + * @param {string} project + * @param {string} backup + * @returns {string} Resource name string. + */ + backupPath(project: string, backup: string) { + return this.pathTemplates.backupPathTemplate.render({ + project: project, + backup: backup, + }); + } + + /** + * Parse the project from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the project. + */ + matchProjectFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).project; + } + + /** + * Parse the backup from Backup resource. + * + * @param {string} backupName + * A fully-qualified path representing Backup resource. + * @returns {string} A string representing the backup. + */ + matchBackupFromBackupName(backupName: string) { + return this.pathTemplates.backupPathTemplate.match(backupName).backup; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.sqlUsersServiceStub && !this._terminated) { + return this.sqlUsersServiceStub.then((stub) => { + this._log.info('ending gRPC channel'); + this._terminated = true; + stub.close(); + this.locationsClient.close().catch((err) => { + throw err; + }); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client_config.json new file mode 100644 index 000000000000..a98c499e5123 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client_config.json @@ -0,0 +1,51 @@ +{ + "interfaces": { + "google.cloud.sql.v1beta4.SqlUsersService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "Delete": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Get": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Insert": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "List": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "Update": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_proto_list.json new file mode 100644 index 000000000000..3d9dcd428e8f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_proto_list.json @@ -0,0 +1,8 @@ +[ + "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", + "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" +] diff --git a/owl-bot-staging/google-cloud-sql/system-test/install.ts b/owl-bot-staging/google-cloud-sql/system-test/install.ts new file mode 100644 index 000000000000..ccf167042d2e --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/system-test/install.ts @@ -0,0 +1,51 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + it('TypeScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, + }; + await packNTest(options); + }); + + it('JavaScript code', async function () { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, + }; + await packNTest(options); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_available_database_versions_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_available_database_versions_service_v1.ts new file mode 100644 index 000000000000..f1fdacd93cc1 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_available_database_versions_service_v1.ts @@ -0,0 +1,571 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlavailabledatabaseversionsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlAvailableDatabaseVersionsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlavailabledatabaseversionsserviceModule.v1 + .SqlAvailableDatabaseVersionsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlavailabledatabaseversionsserviceModule.v1 + .SqlAvailableDatabaseVersionsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { universe_domain: 'example.com', universeDomain: 'example.net' }, + ); + }); + }); + + it('has port', () => { + const port = + sqlavailabledatabaseversionsserviceModule.v1 + .SqlAvailableDatabaseVersionsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual( + client.sqlAvailableDatabaseVersionsServiceStub, + undefined, + ); + await client.initialize(); + assert(client.sqlAvailableDatabaseVersionsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlAvailableDatabaseVersionsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual( + client.sqlAvailableDatabaseVersionsServiceStub, + undefined, + ); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts new file mode 100644 index 000000000000..39a4cbb474bb --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts @@ -0,0 +1,1192 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlbackuprunsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlBackupRunsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); + await client.initialize(); + assert(client.sqlBackupRunsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlBackupRunsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.BackupRun(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.BackupRun(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IBackupRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.BackupRunsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.BackupRunsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IBackupRunsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts new file mode 100644 index 000000000000..31018716d40f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts @@ -0,0 +1,1233 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlbackuprunsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlBackupRunsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); + await client.initialize(); + assert(client.sqlBackupRunsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlBackupRunsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.BackupRun(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.BackupRun(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IBackupRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.BackupRunsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.BackupRunsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IBackupRunsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1.ts new file mode 100644 index 000000000000..e0e3601d826c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1.ts @@ -0,0 +1,1435 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlbackupsserviceModule from '../src'; + +import { PassThrough } from 'stream'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlBackupsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlbackupsserviceModule.v1.SqlBackupsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlbackupsserviceModule.v1.SqlBackupsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlbackupsserviceModule.v1.SqlBackupsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupsServiceStub, undefined); + await client.initialize(); + assert(client.sqlBackupsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlBackupsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.createBackup = stubSimpleCall(expectedResponse); + const [response] = await client.createBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.createBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with closed client', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createBackup(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Backup(), + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Backup(), + ); + client.innerApiCalls.getBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IBackup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with closed client', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('updateBackup', () => { + it('invokes updateBackup without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); + const [response] = await client.updateBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackup without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.updateBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackup with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackup with closed client', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateBackup(request), expectedError); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.deleteBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with closed client', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteBackup(request), expectedError); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + ]; + client.innerApiCalls.listBackups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IBackup[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + ]; + client.descriptors.page.listBackups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.sql.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.sql.v1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBackups, request), + ); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.sql.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.sql.v1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBackups, request), + ); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.sql.v1.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.sql.v1.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts new file mode 100644 index 000000000000..b2fece3336d8 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts @@ -0,0 +1,1483 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlbackupsserviceModule from '../src'; + +import { PassThrough } from 'stream'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); + } + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlBackupsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupsServiceStub, undefined); + await client.initialize(); + assert(client.sqlBackupsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlBackupsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.createBackup = stubSimpleCall(expectedResponse); + const [response] = await client.createBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.createBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createBackup with closed client', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createBackup(request), expectedError); + }); + }); + + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Backup(), + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Backup(), + ); + client.innerApiCalls.getBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IBackup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getBackup with closed client', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getBackup(request), expectedError); + }); + }); + + describe('updateBackup', () => { + it('invokes updateBackup without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); + const [response] = await client.updateBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackup without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.updateBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackup with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateBackup with closed client', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateBackup(request), expectedError); + }); + }); + + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.deleteBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteBackup with closed client', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteBackup(request), expectedError); + }); + }); + + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + ]; + client.innerApiCalls.listBackups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IBackup[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackups with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listBackupsStream without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + ]; + client.descriptors.page.listBackups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.sql.v1beta4.Backup[] = []; + stream.on( + 'data', + (response: protos.google.cloud.sql.v1beta4.Backup) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBackups, request), + ); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('invokes listBackupsStream with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.sql.v1beta4.Backup[] = []; + stream.on( + 'data', + (response: protos.google.cloud.sql.v1beta4.Backup) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBackups, request), + ); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listBackups without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.sql.v1beta4.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + + it('uses async iteration with listBackups with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.sql.v1beta4.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1.ts new file mode 100644 index 000000000000..b60949338fd6 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1.ts @@ -0,0 +1,841 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlconnectserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlConnectServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlconnectserviceModule.v1.SqlConnectServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlconnectserviceModule.v1.SqlConnectServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlconnectserviceModule.v1.SqlConnectServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlconnectserviceModule.v1.SqlConnectServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlConnectServiceStub, undefined); + await client.initialize(); + assert(client.sqlConnectServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlConnectServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlConnectServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getConnectSettings', () => { + it('invokes getConnectSettings without error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.ConnectSettings(), + ); + client.innerApiCalls.getConnectSettings = + stubSimpleCall(expectedResponse); + const [response] = await client.getConnectSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectSettings without error using callback', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.ConnectSettings(), + ); + client.innerApiCalls.getConnectSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnectSettings( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IConnectSettings | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectSettings with error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnectSettings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getConnectSettings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectSettings with closed client', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getConnectSettings(request), expectedError); + }); + }); + + describe('generateEphemeralCert', () => { + it('invokes generateEphemeralCert without error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertResponse(), + ); + client.innerApiCalls.generateEphemeralCert = + stubSimpleCall(expectedResponse); + const [response] = await client.generateEphemeralCert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateEphemeralCert without error using callback', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertResponse(), + ); + client.innerApiCalls.generateEphemeralCert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateEphemeralCert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateEphemeralCert with error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateEphemeralCert = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.generateEphemeralCert(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateEphemeralCert with closed client', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.generateEphemeralCert(request), + expectedError, + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts new file mode 100644 index 000000000000..7a26e7c169f0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts @@ -0,0 +1,867 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlconnectserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlConnectServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlConnectServiceStub, undefined); + await client.initialize(); + assert(client.sqlConnectServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlConnectServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlConnectServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getConnectSettings', () => { + it('invokes getConnectSettings without error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ConnectSettings(), + ); + client.innerApiCalls.getConnectSettings = + stubSimpleCall(expectedResponse); + const [response] = await client.getConnectSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectSettings without error using callback', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ConnectSettings(), + ); + client.innerApiCalls.getConnectSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnectSettings( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IConnectSettings | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectSettings with error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnectSettings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getConnectSettings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectSettings with closed client', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getConnectSettings(request), expectedError); + }); + }); + + describe('generateEphemeralCert', () => { + it('invokes generateEphemeralCert without error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse(), + ); + client.innerApiCalls.generateEphemeralCert = + stubSimpleCall(expectedResponse); + const [response] = await client.generateEphemeralCert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateEphemeralCert without error using callback', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse(), + ); + client.innerApiCalls.generateEphemeralCert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateEphemeralCert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateEphemeralCert with error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateEphemeralCert = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.generateEphemeralCert(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes generateEphemeralCert with closed client', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.generateEphemeralCert(request), + expectedError, + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1.ts new file mode 100644 index 000000000000..15097fddb205 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1.ts @@ -0,0 +1,1567 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqldatabasesserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlDatabasesServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlDatabasesServiceStub, undefined); + await client.initialize(); + assert(client.sqlDatabasesServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlDatabasesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlDatabasesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Database(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Database(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IDatabase | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.DatabasesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.DatabasesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IDatabasesListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('patch', () => { + it('invokes patch without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCall(expectedResponse); + const [response] = await client.patch(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.patch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.patch(request), expectedError); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.patch(request), expectedError); + }); + }); + + describe('update', () => { + it('invokes update without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts new file mode 100644 index 000000000000..3f9edfa33005 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts @@ -0,0 +1,1575 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqldatabasesserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlDatabasesServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlDatabasesServiceStub, undefined); + await client.initialize(); + assert(client.sqlDatabasesServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlDatabasesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlDatabasesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Database(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Database(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IDatabase | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DatabasesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DatabasesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IDatabasesListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('patch', () => { + it('invokes patch without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCall(expectedResponse); + const [response] = await client.patch(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.patch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.patch(request), expectedError); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.patch(request), expectedError); + }); + }); + + describe('update', () => { + it('invokes update without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_events_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_events_service_v1.ts new file mode 100644 index 000000000000..798fbaf8fbf6 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_events_service_v1.ts @@ -0,0 +1,519 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqleventsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlEventsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqleventsserviceModule.v1.SqlEventsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqleventsserviceModule.v1.SqlEventsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqleventsserviceModule.v1.SqlEventsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqleventsserviceModule.v1.SqlEventsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlEventsServiceStub, undefined); + await client.initialize(); + assert(client.sqlEventsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlEventsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlEventsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts new file mode 100644 index 000000000000..b8f469f7bc39 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts @@ -0,0 +1,565 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlfeatureeligibilityserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlFeatureEligibilityServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlfeatureeligibilityserviceModule.v1 + .SqlFeatureEligibilityServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlfeatureeligibilityserviceModule.v1 + .SqlFeatureEligibilityServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { universe_domain: 'example.com', universeDomain: 'example.net' }, + ); + }); + }); + + it('has port', () => { + const port = + sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient + .port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlFeatureEligibilityServiceStub, undefined); + await client.initialize(); + assert(client.sqlFeatureEligibilityServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlFeatureEligibilityServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlFeatureEligibilityServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1.ts new file mode 100644 index 000000000000..09b5fbd0667f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1.ts @@ -0,0 +1,609 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlflagsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlFlagsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlflagsserviceModule.v1.SqlFlagsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlflagsserviceModule.v1.SqlFlagsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlflagsserviceModule.v1.SqlFlagsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlFlagsServiceStub, undefined); + await client.initialize(); + assert(client.sqlFlagsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlFlagsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlFlagsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlFlagsListRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.FlagsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes list without error using callback', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlFlagsListRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.FlagsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IFlagsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes list with error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlFlagsListRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + }); + + it('invokes list with closed client', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlFlagsListRequest(), + ); + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts new file mode 100644 index 000000000000..4e37b9e1b3e7 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts @@ -0,0 +1,649 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlflagsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlFlagsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlFlagsServiceStub, undefined); + await client.initialize(); + assert(client.sqlFlagsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlFlagsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlFlagsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.FlagsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes list without error using callback', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.FlagsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IFlagsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); + + it('invokes list with error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + }); + + it('invokes list with closed client', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), + ); + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1.ts new file mode 100644 index 000000000000..23b93b55596e --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1.ts @@ -0,0 +1,541 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqliampoliciesserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlIamPoliciesServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlIamPoliciesServiceStub, undefined); + await client.initialize(); + assert(client.sqlIamPoliciesServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlIamPoliciesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlIamPoliciesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1beta4.ts new file mode 100644 index 000000000000..ad15ef3ebba1 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1beta4.ts @@ -0,0 +1,541 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqliampoliciesserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlIamPoliciesServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlIamPoliciesServiceStub, undefined); + await client.initialize(); + assert(client.sqlIamPoliciesServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlIamPoliciesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlIamPoliciesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_instance_names_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_instance_names_service_v1.ts new file mode 100644 index 000000000000..d801fe23600c --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_instance_names_service_v1.ts @@ -0,0 +1,541 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlinstancenamesserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlInstanceNamesServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlInstanceNamesServiceStub, undefined); + await client.initialize(); + assert(client.sqlInstanceNamesServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlInstanceNamesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlInstanceNamesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1.ts new file mode 100644 index 000000000000..03dbe2acbf28 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1.ts @@ -0,0 +1,7478 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlinstancesserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlInstancesServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlinstancesserviceModule.v1.SqlInstancesServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlinstancesserviceModule.v1.SqlInstancesServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlinstancesserviceModule.v1.SqlInstancesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlInstancesServiceStub, undefined); + await client.initialize(); + assert(client.sqlInstancesServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlInstancesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlInstancesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('addServerCa', () => { + it('invokes addServerCa without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addServerCa = stubSimpleCall(expectedResponse); + const [response] = await client.addServerCa(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCa without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addServerCa = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addServerCa( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCa with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addServerCa = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.addServerCa(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCa with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.addServerCa(request), expectedError); + }); + }); + + describe('addServerCertificate', () => { + it('invokes addServerCertificate without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addServerCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.addServerCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCertificate without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addServerCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addServerCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCertificate with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addServerCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.addServerCertificate(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCertificate with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.addServerCertificate(request), expectedError); + }); + }); + + describe('addEntraIdCertificate', () => { + it('invokes addEntraIdCertificate without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addEntraIdCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.addEntraIdCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addEntraIdCertificate without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addEntraIdCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addEntraIdCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addEntraIdCertificate with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addEntraIdCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.addEntraIdCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addEntraIdCertificate with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.addEntraIdCertificate(request), + expectedError, + ); + }); + }); + + describe('clone', () => { + it('invokes clone without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.clone = stubSimpleCall(expectedResponse); + const [response] = await client.clone(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clone without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.clone = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.clone( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clone with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clone = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.clone(request), expectedError); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clone with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.clone(request), expectedError); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('demoteMaster', () => { + it('invokes demoteMaster without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.demoteMaster = stubSimpleCall(expectedResponse); + const [response] = await client.demoteMaster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demoteMaster without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.demoteMaster = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.demoteMaster( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demoteMaster with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.demoteMaster = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.demoteMaster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demoteMaster with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.demoteMaster(request), expectedError); + }); + }); + + describe('demote', () => { + it('invokes demote without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.demote = stubSimpleCall(expectedResponse); + const [response] = await client.demote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demote without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.demote = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.demote( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demote with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.demote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.demote(request), expectedError); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demote with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.demote(request), expectedError); + }); + }); + + describe('export', () => { + it('invokes export without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.export = stubSimpleCall(expectedResponse); + const [response] = await client.export(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes export without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.export = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.export( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes export with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.export = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.export(request), expectedError); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes export with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.export(request), expectedError); + }); + }); + + describe('failover', () => { + it('invokes failover without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.failover = stubSimpleCall(expectedResponse); + const [response] = await client.failover(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes failover without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.failover = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.failover( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes failover with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.failover = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.failover(request), expectedError); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes failover with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.failover(request), expectedError); + }); + }); + + describe('reencrypt', () => { + it('invokes reencrypt without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.reencrypt = stubSimpleCall(expectedResponse); + const [response] = await client.reencrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reencrypt without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.reencrypt = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reencrypt( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reencrypt with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reencrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.reencrypt(request), expectedError); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reencrypt with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.reencrypt(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.DatabaseInstance(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.DatabaseInstance(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IDatabaseInstance | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('import', () => { + it('invokes import without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.import = stubSimpleCall(expectedResponse); + const [response] = await client.import(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes import without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.import = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.import( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes import with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.import = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.import(request), expectedError); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes import with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.import(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IInstancesListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('listServerCas', () => { + it('invokes listServerCas without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListServerCasResponse(), + ); + client.innerApiCalls.listServerCas = stubSimpleCall(expectedResponse); + const [response] = await client.listServerCas(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCas without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListServerCasResponse(), + ); + client.innerApiCalls.listServerCas = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerCas( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IInstancesListServerCasResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCas with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerCas = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listServerCas(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCas with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listServerCas(request), expectedError); + }); + }); + + describe('listServerCertificates', () => { + it('invokes listServerCertificates without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse(), + ); + client.innerApiCalls.listServerCertificates = + stubSimpleCall(expectedResponse); + const [response] = await client.listServerCertificates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCertificates without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse(), + ); + client.innerApiCalls.listServerCertificates = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerCertificates( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCertificates with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerCertificates = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listServerCertificates(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCertificates with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.listServerCertificates(request), + expectedError, + ); + }); + }); + + describe('listEntraIdCertificates', () => { + it('invokes listEntraIdCertificates without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse(), + ); + client.innerApiCalls.listEntraIdCertificates = + stubSimpleCall(expectedResponse); + const [response] = await client.listEntraIdCertificates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntraIdCertificates without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse(), + ); + client.innerApiCalls.listEntraIdCertificates = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEntraIdCertificates( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntraIdCertificates with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntraIdCertificates = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listEntraIdCertificates(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntraIdCertificates with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.listEntraIdCertificates(request), + expectedError, + ); + }); + }); + + describe('patch', () => { + it('invokes patch without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCall(expectedResponse); + const [response] = await client.patch(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.patch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.patch(request), expectedError); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.patch(request), expectedError); + }); + }); + + describe('promoteReplica', () => { + it('invokes promoteReplica without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.promoteReplica = stubSimpleCall(expectedResponse); + const [response] = await client.promoteReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes promoteReplica without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.promoteReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.promoteReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes promoteReplica with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.promoteReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.promoteReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes promoteReplica with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.promoteReplica(request), expectedError); + }); + }); + + describe('switchover', () => { + it('invokes switchover without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.switchover = stubSimpleCall(expectedResponse); + const [response] = await client.switchover(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes switchover without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.switchover = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.switchover( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes switchover with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.switchover = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.switchover(request), expectedError); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes switchover with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.switchover(request), expectedError); + }); + }); + + describe('resetSslConfig', () => { + it('invokes resetSslConfig without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.resetSslConfig = stubSimpleCall(expectedResponse); + const [response] = await client.resetSslConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetSslConfig without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.resetSslConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetSslConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetSslConfig with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetSslConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.resetSslConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetSslConfig with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.resetSslConfig(request), expectedError); + }); + }); + + describe('restart', () => { + it('invokes restart without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.restart = stubSimpleCall(expectedResponse); + const [response] = await client.restart(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restart without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.restart = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restart( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restart with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restart = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.restart(request), expectedError); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restart with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.restart(request), expectedError); + }); + }); + + describe('restoreBackup', () => { + it('invokes restoreBackup without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.restoreBackup = stubSimpleCall(expectedResponse); + const [response] = await client.restoreBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreBackup without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.restoreBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreBackup with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.restoreBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreBackup with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.restoreBackup(request), expectedError); + }); + }); + + describe('rotateServerCa', () => { + it('invokes rotateServerCa without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateServerCa = stubSimpleCall(expectedResponse); + const [response] = await client.rotateServerCa(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCa without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateServerCa = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateServerCa( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCa with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateServerCa = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.rotateServerCa(request), expectedError); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCa with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.rotateServerCa(request), expectedError); + }); + }); + + describe('rotateServerCertificate', () => { + it('invokes rotateServerCertificate without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateServerCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.rotateServerCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCertificate without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateServerCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateServerCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCertificate with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateServerCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rotateServerCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCertificate with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rotateServerCertificate(request), + expectedError, + ); + }); + }); + + describe('rotateEntraIdCertificate', () => { + it('invokes rotateEntraIdCertificate without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateEntraIdCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.rotateEntraIdCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateEntraIdCertificate without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateEntraIdCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateEntraIdCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateEntraIdCertificate with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rotateEntraIdCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateEntraIdCertificate with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rotateEntraIdCertificate(request), + expectedError, + ); + }); + }); + + describe('startReplica', () => { + it('invokes startReplica without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.startReplica = stubSimpleCall(expectedResponse); + const [response] = await client.startReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startReplica without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.startReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startReplica with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startReplica with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startReplica(request), expectedError); + }); + }); + + describe('stopReplica', () => { + it('invokes stopReplica without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.stopReplica = stubSimpleCall(expectedResponse); + const [response] = await client.stopReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopReplica without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.stopReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopReplica with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.stopReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopReplica with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.stopReplica(request), expectedError); + }); + }); + + describe('truncateLog', () => { + it('invokes truncateLog without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.truncateLog = stubSimpleCall(expectedResponse); + const [response] = await client.truncateLog(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes truncateLog without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.truncateLog = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.truncateLog( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes truncateLog with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.truncateLog = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.truncateLog(request), expectedError); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes truncateLog with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.truncateLog(request), expectedError); + }); + }); + + describe('update', () => { + it('invokes update without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); + }); + }); + + describe('createEphemeral', () => { + it('invokes createEphemeral without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCert(), + ); + client.innerApiCalls.createEphemeral = stubSimpleCall(expectedResponse); + const [response] = await client.createEphemeral(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEphemeral without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCert(), + ); + client.innerApiCalls.createEphemeral = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEphemeral( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISslCert | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEphemeral with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEphemeral = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createEphemeral(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEphemeral with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createEphemeral(request), expectedError); + }); + }); + + describe('rescheduleMaintenance', () => { + it('invokes rescheduleMaintenance without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rescheduleMaintenance = + stubSimpleCall(expectedResponse); + const [response] = await client.rescheduleMaintenance(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rescheduleMaintenance = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rescheduleMaintenance( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rescheduleMaintenance = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rescheduleMaintenance(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rescheduleMaintenance(request), + expectedError, + ); + }); + }); + + describe('verifyExternalSyncSettings', () => { + it('invokes verifyExternalSyncSettings without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse(), + ); + client.innerApiCalls.verifyExternalSyncSettings = + stubSimpleCall(expectedResponse); + const [response] = await client.verifyExternalSyncSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyExternalSyncSettings without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse(), + ); + client.innerApiCalls.verifyExternalSyncSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.verifyExternalSyncSettings( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyExternalSyncSettings with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.verifyExternalSyncSettings(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyExternalSyncSettings with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.verifyExternalSyncSettings(request), + expectedError, + ); + }); + }); + + describe('startExternalSync', () => { + it('invokes startExternalSync without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.startExternalSync = stubSimpleCall(expectedResponse); + const [response] = await client.startExternalSync(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startExternalSync without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.startExternalSync = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startExternalSync( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startExternalSync with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startExternalSync = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startExternalSync(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startExternalSync with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startExternalSync(request), expectedError); + }); + }); + + describe('performDiskShrink', () => { + it('invokes performDiskShrink without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.performDiskShrink = stubSimpleCall(expectedResponse); + const [response] = await client.performDiskShrink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performDiskShrink without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.performDiskShrink = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.performDiskShrink( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performDiskShrink with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.performDiskShrink = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.performDiskShrink(request), expectedError); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performDiskShrink with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.performDiskShrink(request), expectedError); + }); + }); + + describe('getDiskShrinkConfig', () => { + it('invokes getDiskShrinkConfig without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse(), + ); + client.innerApiCalls.getDiskShrinkConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getDiskShrinkConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDiskShrinkConfig without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse(), + ); + client.innerApiCalls.getDiskShrinkConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDiskShrinkConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDiskShrinkConfig with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDiskShrinkConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDiskShrinkConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDiskShrinkConfig with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDiskShrinkConfig(request), expectedError); + }); + }); + + describe('resetReplicaSize', () => { + it('invokes resetReplicaSize without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.resetReplicaSize = stubSimpleCall(expectedResponse); + const [response] = await client.resetReplicaSize(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetReplicaSize without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.resetReplicaSize = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetReplicaSize( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetReplicaSize with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetReplicaSize = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.resetReplicaSize(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetReplicaSize with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.resetReplicaSize(request), expectedError); + }); + }); + + describe('getLatestRecoveryTime', () => { + it('invokes getLatestRecoveryTime without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse(), + ); + client.innerApiCalls.getLatestRecoveryTime = + stubSimpleCall(expectedResponse); + const [response] = await client.getLatestRecoveryTime(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLatestRecoveryTime without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse(), + ); + client.innerApiCalls.getLatestRecoveryTime = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLatestRecoveryTime( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLatestRecoveryTime with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLatestRecoveryTime = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLatestRecoveryTime(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLatestRecoveryTime with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getLatestRecoveryTime(request), + expectedError, + ); + }); + }); + + describe('executeSql', () => { + it('invokes executeSql without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse(), + ); + client.innerApiCalls.executeSql = stubSimpleCall(expectedResponse); + const [response] = await client.executeSql(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executeSql without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse(), + ); + client.innerApiCalls.executeSql = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.executeSql( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executeSql with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.executeSql = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.executeSql(request), expectedError); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executeSql with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.executeSql(request), expectedError); + }); + }); + + describe('acquireSsrsLease', () => { + it('invokes acquireSsrsLease without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse(), + ); + client.innerApiCalls.acquireSsrsLease = stubSimpleCall(expectedResponse); + const [response] = await client.acquireSsrsLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes acquireSsrsLease without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse(), + ); + client.innerApiCalls.acquireSsrsLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.acquireSsrsLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes acquireSsrsLease with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.acquireSsrsLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.acquireSsrsLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes acquireSsrsLease with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.acquireSsrsLease(request), expectedError); + }); + }); + + describe('releaseSsrsLease', () => { + it('invokes releaseSsrsLease without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse(), + ); + client.innerApiCalls.releaseSsrsLease = stubSimpleCall(expectedResponse); + const [response] = await client.releaseSsrsLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes releaseSsrsLease without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse(), + ); + client.innerApiCalls.releaseSsrsLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.releaseSsrsLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes releaseSsrsLease with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.releaseSsrsLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.releaseSsrsLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes releaseSsrsLease with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.releaseSsrsLease(request), expectedError); + }); + }); + + describe('preCheckMajorVersionUpgrade', () => { + it('invokes preCheckMajorVersionUpgrade without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.preCheckMajorVersionUpgrade = + stubSimpleCall(expectedResponse); + const [response] = await client.preCheckMajorVersionUpgrade(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes preCheckMajorVersionUpgrade without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.preCheckMajorVersionUpgrade = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.preCheckMajorVersionUpgrade( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes preCheckMajorVersionUpgrade with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.preCheckMajorVersionUpgrade(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes preCheckMajorVersionUpgrade with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.preCheckMajorVersionUpgrade(request), + expectedError, + ); + }); + }); + + describe('pointInTimeRestore', () => { + it('invokes pointInTimeRestore without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.pointInTimeRestore = + stubSimpleCall(expectedResponse); + const [response] = await client.pointInTimeRestore(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pointInTimeRestore without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.pointInTimeRestore = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pointInTimeRestore( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pointInTimeRestore with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.pointInTimeRestore = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.pointInTimeRestore(request), expectedError); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pointInTimeRestore with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.pointInTimeRestore(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backupvault: 'backupvaultValue', + datasource: 'datasourceValue', + backup: 'backupValue', + }; + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath( + 'projectValue', + 'locationValue', + 'backupvaultValue', + 'datasourceValue', + 'backupValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupvaultFromBackupName', () => { + const result = client.matchBackupvaultFromBackupName(fakePath); + assert.strictEqual(result, 'backupvaultValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDatasourceFromBackupName', () => { + const result = client.matchDatasourceFromBackupName(fakePath); + assert.strictEqual(result, 'datasourceValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('network', async () => { + const fakePath = '/rendered/path/network'; + const expectedParameters = { + project: 'projectValue', + network: 'networkValue', + }; + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.networkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath('projectValue', 'networkValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, 'networkValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts new file mode 100644 index 000000000000..57ac7bbd95ca --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts @@ -0,0 +1,7248 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlinstancesserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlInstancesServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlInstancesServiceStub, undefined); + await client.initialize(); + assert(client.sqlInstancesServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlInstancesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlInstancesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('addServerCa', () => { + it('invokes addServerCa without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addServerCa = stubSimpleCall(expectedResponse); + const [response] = await client.addServerCa(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCa without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addServerCa = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addServerCa( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCa with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addServerCa = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.addServerCa(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCa with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.addServerCa(request), expectedError); + }); + }); + + describe('addServerCertificate', () => { + it('invokes addServerCertificate without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addServerCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.addServerCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCertificate without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addServerCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addServerCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCertificate with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addServerCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.addServerCertificate(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCertificate with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.addServerCertificate(request), expectedError); + }); + }); + + describe('addEntraIdCertificate', () => { + it('invokes addEntraIdCertificate without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addEntraIdCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.addEntraIdCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addEntraIdCertificate without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addEntraIdCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addEntraIdCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addEntraIdCertificate with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addEntraIdCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.addEntraIdCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addEntraIdCertificate with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.addEntraIdCertificate(request), + expectedError, + ); + }); + }); + + describe('clone', () => { + it('invokes clone without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.clone = stubSimpleCall(expectedResponse); + const [response] = await client.clone(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clone without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.clone = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.clone( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clone with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clone = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.clone(request), expectedError); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clone with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.clone(request), expectedError); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('demoteMaster', () => { + it('invokes demoteMaster without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.demoteMaster = stubSimpleCall(expectedResponse); + const [response] = await client.demoteMaster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demoteMaster without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.demoteMaster = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.demoteMaster( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demoteMaster with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.demoteMaster = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.demoteMaster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demoteMaster with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.demoteMaster(request), expectedError); + }); + }); + + describe('demote', () => { + it('invokes demote without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.demote = stubSimpleCall(expectedResponse); + const [response] = await client.demote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demote without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.demote = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.demote( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demote with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.demote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.demote(request), expectedError); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demote with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.demote(request), expectedError); + }); + }); + + describe('export', () => { + it('invokes export without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.export = stubSimpleCall(expectedResponse); + const [response] = await client.export(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes export without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.export = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.export( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes export with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.export = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.export(request), expectedError); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes export with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.export(request), expectedError); + }); + }); + + describe('failover', () => { + it('invokes failover without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.failover = stubSimpleCall(expectedResponse); + const [response] = await client.failover(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes failover without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.failover = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.failover( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes failover with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.failover = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.failover(request), expectedError); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes failover with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.failover(request), expectedError); + }); + }); + + describe('reencrypt', () => { + it('invokes reencrypt without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.reencrypt = stubSimpleCall(expectedResponse); + const [response] = await client.reencrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reencrypt without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.reencrypt = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reencrypt( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reencrypt with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reencrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.reencrypt(request), expectedError); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reencrypt with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.reencrypt(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DatabaseInstance(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DatabaseInstance(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IDatabaseInstance | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('import', () => { + it('invokes import without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.import = stubSimpleCall(expectedResponse); + const [response] = await client.import(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes import without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.import = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.import( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes import with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.import = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.import(request), expectedError); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes import with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.import(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IInstancesListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('listServerCas', () => { + it('invokes listServerCas without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse(), + ); + client.innerApiCalls.listServerCas = stubSimpleCall(expectedResponse); + const [response] = await client.listServerCas(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCas without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse(), + ); + client.innerApiCalls.listServerCas = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerCas( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCas with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerCas = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listServerCas(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCas with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listServerCas(request), expectedError); + }); + }); + + describe('listServerCertificates', () => { + it('invokes listServerCertificates without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse(), + ); + client.innerApiCalls.listServerCertificates = + stubSimpleCall(expectedResponse); + const [response] = await client.listServerCertificates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCertificates without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse(), + ); + client.innerApiCalls.listServerCertificates = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerCertificates( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCertificates with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerCertificates = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listServerCertificates(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCertificates with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.listServerCertificates(request), + expectedError, + ); + }); + }); + + describe('listEntraIdCertificates', () => { + it('invokes listEntraIdCertificates without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse(), + ); + client.innerApiCalls.listEntraIdCertificates = + stubSimpleCall(expectedResponse); + const [response] = await client.listEntraIdCertificates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntraIdCertificates without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse(), + ); + client.innerApiCalls.listEntraIdCertificates = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEntraIdCertificates( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntraIdCertificates with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntraIdCertificates = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listEntraIdCertificates(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntraIdCertificates with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.listEntraIdCertificates(request), + expectedError, + ); + }); + }); + + describe('patch', () => { + it('invokes patch without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCall(expectedResponse); + const [response] = await client.patch(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.patch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.patch(request), expectedError); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.patch(request), expectedError); + }); + }); + + describe('promoteReplica', () => { + it('invokes promoteReplica without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.promoteReplica = stubSimpleCall(expectedResponse); + const [response] = await client.promoteReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes promoteReplica without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.promoteReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.promoteReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes promoteReplica with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.promoteReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.promoteReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes promoteReplica with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.promoteReplica(request), expectedError); + }); + }); + + describe('switchover', () => { + it('invokes switchover without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.switchover = stubSimpleCall(expectedResponse); + const [response] = await client.switchover(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes switchover without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.switchover = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.switchover( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes switchover with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.switchover = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.switchover(request), expectedError); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes switchover with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.switchover(request), expectedError); + }); + }); + + describe('resetSslConfig', () => { + it('invokes resetSslConfig without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.resetSslConfig = stubSimpleCall(expectedResponse); + const [response] = await client.resetSslConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetSslConfig without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.resetSslConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetSslConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetSslConfig with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetSslConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.resetSslConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetSslConfig with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.resetSslConfig(request), expectedError); + }); + }); + + describe('restart', () => { + it('invokes restart without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.restart = stubSimpleCall(expectedResponse); + const [response] = await client.restart(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restart without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.restart = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restart( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restart with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restart = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.restart(request), expectedError); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restart with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.restart(request), expectedError); + }); + }); + + describe('restoreBackup', () => { + it('invokes restoreBackup without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.restoreBackup = stubSimpleCall(expectedResponse); + const [response] = await client.restoreBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreBackup without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.restoreBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreBackup with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.restoreBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreBackup with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.restoreBackup(request), expectedError); + }); + }); + + describe('rotateServerCa', () => { + it('invokes rotateServerCa without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateServerCa = stubSimpleCall(expectedResponse); + const [response] = await client.rotateServerCa(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCa without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateServerCa = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateServerCa( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCa with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateServerCa = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.rotateServerCa(request), expectedError); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCa with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.rotateServerCa(request), expectedError); + }); + }); + + describe('rotateServerCertificate', () => { + it('invokes rotateServerCertificate without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateServerCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.rotateServerCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCertificate without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateServerCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateServerCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCertificate with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateServerCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rotateServerCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCertificate with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rotateServerCertificate(request), + expectedError, + ); + }); + }); + + describe('rotateEntraIdCertificate', () => { + it('invokes rotateEntraIdCertificate without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateEntraIdCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.rotateEntraIdCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateEntraIdCertificate without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateEntraIdCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateEntraIdCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateEntraIdCertificate with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rotateEntraIdCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateEntraIdCertificate with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rotateEntraIdCertificate(request), + expectedError, + ); + }); + }); + + describe('startReplica', () => { + it('invokes startReplica without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.startReplica = stubSimpleCall(expectedResponse); + const [response] = await client.startReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startReplica without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.startReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startReplica with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startReplica with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startReplica(request), expectedError); + }); + }); + + describe('stopReplica', () => { + it('invokes stopReplica without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.stopReplica = stubSimpleCall(expectedResponse); + const [response] = await client.stopReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopReplica without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.stopReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopReplica with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.stopReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopReplica with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.stopReplica(request), expectedError); + }); + }); + + describe('truncateLog', () => { + it('invokes truncateLog without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.truncateLog = stubSimpleCall(expectedResponse); + const [response] = await client.truncateLog(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes truncateLog without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.truncateLog = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.truncateLog( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes truncateLog with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.truncateLog = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.truncateLog(request), expectedError); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes truncateLog with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.truncateLog(request), expectedError); + }); + }); + + describe('update', () => { + it('invokes update without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); + }); + }); + + describe('createEphemeral', () => { + it('invokes createEphemeral without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCert(), + ); + client.innerApiCalls.createEphemeral = stubSimpleCall(expectedResponse); + const [response] = await client.createEphemeral(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEphemeral without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCert(), + ); + client.innerApiCalls.createEphemeral = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEphemeral( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISslCert | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEphemeral with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEphemeral = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createEphemeral(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEphemeral with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createEphemeral(request), expectedError); + }); + }); + + describe('rescheduleMaintenance', () => { + it('invokes rescheduleMaintenance without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rescheduleMaintenance = + stubSimpleCall(expectedResponse); + const [response] = await client.rescheduleMaintenance(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rescheduleMaintenance = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rescheduleMaintenance( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rescheduleMaintenance = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rescheduleMaintenance(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rescheduleMaintenance(request), + expectedError, + ); + }); + }); + + describe('verifyExternalSyncSettings', () => { + it('invokes verifyExternalSyncSettings without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse(), + ); + client.innerApiCalls.verifyExternalSyncSettings = + stubSimpleCall(expectedResponse); + const [response] = await client.verifyExternalSyncSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyExternalSyncSettings without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse(), + ); + client.innerApiCalls.verifyExternalSyncSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.verifyExternalSyncSettings( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyExternalSyncSettings with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.verifyExternalSyncSettings(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyExternalSyncSettings with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.verifyExternalSyncSettings(request), + expectedError, + ); + }); + }); + + describe('startExternalSync', () => { + it('invokes startExternalSync without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.startExternalSync = stubSimpleCall(expectedResponse); + const [response] = await client.startExternalSync(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startExternalSync without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.startExternalSync = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startExternalSync( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startExternalSync with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startExternalSync = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startExternalSync(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startExternalSync with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startExternalSync(request), expectedError); + }); + }); + + describe('performDiskShrink', () => { + it('invokes performDiskShrink without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.performDiskShrink = stubSimpleCall(expectedResponse); + const [response] = await client.performDiskShrink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performDiskShrink without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.performDiskShrink = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.performDiskShrink( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performDiskShrink with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.performDiskShrink = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.performDiskShrink(request), expectedError); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performDiskShrink with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.performDiskShrink(request), expectedError); + }); + }); + + describe('getDiskShrinkConfig', () => { + it('invokes getDiskShrinkConfig without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse(), + ); + client.innerApiCalls.getDiskShrinkConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getDiskShrinkConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDiskShrinkConfig without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse(), + ); + client.innerApiCalls.getDiskShrinkConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDiskShrinkConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDiskShrinkConfig with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDiskShrinkConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDiskShrinkConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDiskShrinkConfig with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDiskShrinkConfig(request), expectedError); + }); + }); + + describe('resetReplicaSize', () => { + it('invokes resetReplicaSize without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.resetReplicaSize = stubSimpleCall(expectedResponse); + const [response] = await client.resetReplicaSize(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetReplicaSize without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.resetReplicaSize = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetReplicaSize( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetReplicaSize with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetReplicaSize = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.resetReplicaSize(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetReplicaSize with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.resetReplicaSize(request), expectedError); + }); + }); + + describe('getLatestRecoveryTime', () => { + it('invokes getLatestRecoveryTime without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse(), + ); + client.innerApiCalls.getLatestRecoveryTime = + stubSimpleCall(expectedResponse); + const [response] = await client.getLatestRecoveryTime(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLatestRecoveryTime without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse(), + ); + client.innerApiCalls.getLatestRecoveryTime = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLatestRecoveryTime( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLatestRecoveryTime with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLatestRecoveryTime = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLatestRecoveryTime(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLatestRecoveryTime with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getLatestRecoveryTime(request), + expectedError, + ); + }); + }); + + describe('executeSql', () => { + it('invokes executeSql without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse(), + ); + client.innerApiCalls.executeSql = stubSimpleCall(expectedResponse); + const [response] = await client.executeSql(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executeSql without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse(), + ); + client.innerApiCalls.executeSql = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.executeSql( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executeSql with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.executeSql = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.executeSql(request), expectedError); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executeSql with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.executeSql(request), expectedError); + }); + }); + + describe('acquireSsrsLease', () => { + it('invokes acquireSsrsLease without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse(), + ); + client.innerApiCalls.acquireSsrsLease = stubSimpleCall(expectedResponse); + const [response] = await client.acquireSsrsLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes acquireSsrsLease without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse(), + ); + client.innerApiCalls.acquireSsrsLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.acquireSsrsLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes acquireSsrsLease with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.acquireSsrsLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.acquireSsrsLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes acquireSsrsLease with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.acquireSsrsLease(request), expectedError); + }); + }); + + describe('releaseSsrsLease', () => { + it('invokes releaseSsrsLease without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse(), + ); + client.innerApiCalls.releaseSsrsLease = stubSimpleCall(expectedResponse); + const [response] = await client.releaseSsrsLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes releaseSsrsLease without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse(), + ); + client.innerApiCalls.releaseSsrsLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.releaseSsrsLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes releaseSsrsLease with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.releaseSsrsLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.releaseSsrsLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes releaseSsrsLease with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.releaseSsrsLease(request), expectedError); + }); + }); + + describe('preCheckMajorVersionUpgrade', () => { + it('invokes preCheckMajorVersionUpgrade without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.preCheckMajorVersionUpgrade = + stubSimpleCall(expectedResponse); + const [response] = await client.preCheckMajorVersionUpgrade(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes preCheckMajorVersionUpgrade without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.preCheckMajorVersionUpgrade = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.preCheckMajorVersionUpgrade( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes preCheckMajorVersionUpgrade with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.preCheckMajorVersionUpgrade(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes preCheckMajorVersionUpgrade with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.preCheckMajorVersionUpgrade(request), + expectedError, + ); + }); + }); + + describe('pointInTimeRestore', () => { + it('invokes pointInTimeRestore without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.pointInTimeRestore = + stubSimpleCall(expectedResponse); + const [response] = await client.pointInTimeRestore(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pointInTimeRestore without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.pointInTimeRestore = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pointInTimeRestore( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pointInTimeRestore with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.pointInTimeRestore = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.pointInTimeRestore(request), expectedError); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pointInTimeRestore with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.pointInTimeRestore(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1.ts new file mode 100644 index 000000000000..56b5f9690f63 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1.ts @@ -0,0 +1,979 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqloperationsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlOperationsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqloperationsserviceModule.v1.SqlOperationsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqloperationsserviceModule.v1.SqlOperationsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + sqloperationsserviceModule.v1.SqlOperationsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlOperationsServiceStub, undefined); + await client.initialize(); + assert(client.sqlOperationsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlOperationsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlOperationsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.OperationsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.OperationsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperationsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('cancel', () => { + it('invokes cancel without error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.cancel = stubSimpleCall(expectedResponse); + const [response] = await client.cancel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancel without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.cancel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancel( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancel with error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancel = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancel(request), expectedError); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancel with closed client', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.cancel(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts new file mode 100644 index 000000000000..28cc64f3a40a --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts @@ -0,0 +1,1020 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqloperationsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlOperationsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlOperationsServiceStub, undefined); + await client.initialize(); + assert(client.sqlOperationsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlOperationsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlOperationsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.OperationsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.OperationsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperationsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('cancel', () => { + it('invokes cancel without error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.cancel = stubSimpleCall(expectedResponse); + const [response] = await client.cancel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancel without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.cancel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancel( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancel with error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancel = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancel(request), expectedError); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancel with closed client', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.cancel(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_regions_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_regions_service_v1.ts new file mode 100644 index 000000000000..9eb1da8081ae --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_regions_service_v1.ts @@ -0,0 +1,520 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlregionsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlRegionsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlregionsserviceModule.v1.SqlRegionsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlregionsserviceModule.v1.SqlRegionsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlregionsserviceModule.v1.SqlRegionsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlregionsserviceModule.v1.SqlRegionsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlRegionsServiceStub, undefined); + await client.initialize(); + assert(client.sqlRegionsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlRegionsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlRegionsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts new file mode 100644 index 000000000000..07ac5d56e9e0 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts @@ -0,0 +1,1158 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlsslcertsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlSslCertsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlSslCertsServiceStub, undefined); + await client.initialize(); + assert(client.sqlSslCertsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlSslCertsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlSslCertsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCert(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCert(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISslCert | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCertsInsertResponse(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCertsInsertResponse(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISslCertsInsertResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCertsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCertsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISslCertsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts new file mode 100644 index 000000000000..7b9549c8daf5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts @@ -0,0 +1,1231 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlsslcertsserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlSslCertsServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = + sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlSslCertsServiceStub, undefined); + await client.initialize(); + assert(client.sqlSslCertsServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlSslCertsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlSslCertsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCert(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCert(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISslCert | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCertsInsertResponse(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCertsInsertResponse(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCertsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCertsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISslCertsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts new file mode 100644 index 000000000000..0f48bbe07820 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts @@ -0,0 +1,653 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqltiersserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlTiersServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqltiersserviceModule.v1.SqlTiersServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqltiersserviceModule.v1.SqlTiersServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqltiersserviceModule.v1.SqlTiersServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqltiersserviceModule.v1.SqlTiersServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlTiersServiceStub, undefined); + await client.initialize(); + assert(client.sqlTiersServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlTiersServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlTiersServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.TiersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.TiersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ITiersListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts new file mode 100644 index 000000000000..7eed7f7ae61f --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts @@ -0,0 +1,655 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqltiersserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlTiersServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqltiersserviceModule.v1beta4.SqlTiersServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqltiersserviceModule.v1beta4.SqlTiersServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqltiersserviceModule.v1beta4.SqlTiersServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlTiersServiceStub, undefined); + await client.initialize(); + assert(client.sqlTiersServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlTiersServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlTiersServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.TiersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.TiersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ITiersListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1.ts new file mode 100644 index 000000000000..ffbc06c9fd47 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1.ts @@ -0,0 +1,1285 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlusersserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.SqlUsersServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlusersserviceModule.v1.SqlUsersServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlusersserviceModule.v1.SqlUsersServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlusersserviceModule.v1.SqlUsersServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlusersserviceModule.v1.SqlUsersServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlUsersServiceStub, undefined); + await client.initialize(); + assert(client.sqlUsersServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlUsersServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlUsersServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.User(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.User(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IUser | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.UsersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.UsersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IUsersListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('update', () => { + it('invokes update without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with closed client', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts new file mode 100644 index 000000000000..10439be8e2e5 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts @@ -0,0 +1,1287 @@ +// Copyright 2026 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 +// +// https://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 file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; +import * as sqlusersserviceModule from '../src'; + +import { protobuf, LocationProtos } from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); +} + +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1beta4.SqlUsersServiceClient', () => { + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); + + it('has universeDomain', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlusersserviceModule.v1beta4.SqlUsersServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlusersserviceModule.v1beta4.SqlUsersServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); + + it('has port', () => { + const port = sqlusersserviceModule.v1beta4.SqlUsersServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlUsersServiceStub, undefined); + await client.initialize(); + assert(client.sqlUsersServiceStub); + }); + + it('has close method for the initialized client', (done) => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlUsersServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has close method for the non-initialized client', (done) => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlUsersServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.User(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.User(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IUser | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UsersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UsersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IUsersListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('update', () => { + it('invokes update without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with closed client', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-sql/tsconfig.json b/owl-bot-staging/google-cloud-sql/tsconfig.json new file mode 100644 index 000000000000..ca73e7bfc824 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2023", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts", + "src/**/*.json", + "samples/**/*.json", + "protos/protos.json" + ] +} diff --git a/owl-bot-staging/google-cloud-sql/webpack.config.js b/owl-bot-staging/google-cloud-sql/webpack.config.js new file mode 100644 index 000000000000..07dc78031d41 --- /dev/null +++ b/owl-bot-staging/google-cloud-sql/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 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 +// +// https://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. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'SqlAvailableDatabaseVersionsService', + filename: './sql-available-database-versions-service.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; From fc16fb6c4f9f4165c6d859e07fb6dec62e7f3bd0 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 27 May 2026 06:29:04 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/google-cloud-sql/.gitignore | 14 - owl-bot-staging/google-cloud-sql/.jsdoc.js | 55 - owl-bot-staging/google-cloud-sql/.mocharc.js | 33 - owl-bot-staging/google-cloud-sql/.nycrc | 24 - owl-bot-staging/google-cloud-sql/README.md | 263 - ...loud_sql_available_database_versions.proto | 33 - .../cloud/sql/v1/cloud_sql_backup_runs.proto | 270 - .../cloud/sql/v1/cloud_sql_backups.proto | 327 - .../cloud/sql/v1/cloud_sql_connect.proto | 216 - .../cloud/sql/v1/cloud_sql_databases.proto | 152 - .../cloud/sql/v1/cloud_sql_events.proto | 33 - .../v1/cloud_sql_feature_eligibility.proto | 31 - .../google/cloud/sql/v1/cloud_sql_flags.proto | 161 - .../cloud/sql/v1/cloud_sql_iam_policies.proto | 30 - .../sql/v1/cloud_sql_instance_names.proto | 31 - .../cloud/sql/v1/cloud_sql_instances.proto | 2530 - .../cloud/sql/v1/cloud_sql_operations.proto | 105 - .../cloud/sql/v1/cloud_sql_regions.proto | 33 - .../cloud/sql/v1/cloud_sql_resources.proto | 2388 - .../cloud/sql/v1/cloud_sql_ssl_certs.proto | 141 - .../google/cloud/sql/v1/cloud_sql_tiers.proto | 76 - .../google/cloud/sql/v1/cloud_sql_users.proto | 313 - .../google/cloud/sql/v1beta4/cloud_sql.proto | 1739 - .../cloud/sql/v1beta4/cloud_sql_connect.proto | 217 - .../sql/v1beta4/cloud_sql_iam_policies.proto | 30 - .../sql/v1beta4/cloud_sql_resources.proto | 4074 - .../cloud/sql/v1beta4/cloud_sql_tiers.proto | 74 - .../cloud/sql/v1beta4/cloud_sql_users.proto | 311 - .../google-cloud-sql/protos/protos.d.ts | 63446 ------ .../google-cloud-sql/protos/protos.js | 167547 --------------- .../google-cloud-sql/protos/protos.json | 18221 -- .../snippet_metadata_google.cloud.sql.v1.json | 3567 - .../v1/sql_backup_runs_service.delete.js | 70 - .../v1/sql_backup_runs_service.get.js | 68 - .../v1/sql_backup_runs_service.insert.js | 67 - .../v1/sql_backup_runs_service.list.js | 74 - .../v1/sql_backups_service.create_backup.js | 67 - .../v1/sql_backups_service.delete_backup.js | 62 - .../v1/sql_backups_service.get_backup.js | 62 - .../v1/sql_backups_service.list_backups.js | 86 - .../v1/sql_backups_service.update_backup.js | 68 - ...connect_service.generate_ephemeral_cert.js | 81 - ...ql_connect_service.get_connect_settings.js | 69 - .../v1/sql_databases_service.delete.js | 68 - .../generated/v1/sql_databases_service.get.js | 68 - .../v1/sql_databases_service.insert.js | 67 - .../v1/sql_databases_service.list.js | 64 - .../v1/sql_databases_service.patch.js | 71 - .../v1/sql_databases_service.update.js | 71 - .../generated/v1/sql_flags_service.list.js | 66 - ...ql_instances_service.acquire_ssrs_lease.js | 75 - ...tances_service.add_entra_id_certificate.js | 66 - .../v1/sql_instances_service.add_server_ca.js | 64 - ...nstances_service.add_server_certificate.js | 64 - .../v1/sql_instances_service.clone.js | 71 - .../sql_instances_service.create_ephemeral.js | 67 - .../v1/sql_instances_service.delete.js | 81 - .../v1/sql_instances_service.demote.js | 71 - .../v1/sql_instances_service.demote_master.js | 67 - .../v1/sql_instances_service.execute_sql.js | 70 - .../v1/sql_instances_service.export.js | 67 - .../v1/sql_instances_service.failover.js | 67 - .../generated/v1/sql_instances_service.get.js | 66 - ...nstances_service.get_disk_shrink_config.js | 64 - ...tances_service.get_latest_recovery_time.js | 69 - .../v1/sql_instances_service.import.js | 67 - .../v1/sql_instances_service.insert.js | 64 - .../v1/sql_instances_service.list.js | 83 - ...nces_service.list_entra_id_certificates.js | 66 - .../sql_instances_service.list_server_cas.js | 64 - ...tances_service.list_server_certificates.js | 66 - .../v1/sql_instances_service.patch.js | 67 - ...l_instances_service.perform_disk_shrink.js | 68 - ...instances_service.point_in_time_restore.js | 68 - ...service.pre_check_major_version_upgrade.js | 72 - .../sql_instances_service.promote_replica.js | 73 - .../v1/sql_instances_service.reencrypt.js | 68 - ...ql_instances_service.release_ssrs_lease.js | 69 - ...nstances_service.reschedule_maintenance.js | 67 - ...ql_instances_service.reset_replica_size.js | 64 - .../sql_instances_service.reset_ssl_config.js | 68 - .../v1/sql_instances_service.restart.js | 64 - .../sql_instances_service.restore_backup.js | 67 - ...ces_service.rotate_entra_id_certificate.js | 70 - .../sql_instances_service.rotate_server_ca.js | 67 - ...ances_service.rotate_server_certificate.js | 70 - ...l_instances_service.start_external_sync.js | 94 - .../v1/sql_instances_service.start_replica.js | 64 - .../v1/sql_instances_service.stop_replica.js | 64 - .../v1/sql_instances_service.switchover.js | 70 - .../v1/sql_instances_service.truncate_log.js | 67 - .../v1/sql_instances_service.update.js | 67 - ...s_service.verify_external_sync_settings.js | 96 - .../v1/sql_operations_service.cancel.js | 64 - .../v1/sql_operations_service.get.js | 66 - .../v1/sql_operations_service.list.js | 73 - .../v1/sql_ssl_certs_service.delete.js | 68 - .../generated/v1/sql_ssl_certs_service.get.js | 68 - .../v1/sql_ssl_certs_service.insert.js | 67 - .../v1/sql_ssl_certs_service.list.js | 64 - .../generated/v1/sql_tiers_service.list.js | 60 - .../generated/v1/sql_users_service.delete.js | 72 - .../generated/v1/sql_users_service.get.js | 72 - .../generated/v1/sql_users_service.insert.js | 67 - .../generated/v1/sql_users_service.list.js | 64 - .../generated/v1/sql_users_service.update.js | 86 - ...pet_metadata_google.cloud.sql.v1beta4.json | 3567 - .../v1beta4/sql_backup_runs_service.delete.js | 70 - .../v1beta4/sql_backup_runs_service.get.js | 68 - .../v1beta4/sql_backup_runs_service.insert.js | 67 - .../v1beta4/sql_backup_runs_service.list.js | 74 - .../sql_backups_service.create_backup.js | 67 - .../sql_backups_service.delete_backup.js | 62 - .../v1beta4/sql_backups_service.get_backup.js | 62 - .../sql_backups_service.list_backups.js | 86 - .../sql_backups_service.update_backup.js | 68 - ...connect_service.generate_ephemeral_cert.js | 81 - ...ql_connect_service.get_connect_settings.js | 69 - .../v1beta4/sql_databases_service.delete.js | 68 - .../v1beta4/sql_databases_service.get.js | 68 - .../v1beta4/sql_databases_service.insert.js | 67 - .../v1beta4/sql_databases_service.list.js | 64 - .../v1beta4/sql_databases_service.patch.js | 71 - .../v1beta4/sql_databases_service.update.js | 71 - .../v1beta4/sql_flags_service.list.js | 66 - ...ql_instances_service.acquire_ssrs_lease.js | 74 - ...tances_service.add_entra_id_certificate.js | 66 - .../sql_instances_service.add_server_ca.js | 64 - ...nstances_service.add_server_certificate.js | 66 - .../v1beta4/sql_instances_service.clone.js | 68 - .../sql_instances_service.create_ephemeral.js | 67 - .../v1beta4/sql_instances_service.delete.js | 81 - .../v1beta4/sql_instances_service.demote.js | 70 - .../sql_instances_service.demote_master.js | 67 - .../sql_instances_service.execute_sql.js | 70 - .../v1beta4/sql_instances_service.export.js | 67 - .../v1beta4/sql_instances_service.failover.js | 67 - .../v1beta4/sql_instances_service.get.js | 64 - ...nstances_service.get_disk_shrink_config.js | 64 - ...tances_service.get_latest_recovery_time.js | 69 - .../v1beta4/sql_instances_service.import.js | 67 - .../v1beta4/sql_instances_service.insert.js | 64 - .../v1beta4/sql_instances_service.list.js | 83 - ...nces_service.list_entra_id_certificates.js | 66 - .../sql_instances_service.list_server_cas.js | 64 - ...tances_service.list_server_certificates.js | 66 - .../v1beta4/sql_instances_service.patch.js | 67 - ...l_instances_service.perform_disk_shrink.js | 68 - ...instances_service.point_in_time_restore.js | 68 - ...service.pre_check_major_version_upgrade.js | 72 - .../sql_instances_service.promote_replica.js | 73 - .../sql_instances_service.reencrypt.js | 68 - ...ql_instances_service.release_ssrs_lease.js | 70 - ...nstances_service.reschedule_maintenance.js | 67 - ...ql_instances_service.reset_replica_size.js | 64 - .../sql_instances_service.reset_ssl_config.js | 68 - .../v1beta4/sql_instances_service.restart.js | 64 - .../sql_instances_service.restore_backup.js | 67 - ...ces_service.rotate_entra_id_certificate.js | 71 - .../sql_instances_service.rotate_server_ca.js | 67 - ...ances_service.rotate_server_certificate.js | 71 - ...l_instances_service.start_external_sync.js | 94 - .../sql_instances_service.start_replica.js | 64 - .../sql_instances_service.stop_replica.js | 64 - .../sql_instances_service.switchover.js | 70 - .../sql_instances_service.truncate_log.js | 67 - .../v1beta4/sql_instances_service.update.js | 67 - ...s_service.verify_external_sync_settings.js | 96 - .../v1beta4/sql_operations_service.cancel.js | 64 - .../v1beta4/sql_operations_service.get.js | 64 - .../v1beta4/sql_operations_service.list.js | 73 - .../v1beta4/sql_ssl_certs_service.delete.js | 68 - .../v1beta4/sql_ssl_certs_service.get.js | 68 - .../v1beta4/sql_ssl_certs_service.insert.js | 67 - .../v1beta4/sql_ssl_certs_service.list.js | 64 - .../v1beta4/sql_tiers_service.list.js | 60 - .../v1beta4/sql_users_service.delete.js | 72 - .../v1beta4/sql_users_service.get.js | 72 - .../v1beta4/sql_users_service.insert.js | 67 - .../v1beta4/sql_users_service.list.js | 64 - .../v1beta4/sql_users_service.update.js | 86 - .../src/v1/gapic_metadata.json | 965 - .../google-cloud-sql/src/v1/index.ts | 34 - ...ilable_database_versions_service_client.ts | 491 - ...tabase_versions_service_client_config.json | 25 - ..._database_versions_service_proto_list.json | 19 - .../src/v1/sql_backup_runs_service_client.ts | 1059 - ...sql_backup_runs_service_client_config.json | 46 - .../sql_backup_runs_service_proto_list.json | 19 - .../src/v1/sql_backups_service_client.ts | 1323 - .../v1/sql_backups_service_client_config.json | 51 - .../v1/sql_backups_service_proto_list.json | 19 - .../src/v1/sql_connect_service_client.ts | 804 - .../v1/sql_connect_service_client_config.json | 34 - .../v1/sql_connect_service_proto_list.json | 19 - .../src/v1/sql_databases_service_client.ts | 1328 - .../sql_databases_service_client_config.json | 56 - .../v1/sql_databases_service_proto_list.json | 19 - .../src/v1/sql_events_service_client.ts | 487 - .../v1/sql_events_service_client_config.json | 25 - .../src/v1/sql_events_service_proto_list.json | 19 - .../sql_feature_eligibility_service_client.ts | 488 - ...ure_eligibility_service_client_config.json | 25 - ...eature_eligibility_service_proto_list.json | 19 - .../src/v1/sql_flags_service_client.ts | 642 - .../v1/sql_flags_service_client_config.json | 31 - .../src/v1/sql_flags_service_proto_list.json | 19 - .../src/v1/sql_iam_policies_service_client.ts | 487 - ...ql_iam_policies_service_client_config.json | 25 - .../sql_iam_policies_service_proto_list.json | 19 - .../v1/sql_instance_names_service_client.ts | 487 - ..._instance_names_service_client_config.json | 25 - ...sql_instance_names_service_proto_list.json | 19 - .../src/v1/sql_instances_service_client.ts | 6827 - .../sql_instances_service_client_config.json | 241 - .../v1/sql_instances_service_proto_list.json | 19 - .../src/v1/sql_operations_service_client.ts | 916 - .../sql_operations_service_client_config.json | 41 - .../v1/sql_operations_service_proto_list.json | 19 - .../src/v1/sql_regions_service_client.ts | 487 - .../v1/sql_regions_service_client_config.json | 25 - .../v1/sql_regions_service_proto_list.json | 19 - .../src/v1/sql_ssl_certs_service_client.ts | 1046 - .../sql_ssl_certs_service_client_config.json | 46 - .../v1/sql_ssl_certs_service_proto_list.json | 19 - .../src/v1/sql_tiers_service_client.ts | 644 - .../v1/sql_tiers_service_client_config.json | 31 - .../src/v1/sql_tiers_service_proto_list.json | 19 - .../src/v1/sql_users_service_client.ts | 1181 - .../v1/sql_users_service_client_config.json | 51 - .../src/v1/sql_users_service_proto_list.json | 19 - .../src/v1beta4/gapic_metadata.json | 905 - .../google-cloud-sql/src/v1beta4/index.ts | 29 - .../v1beta4/sql_backup_runs_service_client.ts | 1114 - ...sql_backup_runs_service_client_config.json | 46 - .../sql_backup_runs_service_proto_list.json | 8 - .../src/v1beta4/sql_backups_service_client.ts | 1339 - .../sql_backups_service_client_config.json | 51 - .../sql_backups_service_proto_list.json | 8 - .../src/v1beta4/sql_connect_service_client.ts | 816 - .../sql_connect_service_client_config.json | 34 - .../sql_connect_service_proto_list.json | 8 - .../v1beta4/sql_databases_service_client.ts | 1405 - .../sql_databases_service_client_config.json | 56 - .../sql_databases_service_proto_list.json | 8 - .../src/v1beta4/sql_flags_service_client.ts | 671 - .../sql_flags_service_client_config.json | 31 - .../v1beta4/sql_flags_service_proto_list.json | 8 - .../sql_iam_policies_service_client.ts | 487 - ...ql_iam_policies_service_client_config.json | 25 - .../sql_iam_policies_service_proto_list.json | 8 - .../v1beta4/sql_instances_service_client.ts | 6945 - .../sql_instances_service_client_config.json | 241 - .../sql_instances_service_proto_list.json | 8 - .../v1beta4/sql_operations_service_client.ts | 963 - .../sql_operations_service_client_config.json | 41 - .../sql_operations_service_proto_list.json | 8 - .../v1beta4/sql_ssl_certs_service_client.ts | 1097 - .../sql_ssl_certs_service_client_config.json | 46 - .../sql_ssl_certs_service_proto_list.json | 8 - .../src/v1beta4/sql_tiers_service_client.ts | 647 - .../sql_tiers_service_client_config.json | 31 - .../v1beta4/sql_tiers_service_proto_list.json | 8 - .../src/v1beta4/sql_users_service_client.ts | 1200 - .../sql_users_service_client_config.json | 51 - .../v1beta4/sql_users_service_proto_list.json | 8 - .../google-cloud-sql/system-test/install.ts | 51 - ..._available_database_versions_service_v1.ts | 571 - .../test/gapic_sql_backup_runs_service_v1.ts | 1192 - .../gapic_sql_backup_runs_service_v1beta4.ts | 1233 - .../test/gapic_sql_backups_service_v1.ts | 1435 - .../test/gapic_sql_backups_service_v1beta4.ts | 1483 - .../test/gapic_sql_connect_service_v1.ts | 841 - .../test/gapic_sql_connect_service_v1beta4.ts | 867 - .../test/gapic_sql_databases_service_v1.ts | 1567 - .../gapic_sql_databases_service_v1beta4.ts | 1575 - .../test/gapic_sql_events_service_v1.ts | 519 - ...apic_sql_feature_eligibility_service_v1.ts | 565 - .../test/gapic_sql_flags_service_v1.ts | 609 - .../test/gapic_sql_flags_service_v1beta4.ts | 649 - .../test/gapic_sql_iam_policies_service_v1.ts | 541 - .../gapic_sql_iam_policies_service_v1beta4.ts | 541 - .../gapic_sql_instance_names_service_v1.ts | 541 - .../test/gapic_sql_instances_service_v1.ts | 7478 - .../gapic_sql_instances_service_v1beta4.ts | 7248 - .../test/gapic_sql_operations_service_v1.ts | 979 - .../gapic_sql_operations_service_v1beta4.ts | 1020 - .../test/gapic_sql_regions_service_v1.ts | 520 - .../test/gapic_sql_ssl_certs_service_v1.ts | 1158 - .../gapic_sql_ssl_certs_service_v1beta4.ts | 1231 - .../test/gapic_sql_tiers_service_v1.ts | 653 - .../test/gapic_sql_tiers_service_v1beta4.ts | 655 - .../test/gapic_sql_users_service_v1.ts | 1285 - .../test/gapic_sql_users_service_v1beta4.ts | 1287 - .../google-cloud-sql/tsconfig.json | 22 - .../google-cloud-sql/webpack.config.js | 64 - .../google-cloud-sql/.eslintignore | 0 .../google-cloud-sql/.eslintrc.json | 0 packages/google-cloud-sql/README.md | 4 +- .../cloud/sql/v1/cloud_sql_instances.proto | 21 +- .../cloud/sql/v1/cloud_sql_resources.proto | 63 +- .../google/cloud/sql/v1/cloud_sql_users.proto | 1 + packages/google-cloud-sql/protos/protos.d.ts | 673 +- packages/google-cloud-sql/protos/protos.js | 2305 +- packages/google-cloud-sql/protos/protos.json | 310 +- .../snippet_metadata_google.cloud.sql.v1.json | 2 +- .../v1/sql_instances_service.clone.js | 2 +- ...pet_metadata_google.cloud.sql.v1beta4.json | 2 +- packages/google-cloud-sql/src/v1/index.ts | 32 +- .../src/v1/sql_backup_runs_service_client.ts | 901 +- .../src/v1/sql_backups_service_client.ts | 1253 +- .../src/v1/sql_connect_service_client.ts | 554 +- .../src/v1/sql_databases_service_client.ts | 1264 +- .../sql_feature_eligibility_service_client.ts | 139 +- .../src/v1/sql_flags_service_client.ts | 330 +- .../src/v1/sql_instances_service_client.ts | 8513 +- .../src/v1/sql_operations_service_client.ts | 701 +- .../src/v1/sql_ssl_certs_service_client.ts | 883 +- .../src/v1/sql_tiers_service_client.ts | 333 +- .../src/v1/sql_users_service_client.ts | 1073 +- .../google-cloud-sql/src/v1beta4/index.ts | 22 +- .../v1beta4/sql_backup_runs_service_client.ts | 935 +- .../src/v1beta4/sql_backups_service_client.ts | 1269 +- .../src/v1beta4/sql_connect_service_client.ts | 566 +- .../v1beta4/sql_databases_service_client.ts | 1320 +- .../src/v1beta4/sql_flags_service_client.ts | 338 +- .../v1beta4/sql_instances_service_client.ts | 8674 +- .../v1beta4/sql_operations_service_client.ts | 728 +- .../v1beta4/sql_ssl_certs_service_client.ts | 913 +- .../src/v1beta4/sql_tiers_service_client.ts | 335 +- .../src/v1beta4/sql_users_service_client.ts | 1093 +- .../google-cloud-sql/system-test/install.ts | 24 +- .../test/gapic_sql_backup_runs_service_v1.ts | 1999 +- .../gapic_sql_backup_runs_service_v1beta4.ts | 2064 +- .../test/gapic_sql_backups_service_v1.ts | 2394 +- .../test/gapic_sql_backups_service_v1beta4.ts | 2382 +- .../test/gapic_sql_connect_service_v1.ts | 1372 +- .../test/gapic_sql_connect_service_v1beta4.ts | 1364 +- .../test/gapic_sql_databases_service_v1.ts | 2574 +- .../gapic_sql_databases_service_v1beta4.ts | 2538 +- ...apic_sql_feature_eligibility_service_v1.ts | 866 +- .../test/gapic_sql_flags_service_v1.ts | 983 +- .../test/gapic_sql_flags_service_v1beta4.ts | 1049 +- .../test/gapic_sql_instances_service_v1.ts | 12633 +- .../gapic_sql_instances_service_v1beta4.ts | 12711 +- .../test/gapic_sql_operations_service_v1.ts | 1606 +- .../gapic_sql_operations_service_v1beta4.ts | 1705 +- .../test/gapic_sql_ssl_certs_service_v1.ts | 1921 +- .../gapic_sql_ssl_certs_service_v1beta4.ts | 2062 +- .../test/gapic_sql_tiers_service_v1.ts | 1060 +- .../test/gapic_sql_tiers_service_v1beta4.ts | 1060 +- .../test/gapic_sql_users_service_v1.ts | 2148 +- .../test/gapic_sql_users_service_v1beta4.ts | 2148 +- packages/google-cloud-sql/webpack.config.js | 2 +- 354 files changed, 56021 insertions(+), 396007 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-sql/.gitignore delete mode 100644 owl-bot-staging/google-cloud-sql/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-sql/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-sql/.nycrc delete mode 100644 owl-bot-staging/google-cloud-sql/README.md delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backups.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_connect.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_databases.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_events.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_flags.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instance_names.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_operations.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_regions.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_tiers.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_users.proto delete mode 100644 owl-bot-staging/google-cloud-sql/protos/protos.d.ts delete mode 100644 owl-bot-staging/google-cloud-sql/protos/protos.js delete mode 100644 owl-bot-staging/google-cloud-sql/protos/protos.json delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.delete.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.insert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.create_backup.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.delete_backup.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.get_backup.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.list_backups.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.update_backup.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.get_connect_settings.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.delete.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.insert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.patch.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.update.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_flags_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_entra_id_certificate.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_ca.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_certificate.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.create_ephemeral.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.delete.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote_master.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.execute_sql.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.export.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.failover.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_disk_shrink_config.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_latest_recovery_time.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.import.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.insert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_entra_id_certificates.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_cas.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_certificates.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.patch.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.perform_disk_shrink.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.point_in_time_restore.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.promote_replica.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reencrypt.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.release_ssrs_lease.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reschedule_maintenance.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_replica_size.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_ssl_config.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restart.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restore_backup.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_ca.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_certificate.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_external_sync.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_replica.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.stop_replica.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.switchover.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.truncate_log.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.update.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.verify_external_sync_settings.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.cancel.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.delete.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.insert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_tiers_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.delete.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.insert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.update.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.delete.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.insert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.create_backup.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.delete_backup.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.get_backup.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.list_backups.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.update_backup.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.get_connect_settings.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.delete.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.insert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.patch.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.update.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_flags_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_ca.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_certificate.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.clone.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.create_ephemeral.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.delete.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote_master.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.execute_sql.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.export.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.failover.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.import.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.insert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_cas.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_certificates.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.patch.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.promote_replica.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reencrypt.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_replica_size.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restart.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restore_backup.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_external_sync.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_replica.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.stop_replica.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.switchover.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.truncate_log.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.update.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.cancel.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.delete.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.insert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_tiers_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.delete.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.get.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.insert.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.list.js delete mode 100644 owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.update.js delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/index.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client.ts delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client_config.json delete mode 100644 owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-sql/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_available_database_versions_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_events_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_instance_names_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_regions_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1.ts delete mode 100644 owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts delete mode 100644 owl-bot-staging/google-cloud-sql/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-sql/webpack.config.js rename {owl-bot-staging => packages}/google-cloud-sql/.eslintignore (100%) rename {owl-bot-staging => packages}/google-cloud-sql/.eslintrc.json (100%) diff --git a/owl-bot-staging/google-cloud-sql/.gitignore b/owl-bot-staging/google-cloud-sql/.gitignore deleted file mode 100644 index d4f03a0df2e8..000000000000 --- a/owl-bot-staging/google-cloud-sql/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-sql/.jsdoc.js b/owl-bot-staging/google-cloud-sql/.jsdoc.js deleted file mode 100644 index b712c954f332..000000000000 --- a/owl-bot-staging/google-cloud-sql/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2026 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/sql', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-sql/.mocharc.js b/owl-bot-staging/google-cloud-sql/.mocharc.js deleted file mode 100644 index 5eb34e86c874..000000000000 --- a/owl-bot-staging/google-cloud-sql/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-sql/.nycrc b/owl-bot-staging/google-cloud-sql/.nycrc deleted file mode 100644 index 81a95fc94b00..000000000000 --- a/owl-bot-staging/google-cloud-sql/.nycrc +++ /dev/null @@ -1,24 +0,0 @@ -{ - "report-dir": "./.coverage", - "reporter": ["text", "lcov"], - "exclude": [ - "**/*-test", - "**/.coverage", - "**/apis", - "**/benchmark", - "**/conformance", - "**/docs", - "**/samples", - "**/scripts", - "**/protos", - "**/test", - "**/*.d.ts", - ".jsdoc.js", - "**/.jsdoc.js", - "karma.conf.js", - "webpack-tests.config.js", - "webpack.config.js" - ], - "exclude-after-remap": false, - "all": true -} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-sql/README.md b/owl-bot-staging/google-cloud-sql/README.md deleted file mode 100644 index 497b95b405f9..000000000000 --- a/owl-bot-staging/google-cloud-sql/README.md +++ /dev/null @@ -1,263 +0,0 @@ -[//]: # "This README.md file is auto-generated, all changes to this file will be lost." -[//]: # "The comments you see below are used to generate those parts of the template in later states." -Google Cloud Platform logo - -# [Cloud SQL Admin API: Nodejs Client][homepage] - -This library is considered to be **stable**. The code surface will not change in backwards-incompatible ways -unless absolutely necessary (e.g. because of critical security issues) or with -an extensive deprecation period. Issues and requests against **stable** libraries -are addressed with the highest priority - -[![npm version](https://img.shields.io/npm/v/@google-cloud/sql.svg)](https://www.npmjs.org/package/@google-cloud/sql) - -Cloud SQL Admin API client for Node.js - -[//]: # "partials.introduction" - -A comprehensive list of changes in each version may be found in -[the CHANGELOG][homepage_changelog]. - -* [Cloud SQL Admin API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/sql/latest) - - -Read more about the client libraries for Cloud APIs, including the older -Google APIs Client Libraries, in [Client Libraries Explained][explained]. - -[explained]: https://cloud.google.com/apis/docs/client-libraries-explained - -**Table of contents:** - -* [Quickstart](#quickstart) - * [Before you begin](#before-you-begin) - * [Installing the client library](#installing-the-client-library) - -* [Versioning](#versioning) -* [Contributing](#contributing) -* [License](#license) - -## Quickstart -### Before you begin - -1. [Select or create a Cloud Platform project][projects]. -1. [Enable billing for your project][billing]. -1. [Enable the Cloud SQL Admin API API][enable_api]. -1. [Set up authentication][auth] so you can access the - API from your local workstation. -### Installing the client library - -```bash -npm install @google-cloud/sql -``` - -[//]: # "partials.body" - -## Samples - -Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample. - -| Sample | Source Code | -| --------------------------- | --------------------------------- | -| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json) | -| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.delete.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.get.js) | -| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.insert.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.list.js) | -| create backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backups_service.create_backup.js) | -| delete backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backups_service.delete_backup.js) | -| get backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backups_service.get_backup.js) | -| list backups | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backups_service.list_backups.js) | -| update backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_backups_service.update_backup.js) | -| generate ephemeral cert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js) | -| get connect settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_connect_service.get_connect_settings.js) | -| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.delete.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.get.js) | -| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.insert.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.list.js) | -| patch | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.patch.js) | -| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_databases_service.update.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_flags_service.list.js) | -| acquire ssrs lease | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js) | -| add entra id certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.add_entra_id_certificate.js) | -| add server ca | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_ca.js) | -| add server certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_certificate.js) | -| clone | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js) | -| create ephemeral | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.create_ephemeral.js) | -| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.delete.js) | -| demote | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.demote.js) | -| demote master | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.demote_master.js) | -| execute sql | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.execute_sql.js) | -| export | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.export.js) | -| failover | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.failover.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.get.js) | -| get disk shrink config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.get_disk_shrink_config.js) | -| get latest recovery time | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.get_latest_recovery_time.js) | -| import | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.import.js) | -| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.insert.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.list.js) | -| list entra id certificates | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.list_entra_id_certificates.js) | -| list server cas | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_cas.js) | -| list server certificates | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_certificates.js) | -| patch | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.patch.js) | -| perform disk shrink | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.perform_disk_shrink.js) | -| point in time restore | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.point_in_time_restore.js) | -| pre check major version upgrade | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js) | -| promote replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.promote_replica.js) | -| reencrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.reencrypt.js) | -| release ssrs lease | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.release_ssrs_lease.js) | -| reschedule maintenance | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.reschedule_maintenance.js) | -| reset replica size | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_replica_size.js) | -| reset ssl config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_ssl_config.js) | -| restart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.restart.js) | -| restore backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.restore_backup.js) | -| rotate entra id certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js) | -| rotate server ca | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_ca.js) | -| rotate server certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_certificate.js) | -| start external sync | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.start_external_sync.js) | -| start replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.start_replica.js) | -| stop replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.stop_replica.js) | -| switchover | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.switchover.js) | -| truncate log | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.truncate_log.js) | -| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.update.js) | -| verify external sync settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.verify_external_sync_settings.js) | -| cancel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_operations_service.cancel.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_operations_service.get.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_operations_service.list.js) | -| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.delete.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.get.js) | -| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.insert.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.list.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_tiers_service.list.js) | -| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_users_service.delete.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_users_service.get.js) | -| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_users_service.insert.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_users_service.list.js) | -| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1/sql_users_service.update.js) | -| cloud | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json) | -| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.delete.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.get.js) | -| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.insert.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.list.js) | -| create backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.create_backup.js) | -| delete backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.delete_backup.js) | -| get backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.get_backup.js) | -| list backups | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.list_backups.js) | -| update backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.update_backup.js) | -| generate ephemeral cert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js) | -| get connect settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.get_connect_settings.js) | -| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.delete.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.get.js) | -| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.insert.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.list.js) | -| patch | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.patch.js) | -| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.update.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_flags_service.list.js) | -| acquire ssrs lease | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js) | -| add entra id certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js) | -| add server ca | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_ca.js) | -| add server certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_certificate.js) | -| clone | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.clone.js) | -| create ephemeral | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.create_ephemeral.js) | -| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.delete.js) | -| demote | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote.js) | -| demote master | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote_master.js) | -| execute sql | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.execute_sql.js) | -| export | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.export.js) | -| failover | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.failover.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get.js) | -| get disk shrink config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js) | -| get latest recovery time | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js) | -| import | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.import.js) | -| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.insert.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list.js) | -| list entra id certificates | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js) | -| list server cas | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_cas.js) | -| list server certificates | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_certificates.js) | -| patch | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.patch.js) | -| perform disk shrink | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js) | -| point in time restore | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js) | -| pre check major version upgrade | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js) | -| promote replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.promote_replica.js) | -| reencrypt | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reencrypt.js) | -| release ssrs lease | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js) | -| reschedule maintenance | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js) | -| reset replica size | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_replica_size.js) | -| reset ssl config | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js) | -| restart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restart.js) | -| restore backup | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restore_backup.js) | -| rotate entra id certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js) | -| rotate server ca | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js) | -| rotate server certificate | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js) | -| start external sync | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_external_sync.js) | -| start replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_replica.js) | -| stop replica | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.stop_replica.js) | -| switchover | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.switchover.js) | -| truncate log | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.truncate_log.js) | -| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.update.js) | -| verify external sync settings | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js) | -| cancel | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.cancel.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.get.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.list.js) | -| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.delete.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.get.js) | -| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.insert.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.list.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_tiers_service.list.js) | -| delete | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_users_service.delete.js) | -| get | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_users_service.get.js) | -| insert | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_users_service.insert.js) | -| list | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_users_service.list.js) | -| update | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples/generated/v1beta4/sql_users_service.update.js) | - - -## Supported Node.js Versions - -Our client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule). -Libraries are compatible with all current _active_ and _maintenance_ versions of -Node.js. -If you are using an end-of-life version of Node.js, we recommend that you update -as soon as possible to an actively supported LTS version. - -Google's client libraries support legacy versions of Node.js runtimes on a -best-efforts basis with the following warnings: - -* Legacy versions are not tested in continuous integration. -* Some security patches and features cannot be backported. -* Dependencies cannot be kept up-to-date. - -Client libraries targeting some end-of-life versions of Node.js are available, and -can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag). -The dist-tags follow the naming convention `legacy-(version)`. -For example, `npm install @google-cloud/sql@legacy-8` installs client libraries -for versions compatible with Node.js 8. - -## Versioning - -This library follows [Semantic Versioning](http://semver.org/). - -More Information: [Google Cloud Platform Launch Stages][launch_stages] - -[launch_stages]: https://cloud.google.com/terms/launch-stages - -## Contributing - -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). - -Please note that this `README.md` -and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) -are generated from a central template. - -## License - -Apache Version 2.0 - -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) - -[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=sqladmin.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local -[homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/samples -[homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/CHANGELOG.md -[homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto deleted file mode 100644 index 0147d26d397e..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlAvailableDatabaseVersionsProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service that exposes Cloud SQL database versions information. This -// service is only used internally. -service SqlAvailableDatabaseVersionsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto deleted file mode 100644 index b90def1581a8..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto +++ /dev/null @@ -1,270 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/sql/v1/cloud_sql_resources.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlBackupRunsProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service for managing database backups. -service SqlBackupRunsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Deletes the backup taken by a backup run. - rpc Delete(SqlBackupRunsDeleteRequest) returns (Operation) { - option (google.api.http) = { - delete: "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" - }; - } - - // Retrieves a resource containing information about a backup run. - rpc Get(SqlBackupRunsGetRequest) returns (BackupRun) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" - }; - } - - // Creates a new backup run on demand. - rpc Insert(SqlBackupRunsInsertRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/backupRuns" - body: "body" - }; - } - - // Lists all backup runs associated with the project or a given instance - // and configuration in the reverse chronological order of the backup - // initiation time. - rpc List(SqlBackupRunsListRequest) returns (BackupRunsListResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/backupRuns" - }; - } -} - -// Backup runs delete request. -message SqlBackupRunsDeleteRequest { - // The ID of the backup run to delete. To find a backup run ID, use the - // [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list) - // method. - int64 id = 1; - - // Cloud SQL instance ID. This does not include the project ID. - string instance = 2; - - // Project ID of the project that contains the instance. - string project = 3; -} - -// Backup runs get request. -message SqlBackupRunsGetRequest { - // The ID of this backup run. - int64 id = 1; - - // Cloud SQL instance ID. This does not include the project ID. - string instance = 2; - - // Project ID of the project that contains the instance. - string project = 3; -} - -// Backup runs insert request. -message SqlBackupRunsInsertRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - BackupRun body = 100; -} - -// Backup runs list request. -message SqlBackupRunsListRequest { - // Cloud SQL instance ID, or "-" for all instances. This does not include - // the project ID. - string instance = 1; - - // Maximum number of backup runs per response. - int32 max_results = 2; - - // A previously-returned page token representing part of the larger set of - // results to view. - string page_token = 3; - - // Project ID of the project that contains the instance. - string project = 4; -} - -// A BackupRun resource. -message BackupRun { - // This is always `sql#backupRun`. - string kind = 1; - - // The status of this run. - SqlBackupRunStatus status = 2; - - // The time the run was enqueued in UTC timezone in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp enqueued_time = 3; - - // The identifier for this backup run. Unique only for a specific Cloud SQL - // instance. - int64 id = 4; - - // The time the backup operation actually started in UTC timezone in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp start_time = 5; - - // The time the backup operation completed in UTC timezone in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp end_time = 6; - - // Information about why the backup operation failed. This is only present if - // the run has the FAILED status. - OperationError error = 7; - - // The type of this run; can be either "AUTOMATED" or "ON_DEMAND" or "FINAL". - // This field defaults to "ON_DEMAND" and is ignored, when specified for - // insert requests. - SqlBackupRunType type = 8; - - // The description of this run, only applicable to on-demand backups. - string description = 9; - - // The start time of the backup window during which this the backup was - // attempted in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for - // example `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp window_start_time = 10; - - // Name of the database instance. - string instance = 11; - - // The URI of this resource. - string self_link = 12; - - // Location of the backups. - string location = 13; - - // Output only. The instance database version at the time this backup was - // made. - SqlDatabaseVersion database_version = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Encryption configuration specific to a backup. - DiskEncryptionConfiguration disk_encryption_configuration = 16; - - // Encryption status specific to a backup. - DiskEncryptionStatus disk_encryption_status = 17; - - // Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. - SqlBackupKind backup_kind = 19; - - // Backup time zone to prevent restores to an instance with - // a different time zone. Now relevant only for SQL Server. - string time_zone = 23; - - // Output only. The maximum chargeable bytes for the backup. - optional int64 max_chargeable_bytes = 24 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Backup run list results. -message BackupRunsListResponse { - // This is always `sql#backupRunsList`. - string kind = 1; - - // A list of backup runs in reverse chronological order of the enqueued time. - repeated BackupRun items = 2; - - // The continuation token, used to page through large result sets. Provide - // this value in a subsequent request to return the next page of results. - string next_page_token = 3; -} - -// The status of a backup run. -enum SqlBackupRunStatus { - // The status of the run is unknown. - SQL_BACKUP_RUN_STATUS_UNSPECIFIED = 0; - - // The backup operation was enqueued. - ENQUEUED = 1; - - // The backup is overdue across a given backup window. Indicates a - // problem. Example: Long-running operation in progress during - // the whole window. - OVERDUE = 2; - - // The backup is in progress. - RUNNING = 3; - - // The backup failed. - FAILED = 4; - - // The backup was successful. - SUCCESSFUL = 5; - - // The backup was skipped (without problems) for a given backup - // window. Example: Instance was idle. - SKIPPED = 6; - - // The backup is about to be deleted. - DELETION_PENDING = 7; - - // The backup deletion failed. - DELETION_FAILED = 8; - - // The backup has been deleted. - DELETED = 9; -} - -// Defines the supported backup kinds. -enum SqlBackupKind { - // This is an unknown BackupKind. - SQL_BACKUP_KIND_UNSPECIFIED = 0; - - // Snapshot-based backups. - SNAPSHOT = 1; - - // Physical backups. - PHYSICAL = 2; -} - -// Type of backup (i.e. automated, on demand, etc). -enum SqlBackupRunType { - // This is an unknown BackupRun type. - SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0; - - // The backup schedule automatically triggers a backup. - AUTOMATED = 1; - - // The user manually triggers a backup. - ON_DEMAND = 2; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backups.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backups.proto deleted file mode 100644 index 220be86b60fa..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_backups.proto +++ /dev/null @@ -1,327 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/sql/v1/cloud_sql_backup_runs.proto"; -import "google/cloud/sql/v1/cloud_sql_instances.proto"; -import "google/cloud/sql/v1/cloud_sql_resources.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/type/interval.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlBackupsProto"; -option java_package = "com.google.cloud.sql.v1"; - -service SqlBackupsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Creates a backup for a Cloud SQL instance. This API can be used only to - // create on-demand backups. - rpc CreateBackup(CreateBackupRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent, backup"; - } - - // Retrieves a resource containing information about a backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/v1/{name=projects/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all backups associated with the project. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates the retention period and description of the backup. You can use - // this API to update final backups only. - rpc UpdateBackup(UpdateBackupRequest) returns (Operation) { - option (google.api.http) = { - patch: "/v1/{backup.name=projects/*/backups/*}" - body: "backup" - }; - option (google.api.method_signature) = "backup, update_mask"; - } - - // Deletes the backup. - rpc DeleteBackup(DeleteBackupRequest) returns (Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// The request payload to create the backup -message CreateBackupRequest { - // Required. The parent resource where this backup is created. - // Format: projects/{project} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "sqladmin.googleapis.com/Backup" - } - ]; - - // Required. The Backup to create. - Backup backup = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request payload to get the backup. -message GetBackupRequest { - // Required. The name of the backup to retrieve. - // Format: projects/{project}/backups/{backup} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } - ]; -} - -// The request payload to list the backups. -message ListBackupsRequest { - // Required. The parent that owns this collection of backups. - // Format: projects/{project} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "sqladmin.googleapis.com/Backup" - } - ]; - - // The maximum number of backups to return per response. The service might - // return fewer backups than this value. If a value for this parameter isn't - // specified, then, at most, 500 backups are returned. The maximum value is - // 2,000. Any values that you set, which are greater than 2,000, are changed - // to 2,000. - int32 page_size = 2; - - // A page token, received from a previous `ListBackups` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListBackups` must match - // the call that provided the page token. - string page_token = 3; - - // Multiple filter queries are separated by spaces. For example, - // 'instance:abc AND type:FINAL, 'location:us', - // 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - // type, instance, backupInterval.startTime (creation time), or location. - string filter = 4; -} - -// The response payload containing a list of the backups. -message ListBackupsResponse { - // A list of backups. - repeated Backup backups = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, then there aren't subsequent pages. - string next_page_token = 2; - - // If a region isn't unavailable or if an unknown error occurs, then a warning - // message is returned. - repeated ApiWarning warnings = 3; -} - -// The request payload to update the backup. -message UpdateBackupRequest { - // Required. The backup to update. - // The backup’s `name` field is used to identify the backup to update. - // Format: projects/{project}/backups/{backup} - Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields that you can update. You can update only the description - // and retention period of the final backup. - google.protobuf.FieldMask update_mask = 2; -} - -// The request payload to delete the backup. -message DeleteBackupRequest { - // Required. The name of the backup to delete. - // Format: projects/{project}/backups/{backup} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } - ]; -} - -// A backup resource. -message Backup { - option (google.api.resource) = { - type: "sqladmin.googleapis.com/Backup" - pattern: "projects/{project}/backups/{backup}" - }; - - // The backup type. - enum SqlBackupType { - // This is an unknown backup type. - SQL_BACKUP_TYPE_UNSPECIFIED = 0; - - // The backup schedule triggers a backup automatically. - AUTOMATED = 1; - - // The user triggers a backup manually. - ON_DEMAND = 2; - - // The backup created when instance is deleted. - FINAL = 3; - } - - // The backup's state - enum SqlBackupState { - // The state of the backup is unknown. - SQL_BACKUP_STATE_UNSPECIFIED = 0; - - // The backup that's added to a queue. - ENQUEUED = 1; - - // The backup is in progress. - RUNNING = 2; - - // The backup failed. - FAILED = 3; - - // The backup is successful. - SUCCESSFUL = 4; - - // The backup is being deleted. - DELETING = 5; - - // Deletion of the backup failed. - DELETION_FAILED = 6; - } - - // Output only. The resource name of the backup. - // Format: projects/{project}/backups/{backup}. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This is always `sql#backup`. - string kind = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The URI of this resource. - string self_link = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of this backup. The type can be "AUTOMATED", - // "ON_DEMAND" or “FINAL”. - SqlBackupType type = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The description of this backup. - string description = 5; - - // The name of the source database instance. - string instance = 6; - - // The storage location of the backups. The location can be multi-regional. - string location = 7; - - // Output only. This output contains the following values: - // start_time: All database writes up to this time are available. - // end_time: Any database writes after this time aren't available. - google.type.Interval backup_interval = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The status of this backup. - SqlBackupState state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Information about why the backup operation fails (for example, - // when the backup state fails). - OperationError error = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This output contains the encryption configuration for a backup - // and the resource name of the KMS key for disk encryption. - string kms_key = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This output contains the encryption status for a backup and - // the version of the KMS key that's used to encrypt the Cloud SQL instance. - string kms_key_version = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. - SqlBackupKind backup_kind = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This output contains a backup time zone. If a Cloud SQL for - // SQL Server instance has a different time zone from the backup's time zone, - // then the restore to the instance doesn't happen. - string time_zone = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - oneof expiration { - // Input only. The time-to-live (TTL) interval for this resource (in days). - // For example: ttlDays:7, means 7 days from the current time. The - // expiration time can't exceed 365 days from the time that the backup is - // created. - int64 ttl_days = 16 [(google.api.field_behavior) = INPUT_ONLY]; - - // Backup expiration time. - // A UTC timestamp of when this backup expired. - google.protobuf.Timestamp expiry_time = 17; - } - - // Output only. The database version of the instance of at the time this - // backup was made. - SqlDatabaseVersion database_version = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The maximum chargeable bytes for the backup. - optional int64 max_chargeable_bytes = 23 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Output only. Timestamp in UTC of when the instance associated - // with this backup is deleted. - google.protobuf.Timestamp instance_deletion_time = 24 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Optional. Output only. The instance setting of the source instance that's - // associated with this backup. - DatabaseInstance instance_settings = 25 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Output only. The mapping to backup run resource used for IAM validations. - string backup_run = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This status indicates whether the backup satisfies PZS. - // - // The status is reserved for future use. - google.protobuf.BoolValue satisfies_pzs = 27 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This status indicates whether the backup satisfies PZI. - // - // The status is reserved for future use. - google.protobuf.BoolValue satisfies_pzi = 28 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_connect.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_connect.proto deleted file mode 100644 index c00419be1536..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_connect.proto +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/sql/v1/cloud_sql_resources.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlConnectProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Cloud SQL connect service. -service SqlConnectService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Retrieves connect settings about a Cloud SQL instance. - rpc GetConnectSettings(GetConnectSettingsRequest) returns (ConnectSettings) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/connectSettings" - }; - } - - // Generates a short-lived X509 certificate containing the provided public key - // and signed by a private key specific to the target instance. Users may use - // the certificate to authenticate as themselves when connecting to the - // database. - rpc GenerateEphemeralCert(GenerateEphemeralCertRequest) - returns (GenerateEphemeralCertResponse) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}:generateEphemeralCert" - body: "*" - }; - } -} - -// Connect settings retrieval request. -message GetConnectSettingsRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Optional. Optional snapshot read timestamp to trade freshness for - // performance. - google.protobuf.Timestamp read_time = 7 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Connect settings retrieval response. -message ConnectSettings { - // Various Certificate Authority (CA) modes for certificate signing. - enum CaMode { - // CA mode is unknown. - CA_MODE_UNSPECIFIED = 0; - - // Google-managed self-signed internal CA. - GOOGLE_MANAGED_INTERNAL_CA = 1; - - // Google-managed regional CA part of root CA hierarchy hosted on Google - // Cloud's Certificate Authority Service (CAS). - GOOGLE_MANAGED_CAS_CA = 2; - - // Customer-managed CA hosted on Google Cloud's Certificate Authority - // Service (CAS). - CUSTOMER_MANAGED_CAS_CA = 3; - } - - // Details of a single read pool node of a read pool. - message ConnectPoolNodeConfig { - // Output only. The name of the read pool node. Doesn't include the project - // ID. - optional string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Mappings containing IP addresses that can be used to connect - // to the read pool node. - repeated IpMapping ip_addresses = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DNS name of the read pool node. - optional string dns_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of DNS names used by this read pool node. - repeated DnsNameMapping dns_names = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // MdxProtocolSupport describes parts of the MDX protocol supported by this - // instance. - enum MdxProtocolSupport { - // Not specified. - MDX_PROTOCOL_SUPPORT_UNSPECIFIED = 0; - - // Client should send the client protocol type in the MDX request. - CLIENT_PROTOCOL_TYPE = 1; - } - - // This is always `sql#connectSettings`. - string kind = 1; - - // SSL configuration. - SslCert server_ca_cert = 2; - - // The assigned IP addresses for the instance. - repeated IpMapping ip_addresses = 3; - - // The cloud region for the instance. For example, `us-central1`, - // `europe-west1`. The region cannot be changed after instance creation. - string region = 4; - - // The database engine type and version. The `databaseVersion` - // field cannot be changed after instance creation. - // MySQL instances: `MYSQL_8_0`, `MYSQL_5_7` (default), - // or `MYSQL_5_6`. - // PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, - // `POSTGRES_11`, `POSTGRES_12` (default), `POSTGRES_13`, or `POSTGRES_14`. - // SQL Server instances: `SQLSERVER_2017_STANDARD` (default), - // `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, - // `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, - // `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or - // `SQLSERVER_2019_WEB`. - SqlDatabaseVersion database_version = 31; - - // `SECOND_GEN`: Cloud SQL database instance. - // `EXTERNAL`: A database server that is not managed by Google. - // This property is read-only; use the `tier` property in the `settings` - // object to determine the database type. - SqlBackendType backend_type = 32; - - // Whether PSC connectivity is enabled for this instance. - bool psc_enabled = 33; - - // The dns name of the instance. - string dns_name = 34; - - // Specify what type of CA is used for the server certificate. - CaMode server_ca_mode = 35; - - // Custom subject alternative names for the server certificate. - repeated string custom_subject_alternative_names = 37; - - // Output only. The list of DNS names used by this instance. - repeated DnsNameMapping dns_names = 38 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The number of read pool nodes in a read pool. - optional int32 node_count = 63; - - // Output only. Entries containing information about each read pool node of - // the read pool. - repeated ConnectPoolNodeConfig nodes = 64 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Output only. mdx_protocol_support controls how the client uses - // metadata exchange when connecting to the instance. The values in the list - // representing parts of the MDX protocol that are supported by this instance. - // When the list is empty, the instance does not support MDX, so the client - // must not send an MDX request. The default is empty. - repeated MdxProtocolSupport mdx_protocol_support = 39 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; -} - -// Ephemeral certificate creation request. -message GenerateEphemeralCertRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // PEM encoded public key to include in the signed certificate. - string public_key = 3 [json_name = "public_key"]; - - // Optional. Access token to include in the signed certificate. - string access_token = 4 - [json_name = "access_token", (google.api.field_behavior) = OPTIONAL]; - - // Optional. Optional snapshot read timestamp to trade freshness for - // performance. - google.protobuf.Timestamp read_time = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set, it will contain the cert valid duration. - google.protobuf.Duration valid_duration = 12 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Ephemeral certificate creation request. -message GenerateEphemeralCertResponse { - // Generated cert - SslCert ephemeral_cert = 1; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_databases.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_databases.proto deleted file mode 100644 index 56e02ed26a9b..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_databases.proto +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/cloud/sql/v1/cloud_sql_resources.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlDatabasesProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service to manage databases. -service SqlDatabasesService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Deletes a database from a Cloud SQL instance. - rpc Delete(SqlDatabasesDeleteRequest) returns (Operation) { - option (google.api.http) = { - delete: "/v1/projects/{project}/instances/{instance}/databases/{database}" - }; - } - - // Retrieves a resource containing information about a database inside a Cloud - // SQL instance. - rpc Get(SqlDatabasesGetRequest) returns (Database) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/databases/{database}" - }; - } - - // Inserts a resource containing information about a database inside a Cloud - // SQL instance. - // - // **Note:** You can't modify the default character set and collation. - rpc Insert(SqlDatabasesInsertRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/databases" - body: "body" - }; - } - - // Lists databases in the specified Cloud SQL instance. - rpc List(SqlDatabasesListRequest) returns (DatabasesListResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/databases" - }; - } - - // Partially updates a resource containing information about a database inside - // a Cloud SQL instance. This method supports patch semantics. - rpc Patch(SqlDatabasesUpdateRequest) returns (Operation) { - option (google.api.http) = { - patch: "/v1/projects/{project}/instances/{instance}/databases/{database}" - body: "body" - }; - } - - // Updates a resource containing information about a database inside a Cloud - // SQL instance. - rpc Update(SqlDatabasesUpdateRequest) returns (Operation) { - option (google.api.http) = { - put: "/v1/projects/{project}/instances/{instance}/databases/{database}" - body: "body" - }; - } -} - -// Database delete request. -message SqlDatabasesDeleteRequest { - // Name of the database to be deleted in the instance. - string database = 1; - - // Database instance ID. This does not include the project ID. - string instance = 2; - - // Project ID of the project that contains the instance. - string project = 3; -} - -// Database get request. -message SqlDatabasesGetRequest { - // Name of the database in the instance. - string database = 1; - - // Database instance ID. This does not include the project ID. - string instance = 2; - - // Project ID of the project that contains the instance. - string project = 3; -} - -// Database insert request. -message SqlDatabasesInsertRequest { - // Database instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - Database body = 100; -} - -// Database list request. -message SqlDatabasesListRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -// Database update request. -message SqlDatabasesUpdateRequest { - // Name of the database to be updated in the instance. - string database = 1; - - // Database instance ID. This does not include the project ID. - string instance = 2; - - // Project ID of the project that contains the instance. - string project = 3; - - Database body = 100; -} - -// Database list response. -message DatabasesListResponse { - // This is always `sql#databasesList`. - string kind = 1; - - // List of database resources in the instance. - repeated Database items = 2; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_events.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_events.proto deleted file mode 100644 index 3d1bb688c30b..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_events.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlEventsProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service that exposes Cloud SQL event information. This -// service is only used internally. -service SqlEventsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto deleted file mode 100644 index d33e44df0c35..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlFeatureEligibilityProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service to verify the eligibility of an instance for a given operation. -service SqlFeatureEligibilityService { - option (google.api.default_host) = "sqladmin.googleapis.com"; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_flags.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_flags.proto deleted file mode 100644 index b7b704399cf1..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_flags.proto +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/sql/v1/cloud_sql_resources.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlFlagsProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service to manage database flags for Cloud SQL instances. -service SqlFlagsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Lists all available database flags for Cloud SQL instances. - rpc List(SqlFlagsListRequest) returns (FlagsListResponse) { - option (google.api.http) = { - get: "/v1/flags" - }; - } -} - -// Flags list request. -message SqlFlagsListRequest { - // Database type and version you want to retrieve flags for. By default, this - // method returns flags for all database types and versions. - string database_version = 1; - - // Optional. Specify the scope of flags to be returned by SqlFlagsListService. - // Return list of database flags if unspecified. - optional SqlFlagScope flag_scope = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Flags list response. -message FlagsListResponse { - // This is always `sql#flagsList`. - string kind = 1; - - // List of flags. - repeated Flag items = 2; -} - -// A flag resource. -message Flag { - // This is the name of the flag. Flag names always use underscores, not - // hyphens, for example: `max_allowed_packet` - string name = 1; - - // The type of the flag. Flags are typed to being `BOOLEAN`, `STRING`, - // `INTEGER` or `NONE`. `NONE` is used for flags that do not take a - // value, such as `skip_grant_tables`. - SqlFlagType type = 2; - - // The database version this flag applies to. Can be - // MySQL instances: `MYSQL_8_0`, `MYSQL_8_0_18`, `MYSQL_8_0_26`, `MYSQL_5_7`, - // or `MYSQL_5_6`. PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, - // `POSTGRES_11` or `POSTGRES_12`. SQL Server instances: - // `SQLSERVER_2017_STANDARD`, `SQLSERVER_2017_ENTERPRISE`, - // `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, - // `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or - // `SQLSERVER_2019_WEB`. - // See [the complete - // list](/sql/docs/mysql/admin-api/rest/v1/SqlDatabaseVersion). - repeated SqlDatabaseVersion applies_to = 3; - - // For `STRING` flags, a list of strings that the value can be set to. - repeated string allowed_string_values = 4; - - // For `INTEGER` flags, the minimum allowed value. - google.protobuf.Int64Value min_value = 5; - - // For `INTEGER` flags, the maximum allowed value. - google.protobuf.Int64Value max_value = 6; - - // Indicates whether changing this flag will trigger a database restart. Only - // applicable to Second Generation instances. - google.protobuf.BoolValue requires_restart = 7; - - // This is always `sql#flag`. - string kind = 8; - - // Whether or not the flag is considered in beta. - google.protobuf.BoolValue in_beta = 9; - - // Use this field if only certain integers are accepted. Can be combined - // with min_value and max_value to add additional values. - repeated int64 allowed_int_values = 10; - - // Scope of flag. - SqlFlagScope flag_scope = 15; - - // Recommended flag value for UI display. - oneof recommended_value { - // Recommended string value in string format for UI display. - string recommended_string_value = 16; - - // Recommended int value in integer format for UI display. - google.protobuf.Int64Value recommended_int_value = 17; - } -} - -enum SqlFlagType { - // This is an unknown flag type. - SQL_FLAG_TYPE_UNSPECIFIED = 0; - - // Boolean type flag. - BOOLEAN = 1; - - // String type flag. - STRING = 2; - - // Integer type flag. - INTEGER = 3; - - // Flag type used for a server startup option. - NONE = 4; - - // Type introduced specially for MySQL TimeZone offset. Accept a string value - // with the format [-12:59, 13:00]. - MYSQL_TIMEZONE_OFFSET = 5; - - // Float type flag. - FLOAT = 6; - - // Comma-separated list of the strings in a SqlFlagType enum. - REPEATED_STRING = 7; -} - -// Scopes of a flag describe where the flag is used. -enum SqlFlagScope { - // Assume database flags if unspecified - SQL_FLAG_SCOPE_UNSPECIFIED = 0; - - // database flags - SQL_FLAG_SCOPE_DATABASE = 1; - - // connection pool configuration flags - SQL_FLAG_SCOPE_CONNECTION_POOL = 2; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto deleted file mode 100644 index 4edbc6317695..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlIamPoliciesProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service for providing IAM Meta APIs for Cloud SQL. -service SqlIamPoliciesService { - option (google.api.default_host) = "sqladmin.googleapis.com"; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instance_names.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instance_names.proto deleted file mode 100644 index cc00b42bda2f..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instance_names.proto +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlInstanceNamesServiceProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Cloud SQL instance names service. -service SqlInstanceNamesService { - option (google.api.default_host) = "sqladmin.googleapis.com"; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto deleted file mode 100644 index b07e2fa0b118..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto +++ /dev/null @@ -1,2530 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/sql/v1/cloud_sql_resources.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/rpc/status.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlServiceProto"; -option java_package = "com.google.cloud.sql.v1"; -option (google.api.resource_definition) = { - type: "backupdr.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; - -service SqlInstancesService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Adds a new trusted Certificate Authority (CA) version for the specified - // instance. Required to prepare for a certificate rotation. If a CA version - // was previously added but never used in a certificate rotation, this - // operation replaces that version. There cannot be more than one CA version - // waiting to be rotated in. For instances that have enabled Certificate - // Authority Service (CAS) based server CA, use AddServerCertificate to add a - // new server certificate. - rpc AddServerCa(SqlInstancesAddServerCaRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/addServerCa" - }; - } - - // Add a new trusted server certificate version for the specified instance - // using Certificate Authority Service (CAS) server CA. Required to prepare - // for a certificate rotation. If a server certificate version was previously - // added but never used in a certificate rotation, this operation replaces - // that version. There cannot be more than one certificate version waiting to - // be rotated in. For instances not using CAS server CA, use AddServerCa - // instead. - rpc AddServerCertificate(SqlInstancesAddServerCertificateRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/addServerCertificate" - }; - } - - // Adds a new Entra ID certificate for the specified instance. If an Entra ID - // certificate was previously added but never used in a certificate rotation, - // this operation replaces that version. - rpc AddEntraIdCertificate(SqlInstancesAddEntraIdCertificateRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/addEntraIdCertificate" - }; - } - - // Creates a Cloud SQL instance as a clone of the source instance. Using this - // operation might cause your instance to restart. - rpc Clone(SqlInstancesCloneRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/clone" - body: "body" - }; - } - - // Deletes a Cloud SQL instance. - rpc Delete(SqlInstancesDeleteRequest) returns (Operation) { - option (google.api.http) = { - delete: "/v1/projects/{project}/instances/{instance}" - }; - } - - // Demotes the stand-alone instance to be a Cloud SQL read replica for an - // external database server. - rpc DemoteMaster(SqlInstancesDemoteMasterRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/demoteMaster" - body: "body" - }; - } - - // Demotes an existing standalone instance to be a Cloud SQL read replica - // for an external database server. - rpc Demote(SqlInstancesDemoteRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/demote" - body: "body" - }; - } - - // Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL - // dump or CSV file. - rpc Export(SqlInstancesExportRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/export" - body: "body" - }; - } - - // Initiates a manual failover of a high availability (HA) primary instance - // to a standby instance, which becomes the primary instance. Users are - // then rerouted to the new primary. For more information, see the - // [Overview of high - // availability](https://cloud.google.com/sql/docs/mysql/high-availability) - // page in the Cloud SQL documentation. - // If using Legacy HA (MySQL only), this causes the instance to failover to - // its failover replica instance. - rpc Failover(SqlInstancesFailoverRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/failover" - body: "body" - }; - } - - // Reencrypt CMEK instance with latest key version. - rpc Reencrypt(SqlInstancesReencryptRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/reencrypt" - body: "body" - }; - } - - // Retrieves a resource containing information about a Cloud SQL instance. - rpc Get(SqlInstancesGetRequest) returns (DatabaseInstance) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}" - }; - } - - // Imports data into a Cloud SQL instance from a SQL dump or CSV file in - // Cloud Storage. - rpc Import(SqlInstancesImportRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/import" - body: "body" - }; - } - - // Creates a new Cloud SQL instance. - rpc Insert(SqlInstancesInsertRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances" - body: "body" - }; - } - - // Lists instances under a given project. - rpc List(SqlInstancesListRequest) returns (InstancesListResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances" - }; - } - - // Lists all of the trusted Certificate Authorities (CAs) for the specified - // instance. There can be up to three CAs listed: the CA that was used to sign - // the certificate that is currently in use, a CA that has been added but not - // yet used to sign a certificate, and a CA used to sign a certificate that - // has previously rotated out. - rpc ListServerCas(SqlInstancesListServerCasRequest) - returns (InstancesListServerCasResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/listServerCas" - }; - } - - // Lists all versions of server certificates and certificate authorities (CAs) - // for the specified instance. There can be up to three sets of certs listed: - // the certificate that is currently in use, a future that has been added but - // not yet used to sign a certificate, and a certificate that has been rotated - // out. For instances not using Certificate Authority Service (CAS) server CA, - // use ListServerCas instead. - rpc ListServerCertificates(SqlInstancesListServerCertificatesRequest) - returns (InstancesListServerCertificatesResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/listServerCertificates" - }; - } - - // Lists all versions of EntraID certificates for the specified instance. - // There can be up to three sets of certificates listed: the certificate that - // is currently in use, a future that has been added but not yet used to sign - // a certificate, and a certificate that has been rotated out. - rpc ListEntraIdCertificates(SqlInstancesListEntraIdCertificatesRequest) - returns (InstancesListEntraIdCertificatesResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/listEntraIdCertificates" - }; - } - - // Partially updates settings of a Cloud SQL instance by merging the request - // with the current configuration. This method supports patch semantics. - rpc Patch(SqlInstancesPatchRequest) returns (Operation) { - option (google.api.http) = { - patch: "/v1/projects/{project}/instances/{instance}" - body: "body" - }; - } - - // Promotes the read replica instance to be an independent Cloud SQL - // primary instance. - // Using this operation might cause your instance to restart. - rpc PromoteReplica(SqlInstancesPromoteReplicaRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/promoteReplica" - }; - } - - // Switches over from the primary instance to the DR replica - // instance. - rpc Switchover(SqlInstancesSwitchoverRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/switchover" - }; - } - - // Deletes all client certificates and generates a new server SSL certificate - // for the instance. - rpc ResetSslConfig(SqlInstancesResetSslConfigRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/resetSslConfig" - }; - } - - // Restarts a Cloud SQL instance. - rpc Restart(SqlInstancesRestartRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/restart" - }; - } - - // Restores a backup of a Cloud SQL instance. Using this operation might cause - // your instance to restart. - rpc RestoreBackup(SqlInstancesRestoreBackupRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/restoreBackup" - body: "body" - }; - } - - // Rotates the server certificate to one signed by the Certificate Authority - // (CA) version previously added with the addServerCA method. For instances - // that have enabled Certificate Authority Service (CAS) based server CA, - // use RotateServerCertificate to rotate the server certificate. - rpc RotateServerCa(SqlInstancesRotateServerCaRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/rotateServerCa" - body: "body" - }; - } - - // Rotates the server certificate version to one previously added with the - // addServerCertificate method. For instances not using Certificate Authority - // Service (CAS) server CA, use RotateServerCa instead. - rpc RotateServerCertificate(SqlInstancesRotateServerCertificateRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/rotateServerCertificate" - body: "body" - }; - } - - // Rotates the server certificate version to one previously added with the - // addEntraIdCertificate method. - rpc RotateEntraIdCertificate(SqlInstancesRotateEntraIdCertificateRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/rotateEntraIdCertificate" - body: "body" - }; - } - - // Starts the replication in the read replica instance. - rpc StartReplica(SqlInstancesStartReplicaRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/startReplica" - }; - } - - // Stops the replication in the read replica instance. - rpc StopReplica(SqlInstancesStopReplicaRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/stopReplica" - }; - } - - // Truncate MySQL general and slow query log tables - // MySQL only. - rpc TruncateLog(SqlInstancesTruncateLogRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/truncateLog" - body: "body" - }; - } - - // Updates settings of a Cloud SQL instance. Using this operation might cause - // your instance to restart. - rpc Update(SqlInstancesUpdateRequest) returns (Operation) { - option (google.api.http) = { - put: "/v1/projects/{project}/instances/{instance}" - body: "body" - }; - } - - // Generates a short-lived X509 certificate containing the provided public key - // and signed by a private key specific to the target instance. Users may use - // the certificate to authenticate as themselves when connecting to the - // database. - rpc CreateEphemeral(SqlInstancesCreateEphemeralCertRequest) - returns (SslCert) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/createEphemeral" - body: "body" - }; - } - - // Reschedules the maintenance on the given instance. - rpc RescheduleMaintenance(SqlInstancesRescheduleMaintenanceRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/rescheduleMaintenance" - body: "body" - }; - } - - // Verify External primary instance external sync settings. - rpc VerifyExternalSyncSettings(SqlInstancesVerifyExternalSyncSettingsRequest) - returns (SqlInstancesVerifyExternalSyncSettingsResponse) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/verifyExternalSyncSettings" - body: "*" - }; - } - - // Start External primary instance migration. - rpc StartExternalSync(SqlInstancesStartExternalSyncRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/startExternalSync" - body: "*" - }; - } - - // Perform Disk Shrink on primary instance. - rpc PerformDiskShrink(SqlInstancesPerformDiskShrinkRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/performDiskShrink" - body: "body" - }; - } - - // Get Disk Shrink Config for a given instance. - rpc GetDiskShrinkConfig(SqlInstancesGetDiskShrinkConfigRequest) - returns (SqlInstancesGetDiskShrinkConfigResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/getDiskShrinkConfig" - }; - } - - // Reset Replica Size to primary instance disk size. - rpc ResetReplicaSize(SqlInstancesResetReplicaSizeRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/resetReplicaSize" - body: "*" - }; - } - - // Get Latest Recovery Time for a given instance. - rpc GetLatestRecoveryTime(SqlInstancesGetLatestRecoveryTimeRequest) - returns (SqlInstancesGetLatestRecoveryTimeResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/getLatestRecoveryTime" - }; - } - - // Execute SQL statements. - rpc ExecuteSql(SqlInstancesExecuteSqlRequest) - returns (SqlInstancesExecuteSqlResponse) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/executeSql" - body: "body" - }; - } - - // Acquire a lease for the setup of SQL Server Reporting Services (SSRS). - rpc AcquireSsrsLease(SqlInstancesAcquireSsrsLeaseRequest) - returns (SqlInstancesAcquireSsrsLeaseResponse) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/acquireSsrsLease" - body: "body" - }; - } - - // Release a lease for the setup of SQL Server Reporting Services (SSRS). - rpc ReleaseSsrsLease(SqlInstancesReleaseSsrsLeaseRequest) - returns (SqlInstancesReleaseSsrsLeaseResponse) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/releaseSsrsLease" - }; - } - - // Execute MVU Pre-checks - rpc PreCheckMajorVersionUpgrade( - SqlInstancesPreCheckMajorVersionUpgradeRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade" - body: "body" - }; - } - - // Point in time restore for an instance managed by Google Cloud Backup and - // Disaster Recovery. - rpc PointInTimeRestore(SqlInstancesPointInTimeRestoreRequest) - returns (Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}:pointInTimeRestore" - body: "context" - }; - } -} - -// Instance add server CA request. -message SqlInstancesAddServerCaRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -// Instance add server certificate request. -message SqlInstancesAddServerCertificateRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -// Instance add Entra ID certificate request. -message SqlInstancesAddEntraIdCertificateRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Instance clone request. -message SqlInstancesCloneRequest { - // Required. The ID of the Cloud SQL instance to be cloned (source). This does - // not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the source Cloud SQL instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - InstancesCloneRequest body = 100 [(google.api.field_behavior) = REQUIRED]; -} - -// Instance delete request. -message SqlInstancesDeleteRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance to be deleted. - string project = 2; - - // Flag to opt-in for final backup. By default, it is turned off. - optional bool enable_final_backup = 7; - - oneof expiration { - // Optional. Retention period of the final backup. - int64 final_backup_ttl_days = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Final Backup expiration time. - // Timestamp in UTC of when this resource is considered expired. - google.protobuf.Timestamp final_backup_expiry_time = 6 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The description of the final backup. - string final_backup_description = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance demote master request. -message SqlInstancesDemoteMasterRequest { - // Cloud SQL instance name. - string instance = 1; - - // ID of the project that contains the instance. - string project = 2; - - InstancesDemoteMasterRequest body = 100; -} - -// Instance demote request. -message SqlInstancesDemoteRequest { - // Required. Cloud SQL instance name. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The request body. - InstancesDemoteRequest body = 100 [(google.api.field_behavior) = REQUIRED]; -} - -// Instance export request. -message SqlInstancesExportRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance to be exported. - string project = 2; - - InstancesExportRequest body = 100; -} - -// Instance failover request. -message SqlInstancesFailoverRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // ID of the project that contains the read replica. - string project = 2; - - InstancesFailoverRequest body = 100; -} - -// Instance get request. -message SqlInstancesGetRequest { - // Required. Database instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Instance import request. -message SqlInstancesImportRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - InstancesImportRequest body = 100; -} - -// Instance insert request. -message SqlInstancesInsertRequest { - // Project ID of the project to which the newly created Cloud SQL instances - // should belong. - string project = 1; - - DatabaseInstance body = 100; -} - -// Instance list request. -message SqlInstancesListRequest { - // A filter expression that filters resources listed in the response. - // The expression is in the form of field:value. For example, - // 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per - // their JSON representation, such as 'settings.userLabels.auto_start:true'. - // - // Multiple filter queries are space-separated. For example. - // 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each - // expression is an AND expression. However, you can include AND and OR - // expressions explicitly. - string filter = 1; - - // The maximum number of instances to return. The service may return fewer - // than this value. - // If unspecified, at most 500 instances are returned. - // The maximum value is 1000; values above 1000 are coerced to 1000. - uint32 max_results = 2; - - // A previously-returned page token representing part of the larger set of - // results to view. - string page_token = 3; - - // Project ID of the project for which to list Cloud SQL instances. - string project = 4; -} - -// Instance list server CAs request. -message SqlInstancesListServerCasRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -// Instance list server certificates request. -message SqlInstancesListServerCertificatesRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Instance list Entra ID certificates request. -message SqlInstancesListEntraIdCertificatesRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Instance patch request. -message SqlInstancesPatchRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - DatabaseInstance body = 100; -} - -// Instance promote replica request. -message SqlInstancesPromoteReplicaRequest { - // Cloud SQL read replica instance name. - string instance = 1; - - // ID of the project that contains the read replica. - string project = 2; - - // Set to true to invoke a replica failover to the DR - // replica. As part of replica failover, the promote operation attempts - // to add the original primary instance as a replica of the promoted - // DR replica when the original primary instance comes back online. - // If set to false or not specified, then the original primary - // instance becomes an independent Cloud SQL primary instance. - bool failover = 3; -} - -// Instance switchover request. -message SqlInstancesSwitchoverRequest { - // Cloud SQL read replica instance name. - string instance = 1; - - // ID of the project that contains the replica. - string project = 2; - - // Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations - // timeout, which is a sum of all database operations. Default value is 10 - // minutes and can be modified to a maximum value of 24 hours. - google.protobuf.Duration db_timeout = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance reset SSL config request. -message SqlInstancesResetSslConfigRequest { - // Reset SSL mode to selectively refresh the SSL materials. - enum ResetSslMode { - // Reset SSL mode is not specified. - RESET_SSL_MODE_UNSPECIFIED = 0; - - // Refresh all TLS configs. This is the default behaviour. - ALL = 1; - - // Refreshes the replication-related TLS configuration settings provided by - // the primary instance. - // Not applicable to on-premises replication instances. - SYNC_FROM_PRIMARY = 2; - } - - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Optional. Reset SSL mode to use. - ResetSslMode mode = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance restart request. -message SqlInstancesRestartRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance to be restarted. - string project = 2; -} - -// Instance restore backup request. -message SqlInstancesRestoreBackupRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - InstancesRestoreBackupRequest body = 100; -} - -// Instance rotate server CA request. -message SqlInstancesRotateServerCaRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - InstancesRotateServerCaRequest body = 100; -} - -// Instance rotate server certificate request. -message SqlInstancesRotateServerCertificateRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Rotate server certificate request body. - InstancesRotateServerCertificateRequest body = 100 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance rotate server certificate request. -message SqlInstancesRotateEntraIdCertificateRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Rotate Entra ID certificate request body. - InstancesRotateEntraIdCertificateRequest body = 100 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance start replica request. -message SqlInstancesStartReplicaRequest { - // Cloud SQL read replica instance name. - string instance = 1; - - // ID of the project that contains the read replica. - string project = 2; -} - -// Instance stop replica request. -message SqlInstancesStopReplicaRequest { - // Cloud SQL read replica instance name. - string instance = 1; - - // ID of the project that contains the read replica. - string project = 2; -} - -// Instance truncate log request. -message SqlInstancesTruncateLogRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the Cloud SQL project. - string project = 2; - - InstancesTruncateLogRequest body = 100; -} - -// Instance perform disk shrink request. -message SqlInstancesPerformDiskShrinkRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Perform disk shrink context. - PerformDiskShrinkContext body = 100; -} - -// Instance update request. -message SqlInstancesUpdateRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - DatabaseInstance body = 100; -} - -// Instance reschedule maintenance request. -message SqlInstancesRescheduleMaintenanceRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // ID of the project that contains the instance. - string project = 2; - - SqlInstancesRescheduleMaintenanceRequestBody body = 100; -} - -// Instance reencrypt request. -message SqlInstancesReencryptRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // ID of the project that contains the instance. - string project = 2; - - // Reencrypt body that users request - InstancesReencryptRequest body = 3; -} - -// Database Instance reencrypt request. -message InstancesReencryptRequest { - // Configuration specific to backup re-encryption - optional BackupReencryptionConfig backup_reencryption_config = 1; -} - -// Backup Reencryption Config -message BackupReencryptionConfig { - // Backup type for re-encryption - enum BackupType { - // Unknown backup type, will be defaulted to AUTOMATIC backup type - BACKUP_TYPE_UNSPECIFIED = 0; - - // Reencrypt automatic backups - AUTOMATED = 1; - - // Reencrypt on-demand backups - ON_DEMAND = 2; - } - - // Backup re-encryption limit - optional int32 backup_limit = 1; - - // Type of backups users want to re-encrypt. - optional BackupType backup_type = 2; -} - -// External Sync parallel level. -enum ExternalSyncParallelLevel { - // Unknown sync parallel level. Will be defaulted to OPTIMAL. - EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED = 0; - - // Minimal parallel level. - MIN = 1; - - // Optimal parallel level. - OPTIMAL = 2; - - // Maximum parallel level. - MAX = 3; -} - -// The selected object that Cloud SQL migrates. -message ExternalSyncSelectedObject { - // The name of the database that Cloud SQL migrates. - string database = 1; -} - -// Instance get disk shrink config request. -message SqlInstancesGetDiskShrinkConfigRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -// Instance verify external sync settings request. -message SqlInstancesVerifyExternalSyncSettingsRequest { - enum ExternalSyncMode { - // Unknown external sync mode, will be defaulted to ONLINE mode - EXTERNAL_SYNC_MODE_UNSPECIFIED = 0; - - // Online external sync will set up replication after initial data external - // sync - ONLINE = 1; - - // Offline external sync only dumps and loads a one-time snapshot of - // the primary instance's data - OFFLINE = 2; - } - - // MigrationType determines whether the migration is a physical file-based - // migration or a logical dump file-based migration. - enum MigrationType { - // Default value is a logical dump file-based migration - MIGRATION_TYPE_UNSPECIFIED = 0; - - // Logical dump file-based migration - LOGICAL = 1; - - // Physical file-based migration - PHYSICAL = 2; - } - - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Flag to enable verifying connection only - bool verify_connection_only = 3; - - // External sync mode - ExternalSyncMode sync_mode = 4; - - // Optional. Flag to verify settings required by replication setup only - bool verify_replication_only = 5 [(google.api.field_behavior) = OPTIONAL]; - - oneof sync_config { - // Optional. MySQL-specific settings for start external sync. - MySqlSyncConfig mysql_sync_config = 6 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. MigrationType configures the migration to use physical files or - // logical dump files. If not set, then the logical dump file configuration is - // used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - MigrationType migration_type = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Parallel level for initial data sync. Only applicable for - // PostgreSQL. - ExternalSyncParallelLevel sync_parallel_level = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Migrate only the specified objects from the source instance. If - // this field is empty, then migrate all objects. - repeated ExternalSyncSelectedObject selected_objects = 9 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance start external sync request. -message SqlInstancesStartExternalSyncRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // ID of the project that contains the instance. - string project = 2; - - // External sync mode. - SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode sync_mode = 3; - - // Whether to skip the verification step (VESS). - bool skip_verification = 4; - - oneof sync_config { - // MySQL-specific settings for start external sync. - MySqlSyncConfig mysql_sync_config = 6; - } - - // Optional. Parallel level for initial data sync. Currently only applicable - // for MySQL. - ExternalSyncParallelLevel sync_parallel_level = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. MigrationType configures the migration to use physical files or - // logical dump files. If not set, then the logical dump file configuration is - // used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType migration_type = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. MySQL only. True if end-user has confirmed that this SES call - // will wipe replica databases overlapping with the proposed selected_objects. - // If this field is not set and there are both overlapping and additional - // databases proposed, an error will be returned. - bool replica_overwrite_enabled = 9 [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance reset replica size request. -message SqlInstancesResetReplicaSizeRequest { - // Cloud SQL read replica instance name. - string instance = 1; - - // ID of the project that contains the read replica. - string project = 2; -} - -// Instance create ephemeral certificate request. -message SqlInstancesCreateEphemeralCertRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the Cloud SQL project. - string project = 2; - - SslCertsCreateEphemeralRequest body = 100; -} - -// Database instance clone request. -message InstancesCloneRequest { - // Required. Contains details about the clone operation. - CloneContext clone_context = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Database demote primary instance request. -message InstancesDemoteMasterRequest { - // Contains details about the demoteMaster operation. - DemoteMasterContext demote_master_context = 1; -} - -// This request is used to demote an existing standalone instance to be a -// Cloud SQL read replica for an external database server. -message InstancesDemoteRequest { - // Required. Contains details about the demote operation. - DemoteContext demote_context = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Database instance export request. -message InstancesExportRequest { - // Contains details about the export operation. - ExportContext export_context = 1; -} - -// Instance failover request. -message InstancesFailoverRequest { - // Failover Context. - FailoverContext failover_context = 1; -} - -// SslCerts create ephemeral certificate request. -message SslCertsCreateEphemeralRequest { - // PEM encoded public key to include in the signed certificate. - string public_key = 1 [json_name = "public_key"]; - - // Access token to include in the signed certificate. - string access_token = 2 [json_name = "access_token"]; -} - -// Database instance import request. -message InstancesImportRequest { - // Contains details about the import operation. - ImportContext import_context = 1; -} - -// Request for Pre-checks for MVU -message InstancesPreCheckMajorVersionUpgradeRequest { - // Required. Contains details about the pre-check major version upgrade - // operation. - PreCheckMajorVersionUpgradeContext pre_check_major_version_upgrade_context = 1 - [(google.api.field_behavior) = REQUIRED]; -} - -// Database instances list response. -message InstancesListResponse { - // This is always `sql#instancesList`. - string kind = 1; - - // List of warnings that occurred while handling the request. - repeated ApiWarning warnings = 2; - - // List of database instance resources. - repeated DatabaseInstance items = 3; - - // The continuation token, used to page through large result sets. Provide - // this value in a subsequent request to return the next page of results. - string next_page_token = 4; -} - -// Instances ListServerCas response. -message InstancesListServerCasResponse { - // List of server CA certificates for the instance. - repeated SslCert certs = 1; - - string active_version = 2; - - // This is always `sql#instancesListServerCas`. - string kind = 3; -} - -// Instances ListServerCertificates response. -message InstancesListServerCertificatesResponse { - // List of server CA certificates for the instance. - repeated SslCert ca_certs = 1; - - // List of server certificates for the instance, signed by the corresponding - // CA from the `ca_certs` list. - repeated SslCert server_certs = 2; - - // The `sha1_fingerprint` of the active certificate from `server_certs`. - string active_version = 3; - - // This is always `sql#instancesListServerCertificates`. - string kind = 4; -} - -// Instances ListEntraIdCertificates response. -message InstancesListEntraIdCertificatesResponse { - // List of Entra ID certificates for the instance. - repeated SslCert certs = 1; - - // The `sha1_fingerprint` of the active certificate from `certs`. - string active_version = 2; - - // This is always `sql#instancesListEntraIdCertificates`. - string kind = 3; -} - -// Database instance restore backup request. -message InstancesRestoreBackupRequest { - // Parameters required to perform the restore backup operation. - RestoreBackupContext restore_backup_context = 1; - - // The name of the backup that's used to restore a Cloud SQL instance: - // Format: projects/{project-id}/backups/{backup-uid}. Only one of - // restore_backup_context, backup, backupdr_backup can be passed to the input. - string backup = 2 [ - (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } - ]; - - // The name of the backup that's used to restore a Cloud SQL instance: - // Format: - // "projects/{project-id}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup-uid}". - // Only one of restore_backup_context, backup, backupdr_backup can be - // passed to the input. - string backupdr_backup = 4 [ - (google.api.resource_reference) = { type: "backupdr.googleapis.com/Backup" } - ]; - - // Optional. By using this parameter, Cloud SQL overrides any instance - // settings stored in the backup you are restoring from. You can't change the - // instance's major database version and you can only increase the disk size. - // You can use this field to restore new instances only. This field is not - // applicable for restore to existing instances. - DatabaseInstance restore_instance_settings = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This field has the same purpose as restore_instance_settings, - // changes any instance settings stored in the backup you are restoring from. - // With the difference that these fields are cleared in the settings. - repeated string restore_instance_clear_overrides_field_names = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Rotate server CA request. -message InstancesRotateServerCaRequest { - // Contains details about the rotate server CA operation. - RotateServerCaContext rotate_server_ca_context = 1; -} - -// Rotate server certificate request. -message InstancesRotateServerCertificateRequest { - // Optional. Contains details about the rotate server certificate operation. - RotateServerCertificateContext rotate_server_certificate_context = 1 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Rotate Entra ID certificate request. -message InstancesRotateEntraIdCertificateRequest { - // Optional. Contains details about the rotate server certificate operation. - RotateEntraIdCertificateContext rotate_entra_id_certificate_context = 1 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance truncate log request. -message InstancesTruncateLogRequest { - // Contains details about the truncate log operation. - TruncateLogContext truncate_log_context = 1; -} - -// Request to acquire a lease for SSRS. -message InstancesAcquireSsrsLeaseRequest { - // Contains details about the acquire SSRS lease operation. - AcquireSsrsLeaseContext acquire_ssrs_lease_context = 1; -} - -// Request for Pre-checks for MVU -message SqlInstancesPreCheckMajorVersionUpgradeRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The context for request to perform the pre-check major version - // upgrade operation. - InstancesPreCheckMajorVersionUpgradeRequest body = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// Instance verify external sync settings response. -message SqlInstancesVerifyExternalSyncSettingsResponse { - // This is always `sql#migrationSettingErrorList`. - string kind = 1; - - // List of migration violations. - repeated SqlExternalSyncSettingError errors = 2; - - // List of migration warnings. - repeated SqlExternalSyncSettingError warnings = 3; -} - -// Instance get disk shrink config response. -message SqlInstancesGetDiskShrinkConfigResponse { - // This is always `sql#getDiskShrinkConfig`. - string kind = 1; - - // The minimum size to which a disk can be shrunk in GigaBytes. - int64 minimal_target_size_gb = 2; - - // Additional message to customers. - string message = 3; -} - -// Instance get latest recovery time request. -message SqlInstancesGetLatestRecoveryTimeRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // The timestamp used to identify the time when the source instance is - // deleted. If this instance is deleted, then you must set the timestamp. - optional google.protobuf.Timestamp source_instance_deletion_time = 3; -} - -// Instance get latest recovery time response. -message SqlInstancesGetLatestRecoveryTimeResponse { - // This is always `sql#getLatestRecoveryTime`. - string kind = 1; - - // Timestamp, identifies the latest recovery time of the source instance. - google.protobuf.Timestamp latest_recovery_time = 2; - - // Timestamp, identifies the earliest recovery time of the source instance. - google.protobuf.Timestamp earliest_recovery_time = 3; -} - -// Database instance clone context. -message CloneContext { - // This is always `sql#cloneContext`. - string kind = 1; - - // Reserved for future use. - int64 pitr_timestamp_ms = 2; - - // Required. Name of the Cloud SQL instance to be created as a clone. - string destination_instance_name = 3 [(google.api.field_behavior) = REQUIRED]; - - // Binary log coordinates, if specified, identify the position up to which the - // source instance is cloned. If not specified, the source instance is - // cloned up to the most recent binary log coordinates. - BinLogCoordinates bin_log_coordinates = 4; - - // Timestamp, if specified, identifies the time to which the source instance - // is cloned. - google.protobuf.Timestamp point_in_time = 5; - - // The name of the allocated ip range for the private ip Cloud SQL instance. - // For example: "google-managed-services-default". If set, the cloned instance - // ip will be created in the allocated range. The range name must comply with - // [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name - // must be 1-63 characters long and match the regular expression - // [a-z]([-a-z0-9]*[a-z0-9])?. - // Reserved for future use. - string allocated_ip_range = 6; - - // (SQL Server only) Clone only the specified databases from the source - // instance. Clone all databases if empty. - repeated string database_names = 9; - - // Optional. Copy clone and point-in-time recovery clone of an instance to the - // specified zone. If no zone is specified, clone to the same primary zone as - // the source instance. This field applies to all DB types. - optional string preferred_zone = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Copy clone and point-in-time recovery clone of a regional - // instance in the specified zones. If not specified, clone to the same - // secondary zone as the source instance. This value cannot be the same as the - // preferred_zone field. This field applies to all DB types. - optional string preferred_secondary_zone = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // The timestamp used to identify the time when the source instance is - // deleted. If this instance is deleted, then you must set the timestamp. - optional google.protobuf.Timestamp source_instance_deletion_time = 12; - - // Optional. The project ID of the destination project where the cloned - // instance will be created. To perform a cross-project clone, this field is - // required. If not specified, the clone is created in the same project - // as the source instance. - optional string destination_project = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The fully qualified URI of the VPC network to which the cloned - // instance will be connected via Private Services Access for private IP. For - // example:`projects/my-network-project/global/networks/my-network`. This - // field is only required for cross-project cloning. - optional string destination_network = 14 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; -} - -// The context to perform a point-in-time recovery of an instance managed by -// Backup and Disaster Recovery (DR) Service. -message PointInTimeRestoreContext { - // The Backup and Disaster Recovery (DR) Service Datasource URI. - // Format: - // projects/{project}/locations/{region}/backupVaults/{backupvault}/dataSources/{datasource}. - optional string datasource = 1; - - // Required. The date and time to which you want to restore the instance. - google.protobuf.Timestamp point_in_time = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Target instance name. - optional string target_instance = 3; - - // Optional. The resource link for the VPC network from which the Cloud SQL - // instance is accessible for private IP. For example, - // `/projects/myProject/global/networks/default`. - optional string private_network = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the allocated IP range for the internal IP Cloud SQL - // instance. For example: "google-managed-services-default". If you set this, - // then Cloud SQL creates the IP address for the cloned instance in the - // allocated range. This range must comply with [RFC - // 1035](https://tools.ietf.org/html/rfc1035) standards. Specifically, the - // name must be 1-63 characters long and match the regular expression - // [a-z]([-a-z0-9]*[a-z0-9])?. Reserved for future use. - optional string allocated_ip_range = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Point-in-time recovery of an instance to the specified zone. If - // no zone is specified, then clone to the same primary zone as the source - // instance. - optional string preferred_zone = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Point-in-time recovery of a regional instance in the specified - // zones. If not specified, clone to the same secondary zone as the source - // instance. This value cannot be the same as the preferred_zone field. - optional string preferred_secondary_zone = 9 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the instance settings that will be overridden from the - // source instance. This field is only applicable for cross project PITRs. - DatabaseInstance target_instance_settings = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the instance settings that will be cleared from the - // source instance. This field is only applicable for cross project PITRs. - repeated string target_instance_clear_settings_field_names = 12 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The region of the target instance where the datasource will be - // restored. For example: "us-central1". - optional string region = 13 [(google.api.field_behavior) = OPTIONAL]; -} - -// Binary log coordinates. -message BinLogCoordinates { - // Name of the binary log file for a Cloud SQL instance. - string bin_log_file_name = 1; - - // Position (offset) within the binary log file. - int64 bin_log_position = 2; - - // This is always `sql#binLogCoordinates`. - string kind = 3; -} - -// A Cloud SQL instance resource. -message DatabaseInstance { - // The current serving state of the database instance. - enum SqlInstanceState { - // The state of the instance is unknown. - SQL_INSTANCE_STATE_UNSPECIFIED = 0; - - // The instance is running, or has been stopped by owner. - RUNNABLE = 1; - - // The instance is not available, for example due to problems with billing. - SUSPENDED = 2; - - // The instance is being deleted. - PENDING_DELETE = 3; - - // The instance is being created. - PENDING_CREATE = 4; - - // The instance is down for maintenance. - MAINTENANCE = 5; - - // The creation of the instance failed or a fatal error occurred during - // maintenance. - FAILED = 6; - - // Deprecated - ONLINE_MAINTENANCE = 7 [deprecated = true]; - - // (Applicable to read pool nodes only.) The read pool node needs to be - // repaired. The database might be unavailable. - REPAIRING = 8; - } - - message SqlFailoverReplica { - // The name of the failover replica. If specified at instance creation, a - // failover replica is created for the instance. The name - // doesn't include the project ID. - string name = 1; - - // The availability status of the failover replica. A false status indicates - // that the failover replica is out of sync. The primary instance can only - // failover to the failover replica when the status is true. - google.protobuf.BoolValue available = 2; - } - - // Any scheduled maintenance for this instance. - message SqlScheduledMaintenance { - // The start time of any upcoming scheduled maintenance for this instance. - google.protobuf.Timestamp start_time = 1; - - bool can_defer = 2 [deprecated = true]; - - // If the scheduled maintenance can be rescheduled. - bool can_reschedule = 3; - - // Maintenance cannot be rescheduled to start beyond this deadline. - optional google.protobuf.Timestamp schedule_deadline_time = 4; - } - - // This message wraps up the information written by out-of-disk detection job. - message SqlOutOfDiskReport { - // This enum lists all possible states regarding out-of-disk issues. - enum SqlOutOfDiskState { - // Unspecified state - SQL_OUT_OF_DISK_STATE_UNSPECIFIED = 0; - - // The instance has plenty space on data disk - NORMAL = 1; - - // Data disk is almost used up. It is shutdown to prevent data - // corruption. - SOFT_SHUTDOWN = 2; - } - - // This field represents the state generated by the proactive database - // wellness job for OutOfDisk issues. - // * Writers: - // * the proactive database wellness job for OOD. - // * Readers: - // * the proactive database wellness job - optional SqlOutOfDiskState sql_out_of_disk_state = 1; - - // The minimum recommended increase size in GigaBytes - // This field is consumed by the frontend - // * Writers: - // * the proactive database wellness job for OOD. - // * Readers: - optional int32 sql_min_recommended_increase_size_gb = 2; - } - - // The SQL network architecture for the instance. - enum SqlNetworkArchitecture { - SQL_NETWORK_ARCHITECTURE_UNSPECIFIED = 0; - - // The instance uses the new network architecture. - NEW_NETWORK_ARCHITECTURE = 1; - - // The instance uses the old network architecture. - OLD_NETWORK_ARCHITECTURE = 2; - } - - // Details of a single read pool node of a read pool. - message PoolNodeConfig { - // Output only. The name of the read pool node, to be used for retrieving - // metrics and logs. - optional string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The zone of the read pool node. - optional string gce_zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Mappings containing IP addresses that can be used to connect - // to the read pool node. - repeated IpMapping ip_addresses = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DNS name of the read pool node. - optional string dns_name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the read pool node. - optional SqlInstanceState state = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of DNS names used by this read pool node. - repeated DnsNameMapping dns_names = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Private Service Connect (PSC) service attachment of the - // read pool node. - optional string psc_service_attachment_link = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of settings for requested automatically-setup - // Private Service Connect (PSC) consumer endpoints that can be used to - // connect to this read pool node. - repeated PscAutoConnectionConfig psc_auto_connections = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // This is always `sql#instance`. - string kind = 1; - - // The current serving state of the Cloud SQL instance. - SqlInstanceState state = 2; - - // The database engine type and version. The `databaseVersion` field cannot - // be changed after instance creation. - SqlDatabaseVersion database_version = 3; - - // The user settings. - Settings settings = 4; - - // This field is deprecated and will be removed from a future version of the - // API. Use the `settings.settingsVersion` field instead. - string etag = 5; - - // The name and status of the failover replica. - SqlFailoverReplica failover_replica = 6; - - // The name of the instance which will act as primary in the replication - // setup. - string master_instance_name = 7; - - // The replicas of the instance. - repeated string replica_names = 8; - - // The maximum disk size of the instance in bytes. - google.protobuf.Int64Value max_disk_size = 9 [deprecated = true]; - - // The current disk usage of the instance in bytes. This property has been - // deprecated. Use the - // "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud - // Monitoring API instead. Please see [this - // announcement](https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ) - // for details. - google.protobuf.Int64Value current_disk_size = 10 [deprecated = true]; - - // The assigned IP addresses for the instance. - repeated IpMapping ip_addresses = 11; - - // SSL configuration. - SslCert server_ca_cert = 12; - - // The instance type. - SqlInstanceType instance_type = 13; - - // The project ID of the project containing the Cloud SQL instance. The Google - // apps domain is prefixed if applicable. - string project = 14; - - // The IPv6 address assigned to the instance. - // (Deprecated) This property was applicable only - // to First Generation instances. - string ipv6_address = 15 [deprecated = true]; - - // The service account email address assigned to the instance.\This - // property is read-only. - string service_account_email_address = 16; - - // Configuration specific to on-premises instances. - OnPremisesConfiguration on_premises_configuration = 17; - - // Configuration specific to failover replicas and read replicas. - ReplicaConfiguration replica_configuration = 18; - - // The backend type. - // `SECOND_GEN`: Cloud SQL database instance. - // `EXTERNAL`: A database server that is not managed by Google. - // - // This property is read-only; use the `tier` property in the `settings` - // object to determine the database type. - SqlBackendType backend_type = 19; - - // The URI of this resource. - string self_link = 20; - - // If the instance state is SUSPENDED, the reason for the suspension. - repeated SqlSuspensionReason suspension_reason = 21; - - // Connection name of the Cloud SQL instance used in connection strings. - string connection_name = 22; - - // Name of the Cloud SQL instance. This does not include the project ID. - string name = 23; - - // The geographical region of the Cloud SQL instance. - // - // It can be one of the - // [regions](https://cloud.google.com/sql/docs/mysql/locations#location-r) - // where Cloud SQL operates: - // - // For example, `asia-east1`, `europe-west1`, and `us-central1`. - // The default value is `us-central1`. - string region = 24; - - // The Compute Engine zone that the instance is currently serving from. This - // value could be different from the zone that was specified when the instance - // was created if the instance has failed over to its secondary zone. WARNING: - // Changing this might restart the instance. - string gce_zone = 25; - - // The Compute Engine zone that the failover instance is currently serving - // from for a regional instance. This value could be different - // from the zone that was specified when the instance - // was created if the instance has failed over to its secondary/failover zone. - string secondary_gce_zone = 34; - - // Disk encryption configuration specific to an instance. - DiskEncryptionConfiguration disk_encryption_configuration = 26; - - // Disk encryption status specific to an instance. - DiskEncryptionStatus disk_encryption_status = 27; - - // Initial root password. Use only on creation. You must set root passwords - // before you can connect to PostgreSQL instances. - string root_password = 29; - - // The start time of any upcoming scheduled maintenance for this instance. - SqlScheduledMaintenance scheduled_maintenance = 30; - - // This status indicates whether the instance satisfies PZS. - // - // The status is reserved for future use. - google.protobuf.BoolValue satisfies_pzs = 35; - - // Output only. Stores the current database version running on the instance - // including minor version such as `MYSQL_8_0_18`. - string database_installed_version = 40 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // This field represents the report generated by the proactive database - // wellness job for OutOfDisk issues. - // * Writers: - // * the proactive database wellness job for OOD. - // * Readers: - // * the proactive database wellness job - optional SqlOutOfDiskReport out_of_disk_report = 38; - - // Output only. The time when the instance was created in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp create_time = 39 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. List all maintenance versions applicable on the instance - repeated string available_maintenance_versions = 41 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The current software version on the instance. - string maintenance_version = 42; - - // Output only. All database versions that are available for upgrade. - repeated AvailableDatabaseVersion upgradable_database_versions = 45 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - optional SqlNetworkArchitecture sql_network_architecture = 47; - - // Output only. The link to service attachment of PSC instance. - optional string psc_service_attachment_link = 48 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The dns name of the instance. - optional string dns_name = 49 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. DEPRECATED: please use write_endpoint instead. - optional string primary_dns_name = 51 - [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The dns name of the primary instance in a replication group. - optional string write_endpoint = 52 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. A primary instance and disaster recovery (DR) replica pair. - // A DR replica is a cross-region replica that you designate - // for failover in the event that the primary instance - // experiences regional failure. - // Applicable to MySQL and PostgreSQL. - ReplicationCluster replication_cluster = 54 - [(google.api.field_behavior) = OPTIONAL]; - - // Gemini instance configuration. - optional GeminiInstanceConfig gemini_config = 55; - - // Output only. This status indicates whether the instance satisfies PZI. - // - // The status is reserved for future use. - google.protobuf.BoolValue satisfies_pzi = 56 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input only. Whether Cloud SQL is enabled to switch storing point-in-time - // recovery log files from a data disk to Cloud Storage. - optional google.protobuf.BoolValue - switch_transaction_logs_to_cloud_storage_enabled = 57 - [(google.api.field_behavior) = INPUT_ONLY]; - - // Input only. Determines whether an in-place major version upgrade of - // replicas happens when an in-place major version upgrade of a primary - // instance is initiated. - optional google.protobuf.BoolValue - include_replicas_for_major_version_upgrade = 59 - [(google.api.field_behavior) = INPUT_ONLY]; - - // Optional. Input only. Immutable. Tag keys and tag values that are bound to - // this instance. You must represent each item in the map as: - // `"" : ""`. - // - // For example, a single resource can have the following tags: - // ``` - // "123/environment": "production", - // "123/costCenter": "marketing", - // ``` - // - // For more information on tag creation and management, see - // https://cloud.google.com/resource-manager/docs/tags/tags-overview. - map tags = 60 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OPTIONAL - ]; - - // The number of read pool nodes in a read pool. - optional int32 node_count = 63; - - // Output only. Entries containing information about each read pool node of - // the read pool. - repeated PoolNodeConfig nodes = 64 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of DNS names used by this instance. - repeated DnsNameMapping dns_names = 67 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Gemini instance configuration. -message GeminiInstanceConfig { - // Output only. Whether Gemini is enabled. - optional bool entitled = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether the vacuum management is enabled. - optional bool google_vacuum_mgmt_enabled = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether canceling the out-of-memory (OOM) session is enabled. - optional bool oom_session_cancel_enabled = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether the active query is enabled. - optional bool active_query_enabled = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether the index advisor is enabled. - optional bool index_advisor_enabled = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether the flag recommender is enabled. - optional bool flag_recommender_enabled = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A primary instance and disaster recovery (DR) replica pair. -// A DR replica is a cross-region replica that you designate for failover in -// the event that the primary instance experiences regional failure. -// Applicable to MySQL and PostgreSQL. -message ReplicationCluster { - // Output only. If set, this field indicates this instance has a private - // service access (PSA) DNS endpoint that is pointing to the primary instance - // of the cluster. If this instance is the primary, then the DNS endpoint - // points to this instance. After a switchover or replica failover operation, - // this DNS endpoint points to the promoted instance. This is a read-only - // field, returned to the user as information. This field can exist even if a - // standalone instance doesn't have a DR replica yet or the DR replica is - // deleted. - string psa_write_endpoint = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. If the instance is a primary instance, then this field identifies - // the disaster recovery (DR) replica. A DR replica is an optional - // configuration for Enterprise Plus edition instances. If the instance is a - // read replica, then the field is not set. Set this field to a replica name - // to designate a DR replica for a primary instance. Remove the replica name - // to remove the DR replica designation. - string failover_dr_replica_name = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Read-only field that indicates whether the replica is a DR - // replica. This field is not set if the instance is a primary instance. - bool dr_replica = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// An available database version. It can be a major or a minor version. -message AvailableDatabaseVersion { - // The version's major version name. - optional string major_version = 3; - - // The database version name. For MySQL 8.0, this string provides the database - // major and minor version. - optional string name = 8; - - // The database version's display name. - optional string display_name = 9; -} - -// Reschedule options for maintenance windows. -message SqlInstancesRescheduleMaintenanceRequestBody { - enum RescheduleType { - RESCHEDULE_TYPE_UNSPECIFIED = 0; - - // Reschedules maintenance to happen now (within 5 minutes). - IMMEDIATE = 1; - - // Reschedules maintenance to occur within one week from the originally - // scheduled day and time. - NEXT_AVAILABLE_WINDOW = 2; - - // Reschedules maintenance to a specific time and day. - SPECIFIC_TIME = 3; - } - - message Reschedule { - // Required. The type of the reschedule. - RescheduleType reschedule_type = 1; - - // Optional. Timestamp when the maintenance shall be rescheduled to if - // reschedule_type=SPECIFIC_TIME, in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp schedule_time = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. The type of the reschedule the user wants. - Reschedule reschedule = 3; -} - -// Database instance demote primary instance context. -message DemoteMasterContext { - // This is always `sql#demoteMasterContext`. - string kind = 1; - - // Verify the GTID consistency for demote operation. Default value: - // `True`. Setting this flag to `false` enables you to bypass the GTID - // consistency check between on-premises primary instance and Cloud SQL - // instance during the demotion operation but also exposes you to the risk of - // future replication failures. Change the value only if you know the reason - // for the GTID divergence and are confident that doing so will not cause any - // replication issues. - google.protobuf.BoolValue verify_gtid_consistency = 2; - - // The name of the instance which will act as on-premises primary instance - // in the replication setup. - string master_instance_name = 3; - - // Configuration specific to read-replicas replicating from the on-premises - // primary instance. - DemoteMasterConfiguration replica_configuration = 4; - - // Flag to skip replication setup on the instance. - bool skip_replication_setup = 5; -} - -// This context is used to demote an existing standalone instance to be -// a Cloud SQL read replica for an external database server. -message DemoteContext { - // This is always `sql#demoteContext`. - string kind = 1; - - // Required. The name of the instance which acts as the on-premises primary - // instance in the replication setup. - string source_representative_instance_name = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Database instance failover context. -message FailoverContext { - // The current settings version of this instance. Request will be rejected if - // this version doesn't match the current settings version. - int64 settings_version = 1; - - // This is always `sql#failoverContext`. - string kind = 2; -} - -// Database instance restore from backup context. -// Backup context contains source instance id and project id. -message RestoreBackupContext { - // This is always `sql#restoreBackupContext`. - string kind = 1; - - // The ID of the backup run to restore from. - int64 backup_run_id = 2; - - // The ID of the instance that the backup was taken from. - string instance_id = 3; - - // The full project ID of the source instance. - string project = 4; -} - -// Instance rotate server CA context. -message RotateServerCaContext { - // This is always `sql#rotateServerCaContext`. - string kind = 1; - - // The fingerprint of the next version to be rotated to. If left unspecified, - // will be rotated to the most recently added server CA version. - string next_version = 2; -} - -// Instance rotate server certificate context. -message RotateServerCertificateContext { - // Optional. This is always `sql#rotateServerCertificateContext`. - string kind = 1 [(google.api.field_behavior) = OPTIONAL]; - - // The fingerprint of the next version to be rotated to. If left unspecified, - // will be rotated to the most recently added server certificate version. - string next_version = 2; -} - -// Instance rotate Entra ID certificate context. -message RotateEntraIdCertificateContext { - // Optional. This is always `sql#rotateEntraIdCertificateContext`. - string kind = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The fingerprint of the next version to be rotated to. If left - // unspecified, will be rotated to the most recently added server certificate - // version. - string next_version = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Database Instance truncate log context. -message TruncateLogContext { - // This is always `sql#truncateLogContext`. - string kind = 1; - - // The type of log to truncate. Valid values are `MYSQL_GENERAL_TABLE` and - // `MYSQL_SLOW_TABLE`. - string log_type = 2; -} - -// External primary instance migration setting error/warning. -message SqlExternalSyncSettingError { - enum SqlExternalSyncSettingErrorType { - SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED = 0; - - CONNECTION_FAILURE = 1; - - BINLOG_NOT_ENABLED = 2; - - INCOMPATIBLE_DATABASE_VERSION = 3; - - REPLICA_ALREADY_SETUP = 4; - - // The replication user is missing privileges that are required. - INSUFFICIENT_PRIVILEGE = 5; - - // Unsupported migration type. - UNSUPPORTED_MIGRATION_TYPE = 6; - - // No pglogical extension installed on databases, applicable for postgres. - NO_PGLOGICAL_INSTALLED = 7; - - // pglogical node already exists on databases, applicable for postgres. - PGLOGICAL_NODE_ALREADY_EXISTS = 8; - - // The value of parameter wal_level is not set to logical. - INVALID_WAL_LEVEL = 9; - - // The value of parameter shared_preload_libraries does not include - // pglogical. - INVALID_SHARED_PRELOAD_LIBRARY = 10; - - // The value of parameter max_replication_slots is not sufficient. - INSUFFICIENT_MAX_REPLICATION_SLOTS = 11; - - // The value of parameter max_wal_senders is not sufficient. - INSUFFICIENT_MAX_WAL_SENDERS = 12; - - // The value of parameter max_worker_processes is not sufficient. - INSUFFICIENT_MAX_WORKER_PROCESSES = 13; - - // Extensions installed are either not supported or having unsupported - // versions. - UNSUPPORTED_EXTENSIONS = 14; - - // The value of parameter rds.logical_replication is not set to 1. - INVALID_RDS_LOGICAL_REPLICATION = 15; - - // The primary instance logging setup doesn't allow EM sync. - INVALID_LOGGING_SETUP = 16; - - // The primary instance database parameter setup doesn't allow EM sync. - INVALID_DB_PARAM = 17; - - // The gtid_mode is not supported, applicable for MySQL. - UNSUPPORTED_GTID_MODE = 18; - - // SQL Server Agent is not running. - SQLSERVER_AGENT_NOT_RUNNING = 19; - - // The table definition is not support due to missing primary key or replica - // identity, applicable for postgres. Note that this is a warning and won't - // block the migration. - UNSUPPORTED_TABLE_DEFINITION = 20; - - // The customer has a definer that will break EM setup. - UNSUPPORTED_DEFINER = 21; - - // SQL Server @@SERVERNAME does not match actual host name. - SQLSERVER_SERVERNAME_MISMATCH = 22; - - // The primary instance has been setup and will fail the setup. - PRIMARY_ALREADY_SETUP = 23; - - // The primary instance has unsupported binary log format. - UNSUPPORTED_BINLOG_FORMAT = 24; - - // The primary instance's binary log retention setting. - BINLOG_RETENTION_SETTING = 25; - - // The primary instance has tables with unsupported storage engine. - UNSUPPORTED_STORAGE_ENGINE = 26; - - // Source has tables with limited support - // eg: PostgreSQL tables without primary keys. - LIMITED_SUPPORT_TABLES = 27; - - // The replica instance contains existing data. - EXISTING_DATA_IN_REPLICA = 28; - - // The replication user is missing privileges that are optional. - MISSING_OPTIONAL_PRIVILEGES = 29; - - // Additional BACKUP_ADMIN privilege is granted to the replication user - // which may lock source MySQL 8 instance for DDLs during initial sync. - RISKY_BACKUP_ADMIN_PRIVILEGE = 30; - - // The Cloud Storage bucket is missing necessary permissions. - INSUFFICIENT_GCS_PERMISSIONS = 31; - - // The Cloud Storage bucket has an error in the file or contains invalid - // file information. - INVALID_FILE_INFO = 32; - - // The source instance has unsupported database settings for migration. - UNSUPPORTED_DATABASE_SETTINGS = 33; - - // The replication user is missing parallel import specific privileges. - // (e.g. LOCK TABLES) for MySQL. - MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE = 34; - - // The global variable local_infile is off on external server replica. - LOCAL_INFILE_OFF = 35; - - // This code instructs customers to turn on point-in-time recovery manually - // for the instance after promoting the Cloud SQL for PostgreSQL instance. - TURN_ON_PITR_AFTER_PROMOTE = 36; - - // The minor version of replica database is incompatible with the source. - INCOMPATIBLE_DATABASE_MINOR_VERSION = 37; - - // This warning message indicates that Cloud SQL uses the maximum number of - // subscriptions to migrate data from the source to the destination. - SOURCE_MAX_SUBSCRIPTIONS = 38; - - // Unable to verify definers on the source for MySQL. - UNABLE_TO_VERIFY_DEFINERS = 39; - - // If a time out occurs while the subscription counts are calculated, then - // this value is set to 1. Otherwise, this value is set to 2. - SUBSCRIPTION_CALCULATION_STATUS = 40; - - // Count of subscriptions needed to sync source data for PostgreSQL - // database. - PG_SUBSCRIPTION_COUNT = 41; - - // Final parallel level that is used to do migration. - PG_SYNC_PARALLEL_LEVEL = 42; - - // The disk size of the replica instance is smaller than the data size of - // the source instance. - INSUFFICIENT_DISK_SIZE = 43; - - // The data size of the source instance is greater than 1 TB, the number of - // cores of the replica instance is less than 8, and the memory of the - // replica is less than 32 GB. - INSUFFICIENT_MACHINE_TIER = 44; - - // The warning message indicates the unsupported extensions will not be - // migrated to the destination. - UNSUPPORTED_EXTENSIONS_NOT_MIGRATED = 45; - - // The warning message indicates the pg_cron extension and settings will not - // be migrated to the destination. - EXTENSIONS_NOT_MIGRATED = 46; - - // The error message indicates that pg_cron flags are enabled on the - // destination which is not supported during the migration. - PG_CRON_FLAG_ENABLED_IN_REPLICA = 47; - - // This error message indicates that the specified extensions are not - // enabled on destination instance. For example, before you can migrate - // data to the destination instance, you must enable the PGAudit extension - // on the instance. - EXTENSIONS_NOT_ENABLED_IN_REPLICA = 48; - - // The source database has generated columns that can't be migrated. Please - // change them to regular columns before migration. - UNSUPPORTED_COLUMNS = 49; - - // The source database has users that aren't created in the replica. - // First, create all users, which are in the pg_user_mappings table - // of the source database, in the destination instance. Then, perform the - // migration. - USERS_NOT_CREATED_IN_REPLICA = 50; - - // The selected objects include system objects that aren't supported for - // migration. - UNSUPPORTED_SYSTEM_OBJECTS = 51; - - // The source database has tables with the FULL or NOTHING replica identity. - // Before starting your migration, either remove the identity or change it - // to DEFAULT. Note that this is an error and will block the migration. - UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY = 52; - - // The selected objects don't exist on the source instance. - SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE = 53; - - // PSC only destination instance does not have a network attachment URI. - PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI = 54; - - // Selected objects reference unselected objects. Based on their object type - // (foreign key constraint or view), selected objects will fail during - // migration. - SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS = 55; - - // The migration will delete existing data in the replica; set - // [replica_overwrite_enabled][google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.replica_overwrite_enabled] - // in the request to acknowledge this. This is an error. MySQL only. - PROMPT_DELETE_EXISTING = 56; - - // The migration will delete existing data in the replica; - // [replica_overwrite_enabled][google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.replica_overwrite_enabled] - // was set in the request acknowledging this. This is a warning rather than - // an error. MySQL only. - WILL_DELETE_EXISTING = 57; - - // The replication user is missing specific privileges to setup DDL - // replication. (e.g. CREATE EVENT TRIGGER, CREATE SCHEMA) for PostgreSQL. - PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE = 58; - } - - // Can be `sql#externalSyncSettingError` or - // `sql#externalSyncSettingWarning`. - string kind = 1; - - // Identifies the specific error that occurred. - SqlExternalSyncSettingErrorType type = 2; - - // Additional information about the error encountered. - string detail = 3; -} - -// A list of objects that the user selects for replication from an external -// source instance. -message SelectedObjects { - // Required. The name of the database to migrate. - string database = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// On-premises instance configuration. -message OnPremisesConfiguration { - // SslOption defines the SSL mode to be used for replica connection to the - // on-premises source. - enum SslOption { - // Unknown SSL option i.e. SSL option not specified by user. - SSL_OPTION_UNSPECIFIED = 0; - - // SSL is not used for replica connection to the on-premises source. - DISABLE = 1; - - // SSL is required for replica connection to the on-premises source. - REQUIRE = 2; - - // Verify CA is required for replica connection to the on-premises source. - VERIFY_CA = 3; - } - - // The host and port of the on-premises instance in host:port format - string host_port = 1; - - // This is always `sql#onPremisesConfiguration`. - string kind = 2; - - // The username for connecting to on-premises instance. - string username = 3; - - // The password for connecting to on-premises instance. - string password = 4; - - // PEM representation of the trusted CA's x509 certificate. - string ca_certificate = 5; - - // PEM representation of the replica's x509 certificate. - string client_certificate = 6; - - // PEM representation of the replica's private key. The corresponding public - // key is encoded in the client's certificate. - string client_key = 7; - - // The dump file to create the Cloud SQL replica. - string dump_file_path = 8; - - // The reference to Cloud SQL instance if the source is Cloud SQL. - InstanceReference source_instance = 15; - - // Optional. A list of objects that the user selects for replication from an - // external source instance. - repeated SelectedObjects selected_objects = 16 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. SSL option for replica connection to the on-premises source. - SslOption ssl_option = 18 [(google.api.field_behavior) = OPTIONAL]; -} - -// Read-replica configuration for connecting to the primary instance. -message ReplicaConfiguration { - // This is always `sql#replicaConfiguration`. - string kind = 1; - - // MySQL specific configuration when replicating from a MySQL on-premises - // primary instance. Replication configuration information such as the - // username, password, certificates, and keys are not stored in the instance - // metadata. The configuration information is used only to set up the - // replication connection and is stored by MySQL in a file named - // `master.info` in the data directory. - MySqlReplicaConfiguration mysql_replica_configuration = 2; - - // Specifies if the replica is the failover target. If the field is set to - // `true`, the replica will be designated as a failover replica. In case the - // primary instance fails, the replica instance will be promoted as the new - // primary instance. Only one replica can be specified as failover target, and - // the replica has to be in different zone with the primary instance. - google.protobuf.BoolValue failover_target = 3; - - // Optional. Specifies if a SQL Server replica is a cascadable replica. A - // cascadable replica is a SQL Server cross region replica that supports - // replica(s) under it. - google.protobuf.BoolValue cascadable_replica = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Execute SQL statements request. -message SqlInstancesExecuteSqlRequest { - // Required. Database instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // The request body. - ExecuteSqlPayload body = 100; -} - -// The request payload used to execute SQL statements. -message ExecuteSqlPayload { - // Controls how the API should respond when the SQL execution result exceeds - // 10 MB. - enum PartialResultMode { - // Unspecified mode, effectively the same as `FAIL_PARTIAL_RESULT`. - PARTIAL_RESULT_MODE_UNSPECIFIED = 0; - - // Throw an error if the result exceeds 10 MB or if only a partial result - // can be retrieved. Don't return the result. - FAIL_PARTIAL_RESULT = 1; - - // Return a truncated result and set `partial_result` to true if the result - // exceeds 10 MB or if only a partial result can be retrieved due to error. - // Don't throw an error. - ALLOW_PARTIAL_RESULT = 2; - } - - // Optional. The name of an existing database user to connect to the database. - // When `auto_iam_authn` is set to true, this field is ignored and the API - // caller's IAM user is used. - string user = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. SQL statements to run on the database. It can be a single - // statement or a sequence of statements separated by semicolons. - string sql_statement = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Name of the database on which the statement will be executed. - string database = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Credentials for the database connection. - oneof user_password { - // Optional. When set to `true`, the API caller identity associated with the - // request is used for database authentication. The API caller must be an - // IAM user in the database. - bool auto_iam_authn = 11 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The maximum number of rows returned per SQL statement. - int64 row_limit = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Controls how the API should respond when the SQL execution result - // is incomplete due to the size limit or another error. The default mode is - // to throw an error. - PartialResultMode partial_result_mode = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the name of the application that is making the request. - // This field is used for telemetry. Only alphanumeric characters, dashes, and - // underscores are allowed. The maximum length is 32 characters. - string application = 16 [(google.api.field_behavior) = OPTIONAL]; -} - -// Execute SQL statements response. -message SqlInstancesExecuteSqlResponse { - // Represents a notice or warning message from the database. - message Message { - // The full message string. - // For PostgreSQL, this is a formatted string that may include severity, - // code, and the notice/warning message. - // For MySQL, this contains the warning message. - optional string message = 1; - - // The severity of the message (e.g., "NOTICE" for PostgreSQL, "WARNING" for - // MySQL). - optional string severity = 2; - } - - // A list of notices and warnings generated during query execution. - // For PostgreSQL, this includes all notices and warnings. - // For MySQL, this includes warnings generated by the last executed statement. - // To retrieve all warnings for a multi-statement query, `SHOW WARNINGS` must - // be executed after each statement. - repeated Message messages = 9; - - // The additional metadata information regarding the execution of the SQL - // statements. - Metadata metadata = 6; - - // The list of results after executing all the SQL statements. - repeated QueryResult results = 7; - - // Contains the error from the database if the SQL execution failed. - google.rpc.Status status = 8; -} - -// QueryResult contains the result of executing a single SQL statement. -message QueryResult { - // List of columns included in the result. This also includes the data type - // of the column. - repeated Column columns = 1; - - // Rows returned by the SQL statement. - repeated Row rows = 2; - - // Message related to the SQL execution result. - string message = 3; - - // Set to true if the SQL execution's result is truncated due to size limits - // or an error retrieving results. - bool partial_result = 4; - - // If results were truncated due to an error, details of that error. - google.rpc.Status status = 8; -} - -// Contains the name and datatype of a column. -message Column { - // Name of the column. - string name = 1; - - // Datatype of the column. - string type = 2; -} - -// Contains the values for a row. -message Row { - // The values for the row. - repeated Value values = 1; -} - -// The cell value of the table. -message Value { - // The cell value in string format. - string value = 1; - - // If cell value is null, then this flag will be set to true. - bool null_value = 2; -} - -// The additional metadata information regarding the execution of the SQL -// statements. -message Metadata { - // The time taken to execute the SQL statements. - google.protobuf.Duration sql_statement_execution_time = 1; -} - -// Request to acquire a lease for SSRS. -message SqlInstancesAcquireSsrsLeaseRequest { - // Required. Cloud SQL instance ID. This doesn't include the project ID. It's - // composed of lowercase letters, numbers, and hyphens, and it must start with - // a letter. The total length must be 98 characters or less (Example: - // instance-id). - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance (Example: - // project-id). - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The request body. - InstancesAcquireSsrsLeaseRequest body = 100 - [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the acquire SSRS lease request. -message SqlInstancesAcquireSsrsLeaseResponse { - // The unique identifier for this operation. - string operation_id = 1; -} - -// Request to release a lease for SSRS. -message SqlInstancesReleaseSsrsLeaseRequest { - // Required. The Cloud SQL instance ID. This doesn't include the project ID. - // The instance ID contains lowercase letters, numbers, and hyphens, and it - // must start with a letter. This ID can have a maximum length of 98 - // characters. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The project ID that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Response for the release SSRS lease request. -message SqlInstancesReleaseSsrsLeaseResponse { - // The unique identifier for this operation. - string operation_id = 1; -} - -// Request to perform a point in time restore on a Google Cloud Backup and -// Disaster Recovery managed instance. -message SqlInstancesPointInTimeRestoreRequest { - // Required. The parent resource where you created this instance. - // Format: projects/{project} - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The context for request to perform a PITR on a Google Cloud - // Backup and Disaster Recovery managed instance. - PointInTimeRestoreContext context = 100 - [(google.api.field_behavior) = REQUIRED]; -} - -enum SqlInstanceType { - // This is an unknown Cloud SQL instance type. - SQL_INSTANCE_TYPE_UNSPECIFIED = 0; - - // A regular Cloud SQL instance that is not replicating from a primary - // instance. - CLOUD_SQL_INSTANCE = 1; - - // An instance running on the customer's premises that is not managed by - // Cloud SQL. - ON_PREMISES_INSTANCE = 2; - - // A Cloud SQL instance acting as a read-replica. - READ_REPLICA_INSTANCE = 3; - - // A Cloud SQL read pool. - READ_POOL_INSTANCE = 5; -} - -// The suspension reason of the database instance if the state is SUSPENDED. -enum SqlSuspensionReason { - // This is an unknown suspension reason. - SQL_SUSPENSION_REASON_UNSPECIFIED = 0; - - // The instance is suspended due to billing issues (for example:, account - // issue) - BILLING_ISSUE = 2; - - // The instance is suspended due to illegal content (for example:, child - // pornography, copyrighted material, etc.). - LEGAL_ISSUE = 3; - - // The instance is causing operational issues (for example:, causing the - // database to crash). - OPERATIONAL_ISSUE = 4; - - // The KMS key used by the instance is either revoked or denied access to - KMS_KEY_ISSUE = 5; - - // The project is suspended due to abuse detected by Ares. - PROJECT_ABUSE = 8; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_operations.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_operations.proto deleted file mode 100644 index dd4c3fa7e5ef..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_operations.proto +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/sql/v1/cloud_sql_resources.proto"; -import "google/protobuf/empty.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlOperationsProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service to fetch operations for database instances. -service SqlOperationsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Retrieves an instance operation that has been performed on an instance. - rpc Get(SqlOperationsGetRequest) returns (Operation) { - option (google.api.http) = { - get: "/v1/projects/{project}/operations/{operation}" - }; - } - - // Lists all instance operations that have been performed on the given Cloud - // SQL instance in the reverse chronological order of the start time. - rpc List(SqlOperationsListRequest) returns (OperationsListResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/operations" - }; - } - - // Cancels an instance operation that has been performed on an instance. - rpc Cancel(SqlOperationsCancelRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/v1/projects/{project}/operations/{operation}/cancel" - }; - } -} - -// Operations get request. -message SqlOperationsGetRequest { - // Required. Instance operation ID. - string operation = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Operations list request. -message SqlOperationsListRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Maximum number of operations per response. - uint32 max_results = 2; - - // A previously-returned page token representing part of the larger set of - // results to view. - string page_token = 3; - - // Project ID of the project that contains the instance. - string project = 4; -} - -// Operations list response. -message OperationsListResponse { - // This is always `sql#operationsList`. - string kind = 1; - - // List of operation resources. - repeated Operation items = 2; - - // The continuation token, used to page through large result sets. Provide - // this value in a subsequent request to return the next page of results. - string next_page_token = 3; -} - -// Operations cancel request. -message SqlOperationsCancelRequest { - // Instance operation ID. - string operation = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_regions.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_regions.proto deleted file mode 100644 index 91d841faf5ca..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_regions.proto +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlRegionsServiceProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service that exposes Cloud SQL region information. This service is only used -// internally and does not follow the same patterns as the other v1 RPCs. -service SqlRegionsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto deleted file mode 100644 index 4f2fa0a5fc9e..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto +++ /dev/null @@ -1,2388 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/field_behavior.proto"; -import "google/api/field_info.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlResourcesProto"; -option java_package = "com.google.cloud.sql.v1"; - -// An entry for an Access Control list. -message AclEntry { - // The allowlisted value for the access control list. - string value = 1; - - // The time when this access control entry expires in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp expiration_time = 2; - - // Optional. A label to identify this entry. - string name = 3 [(google.api.field_behavior) = OPTIONAL]; - - // This is always `sql#aclEntry`. - string kind = 4; -} - -// An Admin API warning message. -message ApiWarning { - enum SqlApiWarningCode { - // An unknown or unset warning type from Cloud SQL API. - SQL_API_WARNING_CODE_UNSPECIFIED = 0; - - // Warning when one or more regions are not reachable. The returned result - // set may be incomplete. - REGION_UNREACHABLE = 1; - - // Warning when user provided maxResults parameter exceeds the limit. The - // returned result set may be incomplete. - MAX_RESULTS_EXCEEDS_LIMIT = 2; - - // Warning when user tries to create/update a user with credentials that - // have previously been compromised by a public data breach. - COMPROMISED_CREDENTIALS = 3; - - // Warning when the operation succeeds but some non-critical workflow state - // failed. - INTERNAL_STATE_FAILURE = 4; - } - - // Code to uniquely identify the warning type. - SqlApiWarningCode code = 1; - - // The warning message. - string message = 2; - - // The region name for REGION_UNREACHABLE warning. - string region = 3; -} - -// We currently only support backup retention by specifying the number -// of backups we will retain. -message BackupRetentionSettings { - // The units that retained_backups specifies, we only support COUNT. - enum RetentionUnit { - // Backup retention unit is unspecified, will be treated as COUNT. - RETENTION_UNIT_UNSPECIFIED = 0; - - // Retention will be by count, eg. "retain the most recent 7 backups". - COUNT = 1; - } - - // The unit that 'retained_backups' represents. - RetentionUnit retention_unit = 1; - - // Depending on the value of retention_unit, this is used to determine - // if a backup needs to be deleted. If retention_unit is 'COUNT', we will - // retain this many backups. - google.protobuf.Int32Value retained_backups = 2; -} - -// Database instance backup configuration. -message BackupConfiguration { - // This value contains the storage location of the transactional logs - // used to perform point-in-time recovery (PITR) for the database. - enum TransactionalLogStorageState { - // Unspecified. - TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED = 0; - - // The transaction logs used for PITR for the instance are stored - // on a data disk. - DISK = 1; - - // The transaction logs used for PITR for the instance are switching from - // being stored on a data disk to being stored in Cloud Storage. - // Only applicable to MySQL. - SWITCHING_TO_CLOUD_STORAGE = 2; - - // The transaction logs used for PITR for the instance are now stored - // in Cloud Storage. Previously, they were stored on a data disk. - // Only applicable to MySQL. - SWITCHED_TO_CLOUD_STORAGE = 3; - - // The transaction logs used for PITR for the instance are stored in - // Cloud Storage. Only applicable to MySQL and PostgreSQL. - CLOUD_STORAGE = 4; - } - - // Backup tier that manages the backups for the instance. - enum BackupTier { - // Unspecified. - BACKUP_TIER_UNSPECIFIED = 0; - - // Instance is managed by Cloud SQL. - STANDARD = 1; - - // Deprecated: ADVANCED is deprecated. Please use ENHANCED instead. - ADVANCED = 2 [deprecated = true]; - - // Instance is managed by Google Cloud Backup and DR Service. - ENHANCED = 3; - } - - // Start time for the daily backup configuration in UTC timezone in the 24 - // hour format - `HH:MM`. - string start_time = 1; - - // Whether this configuration is enabled. - google.protobuf.BoolValue enabled = 2; - - // This is always `sql#backupConfiguration`. - string kind = 3; - - // (MySQL only) Whether binary log is enabled. If backup configuration is - // disabled, binarylog must be disabled as well. - google.protobuf.BoolValue binary_log_enabled = 4; - - // Reserved for future use. - google.protobuf.BoolValue replication_log_archiving_enabled = 5; - - // Location of the backup - string location = 6; - - // Whether point in time recovery is enabled. - google.protobuf.BoolValue point_in_time_recovery_enabled = 7; - - // Backup retention settings. - BackupRetentionSettings backup_retention_settings = 8; - - // The number of days of transaction logs we retain for point in time - // restore, from 1-7. - google.protobuf.Int32Value transaction_log_retention_days = 9; - - // Output only. This value contains the storage location of transactional logs - // used to perform point-in-time recovery (PITR) for the database. - optional TransactionalLogStorageState transactional_log_storage_state = 10 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Backup tier that manages the backups for the instance. - optional BackupTier backup_tier = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Perform disk shrink context. -message PerformDiskShrinkContext { - // The target disk shrink size in GigaBytes. - int64 target_size_gb = 1; -} - -// Structured PreCheckResponse containing message, type, and required -// actions. -message PreCheckResponse { - // The type of message which can be an info, a warning, or an error that - // requires user intervention. - enum MessageType { - // Default unspecified value to prevent unintended behavior changes. - MESSAGE_TYPE_UNSPECIFIED = 0; - - // General informational messages that don't require action. - INFO = 1; - - // Warnings that might impact the upgrade but don't block it. - WARNING = 2; - - // Errors that a user must resolve before proceeding with the upgrade. - ERROR = 3; - } - - // The message to be displayed to the user. - optional string message = 2; - - // The type of message whether it is an info, warning, or error. - optional MessageType message_type = 3; - - // The actions that the user needs to take. Use repeated for multiple - // actions. - repeated string actions_required = 4; -} - -// Pre-check major version upgrade context. -message PreCheckMajorVersionUpgradeContext { - // Required. The target database version to upgrade to. - SqlDatabaseVersion target_database_version = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Output only. The responses from the precheck operation. - repeated PreCheckResponse pre_check_response = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. This is always `sql#preCheckMajorVersionUpgradeContext`. - string kind = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Backup context. -message BackupContext { - // The identifier of the backup. - int64 backup_id = 1; - - // This is always `sql#backupContext`. - string kind = 2; - - // The name of the backup. - // Format: projects/{project}/backups/{backup} - string name = 3; -} - -// Represents a SQL database on the Cloud SQL instance. -message Database { - // This is always `sql#database`. - string kind = 1; - - // The Cloud SQL charset value. - string charset = 2; - - // The Cloud SQL collation value. - string collation = 3; - - // This field is deprecated and will be removed from a future version of the - // API. - string etag = 4; - - // The name of the database in the Cloud SQL instance. This does not include - // the project ID or instance name. - string name = 5; - - // The name of the Cloud SQL instance. This does not include the project ID. - string instance = 6; - - // The URI of this resource. - string self_link = 7; - - // The project ID of the project containing the Cloud SQL database. The Google - // apps domain is prefixed if applicable. - string project = 8; - - oneof database_details { - SqlServerDatabaseDetails sqlserver_database_details = 9; - } -} - -// Represents a Sql Server database on the Cloud SQL instance. -message SqlServerDatabaseDetails { - // The version of SQL Server with which the database is to be made compatible - int32 compatibility_level = 1; - - // The recovery model of a SQL Server database - string recovery_model = 2; -} - -// Database flags for Cloud SQL instances. -message DatabaseFlags { - // The name of the flag. These flags are passed at instance startup, so - // include both server options and system variables. Flags are - // specified with underscores, not hyphens. For more information, see - // [Configuring Database Flags](https://cloud.google.com/sql/docs/mysql/flags) - // in the Cloud SQL documentation. - string name = 1; - - // The value of the flag. Boolean flags are set to `on` for true - // and `off` for false. This field must be omitted if the flag - // doesn't take a value. - string value = 2; -} - -// MySQL-specific external server sync settings. -message MySqlSyncConfig { - // Flags to use for the initial dump. - repeated SyncFlags initial_sync_flags = 1; -} - -// Initial sync flags for certain Cloud SQL APIs. -// Currently used for the MySQL external server initial dump. -message SyncFlags { - // The name of the flag. - string name = 1; - - // The value of the flag. This field must be omitted if the flag - // doesn't take a value. - string value = 2; -} - -// Reference to another Cloud SQL instance. -message InstanceReference { - // The name of the Cloud SQL instance being referenced. - // This does not include the project ID. - string name = 1; - - // The region of the Cloud SQL instance being referenced. - string region = 2; - - // The project ID of the Cloud SQL instance being referenced. - // The default is the same project ID as the instance references it. - string project = 3; -} - -// Read-replica configuration for connecting to the on-premises primary -// instance. -message DemoteMasterConfiguration { - // This is always `sql#demoteMasterConfiguration`. - string kind = 1; - - // MySQL specific configuration when replicating from a MySQL on-premises - // primary instance. Replication configuration information such as the - // username, password, certificates, and keys are not stored in the instance - // metadata. The configuration information is used only to set up the - // replication connection and is stored by MySQL in a file named - // `master.info` in the data directory. - DemoteMasterMySqlReplicaConfiguration mysql_replica_configuration = 2; -} - -// Read-replica configuration specific to MySQL databases. -message DemoteMasterMySqlReplicaConfiguration { - // This is always `sql#demoteMasterMysqlReplicaConfiguration`. - string kind = 1; - - // The username for the replication connection. - string username = 2; - - // The password for the replication connection. - string password = 3; - - // PEM representation of the replica's private key. The corresponding public - // key is encoded in the client's certificate. The format of the replica's - // private key can be either PKCS #1 or PKCS #8. - string client_key = 4; - - // PEM representation of the replica's x509 certificate. - string client_certificate = 5; - - // PEM representation of the trusted CA's x509 certificate. - string ca_certificate = 6; -} - -enum SqlFileType { - // Unknown file type. - SQL_FILE_TYPE_UNSPECIFIED = 0; - - // File containing SQL statements. - SQL = 1; - - // File in CSV format. - CSV = 2; - - BAK = 4; - - // TDE certificate. - TDE = 8; -} - -// Database instance export context. -message ExportContext { - message SqlCsvExportOptions { - // The select query used to extract the data. - string select_query = 1; - - // Specifies the character that should appear before a data character that - // needs to be escaped. - string escape_character = 2; - - // Specifies the quoting character to be used when a data value is quoted. - string quote_character = 3; - - // Specifies the character that separates columns within each row (line) of - // the file. - string fields_terminated_by = 4; - - // This is used to separate lines. If a line does not contain all fields, - // the rest of the columns are set to their default values. - string lines_terminated_by = 6; - } - - message SqlExportOptions { - // Options for exporting from MySQL. - message MysqlExportOptions { - // Option to include SQL statement required to set up replication. If set - // to `1`, the dump file includes a CHANGE MASTER TO statement with the - // binary log coordinates, and --set-gtid-purged is set to ON. If set to - // `2`, the CHANGE MASTER TO statement is written as a SQL comment and - // has no effect. If set to any value other than `1`, --set-gtid-purged - // is set to OFF. - google.protobuf.Int32Value master_data = 1; - } - - // Options for exporting from a Cloud SQL for PostgreSQL instance. - message PostgresExportOptions { - // Optional. Use this option to include DROP <object> - // SQL statements. Use these statements to delete database objects before - // running the import operation. - google.protobuf.BoolValue clean = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Option to include an IF EXISTS SQL statement with each DROP - // statement produced by clean. - google.protobuf.BoolValue if_exists = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Tables to export, or that were exported, from the specified database. If - // you specify tables, specify one and only one database. For PostgreSQL - // instances, you can specify only one table. - repeated string tables = 1; - - // Export only schemas. - google.protobuf.BoolValue schema_only = 2; - - MysqlExportOptions mysql_export_options = 3; - - // Optional. The number of threads to use for parallel export. - google.protobuf.Int32Value threads = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether or not the export should be parallel. - google.protobuf.BoolValue parallel = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Options for exporting from a Cloud SQL for PostgreSQL instance. - PostgresExportOptions postgres_export_options = 6 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Options for exporting BAK files (SQL Server-only) - message SqlBakExportOptions { - // Whether or not the export should be striped. - google.protobuf.BoolValue striped = 1; - - // Option for specifying how many stripes to use for the export. - // If blank, and the value of the striped field is true, - // the number of stripes is automatically chosen. - google.protobuf.Int32Value stripe_count = 2; - - // Type of this bak file will be export, FULL or DIFF, SQL Server only - BakType bak_type = 4; - - // Deprecated: copy_only is deprecated. Use differential_base instead - google.protobuf.BoolValue copy_only = 5 [deprecated = true]; - - // Whether or not the backup can be used as a differential base - // copy_only backup can not be served as differential base - google.protobuf.BoolValue differential_base = 6; - - // Optional. The begin timestamp when transaction log will be included in - // the export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) - // format (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all - // available logs from the beginning of retention period will be included. - // Only applied to Cloud SQL for SQL Server. - google.protobuf.Timestamp export_log_start_time = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The end timestamp when transaction log will be included in the - // export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) format - // (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all - // available logs until current time will be included. Only applied to Cloud - // SQL for SQL Server. - google.protobuf.Timestamp export_log_end_time = 8 - [(google.api.field_behavior) = OPTIONAL]; - } - - message SqlTdeExportOptions { - // Required. Path to the TDE certificate public key - // in the form gs://bucketName/fileName. - // The instance must have write access to the bucket. - // Applicable only for SQL Server instances. - string certificate_path = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Path to the TDE certificate private key - // in the form gs://bucketName/fileName. - // The instance must have write access to the location. - // Applicable only for SQL Server instances. - string private_key_path = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Password that encrypts the private key. - string private_key_password = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Certificate name. - // Applicable only for SQL Server instances. - string name = 5 [(google.api.field_behavior) = REQUIRED]; - } - - // The path to the file in Google Cloud Storage where the export will be - // stored. The URI is in the form `gs://bucketName/fileName`. If the file - // already exists, the request succeeds, but the operation fails. If - // `fileType` is `SQL` and the filename ends with .gz, - // the contents are compressed. - string uri = 1; - - // Databases to be exported.
`MySQL instances:` If - // `fileType` is `SQL` and no database is specified, all - // databases are exported, except for the `mysql` system database. - // If `fileType` is `CSV`, you can specify one database, - // either by using this property or by using the - // `csvExportOptions.selectQuery` property, which takes precedence - // over this property.
`PostgreSQL instances:` If you don't specify a - // database by name, all user databases in the instance are exported. - // This excludes system databases and Cloud SQL databases used to manage - // internal operations. Exporting all user databases is only available for - // directory-formatted parallel export. If `fileType` is `CSV`, - // this database must match the one specified in the - // `csvExportOptions.selectQuery` property.
`SQL Server - // instances:` You must specify one database to be exported, and the - // `fileType` must be `BAK`. - repeated string databases = 2; - - // This is always `sql#exportContext`. - string kind = 3; - - // Options for exporting data as SQL statements. - SqlExportOptions sql_export_options = 4; - - // Options for exporting data as CSV. `MySQL` and `PostgreSQL` - // instances only. - SqlCsvExportOptions csv_export_options = 5; - - // The file type for the specified uri. - SqlFileType file_type = 6; - - // Whether to perform a serverless export. - google.protobuf.BoolValue offload = 8; - - // Options for exporting data as BAK files. - SqlBakExportOptions bak_export_options = 9; - - // Optional. Export parameters specific to SQL Server TDE certificates - SqlTdeExportOptions tde_export_options = 10 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Database instance import context. -message ImportContext { - message SqlImportOptions { - message PostgresImportOptions { - // Optional. The --clean flag for the pg_restore utility. This flag - // applies only if you enabled Cloud SQL to import files in parallel. - google.protobuf.BoolValue clean = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The --if-exists flag for the pg_restore utility. This flag - // applies only if you enabled Cloud SQL to import files in parallel. - google.protobuf.BoolValue if_exists = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The number of threads to use for parallel import. - google.protobuf.Int32Value threads = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether or not the import should be parallel. - google.protobuf.BoolValue parallel = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Options for importing from a Cloud SQL for PostgreSQL instance. - PostgresImportOptions postgres_import_options = 3 - [(google.api.field_behavior) = OPTIONAL]; - } - - message SqlCsvImportOptions { - // The table to which CSV data is imported. - string table = 1; - - // The columns to which CSV data is imported. If not specified, all columns - // of the database table are loaded with CSV data. - repeated string columns = 2; - - // Specifies the character that should appear before a data character that - // needs to be escaped. - string escape_character = 4; - - // Specifies the quoting character to be used when a data value is quoted. - string quote_character = 5; - - // Specifies the character that separates columns within each row (line) of - // the file. - string fields_terminated_by = 6; - - // This is used to separate lines. If a line does not contain all fields, - // the rest of the columns are set to their default values. - string lines_terminated_by = 8; - } - - message SqlBakImportOptions { - message EncryptionOptions { - // Path to the Certificate (.cer) in Cloud Storage, in the form - // `gs://bucketName/fileName`. The instance must have - // write permissions to the bucket and read access to the file. - string cert_path = 1; - - // Path to the Certificate Private Key (.pvk) in Cloud Storage, in the - // form `gs://bucketName/fileName`. The instance must have - // write permissions to the bucket and read access to the file. - string pvk_path = 2; - - // Password that encrypts the private key - string pvk_password = 3; - - // Optional. Whether the imported file remains encrypted. - google.protobuf.BoolValue keep_encrypted = 5 - [(google.api.field_behavior) = OPTIONAL]; - } - - EncryptionOptions encryption_options = 1; - - // Whether or not the backup set being restored is striped. - // Applies only to Cloud SQL for SQL Server. - google.protobuf.BoolValue striped = 2; - - // Whether or not the backup importing will restore database - // with NORECOVERY option. - // Applies only to Cloud SQL for SQL Server. - google.protobuf.BoolValue no_recovery = 4; - - // Whether or not the backup importing request will just bring database - // online without downloading Bak content only one of "no_recovery" and - // "recovery_only" can be true otherwise error will return. Applies only to - // Cloud SQL for SQL Server. - google.protobuf.BoolValue recovery_only = 5; - - // Type of the bak content, FULL or DIFF - BakType bak_type = 6; - - // Optional. The timestamp when the import should stop. This timestamp is in - // the [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, - // `2023-10-01T16:19:00.094`). This field is equivalent to the STOPAT - // keyword and applies to Cloud SQL for SQL Server only. - google.protobuf.Timestamp stop_at = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The marked transaction where the import should stop. This field - // is equivalent to the STOPATMARK keyword and applies to Cloud SQL for SQL - // Server only. - string stop_at_mark = 8 [(google.api.field_behavior) = OPTIONAL]; - } - - message SqlTdeImportOptions { - // Required. Path to the TDE certificate public key - // in the form gs://bucketName/fileName. - // The instance must have read access to the file. - // Applicable only for SQL Server instances. - string certificate_path = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Path to the TDE certificate private key - // in the form gs://bucketName/fileName. - // The instance must have read access to the file. - // Applicable only for SQL Server instances. - string private_key_path = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Password that encrypts the private key. - string private_key_password = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Certificate name. - // Applicable only for SQL Server instances. - string name = 5 [(google.api.field_behavior) = REQUIRED]; - } - - // Path to the import file in Cloud Storage, in the form - // `gs://bucketName/fileName`. Compressed gzip files (.gz) are supported - // when `fileType` is `SQL`. The instance must have - // write permissions to the bucket and read access to the file. - string uri = 1; - - // The target database for the import. If `fileType` is `SQL`, this field - // is required only if the import file does not specify a database, and is - // overridden by any database specification in the import file. For entire - // instance parallel import operations, the database is overridden by the - // database name stored in subdirectory name. If - // `fileType` is `CSV`, one database must be specified. - string database = 2; - - // This is always `sql#importContext`. - string kind = 3; - - // The file type for the specified uri.\`SQL`: The file - // contains SQL statements. \`CSV`: The file contains CSV data. - SqlFileType file_type = 4; - - // Options for importing data as CSV. - SqlCsvImportOptions csv_import_options = 5; - - // The PostgreSQL user for this import operation. PostgreSQL instances only. - string import_user = 6; - - // Import parameters specific to SQL Server .BAK files - SqlBakImportOptions bak_import_options = 7; - - // Optional. Options for importing data from SQL statements. - SqlImportOptions sql_import_options = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Import parameters specific to SQL Server TDE certificates - SqlTdeImportOptions tde_import_options = 9 - [(google.api.field_behavior) = OPTIONAL]; -} - -enum BakType { - // Default type. - BAK_TYPE_UNSPECIFIED = 0; - - // Full backup. - FULL = 1; - - // Differential backup. - DIFF = 2; - - // Transaction Log backup - TLOG = 3; -} - -// IP Management configuration. -message IpConfiguration { - // The SSL options for database connections. - enum SslMode { - // The SSL mode is unknown. - SSL_MODE_UNSPECIFIED = 0; - - // Allow non-SSL/non-TLS and SSL/TLS connections. - // For SSL connections to MySQL and PostgreSQL, the client certificate - // isn't verified. - // - // When this value is used, the legacy `require_ssl` flag must be false or - // cleared to avoid a conflict between the values of the two flags. - ALLOW_UNENCRYPTED_AND_ENCRYPTED = 1; - - // Only allow connections encrypted with SSL/TLS. - // For SSL connections to MySQL and PostgreSQL, the client certificate - // isn't verified. - // - // When this value is used, the legacy `require_ssl` flag must be false or - // cleared to avoid a conflict between the values of the two flags. - ENCRYPTED_ONLY = 2; - - // Only allow connections encrypted with SSL/TLS and with valid - // client certificates. - // - // When this value is used, the legacy `require_ssl` flag must be true or - // cleared to avoid the conflict between values of two flags. - // PostgreSQL clients or users that connect using IAM database - // authentication must use either the - // [Cloud SQL Auth - // Proxy](https://cloud.google.com/sql/docs/postgres/connect-auth-proxy) or - // [Cloud SQL - // Connectors](https://cloud.google.com/sql/docs/postgres/connect-connectors) - // to enforce client identity verification. - // - // Only applicable to MySQL and PostgreSQL. Not applicable to SQL Server. - TRUSTED_CLIENT_CERTIFICATE_REQUIRED = 3; - } - - // Various Certificate Authority (CA) modes for certificate signing. - enum CaMode { - // CA mode is unspecified. It is effectively the same as - // `GOOGLE_MANAGED_INTERNAL_CA`. - CA_MODE_UNSPECIFIED = 0; - - // Google-managed self-signed internal CA. - GOOGLE_MANAGED_INTERNAL_CA = 1; - - // Google-managed regional CA part of root CA hierarchy hosted on Google - // Cloud's Certificate Authority Service (CAS). - GOOGLE_MANAGED_CAS_CA = 2; - - // Customer-managed CA hosted on Google Cloud's Certificate Authority - // Service (CAS). - CUSTOMER_MANAGED_CAS_CA = 3; - } - - // Settings for automatic server certificate rotation. - enum ServerCertificateRotationMode { - // Unspecified: no automatic server certificate rotation. - SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED = 0; - - // No automatic server certificate rotation. The user must [manage server - // certificate - // rotation](/sql/docs/mysql/manage-ssl-instance#rotate-server-certificate-cas) - // on their side. - NO_AUTOMATIC_ROTATION = 1; - - // Automatic server certificate rotation during Cloud SQL scheduled - // maintenance or self-service maintenance updates. Requires - // `server_ca_mode` to be `GOOGLE_MANAGED_CAS_CA` or - // `CUSTOMER_MANAGED_CAS_CA`. - AUTOMATIC_ROTATION_DURING_MAINTENANCE = 2; - } - - // Whether the instance is assigned a public IP address or not. - google.protobuf.BoolValue ipv4_enabled = 1; - - // The resource link for the VPC network from which the Cloud SQL instance is - // accessible for private IP. For example, - // `/projects/myProject/global/networks/default`. This setting can - // be updated, but it cannot be removed after it is set. - string private_network = 2; - - // Use `ssl_mode` instead. - // - // Whether SSL/TLS connections over IP are enforced. - // If set to false, then allow both non-SSL/non-TLS and SSL/TLS connections. - // For SSL/TLS connections, the client certificate won't be verified. If - // set to true, then only allow connections encrypted with SSL/TLS and with - // valid client certificates. If you want to enforce SSL/TLS without enforcing - // the requirement for valid client certificates, then use the `ssl_mode` flag - // instead of the `require_ssl` flag. - google.protobuf.BoolValue require_ssl = 3; - - // The list of external networks that are allowed to connect to the instance - // using the IP. In 'CIDR' notation, also known as 'slash' notation (for - // example: `157.197.200.0/24`). - repeated AclEntry authorized_networks = 4; - - // The name of the allocated ip range for the private ip Cloud SQL instance. - // For example: "google-managed-services-default". If set, the instance ip - // will be created in the allocated range. The range name must comply with - // [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name - // must be 1-63 characters long and match the regular expression - // `[a-z]([-a-z0-9]*[a-z0-9])?.` - string allocated_ip_range = 6; - - // Controls connectivity to private IP instances from Google services, - // such as BigQuery. - google.protobuf.BoolValue enable_private_path_for_google_cloud_services = 7; - - // Specify how SSL/TLS is enforced in database connections. If you must use - // the `require_ssl` flag for backward compatibility, then only the following - // value pairs are valid: - // - // For PostgreSQL and MySQL: - // - // * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false` - // * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=false` - // * `ssl_mode=TRUSTED_CLIENT_CERTIFICATE_REQUIRED` and `require_ssl=true` - // - // For SQL Server: - // - // * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false` - // * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=true` - // - // The value of `ssl_mode` has priority over the value of `require_ssl`. - // - // For example, for the pair `ssl_mode=ENCRYPTED_ONLY` and - // `require_ssl=false`, `ssl_mode=ENCRYPTED_ONLY` means accept only SSL - // connections, while `require_ssl=false` means accept both non-SSL - // and SSL connections. In this case, MySQL and PostgreSQL databases respect - // `ssl_mode` and accepts only SSL connections. - SslMode ssl_mode = 8; - - // PSC settings for this instance. - optional PscConfig psc_config = 9; - - // Specify what type of CA is used for the server certificate. - optional CaMode server_ca_mode = 10; - - // Optional. Custom Subject Alternative Name(SAN)s for a Cloud SQL instance. - repeated string custom_subject_alternative_names = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource name of the server CA pool for an instance with - // `CUSTOMER_MANAGED_CAS_CA` as the `server_ca_mode`. - // Format: projects/{PROJECT}/locations/{REGION}/caPools/{CA_POOL_ID} - optional string server_ca_pool = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Controls the automatic server certificate rotation feature. This - // feature is disabled by default. When enabled, the server certificate will - // be automatically rotated during Cloud SQL scheduled maintenance or - // self-service maintenance updates up to six months before it expires. This - // setting can only be set if server_ca_mode is either GOOGLE_MANAGED_CAS_CA - // or CUSTOMER_MANAGED_CAS_CA. - optional ServerCertificateRotationMode server_certificate_rotation_mode = 16 - [(google.api.field_behavior) = OPTIONAL]; -} - -// PSC settings for a Cloud SQL instance. -message PscConfig { - // Whether PSC connectivity is enabled for this instance. - optional bool psc_enabled = 1; - - // Optional. The list of consumer projects that are allow-listed for PSC - // connections to this instance. This instance can be connected to with PSC - // from any network in these projects. - // - // Each consumer project in this list may be represented by a project number - // (numeric) or by a project id (alphanumeric). - repeated string allowed_consumer_projects = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The list of settings for requested Private Service Connect - // consumer endpoints that can be used to connect to this Cloud SQL instance. - repeated PscAutoConnectionConfig psc_auto_connections = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The network attachment of the consumer network that the - // Private Service Connect enabled Cloud SQL instance is - // authorized to connect via PSC interface. - // format: projects/PROJECT/regions/REGION/networkAttachments/ID - string network_attachment_uri = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether PSC DNS automation is enabled for this - // instance. When enabled, Cloud SQL provisions a universal DNS record across - // all networks configured with Private Service Connect (PSC) - // auto-connections. This will default to true for new instances when Private - // Service Connect is enabled. - optional bool psc_auto_dns_enabled = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Indicates whether PSC write endpoint DNS automation is enabled - // for this instance. When enabled, Cloud SQL provisions a universal global - // DNS record across all networks configured with Private Service Connect - // (PSC) auto-connections that always points to the cluster primary instance. - // This feature is only supported for Enterprise Plus edition. - // This will default to true for new Enterprise Plus instances when - // `psc_auto_dns_enabled` is enabled. - optional bool psc_write_endpoint_dns_enabled = 6 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Settings for an automatically-setup Private Service Connect consumer endpoint -// that is used to connect to a Cloud SQL instance. -message PscAutoConnectionConfig { - // Optional. This is the project ID of consumer service project of this - // consumer endpoint. - // - // This is only applicable if `consumer_network` is a shared VPC - // network. - string consumer_project = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The consumer network of this consumer endpoint. This must be a - // resource path that includes both the host project and the network name. - // - // For example, `projects/project1/global/networks/network1`. - // - // The consumer host project of this network might be different from the - // consumer service project. - string consumer_network = 2 [(google.api.field_behavior) = OPTIONAL]; - - // The IP address of the consumer endpoint. - optional string ip_address = 3 - [(google.api.field_info).format = IPV4_OR_IPV6]; - - // The connection status of the consumer endpoint. - optional string status = 4; - - // The connection policy status of the consumer network. - optional string consumer_network_status = 5; -} - -// Preferred location. This specifies where a Cloud SQL instance is located. -// Note that if the preferred location is not available, the instance will be -// located as close as possible within the region. Only one location may be -// specified. -message LocationPreference { - // The App Engine application to follow, it must be in the same region as the - // Cloud SQL instance. WARNING: Changing this might restart the instance. - string follow_gae_application = 1 [deprecated = true]; - - // The preferred Compute Engine zone (for example: us-central1-a, - // us-central1-b, etc.). WARNING: Changing this might restart the instance. - string zone = 2; - - // The preferred Compute Engine zone for the secondary/failover - // (for example: us-central1-a, us-central1-b, etc.). - // To disable this field, set it to 'no_secondary_zone'. - string secondary_zone = 4; - - // This is always `sql#locationPreference`. - string kind = 3; -} - -// Maintenance window. This specifies when a Cloud SQL instance is -// restarted for system maintenance purposes. -message MaintenanceWindow { - // Hour of day - 0 to 23. Specify in the UTC time zone. - google.protobuf.Int32Value hour = 1; - - // Day of week - `MONDAY`, `TUESDAY`, `WEDNESDAY`, `THURSDAY`, `FRIDAY`, - // `SATURDAY`, or `SUNDAY`. Specify in the UTC time zone. - // Returned in output as an integer, 1 to 7, where `1` equals Monday. - google.protobuf.Int32Value day = 2; - - // Maintenance timing settings: `canary`, `stable`, or `week5`. - // For more information, see [About maintenance on Cloud SQL - // instances](https://cloud.google.com/sql/docs/mysql/maintenance). - SqlUpdateTrack update_track = 3; - - // This is always `sql#maintenanceWindow`. - string kind = 4; -} - -// Deny maintenance Periods. This specifies a date range during when all CSA -// rollout will be denied. -message DenyMaintenancePeriod { - // "deny maintenance period" start date. If the year of the start date is - // empty, the year of the end date also must be empty. In this case, it means - // the deny maintenance period recurs every year. The date is in format - // yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01 - string start_date = 1; - - // "deny maintenance period" end date. If the year of the end date is empty, - // the year of the start date also must be empty. In this case, it means the - // no maintenance interval recurs every year. The date is in format yyyy-mm-dd - // i.e., 2020-11-01, or mm-dd, i.e., 11-01 - string end_date = 2; - - // Time in UTC when the "deny maintenance period" starts on start_date and - // ends on end_date. The time is in format: HH:mm:SS, i.e., 00:00:00 - string time = 3; -} - -// Insights configuration. This specifies when Cloud SQL Insights feature is -// enabled and optional configuration. -message InsightsConfig { - // Whether Query Insights feature is enabled. - bool query_insights_enabled = 1; - - // Whether Query Insights will record client address when enabled. - bool record_client_address = 2; - - // Whether Query Insights will record application tags from query when - // enabled. - bool record_application_tags = 3; - - // Maximum query length stored in bytes. Default value: 1024 bytes. - // Range: 256-4500 bytes. Query lengths greater than this field value will be - // truncated to this value. When unset, query length will be the default - // value. Changing query length will restart the database. - google.protobuf.Int32Value query_string_length = 4; - - // Number of query execution plans captured by Insights per minute - // for all queries combined. Default is 5. - google.protobuf.Int32Value query_plans_per_minute = 5; - - // Optional. Whether enhanced query insights feature is enabled. - google.protobuf.BoolValue enhanced_query_insights_enabled = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Read-replica configuration specific to MySQL databases. -message MySqlReplicaConfiguration { - // Path to a SQL dump file in Google Cloud Storage from which the replica - // instance is to be created. The URI is in the form gs://bucketName/fileName. - // Compressed gzip files (.gz) are also supported. - // Dumps have the binlog co-ordinates from which replication - // begins. This can be accomplished by setting --master-data to 1 when using - // mysqldump. - string dump_file_path = 1; - - // The username for the replication connection. - string username = 2; - - // The password for the replication connection. - string password = 3; - - // Seconds to wait between connect retries. MySQL's default is 60 seconds. - google.protobuf.Int32Value connect_retry_interval = 4; - - // Interval in milliseconds between replication heartbeats. - google.protobuf.Int64Value master_heartbeat_period = 5; - - // PEM representation of the trusted CA's x509 certificate. - string ca_certificate = 6; - - // PEM representation of the replica's x509 certificate. - string client_certificate = 7; - - // PEM representation of the replica's private key. The corresponding public - // key is encoded in the client's certificate. - string client_key = 8; - - // A list of permissible ciphers to use for SSL encryption. - string ssl_cipher = 9; - - // Whether or not to check the primary instance's Common Name value in the - // certificate that it sends during the SSL handshake. - google.protobuf.BoolValue verify_server_certificate = 10; - - // This is always `sql#mysqlReplicaConfiguration`. - string kind = 11; -} - -// Disk encryption configuration for an instance. -message DiskEncryptionConfiguration { - // Resource name of KMS key for disk encryption - string kms_key_name = 1; - - // This is always `sql#diskEncryptionConfiguration`. - string kind = 2; -} - -// Disk encryption status for an instance. -message DiskEncryptionStatus { - // KMS key version used to encrypt the Cloud SQL instance resource - string kms_key_version_name = 1; - - // This is always `sql#diskEncryptionStatus`. - string kind = 2; -} - -// Database instance IP mapping -message IpMapping { - // The type of this IP address. A `PRIMARY` address is a public address that - // can accept incoming connections. A `PRIVATE` address is a private address - // that can accept incoming connections. An `OUTGOING` address is the source - // address of connections originating from the instance, if supported. - SqlIpAddressType type = 1; - - // The IP address assigned. - string ip_address = 2; - - // The due time for this IP to be retired in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. This field is only available when - // the IP is scheduled to be retired. - google.protobuf.Timestamp time_to_retire = 3; -} - -// The type of maintenance to be performed on the instance. -enum SqlMaintenanceType { - // Maintenance type is unspecified. - SQL_MAINTENANCE_TYPE_UNSPECIFIED = 0; - - // Indicates that a standalone instance is undergoing maintenance. The - // instance can be either a primary instance or a replica. - INSTANCE_MAINTENANCE = 1; - - // Indicates that the primary instance and all of its replicas, including - // cascading replicas, are undergoing maintenance. Maintenance is performed on - // groups of replicas first, followed by the primary instance. - REPLICA_INCLUDED_MAINTENANCE = 2; - - // Indicates that the standalone instance is undergoing maintenance, initiated - // by self-service. The instance can be either a primary instance or a - // replica. - INSTANCE_SELF_SERVICE_MAINTENANCE = 3; - - // Indicates that the primary instance and all of its replicas are undergoing - // maintenance, initiated by self-service. Maintenance is performed on groups - // of replicas first, followed by the primary instance. - REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE = 4; -} - -// The sub operation type based on the operation type. -message SqlSubOperationType { - // Sub operation details corresponding to the operation type. - oneof sub_operation_details { - // The type of maintenance to be performed on the instance. - SqlMaintenanceType maintenance_type = 1; - } -} - -// An Operation resource. For successful operations that return an -// Operation resource, only the fields relevant to the operation are populated -// in the resource. -message Operation { - // The type of Cloud SQL operation. - enum SqlOperationType { - // Unknown operation type. - SQL_OPERATION_TYPE_UNSPECIFIED = 0; - - // Imports data into a Cloud SQL instance. - IMPORT = 1; - - // Exports data from a Cloud SQL instance to a Cloud Storage - // bucket. - EXPORT = 2; - - // Creates a new Cloud SQL instance. - CREATE = 3; - - // Updates the settings of a Cloud SQL instance. - UPDATE = 4; - - // Deletes a Cloud SQL instance. - DELETE = 5; - - // Restarts the Cloud SQL instance. - RESTART = 6; - - BACKUP = 7 [deprecated = true]; - - SNAPSHOT = 8 [deprecated = true]; - - // Performs instance backup. - BACKUP_VOLUME = 9; - - // Deletes an instance backup. - DELETE_VOLUME = 10; - - // Restores an instance backup. - RESTORE_VOLUME = 11; - - // Injects a privileged user in mysql for MOB instances. - INJECT_USER = 12; - - // Clones a Cloud SQL instance. - CLONE = 14; - - // Stops replication on a Cloud SQL read replica instance. - STOP_REPLICA = 15; - - // Starts replication on a Cloud SQL read replica instance. - START_REPLICA = 16; - - // Promotes a Cloud SQL replica instance. - PROMOTE_REPLICA = 17; - - // Creates a Cloud SQL replica instance. - CREATE_REPLICA = 18; - - // Creates a new user in a Cloud SQL instance. - CREATE_USER = 19; - - // Deletes a user from a Cloud SQL instance. - DELETE_USER = 20; - - // Updates an existing user in a Cloud SQL instance. If a user with the - // specified username doesn't exist, a new user is created. - UPDATE_USER = 21; - - // Creates a database in the Cloud SQL instance. - CREATE_DATABASE = 22; - - // Deletes a database in the Cloud SQL instance. - DELETE_DATABASE = 23; - - // Updates a database in the Cloud SQL instance. - UPDATE_DATABASE = 24; - - // Performs failover of an HA-enabled Cloud SQL - // failover replica. - FAILOVER = 25; - - // Deletes the backup taken by a backup run. - DELETE_BACKUP = 26; - - RECREATE_REPLICA = 27; - - // Truncates a general or slow log table in MySQL. - TRUNCATE_LOG = 28; - - // Demotes the stand-alone instance to be a Cloud SQL - // read replica for an external database server. - DEMOTE_MASTER = 29; - - // Indicates that the instance is currently in maintenance. Maintenance - // typically causes the instance to be unavailable for 1-3 minutes. - MAINTENANCE = 30; - - // This field is deprecated, and will be removed in future version of API. - ENABLE_PRIVATE_IP = 31 [deprecated = true]; - - DEFER_MAINTENANCE = 32 [deprecated = true]; - - // Creates clone instance. - CREATE_CLONE = 33 [deprecated = true]; - - // Reschedule maintenance to another time. - RESCHEDULE_MAINTENANCE = 34; - - // Starts external sync of a Cloud SQL EM replica to an external primary - // instance. - START_EXTERNAL_SYNC = 35; - - // Recovers logs from an instance's old data disk. - LOG_CLEANUP = 36; - - // Performs auto-restart of an HA-enabled Cloud SQL database for auto - // recovery. - AUTO_RESTART = 37; - - // Re-encrypts CMEK instances with latest key version. - REENCRYPT = 38; - - // Switches the roles of the primary and replica pair. The target instance - // should be the replica. - SWITCHOVER = 39; - - // Update a backup. - UPDATE_BACKUP = 40; - - // Acquire a lease for the setup of SQL Server Reporting Services (SSRS). - ACQUIRE_SSRS_LEASE = 42; - - // Release a lease for the setup of SQL Server Reporting Services (SSRS). - RELEASE_SSRS_LEASE = 43; - - // Reconfigures old primary after a promote replica operation. Effect of a - // promote operation to the old primary is executed in this operation, - // asynchronously from the promote replica operation executed to the - // replica. - RECONFIGURE_OLD_PRIMARY = 44; - - // Indicates that the instance, its read replicas, and its cascading - // replicas are in maintenance. Maintenance typically gets initiated on - // groups of replicas first, followed by the primary instance. For each - // instance, maintenance typically causes the instance to be unavailable for - // 1-3 minutes. - CLUSTER_MAINTENANCE = 45 [deprecated = true]; - - // Indicates that the instance (and any of its replicas) are currently in - // maintenance. This is initiated as a self-service request by using SSM. - // Maintenance typically causes the instance to be unavailable for 1-3 - // minutes. - SELF_SERVICE_MAINTENANCE = 46 [deprecated = true]; - - // Switches a primary instance to a replica. This operation runs as part of - // a switchover operation to the original primary instance. - SWITCHOVER_TO_REPLICA = 47; - - // Updates the major version of a Cloud SQL instance. - MAJOR_VERSION_UPGRADE = 48; - - // Deprecated: ADVANCED_BACKUP is deprecated. Use ENHANCED_BACKUP instead. - ADVANCED_BACKUP = 49 [deprecated = true]; - - // Changes the BackupTier of a Cloud SQL instance. - MANAGE_BACKUP = 50; - - // Creates a backup for an Enhanced BackupTier Cloud SQL instance. - ENHANCED_BACKUP = 51; - - // Repairs entire read pool or specified read pool nodes in the read pool. - REPAIR_READ_POOL = 52; - - // Creates a Cloud SQL read pool instance. - CREATE_READ_POOL = 53; - - // Pre-checks the major version upgrade operation. - PRE_CHECK_MAJOR_VERSION_UPGRADE = 54; - } - - // The status of an operation. - enum SqlOperationStatus { - // The state of the operation is unknown. - SQL_OPERATION_STATUS_UNSPECIFIED = 0; - - // The operation has been queued, but has not started yet. - PENDING = 1; - - // The operation is running. - RUNNING = 2; - - // The operation completed. - DONE = 3; - } - - // This is always `sql#operation`. - string kind = 1; - - string target_link = 2; - - // The status of an operation. - SqlOperationStatus status = 3; - - // The email address of the user who initiated this operation. - string user = 4; - - // The time this operation was enqueued in UTC timezone in [RFC - // 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp insert_time = 5; - - // The time this operation actually started in UTC timezone in [RFC - // 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp start_time = 6; - - // The time this operation finished in UTC timezone in [RFC - // 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp end_time = 7; - - // If errors occurred during processing of this operation, this field will be - // populated. - OperationErrors error = 8; - - // An Admin API warning message. - ApiWarning api_warning = 19; - - // The type of the operation. Valid values are: - // * `CREATE` - // * `DELETE` - // * `UPDATE` - // * `RESTART` - // * `IMPORT` - // * `EXPORT` - // * `BACKUP_VOLUME` - // * `RESTORE_VOLUME` - // * `CREATE_USER` - // * `DELETE_USER` - // * `CREATE_DATABASE` - // * `DELETE_DATABASE` - SqlOperationType operation_type = 9; - - // The context for import operation, if applicable. - ImportContext import_context = 10; - - // The context for export operation, if applicable. - ExportContext export_context = 11; - - // The context for backup operation, if applicable. - BackupContext backup_context = 17; - - // This field is only populated when the operation_type is - // PRE_CHECK_MAJOR_VERSION_UPGRADE. - // The PreCheckMajorVersionUpgradeContext message itself contains the details - // for that pre-check, such as the target database version for the upgrade - // and the results of the check (including any warnings or errors found). - PreCheckMajorVersionUpgradeContext pre_check_major_version_upgrade_context = - 50; - - // An identifier that uniquely identifies the operation. You can use this - // identifier to retrieve the Operations resource that has information about - // the operation. - string name = 12; - - // Name of the resource on which this operation runs. - string target_id = 13; - - // The URI of this resource. - string self_link = 14; - - // The project ID of the target instance related to this operation. - string target_project = 15; - - // The context for acquire SSRS lease operation, if applicable. - AcquireSsrsLeaseContext acquire_ssrs_lease_context = 20; - - // Optional. The sub operation based on the operation type. - SqlSubOperationType sub_operation_type = 48 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Database instance operation error. -message OperationError { - // This is always `sql#operationError`. - string kind = 1; - - // Identifies the specific error that occurred. - string code = 2; - - // Additional information about the error encountered. - string message = 3; -} - -// Database instance operation errors list wrapper. -message OperationErrors { - // This is always `sql#operationErrors`. - string kind = 1; - - // The list of errors encountered while processing this operation. - repeated OperationError errors = 2; -} - -// Database instance local user password validation policy. -// This message defines the password policy for local database users. -// When enabled, it enforces constraints on password complexity, length, -// and reuse. Keep this policy enabled to help prevent unauthorized access. -message PasswordValidationPolicy { - // The complexity choices of the password. - enum Complexity { - // Complexity check is not specified. - COMPLEXITY_UNSPECIFIED = 0; - - // A combination of lowercase, uppercase, numeric, and non-alphanumeric - // characters. - COMPLEXITY_DEFAULT = 1; - } - - // Minimum number of characters allowed. - google.protobuf.Int32Value min_length = 1; - - // The complexity of the password. - Complexity complexity = 2; - - // Number of previous passwords that cannot be reused. - google.protobuf.Int32Value reuse_interval = 3; - - // Disallow username as a part of the password. - google.protobuf.BoolValue disallow_username_substring = 4; - - // Minimum interval after which the password can be changed. This flag is only - // supported for PostgreSQL. - google.protobuf.Duration password_change_interval = 5; - - // Whether to enable the password policy or not. When enabled, passwords must - // meet complexity requirements. Keep this policy enabled to help prevent - // unauthorized access. Disabling this policy allows weak passwords. - google.protobuf.BoolValue enable_password_policy = 6; - - // This field is deprecated and will be removed in a future version of the - // API. - google.protobuf.BoolValue disallow_compromised_credentials = 7 - [deprecated = true]; -} - -// Data cache configurations. -message DataCacheConfig { - // Whether data cache is enabled for the instance. - bool data_cache_enabled = 1; -} - -// Config used to determine the final backup settings for the instance. -message FinalBackupConfig { - // Whether the final backup is enabled for the instance. - optional bool enabled = 1; - - // The number of days to retain the final backup after the instance deletion. - // The final backup will be purged at (time_of_instance_deletion + - // retention_days). - optional int32 retention_days = 3; -} - -// Database instance settings. -message Settings { - // Specifies when the instance is activated. - enum SqlActivationPolicy { - // Unknown activation plan. - SQL_ACTIVATION_POLICY_UNSPECIFIED = 0; - - // The instance is always up and running. - ALWAYS = 1; - - // The instance never starts. - NEVER = 2; - - // The instance starts upon receiving requests. - ON_DEMAND = 3 [deprecated = true]; - } - - // The edition of the instance. - enum Edition { - // The instance did not specify the edition. - EDITION_UNSPECIFIED = 0; - - // The instance is an enterprise edition. - ENTERPRISE = 2; - - // The instance is an Enterprise Plus edition. - ENTERPRISE_PLUS = 3; - } - - // The options for enforcing Cloud SQL connectors in the instance. - enum ConnectorEnforcement { - // The requirement for Cloud SQL connectors is unknown. - CONNECTOR_ENFORCEMENT_UNSPECIFIED = 0; - - // Do not require Cloud SQL connectors. - NOT_REQUIRED = 1; - - // Require all connections to use Cloud SQL connectors, including the - // Cloud SQL Auth Proxy and Cloud SQL Java, Python, and Go connectors. - // Note: This disables all existing authorized networks. - REQUIRED = 2; - } - - // ExecuteSql API's access to the instance. - enum DataApiAccess { - // Unspecified, effectively the same as `DISALLOW_DATA_API`. - DATA_API_ACCESS_UNSPECIFIED = 0; - - // Disallow using ExecuteSql API to connect to the instance. - DISALLOW_DATA_API = 1; - - // Allow using ExecuteSql API to connect to the instance. For private IP - // instances, this allows authorized users to access the instance from - // the public internet using ExecuteSql API. - ALLOW_DATA_API = 2; - } - - // The version of instance settings. This is a required field for update - // method to make sure concurrent updates are handled properly. During update, - // use the most recent settingsVersion value for this instance and do not try - // to update this value. - google.protobuf.Int64Value settings_version = 1; - - // The App Engine app IDs that can access this instance. - // (Deprecated) Applied to First Generation instances only. - repeated string authorized_gae_applications = 2 [deprecated = true]; - - // The tier (or machine type) for this instance, for example - // `db-custom-1-3840`. WARNING: Changing this restarts the instance. - string tier = 3; - - // This is always `sql#settings`. - string kind = 4; - - // User-provided labels, represented as a dictionary where each label is a - // single key value pair. - map user_labels = 5; - - // Availability type. Potential values: - // * `ZONAL`: The instance serves data from only one zone. Outages in that - // zone affect data accessibility. - // * `REGIONAL`: The instance can serve data from more than one zone in a - // region (it is highly available)./ - // - // For more information, see [Overview of the High Availability - // Configuration](https://cloud.google.com/sql/docs/mysql/high-availability). - SqlAvailabilityType availability_type = 6; - - // The pricing plan for this instance. This can be either `PER_USE` or - // `PACKAGE`. Only `PER_USE` is supported for Second Generation instances. - SqlPricingPlan pricing_plan = 7; - - // The type of replication this instance uses. This can be either - // `ASYNCHRONOUS` or `SYNCHRONOUS`. (Deprecated) This property was only - // applicable to First Generation instances. - SqlReplicationType replication_type = 8 [deprecated = true]; - - // The maximum size to which storage capacity can be automatically increased. - // The default value is 0, which specifies that there is no limit. - google.protobuf.Int64Value storage_auto_resize_limit = 9; - - // The activation policy specifies when the instance is activated; it is - // applicable only when the instance state is RUNNABLE. Valid values: - // * `ALWAYS`: The instance is on, and remains so even in the absence of - // connection requests. - // * `NEVER`: The instance is off; it is not activated, even if a - // connection request arrives. - SqlActivationPolicy activation_policy = 10; - - // The settings for IP Management. This allows to enable or disable the - // instance IP and manage which external networks can connect to the instance. - // The IPv4 address cannot be disabled for Second Generation instances. - IpConfiguration ip_configuration = 11; - - // Configuration to increase storage size automatically. The default value is - // true. - google.protobuf.BoolValue storage_auto_resize = 12; - - // The location preference settings. This allows the instance to be located as - // near as possible to either an App Engine app or Compute Engine zone for - // better performance. App Engine co-location was only applicable to First - // Generation instances. - LocationPreference location_preference = 13; - - // The database flags passed to the instance at startup. - repeated DatabaseFlags database_flags = 14; - - // The type of data disk: `PD_SSD` (default) or `PD_HDD`. Not used for - // First Generation instances. - SqlDataDiskType data_disk_type = 15; - - // The maintenance window for this instance. This specifies when the instance - // can be restarted for maintenance purposes. - MaintenanceWindow maintenance_window = 16; - - // The daily backup configuration for the instance. - BackupConfiguration backup_configuration = 17; - - // Configuration specific to read replica instances. Indicates whether - // replication is enabled or not. WARNING: Changing this restarts the - // instance. - google.protobuf.BoolValue database_replication_enabled = 18; - - // Configuration specific to read replica instances. Indicates whether - // database flags for crash-safe replication are enabled. This property was - // only applicable to First Generation instances. - google.protobuf.BoolValue crash_safe_replication_enabled = 19 - [deprecated = true]; - - // The size of data disk, in GB. The data disk size minimum is 10GB. - google.protobuf.Int64Value data_disk_size_gb = 20; - - // Active Directory configuration, relevant only for Cloud SQL for SQL Server. - SqlActiveDirectoryConfig active_directory_config = 22; - - // The name of server Instance collation. - string collation = 23; - - // Deny maintenance periods - repeated DenyMaintenancePeriod deny_maintenance_periods = 24; - - // Insights configuration, for now relevant only for Postgres. - InsightsConfig insights_config = 25; - - // The local user password validation policy of the instance. - PasswordValidationPolicy password_validation_policy = 27; - - // SQL Server specific audit configuration. - SqlServerAuditConfig sql_server_audit_config = 29; - - // Optional. The edition of the instance. - Edition edition = 38 [(google.api.field_behavior) = OPTIONAL]; - - // Specifies if connections must use Cloud SQL connectors. - // Option values include the following: `NOT_REQUIRED` (Cloud SQL instances - // can be connected without Cloud SQL - // Connectors) and `REQUIRED` (Only allow connections that use Cloud SQL - // Connectors). - // - // Note that using REQUIRED disables all existing authorized networks. If - // this field is not specified when creating a new instance, NOT_REQUIRED is - // used. If this field is not specified when patching or updating an existing - // instance, it is left unchanged in the instance. - ConnectorEnforcement connector_enforcement = 32; - - // Configuration to protect against accidental instance deletion. - google.protobuf.BoolValue deletion_protection_enabled = 33; - - // Server timezone, relevant only for Cloud SQL for SQL Server. - string time_zone = 34; - - // Specifies advanced machine configuration for the instances relevant only - // for SQL Server. - AdvancedMachineFeatures advanced_machine_features = 35; - - // Configuration for data cache. - DataCacheConfig data_cache_config = 37; - - // Optional. Configuration value for recreation of replica after certain - // replication lag - google.protobuf.Int32Value replication_lag_max_seconds = 39 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When this parameter is set to true, Cloud SQL instances can - // connect to Vertex AI to pass requests for real-time predictions and - // insights to the AI. The default value is false. This applies only to Cloud - // SQL for MySQL and Cloud SQL for PostgreSQL instances. - google.protobuf.BoolValue enable_google_ml_integration = 40 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. By default, Cloud SQL instances have schema extraction disabled - // for Dataplex. When this parameter is set to true, schema extraction for - // Dataplex on Cloud SQL instances is activated. - google.protobuf.BoolValue enable_dataplex_integration = 41 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When this parameter is set to true, Cloud SQL retains backups of - // the instance even after the instance is deleted. The ON_DEMAND backup will - // be retained until customer deletes the backup or the project. The AUTOMATED - // backup will be retained based on the backups retention setting. - google.protobuf.BoolValue retain_backups_on_delete = 42 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Provisioned number of I/O operations per second for the data - // disk. This field is only used for hyperdisk-balanced disk types. - optional int64 data_disk_provisioned_iops = 43 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Provisioned throughput measured in MiB per second for the data - // disk. This field is only used for hyperdisk-balanced disk types. - optional int64 data_disk_provisioned_throughput = 44 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The managed connection pooling configuration for the instance. - optional ConnectionPoolConfig connection_pool_config = 45 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The final backup configuration for the instance. - optional FinalBackupConfig final_backup_config = 47 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The read pool auto-scale configuration for the instance. - optional ReadPoolAutoScaleConfig read_pool_auto_scale_config = 48 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether the replica is in accelerated mode. This feature is in - // private preview and requires allowlisting to take effect. - google.protobuf.BoolValue accelerated_replica_mode = 49 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Cloud SQL for MySQL auto-upgrade configuration. When this - // parameter is set to true, auto-upgrade is enabled for MySQL 8.0 minor - // versions. The MySQL version must be 8.0.35 or higher. - optional bool auto_upgrade_enabled = 50 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Microsoft Entra ID configuration for the SQL Server instance. - SqlServerEntraIdConfig entraid_config = 52 - [(google.api.field_behavior) = OPTIONAL]; - - // This parameter controls whether to allow using ExecuteSql API to connect to - // the instance. Not allowed by default. - optional DataApiAccess data_api_access = 53; - - // Optional. Configuration for Performance Capture, provides diagnostic - // metrics during high load situations. - PerformanceCaptureConfig performance_capture_config = 54 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Performance capture configuration. -message PerformanceCaptureConfig { - // Optional. Enables or disables the performance capture feature. - optional bool enabled = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the interval in seconds between consecutive probes that - // check if any trigger condition thresholds have been reached. - optional int32 probing_interval_seconds = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the minimum number of consecutive probe threshold that - // triggers performance capture. - optional int32 probe_threshold = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the minimum number of MySQL `Threads_running` to - // trigger the performance capture on the primary instance. - optional int32 running_threads_threshold = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the minimum number of seconds replica must be lagging - // behind primary instance to trigger the performance capture on replica. - optional int32 seconds_behind_source_threshold = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the amount of time in seconds that a transaction needs - // to have been open before the watcher starts recording it. - optional int32 transaction_duration_threshold = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Connection pool flags for Cloud SQL instances managed connection pool -// configuration. -message ConnectionPoolFlags { - // Required. The name of the flag. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The value of the flag. Boolean flags are set to `on` for true - // and `off` for false. This field must be omitted if the flag - // doesn't take a value. - string value = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The managed connection pooling configuration. -message ConnectionPoolConfig { - // Whether managed connection pooling is enabled. - optional bool connection_pooling_enabled = 1; - - // Optional. List of connection pool configuration flags. - repeated ConnectionPoolFlags flags = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Number of connection poolers. - optional int32 pooler_count = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The read pool auto-scale configuration. -message ReadPoolAutoScaleConfig { - // Target metric for read pool auto scaling. - message TargetMetric { - // The metric name to be used for auto scaling. - optional string metric = 1; - - // The target value for the metric. - optional float target_value = 2; - } - - // Indicates whether read pool auto scaling is enabled. - optional bool enabled = 1; - - // Minimum number of read pool nodes to be maintained. - optional int32 min_node_count = 2; - - // Maximum number of read pool nodes to be maintained. - optional int32 max_node_count = 3; - - // Optional. Target metrics for read pool auto scaling. - repeated TargetMetric target_metrics = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Indicates whether read pool auto scaling supports scale in operations - // (removing nodes). - optional bool disable_scale_in = 5; - - // The cooldown period for scale-in operations. - optional int32 scale_in_cooldown_seconds = 6; - - // The cooldown period for scale-out operations. - optional int32 scale_out_cooldown_seconds = 7; -} - -// Specifies options for controlling advanced machine features. -message AdvancedMachineFeatures { - // The number of threads per physical core. - int32 threads_per_core = 1; -} - -// SslCerts Resource -message SslCert { - // This is always `sql#sslCert`. - string kind = 1; - - // Serial number, as extracted from the certificate. - string cert_serial_number = 2; - - // PEM representation. - string cert = 3; - - // The time when the certificate was created in [RFC - // 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z` - google.protobuf.Timestamp create_time = 4; - - // User supplied name. Constrained to [a-zA-Z.-_ ]+. - string common_name = 5; - - // The time when the certificate expires in [RFC - // 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp expiration_time = 6; - - // Sha1 Fingerprint. - string sha1_fingerprint = 7; - - // Name of the database instance. - string instance = 8; - - // The URI of this resource. - string self_link = 9; -} - -// SslCertDetail. -message SslCertDetail { - // The public information about the cert. - SslCert cert_info = 1; - - // The private key for the client cert, in pem format. Keep private in order - // to protect your security. - string cert_private_key = 2; -} - -// Active Directory configuration, relevant only for Cloud SQL for SQL Server. -message SqlActiveDirectoryConfig { - // The modes of Active Directory configuration. - enum ActiveDirectoryMode { - // Unspecified mode. Will default to MANAGED_ACTIVE_DIRECTORY if the mode is - // not specified to maintain backward compatibility. - ACTIVE_DIRECTORY_MODE_UNSPECIFIED = 0; - - // Managed Active Directory mode. - MANAGED_ACTIVE_DIRECTORY = 1; - - // Deprecated: Use CUSTOMER_MANAGED_ACTIVE_DIRECTORY instead. - SELF_MANAGED_ACTIVE_DIRECTORY = 2 [deprecated = true]; - - // Customer-managed Active Directory mode. - CUSTOMER_MANAGED_ACTIVE_DIRECTORY = 3; - } - - // This is always sql#activeDirectoryConfig. - string kind = 1; - - // The name of the domain (e.g., mydomain.com). - string domain = 2; - - // Optional. The mode of the Active Directory configuration. - ActiveDirectoryMode mode = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Domain controller IPv4 addresses used to bootstrap Active - // Directory. - repeated string dns_servers = 4 [ - (google.api.field_info).format = IPV4, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. The secret manager key storing the administrator credential. - // (e.g., projects/{project}/secrets/{secret}). - string admin_credential_secret_name = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The organizational unit distinguished name. This is the full - // hierarchical path to the organizational unit. - string organizational_unit = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// SQL Server specific audit configuration. -message SqlServerAuditConfig { - // This is always sql#sqlServerAuditConfig - string kind = 1; - - // The name of the destination bucket (e.g., gs://mybucket). - string bucket = 2; - - // How long to keep generated audit files. - google.protobuf.Duration retention_interval = 3; - - // How often to upload generated audit files. - google.protobuf.Duration upload_interval = 4; -} - -// SQL Server Entra ID configuration. -message SqlServerEntraIdConfig { - // Output only. This is always sql#sqlServerEntraIdConfig - string kind = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The tenant ID for the Entra ID configuration. - string tenant_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The application ID for the Entra ID configuration. - string application_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -enum SqlBackendType { - // This is an unknown backend type for instance. - SQL_BACKEND_TYPE_UNSPECIFIED = 0; - - // V1 speckle instance. - FIRST_GEN = 1 [deprecated = true]; - - // V2 speckle instance. - SECOND_GEN = 2; - - // On premises instance. - EXTERNAL = 3; -} - -enum SqlIpAddressType { - // This is an unknown IP address type. - SQL_IP_ADDRESS_TYPE_UNSPECIFIED = 0; - - // IP address the customer is supposed to connect to. Usually this is the - // load balancer's IP address - PRIMARY = 1; - - // Source IP address of the connection a read replica establishes to its - // external primary instance. This IP address can be allowlisted by the - // customer in case it has a firewall that filters incoming connection to its - // on premises primary instance. - OUTGOING = 2; - - // Private IP used when using private IPs and network peering. - PRIVATE = 3; - - // V1 IP of a migrated instance. We want the user to - // decommission this IP as soon as the migration is complete. - // Note: V1 instances with V1 ip addresses will be counted as PRIMARY. - MIGRATED_1ST_GEN = 4; -} - -// The database engine type and version. -enum SqlDatabaseVersion { - // This is an unknown database version. - SQL_DATABASE_VERSION_UNSPECIFIED = 0; - - // The database version is MySQL 5.1. - MYSQL_5_1 = 2 [deprecated = true]; - - // The database version is MySQL 5.5. - MYSQL_5_5 = 3 [deprecated = true]; - - // The database version is MySQL 5.6. - MYSQL_5_6 = 5; - - // The database version is MySQL 5.7. - MYSQL_5_7 = 6; - - // The database version is MySQL 8. - MYSQL_8_0 = 20; - - // The database major version is MySQL 8.0 and the minor version is 18. - MYSQL_8_0_18 = 41; - - // The database major version is MySQL 8.0 and the minor version is 26. - MYSQL_8_0_26 = 85; - - // The database major version is MySQL 8.0 and the minor version is 27. - MYSQL_8_0_27 = 111; - - // The database major version is MySQL 8.0 and the minor version is 28. - MYSQL_8_0_28 = 132; - - // The database major version is MySQL 8.0 and the minor version is 29. - MYSQL_8_0_29 = 148 [deprecated = true]; - - // The database major version is MySQL 8.0 and the minor version is 30. - MYSQL_8_0_30 = 174; - - // The database major version is MySQL 8.0 and the minor version is 31. - MYSQL_8_0_31 = 197; - - // The database major version is MySQL 8.0 and the minor version is 32. - MYSQL_8_0_32 = 213; - - // The database major version is MySQL 8.0 and the minor version is 33. - MYSQL_8_0_33 = 238; - - // The database major version is MySQL 8.0 and the minor version is 34. - MYSQL_8_0_34 = 239; - - // The database major version is MySQL 8.0 and the minor version is 35. - MYSQL_8_0_35 = 240; - - // The database major version is MySQL 8.0 and the minor version is 36. - MYSQL_8_0_36 = 241; - - // The database major version is MySQL 8.0 and the minor version is 37. - MYSQL_8_0_37 = 355; - - // The database major version is MySQL 8.0 and the minor version is 39. - MYSQL_8_0_39 = 357; - - // The database major version is MySQL 8.0 and the minor version is 40. - MYSQL_8_0_40 = 358; - - // The database major version is MySQL 8.0 and the minor version is 41. - MYSQL_8_0_41 = 488; - - // The database major version is MySQL 8.0 and the minor version is 42. - MYSQL_8_0_42 = 489; - - // The database major version is MySQL 8.0 and the minor version is 43. - MYSQL_8_0_43 = 553; - - // The database major version is MySQL 8.0 and the minor version is 44. - MYSQL_8_0_44 = 554; - - // The database major version is MySQL 8.0 and the minor version is 45. - MYSQL_8_0_45 = 555; - - // The database major version is MySQL 8.0 and the minor version is 46. - MYSQL_8_0_46 = 556; - - // The database version is MySQL 8.4. - MYSQL_8_4 = 398; - - // The database version is MySQL 9.7. - MYSQL_9_7 = 654; - - // The database version is SQL Server 2017 Standard. - SQLSERVER_2017_STANDARD = 11; - - // The database version is SQL Server 2017 Enterprise. - SQLSERVER_2017_ENTERPRISE = 14; - - // The database version is SQL Server 2017 Express. - SQLSERVER_2017_EXPRESS = 15; - - // The database version is SQL Server 2017 Web. - SQLSERVER_2017_WEB = 16; - - // The database version is PostgreSQL 9.6. - POSTGRES_9_6 = 9; - - // The database version is PostgreSQL 10. - POSTGRES_10 = 18; - - // The database version is PostgreSQL 11. - POSTGRES_11 = 10; - - // The database version is PostgreSQL 12. - POSTGRES_12 = 19; - - // The database version is PostgreSQL 13. - POSTGRES_13 = 23; - - // The database version is PostgreSQL 14. - POSTGRES_14 = 110; - - // The database version is PostgreSQL 15. - POSTGRES_15 = 172; - - // The database version is PostgreSQL 16. - POSTGRES_16 = 272; - - // The database version is PostgreSQL 17. - POSTGRES_17 = 408; - - // The database version is PostgreSQL 18. - POSTGRES_18 = 557; - - // The database version is PostgreSQL 19. - POSTGRES_19 = 684; - - // The database version is SQL Server 2019 Standard. - SQLSERVER_2019_STANDARD = 26; - - // The database version is SQL Server 2019 Enterprise. - SQLSERVER_2019_ENTERPRISE = 27; - - // The database version is SQL Server 2019 Express. - SQLSERVER_2019_EXPRESS = 28; - - // The database version is SQL Server 2019 Web. - SQLSERVER_2019_WEB = 29; - - // The database version is SQL Server 2022 Standard. - SQLSERVER_2022_STANDARD = 199; - - // The database version is SQL Server 2022 Enterprise. - SQLSERVER_2022_ENTERPRISE = 200; - - // The database version is SQL Server 2022 Express. - SQLSERVER_2022_EXPRESS = 201; - - // The database version is SQL Server 2022 Web. - SQLSERVER_2022_WEB = 202; - - // The database version is SQL Server 2025 Standard. - SQLSERVER_2025_STANDARD = 549; - - // The database version is SQL Server 2025 Enterprise. - SQLSERVER_2025_ENTERPRISE = 550; - - // The database version is SQL Server 2025 Express. - SQLSERVER_2025_EXPRESS = 551; -} - -// The pricing plan for this instance. -enum SqlPricingPlan { - // This is an unknown pricing plan for this instance. - SQL_PRICING_PLAN_UNSPECIFIED = 0; - - // The instance is billed at a monthly flat rate. - PACKAGE = 1; - - // The instance is billed per usage. - PER_USE = 2; -} - -enum SqlReplicationType { - // This is an unknown replication type for a Cloud SQL instance. - SQL_REPLICATION_TYPE_UNSPECIFIED = 0; - - // The synchronous replication mode for First Generation instances. It is the - // default value. - SYNCHRONOUS = 1; - - // The asynchronous replication mode for First Generation instances. It - // provides a slight performance gain, but if an outage occurs while this - // option is set to asynchronous, you can lose up to a few seconds of updates - // to your data. - ASYNCHRONOUS = 2; -} - -// The type of disk that is used for a v2 instance to use. -enum SqlDataDiskType { - // This is an unknown data disk type. - SQL_DATA_DISK_TYPE_UNSPECIFIED = 0; - - // An SSD data disk. - PD_SSD = 1; - - // An HDD data disk. - PD_HDD = 2; - - // This field is deprecated and will be removed from a future version of the - // API. - OBSOLETE_LOCAL_SSD = 3 [deprecated = true]; - - // A Hyperdisk Balanced data disk. - HYPERDISK_BALANCED = 4; -} - -// The availability type of the given Cloud SQL instance. -enum SqlAvailabilityType { - // This is an unknown Availability type. - SQL_AVAILABILITY_TYPE_UNSPECIFIED = 0; - - // Zonal available instance. - ZONAL = 1; - - // Regional available instance. - REGIONAL = 2; -} - -enum SqlUpdateTrack { - // This is an unknown maintenance timing preference. - SQL_UPDATE_TRACK_UNSPECIFIED = 0; - - // For an instance with a scheduled maintenance window, this maintenance - // timing indicates that the maintenance update is scheduled 7 to 14 days - // after the notification is sent out. Also referred to as `Week 1` (Console) - // and `preview` (gcloud CLI). - canary = 1; - - // For an instance with a scheduled maintenance window, this maintenance - // timing indicates that the maintenance update is scheduled 15 to 21 days - // after the notification is sent out. Also referred to as `Week 2` (Console) - // and `production` (gcloud CLI). - stable = 2; - - // For instance with a scheduled maintenance window, this maintenance - // timing indicates that the maintenance update is scheduled 35 to 42 days - // after the notification is sent out. - week5 = 3; -} - -// Acquire SSRS lease context. -message AcquireSsrsLeaseContext { - // The username to be used as the setup login to connect to the database - // server for SSRS setup. - optional string setup_login = 1; - - // The username to be used as the service login to connect to the report - // database for SSRS setup. - optional string service_login = 2; - - // The report database to be used for SSRS setup. - optional string report_database = 3; - - // Lease duration needed for SSRS setup. - optional google.protobuf.Duration duration = 4; -} - -// DNS metadata. -message DnsNameMapping { - // The connection type of the DNS name. - // This enum is not frozen, and new values may be added in the future. - enum ConnectionType { - // Unknown connection type. - CONNECTION_TYPE_UNSPECIFIED = 0; - - // Public IP. - PUBLIC = 1; - - // Private services access (private IP). - PRIVATE_SERVICES_ACCESS = 2; - - // Private Service Connect. - PRIVATE_SERVICE_CONNECT = 3; - } - - // The scope that the DNS name applies to. - enum DnsScope { - // DNS scope not set. This value should not be used. - DNS_SCOPE_UNSPECIFIED = 0; - - // Indicates an instance-level DNS name. - INSTANCE = 1; - - // Indicates a cluster-level DNS name. - CLUSTER = 2; - } - - // The system responsible for managing the DNS record. - enum RecordManager { - // Record manager not set. This value should not be used. - RECORD_MANAGER_UNSPECIFIED = 0; - - // The record may be managed by the customer. It is not automatically - // managed by Cloud SQL automation. - CUSTOMER = 1; - - // The record is managed by Cloud SQL, which will create, update, - // and delete the DNS records for the zone automatically when - // the Cloud SQL database instance is created or updated. - CLOUD_SQL_AUTOMATION = 2; - } - - // Output only. The DNS name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The connection type of the DNS name. - ConnectionType connection_type = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The scope that the DNS name applies to. - DnsScope dns_scope = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The manager for this DNS record. - RecordManager record_manager = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto deleted file mode 100644 index 1a39afd1c8bf..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/cloud/sql/v1/cloud_sql_resources.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlSslCertsProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service to manage SSL certs for Cloud SQL instances. -service SqlSslCertsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Deletes the SSL certificate. For First Generation instances, the - // certificate remains valid until the instance is restarted. - rpc Delete(SqlSslCertsDeleteRequest) returns (Operation) { - option (google.api.http) = { - delete: "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - }; - } - - // Retrieves a particular SSL certificate. Does not include the private key - // (required for usage). The private key must be saved from the response to - // initial creation. - rpc Get(SqlSslCertsGetRequest) returns (SslCert) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - }; - } - - // Creates an SSL certificate and returns it along with the private key and - // server certificate authority. The new certificate will not be usable until - // the instance is restarted. - rpc Insert(SqlSslCertsInsertRequest) returns (SslCertsInsertResponse) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/sslCerts" - body: "body" - }; - } - - // Lists all of the current SSL certificates for the instance. - rpc List(SqlSslCertsListRequest) returns (SslCertsListResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/sslCerts" - }; - } -} - -message SqlSslCertsDeleteRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Sha1 FingerPrint. - string sha1_fingerprint = 3; -} - -message SqlSslCertsGetRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Sha1 FingerPrint. - string sha1_fingerprint = 3; -} - -message SqlSslCertsInsertRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - SslCertsInsertRequest body = 100; -} - -message SqlSslCertsListRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -// SslCerts insert request. -message SslCertsInsertRequest { - // User supplied name. Must be a distinct name from the other certificates - // for this instance. - string common_name = 1; -} - -// SslCert insert response. -message SslCertsInsertResponse { - // This is always `sql#sslCertsInsert`. - string kind = 1; - - // The operation to track the ssl certs insert request. - Operation operation = 2; - - // The server Certificate Authority's certificate. If this is missing you can - // force a new one to be generated by calling resetSslConfig method on - // instances resource. - SslCert server_ca_cert = 3; - - // The new client certificate and private key. - SslCertDetail client_cert = 4; -} - -// SslCerts list response. -message SslCertsListResponse { - // This is always `sql#sslCertsList`. - string kind = 1; - - // List of client certificates for the instance. - repeated SslCert items = 2; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_tiers.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_tiers.proto deleted file mode 100644 index 42bec043bef0..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_tiers.proto +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlTiersProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Service for providing machine types (tiers) for Cloud SQL instances. -service SqlTiersService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Lists all available machine types (tiers) for Cloud SQL, for example, - // `db-custom-1-3840`. For more information, see - // https://cloud.google.com/sql/pricing. - rpc List(SqlTiersListRequest) returns (TiersListResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/tiers" - }; - } -} - -// Tiers list request. -message SqlTiersListRequest { - // Project ID of the project for which to list tiers. - string project = 1; -} - -// Tiers list response. -message TiersListResponse { - // This is always `sql#tiersList`. - string kind = 1; - - // List of tiers. - repeated Tier items = 2; -} - -// A Google Cloud SQL service tier resource. -message Tier { - // An identifier for the machine type, for example, `db-custom-1-3840`. For - // related information, see [Pricing](/sql/pricing). - string tier = 1; - - // The maximum RAM usage of this tier in bytes. - int64 RAM = 2 [json_name = "RAM"]; - - // This is always `sql#tier`. - string kind = 3; - - // The maximum disk size of this tier in bytes. - int64 Disk_Quota = 4 [json_name = "DiskQuota"]; - - // The applicable regions for this tier. - repeated string region = 5; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto deleted file mode 100644 index b74de3516d5b..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/sql/v1/cloud_sql_resources.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlUsersProto"; -option java_package = "com.google.cloud.sql.v1"; - -// Cloud SQL users service. -service SqlUsersService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Deletes a user from a Cloud SQL instance. - rpc Delete(SqlUsersDeleteRequest) returns (Operation) { - option (google.api.http) = { - delete: "/v1/projects/{project}/instances/{instance}/users" - }; - } - - // Retrieves a resource containing information about a user. - rpc Get(SqlUsersGetRequest) returns (User) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/users/{name}" - }; - } - - // Creates a new user in a Cloud SQL instance. - rpc Insert(SqlUsersInsertRequest) returns (Operation) { - option (google.api.http) = { - post: "/v1/projects/{project}/instances/{instance}/users" - body: "body" - }; - } - - // Lists users in the specified Cloud SQL instance. - rpc List(SqlUsersListRequest) returns (UsersListResponse) { - option (google.api.http) = { - get: "/v1/projects/{project}/instances/{instance}/users" - }; - } - - // Updates an existing user in a Cloud SQL instance. - rpc Update(SqlUsersUpdateRequest) returns (Operation) { - option (google.api.http) = { - put: "/v1/projects/{project}/instances/{instance}/users" - body: "body" - }; - } -} - -message SqlUsersDeleteRequest { - // Host of the user in the instance. - string host = 1; - - // Database instance ID. This does not include the project ID. - string instance = 2; - - // Name of the user in the instance. - string name = 3; - - // Project ID of the project that contains the instance. - string project = 4; -} - -// Request message for Users Get RPC -message SqlUsersGetRequest { - // Database instance ID. This does not include the project ID. - string instance = 1; - - // User of the instance. - string name = 2; - - // Project ID of the project that contains the instance. - string project = 3; - - // Host of a user of the instance. - string host = 4; -} - -message SqlUsersInsertRequest { - // Database instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - User body = 100; -} - -message SqlUsersListRequest { - // Database instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -message SqlUsersUpdateRequest { - // Optional. Host of the user in the instance. - string host = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Database instance ID. This does not include the project ID. - string instance = 2; - - // Name of the user in the instance. - string name = 3; - - // Project ID of the project that contains the instance. - string project = 4; - - // Optional. List of database roles to grant to the user. body.database_roles - // will be ignored for update request. - repeated string database_roles = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies whether to revoke existing roles that are not present - // in the `database_roles` field. If `false` or unset, the database roles - // specified in `database_roles` are added to the user's existing roles. - optional bool revoke_existing_roles = 6 - [(google.api.field_behavior) = OPTIONAL]; - - User body = 100; -} - -// User level password validation policy. -message UserPasswordValidationPolicy { - // Number of failed login attempts allowed before user get locked. - int32 allowed_failed_attempts = 1; - - // Expiration duration after password is updated. - google.protobuf.Duration password_expiration_duration = 2; - - // If true, failed login attempts check will be enabled. - bool enable_failed_attempts_check = 3; - - // Output only. Read-only password status. - PasswordStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // If true, the user must specify the current password before changing the - // password. This flag is supported only for MySQL. - bool enable_password_verification = 5; -} - -// Read-only password status. -message PasswordStatus { - // If true, user does not have login privileges. - bool locked = 1; - - // The expiration time of the current password. - google.protobuf.Timestamp password_expiration_time = 2; -} - -// A Cloud SQL user resource. -message User { - // The user type. - enum SqlUserType { - // The database's built-in user type. - BUILT_IN = 0; - - // Cloud IAM user. - CLOUD_IAM_USER = 1; - - // Cloud IAM service account. - CLOUD_IAM_SERVICE_ACCOUNT = 2; - - // Cloud IAM group. Not used for login. - CLOUD_IAM_GROUP = 3; - - // Read-only. Login for a user that belongs to the Cloud IAM group. - CLOUD_IAM_GROUP_USER = 4; - - // Read-only. Login for a service account that belongs to the - // Cloud IAM group. - CLOUD_IAM_GROUP_SERVICE_ACCOUNT = 5; - - // Microsoft Entra ID user. - ENTRAID_USER = 7; - } - - // The type of retained password. - enum DualPasswordType { - // The default value. - DUAL_PASSWORD_TYPE_UNSPECIFIED = 0; - - // Do not update the user's dual password status. - NO_MODIFY_DUAL_PASSWORD = 1; - - // No dual password usable for connecting using this user. - NO_DUAL_PASSWORD = 2; - - // Dual password usable for connecting using this user. - DUAL_PASSWORD = 3; - } - - // Indicates if a group is available for IAM database authentication. - enum IamStatus { - // The default value for users that are not of type CLOUD_IAM_GROUP. - // Only CLOUD_IAM_GROUP users will be inactive or active. - // Users with an IamStatus of IAM_STATUS_UNSPECIFIED will not - // display whether they are active or inactive as that is not applicable to - // them. - IAM_STATUS_UNSPECIFIED = 0; - - // INACTIVE indicates a group is not available for IAM database - // authentication. - INACTIVE = 1; - - // ACTIVE indicates a group is available for IAM database authentication. - ACTIVE = 2; - } - - // This is always `sql#user`. - string kind = 1; - - // The password for the user. - string password = 2; - - // This field is deprecated and will be removed from a future version of the - // API. - string etag = 3; - - // The name of the user in the Cloud SQL instance. Can be omitted for - // `update` because it is already specified in the URL. - string name = 4; - - // Optional. The host from which the user can connect. For `insert` - // operations, host defaults to an empty string. For `update` - // operations, host is specified as part of the request URL. The host name - // cannot be updated after insertion. For a MySQL instance, it's required; - // for a PostgreSQL or SQL Server instance, it's optional. - string host = 5 [(google.api.field_behavior) = OPTIONAL]; - - // The name of the Cloud SQL instance. This does not include the project ID. - // Can be omitted for `update` because it is already specified on the - // URL. - string instance = 6; - - // The project ID of the project containing the Cloud SQL database. The Google - // apps domain is prefixed if applicable. Can be omitted for `update` because - // it is already specified on the URL. - string project = 7; - - // The user type. It determines the method to authenticate the user during - // login. The default is the database's built-in user type. - SqlUserType type = 8; - - // User details for specific database type - oneof user_details { - SqlServerUserDetails sqlserver_user_details = 9; - } - - // Optional. The full email for an IAM user. For normal database users, this - // will not be filled. Only applicable to MySQL database users. - string iam_email = 11 [(google.api.field_behavior) = OPTIONAL]; - - // User level password validation policy. - UserPasswordValidationPolicy password_policy = 12; - - // Dual password status for the user. - optional DualPasswordType dual_password_type = 13; - - // Indicates if a group is active or inactive for IAM database authentication. - optional IamStatus iam_status = 14; - - // Optional. Role memberships of the user - repeated string database_roles = 15 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents a Sql Server user on the Cloud SQL instance. -message SqlServerUserDetails { - // If the user has been disabled - bool disabled = 1; - - // The server roles for this user - repeated string server_roles = 2; -} - -// User list response. -message UsersListResponse { - // This is always `sql#usersList`. - string kind = 1; - - // List of user resources in the instance. - repeated User items = 2; - - // Unused. - string next_page_token = 3 [deprecated = true]; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql.proto deleted file mode 100644 index ae82a77bea1a..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql.proto +++ /dev/null @@ -1,1739 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1beta4; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/sql/v1beta4/cloud_sql_resources.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlServiceProto"; -option java_package = "com.google.cloud.sql.v1beta4"; - -service SqlBackupRunsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Deletes the backup taken by a backup run. - rpc Delete(SqlBackupRunsDeleteRequest) returns (Operation) { - option (google.api.http) = { - delete: "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" - }; - } - - // Retrieves a resource containing information about a backup run. - rpc Get(SqlBackupRunsGetRequest) returns (BackupRun) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" - }; - } - - // Creates a new backup run on demand. - rpc Insert(SqlBackupRunsInsertRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns" - body: "body" - }; - } - - // Lists all backup runs associated with the project or a given instance and - // configuration in the reverse chronological order of the backup initiation - // time. - rpc List(SqlBackupRunsListRequest) returns (BackupRunsListResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns" - }; - } -} - -service SqlDatabasesService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Deletes a database from a Cloud SQL instance. - rpc Delete(SqlDatabasesDeleteRequest) returns (Operation) { - option (google.api.http) = { - delete: "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" - }; - } - - // Retrieves a resource containing information about a database inside a Cloud - // SQL instance. - rpc Get(SqlDatabasesGetRequest) returns (Database) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" - }; - } - - // Inserts a resource containing information about a database inside a Cloud - // SQL instance. - // - // **Note:** You can't modify the default character set and collation. - rpc Insert(SqlDatabasesInsertRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/databases" - body: "body" - }; - } - - // Lists databases in the specified Cloud SQL instance. - rpc List(SqlDatabasesListRequest) returns (DatabasesListResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/databases" - }; - } - - // Partially updates a resource containing information about a database inside - // a Cloud SQL instance. This method supports patch semantics. - rpc Patch(SqlDatabasesUpdateRequest) returns (Operation) { - option (google.api.http) = { - patch: "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" - body: "body" - }; - } - - // Updates a resource containing information about a database inside a Cloud - // SQL instance. - rpc Update(SqlDatabasesUpdateRequest) returns (Operation) { - option (google.api.http) = { - put: "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" - body: "body" - }; - } -} - -service SqlFlagsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Lists all available database flags for Cloud SQL instances. - rpc List(SqlFlagsListRequest) returns (FlagsListResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/flags" - }; - } -} - -service SqlInstancesService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Add a new trusted Certificate Authority (CA) version for the specified - // instance. Required to prepare for a certificate rotation. If a CA version - // was previously added but never used in a certificate rotation, this - // operation replaces that version. There cannot be more than one CA version - // waiting to be rotated in. For instances that have enabled Certificate - // Authority Service (CAS) based server CA, use AddServerCertificate to add a - // new server certificate. - rpc AddServerCa(SqlInstancesAddServerCaRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCa" - }; - } - - // Add a new trusted server certificate version for the specified instance - // using Certificate Authority Service (CAS) server CA. Required to prepare - // for a certificate rotation. If a server certificate version was previously - // added but never used in a certificate rotation, this operation replaces - // that version. There cannot be more than one certificate version waiting to - // be rotated in. For instances not using CAS server CA, use AddServerCa - // instead. - rpc AddServerCertificate(SqlInstancesAddServerCertificateRequest) - returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCertificate" - }; - } - - // Adds a new Entra ID certificate for the specified instance. If an Entra ID - // certificate was previously added but never used in a certificate rotation, - // this operation replaces that version. - rpc AddEntraIdCertificate(SqlInstancesAddEntraIdCertificateRequest) - returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/addEntraIdCertificate" - }; - } - - // Creates a Cloud SQL instance as a clone of the source instance. Using this - // operation might cause your instance to restart. - rpc Clone(SqlInstancesCloneRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/clone" - body: "body" - }; - } - - // Deletes a Cloud SQL instance. - rpc Delete(SqlInstancesDeleteRequest) returns (Operation) { - option (google.api.http) = { - delete: "/sql/v1beta4/projects/{project}/instances/{instance}" - }; - } - - // Demotes the stand-alone instance to be a Cloud SQL read replica for an - // external database server. - rpc DemoteMaster(SqlInstancesDemoteMasterRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/demoteMaster" - body: "body" - }; - } - - // Demotes an existing standalone instance to be a Cloud SQL read replica - // for an external database server. - rpc Demote(SqlInstancesDemoteRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/demote" - body: "body" - }; - } - - // Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL - // dump or CSV file. - rpc Export(SqlInstancesExportRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/export" - body: "body" - }; - } - - // Initiates a manual failover of a high availability (HA) primary instance - // to a standby instance, which becomes the primary instance. Users are - // then rerouted to the new primary. For more information, see the - // [Overview of high - // availability](https://cloud.google.com/sql/docs/mysql/high-availability) - // page in the Cloud SQL documentation. - // If using Legacy HA (MySQL only), this causes the instance to failover to - // its failover replica instance. - rpc Failover(SqlInstancesFailoverRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/failover" - body: "body" - }; - } - - // Reencrypt CMEK instance with latest key version. - rpc Reencrypt(SqlInstancesReencryptRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/reencrypt" - body: "body" - }; - } - - // Retrieves a resource containing information about a Cloud SQL instance. - rpc Get(SqlInstancesGetRequest) returns (DatabaseInstance) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}" - }; - } - - // Imports data into a Cloud SQL instance from a SQL dump or CSV file in - // Cloud Storage. - rpc Import(SqlInstancesImportRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/import" - body: "body" - }; - } - - // Creates a new Cloud SQL instance. - rpc Insert(SqlInstancesInsertRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances" - body: "body" - }; - } - - // Lists instances under a given project. - rpc List(SqlInstancesListRequest) returns (InstancesListResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances" - }; - } - - // Lists all of the trusted Certificate Authorities (CAs) for the specified - // instance. There can be up to three CAs listed: the CA that was used to sign - // the certificate that is currently in use, a CA that has been added but not - // yet used to sign a certificate, and a CA used to sign a certificate that - // has previously rotated out. - rpc ListServerCas(SqlInstancesListServerCasRequest) - returns (InstancesListServerCasResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCas" - }; - } - - // Lists all versions of server certificates and certificate authorities (CAs) - // for the specified instance. There can be up to three sets of certs listed: - // the certificate that is currently in use, a future that has been added but - // not yet used to sign a certificate, and a certificate that has been rotated - // out. For instances not using Certificate Authority Service (CAS) server CA, - // use ListServerCas instead. - rpc ListServerCertificates(SqlInstancesListServerCertificatesRequest) - returns (InstancesListServerCertificatesResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCertificates" - }; - } - - // Lists all versions of EntraID certificates for the specified instance. - // There can be up to three sets of certificates listed: the certificate that - // is currently in use, a future that has been added but not yet used to sign - // a certificate, and a certificate that has been rotated out. - rpc ListEntraIdCertificates(SqlInstancesListEntraIdCertificatesRequest) - returns (InstancesListEntraIdCertificatesResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/listEntraIdCertificates" - }; - } - - // Partially updates settings of a Cloud SQL instance by merging the request - // with the current configuration. This method supports patch semantics. - rpc Patch(SqlInstancesPatchRequest) returns (Operation) { - option (google.api.http) = { - patch: "/sql/v1beta4/projects/{project}/instances/{instance}" - body: "body" - }; - } - - // Promotes the read replica instance to be an independent Cloud SQL - // primary instance. - // Using this operation might cause your instance to restart. - rpc PromoteReplica(SqlInstancesPromoteReplicaRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/promoteReplica" - }; - } - - // Switches over from the primary instance to the DR replica - // instance. - rpc Switchover(SqlInstancesSwitchoverRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/switchover" - }; - } - - // Deletes all client certificates and generates a new server SSL certificate - // for the instance. - rpc ResetSslConfig(SqlInstancesResetSslConfigRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/resetSslConfig" - }; - } - - // Restarts a Cloud SQL instance. - rpc Restart(SqlInstancesRestartRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/restart" - }; - } - - // Restores a backup of a Cloud SQL instance. Using this operation might cause - // your instance to restart. - rpc RestoreBackup(SqlInstancesRestoreBackupRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/restoreBackup" - body: "body" - }; - } - - // Rotates the server certificate to one signed by the Certificate Authority - // (CA) version previously added with the addServerCA method. For instances - // that have enabled Certificate Authority Service (CAS) based server CA, - // use RotateServerCertificate to rotate the server certificate. - rpc RotateServerCa(SqlInstancesRotateServerCaRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCa" - body: "body" - }; - } - - // Rotates the server certificate version to one previously added with the - // addServerCertificate method. For instances not using Certificate Authority - // Service (CAS) server CA, use RotateServerCa instead. - rpc RotateServerCertificate(SqlInstancesRotateServerCertificateRequest) - returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCertificate" - body: "body" - }; - } - - // Rotates the Entra Id certificate version to one previously added with the - // addEntraIdCertificate method. - rpc RotateEntraIdCertificate(SqlInstancesRotateEntraIdCertificateRequest) - returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/rotateEntraIdCertificate" - body: "body" - }; - } - - // Starts the replication in the read replica instance. - rpc StartReplica(SqlInstancesStartReplicaRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/startReplica" - }; - } - - // Stops the replication in the read replica instance. - rpc StopReplica(SqlInstancesStopReplicaRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/stopReplica" - }; - } - - // Truncate MySQL general and slow query log tables - // MySQL only. - rpc TruncateLog(SqlInstancesTruncateLogRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/truncateLog" - body: "body" - }; - } - - // Updates settings of a Cloud SQL instance. Using this operation might cause - // your instance to restart. - rpc Update(SqlInstancesUpdateRequest) returns (Operation) { - option (google.api.http) = { - put: "/sql/v1beta4/projects/{project}/instances/{instance}" - body: "body" - }; - } - - // Generates a short-lived X509 certificate containing the provided public key - // and signed by a private key specific to the target instance. Users may use - // the certificate to authenticate as themselves when connecting to the - // database. - rpc CreateEphemeral(SqlInstancesCreateEphemeralCertRequest) - returns (SslCert) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/createEphemeral" - body: "body" - }; - } - - // Reschedules the maintenance on the given instance. - rpc RescheduleMaintenance(SqlInstancesRescheduleMaintenanceRequest) - returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/rescheduleMaintenance" - body: "body" - }; - } - - // Verify External primary instance external sync settings. - rpc VerifyExternalSyncSettings(SqlInstancesVerifyExternalSyncSettingsRequest) - returns (SqlInstancesVerifyExternalSyncSettingsResponse) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/verifyExternalSyncSettings" - body: "*" - }; - } - - // Start External primary instance migration. - rpc StartExternalSync(SqlInstancesStartExternalSyncRequest) - returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/startExternalSync" - body: "*" - }; - } - - // Perform Disk Shrink on primary instance. - rpc PerformDiskShrink(SqlInstancesPerformDiskShrinkRequest) - returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/performDiskShrink" - body: "body" - }; - } - - // Get Disk Shrink Config for a given instance. - rpc GetDiskShrinkConfig(SqlInstancesGetDiskShrinkConfigRequest) - returns (SqlInstancesGetDiskShrinkConfigResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/getDiskShrinkConfig" - }; - } - - // Reset Replica Size to primary instance disk size. - rpc ResetReplicaSize(SqlInstancesResetReplicaSizeRequest) - returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/resetReplicaSize" - body: "*" - }; - } - - // Get Latest Recovery Time for a given instance. - rpc GetLatestRecoveryTime(SqlInstancesGetLatestRecoveryTimeRequest) - returns (SqlInstancesGetLatestRecoveryTimeResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/getLatestRecoveryTime" - }; - } - - // Execute SQL statements. - rpc ExecuteSql(SqlInstancesExecuteSqlRequest) - returns (SqlInstancesExecuteSqlResponse) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/executeSql" - body: "body" - }; - } - - // Acquire a lease for the setup of SQL Server Reporting Services (SSRS). - rpc AcquireSsrsLease(SqlInstancesAcquireSsrsLeaseRequest) - returns (SqlInstancesAcquireSsrsLeaseResponse) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/acquireSsrsLease" - body: "body" - }; - } - - // Release a lease for the setup of SQL Server Reporting Services (SSRS). - rpc ReleaseSsrsLease(SqlInstancesReleaseSsrsLeaseRequest) - returns (SqlInstancesReleaseSsrsLeaseResponse) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/releaseSsrsLease" - }; - } - - // Execute MVU Pre-checks - rpc PreCheckMajorVersionUpgrade( - SqlInstancesPreCheckMajorVersionUpgradeRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade" - body: "body" - }; - } - - // Point in time restore for an instance managed by Google Cloud Backup and - // Disaster Recovery. - rpc PointInTimeRestore(SqlInstancesPointInTimeRestoreRequest) - returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/{parent=projects/*}:pointInTimeRestore" - body: "context" - }; - } -} - -service SqlOperationsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Retrieves an instance operation that has been performed on an instance. - rpc Get(SqlOperationsGetRequest) returns (Operation) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/operations/{operation}" - }; - } - - // Lists all instance operations that have been performed on the given Cloud - // SQL instance in the reverse chronological order of the start time. - rpc List(SqlOperationsListRequest) returns (OperationsListResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/operations" - }; - } - - // Cancels an instance operation that has been performed on an instance. - // Ordinarily, this method name should be `CancelSqlOperation`. - rpc Cancel(SqlOperationsCancelRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/operations/{operation}/cancel" - }; - } -} - -service SqlSslCertsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Deletes the SSL certificate. For First Generation instances, the - // certificate remains valid until the instance is restarted. - rpc Delete(SqlSslCertsDeleteRequest) returns (Operation) { - option (google.api.http) = { - delete: "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - }; - } - - // Retrieves a particular SSL certificate. Does not include the private key - // (required for usage). The private key must be saved from the response to - // initial creation. - rpc Get(SqlSslCertsGetRequest) returns (SslCert) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - }; - } - - // Creates an SSL certificate and returns it along with the private key and - // server certificate authority. The new certificate will not be usable until - // the instance is restarted. - rpc Insert(SqlSslCertsInsertRequest) returns (SslCertsInsertResponse) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts" - body: "body" - }; - } - - // Lists all of the current SSL certificates for the instance. - rpc List(SqlSslCertsListRequest) returns (SslCertsListResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts" - }; - } -} - -service SqlBackupsService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Creates a backup for a Cloud SQL instance. This API can be used only to - // create on-demand backups. - rpc CreateBackup(CreateBackupRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/{parent=projects/*}/backups" - body: "backup" - }; - option (google.api.method_signature) = "parent, backup"; - } - - // Retrieves a resource containing information about a backup. - rpc GetBackup(GetBackupRequest) returns (Backup) { - option (google.api.http) = { - get: "/sql/v1beta4/{name=projects/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists all backups associated with the project. - rpc ListBackups(ListBackupsRequest) returns (ListBackupsResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/{parent=projects/*}/backups" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates the retention period and the description of the backup. You can use - // this API to update final backups only. - rpc UpdateBackup(UpdateBackupRequest) returns (Operation) { - option (google.api.http) = { - patch: "/sql/v1beta4/{backup.name=projects/*/backups/*}" - body: "backup" - }; - option (google.api.method_signature) = "backup, update_mask"; - } - - // Deletes the backup. - rpc DeleteBackup(DeleteBackupRequest) returns (Operation) { - option (google.api.http) = { - delete: "/sql/v1beta4/{name=projects/*/backups/*}" - }; - option (google.api.method_signature) = "name"; - } -} - -// The request payload to create the backup -message CreateBackupRequest { - // Required. The parent resource where this backup is created. - // Format: projects/{project} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "sqladmin.googleapis.com/Backup" - } - ]; - - // Required. The Backup to create. - Backup backup = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request payload to get the backup. -message GetBackupRequest { - // Required. The name of the backup to retrieve. - // Format: projects/{project}/backups/{backup} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } - ]; -} - -// The request payload to list the backups. -message ListBackupsRequest { - // Required. The parent that owns this collection of backups. - // Format: projects/{project} - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "sqladmin.googleapis.com/Backup" - } - ]; - - // The maximum number of backups to return per response. The service might - // return fewer backups than this value. If a value for this parameter isn't - // specified, then, at most, 500 backups are returned. The maximum value is - // 2,000. Any values that you set, which are greater than 2,000, are changed - // to 2,000. - int32 page_size = 2; - - // A page token, received from a previous `ListBackups` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListBackups` must match - // the call that provided the page token. - string page_token = 3; - - // Multiple filter queries are separated by spaces. For example, - // 'instance:abc AND type:FINAL, 'location:us', - // 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - // type, instance, backupInterval.startTime (creation time), or location. - string filter = 4; -} - -// The response payload containing a list of the backups. -message ListBackupsResponse { - // A list of backups. - repeated Backup backups = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, then there aren't subsequent pages. - string next_page_token = 2; - - // If a region isn't unavailable or if an unknown error occurs, then a warning - // message is returned. - repeated ApiWarning warnings = 3; -} - -// The request payload to update the backup. -message UpdateBackupRequest { - // Required. The backup to update. - // The backup’s `name` field is used to identify the backup to update. - // Format: projects/{project}/backups/{backup} - Backup backup = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields that you can update. You can update only the description - // and retention period of the final backup. - google.protobuf.FieldMask update_mask = 2; -} - -// The request payload to delete the backup. -message DeleteBackupRequest { - // Required. The name of the backup to delete. - // Format: projects/{project}/backups/{backup} - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } - ]; -} - -message SqlBackupRunsDeleteRequest { - // The ID of the backup run to delete. To find a backup run ID, use the - // [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/backupRuns/list) - // method. - int64 id = 1; - - // Cloud SQL instance ID. This does not include the project ID. - string instance = 2; - - // Project ID of the project that contains the instance. - string project = 3; -} - -message SqlBackupRunsGetRequest { - // The ID of this backup run. - int64 id = 1; - - // Cloud SQL instance ID. This does not include the project ID. - string instance = 2; - - // Project ID of the project that contains the instance. - string project = 3; -} - -message SqlBackupRunsInsertRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - BackupRun body = 100; -} - -message SqlBackupRunsListRequest { - // Cloud SQL instance ID, or "-" for all instances. This does not include - // the project ID. - string instance = 1; - - // Maximum number of backup runs per response. - int32 max_results = 2; - - // A previously-returned page token representing part of the larger set of - // results to view. - string page_token = 3; - - // Project ID of the project that contains the instance. - string project = 4; -} - -message SqlDatabasesDeleteRequest { - // Name of the database to be deleted in the instance. - string database = 1; - - // Database instance ID. This does not include the project ID. - string instance = 2; - - // Project ID of the project that contains the instance. - string project = 3; -} - -message SqlDatabasesGetRequest { - // Name of the database in the instance. - string database = 1; - - // Database instance ID. This does not include the project ID. - string instance = 2; - - // Project ID of the project that contains the instance. - string project = 3; -} - -message SqlDatabasesInsertRequest { - // Database instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - Database body = 100; -} - -message SqlDatabasesListRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -message SqlDatabasesUpdateRequest { - // Name of the database to be updated in the instance. - string database = 1; - - // Database instance ID. This does not include the project ID. - string instance = 2; - - // Project ID of the project that contains the instance. - string project = 3; - - Database body = 100; -} - -message SqlFlagsListRequest { - // Database type and version you want to retrieve flags for. By default, this - // method returns flags for all database types and versions. - string database_version = 1; - - // Optional. Specify the scope of flags to be returned by SqlFlagsListService. - // Return list of database flags if unspecified. - optional SqlFlagScope flag_scope = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message SqlInstancesAddServerCaRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -// Request for AddServerCertificate RPC. -message SqlInstancesAddServerCertificateRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request for AddEntraIdCertificate RPC. -message SqlInstancesAddEntraIdCertificateRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message SqlInstancesCloneRequest { - // The ID of the Cloud SQL instance to be cloned (source). This does not - // include the project ID. - string instance = 1; - - // Project ID of the source as well as the clone Cloud SQL instance. - string project = 2; - - InstancesCloneRequest body = 100; -} - -message SqlInstancesDeleteRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance to be deleted. - string project = 2; - - // Flag to opt-in for final backup. By default, it is turned off. - optional bool enable_final_backup = 7; - - oneof expiration { - // Optional. Retention period of the final backup. - int64 final_backup_ttl_days = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Final Backup expiration time. - // Timestamp in UTC of when this resource is considered expired. - google.protobuf.Timestamp final_backup_expiry_time = 6 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The description of the final backup. - string final_backup_description = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -message SqlInstancesDemoteMasterRequest { - // Cloud SQL instance name. - string instance = 1; - - // ID of the project that contains the instance. - string project = 2; - - InstancesDemoteMasterRequest body = 100; -} - -// Instance demote request. -message SqlInstancesDemoteRequest { - // Required. The name of the Cloud SQL instance. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // The request body. - InstancesDemoteRequest body = 100; -} - -message SqlInstancesExportRequest { - // The Cloud SQL instance ID. This doesn't include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance to be exported. - string project = 2; - - InstancesExportRequest body = 100; -} - -message SqlInstancesFailoverRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // ID of the project that contains the read replica. - string project = 2; - - InstancesFailoverRequest body = 100; -} - -message SqlInstancesGetRequest { - // Database instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -message SqlInstancesImportRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - InstancesImportRequest body = 100; -} - -message SqlInstancesInsertRequest { - // Project ID of the project to which the newly created Cloud SQL instances - // should belong. - string project = 1; - - DatabaseInstance body = 100; -} - -message SqlInstancesListRequest { - // A filter expression that filters resources listed in the response. - // The expression is in the form of field:value. For example, - // 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per - // their JSON representation, such as 'settings.userLabels.auto_start:true'. - // - // Multiple filter queries are space-separated. For example. - // 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each - // expression is an AND expression. However, you can include AND and OR - // expressions explicitly. - string filter = 1; - - // The maximum number of instances to return. The service may return fewer - // than this value. - // If unspecified, at most 500 instances are returned. - // The maximum value is 1000; values above 1000 are coerced to 1000. - uint32 max_results = 2; - - // A previously-returned page token representing part of the larger set of - // results to view. - string page_token = 3; - - // Project ID of the project for which to list Cloud SQL instances. - string project = 4; -} - -message SqlInstancesListServerCasRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -message SqlInstancesListServerCertificatesRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for SqlInstancesService.ListEntraIdCertificates. -message SqlInstancesListEntraIdCertificatesRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -message SqlInstancesPatchRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - DatabaseInstance body = 100; -} - -message SqlInstancesPromoteReplicaRequest { - // Cloud SQL read replica instance name. - string instance = 1; - - // ID of the project that contains the read replica. - string project = 2; - - // Set to true to invoke a replica failover to the DR replica. - // As part of replica failover, the promote operation attempts - // to add the original primary instance as a replica of the promoted - // DR replica when the original primary instance comes back online. - // If set to false or not specified, then the original primary - // instance becomes an independent Cloud SQL primary instance. - bool failover = 3; -} - -// Instance switchover request. -message SqlInstancesSwitchoverRequest { - // Cloud SQL read replica instance name. - string instance = 1; - - // ID of the project that contains the replica. - string project = 2; - - // Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations - // timeout, which is a sum of all database operations. Default value is 10 - // minutes and can be modified to a maximum value of 24 hours. - google.protobuf.Duration db_timeout = 3 - [(google.api.field_behavior) = OPTIONAL]; -} - -message SqlInstancesResetSslConfigRequest { - // Reset SSL mode to selectively refresh the SSL materials. - enum ResetSslMode { - // Reset SSL mode is not specified. - RESET_SSL_MODE_UNSPECIFIED = 0; - - // Refresh all TLS configs. This is the default behaviour. - ALL = 1; - - // Refreshes the replication-related TLS configuration settings provided by - // the primary instance. - // Not applicable to on-premises replication instances. - SYNC_FROM_PRIMARY = 2; - } - - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Optional. Reset SSL mode to use. - ResetSslMode mode = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message SqlInstancesRestartRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance to be restarted. - string project = 2; -} - -message SqlInstancesRestoreBackupRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - InstancesRestoreBackupRequest body = 100; -} - -message SqlInstancesRotateServerCaRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - InstancesRotateServerCaRequest body = 100; -} - -message SqlInstancesRotateServerCertificateRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Rotate server certificate request body. - InstancesRotateServerCertificateRequest body = 100 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for SqlInstancesService.RotateEntraIdCertificate. -message SqlInstancesRotateEntraIdCertificateRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Rotate Entra ID certificate request body. - InstancesRotateEntraIdCertificateRequest body = 100 - [(google.api.field_behavior) = REQUIRED]; -} - -message SqlInstancesStartReplicaRequest { - // Cloud SQL read replica instance name. - string instance = 1; - - // ID of the project that contains the read replica. - string project = 2; -} - -message SqlInstancesStopReplicaRequest { - // Cloud SQL read replica instance name. - string instance = 1; - - // ID of the project that contains the read replica. - string project = 2; -} - -message SqlInstancesTruncateLogRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the Cloud SQL project. - string project = 2; - - InstancesTruncateLogRequest body = 100; -} - -message SqlInstancesUpdateRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - DatabaseInstance body = 100; -} - -// Instance reencrypt request. -message SqlInstancesReencryptRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // ID of the project that contains the instance. - string project = 2; - - // Reencrypt body that users request - InstancesReencryptRequest body = 3; -} - -// Database Instance reencrypt request. -message InstancesReencryptRequest { - // Configuration specific to backup re-encryption - optional BackupReencryptionConfig backup_reencryption_config = 1; -} - -// Backup Reencryption Config -message BackupReencryptionConfig { - // Backup type for re-encryption - enum BackupType { - // Unknown backup type, will be defaulted to AUTOMATIC backup type - BACKUP_TYPE_UNSPECIFIED = 0; - - // Reencrypt automatic backups - AUTOMATED = 1; - - // Reencrypt on-demand backups - ON_DEMAND = 2; - } - - // Backup re-encryption limit - optional int32 backup_limit = 1; - - // Type of backups users want to re-encrypt. - optional BackupType backup_type = 2; -} - -message SqlInstancesRescheduleMaintenanceRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // ID of the project that contains the instance. - string project = 2; - - SqlInstancesRescheduleMaintenanceRequestBody body = 100; -} - -// Instance perform disk shrink request. -message SqlInstancesPerformDiskShrinkRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Perform disk shrink context. - PerformDiskShrinkContext body = 100; -} - -// External Sync parallel level. -enum ExternalSyncParallelLevel { - // Unknown sync parallel level. Will be defaulted to OPTIMAL. - EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED = 0; - - // Minimal parallel level. - MIN = 1; - - // Optimal parallel level. - OPTIMAL = 2; - - // Maximum parallel level. - MAX = 3; -} - -// The selected object that Cloud SQL migrates. -message ExternalSyncSelectedObject { - // The name of the database that Cloud SQL migrates. - string database = 1; -} - -message SqlInstancesVerifyExternalSyncSettingsRequest { - enum ExternalSyncMode { - // Unknown external sync mode, will be defaulted to ONLINE mode - EXTERNAL_SYNC_MODE_UNSPECIFIED = 0; - - // Online external sync will set up replication after initial data external - // sync - ONLINE = 1; - - // Offline external sync only dumps and loads a one-time snapshot of - // the primary instance's data - OFFLINE = 2; - } - - // MigrationType determines whether the migration is a physical file-based - // migration or a logical dump file-based migration. - enum MigrationType { - // Default value is a logical dump file-based migration - MIGRATION_TYPE_UNSPECIFIED = 0; - - // Logical dump file-based migration - LOGICAL = 1; - - // Physical file-based migration - PHYSICAL = 2; - } - - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Flag to enable verifying connection only - bool verify_connection_only = 3; - - // External sync mode - ExternalSyncMode sync_mode = 4; - - // Optional. Flag to verify settings required by replication setup only - bool verify_replication_only = 5 [(google.api.field_behavior) = OPTIONAL]; - - oneof sync_config { - // Optional. MySQL-specific settings for start external sync. - MySqlSyncConfig mysql_sync_config = 6 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. MigrationType configures the migration to use physical files or - // logical dump files. If not set, then the logical dump file configuration is - // used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - MigrationType migration_type = 7 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Parallel level for initial data sync. Only applicable for - // PostgreSQL. - ExternalSyncParallelLevel sync_parallel_level = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Migrate only the specified objects from the source instance. If - // this field is empty, then migrate all objects. - repeated ExternalSyncSelectedObject selected_objects = 9 - [(google.api.field_behavior) = OPTIONAL]; -} - -message SqlInstancesStartExternalSyncRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // ID of the project that contains the instance. - string project = 2; - - // External sync mode. - SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode sync_mode = 3; - - // Whether to skip the verification step (VESS). - bool skip_verification = 4; - - oneof sync_config { - // MySQL-specific settings for start external sync. - MySqlSyncConfig mysql_sync_config = 6; - } - - // Optional. Parallel level for initial data sync. Currently only applicable - // for MySQL. - ExternalSyncParallelLevel sync_parallel_level = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. MigrationType configures the migration to use physical files or - // logical dump files. If not set, then the logical dump file configuration is - // used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType migration_type = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. MySQL only. True if end-user has confirmed that this SES call - // will wipe replica databases overlapping with the proposed selected_objects. - // If this field is not set and there are both overlapping and additional - // databases proposed, an error will be returned. - bool replica_overwrite_enabled = 9 [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance reset replica size request. -message SqlInstancesResetReplicaSizeRequest { - // Cloud SQL read replica instance name. - string instance = 1; - - // ID of the project that contains the read replica. - string project = 2; -} - -message SqlOperationsGetRequest { - // Instance operation ID. - string operation = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -message SqlOperationsListRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Maximum number of operations per response. - uint32 max_results = 2; - - // A previously-returned page token representing part of the larger set of - // results to view. - string page_token = 3; - - // Project ID of the project that contains the instance. - string project = 4; -} - -// The request payload to cancel an operation. -message SqlOperationsCancelRequest { - // Instance operation ID. - string operation = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -message SqlInstancesCreateEphemeralCertRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the Cloud SQL project. - string project = 2; - - SslCertsCreateEphemeralRequest body = 100; -} - -message SqlSslCertsDeleteRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Sha1 FingerPrint. - string sha1_fingerprint = 3; -} - -message SqlSslCertsGetRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Sha1 FingerPrint. - string sha1_fingerprint = 3; -} - -message SqlSslCertsInsertRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - SslCertsInsertRequest body = 100; -} - -message SqlSslCertsListRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -// Instance get disk shrink config request. -message SqlInstancesGetDiskShrinkConfigRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -// Instance get latest recovery time request. -message SqlInstancesGetLatestRecoveryTimeRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // The timestamp used to identify the time when the source instance is - // deleted. If this instance is deleted, then you must set the timestamp. - optional google.protobuf.Timestamp source_instance_deletion_time = 3; -} - -// Instance get latest recovery time response. -message SqlInstancesGetLatestRecoveryTimeResponse { - // This is always `sql#getLatestRecoveryTime`. - string kind = 1; - - // Timestamp, identifies the latest recovery time of the source instance. - google.protobuf.Timestamp latest_recovery_time = 2; - - // Timestamp, identifies the earliest recovery time of the source instance. - google.protobuf.Timestamp earliest_recovery_time = 3; -} - -// Execute SQL statements request. -message SqlInstancesExecuteSqlRequest { - // Required. Database instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // The request body. - ExecuteSqlPayload body = 100; -} - -// Request to release a lease for SSRS. -message SqlInstancesReleaseSsrsLeaseRequest { - // Required. The Cloud SQL instance ID. This doesn't include the project ID. - // It's composed of lowercase letters, numbers, and hyphens, and it must start - // with a letter. The total length must be 98 characters or less (Example: - // instance-id). - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The ID of the project that contains the instance (Example: - // project-id). - string project = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The response for the release of the SSRS lease. -message SqlInstancesReleaseSsrsLeaseResponse { - // The operation ID. - string operation_id = 1; -} - -// The request payload used to execute SQL statements. -message ExecuteSqlPayload { - // Controls how the API should respond when the SQL execution result exceeds - // 10 MB. - enum PartialResultMode { - // Unspecified mode, effectively the same as `FAIL_PARTIAL_RESULT`. - PARTIAL_RESULT_MODE_UNSPECIFIED = 0; - - // Throw an error if the result exceeds 10 MB or if only a partial result - // can be retrieved. Don't return the result. - FAIL_PARTIAL_RESULT = 1; - - // Return a truncated result and set `partial_result` to true if the result - // exceeds 10 MB or if only a partial result can be retrieved due to error. - // Don't throw an error. - ALLOW_PARTIAL_RESULT = 2; - } - - // Optional. The name of an existing database user to connect to the database. - // When `auto_iam_authn` is set to true, this field is ignored and the API - // caller's IAM user is used. - string user = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. SQL statements to run on the database. It can be a single - // statement or a sequence of statements separated by semicolons. - string sql_statement = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. Name of the database on which the statement will be executed. - string database = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Credentials for the database connection. - oneof user_password { - // Optional. When set to true, the API caller identity associated with the - // request is used for database authentication. The API caller must be an - // IAM user in the database. - bool auto_iam_authn = 11 [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The maximum number of rows returned per SQL statement. - int64 row_limit = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Controls how the API should respond when the SQL execution result - // is incomplete due to the size limit or another error. The default mode is - // to throw an error. - PartialResultMode partial_result_mode = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies the name of the application that is making the request. - // This field is used for telemetry. Only alphanumeric characters, dashes, and - // underscores are allowed. The maximum length is 32 characters. - string application = 16 [(google.api.field_behavior) = OPTIONAL]; -} - -// Execute SQL statements response. -message SqlInstancesExecuteSqlResponse { - // Represents a notice or warning message from the database. - message Message { - // The full message string. - // For PostgreSQL, this is a formatted string that may include severity, - // code, and the notice/warning message. - // For MySQL, this contains the warning message. - optional string message = 1; - - // The severity of the message (e.g., "NOTICE" for PostgreSQL, "WARNING" for - // MySQL). - optional string severity = 2; - } - - // A list of notices and warnings generated during query execution. - // For PostgreSQL, this includes all notices and warnings. - // For MySQL, this includes warnings generated by the last executed statement. - // To retrieve all warnings for a multi-statement query, `SHOW WARNINGS` must - // be executed after each statement. - repeated Message messages = 9; - - // The additional metadata information regarding the execution of the SQL - // statements. - Metadata metadata = 6; - - // The list of results after executing all the SQL statements. - repeated QueryResult results = 7; - - // Contains the error from the database if the SQL execution failed. - google.rpc.Status status = 8; -} - -// QueryResult contains the result of executing a single SQL statement. -message QueryResult { - // List of columns included in the result. This also includes the data type - // of the column. - repeated Column columns = 1; - - // Rows returned by the SQL statement. - repeated Row rows = 2; - - // Message related to the SQL execution result. - string message = 3; - - // Set to true if the SQL execution's result is truncated due to size limits - // or an error retrieving results. - bool partial_result = 4; - - // If results were truncated due to an error, details of that error. - google.rpc.Status status = 8; -} - -// Contains the name and datatype of a column. -message Column { - // Name of the column. - string name = 1; - - // Datatype of the column. - string type = 2; -} - -// Contains the values for a row. -message Row { - // The values for the row. - repeated Value values = 1; -} - -// The cell value of the table. -message Value { - // The cell value represented in string format. - string value = 1; - - // If cell value is null, then this flag will be set to true. - bool null_value = 2; -} - -// The additional metadata information regarding the execution of the SQL -// statements. -message Metadata { - // The time taken to execute the SQL statements. - google.protobuf.Duration sql_statement_execution_time = 1; -} - -// Request to acquire a lease for SSRS. -message SqlInstancesAcquireSsrsLeaseRequest { - // Required. Cloud SQL instance ID. This doesn't include the project ID. It's - // composed of lowercase letters, numbers, and hyphens, and it must start with - // a letter. The total length must be 98 characters or less (Example: - // instance-id). - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. ID of the project that contains the instance (Example: - // project-id). - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // The body for request to acquire an SSRS lease. - InstancesAcquireSsrsLeaseRequest body = 100; -} - -// Request for Pre-checks for MVU -message SqlInstancesPreCheckMajorVersionUpgradeRequest { - // Required. Cloud SQL instance ID. This does not include the project ID. - string instance = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Project ID of the project that contains the instance. - string project = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The context for request to perform the pre-check major version - // upgrade operation. - InstancesPreCheckMajorVersionUpgradeRequest body = 3 - [(google.api.field_behavior) = REQUIRED]; -} - -// Acquire SSRS lease response. -message SqlInstancesAcquireSsrsLeaseResponse { - // The unique identifier for this operation. - optional string operation_id = 1; -} - -// Request to perform a point in time restore on a Google Cloud Backup and -// Disaster Recovery managed instance. -message SqlInstancesPointInTimeRestoreRequest { - // Required. The parent resource where you created this instance. - // Format: projects/{project} - string parent = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The context for request to perform a PITR on a Google Cloud - // Backup and Disaster Recovery managed instance. - PointInTimeRestoreContext context = 100 - [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto deleted file mode 100644 index dd71ca90f164..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto +++ /dev/null @@ -1,217 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1beta4; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/sql/v1beta4/cloud_sql_resources.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlConnectProto"; -option java_package = "com.google.cloud.sql.v1beta4"; - -// Cloud SQL connect service. -service SqlConnectService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Retrieves connect settings about a Cloud SQL instance. - rpc GetConnectSettings(GetConnectSettingsRequest) returns (ConnectSettings) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/connectSettings" - }; - } - - // Generates a short-lived X509 certificate containing the provided public key - // and signed by a private key specific to the target instance. Users may use - // the certificate to authenticate as themselves when connecting to the - // database. - rpc GenerateEphemeralCert(GenerateEphemeralCertRequest) - returns (GenerateEphemeralCertResponse) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}:generateEphemeralCert" - body: "*" - }; - } -} - -// Connect settings retrieval request. -message GetConnectSettingsRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // Optional. Optional snapshot read timestamp to trade freshness for - // performance. - google.protobuf.Timestamp read_time = 7 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Connect settings retrieval response. -message ConnectSettings { - // Various Certificate Authority (CA) modes for certificate signing. - enum CaMode { - // CA mode is unspecified. It is effectively the same as - // `GOOGLE_MANAGED_INTERNAL_CA`. - CA_MODE_UNSPECIFIED = 0; - - // Google-managed self-signed internal CA. - GOOGLE_MANAGED_INTERNAL_CA = 1; - - // Google-managed regional CA part of root CA hierarchy hosted on Google - // Cloud's Certificate Authority Service (CAS). - GOOGLE_MANAGED_CAS_CA = 2; - - // Customer-managed CA hosted on Google Cloud's Certificate Authority - // Service (CAS). - CUSTOMER_MANAGED_CAS_CA = 3; - } - - // Details of a single read pool node of a read pool. - message ConnectPoolNodeConfig { - // Output only. The name of the read pool node. Doesn't include the project - // ID. - optional string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Mappings containing IP addresses that can be used to connect - // to the read pool node. - repeated IpMapping ip_addresses = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DNS name of the read pool node. - optional string dns_name = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of DNS names used by this read pool node. - repeated DnsNameMapping dns_names = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // MdxProtocolSupport describes parts of the MDX protocol supported by this - // instance. - enum MdxProtocolSupport { - // Not specified. - MDX_PROTOCOL_SUPPORT_UNSPECIFIED = 0; - - // Client should send the client protocol type in the MDX request. - CLIENT_PROTOCOL_TYPE = 1; - } - - // This is always `sql#connectSettings`. - string kind = 1; - - // SSL configuration. - SslCert server_ca_cert = 2; - - // The assigned IP addresses for the instance. - repeated IpMapping ip_addresses = 3; - - // The cloud region for the instance. e.g. `us-central1`, `europe-west1`. - // The region cannot be changed after instance creation. - string region = 4; - - // The database engine type and version. The `databaseVersion` - // field cannot be changed after instance creation. - // MySQL instances: `MYSQL_8_0`, `MYSQL_5_7` (default), - // or `MYSQL_5_6`. - // PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, - // `POSTGRES_11` or `POSTGRES_12` (default), `POSTGRES_13`, or `POSTGRES_14`. - // SQL Server instances: `SQLSERVER_2017_STANDARD` (default), - // `SQLSERVER_2017_ENTERPRISE`, `SQLSERVER_2017_EXPRESS`, - // `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, - // `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or - // `SQLSERVER_2019_WEB`. - SqlDatabaseVersion database_version = 31; - - // `SECOND_GEN`: Cloud SQL database instance. - // `EXTERNAL`: A database server that is not managed by Google. - // This property is read-only; use the `tier` property in the `settings` - // object to determine the database type. - SqlBackendType backend_type = 32; - - // Whether PSC connectivity is enabled for this instance. - bool psc_enabled = 33; - - // The dns name of the instance. - string dns_name = 34; - - // Specify what type of CA is used for the server certificate. - CaMode server_ca_mode = 35; - - // Custom subject alternative names for the server certificate. - repeated string custom_subject_alternative_names = 37; - - // Output only. The list of DNS names used by this instance. - repeated DnsNameMapping dns_names = 38 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The number of read pool nodes in a read pool. - optional int32 node_count = 63; - - // Output only. Entries containing information about each read pool node of - // the read pool. - repeated ConnectPoolNodeConfig nodes = 64 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Output only. mdx_protocol_support controls how the client uses - // metadata exchange when connecting to the instance. The values in the list - // representing parts of the MDX protocol that are supported by this instance. - // When the list is empty, the instance does not support MDX, so the client - // must not send an MDX request. The default is empty. - repeated MdxProtocolSupport mdx_protocol_support = 39 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = OPTIONAL - ]; -} - -// Ephemeral certificate creation request. -message GenerateEphemeralCertRequest { - // Cloud SQL instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - // PEM encoded public key to include in the signed certificate. - string public_key = 3 [json_name = "public_key"]; - - // Optional. Access token to include in the signed certificate. - string access_token = 4 - [json_name = "access_token", (google.api.field_behavior) = OPTIONAL]; - - // Optional. Optional snapshot read timestamp to trade freshness for - // performance. - google.protobuf.Timestamp read_time = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set, it will contain the cert valid duration. - google.protobuf.Duration valid_duration = 12 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Ephemeral certificate creation request. -message GenerateEphemeralCertResponse { - // Generated cert - SslCert ephemeral_cert = 1; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto deleted file mode 100644 index b115c94055c5..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1beta4; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlIamPoliciesProto"; -option java_package = "com.google.cloud.sql.v1beta4"; - -// Service for providing IAM Meta APIs for Cloud SQL. -service SqlIamPoliciesService { - option (google.api.default_host) = "sqladmin.googleapis.com"; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto deleted file mode 100644 index 4f48f2bf9f9f..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto +++ /dev/null @@ -1,4074 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1beta4; - -import "google/api/field_behavior.proto"; -import "google/api/field_info.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/wrappers.proto"; -import "google/type/interval.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlResourcesProto"; -option java_package = "com.google.cloud.sql.v1beta4"; -option (google.api.resource_definition) = { - type: "backupdr.googleapis.com/Backup" - pattern: "projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{network}" -}; - -// An entry for an Access Control list. -message AclEntry { - // The allowlisted value for the access control list. - string value = 1; - - // The time when this access control entry expires in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp expiration_time = 2; - - // Optional. A label to identify this entry. - string name = 3 [(google.api.field_behavior) = OPTIONAL]; - - // This is always `sql#aclEntry`. - string kind = 4; -} - -// An Admin API warning message. -message ApiWarning { - enum SqlApiWarningCode { - // An unknown or unset warning type from Cloud SQL API. - SQL_API_WARNING_CODE_UNSPECIFIED = 0; - - // Warning when one or more regions are not reachable. The returned result - // set may be incomplete. - REGION_UNREACHABLE = 1; - - // Warning when user provided maxResults parameter exceeds the limit. The - // returned result set may be incomplete. - MAX_RESULTS_EXCEEDS_LIMIT = 2; - - // Warning when user tries to create/update a user with credentials that - // have previously been compromised by a public data breach. - COMPROMISED_CREDENTIALS = 3; - - // Warning when the operation succeeds but some non-critical workflow state - // failed. - INTERNAL_STATE_FAILURE = 4; - } - - // Code to uniquely identify the warning type. - SqlApiWarningCode code = 1; - - // The warning message. - string message = 2; - - // The region name for REGION_UNREACHABLE warning. - string region = 3; -} - -// We currently only support backup retention by specifying the number -// of backups we will retain. -message BackupRetentionSettings { - // The units that retained_backups specifies, we only support COUNT. - enum RetentionUnit { - // Backup retention unit is unspecified, will be treated as COUNT. - RETENTION_UNIT_UNSPECIFIED = 0; - - // Retention will be by count, eg. "retain the most recent 7 backups". - COUNT = 1; - } - - // The unit that 'retained_backups' represents. - RetentionUnit retention_unit = 1; - - // Depending on the value of retention_unit, this is used to determine - // if a backup needs to be deleted. If retention_unit is 'COUNT', we will - // retain this many backups. - google.protobuf.Int32Value retained_backups = 2; -} - -// Database instance backup configuration. -message BackupConfiguration { - // This value contains the storage location of the transactional logs - // used to perform point-in-time recovery (PITR) for the database. - enum TransactionalLogStorageState { - // Unspecified. - TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED = 0; - - // The transaction logs used for PITR for the instance are stored - // on a data disk. - DISK = 1; - - // The transaction logs used for PITR for the instance are switching from - // being stored on a data disk to being stored in Cloud Storage. - // Only applicable to MySQL. - SWITCHING_TO_CLOUD_STORAGE = 2; - - // The transaction logs used for PITR for the instance are now stored - // in Cloud Storage. Previously, they were stored on a data disk. - // Only applicable to MySQL. - SWITCHED_TO_CLOUD_STORAGE = 3; - - // The transaction logs used for PITR for the instance are stored in - // Cloud Storage. Only applicable to MySQL and PostgreSQL. - CLOUD_STORAGE = 4; - } - - // Backup tier that manages the backups for the instance. - enum BackupTier { - // Unspecified. - BACKUP_TIER_UNSPECIFIED = 0; - - // Instance is managed by Cloud SQL. - STANDARD = 1; - - // Deprecated: ADVANCED is deprecated. Please use ENHANCED instead. - ADVANCED = 2 [deprecated = true]; - - // Instance is managed by Google Cloud Backup and DR Service. - ENHANCED = 3; - } - - // Start time for the daily backup configuration in UTC timezone in the 24 - // hour format - `HH:MM`. - string start_time = 1; - - // Whether this configuration is enabled. - google.protobuf.BoolValue enabled = 2; - - // This is always `sql#backupConfiguration`. - string kind = 3; - - // (MySQL only) Whether binary log is enabled. If backup configuration is - // disabled, binarylog must be disabled as well. - google.protobuf.BoolValue binary_log_enabled = 4; - - // Reserved for future use. - google.protobuf.BoolValue replication_log_archiving_enabled = 5; - - // Location of the backup - string location = 6; - - // Whether point in time recovery is enabled. - google.protobuf.BoolValue point_in_time_recovery_enabled = 7; - - // The number of days of transaction logs we retain for point in time - // restore, from 1-7. - google.protobuf.Int32Value transaction_log_retention_days = 9; - - // Backup retention settings. - BackupRetentionSettings backup_retention_settings = 10; - - // Output only. This value contains the storage location of transactional logs - // for the database for point-in-time recovery. - optional TransactionalLogStorageState transactional_log_storage_state = 11 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Backup tier that manages the backups for the instance. - optional BackupTier backup_tier = 12 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A BackupRun resource. -message BackupRun { - // This is always `sql#backupRun`. - string kind = 1; - - // The status of this run. - SqlBackupRunStatus status = 2; - - // The time the run was enqueued in UTC timezone in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp enqueued_time = 3; - - // The identifier for this backup run. Unique only for a specific Cloud SQL - // instance. - int64 id = 4; - - // The time the backup operation actually started in UTC timezone in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp start_time = 5; - - // The time the backup operation completed in UTC timezone in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp end_time = 6; - - // Information about why the backup operation failed. This is only present if - // the run has the FAILED status. - OperationError error = 7; - - // The type of this run; can be either "AUTOMATED" or "ON_DEMAND" or "FINAL". - // This field defaults to "ON_DEMAND" and is ignored, when specified for - // insert requests. - SqlBackupRunType type = 8; - - // The description of this run, only applicable to on-demand backups. - string description = 9; - - // The start time of the backup window during which this the backup was - // attempted in [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for - // example `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp window_start_time = 10; - - // Name of the database instance. - string instance = 11; - - // The URI of this resource. - string self_link = 12; - - // Location of the backups. - string location = 13; - - // Output only. The instance database version at the time this backup was - // made. - SqlDatabaseVersion database_version = 15 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Encryption configuration specific to a backup. - DiskEncryptionConfiguration disk_encryption_configuration = 16; - - // Encryption status specific to a backup. - DiskEncryptionStatus disk_encryption_status = 17; - - // Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. - SqlBackupKind backup_kind = 19; - - // Backup time zone to prevent restores to an instance with - // a different time zone. Now relevant only for SQL Server. - string time_zone = 23; - - // Output only. The maximum chargeable bytes for the backup. - optional int64 max_chargeable_bytes = 24 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A backup resource. -message Backup { - option (google.api.resource) = { - type: "sqladmin.googleapis.com/Backup" - pattern: "projects/{project}/backups/{backup}" - }; - - // The backup type. - enum SqlBackupType { - // This is an unknown backup type. - SQL_BACKUP_TYPE_UNSPECIFIED = 0; - - // The backup schedule triggers a backup automatically. - AUTOMATED = 1; - - // The user triggers a backup manually. - ON_DEMAND = 2; - - // The backup that's created when the instance is deleted. - FINAL = 3; - } - - // The backup's state - enum SqlBackupState { - // The state of the backup is unknown. - SQL_BACKUP_STATE_UNSPECIFIED = 0; - - // The backup that's added to a queue. - ENQUEUED = 1; - - // The backup is in progress. - RUNNING = 2; - - // The backup failed. - FAILED = 3; - - // The backup is successful. - SUCCESSFUL = 4; - - // The backup is being deleted. - DELETING = 5; - - // Deletion of the backup failed. - DELETION_FAILED = 6; - } - - // Output only. The resource name of the backup. - // Format: projects/{project}/backups/{backup}. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This is always `sql#backup`. - string kind = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The URI of this resource. - string self_link = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The type of this backup. The type can be "AUTOMATED", - // "ON_DEMAND", or “FINAL”. - SqlBackupType type = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The description of this backup. - string description = 5; - - // The name of the database instance. - string instance = 6; - - // The storage location of the backups. The location can be multi-regional. - string location = 7; - - // Output only. This output contains the following values: - // start_time: All database writes up to this time are available. - // end_time: Any database writes after this time aren't available. - google.type.Interval backup_interval = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The state of this backup. - SqlBackupState state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Information about why the backup operation fails (for example, - // when the backup state fails). - OperationError error = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This output contains the encryption configuration for a backup - // and the resource name of the KMS key for disk encryption. - string kms_key = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This output contains the encryption status for a backup and - // the version of the KMS key that's used to encrypt the Cloud SQL instance. - string kms_key_version = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Specifies the kind of backup, PHYSICAL or DEFAULT_SNAPSHOT. - SqlBackupKind backup_kind = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This output contains a backup time zone. If a Cloud SQL for - // SQL Server instance has a different time zone from the backup's time zone, - // then the restore to the instance doesn't happen. - string time_zone = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; - - oneof expiration { - // Input only. The time-to-live (TTL) interval for this resource (in days). - // For example: ttlDays:7, means 7 days from the current time. The - // expiration time can't exceed 365 days from the time that the backup is - // created. - int64 ttl_days = 16 [(google.api.field_behavior) = INPUT_ONLY]; - - // Backup expiration time. - // A UTC timestamp of when this resource expired. - google.protobuf.Timestamp expiry_time = 17; - } - - // Output only. The database version of the instance of at the time this - // backup was made. - SqlDatabaseVersion database_version = 20 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The maximum chargeable bytes for the backup. - optional int64 max_chargeable_bytes = 23 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. Output only. Timestamp in UTC of when the instance associated - // with this backup is deleted. - google.protobuf.Timestamp instance_deletion_time = 24 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Optional. Output only. Instance setting of the source instance that's - // associated with this backup. - DatabaseInstance instance_settings = 25 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // Output only. The mapping to backup run resource used for IAM validations. - string backup_run = 26 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This status indicates whether the backup satisfies PZS. - // - // The status is reserved for future use. - google.protobuf.BoolValue satisfies_pzs = 27 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. This status indicates whether the backup satisfies PZI. - // - // The status is reserved for future use. - google.protobuf.BoolValue satisfies_pzi = 28 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Backup run list results. -message BackupRunsListResponse { - // This is always `sql#backupRunsList`. - string kind = 1; - - // A list of backup runs in reverse chronological order of the enqueued time. - repeated BackupRun items = 2; - - // The continuation token, used to page through large result sets. Provide - // this value in a subsequent request to return the next page of results. - string next_page_token = 3; -} - -// Binary log coordinates. -message BinLogCoordinates { - // Name of the binary log file for a Cloud SQL instance. - string bin_log_file_name = 1; - - // Position (offset) within the binary log file. - int64 bin_log_position = 2; - - // This is always `sql#binLogCoordinates`. - string kind = 3; -} - -// Backup context. -message BackupContext { - // The identifier of the backup. - int64 backup_id = 1; - - // This is always `sql#backupContext`. - string kind = 2; - - // The name of the backup. - // Format: projects/{project}/backups/{backup} - string name = 3; -} - -// Database instance clone context. -message CloneContext { - // This is always `sql#cloneContext`. - string kind = 1; - - // Reserved for future use. - int64 pitr_timestamp_ms = 2; - - // Name of the Cloud SQL instance to be created as a clone. - string destination_instance_name = 3; - - // Binary log coordinates, if specified, identify the position up to which the - // source instance is cloned. If not specified, the source instance is - // cloned up to the most recent binary log coordinates. - BinLogCoordinates bin_log_coordinates = 4; - - // Timestamp, if specified, identifies the time to which the source instance - // is cloned. - google.protobuf.Timestamp point_in_time = 5; - - // The name of the allocated ip range for the private ip Cloud SQL instance. - // For example: "google-managed-services-default". If set, the cloned instance - // ip will be created in the allocated range. The range name must comply with - // [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name - // must be 1-63 characters long and match the regular expression - // [a-z]([-a-z0-9]*[a-z0-9])?. - // Reserved for future use. - string allocated_ip_range = 6; - - // (SQL Server only) Clone only the specified databases from the source - // instance. Clone all databases if empty. - repeated string database_names = 9; - - // Optional. Copy clone and point-in-time recovery clone of an instance to the - // specified zone. If no zone is specified, clone to the same primary zone as - // the source instance. - optional string preferred_zone = 10 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Copy clone and point-in-time recovery clone of a regional - // instance in the specified zones. If not specified, clone to the same - // secondary zone as the source instance. This value cannot be the same as the - // preferred_zone field. - optional string preferred_secondary_zone = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // The timestamp used to identify the time when the source instance is - // deleted. If this instance is deleted, then you must set the timestamp. - optional google.protobuf.Timestamp source_instance_deletion_time = 12; - - // Optional. The project ID of the destination project where the cloned - // instance will be created. To perform a cross-project clone, this field is - // required. If not specified, the clone is created in the same project - // as the source instance. - optional string destination_project = 13 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The fully qualified URI of the VPC network to which the cloned - // instance will be connected via Private Services Access for private IP. For - // example:`projects/my-network-project/global/networks/my-network`. This - // field is only required for cross-project cloning. - optional string destination_network = 14 [ - (google.api.field_behavior) = OPTIONAL, - (google.api.resource_reference) = { type: "compute.googleapis.com/Network" } - ]; -} - -// Represents a SQL database on the Cloud SQL instance. -message Database { - // This is always `sql#database`. - string kind = 1; - - // The Cloud SQL charset value. - string charset = 2; - - // The Cloud SQL collation value. - string collation = 3; - - // This field is deprecated and will be removed from a future version of the - // API. - string etag = 4; - - // The name of the database in the Cloud SQL instance. This does not include - // the project ID or instance name. - string name = 5; - - // The name of the Cloud SQL instance. This does not include the project ID. - string instance = 6; - - // The URI of this resource. - string self_link = 7; - - // The project ID of the project containing the Cloud SQL database. The Google - // apps domain is prefixed if applicable. - string project = 8; - - oneof database_details { - SqlServerDatabaseDetails sqlserver_database_details = 9; - } -} - -// Represents a Sql Server database on the Cloud SQL instance. -message SqlServerDatabaseDetails { - // The version of SQL Server with which the database is to be made compatible - int32 compatibility_level = 1; - - // The recovery model of a SQL Server database - string recovery_model = 2; -} - -// Database flags for Cloud SQL instances. -message DatabaseFlags { - // The name of the flag. These flags are passed at instance startup, so - // include both server options and system variables. Flags are - // specified with underscores, not hyphens. For more information, see - // [Configuring Database Flags](https://cloud.google.com/sql/docs/mysql/flags) - // in the Cloud SQL documentation. - string name = 1; - - // The value of the flag. Boolean flags are set to `on` for true - // and `off` for false. This field must be omitted if the flag - // doesn't take a value. - string value = 2; -} - -// Initial sync flags for certain Cloud SQL APIs. -// Currently used for the MySQL external server initial dump. -message SyncFlags { - // The name of the flag. - string name = 1; - - // The value of the flag. This field must be omitted if the flag - // doesn't take a value. - string value = 2; -} - -// Reference to another Cloud SQL instance. -message InstanceReference { - // The name of the Cloud SQL instance being referenced. - // This does not include the project ID. - string name = 1; - - // The region of the Cloud SQL instance being referenced. - string region = 2; - - // The project ID of the Cloud SQL instance being referenced. - // The default is the same project ID as the instance references it. - string project = 3; -} - -// A Cloud SQL instance resource. -message DatabaseInstance { - // The current serving state of the database instance. - enum SqlInstanceState { - // The state of the instance is unknown. - SQL_INSTANCE_STATE_UNSPECIFIED = 0; - - // The instance is running, or has been stopped by owner. - RUNNABLE = 1; - - // The instance is not available, for example due to problems with billing. - SUSPENDED = 2; - - // The instance is being deleted. - PENDING_DELETE = 3; - - // The instance is being created. - PENDING_CREATE = 4; - - // The instance is down for maintenance. - MAINTENANCE = 5; - - // The creation of the instance failed or a fatal error occurred during - // maintenance. - FAILED = 6; - - // Deprecated - ONLINE_MAINTENANCE = 7 [deprecated = true]; - - // (Applicable to read pool nodes only.) The read pool node needs to be - // repaired. The database might be unavailable. - REPAIRING = 8; - } - - message SqlFailoverReplica { - // The name of the failover replica. If specified at instance creation, a - // failover replica is created for the instance. The name - // doesn't include the project ID. - string name = 1; - - // The availability status of the failover replica. A false status indicates - // that the failover replica is out of sync. The primary instance can only - // failover to the failover replica when the status is true. - google.protobuf.BoolValue available = 2; - } - - // Any scheduled maintenance for this instance. - message SqlScheduledMaintenance { - // The start time of any upcoming scheduled maintenance for this instance. - google.protobuf.Timestamp start_time = 1; - - bool can_defer = 2 [deprecated = true]; - - // If the scheduled maintenance can be rescheduled. - bool can_reschedule = 3; - - // Maintenance cannot be rescheduled to start beyond this deadline. - optional google.protobuf.Timestamp schedule_deadline_time = 4; - } - - // This message wraps up the information written by out-of-disk detection job. - message SqlOutOfDiskReport { - // This enum lists all possible states regarding out-of-disk issues. - enum SqlOutOfDiskState { - // Unspecified state - SQL_OUT_OF_DISK_STATE_UNSPECIFIED = 0; - - // The instance has plenty space on data disk - NORMAL = 1; - - // Data disk is almost used up. It is shutdown to prevent data - // corruption. - SOFT_SHUTDOWN = 2; - } - - // This field represents the state generated by the proactive database - // wellness job for OutOfDisk issues. - // * Writers: - // * the proactive database wellness job for OOD. - // * Readers: - // * the proactive database wellness job - optional SqlOutOfDiskState sql_out_of_disk_state = 1; - - // The minimum recommended increase size in GigaBytes - // This field is consumed by the frontend - // * Writers: - // * the proactive database wellness job for OOD. - // * Readers: - optional int32 sql_min_recommended_increase_size_gb = 2; - } - - // The SQL network architecture for the instance. - enum SqlNetworkArchitecture { - SQL_NETWORK_ARCHITECTURE_UNSPECIFIED = 0; - - // The instance uses the new network architecture. - NEW_NETWORK_ARCHITECTURE = 1; - - // The instance uses the old network architecture. - OLD_NETWORK_ARCHITECTURE = 2; - } - - // Details of a single read pool node of a read pool. - message PoolNodeConfig { - // Output only. The name of the read pool node, to be used for retrieving - // metrics and logs. - optional string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The zone of the read pool node. - optional string gce_zone = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Mappings containing IP addresses that can be used to connect - // to the read pool node. - repeated IpMapping ip_addresses = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The DNS name of the read pool node. - optional string dns_name = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the read pool node. - optional SqlInstanceState state = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of DNS names used by this read pool node. - repeated DnsNameMapping dns_names = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Private Service Connect (PSC) service attachment of the - // read pool node. - optional string psc_service_attachment_link = 7 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of settings for requested automatically-setup - // Private Service Connect (PSC) consumer endpoints that can be used to - // connect to this read pool node. - repeated PscAutoConnectionConfig psc_auto_connections = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // This is always `sql#instance`. - string kind = 1; - - // The current serving state of the Cloud SQL instance. - SqlInstanceState state = 2; - - // The database engine type and version. The `databaseVersion` field cannot - // be changed after instance creation. - SqlDatabaseVersion database_version = 3; - - // The user settings. - Settings settings = 4; - - // This field is deprecated and will be removed from a future version of the - // API. Use the `settings.settingsVersion` field instead. - string etag = 5; - - // The name and status of the failover replica. - SqlFailoverReplica failover_replica = 6; - - // The name of the instance which will act as primary in the replication - // setup. - string master_instance_name = 7; - - // The replicas of the instance. - repeated string replica_names = 8; - - // The maximum disk size of the instance in bytes. - google.protobuf.Int64Value max_disk_size = 9 [deprecated = true]; - - // The current disk usage of the instance in bytes. This property has been - // deprecated. Use the - // "cloudsql.googleapis.com/database/disk/bytes_used" metric in Cloud - // Monitoring API instead. Please see [this - // announcement](https://groups.google.com/d/msg/google-cloud-sql-announce/I_7-F9EBhT0/BtvFtdFeAgAJ) - // for details. - google.protobuf.Int64Value current_disk_size = 10 [deprecated = true]; - - // The assigned IP addresses for the instance. - repeated IpMapping ip_addresses = 11; - - // SSL configuration. - SslCert server_ca_cert = 12; - - // The instance type. - SqlInstanceType instance_type = 13; - - // The project ID of the project containing the Cloud SQL instance. The Google - // apps domain is prefixed if applicable. - string project = 14; - - // The IPv6 address assigned to the instance. - // (Deprecated) This property was applicable only - // to First Generation instances. - string ipv6_address = 15 [deprecated = true]; - - // The service account email address assigned to the instance. \This - // property is read-only. - string service_account_email_address = 16; - - // Configuration specific to on-premises instances. - OnPremisesConfiguration on_premises_configuration = 17; - - // Configuration specific to failover replicas and read replicas. - ReplicaConfiguration replica_configuration = 18; - - // The backend type. - // `SECOND_GEN`: Cloud SQL database instance. - // `EXTERNAL`: A database server that is not managed by Google. - // - // This property is read-only; use the `tier` property in the `settings` - // object to determine the database type. - SqlBackendType backend_type = 19; - - // The URI of this resource. - string self_link = 20; - - // If the instance state is SUSPENDED, the reason for the suspension. - repeated SqlSuspensionReason suspension_reason = 21; - - // Connection name of the Cloud SQL instance used in connection strings. - string connection_name = 22; - - // Name of the Cloud SQL instance. This does not include the project ID. - string name = 23; - - // The geographical region of the Cloud SQL instance. - // - // It can be one of the - // [regions](https://cloud.google.com/sql/docs/mysql/locations#location-r) - // where Cloud SQL operates: - // - // For example, `asia-east1`, `europe-west1`, and `us-central1`. - // The default value is `us-central1`. - string region = 24; - - // The Compute Engine zone that the instance is currently serving from. This - // value could be different from the zone that was specified when the instance - // was created if the instance has failed over to its secondary zone. WARNING: - // Changing this might restart the instance. - string gce_zone = 25; - - // The Compute Engine zone that the failover instance is currently serving - // from for a regional instance. This value could be different - // from the zone that was specified when the instance - // was created if the instance has failed over to its secondary/failover zone. - string secondary_gce_zone = 34; - - // Disk encryption configuration specific to an instance. - DiskEncryptionConfiguration disk_encryption_configuration = 26; - - // Disk encryption status specific to an instance. - DiskEncryptionStatus disk_encryption_status = 27; - - // Initial root password. Use only on creation. You must set root passwords - // before you can connect to PostgreSQL instances. - string root_password = 29; - - // The start time of any upcoming scheduled maintenance for this instance. - SqlScheduledMaintenance scheduled_maintenance = 30; - - // This status indicates whether the instance satisfies PZS. - // - // The status is reserved for future use. - google.protobuf.BoolValue satisfies_pzs = 35; - - // Output only. Stores the current database version running on the instance - // including minor version such as `MYSQL_8_0_18`. - string database_installed_version = 40 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // This field represents the report generated by the proactive database - // wellness job for OutOfDisk issues. - // * Writers: - // * the proactive database wellness job for OOD. - // * Readers: - // * the proactive database wellness job - optional SqlOutOfDiskReport out_of_disk_report = 38; - - // Output only. The time when the instance was created in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp create_time = 39 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. List all maintenance versions applicable on the instance - repeated string available_maintenance_versions = 41 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The current software version on the instance. - string maintenance_version = 42; - - // Output only. All database versions that are available for upgrade. - repeated AvailableDatabaseVersion upgradable_database_versions = 45 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The SQL network architecture for the instance. - optional SqlNetworkArchitecture sql_network_architecture = 47; - - // Output only. The link to service attachment of PSC instance. - optional string psc_service_attachment_link = 48 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The dns name of the instance. - optional string dns_name = 49 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. DEPRECATED: please use write_endpoint instead. - optional string primary_dns_name = 51 - [deprecated = true, (google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The dns name of the primary instance in a replication group. - optional string write_endpoint = 52 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A primary instance and disaster recovery (DR) replica pair. - // A DR replica is a cross-region replica that you designate - // for failover in the event that the primary instance - // experiences regional failure. - // Applicable to MySQL and PostgreSQL. - optional ReplicationCluster replication_cluster = 54; - - // Gemini instance configuration. - optional GeminiInstanceConfig gemini_config = 55; - - // Output only. This status indicates whether the instance satisfies PZI. - // - // The status is reserved for future use. - google.protobuf.BoolValue satisfies_pzi = 56 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input only. Whether Cloud SQL is enabled to switch storing point-in-time - // recovery log files from a data disk to Cloud Storage. - optional google.protobuf.BoolValue - switch_transaction_logs_to_cloud_storage_enabled = 57 - [(google.api.field_behavior) = INPUT_ONLY]; - - // Input only. Determines whether an in-place major version upgrade of - // replicas happens when an in-place major version upgrade of a primary - // instance is initiated. - optional google.protobuf.BoolValue - include_replicas_for_major_version_upgrade = 59 - [(google.api.field_behavior) = INPUT_ONLY]; - - // Optional. Input only. Immutable. Tag keys and tag values that are bound to - // this instance. You must represent each item in the map as: - // `"" : ""`. - // - // For example, a single resource can have the following tags: - // ``` - // "123/environment": "production", - // "123/costCenter": "marketing", - // ``` - // - // For more information on tag creation and management, see - // https://cloud.google.com/resource-manager/docs/tags/tags-overview. - map tags = 60 [ - (google.api.field_behavior) = INPUT_ONLY, - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OPTIONAL - ]; - - // The number of read pool nodes in a read pool. - optional int32 node_count = 63; - - // Output only. Entries containing information about each read pool node of - // the read pool. - repeated PoolNodeConfig nodes = 64 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The list of DNS names used by this instance. - repeated DnsNameMapping dns_names = 67 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// DNS metadata. -message DnsNameMapping { - // The connection type of the DNS name. - enum ConnectionType { - // Unknown connection type. - CONNECTION_TYPE_UNSPECIFIED = 0; - - // Public IP. - PUBLIC = 1; - - // Private services access (private IP). - PRIVATE_SERVICES_ACCESS = 2; - - // Private Service Connect. - PRIVATE_SERVICE_CONNECT = 3; - } - - // The scope that the DNS name applies to. - enum DnsScope { - // DNS scope not set. This value should not be used. - DNS_SCOPE_UNSPECIFIED = 0; - - // Indicates an instance-level DNS name. - INSTANCE = 1; - - // Indicates a cluster-level DNS name. - CLUSTER = 2; - } - - // The system responsible for managing the DNS record. - enum RecordManager { - // Record manager not set. This value should not be used. - RECORD_MANAGER_UNSPECIFIED = 0; - - // The record may be managed by the customer. It is not automatically - // managed by Cloud SQL automation. - CUSTOMER = 1; - - // The record is managed by Cloud SQL, which will create, update, and delete - // the DNS records for the zone automatically when the Cloud SQL database - // instance is created or updated. - CLOUD_SQL_AUTOMATION = 2; - } - - // Output only. The DNS name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The connection type of the DNS name. - ConnectionType connection_type = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The scope that the DNS name applies to. - DnsScope dns_scope = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The manager for this DNS record. - RecordManager record_manager = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Gemini instance configuration. -message GeminiInstanceConfig { - // Output only. Whether Gemini is enabled. - optional bool entitled = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether the vacuum management is enabled. - optional bool google_vacuum_mgmt_enabled = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether canceling the out-of-memory (OOM) session is enabled. - optional bool oom_session_cancel_enabled = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether the active query is enabled. - optional bool active_query_enabled = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether the index advisor is enabled. - optional bool index_advisor_enabled = 5 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Whether the flag recommender is enabled. - optional bool flag_recommender_enabled = 6 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A primary instance and disaster recovery (DR) replica pair. -// A DR replica is a cross-region replica that you designate for failover -// in the event that the primary instance has regional failure. -// Applicable to MySQL and PostgreSQL. -message ReplicationCluster { - // Output only. If set, this field indicates this instance has a private - // service access (PSA) DNS endpoint that is pointing to the primary instance - // of the cluster. If this instance is the primary, then the DNS endpoint - // points to this instance. After a switchover or replica failover operation, - // this DNS endpoint points to the promoted instance. This is a read-only - // field, returned to the user as information. This field can exist even if a - // standalone instance doesn't have a DR replica yet or the DR replica is - // deleted. - optional string psa_write_endpoint = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. If the instance is a primary instance, then this field identifies - // the disaster recovery (DR) replica. A DR replica is an optional - // configuration for Enterprise Plus edition instances. If the instance is a - // read replica, then the field is not set. Set this field to a replica name - // to designate a DR replica for a primary instance. Remove the replica name - // to remove the DR replica designation. - optional string failover_dr_replica_name = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Read-only field that indicates whether the replica is a DR - // replica. This field is not set if the instance is a primary instance. - optional bool dr_replica = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// An available database version. It can be a major or a minor version. -message AvailableDatabaseVersion { - // The version's major version name. - optional string major_version = 3; - - // The database version name. For MySQL 8.0, this string provides the database - // major and minor version. - optional string name = 8; - - // The database version's display name. - optional string display_name = 9; -} - -// Database list response. -message DatabasesListResponse { - // This is always `sql#databasesList`. - string kind = 1; - - // List of database resources in the instance. - repeated Database items = 2; -} - -// Read-replica configuration for connecting to the on-premises primary -// instance. -message DemoteMasterConfiguration { - // This is always `sql#demoteMasterConfiguration`. - string kind = 1; - - // MySQL specific configuration when replicating from a MySQL on-premises - // primary instance. Replication configuration information such as the - // username, password, certificates, and keys are not stored in the instance - // metadata. The configuration information is used only to set up the - // replication connection and is stored by MySQL in a file named - // `master.info` in the data directory. - DemoteMasterMySqlReplicaConfiguration mysql_replica_configuration = 2; -} - -// Database instance demote primary instance context. -message DemoteMasterContext { - // This is always `sql#demoteMasterContext`. - string kind = 1; - - // Verify the GTID consistency for demote operation. Default value: - // `True`. Setting this flag to `false` enables you to bypass the GTID - // consistency check between on-premises primary instance and Cloud SQL - // instance during the demotion operation but also exposes you to the risk of - // future replication failures. Change the value only if you know the reason - // for the GTID divergence and are confident that doing so will not cause any - // replication issues. - google.protobuf.BoolValue verify_gtid_consistency = 2; - - // The name of the instance which will act as on-premises primary instance - // in the replication setup. - string master_instance_name = 3; - - // Configuration specific to read-replicas replicating from the on-premises - // primary instance. - DemoteMasterConfiguration replica_configuration = 4; - - // Flag to skip replication setup on the instance. - bool skip_replication_setup = 5; -} - -// Read-replica configuration specific to MySQL databases. -message DemoteMasterMySqlReplicaConfiguration { - // This is always `sql#demoteMasterMysqlReplicaConfiguration`. - string kind = 1; - - // The username for the replication connection. - string username = 2; - - // The password for the replication connection. - string password = 3; - - // PEM representation of the replica's private key. The corresponding public - // key is encoded in the client's certificate. The format of the replica's - // private key can be either PKCS #1 or PKCS #8. - string client_key = 4; - - // PEM representation of the replica's x509 certificate. - string client_certificate = 5; - - // PEM representation of the trusted CA's x509 certificate. - string ca_certificate = 6; -} - -// This context is used to demote an existing standalone instance to be -// a Cloud SQL read replica for an external database server. -message DemoteContext { - // This is always `sql#demoteContext`. - string kind = 1; - - // Required. The name of the instance which acts as an on-premises primary - // instance in the replication setup. - string source_representative_instance_name = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -enum SqlFileType { - // Unknown file type. - SQL_FILE_TYPE_UNSPECIFIED = 0; - - // File containing SQL statements. - SQL = 1; - - // File in CSV format. - CSV = 2; - - BAK = 4; - - // TDE certificate. - TDE = 8; -} - -// Database instance export context. -message ExportContext { - message SqlCsvExportOptions { - // The select query used to extract the data. - string select_query = 1; - - // Specifies the character that should appear before a data character that - // needs to be escaped. - string escape_character = 2; - - // Specifies the quoting character to be used when a data value is quoted. - string quote_character = 3; - - // Specifies the character that separates columns within each row (line) of - // the file. - string fields_terminated_by = 4; - - // This is used to separate lines. If a line does not contain all fields, - // the rest of the columns are set to their default values. - string lines_terminated_by = 6; - } - - message SqlExportOptions { - // Options for exporting from MySQL. - message MysqlExportOptions { - // Option to include SQL statement required to set up replication. If set - // to `1`, the dump file includes a CHANGE MASTER TO statement with the - // binary log coordinates, and --set-gtid-purged is set to ON. If set to - // `2`, the CHANGE MASTER TO statement is written as a SQL comment and - // has no effect. If set to any value other than `1`, --set-gtid-purged - // is set to OFF. - google.protobuf.Int32Value master_data = 1; - } - - // Options for exporting from a Cloud SQL for PostgreSQL instance. - message PostgresExportOptions { - // Optional. Use this option to include DROP <object> - // SQL statements. Use these statements to delete database objects before - // running the import operation. - google.protobuf.BoolValue clean = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Option to include an IF EXISTS SQL statement with each DROP - // statement produced by clean. - google.protobuf.BoolValue if_exists = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Tables to export, or that were exported, from the specified database. If - // you specify tables, specify one and only one database. For PostgreSQL - // instances, you can specify only one table. - repeated string tables = 1; - - // Export only schemas. - google.protobuf.BoolValue schema_only = 2; - - MysqlExportOptions mysql_export_options = 3; - - // Optional. The number of threads to use for parallel export. - google.protobuf.Int32Value threads = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether or not the export should be parallel. - google.protobuf.BoolValue parallel = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Options for exporting from a Cloud SQL for PostgreSQL instance. - PostgresExportOptions postgres_export_options = 6 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Options for exporting BAK files (SQL Server-only) - message SqlBakExportOptions { - // Whether or not the export should be striped. - google.protobuf.BoolValue striped = 1; - - // Option for specifying how many stripes to use for the export. - // If blank, and the value of the striped field is true, - // the number of stripes is automatically chosen. - google.protobuf.Int32Value stripe_count = 2; - - // Type of this bak file will be export, FULL or DIFF, SQL Server only - BakType bak_type = 4; - - // Deprecated: copy_only is deprecated. Use differential_base instead - google.protobuf.BoolValue copy_only = 5 [deprecated = true]; - - // Whether or not the backup can be used as a differential base - // copy_only backup can not be served as differential base - google.protobuf.BoolValue differential_base = 6; - - // Optional. The begin timestamp when transaction log will be included in - // the export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) - // format (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all - // available logs from the beginning of retention period will be included. - // Only applied to Cloud SQL for SQL Server. - google.protobuf.Timestamp export_log_start_time = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The end timestamp when transaction log will be included in the - // export operation. [RFC 3339](https://tools.ietf.org/html/rfc3339) format - // (for example, `2023-10-01T16:19:00.094`) in UTC. When omitted, all - // available logs until current time will be included. Only applied to Cloud - // SQL for SQL Server. - google.protobuf.Timestamp export_log_end_time = 8 - [(google.api.field_behavior) = OPTIONAL]; - } - - message SqlTdeExportOptions { - // Required. Path to the TDE certificate public key - // in the form gs://bucketName/fileName. - // The instance must have write access to the location. - // Applicable only for SQL Server instances. - string certificate_path = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Path to the TDE certificate private key - // in the form gs://bucketName/fileName. - // The instance must have write access to the location. - // Applicable only for SQL Server instances. - string private_key_path = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Password that encrypts the private key. - string private_key_password = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Certificate name. - // Applicable only for SQL Server instances. - string name = 5 [(google.api.field_behavior) = REQUIRED]; - } - - // The path to the file in Google Cloud Storage where the export will be - // stored. The URI is in the form `gs://bucketName/fileName`. If the file - // already exists, the request succeeds, but the operation fails. If - // `fileType` is `SQL` and the filename ends with .gz, - // the contents are compressed. - string uri = 1; - - // Databases to be exported.
`MySQL instances:` If - // `fileType` is `SQL` and no database is specified, all - // databases are exported, except for the `mysql` system database. - // If `fileType` is `CSV`, you can specify one database, - // either by using this property or by using the - // `csvExportOptions.selectQuery` property, which takes precedence - // over this property.
`PostgreSQL instances:` If you don't specify a - // database by name, all user databases in the instance are - // exported. This excludes system databases and Cloud SQL databases used to - // manage internal operations. Exporting all user databases is only available - // for directory-formatted parallel export. If `fileType` is `CSV`, - // this database must match the one specified in the - // `csvExportOptions.selectQuery` property.
`SQL Server - // instances:` You must specify one database to be exported, and the - // `fileType` must be `BAK`. - repeated string databases = 2; - - // This is always `sql#exportContext`. - string kind = 3; - - // Options for exporting data as SQL statements. - SqlExportOptions sql_export_options = 4; - - // Options for exporting data as CSV. `MySQL` and `PostgreSQL` - // instances only. - SqlCsvExportOptions csv_export_options = 5; - - // The file type for the specified uri. - SqlFileType file_type = 6; - - // Whether to perform a serverless export. - google.protobuf.BoolValue offload = 8; - - // Options for exporting data as BAK files. - SqlBakExportOptions bak_export_options = 9; - - // Optional. Export parameters specific to SQL Server TDE certificates - SqlTdeExportOptions tde_export_options = 10 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Database instance failover context. -message FailoverContext { - // The current settings version of this instance. Request will be rejected if - // this version doesn't match the current settings version. - int64 settings_version = 1; - - // This is always `sql#failoverContext`. - string kind = 2; -} - -// A flag resource. -message Flag { - // This is the name of the flag. Flag names always use underscores, not - // hyphens, for example: `max_allowed_packet` - string name = 1; - - // The type of the flag. Flags are typed to being `BOOLEAN`, `STRING`, - // `INTEGER` or `NONE`. `NONE` is used for flags which do not take a - // value, such as `skip_grant_tables`. - SqlFlagType type = 2; - - // The database version this flag applies to. Can be - // MySQL instances: `MYSQL_8_0`, `MYSQL_8_0_18`, `MYSQL_8_0_26`, `MYSQL_5_7`, - // or `MYSQL_5_6`. PostgreSQL instances: `POSTGRES_9_6`, `POSTGRES_10`, - // `POSTGRES_11` or `POSTGRES_12`. SQL Server instances: - // `SQLSERVER_2017_STANDARD`, `SQLSERVER_2017_ENTERPRISE`, - // `SQLSERVER_2017_EXPRESS`, `SQLSERVER_2017_WEB`, `SQLSERVER_2019_STANDARD`, - // `SQLSERVER_2019_ENTERPRISE`, `SQLSERVER_2019_EXPRESS`, or - // `SQLSERVER_2019_WEB`. - // See [the complete - // list](/sql/docs/mysql/admin-api/rest/v1/SqlDatabaseVersion). - repeated SqlDatabaseVersion applies_to = 3; - - // For `STRING` flags, a list of strings that the value can be set to. - repeated string allowed_string_values = 4; - - // For `INTEGER` flags, the minimum allowed value. - google.protobuf.Int64Value min_value = 5; - - // For `INTEGER` flags, the maximum allowed value. - google.protobuf.Int64Value max_value = 6; - - // Indicates whether changing this flag will trigger a database restart. Only - // applicable to Second Generation instances. - google.protobuf.BoolValue requires_restart = 7; - - // This is always `sql#flag`. - string kind = 8; - - // Whether or not the flag is considered in beta. - google.protobuf.BoolValue in_beta = 9; - - // Use this field if only certain integers are accepted. Can be combined - // with min_value and max_value to add additional values. - repeated int64 allowed_int_values = 10; - - // Scope of flag. - SqlFlagScope flag_scope = 15; - - // Recommended flag value for UI display. - oneof recommended_value { - // Recommended flag value in string format for UI display. - string recommended_string_value = 16; - - // Recommended flag value in integer format for UI display. - google.protobuf.Int64Value recommended_int_value = 17; - } -} - -// Flags list response. -message FlagsListResponse { - // This is always `sql#flagsList`. - string kind = 1; - - // List of flags. - repeated Flag items = 2; -} - -// Database instance import context. -message ImportContext { - message SqlImportOptions { - message PostgresImportOptions { - // Optional. The --clean flag for the pg_restore utility. This flag - // applies only if you enabled Cloud SQL to import files in parallel. - google.protobuf.BoolValue clean = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The --if-exists flag for the pg_restore utility. This flag - // applies only if you enabled Cloud SQL to import files in parallel. - google.protobuf.BoolValue if_exists = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Optional. The number of threads to use for parallel import. - google.protobuf.Int32Value threads = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Whether or not the import should be parallel. - google.protobuf.BoolValue parallel = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Options for importing from a Cloud SQL for PostgreSQL instance. - PostgresImportOptions postgres_import_options = 3 - [(google.api.field_behavior) = OPTIONAL]; - } - - message SqlCsvImportOptions { - // The table to which CSV data is imported. - string table = 1; - - // The columns to which CSV data is imported. If not specified, all columns - // of the database table are loaded with CSV data. - repeated string columns = 2; - - // Specifies the character that should appear before a data character that - // needs to be escaped. - string escape_character = 4; - - // Specifies the quoting character to be used when a data value is quoted. - string quote_character = 5; - - // Specifies the character that separates columns within each row (line) of - // the file. - string fields_terminated_by = 6; - - // This is used to separate lines. If a line does not contain all fields, - // the rest of the columns are set to their default values. - string lines_terminated_by = 8; - } - - message SqlBakImportOptions { - message EncryptionOptions { - // Path to the Certificate (.cer) in Cloud Storage, in the form - // `gs://bucketName/fileName`. The instance must have write permissions - // to the bucket and read access to the file. - string cert_path = 1; - - // Path to the Certificate Private Key (.pvk) in Cloud Storage, in the - // form `gs://bucketName/fileName`. The instance must have write - // permissions to the bucket and read access to the file. - string pvk_path = 2; - - // Password that encrypts the private key - string pvk_password = 3; - - // Optional. Whether the imported file remains encrypted. - google.protobuf.BoolValue keep_encrypted = 5 - [(google.api.field_behavior) = OPTIONAL]; - } - - EncryptionOptions encryption_options = 1; - - // Whether or not the backup set being restored is striped. - // Applies only to Cloud SQL for SQL Server. - google.protobuf.BoolValue striped = 2; - - // Whether or not the backup importing will restore database - // with NORECOVERY option. - // Applies only to Cloud SQL for SQL Server. - google.protobuf.BoolValue no_recovery = 4; - - // Whether or not the backup importing request will just bring database - // online without downloading Bak content only one of "no_recovery" and - // "recovery_only" can be true otherwise error will return. Applies only to - // Cloud SQL for SQL Server. - google.protobuf.BoolValue recovery_only = 5; - - // Type of the bak content, FULL or DIFF. - BakType bak_type = 6; - - // Optional. The timestamp when the import should stop. This timestamp is in - // the [RFC 3339](https://tools.ietf.org/html/rfc3339) format (for example, - // `2023-10-01T16:19:00.094`). This field is equivalent to the STOPAT - // keyword and applies to Cloud SQL for SQL Server only. - google.protobuf.Timestamp stop_at = 7 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The marked transaction where the import should stop. This field - // is equivalent to the STOPATMARK keyword and applies to Cloud SQL for SQL - // Server only. - string stop_at_mark = 8 [(google.api.field_behavior) = OPTIONAL]; - } - - message SqlTdeImportOptions { - // Required. Path to the TDE certificate public key - // in the form gs://bucketName/fileName. - // The instance must have read access to the file. - // Applicable only for SQL Server instances. - string certificate_path = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Path to the TDE certificate private key - // in the form gs://bucketName/fileName. - // The instance must have read access to the file. - // Applicable only for SQL Server instances. - string private_key_path = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. Password that encrypts the private key. - string private_key_password = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Certificate name. - // Applicable only for SQL Server instances. - string name = 5 [(google.api.field_behavior) = REQUIRED]; - } - - // Path to the import file in Cloud Storage, in the form - // `gs://bucketName/fileName`. Compressed gzip files (.gz) are supported - // when `fileType` is `SQL`. The instance must have - // write permissions to the bucket and read access to the file. - string uri = 1; - - // The target database for the import. If `fileType` is `SQL`, this field - // is required only if the import file does not specify a database, and is - // overridden by any database specification in the import file. For entire - // instance parallel import operations, the database is overridden by the - // database name stored in subdirectory name. If - // `fileType` is `CSV`, one database must be specified. - string database = 2; - - // This is always `sql#importContext`. - string kind = 3; - - // The file type for the specified uri. - // * `SQL`: The file contains SQL statements. - // * `CSV`: The file contains CSV data. - // * `BAK`: The file contains backup data for a SQL Server instance. - SqlFileType file_type = 4; - - // Options for importing data as CSV. - SqlCsvImportOptions csv_import_options = 5; - - // The PostgreSQL user for this import operation. PostgreSQL instances only. - string import_user = 6; - - // Import parameters specific to SQL Server .BAK files - SqlBakImportOptions bak_import_options = 7; - - // Optional. Options for importing data from SQL statements. - SqlImportOptions sql_import_options = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Import parameters specific to SQL Server .TDE files - // Import parameters specific to SQL Server TDE certificates - SqlTdeImportOptions tde_import_options = 9 - [(google.api.field_behavior) = OPTIONAL]; -} - -enum BakType { - // Default type. - BAK_TYPE_UNSPECIFIED = 0; - - // Full backup. - FULL = 1; - - // Differential backup. - DIFF = 2; - - // SQL Server Transaction Log - TLOG = 3; -} - -// Database instance clone request. -message InstancesCloneRequest { - // Contains details about the clone operation. - CloneContext clone_context = 1; -} - -// Database demote primary instance request. -message InstancesDemoteMasterRequest { - // Contains details about the demoteMaster operation. - DemoteMasterContext demote_master_context = 1; -} - -// This request is used to demote an existing standalone instance to be a -// Cloud SQL read replica for an external database server. -message InstancesDemoteRequest { - // Required. This context is used to demote an existing standalone instance to - // be a Cloud SQL read replica for an external database server. - DemoteContext demote_context = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// Database instance export request. -message InstancesExportRequest { - // Contains details about the export operation. - ExportContext export_context = 1; -} - -// Instance failover request. -message InstancesFailoverRequest { - // Failover Context. - FailoverContext failover_context = 1; -} - -// Database instance import request. -message InstancesImportRequest { - // Contains details about the import operation. - ImportContext import_context = 1; -} - -// Request for Pre-checks for MVU -message InstancesPreCheckMajorVersionUpgradeRequest { - // Required. Contains details about the pre-check major version upgrade - // operation. - PreCheckMajorVersionUpgradeContext pre_check_major_version_upgrade_context = 1 - [(google.api.field_behavior) = REQUIRED]; -} - -// MySQL-specific external server sync settings. -message MySqlSyncConfig { - // Flags to use for the initial dump. - repeated SyncFlags initial_sync_flags = 1; -} - -// Database instances list response. -message InstancesListResponse { - // This is always `sql#instancesList`. - string kind = 1; - - // List of warnings that occurred while handling the request. - repeated ApiWarning warnings = 2; - - // List of database instance resources. - repeated DatabaseInstance items = 3; - - // The continuation token, used to page through large result sets. Provide - // this value in a subsequent request to return the next page of results. - string next_page_token = 4; -} - -// Instances ListServerCas response. -message InstancesListServerCasResponse { - // List of server CA certificates for the instance. - repeated SslCert certs = 1; - - string active_version = 2; - - // This is always `sql#instancesListServerCas`. - string kind = 3; -} - -// Instances ListServerCertificatess response. -message InstancesListServerCertificatesResponse { - // List of server CA certificates for the instance. - repeated SslCert ca_certs = 1; - - // List of server certificates for the instance, signed by the corresponding - // CA from the `ca_certs` list. - repeated SslCert server_certs = 2; - - // The `sha1_fingerprint` of the active certificate from `server_certs`. - string active_version = 3; - - // This is always `sql#instancesListServerCertificates`. - string kind = 4; -} - -// Instances ListEntraIdCertificates response. -message InstancesListEntraIdCertificatesResponse { - // List of Entra ID certificates for the instance. - repeated SslCert certs = 1; - - // The `sha1_fingerprint` of the active certificate from `certs`. - string active_version = 2; - - // This is always `sql#instancesListEntraIdCertificates`. - string kind = 3; -} - -// Database instance restore backup request. -message InstancesRestoreBackupRequest { - // Parameters required to perform the restore backup operation. - RestoreBackupContext restore_backup_context = 1; - - // The name of the backup that's used to restore a Cloud SQL instance: - // Format: projects/{project-id}/backups/{backup-uid}. Only one of - // restore_backup_context, backup, backupdr_backup can be passed to the input. - string backup = 2 [ - (google.api.resource_reference) = { type: "sqladmin.googleapis.com/Backup" } - ]; - - // The name of the backup that's used to restore a Cloud SQL instance: - // Format: - // "projects/{project-id}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup-uid}". - // Only one of restore_backup_context, backup, backupdr_backup can be - // passed to the input. - string backupdr_backup = 4 [ - (google.api.resource_reference) = { type: "backupdr.googleapis.com/Backup" } - ]; - - // Optional. By using this parameter, Cloud SQL overrides any instance - // settings stored in the backup you are restoring from. You can't change the - // instance's major database version and you can only increase the disk size. - // You can use this field to restore new instances only. This field is not - // applicable for restore to existing instances. - DatabaseInstance restore_instance_settings = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. This field has the same purpose as restore_instance_settings, - // changes any instance settings stored in the backup you are restoring from. - // With the difference that these fields are cleared in the settings. - repeated string restore_instance_clear_overrides_field_names = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Rotate Server CA request. -message InstancesRotateServerCaRequest { - // Contains details about the rotate server CA operation. - RotateServerCaContext rotate_server_ca_context = 1; -} - -// Rotate Server Certificate request. -message InstancesRotateServerCertificateRequest { - // Optional. Contains details about the rotate server CA operation. - RotateServerCertificateContext rotate_server_certificate_context = 1 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Rotate Entra ID Certificate request. -message InstancesRotateEntraIdCertificateRequest { - // Optional. Contains details about the rotate Entra ID certificate operation. - RotateEntraIdCertificateContext rotate_entra_id_certificate_context = 1 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance truncate log request. -message InstancesTruncateLogRequest { - // Contains details about the truncate log operation. - TruncateLogContext truncate_log_context = 1; -} - -// Request to acquire an SSRS lease for an instance. -message InstancesAcquireSsrsLeaseRequest { - // Contains details about the acquire SSRS lease operation. - AcquireSsrsLeaseContext acquire_ssrs_lease_context = 1; -} - -// Context to perform a point-in-time restore of an instance managed by -// Backup and Disaster Recovery (DR) Service. -message PointInTimeRestoreContext { - // The Backup and Disaster Recovery (DR) Service Datasource URI. - // Format: - // projects/{project}/locations/{region}/backupVaults/{backupvault}/dataSources/{datasource}. - optional string datasource = 1; - - // Required. The date and time to which you want to restore the instance. - google.protobuf.Timestamp point_in_time = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Target instance name. - optional string target_instance = 3; - - // Optional. The resource link for the VPC network from which the Cloud SQL - // instance is accessible for private IP. For example, - // `/projects/myProject/global/networks/default`. - optional string private_network = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The name of the allocated IP range for the internal IP Cloud SQL - // instance. For example: "google-managed-services-default". If you set this, - // then Cloud SQL creates the IP address for the cloned instance in the - // allocated range. This range must comply with [RFC - // 1035](https://tools.ietf.org/html/rfc1035) standards. Specifically, the - // name must be 1-63 characters long and match the regular expression - // [a-z]([-a-z0-9]*[a-z0-9])?. Reserved for future use. - optional string allocated_ip_range = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Point-in-time recovery of an instance to the specified zone. If - // no zone is specified, then clone to the same primary zone as the source - // instance. - optional string preferred_zone = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Point-in-time recovery of a regional instance in the specified - // zones. If not specified, clone to the same secondary zone as the source - // instance. This value cannot be the same as the preferred_zone field. - optional string preferred_secondary_zone = 9 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Perform disk shrink context. -message PerformDiskShrinkContext { - // The target disk shrink size in GigaBytes. - int64 target_size_gb = 1; -} - -// Structured PreCheckResponse containing message, type, and required -// actions. -message PreCheckResponse { - // The type of message which can be an info, a warning, or an error that - // requires user intervention. - enum MessageType { - // Default unspecified value to prevent unintended behavior changes. - MESSAGE_TYPE_UNSPECIFIED = 0; - - // General informational messages that don't require action. - INFO = 1; - - // Warnings that might impact the upgrade but don't block it. - WARNING = 2; - - // Errors that a user must resolve before proceeding with the upgrade. - ERROR = 3; - } - - // The message to be displayed to the user. - optional string message = 2; - - // The type of message whether it is an info, warning, or error. - optional MessageType message_type = 3; - - // The actions that the user needs to take. Use repeated for multiple - // actions. - repeated string actions_required = 4; -} - -// Pre-check major version upgrade context. -message PreCheckMajorVersionUpgradeContext { - // Required. The target database version to upgrade to. - SqlDatabaseVersion target_database_version = 1 - [(google.api.field_behavior) = REQUIRED]; - - // Output only. The responses from the precheck operation. - repeated PreCheckResponse pre_check_response = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. This is always `sql#preCheckMajorVersionUpgradeContext`. - string kind = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance get disk shrink config response. -message SqlInstancesGetDiskShrinkConfigResponse { - // This is always `sql#getDiskShrinkConfig`. - string kind = 1; - - // The minimum size to which a disk can be shrunk in GigaBytes. - int64 minimal_target_size_gb = 2; - - // Additional message to customers. - string message = 3; -} - -// Instance verify external sync settings response. -message SqlInstancesVerifyExternalSyncSettingsResponse { - // This is always `sql#migrationSettingErrorList`. - string kind = 1; - - // List of migration violations. - repeated SqlExternalSyncSettingError errors = 2; - - // List of migration warnings. - repeated SqlExternalSyncSettingError warnings = 3; -} - -// External primary instance migration setting error/warning. -message SqlExternalSyncSettingError { - enum SqlExternalSyncSettingErrorType { - SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED = 0; - - CONNECTION_FAILURE = 1; - - BINLOG_NOT_ENABLED = 2; - - INCOMPATIBLE_DATABASE_VERSION = 3; - - REPLICA_ALREADY_SETUP = 4; - - // The replication user is missing privileges that are required. - INSUFFICIENT_PRIVILEGE = 5; - - // Unsupported migration type. - UNSUPPORTED_MIGRATION_TYPE = 6; - - // No pglogical extension installed on databases, applicable for postgres. - NO_PGLOGICAL_INSTALLED = 7; - - // pglogical node already exists on databases, applicable for postgres. - PGLOGICAL_NODE_ALREADY_EXISTS = 8; - - // The value of parameter wal_level is not set to logical. - INVALID_WAL_LEVEL = 9; - - // The value of parameter shared_preload_libraries does not include - // pglogical. - INVALID_SHARED_PRELOAD_LIBRARY = 10; - - // The value of parameter max_replication_slots is not sufficient. - INSUFFICIENT_MAX_REPLICATION_SLOTS = 11; - - // The value of parameter max_wal_senders is not sufficient. - INSUFFICIENT_MAX_WAL_SENDERS = 12; - - // The value of parameter max_worker_processes is not sufficient. - INSUFFICIENT_MAX_WORKER_PROCESSES = 13; - - // Extensions installed are either not supported or having unsupported - // versions - UNSUPPORTED_EXTENSIONS = 14; - - // The value of parameter rds.logical_replication is not set to 1. - INVALID_RDS_LOGICAL_REPLICATION = 15; - - // The primary instance logging setup doesn't allow EM sync. - INVALID_LOGGING_SETUP = 16; - - // The primary instance database parameter setup doesn't allow EM sync. - INVALID_DB_PARAM = 17; - - // The gtid_mode is not supported, applicable for MySQL. - UNSUPPORTED_GTID_MODE = 18; - - // SQL Server Agent is not running. - SQLSERVER_AGENT_NOT_RUNNING = 19; - - // The table definition is not support due to missing primary key or replica - // identity, applicable for postgres. Note that this is a warning and won't - // block the migration. - UNSUPPORTED_TABLE_DEFINITION = 20; - - // The customer has a definer that will break EM setup. - UNSUPPORTED_DEFINER = 21; - - // SQL Server @@SERVERNAME does not match actual host name. - SQLSERVER_SERVERNAME_MISMATCH = 22; - - // The primary instance has been setup and will fail the setup. - PRIMARY_ALREADY_SETUP = 23; - - // The primary instance has unsupported binary log format. - UNSUPPORTED_BINLOG_FORMAT = 24; - - // The primary instance's binary log retention setting. - BINLOG_RETENTION_SETTING = 25; - - // The primary instance has tables with unsupported storage engine. - UNSUPPORTED_STORAGE_ENGINE = 26; - - // Source has tables with limited support - // eg: PostgreSQL tables without primary keys. - LIMITED_SUPPORT_TABLES = 27; - - // The replica instance contains existing data. - EXISTING_DATA_IN_REPLICA = 28; - - // The replication user is missing privileges that are optional. - MISSING_OPTIONAL_PRIVILEGES = 29; - - // Additional BACKUP_ADMIN privilege is granted to the replication user - // which may lock source MySQL 8 instance for DDLs during initial sync. - RISKY_BACKUP_ADMIN_PRIVILEGE = 30; - - // The Cloud Storage bucket is missing necessary permissions. - INSUFFICIENT_GCS_PERMISSIONS = 31; - - // The Cloud Storage bucket has an error in the file or contains invalid - // file information. - INVALID_FILE_INFO = 32; - - // The source instance has unsupported database settings for migration. - UNSUPPORTED_DATABASE_SETTINGS = 33; - - // The replication user is missing parallel import specific privileges. - // (e.g. LOCK TABLES) for MySQL. - MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE = 34; - - // The global variable local_infile is off on external server replica. - LOCAL_INFILE_OFF = 35; - - // This code instructs customers to turn on point-in-time recovery manually - // for the instance after promoting the Cloud SQL for PostgreSQL instance. - TURN_ON_PITR_AFTER_PROMOTE = 36; - - // The minor version of replica database is incompatible with the source. - INCOMPATIBLE_DATABASE_MINOR_VERSION = 37; - - // This warning message indicates that Cloud SQL uses the maximum number of - // subscriptions to migrate data from the source to the destination. - SOURCE_MAX_SUBSCRIPTIONS = 38; - - // Unable to verify definers on the source for MySQL. - UNABLE_TO_VERIFY_DEFINERS = 39; - - // If a time out occurs while the subscription counts are calculated, then - // this value is set to 1. Otherwise, this value is set to 2. - SUBSCRIPTION_CALCULATION_STATUS = 40; - - // Count of subscriptions needed to sync source data for PostgreSQL - // database. - PG_SUBSCRIPTION_COUNT = 41; - - // Final parallel level that is used to do migration. - PG_SYNC_PARALLEL_LEVEL = 42; - - // The disk size of the replica instance is smaller than the data size of - // the source instance. - INSUFFICIENT_DISK_SIZE = 43; - - // The data size of the source instance is greater than 1 TB, the number of - // cores of the replica instance is less than 8, and the memory of the - // replica is less than 32 GB. - INSUFFICIENT_MACHINE_TIER = 44; - - // The warning message indicates the unsupported extensions will not be - // migrated to the destination. - UNSUPPORTED_EXTENSIONS_NOT_MIGRATED = 45; - - // The warning message indicates the pg_cron extension and settings will not - // be migrated to the destination. - EXTENSIONS_NOT_MIGRATED = 46; - - // The error message indicates that pg_cron flags are enabled on the - // destination which is not supported during the migration. - PG_CRON_FLAG_ENABLED_IN_REPLICA = 47; - - // This error message indicates that the specified extensions are not - // enabled on destination instance. For example, before you can migrate - // data to the destination instance, you must enable the PGAudit extension - // on the instance. - EXTENSIONS_NOT_ENABLED_IN_REPLICA = 48; - - // The source database has generated columns that can't be migrated. Please - // change them to regular columns before migration. - UNSUPPORTED_COLUMNS = 49; - - // The source database has users that aren't created in the replica. - // First, create all users, which are in the pg_user_mappings table - // of the source database, in the destination instance. Then, perform the - // migration. - USERS_NOT_CREATED_IN_REPLICA = 50; - - // The selected objects include system objects that aren't supported for - // migration. - UNSUPPORTED_SYSTEM_OBJECTS = 51; - - // The source database has tables with the FULL or NOTHING replica identity. - // Before starting your migration, either remove the identity or change it - // to DEFAULT. Note that this is an error and will block the migration. - UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY = 52; - - // The selected objects don't exist on the source instance. - SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE = 53; - - // PSC only destination instance does not have a network attachment URI. - PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI = 54; - - // Selected objects reference unselected objects. Based on their object type - // (foreign key constraint or view), selected objects will fail during - // migration. - SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS = 55; - - // The migration will delete existing data in the replica; set - // [replica_overwrite_enabled][google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.replica_overwrite_enabled] - // in the request to acknowledge this. This is an error. MySQL only. - PROMPT_DELETE_EXISTING = 56; - - // The migration will delete existing data in the replica; - // [replica_overwrite_enabled][google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.replica_overwrite_enabled] - // was set in the request acknowledging this. This is a warning rather than - // an error. MySQL only. - WILL_DELETE_EXISTING = 57; - - // The replication user is missing specific privileges to setup DDL - // replication. (e.g. CREATE EVENT TRIGGER, CREATE SCHEMA) for PostgreSQL. - PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE = 58; - } - - // Can be `sql#externalSyncSettingError` or - // `sql#externalSyncSettingWarning`. - string kind = 1; - - // Identifies the specific error that occurred. - SqlExternalSyncSettingErrorType type = 2; - - // Additional information about the error encountered. - string detail = 3; -} - -// IP Management configuration. -message IpConfiguration { - // The SSL options for database connections. - enum SslMode { - // The SSL mode is unknown. - SSL_MODE_UNSPECIFIED = 0; - - // Allow non-SSL/non-TLS and SSL/TLS connections. - // For SSL connections to MySQL and PostgreSQL, the client certificate - // isn't verified. - // - // When this value is used, the legacy `require_ssl` flag must be false or - // cleared to avoid a conflict between the values of the two flags. - ALLOW_UNENCRYPTED_AND_ENCRYPTED = 1; - - // Only allow connections encrypted with SSL/TLS. - // For SSL connections to MySQL and PostgreSQL, the client certificate - // isn't verified. - // - // When this value is used, the legacy `require_ssl` flag must be false or - // cleared to avoid a conflict between the values of the two flags. - ENCRYPTED_ONLY = 2; - - // Only allow connections encrypted with SSL/TLS and with valid - // client certificates. - // - // When this value is used, the legacy `require_ssl` flag must be true or - // cleared to avoid the conflict between values of two flags. - // PostgreSQL clients or users that connect using IAM database - // authentication must use either the - // [Cloud SQL Auth - // Proxy](https://cloud.google.com/sql/docs/postgres/connect-auth-proxy) or - // [Cloud SQL - // Connectors](https://cloud.google.com/sql/docs/postgres/connect-connectors) - // to enforce client identity verification. - // - // Only applicable to MySQL and PostgreSQL. Not applicable to SQL Server. - TRUSTED_CLIENT_CERTIFICATE_REQUIRED = 3; - } - - // Various Certificate Authority (CA) modes for certificate signing. - enum CaMode { - // CA mode is unspecified. It is effectively the same as - // `GOOGLE_MANAGED_INTERNAL_CA`. - CA_MODE_UNSPECIFIED = 0; - - // Google-managed self-signed internal CA. - GOOGLE_MANAGED_INTERNAL_CA = 1; - - // Google-managed regional CA part of root CA hierarchy hosted on Google - // Cloud's Certificate Authority Service (CAS). - GOOGLE_MANAGED_CAS_CA = 2; - - // Customer-managed CA hosted on Google Cloud's Certificate Authority - // Service (CAS). - CUSTOMER_MANAGED_CAS_CA = 3; - } - - // Settings for automatic server certificate rotation. - enum ServerCertificateRotationMode { - // Unspecified: no automatic server certificate rotation. - SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED = 0; - - // No automatic server certificate rotation. The user must [manage server - // certificate - // rotation](/sql/docs/mysql/manage-ssl-instance#rotate-server-certificate-cas) - // on their side. - NO_AUTOMATIC_ROTATION = 1; - - // Automatic server certificate rotation during Cloud SQL scheduled - // maintenance or self-service maintenance updates. Requires - // `server_ca_mode` to be `GOOGLE_MANAGED_CAS_CA` or - // `CUSTOMER_MANAGED_CAS_CA`. - AUTOMATIC_ROTATION_DURING_MAINTENANCE = 2; - } - - // Whether the instance is assigned a public IP address or not. - google.protobuf.BoolValue ipv4_enabled = 1; - - // The resource link for the VPC network from which the Cloud SQL instance is - // accessible for private IP. For example, - // `/projects/myProject/global/networks/default`. This setting can - // be updated, but it cannot be removed after it is set. - string private_network = 2; - - // Use `ssl_mode` instead. - // - // Whether SSL/TLS connections over IP are enforced. - // If set to false, then allow both non-SSL/non-TLS and SSL/TLS connections. - // For SSL/TLS connections, the client certificate won't be verified. If - // set to true, then only allow connections encrypted with SSL/TLS and with - // valid client certificates. If you want to enforce SSL/TLS without enforcing - // the requirement for valid client certificates, then use the `ssl_mode` flag - // instead of the legacy `require_ssl` flag. - google.protobuf.BoolValue require_ssl = 3; - - // The list of external networks that are allowed to connect to the instance - // using the IP. In 'CIDR' notation, also known as 'slash' notation (for - // example: `157.197.200.0/24`). - repeated AclEntry authorized_networks = 4; - - // The name of the allocated ip range for the private ip Cloud SQL instance. - // For example: "google-managed-services-default". If set, the instance ip - // will be created in the allocated range. The range name must comply with - // [RFC 1035](https://tools.ietf.org/html/rfc1035). Specifically, the name - // must be 1-63 characters long and match the regular expression - // `[a-z]([-a-z0-9]*[a-z0-9])?.` - string allocated_ip_range = 6; - - // Controls connectivity to private IP instances from Google services, - // such as BigQuery. - google.protobuf.BoolValue enable_private_path_for_google_cloud_services = 7; - - // Specify how SSL/TLS is enforced in database connections. If you must use - // the `require_ssl` flag for backward compatibility, then only the following - // value pairs are valid: - // - // For PostgreSQL and MySQL: - // - // * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false` - // * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=false` - // * `ssl_mode=TRUSTED_CLIENT_CERTIFICATE_REQUIRED` and `require_ssl=true` - // - // For SQL Server: - // - // * `ssl_mode=ALLOW_UNENCRYPTED_AND_ENCRYPTED` and `require_ssl=false` - // * `ssl_mode=ENCRYPTED_ONLY` and `require_ssl=true` - // - // The value of `ssl_mode` has priority over the value of `require_ssl`. - // - // For example, for the pair `ssl_mode=ENCRYPTED_ONLY` and - // `require_ssl=false`, `ssl_mode=ENCRYPTED_ONLY` means accept only SSL - // connections, while `require_ssl=false` means accept both non-SSL - // and SSL connections. In this case, MySQL and PostgreSQL databases respect - // `ssl_mode` and accepts only SSL connections. - SslMode ssl_mode = 8; - - // PSC settings for this instance. - optional PscConfig psc_config = 9; - - // Specify what type of CA is used for the server certificate. - optional CaMode server_ca_mode = 10; - - // Optional. Custom Subject Alternative Name(SAN)s for a Cloud SQL instance. - repeated string custom_subject_alternative_names = 11 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The resource name of the server CA pool for an instance with - // `CUSTOMER_MANAGED_CAS_CA` as the `server_ca_mode`. - // Format: projects/{PROJECT}/locations/{REGION}/caPools/{CA_POOL_ID} - optional string server_ca_pool = 12 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Controls the automatic server certificate rotation feature. This - // feature is disabled by default. When enabled, the server certificate will - // be automatically rotated during Cloud SQL scheduled maintenance or - // self-service maintenance updates up to six months before it expires. This - // setting can only be set if server_ca_mode is either GOOGLE_MANAGED_CAS_CA - // or CUSTOMER_MANAGED_CAS_CA. - optional ServerCertificateRotationMode server_certificate_rotation_mode = 16 - [(google.api.field_behavior) = OPTIONAL]; -} - -// PSC settings for a Cloud SQL instance. -message PscConfig { - // Whether PSC connectivity is enabled for this instance. - optional bool psc_enabled = 1; - - // Optional. The list of consumer projects that are allow-listed for PSC - // connections to this instance. This instance can be connected to with PSC - // from any network in these projects. - // - // Each consumer project in this list may be represented by a project number - // (numeric) or by a project id (alphanumeric). - repeated string allowed_consumer_projects = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The list of settings for requested Private Service Connect - // consumer endpoints that can be used to connect to this Cloud SQL instance. - repeated PscAutoConnectionConfig psc_auto_connections = 3 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The network attachment of the consumer network that the - // Private Service Connect enabled Cloud SQL instance is - // authorized to connect via PSC interface. - // format: projects/PROJECT/regions/REGION/networkAttachments/ID - string network_attachment_uri = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Settings for an automatically-setup Private Service Connect consumer endpoint -// that is used to connect to a Cloud SQL instance. -message PscAutoConnectionConfig { - // Optional. This is the project ID of consumer service project of this - // consumer endpoint. - // - // Optional. This is only applicable if consumer_network is a shared vpc - // network. - string consumer_project = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The consumer network of this consumer endpoint. This must be a - // resource path that includes both the host project and the network name. - // - // For example, `projects/project1/global/networks/network1`. - // - // The consumer host project of this network might be different from the - // consumer service project. - string consumer_network = 2 [(google.api.field_behavior) = OPTIONAL]; - - // The IP address of the consumer endpoint. - optional string ip_address = 3 - [(google.api.field_info).format = IPV4_OR_IPV6]; - - // The connection status of the consumer endpoint. - optional string status = 4; - - // The connection policy status of the consumer network. - optional string consumer_network_status = 5; -} - -// Database instance IP mapping -message IpMapping { - // The type of this IP address. A `PRIMARY` address is a public address that - // can accept incoming connections. A `PRIVATE` address is a private address - // that can accept incoming connections. An `OUTGOING` address is the source - // address of connections originating from the instance, if supported. - SqlIpAddressType type = 1; - - // The IP address assigned. - string ip_address = 2; - - // The due time for this IP to be retired in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. This field is only available when - // the IP is scheduled to be retired. - google.protobuf.Timestamp time_to_retire = 3; -} - -// Preferred location. This specifies where a Cloud SQL instance is located. -// Note that if the preferred location is not available, the instance will be -// located as close as possible within the region. Only one location may be -// specified. -message LocationPreference { - // The App Engine application to follow, it must be in the same region as the - // Cloud SQL instance. WARNING: Changing this might restart the instance. - string follow_gae_application = 1 [deprecated = true]; - - // The preferred Compute Engine zone (for example: us-central1-a, - // us-central1-b, etc.). WARNING: Changing this might restart the instance. - string zone = 2; - - // The preferred Compute Engine zone for the secondary/failover - // (for example: us-central1-a, us-central1-b, etc.). - // To disable this field, set it to 'no_secondary_zone'. - string secondary_zone = 4; - - // This is always `sql#locationPreference`. - string kind = 3; -} - -// Maintenance window. This specifies when a Cloud SQL instance -// is restarted for system maintenance purposes. -message MaintenanceWindow { - // Hour of day - 0 to 23. Specify in the UTC time zone. - google.protobuf.Int32Value hour = 1; - - // Day of week - `MONDAY`, `TUESDAY`, `WEDNESDAY`, `THURSDAY`, `FRIDAY`, - // `SATURDAY`, or `SUNDAY`. Specify in the UTC time zone. - // Returned in output as an integer, 1 to 7, where `1` equals Monday. - google.protobuf.Int32Value day = 2; - - // Maintenance timing settings: `canary`, `stable`, or `week5`. - // For more information, see [About maintenance on Cloud SQL - // instances](https://cloud.google.com/sql/docs/mysql/maintenance). - SqlUpdateTrack update_track = 3; - - // This is always `sql#maintenanceWindow`. - string kind = 4; -} - -// Deny Maintenance Periods. This specifies a date range during when all CSA -// rollout will be denied. -message DenyMaintenancePeriod { - // "deny maintenance period" start date. If the year of the start date is - // empty, the year of the end date also must be empty. In this case, it means - // the deny maintenance period recurs every year. The date is in format - // yyyy-mm-dd i.e., 2020-11-01, or mm-dd, i.e., 11-01 - string start_date = 1; - - // "deny maintenance period" end date. If the year of the end date is empty, - // the year of the start date also must be empty. In this case, it means the - // deny maintenance period recurs every year. The date is in format yyyy-mm-dd - // i.e., 2020-11-01, or mm-dd, i.e., 11-01 - string end_date = 2; - - // Time in UTC when the "deny maintenance period" starts on start_date and - // ends on end_date. The time is in format: HH:mm:SS, i.e., 00:00:00 - string time = 3; -} - -// Insights configuration. This specifies when Cloud SQL Insights feature is -// enabled and optional configuration. -message InsightsConfig { - // Whether Query Insights feature is enabled. - bool query_insights_enabled = 1; - - // Whether Query Insights will record client address when enabled. - bool record_client_address = 2; - - // Whether Query Insights will record application tags from query when - // enabled. - bool record_application_tags = 3; - - // Maximum query length stored in bytes. Default value: 1024 bytes. - // Range: 256-4500 bytes. Query lengths greater than this field value will be - // truncated to this value. When unset, query length will be the default - // value. Changing query length will restart the database. - google.protobuf.Int32Value query_string_length = 4; - - // Number of query execution plans captured by Insights per minute - // for all queries combined. Default is 5. - google.protobuf.Int32Value query_plans_per_minute = 5; - - // Optional. Whether enhanced query insights feature is enabled. - google.protobuf.BoolValue enhanced_query_insights_enabled = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Read-replica configuration specific to MySQL databases. -message MySqlReplicaConfiguration { - // Path to a SQL dump file in Google Cloud Storage from which the replica - // instance is to be created. The URI is in the form gs://bucketName/fileName. - // Compressed gzip files (.gz) are also supported. - // Dumps have the binlog co-ordinates from which replication - // begins. This can be accomplished by setting --master-data to 1 when using - // mysqldump. - string dump_file_path = 1; - - // The username for the replication connection. - string username = 2; - - // The password for the replication connection. - string password = 3; - - // Seconds to wait between connect retries. MySQL's default is 60 seconds. - google.protobuf.Int32Value connect_retry_interval = 4; - - // Interval in milliseconds between replication heartbeats. - google.protobuf.Int64Value master_heartbeat_period = 5; - - // PEM representation of the trusted CA's x509 certificate. - string ca_certificate = 6; - - // PEM representation of the replica's x509 certificate. - string client_certificate = 7; - - // PEM representation of the replica's private key. The corresponding public - // key is encoded in the client's certificate. - string client_key = 8; - - // A list of permissible ciphers to use for SSL encryption. - string ssl_cipher = 9; - - // Whether or not to check the primary instance's Common Name value in the - // certificate that it sends during the SSL handshake. - google.protobuf.BoolValue verify_server_certificate = 10; - - // This is always `sql#mysqlReplicaConfiguration`. - string kind = 11; -} - -// A list of objects that the user selects for replication from an external -// source instance. -message SelectedObjects { - // Required. The name of the database to migrate. - string database = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// On-premises instance configuration. -message OnPremisesConfiguration { - // SslOption defines the SSL mode to be used for replica connection to the - // on-premises source. - enum SslOption { - // Unknown SSL option i.e. SSL option not specified by user. - SSL_OPTION_UNSPECIFIED = 0; - - // SSL is disabled for replica connection to the on-premises source. - DISABLE = 1; - - // SSL is required for replica connection to the on-premises source. - REQUIRE = 2; - - // Verify CA is required for replica connection to the on-premises source. - VERIFY_CA = 3; - } - - // The host and port of the on-premises instance in host:port format - string host_port = 1; - - // This is always `sql#onPremisesConfiguration`. - string kind = 2; - - // The username for connecting to on-premises instance. - string username = 3; - - // The password for connecting to on-premises instance. - string password = 4; - - // PEM representation of the trusted CA's x509 certificate. - string ca_certificate = 5; - - // PEM representation of the replica's x509 certificate. - string client_certificate = 6; - - // PEM representation of the replica's private key. The corresponding public - // key is encoded in the client's certificate. - string client_key = 7; - - // The dump file to create the Cloud SQL replica. - string dump_file_path = 8; - - // The reference to Cloud SQL instance if the source is Cloud SQL. - InstanceReference source_instance = 15; - - // Optional. A list of objects that the user selects for replication from an - // external source instance. - repeated SelectedObjects selected_objects = 16 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. SslOption for replica connection to the on-premises source. - SslOption ssl_option = 18 [(google.api.field_behavior) = OPTIONAL]; -} - -// Disk encryption configuration for an instance. -message DiskEncryptionConfiguration { - // Resource name of KMS key for disk encryption - string kms_key_name = 1; - - // This is always `sql#diskEncryptionConfiguration`. - string kind = 2; -} - -// Disk encryption status for an instance. -message DiskEncryptionStatus { - // KMS key version used to encrypt the Cloud SQL instance resource - string kms_key_version_name = 1; - - // This is always `sql#diskEncryptionStatus`. - string kind = 2; -} - -// The type of maintenance to be performed on the instance. -enum SqlMaintenanceType { - // Maintenance type is unspecified. - SQL_MAINTENANCE_TYPE_UNSPECIFIED = 0; - - // Indicates that a standalone instance is undergoing maintenance. The - // instance can be either a primary instance or a replica. - INSTANCE_MAINTENANCE = 1; - - // Indicates that the primary instance and all of its replicas, including - // cascading replicas, are undergoing maintenance. Maintenance is performed on - // groups of replicas first, followed by the primary instance. - REPLICA_INCLUDED_MAINTENANCE = 2; - - // Indicates that the standalone instance is undergoing maintenance, initiated - // by self-service. The instance can be either a primary instance or a - // replica. - INSTANCE_SELF_SERVICE_MAINTENANCE = 3; - - // Indicates that the primary instance and all of its replicas are undergoing - // maintenance, initiated by self-service. Maintenance is performed on groups - // of replicas first, followed by the primary instance. - REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE = 4; -} - -// The sub operation type based on the operation type. -message SqlSubOperationType { - // Sub operation details corresponding to the operation type. - oneof sub_operation_details { - // The type of maintenance to be performed on the instance. - SqlMaintenanceType maintenance_type = 1; - } -} - -// An Operation resource. For successful operations that return an -// Operation resource, only the fields relevant to the operation are populated -// in the resource. -message Operation { - // The type of Cloud SQL operation. - enum SqlOperationType { - // Unknown operation type. - SQL_OPERATION_TYPE_UNSPECIFIED = 0; - - // Imports data into a Cloud SQL instance. - IMPORT = 1; - - // Exports data from a Cloud SQL instance to a Cloud Storage - // bucket. - EXPORT = 2; - - // Creates a new Cloud SQL instance. - CREATE = 3; - - // Updates the settings of a Cloud SQL instance. - UPDATE = 4; - - // Deletes a Cloud SQL instance. - DELETE = 5; - - // Restarts the Cloud SQL instance. - RESTART = 6; - - BACKUP = 7 [deprecated = true]; - - SNAPSHOT = 8 [deprecated = true]; - - // Performs instance backup. - BACKUP_VOLUME = 9; - - // Deletes an instance backup. - DELETE_VOLUME = 10; - - // Restores an instance backup. - RESTORE_VOLUME = 11; - - // Injects a privileged user in mysql for MOB instances. - INJECT_USER = 12; - - // Clones a Cloud SQL instance. - CLONE = 14; - - // Stops replication on a Cloud SQL read replica instance. - STOP_REPLICA = 15; - - // Starts replication on a Cloud SQL read replica instance. - START_REPLICA = 16; - - // Promotes a Cloud SQL replica instance. - PROMOTE_REPLICA = 17; - - // Creates a Cloud SQL replica instance. - CREATE_REPLICA = 18; - - // Creates a new user in a Cloud SQL instance. - CREATE_USER = 19; - - // Deletes a user from a Cloud SQL instance. - DELETE_USER = 20; - - // Updates an existing user in a Cloud SQL instance. If a user with the - // specified username doesn't exist, a new user is created. - UPDATE_USER = 21; - - // Creates a database in the Cloud SQL instance. - CREATE_DATABASE = 22; - - // Deletes a database in the Cloud SQL instance. - DELETE_DATABASE = 23; - - // Updates a database in the Cloud SQL instance. - UPDATE_DATABASE = 24; - - // Performs failover of an HA-enabled Cloud SQL - // failover replica. - FAILOVER = 25; - - // Deletes the backup taken by a backup run. - DELETE_BACKUP = 26; - - RECREATE_REPLICA = 27; - - // Truncates a general or slow log table in MySQL. - TRUNCATE_LOG = 28; - - // Demotes the stand-alone instance to be a Cloud SQL - // read replica for an external database server. - DEMOTE_MASTER = 29; - - // Indicates that the instance is currently in maintenance. Maintenance - // typically causes the instance to be unavailable for 1-3 minutes. - MAINTENANCE = 30; - - // This field is deprecated, and will be removed in future version of API. - ENABLE_PRIVATE_IP = 31 [deprecated = true]; - - DEFER_MAINTENANCE = 32 [deprecated = true]; - - // Creates clone instance. - CREATE_CLONE = 33 [deprecated = true]; - - // Reschedule maintenance to another time. - RESCHEDULE_MAINTENANCE = 34; - - // Starts external sync of a Cloud SQL EM replica to an external primary - // instance. - START_EXTERNAL_SYNC = 35; - - // Recovers logs from an instance's old data disk. - LOG_CLEANUP = 36; - - // Performs auto-restart of an HA-enabled Cloud SQL database for auto - // recovery. - AUTO_RESTART = 37; - - // Re-encrypts CMEK instances with latest key version. - REENCRYPT = 38; - - // Switches the roles of the primary and replica pair. The target instance - // should be the replica. - SWITCHOVER = 39; - - // Update a backup. - UPDATE_BACKUP = 40; - - // Acquire a lease for the setup of SQL Server Reporting Services (SSRS). - ACQUIRE_SSRS_LEASE = 42; - - // Release a lease for the setup of SQL Server Reporting Services (SSRS). - RELEASE_SSRS_LEASE = 43; - - // Reconfigures old primary after a promote replica operation. Effect of a - // promote operation to the old primary is executed in this operation, - // asynchronously from the promote replica operation executed to the - // replica. - RECONFIGURE_OLD_PRIMARY = 44; - - // Indicates that the instance, its read replicas, and its cascading - // replicas are in maintenance. Maintenance typically gets initiated on - // groups of replicas first, followed by the primary instance. For each - // instance, maintenance typically causes the instance to be unavailable for - // 1-3 minutes. - CLUSTER_MAINTENANCE = 45 [deprecated = true]; - - // Indicates that the instance (and any of its replicas) are currently in - // maintenance. This is initiated as a self-service request by using SSM. - // Maintenance typically causes the instance to be unavailable for 1-3 - // minutes. - SELF_SERVICE_MAINTENANCE = 46 [deprecated = true]; - - // Switches a primary instance to a replica. This operation runs as part of - // a switchover operation to the original primary instance. - SWITCHOVER_TO_REPLICA = 47; - - // Updates the major version of a Cloud SQL instance. - MAJOR_VERSION_UPGRADE = 48; - - // Deprecated: ADVANCED_BACKUP is deprecated. Use ENHANCED_BACKUP instead. - ADVANCED_BACKUP = 49 [deprecated = true]; - - // Changes the BackupTier of a Cloud SQL instance. - MANAGE_BACKUP = 50; - - // Creates a backup for an Enhanced BackupTier Cloud SQL instance. - ENHANCED_BACKUP = 51; - - // Repairs entire read pool or specified read pool nodes in the read pool. - REPAIR_READ_POOL = 52; - - // Creates a Cloud SQL read pool instance. - CREATE_READ_POOL = 53; - } - - // The status of an operation. - enum SqlOperationStatus { - // The state of the operation is unknown. - SQL_OPERATION_STATUS_UNSPECIFIED = 0; - - // The operation has been queued, but has not started yet. - PENDING = 1; - - // The operation is running. - RUNNING = 2; - - // The operation completed. - DONE = 3; - } - - // This is always `sql#operation`. - string kind = 1; - - string target_link = 2; - - // The status of an operation. - SqlOperationStatus status = 3; - - // The email address of the user who initiated this operation. - string user = 4; - - // The time this operation was enqueued in UTC timezone in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp insert_time = 5; - - // The time this operation actually started in UTC timezone in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp start_time = 6; - - // The time this operation finished in UTC timezone in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp end_time = 7; - - // If errors occurred during processing of this operation, this field will be - // populated. - OperationErrors error = 8; - - // An Admin API warning message. - ApiWarning api_warning = 19; - - // The type of the operation. Valid values are: - // * `CREATE` - // * `DELETE` - // * `UPDATE` - // * `RESTART` - // * `IMPORT` - // * `EXPORT` - // * `BACKUP_VOLUME` - // * `RESTORE_VOLUME` - // * `CREATE_USER` - // * `DELETE_USER` - // * `CREATE_DATABASE` - // * `DELETE_DATABASE` - SqlOperationType operation_type = 9; - - // The context for import operation, if applicable. - ImportContext import_context = 10; - - // The context for export operation, if applicable. - ExportContext export_context = 11; - - // The context for backup operation, if applicable. - BackupContext backup_context = 17; - - // The context for pre-check major version upgrade operation, if applicable. - // This field is only populated when the operation_type is - // PRE_CHECK_MAJOR_VERSION_UPGRADE. - // The PreCheckMajorVersionUpgradeContext message itself contains the details - // for that pre-check, such as the target database version for the upgrade - // and the results of the check (including any warnings or errors found). - PreCheckMajorVersionUpgradeContext pre_check_major_version_upgrade_context = - 50; - - // An identifier that uniquely identifies the operation. You can use this - // identifier to retrieve the Operations resource that has information about - // the operation. - string name = 12; - - // Name of the resource on which this operation runs. - string target_id = 13; - - // The URI of this resource. - string self_link = 14; - - // The project ID of the target instance related to this operation. - string target_project = 15; - - // The context for acquire SSRS lease operation, if applicable. - AcquireSsrsLeaseContext acquire_ssrs_lease_context = 20; - - // Optional. The sub operation based on the operation type. - SqlSubOperationType sub_operation_type = 48 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Database instance operation error. -message OperationError { - // This is always `sql#operationError`. - string kind = 1; - - // Identifies the specific error that occurred. - string code = 2; - - // Additional information about the error encountered. - string message = 3; -} - -// Database instance operation errors list wrapper. -message OperationErrors { - // This is always `sql#operationErrors`. - string kind = 1; - - // The list of errors encountered while processing this operation. - repeated OperationError errors = 2; -} - -// Database instance local user password validation policy. -// This message defines the password policy for local database users. -// When enabled, it enforces constraints on password complexity, length, -// and reuse. Keep this policy enabled to help prevent unauthorized access. -message PasswordValidationPolicy { - // The complexity choices of the password. - enum Complexity { - // Complexity check is not specified. - COMPLEXITY_UNSPECIFIED = 0; - - // A combination of lowercase, uppercase, numeric, and non-alphanumeric - // characters. - COMPLEXITY_DEFAULT = 1; - } - - // Minimum number of characters allowed. - google.protobuf.Int32Value min_length = 1; - - // The complexity of the password. - Complexity complexity = 2; - - // Number of previous passwords that cannot be reused. - google.protobuf.Int32Value reuse_interval = 3; - - // Disallow username as a part of the password. - google.protobuf.BoolValue disallow_username_substring = 4; - - // Minimum interval after which the password can be changed. This flag is only - // supported for PostgreSQL. - google.protobuf.Duration password_change_interval = 5; - - // Whether to enable the password policy or not. When enabled, passwords must - // meet complexity requirements. Keep this policy enabled to help prevent - // unauthorized access. Disabling this policy allows weak passwords. - google.protobuf.BoolValue enable_password_policy = 6; - - // This field is deprecated and will be removed in a future version of the - // API. - google.protobuf.BoolValue disallow_compromised_credentials = 7 - [deprecated = true]; -} - -// Operations list response. -message OperationsListResponse { - // This is always `sql#operationsList`. - string kind = 1; - - // List of operation resources. - repeated Operation items = 2; - - // The continuation token, used to page through large result sets. Provide - // this value in a subsequent request to return the next page of results. - string next_page_token = 3; -} - -// Read-replica configuration for connecting to the primary instance. -message ReplicaConfiguration { - // This is always `sql#replicaConfiguration`. - string kind = 1; - - // MySQL specific configuration when replicating from a MySQL on-premises - // primary instance. Replication configuration information such as the - // username, password, certificates, and keys are not stored in the instance - // metadata. The configuration information is used only to set up the - // replication connection and is stored by MySQL in a file named - // `master.info` in the data directory. - MySqlReplicaConfiguration mysql_replica_configuration = 2; - - // Specifies if the replica is the failover target. If the field is set to - // `true` the replica will be designated as a failover replica. In case the - // primary instance fails, the replica instance will be promoted as the new - // primary instance. Only one replica can be specified as failover target, and - // the replica has to be in different zone with the primary instance. - google.protobuf.BoolValue failover_target = 3; - - // Optional. Specifies if a SQL Server replica is a cascadable replica. A - // cascadable replica is a SQL Server cross region replica that supports - // replica(s) under it. - google.protobuf.BoolValue cascadable_replica = 5 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Database instance restore from backup context. -// Backup context contains source instance id and project id. -message RestoreBackupContext { - // This is always `sql#restoreBackupContext`. - string kind = 1; - - // The ID of the backup run to restore from. - int64 backup_run_id = 2; - - // The ID of the instance that the backup was taken from. - string instance_id = 3; - - // The full project ID of the source instance. - string project = 4; -} - -// Instance rotate server CA context. -message RotateServerCaContext { - // This is always `sql#rotateServerCaContext`. - string kind = 1; - - // The fingerprint of the next version to be rotated to. If left unspecified, - // will be rotated to the most recently added server CA version. - string next_version = 2; -} - -// Instance rotate server certificate context. -message RotateServerCertificateContext { - // Optional. This is always `sql#rotateServerCertificateContext`. - string kind = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The fingerprint of the next version to be rotated to. If left - // unspecified, will be rotated to the most recently added server certificate - // version. - string next_version = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Instance rotate Entra ID certificate context. -message RotateEntraIdCertificateContext { - // Optional. This is always `sql#rotateEntraIdCertificateContext`. - string kind = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The fingerprint of the next version to be rotated to. If left - // unspecified, will be rotated to the most recently added Entra ID - // certificate version. - string next_version = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Data cache configurations. -message DataCacheConfig { - // Whether data cache is enabled for the instance. - bool data_cache_enabled = 1; -} - -// Config used to determine the final backup settings for the instance. -message FinalBackupConfig { - // Whether the final backup is enabled for the instance. - optional bool enabled = 1; - - // The number of days to retain the final backup after the instance deletion. - // The final backup will be purged at (time_of_instance_deletion + - // retention_days). - optional int32 retention_days = 3; -} - -// Database instance settings. -message Settings { - // Specifies when the instance is activated. - enum SqlActivationPolicy { - // Unknown activation plan. - SQL_ACTIVATION_POLICY_UNSPECIFIED = 0; - - // The instance is always up and running. - ALWAYS = 1; - - // The instance never starts. - NEVER = 2; - - // The instance starts upon receiving requests. - ON_DEMAND = 3 [deprecated = true]; - } - - // The edition of the instance. - enum Edition { - // The instance did not specify the edition. - EDITION_UNSPECIFIED = 0; - - // The instance is an enterprise edition. - ENTERPRISE = 2; - - // The instance is an Enterprise Plus edition. - ENTERPRISE_PLUS = 3; - } - - // The options for enforcing Cloud SQL connectors in the instance. - enum ConnectorEnforcement { - // The requirement for Cloud SQL connectors is unknown. - CONNECTOR_ENFORCEMENT_UNSPECIFIED = 0; - - // Do not require Cloud SQL connectors. - NOT_REQUIRED = 1; - - // Require all connections to use Cloud SQL connectors, including the - // Cloud SQL Auth Proxy and Cloud SQL Java, Python, and Go connectors. - // Note: This disables all existing authorized networks. - REQUIRED = 2; - } - - // ExecuteSql API's access to the instance. - enum DataApiAccess { - // Unspecified, effectively the same as `DISALLOW_DATA_API`. - DATA_API_ACCESS_UNSPECIFIED = 0; - - // Disallow using ExecuteSql API to connect to the instance. - DISALLOW_DATA_API = 1; - - // Allow using ExecuteSql API to connect to the instance. For private IP - // instances, this allows authorized users to access the instance from - // the public internet using ExecuteSql API. - ALLOW_DATA_API = 2; - } - - // The version of instance settings. This is a required field for update - // method to make sure concurrent updates are handled properly. During update, - // use the most recent settingsVersion value for this instance and do not try - // to update this value. - google.protobuf.Int64Value settings_version = 1; - - // The App Engine app IDs that can access this instance. - // (Deprecated) Applied to First Generation instances only. - repeated string authorized_gae_applications = 2 [deprecated = true]; - - // The tier (or machine type) for this instance, for example - // `db-custom-1-3840`. WARNING: Changing this restarts the instance. - string tier = 3; - - // This is always `sql#settings`. - string kind = 4; - - // User-provided labels, represented as a dictionary where each label is a - // single key value pair. - map user_labels = 5; - - // Availability type. Potential values: - // * `ZONAL`: The instance serves data from only one zone. Outages in that - // zone affect data accessibility. - // * `REGIONAL`: The instance can serve data from more than one zone in a - // region (it is highly available)./ - // - // For more information, see [Overview of the High Availability - // Configuration](https://cloud.google.com/sql/docs/mysql/high-availability). - SqlAvailabilityType availability_type = 6; - - // The pricing plan for this instance. This can be either `PER_USE` or - // `PACKAGE`. Only `PER_USE` is supported for Second Generation instances. - SqlPricingPlan pricing_plan = 7; - - // The type of replication this instance uses. This can be either - // `ASYNCHRONOUS` or `SYNCHRONOUS`. (Deprecated) This property was only - // applicable to First Generation instances. - SqlReplicationType replication_type = 8 [deprecated = true]; - - // The maximum size to which storage capacity can be automatically increased. - // The default value is 0, which specifies that there is no limit. - google.protobuf.Int64Value storage_auto_resize_limit = 9; - - // The activation policy specifies when the instance is activated; it is - // applicable only when the instance state is RUNNABLE. Valid values: - // * `ALWAYS`: The instance is on, and remains so even in the absence of - // connection requests. - // * `NEVER`: The instance is off; it is not activated, even if a - // connection request arrives. - SqlActivationPolicy activation_policy = 10; - - // The settings for IP Management. This allows to enable or disable the - // instance IP and manage which external networks can connect to the instance. - // The IPv4 address cannot be disabled for Second Generation instances. - IpConfiguration ip_configuration = 11; - - // Configuration to increase storage size automatically. The default value is - // true. - google.protobuf.BoolValue storage_auto_resize = 12; - - // The location preference settings. This allows the instance to be located as - // near as possible to either an App Engine app or Compute Engine zone for - // better performance. App Engine co-location was only applicable to First - // Generation instances. - LocationPreference location_preference = 13; - - // The database flags passed to the instance at startup. - repeated DatabaseFlags database_flags = 14; - - // The type of data disk: `PD_SSD` (default) or `PD_HDD`. Not used for - // First Generation instances. - SqlDataDiskType data_disk_type = 15; - - // The maintenance window for this instance. This specifies when the instance - // can be restarted for maintenance purposes. - MaintenanceWindow maintenance_window = 16; - - // The daily backup configuration for the instance. - BackupConfiguration backup_configuration = 17; - - // Configuration specific to read replica instances. Indicates whether - // replication is enabled or not. WARNING: Changing this restarts the - // instance. - google.protobuf.BoolValue database_replication_enabled = 18; - - // Configuration specific to read replica instances. Indicates whether - // database flags for crash-safe replication are enabled. This property was - // only applicable to First Generation instances. - google.protobuf.BoolValue crash_safe_replication_enabled = 19 - [deprecated = true]; - - // The size of data disk, in GB. The data disk size minimum is 10GB. - google.protobuf.Int64Value data_disk_size_gb = 20; - - // Active Directory configuration, relevant only for Cloud SQL for SQL Server. - SqlActiveDirectoryConfig active_directory_config = 22; - - // The name of server Instance collation. - string collation = 23; - - // Deny maintenance periods - repeated DenyMaintenancePeriod deny_maintenance_periods = 24; - - // Insights configuration, for now relevant only for Postgres. - InsightsConfig insights_config = 25; - - // The local user password validation policy of the instance. - PasswordValidationPolicy password_validation_policy = 27; - - // SQL Server specific audit configuration. - SqlServerAuditConfig sql_server_audit_config = 29; - - // Optional. The edition of the instance. - Edition edition = 38 [(google.api.field_behavior) = OPTIONAL]; - - // Specifies if connections must use Cloud SQL connectors. - // Option values include the following: `NOT_REQUIRED` (Cloud SQL instances - // can be connected without Cloud SQL - // Connectors) and `REQUIRED` (Only allow connections that use Cloud SQL - // Connectors) - // - // Note that using REQUIRED disables all existing authorized networks. If - // this field is not specified when creating a new instance, NOT_REQUIRED is - // used. If this field is not specified when patching or updating an existing - // instance, it is left unchanged in the instance. - ConnectorEnforcement connector_enforcement = 32; - - // Configuration to protect against accidental instance deletion. - google.protobuf.BoolValue deletion_protection_enabled = 33; - - // Server timezone, relevant only for Cloud SQL for SQL Server. - string time_zone = 34; - - // Specifies advanced machine configuration for the instances relevant only - // for SQL Server. - AdvancedMachineFeatures advanced_machine_features = 35; - - // Configuration for data cache. - DataCacheConfig data_cache_config = 37; - - // Optional. Configuration value for recreation of replica after certain - // replication lag. - google.protobuf.Int32Value replication_lag_max_seconds = 39 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When this parameter is set to true, Cloud SQL instances can - // connect to Vertex AI to pass requests for real-time predictions and - // insights to the AI. The default value is false. This applies only to Cloud - // SQL for MySQL and Cloud SQL for PostgreSQL instances. - google.protobuf.BoolValue enable_google_ml_integration = 40 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. By default, Cloud SQL instances have schema extraction disabled - // for Dataplex. When this parameter is set to true, schema extraction for - // Dataplex on Cloud SQL instances is activated. - google.protobuf.BoolValue enable_dataplex_integration = 41 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. When this parameter is set to true, Cloud SQL retains backups of - // the instance even after the instance is deleted. The ON_DEMAND backup will - // be retained until customer deletes the backup or the project. The AUTOMATED - // backup will be retained based on the backups retention setting. - google.protobuf.BoolValue retain_backups_on_delete = 42 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Provisioned number of I/O operations per second for the data - // disk. This field is only used for hyperdisk-balanced disk types. - optional int64 data_disk_provisioned_iops = 43 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Provisioned throughput measured in MiB per second for the data - // disk. This field is only used for hyperdisk-balanced disk types. - optional int64 data_disk_provisioned_throughput = 44 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The managed connection pooling configuration for the instance. - optional ConnectionPoolConfig connection_pool_config = 45 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The final backup configuration for the instance. - optional FinalBackupConfig final_backup_config = 47 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The read pool auto-scale configuration for the instance. - optional ReadPoolAutoScaleConfig read_pool_auto_scale_config = 48 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Cloud SQL for MySQL auto-upgrade configuration. When this - // parameter is set to true, auto-upgrade is enabled for MySQL 8.0 minor - // versions. The MySQL version must be 8.0.35 or higher. - optional bool auto_upgrade_enabled = 50 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The Microsoft Entra ID configuration for the SQL Server instance. - SqlServerEntraIdConfig entraid_config = 52 - [(google.api.field_behavior) = OPTIONAL]; - - // This parameter controls whether to allow using ExecuteSql API to connect to - // the instance. Not allowed by default. - optional DataApiAccess data_api_access = 53; - - // Optional. Configuration for Performance Capture, provides diagnostic - // metrics during high load situations. - PerformanceCaptureConfig performance_capture_config = 54 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Performance Capture configuration. -message PerformanceCaptureConfig { - // Optional. Enable or disable the Performance Capture. - optional bool enabled = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The time interval in seconds between any two probes. - optional int32 probing_interval_seconds = 2 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The minimum number of consecutive readings above threshold that - // triggers instance state capture. - optional int32 probe_threshold = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The minimum number of server threads running to trigger the - // capture on primary. - optional int32 running_threads_threshold = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The minimum number of seconds replica must be lagging behind - // primary to trigger capture on replica. - optional int32 seconds_behind_source_threshold = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The amount of time in seconds that a transaction needs to have - // been open before the watcher starts recording it. - optional int32 transaction_duration_threshold = 8 - [(google.api.field_behavior) = OPTIONAL]; -} - -// Specifies options for controlling advanced machine features. -message AdvancedMachineFeatures { - // The number of threads per physical core. - int32 threads_per_core = 1; -} - -// SslCerts Resource -message SslCert { - // This is always `sql#sslCert`. - string kind = 1; - - // Serial number, as extracted from the certificate. - string cert_serial_number = 2; - - // PEM representation. - string cert = 3; - - // The time when the certificate was created in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp create_time = 4; - - // User supplied name. Constrained to [a-zA-Z.-_ ]+. - string common_name = 5; - - // The time when the certificate expires in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp expiration_time = 6; - - // Sha1 Fingerprint. - string sha1_fingerprint = 7; - - // Name of the database instance. - string instance = 8; - - // The URI of this resource. - string self_link = 9; -} - -// SslCertDetail. -message SslCertDetail { - // The public information about the cert. - SslCert cert_info = 1; - - // The private key for the client cert, in pem format. Keep private in order - // to protect your security. - string cert_private_key = 2; -} - -// SslCerts create ephemeral certificate request. -message SslCertsCreateEphemeralRequest { - // PEM encoded public key to include in the signed certificate. - string public_key = 1 [json_name = "public_key"]; - - // Access token to include in the signed certificate. - string access_token = 2 [json_name = "access_token"]; -} - -// SslCerts insert request. -message SslCertsInsertRequest { - // User supplied name. Must be a distinct name from the other certificates - // for this instance. - string common_name = 1; -} - -// Reschedule options for maintenance windows. -message SqlInstancesRescheduleMaintenanceRequestBody { - enum RescheduleType { - RESCHEDULE_TYPE_UNSPECIFIED = 0; - - // Reschedules maintenance to happen now (within 5 minutes). - IMMEDIATE = 1; - - // Reschedules maintenance to occur within one week from the originally - // scheduled day and time. - NEXT_AVAILABLE_WINDOW = 2; - - // Reschedules maintenance to a specific time and day. - SPECIFIC_TIME = 3; - } - - message Reschedule { - // Required. The type of the reschedule. - RescheduleType reschedule_type = 1; - - // Optional. Timestamp when the maintenance shall be rescheduled to if - // reschedule_type=SPECIFIC_TIME, in - // [RFC 3339](https://tools.ietf.org/html/rfc3339) format, for example - // `2012-11-15T16:19:00.094Z`. - google.protobuf.Timestamp schedule_time = 2 - [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. The type of the reschedule the user wants. - Reschedule reschedule = 3; -} - -// SslCert insert response. -message SslCertsInsertResponse { - // This is always `sql#sslCertsInsert`. - string kind = 1; - - // The operation to track the ssl certs insert request. - Operation operation = 2; - - // The server Certificate Authority's certificate. If this is missing you can - // force a new one to be generated by calling resetSslConfig method on - // instances resource. - SslCert server_ca_cert = 3; - - // The new client certificate and private key. - SslCertDetail client_cert = 4; -} - -// SslCerts list response. -message SslCertsListResponse { - // This is always `sql#sslCertsList`. - string kind = 1; - - // List of client certificates for the instance. - repeated SslCert items = 2; -} - -// Database Instance truncate log context. -message TruncateLogContext { - // This is always `sql#truncateLogContext`. - string kind = 1; - - // The type of log to truncate. Valid values are `MYSQL_GENERAL_TABLE` and - // `MYSQL_SLOW_TABLE`. - string log_type = 2; -} - -// Active Directory configuration, relevant only for Cloud SQL for SQL Server. -message SqlActiveDirectoryConfig { - // The modes of Active Directory configuration. - enum ActiveDirectoryMode { - // Unspecified mode. - ACTIVE_DIRECTORY_MODE_UNSPECIFIED = 0; - - // Managed Active Directory mode. This is the fallback option to maintain - // backward compatibility. - MANAGED_ACTIVE_DIRECTORY = 1; - - // Deprecated: Use CUSTOMER_MANAGED_ACTIVE_DIRECTORY instead. - SELF_MANAGED_ACTIVE_DIRECTORY = 2 [deprecated = true]; - - // Customer-managed Active Directory mode. - CUSTOMER_MANAGED_ACTIVE_DIRECTORY = 3; - } - - // This is always sql#activeDirectoryConfig. - string kind = 1; - - // The name of the domain (e.g., mydomain.com). - string domain = 2; - - // Optional. The mode of the Active Directory configuration. - ActiveDirectoryMode mode = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Domain controller IPv4 addresses used to bootstrap Active - // Directory. - repeated string dns_servers = 4 [ - (google.api.field_info).format = IPV4, - (google.api.field_behavior) = OPTIONAL - ]; - - // Optional. The secret manager key storing the administrator credential. - // (e.g., projects/{project}/secrets/{secret}). - string admin_credential_secret_name = 5 - [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The organizational unit distinguished name. This is the full - // hierarchical path to the organizational unit. - string organizational_unit = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// SQL Server specific audit configuration. -message SqlServerAuditConfig { - // This is always sql#sqlServerAuditConfig - string kind = 1; - - // The name of the destination bucket (e.g., gs://mybucket). - string bucket = 2; - - // How long to keep generated audit files. - google.protobuf.Duration retention_interval = 3; - - // How often to upload generated audit files. - google.protobuf.Duration upload_interval = 4; -} - -// SQL Server Entra ID configuration. -message SqlServerEntraIdConfig { - // Output only. This is always sql#sqlServerEntraIdConfig - string kind = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional. The tenant ID for the Entra ID configuration. - string tenant_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. The application ID for the Entra ID configuration. - string application_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// The status of a backup run. -enum SqlBackupRunStatus { - // The status of the run is unknown. - SQL_BACKUP_RUN_STATUS_UNSPECIFIED = 0; - - // The backup operation was enqueued. - ENQUEUED = 1; - - // The backup is overdue across a given backup window. Indicates a - // problem. Example: Long-running operation in progress during - // the whole window. - OVERDUE = 2; - - // The backup is in progress. - RUNNING = 3; - - // The backup failed. - FAILED = 4; - - // The backup was successful. - SUCCESSFUL = 5; - - // The backup was skipped (without problems) for a given backup - // window. Example: Instance was idle. - SKIPPED = 6; - - // The backup is about to be deleted. - DELETION_PENDING = 7; - - // The backup deletion failed. - DELETION_FAILED = 8; - - // The backup has been deleted. - DELETED = 9; -} - -enum SqlBackupRunType { - // This is an unknown BackupRun type. - SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0; - - // The backup schedule automatically triggers a backup. - AUTOMATED = 1; - - // The user manually triggers a backup. - ON_DEMAND = 2; -} - -// Defines the supported backup kinds -enum SqlBackupKind { - // This is an unknown BackupKind. - SQL_BACKUP_KIND_UNSPECIFIED = 0; - - // Snapshot-based backups. - SNAPSHOT = 1; - - // Physical backups. - PHYSICAL = 2; -} - -enum SqlBackendType { - // This is an unknown backend type for instance. - SQL_BACKEND_TYPE_UNSPECIFIED = 0; - - // V1 speckle instance. - FIRST_GEN = 1 [deprecated = true]; - - // V2 speckle instance. - SECOND_GEN = 2; - - // On premises instance. - EXTERNAL = 3; -} - -enum SqlIpAddressType { - // This is an unknown IP address type. - SQL_IP_ADDRESS_TYPE_UNSPECIFIED = 0; - - // IP address the customer is supposed to connect to. Usually this is the - // load balancer's IP address - PRIMARY = 1; - - // Source IP address of the connection a read replica establishes to its - // external primary instance. This IP address can be allowlisted by the - // customer in case it has a firewall that filters incoming connection to its - // on premises primary instance. - OUTGOING = 2; - - // Private IP used when using private IPs and network peering. - PRIVATE = 3; - - // V1 IP of a migrated instance. We want the user to - // decommission this IP as soon as the migration is complete. - // Note: V1 instances with V1 ip addresses will be counted as PRIMARY. - MIGRATED_1ST_GEN = 4; -} - -enum SqlInstanceType { - // This is an unknown Cloud SQL instance type. - SQL_INSTANCE_TYPE_UNSPECIFIED = 0; - - // A regular Cloud SQL instance that is not replicating from a primary - // instance. - CLOUD_SQL_INSTANCE = 1; - - // An instance running on the customer's premises that is not managed by - // Cloud SQL. - ON_PREMISES_INSTANCE = 2; - - // A Cloud SQL instance acting as a read-replica. - READ_REPLICA_INSTANCE = 3; - - // A Cloud SQL read pool. - READ_POOL_INSTANCE = 5; -} - -// Connection pool flags for Cloud SQL instances managed connection pool -// configuration. -message ConnectionPoolFlags { - // Required. The name of the flag. - string name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The value of the flag. Boolean flags are set to `on` for true - // and `off` for false. This field must be omitted if the flag - // doesn't take a value. - string value = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The read pool auto-scale configuration. -message ReadPoolAutoScaleConfig { - // Target metric for read pool auto scaling. - message TargetMetric { - // The metric name to be used for auto scaling. - optional string metric = 1; - - // The target value for the metric. - optional float target_value = 2; - } - - // Indicates whether read pool auto scaling is enabled. - optional bool enabled = 1; - - // Minimum number of read pool nodes to be maintained. - optional int32 min_node_count = 2; - - // Maximum number of read pool nodes to be maintained. - optional int32 max_node_count = 3; - - // Optional. Target metrics for read pool auto scaling. - repeated TargetMetric target_metrics = 4 - [(google.api.field_behavior) = OPTIONAL]; - - // Indicates whether read pool auto scaling supports scale in operations - // (removing nodes). - optional bool disable_scale_in = 5; - - // The cooldown period for scale in operations. - optional int32 scale_in_cooldown_seconds = 6; - - // The cooldown period for scale out operations. - optional int32 scale_out_cooldown_seconds = 7; -} - -// The managed connection pooling configuration. -message ConnectionPoolConfig { - // Whether managed connection pooling is enabled. - optional bool connection_pooling_enabled = 1; - - // Optional. List of connection pool configuration flags. - repeated ConnectionPoolFlags flags = 8 - [(google.api.field_behavior) = OPTIONAL]; - - // Output only. Number of connection poolers. - optional int32 pooler_count = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The database engine type and version. -enum SqlDatabaseVersion { - // This is an unknown database version. - SQL_DATABASE_VERSION_UNSPECIFIED = 0; - - // The database version is MySQL 5.1. - MYSQL_5_1 = 2 [deprecated = true]; - - // The database version is MySQL 5.5. - MYSQL_5_5 = 3 [deprecated = true]; - - // The database version is MySQL 5.6. - MYSQL_5_6 = 5; - - // The database version is MySQL 5.7. - MYSQL_5_7 = 6; - - // The database version is MySQL 8. - MYSQL_8_0 = 20; - - // The database major version is MySQL 8.0 and the minor version is 18. - MYSQL_8_0_18 = 41; - - // The database major version is MySQL 8.0 and the minor version is 26. - MYSQL_8_0_26 = 85; - - // The database major version is MySQL 8.0 and the minor version is 27. - MYSQL_8_0_27 = 111; - - // The database major version is MySQL 8.0 and the minor version is 28. - MYSQL_8_0_28 = 132; - - // The database major version is MySQL 8.0 and the minor version is 29. - MYSQL_8_0_29 = 148 [deprecated = true]; - - // The database major version is MySQL 8.0 and the minor version is 30. - MYSQL_8_0_30 = 174; - - // The database major version is MySQL 8.0 and the minor version is 31. - MYSQL_8_0_31 = 197; - - // The database major version is MySQL 8.0 and the minor version is 32. - MYSQL_8_0_32 = 213; - - // The database major version is MySQL 8.0 and the minor version is 33. - MYSQL_8_0_33 = 238; - - // The database major version is MySQL 8.0 and the minor version is 34. - MYSQL_8_0_34 = 239; - - // The database major version is MySQL 8.0 and the minor version is 35. - MYSQL_8_0_35 = 240; - - // The database major version is MySQL 8.0 and the minor version is 36. - MYSQL_8_0_36 = 241; - - // The database major version is MySQL 8.0 and the minor version is 37. - MYSQL_8_0_37 = 355; - - // The database major version is MySQL 8.0 and the minor version is 39. - MYSQL_8_0_39 = 357; - - // The database major version is MySQL 8.0 and the minor version is 40. - MYSQL_8_0_40 = 358; - - // The database major version is MySQL 8.0 and the minor version is 41. - MYSQL_8_0_41 = 488; - - // The database major version is MySQL 8.0 and the minor version is 42. - MYSQL_8_0_42 = 489; - - // The database major version is MySQL 8.0 and the minor version is 43. - MYSQL_8_0_43 = 553; - - // The database major version is MySQL 8.0 and the minor version is 44. - MYSQL_8_0_44 = 554; - - // The database major version is MySQL 8.0 and the minor version is 45. - MYSQL_8_0_45 = 555; - - // The database major version is MySQL 8.0 and the minor version is 46. - MYSQL_8_0_46 = 556; - - // The database version is MySQL 8.4. - MYSQL_8_4 = 398; - - // The database version is MySQL 9.7. - MYSQL_9_7 = 654; - - // The database version is SQL Server 2017 Standard. - SQLSERVER_2017_STANDARD = 11; - - // The database version is SQL Server 2017 Enterprise. - SQLSERVER_2017_ENTERPRISE = 14; - - // The database version is SQL Server 2017 Express. - SQLSERVER_2017_EXPRESS = 15; - - // The database version is SQL Server 2017 Web. - SQLSERVER_2017_WEB = 16; - - // The database version is PostgreSQL 9.6. - POSTGRES_9_6 = 9; - - // The database version is PostgreSQL 10. - POSTGRES_10 = 18; - - // The database version is PostgreSQL 11. - POSTGRES_11 = 10; - - // The database version is PostgreSQL 12. - POSTGRES_12 = 19; - - // The database version is PostgreSQL 13. - POSTGRES_13 = 23; - - // The database version is PostgreSQL 14. - POSTGRES_14 = 110; - - // The database version is PostgreSQL 15. - POSTGRES_15 = 172; - - // The database version is PostgreSQL 16. - POSTGRES_16 = 272; - - // The database version is PostgreSQL 17. - POSTGRES_17 = 408; - - // The database version is PostgreSQL 18. - POSTGRES_18 = 557; - - // The database version is SQL Server 2019 Standard. - SQLSERVER_2019_STANDARD = 26; - - // The database version is SQL Server 2019 Enterprise. - SQLSERVER_2019_ENTERPRISE = 27; - - // The database version is SQL Server 2019 Express. - SQLSERVER_2019_EXPRESS = 28; - - // The database version is SQL Server 2019 Web. - SQLSERVER_2019_WEB = 29; - - // The database version is SQL Server 2022 Standard. - SQLSERVER_2022_STANDARD = 199; - - // The database version is SQL Server 2022 Enterprise. - SQLSERVER_2022_ENTERPRISE = 200; - - // The database version is SQL Server 2022 Express. - SQLSERVER_2022_EXPRESS = 201; - - // The database version is SQL Server 2022 Web. - SQLSERVER_2022_WEB = 202; -} - -// The suspension reason of the database instance if the state is SUSPENDED. -enum SqlSuspensionReason { - // This is an unknown suspension reason. - SQL_SUSPENSION_REASON_UNSPECIFIED = 0; - - // The instance is suspended due to billing issues (for example:, account - // issue) - BILLING_ISSUE = 2; - - // The instance is suspended due to illegal content (for example:, child - // pornography, copyrighted material, etc.). - LEGAL_ISSUE = 3; - - // The instance is causing operational issues (for example:, causing the - // database to crash). - OPERATIONAL_ISSUE = 4; - - // The KMS key used by the instance is either revoked or denied access to - KMS_KEY_ISSUE = 5; -} - -// The pricing plan for this instance. -enum SqlPricingPlan { - // This is an unknown pricing plan for this instance. - SQL_PRICING_PLAN_UNSPECIFIED = 0; - - // The instance is billed at a monthly flat rate. - PACKAGE = 1; - - // The instance is billed per usage. - PER_USE = 2; -} - -enum SqlReplicationType { - // This is an unknown replication type for a Cloud SQL instance. - SQL_REPLICATION_TYPE_UNSPECIFIED = 0; - - // The synchronous replication mode for First Generation instances. It is the - // default value. - SYNCHRONOUS = 1; - - // The asynchronous replication mode for First Generation instances. It - // provides a slight performance gain, but if an outage occurs while this - // option is set to asynchronous, you can lose up to a few seconds of updates - // to your data. - ASYNCHRONOUS = 2; -} - -// The type of disk that is used for a v2 instance to use. -enum SqlDataDiskType { - // This is an unknown data disk type. - SQL_DATA_DISK_TYPE_UNSPECIFIED = 0; - - // An SSD data disk. - PD_SSD = 1; - - // An HDD data disk. - PD_HDD = 2; - - // This field is deprecated and will be removed from a future version of the - // API. - OBSOLETE_LOCAL_SSD = 3 [deprecated = true]; - - // A Hyperdisk Balanced data disk. - HYPERDISK_BALANCED = 4; -} - -// The availability type of the given Cloud SQL instance. -enum SqlAvailabilityType { - // This is an unknown Availability type. - SQL_AVAILABILITY_TYPE_UNSPECIFIED = 0; - - // Zonal available instance. - ZONAL = 1; - - // Regional available instance. - REGIONAL = 2; -} - -enum SqlUpdateTrack { - // This is an unknown maintenance timing preference. - SQL_UPDATE_TRACK_UNSPECIFIED = 0; - - // For an instance with a scheduled maintenance window, this maintenance - // timing indicates that the maintenance update is scheduled 7 to 14 days - // after the notification is sent out. Also referred to as `Week 1` (Console) - // and `preview` (gcloud CLI). - canary = 1; - - // For an instance with a scheduled maintenance window, this maintenance - // timing indicates that the maintenance update is scheduled 15 to 21 days - // after the notification is sent out. Also referred to as `Week 2` (Console) - // and `production` (gcloud CLI). - stable = 2; - - // For instance with a scheduled maintenance window, this maintenance - // timing indicates that the maintenance update is scheduled 35 to 42 days - // after the notification is sent out. - week5 = 3; -} - -// Acquire SSRS lease context. -message AcquireSsrsLeaseContext { - // The username to be used as the setup login to connect to the database - // server for SSRS setup. - optional string setup_login = 1; - - // The username to be used as the service login to connect to the report - // database for SSRS setup. - optional string service_login = 2; - - // The report database to be used for the SSRS setup. - optional string report_database = 3; - - // Lease duration needed for the SSRS setup. - optional google.protobuf.Duration duration = 4; -} - -enum SqlFlagType { - // This is an unknown flag type. - SQL_FLAG_TYPE_UNSPECIFIED = 0; - - // Boolean type flag. - BOOLEAN = 1; - - // String type flag. - STRING = 2; - - // Integer type flag. - INTEGER = 3; - - // Flag type used for a server startup option. - NONE = 4; - - // Type introduced specially for MySQL TimeZone offset. Accept a string value - // with the format [-12:59, 13:00]. - MYSQL_TIMEZONE_OFFSET = 5; - - // Float type flag. - FLOAT = 6; - - // Comma-separated list of the strings in a SqlFlagType enum. - REPEATED_STRING = 7; -} - -// Scopes of a flag describe where the flag is used. -enum SqlFlagScope { - // Assume database flags if unspecified - SQL_FLAG_SCOPE_UNSPECIFIED = 0; - - // database flags - SQL_FLAG_SCOPE_DATABASE = 1; - - // connection pool configuration flags - SQL_FLAG_SCOPE_CONNECTION_POOL = 2; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto deleted file mode 100644 index 8c2f712c8b99..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1beta4; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlTiersProto"; -option java_package = "com.google.cloud.sql.v1beta4"; - -// Service for providing machine types (tiers) for Cloud SQL. -service SqlTiersService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Lists all available machine types (tiers) for Cloud SQL, for example, - // `db-custom-1-3840`. For related information, see [Pricing](/sql/pricing). - rpc List(SqlTiersListRequest) returns (TiersListResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/tiers" - }; - } -} - -message SqlTiersListRequest { - // Project ID of the project for which to list tiers. - string project = 1; -} - -// Tiers list response. -message TiersListResponse { - // This is always `sql#tiersList`. - string kind = 1; - - // List of tiers. - repeated Tier items = 2; -} - -// A Google Cloud SQL service tier resource. -message Tier { - // An identifier for the machine type, for example, `db-custom-1-3840`. For - // related information, see [Pricing](/sql/pricing). - string tier = 1; - - // The maximum RAM usage of this tier in bytes. - int64 RAM = 2 [json_name = "RAM"]; - - // This is always `sql#tier`. - string kind = 3; - - // The maximum disk size of this tier in bytes. - int64 Disk_Quota = 4 [json_name = "DiskQuota"]; - - // The applicable regions for this tier. - repeated string region = 5; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_users.proto b/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_users.proto deleted file mode 100644 index bb4e20c993bb..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/google/cloud/sql/v1beta4/cloud_sql_users.proto +++ /dev/null @@ -1,311 +0,0 @@ -// Copyright 2026 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. - -syntax = "proto3"; - -package google.cloud.sql.v1beta4; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/cloud/sql/v1beta4/cloud_sql_resources.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb"; -option java_multiple_files = true; -option java_outer_classname = "CloudSqlUsersProto"; -option java_package = "com.google.cloud.sql.v1beta4"; - -service SqlUsersService { - option (google.api.default_host) = "sqladmin.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform," - "https://www.googleapis.com/auth/sqlservice.admin"; - - // Deletes a user from a Cloud SQL instance. - rpc Delete(SqlUsersDeleteRequest) returns (Operation) { - option (google.api.http) = { - delete: "/sql/v1beta4/projects/{project}/instances/{instance}/users" - }; - } - - // Retrieves a resource containing information about a user. - rpc Get(SqlUsersGetRequest) returns (User) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/users/{name}" - }; - } - - // Creates a new user in a Cloud SQL instance. - rpc Insert(SqlUsersInsertRequest) returns (Operation) { - option (google.api.http) = { - post: "/sql/v1beta4/projects/{project}/instances/{instance}/users" - body: "body" - }; - } - - // Lists users in the specified Cloud SQL instance. - rpc List(SqlUsersListRequest) returns (UsersListResponse) { - option (google.api.http) = { - get: "/sql/v1beta4/projects/{project}/instances/{instance}/users" - }; - } - - // Updates an existing user in a Cloud SQL instance. - rpc Update(SqlUsersUpdateRequest) returns (Operation) { - option (google.api.http) = { - put: "/sql/v1beta4/projects/{project}/instances/{instance}/users" - body: "body" - }; - } -} - -message SqlUsersDeleteRequest { - // Host of the user in the instance. - string host = 1; - - // Database instance ID. This does not include the project ID. - string instance = 2; - - // Name of the user in the instance. - string name = 3; - - // Project ID of the project that contains the instance. - string project = 4; -} - -// Request message for Users Get RPC -message SqlUsersGetRequest { - // Database instance ID. This does not include the project ID. - string instance = 1; - - // User of the instance. - string name = 2; - - // Project ID of the project that contains the instance. - string project = 3; - - // Host of a user of the instance. - string host = 4; -} - -message SqlUsersInsertRequest { - // Database instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; - - User body = 100; -} - -message SqlUsersListRequest { - // Database instance ID. This does not include the project ID. - string instance = 1; - - // Project ID of the project that contains the instance. - string project = 2; -} - -message SqlUsersUpdateRequest { - // Optional. Host of the user in the instance. - string host = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Database instance ID. This does not include the project ID. - string instance = 2; - - // Name of the user in the instance. - string name = 3; - - // Project ID of the project that contains the instance. - string project = 4; - - // Optional. List of database roles to grant to the user. body.database_roles - // will be ignored for update request. - repeated string database_roles = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Specifies whether to revoke existing roles that are not present - // in the `database_roles` field. If `false` or unset, the database roles - // specified in `database_roles` are added to the user's existing roles. - optional bool revoke_existing_roles = 6 - [(google.api.field_behavior) = OPTIONAL]; - - User body = 100; -} - -// User level password validation policy. -message UserPasswordValidationPolicy { - // Number of failed login attempts allowed before user get locked. - int32 allowed_failed_attempts = 1; - - // Expiration duration after password is updated. - google.protobuf.Duration password_expiration_duration = 2; - - // If true, failed login attempts check will be enabled. - bool enable_failed_attempts_check = 3; - - // Output only. Read-only password status. - PasswordStatus status = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // If true, the user must specify the current password before changing the - // password. This flag is supported only for MySQL. - bool enable_password_verification = 5; -} - -// Read-only password status. -message PasswordStatus { - // If true, user does not have login privileges. - bool locked = 1; - - // The expiration time of the current password. - google.protobuf.Timestamp password_expiration_time = 2; -} - -// A Cloud SQL user resource. -message User { - // The user type. - enum SqlUserType { - // The database's built-in user type. - BUILT_IN = 0; - - // Cloud IAM user. - CLOUD_IAM_USER = 1; - - // Cloud IAM service account. - CLOUD_IAM_SERVICE_ACCOUNT = 2; - - // Cloud IAM group. Not used for login. - CLOUD_IAM_GROUP = 3; - - // Read-only. Login for a user that belongs to the Cloud IAM group. - CLOUD_IAM_GROUP_USER = 4; - - // Read-only. Login for a service account that belongs to the - // Cloud IAM group. - CLOUD_IAM_GROUP_SERVICE_ACCOUNT = 5; - - // Microsoft Entra ID user. - ENTRAID_USER = 7; - } - - // The type of retained password. - enum DualPasswordType { - // The default value. - DUAL_PASSWORD_TYPE_UNSPECIFIED = 0; - - // Do not update the user's dual password status. - NO_MODIFY_DUAL_PASSWORD = 1; - - // No dual password usable for connecting using this user. - NO_DUAL_PASSWORD = 2; - - // Dual password usable for connecting using this user. - DUAL_PASSWORD = 3; - } - - // Indicates if a group is available for IAM database authentication. - enum IamStatus { - // The default value for users that are not of type CLOUD_IAM_GROUP. - // Only CLOUD_IAM_GROUP users will be inactive or active. - // Users with an IamStatus of IAM_STATUS_UNSPECIFIED will not - // display whether they are active or inactive as that is not applicable to - // them. - IAM_STATUS_UNSPECIFIED = 0; - - // INACTIVE indicates a group is not available for IAM database - // authentication. - INACTIVE = 1; - - // ACTIVE indicates a group is available for IAM database authentication. - ACTIVE = 2; - } - - // This is always `sql#user`. - string kind = 1; - - // The password for the user. - string password = 2; - - // This field is deprecated and will be removed from a future version of the - // API. - string etag = 3; - - // The name of the user in the Cloud SQL instance. Can be omitted for - // `update` because it is already specified in the URL. - string name = 4; - - // Optional. The host from which the user can connect. For `insert` - // operations, host defaults to an empty string. For `update` - // operations, host is specified as part of the request URL. The host name - // cannot be updated after insertion. For a MySQL instance, it's required; - // for a PostgreSQL or SQL Server instance, it's optional. - string host = 5 [(google.api.field_behavior) = OPTIONAL]; - - // The name of the Cloud SQL instance. This does not include the project ID. - // Can be omitted for update because it is already specified on the - // URL. - string instance = 6; - - // The project ID of the project containing the Cloud SQL database. The Google - // apps domain is prefixed if applicable. Can be omitted for - // update because it is already specified on the URL. - string project = 7; - - // The user type. It determines the method to authenticate the user during - // login. The default is the database's built-in user type. - SqlUserType type = 8; - - // User details for specific database type - oneof user_details { - SqlServerUserDetails sqlserver_user_details = 9; - } - - // Optional. The full email for an IAM user. For normal database users, this - // will not be filled. Only applicable to MySQL database users. - string iam_email = 11 [(google.api.field_behavior) = OPTIONAL]; - - // User level password validation policy. - UserPasswordValidationPolicy password_policy = 12; - - // Dual password status for the user. - optional DualPasswordType dual_password_type = 13; - - // Indicates if a group is active or inactive for IAM database authentication. - optional IamStatus iam_status = 14; - - // Optional. Role memberships of the user - repeated string database_roles = 15 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents a Sql Server user on the Cloud SQL instance. -message SqlServerUserDetails { - // If the user has been disabled - bool disabled = 1; - - // The server roles for this user - repeated string server_roles = 2; -} - -// User list response. -message UsersListResponse { - // This is always sql#usersList. - string kind = 1; - - // List of user resources in the instance. - repeated User items = 2; - - // Unused. - string next_page_token = 3 [deprecated = true]; -} diff --git a/owl-bot-staging/google-cloud-sql/protos/protos.d.ts b/owl-bot-staging/google-cloud-sql/protos/protos.d.ts deleted file mode 100644 index fa584fd39e4e..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/protos.d.ts +++ /dev/null @@ -1,63446 +0,0 @@ -// Copyright 2026 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. - -import type {protobuf as $protobuf} from "google-gax"; -import Long = require("long"); -/** Namespace google. */ -export namespace google { - - /** Namespace cloud. */ - namespace cloud { - - /** Namespace sql. */ - namespace sql { - - /** Namespace v1. */ - namespace v1 { - - /** Represents a SqlAvailableDatabaseVersionsService */ - class SqlAvailableDatabaseVersionsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlAvailableDatabaseVersionsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlAvailableDatabaseVersionsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlAvailableDatabaseVersionsService; - } - - /** Represents a SqlBackupRunsService */ - class SqlBackupRunsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlBackupRunsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlBackupRunsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlBackupRunsService; - - /** - * Calls Delete. - * @param request SqlBackupRunsDeleteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public delete(request: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, callback: google.cloud.sql.v1.SqlBackupRunsService.DeleteCallback): void; - - /** - * Calls Delete. - * @param request SqlBackupRunsDeleteRequest message or plain object - * @returns Promise - */ - public delete(request: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest): Promise; - - /** - * Calls Get. - * @param request SqlBackupRunsGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and BackupRun - */ - public get(request: google.cloud.sql.v1.ISqlBackupRunsGetRequest, callback: google.cloud.sql.v1.SqlBackupRunsService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlBackupRunsGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1.ISqlBackupRunsGetRequest): Promise; - - /** - * Calls Insert. - * @param request SqlBackupRunsInsertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public insert(request: google.cloud.sql.v1.ISqlBackupRunsInsertRequest, callback: google.cloud.sql.v1.SqlBackupRunsService.InsertCallback): void; - - /** - * Calls Insert. - * @param request SqlBackupRunsInsertRequest message or plain object - * @returns Promise - */ - public insert(request: google.cloud.sql.v1.ISqlBackupRunsInsertRequest): Promise; - - /** - * Calls List. - * @param request SqlBackupRunsListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and BackupRunsListResponse - */ - public list(request: google.cloud.sql.v1.ISqlBackupRunsListRequest, callback: google.cloud.sql.v1.SqlBackupRunsService.ListCallback): void; - - /** - * Calls List. - * @param request SqlBackupRunsListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1.ISqlBackupRunsListRequest): Promise; - } - - namespace SqlBackupRunsService { - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|delete_}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|get}. - * @param error Error, if any - * @param [response] BackupRun - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.BackupRun) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|insert}. - * @param error Error, if any - * @param [response] Operation - */ - type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|list}. - * @param error Error, if any - * @param [response] BackupRunsListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.BackupRunsListResponse) => void; - } - - /** Properties of a SqlBackupRunsDeleteRequest. */ - interface ISqlBackupRunsDeleteRequest { - - /** SqlBackupRunsDeleteRequest id */ - id?: (number|Long|string|null); - - /** SqlBackupRunsDeleteRequest instance */ - instance?: (string|null); - - /** SqlBackupRunsDeleteRequest project */ - project?: (string|null); - } - - /** Represents a SqlBackupRunsDeleteRequest. */ - class SqlBackupRunsDeleteRequest implements ISqlBackupRunsDeleteRequest { - - /** - * Constructs a new SqlBackupRunsDeleteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest); - - /** SqlBackupRunsDeleteRequest id. */ - public id: (number|Long|string); - - /** SqlBackupRunsDeleteRequest instance. */ - public instance: string; - - /** SqlBackupRunsDeleteRequest project. */ - public project: string; - - /** - * Creates a new SqlBackupRunsDeleteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBackupRunsDeleteRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest): google.cloud.sql.v1.SqlBackupRunsDeleteRequest; - - /** - * Encodes the specified SqlBackupRunsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsDeleteRequest.verify|verify} messages. - * @param message SqlBackupRunsDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBackupRunsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsDeleteRequest.verify|verify} messages. - * @param message SqlBackupRunsDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBackupRunsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlBackupRunsDeleteRequest; - - /** - * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBackupRunsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlBackupRunsDeleteRequest; - - /** - * Verifies a SqlBackupRunsDeleteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBackupRunsDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBackupRunsDeleteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlBackupRunsDeleteRequest; - - /** - * Creates a plain object from a SqlBackupRunsDeleteRequest message. Also converts values to other types if specified. - * @param message SqlBackupRunsDeleteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlBackupRunsDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBackupRunsDeleteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBackupRunsDeleteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlBackupRunsGetRequest. */ - interface ISqlBackupRunsGetRequest { - - /** SqlBackupRunsGetRequest id */ - id?: (number|Long|string|null); - - /** SqlBackupRunsGetRequest instance */ - instance?: (string|null); - - /** SqlBackupRunsGetRequest project */ - project?: (string|null); - } - - /** Represents a SqlBackupRunsGetRequest. */ - class SqlBackupRunsGetRequest implements ISqlBackupRunsGetRequest { - - /** - * Constructs a new SqlBackupRunsGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlBackupRunsGetRequest); - - /** SqlBackupRunsGetRequest id. */ - public id: (number|Long|string); - - /** SqlBackupRunsGetRequest instance. */ - public instance: string; - - /** SqlBackupRunsGetRequest project. */ - public project: string; - - /** - * Creates a new SqlBackupRunsGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBackupRunsGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlBackupRunsGetRequest): google.cloud.sql.v1.SqlBackupRunsGetRequest; - - /** - * Encodes the specified SqlBackupRunsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsGetRequest.verify|verify} messages. - * @param message SqlBackupRunsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlBackupRunsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBackupRunsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsGetRequest.verify|verify} messages. - * @param message SqlBackupRunsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlBackupRunsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBackupRunsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlBackupRunsGetRequest; - - /** - * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBackupRunsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlBackupRunsGetRequest; - - /** - * Verifies a SqlBackupRunsGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBackupRunsGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBackupRunsGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlBackupRunsGetRequest; - - /** - * Creates a plain object from a SqlBackupRunsGetRequest message. Also converts values to other types if specified. - * @param message SqlBackupRunsGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlBackupRunsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBackupRunsGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBackupRunsGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlBackupRunsInsertRequest. */ - interface ISqlBackupRunsInsertRequest { - - /** SqlBackupRunsInsertRequest instance */ - instance?: (string|null); - - /** SqlBackupRunsInsertRequest project */ - project?: (string|null); - - /** SqlBackupRunsInsertRequest body */ - body?: (google.cloud.sql.v1.IBackupRun|null); - } - - /** Represents a SqlBackupRunsInsertRequest. */ - class SqlBackupRunsInsertRequest implements ISqlBackupRunsInsertRequest { - - /** - * Constructs a new SqlBackupRunsInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlBackupRunsInsertRequest); - - /** SqlBackupRunsInsertRequest instance. */ - public instance: string; - - /** SqlBackupRunsInsertRequest project. */ - public project: string; - - /** SqlBackupRunsInsertRequest body. */ - public body?: (google.cloud.sql.v1.IBackupRun|null); - - /** - * Creates a new SqlBackupRunsInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBackupRunsInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlBackupRunsInsertRequest): google.cloud.sql.v1.SqlBackupRunsInsertRequest; - - /** - * Encodes the specified SqlBackupRunsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsInsertRequest.verify|verify} messages. - * @param message SqlBackupRunsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlBackupRunsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBackupRunsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsInsertRequest.verify|verify} messages. - * @param message SqlBackupRunsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlBackupRunsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBackupRunsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlBackupRunsInsertRequest; - - /** - * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBackupRunsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlBackupRunsInsertRequest; - - /** - * Verifies a SqlBackupRunsInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBackupRunsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBackupRunsInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlBackupRunsInsertRequest; - - /** - * Creates a plain object from a SqlBackupRunsInsertRequest message. Also converts values to other types if specified. - * @param message SqlBackupRunsInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlBackupRunsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBackupRunsInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBackupRunsInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlBackupRunsListRequest. */ - interface ISqlBackupRunsListRequest { - - /** SqlBackupRunsListRequest instance */ - instance?: (string|null); - - /** SqlBackupRunsListRequest maxResults */ - maxResults?: (number|null); - - /** SqlBackupRunsListRequest pageToken */ - pageToken?: (string|null); - - /** SqlBackupRunsListRequest project */ - project?: (string|null); - } - - /** Represents a SqlBackupRunsListRequest. */ - class SqlBackupRunsListRequest implements ISqlBackupRunsListRequest { - - /** - * Constructs a new SqlBackupRunsListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlBackupRunsListRequest); - - /** SqlBackupRunsListRequest instance. */ - public instance: string; - - /** SqlBackupRunsListRequest maxResults. */ - public maxResults: number; - - /** SqlBackupRunsListRequest pageToken. */ - public pageToken: string; - - /** SqlBackupRunsListRequest project. */ - public project: string; - - /** - * Creates a new SqlBackupRunsListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBackupRunsListRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlBackupRunsListRequest): google.cloud.sql.v1.SqlBackupRunsListRequest; - - /** - * Encodes the specified SqlBackupRunsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsListRequest.verify|verify} messages. - * @param message SqlBackupRunsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlBackupRunsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBackupRunsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsListRequest.verify|verify} messages. - * @param message SqlBackupRunsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlBackupRunsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBackupRunsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlBackupRunsListRequest; - - /** - * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBackupRunsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlBackupRunsListRequest; - - /** - * Verifies a SqlBackupRunsListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBackupRunsListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBackupRunsListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlBackupRunsListRequest; - - /** - * Creates a plain object from a SqlBackupRunsListRequest message. Also converts values to other types if specified. - * @param message SqlBackupRunsListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlBackupRunsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBackupRunsListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBackupRunsListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BackupRun. */ - interface IBackupRun { - - /** BackupRun kind */ - kind?: (string|null); - - /** BackupRun status */ - status?: (google.cloud.sql.v1.SqlBackupRunStatus|keyof typeof google.cloud.sql.v1.SqlBackupRunStatus|null); - - /** BackupRun enqueuedTime */ - enqueuedTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun id */ - id?: (number|Long|string|null); - - /** BackupRun startTime */ - startTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun endTime */ - endTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun error */ - error?: (google.cloud.sql.v1.IOperationError|null); - - /** BackupRun type */ - type?: (google.cloud.sql.v1.SqlBackupRunType|keyof typeof google.cloud.sql.v1.SqlBackupRunType|null); - - /** BackupRun description */ - description?: (string|null); - - /** BackupRun windowStartTime */ - windowStartTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun instance */ - instance?: (string|null); - - /** BackupRun selfLink */ - selfLink?: (string|null); - - /** BackupRun location */ - location?: (string|null); - - /** BackupRun databaseVersion */ - databaseVersion?: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion|null); - - /** BackupRun diskEncryptionConfiguration */ - diskEncryptionConfiguration?: (google.cloud.sql.v1.IDiskEncryptionConfiguration|null); - - /** BackupRun diskEncryptionStatus */ - diskEncryptionStatus?: (google.cloud.sql.v1.IDiskEncryptionStatus|null); - - /** BackupRun backupKind */ - backupKind?: (google.cloud.sql.v1.SqlBackupKind|keyof typeof google.cloud.sql.v1.SqlBackupKind|null); - - /** BackupRun timeZone */ - timeZone?: (string|null); - - /** BackupRun maxChargeableBytes */ - maxChargeableBytes?: (number|Long|string|null); - } - - /** Represents a BackupRun. */ - class BackupRun implements IBackupRun { - - /** - * Constructs a new BackupRun. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IBackupRun); - - /** BackupRun kind. */ - public kind: string; - - /** BackupRun status. */ - public status: (google.cloud.sql.v1.SqlBackupRunStatus|keyof typeof google.cloud.sql.v1.SqlBackupRunStatus); - - /** BackupRun enqueuedTime. */ - public enqueuedTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun id. */ - public id: (number|Long|string); - - /** BackupRun startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun error. */ - public error?: (google.cloud.sql.v1.IOperationError|null); - - /** BackupRun type. */ - public type: (google.cloud.sql.v1.SqlBackupRunType|keyof typeof google.cloud.sql.v1.SqlBackupRunType); - - /** BackupRun description. */ - public description: string; - - /** BackupRun windowStartTime. */ - public windowStartTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun instance. */ - public instance: string; - - /** BackupRun selfLink. */ - public selfLink: string; - - /** BackupRun location. */ - public location: string; - - /** BackupRun databaseVersion. */ - public databaseVersion: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion); - - /** BackupRun diskEncryptionConfiguration. */ - public diskEncryptionConfiguration?: (google.cloud.sql.v1.IDiskEncryptionConfiguration|null); - - /** BackupRun diskEncryptionStatus. */ - public diskEncryptionStatus?: (google.cloud.sql.v1.IDiskEncryptionStatus|null); - - /** BackupRun backupKind. */ - public backupKind: (google.cloud.sql.v1.SqlBackupKind|keyof typeof google.cloud.sql.v1.SqlBackupKind); - - /** BackupRun timeZone. */ - public timeZone: string; - - /** BackupRun maxChargeableBytes. */ - public maxChargeableBytes?: (number|Long|string|null); - - /** - * Creates a new BackupRun instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupRun instance - */ - public static create(properties?: google.cloud.sql.v1.IBackupRun): google.cloud.sql.v1.BackupRun; - - /** - * Encodes the specified BackupRun message. Does not implicitly {@link google.cloud.sql.v1.BackupRun.verify|verify} messages. - * @param message BackupRun message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IBackupRun, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupRun message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRun.verify|verify} messages. - * @param message BackupRun message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IBackupRun, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupRun message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupRun - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupRun; - - /** - * Decodes a BackupRun message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupRun - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupRun; - - /** - * Verifies a BackupRun message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupRun message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupRun - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupRun; - - /** - * Creates a plain object from a BackupRun message. Also converts values to other types if specified. - * @param message BackupRun - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.BackupRun, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupRun to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupRun - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BackupRunsListResponse. */ - interface IBackupRunsListResponse { - - /** BackupRunsListResponse kind */ - kind?: (string|null); - - /** BackupRunsListResponse items */ - items?: (google.cloud.sql.v1.IBackupRun[]|null); - - /** BackupRunsListResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a BackupRunsListResponse. */ - class BackupRunsListResponse implements IBackupRunsListResponse { - - /** - * Constructs a new BackupRunsListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IBackupRunsListResponse); - - /** BackupRunsListResponse kind. */ - public kind: string; - - /** BackupRunsListResponse items. */ - public items: google.cloud.sql.v1.IBackupRun[]; - - /** BackupRunsListResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new BackupRunsListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupRunsListResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IBackupRunsListResponse): google.cloud.sql.v1.BackupRunsListResponse; - - /** - * Encodes the specified BackupRunsListResponse message. Does not implicitly {@link google.cloud.sql.v1.BackupRunsListResponse.verify|verify} messages. - * @param message BackupRunsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IBackupRunsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupRunsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRunsListResponse.verify|verify} messages. - * @param message BackupRunsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IBackupRunsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupRunsListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupRunsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupRunsListResponse; - - /** - * Decodes a BackupRunsListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupRunsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupRunsListResponse; - - /** - * Verifies a BackupRunsListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupRunsListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupRunsListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupRunsListResponse; - - /** - * Creates a plain object from a BackupRunsListResponse message. Also converts values to other types if specified. - * @param message BackupRunsListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.BackupRunsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupRunsListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupRunsListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlBackupRunStatus enum. */ - enum SqlBackupRunStatus { - SQL_BACKUP_RUN_STATUS_UNSPECIFIED = 0, - ENQUEUED = 1, - OVERDUE = 2, - RUNNING = 3, - FAILED = 4, - SUCCESSFUL = 5, - SKIPPED = 6, - DELETION_PENDING = 7, - DELETION_FAILED = 8, - DELETED = 9 - } - - /** SqlBackupKind enum. */ - enum SqlBackupKind { - SQL_BACKUP_KIND_UNSPECIFIED = 0, - SNAPSHOT = 1, - PHYSICAL = 2 - } - - /** SqlBackupRunType enum. */ - enum SqlBackupRunType { - SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0, - AUTOMATED = 1, - ON_DEMAND = 2 - } - - /** Properties of an AclEntry. */ - interface IAclEntry { - - /** AclEntry value */ - value?: (string|null); - - /** AclEntry expirationTime */ - expirationTime?: (google.protobuf.ITimestamp|null); - - /** AclEntry name */ - name?: (string|null); - - /** AclEntry kind */ - kind?: (string|null); - } - - /** Represents an AclEntry. */ - class AclEntry implements IAclEntry { - - /** - * Constructs a new AclEntry. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IAclEntry); - - /** AclEntry value. */ - public value: string; - - /** AclEntry expirationTime. */ - public expirationTime?: (google.protobuf.ITimestamp|null); - - /** AclEntry name. */ - public name: string; - - /** AclEntry kind. */ - public kind: string; - - /** - * Creates a new AclEntry instance using the specified properties. - * @param [properties] Properties to set - * @returns AclEntry instance - */ - public static create(properties?: google.cloud.sql.v1.IAclEntry): google.cloud.sql.v1.AclEntry; - - /** - * Encodes the specified AclEntry message. Does not implicitly {@link google.cloud.sql.v1.AclEntry.verify|verify} messages. - * @param message AclEntry message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IAclEntry, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AclEntry message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AclEntry.verify|verify} messages. - * @param message AclEntry message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IAclEntry, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AclEntry message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AclEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.AclEntry; - - /** - * Decodes an AclEntry message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AclEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.AclEntry; - - /** - * Verifies an AclEntry message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an AclEntry message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AclEntry - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.AclEntry; - - /** - * Creates a plain object from an AclEntry message. Also converts values to other types if specified. - * @param message AclEntry - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.AclEntry, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AclEntry to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AclEntry - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ApiWarning. */ - interface IApiWarning { - - /** ApiWarning code */ - code?: (google.cloud.sql.v1.ApiWarning.SqlApiWarningCode|keyof typeof google.cloud.sql.v1.ApiWarning.SqlApiWarningCode|null); - - /** ApiWarning message */ - message?: (string|null); - - /** ApiWarning region */ - region?: (string|null); - } - - /** Represents an ApiWarning. */ - class ApiWarning implements IApiWarning { - - /** - * Constructs a new ApiWarning. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IApiWarning); - - /** ApiWarning code. */ - public code: (google.cloud.sql.v1.ApiWarning.SqlApiWarningCode|keyof typeof google.cloud.sql.v1.ApiWarning.SqlApiWarningCode); - - /** ApiWarning message. */ - public message: string; - - /** ApiWarning region. */ - public region: string; - - /** - * Creates a new ApiWarning instance using the specified properties. - * @param [properties] Properties to set - * @returns ApiWarning instance - */ - public static create(properties?: google.cloud.sql.v1.IApiWarning): google.cloud.sql.v1.ApiWarning; - - /** - * Encodes the specified ApiWarning message. Does not implicitly {@link google.cloud.sql.v1.ApiWarning.verify|verify} messages. - * @param message ApiWarning message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IApiWarning, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ApiWarning message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ApiWarning.verify|verify} messages. - * @param message ApiWarning message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IApiWarning, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ApiWarning message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ApiWarning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ApiWarning; - - /** - * Decodes an ApiWarning message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ApiWarning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ApiWarning; - - /** - * Verifies an ApiWarning message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ApiWarning message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ApiWarning - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ApiWarning; - - /** - * Creates a plain object from an ApiWarning message. Also converts values to other types if specified. - * @param message ApiWarning - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ApiWarning, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ApiWarning to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ApiWarning - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ApiWarning { - - /** SqlApiWarningCode enum. */ - enum SqlApiWarningCode { - SQL_API_WARNING_CODE_UNSPECIFIED = 0, - REGION_UNREACHABLE = 1, - MAX_RESULTS_EXCEEDS_LIMIT = 2, - COMPROMISED_CREDENTIALS = 3, - INTERNAL_STATE_FAILURE = 4 - } - } - - /** Properties of a BackupRetentionSettings. */ - interface IBackupRetentionSettings { - - /** BackupRetentionSettings retentionUnit */ - retentionUnit?: (google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit|keyof typeof google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit|null); - - /** BackupRetentionSettings retainedBackups */ - retainedBackups?: (google.protobuf.IInt32Value|null); - } - - /** Represents a BackupRetentionSettings. */ - class BackupRetentionSettings implements IBackupRetentionSettings { - - /** - * Constructs a new BackupRetentionSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IBackupRetentionSettings); - - /** BackupRetentionSettings retentionUnit. */ - public retentionUnit: (google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit|keyof typeof google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit); - - /** BackupRetentionSettings retainedBackups. */ - public retainedBackups?: (google.protobuf.IInt32Value|null); - - /** - * Creates a new BackupRetentionSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupRetentionSettings instance - */ - public static create(properties?: google.cloud.sql.v1.IBackupRetentionSettings): google.cloud.sql.v1.BackupRetentionSettings; - - /** - * Encodes the specified BackupRetentionSettings message. Does not implicitly {@link google.cloud.sql.v1.BackupRetentionSettings.verify|verify} messages. - * @param message BackupRetentionSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IBackupRetentionSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupRetentionSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRetentionSettings.verify|verify} messages. - * @param message BackupRetentionSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IBackupRetentionSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupRetentionSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupRetentionSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupRetentionSettings; - - /** - * Decodes a BackupRetentionSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupRetentionSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupRetentionSettings; - - /** - * Verifies a BackupRetentionSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupRetentionSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupRetentionSettings - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupRetentionSettings; - - /** - * Creates a plain object from a BackupRetentionSettings message. Also converts values to other types if specified. - * @param message BackupRetentionSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.BackupRetentionSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupRetentionSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupRetentionSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace BackupRetentionSettings { - - /** RetentionUnit enum. */ - enum RetentionUnit { - RETENTION_UNIT_UNSPECIFIED = 0, - COUNT = 1 - } - } - - /** Properties of a BackupConfiguration. */ - interface IBackupConfiguration { - - /** BackupConfiguration startTime */ - startTime?: (string|null); - - /** BackupConfiguration enabled */ - enabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration kind */ - kind?: (string|null); - - /** BackupConfiguration binaryLogEnabled */ - binaryLogEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration replicationLogArchivingEnabled */ - replicationLogArchivingEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration location */ - location?: (string|null); - - /** BackupConfiguration pointInTimeRecoveryEnabled */ - pointInTimeRecoveryEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration backupRetentionSettings */ - backupRetentionSettings?: (google.cloud.sql.v1.IBackupRetentionSettings|null); - - /** BackupConfiguration transactionLogRetentionDays */ - transactionLogRetentionDays?: (google.protobuf.IInt32Value|null); - - /** BackupConfiguration transactionalLogStorageState */ - transactionalLogStorageState?: (google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|keyof typeof google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|null); - - /** BackupConfiguration backupTier */ - backupTier?: (google.cloud.sql.v1.BackupConfiguration.BackupTier|keyof typeof google.cloud.sql.v1.BackupConfiguration.BackupTier|null); - } - - /** Represents a BackupConfiguration. */ - class BackupConfiguration implements IBackupConfiguration { - - /** - * Constructs a new BackupConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IBackupConfiguration); - - /** BackupConfiguration startTime. */ - public startTime: string; - - /** BackupConfiguration enabled. */ - public enabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration kind. */ - public kind: string; - - /** BackupConfiguration binaryLogEnabled. */ - public binaryLogEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration replicationLogArchivingEnabled. */ - public replicationLogArchivingEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration location. */ - public location: string; - - /** BackupConfiguration pointInTimeRecoveryEnabled. */ - public pointInTimeRecoveryEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration backupRetentionSettings. */ - public backupRetentionSettings?: (google.cloud.sql.v1.IBackupRetentionSettings|null); - - /** BackupConfiguration transactionLogRetentionDays. */ - public transactionLogRetentionDays?: (google.protobuf.IInt32Value|null); - - /** BackupConfiguration transactionalLogStorageState. */ - public transactionalLogStorageState?: (google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|keyof typeof google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|null); - - /** BackupConfiguration backupTier. */ - public backupTier?: (google.cloud.sql.v1.BackupConfiguration.BackupTier|keyof typeof google.cloud.sql.v1.BackupConfiguration.BackupTier|null); - - /** - * Creates a new BackupConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1.IBackupConfiguration): google.cloud.sql.v1.BackupConfiguration; - - /** - * Encodes the specified BackupConfiguration message. Does not implicitly {@link google.cloud.sql.v1.BackupConfiguration.verify|verify} messages. - * @param message BackupConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IBackupConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupConfiguration.verify|verify} messages. - * @param message BackupConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IBackupConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupConfiguration; - - /** - * Decodes a BackupConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupConfiguration; - - /** - * Verifies a BackupConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupConfiguration; - - /** - * Creates a plain object from a BackupConfiguration message. Also converts values to other types if specified. - * @param message BackupConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.BackupConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace BackupConfiguration { - - /** TransactionalLogStorageState enum. */ - enum TransactionalLogStorageState { - TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED = 0, - DISK = 1, - SWITCHING_TO_CLOUD_STORAGE = 2, - SWITCHED_TO_CLOUD_STORAGE = 3, - CLOUD_STORAGE = 4 - } - - /** BackupTier enum. */ - enum BackupTier { - BACKUP_TIER_UNSPECIFIED = 0, - STANDARD = 1, - ADVANCED = 2, - ENHANCED = 3 - } - } - - /** Properties of a PerformDiskShrinkContext. */ - interface IPerformDiskShrinkContext { - - /** PerformDiskShrinkContext targetSizeGb */ - targetSizeGb?: (number|Long|string|null); - } - - /** Represents a PerformDiskShrinkContext. */ - class PerformDiskShrinkContext implements IPerformDiskShrinkContext { - - /** - * Constructs a new PerformDiskShrinkContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IPerformDiskShrinkContext); - - /** PerformDiskShrinkContext targetSizeGb. */ - public targetSizeGb: (number|Long|string); - - /** - * Creates a new PerformDiskShrinkContext instance using the specified properties. - * @param [properties] Properties to set - * @returns PerformDiskShrinkContext instance - */ - public static create(properties?: google.cloud.sql.v1.IPerformDiskShrinkContext): google.cloud.sql.v1.PerformDiskShrinkContext; - - /** - * Encodes the specified PerformDiskShrinkContext message. Does not implicitly {@link google.cloud.sql.v1.PerformDiskShrinkContext.verify|verify} messages. - * @param message PerformDiskShrinkContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IPerformDiskShrinkContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PerformDiskShrinkContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PerformDiskShrinkContext.verify|verify} messages. - * @param message PerformDiskShrinkContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IPerformDiskShrinkContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PerformDiskShrinkContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PerformDiskShrinkContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PerformDiskShrinkContext; - - /** - * Decodes a PerformDiskShrinkContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PerformDiskShrinkContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PerformDiskShrinkContext; - - /** - * Verifies a PerformDiskShrinkContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PerformDiskShrinkContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PerformDiskShrinkContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PerformDiskShrinkContext; - - /** - * Creates a plain object from a PerformDiskShrinkContext message. Also converts values to other types if specified. - * @param message PerformDiskShrinkContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.PerformDiskShrinkContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PerformDiskShrinkContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PerformDiskShrinkContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PreCheckResponse. */ - interface IPreCheckResponse { - - /** PreCheckResponse message */ - message?: (string|null); - - /** PreCheckResponse messageType */ - messageType?: (google.cloud.sql.v1.PreCheckResponse.MessageType|keyof typeof google.cloud.sql.v1.PreCheckResponse.MessageType|null); - - /** PreCheckResponse actionsRequired */ - actionsRequired?: (string[]|null); - } - - /** Represents a PreCheckResponse. */ - class PreCheckResponse implements IPreCheckResponse { - - /** - * Constructs a new PreCheckResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IPreCheckResponse); - - /** PreCheckResponse message. */ - public message?: (string|null); - - /** PreCheckResponse messageType. */ - public messageType?: (google.cloud.sql.v1.PreCheckResponse.MessageType|keyof typeof google.cloud.sql.v1.PreCheckResponse.MessageType|null); - - /** PreCheckResponse actionsRequired. */ - public actionsRequired: string[]; - - /** - * Creates a new PreCheckResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns PreCheckResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IPreCheckResponse): google.cloud.sql.v1.PreCheckResponse; - - /** - * Encodes the specified PreCheckResponse message. Does not implicitly {@link google.cloud.sql.v1.PreCheckResponse.verify|verify} messages. - * @param message PreCheckResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IPreCheckResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PreCheckResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PreCheckResponse.verify|verify} messages. - * @param message PreCheckResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IPreCheckResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PreCheckResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PreCheckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PreCheckResponse; - - /** - * Decodes a PreCheckResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PreCheckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PreCheckResponse; - - /** - * Verifies a PreCheckResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PreCheckResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PreCheckResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PreCheckResponse; - - /** - * Creates a plain object from a PreCheckResponse message. Also converts values to other types if specified. - * @param message PreCheckResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.PreCheckResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PreCheckResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PreCheckResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace PreCheckResponse { - - /** MessageType enum. */ - enum MessageType { - MESSAGE_TYPE_UNSPECIFIED = 0, - INFO = 1, - WARNING = 2, - ERROR = 3 - } - } - - /** Properties of a PreCheckMajorVersionUpgradeContext. */ - interface IPreCheckMajorVersionUpgradeContext { - - /** PreCheckMajorVersionUpgradeContext targetDatabaseVersion */ - targetDatabaseVersion?: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion|null); - - /** PreCheckMajorVersionUpgradeContext preCheckResponse */ - preCheckResponse?: (google.cloud.sql.v1.IPreCheckResponse[]|null); - - /** PreCheckMajorVersionUpgradeContext kind */ - kind?: (string|null); - } - - /** Represents a PreCheckMajorVersionUpgradeContext. */ - class PreCheckMajorVersionUpgradeContext implements IPreCheckMajorVersionUpgradeContext { - - /** - * Constructs a new PreCheckMajorVersionUpgradeContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext); - - /** PreCheckMajorVersionUpgradeContext targetDatabaseVersion. */ - public targetDatabaseVersion: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion); - - /** PreCheckMajorVersionUpgradeContext preCheckResponse. */ - public preCheckResponse: google.cloud.sql.v1.IPreCheckResponse[]; - - /** PreCheckMajorVersionUpgradeContext kind. */ - public kind: string; - - /** - * Creates a new PreCheckMajorVersionUpgradeContext instance using the specified properties. - * @param [properties] Properties to set - * @returns PreCheckMajorVersionUpgradeContext instance - */ - public static create(properties?: google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext): google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext; - - /** - * Encodes the specified PreCheckMajorVersionUpgradeContext message. Does not implicitly {@link google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify|verify} messages. - * @param message PreCheckMajorVersionUpgradeContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PreCheckMajorVersionUpgradeContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify|verify} messages. - * @param message PreCheckMajorVersionUpgradeContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PreCheckMajorVersionUpgradeContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext; - - /** - * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PreCheckMajorVersionUpgradeContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext; - - /** - * Verifies a PreCheckMajorVersionUpgradeContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PreCheckMajorVersionUpgradeContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PreCheckMajorVersionUpgradeContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext; - - /** - * Creates a plain object from a PreCheckMajorVersionUpgradeContext message. Also converts values to other types if specified. - * @param message PreCheckMajorVersionUpgradeContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PreCheckMajorVersionUpgradeContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PreCheckMajorVersionUpgradeContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BackupContext. */ - interface IBackupContext { - - /** BackupContext backupId */ - backupId?: (number|Long|string|null); - - /** BackupContext kind */ - kind?: (string|null); - - /** BackupContext name */ - name?: (string|null); - } - - /** Represents a BackupContext. */ - class BackupContext implements IBackupContext { - - /** - * Constructs a new BackupContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IBackupContext); - - /** BackupContext backupId. */ - public backupId: (number|Long|string); - - /** BackupContext kind. */ - public kind: string; - - /** BackupContext name. */ - public name: string; - - /** - * Creates a new BackupContext instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupContext instance - */ - public static create(properties?: google.cloud.sql.v1.IBackupContext): google.cloud.sql.v1.BackupContext; - - /** - * Encodes the specified BackupContext message. Does not implicitly {@link google.cloud.sql.v1.BackupContext.verify|verify} messages. - * @param message BackupContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupContext.verify|verify} messages. - * @param message BackupContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupContext; - - /** - * Decodes a BackupContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupContext; - - /** - * Verifies a BackupContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupContext; - - /** - * Creates a plain object from a BackupContext message. Also converts values to other types if specified. - * @param message BackupContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.BackupContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Database. */ - interface IDatabase { - - /** Database kind */ - kind?: (string|null); - - /** Database charset */ - charset?: (string|null); - - /** Database collation */ - collation?: (string|null); - - /** Database etag */ - etag?: (string|null); - - /** Database name */ - name?: (string|null); - - /** Database instance */ - instance?: (string|null); - - /** Database selfLink */ - selfLink?: (string|null); - - /** Database project */ - project?: (string|null); - - /** Database sqlserverDatabaseDetails */ - sqlserverDatabaseDetails?: (google.cloud.sql.v1.ISqlServerDatabaseDetails|null); - } - - /** Represents a Database. */ - class Database implements IDatabase { - - /** - * Constructs a new Database. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDatabase); - - /** Database kind. */ - public kind: string; - - /** Database charset. */ - public charset: string; - - /** Database collation. */ - public collation: string; - - /** Database etag. */ - public etag: string; - - /** Database name. */ - public name: string; - - /** Database instance. */ - public instance: string; - - /** Database selfLink. */ - public selfLink: string; - - /** Database project. */ - public project: string; - - /** Database sqlserverDatabaseDetails. */ - public sqlserverDatabaseDetails?: (google.cloud.sql.v1.ISqlServerDatabaseDetails|null); - - /** Database databaseDetails. */ - public databaseDetails?: "sqlserverDatabaseDetails"; - - /** - * Creates a new Database instance using the specified properties. - * @param [properties] Properties to set - * @returns Database instance - */ - public static create(properties?: google.cloud.sql.v1.IDatabase): google.cloud.sql.v1.Database; - - /** - * Encodes the specified Database message. Does not implicitly {@link google.cloud.sql.v1.Database.verify|verify} messages. - * @param message Database message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDatabase, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Database message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Database.verify|verify} messages. - * @param message Database message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDatabase, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Database message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Database - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Database; - - /** - * Decodes a Database message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Database - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Database; - - /** - * Verifies a Database message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Database message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Database - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Database; - - /** - * Creates a plain object from a Database message. Also converts values to other types if specified. - * @param message Database - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.Database, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Database to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Database - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlServerDatabaseDetails. */ - interface ISqlServerDatabaseDetails { - - /** SqlServerDatabaseDetails compatibilityLevel */ - compatibilityLevel?: (number|null); - - /** SqlServerDatabaseDetails recoveryModel */ - recoveryModel?: (string|null); - } - - /** Represents a SqlServerDatabaseDetails. */ - class SqlServerDatabaseDetails implements ISqlServerDatabaseDetails { - - /** - * Constructs a new SqlServerDatabaseDetails. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlServerDatabaseDetails); - - /** SqlServerDatabaseDetails compatibilityLevel. */ - public compatibilityLevel: number; - - /** SqlServerDatabaseDetails recoveryModel. */ - public recoveryModel: string; - - /** - * Creates a new SqlServerDatabaseDetails instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlServerDatabaseDetails instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlServerDatabaseDetails): google.cloud.sql.v1.SqlServerDatabaseDetails; - - /** - * Encodes the specified SqlServerDatabaseDetails message. Does not implicitly {@link google.cloud.sql.v1.SqlServerDatabaseDetails.verify|verify} messages. - * @param message SqlServerDatabaseDetails message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlServerDatabaseDetails, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlServerDatabaseDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerDatabaseDetails.verify|verify} messages. - * @param message SqlServerDatabaseDetails message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlServerDatabaseDetails, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlServerDatabaseDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlServerDatabaseDetails; - - /** - * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlServerDatabaseDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlServerDatabaseDetails; - - /** - * Verifies a SqlServerDatabaseDetails message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlServerDatabaseDetails message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlServerDatabaseDetails - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlServerDatabaseDetails; - - /** - * Creates a plain object from a SqlServerDatabaseDetails message. Also converts values to other types if specified. - * @param message SqlServerDatabaseDetails - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlServerDatabaseDetails, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlServerDatabaseDetails to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlServerDatabaseDetails - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DatabaseFlags. */ - interface IDatabaseFlags { - - /** DatabaseFlags name */ - name?: (string|null); - - /** DatabaseFlags value */ - value?: (string|null); - } - - /** Represents a DatabaseFlags. */ - class DatabaseFlags implements IDatabaseFlags { - - /** - * Constructs a new DatabaseFlags. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDatabaseFlags); - - /** DatabaseFlags name. */ - public name: string; - - /** DatabaseFlags value. */ - public value: string; - - /** - * Creates a new DatabaseFlags instance using the specified properties. - * @param [properties] Properties to set - * @returns DatabaseFlags instance - */ - public static create(properties?: google.cloud.sql.v1.IDatabaseFlags): google.cloud.sql.v1.DatabaseFlags; - - /** - * Encodes the specified DatabaseFlags message. Does not implicitly {@link google.cloud.sql.v1.DatabaseFlags.verify|verify} messages. - * @param message DatabaseFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDatabaseFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DatabaseFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseFlags.verify|verify} messages. - * @param message DatabaseFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDatabaseFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DatabaseFlags message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DatabaseFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseFlags; - - /** - * Decodes a DatabaseFlags message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DatabaseFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseFlags; - - /** - * Verifies a DatabaseFlags message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DatabaseFlags message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DatabaseFlags - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseFlags; - - /** - * Creates a plain object from a DatabaseFlags message. Also converts values to other types if specified. - * @param message DatabaseFlags - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DatabaseFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DatabaseFlags to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DatabaseFlags - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MySqlSyncConfig. */ - interface IMySqlSyncConfig { - - /** MySqlSyncConfig initialSyncFlags */ - initialSyncFlags?: (google.cloud.sql.v1.ISyncFlags[]|null); - } - - /** Represents a MySqlSyncConfig. */ - class MySqlSyncConfig implements IMySqlSyncConfig { - - /** - * Constructs a new MySqlSyncConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IMySqlSyncConfig); - - /** MySqlSyncConfig initialSyncFlags. */ - public initialSyncFlags: google.cloud.sql.v1.ISyncFlags[]; - - /** - * Creates a new MySqlSyncConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns MySqlSyncConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IMySqlSyncConfig): google.cloud.sql.v1.MySqlSyncConfig; - - /** - * Encodes the specified MySqlSyncConfig message. Does not implicitly {@link google.cloud.sql.v1.MySqlSyncConfig.verify|verify} messages. - * @param message MySqlSyncConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IMySqlSyncConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MySqlSyncConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MySqlSyncConfig.verify|verify} messages. - * @param message MySqlSyncConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IMySqlSyncConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MySqlSyncConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MySqlSyncConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.MySqlSyncConfig; - - /** - * Decodes a MySqlSyncConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MySqlSyncConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.MySqlSyncConfig; - - /** - * Verifies a MySqlSyncConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MySqlSyncConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MySqlSyncConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.MySqlSyncConfig; - - /** - * Creates a plain object from a MySqlSyncConfig message. Also converts values to other types if specified. - * @param message MySqlSyncConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.MySqlSyncConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MySqlSyncConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MySqlSyncConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SyncFlags. */ - interface ISyncFlags { - - /** SyncFlags name */ - name?: (string|null); - - /** SyncFlags value */ - value?: (string|null); - } - - /** Represents a SyncFlags. */ - class SyncFlags implements ISyncFlags { - - /** - * Constructs a new SyncFlags. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISyncFlags); - - /** SyncFlags name. */ - public name: string; - - /** SyncFlags value. */ - public value: string; - - /** - * Creates a new SyncFlags instance using the specified properties. - * @param [properties] Properties to set - * @returns SyncFlags instance - */ - public static create(properties?: google.cloud.sql.v1.ISyncFlags): google.cloud.sql.v1.SyncFlags; - - /** - * Encodes the specified SyncFlags message. Does not implicitly {@link google.cloud.sql.v1.SyncFlags.verify|verify} messages. - * @param message SyncFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISyncFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SyncFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SyncFlags.verify|verify} messages. - * @param message SyncFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISyncFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SyncFlags message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SyncFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SyncFlags; - - /** - * Decodes a SyncFlags message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SyncFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SyncFlags; - - /** - * Verifies a SyncFlags message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SyncFlags message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SyncFlags - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SyncFlags; - - /** - * Creates a plain object from a SyncFlags message. Also converts values to other types if specified. - * @param message SyncFlags - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SyncFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SyncFlags to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SyncFlags - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstanceReference. */ - interface IInstanceReference { - - /** InstanceReference name */ - name?: (string|null); - - /** InstanceReference region */ - region?: (string|null); - - /** InstanceReference project */ - project?: (string|null); - } - - /** Represents an InstanceReference. */ - class InstanceReference implements IInstanceReference { - - /** - * Constructs a new InstanceReference. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstanceReference); - - /** InstanceReference name. */ - public name: string; - - /** InstanceReference region. */ - public region: string; - - /** InstanceReference project. */ - public project: string; - - /** - * Creates a new InstanceReference instance using the specified properties. - * @param [properties] Properties to set - * @returns InstanceReference instance - */ - public static create(properties?: google.cloud.sql.v1.IInstanceReference): google.cloud.sql.v1.InstanceReference; - - /** - * Encodes the specified InstanceReference message. Does not implicitly {@link google.cloud.sql.v1.InstanceReference.verify|verify} messages. - * @param message InstanceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstanceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstanceReference message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstanceReference.verify|verify} messages. - * @param message InstanceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstanceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstanceReference message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstanceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstanceReference; - - /** - * Decodes an InstanceReference message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstanceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstanceReference; - - /** - * Verifies an InstanceReference message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstanceReference message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstanceReference - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstanceReference; - - /** - * Creates a plain object from an InstanceReference message. Also converts values to other types if specified. - * @param message InstanceReference - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstanceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstanceReference to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstanceReference - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DemoteMasterConfiguration. */ - interface IDemoteMasterConfiguration { - - /** DemoteMasterConfiguration kind */ - kind?: (string|null); - - /** DemoteMasterConfiguration mysqlReplicaConfiguration */ - mysqlReplicaConfiguration?: (google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration|null); - } - - /** Represents a DemoteMasterConfiguration. */ - class DemoteMasterConfiguration implements IDemoteMasterConfiguration { - - /** - * Constructs a new DemoteMasterConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDemoteMasterConfiguration); - - /** DemoteMasterConfiguration kind. */ - public kind: string; - - /** DemoteMasterConfiguration mysqlReplicaConfiguration. */ - public mysqlReplicaConfiguration?: (google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration|null); - - /** - * Creates a new DemoteMasterConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns DemoteMasterConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1.IDemoteMasterConfiguration): google.cloud.sql.v1.DemoteMasterConfiguration; - - /** - * Encodes the specified DemoteMasterConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterConfiguration.verify|verify} messages. - * @param message DemoteMasterConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDemoteMasterConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DemoteMasterConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterConfiguration.verify|verify} messages. - * @param message DemoteMasterConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDemoteMasterConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DemoteMasterConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DemoteMasterConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DemoteMasterConfiguration; - - /** - * Decodes a DemoteMasterConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DemoteMasterConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DemoteMasterConfiguration; - - /** - * Verifies a DemoteMasterConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DemoteMasterConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DemoteMasterConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DemoteMasterConfiguration; - - /** - * Creates a plain object from a DemoteMasterConfiguration message. Also converts values to other types if specified. - * @param message DemoteMasterConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DemoteMasterConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DemoteMasterConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DemoteMasterConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DemoteMasterMySqlReplicaConfiguration. */ - interface IDemoteMasterMySqlReplicaConfiguration { - - /** DemoteMasterMySqlReplicaConfiguration kind */ - kind?: (string|null); - - /** DemoteMasterMySqlReplicaConfiguration username */ - username?: (string|null); - - /** DemoteMasterMySqlReplicaConfiguration password */ - password?: (string|null); - - /** DemoteMasterMySqlReplicaConfiguration clientKey */ - clientKey?: (string|null); - - /** DemoteMasterMySqlReplicaConfiguration clientCertificate */ - clientCertificate?: (string|null); - - /** DemoteMasterMySqlReplicaConfiguration caCertificate */ - caCertificate?: (string|null); - } - - /** Represents a DemoteMasterMySqlReplicaConfiguration. */ - class DemoteMasterMySqlReplicaConfiguration implements IDemoteMasterMySqlReplicaConfiguration { - - /** - * Constructs a new DemoteMasterMySqlReplicaConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration); - - /** DemoteMasterMySqlReplicaConfiguration kind. */ - public kind: string; - - /** DemoteMasterMySqlReplicaConfiguration username. */ - public username: string; - - /** DemoteMasterMySqlReplicaConfiguration password. */ - public password: string; - - /** DemoteMasterMySqlReplicaConfiguration clientKey. */ - public clientKey: string; - - /** DemoteMasterMySqlReplicaConfiguration clientCertificate. */ - public clientCertificate: string; - - /** DemoteMasterMySqlReplicaConfiguration caCertificate. */ - public caCertificate: string; - - /** - * Creates a new DemoteMasterMySqlReplicaConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns DemoteMasterMySqlReplicaConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration): google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration; - - /** - * Encodes the specified DemoteMasterMySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. - * @param message DemoteMasterMySqlReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DemoteMasterMySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. - * @param message DemoteMasterMySqlReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DemoteMasterMySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration; - - /** - * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DemoteMasterMySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration; - - /** - * Verifies a DemoteMasterMySqlReplicaConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DemoteMasterMySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DemoteMasterMySqlReplicaConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration; - - /** - * Creates a plain object from a DemoteMasterMySqlReplicaConfiguration message. Also converts values to other types if specified. - * @param message DemoteMasterMySqlReplicaConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DemoteMasterMySqlReplicaConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DemoteMasterMySqlReplicaConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlFileType enum. */ - enum SqlFileType { - SQL_FILE_TYPE_UNSPECIFIED = 0, - SQL = 1, - CSV = 2, - BAK = 4, - TDE = 8 - } - - /** Properties of an ExportContext. */ - interface IExportContext { - - /** ExportContext uri */ - uri?: (string|null); - - /** ExportContext databases */ - databases?: (string[]|null); - - /** ExportContext kind */ - kind?: (string|null); - - /** ExportContext sqlExportOptions */ - sqlExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlExportOptions|null); - - /** ExportContext csvExportOptions */ - csvExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions|null); - - /** ExportContext fileType */ - fileType?: (google.cloud.sql.v1.SqlFileType|keyof typeof google.cloud.sql.v1.SqlFileType|null); - - /** ExportContext offload */ - offload?: (google.protobuf.IBoolValue|null); - - /** ExportContext bakExportOptions */ - bakExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlBakExportOptions|null); - - /** ExportContext tdeExportOptions */ - tdeExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions|null); - } - - /** Represents an ExportContext. */ - class ExportContext implements IExportContext { - - /** - * Constructs a new ExportContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IExportContext); - - /** ExportContext uri. */ - public uri: string; - - /** ExportContext databases. */ - public databases: string[]; - - /** ExportContext kind. */ - public kind: string; - - /** ExportContext sqlExportOptions. */ - public sqlExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlExportOptions|null); - - /** ExportContext csvExportOptions. */ - public csvExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions|null); - - /** ExportContext fileType. */ - public fileType: (google.cloud.sql.v1.SqlFileType|keyof typeof google.cloud.sql.v1.SqlFileType); - - /** ExportContext offload. */ - public offload?: (google.protobuf.IBoolValue|null); - - /** ExportContext bakExportOptions. */ - public bakExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlBakExportOptions|null); - - /** ExportContext tdeExportOptions. */ - public tdeExportOptions?: (google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions|null); - - /** - * Creates a new ExportContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportContext instance - */ - public static create(properties?: google.cloud.sql.v1.IExportContext): google.cloud.sql.v1.ExportContext; - - /** - * Encodes the specified ExportContext message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.verify|verify} messages. - * @param message ExportContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IExportContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.verify|verify} messages. - * @param message ExportContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IExportContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext; - - /** - * Decodes an ExportContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext; - - /** - * Verifies an ExportContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ExportContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext; - - /** - * Creates a plain object from an ExportContext message. Also converts values to other types if specified. - * @param message ExportContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ExportContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ExportContext { - - /** Properties of a SqlCsvExportOptions. */ - interface ISqlCsvExportOptions { - - /** SqlCsvExportOptions selectQuery */ - selectQuery?: (string|null); - - /** SqlCsvExportOptions escapeCharacter */ - escapeCharacter?: (string|null); - - /** SqlCsvExportOptions quoteCharacter */ - quoteCharacter?: (string|null); - - /** SqlCsvExportOptions fieldsTerminatedBy */ - fieldsTerminatedBy?: (string|null); - - /** SqlCsvExportOptions linesTerminatedBy */ - linesTerminatedBy?: (string|null); - } - - /** Represents a SqlCsvExportOptions. */ - class SqlCsvExportOptions implements ISqlCsvExportOptions { - - /** - * Constructs a new SqlCsvExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions); - - /** SqlCsvExportOptions selectQuery. */ - public selectQuery: string; - - /** SqlCsvExportOptions escapeCharacter. */ - public escapeCharacter: string; - - /** SqlCsvExportOptions quoteCharacter. */ - public quoteCharacter: string; - - /** SqlCsvExportOptions fieldsTerminatedBy. */ - public fieldsTerminatedBy: string; - - /** SqlCsvExportOptions linesTerminatedBy. */ - public linesTerminatedBy: string; - - /** - * Creates a new SqlCsvExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlCsvExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions): google.cloud.sql.v1.ExportContext.SqlCsvExportOptions; - - /** - * Encodes the specified SqlCsvExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.verify|verify} messages. - * @param message SqlCsvExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlCsvExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.verify|verify} messages. - * @param message SqlCsvExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlCsvExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlCsvExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlCsvExportOptions; - - /** - * Decodes a SqlCsvExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlCsvExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlCsvExportOptions; - - /** - * Verifies a SqlCsvExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlCsvExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlCsvExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlCsvExportOptions; - - /** - * Creates a plain object from a SqlCsvExportOptions message. Also converts values to other types if specified. - * @param message SqlCsvExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ExportContext.SqlCsvExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlCsvExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlCsvExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlExportOptions. */ - interface ISqlExportOptions { - - /** SqlExportOptions tables */ - tables?: (string[]|null); - - /** SqlExportOptions schemaOnly */ - schemaOnly?: (google.protobuf.IBoolValue|null); - - /** SqlExportOptions mysqlExportOptions */ - mysqlExportOptions?: (google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions|null); - - /** SqlExportOptions threads */ - threads?: (google.protobuf.IInt32Value|null); - - /** SqlExportOptions parallel */ - parallel?: (google.protobuf.IBoolValue|null); - - /** SqlExportOptions postgresExportOptions */ - postgresExportOptions?: (google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions|null); - } - - /** Represents a SqlExportOptions. */ - class SqlExportOptions implements ISqlExportOptions { - - /** - * Constructs a new SqlExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ExportContext.ISqlExportOptions); - - /** SqlExportOptions tables. */ - public tables: string[]; - - /** SqlExportOptions schemaOnly. */ - public schemaOnly?: (google.protobuf.IBoolValue|null); - - /** SqlExportOptions mysqlExportOptions. */ - public mysqlExportOptions?: (google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions|null); - - /** SqlExportOptions threads. */ - public threads?: (google.protobuf.IInt32Value|null); - - /** SqlExportOptions parallel. */ - public parallel?: (google.protobuf.IBoolValue|null); - - /** SqlExportOptions postgresExportOptions. */ - public postgresExportOptions?: (google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions|null); - - /** - * Creates a new SqlExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ExportContext.ISqlExportOptions): google.cloud.sql.v1.ExportContext.SqlExportOptions; - - /** - * Encodes the specified SqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.verify|verify} messages. - * @param message SqlExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ExportContext.ISqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.verify|verify} messages. - * @param message SqlExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.ISqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlExportOptions; - - /** - * Decodes a SqlExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlExportOptions; - - /** - * Verifies a SqlExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlExportOptions; - - /** - * Creates a plain object from a SqlExportOptions message. Also converts values to other types if specified. - * @param message SqlExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ExportContext.SqlExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlExportOptions { - - /** Properties of a MysqlExportOptions. */ - interface IMysqlExportOptions { - - /** MysqlExportOptions masterData */ - masterData?: (google.protobuf.IInt32Value|null); - } - - /** Represents a MysqlExportOptions. */ - class MysqlExportOptions implements IMysqlExportOptions { - - /** - * Constructs a new MysqlExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions); - - /** MysqlExportOptions masterData. */ - public masterData?: (google.protobuf.IInt32Value|null); - - /** - * Creates a new MysqlExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns MysqlExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions): google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions; - - /** - * Encodes the specified MysqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. - * @param message MysqlExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MysqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. - * @param message MysqlExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MysqlExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MysqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions; - - /** - * Decodes a MysqlExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MysqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions; - - /** - * Verifies a MysqlExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MysqlExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MysqlExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions; - - /** - * Creates a plain object from a MysqlExportOptions message. Also converts values to other types if specified. - * @param message MysqlExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MysqlExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MysqlExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PostgresExportOptions. */ - interface IPostgresExportOptions { - - /** PostgresExportOptions clean */ - clean?: (google.protobuf.IBoolValue|null); - - /** PostgresExportOptions ifExists */ - ifExists?: (google.protobuf.IBoolValue|null); - } - - /** Represents a PostgresExportOptions. */ - class PostgresExportOptions implements IPostgresExportOptions { - - /** - * Constructs a new PostgresExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions); - - /** PostgresExportOptions clean. */ - public clean?: (google.protobuf.IBoolValue|null); - - /** PostgresExportOptions ifExists. */ - public ifExists?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new PostgresExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns PostgresExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions): google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions; - - /** - * Encodes the specified PostgresExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. - * @param message PostgresExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PostgresExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. - * @param message PostgresExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PostgresExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PostgresExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions; - - /** - * Decodes a PostgresExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PostgresExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions; - - /** - * Verifies a PostgresExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PostgresExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PostgresExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions; - - /** - * Creates a plain object from a PostgresExportOptions message. Also converts values to other types if specified. - * @param message PostgresExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PostgresExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PostgresExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a SqlBakExportOptions. */ - interface ISqlBakExportOptions { - - /** SqlBakExportOptions striped */ - striped?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions stripeCount */ - stripeCount?: (google.protobuf.IInt32Value|null); - - /** SqlBakExportOptions bakType */ - bakType?: (google.cloud.sql.v1.BakType|keyof typeof google.cloud.sql.v1.BakType|null); - - /** SqlBakExportOptions copyOnly */ - copyOnly?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions differentialBase */ - differentialBase?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions exportLogStartTime */ - exportLogStartTime?: (google.protobuf.ITimestamp|null); - - /** SqlBakExportOptions exportLogEndTime */ - exportLogEndTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a SqlBakExportOptions. */ - class SqlBakExportOptions implements ISqlBakExportOptions { - - /** - * Constructs a new SqlBakExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ExportContext.ISqlBakExportOptions); - - /** SqlBakExportOptions striped. */ - public striped?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions stripeCount. */ - public stripeCount?: (google.protobuf.IInt32Value|null); - - /** SqlBakExportOptions bakType. */ - public bakType: (google.cloud.sql.v1.BakType|keyof typeof google.cloud.sql.v1.BakType); - - /** SqlBakExportOptions copyOnly. */ - public copyOnly?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions differentialBase. */ - public differentialBase?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions exportLogStartTime. */ - public exportLogStartTime?: (google.protobuf.ITimestamp|null); - - /** SqlBakExportOptions exportLogEndTime. */ - public exportLogEndTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new SqlBakExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBakExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ExportContext.ISqlBakExportOptions): google.cloud.sql.v1.ExportContext.SqlBakExportOptions; - - /** - * Encodes the specified SqlBakExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlBakExportOptions.verify|verify} messages. - * @param message SqlBakExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ExportContext.ISqlBakExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBakExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlBakExportOptions.verify|verify} messages. - * @param message SqlBakExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.ISqlBakExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBakExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBakExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlBakExportOptions; - - /** - * Decodes a SqlBakExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBakExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlBakExportOptions; - - /** - * Verifies a SqlBakExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBakExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBakExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlBakExportOptions; - - /** - * Creates a plain object from a SqlBakExportOptions message. Also converts values to other types if specified. - * @param message SqlBakExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ExportContext.SqlBakExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBakExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBakExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlTdeExportOptions. */ - interface ISqlTdeExportOptions { - - /** SqlTdeExportOptions certificatePath */ - certificatePath?: (string|null); - - /** SqlTdeExportOptions privateKeyPath */ - privateKeyPath?: (string|null); - - /** SqlTdeExportOptions privateKeyPassword */ - privateKeyPassword?: (string|null); - - /** SqlTdeExportOptions name */ - name?: (string|null); - } - - /** Represents a SqlTdeExportOptions. */ - class SqlTdeExportOptions implements ISqlTdeExportOptions { - - /** - * Constructs a new SqlTdeExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions); - - /** SqlTdeExportOptions certificatePath. */ - public certificatePath: string; - - /** SqlTdeExportOptions privateKeyPath. */ - public privateKeyPath: string; - - /** SqlTdeExportOptions privateKeyPassword. */ - public privateKeyPassword: string; - - /** SqlTdeExportOptions name. */ - public name: string; - - /** - * Creates a new SqlTdeExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlTdeExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions): google.cloud.sql.v1.ExportContext.SqlTdeExportOptions; - - /** - * Encodes the specified SqlTdeExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.verify|verify} messages. - * @param message SqlTdeExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlTdeExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.verify|verify} messages. - * @param message SqlTdeExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlTdeExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlTdeExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExportContext.SqlTdeExportOptions; - - /** - * Decodes a SqlTdeExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlTdeExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExportContext.SqlTdeExportOptions; - - /** - * Verifies a SqlTdeExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlTdeExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlTdeExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExportContext.SqlTdeExportOptions; - - /** - * Creates a plain object from a SqlTdeExportOptions message. Also converts values to other types if specified. - * @param message SqlTdeExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ExportContext.SqlTdeExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlTdeExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlTdeExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of an ImportContext. */ - interface IImportContext { - - /** ImportContext uri */ - uri?: (string|null); - - /** ImportContext database */ - database?: (string|null); - - /** ImportContext kind */ - kind?: (string|null); - - /** ImportContext fileType */ - fileType?: (google.cloud.sql.v1.SqlFileType|keyof typeof google.cloud.sql.v1.SqlFileType|null); - - /** ImportContext csvImportOptions */ - csvImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions|null); - - /** ImportContext importUser */ - importUser?: (string|null); - - /** ImportContext bakImportOptions */ - bakImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlBakImportOptions|null); - - /** ImportContext sqlImportOptions */ - sqlImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlImportOptions|null); - - /** ImportContext tdeImportOptions */ - tdeImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions|null); - } - - /** Represents an ImportContext. */ - class ImportContext implements IImportContext { - - /** - * Constructs a new ImportContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IImportContext); - - /** ImportContext uri. */ - public uri: string; - - /** ImportContext database. */ - public database: string; - - /** ImportContext kind. */ - public kind: string; - - /** ImportContext fileType. */ - public fileType: (google.cloud.sql.v1.SqlFileType|keyof typeof google.cloud.sql.v1.SqlFileType); - - /** ImportContext csvImportOptions. */ - public csvImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions|null); - - /** ImportContext importUser. */ - public importUser: string; - - /** ImportContext bakImportOptions. */ - public bakImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlBakImportOptions|null); - - /** ImportContext sqlImportOptions. */ - public sqlImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlImportOptions|null); - - /** ImportContext tdeImportOptions. */ - public tdeImportOptions?: (google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions|null); - - /** - * Creates a new ImportContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportContext instance - */ - public static create(properties?: google.cloud.sql.v1.IImportContext): google.cloud.sql.v1.ImportContext; - - /** - * Encodes the specified ImportContext message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.verify|verify} messages. - * @param message ImportContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IImportContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.verify|verify} messages. - * @param message ImportContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IImportContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext; - - /** - * Decodes an ImportContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext; - - /** - * Verifies an ImportContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ImportContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext; - - /** - * Creates a plain object from an ImportContext message. Also converts values to other types if specified. - * @param message ImportContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ImportContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ImportContext { - - /** Properties of a SqlImportOptions. */ - interface ISqlImportOptions { - - /** SqlImportOptions threads */ - threads?: (google.protobuf.IInt32Value|null); - - /** SqlImportOptions parallel */ - parallel?: (google.protobuf.IBoolValue|null); - - /** SqlImportOptions postgresImportOptions */ - postgresImportOptions?: (google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions|null); - } - - /** Represents a SqlImportOptions. */ - class SqlImportOptions implements ISqlImportOptions { - - /** - * Constructs a new SqlImportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ImportContext.ISqlImportOptions); - - /** SqlImportOptions threads. */ - public threads?: (google.protobuf.IInt32Value|null); - - /** SqlImportOptions parallel. */ - public parallel?: (google.protobuf.IBoolValue|null); - - /** SqlImportOptions postgresImportOptions. */ - public postgresImportOptions?: (google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions|null); - - /** - * Creates a new SqlImportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlImportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ImportContext.ISqlImportOptions): google.cloud.sql.v1.ImportContext.SqlImportOptions; - - /** - * Encodes the specified SqlImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.verify|verify} messages. - * @param message SqlImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ImportContext.ISqlImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.verify|verify} messages. - * @param message SqlImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.ISqlImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlImportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlImportOptions; - - /** - * Decodes a SqlImportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlImportOptions; - - /** - * Verifies a SqlImportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlImportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlImportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlImportOptions; - - /** - * Creates a plain object from a SqlImportOptions message. Also converts values to other types if specified. - * @param message SqlImportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ImportContext.SqlImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlImportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlImportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlImportOptions { - - /** Properties of a PostgresImportOptions. */ - interface IPostgresImportOptions { - - /** PostgresImportOptions clean */ - clean?: (google.protobuf.IBoolValue|null); - - /** PostgresImportOptions ifExists */ - ifExists?: (google.protobuf.IBoolValue|null); - } - - /** Represents a PostgresImportOptions. */ - class PostgresImportOptions implements IPostgresImportOptions { - - /** - * Constructs a new PostgresImportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions); - - /** PostgresImportOptions clean. */ - public clean?: (google.protobuf.IBoolValue|null); - - /** PostgresImportOptions ifExists. */ - public ifExists?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new PostgresImportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns PostgresImportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions): google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions; - - /** - * Encodes the specified PostgresImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. - * @param message PostgresImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PostgresImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. - * @param message PostgresImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PostgresImportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PostgresImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions; - - /** - * Decodes a PostgresImportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PostgresImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions; - - /** - * Verifies a PostgresImportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PostgresImportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PostgresImportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions; - - /** - * Creates a plain object from a PostgresImportOptions message. Also converts values to other types if specified. - * @param message PostgresImportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PostgresImportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PostgresImportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a SqlCsvImportOptions. */ - interface ISqlCsvImportOptions { - - /** SqlCsvImportOptions table */ - table?: (string|null); - - /** SqlCsvImportOptions columns */ - columns?: (string[]|null); - - /** SqlCsvImportOptions escapeCharacter */ - escapeCharacter?: (string|null); - - /** SqlCsvImportOptions quoteCharacter */ - quoteCharacter?: (string|null); - - /** SqlCsvImportOptions fieldsTerminatedBy */ - fieldsTerminatedBy?: (string|null); - - /** SqlCsvImportOptions linesTerminatedBy */ - linesTerminatedBy?: (string|null); - } - - /** Represents a SqlCsvImportOptions. */ - class SqlCsvImportOptions implements ISqlCsvImportOptions { - - /** - * Constructs a new SqlCsvImportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions); - - /** SqlCsvImportOptions table. */ - public table: string; - - /** SqlCsvImportOptions columns. */ - public columns: string[]; - - /** SqlCsvImportOptions escapeCharacter. */ - public escapeCharacter: string; - - /** SqlCsvImportOptions quoteCharacter. */ - public quoteCharacter: string; - - /** SqlCsvImportOptions fieldsTerminatedBy. */ - public fieldsTerminatedBy: string; - - /** SqlCsvImportOptions linesTerminatedBy. */ - public linesTerminatedBy: string; - - /** - * Creates a new SqlCsvImportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlCsvImportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions): google.cloud.sql.v1.ImportContext.SqlCsvImportOptions; - - /** - * Encodes the specified SqlCsvImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.verify|verify} messages. - * @param message SqlCsvImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlCsvImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.verify|verify} messages. - * @param message SqlCsvImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlCsvImportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlCsvImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlCsvImportOptions; - - /** - * Decodes a SqlCsvImportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlCsvImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlCsvImportOptions; - - /** - * Verifies a SqlCsvImportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlCsvImportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlCsvImportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlCsvImportOptions; - - /** - * Creates a plain object from a SqlCsvImportOptions message. Also converts values to other types if specified. - * @param message SqlCsvImportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ImportContext.SqlCsvImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlCsvImportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlCsvImportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlBakImportOptions. */ - interface ISqlBakImportOptions { - - /** SqlBakImportOptions encryptionOptions */ - encryptionOptions?: (google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions|null); - - /** SqlBakImportOptions striped */ - striped?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions noRecovery */ - noRecovery?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions recoveryOnly */ - recoveryOnly?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions bakType */ - bakType?: (google.cloud.sql.v1.BakType|keyof typeof google.cloud.sql.v1.BakType|null); - - /** SqlBakImportOptions stopAt */ - stopAt?: (google.protobuf.ITimestamp|null); - - /** SqlBakImportOptions stopAtMark */ - stopAtMark?: (string|null); - } - - /** Represents a SqlBakImportOptions. */ - class SqlBakImportOptions implements ISqlBakImportOptions { - - /** - * Constructs a new SqlBakImportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ImportContext.ISqlBakImportOptions); - - /** SqlBakImportOptions encryptionOptions. */ - public encryptionOptions?: (google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions|null); - - /** SqlBakImportOptions striped. */ - public striped?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions noRecovery. */ - public noRecovery?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions recoveryOnly. */ - public recoveryOnly?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions bakType. */ - public bakType: (google.cloud.sql.v1.BakType|keyof typeof google.cloud.sql.v1.BakType); - - /** SqlBakImportOptions stopAt. */ - public stopAt?: (google.protobuf.ITimestamp|null); - - /** SqlBakImportOptions stopAtMark. */ - public stopAtMark: string; - - /** - * Creates a new SqlBakImportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBakImportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ImportContext.ISqlBakImportOptions): google.cloud.sql.v1.ImportContext.SqlBakImportOptions; - - /** - * Encodes the specified SqlBakImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.verify|verify} messages. - * @param message SqlBakImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ImportContext.ISqlBakImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBakImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.verify|verify} messages. - * @param message SqlBakImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.ISqlBakImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBakImportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBakImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlBakImportOptions; - - /** - * Decodes a SqlBakImportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBakImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlBakImportOptions; - - /** - * Verifies a SqlBakImportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBakImportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBakImportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlBakImportOptions; - - /** - * Creates a plain object from a SqlBakImportOptions message. Also converts values to other types if specified. - * @param message SqlBakImportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ImportContext.SqlBakImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBakImportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBakImportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlBakImportOptions { - - /** Properties of an EncryptionOptions. */ - interface IEncryptionOptions { - - /** EncryptionOptions certPath */ - certPath?: (string|null); - - /** EncryptionOptions pvkPath */ - pvkPath?: (string|null); - - /** EncryptionOptions pvkPassword */ - pvkPassword?: (string|null); - - /** EncryptionOptions keepEncrypted */ - keepEncrypted?: (google.protobuf.IBoolValue|null); - } - - /** Represents an EncryptionOptions. */ - class EncryptionOptions implements IEncryptionOptions { - - /** - * Constructs a new EncryptionOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions); - - /** EncryptionOptions certPath. */ - public certPath: string; - - /** EncryptionOptions pvkPath. */ - public pvkPath: string; - - /** EncryptionOptions pvkPassword. */ - public pvkPassword: string; - - /** EncryptionOptions keepEncrypted. */ - public keepEncrypted?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new EncryptionOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns EncryptionOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions): google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions; - - /** - * Encodes the specified EncryptionOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. - * @param message EncryptionOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EncryptionOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. - * @param message EncryptionOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EncryptionOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EncryptionOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions; - - /** - * Decodes an EncryptionOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EncryptionOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions; - - /** - * Verifies an EncryptionOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an EncryptionOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EncryptionOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions; - - /** - * Creates a plain object from an EncryptionOptions message. Also converts values to other types if specified. - * @param message EncryptionOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EncryptionOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EncryptionOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a SqlTdeImportOptions. */ - interface ISqlTdeImportOptions { - - /** SqlTdeImportOptions certificatePath */ - certificatePath?: (string|null); - - /** SqlTdeImportOptions privateKeyPath */ - privateKeyPath?: (string|null); - - /** SqlTdeImportOptions privateKeyPassword */ - privateKeyPassword?: (string|null); - - /** SqlTdeImportOptions name */ - name?: (string|null); - } - - /** Represents a SqlTdeImportOptions. */ - class SqlTdeImportOptions implements ISqlTdeImportOptions { - - /** - * Constructs a new SqlTdeImportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions); - - /** SqlTdeImportOptions certificatePath. */ - public certificatePath: string; - - /** SqlTdeImportOptions privateKeyPath. */ - public privateKeyPath: string; - - /** SqlTdeImportOptions privateKeyPassword. */ - public privateKeyPassword: string; - - /** SqlTdeImportOptions name. */ - public name: string; - - /** - * Creates a new SqlTdeImportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlTdeImportOptions instance - */ - public static create(properties?: google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions): google.cloud.sql.v1.ImportContext.SqlTdeImportOptions; - - /** - * Encodes the specified SqlTdeImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.verify|verify} messages. - * @param message SqlTdeImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlTdeImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.verify|verify} messages. - * @param message SqlTdeImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlTdeImportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlTdeImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ImportContext.SqlTdeImportOptions; - - /** - * Decodes a SqlTdeImportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlTdeImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ImportContext.SqlTdeImportOptions; - - /** - * Verifies a SqlTdeImportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlTdeImportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlTdeImportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ImportContext.SqlTdeImportOptions; - - /** - * Creates a plain object from a SqlTdeImportOptions message. Also converts values to other types if specified. - * @param message SqlTdeImportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ImportContext.SqlTdeImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlTdeImportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlTdeImportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** BakType enum. */ - enum BakType { - BAK_TYPE_UNSPECIFIED = 0, - FULL = 1, - DIFF = 2, - TLOG = 3 - } - - /** Properties of an IpConfiguration. */ - interface IIpConfiguration { - - /** IpConfiguration ipv4Enabled */ - ipv4Enabled?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration privateNetwork */ - privateNetwork?: (string|null); - - /** IpConfiguration requireSsl */ - requireSsl?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration authorizedNetworks */ - authorizedNetworks?: (google.cloud.sql.v1.IAclEntry[]|null); - - /** IpConfiguration allocatedIpRange */ - allocatedIpRange?: (string|null); - - /** IpConfiguration enablePrivatePathForGoogleCloudServices */ - enablePrivatePathForGoogleCloudServices?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration sslMode */ - sslMode?: (google.cloud.sql.v1.IpConfiguration.SslMode|keyof typeof google.cloud.sql.v1.IpConfiguration.SslMode|null); - - /** IpConfiguration pscConfig */ - pscConfig?: (google.cloud.sql.v1.IPscConfig|null); - - /** IpConfiguration serverCaMode */ - serverCaMode?: (google.cloud.sql.v1.IpConfiguration.CaMode|keyof typeof google.cloud.sql.v1.IpConfiguration.CaMode|null); - - /** IpConfiguration customSubjectAlternativeNames */ - customSubjectAlternativeNames?: (string[]|null); - - /** IpConfiguration serverCaPool */ - serverCaPool?: (string|null); - - /** IpConfiguration serverCertificateRotationMode */ - serverCertificateRotationMode?: (google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|keyof typeof google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|null); - } - - /** Represents an IpConfiguration. */ - class IpConfiguration implements IIpConfiguration { - - /** - * Constructs a new IpConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IIpConfiguration); - - /** IpConfiguration ipv4Enabled. */ - public ipv4Enabled?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration privateNetwork. */ - public privateNetwork: string; - - /** IpConfiguration requireSsl. */ - public requireSsl?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration authorizedNetworks. */ - public authorizedNetworks: google.cloud.sql.v1.IAclEntry[]; - - /** IpConfiguration allocatedIpRange. */ - public allocatedIpRange: string; - - /** IpConfiguration enablePrivatePathForGoogleCloudServices. */ - public enablePrivatePathForGoogleCloudServices?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration sslMode. */ - public sslMode: (google.cloud.sql.v1.IpConfiguration.SslMode|keyof typeof google.cloud.sql.v1.IpConfiguration.SslMode); - - /** IpConfiguration pscConfig. */ - public pscConfig?: (google.cloud.sql.v1.IPscConfig|null); - - /** IpConfiguration serverCaMode. */ - public serverCaMode?: (google.cloud.sql.v1.IpConfiguration.CaMode|keyof typeof google.cloud.sql.v1.IpConfiguration.CaMode|null); - - /** IpConfiguration customSubjectAlternativeNames. */ - public customSubjectAlternativeNames: string[]; - - /** IpConfiguration serverCaPool. */ - public serverCaPool?: (string|null); - - /** IpConfiguration serverCertificateRotationMode. */ - public serverCertificateRotationMode?: (google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|keyof typeof google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|null); - - /** - * Creates a new IpConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns IpConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1.IIpConfiguration): google.cloud.sql.v1.IpConfiguration; - - /** - * Encodes the specified IpConfiguration message. Does not implicitly {@link google.cloud.sql.v1.IpConfiguration.verify|verify} messages. - * @param message IpConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IIpConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified IpConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.IpConfiguration.verify|verify} messages. - * @param message IpConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IIpConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an IpConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns IpConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.IpConfiguration; - - /** - * Decodes an IpConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns IpConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.IpConfiguration; - - /** - * Verifies an IpConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an IpConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns IpConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.IpConfiguration; - - /** - * Creates a plain object from an IpConfiguration message. Also converts values to other types if specified. - * @param message IpConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.IpConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this IpConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for IpConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace IpConfiguration { - - /** SslMode enum. */ - enum SslMode { - SSL_MODE_UNSPECIFIED = 0, - ALLOW_UNENCRYPTED_AND_ENCRYPTED = 1, - ENCRYPTED_ONLY = 2, - TRUSTED_CLIENT_CERTIFICATE_REQUIRED = 3 - } - - /** CaMode enum. */ - enum CaMode { - CA_MODE_UNSPECIFIED = 0, - GOOGLE_MANAGED_INTERNAL_CA = 1, - GOOGLE_MANAGED_CAS_CA = 2, - CUSTOMER_MANAGED_CAS_CA = 3 - } - - /** ServerCertificateRotationMode enum. */ - enum ServerCertificateRotationMode { - SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED = 0, - NO_AUTOMATIC_ROTATION = 1, - AUTOMATIC_ROTATION_DURING_MAINTENANCE = 2 - } - } - - /** Properties of a PscConfig. */ - interface IPscConfig { - - /** PscConfig pscEnabled */ - pscEnabled?: (boolean|null); - - /** PscConfig allowedConsumerProjects */ - allowedConsumerProjects?: (string[]|null); - - /** PscConfig pscAutoConnections */ - pscAutoConnections?: (google.cloud.sql.v1.IPscAutoConnectionConfig[]|null); - - /** PscConfig networkAttachmentUri */ - networkAttachmentUri?: (string|null); - - /** PscConfig pscAutoDnsEnabled */ - pscAutoDnsEnabled?: (boolean|null); - - /** PscConfig pscWriteEndpointDnsEnabled */ - pscWriteEndpointDnsEnabled?: (boolean|null); - } - - /** Represents a PscConfig. */ - class PscConfig implements IPscConfig { - - /** - * Constructs a new PscConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IPscConfig); - - /** PscConfig pscEnabled. */ - public pscEnabled?: (boolean|null); - - /** PscConfig allowedConsumerProjects. */ - public allowedConsumerProjects: string[]; - - /** PscConfig pscAutoConnections. */ - public pscAutoConnections: google.cloud.sql.v1.IPscAutoConnectionConfig[]; - - /** PscConfig networkAttachmentUri. */ - public networkAttachmentUri: string; - - /** PscConfig pscAutoDnsEnabled. */ - public pscAutoDnsEnabled?: (boolean|null); - - /** PscConfig pscWriteEndpointDnsEnabled. */ - public pscWriteEndpointDnsEnabled?: (boolean|null); - - /** - * Creates a new PscConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns PscConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IPscConfig): google.cloud.sql.v1.PscConfig; - - /** - * Encodes the specified PscConfig message. Does not implicitly {@link google.cloud.sql.v1.PscConfig.verify|verify} messages. - * @param message PscConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IPscConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PscConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PscConfig.verify|verify} messages. - * @param message PscConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IPscConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PscConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PscConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PscConfig; - - /** - * Decodes a PscConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PscConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PscConfig; - - /** - * Verifies a PscConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PscConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PscConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PscConfig; - - /** - * Creates a plain object from a PscConfig message. Also converts values to other types if specified. - * @param message PscConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.PscConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PscConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PscConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PscAutoConnectionConfig. */ - interface IPscAutoConnectionConfig { - - /** PscAutoConnectionConfig consumerProject */ - consumerProject?: (string|null); - - /** PscAutoConnectionConfig consumerNetwork */ - consumerNetwork?: (string|null); - - /** PscAutoConnectionConfig ipAddress */ - ipAddress?: (string|null); - - /** PscAutoConnectionConfig status */ - status?: (string|null); - - /** PscAutoConnectionConfig consumerNetworkStatus */ - consumerNetworkStatus?: (string|null); - } - - /** Represents a PscAutoConnectionConfig. */ - class PscAutoConnectionConfig implements IPscAutoConnectionConfig { - - /** - * Constructs a new PscAutoConnectionConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IPscAutoConnectionConfig); - - /** PscAutoConnectionConfig consumerProject. */ - public consumerProject: string; - - /** PscAutoConnectionConfig consumerNetwork. */ - public consumerNetwork: string; - - /** PscAutoConnectionConfig ipAddress. */ - public ipAddress?: (string|null); - - /** PscAutoConnectionConfig status. */ - public status?: (string|null); - - /** PscAutoConnectionConfig consumerNetworkStatus. */ - public consumerNetworkStatus?: (string|null); - - /** - * Creates a new PscAutoConnectionConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns PscAutoConnectionConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IPscAutoConnectionConfig): google.cloud.sql.v1.PscAutoConnectionConfig; - - /** - * Encodes the specified PscAutoConnectionConfig message. Does not implicitly {@link google.cloud.sql.v1.PscAutoConnectionConfig.verify|verify} messages. - * @param message PscAutoConnectionConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IPscAutoConnectionConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PscAutoConnectionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PscAutoConnectionConfig.verify|verify} messages. - * @param message PscAutoConnectionConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IPscAutoConnectionConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PscAutoConnectionConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PscAutoConnectionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PscAutoConnectionConfig; - - /** - * Decodes a PscAutoConnectionConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PscAutoConnectionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PscAutoConnectionConfig; - - /** - * Verifies a PscAutoConnectionConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PscAutoConnectionConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PscAutoConnectionConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PscAutoConnectionConfig; - - /** - * Creates a plain object from a PscAutoConnectionConfig message. Also converts values to other types if specified. - * @param message PscAutoConnectionConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.PscAutoConnectionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PscAutoConnectionConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PscAutoConnectionConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LocationPreference. */ - interface ILocationPreference { - - /** LocationPreference followGaeApplication */ - followGaeApplication?: (string|null); - - /** LocationPreference zone */ - zone?: (string|null); - - /** LocationPreference secondaryZone */ - secondaryZone?: (string|null); - - /** LocationPreference kind */ - kind?: (string|null); - } - - /** Represents a LocationPreference. */ - class LocationPreference implements ILocationPreference { - - /** - * Constructs a new LocationPreference. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ILocationPreference); - - /** LocationPreference followGaeApplication. */ - public followGaeApplication: string; - - /** LocationPreference zone. */ - public zone: string; - - /** LocationPreference secondaryZone. */ - public secondaryZone: string; - - /** LocationPreference kind. */ - public kind: string; - - /** - * Creates a new LocationPreference instance using the specified properties. - * @param [properties] Properties to set - * @returns LocationPreference instance - */ - public static create(properties?: google.cloud.sql.v1.ILocationPreference): google.cloud.sql.v1.LocationPreference; - - /** - * Encodes the specified LocationPreference message. Does not implicitly {@link google.cloud.sql.v1.LocationPreference.verify|verify} messages. - * @param message LocationPreference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ILocationPreference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LocationPreference message, length delimited. Does not implicitly {@link google.cloud.sql.v1.LocationPreference.verify|verify} messages. - * @param message LocationPreference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ILocationPreference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LocationPreference message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LocationPreference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.LocationPreference; - - /** - * Decodes a LocationPreference message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LocationPreference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.LocationPreference; - - /** - * Verifies a LocationPreference message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a LocationPreference message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocationPreference - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.LocationPreference; - - /** - * Creates a plain object from a LocationPreference message. Also converts values to other types if specified. - * @param message LocationPreference - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.LocationPreference, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LocationPreference to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LocationPreference - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MaintenanceWindow. */ - interface IMaintenanceWindow { - - /** MaintenanceWindow hour */ - hour?: (google.protobuf.IInt32Value|null); - - /** MaintenanceWindow day */ - day?: (google.protobuf.IInt32Value|null); - - /** MaintenanceWindow updateTrack */ - updateTrack?: (google.cloud.sql.v1.SqlUpdateTrack|keyof typeof google.cloud.sql.v1.SqlUpdateTrack|null); - - /** MaintenanceWindow kind */ - kind?: (string|null); - } - - /** Represents a MaintenanceWindow. */ - class MaintenanceWindow implements IMaintenanceWindow { - - /** - * Constructs a new MaintenanceWindow. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IMaintenanceWindow); - - /** MaintenanceWindow hour. */ - public hour?: (google.protobuf.IInt32Value|null); - - /** MaintenanceWindow day. */ - public day?: (google.protobuf.IInt32Value|null); - - /** MaintenanceWindow updateTrack. */ - public updateTrack: (google.cloud.sql.v1.SqlUpdateTrack|keyof typeof google.cloud.sql.v1.SqlUpdateTrack); - - /** MaintenanceWindow kind. */ - public kind: string; - - /** - * Creates a new MaintenanceWindow instance using the specified properties. - * @param [properties] Properties to set - * @returns MaintenanceWindow instance - */ - public static create(properties?: google.cloud.sql.v1.IMaintenanceWindow): google.cloud.sql.v1.MaintenanceWindow; - - /** - * Encodes the specified MaintenanceWindow message. Does not implicitly {@link google.cloud.sql.v1.MaintenanceWindow.verify|verify} messages. - * @param message MaintenanceWindow message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IMaintenanceWindow, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MaintenanceWindow message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MaintenanceWindow.verify|verify} messages. - * @param message MaintenanceWindow message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IMaintenanceWindow, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MaintenanceWindow message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MaintenanceWindow - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.MaintenanceWindow; - - /** - * Decodes a MaintenanceWindow message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MaintenanceWindow - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.MaintenanceWindow; - - /** - * Verifies a MaintenanceWindow message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MaintenanceWindow message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MaintenanceWindow - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.MaintenanceWindow; - - /** - * Creates a plain object from a MaintenanceWindow message. Also converts values to other types if specified. - * @param message MaintenanceWindow - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.MaintenanceWindow, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MaintenanceWindow to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MaintenanceWindow - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DenyMaintenancePeriod. */ - interface IDenyMaintenancePeriod { - - /** DenyMaintenancePeriod startDate */ - startDate?: (string|null); - - /** DenyMaintenancePeriod endDate */ - endDate?: (string|null); - - /** DenyMaintenancePeriod time */ - time?: (string|null); - } - - /** Represents a DenyMaintenancePeriod. */ - class DenyMaintenancePeriod implements IDenyMaintenancePeriod { - - /** - * Constructs a new DenyMaintenancePeriod. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDenyMaintenancePeriod); - - /** DenyMaintenancePeriod startDate. */ - public startDate: string; - - /** DenyMaintenancePeriod endDate. */ - public endDate: string; - - /** DenyMaintenancePeriod time. */ - public time: string; - - /** - * Creates a new DenyMaintenancePeriod instance using the specified properties. - * @param [properties] Properties to set - * @returns DenyMaintenancePeriod instance - */ - public static create(properties?: google.cloud.sql.v1.IDenyMaintenancePeriod): google.cloud.sql.v1.DenyMaintenancePeriod; - - /** - * Encodes the specified DenyMaintenancePeriod message. Does not implicitly {@link google.cloud.sql.v1.DenyMaintenancePeriod.verify|verify} messages. - * @param message DenyMaintenancePeriod message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDenyMaintenancePeriod, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DenyMaintenancePeriod message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DenyMaintenancePeriod.verify|verify} messages. - * @param message DenyMaintenancePeriod message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDenyMaintenancePeriod, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DenyMaintenancePeriod message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DenyMaintenancePeriod - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DenyMaintenancePeriod; - - /** - * Decodes a DenyMaintenancePeriod message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DenyMaintenancePeriod - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DenyMaintenancePeriod; - - /** - * Verifies a DenyMaintenancePeriod message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DenyMaintenancePeriod message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DenyMaintenancePeriod - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DenyMaintenancePeriod; - - /** - * Creates a plain object from a DenyMaintenancePeriod message. Also converts values to other types if specified. - * @param message DenyMaintenancePeriod - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DenyMaintenancePeriod, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DenyMaintenancePeriod to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DenyMaintenancePeriod - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InsightsConfig. */ - interface IInsightsConfig { - - /** InsightsConfig queryInsightsEnabled */ - queryInsightsEnabled?: (boolean|null); - - /** InsightsConfig recordClientAddress */ - recordClientAddress?: (boolean|null); - - /** InsightsConfig recordApplicationTags */ - recordApplicationTags?: (boolean|null); - - /** InsightsConfig queryStringLength */ - queryStringLength?: (google.protobuf.IInt32Value|null); - - /** InsightsConfig queryPlansPerMinute */ - queryPlansPerMinute?: (google.protobuf.IInt32Value|null); - - /** InsightsConfig enhancedQueryInsightsEnabled */ - enhancedQueryInsightsEnabled?: (google.protobuf.IBoolValue|null); - } - - /** Represents an InsightsConfig. */ - class InsightsConfig implements IInsightsConfig { - - /** - * Constructs a new InsightsConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInsightsConfig); - - /** InsightsConfig queryInsightsEnabled. */ - public queryInsightsEnabled: boolean; - - /** InsightsConfig recordClientAddress. */ - public recordClientAddress: boolean; - - /** InsightsConfig recordApplicationTags. */ - public recordApplicationTags: boolean; - - /** InsightsConfig queryStringLength. */ - public queryStringLength?: (google.protobuf.IInt32Value|null); - - /** InsightsConfig queryPlansPerMinute. */ - public queryPlansPerMinute?: (google.protobuf.IInt32Value|null); - - /** InsightsConfig enhancedQueryInsightsEnabled. */ - public enhancedQueryInsightsEnabled?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new InsightsConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns InsightsConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IInsightsConfig): google.cloud.sql.v1.InsightsConfig; - - /** - * Encodes the specified InsightsConfig message. Does not implicitly {@link google.cloud.sql.v1.InsightsConfig.verify|verify} messages. - * @param message InsightsConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInsightsConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InsightsConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InsightsConfig.verify|verify} messages. - * @param message InsightsConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInsightsConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InsightsConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InsightsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InsightsConfig; - - /** - * Decodes an InsightsConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InsightsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InsightsConfig; - - /** - * Verifies an InsightsConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InsightsConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InsightsConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InsightsConfig; - - /** - * Creates a plain object from an InsightsConfig message. Also converts values to other types if specified. - * @param message InsightsConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InsightsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InsightsConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InsightsConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MySqlReplicaConfiguration. */ - interface IMySqlReplicaConfiguration { - - /** MySqlReplicaConfiguration dumpFilePath */ - dumpFilePath?: (string|null); - - /** MySqlReplicaConfiguration username */ - username?: (string|null); - - /** MySqlReplicaConfiguration password */ - password?: (string|null); - - /** MySqlReplicaConfiguration connectRetryInterval */ - connectRetryInterval?: (google.protobuf.IInt32Value|null); - - /** MySqlReplicaConfiguration masterHeartbeatPeriod */ - masterHeartbeatPeriod?: (google.protobuf.IInt64Value|null); - - /** MySqlReplicaConfiguration caCertificate */ - caCertificate?: (string|null); - - /** MySqlReplicaConfiguration clientCertificate */ - clientCertificate?: (string|null); - - /** MySqlReplicaConfiguration clientKey */ - clientKey?: (string|null); - - /** MySqlReplicaConfiguration sslCipher */ - sslCipher?: (string|null); - - /** MySqlReplicaConfiguration verifyServerCertificate */ - verifyServerCertificate?: (google.protobuf.IBoolValue|null); - - /** MySqlReplicaConfiguration kind */ - kind?: (string|null); - } - - /** Represents a MySqlReplicaConfiguration. */ - class MySqlReplicaConfiguration implements IMySqlReplicaConfiguration { - - /** - * Constructs a new MySqlReplicaConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IMySqlReplicaConfiguration); - - /** MySqlReplicaConfiguration dumpFilePath. */ - public dumpFilePath: string; - - /** MySqlReplicaConfiguration username. */ - public username: string; - - /** MySqlReplicaConfiguration password. */ - public password: string; - - /** MySqlReplicaConfiguration connectRetryInterval. */ - public connectRetryInterval?: (google.protobuf.IInt32Value|null); - - /** MySqlReplicaConfiguration masterHeartbeatPeriod. */ - public masterHeartbeatPeriod?: (google.protobuf.IInt64Value|null); - - /** MySqlReplicaConfiguration caCertificate. */ - public caCertificate: string; - - /** MySqlReplicaConfiguration clientCertificate. */ - public clientCertificate: string; - - /** MySqlReplicaConfiguration clientKey. */ - public clientKey: string; - - /** MySqlReplicaConfiguration sslCipher. */ - public sslCipher: string; - - /** MySqlReplicaConfiguration verifyServerCertificate. */ - public verifyServerCertificate?: (google.protobuf.IBoolValue|null); - - /** MySqlReplicaConfiguration kind. */ - public kind: string; - - /** - * Creates a new MySqlReplicaConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns MySqlReplicaConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1.IMySqlReplicaConfiguration): google.cloud.sql.v1.MySqlReplicaConfiguration; - - /** - * Encodes the specified MySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.MySqlReplicaConfiguration.verify|verify} messages. - * @param message MySqlReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MySqlReplicaConfiguration.verify|verify} messages. - * @param message MySqlReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.MySqlReplicaConfiguration; - - /** - * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.MySqlReplicaConfiguration; - - /** - * Verifies a MySqlReplicaConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MySqlReplicaConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.MySqlReplicaConfiguration; - - /** - * Creates a plain object from a MySqlReplicaConfiguration message. Also converts values to other types if specified. - * @param message MySqlReplicaConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.MySqlReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MySqlReplicaConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MySqlReplicaConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DiskEncryptionConfiguration. */ - interface IDiskEncryptionConfiguration { - - /** DiskEncryptionConfiguration kmsKeyName */ - kmsKeyName?: (string|null); - - /** DiskEncryptionConfiguration kind */ - kind?: (string|null); - } - - /** Represents a DiskEncryptionConfiguration. */ - class DiskEncryptionConfiguration implements IDiskEncryptionConfiguration { - - /** - * Constructs a new DiskEncryptionConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDiskEncryptionConfiguration); - - /** DiskEncryptionConfiguration kmsKeyName. */ - public kmsKeyName: string; - - /** DiskEncryptionConfiguration kind. */ - public kind: string; - - /** - * Creates a new DiskEncryptionConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns DiskEncryptionConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1.IDiskEncryptionConfiguration): google.cloud.sql.v1.DiskEncryptionConfiguration; - - /** - * Encodes the specified DiskEncryptionConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionConfiguration.verify|verify} messages. - * @param message DiskEncryptionConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDiskEncryptionConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DiskEncryptionConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionConfiguration.verify|verify} messages. - * @param message DiskEncryptionConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDiskEncryptionConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DiskEncryptionConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DiskEncryptionConfiguration; - - /** - * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DiskEncryptionConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DiskEncryptionConfiguration; - - /** - * Verifies a DiskEncryptionConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DiskEncryptionConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DiskEncryptionConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DiskEncryptionConfiguration; - - /** - * Creates a plain object from a DiskEncryptionConfiguration message. Also converts values to other types if specified. - * @param message DiskEncryptionConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DiskEncryptionConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DiskEncryptionConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DiskEncryptionConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DiskEncryptionStatus. */ - interface IDiskEncryptionStatus { - - /** DiskEncryptionStatus kmsKeyVersionName */ - kmsKeyVersionName?: (string|null); - - /** DiskEncryptionStatus kind */ - kind?: (string|null); - } - - /** Represents a DiskEncryptionStatus. */ - class DiskEncryptionStatus implements IDiskEncryptionStatus { - - /** - * Constructs a new DiskEncryptionStatus. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDiskEncryptionStatus); - - /** DiskEncryptionStatus kmsKeyVersionName. */ - public kmsKeyVersionName: string; - - /** DiskEncryptionStatus kind. */ - public kind: string; - - /** - * Creates a new DiskEncryptionStatus instance using the specified properties. - * @param [properties] Properties to set - * @returns DiskEncryptionStatus instance - */ - public static create(properties?: google.cloud.sql.v1.IDiskEncryptionStatus): google.cloud.sql.v1.DiskEncryptionStatus; - - /** - * Encodes the specified DiskEncryptionStatus message. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionStatus.verify|verify} messages. - * @param message DiskEncryptionStatus message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDiskEncryptionStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DiskEncryptionStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionStatus.verify|verify} messages. - * @param message DiskEncryptionStatus message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDiskEncryptionStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DiskEncryptionStatus message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DiskEncryptionStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DiskEncryptionStatus; - - /** - * Decodes a DiskEncryptionStatus message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DiskEncryptionStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DiskEncryptionStatus; - - /** - * Verifies a DiskEncryptionStatus message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DiskEncryptionStatus message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DiskEncryptionStatus - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DiskEncryptionStatus; - - /** - * Creates a plain object from a DiskEncryptionStatus message. Also converts values to other types if specified. - * @param message DiskEncryptionStatus - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DiskEncryptionStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DiskEncryptionStatus to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DiskEncryptionStatus - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an IpMapping. */ - interface IIpMapping { - - /** IpMapping type */ - type?: (google.cloud.sql.v1.SqlIpAddressType|keyof typeof google.cloud.sql.v1.SqlIpAddressType|null); - - /** IpMapping ipAddress */ - ipAddress?: (string|null); - - /** IpMapping timeToRetire */ - timeToRetire?: (google.protobuf.ITimestamp|null); - } - - /** Represents an IpMapping. */ - class IpMapping implements IIpMapping { - - /** - * Constructs a new IpMapping. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IIpMapping); - - /** IpMapping type. */ - public type: (google.cloud.sql.v1.SqlIpAddressType|keyof typeof google.cloud.sql.v1.SqlIpAddressType); - - /** IpMapping ipAddress. */ - public ipAddress: string; - - /** IpMapping timeToRetire. */ - public timeToRetire?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new IpMapping instance using the specified properties. - * @param [properties] Properties to set - * @returns IpMapping instance - */ - public static create(properties?: google.cloud.sql.v1.IIpMapping): google.cloud.sql.v1.IpMapping; - - /** - * Encodes the specified IpMapping message. Does not implicitly {@link google.cloud.sql.v1.IpMapping.verify|verify} messages. - * @param message IpMapping message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IIpMapping, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified IpMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1.IpMapping.verify|verify} messages. - * @param message IpMapping message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IIpMapping, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an IpMapping message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns IpMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.IpMapping; - - /** - * Decodes an IpMapping message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns IpMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.IpMapping; - - /** - * Verifies an IpMapping message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an IpMapping message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns IpMapping - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.IpMapping; - - /** - * Creates a plain object from an IpMapping message. Also converts values to other types if specified. - * @param message IpMapping - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.IpMapping, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this IpMapping to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for IpMapping - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlMaintenanceType enum. */ - enum SqlMaintenanceType { - SQL_MAINTENANCE_TYPE_UNSPECIFIED = 0, - INSTANCE_MAINTENANCE = 1, - REPLICA_INCLUDED_MAINTENANCE = 2, - INSTANCE_SELF_SERVICE_MAINTENANCE = 3, - REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE = 4 - } - - /** Properties of a SqlSubOperationType. */ - interface ISqlSubOperationType { - - /** SqlSubOperationType maintenanceType */ - maintenanceType?: (google.cloud.sql.v1.SqlMaintenanceType|keyof typeof google.cloud.sql.v1.SqlMaintenanceType|null); - } - - /** Represents a SqlSubOperationType. */ - class SqlSubOperationType implements ISqlSubOperationType { - - /** - * Constructs a new SqlSubOperationType. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlSubOperationType); - - /** SqlSubOperationType maintenanceType. */ - public maintenanceType?: (google.cloud.sql.v1.SqlMaintenanceType|keyof typeof google.cloud.sql.v1.SqlMaintenanceType|null); - - /** SqlSubOperationType subOperationDetails. */ - public subOperationDetails?: "maintenanceType"; - - /** - * Creates a new SqlSubOperationType instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlSubOperationType instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlSubOperationType): google.cloud.sql.v1.SqlSubOperationType; - - /** - * Encodes the specified SqlSubOperationType message. Does not implicitly {@link google.cloud.sql.v1.SqlSubOperationType.verify|verify} messages. - * @param message SqlSubOperationType message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlSubOperationType, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlSubOperationType message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSubOperationType.verify|verify} messages. - * @param message SqlSubOperationType message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlSubOperationType, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlSubOperationType message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlSubOperationType - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlSubOperationType; - - /** - * Decodes a SqlSubOperationType message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlSubOperationType - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlSubOperationType; - - /** - * Verifies a SqlSubOperationType message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlSubOperationType message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlSubOperationType - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlSubOperationType; - - /** - * Creates a plain object from a SqlSubOperationType message. Also converts values to other types if specified. - * @param message SqlSubOperationType - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlSubOperationType, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlSubOperationType to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlSubOperationType - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Operation. */ - interface IOperation { - - /** Operation kind */ - kind?: (string|null); - - /** Operation targetLink */ - targetLink?: (string|null); - - /** Operation status */ - status?: (google.cloud.sql.v1.Operation.SqlOperationStatus|keyof typeof google.cloud.sql.v1.Operation.SqlOperationStatus|null); - - /** Operation user */ - user?: (string|null); - - /** Operation insertTime */ - insertTime?: (google.protobuf.ITimestamp|null); - - /** Operation startTime */ - startTime?: (google.protobuf.ITimestamp|null); - - /** Operation endTime */ - endTime?: (google.protobuf.ITimestamp|null); - - /** Operation error */ - error?: (google.cloud.sql.v1.IOperationErrors|null); - - /** Operation apiWarning */ - apiWarning?: (google.cloud.sql.v1.IApiWarning|null); - - /** Operation operationType */ - operationType?: (google.cloud.sql.v1.Operation.SqlOperationType|keyof typeof google.cloud.sql.v1.Operation.SqlOperationType|null); - - /** Operation importContext */ - importContext?: (google.cloud.sql.v1.IImportContext|null); - - /** Operation exportContext */ - exportContext?: (google.cloud.sql.v1.IExportContext|null); - - /** Operation backupContext */ - backupContext?: (google.cloud.sql.v1.IBackupContext|null); - - /** Operation preCheckMajorVersionUpgradeContext */ - preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null); - - /** Operation name */ - name?: (string|null); - - /** Operation targetId */ - targetId?: (string|null); - - /** Operation selfLink */ - selfLink?: (string|null); - - /** Operation targetProject */ - targetProject?: (string|null); - - /** Operation acquireSsrsLeaseContext */ - acquireSsrsLeaseContext?: (google.cloud.sql.v1.IAcquireSsrsLeaseContext|null); - - /** Operation subOperationType */ - subOperationType?: (google.cloud.sql.v1.ISqlSubOperationType|null); - } - - /** Represents an Operation. */ - class Operation implements IOperation { - - /** - * Constructs a new Operation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IOperation); - - /** Operation kind. */ - public kind: string; - - /** Operation targetLink. */ - public targetLink: string; - - /** Operation status. */ - public status: (google.cloud.sql.v1.Operation.SqlOperationStatus|keyof typeof google.cloud.sql.v1.Operation.SqlOperationStatus); - - /** Operation user. */ - public user: string; - - /** Operation insertTime. */ - public insertTime?: (google.protobuf.ITimestamp|null); - - /** Operation startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); - - /** Operation endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** Operation error. */ - public error?: (google.cloud.sql.v1.IOperationErrors|null); - - /** Operation apiWarning. */ - public apiWarning?: (google.cloud.sql.v1.IApiWarning|null); - - /** Operation operationType. */ - public operationType: (google.cloud.sql.v1.Operation.SqlOperationType|keyof typeof google.cloud.sql.v1.Operation.SqlOperationType); - - /** Operation importContext. */ - public importContext?: (google.cloud.sql.v1.IImportContext|null); - - /** Operation exportContext. */ - public exportContext?: (google.cloud.sql.v1.IExportContext|null); - - /** Operation backupContext. */ - public backupContext?: (google.cloud.sql.v1.IBackupContext|null); - - /** Operation preCheckMajorVersionUpgradeContext. */ - public preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null); - - /** Operation name. */ - public name: string; - - /** Operation targetId. */ - public targetId: string; - - /** Operation selfLink. */ - public selfLink: string; - - /** Operation targetProject. */ - public targetProject: string; - - /** Operation acquireSsrsLeaseContext. */ - public acquireSsrsLeaseContext?: (google.cloud.sql.v1.IAcquireSsrsLeaseContext|null); - - /** Operation subOperationType. */ - public subOperationType?: (google.cloud.sql.v1.ISqlSubOperationType|null); - - /** - * Creates a new Operation instance using the specified properties. - * @param [properties] Properties to set - * @returns Operation instance - */ - public static create(properties?: google.cloud.sql.v1.IOperation): google.cloud.sql.v1.Operation; - - /** - * Encodes the specified Operation message. Does not implicitly {@link google.cloud.sql.v1.Operation.verify|verify} messages. - * @param message Operation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Operation.verify|verify} messages. - * @param message Operation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Operation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Operation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Operation; - - /** - * Decodes an Operation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Operation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Operation; - - /** - * Verifies an Operation message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an Operation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Operation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Operation; - - /** - * Creates a plain object from an Operation message. Also converts values to other types if specified. - * @param message Operation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Operation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Operation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Operation { - - /** SqlOperationType enum. */ - enum SqlOperationType { - SQL_OPERATION_TYPE_UNSPECIFIED = 0, - IMPORT = 1, - EXPORT = 2, - CREATE = 3, - UPDATE = 4, - DELETE = 5, - RESTART = 6, - BACKUP = 7, - SNAPSHOT = 8, - BACKUP_VOLUME = 9, - DELETE_VOLUME = 10, - RESTORE_VOLUME = 11, - INJECT_USER = 12, - CLONE = 14, - STOP_REPLICA = 15, - START_REPLICA = 16, - PROMOTE_REPLICA = 17, - CREATE_REPLICA = 18, - CREATE_USER = 19, - DELETE_USER = 20, - UPDATE_USER = 21, - CREATE_DATABASE = 22, - DELETE_DATABASE = 23, - UPDATE_DATABASE = 24, - FAILOVER = 25, - DELETE_BACKUP = 26, - RECREATE_REPLICA = 27, - TRUNCATE_LOG = 28, - DEMOTE_MASTER = 29, - MAINTENANCE = 30, - ENABLE_PRIVATE_IP = 31, - DEFER_MAINTENANCE = 32, - CREATE_CLONE = 33, - RESCHEDULE_MAINTENANCE = 34, - START_EXTERNAL_SYNC = 35, - LOG_CLEANUP = 36, - AUTO_RESTART = 37, - REENCRYPT = 38, - SWITCHOVER = 39, - UPDATE_BACKUP = 40, - ACQUIRE_SSRS_LEASE = 42, - RELEASE_SSRS_LEASE = 43, - RECONFIGURE_OLD_PRIMARY = 44, - CLUSTER_MAINTENANCE = 45, - SELF_SERVICE_MAINTENANCE = 46, - SWITCHOVER_TO_REPLICA = 47, - MAJOR_VERSION_UPGRADE = 48, - ADVANCED_BACKUP = 49, - MANAGE_BACKUP = 50, - ENHANCED_BACKUP = 51, - REPAIR_READ_POOL = 52, - CREATE_READ_POOL = 53, - PRE_CHECK_MAJOR_VERSION_UPGRADE = 54 - } - - /** SqlOperationStatus enum. */ - enum SqlOperationStatus { - SQL_OPERATION_STATUS_UNSPECIFIED = 0, - PENDING = 1, - RUNNING = 2, - DONE = 3 - } - } - - /** Properties of an OperationError. */ - interface IOperationError { - - /** OperationError kind */ - kind?: (string|null); - - /** OperationError code */ - code?: (string|null); - - /** OperationError message */ - message?: (string|null); - } - - /** Represents an OperationError. */ - class OperationError implements IOperationError { - - /** - * Constructs a new OperationError. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IOperationError); - - /** OperationError kind. */ - public kind: string; - - /** OperationError code. */ - public code: string; - - /** OperationError message. */ - public message: string; - - /** - * Creates a new OperationError instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationError instance - */ - public static create(properties?: google.cloud.sql.v1.IOperationError): google.cloud.sql.v1.OperationError; - - /** - * Encodes the specified OperationError message. Does not implicitly {@link google.cloud.sql.v1.OperationError.verify|verify} messages. - * @param message OperationError message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationError.verify|verify} messages. - * @param message OperationError message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OperationError message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OperationError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.OperationError; - - /** - * Decodes an OperationError message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OperationError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.OperationError; - - /** - * Verifies an OperationError message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OperationError message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationError - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.OperationError; - - /** - * Creates a plain object from an OperationError message. Also converts values to other types if specified. - * @param message OperationError - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.OperationError, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationError to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationError - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OperationErrors. */ - interface IOperationErrors { - - /** OperationErrors kind */ - kind?: (string|null); - - /** OperationErrors errors */ - errors?: (google.cloud.sql.v1.IOperationError[]|null); - } - - /** Represents an OperationErrors. */ - class OperationErrors implements IOperationErrors { - - /** - * Constructs a new OperationErrors. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IOperationErrors); - - /** OperationErrors kind. */ - public kind: string; - - /** OperationErrors errors. */ - public errors: google.cloud.sql.v1.IOperationError[]; - - /** - * Creates a new OperationErrors instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationErrors instance - */ - public static create(properties?: google.cloud.sql.v1.IOperationErrors): google.cloud.sql.v1.OperationErrors; - - /** - * Encodes the specified OperationErrors message. Does not implicitly {@link google.cloud.sql.v1.OperationErrors.verify|verify} messages. - * @param message OperationErrors message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IOperationErrors, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationErrors message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationErrors.verify|verify} messages. - * @param message OperationErrors message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IOperationErrors, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OperationErrors message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OperationErrors - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.OperationErrors; - - /** - * Decodes an OperationErrors message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OperationErrors - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.OperationErrors; - - /** - * Verifies an OperationErrors message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OperationErrors message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationErrors - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.OperationErrors; - - /** - * Creates a plain object from an OperationErrors message. Also converts values to other types if specified. - * @param message OperationErrors - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.OperationErrors, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationErrors to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationErrors - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PasswordValidationPolicy. */ - interface IPasswordValidationPolicy { - - /** PasswordValidationPolicy minLength */ - minLength?: (google.protobuf.IInt32Value|null); - - /** PasswordValidationPolicy complexity */ - complexity?: (google.cloud.sql.v1.PasswordValidationPolicy.Complexity|keyof typeof google.cloud.sql.v1.PasswordValidationPolicy.Complexity|null); - - /** PasswordValidationPolicy reuseInterval */ - reuseInterval?: (google.protobuf.IInt32Value|null); - - /** PasswordValidationPolicy disallowUsernameSubstring */ - disallowUsernameSubstring?: (google.protobuf.IBoolValue|null); - - /** PasswordValidationPolicy passwordChangeInterval */ - passwordChangeInterval?: (google.protobuf.IDuration|null); - - /** PasswordValidationPolicy enablePasswordPolicy */ - enablePasswordPolicy?: (google.protobuf.IBoolValue|null); - - /** PasswordValidationPolicy disallowCompromisedCredentials */ - disallowCompromisedCredentials?: (google.protobuf.IBoolValue|null); - } - - /** Represents a PasswordValidationPolicy. */ - class PasswordValidationPolicy implements IPasswordValidationPolicy { - - /** - * Constructs a new PasswordValidationPolicy. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IPasswordValidationPolicy); - - /** PasswordValidationPolicy minLength. */ - public minLength?: (google.protobuf.IInt32Value|null); - - /** PasswordValidationPolicy complexity. */ - public complexity: (google.cloud.sql.v1.PasswordValidationPolicy.Complexity|keyof typeof google.cloud.sql.v1.PasswordValidationPolicy.Complexity); - - /** PasswordValidationPolicy reuseInterval. */ - public reuseInterval?: (google.protobuf.IInt32Value|null); - - /** PasswordValidationPolicy disallowUsernameSubstring. */ - public disallowUsernameSubstring?: (google.protobuf.IBoolValue|null); - - /** PasswordValidationPolicy passwordChangeInterval. */ - public passwordChangeInterval?: (google.protobuf.IDuration|null); - - /** PasswordValidationPolicy enablePasswordPolicy. */ - public enablePasswordPolicy?: (google.protobuf.IBoolValue|null); - - /** PasswordValidationPolicy disallowCompromisedCredentials. */ - public disallowCompromisedCredentials?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new PasswordValidationPolicy instance using the specified properties. - * @param [properties] Properties to set - * @returns PasswordValidationPolicy instance - */ - public static create(properties?: google.cloud.sql.v1.IPasswordValidationPolicy): google.cloud.sql.v1.PasswordValidationPolicy; - - /** - * Encodes the specified PasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1.PasswordValidationPolicy.verify|verify} messages. - * @param message PasswordValidationPolicy message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PasswordValidationPolicy.verify|verify} messages. - * @param message PasswordValidationPolicy message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PasswordValidationPolicy message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PasswordValidationPolicy; - - /** - * Decodes a PasswordValidationPolicy message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PasswordValidationPolicy; - - /** - * Verifies a PasswordValidationPolicy message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PasswordValidationPolicy - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PasswordValidationPolicy; - - /** - * Creates a plain object from a PasswordValidationPolicy message. Also converts values to other types if specified. - * @param message PasswordValidationPolicy - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.PasswordValidationPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PasswordValidationPolicy to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PasswordValidationPolicy - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace PasswordValidationPolicy { - - /** Complexity enum. */ - enum Complexity { - COMPLEXITY_UNSPECIFIED = 0, - COMPLEXITY_DEFAULT = 1 - } - } - - /** Properties of a DataCacheConfig. */ - interface IDataCacheConfig { - - /** DataCacheConfig dataCacheEnabled */ - dataCacheEnabled?: (boolean|null); - } - - /** Represents a DataCacheConfig. */ - class DataCacheConfig implements IDataCacheConfig { - - /** - * Constructs a new DataCacheConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDataCacheConfig); - - /** DataCacheConfig dataCacheEnabled. */ - public dataCacheEnabled: boolean; - - /** - * Creates a new DataCacheConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns DataCacheConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IDataCacheConfig): google.cloud.sql.v1.DataCacheConfig; - - /** - * Encodes the specified DataCacheConfig message. Does not implicitly {@link google.cloud.sql.v1.DataCacheConfig.verify|verify} messages. - * @param message DataCacheConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDataCacheConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DataCacheConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DataCacheConfig.verify|verify} messages. - * @param message DataCacheConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDataCacheConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DataCacheConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DataCacheConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DataCacheConfig; - - /** - * Decodes a DataCacheConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DataCacheConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DataCacheConfig; - - /** - * Verifies a DataCacheConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DataCacheConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DataCacheConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DataCacheConfig; - - /** - * Creates a plain object from a DataCacheConfig message. Also converts values to other types if specified. - * @param message DataCacheConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DataCacheConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DataCacheConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DataCacheConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FinalBackupConfig. */ - interface IFinalBackupConfig { - - /** FinalBackupConfig enabled */ - enabled?: (boolean|null); - - /** FinalBackupConfig retentionDays */ - retentionDays?: (number|null); - } - - /** Represents a FinalBackupConfig. */ - class FinalBackupConfig implements IFinalBackupConfig { - - /** - * Constructs a new FinalBackupConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IFinalBackupConfig); - - /** FinalBackupConfig enabled. */ - public enabled?: (boolean|null); - - /** FinalBackupConfig retentionDays. */ - public retentionDays?: (number|null); - - /** - * Creates a new FinalBackupConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns FinalBackupConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IFinalBackupConfig): google.cloud.sql.v1.FinalBackupConfig; - - /** - * Encodes the specified FinalBackupConfig message. Does not implicitly {@link google.cloud.sql.v1.FinalBackupConfig.verify|verify} messages. - * @param message FinalBackupConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IFinalBackupConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FinalBackupConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FinalBackupConfig.verify|verify} messages. - * @param message FinalBackupConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IFinalBackupConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FinalBackupConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FinalBackupConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.FinalBackupConfig; - - /** - * Decodes a FinalBackupConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FinalBackupConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.FinalBackupConfig; - - /** - * Verifies a FinalBackupConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FinalBackupConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FinalBackupConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.FinalBackupConfig; - - /** - * Creates a plain object from a FinalBackupConfig message. Also converts values to other types if specified. - * @param message FinalBackupConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.FinalBackupConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FinalBackupConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FinalBackupConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Settings. */ - interface ISettings { - - /** Settings settingsVersion */ - settingsVersion?: (google.protobuf.IInt64Value|null); - - /** Settings authorizedGaeApplications */ - authorizedGaeApplications?: (string[]|null); - - /** Settings tier */ - tier?: (string|null); - - /** Settings kind */ - kind?: (string|null); - - /** Settings userLabels */ - userLabels?: ({ [k: string]: string }|null); - - /** Settings availabilityType */ - availabilityType?: (google.cloud.sql.v1.SqlAvailabilityType|keyof typeof google.cloud.sql.v1.SqlAvailabilityType|null); - - /** Settings pricingPlan */ - pricingPlan?: (google.cloud.sql.v1.SqlPricingPlan|keyof typeof google.cloud.sql.v1.SqlPricingPlan|null); - - /** Settings replicationType */ - replicationType?: (google.cloud.sql.v1.SqlReplicationType|keyof typeof google.cloud.sql.v1.SqlReplicationType|null); - - /** Settings storageAutoResizeLimit */ - storageAutoResizeLimit?: (google.protobuf.IInt64Value|null); - - /** Settings activationPolicy */ - activationPolicy?: (google.cloud.sql.v1.Settings.SqlActivationPolicy|keyof typeof google.cloud.sql.v1.Settings.SqlActivationPolicy|null); - - /** Settings ipConfiguration */ - ipConfiguration?: (google.cloud.sql.v1.IIpConfiguration|null); - - /** Settings storageAutoResize */ - storageAutoResize?: (google.protobuf.IBoolValue|null); - - /** Settings locationPreference */ - locationPreference?: (google.cloud.sql.v1.ILocationPreference|null); - - /** Settings databaseFlags */ - databaseFlags?: (google.cloud.sql.v1.IDatabaseFlags[]|null); - - /** Settings dataDiskType */ - dataDiskType?: (google.cloud.sql.v1.SqlDataDiskType|keyof typeof google.cloud.sql.v1.SqlDataDiskType|null); - - /** Settings maintenanceWindow */ - maintenanceWindow?: (google.cloud.sql.v1.IMaintenanceWindow|null); - - /** Settings backupConfiguration */ - backupConfiguration?: (google.cloud.sql.v1.IBackupConfiguration|null); - - /** Settings databaseReplicationEnabled */ - databaseReplicationEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings crashSafeReplicationEnabled */ - crashSafeReplicationEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings dataDiskSizeGb */ - dataDiskSizeGb?: (google.protobuf.IInt64Value|null); - - /** Settings activeDirectoryConfig */ - activeDirectoryConfig?: (google.cloud.sql.v1.ISqlActiveDirectoryConfig|null); - - /** Settings collation */ - collation?: (string|null); - - /** Settings denyMaintenancePeriods */ - denyMaintenancePeriods?: (google.cloud.sql.v1.IDenyMaintenancePeriod[]|null); - - /** Settings insightsConfig */ - insightsConfig?: (google.cloud.sql.v1.IInsightsConfig|null); - - /** Settings passwordValidationPolicy */ - passwordValidationPolicy?: (google.cloud.sql.v1.IPasswordValidationPolicy|null); - - /** Settings sqlServerAuditConfig */ - sqlServerAuditConfig?: (google.cloud.sql.v1.ISqlServerAuditConfig|null); - - /** Settings edition */ - edition?: (google.cloud.sql.v1.Settings.Edition|keyof typeof google.cloud.sql.v1.Settings.Edition|null); - - /** Settings connectorEnforcement */ - connectorEnforcement?: (google.cloud.sql.v1.Settings.ConnectorEnforcement|keyof typeof google.cloud.sql.v1.Settings.ConnectorEnforcement|null); - - /** Settings deletionProtectionEnabled */ - deletionProtectionEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings timeZone */ - timeZone?: (string|null); - - /** Settings advancedMachineFeatures */ - advancedMachineFeatures?: (google.cloud.sql.v1.IAdvancedMachineFeatures|null); - - /** Settings dataCacheConfig */ - dataCacheConfig?: (google.cloud.sql.v1.IDataCacheConfig|null); - - /** Settings replicationLagMaxSeconds */ - replicationLagMaxSeconds?: (google.protobuf.IInt32Value|null); - - /** Settings enableGoogleMlIntegration */ - enableGoogleMlIntegration?: (google.protobuf.IBoolValue|null); - - /** Settings enableDataplexIntegration */ - enableDataplexIntegration?: (google.protobuf.IBoolValue|null); - - /** Settings retainBackupsOnDelete */ - retainBackupsOnDelete?: (google.protobuf.IBoolValue|null); - - /** Settings dataDiskProvisionedIops */ - dataDiskProvisionedIops?: (number|Long|string|null); - - /** Settings dataDiskProvisionedThroughput */ - dataDiskProvisionedThroughput?: (number|Long|string|null); - - /** Settings connectionPoolConfig */ - connectionPoolConfig?: (google.cloud.sql.v1.IConnectionPoolConfig|null); - - /** Settings finalBackupConfig */ - finalBackupConfig?: (google.cloud.sql.v1.IFinalBackupConfig|null); - - /** Settings readPoolAutoScaleConfig */ - readPoolAutoScaleConfig?: (google.cloud.sql.v1.IReadPoolAutoScaleConfig|null); - - /** Settings acceleratedReplicaMode */ - acceleratedReplicaMode?: (google.protobuf.IBoolValue|null); - - /** Settings autoUpgradeEnabled */ - autoUpgradeEnabled?: (boolean|null); - - /** Settings entraidConfig */ - entraidConfig?: (google.cloud.sql.v1.ISqlServerEntraIdConfig|null); - - /** Settings dataApiAccess */ - dataApiAccess?: (google.cloud.sql.v1.Settings.DataApiAccess|keyof typeof google.cloud.sql.v1.Settings.DataApiAccess|null); - - /** Settings performanceCaptureConfig */ - performanceCaptureConfig?: (google.cloud.sql.v1.IPerformanceCaptureConfig|null); - } - - /** Represents a Settings. */ - class Settings implements ISettings { - - /** - * Constructs a new Settings. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISettings); - - /** Settings settingsVersion. */ - public settingsVersion?: (google.protobuf.IInt64Value|null); - - /** Settings authorizedGaeApplications. */ - public authorizedGaeApplications: string[]; - - /** Settings tier. */ - public tier: string; - - /** Settings kind. */ - public kind: string; - - /** Settings userLabels. */ - public userLabels: { [k: string]: string }; - - /** Settings availabilityType. */ - public availabilityType: (google.cloud.sql.v1.SqlAvailabilityType|keyof typeof google.cloud.sql.v1.SqlAvailabilityType); - - /** Settings pricingPlan. */ - public pricingPlan: (google.cloud.sql.v1.SqlPricingPlan|keyof typeof google.cloud.sql.v1.SqlPricingPlan); - - /** Settings replicationType. */ - public replicationType: (google.cloud.sql.v1.SqlReplicationType|keyof typeof google.cloud.sql.v1.SqlReplicationType); - - /** Settings storageAutoResizeLimit. */ - public storageAutoResizeLimit?: (google.protobuf.IInt64Value|null); - - /** Settings activationPolicy. */ - public activationPolicy: (google.cloud.sql.v1.Settings.SqlActivationPolicy|keyof typeof google.cloud.sql.v1.Settings.SqlActivationPolicy); - - /** Settings ipConfiguration. */ - public ipConfiguration?: (google.cloud.sql.v1.IIpConfiguration|null); - - /** Settings storageAutoResize. */ - public storageAutoResize?: (google.protobuf.IBoolValue|null); - - /** Settings locationPreference. */ - public locationPreference?: (google.cloud.sql.v1.ILocationPreference|null); - - /** Settings databaseFlags. */ - public databaseFlags: google.cloud.sql.v1.IDatabaseFlags[]; - - /** Settings dataDiskType. */ - public dataDiskType: (google.cloud.sql.v1.SqlDataDiskType|keyof typeof google.cloud.sql.v1.SqlDataDiskType); - - /** Settings maintenanceWindow. */ - public maintenanceWindow?: (google.cloud.sql.v1.IMaintenanceWindow|null); - - /** Settings backupConfiguration. */ - public backupConfiguration?: (google.cloud.sql.v1.IBackupConfiguration|null); - - /** Settings databaseReplicationEnabled. */ - public databaseReplicationEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings crashSafeReplicationEnabled. */ - public crashSafeReplicationEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings dataDiskSizeGb. */ - public dataDiskSizeGb?: (google.protobuf.IInt64Value|null); - - /** Settings activeDirectoryConfig. */ - public activeDirectoryConfig?: (google.cloud.sql.v1.ISqlActiveDirectoryConfig|null); - - /** Settings collation. */ - public collation: string; - - /** Settings denyMaintenancePeriods. */ - public denyMaintenancePeriods: google.cloud.sql.v1.IDenyMaintenancePeriod[]; - - /** Settings insightsConfig. */ - public insightsConfig?: (google.cloud.sql.v1.IInsightsConfig|null); - - /** Settings passwordValidationPolicy. */ - public passwordValidationPolicy?: (google.cloud.sql.v1.IPasswordValidationPolicy|null); - - /** Settings sqlServerAuditConfig. */ - public sqlServerAuditConfig?: (google.cloud.sql.v1.ISqlServerAuditConfig|null); - - /** Settings edition. */ - public edition: (google.cloud.sql.v1.Settings.Edition|keyof typeof google.cloud.sql.v1.Settings.Edition); - - /** Settings connectorEnforcement. */ - public connectorEnforcement: (google.cloud.sql.v1.Settings.ConnectorEnforcement|keyof typeof google.cloud.sql.v1.Settings.ConnectorEnforcement); - - /** Settings deletionProtectionEnabled. */ - public deletionProtectionEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings timeZone. */ - public timeZone: string; - - /** Settings advancedMachineFeatures. */ - public advancedMachineFeatures?: (google.cloud.sql.v1.IAdvancedMachineFeatures|null); - - /** Settings dataCacheConfig. */ - public dataCacheConfig?: (google.cloud.sql.v1.IDataCacheConfig|null); - - /** Settings replicationLagMaxSeconds. */ - public replicationLagMaxSeconds?: (google.protobuf.IInt32Value|null); - - /** Settings enableGoogleMlIntegration. */ - public enableGoogleMlIntegration?: (google.protobuf.IBoolValue|null); - - /** Settings enableDataplexIntegration. */ - public enableDataplexIntegration?: (google.protobuf.IBoolValue|null); - - /** Settings retainBackupsOnDelete. */ - public retainBackupsOnDelete?: (google.protobuf.IBoolValue|null); - - /** Settings dataDiskProvisionedIops. */ - public dataDiskProvisionedIops?: (number|Long|string|null); - - /** Settings dataDiskProvisionedThroughput. */ - public dataDiskProvisionedThroughput?: (number|Long|string|null); - - /** Settings connectionPoolConfig. */ - public connectionPoolConfig?: (google.cloud.sql.v1.IConnectionPoolConfig|null); - - /** Settings finalBackupConfig. */ - public finalBackupConfig?: (google.cloud.sql.v1.IFinalBackupConfig|null); - - /** Settings readPoolAutoScaleConfig. */ - public readPoolAutoScaleConfig?: (google.cloud.sql.v1.IReadPoolAutoScaleConfig|null); - - /** Settings acceleratedReplicaMode. */ - public acceleratedReplicaMode?: (google.protobuf.IBoolValue|null); - - /** Settings autoUpgradeEnabled. */ - public autoUpgradeEnabled?: (boolean|null); - - /** Settings entraidConfig. */ - public entraidConfig?: (google.cloud.sql.v1.ISqlServerEntraIdConfig|null); - - /** Settings dataApiAccess. */ - public dataApiAccess?: (google.cloud.sql.v1.Settings.DataApiAccess|keyof typeof google.cloud.sql.v1.Settings.DataApiAccess|null); - - /** Settings performanceCaptureConfig. */ - public performanceCaptureConfig?: (google.cloud.sql.v1.IPerformanceCaptureConfig|null); - - /** - * Creates a new Settings instance using the specified properties. - * @param [properties] Properties to set - * @returns Settings instance - */ - public static create(properties?: google.cloud.sql.v1.ISettings): google.cloud.sql.v1.Settings; - - /** - * Encodes the specified Settings message. Does not implicitly {@link google.cloud.sql.v1.Settings.verify|verify} messages. - * @param message Settings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Settings.verify|verify} messages. - * @param message Settings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Settings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Settings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Settings; - - /** - * Decodes a Settings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Settings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Settings; - - /** - * Verifies a Settings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Settings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Settings - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Settings; - - /** - * Creates a plain object from a Settings message. Also converts values to other types if specified. - * @param message Settings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.Settings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Settings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Settings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Settings { - - /** SqlActivationPolicy enum. */ - enum SqlActivationPolicy { - SQL_ACTIVATION_POLICY_UNSPECIFIED = 0, - ALWAYS = 1, - NEVER = 2, - ON_DEMAND = 3 - } - - /** Edition enum. */ - enum Edition { - EDITION_UNSPECIFIED = 0, - ENTERPRISE = 2, - ENTERPRISE_PLUS = 3 - } - - /** ConnectorEnforcement enum. */ - enum ConnectorEnforcement { - CONNECTOR_ENFORCEMENT_UNSPECIFIED = 0, - NOT_REQUIRED = 1, - REQUIRED = 2 - } - - /** DataApiAccess enum. */ - enum DataApiAccess { - DATA_API_ACCESS_UNSPECIFIED = 0, - DISALLOW_DATA_API = 1, - ALLOW_DATA_API = 2 - } - } - - /** Properties of a PerformanceCaptureConfig. */ - interface IPerformanceCaptureConfig { - - /** PerformanceCaptureConfig enabled */ - enabled?: (boolean|null); - - /** PerformanceCaptureConfig probingIntervalSeconds */ - probingIntervalSeconds?: (number|null); - - /** PerformanceCaptureConfig probeThreshold */ - probeThreshold?: (number|null); - - /** PerformanceCaptureConfig runningThreadsThreshold */ - runningThreadsThreshold?: (number|null); - - /** PerformanceCaptureConfig secondsBehindSourceThreshold */ - secondsBehindSourceThreshold?: (number|null); - - /** PerformanceCaptureConfig transactionDurationThreshold */ - transactionDurationThreshold?: (number|null); - } - - /** Represents a PerformanceCaptureConfig. */ - class PerformanceCaptureConfig implements IPerformanceCaptureConfig { - - /** - * Constructs a new PerformanceCaptureConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IPerformanceCaptureConfig); - - /** PerformanceCaptureConfig enabled. */ - public enabled?: (boolean|null); - - /** PerformanceCaptureConfig probingIntervalSeconds. */ - public probingIntervalSeconds?: (number|null); - - /** PerformanceCaptureConfig probeThreshold. */ - public probeThreshold?: (number|null); - - /** PerformanceCaptureConfig runningThreadsThreshold. */ - public runningThreadsThreshold?: (number|null); - - /** PerformanceCaptureConfig secondsBehindSourceThreshold. */ - public secondsBehindSourceThreshold?: (number|null); - - /** PerformanceCaptureConfig transactionDurationThreshold. */ - public transactionDurationThreshold?: (number|null); - - /** - * Creates a new PerformanceCaptureConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns PerformanceCaptureConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IPerformanceCaptureConfig): google.cloud.sql.v1.PerformanceCaptureConfig; - - /** - * Encodes the specified PerformanceCaptureConfig message. Does not implicitly {@link google.cloud.sql.v1.PerformanceCaptureConfig.verify|verify} messages. - * @param message PerformanceCaptureConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IPerformanceCaptureConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PerformanceCaptureConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PerformanceCaptureConfig.verify|verify} messages. - * @param message PerformanceCaptureConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IPerformanceCaptureConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PerformanceCaptureConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PerformanceCaptureConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PerformanceCaptureConfig; - - /** - * Decodes a PerformanceCaptureConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PerformanceCaptureConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PerformanceCaptureConfig; - - /** - * Verifies a PerformanceCaptureConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PerformanceCaptureConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PerformanceCaptureConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PerformanceCaptureConfig; - - /** - * Creates a plain object from a PerformanceCaptureConfig message. Also converts values to other types if specified. - * @param message PerformanceCaptureConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.PerformanceCaptureConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PerformanceCaptureConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PerformanceCaptureConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ConnectionPoolFlags. */ - interface IConnectionPoolFlags { - - /** ConnectionPoolFlags name */ - name?: (string|null); - - /** ConnectionPoolFlags value */ - value?: (string|null); - } - - /** Represents a ConnectionPoolFlags. */ - class ConnectionPoolFlags implements IConnectionPoolFlags { - - /** - * Constructs a new ConnectionPoolFlags. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IConnectionPoolFlags); - - /** ConnectionPoolFlags name. */ - public name: string; - - /** ConnectionPoolFlags value. */ - public value: string; - - /** - * Creates a new ConnectionPoolFlags instance using the specified properties. - * @param [properties] Properties to set - * @returns ConnectionPoolFlags instance - */ - public static create(properties?: google.cloud.sql.v1.IConnectionPoolFlags): google.cloud.sql.v1.ConnectionPoolFlags; - - /** - * Encodes the specified ConnectionPoolFlags message. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolFlags.verify|verify} messages. - * @param message ConnectionPoolFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IConnectionPoolFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ConnectionPoolFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolFlags.verify|verify} messages. - * @param message ConnectionPoolFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IConnectionPoolFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ConnectionPoolFlags message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConnectionPoolFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ConnectionPoolFlags; - - /** - * Decodes a ConnectionPoolFlags message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConnectionPoolFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ConnectionPoolFlags; - - /** - * Verifies a ConnectionPoolFlags message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ConnectionPoolFlags message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConnectionPoolFlags - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ConnectionPoolFlags; - - /** - * Creates a plain object from a ConnectionPoolFlags message. Also converts values to other types if specified. - * @param message ConnectionPoolFlags - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ConnectionPoolFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ConnectionPoolFlags to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ConnectionPoolFlags - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ConnectionPoolConfig. */ - interface IConnectionPoolConfig { - - /** ConnectionPoolConfig connectionPoolingEnabled */ - connectionPoolingEnabled?: (boolean|null); - - /** ConnectionPoolConfig flags */ - flags?: (google.cloud.sql.v1.IConnectionPoolFlags[]|null); - - /** ConnectionPoolConfig poolerCount */ - poolerCount?: (number|null); - } - - /** Represents a ConnectionPoolConfig. */ - class ConnectionPoolConfig implements IConnectionPoolConfig { - - /** - * Constructs a new ConnectionPoolConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IConnectionPoolConfig); - - /** ConnectionPoolConfig connectionPoolingEnabled. */ - public connectionPoolingEnabled?: (boolean|null); - - /** ConnectionPoolConfig flags. */ - public flags: google.cloud.sql.v1.IConnectionPoolFlags[]; - - /** ConnectionPoolConfig poolerCount. */ - public poolerCount?: (number|null); - - /** - * Creates a new ConnectionPoolConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ConnectionPoolConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IConnectionPoolConfig): google.cloud.sql.v1.ConnectionPoolConfig; - - /** - * Encodes the specified ConnectionPoolConfig message. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolConfig.verify|verify} messages. - * @param message ConnectionPoolConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IConnectionPoolConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ConnectionPoolConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolConfig.verify|verify} messages. - * @param message ConnectionPoolConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IConnectionPoolConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ConnectionPoolConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConnectionPoolConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ConnectionPoolConfig; - - /** - * Decodes a ConnectionPoolConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConnectionPoolConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ConnectionPoolConfig; - - /** - * Verifies a ConnectionPoolConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ConnectionPoolConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConnectionPoolConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ConnectionPoolConfig; - - /** - * Creates a plain object from a ConnectionPoolConfig message. Also converts values to other types if specified. - * @param message ConnectionPoolConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ConnectionPoolConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ConnectionPoolConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ConnectionPoolConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ReadPoolAutoScaleConfig. */ - interface IReadPoolAutoScaleConfig { - - /** ReadPoolAutoScaleConfig enabled */ - enabled?: (boolean|null); - - /** ReadPoolAutoScaleConfig minNodeCount */ - minNodeCount?: (number|null); - - /** ReadPoolAutoScaleConfig maxNodeCount */ - maxNodeCount?: (number|null); - - /** ReadPoolAutoScaleConfig targetMetrics */ - targetMetrics?: (google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric[]|null); - - /** ReadPoolAutoScaleConfig disableScaleIn */ - disableScaleIn?: (boolean|null); - - /** ReadPoolAutoScaleConfig scaleInCooldownSeconds */ - scaleInCooldownSeconds?: (number|null); - - /** ReadPoolAutoScaleConfig scaleOutCooldownSeconds */ - scaleOutCooldownSeconds?: (number|null); - } - - /** Represents a ReadPoolAutoScaleConfig. */ - class ReadPoolAutoScaleConfig implements IReadPoolAutoScaleConfig { - - /** - * Constructs a new ReadPoolAutoScaleConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IReadPoolAutoScaleConfig); - - /** ReadPoolAutoScaleConfig enabled. */ - public enabled?: (boolean|null); - - /** ReadPoolAutoScaleConfig minNodeCount. */ - public minNodeCount?: (number|null); - - /** ReadPoolAutoScaleConfig maxNodeCount. */ - public maxNodeCount?: (number|null); - - /** ReadPoolAutoScaleConfig targetMetrics. */ - public targetMetrics: google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric[]; - - /** ReadPoolAutoScaleConfig disableScaleIn. */ - public disableScaleIn?: (boolean|null); - - /** ReadPoolAutoScaleConfig scaleInCooldownSeconds. */ - public scaleInCooldownSeconds?: (number|null); - - /** ReadPoolAutoScaleConfig scaleOutCooldownSeconds. */ - public scaleOutCooldownSeconds?: (number|null); - - /** - * Creates a new ReadPoolAutoScaleConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ReadPoolAutoScaleConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IReadPoolAutoScaleConfig): google.cloud.sql.v1.ReadPoolAutoScaleConfig; - - /** - * Encodes the specified ReadPoolAutoScaleConfig message. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.verify|verify} messages. - * @param message ReadPoolAutoScaleConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IReadPoolAutoScaleConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReadPoolAutoScaleConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.verify|verify} messages. - * @param message ReadPoolAutoScaleConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IReadPoolAutoScaleConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReadPoolAutoScaleConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ReadPoolAutoScaleConfig; - - /** - * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReadPoolAutoScaleConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ReadPoolAutoScaleConfig; - - /** - * Verifies a ReadPoolAutoScaleConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ReadPoolAutoScaleConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReadPoolAutoScaleConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ReadPoolAutoScaleConfig; - - /** - * Creates a plain object from a ReadPoolAutoScaleConfig message. Also converts values to other types if specified. - * @param message ReadPoolAutoScaleConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ReadPoolAutoScaleConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReadPoolAutoScaleConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReadPoolAutoScaleConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ReadPoolAutoScaleConfig { - - /** Properties of a TargetMetric. */ - interface ITargetMetric { - - /** TargetMetric metric */ - metric?: (string|null); - - /** TargetMetric targetValue */ - targetValue?: (number|null); - } - - /** Represents a TargetMetric. */ - class TargetMetric implements ITargetMetric { - - /** - * Constructs a new TargetMetric. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric); - - /** TargetMetric metric. */ - public metric?: (string|null); - - /** TargetMetric targetValue. */ - public targetValue?: (number|null); - - /** - * Creates a new TargetMetric instance using the specified properties. - * @param [properties] Properties to set - * @returns TargetMetric instance - */ - public static create(properties?: google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric): google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric; - - /** - * Encodes the specified TargetMetric message. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. - * @param message TargetMetric message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TargetMetric message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. - * @param message TargetMetric message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TargetMetric message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TargetMetric - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric; - - /** - * Decodes a TargetMetric message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TargetMetric - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric; - - /** - * Verifies a TargetMetric message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a TargetMetric message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TargetMetric - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric; - - /** - * Creates a plain object from a TargetMetric message. Also converts values to other types if specified. - * @param message TargetMetric - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TargetMetric to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TargetMetric - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of an AdvancedMachineFeatures. */ - interface IAdvancedMachineFeatures { - - /** AdvancedMachineFeatures threadsPerCore */ - threadsPerCore?: (number|null); - } - - /** Represents an AdvancedMachineFeatures. */ - class AdvancedMachineFeatures implements IAdvancedMachineFeatures { - - /** - * Constructs a new AdvancedMachineFeatures. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IAdvancedMachineFeatures); - - /** AdvancedMachineFeatures threadsPerCore. */ - public threadsPerCore: number; - - /** - * Creates a new AdvancedMachineFeatures instance using the specified properties. - * @param [properties] Properties to set - * @returns AdvancedMachineFeatures instance - */ - public static create(properties?: google.cloud.sql.v1.IAdvancedMachineFeatures): google.cloud.sql.v1.AdvancedMachineFeatures; - - /** - * Encodes the specified AdvancedMachineFeatures message. Does not implicitly {@link google.cloud.sql.v1.AdvancedMachineFeatures.verify|verify} messages. - * @param message AdvancedMachineFeatures message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IAdvancedMachineFeatures, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AdvancedMachineFeatures message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AdvancedMachineFeatures.verify|verify} messages. - * @param message AdvancedMachineFeatures message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IAdvancedMachineFeatures, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AdvancedMachineFeatures message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AdvancedMachineFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.AdvancedMachineFeatures; - - /** - * Decodes an AdvancedMachineFeatures message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AdvancedMachineFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.AdvancedMachineFeatures; - - /** - * Verifies an AdvancedMachineFeatures message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an AdvancedMachineFeatures message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AdvancedMachineFeatures - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.AdvancedMachineFeatures; - - /** - * Creates a plain object from an AdvancedMachineFeatures message. Also converts values to other types if specified. - * @param message AdvancedMachineFeatures - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.AdvancedMachineFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AdvancedMachineFeatures to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AdvancedMachineFeatures - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCert. */ - interface ISslCert { - - /** SslCert kind */ - kind?: (string|null); - - /** SslCert certSerialNumber */ - certSerialNumber?: (string|null); - - /** SslCert cert */ - cert?: (string|null); - - /** SslCert createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** SslCert commonName */ - commonName?: (string|null); - - /** SslCert expirationTime */ - expirationTime?: (google.protobuf.ITimestamp|null); - - /** SslCert sha1Fingerprint */ - sha1Fingerprint?: (string|null); - - /** SslCert instance */ - instance?: (string|null); - - /** SslCert selfLink */ - selfLink?: (string|null); - } - - /** Represents a SslCert. */ - class SslCert implements ISslCert { - - /** - * Constructs a new SslCert. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISslCert); - - /** SslCert kind. */ - public kind: string; - - /** SslCert certSerialNumber. */ - public certSerialNumber: string; - - /** SslCert cert. */ - public cert: string; - - /** SslCert createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** SslCert commonName. */ - public commonName: string; - - /** SslCert expirationTime. */ - public expirationTime?: (google.protobuf.ITimestamp|null); - - /** SslCert sha1Fingerprint. */ - public sha1Fingerprint: string; - - /** SslCert instance. */ - public instance: string; - - /** SslCert selfLink. */ - public selfLink: string; - - /** - * Creates a new SslCert instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCert instance - */ - public static create(properties?: google.cloud.sql.v1.ISslCert): google.cloud.sql.v1.SslCert; - - /** - * Encodes the specified SslCert message. Does not implicitly {@link google.cloud.sql.v1.SslCert.verify|verify} messages. - * @param message SslCert message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISslCert, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCert message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCert.verify|verify} messages. - * @param message SslCert message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISslCert, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCert message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCert - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCert; - - /** - * Decodes a SslCert message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCert - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCert; - - /** - * Verifies a SslCert message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCert message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCert - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCert; - - /** - * Creates a plain object from a SslCert message. Also converts values to other types if specified. - * @param message SslCert - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SslCert, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCert to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCert - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCertDetail. */ - interface ISslCertDetail { - - /** SslCertDetail certInfo */ - certInfo?: (google.cloud.sql.v1.ISslCert|null); - - /** SslCertDetail certPrivateKey */ - certPrivateKey?: (string|null); - } - - /** Represents a SslCertDetail. */ - class SslCertDetail implements ISslCertDetail { - - /** - * Constructs a new SslCertDetail. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISslCertDetail); - - /** SslCertDetail certInfo. */ - public certInfo?: (google.cloud.sql.v1.ISslCert|null); - - /** SslCertDetail certPrivateKey. */ - public certPrivateKey: string; - - /** - * Creates a new SslCertDetail instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCertDetail instance - */ - public static create(properties?: google.cloud.sql.v1.ISslCertDetail): google.cloud.sql.v1.SslCertDetail; - - /** - * Encodes the specified SslCertDetail message. Does not implicitly {@link google.cloud.sql.v1.SslCertDetail.verify|verify} messages. - * @param message SslCertDetail message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISslCertDetail, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCertDetail message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertDetail.verify|verify} messages. - * @param message SslCertDetail message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISslCertDetail, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCertDetail message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCertDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCertDetail; - - /** - * Decodes a SslCertDetail message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCertDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCertDetail; - - /** - * Verifies a SslCertDetail message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCertDetail message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCertDetail - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCertDetail; - - /** - * Creates a plain object from a SslCertDetail message. Also converts values to other types if specified. - * @param message SslCertDetail - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SslCertDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCertDetail to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCertDetail - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlActiveDirectoryConfig. */ - interface ISqlActiveDirectoryConfig { - - /** SqlActiveDirectoryConfig kind */ - kind?: (string|null); - - /** SqlActiveDirectoryConfig domain */ - domain?: (string|null); - - /** SqlActiveDirectoryConfig mode */ - mode?: (google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode|keyof typeof google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode|null); - - /** SqlActiveDirectoryConfig dnsServers */ - dnsServers?: (string[]|null); - - /** SqlActiveDirectoryConfig adminCredentialSecretName */ - adminCredentialSecretName?: (string|null); - - /** SqlActiveDirectoryConfig organizationalUnit */ - organizationalUnit?: (string|null); - } - - /** Represents a SqlActiveDirectoryConfig. */ - class SqlActiveDirectoryConfig implements ISqlActiveDirectoryConfig { - - /** - * Constructs a new SqlActiveDirectoryConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlActiveDirectoryConfig); - - /** SqlActiveDirectoryConfig kind. */ - public kind: string; - - /** SqlActiveDirectoryConfig domain. */ - public domain: string; - - /** SqlActiveDirectoryConfig mode. */ - public mode: (google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode|keyof typeof google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode); - - /** SqlActiveDirectoryConfig dnsServers. */ - public dnsServers: string[]; - - /** SqlActiveDirectoryConfig adminCredentialSecretName. */ - public adminCredentialSecretName: string; - - /** SqlActiveDirectoryConfig organizationalUnit. */ - public organizationalUnit: string; - - /** - * Creates a new SqlActiveDirectoryConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlActiveDirectoryConfig instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlActiveDirectoryConfig): google.cloud.sql.v1.SqlActiveDirectoryConfig; - - /** - * Encodes the specified SqlActiveDirectoryConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlActiveDirectoryConfig.verify|verify} messages. - * @param message SqlActiveDirectoryConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlActiveDirectoryConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlActiveDirectoryConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlActiveDirectoryConfig.verify|verify} messages. - * @param message SqlActiveDirectoryConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlActiveDirectoryConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlActiveDirectoryConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlActiveDirectoryConfig; - - /** - * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlActiveDirectoryConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlActiveDirectoryConfig; - - /** - * Verifies a SqlActiveDirectoryConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlActiveDirectoryConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlActiveDirectoryConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlActiveDirectoryConfig; - - /** - * Creates a plain object from a SqlActiveDirectoryConfig message. Also converts values to other types if specified. - * @param message SqlActiveDirectoryConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlActiveDirectoryConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlActiveDirectoryConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlActiveDirectoryConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlActiveDirectoryConfig { - - /** ActiveDirectoryMode enum. */ - enum ActiveDirectoryMode { - ACTIVE_DIRECTORY_MODE_UNSPECIFIED = 0, - MANAGED_ACTIVE_DIRECTORY = 1, - SELF_MANAGED_ACTIVE_DIRECTORY = 2, - CUSTOMER_MANAGED_ACTIVE_DIRECTORY = 3 - } - } - - /** Properties of a SqlServerAuditConfig. */ - interface ISqlServerAuditConfig { - - /** SqlServerAuditConfig kind */ - kind?: (string|null); - - /** SqlServerAuditConfig bucket */ - bucket?: (string|null); - - /** SqlServerAuditConfig retentionInterval */ - retentionInterval?: (google.protobuf.IDuration|null); - - /** SqlServerAuditConfig uploadInterval */ - uploadInterval?: (google.protobuf.IDuration|null); - } - - /** Represents a SqlServerAuditConfig. */ - class SqlServerAuditConfig implements ISqlServerAuditConfig { - - /** - * Constructs a new SqlServerAuditConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlServerAuditConfig); - - /** SqlServerAuditConfig kind. */ - public kind: string; - - /** SqlServerAuditConfig bucket. */ - public bucket: string; - - /** SqlServerAuditConfig retentionInterval. */ - public retentionInterval?: (google.protobuf.IDuration|null); - - /** SqlServerAuditConfig uploadInterval. */ - public uploadInterval?: (google.protobuf.IDuration|null); - - /** - * Creates a new SqlServerAuditConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlServerAuditConfig instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlServerAuditConfig): google.cloud.sql.v1.SqlServerAuditConfig; - - /** - * Encodes the specified SqlServerAuditConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlServerAuditConfig.verify|verify} messages. - * @param message SqlServerAuditConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlServerAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlServerAuditConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerAuditConfig.verify|verify} messages. - * @param message SqlServerAuditConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlServerAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlServerAuditConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlServerAuditConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlServerAuditConfig; - - /** - * Decodes a SqlServerAuditConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlServerAuditConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlServerAuditConfig; - - /** - * Verifies a SqlServerAuditConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlServerAuditConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlServerAuditConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlServerAuditConfig; - - /** - * Creates a plain object from a SqlServerAuditConfig message. Also converts values to other types if specified. - * @param message SqlServerAuditConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlServerAuditConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlServerAuditConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlServerAuditConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlServerEntraIdConfig. */ - interface ISqlServerEntraIdConfig { - - /** SqlServerEntraIdConfig kind */ - kind?: (string|null); - - /** SqlServerEntraIdConfig tenantId */ - tenantId?: (string|null); - - /** SqlServerEntraIdConfig applicationId */ - applicationId?: (string|null); - } - - /** Represents a SqlServerEntraIdConfig. */ - class SqlServerEntraIdConfig implements ISqlServerEntraIdConfig { - - /** - * Constructs a new SqlServerEntraIdConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlServerEntraIdConfig); - - /** SqlServerEntraIdConfig kind. */ - public kind: string; - - /** SqlServerEntraIdConfig tenantId. */ - public tenantId: string; - - /** SqlServerEntraIdConfig applicationId. */ - public applicationId: string; - - /** - * Creates a new SqlServerEntraIdConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlServerEntraIdConfig instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlServerEntraIdConfig): google.cloud.sql.v1.SqlServerEntraIdConfig; - - /** - * Encodes the specified SqlServerEntraIdConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlServerEntraIdConfig.verify|verify} messages. - * @param message SqlServerEntraIdConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlServerEntraIdConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlServerEntraIdConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerEntraIdConfig.verify|verify} messages. - * @param message SqlServerEntraIdConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlServerEntraIdConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlServerEntraIdConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlServerEntraIdConfig; - - /** - * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlServerEntraIdConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlServerEntraIdConfig; - - /** - * Verifies a SqlServerEntraIdConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlServerEntraIdConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlServerEntraIdConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlServerEntraIdConfig; - - /** - * Creates a plain object from a SqlServerEntraIdConfig message. Also converts values to other types if specified. - * @param message SqlServerEntraIdConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlServerEntraIdConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlServerEntraIdConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlServerEntraIdConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlBackendType enum. */ - enum SqlBackendType { - SQL_BACKEND_TYPE_UNSPECIFIED = 0, - FIRST_GEN = 1, - SECOND_GEN = 2, - EXTERNAL = 3 - } - - /** SqlIpAddressType enum. */ - enum SqlIpAddressType { - SQL_IP_ADDRESS_TYPE_UNSPECIFIED = 0, - PRIMARY = 1, - OUTGOING = 2, - PRIVATE = 3, - MIGRATED_1ST_GEN = 4 - } - - /** SqlDatabaseVersion enum. */ - enum SqlDatabaseVersion { - SQL_DATABASE_VERSION_UNSPECIFIED = 0, - MYSQL_5_1 = 2, - MYSQL_5_5 = 3, - MYSQL_5_6 = 5, - MYSQL_5_7 = 6, - MYSQL_8_0 = 20, - MYSQL_8_0_18 = 41, - MYSQL_8_0_26 = 85, - MYSQL_8_0_27 = 111, - MYSQL_8_0_28 = 132, - MYSQL_8_0_29 = 148, - MYSQL_8_0_30 = 174, - MYSQL_8_0_31 = 197, - MYSQL_8_0_32 = 213, - MYSQL_8_0_33 = 238, - MYSQL_8_0_34 = 239, - MYSQL_8_0_35 = 240, - MYSQL_8_0_36 = 241, - MYSQL_8_0_37 = 355, - MYSQL_8_0_39 = 357, - MYSQL_8_0_40 = 358, - MYSQL_8_0_41 = 488, - MYSQL_8_0_42 = 489, - MYSQL_8_0_43 = 553, - MYSQL_8_0_44 = 554, - MYSQL_8_0_45 = 555, - MYSQL_8_0_46 = 556, - MYSQL_8_4 = 398, - MYSQL_9_7 = 654, - SQLSERVER_2017_STANDARD = 11, - SQLSERVER_2017_ENTERPRISE = 14, - SQLSERVER_2017_EXPRESS = 15, - SQLSERVER_2017_WEB = 16, - POSTGRES_9_6 = 9, - POSTGRES_10 = 18, - POSTGRES_11 = 10, - POSTGRES_12 = 19, - POSTGRES_13 = 23, - POSTGRES_14 = 110, - POSTGRES_15 = 172, - POSTGRES_16 = 272, - POSTGRES_17 = 408, - POSTGRES_18 = 557, - POSTGRES_19 = 684, - SQLSERVER_2019_STANDARD = 26, - SQLSERVER_2019_ENTERPRISE = 27, - SQLSERVER_2019_EXPRESS = 28, - SQLSERVER_2019_WEB = 29, - SQLSERVER_2022_STANDARD = 199, - SQLSERVER_2022_ENTERPRISE = 200, - SQLSERVER_2022_EXPRESS = 201, - SQLSERVER_2022_WEB = 202, - SQLSERVER_2025_STANDARD = 549, - SQLSERVER_2025_ENTERPRISE = 550, - SQLSERVER_2025_EXPRESS = 551 - } - - /** SqlPricingPlan enum. */ - enum SqlPricingPlan { - SQL_PRICING_PLAN_UNSPECIFIED = 0, - PACKAGE = 1, - PER_USE = 2 - } - - /** SqlReplicationType enum. */ - enum SqlReplicationType { - SQL_REPLICATION_TYPE_UNSPECIFIED = 0, - SYNCHRONOUS = 1, - ASYNCHRONOUS = 2 - } - - /** SqlDataDiskType enum. */ - enum SqlDataDiskType { - SQL_DATA_DISK_TYPE_UNSPECIFIED = 0, - PD_SSD = 1, - PD_HDD = 2, - OBSOLETE_LOCAL_SSD = 3, - HYPERDISK_BALANCED = 4 - } - - /** SqlAvailabilityType enum. */ - enum SqlAvailabilityType { - SQL_AVAILABILITY_TYPE_UNSPECIFIED = 0, - ZONAL = 1, - REGIONAL = 2 - } - - /** SqlUpdateTrack enum. */ - enum SqlUpdateTrack { - SQL_UPDATE_TRACK_UNSPECIFIED = 0, - canary = 1, - stable = 2, - week5 = 3 - } - - /** Properties of an AcquireSsrsLeaseContext. */ - interface IAcquireSsrsLeaseContext { - - /** AcquireSsrsLeaseContext setupLogin */ - setupLogin?: (string|null); - - /** AcquireSsrsLeaseContext serviceLogin */ - serviceLogin?: (string|null); - - /** AcquireSsrsLeaseContext reportDatabase */ - reportDatabase?: (string|null); - - /** AcquireSsrsLeaseContext duration */ - duration?: (google.protobuf.IDuration|null); - } - - /** Represents an AcquireSsrsLeaseContext. */ - class AcquireSsrsLeaseContext implements IAcquireSsrsLeaseContext { - - /** - * Constructs a new AcquireSsrsLeaseContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IAcquireSsrsLeaseContext); - - /** AcquireSsrsLeaseContext setupLogin. */ - public setupLogin?: (string|null); - - /** AcquireSsrsLeaseContext serviceLogin. */ - public serviceLogin?: (string|null); - - /** AcquireSsrsLeaseContext reportDatabase. */ - public reportDatabase?: (string|null); - - /** AcquireSsrsLeaseContext duration. */ - public duration?: (google.protobuf.IDuration|null); - - /** - * Creates a new AcquireSsrsLeaseContext instance using the specified properties. - * @param [properties] Properties to set - * @returns AcquireSsrsLeaseContext instance - */ - public static create(properties?: google.cloud.sql.v1.IAcquireSsrsLeaseContext): google.cloud.sql.v1.AcquireSsrsLeaseContext; - - /** - * Encodes the specified AcquireSsrsLeaseContext message. Does not implicitly {@link google.cloud.sql.v1.AcquireSsrsLeaseContext.verify|verify} messages. - * @param message AcquireSsrsLeaseContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IAcquireSsrsLeaseContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AcquireSsrsLeaseContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AcquireSsrsLeaseContext.verify|verify} messages. - * @param message AcquireSsrsLeaseContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IAcquireSsrsLeaseContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AcquireSsrsLeaseContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.AcquireSsrsLeaseContext; - - /** - * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AcquireSsrsLeaseContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.AcquireSsrsLeaseContext; - - /** - * Verifies an AcquireSsrsLeaseContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an AcquireSsrsLeaseContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AcquireSsrsLeaseContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.AcquireSsrsLeaseContext; - - /** - * Creates a plain object from an AcquireSsrsLeaseContext message. Also converts values to other types if specified. - * @param message AcquireSsrsLeaseContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.AcquireSsrsLeaseContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AcquireSsrsLeaseContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AcquireSsrsLeaseContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DnsNameMapping. */ - interface IDnsNameMapping { - - /** DnsNameMapping name */ - name?: (string|null); - - /** DnsNameMapping connectionType */ - connectionType?: (google.cloud.sql.v1.DnsNameMapping.ConnectionType|keyof typeof google.cloud.sql.v1.DnsNameMapping.ConnectionType|null); - - /** DnsNameMapping dnsScope */ - dnsScope?: (google.cloud.sql.v1.DnsNameMapping.DnsScope|keyof typeof google.cloud.sql.v1.DnsNameMapping.DnsScope|null); - - /** DnsNameMapping recordManager */ - recordManager?: (google.cloud.sql.v1.DnsNameMapping.RecordManager|keyof typeof google.cloud.sql.v1.DnsNameMapping.RecordManager|null); - } - - /** Represents a DnsNameMapping. */ - class DnsNameMapping implements IDnsNameMapping { - - /** - * Constructs a new DnsNameMapping. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDnsNameMapping); - - /** DnsNameMapping name. */ - public name: string; - - /** DnsNameMapping connectionType. */ - public connectionType: (google.cloud.sql.v1.DnsNameMapping.ConnectionType|keyof typeof google.cloud.sql.v1.DnsNameMapping.ConnectionType); - - /** DnsNameMapping dnsScope. */ - public dnsScope: (google.cloud.sql.v1.DnsNameMapping.DnsScope|keyof typeof google.cloud.sql.v1.DnsNameMapping.DnsScope); - - /** DnsNameMapping recordManager. */ - public recordManager: (google.cloud.sql.v1.DnsNameMapping.RecordManager|keyof typeof google.cloud.sql.v1.DnsNameMapping.RecordManager); - - /** - * Creates a new DnsNameMapping instance using the specified properties. - * @param [properties] Properties to set - * @returns DnsNameMapping instance - */ - public static create(properties?: google.cloud.sql.v1.IDnsNameMapping): google.cloud.sql.v1.DnsNameMapping; - - /** - * Encodes the specified DnsNameMapping message. Does not implicitly {@link google.cloud.sql.v1.DnsNameMapping.verify|verify} messages. - * @param message DnsNameMapping message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDnsNameMapping, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DnsNameMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DnsNameMapping.verify|verify} messages. - * @param message DnsNameMapping message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDnsNameMapping, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DnsNameMapping message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DnsNameMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DnsNameMapping; - - /** - * Decodes a DnsNameMapping message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DnsNameMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DnsNameMapping; - - /** - * Verifies a DnsNameMapping message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DnsNameMapping message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DnsNameMapping - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DnsNameMapping; - - /** - * Creates a plain object from a DnsNameMapping message. Also converts values to other types if specified. - * @param message DnsNameMapping - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DnsNameMapping, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DnsNameMapping to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DnsNameMapping - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DnsNameMapping { - - /** ConnectionType enum. */ - enum ConnectionType { - CONNECTION_TYPE_UNSPECIFIED = 0, - PUBLIC = 1, - PRIVATE_SERVICES_ACCESS = 2, - PRIVATE_SERVICE_CONNECT = 3 - } - - /** DnsScope enum. */ - enum DnsScope { - DNS_SCOPE_UNSPECIFIED = 0, - INSTANCE = 1, - CLUSTER = 2 - } - - /** RecordManager enum. */ - enum RecordManager { - RECORD_MANAGER_UNSPECIFIED = 0, - CUSTOMER = 1, - CLOUD_SQL_AUTOMATION = 2 - } - } - - /** Represents a SqlBackupsService */ - class SqlBackupsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlBackupsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlBackupsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlBackupsService; - - /** - * Calls CreateBackup. - * @param request CreateBackupRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public createBackup(request: google.cloud.sql.v1.ICreateBackupRequest, callback: google.cloud.sql.v1.SqlBackupsService.CreateBackupCallback): void; - - /** - * Calls CreateBackup. - * @param request CreateBackupRequest message or plain object - * @returns Promise - */ - public createBackup(request: google.cloud.sql.v1.ICreateBackupRequest): Promise; - - /** - * Calls GetBackup. - * @param request GetBackupRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Backup - */ - public getBackup(request: google.cloud.sql.v1.IGetBackupRequest, callback: google.cloud.sql.v1.SqlBackupsService.GetBackupCallback): void; - - /** - * Calls GetBackup. - * @param request GetBackupRequest message or plain object - * @returns Promise - */ - public getBackup(request: google.cloud.sql.v1.IGetBackupRequest): Promise; - - /** - * Calls ListBackups. - * @param request ListBackupsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListBackupsResponse - */ - public listBackups(request: google.cloud.sql.v1.IListBackupsRequest, callback: google.cloud.sql.v1.SqlBackupsService.ListBackupsCallback): void; - - /** - * Calls ListBackups. - * @param request ListBackupsRequest message or plain object - * @returns Promise - */ - public listBackups(request: google.cloud.sql.v1.IListBackupsRequest): Promise; - - /** - * Calls UpdateBackup. - * @param request UpdateBackupRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public updateBackup(request: google.cloud.sql.v1.IUpdateBackupRequest, callback: google.cloud.sql.v1.SqlBackupsService.UpdateBackupCallback): void; - - /** - * Calls UpdateBackup. - * @param request UpdateBackupRequest message or plain object - * @returns Promise - */ - public updateBackup(request: google.cloud.sql.v1.IUpdateBackupRequest): Promise; - - /** - * Calls DeleteBackup. - * @param request DeleteBackupRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public deleteBackup(request: google.cloud.sql.v1.IDeleteBackupRequest, callback: google.cloud.sql.v1.SqlBackupsService.DeleteBackupCallback): void; - - /** - * Calls DeleteBackup. - * @param request DeleteBackupRequest message or plain object - * @returns Promise - */ - public deleteBackup(request: google.cloud.sql.v1.IDeleteBackupRequest): Promise; - } - - namespace SqlBackupsService { - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|createBackup}. - * @param error Error, if any - * @param [response] Operation - */ - type CreateBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|getBackup}. - * @param error Error, if any - * @param [response] Backup - */ - type GetBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1.Backup) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|listBackups}. - * @param error Error, if any - * @param [response] ListBackupsResponse - */ - type ListBackupsCallback = (error: (Error|null), response?: google.cloud.sql.v1.ListBackupsResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|updateBackup}. - * @param error Error, if any - * @param [response] Operation - */ - type UpdateBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|deleteBackup}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - } - - /** Properties of a CreateBackupRequest. */ - interface ICreateBackupRequest { - - /** CreateBackupRequest parent */ - parent?: (string|null); - - /** CreateBackupRequest backup */ - backup?: (google.cloud.sql.v1.IBackup|null); - } - - /** Represents a CreateBackupRequest. */ - class CreateBackupRequest implements ICreateBackupRequest { - - /** - * Constructs a new CreateBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ICreateBackupRequest); - - /** CreateBackupRequest parent. */ - public parent: string; - - /** CreateBackupRequest backup. */ - public backup?: (google.cloud.sql.v1.IBackup|null); - - /** - * Creates a new CreateBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ICreateBackupRequest): google.cloud.sql.v1.CreateBackupRequest; - - /** - * Encodes the specified CreateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.CreateBackupRequest.verify|verify} messages. - * @param message CreateBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ICreateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.CreateBackupRequest.verify|verify} messages. - * @param message CreateBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ICreateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.CreateBackupRequest; - - /** - * Decodes a CreateBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.CreateBackupRequest; - - /** - * Verifies a CreateBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CreateBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.CreateBackupRequest; - - /** - * Creates a plain object from a CreateBackupRequest message. Also converts values to other types if specified. - * @param message CreateBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.CreateBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetBackupRequest. */ - interface IGetBackupRequest { - - /** GetBackupRequest name */ - name?: (string|null); - } - - /** Represents a GetBackupRequest. */ - class GetBackupRequest implements IGetBackupRequest { - - /** - * Constructs a new GetBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IGetBackupRequest); - - /** GetBackupRequest name. */ - public name: string; - - /** - * Creates a new GetBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IGetBackupRequest): google.cloud.sql.v1.GetBackupRequest; - - /** - * Encodes the specified GetBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.GetBackupRequest.verify|verify} messages. - * @param message GetBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IGetBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GetBackupRequest.verify|verify} messages. - * @param message GetBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IGetBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.GetBackupRequest; - - /** - * Decodes a GetBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.GetBackupRequest; - - /** - * Verifies a GetBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GetBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.GetBackupRequest; - - /** - * Creates a plain object from a GetBackupRequest message. Also converts values to other types if specified. - * @param message GetBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.GetBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListBackupsRequest. */ - interface IListBackupsRequest { - - /** ListBackupsRequest parent */ - parent?: (string|null); - - /** ListBackupsRequest pageSize */ - pageSize?: (number|null); - - /** ListBackupsRequest pageToken */ - pageToken?: (string|null); - - /** ListBackupsRequest filter */ - filter?: (string|null); - } - - /** Represents a ListBackupsRequest. */ - class ListBackupsRequest implements IListBackupsRequest { - - /** - * Constructs a new ListBackupsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IListBackupsRequest); - - /** ListBackupsRequest parent. */ - public parent: string; - - /** ListBackupsRequest pageSize. */ - public pageSize: number; - - /** ListBackupsRequest pageToken. */ - public pageToken: string; - - /** ListBackupsRequest filter. */ - public filter: string; - - /** - * Creates a new ListBackupsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListBackupsRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IListBackupsRequest): google.cloud.sql.v1.ListBackupsRequest; - - /** - * Encodes the specified ListBackupsRequest message. Does not implicitly {@link google.cloud.sql.v1.ListBackupsRequest.verify|verify} messages. - * @param message ListBackupsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IListBackupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListBackupsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ListBackupsRequest.verify|verify} messages. - * @param message ListBackupsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IListBackupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListBackupsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListBackupsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ListBackupsRequest; - - /** - * Decodes a ListBackupsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListBackupsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ListBackupsRequest; - - /** - * Verifies a ListBackupsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ListBackupsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListBackupsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ListBackupsRequest; - - /** - * Creates a plain object from a ListBackupsRequest message. Also converts values to other types if specified. - * @param message ListBackupsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ListBackupsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListBackupsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListBackupsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListBackupsResponse. */ - interface IListBackupsResponse { - - /** ListBackupsResponse backups */ - backups?: (google.cloud.sql.v1.IBackup[]|null); - - /** ListBackupsResponse nextPageToken */ - nextPageToken?: (string|null); - - /** ListBackupsResponse warnings */ - warnings?: (google.cloud.sql.v1.IApiWarning[]|null); - } - - /** Represents a ListBackupsResponse. */ - class ListBackupsResponse implements IListBackupsResponse { - - /** - * Constructs a new ListBackupsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IListBackupsResponse); - - /** ListBackupsResponse backups. */ - public backups: google.cloud.sql.v1.IBackup[]; - - /** ListBackupsResponse nextPageToken. */ - public nextPageToken: string; - - /** ListBackupsResponse warnings. */ - public warnings: google.cloud.sql.v1.IApiWarning[]; - - /** - * Creates a new ListBackupsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListBackupsResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IListBackupsResponse): google.cloud.sql.v1.ListBackupsResponse; - - /** - * Encodes the specified ListBackupsResponse message. Does not implicitly {@link google.cloud.sql.v1.ListBackupsResponse.verify|verify} messages. - * @param message ListBackupsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IListBackupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListBackupsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ListBackupsResponse.verify|verify} messages. - * @param message ListBackupsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IListBackupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListBackupsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListBackupsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ListBackupsResponse; - - /** - * Decodes a ListBackupsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListBackupsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ListBackupsResponse; - - /** - * Verifies a ListBackupsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ListBackupsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListBackupsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ListBackupsResponse; - - /** - * Creates a plain object from a ListBackupsResponse message. Also converts values to other types if specified. - * @param message ListBackupsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ListBackupsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListBackupsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListBackupsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an UpdateBackupRequest. */ - interface IUpdateBackupRequest { - - /** UpdateBackupRequest backup */ - backup?: (google.cloud.sql.v1.IBackup|null); - - /** UpdateBackupRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - } - - /** Represents an UpdateBackupRequest. */ - class UpdateBackupRequest implements IUpdateBackupRequest { - - /** - * Constructs a new UpdateBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IUpdateBackupRequest); - - /** UpdateBackupRequest backup. */ - public backup?: (google.cloud.sql.v1.IBackup|null); - - /** UpdateBackupRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** - * Creates a new UpdateBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns UpdateBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IUpdateBackupRequest): google.cloud.sql.v1.UpdateBackupRequest; - - /** - * Encodes the specified UpdateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.UpdateBackupRequest.verify|verify} messages. - * @param message UpdateBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IUpdateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UpdateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UpdateBackupRequest.verify|verify} messages. - * @param message UpdateBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IUpdateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an UpdateBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UpdateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.UpdateBackupRequest; - - /** - * Decodes an UpdateBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UpdateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.UpdateBackupRequest; - - /** - * Verifies an UpdateBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an UpdateBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UpdateBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.UpdateBackupRequest; - - /** - * Creates a plain object from an UpdateBackupRequest message. Also converts values to other types if specified. - * @param message UpdateBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.UpdateBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UpdateBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UpdateBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteBackupRequest. */ - interface IDeleteBackupRequest { - - /** DeleteBackupRequest name */ - name?: (string|null); - } - - /** Represents a DeleteBackupRequest. */ - class DeleteBackupRequest implements IDeleteBackupRequest { - - /** - * Constructs a new DeleteBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDeleteBackupRequest); - - /** DeleteBackupRequest name. */ - public name: string; - - /** - * Creates a new DeleteBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IDeleteBackupRequest): google.cloud.sql.v1.DeleteBackupRequest; - - /** - * Encodes the specified DeleteBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.DeleteBackupRequest.verify|verify} messages. - * @param message DeleteBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDeleteBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DeleteBackupRequest.verify|verify} messages. - * @param message DeleteBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDeleteBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DeleteBackupRequest; - - /** - * Decodes a DeleteBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DeleteBackupRequest; - - /** - * Verifies a DeleteBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DeleteBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DeleteBackupRequest; - - /** - * Creates a plain object from a DeleteBackupRequest message. Also converts values to other types if specified. - * @param message DeleteBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DeleteBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Backup. */ - interface IBackup { - - /** Backup name */ - name?: (string|null); - - /** Backup kind */ - kind?: (string|null); - - /** Backup selfLink */ - selfLink?: (string|null); - - /** Backup type */ - type?: (google.cloud.sql.v1.Backup.SqlBackupType|keyof typeof google.cloud.sql.v1.Backup.SqlBackupType|null); - - /** Backup description */ - description?: (string|null); - - /** Backup instance */ - instance?: (string|null); - - /** Backup location */ - location?: (string|null); - - /** Backup backupInterval */ - backupInterval?: (google.type.IInterval|null); - - /** Backup state */ - state?: (google.cloud.sql.v1.Backup.SqlBackupState|keyof typeof google.cloud.sql.v1.Backup.SqlBackupState|null); - - /** Backup error */ - error?: (google.cloud.sql.v1.IOperationError|null); - - /** Backup kmsKey */ - kmsKey?: (string|null); - - /** Backup kmsKeyVersion */ - kmsKeyVersion?: (string|null); - - /** Backup backupKind */ - backupKind?: (google.cloud.sql.v1.SqlBackupKind|keyof typeof google.cloud.sql.v1.SqlBackupKind|null); - - /** Backup timeZone */ - timeZone?: (string|null); - - /** Backup ttlDays */ - ttlDays?: (number|Long|string|null); - - /** Backup expiryTime */ - expiryTime?: (google.protobuf.ITimestamp|null); - - /** Backup databaseVersion */ - databaseVersion?: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion|null); - - /** Backup maxChargeableBytes */ - maxChargeableBytes?: (number|Long|string|null); - - /** Backup instanceDeletionTime */ - instanceDeletionTime?: (google.protobuf.ITimestamp|null); - - /** Backup instanceSettings */ - instanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); - - /** Backup backupRun */ - backupRun?: (string|null); - - /** Backup satisfiesPzs */ - satisfiesPzs?: (google.protobuf.IBoolValue|null); - - /** Backup satisfiesPzi */ - satisfiesPzi?: (google.protobuf.IBoolValue|null); - } - - /** Represents a Backup. */ - class Backup implements IBackup { - - /** - * Constructs a new Backup. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IBackup); - - /** Backup name. */ - public name: string; - - /** Backup kind. */ - public kind: string; - - /** Backup selfLink. */ - public selfLink: string; - - /** Backup type. */ - public type: (google.cloud.sql.v1.Backup.SqlBackupType|keyof typeof google.cloud.sql.v1.Backup.SqlBackupType); - - /** Backup description. */ - public description: string; - - /** Backup instance. */ - public instance: string; - - /** Backup location. */ - public location: string; - - /** Backup backupInterval. */ - public backupInterval?: (google.type.IInterval|null); - - /** Backup state. */ - public state: (google.cloud.sql.v1.Backup.SqlBackupState|keyof typeof google.cloud.sql.v1.Backup.SqlBackupState); - - /** Backup error. */ - public error?: (google.cloud.sql.v1.IOperationError|null); - - /** Backup kmsKey. */ - public kmsKey: string; - - /** Backup kmsKeyVersion. */ - public kmsKeyVersion: string; - - /** Backup backupKind. */ - public backupKind: (google.cloud.sql.v1.SqlBackupKind|keyof typeof google.cloud.sql.v1.SqlBackupKind); - - /** Backup timeZone. */ - public timeZone: string; - - /** Backup ttlDays. */ - public ttlDays?: (number|Long|string|null); - - /** Backup expiryTime. */ - public expiryTime?: (google.protobuf.ITimestamp|null); - - /** Backup databaseVersion. */ - public databaseVersion: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion); - - /** Backup maxChargeableBytes. */ - public maxChargeableBytes?: (number|Long|string|null); - - /** Backup instanceDeletionTime. */ - public instanceDeletionTime?: (google.protobuf.ITimestamp|null); - - /** Backup instanceSettings. */ - public instanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); - - /** Backup backupRun. */ - public backupRun: string; - - /** Backup satisfiesPzs. */ - public satisfiesPzs?: (google.protobuf.IBoolValue|null); - - /** Backup satisfiesPzi. */ - public satisfiesPzi?: (google.protobuf.IBoolValue|null); - - /** Backup expiration. */ - public expiration?: ("ttlDays"|"expiryTime"); - - /** - * Creates a new Backup instance using the specified properties. - * @param [properties] Properties to set - * @returns Backup instance - */ - public static create(properties?: google.cloud.sql.v1.IBackup): google.cloud.sql.v1.Backup; - - /** - * Encodes the specified Backup message. Does not implicitly {@link google.cloud.sql.v1.Backup.verify|verify} messages. - * @param message Backup message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IBackup, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Backup message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Backup.verify|verify} messages. - * @param message Backup message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IBackup, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Backup message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Backup - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Backup; - - /** - * Decodes a Backup message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Backup - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Backup; - - /** - * Verifies a Backup message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Backup message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Backup - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Backup; - - /** - * Creates a plain object from a Backup message. Also converts values to other types if specified. - * @param message Backup - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.Backup, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Backup to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Backup - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Backup { - - /** SqlBackupType enum. */ - enum SqlBackupType { - SQL_BACKUP_TYPE_UNSPECIFIED = 0, - AUTOMATED = 1, - ON_DEMAND = 2, - FINAL = 3 - } - - /** SqlBackupState enum. */ - enum SqlBackupState { - SQL_BACKUP_STATE_UNSPECIFIED = 0, - ENQUEUED = 1, - RUNNING = 2, - FAILED = 3, - SUCCESSFUL = 4, - DELETING = 5, - DELETION_FAILED = 6 - } - } - - /** Represents a SqlInstancesService */ - class SqlInstancesService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlInstancesService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlInstancesService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlInstancesService; - - /** - * Calls AddServerCa. - * @param request SqlInstancesAddServerCaRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public addServerCa(request: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, callback: google.cloud.sql.v1.SqlInstancesService.AddServerCaCallback): void; - - /** - * Calls AddServerCa. - * @param request SqlInstancesAddServerCaRequest message or plain object - * @returns Promise - */ - public addServerCa(request: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest): Promise; - - /** - * Calls AddServerCertificate. - * @param request SqlInstancesAddServerCertificateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public addServerCertificate(request: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, callback: google.cloud.sql.v1.SqlInstancesService.AddServerCertificateCallback): void; - - /** - * Calls AddServerCertificate. - * @param request SqlInstancesAddServerCertificateRequest message or plain object - * @returns Promise - */ - public addServerCertificate(request: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest): Promise; - - /** - * Calls AddEntraIdCertificate. - * @param request SqlInstancesAddEntraIdCertificateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public addEntraIdCertificate(request: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, callback: google.cloud.sql.v1.SqlInstancesService.AddEntraIdCertificateCallback): void; - - /** - * Calls AddEntraIdCertificate. - * @param request SqlInstancesAddEntraIdCertificateRequest message or plain object - * @returns Promise - */ - public addEntraIdCertificate(request: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest): Promise; - - /** - * Calls Clone. - * @param request SqlInstancesCloneRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public clone(request: google.cloud.sql.v1.ISqlInstancesCloneRequest, callback: google.cloud.sql.v1.SqlInstancesService.CloneCallback): void; - - /** - * Calls Clone. - * @param request SqlInstancesCloneRequest message or plain object - * @returns Promise - */ - public clone(request: google.cloud.sql.v1.ISqlInstancesCloneRequest): Promise; - - /** - * Calls Delete. - * @param request SqlInstancesDeleteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public delete(request: google.cloud.sql.v1.ISqlInstancesDeleteRequest, callback: google.cloud.sql.v1.SqlInstancesService.DeleteCallback): void; - - /** - * Calls Delete. - * @param request SqlInstancesDeleteRequest message or plain object - * @returns Promise - */ - public delete(request: google.cloud.sql.v1.ISqlInstancesDeleteRequest): Promise; - - /** - * Calls DemoteMaster. - * @param request SqlInstancesDemoteMasterRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public demoteMaster(request: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, callback: google.cloud.sql.v1.SqlInstancesService.DemoteMasterCallback): void; - - /** - * Calls DemoteMaster. - * @param request SqlInstancesDemoteMasterRequest message or plain object - * @returns Promise - */ - public demoteMaster(request: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest): Promise; - - /** - * Calls Demote. - * @param request SqlInstancesDemoteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public demote(request: google.cloud.sql.v1.ISqlInstancesDemoteRequest, callback: google.cloud.sql.v1.SqlInstancesService.DemoteCallback): void; - - /** - * Calls Demote. - * @param request SqlInstancesDemoteRequest message or plain object - * @returns Promise - */ - public demote(request: google.cloud.sql.v1.ISqlInstancesDemoteRequest): Promise; - - /** - * Calls Export. - * @param request SqlInstancesExportRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public export(request: google.cloud.sql.v1.ISqlInstancesExportRequest, callback: google.cloud.sql.v1.SqlInstancesService.ExportCallback): void; - - /** - * Calls Export. - * @param request SqlInstancesExportRequest message or plain object - * @returns Promise - */ - public export(request: google.cloud.sql.v1.ISqlInstancesExportRequest): Promise; - - /** - * Calls Failover. - * @param request SqlInstancesFailoverRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public failover(request: google.cloud.sql.v1.ISqlInstancesFailoverRequest, callback: google.cloud.sql.v1.SqlInstancesService.FailoverCallback): void; - - /** - * Calls Failover. - * @param request SqlInstancesFailoverRequest message or plain object - * @returns Promise - */ - public failover(request: google.cloud.sql.v1.ISqlInstancesFailoverRequest): Promise; - - /** - * Calls Reencrypt. - * @param request SqlInstancesReencryptRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public reencrypt(request: google.cloud.sql.v1.ISqlInstancesReencryptRequest, callback: google.cloud.sql.v1.SqlInstancesService.ReencryptCallback): void; - - /** - * Calls Reencrypt. - * @param request SqlInstancesReencryptRequest message or plain object - * @returns Promise - */ - public reencrypt(request: google.cloud.sql.v1.ISqlInstancesReencryptRequest): Promise; - - /** - * Calls Get. - * @param request SqlInstancesGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and DatabaseInstance - */ - public get(request: google.cloud.sql.v1.ISqlInstancesGetRequest, callback: google.cloud.sql.v1.SqlInstancesService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlInstancesGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1.ISqlInstancesGetRequest): Promise; - - /** - * Calls Import. - * @param request SqlInstancesImportRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public import(request: google.cloud.sql.v1.ISqlInstancesImportRequest, callback: google.cloud.sql.v1.SqlInstancesService.ImportCallback): void; - - /** - * Calls Import. - * @param request SqlInstancesImportRequest message or plain object - * @returns Promise - */ - public import(request: google.cloud.sql.v1.ISqlInstancesImportRequest): Promise; - - /** - * Calls Insert. - * @param request SqlInstancesInsertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public insert(request: google.cloud.sql.v1.ISqlInstancesInsertRequest, callback: google.cloud.sql.v1.SqlInstancesService.InsertCallback): void; - - /** - * Calls Insert. - * @param request SqlInstancesInsertRequest message or plain object - * @returns Promise - */ - public insert(request: google.cloud.sql.v1.ISqlInstancesInsertRequest): Promise; - - /** - * Calls List. - * @param request SqlInstancesListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and InstancesListResponse - */ - public list(request: google.cloud.sql.v1.ISqlInstancesListRequest, callback: google.cloud.sql.v1.SqlInstancesService.ListCallback): void; - - /** - * Calls List. - * @param request SqlInstancesListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1.ISqlInstancesListRequest): Promise; - - /** - * Calls ListServerCas. - * @param request SqlInstancesListServerCasRequest message or plain object - * @param callback Node-style callback called with the error, if any, and InstancesListServerCasResponse - */ - public listServerCas(request: google.cloud.sql.v1.ISqlInstancesListServerCasRequest, callback: google.cloud.sql.v1.SqlInstancesService.ListServerCasCallback): void; - - /** - * Calls ListServerCas. - * @param request SqlInstancesListServerCasRequest message or plain object - * @returns Promise - */ - public listServerCas(request: google.cloud.sql.v1.ISqlInstancesListServerCasRequest): Promise; - - /** - * Calls ListServerCertificates. - * @param request SqlInstancesListServerCertificatesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and InstancesListServerCertificatesResponse - */ - public listServerCertificates(request: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, callback: google.cloud.sql.v1.SqlInstancesService.ListServerCertificatesCallback): void; - - /** - * Calls ListServerCertificates. - * @param request SqlInstancesListServerCertificatesRequest message or plain object - * @returns Promise - */ - public listServerCertificates(request: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest): Promise; - - /** - * Calls ListEntraIdCertificates. - * @param request SqlInstancesListEntraIdCertificatesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and InstancesListEntraIdCertificatesResponse - */ - public listEntraIdCertificates(request: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, callback: google.cloud.sql.v1.SqlInstancesService.ListEntraIdCertificatesCallback): void; - - /** - * Calls ListEntraIdCertificates. - * @param request SqlInstancesListEntraIdCertificatesRequest message or plain object - * @returns Promise - */ - public listEntraIdCertificates(request: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest): Promise; - - /** - * Calls Patch. - * @param request SqlInstancesPatchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public patch(request: google.cloud.sql.v1.ISqlInstancesPatchRequest, callback: google.cloud.sql.v1.SqlInstancesService.PatchCallback): void; - - /** - * Calls Patch. - * @param request SqlInstancesPatchRequest message or plain object - * @returns Promise - */ - public patch(request: google.cloud.sql.v1.ISqlInstancesPatchRequest): Promise; - - /** - * Calls PromoteReplica. - * @param request SqlInstancesPromoteReplicaRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public promoteReplica(request: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, callback: google.cloud.sql.v1.SqlInstancesService.PromoteReplicaCallback): void; - - /** - * Calls PromoteReplica. - * @param request SqlInstancesPromoteReplicaRequest message or plain object - * @returns Promise - */ - public promoteReplica(request: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest): Promise; - - /** - * Calls Switchover. - * @param request SqlInstancesSwitchoverRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public switchover(request: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, callback: google.cloud.sql.v1.SqlInstancesService.SwitchoverCallback): void; - - /** - * Calls Switchover. - * @param request SqlInstancesSwitchoverRequest message or plain object - * @returns Promise - */ - public switchover(request: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest): Promise; - - /** - * Calls ResetSslConfig. - * @param request SqlInstancesResetSslConfigRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public resetSslConfig(request: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, callback: google.cloud.sql.v1.SqlInstancesService.ResetSslConfigCallback): void; - - /** - * Calls ResetSslConfig. - * @param request SqlInstancesResetSslConfigRequest message or plain object - * @returns Promise - */ - public resetSslConfig(request: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest): Promise; - - /** - * Calls Restart. - * @param request SqlInstancesRestartRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public restart(request: google.cloud.sql.v1.ISqlInstancesRestartRequest, callback: google.cloud.sql.v1.SqlInstancesService.RestartCallback): void; - - /** - * Calls Restart. - * @param request SqlInstancesRestartRequest message or plain object - * @returns Promise - */ - public restart(request: google.cloud.sql.v1.ISqlInstancesRestartRequest): Promise; - - /** - * Calls RestoreBackup. - * @param request SqlInstancesRestoreBackupRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public restoreBackup(request: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, callback: google.cloud.sql.v1.SqlInstancesService.RestoreBackupCallback): void; - - /** - * Calls RestoreBackup. - * @param request SqlInstancesRestoreBackupRequest message or plain object - * @returns Promise - */ - public restoreBackup(request: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest): Promise; - - /** - * Calls RotateServerCa. - * @param request SqlInstancesRotateServerCaRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public rotateServerCa(request: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, callback: google.cloud.sql.v1.SqlInstancesService.RotateServerCaCallback): void; - - /** - * Calls RotateServerCa. - * @param request SqlInstancesRotateServerCaRequest message or plain object - * @returns Promise - */ - public rotateServerCa(request: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest): Promise; - - /** - * Calls RotateServerCertificate. - * @param request SqlInstancesRotateServerCertificateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public rotateServerCertificate(request: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, callback: google.cloud.sql.v1.SqlInstancesService.RotateServerCertificateCallback): void; - - /** - * Calls RotateServerCertificate. - * @param request SqlInstancesRotateServerCertificateRequest message or plain object - * @returns Promise - */ - public rotateServerCertificate(request: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest): Promise; - - /** - * Calls RotateEntraIdCertificate. - * @param request SqlInstancesRotateEntraIdCertificateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public rotateEntraIdCertificate(request: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, callback: google.cloud.sql.v1.SqlInstancesService.RotateEntraIdCertificateCallback): void; - - /** - * Calls RotateEntraIdCertificate. - * @param request SqlInstancesRotateEntraIdCertificateRequest message or plain object - * @returns Promise - */ - public rotateEntraIdCertificate(request: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest): Promise; - - /** - * Calls StartReplica. - * @param request SqlInstancesStartReplicaRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public startReplica(request: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, callback: google.cloud.sql.v1.SqlInstancesService.StartReplicaCallback): void; - - /** - * Calls StartReplica. - * @param request SqlInstancesStartReplicaRequest message or plain object - * @returns Promise - */ - public startReplica(request: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest): Promise; - - /** - * Calls StopReplica. - * @param request SqlInstancesStopReplicaRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public stopReplica(request: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, callback: google.cloud.sql.v1.SqlInstancesService.StopReplicaCallback): void; - - /** - * Calls StopReplica. - * @param request SqlInstancesStopReplicaRequest message or plain object - * @returns Promise - */ - public stopReplica(request: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest): Promise; - - /** - * Calls TruncateLog. - * @param request SqlInstancesTruncateLogRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public truncateLog(request: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, callback: google.cloud.sql.v1.SqlInstancesService.TruncateLogCallback): void; - - /** - * Calls TruncateLog. - * @param request SqlInstancesTruncateLogRequest message or plain object - * @returns Promise - */ - public truncateLog(request: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest): Promise; - - /** - * Calls Update. - * @param request SqlInstancesUpdateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public update(request: google.cloud.sql.v1.ISqlInstancesUpdateRequest, callback: google.cloud.sql.v1.SqlInstancesService.UpdateCallback): void; - - /** - * Calls Update. - * @param request SqlInstancesUpdateRequest message or plain object - * @returns Promise - */ - public update(request: google.cloud.sql.v1.ISqlInstancesUpdateRequest): Promise; - - /** - * Calls CreateEphemeral. - * @param request SqlInstancesCreateEphemeralCertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SslCert - */ - public createEphemeral(request: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, callback: google.cloud.sql.v1.SqlInstancesService.CreateEphemeralCallback): void; - - /** - * Calls CreateEphemeral. - * @param request SqlInstancesCreateEphemeralCertRequest message or plain object - * @returns Promise - */ - public createEphemeral(request: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest): Promise; - - /** - * Calls RescheduleMaintenance. - * @param request SqlInstancesRescheduleMaintenanceRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public rescheduleMaintenance(request: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, callback: google.cloud.sql.v1.SqlInstancesService.RescheduleMaintenanceCallback): void; - - /** - * Calls RescheduleMaintenance. - * @param request SqlInstancesRescheduleMaintenanceRequest message or plain object - * @returns Promise - */ - public rescheduleMaintenance(request: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest): Promise; - - /** - * Calls VerifyExternalSyncSettings. - * @param request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesVerifyExternalSyncSettingsResponse - */ - public verifyExternalSyncSettings(request: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, callback: google.cloud.sql.v1.SqlInstancesService.VerifyExternalSyncSettingsCallback): void; - - /** - * Calls VerifyExternalSyncSettings. - * @param request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object - * @returns Promise - */ - public verifyExternalSyncSettings(request: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest): Promise; - - /** - * Calls StartExternalSync. - * @param request SqlInstancesStartExternalSyncRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public startExternalSync(request: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, callback: google.cloud.sql.v1.SqlInstancesService.StartExternalSyncCallback): void; - - /** - * Calls StartExternalSync. - * @param request SqlInstancesStartExternalSyncRequest message or plain object - * @returns Promise - */ - public startExternalSync(request: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest): Promise; - - /** - * Calls PerformDiskShrink. - * @param request SqlInstancesPerformDiskShrinkRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public performDiskShrink(request: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, callback: google.cloud.sql.v1.SqlInstancesService.PerformDiskShrinkCallback): void; - - /** - * Calls PerformDiskShrink. - * @param request SqlInstancesPerformDiskShrinkRequest message or plain object - * @returns Promise - */ - public performDiskShrink(request: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest): Promise; - - /** - * Calls GetDiskShrinkConfig. - * @param request SqlInstancesGetDiskShrinkConfigRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesGetDiskShrinkConfigResponse - */ - public getDiskShrinkConfig(request: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, callback: google.cloud.sql.v1.SqlInstancesService.GetDiskShrinkConfigCallback): void; - - /** - * Calls GetDiskShrinkConfig. - * @param request SqlInstancesGetDiskShrinkConfigRequest message or plain object - * @returns Promise - */ - public getDiskShrinkConfig(request: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest): Promise; - - /** - * Calls ResetReplicaSize. - * @param request SqlInstancesResetReplicaSizeRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public resetReplicaSize(request: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, callback: google.cloud.sql.v1.SqlInstancesService.ResetReplicaSizeCallback): void; - - /** - * Calls ResetReplicaSize. - * @param request SqlInstancesResetReplicaSizeRequest message or plain object - * @returns Promise - */ - public resetReplicaSize(request: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest): Promise; - - /** - * Calls GetLatestRecoveryTime. - * @param request SqlInstancesGetLatestRecoveryTimeRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesGetLatestRecoveryTimeResponse - */ - public getLatestRecoveryTime(request: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, callback: google.cloud.sql.v1.SqlInstancesService.GetLatestRecoveryTimeCallback): void; - - /** - * Calls GetLatestRecoveryTime. - * @param request SqlInstancesGetLatestRecoveryTimeRequest message or plain object - * @returns Promise - */ - public getLatestRecoveryTime(request: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest): Promise; - - /** - * Calls ExecuteSql. - * @param request SqlInstancesExecuteSqlRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesExecuteSqlResponse - */ - public executeSql(request: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, callback: google.cloud.sql.v1.SqlInstancesService.ExecuteSqlCallback): void; - - /** - * Calls ExecuteSql. - * @param request SqlInstancesExecuteSqlRequest message or plain object - * @returns Promise - */ - public executeSql(request: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest): Promise; - - /** - * Calls AcquireSsrsLease. - * @param request SqlInstancesAcquireSsrsLeaseRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesAcquireSsrsLeaseResponse - */ - public acquireSsrsLease(request: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, callback: google.cloud.sql.v1.SqlInstancesService.AcquireSsrsLeaseCallback): void; - - /** - * Calls AcquireSsrsLease. - * @param request SqlInstancesAcquireSsrsLeaseRequest message or plain object - * @returns Promise - */ - public acquireSsrsLease(request: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest): Promise; - - /** - * Calls ReleaseSsrsLease. - * @param request SqlInstancesReleaseSsrsLeaseRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesReleaseSsrsLeaseResponse - */ - public releaseSsrsLease(request: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, callback: google.cloud.sql.v1.SqlInstancesService.ReleaseSsrsLeaseCallback): void; - - /** - * Calls ReleaseSsrsLease. - * @param request SqlInstancesReleaseSsrsLeaseRequest message or plain object - * @returns Promise - */ - public releaseSsrsLease(request: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest): Promise; - - /** - * Calls PreCheckMajorVersionUpgrade. - * @param request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public preCheckMajorVersionUpgrade(request: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, callback: google.cloud.sql.v1.SqlInstancesService.PreCheckMajorVersionUpgradeCallback): void; - - /** - * Calls PreCheckMajorVersionUpgrade. - * @param request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object - * @returns Promise - */ - public preCheckMajorVersionUpgrade(request: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest): Promise; - - /** - * Calls PointInTimeRestore. - * @param request SqlInstancesPointInTimeRestoreRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public pointInTimeRestore(request: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, callback: google.cloud.sql.v1.SqlInstancesService.PointInTimeRestoreCallback): void; - - /** - * Calls PointInTimeRestore. - * @param request SqlInstancesPointInTimeRestoreRequest message or plain object - * @returns Promise - */ - public pointInTimeRestore(request: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest): Promise; - } - - namespace SqlInstancesService { - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addServerCa}. - * @param error Error, if any - * @param [response] Operation - */ - type AddServerCaCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addServerCertificate}. - * @param error Error, if any - * @param [response] Operation - */ - type AddServerCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addEntraIdCertificate}. - * @param error Error, if any - * @param [response] Operation - */ - type AddEntraIdCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|clone}. - * @param error Error, if any - * @param [response] Operation - */ - type CloneCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|delete_}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|demoteMaster}. - * @param error Error, if any - * @param [response] Operation - */ - type DemoteMasterCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|demote}. - * @param error Error, if any - * @param [response] Operation - */ - type DemoteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|export_}. - * @param error Error, if any - * @param [response] Operation - */ - type ExportCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|failover}. - * @param error Error, if any - * @param [response] Operation - */ - type FailoverCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|reencrypt}. - * @param error Error, if any - * @param [response] Operation - */ - type ReencryptCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|get}. - * @param error Error, if any - * @param [response] DatabaseInstance - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.DatabaseInstance) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|import_}. - * @param error Error, if any - * @param [response] Operation - */ - type ImportCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|insert}. - * @param error Error, if any - * @param [response] Operation - */ - type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|list}. - * @param error Error, if any - * @param [response] InstancesListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.InstancesListResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listServerCas}. - * @param error Error, if any - * @param [response] InstancesListServerCasResponse - */ - type ListServerCasCallback = (error: (Error|null), response?: google.cloud.sql.v1.InstancesListServerCasResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listServerCertificates}. - * @param error Error, if any - * @param [response] InstancesListServerCertificatesResponse - */ - type ListServerCertificatesCallback = (error: (Error|null), response?: google.cloud.sql.v1.InstancesListServerCertificatesResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listEntraIdCertificates}. - * @param error Error, if any - * @param [response] InstancesListEntraIdCertificatesResponse - */ - type ListEntraIdCertificatesCallback = (error: (Error|null), response?: google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|patch}. - * @param error Error, if any - * @param [response] Operation - */ - type PatchCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|promoteReplica}. - * @param error Error, if any - * @param [response] Operation - */ - type PromoteReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|switchover}. - * @param error Error, if any - * @param [response] Operation - */ - type SwitchoverCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|resetSslConfig}. - * @param error Error, if any - * @param [response] Operation - */ - type ResetSslConfigCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|restart}. - * @param error Error, if any - * @param [response] Operation - */ - type RestartCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|restoreBackup}. - * @param error Error, if any - * @param [response] Operation - */ - type RestoreBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateServerCa}. - * @param error Error, if any - * @param [response] Operation - */ - type RotateServerCaCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateServerCertificate}. - * @param error Error, if any - * @param [response] Operation - */ - type RotateServerCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateEntraIdCertificate}. - * @param error Error, if any - * @param [response] Operation - */ - type RotateEntraIdCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|startReplica}. - * @param error Error, if any - * @param [response] Operation - */ - type StartReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|stopReplica}. - * @param error Error, if any - * @param [response] Operation - */ - type StopReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|truncateLog}. - * @param error Error, if any - * @param [response] Operation - */ - type TruncateLogCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|update}. - * @param error Error, if any - * @param [response] Operation - */ - type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|createEphemeral}. - * @param error Error, if any - * @param [response] SslCert - */ - type CreateEphemeralCallback = (error: (Error|null), response?: google.cloud.sql.v1.SslCert) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rescheduleMaintenance}. - * @param error Error, if any - * @param [response] Operation - */ - type RescheduleMaintenanceCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|verifyExternalSyncSettings}. - * @param error Error, if any - * @param [response] SqlInstancesVerifyExternalSyncSettingsResponse - */ - type VerifyExternalSyncSettingsCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|startExternalSync}. - * @param error Error, if any - * @param [response] Operation - */ - type StartExternalSyncCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|performDiskShrink}. - * @param error Error, if any - * @param [response] Operation - */ - type PerformDiskShrinkCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|getDiskShrinkConfig}. - * @param error Error, if any - * @param [response] SqlInstancesGetDiskShrinkConfigResponse - */ - type GetDiskShrinkConfigCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|resetReplicaSize}. - * @param error Error, if any - * @param [response] Operation - */ - type ResetReplicaSizeCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|getLatestRecoveryTime}. - * @param error Error, if any - * @param [response] SqlInstancesGetLatestRecoveryTimeResponse - */ - type GetLatestRecoveryTimeCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|executeSql}. - * @param error Error, if any - * @param [response] SqlInstancesExecuteSqlResponse - */ - type ExecuteSqlCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|acquireSsrsLease}. - * @param error Error, if any - * @param [response] SqlInstancesAcquireSsrsLeaseResponse - */ - type AcquireSsrsLeaseCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|releaseSsrsLease}. - * @param error Error, if any - * @param [response] SqlInstancesReleaseSsrsLeaseResponse - */ - type ReleaseSsrsLeaseCallback = (error: (Error|null), response?: google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|preCheckMajorVersionUpgrade}. - * @param error Error, if any - * @param [response] Operation - */ - type PreCheckMajorVersionUpgradeCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|pointInTimeRestore}. - * @param error Error, if any - * @param [response] Operation - */ - type PointInTimeRestoreCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - } - - /** Properties of a SqlInstancesAddServerCaRequest. */ - interface ISqlInstancesAddServerCaRequest { - - /** SqlInstancesAddServerCaRequest instance */ - instance?: (string|null); - - /** SqlInstancesAddServerCaRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesAddServerCaRequest. */ - class SqlInstancesAddServerCaRequest implements ISqlInstancesAddServerCaRequest { - - /** - * Constructs a new SqlInstancesAddServerCaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest); - - /** SqlInstancesAddServerCaRequest instance. */ - public instance: string; - - /** SqlInstancesAddServerCaRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesAddServerCaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesAddServerCaRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest): google.cloud.sql.v1.SqlInstancesAddServerCaRequest; - - /** - * Encodes the specified SqlInstancesAddServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCaRequest.verify|verify} messages. - * @param message SqlInstancesAddServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesAddServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCaRequest.verify|verify} messages. - * @param message SqlInstancesAddServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesAddServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesAddServerCaRequest; - - /** - * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesAddServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesAddServerCaRequest; - - /** - * Verifies a SqlInstancesAddServerCaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesAddServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesAddServerCaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesAddServerCaRequest; - - /** - * Creates a plain object from a SqlInstancesAddServerCaRequest message. Also converts values to other types if specified. - * @param message SqlInstancesAddServerCaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesAddServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesAddServerCaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesAddServerCaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesAddServerCertificateRequest. */ - interface ISqlInstancesAddServerCertificateRequest { - - /** SqlInstancesAddServerCertificateRequest instance */ - instance?: (string|null); - - /** SqlInstancesAddServerCertificateRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesAddServerCertificateRequest. */ - class SqlInstancesAddServerCertificateRequest implements ISqlInstancesAddServerCertificateRequest { - - /** - * Constructs a new SqlInstancesAddServerCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest); - - /** SqlInstancesAddServerCertificateRequest instance. */ - public instance: string; - - /** SqlInstancesAddServerCertificateRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesAddServerCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesAddServerCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest): google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest; - - /** - * Encodes the specified SqlInstancesAddServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest.verify|verify} messages. - * @param message SqlInstancesAddServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesAddServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest.verify|verify} messages. - * @param message SqlInstancesAddServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesAddServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest; - - /** - * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesAddServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest; - - /** - * Verifies a SqlInstancesAddServerCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesAddServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesAddServerCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest; - - /** - * Creates a plain object from a SqlInstancesAddServerCertificateRequest message. Also converts values to other types if specified. - * @param message SqlInstancesAddServerCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesAddServerCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesAddServerCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesAddEntraIdCertificateRequest. */ - interface ISqlInstancesAddEntraIdCertificateRequest { - - /** SqlInstancesAddEntraIdCertificateRequest instance */ - instance?: (string|null); - - /** SqlInstancesAddEntraIdCertificateRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesAddEntraIdCertificateRequest. */ - class SqlInstancesAddEntraIdCertificateRequest implements ISqlInstancesAddEntraIdCertificateRequest { - - /** - * Constructs a new SqlInstancesAddEntraIdCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest); - - /** SqlInstancesAddEntraIdCertificateRequest instance. */ - public instance: string; - - /** SqlInstancesAddEntraIdCertificateRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesAddEntraIdCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesAddEntraIdCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest): google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest; - - /** - * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. - * @param message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. - * @param message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesAddEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest; - - /** - * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesAddEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest; - - /** - * Verifies a SqlInstancesAddEntraIdCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesAddEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesAddEntraIdCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest; - - /** - * Creates a plain object from a SqlInstancesAddEntraIdCertificateRequest message. Also converts values to other types if specified. - * @param message SqlInstancesAddEntraIdCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesAddEntraIdCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesAddEntraIdCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesCloneRequest. */ - interface ISqlInstancesCloneRequest { - - /** SqlInstancesCloneRequest instance */ - instance?: (string|null); - - /** SqlInstancesCloneRequest project */ - project?: (string|null); - - /** SqlInstancesCloneRequest body */ - body?: (google.cloud.sql.v1.IInstancesCloneRequest|null); - } - - /** Represents a SqlInstancesCloneRequest. */ - class SqlInstancesCloneRequest implements ISqlInstancesCloneRequest { - - /** - * Constructs a new SqlInstancesCloneRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesCloneRequest); - - /** SqlInstancesCloneRequest instance. */ - public instance: string; - - /** SqlInstancesCloneRequest project. */ - public project: string; - - /** SqlInstancesCloneRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesCloneRequest|null); - - /** - * Creates a new SqlInstancesCloneRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesCloneRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesCloneRequest): google.cloud.sql.v1.SqlInstancesCloneRequest; - - /** - * Encodes the specified SqlInstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCloneRequest.verify|verify} messages. - * @param message SqlInstancesCloneRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCloneRequest.verify|verify} messages. - * @param message SqlInstancesCloneRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesCloneRequest; - - /** - * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesCloneRequest; - - /** - * Verifies a SqlInstancesCloneRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesCloneRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesCloneRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesCloneRequest; - - /** - * Creates a plain object from a SqlInstancesCloneRequest message. Also converts values to other types if specified. - * @param message SqlInstancesCloneRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesCloneRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesCloneRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesCloneRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesDeleteRequest. */ - interface ISqlInstancesDeleteRequest { - - /** SqlInstancesDeleteRequest instance */ - instance?: (string|null); - - /** SqlInstancesDeleteRequest project */ - project?: (string|null); - - /** SqlInstancesDeleteRequest enableFinalBackup */ - enableFinalBackup?: (boolean|null); - - /** SqlInstancesDeleteRequest finalBackupTtlDays */ - finalBackupTtlDays?: (number|Long|string|null); - - /** SqlInstancesDeleteRequest finalBackupExpiryTime */ - finalBackupExpiryTime?: (google.protobuf.ITimestamp|null); - - /** SqlInstancesDeleteRequest finalBackupDescription */ - finalBackupDescription?: (string|null); - } - - /** Represents a SqlInstancesDeleteRequest. */ - class SqlInstancesDeleteRequest implements ISqlInstancesDeleteRequest { - - /** - * Constructs a new SqlInstancesDeleteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesDeleteRequest); - - /** SqlInstancesDeleteRequest instance. */ - public instance: string; - - /** SqlInstancesDeleteRequest project. */ - public project: string; - - /** SqlInstancesDeleteRequest enableFinalBackup. */ - public enableFinalBackup?: (boolean|null); - - /** SqlInstancesDeleteRequest finalBackupTtlDays. */ - public finalBackupTtlDays?: (number|Long|string|null); - - /** SqlInstancesDeleteRequest finalBackupExpiryTime. */ - public finalBackupExpiryTime?: (google.protobuf.ITimestamp|null); - - /** SqlInstancesDeleteRequest finalBackupDescription. */ - public finalBackupDescription: string; - - /** SqlInstancesDeleteRequest expiration. */ - public expiration?: ("finalBackupTtlDays"|"finalBackupExpiryTime"); - - /** - * Creates a new SqlInstancesDeleteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesDeleteRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesDeleteRequest): google.cloud.sql.v1.SqlInstancesDeleteRequest; - - /** - * Encodes the specified SqlInstancesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDeleteRequest.verify|verify} messages. - * @param message SqlInstancesDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDeleteRequest.verify|verify} messages. - * @param message SqlInstancesDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesDeleteRequest; - - /** - * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesDeleteRequest; - - /** - * Verifies a SqlInstancesDeleteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesDeleteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesDeleteRequest; - - /** - * Creates a plain object from a SqlInstancesDeleteRequest message. Also converts values to other types if specified. - * @param message SqlInstancesDeleteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesDeleteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesDeleteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesDemoteMasterRequest. */ - interface ISqlInstancesDemoteMasterRequest { - - /** SqlInstancesDemoteMasterRequest instance */ - instance?: (string|null); - - /** SqlInstancesDemoteMasterRequest project */ - project?: (string|null); - - /** SqlInstancesDemoteMasterRequest body */ - body?: (google.cloud.sql.v1.IInstancesDemoteMasterRequest|null); - } - - /** Represents a SqlInstancesDemoteMasterRequest. */ - class SqlInstancesDemoteMasterRequest implements ISqlInstancesDemoteMasterRequest { - - /** - * Constructs a new SqlInstancesDemoteMasterRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest); - - /** SqlInstancesDemoteMasterRequest instance. */ - public instance: string; - - /** SqlInstancesDemoteMasterRequest project. */ - public project: string; - - /** SqlInstancesDemoteMasterRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesDemoteMasterRequest|null); - - /** - * Creates a new SqlInstancesDemoteMasterRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesDemoteMasterRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest): google.cloud.sql.v1.SqlInstancesDemoteMasterRequest; - - /** - * Encodes the specified SqlInstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteMasterRequest.verify|verify} messages. - * @param message SqlInstancesDemoteMasterRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteMasterRequest.verify|verify} messages. - * @param message SqlInstancesDemoteMasterRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesDemoteMasterRequest; - - /** - * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesDemoteMasterRequest; - - /** - * Verifies a SqlInstancesDemoteMasterRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesDemoteMasterRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesDemoteMasterRequest; - - /** - * Creates a plain object from a SqlInstancesDemoteMasterRequest message. Also converts values to other types if specified. - * @param message SqlInstancesDemoteMasterRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesDemoteMasterRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesDemoteMasterRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesDemoteMasterRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesDemoteRequest. */ - interface ISqlInstancesDemoteRequest { - - /** SqlInstancesDemoteRequest instance */ - instance?: (string|null); - - /** SqlInstancesDemoteRequest project */ - project?: (string|null); - - /** SqlInstancesDemoteRequest body */ - body?: (google.cloud.sql.v1.IInstancesDemoteRequest|null); - } - - /** Represents a SqlInstancesDemoteRequest. */ - class SqlInstancesDemoteRequest implements ISqlInstancesDemoteRequest { - - /** - * Constructs a new SqlInstancesDemoteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesDemoteRequest); - - /** SqlInstancesDemoteRequest instance. */ - public instance: string; - - /** SqlInstancesDemoteRequest project. */ - public project: string; - - /** SqlInstancesDemoteRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesDemoteRequest|null); - - /** - * Creates a new SqlInstancesDemoteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesDemoteRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesDemoteRequest): google.cloud.sql.v1.SqlInstancesDemoteRequest; - - /** - * Encodes the specified SqlInstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteRequest.verify|verify} messages. - * @param message SqlInstancesDemoteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteRequest.verify|verify} messages. - * @param message SqlInstancesDemoteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesDemoteRequest; - - /** - * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesDemoteRequest; - - /** - * Verifies a SqlInstancesDemoteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesDemoteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesDemoteRequest; - - /** - * Creates a plain object from a SqlInstancesDemoteRequest message. Also converts values to other types if specified. - * @param message SqlInstancesDemoteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesDemoteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesDemoteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesDemoteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesExportRequest. */ - interface ISqlInstancesExportRequest { - - /** SqlInstancesExportRequest instance */ - instance?: (string|null); - - /** SqlInstancesExportRequest project */ - project?: (string|null); - - /** SqlInstancesExportRequest body */ - body?: (google.cloud.sql.v1.IInstancesExportRequest|null); - } - - /** Represents a SqlInstancesExportRequest. */ - class SqlInstancesExportRequest implements ISqlInstancesExportRequest { - - /** - * Constructs a new SqlInstancesExportRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesExportRequest); - - /** SqlInstancesExportRequest instance. */ - public instance: string; - - /** SqlInstancesExportRequest project. */ - public project: string; - - /** SqlInstancesExportRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesExportRequest|null); - - /** - * Creates a new SqlInstancesExportRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesExportRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesExportRequest): google.cloud.sql.v1.SqlInstancesExportRequest; - - /** - * Encodes the specified SqlInstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExportRequest.verify|verify} messages. - * @param message SqlInstancesExportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExportRequest.verify|verify} messages. - * @param message SqlInstancesExportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesExportRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesExportRequest; - - /** - * Decodes a SqlInstancesExportRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesExportRequest; - - /** - * Verifies a SqlInstancesExportRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesExportRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesExportRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesExportRequest; - - /** - * Creates a plain object from a SqlInstancesExportRequest message. Also converts values to other types if specified. - * @param message SqlInstancesExportRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesExportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesExportRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesExportRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesFailoverRequest. */ - interface ISqlInstancesFailoverRequest { - - /** SqlInstancesFailoverRequest instance */ - instance?: (string|null); - - /** SqlInstancesFailoverRequest project */ - project?: (string|null); - - /** SqlInstancesFailoverRequest body */ - body?: (google.cloud.sql.v1.IInstancesFailoverRequest|null); - } - - /** Represents a SqlInstancesFailoverRequest. */ - class SqlInstancesFailoverRequest implements ISqlInstancesFailoverRequest { - - /** - * Constructs a new SqlInstancesFailoverRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesFailoverRequest); - - /** SqlInstancesFailoverRequest instance. */ - public instance: string; - - /** SqlInstancesFailoverRequest project. */ - public project: string; - - /** SqlInstancesFailoverRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesFailoverRequest|null); - - /** - * Creates a new SqlInstancesFailoverRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesFailoverRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesFailoverRequest): google.cloud.sql.v1.SqlInstancesFailoverRequest; - - /** - * Encodes the specified SqlInstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesFailoverRequest.verify|verify} messages. - * @param message SqlInstancesFailoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesFailoverRequest.verify|verify} messages. - * @param message SqlInstancesFailoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesFailoverRequest; - - /** - * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesFailoverRequest; - - /** - * Verifies a SqlInstancesFailoverRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesFailoverRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesFailoverRequest; - - /** - * Creates a plain object from a SqlInstancesFailoverRequest message. Also converts values to other types if specified. - * @param message SqlInstancesFailoverRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesFailoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesFailoverRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesFailoverRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesGetRequest. */ - interface ISqlInstancesGetRequest { - - /** SqlInstancesGetRequest instance */ - instance?: (string|null); - - /** SqlInstancesGetRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesGetRequest. */ - class SqlInstancesGetRequest implements ISqlInstancesGetRequest { - - /** - * Constructs a new SqlInstancesGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesGetRequest); - - /** SqlInstancesGetRequest instance. */ - public instance: string; - - /** SqlInstancesGetRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesGetRequest): google.cloud.sql.v1.SqlInstancesGetRequest; - - /** - * Encodes the specified SqlInstancesGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetRequest.verify|verify} messages. - * @param message SqlInstancesGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetRequest.verify|verify} messages. - * @param message SqlInstancesGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesGetRequest; - - /** - * Decodes a SqlInstancesGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesGetRequest; - - /** - * Verifies a SqlInstancesGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesGetRequest; - - /** - * Creates a plain object from a SqlInstancesGetRequest message. Also converts values to other types if specified. - * @param message SqlInstancesGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesImportRequest. */ - interface ISqlInstancesImportRequest { - - /** SqlInstancesImportRequest instance */ - instance?: (string|null); - - /** SqlInstancesImportRequest project */ - project?: (string|null); - - /** SqlInstancesImportRequest body */ - body?: (google.cloud.sql.v1.IInstancesImportRequest|null); - } - - /** Represents a SqlInstancesImportRequest. */ - class SqlInstancesImportRequest implements ISqlInstancesImportRequest { - - /** - * Constructs a new SqlInstancesImportRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesImportRequest); - - /** SqlInstancesImportRequest instance. */ - public instance: string; - - /** SqlInstancesImportRequest project. */ - public project: string; - - /** SqlInstancesImportRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesImportRequest|null); - - /** - * Creates a new SqlInstancesImportRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesImportRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesImportRequest): google.cloud.sql.v1.SqlInstancesImportRequest; - - /** - * Encodes the specified SqlInstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesImportRequest.verify|verify} messages. - * @param message SqlInstancesImportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesImportRequest.verify|verify} messages. - * @param message SqlInstancesImportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesImportRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesImportRequest; - - /** - * Decodes a SqlInstancesImportRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesImportRequest; - - /** - * Verifies a SqlInstancesImportRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesImportRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesImportRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesImportRequest; - - /** - * Creates a plain object from a SqlInstancesImportRequest message. Also converts values to other types if specified. - * @param message SqlInstancesImportRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesImportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesImportRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesImportRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesInsertRequest. */ - interface ISqlInstancesInsertRequest { - - /** SqlInstancesInsertRequest project */ - project?: (string|null); - - /** SqlInstancesInsertRequest body */ - body?: (google.cloud.sql.v1.IDatabaseInstance|null); - } - - /** Represents a SqlInstancesInsertRequest. */ - class SqlInstancesInsertRequest implements ISqlInstancesInsertRequest { - - /** - * Constructs a new SqlInstancesInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesInsertRequest); - - /** SqlInstancesInsertRequest project. */ - public project: string; - - /** SqlInstancesInsertRequest body. */ - public body?: (google.cloud.sql.v1.IDatabaseInstance|null); - - /** - * Creates a new SqlInstancesInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesInsertRequest): google.cloud.sql.v1.SqlInstancesInsertRequest; - - /** - * Encodes the specified SqlInstancesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesInsertRequest.verify|verify} messages. - * @param message SqlInstancesInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesInsertRequest.verify|verify} messages. - * @param message SqlInstancesInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesInsertRequest; - - /** - * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesInsertRequest; - - /** - * Verifies a SqlInstancesInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesInsertRequest; - - /** - * Creates a plain object from a SqlInstancesInsertRequest message. Also converts values to other types if specified. - * @param message SqlInstancesInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesListRequest. */ - interface ISqlInstancesListRequest { - - /** SqlInstancesListRequest filter */ - filter?: (string|null); - - /** SqlInstancesListRequest maxResults */ - maxResults?: (number|null); - - /** SqlInstancesListRequest pageToken */ - pageToken?: (string|null); - - /** SqlInstancesListRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesListRequest. */ - class SqlInstancesListRequest implements ISqlInstancesListRequest { - - /** - * Constructs a new SqlInstancesListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesListRequest); - - /** SqlInstancesListRequest filter. */ - public filter: string; - - /** SqlInstancesListRequest maxResults. */ - public maxResults: number; - - /** SqlInstancesListRequest pageToken. */ - public pageToken: string; - - /** SqlInstancesListRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesListRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesListRequest): google.cloud.sql.v1.SqlInstancesListRequest; - - /** - * Encodes the specified SqlInstancesListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListRequest.verify|verify} messages. - * @param message SqlInstancesListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListRequest.verify|verify} messages. - * @param message SqlInstancesListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesListRequest; - - /** - * Decodes a SqlInstancesListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesListRequest; - - /** - * Verifies a SqlInstancesListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesListRequest; - - /** - * Creates a plain object from a SqlInstancesListRequest message. Also converts values to other types if specified. - * @param message SqlInstancesListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesListServerCasRequest. */ - interface ISqlInstancesListServerCasRequest { - - /** SqlInstancesListServerCasRequest instance */ - instance?: (string|null); - - /** SqlInstancesListServerCasRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesListServerCasRequest. */ - class SqlInstancesListServerCasRequest implements ISqlInstancesListServerCasRequest { - - /** - * Constructs a new SqlInstancesListServerCasRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesListServerCasRequest); - - /** SqlInstancesListServerCasRequest instance. */ - public instance: string; - - /** SqlInstancesListServerCasRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesListServerCasRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesListServerCasRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesListServerCasRequest): google.cloud.sql.v1.SqlInstancesListServerCasRequest; - - /** - * Encodes the specified SqlInstancesListServerCasRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCasRequest.verify|verify} messages. - * @param message SqlInstancesListServerCasRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesListServerCasRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesListServerCasRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCasRequest.verify|verify} messages. - * @param message SqlInstancesListServerCasRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesListServerCasRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesListServerCasRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesListServerCasRequest; - - /** - * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesListServerCasRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesListServerCasRequest; - - /** - * Verifies a SqlInstancesListServerCasRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesListServerCasRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesListServerCasRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesListServerCasRequest; - - /** - * Creates a plain object from a SqlInstancesListServerCasRequest message. Also converts values to other types if specified. - * @param message SqlInstancesListServerCasRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesListServerCasRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesListServerCasRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesListServerCasRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesListServerCertificatesRequest. */ - interface ISqlInstancesListServerCertificatesRequest { - - /** SqlInstancesListServerCertificatesRequest instance */ - instance?: (string|null); - - /** SqlInstancesListServerCertificatesRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesListServerCertificatesRequest. */ - class SqlInstancesListServerCertificatesRequest implements ISqlInstancesListServerCertificatesRequest { - - /** - * Constructs a new SqlInstancesListServerCertificatesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest); - - /** SqlInstancesListServerCertificatesRequest instance. */ - public instance: string; - - /** SqlInstancesListServerCertificatesRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesListServerCertificatesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesListServerCertificatesRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest): google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest; - - /** - * Encodes the specified SqlInstancesListServerCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest.verify|verify} messages. - * @param message SqlInstancesListServerCertificatesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesListServerCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest.verify|verify} messages. - * @param message SqlInstancesListServerCertificatesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesListServerCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest; - - /** - * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesListServerCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest; - - /** - * Verifies a SqlInstancesListServerCertificatesRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesListServerCertificatesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesListServerCertificatesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest; - - /** - * Creates a plain object from a SqlInstancesListServerCertificatesRequest message. Also converts values to other types if specified. - * @param message SqlInstancesListServerCertificatesRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesListServerCertificatesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesListServerCertificatesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesListEntraIdCertificatesRequest. */ - interface ISqlInstancesListEntraIdCertificatesRequest { - - /** SqlInstancesListEntraIdCertificatesRequest instance */ - instance?: (string|null); - - /** SqlInstancesListEntraIdCertificatesRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesListEntraIdCertificatesRequest. */ - class SqlInstancesListEntraIdCertificatesRequest implements ISqlInstancesListEntraIdCertificatesRequest { - - /** - * Constructs a new SqlInstancesListEntraIdCertificatesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest); - - /** SqlInstancesListEntraIdCertificatesRequest instance. */ - public instance: string; - - /** SqlInstancesListEntraIdCertificatesRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesListEntraIdCertificatesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesListEntraIdCertificatesRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest): google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest; - - /** - * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. - * @param message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. - * @param message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesListEntraIdCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest; - - /** - * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesListEntraIdCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest; - - /** - * Verifies a SqlInstancesListEntraIdCertificatesRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesListEntraIdCertificatesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesListEntraIdCertificatesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest; - - /** - * Creates a plain object from a SqlInstancesListEntraIdCertificatesRequest message. Also converts values to other types if specified. - * @param message SqlInstancesListEntraIdCertificatesRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesListEntraIdCertificatesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesListEntraIdCertificatesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesPatchRequest. */ - interface ISqlInstancesPatchRequest { - - /** SqlInstancesPatchRequest instance */ - instance?: (string|null); - - /** SqlInstancesPatchRequest project */ - project?: (string|null); - - /** SqlInstancesPatchRequest body */ - body?: (google.cloud.sql.v1.IDatabaseInstance|null); - } - - /** Represents a SqlInstancesPatchRequest. */ - class SqlInstancesPatchRequest implements ISqlInstancesPatchRequest { - - /** - * Constructs a new SqlInstancesPatchRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesPatchRequest); - - /** SqlInstancesPatchRequest instance. */ - public instance: string; - - /** SqlInstancesPatchRequest project. */ - public project: string; - - /** SqlInstancesPatchRequest body. */ - public body?: (google.cloud.sql.v1.IDatabaseInstance|null); - - /** - * Creates a new SqlInstancesPatchRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesPatchRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesPatchRequest): google.cloud.sql.v1.SqlInstancesPatchRequest; - - /** - * Encodes the specified SqlInstancesPatchRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPatchRequest.verify|verify} messages. - * @param message SqlInstancesPatchRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesPatchRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesPatchRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPatchRequest.verify|verify} messages. - * @param message SqlInstancesPatchRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesPatchRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesPatchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesPatchRequest; - - /** - * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesPatchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesPatchRequest; - - /** - * Verifies a SqlInstancesPatchRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesPatchRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesPatchRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesPatchRequest; - - /** - * Creates a plain object from a SqlInstancesPatchRequest message. Also converts values to other types if specified. - * @param message SqlInstancesPatchRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesPatchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesPatchRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesPatchRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesPromoteReplicaRequest. */ - interface ISqlInstancesPromoteReplicaRequest { - - /** SqlInstancesPromoteReplicaRequest instance */ - instance?: (string|null); - - /** SqlInstancesPromoteReplicaRequest project */ - project?: (string|null); - - /** SqlInstancesPromoteReplicaRequest failover */ - failover?: (boolean|null); - } - - /** Represents a SqlInstancesPromoteReplicaRequest. */ - class SqlInstancesPromoteReplicaRequest implements ISqlInstancesPromoteReplicaRequest { - - /** - * Constructs a new SqlInstancesPromoteReplicaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest); - - /** SqlInstancesPromoteReplicaRequest instance. */ - public instance: string; - - /** SqlInstancesPromoteReplicaRequest project. */ - public project: string; - - /** SqlInstancesPromoteReplicaRequest failover. */ - public failover: boolean; - - /** - * Creates a new SqlInstancesPromoteReplicaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesPromoteReplicaRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest): google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest; - - /** - * Encodes the specified SqlInstancesPromoteReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest.verify|verify} messages. - * @param message SqlInstancesPromoteReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesPromoteReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest.verify|verify} messages. - * @param message SqlInstancesPromoteReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesPromoteReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest; - - /** - * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesPromoteReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest; - - /** - * Verifies a SqlInstancesPromoteReplicaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesPromoteReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesPromoteReplicaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest; - - /** - * Creates a plain object from a SqlInstancesPromoteReplicaRequest message. Also converts values to other types if specified. - * @param message SqlInstancesPromoteReplicaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesPromoteReplicaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesPromoteReplicaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesSwitchoverRequest. */ - interface ISqlInstancesSwitchoverRequest { - - /** SqlInstancesSwitchoverRequest instance */ - instance?: (string|null); - - /** SqlInstancesSwitchoverRequest project */ - project?: (string|null); - - /** SqlInstancesSwitchoverRequest dbTimeout */ - dbTimeout?: (google.protobuf.IDuration|null); - } - - /** Represents a SqlInstancesSwitchoverRequest. */ - class SqlInstancesSwitchoverRequest implements ISqlInstancesSwitchoverRequest { - - /** - * Constructs a new SqlInstancesSwitchoverRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest); - - /** SqlInstancesSwitchoverRequest instance. */ - public instance: string; - - /** SqlInstancesSwitchoverRequest project. */ - public project: string; - - /** SqlInstancesSwitchoverRequest dbTimeout. */ - public dbTimeout?: (google.protobuf.IDuration|null); - - /** - * Creates a new SqlInstancesSwitchoverRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesSwitchoverRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest): google.cloud.sql.v1.SqlInstancesSwitchoverRequest; - - /** - * Encodes the specified SqlInstancesSwitchoverRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesSwitchoverRequest.verify|verify} messages. - * @param message SqlInstancesSwitchoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesSwitchoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesSwitchoverRequest.verify|verify} messages. - * @param message SqlInstancesSwitchoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesSwitchoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesSwitchoverRequest; - - /** - * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesSwitchoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesSwitchoverRequest; - - /** - * Verifies a SqlInstancesSwitchoverRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesSwitchoverRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesSwitchoverRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesSwitchoverRequest; - - /** - * Creates a plain object from a SqlInstancesSwitchoverRequest message. Also converts values to other types if specified. - * @param message SqlInstancesSwitchoverRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesSwitchoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesSwitchoverRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesSwitchoverRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesResetSslConfigRequest. */ - interface ISqlInstancesResetSslConfigRequest { - - /** SqlInstancesResetSslConfigRequest instance */ - instance?: (string|null); - - /** SqlInstancesResetSslConfigRequest project */ - project?: (string|null); - - /** SqlInstancesResetSslConfigRequest mode */ - mode?: (google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode|keyof typeof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode|null); - } - - /** Represents a SqlInstancesResetSslConfigRequest. */ - class SqlInstancesResetSslConfigRequest implements ISqlInstancesResetSslConfigRequest { - - /** - * Constructs a new SqlInstancesResetSslConfigRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest); - - /** SqlInstancesResetSslConfigRequest instance. */ - public instance: string; - - /** SqlInstancesResetSslConfigRequest project. */ - public project: string; - - /** SqlInstancesResetSslConfigRequest mode. */ - public mode: (google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode|keyof typeof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode); - - /** - * Creates a new SqlInstancesResetSslConfigRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesResetSslConfigRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest): google.cloud.sql.v1.SqlInstancesResetSslConfigRequest; - - /** - * Encodes the specified SqlInstancesResetSslConfigRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.verify|verify} messages. - * @param message SqlInstancesResetSslConfigRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesResetSslConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.verify|verify} messages. - * @param message SqlInstancesResetSslConfigRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesResetSslConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesResetSslConfigRequest; - - /** - * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesResetSslConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesResetSslConfigRequest; - - /** - * Verifies a SqlInstancesResetSslConfigRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesResetSslConfigRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesResetSslConfigRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesResetSslConfigRequest; - - /** - * Creates a plain object from a SqlInstancesResetSslConfigRequest message. Also converts values to other types if specified. - * @param message SqlInstancesResetSslConfigRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesResetSslConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesResetSslConfigRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesResetSslConfigRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlInstancesResetSslConfigRequest { - - /** ResetSslMode enum. */ - enum ResetSslMode { - RESET_SSL_MODE_UNSPECIFIED = 0, - ALL = 1, - SYNC_FROM_PRIMARY = 2 - } - } - - /** Properties of a SqlInstancesRestartRequest. */ - interface ISqlInstancesRestartRequest { - - /** SqlInstancesRestartRequest instance */ - instance?: (string|null); - - /** SqlInstancesRestartRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesRestartRequest. */ - class SqlInstancesRestartRequest implements ISqlInstancesRestartRequest { - - /** - * Constructs a new SqlInstancesRestartRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesRestartRequest); - - /** SqlInstancesRestartRequest instance. */ - public instance: string; - - /** SqlInstancesRestartRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesRestartRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRestartRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesRestartRequest): google.cloud.sql.v1.SqlInstancesRestartRequest; - - /** - * Encodes the specified SqlInstancesRestartRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestartRequest.verify|verify} messages. - * @param message SqlInstancesRestartRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesRestartRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRestartRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestartRequest.verify|verify} messages. - * @param message SqlInstancesRestartRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRestartRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRestartRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRestartRequest; - - /** - * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRestartRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRestartRequest; - - /** - * Verifies a SqlInstancesRestartRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRestartRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRestartRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRestartRequest; - - /** - * Creates a plain object from a SqlInstancesRestartRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRestartRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesRestartRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRestartRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRestartRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRestoreBackupRequest. */ - interface ISqlInstancesRestoreBackupRequest { - - /** SqlInstancesRestoreBackupRequest instance */ - instance?: (string|null); - - /** SqlInstancesRestoreBackupRequest project */ - project?: (string|null); - - /** SqlInstancesRestoreBackupRequest body */ - body?: (google.cloud.sql.v1.IInstancesRestoreBackupRequest|null); - } - - /** Represents a SqlInstancesRestoreBackupRequest. */ - class SqlInstancesRestoreBackupRequest implements ISqlInstancesRestoreBackupRequest { - - /** - * Constructs a new SqlInstancesRestoreBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest); - - /** SqlInstancesRestoreBackupRequest instance. */ - public instance: string; - - /** SqlInstancesRestoreBackupRequest project. */ - public project: string; - - /** SqlInstancesRestoreBackupRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesRestoreBackupRequest|null); - - /** - * Creates a new SqlInstancesRestoreBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRestoreBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest): google.cloud.sql.v1.SqlInstancesRestoreBackupRequest; - - /** - * Encodes the specified SqlInstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestoreBackupRequest.verify|verify} messages. - * @param message SqlInstancesRestoreBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestoreBackupRequest.verify|verify} messages. - * @param message SqlInstancesRestoreBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRestoreBackupRequest; - - /** - * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRestoreBackupRequest; - - /** - * Verifies a SqlInstancesRestoreBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRestoreBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRestoreBackupRequest; - - /** - * Creates a plain object from a SqlInstancesRestoreBackupRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRestoreBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesRestoreBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRestoreBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRestoreBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRotateServerCaRequest. */ - interface ISqlInstancesRotateServerCaRequest { - - /** SqlInstancesRotateServerCaRequest instance */ - instance?: (string|null); - - /** SqlInstancesRotateServerCaRequest project */ - project?: (string|null); - - /** SqlInstancesRotateServerCaRequest body */ - body?: (google.cloud.sql.v1.IInstancesRotateServerCaRequest|null); - } - - /** Represents a SqlInstancesRotateServerCaRequest. */ - class SqlInstancesRotateServerCaRequest implements ISqlInstancesRotateServerCaRequest { - - /** - * Constructs a new SqlInstancesRotateServerCaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest); - - /** SqlInstancesRotateServerCaRequest instance. */ - public instance: string; - - /** SqlInstancesRotateServerCaRequest project. */ - public project: string; - - /** SqlInstancesRotateServerCaRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesRotateServerCaRequest|null); - - /** - * Creates a new SqlInstancesRotateServerCaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRotateServerCaRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest): google.cloud.sql.v1.SqlInstancesRotateServerCaRequest; - - /** - * Encodes the specified SqlInstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCaRequest.verify|verify} messages. - * @param message SqlInstancesRotateServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCaRequest.verify|verify} messages. - * @param message SqlInstancesRotateServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRotateServerCaRequest; - - /** - * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRotateServerCaRequest; - - /** - * Verifies a SqlInstancesRotateServerCaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRotateServerCaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRotateServerCaRequest; - - /** - * Creates a plain object from a SqlInstancesRotateServerCaRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRotateServerCaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesRotateServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRotateServerCaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRotateServerCaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRotateServerCertificateRequest. */ - interface ISqlInstancesRotateServerCertificateRequest { - - /** SqlInstancesRotateServerCertificateRequest instance */ - instance?: (string|null); - - /** SqlInstancesRotateServerCertificateRequest project */ - project?: (string|null); - - /** SqlInstancesRotateServerCertificateRequest body */ - body?: (google.cloud.sql.v1.IInstancesRotateServerCertificateRequest|null); - } - - /** Represents a SqlInstancesRotateServerCertificateRequest. */ - class SqlInstancesRotateServerCertificateRequest implements ISqlInstancesRotateServerCertificateRequest { - - /** - * Constructs a new SqlInstancesRotateServerCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest); - - /** SqlInstancesRotateServerCertificateRequest instance. */ - public instance: string; - - /** SqlInstancesRotateServerCertificateRequest project. */ - public project: string; - - /** SqlInstancesRotateServerCertificateRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesRotateServerCertificateRequest|null); - - /** - * Creates a new SqlInstancesRotateServerCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRotateServerCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest): google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest; - - /** - * Encodes the specified SqlInstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. - * @param message SqlInstancesRotateServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. - * @param message SqlInstancesRotateServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest; - - /** - * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest; - - /** - * Verifies a SqlInstancesRotateServerCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRotateServerCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest; - - /** - * Creates a plain object from a SqlInstancesRotateServerCertificateRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRotateServerCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRotateServerCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRotateServerCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRotateEntraIdCertificateRequest. */ - interface ISqlInstancesRotateEntraIdCertificateRequest { - - /** SqlInstancesRotateEntraIdCertificateRequest instance */ - instance?: (string|null); - - /** SqlInstancesRotateEntraIdCertificateRequest project */ - project?: (string|null); - - /** SqlInstancesRotateEntraIdCertificateRequest body */ - body?: (google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest|null); - } - - /** Represents a SqlInstancesRotateEntraIdCertificateRequest. */ - class SqlInstancesRotateEntraIdCertificateRequest implements ISqlInstancesRotateEntraIdCertificateRequest { - - /** - * Constructs a new SqlInstancesRotateEntraIdCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest); - - /** SqlInstancesRotateEntraIdCertificateRequest instance. */ - public instance: string; - - /** SqlInstancesRotateEntraIdCertificateRequest project. */ - public project: string; - - /** SqlInstancesRotateEntraIdCertificateRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest|null); - - /** - * Creates a new SqlInstancesRotateEntraIdCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRotateEntraIdCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest): google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest; - - /** - * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @param message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @param message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest; - - /** - * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest; - - /** - * Verifies a SqlInstancesRotateEntraIdCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRotateEntraIdCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest; - - /** - * Creates a plain object from a SqlInstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRotateEntraIdCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRotateEntraIdCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRotateEntraIdCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesStartReplicaRequest. */ - interface ISqlInstancesStartReplicaRequest { - - /** SqlInstancesStartReplicaRequest instance */ - instance?: (string|null); - - /** SqlInstancesStartReplicaRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesStartReplicaRequest. */ - class SqlInstancesStartReplicaRequest implements ISqlInstancesStartReplicaRequest { - - /** - * Constructs a new SqlInstancesStartReplicaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest); - - /** SqlInstancesStartReplicaRequest instance. */ - public instance: string; - - /** SqlInstancesStartReplicaRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesStartReplicaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesStartReplicaRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest): google.cloud.sql.v1.SqlInstancesStartReplicaRequest; - - /** - * Encodes the specified SqlInstancesStartReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartReplicaRequest.verify|verify} messages. - * @param message SqlInstancesStartReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesStartReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartReplicaRequest.verify|verify} messages. - * @param message SqlInstancesStartReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesStartReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesStartReplicaRequest; - - /** - * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesStartReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesStartReplicaRequest; - - /** - * Verifies a SqlInstancesStartReplicaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesStartReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesStartReplicaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesStartReplicaRequest; - - /** - * Creates a plain object from a SqlInstancesStartReplicaRequest message. Also converts values to other types if specified. - * @param message SqlInstancesStartReplicaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesStartReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesStartReplicaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesStartReplicaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesStopReplicaRequest. */ - interface ISqlInstancesStopReplicaRequest { - - /** SqlInstancesStopReplicaRequest instance */ - instance?: (string|null); - - /** SqlInstancesStopReplicaRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesStopReplicaRequest. */ - class SqlInstancesStopReplicaRequest implements ISqlInstancesStopReplicaRequest { - - /** - * Constructs a new SqlInstancesStopReplicaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest); - - /** SqlInstancesStopReplicaRequest instance. */ - public instance: string; - - /** SqlInstancesStopReplicaRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesStopReplicaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesStopReplicaRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest): google.cloud.sql.v1.SqlInstancesStopReplicaRequest; - - /** - * Encodes the specified SqlInstancesStopReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStopReplicaRequest.verify|verify} messages. - * @param message SqlInstancesStopReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesStopReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStopReplicaRequest.verify|verify} messages. - * @param message SqlInstancesStopReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesStopReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesStopReplicaRequest; - - /** - * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesStopReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesStopReplicaRequest; - - /** - * Verifies a SqlInstancesStopReplicaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesStopReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesStopReplicaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesStopReplicaRequest; - - /** - * Creates a plain object from a SqlInstancesStopReplicaRequest message. Also converts values to other types if specified. - * @param message SqlInstancesStopReplicaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesStopReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesStopReplicaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesStopReplicaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesTruncateLogRequest. */ - interface ISqlInstancesTruncateLogRequest { - - /** SqlInstancesTruncateLogRequest instance */ - instance?: (string|null); - - /** SqlInstancesTruncateLogRequest project */ - project?: (string|null); - - /** SqlInstancesTruncateLogRequest body */ - body?: (google.cloud.sql.v1.IInstancesTruncateLogRequest|null); - } - - /** Represents a SqlInstancesTruncateLogRequest. */ - class SqlInstancesTruncateLogRequest implements ISqlInstancesTruncateLogRequest { - - /** - * Constructs a new SqlInstancesTruncateLogRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest); - - /** SqlInstancesTruncateLogRequest instance. */ - public instance: string; - - /** SqlInstancesTruncateLogRequest project. */ - public project: string; - - /** SqlInstancesTruncateLogRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesTruncateLogRequest|null); - - /** - * Creates a new SqlInstancesTruncateLogRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesTruncateLogRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest): google.cloud.sql.v1.SqlInstancesTruncateLogRequest; - - /** - * Encodes the specified SqlInstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesTruncateLogRequest.verify|verify} messages. - * @param message SqlInstancesTruncateLogRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesTruncateLogRequest.verify|verify} messages. - * @param message SqlInstancesTruncateLogRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesTruncateLogRequest; - - /** - * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesTruncateLogRequest; - - /** - * Verifies a SqlInstancesTruncateLogRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesTruncateLogRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesTruncateLogRequest; - - /** - * Creates a plain object from a SqlInstancesTruncateLogRequest message. Also converts values to other types if specified. - * @param message SqlInstancesTruncateLogRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesTruncateLogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesTruncateLogRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesTruncateLogRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesPerformDiskShrinkRequest. */ - interface ISqlInstancesPerformDiskShrinkRequest { - - /** SqlInstancesPerformDiskShrinkRequest instance */ - instance?: (string|null); - - /** SqlInstancesPerformDiskShrinkRequest project */ - project?: (string|null); - - /** SqlInstancesPerformDiskShrinkRequest body */ - body?: (google.cloud.sql.v1.IPerformDiskShrinkContext|null); - } - - /** Represents a SqlInstancesPerformDiskShrinkRequest. */ - class SqlInstancesPerformDiskShrinkRequest implements ISqlInstancesPerformDiskShrinkRequest { - - /** - * Constructs a new SqlInstancesPerformDiskShrinkRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest); - - /** SqlInstancesPerformDiskShrinkRequest instance. */ - public instance: string; - - /** SqlInstancesPerformDiskShrinkRequest project. */ - public project: string; - - /** SqlInstancesPerformDiskShrinkRequest body. */ - public body?: (google.cloud.sql.v1.IPerformDiskShrinkContext|null); - - /** - * Creates a new SqlInstancesPerformDiskShrinkRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesPerformDiskShrinkRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest): google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest; - - /** - * Encodes the specified SqlInstancesPerformDiskShrinkRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. - * @param message SqlInstancesPerformDiskShrinkRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesPerformDiskShrinkRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. - * @param message SqlInstancesPerformDiskShrinkRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesPerformDiskShrinkRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest; - - /** - * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesPerformDiskShrinkRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest; - - /** - * Verifies a SqlInstancesPerformDiskShrinkRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesPerformDiskShrinkRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesPerformDiskShrinkRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest; - - /** - * Creates a plain object from a SqlInstancesPerformDiskShrinkRequest message. Also converts values to other types if specified. - * @param message SqlInstancesPerformDiskShrinkRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesPerformDiskShrinkRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesPerformDiskShrinkRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesUpdateRequest. */ - interface ISqlInstancesUpdateRequest { - - /** SqlInstancesUpdateRequest instance */ - instance?: (string|null); - - /** SqlInstancesUpdateRequest project */ - project?: (string|null); - - /** SqlInstancesUpdateRequest body */ - body?: (google.cloud.sql.v1.IDatabaseInstance|null); - } - - /** Represents a SqlInstancesUpdateRequest. */ - class SqlInstancesUpdateRequest implements ISqlInstancesUpdateRequest { - - /** - * Constructs a new SqlInstancesUpdateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesUpdateRequest); - - /** SqlInstancesUpdateRequest instance. */ - public instance: string; - - /** SqlInstancesUpdateRequest project. */ - public project: string; - - /** SqlInstancesUpdateRequest body. */ - public body?: (google.cloud.sql.v1.IDatabaseInstance|null); - - /** - * Creates a new SqlInstancesUpdateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesUpdateRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesUpdateRequest): google.cloud.sql.v1.SqlInstancesUpdateRequest; - - /** - * Encodes the specified SqlInstancesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesUpdateRequest.verify|verify} messages. - * @param message SqlInstancesUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesUpdateRequest.verify|verify} messages. - * @param message SqlInstancesUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesUpdateRequest; - - /** - * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesUpdateRequest; - - /** - * Verifies a SqlInstancesUpdateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesUpdateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesUpdateRequest; - - /** - * Creates a plain object from a SqlInstancesUpdateRequest message. Also converts values to other types if specified. - * @param message SqlInstancesUpdateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesUpdateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesUpdateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRescheduleMaintenanceRequest. */ - interface ISqlInstancesRescheduleMaintenanceRequest { - - /** SqlInstancesRescheduleMaintenanceRequest instance */ - instance?: (string|null); - - /** SqlInstancesRescheduleMaintenanceRequest project */ - project?: (string|null); - - /** SqlInstancesRescheduleMaintenanceRequest body */ - body?: (google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody|null); - } - - /** Represents a SqlInstancesRescheduleMaintenanceRequest. */ - class SqlInstancesRescheduleMaintenanceRequest implements ISqlInstancesRescheduleMaintenanceRequest { - - /** - * Constructs a new SqlInstancesRescheduleMaintenanceRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest); - - /** SqlInstancesRescheduleMaintenanceRequest instance. */ - public instance: string; - - /** SqlInstancesRescheduleMaintenanceRequest project. */ - public project: string; - - /** SqlInstancesRescheduleMaintenanceRequest body. */ - public body?: (google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody|null); - - /** - * Creates a new SqlInstancesRescheduleMaintenanceRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRescheduleMaintenanceRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. - * @param message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. - * @param message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRescheduleMaintenanceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRescheduleMaintenanceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest; - - /** - * Verifies a SqlInstancesRescheduleMaintenanceRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRescheduleMaintenanceRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRescheduleMaintenanceRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest; - - /** - * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRescheduleMaintenanceRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRescheduleMaintenanceRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRescheduleMaintenanceRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesReencryptRequest. */ - interface ISqlInstancesReencryptRequest { - - /** SqlInstancesReencryptRequest instance */ - instance?: (string|null); - - /** SqlInstancesReencryptRequest project */ - project?: (string|null); - - /** SqlInstancesReencryptRequest body */ - body?: (google.cloud.sql.v1.IInstancesReencryptRequest|null); - } - - /** Represents a SqlInstancesReencryptRequest. */ - class SqlInstancesReencryptRequest implements ISqlInstancesReencryptRequest { - - /** - * Constructs a new SqlInstancesReencryptRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesReencryptRequest); - - /** SqlInstancesReencryptRequest instance. */ - public instance: string; - - /** SqlInstancesReencryptRequest project. */ - public project: string; - - /** SqlInstancesReencryptRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesReencryptRequest|null); - - /** - * Creates a new SqlInstancesReencryptRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesReencryptRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesReencryptRequest): google.cloud.sql.v1.SqlInstancesReencryptRequest; - - /** - * Encodes the specified SqlInstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReencryptRequest.verify|verify} messages. - * @param message SqlInstancesReencryptRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReencryptRequest.verify|verify} messages. - * @param message SqlInstancesReencryptRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesReencryptRequest; - - /** - * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesReencryptRequest; - - /** - * Verifies a SqlInstancesReencryptRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesReencryptRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesReencryptRequest; - - /** - * Creates a plain object from a SqlInstancesReencryptRequest message. Also converts values to other types if specified. - * @param message SqlInstancesReencryptRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesReencryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesReencryptRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesReencryptRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesReencryptRequest. */ - interface IInstancesReencryptRequest { - - /** InstancesReencryptRequest backupReencryptionConfig */ - backupReencryptionConfig?: (google.cloud.sql.v1.IBackupReencryptionConfig|null); - } - - /** Represents an InstancesReencryptRequest. */ - class InstancesReencryptRequest implements IInstancesReencryptRequest { - - /** - * Constructs a new InstancesReencryptRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesReencryptRequest); - - /** InstancesReencryptRequest backupReencryptionConfig. */ - public backupReencryptionConfig?: (google.cloud.sql.v1.IBackupReencryptionConfig|null); - - /** - * Creates a new InstancesReencryptRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesReencryptRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesReencryptRequest): google.cloud.sql.v1.InstancesReencryptRequest; - - /** - * Encodes the specified InstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesReencryptRequest.verify|verify} messages. - * @param message InstancesReencryptRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesReencryptRequest.verify|verify} messages. - * @param message InstancesReencryptRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesReencryptRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesReencryptRequest; - - /** - * Decodes an InstancesReencryptRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesReencryptRequest; - - /** - * Verifies an InstancesReencryptRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesReencryptRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesReencryptRequest; - - /** - * Creates a plain object from an InstancesReencryptRequest message. Also converts values to other types if specified. - * @param message InstancesReencryptRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesReencryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesReencryptRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesReencryptRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BackupReencryptionConfig. */ - interface IBackupReencryptionConfig { - - /** BackupReencryptionConfig backupLimit */ - backupLimit?: (number|null); - - /** BackupReencryptionConfig backupType */ - backupType?: (google.cloud.sql.v1.BackupReencryptionConfig.BackupType|keyof typeof google.cloud.sql.v1.BackupReencryptionConfig.BackupType|null); - } - - /** Represents a BackupReencryptionConfig. */ - class BackupReencryptionConfig implements IBackupReencryptionConfig { - - /** - * Constructs a new BackupReencryptionConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IBackupReencryptionConfig); - - /** BackupReencryptionConfig backupLimit. */ - public backupLimit?: (number|null); - - /** BackupReencryptionConfig backupType. */ - public backupType?: (google.cloud.sql.v1.BackupReencryptionConfig.BackupType|keyof typeof google.cloud.sql.v1.BackupReencryptionConfig.BackupType|null); - - /** - * Creates a new BackupReencryptionConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupReencryptionConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IBackupReencryptionConfig): google.cloud.sql.v1.BackupReencryptionConfig; - - /** - * Encodes the specified BackupReencryptionConfig message. Does not implicitly {@link google.cloud.sql.v1.BackupReencryptionConfig.verify|verify} messages. - * @param message BackupReencryptionConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IBackupReencryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupReencryptionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupReencryptionConfig.verify|verify} messages. - * @param message BackupReencryptionConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IBackupReencryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupReencryptionConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupReencryptionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BackupReencryptionConfig; - - /** - * Decodes a BackupReencryptionConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupReencryptionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BackupReencryptionConfig; - - /** - * Verifies a BackupReencryptionConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupReencryptionConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupReencryptionConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BackupReencryptionConfig; - - /** - * Creates a plain object from a BackupReencryptionConfig message. Also converts values to other types if specified. - * @param message BackupReencryptionConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.BackupReencryptionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupReencryptionConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupReencryptionConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace BackupReencryptionConfig { - - /** BackupType enum. */ - enum BackupType { - BACKUP_TYPE_UNSPECIFIED = 0, - AUTOMATED = 1, - ON_DEMAND = 2 - } - } - - /** ExternalSyncParallelLevel enum. */ - enum ExternalSyncParallelLevel { - EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED = 0, - MIN = 1, - OPTIMAL = 2, - MAX = 3 - } - - /** Properties of an ExternalSyncSelectedObject. */ - interface IExternalSyncSelectedObject { - - /** ExternalSyncSelectedObject database */ - database?: (string|null); - } - - /** Represents an ExternalSyncSelectedObject. */ - class ExternalSyncSelectedObject implements IExternalSyncSelectedObject { - - /** - * Constructs a new ExternalSyncSelectedObject. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IExternalSyncSelectedObject); - - /** ExternalSyncSelectedObject database. */ - public database: string; - - /** - * Creates a new ExternalSyncSelectedObject instance using the specified properties. - * @param [properties] Properties to set - * @returns ExternalSyncSelectedObject instance - */ - public static create(properties?: google.cloud.sql.v1.IExternalSyncSelectedObject): google.cloud.sql.v1.ExternalSyncSelectedObject; - - /** - * Encodes the specified ExternalSyncSelectedObject message. Does not implicitly {@link google.cloud.sql.v1.ExternalSyncSelectedObject.verify|verify} messages. - * @param message ExternalSyncSelectedObject message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IExternalSyncSelectedObject, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExternalSyncSelectedObject message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExternalSyncSelectedObject.verify|verify} messages. - * @param message ExternalSyncSelectedObject message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IExternalSyncSelectedObject, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExternalSyncSelectedObject - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExternalSyncSelectedObject; - - /** - * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExternalSyncSelectedObject - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExternalSyncSelectedObject; - - /** - * Verifies an ExternalSyncSelectedObject message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ExternalSyncSelectedObject message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExternalSyncSelectedObject - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExternalSyncSelectedObject; - - /** - * Creates a plain object from an ExternalSyncSelectedObject message. Also converts values to other types if specified. - * @param message ExternalSyncSelectedObject - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ExternalSyncSelectedObject, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExternalSyncSelectedObject to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExternalSyncSelectedObject - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesGetDiskShrinkConfigRequest. */ - interface ISqlInstancesGetDiskShrinkConfigRequest { - - /** SqlInstancesGetDiskShrinkConfigRequest instance */ - instance?: (string|null); - - /** SqlInstancesGetDiskShrinkConfigRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesGetDiskShrinkConfigRequest. */ - class SqlInstancesGetDiskShrinkConfigRequest implements ISqlInstancesGetDiskShrinkConfigRequest { - - /** - * Constructs a new SqlInstancesGetDiskShrinkConfigRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest); - - /** SqlInstancesGetDiskShrinkConfigRequest instance. */ - public instance: string; - - /** SqlInstancesGetDiskShrinkConfigRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesGetDiskShrinkConfigRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesGetDiskShrinkConfigRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. - * @param message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. - * @param message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesGetDiskShrinkConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesGetDiskShrinkConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest; - - /** - * Verifies a SqlInstancesGetDiskShrinkConfigRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesGetDiskShrinkConfigRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesGetDiskShrinkConfigRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest; - - /** - * Creates a plain object from a SqlInstancesGetDiskShrinkConfigRequest message. Also converts values to other types if specified. - * @param message SqlInstancesGetDiskShrinkConfigRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesGetDiskShrinkConfigRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesGetDiskShrinkConfigRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesVerifyExternalSyncSettingsRequest. */ - interface ISqlInstancesVerifyExternalSyncSettingsRequest { - - /** SqlInstancesVerifyExternalSyncSettingsRequest instance */ - instance?: (string|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest project */ - project?: (string|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly */ - verifyConnectionOnly?: (boolean|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest syncMode */ - syncMode?: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly */ - verifyReplicationOnly?: (boolean|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig */ - mysqlSyncConfig?: (google.cloud.sql.v1.IMySqlSyncConfig|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest migrationType */ - migrationType?: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel */ - syncParallelLevel?: (google.cloud.sql.v1.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1.ExternalSyncParallelLevel|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects */ - selectedObjects?: (google.cloud.sql.v1.IExternalSyncSelectedObject[]|null); - } - - /** Represents a SqlInstancesVerifyExternalSyncSettingsRequest. */ - class SqlInstancesVerifyExternalSyncSettingsRequest implements ISqlInstancesVerifyExternalSyncSettingsRequest { - - /** - * Constructs a new SqlInstancesVerifyExternalSyncSettingsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest); - - /** SqlInstancesVerifyExternalSyncSettingsRequest instance. */ - public instance: string; - - /** SqlInstancesVerifyExternalSyncSettingsRequest project. */ - public project: string; - - /** SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly. */ - public verifyConnectionOnly: boolean; - - /** SqlInstancesVerifyExternalSyncSettingsRequest syncMode. */ - public syncMode: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode); - - /** SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly. */ - public verifyReplicationOnly: boolean; - - /** SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig. */ - public mysqlSyncConfig?: (google.cloud.sql.v1.IMySqlSyncConfig|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest migrationType. */ - public migrationType: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType); - - /** SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel. */ - public syncParallelLevel: (google.cloud.sql.v1.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1.ExternalSyncParallelLevel); - - /** SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects. */ - public selectedObjects: google.cloud.sql.v1.IExternalSyncSelectedObject[]; - - /** SqlInstancesVerifyExternalSyncSettingsRequest syncConfig. */ - public syncConfig?: "mysqlSyncConfig"; - - /** - * Creates a new SqlInstancesVerifyExternalSyncSettingsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesVerifyExternalSyncSettingsRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. - * @param message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. - * @param message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesVerifyExternalSyncSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesVerifyExternalSyncSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest; - - /** - * Verifies a SqlInstancesVerifyExternalSyncSettingsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesVerifyExternalSyncSettingsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesVerifyExternalSyncSettingsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest; - - /** - * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsRequest message. Also converts values to other types if specified. - * @param message SqlInstancesVerifyExternalSyncSettingsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesVerifyExternalSyncSettingsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlInstancesVerifyExternalSyncSettingsRequest { - - /** ExternalSyncMode enum. */ - enum ExternalSyncMode { - EXTERNAL_SYNC_MODE_UNSPECIFIED = 0, - ONLINE = 1, - OFFLINE = 2 - } - - /** MigrationType enum. */ - enum MigrationType { - MIGRATION_TYPE_UNSPECIFIED = 0, - LOGICAL = 1, - PHYSICAL = 2 - } - } - - /** Properties of a SqlInstancesStartExternalSyncRequest. */ - interface ISqlInstancesStartExternalSyncRequest { - - /** SqlInstancesStartExternalSyncRequest instance */ - instance?: (string|null); - - /** SqlInstancesStartExternalSyncRequest project */ - project?: (string|null); - - /** SqlInstancesStartExternalSyncRequest syncMode */ - syncMode?: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null); - - /** SqlInstancesStartExternalSyncRequest skipVerification */ - skipVerification?: (boolean|null); - - /** SqlInstancesStartExternalSyncRequest mysqlSyncConfig */ - mysqlSyncConfig?: (google.cloud.sql.v1.IMySqlSyncConfig|null); - - /** SqlInstancesStartExternalSyncRequest syncParallelLevel */ - syncParallelLevel?: (google.cloud.sql.v1.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1.ExternalSyncParallelLevel|null); - - /** SqlInstancesStartExternalSyncRequest migrationType */ - migrationType?: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null); - - /** SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled */ - replicaOverwriteEnabled?: (boolean|null); - } - - /** Represents a SqlInstancesStartExternalSyncRequest. */ - class SqlInstancesStartExternalSyncRequest implements ISqlInstancesStartExternalSyncRequest { - - /** - * Constructs a new SqlInstancesStartExternalSyncRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest); - - /** SqlInstancesStartExternalSyncRequest instance. */ - public instance: string; - - /** SqlInstancesStartExternalSyncRequest project. */ - public project: string; - - /** SqlInstancesStartExternalSyncRequest syncMode. */ - public syncMode: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode); - - /** SqlInstancesStartExternalSyncRequest skipVerification. */ - public skipVerification: boolean; - - /** SqlInstancesStartExternalSyncRequest mysqlSyncConfig. */ - public mysqlSyncConfig?: (google.cloud.sql.v1.IMySqlSyncConfig|null); - - /** SqlInstancesStartExternalSyncRequest syncParallelLevel. */ - public syncParallelLevel: (google.cloud.sql.v1.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1.ExternalSyncParallelLevel); - - /** SqlInstancesStartExternalSyncRequest migrationType. */ - public migrationType: (google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType); - - /** SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled. */ - public replicaOverwriteEnabled: boolean; - - /** SqlInstancesStartExternalSyncRequest syncConfig. */ - public syncConfig?: "mysqlSyncConfig"; - - /** - * Creates a new SqlInstancesStartExternalSyncRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesStartExternalSyncRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest): google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest; - - /** - * Encodes the specified SqlInstancesStartExternalSyncRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.verify|verify} messages. - * @param message SqlInstancesStartExternalSyncRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesStartExternalSyncRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.verify|verify} messages. - * @param message SqlInstancesStartExternalSyncRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesStartExternalSyncRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest; - - /** - * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesStartExternalSyncRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest; - - /** - * Verifies a SqlInstancesStartExternalSyncRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesStartExternalSyncRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesStartExternalSyncRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest; - - /** - * Creates a plain object from a SqlInstancesStartExternalSyncRequest message. Also converts values to other types if specified. - * @param message SqlInstancesStartExternalSyncRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesStartExternalSyncRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesStartExternalSyncRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesResetReplicaSizeRequest. */ - interface ISqlInstancesResetReplicaSizeRequest { - - /** SqlInstancesResetReplicaSizeRequest instance */ - instance?: (string|null); - - /** SqlInstancesResetReplicaSizeRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesResetReplicaSizeRequest. */ - class SqlInstancesResetReplicaSizeRequest implements ISqlInstancesResetReplicaSizeRequest { - - /** - * Constructs a new SqlInstancesResetReplicaSizeRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest); - - /** SqlInstancesResetReplicaSizeRequest instance. */ - public instance: string; - - /** SqlInstancesResetReplicaSizeRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesResetReplicaSizeRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesResetReplicaSizeRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest): google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest; - - /** - * Encodes the specified SqlInstancesResetReplicaSizeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. - * @param message SqlInstancesResetReplicaSizeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesResetReplicaSizeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. - * @param message SqlInstancesResetReplicaSizeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesResetReplicaSizeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest; - - /** - * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesResetReplicaSizeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest; - - /** - * Verifies a SqlInstancesResetReplicaSizeRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesResetReplicaSizeRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesResetReplicaSizeRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest; - - /** - * Creates a plain object from a SqlInstancesResetReplicaSizeRequest message. Also converts values to other types if specified. - * @param message SqlInstancesResetReplicaSizeRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesResetReplicaSizeRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesResetReplicaSizeRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesCreateEphemeralCertRequest. */ - interface ISqlInstancesCreateEphemeralCertRequest { - - /** SqlInstancesCreateEphemeralCertRequest instance */ - instance?: (string|null); - - /** SqlInstancesCreateEphemeralCertRequest project */ - project?: (string|null); - - /** SqlInstancesCreateEphemeralCertRequest body */ - body?: (google.cloud.sql.v1.ISslCertsCreateEphemeralRequest|null); - } - - /** Represents a SqlInstancesCreateEphemeralCertRequest. */ - class SqlInstancesCreateEphemeralCertRequest implements ISqlInstancesCreateEphemeralCertRequest { - - /** - * Constructs a new SqlInstancesCreateEphemeralCertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest); - - /** SqlInstancesCreateEphemeralCertRequest instance. */ - public instance: string; - - /** SqlInstancesCreateEphemeralCertRequest project. */ - public project: string; - - /** SqlInstancesCreateEphemeralCertRequest body. */ - public body?: (google.cloud.sql.v1.ISslCertsCreateEphemeralRequest|null); - - /** - * Creates a new SqlInstancesCreateEphemeralCertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesCreateEphemeralCertRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest): google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest; - - /** - * Encodes the specified SqlInstancesCreateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. - * @param message SqlInstancesCreateEphemeralCertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesCreateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. - * @param message SqlInstancesCreateEphemeralCertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesCreateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest; - - /** - * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesCreateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest; - - /** - * Verifies a SqlInstancesCreateEphemeralCertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesCreateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesCreateEphemeralCertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest; - - /** - * Creates a plain object from a SqlInstancesCreateEphemeralCertRequest message. Also converts values to other types if specified. - * @param message SqlInstancesCreateEphemeralCertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesCreateEphemeralCertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesCreateEphemeralCertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesCloneRequest. */ - interface IInstancesCloneRequest { - - /** InstancesCloneRequest cloneContext */ - cloneContext?: (google.cloud.sql.v1.ICloneContext|null); - } - - /** Represents an InstancesCloneRequest. */ - class InstancesCloneRequest implements IInstancesCloneRequest { - - /** - * Constructs a new InstancesCloneRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesCloneRequest); - - /** InstancesCloneRequest cloneContext. */ - public cloneContext?: (google.cloud.sql.v1.ICloneContext|null); - - /** - * Creates a new InstancesCloneRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesCloneRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesCloneRequest): google.cloud.sql.v1.InstancesCloneRequest; - - /** - * Encodes the specified InstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesCloneRequest.verify|verify} messages. - * @param message InstancesCloneRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesCloneRequest.verify|verify} messages. - * @param message InstancesCloneRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesCloneRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesCloneRequest; - - /** - * Decodes an InstancesCloneRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesCloneRequest; - - /** - * Verifies an InstancesCloneRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesCloneRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesCloneRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesCloneRequest; - - /** - * Creates a plain object from an InstancesCloneRequest message. Also converts values to other types if specified. - * @param message InstancesCloneRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesCloneRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesCloneRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesCloneRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesDemoteMasterRequest. */ - interface IInstancesDemoteMasterRequest { - - /** InstancesDemoteMasterRequest demoteMasterContext */ - demoteMasterContext?: (google.cloud.sql.v1.IDemoteMasterContext|null); - } - - /** Represents an InstancesDemoteMasterRequest. */ - class InstancesDemoteMasterRequest implements IInstancesDemoteMasterRequest { - - /** - * Constructs a new InstancesDemoteMasterRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesDemoteMasterRequest); - - /** InstancesDemoteMasterRequest demoteMasterContext. */ - public demoteMasterContext?: (google.cloud.sql.v1.IDemoteMasterContext|null); - - /** - * Creates a new InstancesDemoteMasterRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesDemoteMasterRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesDemoteMasterRequest): google.cloud.sql.v1.InstancesDemoteMasterRequest; - - /** - * Encodes the specified InstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteMasterRequest.verify|verify} messages. - * @param message InstancesDemoteMasterRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteMasterRequest.verify|verify} messages. - * @param message InstancesDemoteMasterRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesDemoteMasterRequest; - - /** - * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesDemoteMasterRequest; - - /** - * Verifies an InstancesDemoteMasterRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesDemoteMasterRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesDemoteMasterRequest; - - /** - * Creates a plain object from an InstancesDemoteMasterRequest message. Also converts values to other types if specified. - * @param message InstancesDemoteMasterRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesDemoteMasterRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesDemoteMasterRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesDemoteMasterRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesDemoteRequest. */ - interface IInstancesDemoteRequest { - - /** InstancesDemoteRequest demoteContext */ - demoteContext?: (google.cloud.sql.v1.IDemoteContext|null); - } - - /** Represents an InstancesDemoteRequest. */ - class InstancesDemoteRequest implements IInstancesDemoteRequest { - - /** - * Constructs a new InstancesDemoteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesDemoteRequest); - - /** InstancesDemoteRequest demoteContext. */ - public demoteContext?: (google.cloud.sql.v1.IDemoteContext|null); - - /** - * Creates a new InstancesDemoteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesDemoteRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesDemoteRequest): google.cloud.sql.v1.InstancesDemoteRequest; - - /** - * Encodes the specified InstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteRequest.verify|verify} messages. - * @param message InstancesDemoteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteRequest.verify|verify} messages. - * @param message InstancesDemoteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesDemoteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesDemoteRequest; - - /** - * Decodes an InstancesDemoteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesDemoteRequest; - - /** - * Verifies an InstancesDemoteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesDemoteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesDemoteRequest; - - /** - * Creates a plain object from an InstancesDemoteRequest message. Also converts values to other types if specified. - * @param message InstancesDemoteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesDemoteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesDemoteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesDemoteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesExportRequest. */ - interface IInstancesExportRequest { - - /** InstancesExportRequest exportContext */ - exportContext?: (google.cloud.sql.v1.IExportContext|null); - } - - /** Represents an InstancesExportRequest. */ - class InstancesExportRequest implements IInstancesExportRequest { - - /** - * Constructs a new InstancesExportRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesExportRequest); - - /** InstancesExportRequest exportContext. */ - public exportContext?: (google.cloud.sql.v1.IExportContext|null); - - /** - * Creates a new InstancesExportRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesExportRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesExportRequest): google.cloud.sql.v1.InstancesExportRequest; - - /** - * Encodes the specified InstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesExportRequest.verify|verify} messages. - * @param message InstancesExportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesExportRequest.verify|verify} messages. - * @param message InstancesExportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesExportRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesExportRequest; - - /** - * Decodes an InstancesExportRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesExportRequest; - - /** - * Verifies an InstancesExportRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesExportRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesExportRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesExportRequest; - - /** - * Creates a plain object from an InstancesExportRequest message. Also converts values to other types if specified. - * @param message InstancesExportRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesExportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesExportRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesExportRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesFailoverRequest. */ - interface IInstancesFailoverRequest { - - /** InstancesFailoverRequest failoverContext */ - failoverContext?: (google.cloud.sql.v1.IFailoverContext|null); - } - - /** Represents an InstancesFailoverRequest. */ - class InstancesFailoverRequest implements IInstancesFailoverRequest { - - /** - * Constructs a new InstancesFailoverRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesFailoverRequest); - - /** InstancesFailoverRequest failoverContext. */ - public failoverContext?: (google.cloud.sql.v1.IFailoverContext|null); - - /** - * Creates a new InstancesFailoverRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesFailoverRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesFailoverRequest): google.cloud.sql.v1.InstancesFailoverRequest; - - /** - * Encodes the specified InstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesFailoverRequest.verify|verify} messages. - * @param message InstancesFailoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesFailoverRequest.verify|verify} messages. - * @param message InstancesFailoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesFailoverRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesFailoverRequest; - - /** - * Decodes an InstancesFailoverRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesFailoverRequest; - - /** - * Verifies an InstancesFailoverRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesFailoverRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesFailoverRequest; - - /** - * Creates a plain object from an InstancesFailoverRequest message. Also converts values to other types if specified. - * @param message InstancesFailoverRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesFailoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesFailoverRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesFailoverRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCertsCreateEphemeralRequest. */ - interface ISslCertsCreateEphemeralRequest { - - /** SslCertsCreateEphemeralRequest publicKey */ - publicKey?: (string|null); - - /** SslCertsCreateEphemeralRequest accessToken */ - accessToken?: (string|null); - } - - /** Represents a SslCertsCreateEphemeralRequest. */ - class SslCertsCreateEphemeralRequest implements ISslCertsCreateEphemeralRequest { - - /** - * Constructs a new SslCertsCreateEphemeralRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISslCertsCreateEphemeralRequest); - - /** SslCertsCreateEphemeralRequest publicKey. */ - public publicKey: string; - - /** SslCertsCreateEphemeralRequest accessToken. */ - public accessToken: string; - - /** - * Creates a new SslCertsCreateEphemeralRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCertsCreateEphemeralRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISslCertsCreateEphemeralRequest): google.cloud.sql.v1.SslCertsCreateEphemeralRequest; - - /** - * Encodes the specified SslCertsCreateEphemeralRequest message. Does not implicitly {@link google.cloud.sql.v1.SslCertsCreateEphemeralRequest.verify|verify} messages. - * @param message SslCertsCreateEphemeralRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISslCertsCreateEphemeralRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCertsCreateEphemeralRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsCreateEphemeralRequest.verify|verify} messages. - * @param message SslCertsCreateEphemeralRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISslCertsCreateEphemeralRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCertsCreateEphemeralRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCertsCreateEphemeralRequest; - - /** - * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCertsCreateEphemeralRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCertsCreateEphemeralRequest; - - /** - * Verifies a SslCertsCreateEphemeralRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCertsCreateEphemeralRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCertsCreateEphemeralRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCertsCreateEphemeralRequest; - - /** - * Creates a plain object from a SslCertsCreateEphemeralRequest message. Also converts values to other types if specified. - * @param message SslCertsCreateEphemeralRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SslCertsCreateEphemeralRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCertsCreateEphemeralRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCertsCreateEphemeralRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesImportRequest. */ - interface IInstancesImportRequest { - - /** InstancesImportRequest importContext */ - importContext?: (google.cloud.sql.v1.IImportContext|null); - } - - /** Represents an InstancesImportRequest. */ - class InstancesImportRequest implements IInstancesImportRequest { - - /** - * Constructs a new InstancesImportRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesImportRequest); - - /** InstancesImportRequest importContext. */ - public importContext?: (google.cloud.sql.v1.IImportContext|null); - - /** - * Creates a new InstancesImportRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesImportRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesImportRequest): google.cloud.sql.v1.InstancesImportRequest; - - /** - * Encodes the specified InstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesImportRequest.verify|verify} messages. - * @param message InstancesImportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesImportRequest.verify|verify} messages. - * @param message InstancesImportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesImportRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesImportRequest; - - /** - * Decodes an InstancesImportRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesImportRequest; - - /** - * Verifies an InstancesImportRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesImportRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesImportRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesImportRequest; - - /** - * Creates a plain object from an InstancesImportRequest message. Also converts values to other types if specified. - * @param message InstancesImportRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesImportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesImportRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesImportRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesPreCheckMajorVersionUpgradeRequest. */ - interface IInstancesPreCheckMajorVersionUpgradeRequest { - - /** InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext */ - preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null); - } - - /** Represents an InstancesPreCheckMajorVersionUpgradeRequest. */ - class InstancesPreCheckMajorVersionUpgradeRequest implements IInstancesPreCheckMajorVersionUpgradeRequest { - - /** - * Constructs a new InstancesPreCheckMajorVersionUpgradeRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest); - - /** InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext. */ - public preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null); - - /** - * Creates a new InstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesPreCheckMajorVersionUpgradeRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest): google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @param message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @param message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Verifies an InstancesPreCheckMajorVersionUpgradeRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesPreCheckMajorVersionUpgradeRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Creates a plain object from an InstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. - * @param message InstancesPreCheckMajorVersionUpgradeRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesPreCheckMajorVersionUpgradeRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesPreCheckMajorVersionUpgradeRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesListResponse. */ - interface IInstancesListResponse { - - /** InstancesListResponse kind */ - kind?: (string|null); - - /** InstancesListResponse warnings */ - warnings?: (google.cloud.sql.v1.IApiWarning[]|null); - - /** InstancesListResponse items */ - items?: (google.cloud.sql.v1.IDatabaseInstance[]|null); - - /** InstancesListResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents an InstancesListResponse. */ - class InstancesListResponse implements IInstancesListResponse { - - /** - * Constructs a new InstancesListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesListResponse); - - /** InstancesListResponse kind. */ - public kind: string; - - /** InstancesListResponse warnings. */ - public warnings: google.cloud.sql.v1.IApiWarning[]; - - /** InstancesListResponse items. */ - public items: google.cloud.sql.v1.IDatabaseInstance[]; - - /** InstancesListResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new InstancesListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesListResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesListResponse): google.cloud.sql.v1.InstancesListResponse; - - /** - * Encodes the specified InstancesListResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListResponse.verify|verify} messages. - * @param message InstancesListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListResponse.verify|verify} messages. - * @param message InstancesListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesListResponse; - - /** - * Decodes an InstancesListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesListResponse; - - /** - * Verifies an InstancesListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesListResponse; - - /** - * Creates a plain object from an InstancesListResponse message. Also converts values to other types if specified. - * @param message InstancesListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesListServerCasResponse. */ - interface IInstancesListServerCasResponse { - - /** InstancesListServerCasResponse certs */ - certs?: (google.cloud.sql.v1.ISslCert[]|null); - - /** InstancesListServerCasResponse activeVersion */ - activeVersion?: (string|null); - - /** InstancesListServerCasResponse kind */ - kind?: (string|null); - } - - /** Represents an InstancesListServerCasResponse. */ - class InstancesListServerCasResponse implements IInstancesListServerCasResponse { - - /** - * Constructs a new InstancesListServerCasResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesListServerCasResponse); - - /** InstancesListServerCasResponse certs. */ - public certs: google.cloud.sql.v1.ISslCert[]; - - /** InstancesListServerCasResponse activeVersion. */ - public activeVersion: string; - - /** InstancesListServerCasResponse kind. */ - public kind: string; - - /** - * Creates a new InstancesListServerCasResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesListServerCasResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesListServerCasResponse): google.cloud.sql.v1.InstancesListServerCasResponse; - - /** - * Encodes the specified InstancesListServerCasResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCasResponse.verify|verify} messages. - * @param message InstancesListServerCasResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesListServerCasResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesListServerCasResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCasResponse.verify|verify} messages. - * @param message InstancesListServerCasResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesListServerCasResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesListServerCasResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesListServerCasResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesListServerCasResponse; - - /** - * Decodes an InstancesListServerCasResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesListServerCasResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesListServerCasResponse; - - /** - * Verifies an InstancesListServerCasResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesListServerCasResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesListServerCasResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesListServerCasResponse; - - /** - * Creates a plain object from an InstancesListServerCasResponse message. Also converts values to other types if specified. - * @param message InstancesListServerCasResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesListServerCasResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesListServerCasResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesListServerCasResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesListServerCertificatesResponse. */ - interface IInstancesListServerCertificatesResponse { - - /** InstancesListServerCertificatesResponse caCerts */ - caCerts?: (google.cloud.sql.v1.ISslCert[]|null); - - /** InstancesListServerCertificatesResponse serverCerts */ - serverCerts?: (google.cloud.sql.v1.ISslCert[]|null); - - /** InstancesListServerCertificatesResponse activeVersion */ - activeVersion?: (string|null); - - /** InstancesListServerCertificatesResponse kind */ - kind?: (string|null); - } - - /** Represents an InstancesListServerCertificatesResponse. */ - class InstancesListServerCertificatesResponse implements IInstancesListServerCertificatesResponse { - - /** - * Constructs a new InstancesListServerCertificatesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesListServerCertificatesResponse); - - /** InstancesListServerCertificatesResponse caCerts. */ - public caCerts: google.cloud.sql.v1.ISslCert[]; - - /** InstancesListServerCertificatesResponse serverCerts. */ - public serverCerts: google.cloud.sql.v1.ISslCert[]; - - /** InstancesListServerCertificatesResponse activeVersion. */ - public activeVersion: string; - - /** InstancesListServerCertificatesResponse kind. */ - public kind: string; - - /** - * Creates a new InstancesListServerCertificatesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesListServerCertificatesResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesListServerCertificatesResponse): google.cloud.sql.v1.InstancesListServerCertificatesResponse; - - /** - * Encodes the specified InstancesListServerCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCertificatesResponse.verify|verify} messages. - * @param message InstancesListServerCertificatesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesListServerCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesListServerCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCertificatesResponse.verify|verify} messages. - * @param message InstancesListServerCertificatesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesListServerCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesListServerCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesListServerCertificatesResponse; - - /** - * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesListServerCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesListServerCertificatesResponse; - - /** - * Verifies an InstancesListServerCertificatesResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesListServerCertificatesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesListServerCertificatesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesListServerCertificatesResponse; - - /** - * Creates a plain object from an InstancesListServerCertificatesResponse message. Also converts values to other types if specified. - * @param message InstancesListServerCertificatesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesListServerCertificatesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesListServerCertificatesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesListServerCertificatesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesListEntraIdCertificatesResponse. */ - interface IInstancesListEntraIdCertificatesResponse { - - /** InstancesListEntraIdCertificatesResponse certs */ - certs?: (google.cloud.sql.v1.ISslCert[]|null); - - /** InstancesListEntraIdCertificatesResponse activeVersion */ - activeVersion?: (string|null); - - /** InstancesListEntraIdCertificatesResponse kind */ - kind?: (string|null); - } - - /** Represents an InstancesListEntraIdCertificatesResponse. */ - class InstancesListEntraIdCertificatesResponse implements IInstancesListEntraIdCertificatesResponse { - - /** - * Constructs a new InstancesListEntraIdCertificatesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse); - - /** InstancesListEntraIdCertificatesResponse certs. */ - public certs: google.cloud.sql.v1.ISslCert[]; - - /** InstancesListEntraIdCertificatesResponse activeVersion. */ - public activeVersion: string; - - /** InstancesListEntraIdCertificatesResponse kind. */ - public kind: string; - - /** - * Creates a new InstancesListEntraIdCertificatesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesListEntraIdCertificatesResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse): google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse; - - /** - * Encodes the specified InstancesListEntraIdCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.verify|verify} messages. - * @param message InstancesListEntraIdCertificatesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesListEntraIdCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.verify|verify} messages. - * @param message InstancesListEntraIdCertificatesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesListEntraIdCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse; - - /** - * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesListEntraIdCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse; - - /** - * Verifies an InstancesListEntraIdCertificatesResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesListEntraIdCertificatesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesListEntraIdCertificatesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse; - - /** - * Creates a plain object from an InstancesListEntraIdCertificatesResponse message. Also converts values to other types if specified. - * @param message InstancesListEntraIdCertificatesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesListEntraIdCertificatesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesListEntraIdCertificatesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesRestoreBackupRequest. */ - interface IInstancesRestoreBackupRequest { - - /** InstancesRestoreBackupRequest restoreBackupContext */ - restoreBackupContext?: (google.cloud.sql.v1.IRestoreBackupContext|null); - - /** InstancesRestoreBackupRequest backup */ - backup?: (string|null); - - /** InstancesRestoreBackupRequest backupdrBackup */ - backupdrBackup?: (string|null); - - /** InstancesRestoreBackupRequest restoreInstanceSettings */ - restoreInstanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); - - /** InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames */ - restoreInstanceClearOverridesFieldNames?: (string[]|null); - } - - /** Represents an InstancesRestoreBackupRequest. */ - class InstancesRestoreBackupRequest implements IInstancesRestoreBackupRequest { - - /** - * Constructs a new InstancesRestoreBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesRestoreBackupRequest); - - /** InstancesRestoreBackupRequest restoreBackupContext. */ - public restoreBackupContext?: (google.cloud.sql.v1.IRestoreBackupContext|null); - - /** InstancesRestoreBackupRequest backup. */ - public backup: string; - - /** InstancesRestoreBackupRequest backupdrBackup. */ - public backupdrBackup: string; - - /** InstancesRestoreBackupRequest restoreInstanceSettings. */ - public restoreInstanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); - - /** InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames. */ - public restoreInstanceClearOverridesFieldNames: string[]; - - /** - * Creates a new InstancesRestoreBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesRestoreBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesRestoreBackupRequest): google.cloud.sql.v1.InstancesRestoreBackupRequest; - - /** - * Encodes the specified InstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRestoreBackupRequest.verify|verify} messages. - * @param message InstancesRestoreBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRestoreBackupRequest.verify|verify} messages. - * @param message InstancesRestoreBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesRestoreBackupRequest; - - /** - * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesRestoreBackupRequest; - - /** - * Verifies an InstancesRestoreBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesRestoreBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesRestoreBackupRequest; - - /** - * Creates a plain object from an InstancesRestoreBackupRequest message. Also converts values to other types if specified. - * @param message InstancesRestoreBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesRestoreBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesRestoreBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesRestoreBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesRotateServerCaRequest. */ - interface IInstancesRotateServerCaRequest { - - /** InstancesRotateServerCaRequest rotateServerCaContext */ - rotateServerCaContext?: (google.cloud.sql.v1.IRotateServerCaContext|null); - } - - /** Represents an InstancesRotateServerCaRequest. */ - class InstancesRotateServerCaRequest implements IInstancesRotateServerCaRequest { - - /** - * Constructs a new InstancesRotateServerCaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesRotateServerCaRequest); - - /** InstancesRotateServerCaRequest rotateServerCaContext. */ - public rotateServerCaContext?: (google.cloud.sql.v1.IRotateServerCaContext|null); - - /** - * Creates a new InstancesRotateServerCaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesRotateServerCaRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesRotateServerCaRequest): google.cloud.sql.v1.InstancesRotateServerCaRequest; - - /** - * Encodes the specified InstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCaRequest.verify|verify} messages. - * @param message InstancesRotateServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCaRequest.verify|verify} messages. - * @param message InstancesRotateServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesRotateServerCaRequest; - - /** - * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesRotateServerCaRequest; - - /** - * Verifies an InstancesRotateServerCaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesRotateServerCaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesRotateServerCaRequest; - - /** - * Creates a plain object from an InstancesRotateServerCaRequest message. Also converts values to other types if specified. - * @param message InstancesRotateServerCaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesRotateServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesRotateServerCaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesRotateServerCaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesRotateServerCertificateRequest. */ - interface IInstancesRotateServerCertificateRequest { - - /** InstancesRotateServerCertificateRequest rotateServerCertificateContext */ - rotateServerCertificateContext?: (google.cloud.sql.v1.IRotateServerCertificateContext|null); - } - - /** Represents an InstancesRotateServerCertificateRequest. */ - class InstancesRotateServerCertificateRequest implements IInstancesRotateServerCertificateRequest { - - /** - * Constructs a new InstancesRotateServerCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesRotateServerCertificateRequest); - - /** InstancesRotateServerCertificateRequest rotateServerCertificateContext. */ - public rotateServerCertificateContext?: (google.cloud.sql.v1.IRotateServerCertificateContext|null); - - /** - * Creates a new InstancesRotateServerCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesRotateServerCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesRotateServerCertificateRequest): google.cloud.sql.v1.InstancesRotateServerCertificateRequest; - - /** - * Encodes the specified InstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCertificateRequest.verify|verify} messages. - * @param message InstancesRotateServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCertificateRequest.verify|verify} messages. - * @param message InstancesRotateServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesRotateServerCertificateRequest; - - /** - * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesRotateServerCertificateRequest; - - /** - * Verifies an InstancesRotateServerCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesRotateServerCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesRotateServerCertificateRequest; - - /** - * Creates a plain object from an InstancesRotateServerCertificateRequest message. Also converts values to other types if specified. - * @param message InstancesRotateServerCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesRotateServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesRotateServerCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesRotateServerCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesRotateEntraIdCertificateRequest. */ - interface IInstancesRotateEntraIdCertificateRequest { - - /** InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext */ - rotateEntraIdCertificateContext?: (google.cloud.sql.v1.IRotateEntraIdCertificateContext|null); - } - - /** Represents an InstancesRotateEntraIdCertificateRequest. */ - class InstancesRotateEntraIdCertificateRequest implements IInstancesRotateEntraIdCertificateRequest { - - /** - * Constructs a new InstancesRotateEntraIdCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest); - - /** InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext. */ - public rotateEntraIdCertificateContext?: (google.cloud.sql.v1.IRotateEntraIdCertificateContext|null); - - /** - * Creates a new InstancesRotateEntraIdCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesRotateEntraIdCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest): google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest; - - /** - * Encodes the specified InstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @param message InstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @param message InstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest; - - /** - * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest; - - /** - * Verifies an InstancesRotateEntraIdCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesRotateEntraIdCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest; - - /** - * Creates a plain object from an InstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. - * @param message InstancesRotateEntraIdCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesRotateEntraIdCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesRotateEntraIdCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesTruncateLogRequest. */ - interface IInstancesTruncateLogRequest { - - /** InstancesTruncateLogRequest truncateLogContext */ - truncateLogContext?: (google.cloud.sql.v1.ITruncateLogContext|null); - } - - /** Represents an InstancesTruncateLogRequest. */ - class InstancesTruncateLogRequest implements IInstancesTruncateLogRequest { - - /** - * Constructs a new InstancesTruncateLogRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesTruncateLogRequest); - - /** InstancesTruncateLogRequest truncateLogContext. */ - public truncateLogContext?: (google.cloud.sql.v1.ITruncateLogContext|null); - - /** - * Creates a new InstancesTruncateLogRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesTruncateLogRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesTruncateLogRequest): google.cloud.sql.v1.InstancesTruncateLogRequest; - - /** - * Encodes the specified InstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesTruncateLogRequest.verify|verify} messages. - * @param message InstancesTruncateLogRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesTruncateLogRequest.verify|verify} messages. - * @param message InstancesTruncateLogRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesTruncateLogRequest; - - /** - * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesTruncateLogRequest; - - /** - * Verifies an InstancesTruncateLogRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesTruncateLogRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesTruncateLogRequest; - - /** - * Creates a plain object from an InstancesTruncateLogRequest message. Also converts values to other types if specified. - * @param message InstancesTruncateLogRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesTruncateLogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesTruncateLogRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesTruncateLogRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesAcquireSsrsLeaseRequest. */ - interface IInstancesAcquireSsrsLeaseRequest { - - /** InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext */ - acquireSsrsLeaseContext?: (google.cloud.sql.v1.IAcquireSsrsLeaseContext|null); - } - - /** Represents an InstancesAcquireSsrsLeaseRequest. */ - class InstancesAcquireSsrsLeaseRequest implements IInstancesAcquireSsrsLeaseRequest { - - /** - * Constructs a new InstancesAcquireSsrsLeaseRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest); - - /** InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext. */ - public acquireSsrsLeaseContext?: (google.cloud.sql.v1.IAcquireSsrsLeaseContext|null); - - /** - * Creates a new InstancesAcquireSsrsLeaseRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesAcquireSsrsLeaseRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest): google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest; - - /** - * Encodes the specified InstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @param message InstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @param message InstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest; - - /** - * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest; - - /** - * Verifies an InstancesAcquireSsrsLeaseRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesAcquireSsrsLeaseRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest; - - /** - * Creates a plain object from an InstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. - * @param message InstancesAcquireSsrsLeaseRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesAcquireSsrsLeaseRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesAcquireSsrsLeaseRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesPreCheckMajorVersionUpgradeRequest. */ - interface ISqlInstancesPreCheckMajorVersionUpgradeRequest { - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest instance */ - instance?: (string|null); - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest project */ - project?: (string|null); - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest body */ - body?: (google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest|null); - } - - /** Represents a SqlInstancesPreCheckMajorVersionUpgradeRequest. */ - class SqlInstancesPreCheckMajorVersionUpgradeRequest implements ISqlInstancesPreCheckMajorVersionUpgradeRequest { - - /** - * Constructs a new SqlInstancesPreCheckMajorVersionUpgradeRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest); - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest instance. */ - public instance: string; - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest project. */ - public project: string; - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest|null); - - /** - * Creates a new SqlInstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest): google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Verifies a SqlInstancesPreCheckMajorVersionUpgradeRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Creates a plain object from a SqlInstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. - * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesPreCheckMajorVersionUpgradeRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesPreCheckMajorVersionUpgradeRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesVerifyExternalSyncSettingsResponse. */ - interface ISqlInstancesVerifyExternalSyncSettingsResponse { - - /** SqlInstancesVerifyExternalSyncSettingsResponse kind */ - kind?: (string|null); - - /** SqlInstancesVerifyExternalSyncSettingsResponse errors */ - errors?: (google.cloud.sql.v1.ISqlExternalSyncSettingError[]|null); - - /** SqlInstancesVerifyExternalSyncSettingsResponse warnings */ - warnings?: (google.cloud.sql.v1.ISqlExternalSyncSettingError[]|null); - } - - /** Represents a SqlInstancesVerifyExternalSyncSettingsResponse. */ - class SqlInstancesVerifyExternalSyncSettingsResponse implements ISqlInstancesVerifyExternalSyncSettingsResponse { - - /** - * Constructs a new SqlInstancesVerifyExternalSyncSettingsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse); - - /** SqlInstancesVerifyExternalSyncSettingsResponse kind. */ - public kind: string; - - /** SqlInstancesVerifyExternalSyncSettingsResponse errors. */ - public errors: google.cloud.sql.v1.ISqlExternalSyncSettingError[]; - - /** SqlInstancesVerifyExternalSyncSettingsResponse warnings. */ - public warnings: google.cloud.sql.v1.ISqlExternalSyncSettingError[]; - - /** - * Creates a new SqlInstancesVerifyExternalSyncSettingsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesVerifyExternalSyncSettingsResponse instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. - * @param message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. - * @param message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesVerifyExternalSyncSettingsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesVerifyExternalSyncSettingsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse; - - /** - * Verifies a SqlInstancesVerifyExternalSyncSettingsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesVerifyExternalSyncSettingsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesVerifyExternalSyncSettingsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse; - - /** - * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsResponse message. Also converts values to other types if specified. - * @param message SqlInstancesVerifyExternalSyncSettingsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesVerifyExternalSyncSettingsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesGetDiskShrinkConfigResponse. */ - interface ISqlInstancesGetDiskShrinkConfigResponse { - - /** SqlInstancesGetDiskShrinkConfigResponse kind */ - kind?: (string|null); - - /** SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb */ - minimalTargetSizeGb?: (number|Long|string|null); - - /** SqlInstancesGetDiskShrinkConfigResponse message */ - message?: (string|null); - } - - /** Represents a SqlInstancesGetDiskShrinkConfigResponse. */ - class SqlInstancesGetDiskShrinkConfigResponse implements ISqlInstancesGetDiskShrinkConfigResponse { - - /** - * Constructs a new SqlInstancesGetDiskShrinkConfigResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse); - - /** SqlInstancesGetDiskShrinkConfigResponse kind. */ - public kind: string; - - /** SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb. */ - public minimalTargetSizeGb: (number|Long|string); - - /** SqlInstancesGetDiskShrinkConfigResponse message. */ - public message: string; - - /** - * Creates a new SqlInstancesGetDiskShrinkConfigResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesGetDiskShrinkConfigResponse instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. - * @param message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. - * @param message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesGetDiskShrinkConfigResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesGetDiskShrinkConfigResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse; - - /** - * Verifies a SqlInstancesGetDiskShrinkConfigResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesGetDiskShrinkConfigResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesGetDiskShrinkConfigResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse; - - /** - * Creates a plain object from a SqlInstancesGetDiskShrinkConfigResponse message. Also converts values to other types if specified. - * @param message SqlInstancesGetDiskShrinkConfigResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesGetDiskShrinkConfigResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesGetDiskShrinkConfigResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesGetLatestRecoveryTimeRequest. */ - interface ISqlInstancesGetLatestRecoveryTimeRequest { - - /** SqlInstancesGetLatestRecoveryTimeRequest instance */ - instance?: (string|null); - - /** SqlInstancesGetLatestRecoveryTimeRequest project */ - project?: (string|null); - - /** SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime */ - sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a SqlInstancesGetLatestRecoveryTimeRequest. */ - class SqlInstancesGetLatestRecoveryTimeRequest implements ISqlInstancesGetLatestRecoveryTimeRequest { - - /** - * Constructs a new SqlInstancesGetLatestRecoveryTimeRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest); - - /** SqlInstancesGetLatestRecoveryTimeRequest instance. */ - public instance: string; - - /** SqlInstancesGetLatestRecoveryTimeRequest project. */ - public project: string; - - /** SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime. */ - public sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new SqlInstancesGetLatestRecoveryTimeRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesGetLatestRecoveryTimeRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. - * @param message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. - * @param message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesGetLatestRecoveryTimeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesGetLatestRecoveryTimeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest; - - /** - * Verifies a SqlInstancesGetLatestRecoveryTimeRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesGetLatestRecoveryTimeRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesGetLatestRecoveryTimeRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest; - - /** - * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeRequest message. Also converts values to other types if specified. - * @param message SqlInstancesGetLatestRecoveryTimeRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesGetLatestRecoveryTimeRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesGetLatestRecoveryTimeRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesGetLatestRecoveryTimeResponse. */ - interface ISqlInstancesGetLatestRecoveryTimeResponse { - - /** SqlInstancesGetLatestRecoveryTimeResponse kind */ - kind?: (string|null); - - /** SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime */ - latestRecoveryTime?: (google.protobuf.ITimestamp|null); - - /** SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime */ - earliestRecoveryTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a SqlInstancesGetLatestRecoveryTimeResponse. */ - class SqlInstancesGetLatestRecoveryTimeResponse implements ISqlInstancesGetLatestRecoveryTimeResponse { - - /** - * Constructs a new SqlInstancesGetLatestRecoveryTimeResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse); - - /** SqlInstancesGetLatestRecoveryTimeResponse kind. */ - public kind: string; - - /** SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime. */ - public latestRecoveryTime?: (google.protobuf.ITimestamp|null); - - /** SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime. */ - public earliestRecoveryTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new SqlInstancesGetLatestRecoveryTimeResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesGetLatestRecoveryTimeResponse instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. - * @param message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. - * @param message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesGetLatestRecoveryTimeResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesGetLatestRecoveryTimeResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse; - - /** - * Verifies a SqlInstancesGetLatestRecoveryTimeResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesGetLatestRecoveryTimeResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesGetLatestRecoveryTimeResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse; - - /** - * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeResponse message. Also converts values to other types if specified. - * @param message SqlInstancesGetLatestRecoveryTimeResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesGetLatestRecoveryTimeResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesGetLatestRecoveryTimeResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CloneContext. */ - interface ICloneContext { - - /** CloneContext kind */ - kind?: (string|null); - - /** CloneContext pitrTimestampMs */ - pitrTimestampMs?: (number|Long|string|null); - - /** CloneContext destinationInstanceName */ - destinationInstanceName?: (string|null); - - /** CloneContext binLogCoordinates */ - binLogCoordinates?: (google.cloud.sql.v1.IBinLogCoordinates|null); - - /** CloneContext pointInTime */ - pointInTime?: (google.protobuf.ITimestamp|null); - - /** CloneContext allocatedIpRange */ - allocatedIpRange?: (string|null); - - /** CloneContext databaseNames */ - databaseNames?: (string[]|null); - - /** CloneContext preferredZone */ - preferredZone?: (string|null); - - /** CloneContext preferredSecondaryZone */ - preferredSecondaryZone?: (string|null); - - /** CloneContext sourceInstanceDeletionTime */ - sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); - - /** CloneContext destinationProject */ - destinationProject?: (string|null); - - /** CloneContext destinationNetwork */ - destinationNetwork?: (string|null); - } - - /** Represents a CloneContext. */ - class CloneContext implements ICloneContext { - - /** - * Constructs a new CloneContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ICloneContext); - - /** CloneContext kind. */ - public kind: string; - - /** CloneContext pitrTimestampMs. */ - public pitrTimestampMs: (number|Long|string); - - /** CloneContext destinationInstanceName. */ - public destinationInstanceName: string; - - /** CloneContext binLogCoordinates. */ - public binLogCoordinates?: (google.cloud.sql.v1.IBinLogCoordinates|null); - - /** CloneContext pointInTime. */ - public pointInTime?: (google.protobuf.ITimestamp|null); - - /** CloneContext allocatedIpRange. */ - public allocatedIpRange: string; - - /** CloneContext databaseNames. */ - public databaseNames: string[]; - - /** CloneContext preferredZone. */ - public preferredZone?: (string|null); - - /** CloneContext preferredSecondaryZone. */ - public preferredSecondaryZone?: (string|null); - - /** CloneContext sourceInstanceDeletionTime. */ - public sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); - - /** CloneContext destinationProject. */ - public destinationProject?: (string|null); - - /** CloneContext destinationNetwork. */ - public destinationNetwork?: (string|null); - - /** - * Creates a new CloneContext instance using the specified properties. - * @param [properties] Properties to set - * @returns CloneContext instance - */ - public static create(properties?: google.cloud.sql.v1.ICloneContext): google.cloud.sql.v1.CloneContext; - - /** - * Encodes the specified CloneContext message. Does not implicitly {@link google.cloud.sql.v1.CloneContext.verify|verify} messages. - * @param message CloneContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ICloneContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CloneContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.CloneContext.verify|verify} messages. - * @param message CloneContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ICloneContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CloneContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CloneContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.CloneContext; - - /** - * Decodes a CloneContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CloneContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.CloneContext; - - /** - * Verifies a CloneContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CloneContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CloneContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.CloneContext; - - /** - * Creates a plain object from a CloneContext message. Also converts values to other types if specified. - * @param message CloneContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.CloneContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CloneContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CloneContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PointInTimeRestoreContext. */ - interface IPointInTimeRestoreContext { - - /** PointInTimeRestoreContext datasource */ - datasource?: (string|null); - - /** PointInTimeRestoreContext pointInTime */ - pointInTime?: (google.protobuf.ITimestamp|null); - - /** PointInTimeRestoreContext targetInstance */ - targetInstance?: (string|null); - - /** PointInTimeRestoreContext privateNetwork */ - privateNetwork?: (string|null); - - /** PointInTimeRestoreContext allocatedIpRange */ - allocatedIpRange?: (string|null); - - /** PointInTimeRestoreContext preferredZone */ - preferredZone?: (string|null); - - /** PointInTimeRestoreContext preferredSecondaryZone */ - preferredSecondaryZone?: (string|null); - - /** PointInTimeRestoreContext targetInstanceSettings */ - targetInstanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); - - /** PointInTimeRestoreContext targetInstanceClearSettingsFieldNames */ - targetInstanceClearSettingsFieldNames?: (string[]|null); - - /** PointInTimeRestoreContext region */ - region?: (string|null); - } - - /** Represents a PointInTimeRestoreContext. */ - class PointInTimeRestoreContext implements IPointInTimeRestoreContext { - - /** - * Constructs a new PointInTimeRestoreContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IPointInTimeRestoreContext); - - /** PointInTimeRestoreContext datasource. */ - public datasource?: (string|null); - - /** PointInTimeRestoreContext pointInTime. */ - public pointInTime?: (google.protobuf.ITimestamp|null); - - /** PointInTimeRestoreContext targetInstance. */ - public targetInstance?: (string|null); - - /** PointInTimeRestoreContext privateNetwork. */ - public privateNetwork?: (string|null); - - /** PointInTimeRestoreContext allocatedIpRange. */ - public allocatedIpRange?: (string|null); - - /** PointInTimeRestoreContext preferredZone. */ - public preferredZone?: (string|null); - - /** PointInTimeRestoreContext preferredSecondaryZone. */ - public preferredSecondaryZone?: (string|null); - - /** PointInTimeRestoreContext targetInstanceSettings. */ - public targetInstanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); - - /** PointInTimeRestoreContext targetInstanceClearSettingsFieldNames. */ - public targetInstanceClearSettingsFieldNames: string[]; - - /** PointInTimeRestoreContext region. */ - public region?: (string|null); - - /** - * Creates a new PointInTimeRestoreContext instance using the specified properties. - * @param [properties] Properties to set - * @returns PointInTimeRestoreContext instance - */ - public static create(properties?: google.cloud.sql.v1.IPointInTimeRestoreContext): google.cloud.sql.v1.PointInTimeRestoreContext; - - /** - * Encodes the specified PointInTimeRestoreContext message. Does not implicitly {@link google.cloud.sql.v1.PointInTimeRestoreContext.verify|verify} messages. - * @param message PointInTimeRestoreContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IPointInTimeRestoreContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PointInTimeRestoreContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PointInTimeRestoreContext.verify|verify} messages. - * @param message PointInTimeRestoreContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IPointInTimeRestoreContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PointInTimeRestoreContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PointInTimeRestoreContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PointInTimeRestoreContext; - - /** - * Decodes a PointInTimeRestoreContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PointInTimeRestoreContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PointInTimeRestoreContext; - - /** - * Verifies a PointInTimeRestoreContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PointInTimeRestoreContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PointInTimeRestoreContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PointInTimeRestoreContext; - - /** - * Creates a plain object from a PointInTimeRestoreContext message. Also converts values to other types if specified. - * @param message PointInTimeRestoreContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.PointInTimeRestoreContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PointInTimeRestoreContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PointInTimeRestoreContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BinLogCoordinates. */ - interface IBinLogCoordinates { - - /** BinLogCoordinates binLogFileName */ - binLogFileName?: (string|null); - - /** BinLogCoordinates binLogPosition */ - binLogPosition?: (number|Long|string|null); - - /** BinLogCoordinates kind */ - kind?: (string|null); - } - - /** Represents a BinLogCoordinates. */ - class BinLogCoordinates implements IBinLogCoordinates { - - /** - * Constructs a new BinLogCoordinates. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IBinLogCoordinates); - - /** BinLogCoordinates binLogFileName. */ - public binLogFileName: string; - - /** BinLogCoordinates binLogPosition. */ - public binLogPosition: (number|Long|string); - - /** BinLogCoordinates kind. */ - public kind: string; - - /** - * Creates a new BinLogCoordinates instance using the specified properties. - * @param [properties] Properties to set - * @returns BinLogCoordinates instance - */ - public static create(properties?: google.cloud.sql.v1.IBinLogCoordinates): google.cloud.sql.v1.BinLogCoordinates; - - /** - * Encodes the specified BinLogCoordinates message. Does not implicitly {@link google.cloud.sql.v1.BinLogCoordinates.verify|verify} messages. - * @param message BinLogCoordinates message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IBinLogCoordinates, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BinLogCoordinates message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BinLogCoordinates.verify|verify} messages. - * @param message BinLogCoordinates message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IBinLogCoordinates, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BinLogCoordinates message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BinLogCoordinates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.BinLogCoordinates; - - /** - * Decodes a BinLogCoordinates message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BinLogCoordinates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.BinLogCoordinates; - - /** - * Verifies a BinLogCoordinates message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BinLogCoordinates message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BinLogCoordinates - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.BinLogCoordinates; - - /** - * Creates a plain object from a BinLogCoordinates message. Also converts values to other types if specified. - * @param message BinLogCoordinates - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.BinLogCoordinates, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BinLogCoordinates to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BinLogCoordinates - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DatabaseInstance. */ - interface IDatabaseInstance { - - /** DatabaseInstance kind */ - kind?: (string|null); - - /** DatabaseInstance state */ - state?: (google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null); - - /** DatabaseInstance databaseVersion */ - databaseVersion?: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion|null); - - /** DatabaseInstance settings */ - settings?: (google.cloud.sql.v1.ISettings|null); - - /** DatabaseInstance etag */ - etag?: (string|null); - - /** DatabaseInstance failoverReplica */ - failoverReplica?: (google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica|null); - - /** DatabaseInstance masterInstanceName */ - masterInstanceName?: (string|null); - - /** DatabaseInstance replicaNames */ - replicaNames?: (string[]|null); - - /** DatabaseInstance maxDiskSize */ - maxDiskSize?: (google.protobuf.IInt64Value|null); - - /** DatabaseInstance currentDiskSize */ - currentDiskSize?: (google.protobuf.IInt64Value|null); - - /** DatabaseInstance ipAddresses */ - ipAddresses?: (google.cloud.sql.v1.IIpMapping[]|null); - - /** DatabaseInstance serverCaCert */ - serverCaCert?: (google.cloud.sql.v1.ISslCert|null); - - /** DatabaseInstance instanceType */ - instanceType?: (google.cloud.sql.v1.SqlInstanceType|keyof typeof google.cloud.sql.v1.SqlInstanceType|null); - - /** DatabaseInstance project */ - project?: (string|null); - - /** DatabaseInstance ipv6Address */ - ipv6Address?: (string|null); - - /** DatabaseInstance serviceAccountEmailAddress */ - serviceAccountEmailAddress?: (string|null); - - /** DatabaseInstance onPremisesConfiguration */ - onPremisesConfiguration?: (google.cloud.sql.v1.IOnPremisesConfiguration|null); - - /** DatabaseInstance replicaConfiguration */ - replicaConfiguration?: (google.cloud.sql.v1.IReplicaConfiguration|null); - - /** DatabaseInstance backendType */ - backendType?: (google.cloud.sql.v1.SqlBackendType|keyof typeof google.cloud.sql.v1.SqlBackendType|null); - - /** DatabaseInstance selfLink */ - selfLink?: (string|null); - - /** DatabaseInstance suspensionReason */ - suspensionReason?: (google.cloud.sql.v1.SqlSuspensionReason[]|null); - - /** DatabaseInstance connectionName */ - connectionName?: (string|null); - - /** DatabaseInstance name */ - name?: (string|null); - - /** DatabaseInstance region */ - region?: (string|null); - - /** DatabaseInstance gceZone */ - gceZone?: (string|null); - - /** DatabaseInstance secondaryGceZone */ - secondaryGceZone?: (string|null); - - /** DatabaseInstance diskEncryptionConfiguration */ - diskEncryptionConfiguration?: (google.cloud.sql.v1.IDiskEncryptionConfiguration|null); - - /** DatabaseInstance diskEncryptionStatus */ - diskEncryptionStatus?: (google.cloud.sql.v1.IDiskEncryptionStatus|null); - - /** DatabaseInstance rootPassword */ - rootPassword?: (string|null); - - /** DatabaseInstance scheduledMaintenance */ - scheduledMaintenance?: (google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance|null); - - /** DatabaseInstance satisfiesPzs */ - satisfiesPzs?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance databaseInstalledVersion */ - databaseInstalledVersion?: (string|null); - - /** DatabaseInstance outOfDiskReport */ - outOfDiskReport?: (google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport|null); - - /** DatabaseInstance createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** DatabaseInstance availableMaintenanceVersions */ - availableMaintenanceVersions?: (string[]|null); - - /** DatabaseInstance maintenanceVersion */ - maintenanceVersion?: (string|null); - - /** DatabaseInstance upgradableDatabaseVersions */ - upgradableDatabaseVersions?: (google.cloud.sql.v1.IAvailableDatabaseVersion[]|null); - - /** DatabaseInstance sqlNetworkArchitecture */ - sqlNetworkArchitecture?: (google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|null); - - /** DatabaseInstance pscServiceAttachmentLink */ - pscServiceAttachmentLink?: (string|null); - - /** DatabaseInstance dnsName */ - dnsName?: (string|null); - - /** DatabaseInstance primaryDnsName */ - primaryDnsName?: (string|null); - - /** DatabaseInstance writeEndpoint */ - writeEndpoint?: (string|null); - - /** DatabaseInstance replicationCluster */ - replicationCluster?: (google.cloud.sql.v1.IReplicationCluster|null); - - /** DatabaseInstance geminiConfig */ - geminiConfig?: (google.cloud.sql.v1.IGeminiInstanceConfig|null); - - /** DatabaseInstance satisfiesPzi */ - satisfiesPzi?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance switchTransactionLogsToCloudStorageEnabled */ - switchTransactionLogsToCloudStorageEnabled?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance includeReplicasForMajorVersionUpgrade */ - includeReplicasForMajorVersionUpgrade?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance tags */ - tags?: ({ [k: string]: string }|null); - - /** DatabaseInstance nodeCount */ - nodeCount?: (number|null); - - /** DatabaseInstance nodes */ - nodes?: (google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig[]|null); - - /** DatabaseInstance dnsNames */ - dnsNames?: (google.cloud.sql.v1.IDnsNameMapping[]|null); - } - - /** Represents a DatabaseInstance. */ - class DatabaseInstance implements IDatabaseInstance { - - /** - * Constructs a new DatabaseInstance. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDatabaseInstance); - - /** DatabaseInstance kind. */ - public kind: string; - - /** DatabaseInstance state. */ - public state: (google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlInstanceState); - - /** DatabaseInstance databaseVersion. */ - public databaseVersion: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion); - - /** DatabaseInstance settings. */ - public settings?: (google.cloud.sql.v1.ISettings|null); - - /** DatabaseInstance etag. */ - public etag: string; - - /** DatabaseInstance failoverReplica. */ - public failoverReplica?: (google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica|null); - - /** DatabaseInstance masterInstanceName. */ - public masterInstanceName: string; - - /** DatabaseInstance replicaNames. */ - public replicaNames: string[]; - - /** DatabaseInstance maxDiskSize. */ - public maxDiskSize?: (google.protobuf.IInt64Value|null); - - /** DatabaseInstance currentDiskSize. */ - public currentDiskSize?: (google.protobuf.IInt64Value|null); - - /** DatabaseInstance ipAddresses. */ - public ipAddresses: google.cloud.sql.v1.IIpMapping[]; - - /** DatabaseInstance serverCaCert. */ - public serverCaCert?: (google.cloud.sql.v1.ISslCert|null); - - /** DatabaseInstance instanceType. */ - public instanceType: (google.cloud.sql.v1.SqlInstanceType|keyof typeof google.cloud.sql.v1.SqlInstanceType); - - /** DatabaseInstance project. */ - public project: string; - - /** DatabaseInstance ipv6Address. */ - public ipv6Address: string; - - /** DatabaseInstance serviceAccountEmailAddress. */ - public serviceAccountEmailAddress: string; - - /** DatabaseInstance onPremisesConfiguration. */ - public onPremisesConfiguration?: (google.cloud.sql.v1.IOnPremisesConfiguration|null); - - /** DatabaseInstance replicaConfiguration. */ - public replicaConfiguration?: (google.cloud.sql.v1.IReplicaConfiguration|null); - - /** DatabaseInstance backendType. */ - public backendType: (google.cloud.sql.v1.SqlBackendType|keyof typeof google.cloud.sql.v1.SqlBackendType); - - /** DatabaseInstance selfLink. */ - public selfLink: string; - - /** DatabaseInstance suspensionReason. */ - public suspensionReason: google.cloud.sql.v1.SqlSuspensionReason[]; - - /** DatabaseInstance connectionName. */ - public connectionName: string; - - /** DatabaseInstance name. */ - public name: string; - - /** DatabaseInstance region. */ - public region: string; - - /** DatabaseInstance gceZone. */ - public gceZone: string; - - /** DatabaseInstance secondaryGceZone. */ - public secondaryGceZone: string; - - /** DatabaseInstance diskEncryptionConfiguration. */ - public diskEncryptionConfiguration?: (google.cloud.sql.v1.IDiskEncryptionConfiguration|null); - - /** DatabaseInstance diskEncryptionStatus. */ - public diskEncryptionStatus?: (google.cloud.sql.v1.IDiskEncryptionStatus|null); - - /** DatabaseInstance rootPassword. */ - public rootPassword: string; - - /** DatabaseInstance scheduledMaintenance. */ - public scheduledMaintenance?: (google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance|null); - - /** DatabaseInstance satisfiesPzs. */ - public satisfiesPzs?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance databaseInstalledVersion. */ - public databaseInstalledVersion: string; - - /** DatabaseInstance outOfDiskReport. */ - public outOfDiskReport?: (google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport|null); - - /** DatabaseInstance createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** DatabaseInstance availableMaintenanceVersions. */ - public availableMaintenanceVersions: string[]; - - /** DatabaseInstance maintenanceVersion. */ - public maintenanceVersion: string; - - /** DatabaseInstance upgradableDatabaseVersions. */ - public upgradableDatabaseVersions: google.cloud.sql.v1.IAvailableDatabaseVersion[]; - - /** DatabaseInstance sqlNetworkArchitecture. */ - public sqlNetworkArchitecture?: (google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|null); - - /** DatabaseInstance pscServiceAttachmentLink. */ - public pscServiceAttachmentLink?: (string|null); - - /** DatabaseInstance dnsName. */ - public dnsName?: (string|null); - - /** DatabaseInstance primaryDnsName. */ - public primaryDnsName?: (string|null); - - /** DatabaseInstance writeEndpoint. */ - public writeEndpoint?: (string|null); - - /** DatabaseInstance replicationCluster. */ - public replicationCluster?: (google.cloud.sql.v1.IReplicationCluster|null); - - /** DatabaseInstance geminiConfig. */ - public geminiConfig?: (google.cloud.sql.v1.IGeminiInstanceConfig|null); - - /** DatabaseInstance satisfiesPzi. */ - public satisfiesPzi?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance switchTransactionLogsToCloudStorageEnabled. */ - public switchTransactionLogsToCloudStorageEnabled?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance includeReplicasForMajorVersionUpgrade. */ - public includeReplicasForMajorVersionUpgrade?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance tags. */ - public tags: { [k: string]: string }; - - /** DatabaseInstance nodeCount. */ - public nodeCount?: (number|null); - - /** DatabaseInstance nodes. */ - public nodes: google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig[]; - - /** DatabaseInstance dnsNames. */ - public dnsNames: google.cloud.sql.v1.IDnsNameMapping[]; - - /** - * Creates a new DatabaseInstance instance using the specified properties. - * @param [properties] Properties to set - * @returns DatabaseInstance instance - */ - public static create(properties?: google.cloud.sql.v1.IDatabaseInstance): google.cloud.sql.v1.DatabaseInstance; - - /** - * Encodes the specified DatabaseInstance message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.verify|verify} messages. - * @param message DatabaseInstance message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDatabaseInstance, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DatabaseInstance message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.verify|verify} messages. - * @param message DatabaseInstance message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDatabaseInstance, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DatabaseInstance message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DatabaseInstance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseInstance; - - /** - * Decodes a DatabaseInstance message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DatabaseInstance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseInstance; - - /** - * Verifies a DatabaseInstance message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DatabaseInstance message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DatabaseInstance - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseInstance; - - /** - * Creates a plain object from a DatabaseInstance message. Also converts values to other types if specified. - * @param message DatabaseInstance - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DatabaseInstance, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DatabaseInstance to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DatabaseInstance - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DatabaseInstance { - - /** SqlInstanceState enum. */ - enum SqlInstanceState { - SQL_INSTANCE_STATE_UNSPECIFIED = 0, - RUNNABLE = 1, - SUSPENDED = 2, - PENDING_DELETE = 3, - PENDING_CREATE = 4, - MAINTENANCE = 5, - FAILED = 6, - ONLINE_MAINTENANCE = 7, - REPAIRING = 8 - } - - /** Properties of a SqlFailoverReplica. */ - interface ISqlFailoverReplica { - - /** SqlFailoverReplica name */ - name?: (string|null); - - /** SqlFailoverReplica available */ - available?: (google.protobuf.IBoolValue|null); - } - - /** Represents a SqlFailoverReplica. */ - class SqlFailoverReplica implements ISqlFailoverReplica { - - /** - * Constructs a new SqlFailoverReplica. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica); - - /** SqlFailoverReplica name. */ - public name: string; - - /** SqlFailoverReplica available. */ - public available?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new SqlFailoverReplica instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlFailoverReplica instance - */ - public static create(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica): google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica; - - /** - * Encodes the specified SqlFailoverReplica message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. - * @param message SqlFailoverReplica message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlFailoverReplica message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. - * @param message SqlFailoverReplica message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlFailoverReplica message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlFailoverReplica - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica; - - /** - * Decodes a SqlFailoverReplica message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlFailoverReplica - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica; - - /** - * Verifies a SqlFailoverReplica message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlFailoverReplica message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlFailoverReplica - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica; - - /** - * Creates a plain object from a SqlFailoverReplica message. Also converts values to other types if specified. - * @param message SqlFailoverReplica - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlFailoverReplica to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlFailoverReplica - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlScheduledMaintenance. */ - interface ISqlScheduledMaintenance { - - /** SqlScheduledMaintenance startTime */ - startTime?: (google.protobuf.ITimestamp|null); - - /** SqlScheduledMaintenance canDefer */ - canDefer?: (boolean|null); - - /** SqlScheduledMaintenance canReschedule */ - canReschedule?: (boolean|null); - - /** SqlScheduledMaintenance scheduleDeadlineTime */ - scheduleDeadlineTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a SqlScheduledMaintenance. */ - class SqlScheduledMaintenance implements ISqlScheduledMaintenance { - - /** - * Constructs a new SqlScheduledMaintenance. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance); - - /** SqlScheduledMaintenance startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); - - /** SqlScheduledMaintenance canDefer. */ - public canDefer: boolean; - - /** SqlScheduledMaintenance canReschedule. */ - public canReschedule: boolean; - - /** SqlScheduledMaintenance scheduleDeadlineTime. */ - public scheduleDeadlineTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new SqlScheduledMaintenance instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlScheduledMaintenance instance - */ - public static create(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance): google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance; - - /** - * Encodes the specified SqlScheduledMaintenance message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. - * @param message SqlScheduledMaintenance message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlScheduledMaintenance message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. - * @param message SqlScheduledMaintenance message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlScheduledMaintenance message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlScheduledMaintenance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance; - - /** - * Decodes a SqlScheduledMaintenance message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlScheduledMaintenance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance; - - /** - * Verifies a SqlScheduledMaintenance message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlScheduledMaintenance message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlScheduledMaintenance - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance; - - /** - * Creates a plain object from a SqlScheduledMaintenance message. Also converts values to other types if specified. - * @param message SqlScheduledMaintenance - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlScheduledMaintenance to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlScheduledMaintenance - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlOutOfDiskReport. */ - interface ISqlOutOfDiskReport { - - /** SqlOutOfDiskReport sqlOutOfDiskState */ - sqlOutOfDiskState?: (google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null); - - /** SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb */ - sqlMinRecommendedIncreaseSizeGb?: (number|null); - } - - /** Represents a SqlOutOfDiskReport. */ - class SqlOutOfDiskReport implements ISqlOutOfDiskReport { - - /** - * Constructs a new SqlOutOfDiskReport. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport); - - /** SqlOutOfDiskReport sqlOutOfDiskState. */ - public sqlOutOfDiskState?: (google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null); - - /** SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb. */ - public sqlMinRecommendedIncreaseSizeGb?: (number|null); - - /** - * Creates a new SqlOutOfDiskReport instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlOutOfDiskReport instance - */ - public static create(properties?: google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport): google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport; - - /** - * Encodes the specified SqlOutOfDiskReport message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. - * @param message SqlOutOfDiskReport message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlOutOfDiskReport message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. - * @param message SqlOutOfDiskReport message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlOutOfDiskReport message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlOutOfDiskReport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport; - - /** - * Decodes a SqlOutOfDiskReport message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlOutOfDiskReport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport; - - /** - * Verifies a SqlOutOfDiskReport message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlOutOfDiskReport message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlOutOfDiskReport - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport; - - /** - * Creates a plain object from a SqlOutOfDiskReport message. Also converts values to other types if specified. - * @param message SqlOutOfDiskReport - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlOutOfDiskReport to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlOutOfDiskReport - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlOutOfDiskReport { - - /** SqlOutOfDiskState enum. */ - enum SqlOutOfDiskState { - SQL_OUT_OF_DISK_STATE_UNSPECIFIED = 0, - NORMAL = 1, - SOFT_SHUTDOWN = 2 - } - } - - /** SqlNetworkArchitecture enum. */ - enum SqlNetworkArchitecture { - SQL_NETWORK_ARCHITECTURE_UNSPECIFIED = 0, - NEW_NETWORK_ARCHITECTURE = 1, - OLD_NETWORK_ARCHITECTURE = 2 - } - - /** Properties of a PoolNodeConfig. */ - interface IPoolNodeConfig { - - /** PoolNodeConfig name */ - name?: (string|null); - - /** PoolNodeConfig gceZone */ - gceZone?: (string|null); - - /** PoolNodeConfig ipAddresses */ - ipAddresses?: (google.cloud.sql.v1.IIpMapping[]|null); - - /** PoolNodeConfig dnsName */ - dnsName?: (string|null); - - /** PoolNodeConfig state */ - state?: (google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null); - - /** PoolNodeConfig dnsNames */ - dnsNames?: (google.cloud.sql.v1.IDnsNameMapping[]|null); - - /** PoolNodeConfig pscServiceAttachmentLink */ - pscServiceAttachmentLink?: (string|null); - - /** PoolNodeConfig pscAutoConnections */ - pscAutoConnections?: (google.cloud.sql.v1.IPscAutoConnectionConfig[]|null); - } - - /** Represents a PoolNodeConfig. */ - class PoolNodeConfig implements IPoolNodeConfig { - - /** - * Constructs a new PoolNodeConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig); - - /** PoolNodeConfig name. */ - public name?: (string|null); - - /** PoolNodeConfig gceZone. */ - public gceZone?: (string|null); - - /** PoolNodeConfig ipAddresses. */ - public ipAddresses: google.cloud.sql.v1.IIpMapping[]; - - /** PoolNodeConfig dnsName. */ - public dnsName?: (string|null); - - /** PoolNodeConfig state. */ - public state?: (google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null); - - /** PoolNodeConfig dnsNames. */ - public dnsNames: google.cloud.sql.v1.IDnsNameMapping[]; - - /** PoolNodeConfig pscServiceAttachmentLink. */ - public pscServiceAttachmentLink?: (string|null); - - /** PoolNodeConfig pscAutoConnections. */ - public pscAutoConnections: google.cloud.sql.v1.IPscAutoConnectionConfig[]; - - /** - * Creates a new PoolNodeConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns PoolNodeConfig instance - */ - public static create(properties?: google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig): google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig; - - /** - * Encodes the specified PoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.verify|verify} messages. - * @param message PoolNodeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.verify|verify} messages. - * @param message PoolNodeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PoolNodeConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig; - - /** - * Decodes a PoolNodeConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig; - - /** - * Verifies a PoolNodeConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PoolNodeConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PoolNodeConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig; - - /** - * Creates a plain object from a PoolNodeConfig message. Also converts values to other types if specified. - * @param message PoolNodeConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PoolNodeConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PoolNodeConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a GeminiInstanceConfig. */ - interface IGeminiInstanceConfig { - - /** GeminiInstanceConfig entitled */ - entitled?: (boolean|null); - - /** GeminiInstanceConfig googleVacuumMgmtEnabled */ - googleVacuumMgmtEnabled?: (boolean|null); - - /** GeminiInstanceConfig oomSessionCancelEnabled */ - oomSessionCancelEnabled?: (boolean|null); - - /** GeminiInstanceConfig activeQueryEnabled */ - activeQueryEnabled?: (boolean|null); - - /** GeminiInstanceConfig indexAdvisorEnabled */ - indexAdvisorEnabled?: (boolean|null); - - /** GeminiInstanceConfig flagRecommenderEnabled */ - flagRecommenderEnabled?: (boolean|null); - } - - /** Represents a GeminiInstanceConfig. */ - class GeminiInstanceConfig implements IGeminiInstanceConfig { - - /** - * Constructs a new GeminiInstanceConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IGeminiInstanceConfig); - - /** GeminiInstanceConfig entitled. */ - public entitled?: (boolean|null); - - /** GeminiInstanceConfig googleVacuumMgmtEnabled. */ - public googleVacuumMgmtEnabled?: (boolean|null); - - /** GeminiInstanceConfig oomSessionCancelEnabled. */ - public oomSessionCancelEnabled?: (boolean|null); - - /** GeminiInstanceConfig activeQueryEnabled. */ - public activeQueryEnabled?: (boolean|null); - - /** GeminiInstanceConfig indexAdvisorEnabled. */ - public indexAdvisorEnabled?: (boolean|null); - - /** GeminiInstanceConfig flagRecommenderEnabled. */ - public flagRecommenderEnabled?: (boolean|null); - - /** - * Creates a new GeminiInstanceConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns GeminiInstanceConfig instance - */ - public static create(properties?: google.cloud.sql.v1.IGeminiInstanceConfig): google.cloud.sql.v1.GeminiInstanceConfig; - - /** - * Encodes the specified GeminiInstanceConfig message. Does not implicitly {@link google.cloud.sql.v1.GeminiInstanceConfig.verify|verify} messages. - * @param message GeminiInstanceConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IGeminiInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GeminiInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GeminiInstanceConfig.verify|verify} messages. - * @param message GeminiInstanceConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IGeminiInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GeminiInstanceConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GeminiInstanceConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.GeminiInstanceConfig; - - /** - * Decodes a GeminiInstanceConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GeminiInstanceConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.GeminiInstanceConfig; - - /** - * Verifies a GeminiInstanceConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GeminiInstanceConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GeminiInstanceConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.GeminiInstanceConfig; - - /** - * Creates a plain object from a GeminiInstanceConfig message. Also converts values to other types if specified. - * @param message GeminiInstanceConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.GeminiInstanceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GeminiInstanceConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GeminiInstanceConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ReplicationCluster. */ - interface IReplicationCluster { - - /** ReplicationCluster psaWriteEndpoint */ - psaWriteEndpoint?: (string|null); - - /** ReplicationCluster failoverDrReplicaName */ - failoverDrReplicaName?: (string|null); - - /** ReplicationCluster drReplica */ - drReplica?: (boolean|null); - } - - /** Represents a ReplicationCluster. */ - class ReplicationCluster implements IReplicationCluster { - - /** - * Constructs a new ReplicationCluster. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IReplicationCluster); - - /** ReplicationCluster psaWriteEndpoint. */ - public psaWriteEndpoint: string; - - /** ReplicationCluster failoverDrReplicaName. */ - public failoverDrReplicaName: string; - - /** ReplicationCluster drReplica. */ - public drReplica: boolean; - - /** - * Creates a new ReplicationCluster instance using the specified properties. - * @param [properties] Properties to set - * @returns ReplicationCluster instance - */ - public static create(properties?: google.cloud.sql.v1.IReplicationCluster): google.cloud.sql.v1.ReplicationCluster; - - /** - * Encodes the specified ReplicationCluster message. Does not implicitly {@link google.cloud.sql.v1.ReplicationCluster.verify|verify} messages. - * @param message ReplicationCluster message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IReplicationCluster, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReplicationCluster message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReplicationCluster.verify|verify} messages. - * @param message ReplicationCluster message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IReplicationCluster, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReplicationCluster message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReplicationCluster - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ReplicationCluster; - - /** - * Decodes a ReplicationCluster message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReplicationCluster - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ReplicationCluster; - - /** - * Verifies a ReplicationCluster message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ReplicationCluster message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReplicationCluster - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ReplicationCluster; - - /** - * Creates a plain object from a ReplicationCluster message. Also converts values to other types if specified. - * @param message ReplicationCluster - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ReplicationCluster, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReplicationCluster to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReplicationCluster - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AvailableDatabaseVersion. */ - interface IAvailableDatabaseVersion { - - /** AvailableDatabaseVersion majorVersion */ - majorVersion?: (string|null); - - /** AvailableDatabaseVersion name */ - name?: (string|null); - - /** AvailableDatabaseVersion displayName */ - displayName?: (string|null); - } - - /** Represents an AvailableDatabaseVersion. */ - class AvailableDatabaseVersion implements IAvailableDatabaseVersion { - - /** - * Constructs a new AvailableDatabaseVersion. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IAvailableDatabaseVersion); - - /** AvailableDatabaseVersion majorVersion. */ - public majorVersion?: (string|null); - - /** AvailableDatabaseVersion name. */ - public name?: (string|null); - - /** AvailableDatabaseVersion displayName. */ - public displayName?: (string|null); - - /** - * Creates a new AvailableDatabaseVersion instance using the specified properties. - * @param [properties] Properties to set - * @returns AvailableDatabaseVersion instance - */ - public static create(properties?: google.cloud.sql.v1.IAvailableDatabaseVersion): google.cloud.sql.v1.AvailableDatabaseVersion; - - /** - * Encodes the specified AvailableDatabaseVersion message. Does not implicitly {@link google.cloud.sql.v1.AvailableDatabaseVersion.verify|verify} messages. - * @param message AvailableDatabaseVersion message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IAvailableDatabaseVersion, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AvailableDatabaseVersion message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AvailableDatabaseVersion.verify|verify} messages. - * @param message AvailableDatabaseVersion message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IAvailableDatabaseVersion, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AvailableDatabaseVersion message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AvailableDatabaseVersion - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.AvailableDatabaseVersion; - - /** - * Decodes an AvailableDatabaseVersion message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AvailableDatabaseVersion - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.AvailableDatabaseVersion; - - /** - * Verifies an AvailableDatabaseVersion message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an AvailableDatabaseVersion message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AvailableDatabaseVersion - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.AvailableDatabaseVersion; - - /** - * Creates a plain object from an AvailableDatabaseVersion message. Also converts values to other types if specified. - * @param message AvailableDatabaseVersion - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.AvailableDatabaseVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AvailableDatabaseVersion to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AvailableDatabaseVersion - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRescheduleMaintenanceRequestBody. */ - interface ISqlInstancesRescheduleMaintenanceRequestBody { - - /** SqlInstancesRescheduleMaintenanceRequestBody reschedule */ - reschedule?: (google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null); - } - - /** Represents a SqlInstancesRescheduleMaintenanceRequestBody. */ - class SqlInstancesRescheduleMaintenanceRequestBody implements ISqlInstancesRescheduleMaintenanceRequestBody { - - /** - * Constructs a new SqlInstancesRescheduleMaintenanceRequestBody. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody); - - /** SqlInstancesRescheduleMaintenanceRequestBody reschedule. */ - public reschedule?: (google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null); - - /** - * Creates a new SqlInstancesRescheduleMaintenanceRequestBody instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRescheduleMaintenanceRequestBody instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. - * @param message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. - * @param message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRescheduleMaintenanceRequestBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRescheduleMaintenanceRequestBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody; - - /** - * Verifies a SqlInstancesRescheduleMaintenanceRequestBody message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRescheduleMaintenanceRequestBody message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRescheduleMaintenanceRequestBody - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody; - - /** - * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequestBody message. Also converts values to other types if specified. - * @param message SqlInstancesRescheduleMaintenanceRequestBody - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRescheduleMaintenanceRequestBody to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRescheduleMaintenanceRequestBody - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlInstancesRescheduleMaintenanceRequestBody { - - /** RescheduleType enum. */ - enum RescheduleType { - RESCHEDULE_TYPE_UNSPECIFIED = 0, - IMMEDIATE = 1, - NEXT_AVAILABLE_WINDOW = 2, - SPECIFIC_TIME = 3 - } - - /** Properties of a Reschedule. */ - interface IReschedule { - - /** Reschedule rescheduleType */ - rescheduleType?: (google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|keyof typeof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|null); - - /** Reschedule scheduleTime */ - scheduleTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a Reschedule. */ - class Reschedule implements IReschedule { - - /** - * Constructs a new Reschedule. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule); - - /** Reschedule rescheduleType. */ - public rescheduleType: (google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|keyof typeof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType); - - /** Reschedule scheduleTime. */ - public scheduleTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new Reschedule instance using the specified properties. - * @param [properties] Properties to set - * @returns Reschedule instance - */ - public static create(properties?: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; - - /** - * Encodes the specified Reschedule message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. - * @param message Reschedule message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Reschedule message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. - * @param message Reschedule message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Reschedule message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Reschedule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; - - /** - * Decodes a Reschedule message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Reschedule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; - - /** - * Verifies a Reschedule message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Reschedule message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Reschedule - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; - - /** - * Creates a plain object from a Reschedule message. Also converts values to other types if specified. - * @param message Reschedule - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Reschedule to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Reschedule - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a DemoteMasterContext. */ - interface IDemoteMasterContext { - - /** DemoteMasterContext kind */ - kind?: (string|null); - - /** DemoteMasterContext verifyGtidConsistency */ - verifyGtidConsistency?: (google.protobuf.IBoolValue|null); - - /** DemoteMasterContext masterInstanceName */ - masterInstanceName?: (string|null); - - /** DemoteMasterContext replicaConfiguration */ - replicaConfiguration?: (google.cloud.sql.v1.IDemoteMasterConfiguration|null); - - /** DemoteMasterContext skipReplicationSetup */ - skipReplicationSetup?: (boolean|null); - } - - /** Represents a DemoteMasterContext. */ - class DemoteMasterContext implements IDemoteMasterContext { - - /** - * Constructs a new DemoteMasterContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDemoteMasterContext); - - /** DemoteMasterContext kind. */ - public kind: string; - - /** DemoteMasterContext verifyGtidConsistency. */ - public verifyGtidConsistency?: (google.protobuf.IBoolValue|null); - - /** DemoteMasterContext masterInstanceName. */ - public masterInstanceName: string; - - /** DemoteMasterContext replicaConfiguration. */ - public replicaConfiguration?: (google.cloud.sql.v1.IDemoteMasterConfiguration|null); - - /** DemoteMasterContext skipReplicationSetup. */ - public skipReplicationSetup: boolean; - - /** - * Creates a new DemoteMasterContext instance using the specified properties. - * @param [properties] Properties to set - * @returns DemoteMasterContext instance - */ - public static create(properties?: google.cloud.sql.v1.IDemoteMasterContext): google.cloud.sql.v1.DemoteMasterContext; - - /** - * Encodes the specified DemoteMasterContext message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterContext.verify|verify} messages. - * @param message DemoteMasterContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDemoteMasterContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DemoteMasterContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterContext.verify|verify} messages. - * @param message DemoteMasterContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDemoteMasterContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DemoteMasterContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DemoteMasterContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DemoteMasterContext; - - /** - * Decodes a DemoteMasterContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DemoteMasterContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DemoteMasterContext; - - /** - * Verifies a DemoteMasterContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DemoteMasterContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DemoteMasterContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DemoteMasterContext; - - /** - * Creates a plain object from a DemoteMasterContext message. Also converts values to other types if specified. - * @param message DemoteMasterContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DemoteMasterContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DemoteMasterContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DemoteMasterContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DemoteContext. */ - interface IDemoteContext { - - /** DemoteContext kind */ - kind?: (string|null); - - /** DemoteContext sourceRepresentativeInstanceName */ - sourceRepresentativeInstanceName?: (string|null); - } - - /** Represents a DemoteContext. */ - class DemoteContext implements IDemoteContext { - - /** - * Constructs a new DemoteContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDemoteContext); - - /** DemoteContext kind. */ - public kind: string; - - /** DemoteContext sourceRepresentativeInstanceName. */ - public sourceRepresentativeInstanceName: string; - - /** - * Creates a new DemoteContext instance using the specified properties. - * @param [properties] Properties to set - * @returns DemoteContext instance - */ - public static create(properties?: google.cloud.sql.v1.IDemoteContext): google.cloud.sql.v1.DemoteContext; - - /** - * Encodes the specified DemoteContext message. Does not implicitly {@link google.cloud.sql.v1.DemoteContext.verify|verify} messages. - * @param message DemoteContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDemoteContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DemoteContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteContext.verify|verify} messages. - * @param message DemoteContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDemoteContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DemoteContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DemoteContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DemoteContext; - - /** - * Decodes a DemoteContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DemoteContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DemoteContext; - - /** - * Verifies a DemoteContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DemoteContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DemoteContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DemoteContext; - - /** - * Creates a plain object from a DemoteContext message. Also converts values to other types if specified. - * @param message DemoteContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DemoteContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DemoteContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DemoteContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FailoverContext. */ - interface IFailoverContext { - - /** FailoverContext settingsVersion */ - settingsVersion?: (number|Long|string|null); - - /** FailoverContext kind */ - kind?: (string|null); - } - - /** Represents a FailoverContext. */ - class FailoverContext implements IFailoverContext { - - /** - * Constructs a new FailoverContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IFailoverContext); - - /** FailoverContext settingsVersion. */ - public settingsVersion: (number|Long|string); - - /** FailoverContext kind. */ - public kind: string; - - /** - * Creates a new FailoverContext instance using the specified properties. - * @param [properties] Properties to set - * @returns FailoverContext instance - */ - public static create(properties?: google.cloud.sql.v1.IFailoverContext): google.cloud.sql.v1.FailoverContext; - - /** - * Encodes the specified FailoverContext message. Does not implicitly {@link google.cloud.sql.v1.FailoverContext.verify|verify} messages. - * @param message FailoverContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IFailoverContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FailoverContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FailoverContext.verify|verify} messages. - * @param message FailoverContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IFailoverContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FailoverContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FailoverContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.FailoverContext; - - /** - * Decodes a FailoverContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FailoverContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.FailoverContext; - - /** - * Verifies a FailoverContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FailoverContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FailoverContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.FailoverContext; - - /** - * Creates a plain object from a FailoverContext message. Also converts values to other types if specified. - * @param message FailoverContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.FailoverContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FailoverContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FailoverContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RestoreBackupContext. */ - interface IRestoreBackupContext { - - /** RestoreBackupContext kind */ - kind?: (string|null); - - /** RestoreBackupContext backupRunId */ - backupRunId?: (number|Long|string|null); - - /** RestoreBackupContext instanceId */ - instanceId?: (string|null); - - /** RestoreBackupContext project */ - project?: (string|null); - } - - /** Represents a RestoreBackupContext. */ - class RestoreBackupContext implements IRestoreBackupContext { - - /** - * Constructs a new RestoreBackupContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IRestoreBackupContext); - - /** RestoreBackupContext kind. */ - public kind: string; - - /** RestoreBackupContext backupRunId. */ - public backupRunId: (number|Long|string); - - /** RestoreBackupContext instanceId. */ - public instanceId: string; - - /** RestoreBackupContext project. */ - public project: string; - - /** - * Creates a new RestoreBackupContext instance using the specified properties. - * @param [properties] Properties to set - * @returns RestoreBackupContext instance - */ - public static create(properties?: google.cloud.sql.v1.IRestoreBackupContext): google.cloud.sql.v1.RestoreBackupContext; - - /** - * Encodes the specified RestoreBackupContext message. Does not implicitly {@link google.cloud.sql.v1.RestoreBackupContext.verify|verify} messages. - * @param message RestoreBackupContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IRestoreBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RestoreBackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RestoreBackupContext.verify|verify} messages. - * @param message RestoreBackupContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IRestoreBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RestoreBackupContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RestoreBackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.RestoreBackupContext; - - /** - * Decodes a RestoreBackupContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RestoreBackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.RestoreBackupContext; - - /** - * Verifies a RestoreBackupContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RestoreBackupContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RestoreBackupContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.RestoreBackupContext; - - /** - * Creates a plain object from a RestoreBackupContext message. Also converts values to other types if specified. - * @param message RestoreBackupContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.RestoreBackupContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RestoreBackupContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RestoreBackupContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RotateServerCaContext. */ - interface IRotateServerCaContext { - - /** RotateServerCaContext kind */ - kind?: (string|null); - - /** RotateServerCaContext nextVersion */ - nextVersion?: (string|null); - } - - /** Represents a RotateServerCaContext. */ - class RotateServerCaContext implements IRotateServerCaContext { - - /** - * Constructs a new RotateServerCaContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IRotateServerCaContext); - - /** RotateServerCaContext kind. */ - public kind: string; - - /** RotateServerCaContext nextVersion. */ - public nextVersion: string; - - /** - * Creates a new RotateServerCaContext instance using the specified properties. - * @param [properties] Properties to set - * @returns RotateServerCaContext instance - */ - public static create(properties?: google.cloud.sql.v1.IRotateServerCaContext): google.cloud.sql.v1.RotateServerCaContext; - - /** - * Encodes the specified RotateServerCaContext message. Does not implicitly {@link google.cloud.sql.v1.RotateServerCaContext.verify|verify} messages. - * @param message RotateServerCaContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IRotateServerCaContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RotateServerCaContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateServerCaContext.verify|verify} messages. - * @param message RotateServerCaContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IRotateServerCaContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RotateServerCaContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RotateServerCaContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.RotateServerCaContext; - - /** - * Decodes a RotateServerCaContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RotateServerCaContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.RotateServerCaContext; - - /** - * Verifies a RotateServerCaContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RotateServerCaContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RotateServerCaContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.RotateServerCaContext; - - /** - * Creates a plain object from a RotateServerCaContext message. Also converts values to other types if specified. - * @param message RotateServerCaContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.RotateServerCaContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RotateServerCaContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RotateServerCaContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RotateServerCertificateContext. */ - interface IRotateServerCertificateContext { - - /** RotateServerCertificateContext kind */ - kind?: (string|null); - - /** RotateServerCertificateContext nextVersion */ - nextVersion?: (string|null); - } - - /** Represents a RotateServerCertificateContext. */ - class RotateServerCertificateContext implements IRotateServerCertificateContext { - - /** - * Constructs a new RotateServerCertificateContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IRotateServerCertificateContext); - - /** RotateServerCertificateContext kind. */ - public kind: string; - - /** RotateServerCertificateContext nextVersion. */ - public nextVersion: string; - - /** - * Creates a new RotateServerCertificateContext instance using the specified properties. - * @param [properties] Properties to set - * @returns RotateServerCertificateContext instance - */ - public static create(properties?: google.cloud.sql.v1.IRotateServerCertificateContext): google.cloud.sql.v1.RotateServerCertificateContext; - - /** - * Encodes the specified RotateServerCertificateContext message. Does not implicitly {@link google.cloud.sql.v1.RotateServerCertificateContext.verify|verify} messages. - * @param message RotateServerCertificateContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IRotateServerCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RotateServerCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateServerCertificateContext.verify|verify} messages. - * @param message RotateServerCertificateContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IRotateServerCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RotateServerCertificateContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RotateServerCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.RotateServerCertificateContext; - - /** - * Decodes a RotateServerCertificateContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RotateServerCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.RotateServerCertificateContext; - - /** - * Verifies a RotateServerCertificateContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RotateServerCertificateContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RotateServerCertificateContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.RotateServerCertificateContext; - - /** - * Creates a plain object from a RotateServerCertificateContext message. Also converts values to other types if specified. - * @param message RotateServerCertificateContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.RotateServerCertificateContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RotateServerCertificateContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RotateServerCertificateContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RotateEntraIdCertificateContext. */ - interface IRotateEntraIdCertificateContext { - - /** RotateEntraIdCertificateContext kind */ - kind?: (string|null); - - /** RotateEntraIdCertificateContext nextVersion */ - nextVersion?: (string|null); - } - - /** Represents a RotateEntraIdCertificateContext. */ - class RotateEntraIdCertificateContext implements IRotateEntraIdCertificateContext { - - /** - * Constructs a new RotateEntraIdCertificateContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IRotateEntraIdCertificateContext); - - /** RotateEntraIdCertificateContext kind. */ - public kind: string; - - /** RotateEntraIdCertificateContext nextVersion. */ - public nextVersion: string; - - /** - * Creates a new RotateEntraIdCertificateContext instance using the specified properties. - * @param [properties] Properties to set - * @returns RotateEntraIdCertificateContext instance - */ - public static create(properties?: google.cloud.sql.v1.IRotateEntraIdCertificateContext): google.cloud.sql.v1.RotateEntraIdCertificateContext; - - /** - * Encodes the specified RotateEntraIdCertificateContext message. Does not implicitly {@link google.cloud.sql.v1.RotateEntraIdCertificateContext.verify|verify} messages. - * @param message RotateEntraIdCertificateContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IRotateEntraIdCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RotateEntraIdCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateEntraIdCertificateContext.verify|verify} messages. - * @param message RotateEntraIdCertificateContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IRotateEntraIdCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RotateEntraIdCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.RotateEntraIdCertificateContext; - - /** - * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RotateEntraIdCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.RotateEntraIdCertificateContext; - - /** - * Verifies a RotateEntraIdCertificateContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RotateEntraIdCertificateContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RotateEntraIdCertificateContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.RotateEntraIdCertificateContext; - - /** - * Creates a plain object from a RotateEntraIdCertificateContext message. Also converts values to other types if specified. - * @param message RotateEntraIdCertificateContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.RotateEntraIdCertificateContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RotateEntraIdCertificateContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RotateEntraIdCertificateContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TruncateLogContext. */ - interface ITruncateLogContext { - - /** TruncateLogContext kind */ - kind?: (string|null); - - /** TruncateLogContext logType */ - logType?: (string|null); - } - - /** Represents a TruncateLogContext. */ - class TruncateLogContext implements ITruncateLogContext { - - /** - * Constructs a new TruncateLogContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ITruncateLogContext); - - /** TruncateLogContext kind. */ - public kind: string; - - /** TruncateLogContext logType. */ - public logType: string; - - /** - * Creates a new TruncateLogContext instance using the specified properties. - * @param [properties] Properties to set - * @returns TruncateLogContext instance - */ - public static create(properties?: google.cloud.sql.v1.ITruncateLogContext): google.cloud.sql.v1.TruncateLogContext; - - /** - * Encodes the specified TruncateLogContext message. Does not implicitly {@link google.cloud.sql.v1.TruncateLogContext.verify|verify} messages. - * @param message TruncateLogContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ITruncateLogContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TruncateLogContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.TruncateLogContext.verify|verify} messages. - * @param message TruncateLogContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ITruncateLogContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TruncateLogContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TruncateLogContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.TruncateLogContext; - - /** - * Decodes a TruncateLogContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TruncateLogContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.TruncateLogContext; - - /** - * Verifies a TruncateLogContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a TruncateLogContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TruncateLogContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.TruncateLogContext; - - /** - * Creates a plain object from a TruncateLogContext message. Also converts values to other types if specified. - * @param message TruncateLogContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.TruncateLogContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TruncateLogContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TruncateLogContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlExternalSyncSettingError. */ - interface ISqlExternalSyncSettingError { - - /** SqlExternalSyncSettingError kind */ - kind?: (string|null); - - /** SqlExternalSyncSettingError type */ - type?: (google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|keyof typeof google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|null); - - /** SqlExternalSyncSettingError detail */ - detail?: (string|null); - } - - /** Represents a SqlExternalSyncSettingError. */ - class SqlExternalSyncSettingError implements ISqlExternalSyncSettingError { - - /** - * Constructs a new SqlExternalSyncSettingError. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlExternalSyncSettingError); - - /** SqlExternalSyncSettingError kind. */ - public kind: string; - - /** SqlExternalSyncSettingError type. */ - public type: (google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|keyof typeof google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType); - - /** SqlExternalSyncSettingError detail. */ - public detail: string; - - /** - * Creates a new SqlExternalSyncSettingError instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlExternalSyncSettingError instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlExternalSyncSettingError): google.cloud.sql.v1.SqlExternalSyncSettingError; - - /** - * Encodes the specified SqlExternalSyncSettingError message. Does not implicitly {@link google.cloud.sql.v1.SqlExternalSyncSettingError.verify|verify} messages. - * @param message SqlExternalSyncSettingError message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlExternalSyncSettingError, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlExternalSyncSettingError message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlExternalSyncSettingError.verify|verify} messages. - * @param message SqlExternalSyncSettingError message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlExternalSyncSettingError, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlExternalSyncSettingError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlExternalSyncSettingError; - - /** - * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlExternalSyncSettingError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlExternalSyncSettingError; - - /** - * Verifies a SqlExternalSyncSettingError message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlExternalSyncSettingError message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlExternalSyncSettingError - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlExternalSyncSettingError; - - /** - * Creates a plain object from a SqlExternalSyncSettingError message. Also converts values to other types if specified. - * @param message SqlExternalSyncSettingError - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlExternalSyncSettingError, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlExternalSyncSettingError to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlExternalSyncSettingError - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlExternalSyncSettingError { - - /** SqlExternalSyncSettingErrorType enum. */ - enum SqlExternalSyncSettingErrorType { - SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED = 0, - CONNECTION_FAILURE = 1, - BINLOG_NOT_ENABLED = 2, - INCOMPATIBLE_DATABASE_VERSION = 3, - REPLICA_ALREADY_SETUP = 4, - INSUFFICIENT_PRIVILEGE = 5, - UNSUPPORTED_MIGRATION_TYPE = 6, - NO_PGLOGICAL_INSTALLED = 7, - PGLOGICAL_NODE_ALREADY_EXISTS = 8, - INVALID_WAL_LEVEL = 9, - INVALID_SHARED_PRELOAD_LIBRARY = 10, - INSUFFICIENT_MAX_REPLICATION_SLOTS = 11, - INSUFFICIENT_MAX_WAL_SENDERS = 12, - INSUFFICIENT_MAX_WORKER_PROCESSES = 13, - UNSUPPORTED_EXTENSIONS = 14, - INVALID_RDS_LOGICAL_REPLICATION = 15, - INVALID_LOGGING_SETUP = 16, - INVALID_DB_PARAM = 17, - UNSUPPORTED_GTID_MODE = 18, - SQLSERVER_AGENT_NOT_RUNNING = 19, - UNSUPPORTED_TABLE_DEFINITION = 20, - UNSUPPORTED_DEFINER = 21, - SQLSERVER_SERVERNAME_MISMATCH = 22, - PRIMARY_ALREADY_SETUP = 23, - UNSUPPORTED_BINLOG_FORMAT = 24, - BINLOG_RETENTION_SETTING = 25, - UNSUPPORTED_STORAGE_ENGINE = 26, - LIMITED_SUPPORT_TABLES = 27, - EXISTING_DATA_IN_REPLICA = 28, - MISSING_OPTIONAL_PRIVILEGES = 29, - RISKY_BACKUP_ADMIN_PRIVILEGE = 30, - INSUFFICIENT_GCS_PERMISSIONS = 31, - INVALID_FILE_INFO = 32, - UNSUPPORTED_DATABASE_SETTINGS = 33, - MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE = 34, - LOCAL_INFILE_OFF = 35, - TURN_ON_PITR_AFTER_PROMOTE = 36, - INCOMPATIBLE_DATABASE_MINOR_VERSION = 37, - SOURCE_MAX_SUBSCRIPTIONS = 38, - UNABLE_TO_VERIFY_DEFINERS = 39, - SUBSCRIPTION_CALCULATION_STATUS = 40, - PG_SUBSCRIPTION_COUNT = 41, - PG_SYNC_PARALLEL_LEVEL = 42, - INSUFFICIENT_DISK_SIZE = 43, - INSUFFICIENT_MACHINE_TIER = 44, - UNSUPPORTED_EXTENSIONS_NOT_MIGRATED = 45, - EXTENSIONS_NOT_MIGRATED = 46, - PG_CRON_FLAG_ENABLED_IN_REPLICA = 47, - EXTENSIONS_NOT_ENABLED_IN_REPLICA = 48, - UNSUPPORTED_COLUMNS = 49, - USERS_NOT_CREATED_IN_REPLICA = 50, - UNSUPPORTED_SYSTEM_OBJECTS = 51, - UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY = 52, - SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE = 53, - PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI = 54, - SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS = 55, - PROMPT_DELETE_EXISTING = 56, - WILL_DELETE_EXISTING = 57, - PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE = 58 - } - } - - /** Properties of a SelectedObjects. */ - interface ISelectedObjects { - - /** SelectedObjects database */ - database?: (string|null); - } - - /** Represents a SelectedObjects. */ - class SelectedObjects implements ISelectedObjects { - - /** - * Constructs a new SelectedObjects. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISelectedObjects); - - /** SelectedObjects database. */ - public database: string; - - /** - * Creates a new SelectedObjects instance using the specified properties. - * @param [properties] Properties to set - * @returns SelectedObjects instance - */ - public static create(properties?: google.cloud.sql.v1.ISelectedObjects): google.cloud.sql.v1.SelectedObjects; - - /** - * Encodes the specified SelectedObjects message. Does not implicitly {@link google.cloud.sql.v1.SelectedObjects.verify|verify} messages. - * @param message SelectedObjects message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISelectedObjects, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SelectedObjects message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SelectedObjects.verify|verify} messages. - * @param message SelectedObjects message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISelectedObjects, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SelectedObjects message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SelectedObjects - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SelectedObjects; - - /** - * Decodes a SelectedObjects message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SelectedObjects - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SelectedObjects; - - /** - * Verifies a SelectedObjects message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SelectedObjects message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SelectedObjects - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SelectedObjects; - - /** - * Creates a plain object from a SelectedObjects message. Also converts values to other types if specified. - * @param message SelectedObjects - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SelectedObjects, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SelectedObjects to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SelectedObjects - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OnPremisesConfiguration. */ - interface IOnPremisesConfiguration { - - /** OnPremisesConfiguration hostPort */ - hostPort?: (string|null); - - /** OnPremisesConfiguration kind */ - kind?: (string|null); - - /** OnPremisesConfiguration username */ - username?: (string|null); - - /** OnPremisesConfiguration password */ - password?: (string|null); - - /** OnPremisesConfiguration caCertificate */ - caCertificate?: (string|null); - - /** OnPremisesConfiguration clientCertificate */ - clientCertificate?: (string|null); - - /** OnPremisesConfiguration clientKey */ - clientKey?: (string|null); - - /** OnPremisesConfiguration dumpFilePath */ - dumpFilePath?: (string|null); - - /** OnPremisesConfiguration sourceInstance */ - sourceInstance?: (google.cloud.sql.v1.IInstanceReference|null); - - /** OnPremisesConfiguration selectedObjects */ - selectedObjects?: (google.cloud.sql.v1.ISelectedObjects[]|null); - - /** OnPremisesConfiguration sslOption */ - sslOption?: (google.cloud.sql.v1.OnPremisesConfiguration.SslOption|keyof typeof google.cloud.sql.v1.OnPremisesConfiguration.SslOption|null); - } - - /** Represents an OnPremisesConfiguration. */ - class OnPremisesConfiguration implements IOnPremisesConfiguration { - - /** - * Constructs a new OnPremisesConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IOnPremisesConfiguration); - - /** OnPremisesConfiguration hostPort. */ - public hostPort: string; - - /** OnPremisesConfiguration kind. */ - public kind: string; - - /** OnPremisesConfiguration username. */ - public username: string; - - /** OnPremisesConfiguration password. */ - public password: string; - - /** OnPremisesConfiguration caCertificate. */ - public caCertificate: string; - - /** OnPremisesConfiguration clientCertificate. */ - public clientCertificate: string; - - /** OnPremisesConfiguration clientKey. */ - public clientKey: string; - - /** OnPremisesConfiguration dumpFilePath. */ - public dumpFilePath: string; - - /** OnPremisesConfiguration sourceInstance. */ - public sourceInstance?: (google.cloud.sql.v1.IInstanceReference|null); - - /** OnPremisesConfiguration selectedObjects. */ - public selectedObjects: google.cloud.sql.v1.ISelectedObjects[]; - - /** OnPremisesConfiguration sslOption. */ - public sslOption: (google.cloud.sql.v1.OnPremisesConfiguration.SslOption|keyof typeof google.cloud.sql.v1.OnPremisesConfiguration.SslOption); - - /** - * Creates a new OnPremisesConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns OnPremisesConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1.IOnPremisesConfiguration): google.cloud.sql.v1.OnPremisesConfiguration; - - /** - * Encodes the specified OnPremisesConfiguration message. Does not implicitly {@link google.cloud.sql.v1.OnPremisesConfiguration.verify|verify} messages. - * @param message OnPremisesConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IOnPremisesConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OnPremisesConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OnPremisesConfiguration.verify|verify} messages. - * @param message OnPremisesConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IOnPremisesConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OnPremisesConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OnPremisesConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.OnPremisesConfiguration; - - /** - * Decodes an OnPremisesConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OnPremisesConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.OnPremisesConfiguration; - - /** - * Verifies an OnPremisesConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OnPremisesConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OnPremisesConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.OnPremisesConfiguration; - - /** - * Creates a plain object from an OnPremisesConfiguration message. Also converts values to other types if specified. - * @param message OnPremisesConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.OnPremisesConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OnPremisesConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OnPremisesConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace OnPremisesConfiguration { - - /** SslOption enum. */ - enum SslOption { - SSL_OPTION_UNSPECIFIED = 0, - DISABLE = 1, - REQUIRE = 2, - VERIFY_CA = 3 - } - } - - /** Properties of a ReplicaConfiguration. */ - interface IReplicaConfiguration { - - /** ReplicaConfiguration kind */ - kind?: (string|null); - - /** ReplicaConfiguration mysqlReplicaConfiguration */ - mysqlReplicaConfiguration?: (google.cloud.sql.v1.IMySqlReplicaConfiguration|null); - - /** ReplicaConfiguration failoverTarget */ - failoverTarget?: (google.protobuf.IBoolValue|null); - - /** ReplicaConfiguration cascadableReplica */ - cascadableReplica?: (google.protobuf.IBoolValue|null); - } - - /** Represents a ReplicaConfiguration. */ - class ReplicaConfiguration implements IReplicaConfiguration { - - /** - * Constructs a new ReplicaConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IReplicaConfiguration); - - /** ReplicaConfiguration kind. */ - public kind: string; - - /** ReplicaConfiguration mysqlReplicaConfiguration. */ - public mysqlReplicaConfiguration?: (google.cloud.sql.v1.IMySqlReplicaConfiguration|null); - - /** ReplicaConfiguration failoverTarget. */ - public failoverTarget?: (google.protobuf.IBoolValue|null); - - /** ReplicaConfiguration cascadableReplica. */ - public cascadableReplica?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new ReplicaConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns ReplicaConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1.IReplicaConfiguration): google.cloud.sql.v1.ReplicaConfiguration; - - /** - * Encodes the specified ReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.ReplicaConfiguration.verify|verify} messages. - * @param message ReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReplicaConfiguration.verify|verify} messages. - * @param message ReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReplicaConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ReplicaConfiguration; - - /** - * Decodes a ReplicaConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ReplicaConfiguration; - - /** - * Verifies a ReplicaConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReplicaConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ReplicaConfiguration; - - /** - * Creates a plain object from a ReplicaConfiguration message. Also converts values to other types if specified. - * @param message ReplicaConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReplicaConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReplicaConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesExecuteSqlRequest. */ - interface ISqlInstancesExecuteSqlRequest { - - /** SqlInstancesExecuteSqlRequest instance */ - instance?: (string|null); - - /** SqlInstancesExecuteSqlRequest project */ - project?: (string|null); - - /** SqlInstancesExecuteSqlRequest body */ - body?: (google.cloud.sql.v1.IExecuteSqlPayload|null); - } - - /** Represents a SqlInstancesExecuteSqlRequest. */ - class SqlInstancesExecuteSqlRequest implements ISqlInstancesExecuteSqlRequest { - - /** - * Constructs a new SqlInstancesExecuteSqlRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest); - - /** SqlInstancesExecuteSqlRequest instance. */ - public instance: string; - - /** SqlInstancesExecuteSqlRequest project. */ - public project: string; - - /** SqlInstancesExecuteSqlRequest body. */ - public body?: (google.cloud.sql.v1.IExecuteSqlPayload|null); - - /** - * Creates a new SqlInstancesExecuteSqlRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesExecuteSqlRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest): google.cloud.sql.v1.SqlInstancesExecuteSqlRequest; - - /** - * Encodes the specified SqlInstancesExecuteSqlRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlRequest.verify|verify} messages. - * @param message SqlInstancesExecuteSqlRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesExecuteSqlRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlRequest.verify|verify} messages. - * @param message SqlInstancesExecuteSqlRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesExecuteSqlRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesExecuteSqlRequest; - - /** - * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesExecuteSqlRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesExecuteSqlRequest; - - /** - * Verifies a SqlInstancesExecuteSqlRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesExecuteSqlRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesExecuteSqlRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesExecuteSqlRequest; - - /** - * Creates a plain object from a SqlInstancesExecuteSqlRequest message. Also converts values to other types if specified. - * @param message SqlInstancesExecuteSqlRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesExecuteSqlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesExecuteSqlRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesExecuteSqlRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ExecuteSqlPayload. */ - interface IExecuteSqlPayload { - - /** ExecuteSqlPayload user */ - user?: (string|null); - - /** ExecuteSqlPayload sqlStatement */ - sqlStatement?: (string|null); - - /** ExecuteSqlPayload database */ - database?: (string|null); - - /** ExecuteSqlPayload autoIamAuthn */ - autoIamAuthn?: (boolean|null); - - /** ExecuteSqlPayload rowLimit */ - rowLimit?: (number|Long|string|null); - - /** ExecuteSqlPayload partialResultMode */ - partialResultMode?: (google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode|keyof typeof google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode|null); - - /** ExecuteSqlPayload application */ - application?: (string|null); - } - - /** Represents an ExecuteSqlPayload. */ - class ExecuteSqlPayload implements IExecuteSqlPayload { - - /** - * Constructs a new ExecuteSqlPayload. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IExecuteSqlPayload); - - /** ExecuteSqlPayload user. */ - public user: string; - - /** ExecuteSqlPayload sqlStatement. */ - public sqlStatement: string; - - /** ExecuteSqlPayload database. */ - public database: string; - - /** ExecuteSqlPayload autoIamAuthn. */ - public autoIamAuthn?: (boolean|null); - - /** ExecuteSqlPayload rowLimit. */ - public rowLimit: (number|Long|string); - - /** ExecuteSqlPayload partialResultMode. */ - public partialResultMode: (google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode|keyof typeof google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode); - - /** ExecuteSqlPayload application. */ - public application: string; - - /** ExecuteSqlPayload userPassword. */ - public userPassword?: "autoIamAuthn"; - - /** - * Creates a new ExecuteSqlPayload instance using the specified properties. - * @param [properties] Properties to set - * @returns ExecuteSqlPayload instance - */ - public static create(properties?: google.cloud.sql.v1.IExecuteSqlPayload): google.cloud.sql.v1.ExecuteSqlPayload; - - /** - * Encodes the specified ExecuteSqlPayload message. Does not implicitly {@link google.cloud.sql.v1.ExecuteSqlPayload.verify|verify} messages. - * @param message ExecuteSqlPayload message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IExecuteSqlPayload, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExecuteSqlPayload message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExecuteSqlPayload.verify|verify} messages. - * @param message ExecuteSqlPayload message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IExecuteSqlPayload, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExecuteSqlPayload message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExecuteSqlPayload - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ExecuteSqlPayload; - - /** - * Decodes an ExecuteSqlPayload message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExecuteSqlPayload - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ExecuteSqlPayload; - - /** - * Verifies an ExecuteSqlPayload message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ExecuteSqlPayload message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExecuteSqlPayload - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ExecuteSqlPayload; - - /** - * Creates a plain object from an ExecuteSqlPayload message. Also converts values to other types if specified. - * @param message ExecuteSqlPayload - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ExecuteSqlPayload, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExecuteSqlPayload to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExecuteSqlPayload - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ExecuteSqlPayload { - - /** PartialResultMode enum. */ - enum PartialResultMode { - PARTIAL_RESULT_MODE_UNSPECIFIED = 0, - FAIL_PARTIAL_RESULT = 1, - ALLOW_PARTIAL_RESULT = 2 - } - } - - /** Properties of a SqlInstancesExecuteSqlResponse. */ - interface ISqlInstancesExecuteSqlResponse { - - /** SqlInstancesExecuteSqlResponse messages */ - messages?: (google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage[]|null); - - /** SqlInstancesExecuteSqlResponse metadata */ - metadata?: (google.cloud.sql.v1.IMetadata|null); - - /** SqlInstancesExecuteSqlResponse results */ - results?: (google.cloud.sql.v1.IQueryResult[]|null); - - /** SqlInstancesExecuteSqlResponse status */ - status?: (google.rpc.IStatus|null); - } - - /** Represents a SqlInstancesExecuteSqlResponse. */ - class SqlInstancesExecuteSqlResponse implements ISqlInstancesExecuteSqlResponse { - - /** - * Constructs a new SqlInstancesExecuteSqlResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse); - - /** SqlInstancesExecuteSqlResponse messages. */ - public messages: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage[]; - - /** SqlInstancesExecuteSqlResponse metadata. */ - public metadata?: (google.cloud.sql.v1.IMetadata|null); - - /** SqlInstancesExecuteSqlResponse results. */ - public results: google.cloud.sql.v1.IQueryResult[]; - - /** SqlInstancesExecuteSqlResponse status. */ - public status?: (google.rpc.IStatus|null); - - /** - * Creates a new SqlInstancesExecuteSqlResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesExecuteSqlResponse instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse; - - /** - * Encodes the specified SqlInstancesExecuteSqlResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.verify|verify} messages. - * @param message SqlInstancesExecuteSqlResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesExecuteSqlResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.verify|verify} messages. - * @param message SqlInstancesExecuteSqlResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesExecuteSqlResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse; - - /** - * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesExecuteSqlResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse; - - /** - * Verifies a SqlInstancesExecuteSqlResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesExecuteSqlResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesExecuteSqlResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse; - - /** - * Creates a plain object from a SqlInstancesExecuteSqlResponse message. Also converts values to other types if specified. - * @param message SqlInstancesExecuteSqlResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesExecuteSqlResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesExecuteSqlResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlInstancesExecuteSqlResponse { - - /** Properties of a Message. */ - interface IMessage { - - /** Message message */ - message?: (string|null); - - /** Message severity */ - severity?: (string|null); - } - - /** Represents a Message. */ - class Message implements IMessage { - - /** - * Constructs a new Message. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage); - - /** Message message. */ - public message?: (string|null); - - /** Message severity. */ - public severity?: (string|null); - - /** - * Creates a new Message instance using the specified properties. - * @param [properties] Properties to set - * @returns Message instance - */ - public static create(properties?: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message; - - /** - * Encodes the specified Message message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. - * @param message Message message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. - * @param message Message message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Message message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message; - - /** - * Decodes a Message message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message; - - /** - * Verifies a Message message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Message message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Message - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message; - - /** - * Creates a plain object from a Message message. Also converts values to other types if specified. - * @param message Message - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Message to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Message - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a QueryResult. */ - interface IQueryResult { - - /** QueryResult columns */ - columns?: (google.cloud.sql.v1.IColumn[]|null); - - /** QueryResult rows */ - rows?: (google.cloud.sql.v1.IRow[]|null); - - /** QueryResult message */ - message?: (string|null); - - /** QueryResult partialResult */ - partialResult?: (boolean|null); - - /** QueryResult status */ - status?: (google.rpc.IStatus|null); - } - - /** Represents a QueryResult. */ - class QueryResult implements IQueryResult { - - /** - * Constructs a new QueryResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IQueryResult); - - /** QueryResult columns. */ - public columns: google.cloud.sql.v1.IColumn[]; - - /** QueryResult rows. */ - public rows: google.cloud.sql.v1.IRow[]; - - /** QueryResult message. */ - public message: string; - - /** QueryResult partialResult. */ - public partialResult: boolean; - - /** QueryResult status. */ - public status?: (google.rpc.IStatus|null); - - /** - * Creates a new QueryResult instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryResult instance - */ - public static create(properties?: google.cloud.sql.v1.IQueryResult): google.cloud.sql.v1.QueryResult; - - /** - * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.sql.v1.QueryResult.verify|verify} messages. - * @param message QueryResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.sql.v1.QueryResult.verify|verify} messages. - * @param message QueryResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a QueryResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.QueryResult; - - /** - * Decodes a QueryResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.QueryResult; - - /** - * Verifies a QueryResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.QueryResult; - - /** - * Creates a plain object from a QueryResult message. Also converts values to other types if specified. - * @param message QueryResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.QueryResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this QueryResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for QueryResult - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Column. */ - interface IColumn { - - /** Column name */ - name?: (string|null); - - /** Column type */ - type?: (string|null); - } - - /** Represents a Column. */ - class Column implements IColumn { - - /** - * Constructs a new Column. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IColumn); - - /** Column name. */ - public name: string; - - /** Column type. */ - public type: string; - - /** - * Creates a new Column instance using the specified properties. - * @param [properties] Properties to set - * @returns Column instance - */ - public static create(properties?: google.cloud.sql.v1.IColumn): google.cloud.sql.v1.Column; - - /** - * Encodes the specified Column message. Does not implicitly {@link google.cloud.sql.v1.Column.verify|verify} messages. - * @param message Column message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IColumn, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Column message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Column.verify|verify} messages. - * @param message Column message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IColumn, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Column message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Column - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Column; - - /** - * Decodes a Column message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Column - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Column; - - /** - * Verifies a Column message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Column message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Column - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Column; - - /** - * Creates a plain object from a Column message. Also converts values to other types if specified. - * @param message Column - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.Column, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Column to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Column - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Row. */ - interface IRow { - - /** Row values */ - values?: (google.cloud.sql.v1.IValue[]|null); - } - - /** Represents a Row. */ - class Row implements IRow { - - /** - * Constructs a new Row. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IRow); - - /** Row values. */ - public values: google.cloud.sql.v1.IValue[]; - - /** - * Creates a new Row instance using the specified properties. - * @param [properties] Properties to set - * @returns Row instance - */ - public static create(properties?: google.cloud.sql.v1.IRow): google.cloud.sql.v1.Row; - - /** - * Encodes the specified Row message. Does not implicitly {@link google.cloud.sql.v1.Row.verify|verify} messages. - * @param message Row message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IRow, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Row message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Row.verify|verify} messages. - * @param message Row message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IRow, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Row message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Row - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Row; - - /** - * Decodes a Row message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Row - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Row; - - /** - * Verifies a Row message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Row message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Row - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Row; - - /** - * Creates a plain object from a Row message. Also converts values to other types if specified. - * @param message Row - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.Row, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Row to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Row - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Value. */ - interface IValue { - - /** Value value */ - value?: (string|null); - - /** Value nullValue */ - nullValue?: (boolean|null); - } - - /** Represents a Value. */ - class Value implements IValue { - - /** - * Constructs a new Value. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IValue); - - /** Value value. */ - public value: string; - - /** Value nullValue. */ - public nullValue: boolean; - - /** - * Creates a new Value instance using the specified properties. - * @param [properties] Properties to set - * @returns Value instance - */ - public static create(properties?: google.cloud.sql.v1.IValue): google.cloud.sql.v1.Value; - - /** - * Encodes the specified Value message. Does not implicitly {@link google.cloud.sql.v1.Value.verify|verify} messages. - * @param message Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Value message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Value.verify|verify} messages. - * @param message Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Value message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Value; - - /** - * Decodes a Value message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Value; - - /** - * Verifies a Value message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Value message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Value - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Value; - - /** - * Creates a plain object from a Value message. Also converts values to other types if specified. - * @param message Value - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Value to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Value - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Metadata. */ - interface IMetadata { - - /** Metadata sqlStatementExecutionTime */ - sqlStatementExecutionTime?: (google.protobuf.IDuration|null); - } - - /** Represents a Metadata. */ - class Metadata implements IMetadata { - - /** - * Constructs a new Metadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IMetadata); - - /** Metadata sqlStatementExecutionTime. */ - public sqlStatementExecutionTime?: (google.protobuf.IDuration|null); - - /** - * Creates a new Metadata instance using the specified properties. - * @param [properties] Properties to set - * @returns Metadata instance - */ - public static create(properties?: google.cloud.sql.v1.IMetadata): google.cloud.sql.v1.Metadata; - - /** - * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.sql.v1.Metadata.verify|verify} messages. - * @param message Metadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Metadata.verify|verify} messages. - * @param message Metadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Metadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Metadata; - - /** - * Decodes a Metadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Metadata; - - /** - * Verifies a Metadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Metadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Metadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Metadata; - - /** - * Creates a plain object from a Metadata message. Also converts values to other types if specified. - * @param message Metadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.Metadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Metadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Metadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesAcquireSsrsLeaseRequest. */ - interface ISqlInstancesAcquireSsrsLeaseRequest { - - /** SqlInstancesAcquireSsrsLeaseRequest instance */ - instance?: (string|null); - - /** SqlInstancesAcquireSsrsLeaseRequest project */ - project?: (string|null); - - /** SqlInstancesAcquireSsrsLeaseRequest body */ - body?: (google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest|null); - } - - /** Represents a SqlInstancesAcquireSsrsLeaseRequest. */ - class SqlInstancesAcquireSsrsLeaseRequest implements ISqlInstancesAcquireSsrsLeaseRequest { - - /** - * Constructs a new SqlInstancesAcquireSsrsLeaseRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest); - - /** SqlInstancesAcquireSsrsLeaseRequest instance. */ - public instance: string; - - /** SqlInstancesAcquireSsrsLeaseRequest project. */ - public project: string; - - /** SqlInstancesAcquireSsrsLeaseRequest body. */ - public body?: (google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest|null); - - /** - * Creates a new SqlInstancesAcquireSsrsLeaseRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesAcquireSsrsLeaseRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @param message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @param message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest; - - /** - * Verifies a SqlInstancesAcquireSsrsLeaseRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesAcquireSsrsLeaseRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest; - - /** - * Creates a plain object from a SqlInstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. - * @param message SqlInstancesAcquireSsrsLeaseRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesAcquireSsrsLeaseRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesAcquireSsrsLeaseRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesAcquireSsrsLeaseResponse. */ - interface ISqlInstancesAcquireSsrsLeaseResponse { - - /** SqlInstancesAcquireSsrsLeaseResponse operationId */ - operationId?: (string|null); - } - - /** Represents a SqlInstancesAcquireSsrsLeaseResponse. */ - class SqlInstancesAcquireSsrsLeaseResponse implements ISqlInstancesAcquireSsrsLeaseResponse { - - /** - * Constructs a new SqlInstancesAcquireSsrsLeaseResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse); - - /** SqlInstancesAcquireSsrsLeaseResponse operationId. */ - public operationId: string; - - /** - * Creates a new SqlInstancesAcquireSsrsLeaseResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesAcquireSsrsLeaseResponse instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. - * @param message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. - * @param message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesAcquireSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesAcquireSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse; - - /** - * Verifies a SqlInstancesAcquireSsrsLeaseResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesAcquireSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesAcquireSsrsLeaseResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse; - - /** - * Creates a plain object from a SqlInstancesAcquireSsrsLeaseResponse message. Also converts values to other types if specified. - * @param message SqlInstancesAcquireSsrsLeaseResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesAcquireSsrsLeaseResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesAcquireSsrsLeaseResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesReleaseSsrsLeaseRequest. */ - interface ISqlInstancesReleaseSsrsLeaseRequest { - - /** SqlInstancesReleaseSsrsLeaseRequest instance */ - instance?: (string|null); - - /** SqlInstancesReleaseSsrsLeaseRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesReleaseSsrsLeaseRequest. */ - class SqlInstancesReleaseSsrsLeaseRequest implements ISqlInstancesReleaseSsrsLeaseRequest { - - /** - * Constructs a new SqlInstancesReleaseSsrsLeaseRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest); - - /** SqlInstancesReleaseSsrsLeaseRequest instance. */ - public instance: string; - - /** SqlInstancesReleaseSsrsLeaseRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesReleaseSsrsLeaseRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesReleaseSsrsLeaseRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. - * @param message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. - * @param message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesReleaseSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesReleaseSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest; - - /** - * Verifies a SqlInstancesReleaseSsrsLeaseRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesReleaseSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesReleaseSsrsLeaseRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest; - - /** - * Creates a plain object from a SqlInstancesReleaseSsrsLeaseRequest message. Also converts values to other types if specified. - * @param message SqlInstancesReleaseSsrsLeaseRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesReleaseSsrsLeaseRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesReleaseSsrsLeaseRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesReleaseSsrsLeaseResponse. */ - interface ISqlInstancesReleaseSsrsLeaseResponse { - - /** SqlInstancesReleaseSsrsLeaseResponse operationId */ - operationId?: (string|null); - } - - /** Represents a SqlInstancesReleaseSsrsLeaseResponse. */ - class SqlInstancesReleaseSsrsLeaseResponse implements ISqlInstancesReleaseSsrsLeaseResponse { - - /** - * Constructs a new SqlInstancesReleaseSsrsLeaseResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse); - - /** SqlInstancesReleaseSsrsLeaseResponse operationId. */ - public operationId: string; - - /** - * Creates a new SqlInstancesReleaseSsrsLeaseResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesReleaseSsrsLeaseResponse instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. - * @param message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. - * @param message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesReleaseSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesReleaseSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse; - - /** - * Verifies a SqlInstancesReleaseSsrsLeaseResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesReleaseSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesReleaseSsrsLeaseResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse; - - /** - * Creates a plain object from a SqlInstancesReleaseSsrsLeaseResponse message. Also converts values to other types if specified. - * @param message SqlInstancesReleaseSsrsLeaseResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesReleaseSsrsLeaseResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesReleaseSsrsLeaseResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesPointInTimeRestoreRequest. */ - interface ISqlInstancesPointInTimeRestoreRequest { - - /** SqlInstancesPointInTimeRestoreRequest parent */ - parent?: (string|null); - - /** SqlInstancesPointInTimeRestoreRequest context */ - context?: (google.cloud.sql.v1.IPointInTimeRestoreContext|null); - } - - /** Represents a SqlInstancesPointInTimeRestoreRequest. */ - class SqlInstancesPointInTimeRestoreRequest implements ISqlInstancesPointInTimeRestoreRequest { - - /** - * Constructs a new SqlInstancesPointInTimeRestoreRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest); - - /** SqlInstancesPointInTimeRestoreRequest parent. */ - public parent: string; - - /** SqlInstancesPointInTimeRestoreRequest context. */ - public context?: (google.cloud.sql.v1.IPointInTimeRestoreContext|null); - - /** - * Creates a new SqlInstancesPointInTimeRestoreRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesPointInTimeRestoreRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest): google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest; - - /** - * Encodes the specified SqlInstancesPointInTimeRestoreRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. - * @param message SqlInstancesPointInTimeRestoreRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesPointInTimeRestoreRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. - * @param message SqlInstancesPointInTimeRestoreRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesPointInTimeRestoreRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest; - - /** - * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesPointInTimeRestoreRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest; - - /** - * Verifies a SqlInstancesPointInTimeRestoreRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesPointInTimeRestoreRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesPointInTimeRestoreRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest; - - /** - * Creates a plain object from a SqlInstancesPointInTimeRestoreRequest message. Also converts values to other types if specified. - * @param message SqlInstancesPointInTimeRestoreRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesPointInTimeRestoreRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesPointInTimeRestoreRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlInstanceType enum. */ - enum SqlInstanceType { - SQL_INSTANCE_TYPE_UNSPECIFIED = 0, - CLOUD_SQL_INSTANCE = 1, - ON_PREMISES_INSTANCE = 2, - READ_REPLICA_INSTANCE = 3, - READ_POOL_INSTANCE = 5 - } - - /** SqlSuspensionReason enum. */ - enum SqlSuspensionReason { - SQL_SUSPENSION_REASON_UNSPECIFIED = 0, - BILLING_ISSUE = 2, - LEGAL_ISSUE = 3, - OPERATIONAL_ISSUE = 4, - KMS_KEY_ISSUE = 5, - PROJECT_ABUSE = 8 - } - - /** Represents a SqlConnectService */ - class SqlConnectService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlConnectService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlConnectService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlConnectService; - - /** - * Calls GetConnectSettings. - * @param request GetConnectSettingsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ConnectSettings - */ - public getConnectSettings(request: google.cloud.sql.v1.IGetConnectSettingsRequest, callback: google.cloud.sql.v1.SqlConnectService.GetConnectSettingsCallback): void; - - /** - * Calls GetConnectSettings. - * @param request GetConnectSettingsRequest message or plain object - * @returns Promise - */ - public getConnectSettings(request: google.cloud.sql.v1.IGetConnectSettingsRequest): Promise; - - /** - * Calls GenerateEphemeralCert. - * @param request GenerateEphemeralCertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and GenerateEphemeralCertResponse - */ - public generateEphemeralCert(request: google.cloud.sql.v1.IGenerateEphemeralCertRequest, callback: google.cloud.sql.v1.SqlConnectService.GenerateEphemeralCertCallback): void; - - /** - * Calls GenerateEphemeralCert. - * @param request GenerateEphemeralCertRequest message or plain object - * @returns Promise - */ - public generateEphemeralCert(request: google.cloud.sql.v1.IGenerateEphemeralCertRequest): Promise; - } - - namespace SqlConnectService { - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlConnectService|getConnectSettings}. - * @param error Error, if any - * @param [response] ConnectSettings - */ - type GetConnectSettingsCallback = (error: (Error|null), response?: google.cloud.sql.v1.ConnectSettings) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlConnectService|generateEphemeralCert}. - * @param error Error, if any - * @param [response] GenerateEphemeralCertResponse - */ - type GenerateEphemeralCertCallback = (error: (Error|null), response?: google.cloud.sql.v1.GenerateEphemeralCertResponse) => void; - } - - /** Properties of a GetConnectSettingsRequest. */ - interface IGetConnectSettingsRequest { - - /** GetConnectSettingsRequest instance */ - instance?: (string|null); - - /** GetConnectSettingsRequest project */ - project?: (string|null); - - /** GetConnectSettingsRequest readTime */ - readTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a GetConnectSettingsRequest. */ - class GetConnectSettingsRequest implements IGetConnectSettingsRequest { - - /** - * Constructs a new GetConnectSettingsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IGetConnectSettingsRequest); - - /** GetConnectSettingsRequest instance. */ - public instance: string; - - /** GetConnectSettingsRequest project. */ - public project: string; - - /** GetConnectSettingsRequest readTime. */ - public readTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new GetConnectSettingsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetConnectSettingsRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IGetConnectSettingsRequest): google.cloud.sql.v1.GetConnectSettingsRequest; - - /** - * Encodes the specified GetConnectSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1.GetConnectSettingsRequest.verify|verify} messages. - * @param message GetConnectSettingsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IGetConnectSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetConnectSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GetConnectSettingsRequest.verify|verify} messages. - * @param message GetConnectSettingsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IGetConnectSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetConnectSettingsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetConnectSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.GetConnectSettingsRequest; - - /** - * Decodes a GetConnectSettingsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetConnectSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.GetConnectSettingsRequest; - - /** - * Verifies a GetConnectSettingsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GetConnectSettingsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetConnectSettingsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.GetConnectSettingsRequest; - - /** - * Creates a plain object from a GetConnectSettingsRequest message. Also converts values to other types if specified. - * @param message GetConnectSettingsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.GetConnectSettingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetConnectSettingsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetConnectSettingsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ConnectSettings. */ - interface IConnectSettings { - - /** ConnectSettings kind */ - kind?: (string|null); - - /** ConnectSettings serverCaCert */ - serverCaCert?: (google.cloud.sql.v1.ISslCert|null); - - /** ConnectSettings ipAddresses */ - ipAddresses?: (google.cloud.sql.v1.IIpMapping[]|null); - - /** ConnectSettings region */ - region?: (string|null); - - /** ConnectSettings databaseVersion */ - databaseVersion?: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion|null); - - /** ConnectSettings backendType */ - backendType?: (google.cloud.sql.v1.SqlBackendType|keyof typeof google.cloud.sql.v1.SqlBackendType|null); - - /** ConnectSettings pscEnabled */ - pscEnabled?: (boolean|null); - - /** ConnectSettings dnsName */ - dnsName?: (string|null); - - /** ConnectSettings serverCaMode */ - serverCaMode?: (google.cloud.sql.v1.ConnectSettings.CaMode|keyof typeof google.cloud.sql.v1.ConnectSettings.CaMode|null); - - /** ConnectSettings customSubjectAlternativeNames */ - customSubjectAlternativeNames?: (string[]|null); - - /** ConnectSettings dnsNames */ - dnsNames?: (google.cloud.sql.v1.IDnsNameMapping[]|null); - - /** ConnectSettings nodeCount */ - nodeCount?: (number|null); - - /** ConnectSettings nodes */ - nodes?: (google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig[]|null); - - /** ConnectSettings mdxProtocolSupport */ - mdxProtocolSupport?: (google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport[]|null); - } - - /** Represents a ConnectSettings. */ - class ConnectSettings implements IConnectSettings { - - /** - * Constructs a new ConnectSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IConnectSettings); - - /** ConnectSettings kind. */ - public kind: string; - - /** ConnectSettings serverCaCert. */ - public serverCaCert?: (google.cloud.sql.v1.ISslCert|null); - - /** ConnectSettings ipAddresses. */ - public ipAddresses: google.cloud.sql.v1.IIpMapping[]; - - /** ConnectSettings region. */ - public region: string; - - /** ConnectSettings databaseVersion. */ - public databaseVersion: (google.cloud.sql.v1.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1.SqlDatabaseVersion); - - /** ConnectSettings backendType. */ - public backendType: (google.cloud.sql.v1.SqlBackendType|keyof typeof google.cloud.sql.v1.SqlBackendType); - - /** ConnectSettings pscEnabled. */ - public pscEnabled: boolean; - - /** ConnectSettings dnsName. */ - public dnsName: string; - - /** ConnectSettings serverCaMode. */ - public serverCaMode: (google.cloud.sql.v1.ConnectSettings.CaMode|keyof typeof google.cloud.sql.v1.ConnectSettings.CaMode); - - /** ConnectSettings customSubjectAlternativeNames. */ - public customSubjectAlternativeNames: string[]; - - /** ConnectSettings dnsNames. */ - public dnsNames: google.cloud.sql.v1.IDnsNameMapping[]; - - /** ConnectSettings nodeCount. */ - public nodeCount?: (number|null); - - /** ConnectSettings nodes. */ - public nodes: google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig[]; - - /** ConnectSettings mdxProtocolSupport. */ - public mdxProtocolSupport: google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport[]; - - /** - * Creates a new ConnectSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns ConnectSettings instance - */ - public static create(properties?: google.cloud.sql.v1.IConnectSettings): google.cloud.sql.v1.ConnectSettings; - - /** - * Encodes the specified ConnectSettings message. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.verify|verify} messages. - * @param message ConnectSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IConnectSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ConnectSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.verify|verify} messages. - * @param message ConnectSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IConnectSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ConnectSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConnectSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ConnectSettings; - - /** - * Decodes a ConnectSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConnectSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ConnectSettings; - - /** - * Verifies a ConnectSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ConnectSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConnectSettings - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ConnectSettings; - - /** - * Creates a plain object from a ConnectSettings message. Also converts values to other types if specified. - * @param message ConnectSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ConnectSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ConnectSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ConnectSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ConnectSettings { - - /** CaMode enum. */ - enum CaMode { - CA_MODE_UNSPECIFIED = 0, - GOOGLE_MANAGED_INTERNAL_CA = 1, - GOOGLE_MANAGED_CAS_CA = 2, - CUSTOMER_MANAGED_CAS_CA = 3 - } - - /** Properties of a ConnectPoolNodeConfig. */ - interface IConnectPoolNodeConfig { - - /** ConnectPoolNodeConfig name */ - name?: (string|null); - - /** ConnectPoolNodeConfig ipAddresses */ - ipAddresses?: (google.cloud.sql.v1.IIpMapping[]|null); - - /** ConnectPoolNodeConfig dnsName */ - dnsName?: (string|null); - - /** ConnectPoolNodeConfig dnsNames */ - dnsNames?: (google.cloud.sql.v1.IDnsNameMapping[]|null); - } - - /** Represents a ConnectPoolNodeConfig. */ - class ConnectPoolNodeConfig implements IConnectPoolNodeConfig { - - /** - * Constructs a new ConnectPoolNodeConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig); - - /** ConnectPoolNodeConfig name. */ - public name?: (string|null); - - /** ConnectPoolNodeConfig ipAddresses. */ - public ipAddresses: google.cloud.sql.v1.IIpMapping[]; - - /** ConnectPoolNodeConfig dnsName. */ - public dnsName?: (string|null); - - /** ConnectPoolNodeConfig dnsNames. */ - public dnsNames: google.cloud.sql.v1.IDnsNameMapping[]; - - /** - * Creates a new ConnectPoolNodeConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ConnectPoolNodeConfig instance - */ - public static create(properties?: google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig): google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig; - - /** - * Encodes the specified ConnectPoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. - * @param message ConnectPoolNodeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ConnectPoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. - * @param message ConnectPoolNodeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConnectPoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig; - - /** - * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConnectPoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig; - - /** - * Verifies a ConnectPoolNodeConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ConnectPoolNodeConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConnectPoolNodeConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig; - - /** - * Creates a plain object from a ConnectPoolNodeConfig message. Also converts values to other types if specified. - * @param message ConnectPoolNodeConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ConnectPoolNodeConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ConnectPoolNodeConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** MdxProtocolSupport enum. */ - enum MdxProtocolSupport { - MDX_PROTOCOL_SUPPORT_UNSPECIFIED = 0, - CLIENT_PROTOCOL_TYPE = 1 - } - } - - /** Properties of a GenerateEphemeralCertRequest. */ - interface IGenerateEphemeralCertRequest { - - /** GenerateEphemeralCertRequest instance */ - instance?: (string|null); - - /** GenerateEphemeralCertRequest project */ - project?: (string|null); - - /** GenerateEphemeralCertRequest publicKey */ - publicKey?: (string|null); - - /** GenerateEphemeralCertRequest accessToken */ - accessToken?: (string|null); - - /** GenerateEphemeralCertRequest readTime */ - readTime?: (google.protobuf.ITimestamp|null); - - /** GenerateEphemeralCertRequest validDuration */ - validDuration?: (google.protobuf.IDuration|null); - } - - /** Represents a GenerateEphemeralCertRequest. */ - class GenerateEphemeralCertRequest implements IGenerateEphemeralCertRequest { - - /** - * Constructs a new GenerateEphemeralCertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IGenerateEphemeralCertRequest); - - /** GenerateEphemeralCertRequest instance. */ - public instance: string; - - /** GenerateEphemeralCertRequest project. */ - public project: string; - - /** GenerateEphemeralCertRequest publicKey. */ - public publicKey: string; - - /** GenerateEphemeralCertRequest accessToken. */ - public accessToken: string; - - /** GenerateEphemeralCertRequest readTime. */ - public readTime?: (google.protobuf.ITimestamp|null); - - /** GenerateEphemeralCertRequest validDuration. */ - public validDuration?: (google.protobuf.IDuration|null); - - /** - * Creates a new GenerateEphemeralCertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GenerateEphemeralCertRequest instance - */ - public static create(properties?: google.cloud.sql.v1.IGenerateEphemeralCertRequest): google.cloud.sql.v1.GenerateEphemeralCertRequest; - - /** - * Encodes the specified GenerateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertRequest.verify|verify} messages. - * @param message GenerateEphemeralCertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IGenerateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GenerateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertRequest.verify|verify} messages. - * @param message GenerateEphemeralCertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IGenerateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GenerateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.GenerateEphemeralCertRequest; - - /** - * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GenerateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.GenerateEphemeralCertRequest; - - /** - * Verifies a GenerateEphemeralCertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GenerateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GenerateEphemeralCertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.GenerateEphemeralCertRequest; - - /** - * Creates a plain object from a GenerateEphemeralCertRequest message. Also converts values to other types if specified. - * @param message GenerateEphemeralCertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.GenerateEphemeralCertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GenerateEphemeralCertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GenerateEphemeralCertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GenerateEphemeralCertResponse. */ - interface IGenerateEphemeralCertResponse { - - /** GenerateEphemeralCertResponse ephemeralCert */ - ephemeralCert?: (google.cloud.sql.v1.ISslCert|null); - } - - /** Represents a GenerateEphemeralCertResponse. */ - class GenerateEphemeralCertResponse implements IGenerateEphemeralCertResponse { - - /** - * Constructs a new GenerateEphemeralCertResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IGenerateEphemeralCertResponse); - - /** GenerateEphemeralCertResponse ephemeralCert. */ - public ephemeralCert?: (google.cloud.sql.v1.ISslCert|null); - - /** - * Creates a new GenerateEphemeralCertResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns GenerateEphemeralCertResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IGenerateEphemeralCertResponse): google.cloud.sql.v1.GenerateEphemeralCertResponse; - - /** - * Encodes the specified GenerateEphemeralCertResponse message. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertResponse.verify|verify} messages. - * @param message GenerateEphemeralCertResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IGenerateEphemeralCertResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GenerateEphemeralCertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertResponse.verify|verify} messages. - * @param message GenerateEphemeralCertResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IGenerateEphemeralCertResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GenerateEphemeralCertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.GenerateEphemeralCertResponse; - - /** - * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GenerateEphemeralCertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.GenerateEphemeralCertResponse; - - /** - * Verifies a GenerateEphemeralCertResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GenerateEphemeralCertResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GenerateEphemeralCertResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.GenerateEphemeralCertResponse; - - /** - * Creates a plain object from a GenerateEphemeralCertResponse message. Also converts values to other types if specified. - * @param message GenerateEphemeralCertResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.GenerateEphemeralCertResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GenerateEphemeralCertResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GenerateEphemeralCertResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Represents a SqlDatabasesService */ - class SqlDatabasesService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlDatabasesService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlDatabasesService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlDatabasesService; - - /** - * Calls Delete. - * @param request SqlDatabasesDeleteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public delete(request: google.cloud.sql.v1.ISqlDatabasesDeleteRequest, callback: google.cloud.sql.v1.SqlDatabasesService.DeleteCallback): void; - - /** - * Calls Delete. - * @param request SqlDatabasesDeleteRequest message or plain object - * @returns Promise - */ - public delete(request: google.cloud.sql.v1.ISqlDatabasesDeleteRequest): Promise; - - /** - * Calls Get. - * @param request SqlDatabasesGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Database - */ - public get(request: google.cloud.sql.v1.ISqlDatabasesGetRequest, callback: google.cloud.sql.v1.SqlDatabasesService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlDatabasesGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1.ISqlDatabasesGetRequest): Promise; - - /** - * Calls Insert. - * @param request SqlDatabasesInsertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public insert(request: google.cloud.sql.v1.ISqlDatabasesInsertRequest, callback: google.cloud.sql.v1.SqlDatabasesService.InsertCallback): void; - - /** - * Calls Insert. - * @param request SqlDatabasesInsertRequest message or plain object - * @returns Promise - */ - public insert(request: google.cloud.sql.v1.ISqlDatabasesInsertRequest): Promise; - - /** - * Calls List. - * @param request SqlDatabasesListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and DatabasesListResponse - */ - public list(request: google.cloud.sql.v1.ISqlDatabasesListRequest, callback: google.cloud.sql.v1.SqlDatabasesService.ListCallback): void; - - /** - * Calls List. - * @param request SqlDatabasesListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1.ISqlDatabasesListRequest): Promise; - - /** - * Calls Patch. - * @param request SqlDatabasesUpdateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public patch(request: google.cloud.sql.v1.ISqlDatabasesUpdateRequest, callback: google.cloud.sql.v1.SqlDatabasesService.PatchCallback): void; - - /** - * Calls Patch. - * @param request SqlDatabasesUpdateRequest message or plain object - * @returns Promise - */ - public patch(request: google.cloud.sql.v1.ISqlDatabasesUpdateRequest): Promise; - - /** - * Calls Update. - * @param request SqlDatabasesUpdateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public update(request: google.cloud.sql.v1.ISqlDatabasesUpdateRequest, callback: google.cloud.sql.v1.SqlDatabasesService.UpdateCallback): void; - - /** - * Calls Update. - * @param request SqlDatabasesUpdateRequest message or plain object - * @returns Promise - */ - public update(request: google.cloud.sql.v1.ISqlDatabasesUpdateRequest): Promise; - } - - namespace SqlDatabasesService { - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|delete_}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|get}. - * @param error Error, if any - * @param [response] Database - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.Database) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|insert}. - * @param error Error, if any - * @param [response] Operation - */ - type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|list}. - * @param error Error, if any - * @param [response] DatabasesListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.DatabasesListResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|patch}. - * @param error Error, if any - * @param [response] Operation - */ - type PatchCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|update}. - * @param error Error, if any - * @param [response] Operation - */ - type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - } - - /** Properties of a SqlDatabasesDeleteRequest. */ - interface ISqlDatabasesDeleteRequest { - - /** SqlDatabasesDeleteRequest database */ - database?: (string|null); - - /** SqlDatabasesDeleteRequest instance */ - instance?: (string|null); - - /** SqlDatabasesDeleteRequest project */ - project?: (string|null); - } - - /** Represents a SqlDatabasesDeleteRequest. */ - class SqlDatabasesDeleteRequest implements ISqlDatabasesDeleteRequest { - - /** - * Constructs a new SqlDatabasesDeleteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlDatabasesDeleteRequest); - - /** SqlDatabasesDeleteRequest database. */ - public database: string; - - /** SqlDatabasesDeleteRequest instance. */ - public instance: string; - - /** SqlDatabasesDeleteRequest project. */ - public project: string; - - /** - * Creates a new SqlDatabasesDeleteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlDatabasesDeleteRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlDatabasesDeleteRequest): google.cloud.sql.v1.SqlDatabasesDeleteRequest; - - /** - * Encodes the specified SqlDatabasesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesDeleteRequest.verify|verify} messages. - * @param message SqlDatabasesDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlDatabasesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlDatabasesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesDeleteRequest.verify|verify} messages. - * @param message SqlDatabasesDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlDatabasesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlDatabasesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlDatabasesDeleteRequest; - - /** - * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlDatabasesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlDatabasesDeleteRequest; - - /** - * Verifies a SqlDatabasesDeleteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlDatabasesDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlDatabasesDeleteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlDatabasesDeleteRequest; - - /** - * Creates a plain object from a SqlDatabasesDeleteRequest message. Also converts values to other types if specified. - * @param message SqlDatabasesDeleteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlDatabasesDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlDatabasesDeleteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlDatabasesDeleteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlDatabasesGetRequest. */ - interface ISqlDatabasesGetRequest { - - /** SqlDatabasesGetRequest database */ - database?: (string|null); - - /** SqlDatabasesGetRequest instance */ - instance?: (string|null); - - /** SqlDatabasesGetRequest project */ - project?: (string|null); - } - - /** Represents a SqlDatabasesGetRequest. */ - class SqlDatabasesGetRequest implements ISqlDatabasesGetRequest { - - /** - * Constructs a new SqlDatabasesGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlDatabasesGetRequest); - - /** SqlDatabasesGetRequest database. */ - public database: string; - - /** SqlDatabasesGetRequest instance. */ - public instance: string; - - /** SqlDatabasesGetRequest project. */ - public project: string; - - /** - * Creates a new SqlDatabasesGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlDatabasesGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlDatabasesGetRequest): google.cloud.sql.v1.SqlDatabasesGetRequest; - - /** - * Encodes the specified SqlDatabasesGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesGetRequest.verify|verify} messages. - * @param message SqlDatabasesGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlDatabasesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlDatabasesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesGetRequest.verify|verify} messages. - * @param message SqlDatabasesGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlDatabasesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlDatabasesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlDatabasesGetRequest; - - /** - * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlDatabasesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlDatabasesGetRequest; - - /** - * Verifies a SqlDatabasesGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlDatabasesGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlDatabasesGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlDatabasesGetRequest; - - /** - * Creates a plain object from a SqlDatabasesGetRequest message. Also converts values to other types if specified. - * @param message SqlDatabasesGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlDatabasesGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlDatabasesGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlDatabasesGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlDatabasesInsertRequest. */ - interface ISqlDatabasesInsertRequest { - - /** SqlDatabasesInsertRequest instance */ - instance?: (string|null); - - /** SqlDatabasesInsertRequest project */ - project?: (string|null); - - /** SqlDatabasesInsertRequest body */ - body?: (google.cloud.sql.v1.IDatabase|null); - } - - /** Represents a SqlDatabasesInsertRequest. */ - class SqlDatabasesInsertRequest implements ISqlDatabasesInsertRequest { - - /** - * Constructs a new SqlDatabasesInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlDatabasesInsertRequest); - - /** SqlDatabasesInsertRequest instance. */ - public instance: string; - - /** SqlDatabasesInsertRequest project. */ - public project: string; - - /** SqlDatabasesInsertRequest body. */ - public body?: (google.cloud.sql.v1.IDatabase|null); - - /** - * Creates a new SqlDatabasesInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlDatabasesInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlDatabasesInsertRequest): google.cloud.sql.v1.SqlDatabasesInsertRequest; - - /** - * Encodes the specified SqlDatabasesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesInsertRequest.verify|verify} messages. - * @param message SqlDatabasesInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlDatabasesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlDatabasesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesInsertRequest.verify|verify} messages. - * @param message SqlDatabasesInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlDatabasesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlDatabasesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlDatabasesInsertRequest; - - /** - * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlDatabasesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlDatabasesInsertRequest; - - /** - * Verifies a SqlDatabasesInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlDatabasesInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlDatabasesInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlDatabasesInsertRequest; - - /** - * Creates a plain object from a SqlDatabasesInsertRequest message. Also converts values to other types if specified. - * @param message SqlDatabasesInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlDatabasesInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlDatabasesInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlDatabasesInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlDatabasesListRequest. */ - interface ISqlDatabasesListRequest { - - /** SqlDatabasesListRequest instance */ - instance?: (string|null); - - /** SqlDatabasesListRequest project */ - project?: (string|null); - } - - /** Represents a SqlDatabasesListRequest. */ - class SqlDatabasesListRequest implements ISqlDatabasesListRequest { - - /** - * Constructs a new SqlDatabasesListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlDatabasesListRequest); - - /** SqlDatabasesListRequest instance. */ - public instance: string; - - /** SqlDatabasesListRequest project. */ - public project: string; - - /** - * Creates a new SqlDatabasesListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlDatabasesListRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlDatabasesListRequest): google.cloud.sql.v1.SqlDatabasesListRequest; - - /** - * Encodes the specified SqlDatabasesListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesListRequest.verify|verify} messages. - * @param message SqlDatabasesListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlDatabasesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlDatabasesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesListRequest.verify|verify} messages. - * @param message SqlDatabasesListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlDatabasesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlDatabasesListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlDatabasesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlDatabasesListRequest; - - /** - * Decodes a SqlDatabasesListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlDatabasesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlDatabasesListRequest; - - /** - * Verifies a SqlDatabasesListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlDatabasesListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlDatabasesListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlDatabasesListRequest; - - /** - * Creates a plain object from a SqlDatabasesListRequest message. Also converts values to other types if specified. - * @param message SqlDatabasesListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlDatabasesListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlDatabasesListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlDatabasesListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlDatabasesUpdateRequest. */ - interface ISqlDatabasesUpdateRequest { - - /** SqlDatabasesUpdateRequest database */ - database?: (string|null); - - /** SqlDatabasesUpdateRequest instance */ - instance?: (string|null); - - /** SqlDatabasesUpdateRequest project */ - project?: (string|null); - - /** SqlDatabasesUpdateRequest body */ - body?: (google.cloud.sql.v1.IDatabase|null); - } - - /** Represents a SqlDatabasesUpdateRequest. */ - class SqlDatabasesUpdateRequest implements ISqlDatabasesUpdateRequest { - - /** - * Constructs a new SqlDatabasesUpdateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlDatabasesUpdateRequest); - - /** SqlDatabasesUpdateRequest database. */ - public database: string; - - /** SqlDatabasesUpdateRequest instance. */ - public instance: string; - - /** SqlDatabasesUpdateRequest project. */ - public project: string; - - /** SqlDatabasesUpdateRequest body. */ - public body?: (google.cloud.sql.v1.IDatabase|null); - - /** - * Creates a new SqlDatabasesUpdateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlDatabasesUpdateRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlDatabasesUpdateRequest): google.cloud.sql.v1.SqlDatabasesUpdateRequest; - - /** - * Encodes the specified SqlDatabasesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesUpdateRequest.verify|verify} messages. - * @param message SqlDatabasesUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlDatabasesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlDatabasesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesUpdateRequest.verify|verify} messages. - * @param message SqlDatabasesUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlDatabasesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlDatabasesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlDatabasesUpdateRequest; - - /** - * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlDatabasesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlDatabasesUpdateRequest; - - /** - * Verifies a SqlDatabasesUpdateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlDatabasesUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlDatabasesUpdateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlDatabasesUpdateRequest; - - /** - * Creates a plain object from a SqlDatabasesUpdateRequest message. Also converts values to other types if specified. - * @param message SqlDatabasesUpdateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlDatabasesUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlDatabasesUpdateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlDatabasesUpdateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DatabasesListResponse. */ - interface IDatabasesListResponse { - - /** DatabasesListResponse kind */ - kind?: (string|null); - - /** DatabasesListResponse items */ - items?: (google.cloud.sql.v1.IDatabase[]|null); - } - - /** Represents a DatabasesListResponse. */ - class DatabasesListResponse implements IDatabasesListResponse { - - /** - * Constructs a new DatabasesListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IDatabasesListResponse); - - /** DatabasesListResponse kind. */ - public kind: string; - - /** DatabasesListResponse items. */ - public items: google.cloud.sql.v1.IDatabase[]; - - /** - * Creates a new DatabasesListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns DatabasesListResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IDatabasesListResponse): google.cloud.sql.v1.DatabasesListResponse; - - /** - * Encodes the specified DatabasesListResponse message. Does not implicitly {@link google.cloud.sql.v1.DatabasesListResponse.verify|verify} messages. - * @param message DatabasesListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IDatabasesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DatabasesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabasesListResponse.verify|verify} messages. - * @param message DatabasesListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IDatabasesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DatabasesListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DatabasesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.DatabasesListResponse; - - /** - * Decodes a DatabasesListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DatabasesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.DatabasesListResponse; - - /** - * Verifies a DatabasesListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DatabasesListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DatabasesListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.DatabasesListResponse; - - /** - * Creates a plain object from a DatabasesListResponse message. Also converts values to other types if specified. - * @param message DatabasesListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.DatabasesListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DatabasesListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DatabasesListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Represents a SqlEventsService */ - class SqlEventsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlEventsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlEventsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlEventsService; - } - - /** Represents a SqlFeatureEligibilityService */ - class SqlFeatureEligibilityService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlFeatureEligibilityService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlFeatureEligibilityService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlFeatureEligibilityService; - } - - /** Represents a SqlFlagsService */ - class SqlFlagsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlFlagsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlFlagsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlFlagsService; - - /** - * Calls List. - * @param request SqlFlagsListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and FlagsListResponse - */ - public list(request: google.cloud.sql.v1.ISqlFlagsListRequest, callback: google.cloud.sql.v1.SqlFlagsService.ListCallback): void; - - /** - * Calls List. - * @param request SqlFlagsListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1.ISqlFlagsListRequest): Promise; - } - - namespace SqlFlagsService { - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlFlagsService|list}. - * @param error Error, if any - * @param [response] FlagsListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.FlagsListResponse) => void; - } - - /** Properties of a SqlFlagsListRequest. */ - interface ISqlFlagsListRequest { - - /** SqlFlagsListRequest databaseVersion */ - databaseVersion?: (string|null); - - /** SqlFlagsListRequest flagScope */ - flagScope?: (google.cloud.sql.v1.SqlFlagScope|keyof typeof google.cloud.sql.v1.SqlFlagScope|null); - } - - /** Represents a SqlFlagsListRequest. */ - class SqlFlagsListRequest implements ISqlFlagsListRequest { - - /** - * Constructs a new SqlFlagsListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlFlagsListRequest); - - /** SqlFlagsListRequest databaseVersion. */ - public databaseVersion: string; - - /** SqlFlagsListRequest flagScope. */ - public flagScope?: (google.cloud.sql.v1.SqlFlagScope|keyof typeof google.cloud.sql.v1.SqlFlagScope|null); - - /** - * Creates a new SqlFlagsListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlFlagsListRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlFlagsListRequest): google.cloud.sql.v1.SqlFlagsListRequest; - - /** - * Encodes the specified SqlFlagsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlFlagsListRequest.verify|verify} messages. - * @param message SqlFlagsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlFlagsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlFlagsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlFlagsListRequest.verify|verify} messages. - * @param message SqlFlagsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlFlagsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlFlagsListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlFlagsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlFlagsListRequest; - - /** - * Decodes a SqlFlagsListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlFlagsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlFlagsListRequest; - - /** - * Verifies a SqlFlagsListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlFlagsListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlFlagsListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlFlagsListRequest; - - /** - * Creates a plain object from a SqlFlagsListRequest message. Also converts values to other types if specified. - * @param message SqlFlagsListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlFlagsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlFlagsListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlFlagsListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FlagsListResponse. */ - interface IFlagsListResponse { - - /** FlagsListResponse kind */ - kind?: (string|null); - - /** FlagsListResponse items */ - items?: (google.cloud.sql.v1.IFlag[]|null); - } - - /** Represents a FlagsListResponse. */ - class FlagsListResponse implements IFlagsListResponse { - - /** - * Constructs a new FlagsListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IFlagsListResponse); - - /** FlagsListResponse kind. */ - public kind: string; - - /** FlagsListResponse items. */ - public items: google.cloud.sql.v1.IFlag[]; - - /** - * Creates a new FlagsListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns FlagsListResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IFlagsListResponse): google.cloud.sql.v1.FlagsListResponse; - - /** - * Encodes the specified FlagsListResponse message. Does not implicitly {@link google.cloud.sql.v1.FlagsListResponse.verify|verify} messages. - * @param message FlagsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IFlagsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FlagsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FlagsListResponse.verify|verify} messages. - * @param message FlagsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IFlagsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FlagsListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FlagsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.FlagsListResponse; - - /** - * Decodes a FlagsListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FlagsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.FlagsListResponse; - - /** - * Verifies a FlagsListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FlagsListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FlagsListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.FlagsListResponse; - - /** - * Creates a plain object from a FlagsListResponse message. Also converts values to other types if specified. - * @param message FlagsListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.FlagsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FlagsListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FlagsListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Flag. */ - interface IFlag { - - /** Flag name */ - name?: (string|null); - - /** Flag type */ - type?: (google.cloud.sql.v1.SqlFlagType|keyof typeof google.cloud.sql.v1.SqlFlagType|null); - - /** Flag appliesTo */ - appliesTo?: (google.cloud.sql.v1.SqlDatabaseVersion[]|null); - - /** Flag allowedStringValues */ - allowedStringValues?: (string[]|null); - - /** Flag minValue */ - minValue?: (google.protobuf.IInt64Value|null); - - /** Flag maxValue */ - maxValue?: (google.protobuf.IInt64Value|null); - - /** Flag requiresRestart */ - requiresRestart?: (google.protobuf.IBoolValue|null); - - /** Flag kind */ - kind?: (string|null); - - /** Flag inBeta */ - inBeta?: (google.protobuf.IBoolValue|null); - - /** Flag allowedIntValues */ - allowedIntValues?: ((number|Long|string)[]|null); - - /** Flag flagScope */ - flagScope?: (google.cloud.sql.v1.SqlFlagScope|keyof typeof google.cloud.sql.v1.SqlFlagScope|null); - - /** Flag recommendedStringValue */ - recommendedStringValue?: (string|null); - - /** Flag recommendedIntValue */ - recommendedIntValue?: (google.protobuf.IInt64Value|null); - } - - /** Represents a Flag. */ - class Flag implements IFlag { - - /** - * Constructs a new Flag. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IFlag); - - /** Flag name. */ - public name: string; - - /** Flag type. */ - public type: (google.cloud.sql.v1.SqlFlagType|keyof typeof google.cloud.sql.v1.SqlFlagType); - - /** Flag appliesTo. */ - public appliesTo: google.cloud.sql.v1.SqlDatabaseVersion[]; - - /** Flag allowedStringValues. */ - public allowedStringValues: string[]; - - /** Flag minValue. */ - public minValue?: (google.protobuf.IInt64Value|null); - - /** Flag maxValue. */ - public maxValue?: (google.protobuf.IInt64Value|null); - - /** Flag requiresRestart. */ - public requiresRestart?: (google.protobuf.IBoolValue|null); - - /** Flag kind. */ - public kind: string; - - /** Flag inBeta. */ - public inBeta?: (google.protobuf.IBoolValue|null); - - /** Flag allowedIntValues. */ - public allowedIntValues: (number|Long|string)[]; - - /** Flag flagScope. */ - public flagScope: (google.cloud.sql.v1.SqlFlagScope|keyof typeof google.cloud.sql.v1.SqlFlagScope); - - /** Flag recommendedStringValue. */ - public recommendedStringValue?: (string|null); - - /** Flag recommendedIntValue. */ - public recommendedIntValue?: (google.protobuf.IInt64Value|null); - - /** Flag recommendedValue. */ - public recommendedValue?: ("recommendedStringValue"|"recommendedIntValue"); - - /** - * Creates a new Flag instance using the specified properties. - * @param [properties] Properties to set - * @returns Flag instance - */ - public static create(properties?: google.cloud.sql.v1.IFlag): google.cloud.sql.v1.Flag; - - /** - * Encodes the specified Flag message. Does not implicitly {@link google.cloud.sql.v1.Flag.verify|verify} messages. - * @param message Flag message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IFlag, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Flag message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Flag.verify|verify} messages. - * @param message Flag message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IFlag, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Flag message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Flag - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Flag; - - /** - * Decodes a Flag message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Flag - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Flag; - - /** - * Verifies a Flag message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Flag message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Flag - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Flag; - - /** - * Creates a plain object from a Flag message. Also converts values to other types if specified. - * @param message Flag - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.Flag, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Flag to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Flag - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlFlagType enum. */ - enum SqlFlagType { - SQL_FLAG_TYPE_UNSPECIFIED = 0, - BOOLEAN = 1, - STRING = 2, - INTEGER = 3, - NONE = 4, - MYSQL_TIMEZONE_OFFSET = 5, - FLOAT = 6, - REPEATED_STRING = 7 - } - - /** SqlFlagScope enum. */ - enum SqlFlagScope { - SQL_FLAG_SCOPE_UNSPECIFIED = 0, - SQL_FLAG_SCOPE_DATABASE = 1, - SQL_FLAG_SCOPE_CONNECTION_POOL = 2 - } - - /** Represents a SqlIamPoliciesService */ - class SqlIamPoliciesService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlIamPoliciesService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlIamPoliciesService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlIamPoliciesService; - } - - /** Represents a SqlInstanceNamesService */ - class SqlInstanceNamesService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlInstanceNamesService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlInstanceNamesService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlInstanceNamesService; - } - - /** Represents a SqlOperationsService */ - class SqlOperationsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlOperationsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlOperationsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlOperationsService; - - /** - * Calls Get. - * @param request SqlOperationsGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public get(request: google.cloud.sql.v1.ISqlOperationsGetRequest, callback: google.cloud.sql.v1.SqlOperationsService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlOperationsGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1.ISqlOperationsGetRequest): Promise; - - /** - * Calls List. - * @param request SqlOperationsListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and OperationsListResponse - */ - public list(request: google.cloud.sql.v1.ISqlOperationsListRequest, callback: google.cloud.sql.v1.SqlOperationsService.ListCallback): void; - - /** - * Calls List. - * @param request SqlOperationsListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1.ISqlOperationsListRequest): Promise; - - /** - * Calls Cancel. - * @param request SqlOperationsCancelRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public cancel(request: google.cloud.sql.v1.ISqlOperationsCancelRequest, callback: google.cloud.sql.v1.SqlOperationsService.CancelCallback): void; - - /** - * Calls Cancel. - * @param request SqlOperationsCancelRequest message or plain object - * @returns Promise - */ - public cancel(request: google.cloud.sql.v1.ISqlOperationsCancelRequest): Promise; - } - - namespace SqlOperationsService { - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|get}. - * @param error Error, if any - * @param [response] Operation - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|list}. - * @param error Error, if any - * @param [response] OperationsListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.OperationsListResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|cancel}. - * @param error Error, if any - * @param [response] Empty - */ - type CancelCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - } - - /** Properties of a SqlOperationsGetRequest. */ - interface ISqlOperationsGetRequest { - - /** SqlOperationsGetRequest operation */ - operation?: (string|null); - - /** SqlOperationsGetRequest project */ - project?: (string|null); - } - - /** Represents a SqlOperationsGetRequest. */ - class SqlOperationsGetRequest implements ISqlOperationsGetRequest { - - /** - * Constructs a new SqlOperationsGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlOperationsGetRequest); - - /** SqlOperationsGetRequest operation. */ - public operation: string; - - /** SqlOperationsGetRequest project. */ - public project: string; - - /** - * Creates a new SqlOperationsGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlOperationsGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlOperationsGetRequest): google.cloud.sql.v1.SqlOperationsGetRequest; - - /** - * Encodes the specified SqlOperationsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsGetRequest.verify|verify} messages. - * @param message SqlOperationsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlOperationsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlOperationsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsGetRequest.verify|verify} messages. - * @param message SqlOperationsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlOperationsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlOperationsGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlOperationsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlOperationsGetRequest; - - /** - * Decodes a SqlOperationsGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlOperationsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlOperationsGetRequest; - - /** - * Verifies a SqlOperationsGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlOperationsGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlOperationsGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlOperationsGetRequest; - - /** - * Creates a plain object from a SqlOperationsGetRequest message. Also converts values to other types if specified. - * @param message SqlOperationsGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlOperationsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlOperationsGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlOperationsGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlOperationsListRequest. */ - interface ISqlOperationsListRequest { - - /** SqlOperationsListRequest instance */ - instance?: (string|null); - - /** SqlOperationsListRequest maxResults */ - maxResults?: (number|null); - - /** SqlOperationsListRequest pageToken */ - pageToken?: (string|null); - - /** SqlOperationsListRequest project */ - project?: (string|null); - } - - /** Represents a SqlOperationsListRequest. */ - class SqlOperationsListRequest implements ISqlOperationsListRequest { - - /** - * Constructs a new SqlOperationsListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlOperationsListRequest); - - /** SqlOperationsListRequest instance. */ - public instance: string; - - /** SqlOperationsListRequest maxResults. */ - public maxResults: number; - - /** SqlOperationsListRequest pageToken. */ - public pageToken: string; - - /** SqlOperationsListRequest project. */ - public project: string; - - /** - * Creates a new SqlOperationsListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlOperationsListRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlOperationsListRequest): google.cloud.sql.v1.SqlOperationsListRequest; - - /** - * Encodes the specified SqlOperationsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsListRequest.verify|verify} messages. - * @param message SqlOperationsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlOperationsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlOperationsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsListRequest.verify|verify} messages. - * @param message SqlOperationsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlOperationsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlOperationsListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlOperationsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlOperationsListRequest; - - /** - * Decodes a SqlOperationsListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlOperationsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlOperationsListRequest; - - /** - * Verifies a SqlOperationsListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlOperationsListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlOperationsListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlOperationsListRequest; - - /** - * Creates a plain object from a SqlOperationsListRequest message. Also converts values to other types if specified. - * @param message SqlOperationsListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlOperationsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlOperationsListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlOperationsListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OperationsListResponse. */ - interface IOperationsListResponse { - - /** OperationsListResponse kind */ - kind?: (string|null); - - /** OperationsListResponse items */ - items?: (google.cloud.sql.v1.IOperation[]|null); - - /** OperationsListResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents an OperationsListResponse. */ - class OperationsListResponse implements IOperationsListResponse { - - /** - * Constructs a new OperationsListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IOperationsListResponse); - - /** OperationsListResponse kind. */ - public kind: string; - - /** OperationsListResponse items. */ - public items: google.cloud.sql.v1.IOperation[]; - - /** OperationsListResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new OperationsListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationsListResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IOperationsListResponse): google.cloud.sql.v1.OperationsListResponse; - - /** - * Encodes the specified OperationsListResponse message. Does not implicitly {@link google.cloud.sql.v1.OperationsListResponse.verify|verify} messages. - * @param message OperationsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IOperationsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationsListResponse.verify|verify} messages. - * @param message OperationsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IOperationsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OperationsListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OperationsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.OperationsListResponse; - - /** - * Decodes an OperationsListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OperationsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.OperationsListResponse; - - /** - * Verifies an OperationsListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OperationsListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationsListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.OperationsListResponse; - - /** - * Creates a plain object from an OperationsListResponse message. Also converts values to other types if specified. - * @param message OperationsListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.OperationsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationsListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationsListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlOperationsCancelRequest. */ - interface ISqlOperationsCancelRequest { - - /** SqlOperationsCancelRequest operation */ - operation?: (string|null); - - /** SqlOperationsCancelRequest project */ - project?: (string|null); - } - - /** Represents a SqlOperationsCancelRequest. */ - class SqlOperationsCancelRequest implements ISqlOperationsCancelRequest { - - /** - * Constructs a new SqlOperationsCancelRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlOperationsCancelRequest); - - /** SqlOperationsCancelRequest operation. */ - public operation: string; - - /** SqlOperationsCancelRequest project. */ - public project: string; - - /** - * Creates a new SqlOperationsCancelRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlOperationsCancelRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlOperationsCancelRequest): google.cloud.sql.v1.SqlOperationsCancelRequest; - - /** - * Encodes the specified SqlOperationsCancelRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsCancelRequest.verify|verify} messages. - * @param message SqlOperationsCancelRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlOperationsCancelRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlOperationsCancelRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsCancelRequest.verify|verify} messages. - * @param message SqlOperationsCancelRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlOperationsCancelRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlOperationsCancelRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlOperationsCancelRequest; - - /** - * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlOperationsCancelRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlOperationsCancelRequest; - - /** - * Verifies a SqlOperationsCancelRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlOperationsCancelRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlOperationsCancelRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlOperationsCancelRequest; - - /** - * Creates a plain object from a SqlOperationsCancelRequest message. Also converts values to other types if specified. - * @param message SqlOperationsCancelRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlOperationsCancelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlOperationsCancelRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlOperationsCancelRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Represents a SqlRegionsService */ - class SqlRegionsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlRegionsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlRegionsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlRegionsService; - } - - /** Represents a SqlSslCertsService */ - class SqlSslCertsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlSslCertsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlSslCertsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlSslCertsService; - - /** - * Calls Delete. - * @param request SqlSslCertsDeleteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public delete(request: google.cloud.sql.v1.ISqlSslCertsDeleteRequest, callback: google.cloud.sql.v1.SqlSslCertsService.DeleteCallback): void; - - /** - * Calls Delete. - * @param request SqlSslCertsDeleteRequest message or plain object - * @returns Promise - */ - public delete(request: google.cloud.sql.v1.ISqlSslCertsDeleteRequest): Promise; - - /** - * Calls Get. - * @param request SqlSslCertsGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SslCert - */ - public get(request: google.cloud.sql.v1.ISqlSslCertsGetRequest, callback: google.cloud.sql.v1.SqlSslCertsService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlSslCertsGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1.ISqlSslCertsGetRequest): Promise; - - /** - * Calls Insert. - * @param request SqlSslCertsInsertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SslCertsInsertResponse - */ - public insert(request: google.cloud.sql.v1.ISqlSslCertsInsertRequest, callback: google.cloud.sql.v1.SqlSslCertsService.InsertCallback): void; - - /** - * Calls Insert. - * @param request SqlSslCertsInsertRequest message or plain object - * @returns Promise - */ - public insert(request: google.cloud.sql.v1.ISqlSslCertsInsertRequest): Promise; - - /** - * Calls List. - * @param request SqlSslCertsListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SslCertsListResponse - */ - public list(request: google.cloud.sql.v1.ISqlSslCertsListRequest, callback: google.cloud.sql.v1.SqlSslCertsService.ListCallback): void; - - /** - * Calls List. - * @param request SqlSslCertsListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1.ISqlSslCertsListRequest): Promise; - } - - namespace SqlSslCertsService { - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|delete_}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|get}. - * @param error Error, if any - * @param [response] SslCert - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.SslCert) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|insert}. - * @param error Error, if any - * @param [response] SslCertsInsertResponse - */ - type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1.SslCertsInsertResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|list}. - * @param error Error, if any - * @param [response] SslCertsListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.SslCertsListResponse) => void; - } - - /** Properties of a SqlSslCertsDeleteRequest. */ - interface ISqlSslCertsDeleteRequest { - - /** SqlSslCertsDeleteRequest instance */ - instance?: (string|null); - - /** SqlSslCertsDeleteRequest project */ - project?: (string|null); - - /** SqlSslCertsDeleteRequest sha1Fingerprint */ - sha1Fingerprint?: (string|null); - } - - /** Represents a SqlSslCertsDeleteRequest. */ - class SqlSslCertsDeleteRequest implements ISqlSslCertsDeleteRequest { - - /** - * Constructs a new SqlSslCertsDeleteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlSslCertsDeleteRequest); - - /** SqlSslCertsDeleteRequest instance. */ - public instance: string; - - /** SqlSslCertsDeleteRequest project. */ - public project: string; - - /** SqlSslCertsDeleteRequest sha1Fingerprint. */ - public sha1Fingerprint: string; - - /** - * Creates a new SqlSslCertsDeleteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlSslCertsDeleteRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlSslCertsDeleteRequest): google.cloud.sql.v1.SqlSslCertsDeleteRequest; - - /** - * Encodes the specified SqlSslCertsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsDeleteRequest.verify|verify} messages. - * @param message SqlSslCertsDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlSslCertsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlSslCertsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsDeleteRequest.verify|verify} messages. - * @param message SqlSslCertsDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlSslCertsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlSslCertsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlSslCertsDeleteRequest; - - /** - * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlSslCertsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlSslCertsDeleteRequest; - - /** - * Verifies a SqlSslCertsDeleteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlSslCertsDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlSslCertsDeleteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlSslCertsDeleteRequest; - - /** - * Creates a plain object from a SqlSslCertsDeleteRequest message. Also converts values to other types if specified. - * @param message SqlSslCertsDeleteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlSslCertsDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlSslCertsDeleteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlSslCertsDeleteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlSslCertsGetRequest. */ - interface ISqlSslCertsGetRequest { - - /** SqlSslCertsGetRequest instance */ - instance?: (string|null); - - /** SqlSslCertsGetRequest project */ - project?: (string|null); - - /** SqlSslCertsGetRequest sha1Fingerprint */ - sha1Fingerprint?: (string|null); - } - - /** Represents a SqlSslCertsGetRequest. */ - class SqlSslCertsGetRequest implements ISqlSslCertsGetRequest { - - /** - * Constructs a new SqlSslCertsGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlSslCertsGetRequest); - - /** SqlSslCertsGetRequest instance. */ - public instance: string; - - /** SqlSslCertsGetRequest project. */ - public project: string; - - /** SqlSslCertsGetRequest sha1Fingerprint. */ - public sha1Fingerprint: string; - - /** - * Creates a new SqlSslCertsGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlSslCertsGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlSslCertsGetRequest): google.cloud.sql.v1.SqlSslCertsGetRequest; - - /** - * Encodes the specified SqlSslCertsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsGetRequest.verify|verify} messages. - * @param message SqlSslCertsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlSslCertsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlSslCertsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsGetRequest.verify|verify} messages. - * @param message SqlSslCertsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlSslCertsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlSslCertsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlSslCertsGetRequest; - - /** - * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlSslCertsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlSslCertsGetRequest; - - /** - * Verifies a SqlSslCertsGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlSslCertsGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlSslCertsGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlSslCertsGetRequest; - - /** - * Creates a plain object from a SqlSslCertsGetRequest message. Also converts values to other types if specified. - * @param message SqlSslCertsGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlSslCertsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlSslCertsGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlSslCertsGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlSslCertsInsertRequest. */ - interface ISqlSslCertsInsertRequest { - - /** SqlSslCertsInsertRequest instance */ - instance?: (string|null); - - /** SqlSslCertsInsertRequest project */ - project?: (string|null); - - /** SqlSslCertsInsertRequest body */ - body?: (google.cloud.sql.v1.ISslCertsInsertRequest|null); - } - - /** Represents a SqlSslCertsInsertRequest. */ - class SqlSslCertsInsertRequest implements ISqlSslCertsInsertRequest { - - /** - * Constructs a new SqlSslCertsInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlSslCertsInsertRequest); - - /** SqlSslCertsInsertRequest instance. */ - public instance: string; - - /** SqlSslCertsInsertRequest project. */ - public project: string; - - /** SqlSslCertsInsertRequest body. */ - public body?: (google.cloud.sql.v1.ISslCertsInsertRequest|null); - - /** - * Creates a new SqlSslCertsInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlSslCertsInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlSslCertsInsertRequest): google.cloud.sql.v1.SqlSslCertsInsertRequest; - - /** - * Encodes the specified SqlSslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsInsertRequest.verify|verify} messages. - * @param message SqlSslCertsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlSslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlSslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsInsertRequest.verify|verify} messages. - * @param message SqlSslCertsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlSslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlSslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlSslCertsInsertRequest; - - /** - * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlSslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlSslCertsInsertRequest; - - /** - * Verifies a SqlSslCertsInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlSslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlSslCertsInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlSslCertsInsertRequest; - - /** - * Creates a plain object from a SqlSslCertsInsertRequest message. Also converts values to other types if specified. - * @param message SqlSslCertsInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlSslCertsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlSslCertsInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlSslCertsInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlSslCertsListRequest. */ - interface ISqlSslCertsListRequest { - - /** SqlSslCertsListRequest instance */ - instance?: (string|null); - - /** SqlSslCertsListRequest project */ - project?: (string|null); - } - - /** Represents a SqlSslCertsListRequest. */ - class SqlSslCertsListRequest implements ISqlSslCertsListRequest { - - /** - * Constructs a new SqlSslCertsListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlSslCertsListRequest); - - /** SqlSslCertsListRequest instance. */ - public instance: string; - - /** SqlSslCertsListRequest project. */ - public project: string; - - /** - * Creates a new SqlSslCertsListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlSslCertsListRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlSslCertsListRequest): google.cloud.sql.v1.SqlSslCertsListRequest; - - /** - * Encodes the specified SqlSslCertsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsListRequest.verify|verify} messages. - * @param message SqlSslCertsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlSslCertsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlSslCertsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsListRequest.verify|verify} messages. - * @param message SqlSslCertsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlSslCertsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlSslCertsListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlSslCertsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlSslCertsListRequest; - - /** - * Decodes a SqlSslCertsListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlSslCertsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlSslCertsListRequest; - - /** - * Verifies a SqlSslCertsListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlSslCertsListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlSslCertsListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlSslCertsListRequest; - - /** - * Creates a plain object from a SqlSslCertsListRequest message. Also converts values to other types if specified. - * @param message SqlSslCertsListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlSslCertsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlSslCertsListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlSslCertsListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCertsInsertRequest. */ - interface ISslCertsInsertRequest { - - /** SslCertsInsertRequest commonName */ - commonName?: (string|null); - } - - /** Represents a SslCertsInsertRequest. */ - class SslCertsInsertRequest implements ISslCertsInsertRequest { - - /** - * Constructs a new SslCertsInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISslCertsInsertRequest); - - /** SslCertsInsertRequest commonName. */ - public commonName: string; - - /** - * Creates a new SslCertsInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCertsInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISslCertsInsertRequest): google.cloud.sql.v1.SslCertsInsertRequest; - - /** - * Encodes the specified SslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertRequest.verify|verify} messages. - * @param message SslCertsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertRequest.verify|verify} messages. - * @param message SslCertsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCertsInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCertsInsertRequest; - - /** - * Decodes a SslCertsInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCertsInsertRequest; - - /** - * Verifies a SslCertsInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCertsInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCertsInsertRequest; - - /** - * Creates a plain object from a SslCertsInsertRequest message. Also converts values to other types if specified. - * @param message SslCertsInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SslCertsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCertsInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCertsInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCertsInsertResponse. */ - interface ISslCertsInsertResponse { - - /** SslCertsInsertResponse kind */ - kind?: (string|null); - - /** SslCertsInsertResponse operation */ - operation?: (google.cloud.sql.v1.IOperation|null); - - /** SslCertsInsertResponse serverCaCert */ - serverCaCert?: (google.cloud.sql.v1.ISslCert|null); - - /** SslCertsInsertResponse clientCert */ - clientCert?: (google.cloud.sql.v1.ISslCertDetail|null); - } - - /** Represents a SslCertsInsertResponse. */ - class SslCertsInsertResponse implements ISslCertsInsertResponse { - - /** - * Constructs a new SslCertsInsertResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISslCertsInsertResponse); - - /** SslCertsInsertResponse kind. */ - public kind: string; - - /** SslCertsInsertResponse operation. */ - public operation?: (google.cloud.sql.v1.IOperation|null); - - /** SslCertsInsertResponse serverCaCert. */ - public serverCaCert?: (google.cloud.sql.v1.ISslCert|null); - - /** SslCertsInsertResponse clientCert. */ - public clientCert?: (google.cloud.sql.v1.ISslCertDetail|null); - - /** - * Creates a new SslCertsInsertResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCertsInsertResponse instance - */ - public static create(properties?: google.cloud.sql.v1.ISslCertsInsertResponse): google.cloud.sql.v1.SslCertsInsertResponse; - - /** - * Encodes the specified SslCertsInsertResponse message. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertResponse.verify|verify} messages. - * @param message SslCertsInsertResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISslCertsInsertResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCertsInsertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertResponse.verify|verify} messages. - * @param message SslCertsInsertResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISslCertsInsertResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCertsInsertResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCertsInsertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCertsInsertResponse; - - /** - * Decodes a SslCertsInsertResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCertsInsertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCertsInsertResponse; - - /** - * Verifies a SslCertsInsertResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCertsInsertResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCertsInsertResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCertsInsertResponse; - - /** - * Creates a plain object from a SslCertsInsertResponse message. Also converts values to other types if specified. - * @param message SslCertsInsertResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SslCertsInsertResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCertsInsertResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCertsInsertResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCertsListResponse. */ - interface ISslCertsListResponse { - - /** SslCertsListResponse kind */ - kind?: (string|null); - - /** SslCertsListResponse items */ - items?: (google.cloud.sql.v1.ISslCert[]|null); - } - - /** Represents a SslCertsListResponse. */ - class SslCertsListResponse implements ISslCertsListResponse { - - /** - * Constructs a new SslCertsListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISslCertsListResponse); - - /** SslCertsListResponse kind. */ - public kind: string; - - /** SslCertsListResponse items. */ - public items: google.cloud.sql.v1.ISslCert[]; - - /** - * Creates a new SslCertsListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCertsListResponse instance - */ - public static create(properties?: google.cloud.sql.v1.ISslCertsListResponse): google.cloud.sql.v1.SslCertsListResponse; - - /** - * Encodes the specified SslCertsListResponse message. Does not implicitly {@link google.cloud.sql.v1.SslCertsListResponse.verify|verify} messages. - * @param message SslCertsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISslCertsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCertsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsListResponse.verify|verify} messages. - * @param message SslCertsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISslCertsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCertsListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCertsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SslCertsListResponse; - - /** - * Decodes a SslCertsListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCertsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SslCertsListResponse; - - /** - * Verifies a SslCertsListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCertsListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCertsListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SslCertsListResponse; - - /** - * Creates a plain object from a SslCertsListResponse message. Also converts values to other types if specified. - * @param message SslCertsListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SslCertsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCertsListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCertsListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Represents a SqlTiersService */ - class SqlTiersService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlTiersService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlTiersService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlTiersService; - - /** - * Calls List. - * @param request SqlTiersListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and TiersListResponse - */ - public list(request: google.cloud.sql.v1.ISqlTiersListRequest, callback: google.cloud.sql.v1.SqlTiersService.ListCallback): void; - - /** - * Calls List. - * @param request SqlTiersListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1.ISqlTiersListRequest): Promise; - } - - namespace SqlTiersService { - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlTiersService|list}. - * @param error Error, if any - * @param [response] TiersListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.TiersListResponse) => void; - } - - /** Properties of a SqlTiersListRequest. */ - interface ISqlTiersListRequest { - - /** SqlTiersListRequest project */ - project?: (string|null); - } - - /** Represents a SqlTiersListRequest. */ - class SqlTiersListRequest implements ISqlTiersListRequest { - - /** - * Constructs a new SqlTiersListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlTiersListRequest); - - /** SqlTiersListRequest project. */ - public project: string; - - /** - * Creates a new SqlTiersListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlTiersListRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlTiersListRequest): google.cloud.sql.v1.SqlTiersListRequest; - - /** - * Encodes the specified SqlTiersListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlTiersListRequest.verify|verify} messages. - * @param message SqlTiersListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlTiersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlTiersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlTiersListRequest.verify|verify} messages. - * @param message SqlTiersListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlTiersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlTiersListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlTiersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlTiersListRequest; - - /** - * Decodes a SqlTiersListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlTiersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlTiersListRequest; - - /** - * Verifies a SqlTiersListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlTiersListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlTiersListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlTiersListRequest; - - /** - * Creates a plain object from a SqlTiersListRequest message. Also converts values to other types if specified. - * @param message SqlTiersListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlTiersListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlTiersListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlTiersListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TiersListResponse. */ - interface ITiersListResponse { - - /** TiersListResponse kind */ - kind?: (string|null); - - /** TiersListResponse items */ - items?: (google.cloud.sql.v1.ITier[]|null); - } - - /** Represents a TiersListResponse. */ - class TiersListResponse implements ITiersListResponse { - - /** - * Constructs a new TiersListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ITiersListResponse); - - /** TiersListResponse kind. */ - public kind: string; - - /** TiersListResponse items. */ - public items: google.cloud.sql.v1.ITier[]; - - /** - * Creates a new TiersListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns TiersListResponse instance - */ - public static create(properties?: google.cloud.sql.v1.ITiersListResponse): google.cloud.sql.v1.TiersListResponse; - - /** - * Encodes the specified TiersListResponse message. Does not implicitly {@link google.cloud.sql.v1.TiersListResponse.verify|verify} messages. - * @param message TiersListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ITiersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TiersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.TiersListResponse.verify|verify} messages. - * @param message TiersListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ITiersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TiersListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TiersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.TiersListResponse; - - /** - * Decodes a TiersListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TiersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.TiersListResponse; - - /** - * Verifies a TiersListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a TiersListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TiersListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.TiersListResponse; - - /** - * Creates a plain object from a TiersListResponse message. Also converts values to other types if specified. - * @param message TiersListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.TiersListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TiersListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TiersListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Tier. */ - interface ITier { - - /** Tier tier */ - tier?: (string|null); - - /** Tier RAM */ - RAM?: (number|Long|string|null); - - /** Tier kind */ - kind?: (string|null); - - /** Tier Disk_Quota */ - Disk_Quota?: (number|Long|string|null); - - /** Tier region */ - region?: (string[]|null); - } - - /** Represents a Tier. */ - class Tier implements ITier { - - /** - * Constructs a new Tier. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ITier); - - /** Tier tier. */ - public tier: string; - - /** Tier RAM. */ - public RAM: (number|Long|string); - - /** Tier kind. */ - public kind: string; - - /** Tier Disk_Quota. */ - public Disk_Quota: (number|Long|string); - - /** Tier region. */ - public region: string[]; - - /** - * Creates a new Tier instance using the specified properties. - * @param [properties] Properties to set - * @returns Tier instance - */ - public static create(properties?: google.cloud.sql.v1.ITier): google.cloud.sql.v1.Tier; - - /** - * Encodes the specified Tier message. Does not implicitly {@link google.cloud.sql.v1.Tier.verify|verify} messages. - * @param message Tier message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ITier, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Tier message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Tier.verify|verify} messages. - * @param message Tier message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ITier, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Tier message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Tier - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.Tier; - - /** - * Decodes a Tier message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Tier - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.Tier; - - /** - * Verifies a Tier message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Tier message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Tier - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.Tier; - - /** - * Creates a plain object from a Tier message. Also converts values to other types if specified. - * @param message Tier - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.Tier, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Tier to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Tier - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Represents a SqlUsersService */ - class SqlUsersService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlUsersService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlUsersService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlUsersService; - - /** - * Calls Delete. - * @param request SqlUsersDeleteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public delete(request: google.cloud.sql.v1.ISqlUsersDeleteRequest, callback: google.cloud.sql.v1.SqlUsersService.DeleteCallback): void; - - /** - * Calls Delete. - * @param request SqlUsersDeleteRequest message or plain object - * @returns Promise - */ - public delete(request: google.cloud.sql.v1.ISqlUsersDeleteRequest): Promise; - - /** - * Calls Get. - * @param request SqlUsersGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and User - */ - public get(request: google.cloud.sql.v1.ISqlUsersGetRequest, callback: google.cloud.sql.v1.SqlUsersService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlUsersGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1.ISqlUsersGetRequest): Promise; - - /** - * Calls Insert. - * @param request SqlUsersInsertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public insert(request: google.cloud.sql.v1.ISqlUsersInsertRequest, callback: google.cloud.sql.v1.SqlUsersService.InsertCallback): void; - - /** - * Calls Insert. - * @param request SqlUsersInsertRequest message or plain object - * @returns Promise - */ - public insert(request: google.cloud.sql.v1.ISqlUsersInsertRequest): Promise; - - /** - * Calls List. - * @param request SqlUsersListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and UsersListResponse - */ - public list(request: google.cloud.sql.v1.ISqlUsersListRequest, callback: google.cloud.sql.v1.SqlUsersService.ListCallback): void; - - /** - * Calls List. - * @param request SqlUsersListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1.ISqlUsersListRequest): Promise; - - /** - * Calls Update. - * @param request SqlUsersUpdateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public update(request: google.cloud.sql.v1.ISqlUsersUpdateRequest, callback: google.cloud.sql.v1.SqlUsersService.UpdateCallback): void; - - /** - * Calls Update. - * @param request SqlUsersUpdateRequest message or plain object - * @returns Promise - */ - public update(request: google.cloud.sql.v1.ISqlUsersUpdateRequest): Promise; - } - - namespace SqlUsersService { - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|delete_}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|get}. - * @param error Error, if any - * @param [response] User - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1.User) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|insert}. - * @param error Error, if any - * @param [response] Operation - */ - type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|list}. - * @param error Error, if any - * @param [response] UsersListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1.UsersListResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|update}. - * @param error Error, if any - * @param [response] Operation - */ - type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1.Operation) => void; - } - - /** Properties of a SqlUsersDeleteRequest. */ - interface ISqlUsersDeleteRequest { - - /** SqlUsersDeleteRequest host */ - host?: (string|null); - - /** SqlUsersDeleteRequest instance */ - instance?: (string|null); - - /** SqlUsersDeleteRequest name */ - name?: (string|null); - - /** SqlUsersDeleteRequest project */ - project?: (string|null); - } - - /** Represents a SqlUsersDeleteRequest. */ - class SqlUsersDeleteRequest implements ISqlUsersDeleteRequest { - - /** - * Constructs a new SqlUsersDeleteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlUsersDeleteRequest); - - /** SqlUsersDeleteRequest host. */ - public host: string; - - /** SqlUsersDeleteRequest instance. */ - public instance: string; - - /** SqlUsersDeleteRequest name. */ - public name: string; - - /** SqlUsersDeleteRequest project. */ - public project: string; - - /** - * Creates a new SqlUsersDeleteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlUsersDeleteRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlUsersDeleteRequest): google.cloud.sql.v1.SqlUsersDeleteRequest; - - /** - * Encodes the specified SqlUsersDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersDeleteRequest.verify|verify} messages. - * @param message SqlUsersDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlUsersDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlUsersDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersDeleteRequest.verify|verify} messages. - * @param message SqlUsersDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlUsersDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlUsersDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlUsersDeleteRequest; - - /** - * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlUsersDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlUsersDeleteRequest; - - /** - * Verifies a SqlUsersDeleteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlUsersDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlUsersDeleteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlUsersDeleteRequest; - - /** - * Creates a plain object from a SqlUsersDeleteRequest message. Also converts values to other types if specified. - * @param message SqlUsersDeleteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlUsersDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlUsersDeleteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlUsersDeleteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlUsersGetRequest. */ - interface ISqlUsersGetRequest { - - /** SqlUsersGetRequest instance */ - instance?: (string|null); - - /** SqlUsersGetRequest name */ - name?: (string|null); - - /** SqlUsersGetRequest project */ - project?: (string|null); - - /** SqlUsersGetRequest host */ - host?: (string|null); - } - - /** Represents a SqlUsersGetRequest. */ - class SqlUsersGetRequest implements ISqlUsersGetRequest { - - /** - * Constructs a new SqlUsersGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlUsersGetRequest); - - /** SqlUsersGetRequest instance. */ - public instance: string; - - /** SqlUsersGetRequest name. */ - public name: string; - - /** SqlUsersGetRequest project. */ - public project: string; - - /** SqlUsersGetRequest host. */ - public host: string; - - /** - * Creates a new SqlUsersGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlUsersGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlUsersGetRequest): google.cloud.sql.v1.SqlUsersGetRequest; - - /** - * Encodes the specified SqlUsersGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersGetRequest.verify|verify} messages. - * @param message SqlUsersGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlUsersGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlUsersGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersGetRequest.verify|verify} messages. - * @param message SqlUsersGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlUsersGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlUsersGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlUsersGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlUsersGetRequest; - - /** - * Decodes a SqlUsersGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlUsersGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlUsersGetRequest; - - /** - * Verifies a SqlUsersGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlUsersGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlUsersGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlUsersGetRequest; - - /** - * Creates a plain object from a SqlUsersGetRequest message. Also converts values to other types if specified. - * @param message SqlUsersGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlUsersGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlUsersGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlUsersGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlUsersInsertRequest. */ - interface ISqlUsersInsertRequest { - - /** SqlUsersInsertRequest instance */ - instance?: (string|null); - - /** SqlUsersInsertRequest project */ - project?: (string|null); - - /** SqlUsersInsertRequest body */ - body?: (google.cloud.sql.v1.IUser|null); - } - - /** Represents a SqlUsersInsertRequest. */ - class SqlUsersInsertRequest implements ISqlUsersInsertRequest { - - /** - * Constructs a new SqlUsersInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlUsersInsertRequest); - - /** SqlUsersInsertRequest instance. */ - public instance: string; - - /** SqlUsersInsertRequest project. */ - public project: string; - - /** SqlUsersInsertRequest body. */ - public body?: (google.cloud.sql.v1.IUser|null); - - /** - * Creates a new SqlUsersInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlUsersInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlUsersInsertRequest): google.cloud.sql.v1.SqlUsersInsertRequest; - - /** - * Encodes the specified SqlUsersInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersInsertRequest.verify|verify} messages. - * @param message SqlUsersInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlUsersInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlUsersInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersInsertRequest.verify|verify} messages. - * @param message SqlUsersInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlUsersInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlUsersInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlUsersInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlUsersInsertRequest; - - /** - * Decodes a SqlUsersInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlUsersInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlUsersInsertRequest; - - /** - * Verifies a SqlUsersInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlUsersInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlUsersInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlUsersInsertRequest; - - /** - * Creates a plain object from a SqlUsersInsertRequest message. Also converts values to other types if specified. - * @param message SqlUsersInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlUsersInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlUsersInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlUsersInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlUsersListRequest. */ - interface ISqlUsersListRequest { - - /** SqlUsersListRequest instance */ - instance?: (string|null); - - /** SqlUsersListRequest project */ - project?: (string|null); - } - - /** Represents a SqlUsersListRequest. */ - class SqlUsersListRequest implements ISqlUsersListRequest { - - /** - * Constructs a new SqlUsersListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlUsersListRequest); - - /** SqlUsersListRequest instance. */ - public instance: string; - - /** SqlUsersListRequest project. */ - public project: string; - - /** - * Creates a new SqlUsersListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlUsersListRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlUsersListRequest): google.cloud.sql.v1.SqlUsersListRequest; - - /** - * Encodes the specified SqlUsersListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersListRequest.verify|verify} messages. - * @param message SqlUsersListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlUsersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlUsersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersListRequest.verify|verify} messages. - * @param message SqlUsersListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlUsersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlUsersListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlUsersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlUsersListRequest; - - /** - * Decodes a SqlUsersListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlUsersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlUsersListRequest; - - /** - * Verifies a SqlUsersListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlUsersListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlUsersListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlUsersListRequest; - - /** - * Creates a plain object from a SqlUsersListRequest message. Also converts values to other types if specified. - * @param message SqlUsersListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlUsersListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlUsersListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlUsersListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlUsersUpdateRequest. */ - interface ISqlUsersUpdateRequest { - - /** SqlUsersUpdateRequest host */ - host?: (string|null); - - /** SqlUsersUpdateRequest instance */ - instance?: (string|null); - - /** SqlUsersUpdateRequest name */ - name?: (string|null); - - /** SqlUsersUpdateRequest project */ - project?: (string|null); - - /** SqlUsersUpdateRequest databaseRoles */ - databaseRoles?: (string[]|null); - - /** SqlUsersUpdateRequest revokeExistingRoles */ - revokeExistingRoles?: (boolean|null); - - /** SqlUsersUpdateRequest body */ - body?: (google.cloud.sql.v1.IUser|null); - } - - /** Represents a SqlUsersUpdateRequest. */ - class SqlUsersUpdateRequest implements ISqlUsersUpdateRequest { - - /** - * Constructs a new SqlUsersUpdateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlUsersUpdateRequest); - - /** SqlUsersUpdateRequest host. */ - public host: string; - - /** SqlUsersUpdateRequest instance. */ - public instance: string; - - /** SqlUsersUpdateRequest name. */ - public name: string; - - /** SqlUsersUpdateRequest project. */ - public project: string; - - /** SqlUsersUpdateRequest databaseRoles. */ - public databaseRoles: string[]; - - /** SqlUsersUpdateRequest revokeExistingRoles. */ - public revokeExistingRoles?: (boolean|null); - - /** SqlUsersUpdateRequest body. */ - public body?: (google.cloud.sql.v1.IUser|null); - - /** - * Creates a new SqlUsersUpdateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlUsersUpdateRequest instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlUsersUpdateRequest): google.cloud.sql.v1.SqlUsersUpdateRequest; - - /** - * Encodes the specified SqlUsersUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersUpdateRequest.verify|verify} messages. - * @param message SqlUsersUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlUsersUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlUsersUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersUpdateRequest.verify|verify} messages. - * @param message SqlUsersUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlUsersUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlUsersUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlUsersUpdateRequest; - - /** - * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlUsersUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlUsersUpdateRequest; - - /** - * Verifies a SqlUsersUpdateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlUsersUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlUsersUpdateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlUsersUpdateRequest; - - /** - * Creates a plain object from a SqlUsersUpdateRequest message. Also converts values to other types if specified. - * @param message SqlUsersUpdateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlUsersUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlUsersUpdateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlUsersUpdateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a UserPasswordValidationPolicy. */ - interface IUserPasswordValidationPolicy { - - /** UserPasswordValidationPolicy allowedFailedAttempts */ - allowedFailedAttempts?: (number|null); - - /** UserPasswordValidationPolicy passwordExpirationDuration */ - passwordExpirationDuration?: (google.protobuf.IDuration|null); - - /** UserPasswordValidationPolicy enableFailedAttemptsCheck */ - enableFailedAttemptsCheck?: (boolean|null); - - /** UserPasswordValidationPolicy status */ - status?: (google.cloud.sql.v1.IPasswordStatus|null); - - /** UserPasswordValidationPolicy enablePasswordVerification */ - enablePasswordVerification?: (boolean|null); - } - - /** Represents a UserPasswordValidationPolicy. */ - class UserPasswordValidationPolicy implements IUserPasswordValidationPolicy { - - /** - * Constructs a new UserPasswordValidationPolicy. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IUserPasswordValidationPolicy); - - /** UserPasswordValidationPolicy allowedFailedAttempts. */ - public allowedFailedAttempts: number; - - /** UserPasswordValidationPolicy passwordExpirationDuration. */ - public passwordExpirationDuration?: (google.protobuf.IDuration|null); - - /** UserPasswordValidationPolicy enableFailedAttemptsCheck. */ - public enableFailedAttemptsCheck: boolean; - - /** UserPasswordValidationPolicy status. */ - public status?: (google.cloud.sql.v1.IPasswordStatus|null); - - /** UserPasswordValidationPolicy enablePasswordVerification. */ - public enablePasswordVerification: boolean; - - /** - * Creates a new UserPasswordValidationPolicy instance using the specified properties. - * @param [properties] Properties to set - * @returns UserPasswordValidationPolicy instance - */ - public static create(properties?: google.cloud.sql.v1.IUserPasswordValidationPolicy): google.cloud.sql.v1.UserPasswordValidationPolicy; - - /** - * Encodes the specified UserPasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1.UserPasswordValidationPolicy.verify|verify} messages. - * @param message UserPasswordValidationPolicy message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IUserPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UserPasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UserPasswordValidationPolicy.verify|verify} messages. - * @param message UserPasswordValidationPolicy message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IUserPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UserPasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.UserPasswordValidationPolicy; - - /** - * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UserPasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.UserPasswordValidationPolicy; - - /** - * Verifies a UserPasswordValidationPolicy message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a UserPasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UserPasswordValidationPolicy - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.UserPasswordValidationPolicy; - - /** - * Creates a plain object from a UserPasswordValidationPolicy message. Also converts values to other types if specified. - * @param message UserPasswordValidationPolicy - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.UserPasswordValidationPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UserPasswordValidationPolicy to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UserPasswordValidationPolicy - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PasswordStatus. */ - interface IPasswordStatus { - - /** PasswordStatus locked */ - locked?: (boolean|null); - - /** PasswordStatus passwordExpirationTime */ - passwordExpirationTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a PasswordStatus. */ - class PasswordStatus implements IPasswordStatus { - - /** - * Constructs a new PasswordStatus. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IPasswordStatus); - - /** PasswordStatus locked. */ - public locked: boolean; - - /** PasswordStatus passwordExpirationTime. */ - public passwordExpirationTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new PasswordStatus instance using the specified properties. - * @param [properties] Properties to set - * @returns PasswordStatus instance - */ - public static create(properties?: google.cloud.sql.v1.IPasswordStatus): google.cloud.sql.v1.PasswordStatus; - - /** - * Encodes the specified PasswordStatus message. Does not implicitly {@link google.cloud.sql.v1.PasswordStatus.verify|verify} messages. - * @param message PasswordStatus message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IPasswordStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PasswordStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PasswordStatus.verify|verify} messages. - * @param message PasswordStatus message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IPasswordStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PasswordStatus message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PasswordStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.PasswordStatus; - - /** - * Decodes a PasswordStatus message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PasswordStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.PasswordStatus; - - /** - * Verifies a PasswordStatus message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PasswordStatus message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PasswordStatus - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.PasswordStatus; - - /** - * Creates a plain object from a PasswordStatus message. Also converts values to other types if specified. - * @param message PasswordStatus - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.PasswordStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PasswordStatus to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PasswordStatus - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a User. */ - interface IUser { - - /** User kind */ - kind?: (string|null); - - /** User password */ - password?: (string|null); - - /** User etag */ - etag?: (string|null); - - /** User name */ - name?: (string|null); - - /** User host */ - host?: (string|null); - - /** User instance */ - instance?: (string|null); - - /** User project */ - project?: (string|null); - - /** User type */ - type?: (google.cloud.sql.v1.User.SqlUserType|keyof typeof google.cloud.sql.v1.User.SqlUserType|null); - - /** User sqlserverUserDetails */ - sqlserverUserDetails?: (google.cloud.sql.v1.ISqlServerUserDetails|null); - - /** User iamEmail */ - iamEmail?: (string|null); - - /** User passwordPolicy */ - passwordPolicy?: (google.cloud.sql.v1.IUserPasswordValidationPolicy|null); - - /** User dualPasswordType */ - dualPasswordType?: (google.cloud.sql.v1.User.DualPasswordType|keyof typeof google.cloud.sql.v1.User.DualPasswordType|null); - - /** User iamStatus */ - iamStatus?: (google.cloud.sql.v1.User.IamStatus|keyof typeof google.cloud.sql.v1.User.IamStatus|null); - - /** User databaseRoles */ - databaseRoles?: (string[]|null); - } - - /** Represents a User. */ - class User implements IUser { - - /** - * Constructs a new User. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IUser); - - /** User kind. */ - public kind: string; - - /** User password. */ - public password: string; - - /** User etag. */ - public etag: string; - - /** User name. */ - public name: string; - - /** User host. */ - public host: string; - - /** User instance. */ - public instance: string; - - /** User project. */ - public project: string; - - /** User type. */ - public type: (google.cloud.sql.v1.User.SqlUserType|keyof typeof google.cloud.sql.v1.User.SqlUserType); - - /** User sqlserverUserDetails. */ - public sqlserverUserDetails?: (google.cloud.sql.v1.ISqlServerUserDetails|null); - - /** User iamEmail. */ - public iamEmail: string; - - /** User passwordPolicy. */ - public passwordPolicy?: (google.cloud.sql.v1.IUserPasswordValidationPolicy|null); - - /** User dualPasswordType. */ - public dualPasswordType?: (google.cloud.sql.v1.User.DualPasswordType|keyof typeof google.cloud.sql.v1.User.DualPasswordType|null); - - /** User iamStatus. */ - public iamStatus?: (google.cloud.sql.v1.User.IamStatus|keyof typeof google.cloud.sql.v1.User.IamStatus|null); - - /** User databaseRoles. */ - public databaseRoles: string[]; - - /** User userDetails. */ - public userDetails?: "sqlserverUserDetails"; - - /** - * Creates a new User instance using the specified properties. - * @param [properties] Properties to set - * @returns User instance - */ - public static create(properties?: google.cloud.sql.v1.IUser): google.cloud.sql.v1.User; - - /** - * Encodes the specified User message. Does not implicitly {@link google.cloud.sql.v1.User.verify|verify} messages. - * @param message User message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IUser, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified User message, length delimited. Does not implicitly {@link google.cloud.sql.v1.User.verify|verify} messages. - * @param message User message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IUser, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a User message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns User - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.User; - - /** - * Decodes a User message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns User - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.User; - - /** - * Verifies a User message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a User message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns User - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.User; - - /** - * Creates a plain object from a User message. Also converts values to other types if specified. - * @param message User - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.User, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this User to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for User - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace User { - - /** SqlUserType enum. */ - enum SqlUserType { - BUILT_IN = 0, - CLOUD_IAM_USER = 1, - CLOUD_IAM_SERVICE_ACCOUNT = 2, - CLOUD_IAM_GROUP = 3, - CLOUD_IAM_GROUP_USER = 4, - CLOUD_IAM_GROUP_SERVICE_ACCOUNT = 5, - ENTRAID_USER = 7 - } - - /** DualPasswordType enum. */ - enum DualPasswordType { - DUAL_PASSWORD_TYPE_UNSPECIFIED = 0, - NO_MODIFY_DUAL_PASSWORD = 1, - NO_DUAL_PASSWORD = 2, - DUAL_PASSWORD = 3 - } - - /** IamStatus enum. */ - enum IamStatus { - IAM_STATUS_UNSPECIFIED = 0, - INACTIVE = 1, - ACTIVE = 2 - } - } - - /** Properties of a SqlServerUserDetails. */ - interface ISqlServerUserDetails { - - /** SqlServerUserDetails disabled */ - disabled?: (boolean|null); - - /** SqlServerUserDetails serverRoles */ - serverRoles?: (string[]|null); - } - - /** Represents a SqlServerUserDetails. */ - class SqlServerUserDetails implements ISqlServerUserDetails { - - /** - * Constructs a new SqlServerUserDetails. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.ISqlServerUserDetails); - - /** SqlServerUserDetails disabled. */ - public disabled: boolean; - - /** SqlServerUserDetails serverRoles. */ - public serverRoles: string[]; - - /** - * Creates a new SqlServerUserDetails instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlServerUserDetails instance - */ - public static create(properties?: google.cloud.sql.v1.ISqlServerUserDetails): google.cloud.sql.v1.SqlServerUserDetails; - - /** - * Encodes the specified SqlServerUserDetails message. Does not implicitly {@link google.cloud.sql.v1.SqlServerUserDetails.verify|verify} messages. - * @param message SqlServerUserDetails message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.ISqlServerUserDetails, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlServerUserDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerUserDetails.verify|verify} messages. - * @param message SqlServerUserDetails message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.ISqlServerUserDetails, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlServerUserDetails message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlServerUserDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.SqlServerUserDetails; - - /** - * Decodes a SqlServerUserDetails message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlServerUserDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.SqlServerUserDetails; - - /** - * Verifies a SqlServerUserDetails message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlServerUserDetails message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlServerUserDetails - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.SqlServerUserDetails; - - /** - * Creates a plain object from a SqlServerUserDetails message. Also converts values to other types if specified. - * @param message SqlServerUserDetails - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.SqlServerUserDetails, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlServerUserDetails to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlServerUserDetails - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a UsersListResponse. */ - interface IUsersListResponse { - - /** UsersListResponse kind */ - kind?: (string|null); - - /** UsersListResponse items */ - items?: (google.cloud.sql.v1.IUser[]|null); - - /** UsersListResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a UsersListResponse. */ - class UsersListResponse implements IUsersListResponse { - - /** - * Constructs a new UsersListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1.IUsersListResponse); - - /** UsersListResponse kind. */ - public kind: string; - - /** UsersListResponse items. */ - public items: google.cloud.sql.v1.IUser[]; - - /** UsersListResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new UsersListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns UsersListResponse instance - */ - public static create(properties?: google.cloud.sql.v1.IUsersListResponse): google.cloud.sql.v1.UsersListResponse; - - /** - * Encodes the specified UsersListResponse message. Does not implicitly {@link google.cloud.sql.v1.UsersListResponse.verify|verify} messages. - * @param message UsersListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1.IUsersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UsersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UsersListResponse.verify|verify} messages. - * @param message UsersListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1.IUsersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a UsersListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UsersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1.UsersListResponse; - - /** - * Decodes a UsersListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UsersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1.UsersListResponse; - - /** - * Verifies a UsersListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a UsersListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UsersListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1.UsersListResponse; - - /** - * Creates a plain object from a UsersListResponse message. Also converts values to other types if specified. - * @param message UsersListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1.UsersListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UsersListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UsersListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Namespace v1beta4. */ - namespace v1beta4 { - - /** Represents a SqlBackupRunsService */ - class SqlBackupRunsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlBackupRunsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlBackupRunsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlBackupRunsService; - - /** - * Calls Delete. - * @param request SqlBackupRunsDeleteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public delete(request: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, callback: google.cloud.sql.v1beta4.SqlBackupRunsService.DeleteCallback): void; - - /** - * Calls Delete. - * @param request SqlBackupRunsDeleteRequest message or plain object - * @returns Promise - */ - public delete(request: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest): Promise; - - /** - * Calls Get. - * @param request SqlBackupRunsGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and BackupRun - */ - public get(request: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, callback: google.cloud.sql.v1beta4.SqlBackupRunsService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlBackupRunsGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest): Promise; - - /** - * Calls Insert. - * @param request SqlBackupRunsInsertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public insert(request: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, callback: google.cloud.sql.v1beta4.SqlBackupRunsService.InsertCallback): void; - - /** - * Calls Insert. - * @param request SqlBackupRunsInsertRequest message or plain object - * @returns Promise - */ - public insert(request: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest): Promise; - - /** - * Calls List. - * @param request SqlBackupRunsListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and BackupRunsListResponse - */ - public list(request: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, callback: google.cloud.sql.v1beta4.SqlBackupRunsService.ListCallback): void; - - /** - * Calls List. - * @param request SqlBackupRunsListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest): Promise; - } - - namespace SqlBackupRunsService { - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|delete_}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|get}. - * @param error Error, if any - * @param [response] BackupRun - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.BackupRun) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|insert}. - * @param error Error, if any - * @param [response] Operation - */ - type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|list}. - * @param error Error, if any - * @param [response] BackupRunsListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.BackupRunsListResponse) => void; - } - - /** Represents a SqlDatabasesService */ - class SqlDatabasesService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlDatabasesService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlDatabasesService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlDatabasesService; - - /** - * Calls Delete. - * @param request SqlDatabasesDeleteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public delete(request: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.DeleteCallback): void; - - /** - * Calls Delete. - * @param request SqlDatabasesDeleteRequest message or plain object - * @returns Promise - */ - public delete(request: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest): Promise; - - /** - * Calls Get. - * @param request SqlDatabasesGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Database - */ - public get(request: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlDatabasesGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest): Promise; - - /** - * Calls Insert. - * @param request SqlDatabasesInsertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public insert(request: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.InsertCallback): void; - - /** - * Calls Insert. - * @param request SqlDatabasesInsertRequest message or plain object - * @returns Promise - */ - public insert(request: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest): Promise; - - /** - * Calls List. - * @param request SqlDatabasesListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and DatabasesListResponse - */ - public list(request: google.cloud.sql.v1beta4.ISqlDatabasesListRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.ListCallback): void; - - /** - * Calls List. - * @param request SqlDatabasesListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1beta4.ISqlDatabasesListRequest): Promise; - - /** - * Calls Patch. - * @param request SqlDatabasesUpdateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public patch(request: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.PatchCallback): void; - - /** - * Calls Patch. - * @param request SqlDatabasesUpdateRequest message or plain object - * @returns Promise - */ - public patch(request: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest): Promise; - - /** - * Calls Update. - * @param request SqlDatabasesUpdateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public update(request: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, callback: google.cloud.sql.v1beta4.SqlDatabasesService.UpdateCallback): void; - - /** - * Calls Update. - * @param request SqlDatabasesUpdateRequest message or plain object - * @returns Promise - */ - public update(request: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest): Promise; - } - - namespace SqlDatabasesService { - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|delete_}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|get}. - * @param error Error, if any - * @param [response] Database - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Database) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|insert}. - * @param error Error, if any - * @param [response] Operation - */ - type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|list}. - * @param error Error, if any - * @param [response] DatabasesListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.DatabasesListResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|patch}. - * @param error Error, if any - * @param [response] Operation - */ - type PatchCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|update}. - * @param error Error, if any - * @param [response] Operation - */ - type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - } - - /** Represents a SqlFlagsService */ - class SqlFlagsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlFlagsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlFlagsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlFlagsService; - - /** - * Calls List. - * @param request SqlFlagsListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and FlagsListResponse - */ - public list(request: google.cloud.sql.v1beta4.ISqlFlagsListRequest, callback: google.cloud.sql.v1beta4.SqlFlagsService.ListCallback): void; - - /** - * Calls List. - * @param request SqlFlagsListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1beta4.ISqlFlagsListRequest): Promise; - } - - namespace SqlFlagsService { - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlFlagsService|list}. - * @param error Error, if any - * @param [response] FlagsListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.FlagsListResponse) => void; - } - - /** Represents a SqlInstancesService */ - class SqlInstancesService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlInstancesService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlInstancesService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlInstancesService; - - /** - * Calls AddServerCa. - * @param request SqlInstancesAddServerCaRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public addServerCa(request: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.AddServerCaCallback): void; - - /** - * Calls AddServerCa. - * @param request SqlInstancesAddServerCaRequest message or plain object - * @returns Promise - */ - public addServerCa(request: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest): Promise; - - /** - * Calls AddServerCertificate. - * @param request SqlInstancesAddServerCertificateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public addServerCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.AddServerCertificateCallback): void; - - /** - * Calls AddServerCertificate. - * @param request SqlInstancesAddServerCertificateRequest message or plain object - * @returns Promise - */ - public addServerCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest): Promise; - - /** - * Calls AddEntraIdCertificate. - * @param request SqlInstancesAddEntraIdCertificateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public addEntraIdCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.AddEntraIdCertificateCallback): void; - - /** - * Calls AddEntraIdCertificate. - * @param request SqlInstancesAddEntraIdCertificateRequest message or plain object - * @returns Promise - */ - public addEntraIdCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest): Promise; - - /** - * Calls Clone. - * @param request SqlInstancesCloneRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public clone(request: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.CloneCallback): void; - - /** - * Calls Clone. - * @param request SqlInstancesCloneRequest message or plain object - * @returns Promise - */ - public clone(request: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest): Promise; - - /** - * Calls Delete. - * @param request SqlInstancesDeleteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public delete(request: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.DeleteCallback): void; - - /** - * Calls Delete. - * @param request SqlInstancesDeleteRequest message or plain object - * @returns Promise - */ - public delete(request: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest): Promise; - - /** - * Calls DemoteMaster. - * @param request SqlInstancesDemoteMasterRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public demoteMaster(request: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.DemoteMasterCallback): void; - - /** - * Calls DemoteMaster. - * @param request SqlInstancesDemoteMasterRequest message or plain object - * @returns Promise - */ - public demoteMaster(request: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest): Promise; - - /** - * Calls Demote. - * @param request SqlInstancesDemoteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public demote(request: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.DemoteCallback): void; - - /** - * Calls Demote. - * @param request SqlInstancesDemoteRequest message or plain object - * @returns Promise - */ - public demote(request: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest): Promise; - - /** - * Calls Export. - * @param request SqlInstancesExportRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public export(request: google.cloud.sql.v1beta4.ISqlInstancesExportRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ExportCallback): void; - - /** - * Calls Export. - * @param request SqlInstancesExportRequest message or plain object - * @returns Promise - */ - public export(request: google.cloud.sql.v1beta4.ISqlInstancesExportRequest): Promise; - - /** - * Calls Failover. - * @param request SqlInstancesFailoverRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public failover(request: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.FailoverCallback): void; - - /** - * Calls Failover. - * @param request SqlInstancesFailoverRequest message or plain object - * @returns Promise - */ - public failover(request: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest): Promise; - - /** - * Calls Reencrypt. - * @param request SqlInstancesReencryptRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public reencrypt(request: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ReencryptCallback): void; - - /** - * Calls Reencrypt. - * @param request SqlInstancesReencryptRequest message or plain object - * @returns Promise - */ - public reencrypt(request: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest): Promise; - - /** - * Calls Get. - * @param request SqlInstancesGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and DatabaseInstance - */ - public get(request: google.cloud.sql.v1beta4.ISqlInstancesGetRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlInstancesGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1beta4.ISqlInstancesGetRequest): Promise; - - /** - * Calls Import. - * @param request SqlInstancesImportRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public import(request: google.cloud.sql.v1beta4.ISqlInstancesImportRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ImportCallback): void; - - /** - * Calls Import. - * @param request SqlInstancesImportRequest message or plain object - * @returns Promise - */ - public import(request: google.cloud.sql.v1beta4.ISqlInstancesImportRequest): Promise; - - /** - * Calls Insert. - * @param request SqlInstancesInsertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public insert(request: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.InsertCallback): void; - - /** - * Calls Insert. - * @param request SqlInstancesInsertRequest message or plain object - * @returns Promise - */ - public insert(request: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest): Promise; - - /** - * Calls List. - * @param request SqlInstancesListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and InstancesListResponse - */ - public list(request: google.cloud.sql.v1beta4.ISqlInstancesListRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ListCallback): void; - - /** - * Calls List. - * @param request SqlInstancesListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1beta4.ISqlInstancesListRequest): Promise; - - /** - * Calls ListServerCas. - * @param request SqlInstancesListServerCasRequest message or plain object - * @param callback Node-style callback called with the error, if any, and InstancesListServerCasResponse - */ - public listServerCas(request: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ListServerCasCallback): void; - - /** - * Calls ListServerCas. - * @param request SqlInstancesListServerCasRequest message or plain object - * @returns Promise - */ - public listServerCas(request: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest): Promise; - - /** - * Calls ListServerCertificates. - * @param request SqlInstancesListServerCertificatesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and InstancesListServerCertificatesResponse - */ - public listServerCertificates(request: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ListServerCertificatesCallback): void; - - /** - * Calls ListServerCertificates. - * @param request SqlInstancesListServerCertificatesRequest message or plain object - * @returns Promise - */ - public listServerCertificates(request: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest): Promise; - - /** - * Calls ListEntraIdCertificates. - * @param request SqlInstancesListEntraIdCertificatesRequest message or plain object - * @param callback Node-style callback called with the error, if any, and InstancesListEntraIdCertificatesResponse - */ - public listEntraIdCertificates(request: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ListEntraIdCertificatesCallback): void; - - /** - * Calls ListEntraIdCertificates. - * @param request SqlInstancesListEntraIdCertificatesRequest message or plain object - * @returns Promise - */ - public listEntraIdCertificates(request: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest): Promise; - - /** - * Calls Patch. - * @param request SqlInstancesPatchRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public patch(request: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.PatchCallback): void; - - /** - * Calls Patch. - * @param request SqlInstancesPatchRequest message or plain object - * @returns Promise - */ - public patch(request: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest): Promise; - - /** - * Calls PromoteReplica. - * @param request SqlInstancesPromoteReplicaRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public promoteReplica(request: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.PromoteReplicaCallback): void; - - /** - * Calls PromoteReplica. - * @param request SqlInstancesPromoteReplicaRequest message or plain object - * @returns Promise - */ - public promoteReplica(request: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest): Promise; - - /** - * Calls Switchover. - * @param request SqlInstancesSwitchoverRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public switchover(request: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.SwitchoverCallback): void; - - /** - * Calls Switchover. - * @param request SqlInstancesSwitchoverRequest message or plain object - * @returns Promise - */ - public switchover(request: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest): Promise; - - /** - * Calls ResetSslConfig. - * @param request SqlInstancesResetSslConfigRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public resetSslConfig(request: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ResetSslConfigCallback): void; - - /** - * Calls ResetSslConfig. - * @param request SqlInstancesResetSslConfigRequest message or plain object - * @returns Promise - */ - public resetSslConfig(request: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest): Promise; - - /** - * Calls Restart. - * @param request SqlInstancesRestartRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public restart(request: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RestartCallback): void; - - /** - * Calls Restart. - * @param request SqlInstancesRestartRequest message or plain object - * @returns Promise - */ - public restart(request: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest): Promise; - - /** - * Calls RestoreBackup. - * @param request SqlInstancesRestoreBackupRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public restoreBackup(request: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RestoreBackupCallback): void; - - /** - * Calls RestoreBackup. - * @param request SqlInstancesRestoreBackupRequest message or plain object - * @returns Promise - */ - public restoreBackup(request: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest): Promise; - - /** - * Calls RotateServerCa. - * @param request SqlInstancesRotateServerCaRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public rotateServerCa(request: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCaCallback): void; - - /** - * Calls RotateServerCa. - * @param request SqlInstancesRotateServerCaRequest message or plain object - * @returns Promise - */ - public rotateServerCa(request: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest): Promise; - - /** - * Calls RotateServerCertificate. - * @param request SqlInstancesRotateServerCertificateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public rotateServerCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCertificateCallback): void; - - /** - * Calls RotateServerCertificate. - * @param request SqlInstancesRotateServerCertificateRequest message or plain object - * @returns Promise - */ - public rotateServerCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest): Promise; - - /** - * Calls RotateEntraIdCertificate. - * @param request SqlInstancesRotateEntraIdCertificateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public rotateEntraIdCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RotateEntraIdCertificateCallback): void; - - /** - * Calls RotateEntraIdCertificate. - * @param request SqlInstancesRotateEntraIdCertificateRequest message or plain object - * @returns Promise - */ - public rotateEntraIdCertificate(request: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest): Promise; - - /** - * Calls StartReplica. - * @param request SqlInstancesStartReplicaRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public startReplica(request: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.StartReplicaCallback): void; - - /** - * Calls StartReplica. - * @param request SqlInstancesStartReplicaRequest message or plain object - * @returns Promise - */ - public startReplica(request: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest): Promise; - - /** - * Calls StopReplica. - * @param request SqlInstancesStopReplicaRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public stopReplica(request: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.StopReplicaCallback): void; - - /** - * Calls StopReplica. - * @param request SqlInstancesStopReplicaRequest message or plain object - * @returns Promise - */ - public stopReplica(request: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest): Promise; - - /** - * Calls TruncateLog. - * @param request SqlInstancesTruncateLogRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public truncateLog(request: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.TruncateLogCallback): void; - - /** - * Calls TruncateLog. - * @param request SqlInstancesTruncateLogRequest message or plain object - * @returns Promise - */ - public truncateLog(request: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest): Promise; - - /** - * Calls Update. - * @param request SqlInstancesUpdateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public update(request: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.UpdateCallback): void; - - /** - * Calls Update. - * @param request SqlInstancesUpdateRequest message or plain object - * @returns Promise - */ - public update(request: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest): Promise; - - /** - * Calls CreateEphemeral. - * @param request SqlInstancesCreateEphemeralCertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SslCert - */ - public createEphemeral(request: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.CreateEphemeralCallback): void; - - /** - * Calls CreateEphemeral. - * @param request SqlInstancesCreateEphemeralCertRequest message or plain object - * @returns Promise - */ - public createEphemeral(request: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest): Promise; - - /** - * Calls RescheduleMaintenance. - * @param request SqlInstancesRescheduleMaintenanceRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public rescheduleMaintenance(request: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.RescheduleMaintenanceCallback): void; - - /** - * Calls RescheduleMaintenance. - * @param request SqlInstancesRescheduleMaintenanceRequest message or plain object - * @returns Promise - */ - public rescheduleMaintenance(request: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest): Promise; - - /** - * Calls VerifyExternalSyncSettings. - * @param request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesVerifyExternalSyncSettingsResponse - */ - public verifyExternalSyncSettings(request: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.VerifyExternalSyncSettingsCallback): void; - - /** - * Calls VerifyExternalSyncSettings. - * @param request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object - * @returns Promise - */ - public verifyExternalSyncSettings(request: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest): Promise; - - /** - * Calls StartExternalSync. - * @param request SqlInstancesStartExternalSyncRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public startExternalSync(request: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.StartExternalSyncCallback): void; - - /** - * Calls StartExternalSync. - * @param request SqlInstancesStartExternalSyncRequest message or plain object - * @returns Promise - */ - public startExternalSync(request: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest): Promise; - - /** - * Calls PerformDiskShrink. - * @param request SqlInstancesPerformDiskShrinkRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public performDiskShrink(request: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.PerformDiskShrinkCallback): void; - - /** - * Calls PerformDiskShrink. - * @param request SqlInstancesPerformDiskShrinkRequest message or plain object - * @returns Promise - */ - public performDiskShrink(request: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest): Promise; - - /** - * Calls GetDiskShrinkConfig. - * @param request SqlInstancesGetDiskShrinkConfigRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesGetDiskShrinkConfigResponse - */ - public getDiskShrinkConfig(request: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.GetDiskShrinkConfigCallback): void; - - /** - * Calls GetDiskShrinkConfig. - * @param request SqlInstancesGetDiskShrinkConfigRequest message or plain object - * @returns Promise - */ - public getDiskShrinkConfig(request: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest): Promise; - - /** - * Calls ResetReplicaSize. - * @param request SqlInstancesResetReplicaSizeRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public resetReplicaSize(request: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ResetReplicaSizeCallback): void; - - /** - * Calls ResetReplicaSize. - * @param request SqlInstancesResetReplicaSizeRequest message or plain object - * @returns Promise - */ - public resetReplicaSize(request: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest): Promise; - - /** - * Calls GetLatestRecoveryTime. - * @param request SqlInstancesGetLatestRecoveryTimeRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesGetLatestRecoveryTimeResponse - */ - public getLatestRecoveryTime(request: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.GetLatestRecoveryTimeCallback): void; - - /** - * Calls GetLatestRecoveryTime. - * @param request SqlInstancesGetLatestRecoveryTimeRequest message or plain object - * @returns Promise - */ - public getLatestRecoveryTime(request: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest): Promise; - - /** - * Calls ExecuteSql. - * @param request SqlInstancesExecuteSqlRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesExecuteSqlResponse - */ - public executeSql(request: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ExecuteSqlCallback): void; - - /** - * Calls ExecuteSql. - * @param request SqlInstancesExecuteSqlRequest message or plain object - * @returns Promise - */ - public executeSql(request: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest): Promise; - - /** - * Calls AcquireSsrsLease. - * @param request SqlInstancesAcquireSsrsLeaseRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesAcquireSsrsLeaseResponse - */ - public acquireSsrsLease(request: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.AcquireSsrsLeaseCallback): void; - - /** - * Calls AcquireSsrsLease. - * @param request SqlInstancesAcquireSsrsLeaseRequest message or plain object - * @returns Promise - */ - public acquireSsrsLease(request: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest): Promise; - - /** - * Calls ReleaseSsrsLease. - * @param request SqlInstancesReleaseSsrsLeaseRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SqlInstancesReleaseSsrsLeaseResponse - */ - public releaseSsrsLease(request: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.ReleaseSsrsLeaseCallback): void; - - /** - * Calls ReleaseSsrsLease. - * @param request SqlInstancesReleaseSsrsLeaseRequest message or plain object - * @returns Promise - */ - public releaseSsrsLease(request: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest): Promise; - - /** - * Calls PreCheckMajorVersionUpgrade. - * @param request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public preCheckMajorVersionUpgrade(request: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.PreCheckMajorVersionUpgradeCallback): void; - - /** - * Calls PreCheckMajorVersionUpgrade. - * @param request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object - * @returns Promise - */ - public preCheckMajorVersionUpgrade(request: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest): Promise; - - /** - * Calls PointInTimeRestore. - * @param request SqlInstancesPointInTimeRestoreRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public pointInTimeRestore(request: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, callback: google.cloud.sql.v1beta4.SqlInstancesService.PointInTimeRestoreCallback): void; - - /** - * Calls PointInTimeRestore. - * @param request SqlInstancesPointInTimeRestoreRequest message or plain object - * @returns Promise - */ - public pointInTimeRestore(request: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest): Promise; - } - - namespace SqlInstancesService { - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addServerCa}. - * @param error Error, if any - * @param [response] Operation - */ - type AddServerCaCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addServerCertificate}. - * @param error Error, if any - * @param [response] Operation - */ - type AddServerCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addEntraIdCertificate}. - * @param error Error, if any - * @param [response] Operation - */ - type AddEntraIdCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|clone}. - * @param error Error, if any - * @param [response] Operation - */ - type CloneCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|delete_}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|demoteMaster}. - * @param error Error, if any - * @param [response] Operation - */ - type DemoteMasterCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|demote}. - * @param error Error, if any - * @param [response] Operation - */ - type DemoteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|export_}. - * @param error Error, if any - * @param [response] Operation - */ - type ExportCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|failover}. - * @param error Error, if any - * @param [response] Operation - */ - type FailoverCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|reencrypt}. - * @param error Error, if any - * @param [response] Operation - */ - type ReencryptCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|get}. - * @param error Error, if any - * @param [response] DatabaseInstance - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.DatabaseInstance) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|import_}. - * @param error Error, if any - * @param [response] Operation - */ - type ImportCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|insert}. - * @param error Error, if any - * @param [response] Operation - */ - type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|list}. - * @param error Error, if any - * @param [response] InstancesListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.InstancesListResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listServerCas}. - * @param error Error, if any - * @param [response] InstancesListServerCasResponse - */ - type ListServerCasCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.InstancesListServerCasResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listServerCertificates}. - * @param error Error, if any - * @param [response] InstancesListServerCertificatesResponse - */ - type ListServerCertificatesCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listEntraIdCertificates}. - * @param error Error, if any - * @param [response] InstancesListEntraIdCertificatesResponse - */ - type ListEntraIdCertificatesCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|patch}. - * @param error Error, if any - * @param [response] Operation - */ - type PatchCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|promoteReplica}. - * @param error Error, if any - * @param [response] Operation - */ - type PromoteReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|switchover}. - * @param error Error, if any - * @param [response] Operation - */ - type SwitchoverCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|resetSslConfig}. - * @param error Error, if any - * @param [response] Operation - */ - type ResetSslConfigCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|restart}. - * @param error Error, if any - * @param [response] Operation - */ - type RestartCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|restoreBackup}. - * @param error Error, if any - * @param [response] Operation - */ - type RestoreBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateServerCa}. - * @param error Error, if any - * @param [response] Operation - */ - type RotateServerCaCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateServerCertificate}. - * @param error Error, if any - * @param [response] Operation - */ - type RotateServerCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateEntraIdCertificate}. - * @param error Error, if any - * @param [response] Operation - */ - type RotateEntraIdCertificateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|startReplica}. - * @param error Error, if any - * @param [response] Operation - */ - type StartReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|stopReplica}. - * @param error Error, if any - * @param [response] Operation - */ - type StopReplicaCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|truncateLog}. - * @param error Error, if any - * @param [response] Operation - */ - type TruncateLogCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|update}. - * @param error Error, if any - * @param [response] Operation - */ - type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|createEphemeral}. - * @param error Error, if any - * @param [response] SslCert - */ - type CreateEphemeralCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SslCert) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rescheduleMaintenance}. - * @param error Error, if any - * @param [response] Operation - */ - type RescheduleMaintenanceCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|verifyExternalSyncSettings}. - * @param error Error, if any - * @param [response] SqlInstancesVerifyExternalSyncSettingsResponse - */ - type VerifyExternalSyncSettingsCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|startExternalSync}. - * @param error Error, if any - * @param [response] Operation - */ - type StartExternalSyncCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|performDiskShrink}. - * @param error Error, if any - * @param [response] Operation - */ - type PerformDiskShrinkCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|getDiskShrinkConfig}. - * @param error Error, if any - * @param [response] SqlInstancesGetDiskShrinkConfigResponse - */ - type GetDiskShrinkConfigCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|resetReplicaSize}. - * @param error Error, if any - * @param [response] Operation - */ - type ResetReplicaSizeCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|getLatestRecoveryTime}. - * @param error Error, if any - * @param [response] SqlInstancesGetLatestRecoveryTimeResponse - */ - type GetLatestRecoveryTimeCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|executeSql}. - * @param error Error, if any - * @param [response] SqlInstancesExecuteSqlResponse - */ - type ExecuteSqlCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|acquireSsrsLease}. - * @param error Error, if any - * @param [response] SqlInstancesAcquireSsrsLeaseResponse - */ - type AcquireSsrsLeaseCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|releaseSsrsLease}. - * @param error Error, if any - * @param [response] SqlInstancesReleaseSsrsLeaseResponse - */ - type ReleaseSsrsLeaseCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|preCheckMajorVersionUpgrade}. - * @param error Error, if any - * @param [response] Operation - */ - type PreCheckMajorVersionUpgradeCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|pointInTimeRestore}. - * @param error Error, if any - * @param [response] Operation - */ - type PointInTimeRestoreCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - } - - /** Represents a SqlOperationsService */ - class SqlOperationsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlOperationsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlOperationsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlOperationsService; - - /** - * Calls Get. - * @param request SqlOperationsGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public get(request: google.cloud.sql.v1beta4.ISqlOperationsGetRequest, callback: google.cloud.sql.v1beta4.SqlOperationsService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlOperationsGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1beta4.ISqlOperationsGetRequest): Promise; - - /** - * Calls List. - * @param request SqlOperationsListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and OperationsListResponse - */ - public list(request: google.cloud.sql.v1beta4.ISqlOperationsListRequest, callback: google.cloud.sql.v1beta4.SqlOperationsService.ListCallback): void; - - /** - * Calls List. - * @param request SqlOperationsListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1beta4.ISqlOperationsListRequest): Promise; - - /** - * Calls Cancel. - * @param request SqlOperationsCancelRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Empty - */ - public cancel(request: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, callback: google.cloud.sql.v1beta4.SqlOperationsService.CancelCallback): void; - - /** - * Calls Cancel. - * @param request SqlOperationsCancelRequest message or plain object - * @returns Promise - */ - public cancel(request: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest): Promise; - } - - namespace SqlOperationsService { - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|get}. - * @param error Error, if any - * @param [response] Operation - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|list}. - * @param error Error, if any - * @param [response] OperationsListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.OperationsListResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|cancel}. - * @param error Error, if any - * @param [response] Empty - */ - type CancelCallback = (error: (Error|null), response?: google.protobuf.Empty) => void; - } - - /** Represents a SqlSslCertsService */ - class SqlSslCertsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlSslCertsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlSslCertsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlSslCertsService; - - /** - * Calls Delete. - * @param request SqlSslCertsDeleteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public delete(request: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, callback: google.cloud.sql.v1beta4.SqlSslCertsService.DeleteCallback): void; - - /** - * Calls Delete. - * @param request SqlSslCertsDeleteRequest message or plain object - * @returns Promise - */ - public delete(request: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest): Promise; - - /** - * Calls Get. - * @param request SqlSslCertsGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SslCert - */ - public get(request: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, callback: google.cloud.sql.v1beta4.SqlSslCertsService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlSslCertsGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest): Promise; - - /** - * Calls Insert. - * @param request SqlSslCertsInsertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SslCertsInsertResponse - */ - public insert(request: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, callback: google.cloud.sql.v1beta4.SqlSslCertsService.InsertCallback): void; - - /** - * Calls Insert. - * @param request SqlSslCertsInsertRequest message or plain object - * @returns Promise - */ - public insert(request: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest): Promise; - - /** - * Calls List. - * @param request SqlSslCertsListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and SslCertsListResponse - */ - public list(request: google.cloud.sql.v1beta4.ISqlSslCertsListRequest, callback: google.cloud.sql.v1beta4.SqlSslCertsService.ListCallback): void; - - /** - * Calls List. - * @param request SqlSslCertsListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1beta4.ISqlSslCertsListRequest): Promise; - } - - namespace SqlSslCertsService { - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|delete_}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|get}. - * @param error Error, if any - * @param [response] SslCert - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SslCert) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|insert}. - * @param error Error, if any - * @param [response] SslCertsInsertResponse - */ - type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SslCertsInsertResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|list}. - * @param error Error, if any - * @param [response] SslCertsListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.SslCertsListResponse) => void; - } - - /** Represents a SqlBackupsService */ - class SqlBackupsService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlBackupsService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlBackupsService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlBackupsService; - - /** - * Calls CreateBackup. - * @param request CreateBackupRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public createBackup(request: google.cloud.sql.v1beta4.ICreateBackupRequest, callback: google.cloud.sql.v1beta4.SqlBackupsService.CreateBackupCallback): void; - - /** - * Calls CreateBackup. - * @param request CreateBackupRequest message or plain object - * @returns Promise - */ - public createBackup(request: google.cloud.sql.v1beta4.ICreateBackupRequest): Promise; - - /** - * Calls GetBackup. - * @param request GetBackupRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Backup - */ - public getBackup(request: google.cloud.sql.v1beta4.IGetBackupRequest, callback: google.cloud.sql.v1beta4.SqlBackupsService.GetBackupCallback): void; - - /** - * Calls GetBackup. - * @param request GetBackupRequest message or plain object - * @returns Promise - */ - public getBackup(request: google.cloud.sql.v1beta4.IGetBackupRequest): Promise; - - /** - * Calls ListBackups. - * @param request ListBackupsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ListBackupsResponse - */ - public listBackups(request: google.cloud.sql.v1beta4.IListBackupsRequest, callback: google.cloud.sql.v1beta4.SqlBackupsService.ListBackupsCallback): void; - - /** - * Calls ListBackups. - * @param request ListBackupsRequest message or plain object - * @returns Promise - */ - public listBackups(request: google.cloud.sql.v1beta4.IListBackupsRequest): Promise; - - /** - * Calls UpdateBackup. - * @param request UpdateBackupRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public updateBackup(request: google.cloud.sql.v1beta4.IUpdateBackupRequest, callback: google.cloud.sql.v1beta4.SqlBackupsService.UpdateBackupCallback): void; - - /** - * Calls UpdateBackup. - * @param request UpdateBackupRequest message or plain object - * @returns Promise - */ - public updateBackup(request: google.cloud.sql.v1beta4.IUpdateBackupRequest): Promise; - - /** - * Calls DeleteBackup. - * @param request DeleteBackupRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public deleteBackup(request: google.cloud.sql.v1beta4.IDeleteBackupRequest, callback: google.cloud.sql.v1beta4.SqlBackupsService.DeleteBackupCallback): void; - - /** - * Calls DeleteBackup. - * @param request DeleteBackupRequest message or plain object - * @returns Promise - */ - public deleteBackup(request: google.cloud.sql.v1beta4.IDeleteBackupRequest): Promise; - } - - namespace SqlBackupsService { - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|createBackup}. - * @param error Error, if any - * @param [response] Operation - */ - type CreateBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|getBackup}. - * @param error Error, if any - * @param [response] Backup - */ - type GetBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Backup) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|listBackups}. - * @param error Error, if any - * @param [response] ListBackupsResponse - */ - type ListBackupsCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.ListBackupsResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|updateBackup}. - * @param error Error, if any - * @param [response] Operation - */ - type UpdateBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|deleteBackup}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteBackupCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - } - - /** Properties of a CreateBackupRequest. */ - interface ICreateBackupRequest { - - /** CreateBackupRequest parent */ - parent?: (string|null); - - /** CreateBackupRequest backup */ - backup?: (google.cloud.sql.v1beta4.IBackup|null); - } - - /** Represents a CreateBackupRequest. */ - class CreateBackupRequest implements ICreateBackupRequest { - - /** - * Constructs a new CreateBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ICreateBackupRequest); - - /** CreateBackupRequest parent. */ - public parent: string; - - /** CreateBackupRequest backup. */ - public backup?: (google.cloud.sql.v1beta4.IBackup|null); - - /** - * Creates a new CreateBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns CreateBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ICreateBackupRequest): google.cloud.sql.v1beta4.CreateBackupRequest; - - /** - * Encodes the specified CreateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.CreateBackupRequest.verify|verify} messages. - * @param message CreateBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ICreateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CreateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.CreateBackupRequest.verify|verify} messages. - * @param message CreateBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ICreateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CreateBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CreateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.CreateBackupRequest; - - /** - * Decodes a CreateBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CreateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.CreateBackupRequest; - - /** - * Verifies a CreateBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CreateBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CreateBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.CreateBackupRequest; - - /** - * Creates a plain object from a CreateBackupRequest message. Also converts values to other types if specified. - * @param message CreateBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.CreateBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CreateBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CreateBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GetBackupRequest. */ - interface IGetBackupRequest { - - /** GetBackupRequest name */ - name?: (string|null); - } - - /** Represents a GetBackupRequest. */ - class GetBackupRequest implements IGetBackupRequest { - - /** - * Constructs a new GetBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IGetBackupRequest); - - /** GetBackupRequest name. */ - public name: string; - - /** - * Creates a new GetBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IGetBackupRequest): google.cloud.sql.v1beta4.GetBackupRequest; - - /** - * Encodes the specified GetBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GetBackupRequest.verify|verify} messages. - * @param message GetBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IGetBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GetBackupRequest.verify|verify} messages. - * @param message GetBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IGetBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.GetBackupRequest; - - /** - * Decodes a GetBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.GetBackupRequest; - - /** - * Verifies a GetBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GetBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.GetBackupRequest; - - /** - * Creates a plain object from a GetBackupRequest message. Also converts values to other types if specified. - * @param message GetBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.GetBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListBackupsRequest. */ - interface IListBackupsRequest { - - /** ListBackupsRequest parent */ - parent?: (string|null); - - /** ListBackupsRequest pageSize */ - pageSize?: (number|null); - - /** ListBackupsRequest pageToken */ - pageToken?: (string|null); - - /** ListBackupsRequest filter */ - filter?: (string|null); - } - - /** Represents a ListBackupsRequest. */ - class ListBackupsRequest implements IListBackupsRequest { - - /** - * Constructs a new ListBackupsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IListBackupsRequest); - - /** ListBackupsRequest parent. */ - public parent: string; - - /** ListBackupsRequest pageSize. */ - public pageSize: number; - - /** ListBackupsRequest pageToken. */ - public pageToken: string; - - /** ListBackupsRequest filter. */ - public filter: string; - - /** - * Creates a new ListBackupsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns ListBackupsRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IListBackupsRequest): google.cloud.sql.v1beta4.ListBackupsRequest; - - /** - * Encodes the specified ListBackupsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsRequest.verify|verify} messages. - * @param message ListBackupsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IListBackupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListBackupsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsRequest.verify|verify} messages. - * @param message ListBackupsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IListBackupsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListBackupsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListBackupsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ListBackupsRequest; - - /** - * Decodes a ListBackupsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListBackupsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ListBackupsRequest; - - /** - * Verifies a ListBackupsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ListBackupsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListBackupsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ListBackupsRequest; - - /** - * Creates a plain object from a ListBackupsRequest message. Also converts values to other types if specified. - * @param message ListBackupsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ListBackupsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListBackupsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListBackupsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ListBackupsResponse. */ - interface IListBackupsResponse { - - /** ListBackupsResponse backups */ - backups?: (google.cloud.sql.v1beta4.IBackup[]|null); - - /** ListBackupsResponse nextPageToken */ - nextPageToken?: (string|null); - - /** ListBackupsResponse warnings */ - warnings?: (google.cloud.sql.v1beta4.IApiWarning[]|null); - } - - /** Represents a ListBackupsResponse. */ - class ListBackupsResponse implements IListBackupsResponse { - - /** - * Constructs a new ListBackupsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IListBackupsResponse); - - /** ListBackupsResponse backups. */ - public backups: google.cloud.sql.v1beta4.IBackup[]; - - /** ListBackupsResponse nextPageToken. */ - public nextPageToken: string; - - /** ListBackupsResponse warnings. */ - public warnings: google.cloud.sql.v1beta4.IApiWarning[]; - - /** - * Creates a new ListBackupsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns ListBackupsResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IListBackupsResponse): google.cloud.sql.v1beta4.ListBackupsResponse; - - /** - * Encodes the specified ListBackupsResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsResponse.verify|verify} messages. - * @param message ListBackupsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IListBackupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ListBackupsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsResponse.verify|verify} messages. - * @param message ListBackupsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IListBackupsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ListBackupsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ListBackupsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ListBackupsResponse; - - /** - * Decodes a ListBackupsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ListBackupsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ListBackupsResponse; - - /** - * Verifies a ListBackupsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ListBackupsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ListBackupsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ListBackupsResponse; - - /** - * Creates a plain object from a ListBackupsResponse message. Also converts values to other types if specified. - * @param message ListBackupsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ListBackupsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ListBackupsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ListBackupsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an UpdateBackupRequest. */ - interface IUpdateBackupRequest { - - /** UpdateBackupRequest backup */ - backup?: (google.cloud.sql.v1beta4.IBackup|null); - - /** UpdateBackupRequest updateMask */ - updateMask?: (google.protobuf.IFieldMask|null); - } - - /** Represents an UpdateBackupRequest. */ - class UpdateBackupRequest implements IUpdateBackupRequest { - - /** - * Constructs a new UpdateBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IUpdateBackupRequest); - - /** UpdateBackupRequest backup. */ - public backup?: (google.cloud.sql.v1beta4.IBackup|null); - - /** UpdateBackupRequest updateMask. */ - public updateMask?: (google.protobuf.IFieldMask|null); - - /** - * Creates a new UpdateBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns UpdateBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IUpdateBackupRequest): google.cloud.sql.v1beta4.UpdateBackupRequest; - - /** - * Encodes the specified UpdateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.UpdateBackupRequest.verify|verify} messages. - * @param message UpdateBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IUpdateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UpdateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UpdateBackupRequest.verify|verify} messages. - * @param message UpdateBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IUpdateBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an UpdateBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UpdateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.UpdateBackupRequest; - - /** - * Decodes an UpdateBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UpdateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.UpdateBackupRequest; - - /** - * Verifies an UpdateBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an UpdateBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UpdateBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.UpdateBackupRequest; - - /** - * Creates a plain object from an UpdateBackupRequest message. Also converts values to other types if specified. - * @param message UpdateBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.UpdateBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UpdateBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UpdateBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DeleteBackupRequest. */ - interface IDeleteBackupRequest { - - /** DeleteBackupRequest name */ - name?: (string|null); - } - - /** Represents a DeleteBackupRequest. */ - class DeleteBackupRequest implements IDeleteBackupRequest { - - /** - * Constructs a new DeleteBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDeleteBackupRequest); - - /** DeleteBackupRequest name. */ - public name: string; - - /** - * Creates a new DeleteBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns DeleteBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDeleteBackupRequest): google.cloud.sql.v1beta4.DeleteBackupRequest; - - /** - * Encodes the specified DeleteBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.DeleteBackupRequest.verify|verify} messages. - * @param message DeleteBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDeleteBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DeleteBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DeleteBackupRequest.verify|verify} messages. - * @param message DeleteBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDeleteBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DeleteBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DeleteBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DeleteBackupRequest; - - /** - * Decodes a DeleteBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DeleteBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DeleteBackupRequest; - - /** - * Verifies a DeleteBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DeleteBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DeleteBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DeleteBackupRequest; - - /** - * Creates a plain object from a DeleteBackupRequest message. Also converts values to other types if specified. - * @param message DeleteBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DeleteBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DeleteBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DeleteBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlBackupRunsDeleteRequest. */ - interface ISqlBackupRunsDeleteRequest { - - /** SqlBackupRunsDeleteRequest id */ - id?: (number|Long|string|null); - - /** SqlBackupRunsDeleteRequest instance */ - instance?: (string|null); - - /** SqlBackupRunsDeleteRequest project */ - project?: (string|null); - } - - /** Represents a SqlBackupRunsDeleteRequest. */ - class SqlBackupRunsDeleteRequest implements ISqlBackupRunsDeleteRequest { - - /** - * Constructs a new SqlBackupRunsDeleteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest); - - /** SqlBackupRunsDeleteRequest id. */ - public id: (number|Long|string); - - /** SqlBackupRunsDeleteRequest instance. */ - public instance: string; - - /** SqlBackupRunsDeleteRequest project. */ - public project: string; - - /** - * Creates a new SqlBackupRunsDeleteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBackupRunsDeleteRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest): google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest; - - /** - * Encodes the specified SqlBackupRunsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest.verify|verify} messages. - * @param message SqlBackupRunsDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBackupRunsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest.verify|verify} messages. - * @param message SqlBackupRunsDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBackupRunsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest; - - /** - * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBackupRunsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest; - - /** - * Verifies a SqlBackupRunsDeleteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBackupRunsDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBackupRunsDeleteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest; - - /** - * Creates a plain object from a SqlBackupRunsDeleteRequest message. Also converts values to other types if specified. - * @param message SqlBackupRunsDeleteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBackupRunsDeleteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBackupRunsDeleteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlBackupRunsGetRequest. */ - interface ISqlBackupRunsGetRequest { - - /** SqlBackupRunsGetRequest id */ - id?: (number|Long|string|null); - - /** SqlBackupRunsGetRequest instance */ - instance?: (string|null); - - /** SqlBackupRunsGetRequest project */ - project?: (string|null); - } - - /** Represents a SqlBackupRunsGetRequest. */ - class SqlBackupRunsGetRequest implements ISqlBackupRunsGetRequest { - - /** - * Constructs a new SqlBackupRunsGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest); - - /** SqlBackupRunsGetRequest id. */ - public id: (number|Long|string); - - /** SqlBackupRunsGetRequest instance. */ - public instance: string; - - /** SqlBackupRunsGetRequest project. */ - public project: string; - - /** - * Creates a new SqlBackupRunsGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBackupRunsGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest): google.cloud.sql.v1beta4.SqlBackupRunsGetRequest; - - /** - * Encodes the specified SqlBackupRunsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsGetRequest.verify|verify} messages. - * @param message SqlBackupRunsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBackupRunsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsGetRequest.verify|verify} messages. - * @param message SqlBackupRunsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBackupRunsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlBackupRunsGetRequest; - - /** - * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBackupRunsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlBackupRunsGetRequest; - - /** - * Verifies a SqlBackupRunsGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBackupRunsGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBackupRunsGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlBackupRunsGetRequest; - - /** - * Creates a plain object from a SqlBackupRunsGetRequest message. Also converts values to other types if specified. - * @param message SqlBackupRunsGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlBackupRunsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBackupRunsGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBackupRunsGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlBackupRunsInsertRequest. */ - interface ISqlBackupRunsInsertRequest { - - /** SqlBackupRunsInsertRequest instance */ - instance?: (string|null); - - /** SqlBackupRunsInsertRequest project */ - project?: (string|null); - - /** SqlBackupRunsInsertRequest body */ - body?: (google.cloud.sql.v1beta4.IBackupRun|null); - } - - /** Represents a SqlBackupRunsInsertRequest. */ - class SqlBackupRunsInsertRequest implements ISqlBackupRunsInsertRequest { - - /** - * Constructs a new SqlBackupRunsInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest); - - /** SqlBackupRunsInsertRequest instance. */ - public instance: string; - - /** SqlBackupRunsInsertRequest project. */ - public project: string; - - /** SqlBackupRunsInsertRequest body. */ - public body?: (google.cloud.sql.v1beta4.IBackupRun|null); - - /** - * Creates a new SqlBackupRunsInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBackupRunsInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest): google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest; - - /** - * Encodes the specified SqlBackupRunsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest.verify|verify} messages. - * @param message SqlBackupRunsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBackupRunsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest.verify|verify} messages. - * @param message SqlBackupRunsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBackupRunsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest; - - /** - * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBackupRunsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest; - - /** - * Verifies a SqlBackupRunsInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBackupRunsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBackupRunsInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest; - - /** - * Creates a plain object from a SqlBackupRunsInsertRequest message. Also converts values to other types if specified. - * @param message SqlBackupRunsInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBackupRunsInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBackupRunsInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlBackupRunsListRequest. */ - interface ISqlBackupRunsListRequest { - - /** SqlBackupRunsListRequest instance */ - instance?: (string|null); - - /** SqlBackupRunsListRequest maxResults */ - maxResults?: (number|null); - - /** SqlBackupRunsListRequest pageToken */ - pageToken?: (string|null); - - /** SqlBackupRunsListRequest project */ - project?: (string|null); - } - - /** Represents a SqlBackupRunsListRequest. */ - class SqlBackupRunsListRequest implements ISqlBackupRunsListRequest { - - /** - * Constructs a new SqlBackupRunsListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest); - - /** SqlBackupRunsListRequest instance. */ - public instance: string; - - /** SqlBackupRunsListRequest maxResults. */ - public maxResults: number; - - /** SqlBackupRunsListRequest pageToken. */ - public pageToken: string; - - /** SqlBackupRunsListRequest project. */ - public project: string; - - /** - * Creates a new SqlBackupRunsListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBackupRunsListRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest): google.cloud.sql.v1beta4.SqlBackupRunsListRequest; - - /** - * Encodes the specified SqlBackupRunsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsListRequest.verify|verify} messages. - * @param message SqlBackupRunsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBackupRunsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsListRequest.verify|verify} messages. - * @param message SqlBackupRunsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBackupRunsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlBackupRunsListRequest; - - /** - * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBackupRunsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlBackupRunsListRequest; - - /** - * Verifies a SqlBackupRunsListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBackupRunsListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBackupRunsListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlBackupRunsListRequest; - - /** - * Creates a plain object from a SqlBackupRunsListRequest message. Also converts values to other types if specified. - * @param message SqlBackupRunsListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlBackupRunsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBackupRunsListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBackupRunsListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlDatabasesDeleteRequest. */ - interface ISqlDatabasesDeleteRequest { - - /** SqlDatabasesDeleteRequest database */ - database?: (string|null); - - /** SqlDatabasesDeleteRequest instance */ - instance?: (string|null); - - /** SqlDatabasesDeleteRequest project */ - project?: (string|null); - } - - /** Represents a SqlDatabasesDeleteRequest. */ - class SqlDatabasesDeleteRequest implements ISqlDatabasesDeleteRequest { - - /** - * Constructs a new SqlDatabasesDeleteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest); - - /** SqlDatabasesDeleteRequest database. */ - public database: string; - - /** SqlDatabasesDeleteRequest instance. */ - public instance: string; - - /** SqlDatabasesDeleteRequest project. */ - public project: string; - - /** - * Creates a new SqlDatabasesDeleteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlDatabasesDeleteRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest): google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest; - - /** - * Encodes the specified SqlDatabasesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest.verify|verify} messages. - * @param message SqlDatabasesDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlDatabasesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest.verify|verify} messages. - * @param message SqlDatabasesDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlDatabasesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest; - - /** - * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlDatabasesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest; - - /** - * Verifies a SqlDatabasesDeleteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlDatabasesDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlDatabasesDeleteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest; - - /** - * Creates a plain object from a SqlDatabasesDeleteRequest message. Also converts values to other types if specified. - * @param message SqlDatabasesDeleteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlDatabasesDeleteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlDatabasesDeleteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlDatabasesGetRequest. */ - interface ISqlDatabasesGetRequest { - - /** SqlDatabasesGetRequest database */ - database?: (string|null); - - /** SqlDatabasesGetRequest instance */ - instance?: (string|null); - - /** SqlDatabasesGetRequest project */ - project?: (string|null); - } - - /** Represents a SqlDatabasesGetRequest. */ - class SqlDatabasesGetRequest implements ISqlDatabasesGetRequest { - - /** - * Constructs a new SqlDatabasesGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest); - - /** SqlDatabasesGetRequest database. */ - public database: string; - - /** SqlDatabasesGetRequest instance. */ - public instance: string; - - /** SqlDatabasesGetRequest project. */ - public project: string; - - /** - * Creates a new SqlDatabasesGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlDatabasesGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest): google.cloud.sql.v1beta4.SqlDatabasesGetRequest; - - /** - * Encodes the specified SqlDatabasesGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesGetRequest.verify|verify} messages. - * @param message SqlDatabasesGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlDatabasesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesGetRequest.verify|verify} messages. - * @param message SqlDatabasesGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlDatabasesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlDatabasesGetRequest; - - /** - * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlDatabasesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlDatabasesGetRequest; - - /** - * Verifies a SqlDatabasesGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlDatabasesGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlDatabasesGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlDatabasesGetRequest; - - /** - * Creates a plain object from a SqlDatabasesGetRequest message. Also converts values to other types if specified. - * @param message SqlDatabasesGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlDatabasesGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlDatabasesGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlDatabasesGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlDatabasesInsertRequest. */ - interface ISqlDatabasesInsertRequest { - - /** SqlDatabasesInsertRequest instance */ - instance?: (string|null); - - /** SqlDatabasesInsertRequest project */ - project?: (string|null); - - /** SqlDatabasesInsertRequest body */ - body?: (google.cloud.sql.v1beta4.IDatabase|null); - } - - /** Represents a SqlDatabasesInsertRequest. */ - class SqlDatabasesInsertRequest implements ISqlDatabasesInsertRequest { - - /** - * Constructs a new SqlDatabasesInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest); - - /** SqlDatabasesInsertRequest instance. */ - public instance: string; - - /** SqlDatabasesInsertRequest project. */ - public project: string; - - /** SqlDatabasesInsertRequest body. */ - public body?: (google.cloud.sql.v1beta4.IDatabase|null); - - /** - * Creates a new SqlDatabasesInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlDatabasesInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest): google.cloud.sql.v1beta4.SqlDatabasesInsertRequest; - - /** - * Encodes the specified SqlDatabasesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesInsertRequest.verify|verify} messages. - * @param message SqlDatabasesInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlDatabasesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesInsertRequest.verify|verify} messages. - * @param message SqlDatabasesInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlDatabasesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlDatabasesInsertRequest; - - /** - * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlDatabasesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlDatabasesInsertRequest; - - /** - * Verifies a SqlDatabasesInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlDatabasesInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlDatabasesInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlDatabasesInsertRequest; - - /** - * Creates a plain object from a SqlDatabasesInsertRequest message. Also converts values to other types if specified. - * @param message SqlDatabasesInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlDatabasesInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlDatabasesInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlDatabasesInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlDatabasesListRequest. */ - interface ISqlDatabasesListRequest { - - /** SqlDatabasesListRequest instance */ - instance?: (string|null); - - /** SqlDatabasesListRequest project */ - project?: (string|null); - } - - /** Represents a SqlDatabasesListRequest. */ - class SqlDatabasesListRequest implements ISqlDatabasesListRequest { - - /** - * Constructs a new SqlDatabasesListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlDatabasesListRequest); - - /** SqlDatabasesListRequest instance. */ - public instance: string; - - /** SqlDatabasesListRequest project. */ - public project: string; - - /** - * Creates a new SqlDatabasesListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlDatabasesListRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlDatabasesListRequest): google.cloud.sql.v1beta4.SqlDatabasesListRequest; - - /** - * Encodes the specified SqlDatabasesListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesListRequest.verify|verify} messages. - * @param message SqlDatabasesListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlDatabasesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlDatabasesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesListRequest.verify|verify} messages. - * @param message SqlDatabasesListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlDatabasesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlDatabasesListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlDatabasesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlDatabasesListRequest; - - /** - * Decodes a SqlDatabasesListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlDatabasesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlDatabasesListRequest; - - /** - * Verifies a SqlDatabasesListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlDatabasesListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlDatabasesListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlDatabasesListRequest; - - /** - * Creates a plain object from a SqlDatabasesListRequest message. Also converts values to other types if specified. - * @param message SqlDatabasesListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlDatabasesListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlDatabasesListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlDatabasesListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlDatabasesUpdateRequest. */ - interface ISqlDatabasesUpdateRequest { - - /** SqlDatabasesUpdateRequest database */ - database?: (string|null); - - /** SqlDatabasesUpdateRequest instance */ - instance?: (string|null); - - /** SqlDatabasesUpdateRequest project */ - project?: (string|null); - - /** SqlDatabasesUpdateRequest body */ - body?: (google.cloud.sql.v1beta4.IDatabase|null); - } - - /** Represents a SqlDatabasesUpdateRequest. */ - class SqlDatabasesUpdateRequest implements ISqlDatabasesUpdateRequest { - - /** - * Constructs a new SqlDatabasesUpdateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest); - - /** SqlDatabasesUpdateRequest database. */ - public database: string; - - /** SqlDatabasesUpdateRequest instance. */ - public instance: string; - - /** SqlDatabasesUpdateRequest project. */ - public project: string; - - /** SqlDatabasesUpdateRequest body. */ - public body?: (google.cloud.sql.v1beta4.IDatabase|null); - - /** - * Creates a new SqlDatabasesUpdateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlDatabasesUpdateRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest): google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest; - - /** - * Encodes the specified SqlDatabasesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest.verify|verify} messages. - * @param message SqlDatabasesUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlDatabasesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest.verify|verify} messages. - * @param message SqlDatabasesUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlDatabasesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest; - - /** - * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlDatabasesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest; - - /** - * Verifies a SqlDatabasesUpdateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlDatabasesUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlDatabasesUpdateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest; - - /** - * Creates a plain object from a SqlDatabasesUpdateRequest message. Also converts values to other types if specified. - * @param message SqlDatabasesUpdateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlDatabasesUpdateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlDatabasesUpdateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlFlagsListRequest. */ - interface ISqlFlagsListRequest { - - /** SqlFlagsListRequest databaseVersion */ - databaseVersion?: (string|null); - - /** SqlFlagsListRequest flagScope */ - flagScope?: (google.cloud.sql.v1beta4.SqlFlagScope|keyof typeof google.cloud.sql.v1beta4.SqlFlagScope|null); - } - - /** Represents a SqlFlagsListRequest. */ - class SqlFlagsListRequest implements ISqlFlagsListRequest { - - /** - * Constructs a new SqlFlagsListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlFlagsListRequest); - - /** SqlFlagsListRequest databaseVersion. */ - public databaseVersion: string; - - /** SqlFlagsListRequest flagScope. */ - public flagScope?: (google.cloud.sql.v1beta4.SqlFlagScope|keyof typeof google.cloud.sql.v1beta4.SqlFlagScope|null); - - /** - * Creates a new SqlFlagsListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlFlagsListRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlFlagsListRequest): google.cloud.sql.v1beta4.SqlFlagsListRequest; - - /** - * Encodes the specified SqlFlagsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlFlagsListRequest.verify|verify} messages. - * @param message SqlFlagsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlFlagsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlFlagsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlFlagsListRequest.verify|verify} messages. - * @param message SqlFlagsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlFlagsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlFlagsListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlFlagsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlFlagsListRequest; - - /** - * Decodes a SqlFlagsListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlFlagsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlFlagsListRequest; - - /** - * Verifies a SqlFlagsListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlFlagsListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlFlagsListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlFlagsListRequest; - - /** - * Creates a plain object from a SqlFlagsListRequest message. Also converts values to other types if specified. - * @param message SqlFlagsListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlFlagsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlFlagsListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlFlagsListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesAddServerCaRequest. */ - interface ISqlInstancesAddServerCaRequest { - - /** SqlInstancesAddServerCaRequest instance */ - instance?: (string|null); - - /** SqlInstancesAddServerCaRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesAddServerCaRequest. */ - class SqlInstancesAddServerCaRequest implements ISqlInstancesAddServerCaRequest { - - /** - * Constructs a new SqlInstancesAddServerCaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest); - - /** SqlInstancesAddServerCaRequest instance. */ - public instance: string; - - /** SqlInstancesAddServerCaRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesAddServerCaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesAddServerCaRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest): google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest; - - /** - * Encodes the specified SqlInstancesAddServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest.verify|verify} messages. - * @param message SqlInstancesAddServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesAddServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest.verify|verify} messages. - * @param message SqlInstancesAddServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesAddServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest; - - /** - * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesAddServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest; - - /** - * Verifies a SqlInstancesAddServerCaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesAddServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesAddServerCaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest; - - /** - * Creates a plain object from a SqlInstancesAddServerCaRequest message. Also converts values to other types if specified. - * @param message SqlInstancesAddServerCaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesAddServerCaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesAddServerCaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesAddServerCertificateRequest. */ - interface ISqlInstancesAddServerCertificateRequest { - - /** SqlInstancesAddServerCertificateRequest instance */ - instance?: (string|null); - - /** SqlInstancesAddServerCertificateRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesAddServerCertificateRequest. */ - class SqlInstancesAddServerCertificateRequest implements ISqlInstancesAddServerCertificateRequest { - - /** - * Constructs a new SqlInstancesAddServerCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest); - - /** SqlInstancesAddServerCertificateRequest instance. */ - public instance: string; - - /** SqlInstancesAddServerCertificateRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesAddServerCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesAddServerCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest): google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest; - - /** - * Encodes the specified SqlInstancesAddServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest.verify|verify} messages. - * @param message SqlInstancesAddServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesAddServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest.verify|verify} messages. - * @param message SqlInstancesAddServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesAddServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest; - - /** - * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesAddServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest; - - /** - * Verifies a SqlInstancesAddServerCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesAddServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesAddServerCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest; - - /** - * Creates a plain object from a SqlInstancesAddServerCertificateRequest message. Also converts values to other types if specified. - * @param message SqlInstancesAddServerCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesAddServerCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesAddServerCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesAddEntraIdCertificateRequest. */ - interface ISqlInstancesAddEntraIdCertificateRequest { - - /** SqlInstancesAddEntraIdCertificateRequest instance */ - instance?: (string|null); - - /** SqlInstancesAddEntraIdCertificateRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesAddEntraIdCertificateRequest. */ - class SqlInstancesAddEntraIdCertificateRequest implements ISqlInstancesAddEntraIdCertificateRequest { - - /** - * Constructs a new SqlInstancesAddEntraIdCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest); - - /** SqlInstancesAddEntraIdCertificateRequest instance. */ - public instance: string; - - /** SqlInstancesAddEntraIdCertificateRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesAddEntraIdCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesAddEntraIdCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest): google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest; - - /** - * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. - * @param message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. - * @param message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesAddEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest; - - /** - * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesAddEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest; - - /** - * Verifies a SqlInstancesAddEntraIdCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesAddEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesAddEntraIdCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest; - - /** - * Creates a plain object from a SqlInstancesAddEntraIdCertificateRequest message. Also converts values to other types if specified. - * @param message SqlInstancesAddEntraIdCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesAddEntraIdCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesAddEntraIdCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesCloneRequest. */ - interface ISqlInstancesCloneRequest { - - /** SqlInstancesCloneRequest instance */ - instance?: (string|null); - - /** SqlInstancesCloneRequest project */ - project?: (string|null); - - /** SqlInstancesCloneRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesCloneRequest|null); - } - - /** Represents a SqlInstancesCloneRequest. */ - class SqlInstancesCloneRequest implements ISqlInstancesCloneRequest { - - /** - * Constructs a new SqlInstancesCloneRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest); - - /** SqlInstancesCloneRequest instance. */ - public instance: string; - - /** SqlInstancesCloneRequest project. */ - public project: string; - - /** SqlInstancesCloneRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesCloneRequest|null); - - /** - * Creates a new SqlInstancesCloneRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesCloneRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest): google.cloud.sql.v1beta4.SqlInstancesCloneRequest; - - /** - * Encodes the specified SqlInstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCloneRequest.verify|verify} messages. - * @param message SqlInstancesCloneRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCloneRequest.verify|verify} messages. - * @param message SqlInstancesCloneRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesCloneRequest; - - /** - * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesCloneRequest; - - /** - * Verifies a SqlInstancesCloneRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesCloneRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesCloneRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesCloneRequest; - - /** - * Creates a plain object from a SqlInstancesCloneRequest message. Also converts values to other types if specified. - * @param message SqlInstancesCloneRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesCloneRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesCloneRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesCloneRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesDeleteRequest. */ - interface ISqlInstancesDeleteRequest { - - /** SqlInstancesDeleteRequest instance */ - instance?: (string|null); - - /** SqlInstancesDeleteRequest project */ - project?: (string|null); - - /** SqlInstancesDeleteRequest enableFinalBackup */ - enableFinalBackup?: (boolean|null); - - /** SqlInstancesDeleteRequest finalBackupTtlDays */ - finalBackupTtlDays?: (number|Long|string|null); - - /** SqlInstancesDeleteRequest finalBackupExpiryTime */ - finalBackupExpiryTime?: (google.protobuf.ITimestamp|null); - - /** SqlInstancesDeleteRequest finalBackupDescription */ - finalBackupDescription?: (string|null); - } - - /** Represents a SqlInstancesDeleteRequest. */ - class SqlInstancesDeleteRequest implements ISqlInstancesDeleteRequest { - - /** - * Constructs a new SqlInstancesDeleteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest); - - /** SqlInstancesDeleteRequest instance. */ - public instance: string; - - /** SqlInstancesDeleteRequest project. */ - public project: string; - - /** SqlInstancesDeleteRequest enableFinalBackup. */ - public enableFinalBackup?: (boolean|null); - - /** SqlInstancesDeleteRequest finalBackupTtlDays. */ - public finalBackupTtlDays?: (number|Long|string|null); - - /** SqlInstancesDeleteRequest finalBackupExpiryTime. */ - public finalBackupExpiryTime?: (google.protobuf.ITimestamp|null); - - /** SqlInstancesDeleteRequest finalBackupDescription. */ - public finalBackupDescription: string; - - /** SqlInstancesDeleteRequest expiration. */ - public expiration?: ("finalBackupTtlDays"|"finalBackupExpiryTime"); - - /** - * Creates a new SqlInstancesDeleteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesDeleteRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest): google.cloud.sql.v1beta4.SqlInstancesDeleteRequest; - - /** - * Encodes the specified SqlInstancesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDeleteRequest.verify|verify} messages. - * @param message SqlInstancesDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDeleteRequest.verify|verify} messages. - * @param message SqlInstancesDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesDeleteRequest; - - /** - * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesDeleteRequest; - - /** - * Verifies a SqlInstancesDeleteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesDeleteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesDeleteRequest; - - /** - * Creates a plain object from a SqlInstancesDeleteRequest message. Also converts values to other types if specified. - * @param message SqlInstancesDeleteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesDeleteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesDeleteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesDemoteMasterRequest. */ - interface ISqlInstancesDemoteMasterRequest { - - /** SqlInstancesDemoteMasterRequest instance */ - instance?: (string|null); - - /** SqlInstancesDemoteMasterRequest project */ - project?: (string|null); - - /** SqlInstancesDemoteMasterRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest|null); - } - - /** Represents a SqlInstancesDemoteMasterRequest. */ - class SqlInstancesDemoteMasterRequest implements ISqlInstancesDemoteMasterRequest { - - /** - * Constructs a new SqlInstancesDemoteMasterRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest); - - /** SqlInstancesDemoteMasterRequest instance. */ - public instance: string; - - /** SqlInstancesDemoteMasterRequest project. */ - public project: string; - - /** SqlInstancesDemoteMasterRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest|null); - - /** - * Creates a new SqlInstancesDemoteMasterRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesDemoteMasterRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest): google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest; - - /** - * Encodes the specified SqlInstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest.verify|verify} messages. - * @param message SqlInstancesDemoteMasterRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest.verify|verify} messages. - * @param message SqlInstancesDemoteMasterRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest; - - /** - * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest; - - /** - * Verifies a SqlInstancesDemoteMasterRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesDemoteMasterRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest; - - /** - * Creates a plain object from a SqlInstancesDemoteMasterRequest message. Also converts values to other types if specified. - * @param message SqlInstancesDemoteMasterRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesDemoteMasterRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesDemoteMasterRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesDemoteRequest. */ - interface ISqlInstancesDemoteRequest { - - /** SqlInstancesDemoteRequest instance */ - instance?: (string|null); - - /** SqlInstancesDemoteRequest project */ - project?: (string|null); - - /** SqlInstancesDemoteRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesDemoteRequest|null); - } - - /** Represents a SqlInstancesDemoteRequest. */ - class SqlInstancesDemoteRequest implements ISqlInstancesDemoteRequest { - - /** - * Constructs a new SqlInstancesDemoteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest); - - /** SqlInstancesDemoteRequest instance. */ - public instance: string; - - /** SqlInstancesDemoteRequest project. */ - public project: string; - - /** SqlInstancesDemoteRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesDemoteRequest|null); - - /** - * Creates a new SqlInstancesDemoteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesDemoteRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest): google.cloud.sql.v1beta4.SqlInstancesDemoteRequest; - - /** - * Encodes the specified SqlInstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteRequest.verify|verify} messages. - * @param message SqlInstancesDemoteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteRequest.verify|verify} messages. - * @param message SqlInstancesDemoteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesDemoteRequest; - - /** - * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesDemoteRequest; - - /** - * Verifies a SqlInstancesDemoteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesDemoteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesDemoteRequest; - - /** - * Creates a plain object from a SqlInstancesDemoteRequest message. Also converts values to other types if specified. - * @param message SqlInstancesDemoteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesDemoteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesDemoteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesDemoteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesExportRequest. */ - interface ISqlInstancesExportRequest { - - /** SqlInstancesExportRequest instance */ - instance?: (string|null); - - /** SqlInstancesExportRequest project */ - project?: (string|null); - - /** SqlInstancesExportRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesExportRequest|null); - } - - /** Represents a SqlInstancesExportRequest. */ - class SqlInstancesExportRequest implements ISqlInstancesExportRequest { - - /** - * Constructs a new SqlInstancesExportRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesExportRequest); - - /** SqlInstancesExportRequest instance. */ - public instance: string; - - /** SqlInstancesExportRequest project. */ - public project: string; - - /** SqlInstancesExportRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesExportRequest|null); - - /** - * Creates a new SqlInstancesExportRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesExportRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesExportRequest): google.cloud.sql.v1beta4.SqlInstancesExportRequest; - - /** - * Encodes the specified SqlInstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExportRequest.verify|verify} messages. - * @param message SqlInstancesExportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExportRequest.verify|verify} messages. - * @param message SqlInstancesExportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesExportRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesExportRequest; - - /** - * Decodes a SqlInstancesExportRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesExportRequest; - - /** - * Verifies a SqlInstancesExportRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesExportRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesExportRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesExportRequest; - - /** - * Creates a plain object from a SqlInstancesExportRequest message. Also converts values to other types if specified. - * @param message SqlInstancesExportRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesExportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesExportRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesExportRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesFailoverRequest. */ - interface ISqlInstancesFailoverRequest { - - /** SqlInstancesFailoverRequest instance */ - instance?: (string|null); - - /** SqlInstancesFailoverRequest project */ - project?: (string|null); - - /** SqlInstancesFailoverRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesFailoverRequest|null); - } - - /** Represents a SqlInstancesFailoverRequest. */ - class SqlInstancesFailoverRequest implements ISqlInstancesFailoverRequest { - - /** - * Constructs a new SqlInstancesFailoverRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest); - - /** SqlInstancesFailoverRequest instance. */ - public instance: string; - - /** SqlInstancesFailoverRequest project. */ - public project: string; - - /** SqlInstancesFailoverRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesFailoverRequest|null); - - /** - * Creates a new SqlInstancesFailoverRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesFailoverRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest): google.cloud.sql.v1beta4.SqlInstancesFailoverRequest; - - /** - * Encodes the specified SqlInstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesFailoverRequest.verify|verify} messages. - * @param message SqlInstancesFailoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesFailoverRequest.verify|verify} messages. - * @param message SqlInstancesFailoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesFailoverRequest; - - /** - * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesFailoverRequest; - - /** - * Verifies a SqlInstancesFailoverRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesFailoverRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesFailoverRequest; - - /** - * Creates a plain object from a SqlInstancesFailoverRequest message. Also converts values to other types if specified. - * @param message SqlInstancesFailoverRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesFailoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesFailoverRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesFailoverRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesGetRequest. */ - interface ISqlInstancesGetRequest { - - /** SqlInstancesGetRequest instance */ - instance?: (string|null); - - /** SqlInstancesGetRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesGetRequest. */ - class SqlInstancesGetRequest implements ISqlInstancesGetRequest { - - /** - * Constructs a new SqlInstancesGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetRequest); - - /** SqlInstancesGetRequest instance. */ - public instance: string; - - /** SqlInstancesGetRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetRequest): google.cloud.sql.v1beta4.SqlInstancesGetRequest; - - /** - * Encodes the specified SqlInstancesGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetRequest.verify|verify} messages. - * @param message SqlInstancesGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetRequest.verify|verify} messages. - * @param message SqlInstancesGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesGetRequest; - - /** - * Decodes a SqlInstancesGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesGetRequest; - - /** - * Verifies a SqlInstancesGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesGetRequest; - - /** - * Creates a plain object from a SqlInstancesGetRequest message. Also converts values to other types if specified. - * @param message SqlInstancesGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesImportRequest. */ - interface ISqlInstancesImportRequest { - - /** SqlInstancesImportRequest instance */ - instance?: (string|null); - - /** SqlInstancesImportRequest project */ - project?: (string|null); - - /** SqlInstancesImportRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesImportRequest|null); - } - - /** Represents a SqlInstancesImportRequest. */ - class SqlInstancesImportRequest implements ISqlInstancesImportRequest { - - /** - * Constructs a new SqlInstancesImportRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesImportRequest); - - /** SqlInstancesImportRequest instance. */ - public instance: string; - - /** SqlInstancesImportRequest project. */ - public project: string; - - /** SqlInstancesImportRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesImportRequest|null); - - /** - * Creates a new SqlInstancesImportRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesImportRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesImportRequest): google.cloud.sql.v1beta4.SqlInstancesImportRequest; - - /** - * Encodes the specified SqlInstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesImportRequest.verify|verify} messages. - * @param message SqlInstancesImportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesImportRequest.verify|verify} messages. - * @param message SqlInstancesImportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesImportRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesImportRequest; - - /** - * Decodes a SqlInstancesImportRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesImportRequest; - - /** - * Verifies a SqlInstancesImportRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesImportRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesImportRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesImportRequest; - - /** - * Creates a plain object from a SqlInstancesImportRequest message. Also converts values to other types if specified. - * @param message SqlInstancesImportRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesImportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesImportRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesImportRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesInsertRequest. */ - interface ISqlInstancesInsertRequest { - - /** SqlInstancesInsertRequest project */ - project?: (string|null); - - /** SqlInstancesInsertRequest body */ - body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); - } - - /** Represents a SqlInstancesInsertRequest. */ - class SqlInstancesInsertRequest implements ISqlInstancesInsertRequest { - - /** - * Constructs a new SqlInstancesInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest); - - /** SqlInstancesInsertRequest project. */ - public project: string; - - /** SqlInstancesInsertRequest body. */ - public body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); - - /** - * Creates a new SqlInstancesInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest): google.cloud.sql.v1beta4.SqlInstancesInsertRequest; - - /** - * Encodes the specified SqlInstancesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesInsertRequest.verify|verify} messages. - * @param message SqlInstancesInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesInsertRequest.verify|verify} messages. - * @param message SqlInstancesInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesInsertRequest; - - /** - * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesInsertRequest; - - /** - * Verifies a SqlInstancesInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesInsertRequest; - - /** - * Creates a plain object from a SqlInstancesInsertRequest message. Also converts values to other types if specified. - * @param message SqlInstancesInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesListRequest. */ - interface ISqlInstancesListRequest { - - /** SqlInstancesListRequest filter */ - filter?: (string|null); - - /** SqlInstancesListRequest maxResults */ - maxResults?: (number|null); - - /** SqlInstancesListRequest pageToken */ - pageToken?: (string|null); - - /** SqlInstancesListRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesListRequest. */ - class SqlInstancesListRequest implements ISqlInstancesListRequest { - - /** - * Constructs a new SqlInstancesListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesListRequest); - - /** SqlInstancesListRequest filter. */ - public filter: string; - - /** SqlInstancesListRequest maxResults. */ - public maxResults: number; - - /** SqlInstancesListRequest pageToken. */ - public pageToken: string; - - /** SqlInstancesListRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesListRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesListRequest): google.cloud.sql.v1beta4.SqlInstancesListRequest; - - /** - * Encodes the specified SqlInstancesListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListRequest.verify|verify} messages. - * @param message SqlInstancesListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListRequest.verify|verify} messages. - * @param message SqlInstancesListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesListRequest; - - /** - * Decodes a SqlInstancesListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesListRequest; - - /** - * Verifies a SqlInstancesListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesListRequest; - - /** - * Creates a plain object from a SqlInstancesListRequest message. Also converts values to other types if specified. - * @param message SqlInstancesListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesListServerCasRequest. */ - interface ISqlInstancesListServerCasRequest { - - /** SqlInstancesListServerCasRequest instance */ - instance?: (string|null); - - /** SqlInstancesListServerCasRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesListServerCasRequest. */ - class SqlInstancesListServerCasRequest implements ISqlInstancesListServerCasRequest { - - /** - * Constructs a new SqlInstancesListServerCasRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest); - - /** SqlInstancesListServerCasRequest instance. */ - public instance: string; - - /** SqlInstancesListServerCasRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesListServerCasRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesListServerCasRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest): google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest; - - /** - * Encodes the specified SqlInstancesListServerCasRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest.verify|verify} messages. - * @param message SqlInstancesListServerCasRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesListServerCasRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest.verify|verify} messages. - * @param message SqlInstancesListServerCasRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesListServerCasRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest; - - /** - * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesListServerCasRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest; - - /** - * Verifies a SqlInstancesListServerCasRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesListServerCasRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesListServerCasRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest; - - /** - * Creates a plain object from a SqlInstancesListServerCasRequest message. Also converts values to other types if specified. - * @param message SqlInstancesListServerCasRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesListServerCasRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesListServerCasRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesListServerCertificatesRequest. */ - interface ISqlInstancesListServerCertificatesRequest { - - /** SqlInstancesListServerCertificatesRequest instance */ - instance?: (string|null); - - /** SqlInstancesListServerCertificatesRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesListServerCertificatesRequest. */ - class SqlInstancesListServerCertificatesRequest implements ISqlInstancesListServerCertificatesRequest { - - /** - * Constructs a new SqlInstancesListServerCertificatesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest); - - /** SqlInstancesListServerCertificatesRequest instance. */ - public instance: string; - - /** SqlInstancesListServerCertificatesRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesListServerCertificatesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesListServerCertificatesRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest): google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest; - - /** - * Encodes the specified SqlInstancesListServerCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest.verify|verify} messages. - * @param message SqlInstancesListServerCertificatesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesListServerCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest.verify|verify} messages. - * @param message SqlInstancesListServerCertificatesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesListServerCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest; - - /** - * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesListServerCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest; - - /** - * Verifies a SqlInstancesListServerCertificatesRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesListServerCertificatesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesListServerCertificatesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest; - - /** - * Creates a plain object from a SqlInstancesListServerCertificatesRequest message. Also converts values to other types if specified. - * @param message SqlInstancesListServerCertificatesRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesListServerCertificatesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesListServerCertificatesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesListEntraIdCertificatesRequest. */ - interface ISqlInstancesListEntraIdCertificatesRequest { - - /** SqlInstancesListEntraIdCertificatesRequest instance */ - instance?: (string|null); - - /** SqlInstancesListEntraIdCertificatesRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesListEntraIdCertificatesRequest. */ - class SqlInstancesListEntraIdCertificatesRequest implements ISqlInstancesListEntraIdCertificatesRequest { - - /** - * Constructs a new SqlInstancesListEntraIdCertificatesRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest); - - /** SqlInstancesListEntraIdCertificatesRequest instance. */ - public instance: string; - - /** SqlInstancesListEntraIdCertificatesRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesListEntraIdCertificatesRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesListEntraIdCertificatesRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest): google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest; - - /** - * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. - * @param message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. - * @param message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesListEntraIdCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest; - - /** - * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesListEntraIdCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest; - - /** - * Verifies a SqlInstancesListEntraIdCertificatesRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesListEntraIdCertificatesRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesListEntraIdCertificatesRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest; - - /** - * Creates a plain object from a SqlInstancesListEntraIdCertificatesRequest message. Also converts values to other types if specified. - * @param message SqlInstancesListEntraIdCertificatesRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesListEntraIdCertificatesRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesListEntraIdCertificatesRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesPatchRequest. */ - interface ISqlInstancesPatchRequest { - - /** SqlInstancesPatchRequest instance */ - instance?: (string|null); - - /** SqlInstancesPatchRequest project */ - project?: (string|null); - - /** SqlInstancesPatchRequest body */ - body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); - } - - /** Represents a SqlInstancesPatchRequest. */ - class SqlInstancesPatchRequest implements ISqlInstancesPatchRequest { - - /** - * Constructs a new SqlInstancesPatchRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest); - - /** SqlInstancesPatchRequest instance. */ - public instance: string; - - /** SqlInstancesPatchRequest project. */ - public project: string; - - /** SqlInstancesPatchRequest body. */ - public body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); - - /** - * Creates a new SqlInstancesPatchRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesPatchRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest): google.cloud.sql.v1beta4.SqlInstancesPatchRequest; - - /** - * Encodes the specified SqlInstancesPatchRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPatchRequest.verify|verify} messages. - * @param message SqlInstancesPatchRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesPatchRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPatchRequest.verify|verify} messages. - * @param message SqlInstancesPatchRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesPatchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesPatchRequest; - - /** - * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesPatchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesPatchRequest; - - /** - * Verifies a SqlInstancesPatchRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesPatchRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesPatchRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesPatchRequest; - - /** - * Creates a plain object from a SqlInstancesPatchRequest message. Also converts values to other types if specified. - * @param message SqlInstancesPatchRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesPatchRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesPatchRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesPatchRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesPromoteReplicaRequest. */ - interface ISqlInstancesPromoteReplicaRequest { - - /** SqlInstancesPromoteReplicaRequest instance */ - instance?: (string|null); - - /** SqlInstancesPromoteReplicaRequest project */ - project?: (string|null); - - /** SqlInstancesPromoteReplicaRequest failover */ - failover?: (boolean|null); - } - - /** Represents a SqlInstancesPromoteReplicaRequest. */ - class SqlInstancesPromoteReplicaRequest implements ISqlInstancesPromoteReplicaRequest { - - /** - * Constructs a new SqlInstancesPromoteReplicaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest); - - /** SqlInstancesPromoteReplicaRequest instance. */ - public instance: string; - - /** SqlInstancesPromoteReplicaRequest project. */ - public project: string; - - /** SqlInstancesPromoteReplicaRequest failover. */ - public failover: boolean; - - /** - * Creates a new SqlInstancesPromoteReplicaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesPromoteReplicaRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest): google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest; - - /** - * Encodes the specified SqlInstancesPromoteReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest.verify|verify} messages. - * @param message SqlInstancesPromoteReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesPromoteReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest.verify|verify} messages. - * @param message SqlInstancesPromoteReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesPromoteReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest; - - /** - * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesPromoteReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest; - - /** - * Verifies a SqlInstancesPromoteReplicaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesPromoteReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesPromoteReplicaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest; - - /** - * Creates a plain object from a SqlInstancesPromoteReplicaRequest message. Also converts values to other types if specified. - * @param message SqlInstancesPromoteReplicaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesPromoteReplicaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesPromoteReplicaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesSwitchoverRequest. */ - interface ISqlInstancesSwitchoverRequest { - - /** SqlInstancesSwitchoverRequest instance */ - instance?: (string|null); - - /** SqlInstancesSwitchoverRequest project */ - project?: (string|null); - - /** SqlInstancesSwitchoverRequest dbTimeout */ - dbTimeout?: (google.protobuf.IDuration|null); - } - - /** Represents a SqlInstancesSwitchoverRequest. */ - class SqlInstancesSwitchoverRequest implements ISqlInstancesSwitchoverRequest { - - /** - * Constructs a new SqlInstancesSwitchoverRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest); - - /** SqlInstancesSwitchoverRequest instance. */ - public instance: string; - - /** SqlInstancesSwitchoverRequest project. */ - public project: string; - - /** SqlInstancesSwitchoverRequest dbTimeout. */ - public dbTimeout?: (google.protobuf.IDuration|null); - - /** - * Creates a new SqlInstancesSwitchoverRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesSwitchoverRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest): google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest; - - /** - * Encodes the specified SqlInstancesSwitchoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest.verify|verify} messages. - * @param message SqlInstancesSwitchoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesSwitchoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest.verify|verify} messages. - * @param message SqlInstancesSwitchoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesSwitchoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest; - - /** - * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesSwitchoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest; - - /** - * Verifies a SqlInstancesSwitchoverRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesSwitchoverRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesSwitchoverRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest; - - /** - * Creates a plain object from a SqlInstancesSwitchoverRequest message. Also converts values to other types if specified. - * @param message SqlInstancesSwitchoverRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesSwitchoverRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesSwitchoverRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesResetSslConfigRequest. */ - interface ISqlInstancesResetSslConfigRequest { - - /** SqlInstancesResetSslConfigRequest instance */ - instance?: (string|null); - - /** SqlInstancesResetSslConfigRequest project */ - project?: (string|null); - - /** SqlInstancesResetSslConfigRequest mode */ - mode?: (google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode|null); - } - - /** Represents a SqlInstancesResetSslConfigRequest. */ - class SqlInstancesResetSslConfigRequest implements ISqlInstancesResetSslConfigRequest { - - /** - * Constructs a new SqlInstancesResetSslConfigRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest); - - /** SqlInstancesResetSslConfigRequest instance. */ - public instance: string; - - /** SqlInstancesResetSslConfigRequest project. */ - public project: string; - - /** SqlInstancesResetSslConfigRequest mode. */ - public mode: (google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode); - - /** - * Creates a new SqlInstancesResetSslConfigRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesResetSslConfigRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest): google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest; - - /** - * Encodes the specified SqlInstancesResetSslConfigRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.verify|verify} messages. - * @param message SqlInstancesResetSslConfigRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesResetSslConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.verify|verify} messages. - * @param message SqlInstancesResetSslConfigRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesResetSslConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest; - - /** - * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesResetSslConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest; - - /** - * Verifies a SqlInstancesResetSslConfigRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesResetSslConfigRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesResetSslConfigRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest; - - /** - * Creates a plain object from a SqlInstancesResetSslConfigRequest message. Also converts values to other types if specified. - * @param message SqlInstancesResetSslConfigRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesResetSslConfigRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesResetSslConfigRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlInstancesResetSslConfigRequest { - - /** ResetSslMode enum. */ - enum ResetSslMode { - RESET_SSL_MODE_UNSPECIFIED = 0, - ALL = 1, - SYNC_FROM_PRIMARY = 2 - } - } - - /** Properties of a SqlInstancesRestartRequest. */ - interface ISqlInstancesRestartRequest { - - /** SqlInstancesRestartRequest instance */ - instance?: (string|null); - - /** SqlInstancesRestartRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesRestartRequest. */ - class SqlInstancesRestartRequest implements ISqlInstancesRestartRequest { - - /** - * Constructs a new SqlInstancesRestartRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest); - - /** SqlInstancesRestartRequest instance. */ - public instance: string; - - /** SqlInstancesRestartRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesRestartRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRestartRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest): google.cloud.sql.v1beta4.SqlInstancesRestartRequest; - - /** - * Encodes the specified SqlInstancesRestartRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestartRequest.verify|verify} messages. - * @param message SqlInstancesRestartRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRestartRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestartRequest.verify|verify} messages. - * @param message SqlInstancesRestartRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRestartRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRestartRequest; - - /** - * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRestartRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRestartRequest; - - /** - * Verifies a SqlInstancesRestartRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRestartRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRestartRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRestartRequest; - - /** - * Creates a plain object from a SqlInstancesRestartRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRestartRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRestartRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRestartRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRestartRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRestoreBackupRequest. */ - interface ISqlInstancesRestoreBackupRequest { - - /** SqlInstancesRestoreBackupRequest instance */ - instance?: (string|null); - - /** SqlInstancesRestoreBackupRequest project */ - project?: (string|null); - - /** SqlInstancesRestoreBackupRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest|null); - } - - /** Represents a SqlInstancesRestoreBackupRequest. */ - class SqlInstancesRestoreBackupRequest implements ISqlInstancesRestoreBackupRequest { - - /** - * Constructs a new SqlInstancesRestoreBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest); - - /** SqlInstancesRestoreBackupRequest instance. */ - public instance: string; - - /** SqlInstancesRestoreBackupRequest project. */ - public project: string; - - /** SqlInstancesRestoreBackupRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest|null); - - /** - * Creates a new SqlInstancesRestoreBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRestoreBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest): google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest; - - /** - * Encodes the specified SqlInstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest.verify|verify} messages. - * @param message SqlInstancesRestoreBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest.verify|verify} messages. - * @param message SqlInstancesRestoreBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest; - - /** - * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest; - - /** - * Verifies a SqlInstancesRestoreBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRestoreBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest; - - /** - * Creates a plain object from a SqlInstancesRestoreBackupRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRestoreBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRestoreBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRestoreBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRotateServerCaRequest. */ - interface ISqlInstancesRotateServerCaRequest { - - /** SqlInstancesRotateServerCaRequest instance */ - instance?: (string|null); - - /** SqlInstancesRotateServerCaRequest project */ - project?: (string|null); - - /** SqlInstancesRotateServerCaRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest|null); - } - - /** Represents a SqlInstancesRotateServerCaRequest. */ - class SqlInstancesRotateServerCaRequest implements ISqlInstancesRotateServerCaRequest { - - /** - * Constructs a new SqlInstancesRotateServerCaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest); - - /** SqlInstancesRotateServerCaRequest instance. */ - public instance: string; - - /** SqlInstancesRotateServerCaRequest project. */ - public project: string; - - /** SqlInstancesRotateServerCaRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest|null); - - /** - * Creates a new SqlInstancesRotateServerCaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRotateServerCaRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest): google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest; - - /** - * Encodes the specified SqlInstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest.verify|verify} messages. - * @param message SqlInstancesRotateServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest.verify|verify} messages. - * @param message SqlInstancesRotateServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest; - - /** - * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest; - - /** - * Verifies a SqlInstancesRotateServerCaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRotateServerCaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest; - - /** - * Creates a plain object from a SqlInstancesRotateServerCaRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRotateServerCaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRotateServerCaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRotateServerCaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRotateServerCertificateRequest. */ - interface ISqlInstancesRotateServerCertificateRequest { - - /** SqlInstancesRotateServerCertificateRequest instance */ - instance?: (string|null); - - /** SqlInstancesRotateServerCertificateRequest project */ - project?: (string|null); - - /** SqlInstancesRotateServerCertificateRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest|null); - } - - /** Represents a SqlInstancesRotateServerCertificateRequest. */ - class SqlInstancesRotateServerCertificateRequest implements ISqlInstancesRotateServerCertificateRequest { - - /** - * Constructs a new SqlInstancesRotateServerCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest); - - /** SqlInstancesRotateServerCertificateRequest instance. */ - public instance: string; - - /** SqlInstancesRotateServerCertificateRequest project. */ - public project: string; - - /** SqlInstancesRotateServerCertificateRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest|null); - - /** - * Creates a new SqlInstancesRotateServerCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRotateServerCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest): google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest; - - /** - * Encodes the specified SqlInstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. - * @param message SqlInstancesRotateServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. - * @param message SqlInstancesRotateServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest; - - /** - * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest; - - /** - * Verifies a SqlInstancesRotateServerCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRotateServerCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest; - - /** - * Creates a plain object from a SqlInstancesRotateServerCertificateRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRotateServerCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRotateServerCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRotateServerCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRotateEntraIdCertificateRequest. */ - interface ISqlInstancesRotateEntraIdCertificateRequest { - - /** SqlInstancesRotateEntraIdCertificateRequest instance */ - instance?: (string|null); - - /** SqlInstancesRotateEntraIdCertificateRequest project */ - project?: (string|null); - - /** SqlInstancesRotateEntraIdCertificateRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest|null); - } - - /** Represents a SqlInstancesRotateEntraIdCertificateRequest. */ - class SqlInstancesRotateEntraIdCertificateRequest implements ISqlInstancesRotateEntraIdCertificateRequest { - - /** - * Constructs a new SqlInstancesRotateEntraIdCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest); - - /** SqlInstancesRotateEntraIdCertificateRequest instance. */ - public instance: string; - - /** SqlInstancesRotateEntraIdCertificateRequest project. */ - public project: string; - - /** SqlInstancesRotateEntraIdCertificateRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest|null); - - /** - * Creates a new SqlInstancesRotateEntraIdCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRotateEntraIdCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest): google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest; - - /** - * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @param message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @param message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest; - - /** - * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest; - - /** - * Verifies a SqlInstancesRotateEntraIdCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRotateEntraIdCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest; - - /** - * Creates a plain object from a SqlInstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRotateEntraIdCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRotateEntraIdCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRotateEntraIdCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesStartReplicaRequest. */ - interface ISqlInstancesStartReplicaRequest { - - /** SqlInstancesStartReplicaRequest instance */ - instance?: (string|null); - - /** SqlInstancesStartReplicaRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesStartReplicaRequest. */ - class SqlInstancesStartReplicaRequest implements ISqlInstancesStartReplicaRequest { - - /** - * Constructs a new SqlInstancesStartReplicaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest); - - /** SqlInstancesStartReplicaRequest instance. */ - public instance: string; - - /** SqlInstancesStartReplicaRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesStartReplicaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesStartReplicaRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest): google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest; - - /** - * Encodes the specified SqlInstancesStartReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest.verify|verify} messages. - * @param message SqlInstancesStartReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesStartReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest.verify|verify} messages. - * @param message SqlInstancesStartReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesStartReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest; - - /** - * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesStartReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest; - - /** - * Verifies a SqlInstancesStartReplicaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesStartReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesStartReplicaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest; - - /** - * Creates a plain object from a SqlInstancesStartReplicaRequest message. Also converts values to other types if specified. - * @param message SqlInstancesStartReplicaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesStartReplicaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesStartReplicaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesStopReplicaRequest. */ - interface ISqlInstancesStopReplicaRequest { - - /** SqlInstancesStopReplicaRequest instance */ - instance?: (string|null); - - /** SqlInstancesStopReplicaRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesStopReplicaRequest. */ - class SqlInstancesStopReplicaRequest implements ISqlInstancesStopReplicaRequest { - - /** - * Constructs a new SqlInstancesStopReplicaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest); - - /** SqlInstancesStopReplicaRequest instance. */ - public instance: string; - - /** SqlInstancesStopReplicaRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesStopReplicaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesStopReplicaRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest): google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest; - - /** - * Encodes the specified SqlInstancesStopReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest.verify|verify} messages. - * @param message SqlInstancesStopReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesStopReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest.verify|verify} messages. - * @param message SqlInstancesStopReplicaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesStopReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest; - - /** - * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesStopReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest; - - /** - * Verifies a SqlInstancesStopReplicaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesStopReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesStopReplicaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest; - - /** - * Creates a plain object from a SqlInstancesStopReplicaRequest message. Also converts values to other types if specified. - * @param message SqlInstancesStopReplicaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesStopReplicaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesStopReplicaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesTruncateLogRequest. */ - interface ISqlInstancesTruncateLogRequest { - - /** SqlInstancesTruncateLogRequest instance */ - instance?: (string|null); - - /** SqlInstancesTruncateLogRequest project */ - project?: (string|null); - - /** SqlInstancesTruncateLogRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesTruncateLogRequest|null); - } - - /** Represents a SqlInstancesTruncateLogRequest. */ - class SqlInstancesTruncateLogRequest implements ISqlInstancesTruncateLogRequest { - - /** - * Constructs a new SqlInstancesTruncateLogRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest); - - /** SqlInstancesTruncateLogRequest instance. */ - public instance: string; - - /** SqlInstancesTruncateLogRequest project. */ - public project: string; - - /** SqlInstancesTruncateLogRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesTruncateLogRequest|null); - - /** - * Creates a new SqlInstancesTruncateLogRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesTruncateLogRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest): google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest; - - /** - * Encodes the specified SqlInstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest.verify|verify} messages. - * @param message SqlInstancesTruncateLogRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest.verify|verify} messages. - * @param message SqlInstancesTruncateLogRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest; - - /** - * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest; - - /** - * Verifies a SqlInstancesTruncateLogRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesTruncateLogRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest; - - /** - * Creates a plain object from a SqlInstancesTruncateLogRequest message. Also converts values to other types if specified. - * @param message SqlInstancesTruncateLogRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesTruncateLogRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesTruncateLogRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesUpdateRequest. */ - interface ISqlInstancesUpdateRequest { - - /** SqlInstancesUpdateRequest instance */ - instance?: (string|null); - - /** SqlInstancesUpdateRequest project */ - project?: (string|null); - - /** SqlInstancesUpdateRequest body */ - body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); - } - - /** Represents a SqlInstancesUpdateRequest. */ - class SqlInstancesUpdateRequest implements ISqlInstancesUpdateRequest { - - /** - * Constructs a new SqlInstancesUpdateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest); - - /** SqlInstancesUpdateRequest instance. */ - public instance: string; - - /** SqlInstancesUpdateRequest project. */ - public project: string; - - /** SqlInstancesUpdateRequest body. */ - public body?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); - - /** - * Creates a new SqlInstancesUpdateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesUpdateRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest): google.cloud.sql.v1beta4.SqlInstancesUpdateRequest; - - /** - * Encodes the specified SqlInstancesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesUpdateRequest.verify|verify} messages. - * @param message SqlInstancesUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesUpdateRequest.verify|verify} messages. - * @param message SqlInstancesUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesUpdateRequest; - - /** - * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesUpdateRequest; - - /** - * Verifies a SqlInstancesUpdateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesUpdateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesUpdateRequest; - - /** - * Creates a plain object from a SqlInstancesUpdateRequest message. Also converts values to other types if specified. - * @param message SqlInstancesUpdateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesUpdateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesUpdateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesReencryptRequest. */ - interface ISqlInstancesReencryptRequest { - - /** SqlInstancesReencryptRequest instance */ - instance?: (string|null); - - /** SqlInstancesReencryptRequest project */ - project?: (string|null); - - /** SqlInstancesReencryptRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesReencryptRequest|null); - } - - /** Represents a SqlInstancesReencryptRequest. */ - class SqlInstancesReencryptRequest implements ISqlInstancesReencryptRequest { - - /** - * Constructs a new SqlInstancesReencryptRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest); - - /** SqlInstancesReencryptRequest instance. */ - public instance: string; - - /** SqlInstancesReencryptRequest project. */ - public project: string; - - /** SqlInstancesReencryptRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesReencryptRequest|null); - - /** - * Creates a new SqlInstancesReencryptRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesReencryptRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest): google.cloud.sql.v1beta4.SqlInstancesReencryptRequest; - - /** - * Encodes the specified SqlInstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReencryptRequest.verify|verify} messages. - * @param message SqlInstancesReencryptRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReencryptRequest.verify|verify} messages. - * @param message SqlInstancesReencryptRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesReencryptRequest; - - /** - * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesReencryptRequest; - - /** - * Verifies a SqlInstancesReencryptRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesReencryptRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesReencryptRequest; - - /** - * Creates a plain object from a SqlInstancesReencryptRequest message. Also converts values to other types if specified. - * @param message SqlInstancesReencryptRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesReencryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesReencryptRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesReencryptRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesReencryptRequest. */ - interface IInstancesReencryptRequest { - - /** InstancesReencryptRequest backupReencryptionConfig */ - backupReencryptionConfig?: (google.cloud.sql.v1beta4.IBackupReencryptionConfig|null); - } - - /** Represents an InstancesReencryptRequest. */ - class InstancesReencryptRequest implements IInstancesReencryptRequest { - - /** - * Constructs a new InstancesReencryptRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesReencryptRequest); - - /** InstancesReencryptRequest backupReencryptionConfig. */ - public backupReencryptionConfig?: (google.cloud.sql.v1beta4.IBackupReencryptionConfig|null); - - /** - * Creates a new InstancesReencryptRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesReencryptRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesReencryptRequest): google.cloud.sql.v1beta4.InstancesReencryptRequest; - - /** - * Encodes the specified InstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesReencryptRequest.verify|verify} messages. - * @param message InstancesReencryptRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesReencryptRequest.verify|verify} messages. - * @param message InstancesReencryptRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesReencryptRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesReencryptRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesReencryptRequest; - - /** - * Decodes an InstancesReencryptRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesReencryptRequest; - - /** - * Verifies an InstancesReencryptRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesReencryptRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesReencryptRequest; - - /** - * Creates a plain object from an InstancesReencryptRequest message. Also converts values to other types if specified. - * @param message InstancesReencryptRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesReencryptRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesReencryptRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesReencryptRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BackupReencryptionConfig. */ - interface IBackupReencryptionConfig { - - /** BackupReencryptionConfig backupLimit */ - backupLimit?: (number|null); - - /** BackupReencryptionConfig backupType */ - backupType?: (google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|keyof typeof google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|null); - } - - /** Represents a BackupReencryptionConfig. */ - class BackupReencryptionConfig implements IBackupReencryptionConfig { - - /** - * Constructs a new BackupReencryptionConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IBackupReencryptionConfig); - - /** BackupReencryptionConfig backupLimit. */ - public backupLimit?: (number|null); - - /** BackupReencryptionConfig backupType. */ - public backupType?: (google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|keyof typeof google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|null); - - /** - * Creates a new BackupReencryptionConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupReencryptionConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IBackupReencryptionConfig): google.cloud.sql.v1beta4.BackupReencryptionConfig; - - /** - * Encodes the specified BackupReencryptionConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupReencryptionConfig.verify|verify} messages. - * @param message BackupReencryptionConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IBackupReencryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupReencryptionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupReencryptionConfig.verify|verify} messages. - * @param message BackupReencryptionConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupReencryptionConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupReencryptionConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupReencryptionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupReencryptionConfig; - - /** - * Decodes a BackupReencryptionConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupReencryptionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupReencryptionConfig; - - /** - * Verifies a BackupReencryptionConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupReencryptionConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupReencryptionConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupReencryptionConfig; - - /** - * Creates a plain object from a BackupReencryptionConfig message. Also converts values to other types if specified. - * @param message BackupReencryptionConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.BackupReencryptionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupReencryptionConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupReencryptionConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace BackupReencryptionConfig { - - /** BackupType enum. */ - enum BackupType { - BACKUP_TYPE_UNSPECIFIED = 0, - AUTOMATED = 1, - ON_DEMAND = 2 - } - } - - /** Properties of a SqlInstancesRescheduleMaintenanceRequest. */ - interface ISqlInstancesRescheduleMaintenanceRequest { - - /** SqlInstancesRescheduleMaintenanceRequest instance */ - instance?: (string|null); - - /** SqlInstancesRescheduleMaintenanceRequest project */ - project?: (string|null); - - /** SqlInstancesRescheduleMaintenanceRequest body */ - body?: (google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody|null); - } - - /** Represents a SqlInstancesRescheduleMaintenanceRequest. */ - class SqlInstancesRescheduleMaintenanceRequest implements ISqlInstancesRescheduleMaintenanceRequest { - - /** - * Constructs a new SqlInstancesRescheduleMaintenanceRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest); - - /** SqlInstancesRescheduleMaintenanceRequest instance. */ - public instance: string; - - /** SqlInstancesRescheduleMaintenanceRequest project. */ - public project: string; - - /** SqlInstancesRescheduleMaintenanceRequest body. */ - public body?: (google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody|null); - - /** - * Creates a new SqlInstancesRescheduleMaintenanceRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRescheduleMaintenanceRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. - * @param message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. - * @param message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRescheduleMaintenanceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRescheduleMaintenanceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest; - - /** - * Verifies a SqlInstancesRescheduleMaintenanceRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRescheduleMaintenanceRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRescheduleMaintenanceRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest; - - /** - * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequest message. Also converts values to other types if specified. - * @param message SqlInstancesRescheduleMaintenanceRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRescheduleMaintenanceRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRescheduleMaintenanceRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesPerformDiskShrinkRequest. */ - interface ISqlInstancesPerformDiskShrinkRequest { - - /** SqlInstancesPerformDiskShrinkRequest instance */ - instance?: (string|null); - - /** SqlInstancesPerformDiskShrinkRequest project */ - project?: (string|null); - - /** SqlInstancesPerformDiskShrinkRequest body */ - body?: (google.cloud.sql.v1beta4.IPerformDiskShrinkContext|null); - } - - /** Represents a SqlInstancesPerformDiskShrinkRequest. */ - class SqlInstancesPerformDiskShrinkRequest implements ISqlInstancesPerformDiskShrinkRequest { - - /** - * Constructs a new SqlInstancesPerformDiskShrinkRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest); - - /** SqlInstancesPerformDiskShrinkRequest instance. */ - public instance: string; - - /** SqlInstancesPerformDiskShrinkRequest project. */ - public project: string; - - /** SqlInstancesPerformDiskShrinkRequest body. */ - public body?: (google.cloud.sql.v1beta4.IPerformDiskShrinkContext|null); - - /** - * Creates a new SqlInstancesPerformDiskShrinkRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesPerformDiskShrinkRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest): google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest; - - /** - * Encodes the specified SqlInstancesPerformDiskShrinkRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. - * @param message SqlInstancesPerformDiskShrinkRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesPerformDiskShrinkRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. - * @param message SqlInstancesPerformDiskShrinkRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesPerformDiskShrinkRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest; - - /** - * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesPerformDiskShrinkRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest; - - /** - * Verifies a SqlInstancesPerformDiskShrinkRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesPerformDiskShrinkRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesPerformDiskShrinkRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest; - - /** - * Creates a plain object from a SqlInstancesPerformDiskShrinkRequest message. Also converts values to other types if specified. - * @param message SqlInstancesPerformDiskShrinkRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesPerformDiskShrinkRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesPerformDiskShrinkRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** ExternalSyncParallelLevel enum. */ - enum ExternalSyncParallelLevel { - EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED = 0, - MIN = 1, - OPTIMAL = 2, - MAX = 3 - } - - /** Properties of an ExternalSyncSelectedObject. */ - interface IExternalSyncSelectedObject { - - /** ExternalSyncSelectedObject database */ - database?: (string|null); - } - - /** Represents an ExternalSyncSelectedObject. */ - class ExternalSyncSelectedObject implements IExternalSyncSelectedObject { - - /** - * Constructs a new ExternalSyncSelectedObject. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IExternalSyncSelectedObject); - - /** ExternalSyncSelectedObject database. */ - public database: string; - - /** - * Creates a new ExternalSyncSelectedObject instance using the specified properties. - * @param [properties] Properties to set - * @returns ExternalSyncSelectedObject instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IExternalSyncSelectedObject): google.cloud.sql.v1beta4.ExternalSyncSelectedObject; - - /** - * Encodes the specified ExternalSyncSelectedObject message. Does not implicitly {@link google.cloud.sql.v1beta4.ExternalSyncSelectedObject.verify|verify} messages. - * @param message ExternalSyncSelectedObject message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IExternalSyncSelectedObject, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExternalSyncSelectedObject message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExternalSyncSelectedObject.verify|verify} messages. - * @param message ExternalSyncSelectedObject message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IExternalSyncSelectedObject, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExternalSyncSelectedObject - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExternalSyncSelectedObject; - - /** - * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExternalSyncSelectedObject - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExternalSyncSelectedObject; - - /** - * Verifies an ExternalSyncSelectedObject message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ExternalSyncSelectedObject message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExternalSyncSelectedObject - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExternalSyncSelectedObject; - - /** - * Creates a plain object from an ExternalSyncSelectedObject message. Also converts values to other types if specified. - * @param message ExternalSyncSelectedObject - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ExternalSyncSelectedObject, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExternalSyncSelectedObject to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExternalSyncSelectedObject - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesVerifyExternalSyncSettingsRequest. */ - interface ISqlInstancesVerifyExternalSyncSettingsRequest { - - /** SqlInstancesVerifyExternalSyncSettingsRequest instance */ - instance?: (string|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest project */ - project?: (string|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly */ - verifyConnectionOnly?: (boolean|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest syncMode */ - syncMode?: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly */ - verifyReplicationOnly?: (boolean|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig */ - mysqlSyncConfig?: (google.cloud.sql.v1beta4.IMySqlSyncConfig|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest migrationType */ - migrationType?: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel */ - syncParallelLevel?: (google.cloud.sql.v1beta4.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1beta4.ExternalSyncParallelLevel|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects */ - selectedObjects?: (google.cloud.sql.v1beta4.IExternalSyncSelectedObject[]|null); - } - - /** Represents a SqlInstancesVerifyExternalSyncSettingsRequest. */ - class SqlInstancesVerifyExternalSyncSettingsRequest implements ISqlInstancesVerifyExternalSyncSettingsRequest { - - /** - * Constructs a new SqlInstancesVerifyExternalSyncSettingsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest); - - /** SqlInstancesVerifyExternalSyncSettingsRequest instance. */ - public instance: string; - - /** SqlInstancesVerifyExternalSyncSettingsRequest project. */ - public project: string; - - /** SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly. */ - public verifyConnectionOnly: boolean; - - /** SqlInstancesVerifyExternalSyncSettingsRequest syncMode. */ - public syncMode: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode); - - /** SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly. */ - public verifyReplicationOnly: boolean; - - /** SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig. */ - public mysqlSyncConfig?: (google.cloud.sql.v1beta4.IMySqlSyncConfig|null); - - /** SqlInstancesVerifyExternalSyncSettingsRequest migrationType. */ - public migrationType: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType); - - /** SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel. */ - public syncParallelLevel: (google.cloud.sql.v1beta4.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1beta4.ExternalSyncParallelLevel); - - /** SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects. */ - public selectedObjects: google.cloud.sql.v1beta4.IExternalSyncSelectedObject[]; - - /** SqlInstancesVerifyExternalSyncSettingsRequest syncConfig. */ - public syncConfig?: "mysqlSyncConfig"; - - /** - * Creates a new SqlInstancesVerifyExternalSyncSettingsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesVerifyExternalSyncSettingsRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. - * @param message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. - * @param message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesVerifyExternalSyncSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesVerifyExternalSyncSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest; - - /** - * Verifies a SqlInstancesVerifyExternalSyncSettingsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesVerifyExternalSyncSettingsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesVerifyExternalSyncSettingsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest; - - /** - * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsRequest message. Also converts values to other types if specified. - * @param message SqlInstancesVerifyExternalSyncSettingsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesVerifyExternalSyncSettingsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlInstancesVerifyExternalSyncSettingsRequest { - - /** ExternalSyncMode enum. */ - enum ExternalSyncMode { - EXTERNAL_SYNC_MODE_UNSPECIFIED = 0, - ONLINE = 1, - OFFLINE = 2 - } - - /** MigrationType enum. */ - enum MigrationType { - MIGRATION_TYPE_UNSPECIFIED = 0, - LOGICAL = 1, - PHYSICAL = 2 - } - } - - /** Properties of a SqlInstancesStartExternalSyncRequest. */ - interface ISqlInstancesStartExternalSyncRequest { - - /** SqlInstancesStartExternalSyncRequest instance */ - instance?: (string|null); - - /** SqlInstancesStartExternalSyncRequest project */ - project?: (string|null); - - /** SqlInstancesStartExternalSyncRequest syncMode */ - syncMode?: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null); - - /** SqlInstancesStartExternalSyncRequest skipVerification */ - skipVerification?: (boolean|null); - - /** SqlInstancesStartExternalSyncRequest mysqlSyncConfig */ - mysqlSyncConfig?: (google.cloud.sql.v1beta4.IMySqlSyncConfig|null); - - /** SqlInstancesStartExternalSyncRequest syncParallelLevel */ - syncParallelLevel?: (google.cloud.sql.v1beta4.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1beta4.ExternalSyncParallelLevel|null); - - /** SqlInstancesStartExternalSyncRequest migrationType */ - migrationType?: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null); - - /** SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled */ - replicaOverwriteEnabled?: (boolean|null); - } - - /** Represents a SqlInstancesStartExternalSyncRequest. */ - class SqlInstancesStartExternalSyncRequest implements ISqlInstancesStartExternalSyncRequest { - - /** - * Constructs a new SqlInstancesStartExternalSyncRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest); - - /** SqlInstancesStartExternalSyncRequest instance. */ - public instance: string; - - /** SqlInstancesStartExternalSyncRequest project. */ - public project: string; - - /** SqlInstancesStartExternalSyncRequest syncMode. */ - public syncMode: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode); - - /** SqlInstancesStartExternalSyncRequest skipVerification. */ - public skipVerification: boolean; - - /** SqlInstancesStartExternalSyncRequest mysqlSyncConfig. */ - public mysqlSyncConfig?: (google.cloud.sql.v1beta4.IMySqlSyncConfig|null); - - /** SqlInstancesStartExternalSyncRequest syncParallelLevel. */ - public syncParallelLevel: (google.cloud.sql.v1beta4.ExternalSyncParallelLevel|keyof typeof google.cloud.sql.v1beta4.ExternalSyncParallelLevel); - - /** SqlInstancesStartExternalSyncRequest migrationType. */ - public migrationType: (google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType); - - /** SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled. */ - public replicaOverwriteEnabled: boolean; - - /** SqlInstancesStartExternalSyncRequest syncConfig. */ - public syncConfig?: "mysqlSyncConfig"; - - /** - * Creates a new SqlInstancesStartExternalSyncRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesStartExternalSyncRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest): google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest; - - /** - * Encodes the specified SqlInstancesStartExternalSyncRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.verify|verify} messages. - * @param message SqlInstancesStartExternalSyncRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesStartExternalSyncRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.verify|verify} messages. - * @param message SqlInstancesStartExternalSyncRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesStartExternalSyncRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest; - - /** - * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesStartExternalSyncRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest; - - /** - * Verifies a SqlInstancesStartExternalSyncRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesStartExternalSyncRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesStartExternalSyncRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest; - - /** - * Creates a plain object from a SqlInstancesStartExternalSyncRequest message. Also converts values to other types if specified. - * @param message SqlInstancesStartExternalSyncRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesStartExternalSyncRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesStartExternalSyncRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesResetReplicaSizeRequest. */ - interface ISqlInstancesResetReplicaSizeRequest { - - /** SqlInstancesResetReplicaSizeRequest instance */ - instance?: (string|null); - - /** SqlInstancesResetReplicaSizeRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesResetReplicaSizeRequest. */ - class SqlInstancesResetReplicaSizeRequest implements ISqlInstancesResetReplicaSizeRequest { - - /** - * Constructs a new SqlInstancesResetReplicaSizeRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest); - - /** SqlInstancesResetReplicaSizeRequest instance. */ - public instance: string; - - /** SqlInstancesResetReplicaSizeRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesResetReplicaSizeRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesResetReplicaSizeRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest): google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest; - - /** - * Encodes the specified SqlInstancesResetReplicaSizeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. - * @param message SqlInstancesResetReplicaSizeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesResetReplicaSizeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. - * @param message SqlInstancesResetReplicaSizeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesResetReplicaSizeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest; - - /** - * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesResetReplicaSizeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest; - - /** - * Verifies a SqlInstancesResetReplicaSizeRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesResetReplicaSizeRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesResetReplicaSizeRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest; - - /** - * Creates a plain object from a SqlInstancesResetReplicaSizeRequest message. Also converts values to other types if specified. - * @param message SqlInstancesResetReplicaSizeRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesResetReplicaSizeRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesResetReplicaSizeRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlOperationsGetRequest. */ - interface ISqlOperationsGetRequest { - - /** SqlOperationsGetRequest operation */ - operation?: (string|null); - - /** SqlOperationsGetRequest project */ - project?: (string|null); - } - - /** Represents a SqlOperationsGetRequest. */ - class SqlOperationsGetRequest implements ISqlOperationsGetRequest { - - /** - * Constructs a new SqlOperationsGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlOperationsGetRequest); - - /** SqlOperationsGetRequest operation. */ - public operation: string; - - /** SqlOperationsGetRequest project. */ - public project: string; - - /** - * Creates a new SqlOperationsGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlOperationsGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlOperationsGetRequest): google.cloud.sql.v1beta4.SqlOperationsGetRequest; - - /** - * Encodes the specified SqlOperationsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsGetRequest.verify|verify} messages. - * @param message SqlOperationsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlOperationsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlOperationsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsGetRequest.verify|verify} messages. - * @param message SqlOperationsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlOperationsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlOperationsGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlOperationsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlOperationsGetRequest; - - /** - * Decodes a SqlOperationsGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlOperationsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlOperationsGetRequest; - - /** - * Verifies a SqlOperationsGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlOperationsGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlOperationsGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlOperationsGetRequest; - - /** - * Creates a plain object from a SqlOperationsGetRequest message. Also converts values to other types if specified. - * @param message SqlOperationsGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlOperationsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlOperationsGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlOperationsGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlOperationsListRequest. */ - interface ISqlOperationsListRequest { - - /** SqlOperationsListRequest instance */ - instance?: (string|null); - - /** SqlOperationsListRequest maxResults */ - maxResults?: (number|null); - - /** SqlOperationsListRequest pageToken */ - pageToken?: (string|null); - - /** SqlOperationsListRequest project */ - project?: (string|null); - } - - /** Represents a SqlOperationsListRequest. */ - class SqlOperationsListRequest implements ISqlOperationsListRequest { - - /** - * Constructs a new SqlOperationsListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlOperationsListRequest); - - /** SqlOperationsListRequest instance. */ - public instance: string; - - /** SqlOperationsListRequest maxResults. */ - public maxResults: number; - - /** SqlOperationsListRequest pageToken. */ - public pageToken: string; - - /** SqlOperationsListRequest project. */ - public project: string; - - /** - * Creates a new SqlOperationsListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlOperationsListRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlOperationsListRequest): google.cloud.sql.v1beta4.SqlOperationsListRequest; - - /** - * Encodes the specified SqlOperationsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsListRequest.verify|verify} messages. - * @param message SqlOperationsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlOperationsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlOperationsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsListRequest.verify|verify} messages. - * @param message SqlOperationsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlOperationsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlOperationsListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlOperationsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlOperationsListRequest; - - /** - * Decodes a SqlOperationsListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlOperationsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlOperationsListRequest; - - /** - * Verifies a SqlOperationsListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlOperationsListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlOperationsListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlOperationsListRequest; - - /** - * Creates a plain object from a SqlOperationsListRequest message. Also converts values to other types if specified. - * @param message SqlOperationsListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlOperationsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlOperationsListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlOperationsListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlOperationsCancelRequest. */ - interface ISqlOperationsCancelRequest { - - /** SqlOperationsCancelRequest operation */ - operation?: (string|null); - - /** SqlOperationsCancelRequest project */ - project?: (string|null); - } - - /** Represents a SqlOperationsCancelRequest. */ - class SqlOperationsCancelRequest implements ISqlOperationsCancelRequest { - - /** - * Constructs a new SqlOperationsCancelRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest); - - /** SqlOperationsCancelRequest operation. */ - public operation: string; - - /** SqlOperationsCancelRequest project. */ - public project: string; - - /** - * Creates a new SqlOperationsCancelRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlOperationsCancelRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest): google.cloud.sql.v1beta4.SqlOperationsCancelRequest; - - /** - * Encodes the specified SqlOperationsCancelRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsCancelRequest.verify|verify} messages. - * @param message SqlOperationsCancelRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlOperationsCancelRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsCancelRequest.verify|verify} messages. - * @param message SqlOperationsCancelRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlOperationsCancelRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlOperationsCancelRequest; - - /** - * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlOperationsCancelRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlOperationsCancelRequest; - - /** - * Verifies a SqlOperationsCancelRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlOperationsCancelRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlOperationsCancelRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlOperationsCancelRequest; - - /** - * Creates a plain object from a SqlOperationsCancelRequest message. Also converts values to other types if specified. - * @param message SqlOperationsCancelRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlOperationsCancelRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlOperationsCancelRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlOperationsCancelRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesCreateEphemeralCertRequest. */ - interface ISqlInstancesCreateEphemeralCertRequest { - - /** SqlInstancesCreateEphemeralCertRequest instance */ - instance?: (string|null); - - /** SqlInstancesCreateEphemeralCertRequest project */ - project?: (string|null); - - /** SqlInstancesCreateEphemeralCertRequest body */ - body?: (google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest|null); - } - - /** Represents a SqlInstancesCreateEphemeralCertRequest. */ - class SqlInstancesCreateEphemeralCertRequest implements ISqlInstancesCreateEphemeralCertRequest { - - /** - * Constructs a new SqlInstancesCreateEphemeralCertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest); - - /** SqlInstancesCreateEphemeralCertRequest instance. */ - public instance: string; - - /** SqlInstancesCreateEphemeralCertRequest project. */ - public project: string; - - /** SqlInstancesCreateEphemeralCertRequest body. */ - public body?: (google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest|null); - - /** - * Creates a new SqlInstancesCreateEphemeralCertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesCreateEphemeralCertRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest): google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest; - - /** - * Encodes the specified SqlInstancesCreateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. - * @param message SqlInstancesCreateEphemeralCertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesCreateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. - * @param message SqlInstancesCreateEphemeralCertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesCreateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest; - - /** - * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesCreateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest; - - /** - * Verifies a SqlInstancesCreateEphemeralCertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesCreateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesCreateEphemeralCertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest; - - /** - * Creates a plain object from a SqlInstancesCreateEphemeralCertRequest message. Also converts values to other types if specified. - * @param message SqlInstancesCreateEphemeralCertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesCreateEphemeralCertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesCreateEphemeralCertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlSslCertsDeleteRequest. */ - interface ISqlSslCertsDeleteRequest { - - /** SqlSslCertsDeleteRequest instance */ - instance?: (string|null); - - /** SqlSslCertsDeleteRequest project */ - project?: (string|null); - - /** SqlSslCertsDeleteRequest sha1Fingerprint */ - sha1Fingerprint?: (string|null); - } - - /** Represents a SqlSslCertsDeleteRequest. */ - class SqlSslCertsDeleteRequest implements ISqlSslCertsDeleteRequest { - - /** - * Constructs a new SqlSslCertsDeleteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest); - - /** SqlSslCertsDeleteRequest instance. */ - public instance: string; - - /** SqlSslCertsDeleteRequest project. */ - public project: string; - - /** SqlSslCertsDeleteRequest sha1Fingerprint. */ - public sha1Fingerprint: string; - - /** - * Creates a new SqlSslCertsDeleteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlSslCertsDeleteRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest): google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest; - - /** - * Encodes the specified SqlSslCertsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest.verify|verify} messages. - * @param message SqlSslCertsDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlSslCertsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest.verify|verify} messages. - * @param message SqlSslCertsDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlSslCertsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest; - - /** - * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlSslCertsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest; - - /** - * Verifies a SqlSslCertsDeleteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlSslCertsDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlSslCertsDeleteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest; - - /** - * Creates a plain object from a SqlSslCertsDeleteRequest message. Also converts values to other types if specified. - * @param message SqlSslCertsDeleteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlSslCertsDeleteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlSslCertsDeleteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlSslCertsGetRequest. */ - interface ISqlSslCertsGetRequest { - - /** SqlSslCertsGetRequest instance */ - instance?: (string|null); - - /** SqlSslCertsGetRequest project */ - project?: (string|null); - - /** SqlSslCertsGetRequest sha1Fingerprint */ - sha1Fingerprint?: (string|null); - } - - /** Represents a SqlSslCertsGetRequest. */ - class SqlSslCertsGetRequest implements ISqlSslCertsGetRequest { - - /** - * Constructs a new SqlSslCertsGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest); - - /** SqlSslCertsGetRequest instance. */ - public instance: string; - - /** SqlSslCertsGetRequest project. */ - public project: string; - - /** SqlSslCertsGetRequest sha1Fingerprint. */ - public sha1Fingerprint: string; - - /** - * Creates a new SqlSslCertsGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlSslCertsGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest): google.cloud.sql.v1beta4.SqlSslCertsGetRequest; - - /** - * Encodes the specified SqlSslCertsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsGetRequest.verify|verify} messages. - * @param message SqlSslCertsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlSslCertsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsGetRequest.verify|verify} messages. - * @param message SqlSslCertsGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlSslCertsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlSslCertsGetRequest; - - /** - * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlSslCertsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlSslCertsGetRequest; - - /** - * Verifies a SqlSslCertsGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlSslCertsGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlSslCertsGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlSslCertsGetRequest; - - /** - * Creates a plain object from a SqlSslCertsGetRequest message. Also converts values to other types if specified. - * @param message SqlSslCertsGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlSslCertsGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlSslCertsGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlSslCertsGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlSslCertsInsertRequest. */ - interface ISqlSslCertsInsertRequest { - - /** SqlSslCertsInsertRequest instance */ - instance?: (string|null); - - /** SqlSslCertsInsertRequest project */ - project?: (string|null); - - /** SqlSslCertsInsertRequest body */ - body?: (google.cloud.sql.v1beta4.ISslCertsInsertRequest|null); - } - - /** Represents a SqlSslCertsInsertRequest. */ - class SqlSslCertsInsertRequest implements ISqlSslCertsInsertRequest { - - /** - * Constructs a new SqlSslCertsInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest); - - /** SqlSslCertsInsertRequest instance. */ - public instance: string; - - /** SqlSslCertsInsertRequest project. */ - public project: string; - - /** SqlSslCertsInsertRequest body. */ - public body?: (google.cloud.sql.v1beta4.ISslCertsInsertRequest|null); - - /** - * Creates a new SqlSslCertsInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlSslCertsInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest): google.cloud.sql.v1beta4.SqlSslCertsInsertRequest; - - /** - * Encodes the specified SqlSslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsInsertRequest.verify|verify} messages. - * @param message SqlSslCertsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlSslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsInsertRequest.verify|verify} messages. - * @param message SqlSslCertsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlSslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlSslCertsInsertRequest; - - /** - * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlSslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlSslCertsInsertRequest; - - /** - * Verifies a SqlSslCertsInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlSslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlSslCertsInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlSslCertsInsertRequest; - - /** - * Creates a plain object from a SqlSslCertsInsertRequest message. Also converts values to other types if specified. - * @param message SqlSslCertsInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlSslCertsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlSslCertsInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlSslCertsInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlSslCertsListRequest. */ - interface ISqlSslCertsListRequest { - - /** SqlSslCertsListRequest instance */ - instance?: (string|null); - - /** SqlSslCertsListRequest project */ - project?: (string|null); - } - - /** Represents a SqlSslCertsListRequest. */ - class SqlSslCertsListRequest implements ISqlSslCertsListRequest { - - /** - * Constructs a new SqlSslCertsListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlSslCertsListRequest); - - /** SqlSslCertsListRequest instance. */ - public instance: string; - - /** SqlSslCertsListRequest project. */ - public project: string; - - /** - * Creates a new SqlSslCertsListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlSslCertsListRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlSslCertsListRequest): google.cloud.sql.v1beta4.SqlSslCertsListRequest; - - /** - * Encodes the specified SqlSslCertsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsListRequest.verify|verify} messages. - * @param message SqlSslCertsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlSslCertsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlSslCertsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsListRequest.verify|verify} messages. - * @param message SqlSslCertsListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlSslCertsListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlSslCertsListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlSslCertsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlSslCertsListRequest; - - /** - * Decodes a SqlSslCertsListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlSslCertsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlSslCertsListRequest; - - /** - * Verifies a SqlSslCertsListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlSslCertsListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlSslCertsListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlSslCertsListRequest; - - /** - * Creates a plain object from a SqlSslCertsListRequest message. Also converts values to other types if specified. - * @param message SqlSslCertsListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlSslCertsListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlSslCertsListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlSslCertsListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesGetDiskShrinkConfigRequest. */ - interface ISqlInstancesGetDiskShrinkConfigRequest { - - /** SqlInstancesGetDiskShrinkConfigRequest instance */ - instance?: (string|null); - - /** SqlInstancesGetDiskShrinkConfigRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesGetDiskShrinkConfigRequest. */ - class SqlInstancesGetDiskShrinkConfigRequest implements ISqlInstancesGetDiskShrinkConfigRequest { - - /** - * Constructs a new SqlInstancesGetDiskShrinkConfigRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest); - - /** SqlInstancesGetDiskShrinkConfigRequest instance. */ - public instance: string; - - /** SqlInstancesGetDiskShrinkConfigRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesGetDiskShrinkConfigRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesGetDiskShrinkConfigRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. - * @param message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. - * @param message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesGetDiskShrinkConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesGetDiskShrinkConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest; - - /** - * Verifies a SqlInstancesGetDiskShrinkConfigRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesGetDiskShrinkConfigRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesGetDiskShrinkConfigRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest; - - /** - * Creates a plain object from a SqlInstancesGetDiskShrinkConfigRequest message. Also converts values to other types if specified. - * @param message SqlInstancesGetDiskShrinkConfigRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesGetDiskShrinkConfigRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesGetDiskShrinkConfigRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesGetLatestRecoveryTimeRequest. */ - interface ISqlInstancesGetLatestRecoveryTimeRequest { - - /** SqlInstancesGetLatestRecoveryTimeRequest instance */ - instance?: (string|null); - - /** SqlInstancesGetLatestRecoveryTimeRequest project */ - project?: (string|null); - - /** SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime */ - sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a SqlInstancesGetLatestRecoveryTimeRequest. */ - class SqlInstancesGetLatestRecoveryTimeRequest implements ISqlInstancesGetLatestRecoveryTimeRequest { - - /** - * Constructs a new SqlInstancesGetLatestRecoveryTimeRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest); - - /** SqlInstancesGetLatestRecoveryTimeRequest instance. */ - public instance: string; - - /** SqlInstancesGetLatestRecoveryTimeRequest project. */ - public project: string; - - /** SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime. */ - public sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new SqlInstancesGetLatestRecoveryTimeRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesGetLatestRecoveryTimeRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. - * @param message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. - * @param message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesGetLatestRecoveryTimeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesGetLatestRecoveryTimeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest; - - /** - * Verifies a SqlInstancesGetLatestRecoveryTimeRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesGetLatestRecoveryTimeRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesGetLatestRecoveryTimeRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest; - - /** - * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeRequest message. Also converts values to other types if specified. - * @param message SqlInstancesGetLatestRecoveryTimeRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesGetLatestRecoveryTimeRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesGetLatestRecoveryTimeRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesGetLatestRecoveryTimeResponse. */ - interface ISqlInstancesGetLatestRecoveryTimeResponse { - - /** SqlInstancesGetLatestRecoveryTimeResponse kind */ - kind?: (string|null); - - /** SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime */ - latestRecoveryTime?: (google.protobuf.ITimestamp|null); - - /** SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime */ - earliestRecoveryTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a SqlInstancesGetLatestRecoveryTimeResponse. */ - class SqlInstancesGetLatestRecoveryTimeResponse implements ISqlInstancesGetLatestRecoveryTimeResponse { - - /** - * Constructs a new SqlInstancesGetLatestRecoveryTimeResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse); - - /** SqlInstancesGetLatestRecoveryTimeResponse kind. */ - public kind: string; - - /** SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime. */ - public latestRecoveryTime?: (google.protobuf.ITimestamp|null); - - /** SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime. */ - public earliestRecoveryTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new SqlInstancesGetLatestRecoveryTimeResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesGetLatestRecoveryTimeResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. - * @param message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. - * @param message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesGetLatestRecoveryTimeResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesGetLatestRecoveryTimeResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse; - - /** - * Verifies a SqlInstancesGetLatestRecoveryTimeResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesGetLatestRecoveryTimeResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesGetLatestRecoveryTimeResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse; - - /** - * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeResponse message. Also converts values to other types if specified. - * @param message SqlInstancesGetLatestRecoveryTimeResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesGetLatestRecoveryTimeResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesGetLatestRecoveryTimeResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesExecuteSqlRequest. */ - interface ISqlInstancesExecuteSqlRequest { - - /** SqlInstancesExecuteSqlRequest instance */ - instance?: (string|null); - - /** SqlInstancesExecuteSqlRequest project */ - project?: (string|null); - - /** SqlInstancesExecuteSqlRequest body */ - body?: (google.cloud.sql.v1beta4.IExecuteSqlPayload|null); - } - - /** Represents a SqlInstancesExecuteSqlRequest. */ - class SqlInstancesExecuteSqlRequest implements ISqlInstancesExecuteSqlRequest { - - /** - * Constructs a new SqlInstancesExecuteSqlRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest); - - /** SqlInstancesExecuteSqlRequest instance. */ - public instance: string; - - /** SqlInstancesExecuteSqlRequest project. */ - public project: string; - - /** SqlInstancesExecuteSqlRequest body. */ - public body?: (google.cloud.sql.v1beta4.IExecuteSqlPayload|null); - - /** - * Creates a new SqlInstancesExecuteSqlRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesExecuteSqlRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest; - - /** - * Encodes the specified SqlInstancesExecuteSqlRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest.verify|verify} messages. - * @param message SqlInstancesExecuteSqlRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesExecuteSqlRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest.verify|verify} messages. - * @param message SqlInstancesExecuteSqlRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesExecuteSqlRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest; - - /** - * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesExecuteSqlRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest; - - /** - * Verifies a SqlInstancesExecuteSqlRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesExecuteSqlRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesExecuteSqlRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest; - - /** - * Creates a plain object from a SqlInstancesExecuteSqlRequest message. Also converts values to other types if specified. - * @param message SqlInstancesExecuteSqlRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesExecuteSqlRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesExecuteSqlRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesReleaseSsrsLeaseRequest. */ - interface ISqlInstancesReleaseSsrsLeaseRequest { - - /** SqlInstancesReleaseSsrsLeaseRequest instance */ - instance?: (string|null); - - /** SqlInstancesReleaseSsrsLeaseRequest project */ - project?: (string|null); - } - - /** Represents a SqlInstancesReleaseSsrsLeaseRequest. */ - class SqlInstancesReleaseSsrsLeaseRequest implements ISqlInstancesReleaseSsrsLeaseRequest { - - /** - * Constructs a new SqlInstancesReleaseSsrsLeaseRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest); - - /** SqlInstancesReleaseSsrsLeaseRequest instance. */ - public instance: string; - - /** SqlInstancesReleaseSsrsLeaseRequest project. */ - public project: string; - - /** - * Creates a new SqlInstancesReleaseSsrsLeaseRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesReleaseSsrsLeaseRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. - * @param message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. - * @param message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesReleaseSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesReleaseSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest; - - /** - * Verifies a SqlInstancesReleaseSsrsLeaseRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesReleaseSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesReleaseSsrsLeaseRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest; - - /** - * Creates a plain object from a SqlInstancesReleaseSsrsLeaseRequest message. Also converts values to other types if specified. - * @param message SqlInstancesReleaseSsrsLeaseRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesReleaseSsrsLeaseRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesReleaseSsrsLeaseRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesReleaseSsrsLeaseResponse. */ - interface ISqlInstancesReleaseSsrsLeaseResponse { - - /** SqlInstancesReleaseSsrsLeaseResponse operationId */ - operationId?: (string|null); - } - - /** Represents a SqlInstancesReleaseSsrsLeaseResponse. */ - class SqlInstancesReleaseSsrsLeaseResponse implements ISqlInstancesReleaseSsrsLeaseResponse { - - /** - * Constructs a new SqlInstancesReleaseSsrsLeaseResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse); - - /** SqlInstancesReleaseSsrsLeaseResponse operationId. */ - public operationId: string; - - /** - * Creates a new SqlInstancesReleaseSsrsLeaseResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesReleaseSsrsLeaseResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. - * @param message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. - * @param message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesReleaseSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesReleaseSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse; - - /** - * Verifies a SqlInstancesReleaseSsrsLeaseResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesReleaseSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesReleaseSsrsLeaseResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse; - - /** - * Creates a plain object from a SqlInstancesReleaseSsrsLeaseResponse message. Also converts values to other types if specified. - * @param message SqlInstancesReleaseSsrsLeaseResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesReleaseSsrsLeaseResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesReleaseSsrsLeaseResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ExecuteSqlPayload. */ - interface IExecuteSqlPayload { - - /** ExecuteSqlPayload user */ - user?: (string|null); - - /** ExecuteSqlPayload sqlStatement */ - sqlStatement?: (string|null); - - /** ExecuteSqlPayload database */ - database?: (string|null); - - /** ExecuteSqlPayload autoIamAuthn */ - autoIamAuthn?: (boolean|null); - - /** ExecuteSqlPayload rowLimit */ - rowLimit?: (number|Long|string|null); - - /** ExecuteSqlPayload partialResultMode */ - partialResultMode?: (google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode|keyof typeof google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode|null); - - /** ExecuteSqlPayload application */ - application?: (string|null); - } - - /** Represents an ExecuteSqlPayload. */ - class ExecuteSqlPayload implements IExecuteSqlPayload { - - /** - * Constructs a new ExecuteSqlPayload. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IExecuteSqlPayload); - - /** ExecuteSqlPayload user. */ - public user: string; - - /** ExecuteSqlPayload sqlStatement. */ - public sqlStatement: string; - - /** ExecuteSqlPayload database. */ - public database: string; - - /** ExecuteSqlPayload autoIamAuthn. */ - public autoIamAuthn?: (boolean|null); - - /** ExecuteSqlPayload rowLimit. */ - public rowLimit: (number|Long|string); - - /** ExecuteSqlPayload partialResultMode. */ - public partialResultMode: (google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode|keyof typeof google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode); - - /** ExecuteSqlPayload application. */ - public application: string; - - /** ExecuteSqlPayload userPassword. */ - public userPassword?: "autoIamAuthn"; - - /** - * Creates a new ExecuteSqlPayload instance using the specified properties. - * @param [properties] Properties to set - * @returns ExecuteSqlPayload instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IExecuteSqlPayload): google.cloud.sql.v1beta4.ExecuteSqlPayload; - - /** - * Encodes the specified ExecuteSqlPayload message. Does not implicitly {@link google.cloud.sql.v1beta4.ExecuteSqlPayload.verify|verify} messages. - * @param message ExecuteSqlPayload message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IExecuteSqlPayload, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExecuteSqlPayload message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExecuteSqlPayload.verify|verify} messages. - * @param message ExecuteSqlPayload message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IExecuteSqlPayload, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExecuteSqlPayload message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExecuteSqlPayload - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExecuteSqlPayload; - - /** - * Decodes an ExecuteSqlPayload message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExecuteSqlPayload - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExecuteSqlPayload; - - /** - * Verifies an ExecuteSqlPayload message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ExecuteSqlPayload message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExecuteSqlPayload - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExecuteSqlPayload; - - /** - * Creates a plain object from an ExecuteSqlPayload message. Also converts values to other types if specified. - * @param message ExecuteSqlPayload - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ExecuteSqlPayload, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExecuteSqlPayload to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExecuteSqlPayload - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ExecuteSqlPayload { - - /** PartialResultMode enum. */ - enum PartialResultMode { - PARTIAL_RESULT_MODE_UNSPECIFIED = 0, - FAIL_PARTIAL_RESULT = 1, - ALLOW_PARTIAL_RESULT = 2 - } - } - - /** Properties of a SqlInstancesExecuteSqlResponse. */ - interface ISqlInstancesExecuteSqlResponse { - - /** SqlInstancesExecuteSqlResponse messages */ - messages?: (google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage[]|null); - - /** SqlInstancesExecuteSqlResponse metadata */ - metadata?: (google.cloud.sql.v1beta4.IMetadata|null); - - /** SqlInstancesExecuteSqlResponse results */ - results?: (google.cloud.sql.v1beta4.IQueryResult[]|null); - - /** SqlInstancesExecuteSqlResponse status */ - status?: (google.rpc.IStatus|null); - } - - /** Represents a SqlInstancesExecuteSqlResponse. */ - class SqlInstancesExecuteSqlResponse implements ISqlInstancesExecuteSqlResponse { - - /** - * Constructs a new SqlInstancesExecuteSqlResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse); - - /** SqlInstancesExecuteSqlResponse messages. */ - public messages: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage[]; - - /** SqlInstancesExecuteSqlResponse metadata. */ - public metadata?: (google.cloud.sql.v1beta4.IMetadata|null); - - /** SqlInstancesExecuteSqlResponse results. */ - public results: google.cloud.sql.v1beta4.IQueryResult[]; - - /** SqlInstancesExecuteSqlResponse status. */ - public status?: (google.rpc.IStatus|null); - - /** - * Creates a new SqlInstancesExecuteSqlResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesExecuteSqlResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse; - - /** - * Encodes the specified SqlInstancesExecuteSqlResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.verify|verify} messages. - * @param message SqlInstancesExecuteSqlResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesExecuteSqlResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.verify|verify} messages. - * @param message SqlInstancesExecuteSqlResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesExecuteSqlResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse; - - /** - * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesExecuteSqlResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse; - - /** - * Verifies a SqlInstancesExecuteSqlResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesExecuteSqlResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesExecuteSqlResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse; - - /** - * Creates a plain object from a SqlInstancesExecuteSqlResponse message. Also converts values to other types if specified. - * @param message SqlInstancesExecuteSqlResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesExecuteSqlResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesExecuteSqlResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlInstancesExecuteSqlResponse { - - /** Properties of a Message. */ - interface IMessage { - - /** Message message */ - message?: (string|null); - - /** Message severity */ - severity?: (string|null); - } - - /** Represents a Message. */ - class Message implements IMessage { - - /** - * Constructs a new Message. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage); - - /** Message message. */ - public message?: (string|null); - - /** Message severity. */ - public severity?: (string|null); - - /** - * Creates a new Message instance using the specified properties. - * @param [properties] Properties to set - * @returns Message instance - */ - public static create(properties?: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message; - - /** - * Encodes the specified Message message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. - * @param message Message message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. - * @param message Message message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Message message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message; - - /** - * Decodes a Message message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message; - - /** - * Verifies a Message message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Message message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Message - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message; - - /** - * Creates a plain object from a Message message. Also converts values to other types if specified. - * @param message Message - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Message to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Message - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a QueryResult. */ - interface IQueryResult { - - /** QueryResult columns */ - columns?: (google.cloud.sql.v1beta4.IColumn[]|null); - - /** QueryResult rows */ - rows?: (google.cloud.sql.v1beta4.IRow[]|null); - - /** QueryResult message */ - message?: (string|null); - - /** QueryResult partialResult */ - partialResult?: (boolean|null); - - /** QueryResult status */ - status?: (google.rpc.IStatus|null); - } - - /** Represents a QueryResult. */ - class QueryResult implements IQueryResult { - - /** - * Constructs a new QueryResult. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IQueryResult); - - /** QueryResult columns. */ - public columns: google.cloud.sql.v1beta4.IColumn[]; - - /** QueryResult rows. */ - public rows: google.cloud.sql.v1beta4.IRow[]; - - /** QueryResult message. */ - public message: string; - - /** QueryResult partialResult. */ - public partialResult: boolean; - - /** QueryResult status. */ - public status?: (google.rpc.IStatus|null); - - /** - * Creates a new QueryResult instance using the specified properties. - * @param [properties] Properties to set - * @returns QueryResult instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IQueryResult): google.cloud.sql.v1beta4.QueryResult; - - /** - * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.sql.v1beta4.QueryResult.verify|verify} messages. - * @param message QueryResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.QueryResult.verify|verify} messages. - * @param message QueryResult message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IQueryResult, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a QueryResult message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns QueryResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.QueryResult; - - /** - * Decodes a QueryResult message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns QueryResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.QueryResult; - - /** - * Verifies a QueryResult message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns QueryResult - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.QueryResult; - - /** - * Creates a plain object from a QueryResult message. Also converts values to other types if specified. - * @param message QueryResult - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.QueryResult, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this QueryResult to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for QueryResult - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Column. */ - interface IColumn { - - /** Column name */ - name?: (string|null); - - /** Column type */ - type?: (string|null); - } - - /** Represents a Column. */ - class Column implements IColumn { - - /** - * Constructs a new Column. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IColumn); - - /** Column name. */ - public name: string; - - /** Column type. */ - public type: string; - - /** - * Creates a new Column instance using the specified properties. - * @param [properties] Properties to set - * @returns Column instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IColumn): google.cloud.sql.v1beta4.Column; - - /** - * Encodes the specified Column message. Does not implicitly {@link google.cloud.sql.v1beta4.Column.verify|verify} messages. - * @param message Column message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IColumn, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Column message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Column.verify|verify} messages. - * @param message Column message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IColumn, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Column message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Column - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Column; - - /** - * Decodes a Column message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Column - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Column; - - /** - * Verifies a Column message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Column message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Column - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Column; - - /** - * Creates a plain object from a Column message. Also converts values to other types if specified. - * @param message Column - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.Column, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Column to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Column - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Row. */ - interface IRow { - - /** Row values */ - values?: (google.cloud.sql.v1beta4.IValue[]|null); - } - - /** Represents a Row. */ - class Row implements IRow { - - /** - * Constructs a new Row. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IRow); - - /** Row values. */ - public values: google.cloud.sql.v1beta4.IValue[]; - - /** - * Creates a new Row instance using the specified properties. - * @param [properties] Properties to set - * @returns Row instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IRow): google.cloud.sql.v1beta4.Row; - - /** - * Encodes the specified Row message. Does not implicitly {@link google.cloud.sql.v1beta4.Row.verify|verify} messages. - * @param message Row message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IRow, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Row message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Row.verify|verify} messages. - * @param message Row message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IRow, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Row message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Row - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Row; - - /** - * Decodes a Row message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Row - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Row; - - /** - * Verifies a Row message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Row message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Row - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Row; - - /** - * Creates a plain object from a Row message. Also converts values to other types if specified. - * @param message Row - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.Row, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Row to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Row - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Value. */ - interface IValue { - - /** Value value */ - value?: (string|null); - - /** Value nullValue */ - nullValue?: (boolean|null); - } - - /** Represents a Value. */ - class Value implements IValue { - - /** - * Constructs a new Value. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IValue); - - /** Value value. */ - public value: string; - - /** Value nullValue. */ - public nullValue: boolean; - - /** - * Creates a new Value instance using the specified properties. - * @param [properties] Properties to set - * @returns Value instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IValue): google.cloud.sql.v1beta4.Value; - - /** - * Encodes the specified Value message. Does not implicitly {@link google.cloud.sql.v1beta4.Value.verify|verify} messages. - * @param message Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Value message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Value.verify|verify} messages. - * @param message Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Value message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Value; - - /** - * Decodes a Value message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Value; - - /** - * Verifies a Value message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Value message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Value - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Value; - - /** - * Creates a plain object from a Value message. Also converts values to other types if specified. - * @param message Value - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Value to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Value - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Metadata. */ - interface IMetadata { - - /** Metadata sqlStatementExecutionTime */ - sqlStatementExecutionTime?: (google.protobuf.IDuration|null); - } - - /** Represents a Metadata. */ - class Metadata implements IMetadata { - - /** - * Constructs a new Metadata. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IMetadata); - - /** Metadata sqlStatementExecutionTime. */ - public sqlStatementExecutionTime?: (google.protobuf.IDuration|null); - - /** - * Creates a new Metadata instance using the specified properties. - * @param [properties] Properties to set - * @returns Metadata instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IMetadata): google.cloud.sql.v1beta4.Metadata; - - /** - * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.sql.v1beta4.Metadata.verify|verify} messages. - * @param message Metadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Metadata.verify|verify} messages. - * @param message Metadata message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IMetadata, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Metadata message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Metadata; - - /** - * Decodes a Metadata message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Metadata; - - /** - * Verifies a Metadata message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Metadata message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Metadata - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Metadata; - - /** - * Creates a plain object from a Metadata message. Also converts values to other types if specified. - * @param message Metadata - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.Metadata, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Metadata to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Metadata - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesAcquireSsrsLeaseRequest. */ - interface ISqlInstancesAcquireSsrsLeaseRequest { - - /** SqlInstancesAcquireSsrsLeaseRequest instance */ - instance?: (string|null); - - /** SqlInstancesAcquireSsrsLeaseRequest project */ - project?: (string|null); - - /** SqlInstancesAcquireSsrsLeaseRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest|null); - } - - /** Represents a SqlInstancesAcquireSsrsLeaseRequest. */ - class SqlInstancesAcquireSsrsLeaseRequest implements ISqlInstancesAcquireSsrsLeaseRequest { - - /** - * Constructs a new SqlInstancesAcquireSsrsLeaseRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest); - - /** SqlInstancesAcquireSsrsLeaseRequest instance. */ - public instance: string; - - /** SqlInstancesAcquireSsrsLeaseRequest project. */ - public project: string; - - /** SqlInstancesAcquireSsrsLeaseRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest|null); - - /** - * Creates a new SqlInstancesAcquireSsrsLeaseRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesAcquireSsrsLeaseRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @param message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @param message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest; - - /** - * Verifies a SqlInstancesAcquireSsrsLeaseRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesAcquireSsrsLeaseRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest; - - /** - * Creates a plain object from a SqlInstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. - * @param message SqlInstancesAcquireSsrsLeaseRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesAcquireSsrsLeaseRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesAcquireSsrsLeaseRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesPreCheckMajorVersionUpgradeRequest. */ - interface ISqlInstancesPreCheckMajorVersionUpgradeRequest { - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest instance */ - instance?: (string|null); - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest project */ - project?: (string|null); - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest body */ - body?: (google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest|null); - } - - /** Represents a SqlInstancesPreCheckMajorVersionUpgradeRequest. */ - class SqlInstancesPreCheckMajorVersionUpgradeRequest implements ISqlInstancesPreCheckMajorVersionUpgradeRequest { - - /** - * Constructs a new SqlInstancesPreCheckMajorVersionUpgradeRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest); - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest instance. */ - public instance: string; - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest project. */ - public project: string; - - /** SqlInstancesPreCheckMajorVersionUpgradeRequest body. */ - public body?: (google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest|null); - - /** - * Creates a new SqlInstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest): google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Verifies a SqlInstancesPreCheckMajorVersionUpgradeRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesPreCheckMajorVersionUpgradeRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Creates a plain object from a SqlInstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. - * @param message SqlInstancesPreCheckMajorVersionUpgradeRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesPreCheckMajorVersionUpgradeRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesPreCheckMajorVersionUpgradeRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesAcquireSsrsLeaseResponse. */ - interface ISqlInstancesAcquireSsrsLeaseResponse { - - /** SqlInstancesAcquireSsrsLeaseResponse operationId */ - operationId?: (string|null); - } - - /** Represents a SqlInstancesAcquireSsrsLeaseResponse. */ - class SqlInstancesAcquireSsrsLeaseResponse implements ISqlInstancesAcquireSsrsLeaseResponse { - - /** - * Constructs a new SqlInstancesAcquireSsrsLeaseResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse); - - /** SqlInstancesAcquireSsrsLeaseResponse operationId. */ - public operationId?: (string|null); - - /** - * Creates a new SqlInstancesAcquireSsrsLeaseResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesAcquireSsrsLeaseResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. - * @param message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. - * @param message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesAcquireSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesAcquireSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse; - - /** - * Verifies a SqlInstancesAcquireSsrsLeaseResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesAcquireSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesAcquireSsrsLeaseResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse; - - /** - * Creates a plain object from a SqlInstancesAcquireSsrsLeaseResponse message. Also converts values to other types if specified. - * @param message SqlInstancesAcquireSsrsLeaseResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesAcquireSsrsLeaseResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesAcquireSsrsLeaseResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesPointInTimeRestoreRequest. */ - interface ISqlInstancesPointInTimeRestoreRequest { - - /** SqlInstancesPointInTimeRestoreRequest parent */ - parent?: (string|null); - - /** SqlInstancesPointInTimeRestoreRequest context */ - context?: (google.cloud.sql.v1beta4.IPointInTimeRestoreContext|null); - } - - /** Represents a SqlInstancesPointInTimeRestoreRequest. */ - class SqlInstancesPointInTimeRestoreRequest implements ISqlInstancesPointInTimeRestoreRequest { - - /** - * Constructs a new SqlInstancesPointInTimeRestoreRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest); - - /** SqlInstancesPointInTimeRestoreRequest parent. */ - public parent: string; - - /** SqlInstancesPointInTimeRestoreRequest context. */ - public context?: (google.cloud.sql.v1beta4.IPointInTimeRestoreContext|null); - - /** - * Creates a new SqlInstancesPointInTimeRestoreRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesPointInTimeRestoreRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest): google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest; - - /** - * Encodes the specified SqlInstancesPointInTimeRestoreRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. - * @param message SqlInstancesPointInTimeRestoreRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesPointInTimeRestoreRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. - * @param message SqlInstancesPointInTimeRestoreRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesPointInTimeRestoreRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest; - - /** - * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesPointInTimeRestoreRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest; - - /** - * Verifies a SqlInstancesPointInTimeRestoreRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesPointInTimeRestoreRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesPointInTimeRestoreRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest; - - /** - * Creates a plain object from a SqlInstancesPointInTimeRestoreRequest message. Also converts values to other types if specified. - * @param message SqlInstancesPointInTimeRestoreRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesPointInTimeRestoreRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesPointInTimeRestoreRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AclEntry. */ - interface IAclEntry { - - /** AclEntry value */ - value?: (string|null); - - /** AclEntry expirationTime */ - expirationTime?: (google.protobuf.ITimestamp|null); - - /** AclEntry name */ - name?: (string|null); - - /** AclEntry kind */ - kind?: (string|null); - } - - /** Represents an AclEntry. */ - class AclEntry implements IAclEntry { - - /** - * Constructs a new AclEntry. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IAclEntry); - - /** AclEntry value. */ - public value: string; - - /** AclEntry expirationTime. */ - public expirationTime?: (google.protobuf.ITimestamp|null); - - /** AclEntry name. */ - public name: string; - - /** AclEntry kind. */ - public kind: string; - - /** - * Creates a new AclEntry instance using the specified properties. - * @param [properties] Properties to set - * @returns AclEntry instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IAclEntry): google.cloud.sql.v1beta4.AclEntry; - - /** - * Encodes the specified AclEntry message. Does not implicitly {@link google.cloud.sql.v1beta4.AclEntry.verify|verify} messages. - * @param message AclEntry message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IAclEntry, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AclEntry message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AclEntry.verify|verify} messages. - * @param message AclEntry message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IAclEntry, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AclEntry message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AclEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.AclEntry; - - /** - * Decodes an AclEntry message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AclEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.AclEntry; - - /** - * Verifies an AclEntry message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an AclEntry message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AclEntry - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.AclEntry; - - /** - * Creates a plain object from an AclEntry message. Also converts values to other types if specified. - * @param message AclEntry - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.AclEntry, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AclEntry to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AclEntry - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ApiWarning. */ - interface IApiWarning { - - /** ApiWarning code */ - code?: (google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode|keyof typeof google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode|null); - - /** ApiWarning message */ - message?: (string|null); - - /** ApiWarning region */ - region?: (string|null); - } - - /** Represents an ApiWarning. */ - class ApiWarning implements IApiWarning { - - /** - * Constructs a new ApiWarning. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IApiWarning); - - /** ApiWarning code. */ - public code: (google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode|keyof typeof google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode); - - /** ApiWarning message. */ - public message: string; - - /** ApiWarning region. */ - public region: string; - - /** - * Creates a new ApiWarning instance using the specified properties. - * @param [properties] Properties to set - * @returns ApiWarning instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IApiWarning): google.cloud.sql.v1beta4.ApiWarning; - - /** - * Encodes the specified ApiWarning message. Does not implicitly {@link google.cloud.sql.v1beta4.ApiWarning.verify|verify} messages. - * @param message ApiWarning message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IApiWarning, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ApiWarning message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ApiWarning.verify|verify} messages. - * @param message ApiWarning message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IApiWarning, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ApiWarning message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ApiWarning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ApiWarning; - - /** - * Decodes an ApiWarning message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ApiWarning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ApiWarning; - - /** - * Verifies an ApiWarning message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ApiWarning message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ApiWarning - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ApiWarning; - - /** - * Creates a plain object from an ApiWarning message. Also converts values to other types if specified. - * @param message ApiWarning - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ApiWarning, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ApiWarning to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ApiWarning - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ApiWarning { - - /** SqlApiWarningCode enum. */ - enum SqlApiWarningCode { - SQL_API_WARNING_CODE_UNSPECIFIED = 0, - REGION_UNREACHABLE = 1, - MAX_RESULTS_EXCEEDS_LIMIT = 2, - COMPROMISED_CREDENTIALS = 3, - INTERNAL_STATE_FAILURE = 4 - } - } - - /** Properties of a BackupRetentionSettings. */ - interface IBackupRetentionSettings { - - /** BackupRetentionSettings retentionUnit */ - retentionUnit?: (google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit|keyof typeof google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit|null); - - /** BackupRetentionSettings retainedBackups */ - retainedBackups?: (google.protobuf.IInt32Value|null); - } - - /** Represents a BackupRetentionSettings. */ - class BackupRetentionSettings implements IBackupRetentionSettings { - - /** - * Constructs a new BackupRetentionSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IBackupRetentionSettings); - - /** BackupRetentionSettings retentionUnit. */ - public retentionUnit: (google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit|keyof typeof google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit); - - /** BackupRetentionSettings retainedBackups. */ - public retainedBackups?: (google.protobuf.IInt32Value|null); - - /** - * Creates a new BackupRetentionSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupRetentionSettings instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IBackupRetentionSettings): google.cloud.sql.v1beta4.BackupRetentionSettings; - - /** - * Encodes the specified BackupRetentionSettings message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRetentionSettings.verify|verify} messages. - * @param message BackupRetentionSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IBackupRetentionSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupRetentionSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRetentionSettings.verify|verify} messages. - * @param message BackupRetentionSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupRetentionSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupRetentionSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupRetentionSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupRetentionSettings; - - /** - * Decodes a BackupRetentionSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupRetentionSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupRetentionSettings; - - /** - * Verifies a BackupRetentionSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupRetentionSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupRetentionSettings - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupRetentionSettings; - - /** - * Creates a plain object from a BackupRetentionSettings message. Also converts values to other types if specified. - * @param message BackupRetentionSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.BackupRetentionSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupRetentionSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupRetentionSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace BackupRetentionSettings { - - /** RetentionUnit enum. */ - enum RetentionUnit { - RETENTION_UNIT_UNSPECIFIED = 0, - COUNT = 1 - } - } - - /** Properties of a BackupConfiguration. */ - interface IBackupConfiguration { - - /** BackupConfiguration startTime */ - startTime?: (string|null); - - /** BackupConfiguration enabled */ - enabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration kind */ - kind?: (string|null); - - /** BackupConfiguration binaryLogEnabled */ - binaryLogEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration replicationLogArchivingEnabled */ - replicationLogArchivingEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration location */ - location?: (string|null); - - /** BackupConfiguration pointInTimeRecoveryEnabled */ - pointInTimeRecoveryEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration transactionLogRetentionDays */ - transactionLogRetentionDays?: (google.protobuf.IInt32Value|null); - - /** BackupConfiguration backupRetentionSettings */ - backupRetentionSettings?: (google.cloud.sql.v1beta4.IBackupRetentionSettings|null); - - /** BackupConfiguration transactionalLogStorageState */ - transactionalLogStorageState?: (google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|keyof typeof google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|null); - - /** BackupConfiguration backupTier */ - backupTier?: (google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|keyof typeof google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|null); - } - - /** Represents a BackupConfiguration. */ - class BackupConfiguration implements IBackupConfiguration { - - /** - * Constructs a new BackupConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IBackupConfiguration); - - /** BackupConfiguration startTime. */ - public startTime: string; - - /** BackupConfiguration enabled. */ - public enabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration kind. */ - public kind: string; - - /** BackupConfiguration binaryLogEnabled. */ - public binaryLogEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration replicationLogArchivingEnabled. */ - public replicationLogArchivingEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration location. */ - public location: string; - - /** BackupConfiguration pointInTimeRecoveryEnabled. */ - public pointInTimeRecoveryEnabled?: (google.protobuf.IBoolValue|null); - - /** BackupConfiguration transactionLogRetentionDays. */ - public transactionLogRetentionDays?: (google.protobuf.IInt32Value|null); - - /** BackupConfiguration backupRetentionSettings. */ - public backupRetentionSettings?: (google.cloud.sql.v1beta4.IBackupRetentionSettings|null); - - /** BackupConfiguration transactionalLogStorageState. */ - public transactionalLogStorageState?: (google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|keyof typeof google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|null); - - /** BackupConfiguration backupTier. */ - public backupTier?: (google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|keyof typeof google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|null); - - /** - * Creates a new BackupConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IBackupConfiguration): google.cloud.sql.v1beta4.BackupConfiguration; - - /** - * Encodes the specified BackupConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupConfiguration.verify|verify} messages. - * @param message BackupConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IBackupConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupConfiguration.verify|verify} messages. - * @param message BackupConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupConfiguration; - - /** - * Decodes a BackupConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupConfiguration; - - /** - * Verifies a BackupConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupConfiguration; - - /** - * Creates a plain object from a BackupConfiguration message. Also converts values to other types if specified. - * @param message BackupConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.BackupConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace BackupConfiguration { - - /** TransactionalLogStorageState enum. */ - enum TransactionalLogStorageState { - TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED = 0, - DISK = 1, - SWITCHING_TO_CLOUD_STORAGE = 2, - SWITCHED_TO_CLOUD_STORAGE = 3, - CLOUD_STORAGE = 4 - } - - /** BackupTier enum. */ - enum BackupTier { - BACKUP_TIER_UNSPECIFIED = 0, - STANDARD = 1, - ADVANCED = 2, - ENHANCED = 3 - } - } - - /** Properties of a BackupRun. */ - interface IBackupRun { - - /** BackupRun kind */ - kind?: (string|null); - - /** BackupRun status */ - status?: (google.cloud.sql.v1beta4.SqlBackupRunStatus|keyof typeof google.cloud.sql.v1beta4.SqlBackupRunStatus|null); - - /** BackupRun enqueuedTime */ - enqueuedTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun id */ - id?: (number|Long|string|null); - - /** BackupRun startTime */ - startTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun endTime */ - endTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun error */ - error?: (google.cloud.sql.v1beta4.IOperationError|null); - - /** BackupRun type */ - type?: (google.cloud.sql.v1beta4.SqlBackupRunType|keyof typeof google.cloud.sql.v1beta4.SqlBackupRunType|null); - - /** BackupRun description */ - description?: (string|null); - - /** BackupRun windowStartTime */ - windowStartTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun instance */ - instance?: (string|null); - - /** BackupRun selfLink */ - selfLink?: (string|null); - - /** BackupRun location */ - location?: (string|null); - - /** BackupRun databaseVersion */ - databaseVersion?: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion|null); - - /** BackupRun diskEncryptionConfiguration */ - diskEncryptionConfiguration?: (google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null); - - /** BackupRun diskEncryptionStatus */ - diskEncryptionStatus?: (google.cloud.sql.v1beta4.IDiskEncryptionStatus|null); - - /** BackupRun backupKind */ - backupKind?: (google.cloud.sql.v1beta4.SqlBackupKind|keyof typeof google.cloud.sql.v1beta4.SqlBackupKind|null); - - /** BackupRun timeZone */ - timeZone?: (string|null); - - /** BackupRun maxChargeableBytes */ - maxChargeableBytes?: (number|Long|string|null); - } - - /** Represents a BackupRun. */ - class BackupRun implements IBackupRun { - - /** - * Constructs a new BackupRun. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IBackupRun); - - /** BackupRun kind. */ - public kind: string; - - /** BackupRun status. */ - public status: (google.cloud.sql.v1beta4.SqlBackupRunStatus|keyof typeof google.cloud.sql.v1beta4.SqlBackupRunStatus); - - /** BackupRun enqueuedTime. */ - public enqueuedTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun id. */ - public id: (number|Long|string); - - /** BackupRun startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun error. */ - public error?: (google.cloud.sql.v1beta4.IOperationError|null); - - /** BackupRun type. */ - public type: (google.cloud.sql.v1beta4.SqlBackupRunType|keyof typeof google.cloud.sql.v1beta4.SqlBackupRunType); - - /** BackupRun description. */ - public description: string; - - /** BackupRun windowStartTime. */ - public windowStartTime?: (google.protobuf.ITimestamp|null); - - /** BackupRun instance. */ - public instance: string; - - /** BackupRun selfLink. */ - public selfLink: string; - - /** BackupRun location. */ - public location: string; - - /** BackupRun databaseVersion. */ - public databaseVersion: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion); - - /** BackupRun diskEncryptionConfiguration. */ - public diskEncryptionConfiguration?: (google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null); - - /** BackupRun diskEncryptionStatus. */ - public diskEncryptionStatus?: (google.cloud.sql.v1beta4.IDiskEncryptionStatus|null); - - /** BackupRun backupKind. */ - public backupKind: (google.cloud.sql.v1beta4.SqlBackupKind|keyof typeof google.cloud.sql.v1beta4.SqlBackupKind); - - /** BackupRun timeZone. */ - public timeZone: string; - - /** BackupRun maxChargeableBytes. */ - public maxChargeableBytes?: (number|Long|string|null); - - /** - * Creates a new BackupRun instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupRun instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IBackupRun): google.cloud.sql.v1beta4.BackupRun; - - /** - * Encodes the specified BackupRun message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRun.verify|verify} messages. - * @param message BackupRun message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IBackupRun, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupRun message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRun.verify|verify} messages. - * @param message BackupRun message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupRun, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupRun message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupRun - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupRun; - - /** - * Decodes a BackupRun message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupRun - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupRun; - - /** - * Verifies a BackupRun message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupRun message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupRun - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupRun; - - /** - * Creates a plain object from a BackupRun message. Also converts values to other types if specified. - * @param message BackupRun - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.BackupRun, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupRun to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupRun - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Backup. */ - interface IBackup { - - /** Backup name */ - name?: (string|null); - - /** Backup kind */ - kind?: (string|null); - - /** Backup selfLink */ - selfLink?: (string|null); - - /** Backup type */ - type?: (google.cloud.sql.v1beta4.Backup.SqlBackupType|keyof typeof google.cloud.sql.v1beta4.Backup.SqlBackupType|null); - - /** Backup description */ - description?: (string|null); - - /** Backup instance */ - instance?: (string|null); - - /** Backup location */ - location?: (string|null); - - /** Backup backupInterval */ - backupInterval?: (google.type.IInterval|null); - - /** Backup state */ - state?: (google.cloud.sql.v1beta4.Backup.SqlBackupState|keyof typeof google.cloud.sql.v1beta4.Backup.SqlBackupState|null); - - /** Backup error */ - error?: (google.cloud.sql.v1beta4.IOperationError|null); - - /** Backup kmsKey */ - kmsKey?: (string|null); - - /** Backup kmsKeyVersion */ - kmsKeyVersion?: (string|null); - - /** Backup backupKind */ - backupKind?: (google.cloud.sql.v1beta4.SqlBackupKind|keyof typeof google.cloud.sql.v1beta4.SqlBackupKind|null); - - /** Backup timeZone */ - timeZone?: (string|null); - - /** Backup ttlDays */ - ttlDays?: (number|Long|string|null); - - /** Backup expiryTime */ - expiryTime?: (google.protobuf.ITimestamp|null); - - /** Backup databaseVersion */ - databaseVersion?: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion|null); - - /** Backup maxChargeableBytes */ - maxChargeableBytes?: (number|Long|string|null); - - /** Backup instanceDeletionTime */ - instanceDeletionTime?: (google.protobuf.ITimestamp|null); - - /** Backup instanceSettings */ - instanceSettings?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); - - /** Backup backupRun */ - backupRun?: (string|null); - - /** Backup satisfiesPzs */ - satisfiesPzs?: (google.protobuf.IBoolValue|null); - - /** Backup satisfiesPzi */ - satisfiesPzi?: (google.protobuf.IBoolValue|null); - } - - /** Represents a Backup. */ - class Backup implements IBackup { - - /** - * Constructs a new Backup. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IBackup); - - /** Backup name. */ - public name: string; - - /** Backup kind. */ - public kind: string; - - /** Backup selfLink. */ - public selfLink: string; - - /** Backup type. */ - public type: (google.cloud.sql.v1beta4.Backup.SqlBackupType|keyof typeof google.cloud.sql.v1beta4.Backup.SqlBackupType); - - /** Backup description. */ - public description: string; - - /** Backup instance. */ - public instance: string; - - /** Backup location. */ - public location: string; - - /** Backup backupInterval. */ - public backupInterval?: (google.type.IInterval|null); - - /** Backup state. */ - public state: (google.cloud.sql.v1beta4.Backup.SqlBackupState|keyof typeof google.cloud.sql.v1beta4.Backup.SqlBackupState); - - /** Backup error. */ - public error?: (google.cloud.sql.v1beta4.IOperationError|null); - - /** Backup kmsKey. */ - public kmsKey: string; - - /** Backup kmsKeyVersion. */ - public kmsKeyVersion: string; - - /** Backup backupKind. */ - public backupKind: (google.cloud.sql.v1beta4.SqlBackupKind|keyof typeof google.cloud.sql.v1beta4.SqlBackupKind); - - /** Backup timeZone. */ - public timeZone: string; - - /** Backup ttlDays. */ - public ttlDays?: (number|Long|string|null); - - /** Backup expiryTime. */ - public expiryTime?: (google.protobuf.ITimestamp|null); - - /** Backup databaseVersion. */ - public databaseVersion: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion); - - /** Backup maxChargeableBytes. */ - public maxChargeableBytes?: (number|Long|string|null); - - /** Backup instanceDeletionTime. */ - public instanceDeletionTime?: (google.protobuf.ITimestamp|null); - - /** Backup instanceSettings. */ - public instanceSettings?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); - - /** Backup backupRun. */ - public backupRun: string; - - /** Backup satisfiesPzs. */ - public satisfiesPzs?: (google.protobuf.IBoolValue|null); - - /** Backup satisfiesPzi. */ - public satisfiesPzi?: (google.protobuf.IBoolValue|null); - - /** Backup expiration. */ - public expiration?: ("ttlDays"|"expiryTime"); - - /** - * Creates a new Backup instance using the specified properties. - * @param [properties] Properties to set - * @returns Backup instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IBackup): google.cloud.sql.v1beta4.Backup; - - /** - * Encodes the specified Backup message. Does not implicitly {@link google.cloud.sql.v1beta4.Backup.verify|verify} messages. - * @param message Backup message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IBackup, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Backup message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Backup.verify|verify} messages. - * @param message Backup message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackup, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Backup message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Backup - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Backup; - - /** - * Decodes a Backup message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Backup - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Backup; - - /** - * Verifies a Backup message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Backup message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Backup - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Backup; - - /** - * Creates a plain object from a Backup message. Also converts values to other types if specified. - * @param message Backup - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.Backup, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Backup to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Backup - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Backup { - - /** SqlBackupType enum. */ - enum SqlBackupType { - SQL_BACKUP_TYPE_UNSPECIFIED = 0, - AUTOMATED = 1, - ON_DEMAND = 2, - FINAL = 3 - } - - /** SqlBackupState enum. */ - enum SqlBackupState { - SQL_BACKUP_STATE_UNSPECIFIED = 0, - ENQUEUED = 1, - RUNNING = 2, - FAILED = 3, - SUCCESSFUL = 4, - DELETING = 5, - DELETION_FAILED = 6 - } - } - - /** Properties of a BackupRunsListResponse. */ - interface IBackupRunsListResponse { - - /** BackupRunsListResponse kind */ - kind?: (string|null); - - /** BackupRunsListResponse items */ - items?: (google.cloud.sql.v1beta4.IBackupRun[]|null); - - /** BackupRunsListResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a BackupRunsListResponse. */ - class BackupRunsListResponse implements IBackupRunsListResponse { - - /** - * Constructs a new BackupRunsListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IBackupRunsListResponse); - - /** BackupRunsListResponse kind. */ - public kind: string; - - /** BackupRunsListResponse items. */ - public items: google.cloud.sql.v1beta4.IBackupRun[]; - - /** BackupRunsListResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new BackupRunsListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupRunsListResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IBackupRunsListResponse): google.cloud.sql.v1beta4.BackupRunsListResponse; - - /** - * Encodes the specified BackupRunsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRunsListResponse.verify|verify} messages. - * @param message BackupRunsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IBackupRunsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupRunsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRunsListResponse.verify|verify} messages. - * @param message BackupRunsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupRunsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupRunsListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupRunsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupRunsListResponse; - - /** - * Decodes a BackupRunsListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupRunsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupRunsListResponse; - - /** - * Verifies a BackupRunsListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupRunsListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupRunsListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupRunsListResponse; - - /** - * Creates a plain object from a BackupRunsListResponse message. Also converts values to other types if specified. - * @param message BackupRunsListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.BackupRunsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupRunsListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupRunsListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BinLogCoordinates. */ - interface IBinLogCoordinates { - - /** BinLogCoordinates binLogFileName */ - binLogFileName?: (string|null); - - /** BinLogCoordinates binLogPosition */ - binLogPosition?: (number|Long|string|null); - - /** BinLogCoordinates kind */ - kind?: (string|null); - } - - /** Represents a BinLogCoordinates. */ - class BinLogCoordinates implements IBinLogCoordinates { - - /** - * Constructs a new BinLogCoordinates. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IBinLogCoordinates); - - /** BinLogCoordinates binLogFileName. */ - public binLogFileName: string; - - /** BinLogCoordinates binLogPosition. */ - public binLogPosition: (number|Long|string); - - /** BinLogCoordinates kind. */ - public kind: string; - - /** - * Creates a new BinLogCoordinates instance using the specified properties. - * @param [properties] Properties to set - * @returns BinLogCoordinates instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IBinLogCoordinates): google.cloud.sql.v1beta4.BinLogCoordinates; - - /** - * Encodes the specified BinLogCoordinates message. Does not implicitly {@link google.cloud.sql.v1beta4.BinLogCoordinates.verify|verify} messages. - * @param message BinLogCoordinates message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IBinLogCoordinates, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BinLogCoordinates message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BinLogCoordinates.verify|verify} messages. - * @param message BinLogCoordinates message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IBinLogCoordinates, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BinLogCoordinates message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BinLogCoordinates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BinLogCoordinates; - - /** - * Decodes a BinLogCoordinates message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BinLogCoordinates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BinLogCoordinates; - - /** - * Verifies a BinLogCoordinates message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BinLogCoordinates message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BinLogCoordinates - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BinLogCoordinates; - - /** - * Creates a plain object from a BinLogCoordinates message. Also converts values to other types if specified. - * @param message BinLogCoordinates - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.BinLogCoordinates, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BinLogCoordinates to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BinLogCoordinates - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BackupContext. */ - interface IBackupContext { - - /** BackupContext backupId */ - backupId?: (number|Long|string|null); - - /** BackupContext kind */ - kind?: (string|null); - - /** BackupContext name */ - name?: (string|null); - } - - /** Represents a BackupContext. */ - class BackupContext implements IBackupContext { - - /** - * Constructs a new BackupContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IBackupContext); - - /** BackupContext backupId. */ - public backupId: (number|Long|string); - - /** BackupContext kind. */ - public kind: string; - - /** BackupContext name. */ - public name: string; - - /** - * Creates a new BackupContext instance using the specified properties. - * @param [properties] Properties to set - * @returns BackupContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IBackupContext): google.cloud.sql.v1beta4.BackupContext; - - /** - * Encodes the specified BackupContext message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupContext.verify|verify} messages. - * @param message BackupContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupContext.verify|verify} messages. - * @param message BackupContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BackupContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.BackupContext; - - /** - * Decodes a BackupContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.BackupContext; - - /** - * Verifies a BackupContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BackupContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BackupContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.BackupContext; - - /** - * Creates a plain object from a BackupContext message. Also converts values to other types if specified. - * @param message BackupContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.BackupContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BackupContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BackupContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CloneContext. */ - interface ICloneContext { - - /** CloneContext kind */ - kind?: (string|null); - - /** CloneContext pitrTimestampMs */ - pitrTimestampMs?: (number|Long|string|null); - - /** CloneContext destinationInstanceName */ - destinationInstanceName?: (string|null); - - /** CloneContext binLogCoordinates */ - binLogCoordinates?: (google.cloud.sql.v1beta4.IBinLogCoordinates|null); - - /** CloneContext pointInTime */ - pointInTime?: (google.protobuf.ITimestamp|null); - - /** CloneContext allocatedIpRange */ - allocatedIpRange?: (string|null); - - /** CloneContext databaseNames */ - databaseNames?: (string[]|null); - - /** CloneContext preferredZone */ - preferredZone?: (string|null); - - /** CloneContext preferredSecondaryZone */ - preferredSecondaryZone?: (string|null); - - /** CloneContext sourceInstanceDeletionTime */ - sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); - - /** CloneContext destinationProject */ - destinationProject?: (string|null); - - /** CloneContext destinationNetwork */ - destinationNetwork?: (string|null); - } - - /** Represents a CloneContext. */ - class CloneContext implements ICloneContext { - - /** - * Constructs a new CloneContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ICloneContext); - - /** CloneContext kind. */ - public kind: string; - - /** CloneContext pitrTimestampMs. */ - public pitrTimestampMs: (number|Long|string); - - /** CloneContext destinationInstanceName. */ - public destinationInstanceName: string; - - /** CloneContext binLogCoordinates. */ - public binLogCoordinates?: (google.cloud.sql.v1beta4.IBinLogCoordinates|null); - - /** CloneContext pointInTime. */ - public pointInTime?: (google.protobuf.ITimestamp|null); - - /** CloneContext allocatedIpRange. */ - public allocatedIpRange: string; - - /** CloneContext databaseNames. */ - public databaseNames: string[]; - - /** CloneContext preferredZone. */ - public preferredZone?: (string|null); - - /** CloneContext preferredSecondaryZone. */ - public preferredSecondaryZone?: (string|null); - - /** CloneContext sourceInstanceDeletionTime. */ - public sourceInstanceDeletionTime?: (google.protobuf.ITimestamp|null); - - /** CloneContext destinationProject. */ - public destinationProject?: (string|null); - - /** CloneContext destinationNetwork. */ - public destinationNetwork?: (string|null); - - /** - * Creates a new CloneContext instance using the specified properties. - * @param [properties] Properties to set - * @returns CloneContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ICloneContext): google.cloud.sql.v1beta4.CloneContext; - - /** - * Encodes the specified CloneContext message. Does not implicitly {@link google.cloud.sql.v1beta4.CloneContext.verify|verify} messages. - * @param message CloneContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ICloneContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CloneContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.CloneContext.verify|verify} messages. - * @param message CloneContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ICloneContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CloneContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CloneContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.CloneContext; - - /** - * Decodes a CloneContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CloneContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.CloneContext; - - /** - * Verifies a CloneContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CloneContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CloneContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.CloneContext; - - /** - * Creates a plain object from a CloneContext message. Also converts values to other types if specified. - * @param message CloneContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.CloneContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CloneContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CloneContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Database. */ - interface IDatabase { - - /** Database kind */ - kind?: (string|null); - - /** Database charset */ - charset?: (string|null); - - /** Database collation */ - collation?: (string|null); - - /** Database etag */ - etag?: (string|null); - - /** Database name */ - name?: (string|null); - - /** Database instance */ - instance?: (string|null); - - /** Database selfLink */ - selfLink?: (string|null); - - /** Database project */ - project?: (string|null); - - /** Database sqlserverDatabaseDetails */ - sqlserverDatabaseDetails?: (google.cloud.sql.v1beta4.ISqlServerDatabaseDetails|null); - } - - /** Represents a Database. */ - class Database implements IDatabase { - - /** - * Constructs a new Database. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDatabase); - - /** Database kind. */ - public kind: string; - - /** Database charset. */ - public charset: string; - - /** Database collation. */ - public collation: string; - - /** Database etag. */ - public etag: string; - - /** Database name. */ - public name: string; - - /** Database instance. */ - public instance: string; - - /** Database selfLink. */ - public selfLink: string; - - /** Database project. */ - public project: string; - - /** Database sqlserverDatabaseDetails. */ - public sqlserverDatabaseDetails?: (google.cloud.sql.v1beta4.ISqlServerDatabaseDetails|null); - - /** Database databaseDetails. */ - public databaseDetails?: "sqlserverDatabaseDetails"; - - /** - * Creates a new Database instance using the specified properties. - * @param [properties] Properties to set - * @returns Database instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDatabase): google.cloud.sql.v1beta4.Database; - - /** - * Encodes the specified Database message. Does not implicitly {@link google.cloud.sql.v1beta4.Database.verify|verify} messages. - * @param message Database message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDatabase, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Database message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Database.verify|verify} messages. - * @param message Database message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDatabase, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Database message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Database - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Database; - - /** - * Decodes a Database message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Database - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Database; - - /** - * Verifies a Database message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Database message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Database - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Database; - - /** - * Creates a plain object from a Database message. Also converts values to other types if specified. - * @param message Database - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.Database, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Database to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Database - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlServerDatabaseDetails. */ - interface ISqlServerDatabaseDetails { - - /** SqlServerDatabaseDetails compatibilityLevel */ - compatibilityLevel?: (number|null); - - /** SqlServerDatabaseDetails recoveryModel */ - recoveryModel?: (string|null); - } - - /** Represents a SqlServerDatabaseDetails. */ - class SqlServerDatabaseDetails implements ISqlServerDatabaseDetails { - - /** - * Constructs a new SqlServerDatabaseDetails. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlServerDatabaseDetails); - - /** SqlServerDatabaseDetails compatibilityLevel. */ - public compatibilityLevel: number; - - /** SqlServerDatabaseDetails recoveryModel. */ - public recoveryModel: string; - - /** - * Creates a new SqlServerDatabaseDetails instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlServerDatabaseDetails instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlServerDatabaseDetails): google.cloud.sql.v1beta4.SqlServerDatabaseDetails; - - /** - * Encodes the specified SqlServerDatabaseDetails message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerDatabaseDetails.verify|verify} messages. - * @param message SqlServerDatabaseDetails message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlServerDatabaseDetails, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlServerDatabaseDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerDatabaseDetails.verify|verify} messages. - * @param message SqlServerDatabaseDetails message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlServerDatabaseDetails, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlServerDatabaseDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlServerDatabaseDetails; - - /** - * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlServerDatabaseDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlServerDatabaseDetails; - - /** - * Verifies a SqlServerDatabaseDetails message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlServerDatabaseDetails message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlServerDatabaseDetails - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlServerDatabaseDetails; - - /** - * Creates a plain object from a SqlServerDatabaseDetails message. Also converts values to other types if specified. - * @param message SqlServerDatabaseDetails - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlServerDatabaseDetails, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlServerDatabaseDetails to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlServerDatabaseDetails - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DatabaseFlags. */ - interface IDatabaseFlags { - - /** DatabaseFlags name */ - name?: (string|null); - - /** DatabaseFlags value */ - value?: (string|null); - } - - /** Represents a DatabaseFlags. */ - class DatabaseFlags implements IDatabaseFlags { - - /** - * Constructs a new DatabaseFlags. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDatabaseFlags); - - /** DatabaseFlags name. */ - public name: string; - - /** DatabaseFlags value. */ - public value: string; - - /** - * Creates a new DatabaseFlags instance using the specified properties. - * @param [properties] Properties to set - * @returns DatabaseFlags instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDatabaseFlags): google.cloud.sql.v1beta4.DatabaseFlags; - - /** - * Encodes the specified DatabaseFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseFlags.verify|verify} messages. - * @param message DatabaseFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDatabaseFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DatabaseFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseFlags.verify|verify} messages. - * @param message DatabaseFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDatabaseFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DatabaseFlags message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DatabaseFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseFlags; - - /** - * Decodes a DatabaseFlags message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DatabaseFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseFlags; - - /** - * Verifies a DatabaseFlags message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DatabaseFlags message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DatabaseFlags - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseFlags; - - /** - * Creates a plain object from a DatabaseFlags message. Also converts values to other types if specified. - * @param message DatabaseFlags - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DatabaseFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DatabaseFlags to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DatabaseFlags - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SyncFlags. */ - interface ISyncFlags { - - /** SyncFlags name */ - name?: (string|null); - - /** SyncFlags value */ - value?: (string|null); - } - - /** Represents a SyncFlags. */ - class SyncFlags implements ISyncFlags { - - /** - * Constructs a new SyncFlags. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISyncFlags); - - /** SyncFlags name. */ - public name: string; - - /** SyncFlags value. */ - public value: string; - - /** - * Creates a new SyncFlags instance using the specified properties. - * @param [properties] Properties to set - * @returns SyncFlags instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISyncFlags): google.cloud.sql.v1beta4.SyncFlags; - - /** - * Encodes the specified SyncFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.SyncFlags.verify|verify} messages. - * @param message SyncFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISyncFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SyncFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SyncFlags.verify|verify} messages. - * @param message SyncFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISyncFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SyncFlags message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SyncFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SyncFlags; - - /** - * Decodes a SyncFlags message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SyncFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SyncFlags; - - /** - * Verifies a SyncFlags message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SyncFlags message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SyncFlags - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SyncFlags; - - /** - * Creates a plain object from a SyncFlags message. Also converts values to other types if specified. - * @param message SyncFlags - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SyncFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SyncFlags to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SyncFlags - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstanceReference. */ - interface IInstanceReference { - - /** InstanceReference name */ - name?: (string|null); - - /** InstanceReference region */ - region?: (string|null); - - /** InstanceReference project */ - project?: (string|null); - } - - /** Represents an InstanceReference. */ - class InstanceReference implements IInstanceReference { - - /** - * Constructs a new InstanceReference. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstanceReference); - - /** InstanceReference name. */ - public name: string; - - /** InstanceReference region. */ - public region: string; - - /** InstanceReference project. */ - public project: string; - - /** - * Creates a new InstanceReference instance using the specified properties. - * @param [properties] Properties to set - * @returns InstanceReference instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstanceReference): google.cloud.sql.v1beta4.InstanceReference; - - /** - * Encodes the specified InstanceReference message. Does not implicitly {@link google.cloud.sql.v1beta4.InstanceReference.verify|verify} messages. - * @param message InstanceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstanceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstanceReference message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstanceReference.verify|verify} messages. - * @param message InstanceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstanceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstanceReference message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstanceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstanceReference; - - /** - * Decodes an InstanceReference message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstanceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstanceReference; - - /** - * Verifies an InstanceReference message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstanceReference message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstanceReference - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstanceReference; - - /** - * Creates a plain object from an InstanceReference message. Also converts values to other types if specified. - * @param message InstanceReference - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstanceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstanceReference to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstanceReference - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DatabaseInstance. */ - interface IDatabaseInstance { - - /** DatabaseInstance kind */ - kind?: (string|null); - - /** DatabaseInstance state */ - state?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null); - - /** DatabaseInstance databaseVersion */ - databaseVersion?: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion|null); - - /** DatabaseInstance settings */ - settings?: (google.cloud.sql.v1beta4.ISettings|null); - - /** DatabaseInstance etag */ - etag?: (string|null); - - /** DatabaseInstance failoverReplica */ - failoverReplica?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica|null); - - /** DatabaseInstance masterInstanceName */ - masterInstanceName?: (string|null); - - /** DatabaseInstance replicaNames */ - replicaNames?: (string[]|null); - - /** DatabaseInstance maxDiskSize */ - maxDiskSize?: (google.protobuf.IInt64Value|null); - - /** DatabaseInstance currentDiskSize */ - currentDiskSize?: (google.protobuf.IInt64Value|null); - - /** DatabaseInstance ipAddresses */ - ipAddresses?: (google.cloud.sql.v1beta4.IIpMapping[]|null); - - /** DatabaseInstance serverCaCert */ - serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); - - /** DatabaseInstance instanceType */ - instanceType?: (google.cloud.sql.v1beta4.SqlInstanceType|keyof typeof google.cloud.sql.v1beta4.SqlInstanceType|null); - - /** DatabaseInstance project */ - project?: (string|null); - - /** DatabaseInstance ipv6Address */ - ipv6Address?: (string|null); - - /** DatabaseInstance serviceAccountEmailAddress */ - serviceAccountEmailAddress?: (string|null); - - /** DatabaseInstance onPremisesConfiguration */ - onPremisesConfiguration?: (google.cloud.sql.v1beta4.IOnPremisesConfiguration|null); - - /** DatabaseInstance replicaConfiguration */ - replicaConfiguration?: (google.cloud.sql.v1beta4.IReplicaConfiguration|null); - - /** DatabaseInstance backendType */ - backendType?: (google.cloud.sql.v1beta4.SqlBackendType|keyof typeof google.cloud.sql.v1beta4.SqlBackendType|null); - - /** DatabaseInstance selfLink */ - selfLink?: (string|null); - - /** DatabaseInstance suspensionReason */ - suspensionReason?: (google.cloud.sql.v1beta4.SqlSuspensionReason[]|null); - - /** DatabaseInstance connectionName */ - connectionName?: (string|null); - - /** DatabaseInstance name */ - name?: (string|null); - - /** DatabaseInstance region */ - region?: (string|null); - - /** DatabaseInstance gceZone */ - gceZone?: (string|null); - - /** DatabaseInstance secondaryGceZone */ - secondaryGceZone?: (string|null); - - /** DatabaseInstance diskEncryptionConfiguration */ - diskEncryptionConfiguration?: (google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null); - - /** DatabaseInstance diskEncryptionStatus */ - diskEncryptionStatus?: (google.cloud.sql.v1beta4.IDiskEncryptionStatus|null); - - /** DatabaseInstance rootPassword */ - rootPassword?: (string|null); - - /** DatabaseInstance scheduledMaintenance */ - scheduledMaintenance?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance|null); - - /** DatabaseInstance satisfiesPzs */ - satisfiesPzs?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance databaseInstalledVersion */ - databaseInstalledVersion?: (string|null); - - /** DatabaseInstance outOfDiskReport */ - outOfDiskReport?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport|null); - - /** DatabaseInstance createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** DatabaseInstance availableMaintenanceVersions */ - availableMaintenanceVersions?: (string[]|null); - - /** DatabaseInstance maintenanceVersion */ - maintenanceVersion?: (string|null); - - /** DatabaseInstance upgradableDatabaseVersions */ - upgradableDatabaseVersions?: (google.cloud.sql.v1beta4.IAvailableDatabaseVersion[]|null); - - /** DatabaseInstance sqlNetworkArchitecture */ - sqlNetworkArchitecture?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|null); - - /** DatabaseInstance pscServiceAttachmentLink */ - pscServiceAttachmentLink?: (string|null); - - /** DatabaseInstance dnsName */ - dnsName?: (string|null); - - /** DatabaseInstance primaryDnsName */ - primaryDnsName?: (string|null); - - /** DatabaseInstance writeEndpoint */ - writeEndpoint?: (string|null); - - /** DatabaseInstance replicationCluster */ - replicationCluster?: (google.cloud.sql.v1beta4.IReplicationCluster|null); - - /** DatabaseInstance geminiConfig */ - geminiConfig?: (google.cloud.sql.v1beta4.IGeminiInstanceConfig|null); - - /** DatabaseInstance satisfiesPzi */ - satisfiesPzi?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance switchTransactionLogsToCloudStorageEnabled */ - switchTransactionLogsToCloudStorageEnabled?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance includeReplicasForMajorVersionUpgrade */ - includeReplicasForMajorVersionUpgrade?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance tags */ - tags?: ({ [k: string]: string }|null); - - /** DatabaseInstance nodeCount */ - nodeCount?: (number|null); - - /** DatabaseInstance nodes */ - nodes?: (google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig[]|null); - - /** DatabaseInstance dnsNames */ - dnsNames?: (google.cloud.sql.v1beta4.IDnsNameMapping[]|null); - } - - /** Represents a DatabaseInstance. */ - class DatabaseInstance implements IDatabaseInstance { - - /** - * Constructs a new DatabaseInstance. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDatabaseInstance); - - /** DatabaseInstance kind. */ - public kind: string; - - /** DatabaseInstance state. */ - public state: (google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState); - - /** DatabaseInstance databaseVersion. */ - public databaseVersion: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion); - - /** DatabaseInstance settings. */ - public settings?: (google.cloud.sql.v1beta4.ISettings|null); - - /** DatabaseInstance etag. */ - public etag: string; - - /** DatabaseInstance failoverReplica. */ - public failoverReplica?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica|null); - - /** DatabaseInstance masterInstanceName. */ - public masterInstanceName: string; - - /** DatabaseInstance replicaNames. */ - public replicaNames: string[]; - - /** DatabaseInstance maxDiskSize. */ - public maxDiskSize?: (google.protobuf.IInt64Value|null); - - /** DatabaseInstance currentDiskSize. */ - public currentDiskSize?: (google.protobuf.IInt64Value|null); - - /** DatabaseInstance ipAddresses. */ - public ipAddresses: google.cloud.sql.v1beta4.IIpMapping[]; - - /** DatabaseInstance serverCaCert. */ - public serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); - - /** DatabaseInstance instanceType. */ - public instanceType: (google.cloud.sql.v1beta4.SqlInstanceType|keyof typeof google.cloud.sql.v1beta4.SqlInstanceType); - - /** DatabaseInstance project. */ - public project: string; - - /** DatabaseInstance ipv6Address. */ - public ipv6Address: string; - - /** DatabaseInstance serviceAccountEmailAddress. */ - public serviceAccountEmailAddress: string; - - /** DatabaseInstance onPremisesConfiguration. */ - public onPremisesConfiguration?: (google.cloud.sql.v1beta4.IOnPremisesConfiguration|null); - - /** DatabaseInstance replicaConfiguration. */ - public replicaConfiguration?: (google.cloud.sql.v1beta4.IReplicaConfiguration|null); - - /** DatabaseInstance backendType. */ - public backendType: (google.cloud.sql.v1beta4.SqlBackendType|keyof typeof google.cloud.sql.v1beta4.SqlBackendType); - - /** DatabaseInstance selfLink. */ - public selfLink: string; - - /** DatabaseInstance suspensionReason. */ - public suspensionReason: google.cloud.sql.v1beta4.SqlSuspensionReason[]; - - /** DatabaseInstance connectionName. */ - public connectionName: string; - - /** DatabaseInstance name. */ - public name: string; - - /** DatabaseInstance region. */ - public region: string; - - /** DatabaseInstance gceZone. */ - public gceZone: string; - - /** DatabaseInstance secondaryGceZone. */ - public secondaryGceZone: string; - - /** DatabaseInstance diskEncryptionConfiguration. */ - public diskEncryptionConfiguration?: (google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null); - - /** DatabaseInstance diskEncryptionStatus. */ - public diskEncryptionStatus?: (google.cloud.sql.v1beta4.IDiskEncryptionStatus|null); - - /** DatabaseInstance rootPassword. */ - public rootPassword: string; - - /** DatabaseInstance scheduledMaintenance. */ - public scheduledMaintenance?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance|null); - - /** DatabaseInstance satisfiesPzs. */ - public satisfiesPzs?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance databaseInstalledVersion. */ - public databaseInstalledVersion: string; - - /** DatabaseInstance outOfDiskReport. */ - public outOfDiskReport?: (google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport|null); - - /** DatabaseInstance createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** DatabaseInstance availableMaintenanceVersions. */ - public availableMaintenanceVersions: string[]; - - /** DatabaseInstance maintenanceVersion. */ - public maintenanceVersion: string; - - /** DatabaseInstance upgradableDatabaseVersions. */ - public upgradableDatabaseVersions: google.cloud.sql.v1beta4.IAvailableDatabaseVersion[]; - - /** DatabaseInstance sqlNetworkArchitecture. */ - public sqlNetworkArchitecture?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|null); - - /** DatabaseInstance pscServiceAttachmentLink. */ - public pscServiceAttachmentLink?: (string|null); - - /** DatabaseInstance dnsName. */ - public dnsName?: (string|null); - - /** DatabaseInstance primaryDnsName. */ - public primaryDnsName?: (string|null); - - /** DatabaseInstance writeEndpoint. */ - public writeEndpoint?: (string|null); - - /** DatabaseInstance replicationCluster. */ - public replicationCluster?: (google.cloud.sql.v1beta4.IReplicationCluster|null); - - /** DatabaseInstance geminiConfig. */ - public geminiConfig?: (google.cloud.sql.v1beta4.IGeminiInstanceConfig|null); - - /** DatabaseInstance satisfiesPzi. */ - public satisfiesPzi?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance switchTransactionLogsToCloudStorageEnabled. */ - public switchTransactionLogsToCloudStorageEnabled?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance includeReplicasForMajorVersionUpgrade. */ - public includeReplicasForMajorVersionUpgrade?: (google.protobuf.IBoolValue|null); - - /** DatabaseInstance tags. */ - public tags: { [k: string]: string }; - - /** DatabaseInstance nodeCount. */ - public nodeCount?: (number|null); - - /** DatabaseInstance nodes. */ - public nodes: google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig[]; - - /** DatabaseInstance dnsNames. */ - public dnsNames: google.cloud.sql.v1beta4.IDnsNameMapping[]; - - /** - * Creates a new DatabaseInstance instance using the specified properties. - * @param [properties] Properties to set - * @returns DatabaseInstance instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDatabaseInstance): google.cloud.sql.v1beta4.DatabaseInstance; - - /** - * Encodes the specified DatabaseInstance message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.verify|verify} messages. - * @param message DatabaseInstance message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDatabaseInstance, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DatabaseInstance message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.verify|verify} messages. - * @param message DatabaseInstance message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDatabaseInstance, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DatabaseInstance message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DatabaseInstance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseInstance; - - /** - * Decodes a DatabaseInstance message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DatabaseInstance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseInstance; - - /** - * Verifies a DatabaseInstance message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DatabaseInstance message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DatabaseInstance - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseInstance; - - /** - * Creates a plain object from a DatabaseInstance message. Also converts values to other types if specified. - * @param message DatabaseInstance - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DatabaseInstance, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DatabaseInstance to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DatabaseInstance - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DatabaseInstance { - - /** SqlInstanceState enum. */ - enum SqlInstanceState { - SQL_INSTANCE_STATE_UNSPECIFIED = 0, - RUNNABLE = 1, - SUSPENDED = 2, - PENDING_DELETE = 3, - PENDING_CREATE = 4, - MAINTENANCE = 5, - FAILED = 6, - ONLINE_MAINTENANCE = 7, - REPAIRING = 8 - } - - /** Properties of a SqlFailoverReplica. */ - interface ISqlFailoverReplica { - - /** SqlFailoverReplica name */ - name?: (string|null); - - /** SqlFailoverReplica available */ - available?: (google.protobuf.IBoolValue|null); - } - - /** Represents a SqlFailoverReplica. */ - class SqlFailoverReplica implements ISqlFailoverReplica { - - /** - * Constructs a new SqlFailoverReplica. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica); - - /** SqlFailoverReplica name. */ - public name: string; - - /** SqlFailoverReplica available. */ - public available?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new SqlFailoverReplica instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlFailoverReplica instance - */ - public static create(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica): google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica; - - /** - * Encodes the specified SqlFailoverReplica message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. - * @param message SqlFailoverReplica message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlFailoverReplica message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. - * @param message SqlFailoverReplica message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlFailoverReplica message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlFailoverReplica - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica; - - /** - * Decodes a SqlFailoverReplica message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlFailoverReplica - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica; - - /** - * Verifies a SqlFailoverReplica message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlFailoverReplica message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlFailoverReplica - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica; - - /** - * Creates a plain object from a SqlFailoverReplica message. Also converts values to other types if specified. - * @param message SqlFailoverReplica - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlFailoverReplica to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlFailoverReplica - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlScheduledMaintenance. */ - interface ISqlScheduledMaintenance { - - /** SqlScheduledMaintenance startTime */ - startTime?: (google.protobuf.ITimestamp|null); - - /** SqlScheduledMaintenance canDefer */ - canDefer?: (boolean|null); - - /** SqlScheduledMaintenance canReschedule */ - canReschedule?: (boolean|null); - - /** SqlScheduledMaintenance scheduleDeadlineTime */ - scheduleDeadlineTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a SqlScheduledMaintenance. */ - class SqlScheduledMaintenance implements ISqlScheduledMaintenance { - - /** - * Constructs a new SqlScheduledMaintenance. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance); - - /** SqlScheduledMaintenance startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); - - /** SqlScheduledMaintenance canDefer. */ - public canDefer: boolean; - - /** SqlScheduledMaintenance canReschedule. */ - public canReschedule: boolean; - - /** SqlScheduledMaintenance scheduleDeadlineTime. */ - public scheduleDeadlineTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new SqlScheduledMaintenance instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlScheduledMaintenance instance - */ - public static create(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance): google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance; - - /** - * Encodes the specified SqlScheduledMaintenance message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. - * @param message SqlScheduledMaintenance message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlScheduledMaintenance message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. - * @param message SqlScheduledMaintenance message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlScheduledMaintenance message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlScheduledMaintenance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance; - - /** - * Decodes a SqlScheduledMaintenance message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlScheduledMaintenance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance; - - /** - * Verifies a SqlScheduledMaintenance message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlScheduledMaintenance message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlScheduledMaintenance - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance; - - /** - * Creates a plain object from a SqlScheduledMaintenance message. Also converts values to other types if specified. - * @param message SqlScheduledMaintenance - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlScheduledMaintenance to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlScheduledMaintenance - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlOutOfDiskReport. */ - interface ISqlOutOfDiskReport { - - /** SqlOutOfDiskReport sqlOutOfDiskState */ - sqlOutOfDiskState?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null); - - /** SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb */ - sqlMinRecommendedIncreaseSizeGb?: (number|null); - } - - /** Represents a SqlOutOfDiskReport. */ - class SqlOutOfDiskReport implements ISqlOutOfDiskReport { - - /** - * Constructs a new SqlOutOfDiskReport. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport); - - /** SqlOutOfDiskReport sqlOutOfDiskState. */ - public sqlOutOfDiskState?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null); - - /** SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb. */ - public sqlMinRecommendedIncreaseSizeGb?: (number|null); - - /** - * Creates a new SqlOutOfDiskReport instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlOutOfDiskReport instance - */ - public static create(properties?: google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport): google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport; - - /** - * Encodes the specified SqlOutOfDiskReport message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. - * @param message SqlOutOfDiskReport message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlOutOfDiskReport message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. - * @param message SqlOutOfDiskReport message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlOutOfDiskReport message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlOutOfDiskReport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport; - - /** - * Decodes a SqlOutOfDiskReport message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlOutOfDiskReport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport; - - /** - * Verifies a SqlOutOfDiskReport message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlOutOfDiskReport message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlOutOfDiskReport - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport; - - /** - * Creates a plain object from a SqlOutOfDiskReport message. Also converts values to other types if specified. - * @param message SqlOutOfDiskReport - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlOutOfDiskReport to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlOutOfDiskReport - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlOutOfDiskReport { - - /** SqlOutOfDiskState enum. */ - enum SqlOutOfDiskState { - SQL_OUT_OF_DISK_STATE_UNSPECIFIED = 0, - NORMAL = 1, - SOFT_SHUTDOWN = 2 - } - } - - /** SqlNetworkArchitecture enum. */ - enum SqlNetworkArchitecture { - SQL_NETWORK_ARCHITECTURE_UNSPECIFIED = 0, - NEW_NETWORK_ARCHITECTURE = 1, - OLD_NETWORK_ARCHITECTURE = 2 - } - - /** Properties of a PoolNodeConfig. */ - interface IPoolNodeConfig { - - /** PoolNodeConfig name */ - name?: (string|null); - - /** PoolNodeConfig gceZone */ - gceZone?: (string|null); - - /** PoolNodeConfig ipAddresses */ - ipAddresses?: (google.cloud.sql.v1beta4.IIpMapping[]|null); - - /** PoolNodeConfig dnsName */ - dnsName?: (string|null); - - /** PoolNodeConfig state */ - state?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null); - - /** PoolNodeConfig dnsNames */ - dnsNames?: (google.cloud.sql.v1beta4.IDnsNameMapping[]|null); - - /** PoolNodeConfig pscServiceAttachmentLink */ - pscServiceAttachmentLink?: (string|null); - - /** PoolNodeConfig pscAutoConnections */ - pscAutoConnections?: (google.cloud.sql.v1beta4.IPscAutoConnectionConfig[]|null); - } - - /** Represents a PoolNodeConfig. */ - class PoolNodeConfig implements IPoolNodeConfig { - - /** - * Constructs a new PoolNodeConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig); - - /** PoolNodeConfig name. */ - public name?: (string|null); - - /** PoolNodeConfig gceZone. */ - public gceZone?: (string|null); - - /** PoolNodeConfig ipAddresses. */ - public ipAddresses: google.cloud.sql.v1beta4.IIpMapping[]; - - /** PoolNodeConfig dnsName. */ - public dnsName?: (string|null); - - /** PoolNodeConfig state. */ - public state?: (google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|keyof typeof google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null); - - /** PoolNodeConfig dnsNames. */ - public dnsNames: google.cloud.sql.v1beta4.IDnsNameMapping[]; - - /** PoolNodeConfig pscServiceAttachmentLink. */ - public pscServiceAttachmentLink?: (string|null); - - /** PoolNodeConfig pscAutoConnections. */ - public pscAutoConnections: google.cloud.sql.v1beta4.IPscAutoConnectionConfig[]; - - /** - * Creates a new PoolNodeConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns PoolNodeConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig): google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig; - - /** - * Encodes the specified PoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.verify|verify} messages. - * @param message PoolNodeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.verify|verify} messages. - * @param message PoolNodeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PoolNodeConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig; - - /** - * Decodes a PoolNodeConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig; - - /** - * Verifies a PoolNodeConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PoolNodeConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PoolNodeConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig; - - /** - * Creates a plain object from a PoolNodeConfig message. Also converts values to other types if specified. - * @param message PoolNodeConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PoolNodeConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PoolNodeConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a DnsNameMapping. */ - interface IDnsNameMapping { - - /** DnsNameMapping name */ - name?: (string|null); - - /** DnsNameMapping connectionType */ - connectionType?: (google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType|null); - - /** DnsNameMapping dnsScope */ - dnsScope?: (google.cloud.sql.v1beta4.DnsNameMapping.DnsScope|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.DnsScope|null); - - /** DnsNameMapping recordManager */ - recordManager?: (google.cloud.sql.v1beta4.DnsNameMapping.RecordManager|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.RecordManager|null); - } - - /** Represents a DnsNameMapping. */ - class DnsNameMapping implements IDnsNameMapping { - - /** - * Constructs a new DnsNameMapping. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDnsNameMapping); - - /** DnsNameMapping name. */ - public name: string; - - /** DnsNameMapping connectionType. */ - public connectionType: (google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType); - - /** DnsNameMapping dnsScope. */ - public dnsScope: (google.cloud.sql.v1beta4.DnsNameMapping.DnsScope|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.DnsScope); - - /** DnsNameMapping recordManager. */ - public recordManager: (google.cloud.sql.v1beta4.DnsNameMapping.RecordManager|keyof typeof google.cloud.sql.v1beta4.DnsNameMapping.RecordManager); - - /** - * Creates a new DnsNameMapping instance using the specified properties. - * @param [properties] Properties to set - * @returns DnsNameMapping instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDnsNameMapping): google.cloud.sql.v1beta4.DnsNameMapping; - - /** - * Encodes the specified DnsNameMapping message. Does not implicitly {@link google.cloud.sql.v1beta4.DnsNameMapping.verify|verify} messages. - * @param message DnsNameMapping message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDnsNameMapping, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DnsNameMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DnsNameMapping.verify|verify} messages. - * @param message DnsNameMapping message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDnsNameMapping, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DnsNameMapping message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DnsNameMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DnsNameMapping; - - /** - * Decodes a DnsNameMapping message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DnsNameMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DnsNameMapping; - - /** - * Verifies a DnsNameMapping message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DnsNameMapping message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DnsNameMapping - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DnsNameMapping; - - /** - * Creates a plain object from a DnsNameMapping message. Also converts values to other types if specified. - * @param message DnsNameMapping - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DnsNameMapping, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DnsNameMapping to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DnsNameMapping - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DnsNameMapping { - - /** ConnectionType enum. */ - enum ConnectionType { - CONNECTION_TYPE_UNSPECIFIED = 0, - PUBLIC = 1, - PRIVATE_SERVICES_ACCESS = 2, - PRIVATE_SERVICE_CONNECT = 3 - } - - /** DnsScope enum. */ - enum DnsScope { - DNS_SCOPE_UNSPECIFIED = 0, - INSTANCE = 1, - CLUSTER = 2 - } - - /** RecordManager enum. */ - enum RecordManager { - RECORD_MANAGER_UNSPECIFIED = 0, - CUSTOMER = 1, - CLOUD_SQL_AUTOMATION = 2 - } - } - - /** Properties of a GeminiInstanceConfig. */ - interface IGeminiInstanceConfig { - - /** GeminiInstanceConfig entitled */ - entitled?: (boolean|null); - - /** GeminiInstanceConfig googleVacuumMgmtEnabled */ - googleVacuumMgmtEnabled?: (boolean|null); - - /** GeminiInstanceConfig oomSessionCancelEnabled */ - oomSessionCancelEnabled?: (boolean|null); - - /** GeminiInstanceConfig activeQueryEnabled */ - activeQueryEnabled?: (boolean|null); - - /** GeminiInstanceConfig indexAdvisorEnabled */ - indexAdvisorEnabled?: (boolean|null); - - /** GeminiInstanceConfig flagRecommenderEnabled */ - flagRecommenderEnabled?: (boolean|null); - } - - /** Represents a GeminiInstanceConfig. */ - class GeminiInstanceConfig implements IGeminiInstanceConfig { - - /** - * Constructs a new GeminiInstanceConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IGeminiInstanceConfig); - - /** GeminiInstanceConfig entitled. */ - public entitled?: (boolean|null); - - /** GeminiInstanceConfig googleVacuumMgmtEnabled. */ - public googleVacuumMgmtEnabled?: (boolean|null); - - /** GeminiInstanceConfig oomSessionCancelEnabled. */ - public oomSessionCancelEnabled?: (boolean|null); - - /** GeminiInstanceConfig activeQueryEnabled. */ - public activeQueryEnabled?: (boolean|null); - - /** GeminiInstanceConfig indexAdvisorEnabled. */ - public indexAdvisorEnabled?: (boolean|null); - - /** GeminiInstanceConfig flagRecommenderEnabled. */ - public flagRecommenderEnabled?: (boolean|null); - - /** - * Creates a new GeminiInstanceConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns GeminiInstanceConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IGeminiInstanceConfig): google.cloud.sql.v1beta4.GeminiInstanceConfig; - - /** - * Encodes the specified GeminiInstanceConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.GeminiInstanceConfig.verify|verify} messages. - * @param message GeminiInstanceConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IGeminiInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GeminiInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GeminiInstanceConfig.verify|verify} messages. - * @param message GeminiInstanceConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IGeminiInstanceConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GeminiInstanceConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GeminiInstanceConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.GeminiInstanceConfig; - - /** - * Decodes a GeminiInstanceConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GeminiInstanceConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.GeminiInstanceConfig; - - /** - * Verifies a GeminiInstanceConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GeminiInstanceConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GeminiInstanceConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.GeminiInstanceConfig; - - /** - * Creates a plain object from a GeminiInstanceConfig message. Also converts values to other types if specified. - * @param message GeminiInstanceConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.GeminiInstanceConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GeminiInstanceConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GeminiInstanceConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ReplicationCluster. */ - interface IReplicationCluster { - - /** ReplicationCluster psaWriteEndpoint */ - psaWriteEndpoint?: (string|null); - - /** ReplicationCluster failoverDrReplicaName */ - failoverDrReplicaName?: (string|null); - - /** ReplicationCluster drReplica */ - drReplica?: (boolean|null); - } - - /** Represents a ReplicationCluster. */ - class ReplicationCluster implements IReplicationCluster { - - /** - * Constructs a new ReplicationCluster. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IReplicationCluster); - - /** ReplicationCluster psaWriteEndpoint. */ - public psaWriteEndpoint?: (string|null); - - /** ReplicationCluster failoverDrReplicaName. */ - public failoverDrReplicaName?: (string|null); - - /** ReplicationCluster drReplica. */ - public drReplica?: (boolean|null); - - /** - * Creates a new ReplicationCluster instance using the specified properties. - * @param [properties] Properties to set - * @returns ReplicationCluster instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IReplicationCluster): google.cloud.sql.v1beta4.ReplicationCluster; - - /** - * Encodes the specified ReplicationCluster message. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicationCluster.verify|verify} messages. - * @param message ReplicationCluster message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IReplicationCluster, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReplicationCluster message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicationCluster.verify|verify} messages. - * @param message ReplicationCluster message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IReplicationCluster, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReplicationCluster message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReplicationCluster - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ReplicationCluster; - - /** - * Decodes a ReplicationCluster message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReplicationCluster - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ReplicationCluster; - - /** - * Verifies a ReplicationCluster message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ReplicationCluster message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReplicationCluster - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ReplicationCluster; - - /** - * Creates a plain object from a ReplicationCluster message. Also converts values to other types if specified. - * @param message ReplicationCluster - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ReplicationCluster, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReplicationCluster to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReplicationCluster - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AvailableDatabaseVersion. */ - interface IAvailableDatabaseVersion { - - /** AvailableDatabaseVersion majorVersion */ - majorVersion?: (string|null); - - /** AvailableDatabaseVersion name */ - name?: (string|null); - - /** AvailableDatabaseVersion displayName */ - displayName?: (string|null); - } - - /** Represents an AvailableDatabaseVersion. */ - class AvailableDatabaseVersion implements IAvailableDatabaseVersion { - - /** - * Constructs a new AvailableDatabaseVersion. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IAvailableDatabaseVersion); - - /** AvailableDatabaseVersion majorVersion. */ - public majorVersion?: (string|null); - - /** AvailableDatabaseVersion name. */ - public name?: (string|null); - - /** AvailableDatabaseVersion displayName. */ - public displayName?: (string|null); - - /** - * Creates a new AvailableDatabaseVersion instance using the specified properties. - * @param [properties] Properties to set - * @returns AvailableDatabaseVersion instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IAvailableDatabaseVersion): google.cloud.sql.v1beta4.AvailableDatabaseVersion; - - /** - * Encodes the specified AvailableDatabaseVersion message. Does not implicitly {@link google.cloud.sql.v1beta4.AvailableDatabaseVersion.verify|verify} messages. - * @param message AvailableDatabaseVersion message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IAvailableDatabaseVersion, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AvailableDatabaseVersion message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AvailableDatabaseVersion.verify|verify} messages. - * @param message AvailableDatabaseVersion message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IAvailableDatabaseVersion, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AvailableDatabaseVersion message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AvailableDatabaseVersion - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.AvailableDatabaseVersion; - - /** - * Decodes an AvailableDatabaseVersion message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AvailableDatabaseVersion - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.AvailableDatabaseVersion; - - /** - * Verifies an AvailableDatabaseVersion message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an AvailableDatabaseVersion message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AvailableDatabaseVersion - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.AvailableDatabaseVersion; - - /** - * Creates a plain object from an AvailableDatabaseVersion message. Also converts values to other types if specified. - * @param message AvailableDatabaseVersion - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.AvailableDatabaseVersion, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AvailableDatabaseVersion to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AvailableDatabaseVersion - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DatabasesListResponse. */ - interface IDatabasesListResponse { - - /** DatabasesListResponse kind */ - kind?: (string|null); - - /** DatabasesListResponse items */ - items?: (google.cloud.sql.v1beta4.IDatabase[]|null); - } - - /** Represents a DatabasesListResponse. */ - class DatabasesListResponse implements IDatabasesListResponse { - - /** - * Constructs a new DatabasesListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDatabasesListResponse); - - /** DatabasesListResponse kind. */ - public kind: string; - - /** DatabasesListResponse items. */ - public items: google.cloud.sql.v1beta4.IDatabase[]; - - /** - * Creates a new DatabasesListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns DatabasesListResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDatabasesListResponse): google.cloud.sql.v1beta4.DatabasesListResponse; - - /** - * Encodes the specified DatabasesListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabasesListResponse.verify|verify} messages. - * @param message DatabasesListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDatabasesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DatabasesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabasesListResponse.verify|verify} messages. - * @param message DatabasesListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDatabasesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DatabasesListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DatabasesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DatabasesListResponse; - - /** - * Decodes a DatabasesListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DatabasesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DatabasesListResponse; - - /** - * Verifies a DatabasesListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DatabasesListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DatabasesListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DatabasesListResponse; - - /** - * Creates a plain object from a DatabasesListResponse message. Also converts values to other types if specified. - * @param message DatabasesListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DatabasesListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DatabasesListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DatabasesListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DemoteMasterConfiguration. */ - interface IDemoteMasterConfiguration { - - /** DemoteMasterConfiguration kind */ - kind?: (string|null); - - /** DemoteMasterConfiguration mysqlReplicaConfiguration */ - mysqlReplicaConfiguration?: (google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration|null); - } - - /** Represents a DemoteMasterConfiguration. */ - class DemoteMasterConfiguration implements IDemoteMasterConfiguration { - - /** - * Constructs a new DemoteMasterConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDemoteMasterConfiguration); - - /** DemoteMasterConfiguration kind. */ - public kind: string; - - /** DemoteMasterConfiguration mysqlReplicaConfiguration. */ - public mysqlReplicaConfiguration?: (google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration|null); - - /** - * Creates a new DemoteMasterConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns DemoteMasterConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDemoteMasterConfiguration): google.cloud.sql.v1beta4.DemoteMasterConfiguration; - - /** - * Encodes the specified DemoteMasterConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterConfiguration.verify|verify} messages. - * @param message DemoteMasterConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDemoteMasterConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DemoteMasterConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterConfiguration.verify|verify} messages. - * @param message DemoteMasterConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDemoteMasterConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DemoteMasterConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DemoteMasterConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DemoteMasterConfiguration; - - /** - * Decodes a DemoteMasterConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DemoteMasterConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DemoteMasterConfiguration; - - /** - * Verifies a DemoteMasterConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DemoteMasterConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DemoteMasterConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DemoteMasterConfiguration; - - /** - * Creates a plain object from a DemoteMasterConfiguration message. Also converts values to other types if specified. - * @param message DemoteMasterConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DemoteMasterConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DemoteMasterConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DemoteMasterConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DemoteMasterContext. */ - interface IDemoteMasterContext { - - /** DemoteMasterContext kind */ - kind?: (string|null); - - /** DemoteMasterContext verifyGtidConsistency */ - verifyGtidConsistency?: (google.protobuf.IBoolValue|null); - - /** DemoteMasterContext masterInstanceName */ - masterInstanceName?: (string|null); - - /** DemoteMasterContext replicaConfiguration */ - replicaConfiguration?: (google.cloud.sql.v1beta4.IDemoteMasterConfiguration|null); - - /** DemoteMasterContext skipReplicationSetup */ - skipReplicationSetup?: (boolean|null); - } - - /** Represents a DemoteMasterContext. */ - class DemoteMasterContext implements IDemoteMasterContext { - - /** - * Constructs a new DemoteMasterContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDemoteMasterContext); - - /** DemoteMasterContext kind. */ - public kind: string; - - /** DemoteMasterContext verifyGtidConsistency. */ - public verifyGtidConsistency?: (google.protobuf.IBoolValue|null); - - /** DemoteMasterContext masterInstanceName. */ - public masterInstanceName: string; - - /** DemoteMasterContext replicaConfiguration. */ - public replicaConfiguration?: (google.cloud.sql.v1beta4.IDemoteMasterConfiguration|null); - - /** DemoteMasterContext skipReplicationSetup. */ - public skipReplicationSetup: boolean; - - /** - * Creates a new DemoteMasterContext instance using the specified properties. - * @param [properties] Properties to set - * @returns DemoteMasterContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDemoteMasterContext): google.cloud.sql.v1beta4.DemoteMasterContext; - - /** - * Encodes the specified DemoteMasterContext message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterContext.verify|verify} messages. - * @param message DemoteMasterContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDemoteMasterContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DemoteMasterContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterContext.verify|verify} messages. - * @param message DemoteMasterContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDemoteMasterContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DemoteMasterContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DemoteMasterContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DemoteMasterContext; - - /** - * Decodes a DemoteMasterContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DemoteMasterContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DemoteMasterContext; - - /** - * Verifies a DemoteMasterContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DemoteMasterContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DemoteMasterContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DemoteMasterContext; - - /** - * Creates a plain object from a DemoteMasterContext message. Also converts values to other types if specified. - * @param message DemoteMasterContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DemoteMasterContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DemoteMasterContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DemoteMasterContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DemoteMasterMySqlReplicaConfiguration. */ - interface IDemoteMasterMySqlReplicaConfiguration { - - /** DemoteMasterMySqlReplicaConfiguration kind */ - kind?: (string|null); - - /** DemoteMasterMySqlReplicaConfiguration username */ - username?: (string|null); - - /** DemoteMasterMySqlReplicaConfiguration password */ - password?: (string|null); - - /** DemoteMasterMySqlReplicaConfiguration clientKey */ - clientKey?: (string|null); - - /** DemoteMasterMySqlReplicaConfiguration clientCertificate */ - clientCertificate?: (string|null); - - /** DemoteMasterMySqlReplicaConfiguration caCertificate */ - caCertificate?: (string|null); - } - - /** Represents a DemoteMasterMySqlReplicaConfiguration. */ - class DemoteMasterMySqlReplicaConfiguration implements IDemoteMasterMySqlReplicaConfiguration { - - /** - * Constructs a new DemoteMasterMySqlReplicaConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration); - - /** DemoteMasterMySqlReplicaConfiguration kind. */ - public kind: string; - - /** DemoteMasterMySqlReplicaConfiguration username. */ - public username: string; - - /** DemoteMasterMySqlReplicaConfiguration password. */ - public password: string; - - /** DemoteMasterMySqlReplicaConfiguration clientKey. */ - public clientKey: string; - - /** DemoteMasterMySqlReplicaConfiguration clientCertificate. */ - public clientCertificate: string; - - /** DemoteMasterMySqlReplicaConfiguration caCertificate. */ - public caCertificate: string; - - /** - * Creates a new DemoteMasterMySqlReplicaConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns DemoteMasterMySqlReplicaConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration): google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration; - - /** - * Encodes the specified DemoteMasterMySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. - * @param message DemoteMasterMySqlReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DemoteMasterMySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. - * @param message DemoteMasterMySqlReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DemoteMasterMySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration; - - /** - * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DemoteMasterMySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration; - - /** - * Verifies a DemoteMasterMySqlReplicaConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DemoteMasterMySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DemoteMasterMySqlReplicaConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration; - - /** - * Creates a plain object from a DemoteMasterMySqlReplicaConfiguration message. Also converts values to other types if specified. - * @param message DemoteMasterMySqlReplicaConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DemoteMasterMySqlReplicaConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DemoteMasterMySqlReplicaConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DemoteContext. */ - interface IDemoteContext { - - /** DemoteContext kind */ - kind?: (string|null); - - /** DemoteContext sourceRepresentativeInstanceName */ - sourceRepresentativeInstanceName?: (string|null); - } - - /** Represents a DemoteContext. */ - class DemoteContext implements IDemoteContext { - - /** - * Constructs a new DemoteContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDemoteContext); - - /** DemoteContext kind. */ - public kind: string; - - /** DemoteContext sourceRepresentativeInstanceName. */ - public sourceRepresentativeInstanceName: string; - - /** - * Creates a new DemoteContext instance using the specified properties. - * @param [properties] Properties to set - * @returns DemoteContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDemoteContext): google.cloud.sql.v1beta4.DemoteContext; - - /** - * Encodes the specified DemoteContext message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteContext.verify|verify} messages. - * @param message DemoteContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDemoteContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DemoteContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteContext.verify|verify} messages. - * @param message DemoteContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDemoteContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DemoteContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DemoteContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DemoteContext; - - /** - * Decodes a DemoteContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DemoteContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DemoteContext; - - /** - * Verifies a DemoteContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DemoteContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DemoteContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DemoteContext; - - /** - * Creates a plain object from a DemoteContext message. Also converts values to other types if specified. - * @param message DemoteContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DemoteContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DemoteContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DemoteContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlFileType enum. */ - enum SqlFileType { - SQL_FILE_TYPE_UNSPECIFIED = 0, - SQL = 1, - CSV = 2, - BAK = 4, - TDE = 8 - } - - /** Properties of an ExportContext. */ - interface IExportContext { - - /** ExportContext uri */ - uri?: (string|null); - - /** ExportContext databases */ - databases?: (string[]|null); - - /** ExportContext kind */ - kind?: (string|null); - - /** ExportContext sqlExportOptions */ - sqlExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions|null); - - /** ExportContext csvExportOptions */ - csvExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions|null); - - /** ExportContext fileType */ - fileType?: (google.cloud.sql.v1beta4.SqlFileType|keyof typeof google.cloud.sql.v1beta4.SqlFileType|null); - - /** ExportContext offload */ - offload?: (google.protobuf.IBoolValue|null); - - /** ExportContext bakExportOptions */ - bakExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions|null); - - /** ExportContext tdeExportOptions */ - tdeExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions|null); - } - - /** Represents an ExportContext. */ - class ExportContext implements IExportContext { - - /** - * Constructs a new ExportContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IExportContext); - - /** ExportContext uri. */ - public uri: string; - - /** ExportContext databases. */ - public databases: string[]; - - /** ExportContext kind. */ - public kind: string; - - /** ExportContext sqlExportOptions. */ - public sqlExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions|null); - - /** ExportContext csvExportOptions. */ - public csvExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions|null); - - /** ExportContext fileType. */ - public fileType: (google.cloud.sql.v1beta4.SqlFileType|keyof typeof google.cloud.sql.v1beta4.SqlFileType); - - /** ExportContext offload. */ - public offload?: (google.protobuf.IBoolValue|null); - - /** ExportContext bakExportOptions. */ - public bakExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions|null); - - /** ExportContext tdeExportOptions. */ - public tdeExportOptions?: (google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions|null); - - /** - * Creates a new ExportContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ExportContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IExportContext): google.cloud.sql.v1beta4.ExportContext; - - /** - * Encodes the specified ExportContext message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.verify|verify} messages. - * @param message ExportContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IExportContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.verify|verify} messages. - * @param message ExportContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IExportContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExportContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext; - - /** - * Decodes an ExportContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext; - - /** - * Verifies an ExportContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ExportContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExportContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext; - - /** - * Creates a plain object from an ExportContext message. Also converts values to other types if specified. - * @param message ExportContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ExportContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExportContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExportContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ExportContext { - - /** Properties of a SqlCsvExportOptions. */ - interface ISqlCsvExportOptions { - - /** SqlCsvExportOptions selectQuery */ - selectQuery?: (string|null); - - /** SqlCsvExportOptions escapeCharacter */ - escapeCharacter?: (string|null); - - /** SqlCsvExportOptions quoteCharacter */ - quoteCharacter?: (string|null); - - /** SqlCsvExportOptions fieldsTerminatedBy */ - fieldsTerminatedBy?: (string|null); - - /** SqlCsvExportOptions linesTerminatedBy */ - linesTerminatedBy?: (string|null); - } - - /** Represents a SqlCsvExportOptions. */ - class SqlCsvExportOptions implements ISqlCsvExportOptions { - - /** - * Constructs a new SqlCsvExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions); - - /** SqlCsvExportOptions selectQuery. */ - public selectQuery: string; - - /** SqlCsvExportOptions escapeCharacter. */ - public escapeCharacter: string; - - /** SqlCsvExportOptions quoteCharacter. */ - public quoteCharacter: string; - - /** SqlCsvExportOptions fieldsTerminatedBy. */ - public fieldsTerminatedBy: string; - - /** SqlCsvExportOptions linesTerminatedBy. */ - public linesTerminatedBy: string; - - /** - * Creates a new SqlCsvExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlCsvExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions; - - /** - * Encodes the specified SqlCsvExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.verify|verify} messages. - * @param message SqlCsvExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlCsvExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.verify|verify} messages. - * @param message SqlCsvExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlCsvExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlCsvExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions; - - /** - * Decodes a SqlCsvExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlCsvExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions; - - /** - * Verifies a SqlCsvExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlCsvExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlCsvExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions; - - /** - * Creates a plain object from a SqlCsvExportOptions message. Also converts values to other types if specified. - * @param message SqlCsvExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlCsvExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlCsvExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlExportOptions. */ - interface ISqlExportOptions { - - /** SqlExportOptions tables */ - tables?: (string[]|null); - - /** SqlExportOptions schemaOnly */ - schemaOnly?: (google.protobuf.IBoolValue|null); - - /** SqlExportOptions mysqlExportOptions */ - mysqlExportOptions?: (google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions|null); - - /** SqlExportOptions threads */ - threads?: (google.protobuf.IInt32Value|null); - - /** SqlExportOptions parallel */ - parallel?: (google.protobuf.IBoolValue|null); - - /** SqlExportOptions postgresExportOptions */ - postgresExportOptions?: (google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions|null); - } - - /** Represents a SqlExportOptions. */ - class SqlExportOptions implements ISqlExportOptions { - - /** - * Constructs a new SqlExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions); - - /** SqlExportOptions tables. */ - public tables: string[]; - - /** SqlExportOptions schemaOnly. */ - public schemaOnly?: (google.protobuf.IBoolValue|null); - - /** SqlExportOptions mysqlExportOptions. */ - public mysqlExportOptions?: (google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions|null); - - /** SqlExportOptions threads. */ - public threads?: (google.protobuf.IInt32Value|null); - - /** SqlExportOptions parallel. */ - public parallel?: (google.protobuf.IBoolValue|null); - - /** SqlExportOptions postgresExportOptions. */ - public postgresExportOptions?: (google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions|null); - - /** - * Creates a new SqlExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions; - - /** - * Encodes the specified SqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.verify|verify} messages. - * @param message SqlExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.verify|verify} messages. - * @param message SqlExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions; - - /** - * Decodes a SqlExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions; - - /** - * Verifies a SqlExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions; - - /** - * Creates a plain object from a SqlExportOptions message. Also converts values to other types if specified. - * @param message SqlExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlExportOptions { - - /** Properties of a MysqlExportOptions. */ - interface IMysqlExportOptions { - - /** MysqlExportOptions masterData */ - masterData?: (google.protobuf.IInt32Value|null); - } - - /** Represents a MysqlExportOptions. */ - class MysqlExportOptions implements IMysqlExportOptions { - - /** - * Constructs a new MysqlExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions); - - /** MysqlExportOptions masterData. */ - public masterData?: (google.protobuf.IInt32Value|null); - - /** - * Creates a new MysqlExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns MysqlExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions; - - /** - * Encodes the specified MysqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. - * @param message MysqlExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MysqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. - * @param message MysqlExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MysqlExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MysqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions; - - /** - * Decodes a MysqlExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MysqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions; - - /** - * Verifies a MysqlExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MysqlExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MysqlExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions; - - /** - * Creates a plain object from a MysqlExportOptions message. Also converts values to other types if specified. - * @param message MysqlExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MysqlExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MysqlExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PostgresExportOptions. */ - interface IPostgresExportOptions { - - /** PostgresExportOptions clean */ - clean?: (google.protobuf.IBoolValue|null); - - /** PostgresExportOptions ifExists */ - ifExists?: (google.protobuf.IBoolValue|null); - } - - /** Represents a PostgresExportOptions. */ - class PostgresExportOptions implements IPostgresExportOptions { - - /** - * Constructs a new PostgresExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions); - - /** PostgresExportOptions clean. */ - public clean?: (google.protobuf.IBoolValue|null); - - /** PostgresExportOptions ifExists. */ - public ifExists?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new PostgresExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns PostgresExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions; - - /** - * Encodes the specified PostgresExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. - * @param message PostgresExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PostgresExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. - * @param message PostgresExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PostgresExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PostgresExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions; - - /** - * Decodes a PostgresExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PostgresExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions; - - /** - * Verifies a PostgresExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PostgresExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PostgresExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions; - - /** - * Creates a plain object from a PostgresExportOptions message. Also converts values to other types if specified. - * @param message PostgresExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PostgresExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PostgresExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a SqlBakExportOptions. */ - interface ISqlBakExportOptions { - - /** SqlBakExportOptions striped */ - striped?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions stripeCount */ - stripeCount?: (google.protobuf.IInt32Value|null); - - /** SqlBakExportOptions bakType */ - bakType?: (google.cloud.sql.v1beta4.BakType|keyof typeof google.cloud.sql.v1beta4.BakType|null); - - /** SqlBakExportOptions copyOnly */ - copyOnly?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions differentialBase */ - differentialBase?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions exportLogStartTime */ - exportLogStartTime?: (google.protobuf.ITimestamp|null); - - /** SqlBakExportOptions exportLogEndTime */ - exportLogEndTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a SqlBakExportOptions. */ - class SqlBakExportOptions implements ISqlBakExportOptions { - - /** - * Constructs a new SqlBakExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions); - - /** SqlBakExportOptions striped. */ - public striped?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions stripeCount. */ - public stripeCount?: (google.protobuf.IInt32Value|null); - - /** SqlBakExportOptions bakType. */ - public bakType: (google.cloud.sql.v1beta4.BakType|keyof typeof google.cloud.sql.v1beta4.BakType); - - /** SqlBakExportOptions copyOnly. */ - public copyOnly?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions differentialBase. */ - public differentialBase?: (google.protobuf.IBoolValue|null); - - /** SqlBakExportOptions exportLogStartTime. */ - public exportLogStartTime?: (google.protobuf.ITimestamp|null); - - /** SqlBakExportOptions exportLogEndTime. */ - public exportLogEndTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new SqlBakExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBakExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions; - - /** - * Encodes the specified SqlBakExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.verify|verify} messages. - * @param message SqlBakExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBakExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.verify|verify} messages. - * @param message SqlBakExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBakExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBakExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions; - - /** - * Decodes a SqlBakExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBakExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions; - - /** - * Verifies a SqlBakExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBakExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBakExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions; - - /** - * Creates a plain object from a SqlBakExportOptions message. Also converts values to other types if specified. - * @param message SqlBakExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBakExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBakExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlTdeExportOptions. */ - interface ISqlTdeExportOptions { - - /** SqlTdeExportOptions certificatePath */ - certificatePath?: (string|null); - - /** SqlTdeExportOptions privateKeyPath */ - privateKeyPath?: (string|null); - - /** SqlTdeExportOptions privateKeyPassword */ - privateKeyPassword?: (string|null); - - /** SqlTdeExportOptions name */ - name?: (string|null); - } - - /** Represents a SqlTdeExportOptions. */ - class SqlTdeExportOptions implements ISqlTdeExportOptions { - - /** - * Constructs a new SqlTdeExportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions); - - /** SqlTdeExportOptions certificatePath. */ - public certificatePath: string; - - /** SqlTdeExportOptions privateKeyPath. */ - public privateKeyPath: string; - - /** SqlTdeExportOptions privateKeyPassword. */ - public privateKeyPassword: string; - - /** SqlTdeExportOptions name. */ - public name: string; - - /** - * Creates a new SqlTdeExportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlTdeExportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions): google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions; - - /** - * Encodes the specified SqlTdeExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.verify|verify} messages. - * @param message SqlTdeExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlTdeExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.verify|verify} messages. - * @param message SqlTdeExportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlTdeExportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlTdeExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions; - - /** - * Decodes a SqlTdeExportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlTdeExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions; - - /** - * Verifies a SqlTdeExportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlTdeExportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlTdeExportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions; - - /** - * Creates a plain object from a SqlTdeExportOptions message. Also converts values to other types if specified. - * @param message SqlTdeExportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlTdeExportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlTdeExportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a FailoverContext. */ - interface IFailoverContext { - - /** FailoverContext settingsVersion */ - settingsVersion?: (number|Long|string|null); - - /** FailoverContext kind */ - kind?: (string|null); - } - - /** Represents a FailoverContext. */ - class FailoverContext implements IFailoverContext { - - /** - * Constructs a new FailoverContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IFailoverContext); - - /** FailoverContext settingsVersion. */ - public settingsVersion: (number|Long|string); - - /** FailoverContext kind. */ - public kind: string; - - /** - * Creates a new FailoverContext instance using the specified properties. - * @param [properties] Properties to set - * @returns FailoverContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IFailoverContext): google.cloud.sql.v1beta4.FailoverContext; - - /** - * Encodes the specified FailoverContext message. Does not implicitly {@link google.cloud.sql.v1beta4.FailoverContext.verify|verify} messages. - * @param message FailoverContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IFailoverContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FailoverContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FailoverContext.verify|verify} messages. - * @param message FailoverContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IFailoverContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FailoverContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FailoverContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.FailoverContext; - - /** - * Decodes a FailoverContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FailoverContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.FailoverContext; - - /** - * Verifies a FailoverContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FailoverContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FailoverContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.FailoverContext; - - /** - * Creates a plain object from a FailoverContext message. Also converts values to other types if specified. - * @param message FailoverContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.FailoverContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FailoverContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FailoverContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Flag. */ - interface IFlag { - - /** Flag name */ - name?: (string|null); - - /** Flag type */ - type?: (google.cloud.sql.v1beta4.SqlFlagType|keyof typeof google.cloud.sql.v1beta4.SqlFlagType|null); - - /** Flag appliesTo */ - appliesTo?: (google.cloud.sql.v1beta4.SqlDatabaseVersion[]|null); - - /** Flag allowedStringValues */ - allowedStringValues?: (string[]|null); - - /** Flag minValue */ - minValue?: (google.protobuf.IInt64Value|null); - - /** Flag maxValue */ - maxValue?: (google.protobuf.IInt64Value|null); - - /** Flag requiresRestart */ - requiresRestart?: (google.protobuf.IBoolValue|null); - - /** Flag kind */ - kind?: (string|null); - - /** Flag inBeta */ - inBeta?: (google.protobuf.IBoolValue|null); - - /** Flag allowedIntValues */ - allowedIntValues?: ((number|Long|string)[]|null); - - /** Flag flagScope */ - flagScope?: (google.cloud.sql.v1beta4.SqlFlagScope|keyof typeof google.cloud.sql.v1beta4.SqlFlagScope|null); - - /** Flag recommendedStringValue */ - recommendedStringValue?: (string|null); - - /** Flag recommendedIntValue */ - recommendedIntValue?: (google.protobuf.IInt64Value|null); - } - - /** Represents a Flag. */ - class Flag implements IFlag { - - /** - * Constructs a new Flag. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IFlag); - - /** Flag name. */ - public name: string; - - /** Flag type. */ - public type: (google.cloud.sql.v1beta4.SqlFlagType|keyof typeof google.cloud.sql.v1beta4.SqlFlagType); - - /** Flag appliesTo. */ - public appliesTo: google.cloud.sql.v1beta4.SqlDatabaseVersion[]; - - /** Flag allowedStringValues. */ - public allowedStringValues: string[]; - - /** Flag minValue. */ - public minValue?: (google.protobuf.IInt64Value|null); - - /** Flag maxValue. */ - public maxValue?: (google.protobuf.IInt64Value|null); - - /** Flag requiresRestart. */ - public requiresRestart?: (google.protobuf.IBoolValue|null); - - /** Flag kind. */ - public kind: string; - - /** Flag inBeta. */ - public inBeta?: (google.protobuf.IBoolValue|null); - - /** Flag allowedIntValues. */ - public allowedIntValues: (number|Long|string)[]; - - /** Flag flagScope. */ - public flagScope: (google.cloud.sql.v1beta4.SqlFlagScope|keyof typeof google.cloud.sql.v1beta4.SqlFlagScope); - - /** Flag recommendedStringValue. */ - public recommendedStringValue?: (string|null); - - /** Flag recommendedIntValue. */ - public recommendedIntValue?: (google.protobuf.IInt64Value|null); - - /** Flag recommendedValue. */ - public recommendedValue?: ("recommendedStringValue"|"recommendedIntValue"); - - /** - * Creates a new Flag instance using the specified properties. - * @param [properties] Properties to set - * @returns Flag instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IFlag): google.cloud.sql.v1beta4.Flag; - - /** - * Encodes the specified Flag message. Does not implicitly {@link google.cloud.sql.v1beta4.Flag.verify|verify} messages. - * @param message Flag message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IFlag, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Flag message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Flag.verify|verify} messages. - * @param message Flag message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IFlag, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Flag message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Flag - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Flag; - - /** - * Decodes a Flag message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Flag - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Flag; - - /** - * Verifies a Flag message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Flag message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Flag - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Flag; - - /** - * Creates a plain object from a Flag message. Also converts values to other types if specified. - * @param message Flag - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.Flag, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Flag to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Flag - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FlagsListResponse. */ - interface IFlagsListResponse { - - /** FlagsListResponse kind */ - kind?: (string|null); - - /** FlagsListResponse items */ - items?: (google.cloud.sql.v1beta4.IFlag[]|null); - } - - /** Represents a FlagsListResponse. */ - class FlagsListResponse implements IFlagsListResponse { - - /** - * Constructs a new FlagsListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IFlagsListResponse); - - /** FlagsListResponse kind. */ - public kind: string; - - /** FlagsListResponse items. */ - public items: google.cloud.sql.v1beta4.IFlag[]; - - /** - * Creates a new FlagsListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns FlagsListResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IFlagsListResponse): google.cloud.sql.v1beta4.FlagsListResponse; - - /** - * Encodes the specified FlagsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.FlagsListResponse.verify|verify} messages. - * @param message FlagsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IFlagsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FlagsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FlagsListResponse.verify|verify} messages. - * @param message FlagsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IFlagsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FlagsListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FlagsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.FlagsListResponse; - - /** - * Decodes a FlagsListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FlagsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.FlagsListResponse; - - /** - * Verifies a FlagsListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FlagsListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FlagsListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.FlagsListResponse; - - /** - * Creates a plain object from a FlagsListResponse message. Also converts values to other types if specified. - * @param message FlagsListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.FlagsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FlagsListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FlagsListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an ImportContext. */ - interface IImportContext { - - /** ImportContext uri */ - uri?: (string|null); - - /** ImportContext database */ - database?: (string|null); - - /** ImportContext kind */ - kind?: (string|null); - - /** ImportContext fileType */ - fileType?: (google.cloud.sql.v1beta4.SqlFileType|keyof typeof google.cloud.sql.v1beta4.SqlFileType|null); - - /** ImportContext csvImportOptions */ - csvImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions|null); - - /** ImportContext importUser */ - importUser?: (string|null); - - /** ImportContext bakImportOptions */ - bakImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions|null); - - /** ImportContext sqlImportOptions */ - sqlImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions|null); - - /** ImportContext tdeImportOptions */ - tdeImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions|null); - } - - /** Represents an ImportContext. */ - class ImportContext implements IImportContext { - - /** - * Constructs a new ImportContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IImportContext); - - /** ImportContext uri. */ - public uri: string; - - /** ImportContext database. */ - public database: string; - - /** ImportContext kind. */ - public kind: string; - - /** ImportContext fileType. */ - public fileType: (google.cloud.sql.v1beta4.SqlFileType|keyof typeof google.cloud.sql.v1beta4.SqlFileType); - - /** ImportContext csvImportOptions. */ - public csvImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions|null); - - /** ImportContext importUser. */ - public importUser: string; - - /** ImportContext bakImportOptions. */ - public bakImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions|null); - - /** ImportContext sqlImportOptions. */ - public sqlImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions|null); - - /** ImportContext tdeImportOptions. */ - public tdeImportOptions?: (google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions|null); - - /** - * Creates a new ImportContext instance using the specified properties. - * @param [properties] Properties to set - * @returns ImportContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IImportContext): google.cloud.sql.v1beta4.ImportContext; - - /** - * Encodes the specified ImportContext message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.verify|verify} messages. - * @param message ImportContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IImportContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ImportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.verify|verify} messages. - * @param message ImportContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IImportContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ImportContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ImportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext; - - /** - * Decodes an ImportContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ImportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext; - - /** - * Verifies an ImportContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ImportContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ImportContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext; - - /** - * Creates a plain object from an ImportContext message. Also converts values to other types if specified. - * @param message ImportContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ImportContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ImportContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ImportContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ImportContext { - - /** Properties of a SqlImportOptions. */ - interface ISqlImportOptions { - - /** SqlImportOptions threads */ - threads?: (google.protobuf.IInt32Value|null); - - /** SqlImportOptions parallel */ - parallel?: (google.protobuf.IBoolValue|null); - - /** SqlImportOptions postgresImportOptions */ - postgresImportOptions?: (google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions|null); - } - - /** Represents a SqlImportOptions. */ - class SqlImportOptions implements ISqlImportOptions { - - /** - * Constructs a new SqlImportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions); - - /** SqlImportOptions threads. */ - public threads?: (google.protobuf.IInt32Value|null); - - /** SqlImportOptions parallel. */ - public parallel?: (google.protobuf.IBoolValue|null); - - /** SqlImportOptions postgresImportOptions. */ - public postgresImportOptions?: (google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions|null); - - /** - * Creates a new SqlImportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlImportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions; - - /** - * Encodes the specified SqlImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.verify|verify} messages. - * @param message SqlImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.verify|verify} messages. - * @param message SqlImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlImportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions; - - /** - * Decodes a SqlImportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions; - - /** - * Verifies a SqlImportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlImportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlImportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions; - - /** - * Creates a plain object from a SqlImportOptions message. Also converts values to other types if specified. - * @param message SqlImportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlImportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlImportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlImportOptions { - - /** Properties of a PostgresImportOptions. */ - interface IPostgresImportOptions { - - /** PostgresImportOptions clean */ - clean?: (google.protobuf.IBoolValue|null); - - /** PostgresImportOptions ifExists */ - ifExists?: (google.protobuf.IBoolValue|null); - } - - /** Represents a PostgresImportOptions. */ - class PostgresImportOptions implements IPostgresImportOptions { - - /** - * Constructs a new PostgresImportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions); - - /** PostgresImportOptions clean. */ - public clean?: (google.protobuf.IBoolValue|null); - - /** PostgresImportOptions ifExists. */ - public ifExists?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new PostgresImportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns PostgresImportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions; - - /** - * Encodes the specified PostgresImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. - * @param message PostgresImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PostgresImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. - * @param message PostgresImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PostgresImportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PostgresImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions; - - /** - * Decodes a PostgresImportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PostgresImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions; - - /** - * Verifies a PostgresImportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PostgresImportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PostgresImportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions; - - /** - * Creates a plain object from a PostgresImportOptions message. Also converts values to other types if specified. - * @param message PostgresImportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PostgresImportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PostgresImportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a SqlCsvImportOptions. */ - interface ISqlCsvImportOptions { - - /** SqlCsvImportOptions table */ - table?: (string|null); - - /** SqlCsvImportOptions columns */ - columns?: (string[]|null); - - /** SqlCsvImportOptions escapeCharacter */ - escapeCharacter?: (string|null); - - /** SqlCsvImportOptions quoteCharacter */ - quoteCharacter?: (string|null); - - /** SqlCsvImportOptions fieldsTerminatedBy */ - fieldsTerminatedBy?: (string|null); - - /** SqlCsvImportOptions linesTerminatedBy */ - linesTerminatedBy?: (string|null); - } - - /** Represents a SqlCsvImportOptions. */ - class SqlCsvImportOptions implements ISqlCsvImportOptions { - - /** - * Constructs a new SqlCsvImportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions); - - /** SqlCsvImportOptions table. */ - public table: string; - - /** SqlCsvImportOptions columns. */ - public columns: string[]; - - /** SqlCsvImportOptions escapeCharacter. */ - public escapeCharacter: string; - - /** SqlCsvImportOptions quoteCharacter. */ - public quoteCharacter: string; - - /** SqlCsvImportOptions fieldsTerminatedBy. */ - public fieldsTerminatedBy: string; - - /** SqlCsvImportOptions linesTerminatedBy. */ - public linesTerminatedBy: string; - - /** - * Creates a new SqlCsvImportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlCsvImportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions): google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions; - - /** - * Encodes the specified SqlCsvImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.verify|verify} messages. - * @param message SqlCsvImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlCsvImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.verify|verify} messages. - * @param message SqlCsvImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlCsvImportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlCsvImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions; - - /** - * Decodes a SqlCsvImportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlCsvImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions; - - /** - * Verifies a SqlCsvImportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlCsvImportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlCsvImportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions; - - /** - * Creates a plain object from a SqlCsvImportOptions message. Also converts values to other types if specified. - * @param message SqlCsvImportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlCsvImportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlCsvImportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlBakImportOptions. */ - interface ISqlBakImportOptions { - - /** SqlBakImportOptions encryptionOptions */ - encryptionOptions?: (google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions|null); - - /** SqlBakImportOptions striped */ - striped?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions noRecovery */ - noRecovery?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions recoveryOnly */ - recoveryOnly?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions bakType */ - bakType?: (google.cloud.sql.v1beta4.BakType|keyof typeof google.cloud.sql.v1beta4.BakType|null); - - /** SqlBakImportOptions stopAt */ - stopAt?: (google.protobuf.ITimestamp|null); - - /** SqlBakImportOptions stopAtMark */ - stopAtMark?: (string|null); - } - - /** Represents a SqlBakImportOptions. */ - class SqlBakImportOptions implements ISqlBakImportOptions { - - /** - * Constructs a new SqlBakImportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions); - - /** SqlBakImportOptions encryptionOptions. */ - public encryptionOptions?: (google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions|null); - - /** SqlBakImportOptions striped. */ - public striped?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions noRecovery. */ - public noRecovery?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions recoveryOnly. */ - public recoveryOnly?: (google.protobuf.IBoolValue|null); - - /** SqlBakImportOptions bakType. */ - public bakType: (google.cloud.sql.v1beta4.BakType|keyof typeof google.cloud.sql.v1beta4.BakType); - - /** SqlBakImportOptions stopAt. */ - public stopAt?: (google.protobuf.ITimestamp|null); - - /** SqlBakImportOptions stopAtMark. */ - public stopAtMark: string; - - /** - * Creates a new SqlBakImportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlBakImportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions; - - /** - * Encodes the specified SqlBakImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.verify|verify} messages. - * @param message SqlBakImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlBakImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.verify|verify} messages. - * @param message SqlBakImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlBakImportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlBakImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions; - - /** - * Decodes a SqlBakImportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlBakImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions; - - /** - * Verifies a SqlBakImportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlBakImportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlBakImportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions; - - /** - * Creates a plain object from a SqlBakImportOptions message. Also converts values to other types if specified. - * @param message SqlBakImportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlBakImportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlBakImportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlBakImportOptions { - - /** Properties of an EncryptionOptions. */ - interface IEncryptionOptions { - - /** EncryptionOptions certPath */ - certPath?: (string|null); - - /** EncryptionOptions pvkPath */ - pvkPath?: (string|null); - - /** EncryptionOptions pvkPassword */ - pvkPassword?: (string|null); - - /** EncryptionOptions keepEncrypted */ - keepEncrypted?: (google.protobuf.IBoolValue|null); - } - - /** Represents an EncryptionOptions. */ - class EncryptionOptions implements IEncryptionOptions { - - /** - * Constructs a new EncryptionOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions); - - /** EncryptionOptions certPath. */ - public certPath: string; - - /** EncryptionOptions pvkPath. */ - public pvkPath: string; - - /** EncryptionOptions pvkPassword. */ - public pvkPassword: string; - - /** EncryptionOptions keepEncrypted. */ - public keepEncrypted?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new EncryptionOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns EncryptionOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions; - - /** - * Encodes the specified EncryptionOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. - * @param message EncryptionOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EncryptionOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. - * @param message EncryptionOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EncryptionOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EncryptionOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions; - - /** - * Decodes an EncryptionOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EncryptionOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions; - - /** - * Verifies an EncryptionOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an EncryptionOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EncryptionOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions; - - /** - * Creates a plain object from an EncryptionOptions message. Also converts values to other types if specified. - * @param message EncryptionOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EncryptionOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EncryptionOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a SqlTdeImportOptions. */ - interface ISqlTdeImportOptions { - - /** SqlTdeImportOptions certificatePath */ - certificatePath?: (string|null); - - /** SqlTdeImportOptions privateKeyPath */ - privateKeyPath?: (string|null); - - /** SqlTdeImportOptions privateKeyPassword */ - privateKeyPassword?: (string|null); - - /** SqlTdeImportOptions name */ - name?: (string|null); - } - - /** Represents a SqlTdeImportOptions. */ - class SqlTdeImportOptions implements ISqlTdeImportOptions { - - /** - * Constructs a new SqlTdeImportOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions); - - /** SqlTdeImportOptions certificatePath. */ - public certificatePath: string; - - /** SqlTdeImportOptions privateKeyPath. */ - public privateKeyPath: string; - - /** SqlTdeImportOptions privateKeyPassword. */ - public privateKeyPassword: string; - - /** SqlTdeImportOptions name. */ - public name: string; - - /** - * Creates a new SqlTdeImportOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlTdeImportOptions instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions): google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions; - - /** - * Encodes the specified SqlTdeImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.verify|verify} messages. - * @param message SqlTdeImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlTdeImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.verify|verify} messages. - * @param message SqlTdeImportOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlTdeImportOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlTdeImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions; - - /** - * Decodes a SqlTdeImportOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlTdeImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions; - - /** - * Verifies a SqlTdeImportOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlTdeImportOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlTdeImportOptions - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions; - - /** - * Creates a plain object from a SqlTdeImportOptions message. Also converts values to other types if specified. - * @param message SqlTdeImportOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlTdeImportOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlTdeImportOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** BakType enum. */ - enum BakType { - BAK_TYPE_UNSPECIFIED = 0, - FULL = 1, - DIFF = 2, - TLOG = 3 - } - - /** Properties of an InstancesCloneRequest. */ - interface IInstancesCloneRequest { - - /** InstancesCloneRequest cloneContext */ - cloneContext?: (google.cloud.sql.v1beta4.ICloneContext|null); - } - - /** Represents an InstancesCloneRequest. */ - class InstancesCloneRequest implements IInstancesCloneRequest { - - /** - * Constructs a new InstancesCloneRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesCloneRequest); - - /** InstancesCloneRequest cloneContext. */ - public cloneContext?: (google.cloud.sql.v1beta4.ICloneContext|null); - - /** - * Creates a new InstancesCloneRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesCloneRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesCloneRequest): google.cloud.sql.v1beta4.InstancesCloneRequest; - - /** - * Encodes the specified InstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesCloneRequest.verify|verify} messages. - * @param message InstancesCloneRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesCloneRequest.verify|verify} messages. - * @param message InstancesCloneRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesCloneRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesCloneRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesCloneRequest; - - /** - * Decodes an InstancesCloneRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesCloneRequest; - - /** - * Verifies an InstancesCloneRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesCloneRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesCloneRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesCloneRequest; - - /** - * Creates a plain object from an InstancesCloneRequest message. Also converts values to other types if specified. - * @param message InstancesCloneRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesCloneRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesCloneRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesCloneRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesDemoteMasterRequest. */ - interface IInstancesDemoteMasterRequest { - - /** InstancesDemoteMasterRequest demoteMasterContext */ - demoteMasterContext?: (google.cloud.sql.v1beta4.IDemoteMasterContext|null); - } - - /** Represents an InstancesDemoteMasterRequest. */ - class InstancesDemoteMasterRequest implements IInstancesDemoteMasterRequest { - - /** - * Constructs a new InstancesDemoteMasterRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest); - - /** InstancesDemoteMasterRequest demoteMasterContext. */ - public demoteMasterContext?: (google.cloud.sql.v1beta4.IDemoteMasterContext|null); - - /** - * Creates a new InstancesDemoteMasterRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesDemoteMasterRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest): google.cloud.sql.v1beta4.InstancesDemoteMasterRequest; - - /** - * Encodes the specified InstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.verify|verify} messages. - * @param message InstancesDemoteMasterRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.verify|verify} messages. - * @param message InstancesDemoteMasterRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesDemoteMasterRequest; - - /** - * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesDemoteMasterRequest; - - /** - * Verifies an InstancesDemoteMasterRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesDemoteMasterRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesDemoteMasterRequest; - - /** - * Creates a plain object from an InstancesDemoteMasterRequest message. Also converts values to other types if specified. - * @param message InstancesDemoteMasterRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesDemoteMasterRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesDemoteMasterRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesDemoteMasterRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesDemoteRequest. */ - interface IInstancesDemoteRequest { - - /** InstancesDemoteRequest demoteContext */ - demoteContext?: (google.cloud.sql.v1beta4.IDemoteContext|null); - } - - /** Represents an InstancesDemoteRequest. */ - class InstancesDemoteRequest implements IInstancesDemoteRequest { - - /** - * Constructs a new InstancesDemoteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesDemoteRequest); - - /** InstancesDemoteRequest demoteContext. */ - public demoteContext?: (google.cloud.sql.v1beta4.IDemoteContext|null); - - /** - * Creates a new InstancesDemoteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesDemoteRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesDemoteRequest): google.cloud.sql.v1beta4.InstancesDemoteRequest; - - /** - * Encodes the specified InstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteRequest.verify|verify} messages. - * @param message InstancesDemoteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteRequest.verify|verify} messages. - * @param message InstancesDemoteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesDemoteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesDemoteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesDemoteRequest; - - /** - * Decodes an InstancesDemoteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesDemoteRequest; - - /** - * Verifies an InstancesDemoteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesDemoteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesDemoteRequest; - - /** - * Creates a plain object from an InstancesDemoteRequest message. Also converts values to other types if specified. - * @param message InstancesDemoteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesDemoteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesDemoteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesDemoteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesExportRequest. */ - interface IInstancesExportRequest { - - /** InstancesExportRequest exportContext */ - exportContext?: (google.cloud.sql.v1beta4.IExportContext|null); - } - - /** Represents an InstancesExportRequest. */ - class InstancesExportRequest implements IInstancesExportRequest { - - /** - * Constructs a new InstancesExportRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesExportRequest); - - /** InstancesExportRequest exportContext. */ - public exportContext?: (google.cloud.sql.v1beta4.IExportContext|null); - - /** - * Creates a new InstancesExportRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesExportRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesExportRequest): google.cloud.sql.v1beta4.InstancesExportRequest; - - /** - * Encodes the specified InstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesExportRequest.verify|verify} messages. - * @param message InstancesExportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesExportRequest.verify|verify} messages. - * @param message InstancesExportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesExportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesExportRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesExportRequest; - - /** - * Decodes an InstancesExportRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesExportRequest; - - /** - * Verifies an InstancesExportRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesExportRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesExportRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesExportRequest; - - /** - * Creates a plain object from an InstancesExportRequest message. Also converts values to other types if specified. - * @param message InstancesExportRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesExportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesExportRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesExportRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesFailoverRequest. */ - interface IInstancesFailoverRequest { - - /** InstancesFailoverRequest failoverContext */ - failoverContext?: (google.cloud.sql.v1beta4.IFailoverContext|null); - } - - /** Represents an InstancesFailoverRequest. */ - class InstancesFailoverRequest implements IInstancesFailoverRequest { - - /** - * Constructs a new InstancesFailoverRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesFailoverRequest); - - /** InstancesFailoverRequest failoverContext. */ - public failoverContext?: (google.cloud.sql.v1beta4.IFailoverContext|null); - - /** - * Creates a new InstancesFailoverRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesFailoverRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesFailoverRequest): google.cloud.sql.v1beta4.InstancesFailoverRequest; - - /** - * Encodes the specified InstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesFailoverRequest.verify|verify} messages. - * @param message InstancesFailoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesFailoverRequest.verify|verify} messages. - * @param message InstancesFailoverRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesFailoverRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesFailoverRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesFailoverRequest; - - /** - * Decodes an InstancesFailoverRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesFailoverRequest; - - /** - * Verifies an InstancesFailoverRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesFailoverRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesFailoverRequest; - - /** - * Creates a plain object from an InstancesFailoverRequest message. Also converts values to other types if specified. - * @param message InstancesFailoverRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesFailoverRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesFailoverRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesFailoverRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesImportRequest. */ - interface IInstancesImportRequest { - - /** InstancesImportRequest importContext */ - importContext?: (google.cloud.sql.v1beta4.IImportContext|null); - } - - /** Represents an InstancesImportRequest. */ - class InstancesImportRequest implements IInstancesImportRequest { - - /** - * Constructs a new InstancesImportRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesImportRequest); - - /** InstancesImportRequest importContext. */ - public importContext?: (google.cloud.sql.v1beta4.IImportContext|null); - - /** - * Creates a new InstancesImportRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesImportRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesImportRequest): google.cloud.sql.v1beta4.InstancesImportRequest; - - /** - * Encodes the specified InstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesImportRequest.verify|verify} messages. - * @param message InstancesImportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesImportRequest.verify|verify} messages. - * @param message InstancesImportRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesImportRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesImportRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesImportRequest; - - /** - * Decodes an InstancesImportRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesImportRequest; - - /** - * Verifies an InstancesImportRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesImportRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesImportRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesImportRequest; - - /** - * Creates a plain object from an InstancesImportRequest message. Also converts values to other types if specified. - * @param message InstancesImportRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesImportRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesImportRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesImportRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesPreCheckMajorVersionUpgradeRequest. */ - interface IInstancesPreCheckMajorVersionUpgradeRequest { - - /** InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext */ - preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null); - } - - /** Represents an InstancesPreCheckMajorVersionUpgradeRequest. */ - class InstancesPreCheckMajorVersionUpgradeRequest implements IInstancesPreCheckMajorVersionUpgradeRequest { - - /** - * Constructs a new InstancesPreCheckMajorVersionUpgradeRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest); - - /** InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext. */ - public preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null); - - /** - * Creates a new InstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesPreCheckMajorVersionUpgradeRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest): google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @param message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @param message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Verifies an InstancesPreCheckMajorVersionUpgradeRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesPreCheckMajorVersionUpgradeRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest; - - /** - * Creates a plain object from an InstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. - * @param message InstancesPreCheckMajorVersionUpgradeRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesPreCheckMajorVersionUpgradeRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesPreCheckMajorVersionUpgradeRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MySqlSyncConfig. */ - interface IMySqlSyncConfig { - - /** MySqlSyncConfig initialSyncFlags */ - initialSyncFlags?: (google.cloud.sql.v1beta4.ISyncFlags[]|null); - } - - /** Represents a MySqlSyncConfig. */ - class MySqlSyncConfig implements IMySqlSyncConfig { - - /** - * Constructs a new MySqlSyncConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IMySqlSyncConfig); - - /** MySqlSyncConfig initialSyncFlags. */ - public initialSyncFlags: google.cloud.sql.v1beta4.ISyncFlags[]; - - /** - * Creates a new MySqlSyncConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns MySqlSyncConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IMySqlSyncConfig): google.cloud.sql.v1beta4.MySqlSyncConfig; - - /** - * Encodes the specified MySqlSyncConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlSyncConfig.verify|verify} messages. - * @param message MySqlSyncConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IMySqlSyncConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MySqlSyncConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlSyncConfig.verify|verify} messages. - * @param message MySqlSyncConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IMySqlSyncConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MySqlSyncConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MySqlSyncConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.MySqlSyncConfig; - - /** - * Decodes a MySqlSyncConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MySqlSyncConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.MySqlSyncConfig; - - /** - * Verifies a MySqlSyncConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MySqlSyncConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MySqlSyncConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.MySqlSyncConfig; - - /** - * Creates a plain object from a MySqlSyncConfig message. Also converts values to other types if specified. - * @param message MySqlSyncConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.MySqlSyncConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MySqlSyncConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MySqlSyncConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesListResponse. */ - interface IInstancesListResponse { - - /** InstancesListResponse kind */ - kind?: (string|null); - - /** InstancesListResponse warnings */ - warnings?: (google.cloud.sql.v1beta4.IApiWarning[]|null); - - /** InstancesListResponse items */ - items?: (google.cloud.sql.v1beta4.IDatabaseInstance[]|null); - - /** InstancesListResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents an InstancesListResponse. */ - class InstancesListResponse implements IInstancesListResponse { - - /** - * Constructs a new InstancesListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesListResponse); - - /** InstancesListResponse kind. */ - public kind: string; - - /** InstancesListResponse warnings. */ - public warnings: google.cloud.sql.v1beta4.IApiWarning[]; - - /** InstancesListResponse items. */ - public items: google.cloud.sql.v1beta4.IDatabaseInstance[]; - - /** InstancesListResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new InstancesListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesListResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesListResponse): google.cloud.sql.v1beta4.InstancesListResponse; - - /** - * Encodes the specified InstancesListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListResponse.verify|verify} messages. - * @param message InstancesListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListResponse.verify|verify} messages. - * @param message InstancesListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesListResponse; - - /** - * Decodes an InstancesListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesListResponse; - - /** - * Verifies an InstancesListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesListResponse; - - /** - * Creates a plain object from an InstancesListResponse message. Also converts values to other types if specified. - * @param message InstancesListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesListServerCasResponse. */ - interface IInstancesListServerCasResponse { - - /** InstancesListServerCasResponse certs */ - certs?: (google.cloud.sql.v1beta4.ISslCert[]|null); - - /** InstancesListServerCasResponse activeVersion */ - activeVersion?: (string|null); - - /** InstancesListServerCasResponse kind */ - kind?: (string|null); - } - - /** Represents an InstancesListServerCasResponse. */ - class InstancesListServerCasResponse implements IInstancesListServerCasResponse { - - /** - * Constructs a new InstancesListServerCasResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesListServerCasResponse); - - /** InstancesListServerCasResponse certs. */ - public certs: google.cloud.sql.v1beta4.ISslCert[]; - - /** InstancesListServerCasResponse activeVersion. */ - public activeVersion: string; - - /** InstancesListServerCasResponse kind. */ - public kind: string; - - /** - * Creates a new InstancesListServerCasResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesListServerCasResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesListServerCasResponse): google.cloud.sql.v1beta4.InstancesListServerCasResponse; - - /** - * Encodes the specified InstancesListServerCasResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCasResponse.verify|verify} messages. - * @param message InstancesListServerCasResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesListServerCasResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesListServerCasResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCasResponse.verify|verify} messages. - * @param message InstancesListServerCasResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesListServerCasResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesListServerCasResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesListServerCasResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesListServerCasResponse; - - /** - * Decodes an InstancesListServerCasResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesListServerCasResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesListServerCasResponse; - - /** - * Verifies an InstancesListServerCasResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesListServerCasResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesListServerCasResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesListServerCasResponse; - - /** - * Creates a plain object from an InstancesListServerCasResponse message. Also converts values to other types if specified. - * @param message InstancesListServerCasResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesListServerCasResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesListServerCasResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesListServerCasResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesListServerCertificatesResponse. */ - interface IInstancesListServerCertificatesResponse { - - /** InstancesListServerCertificatesResponse caCerts */ - caCerts?: (google.cloud.sql.v1beta4.ISslCert[]|null); - - /** InstancesListServerCertificatesResponse serverCerts */ - serverCerts?: (google.cloud.sql.v1beta4.ISslCert[]|null); - - /** InstancesListServerCertificatesResponse activeVersion */ - activeVersion?: (string|null); - - /** InstancesListServerCertificatesResponse kind */ - kind?: (string|null); - } - - /** Represents an InstancesListServerCertificatesResponse. */ - class InstancesListServerCertificatesResponse implements IInstancesListServerCertificatesResponse { - - /** - * Constructs a new InstancesListServerCertificatesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse); - - /** InstancesListServerCertificatesResponse caCerts. */ - public caCerts: google.cloud.sql.v1beta4.ISslCert[]; - - /** InstancesListServerCertificatesResponse serverCerts. */ - public serverCerts: google.cloud.sql.v1beta4.ISslCert[]; - - /** InstancesListServerCertificatesResponse activeVersion. */ - public activeVersion: string; - - /** InstancesListServerCertificatesResponse kind. */ - public kind: string; - - /** - * Creates a new InstancesListServerCertificatesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesListServerCertificatesResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse): google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse; - - /** - * Encodes the specified InstancesListServerCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.verify|verify} messages. - * @param message InstancesListServerCertificatesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesListServerCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.verify|verify} messages. - * @param message InstancesListServerCertificatesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesListServerCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse; - - /** - * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesListServerCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse; - - /** - * Verifies an InstancesListServerCertificatesResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesListServerCertificatesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesListServerCertificatesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse; - - /** - * Creates a plain object from an InstancesListServerCertificatesResponse message. Also converts values to other types if specified. - * @param message InstancesListServerCertificatesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesListServerCertificatesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesListServerCertificatesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesListEntraIdCertificatesResponse. */ - interface IInstancesListEntraIdCertificatesResponse { - - /** InstancesListEntraIdCertificatesResponse certs */ - certs?: (google.cloud.sql.v1beta4.ISslCert[]|null); - - /** InstancesListEntraIdCertificatesResponse activeVersion */ - activeVersion?: (string|null); - - /** InstancesListEntraIdCertificatesResponse kind */ - kind?: (string|null); - } - - /** Represents an InstancesListEntraIdCertificatesResponse. */ - class InstancesListEntraIdCertificatesResponse implements IInstancesListEntraIdCertificatesResponse { - - /** - * Constructs a new InstancesListEntraIdCertificatesResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse); - - /** InstancesListEntraIdCertificatesResponse certs. */ - public certs: google.cloud.sql.v1beta4.ISslCert[]; - - /** InstancesListEntraIdCertificatesResponse activeVersion. */ - public activeVersion: string; - - /** InstancesListEntraIdCertificatesResponse kind. */ - public kind: string; - - /** - * Creates a new InstancesListEntraIdCertificatesResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesListEntraIdCertificatesResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse): google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse; - - /** - * Encodes the specified InstancesListEntraIdCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.verify|verify} messages. - * @param message InstancesListEntraIdCertificatesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesListEntraIdCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.verify|verify} messages. - * @param message InstancesListEntraIdCertificatesResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesListEntraIdCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse; - - /** - * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesListEntraIdCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse; - - /** - * Verifies an InstancesListEntraIdCertificatesResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesListEntraIdCertificatesResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesListEntraIdCertificatesResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse; - - /** - * Creates a plain object from an InstancesListEntraIdCertificatesResponse message. Also converts values to other types if specified. - * @param message InstancesListEntraIdCertificatesResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesListEntraIdCertificatesResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesListEntraIdCertificatesResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesRestoreBackupRequest. */ - interface IInstancesRestoreBackupRequest { - - /** InstancesRestoreBackupRequest restoreBackupContext */ - restoreBackupContext?: (google.cloud.sql.v1beta4.IRestoreBackupContext|null); - - /** InstancesRestoreBackupRequest backup */ - backup?: (string|null); - - /** InstancesRestoreBackupRequest backupdrBackup */ - backupdrBackup?: (string|null); - - /** InstancesRestoreBackupRequest restoreInstanceSettings */ - restoreInstanceSettings?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); - - /** InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames */ - restoreInstanceClearOverridesFieldNames?: (string[]|null); - } - - /** Represents an InstancesRestoreBackupRequest. */ - class InstancesRestoreBackupRequest implements IInstancesRestoreBackupRequest { - - /** - * Constructs a new InstancesRestoreBackupRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest); - - /** InstancesRestoreBackupRequest restoreBackupContext. */ - public restoreBackupContext?: (google.cloud.sql.v1beta4.IRestoreBackupContext|null); - - /** InstancesRestoreBackupRequest backup. */ - public backup: string; - - /** InstancesRestoreBackupRequest backupdrBackup. */ - public backupdrBackup: string; - - /** InstancesRestoreBackupRequest restoreInstanceSettings. */ - public restoreInstanceSettings?: (google.cloud.sql.v1beta4.IDatabaseInstance|null); - - /** InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames. */ - public restoreInstanceClearOverridesFieldNames: string[]; - - /** - * Creates a new InstancesRestoreBackupRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesRestoreBackupRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest): google.cloud.sql.v1beta4.InstancesRestoreBackupRequest; - - /** - * Encodes the specified InstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.verify|verify} messages. - * @param message InstancesRestoreBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.verify|verify} messages. - * @param message InstancesRestoreBackupRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesRestoreBackupRequest; - - /** - * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesRestoreBackupRequest; - - /** - * Verifies an InstancesRestoreBackupRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesRestoreBackupRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesRestoreBackupRequest; - - /** - * Creates a plain object from an InstancesRestoreBackupRequest message. Also converts values to other types if specified. - * @param message InstancesRestoreBackupRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesRestoreBackupRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesRestoreBackupRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesRestoreBackupRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesRotateServerCaRequest. */ - interface IInstancesRotateServerCaRequest { - - /** InstancesRotateServerCaRequest rotateServerCaContext */ - rotateServerCaContext?: (google.cloud.sql.v1beta4.IRotateServerCaContext|null); - } - - /** Represents an InstancesRotateServerCaRequest. */ - class InstancesRotateServerCaRequest implements IInstancesRotateServerCaRequest { - - /** - * Constructs a new InstancesRotateServerCaRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest); - - /** InstancesRotateServerCaRequest rotateServerCaContext. */ - public rotateServerCaContext?: (google.cloud.sql.v1beta4.IRotateServerCaContext|null); - - /** - * Creates a new InstancesRotateServerCaRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesRotateServerCaRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest): google.cloud.sql.v1beta4.InstancesRotateServerCaRequest; - - /** - * Encodes the specified InstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.verify|verify} messages. - * @param message InstancesRotateServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.verify|verify} messages. - * @param message InstancesRotateServerCaRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesRotateServerCaRequest; - - /** - * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesRotateServerCaRequest; - - /** - * Verifies an InstancesRotateServerCaRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesRotateServerCaRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesRotateServerCaRequest; - - /** - * Creates a plain object from an InstancesRotateServerCaRequest message. Also converts values to other types if specified. - * @param message InstancesRotateServerCaRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesRotateServerCaRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesRotateServerCaRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesRotateServerCaRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesRotateServerCertificateRequest. */ - interface IInstancesRotateServerCertificateRequest { - - /** InstancesRotateServerCertificateRequest rotateServerCertificateContext */ - rotateServerCertificateContext?: (google.cloud.sql.v1beta4.IRotateServerCertificateContext|null); - } - - /** Represents an InstancesRotateServerCertificateRequest. */ - class InstancesRotateServerCertificateRequest implements IInstancesRotateServerCertificateRequest { - - /** - * Constructs a new InstancesRotateServerCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest); - - /** InstancesRotateServerCertificateRequest rotateServerCertificateContext. */ - public rotateServerCertificateContext?: (google.cloud.sql.v1beta4.IRotateServerCertificateContext|null); - - /** - * Creates a new InstancesRotateServerCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesRotateServerCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest): google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest; - - /** - * Encodes the specified InstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.verify|verify} messages. - * @param message InstancesRotateServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.verify|verify} messages. - * @param message InstancesRotateServerCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest; - - /** - * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest; - - /** - * Verifies an InstancesRotateServerCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesRotateServerCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest; - - /** - * Creates a plain object from an InstancesRotateServerCertificateRequest message. Also converts values to other types if specified. - * @param message InstancesRotateServerCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesRotateServerCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesRotateServerCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesRotateEntraIdCertificateRequest. */ - interface IInstancesRotateEntraIdCertificateRequest { - - /** InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext */ - rotateEntraIdCertificateContext?: (google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext|null); - } - - /** Represents an InstancesRotateEntraIdCertificateRequest. */ - class InstancesRotateEntraIdCertificateRequest implements IInstancesRotateEntraIdCertificateRequest { - - /** - * Constructs a new InstancesRotateEntraIdCertificateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest); - - /** InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext. */ - public rotateEntraIdCertificateContext?: (google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext|null); - - /** - * Creates a new InstancesRotateEntraIdCertificateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesRotateEntraIdCertificateRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest): google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest; - - /** - * Encodes the specified InstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @param message InstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @param message InstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest; - - /** - * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest; - - /** - * Verifies an InstancesRotateEntraIdCertificateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesRotateEntraIdCertificateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest; - - /** - * Creates a plain object from an InstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. - * @param message InstancesRotateEntraIdCertificateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesRotateEntraIdCertificateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesRotateEntraIdCertificateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesTruncateLogRequest. */ - interface IInstancesTruncateLogRequest { - - /** InstancesTruncateLogRequest truncateLogContext */ - truncateLogContext?: (google.cloud.sql.v1beta4.ITruncateLogContext|null); - } - - /** Represents an InstancesTruncateLogRequest. */ - class InstancesTruncateLogRequest implements IInstancesTruncateLogRequest { - - /** - * Constructs a new InstancesTruncateLogRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesTruncateLogRequest); - - /** InstancesTruncateLogRequest truncateLogContext. */ - public truncateLogContext?: (google.cloud.sql.v1beta4.ITruncateLogContext|null); - - /** - * Creates a new InstancesTruncateLogRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesTruncateLogRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesTruncateLogRequest): google.cloud.sql.v1beta4.InstancesTruncateLogRequest; - - /** - * Encodes the specified InstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesTruncateLogRequest.verify|verify} messages. - * @param message InstancesTruncateLogRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesTruncateLogRequest.verify|verify} messages. - * @param message InstancesTruncateLogRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesTruncateLogRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesTruncateLogRequest; - - /** - * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesTruncateLogRequest; - - /** - * Verifies an InstancesTruncateLogRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesTruncateLogRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesTruncateLogRequest; - - /** - * Creates a plain object from an InstancesTruncateLogRequest message. Also converts values to other types if specified. - * @param message InstancesTruncateLogRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesTruncateLogRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesTruncateLogRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesTruncateLogRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InstancesAcquireSsrsLeaseRequest. */ - interface IInstancesAcquireSsrsLeaseRequest { - - /** InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext */ - acquireSsrsLeaseContext?: (google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null); - } - - /** Represents an InstancesAcquireSsrsLeaseRequest. */ - class InstancesAcquireSsrsLeaseRequest implements IInstancesAcquireSsrsLeaseRequest { - - /** - * Constructs a new InstancesAcquireSsrsLeaseRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest); - - /** InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext. */ - public acquireSsrsLeaseContext?: (google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null); - - /** - * Creates a new InstancesAcquireSsrsLeaseRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns InstancesAcquireSsrsLeaseRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest): google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest; - - /** - * Encodes the specified InstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @param message InstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @param message InstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest; - - /** - * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest; - - /** - * Verifies an InstancesAcquireSsrsLeaseRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InstancesAcquireSsrsLeaseRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest; - - /** - * Creates a plain object from an InstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. - * @param message InstancesAcquireSsrsLeaseRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InstancesAcquireSsrsLeaseRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InstancesAcquireSsrsLeaseRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PointInTimeRestoreContext. */ - interface IPointInTimeRestoreContext { - - /** PointInTimeRestoreContext datasource */ - datasource?: (string|null); - - /** PointInTimeRestoreContext pointInTime */ - pointInTime?: (google.protobuf.ITimestamp|null); - - /** PointInTimeRestoreContext targetInstance */ - targetInstance?: (string|null); - - /** PointInTimeRestoreContext privateNetwork */ - privateNetwork?: (string|null); - - /** PointInTimeRestoreContext allocatedIpRange */ - allocatedIpRange?: (string|null); - - /** PointInTimeRestoreContext preferredZone */ - preferredZone?: (string|null); - - /** PointInTimeRestoreContext preferredSecondaryZone */ - preferredSecondaryZone?: (string|null); - } - - /** Represents a PointInTimeRestoreContext. */ - class PointInTimeRestoreContext implements IPointInTimeRestoreContext { - - /** - * Constructs a new PointInTimeRestoreContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IPointInTimeRestoreContext); - - /** PointInTimeRestoreContext datasource. */ - public datasource?: (string|null); - - /** PointInTimeRestoreContext pointInTime. */ - public pointInTime?: (google.protobuf.ITimestamp|null); - - /** PointInTimeRestoreContext targetInstance. */ - public targetInstance?: (string|null); - - /** PointInTimeRestoreContext privateNetwork. */ - public privateNetwork?: (string|null); - - /** PointInTimeRestoreContext allocatedIpRange. */ - public allocatedIpRange?: (string|null); - - /** PointInTimeRestoreContext preferredZone. */ - public preferredZone?: (string|null); - - /** PointInTimeRestoreContext preferredSecondaryZone. */ - public preferredSecondaryZone?: (string|null); - - /** - * Creates a new PointInTimeRestoreContext instance using the specified properties. - * @param [properties] Properties to set - * @returns PointInTimeRestoreContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IPointInTimeRestoreContext): google.cloud.sql.v1beta4.PointInTimeRestoreContext; - - /** - * Encodes the specified PointInTimeRestoreContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PointInTimeRestoreContext.verify|verify} messages. - * @param message PointInTimeRestoreContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IPointInTimeRestoreContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PointInTimeRestoreContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PointInTimeRestoreContext.verify|verify} messages. - * @param message PointInTimeRestoreContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IPointInTimeRestoreContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PointInTimeRestoreContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PointInTimeRestoreContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PointInTimeRestoreContext; - - /** - * Decodes a PointInTimeRestoreContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PointInTimeRestoreContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PointInTimeRestoreContext; - - /** - * Verifies a PointInTimeRestoreContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PointInTimeRestoreContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PointInTimeRestoreContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PointInTimeRestoreContext; - - /** - * Creates a plain object from a PointInTimeRestoreContext message. Also converts values to other types if specified. - * @param message PointInTimeRestoreContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.PointInTimeRestoreContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PointInTimeRestoreContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PointInTimeRestoreContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PerformDiskShrinkContext. */ - interface IPerformDiskShrinkContext { - - /** PerformDiskShrinkContext targetSizeGb */ - targetSizeGb?: (number|Long|string|null); - } - - /** Represents a PerformDiskShrinkContext. */ - class PerformDiskShrinkContext implements IPerformDiskShrinkContext { - - /** - * Constructs a new PerformDiskShrinkContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IPerformDiskShrinkContext); - - /** PerformDiskShrinkContext targetSizeGb. */ - public targetSizeGb: (number|Long|string); - - /** - * Creates a new PerformDiskShrinkContext instance using the specified properties. - * @param [properties] Properties to set - * @returns PerformDiskShrinkContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IPerformDiskShrinkContext): google.cloud.sql.v1beta4.PerformDiskShrinkContext; - - /** - * Encodes the specified PerformDiskShrinkContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PerformDiskShrinkContext.verify|verify} messages. - * @param message PerformDiskShrinkContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IPerformDiskShrinkContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PerformDiskShrinkContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PerformDiskShrinkContext.verify|verify} messages. - * @param message PerformDiskShrinkContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IPerformDiskShrinkContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PerformDiskShrinkContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PerformDiskShrinkContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PerformDiskShrinkContext; - - /** - * Decodes a PerformDiskShrinkContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PerformDiskShrinkContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PerformDiskShrinkContext; - - /** - * Verifies a PerformDiskShrinkContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PerformDiskShrinkContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PerformDiskShrinkContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PerformDiskShrinkContext; - - /** - * Creates a plain object from a PerformDiskShrinkContext message. Also converts values to other types if specified. - * @param message PerformDiskShrinkContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.PerformDiskShrinkContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PerformDiskShrinkContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PerformDiskShrinkContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PreCheckResponse. */ - interface IPreCheckResponse { - - /** PreCheckResponse message */ - message?: (string|null); - - /** PreCheckResponse messageType */ - messageType?: (google.cloud.sql.v1beta4.PreCheckResponse.MessageType|keyof typeof google.cloud.sql.v1beta4.PreCheckResponse.MessageType|null); - - /** PreCheckResponse actionsRequired */ - actionsRequired?: (string[]|null); - } - - /** Represents a PreCheckResponse. */ - class PreCheckResponse implements IPreCheckResponse { - - /** - * Constructs a new PreCheckResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IPreCheckResponse); - - /** PreCheckResponse message. */ - public message?: (string|null); - - /** PreCheckResponse messageType. */ - public messageType?: (google.cloud.sql.v1beta4.PreCheckResponse.MessageType|keyof typeof google.cloud.sql.v1beta4.PreCheckResponse.MessageType|null); - - /** PreCheckResponse actionsRequired. */ - public actionsRequired: string[]; - - /** - * Creates a new PreCheckResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns PreCheckResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IPreCheckResponse): google.cloud.sql.v1beta4.PreCheckResponse; - - /** - * Encodes the specified PreCheckResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckResponse.verify|verify} messages. - * @param message PreCheckResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IPreCheckResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PreCheckResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckResponse.verify|verify} messages. - * @param message PreCheckResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IPreCheckResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PreCheckResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PreCheckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PreCheckResponse; - - /** - * Decodes a PreCheckResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PreCheckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PreCheckResponse; - - /** - * Verifies a PreCheckResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PreCheckResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PreCheckResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PreCheckResponse; - - /** - * Creates a plain object from a PreCheckResponse message. Also converts values to other types if specified. - * @param message PreCheckResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.PreCheckResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PreCheckResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PreCheckResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace PreCheckResponse { - - /** MessageType enum. */ - enum MessageType { - MESSAGE_TYPE_UNSPECIFIED = 0, - INFO = 1, - WARNING = 2, - ERROR = 3 - } - } - - /** Properties of a PreCheckMajorVersionUpgradeContext. */ - interface IPreCheckMajorVersionUpgradeContext { - - /** PreCheckMajorVersionUpgradeContext targetDatabaseVersion */ - targetDatabaseVersion?: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion|null); - - /** PreCheckMajorVersionUpgradeContext preCheckResponse */ - preCheckResponse?: (google.cloud.sql.v1beta4.IPreCheckResponse[]|null); - - /** PreCheckMajorVersionUpgradeContext kind */ - kind?: (string|null); - } - - /** Represents a PreCheckMajorVersionUpgradeContext. */ - class PreCheckMajorVersionUpgradeContext implements IPreCheckMajorVersionUpgradeContext { - - /** - * Constructs a new PreCheckMajorVersionUpgradeContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext); - - /** PreCheckMajorVersionUpgradeContext targetDatabaseVersion. */ - public targetDatabaseVersion: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion); - - /** PreCheckMajorVersionUpgradeContext preCheckResponse. */ - public preCheckResponse: google.cloud.sql.v1beta4.IPreCheckResponse[]; - - /** PreCheckMajorVersionUpgradeContext kind. */ - public kind: string; - - /** - * Creates a new PreCheckMajorVersionUpgradeContext instance using the specified properties. - * @param [properties] Properties to set - * @returns PreCheckMajorVersionUpgradeContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext): google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext; - - /** - * Encodes the specified PreCheckMajorVersionUpgradeContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify|verify} messages. - * @param message PreCheckMajorVersionUpgradeContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PreCheckMajorVersionUpgradeContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify|verify} messages. - * @param message PreCheckMajorVersionUpgradeContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PreCheckMajorVersionUpgradeContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext; - - /** - * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PreCheckMajorVersionUpgradeContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext; - - /** - * Verifies a PreCheckMajorVersionUpgradeContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PreCheckMajorVersionUpgradeContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PreCheckMajorVersionUpgradeContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext; - - /** - * Creates a plain object from a PreCheckMajorVersionUpgradeContext message. Also converts values to other types if specified. - * @param message PreCheckMajorVersionUpgradeContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PreCheckMajorVersionUpgradeContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PreCheckMajorVersionUpgradeContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesGetDiskShrinkConfigResponse. */ - interface ISqlInstancesGetDiskShrinkConfigResponse { - - /** SqlInstancesGetDiskShrinkConfigResponse kind */ - kind?: (string|null); - - /** SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb */ - minimalTargetSizeGb?: (number|Long|string|null); - - /** SqlInstancesGetDiskShrinkConfigResponse message */ - message?: (string|null); - } - - /** Represents a SqlInstancesGetDiskShrinkConfigResponse. */ - class SqlInstancesGetDiskShrinkConfigResponse implements ISqlInstancesGetDiskShrinkConfigResponse { - - /** - * Constructs a new SqlInstancesGetDiskShrinkConfigResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse); - - /** SqlInstancesGetDiskShrinkConfigResponse kind. */ - public kind: string; - - /** SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb. */ - public minimalTargetSizeGb: (number|Long|string); - - /** SqlInstancesGetDiskShrinkConfigResponse message. */ - public message: string; - - /** - * Creates a new SqlInstancesGetDiskShrinkConfigResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesGetDiskShrinkConfigResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. - * @param message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. - * @param message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesGetDiskShrinkConfigResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesGetDiskShrinkConfigResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse; - - /** - * Verifies a SqlInstancesGetDiskShrinkConfigResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesGetDiskShrinkConfigResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesGetDiskShrinkConfigResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse; - - /** - * Creates a plain object from a SqlInstancesGetDiskShrinkConfigResponse message. Also converts values to other types if specified. - * @param message SqlInstancesGetDiskShrinkConfigResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesGetDiskShrinkConfigResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesGetDiskShrinkConfigResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesVerifyExternalSyncSettingsResponse. */ - interface ISqlInstancesVerifyExternalSyncSettingsResponse { - - /** SqlInstancesVerifyExternalSyncSettingsResponse kind */ - kind?: (string|null); - - /** SqlInstancesVerifyExternalSyncSettingsResponse errors */ - errors?: (google.cloud.sql.v1beta4.ISqlExternalSyncSettingError[]|null); - - /** SqlInstancesVerifyExternalSyncSettingsResponse warnings */ - warnings?: (google.cloud.sql.v1beta4.ISqlExternalSyncSettingError[]|null); - } - - /** Represents a SqlInstancesVerifyExternalSyncSettingsResponse. */ - class SqlInstancesVerifyExternalSyncSettingsResponse implements ISqlInstancesVerifyExternalSyncSettingsResponse { - - /** - * Constructs a new SqlInstancesVerifyExternalSyncSettingsResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse); - - /** SqlInstancesVerifyExternalSyncSettingsResponse kind. */ - public kind: string; - - /** SqlInstancesVerifyExternalSyncSettingsResponse errors. */ - public errors: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError[]; - - /** SqlInstancesVerifyExternalSyncSettingsResponse warnings. */ - public warnings: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError[]; - - /** - * Creates a new SqlInstancesVerifyExternalSyncSettingsResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesVerifyExternalSyncSettingsResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. - * @param message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. - * @param message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesVerifyExternalSyncSettingsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesVerifyExternalSyncSettingsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse; - - /** - * Verifies a SqlInstancesVerifyExternalSyncSettingsResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesVerifyExternalSyncSettingsResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesVerifyExternalSyncSettingsResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse; - - /** - * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsResponse message. Also converts values to other types if specified. - * @param message SqlInstancesVerifyExternalSyncSettingsResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesVerifyExternalSyncSettingsResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlExternalSyncSettingError. */ - interface ISqlExternalSyncSettingError { - - /** SqlExternalSyncSettingError kind */ - kind?: (string|null); - - /** SqlExternalSyncSettingError type */ - type?: (google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|keyof typeof google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|null); - - /** SqlExternalSyncSettingError detail */ - detail?: (string|null); - } - - /** Represents a SqlExternalSyncSettingError. */ - class SqlExternalSyncSettingError implements ISqlExternalSyncSettingError { - - /** - * Constructs a new SqlExternalSyncSettingError. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError); - - /** SqlExternalSyncSettingError kind. */ - public kind: string; - - /** SqlExternalSyncSettingError type. */ - public type: (google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|keyof typeof google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType); - - /** SqlExternalSyncSettingError detail. */ - public detail: string; - - /** - * Creates a new SqlExternalSyncSettingError instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlExternalSyncSettingError instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError): google.cloud.sql.v1beta4.SqlExternalSyncSettingError; - - /** - * Encodes the specified SqlExternalSyncSettingError message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify|verify} messages. - * @param message SqlExternalSyncSettingError message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlExternalSyncSettingError message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify|verify} messages. - * @param message SqlExternalSyncSettingError message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlExternalSyncSettingError, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlExternalSyncSettingError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlExternalSyncSettingError; - - /** - * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlExternalSyncSettingError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlExternalSyncSettingError; - - /** - * Verifies a SqlExternalSyncSettingError message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlExternalSyncSettingError message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlExternalSyncSettingError - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlExternalSyncSettingError; - - /** - * Creates a plain object from a SqlExternalSyncSettingError message. Also converts values to other types if specified. - * @param message SqlExternalSyncSettingError - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlExternalSyncSettingError, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlExternalSyncSettingError to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlExternalSyncSettingError - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlExternalSyncSettingError { - - /** SqlExternalSyncSettingErrorType enum. */ - enum SqlExternalSyncSettingErrorType { - SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED = 0, - CONNECTION_FAILURE = 1, - BINLOG_NOT_ENABLED = 2, - INCOMPATIBLE_DATABASE_VERSION = 3, - REPLICA_ALREADY_SETUP = 4, - INSUFFICIENT_PRIVILEGE = 5, - UNSUPPORTED_MIGRATION_TYPE = 6, - NO_PGLOGICAL_INSTALLED = 7, - PGLOGICAL_NODE_ALREADY_EXISTS = 8, - INVALID_WAL_LEVEL = 9, - INVALID_SHARED_PRELOAD_LIBRARY = 10, - INSUFFICIENT_MAX_REPLICATION_SLOTS = 11, - INSUFFICIENT_MAX_WAL_SENDERS = 12, - INSUFFICIENT_MAX_WORKER_PROCESSES = 13, - UNSUPPORTED_EXTENSIONS = 14, - INVALID_RDS_LOGICAL_REPLICATION = 15, - INVALID_LOGGING_SETUP = 16, - INVALID_DB_PARAM = 17, - UNSUPPORTED_GTID_MODE = 18, - SQLSERVER_AGENT_NOT_RUNNING = 19, - UNSUPPORTED_TABLE_DEFINITION = 20, - UNSUPPORTED_DEFINER = 21, - SQLSERVER_SERVERNAME_MISMATCH = 22, - PRIMARY_ALREADY_SETUP = 23, - UNSUPPORTED_BINLOG_FORMAT = 24, - BINLOG_RETENTION_SETTING = 25, - UNSUPPORTED_STORAGE_ENGINE = 26, - LIMITED_SUPPORT_TABLES = 27, - EXISTING_DATA_IN_REPLICA = 28, - MISSING_OPTIONAL_PRIVILEGES = 29, - RISKY_BACKUP_ADMIN_PRIVILEGE = 30, - INSUFFICIENT_GCS_PERMISSIONS = 31, - INVALID_FILE_INFO = 32, - UNSUPPORTED_DATABASE_SETTINGS = 33, - MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE = 34, - LOCAL_INFILE_OFF = 35, - TURN_ON_PITR_AFTER_PROMOTE = 36, - INCOMPATIBLE_DATABASE_MINOR_VERSION = 37, - SOURCE_MAX_SUBSCRIPTIONS = 38, - UNABLE_TO_VERIFY_DEFINERS = 39, - SUBSCRIPTION_CALCULATION_STATUS = 40, - PG_SUBSCRIPTION_COUNT = 41, - PG_SYNC_PARALLEL_LEVEL = 42, - INSUFFICIENT_DISK_SIZE = 43, - INSUFFICIENT_MACHINE_TIER = 44, - UNSUPPORTED_EXTENSIONS_NOT_MIGRATED = 45, - EXTENSIONS_NOT_MIGRATED = 46, - PG_CRON_FLAG_ENABLED_IN_REPLICA = 47, - EXTENSIONS_NOT_ENABLED_IN_REPLICA = 48, - UNSUPPORTED_COLUMNS = 49, - USERS_NOT_CREATED_IN_REPLICA = 50, - UNSUPPORTED_SYSTEM_OBJECTS = 51, - UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY = 52, - SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE = 53, - PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI = 54, - SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS = 55, - PROMPT_DELETE_EXISTING = 56, - WILL_DELETE_EXISTING = 57, - PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE = 58 - } - } - - /** Properties of an IpConfiguration. */ - interface IIpConfiguration { - - /** IpConfiguration ipv4Enabled */ - ipv4Enabled?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration privateNetwork */ - privateNetwork?: (string|null); - - /** IpConfiguration requireSsl */ - requireSsl?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration authorizedNetworks */ - authorizedNetworks?: (google.cloud.sql.v1beta4.IAclEntry[]|null); - - /** IpConfiguration allocatedIpRange */ - allocatedIpRange?: (string|null); - - /** IpConfiguration enablePrivatePathForGoogleCloudServices */ - enablePrivatePathForGoogleCloudServices?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration sslMode */ - sslMode?: (google.cloud.sql.v1beta4.IpConfiguration.SslMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.SslMode|null); - - /** IpConfiguration pscConfig */ - pscConfig?: (google.cloud.sql.v1beta4.IPscConfig|null); - - /** IpConfiguration serverCaMode */ - serverCaMode?: (google.cloud.sql.v1beta4.IpConfiguration.CaMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.CaMode|null); - - /** IpConfiguration customSubjectAlternativeNames */ - customSubjectAlternativeNames?: (string[]|null); - - /** IpConfiguration serverCaPool */ - serverCaPool?: (string|null); - - /** IpConfiguration serverCertificateRotationMode */ - serverCertificateRotationMode?: (google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|null); - } - - /** Represents an IpConfiguration. */ - class IpConfiguration implements IIpConfiguration { - - /** - * Constructs a new IpConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IIpConfiguration); - - /** IpConfiguration ipv4Enabled. */ - public ipv4Enabled?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration privateNetwork. */ - public privateNetwork: string; - - /** IpConfiguration requireSsl. */ - public requireSsl?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration authorizedNetworks. */ - public authorizedNetworks: google.cloud.sql.v1beta4.IAclEntry[]; - - /** IpConfiguration allocatedIpRange. */ - public allocatedIpRange: string; - - /** IpConfiguration enablePrivatePathForGoogleCloudServices. */ - public enablePrivatePathForGoogleCloudServices?: (google.protobuf.IBoolValue|null); - - /** IpConfiguration sslMode. */ - public sslMode: (google.cloud.sql.v1beta4.IpConfiguration.SslMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.SslMode); - - /** IpConfiguration pscConfig. */ - public pscConfig?: (google.cloud.sql.v1beta4.IPscConfig|null); - - /** IpConfiguration serverCaMode. */ - public serverCaMode?: (google.cloud.sql.v1beta4.IpConfiguration.CaMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.CaMode|null); - - /** IpConfiguration customSubjectAlternativeNames. */ - public customSubjectAlternativeNames: string[]; - - /** IpConfiguration serverCaPool. */ - public serverCaPool?: (string|null); - - /** IpConfiguration serverCertificateRotationMode. */ - public serverCertificateRotationMode?: (google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|keyof typeof google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|null); - - /** - * Creates a new IpConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns IpConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IIpConfiguration): google.cloud.sql.v1beta4.IpConfiguration; - - /** - * Encodes the specified IpConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.IpConfiguration.verify|verify} messages. - * @param message IpConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IIpConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified IpConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.IpConfiguration.verify|verify} messages. - * @param message IpConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IIpConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an IpConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns IpConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.IpConfiguration; - - /** - * Decodes an IpConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns IpConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.IpConfiguration; - - /** - * Verifies an IpConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an IpConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns IpConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.IpConfiguration; - - /** - * Creates a plain object from an IpConfiguration message. Also converts values to other types if specified. - * @param message IpConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.IpConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this IpConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for IpConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace IpConfiguration { - - /** SslMode enum. */ - enum SslMode { - SSL_MODE_UNSPECIFIED = 0, - ALLOW_UNENCRYPTED_AND_ENCRYPTED = 1, - ENCRYPTED_ONLY = 2, - TRUSTED_CLIENT_CERTIFICATE_REQUIRED = 3 - } - - /** CaMode enum. */ - enum CaMode { - CA_MODE_UNSPECIFIED = 0, - GOOGLE_MANAGED_INTERNAL_CA = 1, - GOOGLE_MANAGED_CAS_CA = 2, - CUSTOMER_MANAGED_CAS_CA = 3 - } - - /** ServerCertificateRotationMode enum. */ - enum ServerCertificateRotationMode { - SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED = 0, - NO_AUTOMATIC_ROTATION = 1, - AUTOMATIC_ROTATION_DURING_MAINTENANCE = 2 - } - } - - /** Properties of a PscConfig. */ - interface IPscConfig { - - /** PscConfig pscEnabled */ - pscEnabled?: (boolean|null); - - /** PscConfig allowedConsumerProjects */ - allowedConsumerProjects?: (string[]|null); - - /** PscConfig pscAutoConnections */ - pscAutoConnections?: (google.cloud.sql.v1beta4.IPscAutoConnectionConfig[]|null); - - /** PscConfig networkAttachmentUri */ - networkAttachmentUri?: (string|null); - } - - /** Represents a PscConfig. */ - class PscConfig implements IPscConfig { - - /** - * Constructs a new PscConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IPscConfig); - - /** PscConfig pscEnabled. */ - public pscEnabled?: (boolean|null); - - /** PscConfig allowedConsumerProjects. */ - public allowedConsumerProjects: string[]; - - /** PscConfig pscAutoConnections. */ - public pscAutoConnections: google.cloud.sql.v1beta4.IPscAutoConnectionConfig[]; - - /** PscConfig networkAttachmentUri. */ - public networkAttachmentUri: string; - - /** - * Creates a new PscConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns PscConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IPscConfig): google.cloud.sql.v1beta4.PscConfig; - - /** - * Encodes the specified PscConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PscConfig.verify|verify} messages. - * @param message PscConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IPscConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PscConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PscConfig.verify|verify} messages. - * @param message PscConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IPscConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PscConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PscConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PscConfig; - - /** - * Decodes a PscConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PscConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PscConfig; - - /** - * Verifies a PscConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PscConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PscConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PscConfig; - - /** - * Creates a plain object from a PscConfig message. Also converts values to other types if specified. - * @param message PscConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.PscConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PscConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PscConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PscAutoConnectionConfig. */ - interface IPscAutoConnectionConfig { - - /** PscAutoConnectionConfig consumerProject */ - consumerProject?: (string|null); - - /** PscAutoConnectionConfig consumerNetwork */ - consumerNetwork?: (string|null); - - /** PscAutoConnectionConfig ipAddress */ - ipAddress?: (string|null); - - /** PscAutoConnectionConfig status */ - status?: (string|null); - - /** PscAutoConnectionConfig consumerNetworkStatus */ - consumerNetworkStatus?: (string|null); - } - - /** Represents a PscAutoConnectionConfig. */ - class PscAutoConnectionConfig implements IPscAutoConnectionConfig { - - /** - * Constructs a new PscAutoConnectionConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IPscAutoConnectionConfig); - - /** PscAutoConnectionConfig consumerProject. */ - public consumerProject: string; - - /** PscAutoConnectionConfig consumerNetwork. */ - public consumerNetwork: string; - - /** PscAutoConnectionConfig ipAddress. */ - public ipAddress?: (string|null); - - /** PscAutoConnectionConfig status. */ - public status?: (string|null); - - /** PscAutoConnectionConfig consumerNetworkStatus. */ - public consumerNetworkStatus?: (string|null); - - /** - * Creates a new PscAutoConnectionConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns PscAutoConnectionConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IPscAutoConnectionConfig): google.cloud.sql.v1beta4.PscAutoConnectionConfig; - - /** - * Encodes the specified PscAutoConnectionConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify|verify} messages. - * @param message PscAutoConnectionConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IPscAutoConnectionConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PscAutoConnectionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify|verify} messages. - * @param message PscAutoConnectionConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IPscAutoConnectionConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PscAutoConnectionConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PscAutoConnectionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PscAutoConnectionConfig; - - /** - * Decodes a PscAutoConnectionConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PscAutoConnectionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PscAutoConnectionConfig; - - /** - * Verifies a PscAutoConnectionConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PscAutoConnectionConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PscAutoConnectionConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PscAutoConnectionConfig; - - /** - * Creates a plain object from a PscAutoConnectionConfig message. Also converts values to other types if specified. - * @param message PscAutoConnectionConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.PscAutoConnectionConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PscAutoConnectionConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PscAutoConnectionConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an IpMapping. */ - interface IIpMapping { - - /** IpMapping type */ - type?: (google.cloud.sql.v1beta4.SqlIpAddressType|keyof typeof google.cloud.sql.v1beta4.SqlIpAddressType|null); - - /** IpMapping ipAddress */ - ipAddress?: (string|null); - - /** IpMapping timeToRetire */ - timeToRetire?: (google.protobuf.ITimestamp|null); - } - - /** Represents an IpMapping. */ - class IpMapping implements IIpMapping { - - /** - * Constructs a new IpMapping. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IIpMapping); - - /** IpMapping type. */ - public type: (google.cloud.sql.v1beta4.SqlIpAddressType|keyof typeof google.cloud.sql.v1beta4.SqlIpAddressType); - - /** IpMapping ipAddress. */ - public ipAddress: string; - - /** IpMapping timeToRetire. */ - public timeToRetire?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new IpMapping instance using the specified properties. - * @param [properties] Properties to set - * @returns IpMapping instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IIpMapping): google.cloud.sql.v1beta4.IpMapping; - - /** - * Encodes the specified IpMapping message. Does not implicitly {@link google.cloud.sql.v1beta4.IpMapping.verify|verify} messages. - * @param message IpMapping message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IIpMapping, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified IpMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.IpMapping.verify|verify} messages. - * @param message IpMapping message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IIpMapping, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an IpMapping message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns IpMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.IpMapping; - - /** - * Decodes an IpMapping message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns IpMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.IpMapping; - - /** - * Verifies an IpMapping message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an IpMapping message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns IpMapping - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.IpMapping; - - /** - * Creates a plain object from an IpMapping message. Also converts values to other types if specified. - * @param message IpMapping - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.IpMapping, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this IpMapping to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for IpMapping - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a LocationPreference. */ - interface ILocationPreference { - - /** LocationPreference followGaeApplication */ - followGaeApplication?: (string|null); - - /** LocationPreference zone */ - zone?: (string|null); - - /** LocationPreference secondaryZone */ - secondaryZone?: (string|null); - - /** LocationPreference kind */ - kind?: (string|null); - } - - /** Represents a LocationPreference. */ - class LocationPreference implements ILocationPreference { - - /** - * Constructs a new LocationPreference. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ILocationPreference); - - /** LocationPreference followGaeApplication. */ - public followGaeApplication: string; - - /** LocationPreference zone. */ - public zone: string; - - /** LocationPreference secondaryZone. */ - public secondaryZone: string; - - /** LocationPreference kind. */ - public kind: string; - - /** - * Creates a new LocationPreference instance using the specified properties. - * @param [properties] Properties to set - * @returns LocationPreference instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ILocationPreference): google.cloud.sql.v1beta4.LocationPreference; - - /** - * Encodes the specified LocationPreference message. Does not implicitly {@link google.cloud.sql.v1beta4.LocationPreference.verify|verify} messages. - * @param message LocationPreference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ILocationPreference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LocationPreference message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.LocationPreference.verify|verify} messages. - * @param message LocationPreference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ILocationPreference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LocationPreference message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LocationPreference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.LocationPreference; - - /** - * Decodes a LocationPreference message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LocationPreference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.LocationPreference; - - /** - * Verifies a LocationPreference message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a LocationPreference message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LocationPreference - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.LocationPreference; - - /** - * Creates a plain object from a LocationPreference message. Also converts values to other types if specified. - * @param message LocationPreference - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.LocationPreference, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LocationPreference to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LocationPreference - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MaintenanceWindow. */ - interface IMaintenanceWindow { - - /** MaintenanceWindow hour */ - hour?: (google.protobuf.IInt32Value|null); - - /** MaintenanceWindow day */ - day?: (google.protobuf.IInt32Value|null); - - /** MaintenanceWindow updateTrack */ - updateTrack?: (google.cloud.sql.v1beta4.SqlUpdateTrack|keyof typeof google.cloud.sql.v1beta4.SqlUpdateTrack|null); - - /** MaintenanceWindow kind */ - kind?: (string|null); - } - - /** Represents a MaintenanceWindow. */ - class MaintenanceWindow implements IMaintenanceWindow { - - /** - * Constructs a new MaintenanceWindow. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IMaintenanceWindow); - - /** MaintenanceWindow hour. */ - public hour?: (google.protobuf.IInt32Value|null); - - /** MaintenanceWindow day. */ - public day?: (google.protobuf.IInt32Value|null); - - /** MaintenanceWindow updateTrack. */ - public updateTrack: (google.cloud.sql.v1beta4.SqlUpdateTrack|keyof typeof google.cloud.sql.v1beta4.SqlUpdateTrack); - - /** MaintenanceWindow kind. */ - public kind: string; - - /** - * Creates a new MaintenanceWindow instance using the specified properties. - * @param [properties] Properties to set - * @returns MaintenanceWindow instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IMaintenanceWindow): google.cloud.sql.v1beta4.MaintenanceWindow; - - /** - * Encodes the specified MaintenanceWindow message. Does not implicitly {@link google.cloud.sql.v1beta4.MaintenanceWindow.verify|verify} messages. - * @param message MaintenanceWindow message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IMaintenanceWindow, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MaintenanceWindow message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MaintenanceWindow.verify|verify} messages. - * @param message MaintenanceWindow message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IMaintenanceWindow, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MaintenanceWindow message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MaintenanceWindow - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.MaintenanceWindow; - - /** - * Decodes a MaintenanceWindow message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MaintenanceWindow - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.MaintenanceWindow; - - /** - * Verifies a MaintenanceWindow message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MaintenanceWindow message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MaintenanceWindow - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.MaintenanceWindow; - - /** - * Creates a plain object from a MaintenanceWindow message. Also converts values to other types if specified. - * @param message MaintenanceWindow - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.MaintenanceWindow, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MaintenanceWindow to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MaintenanceWindow - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DenyMaintenancePeriod. */ - interface IDenyMaintenancePeriod { - - /** DenyMaintenancePeriod startDate */ - startDate?: (string|null); - - /** DenyMaintenancePeriod endDate */ - endDate?: (string|null); - - /** DenyMaintenancePeriod time */ - time?: (string|null); - } - - /** Represents a DenyMaintenancePeriod. */ - class DenyMaintenancePeriod implements IDenyMaintenancePeriod { - - /** - * Constructs a new DenyMaintenancePeriod. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDenyMaintenancePeriod); - - /** DenyMaintenancePeriod startDate. */ - public startDate: string; - - /** DenyMaintenancePeriod endDate. */ - public endDate: string; - - /** DenyMaintenancePeriod time. */ - public time: string; - - /** - * Creates a new DenyMaintenancePeriod instance using the specified properties. - * @param [properties] Properties to set - * @returns DenyMaintenancePeriod instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDenyMaintenancePeriod): google.cloud.sql.v1beta4.DenyMaintenancePeriod; - - /** - * Encodes the specified DenyMaintenancePeriod message. Does not implicitly {@link google.cloud.sql.v1beta4.DenyMaintenancePeriod.verify|verify} messages. - * @param message DenyMaintenancePeriod message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDenyMaintenancePeriod, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DenyMaintenancePeriod message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DenyMaintenancePeriod.verify|verify} messages. - * @param message DenyMaintenancePeriod message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDenyMaintenancePeriod, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DenyMaintenancePeriod message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DenyMaintenancePeriod - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DenyMaintenancePeriod; - - /** - * Decodes a DenyMaintenancePeriod message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DenyMaintenancePeriod - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DenyMaintenancePeriod; - - /** - * Verifies a DenyMaintenancePeriod message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DenyMaintenancePeriod message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DenyMaintenancePeriod - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DenyMaintenancePeriod; - - /** - * Creates a plain object from a DenyMaintenancePeriod message. Also converts values to other types if specified. - * @param message DenyMaintenancePeriod - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DenyMaintenancePeriod, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DenyMaintenancePeriod to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DenyMaintenancePeriod - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an InsightsConfig. */ - interface IInsightsConfig { - - /** InsightsConfig queryInsightsEnabled */ - queryInsightsEnabled?: (boolean|null); - - /** InsightsConfig recordClientAddress */ - recordClientAddress?: (boolean|null); - - /** InsightsConfig recordApplicationTags */ - recordApplicationTags?: (boolean|null); - - /** InsightsConfig queryStringLength */ - queryStringLength?: (google.protobuf.IInt32Value|null); - - /** InsightsConfig queryPlansPerMinute */ - queryPlansPerMinute?: (google.protobuf.IInt32Value|null); - - /** InsightsConfig enhancedQueryInsightsEnabled */ - enhancedQueryInsightsEnabled?: (google.protobuf.IBoolValue|null); - } - - /** Represents an InsightsConfig. */ - class InsightsConfig implements IInsightsConfig { - - /** - * Constructs a new InsightsConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IInsightsConfig); - - /** InsightsConfig queryInsightsEnabled. */ - public queryInsightsEnabled: boolean; - - /** InsightsConfig recordClientAddress. */ - public recordClientAddress: boolean; - - /** InsightsConfig recordApplicationTags. */ - public recordApplicationTags: boolean; - - /** InsightsConfig queryStringLength. */ - public queryStringLength?: (google.protobuf.IInt32Value|null); - - /** InsightsConfig queryPlansPerMinute. */ - public queryPlansPerMinute?: (google.protobuf.IInt32Value|null); - - /** InsightsConfig enhancedQueryInsightsEnabled. */ - public enhancedQueryInsightsEnabled?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new InsightsConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns InsightsConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IInsightsConfig): google.cloud.sql.v1beta4.InsightsConfig; - - /** - * Encodes the specified InsightsConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.InsightsConfig.verify|verify} messages. - * @param message InsightsConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IInsightsConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified InsightsConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InsightsConfig.verify|verify} messages. - * @param message InsightsConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IInsightsConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an InsightsConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns InsightsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.InsightsConfig; - - /** - * Decodes an InsightsConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns InsightsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.InsightsConfig; - - /** - * Verifies an InsightsConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an InsightsConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns InsightsConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.InsightsConfig; - - /** - * Creates a plain object from an InsightsConfig message. Also converts values to other types if specified. - * @param message InsightsConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.InsightsConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this InsightsConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for InsightsConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MySqlReplicaConfiguration. */ - interface IMySqlReplicaConfiguration { - - /** MySqlReplicaConfiguration dumpFilePath */ - dumpFilePath?: (string|null); - - /** MySqlReplicaConfiguration username */ - username?: (string|null); - - /** MySqlReplicaConfiguration password */ - password?: (string|null); - - /** MySqlReplicaConfiguration connectRetryInterval */ - connectRetryInterval?: (google.protobuf.IInt32Value|null); - - /** MySqlReplicaConfiguration masterHeartbeatPeriod */ - masterHeartbeatPeriod?: (google.protobuf.IInt64Value|null); - - /** MySqlReplicaConfiguration caCertificate */ - caCertificate?: (string|null); - - /** MySqlReplicaConfiguration clientCertificate */ - clientCertificate?: (string|null); - - /** MySqlReplicaConfiguration clientKey */ - clientKey?: (string|null); - - /** MySqlReplicaConfiguration sslCipher */ - sslCipher?: (string|null); - - /** MySqlReplicaConfiguration verifyServerCertificate */ - verifyServerCertificate?: (google.protobuf.IBoolValue|null); - - /** MySqlReplicaConfiguration kind */ - kind?: (string|null); - } - - /** Represents a MySqlReplicaConfiguration. */ - class MySqlReplicaConfiguration implements IMySqlReplicaConfiguration { - - /** - * Constructs a new MySqlReplicaConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IMySqlReplicaConfiguration); - - /** MySqlReplicaConfiguration dumpFilePath. */ - public dumpFilePath: string; - - /** MySqlReplicaConfiguration username. */ - public username: string; - - /** MySqlReplicaConfiguration password. */ - public password: string; - - /** MySqlReplicaConfiguration connectRetryInterval. */ - public connectRetryInterval?: (google.protobuf.IInt32Value|null); - - /** MySqlReplicaConfiguration masterHeartbeatPeriod. */ - public masterHeartbeatPeriod?: (google.protobuf.IInt64Value|null); - - /** MySqlReplicaConfiguration caCertificate. */ - public caCertificate: string; - - /** MySqlReplicaConfiguration clientCertificate. */ - public clientCertificate: string; - - /** MySqlReplicaConfiguration clientKey. */ - public clientKey: string; - - /** MySqlReplicaConfiguration sslCipher. */ - public sslCipher: string; - - /** MySqlReplicaConfiguration verifyServerCertificate. */ - public verifyServerCertificate?: (google.protobuf.IBoolValue|null); - - /** MySqlReplicaConfiguration kind. */ - public kind: string; - - /** - * Creates a new MySqlReplicaConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns MySqlReplicaConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IMySqlReplicaConfiguration): google.cloud.sql.v1beta4.MySqlReplicaConfiguration; - - /** - * Encodes the specified MySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verify|verify} messages. - * @param message MySqlReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verify|verify} messages. - * @param message MySqlReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IMySqlReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.MySqlReplicaConfiguration; - - /** - * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.MySqlReplicaConfiguration; - - /** - * Verifies a MySqlReplicaConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MySqlReplicaConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.MySqlReplicaConfiguration; - - /** - * Creates a plain object from a MySqlReplicaConfiguration message. Also converts values to other types if specified. - * @param message MySqlReplicaConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.MySqlReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MySqlReplicaConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MySqlReplicaConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SelectedObjects. */ - interface ISelectedObjects { - - /** SelectedObjects database */ - database?: (string|null); - } - - /** Represents a SelectedObjects. */ - class SelectedObjects implements ISelectedObjects { - - /** - * Constructs a new SelectedObjects. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISelectedObjects); - - /** SelectedObjects database. */ - public database: string; - - /** - * Creates a new SelectedObjects instance using the specified properties. - * @param [properties] Properties to set - * @returns SelectedObjects instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISelectedObjects): google.cloud.sql.v1beta4.SelectedObjects; - - /** - * Encodes the specified SelectedObjects message. Does not implicitly {@link google.cloud.sql.v1beta4.SelectedObjects.verify|verify} messages. - * @param message SelectedObjects message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISelectedObjects, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SelectedObjects message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SelectedObjects.verify|verify} messages. - * @param message SelectedObjects message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISelectedObjects, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SelectedObjects message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SelectedObjects - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SelectedObjects; - - /** - * Decodes a SelectedObjects message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SelectedObjects - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SelectedObjects; - - /** - * Verifies a SelectedObjects message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SelectedObjects message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SelectedObjects - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SelectedObjects; - - /** - * Creates a plain object from a SelectedObjects message. Also converts values to other types if specified. - * @param message SelectedObjects - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SelectedObjects, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SelectedObjects to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SelectedObjects - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OnPremisesConfiguration. */ - interface IOnPremisesConfiguration { - - /** OnPremisesConfiguration hostPort */ - hostPort?: (string|null); - - /** OnPremisesConfiguration kind */ - kind?: (string|null); - - /** OnPremisesConfiguration username */ - username?: (string|null); - - /** OnPremisesConfiguration password */ - password?: (string|null); - - /** OnPremisesConfiguration caCertificate */ - caCertificate?: (string|null); - - /** OnPremisesConfiguration clientCertificate */ - clientCertificate?: (string|null); - - /** OnPremisesConfiguration clientKey */ - clientKey?: (string|null); - - /** OnPremisesConfiguration dumpFilePath */ - dumpFilePath?: (string|null); - - /** OnPremisesConfiguration sourceInstance */ - sourceInstance?: (google.cloud.sql.v1beta4.IInstanceReference|null); - - /** OnPremisesConfiguration selectedObjects */ - selectedObjects?: (google.cloud.sql.v1beta4.ISelectedObjects[]|null); - - /** OnPremisesConfiguration sslOption */ - sslOption?: (google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption|keyof typeof google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption|null); - } - - /** Represents an OnPremisesConfiguration. */ - class OnPremisesConfiguration implements IOnPremisesConfiguration { - - /** - * Constructs a new OnPremisesConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IOnPremisesConfiguration); - - /** OnPremisesConfiguration hostPort. */ - public hostPort: string; - - /** OnPremisesConfiguration kind. */ - public kind: string; - - /** OnPremisesConfiguration username. */ - public username: string; - - /** OnPremisesConfiguration password. */ - public password: string; - - /** OnPremisesConfiguration caCertificate. */ - public caCertificate: string; - - /** OnPremisesConfiguration clientCertificate. */ - public clientCertificate: string; - - /** OnPremisesConfiguration clientKey. */ - public clientKey: string; - - /** OnPremisesConfiguration dumpFilePath. */ - public dumpFilePath: string; - - /** OnPremisesConfiguration sourceInstance. */ - public sourceInstance?: (google.cloud.sql.v1beta4.IInstanceReference|null); - - /** OnPremisesConfiguration selectedObjects. */ - public selectedObjects: google.cloud.sql.v1beta4.ISelectedObjects[]; - - /** OnPremisesConfiguration sslOption. */ - public sslOption: (google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption|keyof typeof google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption); - - /** - * Creates a new OnPremisesConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns OnPremisesConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IOnPremisesConfiguration): google.cloud.sql.v1beta4.OnPremisesConfiguration; - - /** - * Encodes the specified OnPremisesConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.OnPremisesConfiguration.verify|verify} messages. - * @param message OnPremisesConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IOnPremisesConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OnPremisesConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OnPremisesConfiguration.verify|verify} messages. - * @param message OnPremisesConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IOnPremisesConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OnPremisesConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OnPremisesConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.OnPremisesConfiguration; - - /** - * Decodes an OnPremisesConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OnPremisesConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.OnPremisesConfiguration; - - /** - * Verifies an OnPremisesConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OnPremisesConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OnPremisesConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.OnPremisesConfiguration; - - /** - * Creates a plain object from an OnPremisesConfiguration message. Also converts values to other types if specified. - * @param message OnPremisesConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.OnPremisesConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OnPremisesConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OnPremisesConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace OnPremisesConfiguration { - - /** SslOption enum. */ - enum SslOption { - SSL_OPTION_UNSPECIFIED = 0, - DISABLE = 1, - REQUIRE = 2, - VERIFY_CA = 3 - } - } - - /** Properties of a DiskEncryptionConfiguration. */ - interface IDiskEncryptionConfiguration { - - /** DiskEncryptionConfiguration kmsKeyName */ - kmsKeyName?: (string|null); - - /** DiskEncryptionConfiguration kind */ - kind?: (string|null); - } - - /** Represents a DiskEncryptionConfiguration. */ - class DiskEncryptionConfiguration implements IDiskEncryptionConfiguration { - - /** - * Constructs a new DiskEncryptionConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDiskEncryptionConfiguration); - - /** DiskEncryptionConfiguration kmsKeyName. */ - public kmsKeyName: string; - - /** DiskEncryptionConfiguration kind. */ - public kind: string; - - /** - * Creates a new DiskEncryptionConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns DiskEncryptionConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDiskEncryptionConfiguration): google.cloud.sql.v1beta4.DiskEncryptionConfiguration; - - /** - * Encodes the specified DiskEncryptionConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify|verify} messages. - * @param message DiskEncryptionConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDiskEncryptionConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DiskEncryptionConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify|verify} messages. - * @param message DiskEncryptionConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDiskEncryptionConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DiskEncryptionConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DiskEncryptionConfiguration; - - /** - * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DiskEncryptionConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DiskEncryptionConfiguration; - - /** - * Verifies a DiskEncryptionConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DiskEncryptionConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DiskEncryptionConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DiskEncryptionConfiguration; - - /** - * Creates a plain object from a DiskEncryptionConfiguration message. Also converts values to other types if specified. - * @param message DiskEncryptionConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DiskEncryptionConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DiskEncryptionConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DiskEncryptionConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DiskEncryptionStatus. */ - interface IDiskEncryptionStatus { - - /** DiskEncryptionStatus kmsKeyVersionName */ - kmsKeyVersionName?: (string|null); - - /** DiskEncryptionStatus kind */ - kind?: (string|null); - } - - /** Represents a DiskEncryptionStatus. */ - class DiskEncryptionStatus implements IDiskEncryptionStatus { - - /** - * Constructs a new DiskEncryptionStatus. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDiskEncryptionStatus); - - /** DiskEncryptionStatus kmsKeyVersionName. */ - public kmsKeyVersionName: string; - - /** DiskEncryptionStatus kind. */ - public kind: string; - - /** - * Creates a new DiskEncryptionStatus instance using the specified properties. - * @param [properties] Properties to set - * @returns DiskEncryptionStatus instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDiskEncryptionStatus): google.cloud.sql.v1beta4.DiskEncryptionStatus; - - /** - * Encodes the specified DiskEncryptionStatus message. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionStatus.verify|verify} messages. - * @param message DiskEncryptionStatus message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDiskEncryptionStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DiskEncryptionStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionStatus.verify|verify} messages. - * @param message DiskEncryptionStatus message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDiskEncryptionStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DiskEncryptionStatus message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DiskEncryptionStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DiskEncryptionStatus; - - /** - * Decodes a DiskEncryptionStatus message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DiskEncryptionStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DiskEncryptionStatus; - - /** - * Verifies a DiskEncryptionStatus message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DiskEncryptionStatus message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DiskEncryptionStatus - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DiskEncryptionStatus; - - /** - * Creates a plain object from a DiskEncryptionStatus message. Also converts values to other types if specified. - * @param message DiskEncryptionStatus - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DiskEncryptionStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DiskEncryptionStatus to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DiskEncryptionStatus - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlMaintenanceType enum. */ - enum SqlMaintenanceType { - SQL_MAINTENANCE_TYPE_UNSPECIFIED = 0, - INSTANCE_MAINTENANCE = 1, - REPLICA_INCLUDED_MAINTENANCE = 2, - INSTANCE_SELF_SERVICE_MAINTENANCE = 3, - REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE = 4 - } - - /** Properties of a SqlSubOperationType. */ - interface ISqlSubOperationType { - - /** SqlSubOperationType maintenanceType */ - maintenanceType?: (google.cloud.sql.v1beta4.SqlMaintenanceType|keyof typeof google.cloud.sql.v1beta4.SqlMaintenanceType|null); - } - - /** Represents a SqlSubOperationType. */ - class SqlSubOperationType implements ISqlSubOperationType { - - /** - * Constructs a new SqlSubOperationType. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlSubOperationType); - - /** SqlSubOperationType maintenanceType. */ - public maintenanceType?: (google.cloud.sql.v1beta4.SqlMaintenanceType|keyof typeof google.cloud.sql.v1beta4.SqlMaintenanceType|null); - - /** SqlSubOperationType subOperationDetails. */ - public subOperationDetails?: "maintenanceType"; - - /** - * Creates a new SqlSubOperationType instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlSubOperationType instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlSubOperationType): google.cloud.sql.v1beta4.SqlSubOperationType; - - /** - * Encodes the specified SqlSubOperationType message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSubOperationType.verify|verify} messages. - * @param message SqlSubOperationType message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlSubOperationType, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlSubOperationType message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSubOperationType.verify|verify} messages. - * @param message SqlSubOperationType message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlSubOperationType, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlSubOperationType message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlSubOperationType - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlSubOperationType; - - /** - * Decodes a SqlSubOperationType message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlSubOperationType - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlSubOperationType; - - /** - * Verifies a SqlSubOperationType message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlSubOperationType message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlSubOperationType - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlSubOperationType; - - /** - * Creates a plain object from a SqlSubOperationType message. Also converts values to other types if specified. - * @param message SqlSubOperationType - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlSubOperationType, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlSubOperationType to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlSubOperationType - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Operation. */ - interface IOperation { - - /** Operation kind */ - kind?: (string|null); - - /** Operation targetLink */ - targetLink?: (string|null); - - /** Operation status */ - status?: (google.cloud.sql.v1beta4.Operation.SqlOperationStatus|keyof typeof google.cloud.sql.v1beta4.Operation.SqlOperationStatus|null); - - /** Operation user */ - user?: (string|null); - - /** Operation insertTime */ - insertTime?: (google.protobuf.ITimestamp|null); - - /** Operation startTime */ - startTime?: (google.protobuf.ITimestamp|null); - - /** Operation endTime */ - endTime?: (google.protobuf.ITimestamp|null); - - /** Operation error */ - error?: (google.cloud.sql.v1beta4.IOperationErrors|null); - - /** Operation apiWarning */ - apiWarning?: (google.cloud.sql.v1beta4.IApiWarning|null); - - /** Operation operationType */ - operationType?: (google.cloud.sql.v1beta4.Operation.SqlOperationType|keyof typeof google.cloud.sql.v1beta4.Operation.SqlOperationType|null); - - /** Operation importContext */ - importContext?: (google.cloud.sql.v1beta4.IImportContext|null); - - /** Operation exportContext */ - exportContext?: (google.cloud.sql.v1beta4.IExportContext|null); - - /** Operation backupContext */ - backupContext?: (google.cloud.sql.v1beta4.IBackupContext|null); - - /** Operation preCheckMajorVersionUpgradeContext */ - preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null); - - /** Operation name */ - name?: (string|null); - - /** Operation targetId */ - targetId?: (string|null); - - /** Operation selfLink */ - selfLink?: (string|null); - - /** Operation targetProject */ - targetProject?: (string|null); - - /** Operation acquireSsrsLeaseContext */ - acquireSsrsLeaseContext?: (google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null); - - /** Operation subOperationType */ - subOperationType?: (google.cloud.sql.v1beta4.ISqlSubOperationType|null); - } - - /** Represents an Operation. */ - class Operation implements IOperation { - - /** - * Constructs a new Operation. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IOperation); - - /** Operation kind. */ - public kind: string; - - /** Operation targetLink. */ - public targetLink: string; - - /** Operation status. */ - public status: (google.cloud.sql.v1beta4.Operation.SqlOperationStatus|keyof typeof google.cloud.sql.v1beta4.Operation.SqlOperationStatus); - - /** Operation user. */ - public user: string; - - /** Operation insertTime. */ - public insertTime?: (google.protobuf.ITimestamp|null); - - /** Operation startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); - - /** Operation endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** Operation error. */ - public error?: (google.cloud.sql.v1beta4.IOperationErrors|null); - - /** Operation apiWarning. */ - public apiWarning?: (google.cloud.sql.v1beta4.IApiWarning|null); - - /** Operation operationType. */ - public operationType: (google.cloud.sql.v1beta4.Operation.SqlOperationType|keyof typeof google.cloud.sql.v1beta4.Operation.SqlOperationType); - - /** Operation importContext. */ - public importContext?: (google.cloud.sql.v1beta4.IImportContext|null); - - /** Operation exportContext. */ - public exportContext?: (google.cloud.sql.v1beta4.IExportContext|null); - - /** Operation backupContext. */ - public backupContext?: (google.cloud.sql.v1beta4.IBackupContext|null); - - /** Operation preCheckMajorVersionUpgradeContext. */ - public preCheckMajorVersionUpgradeContext?: (google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null); - - /** Operation name. */ - public name: string; - - /** Operation targetId. */ - public targetId: string; - - /** Operation selfLink. */ - public selfLink: string; - - /** Operation targetProject. */ - public targetProject: string; - - /** Operation acquireSsrsLeaseContext. */ - public acquireSsrsLeaseContext?: (google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null); - - /** Operation subOperationType. */ - public subOperationType?: (google.cloud.sql.v1beta4.ISqlSubOperationType|null); - - /** - * Creates a new Operation instance using the specified properties. - * @param [properties] Properties to set - * @returns Operation instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IOperation): google.cloud.sql.v1beta4.Operation; - - /** - * Encodes the specified Operation message. Does not implicitly {@link google.cloud.sql.v1beta4.Operation.verify|verify} messages. - * @param message Operation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Operation.verify|verify} messages. - * @param message Operation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IOperation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Operation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Operation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Operation; - - /** - * Decodes an Operation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Operation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Operation; - - /** - * Verifies an Operation message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an Operation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Operation - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Operation; - - /** - * Creates a plain object from an Operation message. Also converts values to other types if specified. - * @param message Operation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.Operation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Operation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Operation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Operation { - - /** SqlOperationType enum. */ - enum SqlOperationType { - SQL_OPERATION_TYPE_UNSPECIFIED = 0, - IMPORT = 1, - EXPORT = 2, - CREATE = 3, - UPDATE = 4, - DELETE = 5, - RESTART = 6, - BACKUP = 7, - SNAPSHOT = 8, - BACKUP_VOLUME = 9, - DELETE_VOLUME = 10, - RESTORE_VOLUME = 11, - INJECT_USER = 12, - CLONE = 14, - STOP_REPLICA = 15, - START_REPLICA = 16, - PROMOTE_REPLICA = 17, - CREATE_REPLICA = 18, - CREATE_USER = 19, - DELETE_USER = 20, - UPDATE_USER = 21, - CREATE_DATABASE = 22, - DELETE_DATABASE = 23, - UPDATE_DATABASE = 24, - FAILOVER = 25, - DELETE_BACKUP = 26, - RECREATE_REPLICA = 27, - TRUNCATE_LOG = 28, - DEMOTE_MASTER = 29, - MAINTENANCE = 30, - ENABLE_PRIVATE_IP = 31, - DEFER_MAINTENANCE = 32, - CREATE_CLONE = 33, - RESCHEDULE_MAINTENANCE = 34, - START_EXTERNAL_SYNC = 35, - LOG_CLEANUP = 36, - AUTO_RESTART = 37, - REENCRYPT = 38, - SWITCHOVER = 39, - UPDATE_BACKUP = 40, - ACQUIRE_SSRS_LEASE = 42, - RELEASE_SSRS_LEASE = 43, - RECONFIGURE_OLD_PRIMARY = 44, - CLUSTER_MAINTENANCE = 45, - SELF_SERVICE_MAINTENANCE = 46, - SWITCHOVER_TO_REPLICA = 47, - MAJOR_VERSION_UPGRADE = 48, - ADVANCED_BACKUP = 49, - MANAGE_BACKUP = 50, - ENHANCED_BACKUP = 51, - REPAIR_READ_POOL = 52, - CREATE_READ_POOL = 53 - } - - /** SqlOperationStatus enum. */ - enum SqlOperationStatus { - SQL_OPERATION_STATUS_UNSPECIFIED = 0, - PENDING = 1, - RUNNING = 2, - DONE = 3 - } - } - - /** Properties of an OperationError. */ - interface IOperationError { - - /** OperationError kind */ - kind?: (string|null); - - /** OperationError code */ - code?: (string|null); - - /** OperationError message */ - message?: (string|null); - } - - /** Represents an OperationError. */ - class OperationError implements IOperationError { - - /** - * Constructs a new OperationError. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IOperationError); - - /** OperationError kind. */ - public kind: string; - - /** OperationError code. */ - public code: string; - - /** OperationError message. */ - public message: string; - - /** - * Creates a new OperationError instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationError instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IOperationError): google.cloud.sql.v1beta4.OperationError; - - /** - * Encodes the specified OperationError message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationError.verify|verify} messages. - * @param message OperationError message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationError.verify|verify} messages. - * @param message OperationError message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IOperationError, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OperationError message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OperationError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.OperationError; - - /** - * Decodes an OperationError message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OperationError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.OperationError; - - /** - * Verifies an OperationError message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OperationError message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationError - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.OperationError; - - /** - * Creates a plain object from an OperationError message. Also converts values to other types if specified. - * @param message OperationError - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.OperationError, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationError to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationError - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an OperationErrors. */ - interface IOperationErrors { - - /** OperationErrors kind */ - kind?: (string|null); - - /** OperationErrors errors */ - errors?: (google.cloud.sql.v1beta4.IOperationError[]|null); - } - - /** Represents an OperationErrors. */ - class OperationErrors implements IOperationErrors { - - /** - * Constructs a new OperationErrors. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IOperationErrors); - - /** OperationErrors kind. */ - public kind: string; - - /** OperationErrors errors. */ - public errors: google.cloud.sql.v1beta4.IOperationError[]; - - /** - * Creates a new OperationErrors instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationErrors instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IOperationErrors): google.cloud.sql.v1beta4.OperationErrors; - - /** - * Encodes the specified OperationErrors message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationErrors.verify|verify} messages. - * @param message OperationErrors message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IOperationErrors, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationErrors message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationErrors.verify|verify} messages. - * @param message OperationErrors message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IOperationErrors, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OperationErrors message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OperationErrors - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.OperationErrors; - - /** - * Decodes an OperationErrors message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OperationErrors - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.OperationErrors; - - /** - * Verifies an OperationErrors message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OperationErrors message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationErrors - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.OperationErrors; - - /** - * Creates a plain object from an OperationErrors message. Also converts values to other types if specified. - * @param message OperationErrors - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.OperationErrors, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationErrors to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationErrors - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PasswordValidationPolicy. */ - interface IPasswordValidationPolicy { - - /** PasswordValidationPolicy minLength */ - minLength?: (google.protobuf.IInt32Value|null); - - /** PasswordValidationPolicy complexity */ - complexity?: (google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity|keyof typeof google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity|null); - - /** PasswordValidationPolicy reuseInterval */ - reuseInterval?: (google.protobuf.IInt32Value|null); - - /** PasswordValidationPolicy disallowUsernameSubstring */ - disallowUsernameSubstring?: (google.protobuf.IBoolValue|null); - - /** PasswordValidationPolicy passwordChangeInterval */ - passwordChangeInterval?: (google.protobuf.IDuration|null); - - /** PasswordValidationPolicy enablePasswordPolicy */ - enablePasswordPolicy?: (google.protobuf.IBoolValue|null); - - /** PasswordValidationPolicy disallowCompromisedCredentials */ - disallowCompromisedCredentials?: (google.protobuf.IBoolValue|null); - } - - /** Represents a PasswordValidationPolicy. */ - class PasswordValidationPolicy implements IPasswordValidationPolicy { - - /** - * Constructs a new PasswordValidationPolicy. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IPasswordValidationPolicy); - - /** PasswordValidationPolicy minLength. */ - public minLength?: (google.protobuf.IInt32Value|null); - - /** PasswordValidationPolicy complexity. */ - public complexity: (google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity|keyof typeof google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity); - - /** PasswordValidationPolicy reuseInterval. */ - public reuseInterval?: (google.protobuf.IInt32Value|null); - - /** PasswordValidationPolicy disallowUsernameSubstring. */ - public disallowUsernameSubstring?: (google.protobuf.IBoolValue|null); - - /** PasswordValidationPolicy passwordChangeInterval. */ - public passwordChangeInterval?: (google.protobuf.IDuration|null); - - /** PasswordValidationPolicy enablePasswordPolicy. */ - public enablePasswordPolicy?: (google.protobuf.IBoolValue|null); - - /** PasswordValidationPolicy disallowCompromisedCredentials. */ - public disallowCompromisedCredentials?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new PasswordValidationPolicy instance using the specified properties. - * @param [properties] Properties to set - * @returns PasswordValidationPolicy instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IPasswordValidationPolicy): google.cloud.sql.v1beta4.PasswordValidationPolicy; - - /** - * Encodes the specified PasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordValidationPolicy.verify|verify} messages. - * @param message PasswordValidationPolicy message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordValidationPolicy.verify|verify} messages. - * @param message PasswordValidationPolicy message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PasswordValidationPolicy message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PasswordValidationPolicy; - - /** - * Decodes a PasswordValidationPolicy message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PasswordValidationPolicy; - - /** - * Verifies a PasswordValidationPolicy message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PasswordValidationPolicy - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PasswordValidationPolicy; - - /** - * Creates a plain object from a PasswordValidationPolicy message. Also converts values to other types if specified. - * @param message PasswordValidationPolicy - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.PasswordValidationPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PasswordValidationPolicy to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PasswordValidationPolicy - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace PasswordValidationPolicy { - - /** Complexity enum. */ - enum Complexity { - COMPLEXITY_UNSPECIFIED = 0, - COMPLEXITY_DEFAULT = 1 - } - } - - /** Properties of an OperationsListResponse. */ - interface IOperationsListResponse { - - /** OperationsListResponse kind */ - kind?: (string|null); - - /** OperationsListResponse items */ - items?: (google.cloud.sql.v1beta4.IOperation[]|null); - - /** OperationsListResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents an OperationsListResponse. */ - class OperationsListResponse implements IOperationsListResponse { - - /** - * Constructs a new OperationsListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IOperationsListResponse); - - /** OperationsListResponse kind. */ - public kind: string; - - /** OperationsListResponse items. */ - public items: google.cloud.sql.v1beta4.IOperation[]; - - /** OperationsListResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new OperationsListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns OperationsListResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IOperationsListResponse): google.cloud.sql.v1beta4.OperationsListResponse; - - /** - * Encodes the specified OperationsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationsListResponse.verify|verify} messages. - * @param message OperationsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IOperationsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OperationsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationsListResponse.verify|verify} messages. - * @param message OperationsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IOperationsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OperationsListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OperationsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.OperationsListResponse; - - /** - * Decodes an OperationsListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OperationsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.OperationsListResponse; - - /** - * Verifies an OperationsListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OperationsListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OperationsListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.OperationsListResponse; - - /** - * Creates a plain object from an OperationsListResponse message. Also converts values to other types if specified. - * @param message OperationsListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.OperationsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OperationsListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OperationsListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ReplicaConfiguration. */ - interface IReplicaConfiguration { - - /** ReplicaConfiguration kind */ - kind?: (string|null); - - /** ReplicaConfiguration mysqlReplicaConfiguration */ - mysqlReplicaConfiguration?: (google.cloud.sql.v1beta4.IMySqlReplicaConfiguration|null); - - /** ReplicaConfiguration failoverTarget */ - failoverTarget?: (google.protobuf.IBoolValue|null); - - /** ReplicaConfiguration cascadableReplica */ - cascadableReplica?: (google.protobuf.IBoolValue|null); - } - - /** Represents a ReplicaConfiguration. */ - class ReplicaConfiguration implements IReplicaConfiguration { - - /** - * Constructs a new ReplicaConfiguration. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IReplicaConfiguration); - - /** ReplicaConfiguration kind. */ - public kind: string; - - /** ReplicaConfiguration mysqlReplicaConfiguration. */ - public mysqlReplicaConfiguration?: (google.cloud.sql.v1beta4.IMySqlReplicaConfiguration|null); - - /** ReplicaConfiguration failoverTarget. */ - public failoverTarget?: (google.protobuf.IBoolValue|null); - - /** ReplicaConfiguration cascadableReplica. */ - public cascadableReplica?: (google.protobuf.IBoolValue|null); - - /** - * Creates a new ReplicaConfiguration instance using the specified properties. - * @param [properties] Properties to set - * @returns ReplicaConfiguration instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IReplicaConfiguration): google.cloud.sql.v1beta4.ReplicaConfiguration; - - /** - * Encodes the specified ReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicaConfiguration.verify|verify} messages. - * @param message ReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicaConfiguration.verify|verify} messages. - * @param message ReplicaConfiguration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IReplicaConfiguration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReplicaConfiguration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ReplicaConfiguration; - - /** - * Decodes a ReplicaConfiguration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ReplicaConfiguration; - - /** - * Verifies a ReplicaConfiguration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReplicaConfiguration - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ReplicaConfiguration; - - /** - * Creates a plain object from a ReplicaConfiguration message. Also converts values to other types if specified. - * @param message ReplicaConfiguration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ReplicaConfiguration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReplicaConfiguration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReplicaConfiguration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RestoreBackupContext. */ - interface IRestoreBackupContext { - - /** RestoreBackupContext kind */ - kind?: (string|null); - - /** RestoreBackupContext backupRunId */ - backupRunId?: (number|Long|string|null); - - /** RestoreBackupContext instanceId */ - instanceId?: (string|null); - - /** RestoreBackupContext project */ - project?: (string|null); - } - - /** Represents a RestoreBackupContext. */ - class RestoreBackupContext implements IRestoreBackupContext { - - /** - * Constructs a new RestoreBackupContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IRestoreBackupContext); - - /** RestoreBackupContext kind. */ - public kind: string; - - /** RestoreBackupContext backupRunId. */ - public backupRunId: (number|Long|string); - - /** RestoreBackupContext instanceId. */ - public instanceId: string; - - /** RestoreBackupContext project. */ - public project: string; - - /** - * Creates a new RestoreBackupContext instance using the specified properties. - * @param [properties] Properties to set - * @returns RestoreBackupContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IRestoreBackupContext): google.cloud.sql.v1beta4.RestoreBackupContext; - - /** - * Encodes the specified RestoreBackupContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RestoreBackupContext.verify|verify} messages. - * @param message RestoreBackupContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IRestoreBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RestoreBackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RestoreBackupContext.verify|verify} messages. - * @param message RestoreBackupContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IRestoreBackupContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RestoreBackupContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RestoreBackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.RestoreBackupContext; - - /** - * Decodes a RestoreBackupContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RestoreBackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.RestoreBackupContext; - - /** - * Verifies a RestoreBackupContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RestoreBackupContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RestoreBackupContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.RestoreBackupContext; - - /** - * Creates a plain object from a RestoreBackupContext message. Also converts values to other types if specified. - * @param message RestoreBackupContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.RestoreBackupContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RestoreBackupContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RestoreBackupContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RotateServerCaContext. */ - interface IRotateServerCaContext { - - /** RotateServerCaContext kind */ - kind?: (string|null); - - /** RotateServerCaContext nextVersion */ - nextVersion?: (string|null); - } - - /** Represents a RotateServerCaContext. */ - class RotateServerCaContext implements IRotateServerCaContext { - - /** - * Constructs a new RotateServerCaContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IRotateServerCaContext); - - /** RotateServerCaContext kind. */ - public kind: string; - - /** RotateServerCaContext nextVersion. */ - public nextVersion: string; - - /** - * Creates a new RotateServerCaContext instance using the specified properties. - * @param [properties] Properties to set - * @returns RotateServerCaContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IRotateServerCaContext): google.cloud.sql.v1beta4.RotateServerCaContext; - - /** - * Encodes the specified RotateServerCaContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCaContext.verify|verify} messages. - * @param message RotateServerCaContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IRotateServerCaContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RotateServerCaContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCaContext.verify|verify} messages. - * @param message RotateServerCaContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IRotateServerCaContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RotateServerCaContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RotateServerCaContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.RotateServerCaContext; - - /** - * Decodes a RotateServerCaContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RotateServerCaContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.RotateServerCaContext; - - /** - * Verifies a RotateServerCaContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RotateServerCaContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RotateServerCaContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.RotateServerCaContext; - - /** - * Creates a plain object from a RotateServerCaContext message. Also converts values to other types if specified. - * @param message RotateServerCaContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.RotateServerCaContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RotateServerCaContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RotateServerCaContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RotateServerCertificateContext. */ - interface IRotateServerCertificateContext { - - /** RotateServerCertificateContext kind */ - kind?: (string|null); - - /** RotateServerCertificateContext nextVersion */ - nextVersion?: (string|null); - } - - /** Represents a RotateServerCertificateContext. */ - class RotateServerCertificateContext implements IRotateServerCertificateContext { - - /** - * Constructs a new RotateServerCertificateContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IRotateServerCertificateContext); - - /** RotateServerCertificateContext kind. */ - public kind: string; - - /** RotateServerCertificateContext nextVersion. */ - public nextVersion: string; - - /** - * Creates a new RotateServerCertificateContext instance using the specified properties. - * @param [properties] Properties to set - * @returns RotateServerCertificateContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IRotateServerCertificateContext): google.cloud.sql.v1beta4.RotateServerCertificateContext; - - /** - * Encodes the specified RotateServerCertificateContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCertificateContext.verify|verify} messages. - * @param message RotateServerCertificateContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IRotateServerCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RotateServerCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCertificateContext.verify|verify} messages. - * @param message RotateServerCertificateContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IRotateServerCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RotateServerCertificateContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RotateServerCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.RotateServerCertificateContext; - - /** - * Decodes a RotateServerCertificateContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RotateServerCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.RotateServerCertificateContext; - - /** - * Verifies a RotateServerCertificateContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RotateServerCertificateContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RotateServerCertificateContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.RotateServerCertificateContext; - - /** - * Creates a plain object from a RotateServerCertificateContext message. Also converts values to other types if specified. - * @param message RotateServerCertificateContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.RotateServerCertificateContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RotateServerCertificateContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RotateServerCertificateContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RotateEntraIdCertificateContext. */ - interface IRotateEntraIdCertificateContext { - - /** RotateEntraIdCertificateContext kind */ - kind?: (string|null); - - /** RotateEntraIdCertificateContext nextVersion */ - nextVersion?: (string|null); - } - - /** Represents a RotateEntraIdCertificateContext. */ - class RotateEntraIdCertificateContext implements IRotateEntraIdCertificateContext { - - /** - * Constructs a new RotateEntraIdCertificateContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext); - - /** RotateEntraIdCertificateContext kind. */ - public kind: string; - - /** RotateEntraIdCertificateContext nextVersion. */ - public nextVersion: string; - - /** - * Creates a new RotateEntraIdCertificateContext instance using the specified properties. - * @param [properties] Properties to set - * @returns RotateEntraIdCertificateContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext): google.cloud.sql.v1beta4.RotateEntraIdCertificateContext; - - /** - * Encodes the specified RotateEntraIdCertificateContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.verify|verify} messages. - * @param message RotateEntraIdCertificateContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RotateEntraIdCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.verify|verify} messages. - * @param message RotateEntraIdCertificateContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RotateEntraIdCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.RotateEntraIdCertificateContext; - - /** - * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RotateEntraIdCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.RotateEntraIdCertificateContext; - - /** - * Verifies a RotateEntraIdCertificateContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RotateEntraIdCertificateContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RotateEntraIdCertificateContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.RotateEntraIdCertificateContext; - - /** - * Creates a plain object from a RotateEntraIdCertificateContext message. Also converts values to other types if specified. - * @param message RotateEntraIdCertificateContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.RotateEntraIdCertificateContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RotateEntraIdCertificateContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RotateEntraIdCertificateContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DataCacheConfig. */ - interface IDataCacheConfig { - - /** DataCacheConfig dataCacheEnabled */ - dataCacheEnabled?: (boolean|null); - } - - /** Represents a DataCacheConfig. */ - class DataCacheConfig implements IDataCacheConfig { - - /** - * Constructs a new DataCacheConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IDataCacheConfig); - - /** DataCacheConfig dataCacheEnabled. */ - public dataCacheEnabled: boolean; - - /** - * Creates a new DataCacheConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns DataCacheConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IDataCacheConfig): google.cloud.sql.v1beta4.DataCacheConfig; - - /** - * Encodes the specified DataCacheConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.DataCacheConfig.verify|verify} messages. - * @param message DataCacheConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IDataCacheConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DataCacheConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DataCacheConfig.verify|verify} messages. - * @param message DataCacheConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IDataCacheConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DataCacheConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DataCacheConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.DataCacheConfig; - - /** - * Decodes a DataCacheConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DataCacheConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.DataCacheConfig; - - /** - * Verifies a DataCacheConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DataCacheConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DataCacheConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.DataCacheConfig; - - /** - * Creates a plain object from a DataCacheConfig message. Also converts values to other types if specified. - * @param message DataCacheConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.DataCacheConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DataCacheConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DataCacheConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FinalBackupConfig. */ - interface IFinalBackupConfig { - - /** FinalBackupConfig enabled */ - enabled?: (boolean|null); - - /** FinalBackupConfig retentionDays */ - retentionDays?: (number|null); - } - - /** Represents a FinalBackupConfig. */ - class FinalBackupConfig implements IFinalBackupConfig { - - /** - * Constructs a new FinalBackupConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IFinalBackupConfig); - - /** FinalBackupConfig enabled. */ - public enabled?: (boolean|null); - - /** FinalBackupConfig retentionDays. */ - public retentionDays?: (number|null); - - /** - * Creates a new FinalBackupConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns FinalBackupConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IFinalBackupConfig): google.cloud.sql.v1beta4.FinalBackupConfig; - - /** - * Encodes the specified FinalBackupConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.FinalBackupConfig.verify|verify} messages. - * @param message FinalBackupConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IFinalBackupConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FinalBackupConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FinalBackupConfig.verify|verify} messages. - * @param message FinalBackupConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IFinalBackupConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FinalBackupConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FinalBackupConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.FinalBackupConfig; - - /** - * Decodes a FinalBackupConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FinalBackupConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.FinalBackupConfig; - - /** - * Verifies a FinalBackupConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FinalBackupConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FinalBackupConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.FinalBackupConfig; - - /** - * Creates a plain object from a FinalBackupConfig message. Also converts values to other types if specified. - * @param message FinalBackupConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.FinalBackupConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FinalBackupConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FinalBackupConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Settings. */ - interface ISettings { - - /** Settings settingsVersion */ - settingsVersion?: (google.protobuf.IInt64Value|null); - - /** Settings authorizedGaeApplications */ - authorizedGaeApplications?: (string[]|null); - - /** Settings tier */ - tier?: (string|null); - - /** Settings kind */ - kind?: (string|null); - - /** Settings userLabels */ - userLabels?: ({ [k: string]: string }|null); - - /** Settings availabilityType */ - availabilityType?: (google.cloud.sql.v1beta4.SqlAvailabilityType|keyof typeof google.cloud.sql.v1beta4.SqlAvailabilityType|null); - - /** Settings pricingPlan */ - pricingPlan?: (google.cloud.sql.v1beta4.SqlPricingPlan|keyof typeof google.cloud.sql.v1beta4.SqlPricingPlan|null); - - /** Settings replicationType */ - replicationType?: (google.cloud.sql.v1beta4.SqlReplicationType|keyof typeof google.cloud.sql.v1beta4.SqlReplicationType|null); - - /** Settings storageAutoResizeLimit */ - storageAutoResizeLimit?: (google.protobuf.IInt64Value|null); - - /** Settings activationPolicy */ - activationPolicy?: (google.cloud.sql.v1beta4.Settings.SqlActivationPolicy|keyof typeof google.cloud.sql.v1beta4.Settings.SqlActivationPolicy|null); - - /** Settings ipConfiguration */ - ipConfiguration?: (google.cloud.sql.v1beta4.IIpConfiguration|null); - - /** Settings storageAutoResize */ - storageAutoResize?: (google.protobuf.IBoolValue|null); - - /** Settings locationPreference */ - locationPreference?: (google.cloud.sql.v1beta4.ILocationPreference|null); - - /** Settings databaseFlags */ - databaseFlags?: (google.cloud.sql.v1beta4.IDatabaseFlags[]|null); - - /** Settings dataDiskType */ - dataDiskType?: (google.cloud.sql.v1beta4.SqlDataDiskType|keyof typeof google.cloud.sql.v1beta4.SqlDataDiskType|null); - - /** Settings maintenanceWindow */ - maintenanceWindow?: (google.cloud.sql.v1beta4.IMaintenanceWindow|null); - - /** Settings backupConfiguration */ - backupConfiguration?: (google.cloud.sql.v1beta4.IBackupConfiguration|null); - - /** Settings databaseReplicationEnabled */ - databaseReplicationEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings crashSafeReplicationEnabled */ - crashSafeReplicationEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings dataDiskSizeGb */ - dataDiskSizeGb?: (google.protobuf.IInt64Value|null); - - /** Settings activeDirectoryConfig */ - activeDirectoryConfig?: (google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig|null); - - /** Settings collation */ - collation?: (string|null); - - /** Settings denyMaintenancePeriods */ - denyMaintenancePeriods?: (google.cloud.sql.v1beta4.IDenyMaintenancePeriod[]|null); - - /** Settings insightsConfig */ - insightsConfig?: (google.cloud.sql.v1beta4.IInsightsConfig|null); - - /** Settings passwordValidationPolicy */ - passwordValidationPolicy?: (google.cloud.sql.v1beta4.IPasswordValidationPolicy|null); - - /** Settings sqlServerAuditConfig */ - sqlServerAuditConfig?: (google.cloud.sql.v1beta4.ISqlServerAuditConfig|null); - - /** Settings edition */ - edition?: (google.cloud.sql.v1beta4.Settings.Edition|keyof typeof google.cloud.sql.v1beta4.Settings.Edition|null); - - /** Settings connectorEnforcement */ - connectorEnforcement?: (google.cloud.sql.v1beta4.Settings.ConnectorEnforcement|keyof typeof google.cloud.sql.v1beta4.Settings.ConnectorEnforcement|null); - - /** Settings deletionProtectionEnabled */ - deletionProtectionEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings timeZone */ - timeZone?: (string|null); - - /** Settings advancedMachineFeatures */ - advancedMachineFeatures?: (google.cloud.sql.v1beta4.IAdvancedMachineFeatures|null); - - /** Settings dataCacheConfig */ - dataCacheConfig?: (google.cloud.sql.v1beta4.IDataCacheConfig|null); - - /** Settings replicationLagMaxSeconds */ - replicationLagMaxSeconds?: (google.protobuf.IInt32Value|null); - - /** Settings enableGoogleMlIntegration */ - enableGoogleMlIntegration?: (google.protobuf.IBoolValue|null); - - /** Settings enableDataplexIntegration */ - enableDataplexIntegration?: (google.protobuf.IBoolValue|null); - - /** Settings retainBackupsOnDelete */ - retainBackupsOnDelete?: (google.protobuf.IBoolValue|null); - - /** Settings dataDiskProvisionedIops */ - dataDiskProvisionedIops?: (number|Long|string|null); - - /** Settings dataDiskProvisionedThroughput */ - dataDiskProvisionedThroughput?: (number|Long|string|null); - - /** Settings connectionPoolConfig */ - connectionPoolConfig?: (google.cloud.sql.v1beta4.IConnectionPoolConfig|null); - - /** Settings finalBackupConfig */ - finalBackupConfig?: (google.cloud.sql.v1beta4.IFinalBackupConfig|null); - - /** Settings readPoolAutoScaleConfig */ - readPoolAutoScaleConfig?: (google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig|null); - - /** Settings autoUpgradeEnabled */ - autoUpgradeEnabled?: (boolean|null); - - /** Settings entraidConfig */ - entraidConfig?: (google.cloud.sql.v1beta4.ISqlServerEntraIdConfig|null); - - /** Settings dataApiAccess */ - dataApiAccess?: (google.cloud.sql.v1beta4.Settings.DataApiAccess|keyof typeof google.cloud.sql.v1beta4.Settings.DataApiAccess|null); - - /** Settings performanceCaptureConfig */ - performanceCaptureConfig?: (google.cloud.sql.v1beta4.IPerformanceCaptureConfig|null); - } - - /** Represents a Settings. */ - class Settings implements ISettings { - - /** - * Constructs a new Settings. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISettings); - - /** Settings settingsVersion. */ - public settingsVersion?: (google.protobuf.IInt64Value|null); - - /** Settings authorizedGaeApplications. */ - public authorizedGaeApplications: string[]; - - /** Settings tier. */ - public tier: string; - - /** Settings kind. */ - public kind: string; - - /** Settings userLabels. */ - public userLabels: { [k: string]: string }; - - /** Settings availabilityType. */ - public availabilityType: (google.cloud.sql.v1beta4.SqlAvailabilityType|keyof typeof google.cloud.sql.v1beta4.SqlAvailabilityType); - - /** Settings pricingPlan. */ - public pricingPlan: (google.cloud.sql.v1beta4.SqlPricingPlan|keyof typeof google.cloud.sql.v1beta4.SqlPricingPlan); - - /** Settings replicationType. */ - public replicationType: (google.cloud.sql.v1beta4.SqlReplicationType|keyof typeof google.cloud.sql.v1beta4.SqlReplicationType); - - /** Settings storageAutoResizeLimit. */ - public storageAutoResizeLimit?: (google.protobuf.IInt64Value|null); - - /** Settings activationPolicy. */ - public activationPolicy: (google.cloud.sql.v1beta4.Settings.SqlActivationPolicy|keyof typeof google.cloud.sql.v1beta4.Settings.SqlActivationPolicy); - - /** Settings ipConfiguration. */ - public ipConfiguration?: (google.cloud.sql.v1beta4.IIpConfiguration|null); - - /** Settings storageAutoResize. */ - public storageAutoResize?: (google.protobuf.IBoolValue|null); - - /** Settings locationPreference. */ - public locationPreference?: (google.cloud.sql.v1beta4.ILocationPreference|null); - - /** Settings databaseFlags. */ - public databaseFlags: google.cloud.sql.v1beta4.IDatabaseFlags[]; - - /** Settings dataDiskType. */ - public dataDiskType: (google.cloud.sql.v1beta4.SqlDataDiskType|keyof typeof google.cloud.sql.v1beta4.SqlDataDiskType); - - /** Settings maintenanceWindow. */ - public maintenanceWindow?: (google.cloud.sql.v1beta4.IMaintenanceWindow|null); - - /** Settings backupConfiguration. */ - public backupConfiguration?: (google.cloud.sql.v1beta4.IBackupConfiguration|null); - - /** Settings databaseReplicationEnabled. */ - public databaseReplicationEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings crashSafeReplicationEnabled. */ - public crashSafeReplicationEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings dataDiskSizeGb. */ - public dataDiskSizeGb?: (google.protobuf.IInt64Value|null); - - /** Settings activeDirectoryConfig. */ - public activeDirectoryConfig?: (google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig|null); - - /** Settings collation. */ - public collation: string; - - /** Settings denyMaintenancePeriods. */ - public denyMaintenancePeriods: google.cloud.sql.v1beta4.IDenyMaintenancePeriod[]; - - /** Settings insightsConfig. */ - public insightsConfig?: (google.cloud.sql.v1beta4.IInsightsConfig|null); - - /** Settings passwordValidationPolicy. */ - public passwordValidationPolicy?: (google.cloud.sql.v1beta4.IPasswordValidationPolicy|null); - - /** Settings sqlServerAuditConfig. */ - public sqlServerAuditConfig?: (google.cloud.sql.v1beta4.ISqlServerAuditConfig|null); - - /** Settings edition. */ - public edition: (google.cloud.sql.v1beta4.Settings.Edition|keyof typeof google.cloud.sql.v1beta4.Settings.Edition); - - /** Settings connectorEnforcement. */ - public connectorEnforcement: (google.cloud.sql.v1beta4.Settings.ConnectorEnforcement|keyof typeof google.cloud.sql.v1beta4.Settings.ConnectorEnforcement); - - /** Settings deletionProtectionEnabled. */ - public deletionProtectionEnabled?: (google.protobuf.IBoolValue|null); - - /** Settings timeZone. */ - public timeZone: string; - - /** Settings advancedMachineFeatures. */ - public advancedMachineFeatures?: (google.cloud.sql.v1beta4.IAdvancedMachineFeatures|null); - - /** Settings dataCacheConfig. */ - public dataCacheConfig?: (google.cloud.sql.v1beta4.IDataCacheConfig|null); - - /** Settings replicationLagMaxSeconds. */ - public replicationLagMaxSeconds?: (google.protobuf.IInt32Value|null); - - /** Settings enableGoogleMlIntegration. */ - public enableGoogleMlIntegration?: (google.protobuf.IBoolValue|null); - - /** Settings enableDataplexIntegration. */ - public enableDataplexIntegration?: (google.protobuf.IBoolValue|null); - - /** Settings retainBackupsOnDelete. */ - public retainBackupsOnDelete?: (google.protobuf.IBoolValue|null); - - /** Settings dataDiskProvisionedIops. */ - public dataDiskProvisionedIops?: (number|Long|string|null); - - /** Settings dataDiskProvisionedThroughput. */ - public dataDiskProvisionedThroughput?: (number|Long|string|null); - - /** Settings connectionPoolConfig. */ - public connectionPoolConfig?: (google.cloud.sql.v1beta4.IConnectionPoolConfig|null); - - /** Settings finalBackupConfig. */ - public finalBackupConfig?: (google.cloud.sql.v1beta4.IFinalBackupConfig|null); - - /** Settings readPoolAutoScaleConfig. */ - public readPoolAutoScaleConfig?: (google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig|null); - - /** Settings autoUpgradeEnabled. */ - public autoUpgradeEnabled?: (boolean|null); - - /** Settings entraidConfig. */ - public entraidConfig?: (google.cloud.sql.v1beta4.ISqlServerEntraIdConfig|null); - - /** Settings dataApiAccess. */ - public dataApiAccess?: (google.cloud.sql.v1beta4.Settings.DataApiAccess|keyof typeof google.cloud.sql.v1beta4.Settings.DataApiAccess|null); - - /** Settings performanceCaptureConfig. */ - public performanceCaptureConfig?: (google.cloud.sql.v1beta4.IPerformanceCaptureConfig|null); - - /** - * Creates a new Settings instance using the specified properties. - * @param [properties] Properties to set - * @returns Settings instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISettings): google.cloud.sql.v1beta4.Settings; - - /** - * Encodes the specified Settings message. Does not implicitly {@link google.cloud.sql.v1beta4.Settings.verify|verify} messages. - * @param message Settings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Settings.verify|verify} messages. - * @param message Settings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Settings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Settings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Settings; - - /** - * Decodes a Settings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Settings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Settings; - - /** - * Verifies a Settings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Settings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Settings - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Settings; - - /** - * Creates a plain object from a Settings message. Also converts values to other types if specified. - * @param message Settings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.Settings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Settings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Settings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Settings { - - /** SqlActivationPolicy enum. */ - enum SqlActivationPolicy { - SQL_ACTIVATION_POLICY_UNSPECIFIED = 0, - ALWAYS = 1, - NEVER = 2, - ON_DEMAND = 3 - } - - /** Edition enum. */ - enum Edition { - EDITION_UNSPECIFIED = 0, - ENTERPRISE = 2, - ENTERPRISE_PLUS = 3 - } - - /** ConnectorEnforcement enum. */ - enum ConnectorEnforcement { - CONNECTOR_ENFORCEMENT_UNSPECIFIED = 0, - NOT_REQUIRED = 1, - REQUIRED = 2 - } - - /** DataApiAccess enum. */ - enum DataApiAccess { - DATA_API_ACCESS_UNSPECIFIED = 0, - DISALLOW_DATA_API = 1, - ALLOW_DATA_API = 2 - } - } - - /** Properties of a PerformanceCaptureConfig. */ - interface IPerformanceCaptureConfig { - - /** PerformanceCaptureConfig enabled */ - enabled?: (boolean|null); - - /** PerformanceCaptureConfig probingIntervalSeconds */ - probingIntervalSeconds?: (number|null); - - /** PerformanceCaptureConfig probeThreshold */ - probeThreshold?: (number|null); - - /** PerformanceCaptureConfig runningThreadsThreshold */ - runningThreadsThreshold?: (number|null); - - /** PerformanceCaptureConfig secondsBehindSourceThreshold */ - secondsBehindSourceThreshold?: (number|null); - - /** PerformanceCaptureConfig transactionDurationThreshold */ - transactionDurationThreshold?: (number|null); - } - - /** Represents a PerformanceCaptureConfig. */ - class PerformanceCaptureConfig implements IPerformanceCaptureConfig { - - /** - * Constructs a new PerformanceCaptureConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IPerformanceCaptureConfig); - - /** PerformanceCaptureConfig enabled. */ - public enabled?: (boolean|null); - - /** PerformanceCaptureConfig probingIntervalSeconds. */ - public probingIntervalSeconds?: (number|null); - - /** PerformanceCaptureConfig probeThreshold. */ - public probeThreshold?: (number|null); - - /** PerformanceCaptureConfig runningThreadsThreshold. */ - public runningThreadsThreshold?: (number|null); - - /** PerformanceCaptureConfig secondsBehindSourceThreshold. */ - public secondsBehindSourceThreshold?: (number|null); - - /** PerformanceCaptureConfig transactionDurationThreshold. */ - public transactionDurationThreshold?: (number|null); - - /** - * Creates a new PerformanceCaptureConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns PerformanceCaptureConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IPerformanceCaptureConfig): google.cloud.sql.v1beta4.PerformanceCaptureConfig; - - /** - * Encodes the specified PerformanceCaptureConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PerformanceCaptureConfig.verify|verify} messages. - * @param message PerformanceCaptureConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IPerformanceCaptureConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PerformanceCaptureConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PerformanceCaptureConfig.verify|verify} messages. - * @param message PerformanceCaptureConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IPerformanceCaptureConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PerformanceCaptureConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PerformanceCaptureConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PerformanceCaptureConfig; - - /** - * Decodes a PerformanceCaptureConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PerformanceCaptureConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PerformanceCaptureConfig; - - /** - * Verifies a PerformanceCaptureConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PerformanceCaptureConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PerformanceCaptureConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PerformanceCaptureConfig; - - /** - * Creates a plain object from a PerformanceCaptureConfig message. Also converts values to other types if specified. - * @param message PerformanceCaptureConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.PerformanceCaptureConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PerformanceCaptureConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PerformanceCaptureConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an AdvancedMachineFeatures. */ - interface IAdvancedMachineFeatures { - - /** AdvancedMachineFeatures threadsPerCore */ - threadsPerCore?: (number|null); - } - - /** Represents an AdvancedMachineFeatures. */ - class AdvancedMachineFeatures implements IAdvancedMachineFeatures { - - /** - * Constructs a new AdvancedMachineFeatures. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IAdvancedMachineFeatures); - - /** AdvancedMachineFeatures threadsPerCore. */ - public threadsPerCore: number; - - /** - * Creates a new AdvancedMachineFeatures instance using the specified properties. - * @param [properties] Properties to set - * @returns AdvancedMachineFeatures instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IAdvancedMachineFeatures): google.cloud.sql.v1beta4.AdvancedMachineFeatures; - - /** - * Encodes the specified AdvancedMachineFeatures message. Does not implicitly {@link google.cloud.sql.v1beta4.AdvancedMachineFeatures.verify|verify} messages. - * @param message AdvancedMachineFeatures message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IAdvancedMachineFeatures, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AdvancedMachineFeatures message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AdvancedMachineFeatures.verify|verify} messages. - * @param message AdvancedMachineFeatures message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IAdvancedMachineFeatures, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AdvancedMachineFeatures message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AdvancedMachineFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.AdvancedMachineFeatures; - - /** - * Decodes an AdvancedMachineFeatures message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AdvancedMachineFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.AdvancedMachineFeatures; - - /** - * Verifies an AdvancedMachineFeatures message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an AdvancedMachineFeatures message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AdvancedMachineFeatures - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.AdvancedMachineFeatures; - - /** - * Creates a plain object from an AdvancedMachineFeatures message. Also converts values to other types if specified. - * @param message AdvancedMachineFeatures - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.AdvancedMachineFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AdvancedMachineFeatures to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AdvancedMachineFeatures - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCert. */ - interface ISslCert { - - /** SslCert kind */ - kind?: (string|null); - - /** SslCert certSerialNumber */ - certSerialNumber?: (string|null); - - /** SslCert cert */ - cert?: (string|null); - - /** SslCert createTime */ - createTime?: (google.protobuf.ITimestamp|null); - - /** SslCert commonName */ - commonName?: (string|null); - - /** SslCert expirationTime */ - expirationTime?: (google.protobuf.ITimestamp|null); - - /** SslCert sha1Fingerprint */ - sha1Fingerprint?: (string|null); - - /** SslCert instance */ - instance?: (string|null); - - /** SslCert selfLink */ - selfLink?: (string|null); - } - - /** Represents a SslCert. */ - class SslCert implements ISslCert { - - /** - * Constructs a new SslCert. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISslCert); - - /** SslCert kind. */ - public kind: string; - - /** SslCert certSerialNumber. */ - public certSerialNumber: string; - - /** SslCert cert. */ - public cert: string; - - /** SslCert createTime. */ - public createTime?: (google.protobuf.ITimestamp|null); - - /** SslCert commonName. */ - public commonName: string; - - /** SslCert expirationTime. */ - public expirationTime?: (google.protobuf.ITimestamp|null); - - /** SslCert sha1Fingerprint. */ - public sha1Fingerprint: string; - - /** SslCert instance. */ - public instance: string; - - /** SslCert selfLink. */ - public selfLink: string; - - /** - * Creates a new SslCert instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCert instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISslCert): google.cloud.sql.v1beta4.SslCert; - - /** - * Encodes the specified SslCert message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCert.verify|verify} messages. - * @param message SslCert message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISslCert, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCert message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCert.verify|verify} messages. - * @param message SslCert message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCert, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCert message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCert - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCert; - - /** - * Decodes a SslCert message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCert - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCert; - - /** - * Verifies a SslCert message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCert message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCert - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCert; - - /** - * Creates a plain object from a SslCert message. Also converts values to other types if specified. - * @param message SslCert - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SslCert, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCert to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCert - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCertDetail. */ - interface ISslCertDetail { - - /** SslCertDetail certInfo */ - certInfo?: (google.cloud.sql.v1beta4.ISslCert|null); - - /** SslCertDetail certPrivateKey */ - certPrivateKey?: (string|null); - } - - /** Represents a SslCertDetail. */ - class SslCertDetail implements ISslCertDetail { - - /** - * Constructs a new SslCertDetail. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISslCertDetail); - - /** SslCertDetail certInfo. */ - public certInfo?: (google.cloud.sql.v1beta4.ISslCert|null); - - /** SslCertDetail certPrivateKey. */ - public certPrivateKey: string; - - /** - * Creates a new SslCertDetail instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCertDetail instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISslCertDetail): google.cloud.sql.v1beta4.SslCertDetail; - - /** - * Encodes the specified SslCertDetail message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertDetail.verify|verify} messages. - * @param message SslCertDetail message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISslCertDetail, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCertDetail message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertDetail.verify|verify} messages. - * @param message SslCertDetail message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCertDetail, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCertDetail message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCertDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCertDetail; - - /** - * Decodes a SslCertDetail message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCertDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCertDetail; - - /** - * Verifies a SslCertDetail message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCertDetail message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCertDetail - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCertDetail; - - /** - * Creates a plain object from a SslCertDetail message. Also converts values to other types if specified. - * @param message SslCertDetail - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SslCertDetail, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCertDetail to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCertDetail - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCertsCreateEphemeralRequest. */ - interface ISslCertsCreateEphemeralRequest { - - /** SslCertsCreateEphemeralRequest publicKey */ - publicKey?: (string|null); - - /** SslCertsCreateEphemeralRequest accessToken */ - accessToken?: (string|null); - } - - /** Represents a SslCertsCreateEphemeralRequest. */ - class SslCertsCreateEphemeralRequest implements ISslCertsCreateEphemeralRequest { - - /** - * Constructs a new SslCertsCreateEphemeralRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest); - - /** SslCertsCreateEphemeralRequest publicKey. */ - public publicKey: string; - - /** SslCertsCreateEphemeralRequest accessToken. */ - public accessToken: string; - - /** - * Creates a new SslCertsCreateEphemeralRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCertsCreateEphemeralRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest): google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest; - - /** - * Encodes the specified SslCertsCreateEphemeralRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.verify|verify} messages. - * @param message SslCertsCreateEphemeralRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCertsCreateEphemeralRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.verify|verify} messages. - * @param message SslCertsCreateEphemeralRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCertsCreateEphemeralRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest; - - /** - * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCertsCreateEphemeralRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest; - - /** - * Verifies a SslCertsCreateEphemeralRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCertsCreateEphemeralRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCertsCreateEphemeralRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest; - - /** - * Creates a plain object from a SslCertsCreateEphemeralRequest message. Also converts values to other types if specified. - * @param message SslCertsCreateEphemeralRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCertsCreateEphemeralRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCertsCreateEphemeralRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCertsInsertRequest. */ - interface ISslCertsInsertRequest { - - /** SslCertsInsertRequest commonName */ - commonName?: (string|null); - } - - /** Represents a SslCertsInsertRequest. */ - class SslCertsInsertRequest implements ISslCertsInsertRequest { - - /** - * Constructs a new SslCertsInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISslCertsInsertRequest); - - /** SslCertsInsertRequest commonName. */ - public commonName: string; - - /** - * Creates a new SslCertsInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCertsInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISslCertsInsertRequest): google.cloud.sql.v1beta4.SslCertsInsertRequest; - - /** - * Encodes the specified SslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertRequest.verify|verify} messages. - * @param message SslCertsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertRequest.verify|verify} messages. - * @param message SslCertsInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCertsInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCertsInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCertsInsertRequest; - - /** - * Decodes a SslCertsInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCertsInsertRequest; - - /** - * Verifies a SslCertsInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCertsInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCertsInsertRequest; - - /** - * Creates a plain object from a SslCertsInsertRequest message. Also converts values to other types if specified. - * @param message SslCertsInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SslCertsInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCertsInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCertsInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlInstancesRescheduleMaintenanceRequestBody. */ - interface ISqlInstancesRescheduleMaintenanceRequestBody { - - /** SqlInstancesRescheduleMaintenanceRequestBody reschedule */ - reschedule?: (google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null); - } - - /** Represents a SqlInstancesRescheduleMaintenanceRequestBody. */ - class SqlInstancesRescheduleMaintenanceRequestBody implements ISqlInstancesRescheduleMaintenanceRequestBody { - - /** - * Constructs a new SqlInstancesRescheduleMaintenanceRequestBody. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody); - - /** SqlInstancesRescheduleMaintenanceRequestBody reschedule. */ - public reschedule?: (google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null); - - /** - * Creates a new SqlInstancesRescheduleMaintenanceRequestBody instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlInstancesRescheduleMaintenanceRequestBody instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. - * @param message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. - * @param message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlInstancesRescheduleMaintenanceRequestBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlInstancesRescheduleMaintenanceRequestBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody; - - /** - * Verifies a SqlInstancesRescheduleMaintenanceRequestBody message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlInstancesRescheduleMaintenanceRequestBody message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlInstancesRescheduleMaintenanceRequestBody - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody; - - /** - * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequestBody message. Also converts values to other types if specified. - * @param message SqlInstancesRescheduleMaintenanceRequestBody - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlInstancesRescheduleMaintenanceRequestBody to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlInstancesRescheduleMaintenanceRequestBody - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlInstancesRescheduleMaintenanceRequestBody { - - /** RescheduleType enum. */ - enum RescheduleType { - RESCHEDULE_TYPE_UNSPECIFIED = 0, - IMMEDIATE = 1, - NEXT_AVAILABLE_WINDOW = 2, - SPECIFIC_TIME = 3 - } - - /** Properties of a Reschedule. */ - interface IReschedule { - - /** Reschedule rescheduleType */ - rescheduleType?: (google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|null); - - /** Reschedule scheduleTime */ - scheduleTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a Reschedule. */ - class Reschedule implements IReschedule { - - /** - * Constructs a new Reschedule. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule); - - /** Reschedule rescheduleType. */ - public rescheduleType: (google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|keyof typeof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType); - - /** Reschedule scheduleTime. */ - public scheduleTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new Reschedule instance using the specified properties. - * @param [properties] Properties to set - * @returns Reschedule instance - */ - public static create(properties?: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; - - /** - * Encodes the specified Reschedule message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. - * @param message Reschedule message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Reschedule message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. - * @param message Reschedule message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Reschedule message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Reschedule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; - - /** - * Decodes a Reschedule message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Reschedule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; - - /** - * Verifies a Reschedule message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Reschedule message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Reschedule - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule; - - /** - * Creates a plain object from a Reschedule message. Also converts values to other types if specified. - * @param message Reschedule - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Reschedule to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Reschedule - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a SslCertsInsertResponse. */ - interface ISslCertsInsertResponse { - - /** SslCertsInsertResponse kind */ - kind?: (string|null); - - /** SslCertsInsertResponse operation */ - operation?: (google.cloud.sql.v1beta4.IOperation|null); - - /** SslCertsInsertResponse serverCaCert */ - serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); - - /** SslCertsInsertResponse clientCert */ - clientCert?: (google.cloud.sql.v1beta4.ISslCertDetail|null); - } - - /** Represents a SslCertsInsertResponse. */ - class SslCertsInsertResponse implements ISslCertsInsertResponse { - - /** - * Constructs a new SslCertsInsertResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISslCertsInsertResponse); - - /** SslCertsInsertResponse kind. */ - public kind: string; - - /** SslCertsInsertResponse operation. */ - public operation?: (google.cloud.sql.v1beta4.IOperation|null); - - /** SslCertsInsertResponse serverCaCert. */ - public serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); - - /** SslCertsInsertResponse clientCert. */ - public clientCert?: (google.cloud.sql.v1beta4.ISslCertDetail|null); - - /** - * Creates a new SslCertsInsertResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCertsInsertResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISslCertsInsertResponse): google.cloud.sql.v1beta4.SslCertsInsertResponse; - - /** - * Encodes the specified SslCertsInsertResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertResponse.verify|verify} messages. - * @param message SslCertsInsertResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISslCertsInsertResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCertsInsertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertResponse.verify|verify} messages. - * @param message SslCertsInsertResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCertsInsertResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCertsInsertResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCertsInsertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCertsInsertResponse; - - /** - * Decodes a SslCertsInsertResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCertsInsertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCertsInsertResponse; - - /** - * Verifies a SslCertsInsertResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCertsInsertResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCertsInsertResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCertsInsertResponse; - - /** - * Creates a plain object from a SslCertsInsertResponse message. Also converts values to other types if specified. - * @param message SslCertsInsertResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SslCertsInsertResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCertsInsertResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCertsInsertResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SslCertsListResponse. */ - interface ISslCertsListResponse { - - /** SslCertsListResponse kind */ - kind?: (string|null); - - /** SslCertsListResponse items */ - items?: (google.cloud.sql.v1beta4.ISslCert[]|null); - } - - /** Represents a SslCertsListResponse. */ - class SslCertsListResponse implements ISslCertsListResponse { - - /** - * Constructs a new SslCertsListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISslCertsListResponse); - - /** SslCertsListResponse kind. */ - public kind: string; - - /** SslCertsListResponse items. */ - public items: google.cloud.sql.v1beta4.ISslCert[]; - - /** - * Creates a new SslCertsListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns SslCertsListResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISslCertsListResponse): google.cloud.sql.v1beta4.SslCertsListResponse; - - /** - * Encodes the specified SslCertsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsListResponse.verify|verify} messages. - * @param message SslCertsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISslCertsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SslCertsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsListResponse.verify|verify} messages. - * @param message SslCertsListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISslCertsListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SslCertsListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SslCertsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SslCertsListResponse; - - /** - * Decodes a SslCertsListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SslCertsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SslCertsListResponse; - - /** - * Verifies a SslCertsListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SslCertsListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SslCertsListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SslCertsListResponse; - - /** - * Creates a plain object from a SslCertsListResponse message. Also converts values to other types if specified. - * @param message SslCertsListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SslCertsListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SslCertsListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SslCertsListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TruncateLogContext. */ - interface ITruncateLogContext { - - /** TruncateLogContext kind */ - kind?: (string|null); - - /** TruncateLogContext logType */ - logType?: (string|null); - } - - /** Represents a TruncateLogContext. */ - class TruncateLogContext implements ITruncateLogContext { - - /** - * Constructs a new TruncateLogContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ITruncateLogContext); - - /** TruncateLogContext kind. */ - public kind: string; - - /** TruncateLogContext logType. */ - public logType: string; - - /** - * Creates a new TruncateLogContext instance using the specified properties. - * @param [properties] Properties to set - * @returns TruncateLogContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ITruncateLogContext): google.cloud.sql.v1beta4.TruncateLogContext; - - /** - * Encodes the specified TruncateLogContext message. Does not implicitly {@link google.cloud.sql.v1beta4.TruncateLogContext.verify|verify} messages. - * @param message TruncateLogContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ITruncateLogContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TruncateLogContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.TruncateLogContext.verify|verify} messages. - * @param message TruncateLogContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ITruncateLogContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TruncateLogContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TruncateLogContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.TruncateLogContext; - - /** - * Decodes a TruncateLogContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TruncateLogContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.TruncateLogContext; - - /** - * Verifies a TruncateLogContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a TruncateLogContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TruncateLogContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.TruncateLogContext; - - /** - * Creates a plain object from a TruncateLogContext message. Also converts values to other types if specified. - * @param message TruncateLogContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.TruncateLogContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TruncateLogContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TruncateLogContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlActiveDirectoryConfig. */ - interface ISqlActiveDirectoryConfig { - - /** SqlActiveDirectoryConfig kind */ - kind?: (string|null); - - /** SqlActiveDirectoryConfig domain */ - domain?: (string|null); - - /** SqlActiveDirectoryConfig mode */ - mode?: (google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode|keyof typeof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode|null); - - /** SqlActiveDirectoryConfig dnsServers */ - dnsServers?: (string[]|null); - - /** SqlActiveDirectoryConfig adminCredentialSecretName */ - adminCredentialSecretName?: (string|null); - - /** SqlActiveDirectoryConfig organizationalUnit */ - organizationalUnit?: (string|null); - } - - /** Represents a SqlActiveDirectoryConfig. */ - class SqlActiveDirectoryConfig implements ISqlActiveDirectoryConfig { - - /** - * Constructs a new SqlActiveDirectoryConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig); - - /** SqlActiveDirectoryConfig kind. */ - public kind: string; - - /** SqlActiveDirectoryConfig domain. */ - public domain: string; - - /** SqlActiveDirectoryConfig mode. */ - public mode: (google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode|keyof typeof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode); - - /** SqlActiveDirectoryConfig dnsServers. */ - public dnsServers: string[]; - - /** SqlActiveDirectoryConfig adminCredentialSecretName. */ - public adminCredentialSecretName: string; - - /** SqlActiveDirectoryConfig organizationalUnit. */ - public organizationalUnit: string; - - /** - * Creates a new SqlActiveDirectoryConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlActiveDirectoryConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig): google.cloud.sql.v1beta4.SqlActiveDirectoryConfig; - - /** - * Encodes the specified SqlActiveDirectoryConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.verify|verify} messages. - * @param message SqlActiveDirectoryConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlActiveDirectoryConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.verify|verify} messages. - * @param message SqlActiveDirectoryConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlActiveDirectoryConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlActiveDirectoryConfig; - - /** - * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlActiveDirectoryConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlActiveDirectoryConfig; - - /** - * Verifies a SqlActiveDirectoryConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlActiveDirectoryConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlActiveDirectoryConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlActiveDirectoryConfig; - - /** - * Creates a plain object from a SqlActiveDirectoryConfig message. Also converts values to other types if specified. - * @param message SqlActiveDirectoryConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlActiveDirectoryConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlActiveDirectoryConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlActiveDirectoryConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SqlActiveDirectoryConfig { - - /** ActiveDirectoryMode enum. */ - enum ActiveDirectoryMode { - ACTIVE_DIRECTORY_MODE_UNSPECIFIED = 0, - MANAGED_ACTIVE_DIRECTORY = 1, - SELF_MANAGED_ACTIVE_DIRECTORY = 2, - CUSTOMER_MANAGED_ACTIVE_DIRECTORY = 3 - } - } - - /** Properties of a SqlServerAuditConfig. */ - interface ISqlServerAuditConfig { - - /** SqlServerAuditConfig kind */ - kind?: (string|null); - - /** SqlServerAuditConfig bucket */ - bucket?: (string|null); - - /** SqlServerAuditConfig retentionInterval */ - retentionInterval?: (google.protobuf.IDuration|null); - - /** SqlServerAuditConfig uploadInterval */ - uploadInterval?: (google.protobuf.IDuration|null); - } - - /** Represents a SqlServerAuditConfig. */ - class SqlServerAuditConfig implements ISqlServerAuditConfig { - - /** - * Constructs a new SqlServerAuditConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlServerAuditConfig); - - /** SqlServerAuditConfig kind. */ - public kind: string; - - /** SqlServerAuditConfig bucket. */ - public bucket: string; - - /** SqlServerAuditConfig retentionInterval. */ - public retentionInterval?: (google.protobuf.IDuration|null); - - /** SqlServerAuditConfig uploadInterval. */ - public uploadInterval?: (google.protobuf.IDuration|null); - - /** - * Creates a new SqlServerAuditConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlServerAuditConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlServerAuditConfig): google.cloud.sql.v1beta4.SqlServerAuditConfig; - - /** - * Encodes the specified SqlServerAuditConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerAuditConfig.verify|verify} messages. - * @param message SqlServerAuditConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlServerAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlServerAuditConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerAuditConfig.verify|verify} messages. - * @param message SqlServerAuditConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlServerAuditConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlServerAuditConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlServerAuditConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlServerAuditConfig; - - /** - * Decodes a SqlServerAuditConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlServerAuditConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlServerAuditConfig; - - /** - * Verifies a SqlServerAuditConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlServerAuditConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlServerAuditConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlServerAuditConfig; - - /** - * Creates a plain object from a SqlServerAuditConfig message. Also converts values to other types if specified. - * @param message SqlServerAuditConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlServerAuditConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlServerAuditConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlServerAuditConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlServerEntraIdConfig. */ - interface ISqlServerEntraIdConfig { - - /** SqlServerEntraIdConfig kind */ - kind?: (string|null); - - /** SqlServerEntraIdConfig tenantId */ - tenantId?: (string|null); - - /** SqlServerEntraIdConfig applicationId */ - applicationId?: (string|null); - } - - /** Represents a SqlServerEntraIdConfig. */ - class SqlServerEntraIdConfig implements ISqlServerEntraIdConfig { - - /** - * Constructs a new SqlServerEntraIdConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlServerEntraIdConfig); - - /** SqlServerEntraIdConfig kind. */ - public kind: string; - - /** SqlServerEntraIdConfig tenantId. */ - public tenantId: string; - - /** SqlServerEntraIdConfig applicationId. */ - public applicationId: string; - - /** - * Creates a new SqlServerEntraIdConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlServerEntraIdConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlServerEntraIdConfig): google.cloud.sql.v1beta4.SqlServerEntraIdConfig; - - /** - * Encodes the specified SqlServerEntraIdConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerEntraIdConfig.verify|verify} messages. - * @param message SqlServerEntraIdConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlServerEntraIdConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlServerEntraIdConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerEntraIdConfig.verify|verify} messages. - * @param message SqlServerEntraIdConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlServerEntraIdConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlServerEntraIdConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlServerEntraIdConfig; - - /** - * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlServerEntraIdConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlServerEntraIdConfig; - - /** - * Verifies a SqlServerEntraIdConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlServerEntraIdConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlServerEntraIdConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlServerEntraIdConfig; - - /** - * Creates a plain object from a SqlServerEntraIdConfig message. Also converts values to other types if specified. - * @param message SqlServerEntraIdConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlServerEntraIdConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlServerEntraIdConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlServerEntraIdConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlBackupRunStatus enum. */ - enum SqlBackupRunStatus { - SQL_BACKUP_RUN_STATUS_UNSPECIFIED = 0, - ENQUEUED = 1, - OVERDUE = 2, - RUNNING = 3, - FAILED = 4, - SUCCESSFUL = 5, - SKIPPED = 6, - DELETION_PENDING = 7, - DELETION_FAILED = 8, - DELETED = 9 - } - - /** SqlBackupRunType enum. */ - enum SqlBackupRunType { - SQL_BACKUP_RUN_TYPE_UNSPECIFIED = 0, - AUTOMATED = 1, - ON_DEMAND = 2 - } - - /** SqlBackupKind enum. */ - enum SqlBackupKind { - SQL_BACKUP_KIND_UNSPECIFIED = 0, - SNAPSHOT = 1, - PHYSICAL = 2 - } - - /** SqlBackendType enum. */ - enum SqlBackendType { - SQL_BACKEND_TYPE_UNSPECIFIED = 0, - FIRST_GEN = 1, - SECOND_GEN = 2, - EXTERNAL = 3 - } - - /** SqlIpAddressType enum. */ - enum SqlIpAddressType { - SQL_IP_ADDRESS_TYPE_UNSPECIFIED = 0, - PRIMARY = 1, - OUTGOING = 2, - PRIVATE = 3, - MIGRATED_1ST_GEN = 4 - } - - /** SqlInstanceType enum. */ - enum SqlInstanceType { - SQL_INSTANCE_TYPE_UNSPECIFIED = 0, - CLOUD_SQL_INSTANCE = 1, - ON_PREMISES_INSTANCE = 2, - READ_REPLICA_INSTANCE = 3, - READ_POOL_INSTANCE = 5 - } - - /** Properties of a ConnectionPoolFlags. */ - interface IConnectionPoolFlags { - - /** ConnectionPoolFlags name */ - name?: (string|null); - - /** ConnectionPoolFlags value */ - value?: (string|null); - } - - /** Represents a ConnectionPoolFlags. */ - class ConnectionPoolFlags implements IConnectionPoolFlags { - - /** - * Constructs a new ConnectionPoolFlags. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IConnectionPoolFlags); - - /** ConnectionPoolFlags name. */ - public name: string; - - /** ConnectionPoolFlags value. */ - public value: string; - - /** - * Creates a new ConnectionPoolFlags instance using the specified properties. - * @param [properties] Properties to set - * @returns ConnectionPoolFlags instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IConnectionPoolFlags): google.cloud.sql.v1beta4.ConnectionPoolFlags; - - /** - * Encodes the specified ConnectionPoolFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolFlags.verify|verify} messages. - * @param message ConnectionPoolFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IConnectionPoolFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ConnectionPoolFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolFlags.verify|verify} messages. - * @param message ConnectionPoolFlags message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IConnectionPoolFlags, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ConnectionPoolFlags message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConnectionPoolFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ConnectionPoolFlags; - - /** - * Decodes a ConnectionPoolFlags message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConnectionPoolFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ConnectionPoolFlags; - - /** - * Verifies a ConnectionPoolFlags message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ConnectionPoolFlags message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConnectionPoolFlags - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ConnectionPoolFlags; - - /** - * Creates a plain object from a ConnectionPoolFlags message. Also converts values to other types if specified. - * @param message ConnectionPoolFlags - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ConnectionPoolFlags, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ConnectionPoolFlags to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ConnectionPoolFlags - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ReadPoolAutoScaleConfig. */ - interface IReadPoolAutoScaleConfig { - - /** ReadPoolAutoScaleConfig enabled */ - enabled?: (boolean|null); - - /** ReadPoolAutoScaleConfig minNodeCount */ - minNodeCount?: (number|null); - - /** ReadPoolAutoScaleConfig maxNodeCount */ - maxNodeCount?: (number|null); - - /** ReadPoolAutoScaleConfig targetMetrics */ - targetMetrics?: (google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric[]|null); - - /** ReadPoolAutoScaleConfig disableScaleIn */ - disableScaleIn?: (boolean|null); - - /** ReadPoolAutoScaleConfig scaleInCooldownSeconds */ - scaleInCooldownSeconds?: (number|null); - - /** ReadPoolAutoScaleConfig scaleOutCooldownSeconds */ - scaleOutCooldownSeconds?: (number|null); - } - - /** Represents a ReadPoolAutoScaleConfig. */ - class ReadPoolAutoScaleConfig implements IReadPoolAutoScaleConfig { - - /** - * Constructs a new ReadPoolAutoScaleConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig); - - /** ReadPoolAutoScaleConfig enabled. */ - public enabled?: (boolean|null); - - /** ReadPoolAutoScaleConfig minNodeCount. */ - public minNodeCount?: (number|null); - - /** ReadPoolAutoScaleConfig maxNodeCount. */ - public maxNodeCount?: (number|null); - - /** ReadPoolAutoScaleConfig targetMetrics. */ - public targetMetrics: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric[]; - - /** ReadPoolAutoScaleConfig disableScaleIn. */ - public disableScaleIn?: (boolean|null); - - /** ReadPoolAutoScaleConfig scaleInCooldownSeconds. */ - public scaleInCooldownSeconds?: (number|null); - - /** ReadPoolAutoScaleConfig scaleOutCooldownSeconds. */ - public scaleOutCooldownSeconds?: (number|null); - - /** - * Creates a new ReadPoolAutoScaleConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ReadPoolAutoScaleConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig; - - /** - * Encodes the specified ReadPoolAutoScaleConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.verify|verify} messages. - * @param message ReadPoolAutoScaleConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReadPoolAutoScaleConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.verify|verify} messages. - * @param message ReadPoolAutoScaleConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReadPoolAutoScaleConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig; - - /** - * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReadPoolAutoScaleConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig; - - /** - * Verifies a ReadPoolAutoScaleConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ReadPoolAutoScaleConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReadPoolAutoScaleConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig; - - /** - * Creates a plain object from a ReadPoolAutoScaleConfig message. Also converts values to other types if specified. - * @param message ReadPoolAutoScaleConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReadPoolAutoScaleConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReadPoolAutoScaleConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ReadPoolAutoScaleConfig { - - /** Properties of a TargetMetric. */ - interface ITargetMetric { - - /** TargetMetric metric */ - metric?: (string|null); - - /** TargetMetric targetValue */ - targetValue?: (number|null); - } - - /** Represents a TargetMetric. */ - class TargetMetric implements ITargetMetric { - - /** - * Constructs a new TargetMetric. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric); - - /** TargetMetric metric. */ - public metric?: (string|null); - - /** TargetMetric targetValue. */ - public targetValue?: (number|null); - - /** - * Creates a new TargetMetric instance using the specified properties. - * @param [properties] Properties to set - * @returns TargetMetric instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric; - - /** - * Encodes the specified TargetMetric message. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. - * @param message TargetMetric message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TargetMetric message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. - * @param message TargetMetric message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TargetMetric message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TargetMetric - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric; - - /** - * Decodes a TargetMetric message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TargetMetric - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric; - - /** - * Verifies a TargetMetric message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a TargetMetric message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TargetMetric - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric; - - /** - * Creates a plain object from a TargetMetric message. Also converts values to other types if specified. - * @param message TargetMetric - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TargetMetric to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TargetMetric - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a ConnectionPoolConfig. */ - interface IConnectionPoolConfig { - - /** ConnectionPoolConfig connectionPoolingEnabled */ - connectionPoolingEnabled?: (boolean|null); - - /** ConnectionPoolConfig flags */ - flags?: (google.cloud.sql.v1beta4.IConnectionPoolFlags[]|null); - - /** ConnectionPoolConfig poolerCount */ - poolerCount?: (number|null); - } - - /** Represents a ConnectionPoolConfig. */ - class ConnectionPoolConfig implements IConnectionPoolConfig { - - /** - * Constructs a new ConnectionPoolConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IConnectionPoolConfig); - - /** ConnectionPoolConfig connectionPoolingEnabled. */ - public connectionPoolingEnabled?: (boolean|null); - - /** ConnectionPoolConfig flags. */ - public flags: google.cloud.sql.v1beta4.IConnectionPoolFlags[]; - - /** ConnectionPoolConfig poolerCount. */ - public poolerCount?: (number|null); - - /** - * Creates a new ConnectionPoolConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ConnectionPoolConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IConnectionPoolConfig): google.cloud.sql.v1beta4.ConnectionPoolConfig; - - /** - * Encodes the specified ConnectionPoolConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolConfig.verify|verify} messages. - * @param message ConnectionPoolConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IConnectionPoolConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ConnectionPoolConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolConfig.verify|verify} messages. - * @param message ConnectionPoolConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IConnectionPoolConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ConnectionPoolConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConnectionPoolConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ConnectionPoolConfig; - - /** - * Decodes a ConnectionPoolConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConnectionPoolConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ConnectionPoolConfig; - - /** - * Verifies a ConnectionPoolConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ConnectionPoolConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConnectionPoolConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ConnectionPoolConfig; - - /** - * Creates a plain object from a ConnectionPoolConfig message. Also converts values to other types if specified. - * @param message ConnectionPoolConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ConnectionPoolConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ConnectionPoolConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ConnectionPoolConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlDatabaseVersion enum. */ - enum SqlDatabaseVersion { - SQL_DATABASE_VERSION_UNSPECIFIED = 0, - MYSQL_5_1 = 2, - MYSQL_5_5 = 3, - MYSQL_5_6 = 5, - MYSQL_5_7 = 6, - MYSQL_8_0 = 20, - MYSQL_8_0_18 = 41, - MYSQL_8_0_26 = 85, - MYSQL_8_0_27 = 111, - MYSQL_8_0_28 = 132, - MYSQL_8_0_29 = 148, - MYSQL_8_0_30 = 174, - MYSQL_8_0_31 = 197, - MYSQL_8_0_32 = 213, - MYSQL_8_0_33 = 238, - MYSQL_8_0_34 = 239, - MYSQL_8_0_35 = 240, - MYSQL_8_0_36 = 241, - MYSQL_8_0_37 = 355, - MYSQL_8_0_39 = 357, - MYSQL_8_0_40 = 358, - MYSQL_8_0_41 = 488, - MYSQL_8_0_42 = 489, - MYSQL_8_0_43 = 553, - MYSQL_8_0_44 = 554, - MYSQL_8_0_45 = 555, - MYSQL_8_0_46 = 556, - MYSQL_8_4 = 398, - MYSQL_9_7 = 654, - SQLSERVER_2017_STANDARD = 11, - SQLSERVER_2017_ENTERPRISE = 14, - SQLSERVER_2017_EXPRESS = 15, - SQLSERVER_2017_WEB = 16, - POSTGRES_9_6 = 9, - POSTGRES_10 = 18, - POSTGRES_11 = 10, - POSTGRES_12 = 19, - POSTGRES_13 = 23, - POSTGRES_14 = 110, - POSTGRES_15 = 172, - POSTGRES_16 = 272, - POSTGRES_17 = 408, - POSTGRES_18 = 557, - SQLSERVER_2019_STANDARD = 26, - SQLSERVER_2019_ENTERPRISE = 27, - SQLSERVER_2019_EXPRESS = 28, - SQLSERVER_2019_WEB = 29, - SQLSERVER_2022_STANDARD = 199, - SQLSERVER_2022_ENTERPRISE = 200, - SQLSERVER_2022_EXPRESS = 201, - SQLSERVER_2022_WEB = 202 - } - - /** SqlSuspensionReason enum. */ - enum SqlSuspensionReason { - SQL_SUSPENSION_REASON_UNSPECIFIED = 0, - BILLING_ISSUE = 2, - LEGAL_ISSUE = 3, - OPERATIONAL_ISSUE = 4, - KMS_KEY_ISSUE = 5 - } - - /** SqlPricingPlan enum. */ - enum SqlPricingPlan { - SQL_PRICING_PLAN_UNSPECIFIED = 0, - PACKAGE = 1, - PER_USE = 2 - } - - /** SqlReplicationType enum. */ - enum SqlReplicationType { - SQL_REPLICATION_TYPE_UNSPECIFIED = 0, - SYNCHRONOUS = 1, - ASYNCHRONOUS = 2 - } - - /** SqlDataDiskType enum. */ - enum SqlDataDiskType { - SQL_DATA_DISK_TYPE_UNSPECIFIED = 0, - PD_SSD = 1, - PD_HDD = 2, - OBSOLETE_LOCAL_SSD = 3, - HYPERDISK_BALANCED = 4 - } - - /** SqlAvailabilityType enum. */ - enum SqlAvailabilityType { - SQL_AVAILABILITY_TYPE_UNSPECIFIED = 0, - ZONAL = 1, - REGIONAL = 2 - } - - /** SqlUpdateTrack enum. */ - enum SqlUpdateTrack { - SQL_UPDATE_TRACK_UNSPECIFIED = 0, - canary = 1, - stable = 2, - week5 = 3 - } - - /** Properties of an AcquireSsrsLeaseContext. */ - interface IAcquireSsrsLeaseContext { - - /** AcquireSsrsLeaseContext setupLogin */ - setupLogin?: (string|null); - - /** AcquireSsrsLeaseContext serviceLogin */ - serviceLogin?: (string|null); - - /** AcquireSsrsLeaseContext reportDatabase */ - reportDatabase?: (string|null); - - /** AcquireSsrsLeaseContext duration */ - duration?: (google.protobuf.IDuration|null); - } - - /** Represents an AcquireSsrsLeaseContext. */ - class AcquireSsrsLeaseContext implements IAcquireSsrsLeaseContext { - - /** - * Constructs a new AcquireSsrsLeaseContext. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext); - - /** AcquireSsrsLeaseContext setupLogin. */ - public setupLogin?: (string|null); - - /** AcquireSsrsLeaseContext serviceLogin. */ - public serviceLogin?: (string|null); - - /** AcquireSsrsLeaseContext reportDatabase. */ - public reportDatabase?: (string|null); - - /** AcquireSsrsLeaseContext duration. */ - public duration?: (google.protobuf.IDuration|null); - - /** - * Creates a new AcquireSsrsLeaseContext instance using the specified properties. - * @param [properties] Properties to set - * @returns AcquireSsrsLeaseContext instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext): google.cloud.sql.v1beta4.AcquireSsrsLeaseContext; - - /** - * Encodes the specified AcquireSsrsLeaseContext message. Does not implicitly {@link google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify|verify} messages. - * @param message AcquireSsrsLeaseContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified AcquireSsrsLeaseContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify|verify} messages. - * @param message AcquireSsrsLeaseContext message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns AcquireSsrsLeaseContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.AcquireSsrsLeaseContext; - - /** - * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns AcquireSsrsLeaseContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.AcquireSsrsLeaseContext; - - /** - * Verifies an AcquireSsrsLeaseContext message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an AcquireSsrsLeaseContext message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns AcquireSsrsLeaseContext - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.AcquireSsrsLeaseContext; - - /** - * Creates a plain object from an AcquireSsrsLeaseContext message. Also converts values to other types if specified. - * @param message AcquireSsrsLeaseContext - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.AcquireSsrsLeaseContext, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this AcquireSsrsLeaseContext to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for AcquireSsrsLeaseContext - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** SqlFlagType enum. */ - enum SqlFlagType { - SQL_FLAG_TYPE_UNSPECIFIED = 0, - BOOLEAN = 1, - STRING = 2, - INTEGER = 3, - NONE = 4, - MYSQL_TIMEZONE_OFFSET = 5, - FLOAT = 6, - REPEATED_STRING = 7 - } - - /** SqlFlagScope enum. */ - enum SqlFlagScope { - SQL_FLAG_SCOPE_UNSPECIFIED = 0, - SQL_FLAG_SCOPE_DATABASE = 1, - SQL_FLAG_SCOPE_CONNECTION_POOL = 2 - } - - /** Represents a SqlConnectService */ - class SqlConnectService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlConnectService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlConnectService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlConnectService; - - /** - * Calls GetConnectSettings. - * @param request GetConnectSettingsRequest message or plain object - * @param callback Node-style callback called with the error, if any, and ConnectSettings - */ - public getConnectSettings(request: google.cloud.sql.v1beta4.IGetConnectSettingsRequest, callback: google.cloud.sql.v1beta4.SqlConnectService.GetConnectSettingsCallback): void; - - /** - * Calls GetConnectSettings. - * @param request GetConnectSettingsRequest message or plain object - * @returns Promise - */ - public getConnectSettings(request: google.cloud.sql.v1beta4.IGetConnectSettingsRequest): Promise; - - /** - * Calls GenerateEphemeralCert. - * @param request GenerateEphemeralCertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and GenerateEphemeralCertResponse - */ - public generateEphemeralCert(request: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, callback: google.cloud.sql.v1beta4.SqlConnectService.GenerateEphemeralCertCallback): void; - - /** - * Calls GenerateEphemeralCert. - * @param request GenerateEphemeralCertRequest message or plain object - * @returns Promise - */ - public generateEphemeralCert(request: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest): Promise; - } - - namespace SqlConnectService { - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlConnectService|getConnectSettings}. - * @param error Error, if any - * @param [response] ConnectSettings - */ - type GetConnectSettingsCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.ConnectSettings) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlConnectService|generateEphemeralCert}. - * @param error Error, if any - * @param [response] GenerateEphemeralCertResponse - */ - type GenerateEphemeralCertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.GenerateEphemeralCertResponse) => void; - } - - /** Properties of a GetConnectSettingsRequest. */ - interface IGetConnectSettingsRequest { - - /** GetConnectSettingsRequest instance */ - instance?: (string|null); - - /** GetConnectSettingsRequest project */ - project?: (string|null); - - /** GetConnectSettingsRequest readTime */ - readTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a GetConnectSettingsRequest. */ - class GetConnectSettingsRequest implements IGetConnectSettingsRequest { - - /** - * Constructs a new GetConnectSettingsRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IGetConnectSettingsRequest); - - /** GetConnectSettingsRequest instance. */ - public instance: string; - - /** GetConnectSettingsRequest project. */ - public project: string; - - /** GetConnectSettingsRequest readTime. */ - public readTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new GetConnectSettingsRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GetConnectSettingsRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IGetConnectSettingsRequest): google.cloud.sql.v1beta4.GetConnectSettingsRequest; - - /** - * Encodes the specified GetConnectSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GetConnectSettingsRequest.verify|verify} messages. - * @param message GetConnectSettingsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IGetConnectSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GetConnectSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GetConnectSettingsRequest.verify|verify} messages. - * @param message GetConnectSettingsRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IGetConnectSettingsRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GetConnectSettingsRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GetConnectSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.GetConnectSettingsRequest; - - /** - * Decodes a GetConnectSettingsRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GetConnectSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.GetConnectSettingsRequest; - - /** - * Verifies a GetConnectSettingsRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GetConnectSettingsRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GetConnectSettingsRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.GetConnectSettingsRequest; - - /** - * Creates a plain object from a GetConnectSettingsRequest message. Also converts values to other types if specified. - * @param message GetConnectSettingsRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.GetConnectSettingsRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GetConnectSettingsRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GetConnectSettingsRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ConnectSettings. */ - interface IConnectSettings { - - /** ConnectSettings kind */ - kind?: (string|null); - - /** ConnectSettings serverCaCert */ - serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); - - /** ConnectSettings ipAddresses */ - ipAddresses?: (google.cloud.sql.v1beta4.IIpMapping[]|null); - - /** ConnectSettings region */ - region?: (string|null); - - /** ConnectSettings databaseVersion */ - databaseVersion?: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion|null); - - /** ConnectSettings backendType */ - backendType?: (google.cloud.sql.v1beta4.SqlBackendType|keyof typeof google.cloud.sql.v1beta4.SqlBackendType|null); - - /** ConnectSettings pscEnabled */ - pscEnabled?: (boolean|null); - - /** ConnectSettings dnsName */ - dnsName?: (string|null); - - /** ConnectSettings serverCaMode */ - serverCaMode?: (google.cloud.sql.v1beta4.ConnectSettings.CaMode|keyof typeof google.cloud.sql.v1beta4.ConnectSettings.CaMode|null); - - /** ConnectSettings customSubjectAlternativeNames */ - customSubjectAlternativeNames?: (string[]|null); - - /** ConnectSettings dnsNames */ - dnsNames?: (google.cloud.sql.v1beta4.IDnsNameMapping[]|null); - - /** ConnectSettings nodeCount */ - nodeCount?: (number|null); - - /** ConnectSettings nodes */ - nodes?: (google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig[]|null); - - /** ConnectSettings mdxProtocolSupport */ - mdxProtocolSupport?: (google.cloud.sql.v1beta4.ConnectSettings.MdxProtocolSupport[]|null); - } - - /** Represents a ConnectSettings. */ - class ConnectSettings implements IConnectSettings { - - /** - * Constructs a new ConnectSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IConnectSettings); - - /** ConnectSettings kind. */ - public kind: string; - - /** ConnectSettings serverCaCert. */ - public serverCaCert?: (google.cloud.sql.v1beta4.ISslCert|null); - - /** ConnectSettings ipAddresses. */ - public ipAddresses: google.cloud.sql.v1beta4.IIpMapping[]; - - /** ConnectSettings region. */ - public region: string; - - /** ConnectSettings databaseVersion. */ - public databaseVersion: (google.cloud.sql.v1beta4.SqlDatabaseVersion|keyof typeof google.cloud.sql.v1beta4.SqlDatabaseVersion); - - /** ConnectSettings backendType. */ - public backendType: (google.cloud.sql.v1beta4.SqlBackendType|keyof typeof google.cloud.sql.v1beta4.SqlBackendType); - - /** ConnectSettings pscEnabled. */ - public pscEnabled: boolean; - - /** ConnectSettings dnsName. */ - public dnsName: string; - - /** ConnectSettings serverCaMode. */ - public serverCaMode: (google.cloud.sql.v1beta4.ConnectSettings.CaMode|keyof typeof google.cloud.sql.v1beta4.ConnectSettings.CaMode); - - /** ConnectSettings customSubjectAlternativeNames. */ - public customSubjectAlternativeNames: string[]; - - /** ConnectSettings dnsNames. */ - public dnsNames: google.cloud.sql.v1beta4.IDnsNameMapping[]; - - /** ConnectSettings nodeCount. */ - public nodeCount?: (number|null); - - /** ConnectSettings nodes. */ - public nodes: google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig[]; - - /** ConnectSettings mdxProtocolSupport. */ - public mdxProtocolSupport: google.cloud.sql.v1beta4.ConnectSettings.MdxProtocolSupport[]; - - /** - * Creates a new ConnectSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns ConnectSettings instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IConnectSettings): google.cloud.sql.v1beta4.ConnectSettings; - - /** - * Encodes the specified ConnectSettings message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.verify|verify} messages. - * @param message ConnectSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IConnectSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ConnectSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.verify|verify} messages. - * @param message ConnectSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IConnectSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ConnectSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConnectSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ConnectSettings; - - /** - * Decodes a ConnectSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConnectSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ConnectSettings; - - /** - * Verifies a ConnectSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ConnectSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConnectSettings - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ConnectSettings; - - /** - * Creates a plain object from a ConnectSettings message. Also converts values to other types if specified. - * @param message ConnectSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ConnectSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ConnectSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ConnectSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ConnectSettings { - - /** CaMode enum. */ - enum CaMode { - CA_MODE_UNSPECIFIED = 0, - GOOGLE_MANAGED_INTERNAL_CA = 1, - GOOGLE_MANAGED_CAS_CA = 2, - CUSTOMER_MANAGED_CAS_CA = 3 - } - - /** Properties of a ConnectPoolNodeConfig. */ - interface IConnectPoolNodeConfig { - - /** ConnectPoolNodeConfig name */ - name?: (string|null); - - /** ConnectPoolNodeConfig ipAddresses */ - ipAddresses?: (google.cloud.sql.v1beta4.IIpMapping[]|null); - - /** ConnectPoolNodeConfig dnsName */ - dnsName?: (string|null); - - /** ConnectPoolNodeConfig dnsNames */ - dnsNames?: (google.cloud.sql.v1beta4.IDnsNameMapping[]|null); - } - - /** Represents a ConnectPoolNodeConfig. */ - class ConnectPoolNodeConfig implements IConnectPoolNodeConfig { - - /** - * Constructs a new ConnectPoolNodeConfig. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig); - - /** ConnectPoolNodeConfig name. */ - public name?: (string|null); - - /** ConnectPoolNodeConfig ipAddresses. */ - public ipAddresses: google.cloud.sql.v1beta4.IIpMapping[]; - - /** ConnectPoolNodeConfig dnsName. */ - public dnsName?: (string|null); - - /** ConnectPoolNodeConfig dnsNames. */ - public dnsNames: google.cloud.sql.v1beta4.IDnsNameMapping[]; - - /** - * Creates a new ConnectPoolNodeConfig instance using the specified properties. - * @param [properties] Properties to set - * @returns ConnectPoolNodeConfig instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig): google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig; - - /** - * Encodes the specified ConnectPoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. - * @param message ConnectPoolNodeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ConnectPoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. - * @param message ConnectPoolNodeConfig message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ConnectPoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig; - - /** - * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ConnectPoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig; - - /** - * Verifies a ConnectPoolNodeConfig message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ConnectPoolNodeConfig message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ConnectPoolNodeConfig - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig; - - /** - * Creates a plain object from a ConnectPoolNodeConfig message. Also converts values to other types if specified. - * @param message ConnectPoolNodeConfig - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ConnectPoolNodeConfig to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ConnectPoolNodeConfig - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** MdxProtocolSupport enum. */ - enum MdxProtocolSupport { - MDX_PROTOCOL_SUPPORT_UNSPECIFIED = 0, - CLIENT_PROTOCOL_TYPE = 1 - } - } - - /** Properties of a GenerateEphemeralCertRequest. */ - interface IGenerateEphemeralCertRequest { - - /** GenerateEphemeralCertRequest instance */ - instance?: (string|null); - - /** GenerateEphemeralCertRequest project */ - project?: (string|null); - - /** GenerateEphemeralCertRequest publicKey */ - publicKey?: (string|null); - - /** GenerateEphemeralCertRequest accessToken */ - accessToken?: (string|null); - - /** GenerateEphemeralCertRequest readTime */ - readTime?: (google.protobuf.ITimestamp|null); - - /** GenerateEphemeralCertRequest validDuration */ - validDuration?: (google.protobuf.IDuration|null); - } - - /** Represents a GenerateEphemeralCertRequest. */ - class GenerateEphemeralCertRequest implements IGenerateEphemeralCertRequest { - - /** - * Constructs a new GenerateEphemeralCertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest); - - /** GenerateEphemeralCertRequest instance. */ - public instance: string; - - /** GenerateEphemeralCertRequest project. */ - public project: string; - - /** GenerateEphemeralCertRequest publicKey. */ - public publicKey: string; - - /** GenerateEphemeralCertRequest accessToken. */ - public accessToken: string; - - /** GenerateEphemeralCertRequest readTime. */ - public readTime?: (google.protobuf.ITimestamp|null); - - /** GenerateEphemeralCertRequest validDuration. */ - public validDuration?: (google.protobuf.IDuration|null); - - /** - * Creates a new GenerateEphemeralCertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns GenerateEphemeralCertRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest): google.cloud.sql.v1beta4.GenerateEphemeralCertRequest; - - /** - * Encodes the specified GenerateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.verify|verify} messages. - * @param message GenerateEphemeralCertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GenerateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.verify|verify} messages. - * @param message GenerateEphemeralCertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GenerateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.GenerateEphemeralCertRequest; - - /** - * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GenerateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.GenerateEphemeralCertRequest; - - /** - * Verifies a GenerateEphemeralCertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GenerateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GenerateEphemeralCertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.GenerateEphemeralCertRequest; - - /** - * Creates a plain object from a GenerateEphemeralCertRequest message. Also converts values to other types if specified. - * @param message GenerateEphemeralCertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.GenerateEphemeralCertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GenerateEphemeralCertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GenerateEphemeralCertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GenerateEphemeralCertResponse. */ - interface IGenerateEphemeralCertResponse { - - /** GenerateEphemeralCertResponse ephemeralCert */ - ephemeralCert?: (google.cloud.sql.v1beta4.ISslCert|null); - } - - /** Represents a GenerateEphemeralCertResponse. */ - class GenerateEphemeralCertResponse implements IGenerateEphemeralCertResponse { - - /** - * Constructs a new GenerateEphemeralCertResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse); - - /** GenerateEphemeralCertResponse ephemeralCert. */ - public ephemeralCert?: (google.cloud.sql.v1beta4.ISslCert|null); - - /** - * Creates a new GenerateEphemeralCertResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns GenerateEphemeralCertResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse): google.cloud.sql.v1beta4.GenerateEphemeralCertResponse; - - /** - * Encodes the specified GenerateEphemeralCertResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertResponse.verify|verify} messages. - * @param message GenerateEphemeralCertResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GenerateEphemeralCertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertResponse.verify|verify} messages. - * @param message GenerateEphemeralCertResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GenerateEphemeralCertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.GenerateEphemeralCertResponse; - - /** - * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GenerateEphemeralCertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.GenerateEphemeralCertResponse; - - /** - * Verifies a GenerateEphemeralCertResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GenerateEphemeralCertResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GenerateEphemeralCertResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.GenerateEphemeralCertResponse; - - /** - * Creates a plain object from a GenerateEphemeralCertResponse message. Also converts values to other types if specified. - * @param message GenerateEphemeralCertResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.GenerateEphemeralCertResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GenerateEphemeralCertResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GenerateEphemeralCertResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Represents a SqlIamPoliciesService */ - class SqlIamPoliciesService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlIamPoliciesService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlIamPoliciesService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlIamPoliciesService; - } - - /** Represents a SqlTiersService */ - class SqlTiersService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlTiersService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlTiersService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlTiersService; - - /** - * Calls List. - * @param request SqlTiersListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and TiersListResponse - */ - public list(request: google.cloud.sql.v1beta4.ISqlTiersListRequest, callback: google.cloud.sql.v1beta4.SqlTiersService.ListCallback): void; - - /** - * Calls List. - * @param request SqlTiersListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1beta4.ISqlTiersListRequest): Promise; - } - - namespace SqlTiersService { - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlTiersService|list}. - * @param error Error, if any - * @param [response] TiersListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.TiersListResponse) => void; - } - - /** Properties of a SqlTiersListRequest. */ - interface ISqlTiersListRequest { - - /** SqlTiersListRequest project */ - project?: (string|null); - } - - /** Represents a SqlTiersListRequest. */ - class SqlTiersListRequest implements ISqlTiersListRequest { - - /** - * Constructs a new SqlTiersListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlTiersListRequest); - - /** SqlTiersListRequest project. */ - public project: string; - - /** - * Creates a new SqlTiersListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlTiersListRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlTiersListRequest): google.cloud.sql.v1beta4.SqlTiersListRequest; - - /** - * Encodes the specified SqlTiersListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlTiersListRequest.verify|verify} messages. - * @param message SqlTiersListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlTiersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlTiersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlTiersListRequest.verify|verify} messages. - * @param message SqlTiersListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlTiersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlTiersListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlTiersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlTiersListRequest; - - /** - * Decodes a SqlTiersListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlTiersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlTiersListRequest; - - /** - * Verifies a SqlTiersListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlTiersListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlTiersListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlTiersListRequest; - - /** - * Creates a plain object from a SqlTiersListRequest message. Also converts values to other types if specified. - * @param message SqlTiersListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlTiersListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlTiersListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlTiersListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a TiersListResponse. */ - interface ITiersListResponse { - - /** TiersListResponse kind */ - kind?: (string|null); - - /** TiersListResponse items */ - items?: (google.cloud.sql.v1beta4.ITier[]|null); - } - - /** Represents a TiersListResponse. */ - class TiersListResponse implements ITiersListResponse { - - /** - * Constructs a new TiersListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ITiersListResponse); - - /** TiersListResponse kind. */ - public kind: string; - - /** TiersListResponse items. */ - public items: google.cloud.sql.v1beta4.ITier[]; - - /** - * Creates a new TiersListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns TiersListResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ITiersListResponse): google.cloud.sql.v1beta4.TiersListResponse; - - /** - * Encodes the specified TiersListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.TiersListResponse.verify|verify} messages. - * @param message TiersListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ITiersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TiersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.TiersListResponse.verify|verify} messages. - * @param message TiersListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ITiersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TiersListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TiersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.TiersListResponse; - - /** - * Decodes a TiersListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TiersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.TiersListResponse; - - /** - * Verifies a TiersListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a TiersListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TiersListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.TiersListResponse; - - /** - * Creates a plain object from a TiersListResponse message. Also converts values to other types if specified. - * @param message TiersListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.TiersListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TiersListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TiersListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Tier. */ - interface ITier { - - /** Tier tier */ - tier?: (string|null); - - /** Tier RAM */ - RAM?: (number|Long|string|null); - - /** Tier kind */ - kind?: (string|null); - - /** Tier Disk_Quota */ - Disk_Quota?: (number|Long|string|null); - - /** Tier region */ - region?: (string[]|null); - } - - /** Represents a Tier. */ - class Tier implements ITier { - - /** - * Constructs a new Tier. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ITier); - - /** Tier tier. */ - public tier: string; - - /** Tier RAM. */ - public RAM: (number|Long|string); - - /** Tier kind. */ - public kind: string; - - /** Tier Disk_Quota. */ - public Disk_Quota: (number|Long|string); - - /** Tier region. */ - public region: string[]; - - /** - * Creates a new Tier instance using the specified properties. - * @param [properties] Properties to set - * @returns Tier instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ITier): google.cloud.sql.v1beta4.Tier; - - /** - * Encodes the specified Tier message. Does not implicitly {@link google.cloud.sql.v1beta4.Tier.verify|verify} messages. - * @param message Tier message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ITier, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Tier message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Tier.verify|verify} messages. - * @param message Tier message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ITier, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Tier message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Tier - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.Tier; - - /** - * Decodes a Tier message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Tier - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.Tier; - - /** - * Verifies a Tier message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Tier message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Tier - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.Tier; - - /** - * Creates a plain object from a Tier message. Also converts values to other types if specified. - * @param message Tier - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.Tier, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Tier to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Tier - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Represents a SqlUsersService */ - class SqlUsersService extends $protobuf.rpc.Service { - - /** - * Constructs a new SqlUsersService service. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - */ - constructor(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean); - - /** - * Creates new SqlUsersService service using the specified rpc implementation. - * @param rpcImpl RPC implementation - * @param [requestDelimited=false] Whether requests are length-delimited - * @param [responseDelimited=false] Whether responses are length-delimited - * @returns RPC service. Useful where requests and/or responses are streamed. - */ - public static create(rpcImpl: $protobuf.RPCImpl, requestDelimited?: boolean, responseDelimited?: boolean): SqlUsersService; - - /** - * Calls Delete. - * @param request SqlUsersDeleteRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public delete(request: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, callback: google.cloud.sql.v1beta4.SqlUsersService.DeleteCallback): void; - - /** - * Calls Delete. - * @param request SqlUsersDeleteRequest message or plain object - * @returns Promise - */ - public delete(request: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest): Promise; - - /** - * Calls Get. - * @param request SqlUsersGetRequest message or plain object - * @param callback Node-style callback called with the error, if any, and User - */ - public get(request: google.cloud.sql.v1beta4.ISqlUsersGetRequest, callback: google.cloud.sql.v1beta4.SqlUsersService.GetCallback): void; - - /** - * Calls Get. - * @param request SqlUsersGetRequest message or plain object - * @returns Promise - */ - public get(request: google.cloud.sql.v1beta4.ISqlUsersGetRequest): Promise; - - /** - * Calls Insert. - * @param request SqlUsersInsertRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public insert(request: google.cloud.sql.v1beta4.ISqlUsersInsertRequest, callback: google.cloud.sql.v1beta4.SqlUsersService.InsertCallback): void; - - /** - * Calls Insert. - * @param request SqlUsersInsertRequest message or plain object - * @returns Promise - */ - public insert(request: google.cloud.sql.v1beta4.ISqlUsersInsertRequest): Promise; - - /** - * Calls List. - * @param request SqlUsersListRequest message or plain object - * @param callback Node-style callback called with the error, if any, and UsersListResponse - */ - public list(request: google.cloud.sql.v1beta4.ISqlUsersListRequest, callback: google.cloud.sql.v1beta4.SqlUsersService.ListCallback): void; - - /** - * Calls List. - * @param request SqlUsersListRequest message or plain object - * @returns Promise - */ - public list(request: google.cloud.sql.v1beta4.ISqlUsersListRequest): Promise; - - /** - * Calls Update. - * @param request SqlUsersUpdateRequest message or plain object - * @param callback Node-style callback called with the error, if any, and Operation - */ - public update(request: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, callback: google.cloud.sql.v1beta4.SqlUsersService.UpdateCallback): void; - - /** - * Calls Update. - * @param request SqlUsersUpdateRequest message or plain object - * @returns Promise - */ - public update(request: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest): Promise; - } - - namespace SqlUsersService { - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|delete_}. - * @param error Error, if any - * @param [response] Operation - */ - type DeleteCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|get}. - * @param error Error, if any - * @param [response] User - */ - type GetCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.User) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|insert}. - * @param error Error, if any - * @param [response] Operation - */ - type InsertCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|list}. - * @param error Error, if any - * @param [response] UsersListResponse - */ - type ListCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.UsersListResponse) => void; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|update}. - * @param error Error, if any - * @param [response] Operation - */ - type UpdateCallback = (error: (Error|null), response?: google.cloud.sql.v1beta4.Operation) => void; - } - - /** Properties of a SqlUsersDeleteRequest. */ - interface ISqlUsersDeleteRequest { - - /** SqlUsersDeleteRequest host */ - host?: (string|null); - - /** SqlUsersDeleteRequest instance */ - instance?: (string|null); - - /** SqlUsersDeleteRequest name */ - name?: (string|null); - - /** SqlUsersDeleteRequest project */ - project?: (string|null); - } - - /** Represents a SqlUsersDeleteRequest. */ - class SqlUsersDeleteRequest implements ISqlUsersDeleteRequest { - - /** - * Constructs a new SqlUsersDeleteRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest); - - /** SqlUsersDeleteRequest host. */ - public host: string; - - /** SqlUsersDeleteRequest instance. */ - public instance: string; - - /** SqlUsersDeleteRequest name. */ - public name: string; - - /** SqlUsersDeleteRequest project. */ - public project: string; - - /** - * Creates a new SqlUsersDeleteRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlUsersDeleteRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest): google.cloud.sql.v1beta4.SqlUsersDeleteRequest; - - /** - * Encodes the specified SqlUsersDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersDeleteRequest.verify|verify} messages. - * @param message SqlUsersDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlUsersDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersDeleteRequest.verify|verify} messages. - * @param message SqlUsersDeleteRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlUsersDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlUsersDeleteRequest; - - /** - * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlUsersDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlUsersDeleteRequest; - - /** - * Verifies a SqlUsersDeleteRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlUsersDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlUsersDeleteRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlUsersDeleteRequest; - - /** - * Creates a plain object from a SqlUsersDeleteRequest message. Also converts values to other types if specified. - * @param message SqlUsersDeleteRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlUsersDeleteRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlUsersDeleteRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlUsersDeleteRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlUsersGetRequest. */ - interface ISqlUsersGetRequest { - - /** SqlUsersGetRequest instance */ - instance?: (string|null); - - /** SqlUsersGetRequest name */ - name?: (string|null); - - /** SqlUsersGetRequest project */ - project?: (string|null); - - /** SqlUsersGetRequest host */ - host?: (string|null); - } - - /** Represents a SqlUsersGetRequest. */ - class SqlUsersGetRequest implements ISqlUsersGetRequest { - - /** - * Constructs a new SqlUsersGetRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlUsersGetRequest); - - /** SqlUsersGetRequest instance. */ - public instance: string; - - /** SqlUsersGetRequest name. */ - public name: string; - - /** SqlUsersGetRequest project. */ - public project: string; - - /** SqlUsersGetRequest host. */ - public host: string; - - /** - * Creates a new SqlUsersGetRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlUsersGetRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlUsersGetRequest): google.cloud.sql.v1beta4.SqlUsersGetRequest; - - /** - * Encodes the specified SqlUsersGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersGetRequest.verify|verify} messages. - * @param message SqlUsersGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlUsersGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlUsersGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersGetRequest.verify|verify} messages. - * @param message SqlUsersGetRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlUsersGetRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlUsersGetRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlUsersGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlUsersGetRequest; - - /** - * Decodes a SqlUsersGetRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlUsersGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlUsersGetRequest; - - /** - * Verifies a SqlUsersGetRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlUsersGetRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlUsersGetRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlUsersGetRequest; - - /** - * Creates a plain object from a SqlUsersGetRequest message. Also converts values to other types if specified. - * @param message SqlUsersGetRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlUsersGetRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlUsersGetRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlUsersGetRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlUsersInsertRequest. */ - interface ISqlUsersInsertRequest { - - /** SqlUsersInsertRequest instance */ - instance?: (string|null); - - /** SqlUsersInsertRequest project */ - project?: (string|null); - - /** SqlUsersInsertRequest body */ - body?: (google.cloud.sql.v1beta4.IUser|null); - } - - /** Represents a SqlUsersInsertRequest. */ - class SqlUsersInsertRequest implements ISqlUsersInsertRequest { - - /** - * Constructs a new SqlUsersInsertRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlUsersInsertRequest); - - /** SqlUsersInsertRequest instance. */ - public instance: string; - - /** SqlUsersInsertRequest project. */ - public project: string; - - /** SqlUsersInsertRequest body. */ - public body?: (google.cloud.sql.v1beta4.IUser|null); - - /** - * Creates a new SqlUsersInsertRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlUsersInsertRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlUsersInsertRequest): google.cloud.sql.v1beta4.SqlUsersInsertRequest; - - /** - * Encodes the specified SqlUsersInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersInsertRequest.verify|verify} messages. - * @param message SqlUsersInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlUsersInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlUsersInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersInsertRequest.verify|verify} messages. - * @param message SqlUsersInsertRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlUsersInsertRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlUsersInsertRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlUsersInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlUsersInsertRequest; - - /** - * Decodes a SqlUsersInsertRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlUsersInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlUsersInsertRequest; - - /** - * Verifies a SqlUsersInsertRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlUsersInsertRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlUsersInsertRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlUsersInsertRequest; - - /** - * Creates a plain object from a SqlUsersInsertRequest message. Also converts values to other types if specified. - * @param message SqlUsersInsertRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlUsersInsertRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlUsersInsertRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlUsersInsertRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlUsersListRequest. */ - interface ISqlUsersListRequest { - - /** SqlUsersListRequest instance */ - instance?: (string|null); - - /** SqlUsersListRequest project */ - project?: (string|null); - } - - /** Represents a SqlUsersListRequest. */ - class SqlUsersListRequest implements ISqlUsersListRequest { - - /** - * Constructs a new SqlUsersListRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlUsersListRequest); - - /** SqlUsersListRequest instance. */ - public instance: string; - - /** SqlUsersListRequest project. */ - public project: string; - - /** - * Creates a new SqlUsersListRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlUsersListRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlUsersListRequest): google.cloud.sql.v1beta4.SqlUsersListRequest; - - /** - * Encodes the specified SqlUsersListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersListRequest.verify|verify} messages. - * @param message SqlUsersListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlUsersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlUsersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersListRequest.verify|verify} messages. - * @param message SqlUsersListRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlUsersListRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlUsersListRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlUsersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlUsersListRequest; - - /** - * Decodes a SqlUsersListRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlUsersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlUsersListRequest; - - /** - * Verifies a SqlUsersListRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlUsersListRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlUsersListRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlUsersListRequest; - - /** - * Creates a plain object from a SqlUsersListRequest message. Also converts values to other types if specified. - * @param message SqlUsersListRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlUsersListRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlUsersListRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlUsersListRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a SqlUsersUpdateRequest. */ - interface ISqlUsersUpdateRequest { - - /** SqlUsersUpdateRequest host */ - host?: (string|null); - - /** SqlUsersUpdateRequest instance */ - instance?: (string|null); - - /** SqlUsersUpdateRequest name */ - name?: (string|null); - - /** SqlUsersUpdateRequest project */ - project?: (string|null); - - /** SqlUsersUpdateRequest databaseRoles */ - databaseRoles?: (string[]|null); - - /** SqlUsersUpdateRequest revokeExistingRoles */ - revokeExistingRoles?: (boolean|null); - - /** SqlUsersUpdateRequest body */ - body?: (google.cloud.sql.v1beta4.IUser|null); - } - - /** Represents a SqlUsersUpdateRequest. */ - class SqlUsersUpdateRequest implements ISqlUsersUpdateRequest { - - /** - * Constructs a new SqlUsersUpdateRequest. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest); - - /** SqlUsersUpdateRequest host. */ - public host: string; - - /** SqlUsersUpdateRequest instance. */ - public instance: string; - - /** SqlUsersUpdateRequest name. */ - public name: string; - - /** SqlUsersUpdateRequest project. */ - public project: string; - - /** SqlUsersUpdateRequest databaseRoles. */ - public databaseRoles: string[]; - - /** SqlUsersUpdateRequest revokeExistingRoles. */ - public revokeExistingRoles?: (boolean|null); - - /** SqlUsersUpdateRequest body. */ - public body?: (google.cloud.sql.v1beta4.IUser|null); - - /** - * Creates a new SqlUsersUpdateRequest instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlUsersUpdateRequest instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest): google.cloud.sql.v1beta4.SqlUsersUpdateRequest; - - /** - * Encodes the specified SqlUsersUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersUpdateRequest.verify|verify} messages. - * @param message SqlUsersUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlUsersUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersUpdateRequest.verify|verify} messages. - * @param message SqlUsersUpdateRequest message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlUsersUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlUsersUpdateRequest; - - /** - * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlUsersUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlUsersUpdateRequest; - - /** - * Verifies a SqlUsersUpdateRequest message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlUsersUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlUsersUpdateRequest - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlUsersUpdateRequest; - - /** - * Creates a plain object from a SqlUsersUpdateRequest message. Also converts values to other types if specified. - * @param message SqlUsersUpdateRequest - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlUsersUpdateRequest, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlUsersUpdateRequest to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlUsersUpdateRequest - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a UserPasswordValidationPolicy. */ - interface IUserPasswordValidationPolicy { - - /** UserPasswordValidationPolicy allowedFailedAttempts */ - allowedFailedAttempts?: (number|null); - - /** UserPasswordValidationPolicy passwordExpirationDuration */ - passwordExpirationDuration?: (google.protobuf.IDuration|null); - - /** UserPasswordValidationPolicy enableFailedAttemptsCheck */ - enableFailedAttemptsCheck?: (boolean|null); - - /** UserPasswordValidationPolicy status */ - status?: (google.cloud.sql.v1beta4.IPasswordStatus|null); - - /** UserPasswordValidationPolicy enablePasswordVerification */ - enablePasswordVerification?: (boolean|null); - } - - /** Represents a UserPasswordValidationPolicy. */ - class UserPasswordValidationPolicy implements IUserPasswordValidationPolicy { - - /** - * Constructs a new UserPasswordValidationPolicy. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IUserPasswordValidationPolicy); - - /** UserPasswordValidationPolicy allowedFailedAttempts. */ - public allowedFailedAttempts: number; - - /** UserPasswordValidationPolicy passwordExpirationDuration. */ - public passwordExpirationDuration?: (google.protobuf.IDuration|null); - - /** UserPasswordValidationPolicy enableFailedAttemptsCheck. */ - public enableFailedAttemptsCheck: boolean; - - /** UserPasswordValidationPolicy status. */ - public status?: (google.cloud.sql.v1beta4.IPasswordStatus|null); - - /** UserPasswordValidationPolicy enablePasswordVerification. */ - public enablePasswordVerification: boolean; - - /** - * Creates a new UserPasswordValidationPolicy instance using the specified properties. - * @param [properties] Properties to set - * @returns UserPasswordValidationPolicy instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IUserPasswordValidationPolicy): google.cloud.sql.v1beta4.UserPasswordValidationPolicy; - - /** - * Encodes the specified UserPasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1beta4.UserPasswordValidationPolicy.verify|verify} messages. - * @param message UserPasswordValidationPolicy message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IUserPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UserPasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UserPasswordValidationPolicy.verify|verify} messages. - * @param message UserPasswordValidationPolicy message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IUserPasswordValidationPolicy, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UserPasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.UserPasswordValidationPolicy; - - /** - * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UserPasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.UserPasswordValidationPolicy; - - /** - * Verifies a UserPasswordValidationPolicy message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a UserPasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UserPasswordValidationPolicy - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.UserPasswordValidationPolicy; - - /** - * Creates a plain object from a UserPasswordValidationPolicy message. Also converts values to other types if specified. - * @param message UserPasswordValidationPolicy - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.UserPasswordValidationPolicy, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UserPasswordValidationPolicy to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UserPasswordValidationPolicy - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PasswordStatus. */ - interface IPasswordStatus { - - /** PasswordStatus locked */ - locked?: (boolean|null); - - /** PasswordStatus passwordExpirationTime */ - passwordExpirationTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents a PasswordStatus. */ - class PasswordStatus implements IPasswordStatus { - - /** - * Constructs a new PasswordStatus. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IPasswordStatus); - - /** PasswordStatus locked. */ - public locked: boolean; - - /** PasswordStatus passwordExpirationTime. */ - public passwordExpirationTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new PasswordStatus instance using the specified properties. - * @param [properties] Properties to set - * @returns PasswordStatus instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IPasswordStatus): google.cloud.sql.v1beta4.PasswordStatus; - - /** - * Encodes the specified PasswordStatus message. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordStatus.verify|verify} messages. - * @param message PasswordStatus message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IPasswordStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PasswordStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordStatus.verify|verify} messages. - * @param message PasswordStatus message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IPasswordStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PasswordStatus message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PasswordStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.PasswordStatus; - - /** - * Decodes a PasswordStatus message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PasswordStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.PasswordStatus; - - /** - * Verifies a PasswordStatus message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PasswordStatus message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PasswordStatus - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.PasswordStatus; - - /** - * Creates a plain object from a PasswordStatus message. Also converts values to other types if specified. - * @param message PasswordStatus - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.PasswordStatus, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PasswordStatus to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PasswordStatus - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a User. */ - interface IUser { - - /** User kind */ - kind?: (string|null); - - /** User password */ - password?: (string|null); - - /** User etag */ - etag?: (string|null); - - /** User name */ - name?: (string|null); - - /** User host */ - host?: (string|null); - - /** User instance */ - instance?: (string|null); - - /** User project */ - project?: (string|null); - - /** User type */ - type?: (google.cloud.sql.v1beta4.User.SqlUserType|keyof typeof google.cloud.sql.v1beta4.User.SqlUserType|null); - - /** User sqlserverUserDetails */ - sqlserverUserDetails?: (google.cloud.sql.v1beta4.ISqlServerUserDetails|null); - - /** User iamEmail */ - iamEmail?: (string|null); - - /** User passwordPolicy */ - passwordPolicy?: (google.cloud.sql.v1beta4.IUserPasswordValidationPolicy|null); - - /** User dualPasswordType */ - dualPasswordType?: (google.cloud.sql.v1beta4.User.DualPasswordType|keyof typeof google.cloud.sql.v1beta4.User.DualPasswordType|null); - - /** User iamStatus */ - iamStatus?: (google.cloud.sql.v1beta4.User.IamStatus|keyof typeof google.cloud.sql.v1beta4.User.IamStatus|null); - - /** User databaseRoles */ - databaseRoles?: (string[]|null); - } - - /** Represents a User. */ - class User implements IUser { - - /** - * Constructs a new User. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IUser); - - /** User kind. */ - public kind: string; - - /** User password. */ - public password: string; - - /** User etag. */ - public etag: string; - - /** User name. */ - public name: string; - - /** User host. */ - public host: string; - - /** User instance. */ - public instance: string; - - /** User project. */ - public project: string; - - /** User type. */ - public type: (google.cloud.sql.v1beta4.User.SqlUserType|keyof typeof google.cloud.sql.v1beta4.User.SqlUserType); - - /** User sqlserverUserDetails. */ - public sqlserverUserDetails?: (google.cloud.sql.v1beta4.ISqlServerUserDetails|null); - - /** User iamEmail. */ - public iamEmail: string; - - /** User passwordPolicy. */ - public passwordPolicy?: (google.cloud.sql.v1beta4.IUserPasswordValidationPolicy|null); - - /** User dualPasswordType. */ - public dualPasswordType?: (google.cloud.sql.v1beta4.User.DualPasswordType|keyof typeof google.cloud.sql.v1beta4.User.DualPasswordType|null); - - /** User iamStatus. */ - public iamStatus?: (google.cloud.sql.v1beta4.User.IamStatus|keyof typeof google.cloud.sql.v1beta4.User.IamStatus|null); - - /** User databaseRoles. */ - public databaseRoles: string[]; - - /** User userDetails. */ - public userDetails?: "sqlserverUserDetails"; - - /** - * Creates a new User instance using the specified properties. - * @param [properties] Properties to set - * @returns User instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IUser): google.cloud.sql.v1beta4.User; - - /** - * Encodes the specified User message. Does not implicitly {@link google.cloud.sql.v1beta4.User.verify|verify} messages. - * @param message User message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IUser, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified User message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.User.verify|verify} messages. - * @param message User message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IUser, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a User message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns User - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.User; - - /** - * Decodes a User message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns User - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.User; - - /** - * Verifies a User message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a User message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns User - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.User; - - /** - * Creates a plain object from a User message. Also converts values to other types if specified. - * @param message User - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.User, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this User to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for User - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace User { - - /** SqlUserType enum. */ - enum SqlUserType { - BUILT_IN = 0, - CLOUD_IAM_USER = 1, - CLOUD_IAM_SERVICE_ACCOUNT = 2, - CLOUD_IAM_GROUP = 3, - CLOUD_IAM_GROUP_USER = 4, - CLOUD_IAM_GROUP_SERVICE_ACCOUNT = 5, - ENTRAID_USER = 7 - } - - /** DualPasswordType enum. */ - enum DualPasswordType { - DUAL_PASSWORD_TYPE_UNSPECIFIED = 0, - NO_MODIFY_DUAL_PASSWORD = 1, - NO_DUAL_PASSWORD = 2, - DUAL_PASSWORD = 3 - } - - /** IamStatus enum. */ - enum IamStatus { - IAM_STATUS_UNSPECIFIED = 0, - INACTIVE = 1, - ACTIVE = 2 - } - } - - /** Properties of a SqlServerUserDetails. */ - interface ISqlServerUserDetails { - - /** SqlServerUserDetails disabled */ - disabled?: (boolean|null); - - /** SqlServerUserDetails serverRoles */ - serverRoles?: (string[]|null); - } - - /** Represents a SqlServerUserDetails. */ - class SqlServerUserDetails implements ISqlServerUserDetails { - - /** - * Constructs a new SqlServerUserDetails. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.ISqlServerUserDetails); - - /** SqlServerUserDetails disabled. */ - public disabled: boolean; - - /** SqlServerUserDetails serverRoles. */ - public serverRoles: string[]; - - /** - * Creates a new SqlServerUserDetails instance using the specified properties. - * @param [properties] Properties to set - * @returns SqlServerUserDetails instance - */ - public static create(properties?: google.cloud.sql.v1beta4.ISqlServerUserDetails): google.cloud.sql.v1beta4.SqlServerUserDetails; - - /** - * Encodes the specified SqlServerUserDetails message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerUserDetails.verify|verify} messages. - * @param message SqlServerUserDetails message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.ISqlServerUserDetails, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SqlServerUserDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerUserDetails.verify|verify} messages. - * @param message SqlServerUserDetails message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.ISqlServerUserDetails, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SqlServerUserDetails message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SqlServerUserDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.SqlServerUserDetails; - - /** - * Decodes a SqlServerUserDetails message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SqlServerUserDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.SqlServerUserDetails; - - /** - * Verifies a SqlServerUserDetails message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SqlServerUserDetails message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SqlServerUserDetails - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.SqlServerUserDetails; - - /** - * Creates a plain object from a SqlServerUserDetails message. Also converts values to other types if specified. - * @param message SqlServerUserDetails - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.SqlServerUserDetails, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SqlServerUserDetails to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SqlServerUserDetails - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a UsersListResponse. */ - interface IUsersListResponse { - - /** UsersListResponse kind */ - kind?: (string|null); - - /** UsersListResponse items */ - items?: (google.cloud.sql.v1beta4.IUser[]|null); - - /** UsersListResponse nextPageToken */ - nextPageToken?: (string|null); - } - - /** Represents a UsersListResponse. */ - class UsersListResponse implements IUsersListResponse { - - /** - * Constructs a new UsersListResponse. - * @param [properties] Properties to set - */ - constructor(properties?: google.cloud.sql.v1beta4.IUsersListResponse); - - /** UsersListResponse kind. */ - public kind: string; - - /** UsersListResponse items. */ - public items: google.cloud.sql.v1beta4.IUser[]; - - /** UsersListResponse nextPageToken. */ - public nextPageToken: string; - - /** - * Creates a new UsersListResponse instance using the specified properties. - * @param [properties] Properties to set - * @returns UsersListResponse instance - */ - public static create(properties?: google.cloud.sql.v1beta4.IUsersListResponse): google.cloud.sql.v1beta4.UsersListResponse; - - /** - * Encodes the specified UsersListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.UsersListResponse.verify|verify} messages. - * @param message UsersListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.cloud.sql.v1beta4.IUsersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UsersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UsersListResponse.verify|verify} messages. - * @param message UsersListResponse message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.cloud.sql.v1beta4.IUsersListResponse, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a UsersListResponse message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UsersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.cloud.sql.v1beta4.UsersListResponse; - - /** - * Decodes a UsersListResponse message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UsersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.cloud.sql.v1beta4.UsersListResponse; - - /** - * Verifies a UsersListResponse message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a UsersListResponse message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UsersListResponse - */ - public static fromObject(object: { [k: string]: any }): google.cloud.sql.v1beta4.UsersListResponse; - - /** - * Creates a plain object from a UsersListResponse message. Also converts values to other types if specified. - * @param message UsersListResponse - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.cloud.sql.v1beta4.UsersListResponse, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UsersListResponse to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UsersListResponse - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - } - } - - /** Namespace api. */ - namespace api { - - /** Properties of a Http. */ - interface IHttp { - - /** Http rules */ - rules?: (google.api.IHttpRule[]|null); - - /** Http fullyDecodeReservedExpansion */ - fullyDecodeReservedExpansion?: (boolean|null); - } - - /** Represents a Http. */ - class Http implements IHttp { - - /** - * Constructs a new Http. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IHttp); - - /** Http rules. */ - public rules: google.api.IHttpRule[]; - - /** Http fullyDecodeReservedExpansion. */ - public fullyDecodeReservedExpansion: boolean; - - /** - * Creates a new Http instance using the specified properties. - * @param [properties] Properties to set - * @returns Http instance - */ - public static create(properties?: google.api.IHttp): google.api.Http; - - /** - * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @param message Http message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @param message Http message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IHttp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Http message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Http; - - /** - * Decodes a Http message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Http; - - /** - * Verifies a Http message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Http message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Http - */ - public static fromObject(object: { [k: string]: any }): google.api.Http; - - /** - * Creates a plain object from a Http message. Also converts values to other types if specified. - * @param message Http - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.Http, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Http to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Http - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a HttpRule. */ - interface IHttpRule { - - /** HttpRule selector */ - selector?: (string|null); - - /** HttpRule get */ - get?: (string|null); - - /** HttpRule put */ - put?: (string|null); - - /** HttpRule post */ - post?: (string|null); - - /** HttpRule delete */ - "delete"?: (string|null); - - /** HttpRule patch */ - patch?: (string|null); - - /** HttpRule custom */ - custom?: (google.api.ICustomHttpPattern|null); - - /** HttpRule body */ - body?: (string|null); - - /** HttpRule responseBody */ - responseBody?: (string|null); - - /** HttpRule additionalBindings */ - additionalBindings?: (google.api.IHttpRule[]|null); - } - - /** Represents a HttpRule. */ - class HttpRule implements IHttpRule { - - /** - * Constructs a new HttpRule. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IHttpRule); - - /** HttpRule selector. */ - public selector: string; - - /** HttpRule get. */ - public get?: (string|null); - - /** HttpRule put. */ - public put?: (string|null); - - /** HttpRule post. */ - public post?: (string|null); - - /** HttpRule delete. */ - public delete?: (string|null); - - /** HttpRule patch. */ - public patch?: (string|null); - - /** HttpRule custom. */ - public custom?: (google.api.ICustomHttpPattern|null); - - /** HttpRule body. */ - public body: string; - - /** HttpRule responseBody. */ - public responseBody: string; - - /** HttpRule additionalBindings. */ - public additionalBindings: google.api.IHttpRule[]; - - /** HttpRule pattern. */ - public pattern?: ("get"|"put"|"post"|"delete"|"patch"|"custom"); - - /** - * Creates a new HttpRule instance using the specified properties. - * @param [properties] Properties to set - * @returns HttpRule instance - */ - public static create(properties?: google.api.IHttpRule): google.api.HttpRule; - - /** - * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @param message HttpRule message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @param message HttpRule message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IHttpRule, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a HttpRule message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns HttpRule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.HttpRule; - - /** - * Decodes a HttpRule message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns HttpRule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.HttpRule; - - /** - * Verifies a HttpRule message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns HttpRule - */ - public static fromObject(object: { [k: string]: any }): google.api.HttpRule; - - /** - * Creates a plain object from a HttpRule message. Also converts values to other types if specified. - * @param message HttpRule - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.HttpRule, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this HttpRule to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for HttpRule - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CustomHttpPattern. */ - interface ICustomHttpPattern { - - /** CustomHttpPattern kind */ - kind?: (string|null); - - /** CustomHttpPattern path */ - path?: (string|null); - } - - /** Represents a CustomHttpPattern. */ - class CustomHttpPattern implements ICustomHttpPattern { - - /** - * Constructs a new CustomHttpPattern. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.ICustomHttpPattern); - - /** CustomHttpPattern kind. */ - public kind: string; - - /** CustomHttpPattern path. */ - public path: string; - - /** - * Creates a new CustomHttpPattern instance using the specified properties. - * @param [properties] Properties to set - * @returns CustomHttpPattern instance - */ - public static create(properties?: google.api.ICustomHttpPattern): google.api.CustomHttpPattern; - - /** - * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @param message CustomHttpPattern message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @param message CustomHttpPattern message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.ICustomHttpPattern, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CustomHttpPattern - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CustomHttpPattern; - - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CustomHttpPattern - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CustomHttpPattern; - - /** - * Verifies a CustomHttpPattern message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CustomHttpPattern - */ - public static fromObject(object: { [k: string]: any }): google.api.CustomHttpPattern; - - /** - * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. - * @param message CustomHttpPattern - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.CustomHttpPattern, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CustomHttpPattern to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CustomHttpPattern - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CommonLanguageSettings. */ - interface ICommonLanguageSettings { - - /** CommonLanguageSettings referenceDocsUri */ - referenceDocsUri?: (string|null); - - /** CommonLanguageSettings destinations */ - destinations?: (google.api.ClientLibraryDestination[]|null); - - /** CommonLanguageSettings selectiveGapicGeneration */ - selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); - } - - /** Represents a CommonLanguageSettings. */ - class CommonLanguageSettings implements ICommonLanguageSettings { - - /** - * Constructs a new CommonLanguageSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.ICommonLanguageSettings); - - /** CommonLanguageSettings referenceDocsUri. */ - public referenceDocsUri: string; - - /** CommonLanguageSettings destinations. */ - public destinations: google.api.ClientLibraryDestination[]; - - /** CommonLanguageSettings selectiveGapicGeneration. */ - public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); - - /** - * Creates a new CommonLanguageSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns CommonLanguageSettings instance - */ - public static create(properties?: google.api.ICommonLanguageSettings): google.api.CommonLanguageSettings; - - /** - * Encodes the specified CommonLanguageSettings message. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. - * @param message CommonLanguageSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.ICommonLanguageSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CommonLanguageSettings message, length delimited. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. - * @param message CommonLanguageSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.ICommonLanguageSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CommonLanguageSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CommonLanguageSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CommonLanguageSettings; - - /** - * Decodes a CommonLanguageSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CommonLanguageSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CommonLanguageSettings; - - /** - * Verifies a CommonLanguageSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CommonLanguageSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CommonLanguageSettings - */ - public static fromObject(object: { [k: string]: any }): google.api.CommonLanguageSettings; - - /** - * Creates a plain object from a CommonLanguageSettings message. Also converts values to other types if specified. - * @param message CommonLanguageSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.CommonLanguageSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CommonLanguageSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CommonLanguageSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ClientLibrarySettings. */ - interface IClientLibrarySettings { - - /** ClientLibrarySettings version */ - version?: (string|null); - - /** ClientLibrarySettings launchStage */ - launchStage?: (google.api.LaunchStage|keyof typeof google.api.LaunchStage|null); - - /** ClientLibrarySettings restNumericEnums */ - restNumericEnums?: (boolean|null); - - /** ClientLibrarySettings javaSettings */ - javaSettings?: (google.api.IJavaSettings|null); - - /** ClientLibrarySettings cppSettings */ - cppSettings?: (google.api.ICppSettings|null); - - /** ClientLibrarySettings phpSettings */ - phpSettings?: (google.api.IPhpSettings|null); - - /** ClientLibrarySettings pythonSettings */ - pythonSettings?: (google.api.IPythonSettings|null); - - /** ClientLibrarySettings nodeSettings */ - nodeSettings?: (google.api.INodeSettings|null); - - /** ClientLibrarySettings dotnetSettings */ - dotnetSettings?: (google.api.IDotnetSettings|null); - - /** ClientLibrarySettings rubySettings */ - rubySettings?: (google.api.IRubySettings|null); - - /** ClientLibrarySettings goSettings */ - goSettings?: (google.api.IGoSettings|null); - } - - /** Represents a ClientLibrarySettings. */ - class ClientLibrarySettings implements IClientLibrarySettings { - - /** - * Constructs a new ClientLibrarySettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IClientLibrarySettings); - - /** ClientLibrarySettings version. */ - public version: string; - - /** ClientLibrarySettings launchStage. */ - public launchStage: (google.api.LaunchStage|keyof typeof google.api.LaunchStage); - - /** ClientLibrarySettings restNumericEnums. */ - public restNumericEnums: boolean; - - /** ClientLibrarySettings javaSettings. */ - public javaSettings?: (google.api.IJavaSettings|null); - - /** ClientLibrarySettings cppSettings. */ - public cppSettings?: (google.api.ICppSettings|null); - - /** ClientLibrarySettings phpSettings. */ - public phpSettings?: (google.api.IPhpSettings|null); - - /** ClientLibrarySettings pythonSettings. */ - public pythonSettings?: (google.api.IPythonSettings|null); - - /** ClientLibrarySettings nodeSettings. */ - public nodeSettings?: (google.api.INodeSettings|null); - - /** ClientLibrarySettings dotnetSettings. */ - public dotnetSettings?: (google.api.IDotnetSettings|null); - - /** ClientLibrarySettings rubySettings. */ - public rubySettings?: (google.api.IRubySettings|null); - - /** ClientLibrarySettings goSettings. */ - public goSettings?: (google.api.IGoSettings|null); - - /** - * Creates a new ClientLibrarySettings instance using the specified properties. - * @param [properties] Properties to set - * @returns ClientLibrarySettings instance - */ - public static create(properties?: google.api.IClientLibrarySettings): google.api.ClientLibrarySettings; - - /** - * Encodes the specified ClientLibrarySettings message. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. - * @param message ClientLibrarySettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IClientLibrarySettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ClientLibrarySettings message, length delimited. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. - * @param message ClientLibrarySettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IClientLibrarySettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ClientLibrarySettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ClientLibrarySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ClientLibrarySettings; - - /** - * Decodes a ClientLibrarySettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ClientLibrarySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ClientLibrarySettings; - - /** - * Verifies a ClientLibrarySettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ClientLibrarySettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ClientLibrarySettings - */ - public static fromObject(object: { [k: string]: any }): google.api.ClientLibrarySettings; - - /** - * Creates a plain object from a ClientLibrarySettings message. Also converts values to other types if specified. - * @param message ClientLibrarySettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.ClientLibrarySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ClientLibrarySettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ClientLibrarySettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Publishing. */ - interface IPublishing { - - /** Publishing methodSettings */ - methodSettings?: (google.api.IMethodSettings[]|null); - - /** Publishing newIssueUri */ - newIssueUri?: (string|null); - - /** Publishing documentationUri */ - documentationUri?: (string|null); - - /** Publishing apiShortName */ - apiShortName?: (string|null); - - /** Publishing githubLabel */ - githubLabel?: (string|null); - - /** Publishing codeownerGithubTeams */ - codeownerGithubTeams?: (string[]|null); - - /** Publishing docTagPrefix */ - docTagPrefix?: (string|null); - - /** Publishing organization */ - organization?: (google.api.ClientLibraryOrganization|keyof typeof google.api.ClientLibraryOrganization|null); - - /** Publishing librarySettings */ - librarySettings?: (google.api.IClientLibrarySettings[]|null); - - /** Publishing protoReferenceDocumentationUri */ - protoReferenceDocumentationUri?: (string|null); - - /** Publishing restReferenceDocumentationUri */ - restReferenceDocumentationUri?: (string|null); - } - - /** Represents a Publishing. */ - class Publishing implements IPublishing { - - /** - * Constructs a new Publishing. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IPublishing); - - /** Publishing methodSettings. */ - public methodSettings: google.api.IMethodSettings[]; - - /** Publishing newIssueUri. */ - public newIssueUri: string; - - /** Publishing documentationUri. */ - public documentationUri: string; - - /** Publishing apiShortName. */ - public apiShortName: string; - - /** Publishing githubLabel. */ - public githubLabel: string; - - /** Publishing codeownerGithubTeams. */ - public codeownerGithubTeams: string[]; - - /** Publishing docTagPrefix. */ - public docTagPrefix: string; - - /** Publishing organization. */ - public organization: (google.api.ClientLibraryOrganization|keyof typeof google.api.ClientLibraryOrganization); - - /** Publishing librarySettings. */ - public librarySettings: google.api.IClientLibrarySettings[]; - - /** Publishing protoReferenceDocumentationUri. */ - public protoReferenceDocumentationUri: string; - - /** Publishing restReferenceDocumentationUri. */ - public restReferenceDocumentationUri: string; - - /** - * Creates a new Publishing instance using the specified properties. - * @param [properties] Properties to set - * @returns Publishing instance - */ - public static create(properties?: google.api.IPublishing): google.api.Publishing; - - /** - * Encodes the specified Publishing message. Does not implicitly {@link google.api.Publishing.verify|verify} messages. - * @param message Publishing message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IPublishing, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Publishing message, length delimited. Does not implicitly {@link google.api.Publishing.verify|verify} messages. - * @param message Publishing message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IPublishing, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Publishing message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Publishing - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.Publishing; - - /** - * Decodes a Publishing message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Publishing - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.Publishing; - - /** - * Verifies a Publishing message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Publishing message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Publishing - */ - public static fromObject(object: { [k: string]: any }): google.api.Publishing; - - /** - * Creates a plain object from a Publishing message. Also converts values to other types if specified. - * @param message Publishing - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.Publishing, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Publishing to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Publishing - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a JavaSettings. */ - interface IJavaSettings { - - /** JavaSettings libraryPackage */ - libraryPackage?: (string|null); - - /** JavaSettings serviceClassNames */ - serviceClassNames?: ({ [k: string]: string }|null); - - /** JavaSettings common */ - common?: (google.api.ICommonLanguageSettings|null); - } - - /** Represents a JavaSettings. */ - class JavaSettings implements IJavaSettings { - - /** - * Constructs a new JavaSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IJavaSettings); - - /** JavaSettings libraryPackage. */ - public libraryPackage: string; - - /** JavaSettings serviceClassNames. */ - public serviceClassNames: { [k: string]: string }; - - /** JavaSettings common. */ - public common?: (google.api.ICommonLanguageSettings|null); - - /** - * Creates a new JavaSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns JavaSettings instance - */ - public static create(properties?: google.api.IJavaSettings): google.api.JavaSettings; - - /** - * Encodes the specified JavaSettings message. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. - * @param message JavaSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IJavaSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified JavaSettings message, length delimited. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. - * @param message JavaSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IJavaSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a JavaSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns JavaSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.JavaSettings; - - /** - * Decodes a JavaSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns JavaSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.JavaSettings; - - /** - * Verifies a JavaSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a JavaSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns JavaSettings - */ - public static fromObject(object: { [k: string]: any }): google.api.JavaSettings; - - /** - * Creates a plain object from a JavaSettings message. Also converts values to other types if specified. - * @param message JavaSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.JavaSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this JavaSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for JavaSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a CppSettings. */ - interface ICppSettings { - - /** CppSettings common */ - common?: (google.api.ICommonLanguageSettings|null); - } - - /** Represents a CppSettings. */ - class CppSettings implements ICppSettings { - - /** - * Constructs a new CppSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.ICppSettings); - - /** CppSettings common. */ - public common?: (google.api.ICommonLanguageSettings|null); - - /** - * Creates a new CppSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns CppSettings instance - */ - public static create(properties?: google.api.ICppSettings): google.api.CppSettings; - - /** - * Encodes the specified CppSettings message. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. - * @param message CppSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.ICppSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified CppSettings message, length delimited. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. - * @param message CppSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.ICppSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a CppSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns CppSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.CppSettings; - - /** - * Decodes a CppSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns CppSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.CppSettings; - - /** - * Verifies a CppSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a CppSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns CppSettings - */ - public static fromObject(object: { [k: string]: any }): google.api.CppSettings; - - /** - * Creates a plain object from a CppSettings message. Also converts values to other types if specified. - * @param message CppSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.CppSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this CppSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for CppSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PhpSettings. */ - interface IPhpSettings { - - /** PhpSettings common */ - common?: (google.api.ICommonLanguageSettings|null); - } - - /** Represents a PhpSettings. */ - class PhpSettings implements IPhpSettings { - - /** - * Constructs a new PhpSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IPhpSettings); - - /** PhpSettings common. */ - public common?: (google.api.ICommonLanguageSettings|null); - - /** - * Creates a new PhpSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns PhpSettings instance - */ - public static create(properties?: google.api.IPhpSettings): google.api.PhpSettings; - - /** - * Encodes the specified PhpSettings message. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. - * @param message PhpSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IPhpSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PhpSettings message, length delimited. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. - * @param message PhpSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IPhpSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PhpSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PhpSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PhpSettings; - - /** - * Decodes a PhpSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PhpSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PhpSettings; - - /** - * Verifies a PhpSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PhpSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PhpSettings - */ - public static fromObject(object: { [k: string]: any }): google.api.PhpSettings; - - /** - * Creates a plain object from a PhpSettings message. Also converts values to other types if specified. - * @param message PhpSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.PhpSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PhpSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PhpSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a PythonSettings. */ - interface IPythonSettings { - - /** PythonSettings common */ - common?: (google.api.ICommonLanguageSettings|null); - - /** PythonSettings experimentalFeatures */ - experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); - } - - /** Represents a PythonSettings. */ - class PythonSettings implements IPythonSettings { - - /** - * Constructs a new PythonSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IPythonSettings); - - /** PythonSettings common. */ - public common?: (google.api.ICommonLanguageSettings|null); - - /** PythonSettings experimentalFeatures. */ - public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); - - /** - * Creates a new PythonSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns PythonSettings instance - */ - public static create(properties?: google.api.IPythonSettings): google.api.PythonSettings; - - /** - * Encodes the specified PythonSettings message. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. - * @param message PythonSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IPythonSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified PythonSettings message, length delimited. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. - * @param message PythonSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IPythonSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a PythonSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns PythonSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PythonSettings; - - /** - * Decodes a PythonSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns PythonSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PythonSettings; - - /** - * Verifies a PythonSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a PythonSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns PythonSettings - */ - public static fromObject(object: { [k: string]: any }): google.api.PythonSettings; - - /** - * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. - * @param message PythonSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.PythonSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this PythonSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for PythonSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace PythonSettings { - - /** Properties of an ExperimentalFeatures. */ - interface IExperimentalFeatures { - - /** ExperimentalFeatures restAsyncIoEnabled */ - restAsyncIoEnabled?: (boolean|null); - - /** ExperimentalFeatures protobufPythonicTypesEnabled */ - protobufPythonicTypesEnabled?: (boolean|null); - - /** ExperimentalFeatures unversionedPackageDisabled */ - unversionedPackageDisabled?: (boolean|null); - } - - /** Represents an ExperimentalFeatures. */ - class ExperimentalFeatures implements IExperimentalFeatures { - - /** - * Constructs a new ExperimentalFeatures. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); - - /** ExperimentalFeatures restAsyncIoEnabled. */ - public restAsyncIoEnabled: boolean; - - /** ExperimentalFeatures protobufPythonicTypesEnabled. */ - public protobufPythonicTypesEnabled: boolean; - - /** ExperimentalFeatures unversionedPackageDisabled. */ - public unversionedPackageDisabled: boolean; - - /** - * Creates a new ExperimentalFeatures instance using the specified properties. - * @param [properties] Properties to set - * @returns ExperimentalFeatures instance - */ - public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; - - /** - * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. - * @param message ExperimentalFeatures message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. - * @param message ExperimentalFeatures message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExperimentalFeatures message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExperimentalFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PythonSettings.ExperimentalFeatures; - - /** - * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExperimentalFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PythonSettings.ExperimentalFeatures; - - /** - * Verifies an ExperimentalFeatures message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExperimentalFeatures - */ - public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; - - /** - * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. - * @param message ExperimentalFeatures - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExperimentalFeatures to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExperimentalFeatures - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a NodeSettings. */ - interface INodeSettings { - - /** NodeSettings common */ - common?: (google.api.ICommonLanguageSettings|null); - } - - /** Represents a NodeSettings. */ - class NodeSettings implements INodeSettings { - - /** - * Constructs a new NodeSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.INodeSettings); - - /** NodeSettings common. */ - public common?: (google.api.ICommonLanguageSettings|null); - - /** - * Creates a new NodeSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns NodeSettings instance - */ - public static create(properties?: google.api.INodeSettings): google.api.NodeSettings; - - /** - * Encodes the specified NodeSettings message. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. - * @param message NodeSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.INodeSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified NodeSettings message, length delimited. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. - * @param message NodeSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.INodeSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a NodeSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns NodeSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.NodeSettings; - - /** - * Decodes a NodeSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns NodeSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.NodeSettings; - - /** - * Verifies a NodeSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a NodeSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns NodeSettings - */ - public static fromObject(object: { [k: string]: any }): google.api.NodeSettings; - - /** - * Creates a plain object from a NodeSettings message. Also converts values to other types if specified. - * @param message NodeSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.NodeSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this NodeSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for NodeSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DotnetSettings. */ - interface IDotnetSettings { - - /** DotnetSettings common */ - common?: (google.api.ICommonLanguageSettings|null); - - /** DotnetSettings renamedServices */ - renamedServices?: ({ [k: string]: string }|null); - - /** DotnetSettings renamedResources */ - renamedResources?: ({ [k: string]: string }|null); - - /** DotnetSettings ignoredResources */ - ignoredResources?: (string[]|null); - - /** DotnetSettings forcedNamespaceAliases */ - forcedNamespaceAliases?: (string[]|null); - - /** DotnetSettings handwrittenSignatures */ - handwrittenSignatures?: (string[]|null); - } - - /** Represents a DotnetSettings. */ - class DotnetSettings implements IDotnetSettings { - - /** - * Constructs a new DotnetSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IDotnetSettings); - - /** DotnetSettings common. */ - public common?: (google.api.ICommonLanguageSettings|null); - - /** DotnetSettings renamedServices. */ - public renamedServices: { [k: string]: string }; - - /** DotnetSettings renamedResources. */ - public renamedResources: { [k: string]: string }; - - /** DotnetSettings ignoredResources. */ - public ignoredResources: string[]; - - /** DotnetSettings forcedNamespaceAliases. */ - public forcedNamespaceAliases: string[]; - - /** DotnetSettings handwrittenSignatures. */ - public handwrittenSignatures: string[]; - - /** - * Creates a new DotnetSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns DotnetSettings instance - */ - public static create(properties?: google.api.IDotnetSettings): google.api.DotnetSettings; - - /** - * Encodes the specified DotnetSettings message. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. - * @param message DotnetSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IDotnetSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DotnetSettings message, length delimited. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. - * @param message DotnetSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IDotnetSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DotnetSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DotnetSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.DotnetSettings; - - /** - * Decodes a DotnetSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DotnetSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.DotnetSettings; - - /** - * Verifies a DotnetSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DotnetSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DotnetSettings - */ - public static fromObject(object: { [k: string]: any }): google.api.DotnetSettings; - - /** - * Creates a plain object from a DotnetSettings message. Also converts values to other types if specified. - * @param message DotnetSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.DotnetSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DotnetSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DotnetSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a RubySettings. */ - interface IRubySettings { - - /** RubySettings common */ - common?: (google.api.ICommonLanguageSettings|null); - } - - /** Represents a RubySettings. */ - class RubySettings implements IRubySettings { - - /** - * Constructs a new RubySettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IRubySettings); - - /** RubySettings common. */ - public common?: (google.api.ICommonLanguageSettings|null); - - /** - * Creates a new RubySettings instance using the specified properties. - * @param [properties] Properties to set - * @returns RubySettings instance - */ - public static create(properties?: google.api.IRubySettings): google.api.RubySettings; - - /** - * Encodes the specified RubySettings message. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. - * @param message RubySettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IRubySettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified RubySettings message, length delimited. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. - * @param message RubySettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IRubySettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a RubySettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns RubySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.RubySettings; - - /** - * Decodes a RubySettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns RubySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.RubySettings; - - /** - * Verifies a RubySettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a RubySettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns RubySettings - */ - public static fromObject(object: { [k: string]: any }): google.api.RubySettings; - - /** - * Creates a plain object from a RubySettings message. Also converts values to other types if specified. - * @param message RubySettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.RubySettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this RubySettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for RubySettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a GoSettings. */ - interface IGoSettings { - - /** GoSettings common */ - common?: (google.api.ICommonLanguageSettings|null); - - /** GoSettings renamedServices */ - renamedServices?: ({ [k: string]: string }|null); - } - - /** Represents a GoSettings. */ - class GoSettings implements IGoSettings { - - /** - * Constructs a new GoSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IGoSettings); - - /** GoSettings common. */ - public common?: (google.api.ICommonLanguageSettings|null); - - /** GoSettings renamedServices. */ - public renamedServices: { [k: string]: string }; - - /** - * Creates a new GoSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns GoSettings instance - */ - public static create(properties?: google.api.IGoSettings): google.api.GoSettings; - - /** - * Encodes the specified GoSettings message. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. - * @param message GoSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IGoSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GoSettings message, length delimited. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. - * @param message GoSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IGoSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GoSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GoSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.GoSettings; - - /** - * Decodes a GoSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GoSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.GoSettings; - - /** - * Verifies a GoSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GoSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GoSettings - */ - public static fromObject(object: { [k: string]: any }): google.api.GoSettings; - - /** - * Creates a plain object from a GoSettings message. Also converts values to other types if specified. - * @param message GoSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.GoSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GoSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GoSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MethodSettings. */ - interface IMethodSettings { - - /** MethodSettings selector */ - selector?: (string|null); - - /** MethodSettings longRunning */ - longRunning?: (google.api.MethodSettings.ILongRunning|null); - - /** MethodSettings autoPopulatedFields */ - autoPopulatedFields?: (string[]|null); - } - - /** Represents a MethodSettings. */ - class MethodSettings implements IMethodSettings { - - /** - * Constructs a new MethodSettings. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IMethodSettings); - - /** MethodSettings selector. */ - public selector: string; - - /** MethodSettings longRunning. */ - public longRunning?: (google.api.MethodSettings.ILongRunning|null); - - /** MethodSettings autoPopulatedFields. */ - public autoPopulatedFields: string[]; - - /** - * Creates a new MethodSettings instance using the specified properties. - * @param [properties] Properties to set - * @returns MethodSettings instance - */ - public static create(properties?: google.api.IMethodSettings): google.api.MethodSettings; - - /** - * Encodes the specified MethodSettings message. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. - * @param message MethodSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IMethodSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MethodSettings message, length delimited. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. - * @param message MethodSettings message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IMethodSettings, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MethodSettings message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MethodSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.MethodSettings; - - /** - * Decodes a MethodSettings message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MethodSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.MethodSettings; - - /** - * Verifies a MethodSettings message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MethodSettings message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MethodSettings - */ - public static fromObject(object: { [k: string]: any }): google.api.MethodSettings; - - /** - * Creates a plain object from a MethodSettings message. Also converts values to other types if specified. - * @param message MethodSettings - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.MethodSettings, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MethodSettings to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MethodSettings - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace MethodSettings { - - /** Properties of a LongRunning. */ - interface ILongRunning { - - /** LongRunning initialPollDelay */ - initialPollDelay?: (google.protobuf.IDuration|null); - - /** LongRunning pollDelayMultiplier */ - pollDelayMultiplier?: (number|null); - - /** LongRunning maxPollDelay */ - maxPollDelay?: (google.protobuf.IDuration|null); - - /** LongRunning totalPollTimeout */ - totalPollTimeout?: (google.protobuf.IDuration|null); - } - - /** Represents a LongRunning. */ - class LongRunning implements ILongRunning { - - /** - * Constructs a new LongRunning. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.MethodSettings.ILongRunning); - - /** LongRunning initialPollDelay. */ - public initialPollDelay?: (google.protobuf.IDuration|null); - - /** LongRunning pollDelayMultiplier. */ - public pollDelayMultiplier: number; - - /** LongRunning maxPollDelay. */ - public maxPollDelay?: (google.protobuf.IDuration|null); - - /** LongRunning totalPollTimeout. */ - public totalPollTimeout?: (google.protobuf.IDuration|null); - - /** - * Creates a new LongRunning instance using the specified properties. - * @param [properties] Properties to set - * @returns LongRunning instance - */ - public static create(properties?: google.api.MethodSettings.ILongRunning): google.api.MethodSettings.LongRunning; - - /** - * Encodes the specified LongRunning message. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. - * @param message LongRunning message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.MethodSettings.ILongRunning, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified LongRunning message, length delimited. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. - * @param message LongRunning message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.MethodSettings.ILongRunning, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a LongRunning message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns LongRunning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.MethodSettings.LongRunning; - - /** - * Decodes a LongRunning message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns LongRunning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.MethodSettings.LongRunning; - - /** - * Verifies a LongRunning message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a LongRunning message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns LongRunning - */ - public static fromObject(object: { [k: string]: any }): google.api.MethodSettings.LongRunning; - - /** - * Creates a plain object from a LongRunning message. Also converts values to other types if specified. - * @param message LongRunning - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.MethodSettings.LongRunning, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this LongRunning to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for LongRunning - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** ClientLibraryOrganization enum. */ - enum ClientLibraryOrganization { - CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED = 0, - CLOUD = 1, - ADS = 2, - PHOTOS = 3, - STREET_VIEW = 4, - SHOPPING = 5, - GEO = 6, - GENERATIVE_AI = 7 - } - - /** ClientLibraryDestination enum. */ - enum ClientLibraryDestination { - CLIENT_LIBRARY_DESTINATION_UNSPECIFIED = 0, - GITHUB = 10, - PACKAGE_MANAGER = 20 - } - - /** Properties of a SelectiveGapicGeneration. */ - interface ISelectiveGapicGeneration { - - /** SelectiveGapicGeneration methods */ - methods?: (string[]|null); - - /** SelectiveGapicGeneration generateOmittedAsInternal */ - generateOmittedAsInternal?: (boolean|null); - } - - /** Represents a SelectiveGapicGeneration. */ - class SelectiveGapicGeneration implements ISelectiveGapicGeneration { - - /** - * Constructs a new SelectiveGapicGeneration. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.ISelectiveGapicGeneration); - - /** SelectiveGapicGeneration methods. */ - public methods: string[]; - - /** SelectiveGapicGeneration generateOmittedAsInternal. */ - public generateOmittedAsInternal: boolean; - - /** - * Creates a new SelectiveGapicGeneration instance using the specified properties. - * @param [properties] Properties to set - * @returns SelectiveGapicGeneration instance - */ - public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; - - /** - * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. - * @param message SelectiveGapicGeneration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. - * @param message SelectiveGapicGeneration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SelectiveGapicGeneration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.SelectiveGapicGeneration; - - /** - * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SelectiveGapicGeneration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.SelectiveGapicGeneration; - - /** - * Verifies a SelectiveGapicGeneration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SelectiveGapicGeneration - */ - public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; - - /** - * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. - * @param message SelectiveGapicGeneration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SelectiveGapicGeneration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SelectiveGapicGeneration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** LaunchStage enum. */ - enum LaunchStage { - LAUNCH_STAGE_UNSPECIFIED = 0, - UNIMPLEMENTED = 6, - PRELAUNCH = 7, - EARLY_ACCESS = 1, - ALPHA = 2, - BETA = 3, - GA = 4, - DEPRECATED = 5 - } - - /** FieldBehavior enum. */ - enum FieldBehavior { - FIELD_BEHAVIOR_UNSPECIFIED = 0, - OPTIONAL = 1, - REQUIRED = 2, - OUTPUT_ONLY = 3, - INPUT_ONLY = 4, - IMMUTABLE = 5, - UNORDERED_LIST = 6, - NON_EMPTY_DEFAULT = 7, - IDENTIFIER = 8 - } - - /** Properties of a ResourceDescriptor. */ - interface IResourceDescriptor { - - /** ResourceDescriptor type */ - type?: (string|null); - - /** ResourceDescriptor pattern */ - pattern?: (string[]|null); - - /** ResourceDescriptor nameField */ - nameField?: (string|null); - - /** ResourceDescriptor history */ - history?: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History|null); - - /** ResourceDescriptor plural */ - plural?: (string|null); - - /** ResourceDescriptor singular */ - singular?: (string|null); - - /** ResourceDescriptor style */ - style?: (google.api.ResourceDescriptor.Style[]|null); - } - - /** Represents a ResourceDescriptor. */ - class ResourceDescriptor implements IResourceDescriptor { - - /** - * Constructs a new ResourceDescriptor. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IResourceDescriptor); - - /** ResourceDescriptor type. */ - public type: string; - - /** ResourceDescriptor pattern. */ - public pattern: string[]; - - /** ResourceDescriptor nameField. */ - public nameField: string; - - /** ResourceDescriptor history. */ - public history: (google.api.ResourceDescriptor.History|keyof typeof google.api.ResourceDescriptor.History); - - /** ResourceDescriptor plural. */ - public plural: string; - - /** ResourceDescriptor singular. */ - public singular: string; - - /** ResourceDescriptor style. */ - public style: google.api.ResourceDescriptor.Style[]; - - /** - * Creates a new ResourceDescriptor instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceDescriptor instance - */ - public static create(properties?: google.api.IResourceDescriptor): google.api.ResourceDescriptor; - - /** - * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @param message ResourceDescriptor message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @param message ResourceDescriptor message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IResourceDescriptor, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceDescriptor; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceDescriptor; - - /** - * Verifies a ResourceDescriptor message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceDescriptor - */ - public static fromObject(object: { [k: string]: any }): google.api.ResourceDescriptor; - - /** - * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. - * @param message ResourceDescriptor - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.ResourceDescriptor, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceDescriptor to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ResourceDescriptor - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ResourceDescriptor { - - /** History enum. */ - enum History { - HISTORY_UNSPECIFIED = 0, - ORIGINALLY_SINGLE_PATTERN = 1, - FUTURE_MULTI_PATTERN = 2 - } - - /** Style enum. */ - enum Style { - STYLE_UNSPECIFIED = 0, - DECLARATIVE_FRIENDLY = 1 - } - } - - /** Properties of a ResourceReference. */ - interface IResourceReference { - - /** ResourceReference type */ - type?: (string|null); - - /** ResourceReference childType */ - childType?: (string|null); - } - - /** Represents a ResourceReference. */ - class ResourceReference implements IResourceReference { - - /** - * Constructs a new ResourceReference. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IResourceReference); - - /** ResourceReference type. */ - public type: string; - - /** ResourceReference childType. */ - public childType: string; - - /** - * Creates a new ResourceReference instance using the specified properties. - * @param [properties] Properties to set - * @returns ResourceReference instance - */ - public static create(properties?: google.api.IResourceReference): google.api.ResourceReference; - - /** - * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @param message ResourceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @param message ResourceReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IResourceReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ResourceReference message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.ResourceReference; - - /** - * Decodes a ResourceReference message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.ResourceReference; - - /** - * Verifies a ResourceReference message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ResourceReference - */ - public static fromObject(object: { [k: string]: any }): google.api.ResourceReference; - - /** - * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. - * @param message ResourceReference - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.ResourceReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ResourceReference to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ResourceReference - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FieldInfo. */ - interface IFieldInfo { - - /** FieldInfo format */ - format?: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format|null); - - /** FieldInfo referencedTypes */ - referencedTypes?: (google.api.ITypeReference[]|null); - } - - /** Represents a FieldInfo. */ - class FieldInfo implements IFieldInfo { - - /** - * Constructs a new FieldInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.IFieldInfo); - - /** FieldInfo format. */ - public format: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format); - - /** FieldInfo referencedTypes. */ - public referencedTypes: google.api.ITypeReference[]; - - /** - * Creates a new FieldInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns FieldInfo instance - */ - public static create(properties?: google.api.IFieldInfo): google.api.FieldInfo; - - /** - * Encodes the specified FieldInfo message. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. - * @param message FieldInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.IFieldInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldInfo message, length delimited. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. - * @param message FieldInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.IFieldInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FieldInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.FieldInfo; - - /** - * Decodes a FieldInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FieldInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.FieldInfo; - - /** - * Verifies a FieldInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FieldInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FieldInfo - */ - public static fromObject(object: { [k: string]: any }): google.api.FieldInfo; - - /** - * Creates a plain object from a FieldInfo message. Also converts values to other types if specified. - * @param message FieldInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.FieldInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FieldInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FieldInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FieldInfo { - - /** Format enum. */ - enum Format { - FORMAT_UNSPECIFIED = 0, - UUID4 = 1, - IPV4 = 2, - IPV6 = 3, - IPV4_OR_IPV6 = 4 - } - } - - /** Properties of a TypeReference. */ - interface ITypeReference { - - /** TypeReference typeName */ - typeName?: (string|null); - } - - /** Represents a TypeReference. */ - class TypeReference implements ITypeReference { - - /** - * Constructs a new TypeReference. - * @param [properties] Properties to set - */ - constructor(properties?: google.api.ITypeReference); - - /** TypeReference typeName. */ - public typeName: string; - - /** - * Creates a new TypeReference instance using the specified properties. - * @param [properties] Properties to set - * @returns TypeReference instance - */ - public static create(properties?: google.api.ITypeReference): google.api.TypeReference; - - /** - * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. - * @param message TypeReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. - * @param message TypeReference message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a TypeReference message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns TypeReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.TypeReference; - - /** - * Decodes a TypeReference message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns TypeReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.TypeReference; - - /** - * Verifies a TypeReference message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a TypeReference message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns TypeReference - */ - public static fromObject(object: { [k: string]: any }): google.api.TypeReference; - - /** - * Creates a plain object from a TypeReference message. Also converts values to other types if specified. - * @param message TypeReference - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.api.TypeReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this TypeReference to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for TypeReference - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Namespace protobuf. */ - namespace protobuf { - - /** Properties of a FileDescriptorSet. */ - interface IFileDescriptorSet { - - /** FileDescriptorSet file */ - file?: (google.protobuf.IFileDescriptorProto[]|null); - } - - /** Represents a FileDescriptorSet. */ - class FileDescriptorSet implements IFileDescriptorSet { - - /** - * Constructs a new FileDescriptorSet. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFileDescriptorSet); - - /** FileDescriptorSet file. */ - public file: google.protobuf.IFileDescriptorProto[]; - - /** - * Creates a new FileDescriptorSet instance using the specified properties. - * @param [properties] Properties to set - * @returns FileDescriptorSet instance - */ - public static create(properties?: google.protobuf.IFileDescriptorSet): google.protobuf.FileDescriptorSet; - - /** - * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. - * @param message FileDescriptorSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. - * @param message FileDescriptorSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFileDescriptorSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FileDescriptorSet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FileDescriptorSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorSet; - - /** - * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FileDescriptorSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorSet; - - /** - * Verifies a FileDescriptorSet message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FileDescriptorSet - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorSet; - - /** - * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. - * @param message FileDescriptorSet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FileDescriptorSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FileDescriptorSet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FileDescriptorSet - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Edition enum. */ - enum Edition { - EDITION_UNKNOWN = 0, - EDITION_LEGACY = 900, - EDITION_PROTO2 = 998, - EDITION_PROTO3 = 999, - EDITION_2023 = 1000, - EDITION_2024 = 1001, - EDITION_1_TEST_ONLY = 1, - EDITION_2_TEST_ONLY = 2, - EDITION_99997_TEST_ONLY = 99997, - EDITION_99998_TEST_ONLY = 99998, - EDITION_99999_TEST_ONLY = 99999, - EDITION_MAX = 2147483647 - } - - /** Properties of a FileDescriptorProto. */ - interface IFileDescriptorProto { - - /** FileDescriptorProto name */ - name?: (string|null); - - /** FileDescriptorProto package */ - "package"?: (string|null); - - /** FileDescriptorProto dependency */ - dependency?: (string[]|null); - - /** FileDescriptorProto publicDependency */ - publicDependency?: (number[]|null); - - /** FileDescriptorProto weakDependency */ - weakDependency?: (number[]|null); - - /** FileDescriptorProto optionDependency */ - optionDependency?: (string[]|null); - - /** FileDescriptorProto messageType */ - messageType?: (google.protobuf.IDescriptorProto[]|null); - - /** FileDescriptorProto enumType */ - enumType?: (google.protobuf.IEnumDescriptorProto[]|null); - - /** FileDescriptorProto service */ - service?: (google.protobuf.IServiceDescriptorProto[]|null); - - /** FileDescriptorProto extension */ - extension?: (google.protobuf.IFieldDescriptorProto[]|null); - - /** FileDescriptorProto options */ - options?: (google.protobuf.IFileOptions|null); - - /** FileDescriptorProto sourceCodeInfo */ - sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); - - /** FileDescriptorProto syntax */ - syntax?: (string|null); - - /** FileDescriptorProto edition */ - edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - } - - /** Represents a FileDescriptorProto. */ - class FileDescriptorProto implements IFileDescriptorProto { - - /** - * Constructs a new FileDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFileDescriptorProto); - - /** FileDescriptorProto name. */ - public name: string; - - /** FileDescriptorProto package. */ - public package: string; - - /** FileDescriptorProto dependency. */ - public dependency: string[]; - - /** FileDescriptorProto publicDependency. */ - public publicDependency: number[]; - - /** FileDescriptorProto weakDependency. */ - public weakDependency: number[]; - - /** FileDescriptorProto optionDependency. */ - public optionDependency: string[]; - - /** FileDescriptorProto messageType. */ - public messageType: google.protobuf.IDescriptorProto[]; - - /** FileDescriptorProto enumType. */ - public enumType: google.protobuf.IEnumDescriptorProto[]; - - /** FileDescriptorProto service. */ - public service: google.protobuf.IServiceDescriptorProto[]; - - /** FileDescriptorProto extension. */ - public extension: google.protobuf.IFieldDescriptorProto[]; - - /** FileDescriptorProto options. */ - public options?: (google.protobuf.IFileOptions|null); - - /** FileDescriptorProto sourceCodeInfo. */ - public sourceCodeInfo?: (google.protobuf.ISourceCodeInfo|null); - - /** FileDescriptorProto syntax. */ - public syntax: string; - - /** FileDescriptorProto edition. */ - public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - - /** - * Creates a new FileDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns FileDescriptorProto instance - */ - public static create(properties?: google.protobuf.IFileDescriptorProto): google.protobuf.FileDescriptorProto; - - /** - * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. - * @param message FileDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. - * @param message FileDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFileDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FileDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FileDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileDescriptorProto; - - /** - * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FileDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileDescriptorProto; - - /** - * Verifies a FileDescriptorProto message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FileDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FileDescriptorProto; - - /** - * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. - * @param message FileDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FileDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FileDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FileDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DescriptorProto. */ - interface IDescriptorProto { - - /** DescriptorProto name */ - name?: (string|null); - - /** DescriptorProto field */ - field?: (google.protobuf.IFieldDescriptorProto[]|null); - - /** DescriptorProto extension */ - extension?: (google.protobuf.IFieldDescriptorProto[]|null); - - /** DescriptorProto nestedType */ - nestedType?: (google.protobuf.IDescriptorProto[]|null); - - /** DescriptorProto enumType */ - enumType?: (google.protobuf.IEnumDescriptorProto[]|null); - - /** DescriptorProto extensionRange */ - extensionRange?: (google.protobuf.DescriptorProto.IExtensionRange[]|null); - - /** DescriptorProto oneofDecl */ - oneofDecl?: (google.protobuf.IOneofDescriptorProto[]|null); - - /** DescriptorProto options */ - options?: (google.protobuf.IMessageOptions|null); - - /** DescriptorProto reservedRange */ - reservedRange?: (google.protobuf.DescriptorProto.IReservedRange[]|null); - - /** DescriptorProto reservedName */ - reservedName?: (string[]|null); - - /** DescriptorProto visibility */ - visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); - } - - /** Represents a DescriptorProto. */ - class DescriptorProto implements IDescriptorProto { - - /** - * Constructs a new DescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IDescriptorProto); - - /** DescriptorProto name. */ - public name: string; - - /** DescriptorProto field. */ - public field: google.protobuf.IFieldDescriptorProto[]; - - /** DescriptorProto extension. */ - public extension: google.protobuf.IFieldDescriptorProto[]; - - /** DescriptorProto nestedType. */ - public nestedType: google.protobuf.IDescriptorProto[]; - - /** DescriptorProto enumType. */ - public enumType: google.protobuf.IEnumDescriptorProto[]; - - /** DescriptorProto extensionRange. */ - public extensionRange: google.protobuf.DescriptorProto.IExtensionRange[]; - - /** DescriptorProto oneofDecl. */ - public oneofDecl: google.protobuf.IOneofDescriptorProto[]; - - /** DescriptorProto options. */ - public options?: (google.protobuf.IMessageOptions|null); - - /** DescriptorProto reservedRange. */ - public reservedRange: google.protobuf.DescriptorProto.IReservedRange[]; - - /** DescriptorProto reservedName. */ - public reservedName: string[]; - - /** DescriptorProto visibility. */ - public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); - - /** - * Creates a new DescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns DescriptorProto instance - */ - public static create(properties?: google.protobuf.IDescriptorProto): google.protobuf.DescriptorProto; - - /** - * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @param message DescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @param message DescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto; - - /** - * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto; - - /** - * Verifies a DescriptorProto message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto; - - /** - * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. - * @param message DescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.DescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace DescriptorProto { - - /** Properties of an ExtensionRange. */ - interface IExtensionRange { - - /** ExtensionRange start */ - start?: (number|null); - - /** ExtensionRange end */ - end?: (number|null); - - /** ExtensionRange options */ - options?: (google.protobuf.IExtensionRangeOptions|null); - } - - /** Represents an ExtensionRange. */ - class ExtensionRange implements IExtensionRange { - - /** - * Constructs a new ExtensionRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.DescriptorProto.IExtensionRange); - - /** ExtensionRange start. */ - public start: number; - - /** ExtensionRange end. */ - public end: number; - - /** ExtensionRange options. */ - public options?: (google.protobuf.IExtensionRangeOptions|null); - - /** - * Creates a new ExtensionRange instance using the specified properties. - * @param [properties] Properties to set - * @returns ExtensionRange instance - */ - public static create(properties?: google.protobuf.DescriptorProto.IExtensionRange): google.protobuf.DescriptorProto.ExtensionRange; - - /** - * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @param message ExtensionRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @param message ExtensionRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.DescriptorProto.IExtensionRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExtensionRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExtensionRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ExtensionRange; - - /** - * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExtensionRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ExtensionRange; - - /** - * Verifies an ExtensionRange message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExtensionRange - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ExtensionRange; - - /** - * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. - * @param message ExtensionRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.DescriptorProto.ExtensionRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExtensionRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExtensionRange - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ReservedRange. */ - interface IReservedRange { - - /** ReservedRange start */ - start?: (number|null); - - /** ReservedRange end */ - end?: (number|null); - } - - /** Represents a ReservedRange. */ - class ReservedRange implements IReservedRange { - - /** - * Constructs a new ReservedRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.DescriptorProto.IReservedRange); - - /** ReservedRange start. */ - public start: number; - - /** ReservedRange end. */ - public end: number; - - /** - * Creates a new ReservedRange instance using the specified properties. - * @param [properties] Properties to set - * @returns ReservedRange instance - */ - public static create(properties?: google.protobuf.DescriptorProto.IReservedRange): google.protobuf.DescriptorProto.ReservedRange; - - /** - * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @param message ReservedRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @param message ReservedRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.DescriptorProto.IReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ReservedRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DescriptorProto.ReservedRange; - - /** - * Decodes a ReservedRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DescriptorProto.ReservedRange; - - /** - * Verifies a ReservedRange message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ReservedRange - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.DescriptorProto.ReservedRange; - - /** - * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. - * @param message ReservedRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.DescriptorProto.ReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ReservedRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ReservedRange - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of an ExtensionRangeOptions. */ - interface IExtensionRangeOptions { - - /** ExtensionRangeOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** ExtensionRangeOptions declaration */ - declaration?: (google.protobuf.ExtensionRangeOptions.IDeclaration[]|null); - - /** ExtensionRangeOptions features */ - features?: (google.protobuf.IFeatureSet|null); - - /** ExtensionRangeOptions verification */ - verification?: (google.protobuf.ExtensionRangeOptions.VerificationState|keyof typeof google.protobuf.ExtensionRangeOptions.VerificationState|null); - } - - /** Represents an ExtensionRangeOptions. */ - class ExtensionRangeOptions implements IExtensionRangeOptions { - - /** - * Constructs a new ExtensionRangeOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IExtensionRangeOptions); - - /** ExtensionRangeOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** ExtensionRangeOptions declaration. */ - public declaration: google.protobuf.ExtensionRangeOptions.IDeclaration[]; - - /** ExtensionRangeOptions features. */ - public features?: (google.protobuf.IFeatureSet|null); - - /** ExtensionRangeOptions verification. */ - public verification: (google.protobuf.ExtensionRangeOptions.VerificationState|keyof typeof google.protobuf.ExtensionRangeOptions.VerificationState); - - /** - * Creates a new ExtensionRangeOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns ExtensionRangeOptions instance - */ - public static create(properties?: google.protobuf.IExtensionRangeOptions): google.protobuf.ExtensionRangeOptions; - - /** - * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. - * @param message ExtensionRangeOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. - * @param message ExtensionRangeOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IExtensionRangeOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an ExtensionRangeOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ExtensionRangeOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions; - - /** - * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ExtensionRangeOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions; - - /** - * Verifies an ExtensionRangeOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ExtensionRangeOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions; - - /** - * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. - * @param message ExtensionRangeOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.ExtensionRangeOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ExtensionRangeOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ExtensionRangeOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace ExtensionRangeOptions { - - /** Properties of a Declaration. */ - interface IDeclaration { - - /** Declaration number */ - number?: (number|null); - - /** Declaration fullName */ - fullName?: (string|null); - - /** Declaration type */ - type?: (string|null); - - /** Declaration reserved */ - reserved?: (boolean|null); - - /** Declaration repeated */ - repeated?: (boolean|null); - } - - /** Represents a Declaration. */ - class Declaration implements IDeclaration { - - /** - * Constructs a new Declaration. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.ExtensionRangeOptions.IDeclaration); - - /** Declaration number. */ - public number: number; - - /** Declaration fullName. */ - public fullName: string; - - /** Declaration type. */ - public type: string; - - /** Declaration reserved. */ - public reserved: boolean; - - /** Declaration repeated. */ - public repeated: boolean; - - /** - * Creates a new Declaration instance using the specified properties. - * @param [properties] Properties to set - * @returns Declaration instance - */ - public static create(properties?: google.protobuf.ExtensionRangeOptions.IDeclaration): google.protobuf.ExtensionRangeOptions.Declaration; - - /** - * Encodes the specified Declaration message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. - * @param message Declaration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.ExtensionRangeOptions.IDeclaration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Declaration message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. - * @param message Declaration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.ExtensionRangeOptions.IDeclaration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Declaration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Declaration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ExtensionRangeOptions.Declaration; - - /** - * Decodes a Declaration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Declaration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ExtensionRangeOptions.Declaration; - - /** - * Verifies a Declaration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Declaration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Declaration - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.ExtensionRangeOptions.Declaration; - - /** - * Creates a plain object from a Declaration message. Also converts values to other types if specified. - * @param message Declaration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.ExtensionRangeOptions.Declaration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Declaration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Declaration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** VerificationState enum. */ - enum VerificationState { - DECLARATION = 0, - UNVERIFIED = 1 - } - } - - /** Properties of a FieldDescriptorProto. */ - interface IFieldDescriptorProto { - - /** FieldDescriptorProto name */ - name?: (string|null); - - /** FieldDescriptorProto number */ - number?: (number|null); - - /** FieldDescriptorProto label */ - label?: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label|null); - - /** FieldDescriptorProto type */ - type?: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type|null); - - /** FieldDescriptorProto typeName */ - typeName?: (string|null); - - /** FieldDescriptorProto extendee */ - extendee?: (string|null); - - /** FieldDescriptorProto defaultValue */ - defaultValue?: (string|null); - - /** FieldDescriptorProto oneofIndex */ - oneofIndex?: (number|null); - - /** FieldDescriptorProto jsonName */ - jsonName?: (string|null); - - /** FieldDescriptorProto options */ - options?: (google.protobuf.IFieldOptions|null); - - /** FieldDescriptorProto proto3Optional */ - proto3Optional?: (boolean|null); - } - - /** Represents a FieldDescriptorProto. */ - class FieldDescriptorProto implements IFieldDescriptorProto { - - /** - * Constructs a new FieldDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFieldDescriptorProto); - - /** FieldDescriptorProto name. */ - public name: string; - - /** FieldDescriptorProto number. */ - public number: number; - - /** FieldDescriptorProto label. */ - public label: (google.protobuf.FieldDescriptorProto.Label|keyof typeof google.protobuf.FieldDescriptorProto.Label); - - /** FieldDescriptorProto type. */ - public type: (google.protobuf.FieldDescriptorProto.Type|keyof typeof google.protobuf.FieldDescriptorProto.Type); - - /** FieldDescriptorProto typeName. */ - public typeName: string; - - /** FieldDescriptorProto extendee. */ - public extendee: string; - - /** FieldDescriptorProto defaultValue. */ - public defaultValue: string; - - /** FieldDescriptorProto oneofIndex. */ - public oneofIndex: number; - - /** FieldDescriptorProto jsonName. */ - public jsonName: string; - - /** FieldDescriptorProto options. */ - public options?: (google.protobuf.IFieldOptions|null); - - /** FieldDescriptorProto proto3Optional. */ - public proto3Optional: boolean; - - /** - * Creates a new FieldDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns FieldDescriptorProto instance - */ - public static create(properties?: google.protobuf.IFieldDescriptorProto): google.protobuf.FieldDescriptorProto; - - /** - * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @param message FieldDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @param message FieldDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFieldDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FieldDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldDescriptorProto; - - /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FieldDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldDescriptorProto; - - /** - * Verifies a FieldDescriptorProto message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FieldDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldDescriptorProto; - - /** - * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. - * @param message FieldDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FieldDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FieldDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FieldDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FieldDescriptorProto { - - /** Type enum. */ - enum Type { - TYPE_DOUBLE = 1, - TYPE_FLOAT = 2, - TYPE_INT64 = 3, - TYPE_UINT64 = 4, - TYPE_INT32 = 5, - TYPE_FIXED64 = 6, - TYPE_FIXED32 = 7, - TYPE_BOOL = 8, - TYPE_STRING = 9, - TYPE_GROUP = 10, - TYPE_MESSAGE = 11, - TYPE_BYTES = 12, - TYPE_UINT32 = 13, - TYPE_ENUM = 14, - TYPE_SFIXED32 = 15, - TYPE_SFIXED64 = 16, - TYPE_SINT32 = 17, - TYPE_SINT64 = 18 - } - - /** Label enum. */ - enum Label { - LABEL_OPTIONAL = 1, - LABEL_REPEATED = 3, - LABEL_REQUIRED = 2 - } - } - - /** Properties of an OneofDescriptorProto. */ - interface IOneofDescriptorProto { - - /** OneofDescriptorProto name */ - name?: (string|null); - - /** OneofDescriptorProto options */ - options?: (google.protobuf.IOneofOptions|null); - } - - /** Represents an OneofDescriptorProto. */ - class OneofDescriptorProto implements IOneofDescriptorProto { - - /** - * Constructs a new OneofDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IOneofDescriptorProto); - - /** OneofDescriptorProto name. */ - public name: string; - - /** OneofDescriptorProto options. */ - public options?: (google.protobuf.IOneofOptions|null); - - /** - * Creates a new OneofDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns OneofDescriptorProto instance - */ - public static create(properties?: google.protobuf.IOneofDescriptorProto): google.protobuf.OneofDescriptorProto; - - /** - * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @param message OneofDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @param message OneofDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IOneofDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OneofDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofDescriptorProto; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OneofDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofDescriptorProto; - - /** - * Verifies an OneofDescriptorProto message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OneofDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.OneofDescriptorProto; - - /** - * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. - * @param message OneofDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.OneofDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OneofDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OneofDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an EnumDescriptorProto. */ - interface IEnumDescriptorProto { - - /** EnumDescriptorProto name */ - name?: (string|null); - - /** EnumDescriptorProto value */ - value?: (google.protobuf.IEnumValueDescriptorProto[]|null); - - /** EnumDescriptorProto options */ - options?: (google.protobuf.IEnumOptions|null); - - /** EnumDescriptorProto reservedRange */ - reservedRange?: (google.protobuf.EnumDescriptorProto.IEnumReservedRange[]|null); - - /** EnumDescriptorProto reservedName */ - reservedName?: (string[]|null); - - /** EnumDescriptorProto visibility */ - visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); - } - - /** Represents an EnumDescriptorProto. */ - class EnumDescriptorProto implements IEnumDescriptorProto { - - /** - * Constructs a new EnumDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEnumDescriptorProto); - - /** EnumDescriptorProto name. */ - public name: string; - - /** EnumDescriptorProto value. */ - public value: google.protobuf.IEnumValueDescriptorProto[]; - - /** EnumDescriptorProto options. */ - public options?: (google.protobuf.IEnumOptions|null); - - /** EnumDescriptorProto reservedRange. */ - public reservedRange: google.protobuf.EnumDescriptorProto.IEnumReservedRange[]; - - /** EnumDescriptorProto reservedName. */ - public reservedName: string[]; - - /** EnumDescriptorProto visibility. */ - public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); - - /** - * Creates a new EnumDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumDescriptorProto instance - */ - public static create(properties?: google.protobuf.IEnumDescriptorProto): google.protobuf.EnumDescriptorProto; - - /** - * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @param message EnumDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @param message EnumDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEnumDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto; - - /** - * Verifies an EnumDescriptorProto message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto; - - /** - * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. - * @param message EnumDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.EnumDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EnumDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EnumDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace EnumDescriptorProto { - - /** Properties of an EnumReservedRange. */ - interface IEnumReservedRange { - - /** EnumReservedRange start */ - start?: (number|null); - - /** EnumReservedRange end */ - end?: (number|null); - } - - /** Represents an EnumReservedRange. */ - class EnumReservedRange implements IEnumReservedRange { - - /** - * Constructs a new EnumReservedRange. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange); - - /** EnumReservedRange start. */ - public start: number; - - /** EnumReservedRange end. */ - public end: number; - - /** - * Creates a new EnumReservedRange instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumReservedRange instance - */ - public static create(properties?: google.protobuf.EnumDescriptorProto.IEnumReservedRange): google.protobuf.EnumDescriptorProto.EnumReservedRange; - - /** - * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. - * @param message EnumReservedRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. - * @param message EnumReservedRange message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.EnumDescriptorProto.IEnumReservedRange, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EnumReservedRange message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumDescriptorProto.EnumReservedRange; - - /** - * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumDescriptorProto.EnumReservedRange; - - /** - * Verifies an EnumReservedRange message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumReservedRange - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.EnumDescriptorProto.EnumReservedRange; - - /** - * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. - * @param message EnumReservedRange - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.EnumDescriptorProto.EnumReservedRange, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EnumReservedRange to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EnumReservedRange - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of an EnumValueDescriptorProto. */ - interface IEnumValueDescriptorProto { - - /** EnumValueDescriptorProto name */ - name?: (string|null); - - /** EnumValueDescriptorProto number */ - number?: (number|null); - - /** EnumValueDescriptorProto options */ - options?: (google.protobuf.IEnumValueOptions|null); - } - - /** Represents an EnumValueDescriptorProto. */ - class EnumValueDescriptorProto implements IEnumValueDescriptorProto { - - /** - * Constructs a new EnumValueDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEnumValueDescriptorProto); - - /** EnumValueDescriptorProto name. */ - public name: string; - - /** EnumValueDescriptorProto number. */ - public number: number; - - /** EnumValueDescriptorProto options. */ - public options?: (google.protobuf.IEnumValueOptions|null); - - /** - * Creates a new EnumValueDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumValueDescriptorProto instance - */ - public static create(properties?: google.protobuf.IEnumValueDescriptorProto): google.protobuf.EnumValueDescriptorProto; - - /** - * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. - * @param message EnumValueDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. - * @param message EnumValueDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEnumValueDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumValueDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueDescriptorProto; - - /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumValueDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueDescriptorProto; - - /** - * Verifies an EnumValueDescriptorProto message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumValueDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueDescriptorProto; - - /** - * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. - * @param message EnumValueDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.EnumValueDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EnumValueDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EnumValueDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ServiceDescriptorProto. */ - interface IServiceDescriptorProto { - - /** ServiceDescriptorProto name */ - name?: (string|null); - - /** ServiceDescriptorProto method */ - method?: (google.protobuf.IMethodDescriptorProto[]|null); - - /** ServiceDescriptorProto options */ - options?: (google.protobuf.IServiceOptions|null); - } - - /** Represents a ServiceDescriptorProto. */ - class ServiceDescriptorProto implements IServiceDescriptorProto { - - /** - * Constructs a new ServiceDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IServiceDescriptorProto); - - /** ServiceDescriptorProto name. */ - public name: string; - - /** ServiceDescriptorProto method. */ - public method: google.protobuf.IMethodDescriptorProto[]; - - /** ServiceDescriptorProto options. */ - public options?: (google.protobuf.IServiceOptions|null); - - /** - * Creates a new ServiceDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns ServiceDescriptorProto instance - */ - public static create(properties?: google.protobuf.IServiceDescriptorProto): google.protobuf.ServiceDescriptorProto; - - /** - * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. - * @param message ServiceDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. - * @param message ServiceDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IServiceDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ServiceDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceDescriptorProto; - - /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ServiceDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceDescriptorProto; - - /** - * Verifies a ServiceDescriptorProto message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ServiceDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceDescriptorProto; - - /** - * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. - * @param message ServiceDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.ServiceDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ServiceDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ServiceDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MethodDescriptorProto. */ - interface IMethodDescriptorProto { - - /** MethodDescriptorProto name */ - name?: (string|null); - - /** MethodDescriptorProto inputType */ - inputType?: (string|null); - - /** MethodDescriptorProto outputType */ - outputType?: (string|null); - - /** MethodDescriptorProto options */ - options?: (google.protobuf.IMethodOptions|null); - - /** MethodDescriptorProto clientStreaming */ - clientStreaming?: (boolean|null); - - /** MethodDescriptorProto serverStreaming */ - serverStreaming?: (boolean|null); - } - - /** Represents a MethodDescriptorProto. */ - class MethodDescriptorProto implements IMethodDescriptorProto { - - /** - * Constructs a new MethodDescriptorProto. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IMethodDescriptorProto); - - /** MethodDescriptorProto name. */ - public name: string; - - /** MethodDescriptorProto inputType. */ - public inputType: string; - - /** MethodDescriptorProto outputType. */ - public outputType: string; - - /** MethodDescriptorProto options. */ - public options?: (google.protobuf.IMethodOptions|null); - - /** MethodDescriptorProto clientStreaming. */ - public clientStreaming: boolean; - - /** MethodDescriptorProto serverStreaming. */ - public serverStreaming: boolean; - - /** - * Creates a new MethodDescriptorProto instance using the specified properties. - * @param [properties] Properties to set - * @returns MethodDescriptorProto instance - */ - public static create(properties?: google.protobuf.IMethodDescriptorProto): google.protobuf.MethodDescriptorProto; - - /** - * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. - * @param message MethodDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. - * @param message MethodDescriptorProto message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IMethodDescriptorProto, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MethodDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodDescriptorProto; - - /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MethodDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodDescriptorProto; - - /** - * Verifies a MethodDescriptorProto message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MethodDescriptorProto - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.MethodDescriptorProto; - - /** - * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. - * @param message MethodDescriptorProto - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.MethodDescriptorProto, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MethodDescriptorProto to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MethodDescriptorProto - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FileOptions. */ - interface IFileOptions { - - /** FileOptions javaPackage */ - javaPackage?: (string|null); - - /** FileOptions javaOuterClassname */ - javaOuterClassname?: (string|null); - - /** FileOptions javaMultipleFiles */ - javaMultipleFiles?: (boolean|null); - - /** FileOptions javaGenerateEqualsAndHash */ - javaGenerateEqualsAndHash?: (boolean|null); - - /** FileOptions javaStringCheckUtf8 */ - javaStringCheckUtf8?: (boolean|null); - - /** FileOptions optimizeFor */ - optimizeFor?: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode|null); - - /** FileOptions goPackage */ - goPackage?: (string|null); - - /** FileOptions ccGenericServices */ - ccGenericServices?: (boolean|null); - - /** FileOptions javaGenericServices */ - javaGenericServices?: (boolean|null); - - /** FileOptions pyGenericServices */ - pyGenericServices?: (boolean|null); - - /** FileOptions deprecated */ - deprecated?: (boolean|null); - - /** FileOptions ccEnableArenas */ - ccEnableArenas?: (boolean|null); - - /** FileOptions objcClassPrefix */ - objcClassPrefix?: (string|null); - - /** FileOptions csharpNamespace */ - csharpNamespace?: (string|null); - - /** FileOptions swiftPrefix */ - swiftPrefix?: (string|null); - - /** FileOptions phpClassPrefix */ - phpClassPrefix?: (string|null); - - /** FileOptions phpNamespace */ - phpNamespace?: (string|null); - - /** FileOptions phpMetadataNamespace */ - phpMetadataNamespace?: (string|null); - - /** FileOptions rubyPackage */ - rubyPackage?: (string|null); - - /** FileOptions features */ - features?: (google.protobuf.IFeatureSet|null); - - /** FileOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** FileOptions .google.api.resourceDefinition */ - ".google.api.resourceDefinition"?: (google.api.IResourceDescriptor[]|null); - } - - /** Represents a FileOptions. */ - class FileOptions implements IFileOptions { - - /** - * Constructs a new FileOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFileOptions); - - /** FileOptions javaPackage. */ - public javaPackage: string; - - /** FileOptions javaOuterClassname. */ - public javaOuterClassname: string; - - /** FileOptions javaMultipleFiles. */ - public javaMultipleFiles: boolean; - - /** FileOptions javaGenerateEqualsAndHash. */ - public javaGenerateEqualsAndHash: boolean; - - /** FileOptions javaStringCheckUtf8. */ - public javaStringCheckUtf8: boolean; - - /** FileOptions optimizeFor. */ - public optimizeFor: (google.protobuf.FileOptions.OptimizeMode|keyof typeof google.protobuf.FileOptions.OptimizeMode); - - /** FileOptions goPackage. */ - public goPackage: string; - - /** FileOptions ccGenericServices. */ - public ccGenericServices: boolean; - - /** FileOptions javaGenericServices. */ - public javaGenericServices: boolean; - - /** FileOptions pyGenericServices. */ - public pyGenericServices: boolean; - - /** FileOptions deprecated. */ - public deprecated: boolean; - - /** FileOptions ccEnableArenas. */ - public ccEnableArenas: boolean; - - /** FileOptions objcClassPrefix. */ - public objcClassPrefix: string; - - /** FileOptions csharpNamespace. */ - public csharpNamespace: string; - - /** FileOptions swiftPrefix. */ - public swiftPrefix: string; - - /** FileOptions phpClassPrefix. */ - public phpClassPrefix: string; - - /** FileOptions phpNamespace. */ - public phpNamespace: string; - - /** FileOptions phpMetadataNamespace. */ - public phpMetadataNamespace: string; - - /** FileOptions rubyPackage. */ - public rubyPackage: string; - - /** FileOptions features. */ - public features?: (google.protobuf.IFeatureSet|null); - - /** FileOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new FileOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns FileOptions instance - */ - public static create(properties?: google.protobuf.IFileOptions): google.protobuf.FileOptions; - - /** - * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @param message FileOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @param message FileOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFileOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FileOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FileOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FileOptions; - - /** - * Decodes a FileOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FileOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FileOptions; - - /** - * Verifies a FileOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FileOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FileOptions; - - /** - * Creates a plain object from a FileOptions message. Also converts values to other types if specified. - * @param message FileOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FileOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FileOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FileOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FileOptions { - - /** OptimizeMode enum. */ - enum OptimizeMode { - SPEED = 1, - CODE_SIZE = 2, - LITE_RUNTIME = 3 - } - } - - /** Properties of a MessageOptions. */ - interface IMessageOptions { - - /** MessageOptions messageSetWireFormat */ - messageSetWireFormat?: (boolean|null); - - /** MessageOptions noStandardDescriptorAccessor */ - noStandardDescriptorAccessor?: (boolean|null); - - /** MessageOptions deprecated */ - deprecated?: (boolean|null); - - /** MessageOptions mapEntry */ - mapEntry?: (boolean|null); - - /** MessageOptions deprecatedLegacyJsonFieldConflicts */ - deprecatedLegacyJsonFieldConflicts?: (boolean|null); - - /** MessageOptions features */ - features?: (google.protobuf.IFeatureSet|null); - - /** MessageOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** MessageOptions .google.api.resource */ - ".google.api.resource"?: (google.api.IResourceDescriptor|null); - } - - /** Represents a MessageOptions. */ - class MessageOptions implements IMessageOptions { - - /** - * Constructs a new MessageOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IMessageOptions); - - /** MessageOptions messageSetWireFormat. */ - public messageSetWireFormat: boolean; - - /** MessageOptions noStandardDescriptorAccessor. */ - public noStandardDescriptorAccessor: boolean; - - /** MessageOptions deprecated. */ - public deprecated: boolean; - - /** MessageOptions mapEntry. */ - public mapEntry: boolean; - - /** MessageOptions deprecatedLegacyJsonFieldConflicts. */ - public deprecatedLegacyJsonFieldConflicts: boolean; - - /** MessageOptions features. */ - public features?: (google.protobuf.IFeatureSet|null); - - /** MessageOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new MessageOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns MessageOptions instance - */ - public static create(properties?: google.protobuf.IMessageOptions): google.protobuf.MessageOptions; - - /** - * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @param message MessageOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @param message MessageOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IMessageOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MessageOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MessageOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MessageOptions; - - /** - * Decodes a MessageOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MessageOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MessageOptions; - - /** - * Verifies a MessageOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MessageOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.MessageOptions; - - /** - * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. - * @param message MessageOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.MessageOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MessageOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MessageOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FieldOptions. */ - interface IFieldOptions { - - /** FieldOptions ctype */ - ctype?: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType|null); - - /** FieldOptions packed */ - packed?: (boolean|null); - - /** FieldOptions jstype */ - jstype?: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType|null); - - /** FieldOptions lazy */ - lazy?: (boolean|null); - - /** FieldOptions unverifiedLazy */ - unverifiedLazy?: (boolean|null); - - /** FieldOptions deprecated */ - deprecated?: (boolean|null); - - /** FieldOptions weak */ - weak?: (boolean|null); - - /** FieldOptions debugRedact */ - debugRedact?: (boolean|null); - - /** FieldOptions retention */ - retention?: (google.protobuf.FieldOptions.OptionRetention|keyof typeof google.protobuf.FieldOptions.OptionRetention|null); - - /** FieldOptions targets */ - targets?: (google.protobuf.FieldOptions.OptionTargetType[]|null); - - /** FieldOptions editionDefaults */ - editionDefaults?: (google.protobuf.FieldOptions.IEditionDefault[]|null); - - /** FieldOptions features */ - features?: (google.protobuf.IFeatureSet|null); - - /** FieldOptions featureSupport */ - featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); - - /** FieldOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** FieldOptions .google.api.fieldBehavior */ - ".google.api.fieldBehavior"?: (google.api.FieldBehavior[]|null); - - /** FieldOptions .google.api.resourceReference */ - ".google.api.resourceReference"?: (google.api.IResourceReference|null); - - /** FieldOptions .google.api.fieldInfo */ - ".google.api.fieldInfo"?: (google.api.IFieldInfo|null); - } - - /** Represents a FieldOptions. */ - class FieldOptions implements IFieldOptions { - - /** - * Constructs a new FieldOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFieldOptions); - - /** FieldOptions ctype. */ - public ctype: (google.protobuf.FieldOptions.CType|keyof typeof google.protobuf.FieldOptions.CType); - - /** FieldOptions packed. */ - public packed: boolean; - - /** FieldOptions jstype. */ - public jstype: (google.protobuf.FieldOptions.JSType|keyof typeof google.protobuf.FieldOptions.JSType); - - /** FieldOptions lazy. */ - public lazy: boolean; - - /** FieldOptions unverifiedLazy. */ - public unverifiedLazy: boolean; - - /** FieldOptions deprecated. */ - public deprecated: boolean; - - /** FieldOptions weak. */ - public weak: boolean; - - /** FieldOptions debugRedact. */ - public debugRedact: boolean; - - /** FieldOptions retention. */ - public retention: (google.protobuf.FieldOptions.OptionRetention|keyof typeof google.protobuf.FieldOptions.OptionRetention); - - /** FieldOptions targets. */ - public targets: google.protobuf.FieldOptions.OptionTargetType[]; - - /** FieldOptions editionDefaults. */ - public editionDefaults: google.protobuf.FieldOptions.IEditionDefault[]; - - /** FieldOptions features. */ - public features?: (google.protobuf.IFeatureSet|null); - - /** FieldOptions featureSupport. */ - public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); - - /** FieldOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new FieldOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns FieldOptions instance - */ - public static create(properties?: google.protobuf.IFieldOptions): google.protobuf.FieldOptions; - - /** - * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. - * @param message FieldOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. - * @param message FieldOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFieldOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FieldOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions; - - /** - * Decodes a FieldOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FieldOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions; - - /** - * Verifies a FieldOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FieldOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions; - - /** - * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. - * @param message FieldOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FieldOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FieldOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FieldOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FieldOptions { - - /** CType enum. */ - enum CType { - STRING = 0, - CORD = 1, - STRING_PIECE = 2 - } - - /** JSType enum. */ - enum JSType { - JS_NORMAL = 0, - JS_STRING = 1, - JS_NUMBER = 2 - } - - /** OptionRetention enum. */ - enum OptionRetention { - RETENTION_UNKNOWN = 0, - RETENTION_RUNTIME = 1, - RETENTION_SOURCE = 2 - } - - /** OptionTargetType enum. */ - enum OptionTargetType { - TARGET_TYPE_UNKNOWN = 0, - TARGET_TYPE_FILE = 1, - TARGET_TYPE_EXTENSION_RANGE = 2, - TARGET_TYPE_MESSAGE = 3, - TARGET_TYPE_FIELD = 4, - TARGET_TYPE_ONEOF = 5, - TARGET_TYPE_ENUM = 6, - TARGET_TYPE_ENUM_ENTRY = 7, - TARGET_TYPE_SERVICE = 8, - TARGET_TYPE_METHOD = 9 - } - - /** Properties of an EditionDefault. */ - interface IEditionDefault { - - /** EditionDefault edition */ - edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - - /** EditionDefault value */ - value?: (string|null); - } - - /** Represents an EditionDefault. */ - class EditionDefault implements IEditionDefault { - - /** - * Constructs a new EditionDefault. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.FieldOptions.IEditionDefault); - - /** EditionDefault edition. */ - public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - - /** EditionDefault value. */ - public value: string; - - /** - * Creates a new EditionDefault instance using the specified properties. - * @param [properties] Properties to set - * @returns EditionDefault instance - */ - public static create(properties?: google.protobuf.FieldOptions.IEditionDefault): google.protobuf.FieldOptions.EditionDefault; - - /** - * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. - * @param message EditionDefault message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.FieldOptions.IEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. - * @param message EditionDefault message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.FieldOptions.IEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EditionDefault message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EditionDefault - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions.EditionDefault; - - /** - * Decodes an EditionDefault message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EditionDefault - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions.EditionDefault; - - /** - * Verifies an EditionDefault message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EditionDefault - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.EditionDefault; - - /** - * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. - * @param message EditionDefault - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FieldOptions.EditionDefault, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EditionDefault to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EditionDefault - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FeatureSupport. */ - interface IFeatureSupport { - - /** FeatureSupport editionIntroduced */ - editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - - /** FeatureSupport editionDeprecated */ - editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - - /** FeatureSupport deprecationWarning */ - deprecationWarning?: (string|null); - - /** FeatureSupport editionRemoved */ - editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - } - - /** Represents a FeatureSupport. */ - class FeatureSupport implements IFeatureSupport { - - /** - * Constructs a new FeatureSupport. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); - - /** FeatureSupport editionIntroduced. */ - public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - - /** FeatureSupport editionDeprecated. */ - public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - - /** FeatureSupport deprecationWarning. */ - public deprecationWarning: string; - - /** FeatureSupport editionRemoved. */ - public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - - /** - * Creates a new FeatureSupport instance using the specified properties. - * @param [properties] Properties to set - * @returns FeatureSupport instance - */ - public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; - - /** - * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. - * @param message FeatureSupport message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. - * @param message FeatureSupport message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FeatureSupport message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FeatureSupport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions.FeatureSupport; - - /** - * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FeatureSupport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions.FeatureSupport; - - /** - * Verifies a FeatureSupport message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FeatureSupport - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; - - /** - * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. - * @param message FeatureSupport - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FeatureSupport to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FeatureSupport - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of an OneofOptions. */ - interface IOneofOptions { - - /** OneofOptions features */ - features?: (google.protobuf.IFeatureSet|null); - - /** OneofOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - } - - /** Represents an OneofOptions. */ - class OneofOptions implements IOneofOptions { - - /** - * Constructs a new OneofOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IOneofOptions); - - /** OneofOptions features. */ - public features?: (google.protobuf.IFeatureSet|null); - - /** OneofOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new OneofOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns OneofOptions instance - */ - public static create(properties?: google.protobuf.IOneofOptions): google.protobuf.OneofOptions; - - /** - * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. - * @param message OneofOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. - * @param message OneofOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IOneofOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an OneofOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns OneofOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.OneofOptions; - - /** - * Decodes an OneofOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns OneofOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.OneofOptions; - - /** - * Verifies an OneofOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns OneofOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.OneofOptions; - - /** - * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. - * @param message OneofOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.OneofOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this OneofOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for OneofOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an EnumOptions. */ - interface IEnumOptions { - - /** EnumOptions allowAlias */ - allowAlias?: (boolean|null); - - /** EnumOptions deprecated */ - deprecated?: (boolean|null); - - /** EnumOptions deprecatedLegacyJsonFieldConflicts */ - deprecatedLegacyJsonFieldConflicts?: (boolean|null); - - /** EnumOptions features */ - features?: (google.protobuf.IFeatureSet|null); - - /** EnumOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - } - - /** Represents an EnumOptions. */ - class EnumOptions implements IEnumOptions { - - /** - * Constructs a new EnumOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEnumOptions); - - /** EnumOptions allowAlias. */ - public allowAlias: boolean; - - /** EnumOptions deprecated. */ - public deprecated: boolean; - - /** EnumOptions deprecatedLegacyJsonFieldConflicts. */ - public deprecatedLegacyJsonFieldConflicts: boolean; - - /** EnumOptions features. */ - public features?: (google.protobuf.IFeatureSet|null); - - /** EnumOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new EnumOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumOptions instance - */ - public static create(properties?: google.protobuf.IEnumOptions): google.protobuf.EnumOptions; - - /** - * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @param message EnumOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @param message EnumOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEnumOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EnumOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumOptions; - - /** - * Decodes an EnumOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumOptions; - - /** - * Verifies an EnumOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.EnumOptions; - - /** - * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. - * @param message EnumOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.EnumOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EnumOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EnumOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an EnumValueOptions. */ - interface IEnumValueOptions { - - /** EnumValueOptions deprecated */ - deprecated?: (boolean|null); - - /** EnumValueOptions features */ - features?: (google.protobuf.IFeatureSet|null); - - /** EnumValueOptions debugRedact */ - debugRedact?: (boolean|null); - - /** EnumValueOptions featureSupport */ - featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); - - /** EnumValueOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - } - - /** Represents an EnumValueOptions. */ - class EnumValueOptions implements IEnumValueOptions { - - /** - * Constructs a new EnumValueOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEnumValueOptions); - - /** EnumValueOptions deprecated. */ - public deprecated: boolean; - - /** EnumValueOptions features. */ - public features?: (google.protobuf.IFeatureSet|null); - - /** EnumValueOptions debugRedact. */ - public debugRedact: boolean; - - /** EnumValueOptions featureSupport. */ - public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); - - /** EnumValueOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new EnumValueOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns EnumValueOptions instance - */ - public static create(properties?: google.protobuf.IEnumValueOptions): google.protobuf.EnumValueOptions; - - /** - * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. - * @param message EnumValueOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. - * @param message EnumValueOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEnumValueOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an EnumValueOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns EnumValueOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.EnumValueOptions; - - /** - * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns EnumValueOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.EnumValueOptions; - - /** - * Verifies an EnumValueOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns EnumValueOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.EnumValueOptions; - - /** - * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. - * @param message EnumValueOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.EnumValueOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this EnumValueOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for EnumValueOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a ServiceOptions. */ - interface IServiceOptions { - - /** ServiceOptions features */ - features?: (google.protobuf.IFeatureSet|null); - - /** ServiceOptions deprecated */ - deprecated?: (boolean|null); - - /** ServiceOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** ServiceOptions .google.api.defaultHost */ - ".google.api.defaultHost"?: (string|null); - - /** ServiceOptions .google.api.oauthScopes */ - ".google.api.oauthScopes"?: (string|null); - - /** ServiceOptions .google.api.apiVersion */ - ".google.api.apiVersion"?: (string|null); - } - - /** Represents a ServiceOptions. */ - class ServiceOptions implements IServiceOptions { - - /** - * Constructs a new ServiceOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IServiceOptions); - - /** ServiceOptions features. */ - public features?: (google.protobuf.IFeatureSet|null); - - /** ServiceOptions deprecated. */ - public deprecated: boolean; - - /** ServiceOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new ServiceOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns ServiceOptions instance - */ - public static create(properties?: google.protobuf.IServiceOptions): google.protobuf.ServiceOptions; - - /** - * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @param message ServiceOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @param message ServiceOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IServiceOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns ServiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.ServiceOptions; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns ServiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.ServiceOptions; - - /** - * Verifies a ServiceOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns ServiceOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.ServiceOptions; - - /** - * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. - * @param message ServiceOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.ServiceOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this ServiceOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for ServiceOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a MethodOptions. */ - interface IMethodOptions { - - /** MethodOptions deprecated */ - deprecated?: (boolean|null); - - /** MethodOptions idempotencyLevel */ - idempotencyLevel?: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel|null); - - /** MethodOptions features */ - features?: (google.protobuf.IFeatureSet|null); - - /** MethodOptions uninterpretedOption */ - uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); - - /** MethodOptions .google.api.http */ - ".google.api.http"?: (google.api.IHttpRule|null); - - /** MethodOptions .google.api.methodSignature */ - ".google.api.methodSignature"?: (string[]|null); - } - - /** Represents a MethodOptions. */ - class MethodOptions implements IMethodOptions { - - /** - * Constructs a new MethodOptions. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IMethodOptions); - - /** MethodOptions deprecated. */ - public deprecated: boolean; - - /** MethodOptions idempotencyLevel. */ - public idempotencyLevel: (google.protobuf.MethodOptions.IdempotencyLevel|keyof typeof google.protobuf.MethodOptions.IdempotencyLevel); - - /** MethodOptions features. */ - public features?: (google.protobuf.IFeatureSet|null); - - /** MethodOptions uninterpretedOption. */ - public uninterpretedOption: google.protobuf.IUninterpretedOption[]; - - /** - * Creates a new MethodOptions instance using the specified properties. - * @param [properties] Properties to set - * @returns MethodOptions instance - */ - public static create(properties?: google.protobuf.IMethodOptions): google.protobuf.MethodOptions; - - /** - * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @param message MethodOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @param message MethodOptions message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IMethodOptions, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a MethodOptions message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns MethodOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.MethodOptions; - - /** - * Decodes a MethodOptions message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns MethodOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.MethodOptions; - - /** - * Verifies a MethodOptions message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns MethodOptions - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.MethodOptions; - - /** - * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. - * @param message MethodOptions - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.MethodOptions, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this MethodOptions to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for MethodOptions - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace MethodOptions { - - /** IdempotencyLevel enum. */ - enum IdempotencyLevel { - IDEMPOTENCY_UNKNOWN = 0, - NO_SIDE_EFFECTS = 1, - IDEMPOTENT = 2 - } - } - - /** Properties of an UninterpretedOption. */ - interface IUninterpretedOption { - - /** UninterpretedOption name */ - name?: (google.protobuf.UninterpretedOption.INamePart[]|null); - - /** UninterpretedOption identifierValue */ - identifierValue?: (string|null); - - /** UninterpretedOption positiveIntValue */ - positiveIntValue?: (number|Long|string|null); - - /** UninterpretedOption negativeIntValue */ - negativeIntValue?: (number|Long|string|null); - - /** UninterpretedOption doubleValue */ - doubleValue?: (number|null); - - /** UninterpretedOption stringValue */ - stringValue?: (Uint8Array|Buffer|string|null); - - /** UninterpretedOption aggregateValue */ - aggregateValue?: (string|null); - } - - /** Represents an UninterpretedOption. */ - class UninterpretedOption implements IUninterpretedOption { - - /** - * Constructs a new UninterpretedOption. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IUninterpretedOption); - - /** UninterpretedOption name. */ - public name: google.protobuf.UninterpretedOption.INamePart[]; - - /** UninterpretedOption identifierValue. */ - public identifierValue: string; - - /** UninterpretedOption positiveIntValue. */ - public positiveIntValue: (number|Long|string); - - /** UninterpretedOption negativeIntValue. */ - public negativeIntValue: (number|Long|string); - - /** UninterpretedOption doubleValue. */ - public doubleValue: number; - - /** UninterpretedOption stringValue. */ - public stringValue: (Uint8Array|Buffer|string); - - /** UninterpretedOption aggregateValue. */ - public aggregateValue: string; - - /** - * Creates a new UninterpretedOption instance using the specified properties. - * @param [properties] Properties to set - * @returns UninterpretedOption instance - */ - public static create(properties?: google.protobuf.IUninterpretedOption): google.protobuf.UninterpretedOption; - - /** - * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @param message UninterpretedOption message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @param message UninterpretedOption message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IUninterpretedOption, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UninterpretedOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UninterpretedOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption; - - /** - * Verifies an UninterpretedOption message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UninterpretedOption - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption; - - /** - * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. - * @param message UninterpretedOption - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.UninterpretedOption, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UninterpretedOption to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UninterpretedOption - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace UninterpretedOption { - - /** Properties of a NamePart. */ - interface INamePart { - - /** NamePart namePart */ - namePart: string; - - /** NamePart isExtension */ - isExtension: boolean; - } - - /** Represents a NamePart. */ - class NamePart implements INamePart { - - /** - * Constructs a new NamePart. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.UninterpretedOption.INamePart); - - /** NamePart namePart. */ - public namePart: string; - - /** NamePart isExtension. */ - public isExtension: boolean; - - /** - * Creates a new NamePart instance using the specified properties. - * @param [properties] Properties to set - * @returns NamePart instance - */ - public static create(properties?: google.protobuf.UninterpretedOption.INamePart): google.protobuf.UninterpretedOption.NamePart; - - /** - * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @param message NamePart message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @param message NamePart message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.UninterpretedOption.INamePart, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a NamePart message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns NamePart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UninterpretedOption.NamePart; - - /** - * Decodes a NamePart message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns NamePart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UninterpretedOption.NamePart; - - /** - * Verifies a NamePart message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a NamePart message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns NamePart - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UninterpretedOption.NamePart; - - /** - * Creates a plain object from a NamePart message. Also converts values to other types if specified. - * @param message NamePart - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.UninterpretedOption.NamePart, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this NamePart to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for NamePart - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a FeatureSet. */ - interface IFeatureSet { - - /** FeatureSet fieldPresence */ - fieldPresence?: (google.protobuf.FeatureSet.FieldPresence|keyof typeof google.protobuf.FeatureSet.FieldPresence|null); - - /** FeatureSet enumType */ - enumType?: (google.protobuf.FeatureSet.EnumType|keyof typeof google.protobuf.FeatureSet.EnumType|null); - - /** FeatureSet repeatedFieldEncoding */ - repeatedFieldEncoding?: (google.protobuf.FeatureSet.RepeatedFieldEncoding|keyof typeof google.protobuf.FeatureSet.RepeatedFieldEncoding|null); - - /** FeatureSet utf8Validation */ - utf8Validation?: (google.protobuf.FeatureSet.Utf8Validation|keyof typeof google.protobuf.FeatureSet.Utf8Validation|null); - - /** FeatureSet messageEncoding */ - messageEncoding?: (google.protobuf.FeatureSet.MessageEncoding|keyof typeof google.protobuf.FeatureSet.MessageEncoding|null); - - /** FeatureSet jsonFormat */ - jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); - - /** FeatureSet enforceNamingStyle */ - enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); - - /** FeatureSet defaultSymbolVisibility */ - defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); - } - - /** Represents a FeatureSet. */ - class FeatureSet implements IFeatureSet { - - /** - * Constructs a new FeatureSet. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFeatureSet); - - /** FeatureSet fieldPresence. */ - public fieldPresence: (google.protobuf.FeatureSet.FieldPresence|keyof typeof google.protobuf.FeatureSet.FieldPresence); - - /** FeatureSet enumType. */ - public enumType: (google.protobuf.FeatureSet.EnumType|keyof typeof google.protobuf.FeatureSet.EnumType); - - /** FeatureSet repeatedFieldEncoding. */ - public repeatedFieldEncoding: (google.protobuf.FeatureSet.RepeatedFieldEncoding|keyof typeof google.protobuf.FeatureSet.RepeatedFieldEncoding); - - /** FeatureSet utf8Validation. */ - public utf8Validation: (google.protobuf.FeatureSet.Utf8Validation|keyof typeof google.protobuf.FeatureSet.Utf8Validation); - - /** FeatureSet messageEncoding. */ - public messageEncoding: (google.protobuf.FeatureSet.MessageEncoding|keyof typeof google.protobuf.FeatureSet.MessageEncoding); - - /** FeatureSet jsonFormat. */ - public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); - - /** FeatureSet enforceNamingStyle. */ - public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); - - /** FeatureSet defaultSymbolVisibility. */ - public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); - - /** - * Creates a new FeatureSet instance using the specified properties. - * @param [properties] Properties to set - * @returns FeatureSet instance - */ - public static create(properties?: google.protobuf.IFeatureSet): google.protobuf.FeatureSet; - - /** - * Encodes the specified FeatureSet message. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. - * @param message FeatureSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFeatureSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FeatureSet message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. - * @param message FeatureSet message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFeatureSet, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FeatureSet message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FeatureSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSet; - - /** - * Decodes a FeatureSet message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FeatureSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSet; - - /** - * Verifies a FeatureSet message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FeatureSet message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FeatureSet - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet; - - /** - * Creates a plain object from a FeatureSet message. Also converts values to other types if specified. - * @param message FeatureSet - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FeatureSet, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FeatureSet to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FeatureSet - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FeatureSet { - - /** FieldPresence enum. */ - enum FieldPresence { - FIELD_PRESENCE_UNKNOWN = 0, - EXPLICIT = 1, - IMPLICIT = 2, - LEGACY_REQUIRED = 3 - } - - /** EnumType enum. */ - enum EnumType { - ENUM_TYPE_UNKNOWN = 0, - OPEN = 1, - CLOSED = 2 - } - - /** RepeatedFieldEncoding enum. */ - enum RepeatedFieldEncoding { - REPEATED_FIELD_ENCODING_UNKNOWN = 0, - PACKED = 1, - EXPANDED = 2 - } - - /** Utf8Validation enum. */ - enum Utf8Validation { - UTF8_VALIDATION_UNKNOWN = 0, - VERIFY = 2, - NONE = 3 - } - - /** MessageEncoding enum. */ - enum MessageEncoding { - MESSAGE_ENCODING_UNKNOWN = 0, - LENGTH_PREFIXED = 1, - DELIMITED = 2 - } - - /** JsonFormat enum. */ - enum JsonFormat { - JSON_FORMAT_UNKNOWN = 0, - ALLOW = 1, - LEGACY_BEST_EFFORT = 2 - } - - /** EnforceNamingStyle enum. */ - enum EnforceNamingStyle { - ENFORCE_NAMING_STYLE_UNKNOWN = 0, - STYLE2024 = 1, - STYLE_LEGACY = 2 - } - - /** Properties of a VisibilityFeature. */ - interface IVisibilityFeature { - } - - /** Represents a VisibilityFeature. */ - class VisibilityFeature implements IVisibilityFeature { - - /** - * Constructs a new VisibilityFeature. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); - - /** - * Creates a new VisibilityFeature instance using the specified properties. - * @param [properties] Properties to set - * @returns VisibilityFeature instance - */ - public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; - - /** - * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. - * @param message VisibilityFeature message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. - * @param message VisibilityFeature message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a VisibilityFeature message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns VisibilityFeature - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSet.VisibilityFeature; - - /** - * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns VisibilityFeature - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSet.VisibilityFeature; - - /** - * Verifies a VisibilityFeature message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns VisibilityFeature - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; - - /** - * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. - * @param message VisibilityFeature - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this VisibilityFeature to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for VisibilityFeature - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace VisibilityFeature { - - /** DefaultSymbolVisibility enum. */ - enum DefaultSymbolVisibility { - DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, - EXPORT_ALL = 1, - EXPORT_TOP_LEVEL = 2, - LOCAL_ALL = 3, - STRICT = 4 - } - } - } - - /** Properties of a FeatureSetDefaults. */ - interface IFeatureSetDefaults { - - /** FeatureSetDefaults defaults */ - defaults?: (google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault[]|null); - - /** FeatureSetDefaults minimumEdition */ - minimumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - - /** FeatureSetDefaults maximumEdition */ - maximumEdition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - } - - /** Represents a FeatureSetDefaults. */ - class FeatureSetDefaults implements IFeatureSetDefaults { - - /** - * Constructs a new FeatureSetDefaults. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFeatureSetDefaults); - - /** FeatureSetDefaults defaults. */ - public defaults: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault[]; - - /** FeatureSetDefaults minimumEdition. */ - public minimumEdition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - - /** FeatureSetDefaults maximumEdition. */ - public maximumEdition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - - /** - * Creates a new FeatureSetDefaults instance using the specified properties. - * @param [properties] Properties to set - * @returns FeatureSetDefaults instance - */ - public static create(properties?: google.protobuf.IFeatureSetDefaults): google.protobuf.FeatureSetDefaults; - - /** - * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. - * @param message FeatureSetDefaults message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFeatureSetDefaults, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. - * @param message FeatureSetDefaults message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFeatureSetDefaults, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FeatureSetDefaults message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FeatureSetDefaults - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSetDefaults; - - /** - * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FeatureSetDefaults - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSetDefaults; - - /** - * Verifies a FeatureSetDefaults message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FeatureSetDefaults - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSetDefaults; - - /** - * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. - * @param message FeatureSetDefaults - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FeatureSetDefaults, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FeatureSetDefaults to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FeatureSetDefaults - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace FeatureSetDefaults { - - /** Properties of a FeatureSetEditionDefault. */ - interface IFeatureSetEditionDefault { - - /** FeatureSetEditionDefault edition */ - edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - - /** FeatureSetEditionDefault overridableFeatures */ - overridableFeatures?: (google.protobuf.IFeatureSet|null); - - /** FeatureSetEditionDefault fixedFeatures */ - fixedFeatures?: (google.protobuf.IFeatureSet|null); - } - - /** Represents a FeatureSetEditionDefault. */ - class FeatureSetEditionDefault implements IFeatureSetEditionDefault { - - /** - * Constructs a new FeatureSetEditionDefault. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault); - - /** FeatureSetEditionDefault edition. */ - public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - - /** FeatureSetEditionDefault overridableFeatures. */ - public overridableFeatures?: (google.protobuf.IFeatureSet|null); - - /** FeatureSetEditionDefault fixedFeatures. */ - public fixedFeatures?: (google.protobuf.IFeatureSet|null); - - /** - * Creates a new FeatureSetEditionDefault instance using the specified properties. - * @param [properties] Properties to set - * @returns FeatureSetEditionDefault instance - */ - public static create(properties?: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; - - /** - * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. - * @param message FeatureSetEditionDefault message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. - * @param message FeatureSetEditionDefault message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FeatureSetEditionDefault - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; - - /** - * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FeatureSetEditionDefault - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; - - /** - * Verifies a FeatureSetEditionDefault message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FeatureSetEditionDefault - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault; - - /** - * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. - * @param message FeatureSetEditionDefault - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FeatureSetEditionDefault to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FeatureSetEditionDefault - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a SourceCodeInfo. */ - interface ISourceCodeInfo { - - /** SourceCodeInfo location */ - location?: (google.protobuf.SourceCodeInfo.ILocation[]|null); - } - - /** Represents a SourceCodeInfo. */ - class SourceCodeInfo implements ISourceCodeInfo { - - /** - * Constructs a new SourceCodeInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.ISourceCodeInfo); - - /** SourceCodeInfo location. */ - public location: google.protobuf.SourceCodeInfo.ILocation[]; - - /** - * Creates a new SourceCodeInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns SourceCodeInfo instance - */ - public static create(properties?: google.protobuf.ISourceCodeInfo): google.protobuf.SourceCodeInfo; - - /** - * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @param message SourceCodeInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @param message SourceCodeInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.ISourceCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a SourceCodeInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns SourceCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo; - - /** - * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns SourceCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo; - - /** - * Verifies a SourceCodeInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns SourceCodeInfo - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo; - - /** - * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. - * @param message SourceCodeInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.SourceCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this SourceCodeInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for SourceCodeInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace SourceCodeInfo { - - /** Properties of a Location. */ - interface ILocation { - - /** Location path */ - path?: (number[]|null); - - /** Location span */ - span?: (number[]|null); - - /** Location leadingComments */ - leadingComments?: (string|null); - - /** Location trailingComments */ - trailingComments?: (string|null); - - /** Location leadingDetachedComments */ - leadingDetachedComments?: (string[]|null); - } - - /** Represents a Location. */ - class Location implements ILocation { - - /** - * Constructs a new Location. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.SourceCodeInfo.ILocation); - - /** Location path. */ - public path: number[]; - - /** Location span. */ - public span: number[]; - - /** Location leadingComments. */ - public leadingComments: string; - - /** Location trailingComments. */ - public trailingComments: string; - - /** Location leadingDetachedComments. */ - public leadingDetachedComments: string[]; - - /** - * Creates a new Location instance using the specified properties. - * @param [properties] Properties to set - * @returns Location instance - */ - public static create(properties?: google.protobuf.SourceCodeInfo.ILocation): google.protobuf.SourceCodeInfo.Location; - - /** - * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @param message Location message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @param message Location message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.SourceCodeInfo.ILocation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Location message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.SourceCodeInfo.Location; - - /** - * Decodes a Location message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.SourceCodeInfo.Location; - - /** - * Verifies a Location message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Location message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Location - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.SourceCodeInfo.Location; - - /** - * Creates a plain object from a Location message. Also converts values to other types if specified. - * @param message Location - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.SourceCodeInfo.Location, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Location to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Location - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Properties of a GeneratedCodeInfo. */ - interface IGeneratedCodeInfo { - - /** GeneratedCodeInfo annotation */ - annotation?: (google.protobuf.GeneratedCodeInfo.IAnnotation[]|null); - } - - /** Represents a GeneratedCodeInfo. */ - class GeneratedCodeInfo implements IGeneratedCodeInfo { - - /** - * Constructs a new GeneratedCodeInfo. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IGeneratedCodeInfo); - - /** GeneratedCodeInfo annotation. */ - public annotation: google.protobuf.GeneratedCodeInfo.IAnnotation[]; - - /** - * Creates a new GeneratedCodeInfo instance using the specified properties. - * @param [properties] Properties to set - * @returns GeneratedCodeInfo instance - */ - public static create(properties?: google.protobuf.IGeneratedCodeInfo): google.protobuf.GeneratedCodeInfo; - - /** - * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @param message GeneratedCodeInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @param message GeneratedCodeInfo message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IGeneratedCodeInfo, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns GeneratedCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo; - - /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns GeneratedCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo; - - /** - * Verifies a GeneratedCodeInfo message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns GeneratedCodeInfo - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo; - - /** - * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. - * @param message GeneratedCodeInfo - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.GeneratedCodeInfo, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this GeneratedCodeInfo to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for GeneratedCodeInfo - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace GeneratedCodeInfo { - - /** Properties of an Annotation. */ - interface IAnnotation { - - /** Annotation path */ - path?: (number[]|null); - - /** Annotation sourceFile */ - sourceFile?: (string|null); - - /** Annotation begin */ - begin?: (number|null); - - /** Annotation end */ - end?: (number|null); - - /** Annotation semantic */ - semantic?: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null); - } - - /** Represents an Annotation. */ - class Annotation implements IAnnotation { - - /** - * Constructs a new Annotation. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation); - - /** Annotation path. */ - public path: number[]; - - /** Annotation sourceFile. */ - public sourceFile: string; - - /** Annotation begin. */ - public begin: number; - - /** Annotation end. */ - public end: number; - - /** Annotation semantic. */ - public semantic: (google.protobuf.GeneratedCodeInfo.Annotation.Semantic|keyof typeof google.protobuf.GeneratedCodeInfo.Annotation.Semantic); - - /** - * Creates a new Annotation instance using the specified properties. - * @param [properties] Properties to set - * @returns Annotation instance - */ - public static create(properties?: google.protobuf.GeneratedCodeInfo.IAnnotation): google.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @param message Annotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @param message Annotation message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.GeneratedCodeInfo.IAnnotation, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Annotation message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Annotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Decodes an Annotation message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Annotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Verifies an Annotation message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an Annotation message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Annotation - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.GeneratedCodeInfo.Annotation; - - /** - * Creates a plain object from an Annotation message. Also converts values to other types if specified. - * @param message Annotation - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.GeneratedCodeInfo.Annotation, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Annotation to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Annotation - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - namespace Annotation { - - /** Semantic enum. */ - enum Semantic { - NONE = 0, - SET = 1, - ALIAS = 2 - } - } - } - - /** SymbolVisibility enum. */ - enum SymbolVisibility { - VISIBILITY_UNSET = 0, - VISIBILITY_LOCAL = 1, - VISIBILITY_EXPORT = 2 - } - - /** Properties of a Duration. */ - interface IDuration { - - /** Duration seconds */ - seconds?: (number|Long|string|null); - - /** Duration nanos */ - nanos?: (number|null); - } - - /** Represents a Duration. */ - class Duration implements IDuration { - - /** - * Constructs a new Duration. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IDuration); - - /** Duration seconds. */ - public seconds: (number|Long|string); - - /** Duration nanos. */ - public nanos: number; - - /** - * Creates a new Duration instance using the specified properties. - * @param [properties] Properties to set - * @returns Duration instance - */ - public static create(properties?: google.protobuf.IDuration): google.protobuf.Duration; - - /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @param message Duration message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IDuration, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Duration message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Duration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Duration; - - /** - * Decodes a Duration message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Duration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Duration; - - /** - * Verifies a Duration message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Duration - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Duration; - - /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. - * @param message Duration - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Duration, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Duration to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Duration - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a Timestamp. */ - interface ITimestamp { - - /** Timestamp seconds */ - seconds?: (number|Long|string|null); - - /** Timestamp nanos */ - nanos?: (number|null); - } - - /** Represents a Timestamp. */ - class Timestamp implements ITimestamp { - - /** - * Constructs a new Timestamp. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.ITimestamp); - - /** Timestamp seconds. */ - public seconds: (number|Long|string); - - /** Timestamp nanos. */ - public nanos: number; - - /** - * Creates a new Timestamp instance using the specified properties. - * @param [properties] Properties to set - * @returns Timestamp instance - */ - public static create(properties?: google.protobuf.ITimestamp): google.protobuf.Timestamp; - - /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @param message Timestamp message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @param message Timestamp message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.ITimestamp, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Timestamp message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Timestamp; - - /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Timestamp; - - /** - * Verifies a Timestamp message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Timestamp - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Timestamp; - - /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. - * @param message Timestamp - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Timestamp, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Timestamp to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Timestamp - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a DoubleValue. */ - interface IDoubleValue { - - /** DoubleValue value */ - value?: (number|null); - } - - /** Represents a DoubleValue. */ - class DoubleValue implements IDoubleValue { - - /** - * Constructs a new DoubleValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IDoubleValue); - - /** DoubleValue value. */ - public value: number; - - /** - * Creates a new DoubleValue instance using the specified properties. - * @param [properties] Properties to set - * @returns DoubleValue instance - */ - public static create(properties?: google.protobuf.IDoubleValue): google.protobuf.DoubleValue; - - /** - * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. - * @param message DoubleValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. - * @param message DoubleValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IDoubleValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a DoubleValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns DoubleValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.DoubleValue; - - /** - * Decodes a DoubleValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns DoubleValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.DoubleValue; - - /** - * Verifies a DoubleValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns DoubleValue - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.DoubleValue; - - /** - * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. - * @param message DoubleValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.DoubleValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this DoubleValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for DoubleValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FloatValue. */ - interface IFloatValue { - - /** FloatValue value */ - value?: (number|null); - } - - /** Represents a FloatValue. */ - class FloatValue implements IFloatValue { - - /** - * Constructs a new FloatValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFloatValue); - - /** FloatValue value. */ - public value: number; - - /** - * Creates a new FloatValue instance using the specified properties. - * @param [properties] Properties to set - * @returns FloatValue instance - */ - public static create(properties?: google.protobuf.IFloatValue): google.protobuf.FloatValue; - - /** - * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. - * @param message FloatValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. - * @param message FloatValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFloatValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FloatValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FloatValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FloatValue; - - /** - * Decodes a FloatValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FloatValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FloatValue; - - /** - * Verifies a FloatValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FloatValue - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FloatValue; - - /** - * Creates a plain object from a FloatValue message. Also converts values to other types if specified. - * @param message FloatValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FloatValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FloatValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FloatValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Int64Value. */ - interface IInt64Value { - - /** Int64Value value */ - value?: (number|Long|string|null); - } - - /** Represents an Int64Value. */ - class Int64Value implements IInt64Value { - - /** - * Constructs a new Int64Value. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IInt64Value); - - /** Int64Value value. */ - public value: (number|Long|string); - - /** - * Creates a new Int64Value instance using the specified properties. - * @param [properties] Properties to set - * @returns Int64Value instance - */ - public static create(properties?: google.protobuf.IInt64Value): google.protobuf.Int64Value; - - /** - * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. - * @param message Int64Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. - * @param message Int64Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Int64Value message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Int64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Int64Value; - - /** - * Decodes an Int64Value message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Int64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Int64Value; - - /** - * Verifies an Int64Value message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Int64Value - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Int64Value; - - /** - * Creates a plain object from an Int64Value message. Also converts values to other types if specified. - * @param message Int64Value - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Int64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Int64Value to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Int64Value - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a UInt64Value. */ - interface IUInt64Value { - - /** UInt64Value value */ - value?: (number|Long|string|null); - } - - /** Represents a UInt64Value. */ - class UInt64Value implements IUInt64Value { - - /** - * Constructs a new UInt64Value. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IUInt64Value); - - /** UInt64Value value. */ - public value: (number|Long|string); - - /** - * Creates a new UInt64Value instance using the specified properties. - * @param [properties] Properties to set - * @returns UInt64Value instance - */ - public static create(properties?: google.protobuf.IUInt64Value): google.protobuf.UInt64Value; - - /** - * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. - * @param message UInt64Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. - * @param message UInt64Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IUInt64Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a UInt64Value message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UInt64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UInt64Value; - - /** - * Decodes a UInt64Value message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UInt64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UInt64Value; - - /** - * Verifies a UInt64Value message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UInt64Value - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UInt64Value; - - /** - * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. - * @param message UInt64Value - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.UInt64Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UInt64Value to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UInt64Value - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Int32Value. */ - interface IInt32Value { - - /** Int32Value value */ - value?: (number|null); - } - - /** Represents an Int32Value. */ - class Int32Value implements IInt32Value { - - /** - * Constructs a new Int32Value. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IInt32Value); - - /** Int32Value value. */ - public value: number; - - /** - * Creates a new Int32Value instance using the specified properties. - * @param [properties] Properties to set - * @returns Int32Value instance - */ - public static create(properties?: google.protobuf.IInt32Value): google.protobuf.Int32Value; - - /** - * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. - * @param message Int32Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. - * @param message Int32Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Int32Value message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Int32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Int32Value; - - /** - * Decodes an Int32Value message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Int32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Int32Value; - - /** - * Verifies an Int32Value message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Int32Value - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Int32Value; - - /** - * Creates a plain object from an Int32Value message. Also converts values to other types if specified. - * @param message Int32Value - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Int32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Int32Value to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Int32Value - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a UInt32Value. */ - interface IUInt32Value { - - /** UInt32Value value */ - value?: (number|null); - } - - /** Represents a UInt32Value. */ - class UInt32Value implements IUInt32Value { - - /** - * Constructs a new UInt32Value. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IUInt32Value); - - /** UInt32Value value. */ - public value: number; - - /** - * Creates a new UInt32Value instance using the specified properties. - * @param [properties] Properties to set - * @returns UInt32Value instance - */ - public static create(properties?: google.protobuf.IUInt32Value): google.protobuf.UInt32Value; - - /** - * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. - * @param message UInt32Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. - * @param message UInt32Value message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IUInt32Value, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a UInt32Value message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns UInt32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.UInt32Value; - - /** - * Decodes a UInt32Value message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns UInt32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.UInt32Value; - - /** - * Verifies a UInt32Value message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns UInt32Value - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.UInt32Value; - - /** - * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. - * @param message UInt32Value - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.UInt32Value, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this UInt32Value to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for UInt32Value - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BoolValue. */ - interface IBoolValue { - - /** BoolValue value */ - value?: (boolean|null); - } - - /** Represents a BoolValue. */ - class BoolValue implements IBoolValue { - - /** - * Constructs a new BoolValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IBoolValue); - - /** BoolValue value. */ - public value: boolean; - - /** - * Creates a new BoolValue instance using the specified properties. - * @param [properties] Properties to set - * @returns BoolValue instance - */ - public static create(properties?: google.protobuf.IBoolValue): google.protobuf.BoolValue; - - /** - * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. - * @param message BoolValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. - * @param message BoolValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IBoolValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BoolValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BoolValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.BoolValue; - - /** - * Decodes a BoolValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BoolValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.BoolValue; - - /** - * Verifies a BoolValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BoolValue - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.BoolValue; - - /** - * Creates a plain object from a BoolValue message. Also converts values to other types if specified. - * @param message BoolValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.BoolValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BoolValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BoolValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a StringValue. */ - interface IStringValue { - - /** StringValue value */ - value?: (string|null); - } - - /** Represents a StringValue. */ - class StringValue implements IStringValue { - - /** - * Constructs a new StringValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IStringValue); - - /** StringValue value. */ - public value: string; - - /** - * Creates a new StringValue instance using the specified properties. - * @param [properties] Properties to set - * @returns StringValue instance - */ - public static create(properties?: google.protobuf.IStringValue): google.protobuf.StringValue; - - /** - * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. - * @param message StringValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. - * @param message StringValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IStringValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a StringValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns StringValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.StringValue; - - /** - * Decodes a StringValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns StringValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.StringValue; - - /** - * Verifies a StringValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a StringValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns StringValue - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.StringValue; - - /** - * Creates a plain object from a StringValue message. Also converts values to other types if specified. - * @param message StringValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.StringValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this StringValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for StringValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a BytesValue. */ - interface IBytesValue { - - /** BytesValue value */ - value?: (Uint8Array|Buffer|string|null); - } - - /** Represents a BytesValue. */ - class BytesValue implements IBytesValue { - - /** - * Constructs a new BytesValue. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IBytesValue); - - /** BytesValue value. */ - public value: (Uint8Array|Buffer|string); - - /** - * Creates a new BytesValue instance using the specified properties. - * @param [properties] Properties to set - * @returns BytesValue instance - */ - public static create(properties?: google.protobuf.IBytesValue): google.protobuf.BytesValue; - - /** - * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. - * @param message BytesValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. - * @param message BytesValue message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IBytesValue, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a BytesValue message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns BytesValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.BytesValue; - - /** - * Decodes a BytesValue message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns BytesValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.BytesValue; - - /** - * Verifies a BytesValue message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns BytesValue - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.BytesValue; - - /** - * Creates a plain object from a BytesValue message. Also converts values to other types if specified. - * @param message BytesValue - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.BytesValue, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this BytesValue to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for BytesValue - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Any. */ - interface IAny { - - /** Any type_url */ - type_url?: (string|null); - - /** Any value */ - value?: (Uint8Array|Buffer|string|null); - } - - /** Represents an Any. */ - class Any implements IAny { - - /** - * Constructs a new Any. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IAny); - - /** Any type_url. */ - public type_url: string; - - /** Any value. */ - public value: (Uint8Array|Buffer|string); - - /** - * Creates a new Any instance using the specified properties. - * @param [properties] Properties to set - * @returns Any instance - */ - public static create(properties?: google.protobuf.IAny): google.protobuf.Any; - - /** - * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @param message Any message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @param message Any message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IAny, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Any message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Any - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Any; - - /** - * Decodes an Any message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Any - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Any; - - /** - * Verifies an Any message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an Any message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Any - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Any; - - /** - * Creates a plain object from an Any message. Also converts values to other types if specified. - * @param message Any - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Any, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Any to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Any - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of a FieldMask. */ - interface IFieldMask { - - /** FieldMask paths */ - paths?: (string[]|null); - } - - /** Represents a FieldMask. */ - class FieldMask implements IFieldMask { - - /** - * Constructs a new FieldMask. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IFieldMask); - - /** FieldMask paths. */ - public paths: string[]; - - /** - * Creates a new FieldMask instance using the specified properties. - * @param [properties] Properties to set - * @returns FieldMask instance - */ - public static create(properties?: google.protobuf.IFieldMask): google.protobuf.FieldMask; - - /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @param message FieldMask message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @param message FieldMask message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IFieldMask, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a FieldMask message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldMask; - - /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldMask; - - /** - * Verifies a FieldMask message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns FieldMask - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.FieldMask; - - /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. - * @param message FieldMask - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.FieldMask, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this FieldMask to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for FieldMask - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - - /** Properties of an Empty. */ - interface IEmpty { - } - - /** Represents an Empty. */ - class Empty implements IEmpty { - - /** - * Constructs a new Empty. - * @param [properties] Properties to set - */ - constructor(properties?: google.protobuf.IEmpty); - - /** - * Creates a new Empty instance using the specified properties. - * @param [properties] Properties to set - * @returns Empty instance - */ - public static create(properties?: google.protobuf.IEmpty): google.protobuf.Empty; - - /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @param message Empty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @param message Empty message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.protobuf.IEmpty, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Empty message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.Empty; - - /** - * Decodes an Empty message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.Empty; - - /** - * Verifies an Empty message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an Empty message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Empty - */ - public static fromObject(object: { [k: string]: any }): google.protobuf.Empty; - - /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. - * @param message Empty - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.protobuf.Empty, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Empty to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Empty - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Namespace rpc. */ - namespace rpc { - - /** Properties of a Status. */ - interface IStatus { - - /** Status code */ - code?: (number|null); - - /** Status message */ - message?: (string|null); - - /** Status details */ - details?: (google.protobuf.IAny[]|null); - } - - /** Represents a Status. */ - class Status implements IStatus { - - /** - * Constructs a new Status. - * @param [properties] Properties to set - */ - constructor(properties?: google.rpc.IStatus); - - /** Status code. */ - public code: number; - - /** Status message. */ - public message: string; - - /** Status details. */ - public details: google.protobuf.IAny[]; - - /** - * Creates a new Status instance using the specified properties. - * @param [properties] Properties to set - * @returns Status instance - */ - public static create(properties?: google.rpc.IStatus): google.rpc.Status; - - /** - * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. - * @param message Status message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. - * @param message Status message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.rpc.IStatus, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes a Status message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Status - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.rpc.Status; - - /** - * Decodes a Status message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Status - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.rpc.Status; - - /** - * Verifies a Status message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates a Status message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Status - */ - public static fromObject(object: { [k: string]: any }): google.rpc.Status; - - /** - * Creates a plain object from a Status message. Also converts values to other types if specified. - * @param message Status - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.rpc.Status, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Status to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Status - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } - - /** Namespace type. */ - namespace type { - - /** Properties of an Interval. */ - interface IInterval { - - /** Interval startTime */ - startTime?: (google.protobuf.ITimestamp|null); - - /** Interval endTime */ - endTime?: (google.protobuf.ITimestamp|null); - } - - /** Represents an Interval. */ - class Interval implements IInterval { - - /** - * Constructs a new Interval. - * @param [properties] Properties to set - */ - constructor(properties?: google.type.IInterval); - - /** Interval startTime. */ - public startTime?: (google.protobuf.ITimestamp|null); - - /** Interval endTime. */ - public endTime?: (google.protobuf.ITimestamp|null); - - /** - * Creates a new Interval instance using the specified properties. - * @param [properties] Properties to set - * @returns Interval instance - */ - public static create(properties?: google.type.IInterval): google.type.Interval; - - /** - * Encodes the specified Interval message. Does not implicitly {@link google.type.Interval.verify|verify} messages. - * @param message Interval message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encode(message: google.type.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.type.Interval.verify|verify} messages. - * @param message Interval message or plain object to encode - * @param [writer] Writer to encode to - * @returns Writer - */ - public static encodeDelimited(message: google.type.IInterval, writer?: $protobuf.Writer): $protobuf.Writer; - - /** - * Decodes an Interval message from the specified reader or buffer. - * @param reader Reader or buffer to decode from - * @param [length] Message length if known beforehand - * @returns Interval - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.type.Interval; - - /** - * Decodes an Interval message from the specified reader or buffer, length delimited. - * @param reader Reader or buffer to decode from - * @returns Interval - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.type.Interval; - - /** - * Verifies an Interval message. - * @param message Plain object to verify - * @returns `null` if valid, otherwise the reason why it is not - */ - public static verify(message: { [k: string]: any }): (string|null); - - /** - * Creates an Interval message from a plain object. Also converts values to their respective internal types. - * @param object Plain object - * @returns Interval - */ - public static fromObject(object: { [k: string]: any }): google.type.Interval; - - /** - * Creates a plain object from an Interval message. Also converts values to other types if specified. - * @param message Interval - * @param [options] Conversion options - * @returns Plain object - */ - public static toObject(message: google.type.Interval, options?: $protobuf.IConversionOptions): { [k: string]: any }; - - /** - * Converts this Interval to JSON. - * @returns JSON object - */ - public toJSON(): { [k: string]: any }; - - /** - * Gets the default type url for Interval - * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns The default type url - */ - public static getTypeUrl(typeUrlPrefix?: string): string; - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/protos/protos.js b/owl-bot-staging/google-cloud-sql/protos/protos.js deleted file mode 100644 index 654b059265f6..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/protos.js +++ /dev/null @@ -1,167547 +0,0 @@ -// Copyright 2026 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. - -/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ -(function(global, factory) { /* global define, require, module */ - - /* AMD */ if (typeof define === 'function' && define.amd) - define(["protobufjs/minimal"], factory); - - /* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports) - module.exports = factory(require("google-gax/build/src/protobuf").protobufMinimal); - -})(this, function($protobuf) { - "use strict"; - - // Common aliases - var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; - - // Exported root namespace - var $root = $protobuf.roots._google_cloud_sql_protos || ($protobuf.roots._google_cloud_sql_protos = {}); - - $root.google = (function() { - - /** - * Namespace google. - * @exports google - * @namespace - */ - var google = {}; - - google.cloud = (function() { - - /** - * Namespace cloud. - * @memberof google - * @namespace - */ - var cloud = {}; - - cloud.sql = (function() { - - /** - * Namespace sql. - * @memberof google.cloud - * @namespace - */ - var sql = {}; - - sql.v1 = (function() { - - /** - * Namespace v1. - * @memberof google.cloud.sql - * @namespace - */ - var v1 = {}; - - v1.SqlAvailableDatabaseVersionsService = (function() { - - /** - * Constructs a new SqlAvailableDatabaseVersionsService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlAvailableDatabaseVersionsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlAvailableDatabaseVersionsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlAvailableDatabaseVersionsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlAvailableDatabaseVersionsService; - - /** - * Creates new SqlAvailableDatabaseVersionsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlAvailableDatabaseVersionsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlAvailableDatabaseVersionsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlAvailableDatabaseVersionsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - return SqlAvailableDatabaseVersionsService; - })(); - - v1.SqlBackupRunsService = (function() { - - /** - * Constructs a new SqlBackupRunsService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlBackupRunsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlBackupRunsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlBackupRunsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlBackupRunsService; - - /** - * Creates new SqlBackupRunsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlBackupRunsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlBackupRunsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|delete_}. - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @typedef DeleteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest} request SqlBackupRunsDeleteRequest message or plain object - * @param {google.cloud.sql.v1.SqlBackupRunsService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupRunsService.prototype["delete"] = function delete_(request, callback) { - return this.rpcCall(delete_, $root.google.cloud.sql.v1.SqlBackupRunsDeleteRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Delete" }); - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest} request SqlBackupRunsDeleteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|get}. - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.BackupRun} [response] BackupRun - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest} request SqlBackupRunsGetRequest message or plain object - * @param {google.cloud.sql.v1.SqlBackupRunsService.GetCallback} callback Node-style callback called with the error, if any, and BackupRun - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupRunsService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1.SqlBackupRunsGetRequest, $root.google.cloud.sql.v1.BackupRun, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest} request SqlBackupRunsGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|insert}. - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @typedef InsertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest} request SqlBackupRunsInsertRequest message or plain object - * @param {google.cloud.sql.v1.SqlBackupRunsService.InsertCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupRunsService.prototype.insert = function insert(request, callback) { - return this.rpcCall(insert, $root.google.cloud.sql.v1.SqlBackupRunsInsertRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Insert" }); - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest} request SqlBackupRunsInsertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupRunsService|list}. - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.BackupRunsListResponse} [response] BackupRunsListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest} request SqlBackupRunsListRequest message or plain object - * @param {google.cloud.sql.v1.SqlBackupRunsService.ListCallback} callback Node-style callback called with the error, if any, and BackupRunsListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupRunsService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1.SqlBackupRunsListRequest, $root.google.cloud.sql.v1.BackupRunsListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest} request SqlBackupRunsListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlBackupRunsService; - })(); - - v1.SqlBackupRunsDeleteRequest = (function() { - - /** - * Properties of a SqlBackupRunsDeleteRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlBackupRunsDeleteRequest - * @property {number|Long|null} [id] SqlBackupRunsDeleteRequest id - * @property {string|null} [instance] SqlBackupRunsDeleteRequest instance - * @property {string|null} [project] SqlBackupRunsDeleteRequest project - */ - - /** - * Constructs a new SqlBackupRunsDeleteRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlBackupRunsDeleteRequest. - * @implements ISqlBackupRunsDeleteRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest=} [properties] Properties to set - */ - function SqlBackupRunsDeleteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBackupRunsDeleteRequest id. - * @member {number|Long} id - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @instance - */ - SqlBackupRunsDeleteRequest.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * SqlBackupRunsDeleteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @instance - */ - SqlBackupRunsDeleteRequest.prototype.instance = ""; - - /** - * SqlBackupRunsDeleteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @instance - */ - SqlBackupRunsDeleteRequest.prototype.project = ""; - - /** - * Creates a new SqlBackupRunsDeleteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest instance - */ - SqlBackupRunsDeleteRequest.create = function create(properties) { - return new SqlBackupRunsDeleteRequest(properties); - }; - - /** - * Encodes the specified SqlBackupRunsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsDeleteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsDeleteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlBackupRunsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsDeleteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsDeleteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.id = reader.int64(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsDeleteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBackupRunsDeleteRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBackupRunsDeleteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) - return "id: integer|Long expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlBackupRunsDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest - */ - SqlBackupRunsDeleteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlBackupRunsDeleteRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(); - if (object.id != null) - if ($util.Long) - (message.id = $util.Long.fromValue(object.id)).unsigned = false; - else if (typeof object.id === "string") - message.id = parseInt(object.id, 10); - else if (typeof object.id === "number") - message.id = object.id; - else if (typeof object.id === "object") - message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlBackupRunsDeleteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @static - * @param {google.cloud.sql.v1.SqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBackupRunsDeleteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.id = options.longs === String ? "0" : 0; - object.instance = ""; - object.project = ""; - } - if (message.id != null && message.hasOwnProperty("id")) - if (typeof message.id === "number") - object.id = options.longs === String ? String(message.id) : message.id; - else - object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlBackupRunsDeleteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlBackupRunsDeleteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBackupRunsDeleteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlBackupRunsDeleteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBackupRunsDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlBackupRunsDeleteRequest"; - }; - - return SqlBackupRunsDeleteRequest; - })(); - - v1.SqlBackupRunsGetRequest = (function() { - - /** - * Properties of a SqlBackupRunsGetRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlBackupRunsGetRequest - * @property {number|Long|null} [id] SqlBackupRunsGetRequest id - * @property {string|null} [instance] SqlBackupRunsGetRequest instance - * @property {string|null} [project] SqlBackupRunsGetRequest project - */ - - /** - * Constructs a new SqlBackupRunsGetRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlBackupRunsGetRequest. - * @implements ISqlBackupRunsGetRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest=} [properties] Properties to set - */ - function SqlBackupRunsGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBackupRunsGetRequest id. - * @member {number|Long} id - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @instance - */ - SqlBackupRunsGetRequest.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * SqlBackupRunsGetRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @instance - */ - SqlBackupRunsGetRequest.prototype.instance = ""; - - /** - * SqlBackupRunsGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @instance - */ - SqlBackupRunsGetRequest.prototype.project = ""; - - /** - * Creates a new SqlBackupRunsGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest instance - */ - SqlBackupRunsGetRequest.create = function create(properties) { - return new SqlBackupRunsGetRequest(properties); - }; - - /** - * Encodes the specified SqlBackupRunsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest} message SqlBackupRunsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlBackupRunsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsGetRequest} message SqlBackupRunsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlBackupRunsGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.id = reader.int64(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBackupRunsGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBackupRunsGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) - return "id: integer|Long expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlBackupRunsGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest - */ - SqlBackupRunsGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlBackupRunsGetRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlBackupRunsGetRequest(); - if (object.id != null) - if ($util.Long) - (message.id = $util.Long.fromValue(object.id)).unsigned = false; - else if (typeof object.id === "string") - message.id = parseInt(object.id, 10); - else if (typeof object.id === "number") - message.id = object.id; - else if (typeof object.id === "object") - message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlBackupRunsGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @static - * @param {google.cloud.sql.v1.SqlBackupRunsGetRequest} message SqlBackupRunsGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBackupRunsGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.id = options.longs === String ? "0" : 0; - object.instance = ""; - object.project = ""; - } - if (message.id != null && message.hasOwnProperty("id")) - if (typeof message.id === "number") - object.id = options.longs === String ? String(message.id) : message.id; - else - object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlBackupRunsGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlBackupRunsGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBackupRunsGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlBackupRunsGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBackupRunsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlBackupRunsGetRequest"; - }; - - return SqlBackupRunsGetRequest; - })(); - - v1.SqlBackupRunsInsertRequest = (function() { - - /** - * Properties of a SqlBackupRunsInsertRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlBackupRunsInsertRequest - * @property {string|null} [instance] SqlBackupRunsInsertRequest instance - * @property {string|null} [project] SqlBackupRunsInsertRequest project - * @property {google.cloud.sql.v1.IBackupRun|null} [body] SqlBackupRunsInsertRequest body - */ - - /** - * Constructs a new SqlBackupRunsInsertRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlBackupRunsInsertRequest. - * @implements ISqlBackupRunsInsertRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest=} [properties] Properties to set - */ - function SqlBackupRunsInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBackupRunsInsertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @instance - */ - SqlBackupRunsInsertRequest.prototype.instance = ""; - - /** - * SqlBackupRunsInsertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @instance - */ - SqlBackupRunsInsertRequest.prototype.project = ""; - - /** - * SqlBackupRunsInsertRequest body. - * @member {google.cloud.sql.v1.IBackupRun|null|undefined} body - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @instance - */ - SqlBackupRunsInsertRequest.prototype.body = null; - - /** - * Creates a new SqlBackupRunsInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest instance - */ - SqlBackupRunsInsertRequest.create = function create(properties) { - return new SqlBackupRunsInsertRequest(properties); - }; - - /** - * Encodes the specified SqlBackupRunsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.BackupRun.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlBackupRunsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlBackupRunsInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.BackupRun.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBackupRunsInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBackupRunsInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.BackupRun.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlBackupRunsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest - */ - SqlBackupRunsInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlBackupRunsInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlBackupRunsInsertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlBackupRunsInsertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.BackupRun.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlBackupRunsInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @static - * @param {google.cloud.sql.v1.SqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBackupRunsInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.BackupRun.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlBackupRunsInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlBackupRunsInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBackupRunsInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlBackupRunsInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBackupRunsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlBackupRunsInsertRequest"; - }; - - return SqlBackupRunsInsertRequest; - })(); - - v1.SqlBackupRunsListRequest = (function() { - - /** - * Properties of a SqlBackupRunsListRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlBackupRunsListRequest - * @property {string|null} [instance] SqlBackupRunsListRequest instance - * @property {number|null} [maxResults] SqlBackupRunsListRequest maxResults - * @property {string|null} [pageToken] SqlBackupRunsListRequest pageToken - * @property {string|null} [project] SqlBackupRunsListRequest project - */ - - /** - * Constructs a new SqlBackupRunsListRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlBackupRunsListRequest. - * @implements ISqlBackupRunsListRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest=} [properties] Properties to set - */ - function SqlBackupRunsListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBackupRunsListRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @instance - */ - SqlBackupRunsListRequest.prototype.instance = ""; - - /** - * SqlBackupRunsListRequest maxResults. - * @member {number} maxResults - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @instance - */ - SqlBackupRunsListRequest.prototype.maxResults = 0; - - /** - * SqlBackupRunsListRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @instance - */ - SqlBackupRunsListRequest.prototype.pageToken = ""; - - /** - * SqlBackupRunsListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @instance - */ - SqlBackupRunsListRequest.prototype.project = ""; - - /** - * Creates a new SqlBackupRunsListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlBackupRunsListRequest} SqlBackupRunsListRequest instance - */ - SqlBackupRunsListRequest.create = function create(properties) { - return new SqlBackupRunsListRequest(properties); - }; - - /** - * Encodes the specified SqlBackupRunsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest} message SqlBackupRunsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlBackupRunsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlBackupRunsListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlBackupRunsListRequest} message SqlBackupRunsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlBackupRunsListRequest} SqlBackupRunsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlBackupRunsListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.maxResults = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlBackupRunsListRequest} SqlBackupRunsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBackupRunsListRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBackupRunsListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlBackupRunsListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlBackupRunsListRequest} SqlBackupRunsListRequest - */ - SqlBackupRunsListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlBackupRunsListRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlBackupRunsListRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.maxResults != null) - message.maxResults = object.maxResults | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlBackupRunsListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @static - * @param {google.cloud.sql.v1.SqlBackupRunsListRequest} message SqlBackupRunsListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBackupRunsListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.maxResults = 0; - object.pageToken = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlBackupRunsListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlBackupRunsListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBackupRunsListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlBackupRunsListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBackupRunsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlBackupRunsListRequest"; - }; - - return SqlBackupRunsListRequest; - })(); - - v1.BackupRun = (function() { - - /** - * Properties of a BackupRun. - * @memberof google.cloud.sql.v1 - * @interface IBackupRun - * @property {string|null} [kind] BackupRun kind - * @property {google.cloud.sql.v1.SqlBackupRunStatus|null} [status] BackupRun status - * @property {google.protobuf.ITimestamp|null} [enqueuedTime] BackupRun enqueuedTime - * @property {number|Long|null} [id] BackupRun id - * @property {google.protobuf.ITimestamp|null} [startTime] BackupRun startTime - * @property {google.protobuf.ITimestamp|null} [endTime] BackupRun endTime - * @property {google.cloud.sql.v1.IOperationError|null} [error] BackupRun error - * @property {google.cloud.sql.v1.SqlBackupRunType|null} [type] BackupRun type - * @property {string|null} [description] BackupRun description - * @property {google.protobuf.ITimestamp|null} [windowStartTime] BackupRun windowStartTime - * @property {string|null} [instance] BackupRun instance - * @property {string|null} [selfLink] BackupRun selfLink - * @property {string|null} [location] BackupRun location - * @property {google.cloud.sql.v1.SqlDatabaseVersion|null} [databaseVersion] BackupRun databaseVersion - * @property {google.cloud.sql.v1.IDiskEncryptionConfiguration|null} [diskEncryptionConfiguration] BackupRun diskEncryptionConfiguration - * @property {google.cloud.sql.v1.IDiskEncryptionStatus|null} [diskEncryptionStatus] BackupRun diskEncryptionStatus - * @property {google.cloud.sql.v1.SqlBackupKind|null} [backupKind] BackupRun backupKind - * @property {string|null} [timeZone] BackupRun timeZone - * @property {number|Long|null} [maxChargeableBytes] BackupRun maxChargeableBytes - */ - - /** - * Constructs a new BackupRun. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a BackupRun. - * @implements IBackupRun - * @constructor - * @param {google.cloud.sql.v1.IBackupRun=} [properties] Properties to set - */ - function BackupRun(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupRun kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.kind = ""; - - /** - * BackupRun status. - * @member {google.cloud.sql.v1.SqlBackupRunStatus} status - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.status = 0; - - /** - * BackupRun enqueuedTime. - * @member {google.protobuf.ITimestamp|null|undefined} enqueuedTime - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.enqueuedTime = null; - - /** - * BackupRun id. - * @member {number|Long} id - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BackupRun startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.startTime = null; - - /** - * BackupRun endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.endTime = null; - - /** - * BackupRun error. - * @member {google.cloud.sql.v1.IOperationError|null|undefined} error - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.error = null; - - /** - * BackupRun type. - * @member {google.cloud.sql.v1.SqlBackupRunType} type - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.type = 0; - - /** - * BackupRun description. - * @member {string} description - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.description = ""; - - /** - * BackupRun windowStartTime. - * @member {google.protobuf.ITimestamp|null|undefined} windowStartTime - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.windowStartTime = null; - - /** - * BackupRun instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.instance = ""; - - /** - * BackupRun selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.selfLink = ""; - - /** - * BackupRun location. - * @member {string} location - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.location = ""; - - /** - * BackupRun databaseVersion. - * @member {google.cloud.sql.v1.SqlDatabaseVersion} databaseVersion - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.databaseVersion = 0; - - /** - * BackupRun diskEncryptionConfiguration. - * @member {google.cloud.sql.v1.IDiskEncryptionConfiguration|null|undefined} diskEncryptionConfiguration - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.diskEncryptionConfiguration = null; - - /** - * BackupRun diskEncryptionStatus. - * @member {google.cloud.sql.v1.IDiskEncryptionStatus|null|undefined} diskEncryptionStatus - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.diskEncryptionStatus = null; - - /** - * BackupRun backupKind. - * @member {google.cloud.sql.v1.SqlBackupKind} backupKind - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.backupKind = 0; - - /** - * BackupRun timeZone. - * @member {string} timeZone - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.timeZone = ""; - - /** - * BackupRun maxChargeableBytes. - * @member {number|Long|null|undefined} maxChargeableBytes - * @memberof google.cloud.sql.v1.BackupRun - * @instance - */ - BackupRun.prototype.maxChargeableBytes = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(BackupRun.prototype, "_maxChargeableBytes", { - get: $util.oneOfGetter($oneOfFields = ["maxChargeableBytes"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new BackupRun instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.BackupRun - * @static - * @param {google.cloud.sql.v1.IBackupRun=} [properties] Properties to set - * @returns {google.cloud.sql.v1.BackupRun} BackupRun instance - */ - BackupRun.create = function create(properties) { - return new BackupRun(properties); - }; - - /** - * Encodes the specified BackupRun message. Does not implicitly {@link google.cloud.sql.v1.BackupRun.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.BackupRun - * @static - * @param {google.cloud.sql.v1.IBackupRun} message BackupRun message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRun.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.status); - if (message.enqueuedTime != null && Object.hasOwnProperty.call(message, "enqueuedTime")) - $root.google.protobuf.Timestamp.encode(message.enqueuedTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.id); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.cloud.sql.v1.OperationError.encode(message.error, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.type); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.description); - if (message.windowStartTime != null && Object.hasOwnProperty.call(message, "windowStartTime")) - $root.google.protobuf.Timestamp.encode(message.windowStartTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.instance); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.selfLink); - if (message.location != null && Object.hasOwnProperty.call(message, "location")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.location); - if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.databaseVersion); - if (message.diskEncryptionConfiguration != null && Object.hasOwnProperty.call(message, "diskEncryptionConfiguration")) - $root.google.cloud.sql.v1.DiskEncryptionConfiguration.encode(message.diskEncryptionConfiguration, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - if (message.diskEncryptionStatus != null && Object.hasOwnProperty.call(message, "diskEncryptionStatus")) - $root.google.cloud.sql.v1.DiskEncryptionStatus.encode(message.diskEncryptionStatus, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.backupKind != null && Object.hasOwnProperty.call(message, "backupKind")) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.backupKind); - if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.timeZone); - if (message.maxChargeableBytes != null && Object.hasOwnProperty.call(message, "maxChargeableBytes")) - writer.uint32(/* id 24, wireType 0 =*/192).int64(message.maxChargeableBytes); - return writer; - }; - - /** - * Encodes the specified BackupRun message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRun.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.BackupRun - * @static - * @param {google.cloud.sql.v1.IBackupRun} message BackupRun message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRun.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupRun message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.BackupRun - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.BackupRun} BackupRun - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRun.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupRun(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.status = reader.int32(); - break; - } - case 3: { - message.enqueuedTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 4: { - message.id = reader.int64(); - break; - } - case 5: { - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 6: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 7: { - message.error = $root.google.cloud.sql.v1.OperationError.decode(reader, reader.uint32()); - break; - } - case 8: { - message.type = reader.int32(); - break; - } - case 9: { - message.description = reader.string(); - break; - } - case 10: { - message.windowStartTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 11: { - message.instance = reader.string(); - break; - } - case 12: { - message.selfLink = reader.string(); - break; - } - case 13: { - message.location = reader.string(); - break; - } - case 15: { - message.databaseVersion = reader.int32(); - break; - } - case 16: { - message.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.decode(reader, reader.uint32()); - break; - } - case 17: { - message.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.decode(reader, reader.uint32()); - break; - } - case 19: { - message.backupKind = reader.int32(); - break; - } - case 23: { - message.timeZone = reader.string(); - break; - } - case 24: { - message.maxChargeableBytes = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupRun message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.BackupRun - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.BackupRun} BackupRun - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRun.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupRun message. - * @function verify - * @memberof google.cloud.sql.v1.BackupRun - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupRun.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.status != null && message.hasOwnProperty("status")) - switch (message.status) { - default: - return "status: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - break; - } - if (message.enqueuedTime != null && message.hasOwnProperty("enqueuedTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.enqueuedTime); - if (error) - return "enqueuedTime." + error; - } - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) - return "id: integer|Long expected"; - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.cloud.sql.v1.OperationError.verify(message.error); - if (error) - return "error." + error; - } - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.windowStartTime != null && message.hasOwnProperty("windowStartTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.windowStartTime); - if (error) - return "windowStartTime." + error; - } - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.location != null && message.hasOwnProperty("location")) - if (!$util.isString(message.location)) - return "location: string expected"; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - switch (message.databaseVersion) { - default: - return "databaseVersion: enum value expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 684: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - case 549: - case 550: - case 551: - break; - } - if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) { - var error = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.verify(message.diskEncryptionConfiguration); - if (error) - return "diskEncryptionConfiguration." + error; - } - if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) { - var error = $root.google.cloud.sql.v1.DiskEncryptionStatus.verify(message.diskEncryptionStatus); - if (error) - return "diskEncryptionStatus." + error; - } - if (message.backupKind != null && message.hasOwnProperty("backupKind")) - switch (message.backupKind) { - default: - return "backupKind: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - if (!$util.isString(message.timeZone)) - return "timeZone: string expected"; - if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { - properties._maxChargeableBytes = 1; - if (!$util.isInteger(message.maxChargeableBytes) && !(message.maxChargeableBytes && $util.isInteger(message.maxChargeableBytes.low) && $util.isInteger(message.maxChargeableBytes.high))) - return "maxChargeableBytes: integer|Long expected"; - } - return null; - }; - - /** - * Creates a BackupRun message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.BackupRun - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.BackupRun} BackupRun - */ - BackupRun.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.BackupRun) - return object; - var message = new $root.google.cloud.sql.v1.BackupRun(); - if (object.kind != null) - message.kind = String(object.kind); - switch (object.status) { - default: - if (typeof object.status === "number") { - message.status = object.status; - break; - } - break; - case "SQL_BACKUP_RUN_STATUS_UNSPECIFIED": - case 0: - message.status = 0; - break; - case "ENQUEUED": - case 1: - message.status = 1; - break; - case "OVERDUE": - case 2: - message.status = 2; - break; - case "RUNNING": - case 3: - message.status = 3; - break; - case "FAILED": - case 4: - message.status = 4; - break; - case "SUCCESSFUL": - case 5: - message.status = 5; - break; - case "SKIPPED": - case 6: - message.status = 6; - break; - case "DELETION_PENDING": - case 7: - message.status = 7; - break; - case "DELETION_FAILED": - case 8: - message.status = 8; - break; - case "DELETED": - case 9: - message.status = 9; - break; - } - if (object.enqueuedTime != null) { - if (typeof object.enqueuedTime !== "object") - throw TypeError(".google.cloud.sql.v1.BackupRun.enqueuedTime: object expected"); - message.enqueuedTime = $root.google.protobuf.Timestamp.fromObject(object.enqueuedTime); - } - if (object.id != null) - if ($util.Long) - (message.id = $util.Long.fromValue(object.id)).unsigned = false; - else if (typeof object.id === "string") - message.id = parseInt(object.id, 10); - else if (typeof object.id === "number") - message.id = object.id; - else if (typeof object.id === "object") - message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.cloud.sql.v1.BackupRun.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.sql.v1.BackupRun.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.sql.v1.BackupRun.error: object expected"); - message.error = $root.google.cloud.sql.v1.OperationError.fromObject(object.error); - } - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "SQL_BACKUP_RUN_TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "AUTOMATED": - case 1: - message.type = 1; - break; - case "ON_DEMAND": - case 2: - message.type = 2; - break; - } - if (object.description != null) - message.description = String(object.description); - if (object.windowStartTime != null) { - if (typeof object.windowStartTime !== "object") - throw TypeError(".google.cloud.sql.v1.BackupRun.windowStartTime: object expected"); - message.windowStartTime = $root.google.protobuf.Timestamp.fromObject(object.windowStartTime); - } - if (object.instance != null) - message.instance = String(object.instance); - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - if (object.location != null) - message.location = String(object.location); - switch (object.databaseVersion) { - default: - if (typeof object.databaseVersion === "number") { - message.databaseVersion = object.databaseVersion; - break; - } - break; - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.databaseVersion = 0; - break; - case "MYSQL_5_1": - case 2: - message.databaseVersion = 2; - break; - case "MYSQL_5_5": - case 3: - message.databaseVersion = 3; - break; - case "MYSQL_5_6": - case 5: - message.databaseVersion = 5; - break; - case "MYSQL_5_7": - case 6: - message.databaseVersion = 6; - break; - case "MYSQL_8_0": - case 20: - message.databaseVersion = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.databaseVersion = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.databaseVersion = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.databaseVersion = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.databaseVersion = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.databaseVersion = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.databaseVersion = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.databaseVersion = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.databaseVersion = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.databaseVersion = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.databaseVersion = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.databaseVersion = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.databaseVersion = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.databaseVersion = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.databaseVersion = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.databaseVersion = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.databaseVersion = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.databaseVersion = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.databaseVersion = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.databaseVersion = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.databaseVersion = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.databaseVersion = 556; - break; - case "MYSQL_8_4": - case 398: - message.databaseVersion = 398; - break; - case "MYSQL_9_7": - case 654: - message.databaseVersion = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.databaseVersion = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.databaseVersion = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.databaseVersion = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.databaseVersion = 16; - break; - case "POSTGRES_9_6": - case 9: - message.databaseVersion = 9; - break; - case "POSTGRES_10": - case 18: - message.databaseVersion = 18; - break; - case "POSTGRES_11": - case 10: - message.databaseVersion = 10; - break; - case "POSTGRES_12": - case 19: - message.databaseVersion = 19; - break; - case "POSTGRES_13": - case 23: - message.databaseVersion = 23; - break; - case "POSTGRES_14": - case 110: - message.databaseVersion = 110; - break; - case "POSTGRES_15": - case 172: - message.databaseVersion = 172; - break; - case "POSTGRES_16": - case 272: - message.databaseVersion = 272; - break; - case "POSTGRES_17": - case 408: - message.databaseVersion = 408; - break; - case "POSTGRES_18": - case 557: - message.databaseVersion = 557; - break; - case "POSTGRES_19": - case 684: - message.databaseVersion = 684; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.databaseVersion = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.databaseVersion = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.databaseVersion = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.databaseVersion = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.databaseVersion = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.databaseVersion = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.databaseVersion = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.databaseVersion = 202; - break; - case "SQLSERVER_2025_STANDARD": - case 549: - message.databaseVersion = 549; - break; - case "SQLSERVER_2025_ENTERPRISE": - case 550: - message.databaseVersion = 550; - break; - case "SQLSERVER_2025_EXPRESS": - case 551: - message.databaseVersion = 551; - break; - } - if (object.diskEncryptionConfiguration != null) { - if (typeof object.diskEncryptionConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1.BackupRun.diskEncryptionConfiguration: object expected"); - message.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.fromObject(object.diskEncryptionConfiguration); - } - if (object.diskEncryptionStatus != null) { - if (typeof object.diskEncryptionStatus !== "object") - throw TypeError(".google.cloud.sql.v1.BackupRun.diskEncryptionStatus: object expected"); - message.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.fromObject(object.diskEncryptionStatus); - } - switch (object.backupKind) { - default: - if (typeof object.backupKind === "number") { - message.backupKind = object.backupKind; - break; - } - break; - case "SQL_BACKUP_KIND_UNSPECIFIED": - case 0: - message.backupKind = 0; - break; - case "SNAPSHOT": - case 1: - message.backupKind = 1; - break; - case "PHYSICAL": - case 2: - message.backupKind = 2; - break; - } - if (object.timeZone != null) - message.timeZone = String(object.timeZone); - if (object.maxChargeableBytes != null) - if ($util.Long) - (message.maxChargeableBytes = $util.Long.fromValue(object.maxChargeableBytes)).unsigned = false; - else if (typeof object.maxChargeableBytes === "string") - message.maxChargeableBytes = parseInt(object.maxChargeableBytes, 10); - else if (typeof object.maxChargeableBytes === "number") - message.maxChargeableBytes = object.maxChargeableBytes; - else if (typeof object.maxChargeableBytes === "object") - message.maxChargeableBytes = new $util.LongBits(object.maxChargeableBytes.low >>> 0, object.maxChargeableBytes.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a BackupRun message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.BackupRun - * @static - * @param {google.cloud.sql.v1.BackupRun} message BackupRun - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupRun.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.status = options.enums === String ? "SQL_BACKUP_RUN_STATUS_UNSPECIFIED" : 0; - object.enqueuedTime = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.id = options.longs === String ? "0" : 0; - object.startTime = null; - object.endTime = null; - object.error = null; - object.type = options.enums === String ? "SQL_BACKUP_RUN_TYPE_UNSPECIFIED" : 0; - object.description = ""; - object.windowStartTime = null; - object.instance = ""; - object.selfLink = ""; - object.location = ""; - object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; - object.diskEncryptionConfiguration = null; - object.diskEncryptionStatus = null; - object.backupKind = options.enums === String ? "SQL_BACKUP_KIND_UNSPECIFIED" : 0; - object.timeZone = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.google.cloud.sql.v1.SqlBackupRunStatus[message.status] === undefined ? message.status : $root.google.cloud.sql.v1.SqlBackupRunStatus[message.status] : message.status; - if (message.enqueuedTime != null && message.hasOwnProperty("enqueuedTime")) - object.enqueuedTime = $root.google.protobuf.Timestamp.toObject(message.enqueuedTime, options); - if (message.id != null && message.hasOwnProperty("id")) - if (typeof message.id === "number") - object.id = options.longs === String ? String(message.id) : message.id; - else - object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.cloud.sql.v1.OperationError.toObject(message.error, options); - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1.SqlBackupRunType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.SqlBackupRunType[message.type] : message.type; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.windowStartTime != null && message.hasOwnProperty("windowStartTime")) - object.windowStartTime = $root.google.protobuf.Timestamp.toObject(message.windowStartTime, options); - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.location != null && message.hasOwnProperty("location")) - object.location = message.location; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; - if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) - object.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.toObject(message.diskEncryptionConfiguration, options); - if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) - object.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.toObject(message.diskEncryptionStatus, options); - if (message.backupKind != null && message.hasOwnProperty("backupKind")) - object.backupKind = options.enums === String ? $root.google.cloud.sql.v1.SqlBackupKind[message.backupKind] === undefined ? message.backupKind : $root.google.cloud.sql.v1.SqlBackupKind[message.backupKind] : message.backupKind; - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - object.timeZone = message.timeZone; - if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { - if (typeof message.maxChargeableBytes === "number") - object.maxChargeableBytes = options.longs === String ? String(message.maxChargeableBytes) : message.maxChargeableBytes; - else - object.maxChargeableBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxChargeableBytes) : options.longs === Number ? new $util.LongBits(message.maxChargeableBytes.low >>> 0, message.maxChargeableBytes.high >>> 0).toNumber() : message.maxChargeableBytes; - if (options.oneofs) - object._maxChargeableBytes = "maxChargeableBytes"; - } - return object; - }; - - /** - * Converts this BackupRun to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.BackupRun - * @instance - * @returns {Object.} JSON object - */ - BackupRun.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupRun - * @function getTypeUrl - * @memberof google.cloud.sql.v1.BackupRun - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupRun.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.BackupRun"; - }; - - return BackupRun; - })(); - - v1.BackupRunsListResponse = (function() { - - /** - * Properties of a BackupRunsListResponse. - * @memberof google.cloud.sql.v1 - * @interface IBackupRunsListResponse - * @property {string|null} [kind] BackupRunsListResponse kind - * @property {Array.|null} [items] BackupRunsListResponse items - * @property {string|null} [nextPageToken] BackupRunsListResponse nextPageToken - */ - - /** - * Constructs a new BackupRunsListResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a BackupRunsListResponse. - * @implements IBackupRunsListResponse - * @constructor - * @param {google.cloud.sql.v1.IBackupRunsListResponse=} [properties] Properties to set - */ - function BackupRunsListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupRunsListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @instance - */ - BackupRunsListResponse.prototype.kind = ""; - - /** - * BackupRunsListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @instance - */ - BackupRunsListResponse.prototype.items = $util.emptyArray; - - /** - * BackupRunsListResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @instance - */ - BackupRunsListResponse.prototype.nextPageToken = ""; - - /** - * Creates a new BackupRunsListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @static - * @param {google.cloud.sql.v1.IBackupRunsListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.BackupRunsListResponse} BackupRunsListResponse instance - */ - BackupRunsListResponse.create = function create(properties) { - return new BackupRunsListResponse(properties); - }; - - /** - * Encodes the specified BackupRunsListResponse message. Does not implicitly {@link google.cloud.sql.v1.BackupRunsListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @static - * @param {google.cloud.sql.v1.IBackupRunsListResponse} message BackupRunsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRunsListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1.BackupRun.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified BackupRunsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRunsListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @static - * @param {google.cloud.sql.v1.IBackupRunsListResponse} message BackupRunsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRunsListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupRunsListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.BackupRunsListResponse} BackupRunsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRunsListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupRunsListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1.BackupRun.decode(reader, reader.uint32())); - break; - } - case 3: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupRunsListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.BackupRunsListResponse} BackupRunsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRunsListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupRunsListResponse message. - * @function verify - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupRunsListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1.BackupRun.verify(message.items[i]); - if (error) - return "items." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a BackupRunsListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.BackupRunsListResponse} BackupRunsListResponse - */ - BackupRunsListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.BackupRunsListResponse) - return object; - var message = new $root.google.cloud.sql.v1.BackupRunsListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1.BackupRunsListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1.BackupRunsListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1.BackupRun.fromObject(object.items[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a BackupRunsListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @static - * @param {google.cloud.sql.v1.BackupRunsListResponse} message BackupRunsListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupRunsListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) { - object.kind = ""; - object.nextPageToken = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1.BackupRun.toObject(message.items[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this BackupRunsListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @instance - * @returns {Object.} JSON object - */ - BackupRunsListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupRunsListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.BackupRunsListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupRunsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.BackupRunsListResponse"; - }; - - return BackupRunsListResponse; - })(); - - /** - * SqlBackupRunStatus enum. - * @name google.cloud.sql.v1.SqlBackupRunStatus - * @enum {number} - * @property {number} SQL_BACKUP_RUN_STATUS_UNSPECIFIED=0 SQL_BACKUP_RUN_STATUS_UNSPECIFIED value - * @property {number} ENQUEUED=1 ENQUEUED value - * @property {number} OVERDUE=2 OVERDUE value - * @property {number} RUNNING=3 RUNNING value - * @property {number} FAILED=4 FAILED value - * @property {number} SUCCESSFUL=5 SUCCESSFUL value - * @property {number} SKIPPED=6 SKIPPED value - * @property {number} DELETION_PENDING=7 DELETION_PENDING value - * @property {number} DELETION_FAILED=8 DELETION_FAILED value - * @property {number} DELETED=9 DELETED value - */ - v1.SqlBackupRunStatus = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKUP_RUN_STATUS_UNSPECIFIED"] = 0; - values[valuesById[1] = "ENQUEUED"] = 1; - values[valuesById[2] = "OVERDUE"] = 2; - values[valuesById[3] = "RUNNING"] = 3; - values[valuesById[4] = "FAILED"] = 4; - values[valuesById[5] = "SUCCESSFUL"] = 5; - values[valuesById[6] = "SKIPPED"] = 6; - values[valuesById[7] = "DELETION_PENDING"] = 7; - values[valuesById[8] = "DELETION_FAILED"] = 8; - values[valuesById[9] = "DELETED"] = 9; - return values; - })(); - - /** - * SqlBackupKind enum. - * @name google.cloud.sql.v1.SqlBackupKind - * @enum {number} - * @property {number} SQL_BACKUP_KIND_UNSPECIFIED=0 SQL_BACKUP_KIND_UNSPECIFIED value - * @property {number} SNAPSHOT=1 SNAPSHOT value - * @property {number} PHYSICAL=2 PHYSICAL value - */ - v1.SqlBackupKind = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKUP_KIND_UNSPECIFIED"] = 0; - values[valuesById[1] = "SNAPSHOT"] = 1; - values[valuesById[2] = "PHYSICAL"] = 2; - return values; - })(); - - /** - * SqlBackupRunType enum. - * @name google.cloud.sql.v1.SqlBackupRunType - * @enum {number} - * @property {number} SQL_BACKUP_RUN_TYPE_UNSPECIFIED=0 SQL_BACKUP_RUN_TYPE_UNSPECIFIED value - * @property {number} AUTOMATED=1 AUTOMATED value - * @property {number} ON_DEMAND=2 ON_DEMAND value - */ - v1.SqlBackupRunType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKUP_RUN_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUTOMATED"] = 1; - values[valuesById[2] = "ON_DEMAND"] = 2; - return values; - })(); - - v1.AclEntry = (function() { - - /** - * Properties of an AclEntry. - * @memberof google.cloud.sql.v1 - * @interface IAclEntry - * @property {string|null} [value] AclEntry value - * @property {google.protobuf.ITimestamp|null} [expirationTime] AclEntry expirationTime - * @property {string|null} [name] AclEntry name - * @property {string|null} [kind] AclEntry kind - */ - - /** - * Constructs a new AclEntry. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an AclEntry. - * @implements IAclEntry - * @constructor - * @param {google.cloud.sql.v1.IAclEntry=} [properties] Properties to set - */ - function AclEntry(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AclEntry value. - * @member {string} value - * @memberof google.cloud.sql.v1.AclEntry - * @instance - */ - AclEntry.prototype.value = ""; - - /** - * AclEntry expirationTime. - * @member {google.protobuf.ITimestamp|null|undefined} expirationTime - * @memberof google.cloud.sql.v1.AclEntry - * @instance - */ - AclEntry.prototype.expirationTime = null; - - /** - * AclEntry name. - * @member {string} name - * @memberof google.cloud.sql.v1.AclEntry - * @instance - */ - AclEntry.prototype.name = ""; - - /** - * AclEntry kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.AclEntry - * @instance - */ - AclEntry.prototype.kind = ""; - - /** - * Creates a new AclEntry instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.AclEntry - * @static - * @param {google.cloud.sql.v1.IAclEntry=} [properties] Properties to set - * @returns {google.cloud.sql.v1.AclEntry} AclEntry instance - */ - AclEntry.create = function create(properties) { - return new AclEntry(properties); - }; - - /** - * Encodes the specified AclEntry message. Does not implicitly {@link google.cloud.sql.v1.AclEntry.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.AclEntry - * @static - * @param {google.cloud.sql.v1.IAclEntry} message AclEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AclEntry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.expirationTime != null && Object.hasOwnProperty.call(message, "expirationTime")) - $root.google.protobuf.Timestamp.encode(message.expirationTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); - return writer; - }; - - /** - * Encodes the specified AclEntry message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AclEntry.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.AclEntry - * @static - * @param {google.cloud.sql.v1.IAclEntry} message AclEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AclEntry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AclEntry message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.AclEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.AclEntry} AclEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AclEntry.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.AclEntry(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.string(); - break; - } - case 2: { - message.expirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.name = reader.string(); - break; - } - case 4: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AclEntry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.AclEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.AclEntry} AclEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AclEntry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AclEntry message. - * @function verify - * @memberof google.cloud.sql.v1.AclEntry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AclEntry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.expirationTime); - if (error) - return "expirationTime." + error; - } - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates an AclEntry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.AclEntry - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.AclEntry} AclEntry - */ - AclEntry.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.AclEntry) - return object; - var message = new $root.google.cloud.sql.v1.AclEntry(); - if (object.value != null) - message.value = String(object.value); - if (object.expirationTime != null) { - if (typeof object.expirationTime !== "object") - throw TypeError(".google.cloud.sql.v1.AclEntry.expirationTime: object expected"); - message.expirationTime = $root.google.protobuf.Timestamp.fromObject(object.expirationTime); - } - if (object.name != null) - message.name = String(object.name); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from an AclEntry message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.AclEntry - * @static - * @param {google.cloud.sql.v1.AclEntry} message AclEntry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AclEntry.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.value = ""; - object.expirationTime = null; - object.name = ""; - object.kind = ""; - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) - object.expirationTime = $root.google.protobuf.Timestamp.toObject(message.expirationTime, options); - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this AclEntry to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.AclEntry - * @instance - * @returns {Object.} JSON object - */ - AclEntry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AclEntry - * @function getTypeUrl - * @memberof google.cloud.sql.v1.AclEntry - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AclEntry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.AclEntry"; - }; - - return AclEntry; - })(); - - v1.ApiWarning = (function() { - - /** - * Properties of an ApiWarning. - * @memberof google.cloud.sql.v1 - * @interface IApiWarning - * @property {google.cloud.sql.v1.ApiWarning.SqlApiWarningCode|null} [code] ApiWarning code - * @property {string|null} [message] ApiWarning message - * @property {string|null} [region] ApiWarning region - */ - - /** - * Constructs a new ApiWarning. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an ApiWarning. - * @implements IApiWarning - * @constructor - * @param {google.cloud.sql.v1.IApiWarning=} [properties] Properties to set - */ - function ApiWarning(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ApiWarning code. - * @member {google.cloud.sql.v1.ApiWarning.SqlApiWarningCode} code - * @memberof google.cloud.sql.v1.ApiWarning - * @instance - */ - ApiWarning.prototype.code = 0; - - /** - * ApiWarning message. - * @member {string} message - * @memberof google.cloud.sql.v1.ApiWarning - * @instance - */ - ApiWarning.prototype.message = ""; - - /** - * ApiWarning region. - * @member {string} region - * @memberof google.cloud.sql.v1.ApiWarning - * @instance - */ - ApiWarning.prototype.region = ""; - - /** - * Creates a new ApiWarning instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ApiWarning - * @static - * @param {google.cloud.sql.v1.IApiWarning=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ApiWarning} ApiWarning instance - */ - ApiWarning.create = function create(properties) { - return new ApiWarning(properties); - }; - - /** - * Encodes the specified ApiWarning message. Does not implicitly {@link google.cloud.sql.v1.ApiWarning.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ApiWarning - * @static - * @param {google.cloud.sql.v1.IApiWarning} message ApiWarning message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ApiWarning.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); - if (message.region != null && Object.hasOwnProperty.call(message, "region")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.region); - return writer; - }; - - /** - * Encodes the specified ApiWarning message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ApiWarning.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ApiWarning - * @static - * @param {google.cloud.sql.v1.IApiWarning} message ApiWarning message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ApiWarning.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ApiWarning message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ApiWarning - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ApiWarning} ApiWarning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ApiWarning.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ApiWarning(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.code = reader.int32(); - break; - } - case 2: { - message.message = reader.string(); - break; - } - case 3: { - message.region = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ApiWarning message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ApiWarning - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ApiWarning} ApiWarning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ApiWarning.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ApiWarning message. - * @function verify - * @memberof google.cloud.sql.v1.ApiWarning - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ApiWarning.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.code != null && message.hasOwnProperty("code")) - switch (message.code) { - default: - return "code: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (message.region != null && message.hasOwnProperty("region")) - if (!$util.isString(message.region)) - return "region: string expected"; - return null; - }; - - /** - * Creates an ApiWarning message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ApiWarning - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ApiWarning} ApiWarning - */ - ApiWarning.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ApiWarning) - return object; - var message = new $root.google.cloud.sql.v1.ApiWarning(); - switch (object.code) { - default: - if (typeof object.code === "number") { - message.code = object.code; - break; - } - break; - case "SQL_API_WARNING_CODE_UNSPECIFIED": - case 0: - message.code = 0; - break; - case "REGION_UNREACHABLE": - case 1: - message.code = 1; - break; - case "MAX_RESULTS_EXCEEDS_LIMIT": - case 2: - message.code = 2; - break; - case "COMPROMISED_CREDENTIALS": - case 3: - message.code = 3; - break; - case "INTERNAL_STATE_FAILURE": - case 4: - message.code = 4; - break; - } - if (object.message != null) - message.message = String(object.message); - if (object.region != null) - message.region = String(object.region); - return message; - }; - - /** - * Creates a plain object from an ApiWarning message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ApiWarning - * @static - * @param {google.cloud.sql.v1.ApiWarning} message ApiWarning - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ApiWarning.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.code = options.enums === String ? "SQL_API_WARNING_CODE_UNSPECIFIED" : 0; - object.message = ""; - object.region = ""; - } - if (message.code != null && message.hasOwnProperty("code")) - object.code = options.enums === String ? $root.google.cloud.sql.v1.ApiWarning.SqlApiWarningCode[message.code] === undefined ? message.code : $root.google.cloud.sql.v1.ApiWarning.SqlApiWarningCode[message.code] : message.code; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.region != null && message.hasOwnProperty("region")) - object.region = message.region; - return object; - }; - - /** - * Converts this ApiWarning to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ApiWarning - * @instance - * @returns {Object.} JSON object - */ - ApiWarning.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ApiWarning - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ApiWarning - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ApiWarning.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ApiWarning"; - }; - - /** - * SqlApiWarningCode enum. - * @name google.cloud.sql.v1.ApiWarning.SqlApiWarningCode - * @enum {number} - * @property {number} SQL_API_WARNING_CODE_UNSPECIFIED=0 SQL_API_WARNING_CODE_UNSPECIFIED value - * @property {number} REGION_UNREACHABLE=1 REGION_UNREACHABLE value - * @property {number} MAX_RESULTS_EXCEEDS_LIMIT=2 MAX_RESULTS_EXCEEDS_LIMIT value - * @property {number} COMPROMISED_CREDENTIALS=3 COMPROMISED_CREDENTIALS value - * @property {number} INTERNAL_STATE_FAILURE=4 INTERNAL_STATE_FAILURE value - */ - ApiWarning.SqlApiWarningCode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_API_WARNING_CODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "REGION_UNREACHABLE"] = 1; - values[valuesById[2] = "MAX_RESULTS_EXCEEDS_LIMIT"] = 2; - values[valuesById[3] = "COMPROMISED_CREDENTIALS"] = 3; - values[valuesById[4] = "INTERNAL_STATE_FAILURE"] = 4; - return values; - })(); - - return ApiWarning; - })(); - - v1.BackupRetentionSettings = (function() { - - /** - * Properties of a BackupRetentionSettings. - * @memberof google.cloud.sql.v1 - * @interface IBackupRetentionSettings - * @property {google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit|null} [retentionUnit] BackupRetentionSettings retentionUnit - * @property {google.protobuf.IInt32Value|null} [retainedBackups] BackupRetentionSettings retainedBackups - */ - - /** - * Constructs a new BackupRetentionSettings. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a BackupRetentionSettings. - * @implements IBackupRetentionSettings - * @constructor - * @param {google.cloud.sql.v1.IBackupRetentionSettings=} [properties] Properties to set - */ - function BackupRetentionSettings(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupRetentionSettings retentionUnit. - * @member {google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit} retentionUnit - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @instance - */ - BackupRetentionSettings.prototype.retentionUnit = 0; - - /** - * BackupRetentionSettings retainedBackups. - * @member {google.protobuf.IInt32Value|null|undefined} retainedBackups - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @instance - */ - BackupRetentionSettings.prototype.retainedBackups = null; - - /** - * Creates a new BackupRetentionSettings instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @static - * @param {google.cloud.sql.v1.IBackupRetentionSettings=} [properties] Properties to set - * @returns {google.cloud.sql.v1.BackupRetentionSettings} BackupRetentionSettings instance - */ - BackupRetentionSettings.create = function create(properties) { - return new BackupRetentionSettings(properties); - }; - - /** - * Encodes the specified BackupRetentionSettings message. Does not implicitly {@link google.cloud.sql.v1.BackupRetentionSettings.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @static - * @param {google.cloud.sql.v1.IBackupRetentionSettings} message BackupRetentionSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRetentionSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.retentionUnit != null && Object.hasOwnProperty.call(message, "retentionUnit")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.retentionUnit); - if (message.retainedBackups != null && Object.hasOwnProperty.call(message, "retainedBackups")) - $root.google.protobuf.Int32Value.encode(message.retainedBackups, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified BackupRetentionSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupRetentionSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @static - * @param {google.cloud.sql.v1.IBackupRetentionSettings} message BackupRetentionSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRetentionSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupRetentionSettings message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.BackupRetentionSettings} BackupRetentionSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRetentionSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupRetentionSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.retentionUnit = reader.int32(); - break; - } - case 2: { - message.retainedBackups = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupRetentionSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.BackupRetentionSettings} BackupRetentionSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRetentionSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupRetentionSettings message. - * @function verify - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupRetentionSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.retentionUnit != null && message.hasOwnProperty("retentionUnit")) - switch (message.retentionUnit) { - default: - return "retentionUnit: enum value expected"; - case 0: - case 1: - break; - } - if (message.retainedBackups != null && message.hasOwnProperty("retainedBackups")) { - var error = $root.google.protobuf.Int32Value.verify(message.retainedBackups); - if (error) - return "retainedBackups." + error; - } - return null; - }; - - /** - * Creates a BackupRetentionSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.BackupRetentionSettings} BackupRetentionSettings - */ - BackupRetentionSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.BackupRetentionSettings) - return object; - var message = new $root.google.cloud.sql.v1.BackupRetentionSettings(); - switch (object.retentionUnit) { - default: - if (typeof object.retentionUnit === "number") { - message.retentionUnit = object.retentionUnit; - break; - } - break; - case "RETENTION_UNIT_UNSPECIFIED": - case 0: - message.retentionUnit = 0; - break; - case "COUNT": - case 1: - message.retentionUnit = 1; - break; - } - if (object.retainedBackups != null) { - if (typeof object.retainedBackups !== "object") - throw TypeError(".google.cloud.sql.v1.BackupRetentionSettings.retainedBackups: object expected"); - message.retainedBackups = $root.google.protobuf.Int32Value.fromObject(object.retainedBackups); - } - return message; - }; - - /** - * Creates a plain object from a BackupRetentionSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @static - * @param {google.cloud.sql.v1.BackupRetentionSettings} message BackupRetentionSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupRetentionSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.retentionUnit = options.enums === String ? "RETENTION_UNIT_UNSPECIFIED" : 0; - object.retainedBackups = null; - } - if (message.retentionUnit != null && message.hasOwnProperty("retentionUnit")) - object.retentionUnit = options.enums === String ? $root.google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit[message.retentionUnit] === undefined ? message.retentionUnit : $root.google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit[message.retentionUnit] : message.retentionUnit; - if (message.retainedBackups != null && message.hasOwnProperty("retainedBackups")) - object.retainedBackups = $root.google.protobuf.Int32Value.toObject(message.retainedBackups, options); - return object; - }; - - /** - * Converts this BackupRetentionSettings to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @instance - * @returns {Object.} JSON object - */ - BackupRetentionSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupRetentionSettings - * @function getTypeUrl - * @memberof google.cloud.sql.v1.BackupRetentionSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupRetentionSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.BackupRetentionSettings"; - }; - - /** - * RetentionUnit enum. - * @name google.cloud.sql.v1.BackupRetentionSettings.RetentionUnit - * @enum {number} - * @property {number} RETENTION_UNIT_UNSPECIFIED=0 RETENTION_UNIT_UNSPECIFIED value - * @property {number} COUNT=1 COUNT value - */ - BackupRetentionSettings.RetentionUnit = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RETENTION_UNIT_UNSPECIFIED"] = 0; - values[valuesById[1] = "COUNT"] = 1; - return values; - })(); - - return BackupRetentionSettings; - })(); - - v1.BackupConfiguration = (function() { - - /** - * Properties of a BackupConfiguration. - * @memberof google.cloud.sql.v1 - * @interface IBackupConfiguration - * @property {string|null} [startTime] BackupConfiguration startTime - * @property {google.protobuf.IBoolValue|null} [enabled] BackupConfiguration enabled - * @property {string|null} [kind] BackupConfiguration kind - * @property {google.protobuf.IBoolValue|null} [binaryLogEnabled] BackupConfiguration binaryLogEnabled - * @property {google.protobuf.IBoolValue|null} [replicationLogArchivingEnabled] BackupConfiguration replicationLogArchivingEnabled - * @property {string|null} [location] BackupConfiguration location - * @property {google.protobuf.IBoolValue|null} [pointInTimeRecoveryEnabled] BackupConfiguration pointInTimeRecoveryEnabled - * @property {google.cloud.sql.v1.IBackupRetentionSettings|null} [backupRetentionSettings] BackupConfiguration backupRetentionSettings - * @property {google.protobuf.IInt32Value|null} [transactionLogRetentionDays] BackupConfiguration transactionLogRetentionDays - * @property {google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|null} [transactionalLogStorageState] BackupConfiguration transactionalLogStorageState - * @property {google.cloud.sql.v1.BackupConfiguration.BackupTier|null} [backupTier] BackupConfiguration backupTier - */ - - /** - * Constructs a new BackupConfiguration. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a BackupConfiguration. - * @implements IBackupConfiguration - * @constructor - * @param {google.cloud.sql.v1.IBackupConfiguration=} [properties] Properties to set - */ - function BackupConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupConfiguration startTime. - * @member {string} startTime - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.startTime = ""; - - /** - * BackupConfiguration enabled. - * @member {google.protobuf.IBoolValue|null|undefined} enabled - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.enabled = null; - - /** - * BackupConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.kind = ""; - - /** - * BackupConfiguration binaryLogEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} binaryLogEnabled - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.binaryLogEnabled = null; - - /** - * BackupConfiguration replicationLogArchivingEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} replicationLogArchivingEnabled - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.replicationLogArchivingEnabled = null; - - /** - * BackupConfiguration location. - * @member {string} location - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.location = ""; - - /** - * BackupConfiguration pointInTimeRecoveryEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} pointInTimeRecoveryEnabled - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.pointInTimeRecoveryEnabled = null; - - /** - * BackupConfiguration backupRetentionSettings. - * @member {google.cloud.sql.v1.IBackupRetentionSettings|null|undefined} backupRetentionSettings - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.backupRetentionSettings = null; - - /** - * BackupConfiguration transactionLogRetentionDays. - * @member {google.protobuf.IInt32Value|null|undefined} transactionLogRetentionDays - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.transactionLogRetentionDays = null; - - /** - * BackupConfiguration transactionalLogStorageState. - * @member {google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState|null|undefined} transactionalLogStorageState - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.transactionalLogStorageState = null; - - /** - * BackupConfiguration backupTier. - * @member {google.cloud.sql.v1.BackupConfiguration.BackupTier|null|undefined} backupTier - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.backupTier = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(BackupConfiguration.prototype, "_transactionalLogStorageState", { - get: $util.oneOfGetter($oneOfFields = ["transactionalLogStorageState"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(BackupConfiguration.prototype, "_backupTier", { - get: $util.oneOfGetter($oneOfFields = ["backupTier"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new BackupConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.BackupConfiguration - * @static - * @param {google.cloud.sql.v1.IBackupConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1.BackupConfiguration} BackupConfiguration instance - */ - BackupConfiguration.create = function create(properties) { - return new BackupConfiguration(properties); - }; - - /** - * Encodes the specified BackupConfiguration message. Does not implicitly {@link google.cloud.sql.v1.BackupConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.BackupConfiguration - * @static - * @param {google.cloud.sql.v1.IBackupConfiguration} message BackupConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.startTime); - if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) - $root.google.protobuf.BoolValue.encode(message.enabled, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - if (message.binaryLogEnabled != null && Object.hasOwnProperty.call(message, "binaryLogEnabled")) - $root.google.protobuf.BoolValue.encode(message.binaryLogEnabled, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.replicationLogArchivingEnabled != null && Object.hasOwnProperty.call(message, "replicationLogArchivingEnabled")) - $root.google.protobuf.BoolValue.encode(message.replicationLogArchivingEnabled, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.location != null && Object.hasOwnProperty.call(message, "location")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.location); - if (message.pointInTimeRecoveryEnabled != null && Object.hasOwnProperty.call(message, "pointInTimeRecoveryEnabled")) - $root.google.protobuf.BoolValue.encode(message.pointInTimeRecoveryEnabled, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.backupRetentionSettings != null && Object.hasOwnProperty.call(message, "backupRetentionSettings")) - $root.google.cloud.sql.v1.BackupRetentionSettings.encode(message.backupRetentionSettings, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.transactionLogRetentionDays != null && Object.hasOwnProperty.call(message, "transactionLogRetentionDays")) - $root.google.protobuf.Int32Value.encode(message.transactionLogRetentionDays, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.transactionalLogStorageState != null && Object.hasOwnProperty.call(message, "transactionalLogStorageState")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.transactionalLogStorageState); - if (message.backupTier != null && Object.hasOwnProperty.call(message, "backupTier")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.backupTier); - return writer; - }; - - /** - * Encodes the specified BackupConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.BackupConfiguration - * @static - * @param {google.cloud.sql.v1.IBackupConfiguration} message BackupConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.BackupConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.BackupConfiguration} BackupConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.startTime = reader.string(); - break; - } - case 2: { - message.enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - case 4: { - message.binaryLogEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 5: { - message.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 6: { - message.location = reader.string(); - break; - } - case 7: { - message.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 8: { - message.backupRetentionSettings = $root.google.cloud.sql.v1.BackupRetentionSettings.decode(reader, reader.uint32()); - break; - } - case 9: { - message.transactionLogRetentionDays = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 10: { - message.transactionalLogStorageState = reader.int32(); - break; - } - case 11: { - message.backupTier = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.BackupConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.BackupConfiguration} BackupConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1.BackupConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.startTime != null && message.hasOwnProperty("startTime")) - if (!$util.isString(message.startTime)) - return "startTime: string expected"; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.enabled); - if (error) - return "enabled." + error; - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.binaryLogEnabled != null && message.hasOwnProperty("binaryLogEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.binaryLogEnabled); - if (error) - return "binaryLogEnabled." + error; - } - if (message.replicationLogArchivingEnabled != null && message.hasOwnProperty("replicationLogArchivingEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.replicationLogArchivingEnabled); - if (error) - return "replicationLogArchivingEnabled." + error; - } - if (message.location != null && message.hasOwnProperty("location")) - if (!$util.isString(message.location)) - return "location: string expected"; - if (message.pointInTimeRecoveryEnabled != null && message.hasOwnProperty("pointInTimeRecoveryEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.pointInTimeRecoveryEnabled); - if (error) - return "pointInTimeRecoveryEnabled." + error; - } - if (message.backupRetentionSettings != null && message.hasOwnProperty("backupRetentionSettings")) { - var error = $root.google.cloud.sql.v1.BackupRetentionSettings.verify(message.backupRetentionSettings); - if (error) - return "backupRetentionSettings." + error; - } - if (message.transactionLogRetentionDays != null && message.hasOwnProperty("transactionLogRetentionDays")) { - var error = $root.google.protobuf.Int32Value.verify(message.transactionLogRetentionDays); - if (error) - return "transactionLogRetentionDays." + error; - } - if (message.transactionalLogStorageState != null && message.hasOwnProperty("transactionalLogStorageState")) { - properties._transactionalLogStorageState = 1; - switch (message.transactionalLogStorageState) { - default: - return "transactionalLogStorageState: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - } - if (message.backupTier != null && message.hasOwnProperty("backupTier")) { - properties._backupTier = 1; - switch (message.backupTier) { - default: - return "backupTier: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - } - return null; - }; - - /** - * Creates a BackupConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.BackupConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.BackupConfiguration} BackupConfiguration - */ - BackupConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.BackupConfiguration) - return object; - var message = new $root.google.cloud.sql.v1.BackupConfiguration(); - if (object.startTime != null) - message.startTime = String(object.startTime); - if (object.enabled != null) { - if (typeof object.enabled !== "object") - throw TypeError(".google.cloud.sql.v1.BackupConfiguration.enabled: object expected"); - message.enabled = $root.google.protobuf.BoolValue.fromObject(object.enabled); - } - if (object.kind != null) - message.kind = String(object.kind); - if (object.binaryLogEnabled != null) { - if (typeof object.binaryLogEnabled !== "object") - throw TypeError(".google.cloud.sql.v1.BackupConfiguration.binaryLogEnabled: object expected"); - message.binaryLogEnabled = $root.google.protobuf.BoolValue.fromObject(object.binaryLogEnabled); - } - if (object.replicationLogArchivingEnabled != null) { - if (typeof object.replicationLogArchivingEnabled !== "object") - throw TypeError(".google.cloud.sql.v1.BackupConfiguration.replicationLogArchivingEnabled: object expected"); - message.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.fromObject(object.replicationLogArchivingEnabled); - } - if (object.location != null) - message.location = String(object.location); - if (object.pointInTimeRecoveryEnabled != null) { - if (typeof object.pointInTimeRecoveryEnabled !== "object") - throw TypeError(".google.cloud.sql.v1.BackupConfiguration.pointInTimeRecoveryEnabled: object expected"); - message.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.fromObject(object.pointInTimeRecoveryEnabled); - } - if (object.backupRetentionSettings != null) { - if (typeof object.backupRetentionSettings !== "object") - throw TypeError(".google.cloud.sql.v1.BackupConfiguration.backupRetentionSettings: object expected"); - message.backupRetentionSettings = $root.google.cloud.sql.v1.BackupRetentionSettings.fromObject(object.backupRetentionSettings); - } - if (object.transactionLogRetentionDays != null) { - if (typeof object.transactionLogRetentionDays !== "object") - throw TypeError(".google.cloud.sql.v1.BackupConfiguration.transactionLogRetentionDays: object expected"); - message.transactionLogRetentionDays = $root.google.protobuf.Int32Value.fromObject(object.transactionLogRetentionDays); - } - switch (object.transactionalLogStorageState) { - default: - if (typeof object.transactionalLogStorageState === "number") { - message.transactionalLogStorageState = object.transactionalLogStorageState; - break; - } - break; - case "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED": - case 0: - message.transactionalLogStorageState = 0; - break; - case "DISK": - case 1: - message.transactionalLogStorageState = 1; - break; - case "SWITCHING_TO_CLOUD_STORAGE": - case 2: - message.transactionalLogStorageState = 2; - break; - case "SWITCHED_TO_CLOUD_STORAGE": - case 3: - message.transactionalLogStorageState = 3; - break; - case "CLOUD_STORAGE": - case 4: - message.transactionalLogStorageState = 4; - break; - } - switch (object.backupTier) { - default: - if (typeof object.backupTier === "number") { - message.backupTier = object.backupTier; - break; - } - break; - case "BACKUP_TIER_UNSPECIFIED": - case 0: - message.backupTier = 0; - break; - case "STANDARD": - case 1: - message.backupTier = 1; - break; - case "ADVANCED": - case 2: - message.backupTier = 2; - break; - case "ENHANCED": - case 3: - message.backupTier = 3; - break; - } - return message; - }; - - /** - * Creates a plain object from a BackupConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.BackupConfiguration - * @static - * @param {google.cloud.sql.v1.BackupConfiguration} message BackupConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.startTime = ""; - object.enabled = null; - object.kind = ""; - object.binaryLogEnabled = null; - object.replicationLogArchivingEnabled = null; - object.location = ""; - object.pointInTimeRecoveryEnabled = null; - object.backupRetentionSettings = null; - object.transactionLogRetentionDays = null; - } - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = message.startTime; - if (message.enabled != null && message.hasOwnProperty("enabled")) - object.enabled = $root.google.protobuf.BoolValue.toObject(message.enabled, options); - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.binaryLogEnabled != null && message.hasOwnProperty("binaryLogEnabled")) - object.binaryLogEnabled = $root.google.protobuf.BoolValue.toObject(message.binaryLogEnabled, options); - if (message.replicationLogArchivingEnabled != null && message.hasOwnProperty("replicationLogArchivingEnabled")) - object.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.toObject(message.replicationLogArchivingEnabled, options); - if (message.location != null && message.hasOwnProperty("location")) - object.location = message.location; - if (message.pointInTimeRecoveryEnabled != null && message.hasOwnProperty("pointInTimeRecoveryEnabled")) - object.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.toObject(message.pointInTimeRecoveryEnabled, options); - if (message.backupRetentionSettings != null && message.hasOwnProperty("backupRetentionSettings")) - object.backupRetentionSettings = $root.google.cloud.sql.v1.BackupRetentionSettings.toObject(message.backupRetentionSettings, options); - if (message.transactionLogRetentionDays != null && message.hasOwnProperty("transactionLogRetentionDays")) - object.transactionLogRetentionDays = $root.google.protobuf.Int32Value.toObject(message.transactionLogRetentionDays, options); - if (message.transactionalLogStorageState != null && message.hasOwnProperty("transactionalLogStorageState")) { - object.transactionalLogStorageState = options.enums === String ? $root.google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState[message.transactionalLogStorageState] === undefined ? message.transactionalLogStorageState : $root.google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState[message.transactionalLogStorageState] : message.transactionalLogStorageState; - if (options.oneofs) - object._transactionalLogStorageState = "transactionalLogStorageState"; - } - if (message.backupTier != null && message.hasOwnProperty("backupTier")) { - object.backupTier = options.enums === String ? $root.google.cloud.sql.v1.BackupConfiguration.BackupTier[message.backupTier] === undefined ? message.backupTier : $root.google.cloud.sql.v1.BackupConfiguration.BackupTier[message.backupTier] : message.backupTier; - if (options.oneofs) - object._backupTier = "backupTier"; - } - return object; - }; - - /** - * Converts this BackupConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.BackupConfiguration - * @instance - * @returns {Object.} JSON object - */ - BackupConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1.BackupConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.BackupConfiguration"; - }; - - /** - * TransactionalLogStorageState enum. - * @name google.cloud.sql.v1.BackupConfiguration.TransactionalLogStorageState - * @enum {number} - * @property {number} TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED=0 TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED value - * @property {number} DISK=1 DISK value - * @property {number} SWITCHING_TO_CLOUD_STORAGE=2 SWITCHING_TO_CLOUD_STORAGE value - * @property {number} SWITCHED_TO_CLOUD_STORAGE=3 SWITCHED_TO_CLOUD_STORAGE value - * @property {number} CLOUD_STORAGE=4 CLOUD_STORAGE value - */ - BackupConfiguration.TransactionalLogStorageState = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISK"] = 1; - values[valuesById[2] = "SWITCHING_TO_CLOUD_STORAGE"] = 2; - values[valuesById[3] = "SWITCHED_TO_CLOUD_STORAGE"] = 3; - values[valuesById[4] = "CLOUD_STORAGE"] = 4; - return values; - })(); - - /** - * BackupTier enum. - * @name google.cloud.sql.v1.BackupConfiguration.BackupTier - * @enum {number} - * @property {number} BACKUP_TIER_UNSPECIFIED=0 BACKUP_TIER_UNSPECIFIED value - * @property {number} STANDARD=1 STANDARD value - * @property {number} ADVANCED=2 ADVANCED value - * @property {number} ENHANCED=3 ENHANCED value - */ - BackupConfiguration.BackupTier = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BACKUP_TIER_UNSPECIFIED"] = 0; - values[valuesById[1] = "STANDARD"] = 1; - values[valuesById[2] = "ADVANCED"] = 2; - values[valuesById[3] = "ENHANCED"] = 3; - return values; - })(); - - return BackupConfiguration; - })(); - - v1.PerformDiskShrinkContext = (function() { - - /** - * Properties of a PerformDiskShrinkContext. - * @memberof google.cloud.sql.v1 - * @interface IPerformDiskShrinkContext - * @property {number|Long|null} [targetSizeGb] PerformDiskShrinkContext targetSizeGb - */ - - /** - * Constructs a new PerformDiskShrinkContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a PerformDiskShrinkContext. - * @implements IPerformDiskShrinkContext - * @constructor - * @param {google.cloud.sql.v1.IPerformDiskShrinkContext=} [properties] Properties to set - */ - function PerformDiskShrinkContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PerformDiskShrinkContext targetSizeGb. - * @member {number|Long} targetSizeGb - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @instance - */ - PerformDiskShrinkContext.prototype.targetSizeGb = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new PerformDiskShrinkContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @static - * @param {google.cloud.sql.v1.IPerformDiskShrinkContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.PerformDiskShrinkContext} PerformDiskShrinkContext instance - */ - PerformDiskShrinkContext.create = function create(properties) { - return new PerformDiskShrinkContext(properties); - }; - - /** - * Encodes the specified PerformDiskShrinkContext message. Does not implicitly {@link google.cloud.sql.v1.PerformDiskShrinkContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @static - * @param {google.cloud.sql.v1.IPerformDiskShrinkContext} message PerformDiskShrinkContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PerformDiskShrinkContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.targetSizeGb != null && Object.hasOwnProperty.call(message, "targetSizeGb")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.targetSizeGb); - return writer; - }; - - /** - * Encodes the specified PerformDiskShrinkContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PerformDiskShrinkContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @static - * @param {google.cloud.sql.v1.IPerformDiskShrinkContext} message PerformDiskShrinkContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PerformDiskShrinkContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PerformDiskShrinkContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.PerformDiskShrinkContext} PerformDiskShrinkContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PerformDiskShrinkContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PerformDiskShrinkContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.targetSizeGb = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PerformDiskShrinkContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.PerformDiskShrinkContext} PerformDiskShrinkContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PerformDiskShrinkContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PerformDiskShrinkContext message. - * @function verify - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PerformDiskShrinkContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.targetSizeGb != null && message.hasOwnProperty("targetSizeGb")) - if (!$util.isInteger(message.targetSizeGb) && !(message.targetSizeGb && $util.isInteger(message.targetSizeGb.low) && $util.isInteger(message.targetSizeGb.high))) - return "targetSizeGb: integer|Long expected"; - return null; - }; - - /** - * Creates a PerformDiskShrinkContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.PerformDiskShrinkContext} PerformDiskShrinkContext - */ - PerformDiskShrinkContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.PerformDiskShrinkContext) - return object; - var message = new $root.google.cloud.sql.v1.PerformDiskShrinkContext(); - if (object.targetSizeGb != null) - if ($util.Long) - (message.targetSizeGb = $util.Long.fromValue(object.targetSizeGb)).unsigned = false; - else if (typeof object.targetSizeGb === "string") - message.targetSizeGb = parseInt(object.targetSizeGb, 10); - else if (typeof object.targetSizeGb === "number") - message.targetSizeGb = object.targetSizeGb; - else if (typeof object.targetSizeGb === "object") - message.targetSizeGb = new $util.LongBits(object.targetSizeGb.low >>> 0, object.targetSizeGb.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a PerformDiskShrinkContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @static - * @param {google.cloud.sql.v1.PerformDiskShrinkContext} message PerformDiskShrinkContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PerformDiskShrinkContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.targetSizeGb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.targetSizeGb = options.longs === String ? "0" : 0; - if (message.targetSizeGb != null && message.hasOwnProperty("targetSizeGb")) - if (typeof message.targetSizeGb === "number") - object.targetSizeGb = options.longs === String ? String(message.targetSizeGb) : message.targetSizeGb; - else - object.targetSizeGb = options.longs === String ? $util.Long.prototype.toString.call(message.targetSizeGb) : options.longs === Number ? new $util.LongBits(message.targetSizeGb.low >>> 0, message.targetSizeGb.high >>> 0).toNumber() : message.targetSizeGb; - return object; - }; - - /** - * Converts this PerformDiskShrinkContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @instance - * @returns {Object.} JSON object - */ - PerformDiskShrinkContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PerformDiskShrinkContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.PerformDiskShrinkContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PerformDiskShrinkContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.PerformDiskShrinkContext"; - }; - - return PerformDiskShrinkContext; - })(); - - v1.PreCheckResponse = (function() { - - /** - * Properties of a PreCheckResponse. - * @memberof google.cloud.sql.v1 - * @interface IPreCheckResponse - * @property {string|null} [message] PreCheckResponse message - * @property {google.cloud.sql.v1.PreCheckResponse.MessageType|null} [messageType] PreCheckResponse messageType - * @property {Array.|null} [actionsRequired] PreCheckResponse actionsRequired - */ - - /** - * Constructs a new PreCheckResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a PreCheckResponse. - * @implements IPreCheckResponse - * @constructor - * @param {google.cloud.sql.v1.IPreCheckResponse=} [properties] Properties to set - */ - function PreCheckResponse(properties) { - this.actionsRequired = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PreCheckResponse message. - * @member {string|null|undefined} message - * @memberof google.cloud.sql.v1.PreCheckResponse - * @instance - */ - PreCheckResponse.prototype.message = null; - - /** - * PreCheckResponse messageType. - * @member {google.cloud.sql.v1.PreCheckResponse.MessageType|null|undefined} messageType - * @memberof google.cloud.sql.v1.PreCheckResponse - * @instance - */ - PreCheckResponse.prototype.messageType = null; - - /** - * PreCheckResponse actionsRequired. - * @member {Array.} actionsRequired - * @memberof google.cloud.sql.v1.PreCheckResponse - * @instance - */ - PreCheckResponse.prototype.actionsRequired = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PreCheckResponse.prototype, "_message", { - get: $util.oneOfGetter($oneOfFields = ["message"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PreCheckResponse.prototype, "_messageType", { - get: $util.oneOfGetter($oneOfFields = ["messageType"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PreCheckResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.PreCheckResponse - * @static - * @param {google.cloud.sql.v1.IPreCheckResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.PreCheckResponse} PreCheckResponse instance - */ - PreCheckResponse.create = function create(properties) { - return new PreCheckResponse(properties); - }; - - /** - * Encodes the specified PreCheckResponse message. Does not implicitly {@link google.cloud.sql.v1.PreCheckResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.PreCheckResponse - * @static - * @param {google.cloud.sql.v1.IPreCheckResponse} message PreCheckResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PreCheckResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); - if (message.messageType != null && Object.hasOwnProperty.call(message, "messageType")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.messageType); - if (message.actionsRequired != null && message.actionsRequired.length) - for (var i = 0; i < message.actionsRequired.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.actionsRequired[i]); - return writer; - }; - - /** - * Encodes the specified PreCheckResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PreCheckResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.PreCheckResponse - * @static - * @param {google.cloud.sql.v1.IPreCheckResponse} message PreCheckResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PreCheckResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PreCheckResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.PreCheckResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.PreCheckResponse} PreCheckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PreCheckResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PreCheckResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 2: { - message.message = reader.string(); - break; - } - case 3: { - message.messageType = reader.int32(); - break; - } - case 4: { - if (!(message.actionsRequired && message.actionsRequired.length)) - message.actionsRequired = []; - message.actionsRequired.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PreCheckResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.PreCheckResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.PreCheckResponse} PreCheckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PreCheckResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PreCheckResponse message. - * @function verify - * @memberof google.cloud.sql.v1.PreCheckResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PreCheckResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.message != null && message.hasOwnProperty("message")) { - properties._message = 1; - if (!$util.isString(message.message)) - return "message: string expected"; - } - if (message.messageType != null && message.hasOwnProperty("messageType")) { - properties._messageType = 1; - switch (message.messageType) { - default: - return "messageType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - } - if (message.actionsRequired != null && message.hasOwnProperty("actionsRequired")) { - if (!Array.isArray(message.actionsRequired)) - return "actionsRequired: array expected"; - for (var i = 0; i < message.actionsRequired.length; ++i) - if (!$util.isString(message.actionsRequired[i])) - return "actionsRequired: string[] expected"; - } - return null; - }; - - /** - * Creates a PreCheckResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.PreCheckResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.PreCheckResponse} PreCheckResponse - */ - PreCheckResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.PreCheckResponse) - return object; - var message = new $root.google.cloud.sql.v1.PreCheckResponse(); - if (object.message != null) - message.message = String(object.message); - switch (object.messageType) { - default: - if (typeof object.messageType === "number") { - message.messageType = object.messageType; - break; - } - break; - case "MESSAGE_TYPE_UNSPECIFIED": - case 0: - message.messageType = 0; - break; - case "INFO": - case 1: - message.messageType = 1; - break; - case "WARNING": - case 2: - message.messageType = 2; - break; - case "ERROR": - case 3: - message.messageType = 3; - break; - } - if (object.actionsRequired) { - if (!Array.isArray(object.actionsRequired)) - throw TypeError(".google.cloud.sql.v1.PreCheckResponse.actionsRequired: array expected"); - message.actionsRequired = []; - for (var i = 0; i < object.actionsRequired.length; ++i) - message.actionsRequired[i] = String(object.actionsRequired[i]); - } - return message; - }; - - /** - * Creates a plain object from a PreCheckResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.PreCheckResponse - * @static - * @param {google.cloud.sql.v1.PreCheckResponse} message PreCheckResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PreCheckResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.actionsRequired = []; - if (message.message != null && message.hasOwnProperty("message")) { - object.message = message.message; - if (options.oneofs) - object._message = "message"; - } - if (message.messageType != null && message.hasOwnProperty("messageType")) { - object.messageType = options.enums === String ? $root.google.cloud.sql.v1.PreCheckResponse.MessageType[message.messageType] === undefined ? message.messageType : $root.google.cloud.sql.v1.PreCheckResponse.MessageType[message.messageType] : message.messageType; - if (options.oneofs) - object._messageType = "messageType"; - } - if (message.actionsRequired && message.actionsRequired.length) { - object.actionsRequired = []; - for (var j = 0; j < message.actionsRequired.length; ++j) - object.actionsRequired[j] = message.actionsRequired[j]; - } - return object; - }; - - /** - * Converts this PreCheckResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.PreCheckResponse - * @instance - * @returns {Object.} JSON object - */ - PreCheckResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PreCheckResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.PreCheckResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PreCheckResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.PreCheckResponse"; - }; - - /** - * MessageType enum. - * @name google.cloud.sql.v1.PreCheckResponse.MessageType - * @enum {number} - * @property {number} MESSAGE_TYPE_UNSPECIFIED=0 MESSAGE_TYPE_UNSPECIFIED value - * @property {number} INFO=1 INFO value - * @property {number} WARNING=2 WARNING value - * @property {number} ERROR=3 ERROR value - */ - PreCheckResponse.MessageType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MESSAGE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "INFO"] = 1; - values[valuesById[2] = "WARNING"] = 2; - values[valuesById[3] = "ERROR"] = 3; - return values; - })(); - - return PreCheckResponse; - })(); - - v1.PreCheckMajorVersionUpgradeContext = (function() { - - /** - * Properties of a PreCheckMajorVersionUpgradeContext. - * @memberof google.cloud.sql.v1 - * @interface IPreCheckMajorVersionUpgradeContext - * @property {google.cloud.sql.v1.SqlDatabaseVersion|null} [targetDatabaseVersion] PreCheckMajorVersionUpgradeContext targetDatabaseVersion - * @property {Array.|null} [preCheckResponse] PreCheckMajorVersionUpgradeContext preCheckResponse - * @property {string|null} [kind] PreCheckMajorVersionUpgradeContext kind - */ - - /** - * Constructs a new PreCheckMajorVersionUpgradeContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a PreCheckMajorVersionUpgradeContext. - * @implements IPreCheckMajorVersionUpgradeContext - * @constructor - * @param {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext=} [properties] Properties to set - */ - function PreCheckMajorVersionUpgradeContext(properties) { - this.preCheckResponse = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PreCheckMajorVersionUpgradeContext targetDatabaseVersion. - * @member {google.cloud.sql.v1.SqlDatabaseVersion} targetDatabaseVersion - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @instance - */ - PreCheckMajorVersionUpgradeContext.prototype.targetDatabaseVersion = 0; - - /** - * PreCheckMajorVersionUpgradeContext preCheckResponse. - * @member {Array.} preCheckResponse - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @instance - */ - PreCheckMajorVersionUpgradeContext.prototype.preCheckResponse = $util.emptyArray; - - /** - * PreCheckMajorVersionUpgradeContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @instance - */ - PreCheckMajorVersionUpgradeContext.prototype.kind = ""; - - /** - * Creates a new PreCheckMajorVersionUpgradeContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @static - * @param {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext instance - */ - PreCheckMajorVersionUpgradeContext.create = function create(properties) { - return new PreCheckMajorVersionUpgradeContext(properties); - }; - - /** - * Encodes the specified PreCheckMajorVersionUpgradeContext message. Does not implicitly {@link google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @static - * @param {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PreCheckMajorVersionUpgradeContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.targetDatabaseVersion != null && Object.hasOwnProperty.call(message, "targetDatabaseVersion")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.targetDatabaseVersion); - if (message.preCheckResponse != null && message.preCheckResponse.length) - for (var i = 0; i < message.preCheckResponse.length; ++i) - $root.google.cloud.sql.v1.PreCheckResponse.encode(message.preCheckResponse[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - return writer; - }; - - /** - * Encodes the specified PreCheckMajorVersionUpgradeContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @static - * @param {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PreCheckMajorVersionUpgradeContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PreCheckMajorVersionUpgradeContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.targetDatabaseVersion = reader.int32(); - break; - } - case 2: { - if (!(message.preCheckResponse && message.preCheckResponse.length)) - message.preCheckResponse = []; - message.preCheckResponse.push($root.google.cloud.sql.v1.PreCheckResponse.decode(reader, reader.uint32())); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PreCheckMajorVersionUpgradeContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PreCheckMajorVersionUpgradeContext message. - * @function verify - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PreCheckMajorVersionUpgradeContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.targetDatabaseVersion != null && message.hasOwnProperty("targetDatabaseVersion")) - switch (message.targetDatabaseVersion) { - default: - return "targetDatabaseVersion: enum value expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 684: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - case 549: - case 550: - case 551: - break; - } - if (message.preCheckResponse != null && message.hasOwnProperty("preCheckResponse")) { - if (!Array.isArray(message.preCheckResponse)) - return "preCheckResponse: array expected"; - for (var i = 0; i < message.preCheckResponse.length; ++i) { - var error = $root.google.cloud.sql.v1.PreCheckResponse.verify(message.preCheckResponse[i]); - if (error) - return "preCheckResponse." + error; - } - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a PreCheckMajorVersionUpgradeContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext - */ - PreCheckMajorVersionUpgradeContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext) - return object; - var message = new $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext(); - switch (object.targetDatabaseVersion) { - default: - if (typeof object.targetDatabaseVersion === "number") { - message.targetDatabaseVersion = object.targetDatabaseVersion; - break; - } - break; - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.targetDatabaseVersion = 0; - break; - case "MYSQL_5_1": - case 2: - message.targetDatabaseVersion = 2; - break; - case "MYSQL_5_5": - case 3: - message.targetDatabaseVersion = 3; - break; - case "MYSQL_5_6": - case 5: - message.targetDatabaseVersion = 5; - break; - case "MYSQL_5_7": - case 6: - message.targetDatabaseVersion = 6; - break; - case "MYSQL_8_0": - case 20: - message.targetDatabaseVersion = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.targetDatabaseVersion = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.targetDatabaseVersion = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.targetDatabaseVersion = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.targetDatabaseVersion = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.targetDatabaseVersion = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.targetDatabaseVersion = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.targetDatabaseVersion = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.targetDatabaseVersion = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.targetDatabaseVersion = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.targetDatabaseVersion = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.targetDatabaseVersion = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.targetDatabaseVersion = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.targetDatabaseVersion = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.targetDatabaseVersion = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.targetDatabaseVersion = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.targetDatabaseVersion = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.targetDatabaseVersion = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.targetDatabaseVersion = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.targetDatabaseVersion = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.targetDatabaseVersion = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.targetDatabaseVersion = 556; - break; - case "MYSQL_8_4": - case 398: - message.targetDatabaseVersion = 398; - break; - case "MYSQL_9_7": - case 654: - message.targetDatabaseVersion = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.targetDatabaseVersion = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.targetDatabaseVersion = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.targetDatabaseVersion = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.targetDatabaseVersion = 16; - break; - case "POSTGRES_9_6": - case 9: - message.targetDatabaseVersion = 9; - break; - case "POSTGRES_10": - case 18: - message.targetDatabaseVersion = 18; - break; - case "POSTGRES_11": - case 10: - message.targetDatabaseVersion = 10; - break; - case "POSTGRES_12": - case 19: - message.targetDatabaseVersion = 19; - break; - case "POSTGRES_13": - case 23: - message.targetDatabaseVersion = 23; - break; - case "POSTGRES_14": - case 110: - message.targetDatabaseVersion = 110; - break; - case "POSTGRES_15": - case 172: - message.targetDatabaseVersion = 172; - break; - case "POSTGRES_16": - case 272: - message.targetDatabaseVersion = 272; - break; - case "POSTGRES_17": - case 408: - message.targetDatabaseVersion = 408; - break; - case "POSTGRES_18": - case 557: - message.targetDatabaseVersion = 557; - break; - case "POSTGRES_19": - case 684: - message.targetDatabaseVersion = 684; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.targetDatabaseVersion = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.targetDatabaseVersion = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.targetDatabaseVersion = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.targetDatabaseVersion = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.targetDatabaseVersion = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.targetDatabaseVersion = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.targetDatabaseVersion = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.targetDatabaseVersion = 202; - break; - case "SQLSERVER_2025_STANDARD": - case 549: - message.targetDatabaseVersion = 549; - break; - case "SQLSERVER_2025_ENTERPRISE": - case 550: - message.targetDatabaseVersion = 550; - break; - case "SQLSERVER_2025_EXPRESS": - case 551: - message.targetDatabaseVersion = 551; - break; - } - if (object.preCheckResponse) { - if (!Array.isArray(object.preCheckResponse)) - throw TypeError(".google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.preCheckResponse: array expected"); - message.preCheckResponse = []; - for (var i = 0; i < object.preCheckResponse.length; ++i) { - if (typeof object.preCheckResponse[i] !== "object") - throw TypeError(".google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.preCheckResponse: object expected"); - message.preCheckResponse[i] = $root.google.cloud.sql.v1.PreCheckResponse.fromObject(object.preCheckResponse[i]); - } - } - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a PreCheckMajorVersionUpgradeContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @static - * @param {google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PreCheckMajorVersionUpgradeContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.preCheckResponse = []; - if (options.defaults) { - object.targetDatabaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; - object.kind = ""; - } - if (message.targetDatabaseVersion != null && message.hasOwnProperty("targetDatabaseVersion")) - object.targetDatabaseVersion = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.targetDatabaseVersion] === undefined ? message.targetDatabaseVersion : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.targetDatabaseVersion] : message.targetDatabaseVersion; - if (message.preCheckResponse && message.preCheckResponse.length) { - object.preCheckResponse = []; - for (var j = 0; j < message.preCheckResponse.length; ++j) - object.preCheckResponse[j] = $root.google.cloud.sql.v1.PreCheckResponse.toObject(message.preCheckResponse[j], options); - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this PreCheckMajorVersionUpgradeContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @instance - * @returns {Object.} JSON object - */ - PreCheckMajorVersionUpgradeContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PreCheckMajorVersionUpgradeContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PreCheckMajorVersionUpgradeContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext"; - }; - - return PreCheckMajorVersionUpgradeContext; - })(); - - v1.BackupContext = (function() { - - /** - * Properties of a BackupContext. - * @memberof google.cloud.sql.v1 - * @interface IBackupContext - * @property {number|Long|null} [backupId] BackupContext backupId - * @property {string|null} [kind] BackupContext kind - * @property {string|null} [name] BackupContext name - */ - - /** - * Constructs a new BackupContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a BackupContext. - * @implements IBackupContext - * @constructor - * @param {google.cloud.sql.v1.IBackupContext=} [properties] Properties to set - */ - function BackupContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupContext backupId. - * @member {number|Long} backupId - * @memberof google.cloud.sql.v1.BackupContext - * @instance - */ - BackupContext.prototype.backupId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BackupContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.BackupContext - * @instance - */ - BackupContext.prototype.kind = ""; - - /** - * BackupContext name. - * @member {string} name - * @memberof google.cloud.sql.v1.BackupContext - * @instance - */ - BackupContext.prototype.name = ""; - - /** - * Creates a new BackupContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.BackupContext - * @static - * @param {google.cloud.sql.v1.IBackupContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.BackupContext} BackupContext instance - */ - BackupContext.create = function create(properties) { - return new BackupContext(properties); - }; - - /** - * Encodes the specified BackupContext message. Does not implicitly {@link google.cloud.sql.v1.BackupContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.BackupContext - * @static - * @param {google.cloud.sql.v1.IBackupContext} message BackupContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.backupId != null && Object.hasOwnProperty.call(message, "backupId")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.backupId); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - return writer; - }; - - /** - * Encodes the specified BackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.BackupContext - * @static - * @param {google.cloud.sql.v1.IBackupContext} message BackupContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.BackupContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.BackupContext} BackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.backupId = reader.int64(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - case 3: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.BackupContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.BackupContext} BackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupContext message. - * @function verify - * @memberof google.cloud.sql.v1.BackupContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.backupId != null && message.hasOwnProperty("backupId")) - if (!$util.isInteger(message.backupId) && !(message.backupId && $util.isInteger(message.backupId.low) && $util.isInteger(message.backupId.high))) - return "backupId: integer|Long expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a BackupContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.BackupContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.BackupContext} BackupContext - */ - BackupContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.BackupContext) - return object; - var message = new $root.google.cloud.sql.v1.BackupContext(); - if (object.backupId != null) - if ($util.Long) - (message.backupId = $util.Long.fromValue(object.backupId)).unsigned = false; - else if (typeof object.backupId === "string") - message.backupId = parseInt(object.backupId, 10); - else if (typeof object.backupId === "number") - message.backupId = object.backupId; - else if (typeof object.backupId === "object") - message.backupId = new $util.LongBits(object.backupId.low >>> 0, object.backupId.high >>> 0).toNumber(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a BackupContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.BackupContext - * @static - * @param {google.cloud.sql.v1.BackupContext} message BackupContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.backupId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.backupId = options.longs === String ? "0" : 0; - object.kind = ""; - object.name = ""; - } - if (message.backupId != null && message.hasOwnProperty("backupId")) - if (typeof message.backupId === "number") - object.backupId = options.longs === String ? String(message.backupId) : message.backupId; - else - object.backupId = options.longs === String ? $util.Long.prototype.toString.call(message.backupId) : options.longs === Number ? new $util.LongBits(message.backupId.low >>> 0, message.backupId.high >>> 0).toNumber() : message.backupId; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this BackupContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.BackupContext - * @instance - * @returns {Object.} JSON object - */ - BackupContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.BackupContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.BackupContext"; - }; - - return BackupContext; - })(); - - v1.Database = (function() { - - /** - * Properties of a Database. - * @memberof google.cloud.sql.v1 - * @interface IDatabase - * @property {string|null} [kind] Database kind - * @property {string|null} [charset] Database charset - * @property {string|null} [collation] Database collation - * @property {string|null} [etag] Database etag - * @property {string|null} [name] Database name - * @property {string|null} [instance] Database instance - * @property {string|null} [selfLink] Database selfLink - * @property {string|null} [project] Database project - * @property {google.cloud.sql.v1.ISqlServerDatabaseDetails|null} [sqlserverDatabaseDetails] Database sqlserverDatabaseDetails - */ - - /** - * Constructs a new Database. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a Database. - * @implements IDatabase - * @constructor - * @param {google.cloud.sql.v1.IDatabase=} [properties] Properties to set - */ - function Database(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Database kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.Database - * @instance - */ - Database.prototype.kind = ""; - - /** - * Database charset. - * @member {string} charset - * @memberof google.cloud.sql.v1.Database - * @instance - */ - Database.prototype.charset = ""; - - /** - * Database collation. - * @member {string} collation - * @memberof google.cloud.sql.v1.Database - * @instance - */ - Database.prototype.collation = ""; - - /** - * Database etag. - * @member {string} etag - * @memberof google.cloud.sql.v1.Database - * @instance - */ - Database.prototype.etag = ""; - - /** - * Database name. - * @member {string} name - * @memberof google.cloud.sql.v1.Database - * @instance - */ - Database.prototype.name = ""; - - /** - * Database instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.Database - * @instance - */ - Database.prototype.instance = ""; - - /** - * Database selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1.Database - * @instance - */ - Database.prototype.selfLink = ""; - - /** - * Database project. - * @member {string} project - * @memberof google.cloud.sql.v1.Database - * @instance - */ - Database.prototype.project = ""; - - /** - * Database sqlserverDatabaseDetails. - * @member {google.cloud.sql.v1.ISqlServerDatabaseDetails|null|undefined} sqlserverDatabaseDetails - * @memberof google.cloud.sql.v1.Database - * @instance - */ - Database.prototype.sqlserverDatabaseDetails = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Database databaseDetails. - * @member {"sqlserverDatabaseDetails"|undefined} databaseDetails - * @memberof google.cloud.sql.v1.Database - * @instance - */ - Object.defineProperty(Database.prototype, "databaseDetails", { - get: $util.oneOfGetter($oneOfFields = ["sqlserverDatabaseDetails"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Database instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.Database - * @static - * @param {google.cloud.sql.v1.IDatabase=} [properties] Properties to set - * @returns {google.cloud.sql.v1.Database} Database instance - */ - Database.create = function create(properties) { - return new Database(properties); - }; - - /** - * Encodes the specified Database message. Does not implicitly {@link google.cloud.sql.v1.Database.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.Database - * @static - * @param {google.cloud.sql.v1.IDatabase} message Database message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Database.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.charset != null && Object.hasOwnProperty.call(message, "charset")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.charset); - if (message.collation != null && Object.hasOwnProperty.call(message, "collation")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.collation); - if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.etag); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.selfLink); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.project); - if (message.sqlserverDatabaseDetails != null && Object.hasOwnProperty.call(message, "sqlserverDatabaseDetails")) - $root.google.cloud.sql.v1.SqlServerDatabaseDetails.encode(message.sqlserverDatabaseDetails, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Database message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Database.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.Database - * @static - * @param {google.cloud.sql.v1.IDatabase} message Database message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Database.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Database message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.Database - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.Database} Database - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Database.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Database(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.charset = reader.string(); - break; - } - case 3: { - message.collation = reader.string(); - break; - } - case 4: { - message.etag = reader.string(); - break; - } - case 5: { - message.name = reader.string(); - break; - } - case 6: { - message.instance = reader.string(); - break; - } - case 7: { - message.selfLink = reader.string(); - break; - } - case 8: { - message.project = reader.string(); - break; - } - case 9: { - message.sqlserverDatabaseDetails = $root.google.cloud.sql.v1.SqlServerDatabaseDetails.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Database message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.Database - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.Database} Database - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Database.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Database message. - * @function verify - * @memberof google.cloud.sql.v1.Database - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Database.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.charset != null && message.hasOwnProperty("charset")) - if (!$util.isString(message.charset)) - return "charset: string expected"; - if (message.collation != null && message.hasOwnProperty("collation")) - if (!$util.isString(message.collation)) - return "collation: string expected"; - if (message.etag != null && message.hasOwnProperty("etag")) - if (!$util.isString(message.etag)) - return "etag: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.sqlserverDatabaseDetails != null && message.hasOwnProperty("sqlserverDatabaseDetails")) { - properties.databaseDetails = 1; - { - var error = $root.google.cloud.sql.v1.SqlServerDatabaseDetails.verify(message.sqlserverDatabaseDetails); - if (error) - return "sqlserverDatabaseDetails." + error; - } - } - return null; - }; - - /** - * Creates a Database message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.Database - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.Database} Database - */ - Database.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.Database) - return object; - var message = new $root.google.cloud.sql.v1.Database(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.charset != null) - message.charset = String(object.charset); - if (object.collation != null) - message.collation = String(object.collation); - if (object.etag != null) - message.etag = String(object.etag); - if (object.name != null) - message.name = String(object.name); - if (object.instance != null) - message.instance = String(object.instance); - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - if (object.project != null) - message.project = String(object.project); - if (object.sqlserverDatabaseDetails != null) { - if (typeof object.sqlserverDatabaseDetails !== "object") - throw TypeError(".google.cloud.sql.v1.Database.sqlserverDatabaseDetails: object expected"); - message.sqlserverDatabaseDetails = $root.google.cloud.sql.v1.SqlServerDatabaseDetails.fromObject(object.sqlserverDatabaseDetails); - } - return message; - }; - - /** - * Creates a plain object from a Database message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.Database - * @static - * @param {google.cloud.sql.v1.Database} message Database - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Database.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.charset = ""; - object.collation = ""; - object.etag = ""; - object.name = ""; - object.instance = ""; - object.selfLink = ""; - object.project = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.charset != null && message.hasOwnProperty("charset")) - object.charset = message.charset; - if (message.collation != null && message.hasOwnProperty("collation")) - object.collation = message.collation; - if (message.etag != null && message.hasOwnProperty("etag")) - object.etag = message.etag; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.sqlserverDatabaseDetails != null && message.hasOwnProperty("sqlserverDatabaseDetails")) { - object.sqlserverDatabaseDetails = $root.google.cloud.sql.v1.SqlServerDatabaseDetails.toObject(message.sqlserverDatabaseDetails, options); - if (options.oneofs) - object.databaseDetails = "sqlserverDatabaseDetails"; - } - return object; - }; - - /** - * Converts this Database to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.Database - * @instance - * @returns {Object.} JSON object - */ - Database.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Database - * @function getTypeUrl - * @memberof google.cloud.sql.v1.Database - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Database.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.Database"; - }; - - return Database; - })(); - - v1.SqlServerDatabaseDetails = (function() { - - /** - * Properties of a SqlServerDatabaseDetails. - * @memberof google.cloud.sql.v1 - * @interface ISqlServerDatabaseDetails - * @property {number|null} [compatibilityLevel] SqlServerDatabaseDetails compatibilityLevel - * @property {string|null} [recoveryModel] SqlServerDatabaseDetails recoveryModel - */ - - /** - * Constructs a new SqlServerDatabaseDetails. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlServerDatabaseDetails. - * @implements ISqlServerDatabaseDetails - * @constructor - * @param {google.cloud.sql.v1.ISqlServerDatabaseDetails=} [properties] Properties to set - */ - function SqlServerDatabaseDetails(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlServerDatabaseDetails compatibilityLevel. - * @member {number} compatibilityLevel - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @instance - */ - SqlServerDatabaseDetails.prototype.compatibilityLevel = 0; - - /** - * SqlServerDatabaseDetails recoveryModel. - * @member {string} recoveryModel - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @instance - */ - SqlServerDatabaseDetails.prototype.recoveryModel = ""; - - /** - * Creates a new SqlServerDatabaseDetails instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @static - * @param {google.cloud.sql.v1.ISqlServerDatabaseDetails=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlServerDatabaseDetails} SqlServerDatabaseDetails instance - */ - SqlServerDatabaseDetails.create = function create(properties) { - return new SqlServerDatabaseDetails(properties); - }; - - /** - * Encodes the specified SqlServerDatabaseDetails message. Does not implicitly {@link google.cloud.sql.v1.SqlServerDatabaseDetails.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @static - * @param {google.cloud.sql.v1.ISqlServerDatabaseDetails} message SqlServerDatabaseDetails message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerDatabaseDetails.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.compatibilityLevel != null && Object.hasOwnProperty.call(message, "compatibilityLevel")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.compatibilityLevel); - if (message.recoveryModel != null && Object.hasOwnProperty.call(message, "recoveryModel")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.recoveryModel); - return writer; - }; - - /** - * Encodes the specified SqlServerDatabaseDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerDatabaseDetails.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @static - * @param {google.cloud.sql.v1.ISqlServerDatabaseDetails} message SqlServerDatabaseDetails message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerDatabaseDetails.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlServerDatabaseDetails} SqlServerDatabaseDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerDatabaseDetails.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlServerDatabaseDetails(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.compatibilityLevel = reader.int32(); - break; - } - case 2: { - message.recoveryModel = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlServerDatabaseDetails} SqlServerDatabaseDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerDatabaseDetails.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlServerDatabaseDetails message. - * @function verify - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlServerDatabaseDetails.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.compatibilityLevel != null && message.hasOwnProperty("compatibilityLevel")) - if (!$util.isInteger(message.compatibilityLevel)) - return "compatibilityLevel: integer expected"; - if (message.recoveryModel != null && message.hasOwnProperty("recoveryModel")) - if (!$util.isString(message.recoveryModel)) - return "recoveryModel: string expected"; - return null; - }; - - /** - * Creates a SqlServerDatabaseDetails message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlServerDatabaseDetails} SqlServerDatabaseDetails - */ - SqlServerDatabaseDetails.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlServerDatabaseDetails) - return object; - var message = new $root.google.cloud.sql.v1.SqlServerDatabaseDetails(); - if (object.compatibilityLevel != null) - message.compatibilityLevel = object.compatibilityLevel | 0; - if (object.recoveryModel != null) - message.recoveryModel = String(object.recoveryModel); - return message; - }; - - /** - * Creates a plain object from a SqlServerDatabaseDetails message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @static - * @param {google.cloud.sql.v1.SqlServerDatabaseDetails} message SqlServerDatabaseDetails - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlServerDatabaseDetails.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.compatibilityLevel = 0; - object.recoveryModel = ""; - } - if (message.compatibilityLevel != null && message.hasOwnProperty("compatibilityLevel")) - object.compatibilityLevel = message.compatibilityLevel; - if (message.recoveryModel != null && message.hasOwnProperty("recoveryModel")) - object.recoveryModel = message.recoveryModel; - return object; - }; - - /** - * Converts this SqlServerDatabaseDetails to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @instance - * @returns {Object.} JSON object - */ - SqlServerDatabaseDetails.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlServerDatabaseDetails - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlServerDatabaseDetails - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlServerDatabaseDetails.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlServerDatabaseDetails"; - }; - - return SqlServerDatabaseDetails; - })(); - - v1.DatabaseFlags = (function() { - - /** - * Properties of a DatabaseFlags. - * @memberof google.cloud.sql.v1 - * @interface IDatabaseFlags - * @property {string|null} [name] DatabaseFlags name - * @property {string|null} [value] DatabaseFlags value - */ - - /** - * Constructs a new DatabaseFlags. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DatabaseFlags. - * @implements IDatabaseFlags - * @constructor - * @param {google.cloud.sql.v1.IDatabaseFlags=} [properties] Properties to set - */ - function DatabaseFlags(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DatabaseFlags name. - * @member {string} name - * @memberof google.cloud.sql.v1.DatabaseFlags - * @instance - */ - DatabaseFlags.prototype.name = ""; - - /** - * DatabaseFlags value. - * @member {string} value - * @memberof google.cloud.sql.v1.DatabaseFlags - * @instance - */ - DatabaseFlags.prototype.value = ""; - - /** - * Creates a new DatabaseFlags instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DatabaseFlags - * @static - * @param {google.cloud.sql.v1.IDatabaseFlags=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DatabaseFlags} DatabaseFlags instance - */ - DatabaseFlags.create = function create(properties) { - return new DatabaseFlags(properties); - }; - - /** - * Encodes the specified DatabaseFlags message. Does not implicitly {@link google.cloud.sql.v1.DatabaseFlags.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DatabaseFlags - * @static - * @param {google.cloud.sql.v1.IDatabaseFlags} message DatabaseFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabaseFlags.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified DatabaseFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseFlags.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DatabaseFlags - * @static - * @param {google.cloud.sql.v1.IDatabaseFlags} message DatabaseFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabaseFlags.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DatabaseFlags message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DatabaseFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DatabaseFlags} DatabaseFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabaseFlags.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseFlags(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DatabaseFlags message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DatabaseFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DatabaseFlags} DatabaseFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabaseFlags.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DatabaseFlags message. - * @function verify - * @memberof google.cloud.sql.v1.DatabaseFlags - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DatabaseFlags.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a DatabaseFlags message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DatabaseFlags - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DatabaseFlags} DatabaseFlags - */ - DatabaseFlags.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DatabaseFlags) - return object; - var message = new $root.google.cloud.sql.v1.DatabaseFlags(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a DatabaseFlags message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DatabaseFlags - * @static - * @param {google.cloud.sql.v1.DatabaseFlags} message DatabaseFlags - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DatabaseFlags.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.value = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this DatabaseFlags to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DatabaseFlags - * @instance - * @returns {Object.} JSON object - */ - DatabaseFlags.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DatabaseFlags - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DatabaseFlags - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DatabaseFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseFlags"; - }; - - return DatabaseFlags; - })(); - - v1.MySqlSyncConfig = (function() { - - /** - * Properties of a MySqlSyncConfig. - * @memberof google.cloud.sql.v1 - * @interface IMySqlSyncConfig - * @property {Array.|null} [initialSyncFlags] MySqlSyncConfig initialSyncFlags - */ - - /** - * Constructs a new MySqlSyncConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a MySqlSyncConfig. - * @implements IMySqlSyncConfig - * @constructor - * @param {google.cloud.sql.v1.IMySqlSyncConfig=} [properties] Properties to set - */ - function MySqlSyncConfig(properties) { - this.initialSyncFlags = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MySqlSyncConfig initialSyncFlags. - * @member {Array.} initialSyncFlags - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @instance - */ - MySqlSyncConfig.prototype.initialSyncFlags = $util.emptyArray; - - /** - * Creates a new MySqlSyncConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @static - * @param {google.cloud.sql.v1.IMySqlSyncConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.MySqlSyncConfig} MySqlSyncConfig instance - */ - MySqlSyncConfig.create = function create(properties) { - return new MySqlSyncConfig(properties); - }; - - /** - * Encodes the specified MySqlSyncConfig message. Does not implicitly {@link google.cloud.sql.v1.MySqlSyncConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @static - * @param {google.cloud.sql.v1.IMySqlSyncConfig} message MySqlSyncConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MySqlSyncConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.initialSyncFlags != null && message.initialSyncFlags.length) - for (var i = 0; i < message.initialSyncFlags.length; ++i) - $root.google.cloud.sql.v1.SyncFlags.encode(message.initialSyncFlags[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MySqlSyncConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MySqlSyncConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @static - * @param {google.cloud.sql.v1.IMySqlSyncConfig} message MySqlSyncConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MySqlSyncConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MySqlSyncConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.MySqlSyncConfig} MySqlSyncConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MySqlSyncConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.MySqlSyncConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.initialSyncFlags && message.initialSyncFlags.length)) - message.initialSyncFlags = []; - message.initialSyncFlags.push($root.google.cloud.sql.v1.SyncFlags.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MySqlSyncConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.MySqlSyncConfig} MySqlSyncConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MySqlSyncConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MySqlSyncConfig message. - * @function verify - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MySqlSyncConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.initialSyncFlags != null && message.hasOwnProperty("initialSyncFlags")) { - if (!Array.isArray(message.initialSyncFlags)) - return "initialSyncFlags: array expected"; - for (var i = 0; i < message.initialSyncFlags.length; ++i) { - var error = $root.google.cloud.sql.v1.SyncFlags.verify(message.initialSyncFlags[i]); - if (error) - return "initialSyncFlags." + error; - } - } - return null; - }; - - /** - * Creates a MySqlSyncConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.MySqlSyncConfig} MySqlSyncConfig - */ - MySqlSyncConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.MySqlSyncConfig) - return object; - var message = new $root.google.cloud.sql.v1.MySqlSyncConfig(); - if (object.initialSyncFlags) { - if (!Array.isArray(object.initialSyncFlags)) - throw TypeError(".google.cloud.sql.v1.MySqlSyncConfig.initialSyncFlags: array expected"); - message.initialSyncFlags = []; - for (var i = 0; i < object.initialSyncFlags.length; ++i) { - if (typeof object.initialSyncFlags[i] !== "object") - throw TypeError(".google.cloud.sql.v1.MySqlSyncConfig.initialSyncFlags: object expected"); - message.initialSyncFlags[i] = $root.google.cloud.sql.v1.SyncFlags.fromObject(object.initialSyncFlags[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a MySqlSyncConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @static - * @param {google.cloud.sql.v1.MySqlSyncConfig} message MySqlSyncConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MySqlSyncConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.initialSyncFlags = []; - if (message.initialSyncFlags && message.initialSyncFlags.length) { - object.initialSyncFlags = []; - for (var j = 0; j < message.initialSyncFlags.length; ++j) - object.initialSyncFlags[j] = $root.google.cloud.sql.v1.SyncFlags.toObject(message.initialSyncFlags[j], options); - } - return object; - }; - - /** - * Converts this MySqlSyncConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @instance - * @returns {Object.} JSON object - */ - MySqlSyncConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MySqlSyncConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.MySqlSyncConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MySqlSyncConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.MySqlSyncConfig"; - }; - - return MySqlSyncConfig; - })(); - - v1.SyncFlags = (function() { - - /** - * Properties of a SyncFlags. - * @memberof google.cloud.sql.v1 - * @interface ISyncFlags - * @property {string|null} [name] SyncFlags name - * @property {string|null} [value] SyncFlags value - */ - - /** - * Constructs a new SyncFlags. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SyncFlags. - * @implements ISyncFlags - * @constructor - * @param {google.cloud.sql.v1.ISyncFlags=} [properties] Properties to set - */ - function SyncFlags(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SyncFlags name. - * @member {string} name - * @memberof google.cloud.sql.v1.SyncFlags - * @instance - */ - SyncFlags.prototype.name = ""; - - /** - * SyncFlags value. - * @member {string} value - * @memberof google.cloud.sql.v1.SyncFlags - * @instance - */ - SyncFlags.prototype.value = ""; - - /** - * Creates a new SyncFlags instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SyncFlags - * @static - * @param {google.cloud.sql.v1.ISyncFlags=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SyncFlags} SyncFlags instance - */ - SyncFlags.create = function create(properties) { - return new SyncFlags(properties); - }; - - /** - * Encodes the specified SyncFlags message. Does not implicitly {@link google.cloud.sql.v1.SyncFlags.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SyncFlags - * @static - * @param {google.cloud.sql.v1.ISyncFlags} message SyncFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SyncFlags.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified SyncFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SyncFlags.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SyncFlags - * @static - * @param {google.cloud.sql.v1.ISyncFlags} message SyncFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SyncFlags.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SyncFlags message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SyncFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SyncFlags} SyncFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SyncFlags.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SyncFlags(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SyncFlags message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SyncFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SyncFlags} SyncFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SyncFlags.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SyncFlags message. - * @function verify - * @memberof google.cloud.sql.v1.SyncFlags - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SyncFlags.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a SyncFlags message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SyncFlags - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SyncFlags} SyncFlags - */ - SyncFlags.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SyncFlags) - return object; - var message = new $root.google.cloud.sql.v1.SyncFlags(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a SyncFlags message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SyncFlags - * @static - * @param {google.cloud.sql.v1.SyncFlags} message SyncFlags - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SyncFlags.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.value = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this SyncFlags to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SyncFlags - * @instance - * @returns {Object.} JSON object - */ - SyncFlags.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SyncFlags - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SyncFlags - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SyncFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SyncFlags"; - }; - - return SyncFlags; - })(); - - v1.InstanceReference = (function() { - - /** - * Properties of an InstanceReference. - * @memberof google.cloud.sql.v1 - * @interface IInstanceReference - * @property {string|null} [name] InstanceReference name - * @property {string|null} [region] InstanceReference region - * @property {string|null} [project] InstanceReference project - */ - - /** - * Constructs a new InstanceReference. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstanceReference. - * @implements IInstanceReference - * @constructor - * @param {google.cloud.sql.v1.IInstanceReference=} [properties] Properties to set - */ - function InstanceReference(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstanceReference name. - * @member {string} name - * @memberof google.cloud.sql.v1.InstanceReference - * @instance - */ - InstanceReference.prototype.name = ""; - - /** - * InstanceReference region. - * @member {string} region - * @memberof google.cloud.sql.v1.InstanceReference - * @instance - */ - InstanceReference.prototype.region = ""; - - /** - * InstanceReference project. - * @member {string} project - * @memberof google.cloud.sql.v1.InstanceReference - * @instance - */ - InstanceReference.prototype.project = ""; - - /** - * Creates a new InstanceReference instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstanceReference - * @static - * @param {google.cloud.sql.v1.IInstanceReference=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstanceReference} InstanceReference instance - */ - InstanceReference.create = function create(properties) { - return new InstanceReference(properties); - }; - - /** - * Encodes the specified InstanceReference message. Does not implicitly {@link google.cloud.sql.v1.InstanceReference.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstanceReference - * @static - * @param {google.cloud.sql.v1.IInstanceReference} message InstanceReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstanceReference.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.region != null && Object.hasOwnProperty.call(message, "region")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.region); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - return writer; - }; - - /** - * Encodes the specified InstanceReference message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstanceReference.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstanceReference - * @static - * @param {google.cloud.sql.v1.IInstanceReference} message InstanceReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstanceReference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstanceReference message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstanceReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstanceReference} InstanceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstanceReference.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstanceReference(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.region = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstanceReference message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstanceReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstanceReference} InstanceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstanceReference.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstanceReference message. - * @function verify - * @memberof google.cloud.sql.v1.InstanceReference - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstanceReference.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.region != null && message.hasOwnProperty("region")) - if (!$util.isString(message.region)) - return "region: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates an InstanceReference message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstanceReference - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstanceReference} InstanceReference - */ - InstanceReference.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstanceReference) - return object; - var message = new $root.google.cloud.sql.v1.InstanceReference(); - if (object.name != null) - message.name = String(object.name); - if (object.region != null) - message.region = String(object.region); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from an InstanceReference message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstanceReference - * @static - * @param {google.cloud.sql.v1.InstanceReference} message InstanceReference - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstanceReference.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.region = ""; - object.project = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.region != null && message.hasOwnProperty("region")) - object.region = message.region; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this InstanceReference to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstanceReference - * @instance - * @returns {Object.} JSON object - */ - InstanceReference.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstanceReference - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstanceReference - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstanceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstanceReference"; - }; - - return InstanceReference; - })(); - - v1.DemoteMasterConfiguration = (function() { - - /** - * Properties of a DemoteMasterConfiguration. - * @memberof google.cloud.sql.v1 - * @interface IDemoteMasterConfiguration - * @property {string|null} [kind] DemoteMasterConfiguration kind - * @property {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration|null} [mysqlReplicaConfiguration] DemoteMasterConfiguration mysqlReplicaConfiguration - */ - - /** - * Constructs a new DemoteMasterConfiguration. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DemoteMasterConfiguration. - * @implements IDemoteMasterConfiguration - * @constructor - * @param {google.cloud.sql.v1.IDemoteMasterConfiguration=} [properties] Properties to set - */ - function DemoteMasterConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DemoteMasterConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @instance - */ - DemoteMasterConfiguration.prototype.kind = ""; - - /** - * DemoteMasterConfiguration mysqlReplicaConfiguration. - * @member {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration|null|undefined} mysqlReplicaConfiguration - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @instance - */ - DemoteMasterConfiguration.prototype.mysqlReplicaConfiguration = null; - - /** - * Creates a new DemoteMasterConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @static - * @param {google.cloud.sql.v1.IDemoteMasterConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DemoteMasterConfiguration} DemoteMasterConfiguration instance - */ - DemoteMasterConfiguration.create = function create(properties) { - return new DemoteMasterConfiguration(properties); - }; - - /** - * Encodes the specified DemoteMasterConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @static - * @param {google.cloud.sql.v1.IDemoteMasterConfiguration} message DemoteMasterConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.mysqlReplicaConfiguration != null && Object.hasOwnProperty.call(message, "mysqlReplicaConfiguration")) - $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.encode(message.mysqlReplicaConfiguration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DemoteMasterConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @static - * @param {google.cloud.sql.v1.IDemoteMasterConfiguration} message DemoteMasterConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DemoteMasterConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DemoteMasterConfiguration} DemoteMasterConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DemoteMasterConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DemoteMasterConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DemoteMasterConfiguration} DemoteMasterConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DemoteMasterConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DemoteMasterConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) { - var error = $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.verify(message.mysqlReplicaConfiguration); - if (error) - return "mysqlReplicaConfiguration." + error; - } - return null; - }; - - /** - * Creates a DemoteMasterConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DemoteMasterConfiguration} DemoteMasterConfiguration - */ - DemoteMasterConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DemoteMasterConfiguration) - return object; - var message = new $root.google.cloud.sql.v1.DemoteMasterConfiguration(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.mysqlReplicaConfiguration != null) { - if (typeof object.mysqlReplicaConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1.DemoteMasterConfiguration.mysqlReplicaConfiguration: object expected"); - message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.fromObject(object.mysqlReplicaConfiguration); - } - return message; - }; - - /** - * Creates a plain object from a DemoteMasterConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @static - * @param {google.cloud.sql.v1.DemoteMasterConfiguration} message DemoteMasterConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DemoteMasterConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.mysqlReplicaConfiguration = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) - object.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.toObject(message.mysqlReplicaConfiguration, options); - return object; - }; - - /** - * Converts this DemoteMasterConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @instance - * @returns {Object.} JSON object - */ - DemoteMasterConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DemoteMasterConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DemoteMasterConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DemoteMasterConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DemoteMasterConfiguration"; - }; - - return DemoteMasterConfiguration; - })(); - - v1.DemoteMasterMySqlReplicaConfiguration = (function() { - - /** - * Properties of a DemoteMasterMySqlReplicaConfiguration. - * @memberof google.cloud.sql.v1 - * @interface IDemoteMasterMySqlReplicaConfiguration - * @property {string|null} [kind] DemoteMasterMySqlReplicaConfiguration kind - * @property {string|null} [username] DemoteMasterMySqlReplicaConfiguration username - * @property {string|null} [password] DemoteMasterMySqlReplicaConfiguration password - * @property {string|null} [clientKey] DemoteMasterMySqlReplicaConfiguration clientKey - * @property {string|null} [clientCertificate] DemoteMasterMySqlReplicaConfiguration clientCertificate - * @property {string|null} [caCertificate] DemoteMasterMySqlReplicaConfiguration caCertificate - */ - - /** - * Constructs a new DemoteMasterMySqlReplicaConfiguration. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DemoteMasterMySqlReplicaConfiguration. - * @implements IDemoteMasterMySqlReplicaConfiguration - * @constructor - * @param {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration=} [properties] Properties to set - */ - function DemoteMasterMySqlReplicaConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DemoteMasterMySqlReplicaConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.kind = ""; - - /** - * DemoteMasterMySqlReplicaConfiguration username. - * @member {string} username - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.username = ""; - - /** - * DemoteMasterMySqlReplicaConfiguration password. - * @member {string} password - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.password = ""; - - /** - * DemoteMasterMySqlReplicaConfiguration clientKey. - * @member {string} clientKey - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.clientKey = ""; - - /** - * DemoteMasterMySqlReplicaConfiguration clientCertificate. - * @member {string} clientCertificate - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.clientCertificate = ""; - - /** - * DemoteMasterMySqlReplicaConfiguration caCertificate. - * @member {string} caCertificate - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.caCertificate = ""; - - /** - * Creates a new DemoteMasterMySqlReplicaConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration instance - */ - DemoteMasterMySqlReplicaConfiguration.create = function create(properties) { - return new DemoteMasterMySqlReplicaConfiguration(properties); - }; - - /** - * Encodes the specified DemoteMasterMySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterMySqlReplicaConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.username != null && Object.hasOwnProperty.call(message, "username")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); - if (message.password != null && Object.hasOwnProperty.call(message, "password")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); - if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.clientKey); - if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.clientCertificate); - if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.caCertificate); - return writer; - }; - - /** - * Encodes the specified DemoteMasterMySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.IDemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterMySqlReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterMySqlReplicaConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.username = reader.string(); - break; - } - case 3: { - message.password = reader.string(); - break; - } - case 4: { - message.clientKey = reader.string(); - break; - } - case 5: { - message.clientCertificate = reader.string(); - break; - } - case 6: { - message.caCertificate = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterMySqlReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DemoteMasterMySqlReplicaConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DemoteMasterMySqlReplicaConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.username != null && message.hasOwnProperty("username")) - if (!$util.isString(message.username)) - return "username: string expected"; - if (message.password != null && message.hasOwnProperty("password")) - if (!$util.isString(message.password)) - return "password: string expected"; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - if (!$util.isString(message.clientKey)) - return "clientKey: string expected"; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - if (!$util.isString(message.clientCertificate)) - return "clientCertificate: string expected"; - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - if (!$util.isString(message.caCertificate)) - return "caCertificate: string expected"; - return null; - }; - - /** - * Creates a DemoteMasterMySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration - */ - DemoteMasterMySqlReplicaConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration) - return object; - var message = new $root.google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.username != null) - message.username = String(object.username); - if (object.password != null) - message.password = String(object.password); - if (object.clientKey != null) - message.clientKey = String(object.clientKey); - if (object.clientCertificate != null) - message.clientCertificate = String(object.clientCertificate); - if (object.caCertificate != null) - message.caCertificate = String(object.caCertificate); - return message; - }; - - /** - * Creates a plain object from a DemoteMasterMySqlReplicaConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DemoteMasterMySqlReplicaConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.username = ""; - object.password = ""; - object.clientKey = ""; - object.clientCertificate = ""; - object.caCertificate = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.username != null && message.hasOwnProperty("username")) - object.username = message.username; - if (message.password != null && message.hasOwnProperty("password")) - object.password = message.password; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - object.clientKey = message.clientKey; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - object.clientCertificate = message.clientCertificate; - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - object.caCertificate = message.caCertificate; - return object; - }; - - /** - * Converts this DemoteMasterMySqlReplicaConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @instance - * @returns {Object.} JSON object - */ - DemoteMasterMySqlReplicaConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DemoteMasterMySqlReplicaConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DemoteMasterMySqlReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DemoteMasterMySqlReplicaConfiguration"; - }; - - return DemoteMasterMySqlReplicaConfiguration; - })(); - - /** - * SqlFileType enum. - * @name google.cloud.sql.v1.SqlFileType - * @enum {number} - * @property {number} SQL_FILE_TYPE_UNSPECIFIED=0 SQL_FILE_TYPE_UNSPECIFIED value - * @property {number} SQL=1 SQL value - * @property {number} CSV=2 CSV value - * @property {number} BAK=4 BAK value - * @property {number} TDE=8 TDE value - */ - v1.SqlFileType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_FILE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SQL"] = 1; - values[valuesById[2] = "CSV"] = 2; - values[valuesById[4] = "BAK"] = 4; - values[valuesById[8] = "TDE"] = 8; - return values; - })(); - - v1.ExportContext = (function() { - - /** - * Properties of an ExportContext. - * @memberof google.cloud.sql.v1 - * @interface IExportContext - * @property {string|null} [uri] ExportContext uri - * @property {Array.|null} [databases] ExportContext databases - * @property {string|null} [kind] ExportContext kind - * @property {google.cloud.sql.v1.ExportContext.ISqlExportOptions|null} [sqlExportOptions] ExportContext sqlExportOptions - * @property {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions|null} [csvExportOptions] ExportContext csvExportOptions - * @property {google.cloud.sql.v1.SqlFileType|null} [fileType] ExportContext fileType - * @property {google.protobuf.IBoolValue|null} [offload] ExportContext offload - * @property {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions|null} [bakExportOptions] ExportContext bakExportOptions - * @property {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions|null} [tdeExportOptions] ExportContext tdeExportOptions - */ - - /** - * Constructs a new ExportContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an ExportContext. - * @implements IExportContext - * @constructor - * @param {google.cloud.sql.v1.IExportContext=} [properties] Properties to set - */ - function ExportContext(properties) { - this.databases = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportContext uri. - * @member {string} uri - * @memberof google.cloud.sql.v1.ExportContext - * @instance - */ - ExportContext.prototype.uri = ""; - - /** - * ExportContext databases. - * @member {Array.} databases - * @memberof google.cloud.sql.v1.ExportContext - * @instance - */ - ExportContext.prototype.databases = $util.emptyArray; - - /** - * ExportContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.ExportContext - * @instance - */ - ExportContext.prototype.kind = ""; - - /** - * ExportContext sqlExportOptions. - * @member {google.cloud.sql.v1.ExportContext.ISqlExportOptions|null|undefined} sqlExportOptions - * @memberof google.cloud.sql.v1.ExportContext - * @instance - */ - ExportContext.prototype.sqlExportOptions = null; - - /** - * ExportContext csvExportOptions. - * @member {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions|null|undefined} csvExportOptions - * @memberof google.cloud.sql.v1.ExportContext - * @instance - */ - ExportContext.prototype.csvExportOptions = null; - - /** - * ExportContext fileType. - * @member {google.cloud.sql.v1.SqlFileType} fileType - * @memberof google.cloud.sql.v1.ExportContext - * @instance - */ - ExportContext.prototype.fileType = 0; - - /** - * ExportContext offload. - * @member {google.protobuf.IBoolValue|null|undefined} offload - * @memberof google.cloud.sql.v1.ExportContext - * @instance - */ - ExportContext.prototype.offload = null; - - /** - * ExportContext bakExportOptions. - * @member {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions|null|undefined} bakExportOptions - * @memberof google.cloud.sql.v1.ExportContext - * @instance - */ - ExportContext.prototype.bakExportOptions = null; - - /** - * ExportContext tdeExportOptions. - * @member {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions|null|undefined} tdeExportOptions - * @memberof google.cloud.sql.v1.ExportContext - * @instance - */ - ExportContext.prototype.tdeExportOptions = null; - - /** - * Creates a new ExportContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ExportContext - * @static - * @param {google.cloud.sql.v1.IExportContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ExportContext} ExportContext instance - */ - ExportContext.create = function create(properties) { - return new ExportContext(properties); - }; - - /** - * Encodes the specified ExportContext message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ExportContext - * @static - * @param {google.cloud.sql.v1.IExportContext} message ExportContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.databases != null && message.databases.length) - for (var i = 0; i < message.databases.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.databases[i]); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - if (message.sqlExportOptions != null && Object.hasOwnProperty.call(message, "sqlExportOptions")) - $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.encode(message.sqlExportOptions, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.csvExportOptions != null && Object.hasOwnProperty.call(message, "csvExportOptions")) - $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.encode(message.csvExportOptions, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.fileType != null && Object.hasOwnProperty.call(message, "fileType")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.fileType); - if (message.offload != null && Object.hasOwnProperty.call(message, "offload")) - $root.google.protobuf.BoolValue.encode(message.offload, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.bakExportOptions != null && Object.hasOwnProperty.call(message, "bakExportOptions")) - $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions.encode(message.bakExportOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.tdeExportOptions != null && Object.hasOwnProperty.call(message, "tdeExportOptions")) - $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.encode(message.tdeExportOptions, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ExportContext - * @static - * @param {google.cloud.sql.v1.IExportContext} message ExportContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ExportContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ExportContext} ExportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.uri = reader.string(); - break; - } - case 2: { - if (!(message.databases && message.databases.length)) - message.databases = []; - message.databases.push(reader.string()); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - case 4: { - message.sqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.decode(reader, reader.uint32()); - break; - } - case 5: { - message.csvExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.decode(reader, reader.uint32()); - break; - } - case 6: { - message.fileType = reader.int32(); - break; - } - case 8: { - message.offload = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 9: { - message.bakExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions.decode(reader, reader.uint32()); - break; - } - case 10: { - message.tdeExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExportContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ExportContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ExportContext} ExportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportContext message. - * @function verify - * @memberof google.cloud.sql.v1.ExportContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.databases != null && message.hasOwnProperty("databases")) { - if (!Array.isArray(message.databases)) - return "databases: array expected"; - for (var i = 0; i < message.databases.length; ++i) - if (!$util.isString(message.databases[i])) - return "databases: string[] expected"; - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.sqlExportOptions != null && message.hasOwnProperty("sqlExportOptions")) { - var error = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.verify(message.sqlExportOptions); - if (error) - return "sqlExportOptions." + error; - } - if (message.csvExportOptions != null && message.hasOwnProperty("csvExportOptions")) { - var error = $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.verify(message.csvExportOptions); - if (error) - return "csvExportOptions." + error; - } - if (message.fileType != null && message.hasOwnProperty("fileType")) - switch (message.fileType) { - default: - return "fileType: enum value expected"; - case 0: - case 1: - case 2: - case 4: - case 8: - break; - } - if (message.offload != null && message.hasOwnProperty("offload")) { - var error = $root.google.protobuf.BoolValue.verify(message.offload); - if (error) - return "offload." + error; - } - if (message.bakExportOptions != null && message.hasOwnProperty("bakExportOptions")) { - var error = $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions.verify(message.bakExportOptions); - if (error) - return "bakExportOptions." + error; - } - if (message.tdeExportOptions != null && message.hasOwnProperty("tdeExportOptions")) { - var error = $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.verify(message.tdeExportOptions); - if (error) - return "tdeExportOptions." + error; - } - return null; - }; - - /** - * Creates an ExportContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ExportContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ExportContext} ExportContext - */ - ExportContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ExportContext) - return object; - var message = new $root.google.cloud.sql.v1.ExportContext(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.databases) { - if (!Array.isArray(object.databases)) - throw TypeError(".google.cloud.sql.v1.ExportContext.databases: array expected"); - message.databases = []; - for (var i = 0; i < object.databases.length; ++i) - message.databases[i] = String(object.databases[i]); - } - if (object.kind != null) - message.kind = String(object.kind); - if (object.sqlExportOptions != null) { - if (typeof object.sqlExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.sqlExportOptions: object expected"); - message.sqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.fromObject(object.sqlExportOptions); - } - if (object.csvExportOptions != null) { - if (typeof object.csvExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.csvExportOptions: object expected"); - message.csvExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.fromObject(object.csvExportOptions); - } - switch (object.fileType) { - default: - if (typeof object.fileType === "number") { - message.fileType = object.fileType; - break; - } - break; - case "SQL_FILE_TYPE_UNSPECIFIED": - case 0: - message.fileType = 0; - break; - case "SQL": - case 1: - message.fileType = 1; - break; - case "CSV": - case 2: - message.fileType = 2; - break; - case "BAK": - case 4: - message.fileType = 4; - break; - case "TDE": - case 8: - message.fileType = 8; - break; - } - if (object.offload != null) { - if (typeof object.offload !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.offload: object expected"); - message.offload = $root.google.protobuf.BoolValue.fromObject(object.offload); - } - if (object.bakExportOptions != null) { - if (typeof object.bakExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.bakExportOptions: object expected"); - message.bakExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions.fromObject(object.bakExportOptions); - } - if (object.tdeExportOptions != null) { - if (typeof object.tdeExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.tdeExportOptions: object expected"); - message.tdeExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.fromObject(object.tdeExportOptions); - } - return message; - }; - - /** - * Creates a plain object from an ExportContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ExportContext - * @static - * @param {google.cloud.sql.v1.ExportContext} message ExportContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.databases = []; - if (options.defaults) { - object.uri = ""; - object.kind = ""; - object.sqlExportOptions = null; - object.csvExportOptions = null; - object.fileType = options.enums === String ? "SQL_FILE_TYPE_UNSPECIFIED" : 0; - object.offload = null; - object.bakExportOptions = null; - object.tdeExportOptions = null; - } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.databases && message.databases.length) { - object.databases = []; - for (var j = 0; j < message.databases.length; ++j) - object.databases[j] = message.databases[j]; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.sqlExportOptions != null && message.hasOwnProperty("sqlExportOptions")) - object.sqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.toObject(message.sqlExportOptions, options); - if (message.csvExportOptions != null && message.hasOwnProperty("csvExportOptions")) - object.csvExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.toObject(message.csvExportOptions, options); - if (message.fileType != null && message.hasOwnProperty("fileType")) - object.fileType = options.enums === String ? $root.google.cloud.sql.v1.SqlFileType[message.fileType] === undefined ? message.fileType : $root.google.cloud.sql.v1.SqlFileType[message.fileType] : message.fileType; - if (message.offload != null && message.hasOwnProperty("offload")) - object.offload = $root.google.protobuf.BoolValue.toObject(message.offload, options); - if (message.bakExportOptions != null && message.hasOwnProperty("bakExportOptions")) - object.bakExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions.toObject(message.bakExportOptions, options); - if (message.tdeExportOptions != null && message.hasOwnProperty("tdeExportOptions")) - object.tdeExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.toObject(message.tdeExportOptions, options); - return object; - }; - - /** - * Converts this ExportContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ExportContext - * @instance - * @returns {Object.} JSON object - */ - ExportContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ExportContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext"; - }; - - ExportContext.SqlCsvExportOptions = (function() { - - /** - * Properties of a SqlCsvExportOptions. - * @memberof google.cloud.sql.v1.ExportContext - * @interface ISqlCsvExportOptions - * @property {string|null} [selectQuery] SqlCsvExportOptions selectQuery - * @property {string|null} [escapeCharacter] SqlCsvExportOptions escapeCharacter - * @property {string|null} [quoteCharacter] SqlCsvExportOptions quoteCharacter - * @property {string|null} [fieldsTerminatedBy] SqlCsvExportOptions fieldsTerminatedBy - * @property {string|null} [linesTerminatedBy] SqlCsvExportOptions linesTerminatedBy - */ - - /** - * Constructs a new SqlCsvExportOptions. - * @memberof google.cloud.sql.v1.ExportContext - * @classdesc Represents a SqlCsvExportOptions. - * @implements ISqlCsvExportOptions - * @constructor - * @param {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions=} [properties] Properties to set - */ - function SqlCsvExportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlCsvExportOptions selectQuery. - * @member {string} selectQuery - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @instance - */ - SqlCsvExportOptions.prototype.selectQuery = ""; - - /** - * SqlCsvExportOptions escapeCharacter. - * @member {string} escapeCharacter - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @instance - */ - SqlCsvExportOptions.prototype.escapeCharacter = ""; - - /** - * SqlCsvExportOptions quoteCharacter. - * @member {string} quoteCharacter - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @instance - */ - SqlCsvExportOptions.prototype.quoteCharacter = ""; - - /** - * SqlCsvExportOptions fieldsTerminatedBy. - * @member {string} fieldsTerminatedBy - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @instance - */ - SqlCsvExportOptions.prototype.fieldsTerminatedBy = ""; - - /** - * SqlCsvExportOptions linesTerminatedBy. - * @member {string} linesTerminatedBy - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @instance - */ - SqlCsvExportOptions.prototype.linesTerminatedBy = ""; - - /** - * Creates a new SqlCsvExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions instance - */ - SqlCsvExportOptions.create = function create(properties) { - return new SqlCsvExportOptions(properties); - }; - - /** - * Encodes the specified SqlCsvExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions} message SqlCsvExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlCsvExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.selectQuery != null && Object.hasOwnProperty.call(message, "selectQuery")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selectQuery); - if (message.escapeCharacter != null && Object.hasOwnProperty.call(message, "escapeCharacter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.escapeCharacter); - if (message.quoteCharacter != null && Object.hasOwnProperty.call(message, "quoteCharacter")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.quoteCharacter); - if (message.fieldsTerminatedBy != null && Object.hasOwnProperty.call(message, "fieldsTerminatedBy")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.fieldsTerminatedBy); - if (message.linesTerminatedBy != null && Object.hasOwnProperty.call(message, "linesTerminatedBy")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.linesTerminatedBy); - return writer; - }; - - /** - * Encodes the specified SqlCsvExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlCsvExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlCsvExportOptions} message SqlCsvExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlCsvExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlCsvExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlCsvExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.selectQuery = reader.string(); - break; - } - case 2: { - message.escapeCharacter = reader.string(); - break; - } - case 3: { - message.quoteCharacter = reader.string(); - break; - } - case 4: { - message.fieldsTerminatedBy = reader.string(); - break; - } - case 6: { - message.linesTerminatedBy = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlCsvExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlCsvExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlCsvExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlCsvExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.selectQuery != null && message.hasOwnProperty("selectQuery")) - if (!$util.isString(message.selectQuery)) - return "selectQuery: string expected"; - if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) - if (!$util.isString(message.escapeCharacter)) - return "escapeCharacter: string expected"; - if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) - if (!$util.isString(message.quoteCharacter)) - return "quoteCharacter: string expected"; - if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) - if (!$util.isString(message.fieldsTerminatedBy)) - return "fieldsTerminatedBy: string expected"; - if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) - if (!$util.isString(message.linesTerminatedBy)) - return "linesTerminatedBy: string expected"; - return null; - }; - - /** - * Creates a SqlCsvExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions - */ - SqlCsvExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ExportContext.SqlCsvExportOptions(); - if (object.selectQuery != null) - message.selectQuery = String(object.selectQuery); - if (object.escapeCharacter != null) - message.escapeCharacter = String(object.escapeCharacter); - if (object.quoteCharacter != null) - message.quoteCharacter = String(object.quoteCharacter); - if (object.fieldsTerminatedBy != null) - message.fieldsTerminatedBy = String(object.fieldsTerminatedBy); - if (object.linesTerminatedBy != null) - message.linesTerminatedBy = String(object.linesTerminatedBy); - return message; - }; - - /** - * Creates a plain object from a SqlCsvExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlCsvExportOptions} message SqlCsvExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlCsvExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.selectQuery = ""; - object.escapeCharacter = ""; - object.quoteCharacter = ""; - object.fieldsTerminatedBy = ""; - object.linesTerminatedBy = ""; - } - if (message.selectQuery != null && message.hasOwnProperty("selectQuery")) - object.selectQuery = message.selectQuery; - if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) - object.escapeCharacter = message.escapeCharacter; - if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) - object.quoteCharacter = message.quoteCharacter; - if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) - object.fieldsTerminatedBy = message.fieldsTerminatedBy; - if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) - object.linesTerminatedBy = message.linesTerminatedBy; - return object; - }; - - /** - * Converts this SqlCsvExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlCsvExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlCsvExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ExportContext.SqlCsvExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlCsvExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlCsvExportOptions"; - }; - - return SqlCsvExportOptions; - })(); - - ExportContext.SqlExportOptions = (function() { - - /** - * Properties of a SqlExportOptions. - * @memberof google.cloud.sql.v1.ExportContext - * @interface ISqlExportOptions - * @property {Array.|null} [tables] SqlExportOptions tables - * @property {google.protobuf.IBoolValue|null} [schemaOnly] SqlExportOptions schemaOnly - * @property {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions|null} [mysqlExportOptions] SqlExportOptions mysqlExportOptions - * @property {google.protobuf.IInt32Value|null} [threads] SqlExportOptions threads - * @property {google.protobuf.IBoolValue|null} [parallel] SqlExportOptions parallel - * @property {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions|null} [postgresExportOptions] SqlExportOptions postgresExportOptions - */ - - /** - * Constructs a new SqlExportOptions. - * @memberof google.cloud.sql.v1.ExportContext - * @classdesc Represents a SqlExportOptions. - * @implements ISqlExportOptions - * @constructor - * @param {google.cloud.sql.v1.ExportContext.ISqlExportOptions=} [properties] Properties to set - */ - function SqlExportOptions(properties) { - this.tables = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlExportOptions tables. - * @member {Array.} tables - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.tables = $util.emptyArray; - - /** - * SqlExportOptions schemaOnly. - * @member {google.protobuf.IBoolValue|null|undefined} schemaOnly - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.schemaOnly = null; - - /** - * SqlExportOptions mysqlExportOptions. - * @member {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions|null|undefined} mysqlExportOptions - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.mysqlExportOptions = null; - - /** - * SqlExportOptions threads. - * @member {google.protobuf.IInt32Value|null|undefined} threads - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.threads = null; - - /** - * SqlExportOptions parallel. - * @member {google.protobuf.IBoolValue|null|undefined} parallel - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.parallel = null; - - /** - * SqlExportOptions postgresExportOptions. - * @member {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions|null|undefined} postgresExportOptions - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.postgresExportOptions = null; - - /** - * Creates a new SqlExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions} SqlExportOptions instance - */ - SqlExportOptions.create = function create(properties) { - return new SqlExportOptions(properties); - }; - - /** - * Encodes the specified SqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlExportOptions} message SqlExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tables != null && message.tables.length) - for (var i = 0; i < message.tables.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.tables[i]); - if (message.schemaOnly != null && Object.hasOwnProperty.call(message, "schemaOnly")) - $root.google.protobuf.BoolValue.encode(message.schemaOnly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.mysqlExportOptions != null && Object.hasOwnProperty.call(message, "mysqlExportOptions")) - $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.encode(message.mysqlExportOptions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.threads != null && Object.hasOwnProperty.call(message, "threads")) - $root.google.protobuf.Int32Value.encode(message.threads, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.parallel != null && Object.hasOwnProperty.call(message, "parallel")) - $root.google.protobuf.BoolValue.encode(message.parallel, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.postgresExportOptions != null && Object.hasOwnProperty.call(message, "postgresExportOptions")) - $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.encode(message.postgresExportOptions, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlExportOptions} message SqlExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions} SqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.tables && message.tables.length)) - message.tables = []; - message.tables.push(reader.string()); - break; - } - case 2: { - message.schemaOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 3: { - message.mysqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.decode(reader, reader.uint32()); - break; - } - case 4: { - message.threads = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 5: { - message.parallel = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 6: { - message.postgresExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions} SqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tables != null && message.hasOwnProperty("tables")) { - if (!Array.isArray(message.tables)) - return "tables: array expected"; - for (var i = 0; i < message.tables.length; ++i) - if (!$util.isString(message.tables[i])) - return "tables: string[] expected"; - } - if (message.schemaOnly != null && message.hasOwnProperty("schemaOnly")) { - var error = $root.google.protobuf.BoolValue.verify(message.schemaOnly); - if (error) - return "schemaOnly." + error; - } - if (message.mysqlExportOptions != null && message.hasOwnProperty("mysqlExportOptions")) { - var error = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.verify(message.mysqlExportOptions); - if (error) - return "mysqlExportOptions." + error; - } - if (message.threads != null && message.hasOwnProperty("threads")) { - var error = $root.google.protobuf.Int32Value.verify(message.threads); - if (error) - return "threads." + error; - } - if (message.parallel != null && message.hasOwnProperty("parallel")) { - var error = $root.google.protobuf.BoolValue.verify(message.parallel); - if (error) - return "parallel." + error; - } - if (message.postgresExportOptions != null && message.hasOwnProperty("postgresExportOptions")) { - var error = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.verify(message.postgresExportOptions); - if (error) - return "postgresExportOptions." + error; - } - return null; - }; - - /** - * Creates a SqlExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions} SqlExportOptions - */ - SqlExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlExportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions(); - if (object.tables) { - if (!Array.isArray(object.tables)) - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.tables: array expected"); - message.tables = []; - for (var i = 0; i < object.tables.length; ++i) - message.tables[i] = String(object.tables[i]); - } - if (object.schemaOnly != null) { - if (typeof object.schemaOnly !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.schemaOnly: object expected"); - message.schemaOnly = $root.google.protobuf.BoolValue.fromObject(object.schemaOnly); - } - if (object.mysqlExportOptions != null) { - if (typeof object.mysqlExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.mysqlExportOptions: object expected"); - message.mysqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.fromObject(object.mysqlExportOptions); - } - if (object.threads != null) { - if (typeof object.threads !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.threads: object expected"); - message.threads = $root.google.protobuf.Int32Value.fromObject(object.threads); - } - if (object.parallel != null) { - if (typeof object.parallel !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.parallel: object expected"); - message.parallel = $root.google.protobuf.BoolValue.fromObject(object.parallel); - } - if (object.postgresExportOptions != null) { - if (typeof object.postgresExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.postgresExportOptions: object expected"); - message.postgresExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.fromObject(object.postgresExportOptions); - } - return message; - }; - - /** - * Creates a plain object from a SqlExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions} message SqlExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.tables = []; - if (options.defaults) { - object.schemaOnly = null; - object.mysqlExportOptions = null; - object.threads = null; - object.parallel = null; - object.postgresExportOptions = null; - } - if (message.tables && message.tables.length) { - object.tables = []; - for (var j = 0; j < message.tables.length; ++j) - object.tables[j] = message.tables[j]; - } - if (message.schemaOnly != null && message.hasOwnProperty("schemaOnly")) - object.schemaOnly = $root.google.protobuf.BoolValue.toObject(message.schemaOnly, options); - if (message.mysqlExportOptions != null && message.hasOwnProperty("mysqlExportOptions")) - object.mysqlExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.toObject(message.mysqlExportOptions, options); - if (message.threads != null && message.hasOwnProperty("threads")) - object.threads = $root.google.protobuf.Int32Value.toObject(message.threads, options); - if (message.parallel != null && message.hasOwnProperty("parallel")) - object.parallel = $root.google.protobuf.BoolValue.toObject(message.parallel, options); - if (message.postgresExportOptions != null && message.hasOwnProperty("postgresExportOptions")) - object.postgresExportOptions = $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.toObject(message.postgresExportOptions, options); - return object; - }; - - /** - * Converts this SqlExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlExportOptions"; - }; - - SqlExportOptions.MysqlExportOptions = (function() { - - /** - * Properties of a MysqlExportOptions. - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @interface IMysqlExportOptions - * @property {google.protobuf.IInt32Value|null} [masterData] MysqlExportOptions masterData - */ - - /** - * Constructs a new MysqlExportOptions. - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @classdesc Represents a MysqlExportOptions. - * @implements IMysqlExportOptions - * @constructor - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions=} [properties] Properties to set - */ - function MysqlExportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MysqlExportOptions masterData. - * @member {google.protobuf.IInt32Value|null|undefined} masterData - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @instance - */ - MysqlExportOptions.prototype.masterData = null; - - /** - * Creates a new MysqlExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions instance - */ - MysqlExportOptions.create = function create(properties) { - return new MysqlExportOptions(properties); - }; - - /** - * Encodes the specified MysqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions} message MysqlExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MysqlExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.masterData != null && Object.hasOwnProperty.call(message, "masterData")) - $root.google.protobuf.Int32Value.encode(message.masterData, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MysqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IMysqlExportOptions} message MysqlExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MysqlExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MysqlExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MysqlExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.masterData = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MysqlExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MysqlExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MysqlExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MysqlExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.masterData != null && message.hasOwnProperty("masterData")) { - var error = $root.google.protobuf.Int32Value.verify(message.masterData); - if (error) - return "masterData." + error; - } - return null; - }; - - /** - * Creates a MysqlExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions - */ - MysqlExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions(); - if (object.masterData != null) { - if (typeof object.masterData !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions.masterData: object expected"); - message.masterData = $root.google.protobuf.Int32Value.fromObject(object.masterData); - } - return message; - }; - - /** - * Creates a plain object from a MysqlExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions} message MysqlExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MysqlExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.masterData = null; - if (message.masterData != null && message.hasOwnProperty("masterData")) - object.masterData = $root.google.protobuf.Int32Value.toObject(message.masterData, options); - return object; - }; - - /** - * Converts this MysqlExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @instance - * @returns {Object.} JSON object - */ - MysqlExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MysqlExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MysqlExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlExportOptions.MysqlExportOptions"; - }; - - return MysqlExportOptions; - })(); - - SqlExportOptions.PostgresExportOptions = (function() { - - /** - * Properties of a PostgresExportOptions. - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @interface IPostgresExportOptions - * @property {google.protobuf.IBoolValue|null} [clean] PostgresExportOptions clean - * @property {google.protobuf.IBoolValue|null} [ifExists] PostgresExportOptions ifExists - */ - - /** - * Constructs a new PostgresExportOptions. - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions - * @classdesc Represents a PostgresExportOptions. - * @implements IPostgresExportOptions - * @constructor - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions=} [properties] Properties to set - */ - function PostgresExportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PostgresExportOptions clean. - * @member {google.protobuf.IBoolValue|null|undefined} clean - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @instance - */ - PostgresExportOptions.prototype.clean = null; - - /** - * PostgresExportOptions ifExists. - * @member {google.protobuf.IBoolValue|null|undefined} ifExists - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @instance - */ - PostgresExportOptions.prototype.ifExists = null; - - /** - * Creates a new PostgresExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions instance - */ - PostgresExportOptions.create = function create(properties) { - return new PostgresExportOptions(properties); - }; - - /** - * Encodes the specified PostgresExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions} message PostgresExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PostgresExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.clean != null && Object.hasOwnProperty.call(message, "clean")) - $root.google.protobuf.BoolValue.encode(message.clean, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.ifExists != null && Object.hasOwnProperty.call(message, "ifExists")) - $root.google.protobuf.BoolValue.encode(message.ifExists, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PostgresExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.IPostgresExportOptions} message PostgresExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PostgresExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PostgresExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PostgresExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.clean = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 2: { - message.ifExists = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PostgresExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PostgresExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PostgresExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PostgresExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.clean != null && message.hasOwnProperty("clean")) { - var error = $root.google.protobuf.BoolValue.verify(message.clean); - if (error) - return "clean." + error; - } - if (message.ifExists != null && message.hasOwnProperty("ifExists")) { - var error = $root.google.protobuf.BoolValue.verify(message.ifExists); - if (error) - return "ifExists." + error; - } - return null; - }; - - /** - * Creates a PostgresExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions - */ - PostgresExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions(); - if (object.clean != null) { - if (typeof object.clean !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.clean: object expected"); - message.clean = $root.google.protobuf.BoolValue.fromObject(object.clean); - } - if (object.ifExists != null) { - if (typeof object.ifExists !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions.ifExists: object expected"); - message.ifExists = $root.google.protobuf.BoolValue.fromObject(object.ifExists); - } - return message; - }; - - /** - * Creates a plain object from a PostgresExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions} message PostgresExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PostgresExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.clean = null; - object.ifExists = null; - } - if (message.clean != null && message.hasOwnProperty("clean")) - object.clean = $root.google.protobuf.BoolValue.toObject(message.clean, options); - if (message.ifExists != null && message.hasOwnProperty("ifExists")) - object.ifExists = $root.google.protobuf.BoolValue.toObject(message.ifExists, options); - return object; - }; - - /** - * Converts this PostgresExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @instance - * @returns {Object.} JSON object - */ - PostgresExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PostgresExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PostgresExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlExportOptions.PostgresExportOptions"; - }; - - return PostgresExportOptions; - })(); - - return SqlExportOptions; - })(); - - ExportContext.SqlBakExportOptions = (function() { - - /** - * Properties of a SqlBakExportOptions. - * @memberof google.cloud.sql.v1.ExportContext - * @interface ISqlBakExportOptions - * @property {google.protobuf.IBoolValue|null} [striped] SqlBakExportOptions striped - * @property {google.protobuf.IInt32Value|null} [stripeCount] SqlBakExportOptions stripeCount - * @property {google.cloud.sql.v1.BakType|null} [bakType] SqlBakExportOptions bakType - * @property {google.protobuf.IBoolValue|null} [copyOnly] SqlBakExportOptions copyOnly - * @property {google.protobuf.IBoolValue|null} [differentialBase] SqlBakExportOptions differentialBase - * @property {google.protobuf.ITimestamp|null} [exportLogStartTime] SqlBakExportOptions exportLogStartTime - * @property {google.protobuf.ITimestamp|null} [exportLogEndTime] SqlBakExportOptions exportLogEndTime - */ - - /** - * Constructs a new SqlBakExportOptions. - * @memberof google.cloud.sql.v1.ExportContext - * @classdesc Represents a SqlBakExportOptions. - * @implements ISqlBakExportOptions - * @constructor - * @param {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions=} [properties] Properties to set - */ - function SqlBakExportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBakExportOptions striped. - * @member {google.protobuf.IBoolValue|null|undefined} striped - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.striped = null; - - /** - * SqlBakExportOptions stripeCount. - * @member {google.protobuf.IInt32Value|null|undefined} stripeCount - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.stripeCount = null; - - /** - * SqlBakExportOptions bakType. - * @member {google.cloud.sql.v1.BakType} bakType - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.bakType = 0; - - /** - * SqlBakExportOptions copyOnly. - * @member {google.protobuf.IBoolValue|null|undefined} copyOnly - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.copyOnly = null; - - /** - * SqlBakExportOptions differentialBase. - * @member {google.protobuf.IBoolValue|null|undefined} differentialBase - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.differentialBase = null; - - /** - * SqlBakExportOptions exportLogStartTime. - * @member {google.protobuf.ITimestamp|null|undefined} exportLogStartTime - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.exportLogStartTime = null; - - /** - * SqlBakExportOptions exportLogEndTime. - * @member {google.protobuf.ITimestamp|null|undefined} exportLogEndTime - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.exportLogEndTime = null; - - /** - * Creates a new SqlBakExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ExportContext.SqlBakExportOptions} SqlBakExportOptions instance - */ - SqlBakExportOptions.create = function create(properties) { - return new SqlBakExportOptions(properties); - }; - - /** - * Encodes the specified SqlBakExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlBakExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions} message SqlBakExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBakExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.striped != null && Object.hasOwnProperty.call(message, "striped")) - $root.google.protobuf.BoolValue.encode(message.striped, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.stripeCount != null && Object.hasOwnProperty.call(message, "stripeCount")) - $root.google.protobuf.Int32Value.encode(message.stripeCount, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bakType != null && Object.hasOwnProperty.call(message, "bakType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.bakType); - if (message.copyOnly != null && Object.hasOwnProperty.call(message, "copyOnly")) - $root.google.protobuf.BoolValue.encode(message.copyOnly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.differentialBase != null && Object.hasOwnProperty.call(message, "differentialBase")) - $root.google.protobuf.BoolValue.encode(message.differentialBase, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.exportLogStartTime != null && Object.hasOwnProperty.call(message, "exportLogStartTime")) - $root.google.protobuf.Timestamp.encode(message.exportLogStartTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.exportLogEndTime != null && Object.hasOwnProperty.call(message, "exportLogEndTime")) - $root.google.protobuf.Timestamp.encode(message.exportLogEndTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlBakExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlBakExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlBakExportOptions} message SqlBakExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBakExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBakExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ExportContext.SqlBakExportOptions} SqlBakExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBakExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.striped = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 2: { - message.stripeCount = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 4: { - message.bakType = reader.int32(); - break; - } - case 5: { - message.copyOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 6: { - message.differentialBase = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 7: { - message.exportLogStartTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 8: { - message.exportLogEndTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBakExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ExportContext.SqlBakExportOptions} SqlBakExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBakExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBakExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBakExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.striped != null && message.hasOwnProperty("striped")) { - var error = $root.google.protobuf.BoolValue.verify(message.striped); - if (error) - return "striped." + error; - } - if (message.stripeCount != null && message.hasOwnProperty("stripeCount")) { - var error = $root.google.protobuf.Int32Value.verify(message.stripeCount); - if (error) - return "stripeCount." + error; - } - if (message.bakType != null && message.hasOwnProperty("bakType")) - switch (message.bakType) { - default: - return "bakType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.copyOnly != null && message.hasOwnProperty("copyOnly")) { - var error = $root.google.protobuf.BoolValue.verify(message.copyOnly); - if (error) - return "copyOnly." + error; - } - if (message.differentialBase != null && message.hasOwnProperty("differentialBase")) { - var error = $root.google.protobuf.BoolValue.verify(message.differentialBase); - if (error) - return "differentialBase." + error; - } - if (message.exportLogStartTime != null && message.hasOwnProperty("exportLogStartTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.exportLogStartTime); - if (error) - return "exportLogStartTime." + error; - } - if (message.exportLogEndTime != null && message.hasOwnProperty("exportLogEndTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.exportLogEndTime); - if (error) - return "exportLogEndTime." + error; - } - return null; - }; - - /** - * Creates a SqlBakExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ExportContext.SqlBakExportOptions} SqlBakExportOptions - */ - SqlBakExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ExportContext.SqlBakExportOptions(); - if (object.striped != null) { - if (typeof object.striped !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.striped: object expected"); - message.striped = $root.google.protobuf.BoolValue.fromObject(object.striped); - } - if (object.stripeCount != null) { - if (typeof object.stripeCount !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.stripeCount: object expected"); - message.stripeCount = $root.google.protobuf.Int32Value.fromObject(object.stripeCount); - } - switch (object.bakType) { - default: - if (typeof object.bakType === "number") { - message.bakType = object.bakType; - break; - } - break; - case "BAK_TYPE_UNSPECIFIED": - case 0: - message.bakType = 0; - break; - case "FULL": - case 1: - message.bakType = 1; - break; - case "DIFF": - case 2: - message.bakType = 2; - break; - case "TLOG": - case 3: - message.bakType = 3; - break; - } - if (object.copyOnly != null) { - if (typeof object.copyOnly !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.copyOnly: object expected"); - message.copyOnly = $root.google.protobuf.BoolValue.fromObject(object.copyOnly); - } - if (object.differentialBase != null) { - if (typeof object.differentialBase !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.differentialBase: object expected"); - message.differentialBase = $root.google.protobuf.BoolValue.fromObject(object.differentialBase); - } - if (object.exportLogStartTime != null) { - if (typeof object.exportLogStartTime !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.exportLogStartTime: object expected"); - message.exportLogStartTime = $root.google.protobuf.Timestamp.fromObject(object.exportLogStartTime); - } - if (object.exportLogEndTime != null) { - if (typeof object.exportLogEndTime !== "object") - throw TypeError(".google.cloud.sql.v1.ExportContext.SqlBakExportOptions.exportLogEndTime: object expected"); - message.exportLogEndTime = $root.google.protobuf.Timestamp.fromObject(object.exportLogEndTime); - } - return message; - }; - - /** - * Creates a plain object from a SqlBakExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlBakExportOptions} message SqlBakExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBakExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.striped = null; - object.stripeCount = null; - object.bakType = options.enums === String ? "BAK_TYPE_UNSPECIFIED" : 0; - object.copyOnly = null; - object.differentialBase = null; - object.exportLogStartTime = null; - object.exportLogEndTime = null; - } - if (message.striped != null && message.hasOwnProperty("striped")) - object.striped = $root.google.protobuf.BoolValue.toObject(message.striped, options); - if (message.stripeCount != null && message.hasOwnProperty("stripeCount")) - object.stripeCount = $root.google.protobuf.Int32Value.toObject(message.stripeCount, options); - if (message.bakType != null && message.hasOwnProperty("bakType")) - object.bakType = options.enums === String ? $root.google.cloud.sql.v1.BakType[message.bakType] === undefined ? message.bakType : $root.google.cloud.sql.v1.BakType[message.bakType] : message.bakType; - if (message.copyOnly != null && message.hasOwnProperty("copyOnly")) - object.copyOnly = $root.google.protobuf.BoolValue.toObject(message.copyOnly, options); - if (message.differentialBase != null && message.hasOwnProperty("differentialBase")) - object.differentialBase = $root.google.protobuf.BoolValue.toObject(message.differentialBase, options); - if (message.exportLogStartTime != null && message.hasOwnProperty("exportLogStartTime")) - object.exportLogStartTime = $root.google.protobuf.Timestamp.toObject(message.exportLogStartTime, options); - if (message.exportLogEndTime != null && message.hasOwnProperty("exportLogEndTime")) - object.exportLogEndTime = $root.google.protobuf.Timestamp.toObject(message.exportLogEndTime, options); - return object; - }; - - /** - * Converts this SqlBakExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlBakExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBakExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ExportContext.SqlBakExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBakExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlBakExportOptions"; - }; - - return SqlBakExportOptions; - })(); - - ExportContext.SqlTdeExportOptions = (function() { - - /** - * Properties of a SqlTdeExportOptions. - * @memberof google.cloud.sql.v1.ExportContext - * @interface ISqlTdeExportOptions - * @property {string|null} [certificatePath] SqlTdeExportOptions certificatePath - * @property {string|null} [privateKeyPath] SqlTdeExportOptions privateKeyPath - * @property {string|null} [privateKeyPassword] SqlTdeExportOptions privateKeyPassword - * @property {string|null} [name] SqlTdeExportOptions name - */ - - /** - * Constructs a new SqlTdeExportOptions. - * @memberof google.cloud.sql.v1.ExportContext - * @classdesc Represents a SqlTdeExportOptions. - * @implements ISqlTdeExportOptions - * @constructor - * @param {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions=} [properties] Properties to set - */ - function SqlTdeExportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlTdeExportOptions certificatePath. - * @member {string} certificatePath - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @instance - */ - SqlTdeExportOptions.prototype.certificatePath = ""; - - /** - * SqlTdeExportOptions privateKeyPath. - * @member {string} privateKeyPath - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @instance - */ - SqlTdeExportOptions.prototype.privateKeyPath = ""; - - /** - * SqlTdeExportOptions privateKeyPassword. - * @member {string} privateKeyPassword - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @instance - */ - SqlTdeExportOptions.prototype.privateKeyPassword = ""; - - /** - * SqlTdeExportOptions name. - * @member {string} name - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @instance - */ - SqlTdeExportOptions.prototype.name = ""; - - /** - * Creates a new SqlTdeExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions instance - */ - SqlTdeExportOptions.create = function create(properties) { - return new SqlTdeExportOptions(properties); - }; - - /** - * Encodes the specified SqlTdeExportOptions message. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions} message SqlTdeExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTdeExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certificatePath != null && Object.hasOwnProperty.call(message, "certificatePath")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.certificatePath); - if (message.privateKeyPath != null && Object.hasOwnProperty.call(message, "privateKeyPath")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateKeyPath); - if (message.privateKeyPassword != null && Object.hasOwnProperty.call(message, "privateKeyPassword")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.privateKeyPassword); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); - return writer; - }; - - /** - * Encodes the specified SqlTdeExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExportContext.SqlTdeExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.ISqlTdeExportOptions} message SqlTdeExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTdeExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlTdeExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTdeExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.certificatePath = reader.string(); - break; - } - case 2: { - message.privateKeyPath = reader.string(); - break; - } - case 3: { - message.privateKeyPassword = reader.string(); - break; - } - case 5: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlTdeExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTdeExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlTdeExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlTdeExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) - if (!$util.isString(message.certificatePath)) - return "certificatePath: string expected"; - if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) - if (!$util.isString(message.privateKeyPath)) - return "privateKeyPath: string expected"; - if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) - if (!$util.isString(message.privateKeyPassword)) - return "privateKeyPassword: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a SqlTdeExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions - */ - SqlTdeExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ExportContext.SqlTdeExportOptions(); - if (object.certificatePath != null) - message.certificatePath = String(object.certificatePath); - if (object.privateKeyPath != null) - message.privateKeyPath = String(object.privateKeyPath); - if (object.privateKeyPassword != null) - message.privateKeyPassword = String(object.privateKeyPassword); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a SqlTdeExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @static - * @param {google.cloud.sql.v1.ExportContext.SqlTdeExportOptions} message SqlTdeExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlTdeExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.certificatePath = ""; - object.privateKeyPath = ""; - object.privateKeyPassword = ""; - object.name = ""; - } - if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) - object.certificatePath = message.certificatePath; - if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) - object.privateKeyPath = message.privateKeyPath; - if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) - object.privateKeyPassword = message.privateKeyPassword; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this SqlTdeExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlTdeExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlTdeExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ExportContext.SqlTdeExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlTdeExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ExportContext.SqlTdeExportOptions"; - }; - - return SqlTdeExportOptions; - })(); - - return ExportContext; - })(); - - v1.ImportContext = (function() { - - /** - * Properties of an ImportContext. - * @memberof google.cloud.sql.v1 - * @interface IImportContext - * @property {string|null} [uri] ImportContext uri - * @property {string|null} [database] ImportContext database - * @property {string|null} [kind] ImportContext kind - * @property {google.cloud.sql.v1.SqlFileType|null} [fileType] ImportContext fileType - * @property {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions|null} [csvImportOptions] ImportContext csvImportOptions - * @property {string|null} [importUser] ImportContext importUser - * @property {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions|null} [bakImportOptions] ImportContext bakImportOptions - * @property {google.cloud.sql.v1.ImportContext.ISqlImportOptions|null} [sqlImportOptions] ImportContext sqlImportOptions - * @property {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions|null} [tdeImportOptions] ImportContext tdeImportOptions - */ - - /** - * Constructs a new ImportContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an ImportContext. - * @implements IImportContext - * @constructor - * @param {google.cloud.sql.v1.IImportContext=} [properties] Properties to set - */ - function ImportContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ImportContext uri. - * @member {string} uri - * @memberof google.cloud.sql.v1.ImportContext - * @instance - */ - ImportContext.prototype.uri = ""; - - /** - * ImportContext database. - * @member {string} database - * @memberof google.cloud.sql.v1.ImportContext - * @instance - */ - ImportContext.prototype.database = ""; - - /** - * ImportContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.ImportContext - * @instance - */ - ImportContext.prototype.kind = ""; - - /** - * ImportContext fileType. - * @member {google.cloud.sql.v1.SqlFileType} fileType - * @memberof google.cloud.sql.v1.ImportContext - * @instance - */ - ImportContext.prototype.fileType = 0; - - /** - * ImportContext csvImportOptions. - * @member {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions|null|undefined} csvImportOptions - * @memberof google.cloud.sql.v1.ImportContext - * @instance - */ - ImportContext.prototype.csvImportOptions = null; - - /** - * ImportContext importUser. - * @member {string} importUser - * @memberof google.cloud.sql.v1.ImportContext - * @instance - */ - ImportContext.prototype.importUser = ""; - - /** - * ImportContext bakImportOptions. - * @member {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions|null|undefined} bakImportOptions - * @memberof google.cloud.sql.v1.ImportContext - * @instance - */ - ImportContext.prototype.bakImportOptions = null; - - /** - * ImportContext sqlImportOptions. - * @member {google.cloud.sql.v1.ImportContext.ISqlImportOptions|null|undefined} sqlImportOptions - * @memberof google.cloud.sql.v1.ImportContext - * @instance - */ - ImportContext.prototype.sqlImportOptions = null; - - /** - * ImportContext tdeImportOptions. - * @member {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions|null|undefined} tdeImportOptions - * @memberof google.cloud.sql.v1.ImportContext - * @instance - */ - ImportContext.prototype.tdeImportOptions = null; - - /** - * Creates a new ImportContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ImportContext - * @static - * @param {google.cloud.sql.v1.IImportContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ImportContext} ImportContext instance - */ - ImportContext.create = function create(properties) { - return new ImportContext(properties); - }; - - /** - * Encodes the specified ImportContext message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ImportContext - * @static - * @param {google.cloud.sql.v1.IImportContext} message ImportContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.database); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - if (message.fileType != null && Object.hasOwnProperty.call(message, "fileType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.fileType); - if (message.csvImportOptions != null && Object.hasOwnProperty.call(message, "csvImportOptions")) - $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.encode(message.csvImportOptions, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.importUser != null && Object.hasOwnProperty.call(message, "importUser")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.importUser); - if (message.bakImportOptions != null && Object.hasOwnProperty.call(message, "bakImportOptions")) - $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.encode(message.bakImportOptions, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.sqlImportOptions != null && Object.hasOwnProperty.call(message, "sqlImportOptions")) - $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.encode(message.sqlImportOptions, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.tdeImportOptions != null && Object.hasOwnProperty.call(message, "tdeImportOptions")) - $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.encode(message.tdeImportOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ImportContext - * @static - * @param {google.cloud.sql.v1.IImportContext} message ImportContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ImportContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ImportContext} ImportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.uri = reader.string(); - break; - } - case 2: { - message.database = reader.string(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - case 4: { - message.fileType = reader.int32(); - break; - } - case 5: { - message.csvImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.decode(reader, reader.uint32()); - break; - } - case 6: { - message.importUser = reader.string(); - break; - } - case 7: { - message.bakImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.decode(reader, reader.uint32()); - break; - } - case 8: { - message.sqlImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.decode(reader, reader.uint32()); - break; - } - case 9: { - message.tdeImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ImportContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ImportContext} ImportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportContext message. - * @function verify - * @memberof google.cloud.sql.v1.ImportContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.fileType != null && message.hasOwnProperty("fileType")) - switch (message.fileType) { - default: - return "fileType: enum value expected"; - case 0: - case 1: - case 2: - case 4: - case 8: - break; - } - if (message.csvImportOptions != null && message.hasOwnProperty("csvImportOptions")) { - var error = $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.verify(message.csvImportOptions); - if (error) - return "csvImportOptions." + error; - } - if (message.importUser != null && message.hasOwnProperty("importUser")) - if (!$util.isString(message.importUser)) - return "importUser: string expected"; - if (message.bakImportOptions != null && message.hasOwnProperty("bakImportOptions")) { - var error = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.verify(message.bakImportOptions); - if (error) - return "bakImportOptions." + error; - } - if (message.sqlImportOptions != null && message.hasOwnProperty("sqlImportOptions")) { - var error = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.verify(message.sqlImportOptions); - if (error) - return "sqlImportOptions." + error; - } - if (message.tdeImportOptions != null && message.hasOwnProperty("tdeImportOptions")) { - var error = $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.verify(message.tdeImportOptions); - if (error) - return "tdeImportOptions." + error; - } - return null; - }; - - /** - * Creates an ImportContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ImportContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ImportContext} ImportContext - */ - ImportContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ImportContext) - return object; - var message = new $root.google.cloud.sql.v1.ImportContext(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.database != null) - message.database = String(object.database); - if (object.kind != null) - message.kind = String(object.kind); - switch (object.fileType) { - default: - if (typeof object.fileType === "number") { - message.fileType = object.fileType; - break; - } - break; - case "SQL_FILE_TYPE_UNSPECIFIED": - case 0: - message.fileType = 0; - break; - case "SQL": - case 1: - message.fileType = 1; - break; - case "CSV": - case 2: - message.fileType = 2; - break; - case "BAK": - case 4: - message.fileType = 4; - break; - case "TDE": - case 8: - message.fileType = 8; - break; - } - if (object.csvImportOptions != null) { - if (typeof object.csvImportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.csvImportOptions: object expected"); - message.csvImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.fromObject(object.csvImportOptions); - } - if (object.importUser != null) - message.importUser = String(object.importUser); - if (object.bakImportOptions != null) { - if (typeof object.bakImportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.bakImportOptions: object expected"); - message.bakImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.fromObject(object.bakImportOptions); - } - if (object.sqlImportOptions != null) { - if (typeof object.sqlImportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.sqlImportOptions: object expected"); - message.sqlImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.fromObject(object.sqlImportOptions); - } - if (object.tdeImportOptions != null) { - if (typeof object.tdeImportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.tdeImportOptions: object expected"); - message.tdeImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.fromObject(object.tdeImportOptions); - } - return message; - }; - - /** - * Creates a plain object from an ImportContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ImportContext - * @static - * @param {google.cloud.sql.v1.ImportContext} message ImportContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.uri = ""; - object.database = ""; - object.kind = ""; - object.fileType = options.enums === String ? "SQL_FILE_TYPE_UNSPECIFIED" : 0; - object.csvImportOptions = null; - object.importUser = ""; - object.bakImportOptions = null; - object.sqlImportOptions = null; - object.tdeImportOptions = null; - } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.fileType != null && message.hasOwnProperty("fileType")) - object.fileType = options.enums === String ? $root.google.cloud.sql.v1.SqlFileType[message.fileType] === undefined ? message.fileType : $root.google.cloud.sql.v1.SqlFileType[message.fileType] : message.fileType; - if (message.csvImportOptions != null && message.hasOwnProperty("csvImportOptions")) - object.csvImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.toObject(message.csvImportOptions, options); - if (message.importUser != null && message.hasOwnProperty("importUser")) - object.importUser = message.importUser; - if (message.bakImportOptions != null && message.hasOwnProperty("bakImportOptions")) - object.bakImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.toObject(message.bakImportOptions, options); - if (message.sqlImportOptions != null && message.hasOwnProperty("sqlImportOptions")) - object.sqlImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.toObject(message.sqlImportOptions, options); - if (message.tdeImportOptions != null && message.hasOwnProperty("tdeImportOptions")) - object.tdeImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.toObject(message.tdeImportOptions, options); - return object; - }; - - /** - * Converts this ImportContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ImportContext - * @instance - * @returns {Object.} JSON object - */ - ImportContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ImportContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext"; - }; - - ImportContext.SqlImportOptions = (function() { - - /** - * Properties of a SqlImportOptions. - * @memberof google.cloud.sql.v1.ImportContext - * @interface ISqlImportOptions - * @property {google.protobuf.IInt32Value|null} [threads] SqlImportOptions threads - * @property {google.protobuf.IBoolValue|null} [parallel] SqlImportOptions parallel - * @property {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions|null} [postgresImportOptions] SqlImportOptions postgresImportOptions - */ - - /** - * Constructs a new SqlImportOptions. - * @memberof google.cloud.sql.v1.ImportContext - * @classdesc Represents a SqlImportOptions. - * @implements ISqlImportOptions - * @constructor - * @param {google.cloud.sql.v1.ImportContext.ISqlImportOptions=} [properties] Properties to set - */ - function SqlImportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlImportOptions threads. - * @member {google.protobuf.IInt32Value|null|undefined} threads - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @instance - */ - SqlImportOptions.prototype.threads = null; - - /** - * SqlImportOptions parallel. - * @member {google.protobuf.IBoolValue|null|undefined} parallel - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @instance - */ - SqlImportOptions.prototype.parallel = null; - - /** - * SqlImportOptions postgresImportOptions. - * @member {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions|null|undefined} postgresImportOptions - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @instance - */ - SqlImportOptions.prototype.postgresImportOptions = null; - - /** - * Creates a new SqlImportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlImportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions} SqlImportOptions instance - */ - SqlImportOptions.create = function create(properties) { - return new SqlImportOptions(properties); - }; - - /** - * Encodes the specified SqlImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlImportOptions} message SqlImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlImportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.threads != null && Object.hasOwnProperty.call(message, "threads")) - $root.google.protobuf.Int32Value.encode(message.threads, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.parallel != null && Object.hasOwnProperty.call(message, "parallel")) - $root.google.protobuf.BoolValue.encode(message.parallel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.postgresImportOptions != null && Object.hasOwnProperty.call(message, "postgresImportOptions")) - $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.encode(message.postgresImportOptions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlImportOptions} message SqlImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlImportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlImportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions} SqlImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlImportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlImportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.threads = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 2: { - message.parallel = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 3: { - message.postgresImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlImportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions} SqlImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlImportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlImportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlImportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.threads != null && message.hasOwnProperty("threads")) { - var error = $root.google.protobuf.Int32Value.verify(message.threads); - if (error) - return "threads." + error; - } - if (message.parallel != null && message.hasOwnProperty("parallel")) { - var error = $root.google.protobuf.BoolValue.verify(message.parallel); - if (error) - return "parallel." + error; - } - if (message.postgresImportOptions != null && message.hasOwnProperty("postgresImportOptions")) { - var error = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.verify(message.postgresImportOptions); - if (error) - return "postgresImportOptions." + error; - } - return null; - }; - - /** - * Creates a SqlImportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions} SqlImportOptions - */ - SqlImportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlImportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ImportContext.SqlImportOptions(); - if (object.threads != null) { - if (typeof object.threads !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlImportOptions.threads: object expected"); - message.threads = $root.google.protobuf.Int32Value.fromObject(object.threads); - } - if (object.parallel != null) { - if (typeof object.parallel !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlImportOptions.parallel: object expected"); - message.parallel = $root.google.protobuf.BoolValue.fromObject(object.parallel); - } - if (object.postgresImportOptions != null) { - if (typeof object.postgresImportOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlImportOptions.postgresImportOptions: object expected"); - message.postgresImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.fromObject(object.postgresImportOptions); - } - return message; - }; - - /** - * Creates a plain object from a SqlImportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions} message SqlImportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlImportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.threads = null; - object.parallel = null; - object.postgresImportOptions = null; - } - if (message.threads != null && message.hasOwnProperty("threads")) - object.threads = $root.google.protobuf.Int32Value.toObject(message.threads, options); - if (message.parallel != null && message.hasOwnProperty("parallel")) - object.parallel = $root.google.protobuf.BoolValue.toObject(message.parallel, options); - if (message.postgresImportOptions != null && message.hasOwnProperty("postgresImportOptions")) - object.postgresImportOptions = $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.toObject(message.postgresImportOptions, options); - return object; - }; - - /** - * Converts this SqlImportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlImportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlImportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlImportOptions"; - }; - - SqlImportOptions.PostgresImportOptions = (function() { - - /** - * Properties of a PostgresImportOptions. - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @interface IPostgresImportOptions - * @property {google.protobuf.IBoolValue|null} [clean] PostgresImportOptions clean - * @property {google.protobuf.IBoolValue|null} [ifExists] PostgresImportOptions ifExists - */ - - /** - * Constructs a new PostgresImportOptions. - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions - * @classdesc Represents a PostgresImportOptions. - * @implements IPostgresImportOptions - * @constructor - * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions=} [properties] Properties to set - */ - function PostgresImportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PostgresImportOptions clean. - * @member {google.protobuf.IBoolValue|null|undefined} clean - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @instance - */ - PostgresImportOptions.prototype.clean = null; - - /** - * PostgresImportOptions ifExists. - * @member {google.protobuf.IBoolValue|null|undefined} ifExists - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @instance - */ - PostgresImportOptions.prototype.ifExists = null; - - /** - * Creates a new PostgresImportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions instance - */ - PostgresImportOptions.create = function create(properties) { - return new PostgresImportOptions(properties); - }; - - /** - * Encodes the specified PostgresImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions} message PostgresImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PostgresImportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.clean != null && Object.hasOwnProperty.call(message, "clean")) - $root.google.protobuf.BoolValue.encode(message.clean, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.ifExists != null && Object.hasOwnProperty.call(message, "ifExists")) - $root.google.protobuf.BoolValue.encode(message.ifExists, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PostgresImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions.IPostgresImportOptions} message PostgresImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PostgresImportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PostgresImportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PostgresImportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.clean = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 2: { - message.ifExists = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PostgresImportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PostgresImportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PostgresImportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PostgresImportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.clean != null && message.hasOwnProperty("clean")) { - var error = $root.google.protobuf.BoolValue.verify(message.clean); - if (error) - return "clean." + error; - } - if (message.ifExists != null && message.hasOwnProperty("ifExists")) { - var error = $root.google.protobuf.BoolValue.verify(message.ifExists); - if (error) - return "ifExists." + error; - } - return null; - }; - - /** - * Creates a PostgresImportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions - */ - PostgresImportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions(); - if (object.clean != null) { - if (typeof object.clean !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.clean: object expected"); - message.clean = $root.google.protobuf.BoolValue.fromObject(object.clean); - } - if (object.ifExists != null) { - if (typeof object.ifExists !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions.ifExists: object expected"); - message.ifExists = $root.google.protobuf.BoolValue.fromObject(object.ifExists); - } - return message; - }; - - /** - * Creates a plain object from a PostgresImportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions} message PostgresImportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PostgresImportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.clean = null; - object.ifExists = null; - } - if (message.clean != null && message.hasOwnProperty("clean")) - object.clean = $root.google.protobuf.BoolValue.toObject(message.clean, options); - if (message.ifExists != null && message.hasOwnProperty("ifExists")) - object.ifExists = $root.google.protobuf.BoolValue.toObject(message.ifExists, options); - return object; - }; - - /** - * Converts this PostgresImportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @instance - * @returns {Object.} JSON object - */ - PostgresImportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PostgresImportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PostgresImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlImportOptions.PostgresImportOptions"; - }; - - return PostgresImportOptions; - })(); - - return SqlImportOptions; - })(); - - ImportContext.SqlCsvImportOptions = (function() { - - /** - * Properties of a SqlCsvImportOptions. - * @memberof google.cloud.sql.v1.ImportContext - * @interface ISqlCsvImportOptions - * @property {string|null} [table] SqlCsvImportOptions table - * @property {Array.|null} [columns] SqlCsvImportOptions columns - * @property {string|null} [escapeCharacter] SqlCsvImportOptions escapeCharacter - * @property {string|null} [quoteCharacter] SqlCsvImportOptions quoteCharacter - * @property {string|null} [fieldsTerminatedBy] SqlCsvImportOptions fieldsTerminatedBy - * @property {string|null} [linesTerminatedBy] SqlCsvImportOptions linesTerminatedBy - */ - - /** - * Constructs a new SqlCsvImportOptions. - * @memberof google.cloud.sql.v1.ImportContext - * @classdesc Represents a SqlCsvImportOptions. - * @implements ISqlCsvImportOptions - * @constructor - * @param {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions=} [properties] Properties to set - */ - function SqlCsvImportOptions(properties) { - this.columns = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlCsvImportOptions table. - * @member {string} table - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.table = ""; - - /** - * SqlCsvImportOptions columns. - * @member {Array.} columns - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.columns = $util.emptyArray; - - /** - * SqlCsvImportOptions escapeCharacter. - * @member {string} escapeCharacter - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.escapeCharacter = ""; - - /** - * SqlCsvImportOptions quoteCharacter. - * @member {string} quoteCharacter - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.quoteCharacter = ""; - - /** - * SqlCsvImportOptions fieldsTerminatedBy. - * @member {string} fieldsTerminatedBy - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.fieldsTerminatedBy = ""; - - /** - * SqlCsvImportOptions linesTerminatedBy. - * @member {string} linesTerminatedBy - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.linesTerminatedBy = ""; - - /** - * Creates a new SqlCsvImportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions instance - */ - SqlCsvImportOptions.create = function create(properties) { - return new SqlCsvImportOptions(properties); - }; - - /** - * Encodes the specified SqlCsvImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions} message SqlCsvImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlCsvImportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.table != null && Object.hasOwnProperty.call(message, "table")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.table); - if (message.columns != null && message.columns.length) - for (var i = 0; i < message.columns.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.columns[i]); - if (message.escapeCharacter != null && Object.hasOwnProperty.call(message, "escapeCharacter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.escapeCharacter); - if (message.quoteCharacter != null && Object.hasOwnProperty.call(message, "quoteCharacter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.quoteCharacter); - if (message.fieldsTerminatedBy != null && Object.hasOwnProperty.call(message, "fieldsTerminatedBy")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.fieldsTerminatedBy); - if (message.linesTerminatedBy != null && Object.hasOwnProperty.call(message, "linesTerminatedBy")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.linesTerminatedBy); - return writer; - }; - - /** - * Encodes the specified SqlCsvImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlCsvImportOptions} message SqlCsvImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlCsvImportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlCsvImportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlCsvImportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.table = reader.string(); - break; - } - case 2: { - if (!(message.columns && message.columns.length)) - message.columns = []; - message.columns.push(reader.string()); - break; - } - case 4: { - message.escapeCharacter = reader.string(); - break; - } - case 5: { - message.quoteCharacter = reader.string(); - break; - } - case 6: { - message.fieldsTerminatedBy = reader.string(); - break; - } - case 8: { - message.linesTerminatedBy = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlCsvImportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlCsvImportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlCsvImportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlCsvImportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.table != null && message.hasOwnProperty("table")) - if (!$util.isString(message.table)) - return "table: string expected"; - if (message.columns != null && message.hasOwnProperty("columns")) { - if (!Array.isArray(message.columns)) - return "columns: array expected"; - for (var i = 0; i < message.columns.length; ++i) - if (!$util.isString(message.columns[i])) - return "columns: string[] expected"; - } - if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) - if (!$util.isString(message.escapeCharacter)) - return "escapeCharacter: string expected"; - if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) - if (!$util.isString(message.quoteCharacter)) - return "quoteCharacter: string expected"; - if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) - if (!$util.isString(message.fieldsTerminatedBy)) - return "fieldsTerminatedBy: string expected"; - if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) - if (!$util.isString(message.linesTerminatedBy)) - return "linesTerminatedBy: string expected"; - return null; - }; - - /** - * Creates a SqlCsvImportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions - */ - SqlCsvImportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ImportContext.SqlCsvImportOptions(); - if (object.table != null) - message.table = String(object.table); - if (object.columns) { - if (!Array.isArray(object.columns)) - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlCsvImportOptions.columns: array expected"); - message.columns = []; - for (var i = 0; i < object.columns.length; ++i) - message.columns[i] = String(object.columns[i]); - } - if (object.escapeCharacter != null) - message.escapeCharacter = String(object.escapeCharacter); - if (object.quoteCharacter != null) - message.quoteCharacter = String(object.quoteCharacter); - if (object.fieldsTerminatedBy != null) - message.fieldsTerminatedBy = String(object.fieldsTerminatedBy); - if (object.linesTerminatedBy != null) - message.linesTerminatedBy = String(object.linesTerminatedBy); - return message; - }; - - /** - * Creates a plain object from a SqlCsvImportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlCsvImportOptions} message SqlCsvImportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlCsvImportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.columns = []; - if (options.defaults) { - object.table = ""; - object.escapeCharacter = ""; - object.quoteCharacter = ""; - object.fieldsTerminatedBy = ""; - object.linesTerminatedBy = ""; - } - if (message.table != null && message.hasOwnProperty("table")) - object.table = message.table; - if (message.columns && message.columns.length) { - object.columns = []; - for (var j = 0; j < message.columns.length; ++j) - object.columns[j] = message.columns[j]; - } - if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) - object.escapeCharacter = message.escapeCharacter; - if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) - object.quoteCharacter = message.quoteCharacter; - if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) - object.fieldsTerminatedBy = message.fieldsTerminatedBy; - if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) - object.linesTerminatedBy = message.linesTerminatedBy; - return object; - }; - - /** - * Converts this SqlCsvImportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlCsvImportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlCsvImportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ImportContext.SqlCsvImportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlCsvImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlCsvImportOptions"; - }; - - return SqlCsvImportOptions; - })(); - - ImportContext.SqlBakImportOptions = (function() { - - /** - * Properties of a SqlBakImportOptions. - * @memberof google.cloud.sql.v1.ImportContext - * @interface ISqlBakImportOptions - * @property {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions|null} [encryptionOptions] SqlBakImportOptions encryptionOptions - * @property {google.protobuf.IBoolValue|null} [striped] SqlBakImportOptions striped - * @property {google.protobuf.IBoolValue|null} [noRecovery] SqlBakImportOptions noRecovery - * @property {google.protobuf.IBoolValue|null} [recoveryOnly] SqlBakImportOptions recoveryOnly - * @property {google.cloud.sql.v1.BakType|null} [bakType] SqlBakImportOptions bakType - * @property {google.protobuf.ITimestamp|null} [stopAt] SqlBakImportOptions stopAt - * @property {string|null} [stopAtMark] SqlBakImportOptions stopAtMark - */ - - /** - * Constructs a new SqlBakImportOptions. - * @memberof google.cloud.sql.v1.ImportContext - * @classdesc Represents a SqlBakImportOptions. - * @implements ISqlBakImportOptions - * @constructor - * @param {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions=} [properties] Properties to set - */ - function SqlBakImportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBakImportOptions encryptionOptions. - * @member {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions|null|undefined} encryptionOptions - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.encryptionOptions = null; - - /** - * SqlBakImportOptions striped. - * @member {google.protobuf.IBoolValue|null|undefined} striped - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.striped = null; - - /** - * SqlBakImportOptions noRecovery. - * @member {google.protobuf.IBoolValue|null|undefined} noRecovery - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.noRecovery = null; - - /** - * SqlBakImportOptions recoveryOnly. - * @member {google.protobuf.IBoolValue|null|undefined} recoveryOnly - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.recoveryOnly = null; - - /** - * SqlBakImportOptions bakType. - * @member {google.cloud.sql.v1.BakType} bakType - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.bakType = 0; - - /** - * SqlBakImportOptions stopAt. - * @member {google.protobuf.ITimestamp|null|undefined} stopAt - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.stopAt = null; - - /** - * SqlBakImportOptions stopAtMark. - * @member {string} stopAtMark - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.stopAtMark = ""; - - /** - * Creates a new SqlBakImportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions} SqlBakImportOptions instance - */ - SqlBakImportOptions.create = function create(properties) { - return new SqlBakImportOptions(properties); - }; - - /** - * Encodes the specified SqlBakImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions} message SqlBakImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBakImportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.encryptionOptions != null && Object.hasOwnProperty.call(message, "encryptionOptions")) - $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.encode(message.encryptionOptions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.striped != null && Object.hasOwnProperty.call(message, "striped")) - $root.google.protobuf.BoolValue.encode(message.striped, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.noRecovery != null && Object.hasOwnProperty.call(message, "noRecovery")) - $root.google.protobuf.BoolValue.encode(message.noRecovery, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.recoveryOnly != null && Object.hasOwnProperty.call(message, "recoveryOnly")) - $root.google.protobuf.BoolValue.encode(message.recoveryOnly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.bakType != null && Object.hasOwnProperty.call(message, "bakType")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.bakType); - if (message.stopAt != null && Object.hasOwnProperty.call(message, "stopAt")) - $root.google.protobuf.Timestamp.encode(message.stopAt, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.stopAtMark != null && Object.hasOwnProperty.call(message, "stopAtMark")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.stopAtMark); - return writer; - }; - - /** - * Encodes the specified SqlBakImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlBakImportOptions} message SqlBakImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBakImportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBakImportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions} SqlBakImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBakImportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.encryptionOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.decode(reader, reader.uint32()); - break; - } - case 2: { - message.striped = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 4: { - message.noRecovery = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 5: { - message.recoveryOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 6: { - message.bakType = reader.int32(); - break; - } - case 7: { - message.stopAt = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 8: { - message.stopAtMark = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBakImportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions} SqlBakImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBakImportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBakImportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBakImportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.encryptionOptions != null && message.hasOwnProperty("encryptionOptions")) { - var error = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.verify(message.encryptionOptions); - if (error) - return "encryptionOptions." + error; - } - if (message.striped != null && message.hasOwnProperty("striped")) { - var error = $root.google.protobuf.BoolValue.verify(message.striped); - if (error) - return "striped." + error; - } - if (message.noRecovery != null && message.hasOwnProperty("noRecovery")) { - var error = $root.google.protobuf.BoolValue.verify(message.noRecovery); - if (error) - return "noRecovery." + error; - } - if (message.recoveryOnly != null && message.hasOwnProperty("recoveryOnly")) { - var error = $root.google.protobuf.BoolValue.verify(message.recoveryOnly); - if (error) - return "recoveryOnly." + error; - } - if (message.bakType != null && message.hasOwnProperty("bakType")) - switch (message.bakType) { - default: - return "bakType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.stopAt != null && message.hasOwnProperty("stopAt")) { - var error = $root.google.protobuf.Timestamp.verify(message.stopAt); - if (error) - return "stopAt." + error; - } - if (message.stopAtMark != null && message.hasOwnProperty("stopAtMark")) - if (!$util.isString(message.stopAtMark)) - return "stopAtMark: string expected"; - return null; - }; - - /** - * Creates a SqlBakImportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions} SqlBakImportOptions - */ - SqlBakImportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions(); - if (object.encryptionOptions != null) { - if (typeof object.encryptionOptions !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.encryptionOptions: object expected"); - message.encryptionOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.fromObject(object.encryptionOptions); - } - if (object.striped != null) { - if (typeof object.striped !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.striped: object expected"); - message.striped = $root.google.protobuf.BoolValue.fromObject(object.striped); - } - if (object.noRecovery != null) { - if (typeof object.noRecovery !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.noRecovery: object expected"); - message.noRecovery = $root.google.protobuf.BoolValue.fromObject(object.noRecovery); - } - if (object.recoveryOnly != null) { - if (typeof object.recoveryOnly !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.recoveryOnly: object expected"); - message.recoveryOnly = $root.google.protobuf.BoolValue.fromObject(object.recoveryOnly); - } - switch (object.bakType) { - default: - if (typeof object.bakType === "number") { - message.bakType = object.bakType; - break; - } - break; - case "BAK_TYPE_UNSPECIFIED": - case 0: - message.bakType = 0; - break; - case "FULL": - case 1: - message.bakType = 1; - break; - case "DIFF": - case 2: - message.bakType = 2; - break; - case "TLOG": - case 3: - message.bakType = 3; - break; - } - if (object.stopAt != null) { - if (typeof object.stopAt !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.stopAt: object expected"); - message.stopAt = $root.google.protobuf.Timestamp.fromObject(object.stopAt); - } - if (object.stopAtMark != null) - message.stopAtMark = String(object.stopAtMark); - return message; - }; - - /** - * Creates a plain object from a SqlBakImportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions} message SqlBakImportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBakImportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.encryptionOptions = null; - object.striped = null; - object.noRecovery = null; - object.recoveryOnly = null; - object.bakType = options.enums === String ? "BAK_TYPE_UNSPECIFIED" : 0; - object.stopAt = null; - object.stopAtMark = ""; - } - if (message.encryptionOptions != null && message.hasOwnProperty("encryptionOptions")) - object.encryptionOptions = $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.toObject(message.encryptionOptions, options); - if (message.striped != null && message.hasOwnProperty("striped")) - object.striped = $root.google.protobuf.BoolValue.toObject(message.striped, options); - if (message.noRecovery != null && message.hasOwnProperty("noRecovery")) - object.noRecovery = $root.google.protobuf.BoolValue.toObject(message.noRecovery, options); - if (message.recoveryOnly != null && message.hasOwnProperty("recoveryOnly")) - object.recoveryOnly = $root.google.protobuf.BoolValue.toObject(message.recoveryOnly, options); - if (message.bakType != null && message.hasOwnProperty("bakType")) - object.bakType = options.enums === String ? $root.google.cloud.sql.v1.BakType[message.bakType] === undefined ? message.bakType : $root.google.cloud.sql.v1.BakType[message.bakType] : message.bakType; - if (message.stopAt != null && message.hasOwnProperty("stopAt")) - object.stopAt = $root.google.protobuf.Timestamp.toObject(message.stopAt, options); - if (message.stopAtMark != null && message.hasOwnProperty("stopAtMark")) - object.stopAtMark = message.stopAtMark; - return object; - }; - - /** - * Converts this SqlBakImportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlBakImportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBakImportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBakImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlBakImportOptions"; - }; - - SqlBakImportOptions.EncryptionOptions = (function() { - - /** - * Properties of an EncryptionOptions. - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @interface IEncryptionOptions - * @property {string|null} [certPath] EncryptionOptions certPath - * @property {string|null} [pvkPath] EncryptionOptions pvkPath - * @property {string|null} [pvkPassword] EncryptionOptions pvkPassword - * @property {google.protobuf.IBoolValue|null} [keepEncrypted] EncryptionOptions keepEncrypted - */ - - /** - * Constructs a new EncryptionOptions. - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions - * @classdesc Represents an EncryptionOptions. - * @implements IEncryptionOptions - * @constructor - * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions=} [properties] Properties to set - */ - function EncryptionOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EncryptionOptions certPath. - * @member {string} certPath - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @instance - */ - EncryptionOptions.prototype.certPath = ""; - - /** - * EncryptionOptions pvkPath. - * @member {string} pvkPath - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @instance - */ - EncryptionOptions.prototype.pvkPath = ""; - - /** - * EncryptionOptions pvkPassword. - * @member {string} pvkPassword - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @instance - */ - EncryptionOptions.prototype.pvkPassword = ""; - - /** - * EncryptionOptions keepEncrypted. - * @member {google.protobuf.IBoolValue|null|undefined} keepEncrypted - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @instance - */ - EncryptionOptions.prototype.keepEncrypted = null; - - /** - * Creates a new EncryptionOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions instance - */ - EncryptionOptions.create = function create(properties) { - return new EncryptionOptions(properties); - }; - - /** - * Encodes the specified EncryptionOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions} message EncryptionOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EncryptionOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certPath != null && Object.hasOwnProperty.call(message, "certPath")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.certPath); - if (message.pvkPath != null && Object.hasOwnProperty.call(message, "pvkPath")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.pvkPath); - if (message.pvkPassword != null && Object.hasOwnProperty.call(message, "pvkPassword")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pvkPassword); - if (message.keepEncrypted != null && Object.hasOwnProperty.call(message, "keepEncrypted")) - $root.google.protobuf.BoolValue.encode(message.keepEncrypted, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EncryptionOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.IEncryptionOptions} message EncryptionOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EncryptionOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EncryptionOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EncryptionOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.certPath = reader.string(); - break; - } - case 2: { - message.pvkPath = reader.string(); - break; - } - case 3: { - message.pvkPassword = reader.string(); - break; - } - case 5: { - message.keepEncrypted = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EncryptionOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EncryptionOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EncryptionOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EncryptionOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certPath != null && message.hasOwnProperty("certPath")) - if (!$util.isString(message.certPath)) - return "certPath: string expected"; - if (message.pvkPath != null && message.hasOwnProperty("pvkPath")) - if (!$util.isString(message.pvkPath)) - return "pvkPath: string expected"; - if (message.pvkPassword != null && message.hasOwnProperty("pvkPassword")) - if (!$util.isString(message.pvkPassword)) - return "pvkPassword: string expected"; - if (message.keepEncrypted != null && message.hasOwnProperty("keepEncrypted")) { - var error = $root.google.protobuf.BoolValue.verify(message.keepEncrypted); - if (error) - return "keepEncrypted." + error; - } - return null; - }; - - /** - * Creates an EncryptionOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions - */ - EncryptionOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions) - return object; - var message = new $root.google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions(); - if (object.certPath != null) - message.certPath = String(object.certPath); - if (object.pvkPath != null) - message.pvkPath = String(object.pvkPath); - if (object.pvkPassword != null) - message.pvkPassword = String(object.pvkPassword); - if (object.keepEncrypted != null) { - if (typeof object.keepEncrypted !== "object") - throw TypeError(".google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions.keepEncrypted: object expected"); - message.keepEncrypted = $root.google.protobuf.BoolValue.fromObject(object.keepEncrypted); - } - return message; - }; - - /** - * Creates a plain object from an EncryptionOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions} message EncryptionOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EncryptionOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.certPath = ""; - object.pvkPath = ""; - object.pvkPassword = ""; - object.keepEncrypted = null; - } - if (message.certPath != null && message.hasOwnProperty("certPath")) - object.certPath = message.certPath; - if (message.pvkPath != null && message.hasOwnProperty("pvkPath")) - object.pvkPath = message.pvkPath; - if (message.pvkPassword != null && message.hasOwnProperty("pvkPassword")) - object.pvkPassword = message.pvkPassword; - if (message.keepEncrypted != null && message.hasOwnProperty("keepEncrypted")) - object.keepEncrypted = $root.google.protobuf.BoolValue.toObject(message.keepEncrypted, options); - return object; - }; - - /** - * Converts this EncryptionOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @instance - * @returns {Object.} JSON object - */ - EncryptionOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EncryptionOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EncryptionOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlBakImportOptions.EncryptionOptions"; - }; - - return EncryptionOptions; - })(); - - return SqlBakImportOptions; - })(); - - ImportContext.SqlTdeImportOptions = (function() { - - /** - * Properties of a SqlTdeImportOptions. - * @memberof google.cloud.sql.v1.ImportContext - * @interface ISqlTdeImportOptions - * @property {string|null} [certificatePath] SqlTdeImportOptions certificatePath - * @property {string|null} [privateKeyPath] SqlTdeImportOptions privateKeyPath - * @property {string|null} [privateKeyPassword] SqlTdeImportOptions privateKeyPassword - * @property {string|null} [name] SqlTdeImportOptions name - */ - - /** - * Constructs a new SqlTdeImportOptions. - * @memberof google.cloud.sql.v1.ImportContext - * @classdesc Represents a SqlTdeImportOptions. - * @implements ISqlTdeImportOptions - * @constructor - * @param {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions=} [properties] Properties to set - */ - function SqlTdeImportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlTdeImportOptions certificatePath. - * @member {string} certificatePath - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @instance - */ - SqlTdeImportOptions.prototype.certificatePath = ""; - - /** - * SqlTdeImportOptions privateKeyPath. - * @member {string} privateKeyPath - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @instance - */ - SqlTdeImportOptions.prototype.privateKeyPath = ""; - - /** - * SqlTdeImportOptions privateKeyPassword. - * @member {string} privateKeyPassword - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @instance - */ - SqlTdeImportOptions.prototype.privateKeyPassword = ""; - - /** - * SqlTdeImportOptions name. - * @member {string} name - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @instance - */ - SqlTdeImportOptions.prototype.name = ""; - - /** - * Creates a new SqlTdeImportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions instance - */ - SqlTdeImportOptions.create = function create(properties) { - return new SqlTdeImportOptions(properties); - }; - - /** - * Encodes the specified SqlTdeImportOptions message. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions} message SqlTdeImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTdeImportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certificatePath != null && Object.hasOwnProperty.call(message, "certificatePath")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.certificatePath); - if (message.privateKeyPath != null && Object.hasOwnProperty.call(message, "privateKeyPath")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateKeyPath); - if (message.privateKeyPassword != null && Object.hasOwnProperty.call(message, "privateKeyPassword")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.privateKeyPassword); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); - return writer; - }; - - /** - * Encodes the specified SqlTdeImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ImportContext.SqlTdeImportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.ISqlTdeImportOptions} message SqlTdeImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTdeImportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlTdeImportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTdeImportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.certificatePath = reader.string(); - break; - } - case 2: { - message.privateKeyPath = reader.string(); - break; - } - case 3: { - message.privateKeyPassword = reader.string(); - break; - } - case 5: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlTdeImportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTdeImportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlTdeImportOptions message. - * @function verify - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlTdeImportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) - if (!$util.isString(message.certificatePath)) - return "certificatePath: string expected"; - if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) - if (!$util.isString(message.privateKeyPath)) - return "privateKeyPath: string expected"; - if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) - if (!$util.isString(message.privateKeyPassword)) - return "privateKeyPassword: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a SqlTdeImportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions - */ - SqlTdeImportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions) - return object; - var message = new $root.google.cloud.sql.v1.ImportContext.SqlTdeImportOptions(); - if (object.certificatePath != null) - message.certificatePath = String(object.certificatePath); - if (object.privateKeyPath != null) - message.privateKeyPath = String(object.privateKeyPath); - if (object.privateKeyPassword != null) - message.privateKeyPassword = String(object.privateKeyPassword); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a SqlTdeImportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @static - * @param {google.cloud.sql.v1.ImportContext.SqlTdeImportOptions} message SqlTdeImportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlTdeImportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.certificatePath = ""; - object.privateKeyPath = ""; - object.privateKeyPassword = ""; - object.name = ""; - } - if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) - object.certificatePath = message.certificatePath; - if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) - object.privateKeyPath = message.privateKeyPath; - if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) - object.privateKeyPassword = message.privateKeyPassword; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this SqlTdeImportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlTdeImportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlTdeImportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ImportContext.SqlTdeImportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlTdeImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ImportContext.SqlTdeImportOptions"; - }; - - return SqlTdeImportOptions; - })(); - - return ImportContext; - })(); - - /** - * BakType enum. - * @name google.cloud.sql.v1.BakType - * @enum {number} - * @property {number} BAK_TYPE_UNSPECIFIED=0 BAK_TYPE_UNSPECIFIED value - * @property {number} FULL=1 FULL value - * @property {number} DIFF=2 DIFF value - * @property {number} TLOG=3 TLOG value - */ - v1.BakType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BAK_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FULL"] = 1; - values[valuesById[2] = "DIFF"] = 2; - values[valuesById[3] = "TLOG"] = 3; - return values; - })(); - - v1.IpConfiguration = (function() { - - /** - * Properties of an IpConfiguration. - * @memberof google.cloud.sql.v1 - * @interface IIpConfiguration - * @property {google.protobuf.IBoolValue|null} [ipv4Enabled] IpConfiguration ipv4Enabled - * @property {string|null} [privateNetwork] IpConfiguration privateNetwork - * @property {google.protobuf.IBoolValue|null} [requireSsl] IpConfiguration requireSsl - * @property {Array.|null} [authorizedNetworks] IpConfiguration authorizedNetworks - * @property {string|null} [allocatedIpRange] IpConfiguration allocatedIpRange - * @property {google.protobuf.IBoolValue|null} [enablePrivatePathForGoogleCloudServices] IpConfiguration enablePrivatePathForGoogleCloudServices - * @property {google.cloud.sql.v1.IpConfiguration.SslMode|null} [sslMode] IpConfiguration sslMode - * @property {google.cloud.sql.v1.IPscConfig|null} [pscConfig] IpConfiguration pscConfig - * @property {google.cloud.sql.v1.IpConfiguration.CaMode|null} [serverCaMode] IpConfiguration serverCaMode - * @property {Array.|null} [customSubjectAlternativeNames] IpConfiguration customSubjectAlternativeNames - * @property {string|null} [serverCaPool] IpConfiguration serverCaPool - * @property {google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|null} [serverCertificateRotationMode] IpConfiguration serverCertificateRotationMode - */ - - /** - * Constructs a new IpConfiguration. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an IpConfiguration. - * @implements IIpConfiguration - * @constructor - * @param {google.cloud.sql.v1.IIpConfiguration=} [properties] Properties to set - */ - function IpConfiguration(properties) { - this.authorizedNetworks = []; - this.customSubjectAlternativeNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IpConfiguration ipv4Enabled. - * @member {google.protobuf.IBoolValue|null|undefined} ipv4Enabled - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.ipv4Enabled = null; - - /** - * IpConfiguration privateNetwork. - * @member {string} privateNetwork - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.privateNetwork = ""; - - /** - * IpConfiguration requireSsl. - * @member {google.protobuf.IBoolValue|null|undefined} requireSsl - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.requireSsl = null; - - /** - * IpConfiguration authorizedNetworks. - * @member {Array.} authorizedNetworks - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.authorizedNetworks = $util.emptyArray; - - /** - * IpConfiguration allocatedIpRange. - * @member {string} allocatedIpRange - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.allocatedIpRange = ""; - - /** - * IpConfiguration enablePrivatePathForGoogleCloudServices. - * @member {google.protobuf.IBoolValue|null|undefined} enablePrivatePathForGoogleCloudServices - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.enablePrivatePathForGoogleCloudServices = null; - - /** - * IpConfiguration sslMode. - * @member {google.cloud.sql.v1.IpConfiguration.SslMode} sslMode - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.sslMode = 0; - - /** - * IpConfiguration pscConfig. - * @member {google.cloud.sql.v1.IPscConfig|null|undefined} pscConfig - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.pscConfig = null; - - /** - * IpConfiguration serverCaMode. - * @member {google.cloud.sql.v1.IpConfiguration.CaMode|null|undefined} serverCaMode - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.serverCaMode = null; - - /** - * IpConfiguration customSubjectAlternativeNames. - * @member {Array.} customSubjectAlternativeNames - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.customSubjectAlternativeNames = $util.emptyArray; - - /** - * IpConfiguration serverCaPool. - * @member {string|null|undefined} serverCaPool - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.serverCaPool = null; - - /** - * IpConfiguration serverCertificateRotationMode. - * @member {google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode|null|undefined} serverCertificateRotationMode - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - */ - IpConfiguration.prototype.serverCertificateRotationMode = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(IpConfiguration.prototype, "_pscConfig", { - get: $util.oneOfGetter($oneOfFields = ["pscConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(IpConfiguration.prototype, "_serverCaMode", { - get: $util.oneOfGetter($oneOfFields = ["serverCaMode"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(IpConfiguration.prototype, "_serverCaPool", { - get: $util.oneOfGetter($oneOfFields = ["serverCaPool"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(IpConfiguration.prototype, "_serverCertificateRotationMode", { - get: $util.oneOfGetter($oneOfFields = ["serverCertificateRotationMode"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new IpConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.IpConfiguration - * @static - * @param {google.cloud.sql.v1.IIpConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1.IpConfiguration} IpConfiguration instance - */ - IpConfiguration.create = function create(properties) { - return new IpConfiguration(properties); - }; - - /** - * Encodes the specified IpConfiguration message. Does not implicitly {@link google.cloud.sql.v1.IpConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.IpConfiguration - * @static - * @param {google.cloud.sql.v1.IIpConfiguration} message IpConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IpConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ipv4Enabled != null && Object.hasOwnProperty.call(message, "ipv4Enabled")) - $root.google.protobuf.BoolValue.encode(message.ipv4Enabled, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.privateNetwork != null && Object.hasOwnProperty.call(message, "privateNetwork")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateNetwork); - if (message.requireSsl != null && Object.hasOwnProperty.call(message, "requireSsl")) - $root.google.protobuf.BoolValue.encode(message.requireSsl, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.authorizedNetworks != null && message.authorizedNetworks.length) - for (var i = 0; i < message.authorizedNetworks.length; ++i) - $root.google.cloud.sql.v1.AclEntry.encode(message.authorizedNetworks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.allocatedIpRange); - if (message.enablePrivatePathForGoogleCloudServices != null && Object.hasOwnProperty.call(message, "enablePrivatePathForGoogleCloudServices")) - $root.google.protobuf.BoolValue.encode(message.enablePrivatePathForGoogleCloudServices, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.sslMode != null && Object.hasOwnProperty.call(message, "sslMode")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.sslMode); - if (message.pscConfig != null && Object.hasOwnProperty.call(message, "pscConfig")) - $root.google.cloud.sql.v1.PscConfig.encode(message.pscConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.serverCaMode != null && Object.hasOwnProperty.call(message, "serverCaMode")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.serverCaMode); - if (message.customSubjectAlternativeNames != null && message.customSubjectAlternativeNames.length) - for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.customSubjectAlternativeNames[i]); - if (message.serverCaPool != null && Object.hasOwnProperty.call(message, "serverCaPool")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.serverCaPool); - if (message.serverCertificateRotationMode != null && Object.hasOwnProperty.call(message, "serverCertificateRotationMode")) - writer.uint32(/* id 16, wireType 0 =*/128).int32(message.serverCertificateRotationMode); - return writer; - }; - - /** - * Encodes the specified IpConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.IpConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.IpConfiguration - * @static - * @param {google.cloud.sql.v1.IIpConfiguration} message IpConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IpConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IpConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.IpConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.IpConfiguration} IpConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IpConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.IpConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.ipv4Enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 2: { - message.privateNetwork = reader.string(); - break; - } - case 3: { - message.requireSsl = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 4: { - if (!(message.authorizedNetworks && message.authorizedNetworks.length)) - message.authorizedNetworks = []; - message.authorizedNetworks.push($root.google.cloud.sql.v1.AclEntry.decode(reader, reader.uint32())); - break; - } - case 6: { - message.allocatedIpRange = reader.string(); - break; - } - case 7: { - message.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 8: { - message.sslMode = reader.int32(); - break; - } - case 9: { - message.pscConfig = $root.google.cloud.sql.v1.PscConfig.decode(reader, reader.uint32()); - break; - } - case 10: { - message.serverCaMode = reader.int32(); - break; - } - case 11: { - if (!(message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length)) - message.customSubjectAlternativeNames = []; - message.customSubjectAlternativeNames.push(reader.string()); - break; - } - case 12: { - message.serverCaPool = reader.string(); - break; - } - case 16: { - message.serverCertificateRotationMode = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IpConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.IpConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.IpConfiguration} IpConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IpConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IpConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1.IpConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IpConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.ipv4Enabled != null && message.hasOwnProperty("ipv4Enabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.ipv4Enabled); - if (error) - return "ipv4Enabled." + error; - } - if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) - if (!$util.isString(message.privateNetwork)) - return "privateNetwork: string expected"; - if (message.requireSsl != null && message.hasOwnProperty("requireSsl")) { - var error = $root.google.protobuf.BoolValue.verify(message.requireSsl); - if (error) - return "requireSsl." + error; - } - if (message.authorizedNetworks != null && message.hasOwnProperty("authorizedNetworks")) { - if (!Array.isArray(message.authorizedNetworks)) - return "authorizedNetworks: array expected"; - for (var i = 0; i < message.authorizedNetworks.length; ++i) { - var error = $root.google.cloud.sql.v1.AclEntry.verify(message.authorizedNetworks[i]); - if (error) - return "authorizedNetworks." + error; - } - } - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) - if (!$util.isString(message.allocatedIpRange)) - return "allocatedIpRange: string expected"; - if (message.enablePrivatePathForGoogleCloudServices != null && message.hasOwnProperty("enablePrivatePathForGoogleCloudServices")) { - var error = $root.google.protobuf.BoolValue.verify(message.enablePrivatePathForGoogleCloudServices); - if (error) - return "enablePrivatePathForGoogleCloudServices." + error; - } - if (message.sslMode != null && message.hasOwnProperty("sslMode")) - switch (message.sslMode) { - default: - return "sslMode: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.pscConfig != null && message.hasOwnProperty("pscConfig")) { - properties._pscConfig = 1; - { - var error = $root.google.cloud.sql.v1.PscConfig.verify(message.pscConfig); - if (error) - return "pscConfig." + error; - } - } - if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) { - properties._serverCaMode = 1; - switch (message.serverCaMode) { - default: - return "serverCaMode: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - } - if (message.customSubjectAlternativeNames != null && message.hasOwnProperty("customSubjectAlternativeNames")) { - if (!Array.isArray(message.customSubjectAlternativeNames)) - return "customSubjectAlternativeNames: array expected"; - for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) - if (!$util.isString(message.customSubjectAlternativeNames[i])) - return "customSubjectAlternativeNames: string[] expected"; - } - if (message.serverCaPool != null && message.hasOwnProperty("serverCaPool")) { - properties._serverCaPool = 1; - if (!$util.isString(message.serverCaPool)) - return "serverCaPool: string expected"; - } - if (message.serverCertificateRotationMode != null && message.hasOwnProperty("serverCertificateRotationMode")) { - properties._serverCertificateRotationMode = 1; - switch (message.serverCertificateRotationMode) { - default: - return "serverCertificateRotationMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - return null; - }; - - /** - * Creates an IpConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.IpConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.IpConfiguration} IpConfiguration - */ - IpConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.IpConfiguration) - return object; - var message = new $root.google.cloud.sql.v1.IpConfiguration(); - if (object.ipv4Enabled != null) { - if (typeof object.ipv4Enabled !== "object") - throw TypeError(".google.cloud.sql.v1.IpConfiguration.ipv4Enabled: object expected"); - message.ipv4Enabled = $root.google.protobuf.BoolValue.fromObject(object.ipv4Enabled); - } - if (object.privateNetwork != null) - message.privateNetwork = String(object.privateNetwork); - if (object.requireSsl != null) { - if (typeof object.requireSsl !== "object") - throw TypeError(".google.cloud.sql.v1.IpConfiguration.requireSsl: object expected"); - message.requireSsl = $root.google.protobuf.BoolValue.fromObject(object.requireSsl); - } - if (object.authorizedNetworks) { - if (!Array.isArray(object.authorizedNetworks)) - throw TypeError(".google.cloud.sql.v1.IpConfiguration.authorizedNetworks: array expected"); - message.authorizedNetworks = []; - for (var i = 0; i < object.authorizedNetworks.length; ++i) { - if (typeof object.authorizedNetworks[i] !== "object") - throw TypeError(".google.cloud.sql.v1.IpConfiguration.authorizedNetworks: object expected"); - message.authorizedNetworks[i] = $root.google.cloud.sql.v1.AclEntry.fromObject(object.authorizedNetworks[i]); - } - } - if (object.allocatedIpRange != null) - message.allocatedIpRange = String(object.allocatedIpRange); - if (object.enablePrivatePathForGoogleCloudServices != null) { - if (typeof object.enablePrivatePathForGoogleCloudServices !== "object") - throw TypeError(".google.cloud.sql.v1.IpConfiguration.enablePrivatePathForGoogleCloudServices: object expected"); - message.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.fromObject(object.enablePrivatePathForGoogleCloudServices); - } - switch (object.sslMode) { - default: - if (typeof object.sslMode === "number") { - message.sslMode = object.sslMode; - break; - } - break; - case "SSL_MODE_UNSPECIFIED": - case 0: - message.sslMode = 0; - break; - case "ALLOW_UNENCRYPTED_AND_ENCRYPTED": - case 1: - message.sslMode = 1; - break; - case "ENCRYPTED_ONLY": - case 2: - message.sslMode = 2; - break; - case "TRUSTED_CLIENT_CERTIFICATE_REQUIRED": - case 3: - message.sslMode = 3; - break; - } - if (object.pscConfig != null) { - if (typeof object.pscConfig !== "object") - throw TypeError(".google.cloud.sql.v1.IpConfiguration.pscConfig: object expected"); - message.pscConfig = $root.google.cloud.sql.v1.PscConfig.fromObject(object.pscConfig); - } - switch (object.serverCaMode) { - default: - if (typeof object.serverCaMode === "number") { - message.serverCaMode = object.serverCaMode; - break; - } - break; - case "CA_MODE_UNSPECIFIED": - case 0: - message.serverCaMode = 0; - break; - case "GOOGLE_MANAGED_INTERNAL_CA": - case 1: - message.serverCaMode = 1; - break; - case "GOOGLE_MANAGED_CAS_CA": - case 2: - message.serverCaMode = 2; - break; - case "CUSTOMER_MANAGED_CAS_CA": - case 3: - message.serverCaMode = 3; - break; - } - if (object.customSubjectAlternativeNames) { - if (!Array.isArray(object.customSubjectAlternativeNames)) - throw TypeError(".google.cloud.sql.v1.IpConfiguration.customSubjectAlternativeNames: array expected"); - message.customSubjectAlternativeNames = []; - for (var i = 0; i < object.customSubjectAlternativeNames.length; ++i) - message.customSubjectAlternativeNames[i] = String(object.customSubjectAlternativeNames[i]); - } - if (object.serverCaPool != null) - message.serverCaPool = String(object.serverCaPool); - switch (object.serverCertificateRotationMode) { - default: - if (typeof object.serverCertificateRotationMode === "number") { - message.serverCertificateRotationMode = object.serverCertificateRotationMode; - break; - } - break; - case "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED": - case 0: - message.serverCertificateRotationMode = 0; - break; - case "NO_AUTOMATIC_ROTATION": - case 1: - message.serverCertificateRotationMode = 1; - break; - case "AUTOMATIC_ROTATION_DURING_MAINTENANCE": - case 2: - message.serverCertificateRotationMode = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from an IpConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.IpConfiguration - * @static - * @param {google.cloud.sql.v1.IpConfiguration} message IpConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IpConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.authorizedNetworks = []; - object.customSubjectAlternativeNames = []; - } - if (options.defaults) { - object.ipv4Enabled = null; - object.privateNetwork = ""; - object.requireSsl = null; - object.allocatedIpRange = ""; - object.enablePrivatePathForGoogleCloudServices = null; - object.sslMode = options.enums === String ? "SSL_MODE_UNSPECIFIED" : 0; - } - if (message.ipv4Enabled != null && message.hasOwnProperty("ipv4Enabled")) - object.ipv4Enabled = $root.google.protobuf.BoolValue.toObject(message.ipv4Enabled, options); - if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) - object.privateNetwork = message.privateNetwork; - if (message.requireSsl != null && message.hasOwnProperty("requireSsl")) - object.requireSsl = $root.google.protobuf.BoolValue.toObject(message.requireSsl, options); - if (message.authorizedNetworks && message.authorizedNetworks.length) { - object.authorizedNetworks = []; - for (var j = 0; j < message.authorizedNetworks.length; ++j) - object.authorizedNetworks[j] = $root.google.cloud.sql.v1.AclEntry.toObject(message.authorizedNetworks[j], options); - } - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) - object.allocatedIpRange = message.allocatedIpRange; - if (message.enablePrivatePathForGoogleCloudServices != null && message.hasOwnProperty("enablePrivatePathForGoogleCloudServices")) - object.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.toObject(message.enablePrivatePathForGoogleCloudServices, options); - if (message.sslMode != null && message.hasOwnProperty("sslMode")) - object.sslMode = options.enums === String ? $root.google.cloud.sql.v1.IpConfiguration.SslMode[message.sslMode] === undefined ? message.sslMode : $root.google.cloud.sql.v1.IpConfiguration.SslMode[message.sslMode] : message.sslMode; - if (message.pscConfig != null && message.hasOwnProperty("pscConfig")) { - object.pscConfig = $root.google.cloud.sql.v1.PscConfig.toObject(message.pscConfig, options); - if (options.oneofs) - object._pscConfig = "pscConfig"; - } - if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) { - object.serverCaMode = options.enums === String ? $root.google.cloud.sql.v1.IpConfiguration.CaMode[message.serverCaMode] === undefined ? message.serverCaMode : $root.google.cloud.sql.v1.IpConfiguration.CaMode[message.serverCaMode] : message.serverCaMode; - if (options.oneofs) - object._serverCaMode = "serverCaMode"; - } - if (message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length) { - object.customSubjectAlternativeNames = []; - for (var j = 0; j < message.customSubjectAlternativeNames.length; ++j) - object.customSubjectAlternativeNames[j] = message.customSubjectAlternativeNames[j]; - } - if (message.serverCaPool != null && message.hasOwnProperty("serverCaPool")) { - object.serverCaPool = message.serverCaPool; - if (options.oneofs) - object._serverCaPool = "serverCaPool"; - } - if (message.serverCertificateRotationMode != null && message.hasOwnProperty("serverCertificateRotationMode")) { - object.serverCertificateRotationMode = options.enums === String ? $root.google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode[message.serverCertificateRotationMode] === undefined ? message.serverCertificateRotationMode : $root.google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode[message.serverCertificateRotationMode] : message.serverCertificateRotationMode; - if (options.oneofs) - object._serverCertificateRotationMode = "serverCertificateRotationMode"; - } - return object; - }; - - /** - * Converts this IpConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.IpConfiguration - * @instance - * @returns {Object.} JSON object - */ - IpConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for IpConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1.IpConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - IpConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.IpConfiguration"; - }; - - /** - * SslMode enum. - * @name google.cloud.sql.v1.IpConfiguration.SslMode - * @enum {number} - * @property {number} SSL_MODE_UNSPECIFIED=0 SSL_MODE_UNSPECIFIED value - * @property {number} ALLOW_UNENCRYPTED_AND_ENCRYPTED=1 ALLOW_UNENCRYPTED_AND_ENCRYPTED value - * @property {number} ENCRYPTED_ONLY=2 ENCRYPTED_ONLY value - * @property {number} TRUSTED_CLIENT_CERTIFICATE_REQUIRED=3 TRUSTED_CLIENT_CERTIFICATE_REQUIRED value - */ - IpConfiguration.SslMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SSL_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ALLOW_UNENCRYPTED_AND_ENCRYPTED"] = 1; - values[valuesById[2] = "ENCRYPTED_ONLY"] = 2; - values[valuesById[3] = "TRUSTED_CLIENT_CERTIFICATE_REQUIRED"] = 3; - return values; - })(); - - /** - * CaMode enum. - * @name google.cloud.sql.v1.IpConfiguration.CaMode - * @enum {number} - * @property {number} CA_MODE_UNSPECIFIED=0 CA_MODE_UNSPECIFIED value - * @property {number} GOOGLE_MANAGED_INTERNAL_CA=1 GOOGLE_MANAGED_INTERNAL_CA value - * @property {number} GOOGLE_MANAGED_CAS_CA=2 GOOGLE_MANAGED_CAS_CA value - * @property {number} CUSTOMER_MANAGED_CAS_CA=3 CUSTOMER_MANAGED_CAS_CA value - */ - IpConfiguration.CaMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CA_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "GOOGLE_MANAGED_INTERNAL_CA"] = 1; - values[valuesById[2] = "GOOGLE_MANAGED_CAS_CA"] = 2; - values[valuesById[3] = "CUSTOMER_MANAGED_CAS_CA"] = 3; - return values; - })(); - - /** - * ServerCertificateRotationMode enum. - * @name google.cloud.sql.v1.IpConfiguration.ServerCertificateRotationMode - * @enum {number} - * @property {number} SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED=0 SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED value - * @property {number} NO_AUTOMATIC_ROTATION=1 NO_AUTOMATIC_ROTATION value - * @property {number} AUTOMATIC_ROTATION_DURING_MAINTENANCE=2 AUTOMATIC_ROTATION_DURING_MAINTENANCE value - */ - IpConfiguration.ServerCertificateRotationMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "NO_AUTOMATIC_ROTATION"] = 1; - values[valuesById[2] = "AUTOMATIC_ROTATION_DURING_MAINTENANCE"] = 2; - return values; - })(); - - return IpConfiguration; - })(); - - v1.PscConfig = (function() { - - /** - * Properties of a PscConfig. - * @memberof google.cloud.sql.v1 - * @interface IPscConfig - * @property {boolean|null} [pscEnabled] PscConfig pscEnabled - * @property {Array.|null} [allowedConsumerProjects] PscConfig allowedConsumerProjects - * @property {Array.|null} [pscAutoConnections] PscConfig pscAutoConnections - * @property {string|null} [networkAttachmentUri] PscConfig networkAttachmentUri - * @property {boolean|null} [pscAutoDnsEnabled] PscConfig pscAutoDnsEnabled - * @property {boolean|null} [pscWriteEndpointDnsEnabled] PscConfig pscWriteEndpointDnsEnabled - */ - - /** - * Constructs a new PscConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a PscConfig. - * @implements IPscConfig - * @constructor - * @param {google.cloud.sql.v1.IPscConfig=} [properties] Properties to set - */ - function PscConfig(properties) { - this.allowedConsumerProjects = []; - this.pscAutoConnections = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PscConfig pscEnabled. - * @member {boolean|null|undefined} pscEnabled - * @memberof google.cloud.sql.v1.PscConfig - * @instance - */ - PscConfig.prototype.pscEnabled = null; - - /** - * PscConfig allowedConsumerProjects. - * @member {Array.} allowedConsumerProjects - * @memberof google.cloud.sql.v1.PscConfig - * @instance - */ - PscConfig.prototype.allowedConsumerProjects = $util.emptyArray; - - /** - * PscConfig pscAutoConnections. - * @member {Array.} pscAutoConnections - * @memberof google.cloud.sql.v1.PscConfig - * @instance - */ - PscConfig.prototype.pscAutoConnections = $util.emptyArray; - - /** - * PscConfig networkAttachmentUri. - * @member {string} networkAttachmentUri - * @memberof google.cloud.sql.v1.PscConfig - * @instance - */ - PscConfig.prototype.networkAttachmentUri = ""; - - /** - * PscConfig pscAutoDnsEnabled. - * @member {boolean|null|undefined} pscAutoDnsEnabled - * @memberof google.cloud.sql.v1.PscConfig - * @instance - */ - PscConfig.prototype.pscAutoDnsEnabled = null; - - /** - * PscConfig pscWriteEndpointDnsEnabled. - * @member {boolean|null|undefined} pscWriteEndpointDnsEnabled - * @memberof google.cloud.sql.v1.PscConfig - * @instance - */ - PscConfig.prototype.pscWriteEndpointDnsEnabled = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PscConfig.prototype, "_pscEnabled", { - get: $util.oneOfGetter($oneOfFields = ["pscEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PscConfig.prototype, "_pscAutoDnsEnabled", { - get: $util.oneOfGetter($oneOfFields = ["pscAutoDnsEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PscConfig.prototype, "_pscWriteEndpointDnsEnabled", { - get: $util.oneOfGetter($oneOfFields = ["pscWriteEndpointDnsEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PscConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.PscConfig - * @static - * @param {google.cloud.sql.v1.IPscConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.PscConfig} PscConfig instance - */ - PscConfig.create = function create(properties) { - return new PscConfig(properties); - }; - - /** - * Encodes the specified PscConfig message. Does not implicitly {@link google.cloud.sql.v1.PscConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.PscConfig - * @static - * @param {google.cloud.sql.v1.IPscConfig} message PscConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PscConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pscEnabled != null && Object.hasOwnProperty.call(message, "pscEnabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.pscEnabled); - if (message.allowedConsumerProjects != null && message.allowedConsumerProjects.length) - for (var i = 0; i < message.allowedConsumerProjects.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.allowedConsumerProjects[i]); - if (message.pscAutoConnections != null && message.pscAutoConnections.length) - for (var i = 0; i < message.pscAutoConnections.length; ++i) - $root.google.cloud.sql.v1.PscAutoConnectionConfig.encode(message.pscAutoConnections[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.networkAttachmentUri != null && Object.hasOwnProperty.call(message, "networkAttachmentUri")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.networkAttachmentUri); - if (message.pscAutoDnsEnabled != null && Object.hasOwnProperty.call(message, "pscAutoDnsEnabled")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.pscAutoDnsEnabled); - if (message.pscWriteEndpointDnsEnabled != null && Object.hasOwnProperty.call(message, "pscWriteEndpointDnsEnabled")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.pscWriteEndpointDnsEnabled); - return writer; - }; - - /** - * Encodes the specified PscConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PscConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.PscConfig - * @static - * @param {google.cloud.sql.v1.IPscConfig} message PscConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PscConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PscConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.PscConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.PscConfig} PscConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PscConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PscConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.pscEnabled = reader.bool(); - break; - } - case 2: { - if (!(message.allowedConsumerProjects && message.allowedConsumerProjects.length)) - message.allowedConsumerProjects = []; - message.allowedConsumerProjects.push(reader.string()); - break; - } - case 3: { - if (!(message.pscAutoConnections && message.pscAutoConnections.length)) - message.pscAutoConnections = []; - message.pscAutoConnections.push($root.google.cloud.sql.v1.PscAutoConnectionConfig.decode(reader, reader.uint32())); - break; - } - case 4: { - message.networkAttachmentUri = reader.string(); - break; - } - case 5: { - message.pscAutoDnsEnabled = reader.bool(); - break; - } - case 6: { - message.pscWriteEndpointDnsEnabled = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PscConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.PscConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.PscConfig} PscConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PscConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PscConfig message. - * @function verify - * @memberof google.cloud.sql.v1.PscConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PscConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) { - properties._pscEnabled = 1; - if (typeof message.pscEnabled !== "boolean") - return "pscEnabled: boolean expected"; - } - if (message.allowedConsumerProjects != null && message.hasOwnProperty("allowedConsumerProjects")) { - if (!Array.isArray(message.allowedConsumerProjects)) - return "allowedConsumerProjects: array expected"; - for (var i = 0; i < message.allowedConsumerProjects.length; ++i) - if (!$util.isString(message.allowedConsumerProjects[i])) - return "allowedConsumerProjects: string[] expected"; - } - if (message.pscAutoConnections != null && message.hasOwnProperty("pscAutoConnections")) { - if (!Array.isArray(message.pscAutoConnections)) - return "pscAutoConnections: array expected"; - for (var i = 0; i < message.pscAutoConnections.length; ++i) { - var error = $root.google.cloud.sql.v1.PscAutoConnectionConfig.verify(message.pscAutoConnections[i]); - if (error) - return "pscAutoConnections." + error; - } - } - if (message.networkAttachmentUri != null && message.hasOwnProperty("networkAttachmentUri")) - if (!$util.isString(message.networkAttachmentUri)) - return "networkAttachmentUri: string expected"; - if (message.pscAutoDnsEnabled != null && message.hasOwnProperty("pscAutoDnsEnabled")) { - properties._pscAutoDnsEnabled = 1; - if (typeof message.pscAutoDnsEnabled !== "boolean") - return "pscAutoDnsEnabled: boolean expected"; - } - if (message.pscWriteEndpointDnsEnabled != null && message.hasOwnProperty("pscWriteEndpointDnsEnabled")) { - properties._pscWriteEndpointDnsEnabled = 1; - if (typeof message.pscWriteEndpointDnsEnabled !== "boolean") - return "pscWriteEndpointDnsEnabled: boolean expected"; - } - return null; - }; - - /** - * Creates a PscConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.PscConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.PscConfig} PscConfig - */ - PscConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.PscConfig) - return object; - var message = new $root.google.cloud.sql.v1.PscConfig(); - if (object.pscEnabled != null) - message.pscEnabled = Boolean(object.pscEnabled); - if (object.allowedConsumerProjects) { - if (!Array.isArray(object.allowedConsumerProjects)) - throw TypeError(".google.cloud.sql.v1.PscConfig.allowedConsumerProjects: array expected"); - message.allowedConsumerProjects = []; - for (var i = 0; i < object.allowedConsumerProjects.length; ++i) - message.allowedConsumerProjects[i] = String(object.allowedConsumerProjects[i]); - } - if (object.pscAutoConnections) { - if (!Array.isArray(object.pscAutoConnections)) - throw TypeError(".google.cloud.sql.v1.PscConfig.pscAutoConnections: array expected"); - message.pscAutoConnections = []; - for (var i = 0; i < object.pscAutoConnections.length; ++i) { - if (typeof object.pscAutoConnections[i] !== "object") - throw TypeError(".google.cloud.sql.v1.PscConfig.pscAutoConnections: object expected"); - message.pscAutoConnections[i] = $root.google.cloud.sql.v1.PscAutoConnectionConfig.fromObject(object.pscAutoConnections[i]); - } - } - if (object.networkAttachmentUri != null) - message.networkAttachmentUri = String(object.networkAttachmentUri); - if (object.pscAutoDnsEnabled != null) - message.pscAutoDnsEnabled = Boolean(object.pscAutoDnsEnabled); - if (object.pscWriteEndpointDnsEnabled != null) - message.pscWriteEndpointDnsEnabled = Boolean(object.pscWriteEndpointDnsEnabled); - return message; - }; - - /** - * Creates a plain object from a PscConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.PscConfig - * @static - * @param {google.cloud.sql.v1.PscConfig} message PscConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PscConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.allowedConsumerProjects = []; - object.pscAutoConnections = []; - } - if (options.defaults) - object.networkAttachmentUri = ""; - if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) { - object.pscEnabled = message.pscEnabled; - if (options.oneofs) - object._pscEnabled = "pscEnabled"; - } - if (message.allowedConsumerProjects && message.allowedConsumerProjects.length) { - object.allowedConsumerProjects = []; - for (var j = 0; j < message.allowedConsumerProjects.length; ++j) - object.allowedConsumerProjects[j] = message.allowedConsumerProjects[j]; - } - if (message.pscAutoConnections && message.pscAutoConnections.length) { - object.pscAutoConnections = []; - for (var j = 0; j < message.pscAutoConnections.length; ++j) - object.pscAutoConnections[j] = $root.google.cloud.sql.v1.PscAutoConnectionConfig.toObject(message.pscAutoConnections[j], options); - } - if (message.networkAttachmentUri != null && message.hasOwnProperty("networkAttachmentUri")) - object.networkAttachmentUri = message.networkAttachmentUri; - if (message.pscAutoDnsEnabled != null && message.hasOwnProperty("pscAutoDnsEnabled")) { - object.pscAutoDnsEnabled = message.pscAutoDnsEnabled; - if (options.oneofs) - object._pscAutoDnsEnabled = "pscAutoDnsEnabled"; - } - if (message.pscWriteEndpointDnsEnabled != null && message.hasOwnProperty("pscWriteEndpointDnsEnabled")) { - object.pscWriteEndpointDnsEnabled = message.pscWriteEndpointDnsEnabled; - if (options.oneofs) - object._pscWriteEndpointDnsEnabled = "pscWriteEndpointDnsEnabled"; - } - return object; - }; - - /** - * Converts this PscConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.PscConfig - * @instance - * @returns {Object.} JSON object - */ - PscConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PscConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.PscConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PscConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.PscConfig"; - }; - - return PscConfig; - })(); - - v1.PscAutoConnectionConfig = (function() { - - /** - * Properties of a PscAutoConnectionConfig. - * @memberof google.cloud.sql.v1 - * @interface IPscAutoConnectionConfig - * @property {string|null} [consumerProject] PscAutoConnectionConfig consumerProject - * @property {string|null} [consumerNetwork] PscAutoConnectionConfig consumerNetwork - * @property {string|null} [ipAddress] PscAutoConnectionConfig ipAddress - * @property {string|null} [status] PscAutoConnectionConfig status - * @property {string|null} [consumerNetworkStatus] PscAutoConnectionConfig consumerNetworkStatus - */ - - /** - * Constructs a new PscAutoConnectionConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a PscAutoConnectionConfig. - * @implements IPscAutoConnectionConfig - * @constructor - * @param {google.cloud.sql.v1.IPscAutoConnectionConfig=} [properties] Properties to set - */ - function PscAutoConnectionConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PscAutoConnectionConfig consumerProject. - * @member {string} consumerProject - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @instance - */ - PscAutoConnectionConfig.prototype.consumerProject = ""; - - /** - * PscAutoConnectionConfig consumerNetwork. - * @member {string} consumerNetwork - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @instance - */ - PscAutoConnectionConfig.prototype.consumerNetwork = ""; - - /** - * PscAutoConnectionConfig ipAddress. - * @member {string|null|undefined} ipAddress - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @instance - */ - PscAutoConnectionConfig.prototype.ipAddress = null; - - /** - * PscAutoConnectionConfig status. - * @member {string|null|undefined} status - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @instance - */ - PscAutoConnectionConfig.prototype.status = null; - - /** - * PscAutoConnectionConfig consumerNetworkStatus. - * @member {string|null|undefined} consumerNetworkStatus - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @instance - */ - PscAutoConnectionConfig.prototype.consumerNetworkStatus = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PscAutoConnectionConfig.prototype, "_ipAddress", { - get: $util.oneOfGetter($oneOfFields = ["ipAddress"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PscAutoConnectionConfig.prototype, "_status", { - get: $util.oneOfGetter($oneOfFields = ["status"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PscAutoConnectionConfig.prototype, "_consumerNetworkStatus", { - get: $util.oneOfGetter($oneOfFields = ["consumerNetworkStatus"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PscAutoConnectionConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @static - * @param {google.cloud.sql.v1.IPscAutoConnectionConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.PscAutoConnectionConfig} PscAutoConnectionConfig instance - */ - PscAutoConnectionConfig.create = function create(properties) { - return new PscAutoConnectionConfig(properties); - }; - - /** - * Encodes the specified PscAutoConnectionConfig message. Does not implicitly {@link google.cloud.sql.v1.PscAutoConnectionConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @static - * @param {google.cloud.sql.v1.IPscAutoConnectionConfig} message PscAutoConnectionConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PscAutoConnectionConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.consumerProject != null && Object.hasOwnProperty.call(message, "consumerProject")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.consumerProject); - if (message.consumerNetwork != null && Object.hasOwnProperty.call(message, "consumerNetwork")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.consumerNetwork); - if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.ipAddress); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.status); - if (message.consumerNetworkStatus != null && Object.hasOwnProperty.call(message, "consumerNetworkStatus")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.consumerNetworkStatus); - return writer; - }; - - /** - * Encodes the specified PscAutoConnectionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PscAutoConnectionConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @static - * @param {google.cloud.sql.v1.IPscAutoConnectionConfig} message PscAutoConnectionConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PscAutoConnectionConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PscAutoConnectionConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.PscAutoConnectionConfig} PscAutoConnectionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PscAutoConnectionConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PscAutoConnectionConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.consumerProject = reader.string(); - break; - } - case 2: { - message.consumerNetwork = reader.string(); - break; - } - case 3: { - message.ipAddress = reader.string(); - break; - } - case 4: { - message.status = reader.string(); - break; - } - case 5: { - message.consumerNetworkStatus = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PscAutoConnectionConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.PscAutoConnectionConfig} PscAutoConnectionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PscAutoConnectionConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PscAutoConnectionConfig message. - * @function verify - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PscAutoConnectionConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.consumerProject != null && message.hasOwnProperty("consumerProject")) - if (!$util.isString(message.consumerProject)) - return "consumerProject: string expected"; - if (message.consumerNetwork != null && message.hasOwnProperty("consumerNetwork")) - if (!$util.isString(message.consumerNetwork)) - return "consumerNetwork: string expected"; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) { - properties._ipAddress = 1; - if (!$util.isString(message.ipAddress)) - return "ipAddress: string expected"; - } - if (message.status != null && message.hasOwnProperty("status")) { - properties._status = 1; - if (!$util.isString(message.status)) - return "status: string expected"; - } - if (message.consumerNetworkStatus != null && message.hasOwnProperty("consumerNetworkStatus")) { - properties._consumerNetworkStatus = 1; - if (!$util.isString(message.consumerNetworkStatus)) - return "consumerNetworkStatus: string expected"; - } - return null; - }; - - /** - * Creates a PscAutoConnectionConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.PscAutoConnectionConfig} PscAutoConnectionConfig - */ - PscAutoConnectionConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.PscAutoConnectionConfig) - return object; - var message = new $root.google.cloud.sql.v1.PscAutoConnectionConfig(); - if (object.consumerProject != null) - message.consumerProject = String(object.consumerProject); - if (object.consumerNetwork != null) - message.consumerNetwork = String(object.consumerNetwork); - if (object.ipAddress != null) - message.ipAddress = String(object.ipAddress); - if (object.status != null) - message.status = String(object.status); - if (object.consumerNetworkStatus != null) - message.consumerNetworkStatus = String(object.consumerNetworkStatus); - return message; - }; - - /** - * Creates a plain object from a PscAutoConnectionConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @static - * @param {google.cloud.sql.v1.PscAutoConnectionConfig} message PscAutoConnectionConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PscAutoConnectionConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.consumerProject = ""; - object.consumerNetwork = ""; - } - if (message.consumerProject != null && message.hasOwnProperty("consumerProject")) - object.consumerProject = message.consumerProject; - if (message.consumerNetwork != null && message.hasOwnProperty("consumerNetwork")) - object.consumerNetwork = message.consumerNetwork; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) { - object.ipAddress = message.ipAddress; - if (options.oneofs) - object._ipAddress = "ipAddress"; - } - if (message.status != null && message.hasOwnProperty("status")) { - object.status = message.status; - if (options.oneofs) - object._status = "status"; - } - if (message.consumerNetworkStatus != null && message.hasOwnProperty("consumerNetworkStatus")) { - object.consumerNetworkStatus = message.consumerNetworkStatus; - if (options.oneofs) - object._consumerNetworkStatus = "consumerNetworkStatus"; - } - return object; - }; - - /** - * Converts this PscAutoConnectionConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @instance - * @returns {Object.} JSON object - */ - PscAutoConnectionConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PscAutoConnectionConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.PscAutoConnectionConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PscAutoConnectionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.PscAutoConnectionConfig"; - }; - - return PscAutoConnectionConfig; - })(); - - v1.LocationPreference = (function() { - - /** - * Properties of a LocationPreference. - * @memberof google.cloud.sql.v1 - * @interface ILocationPreference - * @property {string|null} [followGaeApplication] LocationPreference followGaeApplication - * @property {string|null} [zone] LocationPreference zone - * @property {string|null} [secondaryZone] LocationPreference secondaryZone - * @property {string|null} [kind] LocationPreference kind - */ - - /** - * Constructs a new LocationPreference. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a LocationPreference. - * @implements ILocationPreference - * @constructor - * @param {google.cloud.sql.v1.ILocationPreference=} [properties] Properties to set - */ - function LocationPreference(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LocationPreference followGaeApplication. - * @member {string} followGaeApplication - * @memberof google.cloud.sql.v1.LocationPreference - * @instance - */ - LocationPreference.prototype.followGaeApplication = ""; - - /** - * LocationPreference zone. - * @member {string} zone - * @memberof google.cloud.sql.v1.LocationPreference - * @instance - */ - LocationPreference.prototype.zone = ""; - - /** - * LocationPreference secondaryZone. - * @member {string} secondaryZone - * @memberof google.cloud.sql.v1.LocationPreference - * @instance - */ - LocationPreference.prototype.secondaryZone = ""; - - /** - * LocationPreference kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.LocationPreference - * @instance - */ - LocationPreference.prototype.kind = ""; - - /** - * Creates a new LocationPreference instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.LocationPreference - * @static - * @param {google.cloud.sql.v1.ILocationPreference=} [properties] Properties to set - * @returns {google.cloud.sql.v1.LocationPreference} LocationPreference instance - */ - LocationPreference.create = function create(properties) { - return new LocationPreference(properties); - }; - - /** - * Encodes the specified LocationPreference message. Does not implicitly {@link google.cloud.sql.v1.LocationPreference.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.LocationPreference - * @static - * @param {google.cloud.sql.v1.ILocationPreference} message LocationPreference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LocationPreference.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.followGaeApplication != null && Object.hasOwnProperty.call(message, "followGaeApplication")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.followGaeApplication); - if (message.zone != null && Object.hasOwnProperty.call(message, "zone")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.zone); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - if (message.secondaryZone != null && Object.hasOwnProperty.call(message, "secondaryZone")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.secondaryZone); - return writer; - }; - - /** - * Encodes the specified LocationPreference message, length delimited. Does not implicitly {@link google.cloud.sql.v1.LocationPreference.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.LocationPreference - * @static - * @param {google.cloud.sql.v1.ILocationPreference} message LocationPreference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LocationPreference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LocationPreference message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.LocationPreference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.LocationPreference} LocationPreference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LocationPreference.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.LocationPreference(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.followGaeApplication = reader.string(); - break; - } - case 2: { - message.zone = reader.string(); - break; - } - case 4: { - message.secondaryZone = reader.string(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LocationPreference message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.LocationPreference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.LocationPreference} LocationPreference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LocationPreference.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LocationPreference message. - * @function verify - * @memberof google.cloud.sql.v1.LocationPreference - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LocationPreference.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.followGaeApplication != null && message.hasOwnProperty("followGaeApplication")) - if (!$util.isString(message.followGaeApplication)) - return "followGaeApplication: string expected"; - if (message.zone != null && message.hasOwnProperty("zone")) - if (!$util.isString(message.zone)) - return "zone: string expected"; - if (message.secondaryZone != null && message.hasOwnProperty("secondaryZone")) - if (!$util.isString(message.secondaryZone)) - return "secondaryZone: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a LocationPreference message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.LocationPreference - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.LocationPreference} LocationPreference - */ - LocationPreference.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.LocationPreference) - return object; - var message = new $root.google.cloud.sql.v1.LocationPreference(); - if (object.followGaeApplication != null) - message.followGaeApplication = String(object.followGaeApplication); - if (object.zone != null) - message.zone = String(object.zone); - if (object.secondaryZone != null) - message.secondaryZone = String(object.secondaryZone); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a LocationPreference message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.LocationPreference - * @static - * @param {google.cloud.sql.v1.LocationPreference} message LocationPreference - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LocationPreference.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.followGaeApplication = ""; - object.zone = ""; - object.kind = ""; - object.secondaryZone = ""; - } - if (message.followGaeApplication != null && message.hasOwnProperty("followGaeApplication")) - object.followGaeApplication = message.followGaeApplication; - if (message.zone != null && message.hasOwnProperty("zone")) - object.zone = message.zone; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.secondaryZone != null && message.hasOwnProperty("secondaryZone")) - object.secondaryZone = message.secondaryZone; - return object; - }; - - /** - * Converts this LocationPreference to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.LocationPreference - * @instance - * @returns {Object.} JSON object - */ - LocationPreference.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LocationPreference - * @function getTypeUrl - * @memberof google.cloud.sql.v1.LocationPreference - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LocationPreference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.LocationPreference"; - }; - - return LocationPreference; - })(); - - v1.MaintenanceWindow = (function() { - - /** - * Properties of a MaintenanceWindow. - * @memberof google.cloud.sql.v1 - * @interface IMaintenanceWindow - * @property {google.protobuf.IInt32Value|null} [hour] MaintenanceWindow hour - * @property {google.protobuf.IInt32Value|null} [day] MaintenanceWindow day - * @property {google.cloud.sql.v1.SqlUpdateTrack|null} [updateTrack] MaintenanceWindow updateTrack - * @property {string|null} [kind] MaintenanceWindow kind - */ - - /** - * Constructs a new MaintenanceWindow. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a MaintenanceWindow. - * @implements IMaintenanceWindow - * @constructor - * @param {google.cloud.sql.v1.IMaintenanceWindow=} [properties] Properties to set - */ - function MaintenanceWindow(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MaintenanceWindow hour. - * @member {google.protobuf.IInt32Value|null|undefined} hour - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @instance - */ - MaintenanceWindow.prototype.hour = null; - - /** - * MaintenanceWindow day. - * @member {google.protobuf.IInt32Value|null|undefined} day - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @instance - */ - MaintenanceWindow.prototype.day = null; - - /** - * MaintenanceWindow updateTrack. - * @member {google.cloud.sql.v1.SqlUpdateTrack} updateTrack - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @instance - */ - MaintenanceWindow.prototype.updateTrack = 0; - - /** - * MaintenanceWindow kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @instance - */ - MaintenanceWindow.prototype.kind = ""; - - /** - * Creates a new MaintenanceWindow instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @static - * @param {google.cloud.sql.v1.IMaintenanceWindow=} [properties] Properties to set - * @returns {google.cloud.sql.v1.MaintenanceWindow} MaintenanceWindow instance - */ - MaintenanceWindow.create = function create(properties) { - return new MaintenanceWindow(properties); - }; - - /** - * Encodes the specified MaintenanceWindow message. Does not implicitly {@link google.cloud.sql.v1.MaintenanceWindow.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @static - * @param {google.cloud.sql.v1.IMaintenanceWindow} message MaintenanceWindow message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MaintenanceWindow.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hour != null && Object.hasOwnProperty.call(message, "hour")) - $root.google.protobuf.Int32Value.encode(message.hour, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.day != null && Object.hasOwnProperty.call(message, "day")) - $root.google.protobuf.Int32Value.encode(message.day, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.updateTrack != null && Object.hasOwnProperty.call(message, "updateTrack")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.updateTrack); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); - return writer; - }; - - /** - * Encodes the specified MaintenanceWindow message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MaintenanceWindow.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @static - * @param {google.cloud.sql.v1.IMaintenanceWindow} message MaintenanceWindow message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MaintenanceWindow.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MaintenanceWindow message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.MaintenanceWindow} MaintenanceWindow - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MaintenanceWindow.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.MaintenanceWindow(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.hour = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 2: { - message.day = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 3: { - message.updateTrack = reader.int32(); - break; - } - case 4: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MaintenanceWindow message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.MaintenanceWindow} MaintenanceWindow - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MaintenanceWindow.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MaintenanceWindow message. - * @function verify - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MaintenanceWindow.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hour != null && message.hasOwnProperty("hour")) { - var error = $root.google.protobuf.Int32Value.verify(message.hour); - if (error) - return "hour." + error; - } - if (message.day != null && message.hasOwnProperty("day")) { - var error = $root.google.protobuf.Int32Value.verify(message.day); - if (error) - return "day." + error; - } - if (message.updateTrack != null && message.hasOwnProperty("updateTrack")) - switch (message.updateTrack) { - default: - return "updateTrack: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a MaintenanceWindow message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.MaintenanceWindow} MaintenanceWindow - */ - MaintenanceWindow.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.MaintenanceWindow) - return object; - var message = new $root.google.cloud.sql.v1.MaintenanceWindow(); - if (object.hour != null) { - if (typeof object.hour !== "object") - throw TypeError(".google.cloud.sql.v1.MaintenanceWindow.hour: object expected"); - message.hour = $root.google.protobuf.Int32Value.fromObject(object.hour); - } - if (object.day != null) { - if (typeof object.day !== "object") - throw TypeError(".google.cloud.sql.v1.MaintenanceWindow.day: object expected"); - message.day = $root.google.protobuf.Int32Value.fromObject(object.day); - } - switch (object.updateTrack) { - default: - if (typeof object.updateTrack === "number") { - message.updateTrack = object.updateTrack; - break; - } - break; - case "SQL_UPDATE_TRACK_UNSPECIFIED": - case 0: - message.updateTrack = 0; - break; - case "canary": - case 1: - message.updateTrack = 1; - break; - case "stable": - case 2: - message.updateTrack = 2; - break; - case "week5": - case 3: - message.updateTrack = 3; - break; - } - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a MaintenanceWindow message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @static - * @param {google.cloud.sql.v1.MaintenanceWindow} message MaintenanceWindow - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MaintenanceWindow.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.hour = null; - object.day = null; - object.updateTrack = options.enums === String ? "SQL_UPDATE_TRACK_UNSPECIFIED" : 0; - object.kind = ""; - } - if (message.hour != null && message.hasOwnProperty("hour")) - object.hour = $root.google.protobuf.Int32Value.toObject(message.hour, options); - if (message.day != null && message.hasOwnProperty("day")) - object.day = $root.google.protobuf.Int32Value.toObject(message.day, options); - if (message.updateTrack != null && message.hasOwnProperty("updateTrack")) - object.updateTrack = options.enums === String ? $root.google.cloud.sql.v1.SqlUpdateTrack[message.updateTrack] === undefined ? message.updateTrack : $root.google.cloud.sql.v1.SqlUpdateTrack[message.updateTrack] : message.updateTrack; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this MaintenanceWindow to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @instance - * @returns {Object.} JSON object - */ - MaintenanceWindow.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MaintenanceWindow - * @function getTypeUrl - * @memberof google.cloud.sql.v1.MaintenanceWindow - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MaintenanceWindow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.MaintenanceWindow"; - }; - - return MaintenanceWindow; - })(); - - v1.DenyMaintenancePeriod = (function() { - - /** - * Properties of a DenyMaintenancePeriod. - * @memberof google.cloud.sql.v1 - * @interface IDenyMaintenancePeriod - * @property {string|null} [startDate] DenyMaintenancePeriod startDate - * @property {string|null} [endDate] DenyMaintenancePeriod endDate - * @property {string|null} [time] DenyMaintenancePeriod time - */ - - /** - * Constructs a new DenyMaintenancePeriod. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DenyMaintenancePeriod. - * @implements IDenyMaintenancePeriod - * @constructor - * @param {google.cloud.sql.v1.IDenyMaintenancePeriod=} [properties] Properties to set - */ - function DenyMaintenancePeriod(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DenyMaintenancePeriod startDate. - * @member {string} startDate - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @instance - */ - DenyMaintenancePeriod.prototype.startDate = ""; - - /** - * DenyMaintenancePeriod endDate. - * @member {string} endDate - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @instance - */ - DenyMaintenancePeriod.prototype.endDate = ""; - - /** - * DenyMaintenancePeriod time. - * @member {string} time - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @instance - */ - DenyMaintenancePeriod.prototype.time = ""; - - /** - * Creates a new DenyMaintenancePeriod instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @static - * @param {google.cloud.sql.v1.IDenyMaintenancePeriod=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DenyMaintenancePeriod} DenyMaintenancePeriod instance - */ - DenyMaintenancePeriod.create = function create(properties) { - return new DenyMaintenancePeriod(properties); - }; - - /** - * Encodes the specified DenyMaintenancePeriod message. Does not implicitly {@link google.cloud.sql.v1.DenyMaintenancePeriod.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @static - * @param {google.cloud.sql.v1.IDenyMaintenancePeriod} message DenyMaintenancePeriod message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DenyMaintenancePeriod.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startDate != null && Object.hasOwnProperty.call(message, "startDate")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.startDate); - if (message.endDate != null && Object.hasOwnProperty.call(message, "endDate")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.endDate); - if (message.time != null && Object.hasOwnProperty.call(message, "time")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.time); - return writer; - }; - - /** - * Encodes the specified DenyMaintenancePeriod message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DenyMaintenancePeriod.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @static - * @param {google.cloud.sql.v1.IDenyMaintenancePeriod} message DenyMaintenancePeriod message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DenyMaintenancePeriod.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DenyMaintenancePeriod message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DenyMaintenancePeriod} DenyMaintenancePeriod - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DenyMaintenancePeriod.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DenyMaintenancePeriod(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.startDate = reader.string(); - break; - } - case 2: { - message.endDate = reader.string(); - break; - } - case 3: { - message.time = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DenyMaintenancePeriod message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DenyMaintenancePeriod} DenyMaintenancePeriod - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DenyMaintenancePeriod.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DenyMaintenancePeriod message. - * @function verify - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DenyMaintenancePeriod.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.startDate != null && message.hasOwnProperty("startDate")) - if (!$util.isString(message.startDate)) - return "startDate: string expected"; - if (message.endDate != null && message.hasOwnProperty("endDate")) - if (!$util.isString(message.endDate)) - return "endDate: string expected"; - if (message.time != null && message.hasOwnProperty("time")) - if (!$util.isString(message.time)) - return "time: string expected"; - return null; - }; - - /** - * Creates a DenyMaintenancePeriod message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DenyMaintenancePeriod} DenyMaintenancePeriod - */ - DenyMaintenancePeriod.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DenyMaintenancePeriod) - return object; - var message = new $root.google.cloud.sql.v1.DenyMaintenancePeriod(); - if (object.startDate != null) - message.startDate = String(object.startDate); - if (object.endDate != null) - message.endDate = String(object.endDate); - if (object.time != null) - message.time = String(object.time); - return message; - }; - - /** - * Creates a plain object from a DenyMaintenancePeriod message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @static - * @param {google.cloud.sql.v1.DenyMaintenancePeriod} message DenyMaintenancePeriod - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DenyMaintenancePeriod.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.startDate = ""; - object.endDate = ""; - object.time = ""; - } - if (message.startDate != null && message.hasOwnProperty("startDate")) - object.startDate = message.startDate; - if (message.endDate != null && message.hasOwnProperty("endDate")) - object.endDate = message.endDate; - if (message.time != null && message.hasOwnProperty("time")) - object.time = message.time; - return object; - }; - - /** - * Converts this DenyMaintenancePeriod to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @instance - * @returns {Object.} JSON object - */ - DenyMaintenancePeriod.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DenyMaintenancePeriod - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DenyMaintenancePeriod - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DenyMaintenancePeriod.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DenyMaintenancePeriod"; - }; - - return DenyMaintenancePeriod; - })(); - - v1.InsightsConfig = (function() { - - /** - * Properties of an InsightsConfig. - * @memberof google.cloud.sql.v1 - * @interface IInsightsConfig - * @property {boolean|null} [queryInsightsEnabled] InsightsConfig queryInsightsEnabled - * @property {boolean|null} [recordClientAddress] InsightsConfig recordClientAddress - * @property {boolean|null} [recordApplicationTags] InsightsConfig recordApplicationTags - * @property {google.protobuf.IInt32Value|null} [queryStringLength] InsightsConfig queryStringLength - * @property {google.protobuf.IInt32Value|null} [queryPlansPerMinute] InsightsConfig queryPlansPerMinute - * @property {google.protobuf.IBoolValue|null} [enhancedQueryInsightsEnabled] InsightsConfig enhancedQueryInsightsEnabled - */ - - /** - * Constructs a new InsightsConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InsightsConfig. - * @implements IInsightsConfig - * @constructor - * @param {google.cloud.sql.v1.IInsightsConfig=} [properties] Properties to set - */ - function InsightsConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InsightsConfig queryInsightsEnabled. - * @member {boolean} queryInsightsEnabled - * @memberof google.cloud.sql.v1.InsightsConfig - * @instance - */ - InsightsConfig.prototype.queryInsightsEnabled = false; - - /** - * InsightsConfig recordClientAddress. - * @member {boolean} recordClientAddress - * @memberof google.cloud.sql.v1.InsightsConfig - * @instance - */ - InsightsConfig.prototype.recordClientAddress = false; - - /** - * InsightsConfig recordApplicationTags. - * @member {boolean} recordApplicationTags - * @memberof google.cloud.sql.v1.InsightsConfig - * @instance - */ - InsightsConfig.prototype.recordApplicationTags = false; - - /** - * InsightsConfig queryStringLength. - * @member {google.protobuf.IInt32Value|null|undefined} queryStringLength - * @memberof google.cloud.sql.v1.InsightsConfig - * @instance - */ - InsightsConfig.prototype.queryStringLength = null; - - /** - * InsightsConfig queryPlansPerMinute. - * @member {google.protobuf.IInt32Value|null|undefined} queryPlansPerMinute - * @memberof google.cloud.sql.v1.InsightsConfig - * @instance - */ - InsightsConfig.prototype.queryPlansPerMinute = null; - - /** - * InsightsConfig enhancedQueryInsightsEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} enhancedQueryInsightsEnabled - * @memberof google.cloud.sql.v1.InsightsConfig - * @instance - */ - InsightsConfig.prototype.enhancedQueryInsightsEnabled = null; - - /** - * Creates a new InsightsConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InsightsConfig - * @static - * @param {google.cloud.sql.v1.IInsightsConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InsightsConfig} InsightsConfig instance - */ - InsightsConfig.create = function create(properties) { - return new InsightsConfig(properties); - }; - - /** - * Encodes the specified InsightsConfig message. Does not implicitly {@link google.cloud.sql.v1.InsightsConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InsightsConfig - * @static - * @param {google.cloud.sql.v1.IInsightsConfig} message InsightsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InsightsConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.queryInsightsEnabled != null && Object.hasOwnProperty.call(message, "queryInsightsEnabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.queryInsightsEnabled); - if (message.recordClientAddress != null && Object.hasOwnProperty.call(message, "recordClientAddress")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.recordClientAddress); - if (message.recordApplicationTags != null && Object.hasOwnProperty.call(message, "recordApplicationTags")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.recordApplicationTags); - if (message.queryStringLength != null && Object.hasOwnProperty.call(message, "queryStringLength")) - $root.google.protobuf.Int32Value.encode(message.queryStringLength, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.queryPlansPerMinute != null && Object.hasOwnProperty.call(message, "queryPlansPerMinute")) - $root.google.protobuf.Int32Value.encode(message.queryPlansPerMinute, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.enhancedQueryInsightsEnabled != null && Object.hasOwnProperty.call(message, "enhancedQueryInsightsEnabled")) - $root.google.protobuf.BoolValue.encode(message.enhancedQueryInsightsEnabled, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InsightsConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InsightsConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InsightsConfig - * @static - * @param {google.cloud.sql.v1.IInsightsConfig} message InsightsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InsightsConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InsightsConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InsightsConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InsightsConfig} InsightsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InsightsConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InsightsConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.queryInsightsEnabled = reader.bool(); - break; - } - case 2: { - message.recordClientAddress = reader.bool(); - break; - } - case 3: { - message.recordApplicationTags = reader.bool(); - break; - } - case 4: { - message.queryStringLength = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 5: { - message.queryPlansPerMinute = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 8: { - message.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InsightsConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InsightsConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InsightsConfig} InsightsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InsightsConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InsightsConfig message. - * @function verify - * @memberof google.cloud.sql.v1.InsightsConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InsightsConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.queryInsightsEnabled != null && message.hasOwnProperty("queryInsightsEnabled")) - if (typeof message.queryInsightsEnabled !== "boolean") - return "queryInsightsEnabled: boolean expected"; - if (message.recordClientAddress != null && message.hasOwnProperty("recordClientAddress")) - if (typeof message.recordClientAddress !== "boolean") - return "recordClientAddress: boolean expected"; - if (message.recordApplicationTags != null && message.hasOwnProperty("recordApplicationTags")) - if (typeof message.recordApplicationTags !== "boolean") - return "recordApplicationTags: boolean expected"; - if (message.queryStringLength != null && message.hasOwnProperty("queryStringLength")) { - var error = $root.google.protobuf.Int32Value.verify(message.queryStringLength); - if (error) - return "queryStringLength." + error; - } - if (message.queryPlansPerMinute != null && message.hasOwnProperty("queryPlansPerMinute")) { - var error = $root.google.protobuf.Int32Value.verify(message.queryPlansPerMinute); - if (error) - return "queryPlansPerMinute." + error; - } - if (message.enhancedQueryInsightsEnabled != null && message.hasOwnProperty("enhancedQueryInsightsEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.enhancedQueryInsightsEnabled); - if (error) - return "enhancedQueryInsightsEnabled." + error; - } - return null; - }; - - /** - * Creates an InsightsConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InsightsConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InsightsConfig} InsightsConfig - */ - InsightsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InsightsConfig) - return object; - var message = new $root.google.cloud.sql.v1.InsightsConfig(); - if (object.queryInsightsEnabled != null) - message.queryInsightsEnabled = Boolean(object.queryInsightsEnabled); - if (object.recordClientAddress != null) - message.recordClientAddress = Boolean(object.recordClientAddress); - if (object.recordApplicationTags != null) - message.recordApplicationTags = Boolean(object.recordApplicationTags); - if (object.queryStringLength != null) { - if (typeof object.queryStringLength !== "object") - throw TypeError(".google.cloud.sql.v1.InsightsConfig.queryStringLength: object expected"); - message.queryStringLength = $root.google.protobuf.Int32Value.fromObject(object.queryStringLength); - } - if (object.queryPlansPerMinute != null) { - if (typeof object.queryPlansPerMinute !== "object") - throw TypeError(".google.cloud.sql.v1.InsightsConfig.queryPlansPerMinute: object expected"); - message.queryPlansPerMinute = $root.google.protobuf.Int32Value.fromObject(object.queryPlansPerMinute); - } - if (object.enhancedQueryInsightsEnabled != null) { - if (typeof object.enhancedQueryInsightsEnabled !== "object") - throw TypeError(".google.cloud.sql.v1.InsightsConfig.enhancedQueryInsightsEnabled: object expected"); - message.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.fromObject(object.enhancedQueryInsightsEnabled); - } - return message; - }; - - /** - * Creates a plain object from an InsightsConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InsightsConfig - * @static - * @param {google.cloud.sql.v1.InsightsConfig} message InsightsConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InsightsConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.queryInsightsEnabled = false; - object.recordClientAddress = false; - object.recordApplicationTags = false; - object.queryStringLength = null; - object.queryPlansPerMinute = null; - object.enhancedQueryInsightsEnabled = null; - } - if (message.queryInsightsEnabled != null && message.hasOwnProperty("queryInsightsEnabled")) - object.queryInsightsEnabled = message.queryInsightsEnabled; - if (message.recordClientAddress != null && message.hasOwnProperty("recordClientAddress")) - object.recordClientAddress = message.recordClientAddress; - if (message.recordApplicationTags != null && message.hasOwnProperty("recordApplicationTags")) - object.recordApplicationTags = message.recordApplicationTags; - if (message.queryStringLength != null && message.hasOwnProperty("queryStringLength")) - object.queryStringLength = $root.google.protobuf.Int32Value.toObject(message.queryStringLength, options); - if (message.queryPlansPerMinute != null && message.hasOwnProperty("queryPlansPerMinute")) - object.queryPlansPerMinute = $root.google.protobuf.Int32Value.toObject(message.queryPlansPerMinute, options); - if (message.enhancedQueryInsightsEnabled != null && message.hasOwnProperty("enhancedQueryInsightsEnabled")) - object.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.toObject(message.enhancedQueryInsightsEnabled, options); - return object; - }; - - /** - * Converts this InsightsConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InsightsConfig - * @instance - * @returns {Object.} JSON object - */ - InsightsConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InsightsConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InsightsConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InsightsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InsightsConfig"; - }; - - return InsightsConfig; - })(); - - v1.MySqlReplicaConfiguration = (function() { - - /** - * Properties of a MySqlReplicaConfiguration. - * @memberof google.cloud.sql.v1 - * @interface IMySqlReplicaConfiguration - * @property {string|null} [dumpFilePath] MySqlReplicaConfiguration dumpFilePath - * @property {string|null} [username] MySqlReplicaConfiguration username - * @property {string|null} [password] MySqlReplicaConfiguration password - * @property {google.protobuf.IInt32Value|null} [connectRetryInterval] MySqlReplicaConfiguration connectRetryInterval - * @property {google.protobuf.IInt64Value|null} [masterHeartbeatPeriod] MySqlReplicaConfiguration masterHeartbeatPeriod - * @property {string|null} [caCertificate] MySqlReplicaConfiguration caCertificate - * @property {string|null} [clientCertificate] MySqlReplicaConfiguration clientCertificate - * @property {string|null} [clientKey] MySqlReplicaConfiguration clientKey - * @property {string|null} [sslCipher] MySqlReplicaConfiguration sslCipher - * @property {google.protobuf.IBoolValue|null} [verifyServerCertificate] MySqlReplicaConfiguration verifyServerCertificate - * @property {string|null} [kind] MySqlReplicaConfiguration kind - */ - - /** - * Constructs a new MySqlReplicaConfiguration. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a MySqlReplicaConfiguration. - * @implements IMySqlReplicaConfiguration - * @constructor - * @param {google.cloud.sql.v1.IMySqlReplicaConfiguration=} [properties] Properties to set - */ - function MySqlReplicaConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MySqlReplicaConfiguration dumpFilePath. - * @member {string} dumpFilePath - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.dumpFilePath = ""; - - /** - * MySqlReplicaConfiguration username. - * @member {string} username - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.username = ""; - - /** - * MySqlReplicaConfiguration password. - * @member {string} password - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.password = ""; - - /** - * MySqlReplicaConfiguration connectRetryInterval. - * @member {google.protobuf.IInt32Value|null|undefined} connectRetryInterval - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.connectRetryInterval = null; - - /** - * MySqlReplicaConfiguration masterHeartbeatPeriod. - * @member {google.protobuf.IInt64Value|null|undefined} masterHeartbeatPeriod - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.masterHeartbeatPeriod = null; - - /** - * MySqlReplicaConfiguration caCertificate. - * @member {string} caCertificate - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.caCertificate = ""; - - /** - * MySqlReplicaConfiguration clientCertificate. - * @member {string} clientCertificate - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.clientCertificate = ""; - - /** - * MySqlReplicaConfiguration clientKey. - * @member {string} clientKey - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.clientKey = ""; - - /** - * MySqlReplicaConfiguration sslCipher. - * @member {string} sslCipher - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.sslCipher = ""; - - /** - * MySqlReplicaConfiguration verifyServerCertificate. - * @member {google.protobuf.IBoolValue|null|undefined} verifyServerCertificate - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.verifyServerCertificate = null; - - /** - * MySqlReplicaConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.kind = ""; - - /** - * Creates a new MySqlReplicaConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.IMySqlReplicaConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1.MySqlReplicaConfiguration} MySqlReplicaConfiguration instance - */ - MySqlReplicaConfiguration.create = function create(properties) { - return new MySqlReplicaConfiguration(properties); - }; - - /** - * Encodes the specified MySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.MySqlReplicaConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.IMySqlReplicaConfiguration} message MySqlReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MySqlReplicaConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dumpFilePath != null && Object.hasOwnProperty.call(message, "dumpFilePath")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.dumpFilePath); - if (message.username != null && Object.hasOwnProperty.call(message, "username")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); - if (message.password != null && Object.hasOwnProperty.call(message, "password")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); - if (message.connectRetryInterval != null && Object.hasOwnProperty.call(message, "connectRetryInterval")) - $root.google.protobuf.Int32Value.encode(message.connectRetryInterval, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.masterHeartbeatPeriod != null && Object.hasOwnProperty.call(message, "masterHeartbeatPeriod")) - $root.google.protobuf.Int64Value.encode(message.masterHeartbeatPeriod, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.caCertificate); - if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.clientCertificate); - if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.clientKey); - if (message.sslCipher != null && Object.hasOwnProperty.call(message, "sslCipher")) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.sslCipher); - if (message.verifyServerCertificate != null && Object.hasOwnProperty.call(message, "verifyServerCertificate")) - $root.google.protobuf.BoolValue.encode(message.verifyServerCertificate, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.kind); - return writer; - }; - - /** - * Encodes the specified MySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.MySqlReplicaConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.IMySqlReplicaConfiguration} message MySqlReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MySqlReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.MySqlReplicaConfiguration} MySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MySqlReplicaConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.MySqlReplicaConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.dumpFilePath = reader.string(); - break; - } - case 2: { - message.username = reader.string(); - break; - } - case 3: { - message.password = reader.string(); - break; - } - case 4: { - message.connectRetryInterval = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 5: { - message.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 6: { - message.caCertificate = reader.string(); - break; - } - case 7: { - message.clientCertificate = reader.string(); - break; - } - case 8: { - message.clientKey = reader.string(); - break; - } - case 9: { - message.sslCipher = reader.string(); - break; - } - case 10: { - message.verifyServerCertificate = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 11: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.MySqlReplicaConfiguration} MySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MySqlReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MySqlReplicaConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MySqlReplicaConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) - if (!$util.isString(message.dumpFilePath)) - return "dumpFilePath: string expected"; - if (message.username != null && message.hasOwnProperty("username")) - if (!$util.isString(message.username)) - return "username: string expected"; - if (message.password != null && message.hasOwnProperty("password")) - if (!$util.isString(message.password)) - return "password: string expected"; - if (message.connectRetryInterval != null && message.hasOwnProperty("connectRetryInterval")) { - var error = $root.google.protobuf.Int32Value.verify(message.connectRetryInterval); - if (error) - return "connectRetryInterval." + error; - } - if (message.masterHeartbeatPeriod != null && message.hasOwnProperty("masterHeartbeatPeriod")) { - var error = $root.google.protobuf.Int64Value.verify(message.masterHeartbeatPeriod); - if (error) - return "masterHeartbeatPeriod." + error; - } - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - if (!$util.isString(message.caCertificate)) - return "caCertificate: string expected"; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - if (!$util.isString(message.clientCertificate)) - return "clientCertificate: string expected"; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - if (!$util.isString(message.clientKey)) - return "clientKey: string expected"; - if (message.sslCipher != null && message.hasOwnProperty("sslCipher")) - if (!$util.isString(message.sslCipher)) - return "sslCipher: string expected"; - if (message.verifyServerCertificate != null && message.hasOwnProperty("verifyServerCertificate")) { - var error = $root.google.protobuf.BoolValue.verify(message.verifyServerCertificate); - if (error) - return "verifyServerCertificate." + error; - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a MySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.MySqlReplicaConfiguration} MySqlReplicaConfiguration - */ - MySqlReplicaConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.MySqlReplicaConfiguration) - return object; - var message = new $root.google.cloud.sql.v1.MySqlReplicaConfiguration(); - if (object.dumpFilePath != null) - message.dumpFilePath = String(object.dumpFilePath); - if (object.username != null) - message.username = String(object.username); - if (object.password != null) - message.password = String(object.password); - if (object.connectRetryInterval != null) { - if (typeof object.connectRetryInterval !== "object") - throw TypeError(".google.cloud.sql.v1.MySqlReplicaConfiguration.connectRetryInterval: object expected"); - message.connectRetryInterval = $root.google.protobuf.Int32Value.fromObject(object.connectRetryInterval); - } - if (object.masterHeartbeatPeriod != null) { - if (typeof object.masterHeartbeatPeriod !== "object") - throw TypeError(".google.cloud.sql.v1.MySqlReplicaConfiguration.masterHeartbeatPeriod: object expected"); - message.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.fromObject(object.masterHeartbeatPeriod); - } - if (object.caCertificate != null) - message.caCertificate = String(object.caCertificate); - if (object.clientCertificate != null) - message.clientCertificate = String(object.clientCertificate); - if (object.clientKey != null) - message.clientKey = String(object.clientKey); - if (object.sslCipher != null) - message.sslCipher = String(object.sslCipher); - if (object.verifyServerCertificate != null) { - if (typeof object.verifyServerCertificate !== "object") - throw TypeError(".google.cloud.sql.v1.MySqlReplicaConfiguration.verifyServerCertificate: object expected"); - message.verifyServerCertificate = $root.google.protobuf.BoolValue.fromObject(object.verifyServerCertificate); - } - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a MySqlReplicaConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.MySqlReplicaConfiguration} message MySqlReplicaConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MySqlReplicaConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.dumpFilePath = ""; - object.username = ""; - object.password = ""; - object.connectRetryInterval = null; - object.masterHeartbeatPeriod = null; - object.caCertificate = ""; - object.clientCertificate = ""; - object.clientKey = ""; - object.sslCipher = ""; - object.verifyServerCertificate = null; - object.kind = ""; - } - if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) - object.dumpFilePath = message.dumpFilePath; - if (message.username != null && message.hasOwnProperty("username")) - object.username = message.username; - if (message.password != null && message.hasOwnProperty("password")) - object.password = message.password; - if (message.connectRetryInterval != null && message.hasOwnProperty("connectRetryInterval")) - object.connectRetryInterval = $root.google.protobuf.Int32Value.toObject(message.connectRetryInterval, options); - if (message.masterHeartbeatPeriod != null && message.hasOwnProperty("masterHeartbeatPeriod")) - object.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.toObject(message.masterHeartbeatPeriod, options); - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - object.caCertificate = message.caCertificate; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - object.clientCertificate = message.clientCertificate; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - object.clientKey = message.clientKey; - if (message.sslCipher != null && message.hasOwnProperty("sslCipher")) - object.sslCipher = message.sslCipher; - if (message.verifyServerCertificate != null && message.hasOwnProperty("verifyServerCertificate")) - object.verifyServerCertificate = $root.google.protobuf.BoolValue.toObject(message.verifyServerCertificate, options); - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this MySqlReplicaConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @instance - * @returns {Object.} JSON object - */ - MySqlReplicaConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MySqlReplicaConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1.MySqlReplicaConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MySqlReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.MySqlReplicaConfiguration"; - }; - - return MySqlReplicaConfiguration; - })(); - - v1.DiskEncryptionConfiguration = (function() { - - /** - * Properties of a DiskEncryptionConfiguration. - * @memberof google.cloud.sql.v1 - * @interface IDiskEncryptionConfiguration - * @property {string|null} [kmsKeyName] DiskEncryptionConfiguration kmsKeyName - * @property {string|null} [kind] DiskEncryptionConfiguration kind - */ - - /** - * Constructs a new DiskEncryptionConfiguration. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DiskEncryptionConfiguration. - * @implements IDiskEncryptionConfiguration - * @constructor - * @param {google.cloud.sql.v1.IDiskEncryptionConfiguration=} [properties] Properties to set - */ - function DiskEncryptionConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DiskEncryptionConfiguration kmsKeyName. - * @member {string} kmsKeyName - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @instance - */ - DiskEncryptionConfiguration.prototype.kmsKeyName = ""; - - /** - * DiskEncryptionConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @instance - */ - DiskEncryptionConfiguration.prototype.kind = ""; - - /** - * Creates a new DiskEncryptionConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @static - * @param {google.cloud.sql.v1.IDiskEncryptionConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DiskEncryptionConfiguration} DiskEncryptionConfiguration instance - */ - DiskEncryptionConfiguration.create = function create(properties) { - return new DiskEncryptionConfiguration(properties); - }; - - /** - * Encodes the specified DiskEncryptionConfiguration message. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @static - * @param {google.cloud.sql.v1.IDiskEncryptionConfiguration} message DiskEncryptionConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DiskEncryptionConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kmsKeyName); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - return writer; - }; - - /** - * Encodes the specified DiskEncryptionConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @static - * @param {google.cloud.sql.v1.IDiskEncryptionConfiguration} message DiskEncryptionConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DiskEncryptionConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DiskEncryptionConfiguration} DiskEncryptionConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DiskEncryptionConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DiskEncryptionConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kmsKeyName = reader.string(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DiskEncryptionConfiguration} DiskEncryptionConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DiskEncryptionConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DiskEncryptionConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DiskEncryptionConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) - if (!$util.isString(message.kmsKeyName)) - return "kmsKeyName: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a DiskEncryptionConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DiskEncryptionConfiguration} DiskEncryptionConfiguration - */ - DiskEncryptionConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DiskEncryptionConfiguration) - return object; - var message = new $root.google.cloud.sql.v1.DiskEncryptionConfiguration(); - if (object.kmsKeyName != null) - message.kmsKeyName = String(object.kmsKeyName); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a DiskEncryptionConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @static - * @param {google.cloud.sql.v1.DiskEncryptionConfiguration} message DiskEncryptionConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DiskEncryptionConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kmsKeyName = ""; - object.kind = ""; - } - if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) - object.kmsKeyName = message.kmsKeyName; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this DiskEncryptionConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @instance - * @returns {Object.} JSON object - */ - DiskEncryptionConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DiskEncryptionConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DiskEncryptionConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DiskEncryptionConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DiskEncryptionConfiguration"; - }; - - return DiskEncryptionConfiguration; - })(); - - v1.DiskEncryptionStatus = (function() { - - /** - * Properties of a DiskEncryptionStatus. - * @memberof google.cloud.sql.v1 - * @interface IDiskEncryptionStatus - * @property {string|null} [kmsKeyVersionName] DiskEncryptionStatus kmsKeyVersionName - * @property {string|null} [kind] DiskEncryptionStatus kind - */ - - /** - * Constructs a new DiskEncryptionStatus. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DiskEncryptionStatus. - * @implements IDiskEncryptionStatus - * @constructor - * @param {google.cloud.sql.v1.IDiskEncryptionStatus=} [properties] Properties to set - */ - function DiskEncryptionStatus(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DiskEncryptionStatus kmsKeyVersionName. - * @member {string} kmsKeyVersionName - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @instance - */ - DiskEncryptionStatus.prototype.kmsKeyVersionName = ""; - - /** - * DiskEncryptionStatus kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @instance - */ - DiskEncryptionStatus.prototype.kind = ""; - - /** - * Creates a new DiskEncryptionStatus instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @static - * @param {google.cloud.sql.v1.IDiskEncryptionStatus=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DiskEncryptionStatus} DiskEncryptionStatus instance - */ - DiskEncryptionStatus.create = function create(properties) { - return new DiskEncryptionStatus(properties); - }; - - /** - * Encodes the specified DiskEncryptionStatus message. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionStatus.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @static - * @param {google.cloud.sql.v1.IDiskEncryptionStatus} message DiskEncryptionStatus message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DiskEncryptionStatus.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kmsKeyVersionName != null && Object.hasOwnProperty.call(message, "kmsKeyVersionName")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kmsKeyVersionName); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - return writer; - }; - - /** - * Encodes the specified DiskEncryptionStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DiskEncryptionStatus.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @static - * @param {google.cloud.sql.v1.IDiskEncryptionStatus} message DiskEncryptionStatus message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DiskEncryptionStatus.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DiskEncryptionStatus message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DiskEncryptionStatus} DiskEncryptionStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DiskEncryptionStatus.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DiskEncryptionStatus(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kmsKeyVersionName = reader.string(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DiskEncryptionStatus message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DiskEncryptionStatus} DiskEncryptionStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DiskEncryptionStatus.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DiskEncryptionStatus message. - * @function verify - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DiskEncryptionStatus.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) - if (!$util.isString(message.kmsKeyVersionName)) - return "kmsKeyVersionName: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a DiskEncryptionStatus message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DiskEncryptionStatus} DiskEncryptionStatus - */ - DiskEncryptionStatus.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DiskEncryptionStatus) - return object; - var message = new $root.google.cloud.sql.v1.DiskEncryptionStatus(); - if (object.kmsKeyVersionName != null) - message.kmsKeyVersionName = String(object.kmsKeyVersionName); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a DiskEncryptionStatus message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @static - * @param {google.cloud.sql.v1.DiskEncryptionStatus} message DiskEncryptionStatus - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DiskEncryptionStatus.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kmsKeyVersionName = ""; - object.kind = ""; - } - if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) - object.kmsKeyVersionName = message.kmsKeyVersionName; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this DiskEncryptionStatus to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @instance - * @returns {Object.} JSON object - */ - DiskEncryptionStatus.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DiskEncryptionStatus - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DiskEncryptionStatus - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DiskEncryptionStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DiskEncryptionStatus"; - }; - - return DiskEncryptionStatus; - })(); - - v1.IpMapping = (function() { - - /** - * Properties of an IpMapping. - * @memberof google.cloud.sql.v1 - * @interface IIpMapping - * @property {google.cloud.sql.v1.SqlIpAddressType|null} [type] IpMapping type - * @property {string|null} [ipAddress] IpMapping ipAddress - * @property {google.protobuf.ITimestamp|null} [timeToRetire] IpMapping timeToRetire - */ - - /** - * Constructs a new IpMapping. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an IpMapping. - * @implements IIpMapping - * @constructor - * @param {google.cloud.sql.v1.IIpMapping=} [properties] Properties to set - */ - function IpMapping(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IpMapping type. - * @member {google.cloud.sql.v1.SqlIpAddressType} type - * @memberof google.cloud.sql.v1.IpMapping - * @instance - */ - IpMapping.prototype.type = 0; - - /** - * IpMapping ipAddress. - * @member {string} ipAddress - * @memberof google.cloud.sql.v1.IpMapping - * @instance - */ - IpMapping.prototype.ipAddress = ""; - - /** - * IpMapping timeToRetire. - * @member {google.protobuf.ITimestamp|null|undefined} timeToRetire - * @memberof google.cloud.sql.v1.IpMapping - * @instance - */ - IpMapping.prototype.timeToRetire = null; - - /** - * Creates a new IpMapping instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.IpMapping - * @static - * @param {google.cloud.sql.v1.IIpMapping=} [properties] Properties to set - * @returns {google.cloud.sql.v1.IpMapping} IpMapping instance - */ - IpMapping.create = function create(properties) { - return new IpMapping(properties); - }; - - /** - * Encodes the specified IpMapping message. Does not implicitly {@link google.cloud.sql.v1.IpMapping.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.IpMapping - * @static - * @param {google.cloud.sql.v1.IIpMapping} message IpMapping message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IpMapping.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); - if (message.timeToRetire != null && Object.hasOwnProperty.call(message, "timeToRetire")) - $root.google.protobuf.Timestamp.encode(message.timeToRetire, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified IpMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1.IpMapping.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.IpMapping - * @static - * @param {google.cloud.sql.v1.IIpMapping} message IpMapping message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IpMapping.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IpMapping message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.IpMapping - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.IpMapping} IpMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IpMapping.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.IpMapping(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.type = reader.int32(); - break; - } - case 2: { - message.ipAddress = reader.string(); - break; - } - case 3: { - message.timeToRetire = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IpMapping message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.IpMapping - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.IpMapping} IpMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IpMapping.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IpMapping message. - * @function verify - * @memberof google.cloud.sql.v1.IpMapping - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IpMapping.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - if (!$util.isString(message.ipAddress)) - return "ipAddress: string expected"; - if (message.timeToRetire != null && message.hasOwnProperty("timeToRetire")) { - var error = $root.google.protobuf.Timestamp.verify(message.timeToRetire); - if (error) - return "timeToRetire." + error; - } - return null; - }; - - /** - * Creates an IpMapping message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.IpMapping - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.IpMapping} IpMapping - */ - IpMapping.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.IpMapping) - return object; - var message = new $root.google.cloud.sql.v1.IpMapping(); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "SQL_IP_ADDRESS_TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "PRIMARY": - case 1: - message.type = 1; - break; - case "OUTGOING": - case 2: - message.type = 2; - break; - case "PRIVATE": - case 3: - message.type = 3; - break; - case "MIGRATED_1ST_GEN": - case 4: - message.type = 4; - break; - } - if (object.ipAddress != null) - message.ipAddress = String(object.ipAddress); - if (object.timeToRetire != null) { - if (typeof object.timeToRetire !== "object") - throw TypeError(".google.cloud.sql.v1.IpMapping.timeToRetire: object expected"); - message.timeToRetire = $root.google.protobuf.Timestamp.fromObject(object.timeToRetire); - } - return message; - }; - - /** - * Creates a plain object from an IpMapping message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.IpMapping - * @static - * @param {google.cloud.sql.v1.IpMapping} message IpMapping - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IpMapping.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = options.enums === String ? "SQL_IP_ADDRESS_TYPE_UNSPECIFIED" : 0; - object.ipAddress = ""; - object.timeToRetire = null; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1.SqlIpAddressType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.SqlIpAddressType[message.type] : message.type; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - object.ipAddress = message.ipAddress; - if (message.timeToRetire != null && message.hasOwnProperty("timeToRetire")) - object.timeToRetire = $root.google.protobuf.Timestamp.toObject(message.timeToRetire, options); - return object; - }; - - /** - * Converts this IpMapping to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.IpMapping - * @instance - * @returns {Object.} JSON object - */ - IpMapping.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for IpMapping - * @function getTypeUrl - * @memberof google.cloud.sql.v1.IpMapping - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - IpMapping.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.IpMapping"; - }; - - return IpMapping; - })(); - - /** - * SqlMaintenanceType enum. - * @name google.cloud.sql.v1.SqlMaintenanceType - * @enum {number} - * @property {number} SQL_MAINTENANCE_TYPE_UNSPECIFIED=0 SQL_MAINTENANCE_TYPE_UNSPECIFIED value - * @property {number} INSTANCE_MAINTENANCE=1 INSTANCE_MAINTENANCE value - * @property {number} REPLICA_INCLUDED_MAINTENANCE=2 REPLICA_INCLUDED_MAINTENANCE value - * @property {number} INSTANCE_SELF_SERVICE_MAINTENANCE=3 INSTANCE_SELF_SERVICE_MAINTENANCE value - * @property {number} REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE=4 REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE value - */ - v1.SqlMaintenanceType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_MAINTENANCE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "INSTANCE_MAINTENANCE"] = 1; - values[valuesById[2] = "REPLICA_INCLUDED_MAINTENANCE"] = 2; - values[valuesById[3] = "INSTANCE_SELF_SERVICE_MAINTENANCE"] = 3; - values[valuesById[4] = "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE"] = 4; - return values; - })(); - - v1.SqlSubOperationType = (function() { - - /** - * Properties of a SqlSubOperationType. - * @memberof google.cloud.sql.v1 - * @interface ISqlSubOperationType - * @property {google.cloud.sql.v1.SqlMaintenanceType|null} [maintenanceType] SqlSubOperationType maintenanceType - */ - - /** - * Constructs a new SqlSubOperationType. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlSubOperationType. - * @implements ISqlSubOperationType - * @constructor - * @param {google.cloud.sql.v1.ISqlSubOperationType=} [properties] Properties to set - */ - function SqlSubOperationType(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlSubOperationType maintenanceType. - * @member {google.cloud.sql.v1.SqlMaintenanceType|null|undefined} maintenanceType - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @instance - */ - SqlSubOperationType.prototype.maintenanceType = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * SqlSubOperationType subOperationDetails. - * @member {"maintenanceType"|undefined} subOperationDetails - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @instance - */ - Object.defineProperty(SqlSubOperationType.prototype, "subOperationDetails", { - get: $util.oneOfGetter($oneOfFields = ["maintenanceType"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlSubOperationType instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @static - * @param {google.cloud.sql.v1.ISqlSubOperationType=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlSubOperationType} SqlSubOperationType instance - */ - SqlSubOperationType.create = function create(properties) { - return new SqlSubOperationType(properties); - }; - - /** - * Encodes the specified SqlSubOperationType message. Does not implicitly {@link google.cloud.sql.v1.SqlSubOperationType.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @static - * @param {google.cloud.sql.v1.ISqlSubOperationType} message SqlSubOperationType message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSubOperationType.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.maintenanceType != null && Object.hasOwnProperty.call(message, "maintenanceType")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.maintenanceType); - return writer; - }; - - /** - * Encodes the specified SqlSubOperationType message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSubOperationType.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @static - * @param {google.cloud.sql.v1.ISqlSubOperationType} message SqlSubOperationType message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSubOperationType.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlSubOperationType message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlSubOperationType} SqlSubOperationType - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSubOperationType.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlSubOperationType(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.maintenanceType = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlSubOperationType message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlSubOperationType} SqlSubOperationType - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSubOperationType.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlSubOperationType message. - * @function verify - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlSubOperationType.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.maintenanceType != null && message.hasOwnProperty("maintenanceType")) { - properties.subOperationDetails = 1; - switch (message.maintenanceType) { - default: - return "maintenanceType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - } - return null; - }; - - /** - * Creates a SqlSubOperationType message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlSubOperationType} SqlSubOperationType - */ - SqlSubOperationType.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlSubOperationType) - return object; - var message = new $root.google.cloud.sql.v1.SqlSubOperationType(); - switch (object.maintenanceType) { - default: - if (typeof object.maintenanceType === "number") { - message.maintenanceType = object.maintenanceType; - break; - } - break; - case "SQL_MAINTENANCE_TYPE_UNSPECIFIED": - case 0: - message.maintenanceType = 0; - break; - case "INSTANCE_MAINTENANCE": - case 1: - message.maintenanceType = 1; - break; - case "REPLICA_INCLUDED_MAINTENANCE": - case 2: - message.maintenanceType = 2; - break; - case "INSTANCE_SELF_SERVICE_MAINTENANCE": - case 3: - message.maintenanceType = 3; - break; - case "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE": - case 4: - message.maintenanceType = 4; - break; - } - return message; - }; - - /** - * Creates a plain object from a SqlSubOperationType message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @static - * @param {google.cloud.sql.v1.SqlSubOperationType} message SqlSubOperationType - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlSubOperationType.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.maintenanceType != null && message.hasOwnProperty("maintenanceType")) { - object.maintenanceType = options.enums === String ? $root.google.cloud.sql.v1.SqlMaintenanceType[message.maintenanceType] === undefined ? message.maintenanceType : $root.google.cloud.sql.v1.SqlMaintenanceType[message.maintenanceType] : message.maintenanceType; - if (options.oneofs) - object.subOperationDetails = "maintenanceType"; - } - return object; - }; - - /** - * Converts this SqlSubOperationType to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @instance - * @returns {Object.} JSON object - */ - SqlSubOperationType.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlSubOperationType - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlSubOperationType - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlSubOperationType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlSubOperationType"; - }; - - return SqlSubOperationType; - })(); - - v1.Operation = (function() { - - /** - * Properties of an Operation. - * @memberof google.cloud.sql.v1 - * @interface IOperation - * @property {string|null} [kind] Operation kind - * @property {string|null} [targetLink] Operation targetLink - * @property {google.cloud.sql.v1.Operation.SqlOperationStatus|null} [status] Operation status - * @property {string|null} [user] Operation user - * @property {google.protobuf.ITimestamp|null} [insertTime] Operation insertTime - * @property {google.protobuf.ITimestamp|null} [startTime] Operation startTime - * @property {google.protobuf.ITimestamp|null} [endTime] Operation endTime - * @property {google.cloud.sql.v1.IOperationErrors|null} [error] Operation error - * @property {google.cloud.sql.v1.IApiWarning|null} [apiWarning] Operation apiWarning - * @property {google.cloud.sql.v1.Operation.SqlOperationType|null} [operationType] Operation operationType - * @property {google.cloud.sql.v1.IImportContext|null} [importContext] Operation importContext - * @property {google.cloud.sql.v1.IExportContext|null} [exportContext] Operation exportContext - * @property {google.cloud.sql.v1.IBackupContext|null} [backupContext] Operation backupContext - * @property {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null} [preCheckMajorVersionUpgradeContext] Operation preCheckMajorVersionUpgradeContext - * @property {string|null} [name] Operation name - * @property {string|null} [targetId] Operation targetId - * @property {string|null} [selfLink] Operation selfLink - * @property {string|null} [targetProject] Operation targetProject - * @property {google.cloud.sql.v1.IAcquireSsrsLeaseContext|null} [acquireSsrsLeaseContext] Operation acquireSsrsLeaseContext - * @property {google.cloud.sql.v1.ISqlSubOperationType|null} [subOperationType] Operation subOperationType - */ - - /** - * Constructs a new Operation. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an Operation. - * @implements IOperation - * @constructor - * @param {google.cloud.sql.v1.IOperation=} [properties] Properties to set - */ - function Operation(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Operation kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.kind = ""; - - /** - * Operation targetLink. - * @member {string} targetLink - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.targetLink = ""; - - /** - * Operation status. - * @member {google.cloud.sql.v1.Operation.SqlOperationStatus} status - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.status = 0; - - /** - * Operation user. - * @member {string} user - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.user = ""; - - /** - * Operation insertTime. - * @member {google.protobuf.ITimestamp|null|undefined} insertTime - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.insertTime = null; - - /** - * Operation startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.startTime = null; - - /** - * Operation endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.endTime = null; - - /** - * Operation error. - * @member {google.cloud.sql.v1.IOperationErrors|null|undefined} error - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.error = null; - - /** - * Operation apiWarning. - * @member {google.cloud.sql.v1.IApiWarning|null|undefined} apiWarning - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.apiWarning = null; - - /** - * Operation operationType. - * @member {google.cloud.sql.v1.Operation.SqlOperationType} operationType - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.operationType = 0; - - /** - * Operation importContext. - * @member {google.cloud.sql.v1.IImportContext|null|undefined} importContext - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.importContext = null; - - /** - * Operation exportContext. - * @member {google.cloud.sql.v1.IExportContext|null|undefined} exportContext - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.exportContext = null; - - /** - * Operation backupContext. - * @member {google.cloud.sql.v1.IBackupContext|null|undefined} backupContext - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.backupContext = null; - - /** - * Operation preCheckMajorVersionUpgradeContext. - * @member {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null|undefined} preCheckMajorVersionUpgradeContext - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.preCheckMajorVersionUpgradeContext = null; - - /** - * Operation name. - * @member {string} name - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.name = ""; - - /** - * Operation targetId. - * @member {string} targetId - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.targetId = ""; - - /** - * Operation selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.selfLink = ""; - - /** - * Operation targetProject. - * @member {string} targetProject - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.targetProject = ""; - - /** - * Operation acquireSsrsLeaseContext. - * @member {google.cloud.sql.v1.IAcquireSsrsLeaseContext|null|undefined} acquireSsrsLeaseContext - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.acquireSsrsLeaseContext = null; - - /** - * Operation subOperationType. - * @member {google.cloud.sql.v1.ISqlSubOperationType|null|undefined} subOperationType - * @memberof google.cloud.sql.v1.Operation - * @instance - */ - Operation.prototype.subOperationType = null; - - /** - * Creates a new Operation instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.Operation - * @static - * @param {google.cloud.sql.v1.IOperation=} [properties] Properties to set - * @returns {google.cloud.sql.v1.Operation} Operation instance - */ - Operation.create = function create(properties) { - return new Operation(properties); - }; - - /** - * Encodes the specified Operation message. Does not implicitly {@link google.cloud.sql.v1.Operation.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.Operation - * @static - * @param {google.cloud.sql.v1.IOperation} message Operation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Operation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.targetLink != null && Object.hasOwnProperty.call(message, "targetLink")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetLink); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.status); - if (message.user != null && Object.hasOwnProperty.call(message, "user")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.user); - if (message.insertTime != null && Object.hasOwnProperty.call(message, "insertTime")) - $root.google.protobuf.Timestamp.encode(message.insertTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.cloud.sql.v1.OperationErrors.encode(message.error, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.operationType != null && Object.hasOwnProperty.call(message, "operationType")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.operationType); - if (message.importContext != null && Object.hasOwnProperty.call(message, "importContext")) - $root.google.cloud.sql.v1.ImportContext.encode(message.importContext, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.exportContext != null && Object.hasOwnProperty.call(message, "exportContext")) - $root.google.cloud.sql.v1.ExportContext.encode(message.exportContext, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.name); - if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.targetId); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.selfLink); - if (message.targetProject != null && Object.hasOwnProperty.call(message, "targetProject")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.targetProject); - if (message.backupContext != null && Object.hasOwnProperty.call(message, "backupContext")) - $root.google.cloud.sql.v1.BackupContext.encode(message.backupContext, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.apiWarning != null && Object.hasOwnProperty.call(message, "apiWarning")) - $root.google.cloud.sql.v1.ApiWarning.encode(message.apiWarning, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); - if (message.acquireSsrsLeaseContext != null && Object.hasOwnProperty.call(message, "acquireSsrsLeaseContext")) - $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.encode(message.acquireSsrsLeaseContext, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.subOperationType != null && Object.hasOwnProperty.call(message, "subOperationType")) - $root.google.cloud.sql.v1.SqlSubOperationType.encode(message.subOperationType, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); - if (message.preCheckMajorVersionUpgradeContext != null && Object.hasOwnProperty.call(message, "preCheckMajorVersionUpgradeContext")) - $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.encode(message.preCheckMajorVersionUpgradeContext, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Operation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.Operation - * @static - * @param {google.cloud.sql.v1.IOperation} message Operation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Operation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Operation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.Operation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.Operation} Operation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Operation.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Operation(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.targetLink = reader.string(); - break; - } - case 3: { - message.status = reader.int32(); - break; - } - case 4: { - message.user = reader.string(); - break; - } - case 5: { - message.insertTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 6: { - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 7: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 8: { - message.error = $root.google.cloud.sql.v1.OperationErrors.decode(reader, reader.uint32()); - break; - } - case 19: { - message.apiWarning = $root.google.cloud.sql.v1.ApiWarning.decode(reader, reader.uint32()); - break; - } - case 9: { - message.operationType = reader.int32(); - break; - } - case 10: { - message.importContext = $root.google.cloud.sql.v1.ImportContext.decode(reader, reader.uint32()); - break; - } - case 11: { - message.exportContext = $root.google.cloud.sql.v1.ExportContext.decode(reader, reader.uint32()); - break; - } - case 17: { - message.backupContext = $root.google.cloud.sql.v1.BackupContext.decode(reader, reader.uint32()); - break; - } - case 50: { - message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.decode(reader, reader.uint32()); - break; - } - case 12: { - message.name = reader.string(); - break; - } - case 13: { - message.targetId = reader.string(); - break; - } - case 14: { - message.selfLink = reader.string(); - break; - } - case 15: { - message.targetProject = reader.string(); - break; - } - case 20: { - message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.decode(reader, reader.uint32()); - break; - } - case 48: { - message.subOperationType = $root.google.cloud.sql.v1.SqlSubOperationType.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Operation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.Operation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.Operation} Operation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Operation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Operation message. - * @function verify - * @memberof google.cloud.sql.v1.Operation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Operation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.targetLink != null && message.hasOwnProperty("targetLink")) - if (!$util.isString(message.targetLink)) - return "targetLink: string expected"; - if (message.status != null && message.hasOwnProperty("status")) - switch (message.status) { - default: - return "status: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.user != null && message.hasOwnProperty("user")) - if (!$util.isString(message.user)) - return "user: string expected"; - if (message.insertTime != null && message.hasOwnProperty("insertTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.insertTime); - if (error) - return "insertTime." + error; - } - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.cloud.sql.v1.OperationErrors.verify(message.error); - if (error) - return "error." + error; - } - if (message.apiWarning != null && message.hasOwnProperty("apiWarning")) { - var error = $root.google.cloud.sql.v1.ApiWarning.verify(message.apiWarning); - if (error) - return "apiWarning." + error; - } - if (message.operationType != null && message.hasOwnProperty("operationType")) - switch (message.operationType) { - default: - return "operationType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - break; - } - if (message.importContext != null && message.hasOwnProperty("importContext")) { - var error = $root.google.cloud.sql.v1.ImportContext.verify(message.importContext); - if (error) - return "importContext." + error; - } - if (message.exportContext != null && message.hasOwnProperty("exportContext")) { - var error = $root.google.cloud.sql.v1.ExportContext.verify(message.exportContext); - if (error) - return "exportContext." + error; - } - if (message.backupContext != null && message.hasOwnProperty("backupContext")) { - var error = $root.google.cloud.sql.v1.BackupContext.verify(message.backupContext); - if (error) - return "backupContext." + error; - } - if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) { - var error = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify(message.preCheckMajorVersionUpgradeContext); - if (error) - return "preCheckMajorVersionUpgradeContext." + error; - } - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.targetId != null && message.hasOwnProperty("targetId")) - if (!$util.isString(message.targetId)) - return "targetId: string expected"; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.targetProject != null && message.hasOwnProperty("targetProject")) - if (!$util.isString(message.targetProject)) - return "targetProject: string expected"; - if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) { - var error = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.verify(message.acquireSsrsLeaseContext); - if (error) - return "acquireSsrsLeaseContext." + error; - } - if (message.subOperationType != null && message.hasOwnProperty("subOperationType")) { - var error = $root.google.cloud.sql.v1.SqlSubOperationType.verify(message.subOperationType); - if (error) - return "subOperationType." + error; - } - return null; - }; - - /** - * Creates an Operation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.Operation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.Operation} Operation - */ - Operation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.Operation) - return object; - var message = new $root.google.cloud.sql.v1.Operation(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.targetLink != null) - message.targetLink = String(object.targetLink); - switch (object.status) { - default: - if (typeof object.status === "number") { - message.status = object.status; - break; - } - break; - case "SQL_OPERATION_STATUS_UNSPECIFIED": - case 0: - message.status = 0; - break; - case "PENDING": - case 1: - message.status = 1; - break; - case "RUNNING": - case 2: - message.status = 2; - break; - case "DONE": - case 3: - message.status = 3; - break; - } - if (object.user != null) - message.user = String(object.user); - if (object.insertTime != null) { - if (typeof object.insertTime !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.insertTime: object expected"); - message.insertTime = $root.google.protobuf.Timestamp.fromObject(object.insertTime); - } - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.error: object expected"); - message.error = $root.google.cloud.sql.v1.OperationErrors.fromObject(object.error); - } - if (object.apiWarning != null) { - if (typeof object.apiWarning !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.apiWarning: object expected"); - message.apiWarning = $root.google.cloud.sql.v1.ApiWarning.fromObject(object.apiWarning); - } - switch (object.operationType) { - default: - if (typeof object.operationType === "number") { - message.operationType = object.operationType; - break; - } - break; - case "SQL_OPERATION_TYPE_UNSPECIFIED": - case 0: - message.operationType = 0; - break; - case "IMPORT": - case 1: - message.operationType = 1; - break; - case "EXPORT": - case 2: - message.operationType = 2; - break; - case "CREATE": - case 3: - message.operationType = 3; - break; - case "UPDATE": - case 4: - message.operationType = 4; - break; - case "DELETE": - case 5: - message.operationType = 5; - break; - case "RESTART": - case 6: - message.operationType = 6; - break; - case "BACKUP": - case 7: - message.operationType = 7; - break; - case "SNAPSHOT": - case 8: - message.operationType = 8; - break; - case "BACKUP_VOLUME": - case 9: - message.operationType = 9; - break; - case "DELETE_VOLUME": - case 10: - message.operationType = 10; - break; - case "RESTORE_VOLUME": - case 11: - message.operationType = 11; - break; - case "INJECT_USER": - case 12: - message.operationType = 12; - break; - case "CLONE": - case 14: - message.operationType = 14; - break; - case "STOP_REPLICA": - case 15: - message.operationType = 15; - break; - case "START_REPLICA": - case 16: - message.operationType = 16; - break; - case "PROMOTE_REPLICA": - case 17: - message.operationType = 17; - break; - case "CREATE_REPLICA": - case 18: - message.operationType = 18; - break; - case "CREATE_USER": - case 19: - message.operationType = 19; - break; - case "DELETE_USER": - case 20: - message.operationType = 20; - break; - case "UPDATE_USER": - case 21: - message.operationType = 21; - break; - case "CREATE_DATABASE": - case 22: - message.operationType = 22; - break; - case "DELETE_DATABASE": - case 23: - message.operationType = 23; - break; - case "UPDATE_DATABASE": - case 24: - message.operationType = 24; - break; - case "FAILOVER": - case 25: - message.operationType = 25; - break; - case "DELETE_BACKUP": - case 26: - message.operationType = 26; - break; - case "RECREATE_REPLICA": - case 27: - message.operationType = 27; - break; - case "TRUNCATE_LOG": - case 28: - message.operationType = 28; - break; - case "DEMOTE_MASTER": - case 29: - message.operationType = 29; - break; - case "MAINTENANCE": - case 30: - message.operationType = 30; - break; - case "ENABLE_PRIVATE_IP": - case 31: - message.operationType = 31; - break; - case "DEFER_MAINTENANCE": - case 32: - message.operationType = 32; - break; - case "CREATE_CLONE": - case 33: - message.operationType = 33; - break; - case "RESCHEDULE_MAINTENANCE": - case 34: - message.operationType = 34; - break; - case "START_EXTERNAL_SYNC": - case 35: - message.operationType = 35; - break; - case "LOG_CLEANUP": - case 36: - message.operationType = 36; - break; - case "AUTO_RESTART": - case 37: - message.operationType = 37; - break; - case "REENCRYPT": - case 38: - message.operationType = 38; - break; - case "SWITCHOVER": - case 39: - message.operationType = 39; - break; - case "UPDATE_BACKUP": - case 40: - message.operationType = 40; - break; - case "ACQUIRE_SSRS_LEASE": - case 42: - message.operationType = 42; - break; - case "RELEASE_SSRS_LEASE": - case 43: - message.operationType = 43; - break; - case "RECONFIGURE_OLD_PRIMARY": - case 44: - message.operationType = 44; - break; - case "CLUSTER_MAINTENANCE": - case 45: - message.operationType = 45; - break; - case "SELF_SERVICE_MAINTENANCE": - case 46: - message.operationType = 46; - break; - case "SWITCHOVER_TO_REPLICA": - case 47: - message.operationType = 47; - break; - case "MAJOR_VERSION_UPGRADE": - case 48: - message.operationType = 48; - break; - case "ADVANCED_BACKUP": - case 49: - message.operationType = 49; - break; - case "MANAGE_BACKUP": - case 50: - message.operationType = 50; - break; - case "ENHANCED_BACKUP": - case 51: - message.operationType = 51; - break; - case "REPAIR_READ_POOL": - case 52: - message.operationType = 52; - break; - case "CREATE_READ_POOL": - case 53: - message.operationType = 53; - break; - case "PRE_CHECK_MAJOR_VERSION_UPGRADE": - case 54: - message.operationType = 54; - break; - } - if (object.importContext != null) { - if (typeof object.importContext !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.importContext: object expected"); - message.importContext = $root.google.cloud.sql.v1.ImportContext.fromObject(object.importContext); - } - if (object.exportContext != null) { - if (typeof object.exportContext !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.exportContext: object expected"); - message.exportContext = $root.google.cloud.sql.v1.ExportContext.fromObject(object.exportContext); - } - if (object.backupContext != null) { - if (typeof object.backupContext !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.backupContext: object expected"); - message.backupContext = $root.google.cloud.sql.v1.BackupContext.fromObject(object.backupContext); - } - if (object.preCheckMajorVersionUpgradeContext != null) { - if (typeof object.preCheckMajorVersionUpgradeContext !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.preCheckMajorVersionUpgradeContext: object expected"); - message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.fromObject(object.preCheckMajorVersionUpgradeContext); - } - if (object.name != null) - message.name = String(object.name); - if (object.targetId != null) - message.targetId = String(object.targetId); - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - if (object.targetProject != null) - message.targetProject = String(object.targetProject); - if (object.acquireSsrsLeaseContext != null) { - if (typeof object.acquireSsrsLeaseContext !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.acquireSsrsLeaseContext: object expected"); - message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.fromObject(object.acquireSsrsLeaseContext); - } - if (object.subOperationType != null) { - if (typeof object.subOperationType !== "object") - throw TypeError(".google.cloud.sql.v1.Operation.subOperationType: object expected"); - message.subOperationType = $root.google.cloud.sql.v1.SqlSubOperationType.fromObject(object.subOperationType); - } - return message; - }; - - /** - * Creates a plain object from an Operation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.Operation - * @static - * @param {google.cloud.sql.v1.Operation} message Operation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Operation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.targetLink = ""; - object.status = options.enums === String ? "SQL_OPERATION_STATUS_UNSPECIFIED" : 0; - object.user = ""; - object.insertTime = null; - object.startTime = null; - object.endTime = null; - object.error = null; - object.operationType = options.enums === String ? "SQL_OPERATION_TYPE_UNSPECIFIED" : 0; - object.importContext = null; - object.exportContext = null; - object.name = ""; - object.targetId = ""; - object.selfLink = ""; - object.targetProject = ""; - object.backupContext = null; - object.apiWarning = null; - object.acquireSsrsLeaseContext = null; - object.subOperationType = null; - object.preCheckMajorVersionUpgradeContext = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.targetLink != null && message.hasOwnProperty("targetLink")) - object.targetLink = message.targetLink; - if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.google.cloud.sql.v1.Operation.SqlOperationStatus[message.status] === undefined ? message.status : $root.google.cloud.sql.v1.Operation.SqlOperationStatus[message.status] : message.status; - if (message.user != null && message.hasOwnProperty("user")) - object.user = message.user; - if (message.insertTime != null && message.hasOwnProperty("insertTime")) - object.insertTime = $root.google.protobuf.Timestamp.toObject(message.insertTime, options); - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.cloud.sql.v1.OperationErrors.toObject(message.error, options); - if (message.operationType != null && message.hasOwnProperty("operationType")) - object.operationType = options.enums === String ? $root.google.cloud.sql.v1.Operation.SqlOperationType[message.operationType] === undefined ? message.operationType : $root.google.cloud.sql.v1.Operation.SqlOperationType[message.operationType] : message.operationType; - if (message.importContext != null && message.hasOwnProperty("importContext")) - object.importContext = $root.google.cloud.sql.v1.ImportContext.toObject(message.importContext, options); - if (message.exportContext != null && message.hasOwnProperty("exportContext")) - object.exportContext = $root.google.cloud.sql.v1.ExportContext.toObject(message.exportContext, options); - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.targetId != null && message.hasOwnProperty("targetId")) - object.targetId = message.targetId; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.targetProject != null && message.hasOwnProperty("targetProject")) - object.targetProject = message.targetProject; - if (message.backupContext != null && message.hasOwnProperty("backupContext")) - object.backupContext = $root.google.cloud.sql.v1.BackupContext.toObject(message.backupContext, options); - if (message.apiWarning != null && message.hasOwnProperty("apiWarning")) - object.apiWarning = $root.google.cloud.sql.v1.ApiWarning.toObject(message.apiWarning, options); - if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) - object.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.toObject(message.acquireSsrsLeaseContext, options); - if (message.subOperationType != null && message.hasOwnProperty("subOperationType")) - object.subOperationType = $root.google.cloud.sql.v1.SqlSubOperationType.toObject(message.subOperationType, options); - if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) - object.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.toObject(message.preCheckMajorVersionUpgradeContext, options); - return object; - }; - - /** - * Converts this Operation to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.Operation - * @instance - * @returns {Object.} JSON object - */ - Operation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Operation - * @function getTypeUrl - * @memberof google.cloud.sql.v1.Operation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.Operation"; - }; - - /** - * SqlOperationType enum. - * @name google.cloud.sql.v1.Operation.SqlOperationType - * @enum {number} - * @property {number} SQL_OPERATION_TYPE_UNSPECIFIED=0 SQL_OPERATION_TYPE_UNSPECIFIED value - * @property {number} IMPORT=1 IMPORT value - * @property {number} EXPORT=2 EXPORT value - * @property {number} CREATE=3 CREATE value - * @property {number} UPDATE=4 UPDATE value - * @property {number} DELETE=5 DELETE value - * @property {number} RESTART=6 RESTART value - * @property {number} BACKUP=7 BACKUP value - * @property {number} SNAPSHOT=8 SNAPSHOT value - * @property {number} BACKUP_VOLUME=9 BACKUP_VOLUME value - * @property {number} DELETE_VOLUME=10 DELETE_VOLUME value - * @property {number} RESTORE_VOLUME=11 RESTORE_VOLUME value - * @property {number} INJECT_USER=12 INJECT_USER value - * @property {number} CLONE=14 CLONE value - * @property {number} STOP_REPLICA=15 STOP_REPLICA value - * @property {number} START_REPLICA=16 START_REPLICA value - * @property {number} PROMOTE_REPLICA=17 PROMOTE_REPLICA value - * @property {number} CREATE_REPLICA=18 CREATE_REPLICA value - * @property {number} CREATE_USER=19 CREATE_USER value - * @property {number} DELETE_USER=20 DELETE_USER value - * @property {number} UPDATE_USER=21 UPDATE_USER value - * @property {number} CREATE_DATABASE=22 CREATE_DATABASE value - * @property {number} DELETE_DATABASE=23 DELETE_DATABASE value - * @property {number} UPDATE_DATABASE=24 UPDATE_DATABASE value - * @property {number} FAILOVER=25 FAILOVER value - * @property {number} DELETE_BACKUP=26 DELETE_BACKUP value - * @property {number} RECREATE_REPLICA=27 RECREATE_REPLICA value - * @property {number} TRUNCATE_LOG=28 TRUNCATE_LOG value - * @property {number} DEMOTE_MASTER=29 DEMOTE_MASTER value - * @property {number} MAINTENANCE=30 MAINTENANCE value - * @property {number} ENABLE_PRIVATE_IP=31 ENABLE_PRIVATE_IP value - * @property {number} DEFER_MAINTENANCE=32 DEFER_MAINTENANCE value - * @property {number} CREATE_CLONE=33 CREATE_CLONE value - * @property {number} RESCHEDULE_MAINTENANCE=34 RESCHEDULE_MAINTENANCE value - * @property {number} START_EXTERNAL_SYNC=35 START_EXTERNAL_SYNC value - * @property {number} LOG_CLEANUP=36 LOG_CLEANUP value - * @property {number} AUTO_RESTART=37 AUTO_RESTART value - * @property {number} REENCRYPT=38 REENCRYPT value - * @property {number} SWITCHOVER=39 SWITCHOVER value - * @property {number} UPDATE_BACKUP=40 UPDATE_BACKUP value - * @property {number} ACQUIRE_SSRS_LEASE=42 ACQUIRE_SSRS_LEASE value - * @property {number} RELEASE_SSRS_LEASE=43 RELEASE_SSRS_LEASE value - * @property {number} RECONFIGURE_OLD_PRIMARY=44 RECONFIGURE_OLD_PRIMARY value - * @property {number} CLUSTER_MAINTENANCE=45 CLUSTER_MAINTENANCE value - * @property {number} SELF_SERVICE_MAINTENANCE=46 SELF_SERVICE_MAINTENANCE value - * @property {number} SWITCHOVER_TO_REPLICA=47 SWITCHOVER_TO_REPLICA value - * @property {number} MAJOR_VERSION_UPGRADE=48 MAJOR_VERSION_UPGRADE value - * @property {number} ADVANCED_BACKUP=49 ADVANCED_BACKUP value - * @property {number} MANAGE_BACKUP=50 MANAGE_BACKUP value - * @property {number} ENHANCED_BACKUP=51 ENHANCED_BACKUP value - * @property {number} REPAIR_READ_POOL=52 REPAIR_READ_POOL value - * @property {number} CREATE_READ_POOL=53 CREATE_READ_POOL value - * @property {number} PRE_CHECK_MAJOR_VERSION_UPGRADE=54 PRE_CHECK_MAJOR_VERSION_UPGRADE value - */ - Operation.SqlOperationType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_OPERATION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "IMPORT"] = 1; - values[valuesById[2] = "EXPORT"] = 2; - values[valuesById[3] = "CREATE"] = 3; - values[valuesById[4] = "UPDATE"] = 4; - values[valuesById[5] = "DELETE"] = 5; - values[valuesById[6] = "RESTART"] = 6; - values[valuesById[7] = "BACKUP"] = 7; - values[valuesById[8] = "SNAPSHOT"] = 8; - values[valuesById[9] = "BACKUP_VOLUME"] = 9; - values[valuesById[10] = "DELETE_VOLUME"] = 10; - values[valuesById[11] = "RESTORE_VOLUME"] = 11; - values[valuesById[12] = "INJECT_USER"] = 12; - values[valuesById[14] = "CLONE"] = 14; - values[valuesById[15] = "STOP_REPLICA"] = 15; - values[valuesById[16] = "START_REPLICA"] = 16; - values[valuesById[17] = "PROMOTE_REPLICA"] = 17; - values[valuesById[18] = "CREATE_REPLICA"] = 18; - values[valuesById[19] = "CREATE_USER"] = 19; - values[valuesById[20] = "DELETE_USER"] = 20; - values[valuesById[21] = "UPDATE_USER"] = 21; - values[valuesById[22] = "CREATE_DATABASE"] = 22; - values[valuesById[23] = "DELETE_DATABASE"] = 23; - values[valuesById[24] = "UPDATE_DATABASE"] = 24; - values[valuesById[25] = "FAILOVER"] = 25; - values[valuesById[26] = "DELETE_BACKUP"] = 26; - values[valuesById[27] = "RECREATE_REPLICA"] = 27; - values[valuesById[28] = "TRUNCATE_LOG"] = 28; - values[valuesById[29] = "DEMOTE_MASTER"] = 29; - values[valuesById[30] = "MAINTENANCE"] = 30; - values[valuesById[31] = "ENABLE_PRIVATE_IP"] = 31; - values[valuesById[32] = "DEFER_MAINTENANCE"] = 32; - values[valuesById[33] = "CREATE_CLONE"] = 33; - values[valuesById[34] = "RESCHEDULE_MAINTENANCE"] = 34; - values[valuesById[35] = "START_EXTERNAL_SYNC"] = 35; - values[valuesById[36] = "LOG_CLEANUP"] = 36; - values[valuesById[37] = "AUTO_RESTART"] = 37; - values[valuesById[38] = "REENCRYPT"] = 38; - values[valuesById[39] = "SWITCHOVER"] = 39; - values[valuesById[40] = "UPDATE_BACKUP"] = 40; - values[valuesById[42] = "ACQUIRE_SSRS_LEASE"] = 42; - values[valuesById[43] = "RELEASE_SSRS_LEASE"] = 43; - values[valuesById[44] = "RECONFIGURE_OLD_PRIMARY"] = 44; - values[valuesById[45] = "CLUSTER_MAINTENANCE"] = 45; - values[valuesById[46] = "SELF_SERVICE_MAINTENANCE"] = 46; - values[valuesById[47] = "SWITCHOVER_TO_REPLICA"] = 47; - values[valuesById[48] = "MAJOR_VERSION_UPGRADE"] = 48; - values[valuesById[49] = "ADVANCED_BACKUP"] = 49; - values[valuesById[50] = "MANAGE_BACKUP"] = 50; - values[valuesById[51] = "ENHANCED_BACKUP"] = 51; - values[valuesById[52] = "REPAIR_READ_POOL"] = 52; - values[valuesById[53] = "CREATE_READ_POOL"] = 53; - values[valuesById[54] = "PRE_CHECK_MAJOR_VERSION_UPGRADE"] = 54; - return values; - })(); - - /** - * SqlOperationStatus enum. - * @name google.cloud.sql.v1.Operation.SqlOperationStatus - * @enum {number} - * @property {number} SQL_OPERATION_STATUS_UNSPECIFIED=0 SQL_OPERATION_STATUS_UNSPECIFIED value - * @property {number} PENDING=1 PENDING value - * @property {number} RUNNING=2 RUNNING value - * @property {number} DONE=3 DONE value - */ - Operation.SqlOperationStatus = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_OPERATION_STATUS_UNSPECIFIED"] = 0; - values[valuesById[1] = "PENDING"] = 1; - values[valuesById[2] = "RUNNING"] = 2; - values[valuesById[3] = "DONE"] = 3; - return values; - })(); - - return Operation; - })(); - - v1.OperationError = (function() { - - /** - * Properties of an OperationError. - * @memberof google.cloud.sql.v1 - * @interface IOperationError - * @property {string|null} [kind] OperationError kind - * @property {string|null} [code] OperationError code - * @property {string|null} [message] OperationError message - */ - - /** - * Constructs a new OperationError. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an OperationError. - * @implements IOperationError - * @constructor - * @param {google.cloud.sql.v1.IOperationError=} [properties] Properties to set - */ - function OperationError(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OperationError kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.OperationError - * @instance - */ - OperationError.prototype.kind = ""; - - /** - * OperationError code. - * @member {string} code - * @memberof google.cloud.sql.v1.OperationError - * @instance - */ - OperationError.prototype.code = ""; - - /** - * OperationError message. - * @member {string} message - * @memberof google.cloud.sql.v1.OperationError - * @instance - */ - OperationError.prototype.message = ""; - - /** - * Creates a new OperationError instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.OperationError - * @static - * @param {google.cloud.sql.v1.IOperationError=} [properties] Properties to set - * @returns {google.cloud.sql.v1.OperationError} OperationError instance - */ - OperationError.create = function create(properties) { - return new OperationError(properties); - }; - - /** - * Encodes the specified OperationError message. Does not implicitly {@link google.cloud.sql.v1.OperationError.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.OperationError - * @static - * @param {google.cloud.sql.v1.IOperationError} message OperationError message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationError.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.code); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); - return writer; - }; - - /** - * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationError.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.OperationError - * @static - * @param {google.cloud.sql.v1.IOperationError} message OperationError message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationError.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationError message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.OperationError - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.OperationError} OperationError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationError.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.OperationError(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.code = reader.string(); - break; - } - case 3: { - message.message = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationError message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.OperationError - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.OperationError} OperationError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationError.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationError message. - * @function verify - * @memberof google.cloud.sql.v1.OperationError - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OperationError.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.code != null && message.hasOwnProperty("code")) - if (!$util.isString(message.code)) - return "code: string expected"; - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - return null; - }; - - /** - * Creates an OperationError message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.OperationError - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.OperationError} OperationError - */ - OperationError.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.OperationError) - return object; - var message = new $root.google.cloud.sql.v1.OperationError(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.code != null) - message.code = String(object.code); - if (object.message != null) - message.message = String(object.message); - return message; - }; - - /** - * Creates a plain object from an OperationError message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.OperationError - * @static - * @param {google.cloud.sql.v1.OperationError} message OperationError - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationError.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.code = ""; - object.message = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.code != null && message.hasOwnProperty("code")) - object.code = message.code; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - return object; - }; - - /** - * Converts this OperationError to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.OperationError - * @instance - * @returns {Object.} JSON object - */ - OperationError.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationError - * @function getTypeUrl - * @memberof google.cloud.sql.v1.OperationError - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.OperationError"; - }; - - return OperationError; - })(); - - v1.OperationErrors = (function() { - - /** - * Properties of an OperationErrors. - * @memberof google.cloud.sql.v1 - * @interface IOperationErrors - * @property {string|null} [kind] OperationErrors kind - * @property {Array.|null} [errors] OperationErrors errors - */ - - /** - * Constructs a new OperationErrors. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an OperationErrors. - * @implements IOperationErrors - * @constructor - * @param {google.cloud.sql.v1.IOperationErrors=} [properties] Properties to set - */ - function OperationErrors(properties) { - this.errors = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OperationErrors kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.OperationErrors - * @instance - */ - OperationErrors.prototype.kind = ""; - - /** - * OperationErrors errors. - * @member {Array.} errors - * @memberof google.cloud.sql.v1.OperationErrors - * @instance - */ - OperationErrors.prototype.errors = $util.emptyArray; - - /** - * Creates a new OperationErrors instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.OperationErrors - * @static - * @param {google.cloud.sql.v1.IOperationErrors=} [properties] Properties to set - * @returns {google.cloud.sql.v1.OperationErrors} OperationErrors instance - */ - OperationErrors.create = function create(properties) { - return new OperationErrors(properties); - }; - - /** - * Encodes the specified OperationErrors message. Does not implicitly {@link google.cloud.sql.v1.OperationErrors.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.OperationErrors - * @static - * @param {google.cloud.sql.v1.IOperationErrors} message OperationErrors message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationErrors.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.errors != null && message.errors.length) - for (var i = 0; i < message.errors.length; ++i) - $root.google.cloud.sql.v1.OperationError.encode(message.errors[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified OperationErrors message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationErrors.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.OperationErrors - * @static - * @param {google.cloud.sql.v1.IOperationErrors} message OperationErrors message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationErrors.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationErrors message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.OperationErrors - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.OperationErrors} OperationErrors - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationErrors.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.OperationErrors(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.errors && message.errors.length)) - message.errors = []; - message.errors.push($root.google.cloud.sql.v1.OperationError.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationErrors message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.OperationErrors - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.OperationErrors} OperationErrors - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationErrors.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationErrors message. - * @function verify - * @memberof google.cloud.sql.v1.OperationErrors - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OperationErrors.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.errors != null && message.hasOwnProperty("errors")) { - if (!Array.isArray(message.errors)) - return "errors: array expected"; - for (var i = 0; i < message.errors.length; ++i) { - var error = $root.google.cloud.sql.v1.OperationError.verify(message.errors[i]); - if (error) - return "errors." + error; - } - } - return null; - }; - - /** - * Creates an OperationErrors message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.OperationErrors - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.OperationErrors} OperationErrors - */ - OperationErrors.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.OperationErrors) - return object; - var message = new $root.google.cloud.sql.v1.OperationErrors(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.errors) { - if (!Array.isArray(object.errors)) - throw TypeError(".google.cloud.sql.v1.OperationErrors.errors: array expected"); - message.errors = []; - for (var i = 0; i < object.errors.length; ++i) { - if (typeof object.errors[i] !== "object") - throw TypeError(".google.cloud.sql.v1.OperationErrors.errors: object expected"); - message.errors[i] = $root.google.cloud.sql.v1.OperationError.fromObject(object.errors[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an OperationErrors message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.OperationErrors - * @static - * @param {google.cloud.sql.v1.OperationErrors} message OperationErrors - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationErrors.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.errors = []; - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.errors && message.errors.length) { - object.errors = []; - for (var j = 0; j < message.errors.length; ++j) - object.errors[j] = $root.google.cloud.sql.v1.OperationError.toObject(message.errors[j], options); - } - return object; - }; - - /** - * Converts this OperationErrors to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.OperationErrors - * @instance - * @returns {Object.} JSON object - */ - OperationErrors.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationErrors - * @function getTypeUrl - * @memberof google.cloud.sql.v1.OperationErrors - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationErrors.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.OperationErrors"; - }; - - return OperationErrors; - })(); - - v1.PasswordValidationPolicy = (function() { - - /** - * Properties of a PasswordValidationPolicy. - * @memberof google.cloud.sql.v1 - * @interface IPasswordValidationPolicy - * @property {google.protobuf.IInt32Value|null} [minLength] PasswordValidationPolicy minLength - * @property {google.cloud.sql.v1.PasswordValidationPolicy.Complexity|null} [complexity] PasswordValidationPolicy complexity - * @property {google.protobuf.IInt32Value|null} [reuseInterval] PasswordValidationPolicy reuseInterval - * @property {google.protobuf.IBoolValue|null} [disallowUsernameSubstring] PasswordValidationPolicy disallowUsernameSubstring - * @property {google.protobuf.IDuration|null} [passwordChangeInterval] PasswordValidationPolicy passwordChangeInterval - * @property {google.protobuf.IBoolValue|null} [enablePasswordPolicy] PasswordValidationPolicy enablePasswordPolicy - * @property {google.protobuf.IBoolValue|null} [disallowCompromisedCredentials] PasswordValidationPolicy disallowCompromisedCredentials - */ - - /** - * Constructs a new PasswordValidationPolicy. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a PasswordValidationPolicy. - * @implements IPasswordValidationPolicy - * @constructor - * @param {google.cloud.sql.v1.IPasswordValidationPolicy=} [properties] Properties to set - */ - function PasswordValidationPolicy(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PasswordValidationPolicy minLength. - * @member {google.protobuf.IInt32Value|null|undefined} minLength - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.minLength = null; - - /** - * PasswordValidationPolicy complexity. - * @member {google.cloud.sql.v1.PasswordValidationPolicy.Complexity} complexity - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.complexity = 0; - - /** - * PasswordValidationPolicy reuseInterval. - * @member {google.protobuf.IInt32Value|null|undefined} reuseInterval - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.reuseInterval = null; - - /** - * PasswordValidationPolicy disallowUsernameSubstring. - * @member {google.protobuf.IBoolValue|null|undefined} disallowUsernameSubstring - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.disallowUsernameSubstring = null; - - /** - * PasswordValidationPolicy passwordChangeInterval. - * @member {google.protobuf.IDuration|null|undefined} passwordChangeInterval - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.passwordChangeInterval = null; - - /** - * PasswordValidationPolicy enablePasswordPolicy. - * @member {google.protobuf.IBoolValue|null|undefined} enablePasswordPolicy - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.enablePasswordPolicy = null; - - /** - * PasswordValidationPolicy disallowCompromisedCredentials. - * @member {google.protobuf.IBoolValue|null|undefined} disallowCompromisedCredentials - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.disallowCompromisedCredentials = null; - - /** - * Creates a new PasswordValidationPolicy instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1.IPasswordValidationPolicy=} [properties] Properties to set - * @returns {google.cloud.sql.v1.PasswordValidationPolicy} PasswordValidationPolicy instance - */ - PasswordValidationPolicy.create = function create(properties) { - return new PasswordValidationPolicy(properties); - }; - - /** - * Encodes the specified PasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1.PasswordValidationPolicy.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1.IPasswordValidationPolicy} message PasswordValidationPolicy message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PasswordValidationPolicy.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.minLength != null && Object.hasOwnProperty.call(message, "minLength")) - $root.google.protobuf.Int32Value.encode(message.minLength, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.complexity != null && Object.hasOwnProperty.call(message, "complexity")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.complexity); - if (message.reuseInterval != null && Object.hasOwnProperty.call(message, "reuseInterval")) - $root.google.protobuf.Int32Value.encode(message.reuseInterval, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.disallowUsernameSubstring != null && Object.hasOwnProperty.call(message, "disallowUsernameSubstring")) - $root.google.protobuf.BoolValue.encode(message.disallowUsernameSubstring, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.passwordChangeInterval != null && Object.hasOwnProperty.call(message, "passwordChangeInterval")) - $root.google.protobuf.Duration.encode(message.passwordChangeInterval, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.enablePasswordPolicy != null && Object.hasOwnProperty.call(message, "enablePasswordPolicy")) - $root.google.protobuf.BoolValue.encode(message.enablePasswordPolicy, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.disallowCompromisedCredentials != null && Object.hasOwnProperty.call(message, "disallowCompromisedCredentials")) - $root.google.protobuf.BoolValue.encode(message.disallowCompromisedCredentials, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PasswordValidationPolicy.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1.IPasswordValidationPolicy} message PasswordValidationPolicy message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PasswordValidationPolicy.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PasswordValidationPolicy message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.PasswordValidationPolicy} PasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PasswordValidationPolicy.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PasswordValidationPolicy(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.minLength = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 2: { - message.complexity = reader.int32(); - break; - } - case 3: { - message.reuseInterval = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 4: { - message.disallowUsernameSubstring = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 5: { - message.passwordChangeInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - case 6: { - message.enablePasswordPolicy = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 7: { - message.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PasswordValidationPolicy message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.PasswordValidationPolicy} PasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PasswordValidationPolicy.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PasswordValidationPolicy message. - * @function verify - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PasswordValidationPolicy.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.minLength != null && message.hasOwnProperty("minLength")) { - var error = $root.google.protobuf.Int32Value.verify(message.minLength); - if (error) - return "minLength." + error; - } - if (message.complexity != null && message.hasOwnProperty("complexity")) - switch (message.complexity) { - default: - return "complexity: enum value expected"; - case 0: - case 1: - break; - } - if (message.reuseInterval != null && message.hasOwnProperty("reuseInterval")) { - var error = $root.google.protobuf.Int32Value.verify(message.reuseInterval); - if (error) - return "reuseInterval." + error; - } - if (message.disallowUsernameSubstring != null && message.hasOwnProperty("disallowUsernameSubstring")) { - var error = $root.google.protobuf.BoolValue.verify(message.disallowUsernameSubstring); - if (error) - return "disallowUsernameSubstring." + error; - } - if (message.passwordChangeInterval != null && message.hasOwnProperty("passwordChangeInterval")) { - var error = $root.google.protobuf.Duration.verify(message.passwordChangeInterval); - if (error) - return "passwordChangeInterval." + error; - } - if (message.enablePasswordPolicy != null && message.hasOwnProperty("enablePasswordPolicy")) { - var error = $root.google.protobuf.BoolValue.verify(message.enablePasswordPolicy); - if (error) - return "enablePasswordPolicy." + error; - } - if (message.disallowCompromisedCredentials != null && message.hasOwnProperty("disallowCompromisedCredentials")) { - var error = $root.google.protobuf.BoolValue.verify(message.disallowCompromisedCredentials); - if (error) - return "disallowCompromisedCredentials." + error; - } - return null; - }; - - /** - * Creates a PasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.PasswordValidationPolicy} PasswordValidationPolicy - */ - PasswordValidationPolicy.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.PasswordValidationPolicy) - return object; - var message = new $root.google.cloud.sql.v1.PasswordValidationPolicy(); - if (object.minLength != null) { - if (typeof object.minLength !== "object") - throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.minLength: object expected"); - message.minLength = $root.google.protobuf.Int32Value.fromObject(object.minLength); - } - switch (object.complexity) { - default: - if (typeof object.complexity === "number") { - message.complexity = object.complexity; - break; - } - break; - case "COMPLEXITY_UNSPECIFIED": - case 0: - message.complexity = 0; - break; - case "COMPLEXITY_DEFAULT": - case 1: - message.complexity = 1; - break; - } - if (object.reuseInterval != null) { - if (typeof object.reuseInterval !== "object") - throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.reuseInterval: object expected"); - message.reuseInterval = $root.google.protobuf.Int32Value.fromObject(object.reuseInterval); - } - if (object.disallowUsernameSubstring != null) { - if (typeof object.disallowUsernameSubstring !== "object") - throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.disallowUsernameSubstring: object expected"); - message.disallowUsernameSubstring = $root.google.protobuf.BoolValue.fromObject(object.disallowUsernameSubstring); - } - if (object.passwordChangeInterval != null) { - if (typeof object.passwordChangeInterval !== "object") - throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.passwordChangeInterval: object expected"); - message.passwordChangeInterval = $root.google.protobuf.Duration.fromObject(object.passwordChangeInterval); - } - if (object.enablePasswordPolicy != null) { - if (typeof object.enablePasswordPolicy !== "object") - throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.enablePasswordPolicy: object expected"); - message.enablePasswordPolicy = $root.google.protobuf.BoolValue.fromObject(object.enablePasswordPolicy); - } - if (object.disallowCompromisedCredentials != null) { - if (typeof object.disallowCompromisedCredentials !== "object") - throw TypeError(".google.cloud.sql.v1.PasswordValidationPolicy.disallowCompromisedCredentials: object expected"); - message.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.fromObject(object.disallowCompromisedCredentials); - } - return message; - }; - - /** - * Creates a plain object from a PasswordValidationPolicy message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1.PasswordValidationPolicy} message PasswordValidationPolicy - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PasswordValidationPolicy.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.minLength = null; - object.complexity = options.enums === String ? "COMPLEXITY_UNSPECIFIED" : 0; - object.reuseInterval = null; - object.disallowUsernameSubstring = null; - object.passwordChangeInterval = null; - object.enablePasswordPolicy = null; - object.disallowCompromisedCredentials = null; - } - if (message.minLength != null && message.hasOwnProperty("minLength")) - object.minLength = $root.google.protobuf.Int32Value.toObject(message.minLength, options); - if (message.complexity != null && message.hasOwnProperty("complexity")) - object.complexity = options.enums === String ? $root.google.cloud.sql.v1.PasswordValidationPolicy.Complexity[message.complexity] === undefined ? message.complexity : $root.google.cloud.sql.v1.PasswordValidationPolicy.Complexity[message.complexity] : message.complexity; - if (message.reuseInterval != null && message.hasOwnProperty("reuseInterval")) - object.reuseInterval = $root.google.protobuf.Int32Value.toObject(message.reuseInterval, options); - if (message.disallowUsernameSubstring != null && message.hasOwnProperty("disallowUsernameSubstring")) - object.disallowUsernameSubstring = $root.google.protobuf.BoolValue.toObject(message.disallowUsernameSubstring, options); - if (message.passwordChangeInterval != null && message.hasOwnProperty("passwordChangeInterval")) - object.passwordChangeInterval = $root.google.protobuf.Duration.toObject(message.passwordChangeInterval, options); - if (message.enablePasswordPolicy != null && message.hasOwnProperty("enablePasswordPolicy")) - object.enablePasswordPolicy = $root.google.protobuf.BoolValue.toObject(message.enablePasswordPolicy, options); - if (message.disallowCompromisedCredentials != null && message.hasOwnProperty("disallowCompromisedCredentials")) - object.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.toObject(message.disallowCompromisedCredentials, options); - return object; - }; - - /** - * Converts this PasswordValidationPolicy to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @instance - * @returns {Object.} JSON object - */ - PasswordValidationPolicy.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PasswordValidationPolicy - * @function getTypeUrl - * @memberof google.cloud.sql.v1.PasswordValidationPolicy - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PasswordValidationPolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.PasswordValidationPolicy"; - }; - - /** - * Complexity enum. - * @name google.cloud.sql.v1.PasswordValidationPolicy.Complexity - * @enum {number} - * @property {number} COMPLEXITY_UNSPECIFIED=0 COMPLEXITY_UNSPECIFIED value - * @property {number} COMPLEXITY_DEFAULT=1 COMPLEXITY_DEFAULT value - */ - PasswordValidationPolicy.Complexity = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "COMPLEXITY_UNSPECIFIED"] = 0; - values[valuesById[1] = "COMPLEXITY_DEFAULT"] = 1; - return values; - })(); - - return PasswordValidationPolicy; - })(); - - v1.DataCacheConfig = (function() { - - /** - * Properties of a DataCacheConfig. - * @memberof google.cloud.sql.v1 - * @interface IDataCacheConfig - * @property {boolean|null} [dataCacheEnabled] DataCacheConfig dataCacheEnabled - */ - - /** - * Constructs a new DataCacheConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DataCacheConfig. - * @implements IDataCacheConfig - * @constructor - * @param {google.cloud.sql.v1.IDataCacheConfig=} [properties] Properties to set - */ - function DataCacheConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DataCacheConfig dataCacheEnabled. - * @member {boolean} dataCacheEnabled - * @memberof google.cloud.sql.v1.DataCacheConfig - * @instance - */ - DataCacheConfig.prototype.dataCacheEnabled = false; - - /** - * Creates a new DataCacheConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DataCacheConfig - * @static - * @param {google.cloud.sql.v1.IDataCacheConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DataCacheConfig} DataCacheConfig instance - */ - DataCacheConfig.create = function create(properties) { - return new DataCacheConfig(properties); - }; - - /** - * Encodes the specified DataCacheConfig message. Does not implicitly {@link google.cloud.sql.v1.DataCacheConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DataCacheConfig - * @static - * @param {google.cloud.sql.v1.IDataCacheConfig} message DataCacheConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DataCacheConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dataCacheEnabled != null && Object.hasOwnProperty.call(message, "dataCacheEnabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.dataCacheEnabled); - return writer; - }; - - /** - * Encodes the specified DataCacheConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DataCacheConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DataCacheConfig - * @static - * @param {google.cloud.sql.v1.IDataCacheConfig} message DataCacheConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DataCacheConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DataCacheConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DataCacheConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DataCacheConfig} DataCacheConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DataCacheConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DataCacheConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.dataCacheEnabled = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DataCacheConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DataCacheConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DataCacheConfig} DataCacheConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DataCacheConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DataCacheConfig message. - * @function verify - * @memberof google.cloud.sql.v1.DataCacheConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DataCacheConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dataCacheEnabled != null && message.hasOwnProperty("dataCacheEnabled")) - if (typeof message.dataCacheEnabled !== "boolean") - return "dataCacheEnabled: boolean expected"; - return null; - }; - - /** - * Creates a DataCacheConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DataCacheConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DataCacheConfig} DataCacheConfig - */ - DataCacheConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DataCacheConfig) - return object; - var message = new $root.google.cloud.sql.v1.DataCacheConfig(); - if (object.dataCacheEnabled != null) - message.dataCacheEnabled = Boolean(object.dataCacheEnabled); - return message; - }; - - /** - * Creates a plain object from a DataCacheConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DataCacheConfig - * @static - * @param {google.cloud.sql.v1.DataCacheConfig} message DataCacheConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DataCacheConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.dataCacheEnabled = false; - if (message.dataCacheEnabled != null && message.hasOwnProperty("dataCacheEnabled")) - object.dataCacheEnabled = message.dataCacheEnabled; - return object; - }; - - /** - * Converts this DataCacheConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DataCacheConfig - * @instance - * @returns {Object.} JSON object - */ - DataCacheConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DataCacheConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DataCacheConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DataCacheConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DataCacheConfig"; - }; - - return DataCacheConfig; - })(); - - v1.FinalBackupConfig = (function() { - - /** - * Properties of a FinalBackupConfig. - * @memberof google.cloud.sql.v1 - * @interface IFinalBackupConfig - * @property {boolean|null} [enabled] FinalBackupConfig enabled - * @property {number|null} [retentionDays] FinalBackupConfig retentionDays - */ - - /** - * Constructs a new FinalBackupConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a FinalBackupConfig. - * @implements IFinalBackupConfig - * @constructor - * @param {google.cloud.sql.v1.IFinalBackupConfig=} [properties] Properties to set - */ - function FinalBackupConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FinalBackupConfig enabled. - * @member {boolean|null|undefined} enabled - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @instance - */ - FinalBackupConfig.prototype.enabled = null; - - /** - * FinalBackupConfig retentionDays. - * @member {number|null|undefined} retentionDays - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @instance - */ - FinalBackupConfig.prototype.retentionDays = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(FinalBackupConfig.prototype, "_enabled", { - get: $util.oneOfGetter($oneOfFields = ["enabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(FinalBackupConfig.prototype, "_retentionDays", { - get: $util.oneOfGetter($oneOfFields = ["retentionDays"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new FinalBackupConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @static - * @param {google.cloud.sql.v1.IFinalBackupConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.FinalBackupConfig} FinalBackupConfig instance - */ - FinalBackupConfig.create = function create(properties) { - return new FinalBackupConfig(properties); - }; - - /** - * Encodes the specified FinalBackupConfig message. Does not implicitly {@link google.cloud.sql.v1.FinalBackupConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @static - * @param {google.cloud.sql.v1.IFinalBackupConfig} message FinalBackupConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FinalBackupConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); - if (message.retentionDays != null && Object.hasOwnProperty.call(message, "retentionDays")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.retentionDays); - return writer; - }; - - /** - * Encodes the specified FinalBackupConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FinalBackupConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @static - * @param {google.cloud.sql.v1.IFinalBackupConfig} message FinalBackupConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FinalBackupConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FinalBackupConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.FinalBackupConfig} FinalBackupConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FinalBackupConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.FinalBackupConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.enabled = reader.bool(); - break; - } - case 3: { - message.retentionDays = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FinalBackupConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.FinalBackupConfig} FinalBackupConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FinalBackupConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FinalBackupConfig message. - * @function verify - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FinalBackupConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - properties._enabled = 1; - if (typeof message.enabled !== "boolean") - return "enabled: boolean expected"; - } - if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) { - properties._retentionDays = 1; - if (!$util.isInteger(message.retentionDays)) - return "retentionDays: integer expected"; - } - return null; - }; - - /** - * Creates a FinalBackupConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.FinalBackupConfig} FinalBackupConfig - */ - FinalBackupConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.FinalBackupConfig) - return object; - var message = new $root.google.cloud.sql.v1.FinalBackupConfig(); - if (object.enabled != null) - message.enabled = Boolean(object.enabled); - if (object.retentionDays != null) - message.retentionDays = object.retentionDays | 0; - return message; - }; - - /** - * Creates a plain object from a FinalBackupConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @static - * @param {google.cloud.sql.v1.FinalBackupConfig} message FinalBackupConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FinalBackupConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - object.enabled = message.enabled; - if (options.oneofs) - object._enabled = "enabled"; - } - if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) { - object.retentionDays = message.retentionDays; - if (options.oneofs) - object._retentionDays = "retentionDays"; - } - return object; - }; - - /** - * Converts this FinalBackupConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @instance - * @returns {Object.} JSON object - */ - FinalBackupConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FinalBackupConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.FinalBackupConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FinalBackupConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.FinalBackupConfig"; - }; - - return FinalBackupConfig; - })(); - - v1.Settings = (function() { - - /** - * Properties of a Settings. - * @memberof google.cloud.sql.v1 - * @interface ISettings - * @property {google.protobuf.IInt64Value|null} [settingsVersion] Settings settingsVersion - * @property {Array.|null} [authorizedGaeApplications] Settings authorizedGaeApplications - * @property {string|null} [tier] Settings tier - * @property {string|null} [kind] Settings kind - * @property {Object.|null} [userLabels] Settings userLabels - * @property {google.cloud.sql.v1.SqlAvailabilityType|null} [availabilityType] Settings availabilityType - * @property {google.cloud.sql.v1.SqlPricingPlan|null} [pricingPlan] Settings pricingPlan - * @property {google.cloud.sql.v1.SqlReplicationType|null} [replicationType] Settings replicationType - * @property {google.protobuf.IInt64Value|null} [storageAutoResizeLimit] Settings storageAutoResizeLimit - * @property {google.cloud.sql.v1.Settings.SqlActivationPolicy|null} [activationPolicy] Settings activationPolicy - * @property {google.cloud.sql.v1.IIpConfiguration|null} [ipConfiguration] Settings ipConfiguration - * @property {google.protobuf.IBoolValue|null} [storageAutoResize] Settings storageAutoResize - * @property {google.cloud.sql.v1.ILocationPreference|null} [locationPreference] Settings locationPreference - * @property {Array.|null} [databaseFlags] Settings databaseFlags - * @property {google.cloud.sql.v1.SqlDataDiskType|null} [dataDiskType] Settings dataDiskType - * @property {google.cloud.sql.v1.IMaintenanceWindow|null} [maintenanceWindow] Settings maintenanceWindow - * @property {google.cloud.sql.v1.IBackupConfiguration|null} [backupConfiguration] Settings backupConfiguration - * @property {google.protobuf.IBoolValue|null} [databaseReplicationEnabled] Settings databaseReplicationEnabled - * @property {google.protobuf.IBoolValue|null} [crashSafeReplicationEnabled] Settings crashSafeReplicationEnabled - * @property {google.protobuf.IInt64Value|null} [dataDiskSizeGb] Settings dataDiskSizeGb - * @property {google.cloud.sql.v1.ISqlActiveDirectoryConfig|null} [activeDirectoryConfig] Settings activeDirectoryConfig - * @property {string|null} [collation] Settings collation - * @property {Array.|null} [denyMaintenancePeriods] Settings denyMaintenancePeriods - * @property {google.cloud.sql.v1.IInsightsConfig|null} [insightsConfig] Settings insightsConfig - * @property {google.cloud.sql.v1.IPasswordValidationPolicy|null} [passwordValidationPolicy] Settings passwordValidationPolicy - * @property {google.cloud.sql.v1.ISqlServerAuditConfig|null} [sqlServerAuditConfig] Settings sqlServerAuditConfig - * @property {google.cloud.sql.v1.Settings.Edition|null} [edition] Settings edition - * @property {google.cloud.sql.v1.Settings.ConnectorEnforcement|null} [connectorEnforcement] Settings connectorEnforcement - * @property {google.protobuf.IBoolValue|null} [deletionProtectionEnabled] Settings deletionProtectionEnabled - * @property {string|null} [timeZone] Settings timeZone - * @property {google.cloud.sql.v1.IAdvancedMachineFeatures|null} [advancedMachineFeatures] Settings advancedMachineFeatures - * @property {google.cloud.sql.v1.IDataCacheConfig|null} [dataCacheConfig] Settings dataCacheConfig - * @property {google.protobuf.IInt32Value|null} [replicationLagMaxSeconds] Settings replicationLagMaxSeconds - * @property {google.protobuf.IBoolValue|null} [enableGoogleMlIntegration] Settings enableGoogleMlIntegration - * @property {google.protobuf.IBoolValue|null} [enableDataplexIntegration] Settings enableDataplexIntegration - * @property {google.protobuf.IBoolValue|null} [retainBackupsOnDelete] Settings retainBackupsOnDelete - * @property {number|Long|null} [dataDiskProvisionedIops] Settings dataDiskProvisionedIops - * @property {number|Long|null} [dataDiskProvisionedThroughput] Settings dataDiskProvisionedThroughput - * @property {google.cloud.sql.v1.IConnectionPoolConfig|null} [connectionPoolConfig] Settings connectionPoolConfig - * @property {google.cloud.sql.v1.IFinalBackupConfig|null} [finalBackupConfig] Settings finalBackupConfig - * @property {google.cloud.sql.v1.IReadPoolAutoScaleConfig|null} [readPoolAutoScaleConfig] Settings readPoolAutoScaleConfig - * @property {google.protobuf.IBoolValue|null} [acceleratedReplicaMode] Settings acceleratedReplicaMode - * @property {boolean|null} [autoUpgradeEnabled] Settings autoUpgradeEnabled - * @property {google.cloud.sql.v1.ISqlServerEntraIdConfig|null} [entraidConfig] Settings entraidConfig - * @property {google.cloud.sql.v1.Settings.DataApiAccess|null} [dataApiAccess] Settings dataApiAccess - * @property {google.cloud.sql.v1.IPerformanceCaptureConfig|null} [performanceCaptureConfig] Settings performanceCaptureConfig - */ - - /** - * Constructs a new Settings. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a Settings. - * @implements ISettings - * @constructor - * @param {google.cloud.sql.v1.ISettings=} [properties] Properties to set - */ - function Settings(properties) { - this.authorizedGaeApplications = []; - this.userLabels = {}; - this.databaseFlags = []; - this.denyMaintenancePeriods = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Settings settingsVersion. - * @member {google.protobuf.IInt64Value|null|undefined} settingsVersion - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.settingsVersion = null; - - /** - * Settings authorizedGaeApplications. - * @member {Array.} authorizedGaeApplications - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.authorizedGaeApplications = $util.emptyArray; - - /** - * Settings tier. - * @member {string} tier - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.tier = ""; - - /** - * Settings kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.kind = ""; - - /** - * Settings userLabels. - * @member {Object.} userLabels - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.userLabels = $util.emptyObject; - - /** - * Settings availabilityType. - * @member {google.cloud.sql.v1.SqlAvailabilityType} availabilityType - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.availabilityType = 0; - - /** - * Settings pricingPlan. - * @member {google.cloud.sql.v1.SqlPricingPlan} pricingPlan - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.pricingPlan = 0; - - /** - * Settings replicationType. - * @member {google.cloud.sql.v1.SqlReplicationType} replicationType - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.replicationType = 0; - - /** - * Settings storageAutoResizeLimit. - * @member {google.protobuf.IInt64Value|null|undefined} storageAutoResizeLimit - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.storageAutoResizeLimit = null; - - /** - * Settings activationPolicy. - * @member {google.cloud.sql.v1.Settings.SqlActivationPolicy} activationPolicy - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.activationPolicy = 0; - - /** - * Settings ipConfiguration. - * @member {google.cloud.sql.v1.IIpConfiguration|null|undefined} ipConfiguration - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.ipConfiguration = null; - - /** - * Settings storageAutoResize. - * @member {google.protobuf.IBoolValue|null|undefined} storageAutoResize - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.storageAutoResize = null; - - /** - * Settings locationPreference. - * @member {google.cloud.sql.v1.ILocationPreference|null|undefined} locationPreference - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.locationPreference = null; - - /** - * Settings databaseFlags. - * @member {Array.} databaseFlags - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.databaseFlags = $util.emptyArray; - - /** - * Settings dataDiskType. - * @member {google.cloud.sql.v1.SqlDataDiskType} dataDiskType - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.dataDiskType = 0; - - /** - * Settings maintenanceWindow. - * @member {google.cloud.sql.v1.IMaintenanceWindow|null|undefined} maintenanceWindow - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.maintenanceWindow = null; - - /** - * Settings backupConfiguration. - * @member {google.cloud.sql.v1.IBackupConfiguration|null|undefined} backupConfiguration - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.backupConfiguration = null; - - /** - * Settings databaseReplicationEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} databaseReplicationEnabled - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.databaseReplicationEnabled = null; - - /** - * Settings crashSafeReplicationEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} crashSafeReplicationEnabled - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.crashSafeReplicationEnabled = null; - - /** - * Settings dataDiskSizeGb. - * @member {google.protobuf.IInt64Value|null|undefined} dataDiskSizeGb - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.dataDiskSizeGb = null; - - /** - * Settings activeDirectoryConfig. - * @member {google.cloud.sql.v1.ISqlActiveDirectoryConfig|null|undefined} activeDirectoryConfig - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.activeDirectoryConfig = null; - - /** - * Settings collation. - * @member {string} collation - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.collation = ""; - - /** - * Settings denyMaintenancePeriods. - * @member {Array.} denyMaintenancePeriods - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.denyMaintenancePeriods = $util.emptyArray; - - /** - * Settings insightsConfig. - * @member {google.cloud.sql.v1.IInsightsConfig|null|undefined} insightsConfig - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.insightsConfig = null; - - /** - * Settings passwordValidationPolicy. - * @member {google.cloud.sql.v1.IPasswordValidationPolicy|null|undefined} passwordValidationPolicy - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.passwordValidationPolicy = null; - - /** - * Settings sqlServerAuditConfig. - * @member {google.cloud.sql.v1.ISqlServerAuditConfig|null|undefined} sqlServerAuditConfig - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.sqlServerAuditConfig = null; - - /** - * Settings edition. - * @member {google.cloud.sql.v1.Settings.Edition} edition - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.edition = 0; - - /** - * Settings connectorEnforcement. - * @member {google.cloud.sql.v1.Settings.ConnectorEnforcement} connectorEnforcement - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.connectorEnforcement = 0; - - /** - * Settings deletionProtectionEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} deletionProtectionEnabled - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.deletionProtectionEnabled = null; - - /** - * Settings timeZone. - * @member {string} timeZone - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.timeZone = ""; - - /** - * Settings advancedMachineFeatures. - * @member {google.cloud.sql.v1.IAdvancedMachineFeatures|null|undefined} advancedMachineFeatures - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.advancedMachineFeatures = null; - - /** - * Settings dataCacheConfig. - * @member {google.cloud.sql.v1.IDataCacheConfig|null|undefined} dataCacheConfig - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.dataCacheConfig = null; - - /** - * Settings replicationLagMaxSeconds. - * @member {google.protobuf.IInt32Value|null|undefined} replicationLagMaxSeconds - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.replicationLagMaxSeconds = null; - - /** - * Settings enableGoogleMlIntegration. - * @member {google.protobuf.IBoolValue|null|undefined} enableGoogleMlIntegration - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.enableGoogleMlIntegration = null; - - /** - * Settings enableDataplexIntegration. - * @member {google.protobuf.IBoolValue|null|undefined} enableDataplexIntegration - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.enableDataplexIntegration = null; - - /** - * Settings retainBackupsOnDelete. - * @member {google.protobuf.IBoolValue|null|undefined} retainBackupsOnDelete - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.retainBackupsOnDelete = null; - - /** - * Settings dataDiskProvisionedIops. - * @member {number|Long|null|undefined} dataDiskProvisionedIops - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.dataDiskProvisionedIops = null; - - /** - * Settings dataDiskProvisionedThroughput. - * @member {number|Long|null|undefined} dataDiskProvisionedThroughput - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.dataDiskProvisionedThroughput = null; - - /** - * Settings connectionPoolConfig. - * @member {google.cloud.sql.v1.IConnectionPoolConfig|null|undefined} connectionPoolConfig - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.connectionPoolConfig = null; - - /** - * Settings finalBackupConfig. - * @member {google.cloud.sql.v1.IFinalBackupConfig|null|undefined} finalBackupConfig - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.finalBackupConfig = null; - - /** - * Settings readPoolAutoScaleConfig. - * @member {google.cloud.sql.v1.IReadPoolAutoScaleConfig|null|undefined} readPoolAutoScaleConfig - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.readPoolAutoScaleConfig = null; - - /** - * Settings acceleratedReplicaMode. - * @member {google.protobuf.IBoolValue|null|undefined} acceleratedReplicaMode - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.acceleratedReplicaMode = null; - - /** - * Settings autoUpgradeEnabled. - * @member {boolean|null|undefined} autoUpgradeEnabled - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.autoUpgradeEnabled = null; - - /** - * Settings entraidConfig. - * @member {google.cloud.sql.v1.ISqlServerEntraIdConfig|null|undefined} entraidConfig - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.entraidConfig = null; - - /** - * Settings dataApiAccess. - * @member {google.cloud.sql.v1.Settings.DataApiAccess|null|undefined} dataApiAccess - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.dataApiAccess = null; - - /** - * Settings performanceCaptureConfig. - * @member {google.cloud.sql.v1.IPerformanceCaptureConfig|null|undefined} performanceCaptureConfig - * @memberof google.cloud.sql.v1.Settings - * @instance - */ - Settings.prototype.performanceCaptureConfig = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_dataDiskProvisionedIops", { - get: $util.oneOfGetter($oneOfFields = ["dataDiskProvisionedIops"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_dataDiskProvisionedThroughput", { - get: $util.oneOfGetter($oneOfFields = ["dataDiskProvisionedThroughput"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_connectionPoolConfig", { - get: $util.oneOfGetter($oneOfFields = ["connectionPoolConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_finalBackupConfig", { - get: $util.oneOfGetter($oneOfFields = ["finalBackupConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_readPoolAutoScaleConfig", { - get: $util.oneOfGetter($oneOfFields = ["readPoolAutoScaleConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_autoUpgradeEnabled", { - get: $util.oneOfGetter($oneOfFields = ["autoUpgradeEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_dataApiAccess", { - get: $util.oneOfGetter($oneOfFields = ["dataApiAccess"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Settings instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.Settings - * @static - * @param {google.cloud.sql.v1.ISettings=} [properties] Properties to set - * @returns {google.cloud.sql.v1.Settings} Settings instance - */ - Settings.create = function create(properties) { - return new Settings(properties); - }; - - /** - * Encodes the specified Settings message. Does not implicitly {@link google.cloud.sql.v1.Settings.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.Settings - * @static - * @param {google.cloud.sql.v1.ISettings} message Settings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Settings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.settingsVersion != null && Object.hasOwnProperty.call(message, "settingsVersion")) - $root.google.protobuf.Int64Value.encode(message.settingsVersion, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.authorizedGaeApplications != null && message.authorizedGaeApplications.length) - for (var i = 0; i < message.authorizedGaeApplications.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.authorizedGaeApplications[i]); - if (message.tier != null && Object.hasOwnProperty.call(message, "tier")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.tier); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); - if (message.userLabels != null && Object.hasOwnProperty.call(message, "userLabels")) - for (var keys = Object.keys(message.userLabels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.userLabels[keys[i]]).ldelim(); - if (message.availabilityType != null && Object.hasOwnProperty.call(message, "availabilityType")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.availabilityType); - if (message.pricingPlan != null && Object.hasOwnProperty.call(message, "pricingPlan")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pricingPlan); - if (message.replicationType != null && Object.hasOwnProperty.call(message, "replicationType")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.replicationType); - if (message.storageAutoResizeLimit != null && Object.hasOwnProperty.call(message, "storageAutoResizeLimit")) - $root.google.protobuf.Int64Value.encode(message.storageAutoResizeLimit, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.activationPolicy != null && Object.hasOwnProperty.call(message, "activationPolicy")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.activationPolicy); - if (message.ipConfiguration != null && Object.hasOwnProperty.call(message, "ipConfiguration")) - $root.google.cloud.sql.v1.IpConfiguration.encode(message.ipConfiguration, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.storageAutoResize != null && Object.hasOwnProperty.call(message, "storageAutoResize")) - $root.google.protobuf.BoolValue.encode(message.storageAutoResize, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.locationPreference != null && Object.hasOwnProperty.call(message, "locationPreference")) - $root.google.cloud.sql.v1.LocationPreference.encode(message.locationPreference, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.databaseFlags != null && message.databaseFlags.length) - for (var i = 0; i < message.databaseFlags.length; ++i) - $root.google.cloud.sql.v1.DatabaseFlags.encode(message.databaseFlags[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.dataDiskType != null && Object.hasOwnProperty.call(message, "dataDiskType")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.dataDiskType); - if (message.maintenanceWindow != null && Object.hasOwnProperty.call(message, "maintenanceWindow")) - $root.google.cloud.sql.v1.MaintenanceWindow.encode(message.maintenanceWindow, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - if (message.backupConfiguration != null && Object.hasOwnProperty.call(message, "backupConfiguration")) - $root.google.cloud.sql.v1.BackupConfiguration.encode(message.backupConfiguration, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.databaseReplicationEnabled != null && Object.hasOwnProperty.call(message, "databaseReplicationEnabled")) - $root.google.protobuf.BoolValue.encode(message.databaseReplicationEnabled, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - if (message.crashSafeReplicationEnabled != null && Object.hasOwnProperty.call(message, "crashSafeReplicationEnabled")) - $root.google.protobuf.BoolValue.encode(message.crashSafeReplicationEnabled, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); - if (message.dataDiskSizeGb != null && Object.hasOwnProperty.call(message, "dataDiskSizeGb")) - $root.google.protobuf.Int64Value.encode(message.dataDiskSizeGb, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.activeDirectoryConfig != null && Object.hasOwnProperty.call(message, "activeDirectoryConfig")) - $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.encode(message.activeDirectoryConfig, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); - if (message.collation != null && Object.hasOwnProperty.call(message, "collation")) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.collation); - if (message.denyMaintenancePeriods != null && message.denyMaintenancePeriods.length) - for (var i = 0; i < message.denyMaintenancePeriods.length; ++i) - $root.google.cloud.sql.v1.DenyMaintenancePeriod.encode(message.denyMaintenancePeriods[i], writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); - if (message.insightsConfig != null && Object.hasOwnProperty.call(message, "insightsConfig")) - $root.google.cloud.sql.v1.InsightsConfig.encode(message.insightsConfig, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); - if (message.passwordValidationPolicy != null && Object.hasOwnProperty.call(message, "passwordValidationPolicy")) - $root.google.cloud.sql.v1.PasswordValidationPolicy.encode(message.passwordValidationPolicy, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); - if (message.sqlServerAuditConfig != null && Object.hasOwnProperty.call(message, "sqlServerAuditConfig")) - $root.google.cloud.sql.v1.SqlServerAuditConfig.encode(message.sqlServerAuditConfig, writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim(); - if (message.connectorEnforcement != null && Object.hasOwnProperty.call(message, "connectorEnforcement")) - writer.uint32(/* id 32, wireType 0 =*/256).int32(message.connectorEnforcement); - if (message.deletionProtectionEnabled != null && Object.hasOwnProperty.call(message, "deletionProtectionEnabled")) - $root.google.protobuf.BoolValue.encode(message.deletionProtectionEnabled, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); - if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) - writer.uint32(/* id 34, wireType 2 =*/274).string(message.timeZone); - if (message.advancedMachineFeatures != null && Object.hasOwnProperty.call(message, "advancedMachineFeatures")) - $root.google.cloud.sql.v1.AdvancedMachineFeatures.encode(message.advancedMachineFeatures, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); - if (message.dataCacheConfig != null && Object.hasOwnProperty.call(message, "dataCacheConfig")) - $root.google.cloud.sql.v1.DataCacheConfig.encode(message.dataCacheConfig, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim(); - if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 38, wireType 0 =*/304).int32(message.edition); - if (message.replicationLagMaxSeconds != null && Object.hasOwnProperty.call(message, "replicationLagMaxSeconds")) - $root.google.protobuf.Int32Value.encode(message.replicationLagMaxSeconds, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); - if (message.enableGoogleMlIntegration != null && Object.hasOwnProperty.call(message, "enableGoogleMlIntegration")) - $root.google.protobuf.BoolValue.encode(message.enableGoogleMlIntegration, writer.uint32(/* id 40, wireType 2 =*/322).fork()).ldelim(); - if (message.enableDataplexIntegration != null && Object.hasOwnProperty.call(message, "enableDataplexIntegration")) - $root.google.protobuf.BoolValue.encode(message.enableDataplexIntegration, writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); - if (message.retainBackupsOnDelete != null && Object.hasOwnProperty.call(message, "retainBackupsOnDelete")) - $root.google.protobuf.BoolValue.encode(message.retainBackupsOnDelete, writer.uint32(/* id 42, wireType 2 =*/338).fork()).ldelim(); - if (message.dataDiskProvisionedIops != null && Object.hasOwnProperty.call(message, "dataDiskProvisionedIops")) - writer.uint32(/* id 43, wireType 0 =*/344).int64(message.dataDiskProvisionedIops); - if (message.dataDiskProvisionedThroughput != null && Object.hasOwnProperty.call(message, "dataDiskProvisionedThroughput")) - writer.uint32(/* id 44, wireType 0 =*/352).int64(message.dataDiskProvisionedThroughput); - if (message.connectionPoolConfig != null && Object.hasOwnProperty.call(message, "connectionPoolConfig")) - $root.google.cloud.sql.v1.ConnectionPoolConfig.encode(message.connectionPoolConfig, writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); - if (message.finalBackupConfig != null && Object.hasOwnProperty.call(message, "finalBackupConfig")) - $root.google.cloud.sql.v1.FinalBackupConfig.encode(message.finalBackupConfig, writer.uint32(/* id 47, wireType 2 =*/378).fork()).ldelim(); - if (message.readPoolAutoScaleConfig != null && Object.hasOwnProperty.call(message, "readPoolAutoScaleConfig")) - $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.encode(message.readPoolAutoScaleConfig, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); - if (message.acceleratedReplicaMode != null && Object.hasOwnProperty.call(message, "acceleratedReplicaMode")) - $root.google.protobuf.BoolValue.encode(message.acceleratedReplicaMode, writer.uint32(/* id 49, wireType 2 =*/394).fork()).ldelim(); - if (message.autoUpgradeEnabled != null && Object.hasOwnProperty.call(message, "autoUpgradeEnabled")) - writer.uint32(/* id 50, wireType 0 =*/400).bool(message.autoUpgradeEnabled); - if (message.entraidConfig != null && Object.hasOwnProperty.call(message, "entraidConfig")) - $root.google.cloud.sql.v1.SqlServerEntraIdConfig.encode(message.entraidConfig, writer.uint32(/* id 52, wireType 2 =*/418).fork()).ldelim(); - if (message.dataApiAccess != null && Object.hasOwnProperty.call(message, "dataApiAccess")) - writer.uint32(/* id 53, wireType 0 =*/424).int32(message.dataApiAccess); - if (message.performanceCaptureConfig != null && Object.hasOwnProperty.call(message, "performanceCaptureConfig")) - $root.google.cloud.sql.v1.PerformanceCaptureConfig.encode(message.performanceCaptureConfig, writer.uint32(/* id 54, wireType 2 =*/434).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Settings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.Settings - * @static - * @param {google.cloud.sql.v1.ISettings} message Settings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Settings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Settings message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.Settings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.Settings} Settings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Settings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Settings(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.settingsVersion = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 2: { - if (!(message.authorizedGaeApplications && message.authorizedGaeApplications.length)) - message.authorizedGaeApplications = []; - message.authorizedGaeApplications.push(reader.string()); - break; - } - case 3: { - message.tier = reader.string(); - break; - } - case 4: { - message.kind = reader.string(); - break; - } - case 5: { - if (message.userLabels === $util.emptyObject) - message.userLabels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.userLabels[key] = value; - break; - } - case 6: { - message.availabilityType = reader.int32(); - break; - } - case 7: { - message.pricingPlan = reader.int32(); - break; - } - case 8: { - message.replicationType = reader.int32(); - break; - } - case 9: { - message.storageAutoResizeLimit = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 10: { - message.activationPolicy = reader.int32(); - break; - } - case 11: { - message.ipConfiguration = $root.google.cloud.sql.v1.IpConfiguration.decode(reader, reader.uint32()); - break; - } - case 12: { - message.storageAutoResize = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 13: { - message.locationPreference = $root.google.cloud.sql.v1.LocationPreference.decode(reader, reader.uint32()); - break; - } - case 14: { - if (!(message.databaseFlags && message.databaseFlags.length)) - message.databaseFlags = []; - message.databaseFlags.push($root.google.cloud.sql.v1.DatabaseFlags.decode(reader, reader.uint32())); - break; - } - case 15: { - message.dataDiskType = reader.int32(); - break; - } - case 16: { - message.maintenanceWindow = $root.google.cloud.sql.v1.MaintenanceWindow.decode(reader, reader.uint32()); - break; - } - case 17: { - message.backupConfiguration = $root.google.cloud.sql.v1.BackupConfiguration.decode(reader, reader.uint32()); - break; - } - case 18: { - message.databaseReplicationEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 19: { - message.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 20: { - message.dataDiskSizeGb = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 22: { - message.activeDirectoryConfig = $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.decode(reader, reader.uint32()); - break; - } - case 23: { - message.collation = reader.string(); - break; - } - case 24: { - if (!(message.denyMaintenancePeriods && message.denyMaintenancePeriods.length)) - message.denyMaintenancePeriods = []; - message.denyMaintenancePeriods.push($root.google.cloud.sql.v1.DenyMaintenancePeriod.decode(reader, reader.uint32())); - break; - } - case 25: { - message.insightsConfig = $root.google.cloud.sql.v1.InsightsConfig.decode(reader, reader.uint32()); - break; - } - case 27: { - message.passwordValidationPolicy = $root.google.cloud.sql.v1.PasswordValidationPolicy.decode(reader, reader.uint32()); - break; - } - case 29: { - message.sqlServerAuditConfig = $root.google.cloud.sql.v1.SqlServerAuditConfig.decode(reader, reader.uint32()); - break; - } - case 38: { - message.edition = reader.int32(); - break; - } - case 32: { - message.connectorEnforcement = reader.int32(); - break; - } - case 33: { - message.deletionProtectionEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 34: { - message.timeZone = reader.string(); - break; - } - case 35: { - message.advancedMachineFeatures = $root.google.cloud.sql.v1.AdvancedMachineFeatures.decode(reader, reader.uint32()); - break; - } - case 37: { - message.dataCacheConfig = $root.google.cloud.sql.v1.DataCacheConfig.decode(reader, reader.uint32()); - break; - } - case 39: { - message.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 40: { - message.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 41: { - message.enableDataplexIntegration = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 42: { - message.retainBackupsOnDelete = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 43: { - message.dataDiskProvisionedIops = reader.int64(); - break; - } - case 44: { - message.dataDiskProvisionedThroughput = reader.int64(); - break; - } - case 45: { - message.connectionPoolConfig = $root.google.cloud.sql.v1.ConnectionPoolConfig.decode(reader, reader.uint32()); - break; - } - case 47: { - message.finalBackupConfig = $root.google.cloud.sql.v1.FinalBackupConfig.decode(reader, reader.uint32()); - break; - } - case 48: { - message.readPoolAutoScaleConfig = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.decode(reader, reader.uint32()); - break; - } - case 49: { - message.acceleratedReplicaMode = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 50: { - message.autoUpgradeEnabled = reader.bool(); - break; - } - case 52: { - message.entraidConfig = $root.google.cloud.sql.v1.SqlServerEntraIdConfig.decode(reader, reader.uint32()); - break; - } - case 53: { - message.dataApiAccess = reader.int32(); - break; - } - case 54: { - message.performanceCaptureConfig = $root.google.cloud.sql.v1.PerformanceCaptureConfig.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Settings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.Settings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.Settings} Settings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Settings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Settings message. - * @function verify - * @memberof google.cloud.sql.v1.Settings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Settings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) { - var error = $root.google.protobuf.Int64Value.verify(message.settingsVersion); - if (error) - return "settingsVersion." + error; - } - if (message.authorizedGaeApplications != null && message.hasOwnProperty("authorizedGaeApplications")) { - if (!Array.isArray(message.authorizedGaeApplications)) - return "authorizedGaeApplications: array expected"; - for (var i = 0; i < message.authorizedGaeApplications.length; ++i) - if (!$util.isString(message.authorizedGaeApplications[i])) - return "authorizedGaeApplications: string[] expected"; - } - if (message.tier != null && message.hasOwnProperty("tier")) - if (!$util.isString(message.tier)) - return "tier: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.userLabels != null && message.hasOwnProperty("userLabels")) { - if (!$util.isObject(message.userLabels)) - return "userLabels: object expected"; - var key = Object.keys(message.userLabels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.userLabels[key[i]])) - return "userLabels: string{k:string} expected"; - } - if (message.availabilityType != null && message.hasOwnProperty("availabilityType")) - switch (message.availabilityType) { - default: - return "availabilityType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.pricingPlan != null && message.hasOwnProperty("pricingPlan")) - switch (message.pricingPlan) { - default: - return "pricingPlan: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.replicationType != null && message.hasOwnProperty("replicationType")) - switch (message.replicationType) { - default: - return "replicationType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.storageAutoResizeLimit != null && message.hasOwnProperty("storageAutoResizeLimit")) { - var error = $root.google.protobuf.Int64Value.verify(message.storageAutoResizeLimit); - if (error) - return "storageAutoResizeLimit." + error; - } - if (message.activationPolicy != null && message.hasOwnProperty("activationPolicy")) - switch (message.activationPolicy) { - default: - return "activationPolicy: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.ipConfiguration != null && message.hasOwnProperty("ipConfiguration")) { - var error = $root.google.cloud.sql.v1.IpConfiguration.verify(message.ipConfiguration); - if (error) - return "ipConfiguration." + error; - } - if (message.storageAutoResize != null && message.hasOwnProperty("storageAutoResize")) { - var error = $root.google.protobuf.BoolValue.verify(message.storageAutoResize); - if (error) - return "storageAutoResize." + error; - } - if (message.locationPreference != null && message.hasOwnProperty("locationPreference")) { - var error = $root.google.cloud.sql.v1.LocationPreference.verify(message.locationPreference); - if (error) - return "locationPreference." + error; - } - if (message.databaseFlags != null && message.hasOwnProperty("databaseFlags")) { - if (!Array.isArray(message.databaseFlags)) - return "databaseFlags: array expected"; - for (var i = 0; i < message.databaseFlags.length; ++i) { - var error = $root.google.cloud.sql.v1.DatabaseFlags.verify(message.databaseFlags[i]); - if (error) - return "databaseFlags." + error; - } - } - if (message.dataDiskType != null && message.hasOwnProperty("dataDiskType")) - switch (message.dataDiskType) { - default: - return "dataDiskType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.maintenanceWindow != null && message.hasOwnProperty("maintenanceWindow")) { - var error = $root.google.cloud.sql.v1.MaintenanceWindow.verify(message.maintenanceWindow); - if (error) - return "maintenanceWindow." + error; - } - if (message.backupConfiguration != null && message.hasOwnProperty("backupConfiguration")) { - var error = $root.google.cloud.sql.v1.BackupConfiguration.verify(message.backupConfiguration); - if (error) - return "backupConfiguration." + error; - } - if (message.databaseReplicationEnabled != null && message.hasOwnProperty("databaseReplicationEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.databaseReplicationEnabled); - if (error) - return "databaseReplicationEnabled." + error; - } - if (message.crashSafeReplicationEnabled != null && message.hasOwnProperty("crashSafeReplicationEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.crashSafeReplicationEnabled); - if (error) - return "crashSafeReplicationEnabled." + error; - } - if (message.dataDiskSizeGb != null && message.hasOwnProperty("dataDiskSizeGb")) { - var error = $root.google.protobuf.Int64Value.verify(message.dataDiskSizeGb); - if (error) - return "dataDiskSizeGb." + error; - } - if (message.activeDirectoryConfig != null && message.hasOwnProperty("activeDirectoryConfig")) { - var error = $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.verify(message.activeDirectoryConfig); - if (error) - return "activeDirectoryConfig." + error; - } - if (message.collation != null && message.hasOwnProperty("collation")) - if (!$util.isString(message.collation)) - return "collation: string expected"; - if (message.denyMaintenancePeriods != null && message.hasOwnProperty("denyMaintenancePeriods")) { - if (!Array.isArray(message.denyMaintenancePeriods)) - return "denyMaintenancePeriods: array expected"; - for (var i = 0; i < message.denyMaintenancePeriods.length; ++i) { - var error = $root.google.cloud.sql.v1.DenyMaintenancePeriod.verify(message.denyMaintenancePeriods[i]); - if (error) - return "denyMaintenancePeriods." + error; - } - } - if (message.insightsConfig != null && message.hasOwnProperty("insightsConfig")) { - var error = $root.google.cloud.sql.v1.InsightsConfig.verify(message.insightsConfig); - if (error) - return "insightsConfig." + error; - } - if (message.passwordValidationPolicy != null && message.hasOwnProperty("passwordValidationPolicy")) { - var error = $root.google.cloud.sql.v1.PasswordValidationPolicy.verify(message.passwordValidationPolicy); - if (error) - return "passwordValidationPolicy." + error; - } - if (message.sqlServerAuditConfig != null && message.hasOwnProperty("sqlServerAuditConfig")) { - var error = $root.google.cloud.sql.v1.SqlServerAuditConfig.verify(message.sqlServerAuditConfig); - if (error) - return "sqlServerAuditConfig." + error; - } - if (message.edition != null && message.hasOwnProperty("edition")) - switch (message.edition) { - default: - return "edition: enum value expected"; - case 0: - case 2: - case 3: - break; - } - if (message.connectorEnforcement != null && message.hasOwnProperty("connectorEnforcement")) - switch (message.connectorEnforcement) { - default: - return "connectorEnforcement: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.deletionProtectionEnabled != null && message.hasOwnProperty("deletionProtectionEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.deletionProtectionEnabled); - if (error) - return "deletionProtectionEnabled." + error; - } - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - if (!$util.isString(message.timeZone)) - return "timeZone: string expected"; - if (message.advancedMachineFeatures != null && message.hasOwnProperty("advancedMachineFeatures")) { - var error = $root.google.cloud.sql.v1.AdvancedMachineFeatures.verify(message.advancedMachineFeatures); - if (error) - return "advancedMachineFeatures." + error; - } - if (message.dataCacheConfig != null && message.hasOwnProperty("dataCacheConfig")) { - var error = $root.google.cloud.sql.v1.DataCacheConfig.verify(message.dataCacheConfig); - if (error) - return "dataCacheConfig." + error; - } - if (message.replicationLagMaxSeconds != null && message.hasOwnProperty("replicationLagMaxSeconds")) { - var error = $root.google.protobuf.Int32Value.verify(message.replicationLagMaxSeconds); - if (error) - return "replicationLagMaxSeconds." + error; - } - if (message.enableGoogleMlIntegration != null && message.hasOwnProperty("enableGoogleMlIntegration")) { - var error = $root.google.protobuf.BoolValue.verify(message.enableGoogleMlIntegration); - if (error) - return "enableGoogleMlIntegration." + error; - } - if (message.enableDataplexIntegration != null && message.hasOwnProperty("enableDataplexIntegration")) { - var error = $root.google.protobuf.BoolValue.verify(message.enableDataplexIntegration); - if (error) - return "enableDataplexIntegration." + error; - } - if (message.retainBackupsOnDelete != null && message.hasOwnProperty("retainBackupsOnDelete")) { - var error = $root.google.protobuf.BoolValue.verify(message.retainBackupsOnDelete); - if (error) - return "retainBackupsOnDelete." + error; - } - if (message.dataDiskProvisionedIops != null && message.hasOwnProperty("dataDiskProvisionedIops")) { - properties._dataDiskProvisionedIops = 1; - if (!$util.isInteger(message.dataDiskProvisionedIops) && !(message.dataDiskProvisionedIops && $util.isInteger(message.dataDiskProvisionedIops.low) && $util.isInteger(message.dataDiskProvisionedIops.high))) - return "dataDiskProvisionedIops: integer|Long expected"; - } - if (message.dataDiskProvisionedThroughput != null && message.hasOwnProperty("dataDiskProvisionedThroughput")) { - properties._dataDiskProvisionedThroughput = 1; - if (!$util.isInteger(message.dataDiskProvisionedThroughput) && !(message.dataDiskProvisionedThroughput && $util.isInteger(message.dataDiskProvisionedThroughput.low) && $util.isInteger(message.dataDiskProvisionedThroughput.high))) - return "dataDiskProvisionedThroughput: integer|Long expected"; - } - if (message.connectionPoolConfig != null && message.hasOwnProperty("connectionPoolConfig")) { - properties._connectionPoolConfig = 1; - { - var error = $root.google.cloud.sql.v1.ConnectionPoolConfig.verify(message.connectionPoolConfig); - if (error) - return "connectionPoolConfig." + error; - } - } - if (message.finalBackupConfig != null && message.hasOwnProperty("finalBackupConfig")) { - properties._finalBackupConfig = 1; - { - var error = $root.google.cloud.sql.v1.FinalBackupConfig.verify(message.finalBackupConfig); - if (error) - return "finalBackupConfig." + error; - } - } - if (message.readPoolAutoScaleConfig != null && message.hasOwnProperty("readPoolAutoScaleConfig")) { - properties._readPoolAutoScaleConfig = 1; - { - var error = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.verify(message.readPoolAutoScaleConfig); - if (error) - return "readPoolAutoScaleConfig." + error; - } - } - if (message.acceleratedReplicaMode != null && message.hasOwnProperty("acceleratedReplicaMode")) { - var error = $root.google.protobuf.BoolValue.verify(message.acceleratedReplicaMode); - if (error) - return "acceleratedReplicaMode." + error; - } - if (message.autoUpgradeEnabled != null && message.hasOwnProperty("autoUpgradeEnabled")) { - properties._autoUpgradeEnabled = 1; - if (typeof message.autoUpgradeEnabled !== "boolean") - return "autoUpgradeEnabled: boolean expected"; - } - if (message.entraidConfig != null && message.hasOwnProperty("entraidConfig")) { - var error = $root.google.cloud.sql.v1.SqlServerEntraIdConfig.verify(message.entraidConfig); - if (error) - return "entraidConfig." + error; - } - if (message.dataApiAccess != null && message.hasOwnProperty("dataApiAccess")) { - properties._dataApiAccess = 1; - switch (message.dataApiAccess) { - default: - return "dataApiAccess: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - if (message.performanceCaptureConfig != null && message.hasOwnProperty("performanceCaptureConfig")) { - var error = $root.google.cloud.sql.v1.PerformanceCaptureConfig.verify(message.performanceCaptureConfig); - if (error) - return "performanceCaptureConfig." + error; - } - return null; - }; - - /** - * Creates a Settings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.Settings - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.Settings} Settings - */ - Settings.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.Settings) - return object; - var message = new $root.google.cloud.sql.v1.Settings(); - if (object.settingsVersion != null) { - if (typeof object.settingsVersion !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.settingsVersion: object expected"); - message.settingsVersion = $root.google.protobuf.Int64Value.fromObject(object.settingsVersion); - } - if (object.authorizedGaeApplications) { - if (!Array.isArray(object.authorizedGaeApplications)) - throw TypeError(".google.cloud.sql.v1.Settings.authorizedGaeApplications: array expected"); - message.authorizedGaeApplications = []; - for (var i = 0; i < object.authorizedGaeApplications.length; ++i) - message.authorizedGaeApplications[i] = String(object.authorizedGaeApplications[i]); - } - if (object.tier != null) - message.tier = String(object.tier); - if (object.kind != null) - message.kind = String(object.kind); - if (object.userLabels) { - if (typeof object.userLabels !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.userLabels: object expected"); - message.userLabels = {}; - for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) - message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); - } - switch (object.availabilityType) { - default: - if (typeof object.availabilityType === "number") { - message.availabilityType = object.availabilityType; - break; - } - break; - case "SQL_AVAILABILITY_TYPE_UNSPECIFIED": - case 0: - message.availabilityType = 0; - break; - case "ZONAL": - case 1: - message.availabilityType = 1; - break; - case "REGIONAL": - case 2: - message.availabilityType = 2; - break; - } - switch (object.pricingPlan) { - default: - if (typeof object.pricingPlan === "number") { - message.pricingPlan = object.pricingPlan; - break; - } - break; - case "SQL_PRICING_PLAN_UNSPECIFIED": - case 0: - message.pricingPlan = 0; - break; - case "PACKAGE": - case 1: - message.pricingPlan = 1; - break; - case "PER_USE": - case 2: - message.pricingPlan = 2; - break; - } - switch (object.replicationType) { - default: - if (typeof object.replicationType === "number") { - message.replicationType = object.replicationType; - break; - } - break; - case "SQL_REPLICATION_TYPE_UNSPECIFIED": - case 0: - message.replicationType = 0; - break; - case "SYNCHRONOUS": - case 1: - message.replicationType = 1; - break; - case "ASYNCHRONOUS": - case 2: - message.replicationType = 2; - break; - } - if (object.storageAutoResizeLimit != null) { - if (typeof object.storageAutoResizeLimit !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.storageAutoResizeLimit: object expected"); - message.storageAutoResizeLimit = $root.google.protobuf.Int64Value.fromObject(object.storageAutoResizeLimit); - } - switch (object.activationPolicy) { - default: - if (typeof object.activationPolicy === "number") { - message.activationPolicy = object.activationPolicy; - break; - } - break; - case "SQL_ACTIVATION_POLICY_UNSPECIFIED": - case 0: - message.activationPolicy = 0; - break; - case "ALWAYS": - case 1: - message.activationPolicy = 1; - break; - case "NEVER": - case 2: - message.activationPolicy = 2; - break; - case "ON_DEMAND": - case 3: - message.activationPolicy = 3; - break; - } - if (object.ipConfiguration != null) { - if (typeof object.ipConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.ipConfiguration: object expected"); - message.ipConfiguration = $root.google.cloud.sql.v1.IpConfiguration.fromObject(object.ipConfiguration); - } - if (object.storageAutoResize != null) { - if (typeof object.storageAutoResize !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.storageAutoResize: object expected"); - message.storageAutoResize = $root.google.protobuf.BoolValue.fromObject(object.storageAutoResize); - } - if (object.locationPreference != null) { - if (typeof object.locationPreference !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.locationPreference: object expected"); - message.locationPreference = $root.google.cloud.sql.v1.LocationPreference.fromObject(object.locationPreference); - } - if (object.databaseFlags) { - if (!Array.isArray(object.databaseFlags)) - throw TypeError(".google.cloud.sql.v1.Settings.databaseFlags: array expected"); - message.databaseFlags = []; - for (var i = 0; i < object.databaseFlags.length; ++i) { - if (typeof object.databaseFlags[i] !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.databaseFlags: object expected"); - message.databaseFlags[i] = $root.google.cloud.sql.v1.DatabaseFlags.fromObject(object.databaseFlags[i]); - } - } - switch (object.dataDiskType) { - default: - if (typeof object.dataDiskType === "number") { - message.dataDiskType = object.dataDiskType; - break; - } - break; - case "SQL_DATA_DISK_TYPE_UNSPECIFIED": - case 0: - message.dataDiskType = 0; - break; - case "PD_SSD": - case 1: - message.dataDiskType = 1; - break; - case "PD_HDD": - case 2: - message.dataDiskType = 2; - break; - case "OBSOLETE_LOCAL_SSD": - case 3: - message.dataDiskType = 3; - break; - case "HYPERDISK_BALANCED": - case 4: - message.dataDiskType = 4; - break; - } - if (object.maintenanceWindow != null) { - if (typeof object.maintenanceWindow !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.maintenanceWindow: object expected"); - message.maintenanceWindow = $root.google.cloud.sql.v1.MaintenanceWindow.fromObject(object.maintenanceWindow); - } - if (object.backupConfiguration != null) { - if (typeof object.backupConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.backupConfiguration: object expected"); - message.backupConfiguration = $root.google.cloud.sql.v1.BackupConfiguration.fromObject(object.backupConfiguration); - } - if (object.databaseReplicationEnabled != null) { - if (typeof object.databaseReplicationEnabled !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.databaseReplicationEnabled: object expected"); - message.databaseReplicationEnabled = $root.google.protobuf.BoolValue.fromObject(object.databaseReplicationEnabled); - } - if (object.crashSafeReplicationEnabled != null) { - if (typeof object.crashSafeReplicationEnabled !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.crashSafeReplicationEnabled: object expected"); - message.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.fromObject(object.crashSafeReplicationEnabled); - } - if (object.dataDiskSizeGb != null) { - if (typeof object.dataDiskSizeGb !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.dataDiskSizeGb: object expected"); - message.dataDiskSizeGb = $root.google.protobuf.Int64Value.fromObject(object.dataDiskSizeGb); - } - if (object.activeDirectoryConfig != null) { - if (typeof object.activeDirectoryConfig !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.activeDirectoryConfig: object expected"); - message.activeDirectoryConfig = $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.fromObject(object.activeDirectoryConfig); - } - if (object.collation != null) - message.collation = String(object.collation); - if (object.denyMaintenancePeriods) { - if (!Array.isArray(object.denyMaintenancePeriods)) - throw TypeError(".google.cloud.sql.v1.Settings.denyMaintenancePeriods: array expected"); - message.denyMaintenancePeriods = []; - for (var i = 0; i < object.denyMaintenancePeriods.length; ++i) { - if (typeof object.denyMaintenancePeriods[i] !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.denyMaintenancePeriods: object expected"); - message.denyMaintenancePeriods[i] = $root.google.cloud.sql.v1.DenyMaintenancePeriod.fromObject(object.denyMaintenancePeriods[i]); - } - } - if (object.insightsConfig != null) { - if (typeof object.insightsConfig !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.insightsConfig: object expected"); - message.insightsConfig = $root.google.cloud.sql.v1.InsightsConfig.fromObject(object.insightsConfig); - } - if (object.passwordValidationPolicy != null) { - if (typeof object.passwordValidationPolicy !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.passwordValidationPolicy: object expected"); - message.passwordValidationPolicy = $root.google.cloud.sql.v1.PasswordValidationPolicy.fromObject(object.passwordValidationPolicy); - } - if (object.sqlServerAuditConfig != null) { - if (typeof object.sqlServerAuditConfig !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.sqlServerAuditConfig: object expected"); - message.sqlServerAuditConfig = $root.google.cloud.sql.v1.SqlServerAuditConfig.fromObject(object.sqlServerAuditConfig); - } - switch (object.edition) { - default: - if (typeof object.edition === "number") { - message.edition = object.edition; - break; - } - break; - case "EDITION_UNSPECIFIED": - case 0: - message.edition = 0; - break; - case "ENTERPRISE": - case 2: - message.edition = 2; - break; - case "ENTERPRISE_PLUS": - case 3: - message.edition = 3; - break; - } - switch (object.connectorEnforcement) { - default: - if (typeof object.connectorEnforcement === "number") { - message.connectorEnforcement = object.connectorEnforcement; - break; - } - break; - case "CONNECTOR_ENFORCEMENT_UNSPECIFIED": - case 0: - message.connectorEnforcement = 0; - break; - case "NOT_REQUIRED": - case 1: - message.connectorEnforcement = 1; - break; - case "REQUIRED": - case 2: - message.connectorEnforcement = 2; - break; - } - if (object.deletionProtectionEnabled != null) { - if (typeof object.deletionProtectionEnabled !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.deletionProtectionEnabled: object expected"); - message.deletionProtectionEnabled = $root.google.protobuf.BoolValue.fromObject(object.deletionProtectionEnabled); - } - if (object.timeZone != null) - message.timeZone = String(object.timeZone); - if (object.advancedMachineFeatures != null) { - if (typeof object.advancedMachineFeatures !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.advancedMachineFeatures: object expected"); - message.advancedMachineFeatures = $root.google.cloud.sql.v1.AdvancedMachineFeatures.fromObject(object.advancedMachineFeatures); - } - if (object.dataCacheConfig != null) { - if (typeof object.dataCacheConfig !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.dataCacheConfig: object expected"); - message.dataCacheConfig = $root.google.cloud.sql.v1.DataCacheConfig.fromObject(object.dataCacheConfig); - } - if (object.replicationLagMaxSeconds != null) { - if (typeof object.replicationLagMaxSeconds !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.replicationLagMaxSeconds: object expected"); - message.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.fromObject(object.replicationLagMaxSeconds); - } - if (object.enableGoogleMlIntegration != null) { - if (typeof object.enableGoogleMlIntegration !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.enableGoogleMlIntegration: object expected"); - message.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.fromObject(object.enableGoogleMlIntegration); - } - if (object.enableDataplexIntegration != null) { - if (typeof object.enableDataplexIntegration !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.enableDataplexIntegration: object expected"); - message.enableDataplexIntegration = $root.google.protobuf.BoolValue.fromObject(object.enableDataplexIntegration); - } - if (object.retainBackupsOnDelete != null) { - if (typeof object.retainBackupsOnDelete !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.retainBackupsOnDelete: object expected"); - message.retainBackupsOnDelete = $root.google.protobuf.BoolValue.fromObject(object.retainBackupsOnDelete); - } - if (object.dataDiskProvisionedIops != null) - if ($util.Long) - (message.dataDiskProvisionedIops = $util.Long.fromValue(object.dataDiskProvisionedIops)).unsigned = false; - else if (typeof object.dataDiskProvisionedIops === "string") - message.dataDiskProvisionedIops = parseInt(object.dataDiskProvisionedIops, 10); - else if (typeof object.dataDiskProvisionedIops === "number") - message.dataDiskProvisionedIops = object.dataDiskProvisionedIops; - else if (typeof object.dataDiskProvisionedIops === "object") - message.dataDiskProvisionedIops = new $util.LongBits(object.dataDiskProvisionedIops.low >>> 0, object.dataDiskProvisionedIops.high >>> 0).toNumber(); - if (object.dataDiskProvisionedThroughput != null) - if ($util.Long) - (message.dataDiskProvisionedThroughput = $util.Long.fromValue(object.dataDiskProvisionedThroughput)).unsigned = false; - else if (typeof object.dataDiskProvisionedThroughput === "string") - message.dataDiskProvisionedThroughput = parseInt(object.dataDiskProvisionedThroughput, 10); - else if (typeof object.dataDiskProvisionedThroughput === "number") - message.dataDiskProvisionedThroughput = object.dataDiskProvisionedThroughput; - else if (typeof object.dataDiskProvisionedThroughput === "object") - message.dataDiskProvisionedThroughput = new $util.LongBits(object.dataDiskProvisionedThroughput.low >>> 0, object.dataDiskProvisionedThroughput.high >>> 0).toNumber(); - if (object.connectionPoolConfig != null) { - if (typeof object.connectionPoolConfig !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.connectionPoolConfig: object expected"); - message.connectionPoolConfig = $root.google.cloud.sql.v1.ConnectionPoolConfig.fromObject(object.connectionPoolConfig); - } - if (object.finalBackupConfig != null) { - if (typeof object.finalBackupConfig !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.finalBackupConfig: object expected"); - message.finalBackupConfig = $root.google.cloud.sql.v1.FinalBackupConfig.fromObject(object.finalBackupConfig); - } - if (object.readPoolAutoScaleConfig != null) { - if (typeof object.readPoolAutoScaleConfig !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.readPoolAutoScaleConfig: object expected"); - message.readPoolAutoScaleConfig = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.fromObject(object.readPoolAutoScaleConfig); - } - if (object.acceleratedReplicaMode != null) { - if (typeof object.acceleratedReplicaMode !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.acceleratedReplicaMode: object expected"); - message.acceleratedReplicaMode = $root.google.protobuf.BoolValue.fromObject(object.acceleratedReplicaMode); - } - if (object.autoUpgradeEnabled != null) - message.autoUpgradeEnabled = Boolean(object.autoUpgradeEnabled); - if (object.entraidConfig != null) { - if (typeof object.entraidConfig !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.entraidConfig: object expected"); - message.entraidConfig = $root.google.cloud.sql.v1.SqlServerEntraIdConfig.fromObject(object.entraidConfig); - } - switch (object.dataApiAccess) { - default: - if (typeof object.dataApiAccess === "number") { - message.dataApiAccess = object.dataApiAccess; - break; - } - break; - case "DATA_API_ACCESS_UNSPECIFIED": - case 0: - message.dataApiAccess = 0; - break; - case "DISALLOW_DATA_API": - case 1: - message.dataApiAccess = 1; - break; - case "ALLOW_DATA_API": - case 2: - message.dataApiAccess = 2; - break; - } - if (object.performanceCaptureConfig != null) { - if (typeof object.performanceCaptureConfig !== "object") - throw TypeError(".google.cloud.sql.v1.Settings.performanceCaptureConfig: object expected"); - message.performanceCaptureConfig = $root.google.cloud.sql.v1.PerformanceCaptureConfig.fromObject(object.performanceCaptureConfig); - } - return message; - }; - - /** - * Creates a plain object from a Settings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.Settings - * @static - * @param {google.cloud.sql.v1.Settings} message Settings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Settings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.authorizedGaeApplications = []; - object.databaseFlags = []; - object.denyMaintenancePeriods = []; - } - if (options.objects || options.defaults) - object.userLabels = {}; - if (options.defaults) { - object.settingsVersion = null; - object.tier = ""; - object.kind = ""; - object.availabilityType = options.enums === String ? "SQL_AVAILABILITY_TYPE_UNSPECIFIED" : 0; - object.pricingPlan = options.enums === String ? "SQL_PRICING_PLAN_UNSPECIFIED" : 0; - object.replicationType = options.enums === String ? "SQL_REPLICATION_TYPE_UNSPECIFIED" : 0; - object.storageAutoResizeLimit = null; - object.activationPolicy = options.enums === String ? "SQL_ACTIVATION_POLICY_UNSPECIFIED" : 0; - object.ipConfiguration = null; - object.storageAutoResize = null; - object.locationPreference = null; - object.dataDiskType = options.enums === String ? "SQL_DATA_DISK_TYPE_UNSPECIFIED" : 0; - object.maintenanceWindow = null; - object.backupConfiguration = null; - object.databaseReplicationEnabled = null; - object.crashSafeReplicationEnabled = null; - object.dataDiskSizeGb = null; - object.activeDirectoryConfig = null; - object.collation = ""; - object.insightsConfig = null; - object.passwordValidationPolicy = null; - object.sqlServerAuditConfig = null; - object.connectorEnforcement = options.enums === String ? "CONNECTOR_ENFORCEMENT_UNSPECIFIED" : 0; - object.deletionProtectionEnabled = null; - object.timeZone = ""; - object.advancedMachineFeatures = null; - object.dataCacheConfig = null; - object.edition = options.enums === String ? "EDITION_UNSPECIFIED" : 0; - object.replicationLagMaxSeconds = null; - object.enableGoogleMlIntegration = null; - object.enableDataplexIntegration = null; - object.retainBackupsOnDelete = null; - object.acceleratedReplicaMode = null; - object.entraidConfig = null; - object.performanceCaptureConfig = null; - } - if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) - object.settingsVersion = $root.google.protobuf.Int64Value.toObject(message.settingsVersion, options); - if (message.authorizedGaeApplications && message.authorizedGaeApplications.length) { - object.authorizedGaeApplications = []; - for (var j = 0; j < message.authorizedGaeApplications.length; ++j) - object.authorizedGaeApplications[j] = message.authorizedGaeApplications[j]; - } - if (message.tier != null && message.hasOwnProperty("tier")) - object.tier = message.tier; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - var keys2; - if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { - object.userLabels = {}; - for (var j = 0; j < keys2.length; ++j) - object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; - } - if (message.availabilityType != null && message.hasOwnProperty("availabilityType")) - object.availabilityType = options.enums === String ? $root.google.cloud.sql.v1.SqlAvailabilityType[message.availabilityType] === undefined ? message.availabilityType : $root.google.cloud.sql.v1.SqlAvailabilityType[message.availabilityType] : message.availabilityType; - if (message.pricingPlan != null && message.hasOwnProperty("pricingPlan")) - object.pricingPlan = options.enums === String ? $root.google.cloud.sql.v1.SqlPricingPlan[message.pricingPlan] === undefined ? message.pricingPlan : $root.google.cloud.sql.v1.SqlPricingPlan[message.pricingPlan] : message.pricingPlan; - if (message.replicationType != null && message.hasOwnProperty("replicationType")) - object.replicationType = options.enums === String ? $root.google.cloud.sql.v1.SqlReplicationType[message.replicationType] === undefined ? message.replicationType : $root.google.cloud.sql.v1.SqlReplicationType[message.replicationType] : message.replicationType; - if (message.storageAutoResizeLimit != null && message.hasOwnProperty("storageAutoResizeLimit")) - object.storageAutoResizeLimit = $root.google.protobuf.Int64Value.toObject(message.storageAutoResizeLimit, options); - if (message.activationPolicy != null && message.hasOwnProperty("activationPolicy")) - object.activationPolicy = options.enums === String ? $root.google.cloud.sql.v1.Settings.SqlActivationPolicy[message.activationPolicy] === undefined ? message.activationPolicy : $root.google.cloud.sql.v1.Settings.SqlActivationPolicy[message.activationPolicy] : message.activationPolicy; - if (message.ipConfiguration != null && message.hasOwnProperty("ipConfiguration")) - object.ipConfiguration = $root.google.cloud.sql.v1.IpConfiguration.toObject(message.ipConfiguration, options); - if (message.storageAutoResize != null && message.hasOwnProperty("storageAutoResize")) - object.storageAutoResize = $root.google.protobuf.BoolValue.toObject(message.storageAutoResize, options); - if (message.locationPreference != null && message.hasOwnProperty("locationPreference")) - object.locationPreference = $root.google.cloud.sql.v1.LocationPreference.toObject(message.locationPreference, options); - if (message.databaseFlags && message.databaseFlags.length) { - object.databaseFlags = []; - for (var j = 0; j < message.databaseFlags.length; ++j) - object.databaseFlags[j] = $root.google.cloud.sql.v1.DatabaseFlags.toObject(message.databaseFlags[j], options); - } - if (message.dataDiskType != null && message.hasOwnProperty("dataDiskType")) - object.dataDiskType = options.enums === String ? $root.google.cloud.sql.v1.SqlDataDiskType[message.dataDiskType] === undefined ? message.dataDiskType : $root.google.cloud.sql.v1.SqlDataDiskType[message.dataDiskType] : message.dataDiskType; - if (message.maintenanceWindow != null && message.hasOwnProperty("maintenanceWindow")) - object.maintenanceWindow = $root.google.cloud.sql.v1.MaintenanceWindow.toObject(message.maintenanceWindow, options); - if (message.backupConfiguration != null && message.hasOwnProperty("backupConfiguration")) - object.backupConfiguration = $root.google.cloud.sql.v1.BackupConfiguration.toObject(message.backupConfiguration, options); - if (message.databaseReplicationEnabled != null && message.hasOwnProperty("databaseReplicationEnabled")) - object.databaseReplicationEnabled = $root.google.protobuf.BoolValue.toObject(message.databaseReplicationEnabled, options); - if (message.crashSafeReplicationEnabled != null && message.hasOwnProperty("crashSafeReplicationEnabled")) - object.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.toObject(message.crashSafeReplicationEnabled, options); - if (message.dataDiskSizeGb != null && message.hasOwnProperty("dataDiskSizeGb")) - object.dataDiskSizeGb = $root.google.protobuf.Int64Value.toObject(message.dataDiskSizeGb, options); - if (message.activeDirectoryConfig != null && message.hasOwnProperty("activeDirectoryConfig")) - object.activeDirectoryConfig = $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.toObject(message.activeDirectoryConfig, options); - if (message.collation != null && message.hasOwnProperty("collation")) - object.collation = message.collation; - if (message.denyMaintenancePeriods && message.denyMaintenancePeriods.length) { - object.denyMaintenancePeriods = []; - for (var j = 0; j < message.denyMaintenancePeriods.length; ++j) - object.denyMaintenancePeriods[j] = $root.google.cloud.sql.v1.DenyMaintenancePeriod.toObject(message.denyMaintenancePeriods[j], options); - } - if (message.insightsConfig != null && message.hasOwnProperty("insightsConfig")) - object.insightsConfig = $root.google.cloud.sql.v1.InsightsConfig.toObject(message.insightsConfig, options); - if (message.passwordValidationPolicy != null && message.hasOwnProperty("passwordValidationPolicy")) - object.passwordValidationPolicy = $root.google.cloud.sql.v1.PasswordValidationPolicy.toObject(message.passwordValidationPolicy, options); - if (message.sqlServerAuditConfig != null && message.hasOwnProperty("sqlServerAuditConfig")) - object.sqlServerAuditConfig = $root.google.cloud.sql.v1.SqlServerAuditConfig.toObject(message.sqlServerAuditConfig, options); - if (message.connectorEnforcement != null && message.hasOwnProperty("connectorEnforcement")) - object.connectorEnforcement = options.enums === String ? $root.google.cloud.sql.v1.Settings.ConnectorEnforcement[message.connectorEnforcement] === undefined ? message.connectorEnforcement : $root.google.cloud.sql.v1.Settings.ConnectorEnforcement[message.connectorEnforcement] : message.connectorEnforcement; - if (message.deletionProtectionEnabled != null && message.hasOwnProperty("deletionProtectionEnabled")) - object.deletionProtectionEnabled = $root.google.protobuf.BoolValue.toObject(message.deletionProtectionEnabled, options); - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - object.timeZone = message.timeZone; - if (message.advancedMachineFeatures != null && message.hasOwnProperty("advancedMachineFeatures")) - object.advancedMachineFeatures = $root.google.cloud.sql.v1.AdvancedMachineFeatures.toObject(message.advancedMachineFeatures, options); - if (message.dataCacheConfig != null && message.hasOwnProperty("dataCacheConfig")) - object.dataCacheConfig = $root.google.cloud.sql.v1.DataCacheConfig.toObject(message.dataCacheConfig, options); - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.cloud.sql.v1.Settings.Edition[message.edition] === undefined ? message.edition : $root.google.cloud.sql.v1.Settings.Edition[message.edition] : message.edition; - if (message.replicationLagMaxSeconds != null && message.hasOwnProperty("replicationLagMaxSeconds")) - object.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.toObject(message.replicationLagMaxSeconds, options); - if (message.enableGoogleMlIntegration != null && message.hasOwnProperty("enableGoogleMlIntegration")) - object.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.toObject(message.enableGoogleMlIntegration, options); - if (message.enableDataplexIntegration != null && message.hasOwnProperty("enableDataplexIntegration")) - object.enableDataplexIntegration = $root.google.protobuf.BoolValue.toObject(message.enableDataplexIntegration, options); - if (message.retainBackupsOnDelete != null && message.hasOwnProperty("retainBackupsOnDelete")) - object.retainBackupsOnDelete = $root.google.protobuf.BoolValue.toObject(message.retainBackupsOnDelete, options); - if (message.dataDiskProvisionedIops != null && message.hasOwnProperty("dataDiskProvisionedIops")) { - if (typeof message.dataDiskProvisionedIops === "number") - object.dataDiskProvisionedIops = options.longs === String ? String(message.dataDiskProvisionedIops) : message.dataDiskProvisionedIops; - else - object.dataDiskProvisionedIops = options.longs === String ? $util.Long.prototype.toString.call(message.dataDiskProvisionedIops) : options.longs === Number ? new $util.LongBits(message.dataDiskProvisionedIops.low >>> 0, message.dataDiskProvisionedIops.high >>> 0).toNumber() : message.dataDiskProvisionedIops; - if (options.oneofs) - object._dataDiskProvisionedIops = "dataDiskProvisionedIops"; - } - if (message.dataDiskProvisionedThroughput != null && message.hasOwnProperty("dataDiskProvisionedThroughput")) { - if (typeof message.dataDiskProvisionedThroughput === "number") - object.dataDiskProvisionedThroughput = options.longs === String ? String(message.dataDiskProvisionedThroughput) : message.dataDiskProvisionedThroughput; - else - object.dataDiskProvisionedThroughput = options.longs === String ? $util.Long.prototype.toString.call(message.dataDiskProvisionedThroughput) : options.longs === Number ? new $util.LongBits(message.dataDiskProvisionedThroughput.low >>> 0, message.dataDiskProvisionedThroughput.high >>> 0).toNumber() : message.dataDiskProvisionedThroughput; - if (options.oneofs) - object._dataDiskProvisionedThroughput = "dataDiskProvisionedThroughput"; - } - if (message.connectionPoolConfig != null && message.hasOwnProperty("connectionPoolConfig")) { - object.connectionPoolConfig = $root.google.cloud.sql.v1.ConnectionPoolConfig.toObject(message.connectionPoolConfig, options); - if (options.oneofs) - object._connectionPoolConfig = "connectionPoolConfig"; - } - if (message.finalBackupConfig != null && message.hasOwnProperty("finalBackupConfig")) { - object.finalBackupConfig = $root.google.cloud.sql.v1.FinalBackupConfig.toObject(message.finalBackupConfig, options); - if (options.oneofs) - object._finalBackupConfig = "finalBackupConfig"; - } - if (message.readPoolAutoScaleConfig != null && message.hasOwnProperty("readPoolAutoScaleConfig")) { - object.readPoolAutoScaleConfig = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.toObject(message.readPoolAutoScaleConfig, options); - if (options.oneofs) - object._readPoolAutoScaleConfig = "readPoolAutoScaleConfig"; - } - if (message.acceleratedReplicaMode != null && message.hasOwnProperty("acceleratedReplicaMode")) - object.acceleratedReplicaMode = $root.google.protobuf.BoolValue.toObject(message.acceleratedReplicaMode, options); - if (message.autoUpgradeEnabled != null && message.hasOwnProperty("autoUpgradeEnabled")) { - object.autoUpgradeEnabled = message.autoUpgradeEnabled; - if (options.oneofs) - object._autoUpgradeEnabled = "autoUpgradeEnabled"; - } - if (message.entraidConfig != null && message.hasOwnProperty("entraidConfig")) - object.entraidConfig = $root.google.cloud.sql.v1.SqlServerEntraIdConfig.toObject(message.entraidConfig, options); - if (message.dataApiAccess != null && message.hasOwnProperty("dataApiAccess")) { - object.dataApiAccess = options.enums === String ? $root.google.cloud.sql.v1.Settings.DataApiAccess[message.dataApiAccess] === undefined ? message.dataApiAccess : $root.google.cloud.sql.v1.Settings.DataApiAccess[message.dataApiAccess] : message.dataApiAccess; - if (options.oneofs) - object._dataApiAccess = "dataApiAccess"; - } - if (message.performanceCaptureConfig != null && message.hasOwnProperty("performanceCaptureConfig")) - object.performanceCaptureConfig = $root.google.cloud.sql.v1.PerformanceCaptureConfig.toObject(message.performanceCaptureConfig, options); - return object; - }; - - /** - * Converts this Settings to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.Settings - * @instance - * @returns {Object.} JSON object - */ - Settings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Settings - * @function getTypeUrl - * @memberof google.cloud.sql.v1.Settings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Settings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.Settings"; - }; - - /** - * SqlActivationPolicy enum. - * @name google.cloud.sql.v1.Settings.SqlActivationPolicy - * @enum {number} - * @property {number} SQL_ACTIVATION_POLICY_UNSPECIFIED=0 SQL_ACTIVATION_POLICY_UNSPECIFIED value - * @property {number} ALWAYS=1 ALWAYS value - * @property {number} NEVER=2 NEVER value - * @property {number} ON_DEMAND=3 ON_DEMAND value - */ - Settings.SqlActivationPolicy = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_ACTIVATION_POLICY_UNSPECIFIED"] = 0; - values[valuesById[1] = "ALWAYS"] = 1; - values[valuesById[2] = "NEVER"] = 2; - values[valuesById[3] = "ON_DEMAND"] = 3; - return values; - })(); - - /** - * Edition enum. - * @name google.cloud.sql.v1.Settings.Edition - * @enum {number} - * @property {number} EDITION_UNSPECIFIED=0 EDITION_UNSPECIFIED value - * @property {number} ENTERPRISE=2 ENTERPRISE value - * @property {number} ENTERPRISE_PLUS=3 ENTERPRISE_PLUS value - */ - Settings.Edition = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "EDITION_UNSPECIFIED"] = 0; - values[valuesById[2] = "ENTERPRISE"] = 2; - values[valuesById[3] = "ENTERPRISE_PLUS"] = 3; - return values; - })(); - - /** - * ConnectorEnforcement enum. - * @name google.cloud.sql.v1.Settings.ConnectorEnforcement - * @enum {number} - * @property {number} CONNECTOR_ENFORCEMENT_UNSPECIFIED=0 CONNECTOR_ENFORCEMENT_UNSPECIFIED value - * @property {number} NOT_REQUIRED=1 NOT_REQUIRED value - * @property {number} REQUIRED=2 REQUIRED value - */ - Settings.ConnectorEnforcement = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CONNECTOR_ENFORCEMENT_UNSPECIFIED"] = 0; - values[valuesById[1] = "NOT_REQUIRED"] = 1; - values[valuesById[2] = "REQUIRED"] = 2; - return values; - })(); - - /** - * DataApiAccess enum. - * @name google.cloud.sql.v1.Settings.DataApiAccess - * @enum {number} - * @property {number} DATA_API_ACCESS_UNSPECIFIED=0 DATA_API_ACCESS_UNSPECIFIED value - * @property {number} DISALLOW_DATA_API=1 DISALLOW_DATA_API value - * @property {number} ALLOW_DATA_API=2 ALLOW_DATA_API value - */ - Settings.DataApiAccess = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DATA_API_ACCESS_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISALLOW_DATA_API"] = 1; - values[valuesById[2] = "ALLOW_DATA_API"] = 2; - return values; - })(); - - return Settings; - })(); - - v1.PerformanceCaptureConfig = (function() { - - /** - * Properties of a PerformanceCaptureConfig. - * @memberof google.cloud.sql.v1 - * @interface IPerformanceCaptureConfig - * @property {boolean|null} [enabled] PerformanceCaptureConfig enabled - * @property {number|null} [probingIntervalSeconds] PerformanceCaptureConfig probingIntervalSeconds - * @property {number|null} [probeThreshold] PerformanceCaptureConfig probeThreshold - * @property {number|null} [runningThreadsThreshold] PerformanceCaptureConfig runningThreadsThreshold - * @property {number|null} [secondsBehindSourceThreshold] PerformanceCaptureConfig secondsBehindSourceThreshold - * @property {number|null} [transactionDurationThreshold] PerformanceCaptureConfig transactionDurationThreshold - */ - - /** - * Constructs a new PerformanceCaptureConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a PerformanceCaptureConfig. - * @implements IPerformanceCaptureConfig - * @constructor - * @param {google.cloud.sql.v1.IPerformanceCaptureConfig=} [properties] Properties to set - */ - function PerformanceCaptureConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PerformanceCaptureConfig enabled. - * @member {boolean|null|undefined} enabled - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.enabled = null; - - /** - * PerformanceCaptureConfig probingIntervalSeconds. - * @member {number|null|undefined} probingIntervalSeconds - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.probingIntervalSeconds = null; - - /** - * PerformanceCaptureConfig probeThreshold. - * @member {number|null|undefined} probeThreshold - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.probeThreshold = null; - - /** - * PerformanceCaptureConfig runningThreadsThreshold. - * @member {number|null|undefined} runningThreadsThreshold - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.runningThreadsThreshold = null; - - /** - * PerformanceCaptureConfig secondsBehindSourceThreshold. - * @member {number|null|undefined} secondsBehindSourceThreshold - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.secondsBehindSourceThreshold = null; - - /** - * PerformanceCaptureConfig transactionDurationThreshold. - * @member {number|null|undefined} transactionDurationThreshold - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.transactionDurationThreshold = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_enabled", { - get: $util.oneOfGetter($oneOfFields = ["enabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_probingIntervalSeconds", { - get: $util.oneOfGetter($oneOfFields = ["probingIntervalSeconds"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_probeThreshold", { - get: $util.oneOfGetter($oneOfFields = ["probeThreshold"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_runningThreadsThreshold", { - get: $util.oneOfGetter($oneOfFields = ["runningThreadsThreshold"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_secondsBehindSourceThreshold", { - get: $util.oneOfGetter($oneOfFields = ["secondsBehindSourceThreshold"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_transactionDurationThreshold", { - get: $util.oneOfGetter($oneOfFields = ["transactionDurationThreshold"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PerformanceCaptureConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @static - * @param {google.cloud.sql.v1.IPerformanceCaptureConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.PerformanceCaptureConfig} PerformanceCaptureConfig instance - */ - PerformanceCaptureConfig.create = function create(properties) { - return new PerformanceCaptureConfig(properties); - }; - - /** - * Encodes the specified PerformanceCaptureConfig message. Does not implicitly {@link google.cloud.sql.v1.PerformanceCaptureConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @static - * @param {google.cloud.sql.v1.IPerformanceCaptureConfig} message PerformanceCaptureConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PerformanceCaptureConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); - if (message.probingIntervalSeconds != null && Object.hasOwnProperty.call(message, "probingIntervalSeconds")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.probingIntervalSeconds); - if (message.probeThreshold != null && Object.hasOwnProperty.call(message, "probeThreshold")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.probeThreshold); - if (message.runningThreadsThreshold != null && Object.hasOwnProperty.call(message, "runningThreadsThreshold")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.runningThreadsThreshold); - if (message.secondsBehindSourceThreshold != null && Object.hasOwnProperty.call(message, "secondsBehindSourceThreshold")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.secondsBehindSourceThreshold); - if (message.transactionDurationThreshold != null && Object.hasOwnProperty.call(message, "transactionDurationThreshold")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.transactionDurationThreshold); - return writer; - }; - - /** - * Encodes the specified PerformanceCaptureConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PerformanceCaptureConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @static - * @param {google.cloud.sql.v1.IPerformanceCaptureConfig} message PerformanceCaptureConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PerformanceCaptureConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PerformanceCaptureConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.PerformanceCaptureConfig} PerformanceCaptureConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PerformanceCaptureConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PerformanceCaptureConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.enabled = reader.bool(); - break; - } - case 2: { - message.probingIntervalSeconds = reader.int32(); - break; - } - case 3: { - message.probeThreshold = reader.int32(); - break; - } - case 4: { - message.runningThreadsThreshold = reader.int32(); - break; - } - case 5: { - message.secondsBehindSourceThreshold = reader.int32(); - break; - } - case 8: { - message.transactionDurationThreshold = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PerformanceCaptureConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.PerformanceCaptureConfig} PerformanceCaptureConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PerformanceCaptureConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PerformanceCaptureConfig message. - * @function verify - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PerformanceCaptureConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - properties._enabled = 1; - if (typeof message.enabled !== "boolean") - return "enabled: boolean expected"; - } - if (message.probingIntervalSeconds != null && message.hasOwnProperty("probingIntervalSeconds")) { - properties._probingIntervalSeconds = 1; - if (!$util.isInteger(message.probingIntervalSeconds)) - return "probingIntervalSeconds: integer expected"; - } - if (message.probeThreshold != null && message.hasOwnProperty("probeThreshold")) { - properties._probeThreshold = 1; - if (!$util.isInteger(message.probeThreshold)) - return "probeThreshold: integer expected"; - } - if (message.runningThreadsThreshold != null && message.hasOwnProperty("runningThreadsThreshold")) { - properties._runningThreadsThreshold = 1; - if (!$util.isInteger(message.runningThreadsThreshold)) - return "runningThreadsThreshold: integer expected"; - } - if (message.secondsBehindSourceThreshold != null && message.hasOwnProperty("secondsBehindSourceThreshold")) { - properties._secondsBehindSourceThreshold = 1; - if (!$util.isInteger(message.secondsBehindSourceThreshold)) - return "secondsBehindSourceThreshold: integer expected"; - } - if (message.transactionDurationThreshold != null && message.hasOwnProperty("transactionDurationThreshold")) { - properties._transactionDurationThreshold = 1; - if (!$util.isInteger(message.transactionDurationThreshold)) - return "transactionDurationThreshold: integer expected"; - } - return null; - }; - - /** - * Creates a PerformanceCaptureConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.PerformanceCaptureConfig} PerformanceCaptureConfig - */ - PerformanceCaptureConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.PerformanceCaptureConfig) - return object; - var message = new $root.google.cloud.sql.v1.PerformanceCaptureConfig(); - if (object.enabled != null) - message.enabled = Boolean(object.enabled); - if (object.probingIntervalSeconds != null) - message.probingIntervalSeconds = object.probingIntervalSeconds | 0; - if (object.probeThreshold != null) - message.probeThreshold = object.probeThreshold | 0; - if (object.runningThreadsThreshold != null) - message.runningThreadsThreshold = object.runningThreadsThreshold | 0; - if (object.secondsBehindSourceThreshold != null) - message.secondsBehindSourceThreshold = object.secondsBehindSourceThreshold | 0; - if (object.transactionDurationThreshold != null) - message.transactionDurationThreshold = object.transactionDurationThreshold | 0; - return message; - }; - - /** - * Creates a plain object from a PerformanceCaptureConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @static - * @param {google.cloud.sql.v1.PerformanceCaptureConfig} message PerformanceCaptureConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PerformanceCaptureConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - object.enabled = message.enabled; - if (options.oneofs) - object._enabled = "enabled"; - } - if (message.probingIntervalSeconds != null && message.hasOwnProperty("probingIntervalSeconds")) { - object.probingIntervalSeconds = message.probingIntervalSeconds; - if (options.oneofs) - object._probingIntervalSeconds = "probingIntervalSeconds"; - } - if (message.probeThreshold != null && message.hasOwnProperty("probeThreshold")) { - object.probeThreshold = message.probeThreshold; - if (options.oneofs) - object._probeThreshold = "probeThreshold"; - } - if (message.runningThreadsThreshold != null && message.hasOwnProperty("runningThreadsThreshold")) { - object.runningThreadsThreshold = message.runningThreadsThreshold; - if (options.oneofs) - object._runningThreadsThreshold = "runningThreadsThreshold"; - } - if (message.secondsBehindSourceThreshold != null && message.hasOwnProperty("secondsBehindSourceThreshold")) { - object.secondsBehindSourceThreshold = message.secondsBehindSourceThreshold; - if (options.oneofs) - object._secondsBehindSourceThreshold = "secondsBehindSourceThreshold"; - } - if (message.transactionDurationThreshold != null && message.hasOwnProperty("transactionDurationThreshold")) { - object.transactionDurationThreshold = message.transactionDurationThreshold; - if (options.oneofs) - object._transactionDurationThreshold = "transactionDurationThreshold"; - } - return object; - }; - - /** - * Converts this PerformanceCaptureConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @instance - * @returns {Object.} JSON object - */ - PerformanceCaptureConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PerformanceCaptureConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.PerformanceCaptureConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PerformanceCaptureConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.PerformanceCaptureConfig"; - }; - - return PerformanceCaptureConfig; - })(); - - v1.ConnectionPoolFlags = (function() { - - /** - * Properties of a ConnectionPoolFlags. - * @memberof google.cloud.sql.v1 - * @interface IConnectionPoolFlags - * @property {string|null} [name] ConnectionPoolFlags name - * @property {string|null} [value] ConnectionPoolFlags value - */ - - /** - * Constructs a new ConnectionPoolFlags. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a ConnectionPoolFlags. - * @implements IConnectionPoolFlags - * @constructor - * @param {google.cloud.sql.v1.IConnectionPoolFlags=} [properties] Properties to set - */ - function ConnectionPoolFlags(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectionPoolFlags name. - * @member {string} name - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @instance - */ - ConnectionPoolFlags.prototype.name = ""; - - /** - * ConnectionPoolFlags value. - * @member {string} value - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @instance - */ - ConnectionPoolFlags.prototype.value = ""; - - /** - * Creates a new ConnectionPoolFlags instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @static - * @param {google.cloud.sql.v1.IConnectionPoolFlags=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ConnectionPoolFlags} ConnectionPoolFlags instance - */ - ConnectionPoolFlags.create = function create(properties) { - return new ConnectionPoolFlags(properties); - }; - - /** - * Encodes the specified ConnectionPoolFlags message. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolFlags.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @static - * @param {google.cloud.sql.v1.IConnectionPoolFlags} message ConnectionPoolFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionPoolFlags.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified ConnectionPoolFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolFlags.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @static - * @param {google.cloud.sql.v1.IConnectionPoolFlags} message ConnectionPoolFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionPoolFlags.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectionPoolFlags message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ConnectionPoolFlags} ConnectionPoolFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionPoolFlags.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ConnectionPoolFlags(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectionPoolFlags message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ConnectionPoolFlags} ConnectionPoolFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionPoolFlags.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectionPoolFlags message. - * @function verify - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectionPoolFlags.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a ConnectionPoolFlags message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ConnectionPoolFlags} ConnectionPoolFlags - */ - ConnectionPoolFlags.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ConnectionPoolFlags) - return object; - var message = new $root.google.cloud.sql.v1.ConnectionPoolFlags(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a ConnectionPoolFlags message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @static - * @param {google.cloud.sql.v1.ConnectionPoolFlags} message ConnectionPoolFlags - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectionPoolFlags.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.value = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this ConnectionPoolFlags to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @instance - * @returns {Object.} JSON object - */ - ConnectionPoolFlags.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ConnectionPoolFlags - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ConnectionPoolFlags - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ConnectionPoolFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ConnectionPoolFlags"; - }; - - return ConnectionPoolFlags; - })(); - - v1.ConnectionPoolConfig = (function() { - - /** - * Properties of a ConnectionPoolConfig. - * @memberof google.cloud.sql.v1 - * @interface IConnectionPoolConfig - * @property {boolean|null} [connectionPoolingEnabled] ConnectionPoolConfig connectionPoolingEnabled - * @property {Array.|null} [flags] ConnectionPoolConfig flags - * @property {number|null} [poolerCount] ConnectionPoolConfig poolerCount - */ - - /** - * Constructs a new ConnectionPoolConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a ConnectionPoolConfig. - * @implements IConnectionPoolConfig - * @constructor - * @param {google.cloud.sql.v1.IConnectionPoolConfig=} [properties] Properties to set - */ - function ConnectionPoolConfig(properties) { - this.flags = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectionPoolConfig connectionPoolingEnabled. - * @member {boolean|null|undefined} connectionPoolingEnabled - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @instance - */ - ConnectionPoolConfig.prototype.connectionPoolingEnabled = null; - - /** - * ConnectionPoolConfig flags. - * @member {Array.} flags - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @instance - */ - ConnectionPoolConfig.prototype.flags = $util.emptyArray; - - /** - * ConnectionPoolConfig poolerCount. - * @member {number|null|undefined} poolerCount - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @instance - */ - ConnectionPoolConfig.prototype.poolerCount = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ConnectionPoolConfig.prototype, "_connectionPoolingEnabled", { - get: $util.oneOfGetter($oneOfFields = ["connectionPoolingEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ConnectionPoolConfig.prototype, "_poolerCount", { - get: $util.oneOfGetter($oneOfFields = ["poolerCount"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ConnectionPoolConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @static - * @param {google.cloud.sql.v1.IConnectionPoolConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ConnectionPoolConfig} ConnectionPoolConfig instance - */ - ConnectionPoolConfig.create = function create(properties) { - return new ConnectionPoolConfig(properties); - }; - - /** - * Encodes the specified ConnectionPoolConfig message. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @static - * @param {google.cloud.sql.v1.IConnectionPoolConfig} message ConnectionPoolConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionPoolConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connectionPoolingEnabled != null && Object.hasOwnProperty.call(message, "connectionPoolingEnabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.connectionPoolingEnabled); - if (message.flags != null && message.flags.length) - for (var i = 0; i < message.flags.length; ++i) - $root.google.cloud.sql.v1.ConnectionPoolFlags.encode(message.flags[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.poolerCount != null && Object.hasOwnProperty.call(message, "poolerCount")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.poolerCount); - return writer; - }; - - /** - * Encodes the specified ConnectionPoolConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectionPoolConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @static - * @param {google.cloud.sql.v1.IConnectionPoolConfig} message ConnectionPoolConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionPoolConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectionPoolConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ConnectionPoolConfig} ConnectionPoolConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionPoolConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ConnectionPoolConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.connectionPoolingEnabled = reader.bool(); - break; - } - case 8: { - if (!(message.flags && message.flags.length)) - message.flags = []; - message.flags.push($root.google.cloud.sql.v1.ConnectionPoolFlags.decode(reader, reader.uint32())); - break; - } - case 9: { - message.poolerCount = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectionPoolConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ConnectionPoolConfig} ConnectionPoolConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionPoolConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectionPoolConfig message. - * @function verify - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectionPoolConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.connectionPoolingEnabled != null && message.hasOwnProperty("connectionPoolingEnabled")) { - properties._connectionPoolingEnabled = 1; - if (typeof message.connectionPoolingEnabled !== "boolean") - return "connectionPoolingEnabled: boolean expected"; - } - if (message.flags != null && message.hasOwnProperty("flags")) { - if (!Array.isArray(message.flags)) - return "flags: array expected"; - for (var i = 0; i < message.flags.length; ++i) { - var error = $root.google.cloud.sql.v1.ConnectionPoolFlags.verify(message.flags[i]); - if (error) - return "flags." + error; - } - } - if (message.poolerCount != null && message.hasOwnProperty("poolerCount")) { - properties._poolerCount = 1; - if (!$util.isInteger(message.poolerCount)) - return "poolerCount: integer expected"; - } - return null; - }; - - /** - * Creates a ConnectionPoolConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ConnectionPoolConfig} ConnectionPoolConfig - */ - ConnectionPoolConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ConnectionPoolConfig) - return object; - var message = new $root.google.cloud.sql.v1.ConnectionPoolConfig(); - if (object.connectionPoolingEnabled != null) - message.connectionPoolingEnabled = Boolean(object.connectionPoolingEnabled); - if (object.flags) { - if (!Array.isArray(object.flags)) - throw TypeError(".google.cloud.sql.v1.ConnectionPoolConfig.flags: array expected"); - message.flags = []; - for (var i = 0; i < object.flags.length; ++i) { - if (typeof object.flags[i] !== "object") - throw TypeError(".google.cloud.sql.v1.ConnectionPoolConfig.flags: object expected"); - message.flags[i] = $root.google.cloud.sql.v1.ConnectionPoolFlags.fromObject(object.flags[i]); - } - } - if (object.poolerCount != null) - message.poolerCount = object.poolerCount | 0; - return message; - }; - - /** - * Creates a plain object from a ConnectionPoolConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @static - * @param {google.cloud.sql.v1.ConnectionPoolConfig} message ConnectionPoolConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectionPoolConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.flags = []; - if (message.connectionPoolingEnabled != null && message.hasOwnProperty("connectionPoolingEnabled")) { - object.connectionPoolingEnabled = message.connectionPoolingEnabled; - if (options.oneofs) - object._connectionPoolingEnabled = "connectionPoolingEnabled"; - } - if (message.flags && message.flags.length) { - object.flags = []; - for (var j = 0; j < message.flags.length; ++j) - object.flags[j] = $root.google.cloud.sql.v1.ConnectionPoolFlags.toObject(message.flags[j], options); - } - if (message.poolerCount != null && message.hasOwnProperty("poolerCount")) { - object.poolerCount = message.poolerCount; - if (options.oneofs) - object._poolerCount = "poolerCount"; - } - return object; - }; - - /** - * Converts this ConnectionPoolConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @instance - * @returns {Object.} JSON object - */ - ConnectionPoolConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ConnectionPoolConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ConnectionPoolConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ConnectionPoolConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ConnectionPoolConfig"; - }; - - return ConnectionPoolConfig; - })(); - - v1.ReadPoolAutoScaleConfig = (function() { - - /** - * Properties of a ReadPoolAutoScaleConfig. - * @memberof google.cloud.sql.v1 - * @interface IReadPoolAutoScaleConfig - * @property {boolean|null} [enabled] ReadPoolAutoScaleConfig enabled - * @property {number|null} [minNodeCount] ReadPoolAutoScaleConfig minNodeCount - * @property {number|null} [maxNodeCount] ReadPoolAutoScaleConfig maxNodeCount - * @property {Array.|null} [targetMetrics] ReadPoolAutoScaleConfig targetMetrics - * @property {boolean|null} [disableScaleIn] ReadPoolAutoScaleConfig disableScaleIn - * @property {number|null} [scaleInCooldownSeconds] ReadPoolAutoScaleConfig scaleInCooldownSeconds - * @property {number|null} [scaleOutCooldownSeconds] ReadPoolAutoScaleConfig scaleOutCooldownSeconds - */ - - /** - * Constructs a new ReadPoolAutoScaleConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a ReadPoolAutoScaleConfig. - * @implements IReadPoolAutoScaleConfig - * @constructor - * @param {google.cloud.sql.v1.IReadPoolAutoScaleConfig=} [properties] Properties to set - */ - function ReadPoolAutoScaleConfig(properties) { - this.targetMetrics = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReadPoolAutoScaleConfig enabled. - * @member {boolean|null|undefined} enabled - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.enabled = null; - - /** - * ReadPoolAutoScaleConfig minNodeCount. - * @member {number|null|undefined} minNodeCount - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.minNodeCount = null; - - /** - * ReadPoolAutoScaleConfig maxNodeCount. - * @member {number|null|undefined} maxNodeCount - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.maxNodeCount = null; - - /** - * ReadPoolAutoScaleConfig targetMetrics. - * @member {Array.} targetMetrics - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.targetMetrics = $util.emptyArray; - - /** - * ReadPoolAutoScaleConfig disableScaleIn. - * @member {boolean|null|undefined} disableScaleIn - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.disableScaleIn = null; - - /** - * ReadPoolAutoScaleConfig scaleInCooldownSeconds. - * @member {number|null|undefined} scaleInCooldownSeconds - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.scaleInCooldownSeconds = null; - - /** - * ReadPoolAutoScaleConfig scaleOutCooldownSeconds. - * @member {number|null|undefined} scaleOutCooldownSeconds - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.scaleOutCooldownSeconds = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_enabled", { - get: $util.oneOfGetter($oneOfFields = ["enabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_minNodeCount", { - get: $util.oneOfGetter($oneOfFields = ["minNodeCount"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_maxNodeCount", { - get: $util.oneOfGetter($oneOfFields = ["maxNodeCount"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_disableScaleIn", { - get: $util.oneOfGetter($oneOfFields = ["disableScaleIn"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_scaleInCooldownSeconds", { - get: $util.oneOfGetter($oneOfFields = ["scaleInCooldownSeconds"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_scaleOutCooldownSeconds", { - get: $util.oneOfGetter($oneOfFields = ["scaleOutCooldownSeconds"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ReadPoolAutoScaleConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @static - * @param {google.cloud.sql.v1.IReadPoolAutoScaleConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig instance - */ - ReadPoolAutoScaleConfig.create = function create(properties) { - return new ReadPoolAutoScaleConfig(properties); - }; - - /** - * Encodes the specified ReadPoolAutoScaleConfig message. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @static - * @param {google.cloud.sql.v1.IReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadPoolAutoScaleConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); - if (message.minNodeCount != null && Object.hasOwnProperty.call(message, "minNodeCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.minNodeCount); - if (message.maxNodeCount != null && Object.hasOwnProperty.call(message, "maxNodeCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxNodeCount); - if (message.targetMetrics != null && message.targetMetrics.length) - for (var i = 0; i < message.targetMetrics.length; ++i) - $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.encode(message.targetMetrics[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.disableScaleIn != null && Object.hasOwnProperty.call(message, "disableScaleIn")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.disableScaleIn); - if (message.scaleInCooldownSeconds != null && Object.hasOwnProperty.call(message, "scaleInCooldownSeconds")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.scaleInCooldownSeconds); - if (message.scaleOutCooldownSeconds != null && Object.hasOwnProperty.call(message, "scaleOutCooldownSeconds")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.scaleOutCooldownSeconds); - return writer; - }; - - /** - * Encodes the specified ReadPoolAutoScaleConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @static - * @param {google.cloud.sql.v1.IReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadPoolAutoScaleConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadPoolAutoScaleConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.enabled = reader.bool(); - break; - } - case 2: { - message.minNodeCount = reader.int32(); - break; - } - case 3: { - message.maxNodeCount = reader.int32(); - break; - } - case 4: { - if (!(message.targetMetrics && message.targetMetrics.length)) - message.targetMetrics = []; - message.targetMetrics.push($root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.decode(reader, reader.uint32())); - break; - } - case 5: { - message.disableScaleIn = reader.bool(); - break; - } - case 6: { - message.scaleInCooldownSeconds = reader.int32(); - break; - } - case 7: { - message.scaleOutCooldownSeconds = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadPoolAutoScaleConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReadPoolAutoScaleConfig message. - * @function verify - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReadPoolAutoScaleConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - properties._enabled = 1; - if (typeof message.enabled !== "boolean") - return "enabled: boolean expected"; - } - if (message.minNodeCount != null && message.hasOwnProperty("minNodeCount")) { - properties._minNodeCount = 1; - if (!$util.isInteger(message.minNodeCount)) - return "minNodeCount: integer expected"; - } - if (message.maxNodeCount != null && message.hasOwnProperty("maxNodeCount")) { - properties._maxNodeCount = 1; - if (!$util.isInteger(message.maxNodeCount)) - return "maxNodeCount: integer expected"; - } - if (message.targetMetrics != null && message.hasOwnProperty("targetMetrics")) { - if (!Array.isArray(message.targetMetrics)) - return "targetMetrics: array expected"; - for (var i = 0; i < message.targetMetrics.length; ++i) { - var error = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.verify(message.targetMetrics[i]); - if (error) - return "targetMetrics." + error; - } - } - if (message.disableScaleIn != null && message.hasOwnProperty("disableScaleIn")) { - properties._disableScaleIn = 1; - if (typeof message.disableScaleIn !== "boolean") - return "disableScaleIn: boolean expected"; - } - if (message.scaleInCooldownSeconds != null && message.hasOwnProperty("scaleInCooldownSeconds")) { - properties._scaleInCooldownSeconds = 1; - if (!$util.isInteger(message.scaleInCooldownSeconds)) - return "scaleInCooldownSeconds: integer expected"; - } - if (message.scaleOutCooldownSeconds != null && message.hasOwnProperty("scaleOutCooldownSeconds")) { - properties._scaleOutCooldownSeconds = 1; - if (!$util.isInteger(message.scaleOutCooldownSeconds)) - return "scaleOutCooldownSeconds: integer expected"; - } - return null; - }; - - /** - * Creates a ReadPoolAutoScaleConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig - */ - ReadPoolAutoScaleConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig) - return object; - var message = new $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig(); - if (object.enabled != null) - message.enabled = Boolean(object.enabled); - if (object.minNodeCount != null) - message.minNodeCount = object.minNodeCount | 0; - if (object.maxNodeCount != null) - message.maxNodeCount = object.maxNodeCount | 0; - if (object.targetMetrics) { - if (!Array.isArray(object.targetMetrics)) - throw TypeError(".google.cloud.sql.v1.ReadPoolAutoScaleConfig.targetMetrics: array expected"); - message.targetMetrics = []; - for (var i = 0; i < object.targetMetrics.length; ++i) { - if (typeof object.targetMetrics[i] !== "object") - throw TypeError(".google.cloud.sql.v1.ReadPoolAutoScaleConfig.targetMetrics: object expected"); - message.targetMetrics[i] = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.fromObject(object.targetMetrics[i]); - } - } - if (object.disableScaleIn != null) - message.disableScaleIn = Boolean(object.disableScaleIn); - if (object.scaleInCooldownSeconds != null) - message.scaleInCooldownSeconds = object.scaleInCooldownSeconds | 0; - if (object.scaleOutCooldownSeconds != null) - message.scaleOutCooldownSeconds = object.scaleOutCooldownSeconds | 0; - return message; - }; - - /** - * Creates a plain object from a ReadPoolAutoScaleConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @static - * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReadPoolAutoScaleConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.targetMetrics = []; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - object.enabled = message.enabled; - if (options.oneofs) - object._enabled = "enabled"; - } - if (message.minNodeCount != null && message.hasOwnProperty("minNodeCount")) { - object.minNodeCount = message.minNodeCount; - if (options.oneofs) - object._minNodeCount = "minNodeCount"; - } - if (message.maxNodeCount != null && message.hasOwnProperty("maxNodeCount")) { - object.maxNodeCount = message.maxNodeCount; - if (options.oneofs) - object._maxNodeCount = "maxNodeCount"; - } - if (message.targetMetrics && message.targetMetrics.length) { - object.targetMetrics = []; - for (var j = 0; j < message.targetMetrics.length; ++j) - object.targetMetrics[j] = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.toObject(message.targetMetrics[j], options); - } - if (message.disableScaleIn != null && message.hasOwnProperty("disableScaleIn")) { - object.disableScaleIn = message.disableScaleIn; - if (options.oneofs) - object._disableScaleIn = "disableScaleIn"; - } - if (message.scaleInCooldownSeconds != null && message.hasOwnProperty("scaleInCooldownSeconds")) { - object.scaleInCooldownSeconds = message.scaleInCooldownSeconds; - if (options.oneofs) - object._scaleInCooldownSeconds = "scaleInCooldownSeconds"; - } - if (message.scaleOutCooldownSeconds != null && message.hasOwnProperty("scaleOutCooldownSeconds")) { - object.scaleOutCooldownSeconds = message.scaleOutCooldownSeconds; - if (options.oneofs) - object._scaleOutCooldownSeconds = "scaleOutCooldownSeconds"; - } - return object; - }; - - /** - * Converts this ReadPoolAutoScaleConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @instance - * @returns {Object.} JSON object - */ - ReadPoolAutoScaleConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReadPoolAutoScaleConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReadPoolAutoScaleConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ReadPoolAutoScaleConfig"; - }; - - ReadPoolAutoScaleConfig.TargetMetric = (function() { - - /** - * Properties of a TargetMetric. - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @interface ITargetMetric - * @property {string|null} [metric] TargetMetric metric - * @property {number|null} [targetValue] TargetMetric targetValue - */ - - /** - * Constructs a new TargetMetric. - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig - * @classdesc Represents a TargetMetric. - * @implements ITargetMetric - * @constructor - * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric=} [properties] Properties to set - */ - function TargetMetric(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TargetMetric metric. - * @member {string|null|undefined} metric - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @instance - */ - TargetMetric.prototype.metric = null; - - /** - * TargetMetric targetValue. - * @member {number|null|undefined} targetValue - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @instance - */ - TargetMetric.prototype.targetValue = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(TargetMetric.prototype, "_metric", { - get: $util.oneOfGetter($oneOfFields = ["metric"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(TargetMetric.prototype, "_targetValue", { - get: $util.oneOfGetter($oneOfFields = ["targetValue"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new TargetMetric instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric instance - */ - TargetMetric.create = function create(properties) { - return new TargetMetric(properties); - }; - - /** - * Encodes the specified TargetMetric message. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric} message TargetMetric message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TargetMetric.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.metric != null && Object.hasOwnProperty.call(message, "metric")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.metric); - if (message.targetValue != null && Object.hasOwnProperty.call(message, "targetValue")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.targetValue); - return writer; - }; - - /** - * Encodes the specified TargetMetric message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig.ITargetMetric} message TargetMetric message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TargetMetric.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TargetMetric message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TargetMetric.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.metric = reader.string(); - break; - } - case 2: { - message.targetValue = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TargetMetric message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TargetMetric.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TargetMetric message. - * @function verify - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TargetMetric.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.metric != null && message.hasOwnProperty("metric")) { - properties._metric = 1; - if (!$util.isString(message.metric)) - return "metric: string expected"; - } - if (message.targetValue != null && message.hasOwnProperty("targetValue")) { - properties._targetValue = 1; - if (typeof message.targetValue !== "number") - return "targetValue: number expected"; - } - return null; - }; - - /** - * Creates a TargetMetric message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric - */ - TargetMetric.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric) - return object; - var message = new $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric(); - if (object.metric != null) - message.metric = String(object.metric); - if (object.targetValue != null) - message.targetValue = Number(object.targetValue); - return message; - }; - - /** - * Creates a plain object from a TargetMetric message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric} message TargetMetric - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TargetMetric.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.metric != null && message.hasOwnProperty("metric")) { - object.metric = message.metric; - if (options.oneofs) - object._metric = "metric"; - } - if (message.targetValue != null && message.hasOwnProperty("targetValue")) { - object.targetValue = options.json && !isFinite(message.targetValue) ? String(message.targetValue) : message.targetValue; - if (options.oneofs) - object._targetValue = "targetValue"; - } - return object; - }; - - /** - * Converts this TargetMetric to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @instance - * @returns {Object.} JSON object - */ - TargetMetric.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TargetMetric - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TargetMetric.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ReadPoolAutoScaleConfig.TargetMetric"; - }; - - return TargetMetric; - })(); - - return ReadPoolAutoScaleConfig; - })(); - - v1.AdvancedMachineFeatures = (function() { - - /** - * Properties of an AdvancedMachineFeatures. - * @memberof google.cloud.sql.v1 - * @interface IAdvancedMachineFeatures - * @property {number|null} [threadsPerCore] AdvancedMachineFeatures threadsPerCore - */ - - /** - * Constructs a new AdvancedMachineFeatures. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an AdvancedMachineFeatures. - * @implements IAdvancedMachineFeatures - * @constructor - * @param {google.cloud.sql.v1.IAdvancedMachineFeatures=} [properties] Properties to set - */ - function AdvancedMachineFeatures(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AdvancedMachineFeatures threadsPerCore. - * @member {number} threadsPerCore - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @instance - */ - AdvancedMachineFeatures.prototype.threadsPerCore = 0; - - /** - * Creates a new AdvancedMachineFeatures instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @static - * @param {google.cloud.sql.v1.IAdvancedMachineFeatures=} [properties] Properties to set - * @returns {google.cloud.sql.v1.AdvancedMachineFeatures} AdvancedMachineFeatures instance - */ - AdvancedMachineFeatures.create = function create(properties) { - return new AdvancedMachineFeatures(properties); - }; - - /** - * Encodes the specified AdvancedMachineFeatures message. Does not implicitly {@link google.cloud.sql.v1.AdvancedMachineFeatures.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @static - * @param {google.cloud.sql.v1.IAdvancedMachineFeatures} message AdvancedMachineFeatures message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AdvancedMachineFeatures.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.threadsPerCore != null && Object.hasOwnProperty.call(message, "threadsPerCore")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.threadsPerCore); - return writer; - }; - - /** - * Encodes the specified AdvancedMachineFeatures message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AdvancedMachineFeatures.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @static - * @param {google.cloud.sql.v1.IAdvancedMachineFeatures} message AdvancedMachineFeatures message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AdvancedMachineFeatures.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AdvancedMachineFeatures message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.AdvancedMachineFeatures} AdvancedMachineFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AdvancedMachineFeatures.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.AdvancedMachineFeatures(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.threadsPerCore = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AdvancedMachineFeatures message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.AdvancedMachineFeatures} AdvancedMachineFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AdvancedMachineFeatures.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AdvancedMachineFeatures message. - * @function verify - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AdvancedMachineFeatures.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.threadsPerCore != null && message.hasOwnProperty("threadsPerCore")) - if (!$util.isInteger(message.threadsPerCore)) - return "threadsPerCore: integer expected"; - return null; - }; - - /** - * Creates an AdvancedMachineFeatures message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.AdvancedMachineFeatures} AdvancedMachineFeatures - */ - AdvancedMachineFeatures.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.AdvancedMachineFeatures) - return object; - var message = new $root.google.cloud.sql.v1.AdvancedMachineFeatures(); - if (object.threadsPerCore != null) - message.threadsPerCore = object.threadsPerCore | 0; - return message; - }; - - /** - * Creates a plain object from an AdvancedMachineFeatures message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @static - * @param {google.cloud.sql.v1.AdvancedMachineFeatures} message AdvancedMachineFeatures - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AdvancedMachineFeatures.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.threadsPerCore = 0; - if (message.threadsPerCore != null && message.hasOwnProperty("threadsPerCore")) - object.threadsPerCore = message.threadsPerCore; - return object; - }; - - /** - * Converts this AdvancedMachineFeatures to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @instance - * @returns {Object.} JSON object - */ - AdvancedMachineFeatures.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AdvancedMachineFeatures - * @function getTypeUrl - * @memberof google.cloud.sql.v1.AdvancedMachineFeatures - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AdvancedMachineFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.AdvancedMachineFeatures"; - }; - - return AdvancedMachineFeatures; - })(); - - v1.SslCert = (function() { - - /** - * Properties of a SslCert. - * @memberof google.cloud.sql.v1 - * @interface ISslCert - * @property {string|null} [kind] SslCert kind - * @property {string|null} [certSerialNumber] SslCert certSerialNumber - * @property {string|null} [cert] SslCert cert - * @property {google.protobuf.ITimestamp|null} [createTime] SslCert createTime - * @property {string|null} [commonName] SslCert commonName - * @property {google.protobuf.ITimestamp|null} [expirationTime] SslCert expirationTime - * @property {string|null} [sha1Fingerprint] SslCert sha1Fingerprint - * @property {string|null} [instance] SslCert instance - * @property {string|null} [selfLink] SslCert selfLink - */ - - /** - * Constructs a new SslCert. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SslCert. - * @implements ISslCert - * @constructor - * @param {google.cloud.sql.v1.ISslCert=} [properties] Properties to set - */ - function SslCert(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCert kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.SslCert - * @instance - */ - SslCert.prototype.kind = ""; - - /** - * SslCert certSerialNumber. - * @member {string} certSerialNumber - * @memberof google.cloud.sql.v1.SslCert - * @instance - */ - SslCert.prototype.certSerialNumber = ""; - - /** - * SslCert cert. - * @member {string} cert - * @memberof google.cloud.sql.v1.SslCert - * @instance - */ - SslCert.prototype.cert = ""; - - /** - * SslCert createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.sql.v1.SslCert - * @instance - */ - SslCert.prototype.createTime = null; - - /** - * SslCert commonName. - * @member {string} commonName - * @memberof google.cloud.sql.v1.SslCert - * @instance - */ - SslCert.prototype.commonName = ""; - - /** - * SslCert expirationTime. - * @member {google.protobuf.ITimestamp|null|undefined} expirationTime - * @memberof google.cloud.sql.v1.SslCert - * @instance - */ - SslCert.prototype.expirationTime = null; - - /** - * SslCert sha1Fingerprint. - * @member {string} sha1Fingerprint - * @memberof google.cloud.sql.v1.SslCert - * @instance - */ - SslCert.prototype.sha1Fingerprint = ""; - - /** - * SslCert instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SslCert - * @instance - */ - SslCert.prototype.instance = ""; - - /** - * SslCert selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1.SslCert - * @instance - */ - SslCert.prototype.selfLink = ""; - - /** - * Creates a new SslCert instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SslCert - * @static - * @param {google.cloud.sql.v1.ISslCert=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SslCert} SslCert instance - */ - SslCert.create = function create(properties) { - return new SslCert(properties); - }; - - /** - * Encodes the specified SslCert message. Does not implicitly {@link google.cloud.sql.v1.SslCert.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SslCert - * @static - * @param {google.cloud.sql.v1.ISslCert} message SslCert message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCert.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.certSerialNumber != null && Object.hasOwnProperty.call(message, "certSerialNumber")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.certSerialNumber); - if (message.cert != null && Object.hasOwnProperty.call(message, "cert")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.cert); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.commonName != null && Object.hasOwnProperty.call(message, "commonName")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.commonName); - if (message.expirationTime != null && Object.hasOwnProperty.call(message, "expirationTime")) - $root.google.protobuf.Timestamp.encode(message.expirationTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.sha1Fingerprint); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.instance); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.selfLink); - return writer; - }; - - /** - * Encodes the specified SslCert message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCert.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SslCert - * @static - * @param {google.cloud.sql.v1.ISslCert} message SslCert message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCert.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCert message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SslCert - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SslCert} SslCert - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCert.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCert(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.certSerialNumber = reader.string(); - break; - } - case 3: { - message.cert = reader.string(); - break; - } - case 4: { - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 5: { - message.commonName = reader.string(); - break; - } - case 6: { - message.expirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 7: { - message.sha1Fingerprint = reader.string(); - break; - } - case 8: { - message.instance = reader.string(); - break; - } - case 9: { - message.selfLink = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCert message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SslCert - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SslCert} SslCert - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCert.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCert message. - * @function verify - * @memberof google.cloud.sql.v1.SslCert - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCert.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.certSerialNumber != null && message.hasOwnProperty("certSerialNumber")) - if (!$util.isString(message.certSerialNumber)) - return "certSerialNumber: string expected"; - if (message.cert != null && message.hasOwnProperty("cert")) - if (!$util.isString(message.cert)) - return "cert: string expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.commonName != null && message.hasOwnProperty("commonName")) - if (!$util.isString(message.commonName)) - return "commonName: string expected"; - if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.expirationTime); - if (error) - return "expirationTime." + error; - } - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - if (!$util.isString(message.sha1Fingerprint)) - return "sha1Fingerprint: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - return null; - }; - - /** - * Creates a SslCert message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SslCert - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SslCert} SslCert - */ - SslCert.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SslCert) - return object; - var message = new $root.google.cloud.sql.v1.SslCert(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.certSerialNumber != null) - message.certSerialNumber = String(object.certSerialNumber); - if (object.cert != null) - message.cert = String(object.cert); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.sql.v1.SslCert.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.commonName != null) - message.commonName = String(object.commonName); - if (object.expirationTime != null) { - if (typeof object.expirationTime !== "object") - throw TypeError(".google.cloud.sql.v1.SslCert.expirationTime: object expected"); - message.expirationTime = $root.google.protobuf.Timestamp.fromObject(object.expirationTime); - } - if (object.sha1Fingerprint != null) - message.sha1Fingerprint = String(object.sha1Fingerprint); - if (object.instance != null) - message.instance = String(object.instance); - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - return message; - }; - - /** - * Creates a plain object from a SslCert message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SslCert - * @static - * @param {google.cloud.sql.v1.SslCert} message SslCert - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCert.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.certSerialNumber = ""; - object.cert = ""; - object.createTime = null; - object.commonName = ""; - object.expirationTime = null; - object.sha1Fingerprint = ""; - object.instance = ""; - object.selfLink = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.certSerialNumber != null && message.hasOwnProperty("certSerialNumber")) - object.certSerialNumber = message.certSerialNumber; - if (message.cert != null && message.hasOwnProperty("cert")) - object.cert = message.cert; - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.commonName != null && message.hasOwnProperty("commonName")) - object.commonName = message.commonName; - if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) - object.expirationTime = $root.google.protobuf.Timestamp.toObject(message.expirationTime, options); - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - object.sha1Fingerprint = message.sha1Fingerprint; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - return object; - }; - - /** - * Converts this SslCert to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SslCert - * @instance - * @returns {Object.} JSON object - */ - SslCert.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCert - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SslCert - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCert.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SslCert"; - }; - - return SslCert; - })(); - - v1.SslCertDetail = (function() { - - /** - * Properties of a SslCertDetail. - * @memberof google.cloud.sql.v1 - * @interface ISslCertDetail - * @property {google.cloud.sql.v1.ISslCert|null} [certInfo] SslCertDetail certInfo - * @property {string|null} [certPrivateKey] SslCertDetail certPrivateKey - */ - - /** - * Constructs a new SslCertDetail. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SslCertDetail. - * @implements ISslCertDetail - * @constructor - * @param {google.cloud.sql.v1.ISslCertDetail=} [properties] Properties to set - */ - function SslCertDetail(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCertDetail certInfo. - * @member {google.cloud.sql.v1.ISslCert|null|undefined} certInfo - * @memberof google.cloud.sql.v1.SslCertDetail - * @instance - */ - SslCertDetail.prototype.certInfo = null; - - /** - * SslCertDetail certPrivateKey. - * @member {string} certPrivateKey - * @memberof google.cloud.sql.v1.SslCertDetail - * @instance - */ - SslCertDetail.prototype.certPrivateKey = ""; - - /** - * Creates a new SslCertDetail instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SslCertDetail - * @static - * @param {google.cloud.sql.v1.ISslCertDetail=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SslCertDetail} SslCertDetail instance - */ - SslCertDetail.create = function create(properties) { - return new SslCertDetail(properties); - }; - - /** - * Encodes the specified SslCertDetail message. Does not implicitly {@link google.cloud.sql.v1.SslCertDetail.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SslCertDetail - * @static - * @param {google.cloud.sql.v1.ISslCertDetail} message SslCertDetail message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertDetail.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certInfo != null && Object.hasOwnProperty.call(message, "certInfo")) - $root.google.cloud.sql.v1.SslCert.encode(message.certInfo, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.certPrivateKey != null && Object.hasOwnProperty.call(message, "certPrivateKey")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.certPrivateKey); - return writer; - }; - - /** - * Encodes the specified SslCertDetail message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertDetail.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SslCertDetail - * @static - * @param {google.cloud.sql.v1.ISslCertDetail} message SslCertDetail message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertDetail.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCertDetail message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SslCertDetail - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SslCertDetail} SslCertDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertDetail.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCertDetail(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.certInfo = $root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32()); - break; - } - case 2: { - message.certPrivateKey = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCertDetail message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SslCertDetail - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SslCertDetail} SslCertDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertDetail.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCertDetail message. - * @function verify - * @memberof google.cloud.sql.v1.SslCertDetail - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCertDetail.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certInfo != null && message.hasOwnProperty("certInfo")) { - var error = $root.google.cloud.sql.v1.SslCert.verify(message.certInfo); - if (error) - return "certInfo." + error; - } - if (message.certPrivateKey != null && message.hasOwnProperty("certPrivateKey")) - if (!$util.isString(message.certPrivateKey)) - return "certPrivateKey: string expected"; - return null; - }; - - /** - * Creates a SslCertDetail message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SslCertDetail - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SslCertDetail} SslCertDetail - */ - SslCertDetail.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SslCertDetail) - return object; - var message = new $root.google.cloud.sql.v1.SslCertDetail(); - if (object.certInfo != null) { - if (typeof object.certInfo !== "object") - throw TypeError(".google.cloud.sql.v1.SslCertDetail.certInfo: object expected"); - message.certInfo = $root.google.cloud.sql.v1.SslCert.fromObject(object.certInfo); - } - if (object.certPrivateKey != null) - message.certPrivateKey = String(object.certPrivateKey); - return message; - }; - - /** - * Creates a plain object from a SslCertDetail message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SslCertDetail - * @static - * @param {google.cloud.sql.v1.SslCertDetail} message SslCertDetail - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCertDetail.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.certInfo = null; - object.certPrivateKey = ""; - } - if (message.certInfo != null && message.hasOwnProperty("certInfo")) - object.certInfo = $root.google.cloud.sql.v1.SslCert.toObject(message.certInfo, options); - if (message.certPrivateKey != null && message.hasOwnProperty("certPrivateKey")) - object.certPrivateKey = message.certPrivateKey; - return object; - }; - - /** - * Converts this SslCertDetail to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SslCertDetail - * @instance - * @returns {Object.} JSON object - */ - SslCertDetail.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCertDetail - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SslCertDetail - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCertDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SslCertDetail"; - }; - - return SslCertDetail; - })(); - - v1.SqlActiveDirectoryConfig = (function() { - - /** - * Properties of a SqlActiveDirectoryConfig. - * @memberof google.cloud.sql.v1 - * @interface ISqlActiveDirectoryConfig - * @property {string|null} [kind] SqlActiveDirectoryConfig kind - * @property {string|null} [domain] SqlActiveDirectoryConfig domain - * @property {google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode|null} [mode] SqlActiveDirectoryConfig mode - * @property {Array.|null} [dnsServers] SqlActiveDirectoryConfig dnsServers - * @property {string|null} [adminCredentialSecretName] SqlActiveDirectoryConfig adminCredentialSecretName - * @property {string|null} [organizationalUnit] SqlActiveDirectoryConfig organizationalUnit - */ - - /** - * Constructs a new SqlActiveDirectoryConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlActiveDirectoryConfig. - * @implements ISqlActiveDirectoryConfig - * @constructor - * @param {google.cloud.sql.v1.ISqlActiveDirectoryConfig=} [properties] Properties to set - */ - function SqlActiveDirectoryConfig(properties) { - this.dnsServers = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlActiveDirectoryConfig kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.kind = ""; - - /** - * SqlActiveDirectoryConfig domain. - * @member {string} domain - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.domain = ""; - - /** - * SqlActiveDirectoryConfig mode. - * @member {google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode} mode - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.mode = 0; - - /** - * SqlActiveDirectoryConfig dnsServers. - * @member {Array.} dnsServers - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.dnsServers = $util.emptyArray; - - /** - * SqlActiveDirectoryConfig adminCredentialSecretName. - * @member {string} adminCredentialSecretName - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.adminCredentialSecretName = ""; - - /** - * SqlActiveDirectoryConfig organizationalUnit. - * @member {string} organizationalUnit - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.organizationalUnit = ""; - - /** - * Creates a new SqlActiveDirectoryConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @static - * @param {google.cloud.sql.v1.ISqlActiveDirectoryConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig instance - */ - SqlActiveDirectoryConfig.create = function create(properties) { - return new SqlActiveDirectoryConfig(properties); - }; - - /** - * Encodes the specified SqlActiveDirectoryConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlActiveDirectoryConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @static - * @param {google.cloud.sql.v1.ISqlActiveDirectoryConfig} message SqlActiveDirectoryConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlActiveDirectoryConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.domain != null && Object.hasOwnProperty.call(message, "domain")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.domain); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mode); - if (message.dnsServers != null && message.dnsServers.length) - for (var i = 0; i < message.dnsServers.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dnsServers[i]); - if (message.adminCredentialSecretName != null && Object.hasOwnProperty.call(message, "adminCredentialSecretName")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.adminCredentialSecretName); - if (message.organizationalUnit != null && Object.hasOwnProperty.call(message, "organizationalUnit")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.organizationalUnit); - return writer; - }; - - /** - * Encodes the specified SqlActiveDirectoryConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlActiveDirectoryConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @static - * @param {google.cloud.sql.v1.ISqlActiveDirectoryConfig} message SqlActiveDirectoryConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlActiveDirectoryConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlActiveDirectoryConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlActiveDirectoryConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.domain = reader.string(); - break; - } - case 3: { - message.mode = reader.int32(); - break; - } - case 4: { - if (!(message.dnsServers && message.dnsServers.length)) - message.dnsServers = []; - message.dnsServers.push(reader.string()); - break; - } - case 5: { - message.adminCredentialSecretName = reader.string(); - break; - } - case 6: { - message.organizationalUnit = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlActiveDirectoryConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlActiveDirectoryConfig message. - * @function verify - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlActiveDirectoryConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.domain != null && message.hasOwnProperty("domain")) - if (!$util.isString(message.domain)) - return "domain: string expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.dnsServers != null && message.hasOwnProperty("dnsServers")) { - if (!Array.isArray(message.dnsServers)) - return "dnsServers: array expected"; - for (var i = 0; i < message.dnsServers.length; ++i) - if (!$util.isString(message.dnsServers[i])) - return "dnsServers: string[] expected"; - } - if (message.adminCredentialSecretName != null && message.hasOwnProperty("adminCredentialSecretName")) - if (!$util.isString(message.adminCredentialSecretName)) - return "adminCredentialSecretName: string expected"; - if (message.organizationalUnit != null && message.hasOwnProperty("organizationalUnit")) - if (!$util.isString(message.organizationalUnit)) - return "organizationalUnit: string expected"; - return null; - }; - - /** - * Creates a SqlActiveDirectoryConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig - */ - SqlActiveDirectoryConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlActiveDirectoryConfig) - return object; - var message = new $root.google.cloud.sql.v1.SqlActiveDirectoryConfig(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.domain != null) - message.domain = String(object.domain); - switch (object.mode) { - default: - if (typeof object.mode === "number") { - message.mode = object.mode; - break; - } - break; - case "ACTIVE_DIRECTORY_MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "MANAGED_ACTIVE_DIRECTORY": - case 1: - message.mode = 1; - break; - case "SELF_MANAGED_ACTIVE_DIRECTORY": - case 2: - message.mode = 2; - break; - case "CUSTOMER_MANAGED_ACTIVE_DIRECTORY": - case 3: - message.mode = 3; - break; - } - if (object.dnsServers) { - if (!Array.isArray(object.dnsServers)) - throw TypeError(".google.cloud.sql.v1.SqlActiveDirectoryConfig.dnsServers: array expected"); - message.dnsServers = []; - for (var i = 0; i < object.dnsServers.length; ++i) - message.dnsServers[i] = String(object.dnsServers[i]); - } - if (object.adminCredentialSecretName != null) - message.adminCredentialSecretName = String(object.adminCredentialSecretName); - if (object.organizationalUnit != null) - message.organizationalUnit = String(object.organizationalUnit); - return message; - }; - - /** - * Creates a plain object from a SqlActiveDirectoryConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @static - * @param {google.cloud.sql.v1.SqlActiveDirectoryConfig} message SqlActiveDirectoryConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlActiveDirectoryConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.dnsServers = []; - if (options.defaults) { - object.kind = ""; - object.domain = ""; - object.mode = options.enums === String ? "ACTIVE_DIRECTORY_MODE_UNSPECIFIED" : 0; - object.adminCredentialSecretName = ""; - object.organizationalUnit = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.domain != null && message.hasOwnProperty("domain")) - object.domain = message.domain; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode[message.mode] === undefined ? message.mode : $root.google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode[message.mode] : message.mode; - if (message.dnsServers && message.dnsServers.length) { - object.dnsServers = []; - for (var j = 0; j < message.dnsServers.length; ++j) - object.dnsServers[j] = message.dnsServers[j]; - } - if (message.adminCredentialSecretName != null && message.hasOwnProperty("adminCredentialSecretName")) - object.adminCredentialSecretName = message.adminCredentialSecretName; - if (message.organizationalUnit != null && message.hasOwnProperty("organizationalUnit")) - object.organizationalUnit = message.organizationalUnit; - return object; - }; - - /** - * Converts this SqlActiveDirectoryConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @instance - * @returns {Object.} JSON object - */ - SqlActiveDirectoryConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlActiveDirectoryConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlActiveDirectoryConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlActiveDirectoryConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlActiveDirectoryConfig"; - }; - - /** - * ActiveDirectoryMode enum. - * @name google.cloud.sql.v1.SqlActiveDirectoryConfig.ActiveDirectoryMode - * @enum {number} - * @property {number} ACTIVE_DIRECTORY_MODE_UNSPECIFIED=0 ACTIVE_DIRECTORY_MODE_UNSPECIFIED value - * @property {number} MANAGED_ACTIVE_DIRECTORY=1 MANAGED_ACTIVE_DIRECTORY value - * @property {number} SELF_MANAGED_ACTIVE_DIRECTORY=2 SELF_MANAGED_ACTIVE_DIRECTORY value - * @property {number} CUSTOMER_MANAGED_ACTIVE_DIRECTORY=3 CUSTOMER_MANAGED_ACTIVE_DIRECTORY value - */ - SqlActiveDirectoryConfig.ActiveDirectoryMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "ACTIVE_DIRECTORY_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "MANAGED_ACTIVE_DIRECTORY"] = 1; - values[valuesById[2] = "SELF_MANAGED_ACTIVE_DIRECTORY"] = 2; - values[valuesById[3] = "CUSTOMER_MANAGED_ACTIVE_DIRECTORY"] = 3; - return values; - })(); - - return SqlActiveDirectoryConfig; - })(); - - v1.SqlServerAuditConfig = (function() { - - /** - * Properties of a SqlServerAuditConfig. - * @memberof google.cloud.sql.v1 - * @interface ISqlServerAuditConfig - * @property {string|null} [kind] SqlServerAuditConfig kind - * @property {string|null} [bucket] SqlServerAuditConfig bucket - * @property {google.protobuf.IDuration|null} [retentionInterval] SqlServerAuditConfig retentionInterval - * @property {google.protobuf.IDuration|null} [uploadInterval] SqlServerAuditConfig uploadInterval - */ - - /** - * Constructs a new SqlServerAuditConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlServerAuditConfig. - * @implements ISqlServerAuditConfig - * @constructor - * @param {google.cloud.sql.v1.ISqlServerAuditConfig=} [properties] Properties to set - */ - function SqlServerAuditConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlServerAuditConfig kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @instance - */ - SqlServerAuditConfig.prototype.kind = ""; - - /** - * SqlServerAuditConfig bucket. - * @member {string} bucket - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @instance - */ - SqlServerAuditConfig.prototype.bucket = ""; - - /** - * SqlServerAuditConfig retentionInterval. - * @member {google.protobuf.IDuration|null|undefined} retentionInterval - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @instance - */ - SqlServerAuditConfig.prototype.retentionInterval = null; - - /** - * SqlServerAuditConfig uploadInterval. - * @member {google.protobuf.IDuration|null|undefined} uploadInterval - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @instance - */ - SqlServerAuditConfig.prototype.uploadInterval = null; - - /** - * Creates a new SqlServerAuditConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @static - * @param {google.cloud.sql.v1.ISqlServerAuditConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlServerAuditConfig} SqlServerAuditConfig instance - */ - SqlServerAuditConfig.create = function create(properties) { - return new SqlServerAuditConfig(properties); - }; - - /** - * Encodes the specified SqlServerAuditConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlServerAuditConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @static - * @param {google.cloud.sql.v1.ISqlServerAuditConfig} message SqlServerAuditConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerAuditConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.bucket); - if (message.retentionInterval != null && Object.hasOwnProperty.call(message, "retentionInterval")) - $root.google.protobuf.Duration.encode(message.retentionInterval, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.uploadInterval != null && Object.hasOwnProperty.call(message, "uploadInterval")) - $root.google.protobuf.Duration.encode(message.uploadInterval, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlServerAuditConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerAuditConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @static - * @param {google.cloud.sql.v1.ISqlServerAuditConfig} message SqlServerAuditConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerAuditConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlServerAuditConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlServerAuditConfig} SqlServerAuditConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerAuditConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlServerAuditConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.bucket = reader.string(); - break; - } - case 3: { - message.retentionInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - case 4: { - message.uploadInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlServerAuditConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlServerAuditConfig} SqlServerAuditConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerAuditConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlServerAuditConfig message. - * @function verify - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlServerAuditConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.bucket != null && message.hasOwnProperty("bucket")) - if (!$util.isString(message.bucket)) - return "bucket: string expected"; - if (message.retentionInterval != null && message.hasOwnProperty("retentionInterval")) { - var error = $root.google.protobuf.Duration.verify(message.retentionInterval); - if (error) - return "retentionInterval." + error; - } - if (message.uploadInterval != null && message.hasOwnProperty("uploadInterval")) { - var error = $root.google.protobuf.Duration.verify(message.uploadInterval); - if (error) - return "uploadInterval." + error; - } - return null; - }; - - /** - * Creates a SqlServerAuditConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlServerAuditConfig} SqlServerAuditConfig - */ - SqlServerAuditConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlServerAuditConfig) - return object; - var message = new $root.google.cloud.sql.v1.SqlServerAuditConfig(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.bucket != null) - message.bucket = String(object.bucket); - if (object.retentionInterval != null) { - if (typeof object.retentionInterval !== "object") - throw TypeError(".google.cloud.sql.v1.SqlServerAuditConfig.retentionInterval: object expected"); - message.retentionInterval = $root.google.protobuf.Duration.fromObject(object.retentionInterval); - } - if (object.uploadInterval != null) { - if (typeof object.uploadInterval !== "object") - throw TypeError(".google.cloud.sql.v1.SqlServerAuditConfig.uploadInterval: object expected"); - message.uploadInterval = $root.google.protobuf.Duration.fromObject(object.uploadInterval); - } - return message; - }; - - /** - * Creates a plain object from a SqlServerAuditConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @static - * @param {google.cloud.sql.v1.SqlServerAuditConfig} message SqlServerAuditConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlServerAuditConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.bucket = ""; - object.retentionInterval = null; - object.uploadInterval = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.bucket != null && message.hasOwnProperty("bucket")) - object.bucket = message.bucket; - if (message.retentionInterval != null && message.hasOwnProperty("retentionInterval")) - object.retentionInterval = $root.google.protobuf.Duration.toObject(message.retentionInterval, options); - if (message.uploadInterval != null && message.hasOwnProperty("uploadInterval")) - object.uploadInterval = $root.google.protobuf.Duration.toObject(message.uploadInterval, options); - return object; - }; - - /** - * Converts this SqlServerAuditConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @instance - * @returns {Object.} JSON object - */ - SqlServerAuditConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlServerAuditConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlServerAuditConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlServerAuditConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlServerAuditConfig"; - }; - - return SqlServerAuditConfig; - })(); - - v1.SqlServerEntraIdConfig = (function() { - - /** - * Properties of a SqlServerEntraIdConfig. - * @memberof google.cloud.sql.v1 - * @interface ISqlServerEntraIdConfig - * @property {string|null} [kind] SqlServerEntraIdConfig kind - * @property {string|null} [tenantId] SqlServerEntraIdConfig tenantId - * @property {string|null} [applicationId] SqlServerEntraIdConfig applicationId - */ - - /** - * Constructs a new SqlServerEntraIdConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlServerEntraIdConfig. - * @implements ISqlServerEntraIdConfig - * @constructor - * @param {google.cloud.sql.v1.ISqlServerEntraIdConfig=} [properties] Properties to set - */ - function SqlServerEntraIdConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlServerEntraIdConfig kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @instance - */ - SqlServerEntraIdConfig.prototype.kind = ""; - - /** - * SqlServerEntraIdConfig tenantId. - * @member {string} tenantId - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @instance - */ - SqlServerEntraIdConfig.prototype.tenantId = ""; - - /** - * SqlServerEntraIdConfig applicationId. - * @member {string} applicationId - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @instance - */ - SqlServerEntraIdConfig.prototype.applicationId = ""; - - /** - * Creates a new SqlServerEntraIdConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @static - * @param {google.cloud.sql.v1.ISqlServerEntraIdConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlServerEntraIdConfig} SqlServerEntraIdConfig instance - */ - SqlServerEntraIdConfig.create = function create(properties) { - return new SqlServerEntraIdConfig(properties); - }; - - /** - * Encodes the specified SqlServerEntraIdConfig message. Does not implicitly {@link google.cloud.sql.v1.SqlServerEntraIdConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @static - * @param {google.cloud.sql.v1.ISqlServerEntraIdConfig} message SqlServerEntraIdConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerEntraIdConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.tenantId != null && Object.hasOwnProperty.call(message, "tenantId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.tenantId); - if (message.applicationId != null && Object.hasOwnProperty.call(message, "applicationId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.applicationId); - return writer; - }; - - /** - * Encodes the specified SqlServerEntraIdConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerEntraIdConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @static - * @param {google.cloud.sql.v1.ISqlServerEntraIdConfig} message SqlServerEntraIdConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerEntraIdConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlServerEntraIdConfig} SqlServerEntraIdConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerEntraIdConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlServerEntraIdConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.tenantId = reader.string(); - break; - } - case 3: { - message.applicationId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlServerEntraIdConfig} SqlServerEntraIdConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerEntraIdConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlServerEntraIdConfig message. - * @function verify - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlServerEntraIdConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.tenantId != null && message.hasOwnProperty("tenantId")) - if (!$util.isString(message.tenantId)) - return "tenantId: string expected"; - if (message.applicationId != null && message.hasOwnProperty("applicationId")) - if (!$util.isString(message.applicationId)) - return "applicationId: string expected"; - return null; - }; - - /** - * Creates a SqlServerEntraIdConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlServerEntraIdConfig} SqlServerEntraIdConfig - */ - SqlServerEntraIdConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlServerEntraIdConfig) - return object; - var message = new $root.google.cloud.sql.v1.SqlServerEntraIdConfig(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.tenantId != null) - message.tenantId = String(object.tenantId); - if (object.applicationId != null) - message.applicationId = String(object.applicationId); - return message; - }; - - /** - * Creates a plain object from a SqlServerEntraIdConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @static - * @param {google.cloud.sql.v1.SqlServerEntraIdConfig} message SqlServerEntraIdConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlServerEntraIdConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.tenantId = ""; - object.applicationId = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.tenantId != null && message.hasOwnProperty("tenantId")) - object.tenantId = message.tenantId; - if (message.applicationId != null && message.hasOwnProperty("applicationId")) - object.applicationId = message.applicationId; - return object; - }; - - /** - * Converts this SqlServerEntraIdConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @instance - * @returns {Object.} JSON object - */ - SqlServerEntraIdConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlServerEntraIdConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlServerEntraIdConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlServerEntraIdConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlServerEntraIdConfig"; - }; - - return SqlServerEntraIdConfig; - })(); - - /** - * SqlBackendType enum. - * @name google.cloud.sql.v1.SqlBackendType - * @enum {number} - * @property {number} SQL_BACKEND_TYPE_UNSPECIFIED=0 SQL_BACKEND_TYPE_UNSPECIFIED value - * @property {number} FIRST_GEN=1 FIRST_GEN value - * @property {number} SECOND_GEN=2 SECOND_GEN value - * @property {number} EXTERNAL=3 EXTERNAL value - */ - v1.SqlBackendType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKEND_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FIRST_GEN"] = 1; - values[valuesById[2] = "SECOND_GEN"] = 2; - values[valuesById[3] = "EXTERNAL"] = 3; - return values; - })(); - - /** - * SqlIpAddressType enum. - * @name google.cloud.sql.v1.SqlIpAddressType - * @enum {number} - * @property {number} SQL_IP_ADDRESS_TYPE_UNSPECIFIED=0 SQL_IP_ADDRESS_TYPE_UNSPECIFIED value - * @property {number} PRIMARY=1 PRIMARY value - * @property {number} OUTGOING=2 OUTGOING value - * @property {number} PRIVATE=3 PRIVATE value - * @property {number} MIGRATED_1ST_GEN=4 MIGRATED_1ST_GEN value - */ - v1.SqlIpAddressType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_IP_ADDRESS_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRIMARY"] = 1; - values[valuesById[2] = "OUTGOING"] = 2; - values[valuesById[3] = "PRIVATE"] = 3; - values[valuesById[4] = "MIGRATED_1ST_GEN"] = 4; - return values; - })(); - - /** - * SqlDatabaseVersion enum. - * @name google.cloud.sql.v1.SqlDatabaseVersion - * @enum {number} - * @property {number} SQL_DATABASE_VERSION_UNSPECIFIED=0 SQL_DATABASE_VERSION_UNSPECIFIED value - * @property {number} MYSQL_5_1=2 MYSQL_5_1 value - * @property {number} MYSQL_5_5=3 MYSQL_5_5 value - * @property {number} MYSQL_5_6=5 MYSQL_5_6 value - * @property {number} MYSQL_5_7=6 MYSQL_5_7 value - * @property {number} MYSQL_8_0=20 MYSQL_8_0 value - * @property {number} MYSQL_8_0_18=41 MYSQL_8_0_18 value - * @property {number} MYSQL_8_0_26=85 MYSQL_8_0_26 value - * @property {number} MYSQL_8_0_27=111 MYSQL_8_0_27 value - * @property {number} MYSQL_8_0_28=132 MYSQL_8_0_28 value - * @property {number} MYSQL_8_0_29=148 MYSQL_8_0_29 value - * @property {number} MYSQL_8_0_30=174 MYSQL_8_0_30 value - * @property {number} MYSQL_8_0_31=197 MYSQL_8_0_31 value - * @property {number} MYSQL_8_0_32=213 MYSQL_8_0_32 value - * @property {number} MYSQL_8_0_33=238 MYSQL_8_0_33 value - * @property {number} MYSQL_8_0_34=239 MYSQL_8_0_34 value - * @property {number} MYSQL_8_0_35=240 MYSQL_8_0_35 value - * @property {number} MYSQL_8_0_36=241 MYSQL_8_0_36 value - * @property {number} MYSQL_8_0_37=355 MYSQL_8_0_37 value - * @property {number} MYSQL_8_0_39=357 MYSQL_8_0_39 value - * @property {number} MYSQL_8_0_40=358 MYSQL_8_0_40 value - * @property {number} MYSQL_8_0_41=488 MYSQL_8_0_41 value - * @property {number} MYSQL_8_0_42=489 MYSQL_8_0_42 value - * @property {number} MYSQL_8_0_43=553 MYSQL_8_0_43 value - * @property {number} MYSQL_8_0_44=554 MYSQL_8_0_44 value - * @property {number} MYSQL_8_0_45=555 MYSQL_8_0_45 value - * @property {number} MYSQL_8_0_46=556 MYSQL_8_0_46 value - * @property {number} MYSQL_8_4=398 MYSQL_8_4 value - * @property {number} MYSQL_9_7=654 MYSQL_9_7 value - * @property {number} SQLSERVER_2017_STANDARD=11 SQLSERVER_2017_STANDARD value - * @property {number} SQLSERVER_2017_ENTERPRISE=14 SQLSERVER_2017_ENTERPRISE value - * @property {number} SQLSERVER_2017_EXPRESS=15 SQLSERVER_2017_EXPRESS value - * @property {number} SQLSERVER_2017_WEB=16 SQLSERVER_2017_WEB value - * @property {number} POSTGRES_9_6=9 POSTGRES_9_6 value - * @property {number} POSTGRES_10=18 POSTGRES_10 value - * @property {number} POSTGRES_11=10 POSTGRES_11 value - * @property {number} POSTGRES_12=19 POSTGRES_12 value - * @property {number} POSTGRES_13=23 POSTGRES_13 value - * @property {number} POSTGRES_14=110 POSTGRES_14 value - * @property {number} POSTGRES_15=172 POSTGRES_15 value - * @property {number} POSTGRES_16=272 POSTGRES_16 value - * @property {number} POSTGRES_17=408 POSTGRES_17 value - * @property {number} POSTGRES_18=557 POSTGRES_18 value - * @property {number} POSTGRES_19=684 POSTGRES_19 value - * @property {number} SQLSERVER_2019_STANDARD=26 SQLSERVER_2019_STANDARD value - * @property {number} SQLSERVER_2019_ENTERPRISE=27 SQLSERVER_2019_ENTERPRISE value - * @property {number} SQLSERVER_2019_EXPRESS=28 SQLSERVER_2019_EXPRESS value - * @property {number} SQLSERVER_2019_WEB=29 SQLSERVER_2019_WEB value - * @property {number} SQLSERVER_2022_STANDARD=199 SQLSERVER_2022_STANDARD value - * @property {number} SQLSERVER_2022_ENTERPRISE=200 SQLSERVER_2022_ENTERPRISE value - * @property {number} SQLSERVER_2022_EXPRESS=201 SQLSERVER_2022_EXPRESS value - * @property {number} SQLSERVER_2022_WEB=202 SQLSERVER_2022_WEB value - * @property {number} SQLSERVER_2025_STANDARD=549 SQLSERVER_2025_STANDARD value - * @property {number} SQLSERVER_2025_ENTERPRISE=550 SQLSERVER_2025_ENTERPRISE value - * @property {number} SQLSERVER_2025_EXPRESS=551 SQLSERVER_2025_EXPRESS value - */ - v1.SqlDatabaseVersion = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_DATABASE_VERSION_UNSPECIFIED"] = 0; - values[valuesById[2] = "MYSQL_5_1"] = 2; - values[valuesById[3] = "MYSQL_5_5"] = 3; - values[valuesById[5] = "MYSQL_5_6"] = 5; - values[valuesById[6] = "MYSQL_5_7"] = 6; - values[valuesById[20] = "MYSQL_8_0"] = 20; - values[valuesById[41] = "MYSQL_8_0_18"] = 41; - values[valuesById[85] = "MYSQL_8_0_26"] = 85; - values[valuesById[111] = "MYSQL_8_0_27"] = 111; - values[valuesById[132] = "MYSQL_8_0_28"] = 132; - values[valuesById[148] = "MYSQL_8_0_29"] = 148; - values[valuesById[174] = "MYSQL_8_0_30"] = 174; - values[valuesById[197] = "MYSQL_8_0_31"] = 197; - values[valuesById[213] = "MYSQL_8_0_32"] = 213; - values[valuesById[238] = "MYSQL_8_0_33"] = 238; - values[valuesById[239] = "MYSQL_8_0_34"] = 239; - values[valuesById[240] = "MYSQL_8_0_35"] = 240; - values[valuesById[241] = "MYSQL_8_0_36"] = 241; - values[valuesById[355] = "MYSQL_8_0_37"] = 355; - values[valuesById[357] = "MYSQL_8_0_39"] = 357; - values[valuesById[358] = "MYSQL_8_0_40"] = 358; - values[valuesById[488] = "MYSQL_8_0_41"] = 488; - values[valuesById[489] = "MYSQL_8_0_42"] = 489; - values[valuesById[553] = "MYSQL_8_0_43"] = 553; - values[valuesById[554] = "MYSQL_8_0_44"] = 554; - values[valuesById[555] = "MYSQL_8_0_45"] = 555; - values[valuesById[556] = "MYSQL_8_0_46"] = 556; - values[valuesById[398] = "MYSQL_8_4"] = 398; - values[valuesById[654] = "MYSQL_9_7"] = 654; - values[valuesById[11] = "SQLSERVER_2017_STANDARD"] = 11; - values[valuesById[14] = "SQLSERVER_2017_ENTERPRISE"] = 14; - values[valuesById[15] = "SQLSERVER_2017_EXPRESS"] = 15; - values[valuesById[16] = "SQLSERVER_2017_WEB"] = 16; - values[valuesById[9] = "POSTGRES_9_6"] = 9; - values[valuesById[18] = "POSTGRES_10"] = 18; - values[valuesById[10] = "POSTGRES_11"] = 10; - values[valuesById[19] = "POSTGRES_12"] = 19; - values[valuesById[23] = "POSTGRES_13"] = 23; - values[valuesById[110] = "POSTGRES_14"] = 110; - values[valuesById[172] = "POSTGRES_15"] = 172; - values[valuesById[272] = "POSTGRES_16"] = 272; - values[valuesById[408] = "POSTGRES_17"] = 408; - values[valuesById[557] = "POSTGRES_18"] = 557; - values[valuesById[684] = "POSTGRES_19"] = 684; - values[valuesById[26] = "SQLSERVER_2019_STANDARD"] = 26; - values[valuesById[27] = "SQLSERVER_2019_ENTERPRISE"] = 27; - values[valuesById[28] = "SQLSERVER_2019_EXPRESS"] = 28; - values[valuesById[29] = "SQLSERVER_2019_WEB"] = 29; - values[valuesById[199] = "SQLSERVER_2022_STANDARD"] = 199; - values[valuesById[200] = "SQLSERVER_2022_ENTERPRISE"] = 200; - values[valuesById[201] = "SQLSERVER_2022_EXPRESS"] = 201; - values[valuesById[202] = "SQLSERVER_2022_WEB"] = 202; - values[valuesById[549] = "SQLSERVER_2025_STANDARD"] = 549; - values[valuesById[550] = "SQLSERVER_2025_ENTERPRISE"] = 550; - values[valuesById[551] = "SQLSERVER_2025_EXPRESS"] = 551; - return values; - })(); - - /** - * SqlPricingPlan enum. - * @name google.cloud.sql.v1.SqlPricingPlan - * @enum {number} - * @property {number} SQL_PRICING_PLAN_UNSPECIFIED=0 SQL_PRICING_PLAN_UNSPECIFIED value - * @property {number} PACKAGE=1 PACKAGE value - * @property {number} PER_USE=2 PER_USE value - */ - v1.SqlPricingPlan = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_PRICING_PLAN_UNSPECIFIED"] = 0; - values[valuesById[1] = "PACKAGE"] = 1; - values[valuesById[2] = "PER_USE"] = 2; - return values; - })(); - - /** - * SqlReplicationType enum. - * @name google.cloud.sql.v1.SqlReplicationType - * @enum {number} - * @property {number} SQL_REPLICATION_TYPE_UNSPECIFIED=0 SQL_REPLICATION_TYPE_UNSPECIFIED value - * @property {number} SYNCHRONOUS=1 SYNCHRONOUS value - * @property {number} ASYNCHRONOUS=2 ASYNCHRONOUS value - */ - v1.SqlReplicationType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_REPLICATION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SYNCHRONOUS"] = 1; - values[valuesById[2] = "ASYNCHRONOUS"] = 2; - return values; - })(); - - /** - * SqlDataDiskType enum. - * @name google.cloud.sql.v1.SqlDataDiskType - * @enum {number} - * @property {number} SQL_DATA_DISK_TYPE_UNSPECIFIED=0 SQL_DATA_DISK_TYPE_UNSPECIFIED value - * @property {number} PD_SSD=1 PD_SSD value - * @property {number} PD_HDD=2 PD_HDD value - * @property {number} OBSOLETE_LOCAL_SSD=3 OBSOLETE_LOCAL_SSD value - * @property {number} HYPERDISK_BALANCED=4 HYPERDISK_BALANCED value - */ - v1.SqlDataDiskType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_DATA_DISK_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PD_SSD"] = 1; - values[valuesById[2] = "PD_HDD"] = 2; - values[valuesById[3] = "OBSOLETE_LOCAL_SSD"] = 3; - values[valuesById[4] = "HYPERDISK_BALANCED"] = 4; - return values; - })(); - - /** - * SqlAvailabilityType enum. - * @name google.cloud.sql.v1.SqlAvailabilityType - * @enum {number} - * @property {number} SQL_AVAILABILITY_TYPE_UNSPECIFIED=0 SQL_AVAILABILITY_TYPE_UNSPECIFIED value - * @property {number} ZONAL=1 ZONAL value - * @property {number} REGIONAL=2 REGIONAL value - */ - v1.SqlAvailabilityType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_AVAILABILITY_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ZONAL"] = 1; - values[valuesById[2] = "REGIONAL"] = 2; - return values; - })(); - - /** - * SqlUpdateTrack enum. - * @name google.cloud.sql.v1.SqlUpdateTrack - * @enum {number} - * @property {number} SQL_UPDATE_TRACK_UNSPECIFIED=0 SQL_UPDATE_TRACK_UNSPECIFIED value - * @property {number} canary=1 canary value - * @property {number} stable=2 stable value - * @property {number} week5=3 week5 value - */ - v1.SqlUpdateTrack = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_UPDATE_TRACK_UNSPECIFIED"] = 0; - values[valuesById[1] = "canary"] = 1; - values[valuesById[2] = "stable"] = 2; - values[valuesById[3] = "week5"] = 3; - return values; - })(); - - v1.AcquireSsrsLeaseContext = (function() { - - /** - * Properties of an AcquireSsrsLeaseContext. - * @memberof google.cloud.sql.v1 - * @interface IAcquireSsrsLeaseContext - * @property {string|null} [setupLogin] AcquireSsrsLeaseContext setupLogin - * @property {string|null} [serviceLogin] AcquireSsrsLeaseContext serviceLogin - * @property {string|null} [reportDatabase] AcquireSsrsLeaseContext reportDatabase - * @property {google.protobuf.IDuration|null} [duration] AcquireSsrsLeaseContext duration - */ - - /** - * Constructs a new AcquireSsrsLeaseContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an AcquireSsrsLeaseContext. - * @implements IAcquireSsrsLeaseContext - * @constructor - * @param {google.cloud.sql.v1.IAcquireSsrsLeaseContext=} [properties] Properties to set - */ - function AcquireSsrsLeaseContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AcquireSsrsLeaseContext setupLogin. - * @member {string|null|undefined} setupLogin - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @instance - */ - AcquireSsrsLeaseContext.prototype.setupLogin = null; - - /** - * AcquireSsrsLeaseContext serviceLogin. - * @member {string|null|undefined} serviceLogin - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @instance - */ - AcquireSsrsLeaseContext.prototype.serviceLogin = null; - - /** - * AcquireSsrsLeaseContext reportDatabase. - * @member {string|null|undefined} reportDatabase - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @instance - */ - AcquireSsrsLeaseContext.prototype.reportDatabase = null; - - /** - * AcquireSsrsLeaseContext duration. - * @member {google.protobuf.IDuration|null|undefined} duration - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @instance - */ - AcquireSsrsLeaseContext.prototype.duration = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_setupLogin", { - get: $util.oneOfGetter($oneOfFields = ["setupLogin"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_serviceLogin", { - get: $util.oneOfGetter($oneOfFields = ["serviceLogin"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_reportDatabase", { - get: $util.oneOfGetter($oneOfFields = ["reportDatabase"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_duration", { - get: $util.oneOfGetter($oneOfFields = ["duration"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new AcquireSsrsLeaseContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @static - * @param {google.cloud.sql.v1.IAcquireSsrsLeaseContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext instance - */ - AcquireSsrsLeaseContext.create = function create(properties) { - return new AcquireSsrsLeaseContext(properties); - }; - - /** - * Encodes the specified AcquireSsrsLeaseContext message. Does not implicitly {@link google.cloud.sql.v1.AcquireSsrsLeaseContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @static - * @param {google.cloud.sql.v1.IAcquireSsrsLeaseContext} message AcquireSsrsLeaseContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AcquireSsrsLeaseContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.setupLogin != null && Object.hasOwnProperty.call(message, "setupLogin")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.setupLogin); - if (message.serviceLogin != null && Object.hasOwnProperty.call(message, "serviceLogin")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.serviceLogin); - if (message.reportDatabase != null && Object.hasOwnProperty.call(message, "reportDatabase")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.reportDatabase); - if (message.duration != null && Object.hasOwnProperty.call(message, "duration")) - $root.google.protobuf.Duration.encode(message.duration, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified AcquireSsrsLeaseContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AcquireSsrsLeaseContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @static - * @param {google.cloud.sql.v1.IAcquireSsrsLeaseContext} message AcquireSsrsLeaseContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AcquireSsrsLeaseContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AcquireSsrsLeaseContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.AcquireSsrsLeaseContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.setupLogin = reader.string(); - break; - } - case 2: { - message.serviceLogin = reader.string(); - break; - } - case 3: { - message.reportDatabase = reader.string(); - break; - } - case 4: { - message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AcquireSsrsLeaseContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AcquireSsrsLeaseContext message. - * @function verify - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AcquireSsrsLeaseContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.setupLogin != null && message.hasOwnProperty("setupLogin")) { - properties._setupLogin = 1; - if (!$util.isString(message.setupLogin)) - return "setupLogin: string expected"; - } - if (message.serviceLogin != null && message.hasOwnProperty("serviceLogin")) { - properties._serviceLogin = 1; - if (!$util.isString(message.serviceLogin)) - return "serviceLogin: string expected"; - } - if (message.reportDatabase != null && message.hasOwnProperty("reportDatabase")) { - properties._reportDatabase = 1; - if (!$util.isString(message.reportDatabase)) - return "reportDatabase: string expected"; - } - if (message.duration != null && message.hasOwnProperty("duration")) { - properties._duration = 1; - { - var error = $root.google.protobuf.Duration.verify(message.duration); - if (error) - return "duration." + error; - } - } - return null; - }; - - /** - * Creates an AcquireSsrsLeaseContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext - */ - AcquireSsrsLeaseContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.AcquireSsrsLeaseContext) - return object; - var message = new $root.google.cloud.sql.v1.AcquireSsrsLeaseContext(); - if (object.setupLogin != null) - message.setupLogin = String(object.setupLogin); - if (object.serviceLogin != null) - message.serviceLogin = String(object.serviceLogin); - if (object.reportDatabase != null) - message.reportDatabase = String(object.reportDatabase); - if (object.duration != null) { - if (typeof object.duration !== "object") - throw TypeError(".google.cloud.sql.v1.AcquireSsrsLeaseContext.duration: object expected"); - message.duration = $root.google.protobuf.Duration.fromObject(object.duration); - } - return message; - }; - - /** - * Creates a plain object from an AcquireSsrsLeaseContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @static - * @param {google.cloud.sql.v1.AcquireSsrsLeaseContext} message AcquireSsrsLeaseContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AcquireSsrsLeaseContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.setupLogin != null && message.hasOwnProperty("setupLogin")) { - object.setupLogin = message.setupLogin; - if (options.oneofs) - object._setupLogin = "setupLogin"; - } - if (message.serviceLogin != null && message.hasOwnProperty("serviceLogin")) { - object.serviceLogin = message.serviceLogin; - if (options.oneofs) - object._serviceLogin = "serviceLogin"; - } - if (message.reportDatabase != null && message.hasOwnProperty("reportDatabase")) { - object.reportDatabase = message.reportDatabase; - if (options.oneofs) - object._reportDatabase = "reportDatabase"; - } - if (message.duration != null && message.hasOwnProperty("duration")) { - object.duration = $root.google.protobuf.Duration.toObject(message.duration, options); - if (options.oneofs) - object._duration = "duration"; - } - return object; - }; - - /** - * Converts this AcquireSsrsLeaseContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @instance - * @returns {Object.} JSON object - */ - AcquireSsrsLeaseContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AcquireSsrsLeaseContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.AcquireSsrsLeaseContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AcquireSsrsLeaseContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.AcquireSsrsLeaseContext"; - }; - - return AcquireSsrsLeaseContext; - })(); - - v1.DnsNameMapping = (function() { - - /** - * Properties of a DnsNameMapping. - * @memberof google.cloud.sql.v1 - * @interface IDnsNameMapping - * @property {string|null} [name] DnsNameMapping name - * @property {google.cloud.sql.v1.DnsNameMapping.ConnectionType|null} [connectionType] DnsNameMapping connectionType - * @property {google.cloud.sql.v1.DnsNameMapping.DnsScope|null} [dnsScope] DnsNameMapping dnsScope - * @property {google.cloud.sql.v1.DnsNameMapping.RecordManager|null} [recordManager] DnsNameMapping recordManager - */ - - /** - * Constructs a new DnsNameMapping. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DnsNameMapping. - * @implements IDnsNameMapping - * @constructor - * @param {google.cloud.sql.v1.IDnsNameMapping=} [properties] Properties to set - */ - function DnsNameMapping(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DnsNameMapping name. - * @member {string} name - * @memberof google.cloud.sql.v1.DnsNameMapping - * @instance - */ - DnsNameMapping.prototype.name = ""; - - /** - * DnsNameMapping connectionType. - * @member {google.cloud.sql.v1.DnsNameMapping.ConnectionType} connectionType - * @memberof google.cloud.sql.v1.DnsNameMapping - * @instance - */ - DnsNameMapping.prototype.connectionType = 0; - - /** - * DnsNameMapping dnsScope. - * @member {google.cloud.sql.v1.DnsNameMapping.DnsScope} dnsScope - * @memberof google.cloud.sql.v1.DnsNameMapping - * @instance - */ - DnsNameMapping.prototype.dnsScope = 0; - - /** - * DnsNameMapping recordManager. - * @member {google.cloud.sql.v1.DnsNameMapping.RecordManager} recordManager - * @memberof google.cloud.sql.v1.DnsNameMapping - * @instance - */ - DnsNameMapping.prototype.recordManager = 0; - - /** - * Creates a new DnsNameMapping instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DnsNameMapping - * @static - * @param {google.cloud.sql.v1.IDnsNameMapping=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DnsNameMapping} DnsNameMapping instance - */ - DnsNameMapping.create = function create(properties) { - return new DnsNameMapping(properties); - }; - - /** - * Encodes the specified DnsNameMapping message. Does not implicitly {@link google.cloud.sql.v1.DnsNameMapping.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DnsNameMapping - * @static - * @param {google.cloud.sql.v1.IDnsNameMapping} message DnsNameMapping message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DnsNameMapping.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.connectionType != null && Object.hasOwnProperty.call(message, "connectionType")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.connectionType); - if (message.dnsScope != null && Object.hasOwnProperty.call(message, "dnsScope")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.dnsScope); - if (message.recordManager != null && Object.hasOwnProperty.call(message, "recordManager")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.recordManager); - return writer; - }; - - /** - * Encodes the specified DnsNameMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DnsNameMapping.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DnsNameMapping - * @static - * @param {google.cloud.sql.v1.IDnsNameMapping} message DnsNameMapping message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DnsNameMapping.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DnsNameMapping message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DnsNameMapping - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DnsNameMapping} DnsNameMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DnsNameMapping.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DnsNameMapping(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.connectionType = reader.int32(); - break; - } - case 3: { - message.dnsScope = reader.int32(); - break; - } - case 4: { - message.recordManager = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DnsNameMapping message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DnsNameMapping - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DnsNameMapping} DnsNameMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DnsNameMapping.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DnsNameMapping message. - * @function verify - * @memberof google.cloud.sql.v1.DnsNameMapping - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DnsNameMapping.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.connectionType != null && message.hasOwnProperty("connectionType")) - switch (message.connectionType) { - default: - return "connectionType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.dnsScope != null && message.hasOwnProperty("dnsScope")) - switch (message.dnsScope) { - default: - return "dnsScope: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.recordManager != null && message.hasOwnProperty("recordManager")) - switch (message.recordManager) { - default: - return "recordManager: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates a DnsNameMapping message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DnsNameMapping - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DnsNameMapping} DnsNameMapping - */ - DnsNameMapping.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DnsNameMapping) - return object; - var message = new $root.google.cloud.sql.v1.DnsNameMapping(); - if (object.name != null) - message.name = String(object.name); - switch (object.connectionType) { - default: - if (typeof object.connectionType === "number") { - message.connectionType = object.connectionType; - break; - } - break; - case "CONNECTION_TYPE_UNSPECIFIED": - case 0: - message.connectionType = 0; - break; - case "PUBLIC": - case 1: - message.connectionType = 1; - break; - case "PRIVATE_SERVICES_ACCESS": - case 2: - message.connectionType = 2; - break; - case "PRIVATE_SERVICE_CONNECT": - case 3: - message.connectionType = 3; - break; - } - switch (object.dnsScope) { - default: - if (typeof object.dnsScope === "number") { - message.dnsScope = object.dnsScope; - break; - } - break; - case "DNS_SCOPE_UNSPECIFIED": - case 0: - message.dnsScope = 0; - break; - case "INSTANCE": - case 1: - message.dnsScope = 1; - break; - case "CLUSTER": - case 2: - message.dnsScope = 2; - break; - } - switch (object.recordManager) { - default: - if (typeof object.recordManager === "number") { - message.recordManager = object.recordManager; - break; - } - break; - case "RECORD_MANAGER_UNSPECIFIED": - case 0: - message.recordManager = 0; - break; - case "CUSTOMER": - case 1: - message.recordManager = 1; - break; - case "CLOUD_SQL_AUTOMATION": - case 2: - message.recordManager = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a DnsNameMapping message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DnsNameMapping - * @static - * @param {google.cloud.sql.v1.DnsNameMapping} message DnsNameMapping - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DnsNameMapping.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.connectionType = options.enums === String ? "CONNECTION_TYPE_UNSPECIFIED" : 0; - object.dnsScope = options.enums === String ? "DNS_SCOPE_UNSPECIFIED" : 0; - object.recordManager = options.enums === String ? "RECORD_MANAGER_UNSPECIFIED" : 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.connectionType != null && message.hasOwnProperty("connectionType")) - object.connectionType = options.enums === String ? $root.google.cloud.sql.v1.DnsNameMapping.ConnectionType[message.connectionType] === undefined ? message.connectionType : $root.google.cloud.sql.v1.DnsNameMapping.ConnectionType[message.connectionType] : message.connectionType; - if (message.dnsScope != null && message.hasOwnProperty("dnsScope")) - object.dnsScope = options.enums === String ? $root.google.cloud.sql.v1.DnsNameMapping.DnsScope[message.dnsScope] === undefined ? message.dnsScope : $root.google.cloud.sql.v1.DnsNameMapping.DnsScope[message.dnsScope] : message.dnsScope; - if (message.recordManager != null && message.hasOwnProperty("recordManager")) - object.recordManager = options.enums === String ? $root.google.cloud.sql.v1.DnsNameMapping.RecordManager[message.recordManager] === undefined ? message.recordManager : $root.google.cloud.sql.v1.DnsNameMapping.RecordManager[message.recordManager] : message.recordManager; - return object; - }; - - /** - * Converts this DnsNameMapping to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DnsNameMapping - * @instance - * @returns {Object.} JSON object - */ - DnsNameMapping.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DnsNameMapping - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DnsNameMapping - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DnsNameMapping.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DnsNameMapping"; - }; - - /** - * ConnectionType enum. - * @name google.cloud.sql.v1.DnsNameMapping.ConnectionType - * @enum {number} - * @property {number} CONNECTION_TYPE_UNSPECIFIED=0 CONNECTION_TYPE_UNSPECIFIED value - * @property {number} PUBLIC=1 PUBLIC value - * @property {number} PRIVATE_SERVICES_ACCESS=2 PRIVATE_SERVICES_ACCESS value - * @property {number} PRIVATE_SERVICE_CONNECT=3 PRIVATE_SERVICE_CONNECT value - */ - DnsNameMapping.ConnectionType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CONNECTION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PUBLIC"] = 1; - values[valuesById[2] = "PRIVATE_SERVICES_ACCESS"] = 2; - values[valuesById[3] = "PRIVATE_SERVICE_CONNECT"] = 3; - return values; - })(); - - /** - * DnsScope enum. - * @name google.cloud.sql.v1.DnsNameMapping.DnsScope - * @enum {number} - * @property {number} DNS_SCOPE_UNSPECIFIED=0 DNS_SCOPE_UNSPECIFIED value - * @property {number} INSTANCE=1 INSTANCE value - * @property {number} CLUSTER=2 CLUSTER value - */ - DnsNameMapping.DnsScope = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DNS_SCOPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "INSTANCE"] = 1; - values[valuesById[2] = "CLUSTER"] = 2; - return values; - })(); - - /** - * RecordManager enum. - * @name google.cloud.sql.v1.DnsNameMapping.RecordManager - * @enum {number} - * @property {number} RECORD_MANAGER_UNSPECIFIED=0 RECORD_MANAGER_UNSPECIFIED value - * @property {number} CUSTOMER=1 CUSTOMER value - * @property {number} CLOUD_SQL_AUTOMATION=2 CLOUD_SQL_AUTOMATION value - */ - DnsNameMapping.RecordManager = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RECORD_MANAGER_UNSPECIFIED"] = 0; - values[valuesById[1] = "CUSTOMER"] = 1; - values[valuesById[2] = "CLOUD_SQL_AUTOMATION"] = 2; - return values; - })(); - - return DnsNameMapping; - })(); - - v1.SqlBackupsService = (function() { - - /** - * Constructs a new SqlBackupsService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlBackupsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlBackupsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlBackupsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlBackupsService; - - /** - * Creates new SqlBackupsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlBackupsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlBackupsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlBackupsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|createBackup}. - * @memberof google.cloud.sql.v1.SqlBackupsService - * @typedef CreateBackupCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls CreateBackup. - * @function createBackup - * @memberof google.cloud.sql.v1.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1.ICreateBackupRequest} request CreateBackupRequest message or plain object - * @param {google.cloud.sql.v1.SqlBackupsService.CreateBackupCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupsService.prototype.createBackup = function createBackup(request, callback) { - return this.rpcCall(createBackup, $root.google.cloud.sql.v1.CreateBackupRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "CreateBackup" }); - - /** - * Calls CreateBackup. - * @function createBackup - * @memberof google.cloud.sql.v1.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1.ICreateBackupRequest} request CreateBackupRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|getBackup}. - * @memberof google.cloud.sql.v1.SqlBackupsService - * @typedef GetBackupCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Backup} [response] Backup - */ - - /** - * Calls GetBackup. - * @function getBackup - * @memberof google.cloud.sql.v1.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1.IGetBackupRequest} request GetBackupRequest message or plain object - * @param {google.cloud.sql.v1.SqlBackupsService.GetBackupCallback} callback Node-style callback called with the error, if any, and Backup - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupsService.prototype.getBackup = function getBackup(request, callback) { - return this.rpcCall(getBackup, $root.google.cloud.sql.v1.GetBackupRequest, $root.google.cloud.sql.v1.Backup, request, callback); - }, "name", { value: "GetBackup" }); - - /** - * Calls GetBackup. - * @function getBackup - * @memberof google.cloud.sql.v1.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1.IGetBackupRequest} request GetBackupRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|listBackups}. - * @memberof google.cloud.sql.v1.SqlBackupsService - * @typedef ListBackupsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.ListBackupsResponse} [response] ListBackupsResponse - */ - - /** - * Calls ListBackups. - * @function listBackups - * @memberof google.cloud.sql.v1.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1.IListBackupsRequest} request ListBackupsRequest message or plain object - * @param {google.cloud.sql.v1.SqlBackupsService.ListBackupsCallback} callback Node-style callback called with the error, if any, and ListBackupsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupsService.prototype.listBackups = function listBackups(request, callback) { - return this.rpcCall(listBackups, $root.google.cloud.sql.v1.ListBackupsRequest, $root.google.cloud.sql.v1.ListBackupsResponse, request, callback); - }, "name", { value: "ListBackups" }); - - /** - * Calls ListBackups. - * @function listBackups - * @memberof google.cloud.sql.v1.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1.IListBackupsRequest} request ListBackupsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|updateBackup}. - * @memberof google.cloud.sql.v1.SqlBackupsService - * @typedef UpdateBackupCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls UpdateBackup. - * @function updateBackup - * @memberof google.cloud.sql.v1.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1.IUpdateBackupRequest} request UpdateBackupRequest message or plain object - * @param {google.cloud.sql.v1.SqlBackupsService.UpdateBackupCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupsService.prototype.updateBackup = function updateBackup(request, callback) { - return this.rpcCall(updateBackup, $root.google.cloud.sql.v1.UpdateBackupRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "UpdateBackup" }); - - /** - * Calls UpdateBackup. - * @function updateBackup - * @memberof google.cloud.sql.v1.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1.IUpdateBackupRequest} request UpdateBackupRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlBackupsService|deleteBackup}. - * @memberof google.cloud.sql.v1.SqlBackupsService - * @typedef DeleteBackupCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls DeleteBackup. - * @function deleteBackup - * @memberof google.cloud.sql.v1.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1.IDeleteBackupRequest} request DeleteBackupRequest message or plain object - * @param {google.cloud.sql.v1.SqlBackupsService.DeleteBackupCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupsService.prototype.deleteBackup = function deleteBackup(request, callback) { - return this.rpcCall(deleteBackup, $root.google.cloud.sql.v1.DeleteBackupRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "DeleteBackup" }); - - /** - * Calls DeleteBackup. - * @function deleteBackup - * @memberof google.cloud.sql.v1.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1.IDeleteBackupRequest} request DeleteBackupRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlBackupsService; - })(); - - v1.CreateBackupRequest = (function() { - - /** - * Properties of a CreateBackupRequest. - * @memberof google.cloud.sql.v1 - * @interface ICreateBackupRequest - * @property {string|null} [parent] CreateBackupRequest parent - * @property {google.cloud.sql.v1.IBackup|null} [backup] CreateBackupRequest backup - */ - - /** - * Constructs a new CreateBackupRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a CreateBackupRequest. - * @implements ICreateBackupRequest - * @constructor - * @param {google.cloud.sql.v1.ICreateBackupRequest=} [properties] Properties to set - */ - function CreateBackupRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CreateBackupRequest parent. - * @member {string} parent - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @instance - */ - CreateBackupRequest.prototype.parent = ""; - - /** - * CreateBackupRequest backup. - * @member {google.cloud.sql.v1.IBackup|null|undefined} backup - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @instance - */ - CreateBackupRequest.prototype.backup = null; - - /** - * Creates a new CreateBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @static - * @param {google.cloud.sql.v1.ICreateBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.CreateBackupRequest} CreateBackupRequest instance - */ - CreateBackupRequest.create = function create(properties) { - return new CreateBackupRequest(properties); - }; - - /** - * Encodes the specified CreateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.CreateBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @static - * @param {google.cloud.sql.v1.ICreateBackupRequest} message CreateBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) - $root.google.cloud.sql.v1.Backup.encode(message.backup, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CreateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.CreateBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @static - * @param {google.cloud.sql.v1.ICreateBackupRequest} message CreateBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.CreateBackupRequest} CreateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.CreateBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.backup = $root.google.cloud.sql.v1.Backup.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.CreateBackupRequest} CreateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.backup != null && message.hasOwnProperty("backup")) { - var error = $root.google.cloud.sql.v1.Backup.verify(message.backup); - if (error) - return "backup." + error; - } - return null; - }; - - /** - * Creates a CreateBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.CreateBackupRequest} CreateBackupRequest - */ - CreateBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.CreateBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1.CreateBackupRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.backup != null) { - if (typeof object.backup !== "object") - throw TypeError(".google.cloud.sql.v1.CreateBackupRequest.backup: object expected"); - message.backup = $root.google.cloud.sql.v1.Backup.fromObject(object.backup); - } - return message; - }; - - /** - * Creates a plain object from a CreateBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @static - * @param {google.cloud.sql.v1.CreateBackupRequest} message CreateBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.backup = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.backup != null && message.hasOwnProperty("backup")) - object.backup = $root.google.cloud.sql.v1.Backup.toObject(message.backup, options); - return object; - }; - - /** - * Converts this CreateBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @instance - * @returns {Object.} JSON object - */ - CreateBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.CreateBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.CreateBackupRequest"; - }; - - return CreateBackupRequest; - })(); - - v1.GetBackupRequest = (function() { - - /** - * Properties of a GetBackupRequest. - * @memberof google.cloud.sql.v1 - * @interface IGetBackupRequest - * @property {string|null} [name] GetBackupRequest name - */ - - /** - * Constructs a new GetBackupRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a GetBackupRequest. - * @implements IGetBackupRequest - * @constructor - * @param {google.cloud.sql.v1.IGetBackupRequest=} [properties] Properties to set - */ - function GetBackupRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetBackupRequest name. - * @member {string} name - * @memberof google.cloud.sql.v1.GetBackupRequest - * @instance - */ - GetBackupRequest.prototype.name = ""; - - /** - * Creates a new GetBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.GetBackupRequest - * @static - * @param {google.cloud.sql.v1.IGetBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.GetBackupRequest} GetBackupRequest instance - */ - GetBackupRequest.create = function create(properties) { - return new GetBackupRequest(properties); - }; - - /** - * Encodes the specified GetBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.GetBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.GetBackupRequest - * @static - * @param {google.cloud.sql.v1.IGetBackupRequest} message GetBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GetBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.GetBackupRequest - * @static - * @param {google.cloud.sql.v1.IGetBackupRequest} message GetBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.GetBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.GetBackupRequest} GetBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.GetBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.GetBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.GetBackupRequest} GetBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1.GetBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.GetBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.GetBackupRequest} GetBackupRequest - */ - GetBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.GetBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1.GetBackupRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.GetBackupRequest - * @static - * @param {google.cloud.sql.v1.GetBackupRequest} message GetBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.GetBackupRequest - * @instance - * @returns {Object.} JSON object - */ - GetBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.GetBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.GetBackupRequest"; - }; - - return GetBackupRequest; - })(); - - v1.ListBackupsRequest = (function() { - - /** - * Properties of a ListBackupsRequest. - * @memberof google.cloud.sql.v1 - * @interface IListBackupsRequest - * @property {string|null} [parent] ListBackupsRequest parent - * @property {number|null} [pageSize] ListBackupsRequest pageSize - * @property {string|null} [pageToken] ListBackupsRequest pageToken - * @property {string|null} [filter] ListBackupsRequest filter - */ - - /** - * Constructs a new ListBackupsRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a ListBackupsRequest. - * @implements IListBackupsRequest - * @constructor - * @param {google.cloud.sql.v1.IListBackupsRequest=} [properties] Properties to set - */ - function ListBackupsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListBackupsRequest parent. - * @member {string} parent - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @instance - */ - ListBackupsRequest.prototype.parent = ""; - - /** - * ListBackupsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @instance - */ - ListBackupsRequest.prototype.pageSize = 0; - - /** - * ListBackupsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @instance - */ - ListBackupsRequest.prototype.pageToken = ""; - - /** - * ListBackupsRequest filter. - * @member {string} filter - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @instance - */ - ListBackupsRequest.prototype.filter = ""; - - /** - * Creates a new ListBackupsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @static - * @param {google.cloud.sql.v1.IListBackupsRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ListBackupsRequest} ListBackupsRequest instance - */ - ListBackupsRequest.create = function create(properties) { - return new ListBackupsRequest(properties); - }; - - /** - * Encodes the specified ListBackupsRequest message. Does not implicitly {@link google.cloud.sql.v1.ListBackupsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @static - * @param {google.cloud.sql.v1.IListBackupsRequest} message ListBackupsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListBackupsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); - return writer; - }; - - /** - * Encodes the specified ListBackupsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ListBackupsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @static - * @param {google.cloud.sql.v1.IListBackupsRequest} message ListBackupsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListBackupsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListBackupsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ListBackupsRequest} ListBackupsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListBackupsRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ListBackupsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - case 4: { - message.filter = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListBackupsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ListBackupsRequest} ListBackupsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListBackupsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListBackupsRequest message. - * @function verify - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListBackupsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - return null; - }; - - /** - * Creates a ListBackupsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ListBackupsRequest} ListBackupsRequest - */ - ListBackupsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ListBackupsRequest) - return object; - var message = new $root.google.cloud.sql.v1.ListBackupsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - return message; - }; - - /** - * Creates a plain object from a ListBackupsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @static - * @param {google.cloud.sql.v1.ListBackupsRequest} message ListBackupsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListBackupsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - return object; - }; - - /** - * Converts this ListBackupsRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @instance - * @returns {Object.} JSON object - */ - ListBackupsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListBackupsRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ListBackupsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListBackupsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ListBackupsRequest"; - }; - - return ListBackupsRequest; - })(); - - v1.ListBackupsResponse = (function() { - - /** - * Properties of a ListBackupsResponse. - * @memberof google.cloud.sql.v1 - * @interface IListBackupsResponse - * @property {Array.|null} [backups] ListBackupsResponse backups - * @property {string|null} [nextPageToken] ListBackupsResponse nextPageToken - * @property {Array.|null} [warnings] ListBackupsResponse warnings - */ - - /** - * Constructs a new ListBackupsResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a ListBackupsResponse. - * @implements IListBackupsResponse - * @constructor - * @param {google.cloud.sql.v1.IListBackupsResponse=} [properties] Properties to set - */ - function ListBackupsResponse(properties) { - this.backups = []; - this.warnings = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListBackupsResponse backups. - * @member {Array.} backups - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @instance - */ - ListBackupsResponse.prototype.backups = $util.emptyArray; - - /** - * ListBackupsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @instance - */ - ListBackupsResponse.prototype.nextPageToken = ""; - - /** - * ListBackupsResponse warnings. - * @member {Array.} warnings - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @instance - */ - ListBackupsResponse.prototype.warnings = $util.emptyArray; - - /** - * Creates a new ListBackupsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @static - * @param {google.cloud.sql.v1.IListBackupsResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ListBackupsResponse} ListBackupsResponse instance - */ - ListBackupsResponse.create = function create(properties) { - return new ListBackupsResponse(properties); - }; - - /** - * Encodes the specified ListBackupsResponse message. Does not implicitly {@link google.cloud.sql.v1.ListBackupsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @static - * @param {google.cloud.sql.v1.IListBackupsResponse} message ListBackupsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListBackupsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.backups != null && message.backups.length) - for (var i = 0; i < message.backups.length; ++i) - $root.google.cloud.sql.v1.Backup.encode(message.backups[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - if (message.warnings != null && message.warnings.length) - for (var i = 0; i < message.warnings.length; ++i) - $root.google.cloud.sql.v1.ApiWarning.encode(message.warnings[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ListBackupsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ListBackupsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @static - * @param {google.cloud.sql.v1.IListBackupsResponse} message ListBackupsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListBackupsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListBackupsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ListBackupsResponse} ListBackupsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListBackupsResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ListBackupsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.backups && message.backups.length)) - message.backups = []; - message.backups.push($root.google.cloud.sql.v1.Backup.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - case 3: { - if (!(message.warnings && message.warnings.length)) - message.warnings = []; - message.warnings.push($root.google.cloud.sql.v1.ApiWarning.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListBackupsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ListBackupsResponse} ListBackupsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListBackupsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListBackupsResponse message. - * @function verify - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListBackupsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.backups != null && message.hasOwnProperty("backups")) { - if (!Array.isArray(message.backups)) - return "backups: array expected"; - for (var i = 0; i < message.backups.length; ++i) { - var error = $root.google.cloud.sql.v1.Backup.verify(message.backups[i]); - if (error) - return "backups." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.warnings != null && message.hasOwnProperty("warnings")) { - if (!Array.isArray(message.warnings)) - return "warnings: array expected"; - for (var i = 0; i < message.warnings.length; ++i) { - var error = $root.google.cloud.sql.v1.ApiWarning.verify(message.warnings[i]); - if (error) - return "warnings." + error; - } - } - return null; - }; - - /** - * Creates a ListBackupsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ListBackupsResponse} ListBackupsResponse - */ - ListBackupsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ListBackupsResponse) - return object; - var message = new $root.google.cloud.sql.v1.ListBackupsResponse(); - if (object.backups) { - if (!Array.isArray(object.backups)) - throw TypeError(".google.cloud.sql.v1.ListBackupsResponse.backups: array expected"); - message.backups = []; - for (var i = 0; i < object.backups.length; ++i) { - if (typeof object.backups[i] !== "object") - throw TypeError(".google.cloud.sql.v1.ListBackupsResponse.backups: object expected"); - message.backups[i] = $root.google.cloud.sql.v1.Backup.fromObject(object.backups[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.warnings) { - if (!Array.isArray(object.warnings)) - throw TypeError(".google.cloud.sql.v1.ListBackupsResponse.warnings: array expected"); - message.warnings = []; - for (var i = 0; i < object.warnings.length; ++i) { - if (typeof object.warnings[i] !== "object") - throw TypeError(".google.cloud.sql.v1.ListBackupsResponse.warnings: object expected"); - message.warnings[i] = $root.google.cloud.sql.v1.ApiWarning.fromObject(object.warnings[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ListBackupsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @static - * @param {google.cloud.sql.v1.ListBackupsResponse} message ListBackupsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListBackupsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.backups = []; - object.warnings = []; - } - if (options.defaults) - object.nextPageToken = ""; - if (message.backups && message.backups.length) { - object.backups = []; - for (var j = 0; j < message.backups.length; ++j) - object.backups[j] = $root.google.cloud.sql.v1.Backup.toObject(message.backups[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.warnings && message.warnings.length) { - object.warnings = []; - for (var j = 0; j < message.warnings.length; ++j) - object.warnings[j] = $root.google.cloud.sql.v1.ApiWarning.toObject(message.warnings[j], options); - } - return object; - }; - - /** - * Converts this ListBackupsResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @instance - * @returns {Object.} JSON object - */ - ListBackupsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListBackupsResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ListBackupsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListBackupsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ListBackupsResponse"; - }; - - return ListBackupsResponse; - })(); - - v1.UpdateBackupRequest = (function() { - - /** - * Properties of an UpdateBackupRequest. - * @memberof google.cloud.sql.v1 - * @interface IUpdateBackupRequest - * @property {google.cloud.sql.v1.IBackup|null} [backup] UpdateBackupRequest backup - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateBackupRequest updateMask - */ - - /** - * Constructs a new UpdateBackupRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an UpdateBackupRequest. - * @implements IUpdateBackupRequest - * @constructor - * @param {google.cloud.sql.v1.IUpdateBackupRequest=} [properties] Properties to set - */ - function UpdateBackupRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UpdateBackupRequest backup. - * @member {google.cloud.sql.v1.IBackup|null|undefined} backup - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @instance - */ - UpdateBackupRequest.prototype.backup = null; - - /** - * UpdateBackupRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @instance - */ - UpdateBackupRequest.prototype.updateMask = null; - - /** - * Creates a new UpdateBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @static - * @param {google.cloud.sql.v1.IUpdateBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.UpdateBackupRequest} UpdateBackupRequest instance - */ - UpdateBackupRequest.create = function create(properties) { - return new UpdateBackupRequest(properties); - }; - - /** - * Encodes the specified UpdateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.UpdateBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @static - * @param {google.cloud.sql.v1.IUpdateBackupRequest} message UpdateBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) - $root.google.cloud.sql.v1.Backup.encode(message.backup, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UpdateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UpdateBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @static - * @param {google.cloud.sql.v1.IUpdateBackupRequest} message UpdateBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UpdateBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.UpdateBackupRequest} UpdateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.UpdateBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.backup = $root.google.cloud.sql.v1.Backup.decode(reader, reader.uint32()); - break; - } - case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UpdateBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.UpdateBackupRequest} UpdateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UpdateBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdateBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.backup != null && message.hasOwnProperty("backup")) { - var error = $root.google.cloud.sql.v1.Backup.verify(message.backup); - if (error) - return "backup." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; - - /** - * Creates an UpdateBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.UpdateBackupRequest} UpdateBackupRequest - */ - UpdateBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.UpdateBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1.UpdateBackupRequest(); - if (object.backup != null) { - if (typeof object.backup !== "object") - throw TypeError(".google.cloud.sql.v1.UpdateBackupRequest.backup: object expected"); - message.backup = $root.google.cloud.sql.v1.Backup.fromObject(object.backup); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.sql.v1.UpdateBackupRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; - - /** - * Creates a plain object from an UpdateBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @static - * @param {google.cloud.sql.v1.UpdateBackupRequest} message UpdateBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdateBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.backup = null; - object.updateMask = null; - } - if (message.backup != null && message.hasOwnProperty("backup")) - object.backup = $root.google.cloud.sql.v1.Backup.toObject(message.backup, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; - - /** - * Converts this UpdateBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @instance - * @returns {Object.} JSON object - */ - UpdateBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UpdateBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.UpdateBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UpdateBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.UpdateBackupRequest"; - }; - - return UpdateBackupRequest; - })(); - - v1.DeleteBackupRequest = (function() { - - /** - * Properties of a DeleteBackupRequest. - * @memberof google.cloud.sql.v1 - * @interface IDeleteBackupRequest - * @property {string|null} [name] DeleteBackupRequest name - */ - - /** - * Constructs a new DeleteBackupRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DeleteBackupRequest. - * @implements IDeleteBackupRequest - * @constructor - * @param {google.cloud.sql.v1.IDeleteBackupRequest=} [properties] Properties to set - */ - function DeleteBackupRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DeleteBackupRequest name. - * @member {string} name - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @instance - */ - DeleteBackupRequest.prototype.name = ""; - - /** - * Creates a new DeleteBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @static - * @param {google.cloud.sql.v1.IDeleteBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DeleteBackupRequest} DeleteBackupRequest instance - */ - DeleteBackupRequest.create = function create(properties) { - return new DeleteBackupRequest(properties); - }; - - /** - * Encodes the specified DeleteBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.DeleteBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @static - * @param {google.cloud.sql.v1.IDeleteBackupRequest} message DeleteBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DeleteBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @static - * @param {google.cloud.sql.v1.IDeleteBackupRequest} message DeleteBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DeleteBackupRequest} DeleteBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DeleteBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DeleteBackupRequest} DeleteBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DeleteBackupRequest} DeleteBackupRequest - */ - DeleteBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DeleteBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1.DeleteBackupRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @static - * @param {google.cloud.sql.v1.DeleteBackupRequest} message DeleteBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DeleteBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DeleteBackupRequest"; - }; - - return DeleteBackupRequest; - })(); - - v1.Backup = (function() { - - /** - * Properties of a Backup. - * @memberof google.cloud.sql.v1 - * @interface IBackup - * @property {string|null} [name] Backup name - * @property {string|null} [kind] Backup kind - * @property {string|null} [selfLink] Backup selfLink - * @property {google.cloud.sql.v1.Backup.SqlBackupType|null} [type] Backup type - * @property {string|null} [description] Backup description - * @property {string|null} [instance] Backup instance - * @property {string|null} [location] Backup location - * @property {google.type.IInterval|null} [backupInterval] Backup backupInterval - * @property {google.cloud.sql.v1.Backup.SqlBackupState|null} [state] Backup state - * @property {google.cloud.sql.v1.IOperationError|null} [error] Backup error - * @property {string|null} [kmsKey] Backup kmsKey - * @property {string|null} [kmsKeyVersion] Backup kmsKeyVersion - * @property {google.cloud.sql.v1.SqlBackupKind|null} [backupKind] Backup backupKind - * @property {string|null} [timeZone] Backup timeZone - * @property {number|Long|null} [ttlDays] Backup ttlDays - * @property {google.protobuf.ITimestamp|null} [expiryTime] Backup expiryTime - * @property {google.cloud.sql.v1.SqlDatabaseVersion|null} [databaseVersion] Backup databaseVersion - * @property {number|Long|null} [maxChargeableBytes] Backup maxChargeableBytes - * @property {google.protobuf.ITimestamp|null} [instanceDeletionTime] Backup instanceDeletionTime - * @property {google.cloud.sql.v1.IDatabaseInstance|null} [instanceSettings] Backup instanceSettings - * @property {string|null} [backupRun] Backup backupRun - * @property {google.protobuf.IBoolValue|null} [satisfiesPzs] Backup satisfiesPzs - * @property {google.protobuf.IBoolValue|null} [satisfiesPzi] Backup satisfiesPzi - */ - - /** - * Constructs a new Backup. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a Backup. - * @implements IBackup - * @constructor - * @param {google.cloud.sql.v1.IBackup=} [properties] Properties to set - */ - function Backup(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Backup name. - * @member {string} name - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.name = ""; - - /** - * Backup kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.kind = ""; - - /** - * Backup selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.selfLink = ""; - - /** - * Backup type. - * @member {google.cloud.sql.v1.Backup.SqlBackupType} type - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.type = 0; - - /** - * Backup description. - * @member {string} description - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.description = ""; - - /** - * Backup instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.instance = ""; - - /** - * Backup location. - * @member {string} location - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.location = ""; - - /** - * Backup backupInterval. - * @member {google.type.IInterval|null|undefined} backupInterval - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.backupInterval = null; - - /** - * Backup state. - * @member {google.cloud.sql.v1.Backup.SqlBackupState} state - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.state = 0; - - /** - * Backup error. - * @member {google.cloud.sql.v1.IOperationError|null|undefined} error - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.error = null; - - /** - * Backup kmsKey. - * @member {string} kmsKey - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.kmsKey = ""; - - /** - * Backup kmsKeyVersion. - * @member {string} kmsKeyVersion - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.kmsKeyVersion = ""; - - /** - * Backup backupKind. - * @member {google.cloud.sql.v1.SqlBackupKind} backupKind - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.backupKind = 0; - - /** - * Backup timeZone. - * @member {string} timeZone - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.timeZone = ""; - - /** - * Backup ttlDays. - * @member {number|Long|null|undefined} ttlDays - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.ttlDays = null; - - /** - * Backup expiryTime. - * @member {google.protobuf.ITimestamp|null|undefined} expiryTime - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.expiryTime = null; - - /** - * Backup databaseVersion. - * @member {google.cloud.sql.v1.SqlDatabaseVersion} databaseVersion - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.databaseVersion = 0; - - /** - * Backup maxChargeableBytes. - * @member {number|Long|null|undefined} maxChargeableBytes - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.maxChargeableBytes = null; - - /** - * Backup instanceDeletionTime. - * @member {google.protobuf.ITimestamp|null|undefined} instanceDeletionTime - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.instanceDeletionTime = null; - - /** - * Backup instanceSettings. - * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} instanceSettings - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.instanceSettings = null; - - /** - * Backup backupRun. - * @member {string} backupRun - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.backupRun = ""; - - /** - * Backup satisfiesPzs. - * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzs - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.satisfiesPzs = null; - - /** - * Backup satisfiesPzi. - * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzi - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Backup.prototype.satisfiesPzi = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Backup expiration. - * @member {"ttlDays"|"expiryTime"|undefined} expiration - * @memberof google.cloud.sql.v1.Backup - * @instance - */ - Object.defineProperty(Backup.prototype, "expiration", { - get: $util.oneOfGetter($oneOfFields = ["ttlDays", "expiryTime"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Backup.prototype, "_maxChargeableBytes", { - get: $util.oneOfGetter($oneOfFields = ["maxChargeableBytes"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Backup instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.Backup - * @static - * @param {google.cloud.sql.v1.IBackup=} [properties] Properties to set - * @returns {google.cloud.sql.v1.Backup} Backup instance - */ - Backup.create = function create(properties) { - return new Backup(properties); - }; - - /** - * Encodes the specified Backup message. Does not implicitly {@link google.cloud.sql.v1.Backup.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.Backup - * @static - * @param {google.cloud.sql.v1.IBackup} message Backup message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Backup.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.selfLink); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.description); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); - if (message.location != null && Object.hasOwnProperty.call(message, "location")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.location); - if (message.backupInterval != null && Object.hasOwnProperty.call(message, "backupInterval")) - $root.google.type.Interval.encode(message.backupInterval, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.cloud.sql.v1.OperationError.encode(message.error, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.kmsKey != null && Object.hasOwnProperty.call(message, "kmsKey")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.kmsKey); - if (message.kmsKeyVersion != null && Object.hasOwnProperty.call(message, "kmsKeyVersion")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.kmsKeyVersion); - if (message.backupKind != null && Object.hasOwnProperty.call(message, "backupKind")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.backupKind); - if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.timeZone); - if (message.ttlDays != null && Object.hasOwnProperty.call(message, "ttlDays")) - writer.uint32(/* id 16, wireType 0 =*/128).int64(message.ttlDays); - if (message.expiryTime != null && Object.hasOwnProperty.call(message, "expiryTime")) - $root.google.protobuf.Timestamp.encode(message.expiryTime, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) - writer.uint32(/* id 20, wireType 0 =*/160).int32(message.databaseVersion); - if (message.maxChargeableBytes != null && Object.hasOwnProperty.call(message, "maxChargeableBytes")) - writer.uint32(/* id 23, wireType 0 =*/184).int64(message.maxChargeableBytes); - if (message.instanceDeletionTime != null && Object.hasOwnProperty.call(message, "instanceDeletionTime")) - $root.google.protobuf.Timestamp.encode(message.instanceDeletionTime, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); - if (message.instanceSettings != null && Object.hasOwnProperty.call(message, "instanceSettings")) - $root.google.cloud.sql.v1.DatabaseInstance.encode(message.instanceSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); - if (message.backupRun != null && Object.hasOwnProperty.call(message, "backupRun")) - writer.uint32(/* id 26, wireType 2 =*/210).string(message.backupRun); - if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) - $root.google.protobuf.BoolValue.encode(message.satisfiesPzs, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); - if (message.satisfiesPzi != null && Object.hasOwnProperty.call(message, "satisfiesPzi")) - $root.google.protobuf.BoolValue.encode(message.satisfiesPzi, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Backup message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Backup.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.Backup - * @static - * @param {google.cloud.sql.v1.IBackup} message Backup message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Backup.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Backup message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.Backup - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.Backup} Backup - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Backup.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Backup(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - case 3: { - message.selfLink = reader.string(); - break; - } - case 4: { - message.type = reader.int32(); - break; - } - case 5: { - message.description = reader.string(); - break; - } - case 6: { - message.instance = reader.string(); - break; - } - case 7: { - message.location = reader.string(); - break; - } - case 8: { - message.backupInterval = $root.google.type.Interval.decode(reader, reader.uint32()); - break; - } - case 9: { - message.state = reader.int32(); - break; - } - case 10: { - message.error = $root.google.cloud.sql.v1.OperationError.decode(reader, reader.uint32()); - break; - } - case 11: { - message.kmsKey = reader.string(); - break; - } - case 12: { - message.kmsKeyVersion = reader.string(); - break; - } - case 13: { - message.backupKind = reader.int32(); - break; - } - case 15: { - message.timeZone = reader.string(); - break; - } - case 16: { - message.ttlDays = reader.int64(); - break; - } - case 17: { - message.expiryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 20: { - message.databaseVersion = reader.int32(); - break; - } - case 23: { - message.maxChargeableBytes = reader.int64(); - break; - } - case 24: { - message.instanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 25: { - message.instanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - case 26: { - message.backupRun = reader.string(); - break; - } - case 27: { - message.satisfiesPzs = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 28: { - message.satisfiesPzi = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Backup message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.Backup - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.Backup} Backup - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Backup.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Backup message. - * @function verify - * @memberof google.cloud.sql.v1.Backup - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Backup.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.location != null && message.hasOwnProperty("location")) - if (!$util.isString(message.location)) - return "location: string expected"; - if (message.backupInterval != null && message.hasOwnProperty("backupInterval")) { - var error = $root.google.type.Interval.verify(message.backupInterval); - if (error) - return "backupInterval." + error; - } - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - break; - } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.cloud.sql.v1.OperationError.verify(message.error); - if (error) - return "error." + error; - } - if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) - if (!$util.isString(message.kmsKey)) - return "kmsKey: string expected"; - if (message.kmsKeyVersion != null && message.hasOwnProperty("kmsKeyVersion")) - if (!$util.isString(message.kmsKeyVersion)) - return "kmsKeyVersion: string expected"; - if (message.backupKind != null && message.hasOwnProperty("backupKind")) - switch (message.backupKind) { - default: - return "backupKind: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - if (!$util.isString(message.timeZone)) - return "timeZone: string expected"; - if (message.ttlDays != null && message.hasOwnProperty("ttlDays")) { - properties.expiration = 1; - if (!$util.isInteger(message.ttlDays) && !(message.ttlDays && $util.isInteger(message.ttlDays.low) && $util.isInteger(message.ttlDays.high))) - return "ttlDays: integer|Long expected"; - } - if (message.expiryTime != null && message.hasOwnProperty("expiryTime")) { - if (properties.expiration === 1) - return "expiration: multiple values"; - properties.expiration = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.expiryTime); - if (error) - return "expiryTime." + error; - } - } - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - switch (message.databaseVersion) { - default: - return "databaseVersion: enum value expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 684: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - case 549: - case 550: - case 551: - break; - } - if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { - properties._maxChargeableBytes = 1; - if (!$util.isInteger(message.maxChargeableBytes) && !(message.maxChargeableBytes && $util.isInteger(message.maxChargeableBytes.low) && $util.isInteger(message.maxChargeableBytes.high))) - return "maxChargeableBytes: integer|Long expected"; - } - if (message.instanceDeletionTime != null && message.hasOwnProperty("instanceDeletionTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.instanceDeletionTime); - if (error) - return "instanceDeletionTime." + error; - } - if (message.instanceSettings != null && message.hasOwnProperty("instanceSettings")) { - var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.instanceSettings); - if (error) - return "instanceSettings." + error; - } - if (message.backupRun != null && message.hasOwnProperty("backupRun")) - if (!$util.isString(message.backupRun)) - return "backupRun: string expected"; - if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) { - var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzs); - if (error) - return "satisfiesPzs." + error; - } - if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) { - var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzi); - if (error) - return "satisfiesPzi." + error; - } - return null; - }; - - /** - * Creates a Backup message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.Backup - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.Backup} Backup - */ - Backup.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.Backup) - return object; - var message = new $root.google.cloud.sql.v1.Backup(); - if (object.name != null) - message.name = String(object.name); - if (object.kind != null) - message.kind = String(object.kind); - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "SQL_BACKUP_TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "AUTOMATED": - case 1: - message.type = 1; - break; - case "ON_DEMAND": - case 2: - message.type = 2; - break; - case "FINAL": - case 3: - message.type = 3; - break; - } - if (object.description != null) - message.description = String(object.description); - if (object.instance != null) - message.instance = String(object.instance); - if (object.location != null) - message.location = String(object.location); - if (object.backupInterval != null) { - if (typeof object.backupInterval !== "object") - throw TypeError(".google.cloud.sql.v1.Backup.backupInterval: object expected"); - message.backupInterval = $root.google.type.Interval.fromObject(object.backupInterval); - } - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "SQL_BACKUP_STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "ENQUEUED": - case 1: - message.state = 1; - break; - case "RUNNING": - case 2: - message.state = 2; - break; - case "FAILED": - case 3: - message.state = 3; - break; - case "SUCCESSFUL": - case 4: - message.state = 4; - break; - case "DELETING": - case 5: - message.state = 5; - break; - case "DELETION_FAILED": - case 6: - message.state = 6; - break; - } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.sql.v1.Backup.error: object expected"); - message.error = $root.google.cloud.sql.v1.OperationError.fromObject(object.error); - } - if (object.kmsKey != null) - message.kmsKey = String(object.kmsKey); - if (object.kmsKeyVersion != null) - message.kmsKeyVersion = String(object.kmsKeyVersion); - switch (object.backupKind) { - default: - if (typeof object.backupKind === "number") { - message.backupKind = object.backupKind; - break; - } - break; - case "SQL_BACKUP_KIND_UNSPECIFIED": - case 0: - message.backupKind = 0; - break; - case "SNAPSHOT": - case 1: - message.backupKind = 1; - break; - case "PHYSICAL": - case 2: - message.backupKind = 2; - break; - } - if (object.timeZone != null) - message.timeZone = String(object.timeZone); - if (object.ttlDays != null) - if ($util.Long) - (message.ttlDays = $util.Long.fromValue(object.ttlDays)).unsigned = false; - else if (typeof object.ttlDays === "string") - message.ttlDays = parseInt(object.ttlDays, 10); - else if (typeof object.ttlDays === "number") - message.ttlDays = object.ttlDays; - else if (typeof object.ttlDays === "object") - message.ttlDays = new $util.LongBits(object.ttlDays.low >>> 0, object.ttlDays.high >>> 0).toNumber(); - if (object.expiryTime != null) { - if (typeof object.expiryTime !== "object") - throw TypeError(".google.cloud.sql.v1.Backup.expiryTime: object expected"); - message.expiryTime = $root.google.protobuf.Timestamp.fromObject(object.expiryTime); - } - switch (object.databaseVersion) { - default: - if (typeof object.databaseVersion === "number") { - message.databaseVersion = object.databaseVersion; - break; - } - break; - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.databaseVersion = 0; - break; - case "MYSQL_5_1": - case 2: - message.databaseVersion = 2; - break; - case "MYSQL_5_5": - case 3: - message.databaseVersion = 3; - break; - case "MYSQL_5_6": - case 5: - message.databaseVersion = 5; - break; - case "MYSQL_5_7": - case 6: - message.databaseVersion = 6; - break; - case "MYSQL_8_0": - case 20: - message.databaseVersion = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.databaseVersion = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.databaseVersion = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.databaseVersion = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.databaseVersion = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.databaseVersion = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.databaseVersion = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.databaseVersion = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.databaseVersion = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.databaseVersion = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.databaseVersion = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.databaseVersion = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.databaseVersion = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.databaseVersion = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.databaseVersion = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.databaseVersion = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.databaseVersion = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.databaseVersion = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.databaseVersion = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.databaseVersion = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.databaseVersion = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.databaseVersion = 556; - break; - case "MYSQL_8_4": - case 398: - message.databaseVersion = 398; - break; - case "MYSQL_9_7": - case 654: - message.databaseVersion = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.databaseVersion = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.databaseVersion = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.databaseVersion = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.databaseVersion = 16; - break; - case "POSTGRES_9_6": - case 9: - message.databaseVersion = 9; - break; - case "POSTGRES_10": - case 18: - message.databaseVersion = 18; - break; - case "POSTGRES_11": - case 10: - message.databaseVersion = 10; - break; - case "POSTGRES_12": - case 19: - message.databaseVersion = 19; - break; - case "POSTGRES_13": - case 23: - message.databaseVersion = 23; - break; - case "POSTGRES_14": - case 110: - message.databaseVersion = 110; - break; - case "POSTGRES_15": - case 172: - message.databaseVersion = 172; - break; - case "POSTGRES_16": - case 272: - message.databaseVersion = 272; - break; - case "POSTGRES_17": - case 408: - message.databaseVersion = 408; - break; - case "POSTGRES_18": - case 557: - message.databaseVersion = 557; - break; - case "POSTGRES_19": - case 684: - message.databaseVersion = 684; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.databaseVersion = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.databaseVersion = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.databaseVersion = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.databaseVersion = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.databaseVersion = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.databaseVersion = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.databaseVersion = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.databaseVersion = 202; - break; - case "SQLSERVER_2025_STANDARD": - case 549: - message.databaseVersion = 549; - break; - case "SQLSERVER_2025_ENTERPRISE": - case 550: - message.databaseVersion = 550; - break; - case "SQLSERVER_2025_EXPRESS": - case 551: - message.databaseVersion = 551; - break; - } - if (object.maxChargeableBytes != null) - if ($util.Long) - (message.maxChargeableBytes = $util.Long.fromValue(object.maxChargeableBytes)).unsigned = false; - else if (typeof object.maxChargeableBytes === "string") - message.maxChargeableBytes = parseInt(object.maxChargeableBytes, 10); - else if (typeof object.maxChargeableBytes === "number") - message.maxChargeableBytes = object.maxChargeableBytes; - else if (typeof object.maxChargeableBytes === "object") - message.maxChargeableBytes = new $util.LongBits(object.maxChargeableBytes.low >>> 0, object.maxChargeableBytes.high >>> 0).toNumber(); - if (object.instanceDeletionTime != null) { - if (typeof object.instanceDeletionTime !== "object") - throw TypeError(".google.cloud.sql.v1.Backup.instanceDeletionTime: object expected"); - message.instanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.instanceDeletionTime); - } - if (object.instanceSettings != null) { - if (typeof object.instanceSettings !== "object") - throw TypeError(".google.cloud.sql.v1.Backup.instanceSettings: object expected"); - message.instanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.instanceSettings); - } - if (object.backupRun != null) - message.backupRun = String(object.backupRun); - if (object.satisfiesPzs != null) { - if (typeof object.satisfiesPzs !== "object") - throw TypeError(".google.cloud.sql.v1.Backup.satisfiesPzs: object expected"); - message.satisfiesPzs = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzs); - } - if (object.satisfiesPzi != null) { - if (typeof object.satisfiesPzi !== "object") - throw TypeError(".google.cloud.sql.v1.Backup.satisfiesPzi: object expected"); - message.satisfiesPzi = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzi); - } - return message; - }; - - /** - * Creates a plain object from a Backup message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.Backup - * @static - * @param {google.cloud.sql.v1.Backup} message Backup - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Backup.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.kind = ""; - object.selfLink = ""; - object.type = options.enums === String ? "SQL_BACKUP_TYPE_UNSPECIFIED" : 0; - object.description = ""; - object.instance = ""; - object.location = ""; - object.backupInterval = null; - object.state = options.enums === String ? "SQL_BACKUP_STATE_UNSPECIFIED" : 0; - object.error = null; - object.kmsKey = ""; - object.kmsKeyVersion = ""; - object.backupKind = options.enums === String ? "SQL_BACKUP_KIND_UNSPECIFIED" : 0; - object.timeZone = ""; - object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; - object.instanceDeletionTime = null; - object.instanceSettings = null; - object.backupRun = ""; - object.satisfiesPzs = null; - object.satisfiesPzi = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1.Backup.SqlBackupType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.Backup.SqlBackupType[message.type] : message.type; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.location != null && message.hasOwnProperty("location")) - object.location = message.location; - if (message.backupInterval != null && message.hasOwnProperty("backupInterval")) - object.backupInterval = $root.google.type.Interval.toObject(message.backupInterval, options); - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.sql.v1.Backup.SqlBackupState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1.Backup.SqlBackupState[message.state] : message.state; - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.cloud.sql.v1.OperationError.toObject(message.error, options); - if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) - object.kmsKey = message.kmsKey; - if (message.kmsKeyVersion != null && message.hasOwnProperty("kmsKeyVersion")) - object.kmsKeyVersion = message.kmsKeyVersion; - if (message.backupKind != null && message.hasOwnProperty("backupKind")) - object.backupKind = options.enums === String ? $root.google.cloud.sql.v1.SqlBackupKind[message.backupKind] === undefined ? message.backupKind : $root.google.cloud.sql.v1.SqlBackupKind[message.backupKind] : message.backupKind; - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - object.timeZone = message.timeZone; - if (message.ttlDays != null && message.hasOwnProperty("ttlDays")) { - if (typeof message.ttlDays === "number") - object.ttlDays = options.longs === String ? String(message.ttlDays) : message.ttlDays; - else - object.ttlDays = options.longs === String ? $util.Long.prototype.toString.call(message.ttlDays) : options.longs === Number ? new $util.LongBits(message.ttlDays.low >>> 0, message.ttlDays.high >>> 0).toNumber() : message.ttlDays; - if (options.oneofs) - object.expiration = "ttlDays"; - } - if (message.expiryTime != null && message.hasOwnProperty("expiryTime")) { - object.expiryTime = $root.google.protobuf.Timestamp.toObject(message.expiryTime, options); - if (options.oneofs) - object.expiration = "expiryTime"; - } - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; - if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { - if (typeof message.maxChargeableBytes === "number") - object.maxChargeableBytes = options.longs === String ? String(message.maxChargeableBytes) : message.maxChargeableBytes; - else - object.maxChargeableBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxChargeableBytes) : options.longs === Number ? new $util.LongBits(message.maxChargeableBytes.low >>> 0, message.maxChargeableBytes.high >>> 0).toNumber() : message.maxChargeableBytes; - if (options.oneofs) - object._maxChargeableBytes = "maxChargeableBytes"; - } - if (message.instanceDeletionTime != null && message.hasOwnProperty("instanceDeletionTime")) - object.instanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.instanceDeletionTime, options); - if (message.instanceSettings != null && message.hasOwnProperty("instanceSettings")) - object.instanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.instanceSettings, options); - if (message.backupRun != null && message.hasOwnProperty("backupRun")) - object.backupRun = message.backupRun; - if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) - object.satisfiesPzs = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzs, options); - if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) - object.satisfiesPzi = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzi, options); - return object; - }; - - /** - * Converts this Backup to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.Backup - * @instance - * @returns {Object.} JSON object - */ - Backup.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Backup - * @function getTypeUrl - * @memberof google.cloud.sql.v1.Backup - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Backup.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.Backup"; - }; - - /** - * SqlBackupType enum. - * @name google.cloud.sql.v1.Backup.SqlBackupType - * @enum {number} - * @property {number} SQL_BACKUP_TYPE_UNSPECIFIED=0 SQL_BACKUP_TYPE_UNSPECIFIED value - * @property {number} AUTOMATED=1 AUTOMATED value - * @property {number} ON_DEMAND=2 ON_DEMAND value - * @property {number} FINAL=3 FINAL value - */ - Backup.SqlBackupType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKUP_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUTOMATED"] = 1; - values[valuesById[2] = "ON_DEMAND"] = 2; - values[valuesById[3] = "FINAL"] = 3; - return values; - })(); - - /** - * SqlBackupState enum. - * @name google.cloud.sql.v1.Backup.SqlBackupState - * @enum {number} - * @property {number} SQL_BACKUP_STATE_UNSPECIFIED=0 SQL_BACKUP_STATE_UNSPECIFIED value - * @property {number} ENQUEUED=1 ENQUEUED value - * @property {number} RUNNING=2 RUNNING value - * @property {number} FAILED=3 FAILED value - * @property {number} SUCCESSFUL=4 SUCCESSFUL value - * @property {number} DELETING=5 DELETING value - * @property {number} DELETION_FAILED=6 DELETION_FAILED value - */ - Backup.SqlBackupState = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKUP_STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ENQUEUED"] = 1; - values[valuesById[2] = "RUNNING"] = 2; - values[valuesById[3] = "FAILED"] = 3; - values[valuesById[4] = "SUCCESSFUL"] = 4; - values[valuesById[5] = "DELETING"] = 5; - values[valuesById[6] = "DELETION_FAILED"] = 6; - return values; - })(); - - return Backup; - })(); - - v1.SqlInstancesService = (function() { - - /** - * Constructs a new SqlInstancesService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlInstancesService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlInstancesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlInstancesService; - - /** - * Creates new SqlInstancesService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlInstancesService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlInstancesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addServerCa}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef AddServerCaCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls AddServerCa. - * @function addServerCa - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest} request SqlInstancesAddServerCaRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.AddServerCaCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.addServerCa = function addServerCa(request, callback) { - return this.rpcCall(addServerCa, $root.google.cloud.sql.v1.SqlInstancesAddServerCaRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "AddServerCa" }); - - /** - * Calls AddServerCa. - * @function addServerCa - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest} request SqlInstancesAddServerCaRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addServerCertificate}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef AddServerCertificateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls AddServerCertificate. - * @function addServerCertificate - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest} request SqlInstancesAddServerCertificateRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.AddServerCertificateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.addServerCertificate = function addServerCertificate(request, callback) { - return this.rpcCall(addServerCertificate, $root.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "AddServerCertificate" }); - - /** - * Calls AddServerCertificate. - * @function addServerCertificate - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest} request SqlInstancesAddServerCertificateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|addEntraIdCertificate}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef AddEntraIdCertificateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls AddEntraIdCertificate. - * @function addEntraIdCertificate - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest} request SqlInstancesAddEntraIdCertificateRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.AddEntraIdCertificateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.addEntraIdCertificate = function addEntraIdCertificate(request, callback) { - return this.rpcCall(addEntraIdCertificate, $root.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "AddEntraIdCertificate" }); - - /** - * Calls AddEntraIdCertificate. - * @function addEntraIdCertificate - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest} request SqlInstancesAddEntraIdCertificateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|clone}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef CloneCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Clone. - * @function clone - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest} request SqlInstancesCloneRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.CloneCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.clone = function clone(request, callback) { - return this.rpcCall(clone, $root.google.cloud.sql.v1.SqlInstancesCloneRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Clone" }); - - /** - * Calls Clone. - * @function clone - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest} request SqlInstancesCloneRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|delete_}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef DeleteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest} request SqlInstancesDeleteRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype["delete"] = function delete_(request, callback) { - return this.rpcCall(delete_, $root.google.cloud.sql.v1.SqlInstancesDeleteRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Delete" }); - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest} request SqlInstancesDeleteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|demoteMaster}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef DemoteMasterCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls DemoteMaster. - * @function demoteMaster - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest} request SqlInstancesDemoteMasterRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.DemoteMasterCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.demoteMaster = function demoteMaster(request, callback) { - return this.rpcCall(demoteMaster, $root.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "DemoteMaster" }); - - /** - * Calls DemoteMaster. - * @function demoteMaster - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest} request SqlInstancesDemoteMasterRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|demote}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef DemoteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Demote. - * @function demote - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest} request SqlInstancesDemoteRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.DemoteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.demote = function demote(request, callback) { - return this.rpcCall(demote, $root.google.cloud.sql.v1.SqlInstancesDemoteRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Demote" }); - - /** - * Calls Demote. - * @function demote - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest} request SqlInstancesDemoteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|export_}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ExportCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Export. - * @function export - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesExportRequest} request SqlInstancesExportRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ExportCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype["export"] = function export_(request, callback) { - return this.rpcCall(export_, $root.google.cloud.sql.v1.SqlInstancesExportRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Export" }); - - /** - * Calls Export. - * @function export - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesExportRequest} request SqlInstancesExportRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|failover}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef FailoverCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Failover. - * @function failover - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest} request SqlInstancesFailoverRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.FailoverCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.failover = function failover(request, callback) { - return this.rpcCall(failover, $root.google.cloud.sql.v1.SqlInstancesFailoverRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Failover" }); - - /** - * Calls Failover. - * @function failover - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest} request SqlInstancesFailoverRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|reencrypt}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ReencryptCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Reencrypt. - * @function reencrypt - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest} request SqlInstancesReencryptRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ReencryptCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.reencrypt = function reencrypt(request, callback) { - return this.rpcCall(reencrypt, $root.google.cloud.sql.v1.SqlInstancesReencryptRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Reencrypt" }); - - /** - * Calls Reencrypt. - * @function reencrypt - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest} request SqlInstancesReencryptRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|get}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.DatabaseInstance} [response] DatabaseInstance - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesGetRequest} request SqlInstancesGetRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.GetCallback} callback Node-style callback called with the error, if any, and DatabaseInstance - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1.SqlInstancesGetRequest, $root.google.cloud.sql.v1.DatabaseInstance, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesGetRequest} request SqlInstancesGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|import_}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ImportCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Import. - * @function import - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesImportRequest} request SqlInstancesImportRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ImportCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype["import"] = function import_(request, callback) { - return this.rpcCall(import_, $root.google.cloud.sql.v1.SqlInstancesImportRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Import" }); - - /** - * Calls Import. - * @function import - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesImportRequest} request SqlInstancesImportRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|insert}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef InsertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest} request SqlInstancesInsertRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.InsertCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.insert = function insert(request, callback) { - return this.rpcCall(insert, $root.google.cloud.sql.v1.SqlInstancesInsertRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Insert" }); - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest} request SqlInstancesInsertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|list}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.InstancesListResponse} [response] InstancesListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesListRequest} request SqlInstancesListRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ListCallback} callback Node-style callback called with the error, if any, and InstancesListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1.SqlInstancesListRequest, $root.google.cloud.sql.v1.InstancesListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesListRequest} request SqlInstancesListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listServerCas}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ListServerCasCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.InstancesListServerCasResponse} [response] InstancesListServerCasResponse - */ - - /** - * Calls ListServerCas. - * @function listServerCas - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest} request SqlInstancesListServerCasRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ListServerCasCallback} callback Node-style callback called with the error, if any, and InstancesListServerCasResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.listServerCas = function listServerCas(request, callback) { - return this.rpcCall(listServerCas, $root.google.cloud.sql.v1.SqlInstancesListServerCasRequest, $root.google.cloud.sql.v1.InstancesListServerCasResponse, request, callback); - }, "name", { value: "ListServerCas" }); - - /** - * Calls ListServerCas. - * @function listServerCas - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest} request SqlInstancesListServerCasRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listServerCertificates}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ListServerCertificatesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.InstancesListServerCertificatesResponse} [response] InstancesListServerCertificatesResponse - */ - - /** - * Calls ListServerCertificates. - * @function listServerCertificates - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest} request SqlInstancesListServerCertificatesRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ListServerCertificatesCallback} callback Node-style callback called with the error, if any, and InstancesListServerCertificatesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.listServerCertificates = function listServerCertificates(request, callback) { - return this.rpcCall(listServerCertificates, $root.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest, $root.google.cloud.sql.v1.InstancesListServerCertificatesResponse, request, callback); - }, "name", { value: "ListServerCertificates" }); - - /** - * Calls ListServerCertificates. - * @function listServerCertificates - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest} request SqlInstancesListServerCertificatesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|listEntraIdCertificates}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ListEntraIdCertificatesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} [response] InstancesListEntraIdCertificatesResponse - */ - - /** - * Calls ListEntraIdCertificates. - * @function listEntraIdCertificates - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest} request SqlInstancesListEntraIdCertificatesRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ListEntraIdCertificatesCallback} callback Node-style callback called with the error, if any, and InstancesListEntraIdCertificatesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.listEntraIdCertificates = function listEntraIdCertificates(request, callback) { - return this.rpcCall(listEntraIdCertificates, $root.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest, $root.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse, request, callback); - }, "name", { value: "ListEntraIdCertificates" }); - - /** - * Calls ListEntraIdCertificates. - * @function listEntraIdCertificates - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest} request SqlInstancesListEntraIdCertificatesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|patch}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef PatchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Patch. - * @function patch - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest} request SqlInstancesPatchRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.PatchCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.patch = function patch(request, callback) { - return this.rpcCall(patch, $root.google.cloud.sql.v1.SqlInstancesPatchRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Patch" }); - - /** - * Calls Patch. - * @function patch - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest} request SqlInstancesPatchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|promoteReplica}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef PromoteReplicaCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls PromoteReplica. - * @function promoteReplica - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest} request SqlInstancesPromoteReplicaRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.PromoteReplicaCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.promoteReplica = function promoteReplica(request, callback) { - return this.rpcCall(promoteReplica, $root.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "PromoteReplica" }); - - /** - * Calls PromoteReplica. - * @function promoteReplica - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest} request SqlInstancesPromoteReplicaRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|switchover}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef SwitchoverCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Switchover. - * @function switchover - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest} request SqlInstancesSwitchoverRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.SwitchoverCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.switchover = function switchover(request, callback) { - return this.rpcCall(switchover, $root.google.cloud.sql.v1.SqlInstancesSwitchoverRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Switchover" }); - - /** - * Calls Switchover. - * @function switchover - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest} request SqlInstancesSwitchoverRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|resetSslConfig}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ResetSslConfigCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls ResetSslConfig. - * @function resetSslConfig - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest} request SqlInstancesResetSslConfigRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ResetSslConfigCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.resetSslConfig = function resetSslConfig(request, callback) { - return this.rpcCall(resetSslConfig, $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "ResetSslConfig" }); - - /** - * Calls ResetSslConfig. - * @function resetSslConfig - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest} request SqlInstancesResetSslConfigRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|restart}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef RestartCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Restart. - * @function restart - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest} request SqlInstancesRestartRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.RestartCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.restart = function restart(request, callback) { - return this.rpcCall(restart, $root.google.cloud.sql.v1.SqlInstancesRestartRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Restart" }); - - /** - * Calls Restart. - * @function restart - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest} request SqlInstancesRestartRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|restoreBackup}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef RestoreBackupCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls RestoreBackup. - * @function restoreBackup - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest} request SqlInstancesRestoreBackupRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.RestoreBackupCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.restoreBackup = function restoreBackup(request, callback) { - return this.rpcCall(restoreBackup, $root.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "RestoreBackup" }); - - /** - * Calls RestoreBackup. - * @function restoreBackup - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest} request SqlInstancesRestoreBackupRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateServerCa}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef RotateServerCaCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls RotateServerCa. - * @function rotateServerCa - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest} request SqlInstancesRotateServerCaRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.RotateServerCaCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.rotateServerCa = function rotateServerCa(request, callback) { - return this.rpcCall(rotateServerCa, $root.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "RotateServerCa" }); - - /** - * Calls RotateServerCa. - * @function rotateServerCa - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest} request SqlInstancesRotateServerCaRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateServerCertificate}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef RotateServerCertificateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls RotateServerCertificate. - * @function rotateServerCertificate - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest} request SqlInstancesRotateServerCertificateRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.RotateServerCertificateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.rotateServerCertificate = function rotateServerCertificate(request, callback) { - return this.rpcCall(rotateServerCertificate, $root.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "RotateServerCertificate" }); - - /** - * Calls RotateServerCertificate. - * @function rotateServerCertificate - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest} request SqlInstancesRotateServerCertificateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rotateEntraIdCertificate}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef RotateEntraIdCertificateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls RotateEntraIdCertificate. - * @function rotateEntraIdCertificate - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest} request SqlInstancesRotateEntraIdCertificateRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.RotateEntraIdCertificateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.rotateEntraIdCertificate = function rotateEntraIdCertificate(request, callback) { - return this.rpcCall(rotateEntraIdCertificate, $root.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "RotateEntraIdCertificate" }); - - /** - * Calls RotateEntraIdCertificate. - * @function rotateEntraIdCertificate - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest} request SqlInstancesRotateEntraIdCertificateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|startReplica}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef StartReplicaCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls StartReplica. - * @function startReplica - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest} request SqlInstancesStartReplicaRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.StartReplicaCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.startReplica = function startReplica(request, callback) { - return this.rpcCall(startReplica, $root.google.cloud.sql.v1.SqlInstancesStartReplicaRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "StartReplica" }); - - /** - * Calls StartReplica. - * @function startReplica - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest} request SqlInstancesStartReplicaRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|stopReplica}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef StopReplicaCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls StopReplica. - * @function stopReplica - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest} request SqlInstancesStopReplicaRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.StopReplicaCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.stopReplica = function stopReplica(request, callback) { - return this.rpcCall(stopReplica, $root.google.cloud.sql.v1.SqlInstancesStopReplicaRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "StopReplica" }); - - /** - * Calls StopReplica. - * @function stopReplica - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest} request SqlInstancesStopReplicaRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|truncateLog}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef TruncateLogCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls TruncateLog. - * @function truncateLog - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest} request SqlInstancesTruncateLogRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.TruncateLogCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.truncateLog = function truncateLog(request, callback) { - return this.rpcCall(truncateLog, $root.google.cloud.sql.v1.SqlInstancesTruncateLogRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "TruncateLog" }); - - /** - * Calls TruncateLog. - * @function truncateLog - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest} request SqlInstancesTruncateLogRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|update}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef UpdateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest} request SqlInstancesUpdateRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.update = function update(request, callback) { - return this.rpcCall(update, $root.google.cloud.sql.v1.SqlInstancesUpdateRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Update" }); - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest} request SqlInstancesUpdateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|createEphemeral}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef CreateEphemeralCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.SslCert} [response] SslCert - */ - - /** - * Calls CreateEphemeral. - * @function createEphemeral - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest} request SqlInstancesCreateEphemeralCertRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.CreateEphemeralCallback} callback Node-style callback called with the error, if any, and SslCert - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.createEphemeral = function createEphemeral(request, callback) { - return this.rpcCall(createEphemeral, $root.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest, $root.google.cloud.sql.v1.SslCert, request, callback); - }, "name", { value: "CreateEphemeral" }); - - /** - * Calls CreateEphemeral. - * @function createEphemeral - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest} request SqlInstancesCreateEphemeralCertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|rescheduleMaintenance}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef RescheduleMaintenanceCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls RescheduleMaintenance. - * @function rescheduleMaintenance - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest} request SqlInstancesRescheduleMaintenanceRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.RescheduleMaintenanceCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.rescheduleMaintenance = function rescheduleMaintenance(request, callback) { - return this.rpcCall(rescheduleMaintenance, $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "RescheduleMaintenance" }); - - /** - * Calls RescheduleMaintenance. - * @function rescheduleMaintenance - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest} request SqlInstancesRescheduleMaintenanceRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|verifyExternalSyncSettings}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef VerifyExternalSyncSettingsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} [response] SqlInstancesVerifyExternalSyncSettingsResponse - */ - - /** - * Calls VerifyExternalSyncSettings. - * @function verifyExternalSyncSettings - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest} request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.VerifyExternalSyncSettingsCallback} callback Node-style callback called with the error, if any, and SqlInstancesVerifyExternalSyncSettingsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.verifyExternalSyncSettings = function verifyExternalSyncSettings(request, callback) { - return this.rpcCall(verifyExternalSyncSettings, $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest, $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse, request, callback); - }, "name", { value: "VerifyExternalSyncSettings" }); - - /** - * Calls VerifyExternalSyncSettings. - * @function verifyExternalSyncSettings - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest} request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|startExternalSync}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef StartExternalSyncCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls StartExternalSync. - * @function startExternalSync - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest} request SqlInstancesStartExternalSyncRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.StartExternalSyncCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.startExternalSync = function startExternalSync(request, callback) { - return this.rpcCall(startExternalSync, $root.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "StartExternalSync" }); - - /** - * Calls StartExternalSync. - * @function startExternalSync - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest} request SqlInstancesStartExternalSyncRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|performDiskShrink}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef PerformDiskShrinkCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls PerformDiskShrink. - * @function performDiskShrink - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest} request SqlInstancesPerformDiskShrinkRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.PerformDiskShrinkCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.performDiskShrink = function performDiskShrink(request, callback) { - return this.rpcCall(performDiskShrink, $root.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "PerformDiskShrink" }); - - /** - * Calls PerformDiskShrink. - * @function performDiskShrink - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest} request SqlInstancesPerformDiskShrinkRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|getDiskShrinkConfig}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef GetDiskShrinkConfigCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} [response] SqlInstancesGetDiskShrinkConfigResponse - */ - - /** - * Calls GetDiskShrinkConfig. - * @function getDiskShrinkConfig - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest} request SqlInstancesGetDiskShrinkConfigRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.GetDiskShrinkConfigCallback} callback Node-style callback called with the error, if any, and SqlInstancesGetDiskShrinkConfigResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.getDiskShrinkConfig = function getDiskShrinkConfig(request, callback) { - return this.rpcCall(getDiskShrinkConfig, $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest, $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse, request, callback); - }, "name", { value: "GetDiskShrinkConfig" }); - - /** - * Calls GetDiskShrinkConfig. - * @function getDiskShrinkConfig - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest} request SqlInstancesGetDiskShrinkConfigRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|resetReplicaSize}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ResetReplicaSizeCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls ResetReplicaSize. - * @function resetReplicaSize - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest} request SqlInstancesResetReplicaSizeRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ResetReplicaSizeCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.resetReplicaSize = function resetReplicaSize(request, callback) { - return this.rpcCall(resetReplicaSize, $root.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "ResetReplicaSize" }); - - /** - * Calls ResetReplicaSize. - * @function resetReplicaSize - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest} request SqlInstancesResetReplicaSizeRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|getLatestRecoveryTime}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef GetLatestRecoveryTimeCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} [response] SqlInstancesGetLatestRecoveryTimeResponse - */ - - /** - * Calls GetLatestRecoveryTime. - * @function getLatestRecoveryTime - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest} request SqlInstancesGetLatestRecoveryTimeRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.GetLatestRecoveryTimeCallback} callback Node-style callback called with the error, if any, and SqlInstancesGetLatestRecoveryTimeResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.getLatestRecoveryTime = function getLatestRecoveryTime(request, callback) { - return this.rpcCall(getLatestRecoveryTime, $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest, $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse, request, callback); - }, "name", { value: "GetLatestRecoveryTime" }); - - /** - * Calls GetLatestRecoveryTime. - * @function getLatestRecoveryTime - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest} request SqlInstancesGetLatestRecoveryTimeRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|executeSql}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ExecuteSqlCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} [response] SqlInstancesExecuteSqlResponse - */ - - /** - * Calls ExecuteSql. - * @function executeSql - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest} request SqlInstancesExecuteSqlRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ExecuteSqlCallback} callback Node-style callback called with the error, if any, and SqlInstancesExecuteSqlResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.executeSql = function executeSql(request, callback) { - return this.rpcCall(executeSql, $root.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest, $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse, request, callback); - }, "name", { value: "ExecuteSql" }); - - /** - * Calls ExecuteSql. - * @function executeSql - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest} request SqlInstancesExecuteSqlRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|acquireSsrsLease}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef AcquireSsrsLeaseCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} [response] SqlInstancesAcquireSsrsLeaseResponse - */ - - /** - * Calls AcquireSsrsLease. - * @function acquireSsrsLease - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest} request SqlInstancesAcquireSsrsLeaseRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.AcquireSsrsLeaseCallback} callback Node-style callback called with the error, if any, and SqlInstancesAcquireSsrsLeaseResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.acquireSsrsLease = function acquireSsrsLease(request, callback) { - return this.rpcCall(acquireSsrsLease, $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest, $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse, request, callback); - }, "name", { value: "AcquireSsrsLease" }); - - /** - * Calls AcquireSsrsLease. - * @function acquireSsrsLease - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest} request SqlInstancesAcquireSsrsLeaseRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|releaseSsrsLease}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef ReleaseSsrsLeaseCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} [response] SqlInstancesReleaseSsrsLeaseResponse - */ - - /** - * Calls ReleaseSsrsLease. - * @function releaseSsrsLease - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest} request SqlInstancesReleaseSsrsLeaseRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.ReleaseSsrsLeaseCallback} callback Node-style callback called with the error, if any, and SqlInstancesReleaseSsrsLeaseResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.releaseSsrsLease = function releaseSsrsLease(request, callback) { - return this.rpcCall(releaseSsrsLease, $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest, $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse, request, callback); - }, "name", { value: "ReleaseSsrsLease" }); - - /** - * Calls ReleaseSsrsLease. - * @function releaseSsrsLease - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest} request SqlInstancesReleaseSsrsLeaseRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|preCheckMajorVersionUpgrade}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef PreCheckMajorVersionUpgradeCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls PreCheckMajorVersionUpgrade. - * @function preCheckMajorVersionUpgrade - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest} request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.PreCheckMajorVersionUpgradeCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.preCheckMajorVersionUpgrade = function preCheckMajorVersionUpgrade(request, callback) { - return this.rpcCall(preCheckMajorVersionUpgrade, $root.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "PreCheckMajorVersionUpgrade" }); - - /** - * Calls PreCheckMajorVersionUpgrade. - * @function preCheckMajorVersionUpgrade - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest} request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlInstancesService|pointInTimeRestore}. - * @memberof google.cloud.sql.v1.SqlInstancesService - * @typedef PointInTimeRestoreCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls PointInTimeRestore. - * @function pointInTimeRestore - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest} request SqlInstancesPointInTimeRestoreRequest message or plain object - * @param {google.cloud.sql.v1.SqlInstancesService.PointInTimeRestoreCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.pointInTimeRestore = function pointInTimeRestore(request, callback) { - return this.rpcCall(pointInTimeRestore, $root.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "PointInTimeRestore" }); - - /** - * Calls PointInTimeRestore. - * @function pointInTimeRestore - * @memberof google.cloud.sql.v1.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest} request SqlInstancesPointInTimeRestoreRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlInstancesService; - })(); - - v1.SqlInstancesAddServerCaRequest = (function() { - - /** - * Properties of a SqlInstancesAddServerCaRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesAddServerCaRequest - * @property {string|null} [instance] SqlInstancesAddServerCaRequest instance - * @property {string|null} [project] SqlInstancesAddServerCaRequest project - */ - - /** - * Constructs a new SqlInstancesAddServerCaRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesAddServerCaRequest. - * @implements ISqlInstancesAddServerCaRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest=} [properties] Properties to set - */ - function SqlInstancesAddServerCaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesAddServerCaRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @instance - */ - SqlInstancesAddServerCaRequest.prototype.instance = ""; - - /** - * SqlInstancesAddServerCaRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @instance - */ - SqlInstancesAddServerCaRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesAddServerCaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest instance - */ - SqlInstancesAddServerCaRequest.create = function create(properties) { - return new SqlInstancesAddServerCaRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesAddServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddServerCaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesAddServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddServerCaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddServerCaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesAddServerCaRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesAddServerCaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesAddServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest - */ - SqlInstancesAddServerCaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesAddServerCaRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesAddServerCaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesAddServerCaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesAddServerCaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesAddServerCaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesAddServerCaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesAddServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesAddServerCaRequest"; - }; - - return SqlInstancesAddServerCaRequest; - })(); - - v1.SqlInstancesAddServerCertificateRequest = (function() { - - /** - * Properties of a SqlInstancesAddServerCertificateRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesAddServerCertificateRequest - * @property {string|null} [instance] SqlInstancesAddServerCertificateRequest instance - * @property {string|null} [project] SqlInstancesAddServerCertificateRequest project - */ - - /** - * Constructs a new SqlInstancesAddServerCertificateRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesAddServerCertificateRequest. - * @implements ISqlInstancesAddServerCertificateRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest=} [properties] Properties to set - */ - function SqlInstancesAddServerCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesAddServerCertificateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @instance - */ - SqlInstancesAddServerCertificateRequest.prototype.instance = ""; - - /** - * SqlInstancesAddServerCertificateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @instance - */ - SqlInstancesAddServerCertificateRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesAddServerCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest instance - */ - SqlInstancesAddServerCertificateRequest.create = function create(properties) { - return new SqlInstancesAddServerCertificateRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesAddServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddServerCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesAddServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddServerCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesAddServerCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesAddServerCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesAddServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest - */ - SqlInstancesAddServerCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesAddServerCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesAddServerCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesAddServerCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesAddServerCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesAddServerCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesAddServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest"; - }; - - return SqlInstancesAddServerCertificateRequest; - })(); - - v1.SqlInstancesAddEntraIdCertificateRequest = (function() { - - /** - * Properties of a SqlInstancesAddEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesAddEntraIdCertificateRequest - * @property {string|null} [instance] SqlInstancesAddEntraIdCertificateRequest instance - * @property {string|null} [project] SqlInstancesAddEntraIdCertificateRequest project - */ - - /** - * Constructs a new SqlInstancesAddEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesAddEntraIdCertificateRequest. - * @implements ISqlInstancesAddEntraIdCertificateRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest=} [properties] Properties to set - */ - function SqlInstancesAddEntraIdCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesAddEntraIdCertificateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @instance - */ - SqlInstancesAddEntraIdCertificateRequest.prototype.instance = ""; - - /** - * SqlInstancesAddEntraIdCertificateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @instance - */ - SqlInstancesAddEntraIdCertificateRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesAddEntraIdCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest instance - */ - SqlInstancesAddEntraIdCertificateRequest.create = function create(properties) { - return new SqlInstancesAddEntraIdCertificateRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddEntraIdCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddEntraIdCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesAddEntraIdCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesAddEntraIdCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesAddEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest - */ - SqlInstancesAddEntraIdCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesAddEntraIdCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesAddEntraIdCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesAddEntraIdCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesAddEntraIdCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesAddEntraIdCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesAddEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest"; - }; - - return SqlInstancesAddEntraIdCertificateRequest; - })(); - - v1.SqlInstancesCloneRequest = (function() { - - /** - * Properties of a SqlInstancesCloneRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesCloneRequest - * @property {string|null} [instance] SqlInstancesCloneRequest instance - * @property {string|null} [project] SqlInstancesCloneRequest project - * @property {google.cloud.sql.v1.IInstancesCloneRequest|null} [body] SqlInstancesCloneRequest body - */ - - /** - * Constructs a new SqlInstancesCloneRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesCloneRequest. - * @implements ISqlInstancesCloneRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest=} [properties] Properties to set - */ - function SqlInstancesCloneRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesCloneRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @instance - */ - SqlInstancesCloneRequest.prototype.instance = ""; - - /** - * SqlInstancesCloneRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @instance - */ - SqlInstancesCloneRequest.prototype.project = ""; - - /** - * SqlInstancesCloneRequest body. - * @member {google.cloud.sql.v1.IInstancesCloneRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @instance - */ - SqlInstancesCloneRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesCloneRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesCloneRequest} SqlInstancesCloneRequest instance - */ - SqlInstancesCloneRequest.create = function create(properties) { - return new SqlInstancesCloneRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCloneRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest} message SqlInstancesCloneRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesCloneRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesCloneRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCloneRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesCloneRequest} message SqlInstancesCloneRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesCloneRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesCloneRequest} SqlInstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesCloneRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesCloneRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesCloneRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesCloneRequest} SqlInstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesCloneRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesCloneRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesCloneRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesCloneRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesCloneRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesCloneRequest} SqlInstancesCloneRequest - */ - SqlInstancesCloneRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesCloneRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesCloneRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesCloneRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesCloneRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesCloneRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesCloneRequest} message SqlInstancesCloneRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesCloneRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesCloneRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesCloneRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesCloneRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesCloneRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesCloneRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesCloneRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesCloneRequest"; - }; - - return SqlInstancesCloneRequest; - })(); - - v1.SqlInstancesDeleteRequest = (function() { - - /** - * Properties of a SqlInstancesDeleteRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesDeleteRequest - * @property {string|null} [instance] SqlInstancesDeleteRequest instance - * @property {string|null} [project] SqlInstancesDeleteRequest project - * @property {boolean|null} [enableFinalBackup] SqlInstancesDeleteRequest enableFinalBackup - * @property {number|Long|null} [finalBackupTtlDays] SqlInstancesDeleteRequest finalBackupTtlDays - * @property {google.protobuf.ITimestamp|null} [finalBackupExpiryTime] SqlInstancesDeleteRequest finalBackupExpiryTime - * @property {string|null} [finalBackupDescription] SqlInstancesDeleteRequest finalBackupDescription - */ - - /** - * Constructs a new SqlInstancesDeleteRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesDeleteRequest. - * @implements ISqlInstancesDeleteRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest=} [properties] Properties to set - */ - function SqlInstancesDeleteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesDeleteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.instance = ""; - - /** - * SqlInstancesDeleteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.project = ""; - - /** - * SqlInstancesDeleteRequest enableFinalBackup. - * @member {boolean|null|undefined} enableFinalBackup - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.enableFinalBackup = null; - - /** - * SqlInstancesDeleteRequest finalBackupTtlDays. - * @member {number|Long|null|undefined} finalBackupTtlDays - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.finalBackupTtlDays = null; - - /** - * SqlInstancesDeleteRequest finalBackupExpiryTime. - * @member {google.protobuf.ITimestamp|null|undefined} finalBackupExpiryTime - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.finalBackupExpiryTime = null; - - /** - * SqlInstancesDeleteRequest finalBackupDescription. - * @member {string} finalBackupDescription - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.finalBackupDescription = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlInstancesDeleteRequest.prototype, "_enableFinalBackup", { - get: $util.oneOfGetter($oneOfFields = ["enableFinalBackup"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * SqlInstancesDeleteRequest expiration. - * @member {"finalBackupTtlDays"|"finalBackupExpiryTime"|undefined} expiration - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @instance - */ - Object.defineProperty(SqlInstancesDeleteRequest.prototype, "expiration", { - get: $util.oneOfGetter($oneOfFields = ["finalBackupTtlDays", "finalBackupExpiryTime"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlInstancesDeleteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest instance - */ - SqlInstancesDeleteRequest.create = function create(properties) { - return new SqlInstancesDeleteRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDeleteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest} message SqlInstancesDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDeleteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.finalBackupTtlDays != null && Object.hasOwnProperty.call(message, "finalBackupTtlDays")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.finalBackupTtlDays); - if (message.finalBackupDescription != null && Object.hasOwnProperty.call(message, "finalBackupDescription")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.finalBackupDescription); - if (message.finalBackupExpiryTime != null && Object.hasOwnProperty.call(message, "finalBackupExpiryTime")) - $root.google.protobuf.Timestamp.encode(message.finalBackupExpiryTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.enableFinalBackup != null && Object.hasOwnProperty.call(message, "enableFinalBackup")) - writer.uint32(/* id 7, wireType 0 =*/56).bool(message.enableFinalBackup); - return writer; - }; - - /** - * Encodes the specified SqlInstancesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDeleteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesDeleteRequest} message SqlInstancesDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDeleteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesDeleteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 7: { - message.enableFinalBackup = reader.bool(); - break; - } - case 4: { - message.finalBackupTtlDays = reader.int64(); - break; - } - case 6: { - message.finalBackupExpiryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 5: { - message.finalBackupDescription = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDeleteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesDeleteRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesDeleteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.enableFinalBackup != null && message.hasOwnProperty("enableFinalBackup")) { - properties._enableFinalBackup = 1; - if (typeof message.enableFinalBackup !== "boolean") - return "enableFinalBackup: boolean expected"; - } - if (message.finalBackupTtlDays != null && message.hasOwnProperty("finalBackupTtlDays")) { - properties.expiration = 1; - if (!$util.isInteger(message.finalBackupTtlDays) && !(message.finalBackupTtlDays && $util.isInteger(message.finalBackupTtlDays.low) && $util.isInteger(message.finalBackupTtlDays.high))) - return "finalBackupTtlDays: integer|Long expected"; - } - if (message.finalBackupExpiryTime != null && message.hasOwnProperty("finalBackupExpiryTime")) { - if (properties.expiration === 1) - return "expiration: multiple values"; - properties.expiration = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.finalBackupExpiryTime); - if (error) - return "finalBackupExpiryTime." + error; - } - } - if (message.finalBackupDescription != null && message.hasOwnProperty("finalBackupDescription")) - if (!$util.isString(message.finalBackupDescription)) - return "finalBackupDescription: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest - */ - SqlInstancesDeleteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesDeleteRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesDeleteRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.enableFinalBackup != null) - message.enableFinalBackup = Boolean(object.enableFinalBackup); - if (object.finalBackupTtlDays != null) - if ($util.Long) - (message.finalBackupTtlDays = $util.Long.fromValue(object.finalBackupTtlDays)).unsigned = false; - else if (typeof object.finalBackupTtlDays === "string") - message.finalBackupTtlDays = parseInt(object.finalBackupTtlDays, 10); - else if (typeof object.finalBackupTtlDays === "number") - message.finalBackupTtlDays = object.finalBackupTtlDays; - else if (typeof object.finalBackupTtlDays === "object") - message.finalBackupTtlDays = new $util.LongBits(object.finalBackupTtlDays.low >>> 0, object.finalBackupTtlDays.high >>> 0).toNumber(); - if (object.finalBackupExpiryTime != null) { - if (typeof object.finalBackupExpiryTime !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesDeleteRequest.finalBackupExpiryTime: object expected"); - message.finalBackupExpiryTime = $root.google.protobuf.Timestamp.fromObject(object.finalBackupExpiryTime); - } - if (object.finalBackupDescription != null) - message.finalBackupDescription = String(object.finalBackupDescription); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesDeleteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesDeleteRequest} message SqlInstancesDeleteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesDeleteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.finalBackupDescription = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.finalBackupTtlDays != null && message.hasOwnProperty("finalBackupTtlDays")) { - if (typeof message.finalBackupTtlDays === "number") - object.finalBackupTtlDays = options.longs === String ? String(message.finalBackupTtlDays) : message.finalBackupTtlDays; - else - object.finalBackupTtlDays = options.longs === String ? $util.Long.prototype.toString.call(message.finalBackupTtlDays) : options.longs === Number ? new $util.LongBits(message.finalBackupTtlDays.low >>> 0, message.finalBackupTtlDays.high >>> 0).toNumber() : message.finalBackupTtlDays; - if (options.oneofs) - object.expiration = "finalBackupTtlDays"; - } - if (message.finalBackupDescription != null && message.hasOwnProperty("finalBackupDescription")) - object.finalBackupDescription = message.finalBackupDescription; - if (message.finalBackupExpiryTime != null && message.hasOwnProperty("finalBackupExpiryTime")) { - object.finalBackupExpiryTime = $root.google.protobuf.Timestamp.toObject(message.finalBackupExpiryTime, options); - if (options.oneofs) - object.expiration = "finalBackupExpiryTime"; - } - if (message.enableFinalBackup != null && message.hasOwnProperty("enableFinalBackup")) { - object.enableFinalBackup = message.enableFinalBackup; - if (options.oneofs) - object._enableFinalBackup = "enableFinalBackup"; - } - return object; - }; - - /** - * Converts this SqlInstancesDeleteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesDeleteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesDeleteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesDeleteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesDeleteRequest"; - }; - - return SqlInstancesDeleteRequest; - })(); - - v1.SqlInstancesDemoteMasterRequest = (function() { - - /** - * Properties of a SqlInstancesDemoteMasterRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesDemoteMasterRequest - * @property {string|null} [instance] SqlInstancesDemoteMasterRequest instance - * @property {string|null} [project] SqlInstancesDemoteMasterRequest project - * @property {google.cloud.sql.v1.IInstancesDemoteMasterRequest|null} [body] SqlInstancesDemoteMasterRequest body - */ - - /** - * Constructs a new SqlInstancesDemoteMasterRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesDemoteMasterRequest. - * @implements ISqlInstancesDemoteMasterRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest=} [properties] Properties to set - */ - function SqlInstancesDemoteMasterRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesDemoteMasterRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @instance - */ - SqlInstancesDemoteMasterRequest.prototype.instance = ""; - - /** - * SqlInstancesDemoteMasterRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @instance - */ - SqlInstancesDemoteMasterRequest.prototype.project = ""; - - /** - * SqlInstancesDemoteMasterRequest body. - * @member {google.cloud.sql.v1.IInstancesDemoteMasterRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @instance - */ - SqlInstancesDemoteMasterRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesDemoteMasterRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest instance - */ - SqlInstancesDemoteMasterRequest.create = function create(properties) { - return new SqlInstancesDemoteMasterRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteMasterRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDemoteMasterRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesDemoteMasterRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteMasterRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDemoteMasterRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDemoteMasterRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesDemoteMasterRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDemoteMasterRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesDemoteMasterRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesDemoteMasterRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesDemoteMasterRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest - */ - SqlInstancesDemoteMasterRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesDemoteMasterRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesDemoteMasterRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesDemoteMasterRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesDemoteMasterRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesDemoteMasterRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesDemoteMasterRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesDemoteMasterRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesDemoteMasterRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesDemoteMasterRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesDemoteMasterRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesDemoteMasterRequest"; - }; - - return SqlInstancesDemoteMasterRequest; - })(); - - v1.SqlInstancesDemoteRequest = (function() { - - /** - * Properties of a SqlInstancesDemoteRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesDemoteRequest - * @property {string|null} [instance] SqlInstancesDemoteRequest instance - * @property {string|null} [project] SqlInstancesDemoteRequest project - * @property {google.cloud.sql.v1.IInstancesDemoteRequest|null} [body] SqlInstancesDemoteRequest body - */ - - /** - * Constructs a new SqlInstancesDemoteRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesDemoteRequest. - * @implements ISqlInstancesDemoteRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest=} [properties] Properties to set - */ - function SqlInstancesDemoteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesDemoteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @instance - */ - SqlInstancesDemoteRequest.prototype.instance = ""; - - /** - * SqlInstancesDemoteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @instance - */ - SqlInstancesDemoteRequest.prototype.project = ""; - - /** - * SqlInstancesDemoteRequest body. - * @member {google.cloud.sql.v1.IInstancesDemoteRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @instance - */ - SqlInstancesDemoteRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesDemoteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest instance - */ - SqlInstancesDemoteRequest.create = function create(properties) { - return new SqlInstancesDemoteRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest} message SqlInstancesDemoteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDemoteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesDemoteRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesDemoteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesDemoteRequest} message SqlInstancesDemoteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDemoteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDemoteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesDemoteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesDemoteRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDemoteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesDemoteRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesDemoteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesDemoteRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest - */ - SqlInstancesDemoteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesDemoteRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesDemoteRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesDemoteRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesDemoteRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesDemoteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesDemoteRequest} message SqlInstancesDemoteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesDemoteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesDemoteRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesDemoteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesDemoteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesDemoteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesDemoteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesDemoteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesDemoteRequest"; - }; - - return SqlInstancesDemoteRequest; - })(); - - v1.SqlInstancesExportRequest = (function() { - - /** - * Properties of a SqlInstancesExportRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesExportRequest - * @property {string|null} [instance] SqlInstancesExportRequest instance - * @property {string|null} [project] SqlInstancesExportRequest project - * @property {google.cloud.sql.v1.IInstancesExportRequest|null} [body] SqlInstancesExportRequest body - */ - - /** - * Constructs a new SqlInstancesExportRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesExportRequest. - * @implements ISqlInstancesExportRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesExportRequest=} [properties] Properties to set - */ - function SqlInstancesExportRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesExportRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @instance - */ - SqlInstancesExportRequest.prototype.instance = ""; - - /** - * SqlInstancesExportRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @instance - */ - SqlInstancesExportRequest.prototype.project = ""; - - /** - * SqlInstancesExportRequest body. - * @member {google.cloud.sql.v1.IInstancesExportRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @instance - */ - SqlInstancesExportRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesExportRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesExportRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesExportRequest} SqlInstancesExportRequest instance - */ - SqlInstancesExportRequest.create = function create(properties) { - return new SqlInstancesExportRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExportRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesExportRequest} message SqlInstancesExportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExportRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesExportRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExportRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesExportRequest} message SqlInstancesExportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExportRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesExportRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesExportRequest} SqlInstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExportRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesExportRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesExportRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesExportRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesExportRequest} SqlInstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExportRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesExportRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesExportRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesExportRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesExportRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesExportRequest} SqlInstancesExportRequest - */ - SqlInstancesExportRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesExportRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesExportRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesExportRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesExportRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesExportRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesExportRequest} message SqlInstancesExportRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesExportRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesExportRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesExportRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesExportRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesExportRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesExportRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesExportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesExportRequest"; - }; - - return SqlInstancesExportRequest; - })(); - - v1.SqlInstancesFailoverRequest = (function() { - - /** - * Properties of a SqlInstancesFailoverRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesFailoverRequest - * @property {string|null} [instance] SqlInstancesFailoverRequest instance - * @property {string|null} [project] SqlInstancesFailoverRequest project - * @property {google.cloud.sql.v1.IInstancesFailoverRequest|null} [body] SqlInstancesFailoverRequest body - */ - - /** - * Constructs a new SqlInstancesFailoverRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesFailoverRequest. - * @implements ISqlInstancesFailoverRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest=} [properties] Properties to set - */ - function SqlInstancesFailoverRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesFailoverRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @instance - */ - SqlInstancesFailoverRequest.prototype.instance = ""; - - /** - * SqlInstancesFailoverRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @instance - */ - SqlInstancesFailoverRequest.prototype.project = ""; - - /** - * SqlInstancesFailoverRequest body. - * @member {google.cloud.sql.v1.IInstancesFailoverRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @instance - */ - SqlInstancesFailoverRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesFailoverRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest instance - */ - SqlInstancesFailoverRequest.create = function create(properties) { - return new SqlInstancesFailoverRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesFailoverRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest} message SqlInstancesFailoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesFailoverRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesFailoverRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesFailoverRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesFailoverRequest} message SqlInstancesFailoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesFailoverRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesFailoverRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesFailoverRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesFailoverRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesFailoverRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesFailoverRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesFailoverRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesFailoverRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest - */ - SqlInstancesFailoverRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesFailoverRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesFailoverRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesFailoverRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesFailoverRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesFailoverRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesFailoverRequest} message SqlInstancesFailoverRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesFailoverRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesFailoverRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesFailoverRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesFailoverRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesFailoverRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesFailoverRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesFailoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesFailoverRequest"; - }; - - return SqlInstancesFailoverRequest; - })(); - - v1.SqlInstancesGetRequest = (function() { - - /** - * Properties of a SqlInstancesGetRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesGetRequest - * @property {string|null} [instance] SqlInstancesGetRequest instance - * @property {string|null} [project] SqlInstancesGetRequest project - */ - - /** - * Constructs a new SqlInstancesGetRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesGetRequest. - * @implements ISqlInstancesGetRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesGetRequest=} [properties] Properties to set - */ - function SqlInstancesGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesGetRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @instance - */ - SqlInstancesGetRequest.prototype.instance = ""; - - /** - * SqlInstancesGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @instance - */ - SqlInstancesGetRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesGetRequest} SqlInstancesGetRequest instance - */ - SqlInstancesGetRequest.create = function create(properties) { - return new SqlInstancesGetRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetRequest} message SqlInstancesGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetRequest} message SqlInstancesGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesGetRequest} SqlInstancesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesGetRequest} SqlInstancesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesGetRequest} SqlInstancesGetRequest - */ - SqlInstancesGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesGetRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesGetRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesGetRequest} message SqlInstancesGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesGetRequest"; - }; - - return SqlInstancesGetRequest; - })(); - - v1.SqlInstancesImportRequest = (function() { - - /** - * Properties of a SqlInstancesImportRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesImportRequest - * @property {string|null} [instance] SqlInstancesImportRequest instance - * @property {string|null} [project] SqlInstancesImportRequest project - * @property {google.cloud.sql.v1.IInstancesImportRequest|null} [body] SqlInstancesImportRequest body - */ - - /** - * Constructs a new SqlInstancesImportRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesImportRequest. - * @implements ISqlInstancesImportRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesImportRequest=} [properties] Properties to set - */ - function SqlInstancesImportRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesImportRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @instance - */ - SqlInstancesImportRequest.prototype.instance = ""; - - /** - * SqlInstancesImportRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @instance - */ - SqlInstancesImportRequest.prototype.project = ""; - - /** - * SqlInstancesImportRequest body. - * @member {google.cloud.sql.v1.IInstancesImportRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @instance - */ - SqlInstancesImportRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesImportRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesImportRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesImportRequest} SqlInstancesImportRequest instance - */ - SqlInstancesImportRequest.create = function create(properties) { - return new SqlInstancesImportRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesImportRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesImportRequest} message SqlInstancesImportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesImportRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesImportRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesImportRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesImportRequest} message SqlInstancesImportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesImportRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesImportRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesImportRequest} SqlInstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesImportRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesImportRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesImportRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesImportRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesImportRequest} SqlInstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesImportRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesImportRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesImportRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesImportRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesImportRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesImportRequest} SqlInstancesImportRequest - */ - SqlInstancesImportRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesImportRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesImportRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesImportRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesImportRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesImportRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesImportRequest} message SqlInstancesImportRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesImportRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesImportRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesImportRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesImportRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesImportRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesImportRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesImportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesImportRequest"; - }; - - return SqlInstancesImportRequest; - })(); - - v1.SqlInstancesInsertRequest = (function() { - - /** - * Properties of a SqlInstancesInsertRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesInsertRequest - * @property {string|null} [project] SqlInstancesInsertRequest project - * @property {google.cloud.sql.v1.IDatabaseInstance|null} [body] SqlInstancesInsertRequest body - */ - - /** - * Constructs a new SqlInstancesInsertRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesInsertRequest. - * @implements ISqlInstancesInsertRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest=} [properties] Properties to set - */ - function SqlInstancesInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesInsertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @instance - */ - SqlInstancesInsertRequest.prototype.project = ""; - - /** - * SqlInstancesInsertRequest body. - * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @instance - */ - SqlInstancesInsertRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesInsertRequest} SqlInstancesInsertRequest instance - */ - SqlInstancesInsertRequest.create = function create(properties) { - return new SqlInstancesInsertRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest} message SqlInstancesInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesInsertRequest} message SqlInstancesInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesInsertRequest} SqlInstancesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesInsertRequest} SqlInstancesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesInsertRequest} SqlInstancesInsertRequest - */ - SqlInstancesInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesInsertRequest(); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesInsertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesInsertRequest} message SqlInstancesInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.project = ""; - object.body = null; - } - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesInsertRequest"; - }; - - return SqlInstancesInsertRequest; - })(); - - v1.SqlInstancesListRequest = (function() { - - /** - * Properties of a SqlInstancesListRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesListRequest - * @property {string|null} [filter] SqlInstancesListRequest filter - * @property {number|null} [maxResults] SqlInstancesListRequest maxResults - * @property {string|null} [pageToken] SqlInstancesListRequest pageToken - * @property {string|null} [project] SqlInstancesListRequest project - */ - - /** - * Constructs a new SqlInstancesListRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesListRequest. - * @implements ISqlInstancesListRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesListRequest=} [properties] Properties to set - */ - function SqlInstancesListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesListRequest filter. - * @member {string} filter - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @instance - */ - SqlInstancesListRequest.prototype.filter = ""; - - /** - * SqlInstancesListRequest maxResults. - * @member {number} maxResults - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @instance - */ - SqlInstancesListRequest.prototype.maxResults = 0; - - /** - * SqlInstancesListRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @instance - */ - SqlInstancesListRequest.prototype.pageToken = ""; - - /** - * SqlInstancesListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @instance - */ - SqlInstancesListRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesListRequest} SqlInstancesListRequest instance - */ - SqlInstancesListRequest.create = function create(properties) { - return new SqlInstancesListRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListRequest} message SqlInstancesListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.maxResults); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListRequest} message SqlInstancesListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesListRequest} SqlInstancesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.filter = reader.string(); - break; - } - case 2: { - message.maxResults = reader.uint32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesListRequest} SqlInstancesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesListRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesListRequest} SqlInstancesListRequest - */ - SqlInstancesListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesListRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesListRequest(); - if (object.filter != null) - message.filter = String(object.filter); - if (object.maxResults != null) - message.maxResults = object.maxResults >>> 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesListRequest} message SqlInstancesListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.filter = ""; - object.maxResults = 0; - object.pageToken = ""; - object.project = ""; - } - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesListRequest"; - }; - - return SqlInstancesListRequest; - })(); - - v1.SqlInstancesListServerCasRequest = (function() { - - /** - * Properties of a SqlInstancesListServerCasRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesListServerCasRequest - * @property {string|null} [instance] SqlInstancesListServerCasRequest instance - * @property {string|null} [project] SqlInstancesListServerCasRequest project - */ - - /** - * Constructs a new SqlInstancesListServerCasRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesListServerCasRequest. - * @implements ISqlInstancesListServerCasRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest=} [properties] Properties to set - */ - function SqlInstancesListServerCasRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesListServerCasRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @instance - */ - SqlInstancesListServerCasRequest.prototype.instance = ""; - - /** - * SqlInstancesListServerCasRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @instance - */ - SqlInstancesListServerCasRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesListServerCasRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest instance - */ - SqlInstancesListServerCasRequest.create = function create(properties) { - return new SqlInstancesListServerCasRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesListServerCasRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCasRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListServerCasRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesListServerCasRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCasRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListServerCasRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListServerCasRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesListServerCasRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListServerCasRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesListServerCasRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesListServerCasRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesListServerCasRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest - */ - SqlInstancesListServerCasRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesListServerCasRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesListServerCasRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesListServerCasRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesListServerCasRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesListServerCasRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesListServerCasRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesListServerCasRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesListServerCasRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesListServerCasRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesListServerCasRequest"; - }; - - return SqlInstancesListServerCasRequest; - })(); - - v1.SqlInstancesListServerCertificatesRequest = (function() { - - /** - * Properties of a SqlInstancesListServerCertificatesRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesListServerCertificatesRequest - * @property {string|null} [instance] SqlInstancesListServerCertificatesRequest instance - * @property {string|null} [project] SqlInstancesListServerCertificatesRequest project - */ - - /** - * Constructs a new SqlInstancesListServerCertificatesRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesListServerCertificatesRequest. - * @implements ISqlInstancesListServerCertificatesRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest=} [properties] Properties to set - */ - function SqlInstancesListServerCertificatesRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesListServerCertificatesRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @instance - */ - SqlInstancesListServerCertificatesRequest.prototype.instance = ""; - - /** - * SqlInstancesListServerCertificatesRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @instance - */ - SqlInstancesListServerCertificatesRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesListServerCertificatesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest instance - */ - SqlInstancesListServerCertificatesRequest.create = function create(properties) { - return new SqlInstancesListServerCertificatesRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesListServerCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListServerCertificatesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesListServerCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListServerCertificatesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListServerCertificatesRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListServerCertificatesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesListServerCertificatesRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesListServerCertificatesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesListServerCertificatesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest - */ - SqlInstancesListServerCertificatesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesListServerCertificatesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesListServerCertificatesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesListServerCertificatesRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesListServerCertificatesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesListServerCertificatesRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesListServerCertificatesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest"; - }; - - return SqlInstancesListServerCertificatesRequest; - })(); - - v1.SqlInstancesListEntraIdCertificatesRequest = (function() { - - /** - * Properties of a SqlInstancesListEntraIdCertificatesRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesListEntraIdCertificatesRequest - * @property {string|null} [instance] SqlInstancesListEntraIdCertificatesRequest instance - * @property {string|null} [project] SqlInstancesListEntraIdCertificatesRequest project - */ - - /** - * Constructs a new SqlInstancesListEntraIdCertificatesRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesListEntraIdCertificatesRequest. - * @implements ISqlInstancesListEntraIdCertificatesRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest=} [properties] Properties to set - */ - function SqlInstancesListEntraIdCertificatesRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesListEntraIdCertificatesRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @instance - */ - SqlInstancesListEntraIdCertificatesRequest.prototype.instance = ""; - - /** - * SqlInstancesListEntraIdCertificatesRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @instance - */ - SqlInstancesListEntraIdCertificatesRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesListEntraIdCertificatesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest instance - */ - SqlInstancesListEntraIdCertificatesRequest.create = function create(properties) { - return new SqlInstancesListEntraIdCertificatesRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListEntraIdCertificatesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListEntraIdCertificatesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListEntraIdCertificatesRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListEntraIdCertificatesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesListEntraIdCertificatesRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesListEntraIdCertificatesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesListEntraIdCertificatesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest - */ - SqlInstancesListEntraIdCertificatesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesListEntraIdCertificatesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesListEntraIdCertificatesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesListEntraIdCertificatesRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesListEntraIdCertificatesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesListEntraIdCertificatesRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesListEntraIdCertificatesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest"; - }; - - return SqlInstancesListEntraIdCertificatesRequest; - })(); - - v1.SqlInstancesPatchRequest = (function() { - - /** - * Properties of a SqlInstancesPatchRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesPatchRequest - * @property {string|null} [instance] SqlInstancesPatchRequest instance - * @property {string|null} [project] SqlInstancesPatchRequest project - * @property {google.cloud.sql.v1.IDatabaseInstance|null} [body] SqlInstancesPatchRequest body - */ - - /** - * Constructs a new SqlInstancesPatchRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesPatchRequest. - * @implements ISqlInstancesPatchRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest=} [properties] Properties to set - */ - function SqlInstancesPatchRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesPatchRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @instance - */ - SqlInstancesPatchRequest.prototype.instance = ""; - - /** - * SqlInstancesPatchRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @instance - */ - SqlInstancesPatchRequest.prototype.project = ""; - - /** - * SqlInstancesPatchRequest body. - * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @instance - */ - SqlInstancesPatchRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesPatchRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesPatchRequest} SqlInstancesPatchRequest instance - */ - SqlInstancesPatchRequest.create = function create(properties) { - return new SqlInstancesPatchRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesPatchRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPatchRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest} message SqlInstancesPatchRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPatchRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesPatchRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPatchRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPatchRequest} message SqlInstancesPatchRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPatchRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesPatchRequest} SqlInstancesPatchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPatchRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesPatchRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesPatchRequest} SqlInstancesPatchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPatchRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesPatchRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesPatchRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesPatchRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesPatchRequest} SqlInstancesPatchRequest - */ - SqlInstancesPatchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesPatchRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesPatchRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesPatchRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesPatchRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesPatchRequest} message SqlInstancesPatchRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesPatchRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesPatchRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesPatchRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesPatchRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesPatchRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesPatchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesPatchRequest"; - }; - - return SqlInstancesPatchRequest; - })(); - - v1.SqlInstancesPromoteReplicaRequest = (function() { - - /** - * Properties of a SqlInstancesPromoteReplicaRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesPromoteReplicaRequest - * @property {string|null} [instance] SqlInstancesPromoteReplicaRequest instance - * @property {string|null} [project] SqlInstancesPromoteReplicaRequest project - * @property {boolean|null} [failover] SqlInstancesPromoteReplicaRequest failover - */ - - /** - * Constructs a new SqlInstancesPromoteReplicaRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesPromoteReplicaRequest. - * @implements ISqlInstancesPromoteReplicaRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest=} [properties] Properties to set - */ - function SqlInstancesPromoteReplicaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesPromoteReplicaRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @instance - */ - SqlInstancesPromoteReplicaRequest.prototype.instance = ""; - - /** - * SqlInstancesPromoteReplicaRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @instance - */ - SqlInstancesPromoteReplicaRequest.prototype.project = ""; - - /** - * SqlInstancesPromoteReplicaRequest failover. - * @member {boolean} failover - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @instance - */ - SqlInstancesPromoteReplicaRequest.prototype.failover = false; - - /** - * Creates a new SqlInstancesPromoteReplicaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest instance - */ - SqlInstancesPromoteReplicaRequest.create = function create(properties) { - return new SqlInstancesPromoteReplicaRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesPromoteReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPromoteReplicaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.failover != null && Object.hasOwnProperty.call(message, "failover")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.failover); - return writer; - }; - - /** - * Encodes the specified SqlInstancesPromoteReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPromoteReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPromoteReplicaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.failover = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPromoteReplicaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesPromoteReplicaRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesPromoteReplicaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.failover != null && message.hasOwnProperty("failover")) - if (typeof message.failover !== "boolean") - return "failover: boolean expected"; - return null; - }; - - /** - * Creates a SqlInstancesPromoteReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest - */ - SqlInstancesPromoteReplicaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.failover != null) - message.failover = Boolean(object.failover); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesPromoteReplicaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesPromoteReplicaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.failover = false; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.failover != null && message.hasOwnProperty("failover")) - object.failover = message.failover; - return object; - }; - - /** - * Converts this SqlInstancesPromoteReplicaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesPromoteReplicaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesPromoteReplicaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesPromoteReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest"; - }; - - return SqlInstancesPromoteReplicaRequest; - })(); - - v1.SqlInstancesSwitchoverRequest = (function() { - - /** - * Properties of a SqlInstancesSwitchoverRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesSwitchoverRequest - * @property {string|null} [instance] SqlInstancesSwitchoverRequest instance - * @property {string|null} [project] SqlInstancesSwitchoverRequest project - * @property {google.protobuf.IDuration|null} [dbTimeout] SqlInstancesSwitchoverRequest dbTimeout - */ - - /** - * Constructs a new SqlInstancesSwitchoverRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesSwitchoverRequest. - * @implements ISqlInstancesSwitchoverRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest=} [properties] Properties to set - */ - function SqlInstancesSwitchoverRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesSwitchoverRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @instance - */ - SqlInstancesSwitchoverRequest.prototype.instance = ""; - - /** - * SqlInstancesSwitchoverRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @instance - */ - SqlInstancesSwitchoverRequest.prototype.project = ""; - - /** - * SqlInstancesSwitchoverRequest dbTimeout. - * @member {google.protobuf.IDuration|null|undefined} dbTimeout - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @instance - */ - SqlInstancesSwitchoverRequest.prototype.dbTimeout = null; - - /** - * Creates a new SqlInstancesSwitchoverRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest instance - */ - SqlInstancesSwitchoverRequest.create = function create(properties) { - return new SqlInstancesSwitchoverRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesSwitchoverRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesSwitchoverRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesSwitchoverRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.dbTimeout != null && Object.hasOwnProperty.call(message, "dbTimeout")) - $root.google.protobuf.Duration.encode(message.dbTimeout, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesSwitchoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesSwitchoverRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesSwitchoverRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesSwitchoverRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.dbTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesSwitchoverRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesSwitchoverRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesSwitchoverRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.dbTimeout != null && message.hasOwnProperty("dbTimeout")) { - var error = $root.google.protobuf.Duration.verify(message.dbTimeout); - if (error) - return "dbTimeout." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesSwitchoverRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest - */ - SqlInstancesSwitchoverRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesSwitchoverRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.dbTimeout != null) { - if (typeof object.dbTimeout !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesSwitchoverRequest.dbTimeout: object expected"); - message.dbTimeout = $root.google.protobuf.Duration.fromObject(object.dbTimeout); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesSwitchoverRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesSwitchoverRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.dbTimeout = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.dbTimeout != null && message.hasOwnProperty("dbTimeout")) - object.dbTimeout = $root.google.protobuf.Duration.toObject(message.dbTimeout, options); - return object; - }; - - /** - * Converts this SqlInstancesSwitchoverRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesSwitchoverRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesSwitchoverRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesSwitchoverRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesSwitchoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesSwitchoverRequest"; - }; - - return SqlInstancesSwitchoverRequest; - })(); - - v1.SqlInstancesResetSslConfigRequest = (function() { - - /** - * Properties of a SqlInstancesResetSslConfigRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesResetSslConfigRequest - * @property {string|null} [instance] SqlInstancesResetSslConfigRequest instance - * @property {string|null} [project] SqlInstancesResetSslConfigRequest project - * @property {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode|null} [mode] SqlInstancesResetSslConfigRequest mode - */ - - /** - * Constructs a new SqlInstancesResetSslConfigRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesResetSslConfigRequest. - * @implements ISqlInstancesResetSslConfigRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest=} [properties] Properties to set - */ - function SqlInstancesResetSslConfigRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesResetSslConfigRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @instance - */ - SqlInstancesResetSslConfigRequest.prototype.instance = ""; - - /** - * SqlInstancesResetSslConfigRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @instance - */ - SqlInstancesResetSslConfigRequest.prototype.project = ""; - - /** - * SqlInstancesResetSslConfigRequest mode. - * @member {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode} mode - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @instance - */ - SqlInstancesResetSslConfigRequest.prototype.mode = 0; - - /** - * Creates a new SqlInstancesResetSslConfigRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest instance - */ - SqlInstancesResetSslConfigRequest.create = function create(properties) { - return new SqlInstancesResetSslConfigRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesResetSslConfigRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesResetSslConfigRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mode); - return writer; - }; - - /** - * Encodes the specified SqlInstancesResetSslConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesResetSslConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesResetSslConfigRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.mode = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesResetSslConfigRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesResetSslConfigRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesResetSslConfigRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates a SqlInstancesResetSslConfigRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest - */ - SqlInstancesResetSslConfigRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - switch (object.mode) { - default: - if (typeof object.mode === "number") { - message.mode = object.mode; - break; - } - break; - case "RESET_SSL_MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "ALL": - case 1: - message.mode = 1; - break; - case "SYNC_FROM_PRIMARY": - case 2: - message.mode = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesResetSslConfigRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesResetSslConfigRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.mode = options.enums === String ? "RESET_SSL_MODE_UNSPECIFIED" : 0; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode[message.mode] === undefined ? message.mode : $root.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode[message.mode] : message.mode; - return object; - }; - - /** - * Converts this SqlInstancesResetSslConfigRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesResetSslConfigRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesResetSslConfigRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesResetSslConfigRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesResetSslConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesResetSslConfigRequest"; - }; - - /** - * ResetSslMode enum. - * @name google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode - * @enum {number} - * @property {number} RESET_SSL_MODE_UNSPECIFIED=0 RESET_SSL_MODE_UNSPECIFIED value - * @property {number} ALL=1 ALL value - * @property {number} SYNC_FROM_PRIMARY=2 SYNC_FROM_PRIMARY value - */ - SqlInstancesResetSslConfigRequest.ResetSslMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RESET_SSL_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ALL"] = 1; - values[valuesById[2] = "SYNC_FROM_PRIMARY"] = 2; - return values; - })(); - - return SqlInstancesResetSslConfigRequest; - })(); - - v1.SqlInstancesRestartRequest = (function() { - - /** - * Properties of a SqlInstancesRestartRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesRestartRequest - * @property {string|null} [instance] SqlInstancesRestartRequest instance - * @property {string|null} [project] SqlInstancesRestartRequest project - */ - - /** - * Constructs a new SqlInstancesRestartRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesRestartRequest. - * @implements ISqlInstancesRestartRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest=} [properties] Properties to set - */ - function SqlInstancesRestartRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRestartRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @instance - */ - SqlInstancesRestartRequest.prototype.instance = ""; - - /** - * SqlInstancesRestartRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @instance - */ - SqlInstancesRestartRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesRestartRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesRestartRequest} SqlInstancesRestartRequest instance - */ - SqlInstancesRestartRequest.create = function create(properties) { - return new SqlInstancesRestartRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRestartRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestartRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest} message SqlInstancesRestartRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRestartRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRestartRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestartRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRestartRequest} message SqlInstancesRestartRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRestartRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesRestartRequest} SqlInstancesRestartRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRestartRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRestartRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesRestartRequest} SqlInstancesRestartRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRestartRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRestartRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRestartRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesRestartRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesRestartRequest} SqlInstancesRestartRequest - */ - SqlInstancesRestartRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRestartRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesRestartRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRestartRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesRestartRequest} message SqlInstancesRestartRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRestartRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesRestartRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRestartRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRestartRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesRestartRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRestartRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRestartRequest"; - }; - - return SqlInstancesRestartRequest; - })(); - - v1.SqlInstancesRestoreBackupRequest = (function() { - - /** - * Properties of a SqlInstancesRestoreBackupRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesRestoreBackupRequest - * @property {string|null} [instance] SqlInstancesRestoreBackupRequest instance - * @property {string|null} [project] SqlInstancesRestoreBackupRequest project - * @property {google.cloud.sql.v1.IInstancesRestoreBackupRequest|null} [body] SqlInstancesRestoreBackupRequest body - */ - - /** - * Constructs a new SqlInstancesRestoreBackupRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesRestoreBackupRequest. - * @implements ISqlInstancesRestoreBackupRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest=} [properties] Properties to set - */ - function SqlInstancesRestoreBackupRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRestoreBackupRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @instance - */ - SqlInstancesRestoreBackupRequest.prototype.instance = ""; - - /** - * SqlInstancesRestoreBackupRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @instance - */ - SqlInstancesRestoreBackupRequest.prototype.project = ""; - - /** - * SqlInstancesRestoreBackupRequest body. - * @member {google.cloud.sql.v1.IInstancesRestoreBackupRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @instance - */ - SqlInstancesRestoreBackupRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesRestoreBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest instance - */ - SqlInstancesRestoreBackupRequest.create = function create(properties) { - return new SqlInstancesRestoreBackupRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestoreBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRestoreBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesRestoreBackupRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRestoreBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRestoreBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRestoreBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesRestoreBackupRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRestoreBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRestoreBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRestoreBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesRestoreBackupRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest - */ - SqlInstancesRestoreBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesRestoreBackupRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesRestoreBackupRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRestoreBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRestoreBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesRestoreBackupRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesRestoreBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRestoreBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRestoreBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesRestoreBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRestoreBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRestoreBackupRequest"; - }; - - return SqlInstancesRestoreBackupRequest; - })(); - - v1.SqlInstancesRotateServerCaRequest = (function() { - - /** - * Properties of a SqlInstancesRotateServerCaRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesRotateServerCaRequest - * @property {string|null} [instance] SqlInstancesRotateServerCaRequest instance - * @property {string|null} [project] SqlInstancesRotateServerCaRequest project - * @property {google.cloud.sql.v1.IInstancesRotateServerCaRequest|null} [body] SqlInstancesRotateServerCaRequest body - */ - - /** - * Constructs a new SqlInstancesRotateServerCaRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesRotateServerCaRequest. - * @implements ISqlInstancesRotateServerCaRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest=} [properties] Properties to set - */ - function SqlInstancesRotateServerCaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRotateServerCaRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @instance - */ - SqlInstancesRotateServerCaRequest.prototype.instance = ""; - - /** - * SqlInstancesRotateServerCaRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @instance - */ - SqlInstancesRotateServerCaRequest.prototype.project = ""; - - /** - * SqlInstancesRotateServerCaRequest body. - * @member {google.cloud.sql.v1.IInstancesRotateServerCaRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @instance - */ - SqlInstancesRotateServerCaRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesRotateServerCaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest instance - */ - SqlInstancesRotateServerCaRequest.create = function create(properties) { - return new SqlInstancesRotateServerCaRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateServerCaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesRotateServerCaRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateServerCaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesRotateServerCaRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateServerCaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRotateServerCaRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRotateServerCaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesRotateServerCaRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest - */ - SqlInstancesRotateServerCaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesRotateServerCaRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesRotateServerCaRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRotateServerCaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRotateServerCaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesRotateServerCaRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesRotateServerCaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRotateServerCaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRotateServerCaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRotateServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRotateServerCaRequest"; - }; - - return SqlInstancesRotateServerCaRequest; - })(); - - v1.SqlInstancesRotateServerCertificateRequest = (function() { - - /** - * Properties of a SqlInstancesRotateServerCertificateRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesRotateServerCertificateRequest - * @property {string|null} [instance] SqlInstancesRotateServerCertificateRequest instance - * @property {string|null} [project] SqlInstancesRotateServerCertificateRequest project - * @property {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest|null} [body] SqlInstancesRotateServerCertificateRequest body - */ - - /** - * Constructs a new SqlInstancesRotateServerCertificateRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesRotateServerCertificateRequest. - * @implements ISqlInstancesRotateServerCertificateRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest=} [properties] Properties to set - */ - function SqlInstancesRotateServerCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRotateServerCertificateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @instance - */ - SqlInstancesRotateServerCertificateRequest.prototype.instance = ""; - - /** - * SqlInstancesRotateServerCertificateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @instance - */ - SqlInstancesRotateServerCertificateRequest.prototype.project = ""; - - /** - * SqlInstancesRotateServerCertificateRequest body. - * @member {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @instance - */ - SqlInstancesRotateServerCertificateRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesRotateServerCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest instance - */ - SqlInstancesRotateServerCertificateRequest.create = function create(properties) { - return new SqlInstancesRotateServerCertificateRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateServerCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateServerCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRotateServerCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRotateServerCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest - */ - SqlInstancesRotateServerCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRotateServerCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRotateServerCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesRotateServerCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRotateServerCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRotateServerCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRotateServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest"; - }; - - return SqlInstancesRotateServerCertificateRequest; - })(); - - v1.SqlInstancesRotateEntraIdCertificateRequest = (function() { - - /** - * Properties of a SqlInstancesRotateEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesRotateEntraIdCertificateRequest - * @property {string|null} [instance] SqlInstancesRotateEntraIdCertificateRequest instance - * @property {string|null} [project] SqlInstancesRotateEntraIdCertificateRequest project - * @property {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest|null} [body] SqlInstancesRotateEntraIdCertificateRequest body - */ - - /** - * Constructs a new SqlInstancesRotateEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesRotateEntraIdCertificateRequest. - * @implements ISqlInstancesRotateEntraIdCertificateRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set - */ - function SqlInstancesRotateEntraIdCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRotateEntraIdCertificateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @instance - */ - SqlInstancesRotateEntraIdCertificateRequest.prototype.instance = ""; - - /** - * SqlInstancesRotateEntraIdCertificateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @instance - */ - SqlInstancesRotateEntraIdCertificateRequest.prototype.project = ""; - - /** - * SqlInstancesRotateEntraIdCertificateRequest body. - * @member {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @instance - */ - SqlInstancesRotateEntraIdCertificateRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesRotateEntraIdCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest instance - */ - SqlInstancesRotateEntraIdCertificateRequest.create = function create(properties) { - return new SqlInstancesRotateEntraIdCertificateRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateEntraIdCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateEntraIdCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRotateEntraIdCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRotateEntraIdCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest - */ - SqlInstancesRotateEntraIdCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRotateEntraIdCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesRotateEntraIdCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRotateEntraIdCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRotateEntraIdCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRotateEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest"; - }; - - return SqlInstancesRotateEntraIdCertificateRequest; - })(); - - v1.SqlInstancesStartReplicaRequest = (function() { - - /** - * Properties of a SqlInstancesStartReplicaRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesStartReplicaRequest - * @property {string|null} [instance] SqlInstancesStartReplicaRequest instance - * @property {string|null} [project] SqlInstancesStartReplicaRequest project - */ - - /** - * Constructs a new SqlInstancesStartReplicaRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesStartReplicaRequest. - * @implements ISqlInstancesStartReplicaRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest=} [properties] Properties to set - */ - function SqlInstancesStartReplicaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesStartReplicaRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @instance - */ - SqlInstancesStartReplicaRequest.prototype.instance = ""; - - /** - * SqlInstancesStartReplicaRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @instance - */ - SqlInstancesStartReplicaRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesStartReplicaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest instance - */ - SqlInstancesStartReplicaRequest.create = function create(properties) { - return new SqlInstancesStartReplicaRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesStartReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartReplicaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStartReplicaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesStartReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartReplicaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStartReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStartReplicaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStartReplicaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesStartReplicaRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesStartReplicaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesStartReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest - */ - SqlInstancesStartReplicaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesStartReplicaRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesStartReplicaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesStartReplicaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesStartReplicaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesStartReplicaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesStartReplicaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesStartReplicaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesStartReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesStartReplicaRequest"; - }; - - return SqlInstancesStartReplicaRequest; - })(); - - v1.SqlInstancesStopReplicaRequest = (function() { - - /** - * Properties of a SqlInstancesStopReplicaRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesStopReplicaRequest - * @property {string|null} [instance] SqlInstancesStopReplicaRequest instance - * @property {string|null} [project] SqlInstancesStopReplicaRequest project - */ - - /** - * Constructs a new SqlInstancesStopReplicaRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesStopReplicaRequest. - * @implements ISqlInstancesStopReplicaRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest=} [properties] Properties to set - */ - function SqlInstancesStopReplicaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesStopReplicaRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @instance - */ - SqlInstancesStopReplicaRequest.prototype.instance = ""; - - /** - * SqlInstancesStopReplicaRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @instance - */ - SqlInstancesStopReplicaRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesStopReplicaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest instance - */ - SqlInstancesStopReplicaRequest.create = function create(properties) { - return new SqlInstancesStopReplicaRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesStopReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStopReplicaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStopReplicaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesStopReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStopReplicaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStopReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStopReplicaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStopReplicaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesStopReplicaRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesStopReplicaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesStopReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest - */ - SqlInstancesStopReplicaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesStopReplicaRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesStopReplicaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesStopReplicaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesStopReplicaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesStopReplicaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesStopReplicaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesStopReplicaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesStopReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesStopReplicaRequest"; - }; - - return SqlInstancesStopReplicaRequest; - })(); - - v1.SqlInstancesTruncateLogRequest = (function() { - - /** - * Properties of a SqlInstancesTruncateLogRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesTruncateLogRequest - * @property {string|null} [instance] SqlInstancesTruncateLogRequest instance - * @property {string|null} [project] SqlInstancesTruncateLogRequest project - * @property {google.cloud.sql.v1.IInstancesTruncateLogRequest|null} [body] SqlInstancesTruncateLogRequest body - */ - - /** - * Constructs a new SqlInstancesTruncateLogRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesTruncateLogRequest. - * @implements ISqlInstancesTruncateLogRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest=} [properties] Properties to set - */ - function SqlInstancesTruncateLogRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesTruncateLogRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @instance - */ - SqlInstancesTruncateLogRequest.prototype.instance = ""; - - /** - * SqlInstancesTruncateLogRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @instance - */ - SqlInstancesTruncateLogRequest.prototype.project = ""; - - /** - * SqlInstancesTruncateLogRequest body. - * @member {google.cloud.sql.v1.IInstancesTruncateLogRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @instance - */ - SqlInstancesTruncateLogRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesTruncateLogRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest instance - */ - SqlInstancesTruncateLogRequest.create = function create(properties) { - return new SqlInstancesTruncateLogRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesTruncateLogRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesTruncateLogRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesTruncateLogRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesTruncateLogRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesTruncateLogRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesTruncateLogRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesTruncateLogRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesTruncateLogRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesTruncateLogRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesTruncateLogRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesTruncateLogRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest - */ - SqlInstancesTruncateLogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesTruncateLogRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesTruncateLogRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesTruncateLogRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesTruncateLogRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesTruncateLogRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesTruncateLogRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesTruncateLogRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesTruncateLogRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesTruncateLogRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesTruncateLogRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesTruncateLogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesTruncateLogRequest"; - }; - - return SqlInstancesTruncateLogRequest; - })(); - - v1.SqlInstancesPerformDiskShrinkRequest = (function() { - - /** - * Properties of a SqlInstancesPerformDiskShrinkRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesPerformDiskShrinkRequest - * @property {string|null} [instance] SqlInstancesPerformDiskShrinkRequest instance - * @property {string|null} [project] SqlInstancesPerformDiskShrinkRequest project - * @property {google.cloud.sql.v1.IPerformDiskShrinkContext|null} [body] SqlInstancesPerformDiskShrinkRequest body - */ - - /** - * Constructs a new SqlInstancesPerformDiskShrinkRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesPerformDiskShrinkRequest. - * @implements ISqlInstancesPerformDiskShrinkRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest=} [properties] Properties to set - */ - function SqlInstancesPerformDiskShrinkRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesPerformDiskShrinkRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @instance - */ - SqlInstancesPerformDiskShrinkRequest.prototype.instance = ""; - - /** - * SqlInstancesPerformDiskShrinkRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @instance - */ - SqlInstancesPerformDiskShrinkRequest.prototype.project = ""; - - /** - * SqlInstancesPerformDiskShrinkRequest body. - * @member {google.cloud.sql.v1.IPerformDiskShrinkContext|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @instance - */ - SqlInstancesPerformDiskShrinkRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesPerformDiskShrinkRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest instance - */ - SqlInstancesPerformDiskShrinkRequest.create = function create(properties) { - return new SqlInstancesPerformDiskShrinkRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesPerformDiskShrinkRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPerformDiskShrinkRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.PerformDiskShrinkContext.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesPerformDiskShrinkRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPerformDiskShrinkRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPerformDiskShrinkRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.PerformDiskShrinkContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPerformDiskShrinkRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesPerformDiskShrinkRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesPerformDiskShrinkRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.PerformDiskShrinkContext.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesPerformDiskShrinkRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest - */ - SqlInstancesPerformDiskShrinkRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.PerformDiskShrinkContext.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesPerformDiskShrinkRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesPerformDiskShrinkRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.PerformDiskShrinkContext.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesPerformDiskShrinkRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesPerformDiskShrinkRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesPerformDiskShrinkRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesPerformDiskShrinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest"; - }; - - return SqlInstancesPerformDiskShrinkRequest; - })(); - - v1.SqlInstancesUpdateRequest = (function() { - - /** - * Properties of a SqlInstancesUpdateRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesUpdateRequest - * @property {string|null} [instance] SqlInstancesUpdateRequest instance - * @property {string|null} [project] SqlInstancesUpdateRequest project - * @property {google.cloud.sql.v1.IDatabaseInstance|null} [body] SqlInstancesUpdateRequest body - */ - - /** - * Constructs a new SqlInstancesUpdateRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesUpdateRequest. - * @implements ISqlInstancesUpdateRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest=} [properties] Properties to set - */ - function SqlInstancesUpdateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesUpdateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @instance - */ - SqlInstancesUpdateRequest.prototype.instance = ""; - - /** - * SqlInstancesUpdateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @instance - */ - SqlInstancesUpdateRequest.prototype.project = ""; - - /** - * SqlInstancesUpdateRequest body. - * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @instance - */ - SqlInstancesUpdateRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesUpdateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest instance - */ - SqlInstancesUpdateRequest.create = function create(properties) { - return new SqlInstancesUpdateRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesUpdateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest} message SqlInstancesUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesUpdateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesUpdateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesUpdateRequest} message SqlInstancesUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesUpdateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesUpdateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesUpdateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesUpdateRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesUpdateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest - */ - SqlInstancesUpdateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesUpdateRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesUpdateRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesUpdateRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesUpdateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesUpdateRequest} message SqlInstancesUpdateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesUpdateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesUpdateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesUpdateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesUpdateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesUpdateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesUpdateRequest"; - }; - - return SqlInstancesUpdateRequest; - })(); - - v1.SqlInstancesRescheduleMaintenanceRequest = (function() { - - /** - * Properties of a SqlInstancesRescheduleMaintenanceRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesRescheduleMaintenanceRequest - * @property {string|null} [instance] SqlInstancesRescheduleMaintenanceRequest instance - * @property {string|null} [project] SqlInstancesRescheduleMaintenanceRequest project - * @property {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody|null} [body] SqlInstancesRescheduleMaintenanceRequest body - */ - - /** - * Constructs a new SqlInstancesRescheduleMaintenanceRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesRescheduleMaintenanceRequest. - * @implements ISqlInstancesRescheduleMaintenanceRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest=} [properties] Properties to set - */ - function SqlInstancesRescheduleMaintenanceRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRescheduleMaintenanceRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @instance - */ - SqlInstancesRescheduleMaintenanceRequest.prototype.instance = ""; - - /** - * SqlInstancesRescheduleMaintenanceRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @instance - */ - SqlInstancesRescheduleMaintenanceRequest.prototype.project = ""; - - /** - * SqlInstancesRescheduleMaintenanceRequest body. - * @member {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @instance - */ - SqlInstancesRescheduleMaintenanceRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesRescheduleMaintenanceRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest instance - */ - SqlInstancesRescheduleMaintenanceRequest.create = function create(properties) { - return new SqlInstancesRescheduleMaintenanceRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRescheduleMaintenanceRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRescheduleMaintenanceRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRescheduleMaintenanceRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRescheduleMaintenanceRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRescheduleMaintenanceRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRescheduleMaintenanceRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRescheduleMaintenanceRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest - */ - SqlInstancesRescheduleMaintenanceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRescheduleMaintenanceRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesRescheduleMaintenanceRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRescheduleMaintenanceRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRescheduleMaintenanceRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRescheduleMaintenanceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest"; - }; - - return SqlInstancesRescheduleMaintenanceRequest; - })(); - - v1.SqlInstancesReencryptRequest = (function() { - - /** - * Properties of a SqlInstancesReencryptRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesReencryptRequest - * @property {string|null} [instance] SqlInstancesReencryptRequest instance - * @property {string|null} [project] SqlInstancesReencryptRequest project - * @property {google.cloud.sql.v1.IInstancesReencryptRequest|null} [body] SqlInstancesReencryptRequest body - */ - - /** - * Constructs a new SqlInstancesReencryptRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesReencryptRequest. - * @implements ISqlInstancesReencryptRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest=} [properties] Properties to set - */ - function SqlInstancesReencryptRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesReencryptRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @instance - */ - SqlInstancesReencryptRequest.prototype.instance = ""; - - /** - * SqlInstancesReencryptRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @instance - */ - SqlInstancesReencryptRequest.prototype.project = ""; - - /** - * SqlInstancesReencryptRequest body. - * @member {google.cloud.sql.v1.IInstancesReencryptRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @instance - */ - SqlInstancesReencryptRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesReencryptRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest instance - */ - SqlInstancesReencryptRequest.create = function create(properties) { - return new SqlInstancesReencryptRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReencryptRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest} message SqlInstancesReencryptRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReencryptRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesReencryptRequest.encode(message.body, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReencryptRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesReencryptRequest} message SqlInstancesReencryptRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReencryptRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReencryptRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesReencryptRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.body = $root.google.cloud.sql.v1.InstancesReencryptRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReencryptRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesReencryptRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesReencryptRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesReencryptRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest - */ - SqlInstancesReencryptRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesReencryptRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesReencryptRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesReencryptRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesReencryptRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesReencryptRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesReencryptRequest} message SqlInstancesReencryptRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesReencryptRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesReencryptRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesReencryptRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesReencryptRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesReencryptRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesReencryptRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesReencryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesReencryptRequest"; - }; - - return SqlInstancesReencryptRequest; - })(); - - v1.InstancesReencryptRequest = (function() { - - /** - * Properties of an InstancesReencryptRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesReencryptRequest - * @property {google.cloud.sql.v1.IBackupReencryptionConfig|null} [backupReencryptionConfig] InstancesReencryptRequest backupReencryptionConfig - */ - - /** - * Constructs a new InstancesReencryptRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesReencryptRequest. - * @implements IInstancesReencryptRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesReencryptRequest=} [properties] Properties to set - */ - function InstancesReencryptRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesReencryptRequest backupReencryptionConfig. - * @member {google.cloud.sql.v1.IBackupReencryptionConfig|null|undefined} backupReencryptionConfig - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @instance - */ - InstancesReencryptRequest.prototype.backupReencryptionConfig = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(InstancesReencryptRequest.prototype, "_backupReencryptionConfig", { - get: $util.oneOfGetter($oneOfFields = ["backupReencryptionConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new InstancesReencryptRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1.IInstancesReencryptRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesReencryptRequest} InstancesReencryptRequest instance - */ - InstancesReencryptRequest.create = function create(properties) { - return new InstancesReencryptRequest(properties); - }; - - /** - * Encodes the specified InstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesReencryptRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1.IInstancesReencryptRequest} message InstancesReencryptRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesReencryptRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.backupReencryptionConfig != null && Object.hasOwnProperty.call(message, "backupReencryptionConfig")) - $root.google.cloud.sql.v1.BackupReencryptionConfig.encode(message.backupReencryptionConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesReencryptRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1.IInstancesReencryptRequest} message InstancesReencryptRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesReencryptRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesReencryptRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesReencryptRequest} InstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesReencryptRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesReencryptRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.backupReencryptionConfig = $root.google.cloud.sql.v1.BackupReencryptionConfig.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesReencryptRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesReencryptRequest} InstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesReencryptRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesReencryptRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesReencryptRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.backupReencryptionConfig != null && message.hasOwnProperty("backupReencryptionConfig")) { - properties._backupReencryptionConfig = 1; - { - var error = $root.google.cloud.sql.v1.BackupReencryptionConfig.verify(message.backupReencryptionConfig); - if (error) - return "backupReencryptionConfig." + error; - } - } - return null; - }; - - /** - * Creates an InstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesReencryptRequest} InstancesReencryptRequest - */ - InstancesReencryptRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesReencryptRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesReencryptRequest(); - if (object.backupReencryptionConfig != null) { - if (typeof object.backupReencryptionConfig !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesReencryptRequest.backupReencryptionConfig: object expected"); - message.backupReencryptionConfig = $root.google.cloud.sql.v1.BackupReencryptionConfig.fromObject(object.backupReencryptionConfig); - } - return message; - }; - - /** - * Creates a plain object from an InstancesReencryptRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1.InstancesReencryptRequest} message InstancesReencryptRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesReencryptRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.backupReencryptionConfig != null && message.hasOwnProperty("backupReencryptionConfig")) { - object.backupReencryptionConfig = $root.google.cloud.sql.v1.BackupReencryptionConfig.toObject(message.backupReencryptionConfig, options); - if (options.oneofs) - object._backupReencryptionConfig = "backupReencryptionConfig"; - } - return object; - }; - - /** - * Converts this InstancesReencryptRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesReencryptRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesReencryptRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesReencryptRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesReencryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesReencryptRequest"; - }; - - return InstancesReencryptRequest; - })(); - - v1.BackupReencryptionConfig = (function() { - - /** - * Properties of a BackupReencryptionConfig. - * @memberof google.cloud.sql.v1 - * @interface IBackupReencryptionConfig - * @property {number|null} [backupLimit] BackupReencryptionConfig backupLimit - * @property {google.cloud.sql.v1.BackupReencryptionConfig.BackupType|null} [backupType] BackupReencryptionConfig backupType - */ - - /** - * Constructs a new BackupReencryptionConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a BackupReencryptionConfig. - * @implements IBackupReencryptionConfig - * @constructor - * @param {google.cloud.sql.v1.IBackupReencryptionConfig=} [properties] Properties to set - */ - function BackupReencryptionConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupReencryptionConfig backupLimit. - * @member {number|null|undefined} backupLimit - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @instance - */ - BackupReencryptionConfig.prototype.backupLimit = null; - - /** - * BackupReencryptionConfig backupType. - * @member {google.cloud.sql.v1.BackupReencryptionConfig.BackupType|null|undefined} backupType - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @instance - */ - BackupReencryptionConfig.prototype.backupType = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(BackupReencryptionConfig.prototype, "_backupLimit", { - get: $util.oneOfGetter($oneOfFields = ["backupLimit"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(BackupReencryptionConfig.prototype, "_backupType", { - get: $util.oneOfGetter($oneOfFields = ["backupType"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new BackupReencryptionConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @static - * @param {google.cloud.sql.v1.IBackupReencryptionConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.BackupReencryptionConfig} BackupReencryptionConfig instance - */ - BackupReencryptionConfig.create = function create(properties) { - return new BackupReencryptionConfig(properties); - }; - - /** - * Encodes the specified BackupReencryptionConfig message. Does not implicitly {@link google.cloud.sql.v1.BackupReencryptionConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @static - * @param {google.cloud.sql.v1.IBackupReencryptionConfig} message BackupReencryptionConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupReencryptionConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.backupLimit != null && Object.hasOwnProperty.call(message, "backupLimit")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.backupLimit); - if (message.backupType != null && Object.hasOwnProperty.call(message, "backupType")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.backupType); - return writer; - }; - - /** - * Encodes the specified BackupReencryptionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BackupReencryptionConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @static - * @param {google.cloud.sql.v1.IBackupReencryptionConfig} message BackupReencryptionConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupReencryptionConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupReencryptionConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.BackupReencryptionConfig} BackupReencryptionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupReencryptionConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BackupReencryptionConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.backupLimit = reader.int32(); - break; - } - case 2: { - message.backupType = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupReencryptionConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.BackupReencryptionConfig} BackupReencryptionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupReencryptionConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupReencryptionConfig message. - * @function verify - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupReencryptionConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.backupLimit != null && message.hasOwnProperty("backupLimit")) { - properties._backupLimit = 1; - if (!$util.isInteger(message.backupLimit)) - return "backupLimit: integer expected"; - } - if (message.backupType != null && message.hasOwnProperty("backupType")) { - properties._backupType = 1; - switch (message.backupType) { - default: - return "backupType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - return null; - }; - - /** - * Creates a BackupReencryptionConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.BackupReencryptionConfig} BackupReencryptionConfig - */ - BackupReencryptionConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.BackupReencryptionConfig) - return object; - var message = new $root.google.cloud.sql.v1.BackupReencryptionConfig(); - if (object.backupLimit != null) - message.backupLimit = object.backupLimit | 0; - switch (object.backupType) { - default: - if (typeof object.backupType === "number") { - message.backupType = object.backupType; - break; - } - break; - case "BACKUP_TYPE_UNSPECIFIED": - case 0: - message.backupType = 0; - break; - case "AUTOMATED": - case 1: - message.backupType = 1; - break; - case "ON_DEMAND": - case 2: - message.backupType = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a BackupReencryptionConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @static - * @param {google.cloud.sql.v1.BackupReencryptionConfig} message BackupReencryptionConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupReencryptionConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.backupLimit != null && message.hasOwnProperty("backupLimit")) { - object.backupLimit = message.backupLimit; - if (options.oneofs) - object._backupLimit = "backupLimit"; - } - if (message.backupType != null && message.hasOwnProperty("backupType")) { - object.backupType = options.enums === String ? $root.google.cloud.sql.v1.BackupReencryptionConfig.BackupType[message.backupType] === undefined ? message.backupType : $root.google.cloud.sql.v1.BackupReencryptionConfig.BackupType[message.backupType] : message.backupType; - if (options.oneofs) - object._backupType = "backupType"; - } - return object; - }; - - /** - * Converts this BackupReencryptionConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @instance - * @returns {Object.} JSON object - */ - BackupReencryptionConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupReencryptionConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.BackupReencryptionConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupReencryptionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.BackupReencryptionConfig"; - }; - - /** - * BackupType enum. - * @name google.cloud.sql.v1.BackupReencryptionConfig.BackupType - * @enum {number} - * @property {number} BACKUP_TYPE_UNSPECIFIED=0 BACKUP_TYPE_UNSPECIFIED value - * @property {number} AUTOMATED=1 AUTOMATED value - * @property {number} ON_DEMAND=2 ON_DEMAND value - */ - BackupReencryptionConfig.BackupType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BACKUP_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUTOMATED"] = 1; - values[valuesById[2] = "ON_DEMAND"] = 2; - return values; - })(); - - return BackupReencryptionConfig; - })(); - - /** - * ExternalSyncParallelLevel enum. - * @name google.cloud.sql.v1.ExternalSyncParallelLevel - * @enum {number} - * @property {number} EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED=0 EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED value - * @property {number} MIN=1 MIN value - * @property {number} OPTIMAL=2 OPTIMAL value - * @property {number} MAX=3 MAX value - */ - v1.ExternalSyncParallelLevel = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED"] = 0; - values[valuesById[1] = "MIN"] = 1; - values[valuesById[2] = "OPTIMAL"] = 2; - values[valuesById[3] = "MAX"] = 3; - return values; - })(); - - v1.ExternalSyncSelectedObject = (function() { - - /** - * Properties of an ExternalSyncSelectedObject. - * @memberof google.cloud.sql.v1 - * @interface IExternalSyncSelectedObject - * @property {string|null} [database] ExternalSyncSelectedObject database - */ - - /** - * Constructs a new ExternalSyncSelectedObject. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an ExternalSyncSelectedObject. - * @implements IExternalSyncSelectedObject - * @constructor - * @param {google.cloud.sql.v1.IExternalSyncSelectedObject=} [properties] Properties to set - */ - function ExternalSyncSelectedObject(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExternalSyncSelectedObject database. - * @member {string} database - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @instance - */ - ExternalSyncSelectedObject.prototype.database = ""; - - /** - * Creates a new ExternalSyncSelectedObject instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @static - * @param {google.cloud.sql.v1.IExternalSyncSelectedObject=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ExternalSyncSelectedObject} ExternalSyncSelectedObject instance - */ - ExternalSyncSelectedObject.create = function create(properties) { - return new ExternalSyncSelectedObject(properties); - }; - - /** - * Encodes the specified ExternalSyncSelectedObject message. Does not implicitly {@link google.cloud.sql.v1.ExternalSyncSelectedObject.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @static - * @param {google.cloud.sql.v1.IExternalSyncSelectedObject} message ExternalSyncSelectedObject message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExternalSyncSelectedObject.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); - return writer; - }; - - /** - * Encodes the specified ExternalSyncSelectedObject message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExternalSyncSelectedObject.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @static - * @param {google.cloud.sql.v1.IExternalSyncSelectedObject} message ExternalSyncSelectedObject message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExternalSyncSelectedObject.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ExternalSyncSelectedObject} ExternalSyncSelectedObject - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExternalSyncSelectedObject.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExternalSyncSelectedObject(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.database = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ExternalSyncSelectedObject} ExternalSyncSelectedObject - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExternalSyncSelectedObject.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExternalSyncSelectedObject message. - * @function verify - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExternalSyncSelectedObject.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - return null; - }; - - /** - * Creates an ExternalSyncSelectedObject message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ExternalSyncSelectedObject} ExternalSyncSelectedObject - */ - ExternalSyncSelectedObject.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ExternalSyncSelectedObject) - return object; - var message = new $root.google.cloud.sql.v1.ExternalSyncSelectedObject(); - if (object.database != null) - message.database = String(object.database); - return message; - }; - - /** - * Creates a plain object from an ExternalSyncSelectedObject message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @static - * @param {google.cloud.sql.v1.ExternalSyncSelectedObject} message ExternalSyncSelectedObject - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExternalSyncSelectedObject.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.database = ""; - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - return object; - }; - - /** - * Converts this ExternalSyncSelectedObject to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @instance - * @returns {Object.} JSON object - */ - ExternalSyncSelectedObject.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExternalSyncSelectedObject - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ExternalSyncSelectedObject - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExternalSyncSelectedObject.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ExternalSyncSelectedObject"; - }; - - return ExternalSyncSelectedObject; - })(); - - v1.SqlInstancesGetDiskShrinkConfigRequest = (function() { - - /** - * Properties of a SqlInstancesGetDiskShrinkConfigRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesGetDiskShrinkConfigRequest - * @property {string|null} [instance] SqlInstancesGetDiskShrinkConfigRequest instance - * @property {string|null} [project] SqlInstancesGetDiskShrinkConfigRequest project - */ - - /** - * Constructs a new SqlInstancesGetDiskShrinkConfigRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesGetDiskShrinkConfigRequest. - * @implements ISqlInstancesGetDiskShrinkConfigRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest=} [properties] Properties to set - */ - function SqlInstancesGetDiskShrinkConfigRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesGetDiskShrinkConfigRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @instance - */ - SqlInstancesGetDiskShrinkConfigRequest.prototype.instance = ""; - - /** - * SqlInstancesGetDiskShrinkConfigRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @instance - */ - SqlInstancesGetDiskShrinkConfigRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesGetDiskShrinkConfigRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest instance - */ - SqlInstancesGetDiskShrinkConfigRequest.create = function create(properties) { - return new SqlInstancesGetDiskShrinkConfigRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetDiskShrinkConfigRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetDiskShrinkConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetDiskShrinkConfigRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetDiskShrinkConfigRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesGetDiskShrinkConfigRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesGetDiskShrinkConfigRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesGetDiskShrinkConfigRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest - */ - SqlInstancesGetDiskShrinkConfigRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesGetDiskShrinkConfigRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesGetDiskShrinkConfigRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesGetDiskShrinkConfigRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesGetDiskShrinkConfigRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesGetDiskShrinkConfigRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesGetDiskShrinkConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest"; - }; - - return SqlInstancesGetDiskShrinkConfigRequest; - })(); - - v1.SqlInstancesVerifyExternalSyncSettingsRequest = (function() { - - /** - * Properties of a SqlInstancesVerifyExternalSyncSettingsRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesVerifyExternalSyncSettingsRequest - * @property {string|null} [instance] SqlInstancesVerifyExternalSyncSettingsRequest instance - * @property {string|null} [project] SqlInstancesVerifyExternalSyncSettingsRequest project - * @property {boolean|null} [verifyConnectionOnly] SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly - * @property {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null} [syncMode] SqlInstancesVerifyExternalSyncSettingsRequest syncMode - * @property {boolean|null} [verifyReplicationOnly] SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly - * @property {google.cloud.sql.v1.IMySqlSyncConfig|null} [mysqlSyncConfig] SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig - * @property {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null} [migrationType] SqlInstancesVerifyExternalSyncSettingsRequest migrationType - * @property {google.cloud.sql.v1.ExternalSyncParallelLevel|null} [syncParallelLevel] SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel - * @property {Array.|null} [selectedObjects] SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects - */ - - /** - * Constructs a new SqlInstancesVerifyExternalSyncSettingsRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesVerifyExternalSyncSettingsRequest. - * @implements ISqlInstancesVerifyExternalSyncSettingsRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest=} [properties] Properties to set - */ - function SqlInstancesVerifyExternalSyncSettingsRequest(properties) { - this.selectedObjects = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.instance = ""; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.project = ""; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly. - * @member {boolean} verifyConnectionOnly - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.verifyConnectionOnly = false; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest syncMode. - * @member {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} syncMode - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.syncMode = 0; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly. - * @member {boolean} verifyReplicationOnly - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.verifyReplicationOnly = false; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig. - * @member {google.cloud.sql.v1.IMySqlSyncConfig|null|undefined} mysqlSyncConfig - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.mysqlSyncConfig = null; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest migrationType. - * @member {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} migrationType - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.migrationType = 0; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel. - * @member {google.cloud.sql.v1.ExternalSyncParallelLevel} syncParallelLevel - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.syncParallelLevel = 0; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects. - * @member {Array.} selectedObjects - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.selectedObjects = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest syncConfig. - * @member {"mysqlSyncConfig"|undefined} syncConfig - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - Object.defineProperty(SqlInstancesVerifyExternalSyncSettingsRequest.prototype, "syncConfig", { - get: $util.oneOfGetter($oneOfFields = ["mysqlSyncConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlInstancesVerifyExternalSyncSettingsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.create = function create(properties) { - return new SqlInstancesVerifyExternalSyncSettingsRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesVerifyExternalSyncSettingsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.verifyConnectionOnly != null && Object.hasOwnProperty.call(message, "verifyConnectionOnly")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.verifyConnectionOnly); - if (message.syncMode != null && Object.hasOwnProperty.call(message, "syncMode")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.syncMode); - if (message.verifyReplicationOnly != null && Object.hasOwnProperty.call(message, "verifyReplicationOnly")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.verifyReplicationOnly); - if (message.mysqlSyncConfig != null && Object.hasOwnProperty.call(message, "mysqlSyncConfig")) - $root.google.cloud.sql.v1.MySqlSyncConfig.encode(message.mysqlSyncConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.migrationType != null && Object.hasOwnProperty.call(message, "migrationType")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.migrationType); - if (message.syncParallelLevel != null && Object.hasOwnProperty.call(message, "syncParallelLevel")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.syncParallelLevel); - if (message.selectedObjects != null && message.selectedObjects.length) - for (var i = 0; i < message.selectedObjects.length; ++i) - $root.google.cloud.sql.v1.ExternalSyncSelectedObject.encode(message.selectedObjects[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesVerifyExternalSyncSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesVerifyExternalSyncSettingsRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.verifyConnectionOnly = reader.bool(); - break; - } - case 4: { - message.syncMode = reader.int32(); - break; - } - case 5: { - message.verifyReplicationOnly = reader.bool(); - break; - } - case 6: { - message.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.decode(reader, reader.uint32()); - break; - } - case 7: { - message.migrationType = reader.int32(); - break; - } - case 8: { - message.syncParallelLevel = reader.int32(); - break; - } - case 9: { - if (!(message.selectedObjects && message.selectedObjects.length)) - message.selectedObjects = []; - message.selectedObjects.push($root.google.cloud.sql.v1.ExternalSyncSelectedObject.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesVerifyExternalSyncSettingsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesVerifyExternalSyncSettingsRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesVerifyExternalSyncSettingsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.verifyConnectionOnly != null && message.hasOwnProperty("verifyConnectionOnly")) - if (typeof message.verifyConnectionOnly !== "boolean") - return "verifyConnectionOnly: boolean expected"; - if (message.syncMode != null && message.hasOwnProperty("syncMode")) - switch (message.syncMode) { - default: - return "syncMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.verifyReplicationOnly != null && message.hasOwnProperty("verifyReplicationOnly")) - if (typeof message.verifyReplicationOnly !== "boolean") - return "verifyReplicationOnly: boolean expected"; - if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { - properties.syncConfig = 1; - { - var error = $root.google.cloud.sql.v1.MySqlSyncConfig.verify(message.mysqlSyncConfig); - if (error) - return "mysqlSyncConfig." + error; - } - } - if (message.migrationType != null && message.hasOwnProperty("migrationType")) - switch (message.migrationType) { - default: - return "migrationType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) - switch (message.syncParallelLevel) { - default: - return "syncParallelLevel: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.selectedObjects != null && message.hasOwnProperty("selectedObjects")) { - if (!Array.isArray(message.selectedObjects)) - return "selectedObjects: array expected"; - for (var i = 0; i < message.selectedObjects.length; ++i) { - var error = $root.google.cloud.sql.v1.ExternalSyncSelectedObject.verify(message.selectedObjects[i]); - if (error) - return "selectedObjects." + error; - } - } - return null; - }; - - /** - * Creates a SqlInstancesVerifyExternalSyncSettingsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest - */ - SqlInstancesVerifyExternalSyncSettingsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.verifyConnectionOnly != null) - message.verifyConnectionOnly = Boolean(object.verifyConnectionOnly); - switch (object.syncMode) { - default: - if (typeof object.syncMode === "number") { - message.syncMode = object.syncMode; - break; - } - break; - case "EXTERNAL_SYNC_MODE_UNSPECIFIED": - case 0: - message.syncMode = 0; - break; - case "ONLINE": - case 1: - message.syncMode = 1; - break; - case "OFFLINE": - case 2: - message.syncMode = 2; - break; - } - if (object.verifyReplicationOnly != null) - message.verifyReplicationOnly = Boolean(object.verifyReplicationOnly); - if (object.mysqlSyncConfig != null) { - if (typeof object.mysqlSyncConfig !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.mysqlSyncConfig: object expected"); - message.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.fromObject(object.mysqlSyncConfig); - } - switch (object.migrationType) { - default: - if (typeof object.migrationType === "number") { - message.migrationType = object.migrationType; - break; - } - break; - case "MIGRATION_TYPE_UNSPECIFIED": - case 0: - message.migrationType = 0; - break; - case "LOGICAL": - case 1: - message.migrationType = 1; - break; - case "PHYSICAL": - case 2: - message.migrationType = 2; - break; - } - switch (object.syncParallelLevel) { - default: - if (typeof object.syncParallelLevel === "number") { - message.syncParallelLevel = object.syncParallelLevel; - break; - } - break; - case "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": - case 0: - message.syncParallelLevel = 0; - break; - case "MIN": - case 1: - message.syncParallelLevel = 1; - break; - case "OPTIMAL": - case 2: - message.syncParallelLevel = 2; - break; - case "MAX": - case 3: - message.syncParallelLevel = 3; - break; - } - if (object.selectedObjects) { - if (!Array.isArray(object.selectedObjects)) - throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.selectedObjects: array expected"); - message.selectedObjects = []; - for (var i = 0; i < object.selectedObjects.length; ++i) { - if (typeof object.selectedObjects[i] !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.selectedObjects: object expected"); - message.selectedObjects[i] = $root.google.cloud.sql.v1.ExternalSyncSelectedObject.fromObject(object.selectedObjects[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesVerifyExternalSyncSettingsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.selectedObjects = []; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.verifyConnectionOnly = false; - object.syncMode = options.enums === String ? "EXTERNAL_SYNC_MODE_UNSPECIFIED" : 0; - object.verifyReplicationOnly = false; - object.migrationType = options.enums === String ? "MIGRATION_TYPE_UNSPECIFIED" : 0; - object.syncParallelLevel = options.enums === String ? "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" : 0; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.verifyConnectionOnly != null && message.hasOwnProperty("verifyConnectionOnly")) - object.verifyConnectionOnly = message.verifyConnectionOnly; - if (message.syncMode != null && message.hasOwnProperty("syncMode")) - object.syncMode = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] === undefined ? message.syncMode : $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] : message.syncMode; - if (message.verifyReplicationOnly != null && message.hasOwnProperty("verifyReplicationOnly")) - object.verifyReplicationOnly = message.verifyReplicationOnly; - if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { - object.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.toObject(message.mysqlSyncConfig, options); - if (options.oneofs) - object.syncConfig = "mysqlSyncConfig"; - } - if (message.migrationType != null && message.hasOwnProperty("migrationType")) - object.migrationType = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] === undefined ? message.migrationType : $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] : message.migrationType; - if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) - object.syncParallelLevel = options.enums === String ? $root.google.cloud.sql.v1.ExternalSyncParallelLevel[message.syncParallelLevel] === undefined ? message.syncParallelLevel : $root.google.cloud.sql.v1.ExternalSyncParallelLevel[message.syncParallelLevel] : message.syncParallelLevel; - if (message.selectedObjects && message.selectedObjects.length) { - object.selectedObjects = []; - for (var j = 0; j < message.selectedObjects.length; ++j) - object.selectedObjects[j] = $root.google.cloud.sql.v1.ExternalSyncSelectedObject.toObject(message.selectedObjects[j], options); - } - return object; - }; - - /** - * Converts this SqlInstancesVerifyExternalSyncSettingsRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesVerifyExternalSyncSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest"; - }; - - /** - * ExternalSyncMode enum. - * @name google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode - * @enum {number} - * @property {number} EXTERNAL_SYNC_MODE_UNSPECIFIED=0 EXTERNAL_SYNC_MODE_UNSPECIFIED value - * @property {number} ONLINE=1 ONLINE value - * @property {number} OFFLINE=2 OFFLINE value - */ - SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "EXTERNAL_SYNC_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ONLINE"] = 1; - values[valuesById[2] = "OFFLINE"] = 2; - return values; - })(); - - /** - * MigrationType enum. - * @name google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType - * @enum {number} - * @property {number} MIGRATION_TYPE_UNSPECIFIED=0 MIGRATION_TYPE_UNSPECIFIED value - * @property {number} LOGICAL=1 LOGICAL value - * @property {number} PHYSICAL=2 PHYSICAL value - */ - SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MIGRATION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "LOGICAL"] = 1; - values[valuesById[2] = "PHYSICAL"] = 2; - return values; - })(); - - return SqlInstancesVerifyExternalSyncSettingsRequest; - })(); - - v1.SqlInstancesStartExternalSyncRequest = (function() { - - /** - * Properties of a SqlInstancesStartExternalSyncRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesStartExternalSyncRequest - * @property {string|null} [instance] SqlInstancesStartExternalSyncRequest instance - * @property {string|null} [project] SqlInstancesStartExternalSyncRequest project - * @property {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null} [syncMode] SqlInstancesStartExternalSyncRequest syncMode - * @property {boolean|null} [skipVerification] SqlInstancesStartExternalSyncRequest skipVerification - * @property {google.cloud.sql.v1.IMySqlSyncConfig|null} [mysqlSyncConfig] SqlInstancesStartExternalSyncRequest mysqlSyncConfig - * @property {google.cloud.sql.v1.ExternalSyncParallelLevel|null} [syncParallelLevel] SqlInstancesStartExternalSyncRequest syncParallelLevel - * @property {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null} [migrationType] SqlInstancesStartExternalSyncRequest migrationType - * @property {boolean|null} [replicaOverwriteEnabled] SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled - */ - - /** - * Constructs a new SqlInstancesStartExternalSyncRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesStartExternalSyncRequest. - * @implements ISqlInstancesStartExternalSyncRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest=} [properties] Properties to set - */ - function SqlInstancesStartExternalSyncRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesStartExternalSyncRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.instance = ""; - - /** - * SqlInstancesStartExternalSyncRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.project = ""; - - /** - * SqlInstancesStartExternalSyncRequest syncMode. - * @member {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} syncMode - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.syncMode = 0; - - /** - * SqlInstancesStartExternalSyncRequest skipVerification. - * @member {boolean} skipVerification - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.skipVerification = false; - - /** - * SqlInstancesStartExternalSyncRequest mysqlSyncConfig. - * @member {google.cloud.sql.v1.IMySqlSyncConfig|null|undefined} mysqlSyncConfig - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.mysqlSyncConfig = null; - - /** - * SqlInstancesStartExternalSyncRequest syncParallelLevel. - * @member {google.cloud.sql.v1.ExternalSyncParallelLevel} syncParallelLevel - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.syncParallelLevel = 0; - - /** - * SqlInstancesStartExternalSyncRequest migrationType. - * @member {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} migrationType - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.migrationType = 0; - - /** - * SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled. - * @member {boolean} replicaOverwriteEnabled - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.replicaOverwriteEnabled = false; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * SqlInstancesStartExternalSyncRequest syncConfig. - * @member {"mysqlSyncConfig"|undefined} syncConfig - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @instance - */ - Object.defineProperty(SqlInstancesStartExternalSyncRequest.prototype, "syncConfig", { - get: $util.oneOfGetter($oneOfFields = ["mysqlSyncConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlInstancesStartExternalSyncRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest instance - */ - SqlInstancesStartExternalSyncRequest.create = function create(properties) { - return new SqlInstancesStartExternalSyncRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesStartExternalSyncRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStartExternalSyncRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.syncMode != null && Object.hasOwnProperty.call(message, "syncMode")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.syncMode); - if (message.skipVerification != null && Object.hasOwnProperty.call(message, "skipVerification")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.skipVerification); - if (message.mysqlSyncConfig != null && Object.hasOwnProperty.call(message, "mysqlSyncConfig")) - $root.google.cloud.sql.v1.MySqlSyncConfig.encode(message.mysqlSyncConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.syncParallelLevel != null && Object.hasOwnProperty.call(message, "syncParallelLevel")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.syncParallelLevel); - if (message.migrationType != null && Object.hasOwnProperty.call(message, "migrationType")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.migrationType); - if (message.replicaOverwriteEnabled != null && Object.hasOwnProperty.call(message, "replicaOverwriteEnabled")) - writer.uint32(/* id 9, wireType 0 =*/72).bool(message.replicaOverwriteEnabled); - return writer; - }; - - /** - * Encodes the specified SqlInstancesStartExternalSyncRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStartExternalSyncRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStartExternalSyncRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.syncMode = reader.int32(); - break; - } - case 4: { - message.skipVerification = reader.bool(); - break; - } - case 6: { - message.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.decode(reader, reader.uint32()); - break; - } - case 7: { - message.syncParallelLevel = reader.int32(); - break; - } - case 8: { - message.migrationType = reader.int32(); - break; - } - case 9: { - message.replicaOverwriteEnabled = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStartExternalSyncRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesStartExternalSyncRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesStartExternalSyncRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.syncMode != null && message.hasOwnProperty("syncMode")) - switch (message.syncMode) { - default: - return "syncMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.skipVerification != null && message.hasOwnProperty("skipVerification")) - if (typeof message.skipVerification !== "boolean") - return "skipVerification: boolean expected"; - if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { - properties.syncConfig = 1; - { - var error = $root.google.cloud.sql.v1.MySqlSyncConfig.verify(message.mysqlSyncConfig); - if (error) - return "mysqlSyncConfig." + error; - } - } - if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) - switch (message.syncParallelLevel) { - default: - return "syncParallelLevel: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.migrationType != null && message.hasOwnProperty("migrationType")) - switch (message.migrationType) { - default: - return "migrationType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.replicaOverwriteEnabled != null && message.hasOwnProperty("replicaOverwriteEnabled")) - if (typeof message.replicaOverwriteEnabled !== "boolean") - return "replicaOverwriteEnabled: boolean expected"; - return null; - }; - - /** - * Creates a SqlInstancesStartExternalSyncRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest - */ - SqlInstancesStartExternalSyncRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - switch (object.syncMode) { - default: - if (typeof object.syncMode === "number") { - message.syncMode = object.syncMode; - break; - } - break; - case "EXTERNAL_SYNC_MODE_UNSPECIFIED": - case 0: - message.syncMode = 0; - break; - case "ONLINE": - case 1: - message.syncMode = 1; - break; - case "OFFLINE": - case 2: - message.syncMode = 2; - break; - } - if (object.skipVerification != null) - message.skipVerification = Boolean(object.skipVerification); - if (object.mysqlSyncConfig != null) { - if (typeof object.mysqlSyncConfig !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest.mysqlSyncConfig: object expected"); - message.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.fromObject(object.mysqlSyncConfig); - } - switch (object.syncParallelLevel) { - default: - if (typeof object.syncParallelLevel === "number") { - message.syncParallelLevel = object.syncParallelLevel; - break; - } - break; - case "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": - case 0: - message.syncParallelLevel = 0; - break; - case "MIN": - case 1: - message.syncParallelLevel = 1; - break; - case "OPTIMAL": - case 2: - message.syncParallelLevel = 2; - break; - case "MAX": - case 3: - message.syncParallelLevel = 3; - break; - } - switch (object.migrationType) { - default: - if (typeof object.migrationType === "number") { - message.migrationType = object.migrationType; - break; - } - break; - case "MIGRATION_TYPE_UNSPECIFIED": - case 0: - message.migrationType = 0; - break; - case "LOGICAL": - case 1: - message.migrationType = 1; - break; - case "PHYSICAL": - case 2: - message.migrationType = 2; - break; - } - if (object.replicaOverwriteEnabled != null) - message.replicaOverwriteEnabled = Boolean(object.replicaOverwriteEnabled); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesStartExternalSyncRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesStartExternalSyncRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.syncMode = options.enums === String ? "EXTERNAL_SYNC_MODE_UNSPECIFIED" : 0; - object.skipVerification = false; - object.syncParallelLevel = options.enums === String ? "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" : 0; - object.migrationType = options.enums === String ? "MIGRATION_TYPE_UNSPECIFIED" : 0; - object.replicaOverwriteEnabled = false; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.syncMode != null && message.hasOwnProperty("syncMode")) - object.syncMode = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] === undefined ? message.syncMode : $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] : message.syncMode; - if (message.skipVerification != null && message.hasOwnProperty("skipVerification")) - object.skipVerification = message.skipVerification; - if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { - object.mysqlSyncConfig = $root.google.cloud.sql.v1.MySqlSyncConfig.toObject(message.mysqlSyncConfig, options); - if (options.oneofs) - object.syncConfig = "mysqlSyncConfig"; - } - if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) - object.syncParallelLevel = options.enums === String ? $root.google.cloud.sql.v1.ExternalSyncParallelLevel[message.syncParallelLevel] === undefined ? message.syncParallelLevel : $root.google.cloud.sql.v1.ExternalSyncParallelLevel[message.syncParallelLevel] : message.syncParallelLevel; - if (message.migrationType != null && message.hasOwnProperty("migrationType")) - object.migrationType = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] === undefined ? message.migrationType : $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] : message.migrationType; - if (message.replicaOverwriteEnabled != null && message.hasOwnProperty("replicaOverwriteEnabled")) - object.replicaOverwriteEnabled = message.replicaOverwriteEnabled; - return object; - }; - - /** - * Converts this SqlInstancesStartExternalSyncRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesStartExternalSyncRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesStartExternalSyncRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesStartExternalSyncRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest"; - }; - - return SqlInstancesStartExternalSyncRequest; - })(); - - v1.SqlInstancesResetReplicaSizeRequest = (function() { - - /** - * Properties of a SqlInstancesResetReplicaSizeRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesResetReplicaSizeRequest - * @property {string|null} [instance] SqlInstancesResetReplicaSizeRequest instance - * @property {string|null} [project] SqlInstancesResetReplicaSizeRequest project - */ - - /** - * Constructs a new SqlInstancesResetReplicaSizeRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesResetReplicaSizeRequest. - * @implements ISqlInstancesResetReplicaSizeRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest=} [properties] Properties to set - */ - function SqlInstancesResetReplicaSizeRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesResetReplicaSizeRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @instance - */ - SqlInstancesResetReplicaSizeRequest.prototype.instance = ""; - - /** - * SqlInstancesResetReplicaSizeRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @instance - */ - SqlInstancesResetReplicaSizeRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesResetReplicaSizeRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest instance - */ - SqlInstancesResetReplicaSizeRequest.create = function create(properties) { - return new SqlInstancesResetReplicaSizeRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesResetReplicaSizeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesResetReplicaSizeRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesResetReplicaSizeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesResetReplicaSizeRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesResetReplicaSizeRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesResetReplicaSizeRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesResetReplicaSizeRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesResetReplicaSizeRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesResetReplicaSizeRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest - */ - SqlInstancesResetReplicaSizeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesResetReplicaSizeRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesResetReplicaSizeRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesResetReplicaSizeRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesResetReplicaSizeRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesResetReplicaSizeRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesResetReplicaSizeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest"; - }; - - return SqlInstancesResetReplicaSizeRequest; - })(); - - v1.SqlInstancesCreateEphemeralCertRequest = (function() { - - /** - * Properties of a SqlInstancesCreateEphemeralCertRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesCreateEphemeralCertRequest - * @property {string|null} [instance] SqlInstancesCreateEphemeralCertRequest instance - * @property {string|null} [project] SqlInstancesCreateEphemeralCertRequest project - * @property {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest|null} [body] SqlInstancesCreateEphemeralCertRequest body - */ - - /** - * Constructs a new SqlInstancesCreateEphemeralCertRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesCreateEphemeralCertRequest. - * @implements ISqlInstancesCreateEphemeralCertRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest=} [properties] Properties to set - */ - function SqlInstancesCreateEphemeralCertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesCreateEphemeralCertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @instance - */ - SqlInstancesCreateEphemeralCertRequest.prototype.instance = ""; - - /** - * SqlInstancesCreateEphemeralCertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @instance - */ - SqlInstancesCreateEphemeralCertRequest.prototype.project = ""; - - /** - * SqlInstancesCreateEphemeralCertRequest body. - * @member {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @instance - */ - SqlInstancesCreateEphemeralCertRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesCreateEphemeralCertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest instance - */ - SqlInstancesCreateEphemeralCertRequest.create = function create(properties) { - return new SqlInstancesCreateEphemeralCertRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesCreateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesCreateEphemeralCertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesCreateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesCreateEphemeralCertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesCreateEphemeralCertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesCreateEphemeralCertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesCreateEphemeralCertRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesCreateEphemeralCertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesCreateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest - */ - SqlInstancesCreateEphemeralCertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesCreateEphemeralCertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesCreateEphemeralCertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesCreateEphemeralCertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesCreateEphemeralCertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesCreateEphemeralCertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesCreateEphemeralCertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest"; - }; - - return SqlInstancesCreateEphemeralCertRequest; - })(); - - v1.InstancesCloneRequest = (function() { - - /** - * Properties of an InstancesCloneRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesCloneRequest - * @property {google.cloud.sql.v1.ICloneContext|null} [cloneContext] InstancesCloneRequest cloneContext - */ - - /** - * Constructs a new InstancesCloneRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesCloneRequest. - * @implements IInstancesCloneRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesCloneRequest=} [properties] Properties to set - */ - function InstancesCloneRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesCloneRequest cloneContext. - * @member {google.cloud.sql.v1.ICloneContext|null|undefined} cloneContext - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @instance - */ - InstancesCloneRequest.prototype.cloneContext = null; - - /** - * Creates a new InstancesCloneRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @static - * @param {google.cloud.sql.v1.IInstancesCloneRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesCloneRequest} InstancesCloneRequest instance - */ - InstancesCloneRequest.create = function create(properties) { - return new InstancesCloneRequest(properties); - }; - - /** - * Encodes the specified InstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesCloneRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @static - * @param {google.cloud.sql.v1.IInstancesCloneRequest} message InstancesCloneRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesCloneRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.cloneContext != null && Object.hasOwnProperty.call(message, "cloneContext")) - $root.google.cloud.sql.v1.CloneContext.encode(message.cloneContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesCloneRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @static - * @param {google.cloud.sql.v1.IInstancesCloneRequest} message InstancesCloneRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesCloneRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesCloneRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesCloneRequest} InstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesCloneRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesCloneRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.cloneContext = $root.google.cloud.sql.v1.CloneContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesCloneRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesCloneRequest} InstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesCloneRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesCloneRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesCloneRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.cloneContext != null && message.hasOwnProperty("cloneContext")) { - var error = $root.google.cloud.sql.v1.CloneContext.verify(message.cloneContext); - if (error) - return "cloneContext." + error; - } - return null; - }; - - /** - * Creates an InstancesCloneRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesCloneRequest} InstancesCloneRequest - */ - InstancesCloneRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesCloneRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesCloneRequest(); - if (object.cloneContext != null) { - if (typeof object.cloneContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesCloneRequest.cloneContext: object expected"); - message.cloneContext = $root.google.cloud.sql.v1.CloneContext.fromObject(object.cloneContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesCloneRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @static - * @param {google.cloud.sql.v1.InstancesCloneRequest} message InstancesCloneRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesCloneRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.cloneContext = null; - if (message.cloneContext != null && message.hasOwnProperty("cloneContext")) - object.cloneContext = $root.google.cloud.sql.v1.CloneContext.toObject(message.cloneContext, options); - return object; - }; - - /** - * Converts this InstancesCloneRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesCloneRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesCloneRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesCloneRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesCloneRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesCloneRequest"; - }; - - return InstancesCloneRequest; - })(); - - v1.InstancesDemoteMasterRequest = (function() { - - /** - * Properties of an InstancesDemoteMasterRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesDemoteMasterRequest - * @property {google.cloud.sql.v1.IDemoteMasterContext|null} [demoteMasterContext] InstancesDemoteMasterRequest demoteMasterContext - */ - - /** - * Constructs a new InstancesDemoteMasterRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesDemoteMasterRequest. - * @implements IInstancesDemoteMasterRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesDemoteMasterRequest=} [properties] Properties to set - */ - function InstancesDemoteMasterRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesDemoteMasterRequest demoteMasterContext. - * @member {google.cloud.sql.v1.IDemoteMasterContext|null|undefined} demoteMasterContext - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @instance - */ - InstancesDemoteMasterRequest.prototype.demoteMasterContext = null; - - /** - * Creates a new InstancesDemoteMasterRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1.IInstancesDemoteMasterRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest instance - */ - InstancesDemoteMasterRequest.create = function create(properties) { - return new InstancesDemoteMasterRequest(properties); - }; - - /** - * Encodes the specified InstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteMasterRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1.IInstancesDemoteMasterRequest} message InstancesDemoteMasterRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesDemoteMasterRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.demoteMasterContext != null && Object.hasOwnProperty.call(message, "demoteMasterContext")) - $root.google.cloud.sql.v1.DemoteMasterContext.encode(message.demoteMasterContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteMasterRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1.IInstancesDemoteMasterRequest} message InstancesDemoteMasterRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesDemoteMasterRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesDemoteMasterRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesDemoteMasterRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.demoteMasterContext = $root.google.cloud.sql.v1.DemoteMasterContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesDemoteMasterRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesDemoteMasterRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesDemoteMasterRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.demoteMasterContext != null && message.hasOwnProperty("demoteMasterContext")) { - var error = $root.google.cloud.sql.v1.DemoteMasterContext.verify(message.demoteMasterContext); - if (error) - return "demoteMasterContext." + error; - } - return null; - }; - - /** - * Creates an InstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest - */ - InstancesDemoteMasterRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesDemoteMasterRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesDemoteMasterRequest(); - if (object.demoteMasterContext != null) { - if (typeof object.demoteMasterContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesDemoteMasterRequest.demoteMasterContext: object expected"); - message.demoteMasterContext = $root.google.cloud.sql.v1.DemoteMasterContext.fromObject(object.demoteMasterContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesDemoteMasterRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1.InstancesDemoteMasterRequest} message InstancesDemoteMasterRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesDemoteMasterRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.demoteMasterContext = null; - if (message.demoteMasterContext != null && message.hasOwnProperty("demoteMasterContext")) - object.demoteMasterContext = $root.google.cloud.sql.v1.DemoteMasterContext.toObject(message.demoteMasterContext, options); - return object; - }; - - /** - * Converts this InstancesDemoteMasterRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesDemoteMasterRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesDemoteMasterRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesDemoteMasterRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesDemoteMasterRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesDemoteMasterRequest"; - }; - - return InstancesDemoteMasterRequest; - })(); - - v1.InstancesDemoteRequest = (function() { - - /** - * Properties of an InstancesDemoteRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesDemoteRequest - * @property {google.cloud.sql.v1.IDemoteContext|null} [demoteContext] InstancesDemoteRequest demoteContext - */ - - /** - * Constructs a new InstancesDemoteRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesDemoteRequest. - * @implements IInstancesDemoteRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesDemoteRequest=} [properties] Properties to set - */ - function InstancesDemoteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesDemoteRequest demoteContext. - * @member {google.cloud.sql.v1.IDemoteContext|null|undefined} demoteContext - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @instance - */ - InstancesDemoteRequest.prototype.demoteContext = null; - - /** - * Creates a new InstancesDemoteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1.IInstancesDemoteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesDemoteRequest} InstancesDemoteRequest instance - */ - InstancesDemoteRequest.create = function create(properties) { - return new InstancesDemoteRequest(properties); - }; - - /** - * Encodes the specified InstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1.IInstancesDemoteRequest} message InstancesDemoteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesDemoteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.demoteContext != null && Object.hasOwnProperty.call(message, "demoteContext")) - $root.google.cloud.sql.v1.DemoteContext.encode(message.demoteContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesDemoteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1.IInstancesDemoteRequest} message InstancesDemoteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesDemoteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesDemoteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesDemoteRequest} InstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesDemoteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesDemoteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.demoteContext = $root.google.cloud.sql.v1.DemoteContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesDemoteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesDemoteRequest} InstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesDemoteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesDemoteRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesDemoteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.demoteContext != null && message.hasOwnProperty("demoteContext")) { - var error = $root.google.cloud.sql.v1.DemoteContext.verify(message.demoteContext); - if (error) - return "demoteContext." + error; - } - return null; - }; - - /** - * Creates an InstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesDemoteRequest} InstancesDemoteRequest - */ - InstancesDemoteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesDemoteRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesDemoteRequest(); - if (object.demoteContext != null) { - if (typeof object.demoteContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesDemoteRequest.demoteContext: object expected"); - message.demoteContext = $root.google.cloud.sql.v1.DemoteContext.fromObject(object.demoteContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesDemoteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1.InstancesDemoteRequest} message InstancesDemoteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesDemoteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.demoteContext = null; - if (message.demoteContext != null && message.hasOwnProperty("demoteContext")) - object.demoteContext = $root.google.cloud.sql.v1.DemoteContext.toObject(message.demoteContext, options); - return object; - }; - - /** - * Converts this InstancesDemoteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesDemoteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesDemoteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesDemoteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesDemoteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesDemoteRequest"; - }; - - return InstancesDemoteRequest; - })(); - - v1.InstancesExportRequest = (function() { - - /** - * Properties of an InstancesExportRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesExportRequest - * @property {google.cloud.sql.v1.IExportContext|null} [exportContext] InstancesExportRequest exportContext - */ - - /** - * Constructs a new InstancesExportRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesExportRequest. - * @implements IInstancesExportRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesExportRequest=} [properties] Properties to set - */ - function InstancesExportRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesExportRequest exportContext. - * @member {google.cloud.sql.v1.IExportContext|null|undefined} exportContext - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @instance - */ - InstancesExportRequest.prototype.exportContext = null; - - /** - * Creates a new InstancesExportRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @static - * @param {google.cloud.sql.v1.IInstancesExportRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesExportRequest} InstancesExportRequest instance - */ - InstancesExportRequest.create = function create(properties) { - return new InstancesExportRequest(properties); - }; - - /** - * Encodes the specified InstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesExportRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @static - * @param {google.cloud.sql.v1.IInstancesExportRequest} message InstancesExportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesExportRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.exportContext != null && Object.hasOwnProperty.call(message, "exportContext")) - $root.google.cloud.sql.v1.ExportContext.encode(message.exportContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesExportRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @static - * @param {google.cloud.sql.v1.IInstancesExportRequest} message InstancesExportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesExportRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesExportRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesExportRequest} InstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesExportRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesExportRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.exportContext = $root.google.cloud.sql.v1.ExportContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesExportRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesExportRequest} InstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesExportRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesExportRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesExportRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.exportContext != null && message.hasOwnProperty("exportContext")) { - var error = $root.google.cloud.sql.v1.ExportContext.verify(message.exportContext); - if (error) - return "exportContext." + error; - } - return null; - }; - - /** - * Creates an InstancesExportRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesExportRequest} InstancesExportRequest - */ - InstancesExportRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesExportRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesExportRequest(); - if (object.exportContext != null) { - if (typeof object.exportContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesExportRequest.exportContext: object expected"); - message.exportContext = $root.google.cloud.sql.v1.ExportContext.fromObject(object.exportContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesExportRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @static - * @param {google.cloud.sql.v1.InstancesExportRequest} message InstancesExportRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesExportRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.exportContext = null; - if (message.exportContext != null && message.hasOwnProperty("exportContext")) - object.exportContext = $root.google.cloud.sql.v1.ExportContext.toObject(message.exportContext, options); - return object; - }; - - /** - * Converts this InstancesExportRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesExportRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesExportRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesExportRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesExportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesExportRequest"; - }; - - return InstancesExportRequest; - })(); - - v1.InstancesFailoverRequest = (function() { - - /** - * Properties of an InstancesFailoverRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesFailoverRequest - * @property {google.cloud.sql.v1.IFailoverContext|null} [failoverContext] InstancesFailoverRequest failoverContext - */ - - /** - * Constructs a new InstancesFailoverRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesFailoverRequest. - * @implements IInstancesFailoverRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesFailoverRequest=} [properties] Properties to set - */ - function InstancesFailoverRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesFailoverRequest failoverContext. - * @member {google.cloud.sql.v1.IFailoverContext|null|undefined} failoverContext - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @instance - */ - InstancesFailoverRequest.prototype.failoverContext = null; - - /** - * Creates a new InstancesFailoverRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1.IInstancesFailoverRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesFailoverRequest} InstancesFailoverRequest instance - */ - InstancesFailoverRequest.create = function create(properties) { - return new InstancesFailoverRequest(properties); - }; - - /** - * Encodes the specified InstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesFailoverRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1.IInstancesFailoverRequest} message InstancesFailoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesFailoverRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.failoverContext != null && Object.hasOwnProperty.call(message, "failoverContext")) - $root.google.cloud.sql.v1.FailoverContext.encode(message.failoverContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesFailoverRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1.IInstancesFailoverRequest} message InstancesFailoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesFailoverRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesFailoverRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesFailoverRequest} InstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesFailoverRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesFailoverRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.failoverContext = $root.google.cloud.sql.v1.FailoverContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesFailoverRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesFailoverRequest} InstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesFailoverRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesFailoverRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesFailoverRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.failoverContext != null && message.hasOwnProperty("failoverContext")) { - var error = $root.google.cloud.sql.v1.FailoverContext.verify(message.failoverContext); - if (error) - return "failoverContext." + error; - } - return null; - }; - - /** - * Creates an InstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesFailoverRequest} InstancesFailoverRequest - */ - InstancesFailoverRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesFailoverRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesFailoverRequest(); - if (object.failoverContext != null) { - if (typeof object.failoverContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesFailoverRequest.failoverContext: object expected"); - message.failoverContext = $root.google.cloud.sql.v1.FailoverContext.fromObject(object.failoverContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesFailoverRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1.InstancesFailoverRequest} message InstancesFailoverRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesFailoverRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.failoverContext = null; - if (message.failoverContext != null && message.hasOwnProperty("failoverContext")) - object.failoverContext = $root.google.cloud.sql.v1.FailoverContext.toObject(message.failoverContext, options); - return object; - }; - - /** - * Converts this InstancesFailoverRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesFailoverRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesFailoverRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesFailoverRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesFailoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesFailoverRequest"; - }; - - return InstancesFailoverRequest; - })(); - - v1.SslCertsCreateEphemeralRequest = (function() { - - /** - * Properties of a SslCertsCreateEphemeralRequest. - * @memberof google.cloud.sql.v1 - * @interface ISslCertsCreateEphemeralRequest - * @property {string|null} [publicKey] SslCertsCreateEphemeralRequest publicKey - * @property {string|null} [accessToken] SslCertsCreateEphemeralRequest accessToken - */ - - /** - * Constructs a new SslCertsCreateEphemeralRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SslCertsCreateEphemeralRequest. - * @implements ISslCertsCreateEphemeralRequest - * @constructor - * @param {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest=} [properties] Properties to set - */ - function SslCertsCreateEphemeralRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCertsCreateEphemeralRequest publicKey. - * @member {string} publicKey - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @instance - */ - SslCertsCreateEphemeralRequest.prototype.publicKey = ""; - - /** - * SslCertsCreateEphemeralRequest accessToken. - * @member {string} accessToken - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @instance - */ - SslCertsCreateEphemeralRequest.prototype.accessToken = ""; - - /** - * Creates a new SslCertsCreateEphemeralRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @static - * @param {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest instance - */ - SslCertsCreateEphemeralRequest.create = function create(properties) { - return new SslCertsCreateEphemeralRequest(properties); - }; - - /** - * Encodes the specified SslCertsCreateEphemeralRequest message. Does not implicitly {@link google.cloud.sql.v1.SslCertsCreateEphemeralRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @static - * @param {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsCreateEphemeralRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.publicKey); - if (message.accessToken != null && Object.hasOwnProperty.call(message, "accessToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.accessToken); - return writer; - }; - - /** - * Encodes the specified SslCertsCreateEphemeralRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsCreateEphemeralRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @static - * @param {google.cloud.sql.v1.ISslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsCreateEphemeralRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsCreateEphemeralRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.publicKey = reader.string(); - break; - } - case 2: { - message.accessToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsCreateEphemeralRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCertsCreateEphemeralRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCertsCreateEphemeralRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.publicKey != null && message.hasOwnProperty("publicKey")) - if (!$util.isString(message.publicKey)) - return "publicKey: string expected"; - if (message.accessToken != null && message.hasOwnProperty("accessToken")) - if (!$util.isString(message.accessToken)) - return "accessToken: string expected"; - return null; - }; - - /** - * Creates a SslCertsCreateEphemeralRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest - */ - SslCertsCreateEphemeralRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest) - return object; - var message = new $root.google.cloud.sql.v1.SslCertsCreateEphemeralRequest(); - if (object.publicKey != null) - message.publicKey = String(object.publicKey); - if (object.accessToken != null) - message.accessToken = String(object.accessToken); - return message; - }; - - /** - * Creates a plain object from a SslCertsCreateEphemeralRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @static - * @param {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCertsCreateEphemeralRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.publicKey = ""; - object.accessToken = ""; - } - if (message.publicKey != null && message.hasOwnProperty("publicKey")) - object.publicKey = message.publicKey; - if (message.accessToken != null && message.hasOwnProperty("accessToken")) - object.accessToken = message.accessToken; - return object; - }; - - /** - * Converts this SslCertsCreateEphemeralRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @instance - * @returns {Object.} JSON object - */ - SslCertsCreateEphemeralRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCertsCreateEphemeralRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SslCertsCreateEphemeralRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCertsCreateEphemeralRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SslCertsCreateEphemeralRequest"; - }; - - return SslCertsCreateEphemeralRequest; - })(); - - v1.InstancesImportRequest = (function() { - - /** - * Properties of an InstancesImportRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesImportRequest - * @property {google.cloud.sql.v1.IImportContext|null} [importContext] InstancesImportRequest importContext - */ - - /** - * Constructs a new InstancesImportRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesImportRequest. - * @implements IInstancesImportRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesImportRequest=} [properties] Properties to set - */ - function InstancesImportRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesImportRequest importContext. - * @member {google.cloud.sql.v1.IImportContext|null|undefined} importContext - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @instance - */ - InstancesImportRequest.prototype.importContext = null; - - /** - * Creates a new InstancesImportRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @static - * @param {google.cloud.sql.v1.IInstancesImportRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesImportRequest} InstancesImportRequest instance - */ - InstancesImportRequest.create = function create(properties) { - return new InstancesImportRequest(properties); - }; - - /** - * Encodes the specified InstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesImportRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @static - * @param {google.cloud.sql.v1.IInstancesImportRequest} message InstancesImportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesImportRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.importContext != null && Object.hasOwnProperty.call(message, "importContext")) - $root.google.cloud.sql.v1.ImportContext.encode(message.importContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesImportRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @static - * @param {google.cloud.sql.v1.IInstancesImportRequest} message InstancesImportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesImportRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesImportRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesImportRequest} InstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesImportRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesImportRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.importContext = $root.google.cloud.sql.v1.ImportContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesImportRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesImportRequest} InstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesImportRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesImportRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesImportRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.importContext != null && message.hasOwnProperty("importContext")) { - var error = $root.google.cloud.sql.v1.ImportContext.verify(message.importContext); - if (error) - return "importContext." + error; - } - return null; - }; - - /** - * Creates an InstancesImportRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesImportRequest} InstancesImportRequest - */ - InstancesImportRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesImportRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesImportRequest(); - if (object.importContext != null) { - if (typeof object.importContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesImportRequest.importContext: object expected"); - message.importContext = $root.google.cloud.sql.v1.ImportContext.fromObject(object.importContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesImportRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @static - * @param {google.cloud.sql.v1.InstancesImportRequest} message InstancesImportRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesImportRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.importContext = null; - if (message.importContext != null && message.hasOwnProperty("importContext")) - object.importContext = $root.google.cloud.sql.v1.ImportContext.toObject(message.importContext, options); - return object; - }; - - /** - * Converts this InstancesImportRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesImportRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesImportRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesImportRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesImportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesImportRequest"; - }; - - return InstancesImportRequest; - })(); - - v1.InstancesPreCheckMajorVersionUpgradeRequest = (function() { - - /** - * Properties of an InstancesPreCheckMajorVersionUpgradeRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesPreCheckMajorVersionUpgradeRequest - * @property {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null} [preCheckMajorVersionUpgradeContext] InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext - */ - - /** - * Constructs a new InstancesPreCheckMajorVersionUpgradeRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesPreCheckMajorVersionUpgradeRequest. - * @implements IInstancesPreCheckMajorVersionUpgradeRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set - */ - function InstancesPreCheckMajorVersionUpgradeRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext. - * @member {google.cloud.sql.v1.IPreCheckMajorVersionUpgradeContext|null|undefined} preCheckMajorVersionUpgradeContext - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @instance - */ - InstancesPreCheckMajorVersionUpgradeRequest.prototype.preCheckMajorVersionUpgradeContext = null; - - /** - * Creates a new InstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest instance - */ - InstancesPreCheckMajorVersionUpgradeRequest.create = function create(properties) { - return new InstancesPreCheckMajorVersionUpgradeRequest(properties); - }; - - /** - * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesPreCheckMajorVersionUpgradeRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.preCheckMajorVersionUpgradeContext != null && Object.hasOwnProperty.call(message, "preCheckMajorVersionUpgradeContext")) - $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.encode(message.preCheckMajorVersionUpgradeContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesPreCheckMajorVersionUpgradeRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesPreCheckMajorVersionUpgradeRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesPreCheckMajorVersionUpgradeRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesPreCheckMajorVersionUpgradeRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesPreCheckMajorVersionUpgradeRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) { - var error = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.verify(message.preCheckMajorVersionUpgradeContext); - if (error) - return "preCheckMajorVersionUpgradeContext." + error; - } - return null; - }; - - /** - * Creates an InstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest - */ - InstancesPreCheckMajorVersionUpgradeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest(); - if (object.preCheckMajorVersionUpgradeContext != null) { - if (typeof object.preCheckMajorVersionUpgradeContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.preCheckMajorVersionUpgradeContext: object expected"); - message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.fromObject(object.preCheckMajorVersionUpgradeContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesPreCheckMajorVersionUpgradeRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.preCheckMajorVersionUpgradeContext = null; - if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) - object.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1.PreCheckMajorVersionUpgradeContext.toObject(message.preCheckMajorVersionUpgradeContext, options); - return object; - }; - - /** - * Converts this InstancesPreCheckMajorVersionUpgradeRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesPreCheckMajorVersionUpgradeRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesPreCheckMajorVersionUpgradeRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesPreCheckMajorVersionUpgradeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest"; - }; - - return InstancesPreCheckMajorVersionUpgradeRequest; - })(); - - v1.InstancesListResponse = (function() { - - /** - * Properties of an InstancesListResponse. - * @memberof google.cloud.sql.v1 - * @interface IInstancesListResponse - * @property {string|null} [kind] InstancesListResponse kind - * @property {Array.|null} [warnings] InstancesListResponse warnings - * @property {Array.|null} [items] InstancesListResponse items - * @property {string|null} [nextPageToken] InstancesListResponse nextPageToken - */ - - /** - * Constructs a new InstancesListResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesListResponse. - * @implements IInstancesListResponse - * @constructor - * @param {google.cloud.sql.v1.IInstancesListResponse=} [properties] Properties to set - */ - function InstancesListResponse(properties) { - this.warnings = []; - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.InstancesListResponse - * @instance - */ - InstancesListResponse.prototype.kind = ""; - - /** - * InstancesListResponse warnings. - * @member {Array.} warnings - * @memberof google.cloud.sql.v1.InstancesListResponse - * @instance - */ - InstancesListResponse.prototype.warnings = $util.emptyArray; - - /** - * InstancesListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1.InstancesListResponse - * @instance - */ - InstancesListResponse.prototype.items = $util.emptyArray; - - /** - * InstancesListResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.sql.v1.InstancesListResponse - * @instance - */ - InstancesListResponse.prototype.nextPageToken = ""; - - /** - * Creates a new InstancesListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesListResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesListResponse} InstancesListResponse instance - */ - InstancesListResponse.create = function create(properties) { - return new InstancesListResponse(properties); - }; - - /** - * Encodes the specified InstancesListResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesListResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListResponse} message InstancesListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.warnings != null && message.warnings.length) - for (var i = 0; i < message.warnings.length; ++i) - $root.google.cloud.sql.v1.ApiWarning.encode(message.warnings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1.DatabaseInstance.encode(message.items[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified InstancesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesListResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListResponse} message InstancesListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesListResponse} InstancesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.warnings && message.warnings.length)) - message.warnings = []; - message.warnings.push($root.google.cloud.sql.v1.ApiWarning.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32())); - break; - } - case 4: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesListResponse} InstancesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesListResponse message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.warnings != null && message.hasOwnProperty("warnings")) { - if (!Array.isArray(message.warnings)) - return "warnings: array expected"; - for (var i = 0; i < message.warnings.length; ++i) { - var error = $root.google.cloud.sql.v1.ApiWarning.verify(message.warnings[i]); - if (error) - return "warnings." + error; - } - } - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.items[i]); - if (error) - return "items." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates an InstancesListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesListResponse} InstancesListResponse - */ - InstancesListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesListResponse) - return object; - var message = new $root.google.cloud.sql.v1.InstancesListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.warnings) { - if (!Array.isArray(object.warnings)) - throw TypeError(".google.cloud.sql.v1.InstancesListResponse.warnings: array expected"); - message.warnings = []; - for (var i = 0; i < object.warnings.length; ++i) { - if (typeof object.warnings[i] !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesListResponse.warnings: object expected"); - message.warnings[i] = $root.google.cloud.sql.v1.ApiWarning.fromObject(object.warnings[i]); - } - } - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1.InstancesListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.items[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from an InstancesListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesListResponse - * @static - * @param {google.cloud.sql.v1.InstancesListResponse} message InstancesListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.warnings = []; - object.items = []; - } - if (options.defaults) { - object.kind = ""; - object.nextPageToken = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.warnings && message.warnings.length) { - object.warnings = []; - for (var j = 0; j < message.warnings.length; ++j) - object.warnings[j] = $root.google.cloud.sql.v1.ApiWarning.toObject(message.warnings[j], options); - } - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.items[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this InstancesListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesListResponse - * @instance - * @returns {Object.} JSON object - */ - InstancesListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesListResponse"; - }; - - return InstancesListResponse; - })(); - - v1.InstancesListServerCasResponse = (function() { - - /** - * Properties of an InstancesListServerCasResponse. - * @memberof google.cloud.sql.v1 - * @interface IInstancesListServerCasResponse - * @property {Array.|null} [certs] InstancesListServerCasResponse certs - * @property {string|null} [activeVersion] InstancesListServerCasResponse activeVersion - * @property {string|null} [kind] InstancesListServerCasResponse kind - */ - - /** - * Constructs a new InstancesListServerCasResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesListServerCasResponse. - * @implements IInstancesListServerCasResponse - * @constructor - * @param {google.cloud.sql.v1.IInstancesListServerCasResponse=} [properties] Properties to set - */ - function InstancesListServerCasResponse(properties) { - this.certs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesListServerCasResponse certs. - * @member {Array.} certs - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @instance - */ - InstancesListServerCasResponse.prototype.certs = $util.emptyArray; - - /** - * InstancesListServerCasResponse activeVersion. - * @member {string} activeVersion - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @instance - */ - InstancesListServerCasResponse.prototype.activeVersion = ""; - - /** - * InstancesListServerCasResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @instance - */ - InstancesListServerCasResponse.prototype.kind = ""; - - /** - * Creates a new InstancesListServerCasResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListServerCasResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesListServerCasResponse} InstancesListServerCasResponse instance - */ - InstancesListServerCasResponse.create = function create(properties) { - return new InstancesListServerCasResponse(properties); - }; - - /** - * Encodes the specified InstancesListServerCasResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCasResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListServerCasResponse} message InstancesListServerCasResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListServerCasResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certs != null && message.certs.length) - for (var i = 0; i < message.certs.length; ++i) - $root.google.cloud.sql.v1.SslCert.encode(message.certs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.activeVersion); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - return writer; - }; - - /** - * Encodes the specified InstancesListServerCasResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCasResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListServerCasResponse} message InstancesListServerCasResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListServerCasResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesListServerCasResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesListServerCasResponse} InstancesListServerCasResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListServerCasResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesListServerCasResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.certs && message.certs.length)) - message.certs = []; - message.certs.push($root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32())); - break; - } - case 2: { - message.activeVersion = reader.string(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesListServerCasResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesListServerCasResponse} InstancesListServerCasResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListServerCasResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesListServerCasResponse message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesListServerCasResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certs != null && message.hasOwnProperty("certs")) { - if (!Array.isArray(message.certs)) - return "certs: array expected"; - for (var i = 0; i < message.certs.length; ++i) { - var error = $root.google.cloud.sql.v1.SslCert.verify(message.certs[i]); - if (error) - return "certs." + error; - } - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - if (!$util.isString(message.activeVersion)) - return "activeVersion: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates an InstancesListServerCasResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesListServerCasResponse} InstancesListServerCasResponse - */ - InstancesListServerCasResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesListServerCasResponse) - return object; - var message = new $root.google.cloud.sql.v1.InstancesListServerCasResponse(); - if (object.certs) { - if (!Array.isArray(object.certs)) - throw TypeError(".google.cloud.sql.v1.InstancesListServerCasResponse.certs: array expected"); - message.certs = []; - for (var i = 0; i < object.certs.length; ++i) { - if (typeof object.certs[i] !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesListServerCasResponse.certs: object expected"); - message.certs[i] = $root.google.cloud.sql.v1.SslCert.fromObject(object.certs[i]); - } - } - if (object.activeVersion != null) - message.activeVersion = String(object.activeVersion); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from an InstancesListServerCasResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @static - * @param {google.cloud.sql.v1.InstancesListServerCasResponse} message InstancesListServerCasResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesListServerCasResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.certs = []; - if (options.defaults) { - object.activeVersion = ""; - object.kind = ""; - } - if (message.certs && message.certs.length) { - object.certs = []; - for (var j = 0; j < message.certs.length; ++j) - object.certs[j] = $root.google.cloud.sql.v1.SslCert.toObject(message.certs[j], options); - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - object.activeVersion = message.activeVersion; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this InstancesListServerCasResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @instance - * @returns {Object.} JSON object - */ - InstancesListServerCasResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesListServerCasResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesListServerCasResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesListServerCasResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesListServerCasResponse"; - }; - - return InstancesListServerCasResponse; - })(); - - v1.InstancesListServerCertificatesResponse = (function() { - - /** - * Properties of an InstancesListServerCertificatesResponse. - * @memberof google.cloud.sql.v1 - * @interface IInstancesListServerCertificatesResponse - * @property {Array.|null} [caCerts] InstancesListServerCertificatesResponse caCerts - * @property {Array.|null} [serverCerts] InstancesListServerCertificatesResponse serverCerts - * @property {string|null} [activeVersion] InstancesListServerCertificatesResponse activeVersion - * @property {string|null} [kind] InstancesListServerCertificatesResponse kind - */ - - /** - * Constructs a new InstancesListServerCertificatesResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesListServerCertificatesResponse. - * @implements IInstancesListServerCertificatesResponse - * @constructor - * @param {google.cloud.sql.v1.IInstancesListServerCertificatesResponse=} [properties] Properties to set - */ - function InstancesListServerCertificatesResponse(properties) { - this.caCerts = []; - this.serverCerts = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesListServerCertificatesResponse caCerts. - * @member {Array.} caCerts - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @instance - */ - InstancesListServerCertificatesResponse.prototype.caCerts = $util.emptyArray; - - /** - * InstancesListServerCertificatesResponse serverCerts. - * @member {Array.} serverCerts - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @instance - */ - InstancesListServerCertificatesResponse.prototype.serverCerts = $util.emptyArray; - - /** - * InstancesListServerCertificatesResponse activeVersion. - * @member {string} activeVersion - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @instance - */ - InstancesListServerCertificatesResponse.prototype.activeVersion = ""; - - /** - * InstancesListServerCertificatesResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @instance - */ - InstancesListServerCertificatesResponse.prototype.kind = ""; - - /** - * Creates a new InstancesListServerCertificatesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListServerCertificatesResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse instance - */ - InstancesListServerCertificatesResponse.create = function create(properties) { - return new InstancesListServerCertificatesResponse(properties); - }; - - /** - * Encodes the specified InstancesListServerCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCertificatesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListServerCertificatesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.caCerts != null && message.caCerts.length) - for (var i = 0; i < message.caCerts.length; ++i) - $root.google.cloud.sql.v1.SslCert.encode(message.caCerts[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.serverCerts != null && message.serverCerts.length) - for (var i = 0; i < message.serverCerts.length; ++i) - $root.google.cloud.sql.v1.SslCert.encode(message.serverCerts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.activeVersion); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); - return writer; - }; - - /** - * Encodes the specified InstancesListServerCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListServerCertificatesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListServerCertificatesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListServerCertificatesResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesListServerCertificatesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.caCerts && message.caCerts.length)) - message.caCerts = []; - message.caCerts.push($root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.serverCerts && message.serverCerts.length)) - message.serverCerts = []; - message.serverCerts.push($root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32())); - break; - } - case 3: { - message.activeVersion = reader.string(); - break; - } - case 4: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListServerCertificatesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesListServerCertificatesResponse message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesListServerCertificatesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.caCerts != null && message.hasOwnProperty("caCerts")) { - if (!Array.isArray(message.caCerts)) - return "caCerts: array expected"; - for (var i = 0; i < message.caCerts.length; ++i) { - var error = $root.google.cloud.sql.v1.SslCert.verify(message.caCerts[i]); - if (error) - return "caCerts." + error; - } - } - if (message.serverCerts != null && message.hasOwnProperty("serverCerts")) { - if (!Array.isArray(message.serverCerts)) - return "serverCerts: array expected"; - for (var i = 0; i < message.serverCerts.length; ++i) { - var error = $root.google.cloud.sql.v1.SslCert.verify(message.serverCerts[i]); - if (error) - return "serverCerts." + error; - } - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - if (!$util.isString(message.activeVersion)) - return "activeVersion: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates an InstancesListServerCertificatesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse - */ - InstancesListServerCertificatesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesListServerCertificatesResponse) - return object; - var message = new $root.google.cloud.sql.v1.InstancesListServerCertificatesResponse(); - if (object.caCerts) { - if (!Array.isArray(object.caCerts)) - throw TypeError(".google.cloud.sql.v1.InstancesListServerCertificatesResponse.caCerts: array expected"); - message.caCerts = []; - for (var i = 0; i < object.caCerts.length; ++i) { - if (typeof object.caCerts[i] !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesListServerCertificatesResponse.caCerts: object expected"); - message.caCerts[i] = $root.google.cloud.sql.v1.SslCert.fromObject(object.caCerts[i]); - } - } - if (object.serverCerts) { - if (!Array.isArray(object.serverCerts)) - throw TypeError(".google.cloud.sql.v1.InstancesListServerCertificatesResponse.serverCerts: array expected"); - message.serverCerts = []; - for (var i = 0; i < object.serverCerts.length; ++i) { - if (typeof object.serverCerts[i] !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesListServerCertificatesResponse.serverCerts: object expected"); - message.serverCerts[i] = $root.google.cloud.sql.v1.SslCert.fromObject(object.serverCerts[i]); - } - } - if (object.activeVersion != null) - message.activeVersion = String(object.activeVersion); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from an InstancesListServerCertificatesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @static - * @param {google.cloud.sql.v1.InstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesListServerCertificatesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.caCerts = []; - object.serverCerts = []; - } - if (options.defaults) { - object.activeVersion = ""; - object.kind = ""; - } - if (message.caCerts && message.caCerts.length) { - object.caCerts = []; - for (var j = 0; j < message.caCerts.length; ++j) - object.caCerts[j] = $root.google.cloud.sql.v1.SslCert.toObject(message.caCerts[j], options); - } - if (message.serverCerts && message.serverCerts.length) { - object.serverCerts = []; - for (var j = 0; j < message.serverCerts.length; ++j) - object.serverCerts[j] = $root.google.cloud.sql.v1.SslCert.toObject(message.serverCerts[j], options); - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - object.activeVersion = message.activeVersion; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this InstancesListServerCertificatesResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @instance - * @returns {Object.} JSON object - */ - InstancesListServerCertificatesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesListServerCertificatesResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesListServerCertificatesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesListServerCertificatesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesListServerCertificatesResponse"; - }; - - return InstancesListServerCertificatesResponse; - })(); - - v1.InstancesListEntraIdCertificatesResponse = (function() { - - /** - * Properties of an InstancesListEntraIdCertificatesResponse. - * @memberof google.cloud.sql.v1 - * @interface IInstancesListEntraIdCertificatesResponse - * @property {Array.|null} [certs] InstancesListEntraIdCertificatesResponse certs - * @property {string|null} [activeVersion] InstancesListEntraIdCertificatesResponse activeVersion - * @property {string|null} [kind] InstancesListEntraIdCertificatesResponse kind - */ - - /** - * Constructs a new InstancesListEntraIdCertificatesResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesListEntraIdCertificatesResponse. - * @implements IInstancesListEntraIdCertificatesResponse - * @constructor - * @param {google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse=} [properties] Properties to set - */ - function InstancesListEntraIdCertificatesResponse(properties) { - this.certs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesListEntraIdCertificatesResponse certs. - * @member {Array.} certs - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @instance - */ - InstancesListEntraIdCertificatesResponse.prototype.certs = $util.emptyArray; - - /** - * InstancesListEntraIdCertificatesResponse activeVersion. - * @member {string} activeVersion - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @instance - */ - InstancesListEntraIdCertificatesResponse.prototype.activeVersion = ""; - - /** - * InstancesListEntraIdCertificatesResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @instance - */ - InstancesListEntraIdCertificatesResponse.prototype.kind = ""; - - /** - * Creates a new InstancesListEntraIdCertificatesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse instance - */ - InstancesListEntraIdCertificatesResponse.create = function create(properties) { - return new InstancesListEntraIdCertificatesResponse(properties); - }; - - /** - * Encodes the specified InstancesListEntraIdCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListEntraIdCertificatesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certs != null && message.certs.length) - for (var i = 0; i < message.certs.length; ++i) - $root.google.cloud.sql.v1.SslCert.encode(message.certs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.activeVersion); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - return writer; - }; - - /** - * Encodes the specified InstancesListEntraIdCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @static - * @param {google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListEntraIdCertificatesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListEntraIdCertificatesResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.certs && message.certs.length)) - message.certs = []; - message.certs.push($root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32())); - break; - } - case 2: { - message.activeVersion = reader.string(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListEntraIdCertificatesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesListEntraIdCertificatesResponse message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesListEntraIdCertificatesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certs != null && message.hasOwnProperty("certs")) { - if (!Array.isArray(message.certs)) - return "certs: array expected"; - for (var i = 0; i < message.certs.length; ++i) { - var error = $root.google.cloud.sql.v1.SslCert.verify(message.certs[i]); - if (error) - return "certs." + error; - } - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - if (!$util.isString(message.activeVersion)) - return "activeVersion: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates an InstancesListEntraIdCertificatesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse - */ - InstancesListEntraIdCertificatesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse) - return object; - var message = new $root.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse(); - if (object.certs) { - if (!Array.isArray(object.certs)) - throw TypeError(".google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.certs: array expected"); - message.certs = []; - for (var i = 0; i < object.certs.length; ++i) { - if (typeof object.certs[i] !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse.certs: object expected"); - message.certs[i] = $root.google.cloud.sql.v1.SslCert.fromObject(object.certs[i]); - } - } - if (object.activeVersion != null) - message.activeVersion = String(object.activeVersion); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from an InstancesListEntraIdCertificatesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @static - * @param {google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesListEntraIdCertificatesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.certs = []; - if (options.defaults) { - object.activeVersion = ""; - object.kind = ""; - } - if (message.certs && message.certs.length) { - object.certs = []; - for (var j = 0; j < message.certs.length; ++j) - object.certs[j] = $root.google.cloud.sql.v1.SslCert.toObject(message.certs[j], options); - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - object.activeVersion = message.activeVersion; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this InstancesListEntraIdCertificatesResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @instance - * @returns {Object.} JSON object - */ - InstancesListEntraIdCertificatesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesListEntraIdCertificatesResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesListEntraIdCertificatesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse"; - }; - - return InstancesListEntraIdCertificatesResponse; - })(); - - v1.InstancesRestoreBackupRequest = (function() { - - /** - * Properties of an InstancesRestoreBackupRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesRestoreBackupRequest - * @property {google.cloud.sql.v1.IRestoreBackupContext|null} [restoreBackupContext] InstancesRestoreBackupRequest restoreBackupContext - * @property {string|null} [backup] InstancesRestoreBackupRequest backup - * @property {string|null} [backupdrBackup] InstancesRestoreBackupRequest backupdrBackup - * @property {google.cloud.sql.v1.IDatabaseInstance|null} [restoreInstanceSettings] InstancesRestoreBackupRequest restoreInstanceSettings - * @property {Array.|null} [restoreInstanceClearOverridesFieldNames] InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames - */ - - /** - * Constructs a new InstancesRestoreBackupRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesRestoreBackupRequest. - * @implements IInstancesRestoreBackupRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesRestoreBackupRequest=} [properties] Properties to set - */ - function InstancesRestoreBackupRequest(properties) { - this.restoreInstanceClearOverridesFieldNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesRestoreBackupRequest restoreBackupContext. - * @member {google.cloud.sql.v1.IRestoreBackupContext|null|undefined} restoreBackupContext - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @instance - */ - InstancesRestoreBackupRequest.prototype.restoreBackupContext = null; - - /** - * InstancesRestoreBackupRequest backup. - * @member {string} backup - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @instance - */ - InstancesRestoreBackupRequest.prototype.backup = ""; - - /** - * InstancesRestoreBackupRequest backupdrBackup. - * @member {string} backupdrBackup - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @instance - */ - InstancesRestoreBackupRequest.prototype.backupdrBackup = ""; - - /** - * InstancesRestoreBackupRequest restoreInstanceSettings. - * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} restoreInstanceSettings - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @instance - */ - InstancesRestoreBackupRequest.prototype.restoreInstanceSettings = null; - - /** - * InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames. - * @member {Array.} restoreInstanceClearOverridesFieldNames - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @instance - */ - InstancesRestoreBackupRequest.prototype.restoreInstanceClearOverridesFieldNames = $util.emptyArray; - - /** - * Creates a new InstancesRestoreBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRestoreBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest instance - */ - InstancesRestoreBackupRequest.create = function create(properties) { - return new InstancesRestoreBackupRequest(properties); - }; - - /** - * Encodes the specified InstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRestoreBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRestoreBackupRequest} message InstancesRestoreBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRestoreBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.restoreBackupContext != null && Object.hasOwnProperty.call(message, "restoreBackupContext")) - $root.google.cloud.sql.v1.RestoreBackupContext.encode(message.restoreBackupContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.backup); - if (message.restoreInstanceSettings != null && Object.hasOwnProperty.call(message, "restoreInstanceSettings")) - $root.google.cloud.sql.v1.DatabaseInstance.encode(message.restoreInstanceSettings, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.backupdrBackup != null && Object.hasOwnProperty.call(message, "backupdrBackup")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.backupdrBackup); - if (message.restoreInstanceClearOverridesFieldNames != null && message.restoreInstanceClearOverridesFieldNames.length) - for (var i = 0; i < message.restoreInstanceClearOverridesFieldNames.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.restoreInstanceClearOverridesFieldNames[i]); - return writer; - }; - - /** - * Encodes the specified InstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRestoreBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRestoreBackupRequest} message InstancesRestoreBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRestoreBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRestoreBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesRestoreBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.restoreBackupContext = $root.google.cloud.sql.v1.RestoreBackupContext.decode(reader, reader.uint32()); - break; - } - case 2: { - message.backup = reader.string(); - break; - } - case 4: { - message.backupdrBackup = reader.string(); - break; - } - case 3: { - message.restoreInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - case 5: { - if (!(message.restoreInstanceClearOverridesFieldNames && message.restoreInstanceClearOverridesFieldNames.length)) - message.restoreInstanceClearOverridesFieldNames = []; - message.restoreInstanceClearOverridesFieldNames.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRestoreBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesRestoreBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesRestoreBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.restoreBackupContext != null && message.hasOwnProperty("restoreBackupContext")) { - var error = $root.google.cloud.sql.v1.RestoreBackupContext.verify(message.restoreBackupContext); - if (error) - return "restoreBackupContext." + error; - } - if (message.backup != null && message.hasOwnProperty("backup")) - if (!$util.isString(message.backup)) - return "backup: string expected"; - if (message.backupdrBackup != null && message.hasOwnProperty("backupdrBackup")) - if (!$util.isString(message.backupdrBackup)) - return "backupdrBackup: string expected"; - if (message.restoreInstanceSettings != null && message.hasOwnProperty("restoreInstanceSettings")) { - var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.restoreInstanceSettings); - if (error) - return "restoreInstanceSettings." + error; - } - if (message.restoreInstanceClearOverridesFieldNames != null && message.hasOwnProperty("restoreInstanceClearOverridesFieldNames")) { - if (!Array.isArray(message.restoreInstanceClearOverridesFieldNames)) - return "restoreInstanceClearOverridesFieldNames: array expected"; - for (var i = 0; i < message.restoreInstanceClearOverridesFieldNames.length; ++i) - if (!$util.isString(message.restoreInstanceClearOverridesFieldNames[i])) - return "restoreInstanceClearOverridesFieldNames: string[] expected"; - } - return null; - }; - - /** - * Creates an InstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest - */ - InstancesRestoreBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesRestoreBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesRestoreBackupRequest(); - if (object.restoreBackupContext != null) { - if (typeof object.restoreBackupContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesRestoreBackupRequest.restoreBackupContext: object expected"); - message.restoreBackupContext = $root.google.cloud.sql.v1.RestoreBackupContext.fromObject(object.restoreBackupContext); - } - if (object.backup != null) - message.backup = String(object.backup); - if (object.backupdrBackup != null) - message.backupdrBackup = String(object.backupdrBackup); - if (object.restoreInstanceSettings != null) { - if (typeof object.restoreInstanceSettings !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesRestoreBackupRequest.restoreInstanceSettings: object expected"); - message.restoreInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.restoreInstanceSettings); - } - if (object.restoreInstanceClearOverridesFieldNames) { - if (!Array.isArray(object.restoreInstanceClearOverridesFieldNames)) - throw TypeError(".google.cloud.sql.v1.InstancesRestoreBackupRequest.restoreInstanceClearOverridesFieldNames: array expected"); - message.restoreInstanceClearOverridesFieldNames = []; - for (var i = 0; i < object.restoreInstanceClearOverridesFieldNames.length; ++i) - message.restoreInstanceClearOverridesFieldNames[i] = String(object.restoreInstanceClearOverridesFieldNames[i]); - } - return message; - }; - - /** - * Creates a plain object from an InstancesRestoreBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1.InstancesRestoreBackupRequest} message InstancesRestoreBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesRestoreBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.restoreInstanceClearOverridesFieldNames = []; - if (options.defaults) { - object.restoreBackupContext = null; - object.backup = ""; - object.restoreInstanceSettings = null; - object.backupdrBackup = ""; - } - if (message.restoreBackupContext != null && message.hasOwnProperty("restoreBackupContext")) - object.restoreBackupContext = $root.google.cloud.sql.v1.RestoreBackupContext.toObject(message.restoreBackupContext, options); - if (message.backup != null && message.hasOwnProperty("backup")) - object.backup = message.backup; - if (message.restoreInstanceSettings != null && message.hasOwnProperty("restoreInstanceSettings")) - object.restoreInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.restoreInstanceSettings, options); - if (message.backupdrBackup != null && message.hasOwnProperty("backupdrBackup")) - object.backupdrBackup = message.backupdrBackup; - if (message.restoreInstanceClearOverridesFieldNames && message.restoreInstanceClearOverridesFieldNames.length) { - object.restoreInstanceClearOverridesFieldNames = []; - for (var j = 0; j < message.restoreInstanceClearOverridesFieldNames.length; ++j) - object.restoreInstanceClearOverridesFieldNames[j] = message.restoreInstanceClearOverridesFieldNames[j]; - } - return object; - }; - - /** - * Converts this InstancesRestoreBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesRestoreBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesRestoreBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesRestoreBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesRestoreBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesRestoreBackupRequest"; - }; - - return InstancesRestoreBackupRequest; - })(); - - v1.InstancesRotateServerCaRequest = (function() { - - /** - * Properties of an InstancesRotateServerCaRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesRotateServerCaRequest - * @property {google.cloud.sql.v1.IRotateServerCaContext|null} [rotateServerCaContext] InstancesRotateServerCaRequest rotateServerCaContext - */ - - /** - * Constructs a new InstancesRotateServerCaRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesRotateServerCaRequest. - * @implements IInstancesRotateServerCaRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesRotateServerCaRequest=} [properties] Properties to set - */ - function InstancesRotateServerCaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesRotateServerCaRequest rotateServerCaContext. - * @member {google.cloud.sql.v1.IRotateServerCaContext|null|undefined} rotateServerCaContext - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @instance - */ - InstancesRotateServerCaRequest.prototype.rotateServerCaContext = null; - - /** - * Creates a new InstancesRotateServerCaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRotateServerCaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest instance - */ - InstancesRotateServerCaRequest.create = function create(properties) { - return new InstancesRotateServerCaRequest(properties); - }; - - /** - * Encodes the specified InstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRotateServerCaRequest} message InstancesRotateServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateServerCaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rotateServerCaContext != null && Object.hasOwnProperty.call(message, "rotateServerCaContext")) - $root.google.cloud.sql.v1.RotateServerCaContext.encode(message.rotateServerCaContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRotateServerCaRequest} message InstancesRotateServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateServerCaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesRotateServerCaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.rotateServerCaContext = $root.google.cloud.sql.v1.RotateServerCaContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateServerCaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesRotateServerCaRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesRotateServerCaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rotateServerCaContext != null && message.hasOwnProperty("rotateServerCaContext")) { - var error = $root.google.cloud.sql.v1.RotateServerCaContext.verify(message.rotateServerCaContext); - if (error) - return "rotateServerCaContext." + error; - } - return null; - }; - - /** - * Creates an InstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest - */ - InstancesRotateServerCaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesRotateServerCaRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesRotateServerCaRequest(); - if (object.rotateServerCaContext != null) { - if (typeof object.rotateServerCaContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesRotateServerCaRequest.rotateServerCaContext: object expected"); - message.rotateServerCaContext = $root.google.cloud.sql.v1.RotateServerCaContext.fromObject(object.rotateServerCaContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesRotateServerCaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1.InstancesRotateServerCaRequest} message InstancesRotateServerCaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesRotateServerCaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.rotateServerCaContext = null; - if (message.rotateServerCaContext != null && message.hasOwnProperty("rotateServerCaContext")) - object.rotateServerCaContext = $root.google.cloud.sql.v1.RotateServerCaContext.toObject(message.rotateServerCaContext, options); - return object; - }; - - /** - * Converts this InstancesRotateServerCaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesRotateServerCaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesRotateServerCaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesRotateServerCaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesRotateServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesRotateServerCaRequest"; - }; - - return InstancesRotateServerCaRequest; - })(); - - v1.InstancesRotateServerCertificateRequest = (function() { - - /** - * Properties of an InstancesRotateServerCertificateRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesRotateServerCertificateRequest - * @property {google.cloud.sql.v1.IRotateServerCertificateContext|null} [rotateServerCertificateContext] InstancesRotateServerCertificateRequest rotateServerCertificateContext - */ - - /** - * Constructs a new InstancesRotateServerCertificateRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesRotateServerCertificateRequest. - * @implements IInstancesRotateServerCertificateRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest=} [properties] Properties to set - */ - function InstancesRotateServerCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesRotateServerCertificateRequest rotateServerCertificateContext. - * @member {google.cloud.sql.v1.IRotateServerCertificateContext|null|undefined} rotateServerCertificateContext - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @instance - */ - InstancesRotateServerCertificateRequest.prototype.rotateServerCertificateContext = null; - - /** - * Creates a new InstancesRotateServerCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest instance - */ - InstancesRotateServerCertificateRequest.create = function create(properties) { - return new InstancesRotateServerCertificateRequest(properties); - }; - - /** - * Encodes the specified InstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateServerCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rotateServerCertificateContext != null && Object.hasOwnProperty.call(message, "rotateServerCertificateContext")) - $root.google.cloud.sql.v1.RotateServerCertificateContext.encode(message.rotateServerCertificateContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateServerCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateServerCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.rotateServerCertificateContext = $root.google.cloud.sql.v1.RotateServerCertificateContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesRotateServerCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesRotateServerCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rotateServerCertificateContext != null && message.hasOwnProperty("rotateServerCertificateContext")) { - var error = $root.google.cloud.sql.v1.RotateServerCertificateContext.verify(message.rotateServerCertificateContext); - if (error) - return "rotateServerCertificateContext." + error; - } - return null; - }; - - /** - * Creates an InstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest - */ - InstancesRotateServerCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesRotateServerCertificateRequest(); - if (object.rotateServerCertificateContext != null) { - if (typeof object.rotateServerCertificateContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesRotateServerCertificateRequest.rotateServerCertificateContext: object expected"); - message.rotateServerCertificateContext = $root.google.cloud.sql.v1.RotateServerCertificateContext.fromObject(object.rotateServerCertificateContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesRotateServerCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesRotateServerCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.rotateServerCertificateContext = null; - if (message.rotateServerCertificateContext != null && message.hasOwnProperty("rotateServerCertificateContext")) - object.rotateServerCertificateContext = $root.google.cloud.sql.v1.RotateServerCertificateContext.toObject(message.rotateServerCertificateContext, options); - return object; - }; - - /** - * Converts this InstancesRotateServerCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesRotateServerCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesRotateServerCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesRotateServerCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesRotateServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesRotateServerCertificateRequest"; - }; - - return InstancesRotateServerCertificateRequest; - })(); - - v1.InstancesRotateEntraIdCertificateRequest = (function() { - - /** - * Properties of an InstancesRotateEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesRotateEntraIdCertificateRequest - * @property {google.cloud.sql.v1.IRotateEntraIdCertificateContext|null} [rotateEntraIdCertificateContext] InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext - */ - - /** - * Constructs a new InstancesRotateEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesRotateEntraIdCertificateRequest. - * @implements IInstancesRotateEntraIdCertificateRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set - */ - function InstancesRotateEntraIdCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext. - * @member {google.cloud.sql.v1.IRotateEntraIdCertificateContext|null|undefined} rotateEntraIdCertificateContext - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @instance - */ - InstancesRotateEntraIdCertificateRequest.prototype.rotateEntraIdCertificateContext = null; - - /** - * Creates a new InstancesRotateEntraIdCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest instance - */ - InstancesRotateEntraIdCertificateRequest.create = function create(properties) { - return new InstancesRotateEntraIdCertificateRequest(properties); - }; - - /** - * Encodes the specified InstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateEntraIdCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rotateEntraIdCertificateContext != null && Object.hasOwnProperty.call(message, "rotateEntraIdCertificateContext")) - $root.google.cloud.sql.v1.RotateEntraIdCertificateContext.encode(message.rotateEntraIdCertificateContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.IInstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateEntraIdCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1.RotateEntraIdCertificateContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesRotateEntraIdCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesRotateEntraIdCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rotateEntraIdCertificateContext != null && message.hasOwnProperty("rotateEntraIdCertificateContext")) { - var error = $root.google.cloud.sql.v1.RotateEntraIdCertificateContext.verify(message.rotateEntraIdCertificateContext); - if (error) - return "rotateEntraIdCertificateContext." + error; - } - return null; - }; - - /** - * Creates an InstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest - */ - InstancesRotateEntraIdCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest(); - if (object.rotateEntraIdCertificateContext != null) { - if (typeof object.rotateEntraIdCertificateContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest.rotateEntraIdCertificateContext: object expected"); - message.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1.RotateEntraIdCertificateContext.fromObject(object.rotateEntraIdCertificateContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesRotateEntraIdCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.rotateEntraIdCertificateContext = null; - if (message.rotateEntraIdCertificateContext != null && message.hasOwnProperty("rotateEntraIdCertificateContext")) - object.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1.RotateEntraIdCertificateContext.toObject(message.rotateEntraIdCertificateContext, options); - return object; - }; - - /** - * Converts this InstancesRotateEntraIdCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesRotateEntraIdCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesRotateEntraIdCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesRotateEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest"; - }; - - return InstancesRotateEntraIdCertificateRequest; - })(); - - v1.InstancesTruncateLogRequest = (function() { - - /** - * Properties of an InstancesTruncateLogRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesTruncateLogRequest - * @property {google.cloud.sql.v1.ITruncateLogContext|null} [truncateLogContext] InstancesTruncateLogRequest truncateLogContext - */ - - /** - * Constructs a new InstancesTruncateLogRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesTruncateLogRequest. - * @implements IInstancesTruncateLogRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesTruncateLogRequest=} [properties] Properties to set - */ - function InstancesTruncateLogRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesTruncateLogRequest truncateLogContext. - * @member {google.cloud.sql.v1.ITruncateLogContext|null|undefined} truncateLogContext - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @instance - */ - InstancesTruncateLogRequest.prototype.truncateLogContext = null; - - /** - * Creates a new InstancesTruncateLogRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1.IInstancesTruncateLogRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesTruncateLogRequest} InstancesTruncateLogRequest instance - */ - InstancesTruncateLogRequest.create = function create(properties) { - return new InstancesTruncateLogRequest(properties); - }; - - /** - * Encodes the specified InstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesTruncateLogRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1.IInstancesTruncateLogRequest} message InstancesTruncateLogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesTruncateLogRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.truncateLogContext != null && Object.hasOwnProperty.call(message, "truncateLogContext")) - $root.google.cloud.sql.v1.TruncateLogContext.encode(message.truncateLogContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesTruncateLogRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1.IInstancesTruncateLogRequest} message InstancesTruncateLogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesTruncateLogRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesTruncateLogRequest} InstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesTruncateLogRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesTruncateLogRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.truncateLogContext = $root.google.cloud.sql.v1.TruncateLogContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesTruncateLogRequest} InstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesTruncateLogRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesTruncateLogRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesTruncateLogRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.truncateLogContext != null && message.hasOwnProperty("truncateLogContext")) { - var error = $root.google.cloud.sql.v1.TruncateLogContext.verify(message.truncateLogContext); - if (error) - return "truncateLogContext." + error; - } - return null; - }; - - /** - * Creates an InstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesTruncateLogRequest} InstancesTruncateLogRequest - */ - InstancesTruncateLogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesTruncateLogRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesTruncateLogRequest(); - if (object.truncateLogContext != null) { - if (typeof object.truncateLogContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesTruncateLogRequest.truncateLogContext: object expected"); - message.truncateLogContext = $root.google.cloud.sql.v1.TruncateLogContext.fromObject(object.truncateLogContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesTruncateLogRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1.InstancesTruncateLogRequest} message InstancesTruncateLogRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesTruncateLogRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.truncateLogContext = null; - if (message.truncateLogContext != null && message.hasOwnProperty("truncateLogContext")) - object.truncateLogContext = $root.google.cloud.sql.v1.TruncateLogContext.toObject(message.truncateLogContext, options); - return object; - }; - - /** - * Converts this InstancesTruncateLogRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesTruncateLogRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesTruncateLogRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesTruncateLogRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesTruncateLogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesTruncateLogRequest"; - }; - - return InstancesTruncateLogRequest; - })(); - - v1.InstancesAcquireSsrsLeaseRequest = (function() { - - /** - * Properties of an InstancesAcquireSsrsLeaseRequest. - * @memberof google.cloud.sql.v1 - * @interface IInstancesAcquireSsrsLeaseRequest - * @property {google.cloud.sql.v1.IAcquireSsrsLeaseContext|null} [acquireSsrsLeaseContext] InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext - */ - - /** - * Constructs a new InstancesAcquireSsrsLeaseRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an InstancesAcquireSsrsLeaseRequest. - * @implements IInstancesAcquireSsrsLeaseRequest - * @constructor - * @param {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set - */ - function InstancesAcquireSsrsLeaseRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext. - * @member {google.cloud.sql.v1.IAcquireSsrsLeaseContext|null|undefined} acquireSsrsLeaseContext - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @instance - */ - InstancesAcquireSsrsLeaseRequest.prototype.acquireSsrsLeaseContext = null; - - /** - * Creates a new InstancesAcquireSsrsLeaseRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest instance - */ - InstancesAcquireSsrsLeaseRequest.create = function create(properties) { - return new InstancesAcquireSsrsLeaseRequest(properties); - }; - - /** - * Encodes the specified InstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesAcquireSsrsLeaseRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.acquireSsrsLeaseContext != null && Object.hasOwnProperty.call(message, "acquireSsrsLeaseContext")) - $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.encode(message.acquireSsrsLeaseContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesAcquireSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesAcquireSsrsLeaseRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesAcquireSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesAcquireSsrsLeaseRequest message. - * @function verify - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesAcquireSsrsLeaseRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) { - var error = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.verify(message.acquireSsrsLeaseContext); - if (error) - return "acquireSsrsLeaseContext." + error; - } - return null; - }; - - /** - * Creates an InstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest - */ - InstancesAcquireSsrsLeaseRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest) - return object; - var message = new $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest(); - if (object.acquireSsrsLeaseContext != null) { - if (typeof object.acquireSsrsLeaseContext !== "object") - throw TypeError(".google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.acquireSsrsLeaseContext: object expected"); - message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.fromObject(object.acquireSsrsLeaseContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesAcquireSsrsLeaseRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.acquireSsrsLeaseContext = null; - if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) - object.acquireSsrsLeaseContext = $root.google.cloud.sql.v1.AcquireSsrsLeaseContext.toObject(message.acquireSsrsLeaseContext, options); - return object; - }; - - /** - * Converts this InstancesAcquireSsrsLeaseRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesAcquireSsrsLeaseRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesAcquireSsrsLeaseRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesAcquireSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest"; - }; - - return InstancesAcquireSsrsLeaseRequest; - })(); - - v1.SqlInstancesPreCheckMajorVersionUpgradeRequest = (function() { - - /** - * Properties of a SqlInstancesPreCheckMajorVersionUpgradeRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesPreCheckMajorVersionUpgradeRequest - * @property {string|null} [instance] SqlInstancesPreCheckMajorVersionUpgradeRequest instance - * @property {string|null} [project] SqlInstancesPreCheckMajorVersionUpgradeRequest project - * @property {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest|null} [body] SqlInstancesPreCheckMajorVersionUpgradeRequest body - */ - - /** - * Constructs a new SqlInstancesPreCheckMajorVersionUpgradeRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesPreCheckMajorVersionUpgradeRequest. - * @implements ISqlInstancesPreCheckMajorVersionUpgradeRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set - */ - function SqlInstancesPreCheckMajorVersionUpgradeRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesPreCheckMajorVersionUpgradeRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @instance - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.instance = ""; - - /** - * SqlInstancesPreCheckMajorVersionUpgradeRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @instance - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.project = ""; - - /** - * SqlInstancesPreCheckMajorVersionUpgradeRequest body. - * @member {google.cloud.sql.v1.IInstancesPreCheckMajorVersionUpgradeRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @instance - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest instance - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.create = function create(properties) { - return new SqlInstancesPreCheckMajorVersionUpgradeRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.encode(message.body, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.body = $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesPreCheckMajorVersionUpgradeRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesPreCheckMajorVersionUpgradeRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesPreCheckMajorVersionUpgradeRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest"; - }; - - return SqlInstancesPreCheckMajorVersionUpgradeRequest; - })(); - - v1.SqlInstancesVerifyExternalSyncSettingsResponse = (function() { - - /** - * Properties of a SqlInstancesVerifyExternalSyncSettingsResponse. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesVerifyExternalSyncSettingsResponse - * @property {string|null} [kind] SqlInstancesVerifyExternalSyncSettingsResponse kind - * @property {Array.|null} [errors] SqlInstancesVerifyExternalSyncSettingsResponse errors - * @property {Array.|null} [warnings] SqlInstancesVerifyExternalSyncSettingsResponse warnings - */ - - /** - * Constructs a new SqlInstancesVerifyExternalSyncSettingsResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesVerifyExternalSyncSettingsResponse. - * @implements ISqlInstancesVerifyExternalSyncSettingsResponse - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse=} [properties] Properties to set - */ - function SqlInstancesVerifyExternalSyncSettingsResponse(properties) { - this.errors = []; - this.warnings = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesVerifyExternalSyncSettingsResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsResponse.prototype.kind = ""; - - /** - * SqlInstancesVerifyExternalSyncSettingsResponse errors. - * @member {Array.} errors - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsResponse.prototype.errors = $util.emptyArray; - - /** - * SqlInstancesVerifyExternalSyncSettingsResponse warnings. - * @member {Array.} warnings - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsResponse.prototype.warnings = $util.emptyArray; - - /** - * Creates a new SqlInstancesVerifyExternalSyncSettingsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse instance - */ - SqlInstancesVerifyExternalSyncSettingsResponse.create = function create(properties) { - return new SqlInstancesVerifyExternalSyncSettingsResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesVerifyExternalSyncSettingsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.errors != null && message.errors.length) - for (var i = 0; i < message.errors.length; ++i) - $root.google.cloud.sql.v1.SqlExternalSyncSettingError.encode(message.errors[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.warnings != null && message.warnings.length) - for (var i = 0; i < message.warnings.length; ++i) - $root.google.cloud.sql.v1.SqlExternalSyncSettingError.encode(message.warnings[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesVerifyExternalSyncSettingsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesVerifyExternalSyncSettingsResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.errors && message.errors.length)) - message.errors = []; - message.errors.push($root.google.cloud.sql.v1.SqlExternalSyncSettingError.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.warnings && message.warnings.length)) - message.warnings = []; - message.warnings.push($root.google.cloud.sql.v1.SqlExternalSyncSettingError.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesVerifyExternalSyncSettingsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesVerifyExternalSyncSettingsResponse message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesVerifyExternalSyncSettingsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.errors != null && message.hasOwnProperty("errors")) { - if (!Array.isArray(message.errors)) - return "errors: array expected"; - for (var i = 0; i < message.errors.length; ++i) { - var error = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.verify(message.errors[i]); - if (error) - return "errors." + error; - } - } - if (message.warnings != null && message.hasOwnProperty("warnings")) { - if (!Array.isArray(message.warnings)) - return "warnings: array expected"; - for (var i = 0; i < message.warnings.length; ++i) { - var error = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.verify(message.warnings[i]); - if (error) - return "warnings." + error; - } - } - return null; - }; - - /** - * Creates a SqlInstancesVerifyExternalSyncSettingsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse - */ - SqlInstancesVerifyExternalSyncSettingsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.errors) { - if (!Array.isArray(object.errors)) - throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.errors: array expected"); - message.errors = []; - for (var i = 0; i < object.errors.length; ++i) { - if (typeof object.errors[i] !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.errors: object expected"); - message.errors[i] = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.fromObject(object.errors[i]); - } - } - if (object.warnings) { - if (!Array.isArray(object.warnings)) - throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.warnings: array expected"); - message.warnings = []; - for (var i = 0; i < object.warnings.length; ++i) { - if (typeof object.warnings[i] !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse.warnings: object expected"); - message.warnings[i] = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.fromObject(object.warnings[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesVerifyExternalSyncSettingsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.errors = []; - object.warnings = []; - } - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.errors && message.errors.length) { - object.errors = []; - for (var j = 0; j < message.errors.length; ++j) - object.errors[j] = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.toObject(message.errors[j], options); - } - if (message.warnings && message.warnings.length) { - object.warnings = []; - for (var j = 0; j < message.warnings.length; ++j) - object.warnings[j] = $root.google.cloud.sql.v1.SqlExternalSyncSettingError.toObject(message.warnings[j], options); - } - return object; - }; - - /** - * Converts this SqlInstancesVerifyExternalSyncSettingsResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesVerifyExternalSyncSettingsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesVerifyExternalSyncSettingsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse"; - }; - - return SqlInstancesVerifyExternalSyncSettingsResponse; - })(); - - v1.SqlInstancesGetDiskShrinkConfigResponse = (function() { - - /** - * Properties of a SqlInstancesGetDiskShrinkConfigResponse. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesGetDiskShrinkConfigResponse - * @property {string|null} [kind] SqlInstancesGetDiskShrinkConfigResponse kind - * @property {number|Long|null} [minimalTargetSizeGb] SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb - * @property {string|null} [message] SqlInstancesGetDiskShrinkConfigResponse message - */ - - /** - * Constructs a new SqlInstancesGetDiskShrinkConfigResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesGetDiskShrinkConfigResponse. - * @implements ISqlInstancesGetDiskShrinkConfigResponse - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse=} [properties] Properties to set - */ - function SqlInstancesGetDiskShrinkConfigResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesGetDiskShrinkConfigResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @instance - */ - SqlInstancesGetDiskShrinkConfigResponse.prototype.kind = ""; - - /** - * SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb. - * @member {number|Long} minimalTargetSizeGb - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @instance - */ - SqlInstancesGetDiskShrinkConfigResponse.prototype.minimalTargetSizeGb = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * SqlInstancesGetDiskShrinkConfigResponse message. - * @member {string} message - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @instance - */ - SqlInstancesGetDiskShrinkConfigResponse.prototype.message = ""; - - /** - * Creates a new SqlInstancesGetDiskShrinkConfigResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse instance - */ - SqlInstancesGetDiskShrinkConfigResponse.create = function create(properties) { - return new SqlInstancesGetDiskShrinkConfigResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetDiskShrinkConfigResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.minimalTargetSizeGb != null && Object.hasOwnProperty.call(message, "minimalTargetSizeGb")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.minimalTargetSizeGb); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); - return writer; - }; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetDiskShrinkConfigResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetDiskShrinkConfigResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.minimalTargetSizeGb = reader.int64(); - break; - } - case 3: { - message.message = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetDiskShrinkConfigResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesGetDiskShrinkConfigResponse message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesGetDiskShrinkConfigResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.minimalTargetSizeGb != null && message.hasOwnProperty("minimalTargetSizeGb")) - if (!$util.isInteger(message.minimalTargetSizeGb) && !(message.minimalTargetSizeGb && $util.isInteger(message.minimalTargetSizeGb.low) && $util.isInteger(message.minimalTargetSizeGb.high))) - return "minimalTargetSizeGb: integer|Long expected"; - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesGetDiskShrinkConfigResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse - */ - SqlInstancesGetDiskShrinkConfigResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.minimalTargetSizeGb != null) - if ($util.Long) - (message.minimalTargetSizeGb = $util.Long.fromValue(object.minimalTargetSizeGb)).unsigned = false; - else if (typeof object.minimalTargetSizeGb === "string") - message.minimalTargetSizeGb = parseInt(object.minimalTargetSizeGb, 10); - else if (typeof object.minimalTargetSizeGb === "number") - message.minimalTargetSizeGb = object.minimalTargetSizeGb; - else if (typeof object.minimalTargetSizeGb === "object") - message.minimalTargetSizeGb = new $util.LongBits(object.minimalTargetSizeGb.low >>> 0, object.minimalTargetSizeGb.high >>> 0).toNumber(); - if (object.message != null) - message.message = String(object.message); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesGetDiskShrinkConfigResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesGetDiskShrinkConfigResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.minimalTargetSizeGb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.minimalTargetSizeGb = options.longs === String ? "0" : 0; - object.message = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.minimalTargetSizeGb != null && message.hasOwnProperty("minimalTargetSizeGb")) - if (typeof message.minimalTargetSizeGb === "number") - object.minimalTargetSizeGb = options.longs === String ? String(message.minimalTargetSizeGb) : message.minimalTargetSizeGb; - else - object.minimalTargetSizeGb = options.longs === String ? $util.Long.prototype.toString.call(message.minimalTargetSizeGb) : options.longs === Number ? new $util.LongBits(message.minimalTargetSizeGb.low >>> 0, message.minimalTargetSizeGb.high >>> 0).toNumber() : message.minimalTargetSizeGb; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - return object; - }; - - /** - * Converts this SqlInstancesGetDiskShrinkConfigResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesGetDiskShrinkConfigResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesGetDiskShrinkConfigResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesGetDiskShrinkConfigResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse"; - }; - - return SqlInstancesGetDiskShrinkConfigResponse; - })(); - - v1.SqlInstancesGetLatestRecoveryTimeRequest = (function() { - - /** - * Properties of a SqlInstancesGetLatestRecoveryTimeRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesGetLatestRecoveryTimeRequest - * @property {string|null} [instance] SqlInstancesGetLatestRecoveryTimeRequest instance - * @property {string|null} [project] SqlInstancesGetLatestRecoveryTimeRequest project - * @property {google.protobuf.ITimestamp|null} [sourceInstanceDeletionTime] SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime - */ - - /** - * Constructs a new SqlInstancesGetLatestRecoveryTimeRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesGetLatestRecoveryTimeRequest. - * @implements ISqlInstancesGetLatestRecoveryTimeRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest=} [properties] Properties to set - */ - function SqlInstancesGetLatestRecoveryTimeRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesGetLatestRecoveryTimeRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @instance - */ - SqlInstancesGetLatestRecoveryTimeRequest.prototype.instance = ""; - - /** - * SqlInstancesGetLatestRecoveryTimeRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @instance - */ - SqlInstancesGetLatestRecoveryTimeRequest.prototype.project = ""; - - /** - * SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime. - * @member {google.protobuf.ITimestamp|null|undefined} sourceInstanceDeletionTime - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @instance - */ - SqlInstancesGetLatestRecoveryTimeRequest.prototype.sourceInstanceDeletionTime = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlInstancesGetLatestRecoveryTimeRequest.prototype, "_sourceInstanceDeletionTime", { - get: $util.oneOfGetter($oneOfFields = ["sourceInstanceDeletionTime"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlInstancesGetLatestRecoveryTimeRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest instance - */ - SqlInstancesGetLatestRecoveryTimeRequest.create = function create(properties) { - return new SqlInstancesGetLatestRecoveryTimeRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetLatestRecoveryTimeRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.sourceInstanceDeletionTime != null && Object.hasOwnProperty.call(message, "sourceInstanceDeletionTime")) - $root.google.protobuf.Timestamp.encode(message.sourceInstanceDeletionTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetLatestRecoveryTimeRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetLatestRecoveryTimeRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetLatestRecoveryTimeRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesGetLatestRecoveryTimeRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesGetLatestRecoveryTimeRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { - properties._sourceInstanceDeletionTime = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.sourceInstanceDeletionTime); - if (error) - return "sourceInstanceDeletionTime." + error; - } - } - return null; - }; - - /** - * Creates a SqlInstancesGetLatestRecoveryTimeRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest - */ - SqlInstancesGetLatestRecoveryTimeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.sourceInstanceDeletionTime != null) { - if (typeof object.sourceInstanceDeletionTime !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest.sourceInstanceDeletionTime: object expected"); - message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.sourceInstanceDeletionTime); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesGetLatestRecoveryTimeRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { - object.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.sourceInstanceDeletionTime, options); - if (options.oneofs) - object._sourceInstanceDeletionTime = "sourceInstanceDeletionTime"; - } - return object; - }; - - /** - * Converts this SqlInstancesGetLatestRecoveryTimeRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesGetLatestRecoveryTimeRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesGetLatestRecoveryTimeRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesGetLatestRecoveryTimeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest"; - }; - - return SqlInstancesGetLatestRecoveryTimeRequest; - })(); - - v1.SqlInstancesGetLatestRecoveryTimeResponse = (function() { - - /** - * Properties of a SqlInstancesGetLatestRecoveryTimeResponse. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesGetLatestRecoveryTimeResponse - * @property {string|null} [kind] SqlInstancesGetLatestRecoveryTimeResponse kind - * @property {google.protobuf.ITimestamp|null} [latestRecoveryTime] SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime - * @property {google.protobuf.ITimestamp|null} [earliestRecoveryTime] SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime - */ - - /** - * Constructs a new SqlInstancesGetLatestRecoveryTimeResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesGetLatestRecoveryTimeResponse. - * @implements ISqlInstancesGetLatestRecoveryTimeResponse - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse=} [properties] Properties to set - */ - function SqlInstancesGetLatestRecoveryTimeResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesGetLatestRecoveryTimeResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @instance - */ - SqlInstancesGetLatestRecoveryTimeResponse.prototype.kind = ""; - - /** - * SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime. - * @member {google.protobuf.ITimestamp|null|undefined} latestRecoveryTime - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @instance - */ - SqlInstancesGetLatestRecoveryTimeResponse.prototype.latestRecoveryTime = null; - - /** - * SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime. - * @member {google.protobuf.ITimestamp|null|undefined} earliestRecoveryTime - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @instance - */ - SqlInstancesGetLatestRecoveryTimeResponse.prototype.earliestRecoveryTime = null; - - /** - * Creates a new SqlInstancesGetLatestRecoveryTimeResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse instance - */ - SqlInstancesGetLatestRecoveryTimeResponse.create = function create(properties) { - return new SqlInstancesGetLatestRecoveryTimeResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetLatestRecoveryTimeResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.latestRecoveryTime != null && Object.hasOwnProperty.call(message, "latestRecoveryTime")) - $root.google.protobuf.Timestamp.encode(message.latestRecoveryTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.earliestRecoveryTime != null && Object.hasOwnProperty.call(message, "earliestRecoveryTime")) - $root.google.protobuf.Timestamp.encode(message.earliestRecoveryTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetLatestRecoveryTimeResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetLatestRecoveryTimeResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.latestRecoveryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.earliestRecoveryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetLatestRecoveryTimeResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesGetLatestRecoveryTimeResponse message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesGetLatestRecoveryTimeResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.latestRecoveryTime != null && message.hasOwnProperty("latestRecoveryTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.latestRecoveryTime); - if (error) - return "latestRecoveryTime." + error; - } - if (message.earliestRecoveryTime != null && message.hasOwnProperty("earliestRecoveryTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.earliestRecoveryTime); - if (error) - return "earliestRecoveryTime." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesGetLatestRecoveryTimeResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse - */ - SqlInstancesGetLatestRecoveryTimeResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.latestRecoveryTime != null) { - if (typeof object.latestRecoveryTime !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.latestRecoveryTime: object expected"); - message.latestRecoveryTime = $root.google.protobuf.Timestamp.fromObject(object.latestRecoveryTime); - } - if (object.earliestRecoveryTime != null) { - if (typeof object.earliestRecoveryTime !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse.earliestRecoveryTime: object expected"); - message.earliestRecoveryTime = $root.google.protobuf.Timestamp.fromObject(object.earliestRecoveryTime); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesGetLatestRecoveryTimeResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.latestRecoveryTime = null; - object.earliestRecoveryTime = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.latestRecoveryTime != null && message.hasOwnProperty("latestRecoveryTime")) - object.latestRecoveryTime = $root.google.protobuf.Timestamp.toObject(message.latestRecoveryTime, options); - if (message.earliestRecoveryTime != null && message.hasOwnProperty("earliestRecoveryTime")) - object.earliestRecoveryTime = $root.google.protobuf.Timestamp.toObject(message.earliestRecoveryTime, options); - return object; - }; - - /** - * Converts this SqlInstancesGetLatestRecoveryTimeResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesGetLatestRecoveryTimeResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesGetLatestRecoveryTimeResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesGetLatestRecoveryTimeResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse"; - }; - - return SqlInstancesGetLatestRecoveryTimeResponse; - })(); - - v1.CloneContext = (function() { - - /** - * Properties of a CloneContext. - * @memberof google.cloud.sql.v1 - * @interface ICloneContext - * @property {string|null} [kind] CloneContext kind - * @property {number|Long|null} [pitrTimestampMs] CloneContext pitrTimestampMs - * @property {string|null} [destinationInstanceName] CloneContext destinationInstanceName - * @property {google.cloud.sql.v1.IBinLogCoordinates|null} [binLogCoordinates] CloneContext binLogCoordinates - * @property {google.protobuf.ITimestamp|null} [pointInTime] CloneContext pointInTime - * @property {string|null} [allocatedIpRange] CloneContext allocatedIpRange - * @property {Array.|null} [databaseNames] CloneContext databaseNames - * @property {string|null} [preferredZone] CloneContext preferredZone - * @property {string|null} [preferredSecondaryZone] CloneContext preferredSecondaryZone - * @property {google.protobuf.ITimestamp|null} [sourceInstanceDeletionTime] CloneContext sourceInstanceDeletionTime - * @property {string|null} [destinationProject] CloneContext destinationProject - * @property {string|null} [destinationNetwork] CloneContext destinationNetwork - */ - - /** - * Constructs a new CloneContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a CloneContext. - * @implements ICloneContext - * @constructor - * @param {google.cloud.sql.v1.ICloneContext=} [properties] Properties to set - */ - function CloneContext(properties) { - this.databaseNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CloneContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.kind = ""; - - /** - * CloneContext pitrTimestampMs. - * @member {number|Long} pitrTimestampMs - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.pitrTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * CloneContext destinationInstanceName. - * @member {string} destinationInstanceName - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.destinationInstanceName = ""; - - /** - * CloneContext binLogCoordinates. - * @member {google.cloud.sql.v1.IBinLogCoordinates|null|undefined} binLogCoordinates - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.binLogCoordinates = null; - - /** - * CloneContext pointInTime. - * @member {google.protobuf.ITimestamp|null|undefined} pointInTime - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.pointInTime = null; - - /** - * CloneContext allocatedIpRange. - * @member {string} allocatedIpRange - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.allocatedIpRange = ""; - - /** - * CloneContext databaseNames. - * @member {Array.} databaseNames - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.databaseNames = $util.emptyArray; - - /** - * CloneContext preferredZone. - * @member {string|null|undefined} preferredZone - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.preferredZone = null; - - /** - * CloneContext preferredSecondaryZone. - * @member {string|null|undefined} preferredSecondaryZone - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.preferredSecondaryZone = null; - - /** - * CloneContext sourceInstanceDeletionTime. - * @member {google.protobuf.ITimestamp|null|undefined} sourceInstanceDeletionTime - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.sourceInstanceDeletionTime = null; - - /** - * CloneContext destinationProject. - * @member {string|null|undefined} destinationProject - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.destinationProject = null; - - /** - * CloneContext destinationNetwork. - * @member {string|null|undefined} destinationNetwork - * @memberof google.cloud.sql.v1.CloneContext - * @instance - */ - CloneContext.prototype.destinationNetwork = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CloneContext.prototype, "_preferredZone", { - get: $util.oneOfGetter($oneOfFields = ["preferredZone"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CloneContext.prototype, "_preferredSecondaryZone", { - get: $util.oneOfGetter($oneOfFields = ["preferredSecondaryZone"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CloneContext.prototype, "_sourceInstanceDeletionTime", { - get: $util.oneOfGetter($oneOfFields = ["sourceInstanceDeletionTime"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CloneContext.prototype, "_destinationProject", { - get: $util.oneOfGetter($oneOfFields = ["destinationProject"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CloneContext.prototype, "_destinationNetwork", { - get: $util.oneOfGetter($oneOfFields = ["destinationNetwork"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new CloneContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.CloneContext - * @static - * @param {google.cloud.sql.v1.ICloneContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.CloneContext} CloneContext instance - */ - CloneContext.create = function create(properties) { - return new CloneContext(properties); - }; - - /** - * Encodes the specified CloneContext message. Does not implicitly {@link google.cloud.sql.v1.CloneContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.CloneContext - * @static - * @param {google.cloud.sql.v1.ICloneContext} message CloneContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CloneContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.pitrTimestampMs != null && Object.hasOwnProperty.call(message, "pitrTimestampMs")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pitrTimestampMs); - if (message.destinationInstanceName != null && Object.hasOwnProperty.call(message, "destinationInstanceName")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinationInstanceName); - if (message.binLogCoordinates != null && Object.hasOwnProperty.call(message, "binLogCoordinates")) - $root.google.cloud.sql.v1.BinLogCoordinates.encode(message.binLogCoordinates, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.pointInTime != null && Object.hasOwnProperty.call(message, "pointInTime")) - $root.google.protobuf.Timestamp.encode(message.pointInTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.allocatedIpRange); - if (message.databaseNames != null && message.databaseNames.length) - for (var i = 0; i < message.databaseNames.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.databaseNames[i]); - if (message.preferredZone != null && Object.hasOwnProperty.call(message, "preferredZone")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.preferredZone); - if (message.preferredSecondaryZone != null && Object.hasOwnProperty.call(message, "preferredSecondaryZone")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.preferredSecondaryZone); - if (message.sourceInstanceDeletionTime != null && Object.hasOwnProperty.call(message, "sourceInstanceDeletionTime")) - $root.google.protobuf.Timestamp.encode(message.sourceInstanceDeletionTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.destinationProject != null && Object.hasOwnProperty.call(message, "destinationProject")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.destinationProject); - if (message.destinationNetwork != null && Object.hasOwnProperty.call(message, "destinationNetwork")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.destinationNetwork); - return writer; - }; - - /** - * Encodes the specified CloneContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.CloneContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.CloneContext - * @static - * @param {google.cloud.sql.v1.ICloneContext} message CloneContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CloneContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CloneContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.CloneContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.CloneContext} CloneContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CloneContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.CloneContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.pitrTimestampMs = reader.int64(); - break; - } - case 3: { - message.destinationInstanceName = reader.string(); - break; - } - case 4: { - message.binLogCoordinates = $root.google.cloud.sql.v1.BinLogCoordinates.decode(reader, reader.uint32()); - break; - } - case 5: { - message.pointInTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 6: { - message.allocatedIpRange = reader.string(); - break; - } - case 9: { - if (!(message.databaseNames && message.databaseNames.length)) - message.databaseNames = []; - message.databaseNames.push(reader.string()); - break; - } - case 10: { - message.preferredZone = reader.string(); - break; - } - case 11: { - message.preferredSecondaryZone = reader.string(); - break; - } - case 12: { - message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 13: { - message.destinationProject = reader.string(); - break; - } - case 14: { - message.destinationNetwork = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CloneContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.CloneContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.CloneContext} CloneContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CloneContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CloneContext message. - * @function verify - * @memberof google.cloud.sql.v1.CloneContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CloneContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.pitrTimestampMs != null && message.hasOwnProperty("pitrTimestampMs")) - if (!$util.isInteger(message.pitrTimestampMs) && !(message.pitrTimestampMs && $util.isInteger(message.pitrTimestampMs.low) && $util.isInteger(message.pitrTimestampMs.high))) - return "pitrTimestampMs: integer|Long expected"; - if (message.destinationInstanceName != null && message.hasOwnProperty("destinationInstanceName")) - if (!$util.isString(message.destinationInstanceName)) - return "destinationInstanceName: string expected"; - if (message.binLogCoordinates != null && message.hasOwnProperty("binLogCoordinates")) { - var error = $root.google.cloud.sql.v1.BinLogCoordinates.verify(message.binLogCoordinates); - if (error) - return "binLogCoordinates." + error; - } - if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.pointInTime); - if (error) - return "pointInTime." + error; - } - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) - if (!$util.isString(message.allocatedIpRange)) - return "allocatedIpRange: string expected"; - if (message.databaseNames != null && message.hasOwnProperty("databaseNames")) { - if (!Array.isArray(message.databaseNames)) - return "databaseNames: array expected"; - for (var i = 0; i < message.databaseNames.length; ++i) - if (!$util.isString(message.databaseNames[i])) - return "databaseNames: string[] expected"; - } - if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { - properties._preferredZone = 1; - if (!$util.isString(message.preferredZone)) - return "preferredZone: string expected"; - } - if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { - properties._preferredSecondaryZone = 1; - if (!$util.isString(message.preferredSecondaryZone)) - return "preferredSecondaryZone: string expected"; - } - if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { - properties._sourceInstanceDeletionTime = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.sourceInstanceDeletionTime); - if (error) - return "sourceInstanceDeletionTime." + error; - } - } - if (message.destinationProject != null && message.hasOwnProperty("destinationProject")) { - properties._destinationProject = 1; - if (!$util.isString(message.destinationProject)) - return "destinationProject: string expected"; - } - if (message.destinationNetwork != null && message.hasOwnProperty("destinationNetwork")) { - properties._destinationNetwork = 1; - if (!$util.isString(message.destinationNetwork)) - return "destinationNetwork: string expected"; - } - return null; - }; - - /** - * Creates a CloneContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.CloneContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.CloneContext} CloneContext - */ - CloneContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.CloneContext) - return object; - var message = new $root.google.cloud.sql.v1.CloneContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.pitrTimestampMs != null) - if ($util.Long) - (message.pitrTimestampMs = $util.Long.fromValue(object.pitrTimestampMs)).unsigned = false; - else if (typeof object.pitrTimestampMs === "string") - message.pitrTimestampMs = parseInt(object.pitrTimestampMs, 10); - else if (typeof object.pitrTimestampMs === "number") - message.pitrTimestampMs = object.pitrTimestampMs; - else if (typeof object.pitrTimestampMs === "object") - message.pitrTimestampMs = new $util.LongBits(object.pitrTimestampMs.low >>> 0, object.pitrTimestampMs.high >>> 0).toNumber(); - if (object.destinationInstanceName != null) - message.destinationInstanceName = String(object.destinationInstanceName); - if (object.binLogCoordinates != null) { - if (typeof object.binLogCoordinates !== "object") - throw TypeError(".google.cloud.sql.v1.CloneContext.binLogCoordinates: object expected"); - message.binLogCoordinates = $root.google.cloud.sql.v1.BinLogCoordinates.fromObject(object.binLogCoordinates); - } - if (object.pointInTime != null) { - if (typeof object.pointInTime !== "object") - throw TypeError(".google.cloud.sql.v1.CloneContext.pointInTime: object expected"); - message.pointInTime = $root.google.protobuf.Timestamp.fromObject(object.pointInTime); - } - if (object.allocatedIpRange != null) - message.allocatedIpRange = String(object.allocatedIpRange); - if (object.databaseNames) { - if (!Array.isArray(object.databaseNames)) - throw TypeError(".google.cloud.sql.v1.CloneContext.databaseNames: array expected"); - message.databaseNames = []; - for (var i = 0; i < object.databaseNames.length; ++i) - message.databaseNames[i] = String(object.databaseNames[i]); - } - if (object.preferredZone != null) - message.preferredZone = String(object.preferredZone); - if (object.preferredSecondaryZone != null) - message.preferredSecondaryZone = String(object.preferredSecondaryZone); - if (object.sourceInstanceDeletionTime != null) { - if (typeof object.sourceInstanceDeletionTime !== "object") - throw TypeError(".google.cloud.sql.v1.CloneContext.sourceInstanceDeletionTime: object expected"); - message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.sourceInstanceDeletionTime); - } - if (object.destinationProject != null) - message.destinationProject = String(object.destinationProject); - if (object.destinationNetwork != null) - message.destinationNetwork = String(object.destinationNetwork); - return message; - }; - - /** - * Creates a plain object from a CloneContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.CloneContext - * @static - * @param {google.cloud.sql.v1.CloneContext} message CloneContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CloneContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.databaseNames = []; - if (options.defaults) { - object.kind = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.pitrTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.pitrTimestampMs = options.longs === String ? "0" : 0; - object.destinationInstanceName = ""; - object.binLogCoordinates = null; - object.pointInTime = null; - object.allocatedIpRange = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.pitrTimestampMs != null && message.hasOwnProperty("pitrTimestampMs")) - if (typeof message.pitrTimestampMs === "number") - object.pitrTimestampMs = options.longs === String ? String(message.pitrTimestampMs) : message.pitrTimestampMs; - else - object.pitrTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.pitrTimestampMs) : options.longs === Number ? new $util.LongBits(message.pitrTimestampMs.low >>> 0, message.pitrTimestampMs.high >>> 0).toNumber() : message.pitrTimestampMs; - if (message.destinationInstanceName != null && message.hasOwnProperty("destinationInstanceName")) - object.destinationInstanceName = message.destinationInstanceName; - if (message.binLogCoordinates != null && message.hasOwnProperty("binLogCoordinates")) - object.binLogCoordinates = $root.google.cloud.sql.v1.BinLogCoordinates.toObject(message.binLogCoordinates, options); - if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) - object.pointInTime = $root.google.protobuf.Timestamp.toObject(message.pointInTime, options); - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) - object.allocatedIpRange = message.allocatedIpRange; - if (message.databaseNames && message.databaseNames.length) { - object.databaseNames = []; - for (var j = 0; j < message.databaseNames.length; ++j) - object.databaseNames[j] = message.databaseNames[j]; - } - if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { - object.preferredZone = message.preferredZone; - if (options.oneofs) - object._preferredZone = "preferredZone"; - } - if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { - object.preferredSecondaryZone = message.preferredSecondaryZone; - if (options.oneofs) - object._preferredSecondaryZone = "preferredSecondaryZone"; - } - if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { - object.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.sourceInstanceDeletionTime, options); - if (options.oneofs) - object._sourceInstanceDeletionTime = "sourceInstanceDeletionTime"; - } - if (message.destinationProject != null && message.hasOwnProperty("destinationProject")) { - object.destinationProject = message.destinationProject; - if (options.oneofs) - object._destinationProject = "destinationProject"; - } - if (message.destinationNetwork != null && message.hasOwnProperty("destinationNetwork")) { - object.destinationNetwork = message.destinationNetwork; - if (options.oneofs) - object._destinationNetwork = "destinationNetwork"; - } - return object; - }; - - /** - * Converts this CloneContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.CloneContext - * @instance - * @returns {Object.} JSON object - */ - CloneContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CloneContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.CloneContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CloneContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.CloneContext"; - }; - - return CloneContext; - })(); - - v1.PointInTimeRestoreContext = (function() { - - /** - * Properties of a PointInTimeRestoreContext. - * @memberof google.cloud.sql.v1 - * @interface IPointInTimeRestoreContext - * @property {string|null} [datasource] PointInTimeRestoreContext datasource - * @property {google.protobuf.ITimestamp|null} [pointInTime] PointInTimeRestoreContext pointInTime - * @property {string|null} [targetInstance] PointInTimeRestoreContext targetInstance - * @property {string|null} [privateNetwork] PointInTimeRestoreContext privateNetwork - * @property {string|null} [allocatedIpRange] PointInTimeRestoreContext allocatedIpRange - * @property {string|null} [preferredZone] PointInTimeRestoreContext preferredZone - * @property {string|null} [preferredSecondaryZone] PointInTimeRestoreContext preferredSecondaryZone - * @property {google.cloud.sql.v1.IDatabaseInstance|null} [targetInstanceSettings] PointInTimeRestoreContext targetInstanceSettings - * @property {Array.|null} [targetInstanceClearSettingsFieldNames] PointInTimeRestoreContext targetInstanceClearSettingsFieldNames - * @property {string|null} [region] PointInTimeRestoreContext region - */ - - /** - * Constructs a new PointInTimeRestoreContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a PointInTimeRestoreContext. - * @implements IPointInTimeRestoreContext - * @constructor - * @param {google.cloud.sql.v1.IPointInTimeRestoreContext=} [properties] Properties to set - */ - function PointInTimeRestoreContext(properties) { - this.targetInstanceClearSettingsFieldNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PointInTimeRestoreContext datasource. - * @member {string|null|undefined} datasource - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.datasource = null; - - /** - * PointInTimeRestoreContext pointInTime. - * @member {google.protobuf.ITimestamp|null|undefined} pointInTime - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.pointInTime = null; - - /** - * PointInTimeRestoreContext targetInstance. - * @member {string|null|undefined} targetInstance - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.targetInstance = null; - - /** - * PointInTimeRestoreContext privateNetwork. - * @member {string|null|undefined} privateNetwork - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.privateNetwork = null; - - /** - * PointInTimeRestoreContext allocatedIpRange. - * @member {string|null|undefined} allocatedIpRange - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.allocatedIpRange = null; - - /** - * PointInTimeRestoreContext preferredZone. - * @member {string|null|undefined} preferredZone - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.preferredZone = null; - - /** - * PointInTimeRestoreContext preferredSecondaryZone. - * @member {string|null|undefined} preferredSecondaryZone - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.preferredSecondaryZone = null; - - /** - * PointInTimeRestoreContext targetInstanceSettings. - * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} targetInstanceSettings - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.targetInstanceSettings = null; - - /** - * PointInTimeRestoreContext targetInstanceClearSettingsFieldNames. - * @member {Array.} targetInstanceClearSettingsFieldNames - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.targetInstanceClearSettingsFieldNames = $util.emptyArray; - - /** - * PointInTimeRestoreContext region. - * @member {string|null|undefined} region - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.region = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_datasource", { - get: $util.oneOfGetter($oneOfFields = ["datasource"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_targetInstance", { - get: $util.oneOfGetter($oneOfFields = ["targetInstance"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_privateNetwork", { - get: $util.oneOfGetter($oneOfFields = ["privateNetwork"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_allocatedIpRange", { - get: $util.oneOfGetter($oneOfFields = ["allocatedIpRange"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_preferredZone", { - get: $util.oneOfGetter($oneOfFields = ["preferredZone"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_preferredSecondaryZone", { - get: $util.oneOfGetter($oneOfFields = ["preferredSecondaryZone"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_region", { - get: $util.oneOfGetter($oneOfFields = ["region"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PointInTimeRestoreContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @static - * @param {google.cloud.sql.v1.IPointInTimeRestoreContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.PointInTimeRestoreContext} PointInTimeRestoreContext instance - */ - PointInTimeRestoreContext.create = function create(properties) { - return new PointInTimeRestoreContext(properties); - }; - - /** - * Encodes the specified PointInTimeRestoreContext message. Does not implicitly {@link google.cloud.sql.v1.PointInTimeRestoreContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @static - * @param {google.cloud.sql.v1.IPointInTimeRestoreContext} message PointInTimeRestoreContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PointInTimeRestoreContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.datasource != null && Object.hasOwnProperty.call(message, "datasource")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasource); - if (message.pointInTime != null && Object.hasOwnProperty.call(message, "pointInTime")) - $root.google.protobuf.Timestamp.encode(message.pointInTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.targetInstance != null && Object.hasOwnProperty.call(message, "targetInstance")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetInstance); - if (message.privateNetwork != null && Object.hasOwnProperty.call(message, "privateNetwork")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.privateNetwork); - if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.allocatedIpRange); - if (message.preferredZone != null && Object.hasOwnProperty.call(message, "preferredZone")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.preferredZone); - if (message.preferredSecondaryZone != null && Object.hasOwnProperty.call(message, "preferredSecondaryZone")) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.preferredSecondaryZone); - if (message.targetInstanceSettings != null && Object.hasOwnProperty.call(message, "targetInstanceSettings")) - $root.google.cloud.sql.v1.DatabaseInstance.encode(message.targetInstanceSettings, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.targetInstanceClearSettingsFieldNames != null && message.targetInstanceClearSettingsFieldNames.length) - for (var i = 0; i < message.targetInstanceClearSettingsFieldNames.length; ++i) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.targetInstanceClearSettingsFieldNames[i]); - if (message.region != null && Object.hasOwnProperty.call(message, "region")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.region); - return writer; - }; - - /** - * Encodes the specified PointInTimeRestoreContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PointInTimeRestoreContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @static - * @param {google.cloud.sql.v1.IPointInTimeRestoreContext} message PointInTimeRestoreContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PointInTimeRestoreContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PointInTimeRestoreContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.PointInTimeRestoreContext} PointInTimeRestoreContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PointInTimeRestoreContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PointInTimeRestoreContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.datasource = reader.string(); - break; - } - case 2: { - message.pointInTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.targetInstance = reader.string(); - break; - } - case 4: { - message.privateNetwork = reader.string(); - break; - } - case 5: { - message.allocatedIpRange = reader.string(); - break; - } - case 6: { - message.preferredZone = reader.string(); - break; - } - case 9: { - message.preferredSecondaryZone = reader.string(); - break; - } - case 11: { - message.targetInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - case 12: { - if (!(message.targetInstanceClearSettingsFieldNames && message.targetInstanceClearSettingsFieldNames.length)) - message.targetInstanceClearSettingsFieldNames = []; - message.targetInstanceClearSettingsFieldNames.push(reader.string()); - break; - } - case 13: { - message.region = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PointInTimeRestoreContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.PointInTimeRestoreContext} PointInTimeRestoreContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PointInTimeRestoreContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PointInTimeRestoreContext message. - * @function verify - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PointInTimeRestoreContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.datasource != null && message.hasOwnProperty("datasource")) { - properties._datasource = 1; - if (!$util.isString(message.datasource)) - return "datasource: string expected"; - } - if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.pointInTime); - if (error) - return "pointInTime." + error; - } - if (message.targetInstance != null && message.hasOwnProperty("targetInstance")) { - properties._targetInstance = 1; - if (!$util.isString(message.targetInstance)) - return "targetInstance: string expected"; - } - if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) { - properties._privateNetwork = 1; - if (!$util.isString(message.privateNetwork)) - return "privateNetwork: string expected"; - } - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) { - properties._allocatedIpRange = 1; - if (!$util.isString(message.allocatedIpRange)) - return "allocatedIpRange: string expected"; - } - if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { - properties._preferredZone = 1; - if (!$util.isString(message.preferredZone)) - return "preferredZone: string expected"; - } - if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { - properties._preferredSecondaryZone = 1; - if (!$util.isString(message.preferredSecondaryZone)) - return "preferredSecondaryZone: string expected"; - } - if (message.targetInstanceSettings != null && message.hasOwnProperty("targetInstanceSettings")) { - var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.targetInstanceSettings); - if (error) - return "targetInstanceSettings." + error; - } - if (message.targetInstanceClearSettingsFieldNames != null && message.hasOwnProperty("targetInstanceClearSettingsFieldNames")) { - if (!Array.isArray(message.targetInstanceClearSettingsFieldNames)) - return "targetInstanceClearSettingsFieldNames: array expected"; - for (var i = 0; i < message.targetInstanceClearSettingsFieldNames.length; ++i) - if (!$util.isString(message.targetInstanceClearSettingsFieldNames[i])) - return "targetInstanceClearSettingsFieldNames: string[] expected"; - } - if (message.region != null && message.hasOwnProperty("region")) { - properties._region = 1; - if (!$util.isString(message.region)) - return "region: string expected"; - } - return null; - }; - - /** - * Creates a PointInTimeRestoreContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.PointInTimeRestoreContext} PointInTimeRestoreContext - */ - PointInTimeRestoreContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.PointInTimeRestoreContext) - return object; - var message = new $root.google.cloud.sql.v1.PointInTimeRestoreContext(); - if (object.datasource != null) - message.datasource = String(object.datasource); - if (object.pointInTime != null) { - if (typeof object.pointInTime !== "object") - throw TypeError(".google.cloud.sql.v1.PointInTimeRestoreContext.pointInTime: object expected"); - message.pointInTime = $root.google.protobuf.Timestamp.fromObject(object.pointInTime); - } - if (object.targetInstance != null) - message.targetInstance = String(object.targetInstance); - if (object.privateNetwork != null) - message.privateNetwork = String(object.privateNetwork); - if (object.allocatedIpRange != null) - message.allocatedIpRange = String(object.allocatedIpRange); - if (object.preferredZone != null) - message.preferredZone = String(object.preferredZone); - if (object.preferredSecondaryZone != null) - message.preferredSecondaryZone = String(object.preferredSecondaryZone); - if (object.targetInstanceSettings != null) { - if (typeof object.targetInstanceSettings !== "object") - throw TypeError(".google.cloud.sql.v1.PointInTimeRestoreContext.targetInstanceSettings: object expected"); - message.targetInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.targetInstanceSettings); - } - if (object.targetInstanceClearSettingsFieldNames) { - if (!Array.isArray(object.targetInstanceClearSettingsFieldNames)) - throw TypeError(".google.cloud.sql.v1.PointInTimeRestoreContext.targetInstanceClearSettingsFieldNames: array expected"); - message.targetInstanceClearSettingsFieldNames = []; - for (var i = 0; i < object.targetInstanceClearSettingsFieldNames.length; ++i) - message.targetInstanceClearSettingsFieldNames[i] = String(object.targetInstanceClearSettingsFieldNames[i]); - } - if (object.region != null) - message.region = String(object.region); - return message; - }; - - /** - * Creates a plain object from a PointInTimeRestoreContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @static - * @param {google.cloud.sql.v1.PointInTimeRestoreContext} message PointInTimeRestoreContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PointInTimeRestoreContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.targetInstanceClearSettingsFieldNames = []; - if (options.defaults) { - object.pointInTime = null; - object.targetInstanceSettings = null; - } - if (message.datasource != null && message.hasOwnProperty("datasource")) { - object.datasource = message.datasource; - if (options.oneofs) - object._datasource = "datasource"; - } - if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) - object.pointInTime = $root.google.protobuf.Timestamp.toObject(message.pointInTime, options); - if (message.targetInstance != null && message.hasOwnProperty("targetInstance")) { - object.targetInstance = message.targetInstance; - if (options.oneofs) - object._targetInstance = "targetInstance"; - } - if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) { - object.privateNetwork = message.privateNetwork; - if (options.oneofs) - object._privateNetwork = "privateNetwork"; - } - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) { - object.allocatedIpRange = message.allocatedIpRange; - if (options.oneofs) - object._allocatedIpRange = "allocatedIpRange"; - } - if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { - object.preferredZone = message.preferredZone; - if (options.oneofs) - object._preferredZone = "preferredZone"; - } - if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { - object.preferredSecondaryZone = message.preferredSecondaryZone; - if (options.oneofs) - object._preferredSecondaryZone = "preferredSecondaryZone"; - } - if (message.targetInstanceSettings != null && message.hasOwnProperty("targetInstanceSettings")) - object.targetInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.targetInstanceSettings, options); - if (message.targetInstanceClearSettingsFieldNames && message.targetInstanceClearSettingsFieldNames.length) { - object.targetInstanceClearSettingsFieldNames = []; - for (var j = 0; j < message.targetInstanceClearSettingsFieldNames.length; ++j) - object.targetInstanceClearSettingsFieldNames[j] = message.targetInstanceClearSettingsFieldNames[j]; - } - if (message.region != null && message.hasOwnProperty("region")) { - object.region = message.region; - if (options.oneofs) - object._region = "region"; - } - return object; - }; - - /** - * Converts this PointInTimeRestoreContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @instance - * @returns {Object.} JSON object - */ - PointInTimeRestoreContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PointInTimeRestoreContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.PointInTimeRestoreContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PointInTimeRestoreContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.PointInTimeRestoreContext"; - }; - - return PointInTimeRestoreContext; - })(); - - v1.BinLogCoordinates = (function() { - - /** - * Properties of a BinLogCoordinates. - * @memberof google.cloud.sql.v1 - * @interface IBinLogCoordinates - * @property {string|null} [binLogFileName] BinLogCoordinates binLogFileName - * @property {number|Long|null} [binLogPosition] BinLogCoordinates binLogPosition - * @property {string|null} [kind] BinLogCoordinates kind - */ - - /** - * Constructs a new BinLogCoordinates. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a BinLogCoordinates. - * @implements IBinLogCoordinates - * @constructor - * @param {google.cloud.sql.v1.IBinLogCoordinates=} [properties] Properties to set - */ - function BinLogCoordinates(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BinLogCoordinates binLogFileName. - * @member {string} binLogFileName - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @instance - */ - BinLogCoordinates.prototype.binLogFileName = ""; - - /** - * BinLogCoordinates binLogPosition. - * @member {number|Long} binLogPosition - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @instance - */ - BinLogCoordinates.prototype.binLogPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BinLogCoordinates kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @instance - */ - BinLogCoordinates.prototype.kind = ""; - - /** - * Creates a new BinLogCoordinates instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @static - * @param {google.cloud.sql.v1.IBinLogCoordinates=} [properties] Properties to set - * @returns {google.cloud.sql.v1.BinLogCoordinates} BinLogCoordinates instance - */ - BinLogCoordinates.create = function create(properties) { - return new BinLogCoordinates(properties); - }; - - /** - * Encodes the specified BinLogCoordinates message. Does not implicitly {@link google.cloud.sql.v1.BinLogCoordinates.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @static - * @param {google.cloud.sql.v1.IBinLogCoordinates} message BinLogCoordinates message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BinLogCoordinates.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.binLogFileName != null && Object.hasOwnProperty.call(message, "binLogFileName")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.binLogFileName); - if (message.binLogPosition != null && Object.hasOwnProperty.call(message, "binLogPosition")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.binLogPosition); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - return writer; - }; - - /** - * Encodes the specified BinLogCoordinates message, length delimited. Does not implicitly {@link google.cloud.sql.v1.BinLogCoordinates.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @static - * @param {google.cloud.sql.v1.IBinLogCoordinates} message BinLogCoordinates message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BinLogCoordinates.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BinLogCoordinates message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.BinLogCoordinates} BinLogCoordinates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BinLogCoordinates.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.BinLogCoordinates(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.binLogFileName = reader.string(); - break; - } - case 2: { - message.binLogPosition = reader.int64(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BinLogCoordinates message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.BinLogCoordinates} BinLogCoordinates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BinLogCoordinates.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BinLogCoordinates message. - * @function verify - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BinLogCoordinates.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.binLogFileName != null && message.hasOwnProperty("binLogFileName")) - if (!$util.isString(message.binLogFileName)) - return "binLogFileName: string expected"; - if (message.binLogPosition != null && message.hasOwnProperty("binLogPosition")) - if (!$util.isInteger(message.binLogPosition) && !(message.binLogPosition && $util.isInteger(message.binLogPosition.low) && $util.isInteger(message.binLogPosition.high))) - return "binLogPosition: integer|Long expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a BinLogCoordinates message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.BinLogCoordinates} BinLogCoordinates - */ - BinLogCoordinates.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.BinLogCoordinates) - return object; - var message = new $root.google.cloud.sql.v1.BinLogCoordinates(); - if (object.binLogFileName != null) - message.binLogFileName = String(object.binLogFileName); - if (object.binLogPosition != null) - if ($util.Long) - (message.binLogPosition = $util.Long.fromValue(object.binLogPosition)).unsigned = false; - else if (typeof object.binLogPosition === "string") - message.binLogPosition = parseInt(object.binLogPosition, 10); - else if (typeof object.binLogPosition === "number") - message.binLogPosition = object.binLogPosition; - else if (typeof object.binLogPosition === "object") - message.binLogPosition = new $util.LongBits(object.binLogPosition.low >>> 0, object.binLogPosition.high >>> 0).toNumber(); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a BinLogCoordinates message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @static - * @param {google.cloud.sql.v1.BinLogCoordinates} message BinLogCoordinates - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BinLogCoordinates.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.binLogFileName = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.binLogPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.binLogPosition = options.longs === String ? "0" : 0; - object.kind = ""; - } - if (message.binLogFileName != null && message.hasOwnProperty("binLogFileName")) - object.binLogFileName = message.binLogFileName; - if (message.binLogPosition != null && message.hasOwnProperty("binLogPosition")) - if (typeof message.binLogPosition === "number") - object.binLogPosition = options.longs === String ? String(message.binLogPosition) : message.binLogPosition; - else - object.binLogPosition = options.longs === String ? $util.Long.prototype.toString.call(message.binLogPosition) : options.longs === Number ? new $util.LongBits(message.binLogPosition.low >>> 0, message.binLogPosition.high >>> 0).toNumber() : message.binLogPosition; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this BinLogCoordinates to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @instance - * @returns {Object.} JSON object - */ - BinLogCoordinates.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BinLogCoordinates - * @function getTypeUrl - * @memberof google.cloud.sql.v1.BinLogCoordinates - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BinLogCoordinates.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.BinLogCoordinates"; - }; - - return BinLogCoordinates; - })(); - - v1.DatabaseInstance = (function() { - - /** - * Properties of a DatabaseInstance. - * @memberof google.cloud.sql.v1 - * @interface IDatabaseInstance - * @property {string|null} [kind] DatabaseInstance kind - * @property {google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null} [state] DatabaseInstance state - * @property {google.cloud.sql.v1.SqlDatabaseVersion|null} [databaseVersion] DatabaseInstance databaseVersion - * @property {google.cloud.sql.v1.ISettings|null} [settings] DatabaseInstance settings - * @property {string|null} [etag] DatabaseInstance etag - * @property {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica|null} [failoverReplica] DatabaseInstance failoverReplica - * @property {string|null} [masterInstanceName] DatabaseInstance masterInstanceName - * @property {Array.|null} [replicaNames] DatabaseInstance replicaNames - * @property {google.protobuf.IInt64Value|null} [maxDiskSize] DatabaseInstance maxDiskSize - * @property {google.protobuf.IInt64Value|null} [currentDiskSize] DatabaseInstance currentDiskSize - * @property {Array.|null} [ipAddresses] DatabaseInstance ipAddresses - * @property {google.cloud.sql.v1.ISslCert|null} [serverCaCert] DatabaseInstance serverCaCert - * @property {google.cloud.sql.v1.SqlInstanceType|null} [instanceType] DatabaseInstance instanceType - * @property {string|null} [project] DatabaseInstance project - * @property {string|null} [ipv6Address] DatabaseInstance ipv6Address - * @property {string|null} [serviceAccountEmailAddress] DatabaseInstance serviceAccountEmailAddress - * @property {google.cloud.sql.v1.IOnPremisesConfiguration|null} [onPremisesConfiguration] DatabaseInstance onPremisesConfiguration - * @property {google.cloud.sql.v1.IReplicaConfiguration|null} [replicaConfiguration] DatabaseInstance replicaConfiguration - * @property {google.cloud.sql.v1.SqlBackendType|null} [backendType] DatabaseInstance backendType - * @property {string|null} [selfLink] DatabaseInstance selfLink - * @property {Array.|null} [suspensionReason] DatabaseInstance suspensionReason - * @property {string|null} [connectionName] DatabaseInstance connectionName - * @property {string|null} [name] DatabaseInstance name - * @property {string|null} [region] DatabaseInstance region - * @property {string|null} [gceZone] DatabaseInstance gceZone - * @property {string|null} [secondaryGceZone] DatabaseInstance secondaryGceZone - * @property {google.cloud.sql.v1.IDiskEncryptionConfiguration|null} [diskEncryptionConfiguration] DatabaseInstance diskEncryptionConfiguration - * @property {google.cloud.sql.v1.IDiskEncryptionStatus|null} [diskEncryptionStatus] DatabaseInstance diskEncryptionStatus - * @property {string|null} [rootPassword] DatabaseInstance rootPassword - * @property {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance|null} [scheduledMaintenance] DatabaseInstance scheduledMaintenance - * @property {google.protobuf.IBoolValue|null} [satisfiesPzs] DatabaseInstance satisfiesPzs - * @property {string|null} [databaseInstalledVersion] DatabaseInstance databaseInstalledVersion - * @property {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport|null} [outOfDiskReport] DatabaseInstance outOfDiskReport - * @property {google.protobuf.ITimestamp|null} [createTime] DatabaseInstance createTime - * @property {Array.|null} [availableMaintenanceVersions] DatabaseInstance availableMaintenanceVersions - * @property {string|null} [maintenanceVersion] DatabaseInstance maintenanceVersion - * @property {Array.|null} [upgradableDatabaseVersions] DatabaseInstance upgradableDatabaseVersions - * @property {google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|null} [sqlNetworkArchitecture] DatabaseInstance sqlNetworkArchitecture - * @property {string|null} [pscServiceAttachmentLink] DatabaseInstance pscServiceAttachmentLink - * @property {string|null} [dnsName] DatabaseInstance dnsName - * @property {string|null} [primaryDnsName] DatabaseInstance primaryDnsName - * @property {string|null} [writeEndpoint] DatabaseInstance writeEndpoint - * @property {google.cloud.sql.v1.IReplicationCluster|null} [replicationCluster] DatabaseInstance replicationCluster - * @property {google.cloud.sql.v1.IGeminiInstanceConfig|null} [geminiConfig] DatabaseInstance geminiConfig - * @property {google.protobuf.IBoolValue|null} [satisfiesPzi] DatabaseInstance satisfiesPzi - * @property {google.protobuf.IBoolValue|null} [switchTransactionLogsToCloudStorageEnabled] DatabaseInstance switchTransactionLogsToCloudStorageEnabled - * @property {google.protobuf.IBoolValue|null} [includeReplicasForMajorVersionUpgrade] DatabaseInstance includeReplicasForMajorVersionUpgrade - * @property {Object.|null} [tags] DatabaseInstance tags - * @property {number|null} [nodeCount] DatabaseInstance nodeCount - * @property {Array.|null} [nodes] DatabaseInstance nodes - * @property {Array.|null} [dnsNames] DatabaseInstance dnsNames - */ - - /** - * Constructs a new DatabaseInstance. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DatabaseInstance. - * @implements IDatabaseInstance - * @constructor - * @param {google.cloud.sql.v1.IDatabaseInstance=} [properties] Properties to set - */ - function DatabaseInstance(properties) { - this.replicaNames = []; - this.ipAddresses = []; - this.suspensionReason = []; - this.availableMaintenanceVersions = []; - this.upgradableDatabaseVersions = []; - this.tags = {}; - this.nodes = []; - this.dnsNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DatabaseInstance kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.kind = ""; - - /** - * DatabaseInstance state. - * @member {google.cloud.sql.v1.DatabaseInstance.SqlInstanceState} state - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.state = 0; - - /** - * DatabaseInstance databaseVersion. - * @member {google.cloud.sql.v1.SqlDatabaseVersion} databaseVersion - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.databaseVersion = 0; - - /** - * DatabaseInstance settings. - * @member {google.cloud.sql.v1.ISettings|null|undefined} settings - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.settings = null; - - /** - * DatabaseInstance etag. - * @member {string} etag - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.etag = ""; - - /** - * DatabaseInstance failoverReplica. - * @member {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica|null|undefined} failoverReplica - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.failoverReplica = null; - - /** - * DatabaseInstance masterInstanceName. - * @member {string} masterInstanceName - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.masterInstanceName = ""; - - /** - * DatabaseInstance replicaNames. - * @member {Array.} replicaNames - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.replicaNames = $util.emptyArray; - - /** - * DatabaseInstance maxDiskSize. - * @member {google.protobuf.IInt64Value|null|undefined} maxDiskSize - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.maxDiskSize = null; - - /** - * DatabaseInstance currentDiskSize. - * @member {google.protobuf.IInt64Value|null|undefined} currentDiskSize - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.currentDiskSize = null; - - /** - * DatabaseInstance ipAddresses. - * @member {Array.} ipAddresses - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.ipAddresses = $util.emptyArray; - - /** - * DatabaseInstance serverCaCert. - * @member {google.cloud.sql.v1.ISslCert|null|undefined} serverCaCert - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.serverCaCert = null; - - /** - * DatabaseInstance instanceType. - * @member {google.cloud.sql.v1.SqlInstanceType} instanceType - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.instanceType = 0; - - /** - * DatabaseInstance project. - * @member {string} project - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.project = ""; - - /** - * DatabaseInstance ipv6Address. - * @member {string} ipv6Address - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.ipv6Address = ""; - - /** - * DatabaseInstance serviceAccountEmailAddress. - * @member {string} serviceAccountEmailAddress - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.serviceAccountEmailAddress = ""; - - /** - * DatabaseInstance onPremisesConfiguration. - * @member {google.cloud.sql.v1.IOnPremisesConfiguration|null|undefined} onPremisesConfiguration - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.onPremisesConfiguration = null; - - /** - * DatabaseInstance replicaConfiguration. - * @member {google.cloud.sql.v1.IReplicaConfiguration|null|undefined} replicaConfiguration - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.replicaConfiguration = null; - - /** - * DatabaseInstance backendType. - * @member {google.cloud.sql.v1.SqlBackendType} backendType - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.backendType = 0; - - /** - * DatabaseInstance selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.selfLink = ""; - - /** - * DatabaseInstance suspensionReason. - * @member {Array.} suspensionReason - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.suspensionReason = $util.emptyArray; - - /** - * DatabaseInstance connectionName. - * @member {string} connectionName - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.connectionName = ""; - - /** - * DatabaseInstance name. - * @member {string} name - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.name = ""; - - /** - * DatabaseInstance region. - * @member {string} region - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.region = ""; - - /** - * DatabaseInstance gceZone. - * @member {string} gceZone - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.gceZone = ""; - - /** - * DatabaseInstance secondaryGceZone. - * @member {string} secondaryGceZone - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.secondaryGceZone = ""; - - /** - * DatabaseInstance diskEncryptionConfiguration. - * @member {google.cloud.sql.v1.IDiskEncryptionConfiguration|null|undefined} diskEncryptionConfiguration - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.diskEncryptionConfiguration = null; - - /** - * DatabaseInstance diskEncryptionStatus. - * @member {google.cloud.sql.v1.IDiskEncryptionStatus|null|undefined} diskEncryptionStatus - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.diskEncryptionStatus = null; - - /** - * DatabaseInstance rootPassword. - * @member {string} rootPassword - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.rootPassword = ""; - - /** - * DatabaseInstance scheduledMaintenance. - * @member {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance|null|undefined} scheduledMaintenance - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.scheduledMaintenance = null; - - /** - * DatabaseInstance satisfiesPzs. - * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzs - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.satisfiesPzs = null; - - /** - * DatabaseInstance databaseInstalledVersion. - * @member {string} databaseInstalledVersion - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.databaseInstalledVersion = ""; - - /** - * DatabaseInstance outOfDiskReport. - * @member {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport|null|undefined} outOfDiskReport - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.outOfDiskReport = null; - - /** - * DatabaseInstance createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.createTime = null; - - /** - * DatabaseInstance availableMaintenanceVersions. - * @member {Array.} availableMaintenanceVersions - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.availableMaintenanceVersions = $util.emptyArray; - - /** - * DatabaseInstance maintenanceVersion. - * @member {string} maintenanceVersion - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.maintenanceVersion = ""; - - /** - * DatabaseInstance upgradableDatabaseVersions. - * @member {Array.} upgradableDatabaseVersions - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.upgradableDatabaseVersions = $util.emptyArray; - - /** - * DatabaseInstance sqlNetworkArchitecture. - * @member {google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture|null|undefined} sqlNetworkArchitecture - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.sqlNetworkArchitecture = null; - - /** - * DatabaseInstance pscServiceAttachmentLink. - * @member {string|null|undefined} pscServiceAttachmentLink - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.pscServiceAttachmentLink = null; - - /** - * DatabaseInstance dnsName. - * @member {string|null|undefined} dnsName - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.dnsName = null; - - /** - * DatabaseInstance primaryDnsName. - * @member {string|null|undefined} primaryDnsName - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.primaryDnsName = null; - - /** - * DatabaseInstance writeEndpoint. - * @member {string|null|undefined} writeEndpoint - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.writeEndpoint = null; - - /** - * DatabaseInstance replicationCluster. - * @member {google.cloud.sql.v1.IReplicationCluster|null|undefined} replicationCluster - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.replicationCluster = null; - - /** - * DatabaseInstance geminiConfig. - * @member {google.cloud.sql.v1.IGeminiInstanceConfig|null|undefined} geminiConfig - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.geminiConfig = null; - - /** - * DatabaseInstance satisfiesPzi. - * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzi - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.satisfiesPzi = null; - - /** - * DatabaseInstance switchTransactionLogsToCloudStorageEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} switchTransactionLogsToCloudStorageEnabled - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.switchTransactionLogsToCloudStorageEnabled = null; - - /** - * DatabaseInstance includeReplicasForMajorVersionUpgrade. - * @member {google.protobuf.IBoolValue|null|undefined} includeReplicasForMajorVersionUpgrade - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.includeReplicasForMajorVersionUpgrade = null; - - /** - * DatabaseInstance tags. - * @member {Object.} tags - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.tags = $util.emptyObject; - - /** - * DatabaseInstance nodeCount. - * @member {number|null|undefined} nodeCount - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.nodeCount = null; - - /** - * DatabaseInstance nodes. - * @member {Array.} nodes - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.nodes = $util.emptyArray; - - /** - * DatabaseInstance dnsNames. - * @member {Array.} dnsNames - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.dnsNames = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_outOfDiskReport", { - get: $util.oneOfGetter($oneOfFields = ["outOfDiskReport"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_sqlNetworkArchitecture", { - get: $util.oneOfGetter($oneOfFields = ["sqlNetworkArchitecture"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_pscServiceAttachmentLink", { - get: $util.oneOfGetter($oneOfFields = ["pscServiceAttachmentLink"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_dnsName", { - get: $util.oneOfGetter($oneOfFields = ["dnsName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_primaryDnsName", { - get: $util.oneOfGetter($oneOfFields = ["primaryDnsName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_writeEndpoint", { - get: $util.oneOfGetter($oneOfFields = ["writeEndpoint"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_geminiConfig", { - get: $util.oneOfGetter($oneOfFields = ["geminiConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_switchTransactionLogsToCloudStorageEnabled", { - get: $util.oneOfGetter($oneOfFields = ["switchTransactionLogsToCloudStorageEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_includeReplicasForMajorVersionUpgrade", { - get: $util.oneOfGetter($oneOfFields = ["includeReplicasForMajorVersionUpgrade"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_nodeCount", { - get: $util.oneOfGetter($oneOfFields = ["nodeCount"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new DatabaseInstance instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DatabaseInstance - * @static - * @param {google.cloud.sql.v1.IDatabaseInstance=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DatabaseInstance} DatabaseInstance instance - */ - DatabaseInstance.create = function create(properties) { - return new DatabaseInstance(properties); - }; - - /** - * Encodes the specified DatabaseInstance message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DatabaseInstance - * @static - * @param {google.cloud.sql.v1.IDatabaseInstance} message DatabaseInstance message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabaseInstance.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); - if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.databaseVersion); - if (message.settings != null && Object.hasOwnProperty.call(message, "settings")) - $root.google.cloud.sql.v1.Settings.encode(message.settings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.etag); - if (message.failoverReplica != null && Object.hasOwnProperty.call(message, "failoverReplica")) - $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.encode(message.failoverReplica, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.masterInstanceName != null && Object.hasOwnProperty.call(message, "masterInstanceName")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.masterInstanceName); - if (message.replicaNames != null && message.replicaNames.length) - for (var i = 0; i < message.replicaNames.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.replicaNames[i]); - if (message.maxDiskSize != null && Object.hasOwnProperty.call(message, "maxDiskSize")) - $root.google.protobuf.Int64Value.encode(message.maxDiskSize, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.currentDiskSize != null && Object.hasOwnProperty.call(message, "currentDiskSize")) - $root.google.protobuf.Int64Value.encode(message.currentDiskSize, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.ipAddresses != null && message.ipAddresses.length) - for (var i = 0; i < message.ipAddresses.length; ++i) - $root.google.cloud.sql.v1.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) - $root.google.cloud.sql.v1.SslCert.encode(message.serverCaCert, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.instanceType != null && Object.hasOwnProperty.call(message, "instanceType")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.instanceType); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.project); - if (message.ipv6Address != null && Object.hasOwnProperty.call(message, "ipv6Address")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.ipv6Address); - if (message.serviceAccountEmailAddress != null && Object.hasOwnProperty.call(message, "serviceAccountEmailAddress")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.serviceAccountEmailAddress); - if (message.onPremisesConfiguration != null && Object.hasOwnProperty.call(message, "onPremisesConfiguration")) - $root.google.cloud.sql.v1.OnPremisesConfiguration.encode(message.onPremisesConfiguration, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.replicaConfiguration != null && Object.hasOwnProperty.call(message, "replicaConfiguration")) - $root.google.cloud.sql.v1.ReplicaConfiguration.encode(message.replicaConfiguration, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - if (message.backendType != null && Object.hasOwnProperty.call(message, "backendType")) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.backendType); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 20, wireType 2 =*/162).string(message.selfLink); - if (message.suspensionReason != null && message.suspensionReason.length) { - writer.uint32(/* id 21, wireType 2 =*/170).fork(); - for (var i = 0; i < message.suspensionReason.length; ++i) - writer.int32(message.suspensionReason[i]); - writer.ldelim(); - } - if (message.connectionName != null && Object.hasOwnProperty.call(message, "connectionName")) - writer.uint32(/* id 22, wireType 2 =*/178).string(message.connectionName); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.name); - if (message.region != null && Object.hasOwnProperty.call(message, "region")) - writer.uint32(/* id 24, wireType 2 =*/194).string(message.region); - if (message.gceZone != null && Object.hasOwnProperty.call(message, "gceZone")) - writer.uint32(/* id 25, wireType 2 =*/202).string(message.gceZone); - if (message.diskEncryptionConfiguration != null && Object.hasOwnProperty.call(message, "diskEncryptionConfiguration")) - $root.google.cloud.sql.v1.DiskEncryptionConfiguration.encode(message.diskEncryptionConfiguration, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); - if (message.diskEncryptionStatus != null && Object.hasOwnProperty.call(message, "diskEncryptionStatus")) - $root.google.cloud.sql.v1.DiskEncryptionStatus.encode(message.diskEncryptionStatus, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); - if (message.rootPassword != null && Object.hasOwnProperty.call(message, "rootPassword")) - writer.uint32(/* id 29, wireType 2 =*/234).string(message.rootPassword); - if (message.scheduledMaintenance != null && Object.hasOwnProperty.call(message, "scheduledMaintenance")) - $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.encode(message.scheduledMaintenance, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); - if (message.secondaryGceZone != null && Object.hasOwnProperty.call(message, "secondaryGceZone")) - writer.uint32(/* id 34, wireType 2 =*/274).string(message.secondaryGceZone); - if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) - $root.google.protobuf.BoolValue.encode(message.satisfiesPzs, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); - if (message.outOfDiskReport != null && Object.hasOwnProperty.call(message, "outOfDiskReport")) - $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.encode(message.outOfDiskReport, writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); - if (message.databaseInstalledVersion != null && Object.hasOwnProperty.call(message, "databaseInstalledVersion")) - writer.uint32(/* id 40, wireType 2 =*/322).string(message.databaseInstalledVersion); - if (message.availableMaintenanceVersions != null && message.availableMaintenanceVersions.length) - for (var i = 0; i < message.availableMaintenanceVersions.length; ++i) - writer.uint32(/* id 41, wireType 2 =*/330).string(message.availableMaintenanceVersions[i]); - if (message.maintenanceVersion != null && Object.hasOwnProperty.call(message, "maintenanceVersion")) - writer.uint32(/* id 42, wireType 2 =*/338).string(message.maintenanceVersion); - if (message.upgradableDatabaseVersions != null && message.upgradableDatabaseVersions.length) - for (var i = 0; i < message.upgradableDatabaseVersions.length; ++i) - $root.google.cloud.sql.v1.AvailableDatabaseVersion.encode(message.upgradableDatabaseVersions[i], writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); - if (message.sqlNetworkArchitecture != null && Object.hasOwnProperty.call(message, "sqlNetworkArchitecture")) - writer.uint32(/* id 47, wireType 0 =*/376).int32(message.sqlNetworkArchitecture); - if (message.pscServiceAttachmentLink != null && Object.hasOwnProperty.call(message, "pscServiceAttachmentLink")) - writer.uint32(/* id 48, wireType 2 =*/386).string(message.pscServiceAttachmentLink); - if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) - writer.uint32(/* id 49, wireType 2 =*/394).string(message.dnsName); - if (message.primaryDnsName != null && Object.hasOwnProperty.call(message, "primaryDnsName")) - writer.uint32(/* id 51, wireType 2 =*/410).string(message.primaryDnsName); - if (message.writeEndpoint != null && Object.hasOwnProperty.call(message, "writeEndpoint")) - writer.uint32(/* id 52, wireType 2 =*/418).string(message.writeEndpoint); - if (message.replicationCluster != null && Object.hasOwnProperty.call(message, "replicationCluster")) - $root.google.cloud.sql.v1.ReplicationCluster.encode(message.replicationCluster, writer.uint32(/* id 54, wireType 2 =*/434).fork()).ldelim(); - if (message.geminiConfig != null && Object.hasOwnProperty.call(message, "geminiConfig")) - $root.google.cloud.sql.v1.GeminiInstanceConfig.encode(message.geminiConfig, writer.uint32(/* id 55, wireType 2 =*/442).fork()).ldelim(); - if (message.satisfiesPzi != null && Object.hasOwnProperty.call(message, "satisfiesPzi")) - $root.google.protobuf.BoolValue.encode(message.satisfiesPzi, writer.uint32(/* id 56, wireType 2 =*/450).fork()).ldelim(); - if (message.switchTransactionLogsToCloudStorageEnabled != null && Object.hasOwnProperty.call(message, "switchTransactionLogsToCloudStorageEnabled")) - $root.google.protobuf.BoolValue.encode(message.switchTransactionLogsToCloudStorageEnabled, writer.uint32(/* id 57, wireType 2 =*/458).fork()).ldelim(); - if (message.includeReplicasForMajorVersionUpgrade != null && Object.hasOwnProperty.call(message, "includeReplicasForMajorVersionUpgrade")) - $root.google.protobuf.BoolValue.encode(message.includeReplicasForMajorVersionUpgrade, writer.uint32(/* id 59, wireType 2 =*/474).fork()).ldelim(); - if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) - for (var keys = Object.keys(message.tags), i = 0; i < keys.length; ++i) - writer.uint32(/* id 60, wireType 2 =*/482).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.tags[keys[i]]).ldelim(); - if (message.nodeCount != null && Object.hasOwnProperty.call(message, "nodeCount")) - writer.uint32(/* id 63, wireType 0 =*/504).int32(message.nodeCount); - if (message.nodes != null && message.nodes.length) - for (var i = 0; i < message.nodes.length; ++i) - $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.encode(message.nodes[i], writer.uint32(/* id 64, wireType 2 =*/514).fork()).ldelim(); - if (message.dnsNames != null && message.dnsNames.length) - for (var i = 0; i < message.dnsNames.length; ++i) - $root.google.cloud.sql.v1.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 67, wireType 2 =*/538).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DatabaseInstance message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DatabaseInstance - * @static - * @param {google.cloud.sql.v1.IDatabaseInstance} message DatabaseInstance message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabaseInstance.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DatabaseInstance message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DatabaseInstance - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DatabaseInstance} DatabaseInstance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabaseInstance.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseInstance(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.state = reader.int32(); - break; - } - case 3: { - message.databaseVersion = reader.int32(); - break; - } - case 4: { - message.settings = $root.google.cloud.sql.v1.Settings.decode(reader, reader.uint32()); - break; - } - case 5: { - message.etag = reader.string(); - break; - } - case 6: { - message.failoverReplica = $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.decode(reader, reader.uint32()); - break; - } - case 7: { - message.masterInstanceName = reader.string(); - break; - } - case 8: { - if (!(message.replicaNames && message.replicaNames.length)) - message.replicaNames = []; - message.replicaNames.push(reader.string()); - break; - } - case 9: { - message.maxDiskSize = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 10: { - message.currentDiskSize = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 11: { - if (!(message.ipAddresses && message.ipAddresses.length)) - message.ipAddresses = []; - message.ipAddresses.push($root.google.cloud.sql.v1.IpMapping.decode(reader, reader.uint32())); - break; - } - case 12: { - message.serverCaCert = $root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32()); - break; - } - case 13: { - message.instanceType = reader.int32(); - break; - } - case 14: { - message.project = reader.string(); - break; - } - case 15: { - message.ipv6Address = reader.string(); - break; - } - case 16: { - message.serviceAccountEmailAddress = reader.string(); - break; - } - case 17: { - message.onPremisesConfiguration = $root.google.cloud.sql.v1.OnPremisesConfiguration.decode(reader, reader.uint32()); - break; - } - case 18: { - message.replicaConfiguration = $root.google.cloud.sql.v1.ReplicaConfiguration.decode(reader, reader.uint32()); - break; - } - case 19: { - message.backendType = reader.int32(); - break; - } - case 20: { - message.selfLink = reader.string(); - break; - } - case 21: { - if (!(message.suspensionReason && message.suspensionReason.length)) - message.suspensionReason = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.suspensionReason.push(reader.int32()); - } else - message.suspensionReason.push(reader.int32()); - break; - } - case 22: { - message.connectionName = reader.string(); - break; - } - case 23: { - message.name = reader.string(); - break; - } - case 24: { - message.region = reader.string(); - break; - } - case 25: { - message.gceZone = reader.string(); - break; - } - case 34: { - message.secondaryGceZone = reader.string(); - break; - } - case 26: { - message.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.decode(reader, reader.uint32()); - break; - } - case 27: { - message.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.decode(reader, reader.uint32()); - break; - } - case 29: { - message.rootPassword = reader.string(); - break; - } - case 30: { - message.scheduledMaintenance = $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.decode(reader, reader.uint32()); - break; - } - case 35: { - message.satisfiesPzs = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 40: { - message.databaseInstalledVersion = reader.string(); - break; - } - case 38: { - message.outOfDiskReport = $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.decode(reader, reader.uint32()); - break; - } - case 39: { - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 41: { - if (!(message.availableMaintenanceVersions && message.availableMaintenanceVersions.length)) - message.availableMaintenanceVersions = []; - message.availableMaintenanceVersions.push(reader.string()); - break; - } - case 42: { - message.maintenanceVersion = reader.string(); - break; - } - case 45: { - if (!(message.upgradableDatabaseVersions && message.upgradableDatabaseVersions.length)) - message.upgradableDatabaseVersions = []; - message.upgradableDatabaseVersions.push($root.google.cloud.sql.v1.AvailableDatabaseVersion.decode(reader, reader.uint32())); - break; - } - case 47: { - message.sqlNetworkArchitecture = reader.int32(); - break; - } - case 48: { - message.pscServiceAttachmentLink = reader.string(); - break; - } - case 49: { - message.dnsName = reader.string(); - break; - } - case 51: { - message.primaryDnsName = reader.string(); - break; - } - case 52: { - message.writeEndpoint = reader.string(); - break; - } - case 54: { - message.replicationCluster = $root.google.cloud.sql.v1.ReplicationCluster.decode(reader, reader.uint32()); - break; - } - case 55: { - message.geminiConfig = $root.google.cloud.sql.v1.GeminiInstanceConfig.decode(reader, reader.uint32()); - break; - } - case 56: { - message.satisfiesPzi = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 57: { - message.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 59: { - message.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 60: { - if (message.tags === $util.emptyObject) - message.tags = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.tags[key] = value; - break; - } - case 63: { - message.nodeCount = reader.int32(); - break; - } - case 64: { - if (!(message.nodes && message.nodes.length)) - message.nodes = []; - message.nodes.push($root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.decode(reader, reader.uint32())); - break; - } - case 67: { - if (!(message.dnsNames && message.dnsNames.length)) - message.dnsNames = []; - message.dnsNames.push($root.google.cloud.sql.v1.DnsNameMapping.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DatabaseInstance message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DatabaseInstance - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DatabaseInstance} DatabaseInstance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabaseInstance.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DatabaseInstance message. - * @function verify - * @memberof google.cloud.sql.v1.DatabaseInstance - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DatabaseInstance.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - break; - } - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - switch (message.databaseVersion) { - default: - return "databaseVersion: enum value expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 684: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - case 549: - case 550: - case 551: - break; - } - if (message.settings != null && message.hasOwnProperty("settings")) { - var error = $root.google.cloud.sql.v1.Settings.verify(message.settings); - if (error) - return "settings." + error; - } - if (message.etag != null && message.hasOwnProperty("etag")) - if (!$util.isString(message.etag)) - return "etag: string expected"; - if (message.failoverReplica != null && message.hasOwnProperty("failoverReplica")) { - var error = $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.verify(message.failoverReplica); - if (error) - return "failoverReplica." + error; - } - if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) - if (!$util.isString(message.masterInstanceName)) - return "masterInstanceName: string expected"; - if (message.replicaNames != null && message.hasOwnProperty("replicaNames")) { - if (!Array.isArray(message.replicaNames)) - return "replicaNames: array expected"; - for (var i = 0; i < message.replicaNames.length; ++i) - if (!$util.isString(message.replicaNames[i])) - return "replicaNames: string[] expected"; - } - if (message.maxDiskSize != null && message.hasOwnProperty("maxDiskSize")) { - var error = $root.google.protobuf.Int64Value.verify(message.maxDiskSize); - if (error) - return "maxDiskSize." + error; - } - if (message.currentDiskSize != null && message.hasOwnProperty("currentDiskSize")) { - var error = $root.google.protobuf.Int64Value.verify(message.currentDiskSize); - if (error) - return "currentDiskSize." + error; - } - if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { - if (!Array.isArray(message.ipAddresses)) - return "ipAddresses: array expected"; - for (var i = 0; i < message.ipAddresses.length; ++i) { - var error = $root.google.cloud.sql.v1.IpMapping.verify(message.ipAddresses[i]); - if (error) - return "ipAddresses." + error; - } - } - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { - var error = $root.google.cloud.sql.v1.SslCert.verify(message.serverCaCert); - if (error) - return "serverCaCert." + error; - } - if (message.instanceType != null && message.hasOwnProperty("instanceType")) - switch (message.instanceType) { - default: - return "instanceType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 5: - break; - } - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.ipv6Address != null && message.hasOwnProperty("ipv6Address")) - if (!$util.isString(message.ipv6Address)) - return "ipv6Address: string expected"; - if (message.serviceAccountEmailAddress != null && message.hasOwnProperty("serviceAccountEmailAddress")) - if (!$util.isString(message.serviceAccountEmailAddress)) - return "serviceAccountEmailAddress: string expected"; - if (message.onPremisesConfiguration != null && message.hasOwnProperty("onPremisesConfiguration")) { - var error = $root.google.cloud.sql.v1.OnPremisesConfiguration.verify(message.onPremisesConfiguration); - if (error) - return "onPremisesConfiguration." + error; - } - if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) { - var error = $root.google.cloud.sql.v1.ReplicaConfiguration.verify(message.replicaConfiguration); - if (error) - return "replicaConfiguration." + error; - } - if (message.backendType != null && message.hasOwnProperty("backendType")) - switch (message.backendType) { - default: - return "backendType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.suspensionReason != null && message.hasOwnProperty("suspensionReason")) { - if (!Array.isArray(message.suspensionReason)) - return "suspensionReason: array expected"; - for (var i = 0; i < message.suspensionReason.length; ++i) - switch (message.suspensionReason[i]) { - default: - return "suspensionReason: enum value[] expected"; - case 0: - case 2: - case 3: - case 4: - case 5: - case 8: - break; - } - } - if (message.connectionName != null && message.hasOwnProperty("connectionName")) - if (!$util.isString(message.connectionName)) - return "connectionName: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.region != null && message.hasOwnProperty("region")) - if (!$util.isString(message.region)) - return "region: string expected"; - if (message.gceZone != null && message.hasOwnProperty("gceZone")) - if (!$util.isString(message.gceZone)) - return "gceZone: string expected"; - if (message.secondaryGceZone != null && message.hasOwnProperty("secondaryGceZone")) - if (!$util.isString(message.secondaryGceZone)) - return "secondaryGceZone: string expected"; - if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) { - var error = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.verify(message.diskEncryptionConfiguration); - if (error) - return "diskEncryptionConfiguration." + error; - } - if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) { - var error = $root.google.cloud.sql.v1.DiskEncryptionStatus.verify(message.diskEncryptionStatus); - if (error) - return "diskEncryptionStatus." + error; - } - if (message.rootPassword != null && message.hasOwnProperty("rootPassword")) - if (!$util.isString(message.rootPassword)) - return "rootPassword: string expected"; - if (message.scheduledMaintenance != null && message.hasOwnProperty("scheduledMaintenance")) { - var error = $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.verify(message.scheduledMaintenance); - if (error) - return "scheduledMaintenance." + error; - } - if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) { - var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzs); - if (error) - return "satisfiesPzs." + error; - } - if (message.databaseInstalledVersion != null && message.hasOwnProperty("databaseInstalledVersion")) - if (!$util.isString(message.databaseInstalledVersion)) - return "databaseInstalledVersion: string expected"; - if (message.outOfDiskReport != null && message.hasOwnProperty("outOfDiskReport")) { - properties._outOfDiskReport = 1; - { - var error = $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.verify(message.outOfDiskReport); - if (error) - return "outOfDiskReport." + error; - } - } - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.availableMaintenanceVersions != null && message.hasOwnProperty("availableMaintenanceVersions")) { - if (!Array.isArray(message.availableMaintenanceVersions)) - return "availableMaintenanceVersions: array expected"; - for (var i = 0; i < message.availableMaintenanceVersions.length; ++i) - if (!$util.isString(message.availableMaintenanceVersions[i])) - return "availableMaintenanceVersions: string[] expected"; - } - if (message.maintenanceVersion != null && message.hasOwnProperty("maintenanceVersion")) - if (!$util.isString(message.maintenanceVersion)) - return "maintenanceVersion: string expected"; - if (message.upgradableDatabaseVersions != null && message.hasOwnProperty("upgradableDatabaseVersions")) { - if (!Array.isArray(message.upgradableDatabaseVersions)) - return "upgradableDatabaseVersions: array expected"; - for (var i = 0; i < message.upgradableDatabaseVersions.length; ++i) { - var error = $root.google.cloud.sql.v1.AvailableDatabaseVersion.verify(message.upgradableDatabaseVersions[i]); - if (error) - return "upgradableDatabaseVersions." + error; - } - } - if (message.sqlNetworkArchitecture != null && message.hasOwnProperty("sqlNetworkArchitecture")) { - properties._sqlNetworkArchitecture = 1; - switch (message.sqlNetworkArchitecture) { - default: - return "sqlNetworkArchitecture: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { - properties._pscServiceAttachmentLink = 1; - if (!$util.isString(message.pscServiceAttachmentLink)) - return "pscServiceAttachmentLink: string expected"; - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - properties._dnsName = 1; - if (!$util.isString(message.dnsName)) - return "dnsName: string expected"; - } - if (message.primaryDnsName != null && message.hasOwnProperty("primaryDnsName")) { - properties._primaryDnsName = 1; - if (!$util.isString(message.primaryDnsName)) - return "primaryDnsName: string expected"; - } - if (message.writeEndpoint != null && message.hasOwnProperty("writeEndpoint")) { - properties._writeEndpoint = 1; - if (!$util.isString(message.writeEndpoint)) - return "writeEndpoint: string expected"; - } - if (message.replicationCluster != null && message.hasOwnProperty("replicationCluster")) { - var error = $root.google.cloud.sql.v1.ReplicationCluster.verify(message.replicationCluster); - if (error) - return "replicationCluster." + error; - } - if (message.geminiConfig != null && message.hasOwnProperty("geminiConfig")) { - properties._geminiConfig = 1; - { - var error = $root.google.cloud.sql.v1.GeminiInstanceConfig.verify(message.geminiConfig); - if (error) - return "geminiConfig." + error; - } - } - if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) { - var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzi); - if (error) - return "satisfiesPzi." + error; - } - if (message.switchTransactionLogsToCloudStorageEnabled != null && message.hasOwnProperty("switchTransactionLogsToCloudStorageEnabled")) { - properties._switchTransactionLogsToCloudStorageEnabled = 1; - { - var error = $root.google.protobuf.BoolValue.verify(message.switchTransactionLogsToCloudStorageEnabled); - if (error) - return "switchTransactionLogsToCloudStorageEnabled." + error; - } - } - if (message.includeReplicasForMajorVersionUpgrade != null && message.hasOwnProperty("includeReplicasForMajorVersionUpgrade")) { - properties._includeReplicasForMajorVersionUpgrade = 1; - { - var error = $root.google.protobuf.BoolValue.verify(message.includeReplicasForMajorVersionUpgrade); - if (error) - return "includeReplicasForMajorVersionUpgrade." + error; - } - } - if (message.tags != null && message.hasOwnProperty("tags")) { - if (!$util.isObject(message.tags)) - return "tags: object expected"; - var key = Object.keys(message.tags); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.tags[key[i]])) - return "tags: string{k:string} expected"; - } - if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { - properties._nodeCount = 1; - if (!$util.isInteger(message.nodeCount)) - return "nodeCount: integer expected"; - } - if (message.nodes != null && message.hasOwnProperty("nodes")) { - if (!Array.isArray(message.nodes)) - return "nodes: array expected"; - for (var i = 0; i < message.nodes.length; ++i) { - var error = $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.verify(message.nodes[i]); - if (error) - return "nodes." + error; - } - } - if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { - if (!Array.isArray(message.dnsNames)) - return "dnsNames: array expected"; - for (var i = 0; i < message.dnsNames.length; ++i) { - var error = $root.google.cloud.sql.v1.DnsNameMapping.verify(message.dnsNames[i]); - if (error) - return "dnsNames." + error; - } - } - return null; - }; - - /** - * Creates a DatabaseInstance message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DatabaseInstance - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DatabaseInstance} DatabaseInstance - */ - DatabaseInstance.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DatabaseInstance) - return object; - var message = new $root.google.cloud.sql.v1.DatabaseInstance(); - if (object.kind != null) - message.kind = String(object.kind); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "SQL_INSTANCE_STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNABLE": - case 1: - message.state = 1; - break; - case "SUSPENDED": - case 2: - message.state = 2; - break; - case "PENDING_DELETE": - case 3: - message.state = 3; - break; - case "PENDING_CREATE": - case 4: - message.state = 4; - break; - case "MAINTENANCE": - case 5: - message.state = 5; - break; - case "FAILED": - case 6: - message.state = 6; - break; - case "ONLINE_MAINTENANCE": - case 7: - message.state = 7; - break; - case "REPAIRING": - case 8: - message.state = 8; - break; - } - switch (object.databaseVersion) { - default: - if (typeof object.databaseVersion === "number") { - message.databaseVersion = object.databaseVersion; - break; - } - break; - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.databaseVersion = 0; - break; - case "MYSQL_5_1": - case 2: - message.databaseVersion = 2; - break; - case "MYSQL_5_5": - case 3: - message.databaseVersion = 3; - break; - case "MYSQL_5_6": - case 5: - message.databaseVersion = 5; - break; - case "MYSQL_5_7": - case 6: - message.databaseVersion = 6; - break; - case "MYSQL_8_0": - case 20: - message.databaseVersion = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.databaseVersion = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.databaseVersion = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.databaseVersion = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.databaseVersion = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.databaseVersion = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.databaseVersion = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.databaseVersion = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.databaseVersion = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.databaseVersion = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.databaseVersion = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.databaseVersion = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.databaseVersion = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.databaseVersion = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.databaseVersion = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.databaseVersion = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.databaseVersion = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.databaseVersion = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.databaseVersion = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.databaseVersion = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.databaseVersion = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.databaseVersion = 556; - break; - case "MYSQL_8_4": - case 398: - message.databaseVersion = 398; - break; - case "MYSQL_9_7": - case 654: - message.databaseVersion = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.databaseVersion = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.databaseVersion = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.databaseVersion = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.databaseVersion = 16; - break; - case "POSTGRES_9_6": - case 9: - message.databaseVersion = 9; - break; - case "POSTGRES_10": - case 18: - message.databaseVersion = 18; - break; - case "POSTGRES_11": - case 10: - message.databaseVersion = 10; - break; - case "POSTGRES_12": - case 19: - message.databaseVersion = 19; - break; - case "POSTGRES_13": - case 23: - message.databaseVersion = 23; - break; - case "POSTGRES_14": - case 110: - message.databaseVersion = 110; - break; - case "POSTGRES_15": - case 172: - message.databaseVersion = 172; - break; - case "POSTGRES_16": - case 272: - message.databaseVersion = 272; - break; - case "POSTGRES_17": - case 408: - message.databaseVersion = 408; - break; - case "POSTGRES_18": - case 557: - message.databaseVersion = 557; - break; - case "POSTGRES_19": - case 684: - message.databaseVersion = 684; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.databaseVersion = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.databaseVersion = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.databaseVersion = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.databaseVersion = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.databaseVersion = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.databaseVersion = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.databaseVersion = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.databaseVersion = 202; - break; - case "SQLSERVER_2025_STANDARD": - case 549: - message.databaseVersion = 549; - break; - case "SQLSERVER_2025_ENTERPRISE": - case 550: - message.databaseVersion = 550; - break; - case "SQLSERVER_2025_EXPRESS": - case 551: - message.databaseVersion = 551; - break; - } - if (object.settings != null) { - if (typeof object.settings !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.settings: object expected"); - message.settings = $root.google.cloud.sql.v1.Settings.fromObject(object.settings); - } - if (object.etag != null) - message.etag = String(object.etag); - if (object.failoverReplica != null) { - if (typeof object.failoverReplica !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.failoverReplica: object expected"); - message.failoverReplica = $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.fromObject(object.failoverReplica); - } - if (object.masterInstanceName != null) - message.masterInstanceName = String(object.masterInstanceName); - if (object.replicaNames) { - if (!Array.isArray(object.replicaNames)) - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.replicaNames: array expected"); - message.replicaNames = []; - for (var i = 0; i < object.replicaNames.length; ++i) - message.replicaNames[i] = String(object.replicaNames[i]); - } - if (object.maxDiskSize != null) { - if (typeof object.maxDiskSize !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.maxDiskSize: object expected"); - message.maxDiskSize = $root.google.protobuf.Int64Value.fromObject(object.maxDiskSize); - } - if (object.currentDiskSize != null) { - if (typeof object.currentDiskSize !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.currentDiskSize: object expected"); - message.currentDiskSize = $root.google.protobuf.Int64Value.fromObject(object.currentDiskSize); - } - if (object.ipAddresses) { - if (!Array.isArray(object.ipAddresses)) - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.ipAddresses: array expected"); - message.ipAddresses = []; - for (var i = 0; i < object.ipAddresses.length; ++i) { - if (typeof object.ipAddresses[i] !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.ipAddresses: object expected"); - message.ipAddresses[i] = $root.google.cloud.sql.v1.IpMapping.fromObject(object.ipAddresses[i]); - } - } - if (object.serverCaCert != null) { - if (typeof object.serverCaCert !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.serverCaCert: object expected"); - message.serverCaCert = $root.google.cloud.sql.v1.SslCert.fromObject(object.serverCaCert); - } - switch (object.instanceType) { - default: - if (typeof object.instanceType === "number") { - message.instanceType = object.instanceType; - break; - } - break; - case "SQL_INSTANCE_TYPE_UNSPECIFIED": - case 0: - message.instanceType = 0; - break; - case "CLOUD_SQL_INSTANCE": - case 1: - message.instanceType = 1; - break; - case "ON_PREMISES_INSTANCE": - case 2: - message.instanceType = 2; - break; - case "READ_REPLICA_INSTANCE": - case 3: - message.instanceType = 3; - break; - case "READ_POOL_INSTANCE": - case 5: - message.instanceType = 5; - break; - } - if (object.project != null) - message.project = String(object.project); - if (object.ipv6Address != null) - message.ipv6Address = String(object.ipv6Address); - if (object.serviceAccountEmailAddress != null) - message.serviceAccountEmailAddress = String(object.serviceAccountEmailAddress); - if (object.onPremisesConfiguration != null) { - if (typeof object.onPremisesConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.onPremisesConfiguration: object expected"); - message.onPremisesConfiguration = $root.google.cloud.sql.v1.OnPremisesConfiguration.fromObject(object.onPremisesConfiguration); - } - if (object.replicaConfiguration != null) { - if (typeof object.replicaConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.replicaConfiguration: object expected"); - message.replicaConfiguration = $root.google.cloud.sql.v1.ReplicaConfiguration.fromObject(object.replicaConfiguration); - } - switch (object.backendType) { - default: - if (typeof object.backendType === "number") { - message.backendType = object.backendType; - break; - } - break; - case "SQL_BACKEND_TYPE_UNSPECIFIED": - case 0: - message.backendType = 0; - break; - case "FIRST_GEN": - case 1: - message.backendType = 1; - break; - case "SECOND_GEN": - case 2: - message.backendType = 2; - break; - case "EXTERNAL": - case 3: - message.backendType = 3; - break; - } - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - if (object.suspensionReason) { - if (!Array.isArray(object.suspensionReason)) - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.suspensionReason: array expected"); - message.suspensionReason = []; - for (var i = 0; i < object.suspensionReason.length; ++i) - switch (object.suspensionReason[i]) { - default: - if (typeof object.suspensionReason[i] === "number") { - message.suspensionReason[i] = object.suspensionReason[i]; - break; - } - case "SQL_SUSPENSION_REASON_UNSPECIFIED": - case 0: - message.suspensionReason[i] = 0; - break; - case "BILLING_ISSUE": - case 2: - message.suspensionReason[i] = 2; - break; - case "LEGAL_ISSUE": - case 3: - message.suspensionReason[i] = 3; - break; - case "OPERATIONAL_ISSUE": - case 4: - message.suspensionReason[i] = 4; - break; - case "KMS_KEY_ISSUE": - case 5: - message.suspensionReason[i] = 5; - break; - case "PROJECT_ABUSE": - case 8: - message.suspensionReason[i] = 8; - break; - } - } - if (object.connectionName != null) - message.connectionName = String(object.connectionName); - if (object.name != null) - message.name = String(object.name); - if (object.region != null) - message.region = String(object.region); - if (object.gceZone != null) - message.gceZone = String(object.gceZone); - if (object.secondaryGceZone != null) - message.secondaryGceZone = String(object.secondaryGceZone); - if (object.diskEncryptionConfiguration != null) { - if (typeof object.diskEncryptionConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.diskEncryptionConfiguration: object expected"); - message.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.fromObject(object.diskEncryptionConfiguration); - } - if (object.diskEncryptionStatus != null) { - if (typeof object.diskEncryptionStatus !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.diskEncryptionStatus: object expected"); - message.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.fromObject(object.diskEncryptionStatus); - } - if (object.rootPassword != null) - message.rootPassword = String(object.rootPassword); - if (object.scheduledMaintenance != null) { - if (typeof object.scheduledMaintenance !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.scheduledMaintenance: object expected"); - message.scheduledMaintenance = $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.fromObject(object.scheduledMaintenance); - } - if (object.satisfiesPzs != null) { - if (typeof object.satisfiesPzs !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.satisfiesPzs: object expected"); - message.satisfiesPzs = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzs); - } - if (object.databaseInstalledVersion != null) - message.databaseInstalledVersion = String(object.databaseInstalledVersion); - if (object.outOfDiskReport != null) { - if (typeof object.outOfDiskReport !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.outOfDiskReport: object expected"); - message.outOfDiskReport = $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.fromObject(object.outOfDiskReport); - } - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.availableMaintenanceVersions) { - if (!Array.isArray(object.availableMaintenanceVersions)) - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.availableMaintenanceVersions: array expected"); - message.availableMaintenanceVersions = []; - for (var i = 0; i < object.availableMaintenanceVersions.length; ++i) - message.availableMaintenanceVersions[i] = String(object.availableMaintenanceVersions[i]); - } - if (object.maintenanceVersion != null) - message.maintenanceVersion = String(object.maintenanceVersion); - if (object.upgradableDatabaseVersions) { - if (!Array.isArray(object.upgradableDatabaseVersions)) - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.upgradableDatabaseVersions: array expected"); - message.upgradableDatabaseVersions = []; - for (var i = 0; i < object.upgradableDatabaseVersions.length; ++i) { - if (typeof object.upgradableDatabaseVersions[i] !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.upgradableDatabaseVersions: object expected"); - message.upgradableDatabaseVersions[i] = $root.google.cloud.sql.v1.AvailableDatabaseVersion.fromObject(object.upgradableDatabaseVersions[i]); - } - } - switch (object.sqlNetworkArchitecture) { - default: - if (typeof object.sqlNetworkArchitecture === "number") { - message.sqlNetworkArchitecture = object.sqlNetworkArchitecture; - break; - } - break; - case "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED": - case 0: - message.sqlNetworkArchitecture = 0; - break; - case "NEW_NETWORK_ARCHITECTURE": - case 1: - message.sqlNetworkArchitecture = 1; - break; - case "OLD_NETWORK_ARCHITECTURE": - case 2: - message.sqlNetworkArchitecture = 2; - break; - } - if (object.pscServiceAttachmentLink != null) - message.pscServiceAttachmentLink = String(object.pscServiceAttachmentLink); - if (object.dnsName != null) - message.dnsName = String(object.dnsName); - if (object.primaryDnsName != null) - message.primaryDnsName = String(object.primaryDnsName); - if (object.writeEndpoint != null) - message.writeEndpoint = String(object.writeEndpoint); - if (object.replicationCluster != null) { - if (typeof object.replicationCluster !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.replicationCluster: object expected"); - message.replicationCluster = $root.google.cloud.sql.v1.ReplicationCluster.fromObject(object.replicationCluster); - } - if (object.geminiConfig != null) { - if (typeof object.geminiConfig !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.geminiConfig: object expected"); - message.geminiConfig = $root.google.cloud.sql.v1.GeminiInstanceConfig.fromObject(object.geminiConfig); - } - if (object.satisfiesPzi != null) { - if (typeof object.satisfiesPzi !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.satisfiesPzi: object expected"); - message.satisfiesPzi = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzi); - } - if (object.switchTransactionLogsToCloudStorageEnabled != null) { - if (typeof object.switchTransactionLogsToCloudStorageEnabled !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.switchTransactionLogsToCloudStorageEnabled: object expected"); - message.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.fromObject(object.switchTransactionLogsToCloudStorageEnabled); - } - if (object.includeReplicasForMajorVersionUpgrade != null) { - if (typeof object.includeReplicasForMajorVersionUpgrade !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.includeReplicasForMajorVersionUpgrade: object expected"); - message.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.fromObject(object.includeReplicasForMajorVersionUpgrade); - } - if (object.tags) { - if (typeof object.tags !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.tags: object expected"); - message.tags = {}; - for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) - message.tags[keys[i]] = String(object.tags[keys[i]]); - } - if (object.nodeCount != null) - message.nodeCount = object.nodeCount | 0; - if (object.nodes) { - if (!Array.isArray(object.nodes)) - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.nodes: array expected"); - message.nodes = []; - for (var i = 0; i < object.nodes.length; ++i) { - if (typeof object.nodes[i] !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.nodes: object expected"); - message.nodes[i] = $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.fromObject(object.nodes[i]); - } - } - if (object.dnsNames) { - if (!Array.isArray(object.dnsNames)) - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.dnsNames: array expected"); - message.dnsNames = []; - for (var i = 0; i < object.dnsNames.length; ++i) { - if (typeof object.dnsNames[i] !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.dnsNames: object expected"); - message.dnsNames[i] = $root.google.cloud.sql.v1.DnsNameMapping.fromObject(object.dnsNames[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a DatabaseInstance message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DatabaseInstance - * @static - * @param {google.cloud.sql.v1.DatabaseInstance} message DatabaseInstance - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DatabaseInstance.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.replicaNames = []; - object.ipAddresses = []; - object.suspensionReason = []; - object.availableMaintenanceVersions = []; - object.upgradableDatabaseVersions = []; - object.nodes = []; - object.dnsNames = []; - } - if (options.objects || options.defaults) - object.tags = {}; - if (options.defaults) { - object.kind = ""; - object.state = options.enums === String ? "SQL_INSTANCE_STATE_UNSPECIFIED" : 0; - object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; - object.settings = null; - object.etag = ""; - object.failoverReplica = null; - object.masterInstanceName = ""; - object.maxDiskSize = null; - object.currentDiskSize = null; - object.serverCaCert = null; - object.instanceType = options.enums === String ? "SQL_INSTANCE_TYPE_UNSPECIFIED" : 0; - object.project = ""; - object.ipv6Address = ""; - object.serviceAccountEmailAddress = ""; - object.onPremisesConfiguration = null; - object.replicaConfiguration = null; - object.backendType = options.enums === String ? "SQL_BACKEND_TYPE_UNSPECIFIED" : 0; - object.selfLink = ""; - object.connectionName = ""; - object.name = ""; - object.region = ""; - object.gceZone = ""; - object.diskEncryptionConfiguration = null; - object.diskEncryptionStatus = null; - object.rootPassword = ""; - object.scheduledMaintenance = null; - object.secondaryGceZone = ""; - object.satisfiesPzs = null; - object.createTime = null; - object.databaseInstalledVersion = ""; - object.maintenanceVersion = ""; - object.replicationCluster = null; - object.satisfiesPzi = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.sql.v1.DatabaseInstance.SqlInstanceState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1.DatabaseInstance.SqlInstanceState[message.state] : message.state; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; - if (message.settings != null && message.hasOwnProperty("settings")) - object.settings = $root.google.cloud.sql.v1.Settings.toObject(message.settings, options); - if (message.etag != null && message.hasOwnProperty("etag")) - object.etag = message.etag; - if (message.failoverReplica != null && message.hasOwnProperty("failoverReplica")) - object.failoverReplica = $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.toObject(message.failoverReplica, options); - if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) - object.masterInstanceName = message.masterInstanceName; - if (message.replicaNames && message.replicaNames.length) { - object.replicaNames = []; - for (var j = 0; j < message.replicaNames.length; ++j) - object.replicaNames[j] = message.replicaNames[j]; - } - if (message.maxDiskSize != null && message.hasOwnProperty("maxDiskSize")) - object.maxDiskSize = $root.google.protobuf.Int64Value.toObject(message.maxDiskSize, options); - if (message.currentDiskSize != null && message.hasOwnProperty("currentDiskSize")) - object.currentDiskSize = $root.google.protobuf.Int64Value.toObject(message.currentDiskSize, options); - if (message.ipAddresses && message.ipAddresses.length) { - object.ipAddresses = []; - for (var j = 0; j < message.ipAddresses.length; ++j) - object.ipAddresses[j] = $root.google.cloud.sql.v1.IpMapping.toObject(message.ipAddresses[j], options); - } - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) - object.serverCaCert = $root.google.cloud.sql.v1.SslCert.toObject(message.serverCaCert, options); - if (message.instanceType != null && message.hasOwnProperty("instanceType")) - object.instanceType = options.enums === String ? $root.google.cloud.sql.v1.SqlInstanceType[message.instanceType] === undefined ? message.instanceType : $root.google.cloud.sql.v1.SqlInstanceType[message.instanceType] : message.instanceType; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.ipv6Address != null && message.hasOwnProperty("ipv6Address")) - object.ipv6Address = message.ipv6Address; - if (message.serviceAccountEmailAddress != null && message.hasOwnProperty("serviceAccountEmailAddress")) - object.serviceAccountEmailAddress = message.serviceAccountEmailAddress; - if (message.onPremisesConfiguration != null && message.hasOwnProperty("onPremisesConfiguration")) - object.onPremisesConfiguration = $root.google.cloud.sql.v1.OnPremisesConfiguration.toObject(message.onPremisesConfiguration, options); - if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) - object.replicaConfiguration = $root.google.cloud.sql.v1.ReplicaConfiguration.toObject(message.replicaConfiguration, options); - if (message.backendType != null && message.hasOwnProperty("backendType")) - object.backendType = options.enums === String ? $root.google.cloud.sql.v1.SqlBackendType[message.backendType] === undefined ? message.backendType : $root.google.cloud.sql.v1.SqlBackendType[message.backendType] : message.backendType; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.suspensionReason && message.suspensionReason.length) { - object.suspensionReason = []; - for (var j = 0; j < message.suspensionReason.length; ++j) - object.suspensionReason[j] = options.enums === String ? $root.google.cloud.sql.v1.SqlSuspensionReason[message.suspensionReason[j]] === undefined ? message.suspensionReason[j] : $root.google.cloud.sql.v1.SqlSuspensionReason[message.suspensionReason[j]] : message.suspensionReason[j]; - } - if (message.connectionName != null && message.hasOwnProperty("connectionName")) - object.connectionName = message.connectionName; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.region != null && message.hasOwnProperty("region")) - object.region = message.region; - if (message.gceZone != null && message.hasOwnProperty("gceZone")) - object.gceZone = message.gceZone; - if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) - object.diskEncryptionConfiguration = $root.google.cloud.sql.v1.DiskEncryptionConfiguration.toObject(message.diskEncryptionConfiguration, options); - if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) - object.diskEncryptionStatus = $root.google.cloud.sql.v1.DiskEncryptionStatus.toObject(message.diskEncryptionStatus, options); - if (message.rootPassword != null && message.hasOwnProperty("rootPassword")) - object.rootPassword = message.rootPassword; - if (message.scheduledMaintenance != null && message.hasOwnProperty("scheduledMaintenance")) - object.scheduledMaintenance = $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.toObject(message.scheduledMaintenance, options); - if (message.secondaryGceZone != null && message.hasOwnProperty("secondaryGceZone")) - object.secondaryGceZone = message.secondaryGceZone; - if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) - object.satisfiesPzs = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzs, options); - if (message.outOfDiskReport != null && message.hasOwnProperty("outOfDiskReport")) { - object.outOfDiskReport = $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.toObject(message.outOfDiskReport, options); - if (options.oneofs) - object._outOfDiskReport = "outOfDiskReport"; - } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.databaseInstalledVersion != null && message.hasOwnProperty("databaseInstalledVersion")) - object.databaseInstalledVersion = message.databaseInstalledVersion; - if (message.availableMaintenanceVersions && message.availableMaintenanceVersions.length) { - object.availableMaintenanceVersions = []; - for (var j = 0; j < message.availableMaintenanceVersions.length; ++j) - object.availableMaintenanceVersions[j] = message.availableMaintenanceVersions[j]; - } - if (message.maintenanceVersion != null && message.hasOwnProperty("maintenanceVersion")) - object.maintenanceVersion = message.maintenanceVersion; - if (message.upgradableDatabaseVersions && message.upgradableDatabaseVersions.length) { - object.upgradableDatabaseVersions = []; - for (var j = 0; j < message.upgradableDatabaseVersions.length; ++j) - object.upgradableDatabaseVersions[j] = $root.google.cloud.sql.v1.AvailableDatabaseVersion.toObject(message.upgradableDatabaseVersions[j], options); - } - if (message.sqlNetworkArchitecture != null && message.hasOwnProperty("sqlNetworkArchitecture")) { - object.sqlNetworkArchitecture = options.enums === String ? $root.google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture[message.sqlNetworkArchitecture] === undefined ? message.sqlNetworkArchitecture : $root.google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture[message.sqlNetworkArchitecture] : message.sqlNetworkArchitecture; - if (options.oneofs) - object._sqlNetworkArchitecture = "sqlNetworkArchitecture"; - } - if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { - object.pscServiceAttachmentLink = message.pscServiceAttachmentLink; - if (options.oneofs) - object._pscServiceAttachmentLink = "pscServiceAttachmentLink"; - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - object.dnsName = message.dnsName; - if (options.oneofs) - object._dnsName = "dnsName"; - } - if (message.primaryDnsName != null && message.hasOwnProperty("primaryDnsName")) { - object.primaryDnsName = message.primaryDnsName; - if (options.oneofs) - object._primaryDnsName = "primaryDnsName"; - } - if (message.writeEndpoint != null && message.hasOwnProperty("writeEndpoint")) { - object.writeEndpoint = message.writeEndpoint; - if (options.oneofs) - object._writeEndpoint = "writeEndpoint"; - } - if (message.replicationCluster != null && message.hasOwnProperty("replicationCluster")) - object.replicationCluster = $root.google.cloud.sql.v1.ReplicationCluster.toObject(message.replicationCluster, options); - if (message.geminiConfig != null && message.hasOwnProperty("geminiConfig")) { - object.geminiConfig = $root.google.cloud.sql.v1.GeminiInstanceConfig.toObject(message.geminiConfig, options); - if (options.oneofs) - object._geminiConfig = "geminiConfig"; - } - if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) - object.satisfiesPzi = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzi, options); - if (message.switchTransactionLogsToCloudStorageEnabled != null && message.hasOwnProperty("switchTransactionLogsToCloudStorageEnabled")) { - object.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.toObject(message.switchTransactionLogsToCloudStorageEnabled, options); - if (options.oneofs) - object._switchTransactionLogsToCloudStorageEnabled = "switchTransactionLogsToCloudStorageEnabled"; - } - if (message.includeReplicasForMajorVersionUpgrade != null && message.hasOwnProperty("includeReplicasForMajorVersionUpgrade")) { - object.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.toObject(message.includeReplicasForMajorVersionUpgrade, options); - if (options.oneofs) - object._includeReplicasForMajorVersionUpgrade = "includeReplicasForMajorVersionUpgrade"; - } - var keys2; - if (message.tags && (keys2 = Object.keys(message.tags)).length) { - object.tags = {}; - for (var j = 0; j < keys2.length; ++j) - object.tags[keys2[j]] = message.tags[keys2[j]]; - } - if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { - object.nodeCount = message.nodeCount; - if (options.oneofs) - object._nodeCount = "nodeCount"; - } - if (message.nodes && message.nodes.length) { - object.nodes = []; - for (var j = 0; j < message.nodes.length; ++j) - object.nodes[j] = $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.toObject(message.nodes[j], options); - } - if (message.dnsNames && message.dnsNames.length) { - object.dnsNames = []; - for (var j = 0; j < message.dnsNames.length; ++j) - object.dnsNames[j] = $root.google.cloud.sql.v1.DnsNameMapping.toObject(message.dnsNames[j], options); - } - return object; - }; - - /** - * Converts this DatabaseInstance to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DatabaseInstance - * @instance - * @returns {Object.} JSON object - */ - DatabaseInstance.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DatabaseInstance - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DatabaseInstance - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DatabaseInstance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseInstance"; - }; - - /** - * SqlInstanceState enum. - * @name google.cloud.sql.v1.DatabaseInstance.SqlInstanceState - * @enum {number} - * @property {number} SQL_INSTANCE_STATE_UNSPECIFIED=0 SQL_INSTANCE_STATE_UNSPECIFIED value - * @property {number} RUNNABLE=1 RUNNABLE value - * @property {number} SUSPENDED=2 SUSPENDED value - * @property {number} PENDING_DELETE=3 PENDING_DELETE value - * @property {number} PENDING_CREATE=4 PENDING_CREATE value - * @property {number} MAINTENANCE=5 MAINTENANCE value - * @property {number} FAILED=6 FAILED value - * @property {number} ONLINE_MAINTENANCE=7 ONLINE_MAINTENANCE value - * @property {number} REPAIRING=8 REPAIRING value - */ - DatabaseInstance.SqlInstanceState = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_INSTANCE_STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNABLE"] = 1; - values[valuesById[2] = "SUSPENDED"] = 2; - values[valuesById[3] = "PENDING_DELETE"] = 3; - values[valuesById[4] = "PENDING_CREATE"] = 4; - values[valuesById[5] = "MAINTENANCE"] = 5; - values[valuesById[6] = "FAILED"] = 6; - values[valuesById[7] = "ONLINE_MAINTENANCE"] = 7; - values[valuesById[8] = "REPAIRING"] = 8; - return values; - })(); - - DatabaseInstance.SqlFailoverReplica = (function() { - - /** - * Properties of a SqlFailoverReplica. - * @memberof google.cloud.sql.v1.DatabaseInstance - * @interface ISqlFailoverReplica - * @property {string|null} [name] SqlFailoverReplica name - * @property {google.protobuf.IBoolValue|null} [available] SqlFailoverReplica available - */ - - /** - * Constructs a new SqlFailoverReplica. - * @memberof google.cloud.sql.v1.DatabaseInstance - * @classdesc Represents a SqlFailoverReplica. - * @implements ISqlFailoverReplica - * @constructor - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica=} [properties] Properties to set - */ - function SqlFailoverReplica(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlFailoverReplica name. - * @member {string} name - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @instance - */ - SqlFailoverReplica.prototype.name = ""; - - /** - * SqlFailoverReplica available. - * @member {google.protobuf.IBoolValue|null|undefined} available - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @instance - */ - SqlFailoverReplica.prototype.available = null; - - /** - * Creates a new SqlFailoverReplica instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica instance - */ - SqlFailoverReplica.create = function create(properties) { - return new SqlFailoverReplica(properties); - }; - - /** - * Encodes the specified SqlFailoverReplica message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica} message SqlFailoverReplica message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlFailoverReplica.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.available != null && Object.hasOwnProperty.call(message, "available")) - $root.google.protobuf.BoolValue.encode(message.available, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlFailoverReplica message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlFailoverReplica} message SqlFailoverReplica message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlFailoverReplica.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlFailoverReplica message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlFailoverReplica.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.available = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlFailoverReplica message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlFailoverReplica.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlFailoverReplica message. - * @function verify - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlFailoverReplica.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.available != null && message.hasOwnProperty("available")) { - var error = $root.google.protobuf.BoolValue.verify(message.available); - if (error) - return "available." + error; - } - return null; - }; - - /** - * Creates a SqlFailoverReplica message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica - */ - SqlFailoverReplica.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica) - return object; - var message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica(); - if (object.name != null) - message.name = String(object.name); - if (object.available != null) { - if (typeof object.available !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica.available: object expected"); - message.available = $root.google.protobuf.BoolValue.fromObject(object.available); - } - return message; - }; - - /** - * Creates a plain object from a SqlFailoverReplica message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica} message SqlFailoverReplica - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlFailoverReplica.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.available = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.available != null && message.hasOwnProperty("available")) - object.available = $root.google.protobuf.BoolValue.toObject(message.available, options); - return object; - }; - - /** - * Converts this SqlFailoverReplica to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @instance - * @returns {Object.} JSON object - */ - SqlFailoverReplica.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlFailoverReplica - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlFailoverReplica.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseInstance.SqlFailoverReplica"; - }; - - return SqlFailoverReplica; - })(); - - DatabaseInstance.SqlScheduledMaintenance = (function() { - - /** - * Properties of a SqlScheduledMaintenance. - * @memberof google.cloud.sql.v1.DatabaseInstance - * @interface ISqlScheduledMaintenance - * @property {google.protobuf.ITimestamp|null} [startTime] SqlScheduledMaintenance startTime - * @property {boolean|null} [canDefer] SqlScheduledMaintenance canDefer - * @property {boolean|null} [canReschedule] SqlScheduledMaintenance canReschedule - * @property {google.protobuf.ITimestamp|null} [scheduleDeadlineTime] SqlScheduledMaintenance scheduleDeadlineTime - */ - - /** - * Constructs a new SqlScheduledMaintenance. - * @memberof google.cloud.sql.v1.DatabaseInstance - * @classdesc Represents a SqlScheduledMaintenance. - * @implements ISqlScheduledMaintenance - * @constructor - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance=} [properties] Properties to set - */ - function SqlScheduledMaintenance(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlScheduledMaintenance startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @instance - */ - SqlScheduledMaintenance.prototype.startTime = null; - - /** - * SqlScheduledMaintenance canDefer. - * @member {boolean} canDefer - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @instance - */ - SqlScheduledMaintenance.prototype.canDefer = false; - - /** - * SqlScheduledMaintenance canReschedule. - * @member {boolean} canReschedule - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @instance - */ - SqlScheduledMaintenance.prototype.canReschedule = false; - - /** - * SqlScheduledMaintenance scheduleDeadlineTime. - * @member {google.protobuf.ITimestamp|null|undefined} scheduleDeadlineTime - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @instance - */ - SqlScheduledMaintenance.prototype.scheduleDeadlineTime = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlScheduledMaintenance.prototype, "_scheduleDeadlineTime", { - get: $util.oneOfGetter($oneOfFields = ["scheduleDeadlineTime"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlScheduledMaintenance instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance instance - */ - SqlScheduledMaintenance.create = function create(properties) { - return new SqlScheduledMaintenance(properties); - }; - - /** - * Encodes the specified SqlScheduledMaintenance message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance} message SqlScheduledMaintenance message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlScheduledMaintenance.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.canDefer != null && Object.hasOwnProperty.call(message, "canDefer")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.canDefer); - if (message.canReschedule != null && Object.hasOwnProperty.call(message, "canReschedule")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.canReschedule); - if (message.scheduleDeadlineTime != null && Object.hasOwnProperty.call(message, "scheduleDeadlineTime")) - $root.google.protobuf.Timestamp.encode(message.scheduleDeadlineTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlScheduledMaintenance message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlScheduledMaintenance} message SqlScheduledMaintenance message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlScheduledMaintenance.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlScheduledMaintenance message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlScheduledMaintenance.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 2: { - message.canDefer = reader.bool(); - break; - } - case 3: { - message.canReschedule = reader.bool(); - break; - } - case 4: { - message.scheduleDeadlineTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlScheduledMaintenance message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlScheduledMaintenance.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlScheduledMaintenance message. - * @function verify - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlScheduledMaintenance.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.canDefer != null && message.hasOwnProperty("canDefer")) - if (typeof message.canDefer !== "boolean") - return "canDefer: boolean expected"; - if (message.canReschedule != null && message.hasOwnProperty("canReschedule")) - if (typeof message.canReschedule !== "boolean") - return "canReschedule: boolean expected"; - if (message.scheduleDeadlineTime != null && message.hasOwnProperty("scheduleDeadlineTime")) { - properties._scheduleDeadlineTime = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.scheduleDeadlineTime); - if (error) - return "scheduleDeadlineTime." + error; - } - } - return null; - }; - - /** - * Creates a SqlScheduledMaintenance message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance - */ - SqlScheduledMaintenance.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance) - return object; - var message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance(); - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.canDefer != null) - message.canDefer = Boolean(object.canDefer); - if (object.canReschedule != null) - message.canReschedule = Boolean(object.canReschedule); - if (object.scheduleDeadlineTime != null) { - if (typeof object.scheduleDeadlineTime !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance.scheduleDeadlineTime: object expected"); - message.scheduleDeadlineTime = $root.google.protobuf.Timestamp.fromObject(object.scheduleDeadlineTime); - } - return message; - }; - - /** - * Creates a plain object from a SqlScheduledMaintenance message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance} message SqlScheduledMaintenance - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlScheduledMaintenance.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.startTime = null; - object.canDefer = false; - object.canReschedule = false; - } - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.canDefer != null && message.hasOwnProperty("canDefer")) - object.canDefer = message.canDefer; - if (message.canReschedule != null && message.hasOwnProperty("canReschedule")) - object.canReschedule = message.canReschedule; - if (message.scheduleDeadlineTime != null && message.hasOwnProperty("scheduleDeadlineTime")) { - object.scheduleDeadlineTime = $root.google.protobuf.Timestamp.toObject(message.scheduleDeadlineTime, options); - if (options.oneofs) - object._scheduleDeadlineTime = "scheduleDeadlineTime"; - } - return object; - }; - - /** - * Converts this SqlScheduledMaintenance to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @instance - * @returns {Object.} JSON object - */ - SqlScheduledMaintenance.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlScheduledMaintenance - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlScheduledMaintenance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseInstance.SqlScheduledMaintenance"; - }; - - return SqlScheduledMaintenance; - })(); - - DatabaseInstance.SqlOutOfDiskReport = (function() { - - /** - * Properties of a SqlOutOfDiskReport. - * @memberof google.cloud.sql.v1.DatabaseInstance - * @interface ISqlOutOfDiskReport - * @property {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null} [sqlOutOfDiskState] SqlOutOfDiskReport sqlOutOfDiskState - * @property {number|null} [sqlMinRecommendedIncreaseSizeGb] SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb - */ - - /** - * Constructs a new SqlOutOfDiskReport. - * @memberof google.cloud.sql.v1.DatabaseInstance - * @classdesc Represents a SqlOutOfDiskReport. - * @implements ISqlOutOfDiskReport - * @constructor - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport=} [properties] Properties to set - */ - function SqlOutOfDiskReport(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlOutOfDiskReport sqlOutOfDiskState. - * @member {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null|undefined} sqlOutOfDiskState - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @instance - */ - SqlOutOfDiskReport.prototype.sqlOutOfDiskState = null; - - /** - * SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb. - * @member {number|null|undefined} sqlMinRecommendedIncreaseSizeGb - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @instance - */ - SqlOutOfDiskReport.prototype.sqlMinRecommendedIncreaseSizeGb = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlOutOfDiskReport.prototype, "_sqlOutOfDiskState", { - get: $util.oneOfGetter($oneOfFields = ["sqlOutOfDiskState"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlOutOfDiskReport.prototype, "_sqlMinRecommendedIncreaseSizeGb", { - get: $util.oneOfGetter($oneOfFields = ["sqlMinRecommendedIncreaseSizeGb"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlOutOfDiskReport instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport instance - */ - SqlOutOfDiskReport.create = function create(properties) { - return new SqlOutOfDiskReport(properties); - }; - - /** - * Encodes the specified SqlOutOfDiskReport message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport} message SqlOutOfDiskReport message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOutOfDiskReport.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sqlOutOfDiskState != null && Object.hasOwnProperty.call(message, "sqlOutOfDiskState")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.sqlOutOfDiskState); - if (message.sqlMinRecommendedIncreaseSizeGb != null && Object.hasOwnProperty.call(message, "sqlMinRecommendedIncreaseSizeGb")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sqlMinRecommendedIncreaseSizeGb); - return writer; - }; - - /** - * Encodes the specified SqlOutOfDiskReport message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.ISqlOutOfDiskReport} message SqlOutOfDiskReport message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOutOfDiskReport.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlOutOfDiskReport message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOutOfDiskReport.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.sqlOutOfDiskState = reader.int32(); - break; - } - case 2: { - message.sqlMinRecommendedIncreaseSizeGb = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlOutOfDiskReport message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOutOfDiskReport.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlOutOfDiskReport message. - * @function verify - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlOutOfDiskReport.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.sqlOutOfDiskState != null && message.hasOwnProperty("sqlOutOfDiskState")) { - properties._sqlOutOfDiskState = 1; - switch (message.sqlOutOfDiskState) { - default: - return "sqlOutOfDiskState: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - if (message.sqlMinRecommendedIncreaseSizeGb != null && message.hasOwnProperty("sqlMinRecommendedIncreaseSizeGb")) { - properties._sqlMinRecommendedIncreaseSizeGb = 1; - if (!$util.isInteger(message.sqlMinRecommendedIncreaseSizeGb)) - return "sqlMinRecommendedIncreaseSizeGb: integer expected"; - } - return null; - }; - - /** - * Creates a SqlOutOfDiskReport message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport - */ - SqlOutOfDiskReport.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport) - return object; - var message = new $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport(); - switch (object.sqlOutOfDiskState) { - default: - if (typeof object.sqlOutOfDiskState === "number") { - message.sqlOutOfDiskState = object.sqlOutOfDiskState; - break; - } - break; - case "SQL_OUT_OF_DISK_STATE_UNSPECIFIED": - case 0: - message.sqlOutOfDiskState = 0; - break; - case "NORMAL": - case 1: - message.sqlOutOfDiskState = 1; - break; - case "SOFT_SHUTDOWN": - case 2: - message.sqlOutOfDiskState = 2; - break; - } - if (object.sqlMinRecommendedIncreaseSizeGb != null) - message.sqlMinRecommendedIncreaseSizeGb = object.sqlMinRecommendedIncreaseSizeGb | 0; - return message; - }; - - /** - * Creates a plain object from a SqlOutOfDiskReport message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport} message SqlOutOfDiskReport - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlOutOfDiskReport.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.sqlOutOfDiskState != null && message.hasOwnProperty("sqlOutOfDiskState")) { - object.sqlOutOfDiskState = options.enums === String ? $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState[message.sqlOutOfDiskState] === undefined ? message.sqlOutOfDiskState : $root.google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState[message.sqlOutOfDiskState] : message.sqlOutOfDiskState; - if (options.oneofs) - object._sqlOutOfDiskState = "sqlOutOfDiskState"; - } - if (message.sqlMinRecommendedIncreaseSizeGb != null && message.hasOwnProperty("sqlMinRecommendedIncreaseSizeGb")) { - object.sqlMinRecommendedIncreaseSizeGb = message.sqlMinRecommendedIncreaseSizeGb; - if (options.oneofs) - object._sqlMinRecommendedIncreaseSizeGb = "sqlMinRecommendedIncreaseSizeGb"; - } - return object; - }; - - /** - * Converts this SqlOutOfDiskReport to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @instance - * @returns {Object.} JSON object - */ - SqlOutOfDiskReport.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlOutOfDiskReport - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlOutOfDiskReport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport"; - }; - - /** - * SqlOutOfDiskState enum. - * @name google.cloud.sql.v1.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState - * @enum {number} - * @property {number} SQL_OUT_OF_DISK_STATE_UNSPECIFIED=0 SQL_OUT_OF_DISK_STATE_UNSPECIFIED value - * @property {number} NORMAL=1 NORMAL value - * @property {number} SOFT_SHUTDOWN=2 SOFT_SHUTDOWN value - */ - SqlOutOfDiskReport.SqlOutOfDiskState = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_OUT_OF_DISK_STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "NORMAL"] = 1; - values[valuesById[2] = "SOFT_SHUTDOWN"] = 2; - return values; - })(); - - return SqlOutOfDiskReport; - })(); - - /** - * SqlNetworkArchitecture enum. - * @name google.cloud.sql.v1.DatabaseInstance.SqlNetworkArchitecture - * @enum {number} - * @property {number} SQL_NETWORK_ARCHITECTURE_UNSPECIFIED=0 SQL_NETWORK_ARCHITECTURE_UNSPECIFIED value - * @property {number} NEW_NETWORK_ARCHITECTURE=1 NEW_NETWORK_ARCHITECTURE value - * @property {number} OLD_NETWORK_ARCHITECTURE=2 OLD_NETWORK_ARCHITECTURE value - */ - DatabaseInstance.SqlNetworkArchitecture = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED"] = 0; - values[valuesById[1] = "NEW_NETWORK_ARCHITECTURE"] = 1; - values[valuesById[2] = "OLD_NETWORK_ARCHITECTURE"] = 2; - return values; - })(); - - DatabaseInstance.PoolNodeConfig = (function() { - - /** - * Properties of a PoolNodeConfig. - * @memberof google.cloud.sql.v1.DatabaseInstance - * @interface IPoolNodeConfig - * @property {string|null} [name] PoolNodeConfig name - * @property {string|null} [gceZone] PoolNodeConfig gceZone - * @property {Array.|null} [ipAddresses] PoolNodeConfig ipAddresses - * @property {string|null} [dnsName] PoolNodeConfig dnsName - * @property {google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null} [state] PoolNodeConfig state - * @property {Array.|null} [dnsNames] PoolNodeConfig dnsNames - * @property {string|null} [pscServiceAttachmentLink] PoolNodeConfig pscServiceAttachmentLink - * @property {Array.|null} [pscAutoConnections] PoolNodeConfig pscAutoConnections - */ - - /** - * Constructs a new PoolNodeConfig. - * @memberof google.cloud.sql.v1.DatabaseInstance - * @classdesc Represents a PoolNodeConfig. - * @implements IPoolNodeConfig - * @constructor - * @param {google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig=} [properties] Properties to set - */ - function PoolNodeConfig(properties) { - this.ipAddresses = []; - this.dnsNames = []; - this.pscAutoConnections = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PoolNodeConfig name. - * @member {string|null|undefined} name - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.name = null; - - /** - * PoolNodeConfig gceZone. - * @member {string|null|undefined} gceZone - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.gceZone = null; - - /** - * PoolNodeConfig ipAddresses. - * @member {Array.} ipAddresses - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.ipAddresses = $util.emptyArray; - - /** - * PoolNodeConfig dnsName. - * @member {string|null|undefined} dnsName - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.dnsName = null; - - /** - * PoolNodeConfig state. - * @member {google.cloud.sql.v1.DatabaseInstance.SqlInstanceState|null|undefined} state - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.state = null; - - /** - * PoolNodeConfig dnsNames. - * @member {Array.} dnsNames - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.dnsNames = $util.emptyArray; - - /** - * PoolNodeConfig pscServiceAttachmentLink. - * @member {string|null|undefined} pscServiceAttachmentLink - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.pscServiceAttachmentLink = null; - - /** - * PoolNodeConfig pscAutoConnections. - * @member {Array.} pscAutoConnections - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.pscAutoConnections = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PoolNodeConfig.prototype, "_name", { - get: $util.oneOfGetter($oneOfFields = ["name"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PoolNodeConfig.prototype, "_gceZone", { - get: $util.oneOfGetter($oneOfFields = ["gceZone"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PoolNodeConfig.prototype, "_dnsName", { - get: $util.oneOfGetter($oneOfFields = ["dnsName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PoolNodeConfig.prototype, "_state", { - get: $util.oneOfGetter($oneOfFields = ["state"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PoolNodeConfig.prototype, "_pscServiceAttachmentLink", { - get: $util.oneOfGetter($oneOfFields = ["pscServiceAttachmentLink"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PoolNodeConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig} PoolNodeConfig instance - */ - PoolNodeConfig.create = function create(properties) { - return new PoolNodeConfig(properties); - }; - - /** - * Encodes the specified PoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig} message PoolNodeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PoolNodeConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.gceZone != null && Object.hasOwnProperty.call(message, "gceZone")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.gceZone); - if (message.ipAddresses != null && message.ipAddresses.length) - for (var i = 0; i < message.ipAddresses.length; ++i) - $root.google.cloud.sql.v1.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dnsName); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.state); - if (message.dnsNames != null && message.dnsNames.length) - for (var i = 0; i < message.dnsNames.length; ++i) - $root.google.cloud.sql.v1.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.pscServiceAttachmentLink != null && Object.hasOwnProperty.call(message, "pscServiceAttachmentLink")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.pscServiceAttachmentLink); - if (message.pscAutoConnections != null && message.pscAutoConnections.length) - for (var i = 0; i < message.pscAutoConnections.length; ++i) - $root.google.cloud.sql.v1.PscAutoConnectionConfig.encode(message.pscAutoConnections[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.IPoolNodeConfig} message PoolNodeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PoolNodeConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PoolNodeConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig} PoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PoolNodeConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.gceZone = reader.string(); - break; - } - case 3: { - if (!(message.ipAddresses && message.ipAddresses.length)) - message.ipAddresses = []; - message.ipAddresses.push($root.google.cloud.sql.v1.IpMapping.decode(reader, reader.uint32())); - break; - } - case 4: { - message.dnsName = reader.string(); - break; - } - case 5: { - message.state = reader.int32(); - break; - } - case 6: { - if (!(message.dnsNames && message.dnsNames.length)) - message.dnsNames = []; - message.dnsNames.push($root.google.cloud.sql.v1.DnsNameMapping.decode(reader, reader.uint32())); - break; - } - case 7: { - message.pscServiceAttachmentLink = reader.string(); - break; - } - case 8: { - if (!(message.pscAutoConnections && message.pscAutoConnections.length)) - message.pscAutoConnections = []; - message.pscAutoConnections.push($root.google.cloud.sql.v1.PscAutoConnectionConfig.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PoolNodeConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig} PoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PoolNodeConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PoolNodeConfig message. - * @function verify - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PoolNodeConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) { - properties._name = 1; - if (!$util.isString(message.name)) - return "name: string expected"; - } - if (message.gceZone != null && message.hasOwnProperty("gceZone")) { - properties._gceZone = 1; - if (!$util.isString(message.gceZone)) - return "gceZone: string expected"; - } - if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { - if (!Array.isArray(message.ipAddresses)) - return "ipAddresses: array expected"; - for (var i = 0; i < message.ipAddresses.length; ++i) { - var error = $root.google.cloud.sql.v1.IpMapping.verify(message.ipAddresses[i]); - if (error) - return "ipAddresses." + error; - } - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - properties._dnsName = 1; - if (!$util.isString(message.dnsName)) - return "dnsName: string expected"; - } - if (message.state != null && message.hasOwnProperty("state")) { - properties._state = 1; - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - break; - } - } - if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { - if (!Array.isArray(message.dnsNames)) - return "dnsNames: array expected"; - for (var i = 0; i < message.dnsNames.length; ++i) { - var error = $root.google.cloud.sql.v1.DnsNameMapping.verify(message.dnsNames[i]); - if (error) - return "dnsNames." + error; - } - } - if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { - properties._pscServiceAttachmentLink = 1; - if (!$util.isString(message.pscServiceAttachmentLink)) - return "pscServiceAttachmentLink: string expected"; - } - if (message.pscAutoConnections != null && message.hasOwnProperty("pscAutoConnections")) { - if (!Array.isArray(message.pscAutoConnections)) - return "pscAutoConnections: array expected"; - for (var i = 0; i < message.pscAutoConnections.length; ++i) { - var error = $root.google.cloud.sql.v1.PscAutoConnectionConfig.verify(message.pscAutoConnections[i]); - if (error) - return "pscAutoConnections." + error; - } - } - return null; - }; - - /** - * Creates a PoolNodeConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig} PoolNodeConfig - */ - PoolNodeConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig) - return object; - var message = new $root.google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig(); - if (object.name != null) - message.name = String(object.name); - if (object.gceZone != null) - message.gceZone = String(object.gceZone); - if (object.ipAddresses) { - if (!Array.isArray(object.ipAddresses)) - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.ipAddresses: array expected"); - message.ipAddresses = []; - for (var i = 0; i < object.ipAddresses.length; ++i) { - if (typeof object.ipAddresses[i] !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.ipAddresses: object expected"); - message.ipAddresses[i] = $root.google.cloud.sql.v1.IpMapping.fromObject(object.ipAddresses[i]); - } - } - if (object.dnsName != null) - message.dnsName = String(object.dnsName); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "SQL_INSTANCE_STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNABLE": - case 1: - message.state = 1; - break; - case "SUSPENDED": - case 2: - message.state = 2; - break; - case "PENDING_DELETE": - case 3: - message.state = 3; - break; - case "PENDING_CREATE": - case 4: - message.state = 4; - break; - case "MAINTENANCE": - case 5: - message.state = 5; - break; - case "FAILED": - case 6: - message.state = 6; - break; - case "ONLINE_MAINTENANCE": - case 7: - message.state = 7; - break; - case "REPAIRING": - case 8: - message.state = 8; - break; - } - if (object.dnsNames) { - if (!Array.isArray(object.dnsNames)) - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.dnsNames: array expected"); - message.dnsNames = []; - for (var i = 0; i < object.dnsNames.length; ++i) { - if (typeof object.dnsNames[i] !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.dnsNames: object expected"); - message.dnsNames[i] = $root.google.cloud.sql.v1.DnsNameMapping.fromObject(object.dnsNames[i]); - } - } - if (object.pscServiceAttachmentLink != null) - message.pscServiceAttachmentLink = String(object.pscServiceAttachmentLink); - if (object.pscAutoConnections) { - if (!Array.isArray(object.pscAutoConnections)) - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.pscAutoConnections: array expected"); - message.pscAutoConnections = []; - for (var i = 0; i < object.pscAutoConnections.length; ++i) { - if (typeof object.pscAutoConnections[i] !== "object") - throw TypeError(".google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig.pscAutoConnections: object expected"); - message.pscAutoConnections[i] = $root.google.cloud.sql.v1.PscAutoConnectionConfig.fromObject(object.pscAutoConnections[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a PoolNodeConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @static - * @param {google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig} message PoolNodeConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PoolNodeConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.ipAddresses = []; - object.dnsNames = []; - object.pscAutoConnections = []; - } - if (message.name != null && message.hasOwnProperty("name")) { - object.name = message.name; - if (options.oneofs) - object._name = "name"; - } - if (message.gceZone != null && message.hasOwnProperty("gceZone")) { - object.gceZone = message.gceZone; - if (options.oneofs) - object._gceZone = "gceZone"; - } - if (message.ipAddresses && message.ipAddresses.length) { - object.ipAddresses = []; - for (var j = 0; j < message.ipAddresses.length; ++j) - object.ipAddresses[j] = $root.google.cloud.sql.v1.IpMapping.toObject(message.ipAddresses[j], options); - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - object.dnsName = message.dnsName; - if (options.oneofs) - object._dnsName = "dnsName"; - } - if (message.state != null && message.hasOwnProperty("state")) { - object.state = options.enums === String ? $root.google.cloud.sql.v1.DatabaseInstance.SqlInstanceState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1.DatabaseInstance.SqlInstanceState[message.state] : message.state; - if (options.oneofs) - object._state = "state"; - } - if (message.dnsNames && message.dnsNames.length) { - object.dnsNames = []; - for (var j = 0; j < message.dnsNames.length; ++j) - object.dnsNames[j] = $root.google.cloud.sql.v1.DnsNameMapping.toObject(message.dnsNames[j], options); - } - if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { - object.pscServiceAttachmentLink = message.pscServiceAttachmentLink; - if (options.oneofs) - object._pscServiceAttachmentLink = "pscServiceAttachmentLink"; - } - if (message.pscAutoConnections && message.pscAutoConnections.length) { - object.pscAutoConnections = []; - for (var j = 0; j < message.pscAutoConnections.length; ++j) - object.pscAutoConnections[j] = $root.google.cloud.sql.v1.PscAutoConnectionConfig.toObject(message.pscAutoConnections[j], options); - } - return object; - }; - - /** - * Converts this PoolNodeConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @instance - * @returns {Object.} JSON object - */ - PoolNodeConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PoolNodeConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PoolNodeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DatabaseInstance.PoolNodeConfig"; - }; - - return PoolNodeConfig; - })(); - - return DatabaseInstance; - })(); - - v1.GeminiInstanceConfig = (function() { - - /** - * Properties of a GeminiInstanceConfig. - * @memberof google.cloud.sql.v1 - * @interface IGeminiInstanceConfig - * @property {boolean|null} [entitled] GeminiInstanceConfig entitled - * @property {boolean|null} [googleVacuumMgmtEnabled] GeminiInstanceConfig googleVacuumMgmtEnabled - * @property {boolean|null} [oomSessionCancelEnabled] GeminiInstanceConfig oomSessionCancelEnabled - * @property {boolean|null} [activeQueryEnabled] GeminiInstanceConfig activeQueryEnabled - * @property {boolean|null} [indexAdvisorEnabled] GeminiInstanceConfig indexAdvisorEnabled - * @property {boolean|null} [flagRecommenderEnabled] GeminiInstanceConfig flagRecommenderEnabled - */ - - /** - * Constructs a new GeminiInstanceConfig. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a GeminiInstanceConfig. - * @implements IGeminiInstanceConfig - * @constructor - * @param {google.cloud.sql.v1.IGeminiInstanceConfig=} [properties] Properties to set - */ - function GeminiInstanceConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GeminiInstanceConfig entitled. - * @member {boolean|null|undefined} entitled - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.entitled = null; - - /** - * GeminiInstanceConfig googleVacuumMgmtEnabled. - * @member {boolean|null|undefined} googleVacuumMgmtEnabled - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.googleVacuumMgmtEnabled = null; - - /** - * GeminiInstanceConfig oomSessionCancelEnabled. - * @member {boolean|null|undefined} oomSessionCancelEnabled - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.oomSessionCancelEnabled = null; - - /** - * GeminiInstanceConfig activeQueryEnabled. - * @member {boolean|null|undefined} activeQueryEnabled - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.activeQueryEnabled = null; - - /** - * GeminiInstanceConfig indexAdvisorEnabled. - * @member {boolean|null|undefined} indexAdvisorEnabled - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.indexAdvisorEnabled = null; - - /** - * GeminiInstanceConfig flagRecommenderEnabled. - * @member {boolean|null|undefined} flagRecommenderEnabled - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.flagRecommenderEnabled = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_entitled", { - get: $util.oneOfGetter($oneOfFields = ["entitled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_googleVacuumMgmtEnabled", { - get: $util.oneOfGetter($oneOfFields = ["googleVacuumMgmtEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_oomSessionCancelEnabled", { - get: $util.oneOfGetter($oneOfFields = ["oomSessionCancelEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_activeQueryEnabled", { - get: $util.oneOfGetter($oneOfFields = ["activeQueryEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_indexAdvisorEnabled", { - get: $util.oneOfGetter($oneOfFields = ["indexAdvisorEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_flagRecommenderEnabled", { - get: $util.oneOfGetter($oneOfFields = ["flagRecommenderEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new GeminiInstanceConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @static - * @param {google.cloud.sql.v1.IGeminiInstanceConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.GeminiInstanceConfig} GeminiInstanceConfig instance - */ - GeminiInstanceConfig.create = function create(properties) { - return new GeminiInstanceConfig(properties); - }; - - /** - * Encodes the specified GeminiInstanceConfig message. Does not implicitly {@link google.cloud.sql.v1.GeminiInstanceConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @static - * @param {google.cloud.sql.v1.IGeminiInstanceConfig} message GeminiInstanceConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GeminiInstanceConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.entitled != null && Object.hasOwnProperty.call(message, "entitled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.entitled); - if (message.googleVacuumMgmtEnabled != null && Object.hasOwnProperty.call(message, "googleVacuumMgmtEnabled")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.googleVacuumMgmtEnabled); - if (message.oomSessionCancelEnabled != null && Object.hasOwnProperty.call(message, "oomSessionCancelEnabled")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.oomSessionCancelEnabled); - if (message.activeQueryEnabled != null && Object.hasOwnProperty.call(message, "activeQueryEnabled")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.activeQueryEnabled); - if (message.indexAdvisorEnabled != null && Object.hasOwnProperty.call(message, "indexAdvisorEnabled")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.indexAdvisorEnabled); - if (message.flagRecommenderEnabled != null && Object.hasOwnProperty.call(message, "flagRecommenderEnabled")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.flagRecommenderEnabled); - return writer; - }; - - /** - * Encodes the specified GeminiInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GeminiInstanceConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @static - * @param {google.cloud.sql.v1.IGeminiInstanceConfig} message GeminiInstanceConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GeminiInstanceConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GeminiInstanceConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.GeminiInstanceConfig} GeminiInstanceConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GeminiInstanceConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.GeminiInstanceConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.entitled = reader.bool(); - break; - } - case 2: { - message.googleVacuumMgmtEnabled = reader.bool(); - break; - } - case 3: { - message.oomSessionCancelEnabled = reader.bool(); - break; - } - case 4: { - message.activeQueryEnabled = reader.bool(); - break; - } - case 5: { - message.indexAdvisorEnabled = reader.bool(); - break; - } - case 6: { - message.flagRecommenderEnabled = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GeminiInstanceConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.GeminiInstanceConfig} GeminiInstanceConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GeminiInstanceConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GeminiInstanceConfig message. - * @function verify - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GeminiInstanceConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.entitled != null && message.hasOwnProperty("entitled")) { - properties._entitled = 1; - if (typeof message.entitled !== "boolean") - return "entitled: boolean expected"; - } - if (message.googleVacuumMgmtEnabled != null && message.hasOwnProperty("googleVacuumMgmtEnabled")) { - properties._googleVacuumMgmtEnabled = 1; - if (typeof message.googleVacuumMgmtEnabled !== "boolean") - return "googleVacuumMgmtEnabled: boolean expected"; - } - if (message.oomSessionCancelEnabled != null && message.hasOwnProperty("oomSessionCancelEnabled")) { - properties._oomSessionCancelEnabled = 1; - if (typeof message.oomSessionCancelEnabled !== "boolean") - return "oomSessionCancelEnabled: boolean expected"; - } - if (message.activeQueryEnabled != null && message.hasOwnProperty("activeQueryEnabled")) { - properties._activeQueryEnabled = 1; - if (typeof message.activeQueryEnabled !== "boolean") - return "activeQueryEnabled: boolean expected"; - } - if (message.indexAdvisorEnabled != null && message.hasOwnProperty("indexAdvisorEnabled")) { - properties._indexAdvisorEnabled = 1; - if (typeof message.indexAdvisorEnabled !== "boolean") - return "indexAdvisorEnabled: boolean expected"; - } - if (message.flagRecommenderEnabled != null && message.hasOwnProperty("flagRecommenderEnabled")) { - properties._flagRecommenderEnabled = 1; - if (typeof message.flagRecommenderEnabled !== "boolean") - return "flagRecommenderEnabled: boolean expected"; - } - return null; - }; - - /** - * Creates a GeminiInstanceConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.GeminiInstanceConfig} GeminiInstanceConfig - */ - GeminiInstanceConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.GeminiInstanceConfig) - return object; - var message = new $root.google.cloud.sql.v1.GeminiInstanceConfig(); - if (object.entitled != null) - message.entitled = Boolean(object.entitled); - if (object.googleVacuumMgmtEnabled != null) - message.googleVacuumMgmtEnabled = Boolean(object.googleVacuumMgmtEnabled); - if (object.oomSessionCancelEnabled != null) - message.oomSessionCancelEnabled = Boolean(object.oomSessionCancelEnabled); - if (object.activeQueryEnabled != null) - message.activeQueryEnabled = Boolean(object.activeQueryEnabled); - if (object.indexAdvisorEnabled != null) - message.indexAdvisorEnabled = Boolean(object.indexAdvisorEnabled); - if (object.flagRecommenderEnabled != null) - message.flagRecommenderEnabled = Boolean(object.flagRecommenderEnabled); - return message; - }; - - /** - * Creates a plain object from a GeminiInstanceConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @static - * @param {google.cloud.sql.v1.GeminiInstanceConfig} message GeminiInstanceConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GeminiInstanceConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.entitled != null && message.hasOwnProperty("entitled")) { - object.entitled = message.entitled; - if (options.oneofs) - object._entitled = "entitled"; - } - if (message.googleVacuumMgmtEnabled != null && message.hasOwnProperty("googleVacuumMgmtEnabled")) { - object.googleVacuumMgmtEnabled = message.googleVacuumMgmtEnabled; - if (options.oneofs) - object._googleVacuumMgmtEnabled = "googleVacuumMgmtEnabled"; - } - if (message.oomSessionCancelEnabled != null && message.hasOwnProperty("oomSessionCancelEnabled")) { - object.oomSessionCancelEnabled = message.oomSessionCancelEnabled; - if (options.oneofs) - object._oomSessionCancelEnabled = "oomSessionCancelEnabled"; - } - if (message.activeQueryEnabled != null && message.hasOwnProperty("activeQueryEnabled")) { - object.activeQueryEnabled = message.activeQueryEnabled; - if (options.oneofs) - object._activeQueryEnabled = "activeQueryEnabled"; - } - if (message.indexAdvisorEnabled != null && message.hasOwnProperty("indexAdvisorEnabled")) { - object.indexAdvisorEnabled = message.indexAdvisorEnabled; - if (options.oneofs) - object._indexAdvisorEnabled = "indexAdvisorEnabled"; - } - if (message.flagRecommenderEnabled != null && message.hasOwnProperty("flagRecommenderEnabled")) { - object.flagRecommenderEnabled = message.flagRecommenderEnabled; - if (options.oneofs) - object._flagRecommenderEnabled = "flagRecommenderEnabled"; - } - return object; - }; - - /** - * Converts this GeminiInstanceConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @instance - * @returns {Object.} JSON object - */ - GeminiInstanceConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GeminiInstanceConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.GeminiInstanceConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GeminiInstanceConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.GeminiInstanceConfig"; - }; - - return GeminiInstanceConfig; - })(); - - v1.ReplicationCluster = (function() { - - /** - * Properties of a ReplicationCluster. - * @memberof google.cloud.sql.v1 - * @interface IReplicationCluster - * @property {string|null} [psaWriteEndpoint] ReplicationCluster psaWriteEndpoint - * @property {string|null} [failoverDrReplicaName] ReplicationCluster failoverDrReplicaName - * @property {boolean|null} [drReplica] ReplicationCluster drReplica - */ - - /** - * Constructs a new ReplicationCluster. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a ReplicationCluster. - * @implements IReplicationCluster - * @constructor - * @param {google.cloud.sql.v1.IReplicationCluster=} [properties] Properties to set - */ - function ReplicationCluster(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReplicationCluster psaWriteEndpoint. - * @member {string} psaWriteEndpoint - * @memberof google.cloud.sql.v1.ReplicationCluster - * @instance - */ - ReplicationCluster.prototype.psaWriteEndpoint = ""; - - /** - * ReplicationCluster failoverDrReplicaName. - * @member {string} failoverDrReplicaName - * @memberof google.cloud.sql.v1.ReplicationCluster - * @instance - */ - ReplicationCluster.prototype.failoverDrReplicaName = ""; - - /** - * ReplicationCluster drReplica. - * @member {boolean} drReplica - * @memberof google.cloud.sql.v1.ReplicationCluster - * @instance - */ - ReplicationCluster.prototype.drReplica = false; - - /** - * Creates a new ReplicationCluster instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ReplicationCluster - * @static - * @param {google.cloud.sql.v1.IReplicationCluster=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ReplicationCluster} ReplicationCluster instance - */ - ReplicationCluster.create = function create(properties) { - return new ReplicationCluster(properties); - }; - - /** - * Encodes the specified ReplicationCluster message. Does not implicitly {@link google.cloud.sql.v1.ReplicationCluster.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ReplicationCluster - * @static - * @param {google.cloud.sql.v1.IReplicationCluster} message ReplicationCluster message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReplicationCluster.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.psaWriteEndpoint != null && Object.hasOwnProperty.call(message, "psaWriteEndpoint")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.psaWriteEndpoint); - if (message.failoverDrReplicaName != null && Object.hasOwnProperty.call(message, "failoverDrReplicaName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.failoverDrReplicaName); - if (message.drReplica != null && Object.hasOwnProperty.call(message, "drReplica")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.drReplica); - return writer; - }; - - /** - * Encodes the specified ReplicationCluster message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReplicationCluster.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ReplicationCluster - * @static - * @param {google.cloud.sql.v1.IReplicationCluster} message ReplicationCluster message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReplicationCluster.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReplicationCluster message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ReplicationCluster - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ReplicationCluster} ReplicationCluster - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplicationCluster.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ReplicationCluster(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.psaWriteEndpoint = reader.string(); - break; - } - case 2: { - message.failoverDrReplicaName = reader.string(); - break; - } - case 4: { - message.drReplica = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReplicationCluster message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ReplicationCluster - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ReplicationCluster} ReplicationCluster - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplicationCluster.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReplicationCluster message. - * @function verify - * @memberof google.cloud.sql.v1.ReplicationCluster - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReplicationCluster.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.psaWriteEndpoint != null && message.hasOwnProperty("psaWriteEndpoint")) - if (!$util.isString(message.psaWriteEndpoint)) - return "psaWriteEndpoint: string expected"; - if (message.failoverDrReplicaName != null && message.hasOwnProperty("failoverDrReplicaName")) - if (!$util.isString(message.failoverDrReplicaName)) - return "failoverDrReplicaName: string expected"; - if (message.drReplica != null && message.hasOwnProperty("drReplica")) - if (typeof message.drReplica !== "boolean") - return "drReplica: boolean expected"; - return null; - }; - - /** - * Creates a ReplicationCluster message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ReplicationCluster - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ReplicationCluster} ReplicationCluster - */ - ReplicationCluster.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ReplicationCluster) - return object; - var message = new $root.google.cloud.sql.v1.ReplicationCluster(); - if (object.psaWriteEndpoint != null) - message.psaWriteEndpoint = String(object.psaWriteEndpoint); - if (object.failoverDrReplicaName != null) - message.failoverDrReplicaName = String(object.failoverDrReplicaName); - if (object.drReplica != null) - message.drReplica = Boolean(object.drReplica); - return message; - }; - - /** - * Creates a plain object from a ReplicationCluster message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ReplicationCluster - * @static - * @param {google.cloud.sql.v1.ReplicationCluster} message ReplicationCluster - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReplicationCluster.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.psaWriteEndpoint = ""; - object.failoverDrReplicaName = ""; - object.drReplica = false; - } - if (message.psaWriteEndpoint != null && message.hasOwnProperty("psaWriteEndpoint")) - object.psaWriteEndpoint = message.psaWriteEndpoint; - if (message.failoverDrReplicaName != null && message.hasOwnProperty("failoverDrReplicaName")) - object.failoverDrReplicaName = message.failoverDrReplicaName; - if (message.drReplica != null && message.hasOwnProperty("drReplica")) - object.drReplica = message.drReplica; - return object; - }; - - /** - * Converts this ReplicationCluster to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ReplicationCluster - * @instance - * @returns {Object.} JSON object - */ - ReplicationCluster.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReplicationCluster - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ReplicationCluster - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReplicationCluster.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ReplicationCluster"; - }; - - return ReplicationCluster; - })(); - - v1.AvailableDatabaseVersion = (function() { - - /** - * Properties of an AvailableDatabaseVersion. - * @memberof google.cloud.sql.v1 - * @interface IAvailableDatabaseVersion - * @property {string|null} [majorVersion] AvailableDatabaseVersion majorVersion - * @property {string|null} [name] AvailableDatabaseVersion name - * @property {string|null} [displayName] AvailableDatabaseVersion displayName - */ - - /** - * Constructs a new AvailableDatabaseVersion. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an AvailableDatabaseVersion. - * @implements IAvailableDatabaseVersion - * @constructor - * @param {google.cloud.sql.v1.IAvailableDatabaseVersion=} [properties] Properties to set - */ - function AvailableDatabaseVersion(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AvailableDatabaseVersion majorVersion. - * @member {string|null|undefined} majorVersion - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @instance - */ - AvailableDatabaseVersion.prototype.majorVersion = null; - - /** - * AvailableDatabaseVersion name. - * @member {string|null|undefined} name - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @instance - */ - AvailableDatabaseVersion.prototype.name = null; - - /** - * AvailableDatabaseVersion displayName. - * @member {string|null|undefined} displayName - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @instance - */ - AvailableDatabaseVersion.prototype.displayName = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AvailableDatabaseVersion.prototype, "_majorVersion", { - get: $util.oneOfGetter($oneOfFields = ["majorVersion"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AvailableDatabaseVersion.prototype, "_name", { - get: $util.oneOfGetter($oneOfFields = ["name"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AvailableDatabaseVersion.prototype, "_displayName", { - get: $util.oneOfGetter($oneOfFields = ["displayName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new AvailableDatabaseVersion instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @static - * @param {google.cloud.sql.v1.IAvailableDatabaseVersion=} [properties] Properties to set - * @returns {google.cloud.sql.v1.AvailableDatabaseVersion} AvailableDatabaseVersion instance - */ - AvailableDatabaseVersion.create = function create(properties) { - return new AvailableDatabaseVersion(properties); - }; - - /** - * Encodes the specified AvailableDatabaseVersion message. Does not implicitly {@link google.cloud.sql.v1.AvailableDatabaseVersion.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @static - * @param {google.cloud.sql.v1.IAvailableDatabaseVersion} message AvailableDatabaseVersion message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AvailableDatabaseVersion.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.majorVersion != null && Object.hasOwnProperty.call(message, "majorVersion")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.majorVersion); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.displayName); - return writer; - }; - - /** - * Encodes the specified AvailableDatabaseVersion message, length delimited. Does not implicitly {@link google.cloud.sql.v1.AvailableDatabaseVersion.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @static - * @param {google.cloud.sql.v1.IAvailableDatabaseVersion} message AvailableDatabaseVersion message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AvailableDatabaseVersion.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AvailableDatabaseVersion message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.AvailableDatabaseVersion} AvailableDatabaseVersion - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AvailableDatabaseVersion.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.AvailableDatabaseVersion(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 3: { - message.majorVersion = reader.string(); - break; - } - case 8: { - message.name = reader.string(); - break; - } - case 9: { - message.displayName = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AvailableDatabaseVersion message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.AvailableDatabaseVersion} AvailableDatabaseVersion - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AvailableDatabaseVersion.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AvailableDatabaseVersion message. - * @function verify - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AvailableDatabaseVersion.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.majorVersion != null && message.hasOwnProperty("majorVersion")) { - properties._majorVersion = 1; - if (!$util.isString(message.majorVersion)) - return "majorVersion: string expected"; - } - if (message.name != null && message.hasOwnProperty("name")) { - properties._name = 1; - if (!$util.isString(message.name)) - return "name: string expected"; - } - if (message.displayName != null && message.hasOwnProperty("displayName")) { - properties._displayName = 1; - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - } - return null; - }; - - /** - * Creates an AvailableDatabaseVersion message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.AvailableDatabaseVersion} AvailableDatabaseVersion - */ - AvailableDatabaseVersion.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.AvailableDatabaseVersion) - return object; - var message = new $root.google.cloud.sql.v1.AvailableDatabaseVersion(); - if (object.majorVersion != null) - message.majorVersion = String(object.majorVersion); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - return message; - }; - - /** - * Creates a plain object from an AvailableDatabaseVersion message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @static - * @param {google.cloud.sql.v1.AvailableDatabaseVersion} message AvailableDatabaseVersion - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AvailableDatabaseVersion.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.majorVersion != null && message.hasOwnProperty("majorVersion")) { - object.majorVersion = message.majorVersion; - if (options.oneofs) - object._majorVersion = "majorVersion"; - } - if (message.name != null && message.hasOwnProperty("name")) { - object.name = message.name; - if (options.oneofs) - object._name = "name"; - } - if (message.displayName != null && message.hasOwnProperty("displayName")) { - object.displayName = message.displayName; - if (options.oneofs) - object._displayName = "displayName"; - } - return object; - }; - - /** - * Converts this AvailableDatabaseVersion to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @instance - * @returns {Object.} JSON object - */ - AvailableDatabaseVersion.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AvailableDatabaseVersion - * @function getTypeUrl - * @memberof google.cloud.sql.v1.AvailableDatabaseVersion - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AvailableDatabaseVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.AvailableDatabaseVersion"; - }; - - return AvailableDatabaseVersion; - })(); - - v1.SqlInstancesRescheduleMaintenanceRequestBody = (function() { - - /** - * Properties of a SqlInstancesRescheduleMaintenanceRequestBody. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesRescheduleMaintenanceRequestBody - * @property {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null} [reschedule] SqlInstancesRescheduleMaintenanceRequestBody reschedule - */ - - /** - * Constructs a new SqlInstancesRescheduleMaintenanceRequestBody. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesRescheduleMaintenanceRequestBody. - * @implements ISqlInstancesRescheduleMaintenanceRequestBody - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody=} [properties] Properties to set - */ - function SqlInstancesRescheduleMaintenanceRequestBody(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRescheduleMaintenanceRequestBody reschedule. - * @member {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null|undefined} reschedule - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @instance - */ - SqlInstancesRescheduleMaintenanceRequestBody.prototype.reschedule = null; - - /** - * Creates a new SqlInstancesRescheduleMaintenanceRequestBody instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody instance - */ - SqlInstancesRescheduleMaintenanceRequestBody.create = function create(properties) { - return new SqlInstancesRescheduleMaintenanceRequestBody(properties); - }; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRescheduleMaintenanceRequestBody.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.reschedule != null && Object.hasOwnProperty.call(message, "reschedule")) - $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.encode(message.reschedule, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRescheduleMaintenanceRequestBody.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRescheduleMaintenanceRequestBody.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 3: { - message.reschedule = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRescheduleMaintenanceRequestBody.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRescheduleMaintenanceRequestBody message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRescheduleMaintenanceRequestBody.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.reschedule != null && message.hasOwnProperty("reschedule")) { - var error = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify(message.reschedule); - if (error) - return "reschedule." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRescheduleMaintenanceRequestBody message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody - */ - SqlInstancesRescheduleMaintenanceRequestBody.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody(); - if (object.reschedule != null) { - if (typeof object.reschedule !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.reschedule: object expected"); - message.reschedule = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.fromObject(object.reschedule); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequestBody message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRescheduleMaintenanceRequestBody.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.reschedule = null; - if (message.reschedule != null && message.hasOwnProperty("reschedule")) - object.reschedule = $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.toObject(message.reschedule, options); - return object; - }; - - /** - * Converts this SqlInstancesRescheduleMaintenanceRequestBody to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRescheduleMaintenanceRequestBody.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRescheduleMaintenanceRequestBody - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRescheduleMaintenanceRequestBody.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody"; - }; - - /** - * RescheduleType enum. - * @name google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType - * @enum {number} - * @property {number} RESCHEDULE_TYPE_UNSPECIFIED=0 RESCHEDULE_TYPE_UNSPECIFIED value - * @property {number} IMMEDIATE=1 IMMEDIATE value - * @property {number} NEXT_AVAILABLE_WINDOW=2 NEXT_AVAILABLE_WINDOW value - * @property {number} SPECIFIC_TIME=3 SPECIFIC_TIME value - */ - SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RESCHEDULE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "IMMEDIATE"] = 1; - values[valuesById[2] = "NEXT_AVAILABLE_WINDOW"] = 2; - values[valuesById[3] = "SPECIFIC_TIME"] = 3; - return values; - })(); - - SqlInstancesRescheduleMaintenanceRequestBody.Reschedule = (function() { - - /** - * Properties of a Reschedule. - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @interface IReschedule - * @property {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|null} [rescheduleType] Reschedule rescheduleType - * @property {google.protobuf.ITimestamp|null} [scheduleTime] Reschedule scheduleTime - */ - - /** - * Constructs a new Reschedule. - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody - * @classdesc Represents a Reschedule. - * @implements IReschedule - * @constructor - * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule=} [properties] Properties to set - */ - function Reschedule(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Reschedule rescheduleType. - * @member {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType} rescheduleType - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @instance - */ - Reschedule.prototype.rescheduleType = 0; - - /** - * Reschedule scheduleTime. - * @member {google.protobuf.ITimestamp|null|undefined} scheduleTime - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @instance - */ - Reschedule.prototype.scheduleTime = null; - - /** - * Creates a new Reschedule instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule instance - */ - Reschedule.create = function create(properties) { - return new Reschedule(properties); - }; - - /** - * Encodes the specified Reschedule message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule} message Reschedule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Reschedule.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rescheduleType != null && Object.hasOwnProperty.call(message, "rescheduleType")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.rescheduleType); - if (message.scheduleTime != null && Object.hasOwnProperty.call(message, "scheduleTime")) - $root.google.protobuf.Timestamp.encode(message.scheduleTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Reschedule message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule} message Reschedule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Reschedule.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Reschedule message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Reschedule.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.rescheduleType = reader.int32(); - break; - } - case 2: { - message.scheduleTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Reschedule message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Reschedule.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Reschedule message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Reschedule.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rescheduleType != null && message.hasOwnProperty("rescheduleType")) - switch (message.rescheduleType) { - default: - return "rescheduleType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.scheduleTime != null && message.hasOwnProperty("scheduleTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.scheduleTime); - if (error) - return "scheduleTime." + error; - } - return null; - }; - - /** - * Creates a Reschedule message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule - */ - Reschedule.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule(); - switch (object.rescheduleType) { - default: - if (typeof object.rescheduleType === "number") { - message.rescheduleType = object.rescheduleType; - break; - } - break; - case "RESCHEDULE_TYPE_UNSPECIFIED": - case 0: - message.rescheduleType = 0; - break; - case "IMMEDIATE": - case 1: - message.rescheduleType = 1; - break; - case "NEXT_AVAILABLE_WINDOW": - case 2: - message.rescheduleType = 2; - break; - case "SPECIFIC_TIME": - case 3: - message.rescheduleType = 3; - break; - } - if (object.scheduleTime != null) { - if (typeof object.scheduleTime !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.scheduleTime: object expected"); - message.scheduleTime = $root.google.protobuf.Timestamp.fromObject(object.scheduleTime); - } - return message; - }; - - /** - * Creates a plain object from a Reschedule message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} message Reschedule - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Reschedule.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.rescheduleType = options.enums === String ? "RESCHEDULE_TYPE_UNSPECIFIED" : 0; - object.scheduleTime = null; - } - if (message.rescheduleType != null && message.hasOwnProperty("rescheduleType")) - object.rescheduleType = options.enums === String ? $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType[message.rescheduleType] === undefined ? message.rescheduleType : $root.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType[message.rescheduleType] : message.rescheduleType; - if (message.scheduleTime != null && message.hasOwnProperty("scheduleTime")) - object.scheduleTime = $root.google.protobuf.Timestamp.toObject(message.scheduleTime, options); - return object; - }; - - /** - * Converts this Reschedule to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @instance - * @returns {Object.} JSON object - */ - Reschedule.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Reschedule - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Reschedule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule"; - }; - - return Reschedule; - })(); - - return SqlInstancesRescheduleMaintenanceRequestBody; - })(); - - v1.DemoteMasterContext = (function() { - - /** - * Properties of a DemoteMasterContext. - * @memberof google.cloud.sql.v1 - * @interface IDemoteMasterContext - * @property {string|null} [kind] DemoteMasterContext kind - * @property {google.protobuf.IBoolValue|null} [verifyGtidConsistency] DemoteMasterContext verifyGtidConsistency - * @property {string|null} [masterInstanceName] DemoteMasterContext masterInstanceName - * @property {google.cloud.sql.v1.IDemoteMasterConfiguration|null} [replicaConfiguration] DemoteMasterContext replicaConfiguration - * @property {boolean|null} [skipReplicationSetup] DemoteMasterContext skipReplicationSetup - */ - - /** - * Constructs a new DemoteMasterContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DemoteMasterContext. - * @implements IDemoteMasterContext - * @constructor - * @param {google.cloud.sql.v1.IDemoteMasterContext=} [properties] Properties to set - */ - function DemoteMasterContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DemoteMasterContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @instance - */ - DemoteMasterContext.prototype.kind = ""; - - /** - * DemoteMasterContext verifyGtidConsistency. - * @member {google.protobuf.IBoolValue|null|undefined} verifyGtidConsistency - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @instance - */ - DemoteMasterContext.prototype.verifyGtidConsistency = null; - - /** - * DemoteMasterContext masterInstanceName. - * @member {string} masterInstanceName - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @instance - */ - DemoteMasterContext.prototype.masterInstanceName = ""; - - /** - * DemoteMasterContext replicaConfiguration. - * @member {google.cloud.sql.v1.IDemoteMasterConfiguration|null|undefined} replicaConfiguration - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @instance - */ - DemoteMasterContext.prototype.replicaConfiguration = null; - - /** - * DemoteMasterContext skipReplicationSetup. - * @member {boolean} skipReplicationSetup - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @instance - */ - DemoteMasterContext.prototype.skipReplicationSetup = false; - - /** - * Creates a new DemoteMasterContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @static - * @param {google.cloud.sql.v1.IDemoteMasterContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DemoteMasterContext} DemoteMasterContext instance - */ - DemoteMasterContext.create = function create(properties) { - return new DemoteMasterContext(properties); - }; - - /** - * Encodes the specified DemoteMasterContext message. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @static - * @param {google.cloud.sql.v1.IDemoteMasterContext} message DemoteMasterContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.verifyGtidConsistency != null && Object.hasOwnProperty.call(message, "verifyGtidConsistency")) - $root.google.protobuf.BoolValue.encode(message.verifyGtidConsistency, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.masterInstanceName != null && Object.hasOwnProperty.call(message, "masterInstanceName")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.masterInstanceName); - if (message.replicaConfiguration != null && Object.hasOwnProperty.call(message, "replicaConfiguration")) - $root.google.cloud.sql.v1.DemoteMasterConfiguration.encode(message.replicaConfiguration, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.skipReplicationSetup != null && Object.hasOwnProperty.call(message, "skipReplicationSetup")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.skipReplicationSetup); - return writer; - }; - - /** - * Encodes the specified DemoteMasterContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteMasterContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @static - * @param {google.cloud.sql.v1.IDemoteMasterContext} message DemoteMasterContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DemoteMasterContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DemoteMasterContext} DemoteMasterContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DemoteMasterContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.verifyGtidConsistency = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 3: { - message.masterInstanceName = reader.string(); - break; - } - case 4: { - message.replicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterConfiguration.decode(reader, reader.uint32()); - break; - } - case 5: { - message.skipReplicationSetup = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DemoteMasterContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DemoteMasterContext} DemoteMasterContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DemoteMasterContext message. - * @function verify - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DemoteMasterContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.verifyGtidConsistency != null && message.hasOwnProperty("verifyGtidConsistency")) { - var error = $root.google.protobuf.BoolValue.verify(message.verifyGtidConsistency); - if (error) - return "verifyGtidConsistency." + error; - } - if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) - if (!$util.isString(message.masterInstanceName)) - return "masterInstanceName: string expected"; - if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) { - var error = $root.google.cloud.sql.v1.DemoteMasterConfiguration.verify(message.replicaConfiguration); - if (error) - return "replicaConfiguration." + error; - } - if (message.skipReplicationSetup != null && message.hasOwnProperty("skipReplicationSetup")) - if (typeof message.skipReplicationSetup !== "boolean") - return "skipReplicationSetup: boolean expected"; - return null; - }; - - /** - * Creates a DemoteMasterContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DemoteMasterContext} DemoteMasterContext - */ - DemoteMasterContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DemoteMasterContext) - return object; - var message = new $root.google.cloud.sql.v1.DemoteMasterContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.verifyGtidConsistency != null) { - if (typeof object.verifyGtidConsistency !== "object") - throw TypeError(".google.cloud.sql.v1.DemoteMasterContext.verifyGtidConsistency: object expected"); - message.verifyGtidConsistency = $root.google.protobuf.BoolValue.fromObject(object.verifyGtidConsistency); - } - if (object.masterInstanceName != null) - message.masterInstanceName = String(object.masterInstanceName); - if (object.replicaConfiguration != null) { - if (typeof object.replicaConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1.DemoteMasterContext.replicaConfiguration: object expected"); - message.replicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterConfiguration.fromObject(object.replicaConfiguration); - } - if (object.skipReplicationSetup != null) - message.skipReplicationSetup = Boolean(object.skipReplicationSetup); - return message; - }; - - /** - * Creates a plain object from a DemoteMasterContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @static - * @param {google.cloud.sql.v1.DemoteMasterContext} message DemoteMasterContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DemoteMasterContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.verifyGtidConsistency = null; - object.masterInstanceName = ""; - object.replicaConfiguration = null; - object.skipReplicationSetup = false; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.verifyGtidConsistency != null && message.hasOwnProperty("verifyGtidConsistency")) - object.verifyGtidConsistency = $root.google.protobuf.BoolValue.toObject(message.verifyGtidConsistency, options); - if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) - object.masterInstanceName = message.masterInstanceName; - if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) - object.replicaConfiguration = $root.google.cloud.sql.v1.DemoteMasterConfiguration.toObject(message.replicaConfiguration, options); - if (message.skipReplicationSetup != null && message.hasOwnProperty("skipReplicationSetup")) - object.skipReplicationSetup = message.skipReplicationSetup; - return object; - }; - - /** - * Converts this DemoteMasterContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @instance - * @returns {Object.} JSON object - */ - DemoteMasterContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DemoteMasterContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DemoteMasterContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DemoteMasterContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DemoteMasterContext"; - }; - - return DemoteMasterContext; - })(); - - v1.DemoteContext = (function() { - - /** - * Properties of a DemoteContext. - * @memberof google.cloud.sql.v1 - * @interface IDemoteContext - * @property {string|null} [kind] DemoteContext kind - * @property {string|null} [sourceRepresentativeInstanceName] DemoteContext sourceRepresentativeInstanceName - */ - - /** - * Constructs a new DemoteContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DemoteContext. - * @implements IDemoteContext - * @constructor - * @param {google.cloud.sql.v1.IDemoteContext=} [properties] Properties to set - */ - function DemoteContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DemoteContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.DemoteContext - * @instance - */ - DemoteContext.prototype.kind = ""; - - /** - * DemoteContext sourceRepresentativeInstanceName. - * @member {string} sourceRepresentativeInstanceName - * @memberof google.cloud.sql.v1.DemoteContext - * @instance - */ - DemoteContext.prototype.sourceRepresentativeInstanceName = ""; - - /** - * Creates a new DemoteContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DemoteContext - * @static - * @param {google.cloud.sql.v1.IDemoteContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DemoteContext} DemoteContext instance - */ - DemoteContext.create = function create(properties) { - return new DemoteContext(properties); - }; - - /** - * Encodes the specified DemoteContext message. Does not implicitly {@link google.cloud.sql.v1.DemoteContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DemoteContext - * @static - * @param {google.cloud.sql.v1.IDemoteContext} message DemoteContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.sourceRepresentativeInstanceName != null && Object.hasOwnProperty.call(message, "sourceRepresentativeInstanceName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceRepresentativeInstanceName); - return writer; - }; - - /** - * Encodes the specified DemoteContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DemoteContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DemoteContext - * @static - * @param {google.cloud.sql.v1.IDemoteContext} message DemoteContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DemoteContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DemoteContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DemoteContext} DemoteContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DemoteContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.sourceRepresentativeInstanceName = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DemoteContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DemoteContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DemoteContext} DemoteContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DemoteContext message. - * @function verify - * @memberof google.cloud.sql.v1.DemoteContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DemoteContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.sourceRepresentativeInstanceName != null && message.hasOwnProperty("sourceRepresentativeInstanceName")) - if (!$util.isString(message.sourceRepresentativeInstanceName)) - return "sourceRepresentativeInstanceName: string expected"; - return null; - }; - - /** - * Creates a DemoteContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DemoteContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DemoteContext} DemoteContext - */ - DemoteContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DemoteContext) - return object; - var message = new $root.google.cloud.sql.v1.DemoteContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.sourceRepresentativeInstanceName != null) - message.sourceRepresentativeInstanceName = String(object.sourceRepresentativeInstanceName); - return message; - }; - - /** - * Creates a plain object from a DemoteContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DemoteContext - * @static - * @param {google.cloud.sql.v1.DemoteContext} message DemoteContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DemoteContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.sourceRepresentativeInstanceName = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.sourceRepresentativeInstanceName != null && message.hasOwnProperty("sourceRepresentativeInstanceName")) - object.sourceRepresentativeInstanceName = message.sourceRepresentativeInstanceName; - return object; - }; - - /** - * Converts this DemoteContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DemoteContext - * @instance - * @returns {Object.} JSON object - */ - DemoteContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DemoteContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DemoteContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DemoteContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DemoteContext"; - }; - - return DemoteContext; - })(); - - v1.FailoverContext = (function() { - - /** - * Properties of a FailoverContext. - * @memberof google.cloud.sql.v1 - * @interface IFailoverContext - * @property {number|Long|null} [settingsVersion] FailoverContext settingsVersion - * @property {string|null} [kind] FailoverContext kind - */ - - /** - * Constructs a new FailoverContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a FailoverContext. - * @implements IFailoverContext - * @constructor - * @param {google.cloud.sql.v1.IFailoverContext=} [properties] Properties to set - */ - function FailoverContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FailoverContext settingsVersion. - * @member {number|Long} settingsVersion - * @memberof google.cloud.sql.v1.FailoverContext - * @instance - */ - FailoverContext.prototype.settingsVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * FailoverContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.FailoverContext - * @instance - */ - FailoverContext.prototype.kind = ""; - - /** - * Creates a new FailoverContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.FailoverContext - * @static - * @param {google.cloud.sql.v1.IFailoverContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.FailoverContext} FailoverContext instance - */ - FailoverContext.create = function create(properties) { - return new FailoverContext(properties); - }; - - /** - * Encodes the specified FailoverContext message. Does not implicitly {@link google.cloud.sql.v1.FailoverContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.FailoverContext - * @static - * @param {google.cloud.sql.v1.IFailoverContext} message FailoverContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FailoverContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.settingsVersion != null && Object.hasOwnProperty.call(message, "settingsVersion")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.settingsVersion); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - return writer; - }; - - /** - * Encodes the specified FailoverContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FailoverContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.FailoverContext - * @static - * @param {google.cloud.sql.v1.IFailoverContext} message FailoverContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FailoverContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FailoverContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.FailoverContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.FailoverContext} FailoverContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FailoverContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.FailoverContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.settingsVersion = reader.int64(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FailoverContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.FailoverContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.FailoverContext} FailoverContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FailoverContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FailoverContext message. - * @function verify - * @memberof google.cloud.sql.v1.FailoverContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FailoverContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) - if (!$util.isInteger(message.settingsVersion) && !(message.settingsVersion && $util.isInteger(message.settingsVersion.low) && $util.isInteger(message.settingsVersion.high))) - return "settingsVersion: integer|Long expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a FailoverContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.FailoverContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.FailoverContext} FailoverContext - */ - FailoverContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.FailoverContext) - return object; - var message = new $root.google.cloud.sql.v1.FailoverContext(); - if (object.settingsVersion != null) - if ($util.Long) - (message.settingsVersion = $util.Long.fromValue(object.settingsVersion)).unsigned = false; - else if (typeof object.settingsVersion === "string") - message.settingsVersion = parseInt(object.settingsVersion, 10); - else if (typeof object.settingsVersion === "number") - message.settingsVersion = object.settingsVersion; - else if (typeof object.settingsVersion === "object") - message.settingsVersion = new $util.LongBits(object.settingsVersion.low >>> 0, object.settingsVersion.high >>> 0).toNumber(); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a FailoverContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.FailoverContext - * @static - * @param {google.cloud.sql.v1.FailoverContext} message FailoverContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FailoverContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.settingsVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.settingsVersion = options.longs === String ? "0" : 0; - object.kind = ""; - } - if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) - if (typeof message.settingsVersion === "number") - object.settingsVersion = options.longs === String ? String(message.settingsVersion) : message.settingsVersion; - else - object.settingsVersion = options.longs === String ? $util.Long.prototype.toString.call(message.settingsVersion) : options.longs === Number ? new $util.LongBits(message.settingsVersion.low >>> 0, message.settingsVersion.high >>> 0).toNumber() : message.settingsVersion; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this FailoverContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.FailoverContext - * @instance - * @returns {Object.} JSON object - */ - FailoverContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FailoverContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.FailoverContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FailoverContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.FailoverContext"; - }; - - return FailoverContext; - })(); - - v1.RestoreBackupContext = (function() { - - /** - * Properties of a RestoreBackupContext. - * @memberof google.cloud.sql.v1 - * @interface IRestoreBackupContext - * @property {string|null} [kind] RestoreBackupContext kind - * @property {number|Long|null} [backupRunId] RestoreBackupContext backupRunId - * @property {string|null} [instanceId] RestoreBackupContext instanceId - * @property {string|null} [project] RestoreBackupContext project - */ - - /** - * Constructs a new RestoreBackupContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a RestoreBackupContext. - * @implements IRestoreBackupContext - * @constructor - * @param {google.cloud.sql.v1.IRestoreBackupContext=} [properties] Properties to set - */ - function RestoreBackupContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RestoreBackupContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @instance - */ - RestoreBackupContext.prototype.kind = ""; - - /** - * RestoreBackupContext backupRunId. - * @member {number|Long} backupRunId - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @instance - */ - RestoreBackupContext.prototype.backupRunId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * RestoreBackupContext instanceId. - * @member {string} instanceId - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @instance - */ - RestoreBackupContext.prototype.instanceId = ""; - - /** - * RestoreBackupContext project. - * @member {string} project - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @instance - */ - RestoreBackupContext.prototype.project = ""; - - /** - * Creates a new RestoreBackupContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @static - * @param {google.cloud.sql.v1.IRestoreBackupContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.RestoreBackupContext} RestoreBackupContext instance - */ - RestoreBackupContext.create = function create(properties) { - return new RestoreBackupContext(properties); - }; - - /** - * Encodes the specified RestoreBackupContext message. Does not implicitly {@link google.cloud.sql.v1.RestoreBackupContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @static - * @param {google.cloud.sql.v1.IRestoreBackupContext} message RestoreBackupContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RestoreBackupContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.backupRunId != null && Object.hasOwnProperty.call(message, "backupRunId")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.backupRunId); - if (message.instanceId != null && Object.hasOwnProperty.call(message, "instanceId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.instanceId); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - return writer; - }; - - /** - * Encodes the specified RestoreBackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RestoreBackupContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @static - * @param {google.cloud.sql.v1.IRestoreBackupContext} message RestoreBackupContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RestoreBackupContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RestoreBackupContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.RestoreBackupContext} RestoreBackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RestoreBackupContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.RestoreBackupContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.backupRunId = reader.int64(); - break; - } - case 3: { - message.instanceId = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RestoreBackupContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.RestoreBackupContext} RestoreBackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RestoreBackupContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RestoreBackupContext message. - * @function verify - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RestoreBackupContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.backupRunId != null && message.hasOwnProperty("backupRunId")) - if (!$util.isInteger(message.backupRunId) && !(message.backupRunId && $util.isInteger(message.backupRunId.low) && $util.isInteger(message.backupRunId.high))) - return "backupRunId: integer|Long expected"; - if (message.instanceId != null && message.hasOwnProperty("instanceId")) - if (!$util.isString(message.instanceId)) - return "instanceId: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a RestoreBackupContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.RestoreBackupContext} RestoreBackupContext - */ - RestoreBackupContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.RestoreBackupContext) - return object; - var message = new $root.google.cloud.sql.v1.RestoreBackupContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.backupRunId != null) - if ($util.Long) - (message.backupRunId = $util.Long.fromValue(object.backupRunId)).unsigned = false; - else if (typeof object.backupRunId === "string") - message.backupRunId = parseInt(object.backupRunId, 10); - else if (typeof object.backupRunId === "number") - message.backupRunId = object.backupRunId; - else if (typeof object.backupRunId === "object") - message.backupRunId = new $util.LongBits(object.backupRunId.low >>> 0, object.backupRunId.high >>> 0).toNumber(); - if (object.instanceId != null) - message.instanceId = String(object.instanceId); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a RestoreBackupContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @static - * @param {google.cloud.sql.v1.RestoreBackupContext} message RestoreBackupContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RestoreBackupContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.backupRunId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.backupRunId = options.longs === String ? "0" : 0; - object.instanceId = ""; - object.project = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.backupRunId != null && message.hasOwnProperty("backupRunId")) - if (typeof message.backupRunId === "number") - object.backupRunId = options.longs === String ? String(message.backupRunId) : message.backupRunId; - else - object.backupRunId = options.longs === String ? $util.Long.prototype.toString.call(message.backupRunId) : options.longs === Number ? new $util.LongBits(message.backupRunId.low >>> 0, message.backupRunId.high >>> 0).toNumber() : message.backupRunId; - if (message.instanceId != null && message.hasOwnProperty("instanceId")) - object.instanceId = message.instanceId; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this RestoreBackupContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @instance - * @returns {Object.} JSON object - */ - RestoreBackupContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RestoreBackupContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.RestoreBackupContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RestoreBackupContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.RestoreBackupContext"; - }; - - return RestoreBackupContext; - })(); - - v1.RotateServerCaContext = (function() { - - /** - * Properties of a RotateServerCaContext. - * @memberof google.cloud.sql.v1 - * @interface IRotateServerCaContext - * @property {string|null} [kind] RotateServerCaContext kind - * @property {string|null} [nextVersion] RotateServerCaContext nextVersion - */ - - /** - * Constructs a new RotateServerCaContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a RotateServerCaContext. - * @implements IRotateServerCaContext - * @constructor - * @param {google.cloud.sql.v1.IRotateServerCaContext=} [properties] Properties to set - */ - function RotateServerCaContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RotateServerCaContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @instance - */ - RotateServerCaContext.prototype.kind = ""; - - /** - * RotateServerCaContext nextVersion. - * @member {string} nextVersion - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @instance - */ - RotateServerCaContext.prototype.nextVersion = ""; - - /** - * Creates a new RotateServerCaContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @static - * @param {google.cloud.sql.v1.IRotateServerCaContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.RotateServerCaContext} RotateServerCaContext instance - */ - RotateServerCaContext.create = function create(properties) { - return new RotateServerCaContext(properties); - }; - - /** - * Encodes the specified RotateServerCaContext message. Does not implicitly {@link google.cloud.sql.v1.RotateServerCaContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @static - * @param {google.cloud.sql.v1.IRotateServerCaContext} message RotateServerCaContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateServerCaContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); - return writer; - }; - - /** - * Encodes the specified RotateServerCaContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateServerCaContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @static - * @param {google.cloud.sql.v1.IRotateServerCaContext} message RotateServerCaContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateServerCaContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RotateServerCaContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.RotateServerCaContext} RotateServerCaContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateServerCaContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.RotateServerCaContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.nextVersion = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RotateServerCaContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.RotateServerCaContext} RotateServerCaContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateServerCaContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RotateServerCaContext message. - * @function verify - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RotateServerCaContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - if (!$util.isString(message.nextVersion)) - return "nextVersion: string expected"; - return null; - }; - - /** - * Creates a RotateServerCaContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.RotateServerCaContext} RotateServerCaContext - */ - RotateServerCaContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.RotateServerCaContext) - return object; - var message = new $root.google.cloud.sql.v1.RotateServerCaContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.nextVersion != null) - message.nextVersion = String(object.nextVersion); - return message; - }; - - /** - * Creates a plain object from a RotateServerCaContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @static - * @param {google.cloud.sql.v1.RotateServerCaContext} message RotateServerCaContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RotateServerCaContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.nextVersion = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - object.nextVersion = message.nextVersion; - return object; - }; - - /** - * Converts this RotateServerCaContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @instance - * @returns {Object.} JSON object - */ - RotateServerCaContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RotateServerCaContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.RotateServerCaContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RotateServerCaContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.RotateServerCaContext"; - }; - - return RotateServerCaContext; - })(); - - v1.RotateServerCertificateContext = (function() { - - /** - * Properties of a RotateServerCertificateContext. - * @memberof google.cloud.sql.v1 - * @interface IRotateServerCertificateContext - * @property {string|null} [kind] RotateServerCertificateContext kind - * @property {string|null} [nextVersion] RotateServerCertificateContext nextVersion - */ - - /** - * Constructs a new RotateServerCertificateContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a RotateServerCertificateContext. - * @implements IRotateServerCertificateContext - * @constructor - * @param {google.cloud.sql.v1.IRotateServerCertificateContext=} [properties] Properties to set - */ - function RotateServerCertificateContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RotateServerCertificateContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @instance - */ - RotateServerCertificateContext.prototype.kind = ""; - - /** - * RotateServerCertificateContext nextVersion. - * @member {string} nextVersion - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @instance - */ - RotateServerCertificateContext.prototype.nextVersion = ""; - - /** - * Creates a new RotateServerCertificateContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @static - * @param {google.cloud.sql.v1.IRotateServerCertificateContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.RotateServerCertificateContext} RotateServerCertificateContext instance - */ - RotateServerCertificateContext.create = function create(properties) { - return new RotateServerCertificateContext(properties); - }; - - /** - * Encodes the specified RotateServerCertificateContext message. Does not implicitly {@link google.cloud.sql.v1.RotateServerCertificateContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @static - * @param {google.cloud.sql.v1.IRotateServerCertificateContext} message RotateServerCertificateContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateServerCertificateContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); - return writer; - }; - - /** - * Encodes the specified RotateServerCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateServerCertificateContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @static - * @param {google.cloud.sql.v1.IRotateServerCertificateContext} message RotateServerCertificateContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateServerCertificateContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RotateServerCertificateContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.RotateServerCertificateContext} RotateServerCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateServerCertificateContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.RotateServerCertificateContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.nextVersion = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RotateServerCertificateContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.RotateServerCertificateContext} RotateServerCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateServerCertificateContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RotateServerCertificateContext message. - * @function verify - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RotateServerCertificateContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - if (!$util.isString(message.nextVersion)) - return "nextVersion: string expected"; - return null; - }; - - /** - * Creates a RotateServerCertificateContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.RotateServerCertificateContext} RotateServerCertificateContext - */ - RotateServerCertificateContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.RotateServerCertificateContext) - return object; - var message = new $root.google.cloud.sql.v1.RotateServerCertificateContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.nextVersion != null) - message.nextVersion = String(object.nextVersion); - return message; - }; - - /** - * Creates a plain object from a RotateServerCertificateContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @static - * @param {google.cloud.sql.v1.RotateServerCertificateContext} message RotateServerCertificateContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RotateServerCertificateContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.nextVersion = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - object.nextVersion = message.nextVersion; - return object; - }; - - /** - * Converts this RotateServerCertificateContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @instance - * @returns {Object.} JSON object - */ - RotateServerCertificateContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RotateServerCertificateContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.RotateServerCertificateContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RotateServerCertificateContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.RotateServerCertificateContext"; - }; - - return RotateServerCertificateContext; - })(); - - v1.RotateEntraIdCertificateContext = (function() { - - /** - * Properties of a RotateEntraIdCertificateContext. - * @memberof google.cloud.sql.v1 - * @interface IRotateEntraIdCertificateContext - * @property {string|null} [kind] RotateEntraIdCertificateContext kind - * @property {string|null} [nextVersion] RotateEntraIdCertificateContext nextVersion - */ - - /** - * Constructs a new RotateEntraIdCertificateContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a RotateEntraIdCertificateContext. - * @implements IRotateEntraIdCertificateContext - * @constructor - * @param {google.cloud.sql.v1.IRotateEntraIdCertificateContext=} [properties] Properties to set - */ - function RotateEntraIdCertificateContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RotateEntraIdCertificateContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @instance - */ - RotateEntraIdCertificateContext.prototype.kind = ""; - - /** - * RotateEntraIdCertificateContext nextVersion. - * @member {string} nextVersion - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @instance - */ - RotateEntraIdCertificateContext.prototype.nextVersion = ""; - - /** - * Creates a new RotateEntraIdCertificateContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @static - * @param {google.cloud.sql.v1.IRotateEntraIdCertificateContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext instance - */ - RotateEntraIdCertificateContext.create = function create(properties) { - return new RotateEntraIdCertificateContext(properties); - }; - - /** - * Encodes the specified RotateEntraIdCertificateContext message. Does not implicitly {@link google.cloud.sql.v1.RotateEntraIdCertificateContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @static - * @param {google.cloud.sql.v1.IRotateEntraIdCertificateContext} message RotateEntraIdCertificateContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateEntraIdCertificateContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); - return writer; - }; - - /** - * Encodes the specified RotateEntraIdCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.RotateEntraIdCertificateContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @static - * @param {google.cloud.sql.v1.IRotateEntraIdCertificateContext} message RotateEntraIdCertificateContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateEntraIdCertificateContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateEntraIdCertificateContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.RotateEntraIdCertificateContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.nextVersion = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateEntraIdCertificateContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RotateEntraIdCertificateContext message. - * @function verify - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RotateEntraIdCertificateContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - if (!$util.isString(message.nextVersion)) - return "nextVersion: string expected"; - return null; - }; - - /** - * Creates a RotateEntraIdCertificateContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext - */ - RotateEntraIdCertificateContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.RotateEntraIdCertificateContext) - return object; - var message = new $root.google.cloud.sql.v1.RotateEntraIdCertificateContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.nextVersion != null) - message.nextVersion = String(object.nextVersion); - return message; - }; - - /** - * Creates a plain object from a RotateEntraIdCertificateContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @static - * @param {google.cloud.sql.v1.RotateEntraIdCertificateContext} message RotateEntraIdCertificateContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RotateEntraIdCertificateContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.nextVersion = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - object.nextVersion = message.nextVersion; - return object; - }; - - /** - * Converts this RotateEntraIdCertificateContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @instance - * @returns {Object.} JSON object - */ - RotateEntraIdCertificateContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RotateEntraIdCertificateContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.RotateEntraIdCertificateContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RotateEntraIdCertificateContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.RotateEntraIdCertificateContext"; - }; - - return RotateEntraIdCertificateContext; - })(); - - v1.TruncateLogContext = (function() { - - /** - * Properties of a TruncateLogContext. - * @memberof google.cloud.sql.v1 - * @interface ITruncateLogContext - * @property {string|null} [kind] TruncateLogContext kind - * @property {string|null} [logType] TruncateLogContext logType - */ - - /** - * Constructs a new TruncateLogContext. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a TruncateLogContext. - * @implements ITruncateLogContext - * @constructor - * @param {google.cloud.sql.v1.ITruncateLogContext=} [properties] Properties to set - */ - function TruncateLogContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TruncateLogContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.TruncateLogContext - * @instance - */ - TruncateLogContext.prototype.kind = ""; - - /** - * TruncateLogContext logType. - * @member {string} logType - * @memberof google.cloud.sql.v1.TruncateLogContext - * @instance - */ - TruncateLogContext.prototype.logType = ""; - - /** - * Creates a new TruncateLogContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.TruncateLogContext - * @static - * @param {google.cloud.sql.v1.ITruncateLogContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1.TruncateLogContext} TruncateLogContext instance - */ - TruncateLogContext.create = function create(properties) { - return new TruncateLogContext(properties); - }; - - /** - * Encodes the specified TruncateLogContext message. Does not implicitly {@link google.cloud.sql.v1.TruncateLogContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.TruncateLogContext - * @static - * @param {google.cloud.sql.v1.ITruncateLogContext} message TruncateLogContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TruncateLogContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.logType != null && Object.hasOwnProperty.call(message, "logType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.logType); - return writer; - }; - - /** - * Encodes the specified TruncateLogContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1.TruncateLogContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.TruncateLogContext - * @static - * @param {google.cloud.sql.v1.ITruncateLogContext} message TruncateLogContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TruncateLogContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TruncateLogContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.TruncateLogContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.TruncateLogContext} TruncateLogContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TruncateLogContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.TruncateLogContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.logType = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TruncateLogContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.TruncateLogContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.TruncateLogContext} TruncateLogContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TruncateLogContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TruncateLogContext message. - * @function verify - * @memberof google.cloud.sql.v1.TruncateLogContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TruncateLogContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.logType != null && message.hasOwnProperty("logType")) - if (!$util.isString(message.logType)) - return "logType: string expected"; - return null; - }; - - /** - * Creates a TruncateLogContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.TruncateLogContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.TruncateLogContext} TruncateLogContext - */ - TruncateLogContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.TruncateLogContext) - return object; - var message = new $root.google.cloud.sql.v1.TruncateLogContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.logType != null) - message.logType = String(object.logType); - return message; - }; - - /** - * Creates a plain object from a TruncateLogContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.TruncateLogContext - * @static - * @param {google.cloud.sql.v1.TruncateLogContext} message TruncateLogContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TruncateLogContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.logType = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.logType != null && message.hasOwnProperty("logType")) - object.logType = message.logType; - return object; - }; - - /** - * Converts this TruncateLogContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.TruncateLogContext - * @instance - * @returns {Object.} JSON object - */ - TruncateLogContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TruncateLogContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1.TruncateLogContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TruncateLogContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.TruncateLogContext"; - }; - - return TruncateLogContext; - })(); - - v1.SqlExternalSyncSettingError = (function() { - - /** - * Properties of a SqlExternalSyncSettingError. - * @memberof google.cloud.sql.v1 - * @interface ISqlExternalSyncSettingError - * @property {string|null} [kind] SqlExternalSyncSettingError kind - * @property {google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|null} [type] SqlExternalSyncSettingError type - * @property {string|null} [detail] SqlExternalSyncSettingError detail - */ - - /** - * Constructs a new SqlExternalSyncSettingError. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlExternalSyncSettingError. - * @implements ISqlExternalSyncSettingError - * @constructor - * @param {google.cloud.sql.v1.ISqlExternalSyncSettingError=} [properties] Properties to set - */ - function SqlExternalSyncSettingError(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlExternalSyncSettingError kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @instance - */ - SqlExternalSyncSettingError.prototype.kind = ""; - - /** - * SqlExternalSyncSettingError type. - * @member {google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType} type - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @instance - */ - SqlExternalSyncSettingError.prototype.type = 0; - - /** - * SqlExternalSyncSettingError detail. - * @member {string} detail - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @instance - */ - SqlExternalSyncSettingError.prototype.detail = ""; - - /** - * Creates a new SqlExternalSyncSettingError instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @static - * @param {google.cloud.sql.v1.ISqlExternalSyncSettingError=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlExternalSyncSettingError} SqlExternalSyncSettingError instance - */ - SqlExternalSyncSettingError.create = function create(properties) { - return new SqlExternalSyncSettingError(properties); - }; - - /** - * Encodes the specified SqlExternalSyncSettingError message. Does not implicitly {@link google.cloud.sql.v1.SqlExternalSyncSettingError.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @static - * @param {google.cloud.sql.v1.ISqlExternalSyncSettingError} message SqlExternalSyncSettingError message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlExternalSyncSettingError.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); - if (message.detail != null && Object.hasOwnProperty.call(message, "detail")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.detail); - return writer; - }; - - /** - * Encodes the specified SqlExternalSyncSettingError message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlExternalSyncSettingError.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @static - * @param {google.cloud.sql.v1.ISqlExternalSyncSettingError} message SqlExternalSyncSettingError message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlExternalSyncSettingError.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlExternalSyncSettingError} SqlExternalSyncSettingError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlExternalSyncSettingError.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlExternalSyncSettingError(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.type = reader.int32(); - break; - } - case 3: { - message.detail = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlExternalSyncSettingError} SqlExternalSyncSettingError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlExternalSyncSettingError.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlExternalSyncSettingError message. - * @function verify - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlExternalSyncSettingError.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - break; - } - if (message.detail != null && message.hasOwnProperty("detail")) - if (!$util.isString(message.detail)) - return "detail: string expected"; - return null; - }; - - /** - * Creates a SqlExternalSyncSettingError message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlExternalSyncSettingError} SqlExternalSyncSettingError - */ - SqlExternalSyncSettingError.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlExternalSyncSettingError) - return object; - var message = new $root.google.cloud.sql.v1.SqlExternalSyncSettingError(); - if (object.kind != null) - message.kind = String(object.kind); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "CONNECTION_FAILURE": - case 1: - message.type = 1; - break; - case "BINLOG_NOT_ENABLED": - case 2: - message.type = 2; - break; - case "INCOMPATIBLE_DATABASE_VERSION": - case 3: - message.type = 3; - break; - case "REPLICA_ALREADY_SETUP": - case 4: - message.type = 4; - break; - case "INSUFFICIENT_PRIVILEGE": - case 5: - message.type = 5; - break; - case "UNSUPPORTED_MIGRATION_TYPE": - case 6: - message.type = 6; - break; - case "NO_PGLOGICAL_INSTALLED": - case 7: - message.type = 7; - break; - case "PGLOGICAL_NODE_ALREADY_EXISTS": - case 8: - message.type = 8; - break; - case "INVALID_WAL_LEVEL": - case 9: - message.type = 9; - break; - case "INVALID_SHARED_PRELOAD_LIBRARY": - case 10: - message.type = 10; - break; - case "INSUFFICIENT_MAX_REPLICATION_SLOTS": - case 11: - message.type = 11; - break; - case "INSUFFICIENT_MAX_WAL_SENDERS": - case 12: - message.type = 12; - break; - case "INSUFFICIENT_MAX_WORKER_PROCESSES": - case 13: - message.type = 13; - break; - case "UNSUPPORTED_EXTENSIONS": - case 14: - message.type = 14; - break; - case "INVALID_RDS_LOGICAL_REPLICATION": - case 15: - message.type = 15; - break; - case "INVALID_LOGGING_SETUP": - case 16: - message.type = 16; - break; - case "INVALID_DB_PARAM": - case 17: - message.type = 17; - break; - case "UNSUPPORTED_GTID_MODE": - case 18: - message.type = 18; - break; - case "SQLSERVER_AGENT_NOT_RUNNING": - case 19: - message.type = 19; - break; - case "UNSUPPORTED_TABLE_DEFINITION": - case 20: - message.type = 20; - break; - case "UNSUPPORTED_DEFINER": - case 21: - message.type = 21; - break; - case "SQLSERVER_SERVERNAME_MISMATCH": - case 22: - message.type = 22; - break; - case "PRIMARY_ALREADY_SETUP": - case 23: - message.type = 23; - break; - case "UNSUPPORTED_BINLOG_FORMAT": - case 24: - message.type = 24; - break; - case "BINLOG_RETENTION_SETTING": - case 25: - message.type = 25; - break; - case "UNSUPPORTED_STORAGE_ENGINE": - case 26: - message.type = 26; - break; - case "LIMITED_SUPPORT_TABLES": - case 27: - message.type = 27; - break; - case "EXISTING_DATA_IN_REPLICA": - case 28: - message.type = 28; - break; - case "MISSING_OPTIONAL_PRIVILEGES": - case 29: - message.type = 29; - break; - case "RISKY_BACKUP_ADMIN_PRIVILEGE": - case 30: - message.type = 30; - break; - case "INSUFFICIENT_GCS_PERMISSIONS": - case 31: - message.type = 31; - break; - case "INVALID_FILE_INFO": - case 32: - message.type = 32; - break; - case "UNSUPPORTED_DATABASE_SETTINGS": - case 33: - message.type = 33; - break; - case "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE": - case 34: - message.type = 34; - break; - case "LOCAL_INFILE_OFF": - case 35: - message.type = 35; - break; - case "TURN_ON_PITR_AFTER_PROMOTE": - case 36: - message.type = 36; - break; - case "INCOMPATIBLE_DATABASE_MINOR_VERSION": - case 37: - message.type = 37; - break; - case "SOURCE_MAX_SUBSCRIPTIONS": - case 38: - message.type = 38; - break; - case "UNABLE_TO_VERIFY_DEFINERS": - case 39: - message.type = 39; - break; - case "SUBSCRIPTION_CALCULATION_STATUS": - case 40: - message.type = 40; - break; - case "PG_SUBSCRIPTION_COUNT": - case 41: - message.type = 41; - break; - case "PG_SYNC_PARALLEL_LEVEL": - case 42: - message.type = 42; - break; - case "INSUFFICIENT_DISK_SIZE": - case 43: - message.type = 43; - break; - case "INSUFFICIENT_MACHINE_TIER": - case 44: - message.type = 44; - break; - case "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED": - case 45: - message.type = 45; - break; - case "EXTENSIONS_NOT_MIGRATED": - case 46: - message.type = 46; - break; - case "PG_CRON_FLAG_ENABLED_IN_REPLICA": - case 47: - message.type = 47; - break; - case "EXTENSIONS_NOT_ENABLED_IN_REPLICA": - case 48: - message.type = 48; - break; - case "UNSUPPORTED_COLUMNS": - case 49: - message.type = 49; - break; - case "USERS_NOT_CREATED_IN_REPLICA": - case 50: - message.type = 50; - break; - case "UNSUPPORTED_SYSTEM_OBJECTS": - case 51: - message.type = 51; - break; - case "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY": - case 52: - message.type = 52; - break; - case "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE": - case 53: - message.type = 53; - break; - case "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI": - case 54: - message.type = 54; - break; - case "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS": - case 55: - message.type = 55; - break; - case "PROMPT_DELETE_EXISTING": - case 56: - message.type = 56; - break; - case "WILL_DELETE_EXISTING": - case 57: - message.type = 57; - break; - case "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE": - case 58: - message.type = 58; - break; - } - if (object.detail != null) - message.detail = String(object.detail); - return message; - }; - - /** - * Creates a plain object from a SqlExternalSyncSettingError message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @static - * @param {google.cloud.sql.v1.SqlExternalSyncSettingError} message SqlExternalSyncSettingError - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlExternalSyncSettingError.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.type = options.enums === String ? "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED" : 0; - object.detail = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType[message.type] : message.type; - if (message.detail != null && message.hasOwnProperty("detail")) - object.detail = message.detail; - return object; - }; - - /** - * Converts this SqlExternalSyncSettingError to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @instance - * @returns {Object.} JSON object - */ - SqlExternalSyncSettingError.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlExternalSyncSettingError - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlExternalSyncSettingError - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlExternalSyncSettingError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlExternalSyncSettingError"; - }; - - /** - * SqlExternalSyncSettingErrorType enum. - * @name google.cloud.sql.v1.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType - * @enum {number} - * @property {number} SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED=0 SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED value - * @property {number} CONNECTION_FAILURE=1 CONNECTION_FAILURE value - * @property {number} BINLOG_NOT_ENABLED=2 BINLOG_NOT_ENABLED value - * @property {number} INCOMPATIBLE_DATABASE_VERSION=3 INCOMPATIBLE_DATABASE_VERSION value - * @property {number} REPLICA_ALREADY_SETUP=4 REPLICA_ALREADY_SETUP value - * @property {number} INSUFFICIENT_PRIVILEGE=5 INSUFFICIENT_PRIVILEGE value - * @property {number} UNSUPPORTED_MIGRATION_TYPE=6 UNSUPPORTED_MIGRATION_TYPE value - * @property {number} NO_PGLOGICAL_INSTALLED=7 NO_PGLOGICAL_INSTALLED value - * @property {number} PGLOGICAL_NODE_ALREADY_EXISTS=8 PGLOGICAL_NODE_ALREADY_EXISTS value - * @property {number} INVALID_WAL_LEVEL=9 INVALID_WAL_LEVEL value - * @property {number} INVALID_SHARED_PRELOAD_LIBRARY=10 INVALID_SHARED_PRELOAD_LIBRARY value - * @property {number} INSUFFICIENT_MAX_REPLICATION_SLOTS=11 INSUFFICIENT_MAX_REPLICATION_SLOTS value - * @property {number} INSUFFICIENT_MAX_WAL_SENDERS=12 INSUFFICIENT_MAX_WAL_SENDERS value - * @property {number} INSUFFICIENT_MAX_WORKER_PROCESSES=13 INSUFFICIENT_MAX_WORKER_PROCESSES value - * @property {number} UNSUPPORTED_EXTENSIONS=14 UNSUPPORTED_EXTENSIONS value - * @property {number} INVALID_RDS_LOGICAL_REPLICATION=15 INVALID_RDS_LOGICAL_REPLICATION value - * @property {number} INVALID_LOGGING_SETUP=16 INVALID_LOGGING_SETUP value - * @property {number} INVALID_DB_PARAM=17 INVALID_DB_PARAM value - * @property {number} UNSUPPORTED_GTID_MODE=18 UNSUPPORTED_GTID_MODE value - * @property {number} SQLSERVER_AGENT_NOT_RUNNING=19 SQLSERVER_AGENT_NOT_RUNNING value - * @property {number} UNSUPPORTED_TABLE_DEFINITION=20 UNSUPPORTED_TABLE_DEFINITION value - * @property {number} UNSUPPORTED_DEFINER=21 UNSUPPORTED_DEFINER value - * @property {number} SQLSERVER_SERVERNAME_MISMATCH=22 SQLSERVER_SERVERNAME_MISMATCH value - * @property {number} PRIMARY_ALREADY_SETUP=23 PRIMARY_ALREADY_SETUP value - * @property {number} UNSUPPORTED_BINLOG_FORMAT=24 UNSUPPORTED_BINLOG_FORMAT value - * @property {number} BINLOG_RETENTION_SETTING=25 BINLOG_RETENTION_SETTING value - * @property {number} UNSUPPORTED_STORAGE_ENGINE=26 UNSUPPORTED_STORAGE_ENGINE value - * @property {number} LIMITED_SUPPORT_TABLES=27 LIMITED_SUPPORT_TABLES value - * @property {number} EXISTING_DATA_IN_REPLICA=28 EXISTING_DATA_IN_REPLICA value - * @property {number} MISSING_OPTIONAL_PRIVILEGES=29 MISSING_OPTIONAL_PRIVILEGES value - * @property {number} RISKY_BACKUP_ADMIN_PRIVILEGE=30 RISKY_BACKUP_ADMIN_PRIVILEGE value - * @property {number} INSUFFICIENT_GCS_PERMISSIONS=31 INSUFFICIENT_GCS_PERMISSIONS value - * @property {number} INVALID_FILE_INFO=32 INVALID_FILE_INFO value - * @property {number} UNSUPPORTED_DATABASE_SETTINGS=33 UNSUPPORTED_DATABASE_SETTINGS value - * @property {number} MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE=34 MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE value - * @property {number} LOCAL_INFILE_OFF=35 LOCAL_INFILE_OFF value - * @property {number} TURN_ON_PITR_AFTER_PROMOTE=36 TURN_ON_PITR_AFTER_PROMOTE value - * @property {number} INCOMPATIBLE_DATABASE_MINOR_VERSION=37 INCOMPATIBLE_DATABASE_MINOR_VERSION value - * @property {number} SOURCE_MAX_SUBSCRIPTIONS=38 SOURCE_MAX_SUBSCRIPTIONS value - * @property {number} UNABLE_TO_VERIFY_DEFINERS=39 UNABLE_TO_VERIFY_DEFINERS value - * @property {number} SUBSCRIPTION_CALCULATION_STATUS=40 SUBSCRIPTION_CALCULATION_STATUS value - * @property {number} PG_SUBSCRIPTION_COUNT=41 PG_SUBSCRIPTION_COUNT value - * @property {number} PG_SYNC_PARALLEL_LEVEL=42 PG_SYNC_PARALLEL_LEVEL value - * @property {number} INSUFFICIENT_DISK_SIZE=43 INSUFFICIENT_DISK_SIZE value - * @property {number} INSUFFICIENT_MACHINE_TIER=44 INSUFFICIENT_MACHINE_TIER value - * @property {number} UNSUPPORTED_EXTENSIONS_NOT_MIGRATED=45 UNSUPPORTED_EXTENSIONS_NOT_MIGRATED value - * @property {number} EXTENSIONS_NOT_MIGRATED=46 EXTENSIONS_NOT_MIGRATED value - * @property {number} PG_CRON_FLAG_ENABLED_IN_REPLICA=47 PG_CRON_FLAG_ENABLED_IN_REPLICA value - * @property {number} EXTENSIONS_NOT_ENABLED_IN_REPLICA=48 EXTENSIONS_NOT_ENABLED_IN_REPLICA value - * @property {number} UNSUPPORTED_COLUMNS=49 UNSUPPORTED_COLUMNS value - * @property {number} USERS_NOT_CREATED_IN_REPLICA=50 USERS_NOT_CREATED_IN_REPLICA value - * @property {number} UNSUPPORTED_SYSTEM_OBJECTS=51 UNSUPPORTED_SYSTEM_OBJECTS value - * @property {number} UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY=52 UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY value - * @property {number} SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE=53 SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE value - * @property {number} PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI=54 PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI value - * @property {number} SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS=55 SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS value - * @property {number} PROMPT_DELETE_EXISTING=56 PROMPT_DELETE_EXISTING value - * @property {number} WILL_DELETE_EXISTING=57 WILL_DELETE_EXISTING value - * @property {number} PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE=58 PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE value - */ - SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "CONNECTION_FAILURE"] = 1; - values[valuesById[2] = "BINLOG_NOT_ENABLED"] = 2; - values[valuesById[3] = "INCOMPATIBLE_DATABASE_VERSION"] = 3; - values[valuesById[4] = "REPLICA_ALREADY_SETUP"] = 4; - values[valuesById[5] = "INSUFFICIENT_PRIVILEGE"] = 5; - values[valuesById[6] = "UNSUPPORTED_MIGRATION_TYPE"] = 6; - values[valuesById[7] = "NO_PGLOGICAL_INSTALLED"] = 7; - values[valuesById[8] = "PGLOGICAL_NODE_ALREADY_EXISTS"] = 8; - values[valuesById[9] = "INVALID_WAL_LEVEL"] = 9; - values[valuesById[10] = "INVALID_SHARED_PRELOAD_LIBRARY"] = 10; - values[valuesById[11] = "INSUFFICIENT_MAX_REPLICATION_SLOTS"] = 11; - values[valuesById[12] = "INSUFFICIENT_MAX_WAL_SENDERS"] = 12; - values[valuesById[13] = "INSUFFICIENT_MAX_WORKER_PROCESSES"] = 13; - values[valuesById[14] = "UNSUPPORTED_EXTENSIONS"] = 14; - values[valuesById[15] = "INVALID_RDS_LOGICAL_REPLICATION"] = 15; - values[valuesById[16] = "INVALID_LOGGING_SETUP"] = 16; - values[valuesById[17] = "INVALID_DB_PARAM"] = 17; - values[valuesById[18] = "UNSUPPORTED_GTID_MODE"] = 18; - values[valuesById[19] = "SQLSERVER_AGENT_NOT_RUNNING"] = 19; - values[valuesById[20] = "UNSUPPORTED_TABLE_DEFINITION"] = 20; - values[valuesById[21] = "UNSUPPORTED_DEFINER"] = 21; - values[valuesById[22] = "SQLSERVER_SERVERNAME_MISMATCH"] = 22; - values[valuesById[23] = "PRIMARY_ALREADY_SETUP"] = 23; - values[valuesById[24] = "UNSUPPORTED_BINLOG_FORMAT"] = 24; - values[valuesById[25] = "BINLOG_RETENTION_SETTING"] = 25; - values[valuesById[26] = "UNSUPPORTED_STORAGE_ENGINE"] = 26; - values[valuesById[27] = "LIMITED_SUPPORT_TABLES"] = 27; - values[valuesById[28] = "EXISTING_DATA_IN_REPLICA"] = 28; - values[valuesById[29] = "MISSING_OPTIONAL_PRIVILEGES"] = 29; - values[valuesById[30] = "RISKY_BACKUP_ADMIN_PRIVILEGE"] = 30; - values[valuesById[31] = "INSUFFICIENT_GCS_PERMISSIONS"] = 31; - values[valuesById[32] = "INVALID_FILE_INFO"] = 32; - values[valuesById[33] = "UNSUPPORTED_DATABASE_SETTINGS"] = 33; - values[valuesById[34] = "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE"] = 34; - values[valuesById[35] = "LOCAL_INFILE_OFF"] = 35; - values[valuesById[36] = "TURN_ON_PITR_AFTER_PROMOTE"] = 36; - values[valuesById[37] = "INCOMPATIBLE_DATABASE_MINOR_VERSION"] = 37; - values[valuesById[38] = "SOURCE_MAX_SUBSCRIPTIONS"] = 38; - values[valuesById[39] = "UNABLE_TO_VERIFY_DEFINERS"] = 39; - values[valuesById[40] = "SUBSCRIPTION_CALCULATION_STATUS"] = 40; - values[valuesById[41] = "PG_SUBSCRIPTION_COUNT"] = 41; - values[valuesById[42] = "PG_SYNC_PARALLEL_LEVEL"] = 42; - values[valuesById[43] = "INSUFFICIENT_DISK_SIZE"] = 43; - values[valuesById[44] = "INSUFFICIENT_MACHINE_TIER"] = 44; - values[valuesById[45] = "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED"] = 45; - values[valuesById[46] = "EXTENSIONS_NOT_MIGRATED"] = 46; - values[valuesById[47] = "PG_CRON_FLAG_ENABLED_IN_REPLICA"] = 47; - values[valuesById[48] = "EXTENSIONS_NOT_ENABLED_IN_REPLICA"] = 48; - values[valuesById[49] = "UNSUPPORTED_COLUMNS"] = 49; - values[valuesById[50] = "USERS_NOT_CREATED_IN_REPLICA"] = 50; - values[valuesById[51] = "UNSUPPORTED_SYSTEM_OBJECTS"] = 51; - values[valuesById[52] = "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY"] = 52; - values[valuesById[53] = "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE"] = 53; - values[valuesById[54] = "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI"] = 54; - values[valuesById[55] = "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS"] = 55; - values[valuesById[56] = "PROMPT_DELETE_EXISTING"] = 56; - values[valuesById[57] = "WILL_DELETE_EXISTING"] = 57; - values[valuesById[58] = "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE"] = 58; - return values; - })(); - - return SqlExternalSyncSettingError; - })(); - - v1.SelectedObjects = (function() { - - /** - * Properties of a SelectedObjects. - * @memberof google.cloud.sql.v1 - * @interface ISelectedObjects - * @property {string|null} [database] SelectedObjects database - */ - - /** - * Constructs a new SelectedObjects. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SelectedObjects. - * @implements ISelectedObjects - * @constructor - * @param {google.cloud.sql.v1.ISelectedObjects=} [properties] Properties to set - */ - function SelectedObjects(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SelectedObjects database. - * @member {string} database - * @memberof google.cloud.sql.v1.SelectedObjects - * @instance - */ - SelectedObjects.prototype.database = ""; - - /** - * Creates a new SelectedObjects instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SelectedObjects - * @static - * @param {google.cloud.sql.v1.ISelectedObjects=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SelectedObjects} SelectedObjects instance - */ - SelectedObjects.create = function create(properties) { - return new SelectedObjects(properties); - }; - - /** - * Encodes the specified SelectedObjects message. Does not implicitly {@link google.cloud.sql.v1.SelectedObjects.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SelectedObjects - * @static - * @param {google.cloud.sql.v1.ISelectedObjects} message SelectedObjects message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SelectedObjects.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); - return writer; - }; - - /** - * Encodes the specified SelectedObjects message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SelectedObjects.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SelectedObjects - * @static - * @param {google.cloud.sql.v1.ISelectedObjects} message SelectedObjects message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SelectedObjects.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SelectedObjects message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SelectedObjects - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SelectedObjects} SelectedObjects - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SelectedObjects.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SelectedObjects(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.database = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SelectedObjects message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SelectedObjects - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SelectedObjects} SelectedObjects - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SelectedObjects.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SelectedObjects message. - * @function verify - * @memberof google.cloud.sql.v1.SelectedObjects - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SelectedObjects.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - return null; - }; - - /** - * Creates a SelectedObjects message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SelectedObjects - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SelectedObjects} SelectedObjects - */ - SelectedObjects.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SelectedObjects) - return object; - var message = new $root.google.cloud.sql.v1.SelectedObjects(); - if (object.database != null) - message.database = String(object.database); - return message; - }; - - /** - * Creates a plain object from a SelectedObjects message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SelectedObjects - * @static - * @param {google.cloud.sql.v1.SelectedObjects} message SelectedObjects - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SelectedObjects.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.database = ""; - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - return object; - }; - - /** - * Converts this SelectedObjects to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SelectedObjects - * @instance - * @returns {Object.} JSON object - */ - SelectedObjects.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SelectedObjects - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SelectedObjects - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SelectedObjects.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SelectedObjects"; - }; - - return SelectedObjects; - })(); - - v1.OnPremisesConfiguration = (function() { - - /** - * Properties of an OnPremisesConfiguration. - * @memberof google.cloud.sql.v1 - * @interface IOnPremisesConfiguration - * @property {string|null} [hostPort] OnPremisesConfiguration hostPort - * @property {string|null} [kind] OnPremisesConfiguration kind - * @property {string|null} [username] OnPremisesConfiguration username - * @property {string|null} [password] OnPremisesConfiguration password - * @property {string|null} [caCertificate] OnPremisesConfiguration caCertificate - * @property {string|null} [clientCertificate] OnPremisesConfiguration clientCertificate - * @property {string|null} [clientKey] OnPremisesConfiguration clientKey - * @property {string|null} [dumpFilePath] OnPremisesConfiguration dumpFilePath - * @property {google.cloud.sql.v1.IInstanceReference|null} [sourceInstance] OnPremisesConfiguration sourceInstance - * @property {Array.|null} [selectedObjects] OnPremisesConfiguration selectedObjects - * @property {google.cloud.sql.v1.OnPremisesConfiguration.SslOption|null} [sslOption] OnPremisesConfiguration sslOption - */ - - /** - * Constructs a new OnPremisesConfiguration. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an OnPremisesConfiguration. - * @implements IOnPremisesConfiguration - * @constructor - * @param {google.cloud.sql.v1.IOnPremisesConfiguration=} [properties] Properties to set - */ - function OnPremisesConfiguration(properties) { - this.selectedObjects = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OnPremisesConfiguration hostPort. - * @member {string} hostPort - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.hostPort = ""; - - /** - * OnPremisesConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.kind = ""; - - /** - * OnPremisesConfiguration username. - * @member {string} username - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.username = ""; - - /** - * OnPremisesConfiguration password. - * @member {string} password - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.password = ""; - - /** - * OnPremisesConfiguration caCertificate. - * @member {string} caCertificate - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.caCertificate = ""; - - /** - * OnPremisesConfiguration clientCertificate. - * @member {string} clientCertificate - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.clientCertificate = ""; - - /** - * OnPremisesConfiguration clientKey. - * @member {string} clientKey - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.clientKey = ""; - - /** - * OnPremisesConfiguration dumpFilePath. - * @member {string} dumpFilePath - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.dumpFilePath = ""; - - /** - * OnPremisesConfiguration sourceInstance. - * @member {google.cloud.sql.v1.IInstanceReference|null|undefined} sourceInstance - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.sourceInstance = null; - - /** - * OnPremisesConfiguration selectedObjects. - * @member {Array.} selectedObjects - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.selectedObjects = $util.emptyArray; - - /** - * OnPremisesConfiguration sslOption. - * @member {google.cloud.sql.v1.OnPremisesConfiguration.SslOption} sslOption - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.sslOption = 0; - - /** - * Creates a new OnPremisesConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @static - * @param {google.cloud.sql.v1.IOnPremisesConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1.OnPremisesConfiguration} OnPremisesConfiguration instance - */ - OnPremisesConfiguration.create = function create(properties) { - return new OnPremisesConfiguration(properties); - }; - - /** - * Encodes the specified OnPremisesConfiguration message. Does not implicitly {@link google.cloud.sql.v1.OnPremisesConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @static - * @param {google.cloud.sql.v1.IOnPremisesConfiguration} message OnPremisesConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OnPremisesConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hostPort != null && Object.hasOwnProperty.call(message, "hostPort")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.hostPort); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - if (message.username != null && Object.hasOwnProperty.call(message, "username")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.username); - if (message.password != null && Object.hasOwnProperty.call(message, "password")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.password); - if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.caCertificate); - if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.clientCertificate); - if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.clientKey); - if (message.dumpFilePath != null && Object.hasOwnProperty.call(message, "dumpFilePath")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.dumpFilePath); - if (message.sourceInstance != null && Object.hasOwnProperty.call(message, "sourceInstance")) - $root.google.cloud.sql.v1.InstanceReference.encode(message.sourceInstance, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); - if (message.selectedObjects != null && message.selectedObjects.length) - for (var i = 0; i < message.selectedObjects.length; ++i) - $root.google.cloud.sql.v1.SelectedObjects.encode(message.selectedObjects[i], writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - if (message.sslOption != null && Object.hasOwnProperty.call(message, "sslOption")) - writer.uint32(/* id 18, wireType 0 =*/144).int32(message.sslOption); - return writer; - }; - - /** - * Encodes the specified OnPremisesConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OnPremisesConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @static - * @param {google.cloud.sql.v1.IOnPremisesConfiguration} message OnPremisesConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OnPremisesConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OnPremisesConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.OnPremisesConfiguration} OnPremisesConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OnPremisesConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.OnPremisesConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.hostPort = reader.string(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - case 3: { - message.username = reader.string(); - break; - } - case 4: { - message.password = reader.string(); - break; - } - case 5: { - message.caCertificate = reader.string(); - break; - } - case 6: { - message.clientCertificate = reader.string(); - break; - } - case 7: { - message.clientKey = reader.string(); - break; - } - case 8: { - message.dumpFilePath = reader.string(); - break; - } - case 15: { - message.sourceInstance = $root.google.cloud.sql.v1.InstanceReference.decode(reader, reader.uint32()); - break; - } - case 16: { - if (!(message.selectedObjects && message.selectedObjects.length)) - message.selectedObjects = []; - message.selectedObjects.push($root.google.cloud.sql.v1.SelectedObjects.decode(reader, reader.uint32())); - break; - } - case 18: { - message.sslOption = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OnPremisesConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.OnPremisesConfiguration} OnPremisesConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OnPremisesConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OnPremisesConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OnPremisesConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hostPort != null && message.hasOwnProperty("hostPort")) - if (!$util.isString(message.hostPort)) - return "hostPort: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.username != null && message.hasOwnProperty("username")) - if (!$util.isString(message.username)) - return "username: string expected"; - if (message.password != null && message.hasOwnProperty("password")) - if (!$util.isString(message.password)) - return "password: string expected"; - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - if (!$util.isString(message.caCertificate)) - return "caCertificate: string expected"; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - if (!$util.isString(message.clientCertificate)) - return "clientCertificate: string expected"; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - if (!$util.isString(message.clientKey)) - return "clientKey: string expected"; - if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) - if (!$util.isString(message.dumpFilePath)) - return "dumpFilePath: string expected"; - if (message.sourceInstance != null && message.hasOwnProperty("sourceInstance")) { - var error = $root.google.cloud.sql.v1.InstanceReference.verify(message.sourceInstance); - if (error) - return "sourceInstance." + error; - } - if (message.selectedObjects != null && message.hasOwnProperty("selectedObjects")) { - if (!Array.isArray(message.selectedObjects)) - return "selectedObjects: array expected"; - for (var i = 0; i < message.selectedObjects.length; ++i) { - var error = $root.google.cloud.sql.v1.SelectedObjects.verify(message.selectedObjects[i]); - if (error) - return "selectedObjects." + error; - } - } - if (message.sslOption != null && message.hasOwnProperty("sslOption")) - switch (message.sslOption) { - default: - return "sslOption: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - return null; - }; - - /** - * Creates an OnPremisesConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.OnPremisesConfiguration} OnPremisesConfiguration - */ - OnPremisesConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.OnPremisesConfiguration) - return object; - var message = new $root.google.cloud.sql.v1.OnPremisesConfiguration(); - if (object.hostPort != null) - message.hostPort = String(object.hostPort); - if (object.kind != null) - message.kind = String(object.kind); - if (object.username != null) - message.username = String(object.username); - if (object.password != null) - message.password = String(object.password); - if (object.caCertificate != null) - message.caCertificate = String(object.caCertificate); - if (object.clientCertificate != null) - message.clientCertificate = String(object.clientCertificate); - if (object.clientKey != null) - message.clientKey = String(object.clientKey); - if (object.dumpFilePath != null) - message.dumpFilePath = String(object.dumpFilePath); - if (object.sourceInstance != null) { - if (typeof object.sourceInstance !== "object") - throw TypeError(".google.cloud.sql.v1.OnPremisesConfiguration.sourceInstance: object expected"); - message.sourceInstance = $root.google.cloud.sql.v1.InstanceReference.fromObject(object.sourceInstance); - } - if (object.selectedObjects) { - if (!Array.isArray(object.selectedObjects)) - throw TypeError(".google.cloud.sql.v1.OnPremisesConfiguration.selectedObjects: array expected"); - message.selectedObjects = []; - for (var i = 0; i < object.selectedObjects.length; ++i) { - if (typeof object.selectedObjects[i] !== "object") - throw TypeError(".google.cloud.sql.v1.OnPremisesConfiguration.selectedObjects: object expected"); - message.selectedObjects[i] = $root.google.cloud.sql.v1.SelectedObjects.fromObject(object.selectedObjects[i]); - } - } - switch (object.sslOption) { - default: - if (typeof object.sslOption === "number") { - message.sslOption = object.sslOption; - break; - } - break; - case "SSL_OPTION_UNSPECIFIED": - case 0: - message.sslOption = 0; - break; - case "DISABLE": - case 1: - message.sslOption = 1; - break; - case "REQUIRE": - case 2: - message.sslOption = 2; - break; - case "VERIFY_CA": - case 3: - message.sslOption = 3; - break; - } - return message; - }; - - /** - * Creates a plain object from an OnPremisesConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @static - * @param {google.cloud.sql.v1.OnPremisesConfiguration} message OnPremisesConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OnPremisesConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.selectedObjects = []; - if (options.defaults) { - object.hostPort = ""; - object.kind = ""; - object.username = ""; - object.password = ""; - object.caCertificate = ""; - object.clientCertificate = ""; - object.clientKey = ""; - object.dumpFilePath = ""; - object.sourceInstance = null; - object.sslOption = options.enums === String ? "SSL_OPTION_UNSPECIFIED" : 0; - } - if (message.hostPort != null && message.hasOwnProperty("hostPort")) - object.hostPort = message.hostPort; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.username != null && message.hasOwnProperty("username")) - object.username = message.username; - if (message.password != null && message.hasOwnProperty("password")) - object.password = message.password; - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - object.caCertificate = message.caCertificate; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - object.clientCertificate = message.clientCertificate; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - object.clientKey = message.clientKey; - if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) - object.dumpFilePath = message.dumpFilePath; - if (message.sourceInstance != null && message.hasOwnProperty("sourceInstance")) - object.sourceInstance = $root.google.cloud.sql.v1.InstanceReference.toObject(message.sourceInstance, options); - if (message.selectedObjects && message.selectedObjects.length) { - object.selectedObjects = []; - for (var j = 0; j < message.selectedObjects.length; ++j) - object.selectedObjects[j] = $root.google.cloud.sql.v1.SelectedObjects.toObject(message.selectedObjects[j], options); - } - if (message.sslOption != null && message.hasOwnProperty("sslOption")) - object.sslOption = options.enums === String ? $root.google.cloud.sql.v1.OnPremisesConfiguration.SslOption[message.sslOption] === undefined ? message.sslOption : $root.google.cloud.sql.v1.OnPremisesConfiguration.SslOption[message.sslOption] : message.sslOption; - return object; - }; - - /** - * Converts this OnPremisesConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @instance - * @returns {Object.} JSON object - */ - OnPremisesConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OnPremisesConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1.OnPremisesConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OnPremisesConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.OnPremisesConfiguration"; - }; - - /** - * SslOption enum. - * @name google.cloud.sql.v1.OnPremisesConfiguration.SslOption - * @enum {number} - * @property {number} SSL_OPTION_UNSPECIFIED=0 SSL_OPTION_UNSPECIFIED value - * @property {number} DISABLE=1 DISABLE value - * @property {number} REQUIRE=2 REQUIRE value - * @property {number} VERIFY_CA=3 VERIFY_CA value - */ - OnPremisesConfiguration.SslOption = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SSL_OPTION_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLE"] = 1; - values[valuesById[2] = "REQUIRE"] = 2; - values[valuesById[3] = "VERIFY_CA"] = 3; - return values; - })(); - - return OnPremisesConfiguration; - })(); - - v1.ReplicaConfiguration = (function() { - - /** - * Properties of a ReplicaConfiguration. - * @memberof google.cloud.sql.v1 - * @interface IReplicaConfiguration - * @property {string|null} [kind] ReplicaConfiguration kind - * @property {google.cloud.sql.v1.IMySqlReplicaConfiguration|null} [mysqlReplicaConfiguration] ReplicaConfiguration mysqlReplicaConfiguration - * @property {google.protobuf.IBoolValue|null} [failoverTarget] ReplicaConfiguration failoverTarget - * @property {google.protobuf.IBoolValue|null} [cascadableReplica] ReplicaConfiguration cascadableReplica - */ - - /** - * Constructs a new ReplicaConfiguration. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a ReplicaConfiguration. - * @implements IReplicaConfiguration - * @constructor - * @param {google.cloud.sql.v1.IReplicaConfiguration=} [properties] Properties to set - */ - function ReplicaConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReplicaConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @instance - */ - ReplicaConfiguration.prototype.kind = ""; - - /** - * ReplicaConfiguration mysqlReplicaConfiguration. - * @member {google.cloud.sql.v1.IMySqlReplicaConfiguration|null|undefined} mysqlReplicaConfiguration - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @instance - */ - ReplicaConfiguration.prototype.mysqlReplicaConfiguration = null; - - /** - * ReplicaConfiguration failoverTarget. - * @member {google.protobuf.IBoolValue|null|undefined} failoverTarget - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @instance - */ - ReplicaConfiguration.prototype.failoverTarget = null; - - /** - * ReplicaConfiguration cascadableReplica. - * @member {google.protobuf.IBoolValue|null|undefined} cascadableReplica - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @instance - */ - ReplicaConfiguration.prototype.cascadableReplica = null; - - /** - * Creates a new ReplicaConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.IReplicaConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ReplicaConfiguration} ReplicaConfiguration instance - */ - ReplicaConfiguration.create = function create(properties) { - return new ReplicaConfiguration(properties); - }; - - /** - * Encodes the specified ReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1.ReplicaConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.IReplicaConfiguration} message ReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReplicaConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.mysqlReplicaConfiguration != null && Object.hasOwnProperty.call(message, "mysqlReplicaConfiguration")) - $root.google.cloud.sql.v1.MySqlReplicaConfiguration.encode(message.mysqlReplicaConfiguration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.failoverTarget != null && Object.hasOwnProperty.call(message, "failoverTarget")) - $root.google.protobuf.BoolValue.encode(message.failoverTarget, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.cascadableReplica != null && Object.hasOwnProperty.call(message, "cascadableReplica")) - $root.google.protobuf.BoolValue.encode(message.cascadableReplica, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ReplicaConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.IReplicaConfiguration} message ReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReplicaConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ReplicaConfiguration} ReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplicaConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ReplicaConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.MySqlReplicaConfiguration.decode(reader, reader.uint32()); - break; - } - case 3: { - message.failoverTarget = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 5: { - message.cascadableReplica = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReplicaConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ReplicaConfiguration} ReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReplicaConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReplicaConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) { - var error = $root.google.cloud.sql.v1.MySqlReplicaConfiguration.verify(message.mysqlReplicaConfiguration); - if (error) - return "mysqlReplicaConfiguration." + error; - } - if (message.failoverTarget != null && message.hasOwnProperty("failoverTarget")) { - var error = $root.google.protobuf.BoolValue.verify(message.failoverTarget); - if (error) - return "failoverTarget." + error; - } - if (message.cascadableReplica != null && message.hasOwnProperty("cascadableReplica")) { - var error = $root.google.protobuf.BoolValue.verify(message.cascadableReplica); - if (error) - return "cascadableReplica." + error; - } - return null; - }; - - /** - * Creates a ReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ReplicaConfiguration} ReplicaConfiguration - */ - ReplicaConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ReplicaConfiguration) - return object; - var message = new $root.google.cloud.sql.v1.ReplicaConfiguration(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.mysqlReplicaConfiguration != null) { - if (typeof object.mysqlReplicaConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1.ReplicaConfiguration.mysqlReplicaConfiguration: object expected"); - message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.MySqlReplicaConfiguration.fromObject(object.mysqlReplicaConfiguration); - } - if (object.failoverTarget != null) { - if (typeof object.failoverTarget !== "object") - throw TypeError(".google.cloud.sql.v1.ReplicaConfiguration.failoverTarget: object expected"); - message.failoverTarget = $root.google.protobuf.BoolValue.fromObject(object.failoverTarget); - } - if (object.cascadableReplica != null) { - if (typeof object.cascadableReplica !== "object") - throw TypeError(".google.cloud.sql.v1.ReplicaConfiguration.cascadableReplica: object expected"); - message.cascadableReplica = $root.google.protobuf.BoolValue.fromObject(object.cascadableReplica); - } - return message; - }; - - /** - * Creates a plain object from a ReplicaConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @static - * @param {google.cloud.sql.v1.ReplicaConfiguration} message ReplicaConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReplicaConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.mysqlReplicaConfiguration = null; - object.failoverTarget = null; - object.cascadableReplica = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) - object.mysqlReplicaConfiguration = $root.google.cloud.sql.v1.MySqlReplicaConfiguration.toObject(message.mysqlReplicaConfiguration, options); - if (message.failoverTarget != null && message.hasOwnProperty("failoverTarget")) - object.failoverTarget = $root.google.protobuf.BoolValue.toObject(message.failoverTarget, options); - if (message.cascadableReplica != null && message.hasOwnProperty("cascadableReplica")) - object.cascadableReplica = $root.google.protobuf.BoolValue.toObject(message.cascadableReplica, options); - return object; - }; - - /** - * Converts this ReplicaConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @instance - * @returns {Object.} JSON object - */ - ReplicaConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReplicaConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ReplicaConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ReplicaConfiguration"; - }; - - return ReplicaConfiguration; - })(); - - v1.SqlInstancesExecuteSqlRequest = (function() { - - /** - * Properties of a SqlInstancesExecuteSqlRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesExecuteSqlRequest - * @property {string|null} [instance] SqlInstancesExecuteSqlRequest instance - * @property {string|null} [project] SqlInstancesExecuteSqlRequest project - * @property {google.cloud.sql.v1.IExecuteSqlPayload|null} [body] SqlInstancesExecuteSqlRequest body - */ - - /** - * Constructs a new SqlInstancesExecuteSqlRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesExecuteSqlRequest. - * @implements ISqlInstancesExecuteSqlRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest=} [properties] Properties to set - */ - function SqlInstancesExecuteSqlRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesExecuteSqlRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @instance - */ - SqlInstancesExecuteSqlRequest.prototype.instance = ""; - - /** - * SqlInstancesExecuteSqlRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @instance - */ - SqlInstancesExecuteSqlRequest.prototype.project = ""; - - /** - * SqlInstancesExecuteSqlRequest body. - * @member {google.cloud.sql.v1.IExecuteSqlPayload|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @instance - */ - SqlInstancesExecuteSqlRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesExecuteSqlRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest instance - */ - SqlInstancesExecuteSqlRequest.create = function create(properties) { - return new SqlInstancesExecuteSqlRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesExecuteSqlRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExecuteSqlRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.ExecuteSqlPayload.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesExecuteSqlRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExecuteSqlRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExecuteSqlRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.ExecuteSqlPayload.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExecuteSqlRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesExecuteSqlRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesExecuteSqlRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.ExecuteSqlPayload.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesExecuteSqlRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest - */ - SqlInstancesExecuteSqlRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.ExecuteSqlPayload.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesExecuteSqlRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesExecuteSqlRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.ExecuteSqlPayload.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesExecuteSqlRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesExecuteSqlRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesExecuteSqlRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesExecuteSqlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesExecuteSqlRequest"; - }; - - return SqlInstancesExecuteSqlRequest; - })(); - - v1.ExecuteSqlPayload = (function() { - - /** - * Properties of an ExecuteSqlPayload. - * @memberof google.cloud.sql.v1 - * @interface IExecuteSqlPayload - * @property {string|null} [user] ExecuteSqlPayload user - * @property {string|null} [sqlStatement] ExecuteSqlPayload sqlStatement - * @property {string|null} [database] ExecuteSqlPayload database - * @property {boolean|null} [autoIamAuthn] ExecuteSqlPayload autoIamAuthn - * @property {number|Long|null} [rowLimit] ExecuteSqlPayload rowLimit - * @property {google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode|null} [partialResultMode] ExecuteSqlPayload partialResultMode - * @property {string|null} [application] ExecuteSqlPayload application - */ - - /** - * Constructs a new ExecuteSqlPayload. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an ExecuteSqlPayload. - * @implements IExecuteSqlPayload - * @constructor - * @param {google.cloud.sql.v1.IExecuteSqlPayload=} [properties] Properties to set - */ - function ExecuteSqlPayload(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExecuteSqlPayload user. - * @member {string} user - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.user = ""; - - /** - * ExecuteSqlPayload sqlStatement. - * @member {string} sqlStatement - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.sqlStatement = ""; - - /** - * ExecuteSqlPayload database. - * @member {string} database - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.database = ""; - - /** - * ExecuteSqlPayload autoIamAuthn. - * @member {boolean|null|undefined} autoIamAuthn - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.autoIamAuthn = null; - - /** - * ExecuteSqlPayload rowLimit. - * @member {number|Long} rowLimit - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.rowLimit = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ExecuteSqlPayload partialResultMode. - * @member {google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode} partialResultMode - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.partialResultMode = 0; - - /** - * ExecuteSqlPayload application. - * @member {string} application - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.application = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ExecuteSqlPayload userPassword. - * @member {"autoIamAuthn"|undefined} userPassword - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @instance - */ - Object.defineProperty(ExecuteSqlPayload.prototype, "userPassword", { - get: $util.oneOfGetter($oneOfFields = ["autoIamAuthn"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ExecuteSqlPayload instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @static - * @param {google.cloud.sql.v1.IExecuteSqlPayload=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ExecuteSqlPayload} ExecuteSqlPayload instance - */ - ExecuteSqlPayload.create = function create(properties) { - return new ExecuteSqlPayload(properties); - }; - - /** - * Encodes the specified ExecuteSqlPayload message. Does not implicitly {@link google.cloud.sql.v1.ExecuteSqlPayload.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @static - * @param {google.cloud.sql.v1.IExecuteSqlPayload} message ExecuteSqlPayload message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExecuteSqlPayload.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.user != null && Object.hasOwnProperty.call(message, "user")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.user); - if (message.sqlStatement != null && Object.hasOwnProperty.call(message, "sqlStatement")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.sqlStatement); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.database); - if (message.rowLimit != null && Object.hasOwnProperty.call(message, "rowLimit")) - writer.uint32(/* id 10, wireType 0 =*/80).int64(message.rowLimit); - if (message.autoIamAuthn != null && Object.hasOwnProperty.call(message, "autoIamAuthn")) - writer.uint32(/* id 11, wireType 0 =*/88).bool(message.autoIamAuthn); - if (message.partialResultMode != null && Object.hasOwnProperty.call(message, "partialResultMode")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.partialResultMode); - if (message.application != null && Object.hasOwnProperty.call(message, "application")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.application); - return writer; - }; - - /** - * Encodes the specified ExecuteSqlPayload message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ExecuteSqlPayload.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @static - * @param {google.cloud.sql.v1.IExecuteSqlPayload} message ExecuteSqlPayload message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExecuteSqlPayload.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExecuteSqlPayload message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ExecuteSqlPayload} ExecuteSqlPayload - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExecuteSqlPayload.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ExecuteSqlPayload(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.user = reader.string(); - break; - } - case 2: { - message.sqlStatement = reader.string(); - break; - } - case 3: { - message.database = reader.string(); - break; - } - case 11: { - message.autoIamAuthn = reader.bool(); - break; - } - case 10: { - message.rowLimit = reader.int64(); - break; - } - case 13: { - message.partialResultMode = reader.int32(); - break; - } - case 16: { - message.application = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExecuteSqlPayload message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ExecuteSqlPayload} ExecuteSqlPayload - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExecuteSqlPayload.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExecuteSqlPayload message. - * @function verify - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExecuteSqlPayload.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.user != null && message.hasOwnProperty("user")) - if (!$util.isString(message.user)) - return "user: string expected"; - if (message.sqlStatement != null && message.hasOwnProperty("sqlStatement")) - if (!$util.isString(message.sqlStatement)) - return "sqlStatement: string expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - if (message.autoIamAuthn != null && message.hasOwnProperty("autoIamAuthn")) { - properties.userPassword = 1; - if (typeof message.autoIamAuthn !== "boolean") - return "autoIamAuthn: boolean expected"; - } - if (message.rowLimit != null && message.hasOwnProperty("rowLimit")) - if (!$util.isInteger(message.rowLimit) && !(message.rowLimit && $util.isInteger(message.rowLimit.low) && $util.isInteger(message.rowLimit.high))) - return "rowLimit: integer|Long expected"; - if (message.partialResultMode != null && message.hasOwnProperty("partialResultMode")) - switch (message.partialResultMode) { - default: - return "partialResultMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.application != null && message.hasOwnProperty("application")) - if (!$util.isString(message.application)) - return "application: string expected"; - return null; - }; - - /** - * Creates an ExecuteSqlPayload message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ExecuteSqlPayload} ExecuteSqlPayload - */ - ExecuteSqlPayload.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ExecuteSqlPayload) - return object; - var message = new $root.google.cloud.sql.v1.ExecuteSqlPayload(); - if (object.user != null) - message.user = String(object.user); - if (object.sqlStatement != null) - message.sqlStatement = String(object.sqlStatement); - if (object.database != null) - message.database = String(object.database); - if (object.autoIamAuthn != null) - message.autoIamAuthn = Boolean(object.autoIamAuthn); - if (object.rowLimit != null) - if ($util.Long) - (message.rowLimit = $util.Long.fromValue(object.rowLimit)).unsigned = false; - else if (typeof object.rowLimit === "string") - message.rowLimit = parseInt(object.rowLimit, 10); - else if (typeof object.rowLimit === "number") - message.rowLimit = object.rowLimit; - else if (typeof object.rowLimit === "object") - message.rowLimit = new $util.LongBits(object.rowLimit.low >>> 0, object.rowLimit.high >>> 0).toNumber(); - switch (object.partialResultMode) { - default: - if (typeof object.partialResultMode === "number") { - message.partialResultMode = object.partialResultMode; - break; - } - break; - case "PARTIAL_RESULT_MODE_UNSPECIFIED": - case 0: - message.partialResultMode = 0; - break; - case "FAIL_PARTIAL_RESULT": - case 1: - message.partialResultMode = 1; - break; - case "ALLOW_PARTIAL_RESULT": - case 2: - message.partialResultMode = 2; - break; - } - if (object.application != null) - message.application = String(object.application); - return message; - }; - - /** - * Creates a plain object from an ExecuteSqlPayload message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @static - * @param {google.cloud.sql.v1.ExecuteSqlPayload} message ExecuteSqlPayload - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExecuteSqlPayload.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.user = ""; - object.sqlStatement = ""; - object.database = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.rowLimit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.rowLimit = options.longs === String ? "0" : 0; - object.partialResultMode = options.enums === String ? "PARTIAL_RESULT_MODE_UNSPECIFIED" : 0; - object.application = ""; - } - if (message.user != null && message.hasOwnProperty("user")) - object.user = message.user; - if (message.sqlStatement != null && message.hasOwnProperty("sqlStatement")) - object.sqlStatement = message.sqlStatement; - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - if (message.rowLimit != null && message.hasOwnProperty("rowLimit")) - if (typeof message.rowLimit === "number") - object.rowLimit = options.longs === String ? String(message.rowLimit) : message.rowLimit; - else - object.rowLimit = options.longs === String ? $util.Long.prototype.toString.call(message.rowLimit) : options.longs === Number ? new $util.LongBits(message.rowLimit.low >>> 0, message.rowLimit.high >>> 0).toNumber() : message.rowLimit; - if (message.autoIamAuthn != null && message.hasOwnProperty("autoIamAuthn")) { - object.autoIamAuthn = message.autoIamAuthn; - if (options.oneofs) - object.userPassword = "autoIamAuthn"; - } - if (message.partialResultMode != null && message.hasOwnProperty("partialResultMode")) - object.partialResultMode = options.enums === String ? $root.google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode[message.partialResultMode] === undefined ? message.partialResultMode : $root.google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode[message.partialResultMode] : message.partialResultMode; - if (message.application != null && message.hasOwnProperty("application")) - object.application = message.application; - return object; - }; - - /** - * Converts this ExecuteSqlPayload to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @instance - * @returns {Object.} JSON object - */ - ExecuteSqlPayload.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExecuteSqlPayload - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ExecuteSqlPayload - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExecuteSqlPayload.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ExecuteSqlPayload"; - }; - - /** - * PartialResultMode enum. - * @name google.cloud.sql.v1.ExecuteSqlPayload.PartialResultMode - * @enum {number} - * @property {number} PARTIAL_RESULT_MODE_UNSPECIFIED=0 PARTIAL_RESULT_MODE_UNSPECIFIED value - * @property {number} FAIL_PARTIAL_RESULT=1 FAIL_PARTIAL_RESULT value - * @property {number} ALLOW_PARTIAL_RESULT=2 ALLOW_PARTIAL_RESULT value - */ - ExecuteSqlPayload.PartialResultMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "PARTIAL_RESULT_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FAIL_PARTIAL_RESULT"] = 1; - values[valuesById[2] = "ALLOW_PARTIAL_RESULT"] = 2; - return values; - })(); - - return ExecuteSqlPayload; - })(); - - v1.SqlInstancesExecuteSqlResponse = (function() { - - /** - * Properties of a SqlInstancesExecuteSqlResponse. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesExecuteSqlResponse - * @property {Array.|null} [messages] SqlInstancesExecuteSqlResponse messages - * @property {google.cloud.sql.v1.IMetadata|null} [metadata] SqlInstancesExecuteSqlResponse metadata - * @property {Array.|null} [results] SqlInstancesExecuteSqlResponse results - * @property {google.rpc.IStatus|null} [status] SqlInstancesExecuteSqlResponse status - */ - - /** - * Constructs a new SqlInstancesExecuteSqlResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesExecuteSqlResponse. - * @implements ISqlInstancesExecuteSqlResponse - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse=} [properties] Properties to set - */ - function SqlInstancesExecuteSqlResponse(properties) { - this.messages = []; - this.results = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesExecuteSqlResponse messages. - * @member {Array.} messages - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @instance - */ - SqlInstancesExecuteSqlResponse.prototype.messages = $util.emptyArray; - - /** - * SqlInstancesExecuteSqlResponse metadata. - * @member {google.cloud.sql.v1.IMetadata|null|undefined} metadata - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @instance - */ - SqlInstancesExecuteSqlResponse.prototype.metadata = null; - - /** - * SqlInstancesExecuteSqlResponse results. - * @member {Array.} results - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @instance - */ - SqlInstancesExecuteSqlResponse.prototype.results = $util.emptyArray; - - /** - * SqlInstancesExecuteSqlResponse status. - * @member {google.rpc.IStatus|null|undefined} status - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @instance - */ - SqlInstancesExecuteSqlResponse.prototype.status = null; - - /** - * Creates a new SqlInstancesExecuteSqlResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse instance - */ - SqlInstancesExecuteSqlResponse.create = function create(properties) { - return new SqlInstancesExecuteSqlResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesExecuteSqlResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExecuteSqlResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.google.cloud.sql.v1.Metadata.encode(message.metadata, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.sql.v1.QueryResult.encode(message.results[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.messages != null && message.messages.length) - for (var i = 0; i < message.messages.length; ++i) - $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.encode(message.messages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesExecuteSqlResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExecuteSqlResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExecuteSqlResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 9: { - if (!(message.messages && message.messages.length)) - message.messages = []; - message.messages.push($root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.decode(reader, reader.uint32())); - break; - } - case 6: { - message.metadata = $root.google.cloud.sql.v1.Metadata.decode(reader, reader.uint32()); - break; - } - case 7: { - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.sql.v1.QueryResult.decode(reader, reader.uint32())); - break; - } - case 8: { - message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExecuteSqlResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesExecuteSqlResponse message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesExecuteSqlResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.messages != null && message.hasOwnProperty("messages")) { - if (!Array.isArray(message.messages)) - return "messages: array expected"; - for (var i = 0; i < message.messages.length; ++i) { - var error = $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.verify(message.messages[i]); - if (error) - return "messages." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.google.cloud.sql.v1.Metadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.sql.v1.QueryResult.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.status != null && message.hasOwnProperty("status")) { - var error = $root.google.rpc.Status.verify(message.status); - if (error) - return "status." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesExecuteSqlResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse - */ - SqlInstancesExecuteSqlResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse(); - if (object.messages) { - if (!Array.isArray(object.messages)) - throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.messages: array expected"); - message.messages = []; - for (var i = 0; i < object.messages.length; ++i) { - if (typeof object.messages[i] !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.messages: object expected"); - message.messages[i] = $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.fromObject(object.messages[i]); - } - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.metadata: object expected"); - message.metadata = $root.google.cloud.sql.v1.Metadata.fromObject(object.metadata); - } - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.results: object expected"); - message.results[i] = $root.google.cloud.sql.v1.QueryResult.fromObject(object.results[i]); - } - } - if (object.status != null) { - if (typeof object.status !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.status: object expected"); - message.status = $root.google.rpc.Status.fromObject(object.status); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesExecuteSqlResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @static - * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesExecuteSqlResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.messages = []; - } - if (options.defaults) { - object.metadata = null; - object.status = null; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.google.cloud.sql.v1.Metadata.toObject(message.metadata, options); - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.sql.v1.QueryResult.toObject(message.results[j], options); - } - if (message.status != null && message.hasOwnProperty("status")) - object.status = $root.google.rpc.Status.toObject(message.status, options); - if (message.messages && message.messages.length) { - object.messages = []; - for (var j = 0; j < message.messages.length; ++j) - object.messages[j] = $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.toObject(message.messages[j], options); - } - return object; - }; - - /** - * Converts this SqlInstancesExecuteSqlResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesExecuteSqlResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesExecuteSqlResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesExecuteSqlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesExecuteSqlResponse"; - }; - - SqlInstancesExecuteSqlResponse.Message = (function() { - - /** - * Properties of a Message. - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @interface IMessage - * @property {string|null} [message] Message message - * @property {string|null} [severity] Message severity - */ - - /** - * Constructs a new Message. - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse - * @classdesc Represents a Message. - * @implements IMessage - * @constructor - * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage=} [properties] Properties to set - */ - function Message(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Message message. - * @member {string|null|undefined} message - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @instance - */ - Message.prototype.message = null; - - /** - * Message severity. - * @member {string|null|undefined} severity - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @instance - */ - Message.prototype.severity = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Message.prototype, "_message", { - get: $util.oneOfGetter($oneOfFields = ["message"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Message.prototype, "_severity", { - get: $util.oneOfGetter($oneOfFields = ["severity"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Message instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message} Message instance - */ - Message.create = function create(properties) { - return new Message(properties); - }; - - /** - * Encodes the specified Message message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage} message Message message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Message.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); - if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.severity); - return writer; - }; - - /** - * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.IMessage} message Message message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Message.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Message message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message} Message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Message.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.message = reader.string(); - break; - } - case 2: { - message.severity = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Message message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message} Message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Message.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Message message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Message.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.message != null && message.hasOwnProperty("message")) { - properties._message = 1; - if (!$util.isString(message.message)) - return "message: string expected"; - } - if (message.severity != null && message.hasOwnProperty("severity")) { - properties._severity = 1; - if (!$util.isString(message.severity)) - return "severity: string expected"; - } - return null; - }; - - /** - * Creates a Message message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message} Message - */ - Message.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message(); - if (object.message != null) - message.message = String(object.message); - if (object.severity != null) - message.severity = String(object.severity); - return message; - }; - - /** - * Creates a plain object from a Message message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message} message Message - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Message.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.message != null && message.hasOwnProperty("message")) { - object.message = message.message; - if (options.oneofs) - object._message = "message"; - } - if (message.severity != null && message.hasOwnProperty("severity")) { - object.severity = message.severity; - if (options.oneofs) - object._severity = "severity"; - } - return object; - }; - - /** - * Converts this Message to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @instance - * @returns {Object.} JSON object - */ - Message.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Message - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Message.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesExecuteSqlResponse.Message"; - }; - - return Message; - })(); - - return SqlInstancesExecuteSqlResponse; - })(); - - v1.QueryResult = (function() { - - /** - * Properties of a QueryResult. - * @memberof google.cloud.sql.v1 - * @interface IQueryResult - * @property {Array.|null} [columns] QueryResult columns - * @property {Array.|null} [rows] QueryResult rows - * @property {string|null} [message] QueryResult message - * @property {boolean|null} [partialResult] QueryResult partialResult - * @property {google.rpc.IStatus|null} [status] QueryResult status - */ - - /** - * Constructs a new QueryResult. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a QueryResult. - * @implements IQueryResult - * @constructor - * @param {google.cloud.sql.v1.IQueryResult=} [properties] Properties to set - */ - function QueryResult(properties) { - this.columns = []; - this.rows = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryResult columns. - * @member {Array.} columns - * @memberof google.cloud.sql.v1.QueryResult - * @instance - */ - QueryResult.prototype.columns = $util.emptyArray; - - /** - * QueryResult rows. - * @member {Array.} rows - * @memberof google.cloud.sql.v1.QueryResult - * @instance - */ - QueryResult.prototype.rows = $util.emptyArray; - - /** - * QueryResult message. - * @member {string} message - * @memberof google.cloud.sql.v1.QueryResult - * @instance - */ - QueryResult.prototype.message = ""; - - /** - * QueryResult partialResult. - * @member {boolean} partialResult - * @memberof google.cloud.sql.v1.QueryResult - * @instance - */ - QueryResult.prototype.partialResult = false; - - /** - * QueryResult status. - * @member {google.rpc.IStatus|null|undefined} status - * @memberof google.cloud.sql.v1.QueryResult - * @instance - */ - QueryResult.prototype.status = null; - - /** - * Creates a new QueryResult instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.QueryResult - * @static - * @param {google.cloud.sql.v1.IQueryResult=} [properties] Properties to set - * @returns {google.cloud.sql.v1.QueryResult} QueryResult instance - */ - QueryResult.create = function create(properties) { - return new QueryResult(properties); - }; - - /** - * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.sql.v1.QueryResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.QueryResult - * @static - * @param {google.cloud.sql.v1.IQueryResult} message QueryResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.columns != null && message.columns.length) - for (var i = 0; i < message.columns.length; ++i) - $root.google.cloud.sql.v1.Column.encode(message.columns[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.rows != null && message.rows.length) - for (var i = 0; i < message.rows.length; ++i) - $root.google.cloud.sql.v1.Row.encode(message.rows[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); - if (message.partialResult != null && Object.hasOwnProperty.call(message, "partialResult")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.partialResult); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.sql.v1.QueryResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.QueryResult - * @static - * @param {google.cloud.sql.v1.IQueryResult} message QueryResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.QueryResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.QueryResult} QueryResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryResult.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.QueryResult(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.columns && message.columns.length)) - message.columns = []; - message.columns.push($root.google.cloud.sql.v1.Column.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.rows && message.rows.length)) - message.rows = []; - message.rows.push($root.google.cloud.sql.v1.Row.decode(reader, reader.uint32())); - break; - } - case 3: { - message.message = reader.string(); - break; - } - case 4: { - message.partialResult = reader.bool(); - break; - } - case 8: { - message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.QueryResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.QueryResult} QueryResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryResult message. - * @function verify - * @memberof google.cloud.sql.v1.QueryResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.columns != null && message.hasOwnProperty("columns")) { - if (!Array.isArray(message.columns)) - return "columns: array expected"; - for (var i = 0; i < message.columns.length; ++i) { - var error = $root.google.cloud.sql.v1.Column.verify(message.columns[i]); - if (error) - return "columns." + error; - } - } - if (message.rows != null && message.hasOwnProperty("rows")) { - if (!Array.isArray(message.rows)) - return "rows: array expected"; - for (var i = 0; i < message.rows.length; ++i) { - var error = $root.google.cloud.sql.v1.Row.verify(message.rows[i]); - if (error) - return "rows." + error; - } - } - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (message.partialResult != null && message.hasOwnProperty("partialResult")) - if (typeof message.partialResult !== "boolean") - return "partialResult: boolean expected"; - if (message.status != null && message.hasOwnProperty("status")) { - var error = $root.google.rpc.Status.verify(message.status); - if (error) - return "status." + error; - } - return null; - }; - - /** - * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.QueryResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.QueryResult} QueryResult - */ - QueryResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.QueryResult) - return object; - var message = new $root.google.cloud.sql.v1.QueryResult(); - if (object.columns) { - if (!Array.isArray(object.columns)) - throw TypeError(".google.cloud.sql.v1.QueryResult.columns: array expected"); - message.columns = []; - for (var i = 0; i < object.columns.length; ++i) { - if (typeof object.columns[i] !== "object") - throw TypeError(".google.cloud.sql.v1.QueryResult.columns: object expected"); - message.columns[i] = $root.google.cloud.sql.v1.Column.fromObject(object.columns[i]); - } - } - if (object.rows) { - if (!Array.isArray(object.rows)) - throw TypeError(".google.cloud.sql.v1.QueryResult.rows: array expected"); - message.rows = []; - for (var i = 0; i < object.rows.length; ++i) { - if (typeof object.rows[i] !== "object") - throw TypeError(".google.cloud.sql.v1.QueryResult.rows: object expected"); - message.rows[i] = $root.google.cloud.sql.v1.Row.fromObject(object.rows[i]); - } - } - if (object.message != null) - message.message = String(object.message); - if (object.partialResult != null) - message.partialResult = Boolean(object.partialResult); - if (object.status != null) { - if (typeof object.status !== "object") - throw TypeError(".google.cloud.sql.v1.QueryResult.status: object expected"); - message.status = $root.google.rpc.Status.fromObject(object.status); - } - return message; - }; - - /** - * Creates a plain object from a QueryResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.QueryResult - * @static - * @param {google.cloud.sql.v1.QueryResult} message QueryResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.columns = []; - object.rows = []; - } - if (options.defaults) { - object.message = ""; - object.partialResult = false; - object.status = null; - } - if (message.columns && message.columns.length) { - object.columns = []; - for (var j = 0; j < message.columns.length; ++j) - object.columns[j] = $root.google.cloud.sql.v1.Column.toObject(message.columns[j], options); - } - if (message.rows && message.rows.length) { - object.rows = []; - for (var j = 0; j < message.rows.length; ++j) - object.rows[j] = $root.google.cloud.sql.v1.Row.toObject(message.rows[j], options); - } - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.partialResult != null && message.hasOwnProperty("partialResult")) - object.partialResult = message.partialResult; - if (message.status != null && message.hasOwnProperty("status")) - object.status = $root.google.rpc.Status.toObject(message.status, options); - return object; - }; - - /** - * Converts this QueryResult to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.QueryResult - * @instance - * @returns {Object.} JSON object - */ - QueryResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for QueryResult - * @function getTypeUrl - * @memberof google.cloud.sql.v1.QueryResult - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - QueryResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.QueryResult"; - }; - - return QueryResult; - })(); - - v1.Column = (function() { - - /** - * Properties of a Column. - * @memberof google.cloud.sql.v1 - * @interface IColumn - * @property {string|null} [name] Column name - * @property {string|null} [type] Column type - */ - - /** - * Constructs a new Column. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a Column. - * @implements IColumn - * @constructor - * @param {google.cloud.sql.v1.IColumn=} [properties] Properties to set - */ - function Column(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Column name. - * @member {string} name - * @memberof google.cloud.sql.v1.Column - * @instance - */ - Column.prototype.name = ""; - - /** - * Column type. - * @member {string} type - * @memberof google.cloud.sql.v1.Column - * @instance - */ - Column.prototype.type = ""; - - /** - * Creates a new Column instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.Column - * @static - * @param {google.cloud.sql.v1.IColumn=} [properties] Properties to set - * @returns {google.cloud.sql.v1.Column} Column instance - */ - Column.create = function create(properties) { - return new Column(properties); - }; - - /** - * Encodes the specified Column message. Does not implicitly {@link google.cloud.sql.v1.Column.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.Column - * @static - * @param {google.cloud.sql.v1.IColumn} message Column message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Column.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - return writer; - }; - - /** - * Encodes the specified Column message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Column.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.Column - * @static - * @param {google.cloud.sql.v1.IColumn} message Column message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Column.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Column message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.Column - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.Column} Column - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Column.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Column(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.type = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Column message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.Column - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.Column} Column - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Column.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Column message. - * @function verify - * @memberof google.cloud.sql.v1.Column - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Column.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - return null; - }; - - /** - * Creates a Column message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.Column - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.Column} Column - */ - Column.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.Column) - return object; - var message = new $root.google.cloud.sql.v1.Column(); - if (object.name != null) - message.name = String(object.name); - if (object.type != null) - message.type = String(object.type); - return message; - }; - - /** - * Creates a plain object from a Column message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.Column - * @static - * @param {google.cloud.sql.v1.Column} message Column - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Column.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.type = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - return object; - }; - - /** - * Converts this Column to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.Column - * @instance - * @returns {Object.} JSON object - */ - Column.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Column - * @function getTypeUrl - * @memberof google.cloud.sql.v1.Column - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Column.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.Column"; - }; - - return Column; - })(); - - v1.Row = (function() { - - /** - * Properties of a Row. - * @memberof google.cloud.sql.v1 - * @interface IRow - * @property {Array.|null} [values] Row values - */ - - /** - * Constructs a new Row. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a Row. - * @implements IRow - * @constructor - * @param {google.cloud.sql.v1.IRow=} [properties] Properties to set - */ - function Row(properties) { - this.values = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Row values. - * @member {Array.} values - * @memberof google.cloud.sql.v1.Row - * @instance - */ - Row.prototype.values = $util.emptyArray; - - /** - * Creates a new Row instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.Row - * @static - * @param {google.cloud.sql.v1.IRow=} [properties] Properties to set - * @returns {google.cloud.sql.v1.Row} Row instance - */ - Row.create = function create(properties) { - return new Row(properties); - }; - - /** - * Encodes the specified Row message. Does not implicitly {@link google.cloud.sql.v1.Row.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.Row - * @static - * @param {google.cloud.sql.v1.IRow} message Row message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Row.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.values != null && message.values.length) - for (var i = 0; i < message.values.length; ++i) - $root.google.cloud.sql.v1.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Row message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Row.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.Row - * @static - * @param {google.cloud.sql.v1.IRow} message Row message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Row.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Row message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.Row - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.Row} Row - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Row.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Row(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.cloud.sql.v1.Value.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Row message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.Row - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.Row} Row - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Row.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Row message. - * @function verify - * @memberof google.cloud.sql.v1.Row - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Row.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.values != null && message.hasOwnProperty("values")) { - if (!Array.isArray(message.values)) - return "values: array expected"; - for (var i = 0; i < message.values.length; ++i) { - var error = $root.google.cloud.sql.v1.Value.verify(message.values[i]); - if (error) - return "values." + error; - } - } - return null; - }; - - /** - * Creates a Row message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.Row - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.Row} Row - */ - Row.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.Row) - return object; - var message = new $root.google.cloud.sql.v1.Row(); - if (object.values) { - if (!Array.isArray(object.values)) - throw TypeError(".google.cloud.sql.v1.Row.values: array expected"); - message.values = []; - for (var i = 0; i < object.values.length; ++i) { - if (typeof object.values[i] !== "object") - throw TypeError(".google.cloud.sql.v1.Row.values: object expected"); - message.values[i] = $root.google.cloud.sql.v1.Value.fromObject(object.values[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Row message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.Row - * @static - * @param {google.cloud.sql.v1.Row} message Row - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Row.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (message.values && message.values.length) { - object.values = []; - for (var j = 0; j < message.values.length; ++j) - object.values[j] = $root.google.cloud.sql.v1.Value.toObject(message.values[j], options); - } - return object; - }; - - /** - * Converts this Row to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.Row - * @instance - * @returns {Object.} JSON object - */ - Row.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Row - * @function getTypeUrl - * @memberof google.cloud.sql.v1.Row - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Row.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.Row"; - }; - - return Row; - })(); - - v1.Value = (function() { - - /** - * Properties of a Value. - * @memberof google.cloud.sql.v1 - * @interface IValue - * @property {string|null} [value] Value value - * @property {boolean|null} [nullValue] Value nullValue - */ - - /** - * Constructs a new Value. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a Value. - * @implements IValue - * @constructor - * @param {google.cloud.sql.v1.IValue=} [properties] Properties to set - */ - function Value(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Value value. - * @member {string} value - * @memberof google.cloud.sql.v1.Value - * @instance - */ - Value.prototype.value = ""; - - /** - * Value nullValue. - * @member {boolean} nullValue - * @memberof google.cloud.sql.v1.Value - * @instance - */ - Value.prototype.nullValue = false; - - /** - * Creates a new Value instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.Value - * @static - * @param {google.cloud.sql.v1.IValue=} [properties] Properties to set - * @returns {google.cloud.sql.v1.Value} Value instance - */ - Value.create = function create(properties) { - return new Value(properties); - }; - - /** - * Encodes the specified Value message. Does not implicitly {@link google.cloud.sql.v1.Value.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.Value - * @static - * @param {google.cloud.sql.v1.IValue} message Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Value.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.nullValue); - return writer; - }; - - /** - * Encodes the specified Value message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Value.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.Value - * @static - * @param {google.cloud.sql.v1.IValue} message Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Value message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.Value} Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Value.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Value(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.string(); - break; - } - case 2: { - message.nullValue = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Value message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.Value} Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Value.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Value message. - * @function verify - * @memberof google.cloud.sql.v1.Value - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Value.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.nullValue != null && message.hasOwnProperty("nullValue")) - if (typeof message.nullValue !== "boolean") - return "nullValue: boolean expected"; - return null; - }; - - /** - * Creates a Value message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.Value - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.Value} Value - */ - Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.Value) - return object; - var message = new $root.google.cloud.sql.v1.Value(); - if (object.value != null) - message.value = String(object.value); - if (object.nullValue != null) - message.nullValue = Boolean(object.nullValue); - return message; - }; - - /** - * Creates a plain object from a Value message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.Value - * @static - * @param {google.cloud.sql.v1.Value} message Value - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Value.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.value = ""; - object.nullValue = false; - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.nullValue != null && message.hasOwnProperty("nullValue")) - object.nullValue = message.nullValue; - return object; - }; - - /** - * Converts this Value to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.Value - * @instance - * @returns {Object.} JSON object - */ - Value.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Value - * @function getTypeUrl - * @memberof google.cloud.sql.v1.Value - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.Value"; - }; - - return Value; - })(); - - v1.Metadata = (function() { - - /** - * Properties of a Metadata. - * @memberof google.cloud.sql.v1 - * @interface IMetadata - * @property {google.protobuf.IDuration|null} [sqlStatementExecutionTime] Metadata sqlStatementExecutionTime - */ - - /** - * Constructs a new Metadata. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a Metadata. - * @implements IMetadata - * @constructor - * @param {google.cloud.sql.v1.IMetadata=} [properties] Properties to set - */ - function Metadata(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Metadata sqlStatementExecutionTime. - * @member {google.protobuf.IDuration|null|undefined} sqlStatementExecutionTime - * @memberof google.cloud.sql.v1.Metadata - * @instance - */ - Metadata.prototype.sqlStatementExecutionTime = null; - - /** - * Creates a new Metadata instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.Metadata - * @static - * @param {google.cloud.sql.v1.IMetadata=} [properties] Properties to set - * @returns {google.cloud.sql.v1.Metadata} Metadata instance - */ - Metadata.create = function create(properties) { - return new Metadata(properties); - }; - - /** - * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.sql.v1.Metadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.Metadata - * @static - * @param {google.cloud.sql.v1.IMetadata} message Metadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Metadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sqlStatementExecutionTime != null && Object.hasOwnProperty.call(message, "sqlStatementExecutionTime")) - $root.google.protobuf.Duration.encode(message.sqlStatementExecutionTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Metadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.Metadata - * @static - * @param {google.cloud.sql.v1.IMetadata} message Metadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Metadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Metadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.Metadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.Metadata} Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Metadata.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Metadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.sqlStatementExecutionTime = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Metadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.Metadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.Metadata} Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Metadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Metadata message. - * @function verify - * @memberof google.cloud.sql.v1.Metadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Metadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.sqlStatementExecutionTime != null && message.hasOwnProperty("sqlStatementExecutionTime")) { - var error = $root.google.protobuf.Duration.verify(message.sqlStatementExecutionTime); - if (error) - return "sqlStatementExecutionTime." + error; - } - return null; - }; - - /** - * Creates a Metadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.Metadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.Metadata} Metadata - */ - Metadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.Metadata) - return object; - var message = new $root.google.cloud.sql.v1.Metadata(); - if (object.sqlStatementExecutionTime != null) { - if (typeof object.sqlStatementExecutionTime !== "object") - throw TypeError(".google.cloud.sql.v1.Metadata.sqlStatementExecutionTime: object expected"); - message.sqlStatementExecutionTime = $root.google.protobuf.Duration.fromObject(object.sqlStatementExecutionTime); - } - return message; - }; - - /** - * Creates a plain object from a Metadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.Metadata - * @static - * @param {google.cloud.sql.v1.Metadata} message Metadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Metadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.sqlStatementExecutionTime = null; - if (message.sqlStatementExecutionTime != null && message.hasOwnProperty("sqlStatementExecutionTime")) - object.sqlStatementExecutionTime = $root.google.protobuf.Duration.toObject(message.sqlStatementExecutionTime, options); - return object; - }; - - /** - * Converts this Metadata to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.Metadata - * @instance - * @returns {Object.} JSON object - */ - Metadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Metadata - * @function getTypeUrl - * @memberof google.cloud.sql.v1.Metadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Metadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.Metadata"; - }; - - return Metadata; - })(); - - v1.SqlInstancesAcquireSsrsLeaseRequest = (function() { - - /** - * Properties of a SqlInstancesAcquireSsrsLeaseRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesAcquireSsrsLeaseRequest - * @property {string|null} [instance] SqlInstancesAcquireSsrsLeaseRequest instance - * @property {string|null} [project] SqlInstancesAcquireSsrsLeaseRequest project - * @property {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest|null} [body] SqlInstancesAcquireSsrsLeaseRequest body - */ - - /** - * Constructs a new SqlInstancesAcquireSsrsLeaseRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesAcquireSsrsLeaseRequest. - * @implements ISqlInstancesAcquireSsrsLeaseRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set - */ - function SqlInstancesAcquireSsrsLeaseRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesAcquireSsrsLeaseRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @instance - */ - SqlInstancesAcquireSsrsLeaseRequest.prototype.instance = ""; - - /** - * SqlInstancesAcquireSsrsLeaseRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @instance - */ - SqlInstancesAcquireSsrsLeaseRequest.prototype.project = ""; - - /** - * SqlInstancesAcquireSsrsLeaseRequest body. - * @member {google.cloud.sql.v1.IInstancesAcquireSsrsLeaseRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @instance - */ - SqlInstancesAcquireSsrsLeaseRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesAcquireSsrsLeaseRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest instance - */ - SqlInstancesAcquireSsrsLeaseRequest.create = function create(properties) { - return new SqlInstancesAcquireSsrsLeaseRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAcquireSsrsLeaseRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAcquireSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAcquireSsrsLeaseRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAcquireSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesAcquireSsrsLeaseRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesAcquireSsrsLeaseRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest - */ - SqlInstancesAcquireSsrsLeaseRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesAcquireSsrsLeaseRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesAcquireSsrsLeaseRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesAcquireSsrsLeaseRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesAcquireSsrsLeaseRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesAcquireSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest"; - }; - - return SqlInstancesAcquireSsrsLeaseRequest; - })(); - - v1.SqlInstancesAcquireSsrsLeaseResponse = (function() { - - /** - * Properties of a SqlInstancesAcquireSsrsLeaseResponse. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesAcquireSsrsLeaseResponse - * @property {string|null} [operationId] SqlInstancesAcquireSsrsLeaseResponse operationId - */ - - /** - * Constructs a new SqlInstancesAcquireSsrsLeaseResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesAcquireSsrsLeaseResponse. - * @implements ISqlInstancesAcquireSsrsLeaseResponse - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse=} [properties] Properties to set - */ - function SqlInstancesAcquireSsrsLeaseResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesAcquireSsrsLeaseResponse operationId. - * @member {string} operationId - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @instance - */ - SqlInstancesAcquireSsrsLeaseResponse.prototype.operationId = ""; - - /** - * Creates a new SqlInstancesAcquireSsrsLeaseResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse instance - */ - SqlInstancesAcquireSsrsLeaseResponse.create = function create(properties) { - return new SqlInstancesAcquireSsrsLeaseResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAcquireSsrsLeaseResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.operationId != null && Object.hasOwnProperty.call(message, "operationId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.operationId); - return writer; - }; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAcquireSsrsLeaseResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAcquireSsrsLeaseResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.operationId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAcquireSsrsLeaseResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesAcquireSsrsLeaseResponse message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesAcquireSsrsLeaseResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.operationId != null && message.hasOwnProperty("operationId")) - if (!$util.isString(message.operationId)) - return "operationId: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesAcquireSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse - */ - SqlInstancesAcquireSsrsLeaseResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse(); - if (object.operationId != null) - message.operationId = String(object.operationId); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesAcquireSsrsLeaseResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesAcquireSsrsLeaseResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.operationId = ""; - if (message.operationId != null && message.hasOwnProperty("operationId")) - object.operationId = message.operationId; - return object; - }; - - /** - * Converts this SqlInstancesAcquireSsrsLeaseResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesAcquireSsrsLeaseResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesAcquireSsrsLeaseResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesAcquireSsrsLeaseResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse"; - }; - - return SqlInstancesAcquireSsrsLeaseResponse; - })(); - - v1.SqlInstancesReleaseSsrsLeaseRequest = (function() { - - /** - * Properties of a SqlInstancesReleaseSsrsLeaseRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesReleaseSsrsLeaseRequest - * @property {string|null} [instance] SqlInstancesReleaseSsrsLeaseRequest instance - * @property {string|null} [project] SqlInstancesReleaseSsrsLeaseRequest project - */ - - /** - * Constructs a new SqlInstancesReleaseSsrsLeaseRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesReleaseSsrsLeaseRequest. - * @implements ISqlInstancesReleaseSsrsLeaseRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest=} [properties] Properties to set - */ - function SqlInstancesReleaseSsrsLeaseRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesReleaseSsrsLeaseRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @instance - */ - SqlInstancesReleaseSsrsLeaseRequest.prototype.instance = ""; - - /** - * SqlInstancesReleaseSsrsLeaseRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @instance - */ - SqlInstancesReleaseSsrsLeaseRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesReleaseSsrsLeaseRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest instance - */ - SqlInstancesReleaseSsrsLeaseRequest.create = function create(properties) { - return new SqlInstancesReleaseSsrsLeaseRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReleaseSsrsLeaseRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReleaseSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReleaseSsrsLeaseRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReleaseSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesReleaseSsrsLeaseRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesReleaseSsrsLeaseRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesReleaseSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest - */ - SqlInstancesReleaseSsrsLeaseRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesReleaseSsrsLeaseRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesReleaseSsrsLeaseRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesReleaseSsrsLeaseRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesReleaseSsrsLeaseRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesReleaseSsrsLeaseRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesReleaseSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest"; - }; - - return SqlInstancesReleaseSsrsLeaseRequest; - })(); - - v1.SqlInstancesReleaseSsrsLeaseResponse = (function() { - - /** - * Properties of a SqlInstancesReleaseSsrsLeaseResponse. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesReleaseSsrsLeaseResponse - * @property {string|null} [operationId] SqlInstancesReleaseSsrsLeaseResponse operationId - */ - - /** - * Constructs a new SqlInstancesReleaseSsrsLeaseResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesReleaseSsrsLeaseResponse. - * @implements ISqlInstancesReleaseSsrsLeaseResponse - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse=} [properties] Properties to set - */ - function SqlInstancesReleaseSsrsLeaseResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesReleaseSsrsLeaseResponse operationId. - * @member {string} operationId - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @instance - */ - SqlInstancesReleaseSsrsLeaseResponse.prototype.operationId = ""; - - /** - * Creates a new SqlInstancesReleaseSsrsLeaseResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse instance - */ - SqlInstancesReleaseSsrsLeaseResponse.create = function create(properties) { - return new SqlInstancesReleaseSsrsLeaseResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReleaseSsrsLeaseResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.operationId != null && Object.hasOwnProperty.call(message, "operationId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.operationId); - return writer; - }; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReleaseSsrsLeaseResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReleaseSsrsLeaseResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.operationId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReleaseSsrsLeaseResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesReleaseSsrsLeaseResponse message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesReleaseSsrsLeaseResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.operationId != null && message.hasOwnProperty("operationId")) - if (!$util.isString(message.operationId)) - return "operationId: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesReleaseSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse - */ - SqlInstancesReleaseSsrsLeaseResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse(); - if (object.operationId != null) - message.operationId = String(object.operationId); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesReleaseSsrsLeaseResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesReleaseSsrsLeaseResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.operationId = ""; - if (message.operationId != null && message.hasOwnProperty("operationId")) - object.operationId = message.operationId; - return object; - }; - - /** - * Converts this SqlInstancesReleaseSsrsLeaseResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesReleaseSsrsLeaseResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesReleaseSsrsLeaseResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesReleaseSsrsLeaseResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse"; - }; - - return SqlInstancesReleaseSsrsLeaseResponse; - })(); - - v1.SqlInstancesPointInTimeRestoreRequest = (function() { - - /** - * Properties of a SqlInstancesPointInTimeRestoreRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlInstancesPointInTimeRestoreRequest - * @property {string|null} [parent] SqlInstancesPointInTimeRestoreRequest parent - * @property {google.cloud.sql.v1.IPointInTimeRestoreContext|null} [context] SqlInstancesPointInTimeRestoreRequest context - */ - - /** - * Constructs a new SqlInstancesPointInTimeRestoreRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstancesPointInTimeRestoreRequest. - * @implements ISqlInstancesPointInTimeRestoreRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest=} [properties] Properties to set - */ - function SqlInstancesPointInTimeRestoreRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesPointInTimeRestoreRequest parent. - * @member {string} parent - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @instance - */ - SqlInstancesPointInTimeRestoreRequest.prototype.parent = ""; - - /** - * SqlInstancesPointInTimeRestoreRequest context. - * @member {google.cloud.sql.v1.IPointInTimeRestoreContext|null|undefined} context - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @instance - */ - SqlInstancesPointInTimeRestoreRequest.prototype.context = null; - - /** - * Creates a new SqlInstancesPointInTimeRestoreRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest instance - */ - SqlInstancesPointInTimeRestoreRequest.create = function create(properties) { - return new SqlInstancesPointInTimeRestoreRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesPointInTimeRestoreRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPointInTimeRestoreRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.context != null && Object.hasOwnProperty.call(message, "context")) - $root.google.cloud.sql.v1.PointInTimeRestoreContext.encode(message.context, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesPointInTimeRestoreRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPointInTimeRestoreRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPointInTimeRestoreRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 100: { - message.context = $root.google.cloud.sql.v1.PointInTimeRestoreContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPointInTimeRestoreRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesPointInTimeRestoreRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesPointInTimeRestoreRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.context != null && message.hasOwnProperty("context")) { - var error = $root.google.cloud.sql.v1.PointInTimeRestoreContext.verify(message.context); - if (error) - return "context." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesPointInTimeRestoreRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest - */ - SqlInstancesPointInTimeRestoreRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.context != null) { - if (typeof object.context !== "object") - throw TypeError(".google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest.context: object expected"); - message.context = $root.google.cloud.sql.v1.PointInTimeRestoreContext.fromObject(object.context); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesPointInTimeRestoreRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesPointInTimeRestoreRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.context = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.context != null && message.hasOwnProperty("context")) - object.context = $root.google.cloud.sql.v1.PointInTimeRestoreContext.toObject(message.context, options); - return object; - }; - - /** - * Converts this SqlInstancesPointInTimeRestoreRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesPointInTimeRestoreRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesPointInTimeRestoreRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesPointInTimeRestoreRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest"; - }; - - return SqlInstancesPointInTimeRestoreRequest; - })(); - - /** - * SqlInstanceType enum. - * @name google.cloud.sql.v1.SqlInstanceType - * @enum {number} - * @property {number} SQL_INSTANCE_TYPE_UNSPECIFIED=0 SQL_INSTANCE_TYPE_UNSPECIFIED value - * @property {number} CLOUD_SQL_INSTANCE=1 CLOUD_SQL_INSTANCE value - * @property {number} ON_PREMISES_INSTANCE=2 ON_PREMISES_INSTANCE value - * @property {number} READ_REPLICA_INSTANCE=3 READ_REPLICA_INSTANCE value - * @property {number} READ_POOL_INSTANCE=5 READ_POOL_INSTANCE value - */ - v1.SqlInstanceType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_INSTANCE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "CLOUD_SQL_INSTANCE"] = 1; - values[valuesById[2] = "ON_PREMISES_INSTANCE"] = 2; - values[valuesById[3] = "READ_REPLICA_INSTANCE"] = 3; - values[valuesById[5] = "READ_POOL_INSTANCE"] = 5; - return values; - })(); - - /** - * SqlSuspensionReason enum. - * @name google.cloud.sql.v1.SqlSuspensionReason - * @enum {number} - * @property {number} SQL_SUSPENSION_REASON_UNSPECIFIED=0 SQL_SUSPENSION_REASON_UNSPECIFIED value - * @property {number} BILLING_ISSUE=2 BILLING_ISSUE value - * @property {number} LEGAL_ISSUE=3 LEGAL_ISSUE value - * @property {number} OPERATIONAL_ISSUE=4 OPERATIONAL_ISSUE value - * @property {number} KMS_KEY_ISSUE=5 KMS_KEY_ISSUE value - * @property {number} PROJECT_ABUSE=8 PROJECT_ABUSE value - */ - v1.SqlSuspensionReason = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_SUSPENSION_REASON_UNSPECIFIED"] = 0; - values[valuesById[2] = "BILLING_ISSUE"] = 2; - values[valuesById[3] = "LEGAL_ISSUE"] = 3; - values[valuesById[4] = "OPERATIONAL_ISSUE"] = 4; - values[valuesById[5] = "KMS_KEY_ISSUE"] = 5; - values[valuesById[8] = "PROJECT_ABUSE"] = 8; - return values; - })(); - - v1.SqlConnectService = (function() { - - /** - * Constructs a new SqlConnectService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlConnectService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlConnectService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlConnectService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlConnectService; - - /** - * Creates new SqlConnectService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlConnectService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlConnectService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlConnectService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlConnectService|getConnectSettings}. - * @memberof google.cloud.sql.v1.SqlConnectService - * @typedef GetConnectSettingsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.ConnectSettings} [response] ConnectSettings - */ - - /** - * Calls GetConnectSettings. - * @function getConnectSettings - * @memberof google.cloud.sql.v1.SqlConnectService - * @instance - * @param {google.cloud.sql.v1.IGetConnectSettingsRequest} request GetConnectSettingsRequest message or plain object - * @param {google.cloud.sql.v1.SqlConnectService.GetConnectSettingsCallback} callback Node-style callback called with the error, if any, and ConnectSettings - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlConnectService.prototype.getConnectSettings = function getConnectSettings(request, callback) { - return this.rpcCall(getConnectSettings, $root.google.cloud.sql.v1.GetConnectSettingsRequest, $root.google.cloud.sql.v1.ConnectSettings, request, callback); - }, "name", { value: "GetConnectSettings" }); - - /** - * Calls GetConnectSettings. - * @function getConnectSettings - * @memberof google.cloud.sql.v1.SqlConnectService - * @instance - * @param {google.cloud.sql.v1.IGetConnectSettingsRequest} request GetConnectSettingsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlConnectService|generateEphemeralCert}. - * @memberof google.cloud.sql.v1.SqlConnectService - * @typedef GenerateEphemeralCertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.GenerateEphemeralCertResponse} [response] GenerateEphemeralCertResponse - */ - - /** - * Calls GenerateEphemeralCert. - * @function generateEphemeralCert - * @memberof google.cloud.sql.v1.SqlConnectService - * @instance - * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest} request GenerateEphemeralCertRequest message or plain object - * @param {google.cloud.sql.v1.SqlConnectService.GenerateEphemeralCertCallback} callback Node-style callback called with the error, if any, and GenerateEphemeralCertResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlConnectService.prototype.generateEphemeralCert = function generateEphemeralCert(request, callback) { - return this.rpcCall(generateEphemeralCert, $root.google.cloud.sql.v1.GenerateEphemeralCertRequest, $root.google.cloud.sql.v1.GenerateEphemeralCertResponse, request, callback); - }, "name", { value: "GenerateEphemeralCert" }); - - /** - * Calls GenerateEphemeralCert. - * @function generateEphemeralCert - * @memberof google.cloud.sql.v1.SqlConnectService - * @instance - * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest} request GenerateEphemeralCertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlConnectService; - })(); - - v1.GetConnectSettingsRequest = (function() { - - /** - * Properties of a GetConnectSettingsRequest. - * @memberof google.cloud.sql.v1 - * @interface IGetConnectSettingsRequest - * @property {string|null} [instance] GetConnectSettingsRequest instance - * @property {string|null} [project] GetConnectSettingsRequest project - * @property {google.protobuf.ITimestamp|null} [readTime] GetConnectSettingsRequest readTime - */ - - /** - * Constructs a new GetConnectSettingsRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a GetConnectSettingsRequest. - * @implements IGetConnectSettingsRequest - * @constructor - * @param {google.cloud.sql.v1.IGetConnectSettingsRequest=} [properties] Properties to set - */ - function GetConnectSettingsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetConnectSettingsRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @instance - */ - GetConnectSettingsRequest.prototype.instance = ""; - - /** - * GetConnectSettingsRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @instance - */ - GetConnectSettingsRequest.prototype.project = ""; - - /** - * GetConnectSettingsRequest readTime. - * @member {google.protobuf.ITimestamp|null|undefined} readTime - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @instance - */ - GetConnectSettingsRequest.prototype.readTime = null; - - /** - * Creates a new GetConnectSettingsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @static - * @param {google.cloud.sql.v1.IGetConnectSettingsRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.GetConnectSettingsRequest} GetConnectSettingsRequest instance - */ - GetConnectSettingsRequest.create = function create(properties) { - return new GetConnectSettingsRequest(properties); - }; - - /** - * Encodes the specified GetConnectSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1.GetConnectSettingsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @static - * @param {google.cloud.sql.v1.IGetConnectSettingsRequest} message GetConnectSettingsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConnectSettingsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) - $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetConnectSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GetConnectSettingsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @static - * @param {google.cloud.sql.v1.IGetConnectSettingsRequest} message GetConnectSettingsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConnectSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetConnectSettingsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.GetConnectSettingsRequest} GetConnectSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConnectSettingsRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.GetConnectSettingsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 7: { - message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetConnectSettingsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.GetConnectSettingsRequest} GetConnectSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConnectSettingsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetConnectSettingsRequest message. - * @function verify - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetConnectSettingsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.readTime != null && message.hasOwnProperty("readTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.readTime); - if (error) - return "readTime." + error; - } - return null; - }; - - /** - * Creates a GetConnectSettingsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.GetConnectSettingsRequest} GetConnectSettingsRequest - */ - GetConnectSettingsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.GetConnectSettingsRequest) - return object; - var message = new $root.google.cloud.sql.v1.GetConnectSettingsRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.readTime != null) { - if (typeof object.readTime !== "object") - throw TypeError(".google.cloud.sql.v1.GetConnectSettingsRequest.readTime: object expected"); - message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime); - } - return message; - }; - - /** - * Creates a plain object from a GetConnectSettingsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @static - * @param {google.cloud.sql.v1.GetConnectSettingsRequest} message GetConnectSettingsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetConnectSettingsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.readTime = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.readTime != null && message.hasOwnProperty("readTime")) - object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options); - return object; - }; - - /** - * Converts this GetConnectSettingsRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @instance - * @returns {Object.} JSON object - */ - GetConnectSettingsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetConnectSettingsRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.GetConnectSettingsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetConnectSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.GetConnectSettingsRequest"; - }; - - return GetConnectSettingsRequest; - })(); - - v1.ConnectSettings = (function() { - - /** - * Properties of a ConnectSettings. - * @memberof google.cloud.sql.v1 - * @interface IConnectSettings - * @property {string|null} [kind] ConnectSettings kind - * @property {google.cloud.sql.v1.ISslCert|null} [serverCaCert] ConnectSettings serverCaCert - * @property {Array.|null} [ipAddresses] ConnectSettings ipAddresses - * @property {string|null} [region] ConnectSettings region - * @property {google.cloud.sql.v1.SqlDatabaseVersion|null} [databaseVersion] ConnectSettings databaseVersion - * @property {google.cloud.sql.v1.SqlBackendType|null} [backendType] ConnectSettings backendType - * @property {boolean|null} [pscEnabled] ConnectSettings pscEnabled - * @property {string|null} [dnsName] ConnectSettings dnsName - * @property {google.cloud.sql.v1.ConnectSettings.CaMode|null} [serverCaMode] ConnectSettings serverCaMode - * @property {Array.|null} [customSubjectAlternativeNames] ConnectSettings customSubjectAlternativeNames - * @property {Array.|null} [dnsNames] ConnectSettings dnsNames - * @property {number|null} [nodeCount] ConnectSettings nodeCount - * @property {Array.|null} [nodes] ConnectSettings nodes - * @property {Array.|null} [mdxProtocolSupport] ConnectSettings mdxProtocolSupport - */ - - /** - * Constructs a new ConnectSettings. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a ConnectSettings. - * @implements IConnectSettings - * @constructor - * @param {google.cloud.sql.v1.IConnectSettings=} [properties] Properties to set - */ - function ConnectSettings(properties) { - this.ipAddresses = []; - this.customSubjectAlternativeNames = []; - this.dnsNames = []; - this.nodes = []; - this.mdxProtocolSupport = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectSettings kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.kind = ""; - - /** - * ConnectSettings serverCaCert. - * @member {google.cloud.sql.v1.ISslCert|null|undefined} serverCaCert - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.serverCaCert = null; - - /** - * ConnectSettings ipAddresses. - * @member {Array.} ipAddresses - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.ipAddresses = $util.emptyArray; - - /** - * ConnectSettings region. - * @member {string} region - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.region = ""; - - /** - * ConnectSettings databaseVersion. - * @member {google.cloud.sql.v1.SqlDatabaseVersion} databaseVersion - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.databaseVersion = 0; - - /** - * ConnectSettings backendType. - * @member {google.cloud.sql.v1.SqlBackendType} backendType - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.backendType = 0; - - /** - * ConnectSettings pscEnabled. - * @member {boolean} pscEnabled - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.pscEnabled = false; - - /** - * ConnectSettings dnsName. - * @member {string} dnsName - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.dnsName = ""; - - /** - * ConnectSettings serverCaMode. - * @member {google.cloud.sql.v1.ConnectSettings.CaMode} serverCaMode - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.serverCaMode = 0; - - /** - * ConnectSettings customSubjectAlternativeNames. - * @member {Array.} customSubjectAlternativeNames - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.customSubjectAlternativeNames = $util.emptyArray; - - /** - * ConnectSettings dnsNames. - * @member {Array.} dnsNames - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.dnsNames = $util.emptyArray; - - /** - * ConnectSettings nodeCount. - * @member {number|null|undefined} nodeCount - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.nodeCount = null; - - /** - * ConnectSettings nodes. - * @member {Array.} nodes - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.nodes = $util.emptyArray; - - /** - * ConnectSettings mdxProtocolSupport. - * @member {Array.} mdxProtocolSupport - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - */ - ConnectSettings.prototype.mdxProtocolSupport = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ConnectSettings.prototype, "_nodeCount", { - get: $util.oneOfGetter($oneOfFields = ["nodeCount"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ConnectSettings instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ConnectSettings - * @static - * @param {google.cloud.sql.v1.IConnectSettings=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ConnectSettings} ConnectSettings instance - */ - ConnectSettings.create = function create(properties) { - return new ConnectSettings(properties); - }; - - /** - * Encodes the specified ConnectSettings message. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ConnectSettings - * @static - * @param {google.cloud.sql.v1.IConnectSettings} message ConnectSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) - $root.google.cloud.sql.v1.SslCert.encode(message.serverCaCert, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.ipAddresses != null && message.ipAddresses.length) - for (var i = 0; i < message.ipAddresses.length; ++i) - $root.google.cloud.sql.v1.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.region != null && Object.hasOwnProperty.call(message, "region")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.region); - if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) - writer.uint32(/* id 31, wireType 0 =*/248).int32(message.databaseVersion); - if (message.backendType != null && Object.hasOwnProperty.call(message, "backendType")) - writer.uint32(/* id 32, wireType 0 =*/256).int32(message.backendType); - if (message.pscEnabled != null && Object.hasOwnProperty.call(message, "pscEnabled")) - writer.uint32(/* id 33, wireType 0 =*/264).bool(message.pscEnabled); - if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) - writer.uint32(/* id 34, wireType 2 =*/274).string(message.dnsName); - if (message.serverCaMode != null && Object.hasOwnProperty.call(message, "serverCaMode")) - writer.uint32(/* id 35, wireType 0 =*/280).int32(message.serverCaMode); - if (message.customSubjectAlternativeNames != null && message.customSubjectAlternativeNames.length) - for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) - writer.uint32(/* id 37, wireType 2 =*/298).string(message.customSubjectAlternativeNames[i]); - if (message.dnsNames != null && message.dnsNames.length) - for (var i = 0; i < message.dnsNames.length; ++i) - $root.google.cloud.sql.v1.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim(); - if (message.mdxProtocolSupport != null && message.mdxProtocolSupport.length) { - writer.uint32(/* id 39, wireType 2 =*/314).fork(); - for (var i = 0; i < message.mdxProtocolSupport.length; ++i) - writer.int32(message.mdxProtocolSupport[i]); - writer.ldelim(); - } - if (message.nodeCount != null && Object.hasOwnProperty.call(message, "nodeCount")) - writer.uint32(/* id 63, wireType 0 =*/504).int32(message.nodeCount); - if (message.nodes != null && message.nodes.length) - for (var i = 0; i < message.nodes.length; ++i) - $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.encode(message.nodes[i], writer.uint32(/* id 64, wireType 2 =*/514).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ConnectSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ConnectSettings - * @static - * @param {google.cloud.sql.v1.IConnectSettings} message ConnectSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectSettings message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ConnectSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ConnectSettings} ConnectSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ConnectSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.serverCaCert = $root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.ipAddresses && message.ipAddresses.length)) - message.ipAddresses = []; - message.ipAddresses.push($root.google.cloud.sql.v1.IpMapping.decode(reader, reader.uint32())); - break; - } - case 4: { - message.region = reader.string(); - break; - } - case 31: { - message.databaseVersion = reader.int32(); - break; - } - case 32: { - message.backendType = reader.int32(); - break; - } - case 33: { - message.pscEnabled = reader.bool(); - break; - } - case 34: { - message.dnsName = reader.string(); - break; - } - case 35: { - message.serverCaMode = reader.int32(); - break; - } - case 37: { - if (!(message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length)) - message.customSubjectAlternativeNames = []; - message.customSubjectAlternativeNames.push(reader.string()); - break; - } - case 38: { - if (!(message.dnsNames && message.dnsNames.length)) - message.dnsNames = []; - message.dnsNames.push($root.google.cloud.sql.v1.DnsNameMapping.decode(reader, reader.uint32())); - break; - } - case 63: { - message.nodeCount = reader.int32(); - break; - } - case 64: { - if (!(message.nodes && message.nodes.length)) - message.nodes = []; - message.nodes.push($root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.decode(reader, reader.uint32())); - break; - } - case 39: { - if (!(message.mdxProtocolSupport && message.mdxProtocolSupport.length)) - message.mdxProtocolSupport = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.mdxProtocolSupport.push(reader.int32()); - } else - message.mdxProtocolSupport.push(reader.int32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ConnectSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ConnectSettings} ConnectSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectSettings message. - * @function verify - * @memberof google.cloud.sql.v1.ConnectSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { - var error = $root.google.cloud.sql.v1.SslCert.verify(message.serverCaCert); - if (error) - return "serverCaCert." + error; - } - if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { - if (!Array.isArray(message.ipAddresses)) - return "ipAddresses: array expected"; - for (var i = 0; i < message.ipAddresses.length; ++i) { - var error = $root.google.cloud.sql.v1.IpMapping.verify(message.ipAddresses[i]); - if (error) - return "ipAddresses." + error; - } - } - if (message.region != null && message.hasOwnProperty("region")) - if (!$util.isString(message.region)) - return "region: string expected"; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - switch (message.databaseVersion) { - default: - return "databaseVersion: enum value expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 684: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - case 549: - case 550: - case 551: - break; - } - if (message.backendType != null && message.hasOwnProperty("backendType")) - switch (message.backendType) { - default: - return "backendType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) - if (typeof message.pscEnabled !== "boolean") - return "pscEnabled: boolean expected"; - if (message.dnsName != null && message.hasOwnProperty("dnsName")) - if (!$util.isString(message.dnsName)) - return "dnsName: string expected"; - if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) - switch (message.serverCaMode) { - default: - return "serverCaMode: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.customSubjectAlternativeNames != null && message.hasOwnProperty("customSubjectAlternativeNames")) { - if (!Array.isArray(message.customSubjectAlternativeNames)) - return "customSubjectAlternativeNames: array expected"; - for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) - if (!$util.isString(message.customSubjectAlternativeNames[i])) - return "customSubjectAlternativeNames: string[] expected"; - } - if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { - if (!Array.isArray(message.dnsNames)) - return "dnsNames: array expected"; - for (var i = 0; i < message.dnsNames.length; ++i) { - var error = $root.google.cloud.sql.v1.DnsNameMapping.verify(message.dnsNames[i]); - if (error) - return "dnsNames." + error; - } - } - if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { - properties._nodeCount = 1; - if (!$util.isInteger(message.nodeCount)) - return "nodeCount: integer expected"; - } - if (message.nodes != null && message.hasOwnProperty("nodes")) { - if (!Array.isArray(message.nodes)) - return "nodes: array expected"; - for (var i = 0; i < message.nodes.length; ++i) { - var error = $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.verify(message.nodes[i]); - if (error) - return "nodes." + error; - } - } - if (message.mdxProtocolSupport != null && message.hasOwnProperty("mdxProtocolSupport")) { - if (!Array.isArray(message.mdxProtocolSupport)) - return "mdxProtocolSupport: array expected"; - for (var i = 0; i < message.mdxProtocolSupport.length; ++i) - switch (message.mdxProtocolSupport[i]) { - default: - return "mdxProtocolSupport: enum value[] expected"; - case 0: - case 1: - break; - } - } - return null; - }; - - /** - * Creates a ConnectSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ConnectSettings - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ConnectSettings} ConnectSettings - */ - ConnectSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ConnectSettings) - return object; - var message = new $root.google.cloud.sql.v1.ConnectSettings(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.serverCaCert != null) { - if (typeof object.serverCaCert !== "object") - throw TypeError(".google.cloud.sql.v1.ConnectSettings.serverCaCert: object expected"); - message.serverCaCert = $root.google.cloud.sql.v1.SslCert.fromObject(object.serverCaCert); - } - if (object.ipAddresses) { - if (!Array.isArray(object.ipAddresses)) - throw TypeError(".google.cloud.sql.v1.ConnectSettings.ipAddresses: array expected"); - message.ipAddresses = []; - for (var i = 0; i < object.ipAddresses.length; ++i) { - if (typeof object.ipAddresses[i] !== "object") - throw TypeError(".google.cloud.sql.v1.ConnectSettings.ipAddresses: object expected"); - message.ipAddresses[i] = $root.google.cloud.sql.v1.IpMapping.fromObject(object.ipAddresses[i]); - } - } - if (object.region != null) - message.region = String(object.region); - switch (object.databaseVersion) { - default: - if (typeof object.databaseVersion === "number") { - message.databaseVersion = object.databaseVersion; - break; - } - break; - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.databaseVersion = 0; - break; - case "MYSQL_5_1": - case 2: - message.databaseVersion = 2; - break; - case "MYSQL_5_5": - case 3: - message.databaseVersion = 3; - break; - case "MYSQL_5_6": - case 5: - message.databaseVersion = 5; - break; - case "MYSQL_5_7": - case 6: - message.databaseVersion = 6; - break; - case "MYSQL_8_0": - case 20: - message.databaseVersion = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.databaseVersion = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.databaseVersion = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.databaseVersion = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.databaseVersion = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.databaseVersion = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.databaseVersion = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.databaseVersion = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.databaseVersion = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.databaseVersion = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.databaseVersion = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.databaseVersion = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.databaseVersion = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.databaseVersion = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.databaseVersion = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.databaseVersion = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.databaseVersion = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.databaseVersion = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.databaseVersion = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.databaseVersion = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.databaseVersion = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.databaseVersion = 556; - break; - case "MYSQL_8_4": - case 398: - message.databaseVersion = 398; - break; - case "MYSQL_9_7": - case 654: - message.databaseVersion = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.databaseVersion = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.databaseVersion = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.databaseVersion = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.databaseVersion = 16; - break; - case "POSTGRES_9_6": - case 9: - message.databaseVersion = 9; - break; - case "POSTGRES_10": - case 18: - message.databaseVersion = 18; - break; - case "POSTGRES_11": - case 10: - message.databaseVersion = 10; - break; - case "POSTGRES_12": - case 19: - message.databaseVersion = 19; - break; - case "POSTGRES_13": - case 23: - message.databaseVersion = 23; - break; - case "POSTGRES_14": - case 110: - message.databaseVersion = 110; - break; - case "POSTGRES_15": - case 172: - message.databaseVersion = 172; - break; - case "POSTGRES_16": - case 272: - message.databaseVersion = 272; - break; - case "POSTGRES_17": - case 408: - message.databaseVersion = 408; - break; - case "POSTGRES_18": - case 557: - message.databaseVersion = 557; - break; - case "POSTGRES_19": - case 684: - message.databaseVersion = 684; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.databaseVersion = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.databaseVersion = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.databaseVersion = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.databaseVersion = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.databaseVersion = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.databaseVersion = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.databaseVersion = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.databaseVersion = 202; - break; - case "SQLSERVER_2025_STANDARD": - case 549: - message.databaseVersion = 549; - break; - case "SQLSERVER_2025_ENTERPRISE": - case 550: - message.databaseVersion = 550; - break; - case "SQLSERVER_2025_EXPRESS": - case 551: - message.databaseVersion = 551; - break; - } - switch (object.backendType) { - default: - if (typeof object.backendType === "number") { - message.backendType = object.backendType; - break; - } - break; - case "SQL_BACKEND_TYPE_UNSPECIFIED": - case 0: - message.backendType = 0; - break; - case "FIRST_GEN": - case 1: - message.backendType = 1; - break; - case "SECOND_GEN": - case 2: - message.backendType = 2; - break; - case "EXTERNAL": - case 3: - message.backendType = 3; - break; - } - if (object.pscEnabled != null) - message.pscEnabled = Boolean(object.pscEnabled); - if (object.dnsName != null) - message.dnsName = String(object.dnsName); - switch (object.serverCaMode) { - default: - if (typeof object.serverCaMode === "number") { - message.serverCaMode = object.serverCaMode; - break; - } - break; - case "CA_MODE_UNSPECIFIED": - case 0: - message.serverCaMode = 0; - break; - case "GOOGLE_MANAGED_INTERNAL_CA": - case 1: - message.serverCaMode = 1; - break; - case "GOOGLE_MANAGED_CAS_CA": - case 2: - message.serverCaMode = 2; - break; - case "CUSTOMER_MANAGED_CAS_CA": - case 3: - message.serverCaMode = 3; - break; - } - if (object.customSubjectAlternativeNames) { - if (!Array.isArray(object.customSubjectAlternativeNames)) - throw TypeError(".google.cloud.sql.v1.ConnectSettings.customSubjectAlternativeNames: array expected"); - message.customSubjectAlternativeNames = []; - for (var i = 0; i < object.customSubjectAlternativeNames.length; ++i) - message.customSubjectAlternativeNames[i] = String(object.customSubjectAlternativeNames[i]); - } - if (object.dnsNames) { - if (!Array.isArray(object.dnsNames)) - throw TypeError(".google.cloud.sql.v1.ConnectSettings.dnsNames: array expected"); - message.dnsNames = []; - for (var i = 0; i < object.dnsNames.length; ++i) { - if (typeof object.dnsNames[i] !== "object") - throw TypeError(".google.cloud.sql.v1.ConnectSettings.dnsNames: object expected"); - message.dnsNames[i] = $root.google.cloud.sql.v1.DnsNameMapping.fromObject(object.dnsNames[i]); - } - } - if (object.nodeCount != null) - message.nodeCount = object.nodeCount | 0; - if (object.nodes) { - if (!Array.isArray(object.nodes)) - throw TypeError(".google.cloud.sql.v1.ConnectSettings.nodes: array expected"); - message.nodes = []; - for (var i = 0; i < object.nodes.length; ++i) { - if (typeof object.nodes[i] !== "object") - throw TypeError(".google.cloud.sql.v1.ConnectSettings.nodes: object expected"); - message.nodes[i] = $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.fromObject(object.nodes[i]); - } - } - if (object.mdxProtocolSupport) { - if (!Array.isArray(object.mdxProtocolSupport)) - throw TypeError(".google.cloud.sql.v1.ConnectSettings.mdxProtocolSupport: array expected"); - message.mdxProtocolSupport = []; - for (var i = 0; i < object.mdxProtocolSupport.length; ++i) - switch (object.mdxProtocolSupport[i]) { - default: - if (typeof object.mdxProtocolSupport[i] === "number") { - message.mdxProtocolSupport[i] = object.mdxProtocolSupport[i]; - break; - } - case "MDX_PROTOCOL_SUPPORT_UNSPECIFIED": - case 0: - message.mdxProtocolSupport[i] = 0; - break; - case "CLIENT_PROTOCOL_TYPE": - case 1: - message.mdxProtocolSupport[i] = 1; - break; - } - } - return message; - }; - - /** - * Creates a plain object from a ConnectSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ConnectSettings - * @static - * @param {google.cloud.sql.v1.ConnectSettings} message ConnectSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.ipAddresses = []; - object.customSubjectAlternativeNames = []; - object.dnsNames = []; - object.mdxProtocolSupport = []; - object.nodes = []; - } - if (options.defaults) { - object.kind = ""; - object.serverCaCert = null; - object.region = ""; - object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; - object.backendType = options.enums === String ? "SQL_BACKEND_TYPE_UNSPECIFIED" : 0; - object.pscEnabled = false; - object.dnsName = ""; - object.serverCaMode = options.enums === String ? "CA_MODE_UNSPECIFIED" : 0; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) - object.serverCaCert = $root.google.cloud.sql.v1.SslCert.toObject(message.serverCaCert, options); - if (message.ipAddresses && message.ipAddresses.length) { - object.ipAddresses = []; - for (var j = 0; j < message.ipAddresses.length; ++j) - object.ipAddresses[j] = $root.google.cloud.sql.v1.IpMapping.toObject(message.ipAddresses[j], options); - } - if (message.region != null && message.hasOwnProperty("region")) - object.region = message.region; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; - if (message.backendType != null && message.hasOwnProperty("backendType")) - object.backendType = options.enums === String ? $root.google.cloud.sql.v1.SqlBackendType[message.backendType] === undefined ? message.backendType : $root.google.cloud.sql.v1.SqlBackendType[message.backendType] : message.backendType; - if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) - object.pscEnabled = message.pscEnabled; - if (message.dnsName != null && message.hasOwnProperty("dnsName")) - object.dnsName = message.dnsName; - if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) - object.serverCaMode = options.enums === String ? $root.google.cloud.sql.v1.ConnectSettings.CaMode[message.serverCaMode] === undefined ? message.serverCaMode : $root.google.cloud.sql.v1.ConnectSettings.CaMode[message.serverCaMode] : message.serverCaMode; - if (message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length) { - object.customSubjectAlternativeNames = []; - for (var j = 0; j < message.customSubjectAlternativeNames.length; ++j) - object.customSubjectAlternativeNames[j] = message.customSubjectAlternativeNames[j]; - } - if (message.dnsNames && message.dnsNames.length) { - object.dnsNames = []; - for (var j = 0; j < message.dnsNames.length; ++j) - object.dnsNames[j] = $root.google.cloud.sql.v1.DnsNameMapping.toObject(message.dnsNames[j], options); - } - if (message.mdxProtocolSupport && message.mdxProtocolSupport.length) { - object.mdxProtocolSupport = []; - for (var j = 0; j < message.mdxProtocolSupport.length; ++j) - object.mdxProtocolSupport[j] = options.enums === String ? $root.google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport[message.mdxProtocolSupport[j]] === undefined ? message.mdxProtocolSupport[j] : $root.google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport[message.mdxProtocolSupport[j]] : message.mdxProtocolSupport[j]; - } - if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { - object.nodeCount = message.nodeCount; - if (options.oneofs) - object._nodeCount = "nodeCount"; - } - if (message.nodes && message.nodes.length) { - object.nodes = []; - for (var j = 0; j < message.nodes.length; ++j) - object.nodes[j] = $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.toObject(message.nodes[j], options); - } - return object; - }; - - /** - * Converts this ConnectSettings to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ConnectSettings - * @instance - * @returns {Object.} JSON object - */ - ConnectSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ConnectSettings - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ConnectSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ConnectSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ConnectSettings"; - }; - - /** - * CaMode enum. - * @name google.cloud.sql.v1.ConnectSettings.CaMode - * @enum {number} - * @property {number} CA_MODE_UNSPECIFIED=0 CA_MODE_UNSPECIFIED value - * @property {number} GOOGLE_MANAGED_INTERNAL_CA=1 GOOGLE_MANAGED_INTERNAL_CA value - * @property {number} GOOGLE_MANAGED_CAS_CA=2 GOOGLE_MANAGED_CAS_CA value - * @property {number} CUSTOMER_MANAGED_CAS_CA=3 CUSTOMER_MANAGED_CAS_CA value - */ - ConnectSettings.CaMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CA_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "GOOGLE_MANAGED_INTERNAL_CA"] = 1; - values[valuesById[2] = "GOOGLE_MANAGED_CAS_CA"] = 2; - values[valuesById[3] = "CUSTOMER_MANAGED_CAS_CA"] = 3; - return values; - })(); - - ConnectSettings.ConnectPoolNodeConfig = (function() { - - /** - * Properties of a ConnectPoolNodeConfig. - * @memberof google.cloud.sql.v1.ConnectSettings - * @interface IConnectPoolNodeConfig - * @property {string|null} [name] ConnectPoolNodeConfig name - * @property {Array.|null} [ipAddresses] ConnectPoolNodeConfig ipAddresses - * @property {string|null} [dnsName] ConnectPoolNodeConfig dnsName - * @property {Array.|null} [dnsNames] ConnectPoolNodeConfig dnsNames - */ - - /** - * Constructs a new ConnectPoolNodeConfig. - * @memberof google.cloud.sql.v1.ConnectSettings - * @classdesc Represents a ConnectPoolNodeConfig. - * @implements IConnectPoolNodeConfig - * @constructor - * @param {google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig=} [properties] Properties to set - */ - function ConnectPoolNodeConfig(properties) { - this.ipAddresses = []; - this.dnsNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectPoolNodeConfig name. - * @member {string|null|undefined} name - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @instance - */ - ConnectPoolNodeConfig.prototype.name = null; - - /** - * ConnectPoolNodeConfig ipAddresses. - * @member {Array.} ipAddresses - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @instance - */ - ConnectPoolNodeConfig.prototype.ipAddresses = $util.emptyArray; - - /** - * ConnectPoolNodeConfig dnsName. - * @member {string|null|undefined} dnsName - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @instance - */ - ConnectPoolNodeConfig.prototype.dnsName = null; - - /** - * ConnectPoolNodeConfig dnsNames. - * @member {Array.} dnsNames - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @instance - */ - ConnectPoolNodeConfig.prototype.dnsNames = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ConnectPoolNodeConfig.prototype, "_name", { - get: $util.oneOfGetter($oneOfFields = ["name"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ConnectPoolNodeConfig.prototype, "_dnsName", { - get: $util.oneOfGetter($oneOfFields = ["dnsName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ConnectPoolNodeConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig instance - */ - ConnectPoolNodeConfig.create = function create(properties) { - return new ConnectPoolNodeConfig(properties); - }; - - /** - * Encodes the specified ConnectPoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig} message ConnectPoolNodeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectPoolNodeConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.ipAddresses != null && message.ipAddresses.length) - for (var i = 0; i < message.ipAddresses.length; ++i) - $root.google.cloud.sql.v1.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.dnsName); - if (message.dnsNames != null && message.dnsNames.length) - for (var i = 0; i < message.dnsNames.length; ++i) - $root.google.cloud.sql.v1.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ConnectPoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {google.cloud.sql.v1.ConnectSettings.IConnectPoolNodeConfig} message ConnectPoolNodeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectPoolNodeConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectPoolNodeConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - if (!(message.ipAddresses && message.ipAddresses.length)) - message.ipAddresses = []; - message.ipAddresses.push($root.google.cloud.sql.v1.IpMapping.decode(reader, reader.uint32())); - break; - } - case 3: { - message.dnsName = reader.string(); - break; - } - case 4: { - if (!(message.dnsNames && message.dnsNames.length)) - message.dnsNames = []; - message.dnsNames.push($root.google.cloud.sql.v1.DnsNameMapping.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectPoolNodeConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectPoolNodeConfig message. - * @function verify - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectPoolNodeConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) { - properties._name = 1; - if (!$util.isString(message.name)) - return "name: string expected"; - } - if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { - if (!Array.isArray(message.ipAddresses)) - return "ipAddresses: array expected"; - for (var i = 0; i < message.ipAddresses.length; ++i) { - var error = $root.google.cloud.sql.v1.IpMapping.verify(message.ipAddresses[i]); - if (error) - return "ipAddresses." + error; - } - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - properties._dnsName = 1; - if (!$util.isString(message.dnsName)) - return "dnsName: string expected"; - } - if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { - if (!Array.isArray(message.dnsNames)) - return "dnsNames: array expected"; - for (var i = 0; i < message.dnsNames.length; ++i) { - var error = $root.google.cloud.sql.v1.DnsNameMapping.verify(message.dnsNames[i]); - if (error) - return "dnsNames." + error; - } - } - return null; - }; - - /** - * Creates a ConnectPoolNodeConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig - */ - ConnectPoolNodeConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig) - return object; - var message = new $root.google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig(); - if (object.name != null) - message.name = String(object.name); - if (object.ipAddresses) { - if (!Array.isArray(object.ipAddresses)) - throw TypeError(".google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.ipAddresses: array expected"); - message.ipAddresses = []; - for (var i = 0; i < object.ipAddresses.length; ++i) { - if (typeof object.ipAddresses[i] !== "object") - throw TypeError(".google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.ipAddresses: object expected"); - message.ipAddresses[i] = $root.google.cloud.sql.v1.IpMapping.fromObject(object.ipAddresses[i]); - } - } - if (object.dnsName != null) - message.dnsName = String(object.dnsName); - if (object.dnsNames) { - if (!Array.isArray(object.dnsNames)) - throw TypeError(".google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.dnsNames: array expected"); - message.dnsNames = []; - for (var i = 0; i < object.dnsNames.length; ++i) { - if (typeof object.dnsNames[i] !== "object") - throw TypeError(".google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig.dnsNames: object expected"); - message.dnsNames[i] = $root.google.cloud.sql.v1.DnsNameMapping.fromObject(object.dnsNames[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ConnectPoolNodeConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig} message ConnectPoolNodeConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectPoolNodeConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.ipAddresses = []; - object.dnsNames = []; - } - if (message.name != null && message.hasOwnProperty("name")) { - object.name = message.name; - if (options.oneofs) - object._name = "name"; - } - if (message.ipAddresses && message.ipAddresses.length) { - object.ipAddresses = []; - for (var j = 0; j < message.ipAddresses.length; ++j) - object.ipAddresses[j] = $root.google.cloud.sql.v1.IpMapping.toObject(message.ipAddresses[j], options); - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - object.dnsName = message.dnsName; - if (options.oneofs) - object._dnsName = "dnsName"; - } - if (message.dnsNames && message.dnsNames.length) { - object.dnsNames = []; - for (var j = 0; j < message.dnsNames.length; ++j) - object.dnsNames[j] = $root.google.cloud.sql.v1.DnsNameMapping.toObject(message.dnsNames[j], options); - } - return object; - }; - - /** - * Converts this ConnectPoolNodeConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @instance - * @returns {Object.} JSON object - */ - ConnectPoolNodeConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ConnectPoolNodeConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ConnectPoolNodeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.ConnectSettings.ConnectPoolNodeConfig"; - }; - - return ConnectPoolNodeConfig; - })(); - - /** - * MdxProtocolSupport enum. - * @name google.cloud.sql.v1.ConnectSettings.MdxProtocolSupport - * @enum {number} - * @property {number} MDX_PROTOCOL_SUPPORT_UNSPECIFIED=0 MDX_PROTOCOL_SUPPORT_UNSPECIFIED value - * @property {number} CLIENT_PROTOCOL_TYPE=1 CLIENT_PROTOCOL_TYPE value - */ - ConnectSettings.MdxProtocolSupport = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MDX_PROTOCOL_SUPPORT_UNSPECIFIED"] = 0; - values[valuesById[1] = "CLIENT_PROTOCOL_TYPE"] = 1; - return values; - })(); - - return ConnectSettings; - })(); - - v1.GenerateEphemeralCertRequest = (function() { - - /** - * Properties of a GenerateEphemeralCertRequest. - * @memberof google.cloud.sql.v1 - * @interface IGenerateEphemeralCertRequest - * @property {string|null} [instance] GenerateEphemeralCertRequest instance - * @property {string|null} [project] GenerateEphemeralCertRequest project - * @property {string|null} [publicKey] GenerateEphemeralCertRequest publicKey - * @property {string|null} [accessToken] GenerateEphemeralCertRequest accessToken - * @property {google.protobuf.ITimestamp|null} [readTime] GenerateEphemeralCertRequest readTime - * @property {google.protobuf.IDuration|null} [validDuration] GenerateEphemeralCertRequest validDuration - */ - - /** - * Constructs a new GenerateEphemeralCertRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a GenerateEphemeralCertRequest. - * @implements IGenerateEphemeralCertRequest - * @constructor - * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest=} [properties] Properties to set - */ - function GenerateEphemeralCertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenerateEphemeralCertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.instance = ""; - - /** - * GenerateEphemeralCertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.project = ""; - - /** - * GenerateEphemeralCertRequest publicKey. - * @member {string} publicKey - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.publicKey = ""; - - /** - * GenerateEphemeralCertRequest accessToken. - * @member {string} accessToken - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.accessToken = ""; - - /** - * GenerateEphemeralCertRequest readTime. - * @member {google.protobuf.ITimestamp|null|undefined} readTime - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.readTime = null; - - /** - * GenerateEphemeralCertRequest validDuration. - * @member {google.protobuf.IDuration|null|undefined} validDuration - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.validDuration = null; - - /** - * Creates a new GenerateEphemeralCertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest instance - */ - GenerateEphemeralCertRequest.create = function create(properties) { - return new GenerateEphemeralCertRequest(properties); - }; - - /** - * Encodes the specified GenerateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest} message GenerateEphemeralCertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenerateEphemeralCertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.publicKey); - if (message.accessToken != null && Object.hasOwnProperty.call(message, "accessToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.accessToken); - if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) - $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.validDuration != null && Object.hasOwnProperty.call(message, "validDuration")) - $root.google.protobuf.Duration.encode(message.validDuration, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenerateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1.IGenerateEphemeralCertRequest} message GenerateEphemeralCertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenerateEphemeralCertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenerateEphemeralCertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.GenerateEphemeralCertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.publicKey = reader.string(); - break; - } - case 4: { - message.accessToken = reader.string(); - break; - } - case 7: { - message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 12: { - message.validDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenerateEphemeralCertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenerateEphemeralCertRequest message. - * @function verify - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenerateEphemeralCertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.publicKey != null && message.hasOwnProperty("publicKey")) - if (!$util.isString(message.publicKey)) - return "publicKey: string expected"; - if (message.accessToken != null && message.hasOwnProperty("accessToken")) - if (!$util.isString(message.accessToken)) - return "accessToken: string expected"; - if (message.readTime != null && message.hasOwnProperty("readTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.readTime); - if (error) - return "readTime." + error; - } - if (message.validDuration != null && message.hasOwnProperty("validDuration")) { - var error = $root.google.protobuf.Duration.verify(message.validDuration); - if (error) - return "validDuration." + error; - } - return null; - }; - - /** - * Creates a GenerateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest - */ - GenerateEphemeralCertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.GenerateEphemeralCertRequest) - return object; - var message = new $root.google.cloud.sql.v1.GenerateEphemeralCertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.publicKey != null) - message.publicKey = String(object.publicKey); - if (object.accessToken != null) - message.accessToken = String(object.accessToken); - if (object.readTime != null) { - if (typeof object.readTime !== "object") - throw TypeError(".google.cloud.sql.v1.GenerateEphemeralCertRequest.readTime: object expected"); - message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime); - } - if (object.validDuration != null) { - if (typeof object.validDuration !== "object") - throw TypeError(".google.cloud.sql.v1.GenerateEphemeralCertRequest.validDuration: object expected"); - message.validDuration = $root.google.protobuf.Duration.fromObject(object.validDuration); - } - return message; - }; - - /** - * Creates a plain object from a GenerateEphemeralCertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1.GenerateEphemeralCertRequest} message GenerateEphemeralCertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenerateEphemeralCertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.publicKey = ""; - object.accessToken = ""; - object.readTime = null; - object.validDuration = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.publicKey != null && message.hasOwnProperty("publicKey")) - object.publicKey = message.publicKey; - if (message.accessToken != null && message.hasOwnProperty("accessToken")) - object.accessToken = message.accessToken; - if (message.readTime != null && message.hasOwnProperty("readTime")) - object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options); - if (message.validDuration != null && message.hasOwnProperty("validDuration")) - object.validDuration = $root.google.protobuf.Duration.toObject(message.validDuration, options); - return object; - }; - - /** - * Converts this GenerateEphemeralCertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @instance - * @returns {Object.} JSON object - */ - GenerateEphemeralCertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GenerateEphemeralCertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.GenerateEphemeralCertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GenerateEphemeralCertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.GenerateEphemeralCertRequest"; - }; - - return GenerateEphemeralCertRequest; - })(); - - v1.GenerateEphemeralCertResponse = (function() { - - /** - * Properties of a GenerateEphemeralCertResponse. - * @memberof google.cloud.sql.v1 - * @interface IGenerateEphemeralCertResponse - * @property {google.cloud.sql.v1.ISslCert|null} [ephemeralCert] GenerateEphemeralCertResponse ephemeralCert - */ - - /** - * Constructs a new GenerateEphemeralCertResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a GenerateEphemeralCertResponse. - * @implements IGenerateEphemeralCertResponse - * @constructor - * @param {google.cloud.sql.v1.IGenerateEphemeralCertResponse=} [properties] Properties to set - */ - function GenerateEphemeralCertResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenerateEphemeralCertResponse ephemeralCert. - * @member {google.cloud.sql.v1.ISslCert|null|undefined} ephemeralCert - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @instance - */ - GenerateEphemeralCertResponse.prototype.ephemeralCert = null; - - /** - * Creates a new GenerateEphemeralCertResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @static - * @param {google.cloud.sql.v1.IGenerateEphemeralCertResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse instance - */ - GenerateEphemeralCertResponse.create = function create(properties) { - return new GenerateEphemeralCertResponse(properties); - }; - - /** - * Encodes the specified GenerateEphemeralCertResponse message. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @static - * @param {google.cloud.sql.v1.IGenerateEphemeralCertResponse} message GenerateEphemeralCertResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenerateEphemeralCertResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ephemeralCert != null && Object.hasOwnProperty.call(message, "ephemeralCert")) - $root.google.cloud.sql.v1.SslCert.encode(message.ephemeralCert, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenerateEphemeralCertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.GenerateEphemeralCertResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @static - * @param {google.cloud.sql.v1.IGenerateEphemeralCertResponse} message GenerateEphemeralCertResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenerateEphemeralCertResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenerateEphemeralCertResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.GenerateEphemeralCertResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.ephemeralCert = $root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenerateEphemeralCertResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenerateEphemeralCertResponse message. - * @function verify - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenerateEphemeralCertResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ephemeralCert != null && message.hasOwnProperty("ephemeralCert")) { - var error = $root.google.cloud.sql.v1.SslCert.verify(message.ephemeralCert); - if (error) - return "ephemeralCert." + error; - } - return null; - }; - - /** - * Creates a GenerateEphemeralCertResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse - */ - GenerateEphemeralCertResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.GenerateEphemeralCertResponse) - return object; - var message = new $root.google.cloud.sql.v1.GenerateEphemeralCertResponse(); - if (object.ephemeralCert != null) { - if (typeof object.ephemeralCert !== "object") - throw TypeError(".google.cloud.sql.v1.GenerateEphemeralCertResponse.ephemeralCert: object expected"); - message.ephemeralCert = $root.google.cloud.sql.v1.SslCert.fromObject(object.ephemeralCert); - } - return message; - }; - - /** - * Creates a plain object from a GenerateEphemeralCertResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @static - * @param {google.cloud.sql.v1.GenerateEphemeralCertResponse} message GenerateEphemeralCertResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenerateEphemeralCertResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.ephemeralCert = null; - if (message.ephemeralCert != null && message.hasOwnProperty("ephemeralCert")) - object.ephemeralCert = $root.google.cloud.sql.v1.SslCert.toObject(message.ephemeralCert, options); - return object; - }; - - /** - * Converts this GenerateEphemeralCertResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @instance - * @returns {Object.} JSON object - */ - GenerateEphemeralCertResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GenerateEphemeralCertResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.GenerateEphemeralCertResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GenerateEphemeralCertResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.GenerateEphemeralCertResponse"; - }; - - return GenerateEphemeralCertResponse; - })(); - - v1.SqlDatabasesService = (function() { - - /** - * Constructs a new SqlDatabasesService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlDatabasesService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlDatabasesService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlDatabasesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlDatabasesService; - - /** - * Creates new SqlDatabasesService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlDatabasesService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlDatabasesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|delete_}. - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @typedef DeleteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest} request SqlDatabasesDeleteRequest message or plain object - * @param {google.cloud.sql.v1.SqlDatabasesService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype["delete"] = function delete_(request, callback) { - return this.rpcCall(delete_, $root.google.cloud.sql.v1.SqlDatabasesDeleteRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Delete" }); - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest} request SqlDatabasesDeleteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|get}. - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Database} [response] Database - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest} request SqlDatabasesGetRequest message or plain object - * @param {google.cloud.sql.v1.SqlDatabasesService.GetCallback} callback Node-style callback called with the error, if any, and Database - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1.SqlDatabasesGetRequest, $root.google.cloud.sql.v1.Database, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest} request SqlDatabasesGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|insert}. - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @typedef InsertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest} request SqlDatabasesInsertRequest message or plain object - * @param {google.cloud.sql.v1.SqlDatabasesService.InsertCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype.insert = function insert(request, callback) { - return this.rpcCall(insert, $root.google.cloud.sql.v1.SqlDatabasesInsertRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Insert" }); - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest} request SqlDatabasesInsertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|list}. - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.DatabasesListResponse} [response] DatabasesListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesListRequest} request SqlDatabasesListRequest message or plain object - * @param {google.cloud.sql.v1.SqlDatabasesService.ListCallback} callback Node-style callback called with the error, if any, and DatabasesListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1.SqlDatabasesListRequest, $root.google.cloud.sql.v1.DatabasesListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesListRequest} request SqlDatabasesListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|patch}. - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @typedef PatchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Patch. - * @function patch - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object - * @param {google.cloud.sql.v1.SqlDatabasesService.PatchCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype.patch = function patch(request, callback) { - return this.rpcCall(patch, $root.google.cloud.sql.v1.SqlDatabasesUpdateRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Patch" }); - - /** - * Calls Patch. - * @function patch - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlDatabasesService|update}. - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @typedef UpdateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object - * @param {google.cloud.sql.v1.SqlDatabasesService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype.update = function update(request, callback) { - return this.rpcCall(update, $root.google.cloud.sql.v1.SqlDatabasesUpdateRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Update" }); - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlDatabasesService; - })(); - - v1.SqlDatabasesDeleteRequest = (function() { - - /** - * Properties of a SqlDatabasesDeleteRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlDatabasesDeleteRequest - * @property {string|null} [database] SqlDatabasesDeleteRequest database - * @property {string|null} [instance] SqlDatabasesDeleteRequest instance - * @property {string|null} [project] SqlDatabasesDeleteRequest project - */ - - /** - * Constructs a new SqlDatabasesDeleteRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlDatabasesDeleteRequest. - * @implements ISqlDatabasesDeleteRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest=} [properties] Properties to set - */ - function SqlDatabasesDeleteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlDatabasesDeleteRequest database. - * @member {string} database - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @instance - */ - SqlDatabasesDeleteRequest.prototype.database = ""; - - /** - * SqlDatabasesDeleteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @instance - */ - SqlDatabasesDeleteRequest.prototype.instance = ""; - - /** - * SqlDatabasesDeleteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @instance - */ - SqlDatabasesDeleteRequest.prototype.project = ""; - - /** - * Creates a new SqlDatabasesDeleteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest instance - */ - SqlDatabasesDeleteRequest.create = function create(properties) { - return new SqlDatabasesDeleteRequest(properties); - }; - - /** - * Encodes the specified SqlDatabasesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesDeleteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesDeleteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlDatabasesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesDeleteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesDeleteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlDatabasesDeleteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.database = reader.string(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesDeleteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlDatabasesDeleteRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlDatabasesDeleteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlDatabasesDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest - */ - SqlDatabasesDeleteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlDatabasesDeleteRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlDatabasesDeleteRequest(); - if (object.database != null) - message.database = String(object.database); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlDatabasesDeleteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @static - * @param {google.cloud.sql.v1.SqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlDatabasesDeleteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.database = ""; - object.instance = ""; - object.project = ""; - } - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlDatabasesDeleteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlDatabasesDeleteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlDatabasesDeleteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlDatabasesDeleteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlDatabasesDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlDatabasesDeleteRequest"; - }; - - return SqlDatabasesDeleteRequest; - })(); - - v1.SqlDatabasesGetRequest = (function() { - - /** - * Properties of a SqlDatabasesGetRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlDatabasesGetRequest - * @property {string|null} [database] SqlDatabasesGetRequest database - * @property {string|null} [instance] SqlDatabasesGetRequest instance - * @property {string|null} [project] SqlDatabasesGetRequest project - */ - - /** - * Constructs a new SqlDatabasesGetRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlDatabasesGetRequest. - * @implements ISqlDatabasesGetRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest=} [properties] Properties to set - */ - function SqlDatabasesGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlDatabasesGetRequest database. - * @member {string} database - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @instance - */ - SqlDatabasesGetRequest.prototype.database = ""; - - /** - * SqlDatabasesGetRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @instance - */ - SqlDatabasesGetRequest.prototype.instance = ""; - - /** - * SqlDatabasesGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @instance - */ - SqlDatabasesGetRequest.prototype.project = ""; - - /** - * Creates a new SqlDatabasesGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlDatabasesGetRequest} SqlDatabasesGetRequest instance - */ - SqlDatabasesGetRequest.create = function create(properties) { - return new SqlDatabasesGetRequest(properties); - }; - - /** - * Encodes the specified SqlDatabasesGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest} message SqlDatabasesGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlDatabasesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesGetRequest} message SqlDatabasesGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlDatabasesGetRequest} SqlDatabasesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlDatabasesGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.database = reader.string(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlDatabasesGetRequest} SqlDatabasesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlDatabasesGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlDatabasesGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlDatabasesGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlDatabasesGetRequest} SqlDatabasesGetRequest - */ - SqlDatabasesGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlDatabasesGetRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlDatabasesGetRequest(); - if (object.database != null) - message.database = String(object.database); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlDatabasesGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @static - * @param {google.cloud.sql.v1.SqlDatabasesGetRequest} message SqlDatabasesGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlDatabasesGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.database = ""; - object.instance = ""; - object.project = ""; - } - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlDatabasesGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlDatabasesGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlDatabasesGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlDatabasesGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlDatabasesGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlDatabasesGetRequest"; - }; - - return SqlDatabasesGetRequest; - })(); - - v1.SqlDatabasesInsertRequest = (function() { - - /** - * Properties of a SqlDatabasesInsertRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlDatabasesInsertRequest - * @property {string|null} [instance] SqlDatabasesInsertRequest instance - * @property {string|null} [project] SqlDatabasesInsertRequest project - * @property {google.cloud.sql.v1.IDatabase|null} [body] SqlDatabasesInsertRequest body - */ - - /** - * Constructs a new SqlDatabasesInsertRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlDatabasesInsertRequest. - * @implements ISqlDatabasesInsertRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest=} [properties] Properties to set - */ - function SqlDatabasesInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlDatabasesInsertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @instance - */ - SqlDatabasesInsertRequest.prototype.instance = ""; - - /** - * SqlDatabasesInsertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @instance - */ - SqlDatabasesInsertRequest.prototype.project = ""; - - /** - * SqlDatabasesInsertRequest body. - * @member {google.cloud.sql.v1.IDatabase|null|undefined} body - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @instance - */ - SqlDatabasesInsertRequest.prototype.body = null; - - /** - * Creates a new SqlDatabasesInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest instance - */ - SqlDatabasesInsertRequest.create = function create(properties) { - return new SqlDatabasesInsertRequest(properties); - }; - - /** - * Encodes the specified SqlDatabasesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest} message SqlDatabasesInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.Database.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlDatabasesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesInsertRequest} message SqlDatabasesInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlDatabasesInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.Database.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlDatabasesInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlDatabasesInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.Database.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlDatabasesInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest - */ - SqlDatabasesInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlDatabasesInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlDatabasesInsertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlDatabasesInsertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.Database.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlDatabasesInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @static - * @param {google.cloud.sql.v1.SqlDatabasesInsertRequest} message SqlDatabasesInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlDatabasesInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.Database.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlDatabasesInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlDatabasesInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlDatabasesInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlDatabasesInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlDatabasesInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlDatabasesInsertRequest"; - }; - - return SqlDatabasesInsertRequest; - })(); - - v1.SqlDatabasesListRequest = (function() { - - /** - * Properties of a SqlDatabasesListRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlDatabasesListRequest - * @property {string|null} [instance] SqlDatabasesListRequest instance - * @property {string|null} [project] SqlDatabasesListRequest project - */ - - /** - * Constructs a new SqlDatabasesListRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlDatabasesListRequest. - * @implements ISqlDatabasesListRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlDatabasesListRequest=} [properties] Properties to set - */ - function SqlDatabasesListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlDatabasesListRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @instance - */ - SqlDatabasesListRequest.prototype.instance = ""; - - /** - * SqlDatabasesListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @instance - */ - SqlDatabasesListRequest.prototype.project = ""; - - /** - * Creates a new SqlDatabasesListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlDatabasesListRequest} SqlDatabasesListRequest instance - */ - SqlDatabasesListRequest.create = function create(properties) { - return new SqlDatabasesListRequest(properties); - }; - - /** - * Encodes the specified SqlDatabasesListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesListRequest} message SqlDatabasesListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlDatabasesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesListRequest} message SqlDatabasesListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlDatabasesListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlDatabasesListRequest} SqlDatabasesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlDatabasesListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlDatabasesListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlDatabasesListRequest} SqlDatabasesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlDatabasesListRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlDatabasesListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlDatabasesListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlDatabasesListRequest} SqlDatabasesListRequest - */ - SqlDatabasesListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlDatabasesListRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlDatabasesListRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlDatabasesListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @static - * @param {google.cloud.sql.v1.SqlDatabasesListRequest} message SqlDatabasesListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlDatabasesListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlDatabasesListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlDatabasesListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlDatabasesListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlDatabasesListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlDatabasesListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlDatabasesListRequest"; - }; - - return SqlDatabasesListRequest; - })(); - - v1.SqlDatabasesUpdateRequest = (function() { - - /** - * Properties of a SqlDatabasesUpdateRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlDatabasesUpdateRequest - * @property {string|null} [database] SqlDatabasesUpdateRequest database - * @property {string|null} [instance] SqlDatabasesUpdateRequest instance - * @property {string|null} [project] SqlDatabasesUpdateRequest project - * @property {google.cloud.sql.v1.IDatabase|null} [body] SqlDatabasesUpdateRequest body - */ - - /** - * Constructs a new SqlDatabasesUpdateRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlDatabasesUpdateRequest. - * @implements ISqlDatabasesUpdateRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest=} [properties] Properties to set - */ - function SqlDatabasesUpdateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlDatabasesUpdateRequest database. - * @member {string} database - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @instance - */ - SqlDatabasesUpdateRequest.prototype.database = ""; - - /** - * SqlDatabasesUpdateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @instance - */ - SqlDatabasesUpdateRequest.prototype.instance = ""; - - /** - * SqlDatabasesUpdateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @instance - */ - SqlDatabasesUpdateRequest.prototype.project = ""; - - /** - * SqlDatabasesUpdateRequest body. - * @member {google.cloud.sql.v1.IDatabase|null|undefined} body - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @instance - */ - SqlDatabasesUpdateRequest.prototype.body = null; - - /** - * Creates a new SqlDatabasesUpdateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest instance - */ - SqlDatabasesUpdateRequest.create = function create(properties) { - return new SqlDatabasesUpdateRequest(properties); - }; - - /** - * Encodes the specified SqlDatabasesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesUpdateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesUpdateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.Database.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlDatabasesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlDatabasesUpdateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @static - * @param {google.cloud.sql.v1.ISqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesUpdateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlDatabasesUpdateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.database = reader.string(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.Database.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesUpdateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlDatabasesUpdateRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlDatabasesUpdateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.Database.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlDatabasesUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest - */ - SqlDatabasesUpdateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlDatabasesUpdateRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlDatabasesUpdateRequest(); - if (object.database != null) - message.database = String(object.database); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlDatabasesUpdateRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.Database.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlDatabasesUpdateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @static - * @param {google.cloud.sql.v1.SqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlDatabasesUpdateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.database = ""; - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.Database.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlDatabasesUpdateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlDatabasesUpdateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlDatabasesUpdateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlDatabasesUpdateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlDatabasesUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlDatabasesUpdateRequest"; - }; - - return SqlDatabasesUpdateRequest; - })(); - - v1.DatabasesListResponse = (function() { - - /** - * Properties of a DatabasesListResponse. - * @memberof google.cloud.sql.v1 - * @interface IDatabasesListResponse - * @property {string|null} [kind] DatabasesListResponse kind - * @property {Array.|null} [items] DatabasesListResponse items - */ - - /** - * Constructs a new DatabasesListResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a DatabasesListResponse. - * @implements IDatabasesListResponse - * @constructor - * @param {google.cloud.sql.v1.IDatabasesListResponse=} [properties] Properties to set - */ - function DatabasesListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DatabasesListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @instance - */ - DatabasesListResponse.prototype.kind = ""; - - /** - * DatabasesListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @instance - */ - DatabasesListResponse.prototype.items = $util.emptyArray; - - /** - * Creates a new DatabasesListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @static - * @param {google.cloud.sql.v1.IDatabasesListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.DatabasesListResponse} DatabasesListResponse instance - */ - DatabasesListResponse.create = function create(properties) { - return new DatabasesListResponse(properties); - }; - - /** - * Encodes the specified DatabasesListResponse message. Does not implicitly {@link google.cloud.sql.v1.DatabasesListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @static - * @param {google.cloud.sql.v1.IDatabasesListResponse} message DatabasesListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabasesListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1.Database.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DatabasesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.DatabasesListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @static - * @param {google.cloud.sql.v1.IDatabasesListResponse} message DatabasesListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabasesListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DatabasesListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.DatabasesListResponse} DatabasesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabasesListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.DatabasesListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1.Database.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DatabasesListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.DatabasesListResponse} DatabasesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabasesListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DatabasesListResponse message. - * @function verify - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DatabasesListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1.Database.verify(message.items[i]); - if (error) - return "items." + error; - } - } - return null; - }; - - /** - * Creates a DatabasesListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.DatabasesListResponse} DatabasesListResponse - */ - DatabasesListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.DatabasesListResponse) - return object; - var message = new $root.google.cloud.sql.v1.DatabasesListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1.DatabasesListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1.DatabasesListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1.Database.fromObject(object.items[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a DatabasesListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @static - * @param {google.cloud.sql.v1.DatabasesListResponse} message DatabasesListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DatabasesListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1.Database.toObject(message.items[j], options); - } - return object; - }; - - /** - * Converts this DatabasesListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @instance - * @returns {Object.} JSON object - */ - DatabasesListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DatabasesListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.DatabasesListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DatabasesListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.DatabasesListResponse"; - }; - - return DatabasesListResponse; - })(); - - v1.SqlEventsService = (function() { - - /** - * Constructs a new SqlEventsService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlEventsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlEventsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlEventsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlEventsService; - - /** - * Creates new SqlEventsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlEventsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlEventsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlEventsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - return SqlEventsService; - })(); - - v1.SqlFeatureEligibilityService = (function() { - - /** - * Constructs a new SqlFeatureEligibilityService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlFeatureEligibilityService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlFeatureEligibilityService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlFeatureEligibilityService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlFeatureEligibilityService; - - /** - * Creates new SqlFeatureEligibilityService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlFeatureEligibilityService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlFeatureEligibilityService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlFeatureEligibilityService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - return SqlFeatureEligibilityService; - })(); - - v1.SqlFlagsService = (function() { - - /** - * Constructs a new SqlFlagsService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlFlagsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlFlagsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlFlagsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlFlagsService; - - /** - * Creates new SqlFlagsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlFlagsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlFlagsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlFlagsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlFlagsService|list}. - * @memberof google.cloud.sql.v1.SqlFlagsService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.FlagsListResponse} [response] FlagsListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlFlagsService - * @instance - * @param {google.cloud.sql.v1.ISqlFlagsListRequest} request SqlFlagsListRequest message or plain object - * @param {google.cloud.sql.v1.SqlFlagsService.ListCallback} callback Node-style callback called with the error, if any, and FlagsListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlFlagsService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1.SqlFlagsListRequest, $root.google.cloud.sql.v1.FlagsListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlFlagsService - * @instance - * @param {google.cloud.sql.v1.ISqlFlagsListRequest} request SqlFlagsListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlFlagsService; - })(); - - v1.SqlFlagsListRequest = (function() { - - /** - * Properties of a SqlFlagsListRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlFlagsListRequest - * @property {string|null} [databaseVersion] SqlFlagsListRequest databaseVersion - * @property {google.cloud.sql.v1.SqlFlagScope|null} [flagScope] SqlFlagsListRequest flagScope - */ - - /** - * Constructs a new SqlFlagsListRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlFlagsListRequest. - * @implements ISqlFlagsListRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlFlagsListRequest=} [properties] Properties to set - */ - function SqlFlagsListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlFlagsListRequest databaseVersion. - * @member {string} databaseVersion - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @instance - */ - SqlFlagsListRequest.prototype.databaseVersion = ""; - - /** - * SqlFlagsListRequest flagScope. - * @member {google.cloud.sql.v1.SqlFlagScope|null|undefined} flagScope - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @instance - */ - SqlFlagsListRequest.prototype.flagScope = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlFlagsListRequest.prototype, "_flagScope", { - get: $util.oneOfGetter($oneOfFields = ["flagScope"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlFlagsListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlFlagsListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlFlagsListRequest} SqlFlagsListRequest instance - */ - SqlFlagsListRequest.create = function create(properties) { - return new SqlFlagsListRequest(properties); - }; - - /** - * Encodes the specified SqlFlagsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlFlagsListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlFlagsListRequest} message SqlFlagsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlFlagsListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.databaseVersion); - if (message.flagScope != null && Object.hasOwnProperty.call(message, "flagScope")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.flagScope); - return writer; - }; - - /** - * Encodes the specified SqlFlagsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlFlagsListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlFlagsListRequest} message SqlFlagsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlFlagsListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlFlagsListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlFlagsListRequest} SqlFlagsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlFlagsListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlFlagsListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.databaseVersion = reader.string(); - break; - } - case 3: { - message.flagScope = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlFlagsListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlFlagsListRequest} SqlFlagsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlFlagsListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlFlagsListRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlFlagsListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - if (!$util.isString(message.databaseVersion)) - return "databaseVersion: string expected"; - if (message.flagScope != null && message.hasOwnProperty("flagScope")) { - properties._flagScope = 1; - switch (message.flagScope) { - default: - return "flagScope: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - return null; - }; - - /** - * Creates a SqlFlagsListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlFlagsListRequest} SqlFlagsListRequest - */ - SqlFlagsListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlFlagsListRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlFlagsListRequest(); - if (object.databaseVersion != null) - message.databaseVersion = String(object.databaseVersion); - switch (object.flagScope) { - default: - if (typeof object.flagScope === "number") { - message.flagScope = object.flagScope; - break; - } - break; - case "SQL_FLAG_SCOPE_UNSPECIFIED": - case 0: - message.flagScope = 0; - break; - case "SQL_FLAG_SCOPE_DATABASE": - case 1: - message.flagScope = 1; - break; - case "SQL_FLAG_SCOPE_CONNECTION_POOL": - case 2: - message.flagScope = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a SqlFlagsListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @static - * @param {google.cloud.sql.v1.SqlFlagsListRequest} message SqlFlagsListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlFlagsListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.databaseVersion = ""; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - object.databaseVersion = message.databaseVersion; - if (message.flagScope != null && message.hasOwnProperty("flagScope")) { - object.flagScope = options.enums === String ? $root.google.cloud.sql.v1.SqlFlagScope[message.flagScope] === undefined ? message.flagScope : $root.google.cloud.sql.v1.SqlFlagScope[message.flagScope] : message.flagScope; - if (options.oneofs) - object._flagScope = "flagScope"; - } - return object; - }; - - /** - * Converts this SqlFlagsListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlFlagsListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlFlagsListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlFlagsListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlFlagsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlFlagsListRequest"; - }; - - return SqlFlagsListRequest; - })(); - - v1.FlagsListResponse = (function() { - - /** - * Properties of a FlagsListResponse. - * @memberof google.cloud.sql.v1 - * @interface IFlagsListResponse - * @property {string|null} [kind] FlagsListResponse kind - * @property {Array.|null} [items] FlagsListResponse items - */ - - /** - * Constructs a new FlagsListResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a FlagsListResponse. - * @implements IFlagsListResponse - * @constructor - * @param {google.cloud.sql.v1.IFlagsListResponse=} [properties] Properties to set - */ - function FlagsListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FlagsListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.FlagsListResponse - * @instance - */ - FlagsListResponse.prototype.kind = ""; - - /** - * FlagsListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1.FlagsListResponse - * @instance - */ - FlagsListResponse.prototype.items = $util.emptyArray; - - /** - * Creates a new FlagsListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.FlagsListResponse - * @static - * @param {google.cloud.sql.v1.IFlagsListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.FlagsListResponse} FlagsListResponse instance - */ - FlagsListResponse.create = function create(properties) { - return new FlagsListResponse(properties); - }; - - /** - * Encodes the specified FlagsListResponse message. Does not implicitly {@link google.cloud.sql.v1.FlagsListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.FlagsListResponse - * @static - * @param {google.cloud.sql.v1.IFlagsListResponse} message FlagsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FlagsListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1.Flag.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FlagsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.FlagsListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.FlagsListResponse - * @static - * @param {google.cloud.sql.v1.IFlagsListResponse} message FlagsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FlagsListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FlagsListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.FlagsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.FlagsListResponse} FlagsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FlagsListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.FlagsListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1.Flag.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FlagsListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.FlagsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.FlagsListResponse} FlagsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FlagsListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FlagsListResponse message. - * @function verify - * @memberof google.cloud.sql.v1.FlagsListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FlagsListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1.Flag.verify(message.items[i]); - if (error) - return "items." + error; - } - } - return null; - }; - - /** - * Creates a FlagsListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.FlagsListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.FlagsListResponse} FlagsListResponse - */ - FlagsListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.FlagsListResponse) - return object; - var message = new $root.google.cloud.sql.v1.FlagsListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1.FlagsListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1.FlagsListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1.Flag.fromObject(object.items[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a FlagsListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.FlagsListResponse - * @static - * @param {google.cloud.sql.v1.FlagsListResponse} message FlagsListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FlagsListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1.Flag.toObject(message.items[j], options); - } - return object; - }; - - /** - * Converts this FlagsListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.FlagsListResponse - * @instance - * @returns {Object.} JSON object - */ - FlagsListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FlagsListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.FlagsListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FlagsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.FlagsListResponse"; - }; - - return FlagsListResponse; - })(); - - v1.Flag = (function() { - - /** - * Properties of a Flag. - * @memberof google.cloud.sql.v1 - * @interface IFlag - * @property {string|null} [name] Flag name - * @property {google.cloud.sql.v1.SqlFlagType|null} [type] Flag type - * @property {Array.|null} [appliesTo] Flag appliesTo - * @property {Array.|null} [allowedStringValues] Flag allowedStringValues - * @property {google.protobuf.IInt64Value|null} [minValue] Flag minValue - * @property {google.protobuf.IInt64Value|null} [maxValue] Flag maxValue - * @property {google.protobuf.IBoolValue|null} [requiresRestart] Flag requiresRestart - * @property {string|null} [kind] Flag kind - * @property {google.protobuf.IBoolValue|null} [inBeta] Flag inBeta - * @property {Array.|null} [allowedIntValues] Flag allowedIntValues - * @property {google.cloud.sql.v1.SqlFlagScope|null} [flagScope] Flag flagScope - * @property {string|null} [recommendedStringValue] Flag recommendedStringValue - * @property {google.protobuf.IInt64Value|null} [recommendedIntValue] Flag recommendedIntValue - */ - - /** - * Constructs a new Flag. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a Flag. - * @implements IFlag - * @constructor - * @param {google.cloud.sql.v1.IFlag=} [properties] Properties to set - */ - function Flag(properties) { - this.appliesTo = []; - this.allowedStringValues = []; - this.allowedIntValues = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Flag name. - * @member {string} name - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.name = ""; - - /** - * Flag type. - * @member {google.cloud.sql.v1.SqlFlagType} type - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.type = 0; - - /** - * Flag appliesTo. - * @member {Array.} appliesTo - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.appliesTo = $util.emptyArray; - - /** - * Flag allowedStringValues. - * @member {Array.} allowedStringValues - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.allowedStringValues = $util.emptyArray; - - /** - * Flag minValue. - * @member {google.protobuf.IInt64Value|null|undefined} minValue - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.minValue = null; - - /** - * Flag maxValue. - * @member {google.protobuf.IInt64Value|null|undefined} maxValue - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.maxValue = null; - - /** - * Flag requiresRestart. - * @member {google.protobuf.IBoolValue|null|undefined} requiresRestart - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.requiresRestart = null; - - /** - * Flag kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.kind = ""; - - /** - * Flag inBeta. - * @member {google.protobuf.IBoolValue|null|undefined} inBeta - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.inBeta = null; - - /** - * Flag allowedIntValues. - * @member {Array.} allowedIntValues - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.allowedIntValues = $util.emptyArray; - - /** - * Flag flagScope. - * @member {google.cloud.sql.v1.SqlFlagScope} flagScope - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.flagScope = 0; - - /** - * Flag recommendedStringValue. - * @member {string|null|undefined} recommendedStringValue - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.recommendedStringValue = null; - - /** - * Flag recommendedIntValue. - * @member {google.protobuf.IInt64Value|null|undefined} recommendedIntValue - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Flag.prototype.recommendedIntValue = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Flag recommendedValue. - * @member {"recommendedStringValue"|"recommendedIntValue"|undefined} recommendedValue - * @memberof google.cloud.sql.v1.Flag - * @instance - */ - Object.defineProperty(Flag.prototype, "recommendedValue", { - get: $util.oneOfGetter($oneOfFields = ["recommendedStringValue", "recommendedIntValue"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Flag instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.Flag - * @static - * @param {google.cloud.sql.v1.IFlag=} [properties] Properties to set - * @returns {google.cloud.sql.v1.Flag} Flag instance - */ - Flag.create = function create(properties) { - return new Flag(properties); - }; - - /** - * Encodes the specified Flag message. Does not implicitly {@link google.cloud.sql.v1.Flag.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.Flag - * @static - * @param {google.cloud.sql.v1.IFlag} message Flag message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Flag.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); - if (message.appliesTo != null && message.appliesTo.length) { - writer.uint32(/* id 3, wireType 2 =*/26).fork(); - for (var i = 0; i < message.appliesTo.length; ++i) - writer.int32(message.appliesTo[i]); - writer.ldelim(); - } - if (message.allowedStringValues != null && message.allowedStringValues.length) - for (var i = 0; i < message.allowedStringValues.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.allowedStringValues[i]); - if (message.minValue != null && Object.hasOwnProperty.call(message, "minValue")) - $root.google.protobuf.Int64Value.encode(message.minValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.maxValue != null && Object.hasOwnProperty.call(message, "maxValue")) - $root.google.protobuf.Int64Value.encode(message.maxValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.requiresRestart != null && Object.hasOwnProperty.call(message, "requiresRestart")) - $root.google.protobuf.BoolValue.encode(message.requiresRestart, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.kind); - if (message.inBeta != null && Object.hasOwnProperty.call(message, "inBeta")) - $root.google.protobuf.BoolValue.encode(message.inBeta, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.allowedIntValues != null && message.allowedIntValues.length) { - writer.uint32(/* id 10, wireType 2 =*/82).fork(); - for (var i = 0; i < message.allowedIntValues.length; ++i) - writer.int64(message.allowedIntValues[i]); - writer.ldelim(); - } - if (message.flagScope != null && Object.hasOwnProperty.call(message, "flagScope")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.flagScope); - if (message.recommendedStringValue != null && Object.hasOwnProperty.call(message, "recommendedStringValue")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.recommendedStringValue); - if (message.recommendedIntValue != null && Object.hasOwnProperty.call(message, "recommendedIntValue")) - $root.google.protobuf.Int64Value.encode(message.recommendedIntValue, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Flag message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Flag.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.Flag - * @static - * @param {google.cloud.sql.v1.IFlag} message Flag message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Flag.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Flag message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.Flag - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.Flag} Flag - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Flag.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Flag(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.type = reader.int32(); - break; - } - case 3: { - if (!(message.appliesTo && message.appliesTo.length)) - message.appliesTo = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.appliesTo.push(reader.int32()); - } else - message.appliesTo.push(reader.int32()); - break; - } - case 4: { - if (!(message.allowedStringValues && message.allowedStringValues.length)) - message.allowedStringValues = []; - message.allowedStringValues.push(reader.string()); - break; - } - case 5: { - message.minValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 6: { - message.maxValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 7: { - message.requiresRestart = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 8: { - message.kind = reader.string(); - break; - } - case 9: { - message.inBeta = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 10: { - if (!(message.allowedIntValues && message.allowedIntValues.length)) - message.allowedIntValues = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.allowedIntValues.push(reader.int64()); - } else - message.allowedIntValues.push(reader.int64()); - break; - } - case 15: { - message.flagScope = reader.int32(); - break; - } - case 16: { - message.recommendedStringValue = reader.string(); - break; - } - case 17: { - message.recommendedIntValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Flag message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.Flag - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.Flag} Flag - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Flag.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Flag message. - * @function verify - * @memberof google.cloud.sql.v1.Flag - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Flag.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.appliesTo != null && message.hasOwnProperty("appliesTo")) { - if (!Array.isArray(message.appliesTo)) - return "appliesTo: array expected"; - for (var i = 0; i < message.appliesTo.length; ++i) - switch (message.appliesTo[i]) { - default: - return "appliesTo: enum value[] expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 684: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - case 549: - case 550: - case 551: - break; - } - } - if (message.allowedStringValues != null && message.hasOwnProperty("allowedStringValues")) { - if (!Array.isArray(message.allowedStringValues)) - return "allowedStringValues: array expected"; - for (var i = 0; i < message.allowedStringValues.length; ++i) - if (!$util.isString(message.allowedStringValues[i])) - return "allowedStringValues: string[] expected"; - } - if (message.minValue != null && message.hasOwnProperty("minValue")) { - var error = $root.google.protobuf.Int64Value.verify(message.minValue); - if (error) - return "minValue." + error; - } - if (message.maxValue != null && message.hasOwnProperty("maxValue")) { - var error = $root.google.protobuf.Int64Value.verify(message.maxValue); - if (error) - return "maxValue." + error; - } - if (message.requiresRestart != null && message.hasOwnProperty("requiresRestart")) { - var error = $root.google.protobuf.BoolValue.verify(message.requiresRestart); - if (error) - return "requiresRestart." + error; - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.inBeta != null && message.hasOwnProperty("inBeta")) { - var error = $root.google.protobuf.BoolValue.verify(message.inBeta); - if (error) - return "inBeta." + error; - } - if (message.allowedIntValues != null && message.hasOwnProperty("allowedIntValues")) { - if (!Array.isArray(message.allowedIntValues)) - return "allowedIntValues: array expected"; - for (var i = 0; i < message.allowedIntValues.length; ++i) - if (!$util.isInteger(message.allowedIntValues[i]) && !(message.allowedIntValues[i] && $util.isInteger(message.allowedIntValues[i].low) && $util.isInteger(message.allowedIntValues[i].high))) - return "allowedIntValues: integer|Long[] expected"; - } - if (message.flagScope != null && message.hasOwnProperty("flagScope")) - switch (message.flagScope) { - default: - return "flagScope: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.recommendedStringValue != null && message.hasOwnProperty("recommendedStringValue")) { - properties.recommendedValue = 1; - if (!$util.isString(message.recommendedStringValue)) - return "recommendedStringValue: string expected"; - } - if (message.recommendedIntValue != null && message.hasOwnProperty("recommendedIntValue")) { - if (properties.recommendedValue === 1) - return "recommendedValue: multiple values"; - properties.recommendedValue = 1; - { - var error = $root.google.protobuf.Int64Value.verify(message.recommendedIntValue); - if (error) - return "recommendedIntValue." + error; - } - } - return null; - }; - - /** - * Creates a Flag message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.Flag - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.Flag} Flag - */ - Flag.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.Flag) - return object; - var message = new $root.google.cloud.sql.v1.Flag(); - if (object.name != null) - message.name = String(object.name); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "SQL_FLAG_TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "BOOLEAN": - case 1: - message.type = 1; - break; - case "STRING": - case 2: - message.type = 2; - break; - case "INTEGER": - case 3: - message.type = 3; - break; - case "NONE": - case 4: - message.type = 4; - break; - case "MYSQL_TIMEZONE_OFFSET": - case 5: - message.type = 5; - break; - case "FLOAT": - case 6: - message.type = 6; - break; - case "REPEATED_STRING": - case 7: - message.type = 7; - break; - } - if (object.appliesTo) { - if (!Array.isArray(object.appliesTo)) - throw TypeError(".google.cloud.sql.v1.Flag.appliesTo: array expected"); - message.appliesTo = []; - for (var i = 0; i < object.appliesTo.length; ++i) - switch (object.appliesTo[i]) { - default: - if (typeof object.appliesTo[i] === "number") { - message.appliesTo[i] = object.appliesTo[i]; - break; - } - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.appliesTo[i] = 0; - break; - case "MYSQL_5_1": - case 2: - message.appliesTo[i] = 2; - break; - case "MYSQL_5_5": - case 3: - message.appliesTo[i] = 3; - break; - case "MYSQL_5_6": - case 5: - message.appliesTo[i] = 5; - break; - case "MYSQL_5_7": - case 6: - message.appliesTo[i] = 6; - break; - case "MYSQL_8_0": - case 20: - message.appliesTo[i] = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.appliesTo[i] = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.appliesTo[i] = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.appliesTo[i] = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.appliesTo[i] = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.appliesTo[i] = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.appliesTo[i] = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.appliesTo[i] = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.appliesTo[i] = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.appliesTo[i] = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.appliesTo[i] = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.appliesTo[i] = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.appliesTo[i] = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.appliesTo[i] = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.appliesTo[i] = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.appliesTo[i] = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.appliesTo[i] = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.appliesTo[i] = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.appliesTo[i] = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.appliesTo[i] = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.appliesTo[i] = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.appliesTo[i] = 556; - break; - case "MYSQL_8_4": - case 398: - message.appliesTo[i] = 398; - break; - case "MYSQL_9_7": - case 654: - message.appliesTo[i] = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.appliesTo[i] = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.appliesTo[i] = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.appliesTo[i] = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.appliesTo[i] = 16; - break; - case "POSTGRES_9_6": - case 9: - message.appliesTo[i] = 9; - break; - case "POSTGRES_10": - case 18: - message.appliesTo[i] = 18; - break; - case "POSTGRES_11": - case 10: - message.appliesTo[i] = 10; - break; - case "POSTGRES_12": - case 19: - message.appliesTo[i] = 19; - break; - case "POSTGRES_13": - case 23: - message.appliesTo[i] = 23; - break; - case "POSTGRES_14": - case 110: - message.appliesTo[i] = 110; - break; - case "POSTGRES_15": - case 172: - message.appliesTo[i] = 172; - break; - case "POSTGRES_16": - case 272: - message.appliesTo[i] = 272; - break; - case "POSTGRES_17": - case 408: - message.appliesTo[i] = 408; - break; - case "POSTGRES_18": - case 557: - message.appliesTo[i] = 557; - break; - case "POSTGRES_19": - case 684: - message.appliesTo[i] = 684; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.appliesTo[i] = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.appliesTo[i] = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.appliesTo[i] = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.appliesTo[i] = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.appliesTo[i] = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.appliesTo[i] = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.appliesTo[i] = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.appliesTo[i] = 202; - break; - case "SQLSERVER_2025_STANDARD": - case 549: - message.appliesTo[i] = 549; - break; - case "SQLSERVER_2025_ENTERPRISE": - case 550: - message.appliesTo[i] = 550; - break; - case "SQLSERVER_2025_EXPRESS": - case 551: - message.appliesTo[i] = 551; - break; - } - } - if (object.allowedStringValues) { - if (!Array.isArray(object.allowedStringValues)) - throw TypeError(".google.cloud.sql.v1.Flag.allowedStringValues: array expected"); - message.allowedStringValues = []; - for (var i = 0; i < object.allowedStringValues.length; ++i) - message.allowedStringValues[i] = String(object.allowedStringValues[i]); - } - if (object.minValue != null) { - if (typeof object.minValue !== "object") - throw TypeError(".google.cloud.sql.v1.Flag.minValue: object expected"); - message.minValue = $root.google.protobuf.Int64Value.fromObject(object.minValue); - } - if (object.maxValue != null) { - if (typeof object.maxValue !== "object") - throw TypeError(".google.cloud.sql.v1.Flag.maxValue: object expected"); - message.maxValue = $root.google.protobuf.Int64Value.fromObject(object.maxValue); - } - if (object.requiresRestart != null) { - if (typeof object.requiresRestart !== "object") - throw TypeError(".google.cloud.sql.v1.Flag.requiresRestart: object expected"); - message.requiresRestart = $root.google.protobuf.BoolValue.fromObject(object.requiresRestart); - } - if (object.kind != null) - message.kind = String(object.kind); - if (object.inBeta != null) { - if (typeof object.inBeta !== "object") - throw TypeError(".google.cloud.sql.v1.Flag.inBeta: object expected"); - message.inBeta = $root.google.protobuf.BoolValue.fromObject(object.inBeta); - } - if (object.allowedIntValues) { - if (!Array.isArray(object.allowedIntValues)) - throw TypeError(".google.cloud.sql.v1.Flag.allowedIntValues: array expected"); - message.allowedIntValues = []; - for (var i = 0; i < object.allowedIntValues.length; ++i) - if ($util.Long) - (message.allowedIntValues[i] = $util.Long.fromValue(object.allowedIntValues[i])).unsigned = false; - else if (typeof object.allowedIntValues[i] === "string") - message.allowedIntValues[i] = parseInt(object.allowedIntValues[i], 10); - else if (typeof object.allowedIntValues[i] === "number") - message.allowedIntValues[i] = object.allowedIntValues[i]; - else if (typeof object.allowedIntValues[i] === "object") - message.allowedIntValues[i] = new $util.LongBits(object.allowedIntValues[i].low >>> 0, object.allowedIntValues[i].high >>> 0).toNumber(); - } - switch (object.flagScope) { - default: - if (typeof object.flagScope === "number") { - message.flagScope = object.flagScope; - break; - } - break; - case "SQL_FLAG_SCOPE_UNSPECIFIED": - case 0: - message.flagScope = 0; - break; - case "SQL_FLAG_SCOPE_DATABASE": - case 1: - message.flagScope = 1; - break; - case "SQL_FLAG_SCOPE_CONNECTION_POOL": - case 2: - message.flagScope = 2; - break; - } - if (object.recommendedStringValue != null) - message.recommendedStringValue = String(object.recommendedStringValue); - if (object.recommendedIntValue != null) { - if (typeof object.recommendedIntValue !== "object") - throw TypeError(".google.cloud.sql.v1.Flag.recommendedIntValue: object expected"); - message.recommendedIntValue = $root.google.protobuf.Int64Value.fromObject(object.recommendedIntValue); - } - return message; - }; - - /** - * Creates a plain object from a Flag message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.Flag - * @static - * @param {google.cloud.sql.v1.Flag} message Flag - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Flag.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.appliesTo = []; - object.allowedStringValues = []; - object.allowedIntValues = []; - } - if (options.defaults) { - object.name = ""; - object.type = options.enums === String ? "SQL_FLAG_TYPE_UNSPECIFIED" : 0; - object.minValue = null; - object.maxValue = null; - object.requiresRestart = null; - object.kind = ""; - object.inBeta = null; - object.flagScope = options.enums === String ? "SQL_FLAG_SCOPE_UNSPECIFIED" : 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1.SqlFlagType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.SqlFlagType[message.type] : message.type; - if (message.appliesTo && message.appliesTo.length) { - object.appliesTo = []; - for (var j = 0; j < message.appliesTo.length; ++j) - object.appliesTo[j] = options.enums === String ? $root.google.cloud.sql.v1.SqlDatabaseVersion[message.appliesTo[j]] === undefined ? message.appliesTo[j] : $root.google.cloud.sql.v1.SqlDatabaseVersion[message.appliesTo[j]] : message.appliesTo[j]; - } - if (message.allowedStringValues && message.allowedStringValues.length) { - object.allowedStringValues = []; - for (var j = 0; j < message.allowedStringValues.length; ++j) - object.allowedStringValues[j] = message.allowedStringValues[j]; - } - if (message.minValue != null && message.hasOwnProperty("minValue")) - object.minValue = $root.google.protobuf.Int64Value.toObject(message.minValue, options); - if (message.maxValue != null && message.hasOwnProperty("maxValue")) - object.maxValue = $root.google.protobuf.Int64Value.toObject(message.maxValue, options); - if (message.requiresRestart != null && message.hasOwnProperty("requiresRestart")) - object.requiresRestart = $root.google.protobuf.BoolValue.toObject(message.requiresRestart, options); - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.inBeta != null && message.hasOwnProperty("inBeta")) - object.inBeta = $root.google.protobuf.BoolValue.toObject(message.inBeta, options); - if (message.allowedIntValues && message.allowedIntValues.length) { - object.allowedIntValues = []; - for (var j = 0; j < message.allowedIntValues.length; ++j) - if (typeof message.allowedIntValues[j] === "number") - object.allowedIntValues[j] = options.longs === String ? String(message.allowedIntValues[j]) : message.allowedIntValues[j]; - else - object.allowedIntValues[j] = options.longs === String ? $util.Long.prototype.toString.call(message.allowedIntValues[j]) : options.longs === Number ? new $util.LongBits(message.allowedIntValues[j].low >>> 0, message.allowedIntValues[j].high >>> 0).toNumber() : message.allowedIntValues[j]; - } - if (message.flagScope != null && message.hasOwnProperty("flagScope")) - object.flagScope = options.enums === String ? $root.google.cloud.sql.v1.SqlFlagScope[message.flagScope] === undefined ? message.flagScope : $root.google.cloud.sql.v1.SqlFlagScope[message.flagScope] : message.flagScope; - if (message.recommendedStringValue != null && message.hasOwnProperty("recommendedStringValue")) { - object.recommendedStringValue = message.recommendedStringValue; - if (options.oneofs) - object.recommendedValue = "recommendedStringValue"; - } - if (message.recommendedIntValue != null && message.hasOwnProperty("recommendedIntValue")) { - object.recommendedIntValue = $root.google.protobuf.Int64Value.toObject(message.recommendedIntValue, options); - if (options.oneofs) - object.recommendedValue = "recommendedIntValue"; - } - return object; - }; - - /** - * Converts this Flag to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.Flag - * @instance - * @returns {Object.} JSON object - */ - Flag.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Flag - * @function getTypeUrl - * @memberof google.cloud.sql.v1.Flag - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Flag.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.Flag"; - }; - - return Flag; - })(); - - /** - * SqlFlagType enum. - * @name google.cloud.sql.v1.SqlFlagType - * @enum {number} - * @property {number} SQL_FLAG_TYPE_UNSPECIFIED=0 SQL_FLAG_TYPE_UNSPECIFIED value - * @property {number} BOOLEAN=1 BOOLEAN value - * @property {number} STRING=2 STRING value - * @property {number} INTEGER=3 INTEGER value - * @property {number} NONE=4 NONE value - * @property {number} MYSQL_TIMEZONE_OFFSET=5 MYSQL_TIMEZONE_OFFSET value - * @property {number} FLOAT=6 FLOAT value - * @property {number} REPEATED_STRING=7 REPEATED_STRING value - */ - v1.SqlFlagType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_FLAG_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "BOOLEAN"] = 1; - values[valuesById[2] = "STRING"] = 2; - values[valuesById[3] = "INTEGER"] = 3; - values[valuesById[4] = "NONE"] = 4; - values[valuesById[5] = "MYSQL_TIMEZONE_OFFSET"] = 5; - values[valuesById[6] = "FLOAT"] = 6; - values[valuesById[7] = "REPEATED_STRING"] = 7; - return values; - })(); - - /** - * SqlFlagScope enum. - * @name google.cloud.sql.v1.SqlFlagScope - * @enum {number} - * @property {number} SQL_FLAG_SCOPE_UNSPECIFIED=0 SQL_FLAG_SCOPE_UNSPECIFIED value - * @property {number} SQL_FLAG_SCOPE_DATABASE=1 SQL_FLAG_SCOPE_DATABASE value - * @property {number} SQL_FLAG_SCOPE_CONNECTION_POOL=2 SQL_FLAG_SCOPE_CONNECTION_POOL value - */ - v1.SqlFlagScope = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_FLAG_SCOPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SQL_FLAG_SCOPE_DATABASE"] = 1; - values[valuesById[2] = "SQL_FLAG_SCOPE_CONNECTION_POOL"] = 2; - return values; - })(); - - v1.SqlIamPoliciesService = (function() { - - /** - * Constructs a new SqlIamPoliciesService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlIamPoliciesService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlIamPoliciesService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlIamPoliciesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlIamPoliciesService; - - /** - * Creates new SqlIamPoliciesService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlIamPoliciesService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlIamPoliciesService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlIamPoliciesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - return SqlIamPoliciesService; - })(); - - v1.SqlInstanceNamesService = (function() { - - /** - * Constructs a new SqlInstanceNamesService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlInstanceNamesService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlInstanceNamesService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlInstanceNamesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlInstanceNamesService; - - /** - * Creates new SqlInstanceNamesService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlInstanceNamesService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlInstanceNamesService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlInstanceNamesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - return SqlInstanceNamesService; - })(); - - v1.SqlOperationsService = (function() { - - /** - * Constructs a new SqlOperationsService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlOperationsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlOperationsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlOperationsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlOperationsService; - - /** - * Creates new SqlOperationsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlOperationsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlOperationsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlOperationsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|get}. - * @memberof google.cloud.sql.v1.SqlOperationsService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1.ISqlOperationsGetRequest} request SqlOperationsGetRequest message or plain object - * @param {google.cloud.sql.v1.SqlOperationsService.GetCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlOperationsService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1.SqlOperationsGetRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1.ISqlOperationsGetRequest} request SqlOperationsGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|list}. - * @memberof google.cloud.sql.v1.SqlOperationsService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.OperationsListResponse} [response] OperationsListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1.ISqlOperationsListRequest} request SqlOperationsListRequest message or plain object - * @param {google.cloud.sql.v1.SqlOperationsService.ListCallback} callback Node-style callback called with the error, if any, and OperationsListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlOperationsService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1.SqlOperationsListRequest, $root.google.cloud.sql.v1.OperationsListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1.ISqlOperationsListRequest} request SqlOperationsListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlOperationsService|cancel}. - * @memberof google.cloud.sql.v1.SqlOperationsService - * @typedef CancelCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls Cancel. - * @function cancel - * @memberof google.cloud.sql.v1.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest} request SqlOperationsCancelRequest message or plain object - * @param {google.cloud.sql.v1.SqlOperationsService.CancelCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlOperationsService.prototype.cancel = function cancel(request, callback) { - return this.rpcCall(cancel, $root.google.cloud.sql.v1.SqlOperationsCancelRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "Cancel" }); - - /** - * Calls Cancel. - * @function cancel - * @memberof google.cloud.sql.v1.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest} request SqlOperationsCancelRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlOperationsService; - })(); - - v1.SqlOperationsGetRequest = (function() { - - /** - * Properties of a SqlOperationsGetRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlOperationsGetRequest - * @property {string|null} [operation] SqlOperationsGetRequest operation - * @property {string|null} [project] SqlOperationsGetRequest project - */ - - /** - * Constructs a new SqlOperationsGetRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlOperationsGetRequest. - * @implements ISqlOperationsGetRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlOperationsGetRequest=} [properties] Properties to set - */ - function SqlOperationsGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlOperationsGetRequest operation. - * @member {string} operation - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @instance - */ - SqlOperationsGetRequest.prototype.operation = ""; - - /** - * SqlOperationsGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @instance - */ - SqlOperationsGetRequest.prototype.project = ""; - - /** - * Creates a new SqlOperationsGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlOperationsGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlOperationsGetRequest} SqlOperationsGetRequest instance - */ - SqlOperationsGetRequest.create = function create(properties) { - return new SqlOperationsGetRequest(properties); - }; - - /** - * Encodes the specified SqlOperationsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlOperationsGetRequest} message SqlOperationsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.operation); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlOperationsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlOperationsGetRequest} message SqlOperationsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlOperationsGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlOperationsGetRequest} SqlOperationsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlOperationsGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.operation = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlOperationsGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlOperationsGetRequest} SqlOperationsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlOperationsGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlOperationsGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.operation != null && message.hasOwnProperty("operation")) - if (!$util.isString(message.operation)) - return "operation: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlOperationsGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlOperationsGetRequest} SqlOperationsGetRequest - */ - SqlOperationsGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlOperationsGetRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlOperationsGetRequest(); - if (object.operation != null) - message.operation = String(object.operation); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlOperationsGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @static - * @param {google.cloud.sql.v1.SqlOperationsGetRequest} message SqlOperationsGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlOperationsGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.operation = ""; - object.project = ""; - } - if (message.operation != null && message.hasOwnProperty("operation")) - object.operation = message.operation; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlOperationsGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlOperationsGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlOperationsGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlOperationsGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlOperationsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlOperationsGetRequest"; - }; - - return SqlOperationsGetRequest; - })(); - - v1.SqlOperationsListRequest = (function() { - - /** - * Properties of a SqlOperationsListRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlOperationsListRequest - * @property {string|null} [instance] SqlOperationsListRequest instance - * @property {number|null} [maxResults] SqlOperationsListRequest maxResults - * @property {string|null} [pageToken] SqlOperationsListRequest pageToken - * @property {string|null} [project] SqlOperationsListRequest project - */ - - /** - * Constructs a new SqlOperationsListRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlOperationsListRequest. - * @implements ISqlOperationsListRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlOperationsListRequest=} [properties] Properties to set - */ - function SqlOperationsListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlOperationsListRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @instance - */ - SqlOperationsListRequest.prototype.instance = ""; - - /** - * SqlOperationsListRequest maxResults. - * @member {number} maxResults - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @instance - */ - SqlOperationsListRequest.prototype.maxResults = 0; - - /** - * SqlOperationsListRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @instance - */ - SqlOperationsListRequest.prototype.pageToken = ""; - - /** - * SqlOperationsListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @instance - */ - SqlOperationsListRequest.prototype.project = ""; - - /** - * Creates a new SqlOperationsListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlOperationsListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlOperationsListRequest} SqlOperationsListRequest instance - */ - SqlOperationsListRequest.create = function create(properties) { - return new SqlOperationsListRequest(properties); - }; - - /** - * Encodes the specified SqlOperationsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlOperationsListRequest} message SqlOperationsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.maxResults); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlOperationsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlOperationsListRequest} message SqlOperationsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlOperationsListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlOperationsListRequest} SqlOperationsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlOperationsListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.maxResults = reader.uint32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlOperationsListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlOperationsListRequest} SqlOperationsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlOperationsListRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlOperationsListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlOperationsListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlOperationsListRequest} SqlOperationsListRequest - */ - SqlOperationsListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlOperationsListRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlOperationsListRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.maxResults != null) - message.maxResults = object.maxResults >>> 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlOperationsListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @static - * @param {google.cloud.sql.v1.SqlOperationsListRequest} message SqlOperationsListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlOperationsListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.maxResults = 0; - object.pageToken = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlOperationsListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlOperationsListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlOperationsListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlOperationsListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlOperationsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlOperationsListRequest"; - }; - - return SqlOperationsListRequest; - })(); - - v1.OperationsListResponse = (function() { - - /** - * Properties of an OperationsListResponse. - * @memberof google.cloud.sql.v1 - * @interface IOperationsListResponse - * @property {string|null} [kind] OperationsListResponse kind - * @property {Array.|null} [items] OperationsListResponse items - * @property {string|null} [nextPageToken] OperationsListResponse nextPageToken - */ - - /** - * Constructs a new OperationsListResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents an OperationsListResponse. - * @implements IOperationsListResponse - * @constructor - * @param {google.cloud.sql.v1.IOperationsListResponse=} [properties] Properties to set - */ - function OperationsListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OperationsListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.OperationsListResponse - * @instance - */ - OperationsListResponse.prototype.kind = ""; - - /** - * OperationsListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1.OperationsListResponse - * @instance - */ - OperationsListResponse.prototype.items = $util.emptyArray; - - /** - * OperationsListResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.sql.v1.OperationsListResponse - * @instance - */ - OperationsListResponse.prototype.nextPageToken = ""; - - /** - * Creates a new OperationsListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.OperationsListResponse - * @static - * @param {google.cloud.sql.v1.IOperationsListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.OperationsListResponse} OperationsListResponse instance - */ - OperationsListResponse.create = function create(properties) { - return new OperationsListResponse(properties); - }; - - /** - * Encodes the specified OperationsListResponse message. Does not implicitly {@link google.cloud.sql.v1.OperationsListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.OperationsListResponse - * @static - * @param {google.cloud.sql.v1.IOperationsListResponse} message OperationsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationsListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1.Operation.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified OperationsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.OperationsListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.OperationsListResponse - * @static - * @param {google.cloud.sql.v1.IOperationsListResponse} message OperationsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationsListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationsListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.OperationsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.OperationsListResponse} OperationsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationsListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.OperationsListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1.Operation.decode(reader, reader.uint32())); - break; - } - case 3: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationsListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.OperationsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.OperationsListResponse} OperationsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationsListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationsListResponse message. - * @function verify - * @memberof google.cloud.sql.v1.OperationsListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OperationsListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1.Operation.verify(message.items[i]); - if (error) - return "items." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates an OperationsListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.OperationsListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.OperationsListResponse} OperationsListResponse - */ - OperationsListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.OperationsListResponse) - return object; - var message = new $root.google.cloud.sql.v1.OperationsListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1.OperationsListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1.OperationsListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1.Operation.fromObject(object.items[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from an OperationsListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.OperationsListResponse - * @static - * @param {google.cloud.sql.v1.OperationsListResponse} message OperationsListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationsListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) { - object.kind = ""; - object.nextPageToken = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1.Operation.toObject(message.items[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this OperationsListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.OperationsListResponse - * @instance - * @returns {Object.} JSON object - */ - OperationsListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationsListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.OperationsListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.OperationsListResponse"; - }; - - return OperationsListResponse; - })(); - - v1.SqlOperationsCancelRequest = (function() { - - /** - * Properties of a SqlOperationsCancelRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlOperationsCancelRequest - * @property {string|null} [operation] SqlOperationsCancelRequest operation - * @property {string|null} [project] SqlOperationsCancelRequest project - */ - - /** - * Constructs a new SqlOperationsCancelRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlOperationsCancelRequest. - * @implements ISqlOperationsCancelRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest=} [properties] Properties to set - */ - function SqlOperationsCancelRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlOperationsCancelRequest operation. - * @member {string} operation - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @instance - */ - SqlOperationsCancelRequest.prototype.operation = ""; - - /** - * SqlOperationsCancelRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @instance - */ - SqlOperationsCancelRequest.prototype.project = ""; - - /** - * Creates a new SqlOperationsCancelRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @static - * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlOperationsCancelRequest} SqlOperationsCancelRequest instance - */ - SqlOperationsCancelRequest.create = function create(properties) { - return new SqlOperationsCancelRequest(properties); - }; - - /** - * Encodes the specified SqlOperationsCancelRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsCancelRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @static - * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest} message SqlOperationsCancelRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsCancelRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.operation); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlOperationsCancelRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlOperationsCancelRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @static - * @param {google.cloud.sql.v1.ISqlOperationsCancelRequest} message SqlOperationsCancelRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsCancelRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlOperationsCancelRequest} SqlOperationsCancelRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsCancelRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlOperationsCancelRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.operation = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlOperationsCancelRequest} SqlOperationsCancelRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsCancelRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlOperationsCancelRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlOperationsCancelRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.operation != null && message.hasOwnProperty("operation")) - if (!$util.isString(message.operation)) - return "operation: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlOperationsCancelRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlOperationsCancelRequest} SqlOperationsCancelRequest - */ - SqlOperationsCancelRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlOperationsCancelRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlOperationsCancelRequest(); - if (object.operation != null) - message.operation = String(object.operation); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlOperationsCancelRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @static - * @param {google.cloud.sql.v1.SqlOperationsCancelRequest} message SqlOperationsCancelRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlOperationsCancelRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.operation = ""; - object.project = ""; - } - if (message.operation != null && message.hasOwnProperty("operation")) - object.operation = message.operation; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlOperationsCancelRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @instance - * @returns {Object.} JSON object - */ - SqlOperationsCancelRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlOperationsCancelRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlOperationsCancelRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlOperationsCancelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlOperationsCancelRequest"; - }; - - return SqlOperationsCancelRequest; - })(); - - v1.SqlRegionsService = (function() { - - /** - * Constructs a new SqlRegionsService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlRegionsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlRegionsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlRegionsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlRegionsService; - - /** - * Creates new SqlRegionsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlRegionsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlRegionsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlRegionsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - return SqlRegionsService; - })(); - - v1.SqlSslCertsService = (function() { - - /** - * Constructs a new SqlSslCertsService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlSslCertsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlSslCertsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlSslCertsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlSslCertsService; - - /** - * Creates new SqlSslCertsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlSslCertsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlSslCertsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|delete_}. - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @typedef DeleteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest} request SqlSslCertsDeleteRequest message or plain object - * @param {google.cloud.sql.v1.SqlSslCertsService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlSslCertsService.prototype["delete"] = function delete_(request, callback) { - return this.rpcCall(delete_, $root.google.cloud.sql.v1.SqlSslCertsDeleteRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Delete" }); - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest} request SqlSslCertsDeleteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|get}. - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.SslCert} [response] SslCert - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest} request SqlSslCertsGetRequest message or plain object - * @param {google.cloud.sql.v1.SqlSslCertsService.GetCallback} callback Node-style callback called with the error, if any, and SslCert - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlSslCertsService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1.SqlSslCertsGetRequest, $root.google.cloud.sql.v1.SslCert, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest} request SqlSslCertsGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|insert}. - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @typedef InsertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.SslCertsInsertResponse} [response] SslCertsInsertResponse - */ - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest} request SqlSslCertsInsertRequest message or plain object - * @param {google.cloud.sql.v1.SqlSslCertsService.InsertCallback} callback Node-style callback called with the error, if any, and SslCertsInsertResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlSslCertsService.prototype.insert = function insert(request, callback) { - return this.rpcCall(insert, $root.google.cloud.sql.v1.SqlSslCertsInsertRequest, $root.google.cloud.sql.v1.SslCertsInsertResponse, request, callback); - }, "name", { value: "Insert" }); - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest} request SqlSslCertsInsertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlSslCertsService|list}. - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.SslCertsListResponse} [response] SslCertsListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1.ISqlSslCertsListRequest} request SqlSslCertsListRequest message or plain object - * @param {google.cloud.sql.v1.SqlSslCertsService.ListCallback} callback Node-style callback called with the error, if any, and SslCertsListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlSslCertsService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1.SqlSslCertsListRequest, $root.google.cloud.sql.v1.SslCertsListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1.ISqlSslCertsListRequest} request SqlSslCertsListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlSslCertsService; - })(); - - v1.SqlSslCertsDeleteRequest = (function() { - - /** - * Properties of a SqlSslCertsDeleteRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlSslCertsDeleteRequest - * @property {string|null} [instance] SqlSslCertsDeleteRequest instance - * @property {string|null} [project] SqlSslCertsDeleteRequest project - * @property {string|null} [sha1Fingerprint] SqlSslCertsDeleteRequest sha1Fingerprint - */ - - /** - * Constructs a new SqlSslCertsDeleteRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlSslCertsDeleteRequest. - * @implements ISqlSslCertsDeleteRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest=} [properties] Properties to set - */ - function SqlSslCertsDeleteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlSslCertsDeleteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @instance - */ - SqlSslCertsDeleteRequest.prototype.instance = ""; - - /** - * SqlSslCertsDeleteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @instance - */ - SqlSslCertsDeleteRequest.prototype.project = ""; - - /** - * SqlSslCertsDeleteRequest sha1Fingerprint. - * @member {string} sha1Fingerprint - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @instance - */ - SqlSslCertsDeleteRequest.prototype.sha1Fingerprint = ""; - - /** - * Creates a new SqlSslCertsDeleteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest instance - */ - SqlSslCertsDeleteRequest.create = function create(properties) { - return new SqlSslCertsDeleteRequest(properties); - }; - - /** - * Encodes the specified SqlSslCertsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsDeleteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsDeleteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.sha1Fingerprint); - return writer; - }; - - /** - * Encodes the specified SqlSslCertsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsDeleteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsDeleteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlSslCertsDeleteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.sha1Fingerprint = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsDeleteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlSslCertsDeleteRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlSslCertsDeleteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - if (!$util.isString(message.sha1Fingerprint)) - return "sha1Fingerprint: string expected"; - return null; - }; - - /** - * Creates a SqlSslCertsDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest - */ - SqlSslCertsDeleteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlSslCertsDeleteRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlSslCertsDeleteRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.sha1Fingerprint != null) - message.sha1Fingerprint = String(object.sha1Fingerprint); - return message; - }; - - /** - * Creates a plain object from a SqlSslCertsDeleteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @static - * @param {google.cloud.sql.v1.SqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlSslCertsDeleteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.sha1Fingerprint = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - object.sha1Fingerprint = message.sha1Fingerprint; - return object; - }; - - /** - * Converts this SqlSslCertsDeleteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlSslCertsDeleteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlSslCertsDeleteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlSslCertsDeleteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlSslCertsDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlSslCertsDeleteRequest"; - }; - - return SqlSslCertsDeleteRequest; - })(); - - v1.SqlSslCertsGetRequest = (function() { - - /** - * Properties of a SqlSslCertsGetRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlSslCertsGetRequest - * @property {string|null} [instance] SqlSslCertsGetRequest instance - * @property {string|null} [project] SqlSslCertsGetRequest project - * @property {string|null} [sha1Fingerprint] SqlSslCertsGetRequest sha1Fingerprint - */ - - /** - * Constructs a new SqlSslCertsGetRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlSslCertsGetRequest. - * @implements ISqlSslCertsGetRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest=} [properties] Properties to set - */ - function SqlSslCertsGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlSslCertsGetRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @instance - */ - SqlSslCertsGetRequest.prototype.instance = ""; - - /** - * SqlSslCertsGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @instance - */ - SqlSslCertsGetRequest.prototype.project = ""; - - /** - * SqlSslCertsGetRequest sha1Fingerprint. - * @member {string} sha1Fingerprint - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @instance - */ - SqlSslCertsGetRequest.prototype.sha1Fingerprint = ""; - - /** - * Creates a new SqlSslCertsGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlSslCertsGetRequest} SqlSslCertsGetRequest instance - */ - SqlSslCertsGetRequest.create = function create(properties) { - return new SqlSslCertsGetRequest(properties); - }; - - /** - * Encodes the specified SqlSslCertsGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest} message SqlSslCertsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.sha1Fingerprint); - return writer; - }; - - /** - * Encodes the specified SqlSslCertsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsGetRequest} message SqlSslCertsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlSslCertsGetRequest} SqlSslCertsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlSslCertsGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.sha1Fingerprint = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlSslCertsGetRequest} SqlSslCertsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlSslCertsGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlSslCertsGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - if (!$util.isString(message.sha1Fingerprint)) - return "sha1Fingerprint: string expected"; - return null; - }; - - /** - * Creates a SqlSslCertsGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlSslCertsGetRequest} SqlSslCertsGetRequest - */ - SqlSslCertsGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlSslCertsGetRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlSslCertsGetRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.sha1Fingerprint != null) - message.sha1Fingerprint = String(object.sha1Fingerprint); - return message; - }; - - /** - * Creates a plain object from a SqlSslCertsGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @static - * @param {google.cloud.sql.v1.SqlSslCertsGetRequest} message SqlSslCertsGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlSslCertsGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.sha1Fingerprint = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - object.sha1Fingerprint = message.sha1Fingerprint; - return object; - }; - - /** - * Converts this SqlSslCertsGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlSslCertsGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlSslCertsGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlSslCertsGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlSslCertsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlSslCertsGetRequest"; - }; - - return SqlSslCertsGetRequest; - })(); - - v1.SqlSslCertsInsertRequest = (function() { - - /** - * Properties of a SqlSslCertsInsertRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlSslCertsInsertRequest - * @property {string|null} [instance] SqlSslCertsInsertRequest instance - * @property {string|null} [project] SqlSslCertsInsertRequest project - * @property {google.cloud.sql.v1.ISslCertsInsertRequest|null} [body] SqlSslCertsInsertRequest body - */ - - /** - * Constructs a new SqlSslCertsInsertRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlSslCertsInsertRequest. - * @implements ISqlSslCertsInsertRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest=} [properties] Properties to set - */ - function SqlSslCertsInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlSslCertsInsertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @instance - */ - SqlSslCertsInsertRequest.prototype.instance = ""; - - /** - * SqlSslCertsInsertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @instance - */ - SqlSslCertsInsertRequest.prototype.project = ""; - - /** - * SqlSslCertsInsertRequest body. - * @member {google.cloud.sql.v1.ISslCertsInsertRequest|null|undefined} body - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @instance - */ - SqlSslCertsInsertRequest.prototype.body = null; - - /** - * Creates a new SqlSslCertsInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest instance - */ - SqlSslCertsInsertRequest.create = function create(properties) { - return new SqlSslCertsInsertRequest(properties); - }; - - /** - * Encodes the specified SqlSslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest} message SqlSslCertsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.SslCertsInsertRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlSslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsInsertRequest} message SqlSslCertsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlSslCertsInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.SslCertsInsertRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlSslCertsInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlSslCertsInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.SslCertsInsertRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlSslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest - */ - SqlSslCertsInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlSslCertsInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlSslCertsInsertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlSslCertsInsertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.SslCertsInsertRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlSslCertsInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1.SqlSslCertsInsertRequest} message SqlSslCertsInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlSslCertsInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.SslCertsInsertRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlSslCertsInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlSslCertsInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlSslCertsInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlSslCertsInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlSslCertsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlSslCertsInsertRequest"; - }; - - return SqlSslCertsInsertRequest; - })(); - - v1.SqlSslCertsListRequest = (function() { - - /** - * Properties of a SqlSslCertsListRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlSslCertsListRequest - * @property {string|null} [instance] SqlSslCertsListRequest instance - * @property {string|null} [project] SqlSslCertsListRequest project - */ - - /** - * Constructs a new SqlSslCertsListRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlSslCertsListRequest. - * @implements ISqlSslCertsListRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlSslCertsListRequest=} [properties] Properties to set - */ - function SqlSslCertsListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlSslCertsListRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @instance - */ - SqlSslCertsListRequest.prototype.instance = ""; - - /** - * SqlSslCertsListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @instance - */ - SqlSslCertsListRequest.prototype.project = ""; - - /** - * Creates a new SqlSslCertsListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlSslCertsListRequest} SqlSslCertsListRequest instance - */ - SqlSslCertsListRequest.create = function create(properties) { - return new SqlSslCertsListRequest(properties); - }; - - /** - * Encodes the specified SqlSslCertsListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsListRequest} message SqlSslCertsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlSslCertsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlSslCertsListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @static - * @param {google.cloud.sql.v1.ISqlSslCertsListRequest} message SqlSslCertsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlSslCertsListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlSslCertsListRequest} SqlSslCertsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlSslCertsListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlSslCertsListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlSslCertsListRequest} SqlSslCertsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlSslCertsListRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlSslCertsListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlSslCertsListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlSslCertsListRequest} SqlSslCertsListRequest - */ - SqlSslCertsListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlSslCertsListRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlSslCertsListRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlSslCertsListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @static - * @param {google.cloud.sql.v1.SqlSslCertsListRequest} message SqlSslCertsListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlSslCertsListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlSslCertsListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlSslCertsListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlSslCertsListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlSslCertsListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlSslCertsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlSslCertsListRequest"; - }; - - return SqlSslCertsListRequest; - })(); - - v1.SslCertsInsertRequest = (function() { - - /** - * Properties of a SslCertsInsertRequest. - * @memberof google.cloud.sql.v1 - * @interface ISslCertsInsertRequest - * @property {string|null} [commonName] SslCertsInsertRequest commonName - */ - - /** - * Constructs a new SslCertsInsertRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SslCertsInsertRequest. - * @implements ISslCertsInsertRequest - * @constructor - * @param {google.cloud.sql.v1.ISslCertsInsertRequest=} [properties] Properties to set - */ - function SslCertsInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCertsInsertRequest commonName. - * @member {string} commonName - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @instance - */ - SslCertsInsertRequest.prototype.commonName = ""; - - /** - * Creates a new SslCertsInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1.ISslCertsInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SslCertsInsertRequest} SslCertsInsertRequest instance - */ - SslCertsInsertRequest.create = function create(properties) { - return new SslCertsInsertRequest(properties); - }; - - /** - * Encodes the specified SslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1.ISslCertsInsertRequest} message SslCertsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.commonName != null && Object.hasOwnProperty.call(message, "commonName")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.commonName); - return writer; - }; - - /** - * Encodes the specified SslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1.ISslCertsInsertRequest} message SslCertsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCertsInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SslCertsInsertRequest} SslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCertsInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.commonName = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCertsInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SslCertsInsertRequest} SslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCertsInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCertsInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.commonName != null && message.hasOwnProperty("commonName")) - if (!$util.isString(message.commonName)) - return "commonName: string expected"; - return null; - }; - - /** - * Creates a SslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SslCertsInsertRequest} SslCertsInsertRequest - */ - SslCertsInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SslCertsInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1.SslCertsInsertRequest(); - if (object.commonName != null) - message.commonName = String(object.commonName); - return message; - }; - - /** - * Creates a plain object from a SslCertsInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1.SslCertsInsertRequest} message SslCertsInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCertsInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.commonName = ""; - if (message.commonName != null && message.hasOwnProperty("commonName")) - object.commonName = message.commonName; - return object; - }; - - /** - * Converts this SslCertsInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SslCertsInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCertsInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SslCertsInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCertsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SslCertsInsertRequest"; - }; - - return SslCertsInsertRequest; - })(); - - v1.SslCertsInsertResponse = (function() { - - /** - * Properties of a SslCertsInsertResponse. - * @memberof google.cloud.sql.v1 - * @interface ISslCertsInsertResponse - * @property {string|null} [kind] SslCertsInsertResponse kind - * @property {google.cloud.sql.v1.IOperation|null} [operation] SslCertsInsertResponse operation - * @property {google.cloud.sql.v1.ISslCert|null} [serverCaCert] SslCertsInsertResponse serverCaCert - * @property {google.cloud.sql.v1.ISslCertDetail|null} [clientCert] SslCertsInsertResponse clientCert - */ - - /** - * Constructs a new SslCertsInsertResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SslCertsInsertResponse. - * @implements ISslCertsInsertResponse - * @constructor - * @param {google.cloud.sql.v1.ISslCertsInsertResponse=} [properties] Properties to set - */ - function SslCertsInsertResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCertsInsertResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @instance - */ - SslCertsInsertResponse.prototype.kind = ""; - - /** - * SslCertsInsertResponse operation. - * @member {google.cloud.sql.v1.IOperation|null|undefined} operation - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @instance - */ - SslCertsInsertResponse.prototype.operation = null; - - /** - * SslCertsInsertResponse serverCaCert. - * @member {google.cloud.sql.v1.ISslCert|null|undefined} serverCaCert - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @instance - */ - SslCertsInsertResponse.prototype.serverCaCert = null; - - /** - * SslCertsInsertResponse clientCert. - * @member {google.cloud.sql.v1.ISslCertDetail|null|undefined} clientCert - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @instance - */ - SslCertsInsertResponse.prototype.clientCert = null; - - /** - * Creates a new SslCertsInsertResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @static - * @param {google.cloud.sql.v1.ISslCertsInsertResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SslCertsInsertResponse} SslCertsInsertResponse instance - */ - SslCertsInsertResponse.create = function create(properties) { - return new SslCertsInsertResponse(properties); - }; - - /** - * Encodes the specified SslCertsInsertResponse message. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @static - * @param {google.cloud.sql.v1.ISslCertsInsertResponse} message SslCertsInsertResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsInsertResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) - $root.google.cloud.sql.v1.Operation.encode(message.operation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) - $root.google.cloud.sql.v1.SslCert.encode(message.serverCaCert, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.clientCert != null && Object.hasOwnProperty.call(message, "clientCert")) - $root.google.cloud.sql.v1.SslCertDetail.encode(message.clientCert, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SslCertsInsertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsInsertResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @static - * @param {google.cloud.sql.v1.ISslCertsInsertResponse} message SslCertsInsertResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsInsertResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCertsInsertResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SslCertsInsertResponse} SslCertsInsertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsInsertResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCertsInsertResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.operation = $root.google.cloud.sql.v1.Operation.decode(reader, reader.uint32()); - break; - } - case 3: { - message.serverCaCert = $root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32()); - break; - } - case 4: { - message.clientCert = $root.google.cloud.sql.v1.SslCertDetail.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCertsInsertResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SslCertsInsertResponse} SslCertsInsertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsInsertResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCertsInsertResponse message. - * @function verify - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCertsInsertResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.operation != null && message.hasOwnProperty("operation")) { - var error = $root.google.cloud.sql.v1.Operation.verify(message.operation); - if (error) - return "operation." + error; - } - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { - var error = $root.google.cloud.sql.v1.SslCert.verify(message.serverCaCert); - if (error) - return "serverCaCert." + error; - } - if (message.clientCert != null && message.hasOwnProperty("clientCert")) { - var error = $root.google.cloud.sql.v1.SslCertDetail.verify(message.clientCert); - if (error) - return "clientCert." + error; - } - return null; - }; - - /** - * Creates a SslCertsInsertResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SslCertsInsertResponse} SslCertsInsertResponse - */ - SslCertsInsertResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SslCertsInsertResponse) - return object; - var message = new $root.google.cloud.sql.v1.SslCertsInsertResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.operation != null) { - if (typeof object.operation !== "object") - throw TypeError(".google.cloud.sql.v1.SslCertsInsertResponse.operation: object expected"); - message.operation = $root.google.cloud.sql.v1.Operation.fromObject(object.operation); - } - if (object.serverCaCert != null) { - if (typeof object.serverCaCert !== "object") - throw TypeError(".google.cloud.sql.v1.SslCertsInsertResponse.serverCaCert: object expected"); - message.serverCaCert = $root.google.cloud.sql.v1.SslCert.fromObject(object.serverCaCert); - } - if (object.clientCert != null) { - if (typeof object.clientCert !== "object") - throw TypeError(".google.cloud.sql.v1.SslCertsInsertResponse.clientCert: object expected"); - message.clientCert = $root.google.cloud.sql.v1.SslCertDetail.fromObject(object.clientCert); - } - return message; - }; - - /** - * Creates a plain object from a SslCertsInsertResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @static - * @param {google.cloud.sql.v1.SslCertsInsertResponse} message SslCertsInsertResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCertsInsertResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.operation = null; - object.serverCaCert = null; - object.clientCert = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.operation != null && message.hasOwnProperty("operation")) - object.operation = $root.google.cloud.sql.v1.Operation.toObject(message.operation, options); - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) - object.serverCaCert = $root.google.cloud.sql.v1.SslCert.toObject(message.serverCaCert, options); - if (message.clientCert != null && message.hasOwnProperty("clientCert")) - object.clientCert = $root.google.cloud.sql.v1.SslCertDetail.toObject(message.clientCert, options); - return object; - }; - - /** - * Converts this SslCertsInsertResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @instance - * @returns {Object.} JSON object - */ - SslCertsInsertResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCertsInsertResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SslCertsInsertResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCertsInsertResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SslCertsInsertResponse"; - }; - - return SslCertsInsertResponse; - })(); - - v1.SslCertsListResponse = (function() { - - /** - * Properties of a SslCertsListResponse. - * @memberof google.cloud.sql.v1 - * @interface ISslCertsListResponse - * @property {string|null} [kind] SslCertsListResponse kind - * @property {Array.|null} [items] SslCertsListResponse items - */ - - /** - * Constructs a new SslCertsListResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SslCertsListResponse. - * @implements ISslCertsListResponse - * @constructor - * @param {google.cloud.sql.v1.ISslCertsListResponse=} [properties] Properties to set - */ - function SslCertsListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCertsListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @instance - */ - SslCertsListResponse.prototype.kind = ""; - - /** - * SslCertsListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @instance - */ - SslCertsListResponse.prototype.items = $util.emptyArray; - - /** - * Creates a new SslCertsListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @static - * @param {google.cloud.sql.v1.ISslCertsListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SslCertsListResponse} SslCertsListResponse instance - */ - SslCertsListResponse.create = function create(properties) { - return new SslCertsListResponse(properties); - }; - - /** - * Encodes the specified SslCertsListResponse message. Does not implicitly {@link google.cloud.sql.v1.SslCertsListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @static - * @param {google.cloud.sql.v1.ISslCertsListResponse} message SslCertsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1.SslCert.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SslCertsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SslCertsListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @static - * @param {google.cloud.sql.v1.ISslCertsListResponse} message SslCertsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCertsListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SslCertsListResponse} SslCertsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SslCertsListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1.SslCert.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCertsListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SslCertsListResponse} SslCertsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCertsListResponse message. - * @function verify - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCertsListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1.SslCert.verify(message.items[i]); - if (error) - return "items." + error; - } - } - return null; - }; - - /** - * Creates a SslCertsListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SslCertsListResponse} SslCertsListResponse - */ - SslCertsListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SslCertsListResponse) - return object; - var message = new $root.google.cloud.sql.v1.SslCertsListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1.SslCertsListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1.SslCertsListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1.SslCert.fromObject(object.items[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SslCertsListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @static - * @param {google.cloud.sql.v1.SslCertsListResponse} message SslCertsListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCertsListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1.SslCert.toObject(message.items[j], options); - } - return object; - }; - - /** - * Converts this SslCertsListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @instance - * @returns {Object.} JSON object - */ - SslCertsListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCertsListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SslCertsListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCertsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SslCertsListResponse"; - }; - - return SslCertsListResponse; - })(); - - v1.SqlTiersService = (function() { - - /** - * Constructs a new SqlTiersService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlTiersService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlTiersService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlTiersService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlTiersService; - - /** - * Creates new SqlTiersService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlTiersService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlTiersService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlTiersService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlTiersService|list}. - * @memberof google.cloud.sql.v1.SqlTiersService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.TiersListResponse} [response] TiersListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlTiersService - * @instance - * @param {google.cloud.sql.v1.ISqlTiersListRequest} request SqlTiersListRequest message or plain object - * @param {google.cloud.sql.v1.SqlTiersService.ListCallback} callback Node-style callback called with the error, if any, and TiersListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlTiersService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1.SqlTiersListRequest, $root.google.cloud.sql.v1.TiersListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlTiersService - * @instance - * @param {google.cloud.sql.v1.ISqlTiersListRequest} request SqlTiersListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlTiersService; - })(); - - v1.SqlTiersListRequest = (function() { - - /** - * Properties of a SqlTiersListRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlTiersListRequest - * @property {string|null} [project] SqlTiersListRequest project - */ - - /** - * Constructs a new SqlTiersListRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlTiersListRequest. - * @implements ISqlTiersListRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlTiersListRequest=} [properties] Properties to set - */ - function SqlTiersListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlTiersListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @instance - */ - SqlTiersListRequest.prototype.project = ""; - - /** - * Creates a new SqlTiersListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @static - * @param {google.cloud.sql.v1.ISqlTiersListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlTiersListRequest} SqlTiersListRequest instance - */ - SqlTiersListRequest.create = function create(properties) { - return new SqlTiersListRequest(properties); - }; - - /** - * Encodes the specified SqlTiersListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlTiersListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @static - * @param {google.cloud.sql.v1.ISqlTiersListRequest} message SqlTiersListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTiersListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlTiersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlTiersListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @static - * @param {google.cloud.sql.v1.ISqlTiersListRequest} message SqlTiersListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTiersListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlTiersListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlTiersListRequest} SqlTiersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTiersListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlTiersListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlTiersListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlTiersListRequest} SqlTiersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTiersListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlTiersListRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlTiersListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlTiersListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlTiersListRequest} SqlTiersListRequest - */ - SqlTiersListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlTiersListRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlTiersListRequest(); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlTiersListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @static - * @param {google.cloud.sql.v1.SqlTiersListRequest} message SqlTiersListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlTiersListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.project = ""; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlTiersListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlTiersListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlTiersListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlTiersListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlTiersListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlTiersListRequest"; - }; - - return SqlTiersListRequest; - })(); - - v1.TiersListResponse = (function() { - - /** - * Properties of a TiersListResponse. - * @memberof google.cloud.sql.v1 - * @interface ITiersListResponse - * @property {string|null} [kind] TiersListResponse kind - * @property {Array.|null} [items] TiersListResponse items - */ - - /** - * Constructs a new TiersListResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a TiersListResponse. - * @implements ITiersListResponse - * @constructor - * @param {google.cloud.sql.v1.ITiersListResponse=} [properties] Properties to set - */ - function TiersListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TiersListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.TiersListResponse - * @instance - */ - TiersListResponse.prototype.kind = ""; - - /** - * TiersListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1.TiersListResponse - * @instance - */ - TiersListResponse.prototype.items = $util.emptyArray; - - /** - * Creates a new TiersListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.TiersListResponse - * @static - * @param {google.cloud.sql.v1.ITiersListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.TiersListResponse} TiersListResponse instance - */ - TiersListResponse.create = function create(properties) { - return new TiersListResponse(properties); - }; - - /** - * Encodes the specified TiersListResponse message. Does not implicitly {@link google.cloud.sql.v1.TiersListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.TiersListResponse - * @static - * @param {google.cloud.sql.v1.ITiersListResponse} message TiersListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TiersListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1.Tier.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified TiersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.TiersListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.TiersListResponse - * @static - * @param {google.cloud.sql.v1.ITiersListResponse} message TiersListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TiersListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TiersListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.TiersListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.TiersListResponse} TiersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TiersListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.TiersListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1.Tier.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TiersListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.TiersListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.TiersListResponse} TiersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TiersListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TiersListResponse message. - * @function verify - * @memberof google.cloud.sql.v1.TiersListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TiersListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1.Tier.verify(message.items[i]); - if (error) - return "items." + error; - } - } - return null; - }; - - /** - * Creates a TiersListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.TiersListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.TiersListResponse} TiersListResponse - */ - TiersListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.TiersListResponse) - return object; - var message = new $root.google.cloud.sql.v1.TiersListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1.TiersListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1.TiersListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1.Tier.fromObject(object.items[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a TiersListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.TiersListResponse - * @static - * @param {google.cloud.sql.v1.TiersListResponse} message TiersListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TiersListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1.Tier.toObject(message.items[j], options); - } - return object; - }; - - /** - * Converts this TiersListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.TiersListResponse - * @instance - * @returns {Object.} JSON object - */ - TiersListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TiersListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.TiersListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TiersListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.TiersListResponse"; - }; - - return TiersListResponse; - })(); - - v1.Tier = (function() { - - /** - * Properties of a Tier. - * @memberof google.cloud.sql.v1 - * @interface ITier - * @property {string|null} [tier] Tier tier - * @property {number|Long|null} [RAM] Tier RAM - * @property {string|null} [kind] Tier kind - * @property {number|Long|null} [Disk_Quota] Tier Disk_Quota - * @property {Array.|null} [region] Tier region - */ - - /** - * Constructs a new Tier. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a Tier. - * @implements ITier - * @constructor - * @param {google.cloud.sql.v1.ITier=} [properties] Properties to set - */ - function Tier(properties) { - this.region = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Tier tier. - * @member {string} tier - * @memberof google.cloud.sql.v1.Tier - * @instance - */ - Tier.prototype.tier = ""; - - /** - * Tier RAM. - * @member {number|Long} RAM - * @memberof google.cloud.sql.v1.Tier - * @instance - */ - Tier.prototype.RAM = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Tier kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.Tier - * @instance - */ - Tier.prototype.kind = ""; - - /** - * Tier Disk_Quota. - * @member {number|Long} Disk_Quota - * @memberof google.cloud.sql.v1.Tier - * @instance - */ - Tier.prototype.Disk_Quota = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Tier region. - * @member {Array.} region - * @memberof google.cloud.sql.v1.Tier - * @instance - */ - Tier.prototype.region = $util.emptyArray; - - /** - * Creates a new Tier instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.Tier - * @static - * @param {google.cloud.sql.v1.ITier=} [properties] Properties to set - * @returns {google.cloud.sql.v1.Tier} Tier instance - */ - Tier.create = function create(properties) { - return new Tier(properties); - }; - - /** - * Encodes the specified Tier message. Does not implicitly {@link google.cloud.sql.v1.Tier.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.Tier - * @static - * @param {google.cloud.sql.v1.ITier} message Tier message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Tier.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tier != null && Object.hasOwnProperty.call(message, "tier")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.tier); - if (message.RAM != null && Object.hasOwnProperty.call(message, "RAM")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.RAM); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - if (message.Disk_Quota != null && Object.hasOwnProperty.call(message, "Disk_Quota")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.Disk_Quota); - if (message.region != null && message.region.length) - for (var i = 0; i < message.region.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.region[i]); - return writer; - }; - - /** - * Encodes the specified Tier message, length delimited. Does not implicitly {@link google.cloud.sql.v1.Tier.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.Tier - * @static - * @param {google.cloud.sql.v1.ITier} message Tier message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Tier.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Tier message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.Tier - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.Tier} Tier - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Tier.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.Tier(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.tier = reader.string(); - break; - } - case 2: { - message.RAM = reader.int64(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - case 4: { - message.Disk_Quota = reader.int64(); - break; - } - case 5: { - if (!(message.region && message.region.length)) - message.region = []; - message.region.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Tier message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.Tier - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.Tier} Tier - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Tier.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Tier message. - * @function verify - * @memberof google.cloud.sql.v1.Tier - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Tier.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tier != null && message.hasOwnProperty("tier")) - if (!$util.isString(message.tier)) - return "tier: string expected"; - if (message.RAM != null && message.hasOwnProperty("RAM")) - if (!$util.isInteger(message.RAM) && !(message.RAM && $util.isInteger(message.RAM.low) && $util.isInteger(message.RAM.high))) - return "RAM: integer|Long expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.Disk_Quota != null && message.hasOwnProperty("Disk_Quota")) - if (!$util.isInteger(message.Disk_Quota) && !(message.Disk_Quota && $util.isInteger(message.Disk_Quota.low) && $util.isInteger(message.Disk_Quota.high))) - return "Disk_Quota: integer|Long expected"; - if (message.region != null && message.hasOwnProperty("region")) { - if (!Array.isArray(message.region)) - return "region: array expected"; - for (var i = 0; i < message.region.length; ++i) - if (!$util.isString(message.region[i])) - return "region: string[] expected"; - } - return null; - }; - - /** - * Creates a Tier message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.Tier - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.Tier} Tier - */ - Tier.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.Tier) - return object; - var message = new $root.google.cloud.sql.v1.Tier(); - if (object.tier != null) - message.tier = String(object.tier); - if (object.RAM != null) - if ($util.Long) - (message.RAM = $util.Long.fromValue(object.RAM)).unsigned = false; - else if (typeof object.RAM === "string") - message.RAM = parseInt(object.RAM, 10); - else if (typeof object.RAM === "number") - message.RAM = object.RAM; - else if (typeof object.RAM === "object") - message.RAM = new $util.LongBits(object.RAM.low >>> 0, object.RAM.high >>> 0).toNumber(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.Disk_Quota != null) - if ($util.Long) - (message.Disk_Quota = $util.Long.fromValue(object.Disk_Quota)).unsigned = false; - else if (typeof object.Disk_Quota === "string") - message.Disk_Quota = parseInt(object.Disk_Quota, 10); - else if (typeof object.Disk_Quota === "number") - message.Disk_Quota = object.Disk_Quota; - else if (typeof object.Disk_Quota === "object") - message.Disk_Quota = new $util.LongBits(object.Disk_Quota.low >>> 0, object.Disk_Quota.high >>> 0).toNumber(); - if (object.region) { - if (!Array.isArray(object.region)) - throw TypeError(".google.cloud.sql.v1.Tier.region: array expected"); - message.region = []; - for (var i = 0; i < object.region.length; ++i) - message.region[i] = String(object.region[i]); - } - return message; - }; - - /** - * Creates a plain object from a Tier message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.Tier - * @static - * @param {google.cloud.sql.v1.Tier} message Tier - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Tier.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.region = []; - if (options.defaults) { - object.tier = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.RAM = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.RAM = options.longs === String ? "0" : 0; - object.kind = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.Disk_Quota = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.Disk_Quota = options.longs === String ? "0" : 0; - } - if (message.tier != null && message.hasOwnProperty("tier")) - object.tier = message.tier; - if (message.RAM != null && message.hasOwnProperty("RAM")) - if (typeof message.RAM === "number") - object.RAM = options.longs === String ? String(message.RAM) : message.RAM; - else - object.RAM = options.longs === String ? $util.Long.prototype.toString.call(message.RAM) : options.longs === Number ? new $util.LongBits(message.RAM.low >>> 0, message.RAM.high >>> 0).toNumber() : message.RAM; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.Disk_Quota != null && message.hasOwnProperty("Disk_Quota")) - if (typeof message.Disk_Quota === "number") - object.Disk_Quota = options.longs === String ? String(message.Disk_Quota) : message.Disk_Quota; - else - object.Disk_Quota = options.longs === String ? $util.Long.prototype.toString.call(message.Disk_Quota) : options.longs === Number ? new $util.LongBits(message.Disk_Quota.low >>> 0, message.Disk_Quota.high >>> 0).toNumber() : message.Disk_Quota; - if (message.region && message.region.length) { - object.region = []; - for (var j = 0; j < message.region.length; ++j) - object.region[j] = message.region[j]; - } - return object; - }; - - /** - * Converts this Tier to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.Tier - * @instance - * @returns {Object.} JSON object - */ - Tier.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Tier - * @function getTypeUrl - * @memberof google.cloud.sql.v1.Tier - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Tier.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.Tier"; - }; - - return Tier; - })(); - - v1.SqlUsersService = (function() { - - /** - * Constructs a new SqlUsersService service. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlUsersService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlUsersService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlUsersService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlUsersService; - - /** - * Creates new SqlUsersService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1.SqlUsersService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlUsersService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlUsersService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|delete_}. - * @memberof google.cloud.sql.v1.SqlUsersService - * @typedef DeleteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1.SqlUsersService - * @instance - * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest} request SqlUsersDeleteRequest message or plain object - * @param {google.cloud.sql.v1.SqlUsersService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlUsersService.prototype["delete"] = function delete_(request, callback) { - return this.rpcCall(delete_, $root.google.cloud.sql.v1.SqlUsersDeleteRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Delete" }); - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1.SqlUsersService - * @instance - * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest} request SqlUsersDeleteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|get}. - * @memberof google.cloud.sql.v1.SqlUsersService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.User} [response] User - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlUsersService - * @instance - * @param {google.cloud.sql.v1.ISqlUsersGetRequest} request SqlUsersGetRequest message or plain object - * @param {google.cloud.sql.v1.SqlUsersService.GetCallback} callback Node-style callback called with the error, if any, and User - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlUsersService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1.SqlUsersGetRequest, $root.google.cloud.sql.v1.User, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1.SqlUsersService - * @instance - * @param {google.cloud.sql.v1.ISqlUsersGetRequest} request SqlUsersGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|insert}. - * @memberof google.cloud.sql.v1.SqlUsersService - * @typedef InsertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1.SqlUsersService - * @instance - * @param {google.cloud.sql.v1.ISqlUsersInsertRequest} request SqlUsersInsertRequest message or plain object - * @param {google.cloud.sql.v1.SqlUsersService.InsertCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlUsersService.prototype.insert = function insert(request, callback) { - return this.rpcCall(insert, $root.google.cloud.sql.v1.SqlUsersInsertRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Insert" }); - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1.SqlUsersService - * @instance - * @param {google.cloud.sql.v1.ISqlUsersInsertRequest} request SqlUsersInsertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|list}. - * @memberof google.cloud.sql.v1.SqlUsersService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.UsersListResponse} [response] UsersListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlUsersService - * @instance - * @param {google.cloud.sql.v1.ISqlUsersListRequest} request SqlUsersListRequest message or plain object - * @param {google.cloud.sql.v1.SqlUsersService.ListCallback} callback Node-style callback called with the error, if any, and UsersListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlUsersService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1.SqlUsersListRequest, $root.google.cloud.sql.v1.UsersListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1.SqlUsersService - * @instance - * @param {google.cloud.sql.v1.ISqlUsersListRequest} request SqlUsersListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1.SqlUsersService|update}. - * @memberof google.cloud.sql.v1.SqlUsersService - * @typedef UpdateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1.Operation} [response] Operation - */ - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1.SqlUsersService - * @instance - * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest} request SqlUsersUpdateRequest message or plain object - * @param {google.cloud.sql.v1.SqlUsersService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlUsersService.prototype.update = function update(request, callback) { - return this.rpcCall(update, $root.google.cloud.sql.v1.SqlUsersUpdateRequest, $root.google.cloud.sql.v1.Operation, request, callback); - }, "name", { value: "Update" }); - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1.SqlUsersService - * @instance - * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest} request SqlUsersUpdateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlUsersService; - })(); - - v1.SqlUsersDeleteRequest = (function() { - - /** - * Properties of a SqlUsersDeleteRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlUsersDeleteRequest - * @property {string|null} [host] SqlUsersDeleteRequest host - * @property {string|null} [instance] SqlUsersDeleteRequest instance - * @property {string|null} [name] SqlUsersDeleteRequest name - * @property {string|null} [project] SqlUsersDeleteRequest project - */ - - /** - * Constructs a new SqlUsersDeleteRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlUsersDeleteRequest. - * @implements ISqlUsersDeleteRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest=} [properties] Properties to set - */ - function SqlUsersDeleteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlUsersDeleteRequest host. - * @member {string} host - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @instance - */ - SqlUsersDeleteRequest.prototype.host = ""; - - /** - * SqlUsersDeleteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @instance - */ - SqlUsersDeleteRequest.prototype.instance = ""; - - /** - * SqlUsersDeleteRequest name. - * @member {string} name - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @instance - */ - SqlUsersDeleteRequest.prototype.name = ""; - - /** - * SqlUsersDeleteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @instance - */ - SqlUsersDeleteRequest.prototype.project = ""; - - /** - * Creates a new SqlUsersDeleteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlUsersDeleteRequest} SqlUsersDeleteRequest instance - */ - SqlUsersDeleteRequest.create = function create(properties) { - return new SqlUsersDeleteRequest(properties); - }; - - /** - * Encodes the specified SqlUsersDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersDeleteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest} message SqlUsersDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersDeleteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.host != null && Object.hasOwnProperty.call(message, "host")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.host); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlUsersDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersDeleteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersDeleteRequest} message SqlUsersDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlUsersDeleteRequest} SqlUsersDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersDeleteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlUsersDeleteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.host = reader.string(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.name = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlUsersDeleteRequest} SqlUsersDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersDeleteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlUsersDeleteRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlUsersDeleteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.host != null && message.hasOwnProperty("host")) - if (!$util.isString(message.host)) - return "host: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlUsersDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlUsersDeleteRequest} SqlUsersDeleteRequest - */ - SqlUsersDeleteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlUsersDeleteRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlUsersDeleteRequest(); - if (object.host != null) - message.host = String(object.host); - if (object.instance != null) - message.instance = String(object.instance); - if (object.name != null) - message.name = String(object.name); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlUsersDeleteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @static - * @param {google.cloud.sql.v1.SqlUsersDeleteRequest} message SqlUsersDeleteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlUsersDeleteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.host = ""; - object.instance = ""; - object.name = ""; - object.project = ""; - } - if (message.host != null && message.hasOwnProperty("host")) - object.host = message.host; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlUsersDeleteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlUsersDeleteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlUsersDeleteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlUsersDeleteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlUsersDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlUsersDeleteRequest"; - }; - - return SqlUsersDeleteRequest; - })(); - - v1.SqlUsersGetRequest = (function() { - - /** - * Properties of a SqlUsersGetRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlUsersGetRequest - * @property {string|null} [instance] SqlUsersGetRequest instance - * @property {string|null} [name] SqlUsersGetRequest name - * @property {string|null} [project] SqlUsersGetRequest project - * @property {string|null} [host] SqlUsersGetRequest host - */ - - /** - * Constructs a new SqlUsersGetRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlUsersGetRequest. - * @implements ISqlUsersGetRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlUsersGetRequest=} [properties] Properties to set - */ - function SqlUsersGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlUsersGetRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @instance - */ - SqlUsersGetRequest.prototype.instance = ""; - - /** - * SqlUsersGetRequest name. - * @member {string} name - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @instance - */ - SqlUsersGetRequest.prototype.name = ""; - - /** - * SqlUsersGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @instance - */ - SqlUsersGetRequest.prototype.project = ""; - - /** - * SqlUsersGetRequest host. - * @member {string} host - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @instance - */ - SqlUsersGetRequest.prototype.host = ""; - - /** - * Creates a new SqlUsersGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlUsersGetRequest} SqlUsersGetRequest instance - */ - SqlUsersGetRequest.create = function create(properties) { - return new SqlUsersGetRequest(properties); - }; - - /** - * Encodes the specified SqlUsersGetRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersGetRequest} message SqlUsersGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - if (message.host != null && Object.hasOwnProperty.call(message, "host")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.host); - return writer; - }; - - /** - * Encodes the specified SqlUsersGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersGetRequest} message SqlUsersGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlUsersGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlUsersGetRequest} SqlUsersGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlUsersGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.name = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - case 4: { - message.host = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlUsersGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlUsersGetRequest} SqlUsersGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlUsersGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlUsersGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.host != null && message.hasOwnProperty("host")) - if (!$util.isString(message.host)) - return "host: string expected"; - return null; - }; - - /** - * Creates a SqlUsersGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlUsersGetRequest} SqlUsersGetRequest - */ - SqlUsersGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlUsersGetRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlUsersGetRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.name != null) - message.name = String(object.name); - if (object.project != null) - message.project = String(object.project); - if (object.host != null) - message.host = String(object.host); - return message; - }; - - /** - * Creates a plain object from a SqlUsersGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @static - * @param {google.cloud.sql.v1.SqlUsersGetRequest} message SqlUsersGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlUsersGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.name = ""; - object.project = ""; - object.host = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.host != null && message.hasOwnProperty("host")) - object.host = message.host; - return object; - }; - - /** - * Converts this SqlUsersGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlUsersGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlUsersGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlUsersGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlUsersGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlUsersGetRequest"; - }; - - return SqlUsersGetRequest; - })(); - - v1.SqlUsersInsertRequest = (function() { - - /** - * Properties of a SqlUsersInsertRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlUsersInsertRequest - * @property {string|null} [instance] SqlUsersInsertRequest instance - * @property {string|null} [project] SqlUsersInsertRequest project - * @property {google.cloud.sql.v1.IUser|null} [body] SqlUsersInsertRequest body - */ - - /** - * Constructs a new SqlUsersInsertRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlUsersInsertRequest. - * @implements ISqlUsersInsertRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlUsersInsertRequest=} [properties] Properties to set - */ - function SqlUsersInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlUsersInsertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @instance - */ - SqlUsersInsertRequest.prototype.instance = ""; - - /** - * SqlUsersInsertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @instance - */ - SqlUsersInsertRequest.prototype.project = ""; - - /** - * SqlUsersInsertRequest body. - * @member {google.cloud.sql.v1.IUser|null|undefined} body - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @instance - */ - SqlUsersInsertRequest.prototype.body = null; - - /** - * Creates a new SqlUsersInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlUsersInsertRequest} SqlUsersInsertRequest instance - */ - SqlUsersInsertRequest.create = function create(properties) { - return new SqlUsersInsertRequest(properties); - }; - - /** - * Encodes the specified SqlUsersInsertRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersInsertRequest} message SqlUsersInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.User.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlUsersInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersInsertRequest} message SqlUsersInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlUsersInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlUsersInsertRequest} SqlUsersInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlUsersInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.User.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlUsersInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlUsersInsertRequest} SqlUsersInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlUsersInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlUsersInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.User.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlUsersInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlUsersInsertRequest} SqlUsersInsertRequest - */ - SqlUsersInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlUsersInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlUsersInsertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlUsersInsertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.User.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlUsersInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @static - * @param {google.cloud.sql.v1.SqlUsersInsertRequest} message SqlUsersInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlUsersInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.User.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlUsersInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlUsersInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlUsersInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlUsersInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlUsersInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlUsersInsertRequest"; - }; - - return SqlUsersInsertRequest; - })(); - - v1.SqlUsersListRequest = (function() { - - /** - * Properties of a SqlUsersListRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlUsersListRequest - * @property {string|null} [instance] SqlUsersListRequest instance - * @property {string|null} [project] SqlUsersListRequest project - */ - - /** - * Constructs a new SqlUsersListRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlUsersListRequest. - * @implements ISqlUsersListRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlUsersListRequest=} [properties] Properties to set - */ - function SqlUsersListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlUsersListRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @instance - */ - SqlUsersListRequest.prototype.instance = ""; - - /** - * SqlUsersListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @instance - */ - SqlUsersListRequest.prototype.project = ""; - - /** - * Creates a new SqlUsersListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlUsersListRequest} SqlUsersListRequest instance - */ - SqlUsersListRequest.create = function create(properties) { - return new SqlUsersListRequest(properties); - }; - - /** - * Encodes the specified SqlUsersListRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersListRequest} message SqlUsersListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlUsersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersListRequest} message SqlUsersListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlUsersListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlUsersListRequest} SqlUsersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlUsersListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlUsersListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlUsersListRequest} SqlUsersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlUsersListRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlUsersListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlUsersListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlUsersListRequest} SqlUsersListRequest - */ - SqlUsersListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlUsersListRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlUsersListRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlUsersListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @static - * @param {google.cloud.sql.v1.SqlUsersListRequest} message SqlUsersListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlUsersListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlUsersListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlUsersListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlUsersListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlUsersListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlUsersListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlUsersListRequest"; - }; - - return SqlUsersListRequest; - })(); - - v1.SqlUsersUpdateRequest = (function() { - - /** - * Properties of a SqlUsersUpdateRequest. - * @memberof google.cloud.sql.v1 - * @interface ISqlUsersUpdateRequest - * @property {string|null} [host] SqlUsersUpdateRequest host - * @property {string|null} [instance] SqlUsersUpdateRequest instance - * @property {string|null} [name] SqlUsersUpdateRequest name - * @property {string|null} [project] SqlUsersUpdateRequest project - * @property {Array.|null} [databaseRoles] SqlUsersUpdateRequest databaseRoles - * @property {boolean|null} [revokeExistingRoles] SqlUsersUpdateRequest revokeExistingRoles - * @property {google.cloud.sql.v1.IUser|null} [body] SqlUsersUpdateRequest body - */ - - /** - * Constructs a new SqlUsersUpdateRequest. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlUsersUpdateRequest. - * @implements ISqlUsersUpdateRequest - * @constructor - * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest=} [properties] Properties to set - */ - function SqlUsersUpdateRequest(properties) { - this.databaseRoles = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlUsersUpdateRequest host. - * @member {string} host - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.host = ""; - - /** - * SqlUsersUpdateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.instance = ""; - - /** - * SqlUsersUpdateRequest name. - * @member {string} name - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.name = ""; - - /** - * SqlUsersUpdateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.project = ""; - - /** - * SqlUsersUpdateRequest databaseRoles. - * @member {Array.} databaseRoles - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.databaseRoles = $util.emptyArray; - - /** - * SqlUsersUpdateRequest revokeExistingRoles. - * @member {boolean|null|undefined} revokeExistingRoles - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.revokeExistingRoles = null; - - /** - * SqlUsersUpdateRequest body. - * @member {google.cloud.sql.v1.IUser|null|undefined} body - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.body = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlUsersUpdateRequest.prototype, "_revokeExistingRoles", { - get: $util.oneOfGetter($oneOfFields = ["revokeExistingRoles"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlUsersUpdateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlUsersUpdateRequest} SqlUsersUpdateRequest instance - */ - SqlUsersUpdateRequest.create = function create(properties) { - return new SqlUsersUpdateRequest(properties); - }; - - /** - * Encodes the specified SqlUsersUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1.SqlUsersUpdateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest} message SqlUsersUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersUpdateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.host != null && Object.hasOwnProperty.call(message, "host")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.host); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - if (message.databaseRoles != null && message.databaseRoles.length) - for (var i = 0; i < message.databaseRoles.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.databaseRoles[i]); - if (message.revokeExistingRoles != null && Object.hasOwnProperty.call(message, "revokeExistingRoles")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.revokeExistingRoles); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1.User.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlUsersUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlUsersUpdateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @static - * @param {google.cloud.sql.v1.ISqlUsersUpdateRequest} message SqlUsersUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlUsersUpdateRequest} SqlUsersUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersUpdateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlUsersUpdateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.host = reader.string(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.name = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - case 5: { - if (!(message.databaseRoles && message.databaseRoles.length)) - message.databaseRoles = []; - message.databaseRoles.push(reader.string()); - break; - } - case 6: { - message.revokeExistingRoles = reader.bool(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1.User.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlUsersUpdateRequest} SqlUsersUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersUpdateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlUsersUpdateRequest message. - * @function verify - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlUsersUpdateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.host != null && message.hasOwnProperty("host")) - if (!$util.isString(message.host)) - return "host: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.databaseRoles != null && message.hasOwnProperty("databaseRoles")) { - if (!Array.isArray(message.databaseRoles)) - return "databaseRoles: array expected"; - for (var i = 0; i < message.databaseRoles.length; ++i) - if (!$util.isString(message.databaseRoles[i])) - return "databaseRoles: string[] expected"; - } - if (message.revokeExistingRoles != null && message.hasOwnProperty("revokeExistingRoles")) { - properties._revokeExistingRoles = 1; - if (typeof message.revokeExistingRoles !== "boolean") - return "revokeExistingRoles: boolean expected"; - } - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1.User.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlUsersUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlUsersUpdateRequest} SqlUsersUpdateRequest - */ - SqlUsersUpdateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlUsersUpdateRequest) - return object; - var message = new $root.google.cloud.sql.v1.SqlUsersUpdateRequest(); - if (object.host != null) - message.host = String(object.host); - if (object.instance != null) - message.instance = String(object.instance); - if (object.name != null) - message.name = String(object.name); - if (object.project != null) - message.project = String(object.project); - if (object.databaseRoles) { - if (!Array.isArray(object.databaseRoles)) - throw TypeError(".google.cloud.sql.v1.SqlUsersUpdateRequest.databaseRoles: array expected"); - message.databaseRoles = []; - for (var i = 0; i < object.databaseRoles.length; ++i) - message.databaseRoles[i] = String(object.databaseRoles[i]); - } - if (object.revokeExistingRoles != null) - message.revokeExistingRoles = Boolean(object.revokeExistingRoles); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1.SqlUsersUpdateRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1.User.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlUsersUpdateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @static - * @param {google.cloud.sql.v1.SqlUsersUpdateRequest} message SqlUsersUpdateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlUsersUpdateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.databaseRoles = []; - if (options.defaults) { - object.host = ""; - object.instance = ""; - object.name = ""; - object.project = ""; - object.body = null; - } - if (message.host != null && message.hasOwnProperty("host")) - object.host = message.host; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.databaseRoles && message.databaseRoles.length) { - object.databaseRoles = []; - for (var j = 0; j < message.databaseRoles.length; ++j) - object.databaseRoles[j] = message.databaseRoles[j]; - } - if (message.revokeExistingRoles != null && message.hasOwnProperty("revokeExistingRoles")) { - object.revokeExistingRoles = message.revokeExistingRoles; - if (options.oneofs) - object._revokeExistingRoles = "revokeExistingRoles"; - } - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1.User.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlUsersUpdateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlUsersUpdateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlUsersUpdateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlUsersUpdateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlUsersUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlUsersUpdateRequest"; - }; - - return SqlUsersUpdateRequest; - })(); - - v1.UserPasswordValidationPolicy = (function() { - - /** - * Properties of a UserPasswordValidationPolicy. - * @memberof google.cloud.sql.v1 - * @interface IUserPasswordValidationPolicy - * @property {number|null} [allowedFailedAttempts] UserPasswordValidationPolicy allowedFailedAttempts - * @property {google.protobuf.IDuration|null} [passwordExpirationDuration] UserPasswordValidationPolicy passwordExpirationDuration - * @property {boolean|null} [enableFailedAttemptsCheck] UserPasswordValidationPolicy enableFailedAttemptsCheck - * @property {google.cloud.sql.v1.IPasswordStatus|null} [status] UserPasswordValidationPolicy status - * @property {boolean|null} [enablePasswordVerification] UserPasswordValidationPolicy enablePasswordVerification - */ - - /** - * Constructs a new UserPasswordValidationPolicy. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a UserPasswordValidationPolicy. - * @implements IUserPasswordValidationPolicy - * @constructor - * @param {google.cloud.sql.v1.IUserPasswordValidationPolicy=} [properties] Properties to set - */ - function UserPasswordValidationPolicy(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UserPasswordValidationPolicy allowedFailedAttempts. - * @member {number} allowedFailedAttempts - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @instance - */ - UserPasswordValidationPolicy.prototype.allowedFailedAttempts = 0; - - /** - * UserPasswordValidationPolicy passwordExpirationDuration. - * @member {google.protobuf.IDuration|null|undefined} passwordExpirationDuration - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @instance - */ - UserPasswordValidationPolicy.prototype.passwordExpirationDuration = null; - - /** - * UserPasswordValidationPolicy enableFailedAttemptsCheck. - * @member {boolean} enableFailedAttemptsCheck - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @instance - */ - UserPasswordValidationPolicy.prototype.enableFailedAttemptsCheck = false; - - /** - * UserPasswordValidationPolicy status. - * @member {google.cloud.sql.v1.IPasswordStatus|null|undefined} status - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @instance - */ - UserPasswordValidationPolicy.prototype.status = null; - - /** - * UserPasswordValidationPolicy enablePasswordVerification. - * @member {boolean} enablePasswordVerification - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @instance - */ - UserPasswordValidationPolicy.prototype.enablePasswordVerification = false; - - /** - * Creates a new UserPasswordValidationPolicy instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1.IUserPasswordValidationPolicy=} [properties] Properties to set - * @returns {google.cloud.sql.v1.UserPasswordValidationPolicy} UserPasswordValidationPolicy instance - */ - UserPasswordValidationPolicy.create = function create(properties) { - return new UserPasswordValidationPolicy(properties); - }; - - /** - * Encodes the specified UserPasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1.UserPasswordValidationPolicy.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1.IUserPasswordValidationPolicy} message UserPasswordValidationPolicy message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserPasswordValidationPolicy.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.allowedFailedAttempts != null && Object.hasOwnProperty.call(message, "allowedFailedAttempts")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.allowedFailedAttempts); - if (message.passwordExpirationDuration != null && Object.hasOwnProperty.call(message, "passwordExpirationDuration")) - $root.google.protobuf.Duration.encode(message.passwordExpirationDuration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.enableFailedAttemptsCheck != null && Object.hasOwnProperty.call(message, "enableFailedAttemptsCheck")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableFailedAttemptsCheck); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - $root.google.cloud.sql.v1.PasswordStatus.encode(message.status, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.enablePasswordVerification != null && Object.hasOwnProperty.call(message, "enablePasswordVerification")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.enablePasswordVerification); - return writer; - }; - - /** - * Encodes the specified UserPasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UserPasswordValidationPolicy.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1.IUserPasswordValidationPolicy} message UserPasswordValidationPolicy message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserPasswordValidationPolicy.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.UserPasswordValidationPolicy} UserPasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserPasswordValidationPolicy.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.UserPasswordValidationPolicy(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.allowedFailedAttempts = reader.int32(); - break; - } - case 2: { - message.passwordExpirationDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - case 3: { - message.enableFailedAttemptsCheck = reader.bool(); - break; - } - case 4: { - message.status = $root.google.cloud.sql.v1.PasswordStatus.decode(reader, reader.uint32()); - break; - } - case 5: { - message.enablePasswordVerification = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.UserPasswordValidationPolicy} UserPasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserPasswordValidationPolicy.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a UserPasswordValidationPolicy message. - * @function verify - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UserPasswordValidationPolicy.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.allowedFailedAttempts != null && message.hasOwnProperty("allowedFailedAttempts")) - if (!$util.isInteger(message.allowedFailedAttempts)) - return "allowedFailedAttempts: integer expected"; - if (message.passwordExpirationDuration != null && message.hasOwnProperty("passwordExpirationDuration")) { - var error = $root.google.protobuf.Duration.verify(message.passwordExpirationDuration); - if (error) - return "passwordExpirationDuration." + error; - } - if (message.enableFailedAttemptsCheck != null && message.hasOwnProperty("enableFailedAttemptsCheck")) - if (typeof message.enableFailedAttemptsCheck !== "boolean") - return "enableFailedAttemptsCheck: boolean expected"; - if (message.status != null && message.hasOwnProperty("status")) { - var error = $root.google.cloud.sql.v1.PasswordStatus.verify(message.status); - if (error) - return "status." + error; - } - if (message.enablePasswordVerification != null && message.hasOwnProperty("enablePasswordVerification")) - if (typeof message.enablePasswordVerification !== "boolean") - return "enablePasswordVerification: boolean expected"; - return null; - }; - - /** - * Creates a UserPasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.UserPasswordValidationPolicy} UserPasswordValidationPolicy - */ - UserPasswordValidationPolicy.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.UserPasswordValidationPolicy) - return object; - var message = new $root.google.cloud.sql.v1.UserPasswordValidationPolicy(); - if (object.allowedFailedAttempts != null) - message.allowedFailedAttempts = object.allowedFailedAttempts | 0; - if (object.passwordExpirationDuration != null) { - if (typeof object.passwordExpirationDuration !== "object") - throw TypeError(".google.cloud.sql.v1.UserPasswordValidationPolicy.passwordExpirationDuration: object expected"); - message.passwordExpirationDuration = $root.google.protobuf.Duration.fromObject(object.passwordExpirationDuration); - } - if (object.enableFailedAttemptsCheck != null) - message.enableFailedAttemptsCheck = Boolean(object.enableFailedAttemptsCheck); - if (object.status != null) { - if (typeof object.status !== "object") - throw TypeError(".google.cloud.sql.v1.UserPasswordValidationPolicy.status: object expected"); - message.status = $root.google.cloud.sql.v1.PasswordStatus.fromObject(object.status); - } - if (object.enablePasswordVerification != null) - message.enablePasswordVerification = Boolean(object.enablePasswordVerification); - return message; - }; - - /** - * Creates a plain object from a UserPasswordValidationPolicy message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1.UserPasswordValidationPolicy} message UserPasswordValidationPolicy - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UserPasswordValidationPolicy.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.allowedFailedAttempts = 0; - object.passwordExpirationDuration = null; - object.enableFailedAttemptsCheck = false; - object.status = null; - object.enablePasswordVerification = false; - } - if (message.allowedFailedAttempts != null && message.hasOwnProperty("allowedFailedAttempts")) - object.allowedFailedAttempts = message.allowedFailedAttempts; - if (message.passwordExpirationDuration != null && message.hasOwnProperty("passwordExpirationDuration")) - object.passwordExpirationDuration = $root.google.protobuf.Duration.toObject(message.passwordExpirationDuration, options); - if (message.enableFailedAttemptsCheck != null && message.hasOwnProperty("enableFailedAttemptsCheck")) - object.enableFailedAttemptsCheck = message.enableFailedAttemptsCheck; - if (message.status != null && message.hasOwnProperty("status")) - object.status = $root.google.cloud.sql.v1.PasswordStatus.toObject(message.status, options); - if (message.enablePasswordVerification != null && message.hasOwnProperty("enablePasswordVerification")) - object.enablePasswordVerification = message.enablePasswordVerification; - return object; - }; - - /** - * Converts this UserPasswordValidationPolicy to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @instance - * @returns {Object.} JSON object - */ - UserPasswordValidationPolicy.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UserPasswordValidationPolicy - * @function getTypeUrl - * @memberof google.cloud.sql.v1.UserPasswordValidationPolicy - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UserPasswordValidationPolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.UserPasswordValidationPolicy"; - }; - - return UserPasswordValidationPolicy; - })(); - - v1.PasswordStatus = (function() { - - /** - * Properties of a PasswordStatus. - * @memberof google.cloud.sql.v1 - * @interface IPasswordStatus - * @property {boolean|null} [locked] PasswordStatus locked - * @property {google.protobuf.ITimestamp|null} [passwordExpirationTime] PasswordStatus passwordExpirationTime - */ - - /** - * Constructs a new PasswordStatus. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a PasswordStatus. - * @implements IPasswordStatus - * @constructor - * @param {google.cloud.sql.v1.IPasswordStatus=} [properties] Properties to set - */ - function PasswordStatus(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PasswordStatus locked. - * @member {boolean} locked - * @memberof google.cloud.sql.v1.PasswordStatus - * @instance - */ - PasswordStatus.prototype.locked = false; - - /** - * PasswordStatus passwordExpirationTime. - * @member {google.protobuf.ITimestamp|null|undefined} passwordExpirationTime - * @memberof google.cloud.sql.v1.PasswordStatus - * @instance - */ - PasswordStatus.prototype.passwordExpirationTime = null; - - /** - * Creates a new PasswordStatus instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.PasswordStatus - * @static - * @param {google.cloud.sql.v1.IPasswordStatus=} [properties] Properties to set - * @returns {google.cloud.sql.v1.PasswordStatus} PasswordStatus instance - */ - PasswordStatus.create = function create(properties) { - return new PasswordStatus(properties); - }; - - /** - * Encodes the specified PasswordStatus message. Does not implicitly {@link google.cloud.sql.v1.PasswordStatus.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.PasswordStatus - * @static - * @param {google.cloud.sql.v1.IPasswordStatus} message PasswordStatus message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PasswordStatus.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.locked != null && Object.hasOwnProperty.call(message, "locked")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.locked); - if (message.passwordExpirationTime != null && Object.hasOwnProperty.call(message, "passwordExpirationTime")) - $root.google.protobuf.Timestamp.encode(message.passwordExpirationTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PasswordStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1.PasswordStatus.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.PasswordStatus - * @static - * @param {google.cloud.sql.v1.IPasswordStatus} message PasswordStatus message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PasswordStatus.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PasswordStatus message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.PasswordStatus - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.PasswordStatus} PasswordStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PasswordStatus.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.PasswordStatus(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.locked = reader.bool(); - break; - } - case 2: { - message.passwordExpirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PasswordStatus message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.PasswordStatus - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.PasswordStatus} PasswordStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PasswordStatus.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PasswordStatus message. - * @function verify - * @memberof google.cloud.sql.v1.PasswordStatus - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PasswordStatus.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.locked != null && message.hasOwnProperty("locked")) - if (typeof message.locked !== "boolean") - return "locked: boolean expected"; - if (message.passwordExpirationTime != null && message.hasOwnProperty("passwordExpirationTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.passwordExpirationTime); - if (error) - return "passwordExpirationTime." + error; - } - return null; - }; - - /** - * Creates a PasswordStatus message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.PasswordStatus - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.PasswordStatus} PasswordStatus - */ - PasswordStatus.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.PasswordStatus) - return object; - var message = new $root.google.cloud.sql.v1.PasswordStatus(); - if (object.locked != null) - message.locked = Boolean(object.locked); - if (object.passwordExpirationTime != null) { - if (typeof object.passwordExpirationTime !== "object") - throw TypeError(".google.cloud.sql.v1.PasswordStatus.passwordExpirationTime: object expected"); - message.passwordExpirationTime = $root.google.protobuf.Timestamp.fromObject(object.passwordExpirationTime); - } - return message; - }; - - /** - * Creates a plain object from a PasswordStatus message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.PasswordStatus - * @static - * @param {google.cloud.sql.v1.PasswordStatus} message PasswordStatus - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PasswordStatus.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.locked = false; - object.passwordExpirationTime = null; - } - if (message.locked != null && message.hasOwnProperty("locked")) - object.locked = message.locked; - if (message.passwordExpirationTime != null && message.hasOwnProperty("passwordExpirationTime")) - object.passwordExpirationTime = $root.google.protobuf.Timestamp.toObject(message.passwordExpirationTime, options); - return object; - }; - - /** - * Converts this PasswordStatus to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.PasswordStatus - * @instance - * @returns {Object.} JSON object - */ - PasswordStatus.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PasswordStatus - * @function getTypeUrl - * @memberof google.cloud.sql.v1.PasswordStatus - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PasswordStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.PasswordStatus"; - }; - - return PasswordStatus; - })(); - - v1.User = (function() { - - /** - * Properties of a User. - * @memberof google.cloud.sql.v1 - * @interface IUser - * @property {string|null} [kind] User kind - * @property {string|null} [password] User password - * @property {string|null} [etag] User etag - * @property {string|null} [name] User name - * @property {string|null} [host] User host - * @property {string|null} [instance] User instance - * @property {string|null} [project] User project - * @property {google.cloud.sql.v1.User.SqlUserType|null} [type] User type - * @property {google.cloud.sql.v1.ISqlServerUserDetails|null} [sqlserverUserDetails] User sqlserverUserDetails - * @property {string|null} [iamEmail] User iamEmail - * @property {google.cloud.sql.v1.IUserPasswordValidationPolicy|null} [passwordPolicy] User passwordPolicy - * @property {google.cloud.sql.v1.User.DualPasswordType|null} [dualPasswordType] User dualPasswordType - * @property {google.cloud.sql.v1.User.IamStatus|null} [iamStatus] User iamStatus - * @property {Array.|null} [databaseRoles] User databaseRoles - */ - - /** - * Constructs a new User. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a User. - * @implements IUser - * @constructor - * @param {google.cloud.sql.v1.IUser=} [properties] Properties to set - */ - function User(properties) { - this.databaseRoles = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * User kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.kind = ""; - - /** - * User password. - * @member {string} password - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.password = ""; - - /** - * User etag. - * @member {string} etag - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.etag = ""; - - /** - * User name. - * @member {string} name - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.name = ""; - - /** - * User host. - * @member {string} host - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.host = ""; - - /** - * User instance. - * @member {string} instance - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.instance = ""; - - /** - * User project. - * @member {string} project - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.project = ""; - - /** - * User type. - * @member {google.cloud.sql.v1.User.SqlUserType} type - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.type = 0; - - /** - * User sqlserverUserDetails. - * @member {google.cloud.sql.v1.ISqlServerUserDetails|null|undefined} sqlserverUserDetails - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.sqlserverUserDetails = null; - - /** - * User iamEmail. - * @member {string} iamEmail - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.iamEmail = ""; - - /** - * User passwordPolicy. - * @member {google.cloud.sql.v1.IUserPasswordValidationPolicy|null|undefined} passwordPolicy - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.passwordPolicy = null; - - /** - * User dualPasswordType. - * @member {google.cloud.sql.v1.User.DualPasswordType|null|undefined} dualPasswordType - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.dualPasswordType = null; - - /** - * User iamStatus. - * @member {google.cloud.sql.v1.User.IamStatus|null|undefined} iamStatus - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.iamStatus = null; - - /** - * User databaseRoles. - * @member {Array.} databaseRoles - * @memberof google.cloud.sql.v1.User - * @instance - */ - User.prototype.databaseRoles = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * User userDetails. - * @member {"sqlserverUserDetails"|undefined} userDetails - * @memberof google.cloud.sql.v1.User - * @instance - */ - Object.defineProperty(User.prototype, "userDetails", { - get: $util.oneOfGetter($oneOfFields = ["sqlserverUserDetails"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(User.prototype, "_dualPasswordType", { - get: $util.oneOfGetter($oneOfFields = ["dualPasswordType"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(User.prototype, "_iamStatus", { - get: $util.oneOfGetter($oneOfFields = ["iamStatus"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new User instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.User - * @static - * @param {google.cloud.sql.v1.IUser=} [properties] Properties to set - * @returns {google.cloud.sql.v1.User} User instance - */ - User.create = function create(properties) { - return new User(properties); - }; - - /** - * Encodes the specified User message. Does not implicitly {@link google.cloud.sql.v1.User.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.User - * @static - * @param {google.cloud.sql.v1.IUser} message User message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - User.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.password != null && Object.hasOwnProperty.call(message, "password")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.password); - if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.etag); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); - if (message.host != null && Object.hasOwnProperty.call(message, "host")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.host); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.project); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.type); - if (message.sqlserverUserDetails != null && Object.hasOwnProperty.call(message, "sqlserverUserDetails")) - $root.google.cloud.sql.v1.SqlServerUserDetails.encode(message.sqlserverUserDetails, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.iamEmail != null && Object.hasOwnProperty.call(message, "iamEmail")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.iamEmail); - if (message.passwordPolicy != null && Object.hasOwnProperty.call(message, "passwordPolicy")) - $root.google.cloud.sql.v1.UserPasswordValidationPolicy.encode(message.passwordPolicy, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.dualPasswordType != null && Object.hasOwnProperty.call(message, "dualPasswordType")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.dualPasswordType); - if (message.iamStatus != null && Object.hasOwnProperty.call(message, "iamStatus")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.iamStatus); - if (message.databaseRoles != null && message.databaseRoles.length) - for (var i = 0; i < message.databaseRoles.length; ++i) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.databaseRoles[i]); - return writer; - }; - - /** - * Encodes the specified User message, length delimited. Does not implicitly {@link google.cloud.sql.v1.User.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.User - * @static - * @param {google.cloud.sql.v1.IUser} message User message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - User.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a User message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.User - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.User} User - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - User.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.User(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.password = reader.string(); - break; - } - case 3: { - message.etag = reader.string(); - break; - } - case 4: { - message.name = reader.string(); - break; - } - case 5: { - message.host = reader.string(); - break; - } - case 6: { - message.instance = reader.string(); - break; - } - case 7: { - message.project = reader.string(); - break; - } - case 8: { - message.type = reader.int32(); - break; - } - case 9: { - message.sqlserverUserDetails = $root.google.cloud.sql.v1.SqlServerUserDetails.decode(reader, reader.uint32()); - break; - } - case 11: { - message.iamEmail = reader.string(); - break; - } - case 12: { - message.passwordPolicy = $root.google.cloud.sql.v1.UserPasswordValidationPolicy.decode(reader, reader.uint32()); - break; - } - case 13: { - message.dualPasswordType = reader.int32(); - break; - } - case 14: { - message.iamStatus = reader.int32(); - break; - } - case 15: { - if (!(message.databaseRoles && message.databaseRoles.length)) - message.databaseRoles = []; - message.databaseRoles.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a User message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.User - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.User} User - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - User.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a User message. - * @function verify - * @memberof google.cloud.sql.v1.User - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - User.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.password != null && message.hasOwnProperty("password")) - if (!$util.isString(message.password)) - return "password: string expected"; - if (message.etag != null && message.hasOwnProperty("etag")) - if (!$util.isString(message.etag)) - return "etag: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.host != null && message.hasOwnProperty("host")) - if (!$util.isString(message.host)) - return "host: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 7: - break; - } - if (message.sqlserverUserDetails != null && message.hasOwnProperty("sqlserverUserDetails")) { - properties.userDetails = 1; - { - var error = $root.google.cloud.sql.v1.SqlServerUserDetails.verify(message.sqlserverUserDetails); - if (error) - return "sqlserverUserDetails." + error; - } - } - if (message.iamEmail != null && message.hasOwnProperty("iamEmail")) - if (!$util.isString(message.iamEmail)) - return "iamEmail: string expected"; - if (message.passwordPolicy != null && message.hasOwnProperty("passwordPolicy")) { - var error = $root.google.cloud.sql.v1.UserPasswordValidationPolicy.verify(message.passwordPolicy); - if (error) - return "passwordPolicy." + error; - } - if (message.dualPasswordType != null && message.hasOwnProperty("dualPasswordType")) { - properties._dualPasswordType = 1; - switch (message.dualPasswordType) { - default: - return "dualPasswordType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - } - if (message.iamStatus != null && message.hasOwnProperty("iamStatus")) { - properties._iamStatus = 1; - switch (message.iamStatus) { - default: - return "iamStatus: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - if (message.databaseRoles != null && message.hasOwnProperty("databaseRoles")) { - if (!Array.isArray(message.databaseRoles)) - return "databaseRoles: array expected"; - for (var i = 0; i < message.databaseRoles.length; ++i) - if (!$util.isString(message.databaseRoles[i])) - return "databaseRoles: string[] expected"; - } - return null; - }; - - /** - * Creates a User message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.User - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.User} User - */ - User.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.User) - return object; - var message = new $root.google.cloud.sql.v1.User(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.password != null) - message.password = String(object.password); - if (object.etag != null) - message.etag = String(object.etag); - if (object.name != null) - message.name = String(object.name); - if (object.host != null) - message.host = String(object.host); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "BUILT_IN": - case 0: - message.type = 0; - break; - case "CLOUD_IAM_USER": - case 1: - message.type = 1; - break; - case "CLOUD_IAM_SERVICE_ACCOUNT": - case 2: - message.type = 2; - break; - case "CLOUD_IAM_GROUP": - case 3: - message.type = 3; - break; - case "CLOUD_IAM_GROUP_USER": - case 4: - message.type = 4; - break; - case "CLOUD_IAM_GROUP_SERVICE_ACCOUNT": - case 5: - message.type = 5; - break; - case "ENTRAID_USER": - case 7: - message.type = 7; - break; - } - if (object.sqlserverUserDetails != null) { - if (typeof object.sqlserverUserDetails !== "object") - throw TypeError(".google.cloud.sql.v1.User.sqlserverUserDetails: object expected"); - message.sqlserverUserDetails = $root.google.cloud.sql.v1.SqlServerUserDetails.fromObject(object.sqlserverUserDetails); - } - if (object.iamEmail != null) - message.iamEmail = String(object.iamEmail); - if (object.passwordPolicy != null) { - if (typeof object.passwordPolicy !== "object") - throw TypeError(".google.cloud.sql.v1.User.passwordPolicy: object expected"); - message.passwordPolicy = $root.google.cloud.sql.v1.UserPasswordValidationPolicy.fromObject(object.passwordPolicy); - } - switch (object.dualPasswordType) { - default: - if (typeof object.dualPasswordType === "number") { - message.dualPasswordType = object.dualPasswordType; - break; - } - break; - case "DUAL_PASSWORD_TYPE_UNSPECIFIED": - case 0: - message.dualPasswordType = 0; - break; - case "NO_MODIFY_DUAL_PASSWORD": - case 1: - message.dualPasswordType = 1; - break; - case "NO_DUAL_PASSWORD": - case 2: - message.dualPasswordType = 2; - break; - case "DUAL_PASSWORD": - case 3: - message.dualPasswordType = 3; - break; - } - switch (object.iamStatus) { - default: - if (typeof object.iamStatus === "number") { - message.iamStatus = object.iamStatus; - break; - } - break; - case "IAM_STATUS_UNSPECIFIED": - case 0: - message.iamStatus = 0; - break; - case "INACTIVE": - case 1: - message.iamStatus = 1; - break; - case "ACTIVE": - case 2: - message.iamStatus = 2; - break; - } - if (object.databaseRoles) { - if (!Array.isArray(object.databaseRoles)) - throw TypeError(".google.cloud.sql.v1.User.databaseRoles: array expected"); - message.databaseRoles = []; - for (var i = 0; i < object.databaseRoles.length; ++i) - message.databaseRoles[i] = String(object.databaseRoles[i]); - } - return message; - }; - - /** - * Creates a plain object from a User message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.User - * @static - * @param {google.cloud.sql.v1.User} message User - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - User.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.databaseRoles = []; - if (options.defaults) { - object.kind = ""; - object.password = ""; - object.etag = ""; - object.name = ""; - object.host = ""; - object.instance = ""; - object.project = ""; - object.type = options.enums === String ? "BUILT_IN" : 0; - object.iamEmail = ""; - object.passwordPolicy = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.password != null && message.hasOwnProperty("password")) - object.password = message.password; - if (message.etag != null && message.hasOwnProperty("etag")) - object.etag = message.etag; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.host != null && message.hasOwnProperty("host")) - object.host = message.host; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1.User.SqlUserType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1.User.SqlUserType[message.type] : message.type; - if (message.sqlserverUserDetails != null && message.hasOwnProperty("sqlserverUserDetails")) { - object.sqlserverUserDetails = $root.google.cloud.sql.v1.SqlServerUserDetails.toObject(message.sqlserverUserDetails, options); - if (options.oneofs) - object.userDetails = "sqlserverUserDetails"; - } - if (message.iamEmail != null && message.hasOwnProperty("iamEmail")) - object.iamEmail = message.iamEmail; - if (message.passwordPolicy != null && message.hasOwnProperty("passwordPolicy")) - object.passwordPolicy = $root.google.cloud.sql.v1.UserPasswordValidationPolicy.toObject(message.passwordPolicy, options); - if (message.dualPasswordType != null && message.hasOwnProperty("dualPasswordType")) { - object.dualPasswordType = options.enums === String ? $root.google.cloud.sql.v1.User.DualPasswordType[message.dualPasswordType] === undefined ? message.dualPasswordType : $root.google.cloud.sql.v1.User.DualPasswordType[message.dualPasswordType] : message.dualPasswordType; - if (options.oneofs) - object._dualPasswordType = "dualPasswordType"; - } - if (message.iamStatus != null && message.hasOwnProperty("iamStatus")) { - object.iamStatus = options.enums === String ? $root.google.cloud.sql.v1.User.IamStatus[message.iamStatus] === undefined ? message.iamStatus : $root.google.cloud.sql.v1.User.IamStatus[message.iamStatus] : message.iamStatus; - if (options.oneofs) - object._iamStatus = "iamStatus"; - } - if (message.databaseRoles && message.databaseRoles.length) { - object.databaseRoles = []; - for (var j = 0; j < message.databaseRoles.length; ++j) - object.databaseRoles[j] = message.databaseRoles[j]; - } - return object; - }; - - /** - * Converts this User to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.User - * @instance - * @returns {Object.} JSON object - */ - User.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for User - * @function getTypeUrl - * @memberof google.cloud.sql.v1.User - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - User.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.User"; - }; - - /** - * SqlUserType enum. - * @name google.cloud.sql.v1.User.SqlUserType - * @enum {number} - * @property {number} BUILT_IN=0 BUILT_IN value - * @property {number} CLOUD_IAM_USER=1 CLOUD_IAM_USER value - * @property {number} CLOUD_IAM_SERVICE_ACCOUNT=2 CLOUD_IAM_SERVICE_ACCOUNT value - * @property {number} CLOUD_IAM_GROUP=3 CLOUD_IAM_GROUP value - * @property {number} CLOUD_IAM_GROUP_USER=4 CLOUD_IAM_GROUP_USER value - * @property {number} CLOUD_IAM_GROUP_SERVICE_ACCOUNT=5 CLOUD_IAM_GROUP_SERVICE_ACCOUNT value - * @property {number} ENTRAID_USER=7 ENTRAID_USER value - */ - User.SqlUserType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BUILT_IN"] = 0; - values[valuesById[1] = "CLOUD_IAM_USER"] = 1; - values[valuesById[2] = "CLOUD_IAM_SERVICE_ACCOUNT"] = 2; - values[valuesById[3] = "CLOUD_IAM_GROUP"] = 3; - values[valuesById[4] = "CLOUD_IAM_GROUP_USER"] = 4; - values[valuesById[5] = "CLOUD_IAM_GROUP_SERVICE_ACCOUNT"] = 5; - values[valuesById[7] = "ENTRAID_USER"] = 7; - return values; - })(); - - /** - * DualPasswordType enum. - * @name google.cloud.sql.v1.User.DualPasswordType - * @enum {number} - * @property {number} DUAL_PASSWORD_TYPE_UNSPECIFIED=0 DUAL_PASSWORD_TYPE_UNSPECIFIED value - * @property {number} NO_MODIFY_DUAL_PASSWORD=1 NO_MODIFY_DUAL_PASSWORD value - * @property {number} NO_DUAL_PASSWORD=2 NO_DUAL_PASSWORD value - * @property {number} DUAL_PASSWORD=3 DUAL_PASSWORD value - */ - User.DualPasswordType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DUAL_PASSWORD_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "NO_MODIFY_DUAL_PASSWORD"] = 1; - values[valuesById[2] = "NO_DUAL_PASSWORD"] = 2; - values[valuesById[3] = "DUAL_PASSWORD"] = 3; - return values; - })(); - - /** - * IamStatus enum. - * @name google.cloud.sql.v1.User.IamStatus - * @enum {number} - * @property {number} IAM_STATUS_UNSPECIFIED=0 IAM_STATUS_UNSPECIFIED value - * @property {number} INACTIVE=1 INACTIVE value - * @property {number} ACTIVE=2 ACTIVE value - */ - User.IamStatus = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "IAM_STATUS_UNSPECIFIED"] = 0; - values[valuesById[1] = "INACTIVE"] = 1; - values[valuesById[2] = "ACTIVE"] = 2; - return values; - })(); - - return User; - })(); - - v1.SqlServerUserDetails = (function() { - - /** - * Properties of a SqlServerUserDetails. - * @memberof google.cloud.sql.v1 - * @interface ISqlServerUserDetails - * @property {boolean|null} [disabled] SqlServerUserDetails disabled - * @property {Array.|null} [serverRoles] SqlServerUserDetails serverRoles - */ - - /** - * Constructs a new SqlServerUserDetails. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a SqlServerUserDetails. - * @implements ISqlServerUserDetails - * @constructor - * @param {google.cloud.sql.v1.ISqlServerUserDetails=} [properties] Properties to set - */ - function SqlServerUserDetails(properties) { - this.serverRoles = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlServerUserDetails disabled. - * @member {boolean} disabled - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @instance - */ - SqlServerUserDetails.prototype.disabled = false; - - /** - * SqlServerUserDetails serverRoles. - * @member {Array.} serverRoles - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @instance - */ - SqlServerUserDetails.prototype.serverRoles = $util.emptyArray; - - /** - * Creates a new SqlServerUserDetails instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @static - * @param {google.cloud.sql.v1.ISqlServerUserDetails=} [properties] Properties to set - * @returns {google.cloud.sql.v1.SqlServerUserDetails} SqlServerUserDetails instance - */ - SqlServerUserDetails.create = function create(properties) { - return new SqlServerUserDetails(properties); - }; - - /** - * Encodes the specified SqlServerUserDetails message. Does not implicitly {@link google.cloud.sql.v1.SqlServerUserDetails.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @static - * @param {google.cloud.sql.v1.ISqlServerUserDetails} message SqlServerUserDetails message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerUserDetails.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.disabled); - if (message.serverRoles != null && message.serverRoles.length) - for (var i = 0; i < message.serverRoles.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.serverRoles[i]); - return writer; - }; - - /** - * Encodes the specified SqlServerUserDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1.SqlServerUserDetails.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @static - * @param {google.cloud.sql.v1.ISqlServerUserDetails} message SqlServerUserDetails message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerUserDetails.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlServerUserDetails message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.SqlServerUserDetails} SqlServerUserDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerUserDetails.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.SqlServerUserDetails(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.disabled = reader.bool(); - break; - } - case 2: { - if (!(message.serverRoles && message.serverRoles.length)) - message.serverRoles = []; - message.serverRoles.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlServerUserDetails message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.SqlServerUserDetails} SqlServerUserDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerUserDetails.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlServerUserDetails message. - * @function verify - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlServerUserDetails.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.disabled != null && message.hasOwnProperty("disabled")) - if (typeof message.disabled !== "boolean") - return "disabled: boolean expected"; - if (message.serverRoles != null && message.hasOwnProperty("serverRoles")) { - if (!Array.isArray(message.serverRoles)) - return "serverRoles: array expected"; - for (var i = 0; i < message.serverRoles.length; ++i) - if (!$util.isString(message.serverRoles[i])) - return "serverRoles: string[] expected"; - } - return null; - }; - - /** - * Creates a SqlServerUserDetails message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.SqlServerUserDetails} SqlServerUserDetails - */ - SqlServerUserDetails.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.SqlServerUserDetails) - return object; - var message = new $root.google.cloud.sql.v1.SqlServerUserDetails(); - if (object.disabled != null) - message.disabled = Boolean(object.disabled); - if (object.serverRoles) { - if (!Array.isArray(object.serverRoles)) - throw TypeError(".google.cloud.sql.v1.SqlServerUserDetails.serverRoles: array expected"); - message.serverRoles = []; - for (var i = 0; i < object.serverRoles.length; ++i) - message.serverRoles[i] = String(object.serverRoles[i]); - } - return message; - }; - - /** - * Creates a plain object from a SqlServerUserDetails message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @static - * @param {google.cloud.sql.v1.SqlServerUserDetails} message SqlServerUserDetails - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlServerUserDetails.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.serverRoles = []; - if (options.defaults) - object.disabled = false; - if (message.disabled != null && message.hasOwnProperty("disabled")) - object.disabled = message.disabled; - if (message.serverRoles && message.serverRoles.length) { - object.serverRoles = []; - for (var j = 0; j < message.serverRoles.length; ++j) - object.serverRoles[j] = message.serverRoles[j]; - } - return object; - }; - - /** - * Converts this SqlServerUserDetails to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @instance - * @returns {Object.} JSON object - */ - SqlServerUserDetails.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlServerUserDetails - * @function getTypeUrl - * @memberof google.cloud.sql.v1.SqlServerUserDetails - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlServerUserDetails.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.SqlServerUserDetails"; - }; - - return SqlServerUserDetails; - })(); - - v1.UsersListResponse = (function() { - - /** - * Properties of a UsersListResponse. - * @memberof google.cloud.sql.v1 - * @interface IUsersListResponse - * @property {string|null} [kind] UsersListResponse kind - * @property {Array.|null} [items] UsersListResponse items - * @property {string|null} [nextPageToken] UsersListResponse nextPageToken - */ - - /** - * Constructs a new UsersListResponse. - * @memberof google.cloud.sql.v1 - * @classdesc Represents a UsersListResponse. - * @implements IUsersListResponse - * @constructor - * @param {google.cloud.sql.v1.IUsersListResponse=} [properties] Properties to set - */ - function UsersListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UsersListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1.UsersListResponse - * @instance - */ - UsersListResponse.prototype.kind = ""; - - /** - * UsersListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1.UsersListResponse - * @instance - */ - UsersListResponse.prototype.items = $util.emptyArray; - - /** - * UsersListResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.sql.v1.UsersListResponse - * @instance - */ - UsersListResponse.prototype.nextPageToken = ""; - - /** - * Creates a new UsersListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1.UsersListResponse - * @static - * @param {google.cloud.sql.v1.IUsersListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1.UsersListResponse} UsersListResponse instance - */ - UsersListResponse.create = function create(properties) { - return new UsersListResponse(properties); - }; - - /** - * Encodes the specified UsersListResponse message. Does not implicitly {@link google.cloud.sql.v1.UsersListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1.UsersListResponse - * @static - * @param {google.cloud.sql.v1.IUsersListResponse} message UsersListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UsersListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1.User.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified UsersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1.UsersListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1.UsersListResponse - * @static - * @param {google.cloud.sql.v1.IUsersListResponse} message UsersListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UsersListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a UsersListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1.UsersListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1.UsersListResponse} UsersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UsersListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1.UsersListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1.User.decode(reader, reader.uint32())); - break; - } - case 3: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a UsersListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1.UsersListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1.UsersListResponse} UsersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UsersListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a UsersListResponse message. - * @function verify - * @memberof google.cloud.sql.v1.UsersListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UsersListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1.User.verify(message.items[i]); - if (error) - return "items." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a UsersListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1.UsersListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1.UsersListResponse} UsersListResponse - */ - UsersListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1.UsersListResponse) - return object; - var message = new $root.google.cloud.sql.v1.UsersListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1.UsersListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1.UsersListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1.User.fromObject(object.items[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a UsersListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1.UsersListResponse - * @static - * @param {google.cloud.sql.v1.UsersListResponse} message UsersListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UsersListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) { - object.kind = ""; - object.nextPageToken = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1.User.toObject(message.items[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this UsersListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1.UsersListResponse - * @instance - * @returns {Object.} JSON object - */ - UsersListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UsersListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1.UsersListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UsersListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1.UsersListResponse"; - }; - - return UsersListResponse; - })(); - - return v1; - })(); - - sql.v1beta4 = (function() { - - /** - * Namespace v1beta4. - * @memberof google.cloud.sql - * @namespace - */ - var v1beta4 = {}; - - v1beta4.SqlBackupRunsService = (function() { - - /** - * Constructs a new SqlBackupRunsService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlBackupRunsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlBackupRunsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlBackupRunsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlBackupRunsService; - - /** - * Creates new SqlBackupRunsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlBackupRunsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlBackupRunsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|delete_}. - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @typedef DeleteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest} request SqlBackupRunsDeleteRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlBackupRunsService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupRunsService.prototype["delete"] = function delete_(request, callback) { - return this.rpcCall(delete_, $root.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Delete" }); - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest} request SqlBackupRunsDeleteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|get}. - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.BackupRun} [response] BackupRun - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest} request SqlBackupRunsGetRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlBackupRunsService.GetCallback} callback Node-style callback called with the error, if any, and BackupRun - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupRunsService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest, $root.google.cloud.sql.v1beta4.BackupRun, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest} request SqlBackupRunsGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|insert}. - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @typedef InsertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest} request SqlBackupRunsInsertRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlBackupRunsService.InsertCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupRunsService.prototype.insert = function insert(request, callback) { - return this.rpcCall(insert, $root.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Insert" }); - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest} request SqlBackupRunsInsertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupRunsService|list}. - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.BackupRunsListResponse} [response] BackupRunsListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest} request SqlBackupRunsListRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlBackupRunsService.ListCallback} callback Node-style callback called with the error, if any, and BackupRunsListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupRunsService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlBackupRunsListRequest, $root.google.cloud.sql.v1beta4.BackupRunsListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest} request SqlBackupRunsListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlBackupRunsService; - })(); - - v1beta4.SqlDatabasesService = (function() { - - /** - * Constructs a new SqlDatabasesService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlDatabasesService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlDatabasesService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlDatabasesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlDatabasesService; - - /** - * Creates new SqlDatabasesService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlDatabasesService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlDatabasesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|delete_}. - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @typedef DeleteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest} request SqlDatabasesDeleteRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlDatabasesService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype["delete"] = function delete_(request, callback) { - return this.rpcCall(delete_, $root.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Delete" }); - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest} request SqlDatabasesDeleteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|get}. - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Database} [response] Database - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest} request SqlDatabasesGetRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlDatabasesService.GetCallback} callback Node-style callback called with the error, if any, and Database - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlDatabasesGetRequest, $root.google.cloud.sql.v1beta4.Database, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest} request SqlDatabasesGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|insert}. - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @typedef InsertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest} request SqlDatabasesInsertRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlDatabasesService.InsertCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype.insert = function insert(request, callback) { - return this.rpcCall(insert, $root.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Insert" }); - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest} request SqlDatabasesInsertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|list}. - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.DatabasesListResponse} [response] DatabasesListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest} request SqlDatabasesListRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlDatabasesService.ListCallback} callback Node-style callback called with the error, if any, and DatabasesListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlDatabasesListRequest, $root.google.cloud.sql.v1beta4.DatabasesListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest} request SqlDatabasesListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|patch}. - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @typedef PatchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Patch. - * @function patch - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlDatabasesService.PatchCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype.patch = function patch(request, callback) { - return this.rpcCall(patch, $root.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Patch" }); - - /** - * Calls Patch. - * @function patch - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlDatabasesService|update}. - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @typedef UpdateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlDatabasesService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlDatabasesService.prototype.update = function update(request, callback) { - return this.rpcCall(update, $root.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Update" }); - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1beta4.SqlDatabasesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} request SqlDatabasesUpdateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlDatabasesService; - })(); - - v1beta4.SqlFlagsService = (function() { - - /** - * Constructs a new SqlFlagsService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlFlagsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlFlagsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlFlagsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlFlagsService; - - /** - * Creates new SqlFlagsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlFlagsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlFlagsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlFlagsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlFlagsService|list}. - * @memberof google.cloud.sql.v1beta4.SqlFlagsService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.FlagsListResponse} [response] FlagsListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlFlagsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest} request SqlFlagsListRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlFlagsService.ListCallback} callback Node-style callback called with the error, if any, and FlagsListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlFlagsService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlFlagsListRequest, $root.google.cloud.sql.v1beta4.FlagsListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlFlagsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest} request SqlFlagsListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlFlagsService; - })(); - - v1beta4.SqlInstancesService = (function() { - - /** - * Constructs a new SqlInstancesService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlInstancesService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlInstancesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlInstancesService; - - /** - * Creates new SqlInstancesService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlInstancesService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlInstancesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addServerCa}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef AddServerCaCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls AddServerCa. - * @function addServerCa - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest} request SqlInstancesAddServerCaRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.AddServerCaCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.addServerCa = function addServerCa(request, callback) { - return this.rpcCall(addServerCa, $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "AddServerCa" }); - - /** - * Calls AddServerCa. - * @function addServerCa - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest} request SqlInstancesAddServerCaRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addServerCertificate}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef AddServerCertificateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls AddServerCertificate. - * @function addServerCertificate - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest} request SqlInstancesAddServerCertificateRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.AddServerCertificateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.addServerCertificate = function addServerCertificate(request, callback) { - return this.rpcCall(addServerCertificate, $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "AddServerCertificate" }); - - /** - * Calls AddServerCertificate. - * @function addServerCertificate - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest} request SqlInstancesAddServerCertificateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|addEntraIdCertificate}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef AddEntraIdCertificateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls AddEntraIdCertificate. - * @function addEntraIdCertificate - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest} request SqlInstancesAddEntraIdCertificateRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.AddEntraIdCertificateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.addEntraIdCertificate = function addEntraIdCertificate(request, callback) { - return this.rpcCall(addEntraIdCertificate, $root.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "AddEntraIdCertificate" }); - - /** - * Calls AddEntraIdCertificate. - * @function addEntraIdCertificate - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest} request SqlInstancesAddEntraIdCertificateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|clone}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef CloneCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Clone. - * @function clone - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest} request SqlInstancesCloneRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.CloneCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.clone = function clone(request, callback) { - return this.rpcCall(clone, $root.google.cloud.sql.v1beta4.SqlInstancesCloneRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Clone" }); - - /** - * Calls Clone. - * @function clone - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest} request SqlInstancesCloneRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|delete_}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef DeleteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest} request SqlInstancesDeleteRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype["delete"] = function delete_(request, callback) { - return this.rpcCall(delete_, $root.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Delete" }); - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest} request SqlInstancesDeleteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|demoteMaster}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef DemoteMasterCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls DemoteMaster. - * @function demoteMaster - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest} request SqlInstancesDemoteMasterRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.DemoteMasterCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.demoteMaster = function demoteMaster(request, callback) { - return this.rpcCall(demoteMaster, $root.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "DemoteMaster" }); - - /** - * Calls DemoteMaster. - * @function demoteMaster - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest} request SqlInstancesDemoteMasterRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|demote}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef DemoteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Demote. - * @function demote - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest} request SqlInstancesDemoteRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.DemoteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.demote = function demote(request, callback) { - return this.rpcCall(demote, $root.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Demote" }); - - /** - * Calls Demote. - * @function demote - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest} request SqlInstancesDemoteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|export_}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ExportCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Export. - * @function export - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest} request SqlInstancesExportRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ExportCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype["export"] = function export_(request, callback) { - return this.rpcCall(export_, $root.google.cloud.sql.v1beta4.SqlInstancesExportRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Export" }); - - /** - * Calls Export. - * @function export - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest} request SqlInstancesExportRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|failover}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef FailoverCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Failover. - * @function failover - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest} request SqlInstancesFailoverRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.FailoverCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.failover = function failover(request, callback) { - return this.rpcCall(failover, $root.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Failover" }); - - /** - * Calls Failover. - * @function failover - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest} request SqlInstancesFailoverRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|reencrypt}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ReencryptCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Reencrypt. - * @function reencrypt - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest} request SqlInstancesReencryptRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ReencryptCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.reencrypt = function reencrypt(request, callback) { - return this.rpcCall(reencrypt, $root.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Reencrypt" }); - - /** - * Calls Reencrypt. - * @function reencrypt - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest} request SqlInstancesReencryptRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|get}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.DatabaseInstance} [response] DatabaseInstance - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest} request SqlInstancesGetRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.GetCallback} callback Node-style callback called with the error, if any, and DatabaseInstance - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlInstancesGetRequest, $root.google.cloud.sql.v1beta4.DatabaseInstance, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest} request SqlInstancesGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|import_}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ImportCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Import. - * @function import - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest} request SqlInstancesImportRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ImportCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype["import"] = function import_(request, callback) { - return this.rpcCall(import_, $root.google.cloud.sql.v1beta4.SqlInstancesImportRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Import" }); - - /** - * Calls Import. - * @function import - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest} request SqlInstancesImportRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|insert}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef InsertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest} request SqlInstancesInsertRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.InsertCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.insert = function insert(request, callback) { - return this.rpcCall(insert, $root.google.cloud.sql.v1beta4.SqlInstancesInsertRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Insert" }); - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest} request SqlInstancesInsertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|list}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.InstancesListResponse} [response] InstancesListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest} request SqlInstancesListRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ListCallback} callback Node-style callback called with the error, if any, and InstancesListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlInstancesListRequest, $root.google.cloud.sql.v1beta4.InstancesListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest} request SqlInstancesListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listServerCas}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ListServerCasCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.InstancesListServerCasResponse} [response] InstancesListServerCasResponse - */ - - /** - * Calls ListServerCas. - * @function listServerCas - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest} request SqlInstancesListServerCasRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ListServerCasCallback} callback Node-style callback called with the error, if any, and InstancesListServerCasResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.listServerCas = function listServerCas(request, callback) { - return this.rpcCall(listServerCas, $root.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest, $root.google.cloud.sql.v1beta4.InstancesListServerCasResponse, request, callback); - }, "name", { value: "ListServerCas" }); - - /** - * Calls ListServerCas. - * @function listServerCas - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest} request SqlInstancesListServerCasRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listServerCertificates}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ListServerCertificatesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} [response] InstancesListServerCertificatesResponse - */ - - /** - * Calls ListServerCertificates. - * @function listServerCertificates - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest} request SqlInstancesListServerCertificatesRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ListServerCertificatesCallback} callback Node-style callback called with the error, if any, and InstancesListServerCertificatesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.listServerCertificates = function listServerCertificates(request, callback) { - return this.rpcCall(listServerCertificates, $root.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest, $root.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse, request, callback); - }, "name", { value: "ListServerCertificates" }); - - /** - * Calls ListServerCertificates. - * @function listServerCertificates - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest} request SqlInstancesListServerCertificatesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|listEntraIdCertificates}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ListEntraIdCertificatesCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} [response] InstancesListEntraIdCertificatesResponse - */ - - /** - * Calls ListEntraIdCertificates. - * @function listEntraIdCertificates - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest} request SqlInstancesListEntraIdCertificatesRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ListEntraIdCertificatesCallback} callback Node-style callback called with the error, if any, and InstancesListEntraIdCertificatesResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.listEntraIdCertificates = function listEntraIdCertificates(request, callback) { - return this.rpcCall(listEntraIdCertificates, $root.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest, $root.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse, request, callback); - }, "name", { value: "ListEntraIdCertificates" }); - - /** - * Calls ListEntraIdCertificates. - * @function listEntraIdCertificates - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest} request SqlInstancesListEntraIdCertificatesRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|patch}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef PatchCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Patch. - * @function patch - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest} request SqlInstancesPatchRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.PatchCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.patch = function patch(request, callback) { - return this.rpcCall(patch, $root.google.cloud.sql.v1beta4.SqlInstancesPatchRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Patch" }); - - /** - * Calls Patch. - * @function patch - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest} request SqlInstancesPatchRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|promoteReplica}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef PromoteReplicaCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls PromoteReplica. - * @function promoteReplica - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest} request SqlInstancesPromoteReplicaRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.PromoteReplicaCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.promoteReplica = function promoteReplica(request, callback) { - return this.rpcCall(promoteReplica, $root.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "PromoteReplica" }); - - /** - * Calls PromoteReplica. - * @function promoteReplica - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest} request SqlInstancesPromoteReplicaRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|switchover}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef SwitchoverCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Switchover. - * @function switchover - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest} request SqlInstancesSwitchoverRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.SwitchoverCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.switchover = function switchover(request, callback) { - return this.rpcCall(switchover, $root.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Switchover" }); - - /** - * Calls Switchover. - * @function switchover - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest} request SqlInstancesSwitchoverRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|resetSslConfig}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ResetSslConfigCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls ResetSslConfig. - * @function resetSslConfig - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest} request SqlInstancesResetSslConfigRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ResetSslConfigCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.resetSslConfig = function resetSslConfig(request, callback) { - return this.rpcCall(resetSslConfig, $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "ResetSslConfig" }); - - /** - * Calls ResetSslConfig. - * @function resetSslConfig - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest} request SqlInstancesResetSslConfigRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|restart}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef RestartCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Restart. - * @function restart - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest} request SqlInstancesRestartRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.RestartCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.restart = function restart(request, callback) { - return this.rpcCall(restart, $root.google.cloud.sql.v1beta4.SqlInstancesRestartRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Restart" }); - - /** - * Calls Restart. - * @function restart - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest} request SqlInstancesRestartRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|restoreBackup}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef RestoreBackupCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls RestoreBackup. - * @function restoreBackup - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest} request SqlInstancesRestoreBackupRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.RestoreBackupCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.restoreBackup = function restoreBackup(request, callback) { - return this.rpcCall(restoreBackup, $root.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "RestoreBackup" }); - - /** - * Calls RestoreBackup. - * @function restoreBackup - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest} request SqlInstancesRestoreBackupRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateServerCa}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef RotateServerCaCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls RotateServerCa. - * @function rotateServerCa - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest} request SqlInstancesRotateServerCaRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCaCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.rotateServerCa = function rotateServerCa(request, callback) { - return this.rpcCall(rotateServerCa, $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "RotateServerCa" }); - - /** - * Calls RotateServerCa. - * @function rotateServerCa - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest} request SqlInstancesRotateServerCaRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateServerCertificate}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef RotateServerCertificateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls RotateServerCertificate. - * @function rotateServerCertificate - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest} request SqlInstancesRotateServerCertificateRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCertificateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.rotateServerCertificate = function rotateServerCertificate(request, callback) { - return this.rpcCall(rotateServerCertificate, $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "RotateServerCertificate" }); - - /** - * Calls RotateServerCertificate. - * @function rotateServerCertificate - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest} request SqlInstancesRotateServerCertificateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rotateEntraIdCertificate}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef RotateEntraIdCertificateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls RotateEntraIdCertificate. - * @function rotateEntraIdCertificate - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest} request SqlInstancesRotateEntraIdCertificateRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.RotateEntraIdCertificateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.rotateEntraIdCertificate = function rotateEntraIdCertificate(request, callback) { - return this.rpcCall(rotateEntraIdCertificate, $root.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "RotateEntraIdCertificate" }); - - /** - * Calls RotateEntraIdCertificate. - * @function rotateEntraIdCertificate - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest} request SqlInstancesRotateEntraIdCertificateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|startReplica}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef StartReplicaCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls StartReplica. - * @function startReplica - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest} request SqlInstancesStartReplicaRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.StartReplicaCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.startReplica = function startReplica(request, callback) { - return this.rpcCall(startReplica, $root.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "StartReplica" }); - - /** - * Calls StartReplica. - * @function startReplica - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest} request SqlInstancesStartReplicaRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|stopReplica}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef StopReplicaCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls StopReplica. - * @function stopReplica - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest} request SqlInstancesStopReplicaRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.StopReplicaCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.stopReplica = function stopReplica(request, callback) { - return this.rpcCall(stopReplica, $root.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "StopReplica" }); - - /** - * Calls StopReplica. - * @function stopReplica - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest} request SqlInstancesStopReplicaRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|truncateLog}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef TruncateLogCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls TruncateLog. - * @function truncateLog - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest} request SqlInstancesTruncateLogRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.TruncateLogCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.truncateLog = function truncateLog(request, callback) { - return this.rpcCall(truncateLog, $root.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "TruncateLog" }); - - /** - * Calls TruncateLog. - * @function truncateLog - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest} request SqlInstancesTruncateLogRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|update}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef UpdateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest} request SqlInstancesUpdateRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.update = function update(request, callback) { - return this.rpcCall(update, $root.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Update" }); - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest} request SqlInstancesUpdateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|createEphemeral}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef CreateEphemeralCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.SslCert} [response] SslCert - */ - - /** - * Calls CreateEphemeral. - * @function createEphemeral - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest} request SqlInstancesCreateEphemeralCertRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.CreateEphemeralCallback} callback Node-style callback called with the error, if any, and SslCert - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.createEphemeral = function createEphemeral(request, callback) { - return this.rpcCall(createEphemeral, $root.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest, $root.google.cloud.sql.v1beta4.SslCert, request, callback); - }, "name", { value: "CreateEphemeral" }); - - /** - * Calls CreateEphemeral. - * @function createEphemeral - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest} request SqlInstancesCreateEphemeralCertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|rescheduleMaintenance}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef RescheduleMaintenanceCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls RescheduleMaintenance. - * @function rescheduleMaintenance - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest} request SqlInstancesRescheduleMaintenanceRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.RescheduleMaintenanceCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.rescheduleMaintenance = function rescheduleMaintenance(request, callback) { - return this.rpcCall(rescheduleMaintenance, $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "RescheduleMaintenance" }); - - /** - * Calls RescheduleMaintenance. - * @function rescheduleMaintenance - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest} request SqlInstancesRescheduleMaintenanceRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|verifyExternalSyncSettings}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef VerifyExternalSyncSettingsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} [response] SqlInstancesVerifyExternalSyncSettingsResponse - */ - - /** - * Calls VerifyExternalSyncSettings. - * @function verifyExternalSyncSettings - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest} request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.VerifyExternalSyncSettingsCallback} callback Node-style callback called with the error, if any, and SqlInstancesVerifyExternalSyncSettingsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.verifyExternalSyncSettings = function verifyExternalSyncSettings(request, callback) { - return this.rpcCall(verifyExternalSyncSettings, $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest, $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse, request, callback); - }, "name", { value: "VerifyExternalSyncSettings" }); - - /** - * Calls VerifyExternalSyncSettings. - * @function verifyExternalSyncSettings - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest} request SqlInstancesVerifyExternalSyncSettingsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|startExternalSync}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef StartExternalSyncCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls StartExternalSync. - * @function startExternalSync - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest} request SqlInstancesStartExternalSyncRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.StartExternalSyncCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.startExternalSync = function startExternalSync(request, callback) { - return this.rpcCall(startExternalSync, $root.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "StartExternalSync" }); - - /** - * Calls StartExternalSync. - * @function startExternalSync - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest} request SqlInstancesStartExternalSyncRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|performDiskShrink}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef PerformDiskShrinkCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls PerformDiskShrink. - * @function performDiskShrink - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest} request SqlInstancesPerformDiskShrinkRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.PerformDiskShrinkCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.performDiskShrink = function performDiskShrink(request, callback) { - return this.rpcCall(performDiskShrink, $root.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "PerformDiskShrink" }); - - /** - * Calls PerformDiskShrink. - * @function performDiskShrink - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest} request SqlInstancesPerformDiskShrinkRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|getDiskShrinkConfig}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef GetDiskShrinkConfigCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} [response] SqlInstancesGetDiskShrinkConfigResponse - */ - - /** - * Calls GetDiskShrinkConfig. - * @function getDiskShrinkConfig - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest} request SqlInstancesGetDiskShrinkConfigRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.GetDiskShrinkConfigCallback} callback Node-style callback called with the error, if any, and SqlInstancesGetDiskShrinkConfigResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.getDiskShrinkConfig = function getDiskShrinkConfig(request, callback) { - return this.rpcCall(getDiskShrinkConfig, $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest, $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse, request, callback); - }, "name", { value: "GetDiskShrinkConfig" }); - - /** - * Calls GetDiskShrinkConfig. - * @function getDiskShrinkConfig - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest} request SqlInstancesGetDiskShrinkConfigRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|resetReplicaSize}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ResetReplicaSizeCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls ResetReplicaSize. - * @function resetReplicaSize - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest} request SqlInstancesResetReplicaSizeRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ResetReplicaSizeCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.resetReplicaSize = function resetReplicaSize(request, callback) { - return this.rpcCall(resetReplicaSize, $root.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "ResetReplicaSize" }); - - /** - * Calls ResetReplicaSize. - * @function resetReplicaSize - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest} request SqlInstancesResetReplicaSizeRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|getLatestRecoveryTime}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef GetLatestRecoveryTimeCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} [response] SqlInstancesGetLatestRecoveryTimeResponse - */ - - /** - * Calls GetLatestRecoveryTime. - * @function getLatestRecoveryTime - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest} request SqlInstancesGetLatestRecoveryTimeRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.GetLatestRecoveryTimeCallback} callback Node-style callback called with the error, if any, and SqlInstancesGetLatestRecoveryTimeResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.getLatestRecoveryTime = function getLatestRecoveryTime(request, callback) { - return this.rpcCall(getLatestRecoveryTime, $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest, $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse, request, callback); - }, "name", { value: "GetLatestRecoveryTime" }); - - /** - * Calls GetLatestRecoveryTime. - * @function getLatestRecoveryTime - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest} request SqlInstancesGetLatestRecoveryTimeRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|executeSql}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ExecuteSqlCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} [response] SqlInstancesExecuteSqlResponse - */ - - /** - * Calls ExecuteSql. - * @function executeSql - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest} request SqlInstancesExecuteSqlRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ExecuteSqlCallback} callback Node-style callback called with the error, if any, and SqlInstancesExecuteSqlResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.executeSql = function executeSql(request, callback) { - return this.rpcCall(executeSql, $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest, $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse, request, callback); - }, "name", { value: "ExecuteSql" }); - - /** - * Calls ExecuteSql. - * @function executeSql - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest} request SqlInstancesExecuteSqlRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|acquireSsrsLease}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef AcquireSsrsLeaseCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} [response] SqlInstancesAcquireSsrsLeaseResponse - */ - - /** - * Calls AcquireSsrsLease. - * @function acquireSsrsLease - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest} request SqlInstancesAcquireSsrsLeaseRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.AcquireSsrsLeaseCallback} callback Node-style callback called with the error, if any, and SqlInstancesAcquireSsrsLeaseResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.acquireSsrsLease = function acquireSsrsLease(request, callback) { - return this.rpcCall(acquireSsrsLease, $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest, $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse, request, callback); - }, "name", { value: "AcquireSsrsLease" }); - - /** - * Calls AcquireSsrsLease. - * @function acquireSsrsLease - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest} request SqlInstancesAcquireSsrsLeaseRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|releaseSsrsLease}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef ReleaseSsrsLeaseCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} [response] SqlInstancesReleaseSsrsLeaseResponse - */ - - /** - * Calls ReleaseSsrsLease. - * @function releaseSsrsLease - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest} request SqlInstancesReleaseSsrsLeaseRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.ReleaseSsrsLeaseCallback} callback Node-style callback called with the error, if any, and SqlInstancesReleaseSsrsLeaseResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.releaseSsrsLease = function releaseSsrsLease(request, callback) { - return this.rpcCall(releaseSsrsLease, $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest, $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse, request, callback); - }, "name", { value: "ReleaseSsrsLease" }); - - /** - * Calls ReleaseSsrsLease. - * @function releaseSsrsLease - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest} request SqlInstancesReleaseSsrsLeaseRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|preCheckMajorVersionUpgrade}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef PreCheckMajorVersionUpgradeCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls PreCheckMajorVersionUpgrade. - * @function preCheckMajorVersionUpgrade - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest} request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.PreCheckMajorVersionUpgradeCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.preCheckMajorVersionUpgrade = function preCheckMajorVersionUpgrade(request, callback) { - return this.rpcCall(preCheckMajorVersionUpgrade, $root.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "PreCheckMajorVersionUpgrade" }); - - /** - * Calls PreCheckMajorVersionUpgrade. - * @function preCheckMajorVersionUpgrade - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest} request SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlInstancesService|pointInTimeRestore}. - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @typedef PointInTimeRestoreCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls PointInTimeRestore. - * @function pointInTimeRestore - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest} request SqlInstancesPointInTimeRestoreRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlInstancesService.PointInTimeRestoreCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlInstancesService.prototype.pointInTimeRestore = function pointInTimeRestore(request, callback) { - return this.rpcCall(pointInTimeRestore, $root.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "PointInTimeRestore" }); - - /** - * Calls PointInTimeRestore. - * @function pointInTimeRestore - * @memberof google.cloud.sql.v1beta4.SqlInstancesService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest} request SqlInstancesPointInTimeRestoreRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlInstancesService; - })(); - - v1beta4.SqlOperationsService = (function() { - - /** - * Constructs a new SqlOperationsService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlOperationsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlOperationsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlOperationsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlOperationsService; - - /** - * Creates new SqlOperationsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlOperationsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlOperationsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlOperationsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|get}. - * @memberof google.cloud.sql.v1beta4.SqlOperationsService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest} request SqlOperationsGetRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlOperationsService.GetCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlOperationsService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlOperationsGetRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest} request SqlOperationsGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|list}. - * @memberof google.cloud.sql.v1beta4.SqlOperationsService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.OperationsListResponse} [response] OperationsListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest} request SqlOperationsListRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlOperationsService.ListCallback} callback Node-style callback called with the error, if any, and OperationsListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlOperationsService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlOperationsListRequest, $root.google.cloud.sql.v1beta4.OperationsListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest} request SqlOperationsListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlOperationsService|cancel}. - * @memberof google.cloud.sql.v1beta4.SqlOperationsService - * @typedef CancelCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.protobuf.Empty} [response] Empty - */ - - /** - * Calls Cancel. - * @function cancel - * @memberof google.cloud.sql.v1beta4.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest} request SqlOperationsCancelRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlOperationsService.CancelCallback} callback Node-style callback called with the error, if any, and Empty - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlOperationsService.prototype.cancel = function cancel(request, callback) { - return this.rpcCall(cancel, $root.google.cloud.sql.v1beta4.SqlOperationsCancelRequest, $root.google.protobuf.Empty, request, callback); - }, "name", { value: "Cancel" }); - - /** - * Calls Cancel. - * @function cancel - * @memberof google.cloud.sql.v1beta4.SqlOperationsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest} request SqlOperationsCancelRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlOperationsService; - })(); - - v1beta4.SqlSslCertsService = (function() { - - /** - * Constructs a new SqlSslCertsService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlSslCertsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlSslCertsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlSslCertsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlSslCertsService; - - /** - * Creates new SqlSslCertsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlSslCertsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlSslCertsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|delete_}. - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @typedef DeleteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest} request SqlSslCertsDeleteRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlSslCertsService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlSslCertsService.prototype["delete"] = function delete_(request, callback) { - return this.rpcCall(delete_, $root.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Delete" }); - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest} request SqlSslCertsDeleteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|get}. - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.SslCert} [response] SslCert - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest} request SqlSslCertsGetRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlSslCertsService.GetCallback} callback Node-style callback called with the error, if any, and SslCert - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlSslCertsService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlSslCertsGetRequest, $root.google.cloud.sql.v1beta4.SslCert, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest} request SqlSslCertsGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|insert}. - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @typedef InsertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.SslCertsInsertResponse} [response] SslCertsInsertResponse - */ - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest} request SqlSslCertsInsertRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlSslCertsService.InsertCallback} callback Node-style callback called with the error, if any, and SslCertsInsertResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlSslCertsService.prototype.insert = function insert(request, callback) { - return this.rpcCall(insert, $root.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest, $root.google.cloud.sql.v1beta4.SslCertsInsertResponse, request, callback); - }, "name", { value: "Insert" }); - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest} request SqlSslCertsInsertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlSslCertsService|list}. - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.SslCertsListResponse} [response] SslCertsListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest} request SqlSslCertsListRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlSslCertsService.ListCallback} callback Node-style callback called with the error, if any, and SslCertsListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlSslCertsService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlSslCertsListRequest, $root.google.cloud.sql.v1beta4.SslCertsListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlSslCertsService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest} request SqlSslCertsListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlSslCertsService; - })(); - - v1beta4.SqlBackupsService = (function() { - - /** - * Constructs a new SqlBackupsService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlBackupsService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlBackupsService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlBackupsService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlBackupsService; - - /** - * Creates new SqlBackupsService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlBackupsService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlBackupsService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|createBackup}. - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @typedef CreateBackupCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls CreateBackup. - * @function createBackup - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1beta4.ICreateBackupRequest} request CreateBackupRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlBackupsService.CreateBackupCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupsService.prototype.createBackup = function createBackup(request, callback) { - return this.rpcCall(createBackup, $root.google.cloud.sql.v1beta4.CreateBackupRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "CreateBackup" }); - - /** - * Calls CreateBackup. - * @function createBackup - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1beta4.ICreateBackupRequest} request CreateBackupRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|getBackup}. - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @typedef GetBackupCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Backup} [response] Backup - */ - - /** - * Calls GetBackup. - * @function getBackup - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1beta4.IGetBackupRequest} request GetBackupRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlBackupsService.GetBackupCallback} callback Node-style callback called with the error, if any, and Backup - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupsService.prototype.getBackup = function getBackup(request, callback) { - return this.rpcCall(getBackup, $root.google.cloud.sql.v1beta4.GetBackupRequest, $root.google.cloud.sql.v1beta4.Backup, request, callback); - }, "name", { value: "GetBackup" }); - - /** - * Calls GetBackup. - * @function getBackup - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1beta4.IGetBackupRequest} request GetBackupRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|listBackups}. - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @typedef ListBackupsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.ListBackupsResponse} [response] ListBackupsResponse - */ - - /** - * Calls ListBackups. - * @function listBackups - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1beta4.IListBackupsRequest} request ListBackupsRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlBackupsService.ListBackupsCallback} callback Node-style callback called with the error, if any, and ListBackupsResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupsService.prototype.listBackups = function listBackups(request, callback) { - return this.rpcCall(listBackups, $root.google.cloud.sql.v1beta4.ListBackupsRequest, $root.google.cloud.sql.v1beta4.ListBackupsResponse, request, callback); - }, "name", { value: "ListBackups" }); - - /** - * Calls ListBackups. - * @function listBackups - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1beta4.IListBackupsRequest} request ListBackupsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|updateBackup}. - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @typedef UpdateBackupCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls UpdateBackup. - * @function updateBackup - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest} request UpdateBackupRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlBackupsService.UpdateBackupCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupsService.prototype.updateBackup = function updateBackup(request, callback) { - return this.rpcCall(updateBackup, $root.google.cloud.sql.v1beta4.UpdateBackupRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "UpdateBackup" }); - - /** - * Calls UpdateBackup. - * @function updateBackup - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest} request UpdateBackupRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlBackupsService|deleteBackup}. - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @typedef DeleteBackupCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls DeleteBackup. - * @function deleteBackup - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest} request DeleteBackupRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlBackupsService.DeleteBackupCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlBackupsService.prototype.deleteBackup = function deleteBackup(request, callback) { - return this.rpcCall(deleteBackup, $root.google.cloud.sql.v1beta4.DeleteBackupRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "DeleteBackup" }); - - /** - * Calls DeleteBackup. - * @function deleteBackup - * @memberof google.cloud.sql.v1beta4.SqlBackupsService - * @instance - * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest} request DeleteBackupRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlBackupsService; - })(); - - v1beta4.CreateBackupRequest = (function() { - - /** - * Properties of a CreateBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ICreateBackupRequest - * @property {string|null} [parent] CreateBackupRequest parent - * @property {google.cloud.sql.v1beta4.IBackup|null} [backup] CreateBackupRequest backup - */ - - /** - * Constructs a new CreateBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a CreateBackupRequest. - * @implements ICreateBackupRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ICreateBackupRequest=} [properties] Properties to set - */ - function CreateBackupRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CreateBackupRequest parent. - * @member {string} parent - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @instance - */ - CreateBackupRequest.prototype.parent = ""; - - /** - * CreateBackupRequest backup. - * @member {google.cloud.sql.v1beta4.IBackup|null|undefined} backup - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @instance - */ - CreateBackupRequest.prototype.backup = null; - - /** - * Creates a new CreateBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.ICreateBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.CreateBackupRequest} CreateBackupRequest instance - */ - CreateBackupRequest.create = function create(properties) { - return new CreateBackupRequest(properties); - }; - - /** - * Encodes the specified CreateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.CreateBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.ICreateBackupRequest} message CreateBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) - $root.google.cloud.sql.v1beta4.Backup.encode(message.backup, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CreateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.CreateBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.ICreateBackupRequest} message CreateBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CreateBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CreateBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.CreateBackupRequest} CreateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.CreateBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.backup = $root.google.cloud.sql.v1beta4.Backup.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CreateBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.CreateBackupRequest} CreateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CreateBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CreateBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CreateBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.backup != null && message.hasOwnProperty("backup")) { - var error = $root.google.cloud.sql.v1beta4.Backup.verify(message.backup); - if (error) - return "backup." + error; - } - return null; - }; - - /** - * Creates a CreateBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.CreateBackupRequest} CreateBackupRequest - */ - CreateBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.CreateBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.CreateBackupRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.backup != null) { - if (typeof object.backup !== "object") - throw TypeError(".google.cloud.sql.v1beta4.CreateBackupRequest.backup: object expected"); - message.backup = $root.google.cloud.sql.v1beta4.Backup.fromObject(object.backup); - } - return message; - }; - - /** - * Creates a plain object from a CreateBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.CreateBackupRequest} message CreateBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CreateBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.backup = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.backup != null && message.hasOwnProperty("backup")) - object.backup = $root.google.cloud.sql.v1beta4.Backup.toObject(message.backup, options); - return object; - }; - - /** - * Converts this CreateBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @instance - * @returns {Object.} JSON object - */ - CreateBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CreateBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.CreateBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CreateBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.CreateBackupRequest"; - }; - - return CreateBackupRequest; - })(); - - v1beta4.GetBackupRequest = (function() { - - /** - * Properties of a GetBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IGetBackupRequest - * @property {string|null} [name] GetBackupRequest name - */ - - /** - * Constructs a new GetBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a GetBackupRequest. - * @implements IGetBackupRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IGetBackupRequest=} [properties] Properties to set - */ - function GetBackupRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetBackupRequest name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @instance - */ - GetBackupRequest.prototype.name = ""; - - /** - * Creates a new GetBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IGetBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.GetBackupRequest} GetBackupRequest instance - */ - GetBackupRequest.create = function create(properties) { - return new GetBackupRequest(properties); - }; - - /** - * Encodes the specified GetBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GetBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IGetBackupRequest} message GetBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified GetBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GetBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IGetBackupRequest} message GetBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.GetBackupRequest} GetBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.GetBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.GetBackupRequest} GetBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a GetBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.GetBackupRequest} GetBackupRequest - */ - GetBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.GetBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.GetBackupRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a GetBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.GetBackupRequest} message GetBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this GetBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @instance - * @returns {Object.} JSON object - */ - GetBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.GetBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.GetBackupRequest"; - }; - - return GetBackupRequest; - })(); - - v1beta4.ListBackupsRequest = (function() { - - /** - * Properties of a ListBackupsRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IListBackupsRequest - * @property {string|null} [parent] ListBackupsRequest parent - * @property {number|null} [pageSize] ListBackupsRequest pageSize - * @property {string|null} [pageToken] ListBackupsRequest pageToken - * @property {string|null} [filter] ListBackupsRequest filter - */ - - /** - * Constructs a new ListBackupsRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a ListBackupsRequest. - * @implements IListBackupsRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IListBackupsRequest=} [properties] Properties to set - */ - function ListBackupsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListBackupsRequest parent. - * @member {string} parent - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @instance - */ - ListBackupsRequest.prototype.parent = ""; - - /** - * ListBackupsRequest pageSize. - * @member {number} pageSize - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @instance - */ - ListBackupsRequest.prototype.pageSize = 0; - - /** - * ListBackupsRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @instance - */ - ListBackupsRequest.prototype.pageToken = ""; - - /** - * ListBackupsRequest filter. - * @member {string} filter - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @instance - */ - ListBackupsRequest.prototype.filter = ""; - - /** - * Creates a new ListBackupsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @static - * @param {google.cloud.sql.v1beta4.IListBackupsRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ListBackupsRequest} ListBackupsRequest instance - */ - ListBackupsRequest.create = function create(properties) { - return new ListBackupsRequest(properties); - }; - - /** - * Encodes the specified ListBackupsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @static - * @param {google.cloud.sql.v1beta4.IListBackupsRequest} message ListBackupsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListBackupsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.filter); - return writer; - }; - - /** - * Encodes the specified ListBackupsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @static - * @param {google.cloud.sql.v1beta4.IListBackupsRequest} message ListBackupsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListBackupsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListBackupsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ListBackupsRequest} ListBackupsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListBackupsRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ListBackupsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 2: { - message.pageSize = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - case 4: { - message.filter = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListBackupsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ListBackupsRequest} ListBackupsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListBackupsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListBackupsRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListBackupsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - if (!$util.isInteger(message.pageSize)) - return "pageSize: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - return null; - }; - - /** - * Creates a ListBackupsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ListBackupsRequest} ListBackupsRequest - */ - ListBackupsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ListBackupsRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.ListBackupsRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.pageSize != null) - message.pageSize = object.pageSize | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.filter != null) - message.filter = String(object.filter); - return message; - }; - - /** - * Creates a plain object from a ListBackupsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @static - * @param {google.cloud.sql.v1beta4.ListBackupsRequest} message ListBackupsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListBackupsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.pageSize = 0; - object.pageToken = ""; - object.filter = ""; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.pageSize != null && message.hasOwnProperty("pageSize")) - object.pageSize = message.pageSize; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - return object; - }; - - /** - * Converts this ListBackupsRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @instance - * @returns {Object.} JSON object - */ - ListBackupsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListBackupsRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ListBackupsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListBackupsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ListBackupsRequest"; - }; - - return ListBackupsRequest; - })(); - - v1beta4.ListBackupsResponse = (function() { - - /** - * Properties of a ListBackupsResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IListBackupsResponse - * @property {Array.|null} [backups] ListBackupsResponse backups - * @property {string|null} [nextPageToken] ListBackupsResponse nextPageToken - * @property {Array.|null} [warnings] ListBackupsResponse warnings - */ - - /** - * Constructs a new ListBackupsResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a ListBackupsResponse. - * @implements IListBackupsResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IListBackupsResponse=} [properties] Properties to set - */ - function ListBackupsResponse(properties) { - this.backups = []; - this.warnings = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ListBackupsResponse backups. - * @member {Array.} backups - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @instance - */ - ListBackupsResponse.prototype.backups = $util.emptyArray; - - /** - * ListBackupsResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @instance - */ - ListBackupsResponse.prototype.nextPageToken = ""; - - /** - * ListBackupsResponse warnings. - * @member {Array.} warnings - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @instance - */ - ListBackupsResponse.prototype.warnings = $util.emptyArray; - - /** - * Creates a new ListBackupsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @static - * @param {google.cloud.sql.v1beta4.IListBackupsResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ListBackupsResponse} ListBackupsResponse instance - */ - ListBackupsResponse.create = function create(properties) { - return new ListBackupsResponse(properties); - }; - - /** - * Encodes the specified ListBackupsResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @static - * @param {google.cloud.sql.v1beta4.IListBackupsResponse} message ListBackupsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListBackupsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.backups != null && message.backups.length) - for (var i = 0; i < message.backups.length; ++i) - $root.google.cloud.sql.v1beta4.Backup.encode(message.backups[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); - if (message.warnings != null && message.warnings.length) - for (var i = 0; i < message.warnings.length; ++i) - $root.google.cloud.sql.v1beta4.ApiWarning.encode(message.warnings[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ListBackupsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ListBackupsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @static - * @param {google.cloud.sql.v1beta4.IListBackupsResponse} message ListBackupsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ListBackupsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ListBackupsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ListBackupsResponse} ListBackupsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListBackupsResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ListBackupsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.backups && message.backups.length)) - message.backups = []; - message.backups.push($root.google.cloud.sql.v1beta4.Backup.decode(reader, reader.uint32())); - break; - } - case 2: { - message.nextPageToken = reader.string(); - break; - } - case 3: { - if (!(message.warnings && message.warnings.length)) - message.warnings = []; - message.warnings.push($root.google.cloud.sql.v1beta4.ApiWarning.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ListBackupsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ListBackupsResponse} ListBackupsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ListBackupsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ListBackupsResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ListBackupsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.backups != null && message.hasOwnProperty("backups")) { - if (!Array.isArray(message.backups)) - return "backups: array expected"; - for (var i = 0; i < message.backups.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.Backup.verify(message.backups[i]); - if (error) - return "backups." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - if (message.warnings != null && message.hasOwnProperty("warnings")) { - if (!Array.isArray(message.warnings)) - return "warnings: array expected"; - for (var i = 0; i < message.warnings.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.ApiWarning.verify(message.warnings[i]); - if (error) - return "warnings." + error; - } - } - return null; - }; - - /** - * Creates a ListBackupsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ListBackupsResponse} ListBackupsResponse - */ - ListBackupsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ListBackupsResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.ListBackupsResponse(); - if (object.backups) { - if (!Array.isArray(object.backups)) - throw TypeError(".google.cloud.sql.v1beta4.ListBackupsResponse.backups: array expected"); - message.backups = []; - for (var i = 0; i < object.backups.length; ++i) { - if (typeof object.backups[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ListBackupsResponse.backups: object expected"); - message.backups[i] = $root.google.cloud.sql.v1beta4.Backup.fromObject(object.backups[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - if (object.warnings) { - if (!Array.isArray(object.warnings)) - throw TypeError(".google.cloud.sql.v1beta4.ListBackupsResponse.warnings: array expected"); - message.warnings = []; - for (var i = 0; i < object.warnings.length; ++i) { - if (typeof object.warnings[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ListBackupsResponse.warnings: object expected"); - message.warnings[i] = $root.google.cloud.sql.v1beta4.ApiWarning.fromObject(object.warnings[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ListBackupsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @static - * @param {google.cloud.sql.v1beta4.ListBackupsResponse} message ListBackupsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ListBackupsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.backups = []; - object.warnings = []; - } - if (options.defaults) - object.nextPageToken = ""; - if (message.backups && message.backups.length) { - object.backups = []; - for (var j = 0; j < message.backups.length; ++j) - object.backups[j] = $root.google.cloud.sql.v1beta4.Backup.toObject(message.backups[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - if (message.warnings && message.warnings.length) { - object.warnings = []; - for (var j = 0; j < message.warnings.length; ++j) - object.warnings[j] = $root.google.cloud.sql.v1beta4.ApiWarning.toObject(message.warnings[j], options); - } - return object; - }; - - /** - * Converts this ListBackupsResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @instance - * @returns {Object.} JSON object - */ - ListBackupsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ListBackupsResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ListBackupsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ListBackupsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ListBackupsResponse"; - }; - - return ListBackupsResponse; - })(); - - v1beta4.UpdateBackupRequest = (function() { - - /** - * Properties of an UpdateBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IUpdateBackupRequest - * @property {google.cloud.sql.v1beta4.IBackup|null} [backup] UpdateBackupRequest backup - * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateBackupRequest updateMask - */ - - /** - * Constructs a new UpdateBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an UpdateBackupRequest. - * @implements IUpdateBackupRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest=} [properties] Properties to set - */ - function UpdateBackupRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UpdateBackupRequest backup. - * @member {google.cloud.sql.v1beta4.IBackup|null|undefined} backup - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @instance - */ - UpdateBackupRequest.prototype.backup = null; - - /** - * UpdateBackupRequest updateMask. - * @member {google.protobuf.IFieldMask|null|undefined} updateMask - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @instance - */ - UpdateBackupRequest.prototype.updateMask = null; - - /** - * Creates a new UpdateBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.UpdateBackupRequest} UpdateBackupRequest instance - */ - UpdateBackupRequest.create = function create(properties) { - return new UpdateBackupRequest(properties); - }; - - /** - * Encodes the specified UpdateBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.UpdateBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest} message UpdateBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) - $root.google.cloud.sql.v1beta4.Backup.encode(message.backup, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) - $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified UpdateBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UpdateBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IUpdateBackupRequest} message UpdateBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UpdateBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UpdateBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.UpdateBackupRequest} UpdateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.UpdateBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.backup = $root.google.cloud.sql.v1beta4.Backup.decode(reader, reader.uint32()); - break; - } - case 2: { - message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UpdateBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.UpdateBackupRequest} UpdateBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UpdateBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UpdateBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UpdateBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.backup != null && message.hasOwnProperty("backup")) { - var error = $root.google.cloud.sql.v1beta4.Backup.verify(message.backup); - if (error) - return "backup." + error; - } - if (message.updateMask != null && message.hasOwnProperty("updateMask")) { - var error = $root.google.protobuf.FieldMask.verify(message.updateMask); - if (error) - return "updateMask." + error; - } - return null; - }; - - /** - * Creates an UpdateBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.UpdateBackupRequest} UpdateBackupRequest - */ - UpdateBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.UpdateBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.UpdateBackupRequest(); - if (object.backup != null) { - if (typeof object.backup !== "object") - throw TypeError(".google.cloud.sql.v1beta4.UpdateBackupRequest.backup: object expected"); - message.backup = $root.google.cloud.sql.v1beta4.Backup.fromObject(object.backup); - } - if (object.updateMask != null) { - if (typeof object.updateMask !== "object") - throw TypeError(".google.cloud.sql.v1beta4.UpdateBackupRequest.updateMask: object expected"); - message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); - } - return message; - }; - - /** - * Creates a plain object from an UpdateBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.UpdateBackupRequest} message UpdateBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UpdateBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.backup = null; - object.updateMask = null; - } - if (message.backup != null && message.hasOwnProperty("backup")) - object.backup = $root.google.cloud.sql.v1beta4.Backup.toObject(message.backup, options); - if (message.updateMask != null && message.hasOwnProperty("updateMask")) - object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); - return object; - }; - - /** - * Converts this UpdateBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @instance - * @returns {Object.} JSON object - */ - UpdateBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UpdateBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.UpdateBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UpdateBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.UpdateBackupRequest"; - }; - - return UpdateBackupRequest; - })(); - - v1beta4.DeleteBackupRequest = (function() { - - /** - * Properties of a DeleteBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IDeleteBackupRequest - * @property {string|null} [name] DeleteBackupRequest name - */ - - /** - * Constructs a new DeleteBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DeleteBackupRequest. - * @implements IDeleteBackupRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest=} [properties] Properties to set - */ - function DeleteBackupRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DeleteBackupRequest name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @instance - */ - DeleteBackupRequest.prototype.name = ""; - - /** - * Creates a new DeleteBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DeleteBackupRequest} DeleteBackupRequest instance - */ - DeleteBackupRequest.create = function create(properties) { - return new DeleteBackupRequest(properties); - }; - - /** - * Encodes the specified DeleteBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.DeleteBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest} message DeleteBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - return writer; - }; - - /** - * Encodes the specified DeleteBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DeleteBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IDeleteBackupRequest} message DeleteBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DeleteBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DeleteBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DeleteBackupRequest} DeleteBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DeleteBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DeleteBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DeleteBackupRequest} DeleteBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DeleteBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DeleteBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DeleteBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a DeleteBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DeleteBackupRequest} DeleteBackupRequest - */ - DeleteBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DeleteBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.DeleteBackupRequest(); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a DeleteBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.DeleteBackupRequest} message DeleteBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DeleteBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.name = ""; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this DeleteBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @instance - * @returns {Object.} JSON object - */ - DeleteBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DeleteBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DeleteBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DeleteBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DeleteBackupRequest"; - }; - - return DeleteBackupRequest; - })(); - - v1beta4.SqlBackupRunsDeleteRequest = (function() { - - /** - * Properties of a SqlBackupRunsDeleteRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlBackupRunsDeleteRequest - * @property {number|Long|null} [id] SqlBackupRunsDeleteRequest id - * @property {string|null} [instance] SqlBackupRunsDeleteRequest instance - * @property {string|null} [project] SqlBackupRunsDeleteRequest project - */ - - /** - * Constructs a new SqlBackupRunsDeleteRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlBackupRunsDeleteRequest. - * @implements ISqlBackupRunsDeleteRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest=} [properties] Properties to set - */ - function SqlBackupRunsDeleteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBackupRunsDeleteRequest id. - * @member {number|Long} id - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @instance - */ - SqlBackupRunsDeleteRequest.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * SqlBackupRunsDeleteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @instance - */ - SqlBackupRunsDeleteRequest.prototype.instance = ""; - - /** - * SqlBackupRunsDeleteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @instance - */ - SqlBackupRunsDeleteRequest.prototype.project = ""; - - /** - * Creates a new SqlBackupRunsDeleteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest instance - */ - SqlBackupRunsDeleteRequest.create = function create(properties) { - return new SqlBackupRunsDeleteRequest(properties); - }; - - /** - * Encodes the specified SqlBackupRunsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsDeleteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlBackupRunsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsDeleteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.id = reader.int64(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBackupRunsDeleteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsDeleteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBackupRunsDeleteRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBackupRunsDeleteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) - return "id: integer|Long expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlBackupRunsDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest} SqlBackupRunsDeleteRequest - */ - SqlBackupRunsDeleteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(); - if (object.id != null) - if ($util.Long) - (message.id = $util.Long.fromValue(object.id)).unsigned = false; - else if (typeof object.id === "string") - message.id = parseInt(object.id, 10); - else if (typeof object.id === "number") - message.id = object.id; - else if (typeof object.id === "object") - message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlBackupRunsDeleteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest} message SqlBackupRunsDeleteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBackupRunsDeleteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.id = options.longs === String ? "0" : 0; - object.instance = ""; - object.project = ""; - } - if (message.id != null && message.hasOwnProperty("id")) - if (typeof message.id === "number") - object.id = options.longs === String ? String(message.id) : message.id; - else - object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlBackupRunsDeleteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlBackupRunsDeleteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBackupRunsDeleteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBackupRunsDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest"; - }; - - return SqlBackupRunsDeleteRequest; - })(); - - v1beta4.SqlBackupRunsGetRequest = (function() { - - /** - * Properties of a SqlBackupRunsGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlBackupRunsGetRequest - * @property {number|Long|null} [id] SqlBackupRunsGetRequest id - * @property {string|null} [instance] SqlBackupRunsGetRequest instance - * @property {string|null} [project] SqlBackupRunsGetRequest project - */ - - /** - * Constructs a new SqlBackupRunsGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlBackupRunsGetRequest. - * @implements ISqlBackupRunsGetRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest=} [properties] Properties to set - */ - function SqlBackupRunsGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBackupRunsGetRequest id. - * @member {number|Long} id - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @instance - */ - SqlBackupRunsGetRequest.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * SqlBackupRunsGetRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @instance - */ - SqlBackupRunsGetRequest.prototype.instance = ""; - - /** - * SqlBackupRunsGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @instance - */ - SqlBackupRunsGetRequest.prototype.project = ""; - - /** - * Creates a new SqlBackupRunsGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest instance - */ - SqlBackupRunsGetRequest.create = function create(properties) { - return new SqlBackupRunsGetRequest(properties); - }; - - /** - * Encodes the specified SqlBackupRunsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest} message SqlBackupRunsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.id); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlBackupRunsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest} message SqlBackupRunsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.id = reader.int64(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBackupRunsGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBackupRunsGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBackupRunsGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) - return "id: integer|Long expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlBackupRunsGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsGetRequest} SqlBackupRunsGetRequest - */ - SqlBackupRunsGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(); - if (object.id != null) - if ($util.Long) - (message.id = $util.Long.fromValue(object.id)).unsigned = false; - else if (typeof object.id === "string") - message.id = parseInt(object.id, 10); - else if (typeof object.id === "number") - message.id = object.id; - else if (typeof object.id === "object") - message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlBackupRunsGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlBackupRunsGetRequest} message SqlBackupRunsGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBackupRunsGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.id = options.longs === String ? "0" : 0; - object.instance = ""; - object.project = ""; - } - if (message.id != null && message.hasOwnProperty("id")) - if (typeof message.id === "number") - object.id = options.longs === String ? String(message.id) : message.id; - else - object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlBackupRunsGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlBackupRunsGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBackupRunsGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBackupRunsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlBackupRunsGetRequest"; - }; - - return SqlBackupRunsGetRequest; - })(); - - v1beta4.SqlBackupRunsInsertRequest = (function() { - - /** - * Properties of a SqlBackupRunsInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlBackupRunsInsertRequest - * @property {string|null} [instance] SqlBackupRunsInsertRequest instance - * @property {string|null} [project] SqlBackupRunsInsertRequest project - * @property {google.cloud.sql.v1beta4.IBackupRun|null} [body] SqlBackupRunsInsertRequest body - */ - - /** - * Constructs a new SqlBackupRunsInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlBackupRunsInsertRequest. - * @implements ISqlBackupRunsInsertRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest=} [properties] Properties to set - */ - function SqlBackupRunsInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBackupRunsInsertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @instance - */ - SqlBackupRunsInsertRequest.prototype.instance = ""; - - /** - * SqlBackupRunsInsertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @instance - */ - SqlBackupRunsInsertRequest.prototype.project = ""; - - /** - * SqlBackupRunsInsertRequest body. - * @member {google.cloud.sql.v1beta4.IBackupRun|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @instance - */ - SqlBackupRunsInsertRequest.prototype.body = null; - - /** - * Creates a new SqlBackupRunsInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest instance - */ - SqlBackupRunsInsertRequest.create = function create(properties) { - return new SqlBackupRunsInsertRequest(properties); - }; - - /** - * Encodes the specified SqlBackupRunsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.BackupRun.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlBackupRunsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.BackupRun.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBackupRunsInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBackupRunsInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBackupRunsInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.BackupRun.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlBackupRunsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest} SqlBackupRunsInsertRequest - */ - SqlBackupRunsInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.BackupRun.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlBackupRunsInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest} message SqlBackupRunsInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBackupRunsInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.BackupRun.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlBackupRunsInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlBackupRunsInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBackupRunsInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBackupRunsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest"; - }; - - return SqlBackupRunsInsertRequest; - })(); - - v1beta4.SqlBackupRunsListRequest = (function() { - - /** - * Properties of a SqlBackupRunsListRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlBackupRunsListRequest - * @property {string|null} [instance] SqlBackupRunsListRequest instance - * @property {number|null} [maxResults] SqlBackupRunsListRequest maxResults - * @property {string|null} [pageToken] SqlBackupRunsListRequest pageToken - * @property {string|null} [project] SqlBackupRunsListRequest project - */ - - /** - * Constructs a new SqlBackupRunsListRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlBackupRunsListRequest. - * @implements ISqlBackupRunsListRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest=} [properties] Properties to set - */ - function SqlBackupRunsListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBackupRunsListRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @instance - */ - SqlBackupRunsListRequest.prototype.instance = ""; - - /** - * SqlBackupRunsListRequest maxResults. - * @member {number} maxResults - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @instance - */ - SqlBackupRunsListRequest.prototype.maxResults = 0; - - /** - * SqlBackupRunsListRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @instance - */ - SqlBackupRunsListRequest.prototype.pageToken = ""; - - /** - * SqlBackupRunsListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @instance - */ - SqlBackupRunsListRequest.prototype.project = ""; - - /** - * Creates a new SqlBackupRunsListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsListRequest} SqlBackupRunsListRequest instance - */ - SqlBackupRunsListRequest.create = function create(properties) { - return new SqlBackupRunsListRequest(properties); - }; - - /** - * Encodes the specified SqlBackupRunsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest} message SqlBackupRunsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.maxResults); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlBackupRunsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlBackupRunsListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlBackupRunsListRequest} message SqlBackupRunsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBackupRunsListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsListRequest} SqlBackupRunsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.maxResults = reader.int32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBackupRunsListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsListRequest} SqlBackupRunsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBackupRunsListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBackupRunsListRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBackupRunsListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlBackupRunsListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlBackupRunsListRequest} SqlBackupRunsListRequest - */ - SqlBackupRunsListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlBackupRunsListRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.maxResults != null) - message.maxResults = object.maxResults | 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlBackupRunsListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlBackupRunsListRequest} message SqlBackupRunsListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBackupRunsListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.maxResults = 0; - object.pageToken = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlBackupRunsListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlBackupRunsListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBackupRunsListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlBackupRunsListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBackupRunsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlBackupRunsListRequest"; - }; - - return SqlBackupRunsListRequest; - })(); - - v1beta4.SqlDatabasesDeleteRequest = (function() { - - /** - * Properties of a SqlDatabasesDeleteRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlDatabasesDeleteRequest - * @property {string|null} [database] SqlDatabasesDeleteRequest database - * @property {string|null} [instance] SqlDatabasesDeleteRequest instance - * @property {string|null} [project] SqlDatabasesDeleteRequest project - */ - - /** - * Constructs a new SqlDatabasesDeleteRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlDatabasesDeleteRequest. - * @implements ISqlDatabasesDeleteRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest=} [properties] Properties to set - */ - function SqlDatabasesDeleteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlDatabasesDeleteRequest database. - * @member {string} database - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @instance - */ - SqlDatabasesDeleteRequest.prototype.database = ""; - - /** - * SqlDatabasesDeleteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @instance - */ - SqlDatabasesDeleteRequest.prototype.instance = ""; - - /** - * SqlDatabasesDeleteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @instance - */ - SqlDatabasesDeleteRequest.prototype.project = ""; - - /** - * Creates a new SqlDatabasesDeleteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest instance - */ - SqlDatabasesDeleteRequest.create = function create(properties) { - return new SqlDatabasesDeleteRequest(properties); - }; - - /** - * Encodes the specified SqlDatabasesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesDeleteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlDatabasesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesDeleteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.database = reader.string(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlDatabasesDeleteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesDeleteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlDatabasesDeleteRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlDatabasesDeleteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlDatabasesDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest} SqlDatabasesDeleteRequest - */ - SqlDatabasesDeleteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(); - if (object.database != null) - message.database = String(object.database); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlDatabasesDeleteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest} message SqlDatabasesDeleteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlDatabasesDeleteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.database = ""; - object.instance = ""; - object.project = ""; - } - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlDatabasesDeleteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlDatabasesDeleteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlDatabasesDeleteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlDatabasesDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest"; - }; - - return SqlDatabasesDeleteRequest; - })(); - - v1beta4.SqlDatabasesGetRequest = (function() { - - /** - * Properties of a SqlDatabasesGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlDatabasesGetRequest - * @property {string|null} [database] SqlDatabasesGetRequest database - * @property {string|null} [instance] SqlDatabasesGetRequest instance - * @property {string|null} [project] SqlDatabasesGetRequest project - */ - - /** - * Constructs a new SqlDatabasesGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlDatabasesGetRequest. - * @implements ISqlDatabasesGetRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest=} [properties] Properties to set - */ - function SqlDatabasesGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlDatabasesGetRequest database. - * @member {string} database - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @instance - */ - SqlDatabasesGetRequest.prototype.database = ""; - - /** - * SqlDatabasesGetRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @instance - */ - SqlDatabasesGetRequest.prototype.instance = ""; - - /** - * SqlDatabasesGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @instance - */ - SqlDatabasesGetRequest.prototype.project = ""; - - /** - * Creates a new SqlDatabasesGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlDatabasesGetRequest} SqlDatabasesGetRequest instance - */ - SqlDatabasesGetRequest.create = function create(properties) { - return new SqlDatabasesGetRequest(properties); - }; - - /** - * Encodes the specified SqlDatabasesGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest} message SqlDatabasesGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlDatabasesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesGetRequest} message SqlDatabasesGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlDatabasesGetRequest} SqlDatabasesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.database = reader.string(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlDatabasesGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlDatabasesGetRequest} SqlDatabasesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlDatabasesGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlDatabasesGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlDatabasesGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlDatabasesGetRequest} SqlDatabasesGetRequest - */ - SqlDatabasesGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlDatabasesGetRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(); - if (object.database != null) - message.database = String(object.database); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlDatabasesGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlDatabasesGetRequest} message SqlDatabasesGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlDatabasesGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.database = ""; - object.instance = ""; - object.project = ""; - } - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlDatabasesGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlDatabasesGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlDatabasesGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlDatabasesGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlDatabasesGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlDatabasesGetRequest"; - }; - - return SqlDatabasesGetRequest; - })(); - - v1beta4.SqlDatabasesInsertRequest = (function() { - - /** - * Properties of a SqlDatabasesInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlDatabasesInsertRequest - * @property {string|null} [instance] SqlDatabasesInsertRequest instance - * @property {string|null} [project] SqlDatabasesInsertRequest project - * @property {google.cloud.sql.v1beta4.IDatabase|null} [body] SqlDatabasesInsertRequest body - */ - - /** - * Constructs a new SqlDatabasesInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlDatabasesInsertRequest. - * @implements ISqlDatabasesInsertRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest=} [properties] Properties to set - */ - function SqlDatabasesInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlDatabasesInsertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @instance - */ - SqlDatabasesInsertRequest.prototype.instance = ""; - - /** - * SqlDatabasesInsertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @instance - */ - SqlDatabasesInsertRequest.prototype.project = ""; - - /** - * SqlDatabasesInsertRequest body. - * @member {google.cloud.sql.v1beta4.IDatabase|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @instance - */ - SqlDatabasesInsertRequest.prototype.body = null; - - /** - * Creates a new SqlDatabasesInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest instance - */ - SqlDatabasesInsertRequest.create = function create(properties) { - return new SqlDatabasesInsertRequest(properties); - }; - - /** - * Encodes the specified SqlDatabasesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest} message SqlDatabasesInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.Database.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlDatabasesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest} message SqlDatabasesInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.Database.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlDatabasesInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlDatabasesInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlDatabasesInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.Database.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlDatabasesInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlDatabasesInsertRequest} SqlDatabasesInsertRequest - */ - SqlDatabasesInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlDatabasesInsertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.Database.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlDatabasesInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlDatabasesInsertRequest} message SqlDatabasesInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlDatabasesInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.Database.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlDatabasesInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlDatabasesInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlDatabasesInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlDatabasesInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlDatabasesInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlDatabasesInsertRequest"; - }; - - return SqlDatabasesInsertRequest; - })(); - - v1beta4.SqlDatabasesListRequest = (function() { - - /** - * Properties of a SqlDatabasesListRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlDatabasesListRequest - * @property {string|null} [instance] SqlDatabasesListRequest instance - * @property {string|null} [project] SqlDatabasesListRequest project - */ - - /** - * Constructs a new SqlDatabasesListRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlDatabasesListRequest. - * @implements ISqlDatabasesListRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest=} [properties] Properties to set - */ - function SqlDatabasesListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlDatabasesListRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @instance - */ - SqlDatabasesListRequest.prototype.instance = ""; - - /** - * SqlDatabasesListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @instance - */ - SqlDatabasesListRequest.prototype.project = ""; - - /** - * Creates a new SqlDatabasesListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlDatabasesListRequest} SqlDatabasesListRequest instance - */ - SqlDatabasesListRequest.create = function create(properties) { - return new SqlDatabasesListRequest(properties); - }; - - /** - * Encodes the specified SqlDatabasesListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest} message SqlDatabasesListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlDatabasesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesListRequest} message SqlDatabasesListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlDatabasesListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlDatabasesListRequest} SqlDatabasesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlDatabasesListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlDatabasesListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlDatabasesListRequest} SqlDatabasesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlDatabasesListRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlDatabasesListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlDatabasesListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlDatabasesListRequest} SqlDatabasesListRequest - */ - SqlDatabasesListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlDatabasesListRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlDatabasesListRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlDatabasesListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlDatabasesListRequest} message SqlDatabasesListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlDatabasesListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlDatabasesListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlDatabasesListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlDatabasesListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlDatabasesListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlDatabasesListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlDatabasesListRequest"; - }; - - return SqlDatabasesListRequest; - })(); - - v1beta4.SqlDatabasesUpdateRequest = (function() { - - /** - * Properties of a SqlDatabasesUpdateRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlDatabasesUpdateRequest - * @property {string|null} [database] SqlDatabasesUpdateRequest database - * @property {string|null} [instance] SqlDatabasesUpdateRequest instance - * @property {string|null} [project] SqlDatabasesUpdateRequest project - * @property {google.cloud.sql.v1beta4.IDatabase|null} [body] SqlDatabasesUpdateRequest body - */ - - /** - * Constructs a new SqlDatabasesUpdateRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlDatabasesUpdateRequest. - * @implements ISqlDatabasesUpdateRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest=} [properties] Properties to set - */ - function SqlDatabasesUpdateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlDatabasesUpdateRequest database. - * @member {string} database - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @instance - */ - SqlDatabasesUpdateRequest.prototype.database = ""; - - /** - * SqlDatabasesUpdateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @instance - */ - SqlDatabasesUpdateRequest.prototype.instance = ""; - - /** - * SqlDatabasesUpdateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @instance - */ - SqlDatabasesUpdateRequest.prototype.project = ""; - - /** - * SqlDatabasesUpdateRequest body. - * @member {google.cloud.sql.v1beta4.IDatabase|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @instance - */ - SqlDatabasesUpdateRequest.prototype.body = null; - - /** - * Creates a new SqlDatabasesUpdateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest instance - */ - SqlDatabasesUpdateRequest.create = function create(properties) { - return new SqlDatabasesUpdateRequest(properties); - }; - - /** - * Encodes the specified SqlDatabasesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesUpdateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.Database.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlDatabasesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlDatabasesUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesUpdateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.database = reader.string(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.Database.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlDatabasesUpdateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlDatabasesUpdateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlDatabasesUpdateRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlDatabasesUpdateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.Database.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlDatabasesUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest} SqlDatabasesUpdateRequest - */ - SqlDatabasesUpdateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(); - if (object.database != null) - message.database = String(object.database); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.Database.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlDatabasesUpdateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest} message SqlDatabasesUpdateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlDatabasesUpdateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.database = ""; - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.Database.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlDatabasesUpdateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlDatabasesUpdateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlDatabasesUpdateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlDatabasesUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest"; - }; - - return SqlDatabasesUpdateRequest; - })(); - - v1beta4.SqlFlagsListRequest = (function() { - - /** - * Properties of a SqlFlagsListRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlFlagsListRequest - * @property {string|null} [databaseVersion] SqlFlagsListRequest databaseVersion - * @property {google.cloud.sql.v1beta4.SqlFlagScope|null} [flagScope] SqlFlagsListRequest flagScope - */ - - /** - * Constructs a new SqlFlagsListRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlFlagsListRequest. - * @implements ISqlFlagsListRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest=} [properties] Properties to set - */ - function SqlFlagsListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlFlagsListRequest databaseVersion. - * @member {string} databaseVersion - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @instance - */ - SqlFlagsListRequest.prototype.databaseVersion = ""; - - /** - * SqlFlagsListRequest flagScope. - * @member {google.cloud.sql.v1beta4.SqlFlagScope|null|undefined} flagScope - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @instance - */ - SqlFlagsListRequest.prototype.flagScope = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlFlagsListRequest.prototype, "_flagScope", { - get: $util.oneOfGetter($oneOfFields = ["flagScope"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlFlagsListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlFlagsListRequest} SqlFlagsListRequest instance - */ - SqlFlagsListRequest.create = function create(properties) { - return new SqlFlagsListRequest(properties); - }; - - /** - * Encodes the specified SqlFlagsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlFlagsListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest} message SqlFlagsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlFlagsListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.databaseVersion); - if (message.flagScope != null && Object.hasOwnProperty.call(message, "flagScope")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.flagScope); - return writer; - }; - - /** - * Encodes the specified SqlFlagsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlFlagsListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlFlagsListRequest} message SqlFlagsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlFlagsListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlFlagsListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlFlagsListRequest} SqlFlagsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlFlagsListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlFlagsListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.databaseVersion = reader.string(); - break; - } - case 3: { - message.flagScope = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlFlagsListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlFlagsListRequest} SqlFlagsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlFlagsListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlFlagsListRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlFlagsListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - if (!$util.isString(message.databaseVersion)) - return "databaseVersion: string expected"; - if (message.flagScope != null && message.hasOwnProperty("flagScope")) { - properties._flagScope = 1; - switch (message.flagScope) { - default: - return "flagScope: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - return null; - }; - - /** - * Creates a SqlFlagsListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlFlagsListRequest} SqlFlagsListRequest - */ - SqlFlagsListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlFlagsListRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlFlagsListRequest(); - if (object.databaseVersion != null) - message.databaseVersion = String(object.databaseVersion); - switch (object.flagScope) { - default: - if (typeof object.flagScope === "number") { - message.flagScope = object.flagScope; - break; - } - break; - case "SQL_FLAG_SCOPE_UNSPECIFIED": - case 0: - message.flagScope = 0; - break; - case "SQL_FLAG_SCOPE_DATABASE": - case 1: - message.flagScope = 1; - break; - case "SQL_FLAG_SCOPE_CONNECTION_POOL": - case 2: - message.flagScope = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a SqlFlagsListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlFlagsListRequest} message SqlFlagsListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlFlagsListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.databaseVersion = ""; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - object.databaseVersion = message.databaseVersion; - if (message.flagScope != null && message.hasOwnProperty("flagScope")) { - object.flagScope = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlFlagScope[message.flagScope] === undefined ? message.flagScope : $root.google.cloud.sql.v1beta4.SqlFlagScope[message.flagScope] : message.flagScope; - if (options.oneofs) - object._flagScope = "flagScope"; - } - return object; - }; - - /** - * Converts this SqlFlagsListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlFlagsListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlFlagsListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlFlagsListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlFlagsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlFlagsListRequest"; - }; - - return SqlFlagsListRequest; - })(); - - v1beta4.SqlInstancesAddServerCaRequest = (function() { - - /** - * Properties of a SqlInstancesAddServerCaRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesAddServerCaRequest - * @property {string|null} [instance] SqlInstancesAddServerCaRequest instance - * @property {string|null} [project] SqlInstancesAddServerCaRequest project - */ - - /** - * Constructs a new SqlInstancesAddServerCaRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesAddServerCaRequest. - * @implements ISqlInstancesAddServerCaRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest=} [properties] Properties to set - */ - function SqlInstancesAddServerCaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesAddServerCaRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @instance - */ - SqlInstancesAddServerCaRequest.prototype.instance = ""; - - /** - * SqlInstancesAddServerCaRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @instance - */ - SqlInstancesAddServerCaRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesAddServerCaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest instance - */ - SqlInstancesAddServerCaRequest.create = function create(properties) { - return new SqlInstancesAddServerCaRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesAddServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddServerCaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesAddServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddServerCaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesAddServerCaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddServerCaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesAddServerCaRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesAddServerCaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesAddServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest} SqlInstancesAddServerCaRequest - */ - SqlInstancesAddServerCaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesAddServerCaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest} message SqlInstancesAddServerCaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesAddServerCaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesAddServerCaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesAddServerCaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesAddServerCaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesAddServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest"; - }; - - return SqlInstancesAddServerCaRequest; - })(); - - v1beta4.SqlInstancesAddServerCertificateRequest = (function() { - - /** - * Properties of a SqlInstancesAddServerCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesAddServerCertificateRequest - * @property {string|null} [instance] SqlInstancesAddServerCertificateRequest instance - * @property {string|null} [project] SqlInstancesAddServerCertificateRequest project - */ - - /** - * Constructs a new SqlInstancesAddServerCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesAddServerCertificateRequest. - * @implements ISqlInstancesAddServerCertificateRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest=} [properties] Properties to set - */ - function SqlInstancesAddServerCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesAddServerCertificateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @instance - */ - SqlInstancesAddServerCertificateRequest.prototype.instance = ""; - - /** - * SqlInstancesAddServerCertificateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @instance - */ - SqlInstancesAddServerCertificateRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesAddServerCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest instance - */ - SqlInstancesAddServerCertificateRequest.create = function create(properties) { - return new SqlInstancesAddServerCertificateRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesAddServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddServerCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesAddServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddServerCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesAddServerCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesAddServerCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesAddServerCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesAddServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest} SqlInstancesAddServerCertificateRequest - */ - SqlInstancesAddServerCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesAddServerCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest} message SqlInstancesAddServerCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesAddServerCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesAddServerCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesAddServerCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesAddServerCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesAddServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest"; - }; - - return SqlInstancesAddServerCertificateRequest; - })(); - - v1beta4.SqlInstancesAddEntraIdCertificateRequest = (function() { - - /** - * Properties of a SqlInstancesAddEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesAddEntraIdCertificateRequest - * @property {string|null} [instance] SqlInstancesAddEntraIdCertificateRequest instance - * @property {string|null} [project] SqlInstancesAddEntraIdCertificateRequest project - */ - - /** - * Constructs a new SqlInstancesAddEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesAddEntraIdCertificateRequest. - * @implements ISqlInstancesAddEntraIdCertificateRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest=} [properties] Properties to set - */ - function SqlInstancesAddEntraIdCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesAddEntraIdCertificateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @instance - */ - SqlInstancesAddEntraIdCertificateRequest.prototype.instance = ""; - - /** - * SqlInstancesAddEntraIdCertificateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @instance - */ - SqlInstancesAddEntraIdCertificateRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesAddEntraIdCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest instance - */ - SqlInstancesAddEntraIdCertificateRequest.create = function create(properties) { - return new SqlInstancesAddEntraIdCertificateRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddEntraIdCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesAddEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAddEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddEntraIdCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesAddEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAddEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesAddEntraIdCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesAddEntraIdCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesAddEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest} SqlInstancesAddEntraIdCertificateRequest - */ - SqlInstancesAddEntraIdCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesAddEntraIdCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest} message SqlInstancesAddEntraIdCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesAddEntraIdCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesAddEntraIdCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesAddEntraIdCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesAddEntraIdCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesAddEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest"; - }; - - return SqlInstancesAddEntraIdCertificateRequest; - })(); - - v1beta4.SqlInstancesCloneRequest = (function() { - - /** - * Properties of a SqlInstancesCloneRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesCloneRequest - * @property {string|null} [instance] SqlInstancesCloneRequest instance - * @property {string|null} [project] SqlInstancesCloneRequest project - * @property {google.cloud.sql.v1beta4.IInstancesCloneRequest|null} [body] SqlInstancesCloneRequest body - */ - - /** - * Constructs a new SqlInstancesCloneRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesCloneRequest. - * @implements ISqlInstancesCloneRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest=} [properties] Properties to set - */ - function SqlInstancesCloneRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesCloneRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @instance - */ - SqlInstancesCloneRequest.prototype.instance = ""; - - /** - * SqlInstancesCloneRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @instance - */ - SqlInstancesCloneRequest.prototype.project = ""; - - /** - * SqlInstancesCloneRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesCloneRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @instance - */ - SqlInstancesCloneRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesCloneRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesCloneRequest} SqlInstancesCloneRequest instance - */ - SqlInstancesCloneRequest.create = function create(properties) { - return new SqlInstancesCloneRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCloneRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest} message SqlInstancesCloneRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesCloneRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesCloneRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCloneRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesCloneRequest} message SqlInstancesCloneRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesCloneRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesCloneRequest} SqlInstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesCloneRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesCloneRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesCloneRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesCloneRequest} SqlInstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesCloneRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesCloneRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesCloneRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesCloneRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesCloneRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesCloneRequest} SqlInstancesCloneRequest - */ - SqlInstancesCloneRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesCloneRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesCloneRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesCloneRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesCloneRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesCloneRequest} message SqlInstancesCloneRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesCloneRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesCloneRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesCloneRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesCloneRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesCloneRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesCloneRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesCloneRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesCloneRequest"; - }; - - return SqlInstancesCloneRequest; - })(); - - v1beta4.SqlInstancesDeleteRequest = (function() { - - /** - * Properties of a SqlInstancesDeleteRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesDeleteRequest - * @property {string|null} [instance] SqlInstancesDeleteRequest instance - * @property {string|null} [project] SqlInstancesDeleteRequest project - * @property {boolean|null} [enableFinalBackup] SqlInstancesDeleteRequest enableFinalBackup - * @property {number|Long|null} [finalBackupTtlDays] SqlInstancesDeleteRequest finalBackupTtlDays - * @property {google.protobuf.ITimestamp|null} [finalBackupExpiryTime] SqlInstancesDeleteRequest finalBackupExpiryTime - * @property {string|null} [finalBackupDescription] SqlInstancesDeleteRequest finalBackupDescription - */ - - /** - * Constructs a new SqlInstancesDeleteRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesDeleteRequest. - * @implements ISqlInstancesDeleteRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest=} [properties] Properties to set - */ - function SqlInstancesDeleteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesDeleteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.instance = ""; - - /** - * SqlInstancesDeleteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.project = ""; - - /** - * SqlInstancesDeleteRequest enableFinalBackup. - * @member {boolean|null|undefined} enableFinalBackup - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.enableFinalBackup = null; - - /** - * SqlInstancesDeleteRequest finalBackupTtlDays. - * @member {number|Long|null|undefined} finalBackupTtlDays - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.finalBackupTtlDays = null; - - /** - * SqlInstancesDeleteRequest finalBackupExpiryTime. - * @member {google.protobuf.ITimestamp|null|undefined} finalBackupExpiryTime - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.finalBackupExpiryTime = null; - - /** - * SqlInstancesDeleteRequest finalBackupDescription. - * @member {string} finalBackupDescription - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @instance - */ - SqlInstancesDeleteRequest.prototype.finalBackupDescription = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlInstancesDeleteRequest.prototype, "_enableFinalBackup", { - get: $util.oneOfGetter($oneOfFields = ["enableFinalBackup"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * SqlInstancesDeleteRequest expiration. - * @member {"finalBackupTtlDays"|"finalBackupExpiryTime"|undefined} expiration - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @instance - */ - Object.defineProperty(SqlInstancesDeleteRequest.prototype, "expiration", { - get: $util.oneOfGetter($oneOfFields = ["finalBackupTtlDays", "finalBackupExpiryTime"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlInstancesDeleteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest instance - */ - SqlInstancesDeleteRequest.create = function create(properties) { - return new SqlInstancesDeleteRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDeleteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest} message SqlInstancesDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDeleteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.finalBackupTtlDays != null && Object.hasOwnProperty.call(message, "finalBackupTtlDays")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.finalBackupTtlDays); - if (message.finalBackupDescription != null && Object.hasOwnProperty.call(message, "finalBackupDescription")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.finalBackupDescription); - if (message.finalBackupExpiryTime != null && Object.hasOwnProperty.call(message, "finalBackupExpiryTime")) - $root.google.protobuf.Timestamp.encode(message.finalBackupExpiryTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.enableFinalBackup != null && Object.hasOwnProperty.call(message, "enableFinalBackup")) - writer.uint32(/* id 7, wireType 0 =*/56).bool(message.enableFinalBackup); - return writer; - }; - - /** - * Encodes the specified SqlInstancesDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDeleteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest} message SqlInstancesDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDeleteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 7: { - message.enableFinalBackup = reader.bool(); - break; - } - case 4: { - message.finalBackupTtlDays = reader.int64(); - break; - } - case 6: { - message.finalBackupExpiryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 5: { - message.finalBackupDescription = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesDeleteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDeleteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesDeleteRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesDeleteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.enableFinalBackup != null && message.hasOwnProperty("enableFinalBackup")) { - properties._enableFinalBackup = 1; - if (typeof message.enableFinalBackup !== "boolean") - return "enableFinalBackup: boolean expected"; - } - if (message.finalBackupTtlDays != null && message.hasOwnProperty("finalBackupTtlDays")) { - properties.expiration = 1; - if (!$util.isInteger(message.finalBackupTtlDays) && !(message.finalBackupTtlDays && $util.isInteger(message.finalBackupTtlDays.low) && $util.isInteger(message.finalBackupTtlDays.high))) - return "finalBackupTtlDays: integer|Long expected"; - } - if (message.finalBackupExpiryTime != null && message.hasOwnProperty("finalBackupExpiryTime")) { - if (properties.expiration === 1) - return "expiration: multiple values"; - properties.expiration = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.finalBackupExpiryTime); - if (error) - return "finalBackupExpiryTime." + error; - } - } - if (message.finalBackupDescription != null && message.hasOwnProperty("finalBackupDescription")) - if (!$util.isString(message.finalBackupDescription)) - return "finalBackupDescription: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesDeleteRequest} SqlInstancesDeleteRequest - */ - SqlInstancesDeleteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.enableFinalBackup != null) - message.enableFinalBackup = Boolean(object.enableFinalBackup); - if (object.finalBackupTtlDays != null) - if ($util.Long) - (message.finalBackupTtlDays = $util.Long.fromValue(object.finalBackupTtlDays)).unsigned = false; - else if (typeof object.finalBackupTtlDays === "string") - message.finalBackupTtlDays = parseInt(object.finalBackupTtlDays, 10); - else if (typeof object.finalBackupTtlDays === "number") - message.finalBackupTtlDays = object.finalBackupTtlDays; - else if (typeof object.finalBackupTtlDays === "object") - message.finalBackupTtlDays = new $util.LongBits(object.finalBackupTtlDays.low >>> 0, object.finalBackupTtlDays.high >>> 0).toNumber(); - if (object.finalBackupExpiryTime != null) { - if (typeof object.finalBackupExpiryTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesDeleteRequest.finalBackupExpiryTime: object expected"); - message.finalBackupExpiryTime = $root.google.protobuf.Timestamp.fromObject(object.finalBackupExpiryTime); - } - if (object.finalBackupDescription != null) - message.finalBackupDescription = String(object.finalBackupDescription); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesDeleteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesDeleteRequest} message SqlInstancesDeleteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesDeleteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.finalBackupDescription = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.finalBackupTtlDays != null && message.hasOwnProperty("finalBackupTtlDays")) { - if (typeof message.finalBackupTtlDays === "number") - object.finalBackupTtlDays = options.longs === String ? String(message.finalBackupTtlDays) : message.finalBackupTtlDays; - else - object.finalBackupTtlDays = options.longs === String ? $util.Long.prototype.toString.call(message.finalBackupTtlDays) : options.longs === Number ? new $util.LongBits(message.finalBackupTtlDays.low >>> 0, message.finalBackupTtlDays.high >>> 0).toNumber() : message.finalBackupTtlDays; - if (options.oneofs) - object.expiration = "finalBackupTtlDays"; - } - if (message.finalBackupDescription != null && message.hasOwnProperty("finalBackupDescription")) - object.finalBackupDescription = message.finalBackupDescription; - if (message.finalBackupExpiryTime != null && message.hasOwnProperty("finalBackupExpiryTime")) { - object.finalBackupExpiryTime = $root.google.protobuf.Timestamp.toObject(message.finalBackupExpiryTime, options); - if (options.oneofs) - object.expiration = "finalBackupExpiryTime"; - } - if (message.enableFinalBackup != null && message.hasOwnProperty("enableFinalBackup")) { - object.enableFinalBackup = message.enableFinalBackup; - if (options.oneofs) - object._enableFinalBackup = "enableFinalBackup"; - } - return object; - }; - - /** - * Converts this SqlInstancesDeleteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesDeleteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesDeleteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesDeleteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesDeleteRequest"; - }; - - return SqlInstancesDeleteRequest; - })(); - - v1beta4.SqlInstancesDemoteMasterRequest = (function() { - - /** - * Properties of a SqlInstancesDemoteMasterRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesDemoteMasterRequest - * @property {string|null} [instance] SqlInstancesDemoteMasterRequest instance - * @property {string|null} [project] SqlInstancesDemoteMasterRequest project - * @property {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest|null} [body] SqlInstancesDemoteMasterRequest body - */ - - /** - * Constructs a new SqlInstancesDemoteMasterRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesDemoteMasterRequest. - * @implements ISqlInstancesDemoteMasterRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest=} [properties] Properties to set - */ - function SqlInstancesDemoteMasterRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesDemoteMasterRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @instance - */ - SqlInstancesDemoteMasterRequest.prototype.instance = ""; - - /** - * SqlInstancesDemoteMasterRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @instance - */ - SqlInstancesDemoteMasterRequest.prototype.project = ""; - - /** - * SqlInstancesDemoteMasterRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @instance - */ - SqlInstancesDemoteMasterRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesDemoteMasterRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest instance - */ - SqlInstancesDemoteMasterRequest.create = function create(properties) { - return new SqlInstancesDemoteMasterRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDemoteMasterRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDemoteMasterRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDemoteMasterRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDemoteMasterRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesDemoteMasterRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesDemoteMasterRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest} SqlInstancesDemoteMasterRequest - */ - SqlInstancesDemoteMasterRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesDemoteMasterRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest} message SqlInstancesDemoteMasterRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesDemoteMasterRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesDemoteMasterRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesDemoteMasterRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesDemoteMasterRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesDemoteMasterRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest"; - }; - - return SqlInstancesDemoteMasterRequest; - })(); - - v1beta4.SqlInstancesDemoteRequest = (function() { - - /** - * Properties of a SqlInstancesDemoteRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesDemoteRequest - * @property {string|null} [instance] SqlInstancesDemoteRequest instance - * @property {string|null} [project] SqlInstancesDemoteRequest project - * @property {google.cloud.sql.v1beta4.IInstancesDemoteRequest|null} [body] SqlInstancesDemoteRequest body - */ - - /** - * Constructs a new SqlInstancesDemoteRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesDemoteRequest. - * @implements ISqlInstancesDemoteRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest=} [properties] Properties to set - */ - function SqlInstancesDemoteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesDemoteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @instance - */ - SqlInstancesDemoteRequest.prototype.instance = ""; - - /** - * SqlInstancesDemoteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @instance - */ - SqlInstancesDemoteRequest.prototype.project = ""; - - /** - * SqlInstancesDemoteRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesDemoteRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @instance - */ - SqlInstancesDemoteRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesDemoteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest instance - */ - SqlInstancesDemoteRequest.create = function create(properties) { - return new SqlInstancesDemoteRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest} message SqlInstancesDemoteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDemoteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesDemoteRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesDemoteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest} message SqlInstancesDemoteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesDemoteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDemoteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesDemoteRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesDemoteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesDemoteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesDemoteRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesDemoteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesDemoteRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesDemoteRequest} SqlInstancesDemoteRequest - */ - SqlInstancesDemoteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesDemoteRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesDemoteRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesDemoteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesDemoteRequest} message SqlInstancesDemoteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesDemoteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesDemoteRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesDemoteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesDemoteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesDemoteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesDemoteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesDemoteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesDemoteRequest"; - }; - - return SqlInstancesDemoteRequest; - })(); - - v1beta4.SqlInstancesExportRequest = (function() { - - /** - * Properties of a SqlInstancesExportRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesExportRequest - * @property {string|null} [instance] SqlInstancesExportRequest instance - * @property {string|null} [project] SqlInstancesExportRequest project - * @property {google.cloud.sql.v1beta4.IInstancesExportRequest|null} [body] SqlInstancesExportRequest body - */ - - /** - * Constructs a new SqlInstancesExportRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesExportRequest. - * @implements ISqlInstancesExportRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest=} [properties] Properties to set - */ - function SqlInstancesExportRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesExportRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @instance - */ - SqlInstancesExportRequest.prototype.instance = ""; - - /** - * SqlInstancesExportRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @instance - */ - SqlInstancesExportRequest.prototype.project = ""; - - /** - * SqlInstancesExportRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesExportRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @instance - */ - SqlInstancesExportRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesExportRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesExportRequest} SqlInstancesExportRequest instance - */ - SqlInstancesExportRequest.create = function create(properties) { - return new SqlInstancesExportRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExportRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest} message SqlInstancesExportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExportRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesExportRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExportRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesExportRequest} message SqlInstancesExportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExportRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesExportRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesExportRequest} SqlInstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExportRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesExportRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesExportRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesExportRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesExportRequest} SqlInstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExportRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesExportRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesExportRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesExportRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesExportRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesExportRequest} SqlInstancesExportRequest - */ - SqlInstancesExportRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesExportRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesExportRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExportRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesExportRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesExportRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesExportRequest} message SqlInstancesExportRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesExportRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesExportRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesExportRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesExportRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesExportRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesExportRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesExportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesExportRequest"; - }; - - return SqlInstancesExportRequest; - })(); - - v1beta4.SqlInstancesFailoverRequest = (function() { - - /** - * Properties of a SqlInstancesFailoverRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesFailoverRequest - * @property {string|null} [instance] SqlInstancesFailoverRequest instance - * @property {string|null} [project] SqlInstancesFailoverRequest project - * @property {google.cloud.sql.v1beta4.IInstancesFailoverRequest|null} [body] SqlInstancesFailoverRequest body - */ - - /** - * Constructs a new SqlInstancesFailoverRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesFailoverRequest. - * @implements ISqlInstancesFailoverRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest=} [properties] Properties to set - */ - function SqlInstancesFailoverRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesFailoverRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @instance - */ - SqlInstancesFailoverRequest.prototype.instance = ""; - - /** - * SqlInstancesFailoverRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @instance - */ - SqlInstancesFailoverRequest.prototype.project = ""; - - /** - * SqlInstancesFailoverRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesFailoverRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @instance - */ - SqlInstancesFailoverRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesFailoverRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest instance - */ - SqlInstancesFailoverRequest.create = function create(properties) { - return new SqlInstancesFailoverRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesFailoverRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest} message SqlInstancesFailoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesFailoverRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesFailoverRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesFailoverRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest} message SqlInstancesFailoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesFailoverRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesFailoverRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesFailoverRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesFailoverRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesFailoverRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesFailoverRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesFailoverRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesFailoverRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesFailoverRequest} SqlInstancesFailoverRequest - */ - SqlInstancesFailoverRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesFailoverRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesFailoverRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesFailoverRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesFailoverRequest} message SqlInstancesFailoverRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesFailoverRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesFailoverRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesFailoverRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesFailoverRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesFailoverRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesFailoverRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesFailoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesFailoverRequest"; - }; - - return SqlInstancesFailoverRequest; - })(); - - v1beta4.SqlInstancesGetRequest = (function() { - - /** - * Properties of a SqlInstancesGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesGetRequest - * @property {string|null} [instance] SqlInstancesGetRequest instance - * @property {string|null} [project] SqlInstancesGetRequest project - */ - - /** - * Constructs a new SqlInstancesGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesGetRequest. - * @implements ISqlInstancesGetRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest=} [properties] Properties to set - */ - function SqlInstancesGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesGetRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @instance - */ - SqlInstancesGetRequest.prototype.instance = ""; - - /** - * SqlInstancesGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @instance - */ - SqlInstancesGetRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetRequest} SqlInstancesGetRequest instance - */ - SqlInstancesGetRequest.create = function create(properties) { - return new SqlInstancesGetRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest} message SqlInstancesGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetRequest} message SqlInstancesGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetRequest} SqlInstancesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetRequest} SqlInstancesGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetRequest} SqlInstancesGetRequest - */ - SqlInstancesGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesGetRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesGetRequest} message SqlInstancesGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesGetRequest"; - }; - - return SqlInstancesGetRequest; - })(); - - v1beta4.SqlInstancesImportRequest = (function() { - - /** - * Properties of a SqlInstancesImportRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesImportRequest - * @property {string|null} [instance] SqlInstancesImportRequest instance - * @property {string|null} [project] SqlInstancesImportRequest project - * @property {google.cloud.sql.v1beta4.IInstancesImportRequest|null} [body] SqlInstancesImportRequest body - */ - - /** - * Constructs a new SqlInstancesImportRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesImportRequest. - * @implements ISqlInstancesImportRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest=} [properties] Properties to set - */ - function SqlInstancesImportRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesImportRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @instance - */ - SqlInstancesImportRequest.prototype.instance = ""; - - /** - * SqlInstancesImportRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @instance - */ - SqlInstancesImportRequest.prototype.project = ""; - - /** - * SqlInstancesImportRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesImportRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @instance - */ - SqlInstancesImportRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesImportRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesImportRequest} SqlInstancesImportRequest instance - */ - SqlInstancesImportRequest.create = function create(properties) { - return new SqlInstancesImportRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesImportRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest} message SqlInstancesImportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesImportRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesImportRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesImportRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesImportRequest} message SqlInstancesImportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesImportRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesImportRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesImportRequest} SqlInstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesImportRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesImportRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesImportRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesImportRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesImportRequest} SqlInstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesImportRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesImportRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesImportRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesImportRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesImportRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesImportRequest} SqlInstancesImportRequest - */ - SqlInstancesImportRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesImportRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesImportRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesImportRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesImportRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesImportRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesImportRequest} message SqlInstancesImportRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesImportRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesImportRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesImportRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesImportRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesImportRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesImportRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesImportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesImportRequest"; - }; - - return SqlInstancesImportRequest; - })(); - - v1beta4.SqlInstancesInsertRequest = (function() { - - /** - * Properties of a SqlInstancesInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesInsertRequest - * @property {string|null} [project] SqlInstancesInsertRequest project - * @property {google.cloud.sql.v1beta4.IDatabaseInstance|null} [body] SqlInstancesInsertRequest body - */ - - /** - * Constructs a new SqlInstancesInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesInsertRequest. - * @implements ISqlInstancesInsertRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest=} [properties] Properties to set - */ - function SqlInstancesInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesInsertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @instance - */ - SqlInstancesInsertRequest.prototype.project = ""; - - /** - * SqlInstancesInsertRequest body. - * @member {google.cloud.sql.v1beta4.IDatabaseInstance|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @instance - */ - SqlInstancesInsertRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesInsertRequest} SqlInstancesInsertRequest instance - */ - SqlInstancesInsertRequest.create = function create(properties) { - return new SqlInstancesInsertRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest} message SqlInstancesInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesInsertRequest} message SqlInstancesInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesInsertRequest} SqlInstancesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesInsertRequest} SqlInstancesInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesInsertRequest} SqlInstancesInsertRequest - */ - SqlInstancesInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesInsertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesInsertRequest} message SqlInstancesInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.project = ""; - object.body = null; - } - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesInsertRequest"; - }; - - return SqlInstancesInsertRequest; - })(); - - v1beta4.SqlInstancesListRequest = (function() { - - /** - * Properties of a SqlInstancesListRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesListRequest - * @property {string|null} [filter] SqlInstancesListRequest filter - * @property {number|null} [maxResults] SqlInstancesListRequest maxResults - * @property {string|null} [pageToken] SqlInstancesListRequest pageToken - * @property {string|null} [project] SqlInstancesListRequest project - */ - - /** - * Constructs a new SqlInstancesListRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesListRequest. - * @implements ISqlInstancesListRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest=} [properties] Properties to set - */ - function SqlInstancesListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesListRequest filter. - * @member {string} filter - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @instance - */ - SqlInstancesListRequest.prototype.filter = ""; - - /** - * SqlInstancesListRequest maxResults. - * @member {number} maxResults - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @instance - */ - SqlInstancesListRequest.prototype.maxResults = 0; - - /** - * SqlInstancesListRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @instance - */ - SqlInstancesListRequest.prototype.pageToken = ""; - - /** - * SqlInstancesListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @instance - */ - SqlInstancesListRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesListRequest} SqlInstancesListRequest instance - */ - SqlInstancesListRequest.create = function create(properties) { - return new SqlInstancesListRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest} message SqlInstancesListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.maxResults); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListRequest} message SqlInstancesListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesListRequest} SqlInstancesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.filter = reader.string(); - break; - } - case 2: { - message.maxResults = reader.uint32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesListRequest} SqlInstancesListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesListRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.filter != null && message.hasOwnProperty("filter")) - if (!$util.isString(message.filter)) - return "filter: string expected"; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesListRequest} SqlInstancesListRequest - */ - SqlInstancesListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesListRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesListRequest(); - if (object.filter != null) - message.filter = String(object.filter); - if (object.maxResults != null) - message.maxResults = object.maxResults >>> 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesListRequest} message SqlInstancesListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.filter = ""; - object.maxResults = 0; - object.pageToken = ""; - object.project = ""; - } - if (message.filter != null && message.hasOwnProperty("filter")) - object.filter = message.filter; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesListRequest"; - }; - - return SqlInstancesListRequest; - })(); - - v1beta4.SqlInstancesListServerCasRequest = (function() { - - /** - * Properties of a SqlInstancesListServerCasRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesListServerCasRequest - * @property {string|null} [instance] SqlInstancesListServerCasRequest instance - * @property {string|null} [project] SqlInstancesListServerCasRequest project - */ - - /** - * Constructs a new SqlInstancesListServerCasRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesListServerCasRequest. - * @implements ISqlInstancesListServerCasRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest=} [properties] Properties to set - */ - function SqlInstancesListServerCasRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesListServerCasRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @instance - */ - SqlInstancesListServerCasRequest.prototype.instance = ""; - - /** - * SqlInstancesListServerCasRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @instance - */ - SqlInstancesListServerCasRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesListServerCasRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest instance - */ - SqlInstancesListServerCasRequest.create = function create(properties) { - return new SqlInstancesListServerCasRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesListServerCasRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListServerCasRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesListServerCasRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListServerCasRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListServerCasRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesListServerCasRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListServerCasRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesListServerCasRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesListServerCasRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesListServerCasRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest} SqlInstancesListServerCasRequest - */ - SqlInstancesListServerCasRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesListServerCasRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest} message SqlInstancesListServerCasRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesListServerCasRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesListServerCasRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesListServerCasRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesListServerCasRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesListServerCasRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest"; - }; - - return SqlInstancesListServerCasRequest; - })(); - - v1beta4.SqlInstancesListServerCertificatesRequest = (function() { - - /** - * Properties of a SqlInstancesListServerCertificatesRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesListServerCertificatesRequest - * @property {string|null} [instance] SqlInstancesListServerCertificatesRequest instance - * @property {string|null} [project] SqlInstancesListServerCertificatesRequest project - */ - - /** - * Constructs a new SqlInstancesListServerCertificatesRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesListServerCertificatesRequest. - * @implements ISqlInstancesListServerCertificatesRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest=} [properties] Properties to set - */ - function SqlInstancesListServerCertificatesRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesListServerCertificatesRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @instance - */ - SqlInstancesListServerCertificatesRequest.prototype.instance = ""; - - /** - * SqlInstancesListServerCertificatesRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @instance - */ - SqlInstancesListServerCertificatesRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesListServerCertificatesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest instance - */ - SqlInstancesListServerCertificatesRequest.create = function create(properties) { - return new SqlInstancesListServerCertificatesRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesListServerCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListServerCertificatesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesListServerCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListServerCertificatesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListServerCertificatesRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesListServerCertificatesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListServerCertificatesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesListServerCertificatesRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesListServerCertificatesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesListServerCertificatesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest} SqlInstancesListServerCertificatesRequest - */ - SqlInstancesListServerCertificatesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesListServerCertificatesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest} message SqlInstancesListServerCertificatesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesListServerCertificatesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesListServerCertificatesRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesListServerCertificatesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesListServerCertificatesRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesListServerCertificatesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest"; - }; - - return SqlInstancesListServerCertificatesRequest; - })(); - - v1beta4.SqlInstancesListEntraIdCertificatesRequest = (function() { - - /** - * Properties of a SqlInstancesListEntraIdCertificatesRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesListEntraIdCertificatesRequest - * @property {string|null} [instance] SqlInstancesListEntraIdCertificatesRequest instance - * @property {string|null} [project] SqlInstancesListEntraIdCertificatesRequest project - */ - - /** - * Constructs a new SqlInstancesListEntraIdCertificatesRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesListEntraIdCertificatesRequest. - * @implements ISqlInstancesListEntraIdCertificatesRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest=} [properties] Properties to set - */ - function SqlInstancesListEntraIdCertificatesRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesListEntraIdCertificatesRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @instance - */ - SqlInstancesListEntraIdCertificatesRequest.prototype.instance = ""; - - /** - * SqlInstancesListEntraIdCertificatesRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @instance - */ - SqlInstancesListEntraIdCertificatesRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesListEntraIdCertificatesRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest instance - */ - SqlInstancesListEntraIdCertificatesRequest.create = function create(properties) { - return new SqlInstancesListEntraIdCertificatesRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListEntraIdCertificatesRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesListEntraIdCertificatesRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesListEntraIdCertificatesRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListEntraIdCertificatesRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesListEntraIdCertificatesRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesListEntraIdCertificatesRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesListEntraIdCertificatesRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesListEntraIdCertificatesRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesListEntraIdCertificatesRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest} SqlInstancesListEntraIdCertificatesRequest - */ - SqlInstancesListEntraIdCertificatesRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesListEntraIdCertificatesRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest} message SqlInstancesListEntraIdCertificatesRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesListEntraIdCertificatesRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesListEntraIdCertificatesRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesListEntraIdCertificatesRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesListEntraIdCertificatesRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesListEntraIdCertificatesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest"; - }; - - return SqlInstancesListEntraIdCertificatesRequest; - })(); - - v1beta4.SqlInstancesPatchRequest = (function() { - - /** - * Properties of a SqlInstancesPatchRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesPatchRequest - * @property {string|null} [instance] SqlInstancesPatchRequest instance - * @property {string|null} [project] SqlInstancesPatchRequest project - * @property {google.cloud.sql.v1beta4.IDatabaseInstance|null} [body] SqlInstancesPatchRequest body - */ - - /** - * Constructs a new SqlInstancesPatchRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesPatchRequest. - * @implements ISqlInstancesPatchRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest=} [properties] Properties to set - */ - function SqlInstancesPatchRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesPatchRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @instance - */ - SqlInstancesPatchRequest.prototype.instance = ""; - - /** - * SqlInstancesPatchRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @instance - */ - SqlInstancesPatchRequest.prototype.project = ""; - - /** - * SqlInstancesPatchRequest body. - * @member {google.cloud.sql.v1beta4.IDatabaseInstance|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @instance - */ - SqlInstancesPatchRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesPatchRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesPatchRequest} SqlInstancesPatchRequest instance - */ - SqlInstancesPatchRequest.create = function create(properties) { - return new SqlInstancesPatchRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesPatchRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPatchRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest} message SqlInstancesPatchRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPatchRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesPatchRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPatchRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPatchRequest} message SqlInstancesPatchRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPatchRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesPatchRequest} SqlInstancesPatchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPatchRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesPatchRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesPatchRequest} SqlInstancesPatchRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPatchRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesPatchRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesPatchRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesPatchRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesPatchRequest} SqlInstancesPatchRequest - */ - SqlInstancesPatchRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesPatchRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesPatchRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesPatchRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesPatchRequest} message SqlInstancesPatchRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesPatchRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesPatchRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesPatchRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesPatchRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesPatchRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesPatchRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesPatchRequest"; - }; - - return SqlInstancesPatchRequest; - })(); - - v1beta4.SqlInstancesPromoteReplicaRequest = (function() { - - /** - * Properties of a SqlInstancesPromoteReplicaRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesPromoteReplicaRequest - * @property {string|null} [instance] SqlInstancesPromoteReplicaRequest instance - * @property {string|null} [project] SqlInstancesPromoteReplicaRequest project - * @property {boolean|null} [failover] SqlInstancesPromoteReplicaRequest failover - */ - - /** - * Constructs a new SqlInstancesPromoteReplicaRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesPromoteReplicaRequest. - * @implements ISqlInstancesPromoteReplicaRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest=} [properties] Properties to set - */ - function SqlInstancesPromoteReplicaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesPromoteReplicaRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @instance - */ - SqlInstancesPromoteReplicaRequest.prototype.instance = ""; - - /** - * SqlInstancesPromoteReplicaRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @instance - */ - SqlInstancesPromoteReplicaRequest.prototype.project = ""; - - /** - * SqlInstancesPromoteReplicaRequest failover. - * @member {boolean} failover - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @instance - */ - SqlInstancesPromoteReplicaRequest.prototype.failover = false; - - /** - * Creates a new SqlInstancesPromoteReplicaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest instance - */ - SqlInstancesPromoteReplicaRequest.create = function create(properties) { - return new SqlInstancesPromoteReplicaRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesPromoteReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPromoteReplicaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.failover != null && Object.hasOwnProperty.call(message, "failover")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.failover); - return writer; - }; - - /** - * Encodes the specified SqlInstancesPromoteReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPromoteReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPromoteReplicaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.failover = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesPromoteReplicaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPromoteReplicaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesPromoteReplicaRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesPromoteReplicaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.failover != null && message.hasOwnProperty("failover")) - if (typeof message.failover !== "boolean") - return "failover: boolean expected"; - return null; - }; - - /** - * Creates a SqlInstancesPromoteReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest} SqlInstancesPromoteReplicaRequest - */ - SqlInstancesPromoteReplicaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.failover != null) - message.failover = Boolean(object.failover); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesPromoteReplicaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest} message SqlInstancesPromoteReplicaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesPromoteReplicaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.failover = false; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.failover != null && message.hasOwnProperty("failover")) - object.failover = message.failover; - return object; - }; - - /** - * Converts this SqlInstancesPromoteReplicaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesPromoteReplicaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesPromoteReplicaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesPromoteReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest"; - }; - - return SqlInstancesPromoteReplicaRequest; - })(); - - v1beta4.SqlInstancesSwitchoverRequest = (function() { - - /** - * Properties of a SqlInstancesSwitchoverRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesSwitchoverRequest - * @property {string|null} [instance] SqlInstancesSwitchoverRequest instance - * @property {string|null} [project] SqlInstancesSwitchoverRequest project - * @property {google.protobuf.IDuration|null} [dbTimeout] SqlInstancesSwitchoverRequest dbTimeout - */ - - /** - * Constructs a new SqlInstancesSwitchoverRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesSwitchoverRequest. - * @implements ISqlInstancesSwitchoverRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest=} [properties] Properties to set - */ - function SqlInstancesSwitchoverRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesSwitchoverRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @instance - */ - SqlInstancesSwitchoverRequest.prototype.instance = ""; - - /** - * SqlInstancesSwitchoverRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @instance - */ - SqlInstancesSwitchoverRequest.prototype.project = ""; - - /** - * SqlInstancesSwitchoverRequest dbTimeout. - * @member {google.protobuf.IDuration|null|undefined} dbTimeout - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @instance - */ - SqlInstancesSwitchoverRequest.prototype.dbTimeout = null; - - /** - * Creates a new SqlInstancesSwitchoverRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest instance - */ - SqlInstancesSwitchoverRequest.create = function create(properties) { - return new SqlInstancesSwitchoverRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesSwitchoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesSwitchoverRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.dbTimeout != null && Object.hasOwnProperty.call(message, "dbTimeout")) - $root.google.protobuf.Duration.encode(message.dbTimeout, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesSwitchoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesSwitchoverRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesSwitchoverRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.dbTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesSwitchoverRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesSwitchoverRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesSwitchoverRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesSwitchoverRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.dbTimeout != null && message.hasOwnProperty("dbTimeout")) { - var error = $root.google.protobuf.Duration.verify(message.dbTimeout); - if (error) - return "dbTimeout." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesSwitchoverRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest} SqlInstancesSwitchoverRequest - */ - SqlInstancesSwitchoverRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.dbTimeout != null) { - if (typeof object.dbTimeout !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest.dbTimeout: object expected"); - message.dbTimeout = $root.google.protobuf.Duration.fromObject(object.dbTimeout); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesSwitchoverRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest} message SqlInstancesSwitchoverRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesSwitchoverRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.dbTimeout = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.dbTimeout != null && message.hasOwnProperty("dbTimeout")) - object.dbTimeout = $root.google.protobuf.Duration.toObject(message.dbTimeout, options); - return object; - }; - - /** - * Converts this SqlInstancesSwitchoverRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesSwitchoverRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesSwitchoverRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesSwitchoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest"; - }; - - return SqlInstancesSwitchoverRequest; - })(); - - v1beta4.SqlInstancesResetSslConfigRequest = (function() { - - /** - * Properties of a SqlInstancesResetSslConfigRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesResetSslConfigRequest - * @property {string|null} [instance] SqlInstancesResetSslConfigRequest instance - * @property {string|null} [project] SqlInstancesResetSslConfigRequest project - * @property {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode|null} [mode] SqlInstancesResetSslConfigRequest mode - */ - - /** - * Constructs a new SqlInstancesResetSslConfigRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesResetSslConfigRequest. - * @implements ISqlInstancesResetSslConfigRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest=} [properties] Properties to set - */ - function SqlInstancesResetSslConfigRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesResetSslConfigRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @instance - */ - SqlInstancesResetSslConfigRequest.prototype.instance = ""; - - /** - * SqlInstancesResetSslConfigRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @instance - */ - SqlInstancesResetSslConfigRequest.prototype.project = ""; - - /** - * SqlInstancesResetSslConfigRequest mode. - * @member {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode} mode - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @instance - */ - SqlInstancesResetSslConfigRequest.prototype.mode = 0; - - /** - * Creates a new SqlInstancesResetSslConfigRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest instance - */ - SqlInstancesResetSslConfigRequest.create = function create(properties) { - return new SqlInstancesResetSslConfigRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesResetSslConfigRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesResetSslConfigRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mode); - return writer; - }; - - /** - * Encodes the specified SqlInstancesResetSslConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesResetSslConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesResetSslConfigRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.mode = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesResetSslConfigRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesResetSslConfigRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesResetSslConfigRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesResetSslConfigRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates a SqlInstancesResetSslConfigRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest} SqlInstancesResetSslConfigRequest - */ - SqlInstancesResetSslConfigRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - switch (object.mode) { - default: - if (typeof object.mode === "number") { - message.mode = object.mode; - break; - } - break; - case "RESET_SSL_MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "ALL": - case 1: - message.mode = 1; - break; - case "SYNC_FROM_PRIMARY": - case 2: - message.mode = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesResetSslConfigRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest} message SqlInstancesResetSslConfigRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesResetSslConfigRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.mode = options.enums === String ? "RESET_SSL_MODE_UNSPECIFIED" : 0; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode[message.mode] === undefined ? message.mode : $root.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode[message.mode] : message.mode; - return object; - }; - - /** - * Converts this SqlInstancesResetSslConfigRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesResetSslConfigRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesResetSslConfigRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesResetSslConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest"; - }; - - /** - * ResetSslMode enum. - * @name google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode - * @enum {number} - * @property {number} RESET_SSL_MODE_UNSPECIFIED=0 RESET_SSL_MODE_UNSPECIFIED value - * @property {number} ALL=1 ALL value - * @property {number} SYNC_FROM_PRIMARY=2 SYNC_FROM_PRIMARY value - */ - SqlInstancesResetSslConfigRequest.ResetSslMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RESET_SSL_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ALL"] = 1; - values[valuesById[2] = "SYNC_FROM_PRIMARY"] = 2; - return values; - })(); - - return SqlInstancesResetSslConfigRequest; - })(); - - v1beta4.SqlInstancesRestartRequest = (function() { - - /** - * Properties of a SqlInstancesRestartRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesRestartRequest - * @property {string|null} [instance] SqlInstancesRestartRequest instance - * @property {string|null} [project] SqlInstancesRestartRequest project - */ - - /** - * Constructs a new SqlInstancesRestartRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesRestartRequest. - * @implements ISqlInstancesRestartRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest=} [properties] Properties to set - */ - function SqlInstancesRestartRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRestartRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @instance - */ - SqlInstancesRestartRequest.prototype.instance = ""; - - /** - * SqlInstancesRestartRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @instance - */ - SqlInstancesRestartRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesRestartRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesRestartRequest} SqlInstancesRestartRequest instance - */ - SqlInstancesRestartRequest.create = function create(properties) { - return new SqlInstancesRestartRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRestartRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestartRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest} message SqlInstancesRestartRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRestartRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRestartRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestartRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestartRequest} message SqlInstancesRestartRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRestartRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesRestartRequest} SqlInstancesRestartRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRestartRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRestartRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesRestartRequest} SqlInstancesRestartRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRestartRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRestartRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRestartRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesRestartRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesRestartRequest} SqlInstancesRestartRequest - */ - SqlInstancesRestartRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRestartRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRestartRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRestartRequest} message SqlInstancesRestartRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRestartRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesRestartRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRestartRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRestartRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestartRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRestartRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRestartRequest"; - }; - - return SqlInstancesRestartRequest; - })(); - - v1beta4.SqlInstancesRestoreBackupRequest = (function() { - - /** - * Properties of a SqlInstancesRestoreBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesRestoreBackupRequest - * @property {string|null} [instance] SqlInstancesRestoreBackupRequest instance - * @property {string|null} [project] SqlInstancesRestoreBackupRequest project - * @property {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest|null} [body] SqlInstancesRestoreBackupRequest body - */ - - /** - * Constructs a new SqlInstancesRestoreBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesRestoreBackupRequest. - * @implements ISqlInstancesRestoreBackupRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest=} [properties] Properties to set - */ - function SqlInstancesRestoreBackupRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRestoreBackupRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @instance - */ - SqlInstancesRestoreBackupRequest.prototype.instance = ""; - - /** - * SqlInstancesRestoreBackupRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @instance - */ - SqlInstancesRestoreBackupRequest.prototype.project = ""; - - /** - * SqlInstancesRestoreBackupRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @instance - */ - SqlInstancesRestoreBackupRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesRestoreBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest instance - */ - SqlInstancesRestoreBackupRequest.create = function create(properties) { - return new SqlInstancesRestoreBackupRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRestoreBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRestoreBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRestoreBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRestoreBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRestoreBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRestoreBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest} SqlInstancesRestoreBackupRequest - */ - SqlInstancesRestoreBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRestoreBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest} message SqlInstancesRestoreBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRestoreBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesRestoreBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRestoreBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRestoreBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRestoreBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest"; - }; - - return SqlInstancesRestoreBackupRequest; - })(); - - v1beta4.SqlInstancesRotateServerCaRequest = (function() { - - /** - * Properties of a SqlInstancesRotateServerCaRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesRotateServerCaRequest - * @property {string|null} [instance] SqlInstancesRotateServerCaRequest instance - * @property {string|null} [project] SqlInstancesRotateServerCaRequest project - * @property {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest|null} [body] SqlInstancesRotateServerCaRequest body - */ - - /** - * Constructs a new SqlInstancesRotateServerCaRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesRotateServerCaRequest. - * @implements ISqlInstancesRotateServerCaRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest=} [properties] Properties to set - */ - function SqlInstancesRotateServerCaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRotateServerCaRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @instance - */ - SqlInstancesRotateServerCaRequest.prototype.instance = ""; - - /** - * SqlInstancesRotateServerCaRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @instance - */ - SqlInstancesRotateServerCaRequest.prototype.project = ""; - - /** - * SqlInstancesRotateServerCaRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @instance - */ - SqlInstancesRotateServerCaRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesRotateServerCaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest instance - */ - SqlInstancesRotateServerCaRequest.create = function create(properties) { - return new SqlInstancesRotateServerCaRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateServerCaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateServerCaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateServerCaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRotateServerCaRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRotateServerCaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest} SqlInstancesRotateServerCaRequest - */ - SqlInstancesRotateServerCaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRotateServerCaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest} message SqlInstancesRotateServerCaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRotateServerCaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesRotateServerCaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRotateServerCaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRotateServerCaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRotateServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest"; - }; - - return SqlInstancesRotateServerCaRequest; - })(); - - v1beta4.SqlInstancesRotateServerCertificateRequest = (function() { - - /** - * Properties of a SqlInstancesRotateServerCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesRotateServerCertificateRequest - * @property {string|null} [instance] SqlInstancesRotateServerCertificateRequest instance - * @property {string|null} [project] SqlInstancesRotateServerCertificateRequest project - * @property {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest|null} [body] SqlInstancesRotateServerCertificateRequest body - */ - - /** - * Constructs a new SqlInstancesRotateServerCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesRotateServerCertificateRequest. - * @implements ISqlInstancesRotateServerCertificateRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest=} [properties] Properties to set - */ - function SqlInstancesRotateServerCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRotateServerCertificateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @instance - */ - SqlInstancesRotateServerCertificateRequest.prototype.instance = ""; - - /** - * SqlInstancesRotateServerCertificateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @instance - */ - SqlInstancesRotateServerCertificateRequest.prototype.project = ""; - - /** - * SqlInstancesRotateServerCertificateRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @instance - */ - SqlInstancesRotateServerCertificateRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesRotateServerCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest instance - */ - SqlInstancesRotateServerCertificateRequest.create = function create(properties) { - return new SqlInstancesRotateServerCertificateRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateServerCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateServerCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRotateServerCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRotateServerCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest} SqlInstancesRotateServerCertificateRequest - */ - SqlInstancesRotateServerCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRotateServerCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest} message SqlInstancesRotateServerCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRotateServerCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesRotateServerCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRotateServerCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRotateServerCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRotateServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest"; - }; - - return SqlInstancesRotateServerCertificateRequest; - })(); - - v1beta4.SqlInstancesRotateEntraIdCertificateRequest = (function() { - - /** - * Properties of a SqlInstancesRotateEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesRotateEntraIdCertificateRequest - * @property {string|null} [instance] SqlInstancesRotateEntraIdCertificateRequest instance - * @property {string|null} [project] SqlInstancesRotateEntraIdCertificateRequest project - * @property {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest|null} [body] SqlInstancesRotateEntraIdCertificateRequest body - */ - - /** - * Constructs a new SqlInstancesRotateEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesRotateEntraIdCertificateRequest. - * @implements ISqlInstancesRotateEntraIdCertificateRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set - */ - function SqlInstancesRotateEntraIdCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRotateEntraIdCertificateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @instance - */ - SqlInstancesRotateEntraIdCertificateRequest.prototype.instance = ""; - - /** - * SqlInstancesRotateEntraIdCertificateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @instance - */ - SqlInstancesRotateEntraIdCertificateRequest.prototype.project = ""; - - /** - * SqlInstancesRotateEntraIdCertificateRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @instance - */ - SqlInstancesRotateEntraIdCertificateRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesRotateEntraIdCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest instance - */ - SqlInstancesRotateEntraIdCertificateRequest.create = function create(properties) { - return new SqlInstancesRotateEntraIdCertificateRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateEntraIdCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRotateEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateEntraIdCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRotateEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRotateEntraIdCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRotateEntraIdCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest} SqlInstancesRotateEntraIdCertificateRequest - */ - SqlInstancesRotateEntraIdCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest} message SqlInstancesRotateEntraIdCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRotateEntraIdCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesRotateEntraIdCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRotateEntraIdCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRotateEntraIdCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRotateEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest"; - }; - - return SqlInstancesRotateEntraIdCertificateRequest; - })(); - - v1beta4.SqlInstancesStartReplicaRequest = (function() { - - /** - * Properties of a SqlInstancesStartReplicaRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesStartReplicaRequest - * @property {string|null} [instance] SqlInstancesStartReplicaRequest instance - * @property {string|null} [project] SqlInstancesStartReplicaRequest project - */ - - /** - * Constructs a new SqlInstancesStartReplicaRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesStartReplicaRequest. - * @implements ISqlInstancesStartReplicaRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest=} [properties] Properties to set - */ - function SqlInstancesStartReplicaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesStartReplicaRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @instance - */ - SqlInstancesStartReplicaRequest.prototype.instance = ""; - - /** - * SqlInstancesStartReplicaRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @instance - */ - SqlInstancesStartReplicaRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesStartReplicaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest instance - */ - SqlInstancesStartReplicaRequest.create = function create(properties) { - return new SqlInstancesStartReplicaRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesStartReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStartReplicaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesStartReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStartReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStartReplicaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesStartReplicaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStartReplicaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesStartReplicaRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesStartReplicaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesStartReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest} SqlInstancesStartReplicaRequest - */ - SqlInstancesStartReplicaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesStartReplicaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest} message SqlInstancesStartReplicaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesStartReplicaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesStartReplicaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesStartReplicaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesStartReplicaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesStartReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest"; - }; - - return SqlInstancesStartReplicaRequest; - })(); - - v1beta4.SqlInstancesStopReplicaRequest = (function() { - - /** - * Properties of a SqlInstancesStopReplicaRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesStopReplicaRequest - * @property {string|null} [instance] SqlInstancesStopReplicaRequest instance - * @property {string|null} [project] SqlInstancesStopReplicaRequest project - */ - - /** - * Constructs a new SqlInstancesStopReplicaRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesStopReplicaRequest. - * @implements ISqlInstancesStopReplicaRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest=} [properties] Properties to set - */ - function SqlInstancesStopReplicaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesStopReplicaRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @instance - */ - SqlInstancesStopReplicaRequest.prototype.instance = ""; - - /** - * SqlInstancesStopReplicaRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @instance - */ - SqlInstancesStopReplicaRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesStopReplicaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest instance - */ - SqlInstancesStopReplicaRequest.create = function create(properties) { - return new SqlInstancesStopReplicaRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesStopReplicaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStopReplicaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesStopReplicaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStopReplicaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStopReplicaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesStopReplicaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStopReplicaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesStopReplicaRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesStopReplicaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesStopReplicaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest} SqlInstancesStopReplicaRequest - */ - SqlInstancesStopReplicaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesStopReplicaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest} message SqlInstancesStopReplicaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesStopReplicaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesStopReplicaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesStopReplicaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesStopReplicaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesStopReplicaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest"; - }; - - return SqlInstancesStopReplicaRequest; - })(); - - v1beta4.SqlInstancesTruncateLogRequest = (function() { - - /** - * Properties of a SqlInstancesTruncateLogRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesTruncateLogRequest - * @property {string|null} [instance] SqlInstancesTruncateLogRequest instance - * @property {string|null} [project] SqlInstancesTruncateLogRequest project - * @property {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest|null} [body] SqlInstancesTruncateLogRequest body - */ - - /** - * Constructs a new SqlInstancesTruncateLogRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesTruncateLogRequest. - * @implements ISqlInstancesTruncateLogRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest=} [properties] Properties to set - */ - function SqlInstancesTruncateLogRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesTruncateLogRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @instance - */ - SqlInstancesTruncateLogRequest.prototype.instance = ""; - - /** - * SqlInstancesTruncateLogRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @instance - */ - SqlInstancesTruncateLogRequest.prototype.project = ""; - - /** - * SqlInstancesTruncateLogRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @instance - */ - SqlInstancesTruncateLogRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesTruncateLogRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest instance - */ - SqlInstancesTruncateLogRequest.create = function create(properties) { - return new SqlInstancesTruncateLogRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesTruncateLogRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesTruncateLogRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesTruncateLogRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesTruncateLogRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesTruncateLogRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesTruncateLogRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesTruncateLogRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest} SqlInstancesTruncateLogRequest - */ - SqlInstancesTruncateLogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesTruncateLogRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest} message SqlInstancesTruncateLogRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesTruncateLogRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesTruncateLogRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesTruncateLogRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesTruncateLogRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesTruncateLogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest"; - }; - - return SqlInstancesTruncateLogRequest; - })(); - - v1beta4.SqlInstancesUpdateRequest = (function() { - - /** - * Properties of a SqlInstancesUpdateRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesUpdateRequest - * @property {string|null} [instance] SqlInstancesUpdateRequest instance - * @property {string|null} [project] SqlInstancesUpdateRequest project - * @property {google.cloud.sql.v1beta4.IDatabaseInstance|null} [body] SqlInstancesUpdateRequest body - */ - - /** - * Constructs a new SqlInstancesUpdateRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesUpdateRequest. - * @implements ISqlInstancesUpdateRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest=} [properties] Properties to set - */ - function SqlInstancesUpdateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesUpdateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @instance - */ - SqlInstancesUpdateRequest.prototype.instance = ""; - - /** - * SqlInstancesUpdateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @instance - */ - SqlInstancesUpdateRequest.prototype.project = ""; - - /** - * SqlInstancesUpdateRequest body. - * @member {google.cloud.sql.v1beta4.IDatabaseInstance|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @instance - */ - SqlInstancesUpdateRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesUpdateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest instance - */ - SqlInstancesUpdateRequest.create = function create(properties) { - return new SqlInstancesUpdateRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesUpdateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest} message SqlInstancesUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesUpdateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesUpdateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest} message SqlInstancesUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesUpdateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesUpdateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesUpdateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesUpdateRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesUpdateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesUpdateRequest} SqlInstancesUpdateRequest - */ - SqlInstancesUpdateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesUpdateRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesUpdateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesUpdateRequest} message SqlInstancesUpdateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesUpdateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesUpdateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesUpdateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesUpdateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesUpdateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesUpdateRequest"; - }; - - return SqlInstancesUpdateRequest; - })(); - - v1beta4.SqlInstancesReencryptRequest = (function() { - - /** - * Properties of a SqlInstancesReencryptRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesReencryptRequest - * @property {string|null} [instance] SqlInstancesReencryptRequest instance - * @property {string|null} [project] SqlInstancesReencryptRequest project - * @property {google.cloud.sql.v1beta4.IInstancesReencryptRequest|null} [body] SqlInstancesReencryptRequest body - */ - - /** - * Constructs a new SqlInstancesReencryptRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesReencryptRequest. - * @implements ISqlInstancesReencryptRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest=} [properties] Properties to set - */ - function SqlInstancesReencryptRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesReencryptRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @instance - */ - SqlInstancesReencryptRequest.prototype.instance = ""; - - /** - * SqlInstancesReencryptRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @instance - */ - SqlInstancesReencryptRequest.prototype.project = ""; - - /** - * SqlInstancesReencryptRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesReencryptRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @instance - */ - SqlInstancesReencryptRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesReencryptRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest instance - */ - SqlInstancesReencryptRequest.create = function create(properties) { - return new SqlInstancesReencryptRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReencryptRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest} message SqlInstancesReencryptRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReencryptRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesReencryptRequest.encode(message.body, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReencryptRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest} message SqlInstancesReencryptRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReencryptRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReencryptRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.body = $root.google.cloud.sql.v1beta4.InstancesReencryptRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesReencryptRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReencryptRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesReencryptRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesReencryptRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesReencryptRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesReencryptRequest} SqlInstancesReencryptRequest - */ - SqlInstancesReencryptRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesReencryptRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesReencryptRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesReencryptRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesReencryptRequest} message SqlInstancesReencryptRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesReencryptRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesReencryptRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesReencryptRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesReencryptRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesReencryptRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesReencryptRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesReencryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesReencryptRequest"; - }; - - return SqlInstancesReencryptRequest; - })(); - - v1beta4.InstancesReencryptRequest = (function() { - - /** - * Properties of an InstancesReencryptRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesReencryptRequest - * @property {google.cloud.sql.v1beta4.IBackupReencryptionConfig|null} [backupReencryptionConfig] InstancesReencryptRequest backupReencryptionConfig - */ - - /** - * Constructs a new InstancesReencryptRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesReencryptRequest. - * @implements IInstancesReencryptRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesReencryptRequest=} [properties] Properties to set - */ - function InstancesReencryptRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesReencryptRequest backupReencryptionConfig. - * @member {google.cloud.sql.v1beta4.IBackupReencryptionConfig|null|undefined} backupReencryptionConfig - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @instance - */ - InstancesReencryptRequest.prototype.backupReencryptionConfig = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(InstancesReencryptRequest.prototype, "_backupReencryptionConfig", { - get: $util.oneOfGetter($oneOfFields = ["backupReencryptionConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new InstancesReencryptRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesReencryptRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesReencryptRequest} InstancesReencryptRequest instance - */ - InstancesReencryptRequest.create = function create(properties) { - return new InstancesReencryptRequest(properties); - }; - - /** - * Encodes the specified InstancesReencryptRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesReencryptRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesReencryptRequest} message InstancesReencryptRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesReencryptRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.backupReencryptionConfig != null && Object.hasOwnProperty.call(message, "backupReencryptionConfig")) - $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.encode(message.backupReencryptionConfig, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesReencryptRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesReencryptRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesReencryptRequest} message InstancesReencryptRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesReencryptRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesReencryptRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesReencryptRequest} InstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesReencryptRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesReencryptRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.backupReencryptionConfig = $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesReencryptRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesReencryptRequest} InstancesReencryptRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesReencryptRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesReencryptRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesReencryptRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.backupReencryptionConfig != null && message.hasOwnProperty("backupReencryptionConfig")) { - properties._backupReencryptionConfig = 1; - { - var error = $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.verify(message.backupReencryptionConfig); - if (error) - return "backupReencryptionConfig." + error; - } - } - return null; - }; - - /** - * Creates an InstancesReencryptRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesReencryptRequest} InstancesReencryptRequest - */ - InstancesReencryptRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesReencryptRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesReencryptRequest(); - if (object.backupReencryptionConfig != null) { - if (typeof object.backupReencryptionConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesReencryptRequest.backupReencryptionConfig: object expected"); - message.backupReencryptionConfig = $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.fromObject(object.backupReencryptionConfig); - } - return message; - }; - - /** - * Creates a plain object from an InstancesReencryptRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesReencryptRequest} message InstancesReencryptRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesReencryptRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.backupReencryptionConfig != null && message.hasOwnProperty("backupReencryptionConfig")) { - object.backupReencryptionConfig = $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.toObject(message.backupReencryptionConfig, options); - if (options.oneofs) - object._backupReencryptionConfig = "backupReencryptionConfig"; - } - return object; - }; - - /** - * Converts this InstancesReencryptRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesReencryptRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesReencryptRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesReencryptRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesReencryptRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesReencryptRequest"; - }; - - return InstancesReencryptRequest; - })(); - - v1beta4.BackupReencryptionConfig = (function() { - - /** - * Properties of a BackupReencryptionConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IBackupReencryptionConfig - * @property {number|null} [backupLimit] BackupReencryptionConfig backupLimit - * @property {google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|null} [backupType] BackupReencryptionConfig backupType - */ - - /** - * Constructs a new BackupReencryptionConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a BackupReencryptionConfig. - * @implements IBackupReencryptionConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IBackupReencryptionConfig=} [properties] Properties to set - */ - function BackupReencryptionConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupReencryptionConfig backupLimit. - * @member {number|null|undefined} backupLimit - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @instance - */ - BackupReencryptionConfig.prototype.backupLimit = null; - - /** - * BackupReencryptionConfig backupType. - * @member {google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType|null|undefined} backupType - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @instance - */ - BackupReencryptionConfig.prototype.backupType = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(BackupReencryptionConfig.prototype, "_backupLimit", { - get: $util.oneOfGetter($oneOfFields = ["backupLimit"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(BackupReencryptionConfig.prototype, "_backupType", { - get: $util.oneOfGetter($oneOfFields = ["backupType"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new BackupReencryptionConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @static - * @param {google.cloud.sql.v1beta4.IBackupReencryptionConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.BackupReencryptionConfig} BackupReencryptionConfig instance - */ - BackupReencryptionConfig.create = function create(properties) { - return new BackupReencryptionConfig(properties); - }; - - /** - * Encodes the specified BackupReencryptionConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupReencryptionConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @static - * @param {google.cloud.sql.v1beta4.IBackupReencryptionConfig} message BackupReencryptionConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupReencryptionConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.backupLimit != null && Object.hasOwnProperty.call(message, "backupLimit")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.backupLimit); - if (message.backupType != null && Object.hasOwnProperty.call(message, "backupType")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.backupType); - return writer; - }; - - /** - * Encodes the specified BackupReencryptionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupReencryptionConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @static - * @param {google.cloud.sql.v1beta4.IBackupReencryptionConfig} message BackupReencryptionConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupReencryptionConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupReencryptionConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.BackupReencryptionConfig} BackupReencryptionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupReencryptionConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupReencryptionConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.backupLimit = reader.int32(); - break; - } - case 2: { - message.backupType = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupReencryptionConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.BackupReencryptionConfig} BackupReencryptionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupReencryptionConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupReencryptionConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupReencryptionConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.backupLimit != null && message.hasOwnProperty("backupLimit")) { - properties._backupLimit = 1; - if (!$util.isInteger(message.backupLimit)) - return "backupLimit: integer expected"; - } - if (message.backupType != null && message.hasOwnProperty("backupType")) { - properties._backupType = 1; - switch (message.backupType) { - default: - return "backupType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - return null; - }; - - /** - * Creates a BackupReencryptionConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.BackupReencryptionConfig} BackupReencryptionConfig - */ - BackupReencryptionConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.BackupReencryptionConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.BackupReencryptionConfig(); - if (object.backupLimit != null) - message.backupLimit = object.backupLimit | 0; - switch (object.backupType) { - default: - if (typeof object.backupType === "number") { - message.backupType = object.backupType; - break; - } - break; - case "BACKUP_TYPE_UNSPECIFIED": - case 0: - message.backupType = 0; - break; - case "AUTOMATED": - case 1: - message.backupType = 1; - break; - case "ON_DEMAND": - case 2: - message.backupType = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a BackupReencryptionConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @static - * @param {google.cloud.sql.v1beta4.BackupReencryptionConfig} message BackupReencryptionConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupReencryptionConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.backupLimit != null && message.hasOwnProperty("backupLimit")) { - object.backupLimit = message.backupLimit; - if (options.oneofs) - object._backupLimit = "backupLimit"; - } - if (message.backupType != null && message.hasOwnProperty("backupType")) { - object.backupType = options.enums === String ? $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType[message.backupType] === undefined ? message.backupType : $root.google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType[message.backupType] : message.backupType; - if (options.oneofs) - object._backupType = "backupType"; - } - return object; - }; - - /** - * Converts this BackupReencryptionConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @instance - * @returns {Object.} JSON object - */ - BackupReencryptionConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupReencryptionConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.BackupReencryptionConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupReencryptionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupReencryptionConfig"; - }; - - /** - * BackupType enum. - * @name google.cloud.sql.v1beta4.BackupReencryptionConfig.BackupType - * @enum {number} - * @property {number} BACKUP_TYPE_UNSPECIFIED=0 BACKUP_TYPE_UNSPECIFIED value - * @property {number} AUTOMATED=1 AUTOMATED value - * @property {number} ON_DEMAND=2 ON_DEMAND value - */ - BackupReencryptionConfig.BackupType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BACKUP_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUTOMATED"] = 1; - values[valuesById[2] = "ON_DEMAND"] = 2; - return values; - })(); - - return BackupReencryptionConfig; - })(); - - v1beta4.SqlInstancesRescheduleMaintenanceRequest = (function() { - - /** - * Properties of a SqlInstancesRescheduleMaintenanceRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesRescheduleMaintenanceRequest - * @property {string|null} [instance] SqlInstancesRescheduleMaintenanceRequest instance - * @property {string|null} [project] SqlInstancesRescheduleMaintenanceRequest project - * @property {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody|null} [body] SqlInstancesRescheduleMaintenanceRequest body - */ - - /** - * Constructs a new SqlInstancesRescheduleMaintenanceRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesRescheduleMaintenanceRequest. - * @implements ISqlInstancesRescheduleMaintenanceRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest=} [properties] Properties to set - */ - function SqlInstancesRescheduleMaintenanceRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRescheduleMaintenanceRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @instance - */ - SqlInstancesRescheduleMaintenanceRequest.prototype.instance = ""; - - /** - * SqlInstancesRescheduleMaintenanceRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @instance - */ - SqlInstancesRescheduleMaintenanceRequest.prototype.project = ""; - - /** - * SqlInstancesRescheduleMaintenanceRequest body. - * @member {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @instance - */ - SqlInstancesRescheduleMaintenanceRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesRescheduleMaintenanceRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest instance - */ - SqlInstancesRescheduleMaintenanceRequest.create = function create(properties) { - return new SqlInstancesRescheduleMaintenanceRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRescheduleMaintenanceRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRescheduleMaintenanceRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRescheduleMaintenanceRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRescheduleMaintenanceRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRescheduleMaintenanceRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRescheduleMaintenanceRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRescheduleMaintenanceRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest} SqlInstancesRescheduleMaintenanceRequest - */ - SqlInstancesRescheduleMaintenanceRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest} message SqlInstancesRescheduleMaintenanceRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRescheduleMaintenanceRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesRescheduleMaintenanceRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRescheduleMaintenanceRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRescheduleMaintenanceRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRescheduleMaintenanceRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest"; - }; - - return SqlInstancesRescheduleMaintenanceRequest; - })(); - - v1beta4.SqlInstancesPerformDiskShrinkRequest = (function() { - - /** - * Properties of a SqlInstancesPerformDiskShrinkRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesPerformDiskShrinkRequest - * @property {string|null} [instance] SqlInstancesPerformDiskShrinkRequest instance - * @property {string|null} [project] SqlInstancesPerformDiskShrinkRequest project - * @property {google.cloud.sql.v1beta4.IPerformDiskShrinkContext|null} [body] SqlInstancesPerformDiskShrinkRequest body - */ - - /** - * Constructs a new SqlInstancesPerformDiskShrinkRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesPerformDiskShrinkRequest. - * @implements ISqlInstancesPerformDiskShrinkRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest=} [properties] Properties to set - */ - function SqlInstancesPerformDiskShrinkRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesPerformDiskShrinkRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @instance - */ - SqlInstancesPerformDiskShrinkRequest.prototype.instance = ""; - - /** - * SqlInstancesPerformDiskShrinkRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @instance - */ - SqlInstancesPerformDiskShrinkRequest.prototype.project = ""; - - /** - * SqlInstancesPerformDiskShrinkRequest body. - * @member {google.cloud.sql.v1beta4.IPerformDiskShrinkContext|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @instance - */ - SqlInstancesPerformDiskShrinkRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesPerformDiskShrinkRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest instance - */ - SqlInstancesPerformDiskShrinkRequest.create = function create(properties) { - return new SqlInstancesPerformDiskShrinkRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesPerformDiskShrinkRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPerformDiskShrinkRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesPerformDiskShrinkRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPerformDiskShrinkRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPerformDiskShrinkRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesPerformDiskShrinkRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPerformDiskShrinkRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesPerformDiskShrinkRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesPerformDiskShrinkRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesPerformDiskShrinkRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest} SqlInstancesPerformDiskShrinkRequest - */ - SqlInstancesPerformDiskShrinkRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesPerformDiskShrinkRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest} message SqlInstancesPerformDiskShrinkRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesPerformDiskShrinkRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesPerformDiskShrinkRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesPerformDiskShrinkRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesPerformDiskShrinkRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesPerformDiskShrinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest"; - }; - - return SqlInstancesPerformDiskShrinkRequest; - })(); - - /** - * ExternalSyncParallelLevel enum. - * @name google.cloud.sql.v1beta4.ExternalSyncParallelLevel - * @enum {number} - * @property {number} EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED=0 EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED value - * @property {number} MIN=1 MIN value - * @property {number} OPTIMAL=2 OPTIMAL value - * @property {number} MAX=3 MAX value - */ - v1beta4.ExternalSyncParallelLevel = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED"] = 0; - values[valuesById[1] = "MIN"] = 1; - values[valuesById[2] = "OPTIMAL"] = 2; - values[valuesById[3] = "MAX"] = 3; - return values; - })(); - - v1beta4.ExternalSyncSelectedObject = (function() { - - /** - * Properties of an ExternalSyncSelectedObject. - * @memberof google.cloud.sql.v1beta4 - * @interface IExternalSyncSelectedObject - * @property {string|null} [database] ExternalSyncSelectedObject database - */ - - /** - * Constructs a new ExternalSyncSelectedObject. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an ExternalSyncSelectedObject. - * @implements IExternalSyncSelectedObject - * @constructor - * @param {google.cloud.sql.v1beta4.IExternalSyncSelectedObject=} [properties] Properties to set - */ - function ExternalSyncSelectedObject(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExternalSyncSelectedObject database. - * @member {string} database - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @instance - */ - ExternalSyncSelectedObject.prototype.database = ""; - - /** - * Creates a new ExternalSyncSelectedObject instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @static - * @param {google.cloud.sql.v1beta4.IExternalSyncSelectedObject=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ExternalSyncSelectedObject} ExternalSyncSelectedObject instance - */ - ExternalSyncSelectedObject.create = function create(properties) { - return new ExternalSyncSelectedObject(properties); - }; - - /** - * Encodes the specified ExternalSyncSelectedObject message. Does not implicitly {@link google.cloud.sql.v1beta4.ExternalSyncSelectedObject.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @static - * @param {google.cloud.sql.v1beta4.IExternalSyncSelectedObject} message ExternalSyncSelectedObject message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExternalSyncSelectedObject.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); - return writer; - }; - - /** - * Encodes the specified ExternalSyncSelectedObject message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExternalSyncSelectedObject.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @static - * @param {google.cloud.sql.v1beta4.IExternalSyncSelectedObject} message ExternalSyncSelectedObject message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExternalSyncSelectedObject.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ExternalSyncSelectedObject} ExternalSyncSelectedObject - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExternalSyncSelectedObject.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.database = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExternalSyncSelectedObject message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ExternalSyncSelectedObject} ExternalSyncSelectedObject - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExternalSyncSelectedObject.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExternalSyncSelectedObject message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExternalSyncSelectedObject.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - return null; - }; - - /** - * Creates an ExternalSyncSelectedObject message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ExternalSyncSelectedObject} ExternalSyncSelectedObject - */ - ExternalSyncSelectedObject.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject) - return object; - var message = new $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject(); - if (object.database != null) - message.database = String(object.database); - return message; - }; - - /** - * Creates a plain object from an ExternalSyncSelectedObject message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @static - * @param {google.cloud.sql.v1beta4.ExternalSyncSelectedObject} message ExternalSyncSelectedObject - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExternalSyncSelectedObject.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.database = ""; - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - return object; - }; - - /** - * Converts this ExternalSyncSelectedObject to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @instance - * @returns {Object.} JSON object - */ - ExternalSyncSelectedObject.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExternalSyncSelectedObject - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ExternalSyncSelectedObject - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExternalSyncSelectedObject.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExternalSyncSelectedObject"; - }; - - return ExternalSyncSelectedObject; - })(); - - v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest = (function() { - - /** - * Properties of a SqlInstancesVerifyExternalSyncSettingsRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesVerifyExternalSyncSettingsRequest - * @property {string|null} [instance] SqlInstancesVerifyExternalSyncSettingsRequest instance - * @property {string|null} [project] SqlInstancesVerifyExternalSyncSettingsRequest project - * @property {boolean|null} [verifyConnectionOnly] SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly - * @property {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null} [syncMode] SqlInstancesVerifyExternalSyncSettingsRequest syncMode - * @property {boolean|null} [verifyReplicationOnly] SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly - * @property {google.cloud.sql.v1beta4.IMySqlSyncConfig|null} [mysqlSyncConfig] SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig - * @property {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null} [migrationType] SqlInstancesVerifyExternalSyncSettingsRequest migrationType - * @property {google.cloud.sql.v1beta4.ExternalSyncParallelLevel|null} [syncParallelLevel] SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel - * @property {Array.|null} [selectedObjects] SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects - */ - - /** - * Constructs a new SqlInstancesVerifyExternalSyncSettingsRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesVerifyExternalSyncSettingsRequest. - * @implements ISqlInstancesVerifyExternalSyncSettingsRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest=} [properties] Properties to set - */ - function SqlInstancesVerifyExternalSyncSettingsRequest(properties) { - this.selectedObjects = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.instance = ""; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.project = ""; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest verifyConnectionOnly. - * @member {boolean} verifyConnectionOnly - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.verifyConnectionOnly = false; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest syncMode. - * @member {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} syncMode - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.syncMode = 0; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest verifyReplicationOnly. - * @member {boolean} verifyReplicationOnly - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.verifyReplicationOnly = false; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest mysqlSyncConfig. - * @member {google.cloud.sql.v1beta4.IMySqlSyncConfig|null|undefined} mysqlSyncConfig - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.mysqlSyncConfig = null; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest migrationType. - * @member {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} migrationType - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.migrationType = 0; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest syncParallelLevel. - * @member {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} syncParallelLevel - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.syncParallelLevel = 0; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest selectedObjects. - * @member {Array.} selectedObjects - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.selectedObjects = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * SqlInstancesVerifyExternalSyncSettingsRequest syncConfig. - * @member {"mysqlSyncConfig"|undefined} syncConfig - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - */ - Object.defineProperty(SqlInstancesVerifyExternalSyncSettingsRequest.prototype, "syncConfig", { - get: $util.oneOfGetter($oneOfFields = ["mysqlSyncConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlInstancesVerifyExternalSyncSettingsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest instance - */ - SqlInstancesVerifyExternalSyncSettingsRequest.create = function create(properties) { - return new SqlInstancesVerifyExternalSyncSettingsRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesVerifyExternalSyncSettingsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.verifyConnectionOnly != null && Object.hasOwnProperty.call(message, "verifyConnectionOnly")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.verifyConnectionOnly); - if (message.syncMode != null && Object.hasOwnProperty.call(message, "syncMode")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.syncMode); - if (message.verifyReplicationOnly != null && Object.hasOwnProperty.call(message, "verifyReplicationOnly")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.verifyReplicationOnly); - if (message.mysqlSyncConfig != null && Object.hasOwnProperty.call(message, "mysqlSyncConfig")) - $root.google.cloud.sql.v1beta4.MySqlSyncConfig.encode(message.mysqlSyncConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.migrationType != null && Object.hasOwnProperty.call(message, "migrationType")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.migrationType); - if (message.syncParallelLevel != null && Object.hasOwnProperty.call(message, "syncParallelLevel")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.syncParallelLevel); - if (message.selectedObjects != null && message.selectedObjects.length) - for (var i = 0; i < message.selectedObjects.length; ++i) - $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject.encode(message.selectedObjects[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesVerifyExternalSyncSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesVerifyExternalSyncSettingsRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.verifyConnectionOnly = reader.bool(); - break; - } - case 4: { - message.syncMode = reader.int32(); - break; - } - case 5: { - message.verifyReplicationOnly = reader.bool(); - break; - } - case 6: { - message.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.decode(reader, reader.uint32()); - break; - } - case 7: { - message.migrationType = reader.int32(); - break; - } - case 8: { - message.syncParallelLevel = reader.int32(); - break; - } - case 9: { - if (!(message.selectedObjects && message.selectedObjects.length)) - message.selectedObjects = []; - message.selectedObjects.push($root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesVerifyExternalSyncSettingsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesVerifyExternalSyncSettingsRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesVerifyExternalSyncSettingsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.verifyConnectionOnly != null && message.hasOwnProperty("verifyConnectionOnly")) - if (typeof message.verifyConnectionOnly !== "boolean") - return "verifyConnectionOnly: boolean expected"; - if (message.syncMode != null && message.hasOwnProperty("syncMode")) - switch (message.syncMode) { - default: - return "syncMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.verifyReplicationOnly != null && message.hasOwnProperty("verifyReplicationOnly")) - if (typeof message.verifyReplicationOnly !== "boolean") - return "verifyReplicationOnly: boolean expected"; - if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { - properties.syncConfig = 1; - { - var error = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.verify(message.mysqlSyncConfig); - if (error) - return "mysqlSyncConfig." + error; - } - } - if (message.migrationType != null && message.hasOwnProperty("migrationType")) - switch (message.migrationType) { - default: - return "migrationType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) - switch (message.syncParallelLevel) { - default: - return "syncParallelLevel: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.selectedObjects != null && message.hasOwnProperty("selectedObjects")) { - if (!Array.isArray(message.selectedObjects)) - return "selectedObjects: array expected"; - for (var i = 0; i < message.selectedObjects.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject.verify(message.selectedObjects[i]); - if (error) - return "selectedObjects." + error; - } - } - return null; - }; - - /** - * Creates a SqlInstancesVerifyExternalSyncSettingsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest} SqlInstancesVerifyExternalSyncSettingsRequest - */ - SqlInstancesVerifyExternalSyncSettingsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.verifyConnectionOnly != null) - message.verifyConnectionOnly = Boolean(object.verifyConnectionOnly); - switch (object.syncMode) { - default: - if (typeof object.syncMode === "number") { - message.syncMode = object.syncMode; - break; - } - break; - case "EXTERNAL_SYNC_MODE_UNSPECIFIED": - case 0: - message.syncMode = 0; - break; - case "ONLINE": - case 1: - message.syncMode = 1; - break; - case "OFFLINE": - case 2: - message.syncMode = 2; - break; - } - if (object.verifyReplicationOnly != null) - message.verifyReplicationOnly = Boolean(object.verifyReplicationOnly); - if (object.mysqlSyncConfig != null) { - if (typeof object.mysqlSyncConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.mysqlSyncConfig: object expected"); - message.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.fromObject(object.mysqlSyncConfig); - } - switch (object.migrationType) { - default: - if (typeof object.migrationType === "number") { - message.migrationType = object.migrationType; - break; - } - break; - case "MIGRATION_TYPE_UNSPECIFIED": - case 0: - message.migrationType = 0; - break; - case "LOGICAL": - case 1: - message.migrationType = 1; - break; - case "PHYSICAL": - case 2: - message.migrationType = 2; - break; - } - switch (object.syncParallelLevel) { - default: - if (typeof object.syncParallelLevel === "number") { - message.syncParallelLevel = object.syncParallelLevel; - break; - } - break; - case "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": - case 0: - message.syncParallelLevel = 0; - break; - case "MIN": - case 1: - message.syncParallelLevel = 1; - break; - case "OPTIMAL": - case 2: - message.syncParallelLevel = 2; - break; - case "MAX": - case 3: - message.syncParallelLevel = 3; - break; - } - if (object.selectedObjects) { - if (!Array.isArray(object.selectedObjects)) - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.selectedObjects: array expected"); - message.selectedObjects = []; - for (var i = 0; i < object.selectedObjects.length; ++i) { - if (typeof object.selectedObjects[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.selectedObjects: object expected"); - message.selectedObjects[i] = $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject.fromObject(object.selectedObjects[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest} message SqlInstancesVerifyExternalSyncSettingsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesVerifyExternalSyncSettingsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.selectedObjects = []; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.verifyConnectionOnly = false; - object.syncMode = options.enums === String ? "EXTERNAL_SYNC_MODE_UNSPECIFIED" : 0; - object.verifyReplicationOnly = false; - object.migrationType = options.enums === String ? "MIGRATION_TYPE_UNSPECIFIED" : 0; - object.syncParallelLevel = options.enums === String ? "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" : 0; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.verifyConnectionOnly != null && message.hasOwnProperty("verifyConnectionOnly")) - object.verifyConnectionOnly = message.verifyConnectionOnly; - if (message.syncMode != null && message.hasOwnProperty("syncMode")) - object.syncMode = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] === undefined ? message.syncMode : $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] : message.syncMode; - if (message.verifyReplicationOnly != null && message.hasOwnProperty("verifyReplicationOnly")) - object.verifyReplicationOnly = message.verifyReplicationOnly; - if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { - object.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.toObject(message.mysqlSyncConfig, options); - if (options.oneofs) - object.syncConfig = "mysqlSyncConfig"; - } - if (message.migrationType != null && message.hasOwnProperty("migrationType")) - object.migrationType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] === undefined ? message.migrationType : $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] : message.migrationType; - if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) - object.syncParallelLevel = options.enums === String ? $root.google.cloud.sql.v1beta4.ExternalSyncParallelLevel[message.syncParallelLevel] === undefined ? message.syncParallelLevel : $root.google.cloud.sql.v1beta4.ExternalSyncParallelLevel[message.syncParallelLevel] : message.syncParallelLevel; - if (message.selectedObjects && message.selectedObjects.length) { - object.selectedObjects = []; - for (var j = 0; j < message.selectedObjects.length; ++j) - object.selectedObjects[j] = $root.google.cloud.sql.v1beta4.ExternalSyncSelectedObject.toObject(message.selectedObjects[j], options); - } - return object; - }; - - /** - * Converts this SqlInstancesVerifyExternalSyncSettingsRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesVerifyExternalSyncSettingsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesVerifyExternalSyncSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest"; - }; - - /** - * ExternalSyncMode enum. - * @name google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode - * @enum {number} - * @property {number} EXTERNAL_SYNC_MODE_UNSPECIFIED=0 EXTERNAL_SYNC_MODE_UNSPECIFIED value - * @property {number} ONLINE=1 ONLINE value - * @property {number} OFFLINE=2 OFFLINE value - */ - SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "EXTERNAL_SYNC_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ONLINE"] = 1; - values[valuesById[2] = "OFFLINE"] = 2; - return values; - })(); - - /** - * MigrationType enum. - * @name google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType - * @enum {number} - * @property {number} MIGRATION_TYPE_UNSPECIFIED=0 MIGRATION_TYPE_UNSPECIFIED value - * @property {number} LOGICAL=1 LOGICAL value - * @property {number} PHYSICAL=2 PHYSICAL value - */ - SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MIGRATION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "LOGICAL"] = 1; - values[valuesById[2] = "PHYSICAL"] = 2; - return values; - })(); - - return SqlInstancesVerifyExternalSyncSettingsRequest; - })(); - - v1beta4.SqlInstancesStartExternalSyncRequest = (function() { - - /** - * Properties of a SqlInstancesStartExternalSyncRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesStartExternalSyncRequest - * @property {string|null} [instance] SqlInstancesStartExternalSyncRequest instance - * @property {string|null} [project] SqlInstancesStartExternalSyncRequest project - * @property {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode|null} [syncMode] SqlInstancesStartExternalSyncRequest syncMode - * @property {boolean|null} [skipVerification] SqlInstancesStartExternalSyncRequest skipVerification - * @property {google.cloud.sql.v1beta4.IMySqlSyncConfig|null} [mysqlSyncConfig] SqlInstancesStartExternalSyncRequest mysqlSyncConfig - * @property {google.cloud.sql.v1beta4.ExternalSyncParallelLevel|null} [syncParallelLevel] SqlInstancesStartExternalSyncRequest syncParallelLevel - * @property {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType|null} [migrationType] SqlInstancesStartExternalSyncRequest migrationType - * @property {boolean|null} [replicaOverwriteEnabled] SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled - */ - - /** - * Constructs a new SqlInstancesStartExternalSyncRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesStartExternalSyncRequest. - * @implements ISqlInstancesStartExternalSyncRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest=} [properties] Properties to set - */ - function SqlInstancesStartExternalSyncRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesStartExternalSyncRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.instance = ""; - - /** - * SqlInstancesStartExternalSyncRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.project = ""; - - /** - * SqlInstancesStartExternalSyncRequest syncMode. - * @member {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} syncMode - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.syncMode = 0; - - /** - * SqlInstancesStartExternalSyncRequest skipVerification. - * @member {boolean} skipVerification - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.skipVerification = false; - - /** - * SqlInstancesStartExternalSyncRequest mysqlSyncConfig. - * @member {google.cloud.sql.v1beta4.IMySqlSyncConfig|null|undefined} mysqlSyncConfig - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.mysqlSyncConfig = null; - - /** - * SqlInstancesStartExternalSyncRequest syncParallelLevel. - * @member {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} syncParallelLevel - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.syncParallelLevel = 0; - - /** - * SqlInstancesStartExternalSyncRequest migrationType. - * @member {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} migrationType - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.migrationType = 0; - - /** - * SqlInstancesStartExternalSyncRequest replicaOverwriteEnabled. - * @member {boolean} replicaOverwriteEnabled - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @instance - */ - SqlInstancesStartExternalSyncRequest.prototype.replicaOverwriteEnabled = false; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * SqlInstancesStartExternalSyncRequest syncConfig. - * @member {"mysqlSyncConfig"|undefined} syncConfig - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @instance - */ - Object.defineProperty(SqlInstancesStartExternalSyncRequest.prototype, "syncConfig", { - get: $util.oneOfGetter($oneOfFields = ["mysqlSyncConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlInstancesStartExternalSyncRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest instance - */ - SqlInstancesStartExternalSyncRequest.create = function create(properties) { - return new SqlInstancesStartExternalSyncRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesStartExternalSyncRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStartExternalSyncRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.syncMode != null && Object.hasOwnProperty.call(message, "syncMode")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.syncMode); - if (message.skipVerification != null && Object.hasOwnProperty.call(message, "skipVerification")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.skipVerification); - if (message.mysqlSyncConfig != null && Object.hasOwnProperty.call(message, "mysqlSyncConfig")) - $root.google.cloud.sql.v1beta4.MySqlSyncConfig.encode(message.mysqlSyncConfig, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.syncParallelLevel != null && Object.hasOwnProperty.call(message, "syncParallelLevel")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.syncParallelLevel); - if (message.migrationType != null && Object.hasOwnProperty.call(message, "migrationType")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.migrationType); - if (message.replicaOverwriteEnabled != null && Object.hasOwnProperty.call(message, "replicaOverwriteEnabled")) - writer.uint32(/* id 9, wireType 0 =*/72).bool(message.replicaOverwriteEnabled); - return writer; - }; - - /** - * Encodes the specified SqlInstancesStartExternalSyncRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesStartExternalSyncRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStartExternalSyncRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.syncMode = reader.int32(); - break; - } - case 4: { - message.skipVerification = reader.bool(); - break; - } - case 6: { - message.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.decode(reader, reader.uint32()); - break; - } - case 7: { - message.syncParallelLevel = reader.int32(); - break; - } - case 8: { - message.migrationType = reader.int32(); - break; - } - case 9: { - message.replicaOverwriteEnabled = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesStartExternalSyncRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesStartExternalSyncRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesStartExternalSyncRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesStartExternalSyncRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.syncMode != null && message.hasOwnProperty("syncMode")) - switch (message.syncMode) { - default: - return "syncMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.skipVerification != null && message.hasOwnProperty("skipVerification")) - if (typeof message.skipVerification !== "boolean") - return "skipVerification: boolean expected"; - if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { - properties.syncConfig = 1; - { - var error = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.verify(message.mysqlSyncConfig); - if (error) - return "mysqlSyncConfig." + error; - } - } - if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) - switch (message.syncParallelLevel) { - default: - return "syncParallelLevel: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.migrationType != null && message.hasOwnProperty("migrationType")) - switch (message.migrationType) { - default: - return "migrationType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.replicaOverwriteEnabled != null && message.hasOwnProperty("replicaOverwriteEnabled")) - if (typeof message.replicaOverwriteEnabled !== "boolean") - return "replicaOverwriteEnabled: boolean expected"; - return null; - }; - - /** - * Creates a SqlInstancesStartExternalSyncRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest} SqlInstancesStartExternalSyncRequest - */ - SqlInstancesStartExternalSyncRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - switch (object.syncMode) { - default: - if (typeof object.syncMode === "number") { - message.syncMode = object.syncMode; - break; - } - break; - case "EXTERNAL_SYNC_MODE_UNSPECIFIED": - case 0: - message.syncMode = 0; - break; - case "ONLINE": - case 1: - message.syncMode = 1; - break; - case "OFFLINE": - case 2: - message.syncMode = 2; - break; - } - if (object.skipVerification != null) - message.skipVerification = Boolean(object.skipVerification); - if (object.mysqlSyncConfig != null) { - if (typeof object.mysqlSyncConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest.mysqlSyncConfig: object expected"); - message.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.fromObject(object.mysqlSyncConfig); - } - switch (object.syncParallelLevel) { - default: - if (typeof object.syncParallelLevel === "number") { - message.syncParallelLevel = object.syncParallelLevel; - break; - } - break; - case "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": - case 0: - message.syncParallelLevel = 0; - break; - case "MIN": - case 1: - message.syncParallelLevel = 1; - break; - case "OPTIMAL": - case 2: - message.syncParallelLevel = 2; - break; - case "MAX": - case 3: - message.syncParallelLevel = 3; - break; - } - switch (object.migrationType) { - default: - if (typeof object.migrationType === "number") { - message.migrationType = object.migrationType; - break; - } - break; - case "MIGRATION_TYPE_UNSPECIFIED": - case 0: - message.migrationType = 0; - break; - case "LOGICAL": - case 1: - message.migrationType = 1; - break; - case "PHYSICAL": - case 2: - message.migrationType = 2; - break; - } - if (object.replicaOverwriteEnabled != null) - message.replicaOverwriteEnabled = Boolean(object.replicaOverwriteEnabled); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesStartExternalSyncRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest} message SqlInstancesStartExternalSyncRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesStartExternalSyncRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.syncMode = options.enums === String ? "EXTERNAL_SYNC_MODE_UNSPECIFIED" : 0; - object.skipVerification = false; - object.syncParallelLevel = options.enums === String ? "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED" : 0; - object.migrationType = options.enums === String ? "MIGRATION_TYPE_UNSPECIFIED" : 0; - object.replicaOverwriteEnabled = false; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.syncMode != null && message.hasOwnProperty("syncMode")) - object.syncMode = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] === undefined ? message.syncMode : $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode[message.syncMode] : message.syncMode; - if (message.skipVerification != null && message.hasOwnProperty("skipVerification")) - object.skipVerification = message.skipVerification; - if (message.mysqlSyncConfig != null && message.hasOwnProperty("mysqlSyncConfig")) { - object.mysqlSyncConfig = $root.google.cloud.sql.v1beta4.MySqlSyncConfig.toObject(message.mysqlSyncConfig, options); - if (options.oneofs) - object.syncConfig = "mysqlSyncConfig"; - } - if (message.syncParallelLevel != null && message.hasOwnProperty("syncParallelLevel")) - object.syncParallelLevel = options.enums === String ? $root.google.cloud.sql.v1beta4.ExternalSyncParallelLevel[message.syncParallelLevel] === undefined ? message.syncParallelLevel : $root.google.cloud.sql.v1beta4.ExternalSyncParallelLevel[message.syncParallelLevel] : message.syncParallelLevel; - if (message.migrationType != null && message.hasOwnProperty("migrationType")) - object.migrationType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] === undefined ? message.migrationType : $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType[message.migrationType] : message.migrationType; - if (message.replicaOverwriteEnabled != null && message.hasOwnProperty("replicaOverwriteEnabled")) - object.replicaOverwriteEnabled = message.replicaOverwriteEnabled; - return object; - }; - - /** - * Converts this SqlInstancesStartExternalSyncRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesStartExternalSyncRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesStartExternalSyncRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesStartExternalSyncRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest"; - }; - - return SqlInstancesStartExternalSyncRequest; - })(); - - v1beta4.SqlInstancesResetReplicaSizeRequest = (function() { - - /** - * Properties of a SqlInstancesResetReplicaSizeRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesResetReplicaSizeRequest - * @property {string|null} [instance] SqlInstancesResetReplicaSizeRequest instance - * @property {string|null} [project] SqlInstancesResetReplicaSizeRequest project - */ - - /** - * Constructs a new SqlInstancesResetReplicaSizeRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesResetReplicaSizeRequest. - * @implements ISqlInstancesResetReplicaSizeRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest=} [properties] Properties to set - */ - function SqlInstancesResetReplicaSizeRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesResetReplicaSizeRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @instance - */ - SqlInstancesResetReplicaSizeRequest.prototype.instance = ""; - - /** - * SqlInstancesResetReplicaSizeRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @instance - */ - SqlInstancesResetReplicaSizeRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesResetReplicaSizeRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest instance - */ - SqlInstancesResetReplicaSizeRequest.create = function create(properties) { - return new SqlInstancesResetReplicaSizeRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesResetReplicaSizeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesResetReplicaSizeRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesResetReplicaSizeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesResetReplicaSizeRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesResetReplicaSizeRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesResetReplicaSizeRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesResetReplicaSizeRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesResetReplicaSizeRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesResetReplicaSizeRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesResetReplicaSizeRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest} SqlInstancesResetReplicaSizeRequest - */ - SqlInstancesResetReplicaSizeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesResetReplicaSizeRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest} message SqlInstancesResetReplicaSizeRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesResetReplicaSizeRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesResetReplicaSizeRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesResetReplicaSizeRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesResetReplicaSizeRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesResetReplicaSizeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest"; - }; - - return SqlInstancesResetReplicaSizeRequest; - })(); - - v1beta4.SqlOperationsGetRequest = (function() { - - /** - * Properties of a SqlOperationsGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlOperationsGetRequest - * @property {string|null} [operation] SqlOperationsGetRequest operation - * @property {string|null} [project] SqlOperationsGetRequest project - */ - - /** - * Constructs a new SqlOperationsGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlOperationsGetRequest. - * @implements ISqlOperationsGetRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest=} [properties] Properties to set - */ - function SqlOperationsGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlOperationsGetRequest operation. - * @member {string} operation - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @instance - */ - SqlOperationsGetRequest.prototype.operation = ""; - - /** - * SqlOperationsGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @instance - */ - SqlOperationsGetRequest.prototype.project = ""; - - /** - * Creates a new SqlOperationsGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlOperationsGetRequest} SqlOperationsGetRequest instance - */ - SqlOperationsGetRequest.create = function create(properties) { - return new SqlOperationsGetRequest(properties); - }; - - /** - * Encodes the specified SqlOperationsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest} message SqlOperationsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.operation); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlOperationsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlOperationsGetRequest} message SqlOperationsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlOperationsGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlOperationsGetRequest} SqlOperationsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlOperationsGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.operation = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlOperationsGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlOperationsGetRequest} SqlOperationsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlOperationsGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlOperationsGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.operation != null && message.hasOwnProperty("operation")) - if (!$util.isString(message.operation)) - return "operation: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlOperationsGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlOperationsGetRequest} SqlOperationsGetRequest - */ - SqlOperationsGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlOperationsGetRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlOperationsGetRequest(); - if (object.operation != null) - message.operation = String(object.operation); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlOperationsGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlOperationsGetRequest} message SqlOperationsGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlOperationsGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.operation = ""; - object.project = ""; - } - if (message.operation != null && message.hasOwnProperty("operation")) - object.operation = message.operation; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlOperationsGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlOperationsGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlOperationsGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlOperationsGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlOperationsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlOperationsGetRequest"; - }; - - return SqlOperationsGetRequest; - })(); - - v1beta4.SqlOperationsListRequest = (function() { - - /** - * Properties of a SqlOperationsListRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlOperationsListRequest - * @property {string|null} [instance] SqlOperationsListRequest instance - * @property {number|null} [maxResults] SqlOperationsListRequest maxResults - * @property {string|null} [pageToken] SqlOperationsListRequest pageToken - * @property {string|null} [project] SqlOperationsListRequest project - */ - - /** - * Constructs a new SqlOperationsListRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlOperationsListRequest. - * @implements ISqlOperationsListRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest=} [properties] Properties to set - */ - function SqlOperationsListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlOperationsListRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @instance - */ - SqlOperationsListRequest.prototype.instance = ""; - - /** - * SqlOperationsListRequest maxResults. - * @member {number} maxResults - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @instance - */ - SqlOperationsListRequest.prototype.maxResults = 0; - - /** - * SqlOperationsListRequest pageToken. - * @member {string} pageToken - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @instance - */ - SqlOperationsListRequest.prototype.pageToken = ""; - - /** - * SqlOperationsListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @instance - */ - SqlOperationsListRequest.prototype.project = ""; - - /** - * Creates a new SqlOperationsListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlOperationsListRequest} SqlOperationsListRequest instance - */ - SqlOperationsListRequest.create = function create(properties) { - return new SqlOperationsListRequest(properties); - }; - - /** - * Encodes the specified SqlOperationsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest} message SqlOperationsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.maxResults != null && Object.hasOwnProperty.call(message, "maxResults")) - writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.maxResults); - if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlOperationsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlOperationsListRequest} message SqlOperationsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlOperationsListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlOperationsListRequest} SqlOperationsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlOperationsListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.maxResults = reader.uint32(); - break; - } - case 3: { - message.pageToken = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlOperationsListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlOperationsListRequest} SqlOperationsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlOperationsListRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlOperationsListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - if (!$util.isInteger(message.maxResults)) - return "maxResults: integer expected"; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - if (!$util.isString(message.pageToken)) - return "pageToken: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlOperationsListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlOperationsListRequest} SqlOperationsListRequest - */ - SqlOperationsListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlOperationsListRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlOperationsListRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.maxResults != null) - message.maxResults = object.maxResults >>> 0; - if (object.pageToken != null) - message.pageToken = String(object.pageToken); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlOperationsListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlOperationsListRequest} message SqlOperationsListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlOperationsListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.maxResults = 0; - object.pageToken = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.maxResults != null && message.hasOwnProperty("maxResults")) - object.maxResults = message.maxResults; - if (message.pageToken != null && message.hasOwnProperty("pageToken")) - object.pageToken = message.pageToken; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlOperationsListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlOperationsListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlOperationsListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlOperationsListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlOperationsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlOperationsListRequest"; - }; - - return SqlOperationsListRequest; - })(); - - v1beta4.SqlOperationsCancelRequest = (function() { - - /** - * Properties of a SqlOperationsCancelRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlOperationsCancelRequest - * @property {string|null} [operation] SqlOperationsCancelRequest operation - * @property {string|null} [project] SqlOperationsCancelRequest project - */ - - /** - * Constructs a new SqlOperationsCancelRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlOperationsCancelRequest. - * @implements ISqlOperationsCancelRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest=} [properties] Properties to set - */ - function SqlOperationsCancelRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlOperationsCancelRequest operation. - * @member {string} operation - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @instance - */ - SqlOperationsCancelRequest.prototype.operation = ""; - - /** - * SqlOperationsCancelRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @instance - */ - SqlOperationsCancelRequest.prototype.project = ""; - - /** - * Creates a new SqlOperationsCancelRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlOperationsCancelRequest} SqlOperationsCancelRequest instance - */ - SqlOperationsCancelRequest.create = function create(properties) { - return new SqlOperationsCancelRequest(properties); - }; - - /** - * Encodes the specified SqlOperationsCancelRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsCancelRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest} message SqlOperationsCancelRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsCancelRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.operation); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlOperationsCancelRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlOperationsCancelRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlOperationsCancelRequest} message SqlOperationsCancelRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOperationsCancelRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlOperationsCancelRequest} SqlOperationsCancelRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsCancelRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.operation = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlOperationsCancelRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlOperationsCancelRequest} SqlOperationsCancelRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOperationsCancelRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlOperationsCancelRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlOperationsCancelRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.operation != null && message.hasOwnProperty("operation")) - if (!$util.isString(message.operation)) - return "operation: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlOperationsCancelRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlOperationsCancelRequest} SqlOperationsCancelRequest - */ - SqlOperationsCancelRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlOperationsCancelRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(); - if (object.operation != null) - message.operation = String(object.operation); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlOperationsCancelRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlOperationsCancelRequest} message SqlOperationsCancelRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlOperationsCancelRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.operation = ""; - object.project = ""; - } - if (message.operation != null && message.hasOwnProperty("operation")) - object.operation = message.operation; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlOperationsCancelRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @instance - * @returns {Object.} JSON object - */ - SqlOperationsCancelRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlOperationsCancelRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlOperationsCancelRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlOperationsCancelRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlOperationsCancelRequest"; - }; - - return SqlOperationsCancelRequest; - })(); - - v1beta4.SqlInstancesCreateEphemeralCertRequest = (function() { - - /** - * Properties of a SqlInstancesCreateEphemeralCertRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesCreateEphemeralCertRequest - * @property {string|null} [instance] SqlInstancesCreateEphemeralCertRequest instance - * @property {string|null} [project] SqlInstancesCreateEphemeralCertRequest project - * @property {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest|null} [body] SqlInstancesCreateEphemeralCertRequest body - */ - - /** - * Constructs a new SqlInstancesCreateEphemeralCertRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesCreateEphemeralCertRequest. - * @implements ISqlInstancesCreateEphemeralCertRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest=} [properties] Properties to set - */ - function SqlInstancesCreateEphemeralCertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesCreateEphemeralCertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @instance - */ - SqlInstancesCreateEphemeralCertRequest.prototype.instance = ""; - - /** - * SqlInstancesCreateEphemeralCertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @instance - */ - SqlInstancesCreateEphemeralCertRequest.prototype.project = ""; - - /** - * SqlInstancesCreateEphemeralCertRequest body. - * @member {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @instance - */ - SqlInstancesCreateEphemeralCertRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesCreateEphemeralCertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest instance - */ - SqlInstancesCreateEphemeralCertRequest.create = function create(properties) { - return new SqlInstancesCreateEphemeralCertRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesCreateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesCreateEphemeralCertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesCreateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesCreateEphemeralCertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesCreateEphemeralCertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesCreateEphemeralCertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesCreateEphemeralCertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesCreateEphemeralCertRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesCreateEphemeralCertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesCreateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest} SqlInstancesCreateEphemeralCertRequest - */ - SqlInstancesCreateEphemeralCertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesCreateEphemeralCertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest} message SqlInstancesCreateEphemeralCertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesCreateEphemeralCertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesCreateEphemeralCertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesCreateEphemeralCertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesCreateEphemeralCertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesCreateEphemeralCertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest"; - }; - - return SqlInstancesCreateEphemeralCertRequest; - })(); - - v1beta4.SqlSslCertsDeleteRequest = (function() { - - /** - * Properties of a SqlSslCertsDeleteRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlSslCertsDeleteRequest - * @property {string|null} [instance] SqlSslCertsDeleteRequest instance - * @property {string|null} [project] SqlSslCertsDeleteRequest project - * @property {string|null} [sha1Fingerprint] SqlSslCertsDeleteRequest sha1Fingerprint - */ - - /** - * Constructs a new SqlSslCertsDeleteRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlSslCertsDeleteRequest. - * @implements ISqlSslCertsDeleteRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest=} [properties] Properties to set - */ - function SqlSslCertsDeleteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlSslCertsDeleteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @instance - */ - SqlSslCertsDeleteRequest.prototype.instance = ""; - - /** - * SqlSslCertsDeleteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @instance - */ - SqlSslCertsDeleteRequest.prototype.project = ""; - - /** - * SqlSslCertsDeleteRequest sha1Fingerprint. - * @member {string} sha1Fingerprint - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @instance - */ - SqlSslCertsDeleteRequest.prototype.sha1Fingerprint = ""; - - /** - * Creates a new SqlSslCertsDeleteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest instance - */ - SqlSslCertsDeleteRequest.create = function create(properties) { - return new SqlSslCertsDeleteRequest(properties); - }; - - /** - * Encodes the specified SqlSslCertsDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsDeleteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.sha1Fingerprint); - return writer; - }; - - /** - * Encodes the specified SqlSslCertsDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsDeleteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.sha1Fingerprint = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlSslCertsDeleteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsDeleteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlSslCertsDeleteRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlSslCertsDeleteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - if (!$util.isString(message.sha1Fingerprint)) - return "sha1Fingerprint: string expected"; - return null; - }; - - /** - * Creates a SqlSslCertsDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest} SqlSslCertsDeleteRequest - */ - SqlSslCertsDeleteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.sha1Fingerprint != null) - message.sha1Fingerprint = String(object.sha1Fingerprint); - return message; - }; - - /** - * Creates a plain object from a SqlSslCertsDeleteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest} message SqlSslCertsDeleteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlSslCertsDeleteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.sha1Fingerprint = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - object.sha1Fingerprint = message.sha1Fingerprint; - return object; - }; - - /** - * Converts this SqlSslCertsDeleteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlSslCertsDeleteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlSslCertsDeleteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlSslCertsDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest"; - }; - - return SqlSslCertsDeleteRequest; - })(); - - v1beta4.SqlSslCertsGetRequest = (function() { - - /** - * Properties of a SqlSslCertsGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlSslCertsGetRequest - * @property {string|null} [instance] SqlSslCertsGetRequest instance - * @property {string|null} [project] SqlSslCertsGetRequest project - * @property {string|null} [sha1Fingerprint] SqlSslCertsGetRequest sha1Fingerprint - */ - - /** - * Constructs a new SqlSslCertsGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlSslCertsGetRequest. - * @implements ISqlSslCertsGetRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest=} [properties] Properties to set - */ - function SqlSslCertsGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlSslCertsGetRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @instance - */ - SqlSslCertsGetRequest.prototype.instance = ""; - - /** - * SqlSslCertsGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @instance - */ - SqlSslCertsGetRequest.prototype.project = ""; - - /** - * SqlSslCertsGetRequest sha1Fingerprint. - * @member {string} sha1Fingerprint - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @instance - */ - SqlSslCertsGetRequest.prototype.sha1Fingerprint = ""; - - /** - * Creates a new SqlSslCertsGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlSslCertsGetRequest} SqlSslCertsGetRequest instance - */ - SqlSslCertsGetRequest.create = function create(properties) { - return new SqlSslCertsGetRequest(properties); - }; - - /** - * Encodes the specified SqlSslCertsGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest} message SqlSslCertsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.sha1Fingerprint); - return writer; - }; - - /** - * Encodes the specified SqlSslCertsGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsGetRequest} message SqlSslCertsGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlSslCertsGetRequest} SqlSslCertsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.sha1Fingerprint = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlSslCertsGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlSslCertsGetRequest} SqlSslCertsGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlSslCertsGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlSslCertsGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - if (!$util.isString(message.sha1Fingerprint)) - return "sha1Fingerprint: string expected"; - return null; - }; - - /** - * Creates a SqlSslCertsGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlSslCertsGetRequest} SqlSslCertsGetRequest - */ - SqlSslCertsGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlSslCertsGetRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.sha1Fingerprint != null) - message.sha1Fingerprint = String(object.sha1Fingerprint); - return message; - }; - - /** - * Creates a plain object from a SqlSslCertsGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlSslCertsGetRequest} message SqlSslCertsGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlSslCertsGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.sha1Fingerprint = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - object.sha1Fingerprint = message.sha1Fingerprint; - return object; - }; - - /** - * Converts this SqlSslCertsGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlSslCertsGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlSslCertsGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlSslCertsGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlSslCertsGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlSslCertsGetRequest"; - }; - - return SqlSslCertsGetRequest; - })(); - - v1beta4.SqlSslCertsInsertRequest = (function() { - - /** - * Properties of a SqlSslCertsInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlSslCertsInsertRequest - * @property {string|null} [instance] SqlSslCertsInsertRequest instance - * @property {string|null} [project] SqlSslCertsInsertRequest project - * @property {google.cloud.sql.v1beta4.ISslCertsInsertRequest|null} [body] SqlSslCertsInsertRequest body - */ - - /** - * Constructs a new SqlSslCertsInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlSslCertsInsertRequest. - * @implements ISqlSslCertsInsertRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest=} [properties] Properties to set - */ - function SqlSslCertsInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlSslCertsInsertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @instance - */ - SqlSslCertsInsertRequest.prototype.instance = ""; - - /** - * SqlSslCertsInsertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @instance - */ - SqlSslCertsInsertRequest.prototype.project = ""; - - /** - * SqlSslCertsInsertRequest body. - * @member {google.cloud.sql.v1beta4.ISslCertsInsertRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @instance - */ - SqlSslCertsInsertRequest.prototype.body = null; - - /** - * Creates a new SqlSslCertsInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest instance - */ - SqlSslCertsInsertRequest.create = function create(properties) { - return new SqlSslCertsInsertRequest(properties); - }; - - /** - * Encodes the specified SqlSslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest} message SqlSslCertsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.SslCertsInsertRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlSslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest} message SqlSslCertsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.SslCertsInsertRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlSslCertsInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlSslCertsInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlSslCertsInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.SslCertsInsertRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlSslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlSslCertsInsertRequest} SqlSslCertsInsertRequest - */ - SqlSslCertsInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlSslCertsInsertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.SslCertsInsertRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlSslCertsInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlSslCertsInsertRequest} message SqlSslCertsInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlSslCertsInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.SslCertsInsertRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlSslCertsInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlSslCertsInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlSslCertsInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlSslCertsInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlSslCertsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlSslCertsInsertRequest"; - }; - - return SqlSslCertsInsertRequest; - })(); - - v1beta4.SqlSslCertsListRequest = (function() { - - /** - * Properties of a SqlSslCertsListRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlSslCertsListRequest - * @property {string|null} [instance] SqlSslCertsListRequest instance - * @property {string|null} [project] SqlSslCertsListRequest project - */ - - /** - * Constructs a new SqlSslCertsListRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlSslCertsListRequest. - * @implements ISqlSslCertsListRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest=} [properties] Properties to set - */ - function SqlSslCertsListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlSslCertsListRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @instance - */ - SqlSslCertsListRequest.prototype.instance = ""; - - /** - * SqlSslCertsListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @instance - */ - SqlSslCertsListRequest.prototype.project = ""; - - /** - * Creates a new SqlSslCertsListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlSslCertsListRequest} SqlSslCertsListRequest instance - */ - SqlSslCertsListRequest.create = function create(properties) { - return new SqlSslCertsListRequest(properties); - }; - - /** - * Encodes the specified SqlSslCertsListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest} message SqlSslCertsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlSslCertsListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSslCertsListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlSslCertsListRequest} message SqlSslCertsListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSslCertsListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlSslCertsListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlSslCertsListRequest} SqlSslCertsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlSslCertsListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlSslCertsListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlSslCertsListRequest} SqlSslCertsListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSslCertsListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlSslCertsListRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlSslCertsListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlSslCertsListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlSslCertsListRequest} SqlSslCertsListRequest - */ - SqlSslCertsListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlSslCertsListRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlSslCertsListRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlSslCertsListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlSslCertsListRequest} message SqlSslCertsListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlSslCertsListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlSslCertsListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlSslCertsListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlSslCertsListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlSslCertsListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlSslCertsListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlSslCertsListRequest"; - }; - - return SqlSslCertsListRequest; - })(); - - v1beta4.SqlInstancesGetDiskShrinkConfigRequest = (function() { - - /** - * Properties of a SqlInstancesGetDiskShrinkConfigRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesGetDiskShrinkConfigRequest - * @property {string|null} [instance] SqlInstancesGetDiskShrinkConfigRequest instance - * @property {string|null} [project] SqlInstancesGetDiskShrinkConfigRequest project - */ - - /** - * Constructs a new SqlInstancesGetDiskShrinkConfigRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesGetDiskShrinkConfigRequest. - * @implements ISqlInstancesGetDiskShrinkConfigRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest=} [properties] Properties to set - */ - function SqlInstancesGetDiskShrinkConfigRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesGetDiskShrinkConfigRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @instance - */ - SqlInstancesGetDiskShrinkConfigRequest.prototype.instance = ""; - - /** - * SqlInstancesGetDiskShrinkConfigRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @instance - */ - SqlInstancesGetDiskShrinkConfigRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesGetDiskShrinkConfigRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest instance - */ - SqlInstancesGetDiskShrinkConfigRequest.create = function create(properties) { - return new SqlInstancesGetDiskShrinkConfigRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetDiskShrinkConfigRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetDiskShrinkConfigRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetDiskShrinkConfigRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetDiskShrinkConfigRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesGetDiskShrinkConfigRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesGetDiskShrinkConfigRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesGetDiskShrinkConfigRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest} SqlInstancesGetDiskShrinkConfigRequest - */ - SqlInstancesGetDiskShrinkConfigRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesGetDiskShrinkConfigRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest} message SqlInstancesGetDiskShrinkConfigRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesGetDiskShrinkConfigRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesGetDiskShrinkConfigRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesGetDiskShrinkConfigRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesGetDiskShrinkConfigRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesGetDiskShrinkConfigRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest"; - }; - - return SqlInstancesGetDiskShrinkConfigRequest; - })(); - - v1beta4.SqlInstancesGetLatestRecoveryTimeRequest = (function() { - - /** - * Properties of a SqlInstancesGetLatestRecoveryTimeRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesGetLatestRecoveryTimeRequest - * @property {string|null} [instance] SqlInstancesGetLatestRecoveryTimeRequest instance - * @property {string|null} [project] SqlInstancesGetLatestRecoveryTimeRequest project - * @property {google.protobuf.ITimestamp|null} [sourceInstanceDeletionTime] SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime - */ - - /** - * Constructs a new SqlInstancesGetLatestRecoveryTimeRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesGetLatestRecoveryTimeRequest. - * @implements ISqlInstancesGetLatestRecoveryTimeRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest=} [properties] Properties to set - */ - function SqlInstancesGetLatestRecoveryTimeRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesGetLatestRecoveryTimeRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @instance - */ - SqlInstancesGetLatestRecoveryTimeRequest.prototype.instance = ""; - - /** - * SqlInstancesGetLatestRecoveryTimeRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @instance - */ - SqlInstancesGetLatestRecoveryTimeRequest.prototype.project = ""; - - /** - * SqlInstancesGetLatestRecoveryTimeRequest sourceInstanceDeletionTime. - * @member {google.protobuf.ITimestamp|null|undefined} sourceInstanceDeletionTime - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @instance - */ - SqlInstancesGetLatestRecoveryTimeRequest.prototype.sourceInstanceDeletionTime = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlInstancesGetLatestRecoveryTimeRequest.prototype, "_sourceInstanceDeletionTime", { - get: $util.oneOfGetter($oneOfFields = ["sourceInstanceDeletionTime"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlInstancesGetLatestRecoveryTimeRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest instance - */ - SqlInstancesGetLatestRecoveryTimeRequest.create = function create(properties) { - return new SqlInstancesGetLatestRecoveryTimeRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetLatestRecoveryTimeRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.sourceInstanceDeletionTime != null && Object.hasOwnProperty.call(message, "sourceInstanceDeletionTime")) - $root.google.protobuf.Timestamp.encode(message.sourceInstanceDeletionTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetLatestRecoveryTimeRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetLatestRecoveryTimeRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetLatestRecoveryTimeRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesGetLatestRecoveryTimeRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesGetLatestRecoveryTimeRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { - properties._sourceInstanceDeletionTime = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.sourceInstanceDeletionTime); - if (error) - return "sourceInstanceDeletionTime." + error; - } - } - return null; - }; - - /** - * Creates a SqlInstancesGetLatestRecoveryTimeRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest} SqlInstancesGetLatestRecoveryTimeRequest - */ - SqlInstancesGetLatestRecoveryTimeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.sourceInstanceDeletionTime != null) { - if (typeof object.sourceInstanceDeletionTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest.sourceInstanceDeletionTime: object expected"); - message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.sourceInstanceDeletionTime); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest} message SqlInstancesGetLatestRecoveryTimeRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesGetLatestRecoveryTimeRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { - object.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.sourceInstanceDeletionTime, options); - if (options.oneofs) - object._sourceInstanceDeletionTime = "sourceInstanceDeletionTime"; - } - return object; - }; - - /** - * Converts this SqlInstancesGetLatestRecoveryTimeRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesGetLatestRecoveryTimeRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesGetLatestRecoveryTimeRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesGetLatestRecoveryTimeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest"; - }; - - return SqlInstancesGetLatestRecoveryTimeRequest; - })(); - - v1beta4.SqlInstancesGetLatestRecoveryTimeResponse = (function() { - - /** - * Properties of a SqlInstancesGetLatestRecoveryTimeResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesGetLatestRecoveryTimeResponse - * @property {string|null} [kind] SqlInstancesGetLatestRecoveryTimeResponse kind - * @property {google.protobuf.ITimestamp|null} [latestRecoveryTime] SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime - * @property {google.protobuf.ITimestamp|null} [earliestRecoveryTime] SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime - */ - - /** - * Constructs a new SqlInstancesGetLatestRecoveryTimeResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesGetLatestRecoveryTimeResponse. - * @implements ISqlInstancesGetLatestRecoveryTimeResponse - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse=} [properties] Properties to set - */ - function SqlInstancesGetLatestRecoveryTimeResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesGetLatestRecoveryTimeResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @instance - */ - SqlInstancesGetLatestRecoveryTimeResponse.prototype.kind = ""; - - /** - * SqlInstancesGetLatestRecoveryTimeResponse latestRecoveryTime. - * @member {google.protobuf.ITimestamp|null|undefined} latestRecoveryTime - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @instance - */ - SqlInstancesGetLatestRecoveryTimeResponse.prototype.latestRecoveryTime = null; - - /** - * SqlInstancesGetLatestRecoveryTimeResponse earliestRecoveryTime. - * @member {google.protobuf.ITimestamp|null|undefined} earliestRecoveryTime - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @instance - */ - SqlInstancesGetLatestRecoveryTimeResponse.prototype.earliestRecoveryTime = null; - - /** - * Creates a new SqlInstancesGetLatestRecoveryTimeResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse instance - */ - SqlInstancesGetLatestRecoveryTimeResponse.create = function create(properties) { - return new SqlInstancesGetLatestRecoveryTimeResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetLatestRecoveryTimeResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.latestRecoveryTime != null && Object.hasOwnProperty.call(message, "latestRecoveryTime")) - $root.google.protobuf.Timestamp.encode(message.latestRecoveryTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.earliestRecoveryTime != null && Object.hasOwnProperty.call(message, "earliestRecoveryTime")) - $root.google.protobuf.Timestamp.encode(message.earliestRecoveryTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesGetLatestRecoveryTimeResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetLatestRecoveryTimeResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetLatestRecoveryTimeResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.latestRecoveryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.earliestRecoveryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesGetLatestRecoveryTimeResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetLatestRecoveryTimeResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesGetLatestRecoveryTimeResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesGetLatestRecoveryTimeResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.latestRecoveryTime != null && message.hasOwnProperty("latestRecoveryTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.latestRecoveryTime); - if (error) - return "latestRecoveryTime." + error; - } - if (message.earliestRecoveryTime != null && message.hasOwnProperty("earliestRecoveryTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.earliestRecoveryTime); - if (error) - return "earliestRecoveryTime." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesGetLatestRecoveryTimeResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} SqlInstancesGetLatestRecoveryTimeResponse - */ - SqlInstancesGetLatestRecoveryTimeResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.latestRecoveryTime != null) { - if (typeof object.latestRecoveryTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.latestRecoveryTime: object expected"); - message.latestRecoveryTime = $root.google.protobuf.Timestamp.fromObject(object.latestRecoveryTime); - } - if (object.earliestRecoveryTime != null) { - if (typeof object.earliestRecoveryTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse.earliestRecoveryTime: object expected"); - message.earliestRecoveryTime = $root.google.protobuf.Timestamp.fromObject(object.earliestRecoveryTime); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesGetLatestRecoveryTimeResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse} message SqlInstancesGetLatestRecoveryTimeResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesGetLatestRecoveryTimeResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.latestRecoveryTime = null; - object.earliestRecoveryTime = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.latestRecoveryTime != null && message.hasOwnProperty("latestRecoveryTime")) - object.latestRecoveryTime = $root.google.protobuf.Timestamp.toObject(message.latestRecoveryTime, options); - if (message.earliestRecoveryTime != null && message.hasOwnProperty("earliestRecoveryTime")) - object.earliestRecoveryTime = $root.google.protobuf.Timestamp.toObject(message.earliestRecoveryTime, options); - return object; - }; - - /** - * Converts this SqlInstancesGetLatestRecoveryTimeResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesGetLatestRecoveryTimeResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesGetLatestRecoveryTimeResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesGetLatestRecoveryTimeResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse"; - }; - - return SqlInstancesGetLatestRecoveryTimeResponse; - })(); - - v1beta4.SqlInstancesExecuteSqlRequest = (function() { - - /** - * Properties of a SqlInstancesExecuteSqlRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesExecuteSqlRequest - * @property {string|null} [instance] SqlInstancesExecuteSqlRequest instance - * @property {string|null} [project] SqlInstancesExecuteSqlRequest project - * @property {google.cloud.sql.v1beta4.IExecuteSqlPayload|null} [body] SqlInstancesExecuteSqlRequest body - */ - - /** - * Constructs a new SqlInstancesExecuteSqlRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesExecuteSqlRequest. - * @implements ISqlInstancesExecuteSqlRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest=} [properties] Properties to set - */ - function SqlInstancesExecuteSqlRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesExecuteSqlRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @instance - */ - SqlInstancesExecuteSqlRequest.prototype.instance = ""; - - /** - * SqlInstancesExecuteSqlRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @instance - */ - SqlInstancesExecuteSqlRequest.prototype.project = ""; - - /** - * SqlInstancesExecuteSqlRequest body. - * @member {google.cloud.sql.v1beta4.IExecuteSqlPayload|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @instance - */ - SqlInstancesExecuteSqlRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesExecuteSqlRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest instance - */ - SqlInstancesExecuteSqlRequest.create = function create(properties) { - return new SqlInstancesExecuteSqlRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesExecuteSqlRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExecuteSqlRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesExecuteSqlRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExecuteSqlRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExecuteSqlRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesExecuteSqlRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExecuteSqlRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesExecuteSqlRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesExecuteSqlRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesExecuteSqlRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest} SqlInstancesExecuteSqlRequest - */ - SqlInstancesExecuteSqlRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesExecuteSqlRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest} message SqlInstancesExecuteSqlRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesExecuteSqlRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesExecuteSqlRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesExecuteSqlRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesExecuteSqlRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesExecuteSqlRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest"; - }; - - return SqlInstancesExecuteSqlRequest; - })(); - - v1beta4.SqlInstancesReleaseSsrsLeaseRequest = (function() { - - /** - * Properties of a SqlInstancesReleaseSsrsLeaseRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesReleaseSsrsLeaseRequest - * @property {string|null} [instance] SqlInstancesReleaseSsrsLeaseRequest instance - * @property {string|null} [project] SqlInstancesReleaseSsrsLeaseRequest project - */ - - /** - * Constructs a new SqlInstancesReleaseSsrsLeaseRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesReleaseSsrsLeaseRequest. - * @implements ISqlInstancesReleaseSsrsLeaseRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest=} [properties] Properties to set - */ - function SqlInstancesReleaseSsrsLeaseRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesReleaseSsrsLeaseRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @instance - */ - SqlInstancesReleaseSsrsLeaseRequest.prototype.instance = ""; - - /** - * SqlInstancesReleaseSsrsLeaseRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @instance - */ - SqlInstancesReleaseSsrsLeaseRequest.prototype.project = ""; - - /** - * Creates a new SqlInstancesReleaseSsrsLeaseRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest instance - */ - SqlInstancesReleaseSsrsLeaseRequest.create = function create(properties) { - return new SqlInstancesReleaseSsrsLeaseRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReleaseSsrsLeaseRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReleaseSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReleaseSsrsLeaseRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReleaseSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesReleaseSsrsLeaseRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesReleaseSsrsLeaseRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesReleaseSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest} SqlInstancesReleaseSsrsLeaseRequest - */ - SqlInstancesReleaseSsrsLeaseRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesReleaseSsrsLeaseRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest} message SqlInstancesReleaseSsrsLeaseRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesReleaseSsrsLeaseRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlInstancesReleaseSsrsLeaseRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesReleaseSsrsLeaseRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesReleaseSsrsLeaseRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesReleaseSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest"; - }; - - return SqlInstancesReleaseSsrsLeaseRequest; - })(); - - v1beta4.SqlInstancesReleaseSsrsLeaseResponse = (function() { - - /** - * Properties of a SqlInstancesReleaseSsrsLeaseResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesReleaseSsrsLeaseResponse - * @property {string|null} [operationId] SqlInstancesReleaseSsrsLeaseResponse operationId - */ - - /** - * Constructs a new SqlInstancesReleaseSsrsLeaseResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesReleaseSsrsLeaseResponse. - * @implements ISqlInstancesReleaseSsrsLeaseResponse - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse=} [properties] Properties to set - */ - function SqlInstancesReleaseSsrsLeaseResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesReleaseSsrsLeaseResponse operationId. - * @member {string} operationId - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @instance - */ - SqlInstancesReleaseSsrsLeaseResponse.prototype.operationId = ""; - - /** - * Creates a new SqlInstancesReleaseSsrsLeaseResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse instance - */ - SqlInstancesReleaseSsrsLeaseResponse.create = function create(properties) { - return new SqlInstancesReleaseSsrsLeaseResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReleaseSsrsLeaseResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.operationId != null && Object.hasOwnProperty.call(message, "operationId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.operationId); - return writer; - }; - - /** - * Encodes the specified SqlInstancesReleaseSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesReleaseSsrsLeaseResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReleaseSsrsLeaseResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.operationId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesReleaseSsrsLeaseResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesReleaseSsrsLeaseResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesReleaseSsrsLeaseResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesReleaseSsrsLeaseResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.operationId != null && message.hasOwnProperty("operationId")) - if (!$util.isString(message.operationId)) - return "operationId: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesReleaseSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} SqlInstancesReleaseSsrsLeaseResponse - */ - SqlInstancesReleaseSsrsLeaseResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse(); - if (object.operationId != null) - message.operationId = String(object.operationId); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesReleaseSsrsLeaseResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse} message SqlInstancesReleaseSsrsLeaseResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesReleaseSsrsLeaseResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.operationId = ""; - if (message.operationId != null && message.hasOwnProperty("operationId")) - object.operationId = message.operationId; - return object; - }; - - /** - * Converts this SqlInstancesReleaseSsrsLeaseResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesReleaseSsrsLeaseResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesReleaseSsrsLeaseResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesReleaseSsrsLeaseResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse"; - }; - - return SqlInstancesReleaseSsrsLeaseResponse; - })(); - - v1beta4.ExecuteSqlPayload = (function() { - - /** - * Properties of an ExecuteSqlPayload. - * @memberof google.cloud.sql.v1beta4 - * @interface IExecuteSqlPayload - * @property {string|null} [user] ExecuteSqlPayload user - * @property {string|null} [sqlStatement] ExecuteSqlPayload sqlStatement - * @property {string|null} [database] ExecuteSqlPayload database - * @property {boolean|null} [autoIamAuthn] ExecuteSqlPayload autoIamAuthn - * @property {number|Long|null} [rowLimit] ExecuteSqlPayload rowLimit - * @property {google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode|null} [partialResultMode] ExecuteSqlPayload partialResultMode - * @property {string|null} [application] ExecuteSqlPayload application - */ - - /** - * Constructs a new ExecuteSqlPayload. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an ExecuteSqlPayload. - * @implements IExecuteSqlPayload - * @constructor - * @param {google.cloud.sql.v1beta4.IExecuteSqlPayload=} [properties] Properties to set - */ - function ExecuteSqlPayload(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExecuteSqlPayload user. - * @member {string} user - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.user = ""; - - /** - * ExecuteSqlPayload sqlStatement. - * @member {string} sqlStatement - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.sqlStatement = ""; - - /** - * ExecuteSqlPayload database. - * @member {string} database - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.database = ""; - - /** - * ExecuteSqlPayload autoIamAuthn. - * @member {boolean|null|undefined} autoIamAuthn - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.autoIamAuthn = null; - - /** - * ExecuteSqlPayload rowLimit. - * @member {number|Long} rowLimit - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.rowLimit = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * ExecuteSqlPayload partialResultMode. - * @member {google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode} partialResultMode - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.partialResultMode = 0; - - /** - * ExecuteSqlPayload application. - * @member {string} application - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @instance - */ - ExecuteSqlPayload.prototype.application = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * ExecuteSqlPayload userPassword. - * @member {"autoIamAuthn"|undefined} userPassword - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @instance - */ - Object.defineProperty(ExecuteSqlPayload.prototype, "userPassword", { - get: $util.oneOfGetter($oneOfFields = ["autoIamAuthn"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ExecuteSqlPayload instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @static - * @param {google.cloud.sql.v1beta4.IExecuteSqlPayload=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ExecuteSqlPayload} ExecuteSqlPayload instance - */ - ExecuteSqlPayload.create = function create(properties) { - return new ExecuteSqlPayload(properties); - }; - - /** - * Encodes the specified ExecuteSqlPayload message. Does not implicitly {@link google.cloud.sql.v1beta4.ExecuteSqlPayload.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @static - * @param {google.cloud.sql.v1beta4.IExecuteSqlPayload} message ExecuteSqlPayload message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExecuteSqlPayload.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.user != null && Object.hasOwnProperty.call(message, "user")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.user); - if (message.sqlStatement != null && Object.hasOwnProperty.call(message, "sqlStatement")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.sqlStatement); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.database); - if (message.rowLimit != null && Object.hasOwnProperty.call(message, "rowLimit")) - writer.uint32(/* id 10, wireType 0 =*/80).int64(message.rowLimit); - if (message.autoIamAuthn != null && Object.hasOwnProperty.call(message, "autoIamAuthn")) - writer.uint32(/* id 11, wireType 0 =*/88).bool(message.autoIamAuthn); - if (message.partialResultMode != null && Object.hasOwnProperty.call(message, "partialResultMode")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.partialResultMode); - if (message.application != null && Object.hasOwnProperty.call(message, "application")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.application); - return writer; - }; - - /** - * Encodes the specified ExecuteSqlPayload message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExecuteSqlPayload.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @static - * @param {google.cloud.sql.v1beta4.IExecuteSqlPayload} message ExecuteSqlPayload message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExecuteSqlPayload.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExecuteSqlPayload message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ExecuteSqlPayload} ExecuteSqlPayload - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExecuteSqlPayload.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExecuteSqlPayload(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.user = reader.string(); - break; - } - case 2: { - message.sqlStatement = reader.string(); - break; - } - case 3: { - message.database = reader.string(); - break; - } - case 11: { - message.autoIamAuthn = reader.bool(); - break; - } - case 10: { - message.rowLimit = reader.int64(); - break; - } - case 13: { - message.partialResultMode = reader.int32(); - break; - } - case 16: { - message.application = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExecuteSqlPayload message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ExecuteSqlPayload} ExecuteSqlPayload - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExecuteSqlPayload.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExecuteSqlPayload message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExecuteSqlPayload.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.user != null && message.hasOwnProperty("user")) - if (!$util.isString(message.user)) - return "user: string expected"; - if (message.sqlStatement != null && message.hasOwnProperty("sqlStatement")) - if (!$util.isString(message.sqlStatement)) - return "sqlStatement: string expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - if (message.autoIamAuthn != null && message.hasOwnProperty("autoIamAuthn")) { - properties.userPassword = 1; - if (typeof message.autoIamAuthn !== "boolean") - return "autoIamAuthn: boolean expected"; - } - if (message.rowLimit != null && message.hasOwnProperty("rowLimit")) - if (!$util.isInteger(message.rowLimit) && !(message.rowLimit && $util.isInteger(message.rowLimit.low) && $util.isInteger(message.rowLimit.high))) - return "rowLimit: integer|Long expected"; - if (message.partialResultMode != null && message.hasOwnProperty("partialResultMode")) - switch (message.partialResultMode) { - default: - return "partialResultMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.application != null && message.hasOwnProperty("application")) - if (!$util.isString(message.application)) - return "application: string expected"; - return null; - }; - - /** - * Creates an ExecuteSqlPayload message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ExecuteSqlPayload} ExecuteSqlPayload - */ - ExecuteSqlPayload.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ExecuteSqlPayload) - return object; - var message = new $root.google.cloud.sql.v1beta4.ExecuteSqlPayload(); - if (object.user != null) - message.user = String(object.user); - if (object.sqlStatement != null) - message.sqlStatement = String(object.sqlStatement); - if (object.database != null) - message.database = String(object.database); - if (object.autoIamAuthn != null) - message.autoIamAuthn = Boolean(object.autoIamAuthn); - if (object.rowLimit != null) - if ($util.Long) - (message.rowLimit = $util.Long.fromValue(object.rowLimit)).unsigned = false; - else if (typeof object.rowLimit === "string") - message.rowLimit = parseInt(object.rowLimit, 10); - else if (typeof object.rowLimit === "number") - message.rowLimit = object.rowLimit; - else if (typeof object.rowLimit === "object") - message.rowLimit = new $util.LongBits(object.rowLimit.low >>> 0, object.rowLimit.high >>> 0).toNumber(); - switch (object.partialResultMode) { - default: - if (typeof object.partialResultMode === "number") { - message.partialResultMode = object.partialResultMode; - break; - } - break; - case "PARTIAL_RESULT_MODE_UNSPECIFIED": - case 0: - message.partialResultMode = 0; - break; - case "FAIL_PARTIAL_RESULT": - case 1: - message.partialResultMode = 1; - break; - case "ALLOW_PARTIAL_RESULT": - case 2: - message.partialResultMode = 2; - break; - } - if (object.application != null) - message.application = String(object.application); - return message; - }; - - /** - * Creates a plain object from an ExecuteSqlPayload message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @static - * @param {google.cloud.sql.v1beta4.ExecuteSqlPayload} message ExecuteSqlPayload - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExecuteSqlPayload.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.user = ""; - object.sqlStatement = ""; - object.database = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.rowLimit = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.rowLimit = options.longs === String ? "0" : 0; - object.partialResultMode = options.enums === String ? "PARTIAL_RESULT_MODE_UNSPECIFIED" : 0; - object.application = ""; - } - if (message.user != null && message.hasOwnProperty("user")) - object.user = message.user; - if (message.sqlStatement != null && message.hasOwnProperty("sqlStatement")) - object.sqlStatement = message.sqlStatement; - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - if (message.rowLimit != null && message.hasOwnProperty("rowLimit")) - if (typeof message.rowLimit === "number") - object.rowLimit = options.longs === String ? String(message.rowLimit) : message.rowLimit; - else - object.rowLimit = options.longs === String ? $util.Long.prototype.toString.call(message.rowLimit) : options.longs === Number ? new $util.LongBits(message.rowLimit.low >>> 0, message.rowLimit.high >>> 0).toNumber() : message.rowLimit; - if (message.autoIamAuthn != null && message.hasOwnProperty("autoIamAuthn")) { - object.autoIamAuthn = message.autoIamAuthn; - if (options.oneofs) - object.userPassword = "autoIamAuthn"; - } - if (message.partialResultMode != null && message.hasOwnProperty("partialResultMode")) - object.partialResultMode = options.enums === String ? $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode[message.partialResultMode] === undefined ? message.partialResultMode : $root.google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode[message.partialResultMode] : message.partialResultMode; - if (message.application != null && message.hasOwnProperty("application")) - object.application = message.application; - return object; - }; - - /** - * Converts this ExecuteSqlPayload to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @instance - * @returns {Object.} JSON object - */ - ExecuteSqlPayload.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExecuteSqlPayload - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ExecuteSqlPayload - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExecuteSqlPayload.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExecuteSqlPayload"; - }; - - /** - * PartialResultMode enum. - * @name google.cloud.sql.v1beta4.ExecuteSqlPayload.PartialResultMode - * @enum {number} - * @property {number} PARTIAL_RESULT_MODE_UNSPECIFIED=0 PARTIAL_RESULT_MODE_UNSPECIFIED value - * @property {number} FAIL_PARTIAL_RESULT=1 FAIL_PARTIAL_RESULT value - * @property {number} ALLOW_PARTIAL_RESULT=2 ALLOW_PARTIAL_RESULT value - */ - ExecuteSqlPayload.PartialResultMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "PARTIAL_RESULT_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FAIL_PARTIAL_RESULT"] = 1; - values[valuesById[2] = "ALLOW_PARTIAL_RESULT"] = 2; - return values; - })(); - - return ExecuteSqlPayload; - })(); - - v1beta4.SqlInstancesExecuteSqlResponse = (function() { - - /** - * Properties of a SqlInstancesExecuteSqlResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesExecuteSqlResponse - * @property {Array.|null} [messages] SqlInstancesExecuteSqlResponse messages - * @property {google.cloud.sql.v1beta4.IMetadata|null} [metadata] SqlInstancesExecuteSqlResponse metadata - * @property {Array.|null} [results] SqlInstancesExecuteSqlResponse results - * @property {google.rpc.IStatus|null} [status] SqlInstancesExecuteSqlResponse status - */ - - /** - * Constructs a new SqlInstancesExecuteSqlResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesExecuteSqlResponse. - * @implements ISqlInstancesExecuteSqlResponse - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse=} [properties] Properties to set - */ - function SqlInstancesExecuteSqlResponse(properties) { - this.messages = []; - this.results = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesExecuteSqlResponse messages. - * @member {Array.} messages - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @instance - */ - SqlInstancesExecuteSqlResponse.prototype.messages = $util.emptyArray; - - /** - * SqlInstancesExecuteSqlResponse metadata. - * @member {google.cloud.sql.v1beta4.IMetadata|null|undefined} metadata - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @instance - */ - SqlInstancesExecuteSqlResponse.prototype.metadata = null; - - /** - * SqlInstancesExecuteSqlResponse results. - * @member {Array.} results - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @instance - */ - SqlInstancesExecuteSqlResponse.prototype.results = $util.emptyArray; - - /** - * SqlInstancesExecuteSqlResponse status. - * @member {google.rpc.IStatus|null|undefined} status - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @instance - */ - SqlInstancesExecuteSqlResponse.prototype.status = null; - - /** - * Creates a new SqlInstancesExecuteSqlResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse instance - */ - SqlInstancesExecuteSqlResponse.create = function create(properties) { - return new SqlInstancesExecuteSqlResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesExecuteSqlResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExecuteSqlResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) - $root.google.cloud.sql.v1beta4.Metadata.encode(message.metadata, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.results != null && message.results.length) - for (var i = 0; i < message.results.length; ++i) - $root.google.cloud.sql.v1beta4.QueryResult.encode(message.results[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.messages != null && message.messages.length) - for (var i = 0; i < message.messages.length; ++i) - $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.encode(message.messages[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesExecuteSqlResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesExecuteSqlResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExecuteSqlResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 9: { - if (!(message.messages && message.messages.length)) - message.messages = []; - message.messages.push($root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.decode(reader, reader.uint32())); - break; - } - case 6: { - message.metadata = $root.google.cloud.sql.v1beta4.Metadata.decode(reader, reader.uint32()); - break; - } - case 7: { - if (!(message.results && message.results.length)) - message.results = []; - message.results.push($root.google.cloud.sql.v1beta4.QueryResult.decode(reader, reader.uint32())); - break; - } - case 8: { - message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesExecuteSqlResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesExecuteSqlResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesExecuteSqlResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesExecuteSqlResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.messages != null && message.hasOwnProperty("messages")) { - if (!Array.isArray(message.messages)) - return "messages: array expected"; - for (var i = 0; i < message.messages.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.verify(message.messages[i]); - if (error) - return "messages." + error; - } - } - if (message.metadata != null && message.hasOwnProperty("metadata")) { - var error = $root.google.cloud.sql.v1beta4.Metadata.verify(message.metadata); - if (error) - return "metadata." + error; - } - if (message.results != null && message.hasOwnProperty("results")) { - if (!Array.isArray(message.results)) - return "results: array expected"; - for (var i = 0; i < message.results.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.QueryResult.verify(message.results[i]); - if (error) - return "results." + error; - } - } - if (message.status != null && message.hasOwnProperty("status")) { - var error = $root.google.rpc.Status.verify(message.status); - if (error) - return "status." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesExecuteSqlResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} SqlInstancesExecuteSqlResponse - */ - SqlInstancesExecuteSqlResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse(); - if (object.messages) { - if (!Array.isArray(object.messages)) - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.messages: array expected"); - message.messages = []; - for (var i = 0; i < object.messages.length; ++i) { - if (typeof object.messages[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.messages: object expected"); - message.messages[i] = $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.fromObject(object.messages[i]); - } - } - if (object.metadata != null) { - if (typeof object.metadata !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.metadata: object expected"); - message.metadata = $root.google.cloud.sql.v1beta4.Metadata.fromObject(object.metadata); - } - if (object.results) { - if (!Array.isArray(object.results)) - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.results: array expected"); - message.results = []; - for (var i = 0; i < object.results.length; ++i) { - if (typeof object.results[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.results: object expected"); - message.results[i] = $root.google.cloud.sql.v1beta4.QueryResult.fromObject(object.results[i]); - } - } - if (object.status != null) { - if (typeof object.status !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.status: object expected"); - message.status = $root.google.rpc.Status.fromObject(object.status); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesExecuteSqlResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse} message SqlInstancesExecuteSqlResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesExecuteSqlResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.results = []; - object.messages = []; - } - if (options.defaults) { - object.metadata = null; - object.status = null; - } - if (message.metadata != null && message.hasOwnProperty("metadata")) - object.metadata = $root.google.cloud.sql.v1beta4.Metadata.toObject(message.metadata, options); - if (message.results && message.results.length) { - object.results = []; - for (var j = 0; j < message.results.length; ++j) - object.results[j] = $root.google.cloud.sql.v1beta4.QueryResult.toObject(message.results[j], options); - } - if (message.status != null && message.hasOwnProperty("status")) - object.status = $root.google.rpc.Status.toObject(message.status, options); - if (message.messages && message.messages.length) { - object.messages = []; - for (var j = 0; j < message.messages.length; ++j) - object.messages[j] = $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.toObject(message.messages[j], options); - } - return object; - }; - - /** - * Converts this SqlInstancesExecuteSqlResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesExecuteSqlResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesExecuteSqlResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesExecuteSqlResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse"; - }; - - SqlInstancesExecuteSqlResponse.Message = (function() { - - /** - * Properties of a Message. - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @interface IMessage - * @property {string|null} [message] Message message - * @property {string|null} [severity] Message severity - */ - - /** - * Constructs a new Message. - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse - * @classdesc Represents a Message. - * @implements IMessage - * @constructor - * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage=} [properties] Properties to set - */ - function Message(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Message message. - * @member {string|null|undefined} message - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @instance - */ - Message.prototype.message = null; - - /** - * Message severity. - * @member {string|null|undefined} severity - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @instance - */ - Message.prototype.severity = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Message.prototype, "_message", { - get: $util.oneOfGetter($oneOfFields = ["message"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Message.prototype, "_severity", { - get: $util.oneOfGetter($oneOfFields = ["severity"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Message instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message} Message instance - */ - Message.create = function create(properties) { - return new Message(properties); - }; - - /** - * Encodes the specified Message message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage} message Message message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Message.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.message); - if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.severity); - return writer; - }; - - /** - * Encodes the specified Message message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.IMessage} message Message message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Message.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Message message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message} Message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Message.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.message = reader.string(); - break; - } - case 2: { - message.severity = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Message message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message} Message - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Message.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Message message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Message.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.message != null && message.hasOwnProperty("message")) { - properties._message = 1; - if (!$util.isString(message.message)) - return "message: string expected"; - } - if (message.severity != null && message.hasOwnProperty("severity")) { - properties._severity = 1; - if (!$util.isString(message.severity)) - return "severity: string expected"; - } - return null; - }; - - /** - * Creates a Message message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message} Message - */ - Message.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message(); - if (object.message != null) - message.message = String(object.message); - if (object.severity != null) - message.severity = String(object.severity); - return message; - }; - - /** - * Creates a plain object from a Message message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message} message Message - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Message.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.message != null && message.hasOwnProperty("message")) { - object.message = message.message; - if (options.oneofs) - object._message = "message"; - } - if (message.severity != null && message.hasOwnProperty("severity")) { - object.severity = message.severity; - if (options.oneofs) - object._severity = "severity"; - } - return object; - }; - - /** - * Converts this Message to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @instance - * @returns {Object.} JSON object - */ - Message.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Message - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Message.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse.Message"; - }; - - return Message; - })(); - - return SqlInstancesExecuteSqlResponse; - })(); - - v1beta4.QueryResult = (function() { - - /** - * Properties of a QueryResult. - * @memberof google.cloud.sql.v1beta4 - * @interface IQueryResult - * @property {Array.|null} [columns] QueryResult columns - * @property {Array.|null} [rows] QueryResult rows - * @property {string|null} [message] QueryResult message - * @property {boolean|null} [partialResult] QueryResult partialResult - * @property {google.rpc.IStatus|null} [status] QueryResult status - */ - - /** - * Constructs a new QueryResult. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a QueryResult. - * @implements IQueryResult - * @constructor - * @param {google.cloud.sql.v1beta4.IQueryResult=} [properties] Properties to set - */ - function QueryResult(properties) { - this.columns = []; - this.rows = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * QueryResult columns. - * @member {Array.} columns - * @memberof google.cloud.sql.v1beta4.QueryResult - * @instance - */ - QueryResult.prototype.columns = $util.emptyArray; - - /** - * QueryResult rows. - * @member {Array.} rows - * @memberof google.cloud.sql.v1beta4.QueryResult - * @instance - */ - QueryResult.prototype.rows = $util.emptyArray; - - /** - * QueryResult message. - * @member {string} message - * @memberof google.cloud.sql.v1beta4.QueryResult - * @instance - */ - QueryResult.prototype.message = ""; - - /** - * QueryResult partialResult. - * @member {boolean} partialResult - * @memberof google.cloud.sql.v1beta4.QueryResult - * @instance - */ - QueryResult.prototype.partialResult = false; - - /** - * QueryResult status. - * @member {google.rpc.IStatus|null|undefined} status - * @memberof google.cloud.sql.v1beta4.QueryResult - * @instance - */ - QueryResult.prototype.status = null; - - /** - * Creates a new QueryResult instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.QueryResult - * @static - * @param {google.cloud.sql.v1beta4.IQueryResult=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.QueryResult} QueryResult instance - */ - QueryResult.create = function create(properties) { - return new QueryResult(properties); - }; - - /** - * Encodes the specified QueryResult message. Does not implicitly {@link google.cloud.sql.v1beta4.QueryResult.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.QueryResult - * @static - * @param {google.cloud.sql.v1beta4.IQueryResult} message QueryResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryResult.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.columns != null && message.columns.length) - for (var i = 0; i < message.columns.length; ++i) - $root.google.cloud.sql.v1beta4.Column.encode(message.columns[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.rows != null && message.rows.length) - for (var i = 0; i < message.rows.length; ++i) - $root.google.cloud.sql.v1beta4.Row.encode(message.rows[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); - if (message.partialResult != null && Object.hasOwnProperty.call(message, "partialResult")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.partialResult); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - $root.google.rpc.Status.encode(message.status, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified QueryResult message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.QueryResult.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.QueryResult - * @static - * @param {google.cloud.sql.v1beta4.IQueryResult} message QueryResult message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - QueryResult.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a QueryResult message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.QueryResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.QueryResult} QueryResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryResult.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.QueryResult(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.columns && message.columns.length)) - message.columns = []; - message.columns.push($root.google.cloud.sql.v1beta4.Column.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.rows && message.rows.length)) - message.rows = []; - message.rows.push($root.google.cloud.sql.v1beta4.Row.decode(reader, reader.uint32())); - break; - } - case 3: { - message.message = reader.string(); - break; - } - case 4: { - message.partialResult = reader.bool(); - break; - } - case 8: { - message.status = $root.google.rpc.Status.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a QueryResult message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.QueryResult - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.QueryResult} QueryResult - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - QueryResult.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a QueryResult message. - * @function verify - * @memberof google.cloud.sql.v1beta4.QueryResult - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - QueryResult.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.columns != null && message.hasOwnProperty("columns")) { - if (!Array.isArray(message.columns)) - return "columns: array expected"; - for (var i = 0; i < message.columns.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.Column.verify(message.columns[i]); - if (error) - return "columns." + error; - } - } - if (message.rows != null && message.hasOwnProperty("rows")) { - if (!Array.isArray(message.rows)) - return "rows: array expected"; - for (var i = 0; i < message.rows.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.Row.verify(message.rows[i]); - if (error) - return "rows." + error; - } - } - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (message.partialResult != null && message.hasOwnProperty("partialResult")) - if (typeof message.partialResult !== "boolean") - return "partialResult: boolean expected"; - if (message.status != null && message.hasOwnProperty("status")) { - var error = $root.google.rpc.Status.verify(message.status); - if (error) - return "status." + error; - } - return null; - }; - - /** - * Creates a QueryResult message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.QueryResult - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.QueryResult} QueryResult - */ - QueryResult.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.QueryResult) - return object; - var message = new $root.google.cloud.sql.v1beta4.QueryResult(); - if (object.columns) { - if (!Array.isArray(object.columns)) - throw TypeError(".google.cloud.sql.v1beta4.QueryResult.columns: array expected"); - message.columns = []; - for (var i = 0; i < object.columns.length; ++i) { - if (typeof object.columns[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.QueryResult.columns: object expected"); - message.columns[i] = $root.google.cloud.sql.v1beta4.Column.fromObject(object.columns[i]); - } - } - if (object.rows) { - if (!Array.isArray(object.rows)) - throw TypeError(".google.cloud.sql.v1beta4.QueryResult.rows: array expected"); - message.rows = []; - for (var i = 0; i < object.rows.length; ++i) { - if (typeof object.rows[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.QueryResult.rows: object expected"); - message.rows[i] = $root.google.cloud.sql.v1beta4.Row.fromObject(object.rows[i]); - } - } - if (object.message != null) - message.message = String(object.message); - if (object.partialResult != null) - message.partialResult = Boolean(object.partialResult); - if (object.status != null) { - if (typeof object.status !== "object") - throw TypeError(".google.cloud.sql.v1beta4.QueryResult.status: object expected"); - message.status = $root.google.rpc.Status.fromObject(object.status); - } - return message; - }; - - /** - * Creates a plain object from a QueryResult message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.QueryResult - * @static - * @param {google.cloud.sql.v1beta4.QueryResult} message QueryResult - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - QueryResult.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.columns = []; - object.rows = []; - } - if (options.defaults) { - object.message = ""; - object.partialResult = false; - object.status = null; - } - if (message.columns && message.columns.length) { - object.columns = []; - for (var j = 0; j < message.columns.length; ++j) - object.columns[j] = $root.google.cloud.sql.v1beta4.Column.toObject(message.columns[j], options); - } - if (message.rows && message.rows.length) { - object.rows = []; - for (var j = 0; j < message.rows.length; ++j) - object.rows[j] = $root.google.cloud.sql.v1beta4.Row.toObject(message.rows[j], options); - } - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.partialResult != null && message.hasOwnProperty("partialResult")) - object.partialResult = message.partialResult; - if (message.status != null && message.hasOwnProperty("status")) - object.status = $root.google.rpc.Status.toObject(message.status, options); - return object; - }; - - /** - * Converts this QueryResult to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.QueryResult - * @instance - * @returns {Object.} JSON object - */ - QueryResult.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for QueryResult - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.QueryResult - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - QueryResult.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.QueryResult"; - }; - - return QueryResult; - })(); - - v1beta4.Column = (function() { - - /** - * Properties of a Column. - * @memberof google.cloud.sql.v1beta4 - * @interface IColumn - * @property {string|null} [name] Column name - * @property {string|null} [type] Column type - */ - - /** - * Constructs a new Column. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a Column. - * @implements IColumn - * @constructor - * @param {google.cloud.sql.v1beta4.IColumn=} [properties] Properties to set - */ - function Column(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Column name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.Column - * @instance - */ - Column.prototype.name = ""; - - /** - * Column type. - * @member {string} type - * @memberof google.cloud.sql.v1beta4.Column - * @instance - */ - Column.prototype.type = ""; - - /** - * Creates a new Column instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.Column - * @static - * @param {google.cloud.sql.v1beta4.IColumn=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.Column} Column instance - */ - Column.create = function create(properties) { - return new Column(properties); - }; - - /** - * Encodes the specified Column message. Does not implicitly {@link google.cloud.sql.v1beta4.Column.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.Column - * @static - * @param {google.cloud.sql.v1beta4.IColumn} message Column message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Column.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.type); - return writer; - }; - - /** - * Encodes the specified Column message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Column.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.Column - * @static - * @param {google.cloud.sql.v1beta4.IColumn} message Column message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Column.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Column message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.Column - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.Column} Column - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Column.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Column(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.type = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Column message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.Column - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.Column} Column - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Column.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Column message. - * @function verify - * @memberof google.cloud.sql.v1beta4.Column - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Column.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - return null; - }; - - /** - * Creates a Column message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.Column - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.Column} Column - */ - Column.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.Column) - return object; - var message = new $root.google.cloud.sql.v1beta4.Column(); - if (object.name != null) - message.name = String(object.name); - if (object.type != null) - message.type = String(object.type); - return message; - }; - - /** - * Creates a plain object from a Column message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.Column - * @static - * @param {google.cloud.sql.v1beta4.Column} message Column - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Column.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.type = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - return object; - }; - - /** - * Converts this Column to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.Column - * @instance - * @returns {Object.} JSON object - */ - Column.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Column - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.Column - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Column.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.Column"; - }; - - return Column; - })(); - - v1beta4.Row = (function() { - - /** - * Properties of a Row. - * @memberof google.cloud.sql.v1beta4 - * @interface IRow - * @property {Array.|null} [values] Row values - */ - - /** - * Constructs a new Row. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a Row. - * @implements IRow - * @constructor - * @param {google.cloud.sql.v1beta4.IRow=} [properties] Properties to set - */ - function Row(properties) { - this.values = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Row values. - * @member {Array.} values - * @memberof google.cloud.sql.v1beta4.Row - * @instance - */ - Row.prototype.values = $util.emptyArray; - - /** - * Creates a new Row instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.Row - * @static - * @param {google.cloud.sql.v1beta4.IRow=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.Row} Row instance - */ - Row.create = function create(properties) { - return new Row(properties); - }; - - /** - * Encodes the specified Row message. Does not implicitly {@link google.cloud.sql.v1beta4.Row.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.Row - * @static - * @param {google.cloud.sql.v1beta4.IRow} message Row message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Row.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.values != null && message.values.length) - for (var i = 0; i < message.values.length; ++i) - $root.google.cloud.sql.v1beta4.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Row message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Row.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.Row - * @static - * @param {google.cloud.sql.v1beta4.IRow} message Row message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Row.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Row message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.Row - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.Row} Row - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Row.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Row(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.values && message.values.length)) - message.values = []; - message.values.push($root.google.cloud.sql.v1beta4.Value.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Row message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.Row - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.Row} Row - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Row.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Row message. - * @function verify - * @memberof google.cloud.sql.v1beta4.Row - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Row.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.values != null && message.hasOwnProperty("values")) { - if (!Array.isArray(message.values)) - return "values: array expected"; - for (var i = 0; i < message.values.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.Value.verify(message.values[i]); - if (error) - return "values." + error; - } - } - return null; - }; - - /** - * Creates a Row message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.Row - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.Row} Row - */ - Row.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.Row) - return object; - var message = new $root.google.cloud.sql.v1beta4.Row(); - if (object.values) { - if (!Array.isArray(object.values)) - throw TypeError(".google.cloud.sql.v1beta4.Row.values: array expected"); - message.values = []; - for (var i = 0; i < object.values.length; ++i) { - if (typeof object.values[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Row.values: object expected"); - message.values[i] = $root.google.cloud.sql.v1beta4.Value.fromObject(object.values[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Row message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.Row - * @static - * @param {google.cloud.sql.v1beta4.Row} message Row - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Row.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.values = []; - if (message.values && message.values.length) { - object.values = []; - for (var j = 0; j < message.values.length; ++j) - object.values[j] = $root.google.cloud.sql.v1beta4.Value.toObject(message.values[j], options); - } - return object; - }; - - /** - * Converts this Row to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.Row - * @instance - * @returns {Object.} JSON object - */ - Row.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Row - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.Row - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Row.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.Row"; - }; - - return Row; - })(); - - v1beta4.Value = (function() { - - /** - * Properties of a Value. - * @memberof google.cloud.sql.v1beta4 - * @interface IValue - * @property {string|null} [value] Value value - * @property {boolean|null} [nullValue] Value nullValue - */ - - /** - * Constructs a new Value. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a Value. - * @implements IValue - * @constructor - * @param {google.cloud.sql.v1beta4.IValue=} [properties] Properties to set - */ - function Value(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Value value. - * @member {string} value - * @memberof google.cloud.sql.v1beta4.Value - * @instance - */ - Value.prototype.value = ""; - - /** - * Value nullValue. - * @member {boolean} nullValue - * @memberof google.cloud.sql.v1beta4.Value - * @instance - */ - Value.prototype.nullValue = false; - - /** - * Creates a new Value instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.Value - * @static - * @param {google.cloud.sql.v1beta4.IValue=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.Value} Value instance - */ - Value.create = function create(properties) { - return new Value(properties); - }; - - /** - * Encodes the specified Value message. Does not implicitly {@link google.cloud.sql.v1beta4.Value.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.Value - * @static - * @param {google.cloud.sql.v1beta4.IValue} message Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Value.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.nullValue); - return writer; - }; - - /** - * Encodes the specified Value message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Value.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.Value - * @static - * @param {google.cloud.sql.v1beta4.IValue} message Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Value message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.Value} Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Value.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Value(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.string(); - break; - } - case 2: { - message.nullValue = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Value message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.Value} Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Value.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Value message. - * @function verify - * @memberof google.cloud.sql.v1beta4.Value - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Value.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.nullValue != null && message.hasOwnProperty("nullValue")) - if (typeof message.nullValue !== "boolean") - return "nullValue: boolean expected"; - return null; - }; - - /** - * Creates a Value message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.Value - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.Value} Value - */ - Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.Value) - return object; - var message = new $root.google.cloud.sql.v1beta4.Value(); - if (object.value != null) - message.value = String(object.value); - if (object.nullValue != null) - message.nullValue = Boolean(object.nullValue); - return message; - }; - - /** - * Creates a plain object from a Value message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.Value - * @static - * @param {google.cloud.sql.v1beta4.Value} message Value - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Value.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.value = ""; - object.nullValue = false; - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.nullValue != null && message.hasOwnProperty("nullValue")) - object.nullValue = message.nullValue; - return object; - }; - - /** - * Converts this Value to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.Value - * @instance - * @returns {Object.} JSON object - */ - Value.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Value - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.Value - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.Value"; - }; - - return Value; - })(); - - v1beta4.Metadata = (function() { - - /** - * Properties of a Metadata. - * @memberof google.cloud.sql.v1beta4 - * @interface IMetadata - * @property {google.protobuf.IDuration|null} [sqlStatementExecutionTime] Metadata sqlStatementExecutionTime - */ - - /** - * Constructs a new Metadata. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a Metadata. - * @implements IMetadata - * @constructor - * @param {google.cloud.sql.v1beta4.IMetadata=} [properties] Properties to set - */ - function Metadata(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Metadata sqlStatementExecutionTime. - * @member {google.protobuf.IDuration|null|undefined} sqlStatementExecutionTime - * @memberof google.cloud.sql.v1beta4.Metadata - * @instance - */ - Metadata.prototype.sqlStatementExecutionTime = null; - - /** - * Creates a new Metadata instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.Metadata - * @static - * @param {google.cloud.sql.v1beta4.IMetadata=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.Metadata} Metadata instance - */ - Metadata.create = function create(properties) { - return new Metadata(properties); - }; - - /** - * Encodes the specified Metadata message. Does not implicitly {@link google.cloud.sql.v1beta4.Metadata.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.Metadata - * @static - * @param {google.cloud.sql.v1beta4.IMetadata} message Metadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Metadata.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sqlStatementExecutionTime != null && Object.hasOwnProperty.call(message, "sqlStatementExecutionTime")) - $root.google.protobuf.Duration.encode(message.sqlStatementExecutionTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Metadata message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Metadata.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.Metadata - * @static - * @param {google.cloud.sql.v1beta4.IMetadata} message Metadata message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Metadata.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Metadata message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.Metadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.Metadata} Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Metadata.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Metadata(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.sqlStatementExecutionTime = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Metadata message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.Metadata - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.Metadata} Metadata - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Metadata.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Metadata message. - * @function verify - * @memberof google.cloud.sql.v1beta4.Metadata - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Metadata.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.sqlStatementExecutionTime != null && message.hasOwnProperty("sqlStatementExecutionTime")) { - var error = $root.google.protobuf.Duration.verify(message.sqlStatementExecutionTime); - if (error) - return "sqlStatementExecutionTime." + error; - } - return null; - }; - - /** - * Creates a Metadata message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.Metadata - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.Metadata} Metadata - */ - Metadata.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.Metadata) - return object; - var message = new $root.google.cloud.sql.v1beta4.Metadata(); - if (object.sqlStatementExecutionTime != null) { - if (typeof object.sqlStatementExecutionTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Metadata.sqlStatementExecutionTime: object expected"); - message.sqlStatementExecutionTime = $root.google.protobuf.Duration.fromObject(object.sqlStatementExecutionTime); - } - return message; - }; - - /** - * Creates a plain object from a Metadata message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.Metadata - * @static - * @param {google.cloud.sql.v1beta4.Metadata} message Metadata - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Metadata.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.sqlStatementExecutionTime = null; - if (message.sqlStatementExecutionTime != null && message.hasOwnProperty("sqlStatementExecutionTime")) - object.sqlStatementExecutionTime = $root.google.protobuf.Duration.toObject(message.sqlStatementExecutionTime, options); - return object; - }; - - /** - * Converts this Metadata to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.Metadata - * @instance - * @returns {Object.} JSON object - */ - Metadata.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Metadata - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.Metadata - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Metadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.Metadata"; - }; - - return Metadata; - })(); - - v1beta4.SqlInstancesAcquireSsrsLeaseRequest = (function() { - - /** - * Properties of a SqlInstancesAcquireSsrsLeaseRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesAcquireSsrsLeaseRequest - * @property {string|null} [instance] SqlInstancesAcquireSsrsLeaseRequest instance - * @property {string|null} [project] SqlInstancesAcquireSsrsLeaseRequest project - * @property {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest|null} [body] SqlInstancesAcquireSsrsLeaseRequest body - */ - - /** - * Constructs a new SqlInstancesAcquireSsrsLeaseRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesAcquireSsrsLeaseRequest. - * @implements ISqlInstancesAcquireSsrsLeaseRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set - */ - function SqlInstancesAcquireSsrsLeaseRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesAcquireSsrsLeaseRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @instance - */ - SqlInstancesAcquireSsrsLeaseRequest.prototype.instance = ""; - - /** - * SqlInstancesAcquireSsrsLeaseRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @instance - */ - SqlInstancesAcquireSsrsLeaseRequest.prototype.project = ""; - - /** - * SqlInstancesAcquireSsrsLeaseRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @instance - */ - SqlInstancesAcquireSsrsLeaseRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesAcquireSsrsLeaseRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest instance - */ - SqlInstancesAcquireSsrsLeaseRequest.create = function create(properties) { - return new SqlInstancesAcquireSsrsLeaseRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAcquireSsrsLeaseRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAcquireSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAcquireSsrsLeaseRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAcquireSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesAcquireSsrsLeaseRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesAcquireSsrsLeaseRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest} SqlInstancesAcquireSsrsLeaseRequest - */ - SqlInstancesAcquireSsrsLeaseRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest} message SqlInstancesAcquireSsrsLeaseRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesAcquireSsrsLeaseRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesAcquireSsrsLeaseRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesAcquireSsrsLeaseRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesAcquireSsrsLeaseRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesAcquireSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest"; - }; - - return SqlInstancesAcquireSsrsLeaseRequest; - })(); - - v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest = (function() { - - /** - * Properties of a SqlInstancesPreCheckMajorVersionUpgradeRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesPreCheckMajorVersionUpgradeRequest - * @property {string|null} [instance] SqlInstancesPreCheckMajorVersionUpgradeRequest instance - * @property {string|null} [project] SqlInstancesPreCheckMajorVersionUpgradeRequest project - * @property {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest|null} [body] SqlInstancesPreCheckMajorVersionUpgradeRequest body - */ - - /** - * Constructs a new SqlInstancesPreCheckMajorVersionUpgradeRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesPreCheckMajorVersionUpgradeRequest. - * @implements ISqlInstancesPreCheckMajorVersionUpgradeRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set - */ - function SqlInstancesPreCheckMajorVersionUpgradeRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesPreCheckMajorVersionUpgradeRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @instance - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.instance = ""; - - /** - * SqlInstancesPreCheckMajorVersionUpgradeRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @instance - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.project = ""; - - /** - * SqlInstancesPreCheckMajorVersionUpgradeRequest body. - * @member {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @instance - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.body = null; - - /** - * Creates a new SqlInstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest instance - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.create = function create(properties) { - return new SqlInstancesPreCheckMajorVersionUpgradeRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.encode(message.body, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.body = $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesPreCheckMajorVersionUpgradeRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest} SqlInstancesPreCheckMajorVersionUpgradeRequest - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest} message SqlInstancesPreCheckMajorVersionUpgradeRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlInstancesPreCheckMajorVersionUpgradeRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesPreCheckMajorVersionUpgradeRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesPreCheckMajorVersionUpgradeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest"; - }; - - return SqlInstancesPreCheckMajorVersionUpgradeRequest; - })(); - - v1beta4.SqlInstancesAcquireSsrsLeaseResponse = (function() { - - /** - * Properties of a SqlInstancesAcquireSsrsLeaseResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesAcquireSsrsLeaseResponse - * @property {string|null} [operationId] SqlInstancesAcquireSsrsLeaseResponse operationId - */ - - /** - * Constructs a new SqlInstancesAcquireSsrsLeaseResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesAcquireSsrsLeaseResponse. - * @implements ISqlInstancesAcquireSsrsLeaseResponse - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse=} [properties] Properties to set - */ - function SqlInstancesAcquireSsrsLeaseResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesAcquireSsrsLeaseResponse operationId. - * @member {string|null|undefined} operationId - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @instance - */ - SqlInstancesAcquireSsrsLeaseResponse.prototype.operationId = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlInstancesAcquireSsrsLeaseResponse.prototype, "_operationId", { - get: $util.oneOfGetter($oneOfFields = ["operationId"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlInstancesAcquireSsrsLeaseResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse instance - */ - SqlInstancesAcquireSsrsLeaseResponse.create = function create(properties) { - return new SqlInstancesAcquireSsrsLeaseResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAcquireSsrsLeaseResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.operationId != null && Object.hasOwnProperty.call(message, "operationId")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.operationId); - return writer; - }; - - /** - * Encodes the specified SqlInstancesAcquireSsrsLeaseResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesAcquireSsrsLeaseResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAcquireSsrsLeaseResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.operationId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesAcquireSsrsLeaseResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesAcquireSsrsLeaseResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesAcquireSsrsLeaseResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesAcquireSsrsLeaseResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.operationId != null && message.hasOwnProperty("operationId")) { - properties._operationId = 1; - if (!$util.isString(message.operationId)) - return "operationId: string expected"; - } - return null; - }; - - /** - * Creates a SqlInstancesAcquireSsrsLeaseResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} SqlInstancesAcquireSsrsLeaseResponse - */ - SqlInstancesAcquireSsrsLeaseResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse(); - if (object.operationId != null) - message.operationId = String(object.operationId); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesAcquireSsrsLeaseResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse} message SqlInstancesAcquireSsrsLeaseResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesAcquireSsrsLeaseResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.operationId != null && message.hasOwnProperty("operationId")) { - object.operationId = message.operationId; - if (options.oneofs) - object._operationId = "operationId"; - } - return object; - }; - - /** - * Converts this SqlInstancesAcquireSsrsLeaseResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesAcquireSsrsLeaseResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesAcquireSsrsLeaseResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesAcquireSsrsLeaseResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse"; - }; - - return SqlInstancesAcquireSsrsLeaseResponse; - })(); - - v1beta4.SqlInstancesPointInTimeRestoreRequest = (function() { - - /** - * Properties of a SqlInstancesPointInTimeRestoreRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesPointInTimeRestoreRequest - * @property {string|null} [parent] SqlInstancesPointInTimeRestoreRequest parent - * @property {google.cloud.sql.v1beta4.IPointInTimeRestoreContext|null} [context] SqlInstancesPointInTimeRestoreRequest context - */ - - /** - * Constructs a new SqlInstancesPointInTimeRestoreRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesPointInTimeRestoreRequest. - * @implements ISqlInstancesPointInTimeRestoreRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest=} [properties] Properties to set - */ - function SqlInstancesPointInTimeRestoreRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesPointInTimeRestoreRequest parent. - * @member {string} parent - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @instance - */ - SqlInstancesPointInTimeRestoreRequest.prototype.parent = ""; - - /** - * SqlInstancesPointInTimeRestoreRequest context. - * @member {google.cloud.sql.v1beta4.IPointInTimeRestoreContext|null|undefined} context - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @instance - */ - SqlInstancesPointInTimeRestoreRequest.prototype.context = null; - - /** - * Creates a new SqlInstancesPointInTimeRestoreRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest instance - */ - SqlInstancesPointInTimeRestoreRequest.create = function create(properties) { - return new SqlInstancesPointInTimeRestoreRequest(properties); - }; - - /** - * Encodes the specified SqlInstancesPointInTimeRestoreRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPointInTimeRestoreRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); - if (message.context != null && Object.hasOwnProperty.call(message, "context")) - $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext.encode(message.context, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesPointInTimeRestoreRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesPointInTimeRestoreRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPointInTimeRestoreRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.parent = reader.string(); - break; - } - case 100: { - message.context = $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesPointInTimeRestoreRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesPointInTimeRestoreRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesPointInTimeRestoreRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesPointInTimeRestoreRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.parent != null && message.hasOwnProperty("parent")) - if (!$util.isString(message.parent)) - return "parent: string expected"; - if (message.context != null && message.hasOwnProperty("context")) { - var error = $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext.verify(message.context); - if (error) - return "context." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesPointInTimeRestoreRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest} SqlInstancesPointInTimeRestoreRequest - */ - SqlInstancesPointInTimeRestoreRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(); - if (object.parent != null) - message.parent = String(object.parent); - if (object.context != null) { - if (typeof object.context !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest.context: object expected"); - message.context = $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext.fromObject(object.context); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesPointInTimeRestoreRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest} message SqlInstancesPointInTimeRestoreRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesPointInTimeRestoreRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.parent = ""; - object.context = null; - } - if (message.parent != null && message.hasOwnProperty("parent")) - object.parent = message.parent; - if (message.context != null && message.hasOwnProperty("context")) - object.context = $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext.toObject(message.context, options); - return object; - }; - - /** - * Converts this SqlInstancesPointInTimeRestoreRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesPointInTimeRestoreRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesPointInTimeRestoreRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesPointInTimeRestoreRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest"; - }; - - return SqlInstancesPointInTimeRestoreRequest; - })(); - - v1beta4.AclEntry = (function() { - - /** - * Properties of an AclEntry. - * @memberof google.cloud.sql.v1beta4 - * @interface IAclEntry - * @property {string|null} [value] AclEntry value - * @property {google.protobuf.ITimestamp|null} [expirationTime] AclEntry expirationTime - * @property {string|null} [name] AclEntry name - * @property {string|null} [kind] AclEntry kind - */ - - /** - * Constructs a new AclEntry. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an AclEntry. - * @implements IAclEntry - * @constructor - * @param {google.cloud.sql.v1beta4.IAclEntry=} [properties] Properties to set - */ - function AclEntry(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AclEntry value. - * @member {string} value - * @memberof google.cloud.sql.v1beta4.AclEntry - * @instance - */ - AclEntry.prototype.value = ""; - - /** - * AclEntry expirationTime. - * @member {google.protobuf.ITimestamp|null|undefined} expirationTime - * @memberof google.cloud.sql.v1beta4.AclEntry - * @instance - */ - AclEntry.prototype.expirationTime = null; - - /** - * AclEntry name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.AclEntry - * @instance - */ - AclEntry.prototype.name = ""; - - /** - * AclEntry kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.AclEntry - * @instance - */ - AclEntry.prototype.kind = ""; - - /** - * Creates a new AclEntry instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.AclEntry - * @static - * @param {google.cloud.sql.v1beta4.IAclEntry=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.AclEntry} AclEntry instance - */ - AclEntry.create = function create(properties) { - return new AclEntry(properties); - }; - - /** - * Encodes the specified AclEntry message. Does not implicitly {@link google.cloud.sql.v1beta4.AclEntry.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.AclEntry - * @static - * @param {google.cloud.sql.v1beta4.IAclEntry} message AclEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AclEntry.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - if (message.expirationTime != null && Object.hasOwnProperty.call(message, "expirationTime")) - $root.google.protobuf.Timestamp.encode(message.expirationTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); - return writer; - }; - - /** - * Encodes the specified AclEntry message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AclEntry.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.AclEntry - * @static - * @param {google.cloud.sql.v1beta4.IAclEntry} message AclEntry message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AclEntry.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AclEntry message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.AclEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.AclEntry} AclEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AclEntry.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.AclEntry(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.string(); - break; - } - case 2: { - message.expirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.name = reader.string(); - break; - } - case 4: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AclEntry message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.AclEntry - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.AclEntry} AclEntry - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AclEntry.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AclEntry message. - * @function verify - * @memberof google.cloud.sql.v1beta4.AclEntry - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AclEntry.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.expirationTime); - if (error) - return "expirationTime." + error; - } - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates an AclEntry message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.AclEntry - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.AclEntry} AclEntry - */ - AclEntry.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.AclEntry) - return object; - var message = new $root.google.cloud.sql.v1beta4.AclEntry(); - if (object.value != null) - message.value = String(object.value); - if (object.expirationTime != null) { - if (typeof object.expirationTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.AclEntry.expirationTime: object expected"); - message.expirationTime = $root.google.protobuf.Timestamp.fromObject(object.expirationTime); - } - if (object.name != null) - message.name = String(object.name); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from an AclEntry message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.AclEntry - * @static - * @param {google.cloud.sql.v1beta4.AclEntry} message AclEntry - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AclEntry.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.value = ""; - object.expirationTime = null; - object.name = ""; - object.kind = ""; - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) - object.expirationTime = $root.google.protobuf.Timestamp.toObject(message.expirationTime, options); - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this AclEntry to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.AclEntry - * @instance - * @returns {Object.} JSON object - */ - AclEntry.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AclEntry - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.AclEntry - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AclEntry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.AclEntry"; - }; - - return AclEntry; - })(); - - v1beta4.ApiWarning = (function() { - - /** - * Properties of an ApiWarning. - * @memberof google.cloud.sql.v1beta4 - * @interface IApiWarning - * @property {google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode|null} [code] ApiWarning code - * @property {string|null} [message] ApiWarning message - * @property {string|null} [region] ApiWarning region - */ - - /** - * Constructs a new ApiWarning. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an ApiWarning. - * @implements IApiWarning - * @constructor - * @param {google.cloud.sql.v1beta4.IApiWarning=} [properties] Properties to set - */ - function ApiWarning(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ApiWarning code. - * @member {google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode} code - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @instance - */ - ApiWarning.prototype.code = 0; - - /** - * ApiWarning message. - * @member {string} message - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @instance - */ - ApiWarning.prototype.message = ""; - - /** - * ApiWarning region. - * @member {string} region - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @instance - */ - ApiWarning.prototype.region = ""; - - /** - * Creates a new ApiWarning instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @static - * @param {google.cloud.sql.v1beta4.IApiWarning=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ApiWarning} ApiWarning instance - */ - ApiWarning.create = function create(properties) { - return new ApiWarning(properties); - }; - - /** - * Encodes the specified ApiWarning message. Does not implicitly {@link google.cloud.sql.v1beta4.ApiWarning.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @static - * @param {google.cloud.sql.v1beta4.IApiWarning} message ApiWarning message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ApiWarning.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); - if (message.region != null && Object.hasOwnProperty.call(message, "region")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.region); - return writer; - }; - - /** - * Encodes the specified ApiWarning message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ApiWarning.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @static - * @param {google.cloud.sql.v1beta4.IApiWarning} message ApiWarning message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ApiWarning.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ApiWarning message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ApiWarning} ApiWarning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ApiWarning.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ApiWarning(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.code = reader.int32(); - break; - } - case 2: { - message.message = reader.string(); - break; - } - case 3: { - message.region = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ApiWarning message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ApiWarning} ApiWarning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ApiWarning.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ApiWarning message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ApiWarning.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.code != null && message.hasOwnProperty("code")) - switch (message.code) { - default: - return "code: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (message.region != null && message.hasOwnProperty("region")) - if (!$util.isString(message.region)) - return "region: string expected"; - return null; - }; - - /** - * Creates an ApiWarning message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ApiWarning} ApiWarning - */ - ApiWarning.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ApiWarning) - return object; - var message = new $root.google.cloud.sql.v1beta4.ApiWarning(); - switch (object.code) { - default: - if (typeof object.code === "number") { - message.code = object.code; - break; - } - break; - case "SQL_API_WARNING_CODE_UNSPECIFIED": - case 0: - message.code = 0; - break; - case "REGION_UNREACHABLE": - case 1: - message.code = 1; - break; - case "MAX_RESULTS_EXCEEDS_LIMIT": - case 2: - message.code = 2; - break; - case "COMPROMISED_CREDENTIALS": - case 3: - message.code = 3; - break; - case "INTERNAL_STATE_FAILURE": - case 4: - message.code = 4; - break; - } - if (object.message != null) - message.message = String(object.message); - if (object.region != null) - message.region = String(object.region); - return message; - }; - - /** - * Creates a plain object from an ApiWarning message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @static - * @param {google.cloud.sql.v1beta4.ApiWarning} message ApiWarning - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ApiWarning.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.code = options.enums === String ? "SQL_API_WARNING_CODE_UNSPECIFIED" : 0; - object.message = ""; - object.region = ""; - } - if (message.code != null && message.hasOwnProperty("code")) - object.code = options.enums === String ? $root.google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode[message.code] === undefined ? message.code : $root.google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode[message.code] : message.code; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.region != null && message.hasOwnProperty("region")) - object.region = message.region; - return object; - }; - - /** - * Converts this ApiWarning to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @instance - * @returns {Object.} JSON object - */ - ApiWarning.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ApiWarning - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ApiWarning - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ApiWarning.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ApiWarning"; - }; - - /** - * SqlApiWarningCode enum. - * @name google.cloud.sql.v1beta4.ApiWarning.SqlApiWarningCode - * @enum {number} - * @property {number} SQL_API_WARNING_CODE_UNSPECIFIED=0 SQL_API_WARNING_CODE_UNSPECIFIED value - * @property {number} REGION_UNREACHABLE=1 REGION_UNREACHABLE value - * @property {number} MAX_RESULTS_EXCEEDS_LIMIT=2 MAX_RESULTS_EXCEEDS_LIMIT value - * @property {number} COMPROMISED_CREDENTIALS=3 COMPROMISED_CREDENTIALS value - * @property {number} INTERNAL_STATE_FAILURE=4 INTERNAL_STATE_FAILURE value - */ - ApiWarning.SqlApiWarningCode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_API_WARNING_CODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "REGION_UNREACHABLE"] = 1; - values[valuesById[2] = "MAX_RESULTS_EXCEEDS_LIMIT"] = 2; - values[valuesById[3] = "COMPROMISED_CREDENTIALS"] = 3; - values[valuesById[4] = "INTERNAL_STATE_FAILURE"] = 4; - return values; - })(); - - return ApiWarning; - })(); - - v1beta4.BackupRetentionSettings = (function() { - - /** - * Properties of a BackupRetentionSettings. - * @memberof google.cloud.sql.v1beta4 - * @interface IBackupRetentionSettings - * @property {google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit|null} [retentionUnit] BackupRetentionSettings retentionUnit - * @property {google.protobuf.IInt32Value|null} [retainedBackups] BackupRetentionSettings retainedBackups - */ - - /** - * Constructs a new BackupRetentionSettings. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a BackupRetentionSettings. - * @implements IBackupRetentionSettings - * @constructor - * @param {google.cloud.sql.v1beta4.IBackupRetentionSettings=} [properties] Properties to set - */ - function BackupRetentionSettings(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupRetentionSettings retentionUnit. - * @member {google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit} retentionUnit - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @instance - */ - BackupRetentionSettings.prototype.retentionUnit = 0; - - /** - * BackupRetentionSettings retainedBackups. - * @member {google.protobuf.IInt32Value|null|undefined} retainedBackups - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @instance - */ - BackupRetentionSettings.prototype.retainedBackups = null; - - /** - * Creates a new BackupRetentionSettings instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @static - * @param {google.cloud.sql.v1beta4.IBackupRetentionSettings=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.BackupRetentionSettings} BackupRetentionSettings instance - */ - BackupRetentionSettings.create = function create(properties) { - return new BackupRetentionSettings(properties); - }; - - /** - * Encodes the specified BackupRetentionSettings message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRetentionSettings.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @static - * @param {google.cloud.sql.v1beta4.IBackupRetentionSettings} message BackupRetentionSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRetentionSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.retentionUnit != null && Object.hasOwnProperty.call(message, "retentionUnit")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.retentionUnit); - if (message.retainedBackups != null && Object.hasOwnProperty.call(message, "retainedBackups")) - $root.google.protobuf.Int32Value.encode(message.retainedBackups, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified BackupRetentionSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRetentionSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @static - * @param {google.cloud.sql.v1beta4.IBackupRetentionSettings} message BackupRetentionSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRetentionSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupRetentionSettings message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.BackupRetentionSettings} BackupRetentionSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRetentionSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupRetentionSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.retentionUnit = reader.int32(); - break; - } - case 2: { - message.retainedBackups = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupRetentionSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.BackupRetentionSettings} BackupRetentionSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRetentionSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupRetentionSettings message. - * @function verify - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupRetentionSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.retentionUnit != null && message.hasOwnProperty("retentionUnit")) - switch (message.retentionUnit) { - default: - return "retentionUnit: enum value expected"; - case 0: - case 1: - break; - } - if (message.retainedBackups != null && message.hasOwnProperty("retainedBackups")) { - var error = $root.google.protobuf.Int32Value.verify(message.retainedBackups); - if (error) - return "retainedBackups." + error; - } - return null; - }; - - /** - * Creates a BackupRetentionSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.BackupRetentionSettings} BackupRetentionSettings - */ - BackupRetentionSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.BackupRetentionSettings) - return object; - var message = new $root.google.cloud.sql.v1beta4.BackupRetentionSettings(); - switch (object.retentionUnit) { - default: - if (typeof object.retentionUnit === "number") { - message.retentionUnit = object.retentionUnit; - break; - } - break; - case "RETENTION_UNIT_UNSPECIFIED": - case 0: - message.retentionUnit = 0; - break; - case "COUNT": - case 1: - message.retentionUnit = 1; - break; - } - if (object.retainedBackups != null) { - if (typeof object.retainedBackups !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupRetentionSettings.retainedBackups: object expected"); - message.retainedBackups = $root.google.protobuf.Int32Value.fromObject(object.retainedBackups); - } - return message; - }; - - /** - * Creates a plain object from a BackupRetentionSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @static - * @param {google.cloud.sql.v1beta4.BackupRetentionSettings} message BackupRetentionSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupRetentionSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.retentionUnit = options.enums === String ? "RETENTION_UNIT_UNSPECIFIED" : 0; - object.retainedBackups = null; - } - if (message.retentionUnit != null && message.hasOwnProperty("retentionUnit")) - object.retentionUnit = options.enums === String ? $root.google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit[message.retentionUnit] === undefined ? message.retentionUnit : $root.google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit[message.retentionUnit] : message.retentionUnit; - if (message.retainedBackups != null && message.hasOwnProperty("retainedBackups")) - object.retainedBackups = $root.google.protobuf.Int32Value.toObject(message.retainedBackups, options); - return object; - }; - - /** - * Converts this BackupRetentionSettings to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @instance - * @returns {Object.} JSON object - */ - BackupRetentionSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupRetentionSettings - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.BackupRetentionSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupRetentionSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupRetentionSettings"; - }; - - /** - * RetentionUnit enum. - * @name google.cloud.sql.v1beta4.BackupRetentionSettings.RetentionUnit - * @enum {number} - * @property {number} RETENTION_UNIT_UNSPECIFIED=0 RETENTION_UNIT_UNSPECIFIED value - * @property {number} COUNT=1 COUNT value - */ - BackupRetentionSettings.RetentionUnit = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RETENTION_UNIT_UNSPECIFIED"] = 0; - values[valuesById[1] = "COUNT"] = 1; - return values; - })(); - - return BackupRetentionSettings; - })(); - - v1beta4.BackupConfiguration = (function() { - - /** - * Properties of a BackupConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @interface IBackupConfiguration - * @property {string|null} [startTime] BackupConfiguration startTime - * @property {google.protobuf.IBoolValue|null} [enabled] BackupConfiguration enabled - * @property {string|null} [kind] BackupConfiguration kind - * @property {google.protobuf.IBoolValue|null} [binaryLogEnabled] BackupConfiguration binaryLogEnabled - * @property {google.protobuf.IBoolValue|null} [replicationLogArchivingEnabled] BackupConfiguration replicationLogArchivingEnabled - * @property {string|null} [location] BackupConfiguration location - * @property {google.protobuf.IBoolValue|null} [pointInTimeRecoveryEnabled] BackupConfiguration pointInTimeRecoveryEnabled - * @property {google.protobuf.IInt32Value|null} [transactionLogRetentionDays] BackupConfiguration transactionLogRetentionDays - * @property {google.cloud.sql.v1beta4.IBackupRetentionSettings|null} [backupRetentionSettings] BackupConfiguration backupRetentionSettings - * @property {google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|null} [transactionalLogStorageState] BackupConfiguration transactionalLogStorageState - * @property {google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|null} [backupTier] BackupConfiguration backupTier - */ - - /** - * Constructs a new BackupConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a BackupConfiguration. - * @implements IBackupConfiguration - * @constructor - * @param {google.cloud.sql.v1beta4.IBackupConfiguration=} [properties] Properties to set - */ - function BackupConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupConfiguration startTime. - * @member {string} startTime - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.startTime = ""; - - /** - * BackupConfiguration enabled. - * @member {google.protobuf.IBoolValue|null|undefined} enabled - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.enabled = null; - - /** - * BackupConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.kind = ""; - - /** - * BackupConfiguration binaryLogEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} binaryLogEnabled - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.binaryLogEnabled = null; - - /** - * BackupConfiguration replicationLogArchivingEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} replicationLogArchivingEnabled - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.replicationLogArchivingEnabled = null; - - /** - * BackupConfiguration location. - * @member {string} location - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.location = ""; - - /** - * BackupConfiguration pointInTimeRecoveryEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} pointInTimeRecoveryEnabled - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.pointInTimeRecoveryEnabled = null; - - /** - * BackupConfiguration transactionLogRetentionDays. - * @member {google.protobuf.IInt32Value|null|undefined} transactionLogRetentionDays - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.transactionLogRetentionDays = null; - - /** - * BackupConfiguration backupRetentionSettings. - * @member {google.cloud.sql.v1beta4.IBackupRetentionSettings|null|undefined} backupRetentionSettings - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.backupRetentionSettings = null; - - /** - * BackupConfiguration transactionalLogStorageState. - * @member {google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState|null|undefined} transactionalLogStorageState - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.transactionalLogStorageState = null; - - /** - * BackupConfiguration backupTier. - * @member {google.cloud.sql.v1beta4.BackupConfiguration.BackupTier|null|undefined} backupTier - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - */ - BackupConfiguration.prototype.backupTier = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(BackupConfiguration.prototype, "_transactionalLogStorageState", { - get: $util.oneOfGetter($oneOfFields = ["transactionalLogStorageState"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(BackupConfiguration.prototype, "_backupTier", { - get: $util.oneOfGetter($oneOfFields = ["backupTier"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new BackupConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IBackupConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.BackupConfiguration} BackupConfiguration instance - */ - BackupConfiguration.create = function create(properties) { - return new BackupConfiguration(properties); - }; - - /** - * Encodes the specified BackupConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IBackupConfiguration} message BackupConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.startTime); - if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) - $root.google.protobuf.BoolValue.encode(message.enabled, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - if (message.binaryLogEnabled != null && Object.hasOwnProperty.call(message, "binaryLogEnabled")) - $root.google.protobuf.BoolValue.encode(message.binaryLogEnabled, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.replicationLogArchivingEnabled != null && Object.hasOwnProperty.call(message, "replicationLogArchivingEnabled")) - $root.google.protobuf.BoolValue.encode(message.replicationLogArchivingEnabled, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.location != null && Object.hasOwnProperty.call(message, "location")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.location); - if (message.pointInTimeRecoveryEnabled != null && Object.hasOwnProperty.call(message, "pointInTimeRecoveryEnabled")) - $root.google.protobuf.BoolValue.encode(message.pointInTimeRecoveryEnabled, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.transactionLogRetentionDays != null && Object.hasOwnProperty.call(message, "transactionLogRetentionDays")) - $root.google.protobuf.Int32Value.encode(message.transactionLogRetentionDays, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.backupRetentionSettings != null && Object.hasOwnProperty.call(message, "backupRetentionSettings")) - $root.google.cloud.sql.v1beta4.BackupRetentionSettings.encode(message.backupRetentionSettings, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.transactionalLogStorageState != null && Object.hasOwnProperty.call(message, "transactionalLogStorageState")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.transactionalLogStorageState); - if (message.backupTier != null && Object.hasOwnProperty.call(message, "backupTier")) - writer.uint32(/* id 12, wireType 0 =*/96).int32(message.backupTier); - return writer; - }; - - /** - * Encodes the specified BackupConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IBackupConfiguration} message BackupConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.BackupConfiguration} BackupConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.startTime = reader.string(); - break; - } - case 2: { - message.enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - case 4: { - message.binaryLogEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 5: { - message.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 6: { - message.location = reader.string(); - break; - } - case 7: { - message.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 9: { - message.transactionLogRetentionDays = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 10: { - message.backupRetentionSettings = $root.google.cloud.sql.v1beta4.BackupRetentionSettings.decode(reader, reader.uint32()); - break; - } - case 11: { - message.transactionalLogStorageState = reader.int32(); - break; - } - case 12: { - message.backupTier = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.BackupConfiguration} BackupConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.startTime != null && message.hasOwnProperty("startTime")) - if (!$util.isString(message.startTime)) - return "startTime: string expected"; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.enabled); - if (error) - return "enabled." + error; - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.binaryLogEnabled != null && message.hasOwnProperty("binaryLogEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.binaryLogEnabled); - if (error) - return "binaryLogEnabled." + error; - } - if (message.replicationLogArchivingEnabled != null && message.hasOwnProperty("replicationLogArchivingEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.replicationLogArchivingEnabled); - if (error) - return "replicationLogArchivingEnabled." + error; - } - if (message.location != null && message.hasOwnProperty("location")) - if (!$util.isString(message.location)) - return "location: string expected"; - if (message.pointInTimeRecoveryEnabled != null && message.hasOwnProperty("pointInTimeRecoveryEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.pointInTimeRecoveryEnabled); - if (error) - return "pointInTimeRecoveryEnabled." + error; - } - if (message.transactionLogRetentionDays != null && message.hasOwnProperty("transactionLogRetentionDays")) { - var error = $root.google.protobuf.Int32Value.verify(message.transactionLogRetentionDays); - if (error) - return "transactionLogRetentionDays." + error; - } - if (message.backupRetentionSettings != null && message.hasOwnProperty("backupRetentionSettings")) { - var error = $root.google.cloud.sql.v1beta4.BackupRetentionSettings.verify(message.backupRetentionSettings); - if (error) - return "backupRetentionSettings." + error; - } - if (message.transactionalLogStorageState != null && message.hasOwnProperty("transactionalLogStorageState")) { - properties._transactionalLogStorageState = 1; - switch (message.transactionalLogStorageState) { - default: - return "transactionalLogStorageState: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - } - if (message.backupTier != null && message.hasOwnProperty("backupTier")) { - properties._backupTier = 1; - switch (message.backupTier) { - default: - return "backupTier: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - } - return null; - }; - - /** - * Creates a BackupConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.BackupConfiguration} BackupConfiguration - */ - BackupConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.BackupConfiguration) - return object; - var message = new $root.google.cloud.sql.v1beta4.BackupConfiguration(); - if (object.startTime != null) - message.startTime = String(object.startTime); - if (object.enabled != null) { - if (typeof object.enabled !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.enabled: object expected"); - message.enabled = $root.google.protobuf.BoolValue.fromObject(object.enabled); - } - if (object.kind != null) - message.kind = String(object.kind); - if (object.binaryLogEnabled != null) { - if (typeof object.binaryLogEnabled !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.binaryLogEnabled: object expected"); - message.binaryLogEnabled = $root.google.protobuf.BoolValue.fromObject(object.binaryLogEnabled); - } - if (object.replicationLogArchivingEnabled != null) { - if (typeof object.replicationLogArchivingEnabled !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.replicationLogArchivingEnabled: object expected"); - message.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.fromObject(object.replicationLogArchivingEnabled); - } - if (object.location != null) - message.location = String(object.location); - if (object.pointInTimeRecoveryEnabled != null) { - if (typeof object.pointInTimeRecoveryEnabled !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.pointInTimeRecoveryEnabled: object expected"); - message.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.fromObject(object.pointInTimeRecoveryEnabled); - } - if (object.transactionLogRetentionDays != null) { - if (typeof object.transactionLogRetentionDays !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.transactionLogRetentionDays: object expected"); - message.transactionLogRetentionDays = $root.google.protobuf.Int32Value.fromObject(object.transactionLogRetentionDays); - } - if (object.backupRetentionSettings != null) { - if (typeof object.backupRetentionSettings !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupConfiguration.backupRetentionSettings: object expected"); - message.backupRetentionSettings = $root.google.cloud.sql.v1beta4.BackupRetentionSettings.fromObject(object.backupRetentionSettings); - } - switch (object.transactionalLogStorageState) { - default: - if (typeof object.transactionalLogStorageState === "number") { - message.transactionalLogStorageState = object.transactionalLogStorageState; - break; - } - break; - case "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED": - case 0: - message.transactionalLogStorageState = 0; - break; - case "DISK": - case 1: - message.transactionalLogStorageState = 1; - break; - case "SWITCHING_TO_CLOUD_STORAGE": - case 2: - message.transactionalLogStorageState = 2; - break; - case "SWITCHED_TO_CLOUD_STORAGE": - case 3: - message.transactionalLogStorageState = 3; - break; - case "CLOUD_STORAGE": - case 4: - message.transactionalLogStorageState = 4; - break; - } - switch (object.backupTier) { - default: - if (typeof object.backupTier === "number") { - message.backupTier = object.backupTier; - break; - } - break; - case "BACKUP_TIER_UNSPECIFIED": - case 0: - message.backupTier = 0; - break; - case "STANDARD": - case 1: - message.backupTier = 1; - break; - case "ADVANCED": - case 2: - message.backupTier = 2; - break; - case "ENHANCED": - case 3: - message.backupTier = 3; - break; - } - return message; - }; - - /** - * Creates a plain object from a BackupConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @static - * @param {google.cloud.sql.v1beta4.BackupConfiguration} message BackupConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.startTime = ""; - object.enabled = null; - object.kind = ""; - object.binaryLogEnabled = null; - object.replicationLogArchivingEnabled = null; - object.location = ""; - object.pointInTimeRecoveryEnabled = null; - object.transactionLogRetentionDays = null; - object.backupRetentionSettings = null; - } - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = message.startTime; - if (message.enabled != null && message.hasOwnProperty("enabled")) - object.enabled = $root.google.protobuf.BoolValue.toObject(message.enabled, options); - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.binaryLogEnabled != null && message.hasOwnProperty("binaryLogEnabled")) - object.binaryLogEnabled = $root.google.protobuf.BoolValue.toObject(message.binaryLogEnabled, options); - if (message.replicationLogArchivingEnabled != null && message.hasOwnProperty("replicationLogArchivingEnabled")) - object.replicationLogArchivingEnabled = $root.google.protobuf.BoolValue.toObject(message.replicationLogArchivingEnabled, options); - if (message.location != null && message.hasOwnProperty("location")) - object.location = message.location; - if (message.pointInTimeRecoveryEnabled != null && message.hasOwnProperty("pointInTimeRecoveryEnabled")) - object.pointInTimeRecoveryEnabled = $root.google.protobuf.BoolValue.toObject(message.pointInTimeRecoveryEnabled, options); - if (message.transactionLogRetentionDays != null && message.hasOwnProperty("transactionLogRetentionDays")) - object.transactionLogRetentionDays = $root.google.protobuf.Int32Value.toObject(message.transactionLogRetentionDays, options); - if (message.backupRetentionSettings != null && message.hasOwnProperty("backupRetentionSettings")) - object.backupRetentionSettings = $root.google.cloud.sql.v1beta4.BackupRetentionSettings.toObject(message.backupRetentionSettings, options); - if (message.transactionalLogStorageState != null && message.hasOwnProperty("transactionalLogStorageState")) { - object.transactionalLogStorageState = options.enums === String ? $root.google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState[message.transactionalLogStorageState] === undefined ? message.transactionalLogStorageState : $root.google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState[message.transactionalLogStorageState] : message.transactionalLogStorageState; - if (options.oneofs) - object._transactionalLogStorageState = "transactionalLogStorageState"; - } - if (message.backupTier != null && message.hasOwnProperty("backupTier")) { - object.backupTier = options.enums === String ? $root.google.cloud.sql.v1beta4.BackupConfiguration.BackupTier[message.backupTier] === undefined ? message.backupTier : $root.google.cloud.sql.v1beta4.BackupConfiguration.BackupTier[message.backupTier] : message.backupTier; - if (options.oneofs) - object._backupTier = "backupTier"; - } - return object; - }; - - /** - * Converts this BackupConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @instance - * @returns {Object.} JSON object - */ - BackupConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.BackupConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupConfiguration"; - }; - - /** - * TransactionalLogStorageState enum. - * @name google.cloud.sql.v1beta4.BackupConfiguration.TransactionalLogStorageState - * @enum {number} - * @property {number} TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED=0 TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED value - * @property {number} DISK=1 DISK value - * @property {number} SWITCHING_TO_CLOUD_STORAGE=2 SWITCHING_TO_CLOUD_STORAGE value - * @property {number} SWITCHED_TO_CLOUD_STORAGE=3 SWITCHED_TO_CLOUD_STORAGE value - * @property {number} CLOUD_STORAGE=4 CLOUD_STORAGE value - */ - BackupConfiguration.TransactionalLogStorageState = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISK"] = 1; - values[valuesById[2] = "SWITCHING_TO_CLOUD_STORAGE"] = 2; - values[valuesById[3] = "SWITCHED_TO_CLOUD_STORAGE"] = 3; - values[valuesById[4] = "CLOUD_STORAGE"] = 4; - return values; - })(); - - /** - * BackupTier enum. - * @name google.cloud.sql.v1beta4.BackupConfiguration.BackupTier - * @enum {number} - * @property {number} BACKUP_TIER_UNSPECIFIED=0 BACKUP_TIER_UNSPECIFIED value - * @property {number} STANDARD=1 STANDARD value - * @property {number} ADVANCED=2 ADVANCED value - * @property {number} ENHANCED=3 ENHANCED value - */ - BackupConfiguration.BackupTier = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BACKUP_TIER_UNSPECIFIED"] = 0; - values[valuesById[1] = "STANDARD"] = 1; - values[valuesById[2] = "ADVANCED"] = 2; - values[valuesById[3] = "ENHANCED"] = 3; - return values; - })(); - - return BackupConfiguration; - })(); - - v1beta4.BackupRun = (function() { - - /** - * Properties of a BackupRun. - * @memberof google.cloud.sql.v1beta4 - * @interface IBackupRun - * @property {string|null} [kind] BackupRun kind - * @property {google.cloud.sql.v1beta4.SqlBackupRunStatus|null} [status] BackupRun status - * @property {google.protobuf.ITimestamp|null} [enqueuedTime] BackupRun enqueuedTime - * @property {number|Long|null} [id] BackupRun id - * @property {google.protobuf.ITimestamp|null} [startTime] BackupRun startTime - * @property {google.protobuf.ITimestamp|null} [endTime] BackupRun endTime - * @property {google.cloud.sql.v1beta4.IOperationError|null} [error] BackupRun error - * @property {google.cloud.sql.v1beta4.SqlBackupRunType|null} [type] BackupRun type - * @property {string|null} [description] BackupRun description - * @property {google.protobuf.ITimestamp|null} [windowStartTime] BackupRun windowStartTime - * @property {string|null} [instance] BackupRun instance - * @property {string|null} [selfLink] BackupRun selfLink - * @property {string|null} [location] BackupRun location - * @property {google.cloud.sql.v1beta4.SqlDatabaseVersion|null} [databaseVersion] BackupRun databaseVersion - * @property {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null} [diskEncryptionConfiguration] BackupRun diskEncryptionConfiguration - * @property {google.cloud.sql.v1beta4.IDiskEncryptionStatus|null} [diskEncryptionStatus] BackupRun diskEncryptionStatus - * @property {google.cloud.sql.v1beta4.SqlBackupKind|null} [backupKind] BackupRun backupKind - * @property {string|null} [timeZone] BackupRun timeZone - * @property {number|Long|null} [maxChargeableBytes] BackupRun maxChargeableBytes - */ - - /** - * Constructs a new BackupRun. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a BackupRun. - * @implements IBackupRun - * @constructor - * @param {google.cloud.sql.v1beta4.IBackupRun=} [properties] Properties to set - */ - function BackupRun(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupRun kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.kind = ""; - - /** - * BackupRun status. - * @member {google.cloud.sql.v1beta4.SqlBackupRunStatus} status - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.status = 0; - - /** - * BackupRun enqueuedTime. - * @member {google.protobuf.ITimestamp|null|undefined} enqueuedTime - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.enqueuedTime = null; - - /** - * BackupRun id. - * @member {number|Long} id - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.id = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BackupRun startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.startTime = null; - - /** - * BackupRun endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.endTime = null; - - /** - * BackupRun error. - * @member {google.cloud.sql.v1beta4.IOperationError|null|undefined} error - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.error = null; - - /** - * BackupRun type. - * @member {google.cloud.sql.v1beta4.SqlBackupRunType} type - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.type = 0; - - /** - * BackupRun description. - * @member {string} description - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.description = ""; - - /** - * BackupRun windowStartTime. - * @member {google.protobuf.ITimestamp|null|undefined} windowStartTime - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.windowStartTime = null; - - /** - * BackupRun instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.instance = ""; - - /** - * BackupRun selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.selfLink = ""; - - /** - * BackupRun location. - * @member {string} location - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.location = ""; - - /** - * BackupRun databaseVersion. - * @member {google.cloud.sql.v1beta4.SqlDatabaseVersion} databaseVersion - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.databaseVersion = 0; - - /** - * BackupRun diskEncryptionConfiguration. - * @member {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null|undefined} diskEncryptionConfiguration - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.diskEncryptionConfiguration = null; - - /** - * BackupRun diskEncryptionStatus. - * @member {google.cloud.sql.v1beta4.IDiskEncryptionStatus|null|undefined} diskEncryptionStatus - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.diskEncryptionStatus = null; - - /** - * BackupRun backupKind. - * @member {google.cloud.sql.v1beta4.SqlBackupKind} backupKind - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.backupKind = 0; - - /** - * BackupRun timeZone. - * @member {string} timeZone - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.timeZone = ""; - - /** - * BackupRun maxChargeableBytes. - * @member {number|Long|null|undefined} maxChargeableBytes - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - */ - BackupRun.prototype.maxChargeableBytes = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(BackupRun.prototype, "_maxChargeableBytes", { - get: $util.oneOfGetter($oneOfFields = ["maxChargeableBytes"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new BackupRun instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.BackupRun - * @static - * @param {google.cloud.sql.v1beta4.IBackupRun=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.BackupRun} BackupRun instance - */ - BackupRun.create = function create(properties) { - return new BackupRun(properties); - }; - - /** - * Encodes the specified BackupRun message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRun.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.BackupRun - * @static - * @param {google.cloud.sql.v1beta4.IBackupRun} message BackupRun message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRun.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.status); - if (message.enqueuedTime != null && Object.hasOwnProperty.call(message, "enqueuedTime")) - $root.google.protobuf.Timestamp.encode(message.enqueuedTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.id != null && Object.hasOwnProperty.call(message, "id")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.id); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.cloud.sql.v1beta4.OperationError.encode(message.error, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.type); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.description); - if (message.windowStartTime != null && Object.hasOwnProperty.call(message, "windowStartTime")) - $root.google.protobuf.Timestamp.encode(message.windowStartTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.instance); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.selfLink); - if (message.location != null && Object.hasOwnProperty.call(message, "location")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.location); - if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.databaseVersion); - if (message.diskEncryptionConfiguration != null && Object.hasOwnProperty.call(message, "diskEncryptionConfiguration")) - $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.encode(message.diskEncryptionConfiguration, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - if (message.diskEncryptionStatus != null && Object.hasOwnProperty.call(message, "diskEncryptionStatus")) - $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.encode(message.diskEncryptionStatus, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.backupKind != null && Object.hasOwnProperty.call(message, "backupKind")) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.backupKind); - if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.timeZone); - if (message.maxChargeableBytes != null && Object.hasOwnProperty.call(message, "maxChargeableBytes")) - writer.uint32(/* id 24, wireType 0 =*/192).int64(message.maxChargeableBytes); - return writer; - }; - - /** - * Encodes the specified BackupRun message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRun.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupRun - * @static - * @param {google.cloud.sql.v1beta4.IBackupRun} message BackupRun message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRun.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupRun message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.BackupRun - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.BackupRun} BackupRun - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRun.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupRun(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.status = reader.int32(); - break; - } - case 3: { - message.enqueuedTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 4: { - message.id = reader.int64(); - break; - } - case 5: { - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 6: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 7: { - message.error = $root.google.cloud.sql.v1beta4.OperationError.decode(reader, reader.uint32()); - break; - } - case 8: { - message.type = reader.int32(); - break; - } - case 9: { - message.description = reader.string(); - break; - } - case 10: { - message.windowStartTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 11: { - message.instance = reader.string(); - break; - } - case 12: { - message.selfLink = reader.string(); - break; - } - case 13: { - message.location = reader.string(); - break; - } - case 15: { - message.databaseVersion = reader.int32(); - break; - } - case 16: { - message.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.decode(reader, reader.uint32()); - break; - } - case 17: { - message.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.decode(reader, reader.uint32()); - break; - } - case 19: { - message.backupKind = reader.int32(); - break; - } - case 23: { - message.timeZone = reader.string(); - break; - } - case 24: { - message.maxChargeableBytes = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupRun message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupRun - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.BackupRun} BackupRun - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRun.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupRun message. - * @function verify - * @memberof google.cloud.sql.v1beta4.BackupRun - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupRun.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.status != null && message.hasOwnProperty("status")) - switch (message.status) { - default: - return "status: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - break; - } - if (message.enqueuedTime != null && message.hasOwnProperty("enqueuedTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.enqueuedTime); - if (error) - return "enqueuedTime." + error; - } - if (message.id != null && message.hasOwnProperty("id")) - if (!$util.isInteger(message.id) && !(message.id && $util.isInteger(message.id.low) && $util.isInteger(message.id.high))) - return "id: integer|Long expected"; - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.cloud.sql.v1beta4.OperationError.verify(message.error); - if (error) - return "error." + error; - } - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.windowStartTime != null && message.hasOwnProperty("windowStartTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.windowStartTime); - if (error) - return "windowStartTime." + error; - } - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.location != null && message.hasOwnProperty("location")) - if (!$util.isString(message.location)) - return "location: string expected"; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - switch (message.databaseVersion) { - default: - return "databaseVersion: enum value expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - break; - } - if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) { - var error = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify(message.diskEncryptionConfiguration); - if (error) - return "diskEncryptionConfiguration." + error; - } - if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) { - var error = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.verify(message.diskEncryptionStatus); - if (error) - return "diskEncryptionStatus." + error; - } - if (message.backupKind != null && message.hasOwnProperty("backupKind")) - switch (message.backupKind) { - default: - return "backupKind: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - if (!$util.isString(message.timeZone)) - return "timeZone: string expected"; - if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { - properties._maxChargeableBytes = 1; - if (!$util.isInteger(message.maxChargeableBytes) && !(message.maxChargeableBytes && $util.isInteger(message.maxChargeableBytes.low) && $util.isInteger(message.maxChargeableBytes.high))) - return "maxChargeableBytes: integer|Long expected"; - } - return null; - }; - - /** - * Creates a BackupRun message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.BackupRun - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.BackupRun} BackupRun - */ - BackupRun.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.BackupRun) - return object; - var message = new $root.google.cloud.sql.v1beta4.BackupRun(); - if (object.kind != null) - message.kind = String(object.kind); - switch (object.status) { - default: - if (typeof object.status === "number") { - message.status = object.status; - break; - } - break; - case "SQL_BACKUP_RUN_STATUS_UNSPECIFIED": - case 0: - message.status = 0; - break; - case "ENQUEUED": - case 1: - message.status = 1; - break; - case "OVERDUE": - case 2: - message.status = 2; - break; - case "RUNNING": - case 3: - message.status = 3; - break; - case "FAILED": - case 4: - message.status = 4; - break; - case "SUCCESSFUL": - case 5: - message.status = 5; - break; - case "SKIPPED": - case 6: - message.status = 6; - break; - case "DELETION_PENDING": - case 7: - message.status = 7; - break; - case "DELETION_FAILED": - case 8: - message.status = 8; - break; - case "DELETED": - case 9: - message.status = 9; - break; - } - if (object.enqueuedTime != null) { - if (typeof object.enqueuedTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupRun.enqueuedTime: object expected"); - message.enqueuedTime = $root.google.protobuf.Timestamp.fromObject(object.enqueuedTime); - } - if (object.id != null) - if ($util.Long) - (message.id = $util.Long.fromValue(object.id)).unsigned = false; - else if (typeof object.id === "string") - message.id = parseInt(object.id, 10); - else if (typeof object.id === "number") - message.id = object.id; - else if (typeof object.id === "object") - message.id = new $util.LongBits(object.id.low >>> 0, object.id.high >>> 0).toNumber(); - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupRun.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupRun.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupRun.error: object expected"); - message.error = $root.google.cloud.sql.v1beta4.OperationError.fromObject(object.error); - } - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "SQL_BACKUP_RUN_TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "AUTOMATED": - case 1: - message.type = 1; - break; - case "ON_DEMAND": - case 2: - message.type = 2; - break; - } - if (object.description != null) - message.description = String(object.description); - if (object.windowStartTime != null) { - if (typeof object.windowStartTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupRun.windowStartTime: object expected"); - message.windowStartTime = $root.google.protobuf.Timestamp.fromObject(object.windowStartTime); - } - if (object.instance != null) - message.instance = String(object.instance); - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - if (object.location != null) - message.location = String(object.location); - switch (object.databaseVersion) { - default: - if (typeof object.databaseVersion === "number") { - message.databaseVersion = object.databaseVersion; - break; - } - break; - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.databaseVersion = 0; - break; - case "MYSQL_5_1": - case 2: - message.databaseVersion = 2; - break; - case "MYSQL_5_5": - case 3: - message.databaseVersion = 3; - break; - case "MYSQL_5_6": - case 5: - message.databaseVersion = 5; - break; - case "MYSQL_5_7": - case 6: - message.databaseVersion = 6; - break; - case "MYSQL_8_0": - case 20: - message.databaseVersion = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.databaseVersion = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.databaseVersion = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.databaseVersion = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.databaseVersion = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.databaseVersion = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.databaseVersion = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.databaseVersion = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.databaseVersion = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.databaseVersion = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.databaseVersion = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.databaseVersion = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.databaseVersion = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.databaseVersion = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.databaseVersion = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.databaseVersion = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.databaseVersion = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.databaseVersion = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.databaseVersion = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.databaseVersion = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.databaseVersion = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.databaseVersion = 556; - break; - case "MYSQL_8_4": - case 398: - message.databaseVersion = 398; - break; - case "MYSQL_9_7": - case 654: - message.databaseVersion = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.databaseVersion = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.databaseVersion = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.databaseVersion = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.databaseVersion = 16; - break; - case "POSTGRES_9_6": - case 9: - message.databaseVersion = 9; - break; - case "POSTGRES_10": - case 18: - message.databaseVersion = 18; - break; - case "POSTGRES_11": - case 10: - message.databaseVersion = 10; - break; - case "POSTGRES_12": - case 19: - message.databaseVersion = 19; - break; - case "POSTGRES_13": - case 23: - message.databaseVersion = 23; - break; - case "POSTGRES_14": - case 110: - message.databaseVersion = 110; - break; - case "POSTGRES_15": - case 172: - message.databaseVersion = 172; - break; - case "POSTGRES_16": - case 272: - message.databaseVersion = 272; - break; - case "POSTGRES_17": - case 408: - message.databaseVersion = 408; - break; - case "POSTGRES_18": - case 557: - message.databaseVersion = 557; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.databaseVersion = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.databaseVersion = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.databaseVersion = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.databaseVersion = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.databaseVersion = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.databaseVersion = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.databaseVersion = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.databaseVersion = 202; - break; - } - if (object.diskEncryptionConfiguration != null) { - if (typeof object.diskEncryptionConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupRun.diskEncryptionConfiguration: object expected"); - message.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.fromObject(object.diskEncryptionConfiguration); - } - if (object.diskEncryptionStatus != null) { - if (typeof object.diskEncryptionStatus !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupRun.diskEncryptionStatus: object expected"); - message.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.fromObject(object.diskEncryptionStatus); - } - switch (object.backupKind) { - default: - if (typeof object.backupKind === "number") { - message.backupKind = object.backupKind; - break; - } - break; - case "SQL_BACKUP_KIND_UNSPECIFIED": - case 0: - message.backupKind = 0; - break; - case "SNAPSHOT": - case 1: - message.backupKind = 1; - break; - case "PHYSICAL": - case 2: - message.backupKind = 2; - break; - } - if (object.timeZone != null) - message.timeZone = String(object.timeZone); - if (object.maxChargeableBytes != null) - if ($util.Long) - (message.maxChargeableBytes = $util.Long.fromValue(object.maxChargeableBytes)).unsigned = false; - else if (typeof object.maxChargeableBytes === "string") - message.maxChargeableBytes = parseInt(object.maxChargeableBytes, 10); - else if (typeof object.maxChargeableBytes === "number") - message.maxChargeableBytes = object.maxChargeableBytes; - else if (typeof object.maxChargeableBytes === "object") - message.maxChargeableBytes = new $util.LongBits(object.maxChargeableBytes.low >>> 0, object.maxChargeableBytes.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a BackupRun message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.BackupRun - * @static - * @param {google.cloud.sql.v1beta4.BackupRun} message BackupRun - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupRun.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.status = options.enums === String ? "SQL_BACKUP_RUN_STATUS_UNSPECIFIED" : 0; - object.enqueuedTime = null; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.id = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.id = options.longs === String ? "0" : 0; - object.startTime = null; - object.endTime = null; - object.error = null; - object.type = options.enums === String ? "SQL_BACKUP_RUN_TYPE_UNSPECIFIED" : 0; - object.description = ""; - object.windowStartTime = null; - object.instance = ""; - object.selfLink = ""; - object.location = ""; - object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; - object.diskEncryptionConfiguration = null; - object.diskEncryptionStatus = null; - object.backupKind = options.enums === String ? "SQL_BACKUP_KIND_UNSPECIFIED" : 0; - object.timeZone = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackupRunStatus[message.status] === undefined ? message.status : $root.google.cloud.sql.v1beta4.SqlBackupRunStatus[message.status] : message.status; - if (message.enqueuedTime != null && message.hasOwnProperty("enqueuedTime")) - object.enqueuedTime = $root.google.protobuf.Timestamp.toObject(message.enqueuedTime, options); - if (message.id != null && message.hasOwnProperty("id")) - if (typeof message.id === "number") - object.id = options.longs === String ? String(message.id) : message.id; - else - object.id = options.longs === String ? $util.Long.prototype.toString.call(message.id) : options.longs === Number ? new $util.LongBits(message.id.low >>> 0, message.id.high >>> 0).toNumber() : message.id; - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.cloud.sql.v1beta4.OperationError.toObject(message.error, options); - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackupRunType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.SqlBackupRunType[message.type] : message.type; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.windowStartTime != null && message.hasOwnProperty("windowStartTime")) - object.windowStartTime = $root.google.protobuf.Timestamp.toObject(message.windowStartTime, options); - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.location != null && message.hasOwnProperty("location")) - object.location = message.location; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; - if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) - object.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.toObject(message.diskEncryptionConfiguration, options); - if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) - object.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.toObject(message.diskEncryptionStatus, options); - if (message.backupKind != null && message.hasOwnProperty("backupKind")) - object.backupKind = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackupKind[message.backupKind] === undefined ? message.backupKind : $root.google.cloud.sql.v1beta4.SqlBackupKind[message.backupKind] : message.backupKind; - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - object.timeZone = message.timeZone; - if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { - if (typeof message.maxChargeableBytes === "number") - object.maxChargeableBytes = options.longs === String ? String(message.maxChargeableBytes) : message.maxChargeableBytes; - else - object.maxChargeableBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxChargeableBytes) : options.longs === Number ? new $util.LongBits(message.maxChargeableBytes.low >>> 0, message.maxChargeableBytes.high >>> 0).toNumber() : message.maxChargeableBytes; - if (options.oneofs) - object._maxChargeableBytes = "maxChargeableBytes"; - } - return object; - }; - - /** - * Converts this BackupRun to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.BackupRun - * @instance - * @returns {Object.} JSON object - */ - BackupRun.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupRun - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.BackupRun - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupRun.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupRun"; - }; - - return BackupRun; - })(); - - v1beta4.Backup = (function() { - - /** - * Properties of a Backup. - * @memberof google.cloud.sql.v1beta4 - * @interface IBackup - * @property {string|null} [name] Backup name - * @property {string|null} [kind] Backup kind - * @property {string|null} [selfLink] Backup selfLink - * @property {google.cloud.sql.v1beta4.Backup.SqlBackupType|null} [type] Backup type - * @property {string|null} [description] Backup description - * @property {string|null} [instance] Backup instance - * @property {string|null} [location] Backup location - * @property {google.type.IInterval|null} [backupInterval] Backup backupInterval - * @property {google.cloud.sql.v1beta4.Backup.SqlBackupState|null} [state] Backup state - * @property {google.cloud.sql.v1beta4.IOperationError|null} [error] Backup error - * @property {string|null} [kmsKey] Backup kmsKey - * @property {string|null} [kmsKeyVersion] Backup kmsKeyVersion - * @property {google.cloud.sql.v1beta4.SqlBackupKind|null} [backupKind] Backup backupKind - * @property {string|null} [timeZone] Backup timeZone - * @property {number|Long|null} [ttlDays] Backup ttlDays - * @property {google.protobuf.ITimestamp|null} [expiryTime] Backup expiryTime - * @property {google.cloud.sql.v1beta4.SqlDatabaseVersion|null} [databaseVersion] Backup databaseVersion - * @property {number|Long|null} [maxChargeableBytes] Backup maxChargeableBytes - * @property {google.protobuf.ITimestamp|null} [instanceDeletionTime] Backup instanceDeletionTime - * @property {google.cloud.sql.v1beta4.IDatabaseInstance|null} [instanceSettings] Backup instanceSettings - * @property {string|null} [backupRun] Backup backupRun - * @property {google.protobuf.IBoolValue|null} [satisfiesPzs] Backup satisfiesPzs - * @property {google.protobuf.IBoolValue|null} [satisfiesPzi] Backup satisfiesPzi - */ - - /** - * Constructs a new Backup. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a Backup. - * @implements IBackup - * @constructor - * @param {google.cloud.sql.v1beta4.IBackup=} [properties] Properties to set - */ - function Backup(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Backup name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.name = ""; - - /** - * Backup kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.kind = ""; - - /** - * Backup selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.selfLink = ""; - - /** - * Backup type. - * @member {google.cloud.sql.v1beta4.Backup.SqlBackupType} type - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.type = 0; - - /** - * Backup description. - * @member {string} description - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.description = ""; - - /** - * Backup instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.instance = ""; - - /** - * Backup location. - * @member {string} location - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.location = ""; - - /** - * Backup backupInterval. - * @member {google.type.IInterval|null|undefined} backupInterval - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.backupInterval = null; - - /** - * Backup state. - * @member {google.cloud.sql.v1beta4.Backup.SqlBackupState} state - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.state = 0; - - /** - * Backup error. - * @member {google.cloud.sql.v1beta4.IOperationError|null|undefined} error - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.error = null; - - /** - * Backup kmsKey. - * @member {string} kmsKey - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.kmsKey = ""; - - /** - * Backup kmsKeyVersion. - * @member {string} kmsKeyVersion - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.kmsKeyVersion = ""; - - /** - * Backup backupKind. - * @member {google.cloud.sql.v1beta4.SqlBackupKind} backupKind - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.backupKind = 0; - - /** - * Backup timeZone. - * @member {string} timeZone - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.timeZone = ""; - - /** - * Backup ttlDays. - * @member {number|Long|null|undefined} ttlDays - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.ttlDays = null; - - /** - * Backup expiryTime. - * @member {google.protobuf.ITimestamp|null|undefined} expiryTime - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.expiryTime = null; - - /** - * Backup databaseVersion. - * @member {google.cloud.sql.v1beta4.SqlDatabaseVersion} databaseVersion - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.databaseVersion = 0; - - /** - * Backup maxChargeableBytes. - * @member {number|Long|null|undefined} maxChargeableBytes - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.maxChargeableBytes = null; - - /** - * Backup instanceDeletionTime. - * @member {google.protobuf.ITimestamp|null|undefined} instanceDeletionTime - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.instanceDeletionTime = null; - - /** - * Backup instanceSettings. - * @member {google.cloud.sql.v1beta4.IDatabaseInstance|null|undefined} instanceSettings - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.instanceSettings = null; - - /** - * Backup backupRun. - * @member {string} backupRun - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.backupRun = ""; - - /** - * Backup satisfiesPzs. - * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzs - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.satisfiesPzs = null; - - /** - * Backup satisfiesPzi. - * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzi - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Backup.prototype.satisfiesPzi = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Backup expiration. - * @member {"ttlDays"|"expiryTime"|undefined} expiration - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - */ - Object.defineProperty(Backup.prototype, "expiration", { - get: $util.oneOfGetter($oneOfFields = ["ttlDays", "expiryTime"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Backup.prototype, "_maxChargeableBytes", { - get: $util.oneOfGetter($oneOfFields = ["maxChargeableBytes"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Backup instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.Backup - * @static - * @param {google.cloud.sql.v1beta4.IBackup=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.Backup} Backup instance - */ - Backup.create = function create(properties) { - return new Backup(properties); - }; - - /** - * Encodes the specified Backup message. Does not implicitly {@link google.cloud.sql.v1beta4.Backup.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.Backup - * @static - * @param {google.cloud.sql.v1beta4.IBackup} message Backup message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Backup.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.selfLink); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.type); - if (message.description != null && Object.hasOwnProperty.call(message, "description")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.description); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); - if (message.location != null && Object.hasOwnProperty.call(message, "location")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.location); - if (message.backupInterval != null && Object.hasOwnProperty.call(message, "backupInterval")) - $root.google.type.Interval.encode(message.backupInterval, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.state); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.cloud.sql.v1beta4.OperationError.encode(message.error, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.kmsKey != null && Object.hasOwnProperty.call(message, "kmsKey")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.kmsKey); - if (message.kmsKeyVersion != null && Object.hasOwnProperty.call(message, "kmsKeyVersion")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.kmsKeyVersion); - if (message.backupKind != null && Object.hasOwnProperty.call(message, "backupKind")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.backupKind); - if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.timeZone); - if (message.ttlDays != null && Object.hasOwnProperty.call(message, "ttlDays")) - writer.uint32(/* id 16, wireType 0 =*/128).int64(message.ttlDays); - if (message.expiryTime != null && Object.hasOwnProperty.call(message, "expiryTime")) - $root.google.protobuf.Timestamp.encode(message.expiryTime, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) - writer.uint32(/* id 20, wireType 0 =*/160).int32(message.databaseVersion); - if (message.maxChargeableBytes != null && Object.hasOwnProperty.call(message, "maxChargeableBytes")) - writer.uint32(/* id 23, wireType 0 =*/184).int64(message.maxChargeableBytes); - if (message.instanceDeletionTime != null && Object.hasOwnProperty.call(message, "instanceDeletionTime")) - $root.google.protobuf.Timestamp.encode(message.instanceDeletionTime, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); - if (message.instanceSettings != null && Object.hasOwnProperty.call(message, "instanceSettings")) - $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.instanceSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); - if (message.backupRun != null && Object.hasOwnProperty.call(message, "backupRun")) - writer.uint32(/* id 26, wireType 2 =*/210).string(message.backupRun); - if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) - $root.google.protobuf.BoolValue.encode(message.satisfiesPzs, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); - if (message.satisfiesPzi != null && Object.hasOwnProperty.call(message, "satisfiesPzi")) - $root.google.protobuf.BoolValue.encode(message.satisfiesPzi, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Backup message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Backup.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.Backup - * @static - * @param {google.cloud.sql.v1beta4.IBackup} message Backup message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Backup.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Backup message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.Backup - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.Backup} Backup - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Backup.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Backup(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - case 3: { - message.selfLink = reader.string(); - break; - } - case 4: { - message.type = reader.int32(); - break; - } - case 5: { - message.description = reader.string(); - break; - } - case 6: { - message.instance = reader.string(); - break; - } - case 7: { - message.location = reader.string(); - break; - } - case 8: { - message.backupInterval = $root.google.type.Interval.decode(reader, reader.uint32()); - break; - } - case 9: { - message.state = reader.int32(); - break; - } - case 10: { - message.error = $root.google.cloud.sql.v1beta4.OperationError.decode(reader, reader.uint32()); - break; - } - case 11: { - message.kmsKey = reader.string(); - break; - } - case 12: { - message.kmsKeyVersion = reader.string(); - break; - } - case 13: { - message.backupKind = reader.int32(); - break; - } - case 15: { - message.timeZone = reader.string(); - break; - } - case 16: { - message.ttlDays = reader.int64(); - break; - } - case 17: { - message.expiryTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 20: { - message.databaseVersion = reader.int32(); - break; - } - case 23: { - message.maxChargeableBytes = reader.int64(); - break; - } - case 24: { - message.instanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 25: { - message.instanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - case 26: { - message.backupRun = reader.string(); - break; - } - case 27: { - message.satisfiesPzs = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 28: { - message.satisfiesPzi = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Backup message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.Backup - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.Backup} Backup - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Backup.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Backup message. - * @function verify - * @memberof google.cloud.sql.v1beta4.Backup - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Backup.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.description != null && message.hasOwnProperty("description")) - if (!$util.isString(message.description)) - return "description: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.location != null && message.hasOwnProperty("location")) - if (!$util.isString(message.location)) - return "location: string expected"; - if (message.backupInterval != null && message.hasOwnProperty("backupInterval")) { - var error = $root.google.type.Interval.verify(message.backupInterval); - if (error) - return "backupInterval." + error; - } - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - break; - } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.cloud.sql.v1beta4.OperationError.verify(message.error); - if (error) - return "error." + error; - } - if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) - if (!$util.isString(message.kmsKey)) - return "kmsKey: string expected"; - if (message.kmsKeyVersion != null && message.hasOwnProperty("kmsKeyVersion")) - if (!$util.isString(message.kmsKeyVersion)) - return "kmsKeyVersion: string expected"; - if (message.backupKind != null && message.hasOwnProperty("backupKind")) - switch (message.backupKind) { - default: - return "backupKind: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - if (!$util.isString(message.timeZone)) - return "timeZone: string expected"; - if (message.ttlDays != null && message.hasOwnProperty("ttlDays")) { - properties.expiration = 1; - if (!$util.isInteger(message.ttlDays) && !(message.ttlDays && $util.isInteger(message.ttlDays.low) && $util.isInteger(message.ttlDays.high))) - return "ttlDays: integer|Long expected"; - } - if (message.expiryTime != null && message.hasOwnProperty("expiryTime")) { - if (properties.expiration === 1) - return "expiration: multiple values"; - properties.expiration = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.expiryTime); - if (error) - return "expiryTime." + error; - } - } - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - switch (message.databaseVersion) { - default: - return "databaseVersion: enum value expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - break; - } - if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { - properties._maxChargeableBytes = 1; - if (!$util.isInteger(message.maxChargeableBytes) && !(message.maxChargeableBytes && $util.isInteger(message.maxChargeableBytes.low) && $util.isInteger(message.maxChargeableBytes.high))) - return "maxChargeableBytes: integer|Long expected"; - } - if (message.instanceDeletionTime != null && message.hasOwnProperty("instanceDeletionTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.instanceDeletionTime); - if (error) - return "instanceDeletionTime." + error; - } - if (message.instanceSettings != null && message.hasOwnProperty("instanceSettings")) { - var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.instanceSettings); - if (error) - return "instanceSettings." + error; - } - if (message.backupRun != null && message.hasOwnProperty("backupRun")) - if (!$util.isString(message.backupRun)) - return "backupRun: string expected"; - if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) { - var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzs); - if (error) - return "satisfiesPzs." + error; - } - if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) { - var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzi); - if (error) - return "satisfiesPzi." + error; - } - return null; - }; - - /** - * Creates a Backup message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.Backup - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.Backup} Backup - */ - Backup.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.Backup) - return object; - var message = new $root.google.cloud.sql.v1beta4.Backup(); - if (object.name != null) - message.name = String(object.name); - if (object.kind != null) - message.kind = String(object.kind); - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "SQL_BACKUP_TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "AUTOMATED": - case 1: - message.type = 1; - break; - case "ON_DEMAND": - case 2: - message.type = 2; - break; - case "FINAL": - case 3: - message.type = 3; - break; - } - if (object.description != null) - message.description = String(object.description); - if (object.instance != null) - message.instance = String(object.instance); - if (object.location != null) - message.location = String(object.location); - if (object.backupInterval != null) { - if (typeof object.backupInterval !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Backup.backupInterval: object expected"); - message.backupInterval = $root.google.type.Interval.fromObject(object.backupInterval); - } - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "SQL_BACKUP_STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "ENQUEUED": - case 1: - message.state = 1; - break; - case "RUNNING": - case 2: - message.state = 2; - break; - case "FAILED": - case 3: - message.state = 3; - break; - case "SUCCESSFUL": - case 4: - message.state = 4; - break; - case "DELETING": - case 5: - message.state = 5; - break; - case "DELETION_FAILED": - case 6: - message.state = 6; - break; - } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Backup.error: object expected"); - message.error = $root.google.cloud.sql.v1beta4.OperationError.fromObject(object.error); - } - if (object.kmsKey != null) - message.kmsKey = String(object.kmsKey); - if (object.kmsKeyVersion != null) - message.kmsKeyVersion = String(object.kmsKeyVersion); - switch (object.backupKind) { - default: - if (typeof object.backupKind === "number") { - message.backupKind = object.backupKind; - break; - } - break; - case "SQL_BACKUP_KIND_UNSPECIFIED": - case 0: - message.backupKind = 0; - break; - case "SNAPSHOT": - case 1: - message.backupKind = 1; - break; - case "PHYSICAL": - case 2: - message.backupKind = 2; - break; - } - if (object.timeZone != null) - message.timeZone = String(object.timeZone); - if (object.ttlDays != null) - if ($util.Long) - (message.ttlDays = $util.Long.fromValue(object.ttlDays)).unsigned = false; - else if (typeof object.ttlDays === "string") - message.ttlDays = parseInt(object.ttlDays, 10); - else if (typeof object.ttlDays === "number") - message.ttlDays = object.ttlDays; - else if (typeof object.ttlDays === "object") - message.ttlDays = new $util.LongBits(object.ttlDays.low >>> 0, object.ttlDays.high >>> 0).toNumber(); - if (object.expiryTime != null) { - if (typeof object.expiryTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Backup.expiryTime: object expected"); - message.expiryTime = $root.google.protobuf.Timestamp.fromObject(object.expiryTime); - } - switch (object.databaseVersion) { - default: - if (typeof object.databaseVersion === "number") { - message.databaseVersion = object.databaseVersion; - break; - } - break; - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.databaseVersion = 0; - break; - case "MYSQL_5_1": - case 2: - message.databaseVersion = 2; - break; - case "MYSQL_5_5": - case 3: - message.databaseVersion = 3; - break; - case "MYSQL_5_6": - case 5: - message.databaseVersion = 5; - break; - case "MYSQL_5_7": - case 6: - message.databaseVersion = 6; - break; - case "MYSQL_8_0": - case 20: - message.databaseVersion = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.databaseVersion = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.databaseVersion = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.databaseVersion = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.databaseVersion = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.databaseVersion = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.databaseVersion = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.databaseVersion = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.databaseVersion = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.databaseVersion = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.databaseVersion = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.databaseVersion = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.databaseVersion = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.databaseVersion = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.databaseVersion = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.databaseVersion = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.databaseVersion = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.databaseVersion = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.databaseVersion = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.databaseVersion = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.databaseVersion = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.databaseVersion = 556; - break; - case "MYSQL_8_4": - case 398: - message.databaseVersion = 398; - break; - case "MYSQL_9_7": - case 654: - message.databaseVersion = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.databaseVersion = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.databaseVersion = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.databaseVersion = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.databaseVersion = 16; - break; - case "POSTGRES_9_6": - case 9: - message.databaseVersion = 9; - break; - case "POSTGRES_10": - case 18: - message.databaseVersion = 18; - break; - case "POSTGRES_11": - case 10: - message.databaseVersion = 10; - break; - case "POSTGRES_12": - case 19: - message.databaseVersion = 19; - break; - case "POSTGRES_13": - case 23: - message.databaseVersion = 23; - break; - case "POSTGRES_14": - case 110: - message.databaseVersion = 110; - break; - case "POSTGRES_15": - case 172: - message.databaseVersion = 172; - break; - case "POSTGRES_16": - case 272: - message.databaseVersion = 272; - break; - case "POSTGRES_17": - case 408: - message.databaseVersion = 408; - break; - case "POSTGRES_18": - case 557: - message.databaseVersion = 557; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.databaseVersion = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.databaseVersion = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.databaseVersion = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.databaseVersion = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.databaseVersion = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.databaseVersion = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.databaseVersion = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.databaseVersion = 202; - break; - } - if (object.maxChargeableBytes != null) - if ($util.Long) - (message.maxChargeableBytes = $util.Long.fromValue(object.maxChargeableBytes)).unsigned = false; - else if (typeof object.maxChargeableBytes === "string") - message.maxChargeableBytes = parseInt(object.maxChargeableBytes, 10); - else if (typeof object.maxChargeableBytes === "number") - message.maxChargeableBytes = object.maxChargeableBytes; - else if (typeof object.maxChargeableBytes === "object") - message.maxChargeableBytes = new $util.LongBits(object.maxChargeableBytes.low >>> 0, object.maxChargeableBytes.high >>> 0).toNumber(); - if (object.instanceDeletionTime != null) { - if (typeof object.instanceDeletionTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Backup.instanceDeletionTime: object expected"); - message.instanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.instanceDeletionTime); - } - if (object.instanceSettings != null) { - if (typeof object.instanceSettings !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Backup.instanceSettings: object expected"); - message.instanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.instanceSettings); - } - if (object.backupRun != null) - message.backupRun = String(object.backupRun); - if (object.satisfiesPzs != null) { - if (typeof object.satisfiesPzs !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Backup.satisfiesPzs: object expected"); - message.satisfiesPzs = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzs); - } - if (object.satisfiesPzi != null) { - if (typeof object.satisfiesPzi !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Backup.satisfiesPzi: object expected"); - message.satisfiesPzi = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzi); - } - return message; - }; - - /** - * Creates a plain object from a Backup message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.Backup - * @static - * @param {google.cloud.sql.v1beta4.Backup} message Backup - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Backup.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.kind = ""; - object.selfLink = ""; - object.type = options.enums === String ? "SQL_BACKUP_TYPE_UNSPECIFIED" : 0; - object.description = ""; - object.instance = ""; - object.location = ""; - object.backupInterval = null; - object.state = options.enums === String ? "SQL_BACKUP_STATE_UNSPECIFIED" : 0; - object.error = null; - object.kmsKey = ""; - object.kmsKeyVersion = ""; - object.backupKind = options.enums === String ? "SQL_BACKUP_KIND_UNSPECIFIED" : 0; - object.timeZone = ""; - object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; - object.instanceDeletionTime = null; - object.instanceSettings = null; - object.backupRun = ""; - object.satisfiesPzs = null; - object.satisfiesPzi = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.Backup.SqlBackupType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.Backup.SqlBackupType[message.type] : message.type; - if (message.description != null && message.hasOwnProperty("description")) - object.description = message.description; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.location != null && message.hasOwnProperty("location")) - object.location = message.location; - if (message.backupInterval != null && message.hasOwnProperty("backupInterval")) - object.backupInterval = $root.google.type.Interval.toObject(message.backupInterval, options); - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.sql.v1beta4.Backup.SqlBackupState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1beta4.Backup.SqlBackupState[message.state] : message.state; - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.cloud.sql.v1beta4.OperationError.toObject(message.error, options); - if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) - object.kmsKey = message.kmsKey; - if (message.kmsKeyVersion != null && message.hasOwnProperty("kmsKeyVersion")) - object.kmsKeyVersion = message.kmsKeyVersion; - if (message.backupKind != null && message.hasOwnProperty("backupKind")) - object.backupKind = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackupKind[message.backupKind] === undefined ? message.backupKind : $root.google.cloud.sql.v1beta4.SqlBackupKind[message.backupKind] : message.backupKind; - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - object.timeZone = message.timeZone; - if (message.ttlDays != null && message.hasOwnProperty("ttlDays")) { - if (typeof message.ttlDays === "number") - object.ttlDays = options.longs === String ? String(message.ttlDays) : message.ttlDays; - else - object.ttlDays = options.longs === String ? $util.Long.prototype.toString.call(message.ttlDays) : options.longs === Number ? new $util.LongBits(message.ttlDays.low >>> 0, message.ttlDays.high >>> 0).toNumber() : message.ttlDays; - if (options.oneofs) - object.expiration = "ttlDays"; - } - if (message.expiryTime != null && message.hasOwnProperty("expiryTime")) { - object.expiryTime = $root.google.protobuf.Timestamp.toObject(message.expiryTime, options); - if (options.oneofs) - object.expiration = "expiryTime"; - } - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; - if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { - if (typeof message.maxChargeableBytes === "number") - object.maxChargeableBytes = options.longs === String ? String(message.maxChargeableBytes) : message.maxChargeableBytes; - else - object.maxChargeableBytes = options.longs === String ? $util.Long.prototype.toString.call(message.maxChargeableBytes) : options.longs === Number ? new $util.LongBits(message.maxChargeableBytes.low >>> 0, message.maxChargeableBytes.high >>> 0).toNumber() : message.maxChargeableBytes; - if (options.oneofs) - object._maxChargeableBytes = "maxChargeableBytes"; - } - if (message.instanceDeletionTime != null && message.hasOwnProperty("instanceDeletionTime")) - object.instanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.instanceDeletionTime, options); - if (message.instanceSettings != null && message.hasOwnProperty("instanceSettings")) - object.instanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.instanceSettings, options); - if (message.backupRun != null && message.hasOwnProperty("backupRun")) - object.backupRun = message.backupRun; - if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) - object.satisfiesPzs = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzs, options); - if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) - object.satisfiesPzi = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzi, options); - return object; - }; - - /** - * Converts this Backup to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.Backup - * @instance - * @returns {Object.} JSON object - */ - Backup.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Backup - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.Backup - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Backup.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.Backup"; - }; - - /** - * SqlBackupType enum. - * @name google.cloud.sql.v1beta4.Backup.SqlBackupType - * @enum {number} - * @property {number} SQL_BACKUP_TYPE_UNSPECIFIED=0 SQL_BACKUP_TYPE_UNSPECIFIED value - * @property {number} AUTOMATED=1 AUTOMATED value - * @property {number} ON_DEMAND=2 ON_DEMAND value - * @property {number} FINAL=3 FINAL value - */ - Backup.SqlBackupType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKUP_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUTOMATED"] = 1; - values[valuesById[2] = "ON_DEMAND"] = 2; - values[valuesById[3] = "FINAL"] = 3; - return values; - })(); - - /** - * SqlBackupState enum. - * @name google.cloud.sql.v1beta4.Backup.SqlBackupState - * @enum {number} - * @property {number} SQL_BACKUP_STATE_UNSPECIFIED=0 SQL_BACKUP_STATE_UNSPECIFIED value - * @property {number} ENQUEUED=1 ENQUEUED value - * @property {number} RUNNING=2 RUNNING value - * @property {number} FAILED=3 FAILED value - * @property {number} SUCCESSFUL=4 SUCCESSFUL value - * @property {number} DELETING=5 DELETING value - * @property {number} DELETION_FAILED=6 DELETION_FAILED value - */ - Backup.SqlBackupState = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKUP_STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ENQUEUED"] = 1; - values[valuesById[2] = "RUNNING"] = 2; - values[valuesById[3] = "FAILED"] = 3; - values[valuesById[4] = "SUCCESSFUL"] = 4; - values[valuesById[5] = "DELETING"] = 5; - values[valuesById[6] = "DELETION_FAILED"] = 6; - return values; - })(); - - return Backup; - })(); - - v1beta4.BackupRunsListResponse = (function() { - - /** - * Properties of a BackupRunsListResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IBackupRunsListResponse - * @property {string|null} [kind] BackupRunsListResponse kind - * @property {Array.|null} [items] BackupRunsListResponse items - * @property {string|null} [nextPageToken] BackupRunsListResponse nextPageToken - */ - - /** - * Constructs a new BackupRunsListResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a BackupRunsListResponse. - * @implements IBackupRunsListResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IBackupRunsListResponse=} [properties] Properties to set - */ - function BackupRunsListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupRunsListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @instance - */ - BackupRunsListResponse.prototype.kind = ""; - - /** - * BackupRunsListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @instance - */ - BackupRunsListResponse.prototype.items = $util.emptyArray; - - /** - * BackupRunsListResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @instance - */ - BackupRunsListResponse.prototype.nextPageToken = ""; - - /** - * Creates a new BackupRunsListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @static - * @param {google.cloud.sql.v1beta4.IBackupRunsListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.BackupRunsListResponse} BackupRunsListResponse instance - */ - BackupRunsListResponse.create = function create(properties) { - return new BackupRunsListResponse(properties); - }; - - /** - * Encodes the specified BackupRunsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRunsListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @static - * @param {google.cloud.sql.v1beta4.IBackupRunsListResponse} message BackupRunsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRunsListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1beta4.BackupRun.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified BackupRunsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupRunsListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @static - * @param {google.cloud.sql.v1beta4.IBackupRunsListResponse} message BackupRunsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupRunsListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupRunsListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.BackupRunsListResponse} BackupRunsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRunsListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupRunsListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1beta4.BackupRun.decode(reader, reader.uint32())); - break; - } - case 3: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupRunsListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.BackupRunsListResponse} BackupRunsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupRunsListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupRunsListResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupRunsListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.BackupRun.verify(message.items[i]); - if (error) - return "items." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a BackupRunsListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.BackupRunsListResponse} BackupRunsListResponse - */ - BackupRunsListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.BackupRunsListResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.BackupRunsListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1beta4.BackupRunsListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.BackupRunsListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1beta4.BackupRun.fromObject(object.items[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a BackupRunsListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @static - * @param {google.cloud.sql.v1beta4.BackupRunsListResponse} message BackupRunsListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupRunsListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) { - object.kind = ""; - object.nextPageToken = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1beta4.BackupRun.toObject(message.items[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this BackupRunsListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @instance - * @returns {Object.} JSON object - */ - BackupRunsListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupRunsListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.BackupRunsListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupRunsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupRunsListResponse"; - }; - - return BackupRunsListResponse; - })(); - - v1beta4.BinLogCoordinates = (function() { - - /** - * Properties of a BinLogCoordinates. - * @memberof google.cloud.sql.v1beta4 - * @interface IBinLogCoordinates - * @property {string|null} [binLogFileName] BinLogCoordinates binLogFileName - * @property {number|Long|null} [binLogPosition] BinLogCoordinates binLogPosition - * @property {string|null} [kind] BinLogCoordinates kind - */ - - /** - * Constructs a new BinLogCoordinates. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a BinLogCoordinates. - * @implements IBinLogCoordinates - * @constructor - * @param {google.cloud.sql.v1beta4.IBinLogCoordinates=} [properties] Properties to set - */ - function BinLogCoordinates(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BinLogCoordinates binLogFileName. - * @member {string} binLogFileName - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @instance - */ - BinLogCoordinates.prototype.binLogFileName = ""; - - /** - * BinLogCoordinates binLogPosition. - * @member {number|Long} binLogPosition - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @instance - */ - BinLogCoordinates.prototype.binLogPosition = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BinLogCoordinates kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @instance - */ - BinLogCoordinates.prototype.kind = ""; - - /** - * Creates a new BinLogCoordinates instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @static - * @param {google.cloud.sql.v1beta4.IBinLogCoordinates=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.BinLogCoordinates} BinLogCoordinates instance - */ - BinLogCoordinates.create = function create(properties) { - return new BinLogCoordinates(properties); - }; - - /** - * Encodes the specified BinLogCoordinates message. Does not implicitly {@link google.cloud.sql.v1beta4.BinLogCoordinates.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @static - * @param {google.cloud.sql.v1beta4.IBinLogCoordinates} message BinLogCoordinates message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BinLogCoordinates.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.binLogFileName != null && Object.hasOwnProperty.call(message, "binLogFileName")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.binLogFileName); - if (message.binLogPosition != null && Object.hasOwnProperty.call(message, "binLogPosition")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.binLogPosition); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - return writer; - }; - - /** - * Encodes the specified BinLogCoordinates message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BinLogCoordinates.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @static - * @param {google.cloud.sql.v1beta4.IBinLogCoordinates} message BinLogCoordinates message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BinLogCoordinates.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BinLogCoordinates message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.BinLogCoordinates} BinLogCoordinates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BinLogCoordinates.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BinLogCoordinates(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.binLogFileName = reader.string(); - break; - } - case 2: { - message.binLogPosition = reader.int64(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BinLogCoordinates message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.BinLogCoordinates} BinLogCoordinates - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BinLogCoordinates.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BinLogCoordinates message. - * @function verify - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BinLogCoordinates.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.binLogFileName != null && message.hasOwnProperty("binLogFileName")) - if (!$util.isString(message.binLogFileName)) - return "binLogFileName: string expected"; - if (message.binLogPosition != null && message.hasOwnProperty("binLogPosition")) - if (!$util.isInteger(message.binLogPosition) && !(message.binLogPosition && $util.isInteger(message.binLogPosition.low) && $util.isInteger(message.binLogPosition.high))) - return "binLogPosition: integer|Long expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a BinLogCoordinates message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.BinLogCoordinates} BinLogCoordinates - */ - BinLogCoordinates.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.BinLogCoordinates) - return object; - var message = new $root.google.cloud.sql.v1beta4.BinLogCoordinates(); - if (object.binLogFileName != null) - message.binLogFileName = String(object.binLogFileName); - if (object.binLogPosition != null) - if ($util.Long) - (message.binLogPosition = $util.Long.fromValue(object.binLogPosition)).unsigned = false; - else if (typeof object.binLogPosition === "string") - message.binLogPosition = parseInt(object.binLogPosition, 10); - else if (typeof object.binLogPosition === "number") - message.binLogPosition = object.binLogPosition; - else if (typeof object.binLogPosition === "object") - message.binLogPosition = new $util.LongBits(object.binLogPosition.low >>> 0, object.binLogPosition.high >>> 0).toNumber(); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a BinLogCoordinates message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @static - * @param {google.cloud.sql.v1beta4.BinLogCoordinates} message BinLogCoordinates - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BinLogCoordinates.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.binLogFileName = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.binLogPosition = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.binLogPosition = options.longs === String ? "0" : 0; - object.kind = ""; - } - if (message.binLogFileName != null && message.hasOwnProperty("binLogFileName")) - object.binLogFileName = message.binLogFileName; - if (message.binLogPosition != null && message.hasOwnProperty("binLogPosition")) - if (typeof message.binLogPosition === "number") - object.binLogPosition = options.longs === String ? String(message.binLogPosition) : message.binLogPosition; - else - object.binLogPosition = options.longs === String ? $util.Long.prototype.toString.call(message.binLogPosition) : options.longs === Number ? new $util.LongBits(message.binLogPosition.low >>> 0, message.binLogPosition.high >>> 0).toNumber() : message.binLogPosition; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this BinLogCoordinates to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @instance - * @returns {Object.} JSON object - */ - BinLogCoordinates.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BinLogCoordinates - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.BinLogCoordinates - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BinLogCoordinates.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.BinLogCoordinates"; - }; - - return BinLogCoordinates; - })(); - - v1beta4.BackupContext = (function() { - - /** - * Properties of a BackupContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IBackupContext - * @property {number|Long|null} [backupId] BackupContext backupId - * @property {string|null} [kind] BackupContext kind - * @property {string|null} [name] BackupContext name - */ - - /** - * Constructs a new BackupContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a BackupContext. - * @implements IBackupContext - * @constructor - * @param {google.cloud.sql.v1beta4.IBackupContext=} [properties] Properties to set - */ - function BackupContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BackupContext backupId. - * @member {number|Long} backupId - * @memberof google.cloud.sql.v1beta4.BackupContext - * @instance - */ - BackupContext.prototype.backupId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * BackupContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.BackupContext - * @instance - */ - BackupContext.prototype.kind = ""; - - /** - * BackupContext name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.BackupContext - * @instance - */ - BackupContext.prototype.name = ""; - - /** - * Creates a new BackupContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.BackupContext - * @static - * @param {google.cloud.sql.v1beta4.IBackupContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.BackupContext} BackupContext instance - */ - BackupContext.create = function create(properties) { - return new BackupContext(properties); - }; - - /** - * Encodes the specified BackupContext message. Does not implicitly {@link google.cloud.sql.v1beta4.BackupContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.BackupContext - * @static - * @param {google.cloud.sql.v1beta4.IBackupContext} message BackupContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.backupId != null && Object.hasOwnProperty.call(message, "backupId")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.backupId); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - return writer; - }; - - /** - * Encodes the specified BackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.BackupContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupContext - * @static - * @param {google.cloud.sql.v1beta4.IBackupContext} message BackupContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BackupContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BackupContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.BackupContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.BackupContext} BackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.BackupContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.backupId = reader.int64(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - case 3: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BackupContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.BackupContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.BackupContext} BackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BackupContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BackupContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.BackupContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BackupContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.backupId != null && message.hasOwnProperty("backupId")) - if (!$util.isInteger(message.backupId) && !(message.backupId && $util.isInteger(message.backupId.low) && $util.isInteger(message.backupId.high))) - return "backupId: integer|Long expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a BackupContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.BackupContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.BackupContext} BackupContext - */ - BackupContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.BackupContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.BackupContext(); - if (object.backupId != null) - if ($util.Long) - (message.backupId = $util.Long.fromValue(object.backupId)).unsigned = false; - else if (typeof object.backupId === "string") - message.backupId = parseInt(object.backupId, 10); - else if (typeof object.backupId === "number") - message.backupId = object.backupId; - else if (typeof object.backupId === "object") - message.backupId = new $util.LongBits(object.backupId.low >>> 0, object.backupId.high >>> 0).toNumber(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a BackupContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.BackupContext - * @static - * @param {google.cloud.sql.v1beta4.BackupContext} message BackupContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BackupContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.backupId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.backupId = options.longs === String ? "0" : 0; - object.kind = ""; - object.name = ""; - } - if (message.backupId != null && message.hasOwnProperty("backupId")) - if (typeof message.backupId === "number") - object.backupId = options.longs === String ? String(message.backupId) : message.backupId; - else - object.backupId = options.longs === String ? $util.Long.prototype.toString.call(message.backupId) : options.longs === Number ? new $util.LongBits(message.backupId.low >>> 0, message.backupId.high >>> 0).toNumber() : message.backupId; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this BackupContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.BackupContext - * @instance - * @returns {Object.} JSON object - */ - BackupContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BackupContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.BackupContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BackupContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.BackupContext"; - }; - - return BackupContext; - })(); - - v1beta4.CloneContext = (function() { - - /** - * Properties of a CloneContext. - * @memberof google.cloud.sql.v1beta4 - * @interface ICloneContext - * @property {string|null} [kind] CloneContext kind - * @property {number|Long|null} [pitrTimestampMs] CloneContext pitrTimestampMs - * @property {string|null} [destinationInstanceName] CloneContext destinationInstanceName - * @property {google.cloud.sql.v1beta4.IBinLogCoordinates|null} [binLogCoordinates] CloneContext binLogCoordinates - * @property {google.protobuf.ITimestamp|null} [pointInTime] CloneContext pointInTime - * @property {string|null} [allocatedIpRange] CloneContext allocatedIpRange - * @property {Array.|null} [databaseNames] CloneContext databaseNames - * @property {string|null} [preferredZone] CloneContext preferredZone - * @property {string|null} [preferredSecondaryZone] CloneContext preferredSecondaryZone - * @property {google.protobuf.ITimestamp|null} [sourceInstanceDeletionTime] CloneContext sourceInstanceDeletionTime - * @property {string|null} [destinationProject] CloneContext destinationProject - * @property {string|null} [destinationNetwork] CloneContext destinationNetwork - */ - - /** - * Constructs a new CloneContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a CloneContext. - * @implements ICloneContext - * @constructor - * @param {google.cloud.sql.v1beta4.ICloneContext=} [properties] Properties to set - */ - function CloneContext(properties) { - this.databaseNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CloneContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.kind = ""; - - /** - * CloneContext pitrTimestampMs. - * @member {number|Long} pitrTimestampMs - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.pitrTimestampMs = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * CloneContext destinationInstanceName. - * @member {string} destinationInstanceName - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.destinationInstanceName = ""; - - /** - * CloneContext binLogCoordinates. - * @member {google.cloud.sql.v1beta4.IBinLogCoordinates|null|undefined} binLogCoordinates - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.binLogCoordinates = null; - - /** - * CloneContext pointInTime. - * @member {google.protobuf.ITimestamp|null|undefined} pointInTime - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.pointInTime = null; - - /** - * CloneContext allocatedIpRange. - * @member {string} allocatedIpRange - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.allocatedIpRange = ""; - - /** - * CloneContext databaseNames. - * @member {Array.} databaseNames - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.databaseNames = $util.emptyArray; - - /** - * CloneContext preferredZone. - * @member {string|null|undefined} preferredZone - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.preferredZone = null; - - /** - * CloneContext preferredSecondaryZone. - * @member {string|null|undefined} preferredSecondaryZone - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.preferredSecondaryZone = null; - - /** - * CloneContext sourceInstanceDeletionTime. - * @member {google.protobuf.ITimestamp|null|undefined} sourceInstanceDeletionTime - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.sourceInstanceDeletionTime = null; - - /** - * CloneContext destinationProject. - * @member {string|null|undefined} destinationProject - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.destinationProject = null; - - /** - * CloneContext destinationNetwork. - * @member {string|null|undefined} destinationNetwork - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - */ - CloneContext.prototype.destinationNetwork = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CloneContext.prototype, "_preferredZone", { - get: $util.oneOfGetter($oneOfFields = ["preferredZone"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CloneContext.prototype, "_preferredSecondaryZone", { - get: $util.oneOfGetter($oneOfFields = ["preferredSecondaryZone"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CloneContext.prototype, "_sourceInstanceDeletionTime", { - get: $util.oneOfGetter($oneOfFields = ["sourceInstanceDeletionTime"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CloneContext.prototype, "_destinationProject", { - get: $util.oneOfGetter($oneOfFields = ["destinationProject"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(CloneContext.prototype, "_destinationNetwork", { - get: $util.oneOfGetter($oneOfFields = ["destinationNetwork"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new CloneContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.CloneContext - * @static - * @param {google.cloud.sql.v1beta4.ICloneContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.CloneContext} CloneContext instance - */ - CloneContext.create = function create(properties) { - return new CloneContext(properties); - }; - - /** - * Encodes the specified CloneContext message. Does not implicitly {@link google.cloud.sql.v1beta4.CloneContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.CloneContext - * @static - * @param {google.cloud.sql.v1beta4.ICloneContext} message CloneContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CloneContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.pitrTimestampMs != null && Object.hasOwnProperty.call(message, "pitrTimestampMs")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.pitrTimestampMs); - if (message.destinationInstanceName != null && Object.hasOwnProperty.call(message, "destinationInstanceName")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.destinationInstanceName); - if (message.binLogCoordinates != null && Object.hasOwnProperty.call(message, "binLogCoordinates")) - $root.google.cloud.sql.v1beta4.BinLogCoordinates.encode(message.binLogCoordinates, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.pointInTime != null && Object.hasOwnProperty.call(message, "pointInTime")) - $root.google.protobuf.Timestamp.encode(message.pointInTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.allocatedIpRange); - if (message.databaseNames != null && message.databaseNames.length) - for (var i = 0; i < message.databaseNames.length; ++i) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.databaseNames[i]); - if (message.preferredZone != null && Object.hasOwnProperty.call(message, "preferredZone")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.preferredZone); - if (message.preferredSecondaryZone != null && Object.hasOwnProperty.call(message, "preferredSecondaryZone")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.preferredSecondaryZone); - if (message.sourceInstanceDeletionTime != null && Object.hasOwnProperty.call(message, "sourceInstanceDeletionTime")) - $root.google.protobuf.Timestamp.encode(message.sourceInstanceDeletionTime, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.destinationProject != null && Object.hasOwnProperty.call(message, "destinationProject")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.destinationProject); - if (message.destinationNetwork != null && Object.hasOwnProperty.call(message, "destinationNetwork")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.destinationNetwork); - return writer; - }; - - /** - * Encodes the specified CloneContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.CloneContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.CloneContext - * @static - * @param {google.cloud.sql.v1beta4.ICloneContext} message CloneContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CloneContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CloneContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.CloneContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.CloneContext} CloneContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CloneContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.CloneContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.pitrTimestampMs = reader.int64(); - break; - } - case 3: { - message.destinationInstanceName = reader.string(); - break; - } - case 4: { - message.binLogCoordinates = $root.google.cloud.sql.v1beta4.BinLogCoordinates.decode(reader, reader.uint32()); - break; - } - case 5: { - message.pointInTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 6: { - message.allocatedIpRange = reader.string(); - break; - } - case 9: { - if (!(message.databaseNames && message.databaseNames.length)) - message.databaseNames = []; - message.databaseNames.push(reader.string()); - break; - } - case 10: { - message.preferredZone = reader.string(); - break; - } - case 11: { - message.preferredSecondaryZone = reader.string(); - break; - } - case 12: { - message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 13: { - message.destinationProject = reader.string(); - break; - } - case 14: { - message.destinationNetwork = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CloneContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.CloneContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.CloneContext} CloneContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CloneContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CloneContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.CloneContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CloneContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.pitrTimestampMs != null && message.hasOwnProperty("pitrTimestampMs")) - if (!$util.isInteger(message.pitrTimestampMs) && !(message.pitrTimestampMs && $util.isInteger(message.pitrTimestampMs.low) && $util.isInteger(message.pitrTimestampMs.high))) - return "pitrTimestampMs: integer|Long expected"; - if (message.destinationInstanceName != null && message.hasOwnProperty("destinationInstanceName")) - if (!$util.isString(message.destinationInstanceName)) - return "destinationInstanceName: string expected"; - if (message.binLogCoordinates != null && message.hasOwnProperty("binLogCoordinates")) { - var error = $root.google.cloud.sql.v1beta4.BinLogCoordinates.verify(message.binLogCoordinates); - if (error) - return "binLogCoordinates." + error; - } - if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.pointInTime); - if (error) - return "pointInTime." + error; - } - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) - if (!$util.isString(message.allocatedIpRange)) - return "allocatedIpRange: string expected"; - if (message.databaseNames != null && message.hasOwnProperty("databaseNames")) { - if (!Array.isArray(message.databaseNames)) - return "databaseNames: array expected"; - for (var i = 0; i < message.databaseNames.length; ++i) - if (!$util.isString(message.databaseNames[i])) - return "databaseNames: string[] expected"; - } - if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { - properties._preferredZone = 1; - if (!$util.isString(message.preferredZone)) - return "preferredZone: string expected"; - } - if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { - properties._preferredSecondaryZone = 1; - if (!$util.isString(message.preferredSecondaryZone)) - return "preferredSecondaryZone: string expected"; - } - if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { - properties._sourceInstanceDeletionTime = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.sourceInstanceDeletionTime); - if (error) - return "sourceInstanceDeletionTime." + error; - } - } - if (message.destinationProject != null && message.hasOwnProperty("destinationProject")) { - properties._destinationProject = 1; - if (!$util.isString(message.destinationProject)) - return "destinationProject: string expected"; - } - if (message.destinationNetwork != null && message.hasOwnProperty("destinationNetwork")) { - properties._destinationNetwork = 1; - if (!$util.isString(message.destinationNetwork)) - return "destinationNetwork: string expected"; - } - return null; - }; - - /** - * Creates a CloneContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.CloneContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.CloneContext} CloneContext - */ - CloneContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.CloneContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.CloneContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.pitrTimestampMs != null) - if ($util.Long) - (message.pitrTimestampMs = $util.Long.fromValue(object.pitrTimestampMs)).unsigned = false; - else if (typeof object.pitrTimestampMs === "string") - message.pitrTimestampMs = parseInt(object.pitrTimestampMs, 10); - else if (typeof object.pitrTimestampMs === "number") - message.pitrTimestampMs = object.pitrTimestampMs; - else if (typeof object.pitrTimestampMs === "object") - message.pitrTimestampMs = new $util.LongBits(object.pitrTimestampMs.low >>> 0, object.pitrTimestampMs.high >>> 0).toNumber(); - if (object.destinationInstanceName != null) - message.destinationInstanceName = String(object.destinationInstanceName); - if (object.binLogCoordinates != null) { - if (typeof object.binLogCoordinates !== "object") - throw TypeError(".google.cloud.sql.v1beta4.CloneContext.binLogCoordinates: object expected"); - message.binLogCoordinates = $root.google.cloud.sql.v1beta4.BinLogCoordinates.fromObject(object.binLogCoordinates); - } - if (object.pointInTime != null) { - if (typeof object.pointInTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.CloneContext.pointInTime: object expected"); - message.pointInTime = $root.google.protobuf.Timestamp.fromObject(object.pointInTime); - } - if (object.allocatedIpRange != null) - message.allocatedIpRange = String(object.allocatedIpRange); - if (object.databaseNames) { - if (!Array.isArray(object.databaseNames)) - throw TypeError(".google.cloud.sql.v1beta4.CloneContext.databaseNames: array expected"); - message.databaseNames = []; - for (var i = 0; i < object.databaseNames.length; ++i) - message.databaseNames[i] = String(object.databaseNames[i]); - } - if (object.preferredZone != null) - message.preferredZone = String(object.preferredZone); - if (object.preferredSecondaryZone != null) - message.preferredSecondaryZone = String(object.preferredSecondaryZone); - if (object.sourceInstanceDeletionTime != null) { - if (typeof object.sourceInstanceDeletionTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.CloneContext.sourceInstanceDeletionTime: object expected"); - message.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.fromObject(object.sourceInstanceDeletionTime); - } - if (object.destinationProject != null) - message.destinationProject = String(object.destinationProject); - if (object.destinationNetwork != null) - message.destinationNetwork = String(object.destinationNetwork); - return message; - }; - - /** - * Creates a plain object from a CloneContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.CloneContext - * @static - * @param {google.cloud.sql.v1beta4.CloneContext} message CloneContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CloneContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.databaseNames = []; - if (options.defaults) { - object.kind = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.pitrTimestampMs = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.pitrTimestampMs = options.longs === String ? "0" : 0; - object.destinationInstanceName = ""; - object.binLogCoordinates = null; - object.pointInTime = null; - object.allocatedIpRange = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.pitrTimestampMs != null && message.hasOwnProperty("pitrTimestampMs")) - if (typeof message.pitrTimestampMs === "number") - object.pitrTimestampMs = options.longs === String ? String(message.pitrTimestampMs) : message.pitrTimestampMs; - else - object.pitrTimestampMs = options.longs === String ? $util.Long.prototype.toString.call(message.pitrTimestampMs) : options.longs === Number ? new $util.LongBits(message.pitrTimestampMs.low >>> 0, message.pitrTimestampMs.high >>> 0).toNumber() : message.pitrTimestampMs; - if (message.destinationInstanceName != null && message.hasOwnProperty("destinationInstanceName")) - object.destinationInstanceName = message.destinationInstanceName; - if (message.binLogCoordinates != null && message.hasOwnProperty("binLogCoordinates")) - object.binLogCoordinates = $root.google.cloud.sql.v1beta4.BinLogCoordinates.toObject(message.binLogCoordinates, options); - if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) - object.pointInTime = $root.google.protobuf.Timestamp.toObject(message.pointInTime, options); - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) - object.allocatedIpRange = message.allocatedIpRange; - if (message.databaseNames && message.databaseNames.length) { - object.databaseNames = []; - for (var j = 0; j < message.databaseNames.length; ++j) - object.databaseNames[j] = message.databaseNames[j]; - } - if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { - object.preferredZone = message.preferredZone; - if (options.oneofs) - object._preferredZone = "preferredZone"; - } - if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { - object.preferredSecondaryZone = message.preferredSecondaryZone; - if (options.oneofs) - object._preferredSecondaryZone = "preferredSecondaryZone"; - } - if (message.sourceInstanceDeletionTime != null && message.hasOwnProperty("sourceInstanceDeletionTime")) { - object.sourceInstanceDeletionTime = $root.google.protobuf.Timestamp.toObject(message.sourceInstanceDeletionTime, options); - if (options.oneofs) - object._sourceInstanceDeletionTime = "sourceInstanceDeletionTime"; - } - if (message.destinationProject != null && message.hasOwnProperty("destinationProject")) { - object.destinationProject = message.destinationProject; - if (options.oneofs) - object._destinationProject = "destinationProject"; - } - if (message.destinationNetwork != null && message.hasOwnProperty("destinationNetwork")) { - object.destinationNetwork = message.destinationNetwork; - if (options.oneofs) - object._destinationNetwork = "destinationNetwork"; - } - return object; - }; - - /** - * Converts this CloneContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.CloneContext - * @instance - * @returns {Object.} JSON object - */ - CloneContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CloneContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.CloneContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CloneContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.CloneContext"; - }; - - return CloneContext; - })(); - - v1beta4.Database = (function() { - - /** - * Properties of a Database. - * @memberof google.cloud.sql.v1beta4 - * @interface IDatabase - * @property {string|null} [kind] Database kind - * @property {string|null} [charset] Database charset - * @property {string|null} [collation] Database collation - * @property {string|null} [etag] Database etag - * @property {string|null} [name] Database name - * @property {string|null} [instance] Database instance - * @property {string|null} [selfLink] Database selfLink - * @property {string|null} [project] Database project - * @property {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails|null} [sqlserverDatabaseDetails] Database sqlserverDatabaseDetails - */ - - /** - * Constructs a new Database. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a Database. - * @implements IDatabase - * @constructor - * @param {google.cloud.sql.v1beta4.IDatabase=} [properties] Properties to set - */ - function Database(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Database kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.Database - * @instance - */ - Database.prototype.kind = ""; - - /** - * Database charset. - * @member {string} charset - * @memberof google.cloud.sql.v1beta4.Database - * @instance - */ - Database.prototype.charset = ""; - - /** - * Database collation. - * @member {string} collation - * @memberof google.cloud.sql.v1beta4.Database - * @instance - */ - Database.prototype.collation = ""; - - /** - * Database etag. - * @member {string} etag - * @memberof google.cloud.sql.v1beta4.Database - * @instance - */ - Database.prototype.etag = ""; - - /** - * Database name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.Database - * @instance - */ - Database.prototype.name = ""; - - /** - * Database instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.Database - * @instance - */ - Database.prototype.instance = ""; - - /** - * Database selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1beta4.Database - * @instance - */ - Database.prototype.selfLink = ""; - - /** - * Database project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.Database - * @instance - */ - Database.prototype.project = ""; - - /** - * Database sqlserverDatabaseDetails. - * @member {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails|null|undefined} sqlserverDatabaseDetails - * @memberof google.cloud.sql.v1beta4.Database - * @instance - */ - Database.prototype.sqlserverDatabaseDetails = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Database databaseDetails. - * @member {"sqlserverDatabaseDetails"|undefined} databaseDetails - * @memberof google.cloud.sql.v1beta4.Database - * @instance - */ - Object.defineProperty(Database.prototype, "databaseDetails", { - get: $util.oneOfGetter($oneOfFields = ["sqlserverDatabaseDetails"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Database instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.Database - * @static - * @param {google.cloud.sql.v1beta4.IDatabase=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.Database} Database instance - */ - Database.create = function create(properties) { - return new Database(properties); - }; - - /** - * Encodes the specified Database message. Does not implicitly {@link google.cloud.sql.v1beta4.Database.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.Database - * @static - * @param {google.cloud.sql.v1beta4.IDatabase} message Database message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Database.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.charset != null && Object.hasOwnProperty.call(message, "charset")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.charset); - if (message.collation != null && Object.hasOwnProperty.call(message, "collation")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.collation); - if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.etag); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.selfLink); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.project); - if (message.sqlserverDatabaseDetails != null && Object.hasOwnProperty.call(message, "sqlserverDatabaseDetails")) - $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails.encode(message.sqlserverDatabaseDetails, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Database message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Database.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.Database - * @static - * @param {google.cloud.sql.v1beta4.IDatabase} message Database message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Database.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Database message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.Database - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.Database} Database - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Database.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Database(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.charset = reader.string(); - break; - } - case 3: { - message.collation = reader.string(); - break; - } - case 4: { - message.etag = reader.string(); - break; - } - case 5: { - message.name = reader.string(); - break; - } - case 6: { - message.instance = reader.string(); - break; - } - case 7: { - message.selfLink = reader.string(); - break; - } - case 8: { - message.project = reader.string(); - break; - } - case 9: { - message.sqlserverDatabaseDetails = $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Database message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.Database - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.Database} Database - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Database.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Database message. - * @function verify - * @memberof google.cloud.sql.v1beta4.Database - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Database.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.charset != null && message.hasOwnProperty("charset")) - if (!$util.isString(message.charset)) - return "charset: string expected"; - if (message.collation != null && message.hasOwnProperty("collation")) - if (!$util.isString(message.collation)) - return "collation: string expected"; - if (message.etag != null && message.hasOwnProperty("etag")) - if (!$util.isString(message.etag)) - return "etag: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.sqlserverDatabaseDetails != null && message.hasOwnProperty("sqlserverDatabaseDetails")) { - properties.databaseDetails = 1; - { - var error = $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails.verify(message.sqlserverDatabaseDetails); - if (error) - return "sqlserverDatabaseDetails." + error; - } - } - return null; - }; - - /** - * Creates a Database message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.Database - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.Database} Database - */ - Database.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.Database) - return object; - var message = new $root.google.cloud.sql.v1beta4.Database(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.charset != null) - message.charset = String(object.charset); - if (object.collation != null) - message.collation = String(object.collation); - if (object.etag != null) - message.etag = String(object.etag); - if (object.name != null) - message.name = String(object.name); - if (object.instance != null) - message.instance = String(object.instance); - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - if (object.project != null) - message.project = String(object.project); - if (object.sqlserverDatabaseDetails != null) { - if (typeof object.sqlserverDatabaseDetails !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Database.sqlserverDatabaseDetails: object expected"); - message.sqlserverDatabaseDetails = $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails.fromObject(object.sqlserverDatabaseDetails); - } - return message; - }; - - /** - * Creates a plain object from a Database message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.Database - * @static - * @param {google.cloud.sql.v1beta4.Database} message Database - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Database.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.charset = ""; - object.collation = ""; - object.etag = ""; - object.name = ""; - object.instance = ""; - object.selfLink = ""; - object.project = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.charset != null && message.hasOwnProperty("charset")) - object.charset = message.charset; - if (message.collation != null && message.hasOwnProperty("collation")) - object.collation = message.collation; - if (message.etag != null && message.hasOwnProperty("etag")) - object.etag = message.etag; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.sqlserverDatabaseDetails != null && message.hasOwnProperty("sqlserverDatabaseDetails")) { - object.sqlserverDatabaseDetails = $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails.toObject(message.sqlserverDatabaseDetails, options); - if (options.oneofs) - object.databaseDetails = "sqlserverDatabaseDetails"; - } - return object; - }; - - /** - * Converts this Database to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.Database - * @instance - * @returns {Object.} JSON object - */ - Database.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Database - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.Database - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Database.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.Database"; - }; - - return Database; - })(); - - v1beta4.SqlServerDatabaseDetails = (function() { - - /** - * Properties of a SqlServerDatabaseDetails. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlServerDatabaseDetails - * @property {number|null} [compatibilityLevel] SqlServerDatabaseDetails compatibilityLevel - * @property {string|null} [recoveryModel] SqlServerDatabaseDetails recoveryModel - */ - - /** - * Constructs a new SqlServerDatabaseDetails. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlServerDatabaseDetails. - * @implements ISqlServerDatabaseDetails - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails=} [properties] Properties to set - */ - function SqlServerDatabaseDetails(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlServerDatabaseDetails compatibilityLevel. - * @member {number} compatibilityLevel - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @instance - */ - SqlServerDatabaseDetails.prototype.compatibilityLevel = 0; - - /** - * SqlServerDatabaseDetails recoveryModel. - * @member {string} recoveryModel - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @instance - */ - SqlServerDatabaseDetails.prototype.recoveryModel = ""; - - /** - * Creates a new SqlServerDatabaseDetails instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlServerDatabaseDetails} SqlServerDatabaseDetails instance - */ - SqlServerDatabaseDetails.create = function create(properties) { - return new SqlServerDatabaseDetails(properties); - }; - - /** - * Encodes the specified SqlServerDatabaseDetails message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerDatabaseDetails.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails} message SqlServerDatabaseDetails message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerDatabaseDetails.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.compatibilityLevel != null && Object.hasOwnProperty.call(message, "compatibilityLevel")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.compatibilityLevel); - if (message.recoveryModel != null && Object.hasOwnProperty.call(message, "recoveryModel")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.recoveryModel); - return writer; - }; - - /** - * Encodes the specified SqlServerDatabaseDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerDatabaseDetails.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerDatabaseDetails} message SqlServerDatabaseDetails message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerDatabaseDetails.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlServerDatabaseDetails} SqlServerDatabaseDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerDatabaseDetails.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.compatibilityLevel = reader.int32(); - break; - } - case 2: { - message.recoveryModel = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlServerDatabaseDetails message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlServerDatabaseDetails} SqlServerDatabaseDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerDatabaseDetails.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlServerDatabaseDetails message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlServerDatabaseDetails.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.compatibilityLevel != null && message.hasOwnProperty("compatibilityLevel")) - if (!$util.isInteger(message.compatibilityLevel)) - return "compatibilityLevel: integer expected"; - if (message.recoveryModel != null && message.hasOwnProperty("recoveryModel")) - if (!$util.isString(message.recoveryModel)) - return "recoveryModel: string expected"; - return null; - }; - - /** - * Creates a SqlServerDatabaseDetails message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlServerDatabaseDetails} SqlServerDatabaseDetails - */ - SqlServerDatabaseDetails.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlServerDatabaseDetails(); - if (object.compatibilityLevel != null) - message.compatibilityLevel = object.compatibilityLevel | 0; - if (object.recoveryModel != null) - message.recoveryModel = String(object.recoveryModel); - return message; - }; - - /** - * Creates a plain object from a SqlServerDatabaseDetails message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @static - * @param {google.cloud.sql.v1beta4.SqlServerDatabaseDetails} message SqlServerDatabaseDetails - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlServerDatabaseDetails.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.compatibilityLevel = 0; - object.recoveryModel = ""; - } - if (message.compatibilityLevel != null && message.hasOwnProperty("compatibilityLevel")) - object.compatibilityLevel = message.compatibilityLevel; - if (message.recoveryModel != null && message.hasOwnProperty("recoveryModel")) - object.recoveryModel = message.recoveryModel; - return object; - }; - - /** - * Converts this SqlServerDatabaseDetails to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @instance - * @returns {Object.} JSON object - */ - SqlServerDatabaseDetails.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlServerDatabaseDetails - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlServerDatabaseDetails - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlServerDatabaseDetails.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlServerDatabaseDetails"; - }; - - return SqlServerDatabaseDetails; - })(); - - v1beta4.DatabaseFlags = (function() { - - /** - * Properties of a DatabaseFlags. - * @memberof google.cloud.sql.v1beta4 - * @interface IDatabaseFlags - * @property {string|null} [name] DatabaseFlags name - * @property {string|null} [value] DatabaseFlags value - */ - - /** - * Constructs a new DatabaseFlags. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DatabaseFlags. - * @implements IDatabaseFlags - * @constructor - * @param {google.cloud.sql.v1beta4.IDatabaseFlags=} [properties] Properties to set - */ - function DatabaseFlags(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DatabaseFlags name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @instance - */ - DatabaseFlags.prototype.name = ""; - - /** - * DatabaseFlags value. - * @member {string} value - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @instance - */ - DatabaseFlags.prototype.value = ""; - - /** - * Creates a new DatabaseFlags instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @static - * @param {google.cloud.sql.v1beta4.IDatabaseFlags=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DatabaseFlags} DatabaseFlags instance - */ - DatabaseFlags.create = function create(properties) { - return new DatabaseFlags(properties); - }; - - /** - * Encodes the specified DatabaseFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseFlags.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @static - * @param {google.cloud.sql.v1beta4.IDatabaseFlags} message DatabaseFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabaseFlags.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified DatabaseFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseFlags.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @static - * @param {google.cloud.sql.v1beta4.IDatabaseFlags} message DatabaseFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabaseFlags.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DatabaseFlags message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DatabaseFlags} DatabaseFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabaseFlags.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseFlags(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DatabaseFlags message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DatabaseFlags} DatabaseFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabaseFlags.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DatabaseFlags message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DatabaseFlags.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a DatabaseFlags message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DatabaseFlags} DatabaseFlags - */ - DatabaseFlags.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseFlags) - return object; - var message = new $root.google.cloud.sql.v1beta4.DatabaseFlags(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a DatabaseFlags message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @static - * @param {google.cloud.sql.v1beta4.DatabaseFlags} message DatabaseFlags - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DatabaseFlags.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.value = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this DatabaseFlags to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @instance - * @returns {Object.} JSON object - */ - DatabaseFlags.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DatabaseFlags - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DatabaseFlags - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DatabaseFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseFlags"; - }; - - return DatabaseFlags; - })(); - - v1beta4.SyncFlags = (function() { - - /** - * Properties of a SyncFlags. - * @memberof google.cloud.sql.v1beta4 - * @interface ISyncFlags - * @property {string|null} [name] SyncFlags name - * @property {string|null} [value] SyncFlags value - */ - - /** - * Constructs a new SyncFlags. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SyncFlags. - * @implements ISyncFlags - * @constructor - * @param {google.cloud.sql.v1beta4.ISyncFlags=} [properties] Properties to set - */ - function SyncFlags(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SyncFlags name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @instance - */ - SyncFlags.prototype.name = ""; - - /** - * SyncFlags value. - * @member {string} value - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @instance - */ - SyncFlags.prototype.value = ""; - - /** - * Creates a new SyncFlags instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @static - * @param {google.cloud.sql.v1beta4.ISyncFlags=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SyncFlags} SyncFlags instance - */ - SyncFlags.create = function create(properties) { - return new SyncFlags(properties); - }; - - /** - * Encodes the specified SyncFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.SyncFlags.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @static - * @param {google.cloud.sql.v1beta4.ISyncFlags} message SyncFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SyncFlags.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified SyncFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SyncFlags.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @static - * @param {google.cloud.sql.v1beta4.ISyncFlags} message SyncFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SyncFlags.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SyncFlags message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SyncFlags} SyncFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SyncFlags.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SyncFlags(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SyncFlags message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SyncFlags} SyncFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SyncFlags.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SyncFlags message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SyncFlags.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a SyncFlags message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SyncFlags} SyncFlags - */ - SyncFlags.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SyncFlags) - return object; - var message = new $root.google.cloud.sql.v1beta4.SyncFlags(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a SyncFlags message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @static - * @param {google.cloud.sql.v1beta4.SyncFlags} message SyncFlags - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SyncFlags.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.value = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this SyncFlags to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @instance - * @returns {Object.} JSON object - */ - SyncFlags.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SyncFlags - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SyncFlags - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SyncFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SyncFlags"; - }; - - return SyncFlags; - })(); - - v1beta4.InstanceReference = (function() { - - /** - * Properties of an InstanceReference. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstanceReference - * @property {string|null} [name] InstanceReference name - * @property {string|null} [region] InstanceReference region - * @property {string|null} [project] InstanceReference project - */ - - /** - * Constructs a new InstanceReference. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstanceReference. - * @implements IInstanceReference - * @constructor - * @param {google.cloud.sql.v1beta4.IInstanceReference=} [properties] Properties to set - */ - function InstanceReference(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstanceReference name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @instance - */ - InstanceReference.prototype.name = ""; - - /** - * InstanceReference region. - * @member {string} region - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @instance - */ - InstanceReference.prototype.region = ""; - - /** - * InstanceReference project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @instance - */ - InstanceReference.prototype.project = ""; - - /** - * Creates a new InstanceReference instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @static - * @param {google.cloud.sql.v1beta4.IInstanceReference=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstanceReference} InstanceReference instance - */ - InstanceReference.create = function create(properties) { - return new InstanceReference(properties); - }; - - /** - * Encodes the specified InstanceReference message. Does not implicitly {@link google.cloud.sql.v1beta4.InstanceReference.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @static - * @param {google.cloud.sql.v1beta4.IInstanceReference} message InstanceReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstanceReference.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.region != null && Object.hasOwnProperty.call(message, "region")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.region); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - return writer; - }; - - /** - * Encodes the specified InstanceReference message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstanceReference.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @static - * @param {google.cloud.sql.v1beta4.IInstanceReference} message InstanceReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstanceReference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstanceReference message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstanceReference} InstanceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstanceReference.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstanceReference(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.region = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstanceReference message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstanceReference} InstanceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstanceReference.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstanceReference message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstanceReference.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.region != null && message.hasOwnProperty("region")) - if (!$util.isString(message.region)) - return "region: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates an InstanceReference message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstanceReference} InstanceReference - */ - InstanceReference.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstanceReference) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstanceReference(); - if (object.name != null) - message.name = String(object.name); - if (object.region != null) - message.region = String(object.region); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from an InstanceReference message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @static - * @param {google.cloud.sql.v1beta4.InstanceReference} message InstanceReference - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstanceReference.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.region = ""; - object.project = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.region != null && message.hasOwnProperty("region")) - object.region = message.region; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this InstanceReference to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @instance - * @returns {Object.} JSON object - */ - InstanceReference.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstanceReference - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstanceReference - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstanceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstanceReference"; - }; - - return InstanceReference; - })(); - - v1beta4.DatabaseInstance = (function() { - - /** - * Properties of a DatabaseInstance. - * @memberof google.cloud.sql.v1beta4 - * @interface IDatabaseInstance - * @property {string|null} [kind] DatabaseInstance kind - * @property {google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null} [state] DatabaseInstance state - * @property {google.cloud.sql.v1beta4.SqlDatabaseVersion|null} [databaseVersion] DatabaseInstance databaseVersion - * @property {google.cloud.sql.v1beta4.ISettings|null} [settings] DatabaseInstance settings - * @property {string|null} [etag] DatabaseInstance etag - * @property {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica|null} [failoverReplica] DatabaseInstance failoverReplica - * @property {string|null} [masterInstanceName] DatabaseInstance masterInstanceName - * @property {Array.|null} [replicaNames] DatabaseInstance replicaNames - * @property {google.protobuf.IInt64Value|null} [maxDiskSize] DatabaseInstance maxDiskSize - * @property {google.protobuf.IInt64Value|null} [currentDiskSize] DatabaseInstance currentDiskSize - * @property {Array.|null} [ipAddresses] DatabaseInstance ipAddresses - * @property {google.cloud.sql.v1beta4.ISslCert|null} [serverCaCert] DatabaseInstance serverCaCert - * @property {google.cloud.sql.v1beta4.SqlInstanceType|null} [instanceType] DatabaseInstance instanceType - * @property {string|null} [project] DatabaseInstance project - * @property {string|null} [ipv6Address] DatabaseInstance ipv6Address - * @property {string|null} [serviceAccountEmailAddress] DatabaseInstance serviceAccountEmailAddress - * @property {google.cloud.sql.v1beta4.IOnPremisesConfiguration|null} [onPremisesConfiguration] DatabaseInstance onPremisesConfiguration - * @property {google.cloud.sql.v1beta4.IReplicaConfiguration|null} [replicaConfiguration] DatabaseInstance replicaConfiguration - * @property {google.cloud.sql.v1beta4.SqlBackendType|null} [backendType] DatabaseInstance backendType - * @property {string|null} [selfLink] DatabaseInstance selfLink - * @property {Array.|null} [suspensionReason] DatabaseInstance suspensionReason - * @property {string|null} [connectionName] DatabaseInstance connectionName - * @property {string|null} [name] DatabaseInstance name - * @property {string|null} [region] DatabaseInstance region - * @property {string|null} [gceZone] DatabaseInstance gceZone - * @property {string|null} [secondaryGceZone] DatabaseInstance secondaryGceZone - * @property {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null} [diskEncryptionConfiguration] DatabaseInstance diskEncryptionConfiguration - * @property {google.cloud.sql.v1beta4.IDiskEncryptionStatus|null} [diskEncryptionStatus] DatabaseInstance diskEncryptionStatus - * @property {string|null} [rootPassword] DatabaseInstance rootPassword - * @property {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance|null} [scheduledMaintenance] DatabaseInstance scheduledMaintenance - * @property {google.protobuf.IBoolValue|null} [satisfiesPzs] DatabaseInstance satisfiesPzs - * @property {string|null} [databaseInstalledVersion] DatabaseInstance databaseInstalledVersion - * @property {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport|null} [outOfDiskReport] DatabaseInstance outOfDiskReport - * @property {google.protobuf.ITimestamp|null} [createTime] DatabaseInstance createTime - * @property {Array.|null} [availableMaintenanceVersions] DatabaseInstance availableMaintenanceVersions - * @property {string|null} [maintenanceVersion] DatabaseInstance maintenanceVersion - * @property {Array.|null} [upgradableDatabaseVersions] DatabaseInstance upgradableDatabaseVersions - * @property {google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|null} [sqlNetworkArchitecture] DatabaseInstance sqlNetworkArchitecture - * @property {string|null} [pscServiceAttachmentLink] DatabaseInstance pscServiceAttachmentLink - * @property {string|null} [dnsName] DatabaseInstance dnsName - * @property {string|null} [primaryDnsName] DatabaseInstance primaryDnsName - * @property {string|null} [writeEndpoint] DatabaseInstance writeEndpoint - * @property {google.cloud.sql.v1beta4.IReplicationCluster|null} [replicationCluster] DatabaseInstance replicationCluster - * @property {google.cloud.sql.v1beta4.IGeminiInstanceConfig|null} [geminiConfig] DatabaseInstance geminiConfig - * @property {google.protobuf.IBoolValue|null} [satisfiesPzi] DatabaseInstance satisfiesPzi - * @property {google.protobuf.IBoolValue|null} [switchTransactionLogsToCloudStorageEnabled] DatabaseInstance switchTransactionLogsToCloudStorageEnabled - * @property {google.protobuf.IBoolValue|null} [includeReplicasForMajorVersionUpgrade] DatabaseInstance includeReplicasForMajorVersionUpgrade - * @property {Object.|null} [tags] DatabaseInstance tags - * @property {number|null} [nodeCount] DatabaseInstance nodeCount - * @property {Array.|null} [nodes] DatabaseInstance nodes - * @property {Array.|null} [dnsNames] DatabaseInstance dnsNames - */ - - /** - * Constructs a new DatabaseInstance. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DatabaseInstance. - * @implements IDatabaseInstance - * @constructor - * @param {google.cloud.sql.v1beta4.IDatabaseInstance=} [properties] Properties to set - */ - function DatabaseInstance(properties) { - this.replicaNames = []; - this.ipAddresses = []; - this.suspensionReason = []; - this.availableMaintenanceVersions = []; - this.upgradableDatabaseVersions = []; - this.tags = {}; - this.nodes = []; - this.dnsNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DatabaseInstance kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.kind = ""; - - /** - * DatabaseInstance state. - * @member {google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState} state - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.state = 0; - - /** - * DatabaseInstance databaseVersion. - * @member {google.cloud.sql.v1beta4.SqlDatabaseVersion} databaseVersion - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.databaseVersion = 0; - - /** - * DatabaseInstance settings. - * @member {google.cloud.sql.v1beta4.ISettings|null|undefined} settings - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.settings = null; - - /** - * DatabaseInstance etag. - * @member {string} etag - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.etag = ""; - - /** - * DatabaseInstance failoverReplica. - * @member {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica|null|undefined} failoverReplica - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.failoverReplica = null; - - /** - * DatabaseInstance masterInstanceName. - * @member {string} masterInstanceName - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.masterInstanceName = ""; - - /** - * DatabaseInstance replicaNames. - * @member {Array.} replicaNames - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.replicaNames = $util.emptyArray; - - /** - * DatabaseInstance maxDiskSize. - * @member {google.protobuf.IInt64Value|null|undefined} maxDiskSize - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.maxDiskSize = null; - - /** - * DatabaseInstance currentDiskSize. - * @member {google.protobuf.IInt64Value|null|undefined} currentDiskSize - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.currentDiskSize = null; - - /** - * DatabaseInstance ipAddresses. - * @member {Array.} ipAddresses - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.ipAddresses = $util.emptyArray; - - /** - * DatabaseInstance serverCaCert. - * @member {google.cloud.sql.v1beta4.ISslCert|null|undefined} serverCaCert - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.serverCaCert = null; - - /** - * DatabaseInstance instanceType. - * @member {google.cloud.sql.v1beta4.SqlInstanceType} instanceType - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.instanceType = 0; - - /** - * DatabaseInstance project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.project = ""; - - /** - * DatabaseInstance ipv6Address. - * @member {string} ipv6Address - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.ipv6Address = ""; - - /** - * DatabaseInstance serviceAccountEmailAddress. - * @member {string} serviceAccountEmailAddress - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.serviceAccountEmailAddress = ""; - - /** - * DatabaseInstance onPremisesConfiguration. - * @member {google.cloud.sql.v1beta4.IOnPremisesConfiguration|null|undefined} onPremisesConfiguration - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.onPremisesConfiguration = null; - - /** - * DatabaseInstance replicaConfiguration. - * @member {google.cloud.sql.v1beta4.IReplicaConfiguration|null|undefined} replicaConfiguration - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.replicaConfiguration = null; - - /** - * DatabaseInstance backendType. - * @member {google.cloud.sql.v1beta4.SqlBackendType} backendType - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.backendType = 0; - - /** - * DatabaseInstance selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.selfLink = ""; - - /** - * DatabaseInstance suspensionReason. - * @member {Array.} suspensionReason - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.suspensionReason = $util.emptyArray; - - /** - * DatabaseInstance connectionName. - * @member {string} connectionName - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.connectionName = ""; - - /** - * DatabaseInstance name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.name = ""; - - /** - * DatabaseInstance region. - * @member {string} region - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.region = ""; - - /** - * DatabaseInstance gceZone. - * @member {string} gceZone - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.gceZone = ""; - - /** - * DatabaseInstance secondaryGceZone. - * @member {string} secondaryGceZone - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.secondaryGceZone = ""; - - /** - * DatabaseInstance diskEncryptionConfiguration. - * @member {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration|null|undefined} diskEncryptionConfiguration - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.diskEncryptionConfiguration = null; - - /** - * DatabaseInstance diskEncryptionStatus. - * @member {google.cloud.sql.v1beta4.IDiskEncryptionStatus|null|undefined} diskEncryptionStatus - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.diskEncryptionStatus = null; - - /** - * DatabaseInstance rootPassword. - * @member {string} rootPassword - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.rootPassword = ""; - - /** - * DatabaseInstance scheduledMaintenance. - * @member {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance|null|undefined} scheduledMaintenance - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.scheduledMaintenance = null; - - /** - * DatabaseInstance satisfiesPzs. - * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzs - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.satisfiesPzs = null; - - /** - * DatabaseInstance databaseInstalledVersion. - * @member {string} databaseInstalledVersion - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.databaseInstalledVersion = ""; - - /** - * DatabaseInstance outOfDiskReport. - * @member {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport|null|undefined} outOfDiskReport - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.outOfDiskReport = null; - - /** - * DatabaseInstance createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.createTime = null; - - /** - * DatabaseInstance availableMaintenanceVersions. - * @member {Array.} availableMaintenanceVersions - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.availableMaintenanceVersions = $util.emptyArray; - - /** - * DatabaseInstance maintenanceVersion. - * @member {string} maintenanceVersion - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.maintenanceVersion = ""; - - /** - * DatabaseInstance upgradableDatabaseVersions. - * @member {Array.} upgradableDatabaseVersions - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.upgradableDatabaseVersions = $util.emptyArray; - - /** - * DatabaseInstance sqlNetworkArchitecture. - * @member {google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture|null|undefined} sqlNetworkArchitecture - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.sqlNetworkArchitecture = null; - - /** - * DatabaseInstance pscServiceAttachmentLink. - * @member {string|null|undefined} pscServiceAttachmentLink - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.pscServiceAttachmentLink = null; - - /** - * DatabaseInstance dnsName. - * @member {string|null|undefined} dnsName - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.dnsName = null; - - /** - * DatabaseInstance primaryDnsName. - * @member {string|null|undefined} primaryDnsName - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.primaryDnsName = null; - - /** - * DatabaseInstance writeEndpoint. - * @member {string|null|undefined} writeEndpoint - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.writeEndpoint = null; - - /** - * DatabaseInstance replicationCluster. - * @member {google.cloud.sql.v1beta4.IReplicationCluster|null|undefined} replicationCluster - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.replicationCluster = null; - - /** - * DatabaseInstance geminiConfig. - * @member {google.cloud.sql.v1beta4.IGeminiInstanceConfig|null|undefined} geminiConfig - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.geminiConfig = null; - - /** - * DatabaseInstance satisfiesPzi. - * @member {google.protobuf.IBoolValue|null|undefined} satisfiesPzi - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.satisfiesPzi = null; - - /** - * DatabaseInstance switchTransactionLogsToCloudStorageEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} switchTransactionLogsToCloudStorageEnabled - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.switchTransactionLogsToCloudStorageEnabled = null; - - /** - * DatabaseInstance includeReplicasForMajorVersionUpgrade. - * @member {google.protobuf.IBoolValue|null|undefined} includeReplicasForMajorVersionUpgrade - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.includeReplicasForMajorVersionUpgrade = null; - - /** - * DatabaseInstance tags. - * @member {Object.} tags - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.tags = $util.emptyObject; - - /** - * DatabaseInstance nodeCount. - * @member {number|null|undefined} nodeCount - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.nodeCount = null; - - /** - * DatabaseInstance nodes. - * @member {Array.} nodes - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.nodes = $util.emptyArray; - - /** - * DatabaseInstance dnsNames. - * @member {Array.} dnsNames - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - */ - DatabaseInstance.prototype.dnsNames = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_outOfDiskReport", { - get: $util.oneOfGetter($oneOfFields = ["outOfDiskReport"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_sqlNetworkArchitecture", { - get: $util.oneOfGetter($oneOfFields = ["sqlNetworkArchitecture"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_pscServiceAttachmentLink", { - get: $util.oneOfGetter($oneOfFields = ["pscServiceAttachmentLink"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_dnsName", { - get: $util.oneOfGetter($oneOfFields = ["dnsName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_primaryDnsName", { - get: $util.oneOfGetter($oneOfFields = ["primaryDnsName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_writeEndpoint", { - get: $util.oneOfGetter($oneOfFields = ["writeEndpoint"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_replicationCluster", { - get: $util.oneOfGetter($oneOfFields = ["replicationCluster"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_geminiConfig", { - get: $util.oneOfGetter($oneOfFields = ["geminiConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_switchTransactionLogsToCloudStorageEnabled", { - get: $util.oneOfGetter($oneOfFields = ["switchTransactionLogsToCloudStorageEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_includeReplicasForMajorVersionUpgrade", { - get: $util.oneOfGetter($oneOfFields = ["includeReplicasForMajorVersionUpgrade"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(DatabaseInstance.prototype, "_nodeCount", { - get: $util.oneOfGetter($oneOfFields = ["nodeCount"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new DatabaseInstance instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @static - * @param {google.cloud.sql.v1beta4.IDatabaseInstance=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DatabaseInstance} DatabaseInstance instance - */ - DatabaseInstance.create = function create(properties) { - return new DatabaseInstance(properties); - }; - - /** - * Encodes the specified DatabaseInstance message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @static - * @param {google.cloud.sql.v1beta4.IDatabaseInstance} message DatabaseInstance message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabaseInstance.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.state); - if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.databaseVersion); - if (message.settings != null && Object.hasOwnProperty.call(message, "settings")) - $root.google.cloud.sql.v1beta4.Settings.encode(message.settings, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.etag); - if (message.failoverReplica != null && Object.hasOwnProperty.call(message, "failoverReplica")) - $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.encode(message.failoverReplica, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.masterInstanceName != null && Object.hasOwnProperty.call(message, "masterInstanceName")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.masterInstanceName); - if (message.replicaNames != null && message.replicaNames.length) - for (var i = 0; i < message.replicaNames.length; ++i) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.replicaNames[i]); - if (message.maxDiskSize != null && Object.hasOwnProperty.call(message, "maxDiskSize")) - $root.google.protobuf.Int64Value.encode(message.maxDiskSize, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.currentDiskSize != null && Object.hasOwnProperty.call(message, "currentDiskSize")) - $root.google.protobuf.Int64Value.encode(message.currentDiskSize, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.ipAddresses != null && message.ipAddresses.length) - for (var i = 0; i < message.ipAddresses.length; ++i) - $root.google.cloud.sql.v1beta4.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) - $root.google.cloud.sql.v1beta4.SslCert.encode(message.serverCaCert, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.instanceType != null && Object.hasOwnProperty.call(message, "instanceType")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.instanceType); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.project); - if (message.ipv6Address != null && Object.hasOwnProperty.call(message, "ipv6Address")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.ipv6Address); - if (message.serviceAccountEmailAddress != null && Object.hasOwnProperty.call(message, "serviceAccountEmailAddress")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.serviceAccountEmailAddress); - if (message.onPremisesConfiguration != null && Object.hasOwnProperty.call(message, "onPremisesConfiguration")) - $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.encode(message.onPremisesConfiguration, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.replicaConfiguration != null && Object.hasOwnProperty.call(message, "replicaConfiguration")) - $root.google.cloud.sql.v1beta4.ReplicaConfiguration.encode(message.replicaConfiguration, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - if (message.backendType != null && Object.hasOwnProperty.call(message, "backendType")) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.backendType); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 20, wireType 2 =*/162).string(message.selfLink); - if (message.suspensionReason != null && message.suspensionReason.length) { - writer.uint32(/* id 21, wireType 2 =*/170).fork(); - for (var i = 0; i < message.suspensionReason.length; ++i) - writer.int32(message.suspensionReason[i]); - writer.ldelim(); - } - if (message.connectionName != null && Object.hasOwnProperty.call(message, "connectionName")) - writer.uint32(/* id 22, wireType 2 =*/178).string(message.connectionName); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.name); - if (message.region != null && Object.hasOwnProperty.call(message, "region")) - writer.uint32(/* id 24, wireType 2 =*/194).string(message.region); - if (message.gceZone != null && Object.hasOwnProperty.call(message, "gceZone")) - writer.uint32(/* id 25, wireType 2 =*/202).string(message.gceZone); - if (message.diskEncryptionConfiguration != null && Object.hasOwnProperty.call(message, "diskEncryptionConfiguration")) - $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.encode(message.diskEncryptionConfiguration, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); - if (message.diskEncryptionStatus != null && Object.hasOwnProperty.call(message, "diskEncryptionStatus")) - $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.encode(message.diskEncryptionStatus, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); - if (message.rootPassword != null && Object.hasOwnProperty.call(message, "rootPassword")) - writer.uint32(/* id 29, wireType 2 =*/234).string(message.rootPassword); - if (message.scheduledMaintenance != null && Object.hasOwnProperty.call(message, "scheduledMaintenance")) - $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.encode(message.scheduledMaintenance, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim(); - if (message.secondaryGceZone != null && Object.hasOwnProperty.call(message, "secondaryGceZone")) - writer.uint32(/* id 34, wireType 2 =*/274).string(message.secondaryGceZone); - if (message.satisfiesPzs != null && Object.hasOwnProperty.call(message, "satisfiesPzs")) - $root.google.protobuf.BoolValue.encode(message.satisfiesPzs, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); - if (message.outOfDiskReport != null && Object.hasOwnProperty.call(message, "outOfDiskReport")) - $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.encode(message.outOfDiskReport, writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim(); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); - if (message.databaseInstalledVersion != null && Object.hasOwnProperty.call(message, "databaseInstalledVersion")) - writer.uint32(/* id 40, wireType 2 =*/322).string(message.databaseInstalledVersion); - if (message.availableMaintenanceVersions != null && message.availableMaintenanceVersions.length) - for (var i = 0; i < message.availableMaintenanceVersions.length; ++i) - writer.uint32(/* id 41, wireType 2 =*/330).string(message.availableMaintenanceVersions[i]); - if (message.maintenanceVersion != null && Object.hasOwnProperty.call(message, "maintenanceVersion")) - writer.uint32(/* id 42, wireType 2 =*/338).string(message.maintenanceVersion); - if (message.upgradableDatabaseVersions != null && message.upgradableDatabaseVersions.length) - for (var i = 0; i < message.upgradableDatabaseVersions.length; ++i) - $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion.encode(message.upgradableDatabaseVersions[i], writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); - if (message.sqlNetworkArchitecture != null && Object.hasOwnProperty.call(message, "sqlNetworkArchitecture")) - writer.uint32(/* id 47, wireType 0 =*/376).int32(message.sqlNetworkArchitecture); - if (message.pscServiceAttachmentLink != null && Object.hasOwnProperty.call(message, "pscServiceAttachmentLink")) - writer.uint32(/* id 48, wireType 2 =*/386).string(message.pscServiceAttachmentLink); - if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) - writer.uint32(/* id 49, wireType 2 =*/394).string(message.dnsName); - if (message.primaryDnsName != null && Object.hasOwnProperty.call(message, "primaryDnsName")) - writer.uint32(/* id 51, wireType 2 =*/410).string(message.primaryDnsName); - if (message.writeEndpoint != null && Object.hasOwnProperty.call(message, "writeEndpoint")) - writer.uint32(/* id 52, wireType 2 =*/418).string(message.writeEndpoint); - if (message.replicationCluster != null && Object.hasOwnProperty.call(message, "replicationCluster")) - $root.google.cloud.sql.v1beta4.ReplicationCluster.encode(message.replicationCluster, writer.uint32(/* id 54, wireType 2 =*/434).fork()).ldelim(); - if (message.geminiConfig != null && Object.hasOwnProperty.call(message, "geminiConfig")) - $root.google.cloud.sql.v1beta4.GeminiInstanceConfig.encode(message.geminiConfig, writer.uint32(/* id 55, wireType 2 =*/442).fork()).ldelim(); - if (message.satisfiesPzi != null && Object.hasOwnProperty.call(message, "satisfiesPzi")) - $root.google.protobuf.BoolValue.encode(message.satisfiesPzi, writer.uint32(/* id 56, wireType 2 =*/450).fork()).ldelim(); - if (message.switchTransactionLogsToCloudStorageEnabled != null && Object.hasOwnProperty.call(message, "switchTransactionLogsToCloudStorageEnabled")) - $root.google.protobuf.BoolValue.encode(message.switchTransactionLogsToCloudStorageEnabled, writer.uint32(/* id 57, wireType 2 =*/458).fork()).ldelim(); - if (message.includeReplicasForMajorVersionUpgrade != null && Object.hasOwnProperty.call(message, "includeReplicasForMajorVersionUpgrade")) - $root.google.protobuf.BoolValue.encode(message.includeReplicasForMajorVersionUpgrade, writer.uint32(/* id 59, wireType 2 =*/474).fork()).ldelim(); - if (message.tags != null && Object.hasOwnProperty.call(message, "tags")) - for (var keys = Object.keys(message.tags), i = 0; i < keys.length; ++i) - writer.uint32(/* id 60, wireType 2 =*/482).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.tags[keys[i]]).ldelim(); - if (message.nodeCount != null && Object.hasOwnProperty.call(message, "nodeCount")) - writer.uint32(/* id 63, wireType 0 =*/504).int32(message.nodeCount); - if (message.nodes != null && message.nodes.length) - for (var i = 0; i < message.nodes.length; ++i) - $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.encode(message.nodes[i], writer.uint32(/* id 64, wireType 2 =*/514).fork()).ldelim(); - if (message.dnsNames != null && message.dnsNames.length) - for (var i = 0; i < message.dnsNames.length; ++i) - $root.google.cloud.sql.v1beta4.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 67, wireType 2 =*/538).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DatabaseInstance message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @static - * @param {google.cloud.sql.v1beta4.IDatabaseInstance} message DatabaseInstance message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabaseInstance.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DatabaseInstance message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DatabaseInstance} DatabaseInstance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabaseInstance.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseInstance(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.state = reader.int32(); - break; - } - case 3: { - message.databaseVersion = reader.int32(); - break; - } - case 4: { - message.settings = $root.google.cloud.sql.v1beta4.Settings.decode(reader, reader.uint32()); - break; - } - case 5: { - message.etag = reader.string(); - break; - } - case 6: { - message.failoverReplica = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.decode(reader, reader.uint32()); - break; - } - case 7: { - message.masterInstanceName = reader.string(); - break; - } - case 8: { - if (!(message.replicaNames && message.replicaNames.length)) - message.replicaNames = []; - message.replicaNames.push(reader.string()); - break; - } - case 9: { - message.maxDiskSize = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 10: { - message.currentDiskSize = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 11: { - if (!(message.ipAddresses && message.ipAddresses.length)) - message.ipAddresses = []; - message.ipAddresses.push($root.google.cloud.sql.v1beta4.IpMapping.decode(reader, reader.uint32())); - break; - } - case 12: { - message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32()); - break; - } - case 13: { - message.instanceType = reader.int32(); - break; - } - case 14: { - message.project = reader.string(); - break; - } - case 15: { - message.ipv6Address = reader.string(); - break; - } - case 16: { - message.serviceAccountEmailAddress = reader.string(); - break; - } - case 17: { - message.onPremisesConfiguration = $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.decode(reader, reader.uint32()); - break; - } - case 18: { - message.replicaConfiguration = $root.google.cloud.sql.v1beta4.ReplicaConfiguration.decode(reader, reader.uint32()); - break; - } - case 19: { - message.backendType = reader.int32(); - break; - } - case 20: { - message.selfLink = reader.string(); - break; - } - case 21: { - if (!(message.suspensionReason && message.suspensionReason.length)) - message.suspensionReason = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.suspensionReason.push(reader.int32()); - } else - message.suspensionReason.push(reader.int32()); - break; - } - case 22: { - message.connectionName = reader.string(); - break; - } - case 23: { - message.name = reader.string(); - break; - } - case 24: { - message.region = reader.string(); - break; - } - case 25: { - message.gceZone = reader.string(); - break; - } - case 34: { - message.secondaryGceZone = reader.string(); - break; - } - case 26: { - message.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.decode(reader, reader.uint32()); - break; - } - case 27: { - message.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.decode(reader, reader.uint32()); - break; - } - case 29: { - message.rootPassword = reader.string(); - break; - } - case 30: { - message.scheduledMaintenance = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.decode(reader, reader.uint32()); - break; - } - case 35: { - message.satisfiesPzs = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 40: { - message.databaseInstalledVersion = reader.string(); - break; - } - case 38: { - message.outOfDiskReport = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.decode(reader, reader.uint32()); - break; - } - case 39: { - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 41: { - if (!(message.availableMaintenanceVersions && message.availableMaintenanceVersions.length)) - message.availableMaintenanceVersions = []; - message.availableMaintenanceVersions.push(reader.string()); - break; - } - case 42: { - message.maintenanceVersion = reader.string(); - break; - } - case 45: { - if (!(message.upgradableDatabaseVersions && message.upgradableDatabaseVersions.length)) - message.upgradableDatabaseVersions = []; - message.upgradableDatabaseVersions.push($root.google.cloud.sql.v1beta4.AvailableDatabaseVersion.decode(reader, reader.uint32())); - break; - } - case 47: { - message.sqlNetworkArchitecture = reader.int32(); - break; - } - case 48: { - message.pscServiceAttachmentLink = reader.string(); - break; - } - case 49: { - message.dnsName = reader.string(); - break; - } - case 51: { - message.primaryDnsName = reader.string(); - break; - } - case 52: { - message.writeEndpoint = reader.string(); - break; - } - case 54: { - message.replicationCluster = $root.google.cloud.sql.v1beta4.ReplicationCluster.decode(reader, reader.uint32()); - break; - } - case 55: { - message.geminiConfig = $root.google.cloud.sql.v1beta4.GeminiInstanceConfig.decode(reader, reader.uint32()); - break; - } - case 56: { - message.satisfiesPzi = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 57: { - message.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 59: { - message.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 60: { - if (message.tags === $util.emptyObject) - message.tags = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.tags[key] = value; - break; - } - case 63: { - message.nodeCount = reader.int32(); - break; - } - case 64: { - if (!(message.nodes && message.nodes.length)) - message.nodes = []; - message.nodes.push($root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.decode(reader, reader.uint32())); - break; - } - case 67: { - if (!(message.dnsNames && message.dnsNames.length)) - message.dnsNames = []; - message.dnsNames.push($root.google.cloud.sql.v1beta4.DnsNameMapping.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DatabaseInstance message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DatabaseInstance} DatabaseInstance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabaseInstance.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DatabaseInstance message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DatabaseInstance.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.state != null && message.hasOwnProperty("state")) - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - break; - } - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - switch (message.databaseVersion) { - default: - return "databaseVersion: enum value expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - break; - } - if (message.settings != null && message.hasOwnProperty("settings")) { - var error = $root.google.cloud.sql.v1beta4.Settings.verify(message.settings); - if (error) - return "settings." + error; - } - if (message.etag != null && message.hasOwnProperty("etag")) - if (!$util.isString(message.etag)) - return "etag: string expected"; - if (message.failoverReplica != null && message.hasOwnProperty("failoverReplica")) { - var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.verify(message.failoverReplica); - if (error) - return "failoverReplica." + error; - } - if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) - if (!$util.isString(message.masterInstanceName)) - return "masterInstanceName: string expected"; - if (message.replicaNames != null && message.hasOwnProperty("replicaNames")) { - if (!Array.isArray(message.replicaNames)) - return "replicaNames: array expected"; - for (var i = 0; i < message.replicaNames.length; ++i) - if (!$util.isString(message.replicaNames[i])) - return "replicaNames: string[] expected"; - } - if (message.maxDiskSize != null && message.hasOwnProperty("maxDiskSize")) { - var error = $root.google.protobuf.Int64Value.verify(message.maxDiskSize); - if (error) - return "maxDiskSize." + error; - } - if (message.currentDiskSize != null && message.hasOwnProperty("currentDiskSize")) { - var error = $root.google.protobuf.Int64Value.verify(message.currentDiskSize); - if (error) - return "currentDiskSize." + error; - } - if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { - if (!Array.isArray(message.ipAddresses)) - return "ipAddresses: array expected"; - for (var i = 0; i < message.ipAddresses.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.IpMapping.verify(message.ipAddresses[i]); - if (error) - return "ipAddresses." + error; - } - } - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { - var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.serverCaCert); - if (error) - return "serverCaCert." + error; - } - if (message.instanceType != null && message.hasOwnProperty("instanceType")) - switch (message.instanceType) { - default: - return "instanceType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 5: - break; - } - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.ipv6Address != null && message.hasOwnProperty("ipv6Address")) - if (!$util.isString(message.ipv6Address)) - return "ipv6Address: string expected"; - if (message.serviceAccountEmailAddress != null && message.hasOwnProperty("serviceAccountEmailAddress")) - if (!$util.isString(message.serviceAccountEmailAddress)) - return "serviceAccountEmailAddress: string expected"; - if (message.onPremisesConfiguration != null && message.hasOwnProperty("onPremisesConfiguration")) { - var error = $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.verify(message.onPremisesConfiguration); - if (error) - return "onPremisesConfiguration." + error; - } - if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) { - var error = $root.google.cloud.sql.v1beta4.ReplicaConfiguration.verify(message.replicaConfiguration); - if (error) - return "replicaConfiguration." + error; - } - if (message.backendType != null && message.hasOwnProperty("backendType")) - switch (message.backendType) { - default: - return "backendType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.suspensionReason != null && message.hasOwnProperty("suspensionReason")) { - if (!Array.isArray(message.suspensionReason)) - return "suspensionReason: array expected"; - for (var i = 0; i < message.suspensionReason.length; ++i) - switch (message.suspensionReason[i]) { - default: - return "suspensionReason: enum value[] expected"; - case 0: - case 2: - case 3: - case 4: - case 5: - break; - } - } - if (message.connectionName != null && message.hasOwnProperty("connectionName")) - if (!$util.isString(message.connectionName)) - return "connectionName: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.region != null && message.hasOwnProperty("region")) - if (!$util.isString(message.region)) - return "region: string expected"; - if (message.gceZone != null && message.hasOwnProperty("gceZone")) - if (!$util.isString(message.gceZone)) - return "gceZone: string expected"; - if (message.secondaryGceZone != null && message.hasOwnProperty("secondaryGceZone")) - if (!$util.isString(message.secondaryGceZone)) - return "secondaryGceZone: string expected"; - if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) { - var error = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify(message.diskEncryptionConfiguration); - if (error) - return "diskEncryptionConfiguration." + error; - } - if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) { - var error = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.verify(message.diskEncryptionStatus); - if (error) - return "diskEncryptionStatus." + error; - } - if (message.rootPassword != null && message.hasOwnProperty("rootPassword")) - if (!$util.isString(message.rootPassword)) - return "rootPassword: string expected"; - if (message.scheduledMaintenance != null && message.hasOwnProperty("scheduledMaintenance")) { - var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.verify(message.scheduledMaintenance); - if (error) - return "scheduledMaintenance." + error; - } - if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) { - var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzs); - if (error) - return "satisfiesPzs." + error; - } - if (message.databaseInstalledVersion != null && message.hasOwnProperty("databaseInstalledVersion")) - if (!$util.isString(message.databaseInstalledVersion)) - return "databaseInstalledVersion: string expected"; - if (message.outOfDiskReport != null && message.hasOwnProperty("outOfDiskReport")) { - properties._outOfDiskReport = 1; - { - var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.verify(message.outOfDiskReport); - if (error) - return "outOfDiskReport." + error; - } - } - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.availableMaintenanceVersions != null && message.hasOwnProperty("availableMaintenanceVersions")) { - if (!Array.isArray(message.availableMaintenanceVersions)) - return "availableMaintenanceVersions: array expected"; - for (var i = 0; i < message.availableMaintenanceVersions.length; ++i) - if (!$util.isString(message.availableMaintenanceVersions[i])) - return "availableMaintenanceVersions: string[] expected"; - } - if (message.maintenanceVersion != null && message.hasOwnProperty("maintenanceVersion")) - if (!$util.isString(message.maintenanceVersion)) - return "maintenanceVersion: string expected"; - if (message.upgradableDatabaseVersions != null && message.hasOwnProperty("upgradableDatabaseVersions")) { - if (!Array.isArray(message.upgradableDatabaseVersions)) - return "upgradableDatabaseVersions: array expected"; - for (var i = 0; i < message.upgradableDatabaseVersions.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion.verify(message.upgradableDatabaseVersions[i]); - if (error) - return "upgradableDatabaseVersions." + error; - } - } - if (message.sqlNetworkArchitecture != null && message.hasOwnProperty("sqlNetworkArchitecture")) { - properties._sqlNetworkArchitecture = 1; - switch (message.sqlNetworkArchitecture) { - default: - return "sqlNetworkArchitecture: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { - properties._pscServiceAttachmentLink = 1; - if (!$util.isString(message.pscServiceAttachmentLink)) - return "pscServiceAttachmentLink: string expected"; - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - properties._dnsName = 1; - if (!$util.isString(message.dnsName)) - return "dnsName: string expected"; - } - if (message.primaryDnsName != null && message.hasOwnProperty("primaryDnsName")) { - properties._primaryDnsName = 1; - if (!$util.isString(message.primaryDnsName)) - return "primaryDnsName: string expected"; - } - if (message.writeEndpoint != null && message.hasOwnProperty("writeEndpoint")) { - properties._writeEndpoint = 1; - if (!$util.isString(message.writeEndpoint)) - return "writeEndpoint: string expected"; - } - if (message.replicationCluster != null && message.hasOwnProperty("replicationCluster")) { - properties._replicationCluster = 1; - { - var error = $root.google.cloud.sql.v1beta4.ReplicationCluster.verify(message.replicationCluster); - if (error) - return "replicationCluster." + error; - } - } - if (message.geminiConfig != null && message.hasOwnProperty("geminiConfig")) { - properties._geminiConfig = 1; - { - var error = $root.google.cloud.sql.v1beta4.GeminiInstanceConfig.verify(message.geminiConfig); - if (error) - return "geminiConfig." + error; - } - } - if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) { - var error = $root.google.protobuf.BoolValue.verify(message.satisfiesPzi); - if (error) - return "satisfiesPzi." + error; - } - if (message.switchTransactionLogsToCloudStorageEnabled != null && message.hasOwnProperty("switchTransactionLogsToCloudStorageEnabled")) { - properties._switchTransactionLogsToCloudStorageEnabled = 1; - { - var error = $root.google.protobuf.BoolValue.verify(message.switchTransactionLogsToCloudStorageEnabled); - if (error) - return "switchTransactionLogsToCloudStorageEnabled." + error; - } - } - if (message.includeReplicasForMajorVersionUpgrade != null && message.hasOwnProperty("includeReplicasForMajorVersionUpgrade")) { - properties._includeReplicasForMajorVersionUpgrade = 1; - { - var error = $root.google.protobuf.BoolValue.verify(message.includeReplicasForMajorVersionUpgrade); - if (error) - return "includeReplicasForMajorVersionUpgrade." + error; - } - } - if (message.tags != null && message.hasOwnProperty("tags")) { - if (!$util.isObject(message.tags)) - return "tags: object expected"; - var key = Object.keys(message.tags); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.tags[key[i]])) - return "tags: string{k:string} expected"; - } - if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { - properties._nodeCount = 1; - if (!$util.isInteger(message.nodeCount)) - return "nodeCount: integer expected"; - } - if (message.nodes != null && message.hasOwnProperty("nodes")) { - if (!Array.isArray(message.nodes)) - return "nodes: array expected"; - for (var i = 0; i < message.nodes.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.verify(message.nodes[i]); - if (error) - return "nodes." + error; - } - } - if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { - if (!Array.isArray(message.dnsNames)) - return "dnsNames: array expected"; - for (var i = 0; i < message.dnsNames.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.DnsNameMapping.verify(message.dnsNames[i]); - if (error) - return "dnsNames." + error; - } - } - return null; - }; - - /** - * Creates a DatabaseInstance message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DatabaseInstance} DatabaseInstance - */ - DatabaseInstance.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseInstance) - return object; - var message = new $root.google.cloud.sql.v1beta4.DatabaseInstance(); - if (object.kind != null) - message.kind = String(object.kind); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "SQL_INSTANCE_STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNABLE": - case 1: - message.state = 1; - break; - case "SUSPENDED": - case 2: - message.state = 2; - break; - case "PENDING_DELETE": - case 3: - message.state = 3; - break; - case "PENDING_CREATE": - case 4: - message.state = 4; - break; - case "MAINTENANCE": - case 5: - message.state = 5; - break; - case "FAILED": - case 6: - message.state = 6; - break; - case "ONLINE_MAINTENANCE": - case 7: - message.state = 7; - break; - case "REPAIRING": - case 8: - message.state = 8; - break; - } - switch (object.databaseVersion) { - default: - if (typeof object.databaseVersion === "number") { - message.databaseVersion = object.databaseVersion; - break; - } - break; - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.databaseVersion = 0; - break; - case "MYSQL_5_1": - case 2: - message.databaseVersion = 2; - break; - case "MYSQL_5_5": - case 3: - message.databaseVersion = 3; - break; - case "MYSQL_5_6": - case 5: - message.databaseVersion = 5; - break; - case "MYSQL_5_7": - case 6: - message.databaseVersion = 6; - break; - case "MYSQL_8_0": - case 20: - message.databaseVersion = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.databaseVersion = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.databaseVersion = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.databaseVersion = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.databaseVersion = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.databaseVersion = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.databaseVersion = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.databaseVersion = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.databaseVersion = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.databaseVersion = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.databaseVersion = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.databaseVersion = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.databaseVersion = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.databaseVersion = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.databaseVersion = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.databaseVersion = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.databaseVersion = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.databaseVersion = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.databaseVersion = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.databaseVersion = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.databaseVersion = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.databaseVersion = 556; - break; - case "MYSQL_8_4": - case 398: - message.databaseVersion = 398; - break; - case "MYSQL_9_7": - case 654: - message.databaseVersion = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.databaseVersion = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.databaseVersion = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.databaseVersion = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.databaseVersion = 16; - break; - case "POSTGRES_9_6": - case 9: - message.databaseVersion = 9; - break; - case "POSTGRES_10": - case 18: - message.databaseVersion = 18; - break; - case "POSTGRES_11": - case 10: - message.databaseVersion = 10; - break; - case "POSTGRES_12": - case 19: - message.databaseVersion = 19; - break; - case "POSTGRES_13": - case 23: - message.databaseVersion = 23; - break; - case "POSTGRES_14": - case 110: - message.databaseVersion = 110; - break; - case "POSTGRES_15": - case 172: - message.databaseVersion = 172; - break; - case "POSTGRES_16": - case 272: - message.databaseVersion = 272; - break; - case "POSTGRES_17": - case 408: - message.databaseVersion = 408; - break; - case "POSTGRES_18": - case 557: - message.databaseVersion = 557; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.databaseVersion = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.databaseVersion = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.databaseVersion = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.databaseVersion = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.databaseVersion = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.databaseVersion = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.databaseVersion = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.databaseVersion = 202; - break; - } - if (object.settings != null) { - if (typeof object.settings !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.settings: object expected"); - message.settings = $root.google.cloud.sql.v1beta4.Settings.fromObject(object.settings); - } - if (object.etag != null) - message.etag = String(object.etag); - if (object.failoverReplica != null) { - if (typeof object.failoverReplica !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.failoverReplica: object expected"); - message.failoverReplica = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.fromObject(object.failoverReplica); - } - if (object.masterInstanceName != null) - message.masterInstanceName = String(object.masterInstanceName); - if (object.replicaNames) { - if (!Array.isArray(object.replicaNames)) - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.replicaNames: array expected"); - message.replicaNames = []; - for (var i = 0; i < object.replicaNames.length; ++i) - message.replicaNames[i] = String(object.replicaNames[i]); - } - if (object.maxDiskSize != null) { - if (typeof object.maxDiskSize !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.maxDiskSize: object expected"); - message.maxDiskSize = $root.google.protobuf.Int64Value.fromObject(object.maxDiskSize); - } - if (object.currentDiskSize != null) { - if (typeof object.currentDiskSize !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.currentDiskSize: object expected"); - message.currentDiskSize = $root.google.protobuf.Int64Value.fromObject(object.currentDiskSize); - } - if (object.ipAddresses) { - if (!Array.isArray(object.ipAddresses)) - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.ipAddresses: array expected"); - message.ipAddresses = []; - for (var i = 0; i < object.ipAddresses.length; ++i) { - if (typeof object.ipAddresses[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.ipAddresses: object expected"); - message.ipAddresses[i] = $root.google.cloud.sql.v1beta4.IpMapping.fromObject(object.ipAddresses[i]); - } - } - if (object.serverCaCert != null) { - if (typeof object.serverCaCert !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.serverCaCert: object expected"); - message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.serverCaCert); - } - switch (object.instanceType) { - default: - if (typeof object.instanceType === "number") { - message.instanceType = object.instanceType; - break; - } - break; - case "SQL_INSTANCE_TYPE_UNSPECIFIED": - case 0: - message.instanceType = 0; - break; - case "CLOUD_SQL_INSTANCE": - case 1: - message.instanceType = 1; - break; - case "ON_PREMISES_INSTANCE": - case 2: - message.instanceType = 2; - break; - case "READ_REPLICA_INSTANCE": - case 3: - message.instanceType = 3; - break; - case "READ_POOL_INSTANCE": - case 5: - message.instanceType = 5; - break; - } - if (object.project != null) - message.project = String(object.project); - if (object.ipv6Address != null) - message.ipv6Address = String(object.ipv6Address); - if (object.serviceAccountEmailAddress != null) - message.serviceAccountEmailAddress = String(object.serviceAccountEmailAddress); - if (object.onPremisesConfiguration != null) { - if (typeof object.onPremisesConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.onPremisesConfiguration: object expected"); - message.onPremisesConfiguration = $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.fromObject(object.onPremisesConfiguration); - } - if (object.replicaConfiguration != null) { - if (typeof object.replicaConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.replicaConfiguration: object expected"); - message.replicaConfiguration = $root.google.cloud.sql.v1beta4.ReplicaConfiguration.fromObject(object.replicaConfiguration); - } - switch (object.backendType) { - default: - if (typeof object.backendType === "number") { - message.backendType = object.backendType; - break; - } - break; - case "SQL_BACKEND_TYPE_UNSPECIFIED": - case 0: - message.backendType = 0; - break; - case "FIRST_GEN": - case 1: - message.backendType = 1; - break; - case "SECOND_GEN": - case 2: - message.backendType = 2; - break; - case "EXTERNAL": - case 3: - message.backendType = 3; - break; - } - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - if (object.suspensionReason) { - if (!Array.isArray(object.suspensionReason)) - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.suspensionReason: array expected"); - message.suspensionReason = []; - for (var i = 0; i < object.suspensionReason.length; ++i) - switch (object.suspensionReason[i]) { - default: - if (typeof object.suspensionReason[i] === "number") { - message.suspensionReason[i] = object.suspensionReason[i]; - break; - } - case "SQL_SUSPENSION_REASON_UNSPECIFIED": - case 0: - message.suspensionReason[i] = 0; - break; - case "BILLING_ISSUE": - case 2: - message.suspensionReason[i] = 2; - break; - case "LEGAL_ISSUE": - case 3: - message.suspensionReason[i] = 3; - break; - case "OPERATIONAL_ISSUE": - case 4: - message.suspensionReason[i] = 4; - break; - case "KMS_KEY_ISSUE": - case 5: - message.suspensionReason[i] = 5; - break; - } - } - if (object.connectionName != null) - message.connectionName = String(object.connectionName); - if (object.name != null) - message.name = String(object.name); - if (object.region != null) - message.region = String(object.region); - if (object.gceZone != null) - message.gceZone = String(object.gceZone); - if (object.secondaryGceZone != null) - message.secondaryGceZone = String(object.secondaryGceZone); - if (object.diskEncryptionConfiguration != null) { - if (typeof object.diskEncryptionConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.diskEncryptionConfiguration: object expected"); - message.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.fromObject(object.diskEncryptionConfiguration); - } - if (object.diskEncryptionStatus != null) { - if (typeof object.diskEncryptionStatus !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.diskEncryptionStatus: object expected"); - message.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.fromObject(object.diskEncryptionStatus); - } - if (object.rootPassword != null) - message.rootPassword = String(object.rootPassword); - if (object.scheduledMaintenance != null) { - if (typeof object.scheduledMaintenance !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.scheduledMaintenance: object expected"); - message.scheduledMaintenance = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.fromObject(object.scheduledMaintenance); - } - if (object.satisfiesPzs != null) { - if (typeof object.satisfiesPzs !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.satisfiesPzs: object expected"); - message.satisfiesPzs = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzs); - } - if (object.databaseInstalledVersion != null) - message.databaseInstalledVersion = String(object.databaseInstalledVersion); - if (object.outOfDiskReport != null) { - if (typeof object.outOfDiskReport !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.outOfDiskReport: object expected"); - message.outOfDiskReport = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.fromObject(object.outOfDiskReport); - } - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.availableMaintenanceVersions) { - if (!Array.isArray(object.availableMaintenanceVersions)) - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.availableMaintenanceVersions: array expected"); - message.availableMaintenanceVersions = []; - for (var i = 0; i < object.availableMaintenanceVersions.length; ++i) - message.availableMaintenanceVersions[i] = String(object.availableMaintenanceVersions[i]); - } - if (object.maintenanceVersion != null) - message.maintenanceVersion = String(object.maintenanceVersion); - if (object.upgradableDatabaseVersions) { - if (!Array.isArray(object.upgradableDatabaseVersions)) - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.upgradableDatabaseVersions: array expected"); - message.upgradableDatabaseVersions = []; - for (var i = 0; i < object.upgradableDatabaseVersions.length; ++i) { - if (typeof object.upgradableDatabaseVersions[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.upgradableDatabaseVersions: object expected"); - message.upgradableDatabaseVersions[i] = $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion.fromObject(object.upgradableDatabaseVersions[i]); - } - } - switch (object.sqlNetworkArchitecture) { - default: - if (typeof object.sqlNetworkArchitecture === "number") { - message.sqlNetworkArchitecture = object.sqlNetworkArchitecture; - break; - } - break; - case "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED": - case 0: - message.sqlNetworkArchitecture = 0; - break; - case "NEW_NETWORK_ARCHITECTURE": - case 1: - message.sqlNetworkArchitecture = 1; - break; - case "OLD_NETWORK_ARCHITECTURE": - case 2: - message.sqlNetworkArchitecture = 2; - break; - } - if (object.pscServiceAttachmentLink != null) - message.pscServiceAttachmentLink = String(object.pscServiceAttachmentLink); - if (object.dnsName != null) - message.dnsName = String(object.dnsName); - if (object.primaryDnsName != null) - message.primaryDnsName = String(object.primaryDnsName); - if (object.writeEndpoint != null) - message.writeEndpoint = String(object.writeEndpoint); - if (object.replicationCluster != null) { - if (typeof object.replicationCluster !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.replicationCluster: object expected"); - message.replicationCluster = $root.google.cloud.sql.v1beta4.ReplicationCluster.fromObject(object.replicationCluster); - } - if (object.geminiConfig != null) { - if (typeof object.geminiConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.geminiConfig: object expected"); - message.geminiConfig = $root.google.cloud.sql.v1beta4.GeminiInstanceConfig.fromObject(object.geminiConfig); - } - if (object.satisfiesPzi != null) { - if (typeof object.satisfiesPzi !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.satisfiesPzi: object expected"); - message.satisfiesPzi = $root.google.protobuf.BoolValue.fromObject(object.satisfiesPzi); - } - if (object.switchTransactionLogsToCloudStorageEnabled != null) { - if (typeof object.switchTransactionLogsToCloudStorageEnabled !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.switchTransactionLogsToCloudStorageEnabled: object expected"); - message.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.fromObject(object.switchTransactionLogsToCloudStorageEnabled); - } - if (object.includeReplicasForMajorVersionUpgrade != null) { - if (typeof object.includeReplicasForMajorVersionUpgrade !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.includeReplicasForMajorVersionUpgrade: object expected"); - message.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.fromObject(object.includeReplicasForMajorVersionUpgrade); - } - if (object.tags) { - if (typeof object.tags !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.tags: object expected"); - message.tags = {}; - for (var keys = Object.keys(object.tags), i = 0; i < keys.length; ++i) - message.tags[keys[i]] = String(object.tags[keys[i]]); - } - if (object.nodeCount != null) - message.nodeCount = object.nodeCount | 0; - if (object.nodes) { - if (!Array.isArray(object.nodes)) - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.nodes: array expected"); - message.nodes = []; - for (var i = 0; i < object.nodes.length; ++i) { - if (typeof object.nodes[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.nodes: object expected"); - message.nodes[i] = $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.fromObject(object.nodes[i]); - } - } - if (object.dnsNames) { - if (!Array.isArray(object.dnsNames)) - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.dnsNames: array expected"); - message.dnsNames = []; - for (var i = 0; i < object.dnsNames.length; ++i) { - if (typeof object.dnsNames[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.dnsNames: object expected"); - message.dnsNames[i] = $root.google.cloud.sql.v1beta4.DnsNameMapping.fromObject(object.dnsNames[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a DatabaseInstance message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance} message DatabaseInstance - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DatabaseInstance.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.replicaNames = []; - object.ipAddresses = []; - object.suspensionReason = []; - object.availableMaintenanceVersions = []; - object.upgradableDatabaseVersions = []; - object.nodes = []; - object.dnsNames = []; - } - if (options.objects || options.defaults) - object.tags = {}; - if (options.defaults) { - object.kind = ""; - object.state = options.enums === String ? "SQL_INSTANCE_STATE_UNSPECIFIED" : 0; - object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; - object.settings = null; - object.etag = ""; - object.failoverReplica = null; - object.masterInstanceName = ""; - object.maxDiskSize = null; - object.currentDiskSize = null; - object.serverCaCert = null; - object.instanceType = options.enums === String ? "SQL_INSTANCE_TYPE_UNSPECIFIED" : 0; - object.project = ""; - object.ipv6Address = ""; - object.serviceAccountEmailAddress = ""; - object.onPremisesConfiguration = null; - object.replicaConfiguration = null; - object.backendType = options.enums === String ? "SQL_BACKEND_TYPE_UNSPECIFIED" : 0; - object.selfLink = ""; - object.connectionName = ""; - object.name = ""; - object.region = ""; - object.gceZone = ""; - object.diskEncryptionConfiguration = null; - object.diskEncryptionStatus = null; - object.rootPassword = ""; - object.scheduledMaintenance = null; - object.secondaryGceZone = ""; - object.satisfiesPzs = null; - object.createTime = null; - object.databaseInstalledVersion = ""; - object.maintenanceVersion = ""; - object.satisfiesPzi = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.state != null && message.hasOwnProperty("state")) - object.state = options.enums === String ? $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState[message.state] : message.state; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; - if (message.settings != null && message.hasOwnProperty("settings")) - object.settings = $root.google.cloud.sql.v1beta4.Settings.toObject(message.settings, options); - if (message.etag != null && message.hasOwnProperty("etag")) - object.etag = message.etag; - if (message.failoverReplica != null && message.hasOwnProperty("failoverReplica")) - object.failoverReplica = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.toObject(message.failoverReplica, options); - if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) - object.masterInstanceName = message.masterInstanceName; - if (message.replicaNames && message.replicaNames.length) { - object.replicaNames = []; - for (var j = 0; j < message.replicaNames.length; ++j) - object.replicaNames[j] = message.replicaNames[j]; - } - if (message.maxDiskSize != null && message.hasOwnProperty("maxDiskSize")) - object.maxDiskSize = $root.google.protobuf.Int64Value.toObject(message.maxDiskSize, options); - if (message.currentDiskSize != null && message.hasOwnProperty("currentDiskSize")) - object.currentDiskSize = $root.google.protobuf.Int64Value.toObject(message.currentDiskSize, options); - if (message.ipAddresses && message.ipAddresses.length) { - object.ipAddresses = []; - for (var j = 0; j < message.ipAddresses.length; ++j) - object.ipAddresses[j] = $root.google.cloud.sql.v1beta4.IpMapping.toObject(message.ipAddresses[j], options); - } - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) - object.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.serverCaCert, options); - if (message.instanceType != null && message.hasOwnProperty("instanceType")) - object.instanceType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstanceType[message.instanceType] === undefined ? message.instanceType : $root.google.cloud.sql.v1beta4.SqlInstanceType[message.instanceType] : message.instanceType; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.ipv6Address != null && message.hasOwnProperty("ipv6Address")) - object.ipv6Address = message.ipv6Address; - if (message.serviceAccountEmailAddress != null && message.hasOwnProperty("serviceAccountEmailAddress")) - object.serviceAccountEmailAddress = message.serviceAccountEmailAddress; - if (message.onPremisesConfiguration != null && message.hasOwnProperty("onPremisesConfiguration")) - object.onPremisesConfiguration = $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.toObject(message.onPremisesConfiguration, options); - if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) - object.replicaConfiguration = $root.google.cloud.sql.v1beta4.ReplicaConfiguration.toObject(message.replicaConfiguration, options); - if (message.backendType != null && message.hasOwnProperty("backendType")) - object.backendType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackendType[message.backendType] === undefined ? message.backendType : $root.google.cloud.sql.v1beta4.SqlBackendType[message.backendType] : message.backendType; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.suspensionReason && message.suspensionReason.length) { - object.suspensionReason = []; - for (var j = 0; j < message.suspensionReason.length; ++j) - object.suspensionReason[j] = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlSuspensionReason[message.suspensionReason[j]] === undefined ? message.suspensionReason[j] : $root.google.cloud.sql.v1beta4.SqlSuspensionReason[message.suspensionReason[j]] : message.suspensionReason[j]; - } - if (message.connectionName != null && message.hasOwnProperty("connectionName")) - object.connectionName = message.connectionName; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.region != null && message.hasOwnProperty("region")) - object.region = message.region; - if (message.gceZone != null && message.hasOwnProperty("gceZone")) - object.gceZone = message.gceZone; - if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) - object.diskEncryptionConfiguration = $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration.toObject(message.diskEncryptionConfiguration, options); - if (message.diskEncryptionStatus != null && message.hasOwnProperty("diskEncryptionStatus")) - object.diskEncryptionStatus = $root.google.cloud.sql.v1beta4.DiskEncryptionStatus.toObject(message.diskEncryptionStatus, options); - if (message.rootPassword != null && message.hasOwnProperty("rootPassword")) - object.rootPassword = message.rootPassword; - if (message.scheduledMaintenance != null && message.hasOwnProperty("scheduledMaintenance")) - object.scheduledMaintenance = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.toObject(message.scheduledMaintenance, options); - if (message.secondaryGceZone != null && message.hasOwnProperty("secondaryGceZone")) - object.secondaryGceZone = message.secondaryGceZone; - if (message.satisfiesPzs != null && message.hasOwnProperty("satisfiesPzs")) - object.satisfiesPzs = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzs, options); - if (message.outOfDiskReport != null && message.hasOwnProperty("outOfDiskReport")) { - object.outOfDiskReport = $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.toObject(message.outOfDiskReport, options); - if (options.oneofs) - object._outOfDiskReport = "outOfDiskReport"; - } - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.databaseInstalledVersion != null && message.hasOwnProperty("databaseInstalledVersion")) - object.databaseInstalledVersion = message.databaseInstalledVersion; - if (message.availableMaintenanceVersions && message.availableMaintenanceVersions.length) { - object.availableMaintenanceVersions = []; - for (var j = 0; j < message.availableMaintenanceVersions.length; ++j) - object.availableMaintenanceVersions[j] = message.availableMaintenanceVersions[j]; - } - if (message.maintenanceVersion != null && message.hasOwnProperty("maintenanceVersion")) - object.maintenanceVersion = message.maintenanceVersion; - if (message.upgradableDatabaseVersions && message.upgradableDatabaseVersions.length) { - object.upgradableDatabaseVersions = []; - for (var j = 0; j < message.upgradableDatabaseVersions.length; ++j) - object.upgradableDatabaseVersions[j] = $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion.toObject(message.upgradableDatabaseVersions[j], options); - } - if (message.sqlNetworkArchitecture != null && message.hasOwnProperty("sqlNetworkArchitecture")) { - object.sqlNetworkArchitecture = options.enums === String ? $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture[message.sqlNetworkArchitecture] === undefined ? message.sqlNetworkArchitecture : $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture[message.sqlNetworkArchitecture] : message.sqlNetworkArchitecture; - if (options.oneofs) - object._sqlNetworkArchitecture = "sqlNetworkArchitecture"; - } - if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { - object.pscServiceAttachmentLink = message.pscServiceAttachmentLink; - if (options.oneofs) - object._pscServiceAttachmentLink = "pscServiceAttachmentLink"; - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - object.dnsName = message.dnsName; - if (options.oneofs) - object._dnsName = "dnsName"; - } - if (message.primaryDnsName != null && message.hasOwnProperty("primaryDnsName")) { - object.primaryDnsName = message.primaryDnsName; - if (options.oneofs) - object._primaryDnsName = "primaryDnsName"; - } - if (message.writeEndpoint != null && message.hasOwnProperty("writeEndpoint")) { - object.writeEndpoint = message.writeEndpoint; - if (options.oneofs) - object._writeEndpoint = "writeEndpoint"; - } - if (message.replicationCluster != null && message.hasOwnProperty("replicationCluster")) { - object.replicationCluster = $root.google.cloud.sql.v1beta4.ReplicationCluster.toObject(message.replicationCluster, options); - if (options.oneofs) - object._replicationCluster = "replicationCluster"; - } - if (message.geminiConfig != null && message.hasOwnProperty("geminiConfig")) { - object.geminiConfig = $root.google.cloud.sql.v1beta4.GeminiInstanceConfig.toObject(message.geminiConfig, options); - if (options.oneofs) - object._geminiConfig = "geminiConfig"; - } - if (message.satisfiesPzi != null && message.hasOwnProperty("satisfiesPzi")) - object.satisfiesPzi = $root.google.protobuf.BoolValue.toObject(message.satisfiesPzi, options); - if (message.switchTransactionLogsToCloudStorageEnabled != null && message.hasOwnProperty("switchTransactionLogsToCloudStorageEnabled")) { - object.switchTransactionLogsToCloudStorageEnabled = $root.google.protobuf.BoolValue.toObject(message.switchTransactionLogsToCloudStorageEnabled, options); - if (options.oneofs) - object._switchTransactionLogsToCloudStorageEnabled = "switchTransactionLogsToCloudStorageEnabled"; - } - if (message.includeReplicasForMajorVersionUpgrade != null && message.hasOwnProperty("includeReplicasForMajorVersionUpgrade")) { - object.includeReplicasForMajorVersionUpgrade = $root.google.protobuf.BoolValue.toObject(message.includeReplicasForMajorVersionUpgrade, options); - if (options.oneofs) - object._includeReplicasForMajorVersionUpgrade = "includeReplicasForMajorVersionUpgrade"; - } - var keys2; - if (message.tags && (keys2 = Object.keys(message.tags)).length) { - object.tags = {}; - for (var j = 0; j < keys2.length; ++j) - object.tags[keys2[j]] = message.tags[keys2[j]]; - } - if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { - object.nodeCount = message.nodeCount; - if (options.oneofs) - object._nodeCount = "nodeCount"; - } - if (message.nodes && message.nodes.length) { - object.nodes = []; - for (var j = 0; j < message.nodes.length; ++j) - object.nodes[j] = $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.toObject(message.nodes[j], options); - } - if (message.dnsNames && message.dnsNames.length) { - object.dnsNames = []; - for (var j = 0; j < message.dnsNames.length; ++j) - object.dnsNames[j] = $root.google.cloud.sql.v1beta4.DnsNameMapping.toObject(message.dnsNames[j], options); - } - return object; - }; - - /** - * Converts this DatabaseInstance to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @instance - * @returns {Object.} JSON object - */ - DatabaseInstance.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DatabaseInstance - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DatabaseInstance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseInstance"; - }; - - /** - * SqlInstanceState enum. - * @name google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState - * @enum {number} - * @property {number} SQL_INSTANCE_STATE_UNSPECIFIED=0 SQL_INSTANCE_STATE_UNSPECIFIED value - * @property {number} RUNNABLE=1 RUNNABLE value - * @property {number} SUSPENDED=2 SUSPENDED value - * @property {number} PENDING_DELETE=3 PENDING_DELETE value - * @property {number} PENDING_CREATE=4 PENDING_CREATE value - * @property {number} MAINTENANCE=5 MAINTENANCE value - * @property {number} FAILED=6 FAILED value - * @property {number} ONLINE_MAINTENANCE=7 ONLINE_MAINTENANCE value - * @property {number} REPAIRING=8 REPAIRING value - */ - DatabaseInstance.SqlInstanceState = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_INSTANCE_STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "RUNNABLE"] = 1; - values[valuesById[2] = "SUSPENDED"] = 2; - values[valuesById[3] = "PENDING_DELETE"] = 3; - values[valuesById[4] = "PENDING_CREATE"] = 4; - values[valuesById[5] = "MAINTENANCE"] = 5; - values[valuesById[6] = "FAILED"] = 6; - values[valuesById[7] = "ONLINE_MAINTENANCE"] = 7; - values[valuesById[8] = "REPAIRING"] = 8; - return values; - })(); - - DatabaseInstance.SqlFailoverReplica = (function() { - - /** - * Properties of a SqlFailoverReplica. - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @interface ISqlFailoverReplica - * @property {string|null} [name] SqlFailoverReplica name - * @property {google.protobuf.IBoolValue|null} [available] SqlFailoverReplica available - */ - - /** - * Constructs a new SqlFailoverReplica. - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @classdesc Represents a SqlFailoverReplica. - * @implements ISqlFailoverReplica - * @constructor - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica=} [properties] Properties to set - */ - function SqlFailoverReplica(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlFailoverReplica name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @instance - */ - SqlFailoverReplica.prototype.name = ""; - - /** - * SqlFailoverReplica available. - * @member {google.protobuf.IBoolValue|null|undefined} available - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @instance - */ - SqlFailoverReplica.prototype.available = null; - - /** - * Creates a new SqlFailoverReplica instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica instance - */ - SqlFailoverReplica.create = function create(properties) { - return new SqlFailoverReplica(properties); - }; - - /** - * Encodes the specified SqlFailoverReplica message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica} message SqlFailoverReplica message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlFailoverReplica.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.available != null && Object.hasOwnProperty.call(message, "available")) - $root.google.protobuf.BoolValue.encode(message.available, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlFailoverReplica message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlFailoverReplica} message SqlFailoverReplica message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlFailoverReplica.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlFailoverReplica message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlFailoverReplica.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.available = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlFailoverReplica message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlFailoverReplica.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlFailoverReplica message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlFailoverReplica.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.available != null && message.hasOwnProperty("available")) { - var error = $root.google.protobuf.BoolValue.verify(message.available); - if (error) - return "available." + error; - } - return null; - }; - - /** - * Creates a SqlFailoverReplica message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica} SqlFailoverReplica - */ - SqlFailoverReplica.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica) - return object; - var message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica(); - if (object.name != null) - message.name = String(object.name); - if (object.available != null) { - if (typeof object.available !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica.available: object expected"); - message.available = $root.google.protobuf.BoolValue.fromObject(object.available); - } - return message; - }; - - /** - * Creates a plain object from a SqlFailoverReplica message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica} message SqlFailoverReplica - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlFailoverReplica.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.available = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.available != null && message.hasOwnProperty("available")) - object.available = $root.google.protobuf.BoolValue.toObject(message.available, options); - return object; - }; - - /** - * Converts this SqlFailoverReplica to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @instance - * @returns {Object.} JSON object - */ - SqlFailoverReplica.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlFailoverReplica - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlFailoverReplica.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseInstance.SqlFailoverReplica"; - }; - - return SqlFailoverReplica; - })(); - - DatabaseInstance.SqlScheduledMaintenance = (function() { - - /** - * Properties of a SqlScheduledMaintenance. - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @interface ISqlScheduledMaintenance - * @property {google.protobuf.ITimestamp|null} [startTime] SqlScheduledMaintenance startTime - * @property {boolean|null} [canDefer] SqlScheduledMaintenance canDefer - * @property {boolean|null} [canReschedule] SqlScheduledMaintenance canReschedule - * @property {google.protobuf.ITimestamp|null} [scheduleDeadlineTime] SqlScheduledMaintenance scheduleDeadlineTime - */ - - /** - * Constructs a new SqlScheduledMaintenance. - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @classdesc Represents a SqlScheduledMaintenance. - * @implements ISqlScheduledMaintenance - * @constructor - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance=} [properties] Properties to set - */ - function SqlScheduledMaintenance(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlScheduledMaintenance startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @instance - */ - SqlScheduledMaintenance.prototype.startTime = null; - - /** - * SqlScheduledMaintenance canDefer. - * @member {boolean} canDefer - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @instance - */ - SqlScheduledMaintenance.prototype.canDefer = false; - - /** - * SqlScheduledMaintenance canReschedule. - * @member {boolean} canReschedule - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @instance - */ - SqlScheduledMaintenance.prototype.canReschedule = false; - - /** - * SqlScheduledMaintenance scheduleDeadlineTime. - * @member {google.protobuf.ITimestamp|null|undefined} scheduleDeadlineTime - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @instance - */ - SqlScheduledMaintenance.prototype.scheduleDeadlineTime = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlScheduledMaintenance.prototype, "_scheduleDeadlineTime", { - get: $util.oneOfGetter($oneOfFields = ["scheduleDeadlineTime"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlScheduledMaintenance instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance instance - */ - SqlScheduledMaintenance.create = function create(properties) { - return new SqlScheduledMaintenance(properties); - }; - - /** - * Encodes the specified SqlScheduledMaintenance message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance} message SqlScheduledMaintenance message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlScheduledMaintenance.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.canDefer != null && Object.hasOwnProperty.call(message, "canDefer")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.canDefer); - if (message.canReschedule != null && Object.hasOwnProperty.call(message, "canReschedule")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.canReschedule); - if (message.scheduleDeadlineTime != null && Object.hasOwnProperty.call(message, "scheduleDeadlineTime")) - $root.google.protobuf.Timestamp.encode(message.scheduleDeadlineTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlScheduledMaintenance message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlScheduledMaintenance} message SqlScheduledMaintenance message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlScheduledMaintenance.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlScheduledMaintenance message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlScheduledMaintenance.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 2: { - message.canDefer = reader.bool(); - break; - } - case 3: { - message.canReschedule = reader.bool(); - break; - } - case 4: { - message.scheduleDeadlineTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlScheduledMaintenance message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlScheduledMaintenance.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlScheduledMaintenance message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlScheduledMaintenance.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.canDefer != null && message.hasOwnProperty("canDefer")) - if (typeof message.canDefer !== "boolean") - return "canDefer: boolean expected"; - if (message.canReschedule != null && message.hasOwnProperty("canReschedule")) - if (typeof message.canReschedule !== "boolean") - return "canReschedule: boolean expected"; - if (message.scheduleDeadlineTime != null && message.hasOwnProperty("scheduleDeadlineTime")) { - properties._scheduleDeadlineTime = 1; - { - var error = $root.google.protobuf.Timestamp.verify(message.scheduleDeadlineTime); - if (error) - return "scheduleDeadlineTime." + error; - } - } - return null; - }; - - /** - * Creates a SqlScheduledMaintenance message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance} SqlScheduledMaintenance - */ - SqlScheduledMaintenance.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance) - return object; - var message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance(); - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.canDefer != null) - message.canDefer = Boolean(object.canDefer); - if (object.canReschedule != null) - message.canReschedule = Boolean(object.canReschedule); - if (object.scheduleDeadlineTime != null) { - if (typeof object.scheduleDeadlineTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance.scheduleDeadlineTime: object expected"); - message.scheduleDeadlineTime = $root.google.protobuf.Timestamp.fromObject(object.scheduleDeadlineTime); - } - return message; - }; - - /** - * Creates a plain object from a SqlScheduledMaintenance message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance} message SqlScheduledMaintenance - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlScheduledMaintenance.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.startTime = null; - object.canDefer = false; - object.canReschedule = false; - } - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.canDefer != null && message.hasOwnProperty("canDefer")) - object.canDefer = message.canDefer; - if (message.canReschedule != null && message.hasOwnProperty("canReschedule")) - object.canReschedule = message.canReschedule; - if (message.scheduleDeadlineTime != null && message.hasOwnProperty("scheduleDeadlineTime")) { - object.scheduleDeadlineTime = $root.google.protobuf.Timestamp.toObject(message.scheduleDeadlineTime, options); - if (options.oneofs) - object._scheduleDeadlineTime = "scheduleDeadlineTime"; - } - return object; - }; - - /** - * Converts this SqlScheduledMaintenance to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @instance - * @returns {Object.} JSON object - */ - SqlScheduledMaintenance.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlScheduledMaintenance - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlScheduledMaintenance.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseInstance.SqlScheduledMaintenance"; - }; - - return SqlScheduledMaintenance; - })(); - - DatabaseInstance.SqlOutOfDiskReport = (function() { - - /** - * Properties of a SqlOutOfDiskReport. - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @interface ISqlOutOfDiskReport - * @property {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null} [sqlOutOfDiskState] SqlOutOfDiskReport sqlOutOfDiskState - * @property {number|null} [sqlMinRecommendedIncreaseSizeGb] SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb - */ - - /** - * Constructs a new SqlOutOfDiskReport. - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @classdesc Represents a SqlOutOfDiskReport. - * @implements ISqlOutOfDiskReport - * @constructor - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport=} [properties] Properties to set - */ - function SqlOutOfDiskReport(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlOutOfDiskReport sqlOutOfDiskState. - * @member {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState|null|undefined} sqlOutOfDiskState - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @instance - */ - SqlOutOfDiskReport.prototype.sqlOutOfDiskState = null; - - /** - * SqlOutOfDiskReport sqlMinRecommendedIncreaseSizeGb. - * @member {number|null|undefined} sqlMinRecommendedIncreaseSizeGb - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @instance - */ - SqlOutOfDiskReport.prototype.sqlMinRecommendedIncreaseSizeGb = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlOutOfDiskReport.prototype, "_sqlOutOfDiskState", { - get: $util.oneOfGetter($oneOfFields = ["sqlOutOfDiskState"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlOutOfDiskReport.prototype, "_sqlMinRecommendedIncreaseSizeGb", { - get: $util.oneOfGetter($oneOfFields = ["sqlMinRecommendedIncreaseSizeGb"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlOutOfDiskReport instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport instance - */ - SqlOutOfDiskReport.create = function create(properties) { - return new SqlOutOfDiskReport(properties); - }; - - /** - * Encodes the specified SqlOutOfDiskReport message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport} message SqlOutOfDiskReport message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOutOfDiskReport.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.sqlOutOfDiskState != null && Object.hasOwnProperty.call(message, "sqlOutOfDiskState")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.sqlOutOfDiskState); - if (message.sqlMinRecommendedIncreaseSizeGb != null && Object.hasOwnProperty.call(message, "sqlMinRecommendedIncreaseSizeGb")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.sqlMinRecommendedIncreaseSizeGb); - return writer; - }; - - /** - * Encodes the specified SqlOutOfDiskReport message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.ISqlOutOfDiskReport} message SqlOutOfDiskReport message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlOutOfDiskReport.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlOutOfDiskReport message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOutOfDiskReport.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.sqlOutOfDiskState = reader.int32(); - break; - } - case 2: { - message.sqlMinRecommendedIncreaseSizeGb = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlOutOfDiskReport message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlOutOfDiskReport.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlOutOfDiskReport message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlOutOfDiskReport.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.sqlOutOfDiskState != null && message.hasOwnProperty("sqlOutOfDiskState")) { - properties._sqlOutOfDiskState = 1; - switch (message.sqlOutOfDiskState) { - default: - return "sqlOutOfDiskState: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - if (message.sqlMinRecommendedIncreaseSizeGb != null && message.hasOwnProperty("sqlMinRecommendedIncreaseSizeGb")) { - properties._sqlMinRecommendedIncreaseSizeGb = 1; - if (!$util.isInteger(message.sqlMinRecommendedIncreaseSizeGb)) - return "sqlMinRecommendedIncreaseSizeGb: integer expected"; - } - return null; - }; - - /** - * Creates a SqlOutOfDiskReport message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport} SqlOutOfDiskReport - */ - SqlOutOfDiskReport.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport) - return object; - var message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport(); - switch (object.sqlOutOfDiskState) { - default: - if (typeof object.sqlOutOfDiskState === "number") { - message.sqlOutOfDiskState = object.sqlOutOfDiskState; - break; - } - break; - case "SQL_OUT_OF_DISK_STATE_UNSPECIFIED": - case 0: - message.sqlOutOfDiskState = 0; - break; - case "NORMAL": - case 1: - message.sqlOutOfDiskState = 1; - break; - case "SOFT_SHUTDOWN": - case 2: - message.sqlOutOfDiskState = 2; - break; - } - if (object.sqlMinRecommendedIncreaseSizeGb != null) - message.sqlMinRecommendedIncreaseSizeGb = object.sqlMinRecommendedIncreaseSizeGb | 0; - return message; - }; - - /** - * Creates a plain object from a SqlOutOfDiskReport message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport} message SqlOutOfDiskReport - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlOutOfDiskReport.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.sqlOutOfDiskState != null && message.hasOwnProperty("sqlOutOfDiskState")) { - object.sqlOutOfDiskState = options.enums === String ? $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState[message.sqlOutOfDiskState] === undefined ? message.sqlOutOfDiskState : $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState[message.sqlOutOfDiskState] : message.sqlOutOfDiskState; - if (options.oneofs) - object._sqlOutOfDiskState = "sqlOutOfDiskState"; - } - if (message.sqlMinRecommendedIncreaseSizeGb != null && message.hasOwnProperty("sqlMinRecommendedIncreaseSizeGb")) { - object.sqlMinRecommendedIncreaseSizeGb = message.sqlMinRecommendedIncreaseSizeGb; - if (options.oneofs) - object._sqlMinRecommendedIncreaseSizeGb = "sqlMinRecommendedIncreaseSizeGb"; - } - return object; - }; - - /** - * Converts this SqlOutOfDiskReport to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @instance - * @returns {Object.} JSON object - */ - SqlOutOfDiskReport.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlOutOfDiskReport - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlOutOfDiskReport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport"; - }; - - /** - * SqlOutOfDiskState enum. - * @name google.cloud.sql.v1beta4.DatabaseInstance.SqlOutOfDiskReport.SqlOutOfDiskState - * @enum {number} - * @property {number} SQL_OUT_OF_DISK_STATE_UNSPECIFIED=0 SQL_OUT_OF_DISK_STATE_UNSPECIFIED value - * @property {number} NORMAL=1 NORMAL value - * @property {number} SOFT_SHUTDOWN=2 SOFT_SHUTDOWN value - */ - SqlOutOfDiskReport.SqlOutOfDiskState = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_OUT_OF_DISK_STATE_UNSPECIFIED"] = 0; - values[valuesById[1] = "NORMAL"] = 1; - values[valuesById[2] = "SOFT_SHUTDOWN"] = 2; - return values; - })(); - - return SqlOutOfDiskReport; - })(); - - /** - * SqlNetworkArchitecture enum. - * @name google.cloud.sql.v1beta4.DatabaseInstance.SqlNetworkArchitecture - * @enum {number} - * @property {number} SQL_NETWORK_ARCHITECTURE_UNSPECIFIED=0 SQL_NETWORK_ARCHITECTURE_UNSPECIFIED value - * @property {number} NEW_NETWORK_ARCHITECTURE=1 NEW_NETWORK_ARCHITECTURE value - * @property {number} OLD_NETWORK_ARCHITECTURE=2 OLD_NETWORK_ARCHITECTURE value - */ - DatabaseInstance.SqlNetworkArchitecture = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED"] = 0; - values[valuesById[1] = "NEW_NETWORK_ARCHITECTURE"] = 1; - values[valuesById[2] = "OLD_NETWORK_ARCHITECTURE"] = 2; - return values; - })(); - - DatabaseInstance.PoolNodeConfig = (function() { - - /** - * Properties of a PoolNodeConfig. - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @interface IPoolNodeConfig - * @property {string|null} [name] PoolNodeConfig name - * @property {string|null} [gceZone] PoolNodeConfig gceZone - * @property {Array.|null} [ipAddresses] PoolNodeConfig ipAddresses - * @property {string|null} [dnsName] PoolNodeConfig dnsName - * @property {google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null} [state] PoolNodeConfig state - * @property {Array.|null} [dnsNames] PoolNodeConfig dnsNames - * @property {string|null} [pscServiceAttachmentLink] PoolNodeConfig pscServiceAttachmentLink - * @property {Array.|null} [pscAutoConnections] PoolNodeConfig pscAutoConnections - */ - - /** - * Constructs a new PoolNodeConfig. - * @memberof google.cloud.sql.v1beta4.DatabaseInstance - * @classdesc Represents a PoolNodeConfig. - * @implements IPoolNodeConfig - * @constructor - * @param {google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig=} [properties] Properties to set - */ - function PoolNodeConfig(properties) { - this.ipAddresses = []; - this.dnsNames = []; - this.pscAutoConnections = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PoolNodeConfig name. - * @member {string|null|undefined} name - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.name = null; - - /** - * PoolNodeConfig gceZone. - * @member {string|null|undefined} gceZone - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.gceZone = null; - - /** - * PoolNodeConfig ipAddresses. - * @member {Array.} ipAddresses - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.ipAddresses = $util.emptyArray; - - /** - * PoolNodeConfig dnsName. - * @member {string|null|undefined} dnsName - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.dnsName = null; - - /** - * PoolNodeConfig state. - * @member {google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState|null|undefined} state - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.state = null; - - /** - * PoolNodeConfig dnsNames. - * @member {Array.} dnsNames - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.dnsNames = $util.emptyArray; - - /** - * PoolNodeConfig pscServiceAttachmentLink. - * @member {string|null|undefined} pscServiceAttachmentLink - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.pscServiceAttachmentLink = null; - - /** - * PoolNodeConfig pscAutoConnections. - * @member {Array.} pscAutoConnections - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @instance - */ - PoolNodeConfig.prototype.pscAutoConnections = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PoolNodeConfig.prototype, "_name", { - get: $util.oneOfGetter($oneOfFields = ["name"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PoolNodeConfig.prototype, "_gceZone", { - get: $util.oneOfGetter($oneOfFields = ["gceZone"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PoolNodeConfig.prototype, "_dnsName", { - get: $util.oneOfGetter($oneOfFields = ["dnsName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PoolNodeConfig.prototype, "_state", { - get: $util.oneOfGetter($oneOfFields = ["state"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PoolNodeConfig.prototype, "_pscServiceAttachmentLink", { - get: $util.oneOfGetter($oneOfFields = ["pscServiceAttachmentLink"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PoolNodeConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig} PoolNodeConfig instance - */ - PoolNodeConfig.create = function create(properties) { - return new PoolNodeConfig(properties); - }; - - /** - * Encodes the specified PoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig} message PoolNodeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PoolNodeConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.gceZone != null && Object.hasOwnProperty.call(message, "gceZone")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.gceZone); - if (message.ipAddresses != null && message.ipAddresses.length) - for (var i = 0; i < message.ipAddresses.length; ++i) - $root.google.cloud.sql.v1beta4.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dnsName); - if (message.state != null && Object.hasOwnProperty.call(message, "state")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.state); - if (message.dnsNames != null && message.dnsNames.length) - for (var i = 0; i < message.dnsNames.length; ++i) - $root.google.cloud.sql.v1beta4.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.pscServiceAttachmentLink != null && Object.hasOwnProperty.call(message, "pscServiceAttachmentLink")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.pscServiceAttachmentLink); - if (message.pscAutoConnections != null && message.pscAutoConnections.length) - for (var i = 0; i < message.pscAutoConnections.length; ++i) - $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.encode(message.pscAutoConnections[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.IPoolNodeConfig} message PoolNodeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PoolNodeConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PoolNodeConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig} PoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PoolNodeConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.gceZone = reader.string(); - break; - } - case 3: { - if (!(message.ipAddresses && message.ipAddresses.length)) - message.ipAddresses = []; - message.ipAddresses.push($root.google.cloud.sql.v1beta4.IpMapping.decode(reader, reader.uint32())); - break; - } - case 4: { - message.dnsName = reader.string(); - break; - } - case 5: { - message.state = reader.int32(); - break; - } - case 6: { - if (!(message.dnsNames && message.dnsNames.length)) - message.dnsNames = []; - message.dnsNames.push($root.google.cloud.sql.v1beta4.DnsNameMapping.decode(reader, reader.uint32())); - break; - } - case 7: { - message.pscServiceAttachmentLink = reader.string(); - break; - } - case 8: { - if (!(message.pscAutoConnections && message.pscAutoConnections.length)) - message.pscAutoConnections = []; - message.pscAutoConnections.push($root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PoolNodeConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig} PoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PoolNodeConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PoolNodeConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PoolNodeConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) { - properties._name = 1; - if (!$util.isString(message.name)) - return "name: string expected"; - } - if (message.gceZone != null && message.hasOwnProperty("gceZone")) { - properties._gceZone = 1; - if (!$util.isString(message.gceZone)) - return "gceZone: string expected"; - } - if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { - if (!Array.isArray(message.ipAddresses)) - return "ipAddresses: array expected"; - for (var i = 0; i < message.ipAddresses.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.IpMapping.verify(message.ipAddresses[i]); - if (error) - return "ipAddresses." + error; - } - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - properties._dnsName = 1; - if (!$util.isString(message.dnsName)) - return "dnsName: string expected"; - } - if (message.state != null && message.hasOwnProperty("state")) { - properties._state = 1; - switch (message.state) { - default: - return "state: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - break; - } - } - if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { - if (!Array.isArray(message.dnsNames)) - return "dnsNames: array expected"; - for (var i = 0; i < message.dnsNames.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.DnsNameMapping.verify(message.dnsNames[i]); - if (error) - return "dnsNames." + error; - } - } - if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { - properties._pscServiceAttachmentLink = 1; - if (!$util.isString(message.pscServiceAttachmentLink)) - return "pscServiceAttachmentLink: string expected"; - } - if (message.pscAutoConnections != null && message.hasOwnProperty("pscAutoConnections")) { - if (!Array.isArray(message.pscAutoConnections)) - return "pscAutoConnections: array expected"; - for (var i = 0; i < message.pscAutoConnections.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify(message.pscAutoConnections[i]); - if (error) - return "pscAutoConnections." + error; - } - } - return null; - }; - - /** - * Creates a PoolNodeConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig} PoolNodeConfig - */ - PoolNodeConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig(); - if (object.name != null) - message.name = String(object.name); - if (object.gceZone != null) - message.gceZone = String(object.gceZone); - if (object.ipAddresses) { - if (!Array.isArray(object.ipAddresses)) - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.ipAddresses: array expected"); - message.ipAddresses = []; - for (var i = 0; i < object.ipAddresses.length; ++i) { - if (typeof object.ipAddresses[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.ipAddresses: object expected"); - message.ipAddresses[i] = $root.google.cloud.sql.v1beta4.IpMapping.fromObject(object.ipAddresses[i]); - } - } - if (object.dnsName != null) - message.dnsName = String(object.dnsName); - switch (object.state) { - default: - if (typeof object.state === "number") { - message.state = object.state; - break; - } - break; - case "SQL_INSTANCE_STATE_UNSPECIFIED": - case 0: - message.state = 0; - break; - case "RUNNABLE": - case 1: - message.state = 1; - break; - case "SUSPENDED": - case 2: - message.state = 2; - break; - case "PENDING_DELETE": - case 3: - message.state = 3; - break; - case "PENDING_CREATE": - case 4: - message.state = 4; - break; - case "MAINTENANCE": - case 5: - message.state = 5; - break; - case "FAILED": - case 6: - message.state = 6; - break; - case "ONLINE_MAINTENANCE": - case 7: - message.state = 7; - break; - case "REPAIRING": - case 8: - message.state = 8; - break; - } - if (object.dnsNames) { - if (!Array.isArray(object.dnsNames)) - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.dnsNames: array expected"); - message.dnsNames = []; - for (var i = 0; i < object.dnsNames.length; ++i) { - if (typeof object.dnsNames[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.dnsNames: object expected"); - message.dnsNames[i] = $root.google.cloud.sql.v1beta4.DnsNameMapping.fromObject(object.dnsNames[i]); - } - } - if (object.pscServiceAttachmentLink != null) - message.pscServiceAttachmentLink = String(object.pscServiceAttachmentLink); - if (object.pscAutoConnections) { - if (!Array.isArray(object.pscAutoConnections)) - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.pscAutoConnections: array expected"); - message.pscAutoConnections = []; - for (var i = 0; i < object.pscAutoConnections.length; ++i) { - if (typeof object.pscAutoConnections[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig.pscAutoConnections: object expected"); - message.pscAutoConnections[i] = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.fromObject(object.pscAutoConnections[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a PoolNodeConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @static - * @param {google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig} message PoolNodeConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PoolNodeConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.ipAddresses = []; - object.dnsNames = []; - object.pscAutoConnections = []; - } - if (message.name != null && message.hasOwnProperty("name")) { - object.name = message.name; - if (options.oneofs) - object._name = "name"; - } - if (message.gceZone != null && message.hasOwnProperty("gceZone")) { - object.gceZone = message.gceZone; - if (options.oneofs) - object._gceZone = "gceZone"; - } - if (message.ipAddresses && message.ipAddresses.length) { - object.ipAddresses = []; - for (var j = 0; j < message.ipAddresses.length; ++j) - object.ipAddresses[j] = $root.google.cloud.sql.v1beta4.IpMapping.toObject(message.ipAddresses[j], options); - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - object.dnsName = message.dnsName; - if (options.oneofs) - object._dnsName = "dnsName"; - } - if (message.state != null && message.hasOwnProperty("state")) { - object.state = options.enums === String ? $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState[message.state] === undefined ? message.state : $root.google.cloud.sql.v1beta4.DatabaseInstance.SqlInstanceState[message.state] : message.state; - if (options.oneofs) - object._state = "state"; - } - if (message.dnsNames && message.dnsNames.length) { - object.dnsNames = []; - for (var j = 0; j < message.dnsNames.length; ++j) - object.dnsNames[j] = $root.google.cloud.sql.v1beta4.DnsNameMapping.toObject(message.dnsNames[j], options); - } - if (message.pscServiceAttachmentLink != null && message.hasOwnProperty("pscServiceAttachmentLink")) { - object.pscServiceAttachmentLink = message.pscServiceAttachmentLink; - if (options.oneofs) - object._pscServiceAttachmentLink = "pscServiceAttachmentLink"; - } - if (message.pscAutoConnections && message.pscAutoConnections.length) { - object.pscAutoConnections = []; - for (var j = 0; j < message.pscAutoConnections.length; ++j) - object.pscAutoConnections[j] = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.toObject(message.pscAutoConnections[j], options); - } - return object; - }; - - /** - * Converts this PoolNodeConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @instance - * @returns {Object.} JSON object - */ - PoolNodeConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PoolNodeConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PoolNodeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabaseInstance.PoolNodeConfig"; - }; - - return PoolNodeConfig; - })(); - - return DatabaseInstance; - })(); - - v1beta4.DnsNameMapping = (function() { - - /** - * Properties of a DnsNameMapping. - * @memberof google.cloud.sql.v1beta4 - * @interface IDnsNameMapping - * @property {string|null} [name] DnsNameMapping name - * @property {google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType|null} [connectionType] DnsNameMapping connectionType - * @property {google.cloud.sql.v1beta4.DnsNameMapping.DnsScope|null} [dnsScope] DnsNameMapping dnsScope - * @property {google.cloud.sql.v1beta4.DnsNameMapping.RecordManager|null} [recordManager] DnsNameMapping recordManager - */ - - /** - * Constructs a new DnsNameMapping. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DnsNameMapping. - * @implements IDnsNameMapping - * @constructor - * @param {google.cloud.sql.v1beta4.IDnsNameMapping=} [properties] Properties to set - */ - function DnsNameMapping(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DnsNameMapping name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @instance - */ - DnsNameMapping.prototype.name = ""; - - /** - * DnsNameMapping connectionType. - * @member {google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType} connectionType - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @instance - */ - DnsNameMapping.prototype.connectionType = 0; - - /** - * DnsNameMapping dnsScope. - * @member {google.cloud.sql.v1beta4.DnsNameMapping.DnsScope} dnsScope - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @instance - */ - DnsNameMapping.prototype.dnsScope = 0; - - /** - * DnsNameMapping recordManager. - * @member {google.cloud.sql.v1beta4.DnsNameMapping.RecordManager} recordManager - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @instance - */ - DnsNameMapping.prototype.recordManager = 0; - - /** - * Creates a new DnsNameMapping instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @static - * @param {google.cloud.sql.v1beta4.IDnsNameMapping=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DnsNameMapping} DnsNameMapping instance - */ - DnsNameMapping.create = function create(properties) { - return new DnsNameMapping(properties); - }; - - /** - * Encodes the specified DnsNameMapping message. Does not implicitly {@link google.cloud.sql.v1beta4.DnsNameMapping.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @static - * @param {google.cloud.sql.v1beta4.IDnsNameMapping} message DnsNameMapping message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DnsNameMapping.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.connectionType != null && Object.hasOwnProperty.call(message, "connectionType")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.connectionType); - if (message.dnsScope != null && Object.hasOwnProperty.call(message, "dnsScope")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.dnsScope); - if (message.recordManager != null && Object.hasOwnProperty.call(message, "recordManager")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.recordManager); - return writer; - }; - - /** - * Encodes the specified DnsNameMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DnsNameMapping.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @static - * @param {google.cloud.sql.v1beta4.IDnsNameMapping} message DnsNameMapping message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DnsNameMapping.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DnsNameMapping message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DnsNameMapping} DnsNameMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DnsNameMapping.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DnsNameMapping(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.connectionType = reader.int32(); - break; - } - case 3: { - message.dnsScope = reader.int32(); - break; - } - case 4: { - message.recordManager = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DnsNameMapping message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DnsNameMapping} DnsNameMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DnsNameMapping.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DnsNameMapping message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DnsNameMapping.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.connectionType != null && message.hasOwnProperty("connectionType")) - switch (message.connectionType) { - default: - return "connectionType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.dnsScope != null && message.hasOwnProperty("dnsScope")) - switch (message.dnsScope) { - default: - return "dnsScope: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.recordManager != null && message.hasOwnProperty("recordManager")) - switch (message.recordManager) { - default: - return "recordManager: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates a DnsNameMapping message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DnsNameMapping} DnsNameMapping - */ - DnsNameMapping.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DnsNameMapping) - return object; - var message = new $root.google.cloud.sql.v1beta4.DnsNameMapping(); - if (object.name != null) - message.name = String(object.name); - switch (object.connectionType) { - default: - if (typeof object.connectionType === "number") { - message.connectionType = object.connectionType; - break; - } - break; - case "CONNECTION_TYPE_UNSPECIFIED": - case 0: - message.connectionType = 0; - break; - case "PUBLIC": - case 1: - message.connectionType = 1; - break; - case "PRIVATE_SERVICES_ACCESS": - case 2: - message.connectionType = 2; - break; - case "PRIVATE_SERVICE_CONNECT": - case 3: - message.connectionType = 3; - break; - } - switch (object.dnsScope) { - default: - if (typeof object.dnsScope === "number") { - message.dnsScope = object.dnsScope; - break; - } - break; - case "DNS_SCOPE_UNSPECIFIED": - case 0: - message.dnsScope = 0; - break; - case "INSTANCE": - case 1: - message.dnsScope = 1; - break; - case "CLUSTER": - case 2: - message.dnsScope = 2; - break; - } - switch (object.recordManager) { - default: - if (typeof object.recordManager === "number") { - message.recordManager = object.recordManager; - break; - } - break; - case "RECORD_MANAGER_UNSPECIFIED": - case 0: - message.recordManager = 0; - break; - case "CUSTOMER": - case 1: - message.recordManager = 1; - break; - case "CLOUD_SQL_AUTOMATION": - case 2: - message.recordManager = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a DnsNameMapping message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @static - * @param {google.cloud.sql.v1beta4.DnsNameMapping} message DnsNameMapping - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DnsNameMapping.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.connectionType = options.enums === String ? "CONNECTION_TYPE_UNSPECIFIED" : 0; - object.dnsScope = options.enums === String ? "DNS_SCOPE_UNSPECIFIED" : 0; - object.recordManager = options.enums === String ? "RECORD_MANAGER_UNSPECIFIED" : 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.connectionType != null && message.hasOwnProperty("connectionType")) - object.connectionType = options.enums === String ? $root.google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType[message.connectionType] === undefined ? message.connectionType : $root.google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType[message.connectionType] : message.connectionType; - if (message.dnsScope != null && message.hasOwnProperty("dnsScope")) - object.dnsScope = options.enums === String ? $root.google.cloud.sql.v1beta4.DnsNameMapping.DnsScope[message.dnsScope] === undefined ? message.dnsScope : $root.google.cloud.sql.v1beta4.DnsNameMapping.DnsScope[message.dnsScope] : message.dnsScope; - if (message.recordManager != null && message.hasOwnProperty("recordManager")) - object.recordManager = options.enums === String ? $root.google.cloud.sql.v1beta4.DnsNameMapping.RecordManager[message.recordManager] === undefined ? message.recordManager : $root.google.cloud.sql.v1beta4.DnsNameMapping.RecordManager[message.recordManager] : message.recordManager; - return object; - }; - - /** - * Converts this DnsNameMapping to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @instance - * @returns {Object.} JSON object - */ - DnsNameMapping.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DnsNameMapping - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DnsNameMapping - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DnsNameMapping.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DnsNameMapping"; - }; - - /** - * ConnectionType enum. - * @name google.cloud.sql.v1beta4.DnsNameMapping.ConnectionType - * @enum {number} - * @property {number} CONNECTION_TYPE_UNSPECIFIED=0 CONNECTION_TYPE_UNSPECIFIED value - * @property {number} PUBLIC=1 PUBLIC value - * @property {number} PRIVATE_SERVICES_ACCESS=2 PRIVATE_SERVICES_ACCESS value - * @property {number} PRIVATE_SERVICE_CONNECT=3 PRIVATE_SERVICE_CONNECT value - */ - DnsNameMapping.ConnectionType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CONNECTION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PUBLIC"] = 1; - values[valuesById[2] = "PRIVATE_SERVICES_ACCESS"] = 2; - values[valuesById[3] = "PRIVATE_SERVICE_CONNECT"] = 3; - return values; - })(); - - /** - * DnsScope enum. - * @name google.cloud.sql.v1beta4.DnsNameMapping.DnsScope - * @enum {number} - * @property {number} DNS_SCOPE_UNSPECIFIED=0 DNS_SCOPE_UNSPECIFIED value - * @property {number} INSTANCE=1 INSTANCE value - * @property {number} CLUSTER=2 CLUSTER value - */ - DnsNameMapping.DnsScope = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DNS_SCOPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "INSTANCE"] = 1; - values[valuesById[2] = "CLUSTER"] = 2; - return values; - })(); - - /** - * RecordManager enum. - * @name google.cloud.sql.v1beta4.DnsNameMapping.RecordManager - * @enum {number} - * @property {number} RECORD_MANAGER_UNSPECIFIED=0 RECORD_MANAGER_UNSPECIFIED value - * @property {number} CUSTOMER=1 CUSTOMER value - * @property {number} CLOUD_SQL_AUTOMATION=2 CLOUD_SQL_AUTOMATION value - */ - DnsNameMapping.RecordManager = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RECORD_MANAGER_UNSPECIFIED"] = 0; - values[valuesById[1] = "CUSTOMER"] = 1; - values[valuesById[2] = "CLOUD_SQL_AUTOMATION"] = 2; - return values; - })(); - - return DnsNameMapping; - })(); - - v1beta4.GeminiInstanceConfig = (function() { - - /** - * Properties of a GeminiInstanceConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IGeminiInstanceConfig - * @property {boolean|null} [entitled] GeminiInstanceConfig entitled - * @property {boolean|null} [googleVacuumMgmtEnabled] GeminiInstanceConfig googleVacuumMgmtEnabled - * @property {boolean|null} [oomSessionCancelEnabled] GeminiInstanceConfig oomSessionCancelEnabled - * @property {boolean|null} [activeQueryEnabled] GeminiInstanceConfig activeQueryEnabled - * @property {boolean|null} [indexAdvisorEnabled] GeminiInstanceConfig indexAdvisorEnabled - * @property {boolean|null} [flagRecommenderEnabled] GeminiInstanceConfig flagRecommenderEnabled - */ - - /** - * Constructs a new GeminiInstanceConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a GeminiInstanceConfig. - * @implements IGeminiInstanceConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IGeminiInstanceConfig=} [properties] Properties to set - */ - function GeminiInstanceConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GeminiInstanceConfig entitled. - * @member {boolean|null|undefined} entitled - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.entitled = null; - - /** - * GeminiInstanceConfig googleVacuumMgmtEnabled. - * @member {boolean|null|undefined} googleVacuumMgmtEnabled - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.googleVacuumMgmtEnabled = null; - - /** - * GeminiInstanceConfig oomSessionCancelEnabled. - * @member {boolean|null|undefined} oomSessionCancelEnabled - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.oomSessionCancelEnabled = null; - - /** - * GeminiInstanceConfig activeQueryEnabled. - * @member {boolean|null|undefined} activeQueryEnabled - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.activeQueryEnabled = null; - - /** - * GeminiInstanceConfig indexAdvisorEnabled. - * @member {boolean|null|undefined} indexAdvisorEnabled - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.indexAdvisorEnabled = null; - - /** - * GeminiInstanceConfig flagRecommenderEnabled. - * @member {boolean|null|undefined} flagRecommenderEnabled - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @instance - */ - GeminiInstanceConfig.prototype.flagRecommenderEnabled = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_entitled", { - get: $util.oneOfGetter($oneOfFields = ["entitled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_googleVacuumMgmtEnabled", { - get: $util.oneOfGetter($oneOfFields = ["googleVacuumMgmtEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_oomSessionCancelEnabled", { - get: $util.oneOfGetter($oneOfFields = ["oomSessionCancelEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_activeQueryEnabled", { - get: $util.oneOfGetter($oneOfFields = ["activeQueryEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_indexAdvisorEnabled", { - get: $util.oneOfGetter($oneOfFields = ["indexAdvisorEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(GeminiInstanceConfig.prototype, "_flagRecommenderEnabled", { - get: $util.oneOfGetter($oneOfFields = ["flagRecommenderEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new GeminiInstanceConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @static - * @param {google.cloud.sql.v1beta4.IGeminiInstanceConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.GeminiInstanceConfig} GeminiInstanceConfig instance - */ - GeminiInstanceConfig.create = function create(properties) { - return new GeminiInstanceConfig(properties); - }; - - /** - * Encodes the specified GeminiInstanceConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.GeminiInstanceConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @static - * @param {google.cloud.sql.v1beta4.IGeminiInstanceConfig} message GeminiInstanceConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GeminiInstanceConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.entitled != null && Object.hasOwnProperty.call(message, "entitled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.entitled); - if (message.googleVacuumMgmtEnabled != null && Object.hasOwnProperty.call(message, "googleVacuumMgmtEnabled")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.googleVacuumMgmtEnabled); - if (message.oomSessionCancelEnabled != null && Object.hasOwnProperty.call(message, "oomSessionCancelEnabled")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.oomSessionCancelEnabled); - if (message.activeQueryEnabled != null && Object.hasOwnProperty.call(message, "activeQueryEnabled")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.activeQueryEnabled); - if (message.indexAdvisorEnabled != null && Object.hasOwnProperty.call(message, "indexAdvisorEnabled")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.indexAdvisorEnabled); - if (message.flagRecommenderEnabled != null && Object.hasOwnProperty.call(message, "flagRecommenderEnabled")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.flagRecommenderEnabled); - return writer; - }; - - /** - * Encodes the specified GeminiInstanceConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GeminiInstanceConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @static - * @param {google.cloud.sql.v1beta4.IGeminiInstanceConfig} message GeminiInstanceConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GeminiInstanceConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GeminiInstanceConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.GeminiInstanceConfig} GeminiInstanceConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GeminiInstanceConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.GeminiInstanceConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.entitled = reader.bool(); - break; - } - case 2: { - message.googleVacuumMgmtEnabled = reader.bool(); - break; - } - case 3: { - message.oomSessionCancelEnabled = reader.bool(); - break; - } - case 4: { - message.activeQueryEnabled = reader.bool(); - break; - } - case 5: { - message.indexAdvisorEnabled = reader.bool(); - break; - } - case 6: { - message.flagRecommenderEnabled = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GeminiInstanceConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.GeminiInstanceConfig} GeminiInstanceConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GeminiInstanceConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GeminiInstanceConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GeminiInstanceConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.entitled != null && message.hasOwnProperty("entitled")) { - properties._entitled = 1; - if (typeof message.entitled !== "boolean") - return "entitled: boolean expected"; - } - if (message.googleVacuumMgmtEnabled != null && message.hasOwnProperty("googleVacuumMgmtEnabled")) { - properties._googleVacuumMgmtEnabled = 1; - if (typeof message.googleVacuumMgmtEnabled !== "boolean") - return "googleVacuumMgmtEnabled: boolean expected"; - } - if (message.oomSessionCancelEnabled != null && message.hasOwnProperty("oomSessionCancelEnabled")) { - properties._oomSessionCancelEnabled = 1; - if (typeof message.oomSessionCancelEnabled !== "boolean") - return "oomSessionCancelEnabled: boolean expected"; - } - if (message.activeQueryEnabled != null && message.hasOwnProperty("activeQueryEnabled")) { - properties._activeQueryEnabled = 1; - if (typeof message.activeQueryEnabled !== "boolean") - return "activeQueryEnabled: boolean expected"; - } - if (message.indexAdvisorEnabled != null && message.hasOwnProperty("indexAdvisorEnabled")) { - properties._indexAdvisorEnabled = 1; - if (typeof message.indexAdvisorEnabled !== "boolean") - return "indexAdvisorEnabled: boolean expected"; - } - if (message.flagRecommenderEnabled != null && message.hasOwnProperty("flagRecommenderEnabled")) { - properties._flagRecommenderEnabled = 1; - if (typeof message.flagRecommenderEnabled !== "boolean") - return "flagRecommenderEnabled: boolean expected"; - } - return null; - }; - - /** - * Creates a GeminiInstanceConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.GeminiInstanceConfig} GeminiInstanceConfig - */ - GeminiInstanceConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.GeminiInstanceConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.GeminiInstanceConfig(); - if (object.entitled != null) - message.entitled = Boolean(object.entitled); - if (object.googleVacuumMgmtEnabled != null) - message.googleVacuumMgmtEnabled = Boolean(object.googleVacuumMgmtEnabled); - if (object.oomSessionCancelEnabled != null) - message.oomSessionCancelEnabled = Boolean(object.oomSessionCancelEnabled); - if (object.activeQueryEnabled != null) - message.activeQueryEnabled = Boolean(object.activeQueryEnabled); - if (object.indexAdvisorEnabled != null) - message.indexAdvisorEnabled = Boolean(object.indexAdvisorEnabled); - if (object.flagRecommenderEnabled != null) - message.flagRecommenderEnabled = Boolean(object.flagRecommenderEnabled); - return message; - }; - - /** - * Creates a plain object from a GeminiInstanceConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @static - * @param {google.cloud.sql.v1beta4.GeminiInstanceConfig} message GeminiInstanceConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GeminiInstanceConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.entitled != null && message.hasOwnProperty("entitled")) { - object.entitled = message.entitled; - if (options.oneofs) - object._entitled = "entitled"; - } - if (message.googleVacuumMgmtEnabled != null && message.hasOwnProperty("googleVacuumMgmtEnabled")) { - object.googleVacuumMgmtEnabled = message.googleVacuumMgmtEnabled; - if (options.oneofs) - object._googleVacuumMgmtEnabled = "googleVacuumMgmtEnabled"; - } - if (message.oomSessionCancelEnabled != null && message.hasOwnProperty("oomSessionCancelEnabled")) { - object.oomSessionCancelEnabled = message.oomSessionCancelEnabled; - if (options.oneofs) - object._oomSessionCancelEnabled = "oomSessionCancelEnabled"; - } - if (message.activeQueryEnabled != null && message.hasOwnProperty("activeQueryEnabled")) { - object.activeQueryEnabled = message.activeQueryEnabled; - if (options.oneofs) - object._activeQueryEnabled = "activeQueryEnabled"; - } - if (message.indexAdvisorEnabled != null && message.hasOwnProperty("indexAdvisorEnabled")) { - object.indexAdvisorEnabled = message.indexAdvisorEnabled; - if (options.oneofs) - object._indexAdvisorEnabled = "indexAdvisorEnabled"; - } - if (message.flagRecommenderEnabled != null && message.hasOwnProperty("flagRecommenderEnabled")) { - object.flagRecommenderEnabled = message.flagRecommenderEnabled; - if (options.oneofs) - object._flagRecommenderEnabled = "flagRecommenderEnabled"; - } - return object; - }; - - /** - * Converts this GeminiInstanceConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @instance - * @returns {Object.} JSON object - */ - GeminiInstanceConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GeminiInstanceConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.GeminiInstanceConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GeminiInstanceConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.GeminiInstanceConfig"; - }; - - return GeminiInstanceConfig; - })(); - - v1beta4.ReplicationCluster = (function() { - - /** - * Properties of a ReplicationCluster. - * @memberof google.cloud.sql.v1beta4 - * @interface IReplicationCluster - * @property {string|null} [psaWriteEndpoint] ReplicationCluster psaWriteEndpoint - * @property {string|null} [failoverDrReplicaName] ReplicationCluster failoverDrReplicaName - * @property {boolean|null} [drReplica] ReplicationCluster drReplica - */ - - /** - * Constructs a new ReplicationCluster. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a ReplicationCluster. - * @implements IReplicationCluster - * @constructor - * @param {google.cloud.sql.v1beta4.IReplicationCluster=} [properties] Properties to set - */ - function ReplicationCluster(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReplicationCluster psaWriteEndpoint. - * @member {string|null|undefined} psaWriteEndpoint - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @instance - */ - ReplicationCluster.prototype.psaWriteEndpoint = null; - - /** - * ReplicationCluster failoverDrReplicaName. - * @member {string|null|undefined} failoverDrReplicaName - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @instance - */ - ReplicationCluster.prototype.failoverDrReplicaName = null; - - /** - * ReplicationCluster drReplica. - * @member {boolean|null|undefined} drReplica - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @instance - */ - ReplicationCluster.prototype.drReplica = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReplicationCluster.prototype, "_psaWriteEndpoint", { - get: $util.oneOfGetter($oneOfFields = ["psaWriteEndpoint"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReplicationCluster.prototype, "_failoverDrReplicaName", { - get: $util.oneOfGetter($oneOfFields = ["failoverDrReplicaName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReplicationCluster.prototype, "_drReplica", { - get: $util.oneOfGetter($oneOfFields = ["drReplica"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ReplicationCluster instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @static - * @param {google.cloud.sql.v1beta4.IReplicationCluster=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ReplicationCluster} ReplicationCluster instance - */ - ReplicationCluster.create = function create(properties) { - return new ReplicationCluster(properties); - }; - - /** - * Encodes the specified ReplicationCluster message. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicationCluster.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @static - * @param {google.cloud.sql.v1beta4.IReplicationCluster} message ReplicationCluster message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReplicationCluster.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.psaWriteEndpoint != null && Object.hasOwnProperty.call(message, "psaWriteEndpoint")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.psaWriteEndpoint); - if (message.failoverDrReplicaName != null && Object.hasOwnProperty.call(message, "failoverDrReplicaName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.failoverDrReplicaName); - if (message.drReplica != null && Object.hasOwnProperty.call(message, "drReplica")) - writer.uint32(/* id 4, wireType 0 =*/32).bool(message.drReplica); - return writer; - }; - - /** - * Encodes the specified ReplicationCluster message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicationCluster.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @static - * @param {google.cloud.sql.v1beta4.IReplicationCluster} message ReplicationCluster message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReplicationCluster.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReplicationCluster message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ReplicationCluster} ReplicationCluster - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplicationCluster.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ReplicationCluster(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.psaWriteEndpoint = reader.string(); - break; - } - case 2: { - message.failoverDrReplicaName = reader.string(); - break; - } - case 4: { - message.drReplica = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReplicationCluster message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ReplicationCluster} ReplicationCluster - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplicationCluster.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReplicationCluster message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReplicationCluster.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.psaWriteEndpoint != null && message.hasOwnProperty("psaWriteEndpoint")) { - properties._psaWriteEndpoint = 1; - if (!$util.isString(message.psaWriteEndpoint)) - return "psaWriteEndpoint: string expected"; - } - if (message.failoverDrReplicaName != null && message.hasOwnProperty("failoverDrReplicaName")) { - properties._failoverDrReplicaName = 1; - if (!$util.isString(message.failoverDrReplicaName)) - return "failoverDrReplicaName: string expected"; - } - if (message.drReplica != null && message.hasOwnProperty("drReplica")) { - properties._drReplica = 1; - if (typeof message.drReplica !== "boolean") - return "drReplica: boolean expected"; - } - return null; - }; - - /** - * Creates a ReplicationCluster message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ReplicationCluster} ReplicationCluster - */ - ReplicationCluster.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ReplicationCluster) - return object; - var message = new $root.google.cloud.sql.v1beta4.ReplicationCluster(); - if (object.psaWriteEndpoint != null) - message.psaWriteEndpoint = String(object.psaWriteEndpoint); - if (object.failoverDrReplicaName != null) - message.failoverDrReplicaName = String(object.failoverDrReplicaName); - if (object.drReplica != null) - message.drReplica = Boolean(object.drReplica); - return message; - }; - - /** - * Creates a plain object from a ReplicationCluster message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @static - * @param {google.cloud.sql.v1beta4.ReplicationCluster} message ReplicationCluster - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReplicationCluster.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.psaWriteEndpoint != null && message.hasOwnProperty("psaWriteEndpoint")) { - object.psaWriteEndpoint = message.psaWriteEndpoint; - if (options.oneofs) - object._psaWriteEndpoint = "psaWriteEndpoint"; - } - if (message.failoverDrReplicaName != null && message.hasOwnProperty("failoverDrReplicaName")) { - object.failoverDrReplicaName = message.failoverDrReplicaName; - if (options.oneofs) - object._failoverDrReplicaName = "failoverDrReplicaName"; - } - if (message.drReplica != null && message.hasOwnProperty("drReplica")) { - object.drReplica = message.drReplica; - if (options.oneofs) - object._drReplica = "drReplica"; - } - return object; - }; - - /** - * Converts this ReplicationCluster to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @instance - * @returns {Object.} JSON object - */ - ReplicationCluster.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReplicationCluster - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ReplicationCluster - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReplicationCluster.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ReplicationCluster"; - }; - - return ReplicationCluster; - })(); - - v1beta4.AvailableDatabaseVersion = (function() { - - /** - * Properties of an AvailableDatabaseVersion. - * @memberof google.cloud.sql.v1beta4 - * @interface IAvailableDatabaseVersion - * @property {string|null} [majorVersion] AvailableDatabaseVersion majorVersion - * @property {string|null} [name] AvailableDatabaseVersion name - * @property {string|null} [displayName] AvailableDatabaseVersion displayName - */ - - /** - * Constructs a new AvailableDatabaseVersion. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an AvailableDatabaseVersion. - * @implements IAvailableDatabaseVersion - * @constructor - * @param {google.cloud.sql.v1beta4.IAvailableDatabaseVersion=} [properties] Properties to set - */ - function AvailableDatabaseVersion(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AvailableDatabaseVersion majorVersion. - * @member {string|null|undefined} majorVersion - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @instance - */ - AvailableDatabaseVersion.prototype.majorVersion = null; - - /** - * AvailableDatabaseVersion name. - * @member {string|null|undefined} name - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @instance - */ - AvailableDatabaseVersion.prototype.name = null; - - /** - * AvailableDatabaseVersion displayName. - * @member {string|null|undefined} displayName - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @instance - */ - AvailableDatabaseVersion.prototype.displayName = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AvailableDatabaseVersion.prototype, "_majorVersion", { - get: $util.oneOfGetter($oneOfFields = ["majorVersion"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AvailableDatabaseVersion.prototype, "_name", { - get: $util.oneOfGetter($oneOfFields = ["name"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AvailableDatabaseVersion.prototype, "_displayName", { - get: $util.oneOfGetter($oneOfFields = ["displayName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new AvailableDatabaseVersion instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @static - * @param {google.cloud.sql.v1beta4.IAvailableDatabaseVersion=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.AvailableDatabaseVersion} AvailableDatabaseVersion instance - */ - AvailableDatabaseVersion.create = function create(properties) { - return new AvailableDatabaseVersion(properties); - }; - - /** - * Encodes the specified AvailableDatabaseVersion message. Does not implicitly {@link google.cloud.sql.v1beta4.AvailableDatabaseVersion.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @static - * @param {google.cloud.sql.v1beta4.IAvailableDatabaseVersion} message AvailableDatabaseVersion message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AvailableDatabaseVersion.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.majorVersion != null && Object.hasOwnProperty.call(message, "majorVersion")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.majorVersion); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.name); - if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.displayName); - return writer; - }; - - /** - * Encodes the specified AvailableDatabaseVersion message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AvailableDatabaseVersion.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @static - * @param {google.cloud.sql.v1beta4.IAvailableDatabaseVersion} message AvailableDatabaseVersion message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AvailableDatabaseVersion.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AvailableDatabaseVersion message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.AvailableDatabaseVersion} AvailableDatabaseVersion - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AvailableDatabaseVersion.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 3: { - message.majorVersion = reader.string(); - break; - } - case 8: { - message.name = reader.string(); - break; - } - case 9: { - message.displayName = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AvailableDatabaseVersion message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.AvailableDatabaseVersion} AvailableDatabaseVersion - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AvailableDatabaseVersion.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AvailableDatabaseVersion message. - * @function verify - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AvailableDatabaseVersion.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.majorVersion != null && message.hasOwnProperty("majorVersion")) { - properties._majorVersion = 1; - if (!$util.isString(message.majorVersion)) - return "majorVersion: string expected"; - } - if (message.name != null && message.hasOwnProperty("name")) { - properties._name = 1; - if (!$util.isString(message.name)) - return "name: string expected"; - } - if (message.displayName != null && message.hasOwnProperty("displayName")) { - properties._displayName = 1; - if (!$util.isString(message.displayName)) - return "displayName: string expected"; - } - return null; - }; - - /** - * Creates an AvailableDatabaseVersion message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.AvailableDatabaseVersion} AvailableDatabaseVersion - */ - AvailableDatabaseVersion.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion) - return object; - var message = new $root.google.cloud.sql.v1beta4.AvailableDatabaseVersion(); - if (object.majorVersion != null) - message.majorVersion = String(object.majorVersion); - if (object.name != null) - message.name = String(object.name); - if (object.displayName != null) - message.displayName = String(object.displayName); - return message; - }; - - /** - * Creates a plain object from an AvailableDatabaseVersion message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @static - * @param {google.cloud.sql.v1beta4.AvailableDatabaseVersion} message AvailableDatabaseVersion - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AvailableDatabaseVersion.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.majorVersion != null && message.hasOwnProperty("majorVersion")) { - object.majorVersion = message.majorVersion; - if (options.oneofs) - object._majorVersion = "majorVersion"; - } - if (message.name != null && message.hasOwnProperty("name")) { - object.name = message.name; - if (options.oneofs) - object._name = "name"; - } - if (message.displayName != null && message.hasOwnProperty("displayName")) { - object.displayName = message.displayName; - if (options.oneofs) - object._displayName = "displayName"; - } - return object; - }; - - /** - * Converts this AvailableDatabaseVersion to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @instance - * @returns {Object.} JSON object - */ - AvailableDatabaseVersion.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AvailableDatabaseVersion - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.AvailableDatabaseVersion - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AvailableDatabaseVersion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.AvailableDatabaseVersion"; - }; - - return AvailableDatabaseVersion; - })(); - - v1beta4.DatabasesListResponse = (function() { - - /** - * Properties of a DatabasesListResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IDatabasesListResponse - * @property {string|null} [kind] DatabasesListResponse kind - * @property {Array.|null} [items] DatabasesListResponse items - */ - - /** - * Constructs a new DatabasesListResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DatabasesListResponse. - * @implements IDatabasesListResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IDatabasesListResponse=} [properties] Properties to set - */ - function DatabasesListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DatabasesListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @instance - */ - DatabasesListResponse.prototype.kind = ""; - - /** - * DatabasesListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @instance - */ - DatabasesListResponse.prototype.items = $util.emptyArray; - - /** - * Creates a new DatabasesListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @static - * @param {google.cloud.sql.v1beta4.IDatabasesListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DatabasesListResponse} DatabasesListResponse instance - */ - DatabasesListResponse.create = function create(properties) { - return new DatabasesListResponse(properties); - }; - - /** - * Encodes the specified DatabasesListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.DatabasesListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @static - * @param {google.cloud.sql.v1beta4.IDatabasesListResponse} message DatabasesListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabasesListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1beta4.Database.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DatabasesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DatabasesListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @static - * @param {google.cloud.sql.v1beta4.IDatabasesListResponse} message DatabasesListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DatabasesListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DatabasesListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DatabasesListResponse} DatabasesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabasesListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DatabasesListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1beta4.Database.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DatabasesListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DatabasesListResponse} DatabasesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DatabasesListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DatabasesListResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DatabasesListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.Database.verify(message.items[i]); - if (error) - return "items." + error; - } - } - return null; - }; - - /** - * Creates a DatabasesListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DatabasesListResponse} DatabasesListResponse - */ - DatabasesListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DatabasesListResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.DatabasesListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1beta4.DatabasesListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DatabasesListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1beta4.Database.fromObject(object.items[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a DatabasesListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @static - * @param {google.cloud.sql.v1beta4.DatabasesListResponse} message DatabasesListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DatabasesListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1beta4.Database.toObject(message.items[j], options); - } - return object; - }; - - /** - * Converts this DatabasesListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @instance - * @returns {Object.} JSON object - */ - DatabasesListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DatabasesListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DatabasesListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DatabasesListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DatabasesListResponse"; - }; - - return DatabasesListResponse; - })(); - - v1beta4.DemoteMasterConfiguration = (function() { - - /** - * Properties of a DemoteMasterConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @interface IDemoteMasterConfiguration - * @property {string|null} [kind] DemoteMasterConfiguration kind - * @property {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration|null} [mysqlReplicaConfiguration] DemoteMasterConfiguration mysqlReplicaConfiguration - */ - - /** - * Constructs a new DemoteMasterConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DemoteMasterConfiguration. - * @implements IDemoteMasterConfiguration - * @constructor - * @param {google.cloud.sql.v1beta4.IDemoteMasterConfiguration=} [properties] Properties to set - */ - function DemoteMasterConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DemoteMasterConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @instance - */ - DemoteMasterConfiguration.prototype.kind = ""; - - /** - * DemoteMasterConfiguration mysqlReplicaConfiguration. - * @member {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration|null|undefined} mysqlReplicaConfiguration - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @instance - */ - DemoteMasterConfiguration.prototype.mysqlReplicaConfiguration = null; - - /** - * Creates a new DemoteMasterConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IDemoteMasterConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DemoteMasterConfiguration} DemoteMasterConfiguration instance - */ - DemoteMasterConfiguration.create = function create(properties) { - return new DemoteMasterConfiguration(properties); - }; - - /** - * Encodes the specified DemoteMasterConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IDemoteMasterConfiguration} message DemoteMasterConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.mysqlReplicaConfiguration != null && Object.hasOwnProperty.call(message, "mysqlReplicaConfiguration")) - $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.encode(message.mysqlReplicaConfiguration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified DemoteMasterConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IDemoteMasterConfiguration} message DemoteMasterConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DemoteMasterConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DemoteMasterConfiguration} DemoteMasterConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DemoteMasterConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DemoteMasterConfiguration} DemoteMasterConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DemoteMasterConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DemoteMasterConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) { - var error = $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.verify(message.mysqlReplicaConfiguration); - if (error) - return "mysqlReplicaConfiguration." + error; - } - return null; - }; - - /** - * Creates a DemoteMasterConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DemoteMasterConfiguration} DemoteMasterConfiguration - */ - DemoteMasterConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration) - return object; - var message = new $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.mysqlReplicaConfiguration != null) { - if (typeof object.mysqlReplicaConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DemoteMasterConfiguration.mysqlReplicaConfiguration: object expected"); - message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.fromObject(object.mysqlReplicaConfiguration); - } - return message; - }; - - /** - * Creates a plain object from a DemoteMasterConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @static - * @param {google.cloud.sql.v1beta4.DemoteMasterConfiguration} message DemoteMasterConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DemoteMasterConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.mysqlReplicaConfiguration = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) - object.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.toObject(message.mysqlReplicaConfiguration, options); - return object; - }; - - /** - * Converts this DemoteMasterConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @instance - * @returns {Object.} JSON object - */ - DemoteMasterConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DemoteMasterConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DemoteMasterConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DemoteMasterConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DemoteMasterConfiguration"; - }; - - return DemoteMasterConfiguration; - })(); - - v1beta4.DemoteMasterContext = (function() { - - /** - * Properties of a DemoteMasterContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IDemoteMasterContext - * @property {string|null} [kind] DemoteMasterContext kind - * @property {google.protobuf.IBoolValue|null} [verifyGtidConsistency] DemoteMasterContext verifyGtidConsistency - * @property {string|null} [masterInstanceName] DemoteMasterContext masterInstanceName - * @property {google.cloud.sql.v1beta4.IDemoteMasterConfiguration|null} [replicaConfiguration] DemoteMasterContext replicaConfiguration - * @property {boolean|null} [skipReplicationSetup] DemoteMasterContext skipReplicationSetup - */ - - /** - * Constructs a new DemoteMasterContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DemoteMasterContext. - * @implements IDemoteMasterContext - * @constructor - * @param {google.cloud.sql.v1beta4.IDemoteMasterContext=} [properties] Properties to set - */ - function DemoteMasterContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DemoteMasterContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @instance - */ - DemoteMasterContext.prototype.kind = ""; - - /** - * DemoteMasterContext verifyGtidConsistency. - * @member {google.protobuf.IBoolValue|null|undefined} verifyGtidConsistency - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @instance - */ - DemoteMasterContext.prototype.verifyGtidConsistency = null; - - /** - * DemoteMasterContext masterInstanceName. - * @member {string} masterInstanceName - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @instance - */ - DemoteMasterContext.prototype.masterInstanceName = ""; - - /** - * DemoteMasterContext replicaConfiguration. - * @member {google.cloud.sql.v1beta4.IDemoteMasterConfiguration|null|undefined} replicaConfiguration - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @instance - */ - DemoteMasterContext.prototype.replicaConfiguration = null; - - /** - * DemoteMasterContext skipReplicationSetup. - * @member {boolean} skipReplicationSetup - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @instance - */ - DemoteMasterContext.prototype.skipReplicationSetup = false; - - /** - * Creates a new DemoteMasterContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @static - * @param {google.cloud.sql.v1beta4.IDemoteMasterContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DemoteMasterContext} DemoteMasterContext instance - */ - DemoteMasterContext.create = function create(properties) { - return new DemoteMasterContext(properties); - }; - - /** - * Encodes the specified DemoteMasterContext message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @static - * @param {google.cloud.sql.v1beta4.IDemoteMasterContext} message DemoteMasterContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.verifyGtidConsistency != null && Object.hasOwnProperty.call(message, "verifyGtidConsistency")) - $root.google.protobuf.BoolValue.encode(message.verifyGtidConsistency, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.masterInstanceName != null && Object.hasOwnProperty.call(message, "masterInstanceName")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.masterInstanceName); - if (message.replicaConfiguration != null && Object.hasOwnProperty.call(message, "replicaConfiguration")) - $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration.encode(message.replicaConfiguration, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.skipReplicationSetup != null && Object.hasOwnProperty.call(message, "skipReplicationSetup")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.skipReplicationSetup); - return writer; - }; - - /** - * Encodes the specified DemoteMasterContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @static - * @param {google.cloud.sql.v1beta4.IDemoteMasterContext} message DemoteMasterContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DemoteMasterContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DemoteMasterContext} DemoteMasterContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DemoteMasterContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.verifyGtidConsistency = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 3: { - message.masterInstanceName = reader.string(); - break; - } - case 4: { - message.replicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration.decode(reader, reader.uint32()); - break; - } - case 5: { - message.skipReplicationSetup = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DemoteMasterContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DemoteMasterContext} DemoteMasterContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DemoteMasterContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DemoteMasterContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.verifyGtidConsistency != null && message.hasOwnProperty("verifyGtidConsistency")) { - var error = $root.google.protobuf.BoolValue.verify(message.verifyGtidConsistency); - if (error) - return "verifyGtidConsistency." + error; - } - if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) - if (!$util.isString(message.masterInstanceName)) - return "masterInstanceName: string expected"; - if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) { - var error = $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration.verify(message.replicaConfiguration); - if (error) - return "replicaConfiguration." + error; - } - if (message.skipReplicationSetup != null && message.hasOwnProperty("skipReplicationSetup")) - if (typeof message.skipReplicationSetup !== "boolean") - return "skipReplicationSetup: boolean expected"; - return null; - }; - - /** - * Creates a DemoteMasterContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DemoteMasterContext} DemoteMasterContext - */ - DemoteMasterContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DemoteMasterContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.DemoteMasterContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.verifyGtidConsistency != null) { - if (typeof object.verifyGtidConsistency !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DemoteMasterContext.verifyGtidConsistency: object expected"); - message.verifyGtidConsistency = $root.google.protobuf.BoolValue.fromObject(object.verifyGtidConsistency); - } - if (object.masterInstanceName != null) - message.masterInstanceName = String(object.masterInstanceName); - if (object.replicaConfiguration != null) { - if (typeof object.replicaConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.DemoteMasterContext.replicaConfiguration: object expected"); - message.replicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration.fromObject(object.replicaConfiguration); - } - if (object.skipReplicationSetup != null) - message.skipReplicationSetup = Boolean(object.skipReplicationSetup); - return message; - }; - - /** - * Creates a plain object from a DemoteMasterContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @static - * @param {google.cloud.sql.v1beta4.DemoteMasterContext} message DemoteMasterContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DemoteMasterContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.verifyGtidConsistency = null; - object.masterInstanceName = ""; - object.replicaConfiguration = null; - object.skipReplicationSetup = false; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.verifyGtidConsistency != null && message.hasOwnProperty("verifyGtidConsistency")) - object.verifyGtidConsistency = $root.google.protobuf.BoolValue.toObject(message.verifyGtidConsistency, options); - if (message.masterInstanceName != null && message.hasOwnProperty("masterInstanceName")) - object.masterInstanceName = message.masterInstanceName; - if (message.replicaConfiguration != null && message.hasOwnProperty("replicaConfiguration")) - object.replicaConfiguration = $root.google.cloud.sql.v1beta4.DemoteMasterConfiguration.toObject(message.replicaConfiguration, options); - if (message.skipReplicationSetup != null && message.hasOwnProperty("skipReplicationSetup")) - object.skipReplicationSetup = message.skipReplicationSetup; - return object; - }; - - /** - * Converts this DemoteMasterContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @instance - * @returns {Object.} JSON object - */ - DemoteMasterContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DemoteMasterContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DemoteMasterContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DemoteMasterContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DemoteMasterContext"; - }; - - return DemoteMasterContext; - })(); - - v1beta4.DemoteMasterMySqlReplicaConfiguration = (function() { - - /** - * Properties of a DemoteMasterMySqlReplicaConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @interface IDemoteMasterMySqlReplicaConfiguration - * @property {string|null} [kind] DemoteMasterMySqlReplicaConfiguration kind - * @property {string|null} [username] DemoteMasterMySqlReplicaConfiguration username - * @property {string|null} [password] DemoteMasterMySqlReplicaConfiguration password - * @property {string|null} [clientKey] DemoteMasterMySqlReplicaConfiguration clientKey - * @property {string|null} [clientCertificate] DemoteMasterMySqlReplicaConfiguration clientCertificate - * @property {string|null} [caCertificate] DemoteMasterMySqlReplicaConfiguration caCertificate - */ - - /** - * Constructs a new DemoteMasterMySqlReplicaConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DemoteMasterMySqlReplicaConfiguration. - * @implements IDemoteMasterMySqlReplicaConfiguration - * @constructor - * @param {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration=} [properties] Properties to set - */ - function DemoteMasterMySqlReplicaConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DemoteMasterMySqlReplicaConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.kind = ""; - - /** - * DemoteMasterMySqlReplicaConfiguration username. - * @member {string} username - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.username = ""; - - /** - * DemoteMasterMySqlReplicaConfiguration password. - * @member {string} password - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.password = ""; - - /** - * DemoteMasterMySqlReplicaConfiguration clientKey. - * @member {string} clientKey - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.clientKey = ""; - - /** - * DemoteMasterMySqlReplicaConfiguration clientCertificate. - * @member {string} clientCertificate - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.clientCertificate = ""; - - /** - * DemoteMasterMySqlReplicaConfiguration caCertificate. - * @member {string} caCertificate - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @instance - */ - DemoteMasterMySqlReplicaConfiguration.prototype.caCertificate = ""; - - /** - * Creates a new DemoteMasterMySqlReplicaConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration instance - */ - DemoteMasterMySqlReplicaConfiguration.create = function create(properties) { - return new DemoteMasterMySqlReplicaConfiguration(properties); - }; - - /** - * Encodes the specified DemoteMasterMySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterMySqlReplicaConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.username != null && Object.hasOwnProperty.call(message, "username")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); - if (message.password != null && Object.hasOwnProperty.call(message, "password")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); - if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.clientKey); - if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.clientCertificate); - if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.caCertificate); - return writer; - }; - - /** - * Encodes the specified DemoteMasterMySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IDemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteMasterMySqlReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterMySqlReplicaConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.username = reader.string(); - break; - } - case 3: { - message.password = reader.string(); - break; - } - case 4: { - message.clientKey = reader.string(); - break; - } - case 5: { - message.clientCertificate = reader.string(); - break; - } - case 6: { - message.caCertificate = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DemoteMasterMySqlReplicaConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteMasterMySqlReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DemoteMasterMySqlReplicaConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DemoteMasterMySqlReplicaConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.username != null && message.hasOwnProperty("username")) - if (!$util.isString(message.username)) - return "username: string expected"; - if (message.password != null && message.hasOwnProperty("password")) - if (!$util.isString(message.password)) - return "password: string expected"; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - if (!$util.isString(message.clientKey)) - return "clientKey: string expected"; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - if (!$util.isString(message.clientCertificate)) - return "clientCertificate: string expected"; - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - if (!$util.isString(message.caCertificate)) - return "caCertificate: string expected"; - return null; - }; - - /** - * Creates a DemoteMasterMySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration} DemoteMasterMySqlReplicaConfiguration - */ - DemoteMasterMySqlReplicaConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration) - return object; - var message = new $root.google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.username != null) - message.username = String(object.username); - if (object.password != null) - message.password = String(object.password); - if (object.clientKey != null) - message.clientKey = String(object.clientKey); - if (object.clientCertificate != null) - message.clientCertificate = String(object.clientCertificate); - if (object.caCertificate != null) - message.caCertificate = String(object.caCertificate); - return message; - }; - - /** - * Creates a plain object from a DemoteMasterMySqlReplicaConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration} message DemoteMasterMySqlReplicaConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DemoteMasterMySqlReplicaConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.username = ""; - object.password = ""; - object.clientKey = ""; - object.clientCertificate = ""; - object.caCertificate = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.username != null && message.hasOwnProperty("username")) - object.username = message.username; - if (message.password != null && message.hasOwnProperty("password")) - object.password = message.password; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - object.clientKey = message.clientKey; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - object.clientCertificate = message.clientCertificate; - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - object.caCertificate = message.caCertificate; - return object; - }; - - /** - * Converts this DemoteMasterMySqlReplicaConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @instance - * @returns {Object.} JSON object - */ - DemoteMasterMySqlReplicaConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DemoteMasterMySqlReplicaConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DemoteMasterMySqlReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DemoteMasterMySqlReplicaConfiguration"; - }; - - return DemoteMasterMySqlReplicaConfiguration; - })(); - - v1beta4.DemoteContext = (function() { - - /** - * Properties of a DemoteContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IDemoteContext - * @property {string|null} [kind] DemoteContext kind - * @property {string|null} [sourceRepresentativeInstanceName] DemoteContext sourceRepresentativeInstanceName - */ - - /** - * Constructs a new DemoteContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DemoteContext. - * @implements IDemoteContext - * @constructor - * @param {google.cloud.sql.v1beta4.IDemoteContext=} [properties] Properties to set - */ - function DemoteContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DemoteContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @instance - */ - DemoteContext.prototype.kind = ""; - - /** - * DemoteContext sourceRepresentativeInstanceName. - * @member {string} sourceRepresentativeInstanceName - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @instance - */ - DemoteContext.prototype.sourceRepresentativeInstanceName = ""; - - /** - * Creates a new DemoteContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @static - * @param {google.cloud.sql.v1beta4.IDemoteContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DemoteContext} DemoteContext instance - */ - DemoteContext.create = function create(properties) { - return new DemoteContext(properties); - }; - - /** - * Encodes the specified DemoteContext message. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @static - * @param {google.cloud.sql.v1beta4.IDemoteContext} message DemoteContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.sourceRepresentativeInstanceName != null && Object.hasOwnProperty.call(message, "sourceRepresentativeInstanceName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceRepresentativeInstanceName); - return writer; - }; - - /** - * Encodes the specified DemoteContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DemoteContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @static - * @param {google.cloud.sql.v1beta4.IDemoteContext} message DemoteContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DemoteContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DemoteContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DemoteContext} DemoteContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DemoteContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.sourceRepresentativeInstanceName = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DemoteContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DemoteContext} DemoteContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DemoteContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DemoteContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DemoteContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.sourceRepresentativeInstanceName != null && message.hasOwnProperty("sourceRepresentativeInstanceName")) - if (!$util.isString(message.sourceRepresentativeInstanceName)) - return "sourceRepresentativeInstanceName: string expected"; - return null; - }; - - /** - * Creates a DemoteContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DemoteContext} DemoteContext - */ - DemoteContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DemoteContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.DemoteContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.sourceRepresentativeInstanceName != null) - message.sourceRepresentativeInstanceName = String(object.sourceRepresentativeInstanceName); - return message; - }; - - /** - * Creates a plain object from a DemoteContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @static - * @param {google.cloud.sql.v1beta4.DemoteContext} message DemoteContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DemoteContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.sourceRepresentativeInstanceName = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.sourceRepresentativeInstanceName != null && message.hasOwnProperty("sourceRepresentativeInstanceName")) - object.sourceRepresentativeInstanceName = message.sourceRepresentativeInstanceName; - return object; - }; - - /** - * Converts this DemoteContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @instance - * @returns {Object.} JSON object - */ - DemoteContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DemoteContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DemoteContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DemoteContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DemoteContext"; - }; - - return DemoteContext; - })(); - - /** - * SqlFileType enum. - * @name google.cloud.sql.v1beta4.SqlFileType - * @enum {number} - * @property {number} SQL_FILE_TYPE_UNSPECIFIED=0 SQL_FILE_TYPE_UNSPECIFIED value - * @property {number} SQL=1 SQL value - * @property {number} CSV=2 CSV value - * @property {number} BAK=4 BAK value - * @property {number} TDE=8 TDE value - */ - v1beta4.SqlFileType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_FILE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SQL"] = 1; - values[valuesById[2] = "CSV"] = 2; - values[valuesById[4] = "BAK"] = 4; - values[valuesById[8] = "TDE"] = 8; - return values; - })(); - - v1beta4.ExportContext = (function() { - - /** - * Properties of an ExportContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IExportContext - * @property {string|null} [uri] ExportContext uri - * @property {Array.|null} [databases] ExportContext databases - * @property {string|null} [kind] ExportContext kind - * @property {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions|null} [sqlExportOptions] ExportContext sqlExportOptions - * @property {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions|null} [csvExportOptions] ExportContext csvExportOptions - * @property {google.cloud.sql.v1beta4.SqlFileType|null} [fileType] ExportContext fileType - * @property {google.protobuf.IBoolValue|null} [offload] ExportContext offload - * @property {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions|null} [bakExportOptions] ExportContext bakExportOptions - * @property {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions|null} [tdeExportOptions] ExportContext tdeExportOptions - */ - - /** - * Constructs a new ExportContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an ExportContext. - * @implements IExportContext - * @constructor - * @param {google.cloud.sql.v1beta4.IExportContext=} [properties] Properties to set - */ - function ExportContext(properties) { - this.databases = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExportContext uri. - * @member {string} uri - * @memberof google.cloud.sql.v1beta4.ExportContext - * @instance - */ - ExportContext.prototype.uri = ""; - - /** - * ExportContext databases. - * @member {Array.} databases - * @memberof google.cloud.sql.v1beta4.ExportContext - * @instance - */ - ExportContext.prototype.databases = $util.emptyArray; - - /** - * ExportContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.ExportContext - * @instance - */ - ExportContext.prototype.kind = ""; - - /** - * ExportContext sqlExportOptions. - * @member {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions|null|undefined} sqlExportOptions - * @memberof google.cloud.sql.v1beta4.ExportContext - * @instance - */ - ExportContext.prototype.sqlExportOptions = null; - - /** - * ExportContext csvExportOptions. - * @member {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions|null|undefined} csvExportOptions - * @memberof google.cloud.sql.v1beta4.ExportContext - * @instance - */ - ExportContext.prototype.csvExportOptions = null; - - /** - * ExportContext fileType. - * @member {google.cloud.sql.v1beta4.SqlFileType} fileType - * @memberof google.cloud.sql.v1beta4.ExportContext - * @instance - */ - ExportContext.prototype.fileType = 0; - - /** - * ExportContext offload. - * @member {google.protobuf.IBoolValue|null|undefined} offload - * @memberof google.cloud.sql.v1beta4.ExportContext - * @instance - */ - ExportContext.prototype.offload = null; - - /** - * ExportContext bakExportOptions. - * @member {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions|null|undefined} bakExportOptions - * @memberof google.cloud.sql.v1beta4.ExportContext - * @instance - */ - ExportContext.prototype.bakExportOptions = null; - - /** - * ExportContext tdeExportOptions. - * @member {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions|null|undefined} tdeExportOptions - * @memberof google.cloud.sql.v1beta4.ExportContext - * @instance - */ - ExportContext.prototype.tdeExportOptions = null; - - /** - * Creates a new ExportContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ExportContext - * @static - * @param {google.cloud.sql.v1beta4.IExportContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ExportContext} ExportContext instance - */ - ExportContext.create = function create(properties) { - return new ExportContext(properties); - }; - - /** - * Encodes the specified ExportContext message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ExportContext - * @static - * @param {google.cloud.sql.v1beta4.IExportContext} message ExportContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.databases != null && message.databases.length) - for (var i = 0; i < message.databases.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.databases[i]); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - if (message.sqlExportOptions != null && Object.hasOwnProperty.call(message, "sqlExportOptions")) - $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.encode(message.sqlExportOptions, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.csvExportOptions != null && Object.hasOwnProperty.call(message, "csvExportOptions")) - $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.encode(message.csvExportOptions, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.fileType != null && Object.hasOwnProperty.call(message, "fileType")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.fileType); - if (message.offload != null && Object.hasOwnProperty.call(message, "offload")) - $root.google.protobuf.BoolValue.encode(message.offload, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.bakExportOptions != null && Object.hasOwnProperty.call(message, "bakExportOptions")) - $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.encode(message.bakExportOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.tdeExportOptions != null && Object.hasOwnProperty.call(message, "tdeExportOptions")) - $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.encode(message.tdeExportOptions, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext - * @static - * @param {google.cloud.sql.v1beta4.IExportContext} message ExportContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExportContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExportContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ExportContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ExportContext} ExportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.uri = reader.string(); - break; - } - case 2: { - if (!(message.databases && message.databases.length)) - message.databases = []; - message.databases.push(reader.string()); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - case 4: { - message.sqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.decode(reader, reader.uint32()); - break; - } - case 5: { - message.csvExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.decode(reader, reader.uint32()); - break; - } - case 6: { - message.fileType = reader.int32(); - break; - } - case 8: { - message.offload = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 9: { - message.bakExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.decode(reader, reader.uint32()); - break; - } - case 10: { - message.tdeExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExportContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ExportContext} ExportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExportContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExportContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ExportContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExportContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.databases != null && message.hasOwnProperty("databases")) { - if (!Array.isArray(message.databases)) - return "databases: array expected"; - for (var i = 0; i < message.databases.length; ++i) - if (!$util.isString(message.databases[i])) - return "databases: string[] expected"; - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.sqlExportOptions != null && message.hasOwnProperty("sqlExportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.verify(message.sqlExportOptions); - if (error) - return "sqlExportOptions." + error; - } - if (message.csvExportOptions != null && message.hasOwnProperty("csvExportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.verify(message.csvExportOptions); - if (error) - return "csvExportOptions." + error; - } - if (message.fileType != null && message.hasOwnProperty("fileType")) - switch (message.fileType) { - default: - return "fileType: enum value expected"; - case 0: - case 1: - case 2: - case 4: - case 8: - break; - } - if (message.offload != null && message.hasOwnProperty("offload")) { - var error = $root.google.protobuf.BoolValue.verify(message.offload); - if (error) - return "offload." + error; - } - if (message.bakExportOptions != null && message.hasOwnProperty("bakExportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.verify(message.bakExportOptions); - if (error) - return "bakExportOptions." + error; - } - if (message.tdeExportOptions != null && message.hasOwnProperty("tdeExportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.verify(message.tdeExportOptions); - if (error) - return "tdeExportOptions." + error; - } - return null; - }; - - /** - * Creates an ExportContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ExportContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ExportContext} ExportContext - */ - ExportContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.ExportContext(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.databases) { - if (!Array.isArray(object.databases)) - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.databases: array expected"); - message.databases = []; - for (var i = 0; i < object.databases.length; ++i) - message.databases[i] = String(object.databases[i]); - } - if (object.kind != null) - message.kind = String(object.kind); - if (object.sqlExportOptions != null) { - if (typeof object.sqlExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.sqlExportOptions: object expected"); - message.sqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.fromObject(object.sqlExportOptions); - } - if (object.csvExportOptions != null) { - if (typeof object.csvExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.csvExportOptions: object expected"); - message.csvExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.fromObject(object.csvExportOptions); - } - switch (object.fileType) { - default: - if (typeof object.fileType === "number") { - message.fileType = object.fileType; - break; - } - break; - case "SQL_FILE_TYPE_UNSPECIFIED": - case 0: - message.fileType = 0; - break; - case "SQL": - case 1: - message.fileType = 1; - break; - case "CSV": - case 2: - message.fileType = 2; - break; - case "BAK": - case 4: - message.fileType = 4; - break; - case "TDE": - case 8: - message.fileType = 8; - break; - } - if (object.offload != null) { - if (typeof object.offload !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.offload: object expected"); - message.offload = $root.google.protobuf.BoolValue.fromObject(object.offload); - } - if (object.bakExportOptions != null) { - if (typeof object.bakExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.bakExportOptions: object expected"); - message.bakExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.fromObject(object.bakExportOptions); - } - if (object.tdeExportOptions != null) { - if (typeof object.tdeExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.tdeExportOptions: object expected"); - message.tdeExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.fromObject(object.tdeExportOptions); - } - return message; - }; - - /** - * Creates a plain object from an ExportContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ExportContext - * @static - * @param {google.cloud.sql.v1beta4.ExportContext} message ExportContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExportContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.databases = []; - if (options.defaults) { - object.uri = ""; - object.kind = ""; - object.sqlExportOptions = null; - object.csvExportOptions = null; - object.fileType = options.enums === String ? "SQL_FILE_TYPE_UNSPECIFIED" : 0; - object.offload = null; - object.bakExportOptions = null; - object.tdeExportOptions = null; - } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.databases && message.databases.length) { - object.databases = []; - for (var j = 0; j < message.databases.length; ++j) - object.databases[j] = message.databases[j]; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.sqlExportOptions != null && message.hasOwnProperty("sqlExportOptions")) - object.sqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.toObject(message.sqlExportOptions, options); - if (message.csvExportOptions != null && message.hasOwnProperty("csvExportOptions")) - object.csvExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.toObject(message.csvExportOptions, options); - if (message.fileType != null && message.hasOwnProperty("fileType")) - object.fileType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlFileType[message.fileType] === undefined ? message.fileType : $root.google.cloud.sql.v1beta4.SqlFileType[message.fileType] : message.fileType; - if (message.offload != null && message.hasOwnProperty("offload")) - object.offload = $root.google.protobuf.BoolValue.toObject(message.offload, options); - if (message.bakExportOptions != null && message.hasOwnProperty("bakExportOptions")) - object.bakExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.toObject(message.bakExportOptions, options); - if (message.tdeExportOptions != null && message.hasOwnProperty("tdeExportOptions")) - object.tdeExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.toObject(message.tdeExportOptions, options); - return object; - }; - - /** - * Converts this ExportContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ExportContext - * @instance - * @returns {Object.} JSON object - */ - ExportContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExportContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ExportContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExportContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext"; - }; - - ExportContext.SqlCsvExportOptions = (function() { - - /** - * Properties of a SqlCsvExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext - * @interface ISqlCsvExportOptions - * @property {string|null} [selectQuery] SqlCsvExportOptions selectQuery - * @property {string|null} [escapeCharacter] SqlCsvExportOptions escapeCharacter - * @property {string|null} [quoteCharacter] SqlCsvExportOptions quoteCharacter - * @property {string|null} [fieldsTerminatedBy] SqlCsvExportOptions fieldsTerminatedBy - * @property {string|null} [linesTerminatedBy] SqlCsvExportOptions linesTerminatedBy - */ - - /** - * Constructs a new SqlCsvExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext - * @classdesc Represents a SqlCsvExportOptions. - * @implements ISqlCsvExportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions=} [properties] Properties to set - */ - function SqlCsvExportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlCsvExportOptions selectQuery. - * @member {string} selectQuery - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @instance - */ - SqlCsvExportOptions.prototype.selectQuery = ""; - - /** - * SqlCsvExportOptions escapeCharacter. - * @member {string} escapeCharacter - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @instance - */ - SqlCsvExportOptions.prototype.escapeCharacter = ""; - - /** - * SqlCsvExportOptions quoteCharacter. - * @member {string} quoteCharacter - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @instance - */ - SqlCsvExportOptions.prototype.quoteCharacter = ""; - - /** - * SqlCsvExportOptions fieldsTerminatedBy. - * @member {string} fieldsTerminatedBy - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @instance - */ - SqlCsvExportOptions.prototype.fieldsTerminatedBy = ""; - - /** - * SqlCsvExportOptions linesTerminatedBy. - * @member {string} linesTerminatedBy - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @instance - */ - SqlCsvExportOptions.prototype.linesTerminatedBy = ""; - - /** - * Creates a new SqlCsvExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions instance - */ - SqlCsvExportOptions.create = function create(properties) { - return new SqlCsvExportOptions(properties); - }; - - /** - * Encodes the specified SqlCsvExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions} message SqlCsvExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlCsvExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.selectQuery != null && Object.hasOwnProperty.call(message, "selectQuery")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selectQuery); - if (message.escapeCharacter != null && Object.hasOwnProperty.call(message, "escapeCharacter")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.escapeCharacter); - if (message.quoteCharacter != null && Object.hasOwnProperty.call(message, "quoteCharacter")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.quoteCharacter); - if (message.fieldsTerminatedBy != null && Object.hasOwnProperty.call(message, "fieldsTerminatedBy")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.fieldsTerminatedBy); - if (message.linesTerminatedBy != null && Object.hasOwnProperty.call(message, "linesTerminatedBy")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.linesTerminatedBy); - return writer; - }; - - /** - * Encodes the specified SqlCsvExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlCsvExportOptions} message SqlCsvExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlCsvExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlCsvExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlCsvExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.selectQuery = reader.string(); - break; - } - case 2: { - message.escapeCharacter = reader.string(); - break; - } - case 3: { - message.quoteCharacter = reader.string(); - break; - } - case 4: { - message.fieldsTerminatedBy = reader.string(); - break; - } - case 6: { - message.linesTerminatedBy = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlCsvExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlCsvExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlCsvExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlCsvExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.selectQuery != null && message.hasOwnProperty("selectQuery")) - if (!$util.isString(message.selectQuery)) - return "selectQuery: string expected"; - if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) - if (!$util.isString(message.escapeCharacter)) - return "escapeCharacter: string expected"; - if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) - if (!$util.isString(message.quoteCharacter)) - return "quoteCharacter: string expected"; - if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) - if (!$util.isString(message.fieldsTerminatedBy)) - return "fieldsTerminatedBy: string expected"; - if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) - if (!$util.isString(message.linesTerminatedBy)) - return "linesTerminatedBy: string expected"; - return null; - }; - - /** - * Creates a SqlCsvExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions} SqlCsvExportOptions - */ - SqlCsvExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions(); - if (object.selectQuery != null) - message.selectQuery = String(object.selectQuery); - if (object.escapeCharacter != null) - message.escapeCharacter = String(object.escapeCharacter); - if (object.quoteCharacter != null) - message.quoteCharacter = String(object.quoteCharacter); - if (object.fieldsTerminatedBy != null) - message.fieldsTerminatedBy = String(object.fieldsTerminatedBy); - if (object.linesTerminatedBy != null) - message.linesTerminatedBy = String(object.linesTerminatedBy); - return message; - }; - - /** - * Creates a plain object from a SqlCsvExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions} message SqlCsvExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlCsvExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.selectQuery = ""; - object.escapeCharacter = ""; - object.quoteCharacter = ""; - object.fieldsTerminatedBy = ""; - object.linesTerminatedBy = ""; - } - if (message.selectQuery != null && message.hasOwnProperty("selectQuery")) - object.selectQuery = message.selectQuery; - if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) - object.escapeCharacter = message.escapeCharacter; - if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) - object.quoteCharacter = message.quoteCharacter; - if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) - object.fieldsTerminatedBy = message.fieldsTerminatedBy; - if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) - object.linesTerminatedBy = message.linesTerminatedBy; - return object; - }; - - /** - * Converts this SqlCsvExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlCsvExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlCsvExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlCsvExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlCsvExportOptions"; - }; - - return SqlCsvExportOptions; - })(); - - ExportContext.SqlExportOptions = (function() { - - /** - * Properties of a SqlExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext - * @interface ISqlExportOptions - * @property {Array.|null} [tables] SqlExportOptions tables - * @property {google.protobuf.IBoolValue|null} [schemaOnly] SqlExportOptions schemaOnly - * @property {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions|null} [mysqlExportOptions] SqlExportOptions mysqlExportOptions - * @property {google.protobuf.IInt32Value|null} [threads] SqlExportOptions threads - * @property {google.protobuf.IBoolValue|null} [parallel] SqlExportOptions parallel - * @property {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions|null} [postgresExportOptions] SqlExportOptions postgresExportOptions - */ - - /** - * Constructs a new SqlExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext - * @classdesc Represents a SqlExportOptions. - * @implements ISqlExportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions=} [properties] Properties to set - */ - function SqlExportOptions(properties) { - this.tables = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlExportOptions tables. - * @member {Array.} tables - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.tables = $util.emptyArray; - - /** - * SqlExportOptions schemaOnly. - * @member {google.protobuf.IBoolValue|null|undefined} schemaOnly - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.schemaOnly = null; - - /** - * SqlExportOptions mysqlExportOptions. - * @member {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions|null|undefined} mysqlExportOptions - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.mysqlExportOptions = null; - - /** - * SqlExportOptions threads. - * @member {google.protobuf.IInt32Value|null|undefined} threads - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.threads = null; - - /** - * SqlExportOptions parallel. - * @member {google.protobuf.IBoolValue|null|undefined} parallel - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.parallel = null; - - /** - * SqlExportOptions postgresExportOptions. - * @member {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions|null|undefined} postgresExportOptions - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @instance - */ - SqlExportOptions.prototype.postgresExportOptions = null; - - /** - * Creates a new SqlExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions} SqlExportOptions instance - */ - SqlExportOptions.create = function create(properties) { - return new SqlExportOptions(properties); - }; - - /** - * Encodes the specified SqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions} message SqlExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tables != null && message.tables.length) - for (var i = 0; i < message.tables.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.tables[i]); - if (message.schemaOnly != null && Object.hasOwnProperty.call(message, "schemaOnly")) - $root.google.protobuf.BoolValue.encode(message.schemaOnly, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.mysqlExportOptions != null && Object.hasOwnProperty.call(message, "mysqlExportOptions")) - $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.encode(message.mysqlExportOptions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.threads != null && Object.hasOwnProperty.call(message, "threads")) - $root.google.protobuf.Int32Value.encode(message.threads, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.parallel != null && Object.hasOwnProperty.call(message, "parallel")) - $root.google.protobuf.BoolValue.encode(message.parallel, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.postgresExportOptions != null && Object.hasOwnProperty.call(message, "postgresExportOptions")) - $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.encode(message.postgresExportOptions, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlExportOptions} message SqlExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions} SqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.tables && message.tables.length)) - message.tables = []; - message.tables.push(reader.string()); - break; - } - case 2: { - message.schemaOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 3: { - message.mysqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.decode(reader, reader.uint32()); - break; - } - case 4: { - message.threads = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 5: { - message.parallel = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 6: { - message.postgresExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions} SqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tables != null && message.hasOwnProperty("tables")) { - if (!Array.isArray(message.tables)) - return "tables: array expected"; - for (var i = 0; i < message.tables.length; ++i) - if (!$util.isString(message.tables[i])) - return "tables: string[] expected"; - } - if (message.schemaOnly != null && message.hasOwnProperty("schemaOnly")) { - var error = $root.google.protobuf.BoolValue.verify(message.schemaOnly); - if (error) - return "schemaOnly." + error; - } - if (message.mysqlExportOptions != null && message.hasOwnProperty("mysqlExportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.verify(message.mysqlExportOptions); - if (error) - return "mysqlExportOptions." + error; - } - if (message.threads != null && message.hasOwnProperty("threads")) { - var error = $root.google.protobuf.Int32Value.verify(message.threads); - if (error) - return "threads." + error; - } - if (message.parallel != null && message.hasOwnProperty("parallel")) { - var error = $root.google.protobuf.BoolValue.verify(message.parallel); - if (error) - return "parallel." + error; - } - if (message.postgresExportOptions != null && message.hasOwnProperty("postgresExportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.verify(message.postgresExportOptions); - if (error) - return "postgresExportOptions." + error; - } - return null; - }; - - /** - * Creates a SqlExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions} SqlExportOptions - */ - SqlExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions(); - if (object.tables) { - if (!Array.isArray(object.tables)) - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.tables: array expected"); - message.tables = []; - for (var i = 0; i < object.tables.length; ++i) - message.tables[i] = String(object.tables[i]); - } - if (object.schemaOnly != null) { - if (typeof object.schemaOnly !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.schemaOnly: object expected"); - message.schemaOnly = $root.google.protobuf.BoolValue.fromObject(object.schemaOnly); - } - if (object.mysqlExportOptions != null) { - if (typeof object.mysqlExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.mysqlExportOptions: object expected"); - message.mysqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.fromObject(object.mysqlExportOptions); - } - if (object.threads != null) { - if (typeof object.threads !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.threads: object expected"); - message.threads = $root.google.protobuf.Int32Value.fromObject(object.threads); - } - if (object.parallel != null) { - if (typeof object.parallel !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.parallel: object expected"); - message.parallel = $root.google.protobuf.BoolValue.fromObject(object.parallel); - } - if (object.postgresExportOptions != null) { - if (typeof object.postgresExportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.postgresExportOptions: object expected"); - message.postgresExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.fromObject(object.postgresExportOptions); - } - return message; - }; - - /** - * Creates a plain object from a SqlExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions} message SqlExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.tables = []; - if (options.defaults) { - object.schemaOnly = null; - object.mysqlExportOptions = null; - object.threads = null; - object.parallel = null; - object.postgresExportOptions = null; - } - if (message.tables && message.tables.length) { - object.tables = []; - for (var j = 0; j < message.tables.length; ++j) - object.tables[j] = message.tables[j]; - } - if (message.schemaOnly != null && message.hasOwnProperty("schemaOnly")) - object.schemaOnly = $root.google.protobuf.BoolValue.toObject(message.schemaOnly, options); - if (message.mysqlExportOptions != null && message.hasOwnProperty("mysqlExportOptions")) - object.mysqlExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.toObject(message.mysqlExportOptions, options); - if (message.threads != null && message.hasOwnProperty("threads")) - object.threads = $root.google.protobuf.Int32Value.toObject(message.threads, options); - if (message.parallel != null && message.hasOwnProperty("parallel")) - object.parallel = $root.google.protobuf.BoolValue.toObject(message.parallel, options); - if (message.postgresExportOptions != null && message.hasOwnProperty("postgresExportOptions")) - object.postgresExportOptions = $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.toObject(message.postgresExportOptions, options); - return object; - }; - - /** - * Converts this SqlExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlExportOptions"; - }; - - SqlExportOptions.MysqlExportOptions = (function() { - - /** - * Properties of a MysqlExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @interface IMysqlExportOptions - * @property {google.protobuf.IInt32Value|null} [masterData] MysqlExportOptions masterData - */ - - /** - * Constructs a new MysqlExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @classdesc Represents a MysqlExportOptions. - * @implements IMysqlExportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions=} [properties] Properties to set - */ - function MysqlExportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MysqlExportOptions masterData. - * @member {google.protobuf.IInt32Value|null|undefined} masterData - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @instance - */ - MysqlExportOptions.prototype.masterData = null; - - /** - * Creates a new MysqlExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions instance - */ - MysqlExportOptions.create = function create(properties) { - return new MysqlExportOptions(properties); - }; - - /** - * Encodes the specified MysqlExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions} message MysqlExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MysqlExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.masterData != null && Object.hasOwnProperty.call(message, "masterData")) - $root.google.protobuf.Int32Value.encode(message.masterData, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MysqlExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IMysqlExportOptions} message MysqlExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MysqlExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MysqlExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MysqlExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.masterData = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MysqlExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MysqlExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MysqlExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MysqlExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.masterData != null && message.hasOwnProperty("masterData")) { - var error = $root.google.protobuf.Int32Value.verify(message.masterData); - if (error) - return "masterData." + error; - } - return null; - }; - - /** - * Creates a MysqlExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions} MysqlExportOptions - */ - MysqlExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions(); - if (object.masterData != null) { - if (typeof object.masterData !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions.masterData: object expected"); - message.masterData = $root.google.protobuf.Int32Value.fromObject(object.masterData); - } - return message; - }; - - /** - * Creates a plain object from a MysqlExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions} message MysqlExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MysqlExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.masterData = null; - if (message.masterData != null && message.hasOwnProperty("masterData")) - object.masterData = $root.google.protobuf.Int32Value.toObject(message.masterData, options); - return object; - }; - - /** - * Converts this MysqlExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @instance - * @returns {Object.} JSON object - */ - MysqlExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MysqlExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MysqlExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.MysqlExportOptions"; - }; - - return MysqlExportOptions; - })(); - - SqlExportOptions.PostgresExportOptions = (function() { - - /** - * Properties of a PostgresExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @interface IPostgresExportOptions - * @property {google.protobuf.IBoolValue|null} [clean] PostgresExportOptions clean - * @property {google.protobuf.IBoolValue|null} [ifExists] PostgresExportOptions ifExists - */ - - /** - * Constructs a new PostgresExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions - * @classdesc Represents a PostgresExportOptions. - * @implements IPostgresExportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions=} [properties] Properties to set - */ - function PostgresExportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PostgresExportOptions clean. - * @member {google.protobuf.IBoolValue|null|undefined} clean - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @instance - */ - PostgresExportOptions.prototype.clean = null; - - /** - * PostgresExportOptions ifExists. - * @member {google.protobuf.IBoolValue|null|undefined} ifExists - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @instance - */ - PostgresExportOptions.prototype.ifExists = null; - - /** - * Creates a new PostgresExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions instance - */ - PostgresExportOptions.create = function create(properties) { - return new PostgresExportOptions(properties); - }; - - /** - * Encodes the specified PostgresExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions} message PostgresExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PostgresExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.clean != null && Object.hasOwnProperty.call(message, "clean")) - $root.google.protobuf.BoolValue.encode(message.clean, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.ifExists != null && Object.hasOwnProperty.call(message, "ifExists")) - $root.google.protobuf.BoolValue.encode(message.ifExists, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PostgresExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.IPostgresExportOptions} message PostgresExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PostgresExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PostgresExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PostgresExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.clean = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 2: { - message.ifExists = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PostgresExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PostgresExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PostgresExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PostgresExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.clean != null && message.hasOwnProperty("clean")) { - var error = $root.google.protobuf.BoolValue.verify(message.clean); - if (error) - return "clean." + error; - } - if (message.ifExists != null && message.hasOwnProperty("ifExists")) { - var error = $root.google.protobuf.BoolValue.verify(message.ifExists); - if (error) - return "ifExists." + error; - } - return null; - }; - - /** - * Creates a PostgresExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions} PostgresExportOptions - */ - PostgresExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions(); - if (object.clean != null) { - if (typeof object.clean !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.clean: object expected"); - message.clean = $root.google.protobuf.BoolValue.fromObject(object.clean); - } - if (object.ifExists != null) { - if (typeof object.ifExists !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions.ifExists: object expected"); - message.ifExists = $root.google.protobuf.BoolValue.fromObject(object.ifExists); - } - return message; - }; - - /** - * Creates a plain object from a PostgresExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions} message PostgresExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PostgresExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.clean = null; - object.ifExists = null; - } - if (message.clean != null && message.hasOwnProperty("clean")) - object.clean = $root.google.protobuf.BoolValue.toObject(message.clean, options); - if (message.ifExists != null && message.hasOwnProperty("ifExists")) - object.ifExists = $root.google.protobuf.BoolValue.toObject(message.ifExists, options); - return object; - }; - - /** - * Converts this PostgresExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @instance - * @returns {Object.} JSON object - */ - PostgresExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PostgresExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PostgresExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlExportOptions.PostgresExportOptions"; - }; - - return PostgresExportOptions; - })(); - - return SqlExportOptions; - })(); - - ExportContext.SqlBakExportOptions = (function() { - - /** - * Properties of a SqlBakExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext - * @interface ISqlBakExportOptions - * @property {google.protobuf.IBoolValue|null} [striped] SqlBakExportOptions striped - * @property {google.protobuf.IInt32Value|null} [stripeCount] SqlBakExportOptions stripeCount - * @property {google.cloud.sql.v1beta4.BakType|null} [bakType] SqlBakExportOptions bakType - * @property {google.protobuf.IBoolValue|null} [copyOnly] SqlBakExportOptions copyOnly - * @property {google.protobuf.IBoolValue|null} [differentialBase] SqlBakExportOptions differentialBase - * @property {google.protobuf.ITimestamp|null} [exportLogStartTime] SqlBakExportOptions exportLogStartTime - * @property {google.protobuf.ITimestamp|null} [exportLogEndTime] SqlBakExportOptions exportLogEndTime - */ - - /** - * Constructs a new SqlBakExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext - * @classdesc Represents a SqlBakExportOptions. - * @implements ISqlBakExportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions=} [properties] Properties to set - */ - function SqlBakExportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBakExportOptions striped. - * @member {google.protobuf.IBoolValue|null|undefined} striped - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.striped = null; - - /** - * SqlBakExportOptions stripeCount. - * @member {google.protobuf.IInt32Value|null|undefined} stripeCount - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.stripeCount = null; - - /** - * SqlBakExportOptions bakType. - * @member {google.cloud.sql.v1beta4.BakType} bakType - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.bakType = 0; - - /** - * SqlBakExportOptions copyOnly. - * @member {google.protobuf.IBoolValue|null|undefined} copyOnly - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.copyOnly = null; - - /** - * SqlBakExportOptions differentialBase. - * @member {google.protobuf.IBoolValue|null|undefined} differentialBase - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.differentialBase = null; - - /** - * SqlBakExportOptions exportLogStartTime. - * @member {google.protobuf.ITimestamp|null|undefined} exportLogStartTime - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.exportLogStartTime = null; - - /** - * SqlBakExportOptions exportLogEndTime. - * @member {google.protobuf.ITimestamp|null|undefined} exportLogEndTime - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @instance - */ - SqlBakExportOptions.prototype.exportLogEndTime = null; - - /** - * Creates a new SqlBakExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions} SqlBakExportOptions instance - */ - SqlBakExportOptions.create = function create(properties) { - return new SqlBakExportOptions(properties); - }; - - /** - * Encodes the specified SqlBakExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions} message SqlBakExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBakExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.striped != null && Object.hasOwnProperty.call(message, "striped")) - $root.google.protobuf.BoolValue.encode(message.striped, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.stripeCount != null && Object.hasOwnProperty.call(message, "stripeCount")) - $root.google.protobuf.Int32Value.encode(message.stripeCount, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.bakType != null && Object.hasOwnProperty.call(message, "bakType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.bakType); - if (message.copyOnly != null && Object.hasOwnProperty.call(message, "copyOnly")) - $root.google.protobuf.BoolValue.encode(message.copyOnly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.differentialBase != null && Object.hasOwnProperty.call(message, "differentialBase")) - $root.google.protobuf.BoolValue.encode(message.differentialBase, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.exportLogStartTime != null && Object.hasOwnProperty.call(message, "exportLogStartTime")) - $root.google.protobuf.Timestamp.encode(message.exportLogStartTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.exportLogEndTime != null && Object.hasOwnProperty.call(message, "exportLogEndTime")) - $root.google.protobuf.Timestamp.encode(message.exportLogEndTime, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlBakExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlBakExportOptions} message SqlBakExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBakExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBakExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions} SqlBakExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBakExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.striped = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 2: { - message.stripeCount = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 4: { - message.bakType = reader.int32(); - break; - } - case 5: { - message.copyOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 6: { - message.differentialBase = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 7: { - message.exportLogStartTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 8: { - message.exportLogEndTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBakExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions} SqlBakExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBakExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBakExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBakExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.striped != null && message.hasOwnProperty("striped")) { - var error = $root.google.protobuf.BoolValue.verify(message.striped); - if (error) - return "striped." + error; - } - if (message.stripeCount != null && message.hasOwnProperty("stripeCount")) { - var error = $root.google.protobuf.Int32Value.verify(message.stripeCount); - if (error) - return "stripeCount." + error; - } - if (message.bakType != null && message.hasOwnProperty("bakType")) - switch (message.bakType) { - default: - return "bakType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.copyOnly != null && message.hasOwnProperty("copyOnly")) { - var error = $root.google.protobuf.BoolValue.verify(message.copyOnly); - if (error) - return "copyOnly." + error; - } - if (message.differentialBase != null && message.hasOwnProperty("differentialBase")) { - var error = $root.google.protobuf.BoolValue.verify(message.differentialBase); - if (error) - return "differentialBase." + error; - } - if (message.exportLogStartTime != null && message.hasOwnProperty("exportLogStartTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.exportLogStartTime); - if (error) - return "exportLogStartTime." + error; - } - if (message.exportLogEndTime != null && message.hasOwnProperty("exportLogEndTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.exportLogEndTime); - if (error) - return "exportLogEndTime." + error; - } - return null; - }; - - /** - * Creates a SqlBakExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions} SqlBakExportOptions - */ - SqlBakExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions(); - if (object.striped != null) { - if (typeof object.striped !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.striped: object expected"); - message.striped = $root.google.protobuf.BoolValue.fromObject(object.striped); - } - if (object.stripeCount != null) { - if (typeof object.stripeCount !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.stripeCount: object expected"); - message.stripeCount = $root.google.protobuf.Int32Value.fromObject(object.stripeCount); - } - switch (object.bakType) { - default: - if (typeof object.bakType === "number") { - message.bakType = object.bakType; - break; - } - break; - case "BAK_TYPE_UNSPECIFIED": - case 0: - message.bakType = 0; - break; - case "FULL": - case 1: - message.bakType = 1; - break; - case "DIFF": - case 2: - message.bakType = 2; - break; - case "TLOG": - case 3: - message.bakType = 3; - break; - } - if (object.copyOnly != null) { - if (typeof object.copyOnly !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.copyOnly: object expected"); - message.copyOnly = $root.google.protobuf.BoolValue.fromObject(object.copyOnly); - } - if (object.differentialBase != null) { - if (typeof object.differentialBase !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.differentialBase: object expected"); - message.differentialBase = $root.google.protobuf.BoolValue.fromObject(object.differentialBase); - } - if (object.exportLogStartTime != null) { - if (typeof object.exportLogStartTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.exportLogStartTime: object expected"); - message.exportLogStartTime = $root.google.protobuf.Timestamp.fromObject(object.exportLogStartTime); - } - if (object.exportLogEndTime != null) { - if (typeof object.exportLogEndTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions.exportLogEndTime: object expected"); - message.exportLogEndTime = $root.google.protobuf.Timestamp.fromObject(object.exportLogEndTime); - } - return message; - }; - - /** - * Creates a plain object from a SqlBakExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions} message SqlBakExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBakExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.striped = null; - object.stripeCount = null; - object.bakType = options.enums === String ? "BAK_TYPE_UNSPECIFIED" : 0; - object.copyOnly = null; - object.differentialBase = null; - object.exportLogStartTime = null; - object.exportLogEndTime = null; - } - if (message.striped != null && message.hasOwnProperty("striped")) - object.striped = $root.google.protobuf.BoolValue.toObject(message.striped, options); - if (message.stripeCount != null && message.hasOwnProperty("stripeCount")) - object.stripeCount = $root.google.protobuf.Int32Value.toObject(message.stripeCount, options); - if (message.bakType != null && message.hasOwnProperty("bakType")) - object.bakType = options.enums === String ? $root.google.cloud.sql.v1beta4.BakType[message.bakType] === undefined ? message.bakType : $root.google.cloud.sql.v1beta4.BakType[message.bakType] : message.bakType; - if (message.copyOnly != null && message.hasOwnProperty("copyOnly")) - object.copyOnly = $root.google.protobuf.BoolValue.toObject(message.copyOnly, options); - if (message.differentialBase != null && message.hasOwnProperty("differentialBase")) - object.differentialBase = $root.google.protobuf.BoolValue.toObject(message.differentialBase, options); - if (message.exportLogStartTime != null && message.hasOwnProperty("exportLogStartTime")) - object.exportLogStartTime = $root.google.protobuf.Timestamp.toObject(message.exportLogStartTime, options); - if (message.exportLogEndTime != null && message.hasOwnProperty("exportLogEndTime")) - object.exportLogEndTime = $root.google.protobuf.Timestamp.toObject(message.exportLogEndTime, options); - return object; - }; - - /** - * Converts this SqlBakExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlBakExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBakExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBakExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlBakExportOptions"; - }; - - return SqlBakExportOptions; - })(); - - ExportContext.SqlTdeExportOptions = (function() { - - /** - * Properties of a SqlTdeExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext - * @interface ISqlTdeExportOptions - * @property {string|null} [certificatePath] SqlTdeExportOptions certificatePath - * @property {string|null} [privateKeyPath] SqlTdeExportOptions privateKeyPath - * @property {string|null} [privateKeyPassword] SqlTdeExportOptions privateKeyPassword - * @property {string|null} [name] SqlTdeExportOptions name - */ - - /** - * Constructs a new SqlTdeExportOptions. - * @memberof google.cloud.sql.v1beta4.ExportContext - * @classdesc Represents a SqlTdeExportOptions. - * @implements ISqlTdeExportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions=} [properties] Properties to set - */ - function SqlTdeExportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlTdeExportOptions certificatePath. - * @member {string} certificatePath - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @instance - */ - SqlTdeExportOptions.prototype.certificatePath = ""; - - /** - * SqlTdeExportOptions privateKeyPath. - * @member {string} privateKeyPath - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @instance - */ - SqlTdeExportOptions.prototype.privateKeyPath = ""; - - /** - * SqlTdeExportOptions privateKeyPassword. - * @member {string} privateKeyPassword - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @instance - */ - SqlTdeExportOptions.prototype.privateKeyPassword = ""; - - /** - * SqlTdeExportOptions name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @instance - */ - SqlTdeExportOptions.prototype.name = ""; - - /** - * Creates a new SqlTdeExportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions instance - */ - SqlTdeExportOptions.create = function create(properties) { - return new SqlTdeExportOptions(properties); - }; - - /** - * Encodes the specified SqlTdeExportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions} message SqlTdeExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTdeExportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certificatePath != null && Object.hasOwnProperty.call(message, "certificatePath")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.certificatePath); - if (message.privateKeyPath != null && Object.hasOwnProperty.call(message, "privateKeyPath")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateKeyPath); - if (message.privateKeyPassword != null && Object.hasOwnProperty.call(message, "privateKeyPassword")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.privateKeyPassword); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); - return writer; - }; - - /** - * Encodes the specified SqlTdeExportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.ISqlTdeExportOptions} message SqlTdeExportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTdeExportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlTdeExportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTdeExportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.certificatePath = reader.string(); - break; - } - case 2: { - message.privateKeyPath = reader.string(); - break; - } - case 3: { - message.privateKeyPassword = reader.string(); - break; - } - case 5: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlTdeExportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTdeExportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlTdeExportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlTdeExportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) - if (!$util.isString(message.certificatePath)) - return "certificatePath: string expected"; - if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) - if (!$util.isString(message.privateKeyPath)) - return "privateKeyPath: string expected"; - if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) - if (!$util.isString(message.privateKeyPassword)) - return "privateKeyPassword: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a SqlTdeExportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions} SqlTdeExportOptions - */ - SqlTdeExportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions(); - if (object.certificatePath != null) - message.certificatePath = String(object.certificatePath); - if (object.privateKeyPath != null) - message.privateKeyPath = String(object.privateKeyPath); - if (object.privateKeyPassword != null) - message.privateKeyPassword = String(object.privateKeyPassword); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a SqlTdeExportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @static - * @param {google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions} message SqlTdeExportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlTdeExportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.certificatePath = ""; - object.privateKeyPath = ""; - object.privateKeyPassword = ""; - object.name = ""; - } - if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) - object.certificatePath = message.certificatePath; - if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) - object.privateKeyPath = message.privateKeyPath; - if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) - object.privateKeyPassword = message.privateKeyPassword; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this SqlTdeExportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlTdeExportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlTdeExportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlTdeExportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ExportContext.SqlTdeExportOptions"; - }; - - return SqlTdeExportOptions; - })(); - - return ExportContext; - })(); - - v1beta4.FailoverContext = (function() { - - /** - * Properties of a FailoverContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IFailoverContext - * @property {number|Long|null} [settingsVersion] FailoverContext settingsVersion - * @property {string|null} [kind] FailoverContext kind - */ - - /** - * Constructs a new FailoverContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a FailoverContext. - * @implements IFailoverContext - * @constructor - * @param {google.cloud.sql.v1beta4.IFailoverContext=} [properties] Properties to set - */ - function FailoverContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FailoverContext settingsVersion. - * @member {number|Long} settingsVersion - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @instance - */ - FailoverContext.prototype.settingsVersion = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * FailoverContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @instance - */ - FailoverContext.prototype.kind = ""; - - /** - * Creates a new FailoverContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @static - * @param {google.cloud.sql.v1beta4.IFailoverContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.FailoverContext} FailoverContext instance - */ - FailoverContext.create = function create(properties) { - return new FailoverContext(properties); - }; - - /** - * Encodes the specified FailoverContext message. Does not implicitly {@link google.cloud.sql.v1beta4.FailoverContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @static - * @param {google.cloud.sql.v1beta4.IFailoverContext} message FailoverContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FailoverContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.settingsVersion != null && Object.hasOwnProperty.call(message, "settingsVersion")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.settingsVersion); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - return writer; - }; - - /** - * Encodes the specified FailoverContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FailoverContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @static - * @param {google.cloud.sql.v1beta4.IFailoverContext} message FailoverContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FailoverContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FailoverContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.FailoverContext} FailoverContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FailoverContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.FailoverContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.settingsVersion = reader.int64(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FailoverContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.FailoverContext} FailoverContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FailoverContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FailoverContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FailoverContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) - if (!$util.isInteger(message.settingsVersion) && !(message.settingsVersion && $util.isInteger(message.settingsVersion.low) && $util.isInteger(message.settingsVersion.high))) - return "settingsVersion: integer|Long expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a FailoverContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.FailoverContext} FailoverContext - */ - FailoverContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.FailoverContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.FailoverContext(); - if (object.settingsVersion != null) - if ($util.Long) - (message.settingsVersion = $util.Long.fromValue(object.settingsVersion)).unsigned = false; - else if (typeof object.settingsVersion === "string") - message.settingsVersion = parseInt(object.settingsVersion, 10); - else if (typeof object.settingsVersion === "number") - message.settingsVersion = object.settingsVersion; - else if (typeof object.settingsVersion === "object") - message.settingsVersion = new $util.LongBits(object.settingsVersion.low >>> 0, object.settingsVersion.high >>> 0).toNumber(); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a FailoverContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @static - * @param {google.cloud.sql.v1beta4.FailoverContext} message FailoverContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FailoverContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.settingsVersion = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.settingsVersion = options.longs === String ? "0" : 0; - object.kind = ""; - } - if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) - if (typeof message.settingsVersion === "number") - object.settingsVersion = options.longs === String ? String(message.settingsVersion) : message.settingsVersion; - else - object.settingsVersion = options.longs === String ? $util.Long.prototype.toString.call(message.settingsVersion) : options.longs === Number ? new $util.LongBits(message.settingsVersion.low >>> 0, message.settingsVersion.high >>> 0).toNumber() : message.settingsVersion; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this FailoverContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @instance - * @returns {Object.} JSON object - */ - FailoverContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FailoverContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.FailoverContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FailoverContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.FailoverContext"; - }; - - return FailoverContext; - })(); - - v1beta4.Flag = (function() { - - /** - * Properties of a Flag. - * @memberof google.cloud.sql.v1beta4 - * @interface IFlag - * @property {string|null} [name] Flag name - * @property {google.cloud.sql.v1beta4.SqlFlagType|null} [type] Flag type - * @property {Array.|null} [appliesTo] Flag appliesTo - * @property {Array.|null} [allowedStringValues] Flag allowedStringValues - * @property {google.protobuf.IInt64Value|null} [minValue] Flag minValue - * @property {google.protobuf.IInt64Value|null} [maxValue] Flag maxValue - * @property {google.protobuf.IBoolValue|null} [requiresRestart] Flag requiresRestart - * @property {string|null} [kind] Flag kind - * @property {google.protobuf.IBoolValue|null} [inBeta] Flag inBeta - * @property {Array.|null} [allowedIntValues] Flag allowedIntValues - * @property {google.cloud.sql.v1beta4.SqlFlagScope|null} [flagScope] Flag flagScope - * @property {string|null} [recommendedStringValue] Flag recommendedStringValue - * @property {google.protobuf.IInt64Value|null} [recommendedIntValue] Flag recommendedIntValue - */ - - /** - * Constructs a new Flag. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a Flag. - * @implements IFlag - * @constructor - * @param {google.cloud.sql.v1beta4.IFlag=} [properties] Properties to set - */ - function Flag(properties) { - this.appliesTo = []; - this.allowedStringValues = []; - this.allowedIntValues = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Flag name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.name = ""; - - /** - * Flag type. - * @member {google.cloud.sql.v1beta4.SqlFlagType} type - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.type = 0; - - /** - * Flag appliesTo. - * @member {Array.} appliesTo - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.appliesTo = $util.emptyArray; - - /** - * Flag allowedStringValues. - * @member {Array.} allowedStringValues - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.allowedStringValues = $util.emptyArray; - - /** - * Flag minValue. - * @member {google.protobuf.IInt64Value|null|undefined} minValue - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.minValue = null; - - /** - * Flag maxValue. - * @member {google.protobuf.IInt64Value|null|undefined} maxValue - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.maxValue = null; - - /** - * Flag requiresRestart. - * @member {google.protobuf.IBoolValue|null|undefined} requiresRestart - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.requiresRestart = null; - - /** - * Flag kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.kind = ""; - - /** - * Flag inBeta. - * @member {google.protobuf.IBoolValue|null|undefined} inBeta - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.inBeta = null; - - /** - * Flag allowedIntValues. - * @member {Array.} allowedIntValues - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.allowedIntValues = $util.emptyArray; - - /** - * Flag flagScope. - * @member {google.cloud.sql.v1beta4.SqlFlagScope} flagScope - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.flagScope = 0; - - /** - * Flag recommendedStringValue. - * @member {string|null|undefined} recommendedStringValue - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.recommendedStringValue = null; - - /** - * Flag recommendedIntValue. - * @member {google.protobuf.IInt64Value|null|undefined} recommendedIntValue - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Flag.prototype.recommendedIntValue = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * Flag recommendedValue. - * @member {"recommendedStringValue"|"recommendedIntValue"|undefined} recommendedValue - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - */ - Object.defineProperty(Flag.prototype, "recommendedValue", { - get: $util.oneOfGetter($oneOfFields = ["recommendedStringValue", "recommendedIntValue"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Flag instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.Flag - * @static - * @param {google.cloud.sql.v1beta4.IFlag=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.Flag} Flag instance - */ - Flag.create = function create(properties) { - return new Flag(properties); - }; - - /** - * Encodes the specified Flag message. Does not implicitly {@link google.cloud.sql.v1beta4.Flag.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.Flag - * @static - * @param {google.cloud.sql.v1beta4.IFlag} message Flag message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Flag.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); - if (message.appliesTo != null && message.appliesTo.length) { - writer.uint32(/* id 3, wireType 2 =*/26).fork(); - for (var i = 0; i < message.appliesTo.length; ++i) - writer.int32(message.appliesTo[i]); - writer.ldelim(); - } - if (message.allowedStringValues != null && message.allowedStringValues.length) - for (var i = 0; i < message.allowedStringValues.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.allowedStringValues[i]); - if (message.minValue != null && Object.hasOwnProperty.call(message, "minValue")) - $root.google.protobuf.Int64Value.encode(message.minValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.maxValue != null && Object.hasOwnProperty.call(message, "maxValue")) - $root.google.protobuf.Int64Value.encode(message.maxValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.requiresRestart != null && Object.hasOwnProperty.call(message, "requiresRestart")) - $root.google.protobuf.BoolValue.encode(message.requiresRestart, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.kind); - if (message.inBeta != null && Object.hasOwnProperty.call(message, "inBeta")) - $root.google.protobuf.BoolValue.encode(message.inBeta, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.allowedIntValues != null && message.allowedIntValues.length) { - writer.uint32(/* id 10, wireType 2 =*/82).fork(); - for (var i = 0; i < message.allowedIntValues.length; ++i) - writer.int64(message.allowedIntValues[i]); - writer.ldelim(); - } - if (message.flagScope != null && Object.hasOwnProperty.call(message, "flagScope")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.flagScope); - if (message.recommendedStringValue != null && Object.hasOwnProperty.call(message, "recommendedStringValue")) - writer.uint32(/* id 16, wireType 2 =*/130).string(message.recommendedStringValue); - if (message.recommendedIntValue != null && Object.hasOwnProperty.call(message, "recommendedIntValue")) - $root.google.protobuf.Int64Value.encode(message.recommendedIntValue, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Flag message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Flag.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.Flag - * @static - * @param {google.cloud.sql.v1beta4.IFlag} message Flag message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Flag.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Flag message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.Flag - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.Flag} Flag - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Flag.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Flag(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.type = reader.int32(); - break; - } - case 3: { - if (!(message.appliesTo && message.appliesTo.length)) - message.appliesTo = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.appliesTo.push(reader.int32()); - } else - message.appliesTo.push(reader.int32()); - break; - } - case 4: { - if (!(message.allowedStringValues && message.allowedStringValues.length)) - message.allowedStringValues = []; - message.allowedStringValues.push(reader.string()); - break; - } - case 5: { - message.minValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 6: { - message.maxValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 7: { - message.requiresRestart = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 8: { - message.kind = reader.string(); - break; - } - case 9: { - message.inBeta = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 10: { - if (!(message.allowedIntValues && message.allowedIntValues.length)) - message.allowedIntValues = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.allowedIntValues.push(reader.int64()); - } else - message.allowedIntValues.push(reader.int64()); - break; - } - case 15: { - message.flagScope = reader.int32(); - break; - } - case 16: { - message.recommendedStringValue = reader.string(); - break; - } - case 17: { - message.recommendedIntValue = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Flag message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.Flag - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.Flag} Flag - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Flag.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Flag message. - * @function verify - * @memberof google.cloud.sql.v1beta4.Flag - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Flag.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.appliesTo != null && message.hasOwnProperty("appliesTo")) { - if (!Array.isArray(message.appliesTo)) - return "appliesTo: array expected"; - for (var i = 0; i < message.appliesTo.length; ++i) - switch (message.appliesTo[i]) { - default: - return "appliesTo: enum value[] expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - break; - } - } - if (message.allowedStringValues != null && message.hasOwnProperty("allowedStringValues")) { - if (!Array.isArray(message.allowedStringValues)) - return "allowedStringValues: array expected"; - for (var i = 0; i < message.allowedStringValues.length; ++i) - if (!$util.isString(message.allowedStringValues[i])) - return "allowedStringValues: string[] expected"; - } - if (message.minValue != null && message.hasOwnProperty("minValue")) { - var error = $root.google.protobuf.Int64Value.verify(message.minValue); - if (error) - return "minValue." + error; - } - if (message.maxValue != null && message.hasOwnProperty("maxValue")) { - var error = $root.google.protobuf.Int64Value.verify(message.maxValue); - if (error) - return "maxValue." + error; - } - if (message.requiresRestart != null && message.hasOwnProperty("requiresRestart")) { - var error = $root.google.protobuf.BoolValue.verify(message.requiresRestart); - if (error) - return "requiresRestart." + error; - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.inBeta != null && message.hasOwnProperty("inBeta")) { - var error = $root.google.protobuf.BoolValue.verify(message.inBeta); - if (error) - return "inBeta." + error; - } - if (message.allowedIntValues != null && message.hasOwnProperty("allowedIntValues")) { - if (!Array.isArray(message.allowedIntValues)) - return "allowedIntValues: array expected"; - for (var i = 0; i < message.allowedIntValues.length; ++i) - if (!$util.isInteger(message.allowedIntValues[i]) && !(message.allowedIntValues[i] && $util.isInteger(message.allowedIntValues[i].low) && $util.isInteger(message.allowedIntValues[i].high))) - return "allowedIntValues: integer|Long[] expected"; - } - if (message.flagScope != null && message.hasOwnProperty("flagScope")) - switch (message.flagScope) { - default: - return "flagScope: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.recommendedStringValue != null && message.hasOwnProperty("recommendedStringValue")) { - properties.recommendedValue = 1; - if (!$util.isString(message.recommendedStringValue)) - return "recommendedStringValue: string expected"; - } - if (message.recommendedIntValue != null && message.hasOwnProperty("recommendedIntValue")) { - if (properties.recommendedValue === 1) - return "recommendedValue: multiple values"; - properties.recommendedValue = 1; - { - var error = $root.google.protobuf.Int64Value.verify(message.recommendedIntValue); - if (error) - return "recommendedIntValue." + error; - } - } - return null; - }; - - /** - * Creates a Flag message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.Flag - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.Flag} Flag - */ - Flag.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.Flag) - return object; - var message = new $root.google.cloud.sql.v1beta4.Flag(); - if (object.name != null) - message.name = String(object.name); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "SQL_FLAG_TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "BOOLEAN": - case 1: - message.type = 1; - break; - case "STRING": - case 2: - message.type = 2; - break; - case "INTEGER": - case 3: - message.type = 3; - break; - case "NONE": - case 4: - message.type = 4; - break; - case "MYSQL_TIMEZONE_OFFSET": - case 5: - message.type = 5; - break; - case "FLOAT": - case 6: - message.type = 6; - break; - case "REPEATED_STRING": - case 7: - message.type = 7; - break; - } - if (object.appliesTo) { - if (!Array.isArray(object.appliesTo)) - throw TypeError(".google.cloud.sql.v1beta4.Flag.appliesTo: array expected"); - message.appliesTo = []; - for (var i = 0; i < object.appliesTo.length; ++i) - switch (object.appliesTo[i]) { - default: - if (typeof object.appliesTo[i] === "number") { - message.appliesTo[i] = object.appliesTo[i]; - break; - } - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.appliesTo[i] = 0; - break; - case "MYSQL_5_1": - case 2: - message.appliesTo[i] = 2; - break; - case "MYSQL_5_5": - case 3: - message.appliesTo[i] = 3; - break; - case "MYSQL_5_6": - case 5: - message.appliesTo[i] = 5; - break; - case "MYSQL_5_7": - case 6: - message.appliesTo[i] = 6; - break; - case "MYSQL_8_0": - case 20: - message.appliesTo[i] = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.appliesTo[i] = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.appliesTo[i] = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.appliesTo[i] = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.appliesTo[i] = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.appliesTo[i] = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.appliesTo[i] = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.appliesTo[i] = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.appliesTo[i] = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.appliesTo[i] = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.appliesTo[i] = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.appliesTo[i] = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.appliesTo[i] = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.appliesTo[i] = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.appliesTo[i] = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.appliesTo[i] = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.appliesTo[i] = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.appliesTo[i] = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.appliesTo[i] = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.appliesTo[i] = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.appliesTo[i] = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.appliesTo[i] = 556; - break; - case "MYSQL_8_4": - case 398: - message.appliesTo[i] = 398; - break; - case "MYSQL_9_7": - case 654: - message.appliesTo[i] = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.appliesTo[i] = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.appliesTo[i] = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.appliesTo[i] = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.appliesTo[i] = 16; - break; - case "POSTGRES_9_6": - case 9: - message.appliesTo[i] = 9; - break; - case "POSTGRES_10": - case 18: - message.appliesTo[i] = 18; - break; - case "POSTGRES_11": - case 10: - message.appliesTo[i] = 10; - break; - case "POSTGRES_12": - case 19: - message.appliesTo[i] = 19; - break; - case "POSTGRES_13": - case 23: - message.appliesTo[i] = 23; - break; - case "POSTGRES_14": - case 110: - message.appliesTo[i] = 110; - break; - case "POSTGRES_15": - case 172: - message.appliesTo[i] = 172; - break; - case "POSTGRES_16": - case 272: - message.appliesTo[i] = 272; - break; - case "POSTGRES_17": - case 408: - message.appliesTo[i] = 408; - break; - case "POSTGRES_18": - case 557: - message.appliesTo[i] = 557; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.appliesTo[i] = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.appliesTo[i] = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.appliesTo[i] = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.appliesTo[i] = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.appliesTo[i] = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.appliesTo[i] = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.appliesTo[i] = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.appliesTo[i] = 202; - break; - } - } - if (object.allowedStringValues) { - if (!Array.isArray(object.allowedStringValues)) - throw TypeError(".google.cloud.sql.v1beta4.Flag.allowedStringValues: array expected"); - message.allowedStringValues = []; - for (var i = 0; i < object.allowedStringValues.length; ++i) - message.allowedStringValues[i] = String(object.allowedStringValues[i]); - } - if (object.minValue != null) { - if (typeof object.minValue !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Flag.minValue: object expected"); - message.minValue = $root.google.protobuf.Int64Value.fromObject(object.minValue); - } - if (object.maxValue != null) { - if (typeof object.maxValue !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Flag.maxValue: object expected"); - message.maxValue = $root.google.protobuf.Int64Value.fromObject(object.maxValue); - } - if (object.requiresRestart != null) { - if (typeof object.requiresRestart !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Flag.requiresRestart: object expected"); - message.requiresRestart = $root.google.protobuf.BoolValue.fromObject(object.requiresRestart); - } - if (object.kind != null) - message.kind = String(object.kind); - if (object.inBeta != null) { - if (typeof object.inBeta !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Flag.inBeta: object expected"); - message.inBeta = $root.google.protobuf.BoolValue.fromObject(object.inBeta); - } - if (object.allowedIntValues) { - if (!Array.isArray(object.allowedIntValues)) - throw TypeError(".google.cloud.sql.v1beta4.Flag.allowedIntValues: array expected"); - message.allowedIntValues = []; - for (var i = 0; i < object.allowedIntValues.length; ++i) - if ($util.Long) - (message.allowedIntValues[i] = $util.Long.fromValue(object.allowedIntValues[i])).unsigned = false; - else if (typeof object.allowedIntValues[i] === "string") - message.allowedIntValues[i] = parseInt(object.allowedIntValues[i], 10); - else if (typeof object.allowedIntValues[i] === "number") - message.allowedIntValues[i] = object.allowedIntValues[i]; - else if (typeof object.allowedIntValues[i] === "object") - message.allowedIntValues[i] = new $util.LongBits(object.allowedIntValues[i].low >>> 0, object.allowedIntValues[i].high >>> 0).toNumber(); - } - switch (object.flagScope) { - default: - if (typeof object.flagScope === "number") { - message.flagScope = object.flagScope; - break; - } - break; - case "SQL_FLAG_SCOPE_UNSPECIFIED": - case 0: - message.flagScope = 0; - break; - case "SQL_FLAG_SCOPE_DATABASE": - case 1: - message.flagScope = 1; - break; - case "SQL_FLAG_SCOPE_CONNECTION_POOL": - case 2: - message.flagScope = 2; - break; - } - if (object.recommendedStringValue != null) - message.recommendedStringValue = String(object.recommendedStringValue); - if (object.recommendedIntValue != null) { - if (typeof object.recommendedIntValue !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Flag.recommendedIntValue: object expected"); - message.recommendedIntValue = $root.google.protobuf.Int64Value.fromObject(object.recommendedIntValue); - } - return message; - }; - - /** - * Creates a plain object from a Flag message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.Flag - * @static - * @param {google.cloud.sql.v1beta4.Flag} message Flag - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Flag.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.appliesTo = []; - object.allowedStringValues = []; - object.allowedIntValues = []; - } - if (options.defaults) { - object.name = ""; - object.type = options.enums === String ? "SQL_FLAG_TYPE_UNSPECIFIED" : 0; - object.minValue = null; - object.maxValue = null; - object.requiresRestart = null; - object.kind = ""; - object.inBeta = null; - object.flagScope = options.enums === String ? "SQL_FLAG_SCOPE_UNSPECIFIED" : 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlFlagType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.SqlFlagType[message.type] : message.type; - if (message.appliesTo && message.appliesTo.length) { - object.appliesTo = []; - for (var j = 0; j < message.appliesTo.length; ++j) - object.appliesTo[j] = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.appliesTo[j]] === undefined ? message.appliesTo[j] : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.appliesTo[j]] : message.appliesTo[j]; - } - if (message.allowedStringValues && message.allowedStringValues.length) { - object.allowedStringValues = []; - for (var j = 0; j < message.allowedStringValues.length; ++j) - object.allowedStringValues[j] = message.allowedStringValues[j]; - } - if (message.minValue != null && message.hasOwnProperty("minValue")) - object.minValue = $root.google.protobuf.Int64Value.toObject(message.minValue, options); - if (message.maxValue != null && message.hasOwnProperty("maxValue")) - object.maxValue = $root.google.protobuf.Int64Value.toObject(message.maxValue, options); - if (message.requiresRestart != null && message.hasOwnProperty("requiresRestart")) - object.requiresRestart = $root.google.protobuf.BoolValue.toObject(message.requiresRestart, options); - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.inBeta != null && message.hasOwnProperty("inBeta")) - object.inBeta = $root.google.protobuf.BoolValue.toObject(message.inBeta, options); - if (message.allowedIntValues && message.allowedIntValues.length) { - object.allowedIntValues = []; - for (var j = 0; j < message.allowedIntValues.length; ++j) - if (typeof message.allowedIntValues[j] === "number") - object.allowedIntValues[j] = options.longs === String ? String(message.allowedIntValues[j]) : message.allowedIntValues[j]; - else - object.allowedIntValues[j] = options.longs === String ? $util.Long.prototype.toString.call(message.allowedIntValues[j]) : options.longs === Number ? new $util.LongBits(message.allowedIntValues[j].low >>> 0, message.allowedIntValues[j].high >>> 0).toNumber() : message.allowedIntValues[j]; - } - if (message.flagScope != null && message.hasOwnProperty("flagScope")) - object.flagScope = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlFlagScope[message.flagScope] === undefined ? message.flagScope : $root.google.cloud.sql.v1beta4.SqlFlagScope[message.flagScope] : message.flagScope; - if (message.recommendedStringValue != null && message.hasOwnProperty("recommendedStringValue")) { - object.recommendedStringValue = message.recommendedStringValue; - if (options.oneofs) - object.recommendedValue = "recommendedStringValue"; - } - if (message.recommendedIntValue != null && message.hasOwnProperty("recommendedIntValue")) { - object.recommendedIntValue = $root.google.protobuf.Int64Value.toObject(message.recommendedIntValue, options); - if (options.oneofs) - object.recommendedValue = "recommendedIntValue"; - } - return object; - }; - - /** - * Converts this Flag to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.Flag - * @instance - * @returns {Object.} JSON object - */ - Flag.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Flag - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.Flag - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Flag.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.Flag"; - }; - - return Flag; - })(); - - v1beta4.FlagsListResponse = (function() { - - /** - * Properties of a FlagsListResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IFlagsListResponse - * @property {string|null} [kind] FlagsListResponse kind - * @property {Array.|null} [items] FlagsListResponse items - */ - - /** - * Constructs a new FlagsListResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a FlagsListResponse. - * @implements IFlagsListResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IFlagsListResponse=} [properties] Properties to set - */ - function FlagsListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FlagsListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @instance - */ - FlagsListResponse.prototype.kind = ""; - - /** - * FlagsListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @instance - */ - FlagsListResponse.prototype.items = $util.emptyArray; - - /** - * Creates a new FlagsListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @static - * @param {google.cloud.sql.v1beta4.IFlagsListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.FlagsListResponse} FlagsListResponse instance - */ - FlagsListResponse.create = function create(properties) { - return new FlagsListResponse(properties); - }; - - /** - * Encodes the specified FlagsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.FlagsListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @static - * @param {google.cloud.sql.v1beta4.IFlagsListResponse} message FlagsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FlagsListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1beta4.Flag.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FlagsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FlagsListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @static - * @param {google.cloud.sql.v1beta4.IFlagsListResponse} message FlagsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FlagsListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FlagsListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.FlagsListResponse} FlagsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FlagsListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.FlagsListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1beta4.Flag.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FlagsListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.FlagsListResponse} FlagsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FlagsListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FlagsListResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FlagsListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.Flag.verify(message.items[i]); - if (error) - return "items." + error; - } - } - return null; - }; - - /** - * Creates a FlagsListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.FlagsListResponse} FlagsListResponse - */ - FlagsListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.FlagsListResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.FlagsListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1beta4.FlagsListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.FlagsListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1beta4.Flag.fromObject(object.items[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a FlagsListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @static - * @param {google.cloud.sql.v1beta4.FlagsListResponse} message FlagsListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FlagsListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1beta4.Flag.toObject(message.items[j], options); - } - return object; - }; - - /** - * Converts this FlagsListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @instance - * @returns {Object.} JSON object - */ - FlagsListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FlagsListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.FlagsListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FlagsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.FlagsListResponse"; - }; - - return FlagsListResponse; - })(); - - v1beta4.ImportContext = (function() { - - /** - * Properties of an ImportContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IImportContext - * @property {string|null} [uri] ImportContext uri - * @property {string|null} [database] ImportContext database - * @property {string|null} [kind] ImportContext kind - * @property {google.cloud.sql.v1beta4.SqlFileType|null} [fileType] ImportContext fileType - * @property {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions|null} [csvImportOptions] ImportContext csvImportOptions - * @property {string|null} [importUser] ImportContext importUser - * @property {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions|null} [bakImportOptions] ImportContext bakImportOptions - * @property {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions|null} [sqlImportOptions] ImportContext sqlImportOptions - * @property {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions|null} [tdeImportOptions] ImportContext tdeImportOptions - */ - - /** - * Constructs a new ImportContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an ImportContext. - * @implements IImportContext - * @constructor - * @param {google.cloud.sql.v1beta4.IImportContext=} [properties] Properties to set - */ - function ImportContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ImportContext uri. - * @member {string} uri - * @memberof google.cloud.sql.v1beta4.ImportContext - * @instance - */ - ImportContext.prototype.uri = ""; - - /** - * ImportContext database. - * @member {string} database - * @memberof google.cloud.sql.v1beta4.ImportContext - * @instance - */ - ImportContext.prototype.database = ""; - - /** - * ImportContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.ImportContext - * @instance - */ - ImportContext.prototype.kind = ""; - - /** - * ImportContext fileType. - * @member {google.cloud.sql.v1beta4.SqlFileType} fileType - * @memberof google.cloud.sql.v1beta4.ImportContext - * @instance - */ - ImportContext.prototype.fileType = 0; - - /** - * ImportContext csvImportOptions. - * @member {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions|null|undefined} csvImportOptions - * @memberof google.cloud.sql.v1beta4.ImportContext - * @instance - */ - ImportContext.prototype.csvImportOptions = null; - - /** - * ImportContext importUser. - * @member {string} importUser - * @memberof google.cloud.sql.v1beta4.ImportContext - * @instance - */ - ImportContext.prototype.importUser = ""; - - /** - * ImportContext bakImportOptions. - * @member {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions|null|undefined} bakImportOptions - * @memberof google.cloud.sql.v1beta4.ImportContext - * @instance - */ - ImportContext.prototype.bakImportOptions = null; - - /** - * ImportContext sqlImportOptions. - * @member {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions|null|undefined} sqlImportOptions - * @memberof google.cloud.sql.v1beta4.ImportContext - * @instance - */ - ImportContext.prototype.sqlImportOptions = null; - - /** - * ImportContext tdeImportOptions. - * @member {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions|null|undefined} tdeImportOptions - * @memberof google.cloud.sql.v1beta4.ImportContext - * @instance - */ - ImportContext.prototype.tdeImportOptions = null; - - /** - * Creates a new ImportContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ImportContext - * @static - * @param {google.cloud.sql.v1beta4.IImportContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ImportContext} ImportContext instance - */ - ImportContext.create = function create(properties) { - return new ImportContext(properties); - }; - - /** - * Encodes the specified ImportContext message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ImportContext - * @static - * @param {google.cloud.sql.v1beta4.IImportContext} message ImportContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.uri != null && Object.hasOwnProperty.call(message, "uri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.uri); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.database); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - if (message.fileType != null && Object.hasOwnProperty.call(message, "fileType")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.fileType); - if (message.csvImportOptions != null && Object.hasOwnProperty.call(message, "csvImportOptions")) - $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.encode(message.csvImportOptions, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.importUser != null && Object.hasOwnProperty.call(message, "importUser")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.importUser); - if (message.bakImportOptions != null && Object.hasOwnProperty.call(message, "bakImportOptions")) - $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.encode(message.bakImportOptions, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.sqlImportOptions != null && Object.hasOwnProperty.call(message, "sqlImportOptions")) - $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.encode(message.sqlImportOptions, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.tdeImportOptions != null && Object.hasOwnProperty.call(message, "tdeImportOptions")) - $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.encode(message.tdeImportOptions, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ImportContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext - * @static - * @param {google.cloud.sql.v1beta4.IImportContext} message ImportContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ImportContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ImportContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ImportContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ImportContext} ImportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.uri = reader.string(); - break; - } - case 2: { - message.database = reader.string(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - case 4: { - message.fileType = reader.int32(); - break; - } - case 5: { - message.csvImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.decode(reader, reader.uint32()); - break; - } - case 6: { - message.importUser = reader.string(); - break; - } - case 7: { - message.bakImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.decode(reader, reader.uint32()); - break; - } - case 8: { - message.sqlImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.decode(reader, reader.uint32()); - break; - } - case 9: { - message.tdeImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ImportContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ImportContext} ImportContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ImportContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ImportContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ImportContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ImportContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.uri != null && message.hasOwnProperty("uri")) - if (!$util.isString(message.uri)) - return "uri: string expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.fileType != null && message.hasOwnProperty("fileType")) - switch (message.fileType) { - default: - return "fileType: enum value expected"; - case 0: - case 1: - case 2: - case 4: - case 8: - break; - } - if (message.csvImportOptions != null && message.hasOwnProperty("csvImportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.verify(message.csvImportOptions); - if (error) - return "csvImportOptions." + error; - } - if (message.importUser != null && message.hasOwnProperty("importUser")) - if (!$util.isString(message.importUser)) - return "importUser: string expected"; - if (message.bakImportOptions != null && message.hasOwnProperty("bakImportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.verify(message.bakImportOptions); - if (error) - return "bakImportOptions." + error; - } - if (message.sqlImportOptions != null && message.hasOwnProperty("sqlImportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.verify(message.sqlImportOptions); - if (error) - return "sqlImportOptions." + error; - } - if (message.tdeImportOptions != null && message.hasOwnProperty("tdeImportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.verify(message.tdeImportOptions); - if (error) - return "tdeImportOptions." + error; - } - return null; - }; - - /** - * Creates an ImportContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ImportContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ImportContext} ImportContext - */ - ImportContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.ImportContext(); - if (object.uri != null) - message.uri = String(object.uri); - if (object.database != null) - message.database = String(object.database); - if (object.kind != null) - message.kind = String(object.kind); - switch (object.fileType) { - default: - if (typeof object.fileType === "number") { - message.fileType = object.fileType; - break; - } - break; - case "SQL_FILE_TYPE_UNSPECIFIED": - case 0: - message.fileType = 0; - break; - case "SQL": - case 1: - message.fileType = 1; - break; - case "CSV": - case 2: - message.fileType = 2; - break; - case "BAK": - case 4: - message.fileType = 4; - break; - case "TDE": - case 8: - message.fileType = 8; - break; - } - if (object.csvImportOptions != null) { - if (typeof object.csvImportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.csvImportOptions: object expected"); - message.csvImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.fromObject(object.csvImportOptions); - } - if (object.importUser != null) - message.importUser = String(object.importUser); - if (object.bakImportOptions != null) { - if (typeof object.bakImportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.bakImportOptions: object expected"); - message.bakImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.fromObject(object.bakImportOptions); - } - if (object.sqlImportOptions != null) { - if (typeof object.sqlImportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.sqlImportOptions: object expected"); - message.sqlImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.fromObject(object.sqlImportOptions); - } - if (object.tdeImportOptions != null) { - if (typeof object.tdeImportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.tdeImportOptions: object expected"); - message.tdeImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.fromObject(object.tdeImportOptions); - } - return message; - }; - - /** - * Creates a plain object from an ImportContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ImportContext - * @static - * @param {google.cloud.sql.v1beta4.ImportContext} message ImportContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ImportContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.uri = ""; - object.database = ""; - object.kind = ""; - object.fileType = options.enums === String ? "SQL_FILE_TYPE_UNSPECIFIED" : 0; - object.csvImportOptions = null; - object.importUser = ""; - object.bakImportOptions = null; - object.sqlImportOptions = null; - object.tdeImportOptions = null; - } - if (message.uri != null && message.hasOwnProperty("uri")) - object.uri = message.uri; - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.fileType != null && message.hasOwnProperty("fileType")) - object.fileType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlFileType[message.fileType] === undefined ? message.fileType : $root.google.cloud.sql.v1beta4.SqlFileType[message.fileType] : message.fileType; - if (message.csvImportOptions != null && message.hasOwnProperty("csvImportOptions")) - object.csvImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.toObject(message.csvImportOptions, options); - if (message.importUser != null && message.hasOwnProperty("importUser")) - object.importUser = message.importUser; - if (message.bakImportOptions != null && message.hasOwnProperty("bakImportOptions")) - object.bakImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.toObject(message.bakImportOptions, options); - if (message.sqlImportOptions != null && message.hasOwnProperty("sqlImportOptions")) - object.sqlImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.toObject(message.sqlImportOptions, options); - if (message.tdeImportOptions != null && message.hasOwnProperty("tdeImportOptions")) - object.tdeImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.toObject(message.tdeImportOptions, options); - return object; - }; - - /** - * Converts this ImportContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ImportContext - * @instance - * @returns {Object.} JSON object - */ - ImportContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ImportContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ImportContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ImportContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext"; - }; - - ImportContext.SqlImportOptions = (function() { - - /** - * Properties of a SqlImportOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext - * @interface ISqlImportOptions - * @property {google.protobuf.IInt32Value|null} [threads] SqlImportOptions threads - * @property {google.protobuf.IBoolValue|null} [parallel] SqlImportOptions parallel - * @property {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions|null} [postgresImportOptions] SqlImportOptions postgresImportOptions - */ - - /** - * Constructs a new SqlImportOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext - * @classdesc Represents a SqlImportOptions. - * @implements ISqlImportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions=} [properties] Properties to set - */ - function SqlImportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlImportOptions threads. - * @member {google.protobuf.IInt32Value|null|undefined} threads - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @instance - */ - SqlImportOptions.prototype.threads = null; - - /** - * SqlImportOptions parallel. - * @member {google.protobuf.IBoolValue|null|undefined} parallel - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @instance - */ - SqlImportOptions.prototype.parallel = null; - - /** - * SqlImportOptions postgresImportOptions. - * @member {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions|null|undefined} postgresImportOptions - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @instance - */ - SqlImportOptions.prototype.postgresImportOptions = null; - - /** - * Creates a new SqlImportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions} SqlImportOptions instance - */ - SqlImportOptions.create = function create(properties) { - return new SqlImportOptions(properties); - }; - - /** - * Encodes the specified SqlImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions} message SqlImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlImportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.threads != null && Object.hasOwnProperty.call(message, "threads")) - $root.google.protobuf.Int32Value.encode(message.threads, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.parallel != null && Object.hasOwnProperty.call(message, "parallel")) - $root.google.protobuf.BoolValue.encode(message.parallel, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.postgresImportOptions != null && Object.hasOwnProperty.call(message, "postgresImportOptions")) - $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.encode(message.postgresImportOptions, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlImportOptions} message SqlImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlImportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlImportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions} SqlImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlImportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.threads = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 2: { - message.parallel = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 3: { - message.postgresImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlImportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions} SqlImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlImportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlImportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlImportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.threads != null && message.hasOwnProperty("threads")) { - var error = $root.google.protobuf.Int32Value.verify(message.threads); - if (error) - return "threads." + error; - } - if (message.parallel != null && message.hasOwnProperty("parallel")) { - var error = $root.google.protobuf.BoolValue.verify(message.parallel); - if (error) - return "parallel." + error; - } - if (message.postgresImportOptions != null && message.hasOwnProperty("postgresImportOptions")) { - var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.verify(message.postgresImportOptions); - if (error) - return "postgresImportOptions." + error; - } - return null; - }; - - /** - * Creates a SqlImportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions} SqlImportOptions - */ - SqlImportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions(); - if (object.threads != null) { - if (typeof object.threads !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.threads: object expected"); - message.threads = $root.google.protobuf.Int32Value.fromObject(object.threads); - } - if (object.parallel != null) { - if (typeof object.parallel !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.parallel: object expected"); - message.parallel = $root.google.protobuf.BoolValue.fromObject(object.parallel); - } - if (object.postgresImportOptions != null) { - if (typeof object.postgresImportOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.postgresImportOptions: object expected"); - message.postgresImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.fromObject(object.postgresImportOptions); - } - return message; - }; - - /** - * Creates a plain object from a SqlImportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions} message SqlImportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlImportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.threads = null; - object.parallel = null; - object.postgresImportOptions = null; - } - if (message.threads != null && message.hasOwnProperty("threads")) - object.threads = $root.google.protobuf.Int32Value.toObject(message.threads, options); - if (message.parallel != null && message.hasOwnProperty("parallel")) - object.parallel = $root.google.protobuf.BoolValue.toObject(message.parallel, options); - if (message.postgresImportOptions != null && message.hasOwnProperty("postgresImportOptions")) - object.postgresImportOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.toObject(message.postgresImportOptions, options); - return object; - }; - - /** - * Converts this SqlImportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlImportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlImportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlImportOptions"; - }; - - SqlImportOptions.PostgresImportOptions = (function() { - - /** - * Properties of a PostgresImportOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @interface IPostgresImportOptions - * @property {google.protobuf.IBoolValue|null} [clean] PostgresImportOptions clean - * @property {google.protobuf.IBoolValue|null} [ifExists] PostgresImportOptions ifExists - */ - - /** - * Constructs a new PostgresImportOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions - * @classdesc Represents a PostgresImportOptions. - * @implements IPostgresImportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions=} [properties] Properties to set - */ - function PostgresImportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PostgresImportOptions clean. - * @member {google.protobuf.IBoolValue|null|undefined} clean - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @instance - */ - PostgresImportOptions.prototype.clean = null; - - /** - * PostgresImportOptions ifExists. - * @member {google.protobuf.IBoolValue|null|undefined} ifExists - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @instance - */ - PostgresImportOptions.prototype.ifExists = null; - - /** - * Creates a new PostgresImportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions instance - */ - PostgresImportOptions.create = function create(properties) { - return new PostgresImportOptions(properties); - }; - - /** - * Encodes the specified PostgresImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions} message PostgresImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PostgresImportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.clean != null && Object.hasOwnProperty.call(message, "clean")) - $root.google.protobuf.BoolValue.encode(message.clean, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.ifExists != null && Object.hasOwnProperty.call(message, "ifExists")) - $root.google.protobuf.BoolValue.encode(message.ifExists, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PostgresImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.IPostgresImportOptions} message PostgresImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PostgresImportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PostgresImportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PostgresImportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.clean = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 2: { - message.ifExists = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PostgresImportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PostgresImportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PostgresImportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PostgresImportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.clean != null && message.hasOwnProperty("clean")) { - var error = $root.google.protobuf.BoolValue.verify(message.clean); - if (error) - return "clean." + error; - } - if (message.ifExists != null && message.hasOwnProperty("ifExists")) { - var error = $root.google.protobuf.BoolValue.verify(message.ifExists); - if (error) - return "ifExists." + error; - } - return null; - }; - - /** - * Creates a PostgresImportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions} PostgresImportOptions - */ - PostgresImportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions(); - if (object.clean != null) { - if (typeof object.clean !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.clean: object expected"); - message.clean = $root.google.protobuf.BoolValue.fromObject(object.clean); - } - if (object.ifExists != null) { - if (typeof object.ifExists !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions.ifExists: object expected"); - message.ifExists = $root.google.protobuf.BoolValue.fromObject(object.ifExists); - } - return message; - }; - - /** - * Creates a plain object from a PostgresImportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions} message PostgresImportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PostgresImportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.clean = null; - object.ifExists = null; - } - if (message.clean != null && message.hasOwnProperty("clean")) - object.clean = $root.google.protobuf.BoolValue.toObject(message.clean, options); - if (message.ifExists != null && message.hasOwnProperty("ifExists")) - object.ifExists = $root.google.protobuf.BoolValue.toObject(message.ifExists, options); - return object; - }; - - /** - * Converts this PostgresImportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @instance - * @returns {Object.} JSON object - */ - PostgresImportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PostgresImportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PostgresImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlImportOptions.PostgresImportOptions"; - }; - - return PostgresImportOptions; - })(); - - return SqlImportOptions; - })(); - - ImportContext.SqlCsvImportOptions = (function() { - - /** - * Properties of a SqlCsvImportOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext - * @interface ISqlCsvImportOptions - * @property {string|null} [table] SqlCsvImportOptions table - * @property {Array.|null} [columns] SqlCsvImportOptions columns - * @property {string|null} [escapeCharacter] SqlCsvImportOptions escapeCharacter - * @property {string|null} [quoteCharacter] SqlCsvImportOptions quoteCharacter - * @property {string|null} [fieldsTerminatedBy] SqlCsvImportOptions fieldsTerminatedBy - * @property {string|null} [linesTerminatedBy] SqlCsvImportOptions linesTerminatedBy - */ - - /** - * Constructs a new SqlCsvImportOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext - * @classdesc Represents a SqlCsvImportOptions. - * @implements ISqlCsvImportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions=} [properties] Properties to set - */ - function SqlCsvImportOptions(properties) { - this.columns = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlCsvImportOptions table. - * @member {string} table - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.table = ""; - - /** - * SqlCsvImportOptions columns. - * @member {Array.} columns - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.columns = $util.emptyArray; - - /** - * SqlCsvImportOptions escapeCharacter. - * @member {string} escapeCharacter - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.escapeCharacter = ""; - - /** - * SqlCsvImportOptions quoteCharacter. - * @member {string} quoteCharacter - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.quoteCharacter = ""; - - /** - * SqlCsvImportOptions fieldsTerminatedBy. - * @member {string} fieldsTerminatedBy - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.fieldsTerminatedBy = ""; - - /** - * SqlCsvImportOptions linesTerminatedBy. - * @member {string} linesTerminatedBy - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @instance - */ - SqlCsvImportOptions.prototype.linesTerminatedBy = ""; - - /** - * Creates a new SqlCsvImportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions instance - */ - SqlCsvImportOptions.create = function create(properties) { - return new SqlCsvImportOptions(properties); - }; - - /** - * Encodes the specified SqlCsvImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions} message SqlCsvImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlCsvImportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.table != null && Object.hasOwnProperty.call(message, "table")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.table); - if (message.columns != null && message.columns.length) - for (var i = 0; i < message.columns.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.columns[i]); - if (message.escapeCharacter != null && Object.hasOwnProperty.call(message, "escapeCharacter")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.escapeCharacter); - if (message.quoteCharacter != null && Object.hasOwnProperty.call(message, "quoteCharacter")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.quoteCharacter); - if (message.fieldsTerminatedBy != null && Object.hasOwnProperty.call(message, "fieldsTerminatedBy")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.fieldsTerminatedBy); - if (message.linesTerminatedBy != null && Object.hasOwnProperty.call(message, "linesTerminatedBy")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.linesTerminatedBy); - return writer; - }; - - /** - * Encodes the specified SqlCsvImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlCsvImportOptions} message SqlCsvImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlCsvImportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlCsvImportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlCsvImportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.table = reader.string(); - break; - } - case 2: { - if (!(message.columns && message.columns.length)) - message.columns = []; - message.columns.push(reader.string()); - break; - } - case 4: { - message.escapeCharacter = reader.string(); - break; - } - case 5: { - message.quoteCharacter = reader.string(); - break; - } - case 6: { - message.fieldsTerminatedBy = reader.string(); - break; - } - case 8: { - message.linesTerminatedBy = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlCsvImportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlCsvImportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlCsvImportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlCsvImportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.table != null && message.hasOwnProperty("table")) - if (!$util.isString(message.table)) - return "table: string expected"; - if (message.columns != null && message.hasOwnProperty("columns")) { - if (!Array.isArray(message.columns)) - return "columns: array expected"; - for (var i = 0; i < message.columns.length; ++i) - if (!$util.isString(message.columns[i])) - return "columns: string[] expected"; - } - if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) - if (!$util.isString(message.escapeCharacter)) - return "escapeCharacter: string expected"; - if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) - if (!$util.isString(message.quoteCharacter)) - return "quoteCharacter: string expected"; - if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) - if (!$util.isString(message.fieldsTerminatedBy)) - return "fieldsTerminatedBy: string expected"; - if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) - if (!$util.isString(message.linesTerminatedBy)) - return "linesTerminatedBy: string expected"; - return null; - }; - - /** - * Creates a SqlCsvImportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions} SqlCsvImportOptions - */ - SqlCsvImportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions(); - if (object.table != null) - message.table = String(object.table); - if (object.columns) { - if (!Array.isArray(object.columns)) - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions.columns: array expected"); - message.columns = []; - for (var i = 0; i < object.columns.length; ++i) - message.columns[i] = String(object.columns[i]); - } - if (object.escapeCharacter != null) - message.escapeCharacter = String(object.escapeCharacter); - if (object.quoteCharacter != null) - message.quoteCharacter = String(object.quoteCharacter); - if (object.fieldsTerminatedBy != null) - message.fieldsTerminatedBy = String(object.fieldsTerminatedBy); - if (object.linesTerminatedBy != null) - message.linesTerminatedBy = String(object.linesTerminatedBy); - return message; - }; - - /** - * Creates a plain object from a SqlCsvImportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions} message SqlCsvImportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlCsvImportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.columns = []; - if (options.defaults) { - object.table = ""; - object.escapeCharacter = ""; - object.quoteCharacter = ""; - object.fieldsTerminatedBy = ""; - object.linesTerminatedBy = ""; - } - if (message.table != null && message.hasOwnProperty("table")) - object.table = message.table; - if (message.columns && message.columns.length) { - object.columns = []; - for (var j = 0; j < message.columns.length; ++j) - object.columns[j] = message.columns[j]; - } - if (message.escapeCharacter != null && message.hasOwnProperty("escapeCharacter")) - object.escapeCharacter = message.escapeCharacter; - if (message.quoteCharacter != null && message.hasOwnProperty("quoteCharacter")) - object.quoteCharacter = message.quoteCharacter; - if (message.fieldsTerminatedBy != null && message.hasOwnProperty("fieldsTerminatedBy")) - object.fieldsTerminatedBy = message.fieldsTerminatedBy; - if (message.linesTerminatedBy != null && message.hasOwnProperty("linesTerminatedBy")) - object.linesTerminatedBy = message.linesTerminatedBy; - return object; - }; - - /** - * Converts this SqlCsvImportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlCsvImportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlCsvImportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlCsvImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlCsvImportOptions"; - }; - - return SqlCsvImportOptions; - })(); - - ImportContext.SqlBakImportOptions = (function() { - - /** - * Properties of a SqlBakImportOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext - * @interface ISqlBakImportOptions - * @property {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions|null} [encryptionOptions] SqlBakImportOptions encryptionOptions - * @property {google.protobuf.IBoolValue|null} [striped] SqlBakImportOptions striped - * @property {google.protobuf.IBoolValue|null} [noRecovery] SqlBakImportOptions noRecovery - * @property {google.protobuf.IBoolValue|null} [recoveryOnly] SqlBakImportOptions recoveryOnly - * @property {google.cloud.sql.v1beta4.BakType|null} [bakType] SqlBakImportOptions bakType - * @property {google.protobuf.ITimestamp|null} [stopAt] SqlBakImportOptions stopAt - * @property {string|null} [stopAtMark] SqlBakImportOptions stopAtMark - */ - - /** - * Constructs a new SqlBakImportOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext - * @classdesc Represents a SqlBakImportOptions. - * @implements ISqlBakImportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions=} [properties] Properties to set - */ - function SqlBakImportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlBakImportOptions encryptionOptions. - * @member {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions|null|undefined} encryptionOptions - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.encryptionOptions = null; - - /** - * SqlBakImportOptions striped. - * @member {google.protobuf.IBoolValue|null|undefined} striped - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.striped = null; - - /** - * SqlBakImportOptions noRecovery. - * @member {google.protobuf.IBoolValue|null|undefined} noRecovery - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.noRecovery = null; - - /** - * SqlBakImportOptions recoveryOnly. - * @member {google.protobuf.IBoolValue|null|undefined} recoveryOnly - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.recoveryOnly = null; - - /** - * SqlBakImportOptions bakType. - * @member {google.cloud.sql.v1beta4.BakType} bakType - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.bakType = 0; - - /** - * SqlBakImportOptions stopAt. - * @member {google.protobuf.ITimestamp|null|undefined} stopAt - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.stopAt = null; - - /** - * SqlBakImportOptions stopAtMark. - * @member {string} stopAtMark - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @instance - */ - SqlBakImportOptions.prototype.stopAtMark = ""; - - /** - * Creates a new SqlBakImportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions} SqlBakImportOptions instance - */ - SqlBakImportOptions.create = function create(properties) { - return new SqlBakImportOptions(properties); - }; - - /** - * Encodes the specified SqlBakImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions} message SqlBakImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBakImportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.encryptionOptions != null && Object.hasOwnProperty.call(message, "encryptionOptions")) - $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.encode(message.encryptionOptions, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.striped != null && Object.hasOwnProperty.call(message, "striped")) - $root.google.protobuf.BoolValue.encode(message.striped, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.noRecovery != null && Object.hasOwnProperty.call(message, "noRecovery")) - $root.google.protobuf.BoolValue.encode(message.noRecovery, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.recoveryOnly != null && Object.hasOwnProperty.call(message, "recoveryOnly")) - $root.google.protobuf.BoolValue.encode(message.recoveryOnly, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.bakType != null && Object.hasOwnProperty.call(message, "bakType")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.bakType); - if (message.stopAt != null && Object.hasOwnProperty.call(message, "stopAt")) - $root.google.protobuf.Timestamp.encode(message.stopAt, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.stopAtMark != null && Object.hasOwnProperty.call(message, "stopAtMark")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.stopAtMark); - return writer; - }; - - /** - * Encodes the specified SqlBakImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlBakImportOptions} message SqlBakImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlBakImportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlBakImportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions} SqlBakImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBakImportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.encryptionOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.decode(reader, reader.uint32()); - break; - } - case 2: { - message.striped = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 4: { - message.noRecovery = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 5: { - message.recoveryOnly = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 6: { - message.bakType = reader.int32(); - break; - } - case 7: { - message.stopAt = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 8: { - message.stopAtMark = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlBakImportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions} SqlBakImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlBakImportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlBakImportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlBakImportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.encryptionOptions != null && message.hasOwnProperty("encryptionOptions")) { - var error = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.verify(message.encryptionOptions); - if (error) - return "encryptionOptions." + error; - } - if (message.striped != null && message.hasOwnProperty("striped")) { - var error = $root.google.protobuf.BoolValue.verify(message.striped); - if (error) - return "striped." + error; - } - if (message.noRecovery != null && message.hasOwnProperty("noRecovery")) { - var error = $root.google.protobuf.BoolValue.verify(message.noRecovery); - if (error) - return "noRecovery." + error; - } - if (message.recoveryOnly != null && message.hasOwnProperty("recoveryOnly")) { - var error = $root.google.protobuf.BoolValue.verify(message.recoveryOnly); - if (error) - return "recoveryOnly." + error; - } - if (message.bakType != null && message.hasOwnProperty("bakType")) - switch (message.bakType) { - default: - return "bakType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.stopAt != null && message.hasOwnProperty("stopAt")) { - var error = $root.google.protobuf.Timestamp.verify(message.stopAt); - if (error) - return "stopAt." + error; - } - if (message.stopAtMark != null && message.hasOwnProperty("stopAtMark")) - if (!$util.isString(message.stopAtMark)) - return "stopAtMark: string expected"; - return null; - }; - - /** - * Creates a SqlBakImportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions} SqlBakImportOptions - */ - SqlBakImportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions(); - if (object.encryptionOptions != null) { - if (typeof object.encryptionOptions !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.encryptionOptions: object expected"); - message.encryptionOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.fromObject(object.encryptionOptions); - } - if (object.striped != null) { - if (typeof object.striped !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.striped: object expected"); - message.striped = $root.google.protobuf.BoolValue.fromObject(object.striped); - } - if (object.noRecovery != null) { - if (typeof object.noRecovery !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.noRecovery: object expected"); - message.noRecovery = $root.google.protobuf.BoolValue.fromObject(object.noRecovery); - } - if (object.recoveryOnly != null) { - if (typeof object.recoveryOnly !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.recoveryOnly: object expected"); - message.recoveryOnly = $root.google.protobuf.BoolValue.fromObject(object.recoveryOnly); - } - switch (object.bakType) { - default: - if (typeof object.bakType === "number") { - message.bakType = object.bakType; - break; - } - break; - case "BAK_TYPE_UNSPECIFIED": - case 0: - message.bakType = 0; - break; - case "FULL": - case 1: - message.bakType = 1; - break; - case "DIFF": - case 2: - message.bakType = 2; - break; - case "TLOG": - case 3: - message.bakType = 3; - break; - } - if (object.stopAt != null) { - if (typeof object.stopAt !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.stopAt: object expected"); - message.stopAt = $root.google.protobuf.Timestamp.fromObject(object.stopAt); - } - if (object.stopAtMark != null) - message.stopAtMark = String(object.stopAtMark); - return message; - }; - - /** - * Creates a plain object from a SqlBakImportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions} message SqlBakImportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlBakImportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.encryptionOptions = null; - object.striped = null; - object.noRecovery = null; - object.recoveryOnly = null; - object.bakType = options.enums === String ? "BAK_TYPE_UNSPECIFIED" : 0; - object.stopAt = null; - object.stopAtMark = ""; - } - if (message.encryptionOptions != null && message.hasOwnProperty("encryptionOptions")) - object.encryptionOptions = $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.toObject(message.encryptionOptions, options); - if (message.striped != null && message.hasOwnProperty("striped")) - object.striped = $root.google.protobuf.BoolValue.toObject(message.striped, options); - if (message.noRecovery != null && message.hasOwnProperty("noRecovery")) - object.noRecovery = $root.google.protobuf.BoolValue.toObject(message.noRecovery, options); - if (message.recoveryOnly != null && message.hasOwnProperty("recoveryOnly")) - object.recoveryOnly = $root.google.protobuf.BoolValue.toObject(message.recoveryOnly, options); - if (message.bakType != null && message.hasOwnProperty("bakType")) - object.bakType = options.enums === String ? $root.google.cloud.sql.v1beta4.BakType[message.bakType] === undefined ? message.bakType : $root.google.cloud.sql.v1beta4.BakType[message.bakType] : message.bakType; - if (message.stopAt != null && message.hasOwnProperty("stopAt")) - object.stopAt = $root.google.protobuf.Timestamp.toObject(message.stopAt, options); - if (message.stopAtMark != null && message.hasOwnProperty("stopAtMark")) - object.stopAtMark = message.stopAtMark; - return object; - }; - - /** - * Converts this SqlBakImportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlBakImportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlBakImportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlBakImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions"; - }; - - SqlBakImportOptions.EncryptionOptions = (function() { - - /** - * Properties of an EncryptionOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @interface IEncryptionOptions - * @property {string|null} [certPath] EncryptionOptions certPath - * @property {string|null} [pvkPath] EncryptionOptions pvkPath - * @property {string|null} [pvkPassword] EncryptionOptions pvkPassword - * @property {google.protobuf.IBoolValue|null} [keepEncrypted] EncryptionOptions keepEncrypted - */ - - /** - * Constructs a new EncryptionOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions - * @classdesc Represents an EncryptionOptions. - * @implements IEncryptionOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions=} [properties] Properties to set - */ - function EncryptionOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EncryptionOptions certPath. - * @member {string} certPath - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @instance - */ - EncryptionOptions.prototype.certPath = ""; - - /** - * EncryptionOptions pvkPath. - * @member {string} pvkPath - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @instance - */ - EncryptionOptions.prototype.pvkPath = ""; - - /** - * EncryptionOptions pvkPassword. - * @member {string} pvkPassword - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @instance - */ - EncryptionOptions.prototype.pvkPassword = ""; - - /** - * EncryptionOptions keepEncrypted. - * @member {google.protobuf.IBoolValue|null|undefined} keepEncrypted - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @instance - */ - EncryptionOptions.prototype.keepEncrypted = null; - - /** - * Creates a new EncryptionOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions instance - */ - EncryptionOptions.create = function create(properties) { - return new EncryptionOptions(properties); - }; - - /** - * Encodes the specified EncryptionOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions} message EncryptionOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EncryptionOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certPath != null && Object.hasOwnProperty.call(message, "certPath")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.certPath); - if (message.pvkPath != null && Object.hasOwnProperty.call(message, "pvkPath")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.pvkPath); - if (message.pvkPassword != null && Object.hasOwnProperty.call(message, "pvkPassword")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.pvkPassword); - if (message.keepEncrypted != null && Object.hasOwnProperty.call(message, "keepEncrypted")) - $root.google.protobuf.BoolValue.encode(message.keepEncrypted, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EncryptionOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.IEncryptionOptions} message EncryptionOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EncryptionOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EncryptionOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EncryptionOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.certPath = reader.string(); - break; - } - case 2: { - message.pvkPath = reader.string(); - break; - } - case 3: { - message.pvkPassword = reader.string(); - break; - } - case 5: { - message.keepEncrypted = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EncryptionOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EncryptionOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EncryptionOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EncryptionOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certPath != null && message.hasOwnProperty("certPath")) - if (!$util.isString(message.certPath)) - return "certPath: string expected"; - if (message.pvkPath != null && message.hasOwnProperty("pvkPath")) - if (!$util.isString(message.pvkPath)) - return "pvkPath: string expected"; - if (message.pvkPassword != null && message.hasOwnProperty("pvkPassword")) - if (!$util.isString(message.pvkPassword)) - return "pvkPassword: string expected"; - if (message.keepEncrypted != null && message.hasOwnProperty("keepEncrypted")) { - var error = $root.google.protobuf.BoolValue.verify(message.keepEncrypted); - if (error) - return "keepEncrypted." + error; - } - return null; - }; - - /** - * Creates an EncryptionOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions} EncryptionOptions - */ - EncryptionOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions(); - if (object.certPath != null) - message.certPath = String(object.certPath); - if (object.pvkPath != null) - message.pvkPath = String(object.pvkPath); - if (object.pvkPassword != null) - message.pvkPassword = String(object.pvkPassword); - if (object.keepEncrypted != null) { - if (typeof object.keepEncrypted !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions.keepEncrypted: object expected"); - message.keepEncrypted = $root.google.protobuf.BoolValue.fromObject(object.keepEncrypted); - } - return message; - }; - - /** - * Creates a plain object from an EncryptionOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions} message EncryptionOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EncryptionOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.certPath = ""; - object.pvkPath = ""; - object.pvkPassword = ""; - object.keepEncrypted = null; - } - if (message.certPath != null && message.hasOwnProperty("certPath")) - object.certPath = message.certPath; - if (message.pvkPath != null && message.hasOwnProperty("pvkPath")) - object.pvkPath = message.pvkPath; - if (message.pvkPassword != null && message.hasOwnProperty("pvkPassword")) - object.pvkPassword = message.pvkPassword; - if (message.keepEncrypted != null && message.hasOwnProperty("keepEncrypted")) - object.keepEncrypted = $root.google.protobuf.BoolValue.toObject(message.keepEncrypted, options); - return object; - }; - - /** - * Converts this EncryptionOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @instance - * @returns {Object.} JSON object - */ - EncryptionOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EncryptionOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EncryptionOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlBakImportOptions.EncryptionOptions"; - }; - - return EncryptionOptions; - })(); - - return SqlBakImportOptions; - })(); - - ImportContext.SqlTdeImportOptions = (function() { - - /** - * Properties of a SqlTdeImportOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext - * @interface ISqlTdeImportOptions - * @property {string|null} [certificatePath] SqlTdeImportOptions certificatePath - * @property {string|null} [privateKeyPath] SqlTdeImportOptions privateKeyPath - * @property {string|null} [privateKeyPassword] SqlTdeImportOptions privateKeyPassword - * @property {string|null} [name] SqlTdeImportOptions name - */ - - /** - * Constructs a new SqlTdeImportOptions. - * @memberof google.cloud.sql.v1beta4.ImportContext - * @classdesc Represents a SqlTdeImportOptions. - * @implements ISqlTdeImportOptions - * @constructor - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions=} [properties] Properties to set - */ - function SqlTdeImportOptions(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlTdeImportOptions certificatePath. - * @member {string} certificatePath - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @instance - */ - SqlTdeImportOptions.prototype.certificatePath = ""; - - /** - * SqlTdeImportOptions privateKeyPath. - * @member {string} privateKeyPath - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @instance - */ - SqlTdeImportOptions.prototype.privateKeyPath = ""; - - /** - * SqlTdeImportOptions privateKeyPassword. - * @member {string} privateKeyPassword - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @instance - */ - SqlTdeImportOptions.prototype.privateKeyPassword = ""; - - /** - * SqlTdeImportOptions name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @instance - */ - SqlTdeImportOptions.prototype.name = ""; - - /** - * Creates a new SqlTdeImportOptions instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions instance - */ - SqlTdeImportOptions.create = function create(properties) { - return new SqlTdeImportOptions(properties); - }; - - /** - * Encodes the specified SqlTdeImportOptions message. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions} message SqlTdeImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTdeImportOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certificatePath != null && Object.hasOwnProperty.call(message, "certificatePath")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.certificatePath); - if (message.privateKeyPath != null && Object.hasOwnProperty.call(message, "privateKeyPath")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateKeyPath); - if (message.privateKeyPassword != null && Object.hasOwnProperty.call(message, "privateKeyPassword")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.privateKeyPassword); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); - return writer; - }; - - /** - * Encodes the specified SqlTdeImportOptions message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.ISqlTdeImportOptions} message SqlTdeImportOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTdeImportOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlTdeImportOptions message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTdeImportOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.certificatePath = reader.string(); - break; - } - case 2: { - message.privateKeyPath = reader.string(); - break; - } - case 3: { - message.privateKeyPassword = reader.string(); - break; - } - case 5: { - message.name = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlTdeImportOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTdeImportOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlTdeImportOptions message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlTdeImportOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) - if (!$util.isString(message.certificatePath)) - return "certificatePath: string expected"; - if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) - if (!$util.isString(message.privateKeyPath)) - return "privateKeyPath: string expected"; - if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) - if (!$util.isString(message.privateKeyPassword)) - return "privateKeyPassword: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - return null; - }; - - /** - * Creates a SqlTdeImportOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions} SqlTdeImportOptions - */ - SqlTdeImportOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions) - return object; - var message = new $root.google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions(); - if (object.certificatePath != null) - message.certificatePath = String(object.certificatePath); - if (object.privateKeyPath != null) - message.privateKeyPath = String(object.privateKeyPath); - if (object.privateKeyPassword != null) - message.privateKeyPassword = String(object.privateKeyPassword); - if (object.name != null) - message.name = String(object.name); - return message; - }; - - /** - * Creates a plain object from a SqlTdeImportOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @static - * @param {google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions} message SqlTdeImportOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlTdeImportOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.certificatePath = ""; - object.privateKeyPath = ""; - object.privateKeyPassword = ""; - object.name = ""; - } - if (message.certificatePath != null && message.hasOwnProperty("certificatePath")) - object.certificatePath = message.certificatePath; - if (message.privateKeyPath != null && message.hasOwnProperty("privateKeyPath")) - object.privateKeyPath = message.privateKeyPath; - if (message.privateKeyPassword != null && message.hasOwnProperty("privateKeyPassword")) - object.privateKeyPassword = message.privateKeyPassword; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - return object; - }; - - /** - * Converts this SqlTdeImportOptions to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @instance - * @returns {Object.} JSON object - */ - SqlTdeImportOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlTdeImportOptions - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlTdeImportOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ImportContext.SqlTdeImportOptions"; - }; - - return SqlTdeImportOptions; - })(); - - return ImportContext; - })(); - - /** - * BakType enum. - * @name google.cloud.sql.v1beta4.BakType - * @enum {number} - * @property {number} BAK_TYPE_UNSPECIFIED=0 BAK_TYPE_UNSPECIFIED value - * @property {number} FULL=1 FULL value - * @property {number} DIFF=2 DIFF value - * @property {number} TLOG=3 TLOG value - */ - v1beta4.BakType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BAK_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FULL"] = 1; - values[valuesById[2] = "DIFF"] = 2; - values[valuesById[3] = "TLOG"] = 3; - return values; - })(); - - v1beta4.InstancesCloneRequest = (function() { - - /** - * Properties of an InstancesCloneRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesCloneRequest - * @property {google.cloud.sql.v1beta4.ICloneContext|null} [cloneContext] InstancesCloneRequest cloneContext - */ - - /** - * Constructs a new InstancesCloneRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesCloneRequest. - * @implements IInstancesCloneRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesCloneRequest=} [properties] Properties to set - */ - function InstancesCloneRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesCloneRequest cloneContext. - * @member {google.cloud.sql.v1beta4.ICloneContext|null|undefined} cloneContext - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @instance - */ - InstancesCloneRequest.prototype.cloneContext = null; - - /** - * Creates a new InstancesCloneRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesCloneRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesCloneRequest} InstancesCloneRequest instance - */ - InstancesCloneRequest.create = function create(properties) { - return new InstancesCloneRequest(properties); - }; - - /** - * Encodes the specified InstancesCloneRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesCloneRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesCloneRequest} message InstancesCloneRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesCloneRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.cloneContext != null && Object.hasOwnProperty.call(message, "cloneContext")) - $root.google.cloud.sql.v1beta4.CloneContext.encode(message.cloneContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesCloneRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesCloneRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesCloneRequest} message InstancesCloneRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesCloneRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesCloneRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesCloneRequest} InstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesCloneRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesCloneRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.cloneContext = $root.google.cloud.sql.v1beta4.CloneContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesCloneRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesCloneRequest} InstancesCloneRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesCloneRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesCloneRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesCloneRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.cloneContext != null && message.hasOwnProperty("cloneContext")) { - var error = $root.google.cloud.sql.v1beta4.CloneContext.verify(message.cloneContext); - if (error) - return "cloneContext." + error; - } - return null; - }; - - /** - * Creates an InstancesCloneRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesCloneRequest} InstancesCloneRequest - */ - InstancesCloneRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesCloneRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesCloneRequest(); - if (object.cloneContext != null) { - if (typeof object.cloneContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesCloneRequest.cloneContext: object expected"); - message.cloneContext = $root.google.cloud.sql.v1beta4.CloneContext.fromObject(object.cloneContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesCloneRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesCloneRequest} message InstancesCloneRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesCloneRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.cloneContext = null; - if (message.cloneContext != null && message.hasOwnProperty("cloneContext")) - object.cloneContext = $root.google.cloud.sql.v1beta4.CloneContext.toObject(message.cloneContext, options); - return object; - }; - - /** - * Converts this InstancesCloneRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesCloneRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesCloneRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesCloneRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesCloneRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesCloneRequest"; - }; - - return InstancesCloneRequest; - })(); - - v1beta4.InstancesDemoteMasterRequest = (function() { - - /** - * Properties of an InstancesDemoteMasterRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesDemoteMasterRequest - * @property {google.cloud.sql.v1beta4.IDemoteMasterContext|null} [demoteMasterContext] InstancesDemoteMasterRequest demoteMasterContext - */ - - /** - * Constructs a new InstancesDemoteMasterRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesDemoteMasterRequest. - * @implements IInstancesDemoteMasterRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest=} [properties] Properties to set - */ - function InstancesDemoteMasterRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesDemoteMasterRequest demoteMasterContext. - * @member {google.cloud.sql.v1beta4.IDemoteMasterContext|null|undefined} demoteMasterContext - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @instance - */ - InstancesDemoteMasterRequest.prototype.demoteMasterContext = null; - - /** - * Creates a new InstancesDemoteMasterRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest instance - */ - InstancesDemoteMasterRequest.create = function create(properties) { - return new InstancesDemoteMasterRequest(properties); - }; - - /** - * Encodes the specified InstancesDemoteMasterRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest} message InstancesDemoteMasterRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesDemoteMasterRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.demoteMasterContext != null && Object.hasOwnProperty.call(message, "demoteMasterContext")) - $root.google.cloud.sql.v1beta4.DemoteMasterContext.encode(message.demoteMasterContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesDemoteMasterRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesDemoteMasterRequest} message InstancesDemoteMasterRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesDemoteMasterRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesDemoteMasterRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.demoteMasterContext = $root.google.cloud.sql.v1beta4.DemoteMasterContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesDemoteMasterRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesDemoteMasterRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesDemoteMasterRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesDemoteMasterRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.demoteMasterContext != null && message.hasOwnProperty("demoteMasterContext")) { - var error = $root.google.cloud.sql.v1beta4.DemoteMasterContext.verify(message.demoteMasterContext); - if (error) - return "demoteMasterContext." + error; - } - return null; - }; - - /** - * Creates an InstancesDemoteMasterRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} InstancesDemoteMasterRequest - */ - InstancesDemoteMasterRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesDemoteMasterRequest(); - if (object.demoteMasterContext != null) { - if (typeof object.demoteMasterContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesDemoteMasterRequest.demoteMasterContext: object expected"); - message.demoteMasterContext = $root.google.cloud.sql.v1beta4.DemoteMasterContext.fromObject(object.demoteMasterContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesDemoteMasterRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} message InstancesDemoteMasterRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesDemoteMasterRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.demoteMasterContext = null; - if (message.demoteMasterContext != null && message.hasOwnProperty("demoteMasterContext")) - object.demoteMasterContext = $root.google.cloud.sql.v1beta4.DemoteMasterContext.toObject(message.demoteMasterContext, options); - return object; - }; - - /** - * Converts this InstancesDemoteMasterRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesDemoteMasterRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesDemoteMasterRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesDemoteMasterRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesDemoteMasterRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesDemoteMasterRequest"; - }; - - return InstancesDemoteMasterRequest; - })(); - - v1beta4.InstancesDemoteRequest = (function() { - - /** - * Properties of an InstancesDemoteRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesDemoteRequest - * @property {google.cloud.sql.v1beta4.IDemoteContext|null} [demoteContext] InstancesDemoteRequest demoteContext - */ - - /** - * Constructs a new InstancesDemoteRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesDemoteRequest. - * @implements IInstancesDemoteRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesDemoteRequest=} [properties] Properties to set - */ - function InstancesDemoteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesDemoteRequest demoteContext. - * @member {google.cloud.sql.v1beta4.IDemoteContext|null|undefined} demoteContext - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @instance - */ - InstancesDemoteRequest.prototype.demoteContext = null; - - /** - * Creates a new InstancesDemoteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesDemoteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesDemoteRequest} InstancesDemoteRequest instance - */ - InstancesDemoteRequest.create = function create(properties) { - return new InstancesDemoteRequest(properties); - }; - - /** - * Encodes the specified InstancesDemoteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesDemoteRequest} message InstancesDemoteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesDemoteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.demoteContext != null && Object.hasOwnProperty.call(message, "demoteContext")) - $root.google.cloud.sql.v1beta4.DemoteContext.encode(message.demoteContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesDemoteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesDemoteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesDemoteRequest} message InstancesDemoteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesDemoteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesDemoteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesDemoteRequest} InstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesDemoteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesDemoteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.demoteContext = $root.google.cloud.sql.v1beta4.DemoteContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesDemoteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesDemoteRequest} InstancesDemoteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesDemoteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesDemoteRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesDemoteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.demoteContext != null && message.hasOwnProperty("demoteContext")) { - var error = $root.google.cloud.sql.v1beta4.DemoteContext.verify(message.demoteContext); - if (error) - return "demoteContext." + error; - } - return null; - }; - - /** - * Creates an InstancesDemoteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesDemoteRequest} InstancesDemoteRequest - */ - InstancesDemoteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesDemoteRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesDemoteRequest(); - if (object.demoteContext != null) { - if (typeof object.demoteContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesDemoteRequest.demoteContext: object expected"); - message.demoteContext = $root.google.cloud.sql.v1beta4.DemoteContext.fromObject(object.demoteContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesDemoteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesDemoteRequest} message InstancesDemoteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesDemoteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.demoteContext = null; - if (message.demoteContext != null && message.hasOwnProperty("demoteContext")) - object.demoteContext = $root.google.cloud.sql.v1beta4.DemoteContext.toObject(message.demoteContext, options); - return object; - }; - - /** - * Converts this InstancesDemoteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesDemoteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesDemoteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesDemoteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesDemoteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesDemoteRequest"; - }; - - return InstancesDemoteRequest; - })(); - - v1beta4.InstancesExportRequest = (function() { - - /** - * Properties of an InstancesExportRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesExportRequest - * @property {google.cloud.sql.v1beta4.IExportContext|null} [exportContext] InstancesExportRequest exportContext - */ - - /** - * Constructs a new InstancesExportRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesExportRequest. - * @implements IInstancesExportRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesExportRequest=} [properties] Properties to set - */ - function InstancesExportRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesExportRequest exportContext. - * @member {google.cloud.sql.v1beta4.IExportContext|null|undefined} exportContext - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @instance - */ - InstancesExportRequest.prototype.exportContext = null; - - /** - * Creates a new InstancesExportRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesExportRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesExportRequest} InstancesExportRequest instance - */ - InstancesExportRequest.create = function create(properties) { - return new InstancesExportRequest(properties); - }; - - /** - * Encodes the specified InstancesExportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesExportRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesExportRequest} message InstancesExportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesExportRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.exportContext != null && Object.hasOwnProperty.call(message, "exportContext")) - $root.google.cloud.sql.v1beta4.ExportContext.encode(message.exportContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesExportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesExportRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesExportRequest} message InstancesExportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesExportRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesExportRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesExportRequest} InstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesExportRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesExportRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesExportRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesExportRequest} InstancesExportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesExportRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesExportRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesExportRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.exportContext != null && message.hasOwnProperty("exportContext")) { - var error = $root.google.cloud.sql.v1beta4.ExportContext.verify(message.exportContext); - if (error) - return "exportContext." + error; - } - return null; - }; - - /** - * Creates an InstancesExportRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesExportRequest} InstancesExportRequest - */ - InstancesExportRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesExportRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesExportRequest(); - if (object.exportContext != null) { - if (typeof object.exportContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesExportRequest.exportContext: object expected"); - message.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.fromObject(object.exportContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesExportRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesExportRequest} message InstancesExportRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesExportRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.exportContext = null; - if (message.exportContext != null && message.hasOwnProperty("exportContext")) - object.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.toObject(message.exportContext, options); - return object; - }; - - /** - * Converts this InstancesExportRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesExportRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesExportRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesExportRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesExportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesExportRequest"; - }; - - return InstancesExportRequest; - })(); - - v1beta4.InstancesFailoverRequest = (function() { - - /** - * Properties of an InstancesFailoverRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesFailoverRequest - * @property {google.cloud.sql.v1beta4.IFailoverContext|null} [failoverContext] InstancesFailoverRequest failoverContext - */ - - /** - * Constructs a new InstancesFailoverRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesFailoverRequest. - * @implements IInstancesFailoverRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesFailoverRequest=} [properties] Properties to set - */ - function InstancesFailoverRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesFailoverRequest failoverContext. - * @member {google.cloud.sql.v1beta4.IFailoverContext|null|undefined} failoverContext - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @instance - */ - InstancesFailoverRequest.prototype.failoverContext = null; - - /** - * Creates a new InstancesFailoverRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesFailoverRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesFailoverRequest} InstancesFailoverRequest instance - */ - InstancesFailoverRequest.create = function create(properties) { - return new InstancesFailoverRequest(properties); - }; - - /** - * Encodes the specified InstancesFailoverRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesFailoverRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesFailoverRequest} message InstancesFailoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesFailoverRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.failoverContext != null && Object.hasOwnProperty.call(message, "failoverContext")) - $root.google.cloud.sql.v1beta4.FailoverContext.encode(message.failoverContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesFailoverRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesFailoverRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesFailoverRequest} message InstancesFailoverRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesFailoverRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesFailoverRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesFailoverRequest} InstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesFailoverRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesFailoverRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.failoverContext = $root.google.cloud.sql.v1beta4.FailoverContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesFailoverRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesFailoverRequest} InstancesFailoverRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesFailoverRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesFailoverRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesFailoverRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.failoverContext != null && message.hasOwnProperty("failoverContext")) { - var error = $root.google.cloud.sql.v1beta4.FailoverContext.verify(message.failoverContext); - if (error) - return "failoverContext." + error; - } - return null; - }; - - /** - * Creates an InstancesFailoverRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesFailoverRequest} InstancesFailoverRequest - */ - InstancesFailoverRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesFailoverRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesFailoverRequest(); - if (object.failoverContext != null) { - if (typeof object.failoverContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesFailoverRequest.failoverContext: object expected"); - message.failoverContext = $root.google.cloud.sql.v1beta4.FailoverContext.fromObject(object.failoverContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesFailoverRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesFailoverRequest} message InstancesFailoverRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesFailoverRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.failoverContext = null; - if (message.failoverContext != null && message.hasOwnProperty("failoverContext")) - object.failoverContext = $root.google.cloud.sql.v1beta4.FailoverContext.toObject(message.failoverContext, options); - return object; - }; - - /** - * Converts this InstancesFailoverRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesFailoverRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesFailoverRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesFailoverRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesFailoverRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesFailoverRequest"; - }; - - return InstancesFailoverRequest; - })(); - - v1beta4.InstancesImportRequest = (function() { - - /** - * Properties of an InstancesImportRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesImportRequest - * @property {google.cloud.sql.v1beta4.IImportContext|null} [importContext] InstancesImportRequest importContext - */ - - /** - * Constructs a new InstancesImportRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesImportRequest. - * @implements IInstancesImportRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesImportRequest=} [properties] Properties to set - */ - function InstancesImportRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesImportRequest importContext. - * @member {google.cloud.sql.v1beta4.IImportContext|null|undefined} importContext - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @instance - */ - InstancesImportRequest.prototype.importContext = null; - - /** - * Creates a new InstancesImportRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesImportRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesImportRequest} InstancesImportRequest instance - */ - InstancesImportRequest.create = function create(properties) { - return new InstancesImportRequest(properties); - }; - - /** - * Encodes the specified InstancesImportRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesImportRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesImportRequest} message InstancesImportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesImportRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.importContext != null && Object.hasOwnProperty.call(message, "importContext")) - $root.google.cloud.sql.v1beta4.ImportContext.encode(message.importContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesImportRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesImportRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesImportRequest} message InstancesImportRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesImportRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesImportRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesImportRequest} InstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesImportRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesImportRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.importContext = $root.google.cloud.sql.v1beta4.ImportContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesImportRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesImportRequest} InstancesImportRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesImportRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesImportRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesImportRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.importContext != null && message.hasOwnProperty("importContext")) { - var error = $root.google.cloud.sql.v1beta4.ImportContext.verify(message.importContext); - if (error) - return "importContext." + error; - } - return null; - }; - - /** - * Creates an InstancesImportRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesImportRequest} InstancesImportRequest - */ - InstancesImportRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesImportRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesImportRequest(); - if (object.importContext != null) { - if (typeof object.importContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesImportRequest.importContext: object expected"); - message.importContext = $root.google.cloud.sql.v1beta4.ImportContext.fromObject(object.importContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesImportRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesImportRequest} message InstancesImportRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesImportRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.importContext = null; - if (message.importContext != null && message.hasOwnProperty("importContext")) - object.importContext = $root.google.cloud.sql.v1beta4.ImportContext.toObject(message.importContext, options); - return object; - }; - - /** - * Converts this InstancesImportRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesImportRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesImportRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesImportRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesImportRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesImportRequest"; - }; - - return InstancesImportRequest; - })(); - - v1beta4.InstancesPreCheckMajorVersionUpgradeRequest = (function() { - - /** - * Properties of an InstancesPreCheckMajorVersionUpgradeRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesPreCheckMajorVersionUpgradeRequest - * @property {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null} [preCheckMajorVersionUpgradeContext] InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext - */ - - /** - * Constructs a new InstancesPreCheckMajorVersionUpgradeRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesPreCheckMajorVersionUpgradeRequest. - * @implements IInstancesPreCheckMajorVersionUpgradeRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set - */ - function InstancesPreCheckMajorVersionUpgradeRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesPreCheckMajorVersionUpgradeRequest preCheckMajorVersionUpgradeContext. - * @member {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null|undefined} preCheckMajorVersionUpgradeContext - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @instance - */ - InstancesPreCheckMajorVersionUpgradeRequest.prototype.preCheckMajorVersionUpgradeContext = null; - - /** - * Creates a new InstancesPreCheckMajorVersionUpgradeRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest instance - */ - InstancesPreCheckMajorVersionUpgradeRequest.create = function create(properties) { - return new InstancesPreCheckMajorVersionUpgradeRequest(properties); - }; - - /** - * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesPreCheckMajorVersionUpgradeRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.preCheckMajorVersionUpgradeContext != null && Object.hasOwnProperty.call(message, "preCheckMajorVersionUpgradeContext")) - $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.encode(message.preCheckMajorVersionUpgradeContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesPreCheckMajorVersionUpgradeRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesPreCheckMajorVersionUpgradeRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesPreCheckMajorVersionUpgradeRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesPreCheckMajorVersionUpgradeRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesPreCheckMajorVersionUpgradeRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesPreCheckMajorVersionUpgradeRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesPreCheckMajorVersionUpgradeRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) { - var error = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify(message.preCheckMajorVersionUpgradeContext); - if (error) - return "preCheckMajorVersionUpgradeContext." + error; - } - return null; - }; - - /** - * Creates an InstancesPreCheckMajorVersionUpgradeRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} InstancesPreCheckMajorVersionUpgradeRequest - */ - InstancesPreCheckMajorVersionUpgradeRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest(); - if (object.preCheckMajorVersionUpgradeContext != null) { - if (typeof object.preCheckMajorVersionUpgradeContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest.preCheckMajorVersionUpgradeContext: object expected"); - message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.fromObject(object.preCheckMajorVersionUpgradeContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesPreCheckMajorVersionUpgradeRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} message InstancesPreCheckMajorVersionUpgradeRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesPreCheckMajorVersionUpgradeRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.preCheckMajorVersionUpgradeContext = null; - if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) - object.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.toObject(message.preCheckMajorVersionUpgradeContext, options); - return object; - }; - - /** - * Converts this InstancesPreCheckMajorVersionUpgradeRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesPreCheckMajorVersionUpgradeRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesPreCheckMajorVersionUpgradeRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesPreCheckMajorVersionUpgradeRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest"; - }; - - return InstancesPreCheckMajorVersionUpgradeRequest; - })(); - - v1beta4.MySqlSyncConfig = (function() { - - /** - * Properties of a MySqlSyncConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IMySqlSyncConfig - * @property {Array.|null} [initialSyncFlags] MySqlSyncConfig initialSyncFlags - */ - - /** - * Constructs a new MySqlSyncConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a MySqlSyncConfig. - * @implements IMySqlSyncConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IMySqlSyncConfig=} [properties] Properties to set - */ - function MySqlSyncConfig(properties) { - this.initialSyncFlags = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MySqlSyncConfig initialSyncFlags. - * @member {Array.} initialSyncFlags - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @instance - */ - MySqlSyncConfig.prototype.initialSyncFlags = $util.emptyArray; - - /** - * Creates a new MySqlSyncConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @static - * @param {google.cloud.sql.v1beta4.IMySqlSyncConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.MySqlSyncConfig} MySqlSyncConfig instance - */ - MySqlSyncConfig.create = function create(properties) { - return new MySqlSyncConfig(properties); - }; - - /** - * Encodes the specified MySqlSyncConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlSyncConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @static - * @param {google.cloud.sql.v1beta4.IMySqlSyncConfig} message MySqlSyncConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MySqlSyncConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.initialSyncFlags != null && message.initialSyncFlags.length) - for (var i = 0; i < message.initialSyncFlags.length; ++i) - $root.google.cloud.sql.v1beta4.SyncFlags.encode(message.initialSyncFlags[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MySqlSyncConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlSyncConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @static - * @param {google.cloud.sql.v1beta4.IMySqlSyncConfig} message MySqlSyncConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MySqlSyncConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MySqlSyncConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.MySqlSyncConfig} MySqlSyncConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MySqlSyncConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.MySqlSyncConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.initialSyncFlags && message.initialSyncFlags.length)) - message.initialSyncFlags = []; - message.initialSyncFlags.push($root.google.cloud.sql.v1beta4.SyncFlags.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MySqlSyncConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.MySqlSyncConfig} MySqlSyncConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MySqlSyncConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MySqlSyncConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MySqlSyncConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.initialSyncFlags != null && message.hasOwnProperty("initialSyncFlags")) { - if (!Array.isArray(message.initialSyncFlags)) - return "initialSyncFlags: array expected"; - for (var i = 0; i < message.initialSyncFlags.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.SyncFlags.verify(message.initialSyncFlags[i]); - if (error) - return "initialSyncFlags." + error; - } - } - return null; - }; - - /** - * Creates a MySqlSyncConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.MySqlSyncConfig} MySqlSyncConfig - */ - MySqlSyncConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.MySqlSyncConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.MySqlSyncConfig(); - if (object.initialSyncFlags) { - if (!Array.isArray(object.initialSyncFlags)) - throw TypeError(".google.cloud.sql.v1beta4.MySqlSyncConfig.initialSyncFlags: array expected"); - message.initialSyncFlags = []; - for (var i = 0; i < object.initialSyncFlags.length; ++i) { - if (typeof object.initialSyncFlags[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.MySqlSyncConfig.initialSyncFlags: object expected"); - message.initialSyncFlags[i] = $root.google.cloud.sql.v1beta4.SyncFlags.fromObject(object.initialSyncFlags[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a MySqlSyncConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @static - * @param {google.cloud.sql.v1beta4.MySqlSyncConfig} message MySqlSyncConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MySqlSyncConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.initialSyncFlags = []; - if (message.initialSyncFlags && message.initialSyncFlags.length) { - object.initialSyncFlags = []; - for (var j = 0; j < message.initialSyncFlags.length; ++j) - object.initialSyncFlags[j] = $root.google.cloud.sql.v1beta4.SyncFlags.toObject(message.initialSyncFlags[j], options); - } - return object; - }; - - /** - * Converts this MySqlSyncConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @instance - * @returns {Object.} JSON object - */ - MySqlSyncConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MySqlSyncConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.MySqlSyncConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MySqlSyncConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.MySqlSyncConfig"; - }; - - return MySqlSyncConfig; - })(); - - v1beta4.InstancesListResponse = (function() { - - /** - * Properties of an InstancesListResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesListResponse - * @property {string|null} [kind] InstancesListResponse kind - * @property {Array.|null} [warnings] InstancesListResponse warnings - * @property {Array.|null} [items] InstancesListResponse items - * @property {string|null} [nextPageToken] InstancesListResponse nextPageToken - */ - - /** - * Constructs a new InstancesListResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesListResponse. - * @implements IInstancesListResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesListResponse=} [properties] Properties to set - */ - function InstancesListResponse(properties) { - this.warnings = []; - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @instance - */ - InstancesListResponse.prototype.kind = ""; - - /** - * InstancesListResponse warnings. - * @member {Array.} warnings - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @instance - */ - InstancesListResponse.prototype.warnings = $util.emptyArray; - - /** - * InstancesListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @instance - */ - InstancesListResponse.prototype.items = $util.emptyArray; - - /** - * InstancesListResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @instance - */ - InstancesListResponse.prototype.nextPageToken = ""; - - /** - * Creates a new InstancesListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesListResponse} InstancesListResponse instance - */ - InstancesListResponse.create = function create(properties) { - return new InstancesListResponse(properties); - }; - - /** - * Encodes the specified InstancesListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListResponse} message InstancesListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.warnings != null && message.warnings.length) - for (var i = 0; i < message.warnings.length; ++i) - $root.google.cloud.sql.v1beta4.ApiWarning.encode(message.warnings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.items[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified InstancesListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListResponse} message InstancesListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesListResponse} InstancesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.warnings && message.warnings.length)) - message.warnings = []; - message.warnings.push($root.google.cloud.sql.v1beta4.ApiWarning.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32())); - break; - } - case 4: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesListResponse} InstancesListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesListResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.warnings != null && message.hasOwnProperty("warnings")) { - if (!Array.isArray(message.warnings)) - return "warnings: array expected"; - for (var i = 0; i < message.warnings.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.ApiWarning.verify(message.warnings[i]); - if (error) - return "warnings." + error; - } - } - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.items[i]); - if (error) - return "items." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates an InstancesListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesListResponse} InstancesListResponse - */ - InstancesListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesListResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.warnings) { - if (!Array.isArray(object.warnings)) - throw TypeError(".google.cloud.sql.v1beta4.InstancesListResponse.warnings: array expected"); - message.warnings = []; - for (var i = 0; i < object.warnings.length; ++i) { - if (typeof object.warnings[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesListResponse.warnings: object expected"); - message.warnings[i] = $root.google.cloud.sql.v1beta4.ApiWarning.fromObject(object.warnings[i]); - } - } - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1beta4.InstancesListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.items[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from an InstancesListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @static - * @param {google.cloud.sql.v1beta4.InstancesListResponse} message InstancesListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.warnings = []; - object.items = []; - } - if (options.defaults) { - object.kind = ""; - object.nextPageToken = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.warnings && message.warnings.length) { - object.warnings = []; - for (var j = 0; j < message.warnings.length; ++j) - object.warnings[j] = $root.google.cloud.sql.v1beta4.ApiWarning.toObject(message.warnings[j], options); - } - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.items[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this InstancesListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @instance - * @returns {Object.} JSON object - */ - InstancesListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesListResponse"; - }; - - return InstancesListResponse; - })(); - - v1beta4.InstancesListServerCasResponse = (function() { - - /** - * Properties of an InstancesListServerCasResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesListServerCasResponse - * @property {Array.|null} [certs] InstancesListServerCasResponse certs - * @property {string|null} [activeVersion] InstancesListServerCasResponse activeVersion - * @property {string|null} [kind] InstancesListServerCasResponse kind - */ - - /** - * Constructs a new InstancesListServerCasResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesListServerCasResponse. - * @implements IInstancesListServerCasResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesListServerCasResponse=} [properties] Properties to set - */ - function InstancesListServerCasResponse(properties) { - this.certs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesListServerCasResponse certs. - * @member {Array.} certs - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @instance - */ - InstancesListServerCasResponse.prototype.certs = $util.emptyArray; - - /** - * InstancesListServerCasResponse activeVersion. - * @member {string} activeVersion - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @instance - */ - InstancesListServerCasResponse.prototype.activeVersion = ""; - - /** - * InstancesListServerCasResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @instance - */ - InstancesListServerCasResponse.prototype.kind = ""; - - /** - * Creates a new InstancesListServerCasResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListServerCasResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesListServerCasResponse} InstancesListServerCasResponse instance - */ - InstancesListServerCasResponse.create = function create(properties) { - return new InstancesListServerCasResponse(properties); - }; - - /** - * Encodes the specified InstancesListServerCasResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCasResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListServerCasResponse} message InstancesListServerCasResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListServerCasResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certs != null && message.certs.length) - for (var i = 0; i < message.certs.length; ++i) - $root.google.cloud.sql.v1beta4.SslCert.encode(message.certs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.activeVersion); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - return writer; - }; - - /** - * Encodes the specified InstancesListServerCasResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCasResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListServerCasResponse} message InstancesListServerCasResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListServerCasResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesListServerCasResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesListServerCasResponse} InstancesListServerCasResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListServerCasResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesListServerCasResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.certs && message.certs.length)) - message.certs = []; - message.certs.push($root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32())); - break; - } - case 2: { - message.activeVersion = reader.string(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesListServerCasResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesListServerCasResponse} InstancesListServerCasResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListServerCasResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesListServerCasResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesListServerCasResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certs != null && message.hasOwnProperty("certs")) { - if (!Array.isArray(message.certs)) - return "certs: array expected"; - for (var i = 0; i < message.certs.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.certs[i]); - if (error) - return "certs." + error; - } - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - if (!$util.isString(message.activeVersion)) - return "activeVersion: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates an InstancesListServerCasResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesListServerCasResponse} InstancesListServerCasResponse - */ - InstancesListServerCasResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesListServerCasResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesListServerCasResponse(); - if (object.certs) { - if (!Array.isArray(object.certs)) - throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCasResponse.certs: array expected"); - message.certs = []; - for (var i = 0; i < object.certs.length; ++i) { - if (typeof object.certs[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCasResponse.certs: object expected"); - message.certs[i] = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.certs[i]); - } - } - if (object.activeVersion != null) - message.activeVersion = String(object.activeVersion); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from an InstancesListServerCasResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @static - * @param {google.cloud.sql.v1beta4.InstancesListServerCasResponse} message InstancesListServerCasResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesListServerCasResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.certs = []; - if (options.defaults) { - object.activeVersion = ""; - object.kind = ""; - } - if (message.certs && message.certs.length) { - object.certs = []; - for (var j = 0; j < message.certs.length; ++j) - object.certs[j] = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.certs[j], options); - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - object.activeVersion = message.activeVersion; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this InstancesListServerCasResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @instance - * @returns {Object.} JSON object - */ - InstancesListServerCasResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesListServerCasResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesListServerCasResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesListServerCasResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesListServerCasResponse"; - }; - - return InstancesListServerCasResponse; - })(); - - v1beta4.InstancesListServerCertificatesResponse = (function() { - - /** - * Properties of an InstancesListServerCertificatesResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesListServerCertificatesResponse - * @property {Array.|null} [caCerts] InstancesListServerCertificatesResponse caCerts - * @property {Array.|null} [serverCerts] InstancesListServerCertificatesResponse serverCerts - * @property {string|null} [activeVersion] InstancesListServerCertificatesResponse activeVersion - * @property {string|null} [kind] InstancesListServerCertificatesResponse kind - */ - - /** - * Constructs a new InstancesListServerCertificatesResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesListServerCertificatesResponse. - * @implements IInstancesListServerCertificatesResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse=} [properties] Properties to set - */ - function InstancesListServerCertificatesResponse(properties) { - this.caCerts = []; - this.serverCerts = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesListServerCertificatesResponse caCerts. - * @member {Array.} caCerts - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @instance - */ - InstancesListServerCertificatesResponse.prototype.caCerts = $util.emptyArray; - - /** - * InstancesListServerCertificatesResponse serverCerts. - * @member {Array.} serverCerts - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @instance - */ - InstancesListServerCertificatesResponse.prototype.serverCerts = $util.emptyArray; - - /** - * InstancesListServerCertificatesResponse activeVersion. - * @member {string} activeVersion - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @instance - */ - InstancesListServerCertificatesResponse.prototype.activeVersion = ""; - - /** - * InstancesListServerCertificatesResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @instance - */ - InstancesListServerCertificatesResponse.prototype.kind = ""; - - /** - * Creates a new InstancesListServerCertificatesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse instance - */ - InstancesListServerCertificatesResponse.create = function create(properties) { - return new InstancesListServerCertificatesResponse(properties); - }; - - /** - * Encodes the specified InstancesListServerCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListServerCertificatesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.caCerts != null && message.caCerts.length) - for (var i = 0; i < message.caCerts.length; ++i) - $root.google.cloud.sql.v1beta4.SslCert.encode(message.caCerts[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.serverCerts != null && message.serverCerts.length) - for (var i = 0; i < message.serverCerts.length; ++i) - $root.google.cloud.sql.v1beta4.SslCert.encode(message.serverCerts[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.activeVersion); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); - return writer; - }; - - /** - * Encodes the specified InstancesListServerCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListServerCertificatesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListServerCertificatesResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.caCerts && message.caCerts.length)) - message.caCerts = []; - message.caCerts.push($root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.serverCerts && message.serverCerts.length)) - message.serverCerts = []; - message.serverCerts.push($root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32())); - break; - } - case 3: { - message.activeVersion = reader.string(); - break; - } - case 4: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesListServerCertificatesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListServerCertificatesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesListServerCertificatesResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesListServerCertificatesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.caCerts != null && message.hasOwnProperty("caCerts")) { - if (!Array.isArray(message.caCerts)) - return "caCerts: array expected"; - for (var i = 0; i < message.caCerts.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.caCerts[i]); - if (error) - return "caCerts." + error; - } - } - if (message.serverCerts != null && message.hasOwnProperty("serverCerts")) { - if (!Array.isArray(message.serverCerts)) - return "serverCerts: array expected"; - for (var i = 0; i < message.serverCerts.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.serverCerts[i]); - if (error) - return "serverCerts." + error; - } - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - if (!$util.isString(message.activeVersion)) - return "activeVersion: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates an InstancesListServerCertificatesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} InstancesListServerCertificatesResponse - */ - InstancesListServerCertificatesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse(); - if (object.caCerts) { - if (!Array.isArray(object.caCerts)) - throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.caCerts: array expected"); - message.caCerts = []; - for (var i = 0; i < object.caCerts.length; ++i) { - if (typeof object.caCerts[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.caCerts: object expected"); - message.caCerts[i] = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.caCerts[i]); - } - } - if (object.serverCerts) { - if (!Array.isArray(object.serverCerts)) - throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.serverCerts: array expected"); - message.serverCerts = []; - for (var i = 0; i < object.serverCerts.length; ++i) { - if (typeof object.serverCerts[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse.serverCerts: object expected"); - message.serverCerts[i] = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.serverCerts[i]); - } - } - if (object.activeVersion != null) - message.activeVersion = String(object.activeVersion); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from an InstancesListServerCertificatesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @static - * @param {google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse} message InstancesListServerCertificatesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesListServerCertificatesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.caCerts = []; - object.serverCerts = []; - } - if (options.defaults) { - object.activeVersion = ""; - object.kind = ""; - } - if (message.caCerts && message.caCerts.length) { - object.caCerts = []; - for (var j = 0; j < message.caCerts.length; ++j) - object.caCerts[j] = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.caCerts[j], options); - } - if (message.serverCerts && message.serverCerts.length) { - object.serverCerts = []; - for (var j = 0; j < message.serverCerts.length; ++j) - object.serverCerts[j] = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.serverCerts[j], options); - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - object.activeVersion = message.activeVersion; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this InstancesListServerCertificatesResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @instance - * @returns {Object.} JSON object - */ - InstancesListServerCertificatesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesListServerCertificatesResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesListServerCertificatesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse"; - }; - - return InstancesListServerCertificatesResponse; - })(); - - v1beta4.InstancesListEntraIdCertificatesResponse = (function() { - - /** - * Properties of an InstancesListEntraIdCertificatesResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesListEntraIdCertificatesResponse - * @property {Array.|null} [certs] InstancesListEntraIdCertificatesResponse certs - * @property {string|null} [activeVersion] InstancesListEntraIdCertificatesResponse activeVersion - * @property {string|null} [kind] InstancesListEntraIdCertificatesResponse kind - */ - - /** - * Constructs a new InstancesListEntraIdCertificatesResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesListEntraIdCertificatesResponse. - * @implements IInstancesListEntraIdCertificatesResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse=} [properties] Properties to set - */ - function InstancesListEntraIdCertificatesResponse(properties) { - this.certs = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesListEntraIdCertificatesResponse certs. - * @member {Array.} certs - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @instance - */ - InstancesListEntraIdCertificatesResponse.prototype.certs = $util.emptyArray; - - /** - * InstancesListEntraIdCertificatesResponse activeVersion. - * @member {string} activeVersion - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @instance - */ - InstancesListEntraIdCertificatesResponse.prototype.activeVersion = ""; - - /** - * InstancesListEntraIdCertificatesResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @instance - */ - InstancesListEntraIdCertificatesResponse.prototype.kind = ""; - - /** - * Creates a new InstancesListEntraIdCertificatesResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse instance - */ - InstancesListEntraIdCertificatesResponse.create = function create(properties) { - return new InstancesListEntraIdCertificatesResponse(properties); - }; - - /** - * Encodes the specified InstancesListEntraIdCertificatesResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListEntraIdCertificatesResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certs != null && message.certs.length) - for (var i = 0; i < message.certs.length; ++i) - $root.google.cloud.sql.v1beta4.SslCert.encode(message.certs[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.activeVersion != null && Object.hasOwnProperty.call(message, "activeVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.activeVersion); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - return writer; - }; - - /** - * Encodes the specified InstancesListEntraIdCertificatesResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @static - * @param {google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesListEntraIdCertificatesResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListEntraIdCertificatesResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.certs && message.certs.length)) - message.certs = []; - message.certs.push($root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32())); - break; - } - case 2: { - message.activeVersion = reader.string(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesListEntraIdCertificatesResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesListEntraIdCertificatesResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesListEntraIdCertificatesResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesListEntraIdCertificatesResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certs != null && message.hasOwnProperty("certs")) { - if (!Array.isArray(message.certs)) - return "certs: array expected"; - for (var i = 0; i < message.certs.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.certs[i]); - if (error) - return "certs." + error; - } - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - if (!$util.isString(message.activeVersion)) - return "activeVersion: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates an InstancesListEntraIdCertificatesResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} InstancesListEntraIdCertificatesResponse - */ - InstancesListEntraIdCertificatesResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse(); - if (object.certs) { - if (!Array.isArray(object.certs)) - throw TypeError(".google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.certs: array expected"); - message.certs = []; - for (var i = 0; i < object.certs.length; ++i) { - if (typeof object.certs[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse.certs: object expected"); - message.certs[i] = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.certs[i]); - } - } - if (object.activeVersion != null) - message.activeVersion = String(object.activeVersion); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from an InstancesListEntraIdCertificatesResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @static - * @param {google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse} message InstancesListEntraIdCertificatesResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesListEntraIdCertificatesResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.certs = []; - if (options.defaults) { - object.activeVersion = ""; - object.kind = ""; - } - if (message.certs && message.certs.length) { - object.certs = []; - for (var j = 0; j < message.certs.length; ++j) - object.certs[j] = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.certs[j], options); - } - if (message.activeVersion != null && message.hasOwnProperty("activeVersion")) - object.activeVersion = message.activeVersion; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this InstancesListEntraIdCertificatesResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @instance - * @returns {Object.} JSON object - */ - InstancesListEntraIdCertificatesResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesListEntraIdCertificatesResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesListEntraIdCertificatesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse"; - }; - - return InstancesListEntraIdCertificatesResponse; - })(); - - v1beta4.InstancesRestoreBackupRequest = (function() { - - /** - * Properties of an InstancesRestoreBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesRestoreBackupRequest - * @property {google.cloud.sql.v1beta4.IRestoreBackupContext|null} [restoreBackupContext] InstancesRestoreBackupRequest restoreBackupContext - * @property {string|null} [backup] InstancesRestoreBackupRequest backup - * @property {string|null} [backupdrBackup] InstancesRestoreBackupRequest backupdrBackup - * @property {google.cloud.sql.v1beta4.IDatabaseInstance|null} [restoreInstanceSettings] InstancesRestoreBackupRequest restoreInstanceSettings - * @property {Array.|null} [restoreInstanceClearOverridesFieldNames] InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames - */ - - /** - * Constructs a new InstancesRestoreBackupRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesRestoreBackupRequest. - * @implements IInstancesRestoreBackupRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest=} [properties] Properties to set - */ - function InstancesRestoreBackupRequest(properties) { - this.restoreInstanceClearOverridesFieldNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesRestoreBackupRequest restoreBackupContext. - * @member {google.cloud.sql.v1beta4.IRestoreBackupContext|null|undefined} restoreBackupContext - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @instance - */ - InstancesRestoreBackupRequest.prototype.restoreBackupContext = null; - - /** - * InstancesRestoreBackupRequest backup. - * @member {string} backup - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @instance - */ - InstancesRestoreBackupRequest.prototype.backup = ""; - - /** - * InstancesRestoreBackupRequest backupdrBackup. - * @member {string} backupdrBackup - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @instance - */ - InstancesRestoreBackupRequest.prototype.backupdrBackup = ""; - - /** - * InstancesRestoreBackupRequest restoreInstanceSettings. - * @member {google.cloud.sql.v1beta4.IDatabaseInstance|null|undefined} restoreInstanceSettings - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @instance - */ - InstancesRestoreBackupRequest.prototype.restoreInstanceSettings = null; - - /** - * InstancesRestoreBackupRequest restoreInstanceClearOverridesFieldNames. - * @member {Array.} restoreInstanceClearOverridesFieldNames - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @instance - */ - InstancesRestoreBackupRequest.prototype.restoreInstanceClearOverridesFieldNames = $util.emptyArray; - - /** - * Creates a new InstancesRestoreBackupRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest instance - */ - InstancesRestoreBackupRequest.create = function create(properties) { - return new InstancesRestoreBackupRequest(properties); - }; - - /** - * Encodes the specified InstancesRestoreBackupRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest} message InstancesRestoreBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRestoreBackupRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.restoreBackupContext != null && Object.hasOwnProperty.call(message, "restoreBackupContext")) - $root.google.cloud.sql.v1beta4.RestoreBackupContext.encode(message.restoreBackupContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.backup != null && Object.hasOwnProperty.call(message, "backup")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.backup); - if (message.restoreInstanceSettings != null && Object.hasOwnProperty.call(message, "restoreInstanceSettings")) - $root.google.cloud.sql.v1beta4.DatabaseInstance.encode(message.restoreInstanceSettings, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.backupdrBackup != null && Object.hasOwnProperty.call(message, "backupdrBackup")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.backupdrBackup); - if (message.restoreInstanceClearOverridesFieldNames != null && message.restoreInstanceClearOverridesFieldNames.length) - for (var i = 0; i < message.restoreInstanceClearOverridesFieldNames.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.restoreInstanceClearOverridesFieldNames[i]); - return writer; - }; - - /** - * Encodes the specified InstancesRestoreBackupRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRestoreBackupRequest} message InstancesRestoreBackupRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRestoreBackupRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRestoreBackupRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.restoreBackupContext = $root.google.cloud.sql.v1beta4.RestoreBackupContext.decode(reader, reader.uint32()); - break; - } - case 2: { - message.backup = reader.string(); - break; - } - case 4: { - message.backupdrBackup = reader.string(); - break; - } - case 3: { - message.restoreInstanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.decode(reader, reader.uint32()); - break; - } - case 5: { - if (!(message.restoreInstanceClearOverridesFieldNames && message.restoreInstanceClearOverridesFieldNames.length)) - message.restoreInstanceClearOverridesFieldNames = []; - message.restoreInstanceClearOverridesFieldNames.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesRestoreBackupRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRestoreBackupRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesRestoreBackupRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesRestoreBackupRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.restoreBackupContext != null && message.hasOwnProperty("restoreBackupContext")) { - var error = $root.google.cloud.sql.v1beta4.RestoreBackupContext.verify(message.restoreBackupContext); - if (error) - return "restoreBackupContext." + error; - } - if (message.backup != null && message.hasOwnProperty("backup")) - if (!$util.isString(message.backup)) - return "backup: string expected"; - if (message.backupdrBackup != null && message.hasOwnProperty("backupdrBackup")) - if (!$util.isString(message.backupdrBackup)) - return "backupdrBackup: string expected"; - if (message.restoreInstanceSettings != null && message.hasOwnProperty("restoreInstanceSettings")) { - var error = $root.google.cloud.sql.v1beta4.DatabaseInstance.verify(message.restoreInstanceSettings); - if (error) - return "restoreInstanceSettings." + error; - } - if (message.restoreInstanceClearOverridesFieldNames != null && message.hasOwnProperty("restoreInstanceClearOverridesFieldNames")) { - if (!Array.isArray(message.restoreInstanceClearOverridesFieldNames)) - return "restoreInstanceClearOverridesFieldNames: array expected"; - for (var i = 0; i < message.restoreInstanceClearOverridesFieldNames.length; ++i) - if (!$util.isString(message.restoreInstanceClearOverridesFieldNames[i])) - return "restoreInstanceClearOverridesFieldNames: string[] expected"; - } - return null; - }; - - /** - * Creates an InstancesRestoreBackupRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} InstancesRestoreBackupRequest - */ - InstancesRestoreBackupRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesRestoreBackupRequest(); - if (object.restoreBackupContext != null) { - if (typeof object.restoreBackupContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.restoreBackupContext: object expected"); - message.restoreBackupContext = $root.google.cloud.sql.v1beta4.RestoreBackupContext.fromObject(object.restoreBackupContext); - } - if (object.backup != null) - message.backup = String(object.backup); - if (object.backupdrBackup != null) - message.backupdrBackup = String(object.backupdrBackup); - if (object.restoreInstanceSettings != null) { - if (typeof object.restoreInstanceSettings !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.restoreInstanceSettings: object expected"); - message.restoreInstanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.fromObject(object.restoreInstanceSettings); - } - if (object.restoreInstanceClearOverridesFieldNames) { - if (!Array.isArray(object.restoreInstanceClearOverridesFieldNames)) - throw TypeError(".google.cloud.sql.v1beta4.InstancesRestoreBackupRequest.restoreInstanceClearOverridesFieldNames: array expected"); - message.restoreInstanceClearOverridesFieldNames = []; - for (var i = 0; i < object.restoreInstanceClearOverridesFieldNames.length; ++i) - message.restoreInstanceClearOverridesFieldNames[i] = String(object.restoreInstanceClearOverridesFieldNames[i]); - } - return message; - }; - - /** - * Creates a plain object from an InstancesRestoreBackupRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} message InstancesRestoreBackupRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesRestoreBackupRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.restoreInstanceClearOverridesFieldNames = []; - if (options.defaults) { - object.restoreBackupContext = null; - object.backup = ""; - object.restoreInstanceSettings = null; - object.backupdrBackup = ""; - } - if (message.restoreBackupContext != null && message.hasOwnProperty("restoreBackupContext")) - object.restoreBackupContext = $root.google.cloud.sql.v1beta4.RestoreBackupContext.toObject(message.restoreBackupContext, options); - if (message.backup != null && message.hasOwnProperty("backup")) - object.backup = message.backup; - if (message.restoreInstanceSettings != null && message.hasOwnProperty("restoreInstanceSettings")) - object.restoreInstanceSettings = $root.google.cloud.sql.v1beta4.DatabaseInstance.toObject(message.restoreInstanceSettings, options); - if (message.backupdrBackup != null && message.hasOwnProperty("backupdrBackup")) - object.backupdrBackup = message.backupdrBackup; - if (message.restoreInstanceClearOverridesFieldNames && message.restoreInstanceClearOverridesFieldNames.length) { - object.restoreInstanceClearOverridesFieldNames = []; - for (var j = 0; j < message.restoreInstanceClearOverridesFieldNames.length; ++j) - object.restoreInstanceClearOverridesFieldNames[j] = message.restoreInstanceClearOverridesFieldNames[j]; - } - return object; - }; - - /** - * Converts this InstancesRestoreBackupRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesRestoreBackupRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesRestoreBackupRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesRestoreBackupRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesRestoreBackupRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesRestoreBackupRequest"; - }; - - return InstancesRestoreBackupRequest; - })(); - - v1beta4.InstancesRotateServerCaRequest = (function() { - - /** - * Properties of an InstancesRotateServerCaRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesRotateServerCaRequest - * @property {google.cloud.sql.v1beta4.IRotateServerCaContext|null} [rotateServerCaContext] InstancesRotateServerCaRequest rotateServerCaContext - */ - - /** - * Constructs a new InstancesRotateServerCaRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesRotateServerCaRequest. - * @implements IInstancesRotateServerCaRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest=} [properties] Properties to set - */ - function InstancesRotateServerCaRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesRotateServerCaRequest rotateServerCaContext. - * @member {google.cloud.sql.v1beta4.IRotateServerCaContext|null|undefined} rotateServerCaContext - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @instance - */ - InstancesRotateServerCaRequest.prototype.rotateServerCaContext = null; - - /** - * Creates a new InstancesRotateServerCaRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest instance - */ - InstancesRotateServerCaRequest.create = function create(properties) { - return new InstancesRotateServerCaRequest(properties); - }; - - /** - * Encodes the specified InstancesRotateServerCaRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest} message InstancesRotateServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateServerCaRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rotateServerCaContext != null && Object.hasOwnProperty.call(message, "rotateServerCaContext")) - $root.google.cloud.sql.v1beta4.RotateServerCaContext.encode(message.rotateServerCaContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesRotateServerCaRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCaRequest} message InstancesRotateServerCaRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateServerCaRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateServerCaRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.rotateServerCaContext = $root.google.cloud.sql.v1beta4.RotateServerCaContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesRotateServerCaRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateServerCaRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesRotateServerCaRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesRotateServerCaRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rotateServerCaContext != null && message.hasOwnProperty("rotateServerCaContext")) { - var error = $root.google.cloud.sql.v1beta4.RotateServerCaContext.verify(message.rotateServerCaContext); - if (error) - return "rotateServerCaContext." + error; - } - return null; - }; - - /** - * Creates an InstancesRotateServerCaRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} InstancesRotateServerCaRequest - */ - InstancesRotateServerCaRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesRotateServerCaRequest(); - if (object.rotateServerCaContext != null) { - if (typeof object.rotateServerCaContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesRotateServerCaRequest.rotateServerCaContext: object expected"); - message.rotateServerCaContext = $root.google.cloud.sql.v1beta4.RotateServerCaContext.fromObject(object.rotateServerCaContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesRotateServerCaRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} message InstancesRotateServerCaRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesRotateServerCaRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.rotateServerCaContext = null; - if (message.rotateServerCaContext != null && message.hasOwnProperty("rotateServerCaContext")) - object.rotateServerCaContext = $root.google.cloud.sql.v1beta4.RotateServerCaContext.toObject(message.rotateServerCaContext, options); - return object; - }; - - /** - * Converts this InstancesRotateServerCaRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesRotateServerCaRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesRotateServerCaRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCaRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesRotateServerCaRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesRotateServerCaRequest"; - }; - - return InstancesRotateServerCaRequest; - })(); - - v1beta4.InstancesRotateServerCertificateRequest = (function() { - - /** - * Properties of an InstancesRotateServerCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesRotateServerCertificateRequest - * @property {google.cloud.sql.v1beta4.IRotateServerCertificateContext|null} [rotateServerCertificateContext] InstancesRotateServerCertificateRequest rotateServerCertificateContext - */ - - /** - * Constructs a new InstancesRotateServerCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesRotateServerCertificateRequest. - * @implements IInstancesRotateServerCertificateRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest=} [properties] Properties to set - */ - function InstancesRotateServerCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesRotateServerCertificateRequest rotateServerCertificateContext. - * @member {google.cloud.sql.v1beta4.IRotateServerCertificateContext|null|undefined} rotateServerCertificateContext - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @instance - */ - InstancesRotateServerCertificateRequest.prototype.rotateServerCertificateContext = null; - - /** - * Creates a new InstancesRotateServerCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest instance - */ - InstancesRotateServerCertificateRequest.create = function create(properties) { - return new InstancesRotateServerCertificateRequest(properties); - }; - - /** - * Encodes the specified InstancesRotateServerCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateServerCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rotateServerCertificateContext != null && Object.hasOwnProperty.call(message, "rotateServerCertificateContext")) - $root.google.cloud.sql.v1beta4.RotateServerCertificateContext.encode(message.rotateServerCertificateContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesRotateServerCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateServerCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateServerCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.rotateServerCertificateContext = $root.google.cloud.sql.v1beta4.RotateServerCertificateContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesRotateServerCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateServerCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesRotateServerCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesRotateServerCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rotateServerCertificateContext != null && message.hasOwnProperty("rotateServerCertificateContext")) { - var error = $root.google.cloud.sql.v1beta4.RotateServerCertificateContext.verify(message.rotateServerCertificateContext); - if (error) - return "rotateServerCertificateContext." + error; - } - return null; - }; - - /** - * Creates an InstancesRotateServerCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} InstancesRotateServerCertificateRequest - */ - InstancesRotateServerCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest(); - if (object.rotateServerCertificateContext != null) { - if (typeof object.rotateServerCertificateContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest.rotateServerCertificateContext: object expected"); - message.rotateServerCertificateContext = $root.google.cloud.sql.v1beta4.RotateServerCertificateContext.fromObject(object.rotateServerCertificateContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesRotateServerCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} message InstancesRotateServerCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesRotateServerCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.rotateServerCertificateContext = null; - if (message.rotateServerCertificateContext != null && message.hasOwnProperty("rotateServerCertificateContext")) - object.rotateServerCertificateContext = $root.google.cloud.sql.v1beta4.RotateServerCertificateContext.toObject(message.rotateServerCertificateContext, options); - return object; - }; - - /** - * Converts this InstancesRotateServerCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesRotateServerCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesRotateServerCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesRotateServerCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest"; - }; - - return InstancesRotateServerCertificateRequest; - })(); - - v1beta4.InstancesRotateEntraIdCertificateRequest = (function() { - - /** - * Properties of an InstancesRotateEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesRotateEntraIdCertificateRequest - * @property {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext|null} [rotateEntraIdCertificateContext] InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext - */ - - /** - * Constructs a new InstancesRotateEntraIdCertificateRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesRotateEntraIdCertificateRequest. - * @implements IInstancesRotateEntraIdCertificateRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set - */ - function InstancesRotateEntraIdCertificateRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesRotateEntraIdCertificateRequest rotateEntraIdCertificateContext. - * @member {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext|null|undefined} rotateEntraIdCertificateContext - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @instance - */ - InstancesRotateEntraIdCertificateRequest.prototype.rotateEntraIdCertificateContext = null; - - /** - * Creates a new InstancesRotateEntraIdCertificateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest instance - */ - InstancesRotateEntraIdCertificateRequest.create = function create(properties) { - return new InstancesRotateEntraIdCertificateRequest(properties); - }; - - /** - * Encodes the specified InstancesRotateEntraIdCertificateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateEntraIdCertificateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rotateEntraIdCertificateContext != null && Object.hasOwnProperty.call(message, "rotateEntraIdCertificateContext")) - $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.encode(message.rotateEntraIdCertificateContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesRotateEntraIdCertificateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesRotateEntraIdCertificateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateEntraIdCertificateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesRotateEntraIdCertificateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesRotateEntraIdCertificateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesRotateEntraIdCertificateRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesRotateEntraIdCertificateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rotateEntraIdCertificateContext != null && message.hasOwnProperty("rotateEntraIdCertificateContext")) { - var error = $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.verify(message.rotateEntraIdCertificateContext); - if (error) - return "rotateEntraIdCertificateContext." + error; - } - return null; - }; - - /** - * Creates an InstancesRotateEntraIdCertificateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} InstancesRotateEntraIdCertificateRequest - */ - InstancesRotateEntraIdCertificateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest(); - if (object.rotateEntraIdCertificateContext != null) { - if (typeof object.rotateEntraIdCertificateContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest.rotateEntraIdCertificateContext: object expected"); - message.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.fromObject(object.rotateEntraIdCertificateContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesRotateEntraIdCertificateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} message InstancesRotateEntraIdCertificateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesRotateEntraIdCertificateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.rotateEntraIdCertificateContext = null; - if (message.rotateEntraIdCertificateContext != null && message.hasOwnProperty("rotateEntraIdCertificateContext")) - object.rotateEntraIdCertificateContext = $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.toObject(message.rotateEntraIdCertificateContext, options); - return object; - }; - - /** - * Converts this InstancesRotateEntraIdCertificateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesRotateEntraIdCertificateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesRotateEntraIdCertificateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesRotateEntraIdCertificateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest"; - }; - - return InstancesRotateEntraIdCertificateRequest; - })(); - - v1beta4.InstancesTruncateLogRequest = (function() { - - /** - * Properties of an InstancesTruncateLogRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesTruncateLogRequest - * @property {google.cloud.sql.v1beta4.ITruncateLogContext|null} [truncateLogContext] InstancesTruncateLogRequest truncateLogContext - */ - - /** - * Constructs a new InstancesTruncateLogRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesTruncateLogRequest. - * @implements IInstancesTruncateLogRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest=} [properties] Properties to set - */ - function InstancesTruncateLogRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesTruncateLogRequest truncateLogContext. - * @member {google.cloud.sql.v1beta4.ITruncateLogContext|null|undefined} truncateLogContext - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @instance - */ - InstancesTruncateLogRequest.prototype.truncateLogContext = null; - - /** - * Creates a new InstancesTruncateLogRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} InstancesTruncateLogRequest instance - */ - InstancesTruncateLogRequest.create = function create(properties) { - return new InstancesTruncateLogRequest(properties); - }; - - /** - * Encodes the specified InstancesTruncateLogRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesTruncateLogRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest} message InstancesTruncateLogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesTruncateLogRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.truncateLogContext != null && Object.hasOwnProperty.call(message, "truncateLogContext")) - $root.google.cloud.sql.v1beta4.TruncateLogContext.encode(message.truncateLogContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesTruncateLogRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesTruncateLogRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesTruncateLogRequest} message InstancesTruncateLogRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesTruncateLogRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} InstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesTruncateLogRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.truncateLogContext = $root.google.cloud.sql.v1beta4.TruncateLogContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesTruncateLogRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} InstancesTruncateLogRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesTruncateLogRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesTruncateLogRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesTruncateLogRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.truncateLogContext != null && message.hasOwnProperty("truncateLogContext")) { - var error = $root.google.cloud.sql.v1beta4.TruncateLogContext.verify(message.truncateLogContext); - if (error) - return "truncateLogContext." + error; - } - return null; - }; - - /** - * Creates an InstancesTruncateLogRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} InstancesTruncateLogRequest - */ - InstancesTruncateLogRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesTruncateLogRequest(); - if (object.truncateLogContext != null) { - if (typeof object.truncateLogContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesTruncateLogRequest.truncateLogContext: object expected"); - message.truncateLogContext = $root.google.cloud.sql.v1beta4.TruncateLogContext.fromObject(object.truncateLogContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesTruncateLogRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} message InstancesTruncateLogRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesTruncateLogRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.truncateLogContext = null; - if (message.truncateLogContext != null && message.hasOwnProperty("truncateLogContext")) - object.truncateLogContext = $root.google.cloud.sql.v1beta4.TruncateLogContext.toObject(message.truncateLogContext, options); - return object; - }; - - /** - * Converts this InstancesTruncateLogRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesTruncateLogRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesTruncateLogRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesTruncateLogRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesTruncateLogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesTruncateLogRequest"; - }; - - return InstancesTruncateLogRequest; - })(); - - v1beta4.InstancesAcquireSsrsLeaseRequest = (function() { - - /** - * Properties of an InstancesAcquireSsrsLeaseRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IInstancesAcquireSsrsLeaseRequest - * @property {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null} [acquireSsrsLeaseContext] InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext - */ - - /** - * Constructs a new InstancesAcquireSsrsLeaseRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InstancesAcquireSsrsLeaseRequest. - * @implements IInstancesAcquireSsrsLeaseRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set - */ - function InstancesAcquireSsrsLeaseRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InstancesAcquireSsrsLeaseRequest acquireSsrsLeaseContext. - * @member {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null|undefined} acquireSsrsLeaseContext - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @instance - */ - InstancesAcquireSsrsLeaseRequest.prototype.acquireSsrsLeaseContext = null; - - /** - * Creates a new InstancesAcquireSsrsLeaseRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest instance - */ - InstancesAcquireSsrsLeaseRequest.create = function create(properties) { - return new InstancesAcquireSsrsLeaseRequest(properties); - }; - - /** - * Encodes the specified InstancesAcquireSsrsLeaseRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesAcquireSsrsLeaseRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.acquireSsrsLeaseContext != null && Object.hasOwnProperty.call(message, "acquireSsrsLeaseContext")) - $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.encode(message.acquireSsrsLeaseContext, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InstancesAcquireSsrsLeaseRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.IInstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InstancesAcquireSsrsLeaseRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesAcquireSsrsLeaseRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InstancesAcquireSsrsLeaseRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InstancesAcquireSsrsLeaseRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InstancesAcquireSsrsLeaseRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InstancesAcquireSsrsLeaseRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) { - var error = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify(message.acquireSsrsLeaseContext); - if (error) - return "acquireSsrsLeaseContext." + error; - } - return null; - }; - - /** - * Creates an InstancesAcquireSsrsLeaseRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} InstancesAcquireSsrsLeaseRequest - */ - InstancesAcquireSsrsLeaseRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest(); - if (object.acquireSsrsLeaseContext != null) { - if (typeof object.acquireSsrsLeaseContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest.acquireSsrsLeaseContext: object expected"); - message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.fromObject(object.acquireSsrsLeaseContext); - } - return message; - }; - - /** - * Creates a plain object from an InstancesAcquireSsrsLeaseRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @static - * @param {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} message InstancesAcquireSsrsLeaseRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InstancesAcquireSsrsLeaseRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.acquireSsrsLeaseContext = null; - if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) - object.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.toObject(message.acquireSsrsLeaseContext, options); - return object; - }; - - /** - * Converts this InstancesAcquireSsrsLeaseRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @instance - * @returns {Object.} JSON object - */ - InstancesAcquireSsrsLeaseRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InstancesAcquireSsrsLeaseRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InstancesAcquireSsrsLeaseRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest"; - }; - - return InstancesAcquireSsrsLeaseRequest; - })(); - - v1beta4.PointInTimeRestoreContext = (function() { - - /** - * Properties of a PointInTimeRestoreContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IPointInTimeRestoreContext - * @property {string|null} [datasource] PointInTimeRestoreContext datasource - * @property {google.protobuf.ITimestamp|null} [pointInTime] PointInTimeRestoreContext pointInTime - * @property {string|null} [targetInstance] PointInTimeRestoreContext targetInstance - * @property {string|null} [privateNetwork] PointInTimeRestoreContext privateNetwork - * @property {string|null} [allocatedIpRange] PointInTimeRestoreContext allocatedIpRange - * @property {string|null} [preferredZone] PointInTimeRestoreContext preferredZone - * @property {string|null} [preferredSecondaryZone] PointInTimeRestoreContext preferredSecondaryZone - */ - - /** - * Constructs a new PointInTimeRestoreContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a PointInTimeRestoreContext. - * @implements IPointInTimeRestoreContext - * @constructor - * @param {google.cloud.sql.v1beta4.IPointInTimeRestoreContext=} [properties] Properties to set - */ - function PointInTimeRestoreContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PointInTimeRestoreContext datasource. - * @member {string|null|undefined} datasource - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.datasource = null; - - /** - * PointInTimeRestoreContext pointInTime. - * @member {google.protobuf.ITimestamp|null|undefined} pointInTime - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.pointInTime = null; - - /** - * PointInTimeRestoreContext targetInstance. - * @member {string|null|undefined} targetInstance - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.targetInstance = null; - - /** - * PointInTimeRestoreContext privateNetwork. - * @member {string|null|undefined} privateNetwork - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.privateNetwork = null; - - /** - * PointInTimeRestoreContext allocatedIpRange. - * @member {string|null|undefined} allocatedIpRange - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.allocatedIpRange = null; - - /** - * PointInTimeRestoreContext preferredZone. - * @member {string|null|undefined} preferredZone - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.preferredZone = null; - - /** - * PointInTimeRestoreContext preferredSecondaryZone. - * @member {string|null|undefined} preferredSecondaryZone - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @instance - */ - PointInTimeRestoreContext.prototype.preferredSecondaryZone = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_datasource", { - get: $util.oneOfGetter($oneOfFields = ["datasource"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_targetInstance", { - get: $util.oneOfGetter($oneOfFields = ["targetInstance"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_privateNetwork", { - get: $util.oneOfGetter($oneOfFields = ["privateNetwork"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_allocatedIpRange", { - get: $util.oneOfGetter($oneOfFields = ["allocatedIpRange"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_preferredZone", { - get: $util.oneOfGetter($oneOfFields = ["preferredZone"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PointInTimeRestoreContext.prototype, "_preferredSecondaryZone", { - get: $util.oneOfGetter($oneOfFields = ["preferredSecondaryZone"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PointInTimeRestoreContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @static - * @param {google.cloud.sql.v1beta4.IPointInTimeRestoreContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.PointInTimeRestoreContext} PointInTimeRestoreContext instance - */ - PointInTimeRestoreContext.create = function create(properties) { - return new PointInTimeRestoreContext(properties); - }; - - /** - * Encodes the specified PointInTimeRestoreContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PointInTimeRestoreContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @static - * @param {google.cloud.sql.v1beta4.IPointInTimeRestoreContext} message PointInTimeRestoreContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PointInTimeRestoreContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.datasource != null && Object.hasOwnProperty.call(message, "datasource")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasource); - if (message.pointInTime != null && Object.hasOwnProperty.call(message, "pointInTime")) - $root.google.protobuf.Timestamp.encode(message.pointInTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.targetInstance != null && Object.hasOwnProperty.call(message, "targetInstance")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.targetInstance); - if (message.privateNetwork != null && Object.hasOwnProperty.call(message, "privateNetwork")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.privateNetwork); - if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.allocatedIpRange); - if (message.preferredZone != null && Object.hasOwnProperty.call(message, "preferredZone")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.preferredZone); - if (message.preferredSecondaryZone != null && Object.hasOwnProperty.call(message, "preferredSecondaryZone")) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.preferredSecondaryZone); - return writer; - }; - - /** - * Encodes the specified PointInTimeRestoreContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PointInTimeRestoreContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @static - * @param {google.cloud.sql.v1beta4.IPointInTimeRestoreContext} message PointInTimeRestoreContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PointInTimeRestoreContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PointInTimeRestoreContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.PointInTimeRestoreContext} PointInTimeRestoreContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PointInTimeRestoreContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.datasource = reader.string(); - break; - } - case 2: { - message.pointInTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 3: { - message.targetInstance = reader.string(); - break; - } - case 4: { - message.privateNetwork = reader.string(); - break; - } - case 5: { - message.allocatedIpRange = reader.string(); - break; - } - case 6: { - message.preferredZone = reader.string(); - break; - } - case 9: { - message.preferredSecondaryZone = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PointInTimeRestoreContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.PointInTimeRestoreContext} PointInTimeRestoreContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PointInTimeRestoreContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PointInTimeRestoreContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PointInTimeRestoreContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.datasource != null && message.hasOwnProperty("datasource")) { - properties._datasource = 1; - if (!$util.isString(message.datasource)) - return "datasource: string expected"; - } - if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.pointInTime); - if (error) - return "pointInTime." + error; - } - if (message.targetInstance != null && message.hasOwnProperty("targetInstance")) { - properties._targetInstance = 1; - if (!$util.isString(message.targetInstance)) - return "targetInstance: string expected"; - } - if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) { - properties._privateNetwork = 1; - if (!$util.isString(message.privateNetwork)) - return "privateNetwork: string expected"; - } - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) { - properties._allocatedIpRange = 1; - if (!$util.isString(message.allocatedIpRange)) - return "allocatedIpRange: string expected"; - } - if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { - properties._preferredZone = 1; - if (!$util.isString(message.preferredZone)) - return "preferredZone: string expected"; - } - if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { - properties._preferredSecondaryZone = 1; - if (!$util.isString(message.preferredSecondaryZone)) - return "preferredSecondaryZone: string expected"; - } - return null; - }; - - /** - * Creates a PointInTimeRestoreContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.PointInTimeRestoreContext} PointInTimeRestoreContext - */ - PointInTimeRestoreContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.PointInTimeRestoreContext(); - if (object.datasource != null) - message.datasource = String(object.datasource); - if (object.pointInTime != null) { - if (typeof object.pointInTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.PointInTimeRestoreContext.pointInTime: object expected"); - message.pointInTime = $root.google.protobuf.Timestamp.fromObject(object.pointInTime); - } - if (object.targetInstance != null) - message.targetInstance = String(object.targetInstance); - if (object.privateNetwork != null) - message.privateNetwork = String(object.privateNetwork); - if (object.allocatedIpRange != null) - message.allocatedIpRange = String(object.allocatedIpRange); - if (object.preferredZone != null) - message.preferredZone = String(object.preferredZone); - if (object.preferredSecondaryZone != null) - message.preferredSecondaryZone = String(object.preferredSecondaryZone); - return message; - }; - - /** - * Creates a plain object from a PointInTimeRestoreContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @static - * @param {google.cloud.sql.v1beta4.PointInTimeRestoreContext} message PointInTimeRestoreContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PointInTimeRestoreContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.pointInTime = null; - if (message.datasource != null && message.hasOwnProperty("datasource")) { - object.datasource = message.datasource; - if (options.oneofs) - object._datasource = "datasource"; - } - if (message.pointInTime != null && message.hasOwnProperty("pointInTime")) - object.pointInTime = $root.google.protobuf.Timestamp.toObject(message.pointInTime, options); - if (message.targetInstance != null && message.hasOwnProperty("targetInstance")) { - object.targetInstance = message.targetInstance; - if (options.oneofs) - object._targetInstance = "targetInstance"; - } - if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) { - object.privateNetwork = message.privateNetwork; - if (options.oneofs) - object._privateNetwork = "privateNetwork"; - } - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) { - object.allocatedIpRange = message.allocatedIpRange; - if (options.oneofs) - object._allocatedIpRange = "allocatedIpRange"; - } - if (message.preferredZone != null && message.hasOwnProperty("preferredZone")) { - object.preferredZone = message.preferredZone; - if (options.oneofs) - object._preferredZone = "preferredZone"; - } - if (message.preferredSecondaryZone != null && message.hasOwnProperty("preferredSecondaryZone")) { - object.preferredSecondaryZone = message.preferredSecondaryZone; - if (options.oneofs) - object._preferredSecondaryZone = "preferredSecondaryZone"; - } - return object; - }; - - /** - * Converts this PointInTimeRestoreContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @instance - * @returns {Object.} JSON object - */ - PointInTimeRestoreContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PointInTimeRestoreContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.PointInTimeRestoreContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PointInTimeRestoreContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.PointInTimeRestoreContext"; - }; - - return PointInTimeRestoreContext; - })(); - - v1beta4.PerformDiskShrinkContext = (function() { - - /** - * Properties of a PerformDiskShrinkContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IPerformDiskShrinkContext - * @property {number|Long|null} [targetSizeGb] PerformDiskShrinkContext targetSizeGb - */ - - /** - * Constructs a new PerformDiskShrinkContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a PerformDiskShrinkContext. - * @implements IPerformDiskShrinkContext - * @constructor - * @param {google.cloud.sql.v1beta4.IPerformDiskShrinkContext=} [properties] Properties to set - */ - function PerformDiskShrinkContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PerformDiskShrinkContext targetSizeGb. - * @member {number|Long} targetSizeGb - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @instance - */ - PerformDiskShrinkContext.prototype.targetSizeGb = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new PerformDiskShrinkContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @static - * @param {google.cloud.sql.v1beta4.IPerformDiskShrinkContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.PerformDiskShrinkContext} PerformDiskShrinkContext instance - */ - PerformDiskShrinkContext.create = function create(properties) { - return new PerformDiskShrinkContext(properties); - }; - - /** - * Encodes the specified PerformDiskShrinkContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PerformDiskShrinkContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @static - * @param {google.cloud.sql.v1beta4.IPerformDiskShrinkContext} message PerformDiskShrinkContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PerformDiskShrinkContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.targetSizeGb != null && Object.hasOwnProperty.call(message, "targetSizeGb")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.targetSizeGb); - return writer; - }; - - /** - * Encodes the specified PerformDiskShrinkContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PerformDiskShrinkContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @static - * @param {google.cloud.sql.v1beta4.IPerformDiskShrinkContext} message PerformDiskShrinkContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PerformDiskShrinkContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PerformDiskShrinkContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.PerformDiskShrinkContext} PerformDiskShrinkContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PerformDiskShrinkContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.targetSizeGb = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PerformDiskShrinkContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.PerformDiskShrinkContext} PerformDiskShrinkContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PerformDiskShrinkContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PerformDiskShrinkContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PerformDiskShrinkContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.targetSizeGb != null && message.hasOwnProperty("targetSizeGb")) - if (!$util.isInteger(message.targetSizeGb) && !(message.targetSizeGb && $util.isInteger(message.targetSizeGb.low) && $util.isInteger(message.targetSizeGb.high))) - return "targetSizeGb: integer|Long expected"; - return null; - }; - - /** - * Creates a PerformDiskShrinkContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.PerformDiskShrinkContext} PerformDiskShrinkContext - */ - PerformDiskShrinkContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.PerformDiskShrinkContext(); - if (object.targetSizeGb != null) - if ($util.Long) - (message.targetSizeGb = $util.Long.fromValue(object.targetSizeGb)).unsigned = false; - else if (typeof object.targetSizeGb === "string") - message.targetSizeGb = parseInt(object.targetSizeGb, 10); - else if (typeof object.targetSizeGb === "number") - message.targetSizeGb = object.targetSizeGb; - else if (typeof object.targetSizeGb === "object") - message.targetSizeGb = new $util.LongBits(object.targetSizeGb.low >>> 0, object.targetSizeGb.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from a PerformDiskShrinkContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @static - * @param {google.cloud.sql.v1beta4.PerformDiskShrinkContext} message PerformDiskShrinkContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PerformDiskShrinkContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.targetSizeGb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.targetSizeGb = options.longs === String ? "0" : 0; - if (message.targetSizeGb != null && message.hasOwnProperty("targetSizeGb")) - if (typeof message.targetSizeGb === "number") - object.targetSizeGb = options.longs === String ? String(message.targetSizeGb) : message.targetSizeGb; - else - object.targetSizeGb = options.longs === String ? $util.Long.prototype.toString.call(message.targetSizeGb) : options.longs === Number ? new $util.LongBits(message.targetSizeGb.low >>> 0, message.targetSizeGb.high >>> 0).toNumber() : message.targetSizeGb; - return object; - }; - - /** - * Converts this PerformDiskShrinkContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @instance - * @returns {Object.} JSON object - */ - PerformDiskShrinkContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PerformDiskShrinkContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.PerformDiskShrinkContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PerformDiskShrinkContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.PerformDiskShrinkContext"; - }; - - return PerformDiskShrinkContext; - })(); - - v1beta4.PreCheckResponse = (function() { - - /** - * Properties of a PreCheckResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IPreCheckResponse - * @property {string|null} [message] PreCheckResponse message - * @property {google.cloud.sql.v1beta4.PreCheckResponse.MessageType|null} [messageType] PreCheckResponse messageType - * @property {Array.|null} [actionsRequired] PreCheckResponse actionsRequired - */ - - /** - * Constructs a new PreCheckResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a PreCheckResponse. - * @implements IPreCheckResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IPreCheckResponse=} [properties] Properties to set - */ - function PreCheckResponse(properties) { - this.actionsRequired = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PreCheckResponse message. - * @member {string|null|undefined} message - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @instance - */ - PreCheckResponse.prototype.message = null; - - /** - * PreCheckResponse messageType. - * @member {google.cloud.sql.v1beta4.PreCheckResponse.MessageType|null|undefined} messageType - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @instance - */ - PreCheckResponse.prototype.messageType = null; - - /** - * PreCheckResponse actionsRequired. - * @member {Array.} actionsRequired - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @instance - */ - PreCheckResponse.prototype.actionsRequired = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PreCheckResponse.prototype, "_message", { - get: $util.oneOfGetter($oneOfFields = ["message"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PreCheckResponse.prototype, "_messageType", { - get: $util.oneOfGetter($oneOfFields = ["messageType"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PreCheckResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @static - * @param {google.cloud.sql.v1beta4.IPreCheckResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.PreCheckResponse} PreCheckResponse instance - */ - PreCheckResponse.create = function create(properties) { - return new PreCheckResponse(properties); - }; - - /** - * Encodes the specified PreCheckResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @static - * @param {google.cloud.sql.v1beta4.IPreCheckResponse} message PreCheckResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PreCheckResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); - if (message.messageType != null && Object.hasOwnProperty.call(message, "messageType")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.messageType); - if (message.actionsRequired != null && message.actionsRequired.length) - for (var i = 0; i < message.actionsRequired.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.actionsRequired[i]); - return writer; - }; - - /** - * Encodes the specified PreCheckResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @static - * @param {google.cloud.sql.v1beta4.IPreCheckResponse} message PreCheckResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PreCheckResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PreCheckResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.PreCheckResponse} PreCheckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PreCheckResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PreCheckResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 2: { - message.message = reader.string(); - break; - } - case 3: { - message.messageType = reader.int32(); - break; - } - case 4: { - if (!(message.actionsRequired && message.actionsRequired.length)) - message.actionsRequired = []; - message.actionsRequired.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PreCheckResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.PreCheckResponse} PreCheckResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PreCheckResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PreCheckResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PreCheckResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.message != null && message.hasOwnProperty("message")) { - properties._message = 1; - if (!$util.isString(message.message)) - return "message: string expected"; - } - if (message.messageType != null && message.hasOwnProperty("messageType")) { - properties._messageType = 1; - switch (message.messageType) { - default: - return "messageType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - } - if (message.actionsRequired != null && message.hasOwnProperty("actionsRequired")) { - if (!Array.isArray(message.actionsRequired)) - return "actionsRequired: array expected"; - for (var i = 0; i < message.actionsRequired.length; ++i) - if (!$util.isString(message.actionsRequired[i])) - return "actionsRequired: string[] expected"; - } - return null; - }; - - /** - * Creates a PreCheckResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.PreCheckResponse} PreCheckResponse - */ - PreCheckResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.PreCheckResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.PreCheckResponse(); - if (object.message != null) - message.message = String(object.message); - switch (object.messageType) { - default: - if (typeof object.messageType === "number") { - message.messageType = object.messageType; - break; - } - break; - case "MESSAGE_TYPE_UNSPECIFIED": - case 0: - message.messageType = 0; - break; - case "INFO": - case 1: - message.messageType = 1; - break; - case "WARNING": - case 2: - message.messageType = 2; - break; - case "ERROR": - case 3: - message.messageType = 3; - break; - } - if (object.actionsRequired) { - if (!Array.isArray(object.actionsRequired)) - throw TypeError(".google.cloud.sql.v1beta4.PreCheckResponse.actionsRequired: array expected"); - message.actionsRequired = []; - for (var i = 0; i < object.actionsRequired.length; ++i) - message.actionsRequired[i] = String(object.actionsRequired[i]); - } - return message; - }; - - /** - * Creates a plain object from a PreCheckResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @static - * @param {google.cloud.sql.v1beta4.PreCheckResponse} message PreCheckResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PreCheckResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.actionsRequired = []; - if (message.message != null && message.hasOwnProperty("message")) { - object.message = message.message; - if (options.oneofs) - object._message = "message"; - } - if (message.messageType != null && message.hasOwnProperty("messageType")) { - object.messageType = options.enums === String ? $root.google.cloud.sql.v1beta4.PreCheckResponse.MessageType[message.messageType] === undefined ? message.messageType : $root.google.cloud.sql.v1beta4.PreCheckResponse.MessageType[message.messageType] : message.messageType; - if (options.oneofs) - object._messageType = "messageType"; - } - if (message.actionsRequired && message.actionsRequired.length) { - object.actionsRequired = []; - for (var j = 0; j < message.actionsRequired.length; ++j) - object.actionsRequired[j] = message.actionsRequired[j]; - } - return object; - }; - - /** - * Converts this PreCheckResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @instance - * @returns {Object.} JSON object - */ - PreCheckResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PreCheckResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.PreCheckResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PreCheckResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.PreCheckResponse"; - }; - - /** - * MessageType enum. - * @name google.cloud.sql.v1beta4.PreCheckResponse.MessageType - * @enum {number} - * @property {number} MESSAGE_TYPE_UNSPECIFIED=0 MESSAGE_TYPE_UNSPECIFIED value - * @property {number} INFO=1 INFO value - * @property {number} WARNING=2 WARNING value - * @property {number} ERROR=3 ERROR value - */ - PreCheckResponse.MessageType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MESSAGE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "INFO"] = 1; - values[valuesById[2] = "WARNING"] = 2; - values[valuesById[3] = "ERROR"] = 3; - return values; - })(); - - return PreCheckResponse; - })(); - - v1beta4.PreCheckMajorVersionUpgradeContext = (function() { - - /** - * Properties of a PreCheckMajorVersionUpgradeContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IPreCheckMajorVersionUpgradeContext - * @property {google.cloud.sql.v1beta4.SqlDatabaseVersion|null} [targetDatabaseVersion] PreCheckMajorVersionUpgradeContext targetDatabaseVersion - * @property {Array.|null} [preCheckResponse] PreCheckMajorVersionUpgradeContext preCheckResponse - * @property {string|null} [kind] PreCheckMajorVersionUpgradeContext kind - */ - - /** - * Constructs a new PreCheckMajorVersionUpgradeContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a PreCheckMajorVersionUpgradeContext. - * @implements IPreCheckMajorVersionUpgradeContext - * @constructor - * @param {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext=} [properties] Properties to set - */ - function PreCheckMajorVersionUpgradeContext(properties) { - this.preCheckResponse = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PreCheckMajorVersionUpgradeContext targetDatabaseVersion. - * @member {google.cloud.sql.v1beta4.SqlDatabaseVersion} targetDatabaseVersion - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @instance - */ - PreCheckMajorVersionUpgradeContext.prototype.targetDatabaseVersion = 0; - - /** - * PreCheckMajorVersionUpgradeContext preCheckResponse. - * @member {Array.} preCheckResponse - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @instance - */ - PreCheckMajorVersionUpgradeContext.prototype.preCheckResponse = $util.emptyArray; - - /** - * PreCheckMajorVersionUpgradeContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @instance - */ - PreCheckMajorVersionUpgradeContext.prototype.kind = ""; - - /** - * Creates a new PreCheckMajorVersionUpgradeContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @static - * @param {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext instance - */ - PreCheckMajorVersionUpgradeContext.create = function create(properties) { - return new PreCheckMajorVersionUpgradeContext(properties); - }; - - /** - * Encodes the specified PreCheckMajorVersionUpgradeContext message. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @static - * @param {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PreCheckMajorVersionUpgradeContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.targetDatabaseVersion != null && Object.hasOwnProperty.call(message, "targetDatabaseVersion")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.targetDatabaseVersion); - if (message.preCheckResponse != null && message.preCheckResponse.length) - for (var i = 0; i < message.preCheckResponse.length; ++i) - $root.google.cloud.sql.v1beta4.PreCheckResponse.encode(message.preCheckResponse[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - return writer; - }; - - /** - * Encodes the specified PreCheckMajorVersionUpgradeContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @static - * @param {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PreCheckMajorVersionUpgradeContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PreCheckMajorVersionUpgradeContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.targetDatabaseVersion = reader.int32(); - break; - } - case 2: { - if (!(message.preCheckResponse && message.preCheckResponse.length)) - message.preCheckResponse = []; - message.preCheckResponse.push($root.google.cloud.sql.v1beta4.PreCheckResponse.decode(reader, reader.uint32())); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PreCheckMajorVersionUpgradeContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PreCheckMajorVersionUpgradeContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PreCheckMajorVersionUpgradeContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PreCheckMajorVersionUpgradeContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.targetDatabaseVersion != null && message.hasOwnProperty("targetDatabaseVersion")) - switch (message.targetDatabaseVersion) { - default: - return "targetDatabaseVersion: enum value expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - break; - } - if (message.preCheckResponse != null && message.hasOwnProperty("preCheckResponse")) { - if (!Array.isArray(message.preCheckResponse)) - return "preCheckResponse: array expected"; - for (var i = 0; i < message.preCheckResponse.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.PreCheckResponse.verify(message.preCheckResponse[i]); - if (error) - return "preCheckResponse." + error; - } - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a PreCheckMajorVersionUpgradeContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext} PreCheckMajorVersionUpgradeContext - */ - PreCheckMajorVersionUpgradeContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext(); - switch (object.targetDatabaseVersion) { - default: - if (typeof object.targetDatabaseVersion === "number") { - message.targetDatabaseVersion = object.targetDatabaseVersion; - break; - } - break; - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.targetDatabaseVersion = 0; - break; - case "MYSQL_5_1": - case 2: - message.targetDatabaseVersion = 2; - break; - case "MYSQL_5_5": - case 3: - message.targetDatabaseVersion = 3; - break; - case "MYSQL_5_6": - case 5: - message.targetDatabaseVersion = 5; - break; - case "MYSQL_5_7": - case 6: - message.targetDatabaseVersion = 6; - break; - case "MYSQL_8_0": - case 20: - message.targetDatabaseVersion = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.targetDatabaseVersion = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.targetDatabaseVersion = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.targetDatabaseVersion = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.targetDatabaseVersion = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.targetDatabaseVersion = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.targetDatabaseVersion = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.targetDatabaseVersion = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.targetDatabaseVersion = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.targetDatabaseVersion = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.targetDatabaseVersion = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.targetDatabaseVersion = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.targetDatabaseVersion = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.targetDatabaseVersion = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.targetDatabaseVersion = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.targetDatabaseVersion = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.targetDatabaseVersion = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.targetDatabaseVersion = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.targetDatabaseVersion = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.targetDatabaseVersion = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.targetDatabaseVersion = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.targetDatabaseVersion = 556; - break; - case "MYSQL_8_4": - case 398: - message.targetDatabaseVersion = 398; - break; - case "MYSQL_9_7": - case 654: - message.targetDatabaseVersion = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.targetDatabaseVersion = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.targetDatabaseVersion = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.targetDatabaseVersion = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.targetDatabaseVersion = 16; - break; - case "POSTGRES_9_6": - case 9: - message.targetDatabaseVersion = 9; - break; - case "POSTGRES_10": - case 18: - message.targetDatabaseVersion = 18; - break; - case "POSTGRES_11": - case 10: - message.targetDatabaseVersion = 10; - break; - case "POSTGRES_12": - case 19: - message.targetDatabaseVersion = 19; - break; - case "POSTGRES_13": - case 23: - message.targetDatabaseVersion = 23; - break; - case "POSTGRES_14": - case 110: - message.targetDatabaseVersion = 110; - break; - case "POSTGRES_15": - case 172: - message.targetDatabaseVersion = 172; - break; - case "POSTGRES_16": - case 272: - message.targetDatabaseVersion = 272; - break; - case "POSTGRES_17": - case 408: - message.targetDatabaseVersion = 408; - break; - case "POSTGRES_18": - case 557: - message.targetDatabaseVersion = 557; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.targetDatabaseVersion = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.targetDatabaseVersion = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.targetDatabaseVersion = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.targetDatabaseVersion = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.targetDatabaseVersion = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.targetDatabaseVersion = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.targetDatabaseVersion = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.targetDatabaseVersion = 202; - break; - } - if (object.preCheckResponse) { - if (!Array.isArray(object.preCheckResponse)) - throw TypeError(".google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.preCheckResponse: array expected"); - message.preCheckResponse = []; - for (var i = 0; i < object.preCheckResponse.length; ++i) { - if (typeof object.preCheckResponse[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.preCheckResponse: object expected"); - message.preCheckResponse[i] = $root.google.cloud.sql.v1beta4.PreCheckResponse.fromObject(object.preCheckResponse[i]); - } - } - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a PreCheckMajorVersionUpgradeContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @static - * @param {google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext} message PreCheckMajorVersionUpgradeContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PreCheckMajorVersionUpgradeContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.preCheckResponse = []; - if (options.defaults) { - object.targetDatabaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; - object.kind = ""; - } - if (message.targetDatabaseVersion != null && message.hasOwnProperty("targetDatabaseVersion")) - object.targetDatabaseVersion = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.targetDatabaseVersion] === undefined ? message.targetDatabaseVersion : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.targetDatabaseVersion] : message.targetDatabaseVersion; - if (message.preCheckResponse && message.preCheckResponse.length) { - object.preCheckResponse = []; - for (var j = 0; j < message.preCheckResponse.length; ++j) - object.preCheckResponse[j] = $root.google.cloud.sql.v1beta4.PreCheckResponse.toObject(message.preCheckResponse[j], options); - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this PreCheckMajorVersionUpgradeContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @instance - * @returns {Object.} JSON object - */ - PreCheckMajorVersionUpgradeContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PreCheckMajorVersionUpgradeContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PreCheckMajorVersionUpgradeContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext"; - }; - - return PreCheckMajorVersionUpgradeContext; - })(); - - v1beta4.SqlInstancesGetDiskShrinkConfigResponse = (function() { - - /** - * Properties of a SqlInstancesGetDiskShrinkConfigResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesGetDiskShrinkConfigResponse - * @property {string|null} [kind] SqlInstancesGetDiskShrinkConfigResponse kind - * @property {number|Long|null} [minimalTargetSizeGb] SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb - * @property {string|null} [message] SqlInstancesGetDiskShrinkConfigResponse message - */ - - /** - * Constructs a new SqlInstancesGetDiskShrinkConfigResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesGetDiskShrinkConfigResponse. - * @implements ISqlInstancesGetDiskShrinkConfigResponse - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse=} [properties] Properties to set - */ - function SqlInstancesGetDiskShrinkConfigResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesGetDiskShrinkConfigResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @instance - */ - SqlInstancesGetDiskShrinkConfigResponse.prototype.kind = ""; - - /** - * SqlInstancesGetDiskShrinkConfigResponse minimalTargetSizeGb. - * @member {number|Long} minimalTargetSizeGb - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @instance - */ - SqlInstancesGetDiskShrinkConfigResponse.prototype.minimalTargetSizeGb = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * SqlInstancesGetDiskShrinkConfigResponse message. - * @member {string} message - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @instance - */ - SqlInstancesGetDiskShrinkConfigResponse.prototype.message = ""; - - /** - * Creates a new SqlInstancesGetDiskShrinkConfigResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse instance - */ - SqlInstancesGetDiskShrinkConfigResponse.create = function create(properties) { - return new SqlInstancesGetDiskShrinkConfigResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetDiskShrinkConfigResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.minimalTargetSizeGb != null && Object.hasOwnProperty.call(message, "minimalTargetSizeGb")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.minimalTargetSizeGb); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); - return writer; - }; - - /** - * Encodes the specified SqlInstancesGetDiskShrinkConfigResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesGetDiskShrinkConfigResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetDiskShrinkConfigResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.minimalTargetSizeGb = reader.int64(); - break; - } - case 3: { - message.message = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesGetDiskShrinkConfigResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesGetDiskShrinkConfigResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesGetDiskShrinkConfigResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesGetDiskShrinkConfigResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.minimalTargetSizeGb != null && message.hasOwnProperty("minimalTargetSizeGb")) - if (!$util.isInteger(message.minimalTargetSizeGb) && !(message.minimalTargetSizeGb && $util.isInteger(message.minimalTargetSizeGb.low) && $util.isInteger(message.minimalTargetSizeGb.high))) - return "minimalTargetSizeGb: integer|Long expected"; - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - return null; - }; - - /** - * Creates a SqlInstancesGetDiskShrinkConfigResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} SqlInstancesGetDiskShrinkConfigResponse - */ - SqlInstancesGetDiskShrinkConfigResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.minimalTargetSizeGb != null) - if ($util.Long) - (message.minimalTargetSizeGb = $util.Long.fromValue(object.minimalTargetSizeGb)).unsigned = false; - else if (typeof object.minimalTargetSizeGb === "string") - message.minimalTargetSizeGb = parseInt(object.minimalTargetSizeGb, 10); - else if (typeof object.minimalTargetSizeGb === "number") - message.minimalTargetSizeGb = object.minimalTargetSizeGb; - else if (typeof object.minimalTargetSizeGb === "object") - message.minimalTargetSizeGb = new $util.LongBits(object.minimalTargetSizeGb.low >>> 0, object.minimalTargetSizeGb.high >>> 0).toNumber(); - if (object.message != null) - message.message = String(object.message); - return message; - }; - - /** - * Creates a plain object from a SqlInstancesGetDiskShrinkConfigResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse} message SqlInstancesGetDiskShrinkConfigResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesGetDiskShrinkConfigResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.minimalTargetSizeGb = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.minimalTargetSizeGb = options.longs === String ? "0" : 0; - object.message = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.minimalTargetSizeGb != null && message.hasOwnProperty("minimalTargetSizeGb")) - if (typeof message.minimalTargetSizeGb === "number") - object.minimalTargetSizeGb = options.longs === String ? String(message.minimalTargetSizeGb) : message.minimalTargetSizeGb; - else - object.minimalTargetSizeGb = options.longs === String ? $util.Long.prototype.toString.call(message.minimalTargetSizeGb) : options.longs === Number ? new $util.LongBits(message.minimalTargetSizeGb.low >>> 0, message.minimalTargetSizeGb.high >>> 0).toNumber() : message.minimalTargetSizeGb; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - return object; - }; - - /** - * Converts this SqlInstancesGetDiskShrinkConfigResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesGetDiskShrinkConfigResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesGetDiskShrinkConfigResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesGetDiskShrinkConfigResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse"; - }; - - return SqlInstancesGetDiskShrinkConfigResponse; - })(); - - v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse = (function() { - - /** - * Properties of a SqlInstancesVerifyExternalSyncSettingsResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesVerifyExternalSyncSettingsResponse - * @property {string|null} [kind] SqlInstancesVerifyExternalSyncSettingsResponse kind - * @property {Array.|null} [errors] SqlInstancesVerifyExternalSyncSettingsResponse errors - * @property {Array.|null} [warnings] SqlInstancesVerifyExternalSyncSettingsResponse warnings - */ - - /** - * Constructs a new SqlInstancesVerifyExternalSyncSettingsResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesVerifyExternalSyncSettingsResponse. - * @implements ISqlInstancesVerifyExternalSyncSettingsResponse - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse=} [properties] Properties to set - */ - function SqlInstancesVerifyExternalSyncSettingsResponse(properties) { - this.errors = []; - this.warnings = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesVerifyExternalSyncSettingsResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsResponse.prototype.kind = ""; - - /** - * SqlInstancesVerifyExternalSyncSettingsResponse errors. - * @member {Array.} errors - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsResponse.prototype.errors = $util.emptyArray; - - /** - * SqlInstancesVerifyExternalSyncSettingsResponse warnings. - * @member {Array.} warnings - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @instance - */ - SqlInstancesVerifyExternalSyncSettingsResponse.prototype.warnings = $util.emptyArray; - - /** - * Creates a new SqlInstancesVerifyExternalSyncSettingsResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse instance - */ - SqlInstancesVerifyExternalSyncSettingsResponse.create = function create(properties) { - return new SqlInstancesVerifyExternalSyncSettingsResponse(properties); - }; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesVerifyExternalSyncSettingsResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.errors != null && message.errors.length) - for (var i = 0; i < message.errors.length; ++i) - $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.encode(message.errors[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.warnings != null && message.warnings.length) - for (var i = 0; i < message.warnings.length; ++i) - $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.encode(message.warnings[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesVerifyExternalSyncSettingsResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesVerifyExternalSyncSettingsResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesVerifyExternalSyncSettingsResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.errors && message.errors.length)) - message.errors = []; - message.errors.push($root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.warnings && message.warnings.length)) - message.warnings = []; - message.warnings.push($root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesVerifyExternalSyncSettingsResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesVerifyExternalSyncSettingsResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesVerifyExternalSyncSettingsResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesVerifyExternalSyncSettingsResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.errors != null && message.hasOwnProperty("errors")) { - if (!Array.isArray(message.errors)) - return "errors: array expected"; - for (var i = 0; i < message.errors.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify(message.errors[i]); - if (error) - return "errors." + error; - } - } - if (message.warnings != null && message.hasOwnProperty("warnings")) { - if (!Array.isArray(message.warnings)) - return "warnings: array expected"; - for (var i = 0; i < message.warnings.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify(message.warnings[i]); - if (error) - return "warnings." + error; - } - } - return null; - }; - - /** - * Creates a SqlInstancesVerifyExternalSyncSettingsResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} SqlInstancesVerifyExternalSyncSettingsResponse - */ - SqlInstancesVerifyExternalSyncSettingsResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.errors) { - if (!Array.isArray(object.errors)) - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.errors: array expected"); - message.errors = []; - for (var i = 0; i < object.errors.length; ++i) { - if (typeof object.errors[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.errors: object expected"); - message.errors[i] = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.fromObject(object.errors[i]); - } - } - if (object.warnings) { - if (!Array.isArray(object.warnings)) - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.warnings: array expected"); - message.warnings = []; - for (var i = 0; i < object.warnings.length; ++i) { - if (typeof object.warnings[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse.warnings: object expected"); - message.warnings[i] = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.fromObject(object.warnings[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesVerifyExternalSyncSettingsResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse} message SqlInstancesVerifyExternalSyncSettingsResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesVerifyExternalSyncSettingsResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.errors = []; - object.warnings = []; - } - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.errors && message.errors.length) { - object.errors = []; - for (var j = 0; j < message.errors.length; ++j) - object.errors[j] = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.toObject(message.errors[j], options); - } - if (message.warnings && message.warnings.length) { - object.warnings = []; - for (var j = 0; j < message.warnings.length; ++j) - object.warnings[j] = $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.toObject(message.warnings[j], options); - } - return object; - }; - - /** - * Converts this SqlInstancesVerifyExternalSyncSettingsResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesVerifyExternalSyncSettingsResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesVerifyExternalSyncSettingsResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesVerifyExternalSyncSettingsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse"; - }; - - return SqlInstancesVerifyExternalSyncSettingsResponse; - })(); - - v1beta4.SqlExternalSyncSettingError = (function() { - - /** - * Properties of a SqlExternalSyncSettingError. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlExternalSyncSettingError - * @property {string|null} [kind] SqlExternalSyncSettingError kind - * @property {google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType|null} [type] SqlExternalSyncSettingError type - * @property {string|null} [detail] SqlExternalSyncSettingError detail - */ - - /** - * Constructs a new SqlExternalSyncSettingError. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlExternalSyncSettingError. - * @implements ISqlExternalSyncSettingError - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlExternalSyncSettingError=} [properties] Properties to set - */ - function SqlExternalSyncSettingError(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlExternalSyncSettingError kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @instance - */ - SqlExternalSyncSettingError.prototype.kind = ""; - - /** - * SqlExternalSyncSettingError type. - * @member {google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType} type - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @instance - */ - SqlExternalSyncSettingError.prototype.type = 0; - - /** - * SqlExternalSyncSettingError detail. - * @member {string} detail - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @instance - */ - SqlExternalSyncSettingError.prototype.detail = ""; - - /** - * Creates a new SqlExternalSyncSettingError instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @static - * @param {google.cloud.sql.v1beta4.ISqlExternalSyncSettingError=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlExternalSyncSettingError} SqlExternalSyncSettingError instance - */ - SqlExternalSyncSettingError.create = function create(properties) { - return new SqlExternalSyncSettingError(properties); - }; - - /** - * Encodes the specified SqlExternalSyncSettingError message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @static - * @param {google.cloud.sql.v1beta4.ISqlExternalSyncSettingError} message SqlExternalSyncSettingError message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlExternalSyncSettingError.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); - if (message.detail != null && Object.hasOwnProperty.call(message, "detail")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.detail); - return writer; - }; - - /** - * Encodes the specified SqlExternalSyncSettingError message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlExternalSyncSettingError.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @static - * @param {google.cloud.sql.v1beta4.ISqlExternalSyncSettingError} message SqlExternalSyncSettingError message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlExternalSyncSettingError.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlExternalSyncSettingError} SqlExternalSyncSettingError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlExternalSyncSettingError.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.type = reader.int32(); - break; - } - case 3: { - message.detail = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlExternalSyncSettingError message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlExternalSyncSettingError} SqlExternalSyncSettingError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlExternalSyncSettingError.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlExternalSyncSettingError message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlExternalSyncSettingError.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 41: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - case 58: - break; - } - if (message.detail != null && message.hasOwnProperty("detail")) - if (!$util.isString(message.detail)) - return "detail: string expected"; - return null; - }; - - /** - * Creates a SqlExternalSyncSettingError message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlExternalSyncSettingError} SqlExternalSyncSettingError - */ - SqlExternalSyncSettingError.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError(); - if (object.kind != null) - message.kind = String(object.kind); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "CONNECTION_FAILURE": - case 1: - message.type = 1; - break; - case "BINLOG_NOT_ENABLED": - case 2: - message.type = 2; - break; - case "INCOMPATIBLE_DATABASE_VERSION": - case 3: - message.type = 3; - break; - case "REPLICA_ALREADY_SETUP": - case 4: - message.type = 4; - break; - case "INSUFFICIENT_PRIVILEGE": - case 5: - message.type = 5; - break; - case "UNSUPPORTED_MIGRATION_TYPE": - case 6: - message.type = 6; - break; - case "NO_PGLOGICAL_INSTALLED": - case 7: - message.type = 7; - break; - case "PGLOGICAL_NODE_ALREADY_EXISTS": - case 8: - message.type = 8; - break; - case "INVALID_WAL_LEVEL": - case 9: - message.type = 9; - break; - case "INVALID_SHARED_PRELOAD_LIBRARY": - case 10: - message.type = 10; - break; - case "INSUFFICIENT_MAX_REPLICATION_SLOTS": - case 11: - message.type = 11; - break; - case "INSUFFICIENT_MAX_WAL_SENDERS": - case 12: - message.type = 12; - break; - case "INSUFFICIENT_MAX_WORKER_PROCESSES": - case 13: - message.type = 13; - break; - case "UNSUPPORTED_EXTENSIONS": - case 14: - message.type = 14; - break; - case "INVALID_RDS_LOGICAL_REPLICATION": - case 15: - message.type = 15; - break; - case "INVALID_LOGGING_SETUP": - case 16: - message.type = 16; - break; - case "INVALID_DB_PARAM": - case 17: - message.type = 17; - break; - case "UNSUPPORTED_GTID_MODE": - case 18: - message.type = 18; - break; - case "SQLSERVER_AGENT_NOT_RUNNING": - case 19: - message.type = 19; - break; - case "UNSUPPORTED_TABLE_DEFINITION": - case 20: - message.type = 20; - break; - case "UNSUPPORTED_DEFINER": - case 21: - message.type = 21; - break; - case "SQLSERVER_SERVERNAME_MISMATCH": - case 22: - message.type = 22; - break; - case "PRIMARY_ALREADY_SETUP": - case 23: - message.type = 23; - break; - case "UNSUPPORTED_BINLOG_FORMAT": - case 24: - message.type = 24; - break; - case "BINLOG_RETENTION_SETTING": - case 25: - message.type = 25; - break; - case "UNSUPPORTED_STORAGE_ENGINE": - case 26: - message.type = 26; - break; - case "LIMITED_SUPPORT_TABLES": - case 27: - message.type = 27; - break; - case "EXISTING_DATA_IN_REPLICA": - case 28: - message.type = 28; - break; - case "MISSING_OPTIONAL_PRIVILEGES": - case 29: - message.type = 29; - break; - case "RISKY_BACKUP_ADMIN_PRIVILEGE": - case 30: - message.type = 30; - break; - case "INSUFFICIENT_GCS_PERMISSIONS": - case 31: - message.type = 31; - break; - case "INVALID_FILE_INFO": - case 32: - message.type = 32; - break; - case "UNSUPPORTED_DATABASE_SETTINGS": - case 33: - message.type = 33; - break; - case "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE": - case 34: - message.type = 34; - break; - case "LOCAL_INFILE_OFF": - case 35: - message.type = 35; - break; - case "TURN_ON_PITR_AFTER_PROMOTE": - case 36: - message.type = 36; - break; - case "INCOMPATIBLE_DATABASE_MINOR_VERSION": - case 37: - message.type = 37; - break; - case "SOURCE_MAX_SUBSCRIPTIONS": - case 38: - message.type = 38; - break; - case "UNABLE_TO_VERIFY_DEFINERS": - case 39: - message.type = 39; - break; - case "SUBSCRIPTION_CALCULATION_STATUS": - case 40: - message.type = 40; - break; - case "PG_SUBSCRIPTION_COUNT": - case 41: - message.type = 41; - break; - case "PG_SYNC_PARALLEL_LEVEL": - case 42: - message.type = 42; - break; - case "INSUFFICIENT_DISK_SIZE": - case 43: - message.type = 43; - break; - case "INSUFFICIENT_MACHINE_TIER": - case 44: - message.type = 44; - break; - case "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED": - case 45: - message.type = 45; - break; - case "EXTENSIONS_NOT_MIGRATED": - case 46: - message.type = 46; - break; - case "PG_CRON_FLAG_ENABLED_IN_REPLICA": - case 47: - message.type = 47; - break; - case "EXTENSIONS_NOT_ENABLED_IN_REPLICA": - case 48: - message.type = 48; - break; - case "UNSUPPORTED_COLUMNS": - case 49: - message.type = 49; - break; - case "USERS_NOT_CREATED_IN_REPLICA": - case 50: - message.type = 50; - break; - case "UNSUPPORTED_SYSTEM_OBJECTS": - case 51: - message.type = 51; - break; - case "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY": - case 52: - message.type = 52; - break; - case "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE": - case 53: - message.type = 53; - break; - case "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI": - case 54: - message.type = 54; - break; - case "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS": - case 55: - message.type = 55; - break; - case "PROMPT_DELETE_EXISTING": - case 56: - message.type = 56; - break; - case "WILL_DELETE_EXISTING": - case 57: - message.type = 57; - break; - case "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE": - case 58: - message.type = 58; - break; - } - if (object.detail != null) - message.detail = String(object.detail); - return message; - }; - - /** - * Creates a plain object from a SqlExternalSyncSettingError message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @static - * @param {google.cloud.sql.v1beta4.SqlExternalSyncSettingError} message SqlExternalSyncSettingError - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlExternalSyncSettingError.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.type = options.enums === String ? "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED" : 0; - object.detail = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType[message.type] : message.type; - if (message.detail != null && message.hasOwnProperty("detail")) - object.detail = message.detail; - return object; - }; - - /** - * Converts this SqlExternalSyncSettingError to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @instance - * @returns {Object.} JSON object - */ - SqlExternalSyncSettingError.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlExternalSyncSettingError - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlExternalSyncSettingError - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlExternalSyncSettingError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlExternalSyncSettingError"; - }; - - /** - * SqlExternalSyncSettingErrorType enum. - * @name google.cloud.sql.v1beta4.SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType - * @enum {number} - * @property {number} SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED=0 SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED value - * @property {number} CONNECTION_FAILURE=1 CONNECTION_FAILURE value - * @property {number} BINLOG_NOT_ENABLED=2 BINLOG_NOT_ENABLED value - * @property {number} INCOMPATIBLE_DATABASE_VERSION=3 INCOMPATIBLE_DATABASE_VERSION value - * @property {number} REPLICA_ALREADY_SETUP=4 REPLICA_ALREADY_SETUP value - * @property {number} INSUFFICIENT_PRIVILEGE=5 INSUFFICIENT_PRIVILEGE value - * @property {number} UNSUPPORTED_MIGRATION_TYPE=6 UNSUPPORTED_MIGRATION_TYPE value - * @property {number} NO_PGLOGICAL_INSTALLED=7 NO_PGLOGICAL_INSTALLED value - * @property {number} PGLOGICAL_NODE_ALREADY_EXISTS=8 PGLOGICAL_NODE_ALREADY_EXISTS value - * @property {number} INVALID_WAL_LEVEL=9 INVALID_WAL_LEVEL value - * @property {number} INVALID_SHARED_PRELOAD_LIBRARY=10 INVALID_SHARED_PRELOAD_LIBRARY value - * @property {number} INSUFFICIENT_MAX_REPLICATION_SLOTS=11 INSUFFICIENT_MAX_REPLICATION_SLOTS value - * @property {number} INSUFFICIENT_MAX_WAL_SENDERS=12 INSUFFICIENT_MAX_WAL_SENDERS value - * @property {number} INSUFFICIENT_MAX_WORKER_PROCESSES=13 INSUFFICIENT_MAX_WORKER_PROCESSES value - * @property {number} UNSUPPORTED_EXTENSIONS=14 UNSUPPORTED_EXTENSIONS value - * @property {number} INVALID_RDS_LOGICAL_REPLICATION=15 INVALID_RDS_LOGICAL_REPLICATION value - * @property {number} INVALID_LOGGING_SETUP=16 INVALID_LOGGING_SETUP value - * @property {number} INVALID_DB_PARAM=17 INVALID_DB_PARAM value - * @property {number} UNSUPPORTED_GTID_MODE=18 UNSUPPORTED_GTID_MODE value - * @property {number} SQLSERVER_AGENT_NOT_RUNNING=19 SQLSERVER_AGENT_NOT_RUNNING value - * @property {number} UNSUPPORTED_TABLE_DEFINITION=20 UNSUPPORTED_TABLE_DEFINITION value - * @property {number} UNSUPPORTED_DEFINER=21 UNSUPPORTED_DEFINER value - * @property {number} SQLSERVER_SERVERNAME_MISMATCH=22 SQLSERVER_SERVERNAME_MISMATCH value - * @property {number} PRIMARY_ALREADY_SETUP=23 PRIMARY_ALREADY_SETUP value - * @property {number} UNSUPPORTED_BINLOG_FORMAT=24 UNSUPPORTED_BINLOG_FORMAT value - * @property {number} BINLOG_RETENTION_SETTING=25 BINLOG_RETENTION_SETTING value - * @property {number} UNSUPPORTED_STORAGE_ENGINE=26 UNSUPPORTED_STORAGE_ENGINE value - * @property {number} LIMITED_SUPPORT_TABLES=27 LIMITED_SUPPORT_TABLES value - * @property {number} EXISTING_DATA_IN_REPLICA=28 EXISTING_DATA_IN_REPLICA value - * @property {number} MISSING_OPTIONAL_PRIVILEGES=29 MISSING_OPTIONAL_PRIVILEGES value - * @property {number} RISKY_BACKUP_ADMIN_PRIVILEGE=30 RISKY_BACKUP_ADMIN_PRIVILEGE value - * @property {number} INSUFFICIENT_GCS_PERMISSIONS=31 INSUFFICIENT_GCS_PERMISSIONS value - * @property {number} INVALID_FILE_INFO=32 INVALID_FILE_INFO value - * @property {number} UNSUPPORTED_DATABASE_SETTINGS=33 UNSUPPORTED_DATABASE_SETTINGS value - * @property {number} MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE=34 MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE value - * @property {number} LOCAL_INFILE_OFF=35 LOCAL_INFILE_OFF value - * @property {number} TURN_ON_PITR_AFTER_PROMOTE=36 TURN_ON_PITR_AFTER_PROMOTE value - * @property {number} INCOMPATIBLE_DATABASE_MINOR_VERSION=37 INCOMPATIBLE_DATABASE_MINOR_VERSION value - * @property {number} SOURCE_MAX_SUBSCRIPTIONS=38 SOURCE_MAX_SUBSCRIPTIONS value - * @property {number} UNABLE_TO_VERIFY_DEFINERS=39 UNABLE_TO_VERIFY_DEFINERS value - * @property {number} SUBSCRIPTION_CALCULATION_STATUS=40 SUBSCRIPTION_CALCULATION_STATUS value - * @property {number} PG_SUBSCRIPTION_COUNT=41 PG_SUBSCRIPTION_COUNT value - * @property {number} PG_SYNC_PARALLEL_LEVEL=42 PG_SYNC_PARALLEL_LEVEL value - * @property {number} INSUFFICIENT_DISK_SIZE=43 INSUFFICIENT_DISK_SIZE value - * @property {number} INSUFFICIENT_MACHINE_TIER=44 INSUFFICIENT_MACHINE_TIER value - * @property {number} UNSUPPORTED_EXTENSIONS_NOT_MIGRATED=45 UNSUPPORTED_EXTENSIONS_NOT_MIGRATED value - * @property {number} EXTENSIONS_NOT_MIGRATED=46 EXTENSIONS_NOT_MIGRATED value - * @property {number} PG_CRON_FLAG_ENABLED_IN_REPLICA=47 PG_CRON_FLAG_ENABLED_IN_REPLICA value - * @property {number} EXTENSIONS_NOT_ENABLED_IN_REPLICA=48 EXTENSIONS_NOT_ENABLED_IN_REPLICA value - * @property {number} UNSUPPORTED_COLUMNS=49 UNSUPPORTED_COLUMNS value - * @property {number} USERS_NOT_CREATED_IN_REPLICA=50 USERS_NOT_CREATED_IN_REPLICA value - * @property {number} UNSUPPORTED_SYSTEM_OBJECTS=51 UNSUPPORTED_SYSTEM_OBJECTS value - * @property {number} UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY=52 UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY value - * @property {number} SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE=53 SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE value - * @property {number} PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI=54 PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI value - * @property {number} SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS=55 SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS value - * @property {number} PROMPT_DELETE_EXISTING=56 PROMPT_DELETE_EXISTING value - * @property {number} WILL_DELETE_EXISTING=57 WILL_DELETE_EXISTING value - * @property {number} PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE=58 PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE value - */ - SqlExternalSyncSettingError.SqlExternalSyncSettingErrorType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "CONNECTION_FAILURE"] = 1; - values[valuesById[2] = "BINLOG_NOT_ENABLED"] = 2; - values[valuesById[3] = "INCOMPATIBLE_DATABASE_VERSION"] = 3; - values[valuesById[4] = "REPLICA_ALREADY_SETUP"] = 4; - values[valuesById[5] = "INSUFFICIENT_PRIVILEGE"] = 5; - values[valuesById[6] = "UNSUPPORTED_MIGRATION_TYPE"] = 6; - values[valuesById[7] = "NO_PGLOGICAL_INSTALLED"] = 7; - values[valuesById[8] = "PGLOGICAL_NODE_ALREADY_EXISTS"] = 8; - values[valuesById[9] = "INVALID_WAL_LEVEL"] = 9; - values[valuesById[10] = "INVALID_SHARED_PRELOAD_LIBRARY"] = 10; - values[valuesById[11] = "INSUFFICIENT_MAX_REPLICATION_SLOTS"] = 11; - values[valuesById[12] = "INSUFFICIENT_MAX_WAL_SENDERS"] = 12; - values[valuesById[13] = "INSUFFICIENT_MAX_WORKER_PROCESSES"] = 13; - values[valuesById[14] = "UNSUPPORTED_EXTENSIONS"] = 14; - values[valuesById[15] = "INVALID_RDS_LOGICAL_REPLICATION"] = 15; - values[valuesById[16] = "INVALID_LOGGING_SETUP"] = 16; - values[valuesById[17] = "INVALID_DB_PARAM"] = 17; - values[valuesById[18] = "UNSUPPORTED_GTID_MODE"] = 18; - values[valuesById[19] = "SQLSERVER_AGENT_NOT_RUNNING"] = 19; - values[valuesById[20] = "UNSUPPORTED_TABLE_DEFINITION"] = 20; - values[valuesById[21] = "UNSUPPORTED_DEFINER"] = 21; - values[valuesById[22] = "SQLSERVER_SERVERNAME_MISMATCH"] = 22; - values[valuesById[23] = "PRIMARY_ALREADY_SETUP"] = 23; - values[valuesById[24] = "UNSUPPORTED_BINLOG_FORMAT"] = 24; - values[valuesById[25] = "BINLOG_RETENTION_SETTING"] = 25; - values[valuesById[26] = "UNSUPPORTED_STORAGE_ENGINE"] = 26; - values[valuesById[27] = "LIMITED_SUPPORT_TABLES"] = 27; - values[valuesById[28] = "EXISTING_DATA_IN_REPLICA"] = 28; - values[valuesById[29] = "MISSING_OPTIONAL_PRIVILEGES"] = 29; - values[valuesById[30] = "RISKY_BACKUP_ADMIN_PRIVILEGE"] = 30; - values[valuesById[31] = "INSUFFICIENT_GCS_PERMISSIONS"] = 31; - values[valuesById[32] = "INVALID_FILE_INFO"] = 32; - values[valuesById[33] = "UNSUPPORTED_DATABASE_SETTINGS"] = 33; - values[valuesById[34] = "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE"] = 34; - values[valuesById[35] = "LOCAL_INFILE_OFF"] = 35; - values[valuesById[36] = "TURN_ON_PITR_AFTER_PROMOTE"] = 36; - values[valuesById[37] = "INCOMPATIBLE_DATABASE_MINOR_VERSION"] = 37; - values[valuesById[38] = "SOURCE_MAX_SUBSCRIPTIONS"] = 38; - values[valuesById[39] = "UNABLE_TO_VERIFY_DEFINERS"] = 39; - values[valuesById[40] = "SUBSCRIPTION_CALCULATION_STATUS"] = 40; - values[valuesById[41] = "PG_SUBSCRIPTION_COUNT"] = 41; - values[valuesById[42] = "PG_SYNC_PARALLEL_LEVEL"] = 42; - values[valuesById[43] = "INSUFFICIENT_DISK_SIZE"] = 43; - values[valuesById[44] = "INSUFFICIENT_MACHINE_TIER"] = 44; - values[valuesById[45] = "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED"] = 45; - values[valuesById[46] = "EXTENSIONS_NOT_MIGRATED"] = 46; - values[valuesById[47] = "PG_CRON_FLAG_ENABLED_IN_REPLICA"] = 47; - values[valuesById[48] = "EXTENSIONS_NOT_ENABLED_IN_REPLICA"] = 48; - values[valuesById[49] = "UNSUPPORTED_COLUMNS"] = 49; - values[valuesById[50] = "USERS_NOT_CREATED_IN_REPLICA"] = 50; - values[valuesById[51] = "UNSUPPORTED_SYSTEM_OBJECTS"] = 51; - values[valuesById[52] = "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY"] = 52; - values[valuesById[53] = "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE"] = 53; - values[valuesById[54] = "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI"] = 54; - values[valuesById[55] = "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS"] = 55; - values[valuesById[56] = "PROMPT_DELETE_EXISTING"] = 56; - values[valuesById[57] = "WILL_DELETE_EXISTING"] = 57; - values[valuesById[58] = "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE"] = 58; - return values; - })(); - - return SqlExternalSyncSettingError; - })(); - - v1beta4.IpConfiguration = (function() { - - /** - * Properties of an IpConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @interface IIpConfiguration - * @property {google.protobuf.IBoolValue|null} [ipv4Enabled] IpConfiguration ipv4Enabled - * @property {string|null} [privateNetwork] IpConfiguration privateNetwork - * @property {google.protobuf.IBoolValue|null} [requireSsl] IpConfiguration requireSsl - * @property {Array.|null} [authorizedNetworks] IpConfiguration authorizedNetworks - * @property {string|null} [allocatedIpRange] IpConfiguration allocatedIpRange - * @property {google.protobuf.IBoolValue|null} [enablePrivatePathForGoogleCloudServices] IpConfiguration enablePrivatePathForGoogleCloudServices - * @property {google.cloud.sql.v1beta4.IpConfiguration.SslMode|null} [sslMode] IpConfiguration sslMode - * @property {google.cloud.sql.v1beta4.IPscConfig|null} [pscConfig] IpConfiguration pscConfig - * @property {google.cloud.sql.v1beta4.IpConfiguration.CaMode|null} [serverCaMode] IpConfiguration serverCaMode - * @property {Array.|null} [customSubjectAlternativeNames] IpConfiguration customSubjectAlternativeNames - * @property {string|null} [serverCaPool] IpConfiguration serverCaPool - * @property {google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|null} [serverCertificateRotationMode] IpConfiguration serverCertificateRotationMode - */ - - /** - * Constructs a new IpConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an IpConfiguration. - * @implements IIpConfiguration - * @constructor - * @param {google.cloud.sql.v1beta4.IIpConfiguration=} [properties] Properties to set - */ - function IpConfiguration(properties) { - this.authorizedNetworks = []; - this.customSubjectAlternativeNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IpConfiguration ipv4Enabled. - * @member {google.protobuf.IBoolValue|null|undefined} ipv4Enabled - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.ipv4Enabled = null; - - /** - * IpConfiguration privateNetwork. - * @member {string} privateNetwork - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.privateNetwork = ""; - - /** - * IpConfiguration requireSsl. - * @member {google.protobuf.IBoolValue|null|undefined} requireSsl - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.requireSsl = null; - - /** - * IpConfiguration authorizedNetworks. - * @member {Array.} authorizedNetworks - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.authorizedNetworks = $util.emptyArray; - - /** - * IpConfiguration allocatedIpRange. - * @member {string} allocatedIpRange - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.allocatedIpRange = ""; - - /** - * IpConfiguration enablePrivatePathForGoogleCloudServices. - * @member {google.protobuf.IBoolValue|null|undefined} enablePrivatePathForGoogleCloudServices - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.enablePrivatePathForGoogleCloudServices = null; - - /** - * IpConfiguration sslMode. - * @member {google.cloud.sql.v1beta4.IpConfiguration.SslMode} sslMode - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.sslMode = 0; - - /** - * IpConfiguration pscConfig. - * @member {google.cloud.sql.v1beta4.IPscConfig|null|undefined} pscConfig - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.pscConfig = null; - - /** - * IpConfiguration serverCaMode. - * @member {google.cloud.sql.v1beta4.IpConfiguration.CaMode|null|undefined} serverCaMode - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.serverCaMode = null; - - /** - * IpConfiguration customSubjectAlternativeNames. - * @member {Array.} customSubjectAlternativeNames - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.customSubjectAlternativeNames = $util.emptyArray; - - /** - * IpConfiguration serverCaPool. - * @member {string|null|undefined} serverCaPool - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.serverCaPool = null; - - /** - * IpConfiguration serverCertificateRotationMode. - * @member {google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode|null|undefined} serverCertificateRotationMode - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - */ - IpConfiguration.prototype.serverCertificateRotationMode = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(IpConfiguration.prototype, "_pscConfig", { - get: $util.oneOfGetter($oneOfFields = ["pscConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(IpConfiguration.prototype, "_serverCaMode", { - get: $util.oneOfGetter($oneOfFields = ["serverCaMode"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(IpConfiguration.prototype, "_serverCaPool", { - get: $util.oneOfGetter($oneOfFields = ["serverCaPool"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(IpConfiguration.prototype, "_serverCertificateRotationMode", { - get: $util.oneOfGetter($oneOfFields = ["serverCertificateRotationMode"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new IpConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IIpConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.IpConfiguration} IpConfiguration instance - */ - IpConfiguration.create = function create(properties) { - return new IpConfiguration(properties); - }; - - /** - * Encodes the specified IpConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.IpConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IIpConfiguration} message IpConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IpConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ipv4Enabled != null && Object.hasOwnProperty.call(message, "ipv4Enabled")) - $root.google.protobuf.BoolValue.encode(message.ipv4Enabled, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.privateNetwork != null && Object.hasOwnProperty.call(message, "privateNetwork")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.privateNetwork); - if (message.requireSsl != null && Object.hasOwnProperty.call(message, "requireSsl")) - $root.google.protobuf.BoolValue.encode(message.requireSsl, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.authorizedNetworks != null && message.authorizedNetworks.length) - for (var i = 0; i < message.authorizedNetworks.length; ++i) - $root.google.cloud.sql.v1beta4.AclEntry.encode(message.authorizedNetworks[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.allocatedIpRange != null && Object.hasOwnProperty.call(message, "allocatedIpRange")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.allocatedIpRange); - if (message.enablePrivatePathForGoogleCloudServices != null && Object.hasOwnProperty.call(message, "enablePrivatePathForGoogleCloudServices")) - $root.google.protobuf.BoolValue.encode(message.enablePrivatePathForGoogleCloudServices, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.sslMode != null && Object.hasOwnProperty.call(message, "sslMode")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.sslMode); - if (message.pscConfig != null && Object.hasOwnProperty.call(message, "pscConfig")) - $root.google.cloud.sql.v1beta4.PscConfig.encode(message.pscConfig, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.serverCaMode != null && Object.hasOwnProperty.call(message, "serverCaMode")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.serverCaMode); - if (message.customSubjectAlternativeNames != null && message.customSubjectAlternativeNames.length) - for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.customSubjectAlternativeNames[i]); - if (message.serverCaPool != null && Object.hasOwnProperty.call(message, "serverCaPool")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.serverCaPool); - if (message.serverCertificateRotationMode != null && Object.hasOwnProperty.call(message, "serverCertificateRotationMode")) - writer.uint32(/* id 16, wireType 0 =*/128).int32(message.serverCertificateRotationMode); - return writer; - }; - - /** - * Encodes the specified IpConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.IpConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IIpConfiguration} message IpConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IpConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IpConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.IpConfiguration} IpConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IpConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.IpConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.ipv4Enabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 2: { - message.privateNetwork = reader.string(); - break; - } - case 3: { - message.requireSsl = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 4: { - if (!(message.authorizedNetworks && message.authorizedNetworks.length)) - message.authorizedNetworks = []; - message.authorizedNetworks.push($root.google.cloud.sql.v1beta4.AclEntry.decode(reader, reader.uint32())); - break; - } - case 6: { - message.allocatedIpRange = reader.string(); - break; - } - case 7: { - message.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 8: { - message.sslMode = reader.int32(); - break; - } - case 9: { - message.pscConfig = $root.google.cloud.sql.v1beta4.PscConfig.decode(reader, reader.uint32()); - break; - } - case 10: { - message.serverCaMode = reader.int32(); - break; - } - case 11: { - if (!(message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length)) - message.customSubjectAlternativeNames = []; - message.customSubjectAlternativeNames.push(reader.string()); - break; - } - case 12: { - message.serverCaPool = reader.string(); - break; - } - case 16: { - message.serverCertificateRotationMode = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IpConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.IpConfiguration} IpConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IpConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IpConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IpConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.ipv4Enabled != null && message.hasOwnProperty("ipv4Enabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.ipv4Enabled); - if (error) - return "ipv4Enabled." + error; - } - if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) - if (!$util.isString(message.privateNetwork)) - return "privateNetwork: string expected"; - if (message.requireSsl != null && message.hasOwnProperty("requireSsl")) { - var error = $root.google.protobuf.BoolValue.verify(message.requireSsl); - if (error) - return "requireSsl." + error; - } - if (message.authorizedNetworks != null && message.hasOwnProperty("authorizedNetworks")) { - if (!Array.isArray(message.authorizedNetworks)) - return "authorizedNetworks: array expected"; - for (var i = 0; i < message.authorizedNetworks.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.AclEntry.verify(message.authorizedNetworks[i]); - if (error) - return "authorizedNetworks." + error; - } - } - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) - if (!$util.isString(message.allocatedIpRange)) - return "allocatedIpRange: string expected"; - if (message.enablePrivatePathForGoogleCloudServices != null && message.hasOwnProperty("enablePrivatePathForGoogleCloudServices")) { - var error = $root.google.protobuf.BoolValue.verify(message.enablePrivatePathForGoogleCloudServices); - if (error) - return "enablePrivatePathForGoogleCloudServices." + error; - } - if (message.sslMode != null && message.hasOwnProperty("sslMode")) - switch (message.sslMode) { - default: - return "sslMode: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.pscConfig != null && message.hasOwnProperty("pscConfig")) { - properties._pscConfig = 1; - { - var error = $root.google.cloud.sql.v1beta4.PscConfig.verify(message.pscConfig); - if (error) - return "pscConfig." + error; - } - } - if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) { - properties._serverCaMode = 1; - switch (message.serverCaMode) { - default: - return "serverCaMode: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - } - if (message.customSubjectAlternativeNames != null && message.hasOwnProperty("customSubjectAlternativeNames")) { - if (!Array.isArray(message.customSubjectAlternativeNames)) - return "customSubjectAlternativeNames: array expected"; - for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) - if (!$util.isString(message.customSubjectAlternativeNames[i])) - return "customSubjectAlternativeNames: string[] expected"; - } - if (message.serverCaPool != null && message.hasOwnProperty("serverCaPool")) { - properties._serverCaPool = 1; - if (!$util.isString(message.serverCaPool)) - return "serverCaPool: string expected"; - } - if (message.serverCertificateRotationMode != null && message.hasOwnProperty("serverCertificateRotationMode")) { - properties._serverCertificateRotationMode = 1; - switch (message.serverCertificateRotationMode) { - default: - return "serverCertificateRotationMode: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - return null; - }; - - /** - * Creates an IpConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.IpConfiguration} IpConfiguration - */ - IpConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.IpConfiguration) - return object; - var message = new $root.google.cloud.sql.v1beta4.IpConfiguration(); - if (object.ipv4Enabled != null) { - if (typeof object.ipv4Enabled !== "object") - throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.ipv4Enabled: object expected"); - message.ipv4Enabled = $root.google.protobuf.BoolValue.fromObject(object.ipv4Enabled); - } - if (object.privateNetwork != null) - message.privateNetwork = String(object.privateNetwork); - if (object.requireSsl != null) { - if (typeof object.requireSsl !== "object") - throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.requireSsl: object expected"); - message.requireSsl = $root.google.protobuf.BoolValue.fromObject(object.requireSsl); - } - if (object.authorizedNetworks) { - if (!Array.isArray(object.authorizedNetworks)) - throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.authorizedNetworks: array expected"); - message.authorizedNetworks = []; - for (var i = 0; i < object.authorizedNetworks.length; ++i) { - if (typeof object.authorizedNetworks[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.authorizedNetworks: object expected"); - message.authorizedNetworks[i] = $root.google.cloud.sql.v1beta4.AclEntry.fromObject(object.authorizedNetworks[i]); - } - } - if (object.allocatedIpRange != null) - message.allocatedIpRange = String(object.allocatedIpRange); - if (object.enablePrivatePathForGoogleCloudServices != null) { - if (typeof object.enablePrivatePathForGoogleCloudServices !== "object") - throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.enablePrivatePathForGoogleCloudServices: object expected"); - message.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.fromObject(object.enablePrivatePathForGoogleCloudServices); - } - switch (object.sslMode) { - default: - if (typeof object.sslMode === "number") { - message.sslMode = object.sslMode; - break; - } - break; - case "SSL_MODE_UNSPECIFIED": - case 0: - message.sslMode = 0; - break; - case "ALLOW_UNENCRYPTED_AND_ENCRYPTED": - case 1: - message.sslMode = 1; - break; - case "ENCRYPTED_ONLY": - case 2: - message.sslMode = 2; - break; - case "TRUSTED_CLIENT_CERTIFICATE_REQUIRED": - case 3: - message.sslMode = 3; - break; - } - if (object.pscConfig != null) { - if (typeof object.pscConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.pscConfig: object expected"); - message.pscConfig = $root.google.cloud.sql.v1beta4.PscConfig.fromObject(object.pscConfig); - } - switch (object.serverCaMode) { - default: - if (typeof object.serverCaMode === "number") { - message.serverCaMode = object.serverCaMode; - break; - } - break; - case "CA_MODE_UNSPECIFIED": - case 0: - message.serverCaMode = 0; - break; - case "GOOGLE_MANAGED_INTERNAL_CA": - case 1: - message.serverCaMode = 1; - break; - case "GOOGLE_MANAGED_CAS_CA": - case 2: - message.serverCaMode = 2; - break; - case "CUSTOMER_MANAGED_CAS_CA": - case 3: - message.serverCaMode = 3; - break; - } - if (object.customSubjectAlternativeNames) { - if (!Array.isArray(object.customSubjectAlternativeNames)) - throw TypeError(".google.cloud.sql.v1beta4.IpConfiguration.customSubjectAlternativeNames: array expected"); - message.customSubjectAlternativeNames = []; - for (var i = 0; i < object.customSubjectAlternativeNames.length; ++i) - message.customSubjectAlternativeNames[i] = String(object.customSubjectAlternativeNames[i]); - } - if (object.serverCaPool != null) - message.serverCaPool = String(object.serverCaPool); - switch (object.serverCertificateRotationMode) { - default: - if (typeof object.serverCertificateRotationMode === "number") { - message.serverCertificateRotationMode = object.serverCertificateRotationMode; - break; - } - break; - case "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED": - case 0: - message.serverCertificateRotationMode = 0; - break; - case "NO_AUTOMATIC_ROTATION": - case 1: - message.serverCertificateRotationMode = 1; - break; - case "AUTOMATIC_ROTATION_DURING_MAINTENANCE": - case 2: - message.serverCertificateRotationMode = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from an IpConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IpConfiguration} message IpConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IpConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.authorizedNetworks = []; - object.customSubjectAlternativeNames = []; - } - if (options.defaults) { - object.ipv4Enabled = null; - object.privateNetwork = ""; - object.requireSsl = null; - object.allocatedIpRange = ""; - object.enablePrivatePathForGoogleCloudServices = null; - object.sslMode = options.enums === String ? "SSL_MODE_UNSPECIFIED" : 0; - } - if (message.ipv4Enabled != null && message.hasOwnProperty("ipv4Enabled")) - object.ipv4Enabled = $root.google.protobuf.BoolValue.toObject(message.ipv4Enabled, options); - if (message.privateNetwork != null && message.hasOwnProperty("privateNetwork")) - object.privateNetwork = message.privateNetwork; - if (message.requireSsl != null && message.hasOwnProperty("requireSsl")) - object.requireSsl = $root.google.protobuf.BoolValue.toObject(message.requireSsl, options); - if (message.authorizedNetworks && message.authorizedNetworks.length) { - object.authorizedNetworks = []; - for (var j = 0; j < message.authorizedNetworks.length; ++j) - object.authorizedNetworks[j] = $root.google.cloud.sql.v1beta4.AclEntry.toObject(message.authorizedNetworks[j], options); - } - if (message.allocatedIpRange != null && message.hasOwnProperty("allocatedIpRange")) - object.allocatedIpRange = message.allocatedIpRange; - if (message.enablePrivatePathForGoogleCloudServices != null && message.hasOwnProperty("enablePrivatePathForGoogleCloudServices")) - object.enablePrivatePathForGoogleCloudServices = $root.google.protobuf.BoolValue.toObject(message.enablePrivatePathForGoogleCloudServices, options); - if (message.sslMode != null && message.hasOwnProperty("sslMode")) - object.sslMode = options.enums === String ? $root.google.cloud.sql.v1beta4.IpConfiguration.SslMode[message.sslMode] === undefined ? message.sslMode : $root.google.cloud.sql.v1beta4.IpConfiguration.SslMode[message.sslMode] : message.sslMode; - if (message.pscConfig != null && message.hasOwnProperty("pscConfig")) { - object.pscConfig = $root.google.cloud.sql.v1beta4.PscConfig.toObject(message.pscConfig, options); - if (options.oneofs) - object._pscConfig = "pscConfig"; - } - if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) { - object.serverCaMode = options.enums === String ? $root.google.cloud.sql.v1beta4.IpConfiguration.CaMode[message.serverCaMode] === undefined ? message.serverCaMode : $root.google.cloud.sql.v1beta4.IpConfiguration.CaMode[message.serverCaMode] : message.serverCaMode; - if (options.oneofs) - object._serverCaMode = "serverCaMode"; - } - if (message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length) { - object.customSubjectAlternativeNames = []; - for (var j = 0; j < message.customSubjectAlternativeNames.length; ++j) - object.customSubjectAlternativeNames[j] = message.customSubjectAlternativeNames[j]; - } - if (message.serverCaPool != null && message.hasOwnProperty("serverCaPool")) { - object.serverCaPool = message.serverCaPool; - if (options.oneofs) - object._serverCaPool = "serverCaPool"; - } - if (message.serverCertificateRotationMode != null && message.hasOwnProperty("serverCertificateRotationMode")) { - object.serverCertificateRotationMode = options.enums === String ? $root.google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode[message.serverCertificateRotationMode] === undefined ? message.serverCertificateRotationMode : $root.google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode[message.serverCertificateRotationMode] : message.serverCertificateRotationMode; - if (options.oneofs) - object._serverCertificateRotationMode = "serverCertificateRotationMode"; - } - return object; - }; - - /** - * Converts this IpConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @instance - * @returns {Object.} JSON object - */ - IpConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for IpConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.IpConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - IpConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.IpConfiguration"; - }; - - /** - * SslMode enum. - * @name google.cloud.sql.v1beta4.IpConfiguration.SslMode - * @enum {number} - * @property {number} SSL_MODE_UNSPECIFIED=0 SSL_MODE_UNSPECIFIED value - * @property {number} ALLOW_UNENCRYPTED_AND_ENCRYPTED=1 ALLOW_UNENCRYPTED_AND_ENCRYPTED value - * @property {number} ENCRYPTED_ONLY=2 ENCRYPTED_ONLY value - * @property {number} TRUSTED_CLIENT_CERTIFICATE_REQUIRED=3 TRUSTED_CLIENT_CERTIFICATE_REQUIRED value - */ - IpConfiguration.SslMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SSL_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ALLOW_UNENCRYPTED_AND_ENCRYPTED"] = 1; - values[valuesById[2] = "ENCRYPTED_ONLY"] = 2; - values[valuesById[3] = "TRUSTED_CLIENT_CERTIFICATE_REQUIRED"] = 3; - return values; - })(); - - /** - * CaMode enum. - * @name google.cloud.sql.v1beta4.IpConfiguration.CaMode - * @enum {number} - * @property {number} CA_MODE_UNSPECIFIED=0 CA_MODE_UNSPECIFIED value - * @property {number} GOOGLE_MANAGED_INTERNAL_CA=1 GOOGLE_MANAGED_INTERNAL_CA value - * @property {number} GOOGLE_MANAGED_CAS_CA=2 GOOGLE_MANAGED_CAS_CA value - * @property {number} CUSTOMER_MANAGED_CAS_CA=3 CUSTOMER_MANAGED_CAS_CA value - */ - IpConfiguration.CaMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CA_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "GOOGLE_MANAGED_INTERNAL_CA"] = 1; - values[valuesById[2] = "GOOGLE_MANAGED_CAS_CA"] = 2; - values[valuesById[3] = "CUSTOMER_MANAGED_CAS_CA"] = 3; - return values; - })(); - - /** - * ServerCertificateRotationMode enum. - * @name google.cloud.sql.v1beta4.IpConfiguration.ServerCertificateRotationMode - * @enum {number} - * @property {number} SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED=0 SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED value - * @property {number} NO_AUTOMATIC_ROTATION=1 NO_AUTOMATIC_ROTATION value - * @property {number} AUTOMATIC_ROTATION_DURING_MAINTENANCE=2 AUTOMATIC_ROTATION_DURING_MAINTENANCE value - */ - IpConfiguration.ServerCertificateRotationMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "NO_AUTOMATIC_ROTATION"] = 1; - values[valuesById[2] = "AUTOMATIC_ROTATION_DURING_MAINTENANCE"] = 2; - return values; - })(); - - return IpConfiguration; - })(); - - v1beta4.PscConfig = (function() { - - /** - * Properties of a PscConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IPscConfig - * @property {boolean|null} [pscEnabled] PscConfig pscEnabled - * @property {Array.|null} [allowedConsumerProjects] PscConfig allowedConsumerProjects - * @property {Array.|null} [pscAutoConnections] PscConfig pscAutoConnections - * @property {string|null} [networkAttachmentUri] PscConfig networkAttachmentUri - */ - - /** - * Constructs a new PscConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a PscConfig. - * @implements IPscConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IPscConfig=} [properties] Properties to set - */ - function PscConfig(properties) { - this.allowedConsumerProjects = []; - this.pscAutoConnections = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PscConfig pscEnabled. - * @member {boolean|null|undefined} pscEnabled - * @memberof google.cloud.sql.v1beta4.PscConfig - * @instance - */ - PscConfig.prototype.pscEnabled = null; - - /** - * PscConfig allowedConsumerProjects. - * @member {Array.} allowedConsumerProjects - * @memberof google.cloud.sql.v1beta4.PscConfig - * @instance - */ - PscConfig.prototype.allowedConsumerProjects = $util.emptyArray; - - /** - * PscConfig pscAutoConnections. - * @member {Array.} pscAutoConnections - * @memberof google.cloud.sql.v1beta4.PscConfig - * @instance - */ - PscConfig.prototype.pscAutoConnections = $util.emptyArray; - - /** - * PscConfig networkAttachmentUri. - * @member {string} networkAttachmentUri - * @memberof google.cloud.sql.v1beta4.PscConfig - * @instance - */ - PscConfig.prototype.networkAttachmentUri = ""; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PscConfig.prototype, "_pscEnabled", { - get: $util.oneOfGetter($oneOfFields = ["pscEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PscConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.PscConfig - * @static - * @param {google.cloud.sql.v1beta4.IPscConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.PscConfig} PscConfig instance - */ - PscConfig.create = function create(properties) { - return new PscConfig(properties); - }; - - /** - * Encodes the specified PscConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PscConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.PscConfig - * @static - * @param {google.cloud.sql.v1beta4.IPscConfig} message PscConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PscConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.pscEnabled != null && Object.hasOwnProperty.call(message, "pscEnabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.pscEnabled); - if (message.allowedConsumerProjects != null && message.allowedConsumerProjects.length) - for (var i = 0; i < message.allowedConsumerProjects.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.allowedConsumerProjects[i]); - if (message.pscAutoConnections != null && message.pscAutoConnections.length) - for (var i = 0; i < message.pscAutoConnections.length; ++i) - $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.encode(message.pscAutoConnections[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.networkAttachmentUri != null && Object.hasOwnProperty.call(message, "networkAttachmentUri")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.networkAttachmentUri); - return writer; - }; - - /** - * Encodes the specified PscConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PscConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.PscConfig - * @static - * @param {google.cloud.sql.v1beta4.IPscConfig} message PscConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PscConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PscConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.PscConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.PscConfig} PscConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PscConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PscConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.pscEnabled = reader.bool(); - break; - } - case 2: { - if (!(message.allowedConsumerProjects && message.allowedConsumerProjects.length)) - message.allowedConsumerProjects = []; - message.allowedConsumerProjects.push(reader.string()); - break; - } - case 3: { - if (!(message.pscAutoConnections && message.pscAutoConnections.length)) - message.pscAutoConnections = []; - message.pscAutoConnections.push($root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.decode(reader, reader.uint32())); - break; - } - case 4: { - message.networkAttachmentUri = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PscConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.PscConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.PscConfig} PscConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PscConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PscConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.PscConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PscConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) { - properties._pscEnabled = 1; - if (typeof message.pscEnabled !== "boolean") - return "pscEnabled: boolean expected"; - } - if (message.allowedConsumerProjects != null && message.hasOwnProperty("allowedConsumerProjects")) { - if (!Array.isArray(message.allowedConsumerProjects)) - return "allowedConsumerProjects: array expected"; - for (var i = 0; i < message.allowedConsumerProjects.length; ++i) - if (!$util.isString(message.allowedConsumerProjects[i])) - return "allowedConsumerProjects: string[] expected"; - } - if (message.pscAutoConnections != null && message.hasOwnProperty("pscAutoConnections")) { - if (!Array.isArray(message.pscAutoConnections)) - return "pscAutoConnections: array expected"; - for (var i = 0; i < message.pscAutoConnections.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify(message.pscAutoConnections[i]); - if (error) - return "pscAutoConnections." + error; - } - } - if (message.networkAttachmentUri != null && message.hasOwnProperty("networkAttachmentUri")) - if (!$util.isString(message.networkAttachmentUri)) - return "networkAttachmentUri: string expected"; - return null; - }; - - /** - * Creates a PscConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.PscConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.PscConfig} PscConfig - */ - PscConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.PscConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.PscConfig(); - if (object.pscEnabled != null) - message.pscEnabled = Boolean(object.pscEnabled); - if (object.allowedConsumerProjects) { - if (!Array.isArray(object.allowedConsumerProjects)) - throw TypeError(".google.cloud.sql.v1beta4.PscConfig.allowedConsumerProjects: array expected"); - message.allowedConsumerProjects = []; - for (var i = 0; i < object.allowedConsumerProjects.length; ++i) - message.allowedConsumerProjects[i] = String(object.allowedConsumerProjects[i]); - } - if (object.pscAutoConnections) { - if (!Array.isArray(object.pscAutoConnections)) - throw TypeError(".google.cloud.sql.v1beta4.PscConfig.pscAutoConnections: array expected"); - message.pscAutoConnections = []; - for (var i = 0; i < object.pscAutoConnections.length; ++i) { - if (typeof object.pscAutoConnections[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.PscConfig.pscAutoConnections: object expected"); - message.pscAutoConnections[i] = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.fromObject(object.pscAutoConnections[i]); - } - } - if (object.networkAttachmentUri != null) - message.networkAttachmentUri = String(object.networkAttachmentUri); - return message; - }; - - /** - * Creates a plain object from a PscConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.PscConfig - * @static - * @param {google.cloud.sql.v1beta4.PscConfig} message PscConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PscConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.allowedConsumerProjects = []; - object.pscAutoConnections = []; - } - if (options.defaults) - object.networkAttachmentUri = ""; - if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) { - object.pscEnabled = message.pscEnabled; - if (options.oneofs) - object._pscEnabled = "pscEnabled"; - } - if (message.allowedConsumerProjects && message.allowedConsumerProjects.length) { - object.allowedConsumerProjects = []; - for (var j = 0; j < message.allowedConsumerProjects.length; ++j) - object.allowedConsumerProjects[j] = message.allowedConsumerProjects[j]; - } - if (message.pscAutoConnections && message.pscAutoConnections.length) { - object.pscAutoConnections = []; - for (var j = 0; j < message.pscAutoConnections.length; ++j) - object.pscAutoConnections[j] = $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig.toObject(message.pscAutoConnections[j], options); - } - if (message.networkAttachmentUri != null && message.hasOwnProperty("networkAttachmentUri")) - object.networkAttachmentUri = message.networkAttachmentUri; - return object; - }; - - /** - * Converts this PscConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.PscConfig - * @instance - * @returns {Object.} JSON object - */ - PscConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PscConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.PscConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PscConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.PscConfig"; - }; - - return PscConfig; - })(); - - v1beta4.PscAutoConnectionConfig = (function() { - - /** - * Properties of a PscAutoConnectionConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IPscAutoConnectionConfig - * @property {string|null} [consumerProject] PscAutoConnectionConfig consumerProject - * @property {string|null} [consumerNetwork] PscAutoConnectionConfig consumerNetwork - * @property {string|null} [ipAddress] PscAutoConnectionConfig ipAddress - * @property {string|null} [status] PscAutoConnectionConfig status - * @property {string|null} [consumerNetworkStatus] PscAutoConnectionConfig consumerNetworkStatus - */ - - /** - * Constructs a new PscAutoConnectionConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a PscAutoConnectionConfig. - * @implements IPscAutoConnectionConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IPscAutoConnectionConfig=} [properties] Properties to set - */ - function PscAutoConnectionConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PscAutoConnectionConfig consumerProject. - * @member {string} consumerProject - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @instance - */ - PscAutoConnectionConfig.prototype.consumerProject = ""; - - /** - * PscAutoConnectionConfig consumerNetwork. - * @member {string} consumerNetwork - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @instance - */ - PscAutoConnectionConfig.prototype.consumerNetwork = ""; - - /** - * PscAutoConnectionConfig ipAddress. - * @member {string|null|undefined} ipAddress - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @instance - */ - PscAutoConnectionConfig.prototype.ipAddress = null; - - /** - * PscAutoConnectionConfig status. - * @member {string|null|undefined} status - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @instance - */ - PscAutoConnectionConfig.prototype.status = null; - - /** - * PscAutoConnectionConfig consumerNetworkStatus. - * @member {string|null|undefined} consumerNetworkStatus - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @instance - */ - PscAutoConnectionConfig.prototype.consumerNetworkStatus = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PscAutoConnectionConfig.prototype, "_ipAddress", { - get: $util.oneOfGetter($oneOfFields = ["ipAddress"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PscAutoConnectionConfig.prototype, "_status", { - get: $util.oneOfGetter($oneOfFields = ["status"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PscAutoConnectionConfig.prototype, "_consumerNetworkStatus", { - get: $util.oneOfGetter($oneOfFields = ["consumerNetworkStatus"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PscAutoConnectionConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @static - * @param {google.cloud.sql.v1beta4.IPscAutoConnectionConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.PscAutoConnectionConfig} PscAutoConnectionConfig instance - */ - PscAutoConnectionConfig.create = function create(properties) { - return new PscAutoConnectionConfig(properties); - }; - - /** - * Encodes the specified PscAutoConnectionConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @static - * @param {google.cloud.sql.v1beta4.IPscAutoConnectionConfig} message PscAutoConnectionConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PscAutoConnectionConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.consumerProject != null && Object.hasOwnProperty.call(message, "consumerProject")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.consumerProject); - if (message.consumerNetwork != null && Object.hasOwnProperty.call(message, "consumerNetwork")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.consumerNetwork); - if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.ipAddress); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.status); - if (message.consumerNetworkStatus != null && Object.hasOwnProperty.call(message, "consumerNetworkStatus")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.consumerNetworkStatus); - return writer; - }; - - /** - * Encodes the specified PscAutoConnectionConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PscAutoConnectionConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @static - * @param {google.cloud.sql.v1beta4.IPscAutoConnectionConfig} message PscAutoConnectionConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PscAutoConnectionConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PscAutoConnectionConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.PscAutoConnectionConfig} PscAutoConnectionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PscAutoConnectionConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.consumerProject = reader.string(); - break; - } - case 2: { - message.consumerNetwork = reader.string(); - break; - } - case 3: { - message.ipAddress = reader.string(); - break; - } - case 4: { - message.status = reader.string(); - break; - } - case 5: { - message.consumerNetworkStatus = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PscAutoConnectionConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.PscAutoConnectionConfig} PscAutoConnectionConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PscAutoConnectionConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PscAutoConnectionConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PscAutoConnectionConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.consumerProject != null && message.hasOwnProperty("consumerProject")) - if (!$util.isString(message.consumerProject)) - return "consumerProject: string expected"; - if (message.consumerNetwork != null && message.hasOwnProperty("consumerNetwork")) - if (!$util.isString(message.consumerNetwork)) - return "consumerNetwork: string expected"; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) { - properties._ipAddress = 1; - if (!$util.isString(message.ipAddress)) - return "ipAddress: string expected"; - } - if (message.status != null && message.hasOwnProperty("status")) { - properties._status = 1; - if (!$util.isString(message.status)) - return "status: string expected"; - } - if (message.consumerNetworkStatus != null && message.hasOwnProperty("consumerNetworkStatus")) { - properties._consumerNetworkStatus = 1; - if (!$util.isString(message.consumerNetworkStatus)) - return "consumerNetworkStatus: string expected"; - } - return null; - }; - - /** - * Creates a PscAutoConnectionConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.PscAutoConnectionConfig} PscAutoConnectionConfig - */ - PscAutoConnectionConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.PscAutoConnectionConfig(); - if (object.consumerProject != null) - message.consumerProject = String(object.consumerProject); - if (object.consumerNetwork != null) - message.consumerNetwork = String(object.consumerNetwork); - if (object.ipAddress != null) - message.ipAddress = String(object.ipAddress); - if (object.status != null) - message.status = String(object.status); - if (object.consumerNetworkStatus != null) - message.consumerNetworkStatus = String(object.consumerNetworkStatus); - return message; - }; - - /** - * Creates a plain object from a PscAutoConnectionConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @static - * @param {google.cloud.sql.v1beta4.PscAutoConnectionConfig} message PscAutoConnectionConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PscAutoConnectionConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.consumerProject = ""; - object.consumerNetwork = ""; - } - if (message.consumerProject != null && message.hasOwnProperty("consumerProject")) - object.consumerProject = message.consumerProject; - if (message.consumerNetwork != null && message.hasOwnProperty("consumerNetwork")) - object.consumerNetwork = message.consumerNetwork; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) { - object.ipAddress = message.ipAddress; - if (options.oneofs) - object._ipAddress = "ipAddress"; - } - if (message.status != null && message.hasOwnProperty("status")) { - object.status = message.status; - if (options.oneofs) - object._status = "status"; - } - if (message.consumerNetworkStatus != null && message.hasOwnProperty("consumerNetworkStatus")) { - object.consumerNetworkStatus = message.consumerNetworkStatus; - if (options.oneofs) - object._consumerNetworkStatus = "consumerNetworkStatus"; - } - return object; - }; - - /** - * Converts this PscAutoConnectionConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @instance - * @returns {Object.} JSON object - */ - PscAutoConnectionConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PscAutoConnectionConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.PscAutoConnectionConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PscAutoConnectionConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.PscAutoConnectionConfig"; - }; - - return PscAutoConnectionConfig; - })(); - - v1beta4.IpMapping = (function() { - - /** - * Properties of an IpMapping. - * @memberof google.cloud.sql.v1beta4 - * @interface IIpMapping - * @property {google.cloud.sql.v1beta4.SqlIpAddressType|null} [type] IpMapping type - * @property {string|null} [ipAddress] IpMapping ipAddress - * @property {google.protobuf.ITimestamp|null} [timeToRetire] IpMapping timeToRetire - */ - - /** - * Constructs a new IpMapping. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an IpMapping. - * @implements IIpMapping - * @constructor - * @param {google.cloud.sql.v1beta4.IIpMapping=} [properties] Properties to set - */ - function IpMapping(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * IpMapping type. - * @member {google.cloud.sql.v1beta4.SqlIpAddressType} type - * @memberof google.cloud.sql.v1beta4.IpMapping - * @instance - */ - IpMapping.prototype.type = 0; - - /** - * IpMapping ipAddress. - * @member {string} ipAddress - * @memberof google.cloud.sql.v1beta4.IpMapping - * @instance - */ - IpMapping.prototype.ipAddress = ""; - - /** - * IpMapping timeToRetire. - * @member {google.protobuf.ITimestamp|null|undefined} timeToRetire - * @memberof google.cloud.sql.v1beta4.IpMapping - * @instance - */ - IpMapping.prototype.timeToRetire = null; - - /** - * Creates a new IpMapping instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.IpMapping - * @static - * @param {google.cloud.sql.v1beta4.IIpMapping=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.IpMapping} IpMapping instance - */ - IpMapping.create = function create(properties) { - return new IpMapping(properties); - }; - - /** - * Encodes the specified IpMapping message. Does not implicitly {@link google.cloud.sql.v1beta4.IpMapping.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.IpMapping - * @static - * @param {google.cloud.sql.v1beta4.IIpMapping} message IpMapping message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IpMapping.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.type); - if (message.ipAddress != null && Object.hasOwnProperty.call(message, "ipAddress")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.ipAddress); - if (message.timeToRetire != null && Object.hasOwnProperty.call(message, "timeToRetire")) - $root.google.protobuf.Timestamp.encode(message.timeToRetire, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified IpMapping message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.IpMapping.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.IpMapping - * @static - * @param {google.cloud.sql.v1beta4.IIpMapping} message IpMapping message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - IpMapping.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an IpMapping message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.IpMapping - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.IpMapping} IpMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IpMapping.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.IpMapping(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.type = reader.int32(); - break; - } - case 2: { - message.ipAddress = reader.string(); - break; - } - case 3: { - message.timeToRetire = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an IpMapping message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.IpMapping - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.IpMapping} IpMapping - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - IpMapping.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an IpMapping message. - * @function verify - * @memberof google.cloud.sql.v1beta4.IpMapping - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - IpMapping.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - if (!$util.isString(message.ipAddress)) - return "ipAddress: string expected"; - if (message.timeToRetire != null && message.hasOwnProperty("timeToRetire")) { - var error = $root.google.protobuf.Timestamp.verify(message.timeToRetire); - if (error) - return "timeToRetire." + error; - } - return null; - }; - - /** - * Creates an IpMapping message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.IpMapping - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.IpMapping} IpMapping - */ - IpMapping.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.IpMapping) - return object; - var message = new $root.google.cloud.sql.v1beta4.IpMapping(); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "SQL_IP_ADDRESS_TYPE_UNSPECIFIED": - case 0: - message.type = 0; - break; - case "PRIMARY": - case 1: - message.type = 1; - break; - case "OUTGOING": - case 2: - message.type = 2; - break; - case "PRIVATE": - case 3: - message.type = 3; - break; - case "MIGRATED_1ST_GEN": - case 4: - message.type = 4; - break; - } - if (object.ipAddress != null) - message.ipAddress = String(object.ipAddress); - if (object.timeToRetire != null) { - if (typeof object.timeToRetire !== "object") - throw TypeError(".google.cloud.sql.v1beta4.IpMapping.timeToRetire: object expected"); - message.timeToRetire = $root.google.protobuf.Timestamp.fromObject(object.timeToRetire); - } - return message; - }; - - /** - * Creates a plain object from an IpMapping message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.IpMapping - * @static - * @param {google.cloud.sql.v1beta4.IpMapping} message IpMapping - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - IpMapping.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = options.enums === String ? "SQL_IP_ADDRESS_TYPE_UNSPECIFIED" : 0; - object.ipAddress = ""; - object.timeToRetire = null; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlIpAddressType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.SqlIpAddressType[message.type] : message.type; - if (message.ipAddress != null && message.hasOwnProperty("ipAddress")) - object.ipAddress = message.ipAddress; - if (message.timeToRetire != null && message.hasOwnProperty("timeToRetire")) - object.timeToRetire = $root.google.protobuf.Timestamp.toObject(message.timeToRetire, options); - return object; - }; - - /** - * Converts this IpMapping to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.IpMapping - * @instance - * @returns {Object.} JSON object - */ - IpMapping.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for IpMapping - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.IpMapping - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - IpMapping.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.IpMapping"; - }; - - return IpMapping; - })(); - - v1beta4.LocationPreference = (function() { - - /** - * Properties of a LocationPreference. - * @memberof google.cloud.sql.v1beta4 - * @interface ILocationPreference - * @property {string|null} [followGaeApplication] LocationPreference followGaeApplication - * @property {string|null} [zone] LocationPreference zone - * @property {string|null} [secondaryZone] LocationPreference secondaryZone - * @property {string|null} [kind] LocationPreference kind - */ - - /** - * Constructs a new LocationPreference. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a LocationPreference. - * @implements ILocationPreference - * @constructor - * @param {google.cloud.sql.v1beta4.ILocationPreference=} [properties] Properties to set - */ - function LocationPreference(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LocationPreference followGaeApplication. - * @member {string} followGaeApplication - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @instance - */ - LocationPreference.prototype.followGaeApplication = ""; - - /** - * LocationPreference zone. - * @member {string} zone - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @instance - */ - LocationPreference.prototype.zone = ""; - - /** - * LocationPreference secondaryZone. - * @member {string} secondaryZone - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @instance - */ - LocationPreference.prototype.secondaryZone = ""; - - /** - * LocationPreference kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @instance - */ - LocationPreference.prototype.kind = ""; - - /** - * Creates a new LocationPreference instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @static - * @param {google.cloud.sql.v1beta4.ILocationPreference=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.LocationPreference} LocationPreference instance - */ - LocationPreference.create = function create(properties) { - return new LocationPreference(properties); - }; - - /** - * Encodes the specified LocationPreference message. Does not implicitly {@link google.cloud.sql.v1beta4.LocationPreference.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @static - * @param {google.cloud.sql.v1beta4.ILocationPreference} message LocationPreference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LocationPreference.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.followGaeApplication != null && Object.hasOwnProperty.call(message, "followGaeApplication")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.followGaeApplication); - if (message.zone != null && Object.hasOwnProperty.call(message, "zone")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.zone); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - if (message.secondaryZone != null && Object.hasOwnProperty.call(message, "secondaryZone")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.secondaryZone); - return writer; - }; - - /** - * Encodes the specified LocationPreference message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.LocationPreference.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @static - * @param {google.cloud.sql.v1beta4.ILocationPreference} message LocationPreference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LocationPreference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LocationPreference message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.LocationPreference} LocationPreference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LocationPreference.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.LocationPreference(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.followGaeApplication = reader.string(); - break; - } - case 2: { - message.zone = reader.string(); - break; - } - case 4: { - message.secondaryZone = reader.string(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LocationPreference message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.LocationPreference} LocationPreference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LocationPreference.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LocationPreference message. - * @function verify - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LocationPreference.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.followGaeApplication != null && message.hasOwnProperty("followGaeApplication")) - if (!$util.isString(message.followGaeApplication)) - return "followGaeApplication: string expected"; - if (message.zone != null && message.hasOwnProperty("zone")) - if (!$util.isString(message.zone)) - return "zone: string expected"; - if (message.secondaryZone != null && message.hasOwnProperty("secondaryZone")) - if (!$util.isString(message.secondaryZone)) - return "secondaryZone: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a LocationPreference message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.LocationPreference} LocationPreference - */ - LocationPreference.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.LocationPreference) - return object; - var message = new $root.google.cloud.sql.v1beta4.LocationPreference(); - if (object.followGaeApplication != null) - message.followGaeApplication = String(object.followGaeApplication); - if (object.zone != null) - message.zone = String(object.zone); - if (object.secondaryZone != null) - message.secondaryZone = String(object.secondaryZone); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a LocationPreference message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @static - * @param {google.cloud.sql.v1beta4.LocationPreference} message LocationPreference - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LocationPreference.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.followGaeApplication = ""; - object.zone = ""; - object.kind = ""; - object.secondaryZone = ""; - } - if (message.followGaeApplication != null && message.hasOwnProperty("followGaeApplication")) - object.followGaeApplication = message.followGaeApplication; - if (message.zone != null && message.hasOwnProperty("zone")) - object.zone = message.zone; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.secondaryZone != null && message.hasOwnProperty("secondaryZone")) - object.secondaryZone = message.secondaryZone; - return object; - }; - - /** - * Converts this LocationPreference to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @instance - * @returns {Object.} JSON object - */ - LocationPreference.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LocationPreference - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.LocationPreference - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LocationPreference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.LocationPreference"; - }; - - return LocationPreference; - })(); - - v1beta4.MaintenanceWindow = (function() { - - /** - * Properties of a MaintenanceWindow. - * @memberof google.cloud.sql.v1beta4 - * @interface IMaintenanceWindow - * @property {google.protobuf.IInt32Value|null} [hour] MaintenanceWindow hour - * @property {google.protobuf.IInt32Value|null} [day] MaintenanceWindow day - * @property {google.cloud.sql.v1beta4.SqlUpdateTrack|null} [updateTrack] MaintenanceWindow updateTrack - * @property {string|null} [kind] MaintenanceWindow kind - */ - - /** - * Constructs a new MaintenanceWindow. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a MaintenanceWindow. - * @implements IMaintenanceWindow - * @constructor - * @param {google.cloud.sql.v1beta4.IMaintenanceWindow=} [properties] Properties to set - */ - function MaintenanceWindow(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MaintenanceWindow hour. - * @member {google.protobuf.IInt32Value|null|undefined} hour - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @instance - */ - MaintenanceWindow.prototype.hour = null; - - /** - * MaintenanceWindow day. - * @member {google.protobuf.IInt32Value|null|undefined} day - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @instance - */ - MaintenanceWindow.prototype.day = null; - - /** - * MaintenanceWindow updateTrack. - * @member {google.cloud.sql.v1beta4.SqlUpdateTrack} updateTrack - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @instance - */ - MaintenanceWindow.prototype.updateTrack = 0; - - /** - * MaintenanceWindow kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @instance - */ - MaintenanceWindow.prototype.kind = ""; - - /** - * Creates a new MaintenanceWindow instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @static - * @param {google.cloud.sql.v1beta4.IMaintenanceWindow=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.MaintenanceWindow} MaintenanceWindow instance - */ - MaintenanceWindow.create = function create(properties) { - return new MaintenanceWindow(properties); - }; - - /** - * Encodes the specified MaintenanceWindow message. Does not implicitly {@link google.cloud.sql.v1beta4.MaintenanceWindow.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @static - * @param {google.cloud.sql.v1beta4.IMaintenanceWindow} message MaintenanceWindow message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MaintenanceWindow.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hour != null && Object.hasOwnProperty.call(message, "hour")) - $root.google.protobuf.Int32Value.encode(message.hour, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.day != null && Object.hasOwnProperty.call(message, "day")) - $root.google.protobuf.Int32Value.encode(message.day, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.updateTrack != null && Object.hasOwnProperty.call(message, "updateTrack")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.updateTrack); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); - return writer; - }; - - /** - * Encodes the specified MaintenanceWindow message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MaintenanceWindow.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @static - * @param {google.cloud.sql.v1beta4.IMaintenanceWindow} message MaintenanceWindow message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MaintenanceWindow.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MaintenanceWindow message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.MaintenanceWindow} MaintenanceWindow - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MaintenanceWindow.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.MaintenanceWindow(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.hour = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 2: { - message.day = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 3: { - message.updateTrack = reader.int32(); - break; - } - case 4: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MaintenanceWindow message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.MaintenanceWindow} MaintenanceWindow - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MaintenanceWindow.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MaintenanceWindow message. - * @function verify - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MaintenanceWindow.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hour != null && message.hasOwnProperty("hour")) { - var error = $root.google.protobuf.Int32Value.verify(message.hour); - if (error) - return "hour." + error; - } - if (message.day != null && message.hasOwnProperty("day")) { - var error = $root.google.protobuf.Int32Value.verify(message.day); - if (error) - return "day." + error; - } - if (message.updateTrack != null && message.hasOwnProperty("updateTrack")) - switch (message.updateTrack) { - default: - return "updateTrack: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a MaintenanceWindow message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.MaintenanceWindow} MaintenanceWindow - */ - MaintenanceWindow.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.MaintenanceWindow) - return object; - var message = new $root.google.cloud.sql.v1beta4.MaintenanceWindow(); - if (object.hour != null) { - if (typeof object.hour !== "object") - throw TypeError(".google.cloud.sql.v1beta4.MaintenanceWindow.hour: object expected"); - message.hour = $root.google.protobuf.Int32Value.fromObject(object.hour); - } - if (object.day != null) { - if (typeof object.day !== "object") - throw TypeError(".google.cloud.sql.v1beta4.MaintenanceWindow.day: object expected"); - message.day = $root.google.protobuf.Int32Value.fromObject(object.day); - } - switch (object.updateTrack) { - default: - if (typeof object.updateTrack === "number") { - message.updateTrack = object.updateTrack; - break; - } - break; - case "SQL_UPDATE_TRACK_UNSPECIFIED": - case 0: - message.updateTrack = 0; - break; - case "canary": - case 1: - message.updateTrack = 1; - break; - case "stable": - case 2: - message.updateTrack = 2; - break; - case "week5": - case 3: - message.updateTrack = 3; - break; - } - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a MaintenanceWindow message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @static - * @param {google.cloud.sql.v1beta4.MaintenanceWindow} message MaintenanceWindow - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MaintenanceWindow.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.hour = null; - object.day = null; - object.updateTrack = options.enums === String ? "SQL_UPDATE_TRACK_UNSPECIFIED" : 0; - object.kind = ""; - } - if (message.hour != null && message.hasOwnProperty("hour")) - object.hour = $root.google.protobuf.Int32Value.toObject(message.hour, options); - if (message.day != null && message.hasOwnProperty("day")) - object.day = $root.google.protobuf.Int32Value.toObject(message.day, options); - if (message.updateTrack != null && message.hasOwnProperty("updateTrack")) - object.updateTrack = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlUpdateTrack[message.updateTrack] === undefined ? message.updateTrack : $root.google.cloud.sql.v1beta4.SqlUpdateTrack[message.updateTrack] : message.updateTrack; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this MaintenanceWindow to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @instance - * @returns {Object.} JSON object - */ - MaintenanceWindow.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MaintenanceWindow - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.MaintenanceWindow - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MaintenanceWindow.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.MaintenanceWindow"; - }; - - return MaintenanceWindow; - })(); - - v1beta4.DenyMaintenancePeriod = (function() { - - /** - * Properties of a DenyMaintenancePeriod. - * @memberof google.cloud.sql.v1beta4 - * @interface IDenyMaintenancePeriod - * @property {string|null} [startDate] DenyMaintenancePeriod startDate - * @property {string|null} [endDate] DenyMaintenancePeriod endDate - * @property {string|null} [time] DenyMaintenancePeriod time - */ - - /** - * Constructs a new DenyMaintenancePeriod. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DenyMaintenancePeriod. - * @implements IDenyMaintenancePeriod - * @constructor - * @param {google.cloud.sql.v1beta4.IDenyMaintenancePeriod=} [properties] Properties to set - */ - function DenyMaintenancePeriod(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DenyMaintenancePeriod startDate. - * @member {string} startDate - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @instance - */ - DenyMaintenancePeriod.prototype.startDate = ""; - - /** - * DenyMaintenancePeriod endDate. - * @member {string} endDate - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @instance - */ - DenyMaintenancePeriod.prototype.endDate = ""; - - /** - * DenyMaintenancePeriod time. - * @member {string} time - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @instance - */ - DenyMaintenancePeriod.prototype.time = ""; - - /** - * Creates a new DenyMaintenancePeriod instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @static - * @param {google.cloud.sql.v1beta4.IDenyMaintenancePeriod=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DenyMaintenancePeriod} DenyMaintenancePeriod instance - */ - DenyMaintenancePeriod.create = function create(properties) { - return new DenyMaintenancePeriod(properties); - }; - - /** - * Encodes the specified DenyMaintenancePeriod message. Does not implicitly {@link google.cloud.sql.v1beta4.DenyMaintenancePeriod.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @static - * @param {google.cloud.sql.v1beta4.IDenyMaintenancePeriod} message DenyMaintenancePeriod message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DenyMaintenancePeriod.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startDate != null && Object.hasOwnProperty.call(message, "startDate")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.startDate); - if (message.endDate != null && Object.hasOwnProperty.call(message, "endDate")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.endDate); - if (message.time != null && Object.hasOwnProperty.call(message, "time")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.time); - return writer; - }; - - /** - * Encodes the specified DenyMaintenancePeriod message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DenyMaintenancePeriod.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @static - * @param {google.cloud.sql.v1beta4.IDenyMaintenancePeriod} message DenyMaintenancePeriod message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DenyMaintenancePeriod.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DenyMaintenancePeriod message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DenyMaintenancePeriod} DenyMaintenancePeriod - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DenyMaintenancePeriod.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.startDate = reader.string(); - break; - } - case 2: { - message.endDate = reader.string(); - break; - } - case 3: { - message.time = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DenyMaintenancePeriod message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DenyMaintenancePeriod} DenyMaintenancePeriod - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DenyMaintenancePeriod.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DenyMaintenancePeriod message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DenyMaintenancePeriod.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.startDate != null && message.hasOwnProperty("startDate")) - if (!$util.isString(message.startDate)) - return "startDate: string expected"; - if (message.endDate != null && message.hasOwnProperty("endDate")) - if (!$util.isString(message.endDate)) - return "endDate: string expected"; - if (message.time != null && message.hasOwnProperty("time")) - if (!$util.isString(message.time)) - return "time: string expected"; - return null; - }; - - /** - * Creates a DenyMaintenancePeriod message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DenyMaintenancePeriod} DenyMaintenancePeriod - */ - DenyMaintenancePeriod.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod) - return object; - var message = new $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod(); - if (object.startDate != null) - message.startDate = String(object.startDate); - if (object.endDate != null) - message.endDate = String(object.endDate); - if (object.time != null) - message.time = String(object.time); - return message; - }; - - /** - * Creates a plain object from a DenyMaintenancePeriod message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @static - * @param {google.cloud.sql.v1beta4.DenyMaintenancePeriod} message DenyMaintenancePeriod - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DenyMaintenancePeriod.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.startDate = ""; - object.endDate = ""; - object.time = ""; - } - if (message.startDate != null && message.hasOwnProperty("startDate")) - object.startDate = message.startDate; - if (message.endDate != null && message.hasOwnProperty("endDate")) - object.endDate = message.endDate; - if (message.time != null && message.hasOwnProperty("time")) - object.time = message.time; - return object; - }; - - /** - * Converts this DenyMaintenancePeriod to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @instance - * @returns {Object.} JSON object - */ - DenyMaintenancePeriod.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DenyMaintenancePeriod - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DenyMaintenancePeriod - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DenyMaintenancePeriod.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DenyMaintenancePeriod"; - }; - - return DenyMaintenancePeriod; - })(); - - v1beta4.InsightsConfig = (function() { - - /** - * Properties of an InsightsConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IInsightsConfig - * @property {boolean|null} [queryInsightsEnabled] InsightsConfig queryInsightsEnabled - * @property {boolean|null} [recordClientAddress] InsightsConfig recordClientAddress - * @property {boolean|null} [recordApplicationTags] InsightsConfig recordApplicationTags - * @property {google.protobuf.IInt32Value|null} [queryStringLength] InsightsConfig queryStringLength - * @property {google.protobuf.IInt32Value|null} [queryPlansPerMinute] InsightsConfig queryPlansPerMinute - * @property {google.protobuf.IBoolValue|null} [enhancedQueryInsightsEnabled] InsightsConfig enhancedQueryInsightsEnabled - */ - - /** - * Constructs a new InsightsConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an InsightsConfig. - * @implements IInsightsConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IInsightsConfig=} [properties] Properties to set - */ - function InsightsConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * InsightsConfig queryInsightsEnabled. - * @member {boolean} queryInsightsEnabled - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @instance - */ - InsightsConfig.prototype.queryInsightsEnabled = false; - - /** - * InsightsConfig recordClientAddress. - * @member {boolean} recordClientAddress - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @instance - */ - InsightsConfig.prototype.recordClientAddress = false; - - /** - * InsightsConfig recordApplicationTags. - * @member {boolean} recordApplicationTags - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @instance - */ - InsightsConfig.prototype.recordApplicationTags = false; - - /** - * InsightsConfig queryStringLength. - * @member {google.protobuf.IInt32Value|null|undefined} queryStringLength - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @instance - */ - InsightsConfig.prototype.queryStringLength = null; - - /** - * InsightsConfig queryPlansPerMinute. - * @member {google.protobuf.IInt32Value|null|undefined} queryPlansPerMinute - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @instance - */ - InsightsConfig.prototype.queryPlansPerMinute = null; - - /** - * InsightsConfig enhancedQueryInsightsEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} enhancedQueryInsightsEnabled - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @instance - */ - InsightsConfig.prototype.enhancedQueryInsightsEnabled = null; - - /** - * Creates a new InsightsConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @static - * @param {google.cloud.sql.v1beta4.IInsightsConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.InsightsConfig} InsightsConfig instance - */ - InsightsConfig.create = function create(properties) { - return new InsightsConfig(properties); - }; - - /** - * Encodes the specified InsightsConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.InsightsConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @static - * @param {google.cloud.sql.v1beta4.IInsightsConfig} message InsightsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InsightsConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.queryInsightsEnabled != null && Object.hasOwnProperty.call(message, "queryInsightsEnabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.queryInsightsEnabled); - if (message.recordClientAddress != null && Object.hasOwnProperty.call(message, "recordClientAddress")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.recordClientAddress); - if (message.recordApplicationTags != null && Object.hasOwnProperty.call(message, "recordApplicationTags")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.recordApplicationTags); - if (message.queryStringLength != null && Object.hasOwnProperty.call(message, "queryStringLength")) - $root.google.protobuf.Int32Value.encode(message.queryStringLength, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.queryPlansPerMinute != null && Object.hasOwnProperty.call(message, "queryPlansPerMinute")) - $root.google.protobuf.Int32Value.encode(message.queryPlansPerMinute, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.enhancedQueryInsightsEnabled != null && Object.hasOwnProperty.call(message, "enhancedQueryInsightsEnabled")) - $root.google.protobuf.BoolValue.encode(message.enhancedQueryInsightsEnabled, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified InsightsConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.InsightsConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @static - * @param {google.cloud.sql.v1beta4.IInsightsConfig} message InsightsConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - InsightsConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an InsightsConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.InsightsConfig} InsightsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InsightsConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.InsightsConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.queryInsightsEnabled = reader.bool(); - break; - } - case 2: { - message.recordClientAddress = reader.bool(); - break; - } - case 3: { - message.recordApplicationTags = reader.bool(); - break; - } - case 4: { - message.queryStringLength = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 5: { - message.queryPlansPerMinute = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 8: { - message.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an InsightsConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.InsightsConfig} InsightsConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - InsightsConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an InsightsConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - InsightsConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.queryInsightsEnabled != null && message.hasOwnProperty("queryInsightsEnabled")) - if (typeof message.queryInsightsEnabled !== "boolean") - return "queryInsightsEnabled: boolean expected"; - if (message.recordClientAddress != null && message.hasOwnProperty("recordClientAddress")) - if (typeof message.recordClientAddress !== "boolean") - return "recordClientAddress: boolean expected"; - if (message.recordApplicationTags != null && message.hasOwnProperty("recordApplicationTags")) - if (typeof message.recordApplicationTags !== "boolean") - return "recordApplicationTags: boolean expected"; - if (message.queryStringLength != null && message.hasOwnProperty("queryStringLength")) { - var error = $root.google.protobuf.Int32Value.verify(message.queryStringLength); - if (error) - return "queryStringLength." + error; - } - if (message.queryPlansPerMinute != null && message.hasOwnProperty("queryPlansPerMinute")) { - var error = $root.google.protobuf.Int32Value.verify(message.queryPlansPerMinute); - if (error) - return "queryPlansPerMinute." + error; - } - if (message.enhancedQueryInsightsEnabled != null && message.hasOwnProperty("enhancedQueryInsightsEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.enhancedQueryInsightsEnabled); - if (error) - return "enhancedQueryInsightsEnabled." + error; - } - return null; - }; - - /** - * Creates an InsightsConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.InsightsConfig} InsightsConfig - */ - InsightsConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.InsightsConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.InsightsConfig(); - if (object.queryInsightsEnabled != null) - message.queryInsightsEnabled = Boolean(object.queryInsightsEnabled); - if (object.recordClientAddress != null) - message.recordClientAddress = Boolean(object.recordClientAddress); - if (object.recordApplicationTags != null) - message.recordApplicationTags = Boolean(object.recordApplicationTags); - if (object.queryStringLength != null) { - if (typeof object.queryStringLength !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InsightsConfig.queryStringLength: object expected"); - message.queryStringLength = $root.google.protobuf.Int32Value.fromObject(object.queryStringLength); - } - if (object.queryPlansPerMinute != null) { - if (typeof object.queryPlansPerMinute !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InsightsConfig.queryPlansPerMinute: object expected"); - message.queryPlansPerMinute = $root.google.protobuf.Int32Value.fromObject(object.queryPlansPerMinute); - } - if (object.enhancedQueryInsightsEnabled != null) { - if (typeof object.enhancedQueryInsightsEnabled !== "object") - throw TypeError(".google.cloud.sql.v1beta4.InsightsConfig.enhancedQueryInsightsEnabled: object expected"); - message.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.fromObject(object.enhancedQueryInsightsEnabled); - } - return message; - }; - - /** - * Creates a plain object from an InsightsConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @static - * @param {google.cloud.sql.v1beta4.InsightsConfig} message InsightsConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - InsightsConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.queryInsightsEnabled = false; - object.recordClientAddress = false; - object.recordApplicationTags = false; - object.queryStringLength = null; - object.queryPlansPerMinute = null; - object.enhancedQueryInsightsEnabled = null; - } - if (message.queryInsightsEnabled != null && message.hasOwnProperty("queryInsightsEnabled")) - object.queryInsightsEnabled = message.queryInsightsEnabled; - if (message.recordClientAddress != null && message.hasOwnProperty("recordClientAddress")) - object.recordClientAddress = message.recordClientAddress; - if (message.recordApplicationTags != null && message.hasOwnProperty("recordApplicationTags")) - object.recordApplicationTags = message.recordApplicationTags; - if (message.queryStringLength != null && message.hasOwnProperty("queryStringLength")) - object.queryStringLength = $root.google.protobuf.Int32Value.toObject(message.queryStringLength, options); - if (message.queryPlansPerMinute != null && message.hasOwnProperty("queryPlansPerMinute")) - object.queryPlansPerMinute = $root.google.protobuf.Int32Value.toObject(message.queryPlansPerMinute, options); - if (message.enhancedQueryInsightsEnabled != null && message.hasOwnProperty("enhancedQueryInsightsEnabled")) - object.enhancedQueryInsightsEnabled = $root.google.protobuf.BoolValue.toObject(message.enhancedQueryInsightsEnabled, options); - return object; - }; - - /** - * Converts this InsightsConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @instance - * @returns {Object.} JSON object - */ - InsightsConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for InsightsConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.InsightsConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - InsightsConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.InsightsConfig"; - }; - - return InsightsConfig; - })(); - - v1beta4.MySqlReplicaConfiguration = (function() { - - /** - * Properties of a MySqlReplicaConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @interface IMySqlReplicaConfiguration - * @property {string|null} [dumpFilePath] MySqlReplicaConfiguration dumpFilePath - * @property {string|null} [username] MySqlReplicaConfiguration username - * @property {string|null} [password] MySqlReplicaConfiguration password - * @property {google.protobuf.IInt32Value|null} [connectRetryInterval] MySqlReplicaConfiguration connectRetryInterval - * @property {google.protobuf.IInt64Value|null} [masterHeartbeatPeriod] MySqlReplicaConfiguration masterHeartbeatPeriod - * @property {string|null} [caCertificate] MySqlReplicaConfiguration caCertificate - * @property {string|null} [clientCertificate] MySqlReplicaConfiguration clientCertificate - * @property {string|null} [clientKey] MySqlReplicaConfiguration clientKey - * @property {string|null} [sslCipher] MySqlReplicaConfiguration sslCipher - * @property {google.protobuf.IBoolValue|null} [verifyServerCertificate] MySqlReplicaConfiguration verifyServerCertificate - * @property {string|null} [kind] MySqlReplicaConfiguration kind - */ - - /** - * Constructs a new MySqlReplicaConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a MySqlReplicaConfiguration. - * @implements IMySqlReplicaConfiguration - * @constructor - * @param {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration=} [properties] Properties to set - */ - function MySqlReplicaConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MySqlReplicaConfiguration dumpFilePath. - * @member {string} dumpFilePath - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.dumpFilePath = ""; - - /** - * MySqlReplicaConfiguration username. - * @member {string} username - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.username = ""; - - /** - * MySqlReplicaConfiguration password. - * @member {string} password - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.password = ""; - - /** - * MySqlReplicaConfiguration connectRetryInterval. - * @member {google.protobuf.IInt32Value|null|undefined} connectRetryInterval - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.connectRetryInterval = null; - - /** - * MySqlReplicaConfiguration masterHeartbeatPeriod. - * @member {google.protobuf.IInt64Value|null|undefined} masterHeartbeatPeriod - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.masterHeartbeatPeriod = null; - - /** - * MySqlReplicaConfiguration caCertificate. - * @member {string} caCertificate - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.caCertificate = ""; - - /** - * MySqlReplicaConfiguration clientCertificate. - * @member {string} clientCertificate - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.clientCertificate = ""; - - /** - * MySqlReplicaConfiguration clientKey. - * @member {string} clientKey - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.clientKey = ""; - - /** - * MySqlReplicaConfiguration sslCipher. - * @member {string} sslCipher - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.sslCipher = ""; - - /** - * MySqlReplicaConfiguration verifyServerCertificate. - * @member {google.protobuf.IBoolValue|null|undefined} verifyServerCertificate - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.verifyServerCertificate = null; - - /** - * MySqlReplicaConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - */ - MySqlReplicaConfiguration.prototype.kind = ""; - - /** - * Creates a new MySqlReplicaConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.MySqlReplicaConfiguration} MySqlReplicaConfiguration instance - */ - MySqlReplicaConfiguration.create = function create(properties) { - return new MySqlReplicaConfiguration(properties); - }; - - /** - * Encodes the specified MySqlReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration} message MySqlReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MySqlReplicaConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dumpFilePath != null && Object.hasOwnProperty.call(message, "dumpFilePath")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.dumpFilePath); - if (message.username != null && Object.hasOwnProperty.call(message, "username")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.username); - if (message.password != null && Object.hasOwnProperty.call(message, "password")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.password); - if (message.connectRetryInterval != null && Object.hasOwnProperty.call(message, "connectRetryInterval")) - $root.google.protobuf.Int32Value.encode(message.connectRetryInterval, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.masterHeartbeatPeriod != null && Object.hasOwnProperty.call(message, "masterHeartbeatPeriod")) - $root.google.protobuf.Int64Value.encode(message.masterHeartbeatPeriod, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.caCertificate); - if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.clientCertificate); - if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.clientKey); - if (message.sslCipher != null && Object.hasOwnProperty.call(message, "sslCipher")) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.sslCipher); - if (message.verifyServerCertificate != null && Object.hasOwnProperty.call(message, "verifyServerCertificate")) - $root.google.protobuf.BoolValue.encode(message.verifyServerCertificate, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.kind); - return writer; - }; - - /** - * Encodes the specified MySqlReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration} message MySqlReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MySqlReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.MySqlReplicaConfiguration} MySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MySqlReplicaConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.dumpFilePath = reader.string(); - break; - } - case 2: { - message.username = reader.string(); - break; - } - case 3: { - message.password = reader.string(); - break; - } - case 4: { - message.connectRetryInterval = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 5: { - message.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 6: { - message.caCertificate = reader.string(); - break; - } - case 7: { - message.clientCertificate = reader.string(); - break; - } - case 8: { - message.clientKey = reader.string(); - break; - } - case 9: { - message.sslCipher = reader.string(); - break; - } - case 10: { - message.verifyServerCertificate = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 11: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MySqlReplicaConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.MySqlReplicaConfiguration} MySqlReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MySqlReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MySqlReplicaConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MySqlReplicaConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) - if (!$util.isString(message.dumpFilePath)) - return "dumpFilePath: string expected"; - if (message.username != null && message.hasOwnProperty("username")) - if (!$util.isString(message.username)) - return "username: string expected"; - if (message.password != null && message.hasOwnProperty("password")) - if (!$util.isString(message.password)) - return "password: string expected"; - if (message.connectRetryInterval != null && message.hasOwnProperty("connectRetryInterval")) { - var error = $root.google.protobuf.Int32Value.verify(message.connectRetryInterval); - if (error) - return "connectRetryInterval." + error; - } - if (message.masterHeartbeatPeriod != null && message.hasOwnProperty("masterHeartbeatPeriod")) { - var error = $root.google.protobuf.Int64Value.verify(message.masterHeartbeatPeriod); - if (error) - return "masterHeartbeatPeriod." + error; - } - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - if (!$util.isString(message.caCertificate)) - return "caCertificate: string expected"; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - if (!$util.isString(message.clientCertificate)) - return "clientCertificate: string expected"; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - if (!$util.isString(message.clientKey)) - return "clientKey: string expected"; - if (message.sslCipher != null && message.hasOwnProperty("sslCipher")) - if (!$util.isString(message.sslCipher)) - return "sslCipher: string expected"; - if (message.verifyServerCertificate != null && message.hasOwnProperty("verifyServerCertificate")) { - var error = $root.google.protobuf.BoolValue.verify(message.verifyServerCertificate); - if (error) - return "verifyServerCertificate." + error; - } - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a MySqlReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.MySqlReplicaConfiguration} MySqlReplicaConfiguration - */ - MySqlReplicaConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration) - return object; - var message = new $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration(); - if (object.dumpFilePath != null) - message.dumpFilePath = String(object.dumpFilePath); - if (object.username != null) - message.username = String(object.username); - if (object.password != null) - message.password = String(object.password); - if (object.connectRetryInterval != null) { - if (typeof object.connectRetryInterval !== "object") - throw TypeError(".google.cloud.sql.v1beta4.MySqlReplicaConfiguration.connectRetryInterval: object expected"); - message.connectRetryInterval = $root.google.protobuf.Int32Value.fromObject(object.connectRetryInterval); - } - if (object.masterHeartbeatPeriod != null) { - if (typeof object.masterHeartbeatPeriod !== "object") - throw TypeError(".google.cloud.sql.v1beta4.MySqlReplicaConfiguration.masterHeartbeatPeriod: object expected"); - message.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.fromObject(object.masterHeartbeatPeriod); - } - if (object.caCertificate != null) - message.caCertificate = String(object.caCertificate); - if (object.clientCertificate != null) - message.clientCertificate = String(object.clientCertificate); - if (object.clientKey != null) - message.clientKey = String(object.clientKey); - if (object.sslCipher != null) - message.sslCipher = String(object.sslCipher); - if (object.verifyServerCertificate != null) { - if (typeof object.verifyServerCertificate !== "object") - throw TypeError(".google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verifyServerCertificate: object expected"); - message.verifyServerCertificate = $root.google.protobuf.BoolValue.fromObject(object.verifyServerCertificate); - } - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a MySqlReplicaConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.MySqlReplicaConfiguration} message MySqlReplicaConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MySqlReplicaConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.dumpFilePath = ""; - object.username = ""; - object.password = ""; - object.connectRetryInterval = null; - object.masterHeartbeatPeriod = null; - object.caCertificate = ""; - object.clientCertificate = ""; - object.clientKey = ""; - object.sslCipher = ""; - object.verifyServerCertificate = null; - object.kind = ""; - } - if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) - object.dumpFilePath = message.dumpFilePath; - if (message.username != null && message.hasOwnProperty("username")) - object.username = message.username; - if (message.password != null && message.hasOwnProperty("password")) - object.password = message.password; - if (message.connectRetryInterval != null && message.hasOwnProperty("connectRetryInterval")) - object.connectRetryInterval = $root.google.protobuf.Int32Value.toObject(message.connectRetryInterval, options); - if (message.masterHeartbeatPeriod != null && message.hasOwnProperty("masterHeartbeatPeriod")) - object.masterHeartbeatPeriod = $root.google.protobuf.Int64Value.toObject(message.masterHeartbeatPeriod, options); - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - object.caCertificate = message.caCertificate; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - object.clientCertificate = message.clientCertificate; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - object.clientKey = message.clientKey; - if (message.sslCipher != null && message.hasOwnProperty("sslCipher")) - object.sslCipher = message.sslCipher; - if (message.verifyServerCertificate != null && message.hasOwnProperty("verifyServerCertificate")) - object.verifyServerCertificate = $root.google.protobuf.BoolValue.toObject(message.verifyServerCertificate, options); - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this MySqlReplicaConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @instance - * @returns {Object.} JSON object - */ - MySqlReplicaConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MySqlReplicaConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.MySqlReplicaConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MySqlReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.MySqlReplicaConfiguration"; - }; - - return MySqlReplicaConfiguration; - })(); - - v1beta4.SelectedObjects = (function() { - - /** - * Properties of a SelectedObjects. - * @memberof google.cloud.sql.v1beta4 - * @interface ISelectedObjects - * @property {string|null} [database] SelectedObjects database - */ - - /** - * Constructs a new SelectedObjects. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SelectedObjects. - * @implements ISelectedObjects - * @constructor - * @param {google.cloud.sql.v1beta4.ISelectedObjects=} [properties] Properties to set - */ - function SelectedObjects(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SelectedObjects database. - * @member {string} database - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @instance - */ - SelectedObjects.prototype.database = ""; - - /** - * Creates a new SelectedObjects instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @static - * @param {google.cloud.sql.v1beta4.ISelectedObjects=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SelectedObjects} SelectedObjects instance - */ - SelectedObjects.create = function create(properties) { - return new SelectedObjects(properties); - }; - - /** - * Encodes the specified SelectedObjects message. Does not implicitly {@link google.cloud.sql.v1beta4.SelectedObjects.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @static - * @param {google.cloud.sql.v1beta4.ISelectedObjects} message SelectedObjects message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SelectedObjects.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.database != null && Object.hasOwnProperty.call(message, "database")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.database); - return writer; - }; - - /** - * Encodes the specified SelectedObjects message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SelectedObjects.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @static - * @param {google.cloud.sql.v1beta4.ISelectedObjects} message SelectedObjects message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SelectedObjects.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SelectedObjects message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SelectedObjects} SelectedObjects - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SelectedObjects.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SelectedObjects(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.database = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SelectedObjects message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SelectedObjects} SelectedObjects - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SelectedObjects.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SelectedObjects message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SelectedObjects.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.database != null && message.hasOwnProperty("database")) - if (!$util.isString(message.database)) - return "database: string expected"; - return null; - }; - - /** - * Creates a SelectedObjects message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SelectedObjects} SelectedObjects - */ - SelectedObjects.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SelectedObjects) - return object; - var message = new $root.google.cloud.sql.v1beta4.SelectedObjects(); - if (object.database != null) - message.database = String(object.database); - return message; - }; - - /** - * Creates a plain object from a SelectedObjects message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @static - * @param {google.cloud.sql.v1beta4.SelectedObjects} message SelectedObjects - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SelectedObjects.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.database = ""; - if (message.database != null && message.hasOwnProperty("database")) - object.database = message.database; - return object; - }; - - /** - * Converts this SelectedObjects to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @instance - * @returns {Object.} JSON object - */ - SelectedObjects.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SelectedObjects - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SelectedObjects - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SelectedObjects.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SelectedObjects"; - }; - - return SelectedObjects; - })(); - - v1beta4.OnPremisesConfiguration = (function() { - - /** - * Properties of an OnPremisesConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @interface IOnPremisesConfiguration - * @property {string|null} [hostPort] OnPremisesConfiguration hostPort - * @property {string|null} [kind] OnPremisesConfiguration kind - * @property {string|null} [username] OnPremisesConfiguration username - * @property {string|null} [password] OnPremisesConfiguration password - * @property {string|null} [caCertificate] OnPremisesConfiguration caCertificate - * @property {string|null} [clientCertificate] OnPremisesConfiguration clientCertificate - * @property {string|null} [clientKey] OnPremisesConfiguration clientKey - * @property {string|null} [dumpFilePath] OnPremisesConfiguration dumpFilePath - * @property {google.cloud.sql.v1beta4.IInstanceReference|null} [sourceInstance] OnPremisesConfiguration sourceInstance - * @property {Array.|null} [selectedObjects] OnPremisesConfiguration selectedObjects - * @property {google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption|null} [sslOption] OnPremisesConfiguration sslOption - */ - - /** - * Constructs a new OnPremisesConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an OnPremisesConfiguration. - * @implements IOnPremisesConfiguration - * @constructor - * @param {google.cloud.sql.v1beta4.IOnPremisesConfiguration=} [properties] Properties to set - */ - function OnPremisesConfiguration(properties) { - this.selectedObjects = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OnPremisesConfiguration hostPort. - * @member {string} hostPort - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.hostPort = ""; - - /** - * OnPremisesConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.kind = ""; - - /** - * OnPremisesConfiguration username. - * @member {string} username - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.username = ""; - - /** - * OnPremisesConfiguration password. - * @member {string} password - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.password = ""; - - /** - * OnPremisesConfiguration caCertificate. - * @member {string} caCertificate - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.caCertificate = ""; - - /** - * OnPremisesConfiguration clientCertificate. - * @member {string} clientCertificate - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.clientCertificate = ""; - - /** - * OnPremisesConfiguration clientKey. - * @member {string} clientKey - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.clientKey = ""; - - /** - * OnPremisesConfiguration dumpFilePath. - * @member {string} dumpFilePath - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.dumpFilePath = ""; - - /** - * OnPremisesConfiguration sourceInstance. - * @member {google.cloud.sql.v1beta4.IInstanceReference|null|undefined} sourceInstance - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.sourceInstance = null; - - /** - * OnPremisesConfiguration selectedObjects. - * @member {Array.} selectedObjects - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.selectedObjects = $util.emptyArray; - - /** - * OnPremisesConfiguration sslOption. - * @member {google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption} sslOption - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - */ - OnPremisesConfiguration.prototype.sslOption = 0; - - /** - * Creates a new OnPremisesConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IOnPremisesConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.OnPremisesConfiguration} OnPremisesConfiguration instance - */ - OnPremisesConfiguration.create = function create(properties) { - return new OnPremisesConfiguration(properties); - }; - - /** - * Encodes the specified OnPremisesConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.OnPremisesConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IOnPremisesConfiguration} message OnPremisesConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OnPremisesConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.hostPort != null && Object.hasOwnProperty.call(message, "hostPort")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.hostPort); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - if (message.username != null && Object.hasOwnProperty.call(message, "username")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.username); - if (message.password != null && Object.hasOwnProperty.call(message, "password")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.password); - if (message.caCertificate != null && Object.hasOwnProperty.call(message, "caCertificate")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.caCertificate); - if (message.clientCertificate != null && Object.hasOwnProperty.call(message, "clientCertificate")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.clientCertificate); - if (message.clientKey != null && Object.hasOwnProperty.call(message, "clientKey")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.clientKey); - if (message.dumpFilePath != null && Object.hasOwnProperty.call(message, "dumpFilePath")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.dumpFilePath); - if (message.sourceInstance != null && Object.hasOwnProperty.call(message, "sourceInstance")) - $root.google.cloud.sql.v1beta4.InstanceReference.encode(message.sourceInstance, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); - if (message.selectedObjects != null && message.selectedObjects.length) - for (var i = 0; i < message.selectedObjects.length; ++i) - $root.google.cloud.sql.v1beta4.SelectedObjects.encode(message.selectedObjects[i], writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - if (message.sslOption != null && Object.hasOwnProperty.call(message, "sslOption")) - writer.uint32(/* id 18, wireType 0 =*/144).int32(message.sslOption); - return writer; - }; - - /** - * Encodes the specified OnPremisesConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OnPremisesConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IOnPremisesConfiguration} message OnPremisesConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OnPremisesConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OnPremisesConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.OnPremisesConfiguration} OnPremisesConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OnPremisesConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.OnPremisesConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.hostPort = reader.string(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - case 3: { - message.username = reader.string(); - break; - } - case 4: { - message.password = reader.string(); - break; - } - case 5: { - message.caCertificate = reader.string(); - break; - } - case 6: { - message.clientCertificate = reader.string(); - break; - } - case 7: { - message.clientKey = reader.string(); - break; - } - case 8: { - message.dumpFilePath = reader.string(); - break; - } - case 15: { - message.sourceInstance = $root.google.cloud.sql.v1beta4.InstanceReference.decode(reader, reader.uint32()); - break; - } - case 16: { - if (!(message.selectedObjects && message.selectedObjects.length)) - message.selectedObjects = []; - message.selectedObjects.push($root.google.cloud.sql.v1beta4.SelectedObjects.decode(reader, reader.uint32())); - break; - } - case 18: { - message.sslOption = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OnPremisesConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.OnPremisesConfiguration} OnPremisesConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OnPremisesConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OnPremisesConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OnPremisesConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.hostPort != null && message.hasOwnProperty("hostPort")) - if (!$util.isString(message.hostPort)) - return "hostPort: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.username != null && message.hasOwnProperty("username")) - if (!$util.isString(message.username)) - return "username: string expected"; - if (message.password != null && message.hasOwnProperty("password")) - if (!$util.isString(message.password)) - return "password: string expected"; - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - if (!$util.isString(message.caCertificate)) - return "caCertificate: string expected"; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - if (!$util.isString(message.clientCertificate)) - return "clientCertificate: string expected"; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - if (!$util.isString(message.clientKey)) - return "clientKey: string expected"; - if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) - if (!$util.isString(message.dumpFilePath)) - return "dumpFilePath: string expected"; - if (message.sourceInstance != null && message.hasOwnProperty("sourceInstance")) { - var error = $root.google.cloud.sql.v1beta4.InstanceReference.verify(message.sourceInstance); - if (error) - return "sourceInstance." + error; - } - if (message.selectedObjects != null && message.hasOwnProperty("selectedObjects")) { - if (!Array.isArray(message.selectedObjects)) - return "selectedObjects: array expected"; - for (var i = 0; i < message.selectedObjects.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.SelectedObjects.verify(message.selectedObjects[i]); - if (error) - return "selectedObjects." + error; - } - } - if (message.sslOption != null && message.hasOwnProperty("sslOption")) - switch (message.sslOption) { - default: - return "sslOption: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - return null; - }; - - /** - * Creates an OnPremisesConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.OnPremisesConfiguration} OnPremisesConfiguration - */ - OnPremisesConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.OnPremisesConfiguration) - return object; - var message = new $root.google.cloud.sql.v1beta4.OnPremisesConfiguration(); - if (object.hostPort != null) - message.hostPort = String(object.hostPort); - if (object.kind != null) - message.kind = String(object.kind); - if (object.username != null) - message.username = String(object.username); - if (object.password != null) - message.password = String(object.password); - if (object.caCertificate != null) - message.caCertificate = String(object.caCertificate); - if (object.clientCertificate != null) - message.clientCertificate = String(object.clientCertificate); - if (object.clientKey != null) - message.clientKey = String(object.clientKey); - if (object.dumpFilePath != null) - message.dumpFilePath = String(object.dumpFilePath); - if (object.sourceInstance != null) { - if (typeof object.sourceInstance !== "object") - throw TypeError(".google.cloud.sql.v1beta4.OnPremisesConfiguration.sourceInstance: object expected"); - message.sourceInstance = $root.google.cloud.sql.v1beta4.InstanceReference.fromObject(object.sourceInstance); - } - if (object.selectedObjects) { - if (!Array.isArray(object.selectedObjects)) - throw TypeError(".google.cloud.sql.v1beta4.OnPremisesConfiguration.selectedObjects: array expected"); - message.selectedObjects = []; - for (var i = 0; i < object.selectedObjects.length; ++i) { - if (typeof object.selectedObjects[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.OnPremisesConfiguration.selectedObjects: object expected"); - message.selectedObjects[i] = $root.google.cloud.sql.v1beta4.SelectedObjects.fromObject(object.selectedObjects[i]); - } - } - switch (object.sslOption) { - default: - if (typeof object.sslOption === "number") { - message.sslOption = object.sslOption; - break; - } - break; - case "SSL_OPTION_UNSPECIFIED": - case 0: - message.sslOption = 0; - break; - case "DISABLE": - case 1: - message.sslOption = 1; - break; - case "REQUIRE": - case 2: - message.sslOption = 2; - break; - case "VERIFY_CA": - case 3: - message.sslOption = 3; - break; - } - return message; - }; - - /** - * Creates a plain object from an OnPremisesConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @static - * @param {google.cloud.sql.v1beta4.OnPremisesConfiguration} message OnPremisesConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OnPremisesConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.selectedObjects = []; - if (options.defaults) { - object.hostPort = ""; - object.kind = ""; - object.username = ""; - object.password = ""; - object.caCertificate = ""; - object.clientCertificate = ""; - object.clientKey = ""; - object.dumpFilePath = ""; - object.sourceInstance = null; - object.sslOption = options.enums === String ? "SSL_OPTION_UNSPECIFIED" : 0; - } - if (message.hostPort != null && message.hasOwnProperty("hostPort")) - object.hostPort = message.hostPort; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.username != null && message.hasOwnProperty("username")) - object.username = message.username; - if (message.password != null && message.hasOwnProperty("password")) - object.password = message.password; - if (message.caCertificate != null && message.hasOwnProperty("caCertificate")) - object.caCertificate = message.caCertificate; - if (message.clientCertificate != null && message.hasOwnProperty("clientCertificate")) - object.clientCertificate = message.clientCertificate; - if (message.clientKey != null && message.hasOwnProperty("clientKey")) - object.clientKey = message.clientKey; - if (message.dumpFilePath != null && message.hasOwnProperty("dumpFilePath")) - object.dumpFilePath = message.dumpFilePath; - if (message.sourceInstance != null && message.hasOwnProperty("sourceInstance")) - object.sourceInstance = $root.google.cloud.sql.v1beta4.InstanceReference.toObject(message.sourceInstance, options); - if (message.selectedObjects && message.selectedObjects.length) { - object.selectedObjects = []; - for (var j = 0; j < message.selectedObjects.length; ++j) - object.selectedObjects[j] = $root.google.cloud.sql.v1beta4.SelectedObjects.toObject(message.selectedObjects[j], options); - } - if (message.sslOption != null && message.hasOwnProperty("sslOption")) - object.sslOption = options.enums === String ? $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption[message.sslOption] === undefined ? message.sslOption : $root.google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption[message.sslOption] : message.sslOption; - return object; - }; - - /** - * Converts this OnPremisesConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @instance - * @returns {Object.} JSON object - */ - OnPremisesConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OnPremisesConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.OnPremisesConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OnPremisesConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.OnPremisesConfiguration"; - }; - - /** - * SslOption enum. - * @name google.cloud.sql.v1beta4.OnPremisesConfiguration.SslOption - * @enum {number} - * @property {number} SSL_OPTION_UNSPECIFIED=0 SSL_OPTION_UNSPECIFIED value - * @property {number} DISABLE=1 DISABLE value - * @property {number} REQUIRE=2 REQUIRE value - * @property {number} VERIFY_CA=3 VERIFY_CA value - */ - OnPremisesConfiguration.SslOption = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SSL_OPTION_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISABLE"] = 1; - values[valuesById[2] = "REQUIRE"] = 2; - values[valuesById[3] = "VERIFY_CA"] = 3; - return values; - })(); - - return OnPremisesConfiguration; - })(); - - v1beta4.DiskEncryptionConfiguration = (function() { - - /** - * Properties of a DiskEncryptionConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @interface IDiskEncryptionConfiguration - * @property {string|null} [kmsKeyName] DiskEncryptionConfiguration kmsKeyName - * @property {string|null} [kind] DiskEncryptionConfiguration kind - */ - - /** - * Constructs a new DiskEncryptionConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DiskEncryptionConfiguration. - * @implements IDiskEncryptionConfiguration - * @constructor - * @param {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration=} [properties] Properties to set - */ - function DiskEncryptionConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DiskEncryptionConfiguration kmsKeyName. - * @member {string} kmsKeyName - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @instance - */ - DiskEncryptionConfiguration.prototype.kmsKeyName = ""; - - /** - * DiskEncryptionConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @instance - */ - DiskEncryptionConfiguration.prototype.kind = ""; - - /** - * Creates a new DiskEncryptionConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DiskEncryptionConfiguration} DiskEncryptionConfiguration instance - */ - DiskEncryptionConfiguration.create = function create(properties) { - return new DiskEncryptionConfiguration(properties); - }; - - /** - * Encodes the specified DiskEncryptionConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration} message DiskEncryptionConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DiskEncryptionConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kmsKeyName); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - return writer; - }; - - /** - * Encodes the specified DiskEncryptionConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IDiskEncryptionConfiguration} message DiskEncryptionConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DiskEncryptionConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DiskEncryptionConfiguration} DiskEncryptionConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DiskEncryptionConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kmsKeyName = reader.string(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DiskEncryptionConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DiskEncryptionConfiguration} DiskEncryptionConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DiskEncryptionConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DiskEncryptionConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DiskEncryptionConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) - if (!$util.isString(message.kmsKeyName)) - return "kmsKeyName: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a DiskEncryptionConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DiskEncryptionConfiguration} DiskEncryptionConfiguration - */ - DiskEncryptionConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration) - return object; - var message = new $root.google.cloud.sql.v1beta4.DiskEncryptionConfiguration(); - if (object.kmsKeyName != null) - message.kmsKeyName = String(object.kmsKeyName); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a DiskEncryptionConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @static - * @param {google.cloud.sql.v1beta4.DiskEncryptionConfiguration} message DiskEncryptionConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DiskEncryptionConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kmsKeyName = ""; - object.kind = ""; - } - if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) - object.kmsKeyName = message.kmsKeyName; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this DiskEncryptionConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @instance - * @returns {Object.} JSON object - */ - DiskEncryptionConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DiskEncryptionConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DiskEncryptionConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DiskEncryptionConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DiskEncryptionConfiguration"; - }; - - return DiskEncryptionConfiguration; - })(); - - v1beta4.DiskEncryptionStatus = (function() { - - /** - * Properties of a DiskEncryptionStatus. - * @memberof google.cloud.sql.v1beta4 - * @interface IDiskEncryptionStatus - * @property {string|null} [kmsKeyVersionName] DiskEncryptionStatus kmsKeyVersionName - * @property {string|null} [kind] DiskEncryptionStatus kind - */ - - /** - * Constructs a new DiskEncryptionStatus. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DiskEncryptionStatus. - * @implements IDiskEncryptionStatus - * @constructor - * @param {google.cloud.sql.v1beta4.IDiskEncryptionStatus=} [properties] Properties to set - */ - function DiskEncryptionStatus(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DiskEncryptionStatus kmsKeyVersionName. - * @member {string} kmsKeyVersionName - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @instance - */ - DiskEncryptionStatus.prototype.kmsKeyVersionName = ""; - - /** - * DiskEncryptionStatus kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @instance - */ - DiskEncryptionStatus.prototype.kind = ""; - - /** - * Creates a new DiskEncryptionStatus instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @static - * @param {google.cloud.sql.v1beta4.IDiskEncryptionStatus=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DiskEncryptionStatus} DiskEncryptionStatus instance - */ - DiskEncryptionStatus.create = function create(properties) { - return new DiskEncryptionStatus(properties); - }; - - /** - * Encodes the specified DiskEncryptionStatus message. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionStatus.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @static - * @param {google.cloud.sql.v1beta4.IDiskEncryptionStatus} message DiskEncryptionStatus message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DiskEncryptionStatus.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kmsKeyVersionName != null && Object.hasOwnProperty.call(message, "kmsKeyVersionName")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kmsKeyVersionName); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.kind); - return writer; - }; - - /** - * Encodes the specified DiskEncryptionStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DiskEncryptionStatus.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @static - * @param {google.cloud.sql.v1beta4.IDiskEncryptionStatus} message DiskEncryptionStatus message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DiskEncryptionStatus.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DiskEncryptionStatus message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DiskEncryptionStatus} DiskEncryptionStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DiskEncryptionStatus.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DiskEncryptionStatus(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kmsKeyVersionName = reader.string(); - break; - } - case 2: { - message.kind = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DiskEncryptionStatus message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DiskEncryptionStatus} DiskEncryptionStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DiskEncryptionStatus.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DiskEncryptionStatus message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DiskEncryptionStatus.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) - if (!$util.isString(message.kmsKeyVersionName)) - return "kmsKeyVersionName: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - return null; - }; - - /** - * Creates a DiskEncryptionStatus message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DiskEncryptionStatus} DiskEncryptionStatus - */ - DiskEncryptionStatus.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DiskEncryptionStatus) - return object; - var message = new $root.google.cloud.sql.v1beta4.DiskEncryptionStatus(); - if (object.kmsKeyVersionName != null) - message.kmsKeyVersionName = String(object.kmsKeyVersionName); - if (object.kind != null) - message.kind = String(object.kind); - return message; - }; - - /** - * Creates a plain object from a DiskEncryptionStatus message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @static - * @param {google.cloud.sql.v1beta4.DiskEncryptionStatus} message DiskEncryptionStatus - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DiskEncryptionStatus.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kmsKeyVersionName = ""; - object.kind = ""; - } - if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) - object.kmsKeyVersionName = message.kmsKeyVersionName; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - return object; - }; - - /** - * Converts this DiskEncryptionStatus to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @instance - * @returns {Object.} JSON object - */ - DiskEncryptionStatus.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DiskEncryptionStatus - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DiskEncryptionStatus - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DiskEncryptionStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DiskEncryptionStatus"; - }; - - return DiskEncryptionStatus; - })(); - - /** - * SqlMaintenanceType enum. - * @name google.cloud.sql.v1beta4.SqlMaintenanceType - * @enum {number} - * @property {number} SQL_MAINTENANCE_TYPE_UNSPECIFIED=0 SQL_MAINTENANCE_TYPE_UNSPECIFIED value - * @property {number} INSTANCE_MAINTENANCE=1 INSTANCE_MAINTENANCE value - * @property {number} REPLICA_INCLUDED_MAINTENANCE=2 REPLICA_INCLUDED_MAINTENANCE value - * @property {number} INSTANCE_SELF_SERVICE_MAINTENANCE=3 INSTANCE_SELF_SERVICE_MAINTENANCE value - * @property {number} REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE=4 REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE value - */ - v1beta4.SqlMaintenanceType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_MAINTENANCE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "INSTANCE_MAINTENANCE"] = 1; - values[valuesById[2] = "REPLICA_INCLUDED_MAINTENANCE"] = 2; - values[valuesById[3] = "INSTANCE_SELF_SERVICE_MAINTENANCE"] = 3; - values[valuesById[4] = "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE"] = 4; - return values; - })(); - - v1beta4.SqlSubOperationType = (function() { - - /** - * Properties of a SqlSubOperationType. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlSubOperationType - * @property {google.cloud.sql.v1beta4.SqlMaintenanceType|null} [maintenanceType] SqlSubOperationType maintenanceType - */ - - /** - * Constructs a new SqlSubOperationType. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlSubOperationType. - * @implements ISqlSubOperationType - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlSubOperationType=} [properties] Properties to set - */ - function SqlSubOperationType(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlSubOperationType maintenanceType. - * @member {google.cloud.sql.v1beta4.SqlMaintenanceType|null|undefined} maintenanceType - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @instance - */ - SqlSubOperationType.prototype.maintenanceType = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * SqlSubOperationType subOperationDetails. - * @member {"maintenanceType"|undefined} subOperationDetails - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @instance - */ - Object.defineProperty(SqlSubOperationType.prototype, "subOperationDetails", { - get: $util.oneOfGetter($oneOfFields = ["maintenanceType"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlSubOperationType instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @static - * @param {google.cloud.sql.v1beta4.ISqlSubOperationType=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlSubOperationType} SqlSubOperationType instance - */ - SqlSubOperationType.create = function create(properties) { - return new SqlSubOperationType(properties); - }; - - /** - * Encodes the specified SqlSubOperationType message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSubOperationType.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @static - * @param {google.cloud.sql.v1beta4.ISqlSubOperationType} message SqlSubOperationType message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSubOperationType.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.maintenanceType != null && Object.hasOwnProperty.call(message, "maintenanceType")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.maintenanceType); - return writer; - }; - - /** - * Encodes the specified SqlSubOperationType message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlSubOperationType.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @static - * @param {google.cloud.sql.v1beta4.ISqlSubOperationType} message SqlSubOperationType message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlSubOperationType.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlSubOperationType message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlSubOperationType} SqlSubOperationType - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSubOperationType.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlSubOperationType(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.maintenanceType = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlSubOperationType message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlSubOperationType} SqlSubOperationType - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlSubOperationType.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlSubOperationType message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlSubOperationType.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.maintenanceType != null && message.hasOwnProperty("maintenanceType")) { - properties.subOperationDetails = 1; - switch (message.maintenanceType) { - default: - return "maintenanceType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - } - return null; - }; - - /** - * Creates a SqlSubOperationType message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlSubOperationType} SqlSubOperationType - */ - SqlSubOperationType.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlSubOperationType) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlSubOperationType(); - switch (object.maintenanceType) { - default: - if (typeof object.maintenanceType === "number") { - message.maintenanceType = object.maintenanceType; - break; - } - break; - case "SQL_MAINTENANCE_TYPE_UNSPECIFIED": - case 0: - message.maintenanceType = 0; - break; - case "INSTANCE_MAINTENANCE": - case 1: - message.maintenanceType = 1; - break; - case "REPLICA_INCLUDED_MAINTENANCE": - case 2: - message.maintenanceType = 2; - break; - case "INSTANCE_SELF_SERVICE_MAINTENANCE": - case 3: - message.maintenanceType = 3; - break; - case "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE": - case 4: - message.maintenanceType = 4; - break; - } - return message; - }; - - /** - * Creates a plain object from a SqlSubOperationType message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @static - * @param {google.cloud.sql.v1beta4.SqlSubOperationType} message SqlSubOperationType - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlSubOperationType.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.maintenanceType != null && message.hasOwnProperty("maintenanceType")) { - object.maintenanceType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlMaintenanceType[message.maintenanceType] === undefined ? message.maintenanceType : $root.google.cloud.sql.v1beta4.SqlMaintenanceType[message.maintenanceType] : message.maintenanceType; - if (options.oneofs) - object.subOperationDetails = "maintenanceType"; - } - return object; - }; - - /** - * Converts this SqlSubOperationType to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @instance - * @returns {Object.} JSON object - */ - SqlSubOperationType.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlSubOperationType - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlSubOperationType - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlSubOperationType.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlSubOperationType"; - }; - - return SqlSubOperationType; - })(); - - v1beta4.Operation = (function() { - - /** - * Properties of an Operation. - * @memberof google.cloud.sql.v1beta4 - * @interface IOperation - * @property {string|null} [kind] Operation kind - * @property {string|null} [targetLink] Operation targetLink - * @property {google.cloud.sql.v1beta4.Operation.SqlOperationStatus|null} [status] Operation status - * @property {string|null} [user] Operation user - * @property {google.protobuf.ITimestamp|null} [insertTime] Operation insertTime - * @property {google.protobuf.ITimestamp|null} [startTime] Operation startTime - * @property {google.protobuf.ITimestamp|null} [endTime] Operation endTime - * @property {google.cloud.sql.v1beta4.IOperationErrors|null} [error] Operation error - * @property {google.cloud.sql.v1beta4.IApiWarning|null} [apiWarning] Operation apiWarning - * @property {google.cloud.sql.v1beta4.Operation.SqlOperationType|null} [operationType] Operation operationType - * @property {google.cloud.sql.v1beta4.IImportContext|null} [importContext] Operation importContext - * @property {google.cloud.sql.v1beta4.IExportContext|null} [exportContext] Operation exportContext - * @property {google.cloud.sql.v1beta4.IBackupContext|null} [backupContext] Operation backupContext - * @property {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null} [preCheckMajorVersionUpgradeContext] Operation preCheckMajorVersionUpgradeContext - * @property {string|null} [name] Operation name - * @property {string|null} [targetId] Operation targetId - * @property {string|null} [selfLink] Operation selfLink - * @property {string|null} [targetProject] Operation targetProject - * @property {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null} [acquireSsrsLeaseContext] Operation acquireSsrsLeaseContext - * @property {google.cloud.sql.v1beta4.ISqlSubOperationType|null} [subOperationType] Operation subOperationType - */ - - /** - * Constructs a new Operation. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an Operation. - * @implements IOperation - * @constructor - * @param {google.cloud.sql.v1beta4.IOperation=} [properties] Properties to set - */ - function Operation(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Operation kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.kind = ""; - - /** - * Operation targetLink. - * @member {string} targetLink - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.targetLink = ""; - - /** - * Operation status. - * @member {google.cloud.sql.v1beta4.Operation.SqlOperationStatus} status - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.status = 0; - - /** - * Operation user. - * @member {string} user - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.user = ""; - - /** - * Operation insertTime. - * @member {google.protobuf.ITimestamp|null|undefined} insertTime - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.insertTime = null; - - /** - * Operation startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.startTime = null; - - /** - * Operation endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.endTime = null; - - /** - * Operation error. - * @member {google.cloud.sql.v1beta4.IOperationErrors|null|undefined} error - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.error = null; - - /** - * Operation apiWarning. - * @member {google.cloud.sql.v1beta4.IApiWarning|null|undefined} apiWarning - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.apiWarning = null; - - /** - * Operation operationType. - * @member {google.cloud.sql.v1beta4.Operation.SqlOperationType} operationType - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.operationType = 0; - - /** - * Operation importContext. - * @member {google.cloud.sql.v1beta4.IImportContext|null|undefined} importContext - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.importContext = null; - - /** - * Operation exportContext. - * @member {google.cloud.sql.v1beta4.IExportContext|null|undefined} exportContext - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.exportContext = null; - - /** - * Operation backupContext. - * @member {google.cloud.sql.v1beta4.IBackupContext|null|undefined} backupContext - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.backupContext = null; - - /** - * Operation preCheckMajorVersionUpgradeContext. - * @member {google.cloud.sql.v1beta4.IPreCheckMajorVersionUpgradeContext|null|undefined} preCheckMajorVersionUpgradeContext - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.preCheckMajorVersionUpgradeContext = null; - - /** - * Operation name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.name = ""; - - /** - * Operation targetId. - * @member {string} targetId - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.targetId = ""; - - /** - * Operation selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.selfLink = ""; - - /** - * Operation targetProject. - * @member {string} targetProject - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.targetProject = ""; - - /** - * Operation acquireSsrsLeaseContext. - * @member {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext|null|undefined} acquireSsrsLeaseContext - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.acquireSsrsLeaseContext = null; - - /** - * Operation subOperationType. - * @member {google.cloud.sql.v1beta4.ISqlSubOperationType|null|undefined} subOperationType - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - */ - Operation.prototype.subOperationType = null; - - /** - * Creates a new Operation instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.Operation - * @static - * @param {google.cloud.sql.v1beta4.IOperation=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.Operation} Operation instance - */ - Operation.create = function create(properties) { - return new Operation(properties); - }; - - /** - * Encodes the specified Operation message. Does not implicitly {@link google.cloud.sql.v1beta4.Operation.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.Operation - * @static - * @param {google.cloud.sql.v1beta4.IOperation} message Operation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Operation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.targetLink != null && Object.hasOwnProperty.call(message, "targetLink")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.targetLink); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.status); - if (message.user != null && Object.hasOwnProperty.call(message, "user")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.user); - if (message.insertTime != null && Object.hasOwnProperty.call(message, "insertTime")) - $root.google.protobuf.Timestamp.encode(message.insertTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.error != null && Object.hasOwnProperty.call(message, "error")) - $root.google.cloud.sql.v1beta4.OperationErrors.encode(message.error, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.operationType != null && Object.hasOwnProperty.call(message, "operationType")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.operationType); - if (message.importContext != null && Object.hasOwnProperty.call(message, "importContext")) - $root.google.cloud.sql.v1beta4.ImportContext.encode(message.importContext, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); - if (message.exportContext != null && Object.hasOwnProperty.call(message, "exportContext")) - $root.google.cloud.sql.v1beta4.ExportContext.encode(message.exportContext, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.name); - if (message.targetId != null && Object.hasOwnProperty.call(message, "targetId")) - writer.uint32(/* id 13, wireType 2 =*/106).string(message.targetId); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 14, wireType 2 =*/114).string(message.selfLink); - if (message.targetProject != null && Object.hasOwnProperty.call(message, "targetProject")) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.targetProject); - if (message.backupContext != null && Object.hasOwnProperty.call(message, "backupContext")) - $root.google.cloud.sql.v1beta4.BackupContext.encode(message.backupContext, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.apiWarning != null && Object.hasOwnProperty.call(message, "apiWarning")) - $root.google.cloud.sql.v1beta4.ApiWarning.encode(message.apiWarning, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); - if (message.acquireSsrsLeaseContext != null && Object.hasOwnProperty.call(message, "acquireSsrsLeaseContext")) - $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.encode(message.acquireSsrsLeaseContext, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.subOperationType != null && Object.hasOwnProperty.call(message, "subOperationType")) - $root.google.cloud.sql.v1beta4.SqlSubOperationType.encode(message.subOperationType, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); - if (message.preCheckMajorVersionUpgradeContext != null && Object.hasOwnProperty.call(message, "preCheckMajorVersionUpgradeContext")) - $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.encode(message.preCheckMajorVersionUpgradeContext, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Operation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.Operation - * @static - * @param {google.cloud.sql.v1beta4.IOperation} message Operation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Operation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Operation message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.Operation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.Operation} Operation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Operation.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Operation(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.targetLink = reader.string(); - break; - } - case 3: { - message.status = reader.int32(); - break; - } - case 4: { - message.user = reader.string(); - break; - } - case 5: { - message.insertTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 6: { - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 7: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 8: { - message.error = $root.google.cloud.sql.v1beta4.OperationErrors.decode(reader, reader.uint32()); - break; - } - case 19: { - message.apiWarning = $root.google.cloud.sql.v1beta4.ApiWarning.decode(reader, reader.uint32()); - break; - } - case 9: { - message.operationType = reader.int32(); - break; - } - case 10: { - message.importContext = $root.google.cloud.sql.v1beta4.ImportContext.decode(reader, reader.uint32()); - break; - } - case 11: { - message.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.decode(reader, reader.uint32()); - break; - } - case 17: { - message.backupContext = $root.google.cloud.sql.v1beta4.BackupContext.decode(reader, reader.uint32()); - break; - } - case 50: { - message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.decode(reader, reader.uint32()); - break; - } - case 12: { - message.name = reader.string(); - break; - } - case 13: { - message.targetId = reader.string(); - break; - } - case 14: { - message.selfLink = reader.string(); - break; - } - case 15: { - message.targetProject = reader.string(); - break; - } - case 20: { - message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.decode(reader, reader.uint32()); - break; - } - case 48: { - message.subOperationType = $root.google.cloud.sql.v1beta4.SqlSubOperationType.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Operation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.Operation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.Operation} Operation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Operation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Operation message. - * @function verify - * @memberof google.cloud.sql.v1beta4.Operation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Operation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.targetLink != null && message.hasOwnProperty("targetLink")) - if (!$util.isString(message.targetLink)) - return "targetLink: string expected"; - if (message.status != null && message.hasOwnProperty("status")) - switch (message.status) { - default: - return "status: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.user != null && message.hasOwnProperty("user")) - if (!$util.isString(message.user)) - return "user: string expected"; - if (message.insertTime != null && message.hasOwnProperty("insertTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.insertTime); - if (error) - return "insertTime." + error; - } - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - if (message.error != null && message.hasOwnProperty("error")) { - var error = $root.google.cloud.sql.v1beta4.OperationErrors.verify(message.error); - if (error) - return "error." + error; - } - if (message.apiWarning != null && message.hasOwnProperty("apiWarning")) { - var error = $root.google.cloud.sql.v1beta4.ApiWarning.verify(message.apiWarning); - if (error) - return "apiWarning." + error; - } - if (message.operationType != null && message.hasOwnProperty("operationType")) - switch (message.operationType) { - default: - return "operationType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - case 32: - case 33: - case 34: - case 35: - case 36: - case 37: - case 38: - case 39: - case 40: - case 42: - case 43: - case 44: - case 45: - case 46: - case 47: - case 48: - case 49: - case 50: - case 51: - case 52: - case 53: - break; - } - if (message.importContext != null && message.hasOwnProperty("importContext")) { - var error = $root.google.cloud.sql.v1beta4.ImportContext.verify(message.importContext); - if (error) - return "importContext." + error; - } - if (message.exportContext != null && message.hasOwnProperty("exportContext")) { - var error = $root.google.cloud.sql.v1beta4.ExportContext.verify(message.exportContext); - if (error) - return "exportContext." + error; - } - if (message.backupContext != null && message.hasOwnProperty("backupContext")) { - var error = $root.google.cloud.sql.v1beta4.BackupContext.verify(message.backupContext); - if (error) - return "backupContext." + error; - } - if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) { - var error = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.verify(message.preCheckMajorVersionUpgradeContext); - if (error) - return "preCheckMajorVersionUpgradeContext." + error; - } - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.targetId != null && message.hasOwnProperty("targetId")) - if (!$util.isString(message.targetId)) - return "targetId: string expected"; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - if (message.targetProject != null && message.hasOwnProperty("targetProject")) - if (!$util.isString(message.targetProject)) - return "targetProject: string expected"; - if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) { - var error = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify(message.acquireSsrsLeaseContext); - if (error) - return "acquireSsrsLeaseContext." + error; - } - if (message.subOperationType != null && message.hasOwnProperty("subOperationType")) { - var error = $root.google.cloud.sql.v1beta4.SqlSubOperationType.verify(message.subOperationType); - if (error) - return "subOperationType." + error; - } - return null; - }; - - /** - * Creates an Operation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.Operation - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.Operation} Operation - */ - Operation.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.Operation) - return object; - var message = new $root.google.cloud.sql.v1beta4.Operation(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.targetLink != null) - message.targetLink = String(object.targetLink); - switch (object.status) { - default: - if (typeof object.status === "number") { - message.status = object.status; - break; - } - break; - case "SQL_OPERATION_STATUS_UNSPECIFIED": - case 0: - message.status = 0; - break; - case "PENDING": - case 1: - message.status = 1; - break; - case "RUNNING": - case 2: - message.status = 2; - break; - case "DONE": - case 3: - message.status = 3; - break; - } - if (object.user != null) - message.user = String(object.user); - if (object.insertTime != null) { - if (typeof object.insertTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.insertTime: object expected"); - message.insertTime = $root.google.protobuf.Timestamp.fromObject(object.insertTime); - } - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - if (object.error != null) { - if (typeof object.error !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.error: object expected"); - message.error = $root.google.cloud.sql.v1beta4.OperationErrors.fromObject(object.error); - } - if (object.apiWarning != null) { - if (typeof object.apiWarning !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.apiWarning: object expected"); - message.apiWarning = $root.google.cloud.sql.v1beta4.ApiWarning.fromObject(object.apiWarning); - } - switch (object.operationType) { - default: - if (typeof object.operationType === "number") { - message.operationType = object.operationType; - break; - } - break; - case "SQL_OPERATION_TYPE_UNSPECIFIED": - case 0: - message.operationType = 0; - break; - case "IMPORT": - case 1: - message.operationType = 1; - break; - case "EXPORT": - case 2: - message.operationType = 2; - break; - case "CREATE": - case 3: - message.operationType = 3; - break; - case "UPDATE": - case 4: - message.operationType = 4; - break; - case "DELETE": - case 5: - message.operationType = 5; - break; - case "RESTART": - case 6: - message.operationType = 6; - break; - case "BACKUP": - case 7: - message.operationType = 7; - break; - case "SNAPSHOT": - case 8: - message.operationType = 8; - break; - case "BACKUP_VOLUME": - case 9: - message.operationType = 9; - break; - case "DELETE_VOLUME": - case 10: - message.operationType = 10; - break; - case "RESTORE_VOLUME": - case 11: - message.operationType = 11; - break; - case "INJECT_USER": - case 12: - message.operationType = 12; - break; - case "CLONE": - case 14: - message.operationType = 14; - break; - case "STOP_REPLICA": - case 15: - message.operationType = 15; - break; - case "START_REPLICA": - case 16: - message.operationType = 16; - break; - case "PROMOTE_REPLICA": - case 17: - message.operationType = 17; - break; - case "CREATE_REPLICA": - case 18: - message.operationType = 18; - break; - case "CREATE_USER": - case 19: - message.operationType = 19; - break; - case "DELETE_USER": - case 20: - message.operationType = 20; - break; - case "UPDATE_USER": - case 21: - message.operationType = 21; - break; - case "CREATE_DATABASE": - case 22: - message.operationType = 22; - break; - case "DELETE_DATABASE": - case 23: - message.operationType = 23; - break; - case "UPDATE_DATABASE": - case 24: - message.operationType = 24; - break; - case "FAILOVER": - case 25: - message.operationType = 25; - break; - case "DELETE_BACKUP": - case 26: - message.operationType = 26; - break; - case "RECREATE_REPLICA": - case 27: - message.operationType = 27; - break; - case "TRUNCATE_LOG": - case 28: - message.operationType = 28; - break; - case "DEMOTE_MASTER": - case 29: - message.operationType = 29; - break; - case "MAINTENANCE": - case 30: - message.operationType = 30; - break; - case "ENABLE_PRIVATE_IP": - case 31: - message.operationType = 31; - break; - case "DEFER_MAINTENANCE": - case 32: - message.operationType = 32; - break; - case "CREATE_CLONE": - case 33: - message.operationType = 33; - break; - case "RESCHEDULE_MAINTENANCE": - case 34: - message.operationType = 34; - break; - case "START_EXTERNAL_SYNC": - case 35: - message.operationType = 35; - break; - case "LOG_CLEANUP": - case 36: - message.operationType = 36; - break; - case "AUTO_RESTART": - case 37: - message.operationType = 37; - break; - case "REENCRYPT": - case 38: - message.operationType = 38; - break; - case "SWITCHOVER": - case 39: - message.operationType = 39; - break; - case "UPDATE_BACKUP": - case 40: - message.operationType = 40; - break; - case "ACQUIRE_SSRS_LEASE": - case 42: - message.operationType = 42; - break; - case "RELEASE_SSRS_LEASE": - case 43: - message.operationType = 43; - break; - case "RECONFIGURE_OLD_PRIMARY": - case 44: - message.operationType = 44; - break; - case "CLUSTER_MAINTENANCE": - case 45: - message.operationType = 45; - break; - case "SELF_SERVICE_MAINTENANCE": - case 46: - message.operationType = 46; - break; - case "SWITCHOVER_TO_REPLICA": - case 47: - message.operationType = 47; - break; - case "MAJOR_VERSION_UPGRADE": - case 48: - message.operationType = 48; - break; - case "ADVANCED_BACKUP": - case 49: - message.operationType = 49; - break; - case "MANAGE_BACKUP": - case 50: - message.operationType = 50; - break; - case "ENHANCED_BACKUP": - case 51: - message.operationType = 51; - break; - case "REPAIR_READ_POOL": - case 52: - message.operationType = 52; - break; - case "CREATE_READ_POOL": - case 53: - message.operationType = 53; - break; - } - if (object.importContext != null) { - if (typeof object.importContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.importContext: object expected"); - message.importContext = $root.google.cloud.sql.v1beta4.ImportContext.fromObject(object.importContext); - } - if (object.exportContext != null) { - if (typeof object.exportContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.exportContext: object expected"); - message.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.fromObject(object.exportContext); - } - if (object.backupContext != null) { - if (typeof object.backupContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.backupContext: object expected"); - message.backupContext = $root.google.cloud.sql.v1beta4.BackupContext.fromObject(object.backupContext); - } - if (object.preCheckMajorVersionUpgradeContext != null) { - if (typeof object.preCheckMajorVersionUpgradeContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.preCheckMajorVersionUpgradeContext: object expected"); - message.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.fromObject(object.preCheckMajorVersionUpgradeContext); - } - if (object.name != null) - message.name = String(object.name); - if (object.targetId != null) - message.targetId = String(object.targetId); - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - if (object.targetProject != null) - message.targetProject = String(object.targetProject); - if (object.acquireSsrsLeaseContext != null) { - if (typeof object.acquireSsrsLeaseContext !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.acquireSsrsLeaseContext: object expected"); - message.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.fromObject(object.acquireSsrsLeaseContext); - } - if (object.subOperationType != null) { - if (typeof object.subOperationType !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Operation.subOperationType: object expected"); - message.subOperationType = $root.google.cloud.sql.v1beta4.SqlSubOperationType.fromObject(object.subOperationType); - } - return message; - }; - - /** - * Creates a plain object from an Operation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.Operation - * @static - * @param {google.cloud.sql.v1beta4.Operation} message Operation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Operation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.targetLink = ""; - object.status = options.enums === String ? "SQL_OPERATION_STATUS_UNSPECIFIED" : 0; - object.user = ""; - object.insertTime = null; - object.startTime = null; - object.endTime = null; - object.error = null; - object.operationType = options.enums === String ? "SQL_OPERATION_TYPE_UNSPECIFIED" : 0; - object.importContext = null; - object.exportContext = null; - object.name = ""; - object.targetId = ""; - object.selfLink = ""; - object.targetProject = ""; - object.backupContext = null; - object.apiWarning = null; - object.acquireSsrsLeaseContext = null; - object.subOperationType = null; - object.preCheckMajorVersionUpgradeContext = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.targetLink != null && message.hasOwnProperty("targetLink")) - object.targetLink = message.targetLink; - if (message.status != null && message.hasOwnProperty("status")) - object.status = options.enums === String ? $root.google.cloud.sql.v1beta4.Operation.SqlOperationStatus[message.status] === undefined ? message.status : $root.google.cloud.sql.v1beta4.Operation.SqlOperationStatus[message.status] : message.status; - if (message.user != null && message.hasOwnProperty("user")) - object.user = message.user; - if (message.insertTime != null && message.hasOwnProperty("insertTime")) - object.insertTime = $root.google.protobuf.Timestamp.toObject(message.insertTime, options); - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - if (message.error != null && message.hasOwnProperty("error")) - object.error = $root.google.cloud.sql.v1beta4.OperationErrors.toObject(message.error, options); - if (message.operationType != null && message.hasOwnProperty("operationType")) - object.operationType = options.enums === String ? $root.google.cloud.sql.v1beta4.Operation.SqlOperationType[message.operationType] === undefined ? message.operationType : $root.google.cloud.sql.v1beta4.Operation.SqlOperationType[message.operationType] : message.operationType; - if (message.importContext != null && message.hasOwnProperty("importContext")) - object.importContext = $root.google.cloud.sql.v1beta4.ImportContext.toObject(message.importContext, options); - if (message.exportContext != null && message.hasOwnProperty("exportContext")) - object.exportContext = $root.google.cloud.sql.v1beta4.ExportContext.toObject(message.exportContext, options); - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.targetId != null && message.hasOwnProperty("targetId")) - object.targetId = message.targetId; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - if (message.targetProject != null && message.hasOwnProperty("targetProject")) - object.targetProject = message.targetProject; - if (message.backupContext != null && message.hasOwnProperty("backupContext")) - object.backupContext = $root.google.cloud.sql.v1beta4.BackupContext.toObject(message.backupContext, options); - if (message.apiWarning != null && message.hasOwnProperty("apiWarning")) - object.apiWarning = $root.google.cloud.sql.v1beta4.ApiWarning.toObject(message.apiWarning, options); - if (message.acquireSsrsLeaseContext != null && message.hasOwnProperty("acquireSsrsLeaseContext")) - object.acquireSsrsLeaseContext = $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.toObject(message.acquireSsrsLeaseContext, options); - if (message.subOperationType != null && message.hasOwnProperty("subOperationType")) - object.subOperationType = $root.google.cloud.sql.v1beta4.SqlSubOperationType.toObject(message.subOperationType, options); - if (message.preCheckMajorVersionUpgradeContext != null && message.hasOwnProperty("preCheckMajorVersionUpgradeContext")) - object.preCheckMajorVersionUpgradeContext = $root.google.cloud.sql.v1beta4.PreCheckMajorVersionUpgradeContext.toObject(message.preCheckMajorVersionUpgradeContext, options); - return object; - }; - - /** - * Converts this Operation to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.Operation - * @instance - * @returns {Object.} JSON object - */ - Operation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Operation - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.Operation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.Operation"; - }; - - /** - * SqlOperationType enum. - * @name google.cloud.sql.v1beta4.Operation.SqlOperationType - * @enum {number} - * @property {number} SQL_OPERATION_TYPE_UNSPECIFIED=0 SQL_OPERATION_TYPE_UNSPECIFIED value - * @property {number} IMPORT=1 IMPORT value - * @property {number} EXPORT=2 EXPORT value - * @property {number} CREATE=3 CREATE value - * @property {number} UPDATE=4 UPDATE value - * @property {number} DELETE=5 DELETE value - * @property {number} RESTART=6 RESTART value - * @property {number} BACKUP=7 BACKUP value - * @property {number} SNAPSHOT=8 SNAPSHOT value - * @property {number} BACKUP_VOLUME=9 BACKUP_VOLUME value - * @property {number} DELETE_VOLUME=10 DELETE_VOLUME value - * @property {number} RESTORE_VOLUME=11 RESTORE_VOLUME value - * @property {number} INJECT_USER=12 INJECT_USER value - * @property {number} CLONE=14 CLONE value - * @property {number} STOP_REPLICA=15 STOP_REPLICA value - * @property {number} START_REPLICA=16 START_REPLICA value - * @property {number} PROMOTE_REPLICA=17 PROMOTE_REPLICA value - * @property {number} CREATE_REPLICA=18 CREATE_REPLICA value - * @property {number} CREATE_USER=19 CREATE_USER value - * @property {number} DELETE_USER=20 DELETE_USER value - * @property {number} UPDATE_USER=21 UPDATE_USER value - * @property {number} CREATE_DATABASE=22 CREATE_DATABASE value - * @property {number} DELETE_DATABASE=23 DELETE_DATABASE value - * @property {number} UPDATE_DATABASE=24 UPDATE_DATABASE value - * @property {number} FAILOVER=25 FAILOVER value - * @property {number} DELETE_BACKUP=26 DELETE_BACKUP value - * @property {number} RECREATE_REPLICA=27 RECREATE_REPLICA value - * @property {number} TRUNCATE_LOG=28 TRUNCATE_LOG value - * @property {number} DEMOTE_MASTER=29 DEMOTE_MASTER value - * @property {number} MAINTENANCE=30 MAINTENANCE value - * @property {number} ENABLE_PRIVATE_IP=31 ENABLE_PRIVATE_IP value - * @property {number} DEFER_MAINTENANCE=32 DEFER_MAINTENANCE value - * @property {number} CREATE_CLONE=33 CREATE_CLONE value - * @property {number} RESCHEDULE_MAINTENANCE=34 RESCHEDULE_MAINTENANCE value - * @property {number} START_EXTERNAL_SYNC=35 START_EXTERNAL_SYNC value - * @property {number} LOG_CLEANUP=36 LOG_CLEANUP value - * @property {number} AUTO_RESTART=37 AUTO_RESTART value - * @property {number} REENCRYPT=38 REENCRYPT value - * @property {number} SWITCHOVER=39 SWITCHOVER value - * @property {number} UPDATE_BACKUP=40 UPDATE_BACKUP value - * @property {number} ACQUIRE_SSRS_LEASE=42 ACQUIRE_SSRS_LEASE value - * @property {number} RELEASE_SSRS_LEASE=43 RELEASE_SSRS_LEASE value - * @property {number} RECONFIGURE_OLD_PRIMARY=44 RECONFIGURE_OLD_PRIMARY value - * @property {number} CLUSTER_MAINTENANCE=45 CLUSTER_MAINTENANCE value - * @property {number} SELF_SERVICE_MAINTENANCE=46 SELF_SERVICE_MAINTENANCE value - * @property {number} SWITCHOVER_TO_REPLICA=47 SWITCHOVER_TO_REPLICA value - * @property {number} MAJOR_VERSION_UPGRADE=48 MAJOR_VERSION_UPGRADE value - * @property {number} ADVANCED_BACKUP=49 ADVANCED_BACKUP value - * @property {number} MANAGE_BACKUP=50 MANAGE_BACKUP value - * @property {number} ENHANCED_BACKUP=51 ENHANCED_BACKUP value - * @property {number} REPAIR_READ_POOL=52 REPAIR_READ_POOL value - * @property {number} CREATE_READ_POOL=53 CREATE_READ_POOL value - */ - Operation.SqlOperationType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_OPERATION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "IMPORT"] = 1; - values[valuesById[2] = "EXPORT"] = 2; - values[valuesById[3] = "CREATE"] = 3; - values[valuesById[4] = "UPDATE"] = 4; - values[valuesById[5] = "DELETE"] = 5; - values[valuesById[6] = "RESTART"] = 6; - values[valuesById[7] = "BACKUP"] = 7; - values[valuesById[8] = "SNAPSHOT"] = 8; - values[valuesById[9] = "BACKUP_VOLUME"] = 9; - values[valuesById[10] = "DELETE_VOLUME"] = 10; - values[valuesById[11] = "RESTORE_VOLUME"] = 11; - values[valuesById[12] = "INJECT_USER"] = 12; - values[valuesById[14] = "CLONE"] = 14; - values[valuesById[15] = "STOP_REPLICA"] = 15; - values[valuesById[16] = "START_REPLICA"] = 16; - values[valuesById[17] = "PROMOTE_REPLICA"] = 17; - values[valuesById[18] = "CREATE_REPLICA"] = 18; - values[valuesById[19] = "CREATE_USER"] = 19; - values[valuesById[20] = "DELETE_USER"] = 20; - values[valuesById[21] = "UPDATE_USER"] = 21; - values[valuesById[22] = "CREATE_DATABASE"] = 22; - values[valuesById[23] = "DELETE_DATABASE"] = 23; - values[valuesById[24] = "UPDATE_DATABASE"] = 24; - values[valuesById[25] = "FAILOVER"] = 25; - values[valuesById[26] = "DELETE_BACKUP"] = 26; - values[valuesById[27] = "RECREATE_REPLICA"] = 27; - values[valuesById[28] = "TRUNCATE_LOG"] = 28; - values[valuesById[29] = "DEMOTE_MASTER"] = 29; - values[valuesById[30] = "MAINTENANCE"] = 30; - values[valuesById[31] = "ENABLE_PRIVATE_IP"] = 31; - values[valuesById[32] = "DEFER_MAINTENANCE"] = 32; - values[valuesById[33] = "CREATE_CLONE"] = 33; - values[valuesById[34] = "RESCHEDULE_MAINTENANCE"] = 34; - values[valuesById[35] = "START_EXTERNAL_SYNC"] = 35; - values[valuesById[36] = "LOG_CLEANUP"] = 36; - values[valuesById[37] = "AUTO_RESTART"] = 37; - values[valuesById[38] = "REENCRYPT"] = 38; - values[valuesById[39] = "SWITCHOVER"] = 39; - values[valuesById[40] = "UPDATE_BACKUP"] = 40; - values[valuesById[42] = "ACQUIRE_SSRS_LEASE"] = 42; - values[valuesById[43] = "RELEASE_SSRS_LEASE"] = 43; - values[valuesById[44] = "RECONFIGURE_OLD_PRIMARY"] = 44; - values[valuesById[45] = "CLUSTER_MAINTENANCE"] = 45; - values[valuesById[46] = "SELF_SERVICE_MAINTENANCE"] = 46; - values[valuesById[47] = "SWITCHOVER_TO_REPLICA"] = 47; - values[valuesById[48] = "MAJOR_VERSION_UPGRADE"] = 48; - values[valuesById[49] = "ADVANCED_BACKUP"] = 49; - values[valuesById[50] = "MANAGE_BACKUP"] = 50; - values[valuesById[51] = "ENHANCED_BACKUP"] = 51; - values[valuesById[52] = "REPAIR_READ_POOL"] = 52; - values[valuesById[53] = "CREATE_READ_POOL"] = 53; - return values; - })(); - - /** - * SqlOperationStatus enum. - * @name google.cloud.sql.v1beta4.Operation.SqlOperationStatus - * @enum {number} - * @property {number} SQL_OPERATION_STATUS_UNSPECIFIED=0 SQL_OPERATION_STATUS_UNSPECIFIED value - * @property {number} PENDING=1 PENDING value - * @property {number} RUNNING=2 RUNNING value - * @property {number} DONE=3 DONE value - */ - Operation.SqlOperationStatus = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_OPERATION_STATUS_UNSPECIFIED"] = 0; - values[valuesById[1] = "PENDING"] = 1; - values[valuesById[2] = "RUNNING"] = 2; - values[valuesById[3] = "DONE"] = 3; - return values; - })(); - - return Operation; - })(); - - v1beta4.OperationError = (function() { - - /** - * Properties of an OperationError. - * @memberof google.cloud.sql.v1beta4 - * @interface IOperationError - * @property {string|null} [kind] OperationError kind - * @property {string|null} [code] OperationError code - * @property {string|null} [message] OperationError message - */ - - /** - * Constructs a new OperationError. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an OperationError. - * @implements IOperationError - * @constructor - * @param {google.cloud.sql.v1beta4.IOperationError=} [properties] Properties to set - */ - function OperationError(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OperationError kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.OperationError - * @instance - */ - OperationError.prototype.kind = ""; - - /** - * OperationError code. - * @member {string} code - * @memberof google.cloud.sql.v1beta4.OperationError - * @instance - */ - OperationError.prototype.code = ""; - - /** - * OperationError message. - * @member {string} message - * @memberof google.cloud.sql.v1beta4.OperationError - * @instance - */ - OperationError.prototype.message = ""; - - /** - * Creates a new OperationError instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.OperationError - * @static - * @param {google.cloud.sql.v1beta4.IOperationError=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.OperationError} OperationError instance - */ - OperationError.create = function create(properties) { - return new OperationError(properties); - }; - - /** - * Encodes the specified OperationError message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationError.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.OperationError - * @static - * @param {google.cloud.sql.v1beta4.IOperationError} message OperationError message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationError.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.code); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.message); - return writer; - }; - - /** - * Encodes the specified OperationError message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationError.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.OperationError - * @static - * @param {google.cloud.sql.v1beta4.IOperationError} message OperationError message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationError.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationError message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.OperationError - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.OperationError} OperationError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationError.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.OperationError(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.code = reader.string(); - break; - } - case 3: { - message.message = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationError message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.OperationError - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.OperationError} OperationError - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationError.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationError message. - * @function verify - * @memberof google.cloud.sql.v1beta4.OperationError - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OperationError.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.code != null && message.hasOwnProperty("code")) - if (!$util.isString(message.code)) - return "code: string expected"; - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - return null; - }; - - /** - * Creates an OperationError message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.OperationError - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.OperationError} OperationError - */ - OperationError.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.OperationError) - return object; - var message = new $root.google.cloud.sql.v1beta4.OperationError(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.code != null) - message.code = String(object.code); - if (object.message != null) - message.message = String(object.message); - return message; - }; - - /** - * Creates a plain object from an OperationError message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.OperationError - * @static - * @param {google.cloud.sql.v1beta4.OperationError} message OperationError - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationError.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.code = ""; - object.message = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.code != null && message.hasOwnProperty("code")) - object.code = message.code; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - return object; - }; - - /** - * Converts this OperationError to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.OperationError - * @instance - * @returns {Object.} JSON object - */ - OperationError.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationError - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.OperationError - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationError.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.OperationError"; - }; - - return OperationError; - })(); - - v1beta4.OperationErrors = (function() { - - /** - * Properties of an OperationErrors. - * @memberof google.cloud.sql.v1beta4 - * @interface IOperationErrors - * @property {string|null} [kind] OperationErrors kind - * @property {Array.|null} [errors] OperationErrors errors - */ - - /** - * Constructs a new OperationErrors. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an OperationErrors. - * @implements IOperationErrors - * @constructor - * @param {google.cloud.sql.v1beta4.IOperationErrors=} [properties] Properties to set - */ - function OperationErrors(properties) { - this.errors = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OperationErrors kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @instance - */ - OperationErrors.prototype.kind = ""; - - /** - * OperationErrors errors. - * @member {Array.} errors - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @instance - */ - OperationErrors.prototype.errors = $util.emptyArray; - - /** - * Creates a new OperationErrors instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @static - * @param {google.cloud.sql.v1beta4.IOperationErrors=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.OperationErrors} OperationErrors instance - */ - OperationErrors.create = function create(properties) { - return new OperationErrors(properties); - }; - - /** - * Encodes the specified OperationErrors message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationErrors.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @static - * @param {google.cloud.sql.v1beta4.IOperationErrors} message OperationErrors message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationErrors.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.errors != null && message.errors.length) - for (var i = 0; i < message.errors.length; ++i) - $root.google.cloud.sql.v1beta4.OperationError.encode(message.errors[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified OperationErrors message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationErrors.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @static - * @param {google.cloud.sql.v1beta4.IOperationErrors} message OperationErrors message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationErrors.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationErrors message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.OperationErrors} OperationErrors - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationErrors.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.OperationErrors(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.errors && message.errors.length)) - message.errors = []; - message.errors.push($root.google.cloud.sql.v1beta4.OperationError.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationErrors message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.OperationErrors} OperationErrors - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationErrors.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationErrors message. - * @function verify - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OperationErrors.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.errors != null && message.hasOwnProperty("errors")) { - if (!Array.isArray(message.errors)) - return "errors: array expected"; - for (var i = 0; i < message.errors.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.OperationError.verify(message.errors[i]); - if (error) - return "errors." + error; - } - } - return null; - }; - - /** - * Creates an OperationErrors message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.OperationErrors} OperationErrors - */ - OperationErrors.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.OperationErrors) - return object; - var message = new $root.google.cloud.sql.v1beta4.OperationErrors(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.errors) { - if (!Array.isArray(object.errors)) - throw TypeError(".google.cloud.sql.v1beta4.OperationErrors.errors: array expected"); - message.errors = []; - for (var i = 0; i < object.errors.length; ++i) { - if (typeof object.errors[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.OperationErrors.errors: object expected"); - message.errors[i] = $root.google.cloud.sql.v1beta4.OperationError.fromObject(object.errors[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an OperationErrors message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @static - * @param {google.cloud.sql.v1beta4.OperationErrors} message OperationErrors - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationErrors.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.errors = []; - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.errors && message.errors.length) { - object.errors = []; - for (var j = 0; j < message.errors.length; ++j) - object.errors[j] = $root.google.cloud.sql.v1beta4.OperationError.toObject(message.errors[j], options); - } - return object; - }; - - /** - * Converts this OperationErrors to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @instance - * @returns {Object.} JSON object - */ - OperationErrors.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationErrors - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.OperationErrors - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationErrors.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.OperationErrors"; - }; - - return OperationErrors; - })(); - - v1beta4.PasswordValidationPolicy = (function() { - - /** - * Properties of a PasswordValidationPolicy. - * @memberof google.cloud.sql.v1beta4 - * @interface IPasswordValidationPolicy - * @property {google.protobuf.IInt32Value|null} [minLength] PasswordValidationPolicy minLength - * @property {google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity|null} [complexity] PasswordValidationPolicy complexity - * @property {google.protobuf.IInt32Value|null} [reuseInterval] PasswordValidationPolicy reuseInterval - * @property {google.protobuf.IBoolValue|null} [disallowUsernameSubstring] PasswordValidationPolicy disallowUsernameSubstring - * @property {google.protobuf.IDuration|null} [passwordChangeInterval] PasswordValidationPolicy passwordChangeInterval - * @property {google.protobuf.IBoolValue|null} [enablePasswordPolicy] PasswordValidationPolicy enablePasswordPolicy - * @property {google.protobuf.IBoolValue|null} [disallowCompromisedCredentials] PasswordValidationPolicy disallowCompromisedCredentials - */ - - /** - * Constructs a new PasswordValidationPolicy. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a PasswordValidationPolicy. - * @implements IPasswordValidationPolicy - * @constructor - * @param {google.cloud.sql.v1beta4.IPasswordValidationPolicy=} [properties] Properties to set - */ - function PasswordValidationPolicy(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PasswordValidationPolicy minLength. - * @member {google.protobuf.IInt32Value|null|undefined} minLength - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.minLength = null; - - /** - * PasswordValidationPolicy complexity. - * @member {google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity} complexity - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.complexity = 0; - - /** - * PasswordValidationPolicy reuseInterval. - * @member {google.protobuf.IInt32Value|null|undefined} reuseInterval - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.reuseInterval = null; - - /** - * PasswordValidationPolicy disallowUsernameSubstring. - * @member {google.protobuf.IBoolValue|null|undefined} disallowUsernameSubstring - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.disallowUsernameSubstring = null; - - /** - * PasswordValidationPolicy passwordChangeInterval. - * @member {google.protobuf.IDuration|null|undefined} passwordChangeInterval - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.passwordChangeInterval = null; - - /** - * PasswordValidationPolicy enablePasswordPolicy. - * @member {google.protobuf.IBoolValue|null|undefined} enablePasswordPolicy - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.enablePasswordPolicy = null; - - /** - * PasswordValidationPolicy disallowCompromisedCredentials. - * @member {google.protobuf.IBoolValue|null|undefined} disallowCompromisedCredentials - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @instance - */ - PasswordValidationPolicy.prototype.disallowCompromisedCredentials = null; - - /** - * Creates a new PasswordValidationPolicy instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1beta4.IPasswordValidationPolicy=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.PasswordValidationPolicy} PasswordValidationPolicy instance - */ - PasswordValidationPolicy.create = function create(properties) { - return new PasswordValidationPolicy(properties); - }; - - /** - * Encodes the specified PasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordValidationPolicy.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1beta4.IPasswordValidationPolicy} message PasswordValidationPolicy message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PasswordValidationPolicy.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.minLength != null && Object.hasOwnProperty.call(message, "minLength")) - $root.google.protobuf.Int32Value.encode(message.minLength, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.complexity != null && Object.hasOwnProperty.call(message, "complexity")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.complexity); - if (message.reuseInterval != null && Object.hasOwnProperty.call(message, "reuseInterval")) - $root.google.protobuf.Int32Value.encode(message.reuseInterval, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.disallowUsernameSubstring != null && Object.hasOwnProperty.call(message, "disallowUsernameSubstring")) - $root.google.protobuf.BoolValue.encode(message.disallowUsernameSubstring, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.passwordChangeInterval != null && Object.hasOwnProperty.call(message, "passwordChangeInterval")) - $root.google.protobuf.Duration.encode(message.passwordChangeInterval, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.enablePasswordPolicy != null && Object.hasOwnProperty.call(message, "enablePasswordPolicy")) - $root.google.protobuf.BoolValue.encode(message.enablePasswordPolicy, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.disallowCompromisedCredentials != null && Object.hasOwnProperty.call(message, "disallowCompromisedCredentials")) - $root.google.protobuf.BoolValue.encode(message.disallowCompromisedCredentials, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordValidationPolicy.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1beta4.IPasswordValidationPolicy} message PasswordValidationPolicy message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PasswordValidationPolicy.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PasswordValidationPolicy message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.PasswordValidationPolicy} PasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PasswordValidationPolicy.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PasswordValidationPolicy(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.minLength = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 2: { - message.complexity = reader.int32(); - break; - } - case 3: { - message.reuseInterval = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 4: { - message.disallowUsernameSubstring = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 5: { - message.passwordChangeInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - case 6: { - message.enablePasswordPolicy = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 7: { - message.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PasswordValidationPolicy message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.PasswordValidationPolicy} PasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PasswordValidationPolicy.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PasswordValidationPolicy message. - * @function verify - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PasswordValidationPolicy.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.minLength != null && message.hasOwnProperty("minLength")) { - var error = $root.google.protobuf.Int32Value.verify(message.minLength); - if (error) - return "minLength." + error; - } - if (message.complexity != null && message.hasOwnProperty("complexity")) - switch (message.complexity) { - default: - return "complexity: enum value expected"; - case 0: - case 1: - break; - } - if (message.reuseInterval != null && message.hasOwnProperty("reuseInterval")) { - var error = $root.google.protobuf.Int32Value.verify(message.reuseInterval); - if (error) - return "reuseInterval." + error; - } - if (message.disallowUsernameSubstring != null && message.hasOwnProperty("disallowUsernameSubstring")) { - var error = $root.google.protobuf.BoolValue.verify(message.disallowUsernameSubstring); - if (error) - return "disallowUsernameSubstring." + error; - } - if (message.passwordChangeInterval != null && message.hasOwnProperty("passwordChangeInterval")) { - var error = $root.google.protobuf.Duration.verify(message.passwordChangeInterval); - if (error) - return "passwordChangeInterval." + error; - } - if (message.enablePasswordPolicy != null && message.hasOwnProperty("enablePasswordPolicy")) { - var error = $root.google.protobuf.BoolValue.verify(message.enablePasswordPolicy); - if (error) - return "enablePasswordPolicy." + error; - } - if (message.disallowCompromisedCredentials != null && message.hasOwnProperty("disallowCompromisedCredentials")) { - var error = $root.google.protobuf.BoolValue.verify(message.disallowCompromisedCredentials); - if (error) - return "disallowCompromisedCredentials." + error; - } - return null; - }; - - /** - * Creates a PasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.PasswordValidationPolicy} PasswordValidationPolicy - */ - PasswordValidationPolicy.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.PasswordValidationPolicy) - return object; - var message = new $root.google.cloud.sql.v1beta4.PasswordValidationPolicy(); - if (object.minLength != null) { - if (typeof object.minLength !== "object") - throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.minLength: object expected"); - message.minLength = $root.google.protobuf.Int32Value.fromObject(object.minLength); - } - switch (object.complexity) { - default: - if (typeof object.complexity === "number") { - message.complexity = object.complexity; - break; - } - break; - case "COMPLEXITY_UNSPECIFIED": - case 0: - message.complexity = 0; - break; - case "COMPLEXITY_DEFAULT": - case 1: - message.complexity = 1; - break; - } - if (object.reuseInterval != null) { - if (typeof object.reuseInterval !== "object") - throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.reuseInterval: object expected"); - message.reuseInterval = $root.google.protobuf.Int32Value.fromObject(object.reuseInterval); - } - if (object.disallowUsernameSubstring != null) { - if (typeof object.disallowUsernameSubstring !== "object") - throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.disallowUsernameSubstring: object expected"); - message.disallowUsernameSubstring = $root.google.protobuf.BoolValue.fromObject(object.disallowUsernameSubstring); - } - if (object.passwordChangeInterval != null) { - if (typeof object.passwordChangeInterval !== "object") - throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.passwordChangeInterval: object expected"); - message.passwordChangeInterval = $root.google.protobuf.Duration.fromObject(object.passwordChangeInterval); - } - if (object.enablePasswordPolicy != null) { - if (typeof object.enablePasswordPolicy !== "object") - throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.enablePasswordPolicy: object expected"); - message.enablePasswordPolicy = $root.google.protobuf.BoolValue.fromObject(object.enablePasswordPolicy); - } - if (object.disallowCompromisedCredentials != null) { - if (typeof object.disallowCompromisedCredentials !== "object") - throw TypeError(".google.cloud.sql.v1beta4.PasswordValidationPolicy.disallowCompromisedCredentials: object expected"); - message.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.fromObject(object.disallowCompromisedCredentials); - } - return message; - }; - - /** - * Creates a plain object from a PasswordValidationPolicy message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1beta4.PasswordValidationPolicy} message PasswordValidationPolicy - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PasswordValidationPolicy.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.minLength = null; - object.complexity = options.enums === String ? "COMPLEXITY_UNSPECIFIED" : 0; - object.reuseInterval = null; - object.disallowUsernameSubstring = null; - object.passwordChangeInterval = null; - object.enablePasswordPolicy = null; - object.disallowCompromisedCredentials = null; - } - if (message.minLength != null && message.hasOwnProperty("minLength")) - object.minLength = $root.google.protobuf.Int32Value.toObject(message.minLength, options); - if (message.complexity != null && message.hasOwnProperty("complexity")) - object.complexity = options.enums === String ? $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity[message.complexity] === undefined ? message.complexity : $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity[message.complexity] : message.complexity; - if (message.reuseInterval != null && message.hasOwnProperty("reuseInterval")) - object.reuseInterval = $root.google.protobuf.Int32Value.toObject(message.reuseInterval, options); - if (message.disallowUsernameSubstring != null && message.hasOwnProperty("disallowUsernameSubstring")) - object.disallowUsernameSubstring = $root.google.protobuf.BoolValue.toObject(message.disallowUsernameSubstring, options); - if (message.passwordChangeInterval != null && message.hasOwnProperty("passwordChangeInterval")) - object.passwordChangeInterval = $root.google.protobuf.Duration.toObject(message.passwordChangeInterval, options); - if (message.enablePasswordPolicy != null && message.hasOwnProperty("enablePasswordPolicy")) - object.enablePasswordPolicy = $root.google.protobuf.BoolValue.toObject(message.enablePasswordPolicy, options); - if (message.disallowCompromisedCredentials != null && message.hasOwnProperty("disallowCompromisedCredentials")) - object.disallowCompromisedCredentials = $root.google.protobuf.BoolValue.toObject(message.disallowCompromisedCredentials, options); - return object; - }; - - /** - * Converts this PasswordValidationPolicy to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @instance - * @returns {Object.} JSON object - */ - PasswordValidationPolicy.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PasswordValidationPolicy - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.PasswordValidationPolicy - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PasswordValidationPolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.PasswordValidationPolicy"; - }; - - /** - * Complexity enum. - * @name google.cloud.sql.v1beta4.PasswordValidationPolicy.Complexity - * @enum {number} - * @property {number} COMPLEXITY_UNSPECIFIED=0 COMPLEXITY_UNSPECIFIED value - * @property {number} COMPLEXITY_DEFAULT=1 COMPLEXITY_DEFAULT value - */ - PasswordValidationPolicy.Complexity = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "COMPLEXITY_UNSPECIFIED"] = 0; - values[valuesById[1] = "COMPLEXITY_DEFAULT"] = 1; - return values; - })(); - - return PasswordValidationPolicy; - })(); - - v1beta4.OperationsListResponse = (function() { - - /** - * Properties of an OperationsListResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IOperationsListResponse - * @property {string|null} [kind] OperationsListResponse kind - * @property {Array.|null} [items] OperationsListResponse items - * @property {string|null} [nextPageToken] OperationsListResponse nextPageToken - */ - - /** - * Constructs a new OperationsListResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an OperationsListResponse. - * @implements IOperationsListResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IOperationsListResponse=} [properties] Properties to set - */ - function OperationsListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OperationsListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @instance - */ - OperationsListResponse.prototype.kind = ""; - - /** - * OperationsListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @instance - */ - OperationsListResponse.prototype.items = $util.emptyArray; - - /** - * OperationsListResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @instance - */ - OperationsListResponse.prototype.nextPageToken = ""; - - /** - * Creates a new OperationsListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @static - * @param {google.cloud.sql.v1beta4.IOperationsListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.OperationsListResponse} OperationsListResponse instance - */ - OperationsListResponse.create = function create(properties) { - return new OperationsListResponse(properties); - }; - - /** - * Encodes the specified OperationsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.OperationsListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @static - * @param {google.cloud.sql.v1beta4.IOperationsListResponse} message OperationsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationsListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1beta4.Operation.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified OperationsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.OperationsListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @static - * @param {google.cloud.sql.v1beta4.IOperationsListResponse} message OperationsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OperationsListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OperationsListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.OperationsListResponse} OperationsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationsListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.OperationsListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1beta4.Operation.decode(reader, reader.uint32())); - break; - } - case 3: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OperationsListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.OperationsListResponse} OperationsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OperationsListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OperationsListResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OperationsListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.Operation.verify(message.items[i]); - if (error) - return "items." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates an OperationsListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.OperationsListResponse} OperationsListResponse - */ - OperationsListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.OperationsListResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.OperationsListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1beta4.OperationsListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.OperationsListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1beta4.Operation.fromObject(object.items[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from an OperationsListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @static - * @param {google.cloud.sql.v1beta4.OperationsListResponse} message OperationsListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OperationsListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) { - object.kind = ""; - object.nextPageToken = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1beta4.Operation.toObject(message.items[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this OperationsListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @instance - * @returns {Object.} JSON object - */ - OperationsListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OperationsListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.OperationsListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OperationsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.OperationsListResponse"; - }; - - return OperationsListResponse; - })(); - - v1beta4.ReplicaConfiguration = (function() { - - /** - * Properties of a ReplicaConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @interface IReplicaConfiguration - * @property {string|null} [kind] ReplicaConfiguration kind - * @property {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration|null} [mysqlReplicaConfiguration] ReplicaConfiguration mysqlReplicaConfiguration - * @property {google.protobuf.IBoolValue|null} [failoverTarget] ReplicaConfiguration failoverTarget - * @property {google.protobuf.IBoolValue|null} [cascadableReplica] ReplicaConfiguration cascadableReplica - */ - - /** - * Constructs a new ReplicaConfiguration. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a ReplicaConfiguration. - * @implements IReplicaConfiguration - * @constructor - * @param {google.cloud.sql.v1beta4.IReplicaConfiguration=} [properties] Properties to set - */ - function ReplicaConfiguration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReplicaConfiguration kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @instance - */ - ReplicaConfiguration.prototype.kind = ""; - - /** - * ReplicaConfiguration mysqlReplicaConfiguration. - * @member {google.cloud.sql.v1beta4.IMySqlReplicaConfiguration|null|undefined} mysqlReplicaConfiguration - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @instance - */ - ReplicaConfiguration.prototype.mysqlReplicaConfiguration = null; - - /** - * ReplicaConfiguration failoverTarget. - * @member {google.protobuf.IBoolValue|null|undefined} failoverTarget - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @instance - */ - ReplicaConfiguration.prototype.failoverTarget = null; - - /** - * ReplicaConfiguration cascadableReplica. - * @member {google.protobuf.IBoolValue|null|undefined} cascadableReplica - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @instance - */ - ReplicaConfiguration.prototype.cascadableReplica = null; - - /** - * Creates a new ReplicaConfiguration instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IReplicaConfiguration=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ReplicaConfiguration} ReplicaConfiguration instance - */ - ReplicaConfiguration.create = function create(properties) { - return new ReplicaConfiguration(properties); - }; - - /** - * Encodes the specified ReplicaConfiguration message. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicaConfiguration.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IReplicaConfiguration} message ReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReplicaConfiguration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.mysqlReplicaConfiguration != null && Object.hasOwnProperty.call(message, "mysqlReplicaConfiguration")) - $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration.encode(message.mysqlReplicaConfiguration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.failoverTarget != null && Object.hasOwnProperty.call(message, "failoverTarget")) - $root.google.protobuf.BoolValue.encode(message.failoverTarget, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.cascadableReplica != null && Object.hasOwnProperty.call(message, "cascadableReplica")) - $root.google.protobuf.BoolValue.encode(message.cascadableReplica, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ReplicaConfiguration message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReplicaConfiguration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.IReplicaConfiguration} message ReplicaConfiguration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReplicaConfiguration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReplicaConfiguration message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ReplicaConfiguration} ReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplicaConfiguration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ReplicaConfiguration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration.decode(reader, reader.uint32()); - break; - } - case 3: { - message.failoverTarget = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 5: { - message.cascadableReplica = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReplicaConfiguration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ReplicaConfiguration} ReplicaConfiguration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReplicaConfiguration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReplicaConfiguration message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReplicaConfiguration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) { - var error = $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration.verify(message.mysqlReplicaConfiguration); - if (error) - return "mysqlReplicaConfiguration." + error; - } - if (message.failoverTarget != null && message.hasOwnProperty("failoverTarget")) { - var error = $root.google.protobuf.BoolValue.verify(message.failoverTarget); - if (error) - return "failoverTarget." + error; - } - if (message.cascadableReplica != null && message.hasOwnProperty("cascadableReplica")) { - var error = $root.google.protobuf.BoolValue.verify(message.cascadableReplica); - if (error) - return "cascadableReplica." + error; - } - return null; - }; - - /** - * Creates a ReplicaConfiguration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ReplicaConfiguration} ReplicaConfiguration - */ - ReplicaConfiguration.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ReplicaConfiguration) - return object; - var message = new $root.google.cloud.sql.v1beta4.ReplicaConfiguration(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.mysqlReplicaConfiguration != null) { - if (typeof object.mysqlReplicaConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ReplicaConfiguration.mysqlReplicaConfiguration: object expected"); - message.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration.fromObject(object.mysqlReplicaConfiguration); - } - if (object.failoverTarget != null) { - if (typeof object.failoverTarget !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ReplicaConfiguration.failoverTarget: object expected"); - message.failoverTarget = $root.google.protobuf.BoolValue.fromObject(object.failoverTarget); - } - if (object.cascadableReplica != null) { - if (typeof object.cascadableReplica !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ReplicaConfiguration.cascadableReplica: object expected"); - message.cascadableReplica = $root.google.protobuf.BoolValue.fromObject(object.cascadableReplica); - } - return message; - }; - - /** - * Creates a plain object from a ReplicaConfiguration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @static - * @param {google.cloud.sql.v1beta4.ReplicaConfiguration} message ReplicaConfiguration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReplicaConfiguration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.mysqlReplicaConfiguration = null; - object.failoverTarget = null; - object.cascadableReplica = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.mysqlReplicaConfiguration != null && message.hasOwnProperty("mysqlReplicaConfiguration")) - object.mysqlReplicaConfiguration = $root.google.cloud.sql.v1beta4.MySqlReplicaConfiguration.toObject(message.mysqlReplicaConfiguration, options); - if (message.failoverTarget != null && message.hasOwnProperty("failoverTarget")) - object.failoverTarget = $root.google.protobuf.BoolValue.toObject(message.failoverTarget, options); - if (message.cascadableReplica != null && message.hasOwnProperty("cascadableReplica")) - object.cascadableReplica = $root.google.protobuf.BoolValue.toObject(message.cascadableReplica, options); - return object; - }; - - /** - * Converts this ReplicaConfiguration to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @instance - * @returns {Object.} JSON object - */ - ReplicaConfiguration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReplicaConfiguration - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ReplicaConfiguration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReplicaConfiguration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ReplicaConfiguration"; - }; - - return ReplicaConfiguration; - })(); - - v1beta4.RestoreBackupContext = (function() { - - /** - * Properties of a RestoreBackupContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IRestoreBackupContext - * @property {string|null} [kind] RestoreBackupContext kind - * @property {number|Long|null} [backupRunId] RestoreBackupContext backupRunId - * @property {string|null} [instanceId] RestoreBackupContext instanceId - * @property {string|null} [project] RestoreBackupContext project - */ - - /** - * Constructs a new RestoreBackupContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a RestoreBackupContext. - * @implements IRestoreBackupContext - * @constructor - * @param {google.cloud.sql.v1beta4.IRestoreBackupContext=} [properties] Properties to set - */ - function RestoreBackupContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RestoreBackupContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @instance - */ - RestoreBackupContext.prototype.kind = ""; - - /** - * RestoreBackupContext backupRunId. - * @member {number|Long} backupRunId - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @instance - */ - RestoreBackupContext.prototype.backupRunId = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * RestoreBackupContext instanceId. - * @member {string} instanceId - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @instance - */ - RestoreBackupContext.prototype.instanceId = ""; - - /** - * RestoreBackupContext project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @instance - */ - RestoreBackupContext.prototype.project = ""; - - /** - * Creates a new RestoreBackupContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @static - * @param {google.cloud.sql.v1beta4.IRestoreBackupContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.RestoreBackupContext} RestoreBackupContext instance - */ - RestoreBackupContext.create = function create(properties) { - return new RestoreBackupContext(properties); - }; - - /** - * Encodes the specified RestoreBackupContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RestoreBackupContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @static - * @param {google.cloud.sql.v1beta4.IRestoreBackupContext} message RestoreBackupContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RestoreBackupContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.backupRunId != null && Object.hasOwnProperty.call(message, "backupRunId")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.backupRunId); - if (message.instanceId != null && Object.hasOwnProperty.call(message, "instanceId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.instanceId); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - return writer; - }; - - /** - * Encodes the specified RestoreBackupContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RestoreBackupContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @static - * @param {google.cloud.sql.v1beta4.IRestoreBackupContext} message RestoreBackupContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RestoreBackupContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RestoreBackupContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.RestoreBackupContext} RestoreBackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RestoreBackupContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.RestoreBackupContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.backupRunId = reader.int64(); - break; - } - case 3: { - message.instanceId = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RestoreBackupContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.RestoreBackupContext} RestoreBackupContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RestoreBackupContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RestoreBackupContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RestoreBackupContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.backupRunId != null && message.hasOwnProperty("backupRunId")) - if (!$util.isInteger(message.backupRunId) && !(message.backupRunId && $util.isInteger(message.backupRunId.low) && $util.isInteger(message.backupRunId.high))) - return "backupRunId: integer|Long expected"; - if (message.instanceId != null && message.hasOwnProperty("instanceId")) - if (!$util.isString(message.instanceId)) - return "instanceId: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a RestoreBackupContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.RestoreBackupContext} RestoreBackupContext - */ - RestoreBackupContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.RestoreBackupContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.RestoreBackupContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.backupRunId != null) - if ($util.Long) - (message.backupRunId = $util.Long.fromValue(object.backupRunId)).unsigned = false; - else if (typeof object.backupRunId === "string") - message.backupRunId = parseInt(object.backupRunId, 10); - else if (typeof object.backupRunId === "number") - message.backupRunId = object.backupRunId; - else if (typeof object.backupRunId === "object") - message.backupRunId = new $util.LongBits(object.backupRunId.low >>> 0, object.backupRunId.high >>> 0).toNumber(); - if (object.instanceId != null) - message.instanceId = String(object.instanceId); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a RestoreBackupContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @static - * @param {google.cloud.sql.v1beta4.RestoreBackupContext} message RestoreBackupContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RestoreBackupContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.backupRunId = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.backupRunId = options.longs === String ? "0" : 0; - object.instanceId = ""; - object.project = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.backupRunId != null && message.hasOwnProperty("backupRunId")) - if (typeof message.backupRunId === "number") - object.backupRunId = options.longs === String ? String(message.backupRunId) : message.backupRunId; - else - object.backupRunId = options.longs === String ? $util.Long.prototype.toString.call(message.backupRunId) : options.longs === Number ? new $util.LongBits(message.backupRunId.low >>> 0, message.backupRunId.high >>> 0).toNumber() : message.backupRunId; - if (message.instanceId != null && message.hasOwnProperty("instanceId")) - object.instanceId = message.instanceId; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this RestoreBackupContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @instance - * @returns {Object.} JSON object - */ - RestoreBackupContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RestoreBackupContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.RestoreBackupContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RestoreBackupContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.RestoreBackupContext"; - }; - - return RestoreBackupContext; - })(); - - v1beta4.RotateServerCaContext = (function() { - - /** - * Properties of a RotateServerCaContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IRotateServerCaContext - * @property {string|null} [kind] RotateServerCaContext kind - * @property {string|null} [nextVersion] RotateServerCaContext nextVersion - */ - - /** - * Constructs a new RotateServerCaContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a RotateServerCaContext. - * @implements IRotateServerCaContext - * @constructor - * @param {google.cloud.sql.v1beta4.IRotateServerCaContext=} [properties] Properties to set - */ - function RotateServerCaContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RotateServerCaContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @instance - */ - RotateServerCaContext.prototype.kind = ""; - - /** - * RotateServerCaContext nextVersion. - * @member {string} nextVersion - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @instance - */ - RotateServerCaContext.prototype.nextVersion = ""; - - /** - * Creates a new RotateServerCaContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @static - * @param {google.cloud.sql.v1beta4.IRotateServerCaContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.RotateServerCaContext} RotateServerCaContext instance - */ - RotateServerCaContext.create = function create(properties) { - return new RotateServerCaContext(properties); - }; - - /** - * Encodes the specified RotateServerCaContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCaContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @static - * @param {google.cloud.sql.v1beta4.IRotateServerCaContext} message RotateServerCaContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateServerCaContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); - return writer; - }; - - /** - * Encodes the specified RotateServerCaContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCaContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @static - * @param {google.cloud.sql.v1beta4.IRotateServerCaContext} message RotateServerCaContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateServerCaContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RotateServerCaContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.RotateServerCaContext} RotateServerCaContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateServerCaContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.RotateServerCaContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.nextVersion = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RotateServerCaContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.RotateServerCaContext} RotateServerCaContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateServerCaContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RotateServerCaContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RotateServerCaContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - if (!$util.isString(message.nextVersion)) - return "nextVersion: string expected"; - return null; - }; - - /** - * Creates a RotateServerCaContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.RotateServerCaContext} RotateServerCaContext - */ - RotateServerCaContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.RotateServerCaContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.RotateServerCaContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.nextVersion != null) - message.nextVersion = String(object.nextVersion); - return message; - }; - - /** - * Creates a plain object from a RotateServerCaContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @static - * @param {google.cloud.sql.v1beta4.RotateServerCaContext} message RotateServerCaContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RotateServerCaContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.nextVersion = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - object.nextVersion = message.nextVersion; - return object; - }; - - /** - * Converts this RotateServerCaContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @instance - * @returns {Object.} JSON object - */ - RotateServerCaContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RotateServerCaContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.RotateServerCaContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RotateServerCaContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.RotateServerCaContext"; - }; - - return RotateServerCaContext; - })(); - - v1beta4.RotateServerCertificateContext = (function() { - - /** - * Properties of a RotateServerCertificateContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IRotateServerCertificateContext - * @property {string|null} [kind] RotateServerCertificateContext kind - * @property {string|null} [nextVersion] RotateServerCertificateContext nextVersion - */ - - /** - * Constructs a new RotateServerCertificateContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a RotateServerCertificateContext. - * @implements IRotateServerCertificateContext - * @constructor - * @param {google.cloud.sql.v1beta4.IRotateServerCertificateContext=} [properties] Properties to set - */ - function RotateServerCertificateContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RotateServerCertificateContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @instance - */ - RotateServerCertificateContext.prototype.kind = ""; - - /** - * RotateServerCertificateContext nextVersion. - * @member {string} nextVersion - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @instance - */ - RotateServerCertificateContext.prototype.nextVersion = ""; - - /** - * Creates a new RotateServerCertificateContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @static - * @param {google.cloud.sql.v1beta4.IRotateServerCertificateContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.RotateServerCertificateContext} RotateServerCertificateContext instance - */ - RotateServerCertificateContext.create = function create(properties) { - return new RotateServerCertificateContext(properties); - }; - - /** - * Encodes the specified RotateServerCertificateContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCertificateContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @static - * @param {google.cloud.sql.v1beta4.IRotateServerCertificateContext} message RotateServerCertificateContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateServerCertificateContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); - return writer; - }; - - /** - * Encodes the specified RotateServerCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateServerCertificateContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @static - * @param {google.cloud.sql.v1beta4.IRotateServerCertificateContext} message RotateServerCertificateContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateServerCertificateContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RotateServerCertificateContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.RotateServerCertificateContext} RotateServerCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateServerCertificateContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.RotateServerCertificateContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.nextVersion = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RotateServerCertificateContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.RotateServerCertificateContext} RotateServerCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateServerCertificateContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RotateServerCertificateContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RotateServerCertificateContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - if (!$util.isString(message.nextVersion)) - return "nextVersion: string expected"; - return null; - }; - - /** - * Creates a RotateServerCertificateContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.RotateServerCertificateContext} RotateServerCertificateContext - */ - RotateServerCertificateContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.RotateServerCertificateContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.RotateServerCertificateContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.nextVersion != null) - message.nextVersion = String(object.nextVersion); - return message; - }; - - /** - * Creates a plain object from a RotateServerCertificateContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @static - * @param {google.cloud.sql.v1beta4.RotateServerCertificateContext} message RotateServerCertificateContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RotateServerCertificateContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.nextVersion = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - object.nextVersion = message.nextVersion; - return object; - }; - - /** - * Converts this RotateServerCertificateContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @instance - * @returns {Object.} JSON object - */ - RotateServerCertificateContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RotateServerCertificateContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.RotateServerCertificateContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RotateServerCertificateContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.RotateServerCertificateContext"; - }; - - return RotateServerCertificateContext; - })(); - - v1beta4.RotateEntraIdCertificateContext = (function() { - - /** - * Properties of a RotateEntraIdCertificateContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IRotateEntraIdCertificateContext - * @property {string|null} [kind] RotateEntraIdCertificateContext kind - * @property {string|null} [nextVersion] RotateEntraIdCertificateContext nextVersion - */ - - /** - * Constructs a new RotateEntraIdCertificateContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a RotateEntraIdCertificateContext. - * @implements IRotateEntraIdCertificateContext - * @constructor - * @param {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext=} [properties] Properties to set - */ - function RotateEntraIdCertificateContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RotateEntraIdCertificateContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @instance - */ - RotateEntraIdCertificateContext.prototype.kind = ""; - - /** - * RotateEntraIdCertificateContext nextVersion. - * @member {string} nextVersion - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @instance - */ - RotateEntraIdCertificateContext.prototype.nextVersion = ""; - - /** - * Creates a new RotateEntraIdCertificateContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @static - * @param {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext instance - */ - RotateEntraIdCertificateContext.create = function create(properties) { - return new RotateEntraIdCertificateContext(properties); - }; - - /** - * Encodes the specified RotateEntraIdCertificateContext message. Does not implicitly {@link google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @static - * @param {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext} message RotateEntraIdCertificateContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateEntraIdCertificateContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.nextVersion != null && Object.hasOwnProperty.call(message, "nextVersion")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextVersion); - return writer; - }; - - /** - * Encodes the specified RotateEntraIdCertificateContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.RotateEntraIdCertificateContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @static - * @param {google.cloud.sql.v1beta4.IRotateEntraIdCertificateContext} message RotateEntraIdCertificateContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RotateEntraIdCertificateContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateEntraIdCertificateContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.nextVersion = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RotateEntraIdCertificateContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RotateEntraIdCertificateContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RotateEntraIdCertificateContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RotateEntraIdCertificateContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - if (!$util.isString(message.nextVersion)) - return "nextVersion: string expected"; - return null; - }; - - /** - * Creates a RotateEntraIdCertificateContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.RotateEntraIdCertificateContext} RotateEntraIdCertificateContext - */ - RotateEntraIdCertificateContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.RotateEntraIdCertificateContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.nextVersion != null) - message.nextVersion = String(object.nextVersion); - return message; - }; - - /** - * Creates a plain object from a RotateEntraIdCertificateContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @static - * @param {google.cloud.sql.v1beta4.RotateEntraIdCertificateContext} message RotateEntraIdCertificateContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RotateEntraIdCertificateContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.nextVersion = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.nextVersion != null && message.hasOwnProperty("nextVersion")) - object.nextVersion = message.nextVersion; - return object; - }; - - /** - * Converts this RotateEntraIdCertificateContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @instance - * @returns {Object.} JSON object - */ - RotateEntraIdCertificateContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RotateEntraIdCertificateContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.RotateEntraIdCertificateContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RotateEntraIdCertificateContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.RotateEntraIdCertificateContext"; - }; - - return RotateEntraIdCertificateContext; - })(); - - v1beta4.DataCacheConfig = (function() { - - /** - * Properties of a DataCacheConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IDataCacheConfig - * @property {boolean|null} [dataCacheEnabled] DataCacheConfig dataCacheEnabled - */ - - /** - * Constructs a new DataCacheConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a DataCacheConfig. - * @implements IDataCacheConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IDataCacheConfig=} [properties] Properties to set - */ - function DataCacheConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DataCacheConfig dataCacheEnabled. - * @member {boolean} dataCacheEnabled - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @instance - */ - DataCacheConfig.prototype.dataCacheEnabled = false; - - /** - * Creates a new DataCacheConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @static - * @param {google.cloud.sql.v1beta4.IDataCacheConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.DataCacheConfig} DataCacheConfig instance - */ - DataCacheConfig.create = function create(properties) { - return new DataCacheConfig(properties); - }; - - /** - * Encodes the specified DataCacheConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.DataCacheConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @static - * @param {google.cloud.sql.v1beta4.IDataCacheConfig} message DataCacheConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DataCacheConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.dataCacheEnabled != null && Object.hasOwnProperty.call(message, "dataCacheEnabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.dataCacheEnabled); - return writer; - }; - - /** - * Encodes the specified DataCacheConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.DataCacheConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @static - * @param {google.cloud.sql.v1beta4.IDataCacheConfig} message DataCacheConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DataCacheConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DataCacheConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.DataCacheConfig} DataCacheConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DataCacheConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.DataCacheConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.dataCacheEnabled = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DataCacheConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.DataCacheConfig} DataCacheConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DataCacheConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DataCacheConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DataCacheConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.dataCacheEnabled != null && message.hasOwnProperty("dataCacheEnabled")) - if (typeof message.dataCacheEnabled !== "boolean") - return "dataCacheEnabled: boolean expected"; - return null; - }; - - /** - * Creates a DataCacheConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.DataCacheConfig} DataCacheConfig - */ - DataCacheConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.DataCacheConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.DataCacheConfig(); - if (object.dataCacheEnabled != null) - message.dataCacheEnabled = Boolean(object.dataCacheEnabled); - return message; - }; - - /** - * Creates a plain object from a DataCacheConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @static - * @param {google.cloud.sql.v1beta4.DataCacheConfig} message DataCacheConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DataCacheConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.dataCacheEnabled = false; - if (message.dataCacheEnabled != null && message.hasOwnProperty("dataCacheEnabled")) - object.dataCacheEnabled = message.dataCacheEnabled; - return object; - }; - - /** - * Converts this DataCacheConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @instance - * @returns {Object.} JSON object - */ - DataCacheConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DataCacheConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.DataCacheConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DataCacheConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.DataCacheConfig"; - }; - - return DataCacheConfig; - })(); - - v1beta4.FinalBackupConfig = (function() { - - /** - * Properties of a FinalBackupConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IFinalBackupConfig - * @property {boolean|null} [enabled] FinalBackupConfig enabled - * @property {number|null} [retentionDays] FinalBackupConfig retentionDays - */ - - /** - * Constructs a new FinalBackupConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a FinalBackupConfig. - * @implements IFinalBackupConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IFinalBackupConfig=} [properties] Properties to set - */ - function FinalBackupConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FinalBackupConfig enabled. - * @member {boolean|null|undefined} enabled - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @instance - */ - FinalBackupConfig.prototype.enabled = null; - - /** - * FinalBackupConfig retentionDays. - * @member {number|null|undefined} retentionDays - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @instance - */ - FinalBackupConfig.prototype.retentionDays = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(FinalBackupConfig.prototype, "_enabled", { - get: $util.oneOfGetter($oneOfFields = ["enabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(FinalBackupConfig.prototype, "_retentionDays", { - get: $util.oneOfGetter($oneOfFields = ["retentionDays"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new FinalBackupConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @static - * @param {google.cloud.sql.v1beta4.IFinalBackupConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.FinalBackupConfig} FinalBackupConfig instance - */ - FinalBackupConfig.create = function create(properties) { - return new FinalBackupConfig(properties); - }; - - /** - * Encodes the specified FinalBackupConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.FinalBackupConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @static - * @param {google.cloud.sql.v1beta4.IFinalBackupConfig} message FinalBackupConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FinalBackupConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); - if (message.retentionDays != null && Object.hasOwnProperty.call(message, "retentionDays")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.retentionDays); - return writer; - }; - - /** - * Encodes the specified FinalBackupConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.FinalBackupConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @static - * @param {google.cloud.sql.v1beta4.IFinalBackupConfig} message FinalBackupConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FinalBackupConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FinalBackupConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.FinalBackupConfig} FinalBackupConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FinalBackupConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.FinalBackupConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.enabled = reader.bool(); - break; - } - case 3: { - message.retentionDays = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FinalBackupConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.FinalBackupConfig} FinalBackupConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FinalBackupConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FinalBackupConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FinalBackupConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - properties._enabled = 1; - if (typeof message.enabled !== "boolean") - return "enabled: boolean expected"; - } - if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) { - properties._retentionDays = 1; - if (!$util.isInteger(message.retentionDays)) - return "retentionDays: integer expected"; - } - return null; - }; - - /** - * Creates a FinalBackupConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.FinalBackupConfig} FinalBackupConfig - */ - FinalBackupConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.FinalBackupConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.FinalBackupConfig(); - if (object.enabled != null) - message.enabled = Boolean(object.enabled); - if (object.retentionDays != null) - message.retentionDays = object.retentionDays | 0; - return message; - }; - - /** - * Creates a plain object from a FinalBackupConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @static - * @param {google.cloud.sql.v1beta4.FinalBackupConfig} message FinalBackupConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FinalBackupConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - object.enabled = message.enabled; - if (options.oneofs) - object._enabled = "enabled"; - } - if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) { - object.retentionDays = message.retentionDays; - if (options.oneofs) - object._retentionDays = "retentionDays"; - } - return object; - }; - - /** - * Converts this FinalBackupConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @instance - * @returns {Object.} JSON object - */ - FinalBackupConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FinalBackupConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.FinalBackupConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FinalBackupConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.FinalBackupConfig"; - }; - - return FinalBackupConfig; - })(); - - v1beta4.Settings = (function() { - - /** - * Properties of a Settings. - * @memberof google.cloud.sql.v1beta4 - * @interface ISettings - * @property {google.protobuf.IInt64Value|null} [settingsVersion] Settings settingsVersion - * @property {Array.|null} [authorizedGaeApplications] Settings authorizedGaeApplications - * @property {string|null} [tier] Settings tier - * @property {string|null} [kind] Settings kind - * @property {Object.|null} [userLabels] Settings userLabels - * @property {google.cloud.sql.v1beta4.SqlAvailabilityType|null} [availabilityType] Settings availabilityType - * @property {google.cloud.sql.v1beta4.SqlPricingPlan|null} [pricingPlan] Settings pricingPlan - * @property {google.cloud.sql.v1beta4.SqlReplicationType|null} [replicationType] Settings replicationType - * @property {google.protobuf.IInt64Value|null} [storageAutoResizeLimit] Settings storageAutoResizeLimit - * @property {google.cloud.sql.v1beta4.Settings.SqlActivationPolicy|null} [activationPolicy] Settings activationPolicy - * @property {google.cloud.sql.v1beta4.IIpConfiguration|null} [ipConfiguration] Settings ipConfiguration - * @property {google.protobuf.IBoolValue|null} [storageAutoResize] Settings storageAutoResize - * @property {google.cloud.sql.v1beta4.ILocationPreference|null} [locationPreference] Settings locationPreference - * @property {Array.|null} [databaseFlags] Settings databaseFlags - * @property {google.cloud.sql.v1beta4.SqlDataDiskType|null} [dataDiskType] Settings dataDiskType - * @property {google.cloud.sql.v1beta4.IMaintenanceWindow|null} [maintenanceWindow] Settings maintenanceWindow - * @property {google.cloud.sql.v1beta4.IBackupConfiguration|null} [backupConfiguration] Settings backupConfiguration - * @property {google.protobuf.IBoolValue|null} [databaseReplicationEnabled] Settings databaseReplicationEnabled - * @property {google.protobuf.IBoolValue|null} [crashSafeReplicationEnabled] Settings crashSafeReplicationEnabled - * @property {google.protobuf.IInt64Value|null} [dataDiskSizeGb] Settings dataDiskSizeGb - * @property {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig|null} [activeDirectoryConfig] Settings activeDirectoryConfig - * @property {string|null} [collation] Settings collation - * @property {Array.|null} [denyMaintenancePeriods] Settings denyMaintenancePeriods - * @property {google.cloud.sql.v1beta4.IInsightsConfig|null} [insightsConfig] Settings insightsConfig - * @property {google.cloud.sql.v1beta4.IPasswordValidationPolicy|null} [passwordValidationPolicy] Settings passwordValidationPolicy - * @property {google.cloud.sql.v1beta4.ISqlServerAuditConfig|null} [sqlServerAuditConfig] Settings sqlServerAuditConfig - * @property {google.cloud.sql.v1beta4.Settings.Edition|null} [edition] Settings edition - * @property {google.cloud.sql.v1beta4.Settings.ConnectorEnforcement|null} [connectorEnforcement] Settings connectorEnforcement - * @property {google.protobuf.IBoolValue|null} [deletionProtectionEnabled] Settings deletionProtectionEnabled - * @property {string|null} [timeZone] Settings timeZone - * @property {google.cloud.sql.v1beta4.IAdvancedMachineFeatures|null} [advancedMachineFeatures] Settings advancedMachineFeatures - * @property {google.cloud.sql.v1beta4.IDataCacheConfig|null} [dataCacheConfig] Settings dataCacheConfig - * @property {google.protobuf.IInt32Value|null} [replicationLagMaxSeconds] Settings replicationLagMaxSeconds - * @property {google.protobuf.IBoolValue|null} [enableGoogleMlIntegration] Settings enableGoogleMlIntegration - * @property {google.protobuf.IBoolValue|null} [enableDataplexIntegration] Settings enableDataplexIntegration - * @property {google.protobuf.IBoolValue|null} [retainBackupsOnDelete] Settings retainBackupsOnDelete - * @property {number|Long|null} [dataDiskProvisionedIops] Settings dataDiskProvisionedIops - * @property {number|Long|null} [dataDiskProvisionedThroughput] Settings dataDiskProvisionedThroughput - * @property {google.cloud.sql.v1beta4.IConnectionPoolConfig|null} [connectionPoolConfig] Settings connectionPoolConfig - * @property {google.cloud.sql.v1beta4.IFinalBackupConfig|null} [finalBackupConfig] Settings finalBackupConfig - * @property {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig|null} [readPoolAutoScaleConfig] Settings readPoolAutoScaleConfig - * @property {boolean|null} [autoUpgradeEnabled] Settings autoUpgradeEnabled - * @property {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig|null} [entraidConfig] Settings entraidConfig - * @property {google.cloud.sql.v1beta4.Settings.DataApiAccess|null} [dataApiAccess] Settings dataApiAccess - * @property {google.cloud.sql.v1beta4.IPerformanceCaptureConfig|null} [performanceCaptureConfig] Settings performanceCaptureConfig - */ - - /** - * Constructs a new Settings. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a Settings. - * @implements ISettings - * @constructor - * @param {google.cloud.sql.v1beta4.ISettings=} [properties] Properties to set - */ - function Settings(properties) { - this.authorizedGaeApplications = []; - this.userLabels = {}; - this.databaseFlags = []; - this.denyMaintenancePeriods = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Settings settingsVersion. - * @member {google.protobuf.IInt64Value|null|undefined} settingsVersion - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.settingsVersion = null; - - /** - * Settings authorizedGaeApplications. - * @member {Array.} authorizedGaeApplications - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.authorizedGaeApplications = $util.emptyArray; - - /** - * Settings tier. - * @member {string} tier - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.tier = ""; - - /** - * Settings kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.kind = ""; - - /** - * Settings userLabels. - * @member {Object.} userLabels - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.userLabels = $util.emptyObject; - - /** - * Settings availabilityType. - * @member {google.cloud.sql.v1beta4.SqlAvailabilityType} availabilityType - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.availabilityType = 0; - - /** - * Settings pricingPlan. - * @member {google.cloud.sql.v1beta4.SqlPricingPlan} pricingPlan - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.pricingPlan = 0; - - /** - * Settings replicationType. - * @member {google.cloud.sql.v1beta4.SqlReplicationType} replicationType - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.replicationType = 0; - - /** - * Settings storageAutoResizeLimit. - * @member {google.protobuf.IInt64Value|null|undefined} storageAutoResizeLimit - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.storageAutoResizeLimit = null; - - /** - * Settings activationPolicy. - * @member {google.cloud.sql.v1beta4.Settings.SqlActivationPolicy} activationPolicy - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.activationPolicy = 0; - - /** - * Settings ipConfiguration. - * @member {google.cloud.sql.v1beta4.IIpConfiguration|null|undefined} ipConfiguration - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.ipConfiguration = null; - - /** - * Settings storageAutoResize. - * @member {google.protobuf.IBoolValue|null|undefined} storageAutoResize - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.storageAutoResize = null; - - /** - * Settings locationPreference. - * @member {google.cloud.sql.v1beta4.ILocationPreference|null|undefined} locationPreference - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.locationPreference = null; - - /** - * Settings databaseFlags. - * @member {Array.} databaseFlags - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.databaseFlags = $util.emptyArray; - - /** - * Settings dataDiskType. - * @member {google.cloud.sql.v1beta4.SqlDataDiskType} dataDiskType - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.dataDiskType = 0; - - /** - * Settings maintenanceWindow. - * @member {google.cloud.sql.v1beta4.IMaintenanceWindow|null|undefined} maintenanceWindow - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.maintenanceWindow = null; - - /** - * Settings backupConfiguration. - * @member {google.cloud.sql.v1beta4.IBackupConfiguration|null|undefined} backupConfiguration - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.backupConfiguration = null; - - /** - * Settings databaseReplicationEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} databaseReplicationEnabled - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.databaseReplicationEnabled = null; - - /** - * Settings crashSafeReplicationEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} crashSafeReplicationEnabled - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.crashSafeReplicationEnabled = null; - - /** - * Settings dataDiskSizeGb. - * @member {google.protobuf.IInt64Value|null|undefined} dataDiskSizeGb - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.dataDiskSizeGb = null; - - /** - * Settings activeDirectoryConfig. - * @member {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig|null|undefined} activeDirectoryConfig - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.activeDirectoryConfig = null; - - /** - * Settings collation. - * @member {string} collation - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.collation = ""; - - /** - * Settings denyMaintenancePeriods. - * @member {Array.} denyMaintenancePeriods - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.denyMaintenancePeriods = $util.emptyArray; - - /** - * Settings insightsConfig. - * @member {google.cloud.sql.v1beta4.IInsightsConfig|null|undefined} insightsConfig - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.insightsConfig = null; - - /** - * Settings passwordValidationPolicy. - * @member {google.cloud.sql.v1beta4.IPasswordValidationPolicy|null|undefined} passwordValidationPolicy - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.passwordValidationPolicy = null; - - /** - * Settings sqlServerAuditConfig. - * @member {google.cloud.sql.v1beta4.ISqlServerAuditConfig|null|undefined} sqlServerAuditConfig - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.sqlServerAuditConfig = null; - - /** - * Settings edition. - * @member {google.cloud.sql.v1beta4.Settings.Edition} edition - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.edition = 0; - - /** - * Settings connectorEnforcement. - * @member {google.cloud.sql.v1beta4.Settings.ConnectorEnforcement} connectorEnforcement - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.connectorEnforcement = 0; - - /** - * Settings deletionProtectionEnabled. - * @member {google.protobuf.IBoolValue|null|undefined} deletionProtectionEnabled - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.deletionProtectionEnabled = null; - - /** - * Settings timeZone. - * @member {string} timeZone - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.timeZone = ""; - - /** - * Settings advancedMachineFeatures. - * @member {google.cloud.sql.v1beta4.IAdvancedMachineFeatures|null|undefined} advancedMachineFeatures - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.advancedMachineFeatures = null; - - /** - * Settings dataCacheConfig. - * @member {google.cloud.sql.v1beta4.IDataCacheConfig|null|undefined} dataCacheConfig - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.dataCacheConfig = null; - - /** - * Settings replicationLagMaxSeconds. - * @member {google.protobuf.IInt32Value|null|undefined} replicationLagMaxSeconds - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.replicationLagMaxSeconds = null; - - /** - * Settings enableGoogleMlIntegration. - * @member {google.protobuf.IBoolValue|null|undefined} enableGoogleMlIntegration - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.enableGoogleMlIntegration = null; - - /** - * Settings enableDataplexIntegration. - * @member {google.protobuf.IBoolValue|null|undefined} enableDataplexIntegration - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.enableDataplexIntegration = null; - - /** - * Settings retainBackupsOnDelete. - * @member {google.protobuf.IBoolValue|null|undefined} retainBackupsOnDelete - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.retainBackupsOnDelete = null; - - /** - * Settings dataDiskProvisionedIops. - * @member {number|Long|null|undefined} dataDiskProvisionedIops - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.dataDiskProvisionedIops = null; - - /** - * Settings dataDiskProvisionedThroughput. - * @member {number|Long|null|undefined} dataDiskProvisionedThroughput - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.dataDiskProvisionedThroughput = null; - - /** - * Settings connectionPoolConfig. - * @member {google.cloud.sql.v1beta4.IConnectionPoolConfig|null|undefined} connectionPoolConfig - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.connectionPoolConfig = null; - - /** - * Settings finalBackupConfig. - * @member {google.cloud.sql.v1beta4.IFinalBackupConfig|null|undefined} finalBackupConfig - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.finalBackupConfig = null; - - /** - * Settings readPoolAutoScaleConfig. - * @member {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig|null|undefined} readPoolAutoScaleConfig - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.readPoolAutoScaleConfig = null; - - /** - * Settings autoUpgradeEnabled. - * @member {boolean|null|undefined} autoUpgradeEnabled - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.autoUpgradeEnabled = null; - - /** - * Settings entraidConfig. - * @member {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig|null|undefined} entraidConfig - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.entraidConfig = null; - - /** - * Settings dataApiAccess. - * @member {google.cloud.sql.v1beta4.Settings.DataApiAccess|null|undefined} dataApiAccess - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.dataApiAccess = null; - - /** - * Settings performanceCaptureConfig. - * @member {google.cloud.sql.v1beta4.IPerformanceCaptureConfig|null|undefined} performanceCaptureConfig - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - */ - Settings.prototype.performanceCaptureConfig = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_dataDiskProvisionedIops", { - get: $util.oneOfGetter($oneOfFields = ["dataDiskProvisionedIops"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_dataDiskProvisionedThroughput", { - get: $util.oneOfGetter($oneOfFields = ["dataDiskProvisionedThroughput"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_connectionPoolConfig", { - get: $util.oneOfGetter($oneOfFields = ["connectionPoolConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_finalBackupConfig", { - get: $util.oneOfGetter($oneOfFields = ["finalBackupConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_readPoolAutoScaleConfig", { - get: $util.oneOfGetter($oneOfFields = ["readPoolAutoScaleConfig"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_autoUpgradeEnabled", { - get: $util.oneOfGetter($oneOfFields = ["autoUpgradeEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(Settings.prototype, "_dataApiAccess", { - get: $util.oneOfGetter($oneOfFields = ["dataApiAccess"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new Settings instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.Settings - * @static - * @param {google.cloud.sql.v1beta4.ISettings=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.Settings} Settings instance - */ - Settings.create = function create(properties) { - return new Settings(properties); - }; - - /** - * Encodes the specified Settings message. Does not implicitly {@link google.cloud.sql.v1beta4.Settings.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.Settings - * @static - * @param {google.cloud.sql.v1beta4.ISettings} message Settings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Settings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.settingsVersion != null && Object.hasOwnProperty.call(message, "settingsVersion")) - $root.google.protobuf.Int64Value.encode(message.settingsVersion, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.authorizedGaeApplications != null && message.authorizedGaeApplications.length) - for (var i = 0; i < message.authorizedGaeApplications.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.authorizedGaeApplications[i]); - if (message.tier != null && Object.hasOwnProperty.call(message, "tier")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.tier); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.kind); - if (message.userLabels != null && Object.hasOwnProperty.call(message, "userLabels")) - for (var keys = Object.keys(message.userLabels), i = 0; i < keys.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.userLabels[keys[i]]).ldelim(); - if (message.availabilityType != null && Object.hasOwnProperty.call(message, "availabilityType")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.availabilityType); - if (message.pricingPlan != null && Object.hasOwnProperty.call(message, "pricingPlan")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.pricingPlan); - if (message.replicationType != null && Object.hasOwnProperty.call(message, "replicationType")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.replicationType); - if (message.storageAutoResizeLimit != null && Object.hasOwnProperty.call(message, "storageAutoResizeLimit")) - $root.google.protobuf.Int64Value.encode(message.storageAutoResizeLimit, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.activationPolicy != null && Object.hasOwnProperty.call(message, "activationPolicy")) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.activationPolicy); - if (message.ipConfiguration != null && Object.hasOwnProperty.call(message, "ipConfiguration")) - $root.google.cloud.sql.v1beta4.IpConfiguration.encode(message.ipConfiguration, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.storageAutoResize != null && Object.hasOwnProperty.call(message, "storageAutoResize")) - $root.google.protobuf.BoolValue.encode(message.storageAutoResize, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.locationPreference != null && Object.hasOwnProperty.call(message, "locationPreference")) - $root.google.cloud.sql.v1beta4.LocationPreference.encode(message.locationPreference, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); - if (message.databaseFlags != null && message.databaseFlags.length) - for (var i = 0; i < message.databaseFlags.length; ++i) - $root.google.cloud.sql.v1beta4.DatabaseFlags.encode(message.databaseFlags[i], writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); - if (message.dataDiskType != null && Object.hasOwnProperty.call(message, "dataDiskType")) - writer.uint32(/* id 15, wireType 0 =*/120).int32(message.dataDiskType); - if (message.maintenanceWindow != null && Object.hasOwnProperty.call(message, "maintenanceWindow")) - $root.google.cloud.sql.v1beta4.MaintenanceWindow.encode(message.maintenanceWindow, writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); - if (message.backupConfiguration != null && Object.hasOwnProperty.call(message, "backupConfiguration")) - $root.google.cloud.sql.v1beta4.BackupConfiguration.encode(message.backupConfiguration, writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); - if (message.databaseReplicationEnabled != null && Object.hasOwnProperty.call(message, "databaseReplicationEnabled")) - $root.google.protobuf.BoolValue.encode(message.databaseReplicationEnabled, writer.uint32(/* id 18, wireType 2 =*/146).fork()).ldelim(); - if (message.crashSafeReplicationEnabled != null && Object.hasOwnProperty.call(message, "crashSafeReplicationEnabled")) - $root.google.protobuf.BoolValue.encode(message.crashSafeReplicationEnabled, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); - if (message.dataDiskSizeGb != null && Object.hasOwnProperty.call(message, "dataDiskSizeGb")) - $root.google.protobuf.Int64Value.encode(message.dataDiskSizeGb, writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.activeDirectoryConfig != null && Object.hasOwnProperty.call(message, "activeDirectoryConfig")) - $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.encode(message.activeDirectoryConfig, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); - if (message.collation != null && Object.hasOwnProperty.call(message, "collation")) - writer.uint32(/* id 23, wireType 2 =*/186).string(message.collation); - if (message.denyMaintenancePeriods != null && message.denyMaintenancePeriods.length) - for (var i = 0; i < message.denyMaintenancePeriods.length; ++i) - $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod.encode(message.denyMaintenancePeriods[i], writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); - if (message.insightsConfig != null && Object.hasOwnProperty.call(message, "insightsConfig")) - $root.google.cloud.sql.v1beta4.InsightsConfig.encode(message.insightsConfig, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); - if (message.passwordValidationPolicy != null && Object.hasOwnProperty.call(message, "passwordValidationPolicy")) - $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.encode(message.passwordValidationPolicy, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); - if (message.sqlServerAuditConfig != null && Object.hasOwnProperty.call(message, "sqlServerAuditConfig")) - $root.google.cloud.sql.v1beta4.SqlServerAuditConfig.encode(message.sqlServerAuditConfig, writer.uint32(/* id 29, wireType 2 =*/234).fork()).ldelim(); - if (message.connectorEnforcement != null && Object.hasOwnProperty.call(message, "connectorEnforcement")) - writer.uint32(/* id 32, wireType 0 =*/256).int32(message.connectorEnforcement); - if (message.deletionProtectionEnabled != null && Object.hasOwnProperty.call(message, "deletionProtectionEnabled")) - $root.google.protobuf.BoolValue.encode(message.deletionProtectionEnabled, writer.uint32(/* id 33, wireType 2 =*/266).fork()).ldelim(); - if (message.timeZone != null && Object.hasOwnProperty.call(message, "timeZone")) - writer.uint32(/* id 34, wireType 2 =*/274).string(message.timeZone); - if (message.advancedMachineFeatures != null && Object.hasOwnProperty.call(message, "advancedMachineFeatures")) - $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures.encode(message.advancedMachineFeatures, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); - if (message.dataCacheConfig != null && Object.hasOwnProperty.call(message, "dataCacheConfig")) - $root.google.cloud.sql.v1beta4.DataCacheConfig.encode(message.dataCacheConfig, writer.uint32(/* id 37, wireType 2 =*/298).fork()).ldelim(); - if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 38, wireType 0 =*/304).int32(message.edition); - if (message.replicationLagMaxSeconds != null && Object.hasOwnProperty.call(message, "replicationLagMaxSeconds")) - $root.google.protobuf.Int32Value.encode(message.replicationLagMaxSeconds, writer.uint32(/* id 39, wireType 2 =*/314).fork()).ldelim(); - if (message.enableGoogleMlIntegration != null && Object.hasOwnProperty.call(message, "enableGoogleMlIntegration")) - $root.google.protobuf.BoolValue.encode(message.enableGoogleMlIntegration, writer.uint32(/* id 40, wireType 2 =*/322).fork()).ldelim(); - if (message.enableDataplexIntegration != null && Object.hasOwnProperty.call(message, "enableDataplexIntegration")) - $root.google.protobuf.BoolValue.encode(message.enableDataplexIntegration, writer.uint32(/* id 41, wireType 2 =*/330).fork()).ldelim(); - if (message.retainBackupsOnDelete != null && Object.hasOwnProperty.call(message, "retainBackupsOnDelete")) - $root.google.protobuf.BoolValue.encode(message.retainBackupsOnDelete, writer.uint32(/* id 42, wireType 2 =*/338).fork()).ldelim(); - if (message.dataDiskProvisionedIops != null && Object.hasOwnProperty.call(message, "dataDiskProvisionedIops")) - writer.uint32(/* id 43, wireType 0 =*/344).int64(message.dataDiskProvisionedIops); - if (message.dataDiskProvisionedThroughput != null && Object.hasOwnProperty.call(message, "dataDiskProvisionedThroughput")) - writer.uint32(/* id 44, wireType 0 =*/352).int64(message.dataDiskProvisionedThroughput); - if (message.connectionPoolConfig != null && Object.hasOwnProperty.call(message, "connectionPoolConfig")) - $root.google.cloud.sql.v1beta4.ConnectionPoolConfig.encode(message.connectionPoolConfig, writer.uint32(/* id 45, wireType 2 =*/362).fork()).ldelim(); - if (message.finalBackupConfig != null && Object.hasOwnProperty.call(message, "finalBackupConfig")) - $root.google.cloud.sql.v1beta4.FinalBackupConfig.encode(message.finalBackupConfig, writer.uint32(/* id 47, wireType 2 =*/378).fork()).ldelim(); - if (message.readPoolAutoScaleConfig != null && Object.hasOwnProperty.call(message, "readPoolAutoScaleConfig")) - $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.encode(message.readPoolAutoScaleConfig, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); - if (message.autoUpgradeEnabled != null && Object.hasOwnProperty.call(message, "autoUpgradeEnabled")) - writer.uint32(/* id 50, wireType 0 =*/400).bool(message.autoUpgradeEnabled); - if (message.entraidConfig != null && Object.hasOwnProperty.call(message, "entraidConfig")) - $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig.encode(message.entraidConfig, writer.uint32(/* id 52, wireType 2 =*/418).fork()).ldelim(); - if (message.dataApiAccess != null && Object.hasOwnProperty.call(message, "dataApiAccess")) - writer.uint32(/* id 53, wireType 0 =*/424).int32(message.dataApiAccess); - if (message.performanceCaptureConfig != null && Object.hasOwnProperty.call(message, "performanceCaptureConfig")) - $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig.encode(message.performanceCaptureConfig, writer.uint32(/* id 54, wireType 2 =*/434).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Settings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.Settings - * @static - * @param {google.cloud.sql.v1beta4.ISettings} message Settings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Settings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Settings message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.Settings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.Settings} Settings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Settings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Settings(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.settingsVersion = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 2: { - if (!(message.authorizedGaeApplications && message.authorizedGaeApplications.length)) - message.authorizedGaeApplications = []; - message.authorizedGaeApplications.push(reader.string()); - break; - } - case 3: { - message.tier = reader.string(); - break; - } - case 4: { - message.kind = reader.string(); - break; - } - case 5: { - if (message.userLabels === $util.emptyObject) - message.userLabels = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.userLabels[key] = value; - break; - } - case 6: { - message.availabilityType = reader.int32(); - break; - } - case 7: { - message.pricingPlan = reader.int32(); - break; - } - case 8: { - message.replicationType = reader.int32(); - break; - } - case 9: { - message.storageAutoResizeLimit = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 10: { - message.activationPolicy = reader.int32(); - break; - } - case 11: { - message.ipConfiguration = $root.google.cloud.sql.v1beta4.IpConfiguration.decode(reader, reader.uint32()); - break; - } - case 12: { - message.storageAutoResize = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 13: { - message.locationPreference = $root.google.cloud.sql.v1beta4.LocationPreference.decode(reader, reader.uint32()); - break; - } - case 14: { - if (!(message.databaseFlags && message.databaseFlags.length)) - message.databaseFlags = []; - message.databaseFlags.push($root.google.cloud.sql.v1beta4.DatabaseFlags.decode(reader, reader.uint32())); - break; - } - case 15: { - message.dataDiskType = reader.int32(); - break; - } - case 16: { - message.maintenanceWindow = $root.google.cloud.sql.v1beta4.MaintenanceWindow.decode(reader, reader.uint32()); - break; - } - case 17: { - message.backupConfiguration = $root.google.cloud.sql.v1beta4.BackupConfiguration.decode(reader, reader.uint32()); - break; - } - case 18: { - message.databaseReplicationEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 19: { - message.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 20: { - message.dataDiskSizeGb = $root.google.protobuf.Int64Value.decode(reader, reader.uint32()); - break; - } - case 22: { - message.activeDirectoryConfig = $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.decode(reader, reader.uint32()); - break; - } - case 23: { - message.collation = reader.string(); - break; - } - case 24: { - if (!(message.denyMaintenancePeriods && message.denyMaintenancePeriods.length)) - message.denyMaintenancePeriods = []; - message.denyMaintenancePeriods.push($root.google.cloud.sql.v1beta4.DenyMaintenancePeriod.decode(reader, reader.uint32())); - break; - } - case 25: { - message.insightsConfig = $root.google.cloud.sql.v1beta4.InsightsConfig.decode(reader, reader.uint32()); - break; - } - case 27: { - message.passwordValidationPolicy = $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.decode(reader, reader.uint32()); - break; - } - case 29: { - message.sqlServerAuditConfig = $root.google.cloud.sql.v1beta4.SqlServerAuditConfig.decode(reader, reader.uint32()); - break; - } - case 38: { - message.edition = reader.int32(); - break; - } - case 32: { - message.connectorEnforcement = reader.int32(); - break; - } - case 33: { - message.deletionProtectionEnabled = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 34: { - message.timeZone = reader.string(); - break; - } - case 35: { - message.advancedMachineFeatures = $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures.decode(reader, reader.uint32()); - break; - } - case 37: { - message.dataCacheConfig = $root.google.cloud.sql.v1beta4.DataCacheConfig.decode(reader, reader.uint32()); - break; - } - case 39: { - message.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.decode(reader, reader.uint32()); - break; - } - case 40: { - message.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 41: { - message.enableDataplexIntegration = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 42: { - message.retainBackupsOnDelete = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); - break; - } - case 43: { - message.dataDiskProvisionedIops = reader.int64(); - break; - } - case 44: { - message.dataDiskProvisionedThroughput = reader.int64(); - break; - } - case 45: { - message.connectionPoolConfig = $root.google.cloud.sql.v1beta4.ConnectionPoolConfig.decode(reader, reader.uint32()); - break; - } - case 47: { - message.finalBackupConfig = $root.google.cloud.sql.v1beta4.FinalBackupConfig.decode(reader, reader.uint32()); - break; - } - case 48: { - message.readPoolAutoScaleConfig = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.decode(reader, reader.uint32()); - break; - } - case 50: { - message.autoUpgradeEnabled = reader.bool(); - break; - } - case 52: { - message.entraidConfig = $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig.decode(reader, reader.uint32()); - break; - } - case 53: { - message.dataApiAccess = reader.int32(); - break; - } - case 54: { - message.performanceCaptureConfig = $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Settings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.Settings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.Settings} Settings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Settings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Settings message. - * @function verify - * @memberof google.cloud.sql.v1beta4.Settings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Settings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) { - var error = $root.google.protobuf.Int64Value.verify(message.settingsVersion); - if (error) - return "settingsVersion." + error; - } - if (message.authorizedGaeApplications != null && message.hasOwnProperty("authorizedGaeApplications")) { - if (!Array.isArray(message.authorizedGaeApplications)) - return "authorizedGaeApplications: array expected"; - for (var i = 0; i < message.authorizedGaeApplications.length; ++i) - if (!$util.isString(message.authorizedGaeApplications[i])) - return "authorizedGaeApplications: string[] expected"; - } - if (message.tier != null && message.hasOwnProperty("tier")) - if (!$util.isString(message.tier)) - return "tier: string expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.userLabels != null && message.hasOwnProperty("userLabels")) { - if (!$util.isObject(message.userLabels)) - return "userLabels: object expected"; - var key = Object.keys(message.userLabels); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.userLabels[key[i]])) - return "userLabels: string{k:string} expected"; - } - if (message.availabilityType != null && message.hasOwnProperty("availabilityType")) - switch (message.availabilityType) { - default: - return "availabilityType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.pricingPlan != null && message.hasOwnProperty("pricingPlan")) - switch (message.pricingPlan) { - default: - return "pricingPlan: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.replicationType != null && message.hasOwnProperty("replicationType")) - switch (message.replicationType) { - default: - return "replicationType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.storageAutoResizeLimit != null && message.hasOwnProperty("storageAutoResizeLimit")) { - var error = $root.google.protobuf.Int64Value.verify(message.storageAutoResizeLimit); - if (error) - return "storageAutoResizeLimit." + error; - } - if (message.activationPolicy != null && message.hasOwnProperty("activationPolicy")) - switch (message.activationPolicy) { - default: - return "activationPolicy: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.ipConfiguration != null && message.hasOwnProperty("ipConfiguration")) { - var error = $root.google.cloud.sql.v1beta4.IpConfiguration.verify(message.ipConfiguration); - if (error) - return "ipConfiguration." + error; - } - if (message.storageAutoResize != null && message.hasOwnProperty("storageAutoResize")) { - var error = $root.google.protobuf.BoolValue.verify(message.storageAutoResize); - if (error) - return "storageAutoResize." + error; - } - if (message.locationPreference != null && message.hasOwnProperty("locationPreference")) { - var error = $root.google.cloud.sql.v1beta4.LocationPreference.verify(message.locationPreference); - if (error) - return "locationPreference." + error; - } - if (message.databaseFlags != null && message.hasOwnProperty("databaseFlags")) { - if (!Array.isArray(message.databaseFlags)) - return "databaseFlags: array expected"; - for (var i = 0; i < message.databaseFlags.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.DatabaseFlags.verify(message.databaseFlags[i]); - if (error) - return "databaseFlags." + error; - } - } - if (message.dataDiskType != null && message.hasOwnProperty("dataDiskType")) - switch (message.dataDiskType) { - default: - return "dataDiskType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.maintenanceWindow != null && message.hasOwnProperty("maintenanceWindow")) { - var error = $root.google.cloud.sql.v1beta4.MaintenanceWindow.verify(message.maintenanceWindow); - if (error) - return "maintenanceWindow." + error; - } - if (message.backupConfiguration != null && message.hasOwnProperty("backupConfiguration")) { - var error = $root.google.cloud.sql.v1beta4.BackupConfiguration.verify(message.backupConfiguration); - if (error) - return "backupConfiguration." + error; - } - if (message.databaseReplicationEnabled != null && message.hasOwnProperty("databaseReplicationEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.databaseReplicationEnabled); - if (error) - return "databaseReplicationEnabled." + error; - } - if (message.crashSafeReplicationEnabled != null && message.hasOwnProperty("crashSafeReplicationEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.crashSafeReplicationEnabled); - if (error) - return "crashSafeReplicationEnabled." + error; - } - if (message.dataDiskSizeGb != null && message.hasOwnProperty("dataDiskSizeGb")) { - var error = $root.google.protobuf.Int64Value.verify(message.dataDiskSizeGb); - if (error) - return "dataDiskSizeGb." + error; - } - if (message.activeDirectoryConfig != null && message.hasOwnProperty("activeDirectoryConfig")) { - var error = $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.verify(message.activeDirectoryConfig); - if (error) - return "activeDirectoryConfig." + error; - } - if (message.collation != null && message.hasOwnProperty("collation")) - if (!$util.isString(message.collation)) - return "collation: string expected"; - if (message.denyMaintenancePeriods != null && message.hasOwnProperty("denyMaintenancePeriods")) { - if (!Array.isArray(message.denyMaintenancePeriods)) - return "denyMaintenancePeriods: array expected"; - for (var i = 0; i < message.denyMaintenancePeriods.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod.verify(message.denyMaintenancePeriods[i]); - if (error) - return "denyMaintenancePeriods." + error; - } - } - if (message.insightsConfig != null && message.hasOwnProperty("insightsConfig")) { - var error = $root.google.cloud.sql.v1beta4.InsightsConfig.verify(message.insightsConfig); - if (error) - return "insightsConfig." + error; - } - if (message.passwordValidationPolicy != null && message.hasOwnProperty("passwordValidationPolicy")) { - var error = $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.verify(message.passwordValidationPolicy); - if (error) - return "passwordValidationPolicy." + error; - } - if (message.sqlServerAuditConfig != null && message.hasOwnProperty("sqlServerAuditConfig")) { - var error = $root.google.cloud.sql.v1beta4.SqlServerAuditConfig.verify(message.sqlServerAuditConfig); - if (error) - return "sqlServerAuditConfig." + error; - } - if (message.edition != null && message.hasOwnProperty("edition")) - switch (message.edition) { - default: - return "edition: enum value expected"; - case 0: - case 2: - case 3: - break; - } - if (message.connectorEnforcement != null && message.hasOwnProperty("connectorEnforcement")) - switch (message.connectorEnforcement) { - default: - return "connectorEnforcement: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.deletionProtectionEnabled != null && message.hasOwnProperty("deletionProtectionEnabled")) { - var error = $root.google.protobuf.BoolValue.verify(message.deletionProtectionEnabled); - if (error) - return "deletionProtectionEnabled." + error; - } - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - if (!$util.isString(message.timeZone)) - return "timeZone: string expected"; - if (message.advancedMachineFeatures != null && message.hasOwnProperty("advancedMachineFeatures")) { - var error = $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures.verify(message.advancedMachineFeatures); - if (error) - return "advancedMachineFeatures." + error; - } - if (message.dataCacheConfig != null && message.hasOwnProperty("dataCacheConfig")) { - var error = $root.google.cloud.sql.v1beta4.DataCacheConfig.verify(message.dataCacheConfig); - if (error) - return "dataCacheConfig." + error; - } - if (message.replicationLagMaxSeconds != null && message.hasOwnProperty("replicationLagMaxSeconds")) { - var error = $root.google.protobuf.Int32Value.verify(message.replicationLagMaxSeconds); - if (error) - return "replicationLagMaxSeconds." + error; - } - if (message.enableGoogleMlIntegration != null && message.hasOwnProperty("enableGoogleMlIntegration")) { - var error = $root.google.protobuf.BoolValue.verify(message.enableGoogleMlIntegration); - if (error) - return "enableGoogleMlIntegration." + error; - } - if (message.enableDataplexIntegration != null && message.hasOwnProperty("enableDataplexIntegration")) { - var error = $root.google.protobuf.BoolValue.verify(message.enableDataplexIntegration); - if (error) - return "enableDataplexIntegration." + error; - } - if (message.retainBackupsOnDelete != null && message.hasOwnProperty("retainBackupsOnDelete")) { - var error = $root.google.protobuf.BoolValue.verify(message.retainBackupsOnDelete); - if (error) - return "retainBackupsOnDelete." + error; - } - if (message.dataDiskProvisionedIops != null && message.hasOwnProperty("dataDiskProvisionedIops")) { - properties._dataDiskProvisionedIops = 1; - if (!$util.isInteger(message.dataDiskProvisionedIops) && !(message.dataDiskProvisionedIops && $util.isInteger(message.dataDiskProvisionedIops.low) && $util.isInteger(message.dataDiskProvisionedIops.high))) - return "dataDiskProvisionedIops: integer|Long expected"; - } - if (message.dataDiskProvisionedThroughput != null && message.hasOwnProperty("dataDiskProvisionedThroughput")) { - properties._dataDiskProvisionedThroughput = 1; - if (!$util.isInteger(message.dataDiskProvisionedThroughput) && !(message.dataDiskProvisionedThroughput && $util.isInteger(message.dataDiskProvisionedThroughput.low) && $util.isInteger(message.dataDiskProvisionedThroughput.high))) - return "dataDiskProvisionedThroughput: integer|Long expected"; - } - if (message.connectionPoolConfig != null && message.hasOwnProperty("connectionPoolConfig")) { - properties._connectionPoolConfig = 1; - { - var error = $root.google.cloud.sql.v1beta4.ConnectionPoolConfig.verify(message.connectionPoolConfig); - if (error) - return "connectionPoolConfig." + error; - } - } - if (message.finalBackupConfig != null && message.hasOwnProperty("finalBackupConfig")) { - properties._finalBackupConfig = 1; - { - var error = $root.google.cloud.sql.v1beta4.FinalBackupConfig.verify(message.finalBackupConfig); - if (error) - return "finalBackupConfig." + error; - } - } - if (message.readPoolAutoScaleConfig != null && message.hasOwnProperty("readPoolAutoScaleConfig")) { - properties._readPoolAutoScaleConfig = 1; - { - var error = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.verify(message.readPoolAutoScaleConfig); - if (error) - return "readPoolAutoScaleConfig." + error; - } - } - if (message.autoUpgradeEnabled != null && message.hasOwnProperty("autoUpgradeEnabled")) { - properties._autoUpgradeEnabled = 1; - if (typeof message.autoUpgradeEnabled !== "boolean") - return "autoUpgradeEnabled: boolean expected"; - } - if (message.entraidConfig != null && message.hasOwnProperty("entraidConfig")) { - var error = $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig.verify(message.entraidConfig); - if (error) - return "entraidConfig." + error; - } - if (message.dataApiAccess != null && message.hasOwnProperty("dataApiAccess")) { - properties._dataApiAccess = 1; - switch (message.dataApiAccess) { - default: - return "dataApiAccess: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - if (message.performanceCaptureConfig != null && message.hasOwnProperty("performanceCaptureConfig")) { - var error = $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig.verify(message.performanceCaptureConfig); - if (error) - return "performanceCaptureConfig." + error; - } - return null; - }; - - /** - * Creates a Settings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.Settings - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.Settings} Settings - */ - Settings.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.Settings) - return object; - var message = new $root.google.cloud.sql.v1beta4.Settings(); - if (object.settingsVersion != null) { - if (typeof object.settingsVersion !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.settingsVersion: object expected"); - message.settingsVersion = $root.google.protobuf.Int64Value.fromObject(object.settingsVersion); - } - if (object.authorizedGaeApplications) { - if (!Array.isArray(object.authorizedGaeApplications)) - throw TypeError(".google.cloud.sql.v1beta4.Settings.authorizedGaeApplications: array expected"); - message.authorizedGaeApplications = []; - for (var i = 0; i < object.authorizedGaeApplications.length; ++i) - message.authorizedGaeApplications[i] = String(object.authorizedGaeApplications[i]); - } - if (object.tier != null) - message.tier = String(object.tier); - if (object.kind != null) - message.kind = String(object.kind); - if (object.userLabels) { - if (typeof object.userLabels !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.userLabels: object expected"); - message.userLabels = {}; - for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) - message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); - } - switch (object.availabilityType) { - default: - if (typeof object.availabilityType === "number") { - message.availabilityType = object.availabilityType; - break; - } - break; - case "SQL_AVAILABILITY_TYPE_UNSPECIFIED": - case 0: - message.availabilityType = 0; - break; - case "ZONAL": - case 1: - message.availabilityType = 1; - break; - case "REGIONAL": - case 2: - message.availabilityType = 2; - break; - } - switch (object.pricingPlan) { - default: - if (typeof object.pricingPlan === "number") { - message.pricingPlan = object.pricingPlan; - break; - } - break; - case "SQL_PRICING_PLAN_UNSPECIFIED": - case 0: - message.pricingPlan = 0; - break; - case "PACKAGE": - case 1: - message.pricingPlan = 1; - break; - case "PER_USE": - case 2: - message.pricingPlan = 2; - break; - } - switch (object.replicationType) { - default: - if (typeof object.replicationType === "number") { - message.replicationType = object.replicationType; - break; - } - break; - case "SQL_REPLICATION_TYPE_UNSPECIFIED": - case 0: - message.replicationType = 0; - break; - case "SYNCHRONOUS": - case 1: - message.replicationType = 1; - break; - case "ASYNCHRONOUS": - case 2: - message.replicationType = 2; - break; - } - if (object.storageAutoResizeLimit != null) { - if (typeof object.storageAutoResizeLimit !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.storageAutoResizeLimit: object expected"); - message.storageAutoResizeLimit = $root.google.protobuf.Int64Value.fromObject(object.storageAutoResizeLimit); - } - switch (object.activationPolicy) { - default: - if (typeof object.activationPolicy === "number") { - message.activationPolicy = object.activationPolicy; - break; - } - break; - case "SQL_ACTIVATION_POLICY_UNSPECIFIED": - case 0: - message.activationPolicy = 0; - break; - case "ALWAYS": - case 1: - message.activationPolicy = 1; - break; - case "NEVER": - case 2: - message.activationPolicy = 2; - break; - case "ON_DEMAND": - case 3: - message.activationPolicy = 3; - break; - } - if (object.ipConfiguration != null) { - if (typeof object.ipConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.ipConfiguration: object expected"); - message.ipConfiguration = $root.google.cloud.sql.v1beta4.IpConfiguration.fromObject(object.ipConfiguration); - } - if (object.storageAutoResize != null) { - if (typeof object.storageAutoResize !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.storageAutoResize: object expected"); - message.storageAutoResize = $root.google.protobuf.BoolValue.fromObject(object.storageAutoResize); - } - if (object.locationPreference != null) { - if (typeof object.locationPreference !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.locationPreference: object expected"); - message.locationPreference = $root.google.cloud.sql.v1beta4.LocationPreference.fromObject(object.locationPreference); - } - if (object.databaseFlags) { - if (!Array.isArray(object.databaseFlags)) - throw TypeError(".google.cloud.sql.v1beta4.Settings.databaseFlags: array expected"); - message.databaseFlags = []; - for (var i = 0; i < object.databaseFlags.length; ++i) { - if (typeof object.databaseFlags[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.databaseFlags: object expected"); - message.databaseFlags[i] = $root.google.cloud.sql.v1beta4.DatabaseFlags.fromObject(object.databaseFlags[i]); - } - } - switch (object.dataDiskType) { - default: - if (typeof object.dataDiskType === "number") { - message.dataDiskType = object.dataDiskType; - break; - } - break; - case "SQL_DATA_DISK_TYPE_UNSPECIFIED": - case 0: - message.dataDiskType = 0; - break; - case "PD_SSD": - case 1: - message.dataDiskType = 1; - break; - case "PD_HDD": - case 2: - message.dataDiskType = 2; - break; - case "OBSOLETE_LOCAL_SSD": - case 3: - message.dataDiskType = 3; - break; - case "HYPERDISK_BALANCED": - case 4: - message.dataDiskType = 4; - break; - } - if (object.maintenanceWindow != null) { - if (typeof object.maintenanceWindow !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.maintenanceWindow: object expected"); - message.maintenanceWindow = $root.google.cloud.sql.v1beta4.MaintenanceWindow.fromObject(object.maintenanceWindow); - } - if (object.backupConfiguration != null) { - if (typeof object.backupConfiguration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.backupConfiguration: object expected"); - message.backupConfiguration = $root.google.cloud.sql.v1beta4.BackupConfiguration.fromObject(object.backupConfiguration); - } - if (object.databaseReplicationEnabled != null) { - if (typeof object.databaseReplicationEnabled !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.databaseReplicationEnabled: object expected"); - message.databaseReplicationEnabled = $root.google.protobuf.BoolValue.fromObject(object.databaseReplicationEnabled); - } - if (object.crashSafeReplicationEnabled != null) { - if (typeof object.crashSafeReplicationEnabled !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.crashSafeReplicationEnabled: object expected"); - message.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.fromObject(object.crashSafeReplicationEnabled); - } - if (object.dataDiskSizeGb != null) { - if (typeof object.dataDiskSizeGb !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.dataDiskSizeGb: object expected"); - message.dataDiskSizeGb = $root.google.protobuf.Int64Value.fromObject(object.dataDiskSizeGb); - } - if (object.activeDirectoryConfig != null) { - if (typeof object.activeDirectoryConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.activeDirectoryConfig: object expected"); - message.activeDirectoryConfig = $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.fromObject(object.activeDirectoryConfig); - } - if (object.collation != null) - message.collation = String(object.collation); - if (object.denyMaintenancePeriods) { - if (!Array.isArray(object.denyMaintenancePeriods)) - throw TypeError(".google.cloud.sql.v1beta4.Settings.denyMaintenancePeriods: array expected"); - message.denyMaintenancePeriods = []; - for (var i = 0; i < object.denyMaintenancePeriods.length; ++i) { - if (typeof object.denyMaintenancePeriods[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.denyMaintenancePeriods: object expected"); - message.denyMaintenancePeriods[i] = $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod.fromObject(object.denyMaintenancePeriods[i]); - } - } - if (object.insightsConfig != null) { - if (typeof object.insightsConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.insightsConfig: object expected"); - message.insightsConfig = $root.google.cloud.sql.v1beta4.InsightsConfig.fromObject(object.insightsConfig); - } - if (object.passwordValidationPolicy != null) { - if (typeof object.passwordValidationPolicy !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.passwordValidationPolicy: object expected"); - message.passwordValidationPolicy = $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.fromObject(object.passwordValidationPolicy); - } - if (object.sqlServerAuditConfig != null) { - if (typeof object.sqlServerAuditConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.sqlServerAuditConfig: object expected"); - message.sqlServerAuditConfig = $root.google.cloud.sql.v1beta4.SqlServerAuditConfig.fromObject(object.sqlServerAuditConfig); - } - switch (object.edition) { - default: - if (typeof object.edition === "number") { - message.edition = object.edition; - break; - } - break; - case "EDITION_UNSPECIFIED": - case 0: - message.edition = 0; - break; - case "ENTERPRISE": - case 2: - message.edition = 2; - break; - case "ENTERPRISE_PLUS": - case 3: - message.edition = 3; - break; - } - switch (object.connectorEnforcement) { - default: - if (typeof object.connectorEnforcement === "number") { - message.connectorEnforcement = object.connectorEnforcement; - break; - } - break; - case "CONNECTOR_ENFORCEMENT_UNSPECIFIED": - case 0: - message.connectorEnforcement = 0; - break; - case "NOT_REQUIRED": - case 1: - message.connectorEnforcement = 1; - break; - case "REQUIRED": - case 2: - message.connectorEnforcement = 2; - break; - } - if (object.deletionProtectionEnabled != null) { - if (typeof object.deletionProtectionEnabled !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.deletionProtectionEnabled: object expected"); - message.deletionProtectionEnabled = $root.google.protobuf.BoolValue.fromObject(object.deletionProtectionEnabled); - } - if (object.timeZone != null) - message.timeZone = String(object.timeZone); - if (object.advancedMachineFeatures != null) { - if (typeof object.advancedMachineFeatures !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.advancedMachineFeatures: object expected"); - message.advancedMachineFeatures = $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures.fromObject(object.advancedMachineFeatures); - } - if (object.dataCacheConfig != null) { - if (typeof object.dataCacheConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.dataCacheConfig: object expected"); - message.dataCacheConfig = $root.google.cloud.sql.v1beta4.DataCacheConfig.fromObject(object.dataCacheConfig); - } - if (object.replicationLagMaxSeconds != null) { - if (typeof object.replicationLagMaxSeconds !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.replicationLagMaxSeconds: object expected"); - message.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.fromObject(object.replicationLagMaxSeconds); - } - if (object.enableGoogleMlIntegration != null) { - if (typeof object.enableGoogleMlIntegration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.enableGoogleMlIntegration: object expected"); - message.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.fromObject(object.enableGoogleMlIntegration); - } - if (object.enableDataplexIntegration != null) { - if (typeof object.enableDataplexIntegration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.enableDataplexIntegration: object expected"); - message.enableDataplexIntegration = $root.google.protobuf.BoolValue.fromObject(object.enableDataplexIntegration); - } - if (object.retainBackupsOnDelete != null) { - if (typeof object.retainBackupsOnDelete !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.retainBackupsOnDelete: object expected"); - message.retainBackupsOnDelete = $root.google.protobuf.BoolValue.fromObject(object.retainBackupsOnDelete); - } - if (object.dataDiskProvisionedIops != null) - if ($util.Long) - (message.dataDiskProvisionedIops = $util.Long.fromValue(object.dataDiskProvisionedIops)).unsigned = false; - else if (typeof object.dataDiskProvisionedIops === "string") - message.dataDiskProvisionedIops = parseInt(object.dataDiskProvisionedIops, 10); - else if (typeof object.dataDiskProvisionedIops === "number") - message.dataDiskProvisionedIops = object.dataDiskProvisionedIops; - else if (typeof object.dataDiskProvisionedIops === "object") - message.dataDiskProvisionedIops = new $util.LongBits(object.dataDiskProvisionedIops.low >>> 0, object.dataDiskProvisionedIops.high >>> 0).toNumber(); - if (object.dataDiskProvisionedThroughput != null) - if ($util.Long) - (message.dataDiskProvisionedThroughput = $util.Long.fromValue(object.dataDiskProvisionedThroughput)).unsigned = false; - else if (typeof object.dataDiskProvisionedThroughput === "string") - message.dataDiskProvisionedThroughput = parseInt(object.dataDiskProvisionedThroughput, 10); - else if (typeof object.dataDiskProvisionedThroughput === "number") - message.dataDiskProvisionedThroughput = object.dataDiskProvisionedThroughput; - else if (typeof object.dataDiskProvisionedThroughput === "object") - message.dataDiskProvisionedThroughput = new $util.LongBits(object.dataDiskProvisionedThroughput.low >>> 0, object.dataDiskProvisionedThroughput.high >>> 0).toNumber(); - if (object.connectionPoolConfig != null) { - if (typeof object.connectionPoolConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.connectionPoolConfig: object expected"); - message.connectionPoolConfig = $root.google.cloud.sql.v1beta4.ConnectionPoolConfig.fromObject(object.connectionPoolConfig); - } - if (object.finalBackupConfig != null) { - if (typeof object.finalBackupConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.finalBackupConfig: object expected"); - message.finalBackupConfig = $root.google.cloud.sql.v1beta4.FinalBackupConfig.fromObject(object.finalBackupConfig); - } - if (object.readPoolAutoScaleConfig != null) { - if (typeof object.readPoolAutoScaleConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.readPoolAutoScaleConfig: object expected"); - message.readPoolAutoScaleConfig = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.fromObject(object.readPoolAutoScaleConfig); - } - if (object.autoUpgradeEnabled != null) - message.autoUpgradeEnabled = Boolean(object.autoUpgradeEnabled); - if (object.entraidConfig != null) { - if (typeof object.entraidConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.entraidConfig: object expected"); - message.entraidConfig = $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig.fromObject(object.entraidConfig); - } - switch (object.dataApiAccess) { - default: - if (typeof object.dataApiAccess === "number") { - message.dataApiAccess = object.dataApiAccess; - break; - } - break; - case "DATA_API_ACCESS_UNSPECIFIED": - case 0: - message.dataApiAccess = 0; - break; - case "DISALLOW_DATA_API": - case 1: - message.dataApiAccess = 1; - break; - case "ALLOW_DATA_API": - case 2: - message.dataApiAccess = 2; - break; - } - if (object.performanceCaptureConfig != null) { - if (typeof object.performanceCaptureConfig !== "object") - throw TypeError(".google.cloud.sql.v1beta4.Settings.performanceCaptureConfig: object expected"); - message.performanceCaptureConfig = $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig.fromObject(object.performanceCaptureConfig); - } - return message; - }; - - /** - * Creates a plain object from a Settings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.Settings - * @static - * @param {google.cloud.sql.v1beta4.Settings} message Settings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Settings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.authorizedGaeApplications = []; - object.databaseFlags = []; - object.denyMaintenancePeriods = []; - } - if (options.objects || options.defaults) - object.userLabels = {}; - if (options.defaults) { - object.settingsVersion = null; - object.tier = ""; - object.kind = ""; - object.availabilityType = options.enums === String ? "SQL_AVAILABILITY_TYPE_UNSPECIFIED" : 0; - object.pricingPlan = options.enums === String ? "SQL_PRICING_PLAN_UNSPECIFIED" : 0; - object.replicationType = options.enums === String ? "SQL_REPLICATION_TYPE_UNSPECIFIED" : 0; - object.storageAutoResizeLimit = null; - object.activationPolicy = options.enums === String ? "SQL_ACTIVATION_POLICY_UNSPECIFIED" : 0; - object.ipConfiguration = null; - object.storageAutoResize = null; - object.locationPreference = null; - object.dataDiskType = options.enums === String ? "SQL_DATA_DISK_TYPE_UNSPECIFIED" : 0; - object.maintenanceWindow = null; - object.backupConfiguration = null; - object.databaseReplicationEnabled = null; - object.crashSafeReplicationEnabled = null; - object.dataDiskSizeGb = null; - object.activeDirectoryConfig = null; - object.collation = ""; - object.insightsConfig = null; - object.passwordValidationPolicy = null; - object.sqlServerAuditConfig = null; - object.connectorEnforcement = options.enums === String ? "CONNECTOR_ENFORCEMENT_UNSPECIFIED" : 0; - object.deletionProtectionEnabled = null; - object.timeZone = ""; - object.advancedMachineFeatures = null; - object.dataCacheConfig = null; - object.edition = options.enums === String ? "EDITION_UNSPECIFIED" : 0; - object.replicationLagMaxSeconds = null; - object.enableGoogleMlIntegration = null; - object.enableDataplexIntegration = null; - object.retainBackupsOnDelete = null; - object.entraidConfig = null; - object.performanceCaptureConfig = null; - } - if (message.settingsVersion != null && message.hasOwnProperty("settingsVersion")) - object.settingsVersion = $root.google.protobuf.Int64Value.toObject(message.settingsVersion, options); - if (message.authorizedGaeApplications && message.authorizedGaeApplications.length) { - object.authorizedGaeApplications = []; - for (var j = 0; j < message.authorizedGaeApplications.length; ++j) - object.authorizedGaeApplications[j] = message.authorizedGaeApplications[j]; - } - if (message.tier != null && message.hasOwnProperty("tier")) - object.tier = message.tier; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - var keys2; - if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { - object.userLabels = {}; - for (var j = 0; j < keys2.length; ++j) - object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; - } - if (message.availabilityType != null && message.hasOwnProperty("availabilityType")) - object.availabilityType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlAvailabilityType[message.availabilityType] === undefined ? message.availabilityType : $root.google.cloud.sql.v1beta4.SqlAvailabilityType[message.availabilityType] : message.availabilityType; - if (message.pricingPlan != null && message.hasOwnProperty("pricingPlan")) - object.pricingPlan = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlPricingPlan[message.pricingPlan] === undefined ? message.pricingPlan : $root.google.cloud.sql.v1beta4.SqlPricingPlan[message.pricingPlan] : message.pricingPlan; - if (message.replicationType != null && message.hasOwnProperty("replicationType")) - object.replicationType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlReplicationType[message.replicationType] === undefined ? message.replicationType : $root.google.cloud.sql.v1beta4.SqlReplicationType[message.replicationType] : message.replicationType; - if (message.storageAutoResizeLimit != null && message.hasOwnProperty("storageAutoResizeLimit")) - object.storageAutoResizeLimit = $root.google.protobuf.Int64Value.toObject(message.storageAutoResizeLimit, options); - if (message.activationPolicy != null && message.hasOwnProperty("activationPolicy")) - object.activationPolicy = options.enums === String ? $root.google.cloud.sql.v1beta4.Settings.SqlActivationPolicy[message.activationPolicy] === undefined ? message.activationPolicy : $root.google.cloud.sql.v1beta4.Settings.SqlActivationPolicy[message.activationPolicy] : message.activationPolicy; - if (message.ipConfiguration != null && message.hasOwnProperty("ipConfiguration")) - object.ipConfiguration = $root.google.cloud.sql.v1beta4.IpConfiguration.toObject(message.ipConfiguration, options); - if (message.storageAutoResize != null && message.hasOwnProperty("storageAutoResize")) - object.storageAutoResize = $root.google.protobuf.BoolValue.toObject(message.storageAutoResize, options); - if (message.locationPreference != null && message.hasOwnProperty("locationPreference")) - object.locationPreference = $root.google.cloud.sql.v1beta4.LocationPreference.toObject(message.locationPreference, options); - if (message.databaseFlags && message.databaseFlags.length) { - object.databaseFlags = []; - for (var j = 0; j < message.databaseFlags.length; ++j) - object.databaseFlags[j] = $root.google.cloud.sql.v1beta4.DatabaseFlags.toObject(message.databaseFlags[j], options); - } - if (message.dataDiskType != null && message.hasOwnProperty("dataDiskType")) - object.dataDiskType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDataDiskType[message.dataDiskType] === undefined ? message.dataDiskType : $root.google.cloud.sql.v1beta4.SqlDataDiskType[message.dataDiskType] : message.dataDiskType; - if (message.maintenanceWindow != null && message.hasOwnProperty("maintenanceWindow")) - object.maintenanceWindow = $root.google.cloud.sql.v1beta4.MaintenanceWindow.toObject(message.maintenanceWindow, options); - if (message.backupConfiguration != null && message.hasOwnProperty("backupConfiguration")) - object.backupConfiguration = $root.google.cloud.sql.v1beta4.BackupConfiguration.toObject(message.backupConfiguration, options); - if (message.databaseReplicationEnabled != null && message.hasOwnProperty("databaseReplicationEnabled")) - object.databaseReplicationEnabled = $root.google.protobuf.BoolValue.toObject(message.databaseReplicationEnabled, options); - if (message.crashSafeReplicationEnabled != null && message.hasOwnProperty("crashSafeReplicationEnabled")) - object.crashSafeReplicationEnabled = $root.google.protobuf.BoolValue.toObject(message.crashSafeReplicationEnabled, options); - if (message.dataDiskSizeGb != null && message.hasOwnProperty("dataDiskSizeGb")) - object.dataDiskSizeGb = $root.google.protobuf.Int64Value.toObject(message.dataDiskSizeGb, options); - if (message.activeDirectoryConfig != null && message.hasOwnProperty("activeDirectoryConfig")) - object.activeDirectoryConfig = $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.toObject(message.activeDirectoryConfig, options); - if (message.collation != null && message.hasOwnProperty("collation")) - object.collation = message.collation; - if (message.denyMaintenancePeriods && message.denyMaintenancePeriods.length) { - object.denyMaintenancePeriods = []; - for (var j = 0; j < message.denyMaintenancePeriods.length; ++j) - object.denyMaintenancePeriods[j] = $root.google.cloud.sql.v1beta4.DenyMaintenancePeriod.toObject(message.denyMaintenancePeriods[j], options); - } - if (message.insightsConfig != null && message.hasOwnProperty("insightsConfig")) - object.insightsConfig = $root.google.cloud.sql.v1beta4.InsightsConfig.toObject(message.insightsConfig, options); - if (message.passwordValidationPolicy != null && message.hasOwnProperty("passwordValidationPolicy")) - object.passwordValidationPolicy = $root.google.cloud.sql.v1beta4.PasswordValidationPolicy.toObject(message.passwordValidationPolicy, options); - if (message.sqlServerAuditConfig != null && message.hasOwnProperty("sqlServerAuditConfig")) - object.sqlServerAuditConfig = $root.google.cloud.sql.v1beta4.SqlServerAuditConfig.toObject(message.sqlServerAuditConfig, options); - if (message.connectorEnforcement != null && message.hasOwnProperty("connectorEnforcement")) - object.connectorEnforcement = options.enums === String ? $root.google.cloud.sql.v1beta4.Settings.ConnectorEnforcement[message.connectorEnforcement] === undefined ? message.connectorEnforcement : $root.google.cloud.sql.v1beta4.Settings.ConnectorEnforcement[message.connectorEnforcement] : message.connectorEnforcement; - if (message.deletionProtectionEnabled != null && message.hasOwnProperty("deletionProtectionEnabled")) - object.deletionProtectionEnabled = $root.google.protobuf.BoolValue.toObject(message.deletionProtectionEnabled, options); - if (message.timeZone != null && message.hasOwnProperty("timeZone")) - object.timeZone = message.timeZone; - if (message.advancedMachineFeatures != null && message.hasOwnProperty("advancedMachineFeatures")) - object.advancedMachineFeatures = $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures.toObject(message.advancedMachineFeatures, options); - if (message.dataCacheConfig != null && message.hasOwnProperty("dataCacheConfig")) - object.dataCacheConfig = $root.google.cloud.sql.v1beta4.DataCacheConfig.toObject(message.dataCacheConfig, options); - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.cloud.sql.v1beta4.Settings.Edition[message.edition] === undefined ? message.edition : $root.google.cloud.sql.v1beta4.Settings.Edition[message.edition] : message.edition; - if (message.replicationLagMaxSeconds != null && message.hasOwnProperty("replicationLagMaxSeconds")) - object.replicationLagMaxSeconds = $root.google.protobuf.Int32Value.toObject(message.replicationLagMaxSeconds, options); - if (message.enableGoogleMlIntegration != null && message.hasOwnProperty("enableGoogleMlIntegration")) - object.enableGoogleMlIntegration = $root.google.protobuf.BoolValue.toObject(message.enableGoogleMlIntegration, options); - if (message.enableDataplexIntegration != null && message.hasOwnProperty("enableDataplexIntegration")) - object.enableDataplexIntegration = $root.google.protobuf.BoolValue.toObject(message.enableDataplexIntegration, options); - if (message.retainBackupsOnDelete != null && message.hasOwnProperty("retainBackupsOnDelete")) - object.retainBackupsOnDelete = $root.google.protobuf.BoolValue.toObject(message.retainBackupsOnDelete, options); - if (message.dataDiskProvisionedIops != null && message.hasOwnProperty("dataDiskProvisionedIops")) { - if (typeof message.dataDiskProvisionedIops === "number") - object.dataDiskProvisionedIops = options.longs === String ? String(message.dataDiskProvisionedIops) : message.dataDiskProvisionedIops; - else - object.dataDiskProvisionedIops = options.longs === String ? $util.Long.prototype.toString.call(message.dataDiskProvisionedIops) : options.longs === Number ? new $util.LongBits(message.dataDiskProvisionedIops.low >>> 0, message.dataDiskProvisionedIops.high >>> 0).toNumber() : message.dataDiskProvisionedIops; - if (options.oneofs) - object._dataDiskProvisionedIops = "dataDiskProvisionedIops"; - } - if (message.dataDiskProvisionedThroughput != null && message.hasOwnProperty("dataDiskProvisionedThroughput")) { - if (typeof message.dataDiskProvisionedThroughput === "number") - object.dataDiskProvisionedThroughput = options.longs === String ? String(message.dataDiskProvisionedThroughput) : message.dataDiskProvisionedThroughput; - else - object.dataDiskProvisionedThroughput = options.longs === String ? $util.Long.prototype.toString.call(message.dataDiskProvisionedThroughput) : options.longs === Number ? new $util.LongBits(message.dataDiskProvisionedThroughput.low >>> 0, message.dataDiskProvisionedThroughput.high >>> 0).toNumber() : message.dataDiskProvisionedThroughput; - if (options.oneofs) - object._dataDiskProvisionedThroughput = "dataDiskProvisionedThroughput"; - } - if (message.connectionPoolConfig != null && message.hasOwnProperty("connectionPoolConfig")) { - object.connectionPoolConfig = $root.google.cloud.sql.v1beta4.ConnectionPoolConfig.toObject(message.connectionPoolConfig, options); - if (options.oneofs) - object._connectionPoolConfig = "connectionPoolConfig"; - } - if (message.finalBackupConfig != null && message.hasOwnProperty("finalBackupConfig")) { - object.finalBackupConfig = $root.google.cloud.sql.v1beta4.FinalBackupConfig.toObject(message.finalBackupConfig, options); - if (options.oneofs) - object._finalBackupConfig = "finalBackupConfig"; - } - if (message.readPoolAutoScaleConfig != null && message.hasOwnProperty("readPoolAutoScaleConfig")) { - object.readPoolAutoScaleConfig = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.toObject(message.readPoolAutoScaleConfig, options); - if (options.oneofs) - object._readPoolAutoScaleConfig = "readPoolAutoScaleConfig"; - } - if (message.autoUpgradeEnabled != null && message.hasOwnProperty("autoUpgradeEnabled")) { - object.autoUpgradeEnabled = message.autoUpgradeEnabled; - if (options.oneofs) - object._autoUpgradeEnabled = "autoUpgradeEnabled"; - } - if (message.entraidConfig != null && message.hasOwnProperty("entraidConfig")) - object.entraidConfig = $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig.toObject(message.entraidConfig, options); - if (message.dataApiAccess != null && message.hasOwnProperty("dataApiAccess")) { - object.dataApiAccess = options.enums === String ? $root.google.cloud.sql.v1beta4.Settings.DataApiAccess[message.dataApiAccess] === undefined ? message.dataApiAccess : $root.google.cloud.sql.v1beta4.Settings.DataApiAccess[message.dataApiAccess] : message.dataApiAccess; - if (options.oneofs) - object._dataApiAccess = "dataApiAccess"; - } - if (message.performanceCaptureConfig != null && message.hasOwnProperty("performanceCaptureConfig")) - object.performanceCaptureConfig = $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig.toObject(message.performanceCaptureConfig, options); - return object; - }; - - /** - * Converts this Settings to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.Settings - * @instance - * @returns {Object.} JSON object - */ - Settings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Settings - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.Settings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Settings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.Settings"; - }; - - /** - * SqlActivationPolicy enum. - * @name google.cloud.sql.v1beta4.Settings.SqlActivationPolicy - * @enum {number} - * @property {number} SQL_ACTIVATION_POLICY_UNSPECIFIED=0 SQL_ACTIVATION_POLICY_UNSPECIFIED value - * @property {number} ALWAYS=1 ALWAYS value - * @property {number} NEVER=2 NEVER value - * @property {number} ON_DEMAND=3 ON_DEMAND value - */ - Settings.SqlActivationPolicy = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_ACTIVATION_POLICY_UNSPECIFIED"] = 0; - values[valuesById[1] = "ALWAYS"] = 1; - values[valuesById[2] = "NEVER"] = 2; - values[valuesById[3] = "ON_DEMAND"] = 3; - return values; - })(); - - /** - * Edition enum. - * @name google.cloud.sql.v1beta4.Settings.Edition - * @enum {number} - * @property {number} EDITION_UNSPECIFIED=0 EDITION_UNSPECIFIED value - * @property {number} ENTERPRISE=2 ENTERPRISE value - * @property {number} ENTERPRISE_PLUS=3 ENTERPRISE_PLUS value - */ - Settings.Edition = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "EDITION_UNSPECIFIED"] = 0; - values[valuesById[2] = "ENTERPRISE"] = 2; - values[valuesById[3] = "ENTERPRISE_PLUS"] = 3; - return values; - })(); - - /** - * ConnectorEnforcement enum. - * @name google.cloud.sql.v1beta4.Settings.ConnectorEnforcement - * @enum {number} - * @property {number} CONNECTOR_ENFORCEMENT_UNSPECIFIED=0 CONNECTOR_ENFORCEMENT_UNSPECIFIED value - * @property {number} NOT_REQUIRED=1 NOT_REQUIRED value - * @property {number} REQUIRED=2 REQUIRED value - */ - Settings.ConnectorEnforcement = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CONNECTOR_ENFORCEMENT_UNSPECIFIED"] = 0; - values[valuesById[1] = "NOT_REQUIRED"] = 1; - values[valuesById[2] = "REQUIRED"] = 2; - return values; - })(); - - /** - * DataApiAccess enum. - * @name google.cloud.sql.v1beta4.Settings.DataApiAccess - * @enum {number} - * @property {number} DATA_API_ACCESS_UNSPECIFIED=0 DATA_API_ACCESS_UNSPECIFIED value - * @property {number} DISALLOW_DATA_API=1 DISALLOW_DATA_API value - * @property {number} ALLOW_DATA_API=2 ALLOW_DATA_API value - */ - Settings.DataApiAccess = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DATA_API_ACCESS_UNSPECIFIED"] = 0; - values[valuesById[1] = "DISALLOW_DATA_API"] = 1; - values[valuesById[2] = "ALLOW_DATA_API"] = 2; - return values; - })(); - - return Settings; - })(); - - v1beta4.PerformanceCaptureConfig = (function() { - - /** - * Properties of a PerformanceCaptureConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IPerformanceCaptureConfig - * @property {boolean|null} [enabled] PerformanceCaptureConfig enabled - * @property {number|null} [probingIntervalSeconds] PerformanceCaptureConfig probingIntervalSeconds - * @property {number|null} [probeThreshold] PerformanceCaptureConfig probeThreshold - * @property {number|null} [runningThreadsThreshold] PerformanceCaptureConfig runningThreadsThreshold - * @property {number|null} [secondsBehindSourceThreshold] PerformanceCaptureConfig secondsBehindSourceThreshold - * @property {number|null} [transactionDurationThreshold] PerformanceCaptureConfig transactionDurationThreshold - */ - - /** - * Constructs a new PerformanceCaptureConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a PerformanceCaptureConfig. - * @implements IPerformanceCaptureConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IPerformanceCaptureConfig=} [properties] Properties to set - */ - function PerformanceCaptureConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PerformanceCaptureConfig enabled. - * @member {boolean|null|undefined} enabled - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.enabled = null; - - /** - * PerformanceCaptureConfig probingIntervalSeconds. - * @member {number|null|undefined} probingIntervalSeconds - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.probingIntervalSeconds = null; - - /** - * PerformanceCaptureConfig probeThreshold. - * @member {number|null|undefined} probeThreshold - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.probeThreshold = null; - - /** - * PerformanceCaptureConfig runningThreadsThreshold. - * @member {number|null|undefined} runningThreadsThreshold - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.runningThreadsThreshold = null; - - /** - * PerformanceCaptureConfig secondsBehindSourceThreshold. - * @member {number|null|undefined} secondsBehindSourceThreshold - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.secondsBehindSourceThreshold = null; - - /** - * PerformanceCaptureConfig transactionDurationThreshold. - * @member {number|null|undefined} transactionDurationThreshold - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @instance - */ - PerformanceCaptureConfig.prototype.transactionDurationThreshold = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_enabled", { - get: $util.oneOfGetter($oneOfFields = ["enabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_probingIntervalSeconds", { - get: $util.oneOfGetter($oneOfFields = ["probingIntervalSeconds"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_probeThreshold", { - get: $util.oneOfGetter($oneOfFields = ["probeThreshold"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_runningThreadsThreshold", { - get: $util.oneOfGetter($oneOfFields = ["runningThreadsThreshold"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_secondsBehindSourceThreshold", { - get: $util.oneOfGetter($oneOfFields = ["secondsBehindSourceThreshold"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(PerformanceCaptureConfig.prototype, "_transactionDurationThreshold", { - get: $util.oneOfGetter($oneOfFields = ["transactionDurationThreshold"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new PerformanceCaptureConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @static - * @param {google.cloud.sql.v1beta4.IPerformanceCaptureConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.PerformanceCaptureConfig} PerformanceCaptureConfig instance - */ - PerformanceCaptureConfig.create = function create(properties) { - return new PerformanceCaptureConfig(properties); - }; - - /** - * Encodes the specified PerformanceCaptureConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.PerformanceCaptureConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @static - * @param {google.cloud.sql.v1beta4.IPerformanceCaptureConfig} message PerformanceCaptureConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PerformanceCaptureConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); - if (message.probingIntervalSeconds != null && Object.hasOwnProperty.call(message, "probingIntervalSeconds")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.probingIntervalSeconds); - if (message.probeThreshold != null && Object.hasOwnProperty.call(message, "probeThreshold")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.probeThreshold); - if (message.runningThreadsThreshold != null && Object.hasOwnProperty.call(message, "runningThreadsThreshold")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.runningThreadsThreshold); - if (message.secondsBehindSourceThreshold != null && Object.hasOwnProperty.call(message, "secondsBehindSourceThreshold")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.secondsBehindSourceThreshold); - if (message.transactionDurationThreshold != null && Object.hasOwnProperty.call(message, "transactionDurationThreshold")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.transactionDurationThreshold); - return writer; - }; - - /** - * Encodes the specified PerformanceCaptureConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PerformanceCaptureConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @static - * @param {google.cloud.sql.v1beta4.IPerformanceCaptureConfig} message PerformanceCaptureConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PerformanceCaptureConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PerformanceCaptureConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.PerformanceCaptureConfig} PerformanceCaptureConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PerformanceCaptureConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.enabled = reader.bool(); - break; - } - case 2: { - message.probingIntervalSeconds = reader.int32(); - break; - } - case 3: { - message.probeThreshold = reader.int32(); - break; - } - case 4: { - message.runningThreadsThreshold = reader.int32(); - break; - } - case 5: { - message.secondsBehindSourceThreshold = reader.int32(); - break; - } - case 8: { - message.transactionDurationThreshold = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PerformanceCaptureConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.PerformanceCaptureConfig} PerformanceCaptureConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PerformanceCaptureConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PerformanceCaptureConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PerformanceCaptureConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - properties._enabled = 1; - if (typeof message.enabled !== "boolean") - return "enabled: boolean expected"; - } - if (message.probingIntervalSeconds != null && message.hasOwnProperty("probingIntervalSeconds")) { - properties._probingIntervalSeconds = 1; - if (!$util.isInteger(message.probingIntervalSeconds)) - return "probingIntervalSeconds: integer expected"; - } - if (message.probeThreshold != null && message.hasOwnProperty("probeThreshold")) { - properties._probeThreshold = 1; - if (!$util.isInteger(message.probeThreshold)) - return "probeThreshold: integer expected"; - } - if (message.runningThreadsThreshold != null && message.hasOwnProperty("runningThreadsThreshold")) { - properties._runningThreadsThreshold = 1; - if (!$util.isInteger(message.runningThreadsThreshold)) - return "runningThreadsThreshold: integer expected"; - } - if (message.secondsBehindSourceThreshold != null && message.hasOwnProperty("secondsBehindSourceThreshold")) { - properties._secondsBehindSourceThreshold = 1; - if (!$util.isInteger(message.secondsBehindSourceThreshold)) - return "secondsBehindSourceThreshold: integer expected"; - } - if (message.transactionDurationThreshold != null && message.hasOwnProperty("transactionDurationThreshold")) { - properties._transactionDurationThreshold = 1; - if (!$util.isInteger(message.transactionDurationThreshold)) - return "transactionDurationThreshold: integer expected"; - } - return null; - }; - - /** - * Creates a PerformanceCaptureConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.PerformanceCaptureConfig} PerformanceCaptureConfig - */ - PerformanceCaptureConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.PerformanceCaptureConfig(); - if (object.enabled != null) - message.enabled = Boolean(object.enabled); - if (object.probingIntervalSeconds != null) - message.probingIntervalSeconds = object.probingIntervalSeconds | 0; - if (object.probeThreshold != null) - message.probeThreshold = object.probeThreshold | 0; - if (object.runningThreadsThreshold != null) - message.runningThreadsThreshold = object.runningThreadsThreshold | 0; - if (object.secondsBehindSourceThreshold != null) - message.secondsBehindSourceThreshold = object.secondsBehindSourceThreshold | 0; - if (object.transactionDurationThreshold != null) - message.transactionDurationThreshold = object.transactionDurationThreshold | 0; - return message; - }; - - /** - * Creates a plain object from a PerformanceCaptureConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @static - * @param {google.cloud.sql.v1beta4.PerformanceCaptureConfig} message PerformanceCaptureConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PerformanceCaptureConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - object.enabled = message.enabled; - if (options.oneofs) - object._enabled = "enabled"; - } - if (message.probingIntervalSeconds != null && message.hasOwnProperty("probingIntervalSeconds")) { - object.probingIntervalSeconds = message.probingIntervalSeconds; - if (options.oneofs) - object._probingIntervalSeconds = "probingIntervalSeconds"; - } - if (message.probeThreshold != null && message.hasOwnProperty("probeThreshold")) { - object.probeThreshold = message.probeThreshold; - if (options.oneofs) - object._probeThreshold = "probeThreshold"; - } - if (message.runningThreadsThreshold != null && message.hasOwnProperty("runningThreadsThreshold")) { - object.runningThreadsThreshold = message.runningThreadsThreshold; - if (options.oneofs) - object._runningThreadsThreshold = "runningThreadsThreshold"; - } - if (message.secondsBehindSourceThreshold != null && message.hasOwnProperty("secondsBehindSourceThreshold")) { - object.secondsBehindSourceThreshold = message.secondsBehindSourceThreshold; - if (options.oneofs) - object._secondsBehindSourceThreshold = "secondsBehindSourceThreshold"; - } - if (message.transactionDurationThreshold != null && message.hasOwnProperty("transactionDurationThreshold")) { - object.transactionDurationThreshold = message.transactionDurationThreshold; - if (options.oneofs) - object._transactionDurationThreshold = "transactionDurationThreshold"; - } - return object; - }; - - /** - * Converts this PerformanceCaptureConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @instance - * @returns {Object.} JSON object - */ - PerformanceCaptureConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PerformanceCaptureConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.PerformanceCaptureConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PerformanceCaptureConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.PerformanceCaptureConfig"; - }; - - return PerformanceCaptureConfig; - })(); - - v1beta4.AdvancedMachineFeatures = (function() { - - /** - * Properties of an AdvancedMachineFeatures. - * @memberof google.cloud.sql.v1beta4 - * @interface IAdvancedMachineFeatures - * @property {number|null} [threadsPerCore] AdvancedMachineFeatures threadsPerCore - */ - - /** - * Constructs a new AdvancedMachineFeatures. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an AdvancedMachineFeatures. - * @implements IAdvancedMachineFeatures - * @constructor - * @param {google.cloud.sql.v1beta4.IAdvancedMachineFeatures=} [properties] Properties to set - */ - function AdvancedMachineFeatures(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AdvancedMachineFeatures threadsPerCore. - * @member {number} threadsPerCore - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @instance - */ - AdvancedMachineFeatures.prototype.threadsPerCore = 0; - - /** - * Creates a new AdvancedMachineFeatures instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @static - * @param {google.cloud.sql.v1beta4.IAdvancedMachineFeatures=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.AdvancedMachineFeatures} AdvancedMachineFeatures instance - */ - AdvancedMachineFeatures.create = function create(properties) { - return new AdvancedMachineFeatures(properties); - }; - - /** - * Encodes the specified AdvancedMachineFeatures message. Does not implicitly {@link google.cloud.sql.v1beta4.AdvancedMachineFeatures.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @static - * @param {google.cloud.sql.v1beta4.IAdvancedMachineFeatures} message AdvancedMachineFeatures message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AdvancedMachineFeatures.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.threadsPerCore != null && Object.hasOwnProperty.call(message, "threadsPerCore")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.threadsPerCore); - return writer; - }; - - /** - * Encodes the specified AdvancedMachineFeatures message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AdvancedMachineFeatures.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @static - * @param {google.cloud.sql.v1beta4.IAdvancedMachineFeatures} message AdvancedMachineFeatures message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AdvancedMachineFeatures.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AdvancedMachineFeatures message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.AdvancedMachineFeatures} AdvancedMachineFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AdvancedMachineFeatures.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.threadsPerCore = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AdvancedMachineFeatures message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.AdvancedMachineFeatures} AdvancedMachineFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AdvancedMachineFeatures.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AdvancedMachineFeatures message. - * @function verify - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AdvancedMachineFeatures.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.threadsPerCore != null && message.hasOwnProperty("threadsPerCore")) - if (!$util.isInteger(message.threadsPerCore)) - return "threadsPerCore: integer expected"; - return null; - }; - - /** - * Creates an AdvancedMachineFeatures message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.AdvancedMachineFeatures} AdvancedMachineFeatures - */ - AdvancedMachineFeatures.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures) - return object; - var message = new $root.google.cloud.sql.v1beta4.AdvancedMachineFeatures(); - if (object.threadsPerCore != null) - message.threadsPerCore = object.threadsPerCore | 0; - return message; - }; - - /** - * Creates a plain object from an AdvancedMachineFeatures message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @static - * @param {google.cloud.sql.v1beta4.AdvancedMachineFeatures} message AdvancedMachineFeatures - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AdvancedMachineFeatures.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.threadsPerCore = 0; - if (message.threadsPerCore != null && message.hasOwnProperty("threadsPerCore")) - object.threadsPerCore = message.threadsPerCore; - return object; - }; - - /** - * Converts this AdvancedMachineFeatures to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @instance - * @returns {Object.} JSON object - */ - AdvancedMachineFeatures.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AdvancedMachineFeatures - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.AdvancedMachineFeatures - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AdvancedMachineFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.AdvancedMachineFeatures"; - }; - - return AdvancedMachineFeatures; - })(); - - v1beta4.SslCert = (function() { - - /** - * Properties of a SslCert. - * @memberof google.cloud.sql.v1beta4 - * @interface ISslCert - * @property {string|null} [kind] SslCert kind - * @property {string|null} [certSerialNumber] SslCert certSerialNumber - * @property {string|null} [cert] SslCert cert - * @property {google.protobuf.ITimestamp|null} [createTime] SslCert createTime - * @property {string|null} [commonName] SslCert commonName - * @property {google.protobuf.ITimestamp|null} [expirationTime] SslCert expirationTime - * @property {string|null} [sha1Fingerprint] SslCert sha1Fingerprint - * @property {string|null} [instance] SslCert instance - * @property {string|null} [selfLink] SslCert selfLink - */ - - /** - * Constructs a new SslCert. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SslCert. - * @implements ISslCert - * @constructor - * @param {google.cloud.sql.v1beta4.ISslCert=} [properties] Properties to set - */ - function SslCert(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCert kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.SslCert - * @instance - */ - SslCert.prototype.kind = ""; - - /** - * SslCert certSerialNumber. - * @member {string} certSerialNumber - * @memberof google.cloud.sql.v1beta4.SslCert - * @instance - */ - SslCert.prototype.certSerialNumber = ""; - - /** - * SslCert cert. - * @member {string} cert - * @memberof google.cloud.sql.v1beta4.SslCert - * @instance - */ - SslCert.prototype.cert = ""; - - /** - * SslCert createTime. - * @member {google.protobuf.ITimestamp|null|undefined} createTime - * @memberof google.cloud.sql.v1beta4.SslCert - * @instance - */ - SslCert.prototype.createTime = null; - - /** - * SslCert commonName. - * @member {string} commonName - * @memberof google.cloud.sql.v1beta4.SslCert - * @instance - */ - SslCert.prototype.commonName = ""; - - /** - * SslCert expirationTime. - * @member {google.protobuf.ITimestamp|null|undefined} expirationTime - * @memberof google.cloud.sql.v1beta4.SslCert - * @instance - */ - SslCert.prototype.expirationTime = null; - - /** - * SslCert sha1Fingerprint. - * @member {string} sha1Fingerprint - * @memberof google.cloud.sql.v1beta4.SslCert - * @instance - */ - SslCert.prototype.sha1Fingerprint = ""; - - /** - * SslCert instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SslCert - * @instance - */ - SslCert.prototype.instance = ""; - - /** - * SslCert selfLink. - * @member {string} selfLink - * @memberof google.cloud.sql.v1beta4.SslCert - * @instance - */ - SslCert.prototype.selfLink = ""; - - /** - * Creates a new SslCert instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SslCert - * @static - * @param {google.cloud.sql.v1beta4.ISslCert=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SslCert} SslCert instance - */ - SslCert.create = function create(properties) { - return new SslCert(properties); - }; - - /** - * Encodes the specified SslCert message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCert.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SslCert - * @static - * @param {google.cloud.sql.v1beta4.ISslCert} message SslCert message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCert.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.certSerialNumber != null && Object.hasOwnProperty.call(message, "certSerialNumber")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.certSerialNumber); - if (message.cert != null && Object.hasOwnProperty.call(message, "cert")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.cert); - if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) - $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.commonName != null && Object.hasOwnProperty.call(message, "commonName")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.commonName); - if (message.expirationTime != null && Object.hasOwnProperty.call(message, "expirationTime")) - $root.google.protobuf.Timestamp.encode(message.expirationTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.sha1Fingerprint != null && Object.hasOwnProperty.call(message, "sha1Fingerprint")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.sha1Fingerprint); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.instance); - if (message.selfLink != null && Object.hasOwnProperty.call(message, "selfLink")) - writer.uint32(/* id 9, wireType 2 =*/74).string(message.selfLink); - return writer; - }; - - /** - * Encodes the specified SslCert message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCert.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCert - * @static - * @param {google.cloud.sql.v1beta4.ISslCert} message SslCert message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCert.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCert message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SslCert - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SslCert} SslCert - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCert.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCert(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.certSerialNumber = reader.string(); - break; - } - case 3: { - message.cert = reader.string(); - break; - } - case 4: { - message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 5: { - message.commonName = reader.string(); - break; - } - case 6: { - message.expirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 7: { - message.sha1Fingerprint = reader.string(); - break; - } - case 8: { - message.instance = reader.string(); - break; - } - case 9: { - message.selfLink = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCert message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCert - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SslCert} SslCert - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCert.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCert message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SslCert - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCert.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.certSerialNumber != null && message.hasOwnProperty("certSerialNumber")) - if (!$util.isString(message.certSerialNumber)) - return "certSerialNumber: string expected"; - if (message.cert != null && message.hasOwnProperty("cert")) - if (!$util.isString(message.cert)) - return "cert: string expected"; - if (message.createTime != null && message.hasOwnProperty("createTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.createTime); - if (error) - return "createTime." + error; - } - if (message.commonName != null && message.hasOwnProperty("commonName")) - if (!$util.isString(message.commonName)) - return "commonName: string expected"; - if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.expirationTime); - if (error) - return "expirationTime." + error; - } - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - if (!$util.isString(message.sha1Fingerprint)) - return "sha1Fingerprint: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - if (!$util.isString(message.selfLink)) - return "selfLink: string expected"; - return null; - }; - - /** - * Creates a SslCert message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SslCert - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SslCert} SslCert - */ - SslCert.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SslCert) - return object; - var message = new $root.google.cloud.sql.v1beta4.SslCert(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.certSerialNumber != null) - message.certSerialNumber = String(object.certSerialNumber); - if (object.cert != null) - message.cert = String(object.cert); - if (object.createTime != null) { - if (typeof object.createTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SslCert.createTime: object expected"); - message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); - } - if (object.commonName != null) - message.commonName = String(object.commonName); - if (object.expirationTime != null) { - if (typeof object.expirationTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SslCert.expirationTime: object expected"); - message.expirationTime = $root.google.protobuf.Timestamp.fromObject(object.expirationTime); - } - if (object.sha1Fingerprint != null) - message.sha1Fingerprint = String(object.sha1Fingerprint); - if (object.instance != null) - message.instance = String(object.instance); - if (object.selfLink != null) - message.selfLink = String(object.selfLink); - return message; - }; - - /** - * Creates a plain object from a SslCert message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SslCert - * @static - * @param {google.cloud.sql.v1beta4.SslCert} message SslCert - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCert.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.certSerialNumber = ""; - object.cert = ""; - object.createTime = null; - object.commonName = ""; - object.expirationTime = null; - object.sha1Fingerprint = ""; - object.instance = ""; - object.selfLink = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.certSerialNumber != null && message.hasOwnProperty("certSerialNumber")) - object.certSerialNumber = message.certSerialNumber; - if (message.cert != null && message.hasOwnProperty("cert")) - object.cert = message.cert; - if (message.createTime != null && message.hasOwnProperty("createTime")) - object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); - if (message.commonName != null && message.hasOwnProperty("commonName")) - object.commonName = message.commonName; - if (message.expirationTime != null && message.hasOwnProperty("expirationTime")) - object.expirationTime = $root.google.protobuf.Timestamp.toObject(message.expirationTime, options); - if (message.sha1Fingerprint != null && message.hasOwnProperty("sha1Fingerprint")) - object.sha1Fingerprint = message.sha1Fingerprint; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.selfLink != null && message.hasOwnProperty("selfLink")) - object.selfLink = message.selfLink; - return object; - }; - - /** - * Converts this SslCert to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SslCert - * @instance - * @returns {Object.} JSON object - */ - SslCert.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCert - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SslCert - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCert.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCert"; - }; - - return SslCert; - })(); - - v1beta4.SslCertDetail = (function() { - - /** - * Properties of a SslCertDetail. - * @memberof google.cloud.sql.v1beta4 - * @interface ISslCertDetail - * @property {google.cloud.sql.v1beta4.ISslCert|null} [certInfo] SslCertDetail certInfo - * @property {string|null} [certPrivateKey] SslCertDetail certPrivateKey - */ - - /** - * Constructs a new SslCertDetail. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SslCertDetail. - * @implements ISslCertDetail - * @constructor - * @param {google.cloud.sql.v1beta4.ISslCertDetail=} [properties] Properties to set - */ - function SslCertDetail(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCertDetail certInfo. - * @member {google.cloud.sql.v1beta4.ISslCert|null|undefined} certInfo - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @instance - */ - SslCertDetail.prototype.certInfo = null; - - /** - * SslCertDetail certPrivateKey. - * @member {string} certPrivateKey - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @instance - */ - SslCertDetail.prototype.certPrivateKey = ""; - - /** - * Creates a new SslCertDetail instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @static - * @param {google.cloud.sql.v1beta4.ISslCertDetail=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SslCertDetail} SslCertDetail instance - */ - SslCertDetail.create = function create(properties) { - return new SslCertDetail(properties); - }; - - /** - * Encodes the specified SslCertDetail message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertDetail.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @static - * @param {google.cloud.sql.v1beta4.ISslCertDetail} message SslCertDetail message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertDetail.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.certInfo != null && Object.hasOwnProperty.call(message, "certInfo")) - $root.google.cloud.sql.v1beta4.SslCert.encode(message.certInfo, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.certPrivateKey != null && Object.hasOwnProperty.call(message, "certPrivateKey")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.certPrivateKey); - return writer; - }; - - /** - * Encodes the specified SslCertDetail message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertDetail.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @static - * @param {google.cloud.sql.v1beta4.ISslCertDetail} message SslCertDetail message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertDetail.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCertDetail message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SslCertDetail} SslCertDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertDetail.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCertDetail(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.certInfo = $root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32()); - break; - } - case 2: { - message.certPrivateKey = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCertDetail message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SslCertDetail} SslCertDetail - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertDetail.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCertDetail message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCertDetail.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.certInfo != null && message.hasOwnProperty("certInfo")) { - var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.certInfo); - if (error) - return "certInfo." + error; - } - if (message.certPrivateKey != null && message.hasOwnProperty("certPrivateKey")) - if (!$util.isString(message.certPrivateKey)) - return "certPrivateKey: string expected"; - return null; - }; - - /** - * Creates a SslCertDetail message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SslCertDetail} SslCertDetail - */ - SslCertDetail.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SslCertDetail) - return object; - var message = new $root.google.cloud.sql.v1beta4.SslCertDetail(); - if (object.certInfo != null) { - if (typeof object.certInfo !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SslCertDetail.certInfo: object expected"); - message.certInfo = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.certInfo); - } - if (object.certPrivateKey != null) - message.certPrivateKey = String(object.certPrivateKey); - return message; - }; - - /** - * Creates a plain object from a SslCertDetail message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @static - * @param {google.cloud.sql.v1beta4.SslCertDetail} message SslCertDetail - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCertDetail.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.certInfo = null; - object.certPrivateKey = ""; - } - if (message.certInfo != null && message.hasOwnProperty("certInfo")) - object.certInfo = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.certInfo, options); - if (message.certPrivateKey != null && message.hasOwnProperty("certPrivateKey")) - object.certPrivateKey = message.certPrivateKey; - return object; - }; - - /** - * Converts this SslCertDetail to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @instance - * @returns {Object.} JSON object - */ - SslCertDetail.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCertDetail - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SslCertDetail - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCertDetail.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCertDetail"; - }; - - return SslCertDetail; - })(); - - v1beta4.SslCertsCreateEphemeralRequest = (function() { - - /** - * Properties of a SslCertsCreateEphemeralRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISslCertsCreateEphemeralRequest - * @property {string|null} [publicKey] SslCertsCreateEphemeralRequest publicKey - * @property {string|null} [accessToken] SslCertsCreateEphemeralRequest accessToken - */ - - /** - * Constructs a new SslCertsCreateEphemeralRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SslCertsCreateEphemeralRequest. - * @implements ISslCertsCreateEphemeralRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest=} [properties] Properties to set - */ - function SslCertsCreateEphemeralRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCertsCreateEphemeralRequest publicKey. - * @member {string} publicKey - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @instance - */ - SslCertsCreateEphemeralRequest.prototype.publicKey = ""; - - /** - * SslCertsCreateEphemeralRequest accessToken. - * @member {string} accessToken - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @instance - */ - SslCertsCreateEphemeralRequest.prototype.accessToken = ""; - - /** - * Creates a new SslCertsCreateEphemeralRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest instance - */ - SslCertsCreateEphemeralRequest.create = function create(properties) { - return new SslCertsCreateEphemeralRequest(properties); - }; - - /** - * Encodes the specified SslCertsCreateEphemeralRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsCreateEphemeralRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.publicKey); - if (message.accessToken != null && Object.hasOwnProperty.call(message, "accessToken")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.accessToken); - return writer; - }; - - /** - * Encodes the specified SslCertsCreateEphemeralRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsCreateEphemeralRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsCreateEphemeralRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.publicKey = reader.string(); - break; - } - case 2: { - message.accessToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCertsCreateEphemeralRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsCreateEphemeralRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCertsCreateEphemeralRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCertsCreateEphemeralRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.publicKey != null && message.hasOwnProperty("publicKey")) - if (!$util.isString(message.publicKey)) - return "publicKey: string expected"; - if (message.accessToken != null && message.hasOwnProperty("accessToken")) - if (!$util.isString(message.accessToken)) - return "accessToken: string expected"; - return null; - }; - - /** - * Creates a SslCertsCreateEphemeralRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} SslCertsCreateEphemeralRequest - */ - SslCertsCreateEphemeralRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest(); - if (object.publicKey != null) - message.publicKey = String(object.publicKey); - if (object.accessToken != null) - message.accessToken = String(object.accessToken); - return message; - }; - - /** - * Creates a plain object from a SslCertsCreateEphemeralRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @static - * @param {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} message SslCertsCreateEphemeralRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCertsCreateEphemeralRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.publicKey = ""; - object.accessToken = ""; - } - if (message.publicKey != null && message.hasOwnProperty("publicKey")) - object.publicKey = message.publicKey; - if (message.accessToken != null && message.hasOwnProperty("accessToken")) - object.accessToken = message.accessToken; - return object; - }; - - /** - * Converts this SslCertsCreateEphemeralRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @instance - * @returns {Object.} JSON object - */ - SslCertsCreateEphemeralRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCertsCreateEphemeralRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCertsCreateEphemeralRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest"; - }; - - return SslCertsCreateEphemeralRequest; - })(); - - v1beta4.SslCertsInsertRequest = (function() { - - /** - * Properties of a SslCertsInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISslCertsInsertRequest - * @property {string|null} [commonName] SslCertsInsertRequest commonName - */ - - /** - * Constructs a new SslCertsInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SslCertsInsertRequest. - * @implements ISslCertsInsertRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISslCertsInsertRequest=} [properties] Properties to set - */ - function SslCertsInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCertsInsertRequest commonName. - * @member {string} commonName - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @instance - */ - SslCertsInsertRequest.prototype.commonName = ""; - - /** - * Creates a new SslCertsInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SslCertsInsertRequest} SslCertsInsertRequest instance - */ - SslCertsInsertRequest.create = function create(properties) { - return new SslCertsInsertRequest(properties); - }; - - /** - * Encodes the specified SslCertsInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsInsertRequest} message SslCertsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.commonName != null && Object.hasOwnProperty.call(message, "commonName")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.commonName); - return writer; - }; - - /** - * Encodes the specified SslCertsInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsInsertRequest} message SslCertsInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCertsInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SslCertsInsertRequest} SslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCertsInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.commonName = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCertsInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SslCertsInsertRequest} SslCertsInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCertsInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCertsInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.commonName != null && message.hasOwnProperty("commonName")) - if (!$util.isString(message.commonName)) - return "commonName: string expected"; - return null; - }; - - /** - * Creates a SslCertsInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SslCertsInsertRequest} SslCertsInsertRequest - */ - SslCertsInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SslCertsInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SslCertsInsertRequest(); - if (object.commonName != null) - message.commonName = String(object.commonName); - return message; - }; - - /** - * Creates a plain object from a SslCertsInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.SslCertsInsertRequest} message SslCertsInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCertsInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.commonName = ""; - if (message.commonName != null && message.hasOwnProperty("commonName")) - object.commonName = message.commonName; - return object; - }; - - /** - * Converts this SslCertsInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SslCertsInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCertsInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SslCertsInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCertsInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCertsInsertRequest"; - }; - - return SslCertsInsertRequest; - })(); - - v1beta4.SqlInstancesRescheduleMaintenanceRequestBody = (function() { - - /** - * Properties of a SqlInstancesRescheduleMaintenanceRequestBody. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlInstancesRescheduleMaintenanceRequestBody - * @property {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null} [reschedule] SqlInstancesRescheduleMaintenanceRequestBody reschedule - */ - - /** - * Constructs a new SqlInstancesRescheduleMaintenanceRequestBody. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlInstancesRescheduleMaintenanceRequestBody. - * @implements ISqlInstancesRescheduleMaintenanceRequestBody - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody=} [properties] Properties to set - */ - function SqlInstancesRescheduleMaintenanceRequestBody(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlInstancesRescheduleMaintenanceRequestBody reschedule. - * @member {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule|null|undefined} reschedule - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @instance - */ - SqlInstancesRescheduleMaintenanceRequestBody.prototype.reschedule = null; - - /** - * Creates a new SqlInstancesRescheduleMaintenanceRequestBody instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody instance - */ - SqlInstancesRescheduleMaintenanceRequestBody.create = function create(properties) { - return new SqlInstancesRescheduleMaintenanceRequestBody(properties); - }; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRescheduleMaintenanceRequestBody.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.reschedule != null && Object.hasOwnProperty.call(message, "reschedule")) - $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.encode(message.reschedule, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlInstancesRescheduleMaintenanceRequestBody message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlInstancesRescheduleMaintenanceRequestBody.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRescheduleMaintenanceRequestBody.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 3: { - message.reschedule = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlInstancesRescheduleMaintenanceRequestBody message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlInstancesRescheduleMaintenanceRequestBody.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlInstancesRescheduleMaintenanceRequestBody message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlInstancesRescheduleMaintenanceRequestBody.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.reschedule != null && message.hasOwnProperty("reschedule")) { - var error = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify(message.reschedule); - if (error) - return "reschedule." + error; - } - return null; - }; - - /** - * Creates a SqlInstancesRescheduleMaintenanceRequestBody message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} SqlInstancesRescheduleMaintenanceRequestBody - */ - SqlInstancesRescheduleMaintenanceRequestBody.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody(); - if (object.reschedule != null) { - if (typeof object.reschedule !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.reschedule: object expected"); - message.reschedule = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.fromObject(object.reschedule); - } - return message; - }; - - /** - * Creates a plain object from a SqlInstancesRescheduleMaintenanceRequestBody message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} message SqlInstancesRescheduleMaintenanceRequestBody - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlInstancesRescheduleMaintenanceRequestBody.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.reschedule = null; - if (message.reschedule != null && message.hasOwnProperty("reschedule")) - object.reschedule = $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.toObject(message.reschedule, options); - return object; - }; - - /** - * Converts this SqlInstancesRescheduleMaintenanceRequestBody to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @instance - * @returns {Object.} JSON object - */ - SqlInstancesRescheduleMaintenanceRequestBody.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlInstancesRescheduleMaintenanceRequestBody - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlInstancesRescheduleMaintenanceRequestBody.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody"; - }; - - /** - * RescheduleType enum. - * @name google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType - * @enum {number} - * @property {number} RESCHEDULE_TYPE_UNSPECIFIED=0 RESCHEDULE_TYPE_UNSPECIFIED value - * @property {number} IMMEDIATE=1 IMMEDIATE value - * @property {number} NEXT_AVAILABLE_WINDOW=2 NEXT_AVAILABLE_WINDOW value - * @property {number} SPECIFIC_TIME=3 SPECIFIC_TIME value - */ - SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RESCHEDULE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "IMMEDIATE"] = 1; - values[valuesById[2] = "NEXT_AVAILABLE_WINDOW"] = 2; - values[valuesById[3] = "SPECIFIC_TIME"] = 3; - return values; - })(); - - SqlInstancesRescheduleMaintenanceRequestBody.Reschedule = (function() { - - /** - * Properties of a Reschedule. - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @interface IReschedule - * @property {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType|null} [rescheduleType] Reschedule rescheduleType - * @property {google.protobuf.ITimestamp|null} [scheduleTime] Reschedule scheduleTime - */ - - /** - * Constructs a new Reschedule. - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody - * @classdesc Represents a Reschedule. - * @implements IReschedule - * @constructor - * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule=} [properties] Properties to set - */ - function Reschedule(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Reschedule rescheduleType. - * @member {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType} rescheduleType - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @instance - */ - Reschedule.prototype.rescheduleType = 0; - - /** - * Reschedule scheduleTime. - * @member {google.protobuf.ITimestamp|null|undefined} scheduleTime - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @instance - */ - Reschedule.prototype.scheduleTime = null; - - /** - * Creates a new Reschedule instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule instance - */ - Reschedule.create = function create(properties) { - return new Reschedule(properties); - }; - - /** - * Encodes the specified Reschedule message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule} message Reschedule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Reschedule.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rescheduleType != null && Object.hasOwnProperty.call(message, "rescheduleType")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.rescheduleType); - if (message.scheduleTime != null && Object.hasOwnProperty.call(message, "scheduleTime")) - $root.google.protobuf.Timestamp.encode(message.scheduleTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Reschedule message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.IReschedule} message Reschedule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Reschedule.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Reschedule message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Reschedule.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.rescheduleType = reader.int32(); - break; - } - case 2: { - message.scheduleTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Reschedule message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Reschedule.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Reschedule message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Reschedule.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rescheduleType != null && message.hasOwnProperty("rescheduleType")) - switch (message.rescheduleType) { - default: - return "rescheduleType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.scheduleTime != null && message.hasOwnProperty("scheduleTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.scheduleTime); - if (error) - return "scheduleTime." + error; - } - return null; - }; - - /** - * Creates a Reschedule message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} Reschedule - */ - Reschedule.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule(); - switch (object.rescheduleType) { - default: - if (typeof object.rescheduleType === "number") { - message.rescheduleType = object.rescheduleType; - break; - } - break; - case "RESCHEDULE_TYPE_UNSPECIFIED": - case 0: - message.rescheduleType = 0; - break; - case "IMMEDIATE": - case 1: - message.rescheduleType = 1; - break; - case "NEXT_AVAILABLE_WINDOW": - case 2: - message.rescheduleType = 2; - break; - case "SPECIFIC_TIME": - case 3: - message.rescheduleType = 3; - break; - } - if (object.scheduleTime != null) { - if (typeof object.scheduleTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule.scheduleTime: object expected"); - message.scheduleTime = $root.google.protobuf.Timestamp.fromObject(object.scheduleTime); - } - return message; - }; - - /** - * Creates a plain object from a Reschedule message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule} message Reschedule - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Reschedule.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.rescheduleType = options.enums === String ? "RESCHEDULE_TYPE_UNSPECIFIED" : 0; - object.scheduleTime = null; - } - if (message.rescheduleType != null && message.hasOwnProperty("rescheduleType")) - object.rescheduleType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType[message.rescheduleType] === undefined ? message.rescheduleType : $root.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.RescheduleType[message.rescheduleType] : message.rescheduleType; - if (message.scheduleTime != null && message.hasOwnProperty("scheduleTime")) - object.scheduleTime = $root.google.protobuf.Timestamp.toObject(message.scheduleTime, options); - return object; - }; - - /** - * Converts this Reschedule to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @instance - * @returns {Object.} JSON object - */ - Reschedule.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Reschedule - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Reschedule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody.Reschedule"; - }; - - return Reschedule; - })(); - - return SqlInstancesRescheduleMaintenanceRequestBody; - })(); - - v1beta4.SslCertsInsertResponse = (function() { - - /** - * Properties of a SslCertsInsertResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface ISslCertsInsertResponse - * @property {string|null} [kind] SslCertsInsertResponse kind - * @property {google.cloud.sql.v1beta4.IOperation|null} [operation] SslCertsInsertResponse operation - * @property {google.cloud.sql.v1beta4.ISslCert|null} [serverCaCert] SslCertsInsertResponse serverCaCert - * @property {google.cloud.sql.v1beta4.ISslCertDetail|null} [clientCert] SslCertsInsertResponse clientCert - */ - - /** - * Constructs a new SslCertsInsertResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SslCertsInsertResponse. - * @implements ISslCertsInsertResponse - * @constructor - * @param {google.cloud.sql.v1beta4.ISslCertsInsertResponse=} [properties] Properties to set - */ - function SslCertsInsertResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCertsInsertResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @instance - */ - SslCertsInsertResponse.prototype.kind = ""; - - /** - * SslCertsInsertResponse operation. - * @member {google.cloud.sql.v1beta4.IOperation|null|undefined} operation - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @instance - */ - SslCertsInsertResponse.prototype.operation = null; - - /** - * SslCertsInsertResponse serverCaCert. - * @member {google.cloud.sql.v1beta4.ISslCert|null|undefined} serverCaCert - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @instance - */ - SslCertsInsertResponse.prototype.serverCaCert = null; - - /** - * SslCertsInsertResponse clientCert. - * @member {google.cloud.sql.v1beta4.ISslCertDetail|null|undefined} clientCert - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @instance - */ - SslCertsInsertResponse.prototype.clientCert = null; - - /** - * Creates a new SslCertsInsertResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsInsertResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SslCertsInsertResponse} SslCertsInsertResponse instance - */ - SslCertsInsertResponse.create = function create(properties) { - return new SslCertsInsertResponse(properties); - }; - - /** - * Encodes the specified SslCertsInsertResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsInsertResponse} message SslCertsInsertResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsInsertResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) - $root.google.cloud.sql.v1beta4.Operation.encode(message.operation, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) - $root.google.cloud.sql.v1beta4.SslCert.encode(message.serverCaCert, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.clientCert != null && Object.hasOwnProperty.call(message, "clientCert")) - $root.google.cloud.sql.v1beta4.SslCertDetail.encode(message.clientCert, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SslCertsInsertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsInsertResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsInsertResponse} message SslCertsInsertResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsInsertResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCertsInsertResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SslCertsInsertResponse} SslCertsInsertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsInsertResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCertsInsertResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.operation = $root.google.cloud.sql.v1beta4.Operation.decode(reader, reader.uint32()); - break; - } - case 3: { - message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32()); - break; - } - case 4: { - message.clientCert = $root.google.cloud.sql.v1beta4.SslCertDetail.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCertsInsertResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SslCertsInsertResponse} SslCertsInsertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsInsertResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCertsInsertResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCertsInsertResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.operation != null && message.hasOwnProperty("operation")) { - var error = $root.google.cloud.sql.v1beta4.Operation.verify(message.operation); - if (error) - return "operation." + error; - } - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { - var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.serverCaCert); - if (error) - return "serverCaCert." + error; - } - if (message.clientCert != null && message.hasOwnProperty("clientCert")) { - var error = $root.google.cloud.sql.v1beta4.SslCertDetail.verify(message.clientCert); - if (error) - return "clientCert." + error; - } - return null; - }; - - /** - * Creates a SslCertsInsertResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SslCertsInsertResponse} SslCertsInsertResponse - */ - SslCertsInsertResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SslCertsInsertResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.SslCertsInsertResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.operation != null) { - if (typeof object.operation !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SslCertsInsertResponse.operation: object expected"); - message.operation = $root.google.cloud.sql.v1beta4.Operation.fromObject(object.operation); - } - if (object.serverCaCert != null) { - if (typeof object.serverCaCert !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SslCertsInsertResponse.serverCaCert: object expected"); - message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.serverCaCert); - } - if (object.clientCert != null) { - if (typeof object.clientCert !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SslCertsInsertResponse.clientCert: object expected"); - message.clientCert = $root.google.cloud.sql.v1beta4.SslCertDetail.fromObject(object.clientCert); - } - return message; - }; - - /** - * Creates a plain object from a SslCertsInsertResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @static - * @param {google.cloud.sql.v1beta4.SslCertsInsertResponse} message SslCertsInsertResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCertsInsertResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.operation = null; - object.serverCaCert = null; - object.clientCert = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.operation != null && message.hasOwnProperty("operation")) - object.operation = $root.google.cloud.sql.v1beta4.Operation.toObject(message.operation, options); - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) - object.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.serverCaCert, options); - if (message.clientCert != null && message.hasOwnProperty("clientCert")) - object.clientCert = $root.google.cloud.sql.v1beta4.SslCertDetail.toObject(message.clientCert, options); - return object; - }; - - /** - * Converts this SslCertsInsertResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @instance - * @returns {Object.} JSON object - */ - SslCertsInsertResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCertsInsertResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SslCertsInsertResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCertsInsertResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCertsInsertResponse"; - }; - - return SslCertsInsertResponse; - })(); - - v1beta4.SslCertsListResponse = (function() { - - /** - * Properties of a SslCertsListResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface ISslCertsListResponse - * @property {string|null} [kind] SslCertsListResponse kind - * @property {Array.|null} [items] SslCertsListResponse items - */ - - /** - * Constructs a new SslCertsListResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SslCertsListResponse. - * @implements ISslCertsListResponse - * @constructor - * @param {google.cloud.sql.v1beta4.ISslCertsListResponse=} [properties] Properties to set - */ - function SslCertsListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SslCertsListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @instance - */ - SslCertsListResponse.prototype.kind = ""; - - /** - * SslCertsListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @instance - */ - SslCertsListResponse.prototype.items = $util.emptyArray; - - /** - * Creates a new SslCertsListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SslCertsListResponse} SslCertsListResponse instance - */ - SslCertsListResponse.create = function create(properties) { - return new SslCertsListResponse(properties); - }; - - /** - * Encodes the specified SslCertsListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsListResponse} message SslCertsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1beta4.SslCert.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SslCertsListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SslCertsListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @static - * @param {google.cloud.sql.v1beta4.ISslCertsListResponse} message SslCertsListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SslCertsListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SslCertsListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SslCertsListResponse} SslCertsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SslCertsListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SslCertsListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SslCertsListResponse} SslCertsListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SslCertsListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SslCertsListResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SslCertsListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.items[i]); - if (error) - return "items." + error; - } - } - return null; - }; - - /** - * Creates a SslCertsListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SslCertsListResponse} SslCertsListResponse - */ - SslCertsListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SslCertsListResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.SslCertsListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1beta4.SslCertsListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SslCertsListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.items[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SslCertsListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @static - * @param {google.cloud.sql.v1beta4.SslCertsListResponse} message SslCertsListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SslCertsListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.items[j], options); - } - return object; - }; - - /** - * Converts this SslCertsListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @instance - * @returns {Object.} JSON object - */ - SslCertsListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SslCertsListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SslCertsListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SslCertsListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SslCertsListResponse"; - }; - - return SslCertsListResponse; - })(); - - v1beta4.TruncateLogContext = (function() { - - /** - * Properties of a TruncateLogContext. - * @memberof google.cloud.sql.v1beta4 - * @interface ITruncateLogContext - * @property {string|null} [kind] TruncateLogContext kind - * @property {string|null} [logType] TruncateLogContext logType - */ - - /** - * Constructs a new TruncateLogContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a TruncateLogContext. - * @implements ITruncateLogContext - * @constructor - * @param {google.cloud.sql.v1beta4.ITruncateLogContext=} [properties] Properties to set - */ - function TruncateLogContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TruncateLogContext kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @instance - */ - TruncateLogContext.prototype.kind = ""; - - /** - * TruncateLogContext logType. - * @member {string} logType - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @instance - */ - TruncateLogContext.prototype.logType = ""; - - /** - * Creates a new TruncateLogContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @static - * @param {google.cloud.sql.v1beta4.ITruncateLogContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.TruncateLogContext} TruncateLogContext instance - */ - TruncateLogContext.create = function create(properties) { - return new TruncateLogContext(properties); - }; - - /** - * Encodes the specified TruncateLogContext message. Does not implicitly {@link google.cloud.sql.v1beta4.TruncateLogContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @static - * @param {google.cloud.sql.v1beta4.ITruncateLogContext} message TruncateLogContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TruncateLogContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.logType != null && Object.hasOwnProperty.call(message, "logType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.logType); - return writer; - }; - - /** - * Encodes the specified TruncateLogContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.TruncateLogContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @static - * @param {google.cloud.sql.v1beta4.ITruncateLogContext} message TruncateLogContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TruncateLogContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TruncateLogContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.TruncateLogContext} TruncateLogContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TruncateLogContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.TruncateLogContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.logType = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TruncateLogContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.TruncateLogContext} TruncateLogContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TruncateLogContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TruncateLogContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TruncateLogContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.logType != null && message.hasOwnProperty("logType")) - if (!$util.isString(message.logType)) - return "logType: string expected"; - return null; - }; - - /** - * Creates a TruncateLogContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.TruncateLogContext} TruncateLogContext - */ - TruncateLogContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.TruncateLogContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.TruncateLogContext(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.logType != null) - message.logType = String(object.logType); - return message; - }; - - /** - * Creates a plain object from a TruncateLogContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @static - * @param {google.cloud.sql.v1beta4.TruncateLogContext} message TruncateLogContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TruncateLogContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.logType = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.logType != null && message.hasOwnProperty("logType")) - object.logType = message.logType; - return object; - }; - - /** - * Converts this TruncateLogContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @instance - * @returns {Object.} JSON object - */ - TruncateLogContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TruncateLogContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.TruncateLogContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TruncateLogContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.TruncateLogContext"; - }; - - return TruncateLogContext; - })(); - - v1beta4.SqlActiveDirectoryConfig = (function() { - - /** - * Properties of a SqlActiveDirectoryConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlActiveDirectoryConfig - * @property {string|null} [kind] SqlActiveDirectoryConfig kind - * @property {string|null} [domain] SqlActiveDirectoryConfig domain - * @property {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode|null} [mode] SqlActiveDirectoryConfig mode - * @property {Array.|null} [dnsServers] SqlActiveDirectoryConfig dnsServers - * @property {string|null} [adminCredentialSecretName] SqlActiveDirectoryConfig adminCredentialSecretName - * @property {string|null} [organizationalUnit] SqlActiveDirectoryConfig organizationalUnit - */ - - /** - * Constructs a new SqlActiveDirectoryConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlActiveDirectoryConfig. - * @implements ISqlActiveDirectoryConfig - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig=} [properties] Properties to set - */ - function SqlActiveDirectoryConfig(properties) { - this.dnsServers = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlActiveDirectoryConfig kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.kind = ""; - - /** - * SqlActiveDirectoryConfig domain. - * @member {string} domain - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.domain = ""; - - /** - * SqlActiveDirectoryConfig mode. - * @member {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode} mode - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.mode = 0; - - /** - * SqlActiveDirectoryConfig dnsServers. - * @member {Array.} dnsServers - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.dnsServers = $util.emptyArray; - - /** - * SqlActiveDirectoryConfig adminCredentialSecretName. - * @member {string} adminCredentialSecretName - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.adminCredentialSecretName = ""; - - /** - * SqlActiveDirectoryConfig organizationalUnit. - * @member {string} organizationalUnit - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @instance - */ - SqlActiveDirectoryConfig.prototype.organizationalUnit = ""; - - /** - * Creates a new SqlActiveDirectoryConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @static - * @param {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig instance - */ - SqlActiveDirectoryConfig.create = function create(properties) { - return new SqlActiveDirectoryConfig(properties); - }; - - /** - * Encodes the specified SqlActiveDirectoryConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @static - * @param {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig} message SqlActiveDirectoryConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlActiveDirectoryConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.domain != null && Object.hasOwnProperty.call(message, "domain")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.domain); - if (message.mode != null && Object.hasOwnProperty.call(message, "mode")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.mode); - if (message.dnsServers != null && message.dnsServers.length) - for (var i = 0; i < message.dnsServers.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.dnsServers[i]); - if (message.adminCredentialSecretName != null && Object.hasOwnProperty.call(message, "adminCredentialSecretName")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.adminCredentialSecretName); - if (message.organizationalUnit != null && Object.hasOwnProperty.call(message, "organizationalUnit")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.organizationalUnit); - return writer; - }; - - /** - * Encodes the specified SqlActiveDirectoryConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @static - * @param {google.cloud.sql.v1beta4.ISqlActiveDirectoryConfig} message SqlActiveDirectoryConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlActiveDirectoryConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlActiveDirectoryConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.domain = reader.string(); - break; - } - case 3: { - message.mode = reader.int32(); - break; - } - case 4: { - if (!(message.dnsServers && message.dnsServers.length)) - message.dnsServers = []; - message.dnsServers.push(reader.string()); - break; - } - case 5: { - message.adminCredentialSecretName = reader.string(); - break; - } - case 6: { - message.organizationalUnit = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlActiveDirectoryConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlActiveDirectoryConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlActiveDirectoryConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlActiveDirectoryConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.domain != null && message.hasOwnProperty("domain")) - if (!$util.isString(message.domain)) - return "domain: string expected"; - if (message.mode != null && message.hasOwnProperty("mode")) - switch (message.mode) { - default: - return "mode: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.dnsServers != null && message.hasOwnProperty("dnsServers")) { - if (!Array.isArray(message.dnsServers)) - return "dnsServers: array expected"; - for (var i = 0; i < message.dnsServers.length; ++i) - if (!$util.isString(message.dnsServers[i])) - return "dnsServers: string[] expected"; - } - if (message.adminCredentialSecretName != null && message.hasOwnProperty("adminCredentialSecretName")) - if (!$util.isString(message.adminCredentialSecretName)) - return "adminCredentialSecretName: string expected"; - if (message.organizationalUnit != null && message.hasOwnProperty("organizationalUnit")) - if (!$util.isString(message.organizationalUnit)) - return "organizationalUnit: string expected"; - return null; - }; - - /** - * Creates a SqlActiveDirectoryConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig} SqlActiveDirectoryConfig - */ - SqlActiveDirectoryConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.domain != null) - message.domain = String(object.domain); - switch (object.mode) { - default: - if (typeof object.mode === "number") { - message.mode = object.mode; - break; - } - break; - case "ACTIVE_DIRECTORY_MODE_UNSPECIFIED": - case 0: - message.mode = 0; - break; - case "MANAGED_ACTIVE_DIRECTORY": - case 1: - message.mode = 1; - break; - case "SELF_MANAGED_ACTIVE_DIRECTORY": - case 2: - message.mode = 2; - break; - case "CUSTOMER_MANAGED_ACTIVE_DIRECTORY": - case 3: - message.mode = 3; - break; - } - if (object.dnsServers) { - if (!Array.isArray(object.dnsServers)) - throw TypeError(".google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.dnsServers: array expected"); - message.dnsServers = []; - for (var i = 0; i < object.dnsServers.length; ++i) - message.dnsServers[i] = String(object.dnsServers[i]); - } - if (object.adminCredentialSecretName != null) - message.adminCredentialSecretName = String(object.adminCredentialSecretName); - if (object.organizationalUnit != null) - message.organizationalUnit = String(object.organizationalUnit); - return message; - }; - - /** - * Creates a plain object from a SqlActiveDirectoryConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @static - * @param {google.cloud.sql.v1beta4.SqlActiveDirectoryConfig} message SqlActiveDirectoryConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlActiveDirectoryConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.dnsServers = []; - if (options.defaults) { - object.kind = ""; - object.domain = ""; - object.mode = options.enums === String ? "ACTIVE_DIRECTORY_MODE_UNSPECIFIED" : 0; - object.adminCredentialSecretName = ""; - object.organizationalUnit = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.domain != null && message.hasOwnProperty("domain")) - object.domain = message.domain; - if (message.mode != null && message.hasOwnProperty("mode")) - object.mode = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode[message.mode] === undefined ? message.mode : $root.google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode[message.mode] : message.mode; - if (message.dnsServers && message.dnsServers.length) { - object.dnsServers = []; - for (var j = 0; j < message.dnsServers.length; ++j) - object.dnsServers[j] = message.dnsServers[j]; - } - if (message.adminCredentialSecretName != null && message.hasOwnProperty("adminCredentialSecretName")) - object.adminCredentialSecretName = message.adminCredentialSecretName; - if (message.organizationalUnit != null && message.hasOwnProperty("organizationalUnit")) - object.organizationalUnit = message.organizationalUnit; - return object; - }; - - /** - * Converts this SqlActiveDirectoryConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @instance - * @returns {Object.} JSON object - */ - SqlActiveDirectoryConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlActiveDirectoryConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlActiveDirectoryConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlActiveDirectoryConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlActiveDirectoryConfig"; - }; - - /** - * ActiveDirectoryMode enum. - * @name google.cloud.sql.v1beta4.SqlActiveDirectoryConfig.ActiveDirectoryMode - * @enum {number} - * @property {number} ACTIVE_DIRECTORY_MODE_UNSPECIFIED=0 ACTIVE_DIRECTORY_MODE_UNSPECIFIED value - * @property {number} MANAGED_ACTIVE_DIRECTORY=1 MANAGED_ACTIVE_DIRECTORY value - * @property {number} SELF_MANAGED_ACTIVE_DIRECTORY=2 SELF_MANAGED_ACTIVE_DIRECTORY value - * @property {number} CUSTOMER_MANAGED_ACTIVE_DIRECTORY=3 CUSTOMER_MANAGED_ACTIVE_DIRECTORY value - */ - SqlActiveDirectoryConfig.ActiveDirectoryMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "ACTIVE_DIRECTORY_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "MANAGED_ACTIVE_DIRECTORY"] = 1; - values[valuesById[2] = "SELF_MANAGED_ACTIVE_DIRECTORY"] = 2; - values[valuesById[3] = "CUSTOMER_MANAGED_ACTIVE_DIRECTORY"] = 3; - return values; - })(); - - return SqlActiveDirectoryConfig; - })(); - - v1beta4.SqlServerAuditConfig = (function() { - - /** - * Properties of a SqlServerAuditConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlServerAuditConfig - * @property {string|null} [kind] SqlServerAuditConfig kind - * @property {string|null} [bucket] SqlServerAuditConfig bucket - * @property {google.protobuf.IDuration|null} [retentionInterval] SqlServerAuditConfig retentionInterval - * @property {google.protobuf.IDuration|null} [uploadInterval] SqlServerAuditConfig uploadInterval - */ - - /** - * Constructs a new SqlServerAuditConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlServerAuditConfig. - * @implements ISqlServerAuditConfig - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlServerAuditConfig=} [properties] Properties to set - */ - function SqlServerAuditConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlServerAuditConfig kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @instance - */ - SqlServerAuditConfig.prototype.kind = ""; - - /** - * SqlServerAuditConfig bucket. - * @member {string} bucket - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @instance - */ - SqlServerAuditConfig.prototype.bucket = ""; - - /** - * SqlServerAuditConfig retentionInterval. - * @member {google.protobuf.IDuration|null|undefined} retentionInterval - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @instance - */ - SqlServerAuditConfig.prototype.retentionInterval = null; - - /** - * SqlServerAuditConfig uploadInterval. - * @member {google.protobuf.IDuration|null|undefined} uploadInterval - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @instance - */ - SqlServerAuditConfig.prototype.uploadInterval = null; - - /** - * Creates a new SqlServerAuditConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerAuditConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlServerAuditConfig} SqlServerAuditConfig instance - */ - SqlServerAuditConfig.create = function create(properties) { - return new SqlServerAuditConfig(properties); - }; - - /** - * Encodes the specified SqlServerAuditConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerAuditConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerAuditConfig} message SqlServerAuditConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerAuditConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.bucket); - if (message.retentionInterval != null && Object.hasOwnProperty.call(message, "retentionInterval")) - $root.google.protobuf.Duration.encode(message.retentionInterval, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.uploadInterval != null && Object.hasOwnProperty.call(message, "uploadInterval")) - $root.google.protobuf.Duration.encode(message.uploadInterval, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlServerAuditConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerAuditConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerAuditConfig} message SqlServerAuditConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerAuditConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlServerAuditConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlServerAuditConfig} SqlServerAuditConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerAuditConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlServerAuditConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.bucket = reader.string(); - break; - } - case 3: { - message.retentionInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - case 4: { - message.uploadInterval = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlServerAuditConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlServerAuditConfig} SqlServerAuditConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerAuditConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlServerAuditConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlServerAuditConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.bucket != null && message.hasOwnProperty("bucket")) - if (!$util.isString(message.bucket)) - return "bucket: string expected"; - if (message.retentionInterval != null && message.hasOwnProperty("retentionInterval")) { - var error = $root.google.protobuf.Duration.verify(message.retentionInterval); - if (error) - return "retentionInterval." + error; - } - if (message.uploadInterval != null && message.hasOwnProperty("uploadInterval")) { - var error = $root.google.protobuf.Duration.verify(message.uploadInterval); - if (error) - return "uploadInterval." + error; - } - return null; - }; - - /** - * Creates a SqlServerAuditConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlServerAuditConfig} SqlServerAuditConfig - */ - SqlServerAuditConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlServerAuditConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlServerAuditConfig(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.bucket != null) - message.bucket = String(object.bucket); - if (object.retentionInterval != null) { - if (typeof object.retentionInterval !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlServerAuditConfig.retentionInterval: object expected"); - message.retentionInterval = $root.google.protobuf.Duration.fromObject(object.retentionInterval); - } - if (object.uploadInterval != null) { - if (typeof object.uploadInterval !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlServerAuditConfig.uploadInterval: object expected"); - message.uploadInterval = $root.google.protobuf.Duration.fromObject(object.uploadInterval); - } - return message; - }; - - /** - * Creates a plain object from a SqlServerAuditConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @static - * @param {google.cloud.sql.v1beta4.SqlServerAuditConfig} message SqlServerAuditConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlServerAuditConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.bucket = ""; - object.retentionInterval = null; - object.uploadInterval = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.bucket != null && message.hasOwnProperty("bucket")) - object.bucket = message.bucket; - if (message.retentionInterval != null && message.hasOwnProperty("retentionInterval")) - object.retentionInterval = $root.google.protobuf.Duration.toObject(message.retentionInterval, options); - if (message.uploadInterval != null && message.hasOwnProperty("uploadInterval")) - object.uploadInterval = $root.google.protobuf.Duration.toObject(message.uploadInterval, options); - return object; - }; - - /** - * Converts this SqlServerAuditConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @instance - * @returns {Object.} JSON object - */ - SqlServerAuditConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlServerAuditConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlServerAuditConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlServerAuditConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlServerAuditConfig"; - }; - - return SqlServerAuditConfig; - })(); - - v1beta4.SqlServerEntraIdConfig = (function() { - - /** - * Properties of a SqlServerEntraIdConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlServerEntraIdConfig - * @property {string|null} [kind] SqlServerEntraIdConfig kind - * @property {string|null} [tenantId] SqlServerEntraIdConfig tenantId - * @property {string|null} [applicationId] SqlServerEntraIdConfig applicationId - */ - - /** - * Constructs a new SqlServerEntraIdConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlServerEntraIdConfig. - * @implements ISqlServerEntraIdConfig - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig=} [properties] Properties to set - */ - function SqlServerEntraIdConfig(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlServerEntraIdConfig kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @instance - */ - SqlServerEntraIdConfig.prototype.kind = ""; - - /** - * SqlServerEntraIdConfig tenantId. - * @member {string} tenantId - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @instance - */ - SqlServerEntraIdConfig.prototype.tenantId = ""; - - /** - * SqlServerEntraIdConfig applicationId. - * @member {string} applicationId - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @instance - */ - SqlServerEntraIdConfig.prototype.applicationId = ""; - - /** - * Creates a new SqlServerEntraIdConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlServerEntraIdConfig} SqlServerEntraIdConfig instance - */ - SqlServerEntraIdConfig.create = function create(properties) { - return new SqlServerEntraIdConfig(properties); - }; - - /** - * Encodes the specified SqlServerEntraIdConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerEntraIdConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig} message SqlServerEntraIdConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerEntraIdConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.tenantId != null && Object.hasOwnProperty.call(message, "tenantId")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.tenantId); - if (message.applicationId != null && Object.hasOwnProperty.call(message, "applicationId")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.applicationId); - return writer; - }; - - /** - * Encodes the specified SqlServerEntraIdConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerEntraIdConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerEntraIdConfig} message SqlServerEntraIdConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerEntraIdConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlServerEntraIdConfig} SqlServerEntraIdConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerEntraIdConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.tenantId = reader.string(); - break; - } - case 3: { - message.applicationId = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlServerEntraIdConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlServerEntraIdConfig} SqlServerEntraIdConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerEntraIdConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlServerEntraIdConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlServerEntraIdConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.tenantId != null && message.hasOwnProperty("tenantId")) - if (!$util.isString(message.tenantId)) - return "tenantId: string expected"; - if (message.applicationId != null && message.hasOwnProperty("applicationId")) - if (!$util.isString(message.applicationId)) - return "applicationId: string expected"; - return null; - }; - - /** - * Creates a SqlServerEntraIdConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlServerEntraIdConfig} SqlServerEntraIdConfig - */ - SqlServerEntraIdConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlServerEntraIdConfig(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.tenantId != null) - message.tenantId = String(object.tenantId); - if (object.applicationId != null) - message.applicationId = String(object.applicationId); - return message; - }; - - /** - * Creates a plain object from a SqlServerEntraIdConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @static - * @param {google.cloud.sql.v1beta4.SqlServerEntraIdConfig} message SqlServerEntraIdConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlServerEntraIdConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.tenantId = ""; - object.applicationId = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.tenantId != null && message.hasOwnProperty("tenantId")) - object.tenantId = message.tenantId; - if (message.applicationId != null && message.hasOwnProperty("applicationId")) - object.applicationId = message.applicationId; - return object; - }; - - /** - * Converts this SqlServerEntraIdConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @instance - * @returns {Object.} JSON object - */ - SqlServerEntraIdConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlServerEntraIdConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlServerEntraIdConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlServerEntraIdConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlServerEntraIdConfig"; - }; - - return SqlServerEntraIdConfig; - })(); - - /** - * SqlBackupRunStatus enum. - * @name google.cloud.sql.v1beta4.SqlBackupRunStatus - * @enum {number} - * @property {number} SQL_BACKUP_RUN_STATUS_UNSPECIFIED=0 SQL_BACKUP_RUN_STATUS_UNSPECIFIED value - * @property {number} ENQUEUED=1 ENQUEUED value - * @property {number} OVERDUE=2 OVERDUE value - * @property {number} RUNNING=3 RUNNING value - * @property {number} FAILED=4 FAILED value - * @property {number} SUCCESSFUL=5 SUCCESSFUL value - * @property {number} SKIPPED=6 SKIPPED value - * @property {number} DELETION_PENDING=7 DELETION_PENDING value - * @property {number} DELETION_FAILED=8 DELETION_FAILED value - * @property {number} DELETED=9 DELETED value - */ - v1beta4.SqlBackupRunStatus = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKUP_RUN_STATUS_UNSPECIFIED"] = 0; - values[valuesById[1] = "ENQUEUED"] = 1; - values[valuesById[2] = "OVERDUE"] = 2; - values[valuesById[3] = "RUNNING"] = 3; - values[valuesById[4] = "FAILED"] = 4; - values[valuesById[5] = "SUCCESSFUL"] = 5; - values[valuesById[6] = "SKIPPED"] = 6; - values[valuesById[7] = "DELETION_PENDING"] = 7; - values[valuesById[8] = "DELETION_FAILED"] = 8; - values[valuesById[9] = "DELETED"] = 9; - return values; - })(); - - /** - * SqlBackupRunType enum. - * @name google.cloud.sql.v1beta4.SqlBackupRunType - * @enum {number} - * @property {number} SQL_BACKUP_RUN_TYPE_UNSPECIFIED=0 SQL_BACKUP_RUN_TYPE_UNSPECIFIED value - * @property {number} AUTOMATED=1 AUTOMATED value - * @property {number} ON_DEMAND=2 ON_DEMAND value - */ - v1beta4.SqlBackupRunType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKUP_RUN_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "AUTOMATED"] = 1; - values[valuesById[2] = "ON_DEMAND"] = 2; - return values; - })(); - - /** - * SqlBackupKind enum. - * @name google.cloud.sql.v1beta4.SqlBackupKind - * @enum {number} - * @property {number} SQL_BACKUP_KIND_UNSPECIFIED=0 SQL_BACKUP_KIND_UNSPECIFIED value - * @property {number} SNAPSHOT=1 SNAPSHOT value - * @property {number} PHYSICAL=2 PHYSICAL value - */ - v1beta4.SqlBackupKind = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKUP_KIND_UNSPECIFIED"] = 0; - values[valuesById[1] = "SNAPSHOT"] = 1; - values[valuesById[2] = "PHYSICAL"] = 2; - return values; - })(); - - /** - * SqlBackendType enum. - * @name google.cloud.sql.v1beta4.SqlBackendType - * @enum {number} - * @property {number} SQL_BACKEND_TYPE_UNSPECIFIED=0 SQL_BACKEND_TYPE_UNSPECIFIED value - * @property {number} FIRST_GEN=1 FIRST_GEN value - * @property {number} SECOND_GEN=2 SECOND_GEN value - * @property {number} EXTERNAL=3 EXTERNAL value - */ - v1beta4.SqlBackendType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_BACKEND_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "FIRST_GEN"] = 1; - values[valuesById[2] = "SECOND_GEN"] = 2; - values[valuesById[3] = "EXTERNAL"] = 3; - return values; - })(); - - /** - * SqlIpAddressType enum. - * @name google.cloud.sql.v1beta4.SqlIpAddressType - * @enum {number} - * @property {number} SQL_IP_ADDRESS_TYPE_UNSPECIFIED=0 SQL_IP_ADDRESS_TYPE_UNSPECIFIED value - * @property {number} PRIMARY=1 PRIMARY value - * @property {number} OUTGOING=2 OUTGOING value - * @property {number} PRIVATE=3 PRIVATE value - * @property {number} MIGRATED_1ST_GEN=4 MIGRATED_1ST_GEN value - */ - v1beta4.SqlIpAddressType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_IP_ADDRESS_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PRIMARY"] = 1; - values[valuesById[2] = "OUTGOING"] = 2; - values[valuesById[3] = "PRIVATE"] = 3; - values[valuesById[4] = "MIGRATED_1ST_GEN"] = 4; - return values; - })(); - - /** - * SqlInstanceType enum. - * @name google.cloud.sql.v1beta4.SqlInstanceType - * @enum {number} - * @property {number} SQL_INSTANCE_TYPE_UNSPECIFIED=0 SQL_INSTANCE_TYPE_UNSPECIFIED value - * @property {number} CLOUD_SQL_INSTANCE=1 CLOUD_SQL_INSTANCE value - * @property {number} ON_PREMISES_INSTANCE=2 ON_PREMISES_INSTANCE value - * @property {number} READ_REPLICA_INSTANCE=3 READ_REPLICA_INSTANCE value - * @property {number} READ_POOL_INSTANCE=5 READ_POOL_INSTANCE value - */ - v1beta4.SqlInstanceType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_INSTANCE_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "CLOUD_SQL_INSTANCE"] = 1; - values[valuesById[2] = "ON_PREMISES_INSTANCE"] = 2; - values[valuesById[3] = "READ_REPLICA_INSTANCE"] = 3; - values[valuesById[5] = "READ_POOL_INSTANCE"] = 5; - return values; - })(); - - v1beta4.ConnectionPoolFlags = (function() { - - /** - * Properties of a ConnectionPoolFlags. - * @memberof google.cloud.sql.v1beta4 - * @interface IConnectionPoolFlags - * @property {string|null} [name] ConnectionPoolFlags name - * @property {string|null} [value] ConnectionPoolFlags value - */ - - /** - * Constructs a new ConnectionPoolFlags. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a ConnectionPoolFlags. - * @implements IConnectionPoolFlags - * @constructor - * @param {google.cloud.sql.v1beta4.IConnectionPoolFlags=} [properties] Properties to set - */ - function ConnectionPoolFlags(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectionPoolFlags name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @instance - */ - ConnectionPoolFlags.prototype.name = ""; - - /** - * ConnectionPoolFlags value. - * @member {string} value - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @instance - */ - ConnectionPoolFlags.prototype.value = ""; - - /** - * Creates a new ConnectionPoolFlags instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @static - * @param {google.cloud.sql.v1beta4.IConnectionPoolFlags=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ConnectionPoolFlags} ConnectionPoolFlags instance - */ - ConnectionPoolFlags.create = function create(properties) { - return new ConnectionPoolFlags(properties); - }; - - /** - * Encodes the specified ConnectionPoolFlags message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolFlags.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @static - * @param {google.cloud.sql.v1beta4.IConnectionPoolFlags} message ConnectionPoolFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionPoolFlags.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - return writer; - }; - - /** - * Encodes the specified ConnectionPoolFlags message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolFlags.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @static - * @param {google.cloud.sql.v1beta4.IConnectionPoolFlags} message ConnectionPoolFlags message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionPoolFlags.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectionPoolFlags message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ConnectionPoolFlags} ConnectionPoolFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionPoolFlags.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ConnectionPoolFlags(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectionPoolFlags message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ConnectionPoolFlags} ConnectionPoolFlags - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionPoolFlags.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectionPoolFlags message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectionPoolFlags.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a ConnectionPoolFlags message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ConnectionPoolFlags} ConnectionPoolFlags - */ - ConnectionPoolFlags.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ConnectionPoolFlags) - return object; - var message = new $root.google.cloud.sql.v1beta4.ConnectionPoolFlags(); - if (object.name != null) - message.name = String(object.name); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a ConnectionPoolFlags message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @static - * @param {google.cloud.sql.v1beta4.ConnectionPoolFlags} message ConnectionPoolFlags - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectionPoolFlags.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.value = ""; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this ConnectionPoolFlags to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @instance - * @returns {Object.} JSON object - */ - ConnectionPoolFlags.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ConnectionPoolFlags - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ConnectionPoolFlags - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ConnectionPoolFlags.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ConnectionPoolFlags"; - }; - - return ConnectionPoolFlags; - })(); - - v1beta4.ReadPoolAutoScaleConfig = (function() { - - /** - * Properties of a ReadPoolAutoScaleConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IReadPoolAutoScaleConfig - * @property {boolean|null} [enabled] ReadPoolAutoScaleConfig enabled - * @property {number|null} [minNodeCount] ReadPoolAutoScaleConfig minNodeCount - * @property {number|null} [maxNodeCount] ReadPoolAutoScaleConfig maxNodeCount - * @property {Array.|null} [targetMetrics] ReadPoolAutoScaleConfig targetMetrics - * @property {boolean|null} [disableScaleIn] ReadPoolAutoScaleConfig disableScaleIn - * @property {number|null} [scaleInCooldownSeconds] ReadPoolAutoScaleConfig scaleInCooldownSeconds - * @property {number|null} [scaleOutCooldownSeconds] ReadPoolAutoScaleConfig scaleOutCooldownSeconds - */ - - /** - * Constructs a new ReadPoolAutoScaleConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a ReadPoolAutoScaleConfig. - * @implements IReadPoolAutoScaleConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig=} [properties] Properties to set - */ - function ReadPoolAutoScaleConfig(properties) { - this.targetMetrics = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReadPoolAutoScaleConfig enabled. - * @member {boolean|null|undefined} enabled - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.enabled = null; - - /** - * ReadPoolAutoScaleConfig minNodeCount. - * @member {number|null|undefined} minNodeCount - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.minNodeCount = null; - - /** - * ReadPoolAutoScaleConfig maxNodeCount. - * @member {number|null|undefined} maxNodeCount - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.maxNodeCount = null; - - /** - * ReadPoolAutoScaleConfig targetMetrics. - * @member {Array.} targetMetrics - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.targetMetrics = $util.emptyArray; - - /** - * ReadPoolAutoScaleConfig disableScaleIn. - * @member {boolean|null|undefined} disableScaleIn - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.disableScaleIn = null; - - /** - * ReadPoolAutoScaleConfig scaleInCooldownSeconds. - * @member {number|null|undefined} scaleInCooldownSeconds - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.scaleInCooldownSeconds = null; - - /** - * ReadPoolAutoScaleConfig scaleOutCooldownSeconds. - * @member {number|null|undefined} scaleOutCooldownSeconds - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @instance - */ - ReadPoolAutoScaleConfig.prototype.scaleOutCooldownSeconds = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_enabled", { - get: $util.oneOfGetter($oneOfFields = ["enabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_minNodeCount", { - get: $util.oneOfGetter($oneOfFields = ["minNodeCount"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_maxNodeCount", { - get: $util.oneOfGetter($oneOfFields = ["maxNodeCount"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_disableScaleIn", { - get: $util.oneOfGetter($oneOfFields = ["disableScaleIn"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_scaleInCooldownSeconds", { - get: $util.oneOfGetter($oneOfFields = ["scaleInCooldownSeconds"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ReadPoolAutoScaleConfig.prototype, "_scaleOutCooldownSeconds", { - get: $util.oneOfGetter($oneOfFields = ["scaleOutCooldownSeconds"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ReadPoolAutoScaleConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @static - * @param {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig instance - */ - ReadPoolAutoScaleConfig.create = function create(properties) { - return new ReadPoolAutoScaleConfig(properties); - }; - - /** - * Encodes the specified ReadPoolAutoScaleConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @static - * @param {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadPoolAutoScaleConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.enabled != null && Object.hasOwnProperty.call(message, "enabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.enabled); - if (message.minNodeCount != null && Object.hasOwnProperty.call(message, "minNodeCount")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.minNodeCount); - if (message.maxNodeCount != null && Object.hasOwnProperty.call(message, "maxNodeCount")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxNodeCount); - if (message.targetMetrics != null && message.targetMetrics.length) - for (var i = 0; i < message.targetMetrics.length; ++i) - $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.encode(message.targetMetrics[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.disableScaleIn != null && Object.hasOwnProperty.call(message, "disableScaleIn")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.disableScaleIn); - if (message.scaleInCooldownSeconds != null && Object.hasOwnProperty.call(message, "scaleInCooldownSeconds")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.scaleInCooldownSeconds); - if (message.scaleOutCooldownSeconds != null && Object.hasOwnProperty.call(message, "scaleOutCooldownSeconds")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.scaleOutCooldownSeconds); - return writer; - }; - - /** - * Encodes the specified ReadPoolAutoScaleConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @static - * @param {google.cloud.sql.v1beta4.IReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReadPoolAutoScaleConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadPoolAutoScaleConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.enabled = reader.bool(); - break; - } - case 2: { - message.minNodeCount = reader.int32(); - break; - } - case 3: { - message.maxNodeCount = reader.int32(); - break; - } - case 4: { - if (!(message.targetMetrics && message.targetMetrics.length)) - message.targetMetrics = []; - message.targetMetrics.push($root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.decode(reader, reader.uint32())); - break; - } - case 5: { - message.disableScaleIn = reader.bool(); - break; - } - case 6: { - message.scaleInCooldownSeconds = reader.int32(); - break; - } - case 7: { - message.scaleOutCooldownSeconds = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReadPoolAutoScaleConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReadPoolAutoScaleConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReadPoolAutoScaleConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReadPoolAutoScaleConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - properties._enabled = 1; - if (typeof message.enabled !== "boolean") - return "enabled: boolean expected"; - } - if (message.minNodeCount != null && message.hasOwnProperty("minNodeCount")) { - properties._minNodeCount = 1; - if (!$util.isInteger(message.minNodeCount)) - return "minNodeCount: integer expected"; - } - if (message.maxNodeCount != null && message.hasOwnProperty("maxNodeCount")) { - properties._maxNodeCount = 1; - if (!$util.isInteger(message.maxNodeCount)) - return "maxNodeCount: integer expected"; - } - if (message.targetMetrics != null && message.hasOwnProperty("targetMetrics")) { - if (!Array.isArray(message.targetMetrics)) - return "targetMetrics: array expected"; - for (var i = 0; i < message.targetMetrics.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.verify(message.targetMetrics[i]); - if (error) - return "targetMetrics." + error; - } - } - if (message.disableScaleIn != null && message.hasOwnProperty("disableScaleIn")) { - properties._disableScaleIn = 1; - if (typeof message.disableScaleIn !== "boolean") - return "disableScaleIn: boolean expected"; - } - if (message.scaleInCooldownSeconds != null && message.hasOwnProperty("scaleInCooldownSeconds")) { - properties._scaleInCooldownSeconds = 1; - if (!$util.isInteger(message.scaleInCooldownSeconds)) - return "scaleInCooldownSeconds: integer expected"; - } - if (message.scaleOutCooldownSeconds != null && message.hasOwnProperty("scaleOutCooldownSeconds")) { - properties._scaleOutCooldownSeconds = 1; - if (!$util.isInteger(message.scaleOutCooldownSeconds)) - return "scaleOutCooldownSeconds: integer expected"; - } - return null; - }; - - /** - * Creates a ReadPoolAutoScaleConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig} ReadPoolAutoScaleConfig - */ - ReadPoolAutoScaleConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig(); - if (object.enabled != null) - message.enabled = Boolean(object.enabled); - if (object.minNodeCount != null) - message.minNodeCount = object.minNodeCount | 0; - if (object.maxNodeCount != null) - message.maxNodeCount = object.maxNodeCount | 0; - if (object.targetMetrics) { - if (!Array.isArray(object.targetMetrics)) - throw TypeError(".google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.targetMetrics: array expected"); - message.targetMetrics = []; - for (var i = 0; i < object.targetMetrics.length; ++i) { - if (typeof object.targetMetrics[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.targetMetrics: object expected"); - message.targetMetrics[i] = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.fromObject(object.targetMetrics[i]); - } - } - if (object.disableScaleIn != null) - message.disableScaleIn = Boolean(object.disableScaleIn); - if (object.scaleInCooldownSeconds != null) - message.scaleInCooldownSeconds = object.scaleInCooldownSeconds | 0; - if (object.scaleOutCooldownSeconds != null) - message.scaleOutCooldownSeconds = object.scaleOutCooldownSeconds | 0; - return message; - }; - - /** - * Creates a plain object from a ReadPoolAutoScaleConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @static - * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig} message ReadPoolAutoScaleConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReadPoolAutoScaleConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.targetMetrics = []; - if (message.enabled != null && message.hasOwnProperty("enabled")) { - object.enabled = message.enabled; - if (options.oneofs) - object._enabled = "enabled"; - } - if (message.minNodeCount != null && message.hasOwnProperty("minNodeCount")) { - object.minNodeCount = message.minNodeCount; - if (options.oneofs) - object._minNodeCount = "minNodeCount"; - } - if (message.maxNodeCount != null && message.hasOwnProperty("maxNodeCount")) { - object.maxNodeCount = message.maxNodeCount; - if (options.oneofs) - object._maxNodeCount = "maxNodeCount"; - } - if (message.targetMetrics && message.targetMetrics.length) { - object.targetMetrics = []; - for (var j = 0; j < message.targetMetrics.length; ++j) - object.targetMetrics[j] = $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.toObject(message.targetMetrics[j], options); - } - if (message.disableScaleIn != null && message.hasOwnProperty("disableScaleIn")) { - object.disableScaleIn = message.disableScaleIn; - if (options.oneofs) - object._disableScaleIn = "disableScaleIn"; - } - if (message.scaleInCooldownSeconds != null && message.hasOwnProperty("scaleInCooldownSeconds")) { - object.scaleInCooldownSeconds = message.scaleInCooldownSeconds; - if (options.oneofs) - object._scaleInCooldownSeconds = "scaleInCooldownSeconds"; - } - if (message.scaleOutCooldownSeconds != null && message.hasOwnProperty("scaleOutCooldownSeconds")) { - object.scaleOutCooldownSeconds = message.scaleOutCooldownSeconds; - if (options.oneofs) - object._scaleOutCooldownSeconds = "scaleOutCooldownSeconds"; - } - return object; - }; - - /** - * Converts this ReadPoolAutoScaleConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @instance - * @returns {Object.} JSON object - */ - ReadPoolAutoScaleConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReadPoolAutoScaleConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReadPoolAutoScaleConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig"; - }; - - ReadPoolAutoScaleConfig.TargetMetric = (function() { - - /** - * Properties of a TargetMetric. - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @interface ITargetMetric - * @property {string|null} [metric] TargetMetric metric - * @property {number|null} [targetValue] TargetMetric targetValue - */ - - /** - * Constructs a new TargetMetric. - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig - * @classdesc Represents a TargetMetric. - * @implements ITargetMetric - * @constructor - * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric=} [properties] Properties to set - */ - function TargetMetric(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TargetMetric metric. - * @member {string|null|undefined} metric - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @instance - */ - TargetMetric.prototype.metric = null; - - /** - * TargetMetric targetValue. - * @member {number|null|undefined} targetValue - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @instance - */ - TargetMetric.prototype.targetValue = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(TargetMetric.prototype, "_metric", { - get: $util.oneOfGetter($oneOfFields = ["metric"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(TargetMetric.prototype, "_targetValue", { - get: $util.oneOfGetter($oneOfFields = ["targetValue"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new TargetMetric instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric instance - */ - TargetMetric.create = function create(properties) { - return new TargetMetric(properties); - }; - - /** - * Encodes the specified TargetMetric message. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric} message TargetMetric message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TargetMetric.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.metric != null && Object.hasOwnProperty.call(message, "metric")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.metric); - if (message.targetValue != null && Object.hasOwnProperty.call(message, "targetValue")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.targetValue); - return writer; - }; - - /** - * Encodes the specified TargetMetric message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.ITargetMetric} message TargetMetric message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TargetMetric.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TargetMetric message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TargetMetric.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.metric = reader.string(); - break; - } - case 2: { - message.targetValue = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TargetMetric message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TargetMetric.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TargetMetric message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TargetMetric.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.metric != null && message.hasOwnProperty("metric")) { - properties._metric = 1; - if (!$util.isString(message.metric)) - return "metric: string expected"; - } - if (message.targetValue != null && message.hasOwnProperty("targetValue")) { - properties._targetValue = 1; - if (typeof message.targetValue !== "number") - return "targetValue: number expected"; - } - return null; - }; - - /** - * Creates a TargetMetric message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric} TargetMetric - */ - TargetMetric.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric) - return object; - var message = new $root.google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric(); - if (object.metric != null) - message.metric = String(object.metric); - if (object.targetValue != null) - message.targetValue = Number(object.targetValue); - return message; - }; - - /** - * Creates a plain object from a TargetMetric message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric} message TargetMetric - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TargetMetric.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.metric != null && message.hasOwnProperty("metric")) { - object.metric = message.metric; - if (options.oneofs) - object._metric = "metric"; - } - if (message.targetValue != null && message.hasOwnProperty("targetValue")) { - object.targetValue = options.json && !isFinite(message.targetValue) ? String(message.targetValue) : message.targetValue; - if (options.oneofs) - object._targetValue = "targetValue"; - } - return object; - }; - - /** - * Converts this TargetMetric to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @instance - * @returns {Object.} JSON object - */ - TargetMetric.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TargetMetric - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TargetMetric.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ReadPoolAutoScaleConfig.TargetMetric"; - }; - - return TargetMetric; - })(); - - return ReadPoolAutoScaleConfig; - })(); - - v1beta4.ConnectionPoolConfig = (function() { - - /** - * Properties of a ConnectionPoolConfig. - * @memberof google.cloud.sql.v1beta4 - * @interface IConnectionPoolConfig - * @property {boolean|null} [connectionPoolingEnabled] ConnectionPoolConfig connectionPoolingEnabled - * @property {Array.|null} [flags] ConnectionPoolConfig flags - * @property {number|null} [poolerCount] ConnectionPoolConfig poolerCount - */ - - /** - * Constructs a new ConnectionPoolConfig. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a ConnectionPoolConfig. - * @implements IConnectionPoolConfig - * @constructor - * @param {google.cloud.sql.v1beta4.IConnectionPoolConfig=} [properties] Properties to set - */ - function ConnectionPoolConfig(properties) { - this.flags = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectionPoolConfig connectionPoolingEnabled. - * @member {boolean|null|undefined} connectionPoolingEnabled - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @instance - */ - ConnectionPoolConfig.prototype.connectionPoolingEnabled = null; - - /** - * ConnectionPoolConfig flags. - * @member {Array.} flags - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @instance - */ - ConnectionPoolConfig.prototype.flags = $util.emptyArray; - - /** - * ConnectionPoolConfig poolerCount. - * @member {number|null|undefined} poolerCount - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @instance - */ - ConnectionPoolConfig.prototype.poolerCount = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ConnectionPoolConfig.prototype, "_connectionPoolingEnabled", { - get: $util.oneOfGetter($oneOfFields = ["connectionPoolingEnabled"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ConnectionPoolConfig.prototype, "_poolerCount", { - get: $util.oneOfGetter($oneOfFields = ["poolerCount"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ConnectionPoolConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @static - * @param {google.cloud.sql.v1beta4.IConnectionPoolConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ConnectionPoolConfig} ConnectionPoolConfig instance - */ - ConnectionPoolConfig.create = function create(properties) { - return new ConnectionPoolConfig(properties); - }; - - /** - * Encodes the specified ConnectionPoolConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @static - * @param {google.cloud.sql.v1beta4.IConnectionPoolConfig} message ConnectionPoolConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionPoolConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.connectionPoolingEnabled != null && Object.hasOwnProperty.call(message, "connectionPoolingEnabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.connectionPoolingEnabled); - if (message.flags != null && message.flags.length) - for (var i = 0; i < message.flags.length; ++i) - $root.google.cloud.sql.v1beta4.ConnectionPoolFlags.encode(message.flags[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.poolerCount != null && Object.hasOwnProperty.call(message, "poolerCount")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.poolerCount); - return writer; - }; - - /** - * Encodes the specified ConnectionPoolConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectionPoolConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @static - * @param {google.cloud.sql.v1beta4.IConnectionPoolConfig} message ConnectionPoolConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectionPoolConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectionPoolConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ConnectionPoolConfig} ConnectionPoolConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionPoolConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ConnectionPoolConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.connectionPoolingEnabled = reader.bool(); - break; - } - case 8: { - if (!(message.flags && message.flags.length)) - message.flags = []; - message.flags.push($root.google.cloud.sql.v1beta4.ConnectionPoolFlags.decode(reader, reader.uint32())); - break; - } - case 9: { - message.poolerCount = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectionPoolConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ConnectionPoolConfig} ConnectionPoolConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectionPoolConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectionPoolConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectionPoolConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.connectionPoolingEnabled != null && message.hasOwnProperty("connectionPoolingEnabled")) { - properties._connectionPoolingEnabled = 1; - if (typeof message.connectionPoolingEnabled !== "boolean") - return "connectionPoolingEnabled: boolean expected"; - } - if (message.flags != null && message.hasOwnProperty("flags")) { - if (!Array.isArray(message.flags)) - return "flags: array expected"; - for (var i = 0; i < message.flags.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.ConnectionPoolFlags.verify(message.flags[i]); - if (error) - return "flags." + error; - } - } - if (message.poolerCount != null && message.hasOwnProperty("poolerCount")) { - properties._poolerCount = 1; - if (!$util.isInteger(message.poolerCount)) - return "poolerCount: integer expected"; - } - return null; - }; - - /** - * Creates a ConnectionPoolConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ConnectionPoolConfig} ConnectionPoolConfig - */ - ConnectionPoolConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ConnectionPoolConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.ConnectionPoolConfig(); - if (object.connectionPoolingEnabled != null) - message.connectionPoolingEnabled = Boolean(object.connectionPoolingEnabled); - if (object.flags) { - if (!Array.isArray(object.flags)) - throw TypeError(".google.cloud.sql.v1beta4.ConnectionPoolConfig.flags: array expected"); - message.flags = []; - for (var i = 0; i < object.flags.length; ++i) { - if (typeof object.flags[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ConnectionPoolConfig.flags: object expected"); - message.flags[i] = $root.google.cloud.sql.v1beta4.ConnectionPoolFlags.fromObject(object.flags[i]); - } - } - if (object.poolerCount != null) - message.poolerCount = object.poolerCount | 0; - return message; - }; - - /** - * Creates a plain object from a ConnectionPoolConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @static - * @param {google.cloud.sql.v1beta4.ConnectionPoolConfig} message ConnectionPoolConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectionPoolConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.flags = []; - if (message.connectionPoolingEnabled != null && message.hasOwnProperty("connectionPoolingEnabled")) { - object.connectionPoolingEnabled = message.connectionPoolingEnabled; - if (options.oneofs) - object._connectionPoolingEnabled = "connectionPoolingEnabled"; - } - if (message.flags && message.flags.length) { - object.flags = []; - for (var j = 0; j < message.flags.length; ++j) - object.flags[j] = $root.google.cloud.sql.v1beta4.ConnectionPoolFlags.toObject(message.flags[j], options); - } - if (message.poolerCount != null && message.hasOwnProperty("poolerCount")) { - object.poolerCount = message.poolerCount; - if (options.oneofs) - object._poolerCount = "poolerCount"; - } - return object; - }; - - /** - * Converts this ConnectionPoolConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @instance - * @returns {Object.} JSON object - */ - ConnectionPoolConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ConnectionPoolConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ConnectionPoolConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ConnectionPoolConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ConnectionPoolConfig"; - }; - - return ConnectionPoolConfig; - })(); - - /** - * SqlDatabaseVersion enum. - * @name google.cloud.sql.v1beta4.SqlDatabaseVersion - * @enum {number} - * @property {number} SQL_DATABASE_VERSION_UNSPECIFIED=0 SQL_DATABASE_VERSION_UNSPECIFIED value - * @property {number} MYSQL_5_1=2 MYSQL_5_1 value - * @property {number} MYSQL_5_5=3 MYSQL_5_5 value - * @property {number} MYSQL_5_6=5 MYSQL_5_6 value - * @property {number} MYSQL_5_7=6 MYSQL_5_7 value - * @property {number} MYSQL_8_0=20 MYSQL_8_0 value - * @property {number} MYSQL_8_0_18=41 MYSQL_8_0_18 value - * @property {number} MYSQL_8_0_26=85 MYSQL_8_0_26 value - * @property {number} MYSQL_8_0_27=111 MYSQL_8_0_27 value - * @property {number} MYSQL_8_0_28=132 MYSQL_8_0_28 value - * @property {number} MYSQL_8_0_29=148 MYSQL_8_0_29 value - * @property {number} MYSQL_8_0_30=174 MYSQL_8_0_30 value - * @property {number} MYSQL_8_0_31=197 MYSQL_8_0_31 value - * @property {number} MYSQL_8_0_32=213 MYSQL_8_0_32 value - * @property {number} MYSQL_8_0_33=238 MYSQL_8_0_33 value - * @property {number} MYSQL_8_0_34=239 MYSQL_8_0_34 value - * @property {number} MYSQL_8_0_35=240 MYSQL_8_0_35 value - * @property {number} MYSQL_8_0_36=241 MYSQL_8_0_36 value - * @property {number} MYSQL_8_0_37=355 MYSQL_8_0_37 value - * @property {number} MYSQL_8_0_39=357 MYSQL_8_0_39 value - * @property {number} MYSQL_8_0_40=358 MYSQL_8_0_40 value - * @property {number} MYSQL_8_0_41=488 MYSQL_8_0_41 value - * @property {number} MYSQL_8_0_42=489 MYSQL_8_0_42 value - * @property {number} MYSQL_8_0_43=553 MYSQL_8_0_43 value - * @property {number} MYSQL_8_0_44=554 MYSQL_8_0_44 value - * @property {number} MYSQL_8_0_45=555 MYSQL_8_0_45 value - * @property {number} MYSQL_8_0_46=556 MYSQL_8_0_46 value - * @property {number} MYSQL_8_4=398 MYSQL_8_4 value - * @property {number} MYSQL_9_7=654 MYSQL_9_7 value - * @property {number} SQLSERVER_2017_STANDARD=11 SQLSERVER_2017_STANDARD value - * @property {number} SQLSERVER_2017_ENTERPRISE=14 SQLSERVER_2017_ENTERPRISE value - * @property {number} SQLSERVER_2017_EXPRESS=15 SQLSERVER_2017_EXPRESS value - * @property {number} SQLSERVER_2017_WEB=16 SQLSERVER_2017_WEB value - * @property {number} POSTGRES_9_6=9 POSTGRES_9_6 value - * @property {number} POSTGRES_10=18 POSTGRES_10 value - * @property {number} POSTGRES_11=10 POSTGRES_11 value - * @property {number} POSTGRES_12=19 POSTGRES_12 value - * @property {number} POSTGRES_13=23 POSTGRES_13 value - * @property {number} POSTGRES_14=110 POSTGRES_14 value - * @property {number} POSTGRES_15=172 POSTGRES_15 value - * @property {number} POSTGRES_16=272 POSTGRES_16 value - * @property {number} POSTGRES_17=408 POSTGRES_17 value - * @property {number} POSTGRES_18=557 POSTGRES_18 value - * @property {number} SQLSERVER_2019_STANDARD=26 SQLSERVER_2019_STANDARD value - * @property {number} SQLSERVER_2019_ENTERPRISE=27 SQLSERVER_2019_ENTERPRISE value - * @property {number} SQLSERVER_2019_EXPRESS=28 SQLSERVER_2019_EXPRESS value - * @property {number} SQLSERVER_2019_WEB=29 SQLSERVER_2019_WEB value - * @property {number} SQLSERVER_2022_STANDARD=199 SQLSERVER_2022_STANDARD value - * @property {number} SQLSERVER_2022_ENTERPRISE=200 SQLSERVER_2022_ENTERPRISE value - * @property {number} SQLSERVER_2022_EXPRESS=201 SQLSERVER_2022_EXPRESS value - * @property {number} SQLSERVER_2022_WEB=202 SQLSERVER_2022_WEB value - */ - v1beta4.SqlDatabaseVersion = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_DATABASE_VERSION_UNSPECIFIED"] = 0; - values[valuesById[2] = "MYSQL_5_1"] = 2; - values[valuesById[3] = "MYSQL_5_5"] = 3; - values[valuesById[5] = "MYSQL_5_6"] = 5; - values[valuesById[6] = "MYSQL_5_7"] = 6; - values[valuesById[20] = "MYSQL_8_0"] = 20; - values[valuesById[41] = "MYSQL_8_0_18"] = 41; - values[valuesById[85] = "MYSQL_8_0_26"] = 85; - values[valuesById[111] = "MYSQL_8_0_27"] = 111; - values[valuesById[132] = "MYSQL_8_0_28"] = 132; - values[valuesById[148] = "MYSQL_8_0_29"] = 148; - values[valuesById[174] = "MYSQL_8_0_30"] = 174; - values[valuesById[197] = "MYSQL_8_0_31"] = 197; - values[valuesById[213] = "MYSQL_8_0_32"] = 213; - values[valuesById[238] = "MYSQL_8_0_33"] = 238; - values[valuesById[239] = "MYSQL_8_0_34"] = 239; - values[valuesById[240] = "MYSQL_8_0_35"] = 240; - values[valuesById[241] = "MYSQL_8_0_36"] = 241; - values[valuesById[355] = "MYSQL_8_0_37"] = 355; - values[valuesById[357] = "MYSQL_8_0_39"] = 357; - values[valuesById[358] = "MYSQL_8_0_40"] = 358; - values[valuesById[488] = "MYSQL_8_0_41"] = 488; - values[valuesById[489] = "MYSQL_8_0_42"] = 489; - values[valuesById[553] = "MYSQL_8_0_43"] = 553; - values[valuesById[554] = "MYSQL_8_0_44"] = 554; - values[valuesById[555] = "MYSQL_8_0_45"] = 555; - values[valuesById[556] = "MYSQL_8_0_46"] = 556; - values[valuesById[398] = "MYSQL_8_4"] = 398; - values[valuesById[654] = "MYSQL_9_7"] = 654; - values[valuesById[11] = "SQLSERVER_2017_STANDARD"] = 11; - values[valuesById[14] = "SQLSERVER_2017_ENTERPRISE"] = 14; - values[valuesById[15] = "SQLSERVER_2017_EXPRESS"] = 15; - values[valuesById[16] = "SQLSERVER_2017_WEB"] = 16; - values[valuesById[9] = "POSTGRES_9_6"] = 9; - values[valuesById[18] = "POSTGRES_10"] = 18; - values[valuesById[10] = "POSTGRES_11"] = 10; - values[valuesById[19] = "POSTGRES_12"] = 19; - values[valuesById[23] = "POSTGRES_13"] = 23; - values[valuesById[110] = "POSTGRES_14"] = 110; - values[valuesById[172] = "POSTGRES_15"] = 172; - values[valuesById[272] = "POSTGRES_16"] = 272; - values[valuesById[408] = "POSTGRES_17"] = 408; - values[valuesById[557] = "POSTGRES_18"] = 557; - values[valuesById[26] = "SQLSERVER_2019_STANDARD"] = 26; - values[valuesById[27] = "SQLSERVER_2019_ENTERPRISE"] = 27; - values[valuesById[28] = "SQLSERVER_2019_EXPRESS"] = 28; - values[valuesById[29] = "SQLSERVER_2019_WEB"] = 29; - values[valuesById[199] = "SQLSERVER_2022_STANDARD"] = 199; - values[valuesById[200] = "SQLSERVER_2022_ENTERPRISE"] = 200; - values[valuesById[201] = "SQLSERVER_2022_EXPRESS"] = 201; - values[valuesById[202] = "SQLSERVER_2022_WEB"] = 202; - return values; - })(); - - /** - * SqlSuspensionReason enum. - * @name google.cloud.sql.v1beta4.SqlSuspensionReason - * @enum {number} - * @property {number} SQL_SUSPENSION_REASON_UNSPECIFIED=0 SQL_SUSPENSION_REASON_UNSPECIFIED value - * @property {number} BILLING_ISSUE=2 BILLING_ISSUE value - * @property {number} LEGAL_ISSUE=3 LEGAL_ISSUE value - * @property {number} OPERATIONAL_ISSUE=4 OPERATIONAL_ISSUE value - * @property {number} KMS_KEY_ISSUE=5 KMS_KEY_ISSUE value - */ - v1beta4.SqlSuspensionReason = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_SUSPENSION_REASON_UNSPECIFIED"] = 0; - values[valuesById[2] = "BILLING_ISSUE"] = 2; - values[valuesById[3] = "LEGAL_ISSUE"] = 3; - values[valuesById[4] = "OPERATIONAL_ISSUE"] = 4; - values[valuesById[5] = "KMS_KEY_ISSUE"] = 5; - return values; - })(); - - /** - * SqlPricingPlan enum. - * @name google.cloud.sql.v1beta4.SqlPricingPlan - * @enum {number} - * @property {number} SQL_PRICING_PLAN_UNSPECIFIED=0 SQL_PRICING_PLAN_UNSPECIFIED value - * @property {number} PACKAGE=1 PACKAGE value - * @property {number} PER_USE=2 PER_USE value - */ - v1beta4.SqlPricingPlan = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_PRICING_PLAN_UNSPECIFIED"] = 0; - values[valuesById[1] = "PACKAGE"] = 1; - values[valuesById[2] = "PER_USE"] = 2; - return values; - })(); - - /** - * SqlReplicationType enum. - * @name google.cloud.sql.v1beta4.SqlReplicationType - * @enum {number} - * @property {number} SQL_REPLICATION_TYPE_UNSPECIFIED=0 SQL_REPLICATION_TYPE_UNSPECIFIED value - * @property {number} SYNCHRONOUS=1 SYNCHRONOUS value - * @property {number} ASYNCHRONOUS=2 ASYNCHRONOUS value - */ - v1beta4.SqlReplicationType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_REPLICATION_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SYNCHRONOUS"] = 1; - values[valuesById[2] = "ASYNCHRONOUS"] = 2; - return values; - })(); - - /** - * SqlDataDiskType enum. - * @name google.cloud.sql.v1beta4.SqlDataDiskType - * @enum {number} - * @property {number} SQL_DATA_DISK_TYPE_UNSPECIFIED=0 SQL_DATA_DISK_TYPE_UNSPECIFIED value - * @property {number} PD_SSD=1 PD_SSD value - * @property {number} PD_HDD=2 PD_HDD value - * @property {number} OBSOLETE_LOCAL_SSD=3 OBSOLETE_LOCAL_SSD value - * @property {number} HYPERDISK_BALANCED=4 HYPERDISK_BALANCED value - */ - v1beta4.SqlDataDiskType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_DATA_DISK_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "PD_SSD"] = 1; - values[valuesById[2] = "PD_HDD"] = 2; - values[valuesById[3] = "OBSOLETE_LOCAL_SSD"] = 3; - values[valuesById[4] = "HYPERDISK_BALANCED"] = 4; - return values; - })(); - - /** - * SqlAvailabilityType enum. - * @name google.cloud.sql.v1beta4.SqlAvailabilityType - * @enum {number} - * @property {number} SQL_AVAILABILITY_TYPE_UNSPECIFIED=0 SQL_AVAILABILITY_TYPE_UNSPECIFIED value - * @property {number} ZONAL=1 ZONAL value - * @property {number} REGIONAL=2 REGIONAL value - */ - v1beta4.SqlAvailabilityType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_AVAILABILITY_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "ZONAL"] = 1; - values[valuesById[2] = "REGIONAL"] = 2; - return values; - })(); - - /** - * SqlUpdateTrack enum. - * @name google.cloud.sql.v1beta4.SqlUpdateTrack - * @enum {number} - * @property {number} SQL_UPDATE_TRACK_UNSPECIFIED=0 SQL_UPDATE_TRACK_UNSPECIFIED value - * @property {number} canary=1 canary value - * @property {number} stable=2 stable value - * @property {number} week5=3 week5 value - */ - v1beta4.SqlUpdateTrack = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_UPDATE_TRACK_UNSPECIFIED"] = 0; - values[valuesById[1] = "canary"] = 1; - values[valuesById[2] = "stable"] = 2; - values[valuesById[3] = "week5"] = 3; - return values; - })(); - - v1beta4.AcquireSsrsLeaseContext = (function() { - - /** - * Properties of an AcquireSsrsLeaseContext. - * @memberof google.cloud.sql.v1beta4 - * @interface IAcquireSsrsLeaseContext - * @property {string|null} [setupLogin] AcquireSsrsLeaseContext setupLogin - * @property {string|null} [serviceLogin] AcquireSsrsLeaseContext serviceLogin - * @property {string|null} [reportDatabase] AcquireSsrsLeaseContext reportDatabase - * @property {google.protobuf.IDuration|null} [duration] AcquireSsrsLeaseContext duration - */ - - /** - * Constructs a new AcquireSsrsLeaseContext. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents an AcquireSsrsLeaseContext. - * @implements IAcquireSsrsLeaseContext - * @constructor - * @param {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext=} [properties] Properties to set - */ - function AcquireSsrsLeaseContext(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * AcquireSsrsLeaseContext setupLogin. - * @member {string|null|undefined} setupLogin - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @instance - */ - AcquireSsrsLeaseContext.prototype.setupLogin = null; - - /** - * AcquireSsrsLeaseContext serviceLogin. - * @member {string|null|undefined} serviceLogin - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @instance - */ - AcquireSsrsLeaseContext.prototype.serviceLogin = null; - - /** - * AcquireSsrsLeaseContext reportDatabase. - * @member {string|null|undefined} reportDatabase - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @instance - */ - AcquireSsrsLeaseContext.prototype.reportDatabase = null; - - /** - * AcquireSsrsLeaseContext duration. - * @member {google.protobuf.IDuration|null|undefined} duration - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @instance - */ - AcquireSsrsLeaseContext.prototype.duration = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_setupLogin", { - get: $util.oneOfGetter($oneOfFields = ["setupLogin"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_serviceLogin", { - get: $util.oneOfGetter($oneOfFields = ["serviceLogin"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_reportDatabase", { - get: $util.oneOfGetter($oneOfFields = ["reportDatabase"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(AcquireSsrsLeaseContext.prototype, "_duration", { - get: $util.oneOfGetter($oneOfFields = ["duration"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new AcquireSsrsLeaseContext instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @static - * @param {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext instance - */ - AcquireSsrsLeaseContext.create = function create(properties) { - return new AcquireSsrsLeaseContext(properties); - }; - - /** - * Encodes the specified AcquireSsrsLeaseContext message. Does not implicitly {@link google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @static - * @param {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext} message AcquireSsrsLeaseContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AcquireSsrsLeaseContext.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.setupLogin != null && Object.hasOwnProperty.call(message, "setupLogin")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.setupLogin); - if (message.serviceLogin != null && Object.hasOwnProperty.call(message, "serviceLogin")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.serviceLogin); - if (message.reportDatabase != null && Object.hasOwnProperty.call(message, "reportDatabase")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.reportDatabase); - if (message.duration != null && Object.hasOwnProperty.call(message, "duration")) - $root.google.protobuf.Duration.encode(message.duration, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified AcquireSsrsLeaseContext message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @static - * @param {google.cloud.sql.v1beta4.IAcquireSsrsLeaseContext} message AcquireSsrsLeaseContext message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - AcquireSsrsLeaseContext.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AcquireSsrsLeaseContext.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.setupLogin = reader.string(); - break; - } - case 2: { - message.serviceLogin = reader.string(); - break; - } - case 3: { - message.reportDatabase = reader.string(); - break; - } - case 4: { - message.duration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an AcquireSsrsLeaseContext message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - AcquireSsrsLeaseContext.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an AcquireSsrsLeaseContext message. - * @function verify - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - AcquireSsrsLeaseContext.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.setupLogin != null && message.hasOwnProperty("setupLogin")) { - properties._setupLogin = 1; - if (!$util.isString(message.setupLogin)) - return "setupLogin: string expected"; - } - if (message.serviceLogin != null && message.hasOwnProperty("serviceLogin")) { - properties._serviceLogin = 1; - if (!$util.isString(message.serviceLogin)) - return "serviceLogin: string expected"; - } - if (message.reportDatabase != null && message.hasOwnProperty("reportDatabase")) { - properties._reportDatabase = 1; - if (!$util.isString(message.reportDatabase)) - return "reportDatabase: string expected"; - } - if (message.duration != null && message.hasOwnProperty("duration")) { - properties._duration = 1; - { - var error = $root.google.protobuf.Duration.verify(message.duration); - if (error) - return "duration." + error; - } - } - return null; - }; - - /** - * Creates an AcquireSsrsLeaseContext message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.AcquireSsrsLeaseContext} AcquireSsrsLeaseContext - */ - AcquireSsrsLeaseContext.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext) - return object; - var message = new $root.google.cloud.sql.v1beta4.AcquireSsrsLeaseContext(); - if (object.setupLogin != null) - message.setupLogin = String(object.setupLogin); - if (object.serviceLogin != null) - message.serviceLogin = String(object.serviceLogin); - if (object.reportDatabase != null) - message.reportDatabase = String(object.reportDatabase); - if (object.duration != null) { - if (typeof object.duration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.AcquireSsrsLeaseContext.duration: object expected"); - message.duration = $root.google.protobuf.Duration.fromObject(object.duration); - } - return message; - }; - - /** - * Creates a plain object from an AcquireSsrsLeaseContext message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @static - * @param {google.cloud.sql.v1beta4.AcquireSsrsLeaseContext} message AcquireSsrsLeaseContext - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - AcquireSsrsLeaseContext.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (message.setupLogin != null && message.hasOwnProperty("setupLogin")) { - object.setupLogin = message.setupLogin; - if (options.oneofs) - object._setupLogin = "setupLogin"; - } - if (message.serviceLogin != null && message.hasOwnProperty("serviceLogin")) { - object.serviceLogin = message.serviceLogin; - if (options.oneofs) - object._serviceLogin = "serviceLogin"; - } - if (message.reportDatabase != null && message.hasOwnProperty("reportDatabase")) { - object.reportDatabase = message.reportDatabase; - if (options.oneofs) - object._reportDatabase = "reportDatabase"; - } - if (message.duration != null && message.hasOwnProperty("duration")) { - object.duration = $root.google.protobuf.Duration.toObject(message.duration, options); - if (options.oneofs) - object._duration = "duration"; - } - return object; - }; - - /** - * Converts this AcquireSsrsLeaseContext to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @instance - * @returns {Object.} JSON object - */ - AcquireSsrsLeaseContext.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for AcquireSsrsLeaseContext - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.AcquireSsrsLeaseContext - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - AcquireSsrsLeaseContext.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.AcquireSsrsLeaseContext"; - }; - - return AcquireSsrsLeaseContext; - })(); - - /** - * SqlFlagType enum. - * @name google.cloud.sql.v1beta4.SqlFlagType - * @enum {number} - * @property {number} SQL_FLAG_TYPE_UNSPECIFIED=0 SQL_FLAG_TYPE_UNSPECIFIED value - * @property {number} BOOLEAN=1 BOOLEAN value - * @property {number} STRING=2 STRING value - * @property {number} INTEGER=3 INTEGER value - * @property {number} NONE=4 NONE value - * @property {number} MYSQL_TIMEZONE_OFFSET=5 MYSQL_TIMEZONE_OFFSET value - * @property {number} FLOAT=6 FLOAT value - * @property {number} REPEATED_STRING=7 REPEATED_STRING value - */ - v1beta4.SqlFlagType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_FLAG_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "BOOLEAN"] = 1; - values[valuesById[2] = "STRING"] = 2; - values[valuesById[3] = "INTEGER"] = 3; - values[valuesById[4] = "NONE"] = 4; - values[valuesById[5] = "MYSQL_TIMEZONE_OFFSET"] = 5; - values[valuesById[6] = "FLOAT"] = 6; - values[valuesById[7] = "REPEATED_STRING"] = 7; - return values; - })(); - - /** - * SqlFlagScope enum. - * @name google.cloud.sql.v1beta4.SqlFlagScope - * @enum {number} - * @property {number} SQL_FLAG_SCOPE_UNSPECIFIED=0 SQL_FLAG_SCOPE_UNSPECIFIED value - * @property {number} SQL_FLAG_SCOPE_DATABASE=1 SQL_FLAG_SCOPE_DATABASE value - * @property {number} SQL_FLAG_SCOPE_CONNECTION_POOL=2 SQL_FLAG_SCOPE_CONNECTION_POOL value - */ - v1beta4.SqlFlagScope = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "SQL_FLAG_SCOPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "SQL_FLAG_SCOPE_DATABASE"] = 1; - values[valuesById[2] = "SQL_FLAG_SCOPE_CONNECTION_POOL"] = 2; - return values; - })(); - - v1beta4.SqlConnectService = (function() { - - /** - * Constructs a new SqlConnectService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlConnectService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlConnectService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlConnectService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlConnectService; - - /** - * Creates new SqlConnectService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlConnectService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlConnectService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlConnectService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlConnectService|getConnectSettings}. - * @memberof google.cloud.sql.v1beta4.SqlConnectService - * @typedef GetConnectSettingsCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.ConnectSettings} [response] ConnectSettings - */ - - /** - * Calls GetConnectSettings. - * @function getConnectSettings - * @memberof google.cloud.sql.v1beta4.SqlConnectService - * @instance - * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest} request GetConnectSettingsRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlConnectService.GetConnectSettingsCallback} callback Node-style callback called with the error, if any, and ConnectSettings - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlConnectService.prototype.getConnectSettings = function getConnectSettings(request, callback) { - return this.rpcCall(getConnectSettings, $root.google.cloud.sql.v1beta4.GetConnectSettingsRequest, $root.google.cloud.sql.v1beta4.ConnectSettings, request, callback); - }, "name", { value: "GetConnectSettings" }); - - /** - * Calls GetConnectSettings. - * @function getConnectSettings - * @memberof google.cloud.sql.v1beta4.SqlConnectService - * @instance - * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest} request GetConnectSettingsRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlConnectService|generateEphemeralCert}. - * @memberof google.cloud.sql.v1beta4.SqlConnectService - * @typedef GenerateEphemeralCertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} [response] GenerateEphemeralCertResponse - */ - - /** - * Calls GenerateEphemeralCert. - * @function generateEphemeralCert - * @memberof google.cloud.sql.v1beta4.SqlConnectService - * @instance - * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest} request GenerateEphemeralCertRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlConnectService.GenerateEphemeralCertCallback} callback Node-style callback called with the error, if any, and GenerateEphemeralCertResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlConnectService.prototype.generateEphemeralCert = function generateEphemeralCert(request, callback) { - return this.rpcCall(generateEphemeralCert, $root.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest, $root.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse, request, callback); - }, "name", { value: "GenerateEphemeralCert" }); - - /** - * Calls GenerateEphemeralCert. - * @function generateEphemeralCert - * @memberof google.cloud.sql.v1beta4.SqlConnectService - * @instance - * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest} request GenerateEphemeralCertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlConnectService; - })(); - - v1beta4.GetConnectSettingsRequest = (function() { - - /** - * Properties of a GetConnectSettingsRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IGetConnectSettingsRequest - * @property {string|null} [instance] GetConnectSettingsRequest instance - * @property {string|null} [project] GetConnectSettingsRequest project - * @property {google.protobuf.ITimestamp|null} [readTime] GetConnectSettingsRequest readTime - */ - - /** - * Constructs a new GetConnectSettingsRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a GetConnectSettingsRequest. - * @implements IGetConnectSettingsRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest=} [properties] Properties to set - */ - function GetConnectSettingsRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GetConnectSettingsRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @instance - */ - GetConnectSettingsRequest.prototype.instance = ""; - - /** - * GetConnectSettingsRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @instance - */ - GetConnectSettingsRequest.prototype.project = ""; - - /** - * GetConnectSettingsRequest readTime. - * @member {google.protobuf.ITimestamp|null|undefined} readTime - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @instance - */ - GetConnectSettingsRequest.prototype.readTime = null; - - /** - * Creates a new GetConnectSettingsRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @static - * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.GetConnectSettingsRequest} GetConnectSettingsRequest instance - */ - GetConnectSettingsRequest.create = function create(properties) { - return new GetConnectSettingsRequest(properties); - }; - - /** - * Encodes the specified GetConnectSettingsRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GetConnectSettingsRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @static - * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest} message GetConnectSettingsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConnectSettingsRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) - $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GetConnectSettingsRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GetConnectSettingsRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @static - * @param {google.cloud.sql.v1beta4.IGetConnectSettingsRequest} message GetConnectSettingsRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GetConnectSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GetConnectSettingsRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.GetConnectSettingsRequest} GetConnectSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConnectSettingsRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.GetConnectSettingsRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 7: { - message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GetConnectSettingsRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.GetConnectSettingsRequest} GetConnectSettingsRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GetConnectSettingsRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GetConnectSettingsRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GetConnectSettingsRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.readTime != null && message.hasOwnProperty("readTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.readTime); - if (error) - return "readTime." + error; - } - return null; - }; - - /** - * Creates a GetConnectSettingsRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.GetConnectSettingsRequest} GetConnectSettingsRequest - */ - GetConnectSettingsRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.GetConnectSettingsRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.GetConnectSettingsRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.readTime != null) { - if (typeof object.readTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.GetConnectSettingsRequest.readTime: object expected"); - message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime); - } - return message; - }; - - /** - * Creates a plain object from a GetConnectSettingsRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @static - * @param {google.cloud.sql.v1beta4.GetConnectSettingsRequest} message GetConnectSettingsRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GetConnectSettingsRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.readTime = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.readTime != null && message.hasOwnProperty("readTime")) - object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options); - return object; - }; - - /** - * Converts this GetConnectSettingsRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @instance - * @returns {Object.} JSON object - */ - GetConnectSettingsRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GetConnectSettingsRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.GetConnectSettingsRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GetConnectSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.GetConnectSettingsRequest"; - }; - - return GetConnectSettingsRequest; - })(); - - v1beta4.ConnectSettings = (function() { - - /** - * Properties of a ConnectSettings. - * @memberof google.cloud.sql.v1beta4 - * @interface IConnectSettings - * @property {string|null} [kind] ConnectSettings kind - * @property {google.cloud.sql.v1beta4.ISslCert|null} [serverCaCert] ConnectSettings serverCaCert - * @property {Array.|null} [ipAddresses] ConnectSettings ipAddresses - * @property {string|null} [region] ConnectSettings region - * @property {google.cloud.sql.v1beta4.SqlDatabaseVersion|null} [databaseVersion] ConnectSettings databaseVersion - * @property {google.cloud.sql.v1beta4.SqlBackendType|null} [backendType] ConnectSettings backendType - * @property {boolean|null} [pscEnabled] ConnectSettings pscEnabled - * @property {string|null} [dnsName] ConnectSettings dnsName - * @property {google.cloud.sql.v1beta4.ConnectSettings.CaMode|null} [serverCaMode] ConnectSettings serverCaMode - * @property {Array.|null} [customSubjectAlternativeNames] ConnectSettings customSubjectAlternativeNames - * @property {Array.|null} [dnsNames] ConnectSettings dnsNames - * @property {number|null} [nodeCount] ConnectSettings nodeCount - * @property {Array.|null} [nodes] ConnectSettings nodes - * @property {Array.|null} [mdxProtocolSupport] ConnectSettings mdxProtocolSupport - */ - - /** - * Constructs a new ConnectSettings. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a ConnectSettings. - * @implements IConnectSettings - * @constructor - * @param {google.cloud.sql.v1beta4.IConnectSettings=} [properties] Properties to set - */ - function ConnectSettings(properties) { - this.ipAddresses = []; - this.customSubjectAlternativeNames = []; - this.dnsNames = []; - this.nodes = []; - this.mdxProtocolSupport = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectSettings kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.kind = ""; - - /** - * ConnectSettings serverCaCert. - * @member {google.cloud.sql.v1beta4.ISslCert|null|undefined} serverCaCert - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.serverCaCert = null; - - /** - * ConnectSettings ipAddresses. - * @member {Array.} ipAddresses - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.ipAddresses = $util.emptyArray; - - /** - * ConnectSettings region. - * @member {string} region - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.region = ""; - - /** - * ConnectSettings databaseVersion. - * @member {google.cloud.sql.v1beta4.SqlDatabaseVersion} databaseVersion - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.databaseVersion = 0; - - /** - * ConnectSettings backendType. - * @member {google.cloud.sql.v1beta4.SqlBackendType} backendType - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.backendType = 0; - - /** - * ConnectSettings pscEnabled. - * @member {boolean} pscEnabled - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.pscEnabled = false; - - /** - * ConnectSettings dnsName. - * @member {string} dnsName - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.dnsName = ""; - - /** - * ConnectSettings serverCaMode. - * @member {google.cloud.sql.v1beta4.ConnectSettings.CaMode} serverCaMode - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.serverCaMode = 0; - - /** - * ConnectSettings customSubjectAlternativeNames. - * @member {Array.} customSubjectAlternativeNames - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.customSubjectAlternativeNames = $util.emptyArray; - - /** - * ConnectSettings dnsNames. - * @member {Array.} dnsNames - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.dnsNames = $util.emptyArray; - - /** - * ConnectSettings nodeCount. - * @member {number|null|undefined} nodeCount - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.nodeCount = null; - - /** - * ConnectSettings nodes. - * @member {Array.} nodes - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.nodes = $util.emptyArray; - - /** - * ConnectSettings mdxProtocolSupport. - * @member {Array.} mdxProtocolSupport - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - */ - ConnectSettings.prototype.mdxProtocolSupport = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ConnectSettings.prototype, "_nodeCount", { - get: $util.oneOfGetter($oneOfFields = ["nodeCount"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ConnectSettings instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @static - * @param {google.cloud.sql.v1beta4.IConnectSettings=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ConnectSettings} ConnectSettings instance - */ - ConnectSettings.create = function create(properties) { - return new ConnectSettings(properties); - }; - - /** - * Encodes the specified ConnectSettings message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @static - * @param {google.cloud.sql.v1beta4.IConnectSettings} message ConnectSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.serverCaCert != null && Object.hasOwnProperty.call(message, "serverCaCert")) - $root.google.cloud.sql.v1beta4.SslCert.encode(message.serverCaCert, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.ipAddresses != null && message.ipAddresses.length) - for (var i = 0; i < message.ipAddresses.length; ++i) - $root.google.cloud.sql.v1beta4.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.region != null && Object.hasOwnProperty.call(message, "region")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.region); - if (message.databaseVersion != null && Object.hasOwnProperty.call(message, "databaseVersion")) - writer.uint32(/* id 31, wireType 0 =*/248).int32(message.databaseVersion); - if (message.backendType != null && Object.hasOwnProperty.call(message, "backendType")) - writer.uint32(/* id 32, wireType 0 =*/256).int32(message.backendType); - if (message.pscEnabled != null && Object.hasOwnProperty.call(message, "pscEnabled")) - writer.uint32(/* id 33, wireType 0 =*/264).bool(message.pscEnabled); - if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) - writer.uint32(/* id 34, wireType 2 =*/274).string(message.dnsName); - if (message.serverCaMode != null && Object.hasOwnProperty.call(message, "serverCaMode")) - writer.uint32(/* id 35, wireType 0 =*/280).int32(message.serverCaMode); - if (message.customSubjectAlternativeNames != null && message.customSubjectAlternativeNames.length) - for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) - writer.uint32(/* id 37, wireType 2 =*/298).string(message.customSubjectAlternativeNames[i]); - if (message.dnsNames != null && message.dnsNames.length) - for (var i = 0; i < message.dnsNames.length; ++i) - $root.google.cloud.sql.v1beta4.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 38, wireType 2 =*/306).fork()).ldelim(); - if (message.mdxProtocolSupport != null && message.mdxProtocolSupport.length) { - writer.uint32(/* id 39, wireType 2 =*/314).fork(); - for (var i = 0; i < message.mdxProtocolSupport.length; ++i) - writer.int32(message.mdxProtocolSupport[i]); - writer.ldelim(); - } - if (message.nodeCount != null && Object.hasOwnProperty.call(message, "nodeCount")) - writer.uint32(/* id 63, wireType 0 =*/504).int32(message.nodeCount); - if (message.nodes != null && message.nodes.length) - for (var i = 0; i < message.nodes.length; ++i) - $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.encode(message.nodes[i], writer.uint32(/* id 64, wireType 2 =*/514).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ConnectSettings message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @static - * @param {google.cloud.sql.v1beta4.IConnectSettings} message ConnectSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectSettings message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ConnectSettings} ConnectSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ConnectSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.ipAddresses && message.ipAddresses.length)) - message.ipAddresses = []; - message.ipAddresses.push($root.google.cloud.sql.v1beta4.IpMapping.decode(reader, reader.uint32())); - break; - } - case 4: { - message.region = reader.string(); - break; - } - case 31: { - message.databaseVersion = reader.int32(); - break; - } - case 32: { - message.backendType = reader.int32(); - break; - } - case 33: { - message.pscEnabled = reader.bool(); - break; - } - case 34: { - message.dnsName = reader.string(); - break; - } - case 35: { - message.serverCaMode = reader.int32(); - break; - } - case 37: { - if (!(message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length)) - message.customSubjectAlternativeNames = []; - message.customSubjectAlternativeNames.push(reader.string()); - break; - } - case 38: { - if (!(message.dnsNames && message.dnsNames.length)) - message.dnsNames = []; - message.dnsNames.push($root.google.cloud.sql.v1beta4.DnsNameMapping.decode(reader, reader.uint32())); - break; - } - case 63: { - message.nodeCount = reader.int32(); - break; - } - case 64: { - if (!(message.nodes && message.nodes.length)) - message.nodes = []; - message.nodes.push($root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.decode(reader, reader.uint32())); - break; - } - case 39: { - if (!(message.mdxProtocolSupport && message.mdxProtocolSupport.length)) - message.mdxProtocolSupport = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.mdxProtocolSupport.push(reader.int32()); - } else - message.mdxProtocolSupport.push(reader.int32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ConnectSettings} ConnectSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectSettings message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) { - var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.serverCaCert); - if (error) - return "serverCaCert." + error; - } - if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { - if (!Array.isArray(message.ipAddresses)) - return "ipAddresses: array expected"; - for (var i = 0; i < message.ipAddresses.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.IpMapping.verify(message.ipAddresses[i]); - if (error) - return "ipAddresses." + error; - } - } - if (message.region != null && message.hasOwnProperty("region")) - if (!$util.isString(message.region)) - return "region: string expected"; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - switch (message.databaseVersion) { - default: - return "databaseVersion: enum value expected"; - case 0: - case 2: - case 3: - case 5: - case 6: - case 20: - case 41: - case 85: - case 111: - case 132: - case 148: - case 174: - case 197: - case 213: - case 238: - case 239: - case 240: - case 241: - case 355: - case 357: - case 358: - case 488: - case 489: - case 553: - case 554: - case 555: - case 556: - case 398: - case 654: - case 11: - case 14: - case 15: - case 16: - case 9: - case 18: - case 10: - case 19: - case 23: - case 110: - case 172: - case 272: - case 408: - case 557: - case 26: - case 27: - case 28: - case 29: - case 199: - case 200: - case 201: - case 202: - break; - } - if (message.backendType != null && message.hasOwnProperty("backendType")) - switch (message.backendType) { - default: - return "backendType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) - if (typeof message.pscEnabled !== "boolean") - return "pscEnabled: boolean expected"; - if (message.dnsName != null && message.hasOwnProperty("dnsName")) - if (!$util.isString(message.dnsName)) - return "dnsName: string expected"; - if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) - switch (message.serverCaMode) { - default: - return "serverCaMode: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.customSubjectAlternativeNames != null && message.hasOwnProperty("customSubjectAlternativeNames")) { - if (!Array.isArray(message.customSubjectAlternativeNames)) - return "customSubjectAlternativeNames: array expected"; - for (var i = 0; i < message.customSubjectAlternativeNames.length; ++i) - if (!$util.isString(message.customSubjectAlternativeNames[i])) - return "customSubjectAlternativeNames: string[] expected"; - } - if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { - if (!Array.isArray(message.dnsNames)) - return "dnsNames: array expected"; - for (var i = 0; i < message.dnsNames.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.DnsNameMapping.verify(message.dnsNames[i]); - if (error) - return "dnsNames." + error; - } - } - if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { - properties._nodeCount = 1; - if (!$util.isInteger(message.nodeCount)) - return "nodeCount: integer expected"; - } - if (message.nodes != null && message.hasOwnProperty("nodes")) { - if (!Array.isArray(message.nodes)) - return "nodes: array expected"; - for (var i = 0; i < message.nodes.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.verify(message.nodes[i]); - if (error) - return "nodes." + error; - } - } - if (message.mdxProtocolSupport != null && message.hasOwnProperty("mdxProtocolSupport")) { - if (!Array.isArray(message.mdxProtocolSupport)) - return "mdxProtocolSupport: array expected"; - for (var i = 0; i < message.mdxProtocolSupport.length; ++i) - switch (message.mdxProtocolSupport[i]) { - default: - return "mdxProtocolSupport: enum value[] expected"; - case 0: - case 1: - break; - } - } - return null; - }; - - /** - * Creates a ConnectSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ConnectSettings} ConnectSettings - */ - ConnectSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ConnectSettings) - return object; - var message = new $root.google.cloud.sql.v1beta4.ConnectSettings(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.serverCaCert != null) { - if (typeof object.serverCaCert !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.serverCaCert: object expected"); - message.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.serverCaCert); - } - if (object.ipAddresses) { - if (!Array.isArray(object.ipAddresses)) - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ipAddresses: array expected"); - message.ipAddresses = []; - for (var i = 0; i < object.ipAddresses.length; ++i) { - if (typeof object.ipAddresses[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ipAddresses: object expected"); - message.ipAddresses[i] = $root.google.cloud.sql.v1beta4.IpMapping.fromObject(object.ipAddresses[i]); - } - } - if (object.region != null) - message.region = String(object.region); - switch (object.databaseVersion) { - default: - if (typeof object.databaseVersion === "number") { - message.databaseVersion = object.databaseVersion; - break; - } - break; - case "SQL_DATABASE_VERSION_UNSPECIFIED": - case 0: - message.databaseVersion = 0; - break; - case "MYSQL_5_1": - case 2: - message.databaseVersion = 2; - break; - case "MYSQL_5_5": - case 3: - message.databaseVersion = 3; - break; - case "MYSQL_5_6": - case 5: - message.databaseVersion = 5; - break; - case "MYSQL_5_7": - case 6: - message.databaseVersion = 6; - break; - case "MYSQL_8_0": - case 20: - message.databaseVersion = 20; - break; - case "MYSQL_8_0_18": - case 41: - message.databaseVersion = 41; - break; - case "MYSQL_8_0_26": - case 85: - message.databaseVersion = 85; - break; - case "MYSQL_8_0_27": - case 111: - message.databaseVersion = 111; - break; - case "MYSQL_8_0_28": - case 132: - message.databaseVersion = 132; - break; - case "MYSQL_8_0_29": - case 148: - message.databaseVersion = 148; - break; - case "MYSQL_8_0_30": - case 174: - message.databaseVersion = 174; - break; - case "MYSQL_8_0_31": - case 197: - message.databaseVersion = 197; - break; - case "MYSQL_8_0_32": - case 213: - message.databaseVersion = 213; - break; - case "MYSQL_8_0_33": - case 238: - message.databaseVersion = 238; - break; - case "MYSQL_8_0_34": - case 239: - message.databaseVersion = 239; - break; - case "MYSQL_8_0_35": - case 240: - message.databaseVersion = 240; - break; - case "MYSQL_8_0_36": - case 241: - message.databaseVersion = 241; - break; - case "MYSQL_8_0_37": - case 355: - message.databaseVersion = 355; - break; - case "MYSQL_8_0_39": - case 357: - message.databaseVersion = 357; - break; - case "MYSQL_8_0_40": - case 358: - message.databaseVersion = 358; - break; - case "MYSQL_8_0_41": - case 488: - message.databaseVersion = 488; - break; - case "MYSQL_8_0_42": - case 489: - message.databaseVersion = 489; - break; - case "MYSQL_8_0_43": - case 553: - message.databaseVersion = 553; - break; - case "MYSQL_8_0_44": - case 554: - message.databaseVersion = 554; - break; - case "MYSQL_8_0_45": - case 555: - message.databaseVersion = 555; - break; - case "MYSQL_8_0_46": - case 556: - message.databaseVersion = 556; - break; - case "MYSQL_8_4": - case 398: - message.databaseVersion = 398; - break; - case "MYSQL_9_7": - case 654: - message.databaseVersion = 654; - break; - case "SQLSERVER_2017_STANDARD": - case 11: - message.databaseVersion = 11; - break; - case "SQLSERVER_2017_ENTERPRISE": - case 14: - message.databaseVersion = 14; - break; - case "SQLSERVER_2017_EXPRESS": - case 15: - message.databaseVersion = 15; - break; - case "SQLSERVER_2017_WEB": - case 16: - message.databaseVersion = 16; - break; - case "POSTGRES_9_6": - case 9: - message.databaseVersion = 9; - break; - case "POSTGRES_10": - case 18: - message.databaseVersion = 18; - break; - case "POSTGRES_11": - case 10: - message.databaseVersion = 10; - break; - case "POSTGRES_12": - case 19: - message.databaseVersion = 19; - break; - case "POSTGRES_13": - case 23: - message.databaseVersion = 23; - break; - case "POSTGRES_14": - case 110: - message.databaseVersion = 110; - break; - case "POSTGRES_15": - case 172: - message.databaseVersion = 172; - break; - case "POSTGRES_16": - case 272: - message.databaseVersion = 272; - break; - case "POSTGRES_17": - case 408: - message.databaseVersion = 408; - break; - case "POSTGRES_18": - case 557: - message.databaseVersion = 557; - break; - case "SQLSERVER_2019_STANDARD": - case 26: - message.databaseVersion = 26; - break; - case "SQLSERVER_2019_ENTERPRISE": - case 27: - message.databaseVersion = 27; - break; - case "SQLSERVER_2019_EXPRESS": - case 28: - message.databaseVersion = 28; - break; - case "SQLSERVER_2019_WEB": - case 29: - message.databaseVersion = 29; - break; - case "SQLSERVER_2022_STANDARD": - case 199: - message.databaseVersion = 199; - break; - case "SQLSERVER_2022_ENTERPRISE": - case 200: - message.databaseVersion = 200; - break; - case "SQLSERVER_2022_EXPRESS": - case 201: - message.databaseVersion = 201; - break; - case "SQLSERVER_2022_WEB": - case 202: - message.databaseVersion = 202; - break; - } - switch (object.backendType) { - default: - if (typeof object.backendType === "number") { - message.backendType = object.backendType; - break; - } - break; - case "SQL_BACKEND_TYPE_UNSPECIFIED": - case 0: - message.backendType = 0; - break; - case "FIRST_GEN": - case 1: - message.backendType = 1; - break; - case "SECOND_GEN": - case 2: - message.backendType = 2; - break; - case "EXTERNAL": - case 3: - message.backendType = 3; - break; - } - if (object.pscEnabled != null) - message.pscEnabled = Boolean(object.pscEnabled); - if (object.dnsName != null) - message.dnsName = String(object.dnsName); - switch (object.serverCaMode) { - default: - if (typeof object.serverCaMode === "number") { - message.serverCaMode = object.serverCaMode; - break; - } - break; - case "CA_MODE_UNSPECIFIED": - case 0: - message.serverCaMode = 0; - break; - case "GOOGLE_MANAGED_INTERNAL_CA": - case 1: - message.serverCaMode = 1; - break; - case "GOOGLE_MANAGED_CAS_CA": - case 2: - message.serverCaMode = 2; - break; - case "CUSTOMER_MANAGED_CAS_CA": - case 3: - message.serverCaMode = 3; - break; - } - if (object.customSubjectAlternativeNames) { - if (!Array.isArray(object.customSubjectAlternativeNames)) - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.customSubjectAlternativeNames: array expected"); - message.customSubjectAlternativeNames = []; - for (var i = 0; i < object.customSubjectAlternativeNames.length; ++i) - message.customSubjectAlternativeNames[i] = String(object.customSubjectAlternativeNames[i]); - } - if (object.dnsNames) { - if (!Array.isArray(object.dnsNames)) - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.dnsNames: array expected"); - message.dnsNames = []; - for (var i = 0; i < object.dnsNames.length; ++i) { - if (typeof object.dnsNames[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.dnsNames: object expected"); - message.dnsNames[i] = $root.google.cloud.sql.v1beta4.DnsNameMapping.fromObject(object.dnsNames[i]); - } - } - if (object.nodeCount != null) - message.nodeCount = object.nodeCount | 0; - if (object.nodes) { - if (!Array.isArray(object.nodes)) - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.nodes: array expected"); - message.nodes = []; - for (var i = 0; i < object.nodes.length; ++i) { - if (typeof object.nodes[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.nodes: object expected"); - message.nodes[i] = $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.fromObject(object.nodes[i]); - } - } - if (object.mdxProtocolSupport) { - if (!Array.isArray(object.mdxProtocolSupport)) - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.mdxProtocolSupport: array expected"); - message.mdxProtocolSupport = []; - for (var i = 0; i < object.mdxProtocolSupport.length; ++i) - switch (object.mdxProtocolSupport[i]) { - default: - if (typeof object.mdxProtocolSupport[i] === "number") { - message.mdxProtocolSupport[i] = object.mdxProtocolSupport[i]; - break; - } - case "MDX_PROTOCOL_SUPPORT_UNSPECIFIED": - case 0: - message.mdxProtocolSupport[i] = 0; - break; - case "CLIENT_PROTOCOL_TYPE": - case 1: - message.mdxProtocolSupport[i] = 1; - break; - } - } - return message; - }; - - /** - * Creates a plain object from a ConnectSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @static - * @param {google.cloud.sql.v1beta4.ConnectSettings} message ConnectSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.ipAddresses = []; - object.customSubjectAlternativeNames = []; - object.dnsNames = []; - object.mdxProtocolSupport = []; - object.nodes = []; - } - if (options.defaults) { - object.kind = ""; - object.serverCaCert = null; - object.region = ""; - object.databaseVersion = options.enums === String ? "SQL_DATABASE_VERSION_UNSPECIFIED" : 0; - object.backendType = options.enums === String ? "SQL_BACKEND_TYPE_UNSPECIFIED" : 0; - object.pscEnabled = false; - object.dnsName = ""; - object.serverCaMode = options.enums === String ? "CA_MODE_UNSPECIFIED" : 0; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.serverCaCert != null && message.hasOwnProperty("serverCaCert")) - object.serverCaCert = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.serverCaCert, options); - if (message.ipAddresses && message.ipAddresses.length) { - object.ipAddresses = []; - for (var j = 0; j < message.ipAddresses.length; ++j) - object.ipAddresses[j] = $root.google.cloud.sql.v1beta4.IpMapping.toObject(message.ipAddresses[j], options); - } - if (message.region != null && message.hasOwnProperty("region")) - object.region = message.region; - if (message.databaseVersion != null && message.hasOwnProperty("databaseVersion")) - object.databaseVersion = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] === undefined ? message.databaseVersion : $root.google.cloud.sql.v1beta4.SqlDatabaseVersion[message.databaseVersion] : message.databaseVersion; - if (message.backendType != null && message.hasOwnProperty("backendType")) - object.backendType = options.enums === String ? $root.google.cloud.sql.v1beta4.SqlBackendType[message.backendType] === undefined ? message.backendType : $root.google.cloud.sql.v1beta4.SqlBackendType[message.backendType] : message.backendType; - if (message.pscEnabled != null && message.hasOwnProperty("pscEnabled")) - object.pscEnabled = message.pscEnabled; - if (message.dnsName != null && message.hasOwnProperty("dnsName")) - object.dnsName = message.dnsName; - if (message.serverCaMode != null && message.hasOwnProperty("serverCaMode")) - object.serverCaMode = options.enums === String ? $root.google.cloud.sql.v1beta4.ConnectSettings.CaMode[message.serverCaMode] === undefined ? message.serverCaMode : $root.google.cloud.sql.v1beta4.ConnectSettings.CaMode[message.serverCaMode] : message.serverCaMode; - if (message.customSubjectAlternativeNames && message.customSubjectAlternativeNames.length) { - object.customSubjectAlternativeNames = []; - for (var j = 0; j < message.customSubjectAlternativeNames.length; ++j) - object.customSubjectAlternativeNames[j] = message.customSubjectAlternativeNames[j]; - } - if (message.dnsNames && message.dnsNames.length) { - object.dnsNames = []; - for (var j = 0; j < message.dnsNames.length; ++j) - object.dnsNames[j] = $root.google.cloud.sql.v1beta4.DnsNameMapping.toObject(message.dnsNames[j], options); - } - if (message.mdxProtocolSupport && message.mdxProtocolSupport.length) { - object.mdxProtocolSupport = []; - for (var j = 0; j < message.mdxProtocolSupport.length; ++j) - object.mdxProtocolSupport[j] = options.enums === String ? $root.google.cloud.sql.v1beta4.ConnectSettings.MdxProtocolSupport[message.mdxProtocolSupport[j]] === undefined ? message.mdxProtocolSupport[j] : $root.google.cloud.sql.v1beta4.ConnectSettings.MdxProtocolSupport[message.mdxProtocolSupport[j]] : message.mdxProtocolSupport[j]; - } - if (message.nodeCount != null && message.hasOwnProperty("nodeCount")) { - object.nodeCount = message.nodeCount; - if (options.oneofs) - object._nodeCount = "nodeCount"; - } - if (message.nodes && message.nodes.length) { - object.nodes = []; - for (var j = 0; j < message.nodes.length; ++j) - object.nodes[j] = $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.toObject(message.nodes[j], options); - } - return object; - }; - - /** - * Converts this ConnectSettings to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @instance - * @returns {Object.} JSON object - */ - ConnectSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ConnectSettings - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ConnectSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ConnectSettings"; - }; - - /** - * CaMode enum. - * @name google.cloud.sql.v1beta4.ConnectSettings.CaMode - * @enum {number} - * @property {number} CA_MODE_UNSPECIFIED=0 CA_MODE_UNSPECIFIED value - * @property {number} GOOGLE_MANAGED_INTERNAL_CA=1 GOOGLE_MANAGED_INTERNAL_CA value - * @property {number} GOOGLE_MANAGED_CAS_CA=2 GOOGLE_MANAGED_CAS_CA value - * @property {number} CUSTOMER_MANAGED_CAS_CA=3 CUSTOMER_MANAGED_CAS_CA value - */ - ConnectSettings.CaMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CA_MODE_UNSPECIFIED"] = 0; - values[valuesById[1] = "GOOGLE_MANAGED_INTERNAL_CA"] = 1; - values[valuesById[2] = "GOOGLE_MANAGED_CAS_CA"] = 2; - values[valuesById[3] = "CUSTOMER_MANAGED_CAS_CA"] = 3; - return values; - })(); - - ConnectSettings.ConnectPoolNodeConfig = (function() { - - /** - * Properties of a ConnectPoolNodeConfig. - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @interface IConnectPoolNodeConfig - * @property {string|null} [name] ConnectPoolNodeConfig name - * @property {Array.|null} [ipAddresses] ConnectPoolNodeConfig ipAddresses - * @property {string|null} [dnsName] ConnectPoolNodeConfig dnsName - * @property {Array.|null} [dnsNames] ConnectPoolNodeConfig dnsNames - */ - - /** - * Constructs a new ConnectPoolNodeConfig. - * @memberof google.cloud.sql.v1beta4.ConnectSettings - * @classdesc Represents a ConnectPoolNodeConfig. - * @implements IConnectPoolNodeConfig - * @constructor - * @param {google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig=} [properties] Properties to set - */ - function ConnectPoolNodeConfig(properties) { - this.ipAddresses = []; - this.dnsNames = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ConnectPoolNodeConfig name. - * @member {string|null|undefined} name - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @instance - */ - ConnectPoolNodeConfig.prototype.name = null; - - /** - * ConnectPoolNodeConfig ipAddresses. - * @member {Array.} ipAddresses - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @instance - */ - ConnectPoolNodeConfig.prototype.ipAddresses = $util.emptyArray; - - /** - * ConnectPoolNodeConfig dnsName. - * @member {string|null|undefined} dnsName - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @instance - */ - ConnectPoolNodeConfig.prototype.dnsName = null; - - /** - * ConnectPoolNodeConfig dnsNames. - * @member {Array.} dnsNames - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @instance - */ - ConnectPoolNodeConfig.prototype.dnsNames = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ConnectPoolNodeConfig.prototype, "_name", { - get: $util.oneOfGetter($oneOfFields = ["name"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(ConnectPoolNodeConfig.prototype, "_dnsName", { - get: $util.oneOfGetter($oneOfFields = ["dnsName"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new ConnectPoolNodeConfig instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig instance - */ - ConnectPoolNodeConfig.create = function create(properties) { - return new ConnectPoolNodeConfig(properties); - }; - - /** - * Encodes the specified ConnectPoolNodeConfig message. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig} message ConnectPoolNodeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectPoolNodeConfig.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.ipAddresses != null && message.ipAddresses.length) - for (var i = 0; i < message.ipAddresses.length; ++i) - $root.google.cloud.sql.v1beta4.IpMapping.encode(message.ipAddresses[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.dnsName != null && Object.hasOwnProperty.call(message, "dnsName")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.dnsName); - if (message.dnsNames != null && message.dnsNames.length) - for (var i = 0; i < message.dnsNames.length; ++i) - $root.google.cloud.sql.v1beta4.DnsNameMapping.encode(message.dnsNames[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ConnectPoolNodeConfig message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {google.cloud.sql.v1beta4.ConnectSettings.IConnectPoolNodeConfig} message ConnectPoolNodeConfig message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ConnectPoolNodeConfig.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectPoolNodeConfig.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - if (!(message.ipAddresses && message.ipAddresses.length)) - message.ipAddresses = []; - message.ipAddresses.push($root.google.cloud.sql.v1beta4.IpMapping.decode(reader, reader.uint32())); - break; - } - case 3: { - message.dnsName = reader.string(); - break; - } - case 4: { - if (!(message.dnsNames && message.dnsNames.length)) - message.dnsNames = []; - message.dnsNames.push($root.google.cloud.sql.v1beta4.DnsNameMapping.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ConnectPoolNodeConfig message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ConnectPoolNodeConfig.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ConnectPoolNodeConfig message. - * @function verify - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ConnectPoolNodeConfig.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.name != null && message.hasOwnProperty("name")) { - properties._name = 1; - if (!$util.isString(message.name)) - return "name: string expected"; - } - if (message.ipAddresses != null && message.hasOwnProperty("ipAddresses")) { - if (!Array.isArray(message.ipAddresses)) - return "ipAddresses: array expected"; - for (var i = 0; i < message.ipAddresses.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.IpMapping.verify(message.ipAddresses[i]); - if (error) - return "ipAddresses." + error; - } - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - properties._dnsName = 1; - if (!$util.isString(message.dnsName)) - return "dnsName: string expected"; - } - if (message.dnsNames != null && message.hasOwnProperty("dnsNames")) { - if (!Array.isArray(message.dnsNames)) - return "dnsNames: array expected"; - for (var i = 0; i < message.dnsNames.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.DnsNameMapping.verify(message.dnsNames[i]); - if (error) - return "dnsNames." + error; - } - } - return null; - }; - - /** - * Creates a ConnectPoolNodeConfig message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig} ConnectPoolNodeConfig - */ - ConnectPoolNodeConfig.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig) - return object; - var message = new $root.google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig(); - if (object.name != null) - message.name = String(object.name); - if (object.ipAddresses) { - if (!Array.isArray(object.ipAddresses)) - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.ipAddresses: array expected"); - message.ipAddresses = []; - for (var i = 0; i < object.ipAddresses.length; ++i) { - if (typeof object.ipAddresses[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.ipAddresses: object expected"); - message.ipAddresses[i] = $root.google.cloud.sql.v1beta4.IpMapping.fromObject(object.ipAddresses[i]); - } - } - if (object.dnsName != null) - message.dnsName = String(object.dnsName); - if (object.dnsNames) { - if (!Array.isArray(object.dnsNames)) - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.dnsNames: array expected"); - message.dnsNames = []; - for (var i = 0; i < object.dnsNames.length; ++i) { - if (typeof object.dnsNames[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig.dnsNames: object expected"); - message.dnsNames[i] = $root.google.cloud.sql.v1beta4.DnsNameMapping.fromObject(object.dnsNames[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a ConnectPoolNodeConfig message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig} message ConnectPoolNodeConfig - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ConnectPoolNodeConfig.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.ipAddresses = []; - object.dnsNames = []; - } - if (message.name != null && message.hasOwnProperty("name")) { - object.name = message.name; - if (options.oneofs) - object._name = "name"; - } - if (message.ipAddresses && message.ipAddresses.length) { - object.ipAddresses = []; - for (var j = 0; j < message.ipAddresses.length; ++j) - object.ipAddresses[j] = $root.google.cloud.sql.v1beta4.IpMapping.toObject(message.ipAddresses[j], options); - } - if (message.dnsName != null && message.hasOwnProperty("dnsName")) { - object.dnsName = message.dnsName; - if (options.oneofs) - object._dnsName = "dnsName"; - } - if (message.dnsNames && message.dnsNames.length) { - object.dnsNames = []; - for (var j = 0; j < message.dnsNames.length; ++j) - object.dnsNames[j] = $root.google.cloud.sql.v1beta4.DnsNameMapping.toObject(message.dnsNames[j], options); - } - return object; - }; - - /** - * Converts this ConnectPoolNodeConfig to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @instance - * @returns {Object.} JSON object - */ - ConnectPoolNodeConfig.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ConnectPoolNodeConfig - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ConnectPoolNodeConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.ConnectSettings.ConnectPoolNodeConfig"; - }; - - return ConnectPoolNodeConfig; - })(); - - /** - * MdxProtocolSupport enum. - * @name google.cloud.sql.v1beta4.ConnectSettings.MdxProtocolSupport - * @enum {number} - * @property {number} MDX_PROTOCOL_SUPPORT_UNSPECIFIED=0 MDX_PROTOCOL_SUPPORT_UNSPECIFIED value - * @property {number} CLIENT_PROTOCOL_TYPE=1 CLIENT_PROTOCOL_TYPE value - */ - ConnectSettings.MdxProtocolSupport = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MDX_PROTOCOL_SUPPORT_UNSPECIFIED"] = 0; - values[valuesById[1] = "CLIENT_PROTOCOL_TYPE"] = 1; - return values; - })(); - - return ConnectSettings; - })(); - - v1beta4.GenerateEphemeralCertRequest = (function() { - - /** - * Properties of a GenerateEphemeralCertRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface IGenerateEphemeralCertRequest - * @property {string|null} [instance] GenerateEphemeralCertRequest instance - * @property {string|null} [project] GenerateEphemeralCertRequest project - * @property {string|null} [publicKey] GenerateEphemeralCertRequest publicKey - * @property {string|null} [accessToken] GenerateEphemeralCertRequest accessToken - * @property {google.protobuf.ITimestamp|null} [readTime] GenerateEphemeralCertRequest readTime - * @property {google.protobuf.IDuration|null} [validDuration] GenerateEphemeralCertRequest validDuration - */ - - /** - * Constructs a new GenerateEphemeralCertRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a GenerateEphemeralCertRequest. - * @implements IGenerateEphemeralCertRequest - * @constructor - * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest=} [properties] Properties to set - */ - function GenerateEphemeralCertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenerateEphemeralCertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.instance = ""; - - /** - * GenerateEphemeralCertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.project = ""; - - /** - * GenerateEphemeralCertRequest publicKey. - * @member {string} publicKey - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.publicKey = ""; - - /** - * GenerateEphemeralCertRequest accessToken. - * @member {string} accessToken - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.accessToken = ""; - - /** - * GenerateEphemeralCertRequest readTime. - * @member {google.protobuf.ITimestamp|null|undefined} readTime - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.readTime = null; - - /** - * GenerateEphemeralCertRequest validDuration. - * @member {google.protobuf.IDuration|null|undefined} validDuration - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @instance - */ - GenerateEphemeralCertRequest.prototype.validDuration = null; - - /** - * Creates a new GenerateEphemeralCertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest instance - */ - GenerateEphemeralCertRequest.create = function create(properties) { - return new GenerateEphemeralCertRequest(properties); - }; - - /** - * Encodes the specified GenerateEphemeralCertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest} message GenerateEphemeralCertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenerateEphemeralCertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.publicKey != null && Object.hasOwnProperty.call(message, "publicKey")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.publicKey); - if (message.accessToken != null && Object.hasOwnProperty.call(message, "accessToken")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.accessToken); - if (message.readTime != null && Object.hasOwnProperty.call(message, "readTime")) - $root.google.protobuf.Timestamp.encode(message.readTime, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.validDuration != null && Object.hasOwnProperty.call(message, "validDuration")) - $root.google.protobuf.Duration.encode(message.validDuration, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenerateEphemeralCertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest} message GenerateEphemeralCertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenerateEphemeralCertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenerateEphemeralCertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 3: { - message.publicKey = reader.string(); - break; - } - case 4: { - message.accessToken = reader.string(); - break; - } - case 7: { - message.readTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 12: { - message.validDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenerateEphemeralCertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenerateEphemeralCertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenerateEphemeralCertRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenerateEphemeralCertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.publicKey != null && message.hasOwnProperty("publicKey")) - if (!$util.isString(message.publicKey)) - return "publicKey: string expected"; - if (message.accessToken != null && message.hasOwnProperty("accessToken")) - if (!$util.isString(message.accessToken)) - return "accessToken: string expected"; - if (message.readTime != null && message.hasOwnProperty("readTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.readTime); - if (error) - return "readTime." + error; - } - if (message.validDuration != null && message.hasOwnProperty("validDuration")) { - var error = $root.google.protobuf.Duration.verify(message.validDuration); - if (error) - return "validDuration." + error; - } - return null; - }; - - /** - * Creates a GenerateEphemeralCertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertRequest} GenerateEphemeralCertRequest - */ - GenerateEphemeralCertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.publicKey != null) - message.publicKey = String(object.publicKey); - if (object.accessToken != null) - message.accessToken = String(object.accessToken); - if (object.readTime != null) { - if (typeof object.readTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.readTime: object expected"); - message.readTime = $root.google.protobuf.Timestamp.fromObject(object.readTime); - } - if (object.validDuration != null) { - if (typeof object.validDuration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.GenerateEphemeralCertRequest.validDuration: object expected"); - message.validDuration = $root.google.protobuf.Duration.fromObject(object.validDuration); - } - return message; - }; - - /** - * Creates a plain object from a GenerateEphemeralCertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @static - * @param {google.cloud.sql.v1beta4.GenerateEphemeralCertRequest} message GenerateEphemeralCertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenerateEphemeralCertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.publicKey = ""; - object.accessToken = ""; - object.readTime = null; - object.validDuration = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.publicKey != null && message.hasOwnProperty("publicKey")) - object.publicKey = message.publicKey; - if (message.accessToken != null && message.hasOwnProperty("accessToken")) - object.accessToken = message.accessToken; - if (message.readTime != null && message.hasOwnProperty("readTime")) - object.readTime = $root.google.protobuf.Timestamp.toObject(message.readTime, options); - if (message.validDuration != null && message.hasOwnProperty("validDuration")) - object.validDuration = $root.google.protobuf.Duration.toObject(message.validDuration, options); - return object; - }; - - /** - * Converts this GenerateEphemeralCertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @instance - * @returns {Object.} JSON object - */ - GenerateEphemeralCertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GenerateEphemeralCertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GenerateEphemeralCertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.GenerateEphemeralCertRequest"; - }; - - return GenerateEphemeralCertRequest; - })(); - - v1beta4.GenerateEphemeralCertResponse = (function() { - - /** - * Properties of a GenerateEphemeralCertResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IGenerateEphemeralCertResponse - * @property {google.cloud.sql.v1beta4.ISslCert|null} [ephemeralCert] GenerateEphemeralCertResponse ephemeralCert - */ - - /** - * Constructs a new GenerateEphemeralCertResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a GenerateEphemeralCertResponse. - * @implements IGenerateEphemeralCertResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse=} [properties] Properties to set - */ - function GenerateEphemeralCertResponse(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GenerateEphemeralCertResponse ephemeralCert. - * @member {google.cloud.sql.v1beta4.ISslCert|null|undefined} ephemeralCert - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @instance - */ - GenerateEphemeralCertResponse.prototype.ephemeralCert = null; - - /** - * Creates a new GenerateEphemeralCertResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @static - * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse instance - */ - GenerateEphemeralCertResponse.create = function create(properties) { - return new GenerateEphemeralCertResponse(properties); - }; - - /** - * Encodes the specified GenerateEphemeralCertResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @static - * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse} message GenerateEphemeralCertResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenerateEphemeralCertResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ephemeralCert != null && Object.hasOwnProperty.call(message, "ephemeralCert")) - $root.google.cloud.sql.v1beta4.SslCert.encode(message.ephemeralCert, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GenerateEphemeralCertResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.GenerateEphemeralCertResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @static - * @param {google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse} message GenerateEphemeralCertResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GenerateEphemeralCertResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenerateEphemeralCertResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.ephemeralCert = $root.google.cloud.sql.v1beta4.SslCert.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GenerateEphemeralCertResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GenerateEphemeralCertResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GenerateEphemeralCertResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GenerateEphemeralCertResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ephemeralCert != null && message.hasOwnProperty("ephemeralCert")) { - var error = $root.google.cloud.sql.v1beta4.SslCert.verify(message.ephemeralCert); - if (error) - return "ephemeralCert." + error; - } - return null; - }; - - /** - * Creates a GenerateEphemeralCertResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} GenerateEphemeralCertResponse - */ - GenerateEphemeralCertResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse(); - if (object.ephemeralCert != null) { - if (typeof object.ephemeralCert !== "object") - throw TypeError(".google.cloud.sql.v1beta4.GenerateEphemeralCertResponse.ephemeralCert: object expected"); - message.ephemeralCert = $root.google.cloud.sql.v1beta4.SslCert.fromObject(object.ephemeralCert); - } - return message; - }; - - /** - * Creates a plain object from a GenerateEphemeralCertResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @static - * @param {google.cloud.sql.v1beta4.GenerateEphemeralCertResponse} message GenerateEphemeralCertResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GenerateEphemeralCertResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.ephemeralCert = null; - if (message.ephemeralCert != null && message.hasOwnProperty("ephemeralCert")) - object.ephemeralCert = $root.google.cloud.sql.v1beta4.SslCert.toObject(message.ephemeralCert, options); - return object; - }; - - /** - * Converts this GenerateEphemeralCertResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @instance - * @returns {Object.} JSON object - */ - GenerateEphemeralCertResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GenerateEphemeralCertResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.GenerateEphemeralCertResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GenerateEphemeralCertResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.GenerateEphemeralCertResponse"; - }; - - return GenerateEphemeralCertResponse; - })(); - - v1beta4.SqlIamPoliciesService = (function() { - - /** - * Constructs a new SqlIamPoliciesService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlIamPoliciesService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlIamPoliciesService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlIamPoliciesService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlIamPoliciesService; - - /** - * Creates new SqlIamPoliciesService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlIamPoliciesService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlIamPoliciesService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlIamPoliciesService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - return SqlIamPoliciesService; - })(); - - v1beta4.SqlTiersService = (function() { - - /** - * Constructs a new SqlTiersService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlTiersService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlTiersService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlTiersService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlTiersService; - - /** - * Creates new SqlTiersService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlTiersService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlTiersService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlTiersService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlTiersService|list}. - * @memberof google.cloud.sql.v1beta4.SqlTiersService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.TiersListResponse} [response] TiersListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlTiersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest} request SqlTiersListRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlTiersService.ListCallback} callback Node-style callback called with the error, if any, and TiersListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlTiersService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlTiersListRequest, $root.google.cloud.sql.v1beta4.TiersListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlTiersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest} request SqlTiersListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlTiersService; - })(); - - v1beta4.SqlTiersListRequest = (function() { - - /** - * Properties of a SqlTiersListRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlTiersListRequest - * @property {string|null} [project] SqlTiersListRequest project - */ - - /** - * Constructs a new SqlTiersListRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlTiersListRequest. - * @implements ISqlTiersListRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest=} [properties] Properties to set - */ - function SqlTiersListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlTiersListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @instance - */ - SqlTiersListRequest.prototype.project = ""; - - /** - * Creates a new SqlTiersListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlTiersListRequest} SqlTiersListRequest instance - */ - SqlTiersListRequest.create = function create(properties) { - return new SqlTiersListRequest(properties); - }; - - /** - * Encodes the specified SqlTiersListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlTiersListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest} message SqlTiersListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTiersListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlTiersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlTiersListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlTiersListRequest} message SqlTiersListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlTiersListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlTiersListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlTiersListRequest} SqlTiersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTiersListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlTiersListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlTiersListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlTiersListRequest} SqlTiersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlTiersListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlTiersListRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlTiersListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlTiersListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlTiersListRequest} SqlTiersListRequest - */ - SqlTiersListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlTiersListRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlTiersListRequest(); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlTiersListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlTiersListRequest} message SqlTiersListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlTiersListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.project = ""; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlTiersListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlTiersListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlTiersListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlTiersListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlTiersListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlTiersListRequest"; - }; - - return SqlTiersListRequest; - })(); - - v1beta4.TiersListResponse = (function() { - - /** - * Properties of a TiersListResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface ITiersListResponse - * @property {string|null} [kind] TiersListResponse kind - * @property {Array.|null} [items] TiersListResponse items - */ - - /** - * Constructs a new TiersListResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a TiersListResponse. - * @implements ITiersListResponse - * @constructor - * @param {google.cloud.sql.v1beta4.ITiersListResponse=} [properties] Properties to set - */ - function TiersListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TiersListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @instance - */ - TiersListResponse.prototype.kind = ""; - - /** - * TiersListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @instance - */ - TiersListResponse.prototype.items = $util.emptyArray; - - /** - * Creates a new TiersListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @static - * @param {google.cloud.sql.v1beta4.ITiersListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.TiersListResponse} TiersListResponse instance - */ - TiersListResponse.create = function create(properties) { - return new TiersListResponse(properties); - }; - - /** - * Encodes the specified TiersListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.TiersListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @static - * @param {google.cloud.sql.v1beta4.ITiersListResponse} message TiersListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TiersListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1beta4.Tier.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified TiersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.TiersListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @static - * @param {google.cloud.sql.v1beta4.ITiersListResponse} message TiersListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TiersListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TiersListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.TiersListResponse} TiersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TiersListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.TiersListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1beta4.Tier.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TiersListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.TiersListResponse} TiersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TiersListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TiersListResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TiersListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.Tier.verify(message.items[i]); - if (error) - return "items." + error; - } - } - return null; - }; - - /** - * Creates a TiersListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.TiersListResponse} TiersListResponse - */ - TiersListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.TiersListResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.TiersListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1beta4.TiersListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.TiersListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1beta4.Tier.fromObject(object.items[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a TiersListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @static - * @param {google.cloud.sql.v1beta4.TiersListResponse} message TiersListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TiersListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) - object.kind = ""; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1beta4.Tier.toObject(message.items[j], options); - } - return object; - }; - - /** - * Converts this TiersListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @instance - * @returns {Object.} JSON object - */ - TiersListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TiersListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.TiersListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TiersListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.TiersListResponse"; - }; - - return TiersListResponse; - })(); - - v1beta4.Tier = (function() { - - /** - * Properties of a Tier. - * @memberof google.cloud.sql.v1beta4 - * @interface ITier - * @property {string|null} [tier] Tier tier - * @property {number|Long|null} [RAM] Tier RAM - * @property {string|null} [kind] Tier kind - * @property {number|Long|null} [Disk_Quota] Tier Disk_Quota - * @property {Array.|null} [region] Tier region - */ - - /** - * Constructs a new Tier. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a Tier. - * @implements ITier - * @constructor - * @param {google.cloud.sql.v1beta4.ITier=} [properties] Properties to set - */ - function Tier(properties) { - this.region = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Tier tier. - * @member {string} tier - * @memberof google.cloud.sql.v1beta4.Tier - * @instance - */ - Tier.prototype.tier = ""; - - /** - * Tier RAM. - * @member {number|Long} RAM - * @memberof google.cloud.sql.v1beta4.Tier - * @instance - */ - Tier.prototype.RAM = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Tier kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.Tier - * @instance - */ - Tier.prototype.kind = ""; - - /** - * Tier Disk_Quota. - * @member {number|Long} Disk_Quota - * @memberof google.cloud.sql.v1beta4.Tier - * @instance - */ - Tier.prototype.Disk_Quota = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Tier region. - * @member {Array.} region - * @memberof google.cloud.sql.v1beta4.Tier - * @instance - */ - Tier.prototype.region = $util.emptyArray; - - /** - * Creates a new Tier instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.Tier - * @static - * @param {google.cloud.sql.v1beta4.ITier=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.Tier} Tier instance - */ - Tier.create = function create(properties) { - return new Tier(properties); - }; - - /** - * Encodes the specified Tier message. Does not implicitly {@link google.cloud.sql.v1beta4.Tier.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.Tier - * @static - * @param {google.cloud.sql.v1beta4.ITier} message Tier message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Tier.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.tier != null && Object.hasOwnProperty.call(message, "tier")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.tier); - if (message.RAM != null && Object.hasOwnProperty.call(message, "RAM")) - writer.uint32(/* id 2, wireType 0 =*/16).int64(message.RAM); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.kind); - if (message.Disk_Quota != null && Object.hasOwnProperty.call(message, "Disk_Quota")) - writer.uint32(/* id 4, wireType 0 =*/32).int64(message.Disk_Quota); - if (message.region != null && message.region.length) - for (var i = 0; i < message.region.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.region[i]); - return writer; - }; - - /** - * Encodes the specified Tier message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.Tier.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.Tier - * @static - * @param {google.cloud.sql.v1beta4.ITier} message Tier message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Tier.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Tier message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.Tier - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.Tier} Tier - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Tier.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.Tier(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.tier = reader.string(); - break; - } - case 2: { - message.RAM = reader.int64(); - break; - } - case 3: { - message.kind = reader.string(); - break; - } - case 4: { - message.Disk_Quota = reader.int64(); - break; - } - case 5: { - if (!(message.region && message.region.length)) - message.region = []; - message.region.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Tier message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.Tier - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.Tier} Tier - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Tier.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Tier message. - * @function verify - * @memberof google.cloud.sql.v1beta4.Tier - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Tier.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.tier != null && message.hasOwnProperty("tier")) - if (!$util.isString(message.tier)) - return "tier: string expected"; - if (message.RAM != null && message.hasOwnProperty("RAM")) - if (!$util.isInteger(message.RAM) && !(message.RAM && $util.isInteger(message.RAM.low) && $util.isInteger(message.RAM.high))) - return "RAM: integer|Long expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.Disk_Quota != null && message.hasOwnProperty("Disk_Quota")) - if (!$util.isInteger(message.Disk_Quota) && !(message.Disk_Quota && $util.isInteger(message.Disk_Quota.low) && $util.isInteger(message.Disk_Quota.high))) - return "Disk_Quota: integer|Long expected"; - if (message.region != null && message.hasOwnProperty("region")) { - if (!Array.isArray(message.region)) - return "region: array expected"; - for (var i = 0; i < message.region.length; ++i) - if (!$util.isString(message.region[i])) - return "region: string[] expected"; - } - return null; - }; - - /** - * Creates a Tier message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.Tier - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.Tier} Tier - */ - Tier.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.Tier) - return object; - var message = new $root.google.cloud.sql.v1beta4.Tier(); - if (object.tier != null) - message.tier = String(object.tier); - if (object.RAM != null) - if ($util.Long) - (message.RAM = $util.Long.fromValue(object.RAM)).unsigned = false; - else if (typeof object.RAM === "string") - message.RAM = parseInt(object.RAM, 10); - else if (typeof object.RAM === "number") - message.RAM = object.RAM; - else if (typeof object.RAM === "object") - message.RAM = new $util.LongBits(object.RAM.low >>> 0, object.RAM.high >>> 0).toNumber(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.Disk_Quota != null) - if ($util.Long) - (message.Disk_Quota = $util.Long.fromValue(object.Disk_Quota)).unsigned = false; - else if (typeof object.Disk_Quota === "string") - message.Disk_Quota = parseInt(object.Disk_Quota, 10); - else if (typeof object.Disk_Quota === "number") - message.Disk_Quota = object.Disk_Quota; - else if (typeof object.Disk_Quota === "object") - message.Disk_Quota = new $util.LongBits(object.Disk_Quota.low >>> 0, object.Disk_Quota.high >>> 0).toNumber(); - if (object.region) { - if (!Array.isArray(object.region)) - throw TypeError(".google.cloud.sql.v1beta4.Tier.region: array expected"); - message.region = []; - for (var i = 0; i < object.region.length; ++i) - message.region[i] = String(object.region[i]); - } - return message; - }; - - /** - * Creates a plain object from a Tier message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.Tier - * @static - * @param {google.cloud.sql.v1beta4.Tier} message Tier - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Tier.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.region = []; - if (options.defaults) { - object.tier = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.RAM = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.RAM = options.longs === String ? "0" : 0; - object.kind = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.Disk_Quota = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.Disk_Quota = options.longs === String ? "0" : 0; - } - if (message.tier != null && message.hasOwnProperty("tier")) - object.tier = message.tier; - if (message.RAM != null && message.hasOwnProperty("RAM")) - if (typeof message.RAM === "number") - object.RAM = options.longs === String ? String(message.RAM) : message.RAM; - else - object.RAM = options.longs === String ? $util.Long.prototype.toString.call(message.RAM) : options.longs === Number ? new $util.LongBits(message.RAM.low >>> 0, message.RAM.high >>> 0).toNumber() : message.RAM; - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.Disk_Quota != null && message.hasOwnProperty("Disk_Quota")) - if (typeof message.Disk_Quota === "number") - object.Disk_Quota = options.longs === String ? String(message.Disk_Quota) : message.Disk_Quota; - else - object.Disk_Quota = options.longs === String ? $util.Long.prototype.toString.call(message.Disk_Quota) : options.longs === Number ? new $util.LongBits(message.Disk_Quota.low >>> 0, message.Disk_Quota.high >>> 0).toNumber() : message.Disk_Quota; - if (message.region && message.region.length) { - object.region = []; - for (var j = 0; j < message.region.length; ++j) - object.region[j] = message.region[j]; - } - return object; - }; - - /** - * Converts this Tier to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.Tier - * @instance - * @returns {Object.} JSON object - */ - Tier.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Tier - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.Tier - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Tier.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.Tier"; - }; - - return Tier; - })(); - - v1beta4.SqlUsersService = (function() { - - /** - * Constructs a new SqlUsersService service. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlUsersService - * @extends $protobuf.rpc.Service - * @constructor - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - */ - function SqlUsersService(rpcImpl, requestDelimited, responseDelimited) { - $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); - } - - (SqlUsersService.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = SqlUsersService; - - /** - * Creates new SqlUsersService service using the specified rpc implementation. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @static - * @param {$protobuf.RPCImpl} rpcImpl RPC implementation - * @param {boolean} [requestDelimited=false] Whether requests are length-delimited - * @param {boolean} [responseDelimited=false] Whether responses are length-delimited - * @returns {SqlUsersService} RPC service. Useful where requests and/or responses are streamed. - */ - SqlUsersService.create = function create(rpcImpl, requestDelimited, responseDelimited) { - return new this(rpcImpl, requestDelimited, responseDelimited); - }; - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|delete_}. - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @typedef DeleteCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest} request SqlUsersDeleteRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlUsersService.DeleteCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlUsersService.prototype["delete"] = function delete_(request, callback) { - return this.rpcCall(delete_, $root.google.cloud.sql.v1beta4.SqlUsersDeleteRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Delete" }); - - /** - * Calls Delete. - * @function delete - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest} request SqlUsersDeleteRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|get}. - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @typedef GetCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.User} [response] User - */ - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest} request SqlUsersGetRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlUsersService.GetCallback} callback Node-style callback called with the error, if any, and User - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlUsersService.prototype.get = function get(request, callback) { - return this.rpcCall(get, $root.google.cloud.sql.v1beta4.SqlUsersGetRequest, $root.google.cloud.sql.v1beta4.User, request, callback); - }, "name", { value: "Get" }); - - /** - * Calls Get. - * @function get - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest} request SqlUsersGetRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|insert}. - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @typedef InsertCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest} request SqlUsersInsertRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlUsersService.InsertCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlUsersService.prototype.insert = function insert(request, callback) { - return this.rpcCall(insert, $root.google.cloud.sql.v1beta4.SqlUsersInsertRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Insert" }); - - /** - * Calls Insert. - * @function insert - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest} request SqlUsersInsertRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|list}. - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @typedef ListCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.UsersListResponse} [response] UsersListResponse - */ - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest} request SqlUsersListRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlUsersService.ListCallback} callback Node-style callback called with the error, if any, and UsersListResponse - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlUsersService.prototype.list = function list(request, callback) { - return this.rpcCall(list, $root.google.cloud.sql.v1beta4.SqlUsersListRequest, $root.google.cloud.sql.v1beta4.UsersListResponse, request, callback); - }, "name", { value: "List" }); - - /** - * Calls List. - * @function list - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest} request SqlUsersListRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - /** - * Callback as used by {@link google.cloud.sql.v1beta4.SqlUsersService|update}. - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @typedef UpdateCallback - * @type {function} - * @param {Error|null} error Error, if any - * @param {google.cloud.sql.v1beta4.Operation} [response] Operation - */ - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest} request SqlUsersUpdateRequest message or plain object - * @param {google.cloud.sql.v1beta4.SqlUsersService.UpdateCallback} callback Node-style callback called with the error, if any, and Operation - * @returns {undefined} - * @variation 1 - */ - Object.defineProperty(SqlUsersService.prototype.update = function update(request, callback) { - return this.rpcCall(update, $root.google.cloud.sql.v1beta4.SqlUsersUpdateRequest, $root.google.cloud.sql.v1beta4.Operation, request, callback); - }, "name", { value: "Update" }); - - /** - * Calls Update. - * @function update - * @memberof google.cloud.sql.v1beta4.SqlUsersService - * @instance - * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest} request SqlUsersUpdateRequest message or plain object - * @returns {Promise} Promise - * @variation 2 - */ - - return SqlUsersService; - })(); - - v1beta4.SqlUsersDeleteRequest = (function() { - - /** - * Properties of a SqlUsersDeleteRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlUsersDeleteRequest - * @property {string|null} [host] SqlUsersDeleteRequest host - * @property {string|null} [instance] SqlUsersDeleteRequest instance - * @property {string|null} [name] SqlUsersDeleteRequest name - * @property {string|null} [project] SqlUsersDeleteRequest project - */ - - /** - * Constructs a new SqlUsersDeleteRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlUsersDeleteRequest. - * @implements ISqlUsersDeleteRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest=} [properties] Properties to set - */ - function SqlUsersDeleteRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlUsersDeleteRequest host. - * @member {string} host - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @instance - */ - SqlUsersDeleteRequest.prototype.host = ""; - - /** - * SqlUsersDeleteRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @instance - */ - SqlUsersDeleteRequest.prototype.instance = ""; - - /** - * SqlUsersDeleteRequest name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @instance - */ - SqlUsersDeleteRequest.prototype.name = ""; - - /** - * SqlUsersDeleteRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @instance - */ - SqlUsersDeleteRequest.prototype.project = ""; - - /** - * Creates a new SqlUsersDeleteRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlUsersDeleteRequest} SqlUsersDeleteRequest instance - */ - SqlUsersDeleteRequest.create = function create(properties) { - return new SqlUsersDeleteRequest(properties); - }; - - /** - * Encodes the specified SqlUsersDeleteRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersDeleteRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest} message SqlUsersDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersDeleteRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.host != null && Object.hasOwnProperty.call(message, "host")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.host); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlUsersDeleteRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersDeleteRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersDeleteRequest} message SqlUsersDeleteRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersDeleteRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlUsersDeleteRequest} SqlUsersDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersDeleteRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.host = reader.string(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.name = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlUsersDeleteRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlUsersDeleteRequest} SqlUsersDeleteRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersDeleteRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlUsersDeleteRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlUsersDeleteRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.host != null && message.hasOwnProperty("host")) - if (!$util.isString(message.host)) - return "host: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlUsersDeleteRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlUsersDeleteRequest} SqlUsersDeleteRequest - */ - SqlUsersDeleteRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlUsersDeleteRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(); - if (object.host != null) - message.host = String(object.host); - if (object.instance != null) - message.instance = String(object.instance); - if (object.name != null) - message.name = String(object.name); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlUsersDeleteRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlUsersDeleteRequest} message SqlUsersDeleteRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlUsersDeleteRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.host = ""; - object.instance = ""; - object.name = ""; - object.project = ""; - } - if (message.host != null && message.hasOwnProperty("host")) - object.host = message.host; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlUsersDeleteRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @instance - * @returns {Object.} JSON object - */ - SqlUsersDeleteRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlUsersDeleteRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlUsersDeleteRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlUsersDeleteRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlUsersDeleteRequest"; - }; - - return SqlUsersDeleteRequest; - })(); - - v1beta4.SqlUsersGetRequest = (function() { - - /** - * Properties of a SqlUsersGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlUsersGetRequest - * @property {string|null} [instance] SqlUsersGetRequest instance - * @property {string|null} [name] SqlUsersGetRequest name - * @property {string|null} [project] SqlUsersGetRequest project - * @property {string|null} [host] SqlUsersGetRequest host - */ - - /** - * Constructs a new SqlUsersGetRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlUsersGetRequest. - * @implements ISqlUsersGetRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest=} [properties] Properties to set - */ - function SqlUsersGetRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlUsersGetRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @instance - */ - SqlUsersGetRequest.prototype.instance = ""; - - /** - * SqlUsersGetRequest name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @instance - */ - SqlUsersGetRequest.prototype.name = ""; - - /** - * SqlUsersGetRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @instance - */ - SqlUsersGetRequest.prototype.project = ""; - - /** - * SqlUsersGetRequest host. - * @member {string} host - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @instance - */ - SqlUsersGetRequest.prototype.host = ""; - - /** - * Creates a new SqlUsersGetRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlUsersGetRequest} SqlUsersGetRequest instance - */ - SqlUsersGetRequest.create = function create(properties) { - return new SqlUsersGetRequest(properties); - }; - - /** - * Encodes the specified SqlUsersGetRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersGetRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest} message SqlUsersGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersGetRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.name); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.project); - if (message.host != null && Object.hasOwnProperty.call(message, "host")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.host); - return writer; - }; - - /** - * Encodes the specified SqlUsersGetRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersGetRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersGetRequest} message SqlUsersGetRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersGetRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlUsersGetRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlUsersGetRequest} SqlUsersGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersGetRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlUsersGetRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.name = reader.string(); - break; - } - case 3: { - message.project = reader.string(); - break; - } - case 4: { - message.host = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlUsersGetRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlUsersGetRequest} SqlUsersGetRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersGetRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlUsersGetRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlUsersGetRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.host != null && message.hasOwnProperty("host")) - if (!$util.isString(message.host)) - return "host: string expected"; - return null; - }; - - /** - * Creates a SqlUsersGetRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlUsersGetRequest} SqlUsersGetRequest - */ - SqlUsersGetRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlUsersGetRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlUsersGetRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.name != null) - message.name = String(object.name); - if (object.project != null) - message.project = String(object.project); - if (object.host != null) - message.host = String(object.host); - return message; - }; - - /** - * Creates a plain object from a SqlUsersGetRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlUsersGetRequest} message SqlUsersGetRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlUsersGetRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.name = ""; - object.project = ""; - object.host = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.host != null && message.hasOwnProperty("host")) - object.host = message.host; - return object; - }; - - /** - * Converts this SqlUsersGetRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @instance - * @returns {Object.} JSON object - */ - SqlUsersGetRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlUsersGetRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlUsersGetRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlUsersGetRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlUsersGetRequest"; - }; - - return SqlUsersGetRequest; - })(); - - v1beta4.SqlUsersInsertRequest = (function() { - - /** - * Properties of a SqlUsersInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlUsersInsertRequest - * @property {string|null} [instance] SqlUsersInsertRequest instance - * @property {string|null} [project] SqlUsersInsertRequest project - * @property {google.cloud.sql.v1beta4.IUser|null} [body] SqlUsersInsertRequest body - */ - - /** - * Constructs a new SqlUsersInsertRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlUsersInsertRequest. - * @implements ISqlUsersInsertRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest=} [properties] Properties to set - */ - function SqlUsersInsertRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlUsersInsertRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @instance - */ - SqlUsersInsertRequest.prototype.instance = ""; - - /** - * SqlUsersInsertRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @instance - */ - SqlUsersInsertRequest.prototype.project = ""; - - /** - * SqlUsersInsertRequest body. - * @member {google.cloud.sql.v1beta4.IUser|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @instance - */ - SqlUsersInsertRequest.prototype.body = null; - - /** - * Creates a new SqlUsersInsertRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlUsersInsertRequest} SqlUsersInsertRequest instance - */ - SqlUsersInsertRequest.create = function create(properties) { - return new SqlUsersInsertRequest(properties); - }; - - /** - * Encodes the specified SqlUsersInsertRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersInsertRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest} message SqlUsersInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersInsertRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.User.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlUsersInsertRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersInsertRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersInsertRequest} message SqlUsersInsertRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersInsertRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlUsersInsertRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlUsersInsertRequest} SqlUsersInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersInsertRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlUsersInsertRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.User.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlUsersInsertRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlUsersInsertRequest} SqlUsersInsertRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersInsertRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlUsersInsertRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlUsersInsertRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.User.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlUsersInsertRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlUsersInsertRequest} SqlUsersInsertRequest - */ - SqlUsersInsertRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlUsersInsertRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlUsersInsertRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlUsersInsertRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.User.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlUsersInsertRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlUsersInsertRequest} message SqlUsersInsertRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlUsersInsertRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - object.body = null; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.User.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlUsersInsertRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @instance - * @returns {Object.} JSON object - */ - SqlUsersInsertRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlUsersInsertRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlUsersInsertRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlUsersInsertRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlUsersInsertRequest"; - }; - - return SqlUsersInsertRequest; - })(); - - v1beta4.SqlUsersListRequest = (function() { - - /** - * Properties of a SqlUsersListRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlUsersListRequest - * @property {string|null} [instance] SqlUsersListRequest instance - * @property {string|null} [project] SqlUsersListRequest project - */ - - /** - * Constructs a new SqlUsersListRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlUsersListRequest. - * @implements ISqlUsersListRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest=} [properties] Properties to set - */ - function SqlUsersListRequest(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlUsersListRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @instance - */ - SqlUsersListRequest.prototype.instance = ""; - - /** - * SqlUsersListRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @instance - */ - SqlUsersListRequest.prototype.project = ""; - - /** - * Creates a new SqlUsersListRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlUsersListRequest} SqlUsersListRequest instance - */ - SqlUsersListRequest.create = function create(properties) { - return new SqlUsersListRequest(properties); - }; - - /** - * Encodes the specified SqlUsersListRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersListRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest} message SqlUsersListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersListRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.project); - return writer; - }; - - /** - * Encodes the specified SqlUsersListRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersListRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersListRequest} message SqlUsersListRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersListRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlUsersListRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlUsersListRequest} SqlUsersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersListRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlUsersListRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.instance = reader.string(); - break; - } - case 2: { - message.project = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlUsersListRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlUsersListRequest} SqlUsersListRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersListRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlUsersListRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlUsersListRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - return null; - }; - - /** - * Creates a SqlUsersListRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlUsersListRequest} SqlUsersListRequest - */ - SqlUsersListRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlUsersListRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlUsersListRequest(); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - return message; - }; - - /** - * Creates a plain object from a SqlUsersListRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlUsersListRequest} message SqlUsersListRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlUsersListRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.instance = ""; - object.project = ""; - } - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - return object; - }; - - /** - * Converts this SqlUsersListRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @instance - * @returns {Object.} JSON object - */ - SqlUsersListRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlUsersListRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlUsersListRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlUsersListRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlUsersListRequest"; - }; - - return SqlUsersListRequest; - })(); - - v1beta4.SqlUsersUpdateRequest = (function() { - - /** - * Properties of a SqlUsersUpdateRequest. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlUsersUpdateRequest - * @property {string|null} [host] SqlUsersUpdateRequest host - * @property {string|null} [instance] SqlUsersUpdateRequest instance - * @property {string|null} [name] SqlUsersUpdateRequest name - * @property {string|null} [project] SqlUsersUpdateRequest project - * @property {Array.|null} [databaseRoles] SqlUsersUpdateRequest databaseRoles - * @property {boolean|null} [revokeExistingRoles] SqlUsersUpdateRequest revokeExistingRoles - * @property {google.cloud.sql.v1beta4.IUser|null} [body] SqlUsersUpdateRequest body - */ - - /** - * Constructs a new SqlUsersUpdateRequest. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlUsersUpdateRequest. - * @implements ISqlUsersUpdateRequest - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest=} [properties] Properties to set - */ - function SqlUsersUpdateRequest(properties) { - this.databaseRoles = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlUsersUpdateRequest host. - * @member {string} host - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.host = ""; - - /** - * SqlUsersUpdateRequest instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.instance = ""; - - /** - * SqlUsersUpdateRequest name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.name = ""; - - /** - * SqlUsersUpdateRequest project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.project = ""; - - /** - * SqlUsersUpdateRequest databaseRoles. - * @member {Array.} databaseRoles - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.databaseRoles = $util.emptyArray; - - /** - * SqlUsersUpdateRequest revokeExistingRoles. - * @member {boolean|null|undefined} revokeExistingRoles - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.revokeExistingRoles = null; - - /** - * SqlUsersUpdateRequest body. - * @member {google.cloud.sql.v1beta4.IUser|null|undefined} body - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @instance - */ - SqlUsersUpdateRequest.prototype.body = null; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - // Virtual OneOf for proto3 optional field - Object.defineProperty(SqlUsersUpdateRequest.prototype, "_revokeExistingRoles", { - get: $util.oneOfGetter($oneOfFields = ["revokeExistingRoles"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new SqlUsersUpdateRequest instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlUsersUpdateRequest} SqlUsersUpdateRequest instance - */ - SqlUsersUpdateRequest.create = function create(properties) { - return new SqlUsersUpdateRequest(properties); - }; - - /** - * Encodes the specified SqlUsersUpdateRequest message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersUpdateRequest.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest} message SqlUsersUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersUpdateRequest.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.host != null && Object.hasOwnProperty.call(message, "host")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.host); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.instance); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.name); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.project); - if (message.databaseRoles != null && message.databaseRoles.length) - for (var i = 0; i < message.databaseRoles.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.databaseRoles[i]); - if (message.revokeExistingRoles != null && Object.hasOwnProperty.call(message, "revokeExistingRoles")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.revokeExistingRoles); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - $root.google.cloud.sql.v1beta4.User.encode(message.body, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SqlUsersUpdateRequest message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlUsersUpdateRequest.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.ISqlUsersUpdateRequest} message SqlUsersUpdateRequest message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlUsersUpdateRequest.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlUsersUpdateRequest} SqlUsersUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersUpdateRequest.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.host = reader.string(); - break; - } - case 2: { - message.instance = reader.string(); - break; - } - case 3: { - message.name = reader.string(); - break; - } - case 4: { - message.project = reader.string(); - break; - } - case 5: { - if (!(message.databaseRoles && message.databaseRoles.length)) - message.databaseRoles = []; - message.databaseRoles.push(reader.string()); - break; - } - case 6: { - message.revokeExistingRoles = reader.bool(); - break; - } - case 100: { - message.body = $root.google.cloud.sql.v1beta4.User.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlUsersUpdateRequest message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlUsersUpdateRequest} SqlUsersUpdateRequest - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlUsersUpdateRequest.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlUsersUpdateRequest message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlUsersUpdateRequest.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.host != null && message.hasOwnProperty("host")) - if (!$util.isString(message.host)) - return "host: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.databaseRoles != null && message.hasOwnProperty("databaseRoles")) { - if (!Array.isArray(message.databaseRoles)) - return "databaseRoles: array expected"; - for (var i = 0; i < message.databaseRoles.length; ++i) - if (!$util.isString(message.databaseRoles[i])) - return "databaseRoles: string[] expected"; - } - if (message.revokeExistingRoles != null && message.hasOwnProperty("revokeExistingRoles")) { - properties._revokeExistingRoles = 1; - if (typeof message.revokeExistingRoles !== "boolean") - return "revokeExistingRoles: boolean expected"; - } - if (message.body != null && message.hasOwnProperty("body")) { - var error = $root.google.cloud.sql.v1beta4.User.verify(message.body); - if (error) - return "body." + error; - } - return null; - }; - - /** - * Creates a SqlUsersUpdateRequest message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlUsersUpdateRequest} SqlUsersUpdateRequest - */ - SqlUsersUpdateRequest.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlUsersUpdateRequest) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(); - if (object.host != null) - message.host = String(object.host); - if (object.instance != null) - message.instance = String(object.instance); - if (object.name != null) - message.name = String(object.name); - if (object.project != null) - message.project = String(object.project); - if (object.databaseRoles) { - if (!Array.isArray(object.databaseRoles)) - throw TypeError(".google.cloud.sql.v1beta4.SqlUsersUpdateRequest.databaseRoles: array expected"); - message.databaseRoles = []; - for (var i = 0; i < object.databaseRoles.length; ++i) - message.databaseRoles[i] = String(object.databaseRoles[i]); - } - if (object.revokeExistingRoles != null) - message.revokeExistingRoles = Boolean(object.revokeExistingRoles); - if (object.body != null) { - if (typeof object.body !== "object") - throw TypeError(".google.cloud.sql.v1beta4.SqlUsersUpdateRequest.body: object expected"); - message.body = $root.google.cloud.sql.v1beta4.User.fromObject(object.body); - } - return message; - }; - - /** - * Creates a plain object from a SqlUsersUpdateRequest message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @static - * @param {google.cloud.sql.v1beta4.SqlUsersUpdateRequest} message SqlUsersUpdateRequest - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlUsersUpdateRequest.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.databaseRoles = []; - if (options.defaults) { - object.host = ""; - object.instance = ""; - object.name = ""; - object.project = ""; - object.body = null; - } - if (message.host != null && message.hasOwnProperty("host")) - object.host = message.host; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.databaseRoles && message.databaseRoles.length) { - object.databaseRoles = []; - for (var j = 0; j < message.databaseRoles.length; ++j) - object.databaseRoles[j] = message.databaseRoles[j]; - } - if (message.revokeExistingRoles != null && message.hasOwnProperty("revokeExistingRoles")) { - object.revokeExistingRoles = message.revokeExistingRoles; - if (options.oneofs) - object._revokeExistingRoles = "revokeExistingRoles"; - } - if (message.body != null && message.hasOwnProperty("body")) - object.body = $root.google.cloud.sql.v1beta4.User.toObject(message.body, options); - return object; - }; - - /** - * Converts this SqlUsersUpdateRequest to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @instance - * @returns {Object.} JSON object - */ - SqlUsersUpdateRequest.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlUsersUpdateRequest - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlUsersUpdateRequest - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlUsersUpdateRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlUsersUpdateRequest"; - }; - - return SqlUsersUpdateRequest; - })(); - - v1beta4.UserPasswordValidationPolicy = (function() { - - /** - * Properties of a UserPasswordValidationPolicy. - * @memberof google.cloud.sql.v1beta4 - * @interface IUserPasswordValidationPolicy - * @property {number|null} [allowedFailedAttempts] UserPasswordValidationPolicy allowedFailedAttempts - * @property {google.protobuf.IDuration|null} [passwordExpirationDuration] UserPasswordValidationPolicy passwordExpirationDuration - * @property {boolean|null} [enableFailedAttemptsCheck] UserPasswordValidationPolicy enableFailedAttemptsCheck - * @property {google.cloud.sql.v1beta4.IPasswordStatus|null} [status] UserPasswordValidationPolicy status - * @property {boolean|null} [enablePasswordVerification] UserPasswordValidationPolicy enablePasswordVerification - */ - - /** - * Constructs a new UserPasswordValidationPolicy. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a UserPasswordValidationPolicy. - * @implements IUserPasswordValidationPolicy - * @constructor - * @param {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy=} [properties] Properties to set - */ - function UserPasswordValidationPolicy(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UserPasswordValidationPolicy allowedFailedAttempts. - * @member {number} allowedFailedAttempts - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @instance - */ - UserPasswordValidationPolicy.prototype.allowedFailedAttempts = 0; - - /** - * UserPasswordValidationPolicy passwordExpirationDuration. - * @member {google.protobuf.IDuration|null|undefined} passwordExpirationDuration - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @instance - */ - UserPasswordValidationPolicy.prototype.passwordExpirationDuration = null; - - /** - * UserPasswordValidationPolicy enableFailedAttemptsCheck. - * @member {boolean} enableFailedAttemptsCheck - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @instance - */ - UserPasswordValidationPolicy.prototype.enableFailedAttemptsCheck = false; - - /** - * UserPasswordValidationPolicy status. - * @member {google.cloud.sql.v1beta4.IPasswordStatus|null|undefined} status - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @instance - */ - UserPasswordValidationPolicy.prototype.status = null; - - /** - * UserPasswordValidationPolicy enablePasswordVerification. - * @member {boolean} enablePasswordVerification - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @instance - */ - UserPasswordValidationPolicy.prototype.enablePasswordVerification = false; - - /** - * Creates a new UserPasswordValidationPolicy instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.UserPasswordValidationPolicy} UserPasswordValidationPolicy instance - */ - UserPasswordValidationPolicy.create = function create(properties) { - return new UserPasswordValidationPolicy(properties); - }; - - /** - * Encodes the specified UserPasswordValidationPolicy message. Does not implicitly {@link google.cloud.sql.v1beta4.UserPasswordValidationPolicy.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy} message UserPasswordValidationPolicy message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserPasswordValidationPolicy.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.allowedFailedAttempts != null && Object.hasOwnProperty.call(message, "allowedFailedAttempts")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.allowedFailedAttempts); - if (message.passwordExpirationDuration != null && Object.hasOwnProperty.call(message, "passwordExpirationDuration")) - $root.google.protobuf.Duration.encode(message.passwordExpirationDuration, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.enableFailedAttemptsCheck != null && Object.hasOwnProperty.call(message, "enableFailedAttemptsCheck")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.enableFailedAttemptsCheck); - if (message.status != null && Object.hasOwnProperty.call(message, "status")) - $root.google.cloud.sql.v1beta4.PasswordStatus.encode(message.status, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.enablePasswordVerification != null && Object.hasOwnProperty.call(message, "enablePasswordVerification")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.enablePasswordVerification); - return writer; - }; - - /** - * Encodes the specified UserPasswordValidationPolicy message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UserPasswordValidationPolicy.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy} message UserPasswordValidationPolicy message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UserPasswordValidationPolicy.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.UserPasswordValidationPolicy} UserPasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserPasswordValidationPolicy.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.allowedFailedAttempts = reader.int32(); - break; - } - case 2: { - message.passwordExpirationDuration = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - case 3: { - message.enableFailedAttemptsCheck = reader.bool(); - break; - } - case 4: { - message.status = $root.google.cloud.sql.v1beta4.PasswordStatus.decode(reader, reader.uint32()); - break; - } - case 5: { - message.enablePasswordVerification = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a UserPasswordValidationPolicy message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.UserPasswordValidationPolicy} UserPasswordValidationPolicy - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UserPasswordValidationPolicy.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a UserPasswordValidationPolicy message. - * @function verify - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UserPasswordValidationPolicy.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.allowedFailedAttempts != null && message.hasOwnProperty("allowedFailedAttempts")) - if (!$util.isInteger(message.allowedFailedAttempts)) - return "allowedFailedAttempts: integer expected"; - if (message.passwordExpirationDuration != null && message.hasOwnProperty("passwordExpirationDuration")) { - var error = $root.google.protobuf.Duration.verify(message.passwordExpirationDuration); - if (error) - return "passwordExpirationDuration." + error; - } - if (message.enableFailedAttemptsCheck != null && message.hasOwnProperty("enableFailedAttemptsCheck")) - if (typeof message.enableFailedAttemptsCheck !== "boolean") - return "enableFailedAttemptsCheck: boolean expected"; - if (message.status != null && message.hasOwnProperty("status")) { - var error = $root.google.cloud.sql.v1beta4.PasswordStatus.verify(message.status); - if (error) - return "status." + error; - } - if (message.enablePasswordVerification != null && message.hasOwnProperty("enablePasswordVerification")) - if (typeof message.enablePasswordVerification !== "boolean") - return "enablePasswordVerification: boolean expected"; - return null; - }; - - /** - * Creates a UserPasswordValidationPolicy message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.UserPasswordValidationPolicy} UserPasswordValidationPolicy - */ - UserPasswordValidationPolicy.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy) - return object; - var message = new $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy(); - if (object.allowedFailedAttempts != null) - message.allowedFailedAttempts = object.allowedFailedAttempts | 0; - if (object.passwordExpirationDuration != null) { - if (typeof object.passwordExpirationDuration !== "object") - throw TypeError(".google.cloud.sql.v1beta4.UserPasswordValidationPolicy.passwordExpirationDuration: object expected"); - message.passwordExpirationDuration = $root.google.protobuf.Duration.fromObject(object.passwordExpirationDuration); - } - if (object.enableFailedAttemptsCheck != null) - message.enableFailedAttemptsCheck = Boolean(object.enableFailedAttemptsCheck); - if (object.status != null) { - if (typeof object.status !== "object") - throw TypeError(".google.cloud.sql.v1beta4.UserPasswordValidationPolicy.status: object expected"); - message.status = $root.google.cloud.sql.v1beta4.PasswordStatus.fromObject(object.status); - } - if (object.enablePasswordVerification != null) - message.enablePasswordVerification = Boolean(object.enablePasswordVerification); - return message; - }; - - /** - * Creates a plain object from a UserPasswordValidationPolicy message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @static - * @param {google.cloud.sql.v1beta4.UserPasswordValidationPolicy} message UserPasswordValidationPolicy - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UserPasswordValidationPolicy.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.allowedFailedAttempts = 0; - object.passwordExpirationDuration = null; - object.enableFailedAttemptsCheck = false; - object.status = null; - object.enablePasswordVerification = false; - } - if (message.allowedFailedAttempts != null && message.hasOwnProperty("allowedFailedAttempts")) - object.allowedFailedAttempts = message.allowedFailedAttempts; - if (message.passwordExpirationDuration != null && message.hasOwnProperty("passwordExpirationDuration")) - object.passwordExpirationDuration = $root.google.protobuf.Duration.toObject(message.passwordExpirationDuration, options); - if (message.enableFailedAttemptsCheck != null && message.hasOwnProperty("enableFailedAttemptsCheck")) - object.enableFailedAttemptsCheck = message.enableFailedAttemptsCheck; - if (message.status != null && message.hasOwnProperty("status")) - object.status = $root.google.cloud.sql.v1beta4.PasswordStatus.toObject(message.status, options); - if (message.enablePasswordVerification != null && message.hasOwnProperty("enablePasswordVerification")) - object.enablePasswordVerification = message.enablePasswordVerification; - return object; - }; - - /** - * Converts this UserPasswordValidationPolicy to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @instance - * @returns {Object.} JSON object - */ - UserPasswordValidationPolicy.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UserPasswordValidationPolicy - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.UserPasswordValidationPolicy - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UserPasswordValidationPolicy.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.UserPasswordValidationPolicy"; - }; - - return UserPasswordValidationPolicy; - })(); - - v1beta4.PasswordStatus = (function() { - - /** - * Properties of a PasswordStatus. - * @memberof google.cloud.sql.v1beta4 - * @interface IPasswordStatus - * @property {boolean|null} [locked] PasswordStatus locked - * @property {google.protobuf.ITimestamp|null} [passwordExpirationTime] PasswordStatus passwordExpirationTime - */ - - /** - * Constructs a new PasswordStatus. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a PasswordStatus. - * @implements IPasswordStatus - * @constructor - * @param {google.cloud.sql.v1beta4.IPasswordStatus=} [properties] Properties to set - */ - function PasswordStatus(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PasswordStatus locked. - * @member {boolean} locked - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @instance - */ - PasswordStatus.prototype.locked = false; - - /** - * PasswordStatus passwordExpirationTime. - * @member {google.protobuf.ITimestamp|null|undefined} passwordExpirationTime - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @instance - */ - PasswordStatus.prototype.passwordExpirationTime = null; - - /** - * Creates a new PasswordStatus instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @static - * @param {google.cloud.sql.v1beta4.IPasswordStatus=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.PasswordStatus} PasswordStatus instance - */ - PasswordStatus.create = function create(properties) { - return new PasswordStatus(properties); - }; - - /** - * Encodes the specified PasswordStatus message. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordStatus.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @static - * @param {google.cloud.sql.v1beta4.IPasswordStatus} message PasswordStatus message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PasswordStatus.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.locked != null && Object.hasOwnProperty.call(message, "locked")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.locked); - if (message.passwordExpirationTime != null && Object.hasOwnProperty.call(message, "passwordExpirationTime")) - $root.google.protobuf.Timestamp.encode(message.passwordExpirationTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PasswordStatus message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.PasswordStatus.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @static - * @param {google.cloud.sql.v1beta4.IPasswordStatus} message PasswordStatus message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PasswordStatus.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PasswordStatus message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.PasswordStatus} PasswordStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PasswordStatus.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.PasswordStatus(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.locked = reader.bool(); - break; - } - case 2: { - message.passwordExpirationTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PasswordStatus message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.PasswordStatus} PasswordStatus - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PasswordStatus.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PasswordStatus message. - * @function verify - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PasswordStatus.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.locked != null && message.hasOwnProperty("locked")) - if (typeof message.locked !== "boolean") - return "locked: boolean expected"; - if (message.passwordExpirationTime != null && message.hasOwnProperty("passwordExpirationTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.passwordExpirationTime); - if (error) - return "passwordExpirationTime." + error; - } - return null; - }; - - /** - * Creates a PasswordStatus message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.PasswordStatus} PasswordStatus - */ - PasswordStatus.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.PasswordStatus) - return object; - var message = new $root.google.cloud.sql.v1beta4.PasswordStatus(); - if (object.locked != null) - message.locked = Boolean(object.locked); - if (object.passwordExpirationTime != null) { - if (typeof object.passwordExpirationTime !== "object") - throw TypeError(".google.cloud.sql.v1beta4.PasswordStatus.passwordExpirationTime: object expected"); - message.passwordExpirationTime = $root.google.protobuf.Timestamp.fromObject(object.passwordExpirationTime); - } - return message; - }; - - /** - * Creates a plain object from a PasswordStatus message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @static - * @param {google.cloud.sql.v1beta4.PasswordStatus} message PasswordStatus - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PasswordStatus.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.locked = false; - object.passwordExpirationTime = null; - } - if (message.locked != null && message.hasOwnProperty("locked")) - object.locked = message.locked; - if (message.passwordExpirationTime != null && message.hasOwnProperty("passwordExpirationTime")) - object.passwordExpirationTime = $root.google.protobuf.Timestamp.toObject(message.passwordExpirationTime, options); - return object; - }; - - /** - * Converts this PasswordStatus to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @instance - * @returns {Object.} JSON object - */ - PasswordStatus.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PasswordStatus - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.PasswordStatus - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PasswordStatus.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.PasswordStatus"; - }; - - return PasswordStatus; - })(); - - v1beta4.User = (function() { - - /** - * Properties of a User. - * @memberof google.cloud.sql.v1beta4 - * @interface IUser - * @property {string|null} [kind] User kind - * @property {string|null} [password] User password - * @property {string|null} [etag] User etag - * @property {string|null} [name] User name - * @property {string|null} [host] User host - * @property {string|null} [instance] User instance - * @property {string|null} [project] User project - * @property {google.cloud.sql.v1beta4.User.SqlUserType|null} [type] User type - * @property {google.cloud.sql.v1beta4.ISqlServerUserDetails|null} [sqlserverUserDetails] User sqlserverUserDetails - * @property {string|null} [iamEmail] User iamEmail - * @property {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy|null} [passwordPolicy] User passwordPolicy - * @property {google.cloud.sql.v1beta4.User.DualPasswordType|null} [dualPasswordType] User dualPasswordType - * @property {google.cloud.sql.v1beta4.User.IamStatus|null} [iamStatus] User iamStatus - * @property {Array.|null} [databaseRoles] User databaseRoles - */ - - /** - * Constructs a new User. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a User. - * @implements IUser - * @constructor - * @param {google.cloud.sql.v1beta4.IUser=} [properties] Properties to set - */ - function User(properties) { - this.databaseRoles = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * User kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.kind = ""; - - /** - * User password. - * @member {string} password - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.password = ""; - - /** - * User etag. - * @member {string} etag - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.etag = ""; - - /** - * User name. - * @member {string} name - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.name = ""; - - /** - * User host. - * @member {string} host - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.host = ""; - - /** - * User instance. - * @member {string} instance - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.instance = ""; - - /** - * User project. - * @member {string} project - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.project = ""; - - /** - * User type. - * @member {google.cloud.sql.v1beta4.User.SqlUserType} type - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.type = 0; - - /** - * User sqlserverUserDetails. - * @member {google.cloud.sql.v1beta4.ISqlServerUserDetails|null|undefined} sqlserverUserDetails - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.sqlserverUserDetails = null; - - /** - * User iamEmail. - * @member {string} iamEmail - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.iamEmail = ""; - - /** - * User passwordPolicy. - * @member {google.cloud.sql.v1beta4.IUserPasswordValidationPolicy|null|undefined} passwordPolicy - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.passwordPolicy = null; - - /** - * User dualPasswordType. - * @member {google.cloud.sql.v1beta4.User.DualPasswordType|null|undefined} dualPasswordType - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.dualPasswordType = null; - - /** - * User iamStatus. - * @member {google.cloud.sql.v1beta4.User.IamStatus|null|undefined} iamStatus - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.iamStatus = null; - - /** - * User databaseRoles. - * @member {Array.} databaseRoles - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - User.prototype.databaseRoles = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * User userDetails. - * @member {"sqlserverUserDetails"|undefined} userDetails - * @memberof google.cloud.sql.v1beta4.User - * @instance - */ - Object.defineProperty(User.prototype, "userDetails", { - get: $util.oneOfGetter($oneOfFields = ["sqlserverUserDetails"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(User.prototype, "_dualPasswordType", { - get: $util.oneOfGetter($oneOfFields = ["dualPasswordType"]), - set: $util.oneOfSetter($oneOfFields) - }); - - // Virtual OneOf for proto3 optional field - Object.defineProperty(User.prototype, "_iamStatus", { - get: $util.oneOfGetter($oneOfFields = ["iamStatus"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new User instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.User - * @static - * @param {google.cloud.sql.v1beta4.IUser=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.User} User instance - */ - User.create = function create(properties) { - return new User(properties); - }; - - /** - * Encodes the specified User message. Does not implicitly {@link google.cloud.sql.v1beta4.User.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.User - * @static - * @param {google.cloud.sql.v1beta4.IUser} message User message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - User.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.password != null && Object.hasOwnProperty.call(message, "password")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.password); - if (message.etag != null && Object.hasOwnProperty.call(message, "etag")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.etag); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); - if (message.host != null && Object.hasOwnProperty.call(message, "host")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.host); - if (message.instance != null && Object.hasOwnProperty.call(message, "instance")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.instance); - if (message.project != null && Object.hasOwnProperty.call(message, "project")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.project); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.type); - if (message.sqlserverUserDetails != null && Object.hasOwnProperty.call(message, "sqlserverUserDetails")) - $root.google.cloud.sql.v1beta4.SqlServerUserDetails.encode(message.sqlserverUserDetails, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.iamEmail != null && Object.hasOwnProperty.call(message, "iamEmail")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.iamEmail); - if (message.passwordPolicy != null && Object.hasOwnProperty.call(message, "passwordPolicy")) - $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy.encode(message.passwordPolicy, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.dualPasswordType != null && Object.hasOwnProperty.call(message, "dualPasswordType")) - writer.uint32(/* id 13, wireType 0 =*/104).int32(message.dualPasswordType); - if (message.iamStatus != null && Object.hasOwnProperty.call(message, "iamStatus")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.iamStatus); - if (message.databaseRoles != null && message.databaseRoles.length) - for (var i = 0; i < message.databaseRoles.length; ++i) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.databaseRoles[i]); - return writer; - }; - - /** - * Encodes the specified User message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.User.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.User - * @static - * @param {google.cloud.sql.v1beta4.IUser} message User message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - User.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a User message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.User - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.User} User - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - User.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.User(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.password = reader.string(); - break; - } - case 3: { - message.etag = reader.string(); - break; - } - case 4: { - message.name = reader.string(); - break; - } - case 5: { - message.host = reader.string(); - break; - } - case 6: { - message.instance = reader.string(); - break; - } - case 7: { - message.project = reader.string(); - break; - } - case 8: { - message.type = reader.int32(); - break; - } - case 9: { - message.sqlserverUserDetails = $root.google.cloud.sql.v1beta4.SqlServerUserDetails.decode(reader, reader.uint32()); - break; - } - case 11: { - message.iamEmail = reader.string(); - break; - } - case 12: { - message.passwordPolicy = $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy.decode(reader, reader.uint32()); - break; - } - case 13: { - message.dualPasswordType = reader.int32(); - break; - } - case 14: { - message.iamStatus = reader.int32(); - break; - } - case 15: { - if (!(message.databaseRoles && message.databaseRoles.length)) - message.databaseRoles = []; - message.databaseRoles.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a User message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.User - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.User} User - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - User.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a User message. - * @function verify - * @memberof google.cloud.sql.v1beta4.User - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - User.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.password != null && message.hasOwnProperty("password")) - if (!$util.isString(message.password)) - return "password: string expected"; - if (message.etag != null && message.hasOwnProperty("etag")) - if (!$util.isString(message.etag)) - return "etag: string expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.host != null && message.hasOwnProperty("host")) - if (!$util.isString(message.host)) - return "host: string expected"; - if (message.instance != null && message.hasOwnProperty("instance")) - if (!$util.isString(message.instance)) - return "instance: string expected"; - if (message.project != null && message.hasOwnProperty("project")) - if (!$util.isString(message.project)) - return "project: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 7: - break; - } - if (message.sqlserverUserDetails != null && message.hasOwnProperty("sqlserverUserDetails")) { - properties.userDetails = 1; - { - var error = $root.google.cloud.sql.v1beta4.SqlServerUserDetails.verify(message.sqlserverUserDetails); - if (error) - return "sqlserverUserDetails." + error; - } - } - if (message.iamEmail != null && message.hasOwnProperty("iamEmail")) - if (!$util.isString(message.iamEmail)) - return "iamEmail: string expected"; - if (message.passwordPolicy != null && message.hasOwnProperty("passwordPolicy")) { - var error = $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy.verify(message.passwordPolicy); - if (error) - return "passwordPolicy." + error; - } - if (message.dualPasswordType != null && message.hasOwnProperty("dualPasswordType")) { - properties._dualPasswordType = 1; - switch (message.dualPasswordType) { - default: - return "dualPasswordType: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - } - if (message.iamStatus != null && message.hasOwnProperty("iamStatus")) { - properties._iamStatus = 1; - switch (message.iamStatus) { - default: - return "iamStatus: enum value expected"; - case 0: - case 1: - case 2: - break; - } - } - if (message.databaseRoles != null && message.hasOwnProperty("databaseRoles")) { - if (!Array.isArray(message.databaseRoles)) - return "databaseRoles: array expected"; - for (var i = 0; i < message.databaseRoles.length; ++i) - if (!$util.isString(message.databaseRoles[i])) - return "databaseRoles: string[] expected"; - } - return null; - }; - - /** - * Creates a User message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.User - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.User} User - */ - User.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.User) - return object; - var message = new $root.google.cloud.sql.v1beta4.User(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.password != null) - message.password = String(object.password); - if (object.etag != null) - message.etag = String(object.etag); - if (object.name != null) - message.name = String(object.name); - if (object.host != null) - message.host = String(object.host); - if (object.instance != null) - message.instance = String(object.instance); - if (object.project != null) - message.project = String(object.project); - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "BUILT_IN": - case 0: - message.type = 0; - break; - case "CLOUD_IAM_USER": - case 1: - message.type = 1; - break; - case "CLOUD_IAM_SERVICE_ACCOUNT": - case 2: - message.type = 2; - break; - case "CLOUD_IAM_GROUP": - case 3: - message.type = 3; - break; - case "CLOUD_IAM_GROUP_USER": - case 4: - message.type = 4; - break; - case "CLOUD_IAM_GROUP_SERVICE_ACCOUNT": - case 5: - message.type = 5; - break; - case "ENTRAID_USER": - case 7: - message.type = 7; - break; - } - if (object.sqlserverUserDetails != null) { - if (typeof object.sqlserverUserDetails !== "object") - throw TypeError(".google.cloud.sql.v1beta4.User.sqlserverUserDetails: object expected"); - message.sqlserverUserDetails = $root.google.cloud.sql.v1beta4.SqlServerUserDetails.fromObject(object.sqlserverUserDetails); - } - if (object.iamEmail != null) - message.iamEmail = String(object.iamEmail); - if (object.passwordPolicy != null) { - if (typeof object.passwordPolicy !== "object") - throw TypeError(".google.cloud.sql.v1beta4.User.passwordPolicy: object expected"); - message.passwordPolicy = $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy.fromObject(object.passwordPolicy); - } - switch (object.dualPasswordType) { - default: - if (typeof object.dualPasswordType === "number") { - message.dualPasswordType = object.dualPasswordType; - break; - } - break; - case "DUAL_PASSWORD_TYPE_UNSPECIFIED": - case 0: - message.dualPasswordType = 0; - break; - case "NO_MODIFY_DUAL_PASSWORD": - case 1: - message.dualPasswordType = 1; - break; - case "NO_DUAL_PASSWORD": - case 2: - message.dualPasswordType = 2; - break; - case "DUAL_PASSWORD": - case 3: - message.dualPasswordType = 3; - break; - } - switch (object.iamStatus) { - default: - if (typeof object.iamStatus === "number") { - message.iamStatus = object.iamStatus; - break; - } - break; - case "IAM_STATUS_UNSPECIFIED": - case 0: - message.iamStatus = 0; - break; - case "INACTIVE": - case 1: - message.iamStatus = 1; - break; - case "ACTIVE": - case 2: - message.iamStatus = 2; - break; - } - if (object.databaseRoles) { - if (!Array.isArray(object.databaseRoles)) - throw TypeError(".google.cloud.sql.v1beta4.User.databaseRoles: array expected"); - message.databaseRoles = []; - for (var i = 0; i < object.databaseRoles.length; ++i) - message.databaseRoles[i] = String(object.databaseRoles[i]); - } - return message; - }; - - /** - * Creates a plain object from a User message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.User - * @static - * @param {google.cloud.sql.v1beta4.User} message User - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - User.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.databaseRoles = []; - if (options.defaults) { - object.kind = ""; - object.password = ""; - object.etag = ""; - object.name = ""; - object.host = ""; - object.instance = ""; - object.project = ""; - object.type = options.enums === String ? "BUILT_IN" : 0; - object.iamEmail = ""; - object.passwordPolicy = null; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.password != null && message.hasOwnProperty("password")) - object.password = message.password; - if (message.etag != null && message.hasOwnProperty("etag")) - object.etag = message.etag; - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.host != null && message.hasOwnProperty("host")) - object.host = message.host; - if (message.instance != null && message.hasOwnProperty("instance")) - object.instance = message.instance; - if (message.project != null && message.hasOwnProperty("project")) - object.project = message.project; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.cloud.sql.v1beta4.User.SqlUserType[message.type] === undefined ? message.type : $root.google.cloud.sql.v1beta4.User.SqlUserType[message.type] : message.type; - if (message.sqlserverUserDetails != null && message.hasOwnProperty("sqlserverUserDetails")) { - object.sqlserverUserDetails = $root.google.cloud.sql.v1beta4.SqlServerUserDetails.toObject(message.sqlserverUserDetails, options); - if (options.oneofs) - object.userDetails = "sqlserverUserDetails"; - } - if (message.iamEmail != null && message.hasOwnProperty("iamEmail")) - object.iamEmail = message.iamEmail; - if (message.passwordPolicy != null && message.hasOwnProperty("passwordPolicy")) - object.passwordPolicy = $root.google.cloud.sql.v1beta4.UserPasswordValidationPolicy.toObject(message.passwordPolicy, options); - if (message.dualPasswordType != null && message.hasOwnProperty("dualPasswordType")) { - object.dualPasswordType = options.enums === String ? $root.google.cloud.sql.v1beta4.User.DualPasswordType[message.dualPasswordType] === undefined ? message.dualPasswordType : $root.google.cloud.sql.v1beta4.User.DualPasswordType[message.dualPasswordType] : message.dualPasswordType; - if (options.oneofs) - object._dualPasswordType = "dualPasswordType"; - } - if (message.iamStatus != null && message.hasOwnProperty("iamStatus")) { - object.iamStatus = options.enums === String ? $root.google.cloud.sql.v1beta4.User.IamStatus[message.iamStatus] === undefined ? message.iamStatus : $root.google.cloud.sql.v1beta4.User.IamStatus[message.iamStatus] : message.iamStatus; - if (options.oneofs) - object._iamStatus = "iamStatus"; - } - if (message.databaseRoles && message.databaseRoles.length) { - object.databaseRoles = []; - for (var j = 0; j < message.databaseRoles.length; ++j) - object.databaseRoles[j] = message.databaseRoles[j]; - } - return object; - }; - - /** - * Converts this User to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.User - * @instance - * @returns {Object.} JSON object - */ - User.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for User - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.User - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - User.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.User"; - }; - - /** - * SqlUserType enum. - * @name google.cloud.sql.v1beta4.User.SqlUserType - * @enum {number} - * @property {number} BUILT_IN=0 BUILT_IN value - * @property {number} CLOUD_IAM_USER=1 CLOUD_IAM_USER value - * @property {number} CLOUD_IAM_SERVICE_ACCOUNT=2 CLOUD_IAM_SERVICE_ACCOUNT value - * @property {number} CLOUD_IAM_GROUP=3 CLOUD_IAM_GROUP value - * @property {number} CLOUD_IAM_GROUP_USER=4 CLOUD_IAM_GROUP_USER value - * @property {number} CLOUD_IAM_GROUP_SERVICE_ACCOUNT=5 CLOUD_IAM_GROUP_SERVICE_ACCOUNT value - * @property {number} ENTRAID_USER=7 ENTRAID_USER value - */ - User.SqlUserType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "BUILT_IN"] = 0; - values[valuesById[1] = "CLOUD_IAM_USER"] = 1; - values[valuesById[2] = "CLOUD_IAM_SERVICE_ACCOUNT"] = 2; - values[valuesById[3] = "CLOUD_IAM_GROUP"] = 3; - values[valuesById[4] = "CLOUD_IAM_GROUP_USER"] = 4; - values[valuesById[5] = "CLOUD_IAM_GROUP_SERVICE_ACCOUNT"] = 5; - values[valuesById[7] = "ENTRAID_USER"] = 7; - return values; - })(); - - /** - * DualPasswordType enum. - * @name google.cloud.sql.v1beta4.User.DualPasswordType - * @enum {number} - * @property {number} DUAL_PASSWORD_TYPE_UNSPECIFIED=0 DUAL_PASSWORD_TYPE_UNSPECIFIED value - * @property {number} NO_MODIFY_DUAL_PASSWORD=1 NO_MODIFY_DUAL_PASSWORD value - * @property {number} NO_DUAL_PASSWORD=2 NO_DUAL_PASSWORD value - * @property {number} DUAL_PASSWORD=3 DUAL_PASSWORD value - */ - User.DualPasswordType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DUAL_PASSWORD_TYPE_UNSPECIFIED"] = 0; - values[valuesById[1] = "NO_MODIFY_DUAL_PASSWORD"] = 1; - values[valuesById[2] = "NO_DUAL_PASSWORD"] = 2; - values[valuesById[3] = "DUAL_PASSWORD"] = 3; - return values; - })(); - - /** - * IamStatus enum. - * @name google.cloud.sql.v1beta4.User.IamStatus - * @enum {number} - * @property {number} IAM_STATUS_UNSPECIFIED=0 IAM_STATUS_UNSPECIFIED value - * @property {number} INACTIVE=1 INACTIVE value - * @property {number} ACTIVE=2 ACTIVE value - */ - User.IamStatus = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "IAM_STATUS_UNSPECIFIED"] = 0; - values[valuesById[1] = "INACTIVE"] = 1; - values[valuesById[2] = "ACTIVE"] = 2; - return values; - })(); - - return User; - })(); - - v1beta4.SqlServerUserDetails = (function() { - - /** - * Properties of a SqlServerUserDetails. - * @memberof google.cloud.sql.v1beta4 - * @interface ISqlServerUserDetails - * @property {boolean|null} [disabled] SqlServerUserDetails disabled - * @property {Array.|null} [serverRoles] SqlServerUserDetails serverRoles - */ - - /** - * Constructs a new SqlServerUserDetails. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a SqlServerUserDetails. - * @implements ISqlServerUserDetails - * @constructor - * @param {google.cloud.sql.v1beta4.ISqlServerUserDetails=} [properties] Properties to set - */ - function SqlServerUserDetails(properties) { - this.serverRoles = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SqlServerUserDetails disabled. - * @member {boolean} disabled - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @instance - */ - SqlServerUserDetails.prototype.disabled = false; - - /** - * SqlServerUserDetails serverRoles. - * @member {Array.} serverRoles - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @instance - */ - SqlServerUserDetails.prototype.serverRoles = $util.emptyArray; - - /** - * Creates a new SqlServerUserDetails instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerUserDetails=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.SqlServerUserDetails} SqlServerUserDetails instance - */ - SqlServerUserDetails.create = function create(properties) { - return new SqlServerUserDetails(properties); - }; - - /** - * Encodes the specified SqlServerUserDetails message. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerUserDetails.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerUserDetails} message SqlServerUserDetails message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerUserDetails.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.disabled); - if (message.serverRoles != null && message.serverRoles.length) - for (var i = 0; i < message.serverRoles.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.serverRoles[i]); - return writer; - }; - - /** - * Encodes the specified SqlServerUserDetails message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.SqlServerUserDetails.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @static - * @param {google.cloud.sql.v1beta4.ISqlServerUserDetails} message SqlServerUserDetails message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SqlServerUserDetails.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SqlServerUserDetails message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.SqlServerUserDetails} SqlServerUserDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerUserDetails.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.SqlServerUserDetails(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.disabled = reader.bool(); - break; - } - case 2: { - if (!(message.serverRoles && message.serverRoles.length)) - message.serverRoles = []; - message.serverRoles.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SqlServerUserDetails message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.SqlServerUserDetails} SqlServerUserDetails - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SqlServerUserDetails.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SqlServerUserDetails message. - * @function verify - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SqlServerUserDetails.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.disabled != null && message.hasOwnProperty("disabled")) - if (typeof message.disabled !== "boolean") - return "disabled: boolean expected"; - if (message.serverRoles != null && message.hasOwnProperty("serverRoles")) { - if (!Array.isArray(message.serverRoles)) - return "serverRoles: array expected"; - for (var i = 0; i < message.serverRoles.length; ++i) - if (!$util.isString(message.serverRoles[i])) - return "serverRoles: string[] expected"; - } - return null; - }; - - /** - * Creates a SqlServerUserDetails message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.SqlServerUserDetails} SqlServerUserDetails - */ - SqlServerUserDetails.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.SqlServerUserDetails) - return object; - var message = new $root.google.cloud.sql.v1beta4.SqlServerUserDetails(); - if (object.disabled != null) - message.disabled = Boolean(object.disabled); - if (object.serverRoles) { - if (!Array.isArray(object.serverRoles)) - throw TypeError(".google.cloud.sql.v1beta4.SqlServerUserDetails.serverRoles: array expected"); - message.serverRoles = []; - for (var i = 0; i < object.serverRoles.length; ++i) - message.serverRoles[i] = String(object.serverRoles[i]); - } - return message; - }; - - /** - * Creates a plain object from a SqlServerUserDetails message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @static - * @param {google.cloud.sql.v1beta4.SqlServerUserDetails} message SqlServerUserDetails - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SqlServerUserDetails.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.serverRoles = []; - if (options.defaults) - object.disabled = false; - if (message.disabled != null && message.hasOwnProperty("disabled")) - object.disabled = message.disabled; - if (message.serverRoles && message.serverRoles.length) { - object.serverRoles = []; - for (var j = 0; j < message.serverRoles.length; ++j) - object.serverRoles[j] = message.serverRoles[j]; - } - return object; - }; - - /** - * Converts this SqlServerUserDetails to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @instance - * @returns {Object.} JSON object - */ - SqlServerUserDetails.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SqlServerUserDetails - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.SqlServerUserDetails - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SqlServerUserDetails.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.SqlServerUserDetails"; - }; - - return SqlServerUserDetails; - })(); - - v1beta4.UsersListResponse = (function() { - - /** - * Properties of a UsersListResponse. - * @memberof google.cloud.sql.v1beta4 - * @interface IUsersListResponse - * @property {string|null} [kind] UsersListResponse kind - * @property {Array.|null} [items] UsersListResponse items - * @property {string|null} [nextPageToken] UsersListResponse nextPageToken - */ - - /** - * Constructs a new UsersListResponse. - * @memberof google.cloud.sql.v1beta4 - * @classdesc Represents a UsersListResponse. - * @implements IUsersListResponse - * @constructor - * @param {google.cloud.sql.v1beta4.IUsersListResponse=} [properties] Properties to set - */ - function UsersListResponse(properties) { - this.items = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UsersListResponse kind. - * @member {string} kind - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @instance - */ - UsersListResponse.prototype.kind = ""; - - /** - * UsersListResponse items. - * @member {Array.} items - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @instance - */ - UsersListResponse.prototype.items = $util.emptyArray; - - /** - * UsersListResponse nextPageToken. - * @member {string} nextPageToken - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @instance - */ - UsersListResponse.prototype.nextPageToken = ""; - - /** - * Creates a new UsersListResponse instance using the specified properties. - * @function create - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @static - * @param {google.cloud.sql.v1beta4.IUsersListResponse=} [properties] Properties to set - * @returns {google.cloud.sql.v1beta4.UsersListResponse} UsersListResponse instance - */ - UsersListResponse.create = function create(properties) { - return new UsersListResponse(properties); - }; - - /** - * Encodes the specified UsersListResponse message. Does not implicitly {@link google.cloud.sql.v1beta4.UsersListResponse.verify|verify} messages. - * @function encode - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @static - * @param {google.cloud.sql.v1beta4.IUsersListResponse} message UsersListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UsersListResponse.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.items != null && message.items.length) - for (var i = 0; i < message.items.length; ++i) - $root.google.cloud.sql.v1beta4.User.encode(message.items[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nextPageToken); - return writer; - }; - - /** - * Encodes the specified UsersListResponse message, length delimited. Does not implicitly {@link google.cloud.sql.v1beta4.UsersListResponse.verify|verify} messages. - * @function encodeDelimited - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @static - * @param {google.cloud.sql.v1beta4.IUsersListResponse} message UsersListResponse message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UsersListResponse.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a UsersListResponse message from the specified reader or buffer. - * @function decode - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.cloud.sql.v1beta4.UsersListResponse} UsersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UsersListResponse.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.cloud.sql.v1beta4.UsersListResponse(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - if (!(message.items && message.items.length)) - message.items = []; - message.items.push($root.google.cloud.sql.v1beta4.User.decode(reader, reader.uint32())); - break; - } - case 3: { - message.nextPageToken = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a UsersListResponse message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.cloud.sql.v1beta4.UsersListResponse} UsersListResponse - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UsersListResponse.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a UsersListResponse message. - * @function verify - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UsersListResponse.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.items != null && message.hasOwnProperty("items")) { - if (!Array.isArray(message.items)) - return "items: array expected"; - for (var i = 0; i < message.items.length; ++i) { - var error = $root.google.cloud.sql.v1beta4.User.verify(message.items[i]); - if (error) - return "items." + error; - } - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - if (!$util.isString(message.nextPageToken)) - return "nextPageToken: string expected"; - return null; - }; - - /** - * Creates a UsersListResponse message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @static - * @param {Object.} object Plain object - * @returns {google.cloud.sql.v1beta4.UsersListResponse} UsersListResponse - */ - UsersListResponse.fromObject = function fromObject(object) { - if (object instanceof $root.google.cloud.sql.v1beta4.UsersListResponse) - return object; - var message = new $root.google.cloud.sql.v1beta4.UsersListResponse(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.items) { - if (!Array.isArray(object.items)) - throw TypeError(".google.cloud.sql.v1beta4.UsersListResponse.items: array expected"); - message.items = []; - for (var i = 0; i < object.items.length; ++i) { - if (typeof object.items[i] !== "object") - throw TypeError(".google.cloud.sql.v1beta4.UsersListResponse.items: object expected"); - message.items[i] = $root.google.cloud.sql.v1beta4.User.fromObject(object.items[i]); - } - } - if (object.nextPageToken != null) - message.nextPageToken = String(object.nextPageToken); - return message; - }; - - /** - * Creates a plain object from a UsersListResponse message. Also converts values to other types if specified. - * @function toObject - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @static - * @param {google.cloud.sql.v1beta4.UsersListResponse} message UsersListResponse - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UsersListResponse.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.items = []; - if (options.defaults) { - object.kind = ""; - object.nextPageToken = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.items && message.items.length) { - object.items = []; - for (var j = 0; j < message.items.length; ++j) - object.items[j] = $root.google.cloud.sql.v1beta4.User.toObject(message.items[j], options); - } - if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) - object.nextPageToken = message.nextPageToken; - return object; - }; - - /** - * Converts this UsersListResponse to JSON. - * @function toJSON - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @instance - * @returns {Object.} JSON object - */ - UsersListResponse.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UsersListResponse - * @function getTypeUrl - * @memberof google.cloud.sql.v1beta4.UsersListResponse - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UsersListResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.cloud.sql.v1beta4.UsersListResponse"; - }; - - return UsersListResponse; - })(); - - return v1beta4; - })(); - - return sql; - })(); - - return cloud; - })(); - - google.api = (function() { - - /** - * Namespace api. - * @memberof google - * @namespace - */ - var api = {}; - - api.Http = (function() { - - /** - * Properties of a Http. - * @memberof google.api - * @interface IHttp - * @property {Array.|null} [rules] Http rules - * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion - */ - - /** - * Constructs a new Http. - * @memberof google.api - * @classdesc Represents a Http. - * @implements IHttp - * @constructor - * @param {google.api.IHttp=} [properties] Properties to set - */ - function Http(properties) { - this.rules = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Http rules. - * @member {Array.} rules - * @memberof google.api.Http - * @instance - */ - Http.prototype.rules = $util.emptyArray; - - /** - * Http fullyDecodeReservedExpansion. - * @member {boolean} fullyDecodeReservedExpansion - * @memberof google.api.Http - * @instance - */ - Http.prototype.fullyDecodeReservedExpansion = false; - - /** - * Creates a new Http instance using the specified properties. - * @function create - * @memberof google.api.Http - * @static - * @param {google.api.IHttp=} [properties] Properties to set - * @returns {google.api.Http} Http instance - */ - Http.create = function create(properties) { - return new Http(properties); - }; - - /** - * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @function encode - * @memberof google.api.Http - * @static - * @param {google.api.IHttp} message Http message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Http.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.rules != null && message.rules.length) - for (var i = 0; i < message.rules.length; ++i) - $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); - return writer; - }; - - /** - * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.Http - * @static - * @param {google.api.IHttp} message Http message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Http.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Http message from the specified reader or buffer. - * @function decode - * @memberof google.api.Http - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.Http} Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Http.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.rules && message.rules.length)) - message.rules = []; - message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; - } - case 2: { - message.fullyDecodeReservedExpansion = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Http message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.Http - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.Http} Http - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Http.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Http message. - * @function verify - * @memberof google.api.Http - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Http.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.rules != null && message.hasOwnProperty("rules")) { - if (!Array.isArray(message.rules)) - return "rules: array expected"; - for (var i = 0; i < message.rules.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.rules[i]); - if (error) - return "rules." + error; - } - } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - if (typeof message.fullyDecodeReservedExpansion !== "boolean") - return "fullyDecodeReservedExpansion: boolean expected"; - return null; - }; - - /** - * Creates a Http message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.Http - * @static - * @param {Object.} object Plain object - * @returns {google.api.Http} Http - */ - Http.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.Http) - return object; - var message = new $root.google.api.Http(); - if (object.rules) { - if (!Array.isArray(object.rules)) - throw TypeError(".google.api.Http.rules: array expected"); - message.rules = []; - for (var i = 0; i < object.rules.length; ++i) { - if (typeof object.rules[i] !== "object") - throw TypeError(".google.api.Http.rules: object expected"); - message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); - } - } - if (object.fullyDecodeReservedExpansion != null) - message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); - return message; - }; - - /** - * Creates a plain object from a Http message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.Http - * @static - * @param {google.api.Http} message Http - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Http.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.rules = []; - if (options.defaults) - object.fullyDecodeReservedExpansion = false; - if (message.rules && message.rules.length) { - object.rules = []; - for (var j = 0; j < message.rules.length; ++j) - object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); - } - if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) - object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; - return object; - }; - - /** - * Converts this Http to JSON. - * @function toJSON - * @memberof google.api.Http - * @instance - * @returns {Object.} JSON object - */ - Http.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Http - * @function getTypeUrl - * @memberof google.api.Http - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.Http"; - }; - - return Http; - })(); - - api.HttpRule = (function() { - - /** - * Properties of a HttpRule. - * @memberof google.api - * @interface IHttpRule - * @property {string|null} [selector] HttpRule selector - * @property {string|null} [get] HttpRule get - * @property {string|null} [put] HttpRule put - * @property {string|null} [post] HttpRule post - * @property {string|null} ["delete"] HttpRule delete - * @property {string|null} [patch] HttpRule patch - * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom - * @property {string|null} [body] HttpRule body - * @property {string|null} [responseBody] HttpRule responseBody - * @property {Array.|null} [additionalBindings] HttpRule additionalBindings - */ - - /** - * Constructs a new HttpRule. - * @memberof google.api - * @classdesc Represents a HttpRule. - * @implements IHttpRule - * @constructor - * @param {google.api.IHttpRule=} [properties] Properties to set - */ - function HttpRule(properties) { - this.additionalBindings = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * HttpRule selector. - * @member {string} selector - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.selector = ""; - - /** - * HttpRule get. - * @member {string|null|undefined} get - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.get = null; - - /** - * HttpRule put. - * @member {string|null|undefined} put - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.put = null; - - /** - * HttpRule post. - * @member {string|null|undefined} post - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.post = null; - - /** - * HttpRule delete. - * @member {string|null|undefined} delete - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype["delete"] = null; - - /** - * HttpRule patch. - * @member {string|null|undefined} patch - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.patch = null; - - /** - * HttpRule custom. - * @member {google.api.ICustomHttpPattern|null|undefined} custom - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.custom = null; - - /** - * HttpRule body. - * @member {string} body - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.body = ""; - - /** - * HttpRule responseBody. - * @member {string} responseBody - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.responseBody = ""; - - /** - * HttpRule additionalBindings. - * @member {Array.} additionalBindings - * @memberof google.api.HttpRule - * @instance - */ - HttpRule.prototype.additionalBindings = $util.emptyArray; - - // OneOf field names bound to virtual getters and setters - var $oneOfFields; - - /** - * HttpRule pattern. - * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern - * @memberof google.api.HttpRule - * @instance - */ - Object.defineProperty(HttpRule.prototype, "pattern", { - get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), - set: $util.oneOfSetter($oneOfFields) - }); - - /** - * Creates a new HttpRule instance using the specified properties. - * @function create - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule=} [properties] Properties to set - * @returns {google.api.HttpRule} HttpRule instance - */ - HttpRule.create = function create(properties) { - return new HttpRule(properties); - }; - - /** - * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @function encode - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HttpRule.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.get != null && Object.hasOwnProperty.call(message, "get")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); - if (message.put != null && Object.hasOwnProperty.call(message, "put")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); - if (message.post != null && Object.hasOwnProperty.call(message, "post")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); - if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); - if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); - if (message.body != null && Object.hasOwnProperty.call(message, "body")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); - if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) - $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.additionalBindings != null && message.additionalBindings.length) - for (var i = 0; i < message.additionalBindings.length; ++i) - $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); - if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); - return writer; - }; - - /** - * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.HttpRule - * @static - * @param {google.api.IHttpRule} message HttpRule message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - HttpRule.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a HttpRule message from the specified reader or buffer. - * @function decode - * @memberof google.api.HttpRule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.HttpRule} HttpRule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HttpRule.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.selector = reader.string(); - break; - } - case 2: { - message.get = reader.string(); - break; - } - case 3: { - message.put = reader.string(); - break; - } - case 4: { - message.post = reader.string(); - break; - } - case 5: { - message["delete"] = reader.string(); - break; - } - case 6: { - message.patch = reader.string(); - break; - } - case 8: { - message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); - break; - } - case 7: { - message.body = reader.string(); - break; - } - case 12: { - message.responseBody = reader.string(); - break; - } - case 11: { - if (!(message.additionalBindings && message.additionalBindings.length)) - message.additionalBindings = []; - message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a HttpRule message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.HttpRule - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.HttpRule} HttpRule - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - HttpRule.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a HttpRule message. - * @function verify - * @memberof google.api.HttpRule - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - HttpRule.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - var properties = {}; - if (message.selector != null && message.hasOwnProperty("selector")) - if (!$util.isString(message.selector)) - return "selector: string expected"; - if (message.get != null && message.hasOwnProperty("get")) { - properties.pattern = 1; - if (!$util.isString(message.get)) - return "get: string expected"; - } - if (message.put != null && message.hasOwnProperty("put")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.put)) - return "put: string expected"; - } - if (message.post != null && message.hasOwnProperty("post")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.post)) - return "post: string expected"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message["delete"])) - return "delete: string expected"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - if (!$util.isString(message.patch)) - return "patch: string expected"; - } - if (message.custom != null && message.hasOwnProperty("custom")) { - if (properties.pattern === 1) - return "pattern: multiple values"; - properties.pattern = 1; - { - var error = $root.google.api.CustomHttpPattern.verify(message.custom); - if (error) - return "custom." + error; - } - } - if (message.body != null && message.hasOwnProperty("body")) - if (!$util.isString(message.body)) - return "body: string expected"; - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - if (!$util.isString(message.responseBody)) - return "responseBody: string expected"; - if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { - if (!Array.isArray(message.additionalBindings)) - return "additionalBindings: array expected"; - for (var i = 0; i < message.additionalBindings.length; ++i) { - var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); - if (error) - return "additionalBindings." + error; - } - } - return null; - }; - - /** - * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.HttpRule - * @static - * @param {Object.} object Plain object - * @returns {google.api.HttpRule} HttpRule - */ - HttpRule.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.HttpRule) - return object; - var message = new $root.google.api.HttpRule(); - if (object.selector != null) - message.selector = String(object.selector); - if (object.get != null) - message.get = String(object.get); - if (object.put != null) - message.put = String(object.put); - if (object.post != null) - message.post = String(object.post); - if (object["delete"] != null) - message["delete"] = String(object["delete"]); - if (object.patch != null) - message.patch = String(object.patch); - if (object.custom != null) { - if (typeof object.custom !== "object") - throw TypeError(".google.api.HttpRule.custom: object expected"); - message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); - } - if (object.body != null) - message.body = String(object.body); - if (object.responseBody != null) - message.responseBody = String(object.responseBody); - if (object.additionalBindings) { - if (!Array.isArray(object.additionalBindings)) - throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); - message.additionalBindings = []; - for (var i = 0; i < object.additionalBindings.length; ++i) { - if (typeof object.additionalBindings[i] !== "object") - throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); - message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a HttpRule message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.HttpRule - * @static - * @param {google.api.HttpRule} message HttpRule - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - HttpRule.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.additionalBindings = []; - if (options.defaults) { - object.selector = ""; - object.body = ""; - object.responseBody = ""; - } - if (message.selector != null && message.hasOwnProperty("selector")) - object.selector = message.selector; - if (message.get != null && message.hasOwnProperty("get")) { - object.get = message.get; - if (options.oneofs) - object.pattern = "get"; - } - if (message.put != null && message.hasOwnProperty("put")) { - object.put = message.put; - if (options.oneofs) - object.pattern = "put"; - } - if (message.post != null && message.hasOwnProperty("post")) { - object.post = message.post; - if (options.oneofs) - object.pattern = "post"; - } - if (message["delete"] != null && message.hasOwnProperty("delete")) { - object["delete"] = message["delete"]; - if (options.oneofs) - object.pattern = "delete"; - } - if (message.patch != null && message.hasOwnProperty("patch")) { - object.patch = message.patch; - if (options.oneofs) - object.pattern = "patch"; - } - if (message.body != null && message.hasOwnProperty("body")) - object.body = message.body; - if (message.custom != null && message.hasOwnProperty("custom")) { - object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); - if (options.oneofs) - object.pattern = "custom"; - } - if (message.additionalBindings && message.additionalBindings.length) { - object.additionalBindings = []; - for (var j = 0; j < message.additionalBindings.length; ++j) - object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); - } - if (message.responseBody != null && message.hasOwnProperty("responseBody")) - object.responseBody = message.responseBody; - return object; - }; - - /** - * Converts this HttpRule to JSON. - * @function toJSON - * @memberof google.api.HttpRule - * @instance - * @returns {Object.} JSON object - */ - HttpRule.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for HttpRule - * @function getTypeUrl - * @memberof google.api.HttpRule - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.HttpRule"; - }; - - return HttpRule; - })(); - - api.CustomHttpPattern = (function() { - - /** - * Properties of a CustomHttpPattern. - * @memberof google.api - * @interface ICustomHttpPattern - * @property {string|null} [kind] CustomHttpPattern kind - * @property {string|null} [path] CustomHttpPattern path - */ - - /** - * Constructs a new CustomHttpPattern. - * @memberof google.api - * @classdesc Represents a CustomHttpPattern. - * @implements ICustomHttpPattern - * @constructor - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - */ - function CustomHttpPattern(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CustomHttpPattern kind. - * @member {string} kind - * @memberof google.api.CustomHttpPattern - * @instance - */ - CustomHttpPattern.prototype.kind = ""; - - /** - * CustomHttpPattern path. - * @member {string} path - * @memberof google.api.CustomHttpPattern - * @instance - */ - CustomHttpPattern.prototype.path = ""; - - /** - * Creates a new CustomHttpPattern instance using the specified properties. - * @function create - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern=} [properties] Properties to set - * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance - */ - CustomHttpPattern.create = function create(properties) { - return new CustomHttpPattern(properties); - }; - - /** - * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @function encode - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomHttpPattern.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); - if (message.path != null && Object.hasOwnProperty.call(message, "path")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); - return writer; - }; - - /** - * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer. - * @function decode - * @memberof google.api.CustomHttpPattern - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomHttpPattern.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.kind = reader.string(); - break; - } - case 2: { - message.path = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.CustomHttpPattern - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CustomHttpPattern message. - * @function verify - * @memberof google.api.CustomHttpPattern - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CustomHttpPattern.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.kind != null && message.hasOwnProperty("kind")) - if (!$util.isString(message.kind)) - return "kind: string expected"; - if (message.path != null && message.hasOwnProperty("path")) - if (!$util.isString(message.path)) - return "path: string expected"; - return null; - }; - - /** - * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.CustomHttpPattern - * @static - * @param {Object.} object Plain object - * @returns {google.api.CustomHttpPattern} CustomHttpPattern - */ - CustomHttpPattern.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CustomHttpPattern) - return object; - var message = new $root.google.api.CustomHttpPattern(); - if (object.kind != null) - message.kind = String(object.kind); - if (object.path != null) - message.path = String(object.path); - return message; - }; - - /** - * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.CustomHttpPattern - * @static - * @param {google.api.CustomHttpPattern} message CustomHttpPattern - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CustomHttpPattern.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.kind = ""; - object.path = ""; - } - if (message.kind != null && message.hasOwnProperty("kind")) - object.kind = message.kind; - if (message.path != null && message.hasOwnProperty("path")) - object.path = message.path; - return object; - }; - - /** - * Converts this CustomHttpPattern to JSON. - * @function toJSON - * @memberof google.api.CustomHttpPattern - * @instance - * @returns {Object.} JSON object - */ - CustomHttpPattern.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CustomHttpPattern - * @function getTypeUrl - * @memberof google.api.CustomHttpPattern - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.CustomHttpPattern"; - }; - - return CustomHttpPattern; - })(); - - api.CommonLanguageSettings = (function() { - - /** - * Properties of a CommonLanguageSettings. - * @memberof google.api - * @interface ICommonLanguageSettings - * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri - * @property {Array.|null} [destinations] CommonLanguageSettings destinations - * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration - */ - - /** - * Constructs a new CommonLanguageSettings. - * @memberof google.api - * @classdesc Represents a CommonLanguageSettings. - * @implements ICommonLanguageSettings - * @constructor - * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set - */ - function CommonLanguageSettings(properties) { - this.destinations = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CommonLanguageSettings referenceDocsUri. - * @member {string} referenceDocsUri - * @memberof google.api.CommonLanguageSettings - * @instance - */ - CommonLanguageSettings.prototype.referenceDocsUri = ""; - - /** - * CommonLanguageSettings destinations. - * @member {Array.} destinations - * @memberof google.api.CommonLanguageSettings - * @instance - */ - CommonLanguageSettings.prototype.destinations = $util.emptyArray; - - /** - * CommonLanguageSettings selectiveGapicGeneration. - * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration - * @memberof google.api.CommonLanguageSettings - * @instance - */ - CommonLanguageSettings.prototype.selectiveGapicGeneration = null; - - /** - * Creates a new CommonLanguageSettings instance using the specified properties. - * @function create - * @memberof google.api.CommonLanguageSettings - * @static - * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set - * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings instance - */ - CommonLanguageSettings.create = function create(properties) { - return new CommonLanguageSettings(properties); - }; - - /** - * Encodes the specified CommonLanguageSettings message. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. - * @function encode - * @memberof google.api.CommonLanguageSettings - * @static - * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommonLanguageSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.referenceDocsUri); - if (message.destinations != null && message.destinations.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.destinations.length; ++i) - writer.int32(message.destinations[i]); - writer.ldelim(); - } - if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) - $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CommonLanguageSettings message, length delimited. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.CommonLanguageSettings - * @static - * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CommonLanguageSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CommonLanguageSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.CommonLanguageSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommonLanguageSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CommonLanguageSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.referenceDocsUri = reader.string(); - break; - } - case 2: { - if (!(message.destinations && message.destinations.length)) - message.destinations = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.destinations.push(reader.int32()); - } else - message.destinations.push(reader.int32()); - break; - } - case 3: { - message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CommonLanguageSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.CommonLanguageSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CommonLanguageSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CommonLanguageSettings message. - * @function verify - * @memberof google.api.CommonLanguageSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CommonLanguageSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) - if (!$util.isString(message.referenceDocsUri)) - return "referenceDocsUri: string expected"; - if (message.destinations != null && message.hasOwnProperty("destinations")) { - if (!Array.isArray(message.destinations)) - return "destinations: array expected"; - for (var i = 0; i < message.destinations.length; ++i) - switch (message.destinations[i]) { - default: - return "destinations: enum value[] expected"; - case 0: - case 10: - case 20: - break; - } - } - if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { - var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); - if (error) - return "selectiveGapicGeneration." + error; - } - return null; - }; - - /** - * Creates a CommonLanguageSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.CommonLanguageSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings - */ - CommonLanguageSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CommonLanguageSettings) - return object; - var message = new $root.google.api.CommonLanguageSettings(); - if (object.referenceDocsUri != null) - message.referenceDocsUri = String(object.referenceDocsUri); - if (object.destinations) { - if (!Array.isArray(object.destinations)) - throw TypeError(".google.api.CommonLanguageSettings.destinations: array expected"); - message.destinations = []; - for (var i = 0; i < object.destinations.length; ++i) - switch (object.destinations[i]) { - default: - if (typeof object.destinations[i] === "number") { - message.destinations[i] = object.destinations[i]; - break; - } - case "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": - case 0: - message.destinations[i] = 0; - break; - case "GITHUB": - case 10: - message.destinations[i] = 10; - break; - case "PACKAGE_MANAGER": - case 20: - message.destinations[i] = 20; - break; - } - } - if (object.selectiveGapicGeneration != null) { - if (typeof object.selectiveGapicGeneration !== "object") - throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); - message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); - } - return message; - }; - - /** - * Creates a plain object from a CommonLanguageSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.CommonLanguageSettings - * @static - * @param {google.api.CommonLanguageSettings} message CommonLanguageSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CommonLanguageSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.destinations = []; - if (options.defaults) { - object.referenceDocsUri = ""; - object.selectiveGapicGeneration = null; - } - if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) - object.referenceDocsUri = message.referenceDocsUri; - if (message.destinations && message.destinations.length) { - object.destinations = []; - for (var j = 0; j < message.destinations.length; ++j) - object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; - } - if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) - object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); - return object; - }; - - /** - * Converts this CommonLanguageSettings to JSON. - * @function toJSON - * @memberof google.api.CommonLanguageSettings - * @instance - * @returns {Object.} JSON object - */ - CommonLanguageSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CommonLanguageSettings - * @function getTypeUrl - * @memberof google.api.CommonLanguageSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CommonLanguageSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.CommonLanguageSettings"; - }; - - return CommonLanguageSettings; - })(); - - api.ClientLibrarySettings = (function() { - - /** - * Properties of a ClientLibrarySettings. - * @memberof google.api - * @interface IClientLibrarySettings - * @property {string|null} [version] ClientLibrarySettings version - * @property {google.api.LaunchStage|null} [launchStage] ClientLibrarySettings launchStage - * @property {boolean|null} [restNumericEnums] ClientLibrarySettings restNumericEnums - * @property {google.api.IJavaSettings|null} [javaSettings] ClientLibrarySettings javaSettings - * @property {google.api.ICppSettings|null} [cppSettings] ClientLibrarySettings cppSettings - * @property {google.api.IPhpSettings|null} [phpSettings] ClientLibrarySettings phpSettings - * @property {google.api.IPythonSettings|null} [pythonSettings] ClientLibrarySettings pythonSettings - * @property {google.api.INodeSettings|null} [nodeSettings] ClientLibrarySettings nodeSettings - * @property {google.api.IDotnetSettings|null} [dotnetSettings] ClientLibrarySettings dotnetSettings - * @property {google.api.IRubySettings|null} [rubySettings] ClientLibrarySettings rubySettings - * @property {google.api.IGoSettings|null} [goSettings] ClientLibrarySettings goSettings - */ - - /** - * Constructs a new ClientLibrarySettings. - * @memberof google.api - * @classdesc Represents a ClientLibrarySettings. - * @implements IClientLibrarySettings - * @constructor - * @param {google.api.IClientLibrarySettings=} [properties] Properties to set - */ - function ClientLibrarySettings(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ClientLibrarySettings version. - * @member {string} version - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.version = ""; - - /** - * ClientLibrarySettings launchStage. - * @member {google.api.LaunchStage} launchStage - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.launchStage = 0; - - /** - * ClientLibrarySettings restNumericEnums. - * @member {boolean} restNumericEnums - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.restNumericEnums = false; - - /** - * ClientLibrarySettings javaSettings. - * @member {google.api.IJavaSettings|null|undefined} javaSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.javaSettings = null; - - /** - * ClientLibrarySettings cppSettings. - * @member {google.api.ICppSettings|null|undefined} cppSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.cppSettings = null; - - /** - * ClientLibrarySettings phpSettings. - * @member {google.api.IPhpSettings|null|undefined} phpSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.phpSettings = null; - - /** - * ClientLibrarySettings pythonSettings. - * @member {google.api.IPythonSettings|null|undefined} pythonSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.pythonSettings = null; - - /** - * ClientLibrarySettings nodeSettings. - * @member {google.api.INodeSettings|null|undefined} nodeSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.nodeSettings = null; - - /** - * ClientLibrarySettings dotnetSettings. - * @member {google.api.IDotnetSettings|null|undefined} dotnetSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.dotnetSettings = null; - - /** - * ClientLibrarySettings rubySettings. - * @member {google.api.IRubySettings|null|undefined} rubySettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.rubySettings = null; - - /** - * ClientLibrarySettings goSettings. - * @member {google.api.IGoSettings|null|undefined} goSettings - * @memberof google.api.ClientLibrarySettings - * @instance - */ - ClientLibrarySettings.prototype.goSettings = null; - - /** - * Creates a new ClientLibrarySettings instance using the specified properties. - * @function create - * @memberof google.api.ClientLibrarySettings - * @static - * @param {google.api.IClientLibrarySettings=} [properties] Properties to set - * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings instance - */ - ClientLibrarySettings.create = function create(properties) { - return new ClientLibrarySettings(properties); - }; - - /** - * Encodes the specified ClientLibrarySettings message. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. - * @function encode - * @memberof google.api.ClientLibrarySettings - * @static - * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientLibrarySettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.version != null && Object.hasOwnProperty.call(message, "version")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); - if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.launchStage); - if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.restNumericEnums); - if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) - $root.google.api.JavaSettings.encode(message.javaSettings, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) - $root.google.api.CppSettings.encode(message.cppSettings, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); - if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) - $root.google.api.PhpSettings.encode(message.phpSettings, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); - if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) - $root.google.api.PythonSettings.encode(message.pythonSettings, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); - if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) - $root.google.api.NodeSettings.encode(message.nodeSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); - if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) - $root.google.api.DotnetSettings.encode(message.dotnetSettings, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); - if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) - $root.google.api.RubySettings.encode(message.rubySettings, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); - if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) - $root.google.api.GoSettings.encode(message.goSettings, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ClientLibrarySettings message, length delimited. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.ClientLibrarySettings - * @static - * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ClientLibrarySettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ClientLibrarySettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.ClientLibrarySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientLibrarySettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ClientLibrarySettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.version = reader.string(); - break; - } - case 2: { - message.launchStage = reader.int32(); - break; - } - case 3: { - message.restNumericEnums = reader.bool(); - break; - } - case 21: { - message.javaSettings = $root.google.api.JavaSettings.decode(reader, reader.uint32()); - break; - } - case 22: { - message.cppSettings = $root.google.api.CppSettings.decode(reader, reader.uint32()); - break; - } - case 23: { - message.phpSettings = $root.google.api.PhpSettings.decode(reader, reader.uint32()); - break; - } - case 24: { - message.pythonSettings = $root.google.api.PythonSettings.decode(reader, reader.uint32()); - break; - } - case 25: { - message.nodeSettings = $root.google.api.NodeSettings.decode(reader, reader.uint32()); - break; - } - case 26: { - message.dotnetSettings = $root.google.api.DotnetSettings.decode(reader, reader.uint32()); - break; - } - case 27: { - message.rubySettings = $root.google.api.RubySettings.decode(reader, reader.uint32()); - break; - } - case 28: { - message.goSettings = $root.google.api.GoSettings.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ClientLibrarySettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.ClientLibrarySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ClientLibrarySettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ClientLibrarySettings message. - * @function verify - * @memberof google.api.ClientLibrarySettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ClientLibrarySettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.version != null && message.hasOwnProperty("version")) - if (!$util.isString(message.version)) - return "version: string expected"; - if (message.launchStage != null && message.hasOwnProperty("launchStage")) - switch (message.launchStage) { - default: - return "launchStage: enum value expected"; - case 0: - case 6: - case 7: - case 1: - case 2: - case 3: - case 4: - case 5: - break; - } - if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) - if (typeof message.restNumericEnums !== "boolean") - return "restNumericEnums: boolean expected"; - if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) { - var error = $root.google.api.JavaSettings.verify(message.javaSettings); - if (error) - return "javaSettings." + error; - } - if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) { - var error = $root.google.api.CppSettings.verify(message.cppSettings); - if (error) - return "cppSettings." + error; - } - if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) { - var error = $root.google.api.PhpSettings.verify(message.phpSettings); - if (error) - return "phpSettings." + error; - } - if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) { - var error = $root.google.api.PythonSettings.verify(message.pythonSettings); - if (error) - return "pythonSettings." + error; - } - if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) { - var error = $root.google.api.NodeSettings.verify(message.nodeSettings); - if (error) - return "nodeSettings." + error; - } - if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) { - var error = $root.google.api.DotnetSettings.verify(message.dotnetSettings); - if (error) - return "dotnetSettings." + error; - } - if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) { - var error = $root.google.api.RubySettings.verify(message.rubySettings); - if (error) - return "rubySettings." + error; - } - if (message.goSettings != null && message.hasOwnProperty("goSettings")) { - var error = $root.google.api.GoSettings.verify(message.goSettings); - if (error) - return "goSettings." + error; - } - return null; - }; - - /** - * Creates a ClientLibrarySettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.ClientLibrarySettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings - */ - ClientLibrarySettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ClientLibrarySettings) - return object; - var message = new $root.google.api.ClientLibrarySettings(); - if (object.version != null) - message.version = String(object.version); - switch (object.launchStage) { - default: - if (typeof object.launchStage === "number") { - message.launchStage = object.launchStage; - break; - } - break; - case "LAUNCH_STAGE_UNSPECIFIED": - case 0: - message.launchStage = 0; - break; - case "UNIMPLEMENTED": - case 6: - message.launchStage = 6; - break; - case "PRELAUNCH": - case 7: - message.launchStage = 7; - break; - case "EARLY_ACCESS": - case 1: - message.launchStage = 1; - break; - case "ALPHA": - case 2: - message.launchStage = 2; - break; - case "BETA": - case 3: - message.launchStage = 3; - break; - case "GA": - case 4: - message.launchStage = 4; - break; - case "DEPRECATED": - case 5: - message.launchStage = 5; - break; - } - if (object.restNumericEnums != null) - message.restNumericEnums = Boolean(object.restNumericEnums); - if (object.javaSettings != null) { - if (typeof object.javaSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.javaSettings: object expected"); - message.javaSettings = $root.google.api.JavaSettings.fromObject(object.javaSettings); - } - if (object.cppSettings != null) { - if (typeof object.cppSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.cppSettings: object expected"); - message.cppSettings = $root.google.api.CppSettings.fromObject(object.cppSettings); - } - if (object.phpSettings != null) { - if (typeof object.phpSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.phpSettings: object expected"); - message.phpSettings = $root.google.api.PhpSettings.fromObject(object.phpSettings); - } - if (object.pythonSettings != null) { - if (typeof object.pythonSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.pythonSettings: object expected"); - message.pythonSettings = $root.google.api.PythonSettings.fromObject(object.pythonSettings); - } - if (object.nodeSettings != null) { - if (typeof object.nodeSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.nodeSettings: object expected"); - message.nodeSettings = $root.google.api.NodeSettings.fromObject(object.nodeSettings); - } - if (object.dotnetSettings != null) { - if (typeof object.dotnetSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.dotnetSettings: object expected"); - message.dotnetSettings = $root.google.api.DotnetSettings.fromObject(object.dotnetSettings); - } - if (object.rubySettings != null) { - if (typeof object.rubySettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.rubySettings: object expected"); - message.rubySettings = $root.google.api.RubySettings.fromObject(object.rubySettings); - } - if (object.goSettings != null) { - if (typeof object.goSettings !== "object") - throw TypeError(".google.api.ClientLibrarySettings.goSettings: object expected"); - message.goSettings = $root.google.api.GoSettings.fromObject(object.goSettings); - } - return message; - }; - - /** - * Creates a plain object from a ClientLibrarySettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.ClientLibrarySettings - * @static - * @param {google.api.ClientLibrarySettings} message ClientLibrarySettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ClientLibrarySettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.version = ""; - object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; - object.restNumericEnums = false; - object.javaSettings = null; - object.cppSettings = null; - object.phpSettings = null; - object.pythonSettings = null; - object.nodeSettings = null; - object.dotnetSettings = null; - object.rubySettings = null; - object.goSettings = null; - } - if (message.version != null && message.hasOwnProperty("version")) - object.version = message.version; - if (message.launchStage != null && message.hasOwnProperty("launchStage")) - object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; - if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) - object.restNumericEnums = message.restNumericEnums; - if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) - object.javaSettings = $root.google.api.JavaSettings.toObject(message.javaSettings, options); - if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) - object.cppSettings = $root.google.api.CppSettings.toObject(message.cppSettings, options); - if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) - object.phpSettings = $root.google.api.PhpSettings.toObject(message.phpSettings, options); - if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) - object.pythonSettings = $root.google.api.PythonSettings.toObject(message.pythonSettings, options); - if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) - object.nodeSettings = $root.google.api.NodeSettings.toObject(message.nodeSettings, options); - if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) - object.dotnetSettings = $root.google.api.DotnetSettings.toObject(message.dotnetSettings, options); - if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) - object.rubySettings = $root.google.api.RubySettings.toObject(message.rubySettings, options); - if (message.goSettings != null && message.hasOwnProperty("goSettings")) - object.goSettings = $root.google.api.GoSettings.toObject(message.goSettings, options); - return object; - }; - - /** - * Converts this ClientLibrarySettings to JSON. - * @function toJSON - * @memberof google.api.ClientLibrarySettings - * @instance - * @returns {Object.} JSON object - */ - ClientLibrarySettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ClientLibrarySettings - * @function getTypeUrl - * @memberof google.api.ClientLibrarySettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ClientLibrarySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.ClientLibrarySettings"; - }; - - return ClientLibrarySettings; - })(); - - api.Publishing = (function() { - - /** - * Properties of a Publishing. - * @memberof google.api - * @interface IPublishing - * @property {Array.|null} [methodSettings] Publishing methodSettings - * @property {string|null} [newIssueUri] Publishing newIssueUri - * @property {string|null} [documentationUri] Publishing documentationUri - * @property {string|null} [apiShortName] Publishing apiShortName - * @property {string|null} [githubLabel] Publishing githubLabel - * @property {Array.|null} [codeownerGithubTeams] Publishing codeownerGithubTeams - * @property {string|null} [docTagPrefix] Publishing docTagPrefix - * @property {google.api.ClientLibraryOrganization|null} [organization] Publishing organization - * @property {Array.|null} [librarySettings] Publishing librarySettings - * @property {string|null} [protoReferenceDocumentationUri] Publishing protoReferenceDocumentationUri - * @property {string|null} [restReferenceDocumentationUri] Publishing restReferenceDocumentationUri - */ - - /** - * Constructs a new Publishing. - * @memberof google.api - * @classdesc Represents a Publishing. - * @implements IPublishing - * @constructor - * @param {google.api.IPublishing=} [properties] Properties to set - */ - function Publishing(properties) { - this.methodSettings = []; - this.codeownerGithubTeams = []; - this.librarySettings = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Publishing methodSettings. - * @member {Array.} methodSettings - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.methodSettings = $util.emptyArray; - - /** - * Publishing newIssueUri. - * @member {string} newIssueUri - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.newIssueUri = ""; - - /** - * Publishing documentationUri. - * @member {string} documentationUri - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.documentationUri = ""; - - /** - * Publishing apiShortName. - * @member {string} apiShortName - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.apiShortName = ""; - - /** - * Publishing githubLabel. - * @member {string} githubLabel - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.githubLabel = ""; - - /** - * Publishing codeownerGithubTeams. - * @member {Array.} codeownerGithubTeams - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.codeownerGithubTeams = $util.emptyArray; - - /** - * Publishing docTagPrefix. - * @member {string} docTagPrefix - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.docTagPrefix = ""; - - /** - * Publishing organization. - * @member {google.api.ClientLibraryOrganization} organization - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.organization = 0; - - /** - * Publishing librarySettings. - * @member {Array.} librarySettings - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.librarySettings = $util.emptyArray; - - /** - * Publishing protoReferenceDocumentationUri. - * @member {string} protoReferenceDocumentationUri - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.protoReferenceDocumentationUri = ""; - - /** - * Publishing restReferenceDocumentationUri. - * @member {string} restReferenceDocumentationUri - * @memberof google.api.Publishing - * @instance - */ - Publishing.prototype.restReferenceDocumentationUri = ""; - - /** - * Creates a new Publishing instance using the specified properties. - * @function create - * @memberof google.api.Publishing - * @static - * @param {google.api.IPublishing=} [properties] Properties to set - * @returns {google.api.Publishing} Publishing instance - */ - Publishing.create = function create(properties) { - return new Publishing(properties); - }; - - /** - * Encodes the specified Publishing message. Does not implicitly {@link google.api.Publishing.verify|verify} messages. - * @function encode - * @memberof google.api.Publishing - * @static - * @param {google.api.IPublishing} message Publishing message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Publishing.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.methodSettings != null && message.methodSettings.length) - for (var i = 0; i < message.methodSettings.length; ++i) - $root.google.api.MethodSettings.encode(message.methodSettings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) - writer.uint32(/* id 101, wireType 2 =*/810).string(message.newIssueUri); - if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) - writer.uint32(/* id 102, wireType 2 =*/818).string(message.documentationUri); - if (message.apiShortName != null && Object.hasOwnProperty.call(message, "apiShortName")) - writer.uint32(/* id 103, wireType 2 =*/826).string(message.apiShortName); - if (message.githubLabel != null && Object.hasOwnProperty.call(message, "githubLabel")) - writer.uint32(/* id 104, wireType 2 =*/834).string(message.githubLabel); - if (message.codeownerGithubTeams != null && message.codeownerGithubTeams.length) - for (var i = 0; i < message.codeownerGithubTeams.length; ++i) - writer.uint32(/* id 105, wireType 2 =*/842).string(message.codeownerGithubTeams[i]); - if (message.docTagPrefix != null && Object.hasOwnProperty.call(message, "docTagPrefix")) - writer.uint32(/* id 106, wireType 2 =*/850).string(message.docTagPrefix); - if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) - writer.uint32(/* id 107, wireType 0 =*/856).int32(message.organization); - if (message.librarySettings != null && message.librarySettings.length) - for (var i = 0; i < message.librarySettings.length; ++i) - $root.google.api.ClientLibrarySettings.encode(message.librarySettings[i], writer.uint32(/* id 109, wireType 2 =*/874).fork()).ldelim(); - if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) - writer.uint32(/* id 110, wireType 2 =*/882).string(message.protoReferenceDocumentationUri); - if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) - writer.uint32(/* id 111, wireType 2 =*/890).string(message.restReferenceDocumentationUri); - return writer; - }; - - /** - * Encodes the specified Publishing message, length delimited. Does not implicitly {@link google.api.Publishing.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.Publishing - * @static - * @param {google.api.IPublishing} message Publishing message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Publishing.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Publishing message from the specified reader or buffer. - * @function decode - * @memberof google.api.Publishing - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.Publishing} Publishing - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Publishing.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Publishing(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 2: { - if (!(message.methodSettings && message.methodSettings.length)) - message.methodSettings = []; - message.methodSettings.push($root.google.api.MethodSettings.decode(reader, reader.uint32())); - break; - } - case 101: { - message.newIssueUri = reader.string(); - break; - } - case 102: { - message.documentationUri = reader.string(); - break; - } - case 103: { - message.apiShortName = reader.string(); - break; - } - case 104: { - message.githubLabel = reader.string(); - break; - } - case 105: { - if (!(message.codeownerGithubTeams && message.codeownerGithubTeams.length)) - message.codeownerGithubTeams = []; - message.codeownerGithubTeams.push(reader.string()); - break; - } - case 106: { - message.docTagPrefix = reader.string(); - break; - } - case 107: { - message.organization = reader.int32(); - break; - } - case 109: { - if (!(message.librarySettings && message.librarySettings.length)) - message.librarySettings = []; - message.librarySettings.push($root.google.api.ClientLibrarySettings.decode(reader, reader.uint32())); - break; - } - case 110: { - message.protoReferenceDocumentationUri = reader.string(); - break; - } - case 111: { - message.restReferenceDocumentationUri = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Publishing message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.Publishing - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.Publishing} Publishing - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Publishing.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Publishing message. - * @function verify - * @memberof google.api.Publishing - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Publishing.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.methodSettings != null && message.hasOwnProperty("methodSettings")) { - if (!Array.isArray(message.methodSettings)) - return "methodSettings: array expected"; - for (var i = 0; i < message.methodSettings.length; ++i) { - var error = $root.google.api.MethodSettings.verify(message.methodSettings[i]); - if (error) - return "methodSettings." + error; - } - } - if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) - if (!$util.isString(message.newIssueUri)) - return "newIssueUri: string expected"; - if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) - if (!$util.isString(message.documentationUri)) - return "documentationUri: string expected"; - if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) - if (!$util.isString(message.apiShortName)) - return "apiShortName: string expected"; - if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) - if (!$util.isString(message.githubLabel)) - return "githubLabel: string expected"; - if (message.codeownerGithubTeams != null && message.hasOwnProperty("codeownerGithubTeams")) { - if (!Array.isArray(message.codeownerGithubTeams)) - return "codeownerGithubTeams: array expected"; - for (var i = 0; i < message.codeownerGithubTeams.length; ++i) - if (!$util.isString(message.codeownerGithubTeams[i])) - return "codeownerGithubTeams: string[] expected"; - } - if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) - if (!$util.isString(message.docTagPrefix)) - return "docTagPrefix: string expected"; - if (message.organization != null && message.hasOwnProperty("organization")) - switch (message.organization) { - default: - return "organization: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - break; - } - if (message.librarySettings != null && message.hasOwnProperty("librarySettings")) { - if (!Array.isArray(message.librarySettings)) - return "librarySettings: array expected"; - for (var i = 0; i < message.librarySettings.length; ++i) { - var error = $root.google.api.ClientLibrarySettings.verify(message.librarySettings[i]); - if (error) - return "librarySettings." + error; - } - } - if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) - if (!$util.isString(message.protoReferenceDocumentationUri)) - return "protoReferenceDocumentationUri: string expected"; - if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) - if (!$util.isString(message.restReferenceDocumentationUri)) - return "restReferenceDocumentationUri: string expected"; - return null; - }; - - /** - * Creates a Publishing message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.Publishing - * @static - * @param {Object.} object Plain object - * @returns {google.api.Publishing} Publishing - */ - Publishing.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.Publishing) - return object; - var message = new $root.google.api.Publishing(); - if (object.methodSettings) { - if (!Array.isArray(object.methodSettings)) - throw TypeError(".google.api.Publishing.methodSettings: array expected"); - message.methodSettings = []; - for (var i = 0; i < object.methodSettings.length; ++i) { - if (typeof object.methodSettings[i] !== "object") - throw TypeError(".google.api.Publishing.methodSettings: object expected"); - message.methodSettings[i] = $root.google.api.MethodSettings.fromObject(object.methodSettings[i]); - } - } - if (object.newIssueUri != null) - message.newIssueUri = String(object.newIssueUri); - if (object.documentationUri != null) - message.documentationUri = String(object.documentationUri); - if (object.apiShortName != null) - message.apiShortName = String(object.apiShortName); - if (object.githubLabel != null) - message.githubLabel = String(object.githubLabel); - if (object.codeownerGithubTeams) { - if (!Array.isArray(object.codeownerGithubTeams)) - throw TypeError(".google.api.Publishing.codeownerGithubTeams: array expected"); - message.codeownerGithubTeams = []; - for (var i = 0; i < object.codeownerGithubTeams.length; ++i) - message.codeownerGithubTeams[i] = String(object.codeownerGithubTeams[i]); - } - if (object.docTagPrefix != null) - message.docTagPrefix = String(object.docTagPrefix); - switch (object.organization) { - default: - if (typeof object.organization === "number") { - message.organization = object.organization; - break; - } - break; - case "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": - case 0: - message.organization = 0; - break; - case "CLOUD": - case 1: - message.organization = 1; - break; - case "ADS": - case 2: - message.organization = 2; - break; - case "PHOTOS": - case 3: - message.organization = 3; - break; - case "STREET_VIEW": - case 4: - message.organization = 4; - break; - case "SHOPPING": - case 5: - message.organization = 5; - break; - case "GEO": - case 6: - message.organization = 6; - break; - case "GENERATIVE_AI": - case 7: - message.organization = 7; - break; - } - if (object.librarySettings) { - if (!Array.isArray(object.librarySettings)) - throw TypeError(".google.api.Publishing.librarySettings: array expected"); - message.librarySettings = []; - for (var i = 0; i < object.librarySettings.length; ++i) { - if (typeof object.librarySettings[i] !== "object") - throw TypeError(".google.api.Publishing.librarySettings: object expected"); - message.librarySettings[i] = $root.google.api.ClientLibrarySettings.fromObject(object.librarySettings[i]); - } - } - if (object.protoReferenceDocumentationUri != null) - message.protoReferenceDocumentationUri = String(object.protoReferenceDocumentationUri); - if (object.restReferenceDocumentationUri != null) - message.restReferenceDocumentationUri = String(object.restReferenceDocumentationUri); - return message; - }; - - /** - * Creates a plain object from a Publishing message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.Publishing - * @static - * @param {google.api.Publishing} message Publishing - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Publishing.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.methodSettings = []; - object.codeownerGithubTeams = []; - object.librarySettings = []; - } - if (options.defaults) { - object.newIssueUri = ""; - object.documentationUri = ""; - object.apiShortName = ""; - object.githubLabel = ""; - object.docTagPrefix = ""; - object.organization = options.enums === String ? "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" : 0; - object.protoReferenceDocumentationUri = ""; - object.restReferenceDocumentationUri = ""; - } - if (message.methodSettings && message.methodSettings.length) { - object.methodSettings = []; - for (var j = 0; j < message.methodSettings.length; ++j) - object.methodSettings[j] = $root.google.api.MethodSettings.toObject(message.methodSettings[j], options); - } - if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) - object.newIssueUri = message.newIssueUri; - if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) - object.documentationUri = message.documentationUri; - if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) - object.apiShortName = message.apiShortName; - if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) - object.githubLabel = message.githubLabel; - if (message.codeownerGithubTeams && message.codeownerGithubTeams.length) { - object.codeownerGithubTeams = []; - for (var j = 0; j < message.codeownerGithubTeams.length; ++j) - object.codeownerGithubTeams[j] = message.codeownerGithubTeams[j]; - } - if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) - object.docTagPrefix = message.docTagPrefix; - if (message.organization != null && message.hasOwnProperty("organization")) - object.organization = options.enums === String ? $root.google.api.ClientLibraryOrganization[message.organization] === undefined ? message.organization : $root.google.api.ClientLibraryOrganization[message.organization] : message.organization; - if (message.librarySettings && message.librarySettings.length) { - object.librarySettings = []; - for (var j = 0; j < message.librarySettings.length; ++j) - object.librarySettings[j] = $root.google.api.ClientLibrarySettings.toObject(message.librarySettings[j], options); - } - if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) - object.protoReferenceDocumentationUri = message.protoReferenceDocumentationUri; - if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) - object.restReferenceDocumentationUri = message.restReferenceDocumentationUri; - return object; - }; - - /** - * Converts this Publishing to JSON. - * @function toJSON - * @memberof google.api.Publishing - * @instance - * @returns {Object.} JSON object - */ - Publishing.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Publishing - * @function getTypeUrl - * @memberof google.api.Publishing - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Publishing.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.Publishing"; - }; - - return Publishing; - })(); - - api.JavaSettings = (function() { - - /** - * Properties of a JavaSettings. - * @memberof google.api - * @interface IJavaSettings - * @property {string|null} [libraryPackage] JavaSettings libraryPackage - * @property {Object.|null} [serviceClassNames] JavaSettings serviceClassNames - * @property {google.api.ICommonLanguageSettings|null} [common] JavaSettings common - */ - - /** - * Constructs a new JavaSettings. - * @memberof google.api - * @classdesc Represents a JavaSettings. - * @implements IJavaSettings - * @constructor - * @param {google.api.IJavaSettings=} [properties] Properties to set - */ - function JavaSettings(properties) { - this.serviceClassNames = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * JavaSettings libraryPackage. - * @member {string} libraryPackage - * @memberof google.api.JavaSettings - * @instance - */ - JavaSettings.prototype.libraryPackage = ""; - - /** - * JavaSettings serviceClassNames. - * @member {Object.} serviceClassNames - * @memberof google.api.JavaSettings - * @instance - */ - JavaSettings.prototype.serviceClassNames = $util.emptyObject; - - /** - * JavaSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.JavaSettings - * @instance - */ - JavaSettings.prototype.common = null; - - /** - * Creates a new JavaSettings instance using the specified properties. - * @function create - * @memberof google.api.JavaSettings - * @static - * @param {google.api.IJavaSettings=} [properties] Properties to set - * @returns {google.api.JavaSettings} JavaSettings instance - */ - JavaSettings.create = function create(properties) { - return new JavaSettings(properties); - }; - - /** - * Encodes the specified JavaSettings message. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. - * @function encode - * @memberof google.api.JavaSettings - * @static - * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - JavaSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.libraryPackage); - if (message.serviceClassNames != null && Object.hasOwnProperty.call(message, "serviceClassNames")) - for (var keys = Object.keys(message.serviceClassNames), i = 0; i < keys.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.serviceClassNames[keys[i]]).ldelim(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified JavaSettings message, length delimited. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.JavaSettings - * @static - * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - JavaSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a JavaSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.JavaSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.JavaSettings} JavaSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - JavaSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.JavaSettings(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.libraryPackage = reader.string(); - break; - } - case 2: { - if (message.serviceClassNames === $util.emptyObject) - message.serviceClassNames = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.serviceClassNames[key] = value; - break; - } - case 3: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a JavaSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.JavaSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.JavaSettings} JavaSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - JavaSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a JavaSettings message. - * @function verify - * @memberof google.api.JavaSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - JavaSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) - if (!$util.isString(message.libraryPackage)) - return "libraryPackage: string expected"; - if (message.serviceClassNames != null && message.hasOwnProperty("serviceClassNames")) { - if (!$util.isObject(message.serviceClassNames)) - return "serviceClassNames: object expected"; - var key = Object.keys(message.serviceClassNames); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.serviceClassNames[key[i]])) - return "serviceClassNames: string{k:string} expected"; - } - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; - - /** - * Creates a JavaSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.JavaSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.JavaSettings} JavaSettings - */ - JavaSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.JavaSettings) - return object; - var message = new $root.google.api.JavaSettings(); - if (object.libraryPackage != null) - message.libraryPackage = String(object.libraryPackage); - if (object.serviceClassNames) { - if (typeof object.serviceClassNames !== "object") - throw TypeError(".google.api.JavaSettings.serviceClassNames: object expected"); - message.serviceClassNames = {}; - for (var keys = Object.keys(object.serviceClassNames), i = 0; i < keys.length; ++i) - message.serviceClassNames[keys[i]] = String(object.serviceClassNames[keys[i]]); - } - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.JavaSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; - - /** - * Creates a plain object from a JavaSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.JavaSettings - * @static - * @param {google.api.JavaSettings} message JavaSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - JavaSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.serviceClassNames = {}; - if (options.defaults) { - object.libraryPackage = ""; - object.common = null; - } - if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) - object.libraryPackage = message.libraryPackage; - var keys2; - if (message.serviceClassNames && (keys2 = Object.keys(message.serviceClassNames)).length) { - object.serviceClassNames = {}; - for (var j = 0; j < keys2.length; ++j) - object.serviceClassNames[keys2[j]] = message.serviceClassNames[keys2[j]]; - } - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; - - /** - * Converts this JavaSettings to JSON. - * @function toJSON - * @memberof google.api.JavaSettings - * @instance - * @returns {Object.} JSON object - */ - JavaSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for JavaSettings - * @function getTypeUrl - * @memberof google.api.JavaSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - JavaSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.JavaSettings"; - }; - - return JavaSettings; - })(); - - api.CppSettings = (function() { - - /** - * Properties of a CppSettings. - * @memberof google.api - * @interface ICppSettings - * @property {google.api.ICommonLanguageSettings|null} [common] CppSettings common - */ - - /** - * Constructs a new CppSettings. - * @memberof google.api - * @classdesc Represents a CppSettings. - * @implements ICppSettings - * @constructor - * @param {google.api.ICppSettings=} [properties] Properties to set - */ - function CppSettings(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * CppSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.CppSettings - * @instance - */ - CppSettings.prototype.common = null; - - /** - * Creates a new CppSettings instance using the specified properties. - * @function create - * @memberof google.api.CppSettings - * @static - * @param {google.api.ICppSettings=} [properties] Properties to set - * @returns {google.api.CppSettings} CppSettings instance - */ - CppSettings.create = function create(properties) { - return new CppSettings(properties); - }; - - /** - * Encodes the specified CppSettings message. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. - * @function encode - * @memberof google.api.CppSettings - * @static - * @param {google.api.ICppSettings} message CppSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CppSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified CppSettings message, length delimited. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.CppSettings - * @static - * @param {google.api.ICppSettings} message CppSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - CppSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a CppSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.CppSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.CppSettings} CppSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CppSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CppSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a CppSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.CppSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.CppSettings} CppSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - CppSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a CppSettings message. - * @function verify - * @memberof google.api.CppSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - CppSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; - - /** - * Creates a CppSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.CppSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.CppSettings} CppSettings - */ - CppSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.CppSettings) - return object; - var message = new $root.google.api.CppSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.CppSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; - - /** - * Creates a plain object from a CppSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.CppSettings - * @static - * @param {google.api.CppSettings} message CppSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - CppSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; - - /** - * Converts this CppSettings to JSON. - * @function toJSON - * @memberof google.api.CppSettings - * @instance - * @returns {Object.} JSON object - */ - CppSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for CppSettings - * @function getTypeUrl - * @memberof google.api.CppSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - CppSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.CppSettings"; - }; - - return CppSettings; - })(); - - api.PhpSettings = (function() { - - /** - * Properties of a PhpSettings. - * @memberof google.api - * @interface IPhpSettings - * @property {google.api.ICommonLanguageSettings|null} [common] PhpSettings common - */ - - /** - * Constructs a new PhpSettings. - * @memberof google.api - * @classdesc Represents a PhpSettings. - * @implements IPhpSettings - * @constructor - * @param {google.api.IPhpSettings=} [properties] Properties to set - */ - function PhpSettings(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PhpSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.PhpSettings - * @instance - */ - PhpSettings.prototype.common = null; - - /** - * Creates a new PhpSettings instance using the specified properties. - * @function create - * @memberof google.api.PhpSettings - * @static - * @param {google.api.IPhpSettings=} [properties] Properties to set - * @returns {google.api.PhpSettings} PhpSettings instance - */ - PhpSettings.create = function create(properties) { - return new PhpSettings(properties); - }; - - /** - * Encodes the specified PhpSettings message. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. - * @function encode - * @memberof google.api.PhpSettings - * @static - * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PhpSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PhpSettings message, length delimited. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.PhpSettings - * @static - * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PhpSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PhpSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.PhpSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.PhpSettings} PhpSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PhpSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PhpSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PhpSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.PhpSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.PhpSettings} PhpSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PhpSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PhpSettings message. - * @function verify - * @memberof google.api.PhpSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PhpSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; - - /** - * Creates a PhpSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.PhpSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.PhpSettings} PhpSettings - */ - PhpSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.PhpSettings) - return object; - var message = new $root.google.api.PhpSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.PhpSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; - - /** - * Creates a plain object from a PhpSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.PhpSettings - * @static - * @param {google.api.PhpSettings} message PhpSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PhpSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; - - /** - * Converts this PhpSettings to JSON. - * @function toJSON - * @memberof google.api.PhpSettings - * @instance - * @returns {Object.} JSON object - */ - PhpSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PhpSettings - * @function getTypeUrl - * @memberof google.api.PhpSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PhpSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.PhpSettings"; - }; - - return PhpSettings; - })(); - - api.PythonSettings = (function() { - - /** - * Properties of a PythonSettings. - * @memberof google.api - * @interface IPythonSettings - * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common - * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures - */ - - /** - * Constructs a new PythonSettings. - * @memberof google.api - * @classdesc Represents a PythonSettings. - * @implements IPythonSettings - * @constructor - * @param {google.api.IPythonSettings=} [properties] Properties to set - */ - function PythonSettings(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * PythonSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.PythonSettings - * @instance - */ - PythonSettings.prototype.common = null; - - /** - * PythonSettings experimentalFeatures. - * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures - * @memberof google.api.PythonSettings - * @instance - */ - PythonSettings.prototype.experimentalFeatures = null; - - /** - * Creates a new PythonSettings instance using the specified properties. - * @function create - * @memberof google.api.PythonSettings - * @static - * @param {google.api.IPythonSettings=} [properties] Properties to set - * @returns {google.api.PythonSettings} PythonSettings instance - */ - PythonSettings.create = function create(properties) { - return new PythonSettings(properties); - }; - - /** - * Encodes the specified PythonSettings message. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. - * @function encode - * @memberof google.api.PythonSettings - * @static - * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PythonSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) - $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified PythonSettings message, length delimited. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.PythonSettings - * @static - * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - PythonSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a PythonSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.PythonSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.PythonSettings} PythonSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PythonSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - case 2: { - message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a PythonSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.PythonSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.PythonSettings} PythonSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - PythonSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a PythonSettings message. - * @function verify - * @memberof google.api.PythonSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - PythonSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { - var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); - if (error) - return "experimentalFeatures." + error; - } - return null; - }; - - /** - * Creates a PythonSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.PythonSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.PythonSettings} PythonSettings - */ - PythonSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.PythonSettings) - return object; - var message = new $root.google.api.PythonSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.PythonSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - if (object.experimentalFeatures != null) { - if (typeof object.experimentalFeatures !== "object") - throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); - message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); - } - return message; - }; - - /** - * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.PythonSettings - * @static - * @param {google.api.PythonSettings} message PythonSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - PythonSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.common = null; - object.experimentalFeatures = null; - } - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) - object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); - return object; - }; - - /** - * Converts this PythonSettings to JSON. - * @function toJSON - * @memberof google.api.PythonSettings - * @instance - * @returns {Object.} JSON object - */ - PythonSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for PythonSettings - * @function getTypeUrl - * @memberof google.api.PythonSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - PythonSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.PythonSettings"; - }; - - PythonSettings.ExperimentalFeatures = (function() { - - /** - * Properties of an ExperimentalFeatures. - * @memberof google.api.PythonSettings - * @interface IExperimentalFeatures - * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled - * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled - * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled - */ - - /** - * Constructs a new ExperimentalFeatures. - * @memberof google.api.PythonSettings - * @classdesc Represents an ExperimentalFeatures. - * @implements IExperimentalFeatures - * @constructor - * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set - */ - function ExperimentalFeatures(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExperimentalFeatures restAsyncIoEnabled. - * @member {boolean} restAsyncIoEnabled - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @instance - */ - ExperimentalFeatures.prototype.restAsyncIoEnabled = false; - - /** - * ExperimentalFeatures protobufPythonicTypesEnabled. - * @member {boolean} protobufPythonicTypesEnabled - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @instance - */ - ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; - - /** - * ExperimentalFeatures unversionedPackageDisabled. - * @member {boolean} unversionedPackageDisabled - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @instance - */ - ExperimentalFeatures.prototype.unversionedPackageDisabled = false; - - /** - * Creates a new ExperimentalFeatures instance using the specified properties. - * @function create - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @static - * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set - * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance - */ - ExperimentalFeatures.create = function create(properties) { - return new ExperimentalFeatures(properties); - }; - - /** - * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. - * @function encode - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @static - * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExperimentalFeatures.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); - if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); - if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); - return writer; - }; - - /** - * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @static - * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExperimentalFeatures message from the specified reader or buffer. - * @function decode - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExperimentalFeatures.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.restAsyncIoEnabled = reader.bool(); - break; - } - case 2: { - message.protobufPythonicTypesEnabled = reader.bool(); - break; - } - case 3: { - message.unversionedPackageDisabled = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExperimentalFeatures message. - * @function verify - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExperimentalFeatures.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) - if (typeof message.restAsyncIoEnabled !== "boolean") - return "restAsyncIoEnabled: boolean expected"; - if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) - if (typeof message.protobufPythonicTypesEnabled !== "boolean") - return "protobufPythonicTypesEnabled: boolean expected"; - if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) - if (typeof message.unversionedPackageDisabled !== "boolean") - return "unversionedPackageDisabled: boolean expected"; - return null; - }; - - /** - * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @static - * @param {Object.} object Plain object - * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures - */ - ExperimentalFeatures.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) - return object; - var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); - if (object.restAsyncIoEnabled != null) - message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); - if (object.protobufPythonicTypesEnabled != null) - message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); - if (object.unversionedPackageDisabled != null) - message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); - return message; - }; - - /** - * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @static - * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExperimentalFeatures.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.restAsyncIoEnabled = false; - object.protobufPythonicTypesEnabled = false; - object.unversionedPackageDisabled = false; - } - if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) - object.restAsyncIoEnabled = message.restAsyncIoEnabled; - if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) - object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; - if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) - object.unversionedPackageDisabled = message.unversionedPackageDisabled; - return object; - }; - - /** - * Converts this ExperimentalFeatures to JSON. - * @function toJSON - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @instance - * @returns {Object.} JSON object - */ - ExperimentalFeatures.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExperimentalFeatures - * @function getTypeUrl - * @memberof google.api.PythonSettings.ExperimentalFeatures - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; - }; - - return ExperimentalFeatures; - })(); - - return PythonSettings; - })(); - - api.NodeSettings = (function() { - - /** - * Properties of a NodeSettings. - * @memberof google.api - * @interface INodeSettings - * @property {google.api.ICommonLanguageSettings|null} [common] NodeSettings common - */ - - /** - * Constructs a new NodeSettings. - * @memberof google.api - * @classdesc Represents a NodeSettings. - * @implements INodeSettings - * @constructor - * @param {google.api.INodeSettings=} [properties] Properties to set - */ - function NodeSettings(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * NodeSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.NodeSettings - * @instance - */ - NodeSettings.prototype.common = null; - - /** - * Creates a new NodeSettings instance using the specified properties. - * @function create - * @memberof google.api.NodeSettings - * @static - * @param {google.api.INodeSettings=} [properties] Properties to set - * @returns {google.api.NodeSettings} NodeSettings instance - */ - NodeSettings.create = function create(properties) { - return new NodeSettings(properties); - }; - - /** - * Encodes the specified NodeSettings message. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. - * @function encode - * @memberof google.api.NodeSettings - * @static - * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NodeSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified NodeSettings message, length delimited. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.NodeSettings - * @static - * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NodeSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NodeSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.NodeSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.NodeSettings} NodeSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NodeSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.NodeSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a NodeSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.NodeSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.NodeSettings} NodeSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NodeSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NodeSettings message. - * @function verify - * @memberof google.api.NodeSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NodeSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; - - /** - * Creates a NodeSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.NodeSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.NodeSettings} NodeSettings - */ - NodeSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.NodeSettings) - return object; - var message = new $root.google.api.NodeSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.NodeSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; - - /** - * Creates a plain object from a NodeSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.NodeSettings - * @static - * @param {google.api.NodeSettings} message NodeSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NodeSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; - - /** - * Converts this NodeSettings to JSON. - * @function toJSON - * @memberof google.api.NodeSettings - * @instance - * @returns {Object.} JSON object - */ - NodeSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for NodeSettings - * @function getTypeUrl - * @memberof google.api.NodeSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NodeSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.NodeSettings"; - }; - - return NodeSettings; - })(); - - api.DotnetSettings = (function() { - - /** - * Properties of a DotnetSettings. - * @memberof google.api - * @interface IDotnetSettings - * @property {google.api.ICommonLanguageSettings|null} [common] DotnetSettings common - * @property {Object.|null} [renamedServices] DotnetSettings renamedServices - * @property {Object.|null} [renamedResources] DotnetSettings renamedResources - * @property {Array.|null} [ignoredResources] DotnetSettings ignoredResources - * @property {Array.|null} [forcedNamespaceAliases] DotnetSettings forcedNamespaceAliases - * @property {Array.|null} [handwrittenSignatures] DotnetSettings handwrittenSignatures - */ - - /** - * Constructs a new DotnetSettings. - * @memberof google.api - * @classdesc Represents a DotnetSettings. - * @implements IDotnetSettings - * @constructor - * @param {google.api.IDotnetSettings=} [properties] Properties to set - */ - function DotnetSettings(properties) { - this.renamedServices = {}; - this.renamedResources = {}; - this.ignoredResources = []; - this.forcedNamespaceAliases = []; - this.handwrittenSignatures = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DotnetSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.common = null; - - /** - * DotnetSettings renamedServices. - * @member {Object.} renamedServices - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.renamedServices = $util.emptyObject; - - /** - * DotnetSettings renamedResources. - * @member {Object.} renamedResources - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.renamedResources = $util.emptyObject; - - /** - * DotnetSettings ignoredResources. - * @member {Array.} ignoredResources - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.ignoredResources = $util.emptyArray; - - /** - * DotnetSettings forcedNamespaceAliases. - * @member {Array.} forcedNamespaceAliases - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.forcedNamespaceAliases = $util.emptyArray; - - /** - * DotnetSettings handwrittenSignatures. - * @member {Array.} handwrittenSignatures - * @memberof google.api.DotnetSettings - * @instance - */ - DotnetSettings.prototype.handwrittenSignatures = $util.emptyArray; - - /** - * Creates a new DotnetSettings instance using the specified properties. - * @function create - * @memberof google.api.DotnetSettings - * @static - * @param {google.api.IDotnetSettings=} [properties] Properties to set - * @returns {google.api.DotnetSettings} DotnetSettings instance - */ - DotnetSettings.create = function create(properties) { - return new DotnetSettings(properties); - }; - - /** - * Encodes the specified DotnetSettings message. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. - * @function encode - * @memberof google.api.DotnetSettings - * @static - * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DotnetSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) - for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); - if (message.renamedResources != null && Object.hasOwnProperty.call(message, "renamedResources")) - for (var keys = Object.keys(message.renamedResources), i = 0; i < keys.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedResources[keys[i]]).ldelim(); - if (message.ignoredResources != null && message.ignoredResources.length) - for (var i = 0; i < message.ignoredResources.length; ++i) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.ignoredResources[i]); - if (message.forcedNamespaceAliases != null && message.forcedNamespaceAliases.length) - for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.forcedNamespaceAliases[i]); - if (message.handwrittenSignatures != null && message.handwrittenSignatures.length) - for (var i = 0; i < message.handwrittenSignatures.length; ++i) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.handwrittenSignatures[i]); - return writer; - }; - - /** - * Encodes the specified DotnetSettings message, length delimited. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.DotnetSettings - * @static - * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DotnetSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DotnetSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.DotnetSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.DotnetSettings} DotnetSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DotnetSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.DotnetSettings(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - case 2: { - if (message.renamedServices === $util.emptyObject) - message.renamedServices = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.renamedServices[key] = value; - break; - } - case 3: { - if (message.renamedResources === $util.emptyObject) - message.renamedResources = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.renamedResources[key] = value; - break; - } - case 4: { - if (!(message.ignoredResources && message.ignoredResources.length)) - message.ignoredResources = []; - message.ignoredResources.push(reader.string()); - break; - } - case 5: { - if (!(message.forcedNamespaceAliases && message.forcedNamespaceAliases.length)) - message.forcedNamespaceAliases = []; - message.forcedNamespaceAliases.push(reader.string()); - break; - } - case 6: { - if (!(message.handwrittenSignatures && message.handwrittenSignatures.length)) - message.handwrittenSignatures = []; - message.handwrittenSignatures.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DotnetSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.DotnetSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.DotnetSettings} DotnetSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DotnetSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DotnetSettings message. - * @function verify - * @memberof google.api.DotnetSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DotnetSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { - if (!$util.isObject(message.renamedServices)) - return "renamedServices: object expected"; - var key = Object.keys(message.renamedServices); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.renamedServices[key[i]])) - return "renamedServices: string{k:string} expected"; - } - if (message.renamedResources != null && message.hasOwnProperty("renamedResources")) { - if (!$util.isObject(message.renamedResources)) - return "renamedResources: object expected"; - var key = Object.keys(message.renamedResources); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.renamedResources[key[i]])) - return "renamedResources: string{k:string} expected"; - } - if (message.ignoredResources != null && message.hasOwnProperty("ignoredResources")) { - if (!Array.isArray(message.ignoredResources)) - return "ignoredResources: array expected"; - for (var i = 0; i < message.ignoredResources.length; ++i) - if (!$util.isString(message.ignoredResources[i])) - return "ignoredResources: string[] expected"; - } - if (message.forcedNamespaceAliases != null && message.hasOwnProperty("forcedNamespaceAliases")) { - if (!Array.isArray(message.forcedNamespaceAliases)) - return "forcedNamespaceAliases: array expected"; - for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) - if (!$util.isString(message.forcedNamespaceAliases[i])) - return "forcedNamespaceAliases: string[] expected"; - } - if (message.handwrittenSignatures != null && message.hasOwnProperty("handwrittenSignatures")) { - if (!Array.isArray(message.handwrittenSignatures)) - return "handwrittenSignatures: array expected"; - for (var i = 0; i < message.handwrittenSignatures.length; ++i) - if (!$util.isString(message.handwrittenSignatures[i])) - return "handwrittenSignatures: string[] expected"; - } - return null; - }; - - /** - * Creates a DotnetSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.DotnetSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.DotnetSettings} DotnetSettings - */ - DotnetSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.DotnetSettings) - return object; - var message = new $root.google.api.DotnetSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.DotnetSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - if (object.renamedServices) { - if (typeof object.renamedServices !== "object") - throw TypeError(".google.api.DotnetSettings.renamedServices: object expected"); - message.renamedServices = {}; - for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) - message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); - } - if (object.renamedResources) { - if (typeof object.renamedResources !== "object") - throw TypeError(".google.api.DotnetSettings.renamedResources: object expected"); - message.renamedResources = {}; - for (var keys = Object.keys(object.renamedResources), i = 0; i < keys.length; ++i) - message.renamedResources[keys[i]] = String(object.renamedResources[keys[i]]); - } - if (object.ignoredResources) { - if (!Array.isArray(object.ignoredResources)) - throw TypeError(".google.api.DotnetSettings.ignoredResources: array expected"); - message.ignoredResources = []; - for (var i = 0; i < object.ignoredResources.length; ++i) - message.ignoredResources[i] = String(object.ignoredResources[i]); - } - if (object.forcedNamespaceAliases) { - if (!Array.isArray(object.forcedNamespaceAliases)) - throw TypeError(".google.api.DotnetSettings.forcedNamespaceAliases: array expected"); - message.forcedNamespaceAliases = []; - for (var i = 0; i < object.forcedNamespaceAliases.length; ++i) - message.forcedNamespaceAliases[i] = String(object.forcedNamespaceAliases[i]); - } - if (object.handwrittenSignatures) { - if (!Array.isArray(object.handwrittenSignatures)) - throw TypeError(".google.api.DotnetSettings.handwrittenSignatures: array expected"); - message.handwrittenSignatures = []; - for (var i = 0; i < object.handwrittenSignatures.length; ++i) - message.handwrittenSignatures[i] = String(object.handwrittenSignatures[i]); - } - return message; - }; - - /** - * Creates a plain object from a DotnetSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.DotnetSettings - * @static - * @param {google.api.DotnetSettings} message DotnetSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DotnetSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.ignoredResources = []; - object.forcedNamespaceAliases = []; - object.handwrittenSignatures = []; - } - if (options.objects || options.defaults) { - object.renamedServices = {}; - object.renamedResources = {}; - } - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - var keys2; - if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { - object.renamedServices = {}; - for (var j = 0; j < keys2.length; ++j) - object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; - } - if (message.renamedResources && (keys2 = Object.keys(message.renamedResources)).length) { - object.renamedResources = {}; - for (var j = 0; j < keys2.length; ++j) - object.renamedResources[keys2[j]] = message.renamedResources[keys2[j]]; - } - if (message.ignoredResources && message.ignoredResources.length) { - object.ignoredResources = []; - for (var j = 0; j < message.ignoredResources.length; ++j) - object.ignoredResources[j] = message.ignoredResources[j]; - } - if (message.forcedNamespaceAliases && message.forcedNamespaceAliases.length) { - object.forcedNamespaceAliases = []; - for (var j = 0; j < message.forcedNamespaceAliases.length; ++j) - object.forcedNamespaceAliases[j] = message.forcedNamespaceAliases[j]; - } - if (message.handwrittenSignatures && message.handwrittenSignatures.length) { - object.handwrittenSignatures = []; - for (var j = 0; j < message.handwrittenSignatures.length; ++j) - object.handwrittenSignatures[j] = message.handwrittenSignatures[j]; - } - return object; - }; - - /** - * Converts this DotnetSettings to JSON. - * @function toJSON - * @memberof google.api.DotnetSettings - * @instance - * @returns {Object.} JSON object - */ - DotnetSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DotnetSettings - * @function getTypeUrl - * @memberof google.api.DotnetSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DotnetSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.DotnetSettings"; - }; - - return DotnetSettings; - })(); - - api.RubySettings = (function() { - - /** - * Properties of a RubySettings. - * @memberof google.api - * @interface IRubySettings - * @property {google.api.ICommonLanguageSettings|null} [common] RubySettings common - */ - - /** - * Constructs a new RubySettings. - * @memberof google.api - * @classdesc Represents a RubySettings. - * @implements IRubySettings - * @constructor - * @param {google.api.IRubySettings=} [properties] Properties to set - */ - function RubySettings(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * RubySettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.RubySettings - * @instance - */ - RubySettings.prototype.common = null; - - /** - * Creates a new RubySettings instance using the specified properties. - * @function create - * @memberof google.api.RubySettings - * @static - * @param {google.api.IRubySettings=} [properties] Properties to set - * @returns {google.api.RubySettings} RubySettings instance - */ - RubySettings.create = function create(properties) { - return new RubySettings(properties); - }; - - /** - * Encodes the specified RubySettings message. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. - * @function encode - * @memberof google.api.RubySettings - * @static - * @param {google.api.IRubySettings} message RubySettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RubySettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified RubySettings message, length delimited. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.RubySettings - * @static - * @param {google.api.IRubySettings} message RubySettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - RubySettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a RubySettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.RubySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.RubySettings} RubySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RubySettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.RubySettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a RubySettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.RubySettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.RubySettings} RubySettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - RubySettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a RubySettings message. - * @function verify - * @memberof google.api.RubySettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - RubySettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - return null; - }; - - /** - * Creates a RubySettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.RubySettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.RubySettings} RubySettings - */ - RubySettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.RubySettings) - return object; - var message = new $root.google.api.RubySettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.RubySettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - return message; - }; - - /** - * Creates a plain object from a RubySettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.RubySettings - * @static - * @param {google.api.RubySettings} message RubySettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - RubySettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - return object; - }; - - /** - * Converts this RubySettings to JSON. - * @function toJSON - * @memberof google.api.RubySettings - * @instance - * @returns {Object.} JSON object - */ - RubySettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for RubySettings - * @function getTypeUrl - * @memberof google.api.RubySettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - RubySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.RubySettings"; - }; - - return RubySettings; - })(); - - api.GoSettings = (function() { - - /** - * Properties of a GoSettings. - * @memberof google.api - * @interface IGoSettings - * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common - * @property {Object.|null} [renamedServices] GoSettings renamedServices - */ - - /** - * Constructs a new GoSettings. - * @memberof google.api - * @classdesc Represents a GoSettings. - * @implements IGoSettings - * @constructor - * @param {google.api.IGoSettings=} [properties] Properties to set - */ - function GoSettings(properties) { - this.renamedServices = {}; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GoSettings common. - * @member {google.api.ICommonLanguageSettings|null|undefined} common - * @memberof google.api.GoSettings - * @instance - */ - GoSettings.prototype.common = null; - - /** - * GoSettings renamedServices. - * @member {Object.} renamedServices - * @memberof google.api.GoSettings - * @instance - */ - GoSettings.prototype.renamedServices = $util.emptyObject; - - /** - * Creates a new GoSettings instance using the specified properties. - * @function create - * @memberof google.api.GoSettings - * @static - * @param {google.api.IGoSettings=} [properties] Properties to set - * @returns {google.api.GoSettings} GoSettings instance - */ - GoSettings.create = function create(properties) { - return new GoSettings(properties); - }; - - /** - * Encodes the specified GoSettings message. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. - * @function encode - * @memberof google.api.GoSettings - * @static - * @param {google.api.IGoSettings} message GoSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GoSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.common != null && Object.hasOwnProperty.call(message, "common")) - $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) - for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); - return writer; - }; - - /** - * Encodes the specified GoSettings message, length delimited. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.GoSettings - * @static - * @param {google.api.IGoSettings} message GoSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GoSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GoSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.GoSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.GoSettings} GoSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GoSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); - break; - } - case 2: { - if (message.renamedServices === $util.emptyObject) - message.renamedServices = {}; - var end2 = reader.uint32() + reader.pos; - key = ""; - value = ""; - while (reader.pos < end2) { - var tag2 = reader.uint32(); - switch (tag2 >>> 3) { - case 1: - key = reader.string(); - break; - case 2: - value = reader.string(); - break; - default: - reader.skipType(tag2 & 7); - break; - } - } - message.renamedServices[key] = value; - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GoSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.GoSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.GoSettings} GoSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GoSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GoSettings message. - * @function verify - * @memberof google.api.GoSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GoSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.common != null && message.hasOwnProperty("common")) { - var error = $root.google.api.CommonLanguageSettings.verify(message.common); - if (error) - return "common." + error; - } - if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { - if (!$util.isObject(message.renamedServices)) - return "renamedServices: object expected"; - var key = Object.keys(message.renamedServices); - for (var i = 0; i < key.length; ++i) - if (!$util.isString(message.renamedServices[key[i]])) - return "renamedServices: string{k:string} expected"; - } - return null; - }; - - /** - * Creates a GoSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.GoSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.GoSettings} GoSettings - */ - GoSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.GoSettings) - return object; - var message = new $root.google.api.GoSettings(); - if (object.common != null) { - if (typeof object.common !== "object") - throw TypeError(".google.api.GoSettings.common: object expected"); - message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); - } - if (object.renamedServices) { - if (typeof object.renamedServices !== "object") - throw TypeError(".google.api.GoSettings.renamedServices: object expected"); - message.renamedServices = {}; - for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) - message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); - } - return message; - }; - - /** - * Creates a plain object from a GoSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.GoSettings - * @static - * @param {google.api.GoSettings} message GoSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GoSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.objects || options.defaults) - object.renamedServices = {}; - if (options.defaults) - object.common = null; - if (message.common != null && message.hasOwnProperty("common")) - object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); - var keys2; - if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { - object.renamedServices = {}; - for (var j = 0; j < keys2.length; ++j) - object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; - } - return object; - }; - - /** - * Converts this GoSettings to JSON. - * @function toJSON - * @memberof google.api.GoSettings - * @instance - * @returns {Object.} JSON object - */ - GoSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GoSettings - * @function getTypeUrl - * @memberof google.api.GoSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GoSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.GoSettings"; - }; - - return GoSettings; - })(); - - api.MethodSettings = (function() { - - /** - * Properties of a MethodSettings. - * @memberof google.api - * @interface IMethodSettings - * @property {string|null} [selector] MethodSettings selector - * @property {google.api.MethodSettings.ILongRunning|null} [longRunning] MethodSettings longRunning - * @property {Array.|null} [autoPopulatedFields] MethodSettings autoPopulatedFields - */ - - /** - * Constructs a new MethodSettings. - * @memberof google.api - * @classdesc Represents a MethodSettings. - * @implements IMethodSettings - * @constructor - * @param {google.api.IMethodSettings=} [properties] Properties to set - */ - function MethodSettings(properties) { - this.autoPopulatedFields = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MethodSettings selector. - * @member {string} selector - * @memberof google.api.MethodSettings - * @instance - */ - MethodSettings.prototype.selector = ""; - - /** - * MethodSettings longRunning. - * @member {google.api.MethodSettings.ILongRunning|null|undefined} longRunning - * @memberof google.api.MethodSettings - * @instance - */ - MethodSettings.prototype.longRunning = null; - - /** - * MethodSettings autoPopulatedFields. - * @member {Array.} autoPopulatedFields - * @memberof google.api.MethodSettings - * @instance - */ - MethodSettings.prototype.autoPopulatedFields = $util.emptyArray; - - /** - * Creates a new MethodSettings instance using the specified properties. - * @function create - * @memberof google.api.MethodSettings - * @static - * @param {google.api.IMethodSettings=} [properties] Properties to set - * @returns {google.api.MethodSettings} MethodSettings instance - */ - MethodSettings.create = function create(properties) { - return new MethodSettings(properties); - }; - - /** - * Encodes the specified MethodSettings message. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. - * @function encode - * @memberof google.api.MethodSettings - * @static - * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodSettings.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); - if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) - $root.google.api.MethodSettings.LongRunning.encode(message.longRunning, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.autoPopulatedFields != null && message.autoPopulatedFields.length) - for (var i = 0; i < message.autoPopulatedFields.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.autoPopulatedFields[i]); - return writer; - }; - - /** - * Encodes the specified MethodSettings message, length delimited. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.MethodSettings - * @static - * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodSettings.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MethodSettings message from the specified reader or buffer. - * @function decode - * @memberof google.api.MethodSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.MethodSettings} MethodSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodSettings.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.selector = reader.string(); - break; - } - case 2: { - message.longRunning = $root.google.api.MethodSettings.LongRunning.decode(reader, reader.uint32()); - break; - } - case 3: { - if (!(message.autoPopulatedFields && message.autoPopulatedFields.length)) - message.autoPopulatedFields = []; - message.autoPopulatedFields.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MethodSettings message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.MethodSettings - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.MethodSettings} MethodSettings - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodSettings.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MethodSettings message. - * @function verify - * @memberof google.api.MethodSettings - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MethodSettings.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.selector != null && message.hasOwnProperty("selector")) - if (!$util.isString(message.selector)) - return "selector: string expected"; - if (message.longRunning != null && message.hasOwnProperty("longRunning")) { - var error = $root.google.api.MethodSettings.LongRunning.verify(message.longRunning); - if (error) - return "longRunning." + error; - } - if (message.autoPopulatedFields != null && message.hasOwnProperty("autoPopulatedFields")) { - if (!Array.isArray(message.autoPopulatedFields)) - return "autoPopulatedFields: array expected"; - for (var i = 0; i < message.autoPopulatedFields.length; ++i) - if (!$util.isString(message.autoPopulatedFields[i])) - return "autoPopulatedFields: string[] expected"; - } - return null; - }; - - /** - * Creates a MethodSettings message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.MethodSettings - * @static - * @param {Object.} object Plain object - * @returns {google.api.MethodSettings} MethodSettings - */ - MethodSettings.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.MethodSettings) - return object; - var message = new $root.google.api.MethodSettings(); - if (object.selector != null) - message.selector = String(object.selector); - if (object.longRunning != null) { - if (typeof object.longRunning !== "object") - throw TypeError(".google.api.MethodSettings.longRunning: object expected"); - message.longRunning = $root.google.api.MethodSettings.LongRunning.fromObject(object.longRunning); - } - if (object.autoPopulatedFields) { - if (!Array.isArray(object.autoPopulatedFields)) - throw TypeError(".google.api.MethodSettings.autoPopulatedFields: array expected"); - message.autoPopulatedFields = []; - for (var i = 0; i < object.autoPopulatedFields.length; ++i) - message.autoPopulatedFields[i] = String(object.autoPopulatedFields[i]); - } - return message; - }; - - /** - * Creates a plain object from a MethodSettings message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.MethodSettings - * @static - * @param {google.api.MethodSettings} message MethodSettings - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MethodSettings.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.autoPopulatedFields = []; - if (options.defaults) { - object.selector = ""; - object.longRunning = null; - } - if (message.selector != null && message.hasOwnProperty("selector")) - object.selector = message.selector; - if (message.longRunning != null && message.hasOwnProperty("longRunning")) - object.longRunning = $root.google.api.MethodSettings.LongRunning.toObject(message.longRunning, options); - if (message.autoPopulatedFields && message.autoPopulatedFields.length) { - object.autoPopulatedFields = []; - for (var j = 0; j < message.autoPopulatedFields.length; ++j) - object.autoPopulatedFields[j] = message.autoPopulatedFields[j]; - } - return object; - }; - - /** - * Converts this MethodSettings to JSON. - * @function toJSON - * @memberof google.api.MethodSettings - * @instance - * @returns {Object.} JSON object - */ - MethodSettings.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MethodSettings - * @function getTypeUrl - * @memberof google.api.MethodSettings - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MethodSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.MethodSettings"; - }; - - MethodSettings.LongRunning = (function() { - - /** - * Properties of a LongRunning. - * @memberof google.api.MethodSettings - * @interface ILongRunning - * @property {google.protobuf.IDuration|null} [initialPollDelay] LongRunning initialPollDelay - * @property {number|null} [pollDelayMultiplier] LongRunning pollDelayMultiplier - * @property {google.protobuf.IDuration|null} [maxPollDelay] LongRunning maxPollDelay - * @property {google.protobuf.IDuration|null} [totalPollTimeout] LongRunning totalPollTimeout - */ - - /** - * Constructs a new LongRunning. - * @memberof google.api.MethodSettings - * @classdesc Represents a LongRunning. - * @implements ILongRunning - * @constructor - * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set - */ - function LongRunning(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * LongRunning initialPollDelay. - * @member {google.protobuf.IDuration|null|undefined} initialPollDelay - * @memberof google.api.MethodSettings.LongRunning - * @instance - */ - LongRunning.prototype.initialPollDelay = null; - - /** - * LongRunning pollDelayMultiplier. - * @member {number} pollDelayMultiplier - * @memberof google.api.MethodSettings.LongRunning - * @instance - */ - LongRunning.prototype.pollDelayMultiplier = 0; - - /** - * LongRunning maxPollDelay. - * @member {google.protobuf.IDuration|null|undefined} maxPollDelay - * @memberof google.api.MethodSettings.LongRunning - * @instance - */ - LongRunning.prototype.maxPollDelay = null; - - /** - * LongRunning totalPollTimeout. - * @member {google.protobuf.IDuration|null|undefined} totalPollTimeout - * @memberof google.api.MethodSettings.LongRunning - * @instance - */ - LongRunning.prototype.totalPollTimeout = null; - - /** - * Creates a new LongRunning instance using the specified properties. - * @function create - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set - * @returns {google.api.MethodSettings.LongRunning} LongRunning instance - */ - LongRunning.create = function create(properties) { - return new LongRunning(properties); - }; - - /** - * Encodes the specified LongRunning message. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. - * @function encode - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LongRunning.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) - $root.google.protobuf.Duration.encode(message.initialPollDelay, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) - writer.uint32(/* id 2, wireType 5 =*/21).float(message.pollDelayMultiplier); - if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) - $root.google.protobuf.Duration.encode(message.maxPollDelay, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) - $root.google.protobuf.Duration.encode(message.totalPollTimeout, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified LongRunning message, length delimited. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - LongRunning.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a LongRunning message from the specified reader or buffer. - * @function decode - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.MethodSettings.LongRunning} LongRunning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LongRunning.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings.LongRunning(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.initialPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - case 2: { - message.pollDelayMultiplier = reader.float(); - break; - } - case 3: { - message.maxPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - case 4: { - message.totalPollTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a LongRunning message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.MethodSettings.LongRunning} LongRunning - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - LongRunning.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a LongRunning message. - * @function verify - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - LongRunning.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) { - var error = $root.google.protobuf.Duration.verify(message.initialPollDelay); - if (error) - return "initialPollDelay." + error; - } - if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) - if (typeof message.pollDelayMultiplier !== "number") - return "pollDelayMultiplier: number expected"; - if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) { - var error = $root.google.protobuf.Duration.verify(message.maxPollDelay); - if (error) - return "maxPollDelay." + error; - } - if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) { - var error = $root.google.protobuf.Duration.verify(message.totalPollTimeout); - if (error) - return "totalPollTimeout." + error; - } - return null; - }; - - /** - * Creates a LongRunning message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {Object.} object Plain object - * @returns {google.api.MethodSettings.LongRunning} LongRunning - */ - LongRunning.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.MethodSettings.LongRunning) - return object; - var message = new $root.google.api.MethodSettings.LongRunning(); - if (object.initialPollDelay != null) { - if (typeof object.initialPollDelay !== "object") - throw TypeError(".google.api.MethodSettings.LongRunning.initialPollDelay: object expected"); - message.initialPollDelay = $root.google.protobuf.Duration.fromObject(object.initialPollDelay); - } - if (object.pollDelayMultiplier != null) - message.pollDelayMultiplier = Number(object.pollDelayMultiplier); - if (object.maxPollDelay != null) { - if (typeof object.maxPollDelay !== "object") - throw TypeError(".google.api.MethodSettings.LongRunning.maxPollDelay: object expected"); - message.maxPollDelay = $root.google.protobuf.Duration.fromObject(object.maxPollDelay); - } - if (object.totalPollTimeout != null) { - if (typeof object.totalPollTimeout !== "object") - throw TypeError(".google.api.MethodSettings.LongRunning.totalPollTimeout: object expected"); - message.totalPollTimeout = $root.google.protobuf.Duration.fromObject(object.totalPollTimeout); - } - return message; - }; - - /** - * Creates a plain object from a LongRunning message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {google.api.MethodSettings.LongRunning} message LongRunning - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - LongRunning.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.initialPollDelay = null; - object.pollDelayMultiplier = 0; - object.maxPollDelay = null; - object.totalPollTimeout = null; - } - if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) - object.initialPollDelay = $root.google.protobuf.Duration.toObject(message.initialPollDelay, options); - if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) - object.pollDelayMultiplier = options.json && !isFinite(message.pollDelayMultiplier) ? String(message.pollDelayMultiplier) : message.pollDelayMultiplier; - if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) - object.maxPollDelay = $root.google.protobuf.Duration.toObject(message.maxPollDelay, options); - if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) - object.totalPollTimeout = $root.google.protobuf.Duration.toObject(message.totalPollTimeout, options); - return object; - }; - - /** - * Converts this LongRunning to JSON. - * @function toJSON - * @memberof google.api.MethodSettings.LongRunning - * @instance - * @returns {Object.} JSON object - */ - LongRunning.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for LongRunning - * @function getTypeUrl - * @memberof google.api.MethodSettings.LongRunning - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - LongRunning.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.MethodSettings.LongRunning"; - }; - - return LongRunning; - })(); - - return MethodSettings; - })(); - - /** - * ClientLibraryOrganization enum. - * @name google.api.ClientLibraryOrganization - * @enum {number} - * @property {number} CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED=0 CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED value - * @property {number} CLOUD=1 CLOUD value - * @property {number} ADS=2 ADS value - * @property {number} PHOTOS=3 PHOTOS value - * @property {number} STREET_VIEW=4 STREET_VIEW value - * @property {number} SHOPPING=5 SHOPPING value - * @property {number} GEO=6 GEO value - * @property {number} GENERATIVE_AI=7 GENERATIVE_AI value - */ - api.ClientLibraryOrganization = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED"] = 0; - values[valuesById[1] = "CLOUD"] = 1; - values[valuesById[2] = "ADS"] = 2; - values[valuesById[3] = "PHOTOS"] = 3; - values[valuesById[4] = "STREET_VIEW"] = 4; - values[valuesById[5] = "SHOPPING"] = 5; - values[valuesById[6] = "GEO"] = 6; - values[valuesById[7] = "GENERATIVE_AI"] = 7; - return values; - })(); - - /** - * ClientLibraryDestination enum. - * @name google.api.ClientLibraryDestination - * @enum {number} - * @property {number} CLIENT_LIBRARY_DESTINATION_UNSPECIFIED=0 CLIENT_LIBRARY_DESTINATION_UNSPECIFIED value - * @property {number} GITHUB=10 GITHUB value - * @property {number} PACKAGE_MANAGER=20 PACKAGE_MANAGER value - */ - api.ClientLibraryDestination = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED"] = 0; - values[valuesById[10] = "GITHUB"] = 10; - values[valuesById[20] = "PACKAGE_MANAGER"] = 20; - return values; - })(); - - api.SelectiveGapicGeneration = (function() { - - /** - * Properties of a SelectiveGapicGeneration. - * @memberof google.api - * @interface ISelectiveGapicGeneration - * @property {Array.|null} [methods] SelectiveGapicGeneration methods - * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal - */ - - /** - * Constructs a new SelectiveGapicGeneration. - * @memberof google.api - * @classdesc Represents a SelectiveGapicGeneration. - * @implements ISelectiveGapicGeneration - * @constructor - * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set - */ - function SelectiveGapicGeneration(properties) { - this.methods = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SelectiveGapicGeneration methods. - * @member {Array.} methods - * @memberof google.api.SelectiveGapicGeneration - * @instance - */ - SelectiveGapicGeneration.prototype.methods = $util.emptyArray; - - /** - * SelectiveGapicGeneration generateOmittedAsInternal. - * @member {boolean} generateOmittedAsInternal - * @memberof google.api.SelectiveGapicGeneration - * @instance - */ - SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; - - /** - * Creates a new SelectiveGapicGeneration instance using the specified properties. - * @function create - * @memberof google.api.SelectiveGapicGeneration - * @static - * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set - * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance - */ - SelectiveGapicGeneration.create = function create(properties) { - return new SelectiveGapicGeneration(properties); - }; - - /** - * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. - * @function encode - * @memberof google.api.SelectiveGapicGeneration - * @static - * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SelectiveGapicGeneration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.methods != null && message.methods.length) - for (var i = 0; i < message.methods.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); - if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); - return writer; - }; - - /** - * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.SelectiveGapicGeneration - * @static - * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. - * @function decode - * @memberof google.api.SelectiveGapicGeneration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SelectiveGapicGeneration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.methods && message.methods.length)) - message.methods = []; - message.methods.push(reader.string()); - break; - } - case 2: { - message.generateOmittedAsInternal = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.SelectiveGapicGeneration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SelectiveGapicGeneration message. - * @function verify - * @memberof google.api.SelectiveGapicGeneration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SelectiveGapicGeneration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.methods != null && message.hasOwnProperty("methods")) { - if (!Array.isArray(message.methods)) - return "methods: array expected"; - for (var i = 0; i < message.methods.length; ++i) - if (!$util.isString(message.methods[i])) - return "methods: string[] expected"; - } - if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) - if (typeof message.generateOmittedAsInternal !== "boolean") - return "generateOmittedAsInternal: boolean expected"; - return null; - }; - - /** - * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.SelectiveGapicGeneration - * @static - * @param {Object.} object Plain object - * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration - */ - SelectiveGapicGeneration.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.SelectiveGapicGeneration) - return object; - var message = new $root.google.api.SelectiveGapicGeneration(); - if (object.methods) { - if (!Array.isArray(object.methods)) - throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); - message.methods = []; - for (var i = 0; i < object.methods.length; ++i) - message.methods[i] = String(object.methods[i]); - } - if (object.generateOmittedAsInternal != null) - message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); - return message; - }; - - /** - * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.SelectiveGapicGeneration - * @static - * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SelectiveGapicGeneration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.methods = []; - if (options.defaults) - object.generateOmittedAsInternal = false; - if (message.methods && message.methods.length) { - object.methods = []; - for (var j = 0; j < message.methods.length; ++j) - object.methods[j] = message.methods[j]; - } - if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) - object.generateOmittedAsInternal = message.generateOmittedAsInternal; - return object; - }; - - /** - * Converts this SelectiveGapicGeneration to JSON. - * @function toJSON - * @memberof google.api.SelectiveGapicGeneration - * @instance - * @returns {Object.} JSON object - */ - SelectiveGapicGeneration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SelectiveGapicGeneration - * @function getTypeUrl - * @memberof google.api.SelectiveGapicGeneration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; - }; - - return SelectiveGapicGeneration; - })(); - - /** - * LaunchStage enum. - * @name google.api.LaunchStage - * @enum {number} - * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value - * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value - * @property {number} PRELAUNCH=7 PRELAUNCH value - * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value - * @property {number} ALPHA=2 ALPHA value - * @property {number} BETA=3 BETA value - * @property {number} GA=4 GA value - * @property {number} DEPRECATED=5 DEPRECATED value - */ - api.LaunchStage = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; - values[valuesById[6] = "UNIMPLEMENTED"] = 6; - values[valuesById[7] = "PRELAUNCH"] = 7; - values[valuesById[1] = "EARLY_ACCESS"] = 1; - values[valuesById[2] = "ALPHA"] = 2; - values[valuesById[3] = "BETA"] = 3; - values[valuesById[4] = "GA"] = 4; - values[valuesById[5] = "DEPRECATED"] = 5; - return values; - })(); - - /** - * FieldBehavior enum. - * @name google.api.FieldBehavior - * @enum {number} - * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value - * @property {number} OPTIONAL=1 OPTIONAL value - * @property {number} REQUIRED=2 REQUIRED value - * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value - * @property {number} INPUT_ONLY=4 INPUT_ONLY value - * @property {number} IMMUTABLE=5 IMMUTABLE value - * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value - * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value - * @property {number} IDENTIFIER=8 IDENTIFIER value - */ - api.FieldBehavior = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; - values[valuesById[1] = "OPTIONAL"] = 1; - values[valuesById[2] = "REQUIRED"] = 2; - values[valuesById[3] = "OUTPUT_ONLY"] = 3; - values[valuesById[4] = "INPUT_ONLY"] = 4; - values[valuesById[5] = "IMMUTABLE"] = 5; - values[valuesById[6] = "UNORDERED_LIST"] = 6; - values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; - values[valuesById[8] = "IDENTIFIER"] = 8; - return values; - })(); - - api.ResourceDescriptor = (function() { - - /** - * Properties of a ResourceDescriptor. - * @memberof google.api - * @interface IResourceDescriptor - * @property {string|null} [type] ResourceDescriptor type - * @property {Array.|null} [pattern] ResourceDescriptor pattern - * @property {string|null} [nameField] ResourceDescriptor nameField - * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history - * @property {string|null} [plural] ResourceDescriptor plural - * @property {string|null} [singular] ResourceDescriptor singular - * @property {Array.|null} [style] ResourceDescriptor style - */ - - /** - * Constructs a new ResourceDescriptor. - * @memberof google.api - * @classdesc Represents a ResourceDescriptor. - * @implements IResourceDescriptor - * @constructor - * @param {google.api.IResourceDescriptor=} [properties] Properties to set - */ - function ResourceDescriptor(properties) { - this.pattern = []; - this.style = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResourceDescriptor type. - * @member {string} type - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.type = ""; - - /** - * ResourceDescriptor pattern. - * @member {Array.} pattern - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.pattern = $util.emptyArray; - - /** - * ResourceDescriptor nameField. - * @member {string} nameField - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.nameField = ""; - - /** - * ResourceDescriptor history. - * @member {google.api.ResourceDescriptor.History} history - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.history = 0; - - /** - * ResourceDescriptor plural. - * @member {string} plural - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.plural = ""; - - /** - * ResourceDescriptor singular. - * @member {string} singular - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.singular = ""; - - /** - * ResourceDescriptor style. - * @member {Array.} style - * @memberof google.api.ResourceDescriptor - * @instance - */ - ResourceDescriptor.prototype.style = $util.emptyArray; - - /** - * Creates a new ResourceDescriptor instance using the specified properties. - * @function create - * @memberof google.api.ResourceDescriptor - * @static - * @param {google.api.IResourceDescriptor=} [properties] Properties to set - * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance - */ - ResourceDescriptor.create = function create(properties) { - return new ResourceDescriptor(properties); - }; - - /** - * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @function encode - * @memberof google.api.ResourceDescriptor - * @static - * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceDescriptor.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.pattern != null && message.pattern.length) - for (var i = 0; i < message.pattern.length; ++i) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); - if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); - if (message.history != null && Object.hasOwnProperty.call(message, "history")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); - if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); - if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); - if (message.style != null && message.style.length) { - writer.uint32(/* id 10, wireType 2 =*/82).fork(); - for (var i = 0; i < message.style.length; ++i) - writer.int32(message.style[i]); - writer.ldelim(); - } - return writer; - }; - - /** - * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.ResourceDescriptor - * @static - * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer. - * @function decode - * @memberof google.api.ResourceDescriptor - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.ResourceDescriptor} ResourceDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceDescriptor.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.type = reader.string(); - break; - } - case 2: { - if (!(message.pattern && message.pattern.length)) - message.pattern = []; - message.pattern.push(reader.string()); - break; - } - case 3: { - message.nameField = reader.string(); - break; - } - case 4: { - message.history = reader.int32(); - break; - } - case 5: { - message.plural = reader.string(); - break; - } - case 6: { - message.singular = reader.string(); - break; - } - case 10: { - if (!(message.style && message.style.length)) - message.style = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.style.push(reader.int32()); - } else - message.style.push(reader.int32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.ResourceDescriptor - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ResourceDescriptor} ResourceDescriptor - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResourceDescriptor message. - * @function verify - * @memberof google.api.ResourceDescriptor - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResourceDescriptor.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.pattern != null && message.hasOwnProperty("pattern")) { - if (!Array.isArray(message.pattern)) - return "pattern: array expected"; - for (var i = 0; i < message.pattern.length; ++i) - if (!$util.isString(message.pattern[i])) - return "pattern: string[] expected"; - } - if (message.nameField != null && message.hasOwnProperty("nameField")) - if (!$util.isString(message.nameField)) - return "nameField: string expected"; - if (message.history != null && message.hasOwnProperty("history")) - switch (message.history) { - default: - return "history: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.plural != null && message.hasOwnProperty("plural")) - if (!$util.isString(message.plural)) - return "plural: string expected"; - if (message.singular != null && message.hasOwnProperty("singular")) - if (!$util.isString(message.singular)) - return "singular: string expected"; - if (message.style != null && message.hasOwnProperty("style")) { - if (!Array.isArray(message.style)) - return "style: array expected"; - for (var i = 0; i < message.style.length; ++i) - switch (message.style[i]) { - default: - return "style: enum value[] expected"; - case 0: - case 1: - break; - } - } - return null; - }; - - /** - * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.ResourceDescriptor - * @static - * @param {Object.} object Plain object - * @returns {google.api.ResourceDescriptor} ResourceDescriptor - */ - ResourceDescriptor.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ResourceDescriptor) - return object; - var message = new $root.google.api.ResourceDescriptor(); - if (object.type != null) - message.type = String(object.type); - if (object.pattern) { - if (!Array.isArray(object.pattern)) - throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); - message.pattern = []; - for (var i = 0; i < object.pattern.length; ++i) - message.pattern[i] = String(object.pattern[i]); - } - if (object.nameField != null) - message.nameField = String(object.nameField); - switch (object.history) { - default: - if (typeof object.history === "number") { - message.history = object.history; - break; - } - break; - case "HISTORY_UNSPECIFIED": - case 0: - message.history = 0; - break; - case "ORIGINALLY_SINGLE_PATTERN": - case 1: - message.history = 1; - break; - case "FUTURE_MULTI_PATTERN": - case 2: - message.history = 2; - break; - } - if (object.plural != null) - message.plural = String(object.plural); - if (object.singular != null) - message.singular = String(object.singular); - if (object.style) { - if (!Array.isArray(object.style)) - throw TypeError(".google.api.ResourceDescriptor.style: array expected"); - message.style = []; - for (var i = 0; i < object.style.length; ++i) - switch (object.style[i]) { - default: - if (typeof object.style[i] === "number") { - message.style[i] = object.style[i]; - break; - } - case "STYLE_UNSPECIFIED": - case 0: - message.style[i] = 0; - break; - case "DECLARATIVE_FRIENDLY": - case 1: - message.style[i] = 1; - break; - } - } - return message; - }; - - /** - * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.ResourceDescriptor - * @static - * @param {google.api.ResourceDescriptor} message ResourceDescriptor - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResourceDescriptor.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.pattern = []; - object.style = []; - } - if (options.defaults) { - object.type = ""; - object.nameField = ""; - object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; - object.plural = ""; - object.singular = ""; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.pattern && message.pattern.length) { - object.pattern = []; - for (var j = 0; j < message.pattern.length; ++j) - object.pattern[j] = message.pattern[j]; - } - if (message.nameField != null && message.hasOwnProperty("nameField")) - object.nameField = message.nameField; - if (message.history != null && message.hasOwnProperty("history")) - object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; - if (message.plural != null && message.hasOwnProperty("plural")) - object.plural = message.plural; - if (message.singular != null && message.hasOwnProperty("singular")) - object.singular = message.singular; - if (message.style && message.style.length) { - object.style = []; - for (var j = 0; j < message.style.length; ++j) - object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; - } - return object; - }; - - /** - * Converts this ResourceDescriptor to JSON. - * @function toJSON - * @memberof google.api.ResourceDescriptor - * @instance - * @returns {Object.} JSON object - */ - ResourceDescriptor.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ResourceDescriptor - * @function getTypeUrl - * @memberof google.api.ResourceDescriptor - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.ResourceDescriptor"; - }; - - /** - * History enum. - * @name google.api.ResourceDescriptor.History - * @enum {number} - * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value - * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value - * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value - */ - ResourceDescriptor.History = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; - values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; - values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; - return values; - })(); - - /** - * Style enum. - * @name google.api.ResourceDescriptor.Style - * @enum {number} - * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value - * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value - */ - ResourceDescriptor.Style = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; - values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; - return values; - })(); - - return ResourceDescriptor; - })(); - - api.ResourceReference = (function() { - - /** - * Properties of a ResourceReference. - * @memberof google.api - * @interface IResourceReference - * @property {string|null} [type] ResourceReference type - * @property {string|null} [childType] ResourceReference childType - */ - - /** - * Constructs a new ResourceReference. - * @memberof google.api - * @classdesc Represents a ResourceReference. - * @implements IResourceReference - * @constructor - * @param {google.api.IResourceReference=} [properties] Properties to set - */ - function ResourceReference(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ResourceReference type. - * @member {string} type - * @memberof google.api.ResourceReference - * @instance - */ - ResourceReference.prototype.type = ""; - - /** - * ResourceReference childType. - * @member {string} childType - * @memberof google.api.ResourceReference - * @instance - */ - ResourceReference.prototype.childType = ""; - - /** - * Creates a new ResourceReference instance using the specified properties. - * @function create - * @memberof google.api.ResourceReference - * @static - * @param {google.api.IResourceReference=} [properties] Properties to set - * @returns {google.api.ResourceReference} ResourceReference instance - */ - ResourceReference.create = function create(properties) { - return new ResourceReference(properties); - }; - - /** - * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @function encode - * @memberof google.api.ResourceReference - * @static - * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceReference.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); - if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); - return writer; - }; - - /** - * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.ResourceReference - * @static - * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ResourceReference message from the specified reader or buffer. - * @function decode - * @memberof google.api.ResourceReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.ResourceReference} ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceReference.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.type = reader.string(); - break; - } - case 2: { - message.childType = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ResourceReference message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.ResourceReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.ResourceReference} ResourceReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ResourceReference.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ResourceReference message. - * @function verify - * @memberof google.api.ResourceReference - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ResourceReference.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.childType != null && message.hasOwnProperty("childType")) - if (!$util.isString(message.childType)) - return "childType: string expected"; - return null; - }; - - /** - * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.ResourceReference - * @static - * @param {Object.} object Plain object - * @returns {google.api.ResourceReference} ResourceReference - */ - ResourceReference.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.ResourceReference) - return object; - var message = new $root.google.api.ResourceReference(); - if (object.type != null) - message.type = String(object.type); - if (object.childType != null) - message.childType = String(object.childType); - return message; - }; - - /** - * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.ResourceReference - * @static - * @param {google.api.ResourceReference} message ResourceReference - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ResourceReference.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type = ""; - object.childType = ""; - } - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.childType != null && message.hasOwnProperty("childType")) - object.childType = message.childType; - return object; - }; - - /** - * Converts this ResourceReference to JSON. - * @function toJSON - * @memberof google.api.ResourceReference - * @instance - * @returns {Object.} JSON object - */ - ResourceReference.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ResourceReference - * @function getTypeUrl - * @memberof google.api.ResourceReference - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.ResourceReference"; - }; - - return ResourceReference; - })(); - - api.FieldInfo = (function() { - - /** - * Properties of a FieldInfo. - * @memberof google.api - * @interface IFieldInfo - * @property {google.api.FieldInfo.Format|null} [format] FieldInfo format - * @property {Array.|null} [referencedTypes] FieldInfo referencedTypes - */ - - /** - * Constructs a new FieldInfo. - * @memberof google.api - * @classdesc Represents a FieldInfo. - * @implements IFieldInfo - * @constructor - * @param {google.api.IFieldInfo=} [properties] Properties to set - */ - function FieldInfo(properties) { - this.referencedTypes = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FieldInfo format. - * @member {google.api.FieldInfo.Format} format - * @memberof google.api.FieldInfo - * @instance - */ - FieldInfo.prototype.format = 0; - - /** - * FieldInfo referencedTypes. - * @member {Array.} referencedTypes - * @memberof google.api.FieldInfo - * @instance - */ - FieldInfo.prototype.referencedTypes = $util.emptyArray; - - /** - * Creates a new FieldInfo instance using the specified properties. - * @function create - * @memberof google.api.FieldInfo - * @static - * @param {google.api.IFieldInfo=} [properties] Properties to set - * @returns {google.api.FieldInfo} FieldInfo instance - */ - FieldInfo.create = function create(properties) { - return new FieldInfo(properties); - }; - - /** - * Encodes the specified FieldInfo message. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. - * @function encode - * @memberof google.api.FieldInfo - * @static - * @param {google.api.IFieldInfo} message FieldInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.format != null && Object.hasOwnProperty.call(message, "format")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.format); - if (message.referencedTypes != null && message.referencedTypes.length) - for (var i = 0; i < message.referencedTypes.length; ++i) - $root.google.api.TypeReference.encode(message.referencedTypes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FieldInfo message, length delimited. Does not implicitly {@link google.api.FieldInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.FieldInfo - * @static - * @param {google.api.IFieldInfo} message FieldInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldInfo message from the specified reader or buffer. - * @function decode - * @memberof google.api.FieldInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.FieldInfo} FieldInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldInfo.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.FieldInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.format = reader.int32(); - break; - } - case 2: { - if (!(message.referencedTypes && message.referencedTypes.length)) - message.referencedTypes = []; - message.referencedTypes.push($root.google.api.TypeReference.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.FieldInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.FieldInfo} FieldInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldInfo message. - * @function verify - * @memberof google.api.FieldInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.format != null && message.hasOwnProperty("format")) - switch (message.format) { - default: - return "format: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - if (message.referencedTypes != null && message.hasOwnProperty("referencedTypes")) { - if (!Array.isArray(message.referencedTypes)) - return "referencedTypes: array expected"; - for (var i = 0; i < message.referencedTypes.length; ++i) { - var error = $root.google.api.TypeReference.verify(message.referencedTypes[i]); - if (error) - return "referencedTypes." + error; - } - } - return null; - }; - - /** - * Creates a FieldInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.FieldInfo - * @static - * @param {Object.} object Plain object - * @returns {google.api.FieldInfo} FieldInfo - */ - FieldInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.FieldInfo) - return object; - var message = new $root.google.api.FieldInfo(); - switch (object.format) { - default: - if (typeof object.format === "number") { - message.format = object.format; - break; - } - break; - case "FORMAT_UNSPECIFIED": - case 0: - message.format = 0; - break; - case "UUID4": - case 1: - message.format = 1; - break; - case "IPV4": - case 2: - message.format = 2; - break; - case "IPV6": - case 3: - message.format = 3; - break; - case "IPV4_OR_IPV6": - case 4: - message.format = 4; - break; - } - if (object.referencedTypes) { - if (!Array.isArray(object.referencedTypes)) - throw TypeError(".google.api.FieldInfo.referencedTypes: array expected"); - message.referencedTypes = []; - for (var i = 0; i < object.referencedTypes.length; ++i) { - if (typeof object.referencedTypes[i] !== "object") - throw TypeError(".google.api.FieldInfo.referencedTypes: object expected"); - message.referencedTypes[i] = $root.google.api.TypeReference.fromObject(object.referencedTypes[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a FieldInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.FieldInfo - * @static - * @param {google.api.FieldInfo} message FieldInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FieldInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.referencedTypes = []; - if (options.defaults) - object.format = options.enums === String ? "FORMAT_UNSPECIFIED" : 0; - if (message.format != null && message.hasOwnProperty("format")) - object.format = options.enums === String ? $root.google.api.FieldInfo.Format[message.format] === undefined ? message.format : $root.google.api.FieldInfo.Format[message.format] : message.format; - if (message.referencedTypes && message.referencedTypes.length) { - object.referencedTypes = []; - for (var j = 0; j < message.referencedTypes.length; ++j) - object.referencedTypes[j] = $root.google.api.TypeReference.toObject(message.referencedTypes[j], options); - } - return object; - }; - - /** - * Converts this FieldInfo to JSON. - * @function toJSON - * @memberof google.api.FieldInfo - * @instance - * @returns {Object.} JSON object - */ - FieldInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FieldInfo - * @function getTypeUrl - * @memberof google.api.FieldInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FieldInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.FieldInfo"; - }; - - /** - * Format enum. - * @name google.api.FieldInfo.Format - * @enum {number} - * @property {number} FORMAT_UNSPECIFIED=0 FORMAT_UNSPECIFIED value - * @property {number} UUID4=1 UUID4 value - * @property {number} IPV4=2 IPV4 value - * @property {number} IPV6=3 IPV6 value - * @property {number} IPV4_OR_IPV6=4 IPV4_OR_IPV6 value - */ - FieldInfo.Format = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FORMAT_UNSPECIFIED"] = 0; - values[valuesById[1] = "UUID4"] = 1; - values[valuesById[2] = "IPV4"] = 2; - values[valuesById[3] = "IPV6"] = 3; - values[valuesById[4] = "IPV4_OR_IPV6"] = 4; - return values; - })(); - - return FieldInfo; - })(); - - api.TypeReference = (function() { - - /** - * Properties of a TypeReference. - * @memberof google.api - * @interface ITypeReference - * @property {string|null} [typeName] TypeReference typeName - */ - - /** - * Constructs a new TypeReference. - * @memberof google.api - * @classdesc Represents a TypeReference. - * @implements ITypeReference - * @constructor - * @param {google.api.ITypeReference=} [properties] Properties to set - */ - function TypeReference(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * TypeReference typeName. - * @member {string} typeName - * @memberof google.api.TypeReference - * @instance - */ - TypeReference.prototype.typeName = ""; - - /** - * Creates a new TypeReference instance using the specified properties. - * @function create - * @memberof google.api.TypeReference - * @static - * @param {google.api.ITypeReference=} [properties] Properties to set - * @returns {google.api.TypeReference} TypeReference instance - */ - TypeReference.create = function create(properties) { - return new TypeReference(properties); - }; - - /** - * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. - * @function encode - * @memberof google.api.TypeReference - * @static - * @param {google.api.ITypeReference} message TypeReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TypeReference.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.typeName); - return writer; - }; - - /** - * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. - * @function encodeDelimited - * @memberof google.api.TypeReference - * @static - * @param {google.api.ITypeReference} message TypeReference message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - TypeReference.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a TypeReference message from the specified reader or buffer. - * @function decode - * @memberof google.api.TypeReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.api.TypeReference} TypeReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TypeReference.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.TypeReference(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.typeName = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a TypeReference message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.api.TypeReference - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.api.TypeReference} TypeReference - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - TypeReference.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a TypeReference message. - * @function verify - * @memberof google.api.TypeReference - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - TypeReference.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.typeName != null && message.hasOwnProperty("typeName")) - if (!$util.isString(message.typeName)) - return "typeName: string expected"; - return null; - }; - - /** - * Creates a TypeReference message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.api.TypeReference - * @static - * @param {Object.} object Plain object - * @returns {google.api.TypeReference} TypeReference - */ - TypeReference.fromObject = function fromObject(object) { - if (object instanceof $root.google.api.TypeReference) - return object; - var message = new $root.google.api.TypeReference(); - if (object.typeName != null) - message.typeName = String(object.typeName); - return message; - }; - - /** - * Creates a plain object from a TypeReference message. Also converts values to other types if specified. - * @function toObject - * @memberof google.api.TypeReference - * @static - * @param {google.api.TypeReference} message TypeReference - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - TypeReference.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.typeName = ""; - if (message.typeName != null && message.hasOwnProperty("typeName")) - object.typeName = message.typeName; - return object; - }; - - /** - * Converts this TypeReference to JSON. - * @function toJSON - * @memberof google.api.TypeReference - * @instance - * @returns {Object.} JSON object - */ - TypeReference.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for TypeReference - * @function getTypeUrl - * @memberof google.api.TypeReference - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - TypeReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.api.TypeReference"; - }; - - return TypeReference; - })(); - - return api; - })(); - - google.protobuf = (function() { - - /** - * Namespace protobuf. - * @memberof google - * @namespace - */ - var protobuf = {}; - - protobuf.FileDescriptorSet = (function() { - - /** - * Properties of a FileDescriptorSet. - * @memberof google.protobuf - * @interface IFileDescriptorSet - * @property {Array.|null} [file] FileDescriptorSet file - */ - - /** - * Constructs a new FileDescriptorSet. - * @memberof google.protobuf - * @classdesc Represents a FileDescriptorSet. - * @implements IFileDescriptorSet - * @constructor - * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set - */ - function FileDescriptorSet(properties) { - this.file = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FileDescriptorSet file. - * @member {Array.} file - * @memberof google.protobuf.FileDescriptorSet - * @instance - */ - FileDescriptorSet.prototype.file = $util.emptyArray; - - /** - * Creates a new FileDescriptorSet instance using the specified properties. - * @function create - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance - */ - FileDescriptorSet.create = function create(properties) { - return new FileDescriptorSet(properties); - }; - - /** - * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorSet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.file != null && message.file.length) - for (var i = 0; i < message.file.length; ++i) - $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FileDescriptorSet message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorSet.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.file && message.file.length)) - message.file = []; - message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FileDescriptorSet message. - * @function verify - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FileDescriptorSet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.file != null && message.hasOwnProperty("file")) { - if (!Array.isArray(message.file)) - return "file: array expected"; - for (var i = 0; i < message.file.length; ++i) { - var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); - if (error) - return "file." + error; - } - } - return null; - }; - - /** - * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet - */ - FileDescriptorSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileDescriptorSet) - return object; - var message = new $root.google.protobuf.FileDescriptorSet(); - if (object.file) { - if (!Array.isArray(object.file)) - throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); - message.file = []; - for (var i = 0; i < object.file.length; ++i) { - if (typeof object.file[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); - message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FileDescriptorSet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.file = []; - if (message.file && message.file.length) { - object.file = []; - for (var j = 0; j < message.file.length; ++j) - object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); - } - return object; - }; - - /** - * Converts this FileDescriptorSet to JSON. - * @function toJSON - * @memberof google.protobuf.FileDescriptorSet - * @instance - * @returns {Object.} JSON object - */ - FileDescriptorSet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FileDescriptorSet - * @function getTypeUrl - * @memberof google.protobuf.FileDescriptorSet - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; - }; - - return FileDescriptorSet; - })(); - - /** - * Edition enum. - * @name google.protobuf.Edition - * @enum {number} - * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value - * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value - * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value - * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value - * @property {number} EDITION_2023=1000 EDITION_2023 value - * @property {number} EDITION_2024=1001 EDITION_2024 value - * @property {number} EDITION_1_TEST_ONLY=1 EDITION_1_TEST_ONLY value - * @property {number} EDITION_2_TEST_ONLY=2 EDITION_2_TEST_ONLY value - * @property {number} EDITION_99997_TEST_ONLY=99997 EDITION_99997_TEST_ONLY value - * @property {number} EDITION_99998_TEST_ONLY=99998 EDITION_99998_TEST_ONLY value - * @property {number} EDITION_99999_TEST_ONLY=99999 EDITION_99999_TEST_ONLY value - * @property {number} EDITION_MAX=2147483647 EDITION_MAX value - */ - protobuf.Edition = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "EDITION_UNKNOWN"] = 0; - values[valuesById[900] = "EDITION_LEGACY"] = 900; - values[valuesById[998] = "EDITION_PROTO2"] = 998; - values[valuesById[999] = "EDITION_PROTO3"] = 999; - values[valuesById[1000] = "EDITION_2023"] = 1000; - values[valuesById[1001] = "EDITION_2024"] = 1001; - values[valuesById[1] = "EDITION_1_TEST_ONLY"] = 1; - values[valuesById[2] = "EDITION_2_TEST_ONLY"] = 2; - values[valuesById[99997] = "EDITION_99997_TEST_ONLY"] = 99997; - values[valuesById[99998] = "EDITION_99998_TEST_ONLY"] = 99998; - values[valuesById[99999] = "EDITION_99999_TEST_ONLY"] = 99999; - values[valuesById[2147483647] = "EDITION_MAX"] = 2147483647; - return values; - })(); - - protobuf.FileDescriptorProto = (function() { - - /** - * Properties of a FileDescriptorProto. - * @memberof google.protobuf - * @interface IFileDescriptorProto - * @property {string|null} [name] FileDescriptorProto name - * @property {string|null} ["package"] FileDescriptorProto package - * @property {Array.|null} [dependency] FileDescriptorProto dependency - * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency - * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency - * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency - * @property {Array.|null} [messageType] FileDescriptorProto messageType - * @property {Array.|null} [enumType] FileDescriptorProto enumType - * @property {Array.|null} [service] FileDescriptorProto service - * @property {Array.|null} [extension] FileDescriptorProto extension - * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options - * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo - * @property {string|null} [syntax] FileDescriptorProto syntax - * @property {google.protobuf.Edition|null} [edition] FileDescriptorProto edition - */ - - /** - * Constructs a new FileDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a FileDescriptorProto. - * @implements IFileDescriptorProto - * @constructor - * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set - */ - function FileDescriptorProto(properties) { - this.dependency = []; - this.publicDependency = []; - this.weakDependency = []; - this.optionDependency = []; - this.messageType = []; - this.enumType = []; - this.service = []; - this.extension = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FileDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.name = ""; - - /** - * FileDescriptorProto package. - * @member {string} package - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype["package"] = ""; - - /** - * FileDescriptorProto dependency. - * @member {Array.} dependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.dependency = $util.emptyArray; - - /** - * FileDescriptorProto publicDependency. - * @member {Array.} publicDependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.publicDependency = $util.emptyArray; - - /** - * FileDescriptorProto weakDependency. - * @member {Array.} weakDependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.weakDependency = $util.emptyArray; - - /** - * FileDescriptorProto optionDependency. - * @member {Array.} optionDependency - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.optionDependency = $util.emptyArray; - - /** - * FileDescriptorProto messageType. - * @member {Array.} messageType - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.messageType = $util.emptyArray; - - /** - * FileDescriptorProto enumType. - * @member {Array.} enumType - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.enumType = $util.emptyArray; - - /** - * FileDescriptorProto service. - * @member {Array.} service - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.service = $util.emptyArray; - - /** - * FileDescriptorProto extension. - * @member {Array.} extension - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.extension = $util.emptyArray; - - /** - * FileDescriptorProto options. - * @member {google.protobuf.IFileOptions|null|undefined} options - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.options = null; - - /** - * FileDescriptorProto sourceCodeInfo. - * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.sourceCodeInfo = null; - - /** - * FileDescriptorProto syntax. - * @member {string} syntax - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.syntax = ""; - - /** - * FileDescriptorProto edition. - * @member {google.protobuf.Edition} edition - * @memberof google.protobuf.FileDescriptorProto - * @instance - */ - FileDescriptorProto.prototype.edition = 0; - - /** - * Creates a new FileDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance - */ - FileDescriptorProto.create = function create(properties) { - return new FileDescriptorProto(properties); - }; - - /** - * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); - if (message.dependency != null && message.dependency.length) - for (var i = 0; i < message.dependency.length; ++i) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); - if (message.messageType != null && message.messageType.length) - for (var i = 0; i < message.messageType.length; ++i) - $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.enumType != null && message.enumType.length) - for (var i = 0; i < message.enumType.length; ++i) - $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.service != null && message.service.length) - for (var i = 0; i < message.service.length; ++i) - $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.extension != null && message.extension.length) - for (var i = 0; i < message.extension.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) - $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.publicDependency != null && message.publicDependency.length) - for (var i = 0; i < message.publicDependency.length; ++i) - writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); - if (message.weakDependency != null && message.weakDependency.length) - for (var i = 0; i < message.weakDependency.length; ++i) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); - if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) - writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); - if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); - if (message.optionDependency != null && message.optionDependency.length) - for (var i = 0; i < message.optionDependency.length; ++i) - writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); - return writer; - }; - - /** - * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FileDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorProto.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message["package"] = reader.string(); - break; - } - case 3: { - if (!(message.dependency && message.dependency.length)) - message.dependency = []; - message.dependency.push(reader.string()); - break; - } - case 10: { - if (!(message.publicDependency && message.publicDependency.length)) - message.publicDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.publicDependency.push(reader.int32()); - } else - message.publicDependency.push(reader.int32()); - break; - } - case 11: { - if (!(message.weakDependency && message.weakDependency.length)) - message.weakDependency = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.weakDependency.push(reader.int32()); - } else - message.weakDependency.push(reader.int32()); - break; - } - case 15: { - if (!(message.optionDependency && message.optionDependency.length)) - message.optionDependency = []; - message.optionDependency.push(reader.string()); - break; - } - case 4: { - if (!(message.messageType && message.messageType.length)) - message.messageType = []; - message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.service && message.service.length)) - message.service = []; - message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 7: { - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 8: { - message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); - break; - } - case 9: { - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); - break; - } - case 12: { - message.syntax = reader.string(); - break; - } - case 14: { - message.edition = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FileDescriptorProto message. - * @function verify - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FileDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message["package"] != null && message.hasOwnProperty("package")) - if (!$util.isString(message["package"])) - return "package: string expected"; - if (message.dependency != null && message.hasOwnProperty("dependency")) { - if (!Array.isArray(message.dependency)) - return "dependency: array expected"; - for (var i = 0; i < message.dependency.length; ++i) - if (!$util.isString(message.dependency[i])) - return "dependency: string[] expected"; - } - if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { - if (!Array.isArray(message.publicDependency)) - return "publicDependency: array expected"; - for (var i = 0; i < message.publicDependency.length; ++i) - if (!$util.isInteger(message.publicDependency[i])) - return "publicDependency: integer[] expected"; - } - if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { - if (!Array.isArray(message.weakDependency)) - return "weakDependency: array expected"; - for (var i = 0; i < message.weakDependency.length; ++i) - if (!$util.isInteger(message.weakDependency[i])) - return "weakDependency: integer[] expected"; - } - if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { - if (!Array.isArray(message.optionDependency)) - return "optionDependency: array expected"; - for (var i = 0; i < message.optionDependency.length; ++i) - if (!$util.isString(message.optionDependency[i])) - return "optionDependency: string[] expected"; - } - if (message.messageType != null && message.hasOwnProperty("messageType")) { - if (!Array.isArray(message.messageType)) - return "messageType: array expected"; - for (var i = 0; i < message.messageType.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); - if (error) - return "messageType." + error; - } - } - if (message.enumType != null && message.hasOwnProperty("enumType")) { - if (!Array.isArray(message.enumType)) - return "enumType: array expected"; - for (var i = 0; i < message.enumType.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); - if (error) - return "enumType." + error; - } - } - if (message.service != null && message.hasOwnProperty("service")) { - if (!Array.isArray(message.service)) - return "service: array expected"; - for (var i = 0; i < message.service.length; ++i) { - var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); - if (error) - return "service." + error; - } - } - if (message.extension != null && message.hasOwnProperty("extension")) { - if (!Array.isArray(message.extension)) - return "extension: array expected"; - for (var i = 0; i < message.extension.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); - if (error) - return "extension." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.FileOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { - var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); - if (error) - return "sourceCodeInfo." + error; - } - if (message.syntax != null && message.hasOwnProperty("syntax")) - if (!$util.isString(message.syntax)) - return "syntax: string expected"; - if (message.edition != null && message.hasOwnProperty("edition")) - switch (message.edition) { - default: - return "edition: enum value expected"; - case 0: - case 900: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - return null; - }; - - /** - * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto - */ - FileDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileDescriptorProto) - return object; - var message = new $root.google.protobuf.FileDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object["package"] != null) - message["package"] = String(object["package"]); - if (object.dependency) { - if (!Array.isArray(object.dependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); - message.dependency = []; - for (var i = 0; i < object.dependency.length; ++i) - message.dependency[i] = String(object.dependency[i]); - } - if (object.publicDependency) { - if (!Array.isArray(object.publicDependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); - message.publicDependency = []; - for (var i = 0; i < object.publicDependency.length; ++i) - message.publicDependency[i] = object.publicDependency[i] | 0; - } - if (object.weakDependency) { - if (!Array.isArray(object.weakDependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); - message.weakDependency = []; - for (var i = 0; i < object.weakDependency.length; ++i) - message.weakDependency[i] = object.weakDependency[i] | 0; - } - if (object.optionDependency) { - if (!Array.isArray(object.optionDependency)) - throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); - message.optionDependency = []; - for (var i = 0; i < object.optionDependency.length; ++i) - message.optionDependency[i] = String(object.optionDependency[i]); - } - if (object.messageType) { - if (!Array.isArray(object.messageType)) - throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); - message.messageType = []; - for (var i = 0; i < object.messageType.length; ++i) { - if (typeof object.messageType[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); - message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); - } - } - if (object.enumType) { - if (!Array.isArray(object.enumType)) - throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); - message.enumType = []; - for (var i = 0; i < object.enumType.length; ++i) { - if (typeof object.enumType[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); - message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); - } - } - if (object.service) { - if (!Array.isArray(object.service)) - throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); - message.service = []; - for (var i = 0; i < object.service.length; ++i) { - if (typeof object.service[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); - message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); - } - } - if (object.extension) { - if (!Array.isArray(object.extension)) - throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); - message.extension = []; - for (var i = 0; i < object.extension.length; ++i) { - if (typeof object.extension[i] !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); - message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.FileOptions.fromObject(object.options); - } - if (object.sourceCodeInfo != null) { - if (typeof object.sourceCodeInfo !== "object") - throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); - message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); - } - if (object.syntax != null) - message.syntax = String(object.syntax); - switch (object.edition) { - default: - if (typeof object.edition === "number") { - message.edition = object.edition; - break; - } - break; - case "EDITION_UNKNOWN": - case 0: - message.edition = 0; - break; - case "EDITION_LEGACY": - case 900: - message.edition = 900; - break; - case "EDITION_PROTO2": - case 998: - message.edition = 998; - break; - case "EDITION_PROTO3": - case 999: - message.edition = 999; - break; - case "EDITION_2023": - case 1000: - message.edition = 1000; - break; - case "EDITION_2024": - case 1001: - message.edition = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.edition = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.edition = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.edition = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.edition = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.edition = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.edition = 2147483647; - break; - } - return message; - }; - - /** - * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FileDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.dependency = []; - object.messageType = []; - object.enumType = []; - object.service = []; - object.extension = []; - object.publicDependency = []; - object.weakDependency = []; - object.optionDependency = []; - } - if (options.defaults) { - object.name = ""; - object["package"] = ""; - object.options = null; - object.sourceCodeInfo = null; - object.syntax = ""; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message["package"] != null && message.hasOwnProperty("package")) - object["package"] = message["package"]; - if (message.dependency && message.dependency.length) { - object.dependency = []; - for (var j = 0; j < message.dependency.length; ++j) - object.dependency[j] = message.dependency[j]; - } - if (message.messageType && message.messageType.length) { - object.messageType = []; - for (var j = 0; j < message.messageType.length; ++j) - object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); - } - if (message.enumType && message.enumType.length) { - object.enumType = []; - for (var j = 0; j < message.enumType.length; ++j) - object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); - } - if (message.service && message.service.length) { - object.service = []; - for (var j = 0; j < message.service.length; ++j) - object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); - } - if (message.extension && message.extension.length) { - object.extension = []; - for (var j = 0; j < message.extension.length; ++j) - object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); - if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) - object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); - if (message.publicDependency && message.publicDependency.length) { - object.publicDependency = []; - for (var j = 0; j < message.publicDependency.length; ++j) - object.publicDependency[j] = message.publicDependency[j]; - } - if (message.weakDependency && message.weakDependency.length) { - object.weakDependency = []; - for (var j = 0; j < message.weakDependency.length; ++j) - object.weakDependency[j] = message.weakDependency[j]; - } - if (message.syntax != null && message.hasOwnProperty("syntax")) - object.syntax = message.syntax; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; - if (message.optionDependency && message.optionDependency.length) { - object.optionDependency = []; - for (var j = 0; j < message.optionDependency.length; ++j) - object.optionDependency[j] = message.optionDependency[j]; - } - return object; - }; - - /** - * Converts this FileDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.FileDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - FileDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FileDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.FileDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; - }; - - return FileDescriptorProto; - })(); - - protobuf.DescriptorProto = (function() { - - /** - * Properties of a DescriptorProto. - * @memberof google.protobuf - * @interface IDescriptorProto - * @property {string|null} [name] DescriptorProto name - * @property {Array.|null} [field] DescriptorProto field - * @property {Array.|null} [extension] DescriptorProto extension - * @property {Array.|null} [nestedType] DescriptorProto nestedType - * @property {Array.|null} [enumType] DescriptorProto enumType - * @property {Array.|null} [extensionRange] DescriptorProto extensionRange - * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl - * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options - * @property {Array.|null} [reservedRange] DescriptorProto reservedRange - * @property {Array.|null} [reservedName] DescriptorProto reservedName - * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility - */ - - /** - * Constructs a new DescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a DescriptorProto. - * @implements IDescriptorProto - * @constructor - * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set - */ - function DescriptorProto(properties) { - this.field = []; - this.extension = []; - this.nestedType = []; - this.enumType = []; - this.extensionRange = []; - this.oneofDecl = []; - this.reservedRange = []; - this.reservedName = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DescriptorProto name. - * @member {string} name - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.name = ""; - - /** - * DescriptorProto field. - * @member {Array.} field - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.field = $util.emptyArray; - - /** - * DescriptorProto extension. - * @member {Array.} extension - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.extension = $util.emptyArray; - - /** - * DescriptorProto nestedType. - * @member {Array.} nestedType - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.nestedType = $util.emptyArray; - - /** - * DescriptorProto enumType. - * @member {Array.} enumType - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.enumType = $util.emptyArray; - - /** - * DescriptorProto extensionRange. - * @member {Array.} extensionRange - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.extensionRange = $util.emptyArray; - - /** - * DescriptorProto oneofDecl. - * @member {Array.} oneofDecl - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.oneofDecl = $util.emptyArray; - - /** - * DescriptorProto options. - * @member {google.protobuf.IMessageOptions|null|undefined} options - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.options = null; - - /** - * DescriptorProto reservedRange. - * @member {Array.} reservedRange - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.reservedRange = $util.emptyArray; - - /** - * DescriptorProto reservedName. - * @member {Array.} reservedName - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.reservedName = $util.emptyArray; - - /** - * DescriptorProto visibility. - * @member {google.protobuf.SymbolVisibility} visibility - * @memberof google.protobuf.DescriptorProto - * @instance - */ - DescriptorProto.prototype.visibility = 0; - - /** - * Creates a new DescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto} DescriptorProto instance - */ - DescriptorProto.create = function create(properties) { - return new DescriptorProto(properties); - }; - - /** - * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.field != null && message.field.length) - for (var i = 0; i < message.field.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.nestedType != null && message.nestedType.length) - for (var i = 0; i < message.nestedType.length; ++i) - $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.enumType != null && message.enumType.length) - for (var i = 0; i < message.enumType.length; ++i) - $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.extensionRange != null && message.extensionRange.length) - for (var i = 0; i < message.extensionRange.length; ++i) - $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - if (message.extension != null && message.extension.length) - for (var i = 0; i < message.extension.length; ++i) - $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.oneofDecl != null && message.oneofDecl.length) - for (var i = 0; i < message.oneofDecl.length; ++i) - $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.reservedRange != null && message.reservedRange.length) - for (var i = 0; i < message.reservedRange.length; ++i) - $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); - if (message.reservedName != null && message.reservedName.length) - for (var i = 0; i < message.reservedName.length; ++i) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); - if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) - writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); - return writer; - }; - - /** - * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto} DescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DescriptorProto.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - if (!(message.field && message.field.length)) - message.field = []; - message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 6: { - if (!(message.extension && message.extension.length)) - message.extension = []; - message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 3: { - if (!(message.nestedType && message.nestedType.length)) - message.nestedType = []; - message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); - break; - } - case 4: { - if (!(message.enumType && message.enumType.length)) - message.enumType = []; - message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.extensionRange && message.extensionRange.length)) - message.extensionRange = []; - message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); - break; - } - case 8: { - if (!(message.oneofDecl && message.oneofDecl.length)) - message.oneofDecl = []; - message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 7: { - message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); - break; - } - case 9: { - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); - break; - } - case 10: { - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); - break; - } - case 11: { - message.visibility = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto} DescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DescriptorProto message. - * @function verify - * @memberof google.protobuf.DescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.field != null && message.hasOwnProperty("field")) { - if (!Array.isArray(message.field)) - return "field: array expected"; - for (var i = 0; i < message.field.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); - if (error) - return "field." + error; - } - } - if (message.extension != null && message.hasOwnProperty("extension")) { - if (!Array.isArray(message.extension)) - return "extension: array expected"; - for (var i = 0; i < message.extension.length; ++i) { - var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); - if (error) - return "extension." + error; - } - } - if (message.nestedType != null && message.hasOwnProperty("nestedType")) { - if (!Array.isArray(message.nestedType)) - return "nestedType: array expected"; - for (var i = 0; i < message.nestedType.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); - if (error) - return "nestedType." + error; - } - } - if (message.enumType != null && message.hasOwnProperty("enumType")) { - if (!Array.isArray(message.enumType)) - return "enumType: array expected"; - for (var i = 0; i < message.enumType.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); - if (error) - return "enumType." + error; - } - } - if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { - if (!Array.isArray(message.extensionRange)) - return "extensionRange: array expected"; - for (var i = 0; i < message.extensionRange.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); - if (error) - return "extensionRange." + error; - } - } - if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { - if (!Array.isArray(message.oneofDecl)) - return "oneofDecl: array expected"; - for (var i = 0; i < message.oneofDecl.length; ++i) { - var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); - if (error) - return "oneofDecl." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.MessageOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { - if (!Array.isArray(message.reservedRange)) - return "reservedRange: array expected"; - for (var i = 0; i < message.reservedRange.length; ++i) { - var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); - if (error) - return "reservedRange." + error; - } - } - if (message.reservedName != null && message.hasOwnProperty("reservedName")) { - if (!Array.isArray(message.reservedName)) - return "reservedName: array expected"; - for (var i = 0; i < message.reservedName.length; ++i) - if (!$util.isString(message.reservedName[i])) - return "reservedName: string[] expected"; - } - if (message.visibility != null && message.hasOwnProperty("visibility")) - switch (message.visibility) { - default: - return "visibility: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto} DescriptorProto - */ - DescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto) - return object; - var message = new $root.google.protobuf.DescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.field) { - if (!Array.isArray(object.field)) - throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); - message.field = []; - for (var i = 0; i < object.field.length; ++i) { - if (typeof object.field[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); - message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); - } - } - if (object.extension) { - if (!Array.isArray(object.extension)) - throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); - message.extension = []; - for (var i = 0; i < object.extension.length; ++i) { - if (typeof object.extension[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); - message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); - } - } - if (object.nestedType) { - if (!Array.isArray(object.nestedType)) - throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); - message.nestedType = []; - for (var i = 0; i < object.nestedType.length; ++i) { - if (typeof object.nestedType[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); - message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); - } - } - if (object.enumType) { - if (!Array.isArray(object.enumType)) - throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); - message.enumType = []; - for (var i = 0; i < object.enumType.length; ++i) { - if (typeof object.enumType[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); - message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); - } - } - if (object.extensionRange) { - if (!Array.isArray(object.extensionRange)) - throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); - message.extensionRange = []; - for (var i = 0; i < object.extensionRange.length; ++i) { - if (typeof object.extensionRange[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); - message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); - } - } - if (object.oneofDecl) { - if (!Array.isArray(object.oneofDecl)) - throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); - message.oneofDecl = []; - for (var i = 0; i < object.oneofDecl.length; ++i) { - if (typeof object.oneofDecl[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); - message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); - message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); - } - if (object.reservedRange) { - if (!Array.isArray(object.reservedRange)) - throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); - message.reservedRange = []; - for (var i = 0; i < object.reservedRange.length; ++i) { - if (typeof object.reservedRange[i] !== "object") - throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); - message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); - } - } - if (object.reservedName) { - if (!Array.isArray(object.reservedName)) - throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); - message.reservedName = []; - for (var i = 0; i < object.reservedName.length; ++i) - message.reservedName[i] = String(object.reservedName[i]); - } - switch (object.visibility) { - default: - if (typeof object.visibility === "number") { - message.visibility = object.visibility; - break; - } - break; - case "VISIBILITY_UNSET": - case 0: - message.visibility = 0; - break; - case "VISIBILITY_LOCAL": - case 1: - message.visibility = 1; - break; - case "VISIBILITY_EXPORT": - case 2: - message.visibility = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto - * @static - * @param {google.protobuf.DescriptorProto} message DescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.field = []; - object.nestedType = []; - object.enumType = []; - object.extensionRange = []; - object.extension = []; - object.oneofDecl = []; - object.reservedRange = []; - object.reservedName = []; - } - if (options.defaults) { - object.name = ""; - object.options = null; - object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.field && message.field.length) { - object.field = []; - for (var j = 0; j < message.field.length; ++j) - object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); - } - if (message.nestedType && message.nestedType.length) { - object.nestedType = []; - for (var j = 0; j < message.nestedType.length; ++j) - object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); - } - if (message.enumType && message.enumType.length) { - object.enumType = []; - for (var j = 0; j < message.enumType.length; ++j) - object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); - } - if (message.extensionRange && message.extensionRange.length) { - object.extensionRange = []; - for (var j = 0; j < message.extensionRange.length; ++j) - object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); - } - if (message.extension && message.extension.length) { - object.extension = []; - for (var j = 0; j < message.extension.length; ++j) - object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); - if (message.oneofDecl && message.oneofDecl.length) { - object.oneofDecl = []; - for (var j = 0; j < message.oneofDecl.length; ++j) - object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); - } - if (message.reservedRange && message.reservedRange.length) { - object.reservedRange = []; - for (var j = 0; j < message.reservedRange.length; ++j) - object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); - } - if (message.reservedName && message.reservedName.length) { - object.reservedName = []; - for (var j = 0; j < message.reservedName.length; ++j) - object.reservedName[j] = message.reservedName[j]; - } - if (message.visibility != null && message.hasOwnProperty("visibility")) - object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; - return object; - }; - - /** - * Converts this DescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto - * @instance - * @returns {Object.} JSON object - */ - DescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.DescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.DescriptorProto"; - }; - - DescriptorProto.ExtensionRange = (function() { - - /** - * Properties of an ExtensionRange. - * @memberof google.protobuf.DescriptorProto - * @interface IExtensionRange - * @property {number|null} [start] ExtensionRange start - * @property {number|null} [end] ExtensionRange end - * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options - */ - - /** - * Constructs a new ExtensionRange. - * @memberof google.protobuf.DescriptorProto - * @classdesc Represents an ExtensionRange. - * @implements IExtensionRange - * @constructor - * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set - */ - function ExtensionRange(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExtensionRange start. - * @member {number} start - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.start = 0; - - /** - * ExtensionRange end. - * @member {number} end - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.end = 0; - - /** - * ExtensionRange options. - * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - */ - ExtensionRange.prototype.options = null; - - /** - * Creates a new ExtensionRange instance using the specified properties. - * @function create - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance - */ - ExtensionRange.create = function create(properties) { - return new ExtensionRange(properties); - }; - - /** - * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExtensionRange message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRange.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.start = reader.int32(); - break; - } - case 2: { - message.end = reader.int32(); - break; - } - case 3: { - message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExtensionRange message. - * @function verify - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExtensionRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange - */ - ExtensionRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) - return object; - var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); - message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExtensionRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.start = 0; - object.end = 0; - object.options = null; - } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this ExtensionRange to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @instance - * @returns {Object.} JSON object - */ - ExtensionRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExtensionRange - * @function getTypeUrl - * @memberof google.protobuf.DescriptorProto.ExtensionRange - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; - }; - - return ExtensionRange; - })(); - - DescriptorProto.ReservedRange = (function() { - - /** - * Properties of a ReservedRange. - * @memberof google.protobuf.DescriptorProto - * @interface IReservedRange - * @property {number|null} [start] ReservedRange start - * @property {number|null} [end] ReservedRange end - */ - - /** - * Constructs a new ReservedRange. - * @memberof google.protobuf.DescriptorProto - * @classdesc Represents a ReservedRange. - * @implements IReservedRange - * @constructor - * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set - */ - function ReservedRange(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ReservedRange start. - * @member {number} start - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - */ - ReservedRange.prototype.start = 0; - - /** - * ReservedRange end. - * @member {number} end - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - */ - ReservedRange.prototype.end = 0; - - /** - * Creates a new ReservedRange instance using the specified properties. - * @function create - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance - */ - ReservedRange.create = function create(properties) { - return new ReservedRange(properties); - }; - - /** - * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReservedRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - return writer; - }; - - /** - * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ReservedRange message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReservedRange.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.start = reader.int32(); - break; - } - case 2: { - message.end = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ReservedRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ReservedRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ReservedRange message. - * @function verify - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ReservedRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - return null; - }; - - /** - * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange - */ - ReservedRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) - return object; - var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; - return message; - }; - - /** - * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ReservedRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.start = 0; - object.end = 0; - } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - return object; - }; - - /** - * Converts this ReservedRange to JSON. - * @function toJSON - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @instance - * @returns {Object.} JSON object - */ - ReservedRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ReservedRange - * @function getTypeUrl - * @memberof google.protobuf.DescriptorProto.ReservedRange - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; - }; - - return ReservedRange; - })(); - - return DescriptorProto; - })(); - - protobuf.ExtensionRangeOptions = (function() { - - /** - * Properties of an ExtensionRangeOptions. - * @memberof google.protobuf - * @interface IExtensionRangeOptions - * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption - * @property {Array.|null} [declaration] ExtensionRangeOptions declaration - * @property {google.protobuf.IFeatureSet|null} [features] ExtensionRangeOptions features - * @property {google.protobuf.ExtensionRangeOptions.VerificationState|null} [verification] ExtensionRangeOptions verification - */ - - /** - * Constructs a new ExtensionRangeOptions. - * @memberof google.protobuf - * @classdesc Represents an ExtensionRangeOptions. - * @implements IExtensionRangeOptions - * @constructor - * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set - */ - function ExtensionRangeOptions(properties) { - this.uninterpretedOption = []; - this.declaration = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ExtensionRangeOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - */ - ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * ExtensionRangeOptions declaration. - * @member {Array.} declaration - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - */ - ExtensionRangeOptions.prototype.declaration = $util.emptyArray; - - /** - * ExtensionRangeOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - */ - ExtensionRangeOptions.prototype.features = null; - - /** - * ExtensionRangeOptions verification. - * @member {google.protobuf.ExtensionRangeOptions.VerificationState} verification - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - */ - ExtensionRangeOptions.prototype.verification = 1; - - /** - * Creates a new ExtensionRangeOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance - */ - ExtensionRangeOptions.create = function create(properties) { - return new ExtensionRangeOptions(properties); - }; - - /** - * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRangeOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.declaration != null && message.declaration.length) - for (var i = 0; i < message.declaration.length; ++i) - $root.google.protobuf.ExtensionRangeOptions.Declaration.encode(message.declaration[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.verification); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an ExtensionRangeOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRangeOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 2: { - if (!(message.declaration && message.declaration.length)) - message.declaration = []; - message.declaration.push($root.google.protobuf.ExtensionRangeOptions.Declaration.decode(reader, reader.uint32())); - break; - } - case 50: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 3: { - message.verification = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an ExtensionRangeOptions message. - * @function verify - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ExtensionRangeOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message.declaration != null && message.hasOwnProperty("declaration")) { - if (!Array.isArray(message.declaration)) - return "declaration: array expected"; - for (var i = 0; i < message.declaration.length; ++i) { - var error = $root.google.protobuf.ExtensionRangeOptions.Declaration.verify(message.declaration[i]); - if (error) - return "declaration." + error; - } - } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.verification != null && message.hasOwnProperty("verification")) - switch (message.verification) { - default: - return "verification: enum value expected"; - case 0: - case 1: - break; - } - return null; - }; - - /** - * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions - */ - ExtensionRangeOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ExtensionRangeOptions) - return object; - var message = new $root.google.protobuf.ExtensionRangeOptions(); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object.declaration) { - if (!Array.isArray(object.declaration)) - throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: array expected"); - message.declaration = []; - for (var i = 0; i < object.declaration.length; ++i) { - if (typeof object.declaration[i] !== "object") - throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: object expected"); - message.declaration[i] = $root.google.protobuf.ExtensionRangeOptions.Declaration.fromObject(object.declaration[i]); - } - } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.ExtensionRangeOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - switch (object.verification) { - case "DECLARATION": - case 0: - message.verification = 0; - break; - default: - if (typeof object.verification === "number") { - message.verification = object.verification; - break; - } - break; - case "UNVERIFIED": - case 1: - message.verification = 1; - break; - } - return message; - }; - - /** - * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ExtensionRangeOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.declaration = []; - object.uninterpretedOption = []; - } - if (options.defaults) { - object.verification = options.enums === String ? "UNVERIFIED" : 1; - object.features = null; - } - if (message.declaration && message.declaration.length) { - object.declaration = []; - for (var j = 0; j < message.declaration.length; ++j) - object.declaration[j] = $root.google.protobuf.ExtensionRangeOptions.Declaration.toObject(message.declaration[j], options); - } - if (message.verification != null && message.hasOwnProperty("verification")) - object.verification = options.enums === String ? $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] === undefined ? message.verification : $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] : message.verification; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - return object; - }; - - /** - * Converts this ExtensionRangeOptions to JSON. - * @function toJSON - * @memberof google.protobuf.ExtensionRangeOptions - * @instance - * @returns {Object.} JSON object - */ - ExtensionRangeOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ExtensionRangeOptions - * @function getTypeUrl - * @memberof google.protobuf.ExtensionRangeOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; - }; - - ExtensionRangeOptions.Declaration = (function() { - - /** - * Properties of a Declaration. - * @memberof google.protobuf.ExtensionRangeOptions - * @interface IDeclaration - * @property {number|null} [number] Declaration number - * @property {string|null} [fullName] Declaration fullName - * @property {string|null} [type] Declaration type - * @property {boolean|null} [reserved] Declaration reserved - * @property {boolean|null} [repeated] Declaration repeated - */ - - /** - * Constructs a new Declaration. - * @memberof google.protobuf.ExtensionRangeOptions - * @classdesc Represents a Declaration. - * @implements IDeclaration - * @constructor - * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set - */ - function Declaration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Declaration number. - * @member {number} number - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - */ - Declaration.prototype.number = 0; - - /** - * Declaration fullName. - * @member {string} fullName - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - */ - Declaration.prototype.fullName = ""; - - /** - * Declaration type. - * @member {string} type - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - */ - Declaration.prototype.type = ""; - - /** - * Declaration reserved. - * @member {boolean} reserved - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - */ - Declaration.prototype.reserved = false; - - /** - * Declaration repeated. - * @member {boolean} repeated - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - */ - Declaration.prototype.repeated = false; - - /** - * Creates a new Declaration instance using the specified properties. - * @function create - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set - * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration instance - */ - Declaration.create = function create(properties) { - return new Declaration(properties); - }; - - /** - * Encodes the specified Declaration message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Declaration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.number); - if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.fullName); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.type); - if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.reserved); - if (message.repeated != null && Object.hasOwnProperty.call(message, "repeated")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.repeated); - return writer; - }; - - /** - * Encodes the specified Declaration message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Declaration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Declaration message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Declaration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.number = reader.int32(); - break; - } - case 2: { - message.fullName = reader.string(); - break; - } - case 3: { - message.type = reader.string(); - break; - } - case 5: { - message.reserved = reader.bool(); - break; - } - case 6: { - message.repeated = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Declaration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Declaration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Declaration message. - * @function verify - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Declaration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.fullName != null && message.hasOwnProperty("fullName")) - if (!$util.isString(message.fullName)) - return "fullName: string expected"; - if (message.type != null && message.hasOwnProperty("type")) - if (!$util.isString(message.type)) - return "type: string expected"; - if (message.reserved != null && message.hasOwnProperty("reserved")) - if (typeof message.reserved !== "boolean") - return "reserved: boolean expected"; - if (message.repeated != null && message.hasOwnProperty("repeated")) - if (typeof message.repeated !== "boolean") - return "repeated: boolean expected"; - return null; - }; - - /** - * Creates a Declaration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration - */ - Declaration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ExtensionRangeOptions.Declaration) - return object; - var message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); - if (object.number != null) - message.number = object.number | 0; - if (object.fullName != null) - message.fullName = String(object.fullName); - if (object.type != null) - message.type = String(object.type); - if (object.reserved != null) - message.reserved = Boolean(object.reserved); - if (object.repeated != null) - message.repeated = Boolean(object.repeated); - return message; - }; - - /** - * Creates a plain object from a Declaration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {google.protobuf.ExtensionRangeOptions.Declaration} message Declaration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Declaration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.number = 0; - object.fullName = ""; - object.type = ""; - object.reserved = false; - object.repeated = false; - } - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.fullName != null && message.hasOwnProperty("fullName")) - object.fullName = message.fullName; - if (message.type != null && message.hasOwnProperty("type")) - object.type = message.type; - if (message.reserved != null && message.hasOwnProperty("reserved")) - object.reserved = message.reserved; - if (message.repeated != null && message.hasOwnProperty("repeated")) - object.repeated = message.repeated; - return object; - }; - - /** - * Converts this Declaration to JSON. - * @function toJSON - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @instance - * @returns {Object.} JSON object - */ - Declaration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Declaration - * @function getTypeUrl - * @memberof google.protobuf.ExtensionRangeOptions.Declaration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Declaration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions.Declaration"; - }; - - return Declaration; - })(); - - /** - * VerificationState enum. - * @name google.protobuf.ExtensionRangeOptions.VerificationState - * @enum {number} - * @property {number} DECLARATION=0 DECLARATION value - * @property {number} UNVERIFIED=1 UNVERIFIED value - */ - ExtensionRangeOptions.VerificationState = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DECLARATION"] = 0; - values[valuesById[1] = "UNVERIFIED"] = 1; - return values; - })(); - - return ExtensionRangeOptions; - })(); - - protobuf.FieldDescriptorProto = (function() { - - /** - * Properties of a FieldDescriptorProto. - * @memberof google.protobuf - * @interface IFieldDescriptorProto - * @property {string|null} [name] FieldDescriptorProto name - * @property {number|null} [number] FieldDescriptorProto number - * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label - * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type - * @property {string|null} [typeName] FieldDescriptorProto typeName - * @property {string|null} [extendee] FieldDescriptorProto extendee - * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue - * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex - * @property {string|null} [jsonName] FieldDescriptorProto jsonName - * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options - * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional - */ - - /** - * Constructs a new FieldDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a FieldDescriptorProto. - * @implements IFieldDescriptorProto - * @constructor - * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set - */ - function FieldDescriptorProto(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FieldDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.name = ""; - - /** - * FieldDescriptorProto number. - * @member {number} number - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.number = 0; - - /** - * FieldDescriptorProto label. - * @member {google.protobuf.FieldDescriptorProto.Label} label - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.label = 1; - - /** - * FieldDescriptorProto type. - * @member {google.protobuf.FieldDescriptorProto.Type} type - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.type = 1; - - /** - * FieldDescriptorProto typeName. - * @member {string} typeName - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.typeName = ""; - - /** - * FieldDescriptorProto extendee. - * @member {string} extendee - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.extendee = ""; - - /** - * FieldDescriptorProto defaultValue. - * @member {string} defaultValue - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.defaultValue = ""; - - /** - * FieldDescriptorProto oneofIndex. - * @member {number} oneofIndex - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.oneofIndex = 0; - - /** - * FieldDescriptorProto jsonName. - * @member {string} jsonName - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.jsonName = ""; - - /** - * FieldDescriptorProto options. - * @member {google.protobuf.IFieldOptions|null|undefined} options - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.options = null; - - /** - * FieldDescriptorProto proto3Optional. - * @member {boolean} proto3Optional - * @memberof google.protobuf.FieldDescriptorProto - * @instance - */ - FieldDescriptorProto.prototype.proto3Optional = false; - - /** - * Creates a new FieldDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance - */ - FieldDescriptorProto.create = function create(properties) { - return new FieldDescriptorProto(properties); - }; - - /** - * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); - if (message.label != null && Object.hasOwnProperty.call(message, "label")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); - if (message.type != null && Object.hasOwnProperty.call(message, "type")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); - if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); - if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) - writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); - if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); - if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) - writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); - if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) - writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); - return writer; - }; - - /** - * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldDescriptorProto.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 3: { - message.number = reader.int32(); - break; - } - case 4: { - message.label = reader.int32(); - break; - } - case 5: { - message.type = reader.int32(); - break; - } - case 6: { - message.typeName = reader.string(); - break; - } - case 2: { - message.extendee = reader.string(); - break; - } - case 7: { - message.defaultValue = reader.string(); - break; - } - case 9: { - message.oneofIndex = reader.int32(); - break; - } - case 10: { - message.jsonName = reader.string(); - break; - } - case 8: { - message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); - break; - } - case 17: { - message.proto3Optional = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldDescriptorProto message. - * @function verify - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.label != null && message.hasOwnProperty("label")) - switch (message.label) { - default: - return "label: enum value expected"; - case 1: - case 3: - case 2: - break; - } - if (message.type != null && message.hasOwnProperty("type")) - switch (message.type) { - default: - return "type: enum value expected"; - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - break; - } - if (message.typeName != null && message.hasOwnProperty("typeName")) - if (!$util.isString(message.typeName)) - return "typeName: string expected"; - if (message.extendee != null && message.hasOwnProperty("extendee")) - if (!$util.isString(message.extendee)) - return "extendee: string expected"; - if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) - if (!$util.isString(message.defaultValue)) - return "defaultValue: string expected"; - if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) - if (!$util.isInteger(message.oneofIndex)) - return "oneofIndex: integer expected"; - if (message.jsonName != null && message.hasOwnProperty("jsonName")) - if (!$util.isString(message.jsonName)) - return "jsonName: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.FieldOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) - if (typeof message.proto3Optional !== "boolean") - return "proto3Optional: boolean expected"; - return null; - }; - - /** - * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto - */ - FieldDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldDescriptorProto) - return object; - var message = new $root.google.protobuf.FieldDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.number != null) - message.number = object.number | 0; - switch (object.label) { - default: - if (typeof object.label === "number") { - message.label = object.label; - break; - } - break; - case "LABEL_OPTIONAL": - case 1: - message.label = 1; - break; - case "LABEL_REPEATED": - case 3: - message.label = 3; - break; - case "LABEL_REQUIRED": - case 2: - message.label = 2; - break; - } - switch (object.type) { - default: - if (typeof object.type === "number") { - message.type = object.type; - break; - } - break; - case "TYPE_DOUBLE": - case 1: - message.type = 1; - break; - case "TYPE_FLOAT": - case 2: - message.type = 2; - break; - case "TYPE_INT64": - case 3: - message.type = 3; - break; - case "TYPE_UINT64": - case 4: - message.type = 4; - break; - case "TYPE_INT32": - case 5: - message.type = 5; - break; - case "TYPE_FIXED64": - case 6: - message.type = 6; - break; - case "TYPE_FIXED32": - case 7: - message.type = 7; - break; - case "TYPE_BOOL": - case 8: - message.type = 8; - break; - case "TYPE_STRING": - case 9: - message.type = 9; - break; - case "TYPE_GROUP": - case 10: - message.type = 10; - break; - case "TYPE_MESSAGE": - case 11: - message.type = 11; - break; - case "TYPE_BYTES": - case 12: - message.type = 12; - break; - case "TYPE_UINT32": - case 13: - message.type = 13; - break; - case "TYPE_ENUM": - case 14: - message.type = 14; - break; - case "TYPE_SFIXED32": - case 15: - message.type = 15; - break; - case "TYPE_SFIXED64": - case 16: - message.type = 16; - break; - case "TYPE_SINT32": - case 17: - message.type = 17; - break; - case "TYPE_SINT64": - case 18: - message.type = 18; - break; - } - if (object.typeName != null) - message.typeName = String(object.typeName); - if (object.extendee != null) - message.extendee = String(object.extendee); - if (object.defaultValue != null) - message.defaultValue = String(object.defaultValue); - if (object.oneofIndex != null) - message.oneofIndex = object.oneofIndex | 0; - if (object.jsonName != null) - message.jsonName = String(object.jsonName); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); - } - if (object.proto3Optional != null) - message.proto3Optional = Boolean(object.proto3Optional); - return message; - }; - - /** - * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FieldDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.extendee = ""; - object.number = 0; - object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; - object.type = options.enums === String ? "TYPE_DOUBLE" : 1; - object.typeName = ""; - object.defaultValue = ""; - object.options = null; - object.oneofIndex = 0; - object.jsonName = ""; - object.proto3Optional = false; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.extendee != null && message.hasOwnProperty("extendee")) - object.extendee = message.extendee; - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.label != null && message.hasOwnProperty("label")) - object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; - if (message.type != null && message.hasOwnProperty("type")) - object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; - if (message.typeName != null && message.hasOwnProperty("typeName")) - object.typeName = message.typeName; - if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) - object.defaultValue = message.defaultValue; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); - if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) - object.oneofIndex = message.oneofIndex; - if (message.jsonName != null && message.hasOwnProperty("jsonName")) - object.jsonName = message.jsonName; - if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) - object.proto3Optional = message.proto3Optional; - return object; - }; - - /** - * Converts this FieldDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.FieldDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - FieldDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FieldDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.FieldDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; - }; - - /** - * Type enum. - * @name google.protobuf.FieldDescriptorProto.Type - * @enum {number} - * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value - * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value - * @property {number} TYPE_INT64=3 TYPE_INT64 value - * @property {number} TYPE_UINT64=4 TYPE_UINT64 value - * @property {number} TYPE_INT32=5 TYPE_INT32 value - * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value - * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value - * @property {number} TYPE_BOOL=8 TYPE_BOOL value - * @property {number} TYPE_STRING=9 TYPE_STRING value - * @property {number} TYPE_GROUP=10 TYPE_GROUP value - * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value - * @property {number} TYPE_BYTES=12 TYPE_BYTES value - * @property {number} TYPE_UINT32=13 TYPE_UINT32 value - * @property {number} TYPE_ENUM=14 TYPE_ENUM value - * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value - * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value - * @property {number} TYPE_SINT32=17 TYPE_SINT32 value - * @property {number} TYPE_SINT64=18 TYPE_SINT64 value - */ - FieldDescriptorProto.Type = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "TYPE_DOUBLE"] = 1; - values[valuesById[2] = "TYPE_FLOAT"] = 2; - values[valuesById[3] = "TYPE_INT64"] = 3; - values[valuesById[4] = "TYPE_UINT64"] = 4; - values[valuesById[5] = "TYPE_INT32"] = 5; - values[valuesById[6] = "TYPE_FIXED64"] = 6; - values[valuesById[7] = "TYPE_FIXED32"] = 7; - values[valuesById[8] = "TYPE_BOOL"] = 8; - values[valuesById[9] = "TYPE_STRING"] = 9; - values[valuesById[10] = "TYPE_GROUP"] = 10; - values[valuesById[11] = "TYPE_MESSAGE"] = 11; - values[valuesById[12] = "TYPE_BYTES"] = 12; - values[valuesById[13] = "TYPE_UINT32"] = 13; - values[valuesById[14] = "TYPE_ENUM"] = 14; - values[valuesById[15] = "TYPE_SFIXED32"] = 15; - values[valuesById[16] = "TYPE_SFIXED64"] = 16; - values[valuesById[17] = "TYPE_SINT32"] = 17; - values[valuesById[18] = "TYPE_SINT64"] = 18; - return values; - })(); - - /** - * Label enum. - * @name google.protobuf.FieldDescriptorProto.Label - * @enum {number} - * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value - * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value - * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value - */ - FieldDescriptorProto.Label = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "LABEL_OPTIONAL"] = 1; - values[valuesById[3] = "LABEL_REPEATED"] = 3; - values[valuesById[2] = "LABEL_REQUIRED"] = 2; - return values; - })(); - - return FieldDescriptorProto; - })(); - - protobuf.OneofDescriptorProto = (function() { - - /** - * Properties of an OneofDescriptorProto. - * @memberof google.protobuf - * @interface IOneofDescriptorProto - * @property {string|null} [name] OneofDescriptorProto name - * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options - */ - - /** - * Constructs a new OneofDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an OneofDescriptorProto. - * @implements IOneofDescriptorProto - * @constructor - * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set - */ - function OneofDescriptorProto(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OneofDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.OneofDescriptorProto - * @instance - */ - OneofDescriptorProto.prototype.name = ""; - - /** - * OneofDescriptorProto options. - * @member {google.protobuf.IOneofOptions|null|undefined} options - * @memberof google.protobuf.OneofDescriptorProto - * @instance - */ - OneofDescriptorProto.prototype.options = null; - - /** - * Creates a new OneofDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance - */ - OneofDescriptorProto.create = function create(properties) { - return new OneofDescriptorProto(properties); - }; - - /** - * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofDescriptorProto.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OneofDescriptorProto message. - * @function verify - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OneofDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.OneofOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto - */ - OneofDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.OneofDescriptorProto) - return object; - var message = new $root.google.protobuf.OneofDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OneofDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this OneofDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.OneofDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - OneofDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OneofDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.OneofDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; - }; - - return OneofDescriptorProto; - })(); - - protobuf.EnumDescriptorProto = (function() { - - /** - * Properties of an EnumDescriptorProto. - * @memberof google.protobuf - * @interface IEnumDescriptorProto - * @property {string|null} [name] EnumDescriptorProto name - * @property {Array.|null} [value] EnumDescriptorProto value - * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options - * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange - * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName - * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility - */ - - /** - * Constructs a new EnumDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an EnumDescriptorProto. - * @implements IEnumDescriptorProto - * @constructor - * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set - */ - function EnumDescriptorProto(properties) { - this.value = []; - this.reservedRange = []; - this.reservedName = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EnumDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.name = ""; - - /** - * EnumDescriptorProto value. - * @member {Array.} value - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.value = $util.emptyArray; - - /** - * EnumDescriptorProto options. - * @member {google.protobuf.IEnumOptions|null|undefined} options - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.options = null; - - /** - * EnumDescriptorProto reservedRange. - * @member {Array.} reservedRange - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; - - /** - * EnumDescriptorProto reservedName. - * @member {Array.} reservedName - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.reservedName = $util.emptyArray; - - /** - * EnumDescriptorProto visibility. - * @member {google.protobuf.SymbolVisibility} visibility - * @memberof google.protobuf.EnumDescriptorProto - * @instance - */ - EnumDescriptorProto.prototype.visibility = 0; - - /** - * Creates a new EnumDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance - */ - EnumDescriptorProto.create = function create(properties) { - return new EnumDescriptorProto(properties); - }; - - /** - * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.value != null && message.value.length) - for (var i = 0; i < message.value.length; ++i) - $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - if (message.reservedRange != null && message.reservedRange.length) - for (var i = 0; i < message.reservedRange.length; ++i) - $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.reservedName != null && message.reservedName.length) - for (var i = 0; i < message.reservedName.length; ++i) - writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); - if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); - return writer; - }; - - /** - * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumDescriptorProto.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - if (!(message.value && message.value.length)) - message.value = []; - message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 3: { - message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); - break; - } - case 4: { - if (!(message.reservedRange && message.reservedRange.length)) - message.reservedRange = []; - message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); - break; - } - case 5: { - if (!(message.reservedName && message.reservedName.length)) - message.reservedName = []; - message.reservedName.push(reader.string()); - break; - } - case 6: { - message.visibility = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumDescriptorProto message. - * @function verify - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.value != null && message.hasOwnProperty("value")) { - if (!Array.isArray(message.value)) - return "value: array expected"; - for (var i = 0; i < message.value.length; ++i) { - var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); - if (error) - return "value." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.EnumOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { - if (!Array.isArray(message.reservedRange)) - return "reservedRange: array expected"; - for (var i = 0; i < message.reservedRange.length; ++i) { - var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); - if (error) - return "reservedRange." + error; - } - } - if (message.reservedName != null && message.hasOwnProperty("reservedName")) { - if (!Array.isArray(message.reservedName)) - return "reservedName: array expected"; - for (var i = 0; i < message.reservedName.length; ++i) - if (!$util.isString(message.reservedName[i])) - return "reservedName: string[] expected"; - } - if (message.visibility != null && message.hasOwnProperty("visibility")) - switch (message.visibility) { - default: - return "visibility: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto - */ - EnumDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumDescriptorProto) - return object; - var message = new $root.google.protobuf.EnumDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.value) { - if (!Array.isArray(object.value)) - throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); - message.value = []; - for (var i = 0; i < object.value.length; ++i) { - if (typeof object.value[i] !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); - message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); - } - if (object.reservedRange) { - if (!Array.isArray(object.reservedRange)) - throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); - message.reservedRange = []; - for (var i = 0; i < object.reservedRange.length; ++i) { - if (typeof object.reservedRange[i] !== "object") - throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); - message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); - } - } - if (object.reservedName) { - if (!Array.isArray(object.reservedName)) - throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); - message.reservedName = []; - for (var i = 0; i < object.reservedName.length; ++i) - message.reservedName[i] = String(object.reservedName[i]); - } - switch (object.visibility) { - default: - if (typeof object.visibility === "number") { - message.visibility = object.visibility; - break; - } - break; - case "VISIBILITY_UNSET": - case 0: - message.visibility = 0; - break; - case "VISIBILITY_LOCAL": - case 1: - message.visibility = 1; - break; - case "VISIBILITY_EXPORT": - case 2: - message.visibility = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.value = []; - object.reservedRange = []; - object.reservedName = []; - } - if (options.defaults) { - object.name = ""; - object.options = null; - object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.value && message.value.length) { - object.value = []; - for (var j = 0; j < message.value.length; ++j) - object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); - if (message.reservedRange && message.reservedRange.length) { - object.reservedRange = []; - for (var j = 0; j < message.reservedRange.length; ++j) - object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); - } - if (message.reservedName && message.reservedName.length) { - object.reservedName = []; - for (var j = 0; j < message.reservedName.length; ++j) - object.reservedName[j] = message.reservedName[j]; - } - if (message.visibility != null && message.hasOwnProperty("visibility")) - object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; - return object; - }; - - /** - * Converts this EnumDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.EnumDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - EnumDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EnumDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.EnumDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; - }; - - EnumDescriptorProto.EnumReservedRange = (function() { - - /** - * Properties of an EnumReservedRange. - * @memberof google.protobuf.EnumDescriptorProto - * @interface IEnumReservedRange - * @property {number|null} [start] EnumReservedRange start - * @property {number|null} [end] EnumReservedRange end - */ - - /** - * Constructs a new EnumReservedRange. - * @memberof google.protobuf.EnumDescriptorProto - * @classdesc Represents an EnumReservedRange. - * @implements IEnumReservedRange - * @constructor - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set - */ - function EnumReservedRange(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EnumReservedRange start. - * @member {number} start - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @instance - */ - EnumReservedRange.prototype.start = 0; - - /** - * EnumReservedRange end. - * @member {number} end - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @instance - */ - EnumReservedRange.prototype.end = 0; - - /** - * Creates a new EnumReservedRange instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance - */ - EnumReservedRange.create = function create(properties) { - return new EnumReservedRange(properties); - }; - - /** - * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumReservedRange.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.start != null && Object.hasOwnProperty.call(message, "start")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); - return writer; - }; - - /** - * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumReservedRange message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumReservedRange.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.start = reader.int32(); - break; - } - case 2: { - message.end = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumReservedRange message. - * @function verify - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumReservedRange.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.start != null && message.hasOwnProperty("start")) - if (!$util.isInteger(message.start)) - return "start: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - return null; - }; - - /** - * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange - */ - EnumReservedRange.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) - return object; - var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); - if (object.start != null) - message.start = object.start | 0; - if (object.end != null) - message.end = object.end | 0; - return message; - }; - - /** - * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumReservedRange.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.start = 0; - object.end = 0; - } - if (message.start != null && message.hasOwnProperty("start")) - object.start = message.start; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - return object; - }; - - /** - * Converts this EnumReservedRange to JSON. - * @function toJSON - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @instance - * @returns {Object.} JSON object - */ - EnumReservedRange.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EnumReservedRange - * @function getTypeUrl - * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; - }; - - return EnumReservedRange; - })(); - - return EnumDescriptorProto; - })(); - - protobuf.EnumValueDescriptorProto = (function() { - - /** - * Properties of an EnumValueDescriptorProto. - * @memberof google.protobuf - * @interface IEnumValueDescriptorProto - * @property {string|null} [name] EnumValueDescriptorProto name - * @property {number|null} [number] EnumValueDescriptorProto number - * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options - */ - - /** - * Constructs a new EnumValueDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents an EnumValueDescriptorProto. - * @implements IEnumValueDescriptorProto - * @constructor - * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set - */ - function EnumValueDescriptorProto(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EnumValueDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - */ - EnumValueDescriptorProto.prototype.name = ""; - - /** - * EnumValueDescriptorProto number. - * @member {number} number - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - */ - EnumValueDescriptorProto.prototype.number = 0; - - /** - * EnumValueDescriptorProto options. - * @member {google.protobuf.IEnumValueOptions|null|undefined} options - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - */ - EnumValueDescriptorProto.prototype.options = null; - - /** - * Creates a new EnumValueDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance - */ - EnumValueDescriptorProto.create = function create(properties) { - return new EnumValueDescriptorProto(properties); - }; - - /** - * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.number != null && Object.hasOwnProperty.call(message, "number")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueDescriptorProto.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.number = reader.int32(); - break; - } - case 3: { - message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumValueDescriptorProto message. - * @function verify - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumValueDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.number != null && message.hasOwnProperty("number")) - if (!$util.isInteger(message.number)) - return "number: integer expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.EnumValueOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto - */ - EnumValueDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) - return object; - var message = new $root.google.protobuf.EnumValueDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.number != null) - message.number = object.number | 0; - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumValueDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.number = 0; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.number != null && message.hasOwnProperty("number")) - object.number = message.number; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this EnumValueDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.EnumValueDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - EnumValueDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EnumValueDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.EnumValueDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; - }; - - return EnumValueDescriptorProto; - })(); - - protobuf.ServiceDescriptorProto = (function() { - - /** - * Properties of a ServiceDescriptorProto. - * @memberof google.protobuf - * @interface IServiceDescriptorProto - * @property {string|null} [name] ServiceDescriptorProto name - * @property {Array.|null} [method] ServiceDescriptorProto method - * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options - */ - - /** - * Constructs a new ServiceDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a ServiceDescriptorProto. - * @implements IServiceDescriptorProto - * @constructor - * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set - */ - function ServiceDescriptorProto(properties) { - this.method = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ServiceDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - */ - ServiceDescriptorProto.prototype.name = ""; - - /** - * ServiceDescriptorProto method. - * @member {Array.} method - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - */ - ServiceDescriptorProto.prototype.method = $util.emptyArray; - - /** - * ServiceDescriptorProto options. - * @member {google.protobuf.IServiceOptions|null|undefined} options - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - */ - ServiceDescriptorProto.prototype.options = null; - - /** - * Creates a new ServiceDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance - */ - ServiceDescriptorProto.create = function create(properties) { - return new ServiceDescriptorProto(properties); - }; - - /** - * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.method != null && message.method.length) - for (var i = 0; i < message.method.length; ++i) - $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceDescriptorProto.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - if (!(message.method && message.method.length)) - message.method = []; - message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); - break; - } - case 3: { - message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ServiceDescriptorProto message. - * @function verify - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ServiceDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.method != null && message.hasOwnProperty("method")) { - if (!Array.isArray(message.method)) - return "method: array expected"; - for (var i = 0; i < message.method.length; ++i) { - var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); - if (error) - return "method." + error; - } - } - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.ServiceOptions.verify(message.options); - if (error) - return "options." + error; - } - return null; - }; - - /** - * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto - */ - ServiceDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ServiceDescriptorProto) - return object; - var message = new $root.google.protobuf.ServiceDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.method) { - if (!Array.isArray(object.method)) - throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); - message.method = []; - for (var i = 0; i < object.method.length; ++i) { - if (typeof object.method[i] !== "object") - throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); - message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); - } - } - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); - } - return message; - }; - - /** - * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ServiceDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.method = []; - if (options.defaults) { - object.name = ""; - object.options = null; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.method && message.method.length) { - object.method = []; - for (var j = 0; j < message.method.length; ++j) - object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); - } - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); - return object; - }; - - /** - * Converts this ServiceDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.ServiceDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - ServiceDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ServiceDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.ServiceDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; - }; - - return ServiceDescriptorProto; - })(); - - protobuf.MethodDescriptorProto = (function() { - - /** - * Properties of a MethodDescriptorProto. - * @memberof google.protobuf - * @interface IMethodDescriptorProto - * @property {string|null} [name] MethodDescriptorProto name - * @property {string|null} [inputType] MethodDescriptorProto inputType - * @property {string|null} [outputType] MethodDescriptorProto outputType - * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options - * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming - * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming - */ - - /** - * Constructs a new MethodDescriptorProto. - * @memberof google.protobuf - * @classdesc Represents a MethodDescriptorProto. - * @implements IMethodDescriptorProto - * @constructor - * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set - */ - function MethodDescriptorProto(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MethodDescriptorProto name. - * @member {string} name - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.name = ""; - - /** - * MethodDescriptorProto inputType. - * @member {string} inputType - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.inputType = ""; - - /** - * MethodDescriptorProto outputType. - * @member {string} outputType - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.outputType = ""; - - /** - * MethodDescriptorProto options. - * @member {google.protobuf.IMethodOptions|null|undefined} options - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.options = null; - - /** - * MethodDescriptorProto clientStreaming. - * @member {boolean} clientStreaming - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.clientStreaming = false; - - /** - * MethodDescriptorProto serverStreaming. - * @member {boolean} serverStreaming - * @memberof google.protobuf.MethodDescriptorProto - * @instance - */ - MethodDescriptorProto.prototype.serverStreaming = false; - - /** - * Creates a new MethodDescriptorProto instance using the specified properties. - * @function create - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance - */ - MethodDescriptorProto.create = function create(properties) { - return new MethodDescriptorProto(properties); - }; - - /** - * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. - * @function encode - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodDescriptorProto.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && Object.hasOwnProperty.call(message, "name")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); - if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); - if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); - if (message.options != null && Object.hasOwnProperty.call(message, "options")) - $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); - if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); - return writer; - }; - - /** - * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodDescriptorProto.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.name = reader.string(); - break; - } - case 2: { - message.inputType = reader.string(); - break; - } - case 3: { - message.outputType = reader.string(); - break; - } - case 4: { - message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); - break; - } - case 5: { - message.clientStreaming = reader.bool(); - break; - } - case 6: { - message.serverStreaming = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MethodDescriptorProto message. - * @function verify - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MethodDescriptorProto.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) - if (!$util.isString(message.name)) - return "name: string expected"; - if (message.inputType != null && message.hasOwnProperty("inputType")) - if (!$util.isString(message.inputType)) - return "inputType: string expected"; - if (message.outputType != null && message.hasOwnProperty("outputType")) - if (!$util.isString(message.outputType)) - return "outputType: string expected"; - if (message.options != null && message.hasOwnProperty("options")) { - var error = $root.google.protobuf.MethodOptions.verify(message.options); - if (error) - return "options." + error; - } - if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) - if (typeof message.clientStreaming !== "boolean") - return "clientStreaming: boolean expected"; - if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) - if (typeof message.serverStreaming !== "boolean") - return "serverStreaming: boolean expected"; - return null; - }; - - /** - * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto - */ - MethodDescriptorProto.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MethodDescriptorProto) - return object; - var message = new $root.google.protobuf.MethodDescriptorProto(); - if (object.name != null) - message.name = String(object.name); - if (object.inputType != null) - message.inputType = String(object.inputType); - if (object.outputType != null) - message.outputType = String(object.outputType); - if (object.options != null) { - if (typeof object.options !== "object") - throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); - message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); - } - if (object.clientStreaming != null) - message.clientStreaming = Boolean(object.clientStreaming); - if (object.serverStreaming != null) - message.serverStreaming = Boolean(object.serverStreaming); - return message; - }; - - /** - * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MethodDescriptorProto.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.name = ""; - object.inputType = ""; - object.outputType = ""; - object.options = null; - object.clientStreaming = false; - object.serverStreaming = false; - } - if (message.name != null && message.hasOwnProperty("name")) - object.name = message.name; - if (message.inputType != null && message.hasOwnProperty("inputType")) - object.inputType = message.inputType; - if (message.outputType != null && message.hasOwnProperty("outputType")) - object.outputType = message.outputType; - if (message.options != null && message.hasOwnProperty("options")) - object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); - if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) - object.clientStreaming = message.clientStreaming; - if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) - object.serverStreaming = message.serverStreaming; - return object; - }; - - /** - * Converts this MethodDescriptorProto to JSON. - * @function toJSON - * @memberof google.protobuf.MethodDescriptorProto - * @instance - * @returns {Object.} JSON object - */ - MethodDescriptorProto.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MethodDescriptorProto - * @function getTypeUrl - * @memberof google.protobuf.MethodDescriptorProto - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; - }; - - return MethodDescriptorProto; - })(); - - protobuf.FileOptions = (function() { - - /** - * Properties of a FileOptions. - * @memberof google.protobuf - * @interface IFileOptions - * @property {string|null} [javaPackage] FileOptions javaPackage - * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname - * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles - * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash - * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 - * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor - * @property {string|null} [goPackage] FileOptions goPackage - * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices - * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices - * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices - * @property {boolean|null} [deprecated] FileOptions deprecated - * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas - * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix - * @property {string|null} [csharpNamespace] FileOptions csharpNamespace - * @property {string|null} [swiftPrefix] FileOptions swiftPrefix - * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix - * @property {string|null} [phpNamespace] FileOptions phpNamespace - * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace - * @property {string|null} [rubyPackage] FileOptions rubyPackage - * @property {google.protobuf.IFeatureSet|null} [features] FileOptions features - * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption - * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition - */ - - /** - * Constructs a new FileOptions. - * @memberof google.protobuf - * @classdesc Represents a FileOptions. - * @implements IFileOptions - * @constructor - * @param {google.protobuf.IFileOptions=} [properties] Properties to set - */ - function FileOptions(properties) { - this.uninterpretedOption = []; - this[".google.api.resourceDefinition"] = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FileOptions javaPackage. - * @member {string} javaPackage - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaPackage = ""; - - /** - * FileOptions javaOuterClassname. - * @member {string} javaOuterClassname - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaOuterClassname = ""; - - /** - * FileOptions javaMultipleFiles. - * @member {boolean} javaMultipleFiles - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaMultipleFiles = false; - - /** - * FileOptions javaGenerateEqualsAndHash. - * @member {boolean} javaGenerateEqualsAndHash - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaGenerateEqualsAndHash = false; - - /** - * FileOptions javaStringCheckUtf8. - * @member {boolean} javaStringCheckUtf8 - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaStringCheckUtf8 = false; - - /** - * FileOptions optimizeFor. - * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.optimizeFor = 1; - - /** - * FileOptions goPackage. - * @member {string} goPackage - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.goPackage = ""; - - /** - * FileOptions ccGenericServices. - * @member {boolean} ccGenericServices - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.ccGenericServices = false; - - /** - * FileOptions javaGenericServices. - * @member {boolean} javaGenericServices - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.javaGenericServices = false; - - /** - * FileOptions pyGenericServices. - * @member {boolean} pyGenericServices - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.pyGenericServices = false; - - /** - * FileOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.deprecated = false; - - /** - * FileOptions ccEnableArenas. - * @member {boolean} ccEnableArenas - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.ccEnableArenas = true; - - /** - * FileOptions objcClassPrefix. - * @member {string} objcClassPrefix - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.objcClassPrefix = ""; - - /** - * FileOptions csharpNamespace. - * @member {string} csharpNamespace - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.csharpNamespace = ""; - - /** - * FileOptions swiftPrefix. - * @member {string} swiftPrefix - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.swiftPrefix = ""; - - /** - * FileOptions phpClassPrefix. - * @member {string} phpClassPrefix - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.phpClassPrefix = ""; - - /** - * FileOptions phpNamespace. - * @member {string} phpNamespace - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.phpNamespace = ""; - - /** - * FileOptions phpMetadataNamespace. - * @member {string} phpMetadataNamespace - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.phpMetadataNamespace = ""; - - /** - * FileOptions rubyPackage. - * @member {string} rubyPackage - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.rubyPackage = ""; - - /** - * FileOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.features = null; - - /** - * FileOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * FileOptions .google.api.resourceDefinition. - * @member {Array.} .google.api.resourceDefinition - * @memberof google.protobuf.FileOptions - * @instance - */ - FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; - - /** - * Creates a new FileOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.IFileOptions=} [properties] Properties to set - * @returns {google.protobuf.FileOptions} FileOptions instance - */ - FileOptions.create = function create(properties) { - return new FileOptions(properties); - }; - - /** - * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); - if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); - if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) - writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); - if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) - writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); - if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) - writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); - if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) - writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); - if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) - writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); - if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) - writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); - if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) - writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); - if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) - writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); - if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) - writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); - if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) - writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); - if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) - writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); - if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) - writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); - if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) - writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); - if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) - writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); - if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) - writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); - if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) - writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) - for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) - $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FileOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FileOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FileOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FileOptions} FileOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.javaPackage = reader.string(); - break; - } - case 8: { - message.javaOuterClassname = reader.string(); - break; - } - case 10: { - message.javaMultipleFiles = reader.bool(); - break; - } - case 20: { - message.javaGenerateEqualsAndHash = reader.bool(); - break; - } - case 27: { - message.javaStringCheckUtf8 = reader.bool(); - break; - } - case 9: { - message.optimizeFor = reader.int32(); - break; - } - case 11: { - message.goPackage = reader.string(); - break; - } - case 16: { - message.ccGenericServices = reader.bool(); - break; - } - case 17: { - message.javaGenericServices = reader.bool(); - break; - } - case 18: { - message.pyGenericServices = reader.bool(); - break; - } - case 23: { - message.deprecated = reader.bool(); - break; - } - case 31: { - message.ccEnableArenas = reader.bool(); - break; - } - case 36: { - message.objcClassPrefix = reader.string(); - break; - } - case 37: { - message.csharpNamespace = reader.string(); - break; - } - case 39: { - message.swiftPrefix = reader.string(); - break; - } - case 40: { - message.phpClassPrefix = reader.string(); - break; - } - case 41: { - message.phpNamespace = reader.string(); - break; - } - case 44: { - message.phpMetadataNamespace = reader.string(); - break; - } - case 45: { - message.rubyPackage = reader.string(); - break; - } - case 50: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 1053: { - if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) - message[".google.api.resourceDefinition"] = []; - message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FileOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FileOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FileOptions} FileOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FileOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FileOptions message. - * @function verify - * @memberof google.protobuf.FileOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FileOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) - if (!$util.isString(message.javaPackage)) - return "javaPackage: string expected"; - if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) - if (!$util.isString(message.javaOuterClassname)) - return "javaOuterClassname: string expected"; - if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) - if (typeof message.javaMultipleFiles !== "boolean") - return "javaMultipleFiles: boolean expected"; - if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) - if (typeof message.javaGenerateEqualsAndHash !== "boolean") - return "javaGenerateEqualsAndHash: boolean expected"; - if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) - if (typeof message.javaStringCheckUtf8 !== "boolean") - return "javaStringCheckUtf8: boolean expected"; - if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) - switch (message.optimizeFor) { - default: - return "optimizeFor: enum value expected"; - case 1: - case 2: - case 3: - break; - } - if (message.goPackage != null && message.hasOwnProperty("goPackage")) - if (!$util.isString(message.goPackage)) - return "goPackage: string expected"; - if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) - if (typeof message.ccGenericServices !== "boolean") - return "ccGenericServices: boolean expected"; - if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) - if (typeof message.javaGenericServices !== "boolean") - return "javaGenericServices: boolean expected"; - if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) - if (typeof message.pyGenericServices !== "boolean") - return "pyGenericServices: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) - if (typeof message.ccEnableArenas !== "boolean") - return "ccEnableArenas: boolean expected"; - if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) - if (!$util.isString(message.objcClassPrefix)) - return "objcClassPrefix: string expected"; - if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) - if (!$util.isString(message.csharpNamespace)) - return "csharpNamespace: string expected"; - if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) - if (!$util.isString(message.swiftPrefix)) - return "swiftPrefix: string expected"; - if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) - if (!$util.isString(message.phpClassPrefix)) - return "phpClassPrefix: string expected"; - if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) - if (!$util.isString(message.phpNamespace)) - return "phpNamespace: string expected"; - if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) - if (!$util.isString(message.phpMetadataNamespace)) - return "phpMetadataNamespace: string expected"; - if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) - if (!$util.isString(message.rubyPackage)) - return "rubyPackage: string expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { - if (!Array.isArray(message[".google.api.resourceDefinition"])) - return ".google.api.resourceDefinition: array expected"; - for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { - var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); - if (error) - return ".google.api.resourceDefinition." + error; - } - } - return null; - }; - - /** - * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FileOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FileOptions} FileOptions - */ - FileOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FileOptions) - return object; - var message = new $root.google.protobuf.FileOptions(); - if (object.javaPackage != null) - message.javaPackage = String(object.javaPackage); - if (object.javaOuterClassname != null) - message.javaOuterClassname = String(object.javaOuterClassname); - if (object.javaMultipleFiles != null) - message.javaMultipleFiles = Boolean(object.javaMultipleFiles); - if (object.javaGenerateEqualsAndHash != null) - message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); - if (object.javaStringCheckUtf8 != null) - message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); - switch (object.optimizeFor) { - default: - if (typeof object.optimizeFor === "number") { - message.optimizeFor = object.optimizeFor; - break; - } - break; - case "SPEED": - case 1: - message.optimizeFor = 1; - break; - case "CODE_SIZE": - case 2: - message.optimizeFor = 2; - break; - case "LITE_RUNTIME": - case 3: - message.optimizeFor = 3; - break; - } - if (object.goPackage != null) - message.goPackage = String(object.goPackage); - if (object.ccGenericServices != null) - message.ccGenericServices = Boolean(object.ccGenericServices); - if (object.javaGenericServices != null) - message.javaGenericServices = Boolean(object.javaGenericServices); - if (object.pyGenericServices != null) - message.pyGenericServices = Boolean(object.pyGenericServices); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.ccEnableArenas != null) - message.ccEnableArenas = Boolean(object.ccEnableArenas); - if (object.objcClassPrefix != null) - message.objcClassPrefix = String(object.objcClassPrefix); - if (object.csharpNamespace != null) - message.csharpNamespace = String(object.csharpNamespace); - if (object.swiftPrefix != null) - message.swiftPrefix = String(object.swiftPrefix); - if (object.phpClassPrefix != null) - message.phpClassPrefix = String(object.phpClassPrefix); - if (object.phpNamespace != null) - message.phpNamespace = String(object.phpNamespace); - if (object.phpMetadataNamespace != null) - message.phpMetadataNamespace = String(object.phpMetadataNamespace); - if (object.rubyPackage != null) - message.rubyPackage = String(object.rubyPackage); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FileOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.resourceDefinition"]) { - if (!Array.isArray(object[".google.api.resourceDefinition"])) - throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); - message[".google.api.resourceDefinition"] = []; - for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { - if (typeof object[".google.api.resourceDefinition"][i] !== "object") - throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); - message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); - } - } - return message; - }; - - /** - * Creates a plain object from a FileOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FileOptions - * @static - * @param {google.protobuf.FileOptions} message FileOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FileOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.uninterpretedOption = []; - object[".google.api.resourceDefinition"] = []; - } - if (options.defaults) { - object.javaPackage = ""; - object.javaOuterClassname = ""; - object.optimizeFor = options.enums === String ? "SPEED" : 1; - object.javaMultipleFiles = false; - object.goPackage = ""; - object.ccGenericServices = false; - object.javaGenericServices = false; - object.pyGenericServices = false; - object.javaGenerateEqualsAndHash = false; - object.deprecated = false; - object.javaStringCheckUtf8 = false; - object.ccEnableArenas = true; - object.objcClassPrefix = ""; - object.csharpNamespace = ""; - object.swiftPrefix = ""; - object.phpClassPrefix = ""; - object.phpNamespace = ""; - object.phpMetadataNamespace = ""; - object.rubyPackage = ""; - object.features = null; - } - if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) - object.javaPackage = message.javaPackage; - if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) - object.javaOuterClassname = message.javaOuterClassname; - if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) - object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; - if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) - object.javaMultipleFiles = message.javaMultipleFiles; - if (message.goPackage != null && message.hasOwnProperty("goPackage")) - object.goPackage = message.goPackage; - if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) - object.ccGenericServices = message.ccGenericServices; - if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) - object.javaGenericServices = message.javaGenericServices; - if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) - object.pyGenericServices = message.pyGenericServices; - if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) - object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) - object.javaStringCheckUtf8 = message.javaStringCheckUtf8; - if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) - object.ccEnableArenas = message.ccEnableArenas; - if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) - object.objcClassPrefix = message.objcClassPrefix; - if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) - object.csharpNamespace = message.csharpNamespace; - if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) - object.swiftPrefix = message.swiftPrefix; - if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) - object.phpClassPrefix = message.phpClassPrefix; - if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) - object.phpNamespace = message.phpNamespace; - if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) - object.phpMetadataNamespace = message.phpMetadataNamespace; - if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) - object.rubyPackage = message.rubyPackage; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { - object[".google.api.resourceDefinition"] = []; - for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) - object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); - } - return object; - }; - - /** - * Converts this FileOptions to JSON. - * @function toJSON - * @memberof google.protobuf.FileOptions - * @instance - * @returns {Object.} JSON object - */ - FileOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FileOptions - * @function getTypeUrl - * @memberof google.protobuf.FileOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FileOptions"; - }; - - /** - * OptimizeMode enum. - * @name google.protobuf.FileOptions.OptimizeMode - * @enum {number} - * @property {number} SPEED=1 SPEED value - * @property {number} CODE_SIZE=2 CODE_SIZE value - * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value - */ - FileOptions.OptimizeMode = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[1] = "SPEED"] = 1; - values[valuesById[2] = "CODE_SIZE"] = 2; - values[valuesById[3] = "LITE_RUNTIME"] = 3; - return values; - })(); - - return FileOptions; - })(); - - protobuf.MessageOptions = (function() { - - /** - * Properties of a MessageOptions. - * @memberof google.protobuf - * @interface IMessageOptions - * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat - * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor - * @property {boolean|null} [deprecated] MessageOptions deprecated - * @property {boolean|null} [mapEntry] MessageOptions mapEntry - * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] MessageOptions deprecatedLegacyJsonFieldConflicts - * @property {google.protobuf.IFeatureSet|null} [features] MessageOptions features - * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption - * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource - */ - - /** - * Constructs a new MessageOptions. - * @memberof google.protobuf - * @classdesc Represents a MessageOptions. - * @implements IMessageOptions - * @constructor - * @param {google.protobuf.IMessageOptions=} [properties] Properties to set - */ - function MessageOptions(properties) { - this.uninterpretedOption = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MessageOptions messageSetWireFormat. - * @member {boolean} messageSetWireFormat - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.messageSetWireFormat = false; - - /** - * MessageOptions noStandardDescriptorAccessor. - * @member {boolean} noStandardDescriptorAccessor - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.noStandardDescriptorAccessor = false; - - /** - * MessageOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.deprecated = false; - - /** - * MessageOptions mapEntry. - * @member {boolean} mapEntry - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.mapEntry = false; - - /** - * MessageOptions deprecatedLegacyJsonFieldConflicts. - * @member {boolean} deprecatedLegacyJsonFieldConflicts - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; - - /** - * MessageOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.features = null; - - /** - * MessageOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * MessageOptions .google.api.resource. - * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource - * @memberof google.protobuf.MessageOptions - * @instance - */ - MessageOptions.prototype[".google.api.resource"] = null; - - /** - * Creates a new MessageOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions=} [properties] Properties to set - * @returns {google.protobuf.MessageOptions} MessageOptions instance - */ - MessageOptions.create = function create(properties) { - return new MessageOptions(properties); - }; - - /** - * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MessageOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); - if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) - writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); - if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) - writer.uint32(/* id 11, wireType 0 =*/88).bool(message.deprecatedLegacyJsonFieldConflicts); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) - $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MessageOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.MessageOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MessageOptions} MessageOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MessageOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.messageSetWireFormat = reader.bool(); - break; - } - case 2: { - message.noStandardDescriptorAccessor = reader.bool(); - break; - } - case 3: { - message.deprecated = reader.bool(); - break; - } - case 7: { - message.mapEntry = reader.bool(); - break; - } - case 11: { - message.deprecatedLegacyJsonFieldConflicts = reader.bool(); - break; - } - case 12: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 1053: { - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MessageOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.MessageOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MessageOptions} MessageOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MessageOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MessageOptions message. - * @function verify - * @memberof google.protobuf.MessageOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MessageOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) - if (typeof message.messageSetWireFormat !== "boolean") - return "messageSetWireFormat: boolean expected"; - if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) - if (typeof message.noStandardDescriptorAccessor !== "boolean") - return "noStandardDescriptorAccessor: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) - if (typeof message.mapEntry !== "boolean") - return "mapEntry: boolean expected"; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) - if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") - return "deprecatedLegacyJsonFieldConflicts: boolean expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { - var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); - if (error) - return ".google.api.resource." + error; - } - return null; - }; - - /** - * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.MessageOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.MessageOptions} MessageOptions - */ - MessageOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MessageOptions) - return object; - var message = new $root.google.protobuf.MessageOptions(); - if (object.messageSetWireFormat != null) - message.messageSetWireFormat = Boolean(object.messageSetWireFormat); - if (object.noStandardDescriptorAccessor != null) - message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.mapEntry != null) - message.mapEntry = Boolean(object.mapEntry); - if (object.deprecatedLegacyJsonFieldConflicts != null) - message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.MessageOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.resource"] != null) { - if (typeof object[".google.api.resource"] !== "object") - throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); - message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); - } - return message; - }; - - /** - * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.MessageOptions - * @static - * @param {google.protobuf.MessageOptions} message MessageOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MessageOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.messageSetWireFormat = false; - object.noStandardDescriptorAccessor = false; - object.deprecated = false; - object.mapEntry = false; - object.deprecatedLegacyJsonFieldConflicts = false; - object.features = null; - object[".google.api.resource"] = null; - } - if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) - object.messageSetWireFormat = message.messageSetWireFormat; - if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) - object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) - object.mapEntry = message.mapEntry; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) - object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) - object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); - return object; - }; - - /** - * Converts this MessageOptions to JSON. - * @function toJSON - * @memberof google.protobuf.MessageOptions - * @instance - * @returns {Object.} JSON object - */ - MessageOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MessageOptions - * @function getTypeUrl - * @memberof google.protobuf.MessageOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.MessageOptions"; - }; - - return MessageOptions; - })(); - - protobuf.FieldOptions = (function() { - - /** - * Properties of a FieldOptions. - * @memberof google.protobuf - * @interface IFieldOptions - * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype - * @property {boolean|null} [packed] FieldOptions packed - * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype - * @property {boolean|null} [lazy] FieldOptions lazy - * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy - * @property {boolean|null} [deprecated] FieldOptions deprecated - * @property {boolean|null} [weak] FieldOptions weak - * @property {boolean|null} [debugRedact] FieldOptions debugRedact - * @property {google.protobuf.FieldOptions.OptionRetention|null} [retention] FieldOptions retention - * @property {Array.|null} [targets] FieldOptions targets - * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults - * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features - * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport - * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption - * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior - * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference - * @property {google.api.IFieldInfo|null} [".google.api.fieldInfo"] FieldOptions .google.api.fieldInfo - */ - - /** - * Constructs a new FieldOptions. - * @memberof google.protobuf - * @classdesc Represents a FieldOptions. - * @implements IFieldOptions - * @constructor - * @param {google.protobuf.IFieldOptions=} [properties] Properties to set - */ - function FieldOptions(properties) { - this.targets = []; - this.editionDefaults = []; - this.uninterpretedOption = []; - this[".google.api.fieldBehavior"] = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FieldOptions ctype. - * @member {google.protobuf.FieldOptions.CType} ctype - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.ctype = 0; - - /** - * FieldOptions packed. - * @member {boolean} packed - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.packed = false; - - /** - * FieldOptions jstype. - * @member {google.protobuf.FieldOptions.JSType} jstype - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.jstype = 0; - - /** - * FieldOptions lazy. - * @member {boolean} lazy - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.lazy = false; - - /** - * FieldOptions unverifiedLazy. - * @member {boolean} unverifiedLazy - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.unverifiedLazy = false; - - /** - * FieldOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.deprecated = false; - - /** - * FieldOptions weak. - * @member {boolean} weak - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.weak = false; - - /** - * FieldOptions debugRedact. - * @member {boolean} debugRedact - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.debugRedact = false; - - /** - * FieldOptions retention. - * @member {google.protobuf.FieldOptions.OptionRetention} retention - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.retention = 0; - - /** - * FieldOptions targets. - * @member {Array.} targets - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.targets = $util.emptyArray; - - /** - * FieldOptions editionDefaults. - * @member {Array.} editionDefaults - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.editionDefaults = $util.emptyArray; - - /** - * FieldOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.features = null; - - /** - * FieldOptions featureSupport. - * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.featureSupport = null; - - /** - * FieldOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * FieldOptions .google.api.fieldBehavior. - * @member {Array.} .google.api.fieldBehavior - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; - - /** - * FieldOptions .google.api.resourceReference. - * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".google.api.resourceReference"] = null; - - /** - * FieldOptions .google.api.fieldInfo. - * @member {google.api.IFieldInfo|null|undefined} .google.api.fieldInfo - * @memberof google.protobuf.FieldOptions - * @instance - */ - FieldOptions.prototype[".google.api.fieldInfo"] = null; - - /** - * Creates a new FieldOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.IFieldOptions=} [properties] Properties to set - * @returns {google.protobuf.FieldOptions} FieldOptions instance - */ - FieldOptions.create = function create(properties) { - return new FieldOptions(properties); - }; - - /** - * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); - if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) - writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); - if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); - if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) - writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); - if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) - writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); - if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) - writer.uint32(/* id 16, wireType 0 =*/128).bool(message.debugRedact); - if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) - writer.uint32(/* id 17, wireType 0 =*/136).int32(message.retention); - if (message.targets != null && message.targets.length) - for (var i = 0; i < message.targets.length; ++i) - writer.uint32(/* id 19, wireType 0 =*/152).int32(message.targets[i]); - if (message.editionDefaults != null && message.editionDefaults.length) - for (var i = 0; i < message.editionDefaults.length; ++i) - $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); - if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) - $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) - for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) - writer.uint32(/* id 1052, wireType 0 =*/8416).int32(message[".google.api.fieldBehavior"][i]); - if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) - $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); - if (message[".google.api.fieldInfo"] != null && Object.hasOwnProperty.call(message, ".google.api.fieldInfo")) - $root.google.api.FieldInfo.encode(message[".google.api.fieldInfo"], writer.uint32(/* id 291403980, wireType 2 =*/2331231842).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldOptions} FieldOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.ctype = reader.int32(); - break; - } - case 2: { - message.packed = reader.bool(); - break; - } - case 6: { - message.jstype = reader.int32(); - break; - } - case 5: { - message.lazy = reader.bool(); - break; - } - case 15: { - message.unverifiedLazy = reader.bool(); - break; - } - case 3: { - message.deprecated = reader.bool(); - break; - } - case 10: { - message.weak = reader.bool(); - break; - } - case 16: { - message.debugRedact = reader.bool(); - break; - } - case 17: { - message.retention = reader.int32(); - break; - } - case 19: { - if (!(message.targets && message.targets.length)) - message.targets = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.targets.push(reader.int32()); - } else - message.targets.push(reader.int32()); - break; - } - case 20: { - if (!(message.editionDefaults && message.editionDefaults.length)) - message.editionDefaults = []; - message.editionDefaults.push($root.google.protobuf.FieldOptions.EditionDefault.decode(reader, reader.uint32())); - break; - } - case 21: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 22: { - message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 1052: { - if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) - message[".google.api.fieldBehavior"] = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message[".google.api.fieldBehavior"].push(reader.int32()); - } else - message[".google.api.fieldBehavior"].push(reader.int32()); - break; - } - case 1055: { - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); - break; - } - case 291403980: { - message[".google.api.fieldInfo"] = $root.google.api.FieldInfo.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions} FieldOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldOptions message. - * @function verify - * @memberof google.protobuf.FieldOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.ctype != null && message.hasOwnProperty("ctype")) - switch (message.ctype) { - default: - return "ctype: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.packed != null && message.hasOwnProperty("packed")) - if (typeof message.packed !== "boolean") - return "packed: boolean expected"; - if (message.jstype != null && message.hasOwnProperty("jstype")) - switch (message.jstype) { - default: - return "jstype: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.lazy != null && message.hasOwnProperty("lazy")) - if (typeof message.lazy !== "boolean") - return "lazy: boolean expected"; - if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) - if (typeof message.unverifiedLazy !== "boolean") - return "unverifiedLazy: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.weak != null && message.hasOwnProperty("weak")) - if (typeof message.weak !== "boolean") - return "weak: boolean expected"; - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) - if (typeof message.debugRedact !== "boolean") - return "debugRedact: boolean expected"; - if (message.retention != null && message.hasOwnProperty("retention")) - switch (message.retention) { - default: - return "retention: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.targets != null && message.hasOwnProperty("targets")) { - if (!Array.isArray(message.targets)) - return "targets: array expected"; - for (var i = 0; i < message.targets.length; ++i) - switch (message.targets[i]) { - default: - return "targets: enum value[] expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - break; - } - } - if (message.editionDefaults != null && message.hasOwnProperty("editionDefaults")) { - if (!Array.isArray(message.editionDefaults)) - return "editionDefaults: array expected"; - for (var i = 0; i < message.editionDefaults.length; ++i) { - var error = $root.google.protobuf.FieldOptions.EditionDefault.verify(message.editionDefaults[i]); - if (error) - return "editionDefaults." + error; - } - } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { - var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); - if (error) - return "featureSupport." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { - if (!Array.isArray(message[".google.api.fieldBehavior"])) - return ".google.api.fieldBehavior: array expected"; - for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) - switch (message[".google.api.fieldBehavior"][i]) { - default: - return ".google.api.fieldBehavior: enum value[] expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - break; - } - } - if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { - var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); - if (error) - return ".google.api.resourceReference." + error; - } - if (message[".google.api.fieldInfo"] != null && message.hasOwnProperty(".google.api.fieldInfo")) { - var error = $root.google.api.FieldInfo.verify(message[".google.api.fieldInfo"]); - if (error) - return ".google.api.fieldInfo." + error; - } - return null; - }; - - /** - * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldOptions} FieldOptions - */ - FieldOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldOptions) - return object; - var message = new $root.google.protobuf.FieldOptions(); - switch (object.ctype) { - default: - if (typeof object.ctype === "number") { - message.ctype = object.ctype; - break; - } - break; - case "STRING": - case 0: - message.ctype = 0; - break; - case "CORD": - case 1: - message.ctype = 1; - break; - case "STRING_PIECE": - case 2: - message.ctype = 2; - break; - } - if (object.packed != null) - message.packed = Boolean(object.packed); - switch (object.jstype) { - default: - if (typeof object.jstype === "number") { - message.jstype = object.jstype; - break; - } - break; - case "JS_NORMAL": - case 0: - message.jstype = 0; - break; - case "JS_STRING": - case 1: - message.jstype = 1; - break; - case "JS_NUMBER": - case 2: - message.jstype = 2; - break; - } - if (object.lazy != null) - message.lazy = Boolean(object.lazy); - if (object.unverifiedLazy != null) - message.unverifiedLazy = Boolean(object.unverifiedLazy); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.weak != null) - message.weak = Boolean(object.weak); - if (object.debugRedact != null) - message.debugRedact = Boolean(object.debugRedact); - switch (object.retention) { - default: - if (typeof object.retention === "number") { - message.retention = object.retention; - break; - } - break; - case "RETENTION_UNKNOWN": - case 0: - message.retention = 0; - break; - case "RETENTION_RUNTIME": - case 1: - message.retention = 1; - break; - case "RETENTION_SOURCE": - case 2: - message.retention = 2; - break; - } - if (object.targets) { - if (!Array.isArray(object.targets)) - throw TypeError(".google.protobuf.FieldOptions.targets: array expected"); - message.targets = []; - for (var i = 0; i < object.targets.length; ++i) - switch (object.targets[i]) { - default: - if (typeof object.targets[i] === "number") { - message.targets[i] = object.targets[i]; - break; - } - case "TARGET_TYPE_UNKNOWN": - case 0: - message.targets[i] = 0; - break; - case "TARGET_TYPE_FILE": - case 1: - message.targets[i] = 1; - break; - case "TARGET_TYPE_EXTENSION_RANGE": - case 2: - message.targets[i] = 2; - break; - case "TARGET_TYPE_MESSAGE": - case 3: - message.targets[i] = 3; - break; - case "TARGET_TYPE_FIELD": - case 4: - message.targets[i] = 4; - break; - case "TARGET_TYPE_ONEOF": - case 5: - message.targets[i] = 5; - break; - case "TARGET_TYPE_ENUM": - case 6: - message.targets[i] = 6; - break; - case "TARGET_TYPE_ENUM_ENTRY": - case 7: - message.targets[i] = 7; - break; - case "TARGET_TYPE_SERVICE": - case 8: - message.targets[i] = 8; - break; - case "TARGET_TYPE_METHOD": - case 9: - message.targets[i] = 9; - break; - } - } - if (object.editionDefaults) { - if (!Array.isArray(object.editionDefaults)) - throw TypeError(".google.protobuf.FieldOptions.editionDefaults: array expected"); - message.editionDefaults = []; - for (var i = 0; i < object.editionDefaults.length; ++i) { - if (typeof object.editionDefaults[i] !== "object") - throw TypeError(".google.protobuf.FieldOptions.editionDefaults: object expected"); - message.editionDefaults[i] = $root.google.protobuf.FieldOptions.EditionDefault.fromObject(object.editionDefaults[i]); - } - } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FieldOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.featureSupport != null) { - if (typeof object.featureSupport !== "object") - throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); - message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.fieldBehavior"]) { - if (!Array.isArray(object[".google.api.fieldBehavior"])) - throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); - message[".google.api.fieldBehavior"] = []; - for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) - switch (object[".google.api.fieldBehavior"][i]) { - default: - if (typeof object[".google.api.fieldBehavior"][i] === "number") { - message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; - break; - } - case "FIELD_BEHAVIOR_UNSPECIFIED": - case 0: - message[".google.api.fieldBehavior"][i] = 0; - break; - case "OPTIONAL": - case 1: - message[".google.api.fieldBehavior"][i] = 1; - break; - case "REQUIRED": - case 2: - message[".google.api.fieldBehavior"][i] = 2; - break; - case "OUTPUT_ONLY": - case 3: - message[".google.api.fieldBehavior"][i] = 3; - break; - case "INPUT_ONLY": - case 4: - message[".google.api.fieldBehavior"][i] = 4; - break; - case "IMMUTABLE": - case 5: - message[".google.api.fieldBehavior"][i] = 5; - break; - case "UNORDERED_LIST": - case 6: - message[".google.api.fieldBehavior"][i] = 6; - break; - case "NON_EMPTY_DEFAULT": - case 7: - message[".google.api.fieldBehavior"][i] = 7; - break; - case "IDENTIFIER": - case 8: - message[".google.api.fieldBehavior"][i] = 8; - break; - } - } - if (object[".google.api.resourceReference"] != null) { - if (typeof object[".google.api.resourceReference"] !== "object") - throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); - message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); - } - if (object[".google.api.fieldInfo"] != null) { - if (typeof object[".google.api.fieldInfo"] !== "object") - throw TypeError(".google.protobuf.FieldOptions..google.api.fieldInfo: object expected"); - message[".google.api.fieldInfo"] = $root.google.api.FieldInfo.fromObject(object[".google.api.fieldInfo"]); - } - return message; - }; - - /** - * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldOptions - * @static - * @param {google.protobuf.FieldOptions} message FieldOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FieldOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.targets = []; - object.editionDefaults = []; - object.uninterpretedOption = []; - object[".google.api.fieldBehavior"] = []; - } - if (options.defaults) { - object.ctype = options.enums === String ? "STRING" : 0; - object.packed = false; - object.deprecated = false; - object.lazy = false; - object.jstype = options.enums === String ? "JS_NORMAL" : 0; - object.weak = false; - object.unverifiedLazy = false; - object.debugRedact = false; - object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; - object.features = null; - object.featureSupport = null; - object[".google.api.resourceReference"] = null; - object[".google.api.fieldInfo"] = null; - } - if (message.ctype != null && message.hasOwnProperty("ctype")) - object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; - if (message.packed != null && message.hasOwnProperty("packed")) - object.packed = message.packed; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.lazy != null && message.hasOwnProperty("lazy")) - object.lazy = message.lazy; - if (message.jstype != null && message.hasOwnProperty("jstype")) - object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; - if (message.weak != null && message.hasOwnProperty("weak")) - object.weak = message.weak; - if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) - object.unverifiedLazy = message.unverifiedLazy; - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) - object.debugRedact = message.debugRedact; - if (message.retention != null && message.hasOwnProperty("retention")) - object.retention = options.enums === String ? $root.google.protobuf.FieldOptions.OptionRetention[message.retention] === undefined ? message.retention : $root.google.protobuf.FieldOptions.OptionRetention[message.retention] : message.retention; - if (message.targets && message.targets.length) { - object.targets = []; - for (var j = 0; j < message.targets.length; ++j) - object.targets[j] = options.enums === String ? $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] === undefined ? message.targets[j] : $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] : message.targets[j]; - } - if (message.editionDefaults && message.editionDefaults.length) { - object.editionDefaults = []; - for (var j = 0; j < message.editionDefaults.length; ++j) - object.editionDefaults[j] = $root.google.protobuf.FieldOptions.EditionDefault.toObject(message.editionDefaults[j], options); - } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) - object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { - object[".google.api.fieldBehavior"] = []; - for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) - object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; - } - if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) - object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); - if (message[".google.api.fieldInfo"] != null && message.hasOwnProperty(".google.api.fieldInfo")) - object[".google.api.fieldInfo"] = $root.google.api.FieldInfo.toObject(message[".google.api.fieldInfo"], options); - return object; - }; - - /** - * Converts this FieldOptions to JSON. - * @function toJSON - * @memberof google.protobuf.FieldOptions - * @instance - * @returns {Object.} JSON object - */ - FieldOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FieldOptions - * @function getTypeUrl - * @memberof google.protobuf.FieldOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FieldOptions"; - }; - - /** - * CType enum. - * @name google.protobuf.FieldOptions.CType - * @enum {number} - * @property {number} STRING=0 STRING value - * @property {number} CORD=1 CORD value - * @property {number} STRING_PIECE=2 STRING_PIECE value - */ - FieldOptions.CType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "STRING"] = 0; - values[valuesById[1] = "CORD"] = 1; - values[valuesById[2] = "STRING_PIECE"] = 2; - return values; - })(); - - /** - * JSType enum. - * @name google.protobuf.FieldOptions.JSType - * @enum {number} - * @property {number} JS_NORMAL=0 JS_NORMAL value - * @property {number} JS_STRING=1 JS_STRING value - * @property {number} JS_NUMBER=2 JS_NUMBER value - */ - FieldOptions.JSType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "JS_NORMAL"] = 0; - values[valuesById[1] = "JS_STRING"] = 1; - values[valuesById[2] = "JS_NUMBER"] = 2; - return values; - })(); - - /** - * OptionRetention enum. - * @name google.protobuf.FieldOptions.OptionRetention - * @enum {number} - * @property {number} RETENTION_UNKNOWN=0 RETENTION_UNKNOWN value - * @property {number} RETENTION_RUNTIME=1 RETENTION_RUNTIME value - * @property {number} RETENTION_SOURCE=2 RETENTION_SOURCE value - */ - FieldOptions.OptionRetention = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "RETENTION_UNKNOWN"] = 0; - values[valuesById[1] = "RETENTION_RUNTIME"] = 1; - values[valuesById[2] = "RETENTION_SOURCE"] = 2; - return values; - })(); - - /** - * OptionTargetType enum. - * @name google.protobuf.FieldOptions.OptionTargetType - * @enum {number} - * @property {number} TARGET_TYPE_UNKNOWN=0 TARGET_TYPE_UNKNOWN value - * @property {number} TARGET_TYPE_FILE=1 TARGET_TYPE_FILE value - * @property {number} TARGET_TYPE_EXTENSION_RANGE=2 TARGET_TYPE_EXTENSION_RANGE value - * @property {number} TARGET_TYPE_MESSAGE=3 TARGET_TYPE_MESSAGE value - * @property {number} TARGET_TYPE_FIELD=4 TARGET_TYPE_FIELD value - * @property {number} TARGET_TYPE_ONEOF=5 TARGET_TYPE_ONEOF value - * @property {number} TARGET_TYPE_ENUM=6 TARGET_TYPE_ENUM value - * @property {number} TARGET_TYPE_ENUM_ENTRY=7 TARGET_TYPE_ENUM_ENTRY value - * @property {number} TARGET_TYPE_SERVICE=8 TARGET_TYPE_SERVICE value - * @property {number} TARGET_TYPE_METHOD=9 TARGET_TYPE_METHOD value - */ - FieldOptions.OptionTargetType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "TARGET_TYPE_UNKNOWN"] = 0; - values[valuesById[1] = "TARGET_TYPE_FILE"] = 1; - values[valuesById[2] = "TARGET_TYPE_EXTENSION_RANGE"] = 2; - values[valuesById[3] = "TARGET_TYPE_MESSAGE"] = 3; - values[valuesById[4] = "TARGET_TYPE_FIELD"] = 4; - values[valuesById[5] = "TARGET_TYPE_ONEOF"] = 5; - values[valuesById[6] = "TARGET_TYPE_ENUM"] = 6; - values[valuesById[7] = "TARGET_TYPE_ENUM_ENTRY"] = 7; - values[valuesById[8] = "TARGET_TYPE_SERVICE"] = 8; - values[valuesById[9] = "TARGET_TYPE_METHOD"] = 9; - return values; - })(); - - FieldOptions.EditionDefault = (function() { - - /** - * Properties of an EditionDefault. - * @memberof google.protobuf.FieldOptions - * @interface IEditionDefault - * @property {google.protobuf.Edition|null} [edition] EditionDefault edition - * @property {string|null} [value] EditionDefault value - */ - - /** - * Constructs a new EditionDefault. - * @memberof google.protobuf.FieldOptions - * @classdesc Represents an EditionDefault. - * @implements IEditionDefault - * @constructor - * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set - */ - function EditionDefault(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EditionDefault edition. - * @member {google.protobuf.Edition} edition - * @memberof google.protobuf.FieldOptions.EditionDefault - * @instance - */ - EditionDefault.prototype.edition = 0; - - /** - * EditionDefault value. - * @member {string} value - * @memberof google.protobuf.FieldOptions.EditionDefault - * @instance - */ - EditionDefault.prototype.value = ""; - - /** - * Creates a new EditionDefault instance using the specified properties. - * @function create - * @memberof google.protobuf.FieldOptions.EditionDefault - * @static - * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault instance - */ - EditionDefault.create = function create(properties) { - return new EditionDefault(properties); - }; - - /** - * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldOptions.EditionDefault - * @static - * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EditionDefault.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); - if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); - return writer; - }; - - /** - * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldOptions.EditionDefault - * @static - * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EditionDefault message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldOptions.EditionDefault - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EditionDefault.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 3: { - message.edition = reader.int32(); - break; - } - case 2: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EditionDefault message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldOptions.EditionDefault - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EditionDefault.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EditionDefault message. - * @function verify - * @memberof google.protobuf.FieldOptions.EditionDefault - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EditionDefault.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.edition != null && message.hasOwnProperty("edition")) - switch (message.edition) { - default: - return "edition: enum value expected"; - case 0: - case 900: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldOptions.EditionDefault - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault - */ - EditionDefault.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) - return object; - var message = new $root.google.protobuf.FieldOptions.EditionDefault(); - switch (object.edition) { - default: - if (typeof object.edition === "number") { - message.edition = object.edition; - break; - } - break; - case "EDITION_UNKNOWN": - case 0: - message.edition = 0; - break; - case "EDITION_LEGACY": - case 900: - message.edition = 900; - break; - case "EDITION_PROTO2": - case 998: - message.edition = 998; - break; - case "EDITION_PROTO3": - case 999: - message.edition = 999; - break; - case "EDITION_2023": - case 1000: - message.edition = 1000; - break; - case "EDITION_2024": - case 1001: - message.edition = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.edition = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.edition = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.edition = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.edition = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.edition = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.edition = 2147483647; - break; - } - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldOptions.EditionDefault - * @static - * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EditionDefault.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.value = ""; - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; - return object; - }; - - /** - * Converts this EditionDefault to JSON. - * @function toJSON - * @memberof google.protobuf.FieldOptions.EditionDefault - * @instance - * @returns {Object.} JSON object - */ - EditionDefault.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EditionDefault - * @function getTypeUrl - * @memberof google.protobuf.FieldOptions.EditionDefault - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; - }; - - return EditionDefault; - })(); - - FieldOptions.FeatureSupport = (function() { - - /** - * Properties of a FeatureSupport. - * @memberof google.protobuf.FieldOptions - * @interface IFeatureSupport - * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced - * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated - * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning - * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved - */ - - /** - * Constructs a new FeatureSupport. - * @memberof google.protobuf.FieldOptions - * @classdesc Represents a FeatureSupport. - * @implements IFeatureSupport - * @constructor - * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set - */ - function FeatureSupport(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FeatureSupport editionIntroduced. - * @member {google.protobuf.Edition} editionIntroduced - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @instance - */ - FeatureSupport.prototype.editionIntroduced = 0; - - /** - * FeatureSupport editionDeprecated. - * @member {google.protobuf.Edition} editionDeprecated - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @instance - */ - FeatureSupport.prototype.editionDeprecated = 0; - - /** - * FeatureSupport deprecationWarning. - * @member {string} deprecationWarning - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @instance - */ - FeatureSupport.prototype.deprecationWarning = ""; - - /** - * FeatureSupport editionRemoved. - * @member {google.protobuf.Edition} editionRemoved - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @instance - */ - FeatureSupport.prototype.editionRemoved = 0; - - /** - * Creates a new FeatureSupport instance using the specified properties. - * @function create - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @static - * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set - * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance - */ - FeatureSupport.create = function create(properties) { - return new FeatureSupport(properties); - }; - - /** - * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @static - * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeatureSupport.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); - if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); - if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); - if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); - return writer; - }; - - /** - * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @static - * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FeatureSupport message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeatureSupport.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.editionIntroduced = reader.int32(); - break; - } - case 2: { - message.editionDeprecated = reader.int32(); - break; - } - case 3: { - message.deprecationWarning = reader.string(); - break; - } - case 4: { - message.editionRemoved = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeatureSupport.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FeatureSupport message. - * @function verify - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FeatureSupport.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) - switch (message.editionIntroduced) { - default: - return "editionIntroduced: enum value expected"; - case 0: - case 900: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) - switch (message.editionDeprecated) { - default: - return "editionDeprecated: enum value expected"; - case 0: - case 900: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) - if (!$util.isString(message.deprecationWarning)) - return "deprecationWarning: string expected"; - if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) - switch (message.editionRemoved) { - default: - return "editionRemoved: enum value expected"; - case 0: - case 900: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - return null; - }; - - /** - * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport - */ - FeatureSupport.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) - return object; - var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); - switch (object.editionIntroduced) { - default: - if (typeof object.editionIntroduced === "number") { - message.editionIntroduced = object.editionIntroduced; - break; - } - break; - case "EDITION_UNKNOWN": - case 0: - message.editionIntroduced = 0; - break; - case "EDITION_LEGACY": - case 900: - message.editionIntroduced = 900; - break; - case "EDITION_PROTO2": - case 998: - message.editionIntroduced = 998; - break; - case "EDITION_PROTO3": - case 999: - message.editionIntroduced = 999; - break; - case "EDITION_2023": - case 1000: - message.editionIntroduced = 1000; - break; - case "EDITION_2024": - case 1001: - message.editionIntroduced = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.editionIntroduced = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.editionIntroduced = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.editionIntroduced = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.editionIntroduced = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.editionIntroduced = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.editionIntroduced = 2147483647; - break; - } - switch (object.editionDeprecated) { - default: - if (typeof object.editionDeprecated === "number") { - message.editionDeprecated = object.editionDeprecated; - break; - } - break; - case "EDITION_UNKNOWN": - case 0: - message.editionDeprecated = 0; - break; - case "EDITION_LEGACY": - case 900: - message.editionDeprecated = 900; - break; - case "EDITION_PROTO2": - case 998: - message.editionDeprecated = 998; - break; - case "EDITION_PROTO3": - case 999: - message.editionDeprecated = 999; - break; - case "EDITION_2023": - case 1000: - message.editionDeprecated = 1000; - break; - case "EDITION_2024": - case 1001: - message.editionDeprecated = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.editionDeprecated = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.editionDeprecated = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.editionDeprecated = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.editionDeprecated = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.editionDeprecated = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.editionDeprecated = 2147483647; - break; - } - if (object.deprecationWarning != null) - message.deprecationWarning = String(object.deprecationWarning); - switch (object.editionRemoved) { - default: - if (typeof object.editionRemoved === "number") { - message.editionRemoved = object.editionRemoved; - break; - } - break; - case "EDITION_UNKNOWN": - case 0: - message.editionRemoved = 0; - break; - case "EDITION_LEGACY": - case 900: - message.editionRemoved = 900; - break; - case "EDITION_PROTO2": - case 998: - message.editionRemoved = 998; - break; - case "EDITION_PROTO3": - case 999: - message.editionRemoved = 999; - break; - case "EDITION_2023": - case 1000: - message.editionRemoved = 1000; - break; - case "EDITION_2024": - case 1001: - message.editionRemoved = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.editionRemoved = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.editionRemoved = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.editionRemoved = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.editionRemoved = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.editionRemoved = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.editionRemoved = 2147483647; - break; - } - return message; - }; - - /** - * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @static - * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FeatureSupport.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; - object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; - object.deprecationWarning = ""; - object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) - object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; - if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) - object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; - if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) - object.deprecationWarning = message.deprecationWarning; - if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) - object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; - return object; - }; - - /** - * Converts this FeatureSupport to JSON. - * @function toJSON - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @instance - * @returns {Object.} JSON object - */ - FeatureSupport.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FeatureSupport - * @function getTypeUrl - * @memberof google.protobuf.FieldOptions.FeatureSupport - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; - }; - - return FeatureSupport; - })(); - - return FieldOptions; - })(); - - protobuf.OneofOptions = (function() { - - /** - * Properties of an OneofOptions. - * @memberof google.protobuf - * @interface IOneofOptions - * @property {google.protobuf.IFeatureSet|null} [features] OneofOptions features - * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption - */ - - /** - * Constructs a new OneofOptions. - * @memberof google.protobuf - * @classdesc Represents an OneofOptions. - * @implements IOneofOptions - * @constructor - * @param {google.protobuf.IOneofOptions=} [properties] Properties to set - */ - function OneofOptions(properties) { - this.uninterpretedOption = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * OneofOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.OneofOptions - * @instance - */ - OneofOptions.prototype.features = null; - - /** - * OneofOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.OneofOptions - * @instance - */ - OneofOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * Creates a new OneofOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.IOneofOptions=} [properties] Properties to set - * @returns {google.protobuf.OneofOptions} OneofOptions instance - */ - OneofOptions.create = function create(properties) { - return new OneofOptions(properties); - }; - - /** - * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an OneofOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.OneofOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.OneofOptions} OneofOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an OneofOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.OneofOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.OneofOptions} OneofOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - OneofOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an OneofOptions message. - * @function verify - * @memberof google.protobuf.OneofOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - OneofOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - return null; - }; - - /** - * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.OneofOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.OneofOptions} OneofOptions - */ - OneofOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.OneofOptions) - return object; - var message = new $root.google.protobuf.OneofOptions(); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.OneofOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.OneofOptions - * @static - * @param {google.protobuf.OneofOptions} message OneofOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - OneofOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) - object.features = null; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - return object; - }; - - /** - * Converts this OneofOptions to JSON. - * @function toJSON - * @memberof google.protobuf.OneofOptions - * @instance - * @returns {Object.} JSON object - */ - OneofOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for OneofOptions - * @function getTypeUrl - * @memberof google.protobuf.OneofOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.OneofOptions"; - }; - - return OneofOptions; - })(); - - protobuf.EnumOptions = (function() { - - /** - * Properties of an EnumOptions. - * @memberof google.protobuf - * @interface IEnumOptions - * @property {boolean|null} [allowAlias] EnumOptions allowAlias - * @property {boolean|null} [deprecated] EnumOptions deprecated - * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] EnumOptions deprecatedLegacyJsonFieldConflicts - * @property {google.protobuf.IFeatureSet|null} [features] EnumOptions features - * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption - */ - - /** - * Constructs a new EnumOptions. - * @memberof google.protobuf - * @classdesc Represents an EnumOptions. - * @implements IEnumOptions - * @constructor - * @param {google.protobuf.IEnumOptions=} [properties] Properties to set - */ - function EnumOptions(properties) { - this.uninterpretedOption = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EnumOptions allowAlias. - * @member {boolean} allowAlias - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.allowAlias = false; - - /** - * EnumOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.deprecated = false; - - /** - * EnumOptions deprecatedLegacyJsonFieldConflicts. - * @member {boolean} deprecatedLegacyJsonFieldConflicts - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; - - /** - * EnumOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.features = null; - - /** - * EnumOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.EnumOptions - * @instance - */ - EnumOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * Creates a new EnumOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions=} [properties] Properties to set - * @returns {google.protobuf.EnumOptions} EnumOptions instance - */ - EnumOptions.create = function create(properties) { - return new EnumOptions(properties); - }; - - /** - * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); - if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) - writer.uint32(/* id 6, wireType 0 =*/48).bool(message.deprecatedLegacyJsonFieldConflicts); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumOptions} EnumOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 2: { - message.allowAlias = reader.bool(); - break; - } - case 3: { - message.deprecated = reader.bool(); - break; - } - case 6: { - message.deprecatedLegacyJsonFieldConflicts = reader.bool(); - break; - } - case 7: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumOptions} EnumOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumOptions message. - * @function verify - * @memberof google.protobuf.EnumOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) - if (typeof message.allowAlias !== "boolean") - return "allowAlias: boolean expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) - if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") - return "deprecatedLegacyJsonFieldConflicts: boolean expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - return null; - }; - - /** - * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumOptions} EnumOptions - */ - EnumOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumOptions) - return object; - var message = new $root.google.protobuf.EnumOptions(); - if (object.allowAlias != null) - message.allowAlias = Boolean(object.allowAlias); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.deprecatedLegacyJsonFieldConflicts != null) - message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.EnumOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumOptions - * @static - * @param {google.protobuf.EnumOptions} message EnumOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.allowAlias = false; - object.deprecated = false; - object.deprecatedLegacyJsonFieldConflicts = false; - object.features = null; - } - if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) - object.allowAlias = message.allowAlias; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) - object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - return object; - }; - - /** - * Converts this EnumOptions to JSON. - * @function toJSON - * @memberof google.protobuf.EnumOptions - * @instance - * @returns {Object.} JSON object - */ - EnumOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EnumOptions - * @function getTypeUrl - * @memberof google.protobuf.EnumOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumOptions"; - }; - - return EnumOptions; - })(); - - protobuf.EnumValueOptions = (function() { - - /** - * Properties of an EnumValueOptions. - * @memberof google.protobuf - * @interface IEnumValueOptions - * @property {boolean|null} [deprecated] EnumValueOptions deprecated - * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features - * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact - * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport - * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption - */ - - /** - * Constructs a new EnumValueOptions. - * @memberof google.protobuf - * @classdesc Represents an EnumValueOptions. - * @implements IEnumValueOptions - * @constructor - * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set - */ - function EnumValueOptions(properties) { - this.uninterpretedOption = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * EnumValueOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.deprecated = false; - - /** - * EnumValueOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.features = null; - - /** - * EnumValueOptions debugRedact. - * @member {boolean} debugRedact - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.debugRedact = false; - - /** - * EnumValueOptions featureSupport. - * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.featureSupport = null; - - /** - * EnumValueOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.EnumValueOptions - * @instance - */ - EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * Creates a new EnumValueOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance - */ - EnumValueOptions.create = function create(properties) { - return new EnumValueOptions(properties); - }; - - /** - * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) - writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); - if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) - $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an EnumValueOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.deprecated = reader.bool(); - break; - } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 3: { - message.debugRedact = reader.bool(); - break; - } - case 4: { - message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an EnumValueOptions message. - * @function verify - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - EnumValueOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) - if (typeof message.debugRedact !== "boolean") - return "debugRedact: boolean expected"; - if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { - var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); - if (error) - return "featureSupport." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - return null; - }; - - /** - * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.EnumValueOptions} EnumValueOptions - */ - EnumValueOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.EnumValueOptions) - return object; - var message = new $root.google.protobuf.EnumValueOptions(); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.EnumValueOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.debugRedact != null) - message.debugRedact = Boolean(object.debugRedact); - if (object.featureSupport != null) { - if (typeof object.featureSupport !== "object") - throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); - message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - return message; - }; - - /** - * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {google.protobuf.EnumValueOptions} message EnumValueOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - EnumValueOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.deprecated = false; - object.features = null; - object.debugRedact = false; - object.featureSupport = null; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) - object.debugRedact = message.debugRedact; - if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) - object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - return object; - }; - - /** - * Converts this EnumValueOptions to JSON. - * @function toJSON - * @memberof google.protobuf.EnumValueOptions - * @instance - * @returns {Object.} JSON object - */ - EnumValueOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for EnumValueOptions - * @function getTypeUrl - * @memberof google.protobuf.EnumValueOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; - }; - - return EnumValueOptions; - })(); - - protobuf.ServiceOptions = (function() { - - /** - * Properties of a ServiceOptions. - * @memberof google.protobuf - * @interface IServiceOptions - * @property {google.protobuf.IFeatureSet|null} [features] ServiceOptions features - * @property {boolean|null} [deprecated] ServiceOptions deprecated - * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption - * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost - * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes - * @property {string|null} [".google.api.apiVersion"] ServiceOptions .google.api.apiVersion - */ - - /** - * Constructs a new ServiceOptions. - * @memberof google.protobuf - * @classdesc Represents a ServiceOptions. - * @implements IServiceOptions - * @constructor - * @param {google.protobuf.IServiceOptions=} [properties] Properties to set - */ - function ServiceOptions(properties) { - this.uninterpretedOption = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * ServiceOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype.features = null; - - /** - * ServiceOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype.deprecated = false; - - /** - * ServiceOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * ServiceOptions .google.api.defaultHost. - * @member {string} .google.api.defaultHost - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype[".google.api.defaultHost"] = ""; - - /** - * ServiceOptions .google.api.oauthScopes. - * @member {string} .google.api.oauthScopes - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype[".google.api.oauthScopes"] = ""; - - /** - * ServiceOptions .google.api.apiVersion. - * @member {string} .google.api.apiVersion - * @memberof google.protobuf.ServiceOptions - * @instance - */ - ServiceOptions.prototype[".google.api.apiVersion"] = ""; - - /** - * Creates a new ServiceOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions=} [properties] Properties to set - * @returns {google.protobuf.ServiceOptions} ServiceOptions instance - */ - ServiceOptions.create = function create(properties) { - return new ServiceOptions(properties); - }; - - /** - * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) - writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); - if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) - writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); - if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) - writer.uint32(/* id 525000001, wireType 2 =*/4200000010).string(message[".google.api.apiVersion"]); - return writer; - }; - - /** - * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.ServiceOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.ServiceOptions} ServiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 34: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 33: { - message.deprecated = reader.bool(); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 1049: { - message[".google.api.defaultHost"] = reader.string(); - break; - } - case 1050: { - message[".google.api.oauthScopes"] = reader.string(); - break; - } - case 525000001: { - message[".google.api.apiVersion"] = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.ServiceOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.ServiceOptions} ServiceOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - ServiceOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a ServiceOptions message. - * @function verify - * @memberof google.protobuf.ServiceOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - ServiceOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) - if (!$util.isString(message[".google.api.defaultHost"])) - return ".google.api.defaultHost: string expected"; - if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) - if (!$util.isString(message[".google.api.oauthScopes"])) - return ".google.api.oauthScopes: string expected"; - if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) - if (!$util.isString(message[".google.api.apiVersion"])) - return ".google.api.apiVersion: string expected"; - return null; - }; - - /** - * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.ServiceOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.ServiceOptions} ServiceOptions - */ - ServiceOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.ServiceOptions) - return object; - var message = new $root.google.protobuf.ServiceOptions(); - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.ServiceOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.defaultHost"] != null) - message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); - if (object[".google.api.oauthScopes"] != null) - message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); - if (object[".google.api.apiVersion"] != null) - message[".google.api.apiVersion"] = String(object[".google.api.apiVersion"]); - return message; - }; - - /** - * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.ServiceOptions - * @static - * @param {google.protobuf.ServiceOptions} message ServiceOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - ServiceOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.uninterpretedOption = []; - if (options.defaults) { - object.deprecated = false; - object.features = null; - object[".google.api.defaultHost"] = ""; - object[".google.api.oauthScopes"] = ""; - object[".google.api.apiVersion"] = ""; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) - object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; - if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) - object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; - if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) - object[".google.api.apiVersion"] = message[".google.api.apiVersion"]; - return object; - }; - - /** - * Converts this ServiceOptions to JSON. - * @function toJSON - * @memberof google.protobuf.ServiceOptions - * @instance - * @returns {Object.} JSON object - */ - ServiceOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for ServiceOptions - * @function getTypeUrl - * @memberof google.protobuf.ServiceOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.ServiceOptions"; - }; - - return ServiceOptions; - })(); - - protobuf.MethodOptions = (function() { - - /** - * Properties of a MethodOptions. - * @memberof google.protobuf - * @interface IMethodOptions - * @property {boolean|null} [deprecated] MethodOptions deprecated - * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel - * @property {google.protobuf.IFeatureSet|null} [features] MethodOptions features - * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption - * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http - * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature - */ - - /** - * Constructs a new MethodOptions. - * @memberof google.protobuf - * @classdesc Represents a MethodOptions. - * @implements IMethodOptions - * @constructor - * @param {google.protobuf.IMethodOptions=} [properties] Properties to set - */ - function MethodOptions(properties) { - this.uninterpretedOption = []; - this[".google.api.methodSignature"] = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * MethodOptions deprecated. - * @member {boolean} deprecated - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.deprecated = false; - - /** - * MethodOptions idempotencyLevel. - * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.idempotencyLevel = 0; - - /** - * MethodOptions features. - * @member {google.protobuf.IFeatureSet|null|undefined} features - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.features = null; - - /** - * MethodOptions uninterpretedOption. - * @member {Array.} uninterpretedOption - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype.uninterpretedOption = $util.emptyArray; - - /** - * MethodOptions .google.api.http. - * @member {google.api.IHttpRule|null|undefined} .google.api.http - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype[".google.api.http"] = null; - - /** - * MethodOptions .google.api.methodSignature. - * @member {Array.} .google.api.methodSignature - * @memberof google.protobuf.MethodOptions - * @instance - */ - MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; - - /** - * Creates a new MethodOptions instance using the specified properties. - * @function create - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.IMethodOptions=} [properties] Properties to set - * @returns {google.protobuf.MethodOptions} MethodOptions instance - */ - MethodOptions.create = function create(properties) { - return new MethodOptions(properties); - }; - - /** - * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @function encode - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodOptions.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) - writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); - if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) - writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); - if (message.uninterpretedOption != null && message.uninterpretedOption.length) - for (var i = 0; i < message.uninterpretedOption.length; ++i) - $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); - if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) - for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) - writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); - if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) - $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a MethodOptions message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.MethodOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.MethodOptions} MethodOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodOptions.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 33: { - message.deprecated = reader.bool(); - break; - } - case 34: { - message.idempotencyLevel = reader.int32(); - break; - } - case 35: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 999: { - if (!(message.uninterpretedOption && message.uninterpretedOption.length)) - message.uninterpretedOption = []; - message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); - break; - } - case 72295728: { - message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); - break; - } - case 1051: { - if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) - message[".google.api.methodSignature"] = []; - message[".google.api.methodSignature"].push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a MethodOptions message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.MethodOptions - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.MethodOptions} MethodOptions - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - MethodOptions.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a MethodOptions message. - * @function verify - * @memberof google.protobuf.MethodOptions - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - MethodOptions.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - if (typeof message.deprecated !== "boolean") - return "deprecated: boolean expected"; - if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) - switch (message.idempotencyLevel) { - default: - return "idempotencyLevel: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); - if (error) - return "features." + error; - } - if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { - if (!Array.isArray(message.uninterpretedOption)) - return "uninterpretedOption: array expected"; - for (var i = 0; i < message.uninterpretedOption.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); - if (error) - return "uninterpretedOption." + error; - } - } - if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { - var error = $root.google.api.HttpRule.verify(message[".google.api.http"]); - if (error) - return ".google.api.http." + error; - } - if (message[".google.api.methodSignature"] != null && message.hasOwnProperty(".google.api.methodSignature")) { - if (!Array.isArray(message[".google.api.methodSignature"])) - return ".google.api.methodSignature: array expected"; - for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) - if (!$util.isString(message[".google.api.methodSignature"][i])) - return ".google.api.methodSignature: string[] expected"; - } - return null; - }; - - /** - * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.MethodOptions - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.MethodOptions} MethodOptions - */ - MethodOptions.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.MethodOptions) - return object; - var message = new $root.google.protobuf.MethodOptions(); - if (object.deprecated != null) - message.deprecated = Boolean(object.deprecated); - switch (object.idempotencyLevel) { - default: - if (typeof object.idempotencyLevel === "number") { - message.idempotencyLevel = object.idempotencyLevel; - break; - } - break; - case "IDEMPOTENCY_UNKNOWN": - case 0: - message.idempotencyLevel = 0; - break; - case "NO_SIDE_EFFECTS": - case 1: - message.idempotencyLevel = 1; - break; - case "IDEMPOTENT": - case 2: - message.idempotencyLevel = 2; - break; - } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.MethodOptions.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); - } - if (object.uninterpretedOption) { - if (!Array.isArray(object.uninterpretedOption)) - throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); - message.uninterpretedOption = []; - for (var i = 0; i < object.uninterpretedOption.length; ++i) { - if (typeof object.uninterpretedOption[i] !== "object") - throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); - message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); - } - } - if (object[".google.api.http"] != null) { - if (typeof object[".google.api.http"] !== "object") - throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); - message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); - } - if (object[".google.api.methodSignature"]) { - if (!Array.isArray(object[".google.api.methodSignature"])) - throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); - message[".google.api.methodSignature"] = []; - for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) - message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); - } - return message; - }; - - /** - * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.MethodOptions - * @static - * @param {google.protobuf.MethodOptions} message MethodOptions - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - MethodOptions.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.uninterpretedOption = []; - object[".google.api.methodSignature"] = []; - } - if (options.defaults) { - object.deprecated = false; - object.idempotencyLevel = options.enums === String ? "IDEMPOTENCY_UNKNOWN" : 0; - object.features = null; - object[".google.api.http"] = null; - } - if (message.deprecated != null && message.hasOwnProperty("deprecated")) - object.deprecated = message.deprecated; - if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) - object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); - if (message.uninterpretedOption && message.uninterpretedOption.length) { - object.uninterpretedOption = []; - for (var j = 0; j < message.uninterpretedOption.length; ++j) - object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); - } - if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { - object[".google.api.methodSignature"] = []; - for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) - object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; - } - if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) - object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); - return object; - }; - - /** - * Converts this MethodOptions to JSON. - * @function toJSON - * @memberof google.protobuf.MethodOptions - * @instance - * @returns {Object.} JSON object - */ - MethodOptions.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for MethodOptions - * @function getTypeUrl - * @memberof google.protobuf.MethodOptions - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.MethodOptions"; - }; - - /** - * IdempotencyLevel enum. - * @name google.protobuf.MethodOptions.IdempotencyLevel - * @enum {number} - * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value - * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value - * @property {number} IDEMPOTENT=2 IDEMPOTENT value - */ - MethodOptions.IdempotencyLevel = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; - values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; - values[valuesById[2] = "IDEMPOTENT"] = 2; - return values; - })(); - - return MethodOptions; - })(); - - protobuf.UninterpretedOption = (function() { - - /** - * Properties of an UninterpretedOption. - * @memberof google.protobuf - * @interface IUninterpretedOption - * @property {Array.|null} [name] UninterpretedOption name - * @property {string|null} [identifierValue] UninterpretedOption identifierValue - * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue - * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue - * @property {number|null} [doubleValue] UninterpretedOption doubleValue - * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue - * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue - */ - - /** - * Constructs a new UninterpretedOption. - * @memberof google.protobuf - * @classdesc Represents an UninterpretedOption. - * @implements IUninterpretedOption - * @constructor - * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set - */ - function UninterpretedOption(properties) { - this.name = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UninterpretedOption name. - * @member {Array.} name - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.name = $util.emptyArray; - - /** - * UninterpretedOption identifierValue. - * @member {string} identifierValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.identifierValue = ""; - - /** - * UninterpretedOption positiveIntValue. - * @member {number|Long} positiveIntValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * UninterpretedOption negativeIntValue. - * @member {number|Long} negativeIntValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * UninterpretedOption doubleValue. - * @member {number} doubleValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.doubleValue = 0; - - /** - * UninterpretedOption stringValue. - * @member {Uint8Array} stringValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.stringValue = $util.newBuffer([]); - - /** - * UninterpretedOption aggregateValue. - * @member {string} aggregateValue - * @memberof google.protobuf.UninterpretedOption - * @instance - */ - UninterpretedOption.prototype.aggregateValue = ""; - - /** - * Creates a new UninterpretedOption instance using the specified properties. - * @function create - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance - */ - UninterpretedOption.create = function create(properties) { - return new UninterpretedOption(properties); - }; - - /** - * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UninterpretedOption.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.name != null && message.name.length) - for (var i = 0; i < message.name.length; ++i) - $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); - if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) - writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); - if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) - writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); - if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) - writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); - if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) - writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); - if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) - writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); - return writer; - }; - - /** - * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UninterpretedOption.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 2: { - if (!(message.name && message.name.length)) - message.name = []; - message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); - break; - } - case 3: { - message.identifierValue = reader.string(); - break; - } - case 4: { - message.positiveIntValue = reader.uint64(); - break; - } - case 5: { - message.negativeIntValue = reader.int64(); - break; - } - case 6: { - message.doubleValue = reader.double(); - break; - } - case 7: { - message.stringValue = reader.bytes(); - break; - } - case 8: { - message.aggregateValue = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an UninterpretedOption message. - * @function verify - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UninterpretedOption.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.name != null && message.hasOwnProperty("name")) { - if (!Array.isArray(message.name)) - return "name: array expected"; - for (var i = 0; i < message.name.length; ++i) { - var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); - if (error) - return "name." + error; - } - } - if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) - if (!$util.isString(message.identifierValue)) - return "identifierValue: string expected"; - if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) - if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) - return "positiveIntValue: integer|Long expected"; - if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) - if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) - return "negativeIntValue: integer|Long expected"; - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) - if (typeof message.doubleValue !== "number") - return "doubleValue: number expected"; - if (message.stringValue != null && message.hasOwnProperty("stringValue")) - if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) - return "stringValue: buffer expected"; - if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) - if (!$util.isString(message.aggregateValue)) - return "aggregateValue: string expected"; - return null; - }; - - /** - * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UninterpretedOption} UninterpretedOption - */ - UninterpretedOption.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UninterpretedOption) - return object; - var message = new $root.google.protobuf.UninterpretedOption(); - if (object.name) { - if (!Array.isArray(object.name)) - throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); - message.name = []; - for (var i = 0; i < object.name.length; ++i) { - if (typeof object.name[i] !== "object") - throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); - message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); - } - } - if (object.identifierValue != null) - message.identifierValue = String(object.identifierValue); - if (object.positiveIntValue != null) - if ($util.Long) - (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; - else if (typeof object.positiveIntValue === "string") - message.positiveIntValue = parseInt(object.positiveIntValue, 10); - else if (typeof object.positiveIntValue === "number") - message.positiveIntValue = object.positiveIntValue; - else if (typeof object.positiveIntValue === "object") - message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); - if (object.negativeIntValue != null) - if ($util.Long) - (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; - else if (typeof object.negativeIntValue === "string") - message.negativeIntValue = parseInt(object.negativeIntValue, 10); - else if (typeof object.negativeIntValue === "number") - message.negativeIntValue = object.negativeIntValue; - else if (typeof object.negativeIntValue === "object") - message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); - if (object.doubleValue != null) - message.doubleValue = Number(object.doubleValue); - if (object.stringValue != null) - if (typeof object.stringValue === "string") - $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); - else if (object.stringValue.length >= 0) - message.stringValue = object.stringValue; - if (object.aggregateValue != null) - message.aggregateValue = String(object.aggregateValue); - return message; - }; - - /** - * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {google.protobuf.UninterpretedOption} message UninterpretedOption - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UninterpretedOption.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.name = []; - if (options.defaults) { - object.identifierValue = ""; - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.positiveIntValue = options.longs === String ? "0" : 0; - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.negativeIntValue = options.longs === String ? "0" : 0; - object.doubleValue = 0; - if (options.bytes === String) - object.stringValue = ""; - else { - object.stringValue = []; - if (options.bytes !== Array) - object.stringValue = $util.newBuffer(object.stringValue); - } - object.aggregateValue = ""; - } - if (message.name && message.name.length) { - object.name = []; - for (var j = 0; j < message.name.length; ++j) - object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); - } - if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) - object.identifierValue = message.identifierValue; - if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) - if (typeof message.positiveIntValue === "number") - object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; - else - object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; - if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) - if (typeof message.negativeIntValue === "number") - object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; - else - object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; - if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) - object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; - if (message.stringValue != null && message.hasOwnProperty("stringValue")) - object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; - if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) - object.aggregateValue = message.aggregateValue; - return object; - }; - - /** - * Converts this UninterpretedOption to JSON. - * @function toJSON - * @memberof google.protobuf.UninterpretedOption - * @instance - * @returns {Object.} JSON object - */ - UninterpretedOption.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UninterpretedOption - * @function getTypeUrl - * @memberof google.protobuf.UninterpretedOption - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; - }; - - UninterpretedOption.NamePart = (function() { - - /** - * Properties of a NamePart. - * @memberof google.protobuf.UninterpretedOption - * @interface INamePart - * @property {string} namePart NamePart namePart - * @property {boolean} isExtension NamePart isExtension - */ - - /** - * Constructs a new NamePart. - * @memberof google.protobuf.UninterpretedOption - * @classdesc Represents a NamePart. - * @implements INamePart - * @constructor - * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set - */ - function NamePart(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * NamePart namePart. - * @member {string} namePart - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - */ - NamePart.prototype.namePart = ""; - - /** - * NamePart isExtension. - * @member {boolean} isExtension - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - */ - NamePart.prototype.isExtension = false; - - /** - * Creates a new NamePart instance using the specified properties. - * @function create - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance - */ - NamePart.create = function create(properties) { - return new NamePart(properties); - }; - - /** - * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NamePart.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); - writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); - return writer; - }; - - /** - * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - NamePart.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a NamePart message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NamePart.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.namePart = reader.string(); - break; - } - case 2: { - message.isExtension = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - if (!message.hasOwnProperty("namePart")) - throw $util.ProtocolError("missing required 'namePart'", { instance: message }); - if (!message.hasOwnProperty("isExtension")) - throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); - return message; - }; - - /** - * Decodes a NamePart message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - NamePart.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a NamePart message. - * @function verify - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - NamePart.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (!$util.isString(message.namePart)) - return "namePart: string expected"; - if (typeof message.isExtension !== "boolean") - return "isExtension: boolean expected"; - return null; - }; - - /** - * Creates a NamePart message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart - */ - NamePart.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) - return object; - var message = new $root.google.protobuf.UninterpretedOption.NamePart(); - if (object.namePart != null) - message.namePart = String(object.namePart); - if (object.isExtension != null) - message.isExtension = Boolean(object.isExtension); - return message; - }; - - /** - * Creates a plain object from a NamePart message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - NamePart.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.namePart = ""; - object.isExtension = false; - } - if (message.namePart != null && message.hasOwnProperty("namePart")) - object.namePart = message.namePart; - if (message.isExtension != null && message.hasOwnProperty("isExtension")) - object.isExtension = message.isExtension; - return object; - }; - - /** - * Converts this NamePart to JSON. - * @function toJSON - * @memberof google.protobuf.UninterpretedOption.NamePart - * @instance - * @returns {Object.} JSON object - */ - NamePart.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for NamePart - * @function getTypeUrl - * @memberof google.protobuf.UninterpretedOption.NamePart - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; - }; - - return NamePart; - })(); - - return UninterpretedOption; - })(); - - protobuf.FeatureSet = (function() { - - /** - * Properties of a FeatureSet. - * @memberof google.protobuf - * @interface IFeatureSet - * @property {google.protobuf.FeatureSet.FieldPresence|null} [fieldPresence] FeatureSet fieldPresence - * @property {google.protobuf.FeatureSet.EnumType|null} [enumType] FeatureSet enumType - * @property {google.protobuf.FeatureSet.RepeatedFieldEncoding|null} [repeatedFieldEncoding] FeatureSet repeatedFieldEncoding - * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation - * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding - * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat - * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle - * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility - */ - - /** - * Constructs a new FeatureSet. - * @memberof google.protobuf - * @classdesc Represents a FeatureSet. - * @implements IFeatureSet - * @constructor - * @param {google.protobuf.IFeatureSet=} [properties] Properties to set - */ - function FeatureSet(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FeatureSet fieldPresence. - * @member {google.protobuf.FeatureSet.FieldPresence} fieldPresence - * @memberof google.protobuf.FeatureSet - * @instance - */ - FeatureSet.prototype.fieldPresence = 0; - - /** - * FeatureSet enumType. - * @member {google.protobuf.FeatureSet.EnumType} enumType - * @memberof google.protobuf.FeatureSet - * @instance - */ - FeatureSet.prototype.enumType = 0; - - /** - * FeatureSet repeatedFieldEncoding. - * @member {google.protobuf.FeatureSet.RepeatedFieldEncoding} repeatedFieldEncoding - * @memberof google.protobuf.FeatureSet - * @instance - */ - FeatureSet.prototype.repeatedFieldEncoding = 0; - - /** - * FeatureSet utf8Validation. - * @member {google.protobuf.FeatureSet.Utf8Validation} utf8Validation - * @memberof google.protobuf.FeatureSet - * @instance - */ - FeatureSet.prototype.utf8Validation = 0; - - /** - * FeatureSet messageEncoding. - * @member {google.protobuf.FeatureSet.MessageEncoding} messageEncoding - * @memberof google.protobuf.FeatureSet - * @instance - */ - FeatureSet.prototype.messageEncoding = 0; - - /** - * FeatureSet jsonFormat. - * @member {google.protobuf.FeatureSet.JsonFormat} jsonFormat - * @memberof google.protobuf.FeatureSet - * @instance - */ - FeatureSet.prototype.jsonFormat = 0; - - /** - * FeatureSet enforceNamingStyle. - * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle - * @memberof google.protobuf.FeatureSet - * @instance - */ - FeatureSet.prototype.enforceNamingStyle = 0; - - /** - * FeatureSet defaultSymbolVisibility. - * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility - * @memberof google.protobuf.FeatureSet - * @instance - */ - FeatureSet.prototype.defaultSymbolVisibility = 0; - - /** - * Creates a new FeatureSet instance using the specified properties. - * @function create - * @memberof google.protobuf.FeatureSet - * @static - * @param {google.protobuf.IFeatureSet=} [properties] Properties to set - * @returns {google.protobuf.FeatureSet} FeatureSet instance - */ - FeatureSet.create = function create(properties) { - return new FeatureSet(properties); - }; - - /** - * Encodes the specified FeatureSet message. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FeatureSet - * @static - * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeatureSet.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.fieldPresence); - if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.enumType); - if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.repeatedFieldEncoding); - if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.utf8Validation); - if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); - if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) - writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); - if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) - writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); - if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) - writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); - return writer; - }; - - /** - * Encodes the specified FeatureSet message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FeatureSet - * @static - * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeatureSet.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FeatureSet message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FeatureSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FeatureSet} FeatureSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeatureSet.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.fieldPresence = reader.int32(); - break; - } - case 2: { - message.enumType = reader.int32(); - break; - } - case 3: { - message.repeatedFieldEncoding = reader.int32(); - break; - } - case 4: { - message.utf8Validation = reader.int32(); - break; - } - case 5: { - message.messageEncoding = reader.int32(); - break; - } - case 6: { - message.jsonFormat = reader.int32(); - break; - } - case 7: { - message.enforceNamingStyle = reader.int32(); - break; - } - case 8: { - message.defaultSymbolVisibility = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FeatureSet message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FeatureSet - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FeatureSet} FeatureSet - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeatureSet.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FeatureSet message. - * @function verify - * @memberof google.protobuf.FeatureSet - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FeatureSet.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) - switch (message.fieldPresence) { - default: - return "fieldPresence: enum value expected"; - case 0: - case 1: - case 2: - case 3: - break; - } - if (message.enumType != null && message.hasOwnProperty("enumType")) - switch (message.enumType) { - default: - return "enumType: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) - switch (message.repeatedFieldEncoding) { - default: - return "repeatedFieldEncoding: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) - switch (message.utf8Validation) { - default: - return "utf8Validation: enum value expected"; - case 0: - case 2: - case 3: - break; - } - if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) - switch (message.messageEncoding) { - default: - return "messageEncoding: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) - switch (message.jsonFormat) { - default: - return "jsonFormat: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) - switch (message.enforceNamingStyle) { - default: - return "enforceNamingStyle: enum value expected"; - case 0: - case 1: - case 2: - break; - } - if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) - switch (message.defaultSymbolVisibility) { - default: - return "defaultSymbolVisibility: enum value expected"; - case 0: - case 1: - case 2: - case 3: - case 4: - break; - } - return null; - }; - - /** - * Creates a FeatureSet message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FeatureSet - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FeatureSet} FeatureSet - */ - FeatureSet.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FeatureSet) - return object; - var message = new $root.google.protobuf.FeatureSet(); - switch (object.fieldPresence) { - default: - if (typeof object.fieldPresence === "number") { - message.fieldPresence = object.fieldPresence; - break; - } - break; - case "FIELD_PRESENCE_UNKNOWN": - case 0: - message.fieldPresence = 0; - break; - case "EXPLICIT": - case 1: - message.fieldPresence = 1; - break; - case "IMPLICIT": - case 2: - message.fieldPresence = 2; - break; - case "LEGACY_REQUIRED": - case 3: - message.fieldPresence = 3; - break; - } - switch (object.enumType) { - default: - if (typeof object.enumType === "number") { - message.enumType = object.enumType; - break; - } - break; - case "ENUM_TYPE_UNKNOWN": - case 0: - message.enumType = 0; - break; - case "OPEN": - case 1: - message.enumType = 1; - break; - case "CLOSED": - case 2: - message.enumType = 2; - break; - } - switch (object.repeatedFieldEncoding) { - default: - if (typeof object.repeatedFieldEncoding === "number") { - message.repeatedFieldEncoding = object.repeatedFieldEncoding; - break; - } - break; - case "REPEATED_FIELD_ENCODING_UNKNOWN": - case 0: - message.repeatedFieldEncoding = 0; - break; - case "PACKED": - case 1: - message.repeatedFieldEncoding = 1; - break; - case "EXPANDED": - case 2: - message.repeatedFieldEncoding = 2; - break; - } - switch (object.utf8Validation) { - default: - if (typeof object.utf8Validation === "number") { - message.utf8Validation = object.utf8Validation; - break; - } - break; - case "UTF8_VALIDATION_UNKNOWN": - case 0: - message.utf8Validation = 0; - break; - case "VERIFY": - case 2: - message.utf8Validation = 2; - break; - case "NONE": - case 3: - message.utf8Validation = 3; - break; - } - switch (object.messageEncoding) { - default: - if (typeof object.messageEncoding === "number") { - message.messageEncoding = object.messageEncoding; - break; - } - break; - case "MESSAGE_ENCODING_UNKNOWN": - case 0: - message.messageEncoding = 0; - break; - case "LENGTH_PREFIXED": - case 1: - message.messageEncoding = 1; - break; - case "DELIMITED": - case 2: - message.messageEncoding = 2; - break; - } - switch (object.jsonFormat) { - default: - if (typeof object.jsonFormat === "number") { - message.jsonFormat = object.jsonFormat; - break; - } - break; - case "JSON_FORMAT_UNKNOWN": - case 0: - message.jsonFormat = 0; - break; - case "ALLOW": - case 1: - message.jsonFormat = 1; - break; - case "LEGACY_BEST_EFFORT": - case 2: - message.jsonFormat = 2; - break; - } - switch (object.enforceNamingStyle) { - default: - if (typeof object.enforceNamingStyle === "number") { - message.enforceNamingStyle = object.enforceNamingStyle; - break; - } - break; - case "ENFORCE_NAMING_STYLE_UNKNOWN": - case 0: - message.enforceNamingStyle = 0; - break; - case "STYLE2024": - case 1: - message.enforceNamingStyle = 1; - break; - case "STYLE_LEGACY": - case 2: - message.enforceNamingStyle = 2; - break; - } - switch (object.defaultSymbolVisibility) { - default: - if (typeof object.defaultSymbolVisibility === "number") { - message.defaultSymbolVisibility = object.defaultSymbolVisibility; - break; - } - break; - case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": - case 0: - message.defaultSymbolVisibility = 0; - break; - case "EXPORT_ALL": - case 1: - message.defaultSymbolVisibility = 1; - break; - case "EXPORT_TOP_LEVEL": - case 2: - message.defaultSymbolVisibility = 2; - break; - case "LOCAL_ALL": - case 3: - message.defaultSymbolVisibility = 3; - break; - case "STRICT": - case 4: - message.defaultSymbolVisibility = 4; - break; - } - return message; - }; - - /** - * Creates a plain object from a FeatureSet message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FeatureSet - * @static - * @param {google.protobuf.FeatureSet} message FeatureSet - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FeatureSet.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.fieldPresence = options.enums === String ? "FIELD_PRESENCE_UNKNOWN" : 0; - object.enumType = options.enums === String ? "ENUM_TYPE_UNKNOWN" : 0; - object.repeatedFieldEncoding = options.enums === String ? "REPEATED_FIELD_ENCODING_UNKNOWN" : 0; - object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; - object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; - object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; - object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; - object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; - } - if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) - object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; - if (message.enumType != null && message.hasOwnProperty("enumType")) - object.enumType = options.enums === String ? $root.google.protobuf.FeatureSet.EnumType[message.enumType] === undefined ? message.enumType : $root.google.protobuf.FeatureSet.EnumType[message.enumType] : message.enumType; - if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) - object.repeatedFieldEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] === undefined ? message.repeatedFieldEncoding : $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] : message.repeatedFieldEncoding; - if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) - object.utf8Validation = options.enums === String ? $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] === undefined ? message.utf8Validation : $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] : message.utf8Validation; - if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) - object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; - if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) - object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; - if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) - object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; - if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) - object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; - return object; - }; - - /** - * Converts this FeatureSet to JSON. - * @function toJSON - * @memberof google.protobuf.FeatureSet - * @instance - * @returns {Object.} JSON object - */ - FeatureSet.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FeatureSet - * @function getTypeUrl - * @memberof google.protobuf.FeatureSet - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FeatureSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FeatureSet"; - }; - - /** - * FieldPresence enum. - * @name google.protobuf.FeatureSet.FieldPresence - * @enum {number} - * @property {number} FIELD_PRESENCE_UNKNOWN=0 FIELD_PRESENCE_UNKNOWN value - * @property {number} EXPLICIT=1 EXPLICIT value - * @property {number} IMPLICIT=2 IMPLICIT value - * @property {number} LEGACY_REQUIRED=3 LEGACY_REQUIRED value - */ - FeatureSet.FieldPresence = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "FIELD_PRESENCE_UNKNOWN"] = 0; - values[valuesById[1] = "EXPLICIT"] = 1; - values[valuesById[2] = "IMPLICIT"] = 2; - values[valuesById[3] = "LEGACY_REQUIRED"] = 3; - return values; - })(); - - /** - * EnumType enum. - * @name google.protobuf.FeatureSet.EnumType - * @enum {number} - * @property {number} ENUM_TYPE_UNKNOWN=0 ENUM_TYPE_UNKNOWN value - * @property {number} OPEN=1 OPEN value - * @property {number} CLOSED=2 CLOSED value - */ - FeatureSet.EnumType = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "ENUM_TYPE_UNKNOWN"] = 0; - values[valuesById[1] = "OPEN"] = 1; - values[valuesById[2] = "CLOSED"] = 2; - return values; - })(); - - /** - * RepeatedFieldEncoding enum. - * @name google.protobuf.FeatureSet.RepeatedFieldEncoding - * @enum {number} - * @property {number} REPEATED_FIELD_ENCODING_UNKNOWN=0 REPEATED_FIELD_ENCODING_UNKNOWN value - * @property {number} PACKED=1 PACKED value - * @property {number} EXPANDED=2 EXPANDED value - */ - FeatureSet.RepeatedFieldEncoding = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "REPEATED_FIELD_ENCODING_UNKNOWN"] = 0; - values[valuesById[1] = "PACKED"] = 1; - values[valuesById[2] = "EXPANDED"] = 2; - return values; - })(); - - /** - * Utf8Validation enum. - * @name google.protobuf.FeatureSet.Utf8Validation - * @enum {number} - * @property {number} UTF8_VALIDATION_UNKNOWN=0 UTF8_VALIDATION_UNKNOWN value - * @property {number} VERIFY=2 VERIFY value - * @property {number} NONE=3 NONE value - */ - FeatureSet.Utf8Validation = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "UTF8_VALIDATION_UNKNOWN"] = 0; - values[valuesById[2] = "VERIFY"] = 2; - values[valuesById[3] = "NONE"] = 3; - return values; - })(); - - /** - * MessageEncoding enum. - * @name google.protobuf.FeatureSet.MessageEncoding - * @enum {number} - * @property {number} MESSAGE_ENCODING_UNKNOWN=0 MESSAGE_ENCODING_UNKNOWN value - * @property {number} LENGTH_PREFIXED=1 LENGTH_PREFIXED value - * @property {number} DELIMITED=2 DELIMITED value - */ - FeatureSet.MessageEncoding = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "MESSAGE_ENCODING_UNKNOWN"] = 0; - values[valuesById[1] = "LENGTH_PREFIXED"] = 1; - values[valuesById[2] = "DELIMITED"] = 2; - return values; - })(); - - /** - * JsonFormat enum. - * @name google.protobuf.FeatureSet.JsonFormat - * @enum {number} - * @property {number} JSON_FORMAT_UNKNOWN=0 JSON_FORMAT_UNKNOWN value - * @property {number} ALLOW=1 ALLOW value - * @property {number} LEGACY_BEST_EFFORT=2 LEGACY_BEST_EFFORT value - */ - FeatureSet.JsonFormat = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "JSON_FORMAT_UNKNOWN"] = 0; - values[valuesById[1] = "ALLOW"] = 1; - values[valuesById[2] = "LEGACY_BEST_EFFORT"] = 2; - return values; - })(); - - /** - * EnforceNamingStyle enum. - * @name google.protobuf.FeatureSet.EnforceNamingStyle - * @enum {number} - * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value - * @property {number} STYLE2024=1 STYLE2024 value - * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value - */ - FeatureSet.EnforceNamingStyle = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; - values[valuesById[1] = "STYLE2024"] = 1; - values[valuesById[2] = "STYLE_LEGACY"] = 2; - return values; - })(); - - FeatureSet.VisibilityFeature = (function() { - - /** - * Properties of a VisibilityFeature. - * @memberof google.protobuf.FeatureSet - * @interface IVisibilityFeature - */ - - /** - * Constructs a new VisibilityFeature. - * @memberof google.protobuf.FeatureSet - * @classdesc Represents a VisibilityFeature. - * @implements IVisibilityFeature - * @constructor - * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set - */ - function VisibilityFeature(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Creates a new VisibilityFeature instance using the specified properties. - * @function create - * @memberof google.protobuf.FeatureSet.VisibilityFeature - * @static - * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set - * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance - */ - VisibilityFeature.create = function create(properties) { - return new VisibilityFeature(properties); - }; - - /** - * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FeatureSet.VisibilityFeature - * @static - * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VisibilityFeature.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FeatureSet.VisibilityFeature - * @static - * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a VisibilityFeature message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FeatureSet.VisibilityFeature - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VisibilityFeature.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FeatureSet.VisibilityFeature - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a VisibilityFeature message. - * @function verify - * @memberof google.protobuf.FeatureSet.VisibilityFeature - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - VisibilityFeature.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FeatureSet.VisibilityFeature - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature - */ - VisibilityFeature.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) - return object; - return new $root.google.protobuf.FeatureSet.VisibilityFeature(); - }; - - /** - * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FeatureSet.VisibilityFeature - * @static - * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - VisibilityFeature.toObject = function toObject() { - return {}; - }; - - /** - * Converts this VisibilityFeature to JSON. - * @function toJSON - * @memberof google.protobuf.FeatureSet.VisibilityFeature - * @instance - * @returns {Object.} JSON object - */ - VisibilityFeature.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for VisibilityFeature - * @function getTypeUrl - * @memberof google.protobuf.FeatureSet.VisibilityFeature - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; - }; - - /** - * DefaultSymbolVisibility enum. - * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility - * @enum {number} - * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value - * @property {number} EXPORT_ALL=1 EXPORT_ALL value - * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value - * @property {number} LOCAL_ALL=3 LOCAL_ALL value - * @property {number} STRICT=4 STRICT value - */ - VisibilityFeature.DefaultSymbolVisibility = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; - values[valuesById[1] = "EXPORT_ALL"] = 1; - values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; - values[valuesById[3] = "LOCAL_ALL"] = 3; - values[valuesById[4] = "STRICT"] = 4; - return values; - })(); - - return VisibilityFeature; - })(); - - return FeatureSet; - })(); - - protobuf.FeatureSetDefaults = (function() { - - /** - * Properties of a FeatureSetDefaults. - * @memberof google.protobuf - * @interface IFeatureSetDefaults - * @property {Array.|null} [defaults] FeatureSetDefaults defaults - * @property {google.protobuf.Edition|null} [minimumEdition] FeatureSetDefaults minimumEdition - * @property {google.protobuf.Edition|null} [maximumEdition] FeatureSetDefaults maximumEdition - */ - - /** - * Constructs a new FeatureSetDefaults. - * @memberof google.protobuf - * @classdesc Represents a FeatureSetDefaults. - * @implements IFeatureSetDefaults - * @constructor - * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set - */ - function FeatureSetDefaults(properties) { - this.defaults = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FeatureSetDefaults defaults. - * @member {Array.} defaults - * @memberof google.protobuf.FeatureSetDefaults - * @instance - */ - FeatureSetDefaults.prototype.defaults = $util.emptyArray; - - /** - * FeatureSetDefaults minimumEdition. - * @member {google.protobuf.Edition} minimumEdition - * @memberof google.protobuf.FeatureSetDefaults - * @instance - */ - FeatureSetDefaults.prototype.minimumEdition = 0; - - /** - * FeatureSetDefaults maximumEdition. - * @member {google.protobuf.Edition} maximumEdition - * @memberof google.protobuf.FeatureSetDefaults - * @instance - */ - FeatureSetDefaults.prototype.maximumEdition = 0; - - /** - * Creates a new FeatureSetDefaults instance using the specified properties. - * @function create - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set - * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults instance - */ - FeatureSetDefaults.create = function create(properties) { - return new FeatureSetDefaults(properties); - }; - - /** - * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeatureSetDefaults.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.defaults != null && message.defaults.length) - for (var i = 0; i < message.defaults.length; ++i) - $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.encode(message.defaults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minimumEdition); - if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maximumEdition); - return writer; - }; - - /** - * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeatureSetDefaults.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FeatureSetDefaults message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeatureSetDefaults.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.defaults && message.defaults.length)) - message.defaults = []; - message.defaults.push($root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.decode(reader, reader.uint32())); - break; - } - case 4: { - message.minimumEdition = reader.int32(); - break; - } - case 5: { - message.maximumEdition = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeatureSetDefaults.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FeatureSetDefaults message. - * @function verify - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FeatureSetDefaults.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.defaults != null && message.hasOwnProperty("defaults")) { - if (!Array.isArray(message.defaults)) - return "defaults: array expected"; - for (var i = 0; i < message.defaults.length; ++i) { - var error = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify(message.defaults[i]); - if (error) - return "defaults." + error; - } - } - if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) - switch (message.minimumEdition) { - default: - return "minimumEdition: enum value expected"; - case 0: - case 900: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) - switch (message.maximumEdition) { - default: - return "maximumEdition: enum value expected"; - case 0: - case 900: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - return null; - }; - - /** - * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults - */ - FeatureSetDefaults.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FeatureSetDefaults) - return object; - var message = new $root.google.protobuf.FeatureSetDefaults(); - if (object.defaults) { - if (!Array.isArray(object.defaults)) - throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: array expected"); - message.defaults = []; - for (var i = 0; i < object.defaults.length; ++i) { - if (typeof object.defaults[i] !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: object expected"); - message.defaults[i] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fromObject(object.defaults[i]); - } - } - switch (object.minimumEdition) { - default: - if (typeof object.minimumEdition === "number") { - message.minimumEdition = object.minimumEdition; - break; - } - break; - case "EDITION_UNKNOWN": - case 0: - message.minimumEdition = 0; - break; - case "EDITION_LEGACY": - case 900: - message.minimumEdition = 900; - break; - case "EDITION_PROTO2": - case 998: - message.minimumEdition = 998; - break; - case "EDITION_PROTO3": - case 999: - message.minimumEdition = 999; - break; - case "EDITION_2023": - case 1000: - message.minimumEdition = 1000; - break; - case "EDITION_2024": - case 1001: - message.minimumEdition = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.minimumEdition = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.minimumEdition = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.minimumEdition = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.minimumEdition = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.minimumEdition = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.minimumEdition = 2147483647; - break; - } - switch (object.maximumEdition) { - default: - if (typeof object.maximumEdition === "number") { - message.maximumEdition = object.maximumEdition; - break; - } - break; - case "EDITION_UNKNOWN": - case 0: - message.maximumEdition = 0; - break; - case "EDITION_LEGACY": - case 900: - message.maximumEdition = 900; - break; - case "EDITION_PROTO2": - case 998: - message.maximumEdition = 998; - break; - case "EDITION_PROTO3": - case 999: - message.maximumEdition = 999; - break; - case "EDITION_2023": - case 1000: - message.maximumEdition = 1000; - break; - case "EDITION_2024": - case 1001: - message.maximumEdition = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.maximumEdition = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.maximumEdition = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.maximumEdition = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.maximumEdition = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.maximumEdition = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.maximumEdition = 2147483647; - break; - } - return message; - }; - - /** - * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {google.protobuf.FeatureSetDefaults} message FeatureSetDefaults - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FeatureSetDefaults.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.defaults = []; - if (options.defaults) { - object.minimumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; - object.maximumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; - } - if (message.defaults && message.defaults.length) { - object.defaults = []; - for (var j = 0; j < message.defaults.length; ++j) - object.defaults[j] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.toObject(message.defaults[j], options); - } - if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) - object.minimumEdition = options.enums === String ? $root.google.protobuf.Edition[message.minimumEdition] === undefined ? message.minimumEdition : $root.google.protobuf.Edition[message.minimumEdition] : message.minimumEdition; - if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) - object.maximumEdition = options.enums === String ? $root.google.protobuf.Edition[message.maximumEdition] === undefined ? message.maximumEdition : $root.google.protobuf.Edition[message.maximumEdition] : message.maximumEdition; - return object; - }; - - /** - * Converts this FeatureSetDefaults to JSON. - * @function toJSON - * @memberof google.protobuf.FeatureSetDefaults - * @instance - * @returns {Object.} JSON object - */ - FeatureSetDefaults.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FeatureSetDefaults - * @function getTypeUrl - * @memberof google.protobuf.FeatureSetDefaults - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FeatureSetDefaults.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults"; - }; - - FeatureSetDefaults.FeatureSetEditionDefault = (function() { - - /** - * Properties of a FeatureSetEditionDefault. - * @memberof google.protobuf.FeatureSetDefaults - * @interface IFeatureSetEditionDefault - * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures - * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures - */ - - /** - * Constructs a new FeatureSetEditionDefault. - * @memberof google.protobuf.FeatureSetDefaults - * @classdesc Represents a FeatureSetEditionDefault. - * @implements IFeatureSetEditionDefault - * @constructor - * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set - */ - function FeatureSetEditionDefault(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FeatureSetEditionDefault edition. - * @member {google.protobuf.Edition} edition - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @instance - */ - FeatureSetEditionDefault.prototype.edition = 0; - - /** - * FeatureSetEditionDefault overridableFeatures. - * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @instance - */ - FeatureSetEditionDefault.prototype.overridableFeatures = null; - - /** - * FeatureSetEditionDefault fixedFeatures. - * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @instance - */ - FeatureSetEditionDefault.prototype.fixedFeatures = null; - - /** - * Creates a new FeatureSetEditionDefault instance using the specified properties. - * @function create - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set - * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault instance - */ - FeatureSetEditionDefault.create = function create(properties) { - return new FeatureSetEditionDefault(properties); - }; - - /** - * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeatureSetEditionDefault.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); - if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) - $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); - if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) - $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FeatureSetEditionDefault.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeatureSetEditionDefault.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 3: { - message.edition = reader.int32(); - break; - } - case 4: { - message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - case 5: { - message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FeatureSetEditionDefault.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FeatureSetEditionDefault message. - * @function verify - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FeatureSetEditionDefault.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.edition != null && message.hasOwnProperty("edition")) - switch (message.edition) { - default: - return "edition: enum value expected"; - case 0: - case 900: - case 998: - case 999: - case 1000: - case 1001: - case 1: - case 2: - case 99997: - case 99998: - case 99999: - case 2147483647: - break; - } - if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { - var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); - if (error) - return "overridableFeatures." + error; - } - if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { - var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); - if (error) - return "fixedFeatures." + error; - } - return null; - }; - - /** - * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault - */ - FeatureSetEditionDefault.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) - return object; - var message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); - switch (object.edition) { - default: - if (typeof object.edition === "number") { - message.edition = object.edition; - break; - } - break; - case "EDITION_UNKNOWN": - case 0: - message.edition = 0; - break; - case "EDITION_LEGACY": - case 900: - message.edition = 900; - break; - case "EDITION_PROTO2": - case 998: - message.edition = 998; - break; - case "EDITION_PROTO3": - case 999: - message.edition = 999; - break; - case "EDITION_2023": - case 1000: - message.edition = 1000; - break; - case "EDITION_2024": - case 1001: - message.edition = 1001; - break; - case "EDITION_1_TEST_ONLY": - case 1: - message.edition = 1; - break; - case "EDITION_2_TEST_ONLY": - case 2: - message.edition = 2; - break; - case "EDITION_99997_TEST_ONLY": - case 99997: - message.edition = 99997; - break; - case "EDITION_99998_TEST_ONLY": - case 99998: - message.edition = 99998; - break; - case "EDITION_99999_TEST_ONLY": - case 99999: - message.edition = 99999; - break; - case "EDITION_MAX": - case 2147483647: - message.edition = 2147483647; - break; - } - if (object.overridableFeatures != null) { - if (typeof object.overridableFeatures !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); - message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); - } - if (object.fixedFeatures != null) { - if (typeof object.fixedFeatures !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); - message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); - } - return message; - }; - - /** - * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} message FeatureSetEditionDefault - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FeatureSetEditionDefault.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; - object.overridableFeatures = null; - object.fixedFeatures = null; - } - if (message.edition != null && message.hasOwnProperty("edition")) - object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; - if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) - object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); - if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) - object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); - return object; - }; - - /** - * Converts this FeatureSetEditionDefault to JSON. - * @function toJSON - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @instance - * @returns {Object.} JSON object - */ - FeatureSetEditionDefault.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FeatureSetEditionDefault - * @function getTypeUrl - * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FeatureSetEditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"; - }; - - return FeatureSetEditionDefault; - })(); - - return FeatureSetDefaults; - })(); - - protobuf.SourceCodeInfo = (function() { - - /** - * Properties of a SourceCodeInfo. - * @memberof google.protobuf - * @interface ISourceCodeInfo - * @property {Array.|null} [location] SourceCodeInfo location - */ - - /** - * Constructs a new SourceCodeInfo. - * @memberof google.protobuf - * @classdesc Represents a SourceCodeInfo. - * @implements ISourceCodeInfo - * @constructor - * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set - */ - function SourceCodeInfo(properties) { - this.location = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * SourceCodeInfo location. - * @member {Array.} location - * @memberof google.protobuf.SourceCodeInfo - * @instance - */ - SourceCodeInfo.prototype.location = $util.emptyArray; - - /** - * Creates a new SourceCodeInfo instance using the specified properties. - * @function create - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance - */ - SourceCodeInfo.create = function create(properties) { - return new SourceCodeInfo(properties); - }; - - /** - * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @function encode - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SourceCodeInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.location != null && message.location.length) - for (var i = 0; i < message.location.length; ++i) - $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a SourceCodeInfo message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SourceCodeInfo.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.location && message.location.length)) - message.location = []; - message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a SourceCodeInfo message. - * @function verify - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - SourceCodeInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.location != null && message.hasOwnProperty("location")) { - if (!Array.isArray(message.location)) - return "location: array expected"; - for (var i = 0; i < message.location.length; ++i) { - var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); - if (error) - return "location." + error; - } - } - return null; - }; - - /** - * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo - */ - SourceCodeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.SourceCodeInfo) - return object; - var message = new $root.google.protobuf.SourceCodeInfo(); - if (object.location) { - if (!Array.isArray(object.location)) - throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); - message.location = []; - for (var i = 0; i < object.location.length; ++i) { - if (typeof object.location[i] !== "object") - throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); - message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - SourceCodeInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.location = []; - if (message.location && message.location.length) { - object.location = []; - for (var j = 0; j < message.location.length; ++j) - object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); - } - return object; - }; - - /** - * Converts this SourceCodeInfo to JSON. - * @function toJSON - * @memberof google.protobuf.SourceCodeInfo - * @instance - * @returns {Object.} JSON object - */ - SourceCodeInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for SourceCodeInfo - * @function getTypeUrl - * @memberof google.protobuf.SourceCodeInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; - }; - - SourceCodeInfo.Location = (function() { - - /** - * Properties of a Location. - * @memberof google.protobuf.SourceCodeInfo - * @interface ILocation - * @property {Array.|null} [path] Location path - * @property {Array.|null} [span] Location span - * @property {string|null} [leadingComments] Location leadingComments - * @property {string|null} [trailingComments] Location trailingComments - * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments - */ - - /** - * Constructs a new Location. - * @memberof google.protobuf.SourceCodeInfo - * @classdesc Represents a Location. - * @implements ILocation - * @constructor - * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set - */ - function Location(properties) { - this.path = []; - this.span = []; - this.leadingDetachedComments = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Location path. - * @member {Array.} path - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.path = $util.emptyArray; - - /** - * Location span. - * @member {Array.} span - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.span = $util.emptyArray; - - /** - * Location leadingComments. - * @member {string} leadingComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.leadingComments = ""; - - /** - * Location trailingComments. - * @member {string} trailingComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.trailingComments = ""; - - /** - * Location leadingDetachedComments. - * @member {Array.} leadingDetachedComments - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - */ - Location.prototype.leadingDetachedComments = $util.emptyArray; - - /** - * Creates a new Location instance using the specified properties. - * @function create - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set - * @returns {google.protobuf.SourceCodeInfo.Location} Location instance - */ - Location.create = function create(properties) { - return new Location(properties); - }; - - /** - * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @function encode - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Location.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && message.path.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.path.length; ++i) - writer.int32(message.path[i]); - writer.ldelim(); - } - if (message.span != null && message.span.length) { - writer.uint32(/* id 2, wireType 2 =*/18).fork(); - for (var i = 0; i < message.span.length; ++i) - writer.int32(message.span[i]); - writer.ldelim(); - } - if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) - writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); - if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) - writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); - if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) - for (var i = 0; i < message.leadingDetachedComments.length; ++i) - writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); - return writer; - }; - - /** - * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Location.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Location message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.SourceCodeInfo.Location} Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Location.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - } - case 2: { - if (!(message.span && message.span.length)) - message.span = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.span.push(reader.int32()); - } else - message.span.push(reader.int32()); - break; - } - case 3: { - message.leadingComments = reader.string(); - break; - } - case 4: { - message.trailingComments = reader.string(); - break; - } - case 6: { - if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) - message.leadingDetachedComments = []; - message.leadingDetachedComments.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Location message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.SourceCodeInfo.Location} Location - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Location.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Location message. - * @function verify - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Location.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) { - if (!Array.isArray(message.path)) - return "path: array expected"; - for (var i = 0; i < message.path.length; ++i) - if (!$util.isInteger(message.path[i])) - return "path: integer[] expected"; - } - if (message.span != null && message.hasOwnProperty("span")) { - if (!Array.isArray(message.span)) - return "span: array expected"; - for (var i = 0; i < message.span.length; ++i) - if (!$util.isInteger(message.span[i])) - return "span: integer[] expected"; - } - if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) - if (!$util.isString(message.leadingComments)) - return "leadingComments: string expected"; - if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) - if (!$util.isString(message.trailingComments)) - return "trailingComments: string expected"; - if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { - if (!Array.isArray(message.leadingDetachedComments)) - return "leadingDetachedComments: array expected"; - for (var i = 0; i < message.leadingDetachedComments.length; ++i) - if (!$util.isString(message.leadingDetachedComments[i])) - return "leadingDetachedComments: string[] expected"; - } - return null; - }; - - /** - * Creates a Location message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.SourceCodeInfo.Location} Location - */ - Location.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) - return object; - var message = new $root.google.protobuf.SourceCodeInfo.Location(); - if (object.path) { - if (!Array.isArray(object.path)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); - message.path = []; - for (var i = 0; i < object.path.length; ++i) - message.path[i] = object.path[i] | 0; - } - if (object.span) { - if (!Array.isArray(object.span)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); - message.span = []; - for (var i = 0; i < object.span.length; ++i) - message.span[i] = object.span[i] | 0; - } - if (object.leadingComments != null) - message.leadingComments = String(object.leadingComments); - if (object.trailingComments != null) - message.trailingComments = String(object.trailingComments); - if (object.leadingDetachedComments) { - if (!Array.isArray(object.leadingDetachedComments)) - throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); - message.leadingDetachedComments = []; - for (var i = 0; i < object.leadingDetachedComments.length; ++i) - message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); - } - return message; - }; - - /** - * Creates a plain object from a Location message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {google.protobuf.SourceCodeInfo.Location} message Location - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Location.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) { - object.path = []; - object.span = []; - object.leadingDetachedComments = []; - } - if (options.defaults) { - object.leadingComments = ""; - object.trailingComments = ""; - } - if (message.path && message.path.length) { - object.path = []; - for (var j = 0; j < message.path.length; ++j) - object.path[j] = message.path[j]; - } - if (message.span && message.span.length) { - object.span = []; - for (var j = 0; j < message.span.length; ++j) - object.span[j] = message.span[j]; - } - if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) - object.leadingComments = message.leadingComments; - if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) - object.trailingComments = message.trailingComments; - if (message.leadingDetachedComments && message.leadingDetachedComments.length) { - object.leadingDetachedComments = []; - for (var j = 0; j < message.leadingDetachedComments.length; ++j) - object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; - } - return object; - }; - - /** - * Converts this Location to JSON. - * @function toJSON - * @memberof google.protobuf.SourceCodeInfo.Location - * @instance - * @returns {Object.} JSON object - */ - Location.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Location - * @function getTypeUrl - * @memberof google.protobuf.SourceCodeInfo.Location - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; - }; - - return Location; - })(); - - return SourceCodeInfo; - })(); - - protobuf.GeneratedCodeInfo = (function() { - - /** - * Properties of a GeneratedCodeInfo. - * @memberof google.protobuf - * @interface IGeneratedCodeInfo - * @property {Array.|null} [annotation] GeneratedCodeInfo annotation - */ - - /** - * Constructs a new GeneratedCodeInfo. - * @memberof google.protobuf - * @classdesc Represents a GeneratedCodeInfo. - * @implements IGeneratedCodeInfo - * @constructor - * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set - */ - function GeneratedCodeInfo(properties) { - this.annotation = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * GeneratedCodeInfo annotation. - * @member {Array.} annotation - * @memberof google.protobuf.GeneratedCodeInfo - * @instance - */ - GeneratedCodeInfo.prototype.annotation = $util.emptyArray; - - /** - * Creates a new GeneratedCodeInfo instance using the specified properties. - * @function create - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance - */ - GeneratedCodeInfo.create = function create(properties) { - return new GeneratedCodeInfo(properties); - }; - - /** - * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @function encode - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GeneratedCodeInfo.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.annotation != null && message.annotation.length) - for (var i = 0; i < message.annotation.length; ++i) - $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GeneratedCodeInfo.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.annotation && message.annotation.length)) - message.annotation = []; - message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a GeneratedCodeInfo message. - * @function verify - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - GeneratedCodeInfo.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.annotation != null && message.hasOwnProperty("annotation")) { - if (!Array.isArray(message.annotation)) - return "annotation: array expected"; - for (var i = 0; i < message.annotation.length; ++i) { - var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); - if (error) - return "annotation." + error; - } - } - return null; - }; - - /** - * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo - */ - GeneratedCodeInfo.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.GeneratedCodeInfo) - return object; - var message = new $root.google.protobuf.GeneratedCodeInfo(); - if (object.annotation) { - if (!Array.isArray(object.annotation)) - throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); - message.annotation = []; - for (var i = 0; i < object.annotation.length; ++i) { - if (typeof object.annotation[i] !== "object") - throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); - message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - GeneratedCodeInfo.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.annotation = []; - if (message.annotation && message.annotation.length) { - object.annotation = []; - for (var j = 0; j < message.annotation.length; ++j) - object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); - } - return object; - }; - - /** - * Converts this GeneratedCodeInfo to JSON. - * @function toJSON - * @memberof google.protobuf.GeneratedCodeInfo - * @instance - * @returns {Object.} JSON object - */ - GeneratedCodeInfo.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for GeneratedCodeInfo - * @function getTypeUrl - * @memberof google.protobuf.GeneratedCodeInfo - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; - }; - - GeneratedCodeInfo.Annotation = (function() { - - /** - * Properties of an Annotation. - * @memberof google.protobuf.GeneratedCodeInfo - * @interface IAnnotation - * @property {Array.|null} [path] Annotation path - * @property {string|null} [sourceFile] Annotation sourceFile - * @property {number|null} [begin] Annotation begin - * @property {number|null} [end] Annotation end - * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic - */ - - /** - * Constructs a new Annotation. - * @memberof google.protobuf.GeneratedCodeInfo - * @classdesc Represents an Annotation. - * @implements IAnnotation - * @constructor - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set - */ - function Annotation(properties) { - this.path = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Annotation path. - * @member {Array.} path - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.path = $util.emptyArray; - - /** - * Annotation sourceFile. - * @member {string} sourceFile - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.sourceFile = ""; - - /** - * Annotation begin. - * @member {number} begin - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.begin = 0; - - /** - * Annotation end. - * @member {number} end - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.end = 0; - - /** - * Annotation semantic. - * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - */ - Annotation.prototype.semantic = 0; - - /** - * Creates a new Annotation instance using the specified properties. - * @function create - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance - */ - Annotation.create = function create(properties) { - return new Annotation(properties); - }; - - /** - * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @function encode - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Annotation.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.path != null && message.path.length) { - writer.uint32(/* id 1, wireType 2 =*/10).fork(); - for (var i = 0; i < message.path.length; ++i) - writer.int32(message.path[i]); - writer.ldelim(); - } - if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); - if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) - writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); - if (message.end != null && Object.hasOwnProperty.call(message, "end")) - writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); - if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) - writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); - return writer; - }; - - /** - * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Annotation.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Annotation message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Annotation.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.path && message.path.length)) - message.path = []; - if ((tag & 7) === 2) { - var end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) - message.path.push(reader.int32()); - } else - message.path.push(reader.int32()); - break; - } - case 2: { - message.sourceFile = reader.string(); - break; - } - case 3: { - message.begin = reader.int32(); - break; - } - case 4: { - message.end = reader.int32(); - break; - } - case 5: { - message.semantic = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Annotation message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Annotation.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Annotation message. - * @function verify - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Annotation.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.path != null && message.hasOwnProperty("path")) { - if (!Array.isArray(message.path)) - return "path: array expected"; - for (var i = 0; i < message.path.length; ++i) - if (!$util.isInteger(message.path[i])) - return "path: integer[] expected"; - } - if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) - if (!$util.isString(message.sourceFile)) - return "sourceFile: string expected"; - if (message.begin != null && message.hasOwnProperty("begin")) - if (!$util.isInteger(message.begin)) - return "begin: integer expected"; - if (message.end != null && message.hasOwnProperty("end")) - if (!$util.isInteger(message.end)) - return "end: integer expected"; - if (message.semantic != null && message.hasOwnProperty("semantic")) - switch (message.semantic) { - default: - return "semantic: enum value expected"; - case 0: - case 1: - case 2: - break; - } - return null; - }; - - /** - * Creates an Annotation message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation - */ - Annotation.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) - return object; - var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); - if (object.path) { - if (!Array.isArray(object.path)) - throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); - message.path = []; - for (var i = 0; i < object.path.length; ++i) - message.path[i] = object.path[i] | 0; - } - if (object.sourceFile != null) - message.sourceFile = String(object.sourceFile); - if (object.begin != null) - message.begin = object.begin | 0; - if (object.end != null) - message.end = object.end | 0; - switch (object.semantic) { - default: - if (typeof object.semantic === "number") { - message.semantic = object.semantic; - break; - } - break; - case "NONE": - case 0: - message.semantic = 0; - break; - case "SET": - case 1: - message.semantic = 1; - break; - case "ALIAS": - case 2: - message.semantic = 2; - break; - } - return message; - }; - - /** - * Creates a plain object from an Annotation message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Annotation.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.path = []; - if (options.defaults) { - object.sourceFile = ""; - object.begin = 0; - object.end = 0; - object.semantic = options.enums === String ? "NONE" : 0; - } - if (message.path && message.path.length) { - object.path = []; - for (var j = 0; j < message.path.length; ++j) - object.path[j] = message.path[j]; - } - if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) - object.sourceFile = message.sourceFile; - if (message.begin != null && message.hasOwnProperty("begin")) - object.begin = message.begin; - if (message.end != null && message.hasOwnProperty("end")) - object.end = message.end; - if (message.semantic != null && message.hasOwnProperty("semantic")) - object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; - return object; - }; - - /** - * Converts this Annotation to JSON. - * @function toJSON - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @instance - * @returns {Object.} JSON object - */ - Annotation.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Annotation - * @function getTypeUrl - * @memberof google.protobuf.GeneratedCodeInfo.Annotation - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Annotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo.Annotation"; - }; - - /** - * Semantic enum. - * @name google.protobuf.GeneratedCodeInfo.Annotation.Semantic - * @enum {number} - * @property {number} NONE=0 NONE value - * @property {number} SET=1 SET value - * @property {number} ALIAS=2 ALIAS value - */ - Annotation.Semantic = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "NONE"] = 0; - values[valuesById[1] = "SET"] = 1; - values[valuesById[2] = "ALIAS"] = 2; - return values; - })(); - - return Annotation; - })(); - - return GeneratedCodeInfo; - })(); - - /** - * SymbolVisibility enum. - * @name google.protobuf.SymbolVisibility - * @enum {number} - * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value - * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value - * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value - */ - protobuf.SymbolVisibility = (function() { - var valuesById = {}, values = Object.create(valuesById); - values[valuesById[0] = "VISIBILITY_UNSET"] = 0; - values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; - values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; - return values; - })(); - - protobuf.Duration = (function() { - - /** - * Properties of a Duration. - * @memberof google.protobuf - * @interface IDuration - * @property {number|Long|null} [seconds] Duration seconds - * @property {number|null} [nanos] Duration nanos - */ - - /** - * Constructs a new Duration. - * @memberof google.protobuf - * @classdesc Represents a Duration. - * @implements IDuration - * @constructor - * @param {google.protobuf.IDuration=} [properties] Properties to set - */ - function Duration(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Duration seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Duration - * @instance - */ - Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Duration nanos. - * @member {number} nanos - * @memberof google.protobuf.Duration - * @instance - */ - Duration.prototype.nanos = 0; - - /** - * Creates a new Duration instance using the specified properties. - * @function create - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.IDuration=} [properties] Properties to set - * @returns {google.protobuf.Duration} Duration instance - */ - Duration.create = function create(properties) { - return new Duration(properties); - }; - - /** - * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Duration.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); - return writer; - }; - - /** - * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.IDuration} message Duration message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Duration.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Duration message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Duration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Duration} Duration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Duration.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.seconds = reader.int64(); - break; - } - case 2: { - message.nanos = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Duration message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Duration - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Duration} Duration - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Duration.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Duration message. - * @function verify - * @memberof google.protobuf.Duration - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Duration.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; - return null; - }; - - /** - * Creates a Duration message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Duration - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Duration} Duration - */ - Duration.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Duration) - return object; - var message = new $root.google.protobuf.Duration(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; - return message; - }; - - /** - * Creates a plain object from a Duration message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Duration - * @static - * @param {google.protobuf.Duration} message Duration - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Duration.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; - } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; - return object; - }; - - /** - * Converts this Duration to JSON. - * @function toJSON - * @memberof google.protobuf.Duration - * @instance - * @returns {Object.} JSON object - */ - Duration.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Duration - * @function getTypeUrl - * @memberof google.protobuf.Duration - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Duration"; - }; - - return Duration; - })(); - - protobuf.Timestamp = (function() { - - /** - * Properties of a Timestamp. - * @memberof google.protobuf - * @interface ITimestamp - * @property {number|Long|null} [seconds] Timestamp seconds - * @property {number|null} [nanos] Timestamp nanos - */ - - /** - * Constructs a new Timestamp. - * @memberof google.protobuf - * @classdesc Represents a Timestamp. - * @implements ITimestamp - * @constructor - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - */ - function Timestamp(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Timestamp seconds. - * @member {number|Long} seconds - * @memberof google.protobuf.Timestamp - * @instance - */ - Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Timestamp nanos. - * @member {number} nanos - * @memberof google.protobuf.Timestamp - * @instance - */ - Timestamp.prototype.nanos = 0; - - /** - * Creates a new Timestamp instance using the specified properties. - * @function create - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp=} [properties] Properties to set - * @returns {google.protobuf.Timestamp} Timestamp instance - */ - Timestamp.create = function create(properties) { - return new Timestamp(properties); - }; - - /** - * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Timestamp.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); - if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) - writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); - return writer; - }; - - /** - * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Timestamp.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Timestamp message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Timestamp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Timestamp} Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Timestamp.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.seconds = reader.int64(); - break; - } - case 2: { - message.nanos = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Timestamp message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Timestamp - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Timestamp} Timestamp - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Timestamp.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Timestamp message. - * @function verify - * @memberof google.protobuf.Timestamp - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Timestamp.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) - return "seconds: integer|Long expected"; - if (message.nanos != null && message.hasOwnProperty("nanos")) - if (!$util.isInteger(message.nanos)) - return "nanos: integer expected"; - return null; - }; - - /** - * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Timestamp - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Timestamp} Timestamp - */ - Timestamp.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Timestamp) - return object; - var message = new $root.google.protobuf.Timestamp(); - if (object.seconds != null) - if ($util.Long) - (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; - else if (typeof object.seconds === "string") - message.seconds = parseInt(object.seconds, 10); - else if (typeof object.seconds === "number") - message.seconds = object.seconds; - else if (typeof object.seconds === "object") - message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); - if (object.nanos != null) - message.nanos = object.nanos | 0; - return message; - }; - - /** - * Creates a plain object from a Timestamp message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Timestamp - * @static - * @param {google.protobuf.Timestamp} message Timestamp - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Timestamp.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.seconds = options.longs === String ? "0" : 0; - object.nanos = 0; - } - if (message.seconds != null && message.hasOwnProperty("seconds")) - if (typeof message.seconds === "number") - object.seconds = options.longs === String ? String(message.seconds) : message.seconds; - else - object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; - if (message.nanos != null && message.hasOwnProperty("nanos")) - object.nanos = message.nanos; - return object; - }; - - /** - * Converts this Timestamp to JSON. - * @function toJSON - * @memberof google.protobuf.Timestamp - * @instance - * @returns {Object.} JSON object - */ - Timestamp.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Timestamp - * @function getTypeUrl - * @memberof google.protobuf.Timestamp - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Timestamp"; - }; - - return Timestamp; - })(); - - protobuf.DoubleValue = (function() { - - /** - * Properties of a DoubleValue. - * @memberof google.protobuf - * @interface IDoubleValue - * @property {number|null} [value] DoubleValue value - */ - - /** - * Constructs a new DoubleValue. - * @memberof google.protobuf - * @classdesc Represents a DoubleValue. - * @implements IDoubleValue - * @constructor - * @param {google.protobuf.IDoubleValue=} [properties] Properties to set - */ - function DoubleValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * DoubleValue value. - * @member {number} value - * @memberof google.protobuf.DoubleValue - * @instance - */ - DoubleValue.prototype.value = 0; - - /** - * Creates a new DoubleValue instance using the specified properties. - * @function create - * @memberof google.protobuf.DoubleValue - * @static - * @param {google.protobuf.IDoubleValue=} [properties] Properties to set - * @returns {google.protobuf.DoubleValue} DoubleValue instance - */ - DoubleValue.create = function create(properties) { - return new DoubleValue(properties); - }; - - /** - * Encodes the specified DoubleValue message. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. - * @function encode - * @memberof google.protobuf.DoubleValue - * @static - * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DoubleValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); - return writer; - }; - - /** - * Encodes the specified DoubleValue message, length delimited. Does not implicitly {@link google.protobuf.DoubleValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.DoubleValue - * @static - * @param {google.protobuf.IDoubleValue} message DoubleValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - DoubleValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a DoubleValue message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.DoubleValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.DoubleValue} DoubleValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DoubleValue.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DoubleValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.double(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a DoubleValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.DoubleValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.DoubleValue} DoubleValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - DoubleValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a DoubleValue message. - * @function verify - * @memberof google.protobuf.DoubleValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - DoubleValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value !== "number") - return "value: number expected"; - return null; - }; - - /** - * Creates a DoubleValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.DoubleValue - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.DoubleValue} DoubleValue - */ - DoubleValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.DoubleValue) - return object; - var message = new $root.google.protobuf.DoubleValue(); - if (object.value != null) - message.value = Number(object.value); - return message; - }; - - /** - * Creates a plain object from a DoubleValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.DoubleValue - * @static - * @param {google.protobuf.DoubleValue} message DoubleValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - DoubleValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = 0; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; - return object; - }; - - /** - * Converts this DoubleValue to JSON. - * @function toJSON - * @memberof google.protobuf.DoubleValue - * @instance - * @returns {Object.} JSON object - */ - DoubleValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for DoubleValue - * @function getTypeUrl - * @memberof google.protobuf.DoubleValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - DoubleValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.DoubleValue"; - }; - - return DoubleValue; - })(); - - protobuf.FloatValue = (function() { - - /** - * Properties of a FloatValue. - * @memberof google.protobuf - * @interface IFloatValue - * @property {number|null} [value] FloatValue value - */ - - /** - * Constructs a new FloatValue. - * @memberof google.protobuf - * @classdesc Represents a FloatValue. - * @implements IFloatValue - * @constructor - * @param {google.protobuf.IFloatValue=} [properties] Properties to set - */ - function FloatValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FloatValue value. - * @member {number} value - * @memberof google.protobuf.FloatValue - * @instance - */ - FloatValue.prototype.value = 0; - - /** - * Creates a new FloatValue instance using the specified properties. - * @function create - * @memberof google.protobuf.FloatValue - * @static - * @param {google.protobuf.IFloatValue=} [properties] Properties to set - * @returns {google.protobuf.FloatValue} FloatValue instance - */ - FloatValue.create = function create(properties) { - return new FloatValue(properties); - }; - - /** - * Encodes the specified FloatValue message. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FloatValue - * @static - * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FloatValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 5 =*/13).float(message.value); - return writer; - }; - - /** - * Encodes the specified FloatValue message, length delimited. Does not implicitly {@link google.protobuf.FloatValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FloatValue - * @static - * @param {google.protobuf.IFloatValue} message FloatValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FloatValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FloatValue message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FloatValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FloatValue} FloatValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FloatValue.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FloatValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.float(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FloatValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FloatValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FloatValue} FloatValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FloatValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FloatValue message. - * @function verify - * @memberof google.protobuf.FloatValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FloatValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value !== "number") - return "value: number expected"; - return null; - }; - - /** - * Creates a FloatValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FloatValue - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FloatValue} FloatValue - */ - FloatValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FloatValue) - return object; - var message = new $root.google.protobuf.FloatValue(); - if (object.value != null) - message.value = Number(object.value); - return message; - }; - - /** - * Creates a plain object from a FloatValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FloatValue - * @static - * @param {google.protobuf.FloatValue} message FloatValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FloatValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = 0; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; - return object; - }; - - /** - * Converts this FloatValue to JSON. - * @function toJSON - * @memberof google.protobuf.FloatValue - * @instance - * @returns {Object.} JSON object - */ - FloatValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FloatValue - * @function getTypeUrl - * @memberof google.protobuf.FloatValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FloatValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FloatValue"; - }; - - return FloatValue; - })(); - - protobuf.Int64Value = (function() { - - /** - * Properties of an Int64Value. - * @memberof google.protobuf - * @interface IInt64Value - * @property {number|Long|null} [value] Int64Value value - */ - - /** - * Constructs a new Int64Value. - * @memberof google.protobuf - * @classdesc Represents an Int64Value. - * @implements IInt64Value - * @constructor - * @param {google.protobuf.IInt64Value=} [properties] Properties to set - */ - function Int64Value(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Int64Value value. - * @member {number|Long} value - * @memberof google.protobuf.Int64Value - * @instance - */ - Int64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,false) : 0; - - /** - * Creates a new Int64Value instance using the specified properties. - * @function create - * @memberof google.protobuf.Int64Value - * @static - * @param {google.protobuf.IInt64Value=} [properties] Properties to set - * @returns {google.protobuf.Int64Value} Int64Value instance - */ - Int64Value.create = function create(properties) { - return new Int64Value(properties); - }; - - /** - * Encodes the specified Int64Value message. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Int64Value - * @static - * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Int64Value.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 0 =*/8).int64(message.value); - return writer; - }; - - /** - * Encodes the specified Int64Value message, length delimited. Does not implicitly {@link google.protobuf.Int64Value.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Int64Value - * @static - * @param {google.protobuf.IInt64Value} message Int64Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Int64Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Int64Value message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Int64Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Int64Value} Int64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Int64Value.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int64Value(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.int64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Int64Value message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Int64Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Int64Value} Int64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Int64Value.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Int64Value message. - * @function verify - * @memberof google.protobuf.Int64Value - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Int64Value.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) - return "value: integer|Long expected"; - return null; - }; - - /** - * Creates an Int64Value message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Int64Value - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Int64Value} Int64Value - */ - Int64Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Int64Value) - return object; - var message = new $root.google.protobuf.Int64Value(); - if (object.value != null) - if ($util.Long) - (message.value = $util.Long.fromValue(object.value)).unsigned = false; - else if (typeof object.value === "string") - message.value = parseInt(object.value, 10); - else if (typeof object.value === "number") - message.value = object.value; - else if (typeof object.value === "object") - message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(); - return message; - }; - - /** - * Creates a plain object from an Int64Value message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Int64Value - * @static - * @param {google.protobuf.Int64Value} message Int64Value - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Int64Value.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, false); - object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.value = options.longs === String ? "0" : 0; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value === "number") - object.value = options.longs === String ? String(message.value) : message.value; - else - object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber() : message.value; - return object; - }; - - /** - * Converts this Int64Value to JSON. - * @function toJSON - * @memberof google.protobuf.Int64Value - * @instance - * @returns {Object.} JSON object - */ - Int64Value.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Int64Value - * @function getTypeUrl - * @memberof google.protobuf.Int64Value - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Int64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Int64Value"; - }; - - return Int64Value; - })(); - - protobuf.UInt64Value = (function() { - - /** - * Properties of a UInt64Value. - * @memberof google.protobuf - * @interface IUInt64Value - * @property {number|Long|null} [value] UInt64Value value - */ - - /** - * Constructs a new UInt64Value. - * @memberof google.protobuf - * @classdesc Represents a UInt64Value. - * @implements IUInt64Value - * @constructor - * @param {google.protobuf.IUInt64Value=} [properties] Properties to set - */ - function UInt64Value(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UInt64Value value. - * @member {number|Long} value - * @memberof google.protobuf.UInt64Value - * @instance - */ - UInt64Value.prototype.value = $util.Long ? $util.Long.fromBits(0,0,true) : 0; - - /** - * Creates a new UInt64Value instance using the specified properties. - * @function create - * @memberof google.protobuf.UInt64Value - * @static - * @param {google.protobuf.IUInt64Value=} [properties] Properties to set - * @returns {google.protobuf.UInt64Value} UInt64Value instance - */ - UInt64Value.create = function create(properties) { - return new UInt64Value(properties); - }; - - /** - * Encodes the specified UInt64Value message. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UInt64Value - * @static - * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UInt64Value.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 0 =*/8).uint64(message.value); - return writer; - }; - - /** - * Encodes the specified UInt64Value message, length delimited. Does not implicitly {@link google.protobuf.UInt64Value.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UInt64Value - * @static - * @param {google.protobuf.IUInt64Value} message UInt64Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UInt64Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a UInt64Value message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UInt64Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UInt64Value} UInt64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UInt64Value.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt64Value(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.uint64(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a UInt64Value message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UInt64Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UInt64Value} UInt64Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UInt64Value.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a UInt64Value message. - * @function verify - * @memberof google.protobuf.UInt64Value - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UInt64Value.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isInteger(message.value) && !(message.value && $util.isInteger(message.value.low) && $util.isInteger(message.value.high))) - return "value: integer|Long expected"; - return null; - }; - - /** - * Creates a UInt64Value message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UInt64Value - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UInt64Value} UInt64Value - */ - UInt64Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UInt64Value) - return object; - var message = new $root.google.protobuf.UInt64Value(); - if (object.value != null) - if ($util.Long) - (message.value = $util.Long.fromValue(object.value)).unsigned = true; - else if (typeof object.value === "string") - message.value = parseInt(object.value, 10); - else if (typeof object.value === "number") - message.value = object.value; - else if (typeof object.value === "object") - message.value = new $util.LongBits(object.value.low >>> 0, object.value.high >>> 0).toNumber(true); - return message; - }; - - /** - * Creates a plain object from a UInt64Value message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UInt64Value - * @static - * @param {google.protobuf.UInt64Value} message UInt64Value - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UInt64Value.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if ($util.Long) { - var long = new $util.Long(0, 0, true); - object.value = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; - } else - object.value = options.longs === String ? "0" : 0; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value === "number") - object.value = options.longs === String ? String(message.value) : message.value; - else - object.value = options.longs === String ? $util.Long.prototype.toString.call(message.value) : options.longs === Number ? new $util.LongBits(message.value.low >>> 0, message.value.high >>> 0).toNumber(true) : message.value; - return object; - }; - - /** - * Converts this UInt64Value to JSON. - * @function toJSON - * @memberof google.protobuf.UInt64Value - * @instance - * @returns {Object.} JSON object - */ - UInt64Value.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UInt64Value - * @function getTypeUrl - * @memberof google.protobuf.UInt64Value - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UInt64Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.UInt64Value"; - }; - - return UInt64Value; - })(); - - protobuf.Int32Value = (function() { - - /** - * Properties of an Int32Value. - * @memberof google.protobuf - * @interface IInt32Value - * @property {number|null} [value] Int32Value value - */ - - /** - * Constructs a new Int32Value. - * @memberof google.protobuf - * @classdesc Represents an Int32Value. - * @implements IInt32Value - * @constructor - * @param {google.protobuf.IInt32Value=} [properties] Properties to set - */ - function Int32Value(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Int32Value value. - * @member {number} value - * @memberof google.protobuf.Int32Value - * @instance - */ - Int32Value.prototype.value = 0; - - /** - * Creates a new Int32Value instance using the specified properties. - * @function create - * @memberof google.protobuf.Int32Value - * @static - * @param {google.protobuf.IInt32Value=} [properties] Properties to set - * @returns {google.protobuf.Int32Value} Int32Value instance - */ - Int32Value.create = function create(properties) { - return new Int32Value(properties); - }; - - /** - * Encodes the specified Int32Value message. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Int32Value - * @static - * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Int32Value.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.value); - return writer; - }; - - /** - * Encodes the specified Int32Value message, length delimited. Does not implicitly {@link google.protobuf.Int32Value.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Int32Value - * @static - * @param {google.protobuf.IInt32Value} message Int32Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Int32Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Int32Value message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Int32Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Int32Value} Int32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Int32Value.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Int32Value(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.int32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Int32Value message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Int32Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Int32Value} Int32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Int32Value.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Int32Value message. - * @function verify - * @memberof google.protobuf.Int32Value - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Int32Value.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isInteger(message.value)) - return "value: integer expected"; - return null; - }; - - /** - * Creates an Int32Value message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Int32Value - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Int32Value} Int32Value - */ - Int32Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Int32Value) - return object; - var message = new $root.google.protobuf.Int32Value(); - if (object.value != null) - message.value = object.value | 0; - return message; - }; - - /** - * Creates a plain object from an Int32Value message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Int32Value - * @static - * @param {google.protobuf.Int32Value} message Int32Value - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Int32Value.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = 0; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this Int32Value to JSON. - * @function toJSON - * @memberof google.protobuf.Int32Value - * @instance - * @returns {Object.} JSON object - */ - Int32Value.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Int32Value - * @function getTypeUrl - * @memberof google.protobuf.Int32Value - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Int32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Int32Value"; - }; - - return Int32Value; - })(); - - protobuf.UInt32Value = (function() { - - /** - * Properties of a UInt32Value. - * @memberof google.protobuf - * @interface IUInt32Value - * @property {number|null} [value] UInt32Value value - */ - - /** - * Constructs a new UInt32Value. - * @memberof google.protobuf - * @classdesc Represents a UInt32Value. - * @implements IUInt32Value - * @constructor - * @param {google.protobuf.IUInt32Value=} [properties] Properties to set - */ - function UInt32Value(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * UInt32Value value. - * @member {number} value - * @memberof google.protobuf.UInt32Value - * @instance - */ - UInt32Value.prototype.value = 0; - - /** - * Creates a new UInt32Value instance using the specified properties. - * @function create - * @memberof google.protobuf.UInt32Value - * @static - * @param {google.protobuf.IUInt32Value=} [properties] Properties to set - * @returns {google.protobuf.UInt32Value} UInt32Value instance - */ - UInt32Value.create = function create(properties) { - return new UInt32Value(properties); - }; - - /** - * Encodes the specified UInt32Value message. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. - * @function encode - * @memberof google.protobuf.UInt32Value - * @static - * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UInt32Value.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 0 =*/8).uint32(message.value); - return writer; - }; - - /** - * Encodes the specified UInt32Value message, length delimited. Does not implicitly {@link google.protobuf.UInt32Value.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.UInt32Value - * @static - * @param {google.protobuf.IUInt32Value} message UInt32Value message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - UInt32Value.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a UInt32Value message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.UInt32Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.UInt32Value} UInt32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UInt32Value.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UInt32Value(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.uint32(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a UInt32Value message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.UInt32Value - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.UInt32Value} UInt32Value - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - UInt32Value.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a UInt32Value message. - * @function verify - * @memberof google.protobuf.UInt32Value - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - UInt32Value.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isInteger(message.value)) - return "value: integer expected"; - return null; - }; - - /** - * Creates a UInt32Value message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.UInt32Value - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.UInt32Value} UInt32Value - */ - UInt32Value.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.UInt32Value) - return object; - var message = new $root.google.protobuf.UInt32Value(); - if (object.value != null) - message.value = object.value >>> 0; - return message; - }; - - /** - * Creates a plain object from a UInt32Value message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.UInt32Value - * @static - * @param {google.protobuf.UInt32Value} message UInt32Value - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - UInt32Value.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = 0; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this UInt32Value to JSON. - * @function toJSON - * @memberof google.protobuf.UInt32Value - * @instance - * @returns {Object.} JSON object - */ - UInt32Value.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for UInt32Value - * @function getTypeUrl - * @memberof google.protobuf.UInt32Value - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - UInt32Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.UInt32Value"; - }; - - return UInt32Value; - })(); - - protobuf.BoolValue = (function() { - - /** - * Properties of a BoolValue. - * @memberof google.protobuf - * @interface IBoolValue - * @property {boolean|null} [value] BoolValue value - */ - - /** - * Constructs a new BoolValue. - * @memberof google.protobuf - * @classdesc Represents a BoolValue. - * @implements IBoolValue - * @constructor - * @param {google.protobuf.IBoolValue=} [properties] Properties to set - */ - function BoolValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BoolValue value. - * @member {boolean} value - * @memberof google.protobuf.BoolValue - * @instance - */ - BoolValue.prototype.value = false; - - /** - * Creates a new BoolValue instance using the specified properties. - * @function create - * @memberof google.protobuf.BoolValue - * @static - * @param {google.protobuf.IBoolValue=} [properties] Properties to set - * @returns {google.protobuf.BoolValue} BoolValue instance - */ - BoolValue.create = function create(properties) { - return new BoolValue(properties); - }; - - /** - * Encodes the specified BoolValue message. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. - * @function encode - * @memberof google.protobuf.BoolValue - * @static - * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoolValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 0 =*/8).bool(message.value); - return writer; - }; - - /** - * Encodes the specified BoolValue message, length delimited. Does not implicitly {@link google.protobuf.BoolValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.BoolValue - * @static - * @param {google.protobuf.IBoolValue} message BoolValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BoolValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BoolValue message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.BoolValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.BoolValue} BoolValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoolValue.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BoolValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.bool(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BoolValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.BoolValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.BoolValue} BoolValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BoolValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BoolValue message. - * @function verify - * @memberof google.protobuf.BoolValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BoolValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (typeof message.value !== "boolean") - return "value: boolean expected"; - return null; - }; - - /** - * Creates a BoolValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.BoolValue - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.BoolValue} BoolValue - */ - BoolValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.BoolValue) - return object; - var message = new $root.google.protobuf.BoolValue(); - if (object.value != null) - message.value = Boolean(object.value); - return message; - }; - - /** - * Creates a plain object from a BoolValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.BoolValue - * @static - * @param {google.protobuf.BoolValue} message BoolValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BoolValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = false; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this BoolValue to JSON. - * @function toJSON - * @memberof google.protobuf.BoolValue - * @instance - * @returns {Object.} JSON object - */ - BoolValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BoolValue - * @function getTypeUrl - * @memberof google.protobuf.BoolValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BoolValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.BoolValue"; - }; - - return BoolValue; - })(); - - protobuf.StringValue = (function() { - - /** - * Properties of a StringValue. - * @memberof google.protobuf - * @interface IStringValue - * @property {string|null} [value] StringValue value - */ - - /** - * Constructs a new StringValue. - * @memberof google.protobuf - * @classdesc Represents a StringValue. - * @implements IStringValue - * @constructor - * @param {google.protobuf.IStringValue=} [properties] Properties to set - */ - function StringValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * StringValue value. - * @member {string} value - * @memberof google.protobuf.StringValue - * @instance - */ - StringValue.prototype.value = ""; - - /** - * Creates a new StringValue instance using the specified properties. - * @function create - * @memberof google.protobuf.StringValue - * @static - * @param {google.protobuf.IStringValue=} [properties] Properties to set - * @returns {google.protobuf.StringValue} StringValue instance - */ - StringValue.create = function create(properties) { - return new StringValue(properties); - }; - - /** - * Encodes the specified StringValue message. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. - * @function encode - * @memberof google.protobuf.StringValue - * @static - * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - StringValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.value); - return writer; - }; - - /** - * Encodes the specified StringValue message, length delimited. Does not implicitly {@link google.protobuf.StringValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.StringValue - * @static - * @param {google.protobuf.IStringValue} message StringValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - StringValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a StringValue message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.StringValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.StringValue} StringValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - StringValue.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.StringValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.string(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a StringValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.StringValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.StringValue} StringValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - StringValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a StringValue message. - * @function verify - * @memberof google.protobuf.StringValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - StringValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!$util.isString(message.value)) - return "value: string expected"; - return null; - }; - - /** - * Creates a StringValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.StringValue - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.StringValue} StringValue - */ - StringValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.StringValue) - return object; - var message = new $root.google.protobuf.StringValue(); - if (object.value != null) - message.value = String(object.value); - return message; - }; - - /** - * Creates a plain object from a StringValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.StringValue - * @static - * @param {google.protobuf.StringValue} message StringValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - StringValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - object.value = ""; - if (message.value != null && message.hasOwnProperty("value")) - object.value = message.value; - return object; - }; - - /** - * Converts this StringValue to JSON. - * @function toJSON - * @memberof google.protobuf.StringValue - * @instance - * @returns {Object.} JSON object - */ - StringValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for StringValue - * @function getTypeUrl - * @memberof google.protobuf.StringValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - StringValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.StringValue"; - }; - - return StringValue; - })(); - - protobuf.BytesValue = (function() { - - /** - * Properties of a BytesValue. - * @memberof google.protobuf - * @interface IBytesValue - * @property {Uint8Array|null} [value] BytesValue value - */ - - /** - * Constructs a new BytesValue. - * @memberof google.protobuf - * @classdesc Represents a BytesValue. - * @implements IBytesValue - * @constructor - * @param {google.protobuf.IBytesValue=} [properties] Properties to set - */ - function BytesValue(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * BytesValue value. - * @member {Uint8Array} value - * @memberof google.protobuf.BytesValue - * @instance - */ - BytesValue.prototype.value = $util.newBuffer([]); - - /** - * Creates a new BytesValue instance using the specified properties. - * @function create - * @memberof google.protobuf.BytesValue - * @static - * @param {google.protobuf.IBytesValue=} [properties] Properties to set - * @returns {google.protobuf.BytesValue} BytesValue instance - */ - BytesValue.create = function create(properties) { - return new BytesValue(properties); - }; - - /** - * Encodes the specified BytesValue message. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. - * @function encode - * @memberof google.protobuf.BytesValue - * @static - * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BytesValue.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 1, wireType 2 =*/10).bytes(message.value); - return writer; - }; - - /** - * Encodes the specified BytesValue message, length delimited. Does not implicitly {@link google.protobuf.BytesValue.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.BytesValue - * @static - * @param {google.protobuf.IBytesValue} message BytesValue message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - BytesValue.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a BytesValue message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.BytesValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.BytesValue} BytesValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BytesValue.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.BytesValue(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.value = reader.bytes(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a BytesValue message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.BytesValue - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.BytesValue} BytesValue - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - BytesValue.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a BytesValue message. - * @function verify - * @memberof google.protobuf.BytesValue - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - BytesValue.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - return null; - }; - - /** - * Creates a BytesValue message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.BytesValue - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.BytesValue} BytesValue - */ - BytesValue.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.BytesValue) - return object; - var message = new $root.google.protobuf.BytesValue(); - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length >= 0) - message.value = object.value; - return message; - }; - - /** - * Creates a plain object from a BytesValue message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.BytesValue - * @static - * @param {google.protobuf.BytesValue} message BytesValue - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - BytesValue.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - return object; - }; - - /** - * Converts this BytesValue to JSON. - * @function toJSON - * @memberof google.protobuf.BytesValue - * @instance - * @returns {Object.} JSON object - */ - BytesValue.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for BytesValue - * @function getTypeUrl - * @memberof google.protobuf.BytesValue - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - BytesValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.BytesValue"; - }; - - return BytesValue; - })(); - - protobuf.Any = (function() { - - /** - * Properties of an Any. - * @memberof google.protobuf - * @interface IAny - * @property {string|null} [type_url] Any type_url - * @property {Uint8Array|null} [value] Any value - */ - - /** - * Constructs a new Any. - * @memberof google.protobuf - * @classdesc Represents an Any. - * @implements IAny - * @constructor - * @param {google.protobuf.IAny=} [properties] Properties to set - */ - function Any(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Any type_url. - * @member {string} type_url - * @memberof google.protobuf.Any - * @instance - */ - Any.prototype.type_url = ""; - - /** - * Any value. - * @member {Uint8Array} value - * @memberof google.protobuf.Any - * @instance - */ - Any.prototype.value = $util.newBuffer([]); - - /** - * Creates a new Any instance using the specified properties. - * @function create - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.IAny=} [properties] Properties to set - * @returns {google.protobuf.Any} Any instance - */ - Any.create = function create(properties) { - return new Any(properties); - }; - - /** - * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.IAny} message Any message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Any.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); - if (message.value != null && Object.hasOwnProperty.call(message, "value")) - writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); - return writer; - }; - - /** - * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.IAny} message Any message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Any.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Any message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Any - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Any} Any - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Any.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.type_url = reader.string(); - break; - } - case 2: { - message.value = reader.bytes(); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Any message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Any - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Any} Any - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Any.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Any message. - * @function verify - * @memberof google.protobuf.Any - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Any.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.type_url != null && message.hasOwnProperty("type_url")) - if (!$util.isString(message.type_url)) - return "type_url: string expected"; - if (message.value != null && message.hasOwnProperty("value")) - if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) - return "value: buffer expected"; - return null; - }; - - /** - * Creates an Any message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Any - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Any} Any - */ - Any.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Any) - return object; - var message = new $root.google.protobuf.Any(); - if (object.type_url != null) - message.type_url = String(object.type_url); - if (object.value != null) - if (typeof object.value === "string") - $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); - else if (object.value.length >= 0) - message.value = object.value; - return message; - }; - - /** - * Creates a plain object from an Any message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Any - * @static - * @param {google.protobuf.Any} message Any - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Any.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.type_url = ""; - if (options.bytes === String) - object.value = ""; - else { - object.value = []; - if (options.bytes !== Array) - object.value = $util.newBuffer(object.value); - } - } - if (message.type_url != null && message.hasOwnProperty("type_url")) - object.type_url = message.type_url; - if (message.value != null && message.hasOwnProperty("value")) - object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; - return object; - }; - - /** - * Converts this Any to JSON. - * @function toJSON - * @memberof google.protobuf.Any - * @instance - * @returns {Object.} JSON object - */ - Any.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Any - * @function getTypeUrl - * @memberof google.protobuf.Any - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Any"; - }; - - return Any; - })(); - - protobuf.FieldMask = (function() { - - /** - * Properties of a FieldMask. - * @memberof google.protobuf - * @interface IFieldMask - * @property {Array.|null} [paths] FieldMask paths - */ - - /** - * Constructs a new FieldMask. - * @memberof google.protobuf - * @classdesc Represents a FieldMask. - * @implements IFieldMask - * @constructor - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - */ - function FieldMask(properties) { - this.paths = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * FieldMask paths. - * @member {Array.} paths - * @memberof google.protobuf.FieldMask - * @instance - */ - FieldMask.prototype.paths = $util.emptyArray; - - /** - * Creates a new FieldMask instance using the specified properties. - * @function create - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask=} [properties] Properties to set - * @returns {google.protobuf.FieldMask} FieldMask instance - */ - FieldMask.create = function create(properties) { - return new FieldMask(properties); - }; - - /** - * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @function encode - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldMask.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.paths != null && message.paths.length) - for (var i = 0; i < message.paths.length; ++i) - writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); - return writer; - }; - - /** - * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - FieldMask.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a FieldMask message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.FieldMask - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.FieldMask} FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldMask.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - if (!(message.paths && message.paths.length)) - message.paths = []; - message.paths.push(reader.string()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a FieldMask message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.FieldMask - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.FieldMask} FieldMask - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - FieldMask.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a FieldMask message. - * @function verify - * @memberof google.protobuf.FieldMask - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - FieldMask.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.paths != null && message.hasOwnProperty("paths")) { - if (!Array.isArray(message.paths)) - return "paths: array expected"; - for (var i = 0; i < message.paths.length; ++i) - if (!$util.isString(message.paths[i])) - return "paths: string[] expected"; - } - return null; - }; - - /** - * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.FieldMask - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.FieldMask} FieldMask - */ - FieldMask.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.FieldMask) - return object; - var message = new $root.google.protobuf.FieldMask(); - if (object.paths) { - if (!Array.isArray(object.paths)) - throw TypeError(".google.protobuf.FieldMask.paths: array expected"); - message.paths = []; - for (var i = 0; i < object.paths.length; ++i) - message.paths[i] = String(object.paths[i]); - } - return message; - }; - - /** - * Creates a plain object from a FieldMask message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.FieldMask - * @static - * @param {google.protobuf.FieldMask} message FieldMask - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - FieldMask.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.paths = []; - if (message.paths && message.paths.length) { - object.paths = []; - for (var j = 0; j < message.paths.length; ++j) - object.paths[j] = message.paths[j]; - } - return object; - }; - - /** - * Converts this FieldMask to JSON. - * @function toJSON - * @memberof google.protobuf.FieldMask - * @instance - * @returns {Object.} JSON object - */ - FieldMask.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for FieldMask - * @function getTypeUrl - * @memberof google.protobuf.FieldMask - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.FieldMask"; - }; - - return FieldMask; - })(); - - protobuf.Empty = (function() { - - /** - * Properties of an Empty. - * @memberof google.protobuf - * @interface IEmpty - */ - - /** - * Constructs a new Empty. - * @memberof google.protobuf - * @classdesc Represents an Empty. - * @implements IEmpty - * @constructor - * @param {google.protobuf.IEmpty=} [properties] Properties to set - */ - function Empty(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Creates a new Empty instance using the specified properties. - * @function create - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty=} [properties] Properties to set - * @returns {google.protobuf.Empty} Empty instance - */ - Empty.create = function create(properties) { - return new Empty(properties); - }; - - /** - * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @function encode - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Empty.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - return writer; - }; - - /** - * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. - * @function encodeDelimited - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.IEmpty} message Empty message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Empty.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Empty message from the specified reader or buffer. - * @function decode - * @memberof google.protobuf.Empty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.protobuf.Empty} Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Empty.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Empty message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.protobuf.Empty - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.protobuf.Empty} Empty - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Empty.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Empty message. - * @function verify - * @memberof google.protobuf.Empty - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Empty.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - return null; - }; - - /** - * Creates an Empty message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.protobuf.Empty - * @static - * @param {Object.} object Plain object - * @returns {google.protobuf.Empty} Empty - */ - Empty.fromObject = function fromObject(object) { - if (object instanceof $root.google.protobuf.Empty) - return object; - return new $root.google.protobuf.Empty(); - }; - - /** - * Creates a plain object from an Empty message. Also converts values to other types if specified. - * @function toObject - * @memberof google.protobuf.Empty - * @static - * @param {google.protobuf.Empty} message Empty - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Empty.toObject = function toObject() { - return {}; - }; - - /** - * Converts this Empty to JSON. - * @function toJSON - * @memberof google.protobuf.Empty - * @instance - * @returns {Object.} JSON object - */ - Empty.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Empty - * @function getTypeUrl - * @memberof google.protobuf.Empty - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.protobuf.Empty"; - }; - - return Empty; - })(); - - return protobuf; - })(); - - google.rpc = (function() { - - /** - * Namespace rpc. - * @memberof google - * @namespace - */ - var rpc = {}; - - rpc.Status = (function() { - - /** - * Properties of a Status. - * @memberof google.rpc - * @interface IStatus - * @property {number|null} [code] Status code - * @property {string|null} [message] Status message - * @property {Array.|null} [details] Status details - */ - - /** - * Constructs a new Status. - * @memberof google.rpc - * @classdesc Represents a Status. - * @implements IStatus - * @constructor - * @param {google.rpc.IStatus=} [properties] Properties to set - */ - function Status(properties) { - this.details = []; - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Status code. - * @member {number} code - * @memberof google.rpc.Status - * @instance - */ - Status.prototype.code = 0; - - /** - * Status message. - * @member {string} message - * @memberof google.rpc.Status - * @instance - */ - Status.prototype.message = ""; - - /** - * Status details. - * @member {Array.} details - * @memberof google.rpc.Status - * @instance - */ - Status.prototype.details = $util.emptyArray; - - /** - * Creates a new Status instance using the specified properties. - * @function create - * @memberof google.rpc.Status - * @static - * @param {google.rpc.IStatus=} [properties] Properties to set - * @returns {google.rpc.Status} Status instance - */ - Status.create = function create(properties) { - return new Status(properties); - }; - - /** - * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. - * @function encode - * @memberof google.rpc.Status - * @static - * @param {google.rpc.IStatus} message Status message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Status.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.code != null && Object.hasOwnProperty.call(message, "code")) - writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); - if (message.message != null && Object.hasOwnProperty.call(message, "message")) - writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); - if (message.details != null && message.details.length) - for (var i = 0; i < message.details.length; ++i) - $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. - * @function encodeDelimited - * @memberof google.rpc.Status - * @static - * @param {google.rpc.IStatus} message Status message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Status.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes a Status message from the specified reader or buffer. - * @function decode - * @memberof google.rpc.Status - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.rpc.Status} Status - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Status.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.code = reader.int32(); - break; - } - case 2: { - message.message = reader.string(); - break; - } - case 3: { - if (!(message.details && message.details.length)) - message.details = []; - message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes a Status message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.rpc.Status - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.rpc.Status} Status - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Status.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies a Status message. - * @function verify - * @memberof google.rpc.Status - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Status.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.code != null && message.hasOwnProperty("code")) - if (!$util.isInteger(message.code)) - return "code: integer expected"; - if (message.message != null && message.hasOwnProperty("message")) - if (!$util.isString(message.message)) - return "message: string expected"; - if (message.details != null && message.hasOwnProperty("details")) { - if (!Array.isArray(message.details)) - return "details: array expected"; - for (var i = 0; i < message.details.length; ++i) { - var error = $root.google.protobuf.Any.verify(message.details[i]); - if (error) - return "details." + error; - } - } - return null; - }; - - /** - * Creates a Status message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.rpc.Status - * @static - * @param {Object.} object Plain object - * @returns {google.rpc.Status} Status - */ - Status.fromObject = function fromObject(object) { - if (object instanceof $root.google.rpc.Status) - return object; - var message = new $root.google.rpc.Status(); - if (object.code != null) - message.code = object.code | 0; - if (object.message != null) - message.message = String(object.message); - if (object.details) { - if (!Array.isArray(object.details)) - throw TypeError(".google.rpc.Status.details: array expected"); - message.details = []; - for (var i = 0; i < object.details.length; ++i) { - if (typeof object.details[i] !== "object") - throw TypeError(".google.rpc.Status.details: object expected"); - message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); - } - } - return message; - }; - - /** - * Creates a plain object from a Status message. Also converts values to other types if specified. - * @function toObject - * @memberof google.rpc.Status - * @static - * @param {google.rpc.Status} message Status - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Status.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.arrays || options.defaults) - object.details = []; - if (options.defaults) { - object.code = 0; - object.message = ""; - } - if (message.code != null && message.hasOwnProperty("code")) - object.code = message.code; - if (message.message != null && message.hasOwnProperty("message")) - object.message = message.message; - if (message.details && message.details.length) { - object.details = []; - for (var j = 0; j < message.details.length; ++j) - object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); - } - return object; - }; - - /** - * Converts this Status to JSON. - * @function toJSON - * @memberof google.rpc.Status - * @instance - * @returns {Object.} JSON object - */ - Status.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Status - * @function getTypeUrl - * @memberof google.rpc.Status - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.rpc.Status"; - }; - - return Status; - })(); - - return rpc; - })(); - - google.type = (function() { - - /** - * Namespace type. - * @memberof google - * @namespace - */ - var type = {}; - - type.Interval = (function() { - - /** - * Properties of an Interval. - * @memberof google.type - * @interface IInterval - * @property {google.protobuf.ITimestamp|null} [startTime] Interval startTime - * @property {google.protobuf.ITimestamp|null} [endTime] Interval endTime - */ - - /** - * Constructs a new Interval. - * @memberof google.type - * @classdesc Represents an Interval. - * @implements IInterval - * @constructor - * @param {google.type.IInterval=} [properties] Properties to set - */ - function Interval(properties) { - if (properties) - for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) - if (properties[keys[i]] != null) - this[keys[i]] = properties[keys[i]]; - } - - /** - * Interval startTime. - * @member {google.protobuf.ITimestamp|null|undefined} startTime - * @memberof google.type.Interval - * @instance - */ - Interval.prototype.startTime = null; - - /** - * Interval endTime. - * @member {google.protobuf.ITimestamp|null|undefined} endTime - * @memberof google.type.Interval - * @instance - */ - Interval.prototype.endTime = null; - - /** - * Creates a new Interval instance using the specified properties. - * @function create - * @memberof google.type.Interval - * @static - * @param {google.type.IInterval=} [properties] Properties to set - * @returns {google.type.Interval} Interval instance - */ - Interval.create = function create(properties) { - return new Interval(properties); - }; - - /** - * Encodes the specified Interval message. Does not implicitly {@link google.type.Interval.verify|verify} messages. - * @function encode - * @memberof google.type.Interval - * @static - * @param {google.type.IInterval} message Interval message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Interval.encode = function encode(message, writer) { - if (!writer) - writer = $Writer.create(); - if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) - $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); - if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) - $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); - return writer; - }; - - /** - * Encodes the specified Interval message, length delimited. Does not implicitly {@link google.type.Interval.verify|verify} messages. - * @function encodeDelimited - * @memberof google.type.Interval - * @static - * @param {google.type.IInterval} message Interval message or plain object to encode - * @param {$protobuf.Writer} [writer] Writer to encode to - * @returns {$protobuf.Writer} Writer - */ - Interval.encodeDelimited = function encodeDelimited(message, writer) { - return this.encode(message, writer).ldelim(); - }; - - /** - * Decodes an Interval message from the specified reader or buffer. - * @function decode - * @memberof google.type.Interval - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @param {number} [length] Message length if known beforehand - * @returns {google.type.Interval} Interval - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Interval.decode = function decode(reader, length, error) { - if (!(reader instanceof $Reader)) - reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.type.Interval(); - while (reader.pos < end) { - var tag = reader.uint32(); - if (tag === error) - break; - switch (tag >>> 3) { - case 1: { - message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - case 2: { - message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); - break; - } - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }; - - /** - * Decodes an Interval message from the specified reader or buffer, length delimited. - * @function decodeDelimited - * @memberof google.type.Interval - * @static - * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from - * @returns {google.type.Interval} Interval - * @throws {Error} If the payload is not a reader or valid buffer - * @throws {$protobuf.util.ProtocolError} If required fields are missing - */ - Interval.decodeDelimited = function decodeDelimited(reader) { - if (!(reader instanceof $Reader)) - reader = new $Reader(reader); - return this.decode(reader, reader.uint32()); - }; - - /** - * Verifies an Interval message. - * @function verify - * @memberof google.type.Interval - * @static - * @param {Object.} message Plain object to verify - * @returns {string|null} `null` if valid, otherwise the reason why it is not - */ - Interval.verify = function verify(message) { - if (typeof message !== "object" || message === null) - return "object expected"; - if (message.startTime != null && message.hasOwnProperty("startTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.startTime); - if (error) - return "startTime." + error; - } - if (message.endTime != null && message.hasOwnProperty("endTime")) { - var error = $root.google.protobuf.Timestamp.verify(message.endTime); - if (error) - return "endTime." + error; - } - return null; - }; - - /** - * Creates an Interval message from a plain object. Also converts values to their respective internal types. - * @function fromObject - * @memberof google.type.Interval - * @static - * @param {Object.} object Plain object - * @returns {google.type.Interval} Interval - */ - Interval.fromObject = function fromObject(object) { - if (object instanceof $root.google.type.Interval) - return object; - var message = new $root.google.type.Interval(); - if (object.startTime != null) { - if (typeof object.startTime !== "object") - throw TypeError(".google.type.Interval.startTime: object expected"); - message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); - } - if (object.endTime != null) { - if (typeof object.endTime !== "object") - throw TypeError(".google.type.Interval.endTime: object expected"); - message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); - } - return message; - }; - - /** - * Creates a plain object from an Interval message. Also converts values to other types if specified. - * @function toObject - * @memberof google.type.Interval - * @static - * @param {google.type.Interval} message Interval - * @param {$protobuf.IConversionOptions} [options] Conversion options - * @returns {Object.} Plain object - */ - Interval.toObject = function toObject(message, options) { - if (!options) - options = {}; - var object = {}; - if (options.defaults) { - object.startTime = null; - object.endTime = null; - } - if (message.startTime != null && message.hasOwnProperty("startTime")) - object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); - if (message.endTime != null && message.hasOwnProperty("endTime")) - object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); - return object; - }; - - /** - * Converts this Interval to JSON. - * @function toJSON - * @memberof google.type.Interval - * @instance - * @returns {Object.} JSON object - */ - Interval.prototype.toJSON = function toJSON() { - return this.constructor.toObject(this, $protobuf.util.toJSONOptions); - }; - - /** - * Gets the default type url for Interval - * @function getTypeUrl - * @memberof google.type.Interval - * @static - * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") - * @returns {string} The default type url - */ - Interval.getTypeUrl = function getTypeUrl(typeUrlPrefix) { - if (typeUrlPrefix === undefined) { - typeUrlPrefix = "type.googleapis.com"; - } - return typeUrlPrefix + "/google.type.Interval"; - }; - - return Interval; - })(); - - return type; - })(); - - return google; - })(); - - return $root; -}); diff --git a/owl-bot-staging/google-cloud-sql/protos/protos.json b/owl-bot-staging/google-cloud-sql/protos/protos.json deleted file mode 100644 index d3a8e054dbf8..000000000000 --- a/owl-bot-staging/google-cloud-sql/protos/protos.json +++ /dev/null @@ -1,18221 +0,0 @@ -{ - "nested": { - "google": { - "nested": { - "cloud": { - "nested": { - "sql": { - "nested": { - "v1": { - "options": { - "go_package": "cloud.google.com/go/sql/apiv1/sqlpb;sqlpb", - "java_multiple_files": true, - "java_outer_classname": "CloudSqlUsersProto", - "java_package": "com.google.cloud.sql.v1", - "(google.api.resource_definition).type": "compute.googleapis.com/Network", - "(google.api.resource_definition).pattern": "projects/{project}/global/networks/{network}" - }, - "nested": { - "SqlAvailableDatabaseVersionsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com" - }, - "methods": {} - }, - "SqlBackupRunsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "Delete": { - "requestType": "SqlBackupRunsDeleteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" - } - } - ] - }, - "Get": { - "requestType": "SqlBackupRunsGetRequest", - "responseType": "BackupRun", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/backupRuns/{id}" - } - } - ] - }, - "Insert": { - "requestType": "SqlBackupRunsInsertRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/backupRuns", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/backupRuns", - "body": "body" - } - } - ] - }, - "List": { - "requestType": "SqlBackupRunsListRequest", - "responseType": "BackupRunsListResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/backupRuns" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/backupRuns" - } - } - ] - } - } - }, - "SqlBackupRunsDeleteRequest": { - "fields": { - "id": { - "type": "int64", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - } - } - }, - "SqlBackupRunsGetRequest": { - "fields": { - "id": { - "type": "int64", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - } - } - }, - "SqlBackupRunsInsertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "BackupRun", - "id": 100 - } - } - }, - "SqlBackupRunsListRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "maxResults": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - } - } - }, - "BackupRun": { - "oneofs": { - "_maxChargeableBytes": { - "oneof": [ - "maxChargeableBytes" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "status": { - "type": "SqlBackupRunStatus", - "id": 2 - }, - "enqueuedTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - }, - "id": { - "type": "int64", - "id": 4 - }, - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 6 - }, - "error": { - "type": "OperationError", - "id": 7 - }, - "type": { - "type": "SqlBackupRunType", - "id": 8 - }, - "description": { - "type": "string", - "id": 9 - }, - "windowStartTime": { - "type": "google.protobuf.Timestamp", - "id": 10 - }, - "instance": { - "type": "string", - "id": 11 - }, - "selfLink": { - "type": "string", - "id": 12 - }, - "location": { - "type": "string", - "id": 13 - }, - "databaseVersion": { - "type": "SqlDatabaseVersion", - "id": 15, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "diskEncryptionConfiguration": { - "type": "DiskEncryptionConfiguration", - "id": 16 - }, - "diskEncryptionStatus": { - "type": "DiskEncryptionStatus", - "id": 17 - }, - "backupKind": { - "type": "SqlBackupKind", - "id": 19 - }, - "timeZone": { - "type": "string", - "id": 23 - }, - "maxChargeableBytes": { - "type": "int64", - "id": 24, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - } - } - }, - "BackupRunsListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "BackupRun", - "id": 2 - }, - "nextPageToken": { - "type": "string", - "id": 3 - } - } - }, - "SqlBackupRunStatus": { - "values": { - "SQL_BACKUP_RUN_STATUS_UNSPECIFIED": 0, - "ENQUEUED": 1, - "OVERDUE": 2, - "RUNNING": 3, - "FAILED": 4, - "SUCCESSFUL": 5, - "SKIPPED": 6, - "DELETION_PENDING": 7, - "DELETION_FAILED": 8, - "DELETED": 9 - } - }, - "SqlBackupKind": { - "values": { - "SQL_BACKUP_KIND_UNSPECIFIED": 0, - "SNAPSHOT": 1, - "PHYSICAL": 2 - } - }, - "SqlBackupRunType": { - "values": { - "SQL_BACKUP_RUN_TYPE_UNSPECIFIED": 0, - "AUTOMATED": 1, - "ON_DEMAND": 2 - } - }, - "AclEntry": { - "fields": { - "value": { - "type": "string", - "id": 1 - }, - "expirationTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "name": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "kind": { - "type": "string", - "id": 4 - } - } - }, - "ApiWarning": { - "fields": { - "code": { - "type": "SqlApiWarningCode", - "id": 1 - }, - "message": { - "type": "string", - "id": 2 - }, - "region": { - "type": "string", - "id": 3 - } - }, - "nested": { - "SqlApiWarningCode": { - "values": { - "SQL_API_WARNING_CODE_UNSPECIFIED": 0, - "REGION_UNREACHABLE": 1, - "MAX_RESULTS_EXCEEDS_LIMIT": 2, - "COMPROMISED_CREDENTIALS": 3, - "INTERNAL_STATE_FAILURE": 4 - } - } - } - }, - "BackupRetentionSettings": { - "fields": { - "retentionUnit": { - "type": "RetentionUnit", - "id": 1 - }, - "retainedBackups": { - "type": "google.protobuf.Int32Value", - "id": 2 - } - }, - "nested": { - "RetentionUnit": { - "values": { - "RETENTION_UNIT_UNSPECIFIED": 0, - "COUNT": 1 - } - } - } - }, - "BackupConfiguration": { - "oneofs": { - "_transactionalLogStorageState": { - "oneof": [ - "transactionalLogStorageState" - ] - }, - "_backupTier": { - "oneof": [ - "backupTier" - ] - } - }, - "fields": { - "startTime": { - "type": "string", - "id": 1 - }, - "enabled": { - "type": "google.protobuf.BoolValue", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - }, - "binaryLogEnabled": { - "type": "google.protobuf.BoolValue", - "id": 4 - }, - "replicationLogArchivingEnabled": { - "type": "google.protobuf.BoolValue", - "id": 5 - }, - "location": { - "type": "string", - "id": 6 - }, - "pointInTimeRecoveryEnabled": { - "type": "google.protobuf.BoolValue", - "id": 7 - }, - "backupRetentionSettings": { - "type": "BackupRetentionSettings", - "id": 8 - }, - "transactionLogRetentionDays": { - "type": "google.protobuf.Int32Value", - "id": 9 - }, - "transactionalLogStorageState": { - "type": "TransactionalLogStorageState", - "id": 10, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "backupTier": { - "type": "BackupTier", - "id": 11, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - } - }, - "nested": { - "TransactionalLogStorageState": { - "values": { - "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED": 0, - "DISK": 1, - "SWITCHING_TO_CLOUD_STORAGE": 2, - "SWITCHED_TO_CLOUD_STORAGE": 3, - "CLOUD_STORAGE": 4 - } - }, - "BackupTier": { - "valuesOptions": { - "ADVANCED": { - "deprecated": true - } - }, - "values": { - "BACKUP_TIER_UNSPECIFIED": 0, - "STANDARD": 1, - "ADVANCED": 2, - "ENHANCED": 3 - } - } - } - }, - "PerformDiskShrinkContext": { - "fields": { - "targetSizeGb": { - "type": "int64", - "id": 1 - } - } - }, - "PreCheckResponse": { - "oneofs": { - "_message": { - "oneof": [ - "message" - ] - }, - "_messageType": { - "oneof": [ - "messageType" - ] - } - }, - "fields": { - "message": { - "type": "string", - "id": 2, - "options": { - "proto3_optional": true - } - }, - "messageType": { - "type": "MessageType", - "id": 3, - "options": { - "proto3_optional": true - } - }, - "actionsRequired": { - "rule": "repeated", - "type": "string", - "id": 4 - } - }, - "nested": { - "MessageType": { - "values": { - "MESSAGE_TYPE_UNSPECIFIED": 0, - "INFO": 1, - "WARNING": 2, - "ERROR": 3 - } - } - } - }, - "PreCheckMajorVersionUpgradeContext": { - "fields": { - "targetDatabaseVersion": { - "type": "SqlDatabaseVersion", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "preCheckResponse": { - "rule": "repeated", - "type": "PreCheckResponse", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kind": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "BackupContext": { - "fields": { - "backupId": { - "type": "int64", - "id": 1 - }, - "kind": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - } - } - }, - "Database": { - "oneofs": { - "databaseDetails": { - "oneof": [ - "sqlserverDatabaseDetails" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "charset": { - "type": "string", - "id": 2 - }, - "collation": { - "type": "string", - "id": 3 - }, - "etag": { - "type": "string", - "id": 4 - }, - "name": { - "type": "string", - "id": 5 - }, - "instance": { - "type": "string", - "id": 6 - }, - "selfLink": { - "type": "string", - "id": 7 - }, - "project": { - "type": "string", - "id": 8 - }, - "sqlserverDatabaseDetails": { - "type": "SqlServerDatabaseDetails", - "id": 9 - } - } - }, - "SqlServerDatabaseDetails": { - "fields": { - "compatibilityLevel": { - "type": "int32", - "id": 1 - }, - "recoveryModel": { - "type": "string", - "id": 2 - } - } - }, - "DatabaseFlags": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - } - } - }, - "MySqlSyncConfig": { - "fields": { - "initialSyncFlags": { - "rule": "repeated", - "type": "SyncFlags", - "id": 1 - } - } - }, - "SyncFlags": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - } - } - }, - "InstanceReference": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "region": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - } - } - }, - "DemoteMasterConfiguration": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "mysqlReplicaConfiguration": { - "type": "DemoteMasterMySqlReplicaConfiguration", - "id": 2 - } - } - }, - "DemoteMasterMySqlReplicaConfiguration": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "username": { - "type": "string", - "id": 2 - }, - "password": { - "type": "string", - "id": 3 - }, - "clientKey": { - "type": "string", - "id": 4 - }, - "clientCertificate": { - "type": "string", - "id": 5 - }, - "caCertificate": { - "type": "string", - "id": 6 - } - } - }, - "SqlFileType": { - "values": { - "SQL_FILE_TYPE_UNSPECIFIED": 0, - "SQL": 1, - "CSV": 2, - "BAK": 4, - "TDE": 8 - } - }, - "ExportContext": { - "fields": { - "uri": { - "type": "string", - "id": 1 - }, - "databases": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - }, - "sqlExportOptions": { - "type": "SqlExportOptions", - "id": 4 - }, - "csvExportOptions": { - "type": "SqlCsvExportOptions", - "id": 5 - }, - "fileType": { - "type": "SqlFileType", - "id": 6 - }, - "offload": { - "type": "google.protobuf.BoolValue", - "id": 8 - }, - "bakExportOptions": { - "type": "SqlBakExportOptions", - "id": 9 - }, - "tdeExportOptions": { - "type": "SqlTdeExportOptions", - "id": 10, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SqlCsvExportOptions": { - "fields": { - "selectQuery": { - "type": "string", - "id": 1 - }, - "escapeCharacter": { - "type": "string", - "id": 2 - }, - "quoteCharacter": { - "type": "string", - "id": 3 - }, - "fieldsTerminatedBy": { - "type": "string", - "id": 4 - }, - "linesTerminatedBy": { - "type": "string", - "id": 6 - } - } - }, - "SqlExportOptions": { - "fields": { - "tables": { - "rule": "repeated", - "type": "string", - "id": 1 - }, - "schemaOnly": { - "type": "google.protobuf.BoolValue", - "id": 2 - }, - "mysqlExportOptions": { - "type": "MysqlExportOptions", - "id": 3 - }, - "threads": { - "type": "google.protobuf.Int32Value", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "parallel": { - "type": "google.protobuf.BoolValue", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "postgresExportOptions": { - "type": "PostgresExportOptions", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "MysqlExportOptions": { - "fields": { - "masterData": { - "type": "google.protobuf.Int32Value", - "id": 1 - } - } - }, - "PostgresExportOptions": { - "fields": { - "clean": { - "type": "google.protobuf.BoolValue", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "ifExists": { - "type": "google.protobuf.BoolValue", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - } - } - }, - "SqlBakExportOptions": { - "fields": { - "striped": { - "type": "google.protobuf.BoolValue", - "id": 1 - }, - "stripeCount": { - "type": "google.protobuf.Int32Value", - "id": 2 - }, - "bakType": { - "type": "BakType", - "id": 4 - }, - "copyOnly": { - "type": "google.protobuf.BoolValue", - "id": 5, - "options": { - "deprecated": true - } - }, - "differentialBase": { - "type": "google.protobuf.BoolValue", - "id": 6 - }, - "exportLogStartTime": { - "type": "google.protobuf.Timestamp", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "exportLogEndTime": { - "type": "google.protobuf.Timestamp", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlTdeExportOptions": { - "fields": { - "certificatePath": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "privateKeyPath": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "privateKeyPassword": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "name": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - } - } - }, - "ImportContext": { - "fields": { - "uri": { - "type": "string", - "id": 1 - }, - "database": { - "type": "string", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - }, - "fileType": { - "type": "SqlFileType", - "id": 4 - }, - "csvImportOptions": { - "type": "SqlCsvImportOptions", - "id": 5 - }, - "importUser": { - "type": "string", - "id": 6 - }, - "bakImportOptions": { - "type": "SqlBakImportOptions", - "id": 7 - }, - "sqlImportOptions": { - "type": "SqlImportOptions", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "tdeImportOptions": { - "type": "SqlTdeImportOptions", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SqlImportOptions": { - "fields": { - "threads": { - "type": "google.protobuf.Int32Value", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "parallel": { - "type": "google.protobuf.BoolValue", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "postgresImportOptions": { - "type": "PostgresImportOptions", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "PostgresImportOptions": { - "fields": { - "clean": { - "type": "google.protobuf.BoolValue", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "ifExists": { - "type": "google.protobuf.BoolValue", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - } - } - }, - "SqlCsvImportOptions": { - "fields": { - "table": { - "type": "string", - "id": 1 - }, - "columns": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "escapeCharacter": { - "type": "string", - "id": 4 - }, - "quoteCharacter": { - "type": "string", - "id": 5 - }, - "fieldsTerminatedBy": { - "type": "string", - "id": 6 - }, - "linesTerminatedBy": { - "type": "string", - "id": 8 - } - } - }, - "SqlBakImportOptions": { - "fields": { - "encryptionOptions": { - "type": "EncryptionOptions", - "id": 1 - }, - "striped": { - "type": "google.protobuf.BoolValue", - "id": 2 - }, - "noRecovery": { - "type": "google.protobuf.BoolValue", - "id": 4 - }, - "recoveryOnly": { - "type": "google.protobuf.BoolValue", - "id": 5 - }, - "bakType": { - "type": "BakType", - "id": 6 - }, - "stopAt": { - "type": "google.protobuf.Timestamp", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "stopAtMark": { - "type": "string", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "EncryptionOptions": { - "fields": { - "certPath": { - "type": "string", - "id": 1 - }, - "pvkPath": { - "type": "string", - "id": 2 - }, - "pvkPassword": { - "type": "string", - "id": 3 - }, - "keepEncrypted": { - "type": "google.protobuf.BoolValue", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - } - } - }, - "SqlTdeImportOptions": { - "fields": { - "certificatePath": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "privateKeyPath": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "privateKeyPassword": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "name": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - } - } - }, - "BakType": { - "values": { - "BAK_TYPE_UNSPECIFIED": 0, - "FULL": 1, - "DIFF": 2, - "TLOG": 3 - } - }, - "IpConfiguration": { - "oneofs": { - "_pscConfig": { - "oneof": [ - "pscConfig" - ] - }, - "_serverCaMode": { - "oneof": [ - "serverCaMode" - ] - }, - "_serverCaPool": { - "oneof": [ - "serverCaPool" - ] - }, - "_serverCertificateRotationMode": { - "oneof": [ - "serverCertificateRotationMode" - ] - } - }, - "fields": { - "ipv4Enabled": { - "type": "google.protobuf.BoolValue", - "id": 1 - }, - "privateNetwork": { - "type": "string", - "id": 2 - }, - "requireSsl": { - "type": "google.protobuf.BoolValue", - "id": 3 - }, - "authorizedNetworks": { - "rule": "repeated", - "type": "AclEntry", - "id": 4 - }, - "allocatedIpRange": { - "type": "string", - "id": 6 - }, - "enablePrivatePathForGoogleCloudServices": { - "type": "google.protobuf.BoolValue", - "id": 7 - }, - "sslMode": { - "type": "SslMode", - "id": 8 - }, - "pscConfig": { - "type": "PscConfig", - "id": 9, - "options": { - "proto3_optional": true - } - }, - "serverCaMode": { - "type": "CaMode", - "id": 10, - "options": { - "proto3_optional": true - } - }, - "customSubjectAlternativeNames": { - "rule": "repeated", - "type": "string", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "serverCaPool": { - "type": "string", - "id": 12, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "serverCertificateRotationMode": { - "type": "ServerCertificateRotationMode", - "id": 16, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - } - }, - "nested": { - "SslMode": { - "values": { - "SSL_MODE_UNSPECIFIED": 0, - "ALLOW_UNENCRYPTED_AND_ENCRYPTED": 1, - "ENCRYPTED_ONLY": 2, - "TRUSTED_CLIENT_CERTIFICATE_REQUIRED": 3 - } - }, - "CaMode": { - "values": { - "CA_MODE_UNSPECIFIED": 0, - "GOOGLE_MANAGED_INTERNAL_CA": 1, - "GOOGLE_MANAGED_CAS_CA": 2, - "CUSTOMER_MANAGED_CAS_CA": 3 - } - }, - "ServerCertificateRotationMode": { - "values": { - "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED": 0, - "NO_AUTOMATIC_ROTATION": 1, - "AUTOMATIC_ROTATION_DURING_MAINTENANCE": 2 - } - } - } - }, - "PscConfig": { - "oneofs": { - "_pscEnabled": { - "oneof": [ - "pscEnabled" - ] - }, - "_pscAutoDnsEnabled": { - "oneof": [ - "pscAutoDnsEnabled" - ] - }, - "_pscWriteEndpointDnsEnabled": { - "oneof": [ - "pscWriteEndpointDnsEnabled" - ] - } - }, - "fields": { - "pscEnabled": { - "type": "bool", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "allowedConsumerProjects": { - "rule": "repeated", - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pscAutoConnections": { - "rule": "repeated", - "type": "PscAutoConnectionConfig", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "networkAttachmentUri": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pscAutoDnsEnabled": { - "type": "bool", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "pscWriteEndpointDnsEnabled": { - "type": "bool", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - } - } - }, - "PscAutoConnectionConfig": { - "oneofs": { - "_ipAddress": { - "oneof": [ - "ipAddress" - ] - }, - "_status": { - "oneof": [ - "status" - ] - }, - "_consumerNetworkStatus": { - "oneof": [ - "consumerNetworkStatus" - ] - } - }, - "fields": { - "consumerProject": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "consumerNetwork": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "ipAddress": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_info).format": "IPV4_OR_IPV6", - "proto3_optional": true - } - }, - "status": { - "type": "string", - "id": 4, - "options": { - "proto3_optional": true - } - }, - "consumerNetworkStatus": { - "type": "string", - "id": 5, - "options": { - "proto3_optional": true - } - } - } - }, - "LocationPreference": { - "fields": { - "followGaeApplication": { - "type": "string", - "id": 1, - "options": { - "deprecated": true - } - }, - "zone": { - "type": "string", - "id": 2 - }, - "secondaryZone": { - "type": "string", - "id": 4 - }, - "kind": { - "type": "string", - "id": 3 - } - } - }, - "MaintenanceWindow": { - "fields": { - "hour": { - "type": "google.protobuf.Int32Value", - "id": 1 - }, - "day": { - "type": "google.protobuf.Int32Value", - "id": 2 - }, - "updateTrack": { - "type": "SqlUpdateTrack", - "id": 3 - }, - "kind": { - "type": "string", - "id": 4 - } - } - }, - "DenyMaintenancePeriod": { - "fields": { - "startDate": { - "type": "string", - "id": 1 - }, - "endDate": { - "type": "string", - "id": 2 - }, - "time": { - "type": "string", - "id": 3 - } - } - }, - "InsightsConfig": { - "fields": { - "queryInsightsEnabled": { - "type": "bool", - "id": 1 - }, - "recordClientAddress": { - "type": "bool", - "id": 2 - }, - "recordApplicationTags": { - "type": "bool", - "id": 3 - }, - "queryStringLength": { - "type": "google.protobuf.Int32Value", - "id": 4 - }, - "queryPlansPerMinute": { - "type": "google.protobuf.Int32Value", - "id": 5 - }, - "enhancedQueryInsightsEnabled": { - "type": "google.protobuf.BoolValue", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "MySqlReplicaConfiguration": { - "fields": { - "dumpFilePath": { - "type": "string", - "id": 1 - }, - "username": { - "type": "string", - "id": 2 - }, - "password": { - "type": "string", - "id": 3 - }, - "connectRetryInterval": { - "type": "google.protobuf.Int32Value", - "id": 4 - }, - "masterHeartbeatPeriod": { - "type": "google.protobuf.Int64Value", - "id": 5 - }, - "caCertificate": { - "type": "string", - "id": 6 - }, - "clientCertificate": { - "type": "string", - "id": 7 - }, - "clientKey": { - "type": "string", - "id": 8 - }, - "sslCipher": { - "type": "string", - "id": 9 - }, - "verifyServerCertificate": { - "type": "google.protobuf.BoolValue", - "id": 10 - }, - "kind": { - "type": "string", - "id": 11 - } - } - }, - "DiskEncryptionConfiguration": { - "fields": { - "kmsKeyName": { - "type": "string", - "id": 1 - }, - "kind": { - "type": "string", - "id": 2 - } - } - }, - "DiskEncryptionStatus": { - "fields": { - "kmsKeyVersionName": { - "type": "string", - "id": 1 - }, - "kind": { - "type": "string", - "id": 2 - } - } - }, - "IpMapping": { - "fields": { - "type": { - "type": "SqlIpAddressType", - "id": 1 - }, - "ipAddress": { - "type": "string", - "id": 2 - }, - "timeToRetire": { - "type": "google.protobuf.Timestamp", - "id": 3 - } - } - }, - "SqlMaintenanceType": { - "values": { - "SQL_MAINTENANCE_TYPE_UNSPECIFIED": 0, - "INSTANCE_MAINTENANCE": 1, - "REPLICA_INCLUDED_MAINTENANCE": 2, - "INSTANCE_SELF_SERVICE_MAINTENANCE": 3, - "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE": 4 - } - }, - "SqlSubOperationType": { - "oneofs": { - "subOperationDetails": { - "oneof": [ - "maintenanceType" - ] - } - }, - "fields": { - "maintenanceType": { - "type": "SqlMaintenanceType", - "id": 1 - } - } - }, - "Operation": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "targetLink": { - "type": "string", - "id": 2 - }, - "status": { - "type": "SqlOperationStatus", - "id": 3 - }, - "user": { - "type": "string", - "id": 4 - }, - "insertTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 6 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 7 - }, - "error": { - "type": "OperationErrors", - "id": 8 - }, - "apiWarning": { - "type": "ApiWarning", - "id": 19 - }, - "operationType": { - "type": "SqlOperationType", - "id": 9 - }, - "importContext": { - "type": "ImportContext", - "id": 10 - }, - "exportContext": { - "type": "ExportContext", - "id": 11 - }, - "backupContext": { - "type": "BackupContext", - "id": 17 - }, - "preCheckMajorVersionUpgradeContext": { - "type": "PreCheckMajorVersionUpgradeContext", - "id": 50 - }, - "name": { - "type": "string", - "id": 12 - }, - "targetId": { - "type": "string", - "id": 13 - }, - "selfLink": { - "type": "string", - "id": 14 - }, - "targetProject": { - "type": "string", - "id": 15 - }, - "acquireSsrsLeaseContext": { - "type": "AcquireSsrsLeaseContext", - "id": 20 - }, - "subOperationType": { - "type": "SqlSubOperationType", - "id": 48, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SqlOperationType": { - "valuesOptions": { - "BACKUP": { - "deprecated": true - }, - "SNAPSHOT": { - "deprecated": true - }, - "ENABLE_PRIVATE_IP": { - "deprecated": true - }, - "DEFER_MAINTENANCE": { - "deprecated": true - }, - "CREATE_CLONE": { - "deprecated": true - }, - "CLUSTER_MAINTENANCE": { - "deprecated": true - }, - "SELF_SERVICE_MAINTENANCE": { - "deprecated": true - }, - "ADVANCED_BACKUP": { - "deprecated": true - } - }, - "values": { - "SQL_OPERATION_TYPE_UNSPECIFIED": 0, - "IMPORT": 1, - "EXPORT": 2, - "CREATE": 3, - "UPDATE": 4, - "DELETE": 5, - "RESTART": 6, - "BACKUP": 7, - "SNAPSHOT": 8, - "BACKUP_VOLUME": 9, - "DELETE_VOLUME": 10, - "RESTORE_VOLUME": 11, - "INJECT_USER": 12, - "CLONE": 14, - "STOP_REPLICA": 15, - "START_REPLICA": 16, - "PROMOTE_REPLICA": 17, - "CREATE_REPLICA": 18, - "CREATE_USER": 19, - "DELETE_USER": 20, - "UPDATE_USER": 21, - "CREATE_DATABASE": 22, - "DELETE_DATABASE": 23, - "UPDATE_DATABASE": 24, - "FAILOVER": 25, - "DELETE_BACKUP": 26, - "RECREATE_REPLICA": 27, - "TRUNCATE_LOG": 28, - "DEMOTE_MASTER": 29, - "MAINTENANCE": 30, - "ENABLE_PRIVATE_IP": 31, - "DEFER_MAINTENANCE": 32, - "CREATE_CLONE": 33, - "RESCHEDULE_MAINTENANCE": 34, - "START_EXTERNAL_SYNC": 35, - "LOG_CLEANUP": 36, - "AUTO_RESTART": 37, - "REENCRYPT": 38, - "SWITCHOVER": 39, - "UPDATE_BACKUP": 40, - "ACQUIRE_SSRS_LEASE": 42, - "RELEASE_SSRS_LEASE": 43, - "RECONFIGURE_OLD_PRIMARY": 44, - "CLUSTER_MAINTENANCE": 45, - "SELF_SERVICE_MAINTENANCE": 46, - "SWITCHOVER_TO_REPLICA": 47, - "MAJOR_VERSION_UPGRADE": 48, - "ADVANCED_BACKUP": 49, - "MANAGE_BACKUP": 50, - "ENHANCED_BACKUP": 51, - "REPAIR_READ_POOL": 52, - "CREATE_READ_POOL": 53, - "PRE_CHECK_MAJOR_VERSION_UPGRADE": 54 - } - }, - "SqlOperationStatus": { - "values": { - "SQL_OPERATION_STATUS_UNSPECIFIED": 0, - "PENDING": 1, - "RUNNING": 2, - "DONE": 3 - } - } - } - }, - "OperationError": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "code": { - "type": "string", - "id": 2 - }, - "message": { - "type": "string", - "id": 3 - } - } - }, - "OperationErrors": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "errors": { - "rule": "repeated", - "type": "OperationError", - "id": 2 - } - } - }, - "PasswordValidationPolicy": { - "fields": { - "minLength": { - "type": "google.protobuf.Int32Value", - "id": 1 - }, - "complexity": { - "type": "Complexity", - "id": 2 - }, - "reuseInterval": { - "type": "google.protobuf.Int32Value", - "id": 3 - }, - "disallowUsernameSubstring": { - "type": "google.protobuf.BoolValue", - "id": 4 - }, - "passwordChangeInterval": { - "type": "google.protobuf.Duration", - "id": 5 - }, - "enablePasswordPolicy": { - "type": "google.protobuf.BoolValue", - "id": 6 - }, - "disallowCompromisedCredentials": { - "type": "google.protobuf.BoolValue", - "id": 7, - "options": { - "deprecated": true - } - } - }, - "nested": { - "Complexity": { - "values": { - "COMPLEXITY_UNSPECIFIED": 0, - "COMPLEXITY_DEFAULT": 1 - } - } - } - }, - "DataCacheConfig": { - "fields": { - "dataCacheEnabled": { - "type": "bool", - "id": 1 - } - } - }, - "FinalBackupConfig": { - "oneofs": { - "_enabled": { - "oneof": [ - "enabled" - ] - }, - "_retentionDays": { - "oneof": [ - "retentionDays" - ] - } - }, - "fields": { - "enabled": { - "type": "bool", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "retentionDays": { - "type": "int32", - "id": 3, - "options": { - "proto3_optional": true - } - } - } - }, - "Settings": { - "oneofs": { - "_dataDiskProvisionedIops": { - "oneof": [ - "dataDiskProvisionedIops" - ] - }, - "_dataDiskProvisionedThroughput": { - "oneof": [ - "dataDiskProvisionedThroughput" - ] - }, - "_connectionPoolConfig": { - "oneof": [ - "connectionPoolConfig" - ] - }, - "_finalBackupConfig": { - "oneof": [ - "finalBackupConfig" - ] - }, - "_readPoolAutoScaleConfig": { - "oneof": [ - "readPoolAutoScaleConfig" - ] - }, - "_autoUpgradeEnabled": { - "oneof": [ - "autoUpgradeEnabled" - ] - }, - "_dataApiAccess": { - "oneof": [ - "dataApiAccess" - ] - } - }, - "fields": { - "settingsVersion": { - "type": "google.protobuf.Int64Value", - "id": 1 - }, - "authorizedGaeApplications": { - "rule": "repeated", - "type": "string", - "id": 2, - "options": { - "deprecated": true - } - }, - "tier": { - "type": "string", - "id": 3 - }, - "kind": { - "type": "string", - "id": 4 - }, - "userLabels": { - "keyType": "string", - "type": "string", - "id": 5 - }, - "availabilityType": { - "type": "SqlAvailabilityType", - "id": 6 - }, - "pricingPlan": { - "type": "SqlPricingPlan", - "id": 7 - }, - "replicationType": { - "type": "SqlReplicationType", - "id": 8, - "options": { - "deprecated": true - } - }, - "storageAutoResizeLimit": { - "type": "google.protobuf.Int64Value", - "id": 9 - }, - "activationPolicy": { - "type": "SqlActivationPolicy", - "id": 10 - }, - "ipConfiguration": { - "type": "IpConfiguration", - "id": 11 - }, - "storageAutoResize": { - "type": "google.protobuf.BoolValue", - "id": 12 - }, - "locationPreference": { - "type": "LocationPreference", - "id": 13 - }, - "databaseFlags": { - "rule": "repeated", - "type": "DatabaseFlags", - "id": 14 - }, - "dataDiskType": { - "type": "SqlDataDiskType", - "id": 15 - }, - "maintenanceWindow": { - "type": "MaintenanceWindow", - "id": 16 - }, - "backupConfiguration": { - "type": "BackupConfiguration", - "id": 17 - }, - "databaseReplicationEnabled": { - "type": "google.protobuf.BoolValue", - "id": 18 - }, - "crashSafeReplicationEnabled": { - "type": "google.protobuf.BoolValue", - "id": 19, - "options": { - "deprecated": true - } - }, - "dataDiskSizeGb": { - "type": "google.protobuf.Int64Value", - "id": 20 - }, - "activeDirectoryConfig": { - "type": "SqlActiveDirectoryConfig", - "id": 22 - }, - "collation": { - "type": "string", - "id": 23 - }, - "denyMaintenancePeriods": { - "rule": "repeated", - "type": "DenyMaintenancePeriod", - "id": 24 - }, - "insightsConfig": { - "type": "InsightsConfig", - "id": 25 - }, - "passwordValidationPolicy": { - "type": "PasswordValidationPolicy", - "id": 27 - }, - "sqlServerAuditConfig": { - "type": "SqlServerAuditConfig", - "id": 29 - }, - "edition": { - "type": "Edition", - "id": 38, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "connectorEnforcement": { - "type": "ConnectorEnforcement", - "id": 32 - }, - "deletionProtectionEnabled": { - "type": "google.protobuf.BoolValue", - "id": 33 - }, - "timeZone": { - "type": "string", - "id": 34 - }, - "advancedMachineFeatures": { - "type": "AdvancedMachineFeatures", - "id": 35 - }, - "dataCacheConfig": { - "type": "DataCacheConfig", - "id": 37 - }, - "replicationLagMaxSeconds": { - "type": "google.protobuf.Int32Value", - "id": 39, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "enableGoogleMlIntegration": { - "type": "google.protobuf.BoolValue", - "id": 40, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "enableDataplexIntegration": { - "type": "google.protobuf.BoolValue", - "id": 41, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "retainBackupsOnDelete": { - "type": "google.protobuf.BoolValue", - "id": 42, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "dataDiskProvisionedIops": { - "type": "int64", - "id": 43, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "dataDiskProvisionedThroughput": { - "type": "int64", - "id": 44, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "connectionPoolConfig": { - "type": "ConnectionPoolConfig", - "id": 45, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "finalBackupConfig": { - "type": "FinalBackupConfig", - "id": 47, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "readPoolAutoScaleConfig": { - "type": "ReadPoolAutoScaleConfig", - "id": 48, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "acceleratedReplicaMode": { - "type": "google.protobuf.BoolValue", - "id": 49, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "autoUpgradeEnabled": { - "type": "bool", - "id": 50, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "entraidConfig": { - "type": "SqlServerEntraIdConfig", - "id": 52, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "dataApiAccess": { - "type": "DataApiAccess", - "id": 53, - "options": { - "proto3_optional": true - } - }, - "performanceCaptureConfig": { - "type": "PerformanceCaptureConfig", - "id": 54, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SqlActivationPolicy": { - "valuesOptions": { - "ON_DEMAND": { - "deprecated": true - } - }, - "values": { - "SQL_ACTIVATION_POLICY_UNSPECIFIED": 0, - "ALWAYS": 1, - "NEVER": 2, - "ON_DEMAND": 3 - } - }, - "Edition": { - "values": { - "EDITION_UNSPECIFIED": 0, - "ENTERPRISE": 2, - "ENTERPRISE_PLUS": 3 - } - }, - "ConnectorEnforcement": { - "values": { - "CONNECTOR_ENFORCEMENT_UNSPECIFIED": 0, - "NOT_REQUIRED": 1, - "REQUIRED": 2 - } - }, - "DataApiAccess": { - "values": { - "DATA_API_ACCESS_UNSPECIFIED": 0, - "DISALLOW_DATA_API": 1, - "ALLOW_DATA_API": 2 - } - } - } - }, - "PerformanceCaptureConfig": { - "oneofs": { - "_enabled": { - "oneof": [ - "enabled" - ] - }, - "_probingIntervalSeconds": { - "oneof": [ - "probingIntervalSeconds" - ] - }, - "_probeThreshold": { - "oneof": [ - "probeThreshold" - ] - }, - "_runningThreadsThreshold": { - "oneof": [ - "runningThreadsThreshold" - ] - }, - "_secondsBehindSourceThreshold": { - "oneof": [ - "secondsBehindSourceThreshold" - ] - }, - "_transactionDurationThreshold": { - "oneof": [ - "transactionDurationThreshold" - ] - } - }, - "fields": { - "enabled": { - "type": "bool", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "probingIntervalSeconds": { - "type": "int32", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "probeThreshold": { - "type": "int32", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "runningThreadsThreshold": { - "type": "int32", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "secondsBehindSourceThreshold": { - "type": "int32", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "transactionDurationThreshold": { - "type": "int32", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - } - } - }, - "ConnectionPoolFlags": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "value": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "ConnectionPoolConfig": { - "oneofs": { - "_connectionPoolingEnabled": { - "oneof": [ - "connectionPoolingEnabled" - ] - }, - "_poolerCount": { - "oneof": [ - "poolerCount" - ] - } - }, - "fields": { - "connectionPoolingEnabled": { - "type": "bool", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "flags": { - "rule": "repeated", - "type": "ConnectionPoolFlags", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "poolerCount": { - "type": "int32", - "id": 9, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - } - } - }, - "ReadPoolAutoScaleConfig": { - "oneofs": { - "_enabled": { - "oneof": [ - "enabled" - ] - }, - "_minNodeCount": { - "oneof": [ - "minNodeCount" - ] - }, - "_maxNodeCount": { - "oneof": [ - "maxNodeCount" - ] - }, - "_disableScaleIn": { - "oneof": [ - "disableScaleIn" - ] - }, - "_scaleInCooldownSeconds": { - "oneof": [ - "scaleInCooldownSeconds" - ] - }, - "_scaleOutCooldownSeconds": { - "oneof": [ - "scaleOutCooldownSeconds" - ] - } - }, - "fields": { - "enabled": { - "type": "bool", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "minNodeCount": { - "type": "int32", - "id": 2, - "options": { - "proto3_optional": true - } - }, - "maxNodeCount": { - "type": "int32", - "id": 3, - "options": { - "proto3_optional": true - } - }, - "targetMetrics": { - "rule": "repeated", - "type": "TargetMetric", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "disableScaleIn": { - "type": "bool", - "id": 5, - "options": { - "proto3_optional": true - } - }, - "scaleInCooldownSeconds": { - "type": "int32", - "id": 6, - "options": { - "proto3_optional": true - } - }, - "scaleOutCooldownSeconds": { - "type": "int32", - "id": 7, - "options": { - "proto3_optional": true - } - } - }, - "nested": { - "TargetMetric": { - "oneofs": { - "_metric": { - "oneof": [ - "metric" - ] - }, - "_targetValue": { - "oneof": [ - "targetValue" - ] - } - }, - "fields": { - "metric": { - "type": "string", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "targetValue": { - "type": "float", - "id": 2, - "options": { - "proto3_optional": true - } - } - } - } - } - }, - "AdvancedMachineFeatures": { - "fields": { - "threadsPerCore": { - "type": "int32", - "id": 1 - } - } - }, - "SslCert": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "certSerialNumber": { - "type": "string", - "id": 2 - }, - "cert": { - "type": "string", - "id": 3 - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 4 - }, - "commonName": { - "type": "string", - "id": 5 - }, - "expirationTime": { - "type": "google.protobuf.Timestamp", - "id": 6 - }, - "sha1Fingerprint": { - "type": "string", - "id": 7 - }, - "instance": { - "type": "string", - "id": 8 - }, - "selfLink": { - "type": "string", - "id": 9 - } - } - }, - "SslCertDetail": { - "fields": { - "certInfo": { - "type": "SslCert", - "id": 1 - }, - "certPrivateKey": { - "type": "string", - "id": 2 - } - } - }, - "SqlActiveDirectoryConfig": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "domain": { - "type": "string", - "id": 2 - }, - "mode": { - "type": "ActiveDirectoryMode", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "dnsServers": { - "rule": "repeated", - "type": "string", - "id": 4, - "options": { - "(google.api.field_info).format": "IPV4", - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "adminCredentialSecretName": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "organizationalUnit": { - "type": "string", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "ActiveDirectoryMode": { - "valuesOptions": { - "SELF_MANAGED_ACTIVE_DIRECTORY": { - "deprecated": true - } - }, - "values": { - "ACTIVE_DIRECTORY_MODE_UNSPECIFIED": 0, - "MANAGED_ACTIVE_DIRECTORY": 1, - "SELF_MANAGED_ACTIVE_DIRECTORY": 2, - "CUSTOMER_MANAGED_ACTIVE_DIRECTORY": 3 - } - } - } - }, - "SqlServerAuditConfig": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "bucket": { - "type": "string", - "id": 2 - }, - "retentionInterval": { - "type": "google.protobuf.Duration", - "id": 3 - }, - "uploadInterval": { - "type": "google.protobuf.Duration", - "id": 4 - } - } - }, - "SqlServerEntraIdConfig": { - "fields": { - "kind": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "tenantId": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "applicationId": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlBackendType": { - "valuesOptions": { - "FIRST_GEN": { - "deprecated": true - } - }, - "values": { - "SQL_BACKEND_TYPE_UNSPECIFIED": 0, - "FIRST_GEN": 1, - "SECOND_GEN": 2, - "EXTERNAL": 3 - } - }, - "SqlIpAddressType": { - "values": { - "SQL_IP_ADDRESS_TYPE_UNSPECIFIED": 0, - "PRIMARY": 1, - "OUTGOING": 2, - "PRIVATE": 3, - "MIGRATED_1ST_GEN": 4 - } - }, - "SqlDatabaseVersion": { - "valuesOptions": { - "MYSQL_5_1": { - "deprecated": true - }, - "MYSQL_5_5": { - "deprecated": true - }, - "MYSQL_8_0_29": { - "deprecated": true - } - }, - "values": { - "SQL_DATABASE_VERSION_UNSPECIFIED": 0, - "MYSQL_5_1": 2, - "MYSQL_5_5": 3, - "MYSQL_5_6": 5, - "MYSQL_5_7": 6, - "MYSQL_8_0": 20, - "MYSQL_8_0_18": 41, - "MYSQL_8_0_26": 85, - "MYSQL_8_0_27": 111, - "MYSQL_8_0_28": 132, - "MYSQL_8_0_29": 148, - "MYSQL_8_0_30": 174, - "MYSQL_8_0_31": 197, - "MYSQL_8_0_32": 213, - "MYSQL_8_0_33": 238, - "MYSQL_8_0_34": 239, - "MYSQL_8_0_35": 240, - "MYSQL_8_0_36": 241, - "MYSQL_8_0_37": 355, - "MYSQL_8_0_39": 357, - "MYSQL_8_0_40": 358, - "MYSQL_8_0_41": 488, - "MYSQL_8_0_42": 489, - "MYSQL_8_0_43": 553, - "MYSQL_8_0_44": 554, - "MYSQL_8_0_45": 555, - "MYSQL_8_0_46": 556, - "MYSQL_8_4": 398, - "MYSQL_9_7": 654, - "SQLSERVER_2017_STANDARD": 11, - "SQLSERVER_2017_ENTERPRISE": 14, - "SQLSERVER_2017_EXPRESS": 15, - "SQLSERVER_2017_WEB": 16, - "POSTGRES_9_6": 9, - "POSTGRES_10": 18, - "POSTGRES_11": 10, - "POSTGRES_12": 19, - "POSTGRES_13": 23, - "POSTGRES_14": 110, - "POSTGRES_15": 172, - "POSTGRES_16": 272, - "POSTGRES_17": 408, - "POSTGRES_18": 557, - "POSTGRES_19": 684, - "SQLSERVER_2019_STANDARD": 26, - "SQLSERVER_2019_ENTERPRISE": 27, - "SQLSERVER_2019_EXPRESS": 28, - "SQLSERVER_2019_WEB": 29, - "SQLSERVER_2022_STANDARD": 199, - "SQLSERVER_2022_ENTERPRISE": 200, - "SQLSERVER_2022_EXPRESS": 201, - "SQLSERVER_2022_WEB": 202, - "SQLSERVER_2025_STANDARD": 549, - "SQLSERVER_2025_ENTERPRISE": 550, - "SQLSERVER_2025_EXPRESS": 551 - } - }, - "SqlPricingPlan": { - "values": { - "SQL_PRICING_PLAN_UNSPECIFIED": 0, - "PACKAGE": 1, - "PER_USE": 2 - } - }, - "SqlReplicationType": { - "values": { - "SQL_REPLICATION_TYPE_UNSPECIFIED": 0, - "SYNCHRONOUS": 1, - "ASYNCHRONOUS": 2 - } - }, - "SqlDataDiskType": { - "valuesOptions": { - "OBSOLETE_LOCAL_SSD": { - "deprecated": true - } - }, - "values": { - "SQL_DATA_DISK_TYPE_UNSPECIFIED": 0, - "PD_SSD": 1, - "PD_HDD": 2, - "OBSOLETE_LOCAL_SSD": 3, - "HYPERDISK_BALANCED": 4 - } - }, - "SqlAvailabilityType": { - "values": { - "SQL_AVAILABILITY_TYPE_UNSPECIFIED": 0, - "ZONAL": 1, - "REGIONAL": 2 - } - }, - "SqlUpdateTrack": { - "values": { - "SQL_UPDATE_TRACK_UNSPECIFIED": 0, - "canary": 1, - "stable": 2, - "week5": 3 - } - }, - "AcquireSsrsLeaseContext": { - "oneofs": { - "_setupLogin": { - "oneof": [ - "setupLogin" - ] - }, - "_serviceLogin": { - "oneof": [ - "serviceLogin" - ] - }, - "_reportDatabase": { - "oneof": [ - "reportDatabase" - ] - }, - "_duration": { - "oneof": [ - "duration" - ] - } - }, - "fields": { - "setupLogin": { - "type": "string", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "serviceLogin": { - "type": "string", - "id": 2, - "options": { - "proto3_optional": true - } - }, - "reportDatabase": { - "type": "string", - "id": 3, - "options": { - "proto3_optional": true - } - }, - "duration": { - "type": "google.protobuf.Duration", - "id": 4, - "options": { - "proto3_optional": true - } - } - } - }, - "DnsNameMapping": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "connectionType": { - "type": "ConnectionType", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "dnsScope": { - "type": "DnsScope", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "recordManager": { - "type": "RecordManager", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - }, - "nested": { - "ConnectionType": { - "values": { - "CONNECTION_TYPE_UNSPECIFIED": 0, - "PUBLIC": 1, - "PRIVATE_SERVICES_ACCESS": 2, - "PRIVATE_SERVICE_CONNECT": 3 - } - }, - "DnsScope": { - "values": { - "DNS_SCOPE_UNSPECIFIED": 0, - "INSTANCE": 1, - "CLUSTER": 2 - } - }, - "RecordManager": { - "values": { - "RECORD_MANAGER_UNSPECIFIED": 0, - "CUSTOMER": 1, - "CLOUD_SQL_AUTOMATION": 2 - } - } - } - }, - "SqlBackupsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "CreateBackup": { - "requestType": "CreateBackupRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/{parent=projects/*}/backups", - "(google.api.http).body": "backup", - "(google.api.method_signature)": "parent, backup" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*}/backups", - "body": "backup" - } - }, - { - "(google.api.method_signature)": "parent, backup" - } - ] - }, - "GetBackup": { - "requestType": "GetBackupRequest", - "responseType": "Backup", - "options": { - "(google.api.http).get": "/v1/{name=projects/*/backups/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{name=projects/*/backups/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "ListBackups": { - "requestType": "ListBackupsRequest", - "responseType": "ListBackupsResponse", - "options": { - "(google.api.http).get": "/v1/{parent=projects/*}/backups", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/{parent=projects/*}/backups" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "UpdateBackup": { - "requestType": "UpdateBackupRequest", - "responseType": "Operation", - "options": { - "(google.api.http).patch": "/v1/{backup.name=projects/*/backups/*}", - "(google.api.http).body": "backup", - "(google.api.method_signature)": "backup, update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1/{backup.name=projects/*/backups/*}", - "body": "backup" - } - }, - { - "(google.api.method_signature)": "backup, update_mask" - } - ] - }, - "DeleteBackup": { - "requestType": "DeleteBackupRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/v1/{name=projects/*/backups/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/{name=projects/*/backups/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - } - } - }, - "CreateBackupRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "sqladmin.googleapis.com/Backup" - } - }, - "backup": { - "type": "Backup", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "GetBackupRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" - } - } - } - }, - "ListBackupsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "sqladmin.googleapis.com/Backup" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - }, - "filter": { - "type": "string", - "id": 4 - } - } - }, - "ListBackupsResponse": { - "fields": { - "backups": { - "rule": "repeated", - "type": "Backup", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - }, - "warnings": { - "rule": "repeated", - "type": "ApiWarning", - "id": 3 - } - } - }, - "UpdateBackupRequest": { - "fields": { - "backup": { - "type": "Backup", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - } - } - }, - "DeleteBackupRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" - } - } - } - }, - "Backup": { - "options": { - "(google.api.resource).type": "sqladmin.googleapis.com/Backup", - "(google.api.resource).pattern": "projects/{project}/backups/{backup}" - }, - "oneofs": { - "expiration": { - "oneof": [ - "ttlDays", - "expiryTime" - ] - }, - "_maxChargeableBytes": { - "oneof": [ - "maxChargeableBytes" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kind": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "selfLink": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "type": { - "type": "SqlBackupType", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "description": { - "type": "string", - "id": 5 - }, - "instance": { - "type": "string", - "id": 6 - }, - "location": { - "type": "string", - "id": 7 - }, - "backupInterval": { - "type": "google.type.Interval", - "id": 8, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "state": { - "type": "SqlBackupState", - "id": 9, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "error": { - "type": "OperationError", - "id": 10, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kmsKey": { - "type": "string", - "id": 11, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kmsKeyVersion": { - "type": "string", - "id": 12, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "backupKind": { - "type": "SqlBackupKind", - "id": 13, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "timeZone": { - "type": "string", - "id": 15, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "ttlDays": { - "type": "int64", - "id": 16, - "options": { - "(google.api.field_behavior)": "INPUT_ONLY" - } - }, - "expiryTime": { - "type": "google.protobuf.Timestamp", - "id": 17 - }, - "databaseVersion": { - "type": "SqlDatabaseVersion", - "id": 20, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "maxChargeableBytes": { - "type": "int64", - "id": 23, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "instanceDeletionTime": { - "type": "google.protobuf.Timestamp", - "id": 24, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "instanceSettings": { - "type": "DatabaseInstance", - "id": 25, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "backupRun": { - "type": "string", - "id": 26, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "satisfiesPzs": { - "type": "google.protobuf.BoolValue", - "id": 27, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "satisfiesPzi": { - "type": "google.protobuf.BoolValue", - "id": 28, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - }, - "nested": { - "SqlBackupType": { - "values": { - "SQL_BACKUP_TYPE_UNSPECIFIED": 0, - "AUTOMATED": 1, - "ON_DEMAND": 2, - "FINAL": 3 - } - }, - "SqlBackupState": { - "values": { - "SQL_BACKUP_STATE_UNSPECIFIED": 0, - "ENQUEUED": 1, - "RUNNING": 2, - "FAILED": 3, - "SUCCESSFUL": 4, - "DELETING": 5, - "DELETION_FAILED": 6 - } - } - } - }, - "SqlInstancesService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "AddServerCa": { - "requestType": "SqlInstancesAddServerCaRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/addServerCa" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/addServerCa" - } - } - ] - }, - "AddServerCertificate": { - "requestType": "SqlInstancesAddServerCertificateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/addServerCertificate" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/addServerCertificate" - } - } - ] - }, - "AddEntraIdCertificate": { - "requestType": "SqlInstancesAddEntraIdCertificateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/addEntraIdCertificate" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/addEntraIdCertificate" - } - } - ] - }, - "Clone": { - "requestType": "SqlInstancesCloneRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/clone", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/clone", - "body": "body" - } - } - ] - }, - "Delete": { - "requestType": "SqlInstancesDeleteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/v1/projects/{project}/instances/{instance}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/projects/{project}/instances/{instance}" - } - } - ] - }, - "DemoteMaster": { - "requestType": "SqlInstancesDemoteMasterRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/demoteMaster", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/demoteMaster", - "body": "body" - } - } - ] - }, - "Demote": { - "requestType": "SqlInstancesDemoteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/demote", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/demote", - "body": "body" - } - } - ] - }, - "Export": { - "requestType": "SqlInstancesExportRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/export", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/export", - "body": "body" - } - } - ] - }, - "Failover": { - "requestType": "SqlInstancesFailoverRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/failover", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/failover", - "body": "body" - } - } - ] - }, - "Reencrypt": { - "requestType": "SqlInstancesReencryptRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/reencrypt", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/reencrypt", - "body": "body" - } - } - ] - }, - "Get": { - "requestType": "SqlInstancesGetRequest", - "responseType": "DatabaseInstance", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}" - } - } - ] - }, - "Import": { - "requestType": "SqlInstancesImportRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/import", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/import", - "body": "body" - } - } - ] - }, - "Insert": { - "requestType": "SqlInstancesInsertRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances", - "body": "body" - } - } - ] - }, - "List": { - "requestType": "SqlInstancesListRequest", - "responseType": "InstancesListResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances" - } - } - ] - }, - "ListServerCas": { - "requestType": "SqlInstancesListServerCasRequest", - "responseType": "InstancesListServerCasResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/listServerCas" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/listServerCas" - } - } - ] - }, - "ListServerCertificates": { - "requestType": "SqlInstancesListServerCertificatesRequest", - "responseType": "InstancesListServerCertificatesResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/listServerCertificates" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/listServerCertificates" - } - } - ] - }, - "ListEntraIdCertificates": { - "requestType": "SqlInstancesListEntraIdCertificatesRequest", - "responseType": "InstancesListEntraIdCertificatesResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/listEntraIdCertificates" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/listEntraIdCertificates" - } - } - ] - }, - "Patch": { - "requestType": "SqlInstancesPatchRequest", - "responseType": "Operation", - "options": { - "(google.api.http).patch": "/v1/projects/{project}/instances/{instance}", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1/projects/{project}/instances/{instance}", - "body": "body" - } - } - ] - }, - "PromoteReplica": { - "requestType": "SqlInstancesPromoteReplicaRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/promoteReplica" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/promoteReplica" - } - } - ] - }, - "Switchover": { - "requestType": "SqlInstancesSwitchoverRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/switchover" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/switchover" - } - } - ] - }, - "ResetSslConfig": { - "requestType": "SqlInstancesResetSslConfigRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/resetSslConfig" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/resetSslConfig" - } - } - ] - }, - "Restart": { - "requestType": "SqlInstancesRestartRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/restart" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/restart" - } - } - ] - }, - "RestoreBackup": { - "requestType": "SqlInstancesRestoreBackupRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/restoreBackup", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/restoreBackup", - "body": "body" - } - } - ] - }, - "RotateServerCa": { - "requestType": "SqlInstancesRotateServerCaRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/rotateServerCa", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/rotateServerCa", - "body": "body" - } - } - ] - }, - "RotateServerCertificate": { - "requestType": "SqlInstancesRotateServerCertificateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/rotateServerCertificate", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/rotateServerCertificate", - "body": "body" - } - } - ] - }, - "RotateEntraIdCertificate": { - "requestType": "SqlInstancesRotateEntraIdCertificateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/rotateEntraIdCertificate", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/rotateEntraIdCertificate", - "body": "body" - } - } - ] - }, - "StartReplica": { - "requestType": "SqlInstancesStartReplicaRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/startReplica" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/startReplica" - } - } - ] - }, - "StopReplica": { - "requestType": "SqlInstancesStopReplicaRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/stopReplica" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/stopReplica" - } - } - ] - }, - "TruncateLog": { - "requestType": "SqlInstancesTruncateLogRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/truncateLog", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/truncateLog", - "body": "body" - } - } - ] - }, - "Update": { - "requestType": "SqlInstancesUpdateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).put": "/v1/projects/{project}/instances/{instance}", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "put": "/v1/projects/{project}/instances/{instance}", - "body": "body" - } - } - ] - }, - "CreateEphemeral": { - "requestType": "SqlInstancesCreateEphemeralCertRequest", - "responseType": "SslCert", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/createEphemeral", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/createEphemeral", - "body": "body" - } - } - ] - }, - "RescheduleMaintenance": { - "requestType": "SqlInstancesRescheduleMaintenanceRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/rescheduleMaintenance", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/rescheduleMaintenance", - "body": "body" - } - } - ] - }, - "VerifyExternalSyncSettings": { - "requestType": "SqlInstancesVerifyExternalSyncSettingsRequest", - "responseType": "SqlInstancesVerifyExternalSyncSettingsResponse", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/verifyExternalSyncSettings", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/verifyExternalSyncSettings", - "body": "*" - } - } - ] - }, - "StartExternalSync": { - "requestType": "SqlInstancesStartExternalSyncRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/startExternalSync", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/startExternalSync", - "body": "*" - } - } - ] - }, - "PerformDiskShrink": { - "requestType": "SqlInstancesPerformDiskShrinkRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/performDiskShrink", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/performDiskShrink", - "body": "body" - } - } - ] - }, - "GetDiskShrinkConfig": { - "requestType": "SqlInstancesGetDiskShrinkConfigRequest", - "responseType": "SqlInstancesGetDiskShrinkConfigResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/getDiskShrinkConfig" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/getDiskShrinkConfig" - } - } - ] - }, - "ResetReplicaSize": { - "requestType": "SqlInstancesResetReplicaSizeRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/resetReplicaSize", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/resetReplicaSize", - "body": "*" - } - } - ] - }, - "GetLatestRecoveryTime": { - "requestType": "SqlInstancesGetLatestRecoveryTimeRequest", - "responseType": "SqlInstancesGetLatestRecoveryTimeResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/getLatestRecoveryTime" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/getLatestRecoveryTime" - } - } - ] - }, - "ExecuteSql": { - "requestType": "SqlInstancesExecuteSqlRequest", - "responseType": "SqlInstancesExecuteSqlResponse", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/executeSql", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/executeSql", - "body": "body" - } - } - ] - }, - "AcquireSsrsLease": { - "requestType": "SqlInstancesAcquireSsrsLeaseRequest", - "responseType": "SqlInstancesAcquireSsrsLeaseResponse", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/acquireSsrsLease", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/acquireSsrsLease", - "body": "body" - } - } - ] - }, - "ReleaseSsrsLease": { - "requestType": "SqlInstancesReleaseSsrsLeaseRequest", - "responseType": "SqlInstancesReleaseSsrsLeaseResponse", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/releaseSsrsLease" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/releaseSsrsLease" - } - } - ] - }, - "PreCheckMajorVersionUpgrade": { - "requestType": "SqlInstancesPreCheckMajorVersionUpgradeRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade", - "body": "body" - } - } - ] - }, - "PointInTimeRestore": { - "requestType": "SqlInstancesPointInTimeRestoreRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/{parent=projects/*}:pointInTimeRestore", - "(google.api.http).body": "context" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/{parent=projects/*}:pointInTimeRestore", - "body": "context" - } - } - ] - } - } - }, - "SqlInstancesAddServerCaRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesAddServerCertificateRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesAddEntraIdCertificateRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesCloneRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesCloneRequest", - "id": 100, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesDeleteRequest": { - "oneofs": { - "_enableFinalBackup": { - "oneof": [ - "enableFinalBackup" - ] - }, - "expiration": { - "oneof": [ - "finalBackupTtlDays", - "finalBackupExpiryTime" - ] - } - }, - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "enableFinalBackup": { - "type": "bool", - "id": 7, - "options": { - "proto3_optional": true - } - }, - "finalBackupTtlDays": { - "type": "int64", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "finalBackupExpiryTime": { - "type": "google.protobuf.Timestamp", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "finalBackupDescription": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlInstancesDemoteMasterRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesDemoteMasterRequest", - "id": 100 - } - } - }, - "SqlInstancesDemoteRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesDemoteRequest", - "id": 100, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesExportRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesExportRequest", - "id": 100 - } - } - }, - "SqlInstancesFailoverRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesFailoverRequest", - "id": 100 - } - } - }, - "SqlInstancesGetRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesImportRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesImportRequest", - "id": 100 - } - } - }, - "SqlInstancesInsertRequest": { - "fields": { - "project": { - "type": "string", - "id": 1 - }, - "body": { - "type": "DatabaseInstance", - "id": 100 - } - } - }, - "SqlInstancesListRequest": { - "fields": { - "filter": { - "type": "string", - "id": 1 - }, - "maxResults": { - "type": "uint32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - } - } - }, - "SqlInstancesListServerCasRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesListServerCertificatesRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesListEntraIdCertificatesRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesPatchRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "DatabaseInstance", - "id": 100 - } - } - }, - "SqlInstancesPromoteReplicaRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "failover": { - "type": "bool", - "id": 3 - } - } - }, - "SqlInstancesSwitchoverRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "dbTimeout": { - "type": "google.protobuf.Duration", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlInstancesResetSslConfigRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "mode": { - "type": "ResetSslMode", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "ResetSslMode": { - "values": { - "RESET_SSL_MODE_UNSPECIFIED": 0, - "ALL": 1, - "SYNC_FROM_PRIMARY": 2 - } - } - } - }, - "SqlInstancesRestartRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesRestoreBackupRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesRestoreBackupRequest", - "id": 100 - } - } - }, - "SqlInstancesRotateServerCaRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesRotateServerCaRequest", - "id": 100 - } - } - }, - "SqlInstancesRotateServerCertificateRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesRotateServerCertificateRequest", - "id": 100, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlInstancesRotateEntraIdCertificateRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesRotateEntraIdCertificateRequest", - "id": 100, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlInstancesStartReplicaRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesStopReplicaRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesTruncateLogRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesTruncateLogRequest", - "id": 100 - } - } - }, - "SqlInstancesPerformDiskShrinkRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "PerformDiskShrinkContext", - "id": 100 - } - } - }, - "SqlInstancesUpdateRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "DatabaseInstance", - "id": 100 - } - } - }, - "SqlInstancesRescheduleMaintenanceRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "SqlInstancesRescheduleMaintenanceRequestBody", - "id": 100 - } - } - }, - "SqlInstancesReencryptRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesReencryptRequest", - "id": 3 - } - } - }, - "InstancesReencryptRequest": { - "oneofs": { - "_backupReencryptionConfig": { - "oneof": [ - "backupReencryptionConfig" - ] - } - }, - "fields": { - "backupReencryptionConfig": { - "type": "BackupReencryptionConfig", - "id": 1, - "options": { - "proto3_optional": true - } - } - } - }, - "BackupReencryptionConfig": { - "oneofs": { - "_backupLimit": { - "oneof": [ - "backupLimit" - ] - }, - "_backupType": { - "oneof": [ - "backupType" - ] - } - }, - "fields": { - "backupLimit": { - "type": "int32", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "backupType": { - "type": "BackupType", - "id": 2, - "options": { - "proto3_optional": true - } - } - }, - "nested": { - "BackupType": { - "values": { - "BACKUP_TYPE_UNSPECIFIED": 0, - "AUTOMATED": 1, - "ON_DEMAND": 2 - } - } - } - }, - "ExternalSyncParallelLevel": { - "values": { - "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": 0, - "MIN": 1, - "OPTIMAL": 2, - "MAX": 3 - } - }, - "ExternalSyncSelectedObject": { - "fields": { - "database": { - "type": "string", - "id": 1 - } - } - }, - "SqlInstancesGetDiskShrinkConfigRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesVerifyExternalSyncSettingsRequest": { - "oneofs": { - "syncConfig": { - "oneof": [ - "mysqlSyncConfig" - ] - } - }, - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "verifyConnectionOnly": { - "type": "bool", - "id": 3 - }, - "syncMode": { - "type": "ExternalSyncMode", - "id": 4 - }, - "verifyReplicationOnly": { - "type": "bool", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "mysqlSyncConfig": { - "type": "MySqlSyncConfig", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "migrationType": { - "type": "MigrationType", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "syncParallelLevel": { - "type": "ExternalSyncParallelLevel", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "selectedObjects": { - "rule": "repeated", - "type": "ExternalSyncSelectedObject", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "ExternalSyncMode": { - "values": { - "EXTERNAL_SYNC_MODE_UNSPECIFIED": 0, - "ONLINE": 1, - "OFFLINE": 2 - } - }, - "MigrationType": { - "values": { - "MIGRATION_TYPE_UNSPECIFIED": 0, - "LOGICAL": 1, - "PHYSICAL": 2 - } - } - } - }, - "SqlInstancesStartExternalSyncRequest": { - "oneofs": { - "syncConfig": { - "oneof": [ - "mysqlSyncConfig" - ] - } - }, - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "syncMode": { - "type": "SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode", - "id": 3 - }, - "skipVerification": { - "type": "bool", - "id": 4 - }, - "mysqlSyncConfig": { - "type": "MySqlSyncConfig", - "id": 6 - }, - "syncParallelLevel": { - "type": "ExternalSyncParallelLevel", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "migrationType": { - "type": "SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "replicaOverwriteEnabled": { - "type": "bool", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlInstancesResetReplicaSizeRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesCreateEphemeralCertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "SslCertsCreateEphemeralRequest", - "id": 100 - } - } - }, - "InstancesCloneRequest": { - "fields": { - "cloneContext": { - "type": "CloneContext", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "InstancesDemoteMasterRequest": { - "fields": { - "demoteMasterContext": { - "type": "DemoteMasterContext", - "id": 1 - } - } - }, - "InstancesDemoteRequest": { - "fields": { - "demoteContext": { - "type": "DemoteContext", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "InstancesExportRequest": { - "fields": { - "exportContext": { - "type": "ExportContext", - "id": 1 - } - } - }, - "InstancesFailoverRequest": { - "fields": { - "failoverContext": { - "type": "FailoverContext", - "id": 1 - } - } - }, - "SslCertsCreateEphemeralRequest": { - "fields": { - "publicKey": { - "type": "string", - "id": 1, - "options": { - "json_name": "public_key" - } - }, - "accessToken": { - "type": "string", - "id": 2, - "options": { - "json_name": "access_token" - } - } - } - }, - "InstancesImportRequest": { - "fields": { - "importContext": { - "type": "ImportContext", - "id": 1 - } - } - }, - "InstancesPreCheckMajorVersionUpgradeRequest": { - "fields": { - "preCheckMajorVersionUpgradeContext": { - "type": "PreCheckMajorVersionUpgradeContext", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "InstancesListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "warnings": { - "rule": "repeated", - "type": "ApiWarning", - "id": 2 - }, - "items": { - "rule": "repeated", - "type": "DatabaseInstance", - "id": 3 - }, - "nextPageToken": { - "type": "string", - "id": 4 - } - } - }, - "InstancesListServerCasResponse": { - "fields": { - "certs": { - "rule": "repeated", - "type": "SslCert", - "id": 1 - }, - "activeVersion": { - "type": "string", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - } - } - }, - "InstancesListServerCertificatesResponse": { - "fields": { - "caCerts": { - "rule": "repeated", - "type": "SslCert", - "id": 1 - }, - "serverCerts": { - "rule": "repeated", - "type": "SslCert", - "id": 2 - }, - "activeVersion": { - "type": "string", - "id": 3 - }, - "kind": { - "type": "string", - "id": 4 - } - } - }, - "InstancesListEntraIdCertificatesResponse": { - "fields": { - "certs": { - "rule": "repeated", - "type": "SslCert", - "id": 1 - }, - "activeVersion": { - "type": "string", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - } - } - }, - "InstancesRestoreBackupRequest": { - "fields": { - "restoreBackupContext": { - "type": "RestoreBackupContext", - "id": 1 - }, - "backup": { - "type": "string", - "id": 2, - "options": { - "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" - } - }, - "backupdrBackup": { - "type": "string", - "id": 4, - "options": { - "(google.api.resource_reference).type": "backupdr.googleapis.com/Backup" - } - }, - "restoreInstanceSettings": { - "type": "DatabaseInstance", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "restoreInstanceClearOverridesFieldNames": { - "rule": "repeated", - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "InstancesRotateServerCaRequest": { - "fields": { - "rotateServerCaContext": { - "type": "RotateServerCaContext", - "id": 1 - } - } - }, - "InstancesRotateServerCertificateRequest": { - "fields": { - "rotateServerCertificateContext": { - "type": "RotateServerCertificateContext", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "InstancesRotateEntraIdCertificateRequest": { - "fields": { - "rotateEntraIdCertificateContext": { - "type": "RotateEntraIdCertificateContext", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "InstancesTruncateLogRequest": { - "fields": { - "truncateLogContext": { - "type": "TruncateLogContext", - "id": 1 - } - } - }, - "InstancesAcquireSsrsLeaseRequest": { - "fields": { - "acquireSsrsLeaseContext": { - "type": "AcquireSsrsLeaseContext", - "id": 1 - } - } - }, - "SqlInstancesPreCheckMajorVersionUpgradeRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesPreCheckMajorVersionUpgradeRequest", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesVerifyExternalSyncSettingsResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "errors": { - "rule": "repeated", - "type": "SqlExternalSyncSettingError", - "id": 2 - }, - "warnings": { - "rule": "repeated", - "type": "SqlExternalSyncSettingError", - "id": 3 - } - } - }, - "SqlInstancesGetDiskShrinkConfigResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "minimalTargetSizeGb": { - "type": "int64", - "id": 2 - }, - "message": { - "type": "string", - "id": 3 - } - } - }, - "SqlInstancesGetLatestRecoveryTimeRequest": { - "oneofs": { - "_sourceInstanceDeletionTime": { - "oneof": [ - "sourceInstanceDeletionTime" - ] - } - }, - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "sourceInstanceDeletionTime": { - "type": "google.protobuf.Timestamp", - "id": 3, - "options": { - "proto3_optional": true - } - } - } - }, - "SqlInstancesGetLatestRecoveryTimeResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "latestRecoveryTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "earliestRecoveryTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - } - } - }, - "CloneContext": { - "oneofs": { - "_preferredZone": { - "oneof": [ - "preferredZone" - ] - }, - "_preferredSecondaryZone": { - "oneof": [ - "preferredSecondaryZone" - ] - }, - "_sourceInstanceDeletionTime": { - "oneof": [ - "sourceInstanceDeletionTime" - ] - }, - "_destinationProject": { - "oneof": [ - "destinationProject" - ] - }, - "_destinationNetwork": { - "oneof": [ - "destinationNetwork" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "pitrTimestampMs": { - "type": "int64", - "id": 2 - }, - "destinationInstanceName": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "binLogCoordinates": { - "type": "BinLogCoordinates", - "id": 4 - }, - "pointInTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "allocatedIpRange": { - "type": "string", - "id": 6 - }, - "databaseNames": { - "rule": "repeated", - "type": "string", - "id": 9 - }, - "preferredZone": { - "type": "string", - "id": 10, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "preferredSecondaryZone": { - "type": "string", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "sourceInstanceDeletionTime": { - "type": "google.protobuf.Timestamp", - "id": 12, - "options": { - "proto3_optional": true - } - }, - "destinationProject": { - "type": "string", - "id": 13, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "destinationNetwork": { - "type": "string", - "id": 14, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "(google.api.resource_reference).type": "compute.googleapis.com/Network", - "proto3_optional": true - } - } - } - }, - "PointInTimeRestoreContext": { - "oneofs": { - "_datasource": { - "oneof": [ - "datasource" - ] - }, - "_targetInstance": { - "oneof": [ - "targetInstance" - ] - }, - "_privateNetwork": { - "oneof": [ - "privateNetwork" - ] - }, - "_allocatedIpRange": { - "oneof": [ - "allocatedIpRange" - ] - }, - "_preferredZone": { - "oneof": [ - "preferredZone" - ] - }, - "_preferredSecondaryZone": { - "oneof": [ - "preferredSecondaryZone" - ] - }, - "_region": { - "oneof": [ - "region" - ] - } - }, - "fields": { - "datasource": { - "type": "string", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "pointInTime": { - "type": "google.protobuf.Timestamp", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "targetInstance": { - "type": "string", - "id": 3, - "options": { - "proto3_optional": true - } - }, - "privateNetwork": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "allocatedIpRange": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "preferredZone": { - "type": "string", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "preferredSecondaryZone": { - "type": "string", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "targetInstanceSettings": { - "type": "DatabaseInstance", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "targetInstanceClearSettingsFieldNames": { - "rule": "repeated", - "type": "string", - "id": 12, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "region": { - "type": "string", - "id": 13, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - } - } - }, - "BinLogCoordinates": { - "fields": { - "binLogFileName": { - "type": "string", - "id": 1 - }, - "binLogPosition": { - "type": "int64", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - } - } - }, - "DatabaseInstance": { - "oneofs": { - "_outOfDiskReport": { - "oneof": [ - "outOfDiskReport" - ] - }, - "_sqlNetworkArchitecture": { - "oneof": [ - "sqlNetworkArchitecture" - ] - }, - "_pscServiceAttachmentLink": { - "oneof": [ - "pscServiceAttachmentLink" - ] - }, - "_dnsName": { - "oneof": [ - "dnsName" - ] - }, - "_primaryDnsName": { - "oneof": [ - "primaryDnsName" - ] - }, - "_writeEndpoint": { - "oneof": [ - "writeEndpoint" - ] - }, - "_geminiConfig": { - "oneof": [ - "geminiConfig" - ] - }, - "_switchTransactionLogsToCloudStorageEnabled": { - "oneof": [ - "switchTransactionLogsToCloudStorageEnabled" - ] - }, - "_includeReplicasForMajorVersionUpgrade": { - "oneof": [ - "includeReplicasForMajorVersionUpgrade" - ] - }, - "_nodeCount": { - "oneof": [ - "nodeCount" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "state": { - "type": "SqlInstanceState", - "id": 2 - }, - "databaseVersion": { - "type": "SqlDatabaseVersion", - "id": 3 - }, - "settings": { - "type": "Settings", - "id": 4 - }, - "etag": { - "type": "string", - "id": 5 - }, - "failoverReplica": { - "type": "SqlFailoverReplica", - "id": 6 - }, - "masterInstanceName": { - "type": "string", - "id": 7 - }, - "replicaNames": { - "rule": "repeated", - "type": "string", - "id": 8 - }, - "maxDiskSize": { - "type": "google.protobuf.Int64Value", - "id": 9, - "options": { - "deprecated": true - } - }, - "currentDiskSize": { - "type": "google.protobuf.Int64Value", - "id": 10, - "options": { - "deprecated": true - } - }, - "ipAddresses": { - "rule": "repeated", - "type": "IpMapping", - "id": 11 - }, - "serverCaCert": { - "type": "SslCert", - "id": 12 - }, - "instanceType": { - "type": "SqlInstanceType", - "id": 13 - }, - "project": { - "type": "string", - "id": 14 - }, - "ipv6Address": { - "type": "string", - "id": 15, - "options": { - "deprecated": true - } - }, - "serviceAccountEmailAddress": { - "type": "string", - "id": 16 - }, - "onPremisesConfiguration": { - "type": "OnPremisesConfiguration", - "id": 17 - }, - "replicaConfiguration": { - "type": "ReplicaConfiguration", - "id": 18 - }, - "backendType": { - "type": "SqlBackendType", - "id": 19 - }, - "selfLink": { - "type": "string", - "id": 20 - }, - "suspensionReason": { - "rule": "repeated", - "type": "SqlSuspensionReason", - "id": 21 - }, - "connectionName": { - "type": "string", - "id": 22 - }, - "name": { - "type": "string", - "id": 23 - }, - "region": { - "type": "string", - "id": 24 - }, - "gceZone": { - "type": "string", - "id": 25 - }, - "secondaryGceZone": { - "type": "string", - "id": 34 - }, - "diskEncryptionConfiguration": { - "type": "DiskEncryptionConfiguration", - "id": 26 - }, - "diskEncryptionStatus": { - "type": "DiskEncryptionStatus", - "id": 27 - }, - "rootPassword": { - "type": "string", - "id": 29 - }, - "scheduledMaintenance": { - "type": "SqlScheduledMaintenance", - "id": 30 - }, - "satisfiesPzs": { - "type": "google.protobuf.BoolValue", - "id": 35 - }, - "databaseInstalledVersion": { - "type": "string", - "id": 40, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "outOfDiskReport": { - "type": "SqlOutOfDiskReport", - "id": 38, - "options": { - "proto3_optional": true - } - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 39, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "availableMaintenanceVersions": { - "rule": "repeated", - "type": "string", - "id": 41, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "maintenanceVersion": { - "type": "string", - "id": 42 - }, - "upgradableDatabaseVersions": { - "rule": "repeated", - "type": "AvailableDatabaseVersion", - "id": 45, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "sqlNetworkArchitecture": { - "type": "SqlNetworkArchitecture", - "id": 47, - "options": { - "proto3_optional": true - } - }, - "pscServiceAttachmentLink": { - "type": "string", - "id": 48, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "dnsName": { - "type": "string", - "id": 49, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "primaryDnsName": { - "type": "string", - "id": 51, - "options": { - "deprecated": true, - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "writeEndpoint": { - "type": "string", - "id": 52, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "replicationCluster": { - "type": "ReplicationCluster", - "id": 54, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "geminiConfig": { - "type": "GeminiInstanceConfig", - "id": 55, - "options": { - "proto3_optional": true - } - }, - "satisfiesPzi": { - "type": "google.protobuf.BoolValue", - "id": 56, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "switchTransactionLogsToCloudStorageEnabled": { - "type": "google.protobuf.BoolValue", - "id": 57, - "options": { - "(google.api.field_behavior)": "INPUT_ONLY", - "proto3_optional": true - } - }, - "includeReplicasForMajorVersionUpgrade": { - "type": "google.protobuf.BoolValue", - "id": 59, - "options": { - "(google.api.field_behavior)": "INPUT_ONLY", - "proto3_optional": true - } - }, - "tags": { - "keyType": "string", - "type": "string", - "id": 60, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "nodeCount": { - "type": "int32", - "id": 63, - "options": { - "proto3_optional": true - } - }, - "nodes": { - "rule": "repeated", - "type": "PoolNodeConfig", - "id": 64, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "dnsNames": { - "rule": "repeated", - "type": "DnsNameMapping", - "id": 67, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - }, - "nested": { - "SqlInstanceState": { - "valuesOptions": { - "ONLINE_MAINTENANCE": { - "deprecated": true - } - }, - "values": { - "SQL_INSTANCE_STATE_UNSPECIFIED": 0, - "RUNNABLE": 1, - "SUSPENDED": 2, - "PENDING_DELETE": 3, - "PENDING_CREATE": 4, - "MAINTENANCE": 5, - "FAILED": 6, - "ONLINE_MAINTENANCE": 7, - "REPAIRING": 8 - } - }, - "SqlFailoverReplica": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "available": { - "type": "google.protobuf.BoolValue", - "id": 2 - } - } - }, - "SqlScheduledMaintenance": { - "oneofs": { - "_scheduleDeadlineTime": { - "oneof": [ - "scheduleDeadlineTime" - ] - } - }, - "fields": { - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 1 - }, - "canDefer": { - "type": "bool", - "id": 2, - "options": { - "deprecated": true - } - }, - "canReschedule": { - "type": "bool", - "id": 3 - }, - "scheduleDeadlineTime": { - "type": "google.protobuf.Timestamp", - "id": 4, - "options": { - "proto3_optional": true - } - } - } - }, - "SqlOutOfDiskReport": { - "oneofs": { - "_sqlOutOfDiskState": { - "oneof": [ - "sqlOutOfDiskState" - ] - }, - "_sqlMinRecommendedIncreaseSizeGb": { - "oneof": [ - "sqlMinRecommendedIncreaseSizeGb" - ] - } - }, - "fields": { - "sqlOutOfDiskState": { - "type": "SqlOutOfDiskState", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "sqlMinRecommendedIncreaseSizeGb": { - "type": "int32", - "id": 2, - "options": { - "proto3_optional": true - } - } - }, - "nested": { - "SqlOutOfDiskState": { - "values": { - "SQL_OUT_OF_DISK_STATE_UNSPECIFIED": 0, - "NORMAL": 1, - "SOFT_SHUTDOWN": 2 - } - } - } - }, - "SqlNetworkArchitecture": { - "values": { - "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED": 0, - "NEW_NETWORK_ARCHITECTURE": 1, - "OLD_NETWORK_ARCHITECTURE": 2 - } - }, - "PoolNodeConfig": { - "oneofs": { - "_name": { - "oneof": [ - "name" - ] - }, - "_gceZone": { - "oneof": [ - "gceZone" - ] - }, - "_dnsName": { - "oneof": [ - "dnsName" - ] - }, - "_state": { - "oneof": [ - "state" - ] - }, - "_pscServiceAttachmentLink": { - "oneof": [ - "pscServiceAttachmentLink" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "gceZone": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "ipAddresses": { - "rule": "repeated", - "type": "IpMapping", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "dnsName": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "state": { - "type": "SqlInstanceState", - "id": 5, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "dnsNames": { - "rule": "repeated", - "type": "DnsNameMapping", - "id": 6, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "pscServiceAttachmentLink": { - "type": "string", - "id": 7, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "pscAutoConnections": { - "rule": "repeated", - "type": "PscAutoConnectionConfig", - "id": 8, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - } - } - }, - "GeminiInstanceConfig": { - "oneofs": { - "_entitled": { - "oneof": [ - "entitled" - ] - }, - "_googleVacuumMgmtEnabled": { - "oneof": [ - "googleVacuumMgmtEnabled" - ] - }, - "_oomSessionCancelEnabled": { - "oneof": [ - "oomSessionCancelEnabled" - ] - }, - "_activeQueryEnabled": { - "oneof": [ - "activeQueryEnabled" - ] - }, - "_indexAdvisorEnabled": { - "oneof": [ - "indexAdvisorEnabled" - ] - }, - "_flagRecommenderEnabled": { - "oneof": [ - "flagRecommenderEnabled" - ] - } - }, - "fields": { - "entitled": { - "type": "bool", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "googleVacuumMgmtEnabled": { - "type": "bool", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "oomSessionCancelEnabled": { - "type": "bool", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "activeQueryEnabled": { - "type": "bool", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "indexAdvisorEnabled": { - "type": "bool", - "id": 5, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "flagRecommenderEnabled": { - "type": "bool", - "id": 6, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - } - } - }, - "ReplicationCluster": { - "fields": { - "psaWriteEndpoint": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "failoverDrReplicaName": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "drReplica": { - "type": "bool", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "AvailableDatabaseVersion": { - "oneofs": { - "_majorVersion": { - "oneof": [ - "majorVersion" - ] - }, - "_name": { - "oneof": [ - "name" - ] - }, - "_displayName": { - "oneof": [ - "displayName" - ] - } - }, - "fields": { - "majorVersion": { - "type": "string", - "id": 3, - "options": { - "proto3_optional": true - } - }, - "name": { - "type": "string", - "id": 8, - "options": { - "proto3_optional": true - } - }, - "displayName": { - "type": "string", - "id": 9, - "options": { - "proto3_optional": true - } - } - } - }, - "SqlInstancesRescheduleMaintenanceRequestBody": { - "fields": { - "reschedule": { - "type": "Reschedule", - "id": 3 - } - }, - "nested": { - "RescheduleType": { - "values": { - "RESCHEDULE_TYPE_UNSPECIFIED": 0, - "IMMEDIATE": 1, - "NEXT_AVAILABLE_WINDOW": 2, - "SPECIFIC_TIME": 3 - } - }, - "Reschedule": { - "fields": { - "rescheduleType": { - "type": "RescheduleType", - "id": 1 - }, - "scheduleTime": { - "type": "google.protobuf.Timestamp", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - } - } - }, - "DemoteMasterContext": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "verifyGtidConsistency": { - "type": "google.protobuf.BoolValue", - "id": 2 - }, - "masterInstanceName": { - "type": "string", - "id": 3 - }, - "replicaConfiguration": { - "type": "DemoteMasterConfiguration", - "id": 4 - }, - "skipReplicationSetup": { - "type": "bool", - "id": 5 - } - } - }, - "DemoteContext": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "sourceRepresentativeInstanceName": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "FailoverContext": { - "fields": { - "settingsVersion": { - "type": "int64", - "id": 1 - }, - "kind": { - "type": "string", - "id": 2 - } - } - }, - "RestoreBackupContext": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "backupRunId": { - "type": "int64", - "id": 2 - }, - "instanceId": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - } - } - }, - "RotateServerCaContext": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "nextVersion": { - "type": "string", - "id": 2 - } - } - }, - "RotateServerCertificateContext": { - "fields": { - "kind": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "nextVersion": { - "type": "string", - "id": 2 - } - } - }, - "RotateEntraIdCertificateContext": { - "fields": { - "kind": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "nextVersion": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "TruncateLogContext": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "logType": { - "type": "string", - "id": 2 - } - } - }, - "SqlExternalSyncSettingError": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "type": { - "type": "SqlExternalSyncSettingErrorType", - "id": 2 - }, - "detail": { - "type": "string", - "id": 3 - } - }, - "nested": { - "SqlExternalSyncSettingErrorType": { - "values": { - "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED": 0, - "CONNECTION_FAILURE": 1, - "BINLOG_NOT_ENABLED": 2, - "INCOMPATIBLE_DATABASE_VERSION": 3, - "REPLICA_ALREADY_SETUP": 4, - "INSUFFICIENT_PRIVILEGE": 5, - "UNSUPPORTED_MIGRATION_TYPE": 6, - "NO_PGLOGICAL_INSTALLED": 7, - "PGLOGICAL_NODE_ALREADY_EXISTS": 8, - "INVALID_WAL_LEVEL": 9, - "INVALID_SHARED_PRELOAD_LIBRARY": 10, - "INSUFFICIENT_MAX_REPLICATION_SLOTS": 11, - "INSUFFICIENT_MAX_WAL_SENDERS": 12, - "INSUFFICIENT_MAX_WORKER_PROCESSES": 13, - "UNSUPPORTED_EXTENSIONS": 14, - "INVALID_RDS_LOGICAL_REPLICATION": 15, - "INVALID_LOGGING_SETUP": 16, - "INVALID_DB_PARAM": 17, - "UNSUPPORTED_GTID_MODE": 18, - "SQLSERVER_AGENT_NOT_RUNNING": 19, - "UNSUPPORTED_TABLE_DEFINITION": 20, - "UNSUPPORTED_DEFINER": 21, - "SQLSERVER_SERVERNAME_MISMATCH": 22, - "PRIMARY_ALREADY_SETUP": 23, - "UNSUPPORTED_BINLOG_FORMAT": 24, - "BINLOG_RETENTION_SETTING": 25, - "UNSUPPORTED_STORAGE_ENGINE": 26, - "LIMITED_SUPPORT_TABLES": 27, - "EXISTING_DATA_IN_REPLICA": 28, - "MISSING_OPTIONAL_PRIVILEGES": 29, - "RISKY_BACKUP_ADMIN_PRIVILEGE": 30, - "INSUFFICIENT_GCS_PERMISSIONS": 31, - "INVALID_FILE_INFO": 32, - "UNSUPPORTED_DATABASE_SETTINGS": 33, - "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE": 34, - "LOCAL_INFILE_OFF": 35, - "TURN_ON_PITR_AFTER_PROMOTE": 36, - "INCOMPATIBLE_DATABASE_MINOR_VERSION": 37, - "SOURCE_MAX_SUBSCRIPTIONS": 38, - "UNABLE_TO_VERIFY_DEFINERS": 39, - "SUBSCRIPTION_CALCULATION_STATUS": 40, - "PG_SUBSCRIPTION_COUNT": 41, - "PG_SYNC_PARALLEL_LEVEL": 42, - "INSUFFICIENT_DISK_SIZE": 43, - "INSUFFICIENT_MACHINE_TIER": 44, - "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED": 45, - "EXTENSIONS_NOT_MIGRATED": 46, - "PG_CRON_FLAG_ENABLED_IN_REPLICA": 47, - "EXTENSIONS_NOT_ENABLED_IN_REPLICA": 48, - "UNSUPPORTED_COLUMNS": 49, - "USERS_NOT_CREATED_IN_REPLICA": 50, - "UNSUPPORTED_SYSTEM_OBJECTS": 51, - "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY": 52, - "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE": 53, - "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI": 54, - "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS": 55, - "PROMPT_DELETE_EXISTING": 56, - "WILL_DELETE_EXISTING": 57, - "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE": 58 - } - } - } - }, - "SelectedObjects": { - "fields": { - "database": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "OnPremisesConfiguration": { - "fields": { - "hostPort": { - "type": "string", - "id": 1 - }, - "kind": { - "type": "string", - "id": 2 - }, - "username": { - "type": "string", - "id": 3 - }, - "password": { - "type": "string", - "id": 4 - }, - "caCertificate": { - "type": "string", - "id": 5 - }, - "clientCertificate": { - "type": "string", - "id": 6 - }, - "clientKey": { - "type": "string", - "id": 7 - }, - "dumpFilePath": { - "type": "string", - "id": 8 - }, - "sourceInstance": { - "type": "InstanceReference", - "id": 15 - }, - "selectedObjects": { - "rule": "repeated", - "type": "SelectedObjects", - "id": 16, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "sslOption": { - "type": "SslOption", - "id": 18, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SslOption": { - "values": { - "SSL_OPTION_UNSPECIFIED": 0, - "DISABLE": 1, - "REQUIRE": 2, - "VERIFY_CA": 3 - } - } - } - }, - "ReplicaConfiguration": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "mysqlReplicaConfiguration": { - "type": "MySqlReplicaConfiguration", - "id": 2 - }, - "failoverTarget": { - "type": "google.protobuf.BoolValue", - "id": 3 - }, - "cascadableReplica": { - "type": "google.protobuf.BoolValue", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlInstancesExecuteSqlRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "ExecuteSqlPayload", - "id": 100 - } - } - }, - "ExecuteSqlPayload": { - "oneofs": { - "userPassword": { - "oneof": [ - "autoIamAuthn" - ] - } - }, - "fields": { - "user": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "sqlStatement": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "database": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "autoIamAuthn": { - "type": "bool", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "rowLimit": { - "type": "int64", - "id": 10, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "partialResultMode": { - "type": "PartialResultMode", - "id": 13, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "application": { - "type": "string", - "id": 16, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "PartialResultMode": { - "values": { - "PARTIAL_RESULT_MODE_UNSPECIFIED": 0, - "FAIL_PARTIAL_RESULT": 1, - "ALLOW_PARTIAL_RESULT": 2 - } - } - } - }, - "SqlInstancesExecuteSqlResponse": { - "fields": { - "messages": { - "rule": "repeated", - "type": "Message", - "id": 9 - }, - "metadata": { - "type": "Metadata", - "id": 6 - }, - "results": { - "rule": "repeated", - "type": "QueryResult", - "id": 7 - }, - "status": { - "type": "google.rpc.Status", - "id": 8 - } - }, - "nested": { - "Message": { - "oneofs": { - "_message": { - "oneof": [ - "message" - ] - }, - "_severity": { - "oneof": [ - "severity" - ] - } - }, - "fields": { - "message": { - "type": "string", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "severity": { - "type": "string", - "id": 2, - "options": { - "proto3_optional": true - } - } - } - } - } - }, - "QueryResult": { - "fields": { - "columns": { - "rule": "repeated", - "type": "Column", - "id": 1 - }, - "rows": { - "rule": "repeated", - "type": "Row", - "id": 2 - }, - "message": { - "type": "string", - "id": 3 - }, - "partialResult": { - "type": "bool", - "id": 4 - }, - "status": { - "type": "google.rpc.Status", - "id": 8 - } - } - }, - "Column": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "type": { - "type": "string", - "id": 2 - } - } - }, - "Row": { - "fields": { - "values": { - "rule": "repeated", - "type": "Value", - "id": 1 - } - } - }, - "Value": { - "fields": { - "value": { - "type": "string", - "id": 1 - }, - "nullValue": { - "type": "bool", - "id": 2 - } - } - }, - "Metadata": { - "fields": { - "sqlStatementExecutionTime": { - "type": "google.protobuf.Duration", - "id": 1 - } - } - }, - "SqlInstancesAcquireSsrsLeaseRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesAcquireSsrsLeaseRequest", - "id": 100, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesAcquireSsrsLeaseResponse": { - "fields": { - "operationId": { - "type": "string", - "id": 1 - } - } - }, - "SqlInstancesReleaseSsrsLeaseRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesReleaseSsrsLeaseResponse": { - "fields": { - "operationId": { - "type": "string", - "id": 1 - } - } - }, - "SqlInstancesPointInTimeRestoreRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "context": { - "type": "PointInTimeRestoreContext", - "id": 100, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstanceType": { - "values": { - "SQL_INSTANCE_TYPE_UNSPECIFIED": 0, - "CLOUD_SQL_INSTANCE": 1, - "ON_PREMISES_INSTANCE": 2, - "READ_REPLICA_INSTANCE": 3, - "READ_POOL_INSTANCE": 5 - } - }, - "SqlSuspensionReason": { - "values": { - "SQL_SUSPENSION_REASON_UNSPECIFIED": 0, - "BILLING_ISSUE": 2, - "LEGAL_ISSUE": 3, - "OPERATIONAL_ISSUE": 4, - "KMS_KEY_ISSUE": 5, - "PROJECT_ABUSE": 8 - } - }, - "SqlConnectService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "GetConnectSettings": { - "requestType": "GetConnectSettingsRequest", - "responseType": "ConnectSettings", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/connectSettings" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/connectSettings" - } - } - ] - }, - "GenerateEphemeralCert": { - "requestType": "GenerateEphemeralCertRequest", - "responseType": "GenerateEphemeralCertResponse", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}:generateEphemeralCert", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}:generateEphemeralCert", - "body": "*" - } - } - ] - } - } - }, - "GetConnectSettingsRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "readTime": { - "type": "google.protobuf.Timestamp", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ConnectSettings": { - "oneofs": { - "_nodeCount": { - "oneof": [ - "nodeCount" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "serverCaCert": { - "type": "SslCert", - "id": 2 - }, - "ipAddresses": { - "rule": "repeated", - "type": "IpMapping", - "id": 3 - }, - "region": { - "type": "string", - "id": 4 - }, - "databaseVersion": { - "type": "SqlDatabaseVersion", - "id": 31 - }, - "backendType": { - "type": "SqlBackendType", - "id": 32 - }, - "pscEnabled": { - "type": "bool", - "id": 33 - }, - "dnsName": { - "type": "string", - "id": 34 - }, - "serverCaMode": { - "type": "CaMode", - "id": 35 - }, - "customSubjectAlternativeNames": { - "rule": "repeated", - "type": "string", - "id": 37 - }, - "dnsNames": { - "rule": "repeated", - "type": "DnsNameMapping", - "id": 38, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "nodeCount": { - "type": "int32", - "id": 63, - "options": { - "proto3_optional": true - } - }, - "nodes": { - "rule": "repeated", - "type": "ConnectPoolNodeConfig", - "id": 64, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "mdxProtocolSupport": { - "rule": "repeated", - "type": "MdxProtocolSupport", - "id": 39, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "CaMode": { - "values": { - "CA_MODE_UNSPECIFIED": 0, - "GOOGLE_MANAGED_INTERNAL_CA": 1, - "GOOGLE_MANAGED_CAS_CA": 2, - "CUSTOMER_MANAGED_CAS_CA": 3 - } - }, - "ConnectPoolNodeConfig": { - "oneofs": { - "_name": { - "oneof": [ - "name" - ] - }, - "_dnsName": { - "oneof": [ - "dnsName" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "ipAddresses": { - "rule": "repeated", - "type": "IpMapping", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "dnsName": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "dnsNames": { - "rule": "repeated", - "type": "DnsNameMapping", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "MdxProtocolSupport": { - "values": { - "MDX_PROTOCOL_SUPPORT_UNSPECIFIED": 0, - "CLIENT_PROTOCOL_TYPE": 1 - } - } - } - }, - "GenerateEphemeralCertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "publicKey": { - "type": "string", - "id": 3, - "options": { - "json_name": "public_key" - } - }, - "accessToken": { - "type": "string", - "id": 4, - "options": { - "json_name": "access_token", - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "readTime": { - "type": "google.protobuf.Timestamp", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "validDuration": { - "type": "google.protobuf.Duration", - "id": 12, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "GenerateEphemeralCertResponse": { - "fields": { - "ephemeralCert": { - "type": "SslCert", - "id": 1 - } - } - }, - "SqlDatabasesService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "Delete": { - "requestType": "SqlDatabasesDeleteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/v1/projects/{project}/instances/{instance}/databases/{database}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/projects/{project}/instances/{instance}/databases/{database}" - } - } - ] - }, - "Get": { - "requestType": "SqlDatabasesGetRequest", - "responseType": "Database", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/databases/{database}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/databases/{database}" - } - } - ] - }, - "Insert": { - "requestType": "SqlDatabasesInsertRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/databases", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/databases", - "body": "body" - } - } - ] - }, - "List": { - "requestType": "SqlDatabasesListRequest", - "responseType": "DatabasesListResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/databases" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/databases" - } - } - ] - }, - "Patch": { - "requestType": "SqlDatabasesUpdateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).patch": "/v1/projects/{project}/instances/{instance}/databases/{database}", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/v1/projects/{project}/instances/{instance}/databases/{database}", - "body": "body" - } - } - ] - }, - "Update": { - "requestType": "SqlDatabasesUpdateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).put": "/v1/projects/{project}/instances/{instance}/databases/{database}", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "put": "/v1/projects/{project}/instances/{instance}/databases/{database}", - "body": "body" - } - } - ] - } - } - }, - "SqlDatabasesDeleteRequest": { - "fields": { - "database": { - "type": "string", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - } - } - }, - "SqlDatabasesGetRequest": { - "fields": { - "database": { - "type": "string", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - } - } - }, - "SqlDatabasesInsertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "Database", - "id": 100 - } - } - }, - "SqlDatabasesListRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlDatabasesUpdateRequest": { - "fields": { - "database": { - "type": "string", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - }, - "body": { - "type": "Database", - "id": 100 - } - } - }, - "DatabasesListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "Database", - "id": 2 - } - } - }, - "SqlEventsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com" - }, - "methods": {} - }, - "SqlFeatureEligibilityService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com" - }, - "methods": {} - }, - "SqlFlagsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "List": { - "requestType": "SqlFlagsListRequest", - "responseType": "FlagsListResponse", - "options": { - "(google.api.http).get": "/v1/flags" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/flags" - } - } - ] - } - } - }, - "SqlFlagsListRequest": { - "oneofs": { - "_flagScope": { - "oneof": [ - "flagScope" - ] - } - }, - "fields": { - "databaseVersion": { - "type": "string", - "id": 1 - }, - "flagScope": { - "type": "SqlFlagScope", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - } - } - }, - "FlagsListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "Flag", - "id": 2 - } - } - }, - "Flag": { - "oneofs": { - "recommendedValue": { - "oneof": [ - "recommendedStringValue", - "recommendedIntValue" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "type": { - "type": "SqlFlagType", - "id": 2 - }, - "appliesTo": { - "rule": "repeated", - "type": "SqlDatabaseVersion", - "id": 3 - }, - "allowedStringValues": { - "rule": "repeated", - "type": "string", - "id": 4 - }, - "minValue": { - "type": "google.protobuf.Int64Value", - "id": 5 - }, - "maxValue": { - "type": "google.protobuf.Int64Value", - "id": 6 - }, - "requiresRestart": { - "type": "google.protobuf.BoolValue", - "id": 7 - }, - "kind": { - "type": "string", - "id": 8 - }, - "inBeta": { - "type": "google.protobuf.BoolValue", - "id": 9 - }, - "allowedIntValues": { - "rule": "repeated", - "type": "int64", - "id": 10 - }, - "flagScope": { - "type": "SqlFlagScope", - "id": 15 - }, - "recommendedStringValue": { - "type": "string", - "id": 16 - }, - "recommendedIntValue": { - "type": "google.protobuf.Int64Value", - "id": 17 - } - } - }, - "SqlFlagType": { - "values": { - "SQL_FLAG_TYPE_UNSPECIFIED": 0, - "BOOLEAN": 1, - "STRING": 2, - "INTEGER": 3, - "NONE": 4, - "MYSQL_TIMEZONE_OFFSET": 5, - "FLOAT": 6, - "REPEATED_STRING": 7 - } - }, - "SqlFlagScope": { - "values": { - "SQL_FLAG_SCOPE_UNSPECIFIED": 0, - "SQL_FLAG_SCOPE_DATABASE": 1, - "SQL_FLAG_SCOPE_CONNECTION_POOL": 2 - } - }, - "SqlIamPoliciesService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com" - }, - "methods": {} - }, - "SqlInstanceNamesService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com" - }, - "methods": {} - }, - "SqlOperationsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "Get": { - "requestType": "SqlOperationsGetRequest", - "responseType": "Operation", - "options": { - "(google.api.http).get": "/v1/projects/{project}/operations/{operation}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/operations/{operation}" - } - } - ] - }, - "List": { - "requestType": "SqlOperationsListRequest", - "responseType": "OperationsListResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/operations" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/operations" - } - } - ] - }, - "Cancel": { - "requestType": "SqlOperationsCancelRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/v1/projects/{project}/operations/{operation}/cancel" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/operations/{operation}/cancel" - } - } - ] - } - } - }, - "SqlOperationsGetRequest": { - "fields": { - "operation": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlOperationsListRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "maxResults": { - "type": "uint32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - } - } - }, - "OperationsListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "Operation", - "id": 2 - }, - "nextPageToken": { - "type": "string", - "id": 3 - } - } - }, - "SqlOperationsCancelRequest": { - "fields": { - "operation": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlRegionsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com" - }, - "methods": {} - }, - "SqlSslCertsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "Delete": { - "requestType": "SqlSslCertsDeleteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - } - } - ] - }, - "Get": { - "requestType": "SqlSslCertsGetRequest", - "responseType": "SslCert", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - } - } - ] - }, - "Insert": { - "requestType": "SqlSslCertsInsertRequest", - "responseType": "SslCertsInsertResponse", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/sslCerts", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/sslCerts", - "body": "body" - } - } - ] - }, - "List": { - "requestType": "SqlSslCertsListRequest", - "responseType": "SslCertsListResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/sslCerts" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/sslCerts" - } - } - ] - } - } - }, - "SqlSslCertsDeleteRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "sha1Fingerprint": { - "type": "string", - "id": 3 - } - } - }, - "SqlSslCertsGetRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "sha1Fingerprint": { - "type": "string", - "id": 3 - } - } - }, - "SqlSslCertsInsertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "SslCertsInsertRequest", - "id": 100 - } - } - }, - "SqlSslCertsListRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SslCertsInsertRequest": { - "fields": { - "commonName": { - "type": "string", - "id": 1 - } - } - }, - "SslCertsInsertResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "operation": { - "type": "Operation", - "id": 2 - }, - "serverCaCert": { - "type": "SslCert", - "id": 3 - }, - "clientCert": { - "type": "SslCertDetail", - "id": 4 - } - } - }, - "SslCertsListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "SslCert", - "id": 2 - } - } - }, - "SqlTiersService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "List": { - "requestType": "SqlTiersListRequest", - "responseType": "TiersListResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/tiers" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/tiers" - } - } - ] - } - } - }, - "SqlTiersListRequest": { - "fields": { - "project": { - "type": "string", - "id": 1 - } - } - }, - "TiersListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "Tier", - "id": 2 - } - } - }, - "Tier": { - "fields": { - "tier": { - "type": "string", - "id": 1 - }, - "RAM": { - "type": "int64", - "id": 2, - "options": { - "json_name": "RAM" - } - }, - "kind": { - "type": "string", - "id": 3 - }, - "Disk_Quota": { - "type": "int64", - "id": 4, - "options": { - "json_name": "DiskQuota" - } - }, - "region": { - "rule": "repeated", - "type": "string", - "id": 5 - } - } - }, - "SqlUsersService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "Delete": { - "requestType": "SqlUsersDeleteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/v1/projects/{project}/instances/{instance}/users" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/v1/projects/{project}/instances/{instance}/users" - } - } - ] - }, - "Get": { - "requestType": "SqlUsersGetRequest", - "responseType": "User", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/users/{name}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/users/{name}" - } - } - ] - }, - "Insert": { - "requestType": "SqlUsersInsertRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/v1/projects/{project}/instances/{instance}/users", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/v1/projects/{project}/instances/{instance}/users", - "body": "body" - } - } - ] - }, - "List": { - "requestType": "SqlUsersListRequest", - "responseType": "UsersListResponse", - "options": { - "(google.api.http).get": "/v1/projects/{project}/instances/{instance}/users" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/v1/projects/{project}/instances/{instance}/users" - } - } - ] - }, - "Update": { - "requestType": "SqlUsersUpdateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).put": "/v1/projects/{project}/instances/{instance}/users", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "put": "/v1/projects/{project}/instances/{instance}/users", - "body": "body" - } - } - ] - } - } - }, - "SqlUsersDeleteRequest": { - "fields": { - "host": { - "type": "string", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - } - } - }, - "SqlUsersGetRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "name": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - }, - "host": { - "type": "string", - "id": 4 - } - } - }, - "SqlUsersInsertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "User", - "id": 100 - } - } - }, - "SqlUsersListRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlUsersUpdateRequest": { - "oneofs": { - "_revokeExistingRoles": { - "oneof": [ - "revokeExistingRoles" - ] - } - }, - "fields": { - "host": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "instance": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - }, - "databaseRoles": { - "rule": "repeated", - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "revokeExistingRoles": { - "type": "bool", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "body": { - "type": "User", - "id": 100 - } - } - }, - "UserPasswordValidationPolicy": { - "fields": { - "allowedFailedAttempts": { - "type": "int32", - "id": 1 - }, - "passwordExpirationDuration": { - "type": "google.protobuf.Duration", - "id": 2 - }, - "enableFailedAttemptsCheck": { - "type": "bool", - "id": 3 - }, - "status": { - "type": "PasswordStatus", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "enablePasswordVerification": { - "type": "bool", - "id": 5 - } - } - }, - "PasswordStatus": { - "fields": { - "locked": { - "type": "bool", - "id": 1 - }, - "passwordExpirationTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - } - } - }, - "User": { - "oneofs": { - "userDetails": { - "oneof": [ - "sqlserverUserDetails" - ] - }, - "_dualPasswordType": { - "oneof": [ - "dualPasswordType" - ] - }, - "_iamStatus": { - "oneof": [ - "iamStatus" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "password": { - "type": "string", - "id": 2 - }, - "etag": { - "type": "string", - "id": 3 - }, - "name": { - "type": "string", - "id": 4 - }, - "host": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "instance": { - "type": "string", - "id": 6 - }, - "project": { - "type": "string", - "id": 7 - }, - "type": { - "type": "SqlUserType", - "id": 8 - }, - "sqlserverUserDetails": { - "type": "SqlServerUserDetails", - "id": 9 - }, - "iamEmail": { - "type": "string", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "passwordPolicy": { - "type": "UserPasswordValidationPolicy", - "id": 12 - }, - "dualPasswordType": { - "type": "DualPasswordType", - "id": 13, - "options": { - "proto3_optional": true - } - }, - "iamStatus": { - "type": "IamStatus", - "id": 14, - "options": { - "proto3_optional": true - } - }, - "databaseRoles": { - "rule": "repeated", - "type": "string", - "id": 15, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SqlUserType": { - "values": { - "BUILT_IN": 0, - "CLOUD_IAM_USER": 1, - "CLOUD_IAM_SERVICE_ACCOUNT": 2, - "CLOUD_IAM_GROUP": 3, - "CLOUD_IAM_GROUP_USER": 4, - "CLOUD_IAM_GROUP_SERVICE_ACCOUNT": 5, - "ENTRAID_USER": 7 - } - }, - "DualPasswordType": { - "values": { - "DUAL_PASSWORD_TYPE_UNSPECIFIED": 0, - "NO_MODIFY_DUAL_PASSWORD": 1, - "NO_DUAL_PASSWORD": 2, - "DUAL_PASSWORD": 3 - } - }, - "IamStatus": { - "values": { - "IAM_STATUS_UNSPECIFIED": 0, - "INACTIVE": 1, - "ACTIVE": 2 - } - } - } - }, - "SqlServerUserDetails": { - "fields": { - "disabled": { - "type": "bool", - "id": 1 - }, - "serverRoles": { - "rule": "repeated", - "type": "string", - "id": 2 - } - } - }, - "UsersListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "User", - "id": 2 - }, - "nextPageToken": { - "type": "string", - "id": 3, - "options": { - "deprecated": true - } - } - } - } - } - }, - "v1beta4": { - "options": { - "go_package": "cloud.google.com/go/sql/apiv1beta4/sqlpb;sqlpb", - "java_multiple_files": true, - "java_outer_classname": "CloudSqlUsersProto", - "java_package": "com.google.cloud.sql.v1beta4", - "(google.api.resource_definition).type": "compute.googleapis.com/Network", - "(google.api.resource_definition).pattern": "projects/{project}/global/networks/{network}" - }, - "nested": { - "SqlBackupRunsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "Delete": { - "requestType": "SqlBackupRunsDeleteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" - } - } - ] - }, - "Get": { - "requestType": "SqlBackupRunsGetRequest", - "responseType": "BackupRun", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns/{id}" - } - } - ] - }, - "Insert": { - "requestType": "SqlBackupRunsInsertRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns", - "body": "body" - } - } - ] - }, - "List": { - "requestType": "SqlBackupRunsListRequest", - "responseType": "BackupRunsListResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/backupRuns" - } - } - ] - } - } - }, - "SqlDatabasesService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "Delete": { - "requestType": "SqlDatabasesDeleteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" - } - } - ] - }, - "Get": { - "requestType": "SqlDatabasesGetRequest", - "responseType": "Database", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}" - } - } - ] - }, - "Insert": { - "requestType": "SqlDatabasesInsertRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/databases", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/databases", - "body": "body" - } - } - ] - }, - "List": { - "requestType": "SqlDatabasesListRequest", - "responseType": "DatabasesListResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/databases" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/databases" - } - } - ] - }, - "Patch": { - "requestType": "SqlDatabasesUpdateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).patch": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}", - "body": "body" - } - } - ] - }, - "Update": { - "requestType": "SqlDatabasesUpdateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).put": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "put": "/sql/v1beta4/projects/{project}/instances/{instance}/databases/{database}", - "body": "body" - } - } - ] - } - } - }, - "SqlFlagsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "List": { - "requestType": "SqlFlagsListRequest", - "responseType": "FlagsListResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/flags" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/flags" - } - } - ] - } - } - }, - "SqlInstancesService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "AddServerCa": { - "requestType": "SqlInstancesAddServerCaRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCa" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCa" - } - } - ] - }, - "AddServerCertificate": { - "requestType": "SqlInstancesAddServerCertificateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCertificate" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/addServerCertificate" - } - } - ] - }, - "AddEntraIdCertificate": { - "requestType": "SqlInstancesAddEntraIdCertificateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/addEntraIdCertificate" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/addEntraIdCertificate" - } - } - ] - }, - "Clone": { - "requestType": "SqlInstancesCloneRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/clone", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/clone", - "body": "body" - } - } - ] - }, - "Delete": { - "requestType": "SqlInstancesDeleteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/sql/v1beta4/projects/{project}/instances/{instance}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/sql/v1beta4/projects/{project}/instances/{instance}" - } - } - ] - }, - "DemoteMaster": { - "requestType": "SqlInstancesDemoteMasterRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/demoteMaster", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/demoteMaster", - "body": "body" - } - } - ] - }, - "Demote": { - "requestType": "SqlInstancesDemoteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/demote", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/demote", - "body": "body" - } - } - ] - }, - "Export": { - "requestType": "SqlInstancesExportRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/export", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/export", - "body": "body" - } - } - ] - }, - "Failover": { - "requestType": "SqlInstancesFailoverRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/failover", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/failover", - "body": "body" - } - } - ] - }, - "Reencrypt": { - "requestType": "SqlInstancesReencryptRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/reencrypt", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/reencrypt", - "body": "body" - } - } - ] - }, - "Get": { - "requestType": "SqlInstancesGetRequest", - "responseType": "DatabaseInstance", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}" - } - } - ] - }, - "Import": { - "requestType": "SqlInstancesImportRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/import", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/import", - "body": "body" - } - } - ] - }, - "Insert": { - "requestType": "SqlInstancesInsertRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances", - "body": "body" - } - } - ] - }, - "List": { - "requestType": "SqlInstancesListRequest", - "responseType": "InstancesListResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances" - } - } - ] - }, - "ListServerCas": { - "requestType": "SqlInstancesListServerCasRequest", - "responseType": "InstancesListServerCasResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCas" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCas" - } - } - ] - }, - "ListServerCertificates": { - "requestType": "SqlInstancesListServerCertificatesRequest", - "responseType": "InstancesListServerCertificatesResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCertificates" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/listServerCertificates" - } - } - ] - }, - "ListEntraIdCertificates": { - "requestType": "SqlInstancesListEntraIdCertificatesRequest", - "responseType": "InstancesListEntraIdCertificatesResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/listEntraIdCertificates" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/listEntraIdCertificates" - } - } - ] - }, - "Patch": { - "requestType": "SqlInstancesPatchRequest", - "responseType": "Operation", - "options": { - "(google.api.http).patch": "/sql/v1beta4/projects/{project}/instances/{instance}", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/sql/v1beta4/projects/{project}/instances/{instance}", - "body": "body" - } - } - ] - }, - "PromoteReplica": { - "requestType": "SqlInstancesPromoteReplicaRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/promoteReplica" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/promoteReplica" - } - } - ] - }, - "Switchover": { - "requestType": "SqlInstancesSwitchoverRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/switchover" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/switchover" - } - } - ] - }, - "ResetSslConfig": { - "requestType": "SqlInstancesResetSslConfigRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/resetSslConfig" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/resetSslConfig" - } - } - ] - }, - "Restart": { - "requestType": "SqlInstancesRestartRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/restart" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/restart" - } - } - ] - }, - "RestoreBackup": { - "requestType": "SqlInstancesRestoreBackupRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/restoreBackup", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/restoreBackup", - "body": "body" - } - } - ] - }, - "RotateServerCa": { - "requestType": "SqlInstancesRotateServerCaRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCa", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCa", - "body": "body" - } - } - ] - }, - "RotateServerCertificate": { - "requestType": "SqlInstancesRotateServerCertificateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCertificate", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateServerCertificate", - "body": "body" - } - } - ] - }, - "RotateEntraIdCertificate": { - "requestType": "SqlInstancesRotateEntraIdCertificateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateEntraIdCertificate", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/rotateEntraIdCertificate", - "body": "body" - } - } - ] - }, - "StartReplica": { - "requestType": "SqlInstancesStartReplicaRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/startReplica" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/startReplica" - } - } - ] - }, - "StopReplica": { - "requestType": "SqlInstancesStopReplicaRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/stopReplica" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/stopReplica" - } - } - ] - }, - "TruncateLog": { - "requestType": "SqlInstancesTruncateLogRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/truncateLog", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/truncateLog", - "body": "body" - } - } - ] - }, - "Update": { - "requestType": "SqlInstancesUpdateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).put": "/sql/v1beta4/projects/{project}/instances/{instance}", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "put": "/sql/v1beta4/projects/{project}/instances/{instance}", - "body": "body" - } - } - ] - }, - "CreateEphemeral": { - "requestType": "SqlInstancesCreateEphemeralCertRequest", - "responseType": "SslCert", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/createEphemeral", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/createEphemeral", - "body": "body" - } - } - ] - }, - "RescheduleMaintenance": { - "requestType": "SqlInstancesRescheduleMaintenanceRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/rescheduleMaintenance", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/rescheduleMaintenance", - "body": "body" - } - } - ] - }, - "VerifyExternalSyncSettings": { - "requestType": "SqlInstancesVerifyExternalSyncSettingsRequest", - "responseType": "SqlInstancesVerifyExternalSyncSettingsResponse", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/verifyExternalSyncSettings", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/verifyExternalSyncSettings", - "body": "*" - } - } - ] - }, - "StartExternalSync": { - "requestType": "SqlInstancesStartExternalSyncRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/startExternalSync", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/startExternalSync", - "body": "*" - } - } - ] - }, - "PerformDiskShrink": { - "requestType": "SqlInstancesPerformDiskShrinkRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/performDiskShrink", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/performDiskShrink", - "body": "body" - } - } - ] - }, - "GetDiskShrinkConfig": { - "requestType": "SqlInstancesGetDiskShrinkConfigRequest", - "responseType": "SqlInstancesGetDiskShrinkConfigResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/getDiskShrinkConfig" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/getDiskShrinkConfig" - } - } - ] - }, - "ResetReplicaSize": { - "requestType": "SqlInstancesResetReplicaSizeRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/resetReplicaSize", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/resetReplicaSize", - "body": "*" - } - } - ] - }, - "GetLatestRecoveryTime": { - "requestType": "SqlInstancesGetLatestRecoveryTimeRequest", - "responseType": "SqlInstancesGetLatestRecoveryTimeResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/getLatestRecoveryTime" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/getLatestRecoveryTime" - } - } - ] - }, - "ExecuteSql": { - "requestType": "SqlInstancesExecuteSqlRequest", - "responseType": "SqlInstancesExecuteSqlResponse", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/executeSql", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/executeSql", - "body": "body" - } - } - ] - }, - "AcquireSsrsLease": { - "requestType": "SqlInstancesAcquireSsrsLeaseRequest", - "responseType": "SqlInstancesAcquireSsrsLeaseResponse", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/acquireSsrsLease", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/acquireSsrsLease", - "body": "body" - } - } - ] - }, - "ReleaseSsrsLease": { - "requestType": "SqlInstancesReleaseSsrsLeaseRequest", - "responseType": "SqlInstancesReleaseSsrsLeaseResponse", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/releaseSsrsLease" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/releaseSsrsLease" - } - } - ] - }, - "PreCheckMajorVersionUpgrade": { - "requestType": "SqlInstancesPreCheckMajorVersionUpgradeRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/preCheckMajorVersionUpgrade", - "body": "body" - } - } - ] - }, - "PointInTimeRestore": { - "requestType": "SqlInstancesPointInTimeRestoreRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/{parent=projects/*}:pointInTimeRestore", - "(google.api.http).body": "context" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/{parent=projects/*}:pointInTimeRestore", - "body": "context" - } - } - ] - } - } - }, - "SqlOperationsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "Get": { - "requestType": "SqlOperationsGetRequest", - "responseType": "Operation", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/operations/{operation}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/operations/{operation}" - } - } - ] - }, - "List": { - "requestType": "SqlOperationsListRequest", - "responseType": "OperationsListResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/operations" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/operations" - } - } - ] - }, - "Cancel": { - "requestType": "SqlOperationsCancelRequest", - "responseType": "google.protobuf.Empty", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/operations/{operation}/cancel" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/operations/{operation}/cancel" - } - } - ] - } - } - }, - "SqlSslCertsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "Delete": { - "requestType": "SqlSslCertsDeleteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - } - } - ] - }, - "Get": { - "requestType": "SqlSslCertsGetRequest", - "responseType": "SslCert", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts/{sha1_fingerprint}" - } - } - ] - }, - "Insert": { - "requestType": "SqlSslCertsInsertRequest", - "responseType": "SslCertsInsertResponse", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts", - "body": "body" - } - } - ] - }, - "List": { - "requestType": "SqlSslCertsListRequest", - "responseType": "SslCertsListResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/sslCerts" - } - } - ] - } - } - }, - "SqlBackupsService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "CreateBackup": { - "requestType": "CreateBackupRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/{parent=projects/*}/backups", - "(google.api.http).body": "backup", - "(google.api.method_signature)": "parent, backup" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/{parent=projects/*}/backups", - "body": "backup" - } - }, - { - "(google.api.method_signature)": "parent, backup" - } - ] - }, - "GetBackup": { - "requestType": "GetBackupRequest", - "responseType": "Backup", - "options": { - "(google.api.http).get": "/sql/v1beta4/{name=projects/*/backups/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/{name=projects/*/backups/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - }, - "ListBackups": { - "requestType": "ListBackupsRequest", - "responseType": "ListBackupsResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/{parent=projects/*}/backups", - "(google.api.method_signature)": "parent" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/{parent=projects/*}/backups" - } - }, - { - "(google.api.method_signature)": "parent" - } - ] - }, - "UpdateBackup": { - "requestType": "UpdateBackupRequest", - "responseType": "Operation", - "options": { - "(google.api.http).patch": "/sql/v1beta4/{backup.name=projects/*/backups/*}", - "(google.api.http).body": "backup", - "(google.api.method_signature)": "backup, update_mask" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "patch": "/sql/v1beta4/{backup.name=projects/*/backups/*}", - "body": "backup" - } - }, - { - "(google.api.method_signature)": "backup, update_mask" - } - ] - }, - "DeleteBackup": { - "requestType": "DeleteBackupRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/sql/v1beta4/{name=projects/*/backups/*}", - "(google.api.method_signature)": "name" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/sql/v1beta4/{name=projects/*/backups/*}" - } - }, - { - "(google.api.method_signature)": "name" - } - ] - } - } - }, - "CreateBackupRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "sqladmin.googleapis.com/Backup" - } - }, - "backup": { - "type": "Backup", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "GetBackupRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" - } - } - } - }, - "ListBackupsRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).child_type": "sqladmin.googleapis.com/Backup" - } - }, - "pageSize": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - }, - "filter": { - "type": "string", - "id": 4 - } - } - }, - "ListBackupsResponse": { - "fields": { - "backups": { - "rule": "repeated", - "type": "Backup", - "id": 1 - }, - "nextPageToken": { - "type": "string", - "id": 2 - }, - "warnings": { - "rule": "repeated", - "type": "ApiWarning", - "id": 3 - } - } - }, - "UpdateBackupRequest": { - "fields": { - "backup": { - "type": "Backup", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "updateMask": { - "type": "google.protobuf.FieldMask", - "id": 2 - } - } - }, - "DeleteBackupRequest": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED", - "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" - } - } - } - }, - "SqlBackupRunsDeleteRequest": { - "fields": { - "id": { - "type": "int64", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - } - } - }, - "SqlBackupRunsGetRequest": { - "fields": { - "id": { - "type": "int64", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - } - } - }, - "SqlBackupRunsInsertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "BackupRun", - "id": 100 - } - } - }, - "SqlBackupRunsListRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "maxResults": { - "type": "int32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - } - } - }, - "SqlDatabasesDeleteRequest": { - "fields": { - "database": { - "type": "string", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - } - } - }, - "SqlDatabasesGetRequest": { - "fields": { - "database": { - "type": "string", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - } - } - }, - "SqlDatabasesInsertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "Database", - "id": 100 - } - } - }, - "SqlDatabasesListRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlDatabasesUpdateRequest": { - "fields": { - "database": { - "type": "string", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - }, - "body": { - "type": "Database", - "id": 100 - } - } - }, - "SqlFlagsListRequest": { - "oneofs": { - "_flagScope": { - "oneof": [ - "flagScope" - ] - } - }, - "fields": { - "databaseVersion": { - "type": "string", - "id": 1 - }, - "flagScope": { - "type": "SqlFlagScope", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - } - } - }, - "SqlInstancesAddServerCaRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesAddServerCertificateRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesAddEntraIdCertificateRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesCloneRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesCloneRequest", - "id": 100 - } - } - }, - "SqlInstancesDeleteRequest": { - "oneofs": { - "_enableFinalBackup": { - "oneof": [ - "enableFinalBackup" - ] - }, - "expiration": { - "oneof": [ - "finalBackupTtlDays", - "finalBackupExpiryTime" - ] - } - }, - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "enableFinalBackup": { - "type": "bool", - "id": 7, - "options": { - "proto3_optional": true - } - }, - "finalBackupTtlDays": { - "type": "int64", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "finalBackupExpiryTime": { - "type": "google.protobuf.Timestamp", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "finalBackupDescription": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlInstancesDemoteMasterRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesDemoteMasterRequest", - "id": 100 - } - } - }, - "SqlInstancesDemoteRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesDemoteRequest", - "id": 100 - } - } - }, - "SqlInstancesExportRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesExportRequest", - "id": 100 - } - } - }, - "SqlInstancesFailoverRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesFailoverRequest", - "id": 100 - } - } - }, - "SqlInstancesGetRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesImportRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesImportRequest", - "id": 100 - } - } - }, - "SqlInstancesInsertRequest": { - "fields": { - "project": { - "type": "string", - "id": 1 - }, - "body": { - "type": "DatabaseInstance", - "id": 100 - } - } - }, - "SqlInstancesListRequest": { - "fields": { - "filter": { - "type": "string", - "id": 1 - }, - "maxResults": { - "type": "uint32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - } - } - }, - "SqlInstancesListServerCasRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesListServerCertificatesRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesListEntraIdCertificatesRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesPatchRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "DatabaseInstance", - "id": 100 - } - } - }, - "SqlInstancesPromoteReplicaRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "failover": { - "type": "bool", - "id": 3 - } - } - }, - "SqlInstancesSwitchoverRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "dbTimeout": { - "type": "google.protobuf.Duration", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlInstancesResetSslConfigRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "mode": { - "type": "ResetSslMode", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "ResetSslMode": { - "values": { - "RESET_SSL_MODE_UNSPECIFIED": 0, - "ALL": 1, - "SYNC_FROM_PRIMARY": 2 - } - } - } - }, - "SqlInstancesRestartRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesRestoreBackupRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesRestoreBackupRequest", - "id": 100 - } - } - }, - "SqlInstancesRotateServerCaRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesRotateServerCaRequest", - "id": 100 - } - } - }, - "SqlInstancesRotateServerCertificateRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesRotateServerCertificateRequest", - "id": 100, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesRotateEntraIdCertificateRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesRotateEntraIdCertificateRequest", - "id": 100, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesStartReplicaRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesStopReplicaRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesTruncateLogRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesTruncateLogRequest", - "id": 100 - } - } - }, - "SqlInstancesUpdateRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "DatabaseInstance", - "id": 100 - } - } - }, - "SqlInstancesReencryptRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "InstancesReencryptRequest", - "id": 3 - } - } - }, - "InstancesReencryptRequest": { - "oneofs": { - "_backupReencryptionConfig": { - "oneof": [ - "backupReencryptionConfig" - ] - } - }, - "fields": { - "backupReencryptionConfig": { - "type": "BackupReencryptionConfig", - "id": 1, - "options": { - "proto3_optional": true - } - } - } - }, - "BackupReencryptionConfig": { - "oneofs": { - "_backupLimit": { - "oneof": [ - "backupLimit" - ] - }, - "_backupType": { - "oneof": [ - "backupType" - ] - } - }, - "fields": { - "backupLimit": { - "type": "int32", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "backupType": { - "type": "BackupType", - "id": 2, - "options": { - "proto3_optional": true - } - } - }, - "nested": { - "BackupType": { - "values": { - "BACKUP_TYPE_UNSPECIFIED": 0, - "AUTOMATED": 1, - "ON_DEMAND": 2 - } - } - } - }, - "SqlInstancesRescheduleMaintenanceRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "SqlInstancesRescheduleMaintenanceRequestBody", - "id": 100 - } - } - }, - "SqlInstancesPerformDiskShrinkRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "PerformDiskShrinkContext", - "id": 100 - } - } - }, - "ExternalSyncParallelLevel": { - "values": { - "EXTERNAL_SYNC_PARALLEL_LEVEL_UNSPECIFIED": 0, - "MIN": 1, - "OPTIMAL": 2, - "MAX": 3 - } - }, - "ExternalSyncSelectedObject": { - "fields": { - "database": { - "type": "string", - "id": 1 - } - } - }, - "SqlInstancesVerifyExternalSyncSettingsRequest": { - "oneofs": { - "syncConfig": { - "oneof": [ - "mysqlSyncConfig" - ] - } - }, - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "verifyConnectionOnly": { - "type": "bool", - "id": 3 - }, - "syncMode": { - "type": "ExternalSyncMode", - "id": 4 - }, - "verifyReplicationOnly": { - "type": "bool", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "mysqlSyncConfig": { - "type": "MySqlSyncConfig", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "migrationType": { - "type": "MigrationType", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "syncParallelLevel": { - "type": "ExternalSyncParallelLevel", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "selectedObjects": { - "rule": "repeated", - "type": "ExternalSyncSelectedObject", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "ExternalSyncMode": { - "values": { - "EXTERNAL_SYNC_MODE_UNSPECIFIED": 0, - "ONLINE": 1, - "OFFLINE": 2 - } - }, - "MigrationType": { - "values": { - "MIGRATION_TYPE_UNSPECIFIED": 0, - "LOGICAL": 1, - "PHYSICAL": 2 - } - } - } - }, - "SqlInstancesStartExternalSyncRequest": { - "oneofs": { - "syncConfig": { - "oneof": [ - "mysqlSyncConfig" - ] - } - }, - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "syncMode": { - "type": "SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode", - "id": 3 - }, - "skipVerification": { - "type": "bool", - "id": 4 - }, - "mysqlSyncConfig": { - "type": "MySqlSyncConfig", - "id": 6 - }, - "syncParallelLevel": { - "type": "ExternalSyncParallelLevel", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "migrationType": { - "type": "SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "replicaOverwriteEnabled": { - "type": "bool", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlInstancesResetReplicaSizeRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlOperationsGetRequest": { - "fields": { - "operation": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlOperationsListRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "maxResults": { - "type": "uint32", - "id": 2 - }, - "pageToken": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - } - } - }, - "SqlOperationsCancelRequest": { - "fields": { - "operation": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesCreateEphemeralCertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "SslCertsCreateEphemeralRequest", - "id": 100 - } - } - }, - "SqlSslCertsDeleteRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "sha1Fingerprint": { - "type": "string", - "id": 3 - } - } - }, - "SqlSslCertsGetRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "sha1Fingerprint": { - "type": "string", - "id": 3 - } - } - }, - "SqlSslCertsInsertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "SslCertsInsertRequest", - "id": 100 - } - } - }, - "SqlSslCertsListRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesGetDiskShrinkConfigRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlInstancesGetLatestRecoveryTimeRequest": { - "oneofs": { - "_sourceInstanceDeletionTime": { - "oneof": [ - "sourceInstanceDeletionTime" - ] - } - }, - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "sourceInstanceDeletionTime": { - "type": "google.protobuf.Timestamp", - "id": 3, - "options": { - "proto3_optional": true - } - } - } - }, - "SqlInstancesGetLatestRecoveryTimeResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "latestRecoveryTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "earliestRecoveryTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - } - } - }, - "SqlInstancesExecuteSqlRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "ExecuteSqlPayload", - "id": 100 - } - } - }, - "SqlInstancesReleaseSsrsLeaseRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesReleaseSsrsLeaseResponse": { - "fields": { - "operationId": { - "type": "string", - "id": 1 - } - } - }, - "ExecuteSqlPayload": { - "oneofs": { - "userPassword": { - "oneof": [ - "autoIamAuthn" - ] - } - }, - "fields": { - "user": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "sqlStatement": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "database": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "autoIamAuthn": { - "type": "bool", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "rowLimit": { - "type": "int64", - "id": 10, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "partialResultMode": { - "type": "PartialResultMode", - "id": 13, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "application": { - "type": "string", - "id": 16, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "PartialResultMode": { - "values": { - "PARTIAL_RESULT_MODE_UNSPECIFIED": 0, - "FAIL_PARTIAL_RESULT": 1, - "ALLOW_PARTIAL_RESULT": 2 - } - } - } - }, - "SqlInstancesExecuteSqlResponse": { - "fields": { - "messages": { - "rule": "repeated", - "type": "Message", - "id": 9 - }, - "metadata": { - "type": "Metadata", - "id": 6 - }, - "results": { - "rule": "repeated", - "type": "QueryResult", - "id": 7 - }, - "status": { - "type": "google.rpc.Status", - "id": 8 - } - }, - "nested": { - "Message": { - "oneofs": { - "_message": { - "oneof": [ - "message" - ] - }, - "_severity": { - "oneof": [ - "severity" - ] - } - }, - "fields": { - "message": { - "type": "string", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "severity": { - "type": "string", - "id": 2, - "options": { - "proto3_optional": true - } - } - } - } - } - }, - "QueryResult": { - "fields": { - "columns": { - "rule": "repeated", - "type": "Column", - "id": 1 - }, - "rows": { - "rule": "repeated", - "type": "Row", - "id": 2 - }, - "message": { - "type": "string", - "id": 3 - }, - "partialResult": { - "type": "bool", - "id": 4 - }, - "status": { - "type": "google.rpc.Status", - "id": 8 - } - } - }, - "Column": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "type": { - "type": "string", - "id": 2 - } - } - }, - "Row": { - "fields": { - "values": { - "rule": "repeated", - "type": "Value", - "id": 1 - } - } - }, - "Value": { - "fields": { - "value": { - "type": "string", - "id": 1 - }, - "nullValue": { - "type": "bool", - "id": 2 - } - } - }, - "Metadata": { - "fields": { - "sqlStatementExecutionTime": { - "type": "google.protobuf.Duration", - "id": 1 - } - } - }, - "SqlInstancesAcquireSsrsLeaseRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesAcquireSsrsLeaseRequest", - "id": 100 - } - } - }, - "SqlInstancesPreCheckMajorVersionUpgradeRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "project": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "body": { - "type": "InstancesPreCheckMajorVersionUpgradeRequest", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlInstancesAcquireSsrsLeaseResponse": { - "oneofs": { - "_operationId": { - "oneof": [ - "operationId" - ] - } - }, - "fields": { - "operationId": { - "type": "string", - "id": 1, - "options": { - "proto3_optional": true - } - } - } - }, - "SqlInstancesPointInTimeRestoreRequest": { - "fields": { - "parent": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "context": { - "type": "PointInTimeRestoreContext", - "id": 100, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "AclEntry": { - "fields": { - "value": { - "type": "string", - "id": 1 - }, - "expirationTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - }, - "name": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "kind": { - "type": "string", - "id": 4 - } - } - }, - "ApiWarning": { - "fields": { - "code": { - "type": "SqlApiWarningCode", - "id": 1 - }, - "message": { - "type": "string", - "id": 2 - }, - "region": { - "type": "string", - "id": 3 - } - }, - "nested": { - "SqlApiWarningCode": { - "values": { - "SQL_API_WARNING_CODE_UNSPECIFIED": 0, - "REGION_UNREACHABLE": 1, - "MAX_RESULTS_EXCEEDS_LIMIT": 2, - "COMPROMISED_CREDENTIALS": 3, - "INTERNAL_STATE_FAILURE": 4 - } - } - } - }, - "BackupRetentionSettings": { - "fields": { - "retentionUnit": { - "type": "RetentionUnit", - "id": 1 - }, - "retainedBackups": { - "type": "google.protobuf.Int32Value", - "id": 2 - } - }, - "nested": { - "RetentionUnit": { - "values": { - "RETENTION_UNIT_UNSPECIFIED": 0, - "COUNT": 1 - } - } - } - }, - "BackupConfiguration": { - "oneofs": { - "_transactionalLogStorageState": { - "oneof": [ - "transactionalLogStorageState" - ] - }, - "_backupTier": { - "oneof": [ - "backupTier" - ] - } - }, - "fields": { - "startTime": { - "type": "string", - "id": 1 - }, - "enabled": { - "type": "google.protobuf.BoolValue", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - }, - "binaryLogEnabled": { - "type": "google.protobuf.BoolValue", - "id": 4 - }, - "replicationLogArchivingEnabled": { - "type": "google.protobuf.BoolValue", - "id": 5 - }, - "location": { - "type": "string", - "id": 6 - }, - "pointInTimeRecoveryEnabled": { - "type": "google.protobuf.BoolValue", - "id": 7 - }, - "transactionLogRetentionDays": { - "type": "google.protobuf.Int32Value", - "id": 9 - }, - "backupRetentionSettings": { - "type": "BackupRetentionSettings", - "id": 10 - }, - "transactionalLogStorageState": { - "type": "TransactionalLogStorageState", - "id": 11, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "backupTier": { - "type": "BackupTier", - "id": 12, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - } - }, - "nested": { - "TransactionalLogStorageState": { - "values": { - "TRANSACTIONAL_LOG_STORAGE_STATE_UNSPECIFIED": 0, - "DISK": 1, - "SWITCHING_TO_CLOUD_STORAGE": 2, - "SWITCHED_TO_CLOUD_STORAGE": 3, - "CLOUD_STORAGE": 4 - } - }, - "BackupTier": { - "valuesOptions": { - "ADVANCED": { - "deprecated": true - } - }, - "values": { - "BACKUP_TIER_UNSPECIFIED": 0, - "STANDARD": 1, - "ADVANCED": 2, - "ENHANCED": 3 - } - } - } - }, - "BackupRun": { - "oneofs": { - "_maxChargeableBytes": { - "oneof": [ - "maxChargeableBytes" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "status": { - "type": "SqlBackupRunStatus", - "id": 2 - }, - "enqueuedTime": { - "type": "google.protobuf.Timestamp", - "id": 3 - }, - "id": { - "type": "int64", - "id": 4 - }, - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 6 - }, - "error": { - "type": "OperationError", - "id": 7 - }, - "type": { - "type": "SqlBackupRunType", - "id": 8 - }, - "description": { - "type": "string", - "id": 9 - }, - "windowStartTime": { - "type": "google.protobuf.Timestamp", - "id": 10 - }, - "instance": { - "type": "string", - "id": 11 - }, - "selfLink": { - "type": "string", - "id": 12 - }, - "location": { - "type": "string", - "id": 13 - }, - "databaseVersion": { - "type": "SqlDatabaseVersion", - "id": 15, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "diskEncryptionConfiguration": { - "type": "DiskEncryptionConfiguration", - "id": 16 - }, - "diskEncryptionStatus": { - "type": "DiskEncryptionStatus", - "id": 17 - }, - "backupKind": { - "type": "SqlBackupKind", - "id": 19 - }, - "timeZone": { - "type": "string", - "id": 23 - }, - "maxChargeableBytes": { - "type": "int64", - "id": 24, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - } - } - }, - "Backup": { - "options": { - "(google.api.resource).type": "sqladmin.googleapis.com/Backup", - "(google.api.resource).pattern": "projects/{project}/backups/{backup}" - }, - "oneofs": { - "expiration": { - "oneof": [ - "ttlDays", - "expiryTime" - ] - }, - "_maxChargeableBytes": { - "oneof": [ - "maxChargeableBytes" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kind": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "selfLink": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "type": { - "type": "SqlBackupType", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "description": { - "type": "string", - "id": 5 - }, - "instance": { - "type": "string", - "id": 6 - }, - "location": { - "type": "string", - "id": 7 - }, - "backupInterval": { - "type": "google.type.Interval", - "id": 8, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "state": { - "type": "SqlBackupState", - "id": 9, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "error": { - "type": "OperationError", - "id": 10, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kmsKey": { - "type": "string", - "id": 11, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kmsKeyVersion": { - "type": "string", - "id": 12, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "backupKind": { - "type": "SqlBackupKind", - "id": 13, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "timeZone": { - "type": "string", - "id": 15, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "ttlDays": { - "type": "int64", - "id": 16, - "options": { - "(google.api.field_behavior)": "INPUT_ONLY" - } - }, - "expiryTime": { - "type": "google.protobuf.Timestamp", - "id": 17 - }, - "databaseVersion": { - "type": "SqlDatabaseVersion", - "id": 20, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "maxChargeableBytes": { - "type": "int64", - "id": 23, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "instanceDeletionTime": { - "type": "google.protobuf.Timestamp", - "id": 24, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "instanceSettings": { - "type": "DatabaseInstance", - "id": 25, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "backupRun": { - "type": "string", - "id": 26, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "satisfiesPzs": { - "type": "google.protobuf.BoolValue", - "id": 27, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "satisfiesPzi": { - "type": "google.protobuf.BoolValue", - "id": 28, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - }, - "nested": { - "SqlBackupType": { - "values": { - "SQL_BACKUP_TYPE_UNSPECIFIED": 0, - "AUTOMATED": 1, - "ON_DEMAND": 2, - "FINAL": 3 - } - }, - "SqlBackupState": { - "values": { - "SQL_BACKUP_STATE_UNSPECIFIED": 0, - "ENQUEUED": 1, - "RUNNING": 2, - "FAILED": 3, - "SUCCESSFUL": 4, - "DELETING": 5, - "DELETION_FAILED": 6 - } - } - } - }, - "BackupRunsListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "BackupRun", - "id": 2 - }, - "nextPageToken": { - "type": "string", - "id": 3 - } - } - }, - "BinLogCoordinates": { - "fields": { - "binLogFileName": { - "type": "string", - "id": 1 - }, - "binLogPosition": { - "type": "int64", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - } - } - }, - "BackupContext": { - "fields": { - "backupId": { - "type": "int64", - "id": 1 - }, - "kind": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - } - } - }, - "CloneContext": { - "oneofs": { - "_preferredZone": { - "oneof": [ - "preferredZone" - ] - }, - "_preferredSecondaryZone": { - "oneof": [ - "preferredSecondaryZone" - ] - }, - "_sourceInstanceDeletionTime": { - "oneof": [ - "sourceInstanceDeletionTime" - ] - }, - "_destinationProject": { - "oneof": [ - "destinationProject" - ] - }, - "_destinationNetwork": { - "oneof": [ - "destinationNetwork" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "pitrTimestampMs": { - "type": "int64", - "id": 2 - }, - "destinationInstanceName": { - "type": "string", - "id": 3 - }, - "binLogCoordinates": { - "type": "BinLogCoordinates", - "id": 4 - }, - "pointInTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "allocatedIpRange": { - "type": "string", - "id": 6 - }, - "databaseNames": { - "rule": "repeated", - "type": "string", - "id": 9 - }, - "preferredZone": { - "type": "string", - "id": 10, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "preferredSecondaryZone": { - "type": "string", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "sourceInstanceDeletionTime": { - "type": "google.protobuf.Timestamp", - "id": 12, - "options": { - "proto3_optional": true - } - }, - "destinationProject": { - "type": "string", - "id": 13, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "destinationNetwork": { - "type": "string", - "id": 14, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "(google.api.resource_reference).type": "compute.googleapis.com/Network", - "proto3_optional": true - } - } - } - }, - "Database": { - "oneofs": { - "databaseDetails": { - "oneof": [ - "sqlserverDatabaseDetails" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "charset": { - "type": "string", - "id": 2 - }, - "collation": { - "type": "string", - "id": 3 - }, - "etag": { - "type": "string", - "id": 4 - }, - "name": { - "type": "string", - "id": 5 - }, - "instance": { - "type": "string", - "id": 6 - }, - "selfLink": { - "type": "string", - "id": 7 - }, - "project": { - "type": "string", - "id": 8 - }, - "sqlserverDatabaseDetails": { - "type": "SqlServerDatabaseDetails", - "id": 9 - } - } - }, - "SqlServerDatabaseDetails": { - "fields": { - "compatibilityLevel": { - "type": "int32", - "id": 1 - }, - "recoveryModel": { - "type": "string", - "id": 2 - } - } - }, - "DatabaseFlags": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - } - } - }, - "SyncFlags": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "type": "string", - "id": 2 - } - } - }, - "InstanceReference": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "region": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - } - } - }, - "DatabaseInstance": { - "oneofs": { - "_outOfDiskReport": { - "oneof": [ - "outOfDiskReport" - ] - }, - "_sqlNetworkArchitecture": { - "oneof": [ - "sqlNetworkArchitecture" - ] - }, - "_pscServiceAttachmentLink": { - "oneof": [ - "pscServiceAttachmentLink" - ] - }, - "_dnsName": { - "oneof": [ - "dnsName" - ] - }, - "_primaryDnsName": { - "oneof": [ - "primaryDnsName" - ] - }, - "_writeEndpoint": { - "oneof": [ - "writeEndpoint" - ] - }, - "_replicationCluster": { - "oneof": [ - "replicationCluster" - ] - }, - "_geminiConfig": { - "oneof": [ - "geminiConfig" - ] - }, - "_switchTransactionLogsToCloudStorageEnabled": { - "oneof": [ - "switchTransactionLogsToCloudStorageEnabled" - ] - }, - "_includeReplicasForMajorVersionUpgrade": { - "oneof": [ - "includeReplicasForMajorVersionUpgrade" - ] - }, - "_nodeCount": { - "oneof": [ - "nodeCount" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "state": { - "type": "SqlInstanceState", - "id": 2 - }, - "databaseVersion": { - "type": "SqlDatabaseVersion", - "id": 3 - }, - "settings": { - "type": "Settings", - "id": 4 - }, - "etag": { - "type": "string", - "id": 5 - }, - "failoverReplica": { - "type": "SqlFailoverReplica", - "id": 6 - }, - "masterInstanceName": { - "type": "string", - "id": 7 - }, - "replicaNames": { - "rule": "repeated", - "type": "string", - "id": 8 - }, - "maxDiskSize": { - "type": "google.protobuf.Int64Value", - "id": 9, - "options": { - "deprecated": true - } - }, - "currentDiskSize": { - "type": "google.protobuf.Int64Value", - "id": 10, - "options": { - "deprecated": true - } - }, - "ipAddresses": { - "rule": "repeated", - "type": "IpMapping", - "id": 11 - }, - "serverCaCert": { - "type": "SslCert", - "id": 12 - }, - "instanceType": { - "type": "SqlInstanceType", - "id": 13 - }, - "project": { - "type": "string", - "id": 14 - }, - "ipv6Address": { - "type": "string", - "id": 15, - "options": { - "deprecated": true - } - }, - "serviceAccountEmailAddress": { - "type": "string", - "id": 16 - }, - "onPremisesConfiguration": { - "type": "OnPremisesConfiguration", - "id": 17 - }, - "replicaConfiguration": { - "type": "ReplicaConfiguration", - "id": 18 - }, - "backendType": { - "type": "SqlBackendType", - "id": 19 - }, - "selfLink": { - "type": "string", - "id": 20 - }, - "suspensionReason": { - "rule": "repeated", - "type": "SqlSuspensionReason", - "id": 21 - }, - "connectionName": { - "type": "string", - "id": 22 - }, - "name": { - "type": "string", - "id": 23 - }, - "region": { - "type": "string", - "id": 24 - }, - "gceZone": { - "type": "string", - "id": 25 - }, - "secondaryGceZone": { - "type": "string", - "id": 34 - }, - "diskEncryptionConfiguration": { - "type": "DiskEncryptionConfiguration", - "id": 26 - }, - "diskEncryptionStatus": { - "type": "DiskEncryptionStatus", - "id": 27 - }, - "rootPassword": { - "type": "string", - "id": 29 - }, - "scheduledMaintenance": { - "type": "SqlScheduledMaintenance", - "id": 30 - }, - "satisfiesPzs": { - "type": "google.protobuf.BoolValue", - "id": 35 - }, - "databaseInstalledVersion": { - "type": "string", - "id": 40, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "outOfDiskReport": { - "type": "SqlOutOfDiskReport", - "id": 38, - "options": { - "proto3_optional": true - } - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 39, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "availableMaintenanceVersions": { - "rule": "repeated", - "type": "string", - "id": 41, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "maintenanceVersion": { - "type": "string", - "id": 42 - }, - "upgradableDatabaseVersions": { - "rule": "repeated", - "type": "AvailableDatabaseVersion", - "id": 45, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "sqlNetworkArchitecture": { - "type": "SqlNetworkArchitecture", - "id": 47, - "options": { - "proto3_optional": true - } - }, - "pscServiceAttachmentLink": { - "type": "string", - "id": 48, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "dnsName": { - "type": "string", - "id": 49, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "primaryDnsName": { - "type": "string", - "id": 51, - "options": { - "deprecated": true, - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "writeEndpoint": { - "type": "string", - "id": 52, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "replicationCluster": { - "type": "ReplicationCluster", - "id": 54, - "options": { - "proto3_optional": true - } - }, - "geminiConfig": { - "type": "GeminiInstanceConfig", - "id": 55, - "options": { - "proto3_optional": true - } - }, - "satisfiesPzi": { - "type": "google.protobuf.BoolValue", - "id": 56, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "switchTransactionLogsToCloudStorageEnabled": { - "type": "google.protobuf.BoolValue", - "id": 57, - "options": { - "(google.api.field_behavior)": "INPUT_ONLY", - "proto3_optional": true - } - }, - "includeReplicasForMajorVersionUpgrade": { - "type": "google.protobuf.BoolValue", - "id": 59, - "options": { - "(google.api.field_behavior)": "INPUT_ONLY", - "proto3_optional": true - } - }, - "tags": { - "keyType": "string", - "type": "string", - "id": 60, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "nodeCount": { - "type": "int32", - "id": 63, - "options": { - "proto3_optional": true - } - }, - "nodes": { - "rule": "repeated", - "type": "PoolNodeConfig", - "id": 64, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "dnsNames": { - "rule": "repeated", - "type": "DnsNameMapping", - "id": 67, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - }, - "nested": { - "SqlInstanceState": { - "valuesOptions": { - "ONLINE_MAINTENANCE": { - "deprecated": true - } - }, - "values": { - "SQL_INSTANCE_STATE_UNSPECIFIED": 0, - "RUNNABLE": 1, - "SUSPENDED": 2, - "PENDING_DELETE": 3, - "PENDING_CREATE": 4, - "MAINTENANCE": 5, - "FAILED": 6, - "ONLINE_MAINTENANCE": 7, - "REPAIRING": 8 - } - }, - "SqlFailoverReplica": { - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "available": { - "type": "google.protobuf.BoolValue", - "id": 2 - } - } - }, - "SqlScheduledMaintenance": { - "oneofs": { - "_scheduleDeadlineTime": { - "oneof": [ - "scheduleDeadlineTime" - ] - } - }, - "fields": { - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 1 - }, - "canDefer": { - "type": "bool", - "id": 2, - "options": { - "deprecated": true - } - }, - "canReschedule": { - "type": "bool", - "id": 3 - }, - "scheduleDeadlineTime": { - "type": "google.protobuf.Timestamp", - "id": 4, - "options": { - "proto3_optional": true - } - } - } - }, - "SqlOutOfDiskReport": { - "oneofs": { - "_sqlOutOfDiskState": { - "oneof": [ - "sqlOutOfDiskState" - ] - }, - "_sqlMinRecommendedIncreaseSizeGb": { - "oneof": [ - "sqlMinRecommendedIncreaseSizeGb" - ] - } - }, - "fields": { - "sqlOutOfDiskState": { - "type": "SqlOutOfDiskState", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "sqlMinRecommendedIncreaseSizeGb": { - "type": "int32", - "id": 2, - "options": { - "proto3_optional": true - } - } - }, - "nested": { - "SqlOutOfDiskState": { - "values": { - "SQL_OUT_OF_DISK_STATE_UNSPECIFIED": 0, - "NORMAL": 1, - "SOFT_SHUTDOWN": 2 - } - } - } - }, - "SqlNetworkArchitecture": { - "values": { - "SQL_NETWORK_ARCHITECTURE_UNSPECIFIED": 0, - "NEW_NETWORK_ARCHITECTURE": 1, - "OLD_NETWORK_ARCHITECTURE": 2 - } - }, - "PoolNodeConfig": { - "oneofs": { - "_name": { - "oneof": [ - "name" - ] - }, - "_gceZone": { - "oneof": [ - "gceZone" - ] - }, - "_dnsName": { - "oneof": [ - "dnsName" - ] - }, - "_state": { - "oneof": [ - "state" - ] - }, - "_pscServiceAttachmentLink": { - "oneof": [ - "pscServiceAttachmentLink" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "gceZone": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "ipAddresses": { - "rule": "repeated", - "type": "IpMapping", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "dnsName": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "state": { - "type": "SqlInstanceState", - "id": 5, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "dnsNames": { - "rule": "repeated", - "type": "DnsNameMapping", - "id": 6, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "pscServiceAttachmentLink": { - "type": "string", - "id": 7, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "pscAutoConnections": { - "rule": "repeated", - "type": "PscAutoConnectionConfig", - "id": 8, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - } - } - }, - "DnsNameMapping": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "connectionType": { - "type": "ConnectionType", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "dnsScope": { - "type": "DnsScope", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "recordManager": { - "type": "RecordManager", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - }, - "nested": { - "ConnectionType": { - "values": { - "CONNECTION_TYPE_UNSPECIFIED": 0, - "PUBLIC": 1, - "PRIVATE_SERVICES_ACCESS": 2, - "PRIVATE_SERVICE_CONNECT": 3 - } - }, - "DnsScope": { - "values": { - "DNS_SCOPE_UNSPECIFIED": 0, - "INSTANCE": 1, - "CLUSTER": 2 - } - }, - "RecordManager": { - "values": { - "RECORD_MANAGER_UNSPECIFIED": 0, - "CUSTOMER": 1, - "CLOUD_SQL_AUTOMATION": 2 - } - } - } - }, - "GeminiInstanceConfig": { - "oneofs": { - "_entitled": { - "oneof": [ - "entitled" - ] - }, - "_googleVacuumMgmtEnabled": { - "oneof": [ - "googleVacuumMgmtEnabled" - ] - }, - "_oomSessionCancelEnabled": { - "oneof": [ - "oomSessionCancelEnabled" - ] - }, - "_activeQueryEnabled": { - "oneof": [ - "activeQueryEnabled" - ] - }, - "_indexAdvisorEnabled": { - "oneof": [ - "indexAdvisorEnabled" - ] - }, - "_flagRecommenderEnabled": { - "oneof": [ - "flagRecommenderEnabled" - ] - } - }, - "fields": { - "entitled": { - "type": "bool", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "googleVacuumMgmtEnabled": { - "type": "bool", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "oomSessionCancelEnabled": { - "type": "bool", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "activeQueryEnabled": { - "type": "bool", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "indexAdvisorEnabled": { - "type": "bool", - "id": 5, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "flagRecommenderEnabled": { - "type": "bool", - "id": 6, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - } - } - }, - "ReplicationCluster": { - "oneofs": { - "_psaWriteEndpoint": { - "oneof": [ - "psaWriteEndpoint" - ] - }, - "_failoverDrReplicaName": { - "oneof": [ - "failoverDrReplicaName" - ] - }, - "_drReplica": { - "oneof": [ - "drReplica" - ] - } - }, - "fields": { - "psaWriteEndpoint": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "failoverDrReplicaName": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "drReplica": { - "type": "bool", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - } - } - }, - "AvailableDatabaseVersion": { - "oneofs": { - "_majorVersion": { - "oneof": [ - "majorVersion" - ] - }, - "_name": { - "oneof": [ - "name" - ] - }, - "_displayName": { - "oneof": [ - "displayName" - ] - } - }, - "fields": { - "majorVersion": { - "type": "string", - "id": 3, - "options": { - "proto3_optional": true - } - }, - "name": { - "type": "string", - "id": 8, - "options": { - "proto3_optional": true - } - }, - "displayName": { - "type": "string", - "id": 9, - "options": { - "proto3_optional": true - } - } - } - }, - "DatabasesListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "Database", - "id": 2 - } - } - }, - "DemoteMasterConfiguration": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "mysqlReplicaConfiguration": { - "type": "DemoteMasterMySqlReplicaConfiguration", - "id": 2 - } - } - }, - "DemoteMasterContext": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "verifyGtidConsistency": { - "type": "google.protobuf.BoolValue", - "id": 2 - }, - "masterInstanceName": { - "type": "string", - "id": 3 - }, - "replicaConfiguration": { - "type": "DemoteMasterConfiguration", - "id": 4 - }, - "skipReplicationSetup": { - "type": "bool", - "id": 5 - } - } - }, - "DemoteMasterMySqlReplicaConfiguration": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "username": { - "type": "string", - "id": 2 - }, - "password": { - "type": "string", - "id": 3 - }, - "clientKey": { - "type": "string", - "id": 4 - }, - "clientCertificate": { - "type": "string", - "id": 5 - }, - "caCertificate": { - "type": "string", - "id": 6 - } - } - }, - "DemoteContext": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "sourceRepresentativeInstanceName": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "SqlFileType": { - "values": { - "SQL_FILE_TYPE_UNSPECIFIED": 0, - "SQL": 1, - "CSV": 2, - "BAK": 4, - "TDE": 8 - } - }, - "ExportContext": { - "fields": { - "uri": { - "type": "string", - "id": 1 - }, - "databases": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - }, - "sqlExportOptions": { - "type": "SqlExportOptions", - "id": 4 - }, - "csvExportOptions": { - "type": "SqlCsvExportOptions", - "id": 5 - }, - "fileType": { - "type": "SqlFileType", - "id": 6 - }, - "offload": { - "type": "google.protobuf.BoolValue", - "id": 8 - }, - "bakExportOptions": { - "type": "SqlBakExportOptions", - "id": 9 - }, - "tdeExportOptions": { - "type": "SqlTdeExportOptions", - "id": 10, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SqlCsvExportOptions": { - "fields": { - "selectQuery": { - "type": "string", - "id": 1 - }, - "escapeCharacter": { - "type": "string", - "id": 2 - }, - "quoteCharacter": { - "type": "string", - "id": 3 - }, - "fieldsTerminatedBy": { - "type": "string", - "id": 4 - }, - "linesTerminatedBy": { - "type": "string", - "id": 6 - } - } - }, - "SqlExportOptions": { - "fields": { - "tables": { - "rule": "repeated", - "type": "string", - "id": 1 - }, - "schemaOnly": { - "type": "google.protobuf.BoolValue", - "id": 2 - }, - "mysqlExportOptions": { - "type": "MysqlExportOptions", - "id": 3 - }, - "threads": { - "type": "google.protobuf.Int32Value", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "parallel": { - "type": "google.protobuf.BoolValue", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "postgresExportOptions": { - "type": "PostgresExportOptions", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "MysqlExportOptions": { - "fields": { - "masterData": { - "type": "google.protobuf.Int32Value", - "id": 1 - } - } - }, - "PostgresExportOptions": { - "fields": { - "clean": { - "type": "google.protobuf.BoolValue", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "ifExists": { - "type": "google.protobuf.BoolValue", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - } - } - }, - "SqlBakExportOptions": { - "fields": { - "striped": { - "type": "google.protobuf.BoolValue", - "id": 1 - }, - "stripeCount": { - "type": "google.protobuf.Int32Value", - "id": 2 - }, - "bakType": { - "type": "BakType", - "id": 4 - }, - "copyOnly": { - "type": "google.protobuf.BoolValue", - "id": 5, - "options": { - "deprecated": true - } - }, - "differentialBase": { - "type": "google.protobuf.BoolValue", - "id": 6 - }, - "exportLogStartTime": { - "type": "google.protobuf.Timestamp", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "exportLogEndTime": { - "type": "google.protobuf.Timestamp", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlTdeExportOptions": { - "fields": { - "certificatePath": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "privateKeyPath": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "privateKeyPassword": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "name": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - } - } - }, - "FailoverContext": { - "fields": { - "settingsVersion": { - "type": "int64", - "id": 1 - }, - "kind": { - "type": "string", - "id": 2 - } - } - }, - "Flag": { - "oneofs": { - "recommendedValue": { - "oneof": [ - "recommendedStringValue", - "recommendedIntValue" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "type": { - "type": "SqlFlagType", - "id": 2 - }, - "appliesTo": { - "rule": "repeated", - "type": "SqlDatabaseVersion", - "id": 3 - }, - "allowedStringValues": { - "rule": "repeated", - "type": "string", - "id": 4 - }, - "minValue": { - "type": "google.protobuf.Int64Value", - "id": 5 - }, - "maxValue": { - "type": "google.protobuf.Int64Value", - "id": 6 - }, - "requiresRestart": { - "type": "google.protobuf.BoolValue", - "id": 7 - }, - "kind": { - "type": "string", - "id": 8 - }, - "inBeta": { - "type": "google.protobuf.BoolValue", - "id": 9 - }, - "allowedIntValues": { - "rule": "repeated", - "type": "int64", - "id": 10 - }, - "flagScope": { - "type": "SqlFlagScope", - "id": 15 - }, - "recommendedStringValue": { - "type": "string", - "id": 16 - }, - "recommendedIntValue": { - "type": "google.protobuf.Int64Value", - "id": 17 - } - } - }, - "FlagsListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "Flag", - "id": 2 - } - } - }, - "ImportContext": { - "fields": { - "uri": { - "type": "string", - "id": 1 - }, - "database": { - "type": "string", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - }, - "fileType": { - "type": "SqlFileType", - "id": 4 - }, - "csvImportOptions": { - "type": "SqlCsvImportOptions", - "id": 5 - }, - "importUser": { - "type": "string", - "id": 6 - }, - "bakImportOptions": { - "type": "SqlBakImportOptions", - "id": 7 - }, - "sqlImportOptions": { - "type": "SqlImportOptions", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "tdeImportOptions": { - "type": "SqlTdeImportOptions", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SqlImportOptions": { - "fields": { - "threads": { - "type": "google.protobuf.Int32Value", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "parallel": { - "type": "google.protobuf.BoolValue", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "postgresImportOptions": { - "type": "PostgresImportOptions", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "PostgresImportOptions": { - "fields": { - "clean": { - "type": "google.protobuf.BoolValue", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "ifExists": { - "type": "google.protobuf.BoolValue", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - } - } - }, - "SqlCsvImportOptions": { - "fields": { - "table": { - "type": "string", - "id": 1 - }, - "columns": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "escapeCharacter": { - "type": "string", - "id": 4 - }, - "quoteCharacter": { - "type": "string", - "id": 5 - }, - "fieldsTerminatedBy": { - "type": "string", - "id": 6 - }, - "linesTerminatedBy": { - "type": "string", - "id": 8 - } - } - }, - "SqlBakImportOptions": { - "fields": { - "encryptionOptions": { - "type": "EncryptionOptions", - "id": 1 - }, - "striped": { - "type": "google.protobuf.BoolValue", - "id": 2 - }, - "noRecovery": { - "type": "google.protobuf.BoolValue", - "id": 4 - }, - "recoveryOnly": { - "type": "google.protobuf.BoolValue", - "id": 5 - }, - "bakType": { - "type": "BakType", - "id": 6 - }, - "stopAt": { - "type": "google.protobuf.Timestamp", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "stopAtMark": { - "type": "string", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "EncryptionOptions": { - "fields": { - "certPath": { - "type": "string", - "id": 1 - }, - "pvkPath": { - "type": "string", - "id": 2 - }, - "pvkPassword": { - "type": "string", - "id": 3 - }, - "keepEncrypted": { - "type": "google.protobuf.BoolValue", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - } - } - }, - "SqlTdeImportOptions": { - "fields": { - "certificatePath": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "privateKeyPath": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "privateKeyPassword": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "name": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - } - } - }, - "BakType": { - "values": { - "BAK_TYPE_UNSPECIFIED": 0, - "FULL": 1, - "DIFF": 2, - "TLOG": 3 - } - }, - "InstancesCloneRequest": { - "fields": { - "cloneContext": { - "type": "CloneContext", - "id": 1 - } - } - }, - "InstancesDemoteMasterRequest": { - "fields": { - "demoteMasterContext": { - "type": "DemoteMasterContext", - "id": 1 - } - } - }, - "InstancesDemoteRequest": { - "fields": { - "demoteContext": { - "type": "DemoteContext", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "InstancesExportRequest": { - "fields": { - "exportContext": { - "type": "ExportContext", - "id": 1 - } - } - }, - "InstancesFailoverRequest": { - "fields": { - "failoverContext": { - "type": "FailoverContext", - "id": 1 - } - } - }, - "InstancesImportRequest": { - "fields": { - "importContext": { - "type": "ImportContext", - "id": 1 - } - } - }, - "InstancesPreCheckMajorVersionUpgradeRequest": { - "fields": { - "preCheckMajorVersionUpgradeContext": { - "type": "PreCheckMajorVersionUpgradeContext", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "MySqlSyncConfig": { - "fields": { - "initialSyncFlags": { - "rule": "repeated", - "type": "SyncFlags", - "id": 1 - } - } - }, - "InstancesListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "warnings": { - "rule": "repeated", - "type": "ApiWarning", - "id": 2 - }, - "items": { - "rule": "repeated", - "type": "DatabaseInstance", - "id": 3 - }, - "nextPageToken": { - "type": "string", - "id": 4 - } - } - }, - "InstancesListServerCasResponse": { - "fields": { - "certs": { - "rule": "repeated", - "type": "SslCert", - "id": 1 - }, - "activeVersion": { - "type": "string", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - } - } - }, - "InstancesListServerCertificatesResponse": { - "fields": { - "caCerts": { - "rule": "repeated", - "type": "SslCert", - "id": 1 - }, - "serverCerts": { - "rule": "repeated", - "type": "SslCert", - "id": 2 - }, - "activeVersion": { - "type": "string", - "id": 3 - }, - "kind": { - "type": "string", - "id": 4 - } - } - }, - "InstancesListEntraIdCertificatesResponse": { - "fields": { - "certs": { - "rule": "repeated", - "type": "SslCert", - "id": 1 - }, - "activeVersion": { - "type": "string", - "id": 2 - }, - "kind": { - "type": "string", - "id": 3 - } - } - }, - "InstancesRestoreBackupRequest": { - "fields": { - "restoreBackupContext": { - "type": "RestoreBackupContext", - "id": 1 - }, - "backup": { - "type": "string", - "id": 2, - "options": { - "(google.api.resource_reference).type": "sqladmin.googleapis.com/Backup" - } - }, - "backupdrBackup": { - "type": "string", - "id": 4, - "options": { - "(google.api.resource_reference).type": "backupdr.googleapis.com/Backup" - } - }, - "restoreInstanceSettings": { - "type": "DatabaseInstance", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "restoreInstanceClearOverridesFieldNames": { - "rule": "repeated", - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "InstancesRotateServerCaRequest": { - "fields": { - "rotateServerCaContext": { - "type": "RotateServerCaContext", - "id": 1 - } - } - }, - "InstancesRotateServerCertificateRequest": { - "fields": { - "rotateServerCertificateContext": { - "type": "RotateServerCertificateContext", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "InstancesRotateEntraIdCertificateRequest": { - "fields": { - "rotateEntraIdCertificateContext": { - "type": "RotateEntraIdCertificateContext", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "InstancesTruncateLogRequest": { - "fields": { - "truncateLogContext": { - "type": "TruncateLogContext", - "id": 1 - } - } - }, - "InstancesAcquireSsrsLeaseRequest": { - "fields": { - "acquireSsrsLeaseContext": { - "type": "AcquireSsrsLeaseContext", - "id": 1 - } - } - }, - "PointInTimeRestoreContext": { - "oneofs": { - "_datasource": { - "oneof": [ - "datasource" - ] - }, - "_targetInstance": { - "oneof": [ - "targetInstance" - ] - }, - "_privateNetwork": { - "oneof": [ - "privateNetwork" - ] - }, - "_allocatedIpRange": { - "oneof": [ - "allocatedIpRange" - ] - }, - "_preferredZone": { - "oneof": [ - "preferredZone" - ] - }, - "_preferredSecondaryZone": { - "oneof": [ - "preferredSecondaryZone" - ] - } - }, - "fields": { - "datasource": { - "type": "string", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "pointInTime": { - "type": "google.protobuf.Timestamp", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "targetInstance": { - "type": "string", - "id": 3, - "options": { - "proto3_optional": true - } - }, - "privateNetwork": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "allocatedIpRange": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "preferredZone": { - "type": "string", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "preferredSecondaryZone": { - "type": "string", - "id": 9, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - } - } - }, - "PerformDiskShrinkContext": { - "fields": { - "targetSizeGb": { - "type": "int64", - "id": 1 - } - } - }, - "PreCheckResponse": { - "oneofs": { - "_message": { - "oneof": [ - "message" - ] - }, - "_messageType": { - "oneof": [ - "messageType" - ] - } - }, - "fields": { - "message": { - "type": "string", - "id": 2, - "options": { - "proto3_optional": true - } - }, - "messageType": { - "type": "MessageType", - "id": 3, - "options": { - "proto3_optional": true - } - }, - "actionsRequired": { - "rule": "repeated", - "type": "string", - "id": 4 - } - }, - "nested": { - "MessageType": { - "values": { - "MESSAGE_TYPE_UNSPECIFIED": 0, - "INFO": 1, - "WARNING": 2, - "ERROR": 3 - } - } - } - }, - "PreCheckMajorVersionUpgradeContext": { - "fields": { - "targetDatabaseVersion": { - "type": "SqlDatabaseVersion", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "preCheckResponse": { - "rule": "repeated", - "type": "PreCheckResponse", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "kind": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlInstancesGetDiskShrinkConfigResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "minimalTargetSizeGb": { - "type": "int64", - "id": 2 - }, - "message": { - "type": "string", - "id": 3 - } - } - }, - "SqlInstancesVerifyExternalSyncSettingsResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "errors": { - "rule": "repeated", - "type": "SqlExternalSyncSettingError", - "id": 2 - }, - "warnings": { - "rule": "repeated", - "type": "SqlExternalSyncSettingError", - "id": 3 - } - } - }, - "SqlExternalSyncSettingError": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "type": { - "type": "SqlExternalSyncSettingErrorType", - "id": 2 - }, - "detail": { - "type": "string", - "id": 3 - } - }, - "nested": { - "SqlExternalSyncSettingErrorType": { - "values": { - "SQL_EXTERNAL_SYNC_SETTING_ERROR_TYPE_UNSPECIFIED": 0, - "CONNECTION_FAILURE": 1, - "BINLOG_NOT_ENABLED": 2, - "INCOMPATIBLE_DATABASE_VERSION": 3, - "REPLICA_ALREADY_SETUP": 4, - "INSUFFICIENT_PRIVILEGE": 5, - "UNSUPPORTED_MIGRATION_TYPE": 6, - "NO_PGLOGICAL_INSTALLED": 7, - "PGLOGICAL_NODE_ALREADY_EXISTS": 8, - "INVALID_WAL_LEVEL": 9, - "INVALID_SHARED_PRELOAD_LIBRARY": 10, - "INSUFFICIENT_MAX_REPLICATION_SLOTS": 11, - "INSUFFICIENT_MAX_WAL_SENDERS": 12, - "INSUFFICIENT_MAX_WORKER_PROCESSES": 13, - "UNSUPPORTED_EXTENSIONS": 14, - "INVALID_RDS_LOGICAL_REPLICATION": 15, - "INVALID_LOGGING_SETUP": 16, - "INVALID_DB_PARAM": 17, - "UNSUPPORTED_GTID_MODE": 18, - "SQLSERVER_AGENT_NOT_RUNNING": 19, - "UNSUPPORTED_TABLE_DEFINITION": 20, - "UNSUPPORTED_DEFINER": 21, - "SQLSERVER_SERVERNAME_MISMATCH": 22, - "PRIMARY_ALREADY_SETUP": 23, - "UNSUPPORTED_BINLOG_FORMAT": 24, - "BINLOG_RETENTION_SETTING": 25, - "UNSUPPORTED_STORAGE_ENGINE": 26, - "LIMITED_SUPPORT_TABLES": 27, - "EXISTING_DATA_IN_REPLICA": 28, - "MISSING_OPTIONAL_PRIVILEGES": 29, - "RISKY_BACKUP_ADMIN_PRIVILEGE": 30, - "INSUFFICIENT_GCS_PERMISSIONS": 31, - "INVALID_FILE_INFO": 32, - "UNSUPPORTED_DATABASE_SETTINGS": 33, - "MYSQL_PARALLEL_IMPORT_INSUFFICIENT_PRIVILEGE": 34, - "LOCAL_INFILE_OFF": 35, - "TURN_ON_PITR_AFTER_PROMOTE": 36, - "INCOMPATIBLE_DATABASE_MINOR_VERSION": 37, - "SOURCE_MAX_SUBSCRIPTIONS": 38, - "UNABLE_TO_VERIFY_DEFINERS": 39, - "SUBSCRIPTION_CALCULATION_STATUS": 40, - "PG_SUBSCRIPTION_COUNT": 41, - "PG_SYNC_PARALLEL_LEVEL": 42, - "INSUFFICIENT_DISK_SIZE": 43, - "INSUFFICIENT_MACHINE_TIER": 44, - "UNSUPPORTED_EXTENSIONS_NOT_MIGRATED": 45, - "EXTENSIONS_NOT_MIGRATED": 46, - "PG_CRON_FLAG_ENABLED_IN_REPLICA": 47, - "EXTENSIONS_NOT_ENABLED_IN_REPLICA": 48, - "UNSUPPORTED_COLUMNS": 49, - "USERS_NOT_CREATED_IN_REPLICA": 50, - "UNSUPPORTED_SYSTEM_OBJECTS": 51, - "UNSUPPORTED_TABLES_WITH_REPLICA_IDENTITY": 52, - "SELECTED_OBJECTS_NOT_EXIST_ON_SOURCE": 53, - "PSC_ONLY_INSTANCE_WITH_NO_NETWORK_ATTACHMENT_URI": 54, - "SELECTED_OBJECTS_REFERENCE_UNSELECTED_OBJECTS": 55, - "PROMPT_DELETE_EXISTING": 56, - "WILL_DELETE_EXISTING": 57, - "PG_DDL_REPLICATION_INSUFFICIENT_PRIVILEGE": 58 - } - } - } - }, - "IpConfiguration": { - "oneofs": { - "_pscConfig": { - "oneof": [ - "pscConfig" - ] - }, - "_serverCaMode": { - "oneof": [ - "serverCaMode" - ] - }, - "_serverCaPool": { - "oneof": [ - "serverCaPool" - ] - }, - "_serverCertificateRotationMode": { - "oneof": [ - "serverCertificateRotationMode" - ] - } - }, - "fields": { - "ipv4Enabled": { - "type": "google.protobuf.BoolValue", - "id": 1 - }, - "privateNetwork": { - "type": "string", - "id": 2 - }, - "requireSsl": { - "type": "google.protobuf.BoolValue", - "id": 3 - }, - "authorizedNetworks": { - "rule": "repeated", - "type": "AclEntry", - "id": 4 - }, - "allocatedIpRange": { - "type": "string", - "id": 6 - }, - "enablePrivatePathForGoogleCloudServices": { - "type": "google.protobuf.BoolValue", - "id": 7 - }, - "sslMode": { - "type": "SslMode", - "id": 8 - }, - "pscConfig": { - "type": "PscConfig", - "id": 9, - "options": { - "proto3_optional": true - } - }, - "serverCaMode": { - "type": "CaMode", - "id": 10, - "options": { - "proto3_optional": true - } - }, - "customSubjectAlternativeNames": { - "rule": "repeated", - "type": "string", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "serverCaPool": { - "type": "string", - "id": 12, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "serverCertificateRotationMode": { - "type": "ServerCertificateRotationMode", - "id": 16, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - } - }, - "nested": { - "SslMode": { - "values": { - "SSL_MODE_UNSPECIFIED": 0, - "ALLOW_UNENCRYPTED_AND_ENCRYPTED": 1, - "ENCRYPTED_ONLY": 2, - "TRUSTED_CLIENT_CERTIFICATE_REQUIRED": 3 - } - }, - "CaMode": { - "values": { - "CA_MODE_UNSPECIFIED": 0, - "GOOGLE_MANAGED_INTERNAL_CA": 1, - "GOOGLE_MANAGED_CAS_CA": 2, - "CUSTOMER_MANAGED_CAS_CA": 3 - } - }, - "ServerCertificateRotationMode": { - "values": { - "SERVER_CERTIFICATE_ROTATION_MODE_UNSPECIFIED": 0, - "NO_AUTOMATIC_ROTATION": 1, - "AUTOMATIC_ROTATION_DURING_MAINTENANCE": 2 - } - } - } - }, - "PscConfig": { - "oneofs": { - "_pscEnabled": { - "oneof": [ - "pscEnabled" - ] - } - }, - "fields": { - "pscEnabled": { - "type": "bool", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "allowedConsumerProjects": { - "rule": "repeated", - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "pscAutoConnections": { - "rule": "repeated", - "type": "PscAutoConnectionConfig", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "networkAttachmentUri": { - "type": "string", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "PscAutoConnectionConfig": { - "oneofs": { - "_ipAddress": { - "oneof": [ - "ipAddress" - ] - }, - "_status": { - "oneof": [ - "status" - ] - }, - "_consumerNetworkStatus": { - "oneof": [ - "consumerNetworkStatus" - ] - } - }, - "fields": { - "consumerProject": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "consumerNetwork": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "ipAddress": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_info).format": "IPV4_OR_IPV6", - "proto3_optional": true - } - }, - "status": { - "type": "string", - "id": 4, - "options": { - "proto3_optional": true - } - }, - "consumerNetworkStatus": { - "type": "string", - "id": 5, - "options": { - "proto3_optional": true - } - } - } - }, - "IpMapping": { - "fields": { - "type": { - "type": "SqlIpAddressType", - "id": 1 - }, - "ipAddress": { - "type": "string", - "id": 2 - }, - "timeToRetire": { - "type": "google.protobuf.Timestamp", - "id": 3 - } - } - }, - "LocationPreference": { - "fields": { - "followGaeApplication": { - "type": "string", - "id": 1, - "options": { - "deprecated": true - } - }, - "zone": { - "type": "string", - "id": 2 - }, - "secondaryZone": { - "type": "string", - "id": 4 - }, - "kind": { - "type": "string", - "id": 3 - } - } - }, - "MaintenanceWindow": { - "fields": { - "hour": { - "type": "google.protobuf.Int32Value", - "id": 1 - }, - "day": { - "type": "google.protobuf.Int32Value", - "id": 2 - }, - "updateTrack": { - "type": "SqlUpdateTrack", - "id": 3 - }, - "kind": { - "type": "string", - "id": 4 - } - } - }, - "DenyMaintenancePeriod": { - "fields": { - "startDate": { - "type": "string", - "id": 1 - }, - "endDate": { - "type": "string", - "id": 2 - }, - "time": { - "type": "string", - "id": 3 - } - } - }, - "InsightsConfig": { - "fields": { - "queryInsightsEnabled": { - "type": "bool", - "id": 1 - }, - "recordClientAddress": { - "type": "bool", - "id": 2 - }, - "recordApplicationTags": { - "type": "bool", - "id": 3 - }, - "queryStringLength": { - "type": "google.protobuf.Int32Value", - "id": 4 - }, - "queryPlansPerMinute": { - "type": "google.protobuf.Int32Value", - "id": 5 - }, - "enhancedQueryInsightsEnabled": { - "type": "google.protobuf.BoolValue", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "MySqlReplicaConfiguration": { - "fields": { - "dumpFilePath": { - "type": "string", - "id": 1 - }, - "username": { - "type": "string", - "id": 2 - }, - "password": { - "type": "string", - "id": 3 - }, - "connectRetryInterval": { - "type": "google.protobuf.Int32Value", - "id": 4 - }, - "masterHeartbeatPeriod": { - "type": "google.protobuf.Int64Value", - "id": 5 - }, - "caCertificate": { - "type": "string", - "id": 6 - }, - "clientCertificate": { - "type": "string", - "id": 7 - }, - "clientKey": { - "type": "string", - "id": 8 - }, - "sslCipher": { - "type": "string", - "id": 9 - }, - "verifyServerCertificate": { - "type": "google.protobuf.BoolValue", - "id": 10 - }, - "kind": { - "type": "string", - "id": 11 - } - } - }, - "SelectedObjects": { - "fields": { - "database": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "OnPremisesConfiguration": { - "fields": { - "hostPort": { - "type": "string", - "id": 1 - }, - "kind": { - "type": "string", - "id": 2 - }, - "username": { - "type": "string", - "id": 3 - }, - "password": { - "type": "string", - "id": 4 - }, - "caCertificate": { - "type": "string", - "id": 5 - }, - "clientCertificate": { - "type": "string", - "id": 6 - }, - "clientKey": { - "type": "string", - "id": 7 - }, - "dumpFilePath": { - "type": "string", - "id": 8 - }, - "sourceInstance": { - "type": "InstanceReference", - "id": 15 - }, - "selectedObjects": { - "rule": "repeated", - "type": "SelectedObjects", - "id": 16, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "sslOption": { - "type": "SslOption", - "id": 18, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SslOption": { - "values": { - "SSL_OPTION_UNSPECIFIED": 0, - "DISABLE": 1, - "REQUIRE": 2, - "VERIFY_CA": 3 - } - } - } - }, - "DiskEncryptionConfiguration": { - "fields": { - "kmsKeyName": { - "type": "string", - "id": 1 - }, - "kind": { - "type": "string", - "id": 2 - } - } - }, - "DiskEncryptionStatus": { - "fields": { - "kmsKeyVersionName": { - "type": "string", - "id": 1 - }, - "kind": { - "type": "string", - "id": 2 - } - } - }, - "SqlMaintenanceType": { - "values": { - "SQL_MAINTENANCE_TYPE_UNSPECIFIED": 0, - "INSTANCE_MAINTENANCE": 1, - "REPLICA_INCLUDED_MAINTENANCE": 2, - "INSTANCE_SELF_SERVICE_MAINTENANCE": 3, - "REPLICA_INCLUDED_SELF_SERVICE_MAINTENANCE": 4 - } - }, - "SqlSubOperationType": { - "oneofs": { - "subOperationDetails": { - "oneof": [ - "maintenanceType" - ] - } - }, - "fields": { - "maintenanceType": { - "type": "SqlMaintenanceType", - "id": 1 - } - } - }, - "Operation": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "targetLink": { - "type": "string", - "id": 2 - }, - "status": { - "type": "SqlOperationStatus", - "id": 3 - }, - "user": { - "type": "string", - "id": 4 - }, - "insertTime": { - "type": "google.protobuf.Timestamp", - "id": 5 - }, - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 6 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 7 - }, - "error": { - "type": "OperationErrors", - "id": 8 - }, - "apiWarning": { - "type": "ApiWarning", - "id": 19 - }, - "operationType": { - "type": "SqlOperationType", - "id": 9 - }, - "importContext": { - "type": "ImportContext", - "id": 10 - }, - "exportContext": { - "type": "ExportContext", - "id": 11 - }, - "backupContext": { - "type": "BackupContext", - "id": 17 - }, - "preCheckMajorVersionUpgradeContext": { - "type": "PreCheckMajorVersionUpgradeContext", - "id": 50 - }, - "name": { - "type": "string", - "id": 12 - }, - "targetId": { - "type": "string", - "id": 13 - }, - "selfLink": { - "type": "string", - "id": 14 - }, - "targetProject": { - "type": "string", - "id": 15 - }, - "acquireSsrsLeaseContext": { - "type": "AcquireSsrsLeaseContext", - "id": 20 - }, - "subOperationType": { - "type": "SqlSubOperationType", - "id": 48, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SqlOperationType": { - "valuesOptions": { - "BACKUP": { - "deprecated": true - }, - "SNAPSHOT": { - "deprecated": true - }, - "ENABLE_PRIVATE_IP": { - "deprecated": true - }, - "DEFER_MAINTENANCE": { - "deprecated": true - }, - "CREATE_CLONE": { - "deprecated": true - }, - "CLUSTER_MAINTENANCE": { - "deprecated": true - }, - "SELF_SERVICE_MAINTENANCE": { - "deprecated": true - }, - "ADVANCED_BACKUP": { - "deprecated": true - } - }, - "values": { - "SQL_OPERATION_TYPE_UNSPECIFIED": 0, - "IMPORT": 1, - "EXPORT": 2, - "CREATE": 3, - "UPDATE": 4, - "DELETE": 5, - "RESTART": 6, - "BACKUP": 7, - "SNAPSHOT": 8, - "BACKUP_VOLUME": 9, - "DELETE_VOLUME": 10, - "RESTORE_VOLUME": 11, - "INJECT_USER": 12, - "CLONE": 14, - "STOP_REPLICA": 15, - "START_REPLICA": 16, - "PROMOTE_REPLICA": 17, - "CREATE_REPLICA": 18, - "CREATE_USER": 19, - "DELETE_USER": 20, - "UPDATE_USER": 21, - "CREATE_DATABASE": 22, - "DELETE_DATABASE": 23, - "UPDATE_DATABASE": 24, - "FAILOVER": 25, - "DELETE_BACKUP": 26, - "RECREATE_REPLICA": 27, - "TRUNCATE_LOG": 28, - "DEMOTE_MASTER": 29, - "MAINTENANCE": 30, - "ENABLE_PRIVATE_IP": 31, - "DEFER_MAINTENANCE": 32, - "CREATE_CLONE": 33, - "RESCHEDULE_MAINTENANCE": 34, - "START_EXTERNAL_SYNC": 35, - "LOG_CLEANUP": 36, - "AUTO_RESTART": 37, - "REENCRYPT": 38, - "SWITCHOVER": 39, - "UPDATE_BACKUP": 40, - "ACQUIRE_SSRS_LEASE": 42, - "RELEASE_SSRS_LEASE": 43, - "RECONFIGURE_OLD_PRIMARY": 44, - "CLUSTER_MAINTENANCE": 45, - "SELF_SERVICE_MAINTENANCE": 46, - "SWITCHOVER_TO_REPLICA": 47, - "MAJOR_VERSION_UPGRADE": 48, - "ADVANCED_BACKUP": 49, - "MANAGE_BACKUP": 50, - "ENHANCED_BACKUP": 51, - "REPAIR_READ_POOL": 52, - "CREATE_READ_POOL": 53 - } - }, - "SqlOperationStatus": { - "values": { - "SQL_OPERATION_STATUS_UNSPECIFIED": 0, - "PENDING": 1, - "RUNNING": 2, - "DONE": 3 - } - } - } - }, - "OperationError": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "code": { - "type": "string", - "id": 2 - }, - "message": { - "type": "string", - "id": 3 - } - } - }, - "OperationErrors": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "errors": { - "rule": "repeated", - "type": "OperationError", - "id": 2 - } - } - }, - "PasswordValidationPolicy": { - "fields": { - "minLength": { - "type": "google.protobuf.Int32Value", - "id": 1 - }, - "complexity": { - "type": "Complexity", - "id": 2 - }, - "reuseInterval": { - "type": "google.protobuf.Int32Value", - "id": 3 - }, - "disallowUsernameSubstring": { - "type": "google.protobuf.BoolValue", - "id": 4 - }, - "passwordChangeInterval": { - "type": "google.protobuf.Duration", - "id": 5 - }, - "enablePasswordPolicy": { - "type": "google.protobuf.BoolValue", - "id": 6 - }, - "disallowCompromisedCredentials": { - "type": "google.protobuf.BoolValue", - "id": 7, - "options": { - "deprecated": true - } - } - }, - "nested": { - "Complexity": { - "values": { - "COMPLEXITY_UNSPECIFIED": 0, - "COMPLEXITY_DEFAULT": 1 - } - } - } - }, - "OperationsListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "Operation", - "id": 2 - }, - "nextPageToken": { - "type": "string", - "id": 3 - } - } - }, - "ReplicaConfiguration": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "mysqlReplicaConfiguration": { - "type": "MySqlReplicaConfiguration", - "id": 2 - }, - "failoverTarget": { - "type": "google.protobuf.BoolValue", - "id": 3 - }, - "cascadableReplica": { - "type": "google.protobuf.BoolValue", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "RestoreBackupContext": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "backupRunId": { - "type": "int64", - "id": 2 - }, - "instanceId": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - } - } - }, - "RotateServerCaContext": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "nextVersion": { - "type": "string", - "id": 2 - } - } - }, - "RotateServerCertificateContext": { - "fields": { - "kind": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "nextVersion": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "RotateEntraIdCertificateContext": { - "fields": { - "kind": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "nextVersion": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "DataCacheConfig": { - "fields": { - "dataCacheEnabled": { - "type": "bool", - "id": 1 - } - } - }, - "FinalBackupConfig": { - "oneofs": { - "_enabled": { - "oneof": [ - "enabled" - ] - }, - "_retentionDays": { - "oneof": [ - "retentionDays" - ] - } - }, - "fields": { - "enabled": { - "type": "bool", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "retentionDays": { - "type": "int32", - "id": 3, - "options": { - "proto3_optional": true - } - } - } - }, - "Settings": { - "oneofs": { - "_dataDiskProvisionedIops": { - "oneof": [ - "dataDiskProvisionedIops" - ] - }, - "_dataDiskProvisionedThroughput": { - "oneof": [ - "dataDiskProvisionedThroughput" - ] - }, - "_connectionPoolConfig": { - "oneof": [ - "connectionPoolConfig" - ] - }, - "_finalBackupConfig": { - "oneof": [ - "finalBackupConfig" - ] - }, - "_readPoolAutoScaleConfig": { - "oneof": [ - "readPoolAutoScaleConfig" - ] - }, - "_autoUpgradeEnabled": { - "oneof": [ - "autoUpgradeEnabled" - ] - }, - "_dataApiAccess": { - "oneof": [ - "dataApiAccess" - ] - } - }, - "fields": { - "settingsVersion": { - "type": "google.protobuf.Int64Value", - "id": 1 - }, - "authorizedGaeApplications": { - "rule": "repeated", - "type": "string", - "id": 2, - "options": { - "deprecated": true - } - }, - "tier": { - "type": "string", - "id": 3 - }, - "kind": { - "type": "string", - "id": 4 - }, - "userLabels": { - "keyType": "string", - "type": "string", - "id": 5 - }, - "availabilityType": { - "type": "SqlAvailabilityType", - "id": 6 - }, - "pricingPlan": { - "type": "SqlPricingPlan", - "id": 7 - }, - "replicationType": { - "type": "SqlReplicationType", - "id": 8, - "options": { - "deprecated": true - } - }, - "storageAutoResizeLimit": { - "type": "google.protobuf.Int64Value", - "id": 9 - }, - "activationPolicy": { - "type": "SqlActivationPolicy", - "id": 10 - }, - "ipConfiguration": { - "type": "IpConfiguration", - "id": 11 - }, - "storageAutoResize": { - "type": "google.protobuf.BoolValue", - "id": 12 - }, - "locationPreference": { - "type": "LocationPreference", - "id": 13 - }, - "databaseFlags": { - "rule": "repeated", - "type": "DatabaseFlags", - "id": 14 - }, - "dataDiskType": { - "type": "SqlDataDiskType", - "id": 15 - }, - "maintenanceWindow": { - "type": "MaintenanceWindow", - "id": 16 - }, - "backupConfiguration": { - "type": "BackupConfiguration", - "id": 17 - }, - "databaseReplicationEnabled": { - "type": "google.protobuf.BoolValue", - "id": 18 - }, - "crashSafeReplicationEnabled": { - "type": "google.protobuf.BoolValue", - "id": 19, - "options": { - "deprecated": true - } - }, - "dataDiskSizeGb": { - "type": "google.protobuf.Int64Value", - "id": 20 - }, - "activeDirectoryConfig": { - "type": "SqlActiveDirectoryConfig", - "id": 22 - }, - "collation": { - "type": "string", - "id": 23 - }, - "denyMaintenancePeriods": { - "rule": "repeated", - "type": "DenyMaintenancePeriod", - "id": 24 - }, - "insightsConfig": { - "type": "InsightsConfig", - "id": 25 - }, - "passwordValidationPolicy": { - "type": "PasswordValidationPolicy", - "id": 27 - }, - "sqlServerAuditConfig": { - "type": "SqlServerAuditConfig", - "id": 29 - }, - "edition": { - "type": "Edition", - "id": 38, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "connectorEnforcement": { - "type": "ConnectorEnforcement", - "id": 32 - }, - "deletionProtectionEnabled": { - "type": "google.protobuf.BoolValue", - "id": 33 - }, - "timeZone": { - "type": "string", - "id": 34 - }, - "advancedMachineFeatures": { - "type": "AdvancedMachineFeatures", - "id": 35 - }, - "dataCacheConfig": { - "type": "DataCacheConfig", - "id": 37 - }, - "replicationLagMaxSeconds": { - "type": "google.protobuf.Int32Value", - "id": 39, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "enableGoogleMlIntegration": { - "type": "google.protobuf.BoolValue", - "id": 40, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "enableDataplexIntegration": { - "type": "google.protobuf.BoolValue", - "id": 41, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "retainBackupsOnDelete": { - "type": "google.protobuf.BoolValue", - "id": 42, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "dataDiskProvisionedIops": { - "type": "int64", - "id": 43, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "dataDiskProvisionedThroughput": { - "type": "int64", - "id": 44, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "connectionPoolConfig": { - "type": "ConnectionPoolConfig", - "id": 45, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "finalBackupConfig": { - "type": "FinalBackupConfig", - "id": 47, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "readPoolAutoScaleConfig": { - "type": "ReadPoolAutoScaleConfig", - "id": 48, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "autoUpgradeEnabled": { - "type": "bool", - "id": 50, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "entraidConfig": { - "type": "SqlServerEntraIdConfig", - "id": 52, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "dataApiAccess": { - "type": "DataApiAccess", - "id": 53, - "options": { - "proto3_optional": true - } - }, - "performanceCaptureConfig": { - "type": "PerformanceCaptureConfig", - "id": 54, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SqlActivationPolicy": { - "valuesOptions": { - "ON_DEMAND": { - "deprecated": true - } - }, - "values": { - "SQL_ACTIVATION_POLICY_UNSPECIFIED": 0, - "ALWAYS": 1, - "NEVER": 2, - "ON_DEMAND": 3 - } - }, - "Edition": { - "values": { - "EDITION_UNSPECIFIED": 0, - "ENTERPRISE": 2, - "ENTERPRISE_PLUS": 3 - } - }, - "ConnectorEnforcement": { - "values": { - "CONNECTOR_ENFORCEMENT_UNSPECIFIED": 0, - "NOT_REQUIRED": 1, - "REQUIRED": 2 - } - }, - "DataApiAccess": { - "values": { - "DATA_API_ACCESS_UNSPECIFIED": 0, - "DISALLOW_DATA_API": 1, - "ALLOW_DATA_API": 2 - } - } - } - }, - "PerformanceCaptureConfig": { - "oneofs": { - "_enabled": { - "oneof": [ - "enabled" - ] - }, - "_probingIntervalSeconds": { - "oneof": [ - "probingIntervalSeconds" - ] - }, - "_probeThreshold": { - "oneof": [ - "probeThreshold" - ] - }, - "_runningThreadsThreshold": { - "oneof": [ - "runningThreadsThreshold" - ] - }, - "_secondsBehindSourceThreshold": { - "oneof": [ - "secondsBehindSourceThreshold" - ] - }, - "_transactionDurationThreshold": { - "oneof": [ - "transactionDurationThreshold" - ] - } - }, - "fields": { - "enabled": { - "type": "bool", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "probingIntervalSeconds": { - "type": "int32", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "probeThreshold": { - "type": "int32", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "runningThreadsThreshold": { - "type": "int32", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "secondsBehindSourceThreshold": { - "type": "int32", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "transactionDurationThreshold": { - "type": "int32", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - } - } - }, - "AdvancedMachineFeatures": { - "fields": { - "threadsPerCore": { - "type": "int32", - "id": 1 - } - } - }, - "SslCert": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "certSerialNumber": { - "type": "string", - "id": 2 - }, - "cert": { - "type": "string", - "id": 3 - }, - "createTime": { - "type": "google.protobuf.Timestamp", - "id": 4 - }, - "commonName": { - "type": "string", - "id": 5 - }, - "expirationTime": { - "type": "google.protobuf.Timestamp", - "id": 6 - }, - "sha1Fingerprint": { - "type": "string", - "id": 7 - }, - "instance": { - "type": "string", - "id": 8 - }, - "selfLink": { - "type": "string", - "id": 9 - } - } - }, - "SslCertDetail": { - "fields": { - "certInfo": { - "type": "SslCert", - "id": 1 - }, - "certPrivateKey": { - "type": "string", - "id": 2 - } - } - }, - "SslCertsCreateEphemeralRequest": { - "fields": { - "publicKey": { - "type": "string", - "id": 1, - "options": { - "json_name": "public_key" - } - }, - "accessToken": { - "type": "string", - "id": 2, - "options": { - "json_name": "access_token" - } - } - } - }, - "SslCertsInsertRequest": { - "fields": { - "commonName": { - "type": "string", - "id": 1 - } - } - }, - "SqlInstancesRescheduleMaintenanceRequestBody": { - "fields": { - "reschedule": { - "type": "Reschedule", - "id": 3 - } - }, - "nested": { - "RescheduleType": { - "values": { - "RESCHEDULE_TYPE_UNSPECIFIED": 0, - "IMMEDIATE": 1, - "NEXT_AVAILABLE_WINDOW": 2, - "SPECIFIC_TIME": 3 - } - }, - "Reschedule": { - "fields": { - "rescheduleType": { - "type": "RescheduleType", - "id": 1 - }, - "scheduleTime": { - "type": "google.protobuf.Timestamp", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - } - } - }, - "SslCertsInsertResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "operation": { - "type": "Operation", - "id": 2 - }, - "serverCaCert": { - "type": "SslCert", - "id": 3 - }, - "clientCert": { - "type": "SslCertDetail", - "id": 4 - } - } - }, - "SslCertsListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "SslCert", - "id": 2 - } - } - }, - "TruncateLogContext": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "logType": { - "type": "string", - "id": 2 - } - } - }, - "SqlActiveDirectoryConfig": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "domain": { - "type": "string", - "id": 2 - }, - "mode": { - "type": "ActiveDirectoryMode", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "dnsServers": { - "rule": "repeated", - "type": "string", - "id": 4, - "options": { - "(google.api.field_info).format": "IPV4", - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "adminCredentialSecretName": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "organizationalUnit": { - "type": "string", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "ActiveDirectoryMode": { - "valuesOptions": { - "SELF_MANAGED_ACTIVE_DIRECTORY": { - "deprecated": true - } - }, - "values": { - "ACTIVE_DIRECTORY_MODE_UNSPECIFIED": 0, - "MANAGED_ACTIVE_DIRECTORY": 1, - "SELF_MANAGED_ACTIVE_DIRECTORY": 2, - "CUSTOMER_MANAGED_ACTIVE_DIRECTORY": 3 - } - } - } - }, - "SqlServerAuditConfig": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "bucket": { - "type": "string", - "id": 2 - }, - "retentionInterval": { - "type": "google.protobuf.Duration", - "id": 3 - }, - "uploadInterval": { - "type": "google.protobuf.Duration", - "id": 4 - } - } - }, - "SqlServerEntraIdConfig": { - "fields": { - "kind": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "tenantId": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "applicationId": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "SqlBackupRunStatus": { - "values": { - "SQL_BACKUP_RUN_STATUS_UNSPECIFIED": 0, - "ENQUEUED": 1, - "OVERDUE": 2, - "RUNNING": 3, - "FAILED": 4, - "SUCCESSFUL": 5, - "SKIPPED": 6, - "DELETION_PENDING": 7, - "DELETION_FAILED": 8, - "DELETED": 9 - } - }, - "SqlBackupRunType": { - "values": { - "SQL_BACKUP_RUN_TYPE_UNSPECIFIED": 0, - "AUTOMATED": 1, - "ON_DEMAND": 2 - } - }, - "SqlBackupKind": { - "values": { - "SQL_BACKUP_KIND_UNSPECIFIED": 0, - "SNAPSHOT": 1, - "PHYSICAL": 2 - } - }, - "SqlBackendType": { - "valuesOptions": { - "FIRST_GEN": { - "deprecated": true - } - }, - "values": { - "SQL_BACKEND_TYPE_UNSPECIFIED": 0, - "FIRST_GEN": 1, - "SECOND_GEN": 2, - "EXTERNAL": 3 - } - }, - "SqlIpAddressType": { - "values": { - "SQL_IP_ADDRESS_TYPE_UNSPECIFIED": 0, - "PRIMARY": 1, - "OUTGOING": 2, - "PRIVATE": 3, - "MIGRATED_1ST_GEN": 4 - } - }, - "SqlInstanceType": { - "values": { - "SQL_INSTANCE_TYPE_UNSPECIFIED": 0, - "CLOUD_SQL_INSTANCE": 1, - "ON_PREMISES_INSTANCE": 2, - "READ_REPLICA_INSTANCE": 3, - "READ_POOL_INSTANCE": 5 - } - }, - "ConnectionPoolFlags": { - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - }, - "value": { - "type": "string", - "id": 2, - "options": { - "(google.api.field_behavior)": "REQUIRED" - } - } - } - }, - "ReadPoolAutoScaleConfig": { - "oneofs": { - "_enabled": { - "oneof": [ - "enabled" - ] - }, - "_minNodeCount": { - "oneof": [ - "minNodeCount" - ] - }, - "_maxNodeCount": { - "oneof": [ - "maxNodeCount" - ] - }, - "_disableScaleIn": { - "oneof": [ - "disableScaleIn" - ] - }, - "_scaleInCooldownSeconds": { - "oneof": [ - "scaleInCooldownSeconds" - ] - }, - "_scaleOutCooldownSeconds": { - "oneof": [ - "scaleOutCooldownSeconds" - ] - } - }, - "fields": { - "enabled": { - "type": "bool", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "minNodeCount": { - "type": "int32", - "id": 2, - "options": { - "proto3_optional": true - } - }, - "maxNodeCount": { - "type": "int32", - "id": 3, - "options": { - "proto3_optional": true - } - }, - "targetMetrics": { - "rule": "repeated", - "type": "TargetMetric", - "id": 4, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "disableScaleIn": { - "type": "bool", - "id": 5, - "options": { - "proto3_optional": true - } - }, - "scaleInCooldownSeconds": { - "type": "int32", - "id": 6, - "options": { - "proto3_optional": true - } - }, - "scaleOutCooldownSeconds": { - "type": "int32", - "id": 7, - "options": { - "proto3_optional": true - } - } - }, - "nested": { - "TargetMetric": { - "oneofs": { - "_metric": { - "oneof": [ - "metric" - ] - }, - "_targetValue": { - "oneof": [ - "targetValue" - ] - } - }, - "fields": { - "metric": { - "type": "string", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "targetValue": { - "type": "float", - "id": 2, - "options": { - "proto3_optional": true - } - } - } - } - } - }, - "ConnectionPoolConfig": { - "oneofs": { - "_connectionPoolingEnabled": { - "oneof": [ - "connectionPoolingEnabled" - ] - }, - "_poolerCount": { - "oneof": [ - "poolerCount" - ] - } - }, - "fields": { - "connectionPoolingEnabled": { - "type": "bool", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "flags": { - "rule": "repeated", - "type": "ConnectionPoolFlags", - "id": 8, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "poolerCount": { - "type": "int32", - "id": 9, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - } - } - }, - "SqlDatabaseVersion": { - "valuesOptions": { - "MYSQL_5_1": { - "deprecated": true - }, - "MYSQL_5_5": { - "deprecated": true - }, - "MYSQL_8_0_29": { - "deprecated": true - } - }, - "values": { - "SQL_DATABASE_VERSION_UNSPECIFIED": 0, - "MYSQL_5_1": 2, - "MYSQL_5_5": 3, - "MYSQL_5_6": 5, - "MYSQL_5_7": 6, - "MYSQL_8_0": 20, - "MYSQL_8_0_18": 41, - "MYSQL_8_0_26": 85, - "MYSQL_8_0_27": 111, - "MYSQL_8_0_28": 132, - "MYSQL_8_0_29": 148, - "MYSQL_8_0_30": 174, - "MYSQL_8_0_31": 197, - "MYSQL_8_0_32": 213, - "MYSQL_8_0_33": 238, - "MYSQL_8_0_34": 239, - "MYSQL_8_0_35": 240, - "MYSQL_8_0_36": 241, - "MYSQL_8_0_37": 355, - "MYSQL_8_0_39": 357, - "MYSQL_8_0_40": 358, - "MYSQL_8_0_41": 488, - "MYSQL_8_0_42": 489, - "MYSQL_8_0_43": 553, - "MYSQL_8_0_44": 554, - "MYSQL_8_0_45": 555, - "MYSQL_8_0_46": 556, - "MYSQL_8_4": 398, - "MYSQL_9_7": 654, - "SQLSERVER_2017_STANDARD": 11, - "SQLSERVER_2017_ENTERPRISE": 14, - "SQLSERVER_2017_EXPRESS": 15, - "SQLSERVER_2017_WEB": 16, - "POSTGRES_9_6": 9, - "POSTGRES_10": 18, - "POSTGRES_11": 10, - "POSTGRES_12": 19, - "POSTGRES_13": 23, - "POSTGRES_14": 110, - "POSTGRES_15": 172, - "POSTGRES_16": 272, - "POSTGRES_17": 408, - "POSTGRES_18": 557, - "SQLSERVER_2019_STANDARD": 26, - "SQLSERVER_2019_ENTERPRISE": 27, - "SQLSERVER_2019_EXPRESS": 28, - "SQLSERVER_2019_WEB": 29, - "SQLSERVER_2022_STANDARD": 199, - "SQLSERVER_2022_ENTERPRISE": 200, - "SQLSERVER_2022_EXPRESS": 201, - "SQLSERVER_2022_WEB": 202 - } - }, - "SqlSuspensionReason": { - "values": { - "SQL_SUSPENSION_REASON_UNSPECIFIED": 0, - "BILLING_ISSUE": 2, - "LEGAL_ISSUE": 3, - "OPERATIONAL_ISSUE": 4, - "KMS_KEY_ISSUE": 5 - } - }, - "SqlPricingPlan": { - "values": { - "SQL_PRICING_PLAN_UNSPECIFIED": 0, - "PACKAGE": 1, - "PER_USE": 2 - } - }, - "SqlReplicationType": { - "values": { - "SQL_REPLICATION_TYPE_UNSPECIFIED": 0, - "SYNCHRONOUS": 1, - "ASYNCHRONOUS": 2 - } - }, - "SqlDataDiskType": { - "valuesOptions": { - "OBSOLETE_LOCAL_SSD": { - "deprecated": true - } - }, - "values": { - "SQL_DATA_DISK_TYPE_UNSPECIFIED": 0, - "PD_SSD": 1, - "PD_HDD": 2, - "OBSOLETE_LOCAL_SSD": 3, - "HYPERDISK_BALANCED": 4 - } - }, - "SqlAvailabilityType": { - "values": { - "SQL_AVAILABILITY_TYPE_UNSPECIFIED": 0, - "ZONAL": 1, - "REGIONAL": 2 - } - }, - "SqlUpdateTrack": { - "values": { - "SQL_UPDATE_TRACK_UNSPECIFIED": 0, - "canary": 1, - "stable": 2, - "week5": 3 - } - }, - "AcquireSsrsLeaseContext": { - "oneofs": { - "_setupLogin": { - "oneof": [ - "setupLogin" - ] - }, - "_serviceLogin": { - "oneof": [ - "serviceLogin" - ] - }, - "_reportDatabase": { - "oneof": [ - "reportDatabase" - ] - }, - "_duration": { - "oneof": [ - "duration" - ] - } - }, - "fields": { - "setupLogin": { - "type": "string", - "id": 1, - "options": { - "proto3_optional": true - } - }, - "serviceLogin": { - "type": "string", - "id": 2, - "options": { - "proto3_optional": true - } - }, - "reportDatabase": { - "type": "string", - "id": 3, - "options": { - "proto3_optional": true - } - }, - "duration": { - "type": "google.protobuf.Duration", - "id": 4, - "options": { - "proto3_optional": true - } - } - } - }, - "SqlFlagType": { - "values": { - "SQL_FLAG_TYPE_UNSPECIFIED": 0, - "BOOLEAN": 1, - "STRING": 2, - "INTEGER": 3, - "NONE": 4, - "MYSQL_TIMEZONE_OFFSET": 5, - "FLOAT": 6, - "REPEATED_STRING": 7 - } - }, - "SqlFlagScope": { - "values": { - "SQL_FLAG_SCOPE_UNSPECIFIED": 0, - "SQL_FLAG_SCOPE_DATABASE": 1, - "SQL_FLAG_SCOPE_CONNECTION_POOL": 2 - } - }, - "SqlConnectService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "GetConnectSettings": { - "requestType": "GetConnectSettingsRequest", - "responseType": "ConnectSettings", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/connectSettings" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/connectSettings" - } - } - ] - }, - "GenerateEphemeralCert": { - "requestType": "GenerateEphemeralCertRequest", - "responseType": "GenerateEphemeralCertResponse", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}:generateEphemeralCert", - "(google.api.http).body": "*" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}:generateEphemeralCert", - "body": "*" - } - } - ] - } - } - }, - "GetConnectSettingsRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "readTime": { - "type": "google.protobuf.Timestamp", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "ConnectSettings": { - "oneofs": { - "_nodeCount": { - "oneof": [ - "nodeCount" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "serverCaCert": { - "type": "SslCert", - "id": 2 - }, - "ipAddresses": { - "rule": "repeated", - "type": "IpMapping", - "id": 3 - }, - "region": { - "type": "string", - "id": 4 - }, - "databaseVersion": { - "type": "SqlDatabaseVersion", - "id": 31 - }, - "backendType": { - "type": "SqlBackendType", - "id": 32 - }, - "pscEnabled": { - "type": "bool", - "id": 33 - }, - "dnsName": { - "type": "string", - "id": 34 - }, - "serverCaMode": { - "type": "CaMode", - "id": 35 - }, - "customSubjectAlternativeNames": { - "rule": "repeated", - "type": "string", - "id": 37 - }, - "dnsNames": { - "rule": "repeated", - "type": "DnsNameMapping", - "id": 38, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "nodeCount": { - "type": "int32", - "id": 63, - "options": { - "proto3_optional": true - } - }, - "nodes": { - "rule": "repeated", - "type": "ConnectPoolNodeConfig", - "id": 64, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "mdxProtocolSupport": { - "rule": "repeated", - "type": "MdxProtocolSupport", - "id": 39, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "CaMode": { - "values": { - "CA_MODE_UNSPECIFIED": 0, - "GOOGLE_MANAGED_INTERNAL_CA": 1, - "GOOGLE_MANAGED_CAS_CA": 2, - "CUSTOMER_MANAGED_CAS_CA": 3 - } - }, - "ConnectPoolNodeConfig": { - "oneofs": { - "_name": { - "oneof": [ - "name" - ] - }, - "_dnsName": { - "oneof": [ - "dnsName" - ] - } - }, - "fields": { - "name": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "ipAddresses": { - "rule": "repeated", - "type": "IpMapping", - "id": 2, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "dnsName": { - "type": "string", - "id": 3, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY", - "proto3_optional": true - } - }, - "dnsNames": { - "rule": "repeated", - "type": "DnsNameMapping", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - } - } - }, - "MdxProtocolSupport": { - "values": { - "MDX_PROTOCOL_SUPPORT_UNSPECIFIED": 0, - "CLIENT_PROTOCOL_TYPE": 1 - } - } - } - }, - "GenerateEphemeralCertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "publicKey": { - "type": "string", - "id": 3, - "options": { - "json_name": "public_key" - } - }, - "accessToken": { - "type": "string", - "id": 4, - "options": { - "json_name": "access_token", - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "readTime": { - "type": "google.protobuf.Timestamp", - "id": 7, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "validDuration": { - "type": "google.protobuf.Duration", - "id": 12, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - } - }, - "GenerateEphemeralCertResponse": { - "fields": { - "ephemeralCert": { - "type": "SslCert", - "id": 1 - } - } - }, - "SqlIamPoliciesService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com" - }, - "methods": {} - }, - "SqlTiersService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "List": { - "requestType": "SqlTiersListRequest", - "responseType": "TiersListResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/tiers" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/tiers" - } - } - ] - } - } - }, - "SqlTiersListRequest": { - "fields": { - "project": { - "type": "string", - "id": 1 - } - } - }, - "TiersListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "Tier", - "id": 2 - } - } - }, - "Tier": { - "fields": { - "tier": { - "type": "string", - "id": 1 - }, - "RAM": { - "type": "int64", - "id": 2, - "options": { - "json_name": "RAM" - } - }, - "kind": { - "type": "string", - "id": 3 - }, - "Disk_Quota": { - "type": "int64", - "id": 4, - "options": { - "json_name": "DiskQuota" - } - }, - "region": { - "rule": "repeated", - "type": "string", - "id": 5 - } - } - }, - "SqlUsersService": { - "options": { - "(google.api.default_host)": "sqladmin.googleapis.com", - "(google.api.oauth_scopes)": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/sqlservice.admin" - }, - "methods": { - "Delete": { - "requestType": "SqlUsersDeleteRequest", - "responseType": "Operation", - "options": { - "(google.api.http).delete": "/sql/v1beta4/projects/{project}/instances/{instance}/users" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "delete": "/sql/v1beta4/projects/{project}/instances/{instance}/users" - } - } - ] - }, - "Get": { - "requestType": "SqlUsersGetRequest", - "responseType": "User", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/users/{name}" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/users/{name}" - } - } - ] - }, - "Insert": { - "requestType": "SqlUsersInsertRequest", - "responseType": "Operation", - "options": { - "(google.api.http).post": "/sql/v1beta4/projects/{project}/instances/{instance}/users", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "post": "/sql/v1beta4/projects/{project}/instances/{instance}/users", - "body": "body" - } - } - ] - }, - "List": { - "requestType": "SqlUsersListRequest", - "responseType": "UsersListResponse", - "options": { - "(google.api.http).get": "/sql/v1beta4/projects/{project}/instances/{instance}/users" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "get": "/sql/v1beta4/projects/{project}/instances/{instance}/users" - } - } - ] - }, - "Update": { - "requestType": "SqlUsersUpdateRequest", - "responseType": "Operation", - "options": { - "(google.api.http).put": "/sql/v1beta4/projects/{project}/instances/{instance}/users", - "(google.api.http).body": "body" - }, - "parsedOptions": [ - { - "(google.api.http)": { - "put": "/sql/v1beta4/projects/{project}/instances/{instance}/users", - "body": "body" - } - } - ] - } - } - }, - "SqlUsersDeleteRequest": { - "fields": { - "host": { - "type": "string", - "id": 1 - }, - "instance": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - } - } - }, - "SqlUsersGetRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "name": { - "type": "string", - "id": 2 - }, - "project": { - "type": "string", - "id": 3 - }, - "host": { - "type": "string", - "id": 4 - } - } - }, - "SqlUsersInsertRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - }, - "body": { - "type": "User", - "id": 100 - } - } - }, - "SqlUsersListRequest": { - "fields": { - "instance": { - "type": "string", - "id": 1 - }, - "project": { - "type": "string", - "id": 2 - } - } - }, - "SqlUsersUpdateRequest": { - "oneofs": { - "_revokeExistingRoles": { - "oneof": [ - "revokeExistingRoles" - ] - } - }, - "fields": { - "host": { - "type": "string", - "id": 1, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "instance": { - "type": "string", - "id": 2 - }, - "name": { - "type": "string", - "id": 3 - }, - "project": { - "type": "string", - "id": 4 - }, - "databaseRoles": { - "rule": "repeated", - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "revokeExistingRoles": { - "type": "bool", - "id": 6, - "options": { - "(google.api.field_behavior)": "OPTIONAL", - "proto3_optional": true - } - }, - "body": { - "type": "User", - "id": 100 - } - } - }, - "UserPasswordValidationPolicy": { - "fields": { - "allowedFailedAttempts": { - "type": "int32", - "id": 1 - }, - "passwordExpirationDuration": { - "type": "google.protobuf.Duration", - "id": 2 - }, - "enableFailedAttemptsCheck": { - "type": "bool", - "id": 3 - }, - "status": { - "type": "PasswordStatus", - "id": 4, - "options": { - "(google.api.field_behavior)": "OUTPUT_ONLY" - } - }, - "enablePasswordVerification": { - "type": "bool", - "id": 5 - } - } - }, - "PasswordStatus": { - "fields": { - "locked": { - "type": "bool", - "id": 1 - }, - "passwordExpirationTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - } - } - }, - "User": { - "oneofs": { - "userDetails": { - "oneof": [ - "sqlserverUserDetails" - ] - }, - "_dualPasswordType": { - "oneof": [ - "dualPasswordType" - ] - }, - "_iamStatus": { - "oneof": [ - "iamStatus" - ] - } - }, - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "password": { - "type": "string", - "id": 2 - }, - "etag": { - "type": "string", - "id": 3 - }, - "name": { - "type": "string", - "id": 4 - }, - "host": { - "type": "string", - "id": 5, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "instance": { - "type": "string", - "id": 6 - }, - "project": { - "type": "string", - "id": 7 - }, - "type": { - "type": "SqlUserType", - "id": 8 - }, - "sqlserverUserDetails": { - "type": "SqlServerUserDetails", - "id": 9 - }, - "iamEmail": { - "type": "string", - "id": 11, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - }, - "passwordPolicy": { - "type": "UserPasswordValidationPolicy", - "id": 12 - }, - "dualPasswordType": { - "type": "DualPasswordType", - "id": 13, - "options": { - "proto3_optional": true - } - }, - "iamStatus": { - "type": "IamStatus", - "id": 14, - "options": { - "proto3_optional": true - } - }, - "databaseRoles": { - "rule": "repeated", - "type": "string", - "id": 15, - "options": { - "(google.api.field_behavior)": "OPTIONAL" - } - } - }, - "nested": { - "SqlUserType": { - "values": { - "BUILT_IN": 0, - "CLOUD_IAM_USER": 1, - "CLOUD_IAM_SERVICE_ACCOUNT": 2, - "CLOUD_IAM_GROUP": 3, - "CLOUD_IAM_GROUP_USER": 4, - "CLOUD_IAM_GROUP_SERVICE_ACCOUNT": 5, - "ENTRAID_USER": 7 - } - }, - "DualPasswordType": { - "values": { - "DUAL_PASSWORD_TYPE_UNSPECIFIED": 0, - "NO_MODIFY_DUAL_PASSWORD": 1, - "NO_DUAL_PASSWORD": 2, - "DUAL_PASSWORD": 3 - } - }, - "IamStatus": { - "values": { - "IAM_STATUS_UNSPECIFIED": 0, - "INACTIVE": 1, - "ACTIVE": 2 - } - } - } - }, - "SqlServerUserDetails": { - "fields": { - "disabled": { - "type": "bool", - "id": 1 - }, - "serverRoles": { - "rule": "repeated", - "type": "string", - "id": 2 - } - } - }, - "UsersListResponse": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "items": { - "rule": "repeated", - "type": "User", - "id": 2 - }, - "nextPageToken": { - "type": "string", - "id": 3, - "options": { - "deprecated": true - } - } - } - } - } - } - } - } - } - }, - "api": { - "options": { - "go_package": "google.golang.org/genproto/googleapis/api/annotations;annotations", - "java_multiple_files": true, - "java_outer_classname": "FieldInfoProto", - "java_package": "com.google.api", - "objc_class_prefix": "GAPI" - }, - "nested": { - "http": { - "type": "HttpRule", - "id": 72295728, - "extend": "google.protobuf.MethodOptions" - }, - "Http": { - "fields": { - "rules": { - "rule": "repeated", - "type": "HttpRule", - "id": 1 - }, - "fullyDecodeReservedExpansion": { - "type": "bool", - "id": 2 - } - } - }, - "HttpRule": { - "oneofs": { - "pattern": { - "oneof": [ - "get", - "put", - "post", - "delete", - "patch", - "custom" - ] - } - }, - "fields": { - "selector": { - "type": "string", - "id": 1 - }, - "get": { - "type": "string", - "id": 2 - }, - "put": { - "type": "string", - "id": 3 - }, - "post": { - "type": "string", - "id": 4 - }, - "delete": { - "type": "string", - "id": 5 - }, - "patch": { - "type": "string", - "id": 6 - }, - "custom": { - "type": "CustomHttpPattern", - "id": 8 - }, - "body": { - "type": "string", - "id": 7 - }, - "responseBody": { - "type": "string", - "id": 12 - }, - "additionalBindings": { - "rule": "repeated", - "type": "HttpRule", - "id": 11 - } - } - }, - "CustomHttpPattern": { - "fields": { - "kind": { - "type": "string", - "id": 1 - }, - "path": { - "type": "string", - "id": 2 - } - } - }, - "methodSignature": { - "rule": "repeated", - "type": "string", - "id": 1051, - "extend": "google.protobuf.MethodOptions" - }, - "defaultHost": { - "type": "string", - "id": 1049, - "extend": "google.protobuf.ServiceOptions" - }, - "oauthScopes": { - "type": "string", - "id": 1050, - "extend": "google.protobuf.ServiceOptions" - }, - "apiVersion": { - "type": "string", - "id": 525000001, - "extend": "google.protobuf.ServiceOptions" - }, - "CommonLanguageSettings": { - "fields": { - "referenceDocsUri": { - "type": "string", - "id": 1, - "options": { - "deprecated": true - } - }, - "destinations": { - "rule": "repeated", - "type": "ClientLibraryDestination", - "id": 2 - }, - "selectiveGapicGeneration": { - "type": "SelectiveGapicGeneration", - "id": 3 - } - } - }, - "ClientLibrarySettings": { - "fields": { - "version": { - "type": "string", - "id": 1 - }, - "launchStage": { - "type": "LaunchStage", - "id": 2 - }, - "restNumericEnums": { - "type": "bool", - "id": 3 - }, - "javaSettings": { - "type": "JavaSettings", - "id": 21 - }, - "cppSettings": { - "type": "CppSettings", - "id": 22 - }, - "phpSettings": { - "type": "PhpSettings", - "id": 23 - }, - "pythonSettings": { - "type": "PythonSettings", - "id": 24 - }, - "nodeSettings": { - "type": "NodeSettings", - "id": 25 - }, - "dotnetSettings": { - "type": "DotnetSettings", - "id": 26 - }, - "rubySettings": { - "type": "RubySettings", - "id": 27 - }, - "goSettings": { - "type": "GoSettings", - "id": 28 - } - } - }, - "Publishing": { - "fields": { - "methodSettings": { - "rule": "repeated", - "type": "MethodSettings", - "id": 2 - }, - "newIssueUri": { - "type": "string", - "id": 101 - }, - "documentationUri": { - "type": "string", - "id": 102 - }, - "apiShortName": { - "type": "string", - "id": 103 - }, - "githubLabel": { - "type": "string", - "id": 104 - }, - "codeownerGithubTeams": { - "rule": "repeated", - "type": "string", - "id": 105 - }, - "docTagPrefix": { - "type": "string", - "id": 106 - }, - "organization": { - "type": "ClientLibraryOrganization", - "id": 107 - }, - "librarySettings": { - "rule": "repeated", - "type": "ClientLibrarySettings", - "id": 109 - }, - "protoReferenceDocumentationUri": { - "type": "string", - "id": 110 - }, - "restReferenceDocumentationUri": { - "type": "string", - "id": 111 - } - } - }, - "JavaSettings": { - "fields": { - "libraryPackage": { - "type": "string", - "id": 1 - }, - "serviceClassNames": { - "keyType": "string", - "type": "string", - "id": 2 - }, - "common": { - "type": "CommonLanguageSettings", - "id": 3 - } - } - }, - "CppSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - } - } - }, - "PhpSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - } - } - }, - "PythonSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - }, - "experimentalFeatures": { - "type": "ExperimentalFeatures", - "id": 2 - } - }, - "nested": { - "ExperimentalFeatures": { - "fields": { - "restAsyncIoEnabled": { - "type": "bool", - "id": 1 - }, - "protobufPythonicTypesEnabled": { - "type": "bool", - "id": 2 - }, - "unversionedPackageDisabled": { - "type": "bool", - "id": 3 - } - } - } - } - }, - "NodeSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - } - } - }, - "DotnetSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - }, - "renamedServices": { - "keyType": "string", - "type": "string", - "id": 2 - }, - "renamedResources": { - "keyType": "string", - "type": "string", - "id": 3 - }, - "ignoredResources": { - "rule": "repeated", - "type": "string", - "id": 4 - }, - "forcedNamespaceAliases": { - "rule": "repeated", - "type": "string", - "id": 5 - }, - "handwrittenSignatures": { - "rule": "repeated", - "type": "string", - "id": 6 - } - } - }, - "RubySettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - } - } - }, - "GoSettings": { - "fields": { - "common": { - "type": "CommonLanguageSettings", - "id": 1 - }, - "renamedServices": { - "keyType": "string", - "type": "string", - "id": 2 - } - } - }, - "MethodSettings": { - "fields": { - "selector": { - "type": "string", - "id": 1 - }, - "longRunning": { - "type": "LongRunning", - "id": 2 - }, - "autoPopulatedFields": { - "rule": "repeated", - "type": "string", - "id": 3 - } - }, - "nested": { - "LongRunning": { - "fields": { - "initialPollDelay": { - "type": "google.protobuf.Duration", - "id": 1 - }, - "pollDelayMultiplier": { - "type": "float", - "id": 2 - }, - "maxPollDelay": { - "type": "google.protobuf.Duration", - "id": 3 - }, - "totalPollTimeout": { - "type": "google.protobuf.Duration", - "id": 4 - } - } - } - } - }, - "ClientLibraryOrganization": { - "values": { - "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": 0, - "CLOUD": 1, - "ADS": 2, - "PHOTOS": 3, - "STREET_VIEW": 4, - "SHOPPING": 5, - "GEO": 6, - "GENERATIVE_AI": 7 - } - }, - "ClientLibraryDestination": { - "values": { - "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": 0, - "GITHUB": 10, - "PACKAGE_MANAGER": 20 - } - }, - "SelectiveGapicGeneration": { - "fields": { - "methods": { - "rule": "repeated", - "type": "string", - "id": 1 - }, - "generateOmittedAsInternal": { - "type": "bool", - "id": 2 - } - } - }, - "LaunchStage": { - "values": { - "LAUNCH_STAGE_UNSPECIFIED": 0, - "UNIMPLEMENTED": 6, - "PRELAUNCH": 7, - "EARLY_ACCESS": 1, - "ALPHA": 2, - "BETA": 3, - "GA": 4, - "DEPRECATED": 5 - } - }, - "fieldBehavior": { - "rule": "repeated", - "type": "google.api.FieldBehavior", - "id": 1052, - "extend": "google.protobuf.FieldOptions", - "options": { - "packed": false - } - }, - "FieldBehavior": { - "values": { - "FIELD_BEHAVIOR_UNSPECIFIED": 0, - "OPTIONAL": 1, - "REQUIRED": 2, - "OUTPUT_ONLY": 3, - "INPUT_ONLY": 4, - "IMMUTABLE": 5, - "UNORDERED_LIST": 6, - "NON_EMPTY_DEFAULT": 7, - "IDENTIFIER": 8 - } - }, - "resourceReference": { - "type": "google.api.ResourceReference", - "id": 1055, - "extend": "google.protobuf.FieldOptions" - }, - "resourceDefinition": { - "rule": "repeated", - "type": "google.api.ResourceDescriptor", - "id": 1053, - "extend": "google.protobuf.FileOptions" - }, - "resource": { - "type": "google.api.ResourceDescriptor", - "id": 1053, - "extend": "google.protobuf.MessageOptions" - }, - "ResourceDescriptor": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "pattern": { - "rule": "repeated", - "type": "string", - "id": 2 - }, - "nameField": { - "type": "string", - "id": 3 - }, - "history": { - "type": "History", - "id": 4 - }, - "plural": { - "type": "string", - "id": 5 - }, - "singular": { - "type": "string", - "id": 6 - }, - "style": { - "rule": "repeated", - "type": "Style", - "id": 10 - } - }, - "nested": { - "History": { - "values": { - "HISTORY_UNSPECIFIED": 0, - "ORIGINALLY_SINGLE_PATTERN": 1, - "FUTURE_MULTI_PATTERN": 2 - } - }, - "Style": { - "values": { - "STYLE_UNSPECIFIED": 0, - "DECLARATIVE_FRIENDLY": 1 - } - } - } - }, - "ResourceReference": { - "fields": { - "type": { - "type": "string", - "id": 1 - }, - "childType": { - "type": "string", - "id": 2 - } - } - }, - "fieldInfo": { - "type": "google.api.FieldInfo", - "id": 291403980, - "extend": "google.protobuf.FieldOptions" - }, - "FieldInfo": { - "fields": { - "format": { - "type": "Format", - "id": 1 - }, - "referencedTypes": { - "rule": "repeated", - "type": "TypeReference", - "id": 2 - } - }, - "nested": { - "Format": { - "values": { - "FORMAT_UNSPECIFIED": 0, - "UUID4": 1, - "IPV4": 2, - "IPV6": 3, - "IPV4_OR_IPV6": 4 - } - } - } - }, - "TypeReference": { - "fields": { - "typeName": { - "type": "string", - "id": 1 - } - } - } - } - }, - "protobuf": { - "options": { - "go_package": "google.golang.org/protobuf/types/descriptorpb", - "java_package": "com.google.protobuf", - "java_outer_classname": "DescriptorProtos", - "csharp_namespace": "Google.Protobuf.Reflection", - "objc_class_prefix": "GPB", - "cc_enable_arenas": true, - "optimize_for": "SPEED" - }, - "nested": { - "FileDescriptorSet": { - "edition": "proto2", - "fields": { - "file": { - "rule": "repeated", - "type": "FileDescriptorProto", - "id": 1 - } - }, - "extensions": [ - [ - 536000000, - 536000000 - ] - ] - }, - "Edition": { - "edition": "proto2", - "values": { - "EDITION_UNKNOWN": 0, - "EDITION_LEGACY": 900, - "EDITION_PROTO2": 998, - "EDITION_PROTO3": 999, - "EDITION_2023": 1000, - "EDITION_2024": 1001, - "EDITION_1_TEST_ONLY": 1, - "EDITION_2_TEST_ONLY": 2, - "EDITION_99997_TEST_ONLY": 99997, - "EDITION_99998_TEST_ONLY": 99998, - "EDITION_99999_TEST_ONLY": 99999, - "EDITION_MAX": 2147483647 - } - }, - "FileDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "package": { - "type": "string", - "id": 2 - }, - "dependency": { - "rule": "repeated", - "type": "string", - "id": 3 - }, - "publicDependency": { - "rule": "repeated", - "type": "int32", - "id": 10 - }, - "weakDependency": { - "rule": "repeated", - "type": "int32", - "id": 11 - }, - "optionDependency": { - "rule": "repeated", - "type": "string", - "id": 15 - }, - "messageType": { - "rule": "repeated", - "type": "DescriptorProto", - "id": 4 - }, - "enumType": { - "rule": "repeated", - "type": "EnumDescriptorProto", - "id": 5 - }, - "service": { - "rule": "repeated", - "type": "ServiceDescriptorProto", - "id": 6 - }, - "extension": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 7 - }, - "options": { - "type": "FileOptions", - "id": 8 - }, - "sourceCodeInfo": { - "type": "SourceCodeInfo", - "id": 9 - }, - "syntax": { - "type": "string", - "id": 12 - }, - "edition": { - "type": "Edition", - "id": 14 - } - } - }, - "DescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "field": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 2 - }, - "extension": { - "rule": "repeated", - "type": "FieldDescriptorProto", - "id": 6 - }, - "nestedType": { - "rule": "repeated", - "type": "DescriptorProto", - "id": 3 - }, - "enumType": { - "rule": "repeated", - "type": "EnumDescriptorProto", - "id": 4 - }, - "extensionRange": { - "rule": "repeated", - "type": "ExtensionRange", - "id": 5 - }, - "oneofDecl": { - "rule": "repeated", - "type": "OneofDescriptorProto", - "id": 8 - }, - "options": { - "type": "MessageOptions", - "id": 7 - }, - "reservedRange": { - "rule": "repeated", - "type": "ReservedRange", - "id": 9 - }, - "reservedName": { - "rule": "repeated", - "type": "string", - "id": 10 - }, - "visibility": { - "type": "SymbolVisibility", - "id": 11 - } - }, - "nested": { - "ExtensionRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - }, - "options": { - "type": "ExtensionRangeOptions", - "id": 3 - } - } - }, - "ReservedRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - } - } - } - } - }, - "ExtensionRangeOptions": { - "edition": "proto2", - "fields": { - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - }, - "declaration": { - "rule": "repeated", - "type": "Declaration", - "id": 2, - "options": { - "retention": "RETENTION_SOURCE" - } - }, - "features": { - "type": "FeatureSet", - "id": 50 - }, - "verification": { - "type": "VerificationState", - "id": 3, - "options": { - "default": "UNVERIFIED", - "retention": "RETENTION_SOURCE" - } - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "nested": { - "Declaration": { - "fields": { - "number": { - "type": "int32", - "id": 1 - }, - "fullName": { - "type": "string", - "id": 2 - }, - "type": { - "type": "string", - "id": 3 - }, - "reserved": { - "type": "bool", - "id": 5 - }, - "repeated": { - "type": "bool", - "id": 6 - } - }, - "reserved": [ - [ - 4, - 4 - ] - ] - }, - "VerificationState": { - "values": { - "DECLARATION": 0, - "UNVERIFIED": 1 - } - } - } - }, - "FieldDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "number": { - "type": "int32", - "id": 3 - }, - "label": { - "type": "Label", - "id": 4 - }, - "type": { - "type": "Type", - "id": 5 - }, - "typeName": { - "type": "string", - "id": 6 - }, - "extendee": { - "type": "string", - "id": 2 - }, - "defaultValue": { - "type": "string", - "id": 7 - }, - "oneofIndex": { - "type": "int32", - "id": 9 - }, - "jsonName": { - "type": "string", - "id": 10 - }, - "options": { - "type": "FieldOptions", - "id": 8 - }, - "proto3Optional": { - "type": "bool", - "id": 17 - } - }, - "nested": { - "Type": { - "values": { - "TYPE_DOUBLE": 1, - "TYPE_FLOAT": 2, - "TYPE_INT64": 3, - "TYPE_UINT64": 4, - "TYPE_INT32": 5, - "TYPE_FIXED64": 6, - "TYPE_FIXED32": 7, - "TYPE_BOOL": 8, - "TYPE_STRING": 9, - "TYPE_GROUP": 10, - "TYPE_MESSAGE": 11, - "TYPE_BYTES": 12, - "TYPE_UINT32": 13, - "TYPE_ENUM": 14, - "TYPE_SFIXED32": 15, - "TYPE_SFIXED64": 16, - "TYPE_SINT32": 17, - "TYPE_SINT64": 18 - } - }, - "Label": { - "values": { - "LABEL_OPTIONAL": 1, - "LABEL_REPEATED": 3, - "LABEL_REQUIRED": 2 - } - } - } - }, - "OneofDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "options": { - "type": "OneofOptions", - "id": 2 - } - } - }, - "EnumDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "value": { - "rule": "repeated", - "type": "EnumValueDescriptorProto", - "id": 2 - }, - "options": { - "type": "EnumOptions", - "id": 3 - }, - "reservedRange": { - "rule": "repeated", - "type": "EnumReservedRange", - "id": 4 - }, - "reservedName": { - "rule": "repeated", - "type": "string", - "id": 5 - }, - "visibility": { - "type": "SymbolVisibility", - "id": 6 - } - }, - "nested": { - "EnumReservedRange": { - "fields": { - "start": { - "type": "int32", - "id": 1 - }, - "end": { - "type": "int32", - "id": 2 - } - } - } - } - }, - "EnumValueDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "number": { - "type": "int32", - "id": 2 - }, - "options": { - "type": "EnumValueOptions", - "id": 3 - } - } - }, - "ServiceDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "method": { - "rule": "repeated", - "type": "MethodDescriptorProto", - "id": 2 - }, - "options": { - "type": "ServiceOptions", - "id": 3 - } - }, - "reserved": [ - [ - 4, - 4 - ], - "stream" - ] - }, - "MethodDescriptorProto": { - "edition": "proto2", - "fields": { - "name": { - "type": "string", - "id": 1 - }, - "inputType": { - "type": "string", - "id": 2 - }, - "outputType": { - "type": "string", - "id": 3 - }, - "options": { - "type": "MethodOptions", - "id": 4 - }, - "clientStreaming": { - "type": "bool", - "id": 5, - "options": { - "default": false - } - }, - "serverStreaming": { - "type": "bool", - "id": 6, - "options": { - "default": false - } - } - } - }, - "FileOptions": { - "edition": "proto2", - "fields": { - "javaPackage": { - "type": "string", - "id": 1 - }, - "javaOuterClassname": { - "type": "string", - "id": 8 - }, - "javaMultipleFiles": { - "type": "bool", - "id": 10, - "options": { - "default": false - } - }, - "javaGenerateEqualsAndHash": { - "type": "bool", - "id": 20, - "options": { - "deprecated": true - } - }, - "javaStringCheckUtf8": { - "type": "bool", - "id": 27, - "options": { - "default": false - } - }, - "optimizeFor": { - "type": "OptimizeMode", - "id": 9, - "options": { - "default": "SPEED" - } - }, - "goPackage": { - "type": "string", - "id": 11 - }, - "ccGenericServices": { - "type": "bool", - "id": 16, - "options": { - "default": false - } - }, - "javaGenericServices": { - "type": "bool", - "id": 17, - "options": { - "default": false - } - }, - "pyGenericServices": { - "type": "bool", - "id": 18, - "options": { - "default": false - } - }, - "deprecated": { - "type": "bool", - "id": 23, - "options": { - "default": false - } - }, - "ccEnableArenas": { - "type": "bool", - "id": 31, - "options": { - "default": true - } - }, - "objcClassPrefix": { - "type": "string", - "id": 36 - }, - "csharpNamespace": { - "type": "string", - "id": 37 - }, - "swiftPrefix": { - "type": "string", - "id": 39 - }, - "phpClassPrefix": { - "type": "string", - "id": 40 - }, - "phpNamespace": { - "type": "string", - "id": 41 - }, - "phpMetadataNamespace": { - "type": "string", - "id": 44 - }, - "rubyPackage": { - "type": "string", - "id": 45 - }, - "features": { - "type": "FeatureSet", - "id": 50 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 42, - 42 - ], - "php_generic_services", - [ - 38, - 38 - ] - ], - "nested": { - "OptimizeMode": { - "values": { - "SPEED": 1, - "CODE_SIZE": 2, - "LITE_RUNTIME": 3 - } - } - } - }, - "MessageOptions": { - "edition": "proto2", - "fields": { - "messageSetWireFormat": { - "type": "bool", - "id": 1, - "options": { - "default": false - } - }, - "noStandardDescriptorAccessor": { - "type": "bool", - "id": 2, - "options": { - "default": false - } - }, - "deprecated": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "mapEntry": { - "type": "bool", - "id": 7 - }, - "deprecatedLegacyJsonFieldConflicts": { - "type": "bool", - "id": 11, - "options": { - "deprecated": true - } - }, - "features": { - "type": "FeatureSet", - "id": 12 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 4, - 4 - ], - [ - 5, - 5 - ], - [ - 6, - 6 - ], - [ - 8, - 8 - ], - [ - 9, - 9 - ] - ] - }, - "FieldOptions": { - "edition": "proto2", - "fields": { - "ctype": { - "type": "CType", - "id": 1, - "options": { - "default": "STRING" - } - }, - "packed": { - "type": "bool", - "id": 2 - }, - "jstype": { - "type": "JSType", - "id": 6, - "options": { - "default": "JS_NORMAL" - } - }, - "lazy": { - "type": "bool", - "id": 5, - "options": { - "default": false - } - }, - "unverifiedLazy": { - "type": "bool", - "id": 15, - "options": { - "default": false - } - }, - "deprecated": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "weak": { - "type": "bool", - "id": 10, - "options": { - "default": false, - "deprecated": true - } - }, - "debugRedact": { - "type": "bool", - "id": 16, - "options": { - "default": false - } - }, - "retention": { - "type": "OptionRetention", - "id": 17 - }, - "targets": { - "rule": "repeated", - "type": "OptionTargetType", - "id": 19 - }, - "editionDefaults": { - "rule": "repeated", - "type": "EditionDefault", - "id": 20 - }, - "features": { - "type": "FeatureSet", - "id": 21 - }, - "featureSupport": { - "type": "FeatureSupport", - "id": 22 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 4, - 4 - ], - [ - 18, - 18 - ] - ], - "nested": { - "CType": { - "values": { - "STRING": 0, - "CORD": 1, - "STRING_PIECE": 2 - } - }, - "JSType": { - "values": { - "JS_NORMAL": 0, - "JS_STRING": 1, - "JS_NUMBER": 2 - } - }, - "OptionRetention": { - "values": { - "RETENTION_UNKNOWN": 0, - "RETENTION_RUNTIME": 1, - "RETENTION_SOURCE": 2 - } - }, - "OptionTargetType": { - "values": { - "TARGET_TYPE_UNKNOWN": 0, - "TARGET_TYPE_FILE": 1, - "TARGET_TYPE_EXTENSION_RANGE": 2, - "TARGET_TYPE_MESSAGE": 3, - "TARGET_TYPE_FIELD": 4, - "TARGET_TYPE_ONEOF": 5, - "TARGET_TYPE_ENUM": 6, - "TARGET_TYPE_ENUM_ENTRY": 7, - "TARGET_TYPE_SERVICE": 8, - "TARGET_TYPE_METHOD": 9 - } - }, - "EditionDefault": { - "fields": { - "edition": { - "type": "Edition", - "id": 3 - }, - "value": { - "type": "string", - "id": 2 - } - } - }, - "FeatureSupport": { - "fields": { - "editionIntroduced": { - "type": "Edition", - "id": 1 - }, - "editionDeprecated": { - "type": "Edition", - "id": 2 - }, - "deprecationWarning": { - "type": "string", - "id": 3 - }, - "editionRemoved": { - "type": "Edition", - "id": 4 - } - } - } - } - }, - "OneofOptions": { - "edition": "proto2", - "fields": { - "features": { - "type": "FeatureSet", - "id": 1 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "EnumOptions": { - "edition": "proto2", - "fields": { - "allowAlias": { - "type": "bool", - "id": 2 - }, - "deprecated": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "deprecatedLegacyJsonFieldConflicts": { - "type": "bool", - "id": 6, - "options": { - "deprecated": true - } - }, - "features": { - "type": "FeatureSet", - "id": 7 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "reserved": [ - [ - 5, - 5 - ] - ] - }, - "EnumValueOptions": { - "edition": "proto2", - "fields": { - "deprecated": { - "type": "bool", - "id": 1, - "options": { - "default": false - } - }, - "features": { - "type": "FeatureSet", - "id": 2 - }, - "debugRedact": { - "type": "bool", - "id": 3, - "options": { - "default": false - } - }, - "featureSupport": { - "type": "FieldOptions.FeatureSupport", - "id": 4 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "ServiceOptions": { - "edition": "proto2", - "fields": { - "features": { - "type": "FeatureSet", - "id": 34 - }, - "deprecated": { - "type": "bool", - "id": 33, - "options": { - "default": false - } - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ] - }, - "MethodOptions": { - "edition": "proto2", - "fields": { - "deprecated": { - "type": "bool", - "id": 33, - "options": { - "default": false - } - }, - "idempotencyLevel": { - "type": "IdempotencyLevel", - "id": 34, - "options": { - "default": "IDEMPOTENCY_UNKNOWN" - } - }, - "features": { - "type": "FeatureSet", - "id": 35 - }, - "uninterpretedOption": { - "rule": "repeated", - "type": "UninterpretedOption", - "id": 999 - } - }, - "extensions": [ - [ - 1000, - 536870911 - ] - ], - "nested": { - "IdempotencyLevel": { - "values": { - "IDEMPOTENCY_UNKNOWN": 0, - "NO_SIDE_EFFECTS": 1, - "IDEMPOTENT": 2 - } - } - } - }, - "UninterpretedOption": { - "edition": "proto2", - "fields": { - "name": { - "rule": "repeated", - "type": "NamePart", - "id": 2 - }, - "identifierValue": { - "type": "string", - "id": 3 - }, - "positiveIntValue": { - "type": "uint64", - "id": 4 - }, - "negativeIntValue": { - "type": "int64", - "id": 5 - }, - "doubleValue": { - "type": "double", - "id": 6 - }, - "stringValue": { - "type": "bytes", - "id": 7 - }, - "aggregateValue": { - "type": "string", - "id": 8 - } - }, - "nested": { - "NamePart": { - "fields": { - "namePart": { - "rule": "required", - "type": "string", - "id": 1 - }, - "isExtension": { - "rule": "required", - "type": "bool", - "id": 2 - } - } - } - } - }, - "FeatureSet": { - "edition": "proto2", - "fields": { - "fieldPresence": { - "type": "FieldPresence", - "id": 1, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_2023", - "edition_defaults.value": "EXPLICIT" - } - }, - "enumType": { - "type": "EnumType", - "id": 2, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_PROTO3", - "edition_defaults.value": "OPEN" - } - }, - "repeatedFieldEncoding": { - "type": "RepeatedFieldEncoding", - "id": 3, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_PROTO3", - "edition_defaults.value": "PACKED" - } - }, - "utf8Validation": { - "type": "Utf8Validation", - "id": 4, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_PROTO3", - "edition_defaults.value": "VERIFY" - } - }, - "messageEncoding": { - "type": "MessageEncoding", - "id": 5, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_LEGACY", - "edition_defaults.value": "LENGTH_PREFIXED" - } - }, - "jsonFormat": { - "type": "JsonFormat", - "id": 6, - "options": { - "retention": "RETENTION_RUNTIME", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2023", - "edition_defaults.edition": "EDITION_PROTO3", - "edition_defaults.value": "ALLOW" - } - }, - "enforceNamingStyle": { - "type": "EnforceNamingStyle", - "id": 7, - "options": { - "retention": "RETENTION_SOURCE", - "targets": "TARGET_TYPE_METHOD", - "feature_support.edition_introduced": "EDITION_2024", - "edition_defaults.edition": "EDITION_2024", - "edition_defaults.value": "STYLE2024" - } - }, - "defaultSymbolVisibility": { - "type": "VisibilityFeature.DefaultSymbolVisibility", - "id": 8, - "options": { - "retention": "RETENTION_SOURCE", - "targets": "TARGET_TYPE_FILE", - "feature_support.edition_introduced": "EDITION_2024", - "edition_defaults.edition": "EDITION_2024", - "edition_defaults.value": "EXPORT_TOP_LEVEL" - } - } - }, - "extensions": [ - [ - 1000, - 9994 - ], - [ - 9995, - 9999 - ], - [ - 10000, - 10000 - ] - ], - "reserved": [ - [ - 999, - 999 - ] - ], - "nested": { - "FieldPresence": { - "values": { - "FIELD_PRESENCE_UNKNOWN": 0, - "EXPLICIT": 1, - "IMPLICIT": 2, - "LEGACY_REQUIRED": 3 - } - }, - "EnumType": { - "values": { - "ENUM_TYPE_UNKNOWN": 0, - "OPEN": 1, - "CLOSED": 2 - } - }, - "RepeatedFieldEncoding": { - "values": { - "REPEATED_FIELD_ENCODING_UNKNOWN": 0, - "PACKED": 1, - "EXPANDED": 2 - } - }, - "Utf8Validation": { - "values": { - "UTF8_VALIDATION_UNKNOWN": 0, - "VERIFY": 2, - "NONE": 3 - }, - "reserved": [ - [ - 1, - 1 - ] - ] - }, - "MessageEncoding": { - "values": { - "MESSAGE_ENCODING_UNKNOWN": 0, - "LENGTH_PREFIXED": 1, - "DELIMITED": 2 - } - }, - "JsonFormat": { - "values": { - "JSON_FORMAT_UNKNOWN": 0, - "ALLOW": 1, - "LEGACY_BEST_EFFORT": 2 - } - }, - "EnforceNamingStyle": { - "values": { - "ENFORCE_NAMING_STYLE_UNKNOWN": 0, - "STYLE2024": 1, - "STYLE_LEGACY": 2 - } - }, - "VisibilityFeature": { - "fields": {}, - "reserved": [ - [ - 1, - 536870911 - ] - ], - "nested": { - "DefaultSymbolVisibility": { - "values": { - "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, - "EXPORT_ALL": 1, - "EXPORT_TOP_LEVEL": 2, - "LOCAL_ALL": 3, - "STRICT": 4 - } - } - } - } - } - }, - "FeatureSetDefaults": { - "edition": "proto2", - "fields": { - "defaults": { - "rule": "repeated", - "type": "FeatureSetEditionDefault", - "id": 1 - }, - "minimumEdition": { - "type": "Edition", - "id": 4 - }, - "maximumEdition": { - "type": "Edition", - "id": 5 - } - }, - "nested": { - "FeatureSetEditionDefault": { - "fields": { - "edition": { - "type": "Edition", - "id": 3 - }, - "overridableFeatures": { - "type": "FeatureSet", - "id": 4 - }, - "fixedFeatures": { - "type": "FeatureSet", - "id": 5 - } - }, - "reserved": [ - [ - 1, - 1 - ], - [ - 2, - 2 - ], - "features" - ] - } - } - }, - "SourceCodeInfo": { - "edition": "proto2", - "fields": { - "location": { - "rule": "repeated", - "type": "Location", - "id": 1 - } - }, - "extensions": [ - [ - 536000000, - 536000000 - ] - ], - "nested": { - "Location": { - "fields": { - "path": { - "rule": "repeated", - "type": "int32", - "id": 1, - "options": { - "packed": true - } - }, - "span": { - "rule": "repeated", - "type": "int32", - "id": 2, - "options": { - "packed": true - } - }, - "leadingComments": { - "type": "string", - "id": 3 - }, - "trailingComments": { - "type": "string", - "id": 4 - }, - "leadingDetachedComments": { - "rule": "repeated", - "type": "string", - "id": 6 - } - } - } - } - }, - "GeneratedCodeInfo": { - "edition": "proto2", - "fields": { - "annotation": { - "rule": "repeated", - "type": "Annotation", - "id": 1 - } - }, - "nested": { - "Annotation": { - "fields": { - "path": { - "rule": "repeated", - "type": "int32", - "id": 1, - "options": { - "packed": true - } - }, - "sourceFile": { - "type": "string", - "id": 2 - }, - "begin": { - "type": "int32", - "id": 3 - }, - "end": { - "type": "int32", - "id": 4 - }, - "semantic": { - "type": "Semantic", - "id": 5 - } - }, - "nested": { - "Semantic": { - "values": { - "NONE": 0, - "SET": 1, - "ALIAS": 2 - } - } - } - } - } - }, - "SymbolVisibility": { - "edition": "proto2", - "values": { - "VISIBILITY_UNSET": 0, - "VISIBILITY_LOCAL": 1, - "VISIBILITY_EXPORT": 2 - } - }, - "Duration": { - "fields": { - "seconds": { - "type": "int64", - "id": 1 - }, - "nanos": { - "type": "int32", - "id": 2 - } - } - }, - "Timestamp": { - "fields": { - "seconds": { - "type": "int64", - "id": 1 - }, - "nanos": { - "type": "int32", - "id": 2 - } - } - }, - "DoubleValue": { - "fields": { - "value": { - "type": "double", - "id": 1 - } - } - }, - "FloatValue": { - "fields": { - "value": { - "type": "float", - "id": 1 - } - } - }, - "Int64Value": { - "fields": { - "value": { - "type": "int64", - "id": 1 - } - } - }, - "UInt64Value": { - "fields": { - "value": { - "type": "uint64", - "id": 1 - } - } - }, - "Int32Value": { - "fields": { - "value": { - "type": "int32", - "id": 1 - } - } - }, - "UInt32Value": { - "fields": { - "value": { - "type": "uint32", - "id": 1 - } - } - }, - "BoolValue": { - "fields": { - "value": { - "type": "bool", - "id": 1 - } - } - }, - "StringValue": { - "fields": { - "value": { - "type": "string", - "id": 1 - } - } - }, - "BytesValue": { - "fields": { - "value": { - "type": "bytes", - "id": 1 - } - } - }, - "Any": { - "fields": { - "type_url": { - "type": "string", - "id": 1 - }, - "value": { - "type": "bytes", - "id": 2 - } - } - }, - "FieldMask": { - "fields": { - "paths": { - "rule": "repeated", - "type": "string", - "id": 1 - } - } - }, - "Empty": { - "fields": {} - } - } - }, - "rpc": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/rpc/status;status", - "java_multiple_files": true, - "java_outer_classname": "StatusProto", - "java_package": "com.google.rpc", - "objc_class_prefix": "RPC" - }, - "nested": { - "Status": { - "fields": { - "code": { - "type": "int32", - "id": 1 - }, - "message": { - "type": "string", - "id": 2 - }, - "details": { - "rule": "repeated", - "type": "google.protobuf.Any", - "id": 3 - } - } - } - } - }, - "type": { - "options": { - "cc_enable_arenas": true, - "go_package": "google.golang.org/genproto/googleapis/type/interval;interval", - "java_multiple_files": true, - "java_outer_classname": "IntervalProto", - "java_package": "com.google.type", - "objc_class_prefix": "GTP" - }, - "nested": { - "Interval": { - "fields": { - "startTime": { - "type": "google.protobuf.Timestamp", - "id": 1 - }, - "endTime": { - "type": "google.protobuf.Timestamp", - "id": 2 - } - } - } - } - } - } - } - } -} \ No newline at end of file diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json b/owl-bot-staging/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json deleted file mode 100644 index 76103b57b6ed..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json +++ /dev/null @@ -1,3567 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-sql", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.sql.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "sqladmin_v1_generated_SqlBackupRunsService_Delete_async", - "title": "SqlAvailableDatabaseVersionsService delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes the backup taken by a backup run.", - "canonical": true, - "file": "sql_backup_runs_service.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Delete", - "async": true, - "parameters": [ - { - "name": "id", - "type": "TYPE_INT64" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlBackupRunsServiceClient", - "fullName": "google.cloud.sql.v1.SqlBackupRunsServiceClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Delete", - "service": { - "shortName": "SqlBackupRunsService", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlBackupRunsService_Get_async", - "title": "SqlAvailableDatabaseVersionsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a resource containing information about a backup run.", - "canonical": true, - "file": "sql_backup_runs_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Get", - "async": true, - "parameters": [ - { - "name": "id", - "type": "TYPE_INT64" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.BackupRun", - "client": { - "shortName": "SqlBackupRunsServiceClient", - "fullName": "google.cloud.sql.v1.SqlBackupRunsServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Get", - "service": { - "shortName": "SqlBackupRunsService", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlBackupRunsService_Insert_async", - "title": "SqlAvailableDatabaseVersionsService insert Sample", - "origin": "API_DEFINITION", - "description": " Creates a new backup run on demand.", - "canonical": true, - "file": "sql_backup_runs_service.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Insert", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.BackupRun" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlBackupRunsServiceClient", - "fullName": "google.cloud.sql.v1.SqlBackupRunsServiceClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService.Insert", - "service": { - "shortName": "SqlBackupRunsService", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlBackupRunsService_List_async", - "title": "SqlAvailableDatabaseVersionsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists all backup runs associated with the project or a given instance and configuration in the reverse chronological order of the backup initiation time.", - "canonical": true, - "file": "sql_backup_runs_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService.List", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.BackupRunsListResponse", - "client": { - "shortName": "SqlBackupRunsServiceClient", - "fullName": "google.cloud.sql.v1.SqlBackupRunsServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService.List", - "service": { - "shortName": "SqlBackupRunsService", - "fullName": "google.cloud.sql.v1.SqlBackupRunsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlBackupsService_CreateBackup_async", - "title": "SqlAvailableDatabaseVersionsService createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.", - "canonical": true, - "file": "sql_backups_service.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.sql.v1.SqlBackupsService.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.sql.v1.Backup" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlBackupsServiceClient", - "fullName": "google.cloud.sql.v1.SqlBackupsServiceClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.sql.v1.SqlBackupsService.CreateBackup", - "service": { - "shortName": "SqlBackupsService", - "fullName": "google.cloud.sql.v1.SqlBackupsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlBackupsService_GetBackup_async", - "title": "SqlAvailableDatabaseVersionsService getBackup Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a resource containing information about a backup.", - "canonical": true, - "file": "sql_backups_service.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.sql.v1.SqlBackupsService.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Backup", - "client": { - "shortName": "SqlBackupsServiceClient", - "fullName": "google.cloud.sql.v1.SqlBackupsServiceClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.sql.v1.SqlBackupsService.GetBackup", - "service": { - "shortName": "SqlBackupsService", - "fullName": "google.cloud.sql.v1.SqlBackupsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlBackupsService_ListBackups_async", - "title": "SqlAvailableDatabaseVersionsService listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists all backups associated with the project.", - "canonical": true, - "file": "sql_backups_service.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.sql.v1.SqlBackupsService.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.ListBackupsResponse", - "client": { - "shortName": "SqlBackupsServiceClient", - "fullName": "google.cloud.sql.v1.SqlBackupsServiceClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.sql.v1.SqlBackupsService.ListBackups", - "service": { - "shortName": "SqlBackupsService", - "fullName": "google.cloud.sql.v1.SqlBackupsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlBackupsService_UpdateBackup_async", - "title": "SqlAvailableDatabaseVersionsService updateBackup Sample", - "origin": "API_DEFINITION", - "description": " Updates the retention period and description of the backup. You can use this API to update final backups only.", - "canonical": true, - "file": "sql_backups_service.update_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBackup", - "fullName": "google.cloud.sql.v1.SqlBackupsService.UpdateBackup", - "async": true, - "parameters": [ - { - "name": "backup", - "type": ".google.cloud.sql.v1.Backup" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlBackupsServiceClient", - "fullName": "google.cloud.sql.v1.SqlBackupsServiceClient" - }, - "method": { - "shortName": "UpdateBackup", - "fullName": "google.cloud.sql.v1.SqlBackupsService.UpdateBackup", - "service": { - "shortName": "SqlBackupsService", - "fullName": "google.cloud.sql.v1.SqlBackupsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlBackupsService_DeleteBackup_async", - "title": "SqlAvailableDatabaseVersionsService deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes the backup.", - "canonical": true, - "file": "sql_backups_service.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.sql.v1.SqlBackupsService.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlBackupsServiceClient", - "fullName": "google.cloud.sql.v1.SqlBackupsServiceClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.sql.v1.SqlBackupsService.DeleteBackup", - "service": { - "shortName": "SqlBackupsService", - "fullName": "google.cloud.sql.v1.SqlBackupsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlConnectService_GetConnectSettings_async", - "title": "SqlAvailableDatabaseVersionsService getConnectSettings Sample", - "origin": "API_DEFINITION", - "description": " Retrieves connect settings about a Cloud SQL instance.", - "canonical": true, - "file": "sql_connect_service.get_connect_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConnectSettings", - "fullName": "google.cloud.sql.v1.SqlConnectService.GetConnectSettings", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.sql.v1.ConnectSettings", - "client": { - "shortName": "SqlConnectServiceClient", - "fullName": "google.cloud.sql.v1.SqlConnectServiceClient" - }, - "method": { - "shortName": "GetConnectSettings", - "fullName": "google.cloud.sql.v1.SqlConnectService.GetConnectSettings", - "service": { - "shortName": "SqlConnectService", - "fullName": "google.cloud.sql.v1.SqlConnectService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_async", - "title": "SqlAvailableDatabaseVersionsService generateEphemeralCert Sample", - "origin": "API_DEFINITION", - "description": " Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.", - "canonical": true, - "file": "sql_connect_service.generate_ephemeral_cert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateEphemeralCert", - "fullName": "google.cloud.sql.v1.SqlConnectService.GenerateEphemeralCert", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "public_key", - "type": "TYPE_STRING" - }, - { - "name": "access_token", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "valid_duration", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.cloud.sql.v1.GenerateEphemeralCertResponse", - "client": { - "shortName": "SqlConnectServiceClient", - "fullName": "google.cloud.sql.v1.SqlConnectServiceClient" - }, - "method": { - "shortName": "GenerateEphemeralCert", - "fullName": "google.cloud.sql.v1.SqlConnectService.GenerateEphemeralCert", - "service": { - "shortName": "SqlConnectService", - "fullName": "google.cloud.sql.v1.SqlConnectService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlDatabasesService_Delete_async", - "title": "SqlAvailableDatabaseVersionsService delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes a database from a Cloud SQL instance.", - "canonical": true, - "file": "sql_databases_service.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.Delete", - "async": true, - "parameters": [ - { - "name": "database", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.Delete", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlDatabasesService_Get_async", - "title": "SqlAvailableDatabaseVersionsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a resource containing information about a database inside a Cloud SQL instance.", - "canonical": true, - "file": "sql_databases_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.Get", - "async": true, - "parameters": [ - { - "name": "database", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Database", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.Get", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlDatabasesService_Insert_async", - "title": "SqlAvailableDatabaseVersionsService insert Sample", - "origin": "API_DEFINITION", - "description": " Inserts a resource containing information about a database inside a Cloud SQL instance. **Note:** You can't modify the default character set and collation.", - "canonical": true, - "file": "sql_databases_service.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.Insert", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.Database" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.Insert", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlDatabasesService_List_async", - "title": "SqlAvailableDatabaseVersionsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists databases in the specified Cloud SQL instance.", - "canonical": true, - "file": "sql_databases_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.List", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.DatabasesListResponse", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.List", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlDatabasesService_Patch_async", - "title": "SqlAvailableDatabaseVersionsService patch Sample", - "origin": "API_DEFINITION", - "description": " Partially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.", - "canonical": true, - "file": "sql_databases_service.patch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Patch", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.Patch", - "async": true, - "parameters": [ - { - "name": "database", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.Database" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "Patch", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.Patch", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlDatabasesService_Update_async", - "title": "SqlAvailableDatabaseVersionsService update Sample", - "origin": "API_DEFINITION", - "description": " Updates a resource containing information about a database inside a Cloud SQL instance.", - "canonical": true, - "file": "sql_databases_service.update.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.Update", - "async": true, - "parameters": [ - { - "name": "database", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.Database" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1.SqlDatabasesService.Update", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlFlagsService_List_async", - "title": "SqlAvailableDatabaseVersionsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists all available database flags for Cloud SQL instances.", - "canonical": true, - "file": "sql_flags_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlFlagsService.List", - "async": true, - "parameters": [ - { - "name": "database_version", - "type": "TYPE_STRING" - }, - { - "name": "flag_scope", - "type": ".google.cloud.sql.v1.SqlFlagScope" - } - ], - "resultType": ".google.cloud.sql.v1.FlagsListResponse", - "client": { - "shortName": "SqlFlagsServiceClient", - "fullName": "google.cloud.sql.v1.SqlFlagsServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlFlagsService.List", - "service": { - "shortName": "SqlFlagsService", - "fullName": "google.cloud.sql.v1.SqlFlagsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_AddServerCa_async", - "title": "SqlAvailableDatabaseVersionsService addServerCa Sample", - "origin": "API_DEFINITION", - "description": " Adds a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in. For instances that have enabled Certificate Authority Service (CAS) based server CA, use AddServerCertificate to add a new server certificate.", - "canonical": true, - "file": "sql_instances_service.add_server_ca.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddServerCa", - "fullName": "google.cloud.sql.v1.SqlInstancesService.AddServerCa", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "AddServerCa", - "fullName": "google.cloud.sql.v1.SqlInstancesService.AddServerCa", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_async", - "title": "SqlAvailableDatabaseVersionsService addServerCertificate Sample", - "origin": "API_DEFINITION", - "description": " Add a new trusted server certificate version for the specified instance using Certificate Authority Service (CAS) server CA. Required to prepare for a certificate rotation. If a server certificate version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one certificate version waiting to be rotated in. For instances not using CAS server CA, use AddServerCa instead.", - "canonical": true, - "file": "sql_instances_service.add_server_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddServerCertificate", - "fullName": "google.cloud.sql.v1.SqlInstancesService.AddServerCertificate", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "AddServerCertificate", - "fullName": "google.cloud.sql.v1.SqlInstancesService.AddServerCertificate", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_async", - "title": "SqlAvailableDatabaseVersionsService addEntraIdCertificate Sample", - "origin": "API_DEFINITION", - "description": " Adds a new Entra ID certificate for the specified instance. If an Entra ID certificate was previously added but never used in a certificate rotation, this operation replaces that version.", - "canonical": true, - "file": "sql_instances_service.add_entra_id_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddEntraIdCertificate", - "fullName": "google.cloud.sql.v1.SqlInstancesService.AddEntraIdCertificate", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "AddEntraIdCertificate", - "fullName": "google.cloud.sql.v1.SqlInstancesService.AddEntraIdCertificate", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Clone_async", - "title": "SqlAvailableDatabaseVersionsService clone Sample", - "origin": "API_DEFINITION", - "description": " Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.", - "canonical": true, - "file": "sql_instances_service.clone.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Clone", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Clone", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesCloneRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Clone", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Clone", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Delete_async", - "title": "SqlAvailableDatabaseVersionsService delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes a Cloud SQL instance.", - "canonical": true, - "file": "sql_instances_service.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Delete", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "enable_final_backup", - "type": "TYPE_BOOL" - }, - { - "name": "final_backup_ttl_days", - "type": "TYPE_INT64" - }, - { - "name": "final_backup_expiry_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "final_backup_description", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Delete", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_DemoteMaster_async", - "title": "SqlAvailableDatabaseVersionsService demoteMaster Sample", - "origin": "API_DEFINITION", - "description": " Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.", - "canonical": true, - "file": "sql_instances_service.demote_master.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DemoteMaster", - "fullName": "google.cloud.sql.v1.SqlInstancesService.DemoteMaster", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesDemoteMasterRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "DemoteMaster", - "fullName": "google.cloud.sql.v1.SqlInstancesService.DemoteMaster", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Demote_async", - "title": "SqlAvailableDatabaseVersionsService demote Sample", - "origin": "API_DEFINITION", - "description": " Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server.", - "canonical": true, - "file": "sql_instances_service.demote.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Demote", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Demote", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesDemoteRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Demote", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Demote", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Export_async", - "title": "SqlAvailableDatabaseVersionsService export Sample", - "origin": "API_DEFINITION", - "description": " Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.", - "canonical": true, - "file": "sql_instances_service.export.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Export", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Export", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesExportRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Export", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Export", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Failover_async", - "title": "SqlAvailableDatabaseVersionsService failover Sample", - "origin": "API_DEFINITION", - "description": " Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the [Overview of high availability](https://cloud.google.com/sql/docs/mysql/high-availability) page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.", - "canonical": true, - "file": "sql_instances_service.failover.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Failover", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Failover", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesFailoverRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Failover", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Failover", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Reencrypt_async", - "title": "SqlAvailableDatabaseVersionsService reencrypt Sample", - "origin": "API_DEFINITION", - "description": " Reencrypt CMEK instance with latest key version.", - "canonical": true, - "file": "sql_instances_service.reencrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Reencrypt", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Reencrypt", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesReencryptRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Reencrypt", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Reencrypt", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Get_async", - "title": "SqlAvailableDatabaseVersionsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a resource containing information about a Cloud SQL instance.", - "canonical": true, - "file": "sql_instances_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Get", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.DatabaseInstance", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Get", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Import_async", - "title": "SqlAvailableDatabaseVersionsService import Sample", - "origin": "API_DEFINITION", - "description": " Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.", - "canonical": true, - "file": "sql_instances_service.import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Import", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Import", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesImportRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Import", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Import", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Insert_async", - "title": "SqlAvailableDatabaseVersionsService insert Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Cloud SQL instance.", - "canonical": true, - "file": "sql_instances_service.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Insert", - "async": true, - "parameters": [ - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.DatabaseInstance" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Insert", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_List_async", - "title": "SqlAvailableDatabaseVersionsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists instances under a given project.", - "canonical": true, - "file": "sql_instances_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlInstancesService.List", - "async": true, - "parameters": [ - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": "TYPE_UINT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.InstancesListResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlInstancesService.List", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_ListServerCas_async", - "title": "SqlAvailableDatabaseVersionsService listServerCas Sample", - "origin": "API_DEFINITION", - "description": " Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.", - "canonical": true, - "file": "sql_instances_service.list_server_cas.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServerCas", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ListServerCas", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.InstancesListServerCasResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ListServerCas", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ListServerCas", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_async", - "title": "SqlAvailableDatabaseVersionsService listServerCertificates Sample", - "origin": "API_DEFINITION", - "description": " Lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead.", - "canonical": true, - "file": "sql_instances_service.list_server_certificates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServerCertificates", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ListServerCertificates", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.InstancesListServerCertificatesResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ListServerCertificates", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ListServerCertificates", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_async", - "title": "SqlAvailableDatabaseVersionsService listEntraIdCertificates Sample", - "origin": "API_DEFINITION", - "description": " Lists all versions of EntraID certificates for the specified instance. There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out.", - "canonical": true, - "file": "sql_instances_service.list_entra_id_certificates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEntraIdCertificates", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ListEntraIdCertificates", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ListEntraIdCertificates", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ListEntraIdCertificates", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Patch_async", - "title": "SqlAvailableDatabaseVersionsService patch Sample", - "origin": "API_DEFINITION", - "description": " Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.", - "canonical": true, - "file": "sql_instances_service.patch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Patch", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Patch", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.DatabaseInstance" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Patch", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Patch", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_PromoteReplica_async", - "title": "SqlAvailableDatabaseVersionsService promoteReplica Sample", - "origin": "API_DEFINITION", - "description": " Promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.", - "canonical": true, - "file": "sql_instances_service.promote_replica.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PromoteReplica", - "fullName": "google.cloud.sql.v1.SqlInstancesService.PromoteReplica", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "failover", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "PromoteReplica", - "fullName": "google.cloud.sql.v1.SqlInstancesService.PromoteReplica", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Switchover_async", - "title": "SqlAvailableDatabaseVersionsService switchover Sample", - "origin": "API_DEFINITION", - "description": " Switches over from the primary instance to the DR replica instance.", - "canonical": true, - "file": "sql_instances_service.switchover.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Switchover", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Switchover", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "db_timeout", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Switchover", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Switchover", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_async", - "title": "SqlAvailableDatabaseVersionsService resetSslConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes all client certificates and generates a new server SSL certificate for the instance.", - "canonical": true, - "file": "sql_instances_service.reset_ssl_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetSslConfig", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ResetSslConfig", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "mode", - "type": ".google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ResetSslConfig", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ResetSslConfig", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Restart_async", - "title": "SqlAvailableDatabaseVersionsService restart Sample", - "origin": "API_DEFINITION", - "description": " Restarts a Cloud SQL instance.", - "canonical": true, - "file": "sql_instances_service.restart.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Restart", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Restart", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Restart", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Restart", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_RestoreBackup_async", - "title": "SqlAvailableDatabaseVersionsService restoreBackup Sample", - "origin": "API_DEFINITION", - "description": " Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.", - "canonical": true, - "file": "sql_instances_service.restore_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreBackup", - "fullName": "google.cloud.sql.v1.SqlInstancesService.RestoreBackup", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesRestoreBackupRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "RestoreBackup", - "fullName": "google.cloud.sql.v1.SqlInstancesService.RestoreBackup", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_RotateServerCa_async", - "title": "SqlAvailableDatabaseVersionsService rotateServerCa Sample", - "origin": "API_DEFINITION", - "description": " Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use RotateServerCertificate to rotate the server certificate.", - "canonical": true, - "file": "sql_instances_service.rotate_server_ca.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RotateServerCa", - "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateServerCa", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesRotateServerCaRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "RotateServerCa", - "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateServerCa", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_async", - "title": "SqlAvailableDatabaseVersionsService rotateServerCertificate Sample", - "origin": "API_DEFINITION", - "description": " Rotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead.", - "canonical": true, - "file": "sql_instances_service.rotate_server_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RotateServerCertificate", - "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateServerCertificate", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesRotateServerCertificateRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "RotateServerCertificate", - "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateServerCertificate", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_async", - "title": "SqlAvailableDatabaseVersionsService rotateEntraIdCertificate Sample", - "origin": "API_DEFINITION", - "description": " Rotates the server certificate version to one previously added with the addEntraIdCertificate method.", - "canonical": true, - "file": "sql_instances_service.rotate_entra_id_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RotateEntraIdCertificate", - "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateEntraIdCertificate", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "RotateEntraIdCertificate", - "fullName": "google.cloud.sql.v1.SqlInstancesService.RotateEntraIdCertificate", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_StartReplica_async", - "title": "SqlAvailableDatabaseVersionsService startReplica Sample", - "origin": "API_DEFINITION", - "description": " Starts the replication in the read replica instance.", - "canonical": true, - "file": "sql_instances_service.start_replica.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartReplica", - "fullName": "google.cloud.sql.v1.SqlInstancesService.StartReplica", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "StartReplica", - "fullName": "google.cloud.sql.v1.SqlInstancesService.StartReplica", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_StopReplica_async", - "title": "SqlAvailableDatabaseVersionsService stopReplica Sample", - "origin": "API_DEFINITION", - "description": " Stops the replication in the read replica instance.", - "canonical": true, - "file": "sql_instances_service.stop_replica.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopReplica", - "fullName": "google.cloud.sql.v1.SqlInstancesService.StopReplica", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "StopReplica", - "fullName": "google.cloud.sql.v1.SqlInstancesService.StopReplica", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_TruncateLog_async", - "title": "SqlAvailableDatabaseVersionsService truncateLog Sample", - "origin": "API_DEFINITION", - "description": " Truncate MySQL general and slow query log tables MySQL only.", - "canonical": true, - "file": "sql_instances_service.truncate_log.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TruncateLog", - "fullName": "google.cloud.sql.v1.SqlInstancesService.TruncateLog", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesTruncateLogRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "TruncateLog", - "fullName": "google.cloud.sql.v1.SqlInstancesService.TruncateLog", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_Update_async", - "title": "SqlAvailableDatabaseVersionsService update Sample", - "origin": "API_DEFINITION", - "description": " Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.", - "canonical": true, - "file": "sql_instances_service.update.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Update", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.DatabaseInstance" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1.SqlInstancesService.Update", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_async", - "title": "SqlAvailableDatabaseVersionsService createEphemeral Sample", - "origin": "API_DEFINITION", - "description": " Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.", - "canonical": true, - "file": "sql_instances_service.create_ephemeral.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateEphemeral", - "fullName": "google.cloud.sql.v1.SqlInstancesService.CreateEphemeral", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.SslCertsCreateEphemeralRequest" - } - ], - "resultType": ".google.cloud.sql.v1.SslCert", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "CreateEphemeral", - "fullName": "google.cloud.sql.v1.SqlInstancesService.CreateEphemeral", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_async", - "title": "SqlAvailableDatabaseVersionsService rescheduleMaintenance Sample", - "origin": "API_DEFINITION", - "description": " Reschedules the maintenance on the given instance.", - "canonical": true, - "file": "sql_instances_service.reschedule_maintenance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RescheduleMaintenance", - "fullName": "google.cloud.sql.v1.SqlInstancesService.RescheduleMaintenance", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "RescheduleMaintenance", - "fullName": "google.cloud.sql.v1.SqlInstancesService.RescheduleMaintenance", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_async", - "title": "SqlAvailableDatabaseVersionsService verifyExternalSyncSettings Sample", - "origin": "API_DEFINITION", - "description": " Verify External primary instance external sync settings.", - "canonical": true, - "file": "sql_instances_service.verify_external_sync_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 88, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "VerifyExternalSyncSettings", - "fullName": "google.cloud.sql.v1.SqlInstancesService.VerifyExternalSyncSettings", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "verify_connection_only", - "type": "TYPE_BOOL" - }, - { - "name": "sync_mode", - "type": ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode" - }, - { - "name": "verify_replication_only", - "type": "TYPE_BOOL" - }, - { - "name": "mysql_sync_config", - "type": ".google.cloud.sql.v1.MySqlSyncConfig" - }, - { - "name": "migration_type", - "type": ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType" - }, - { - "name": "sync_parallel_level", - "type": ".google.cloud.sql.v1.ExternalSyncParallelLevel" - }, - { - "name": "selected_objects", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "VerifyExternalSyncSettings", - "fullName": "google.cloud.sql.v1.SqlInstancesService.VerifyExternalSyncSettings", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_StartExternalSync_async", - "title": "SqlAvailableDatabaseVersionsService startExternalSync Sample", - "origin": "API_DEFINITION", - "description": " Start External primary instance migration.", - "canonical": true, - "file": "sql_instances_service.start_external_sync.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartExternalSync", - "fullName": "google.cloud.sql.v1.SqlInstancesService.StartExternalSync", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "sync_mode", - "type": ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode" - }, - { - "name": "skip_verification", - "type": "TYPE_BOOL" - }, - { - "name": "mysql_sync_config", - "type": ".google.cloud.sql.v1.MySqlSyncConfig" - }, - { - "name": "sync_parallel_level", - "type": ".google.cloud.sql.v1.ExternalSyncParallelLevel" - }, - { - "name": "migration_type", - "type": ".google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType" - }, - { - "name": "replica_overwrite_enabled", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "StartExternalSync", - "fullName": "google.cloud.sql.v1.SqlInstancesService.StartExternalSync", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_async", - "title": "SqlAvailableDatabaseVersionsService performDiskShrink Sample", - "origin": "API_DEFINITION", - "description": " Perform Disk Shrink on primary instance.", - "canonical": true, - "file": "sql_instances_service.perform_disk_shrink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PerformDiskShrink", - "fullName": "google.cloud.sql.v1.SqlInstancesService.PerformDiskShrink", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.PerformDiskShrinkContext" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "PerformDiskShrink", - "fullName": "google.cloud.sql.v1.SqlInstancesService.PerformDiskShrink", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_async", - "title": "SqlAvailableDatabaseVersionsService getDiskShrinkConfig Sample", - "origin": "API_DEFINITION", - "description": " Get Disk Shrink Config for a given instance.", - "canonical": true, - "file": "sql_instances_service.get_disk_shrink_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDiskShrinkConfig", - "fullName": "google.cloud.sql.v1.SqlInstancesService.GetDiskShrinkConfig", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "GetDiskShrinkConfig", - "fullName": "google.cloud.sql.v1.SqlInstancesService.GetDiskShrinkConfig", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_async", - "title": "SqlAvailableDatabaseVersionsService resetReplicaSize Sample", - "origin": "API_DEFINITION", - "description": " Reset Replica Size to primary instance disk size.", - "canonical": true, - "file": "sql_instances_service.reset_replica_size.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetReplicaSize", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ResetReplicaSize", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ResetReplicaSize", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ResetReplicaSize", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_async", - "title": "SqlAvailableDatabaseVersionsService getLatestRecoveryTime Sample", - "origin": "API_DEFINITION", - "description": " Get Latest Recovery Time for a given instance.", - "canonical": true, - "file": "sql_instances_service.get_latest_recovery_time.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLatestRecoveryTime", - "fullName": "google.cloud.sql.v1.SqlInstancesService.GetLatestRecoveryTime", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "source_instance_deletion_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "GetLatestRecoveryTime", - "fullName": "google.cloud.sql.v1.SqlInstancesService.GetLatestRecoveryTime", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_ExecuteSql_async", - "title": "SqlAvailableDatabaseVersionsService executeSql Sample", - "origin": "API_DEFINITION", - "description": " Execute SQL statements.", - "canonical": true, - "file": "sql_instances_service.execute_sql.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExecuteSql", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ExecuteSql", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.ExecuteSqlPayload" - } - ], - "resultType": ".google.cloud.sql.v1.SqlInstancesExecuteSqlResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ExecuteSql", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ExecuteSql", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_async", - "title": "SqlAvailableDatabaseVersionsService acquireSsrsLease Sample", - "origin": "API_DEFINITION", - "description": " Acquire a lease for the setup of SQL Server Reporting Services (SSRS).", - "canonical": true, - "file": "sql_instances_service.acquire_ssrs_lease.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 67, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AcquireSsrsLease", - "fullName": "google.cloud.sql.v1.SqlInstancesService.AcquireSsrsLease", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest" - } - ], - "resultType": ".google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "AcquireSsrsLease", - "fullName": "google.cloud.sql.v1.SqlInstancesService.AcquireSsrsLease", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_async", - "title": "SqlAvailableDatabaseVersionsService releaseSsrsLease Sample", - "origin": "API_DEFINITION", - "description": " Release a lease for the setup of SQL Server Reporting Services (SSRS).", - "canonical": true, - "file": "sql_instances_service.release_ssrs_lease.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReleaseSsrsLease", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ReleaseSsrsLease", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ReleaseSsrsLease", - "fullName": "google.cloud.sql.v1.SqlInstancesService.ReleaseSsrsLease", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async", - "title": "SqlAvailableDatabaseVersionsService preCheckMajorVersionUpgrade Sample", - "origin": "API_DEFINITION", - "description": " Execute MVU Pre-checks", - "canonical": true, - "file": "sql_instances_service.pre_check_major_version_upgrade.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PreCheckMajorVersionUpgrade", - "fullName": "google.cloud.sql.v1.SqlInstancesService.PreCheckMajorVersionUpgrade", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "PreCheckMajorVersionUpgrade", - "fullName": "google.cloud.sql.v1.SqlInstancesService.PreCheckMajorVersionUpgrade", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_async", - "title": "SqlAvailableDatabaseVersionsService pointInTimeRestore Sample", - "origin": "API_DEFINITION", - "description": " Point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery.", - "canonical": true, - "file": "sql_instances_service.point_in_time_restore.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PointInTimeRestore", - "fullName": "google.cloud.sql.v1.SqlInstancesService.PointInTimeRestore", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "context", - "type": ".google.cloud.sql.v1.PointInTimeRestoreContext" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1.SqlInstancesServiceClient" - }, - "method": { - "shortName": "PointInTimeRestore", - "fullName": "google.cloud.sql.v1.SqlInstancesService.PointInTimeRestore", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlOperationsService_Get_async", - "title": "SqlAvailableDatabaseVersionsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves an instance operation that has been performed on an instance.", - "canonical": true, - "file": "sql_operations_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlOperationsService.Get", - "async": true, - "parameters": [ - { - "name": "operation", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlOperationsServiceClient", - "fullName": "google.cloud.sql.v1.SqlOperationsServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlOperationsService.Get", - "service": { - "shortName": "SqlOperationsService", - "fullName": "google.cloud.sql.v1.SqlOperationsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlOperationsService_List_async", - "title": "SqlAvailableDatabaseVersionsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.", - "canonical": true, - "file": "sql_operations_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlOperationsService.List", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": "TYPE_UINT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.OperationsListResponse", - "client": { - "shortName": "SqlOperationsServiceClient", - "fullName": "google.cloud.sql.v1.SqlOperationsServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlOperationsService.List", - "service": { - "shortName": "SqlOperationsService", - "fullName": "google.cloud.sql.v1.SqlOperationsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlOperationsService_Cancel_async", - "title": "SqlAvailableDatabaseVersionsService cancel Sample", - "origin": "API_DEFINITION", - "description": " Cancels an instance operation that has been performed on an instance.", - "canonical": true, - "file": "sql_operations_service.cancel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Cancel", - "fullName": "google.cloud.sql.v1.SqlOperationsService.Cancel", - "async": true, - "parameters": [ - { - "name": "operation", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SqlOperationsServiceClient", - "fullName": "google.cloud.sql.v1.SqlOperationsServiceClient" - }, - "method": { - "shortName": "Cancel", - "fullName": "google.cloud.sql.v1.SqlOperationsService.Cancel", - "service": { - "shortName": "SqlOperationsService", - "fullName": "google.cloud.sql.v1.SqlOperationsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlSslCertsService_Delete_async", - "title": "SqlAvailableDatabaseVersionsService delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.", - "canonical": true, - "file": "sql_ssl_certs_service.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1.SqlSslCertsService.Delete", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "sha1_fingerprint", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlSslCertsServiceClient", - "fullName": "google.cloud.sql.v1.SqlSslCertsServiceClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1.SqlSslCertsService.Delete", - "service": { - "shortName": "SqlSslCertsService", - "fullName": "google.cloud.sql.v1.SqlSslCertsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlSslCertsService_Get_async", - "title": "SqlAvailableDatabaseVersionsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.", - "canonical": true, - "file": "sql_ssl_certs_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlSslCertsService.Get", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "sha1_fingerprint", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.SslCert", - "client": { - "shortName": "SqlSslCertsServiceClient", - "fullName": "google.cloud.sql.v1.SqlSslCertsServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlSslCertsService.Get", - "service": { - "shortName": "SqlSslCertsService", - "fullName": "google.cloud.sql.v1.SqlSslCertsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlSslCertsService_Insert_async", - "title": "SqlAvailableDatabaseVersionsService insert Sample", - "origin": "API_DEFINITION", - "description": " Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.", - "canonical": true, - "file": "sql_ssl_certs_service.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1.SqlSslCertsService.Insert", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.SslCertsInsertRequest" - } - ], - "resultType": ".google.cloud.sql.v1.SslCertsInsertResponse", - "client": { - "shortName": "SqlSslCertsServiceClient", - "fullName": "google.cloud.sql.v1.SqlSslCertsServiceClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1.SqlSslCertsService.Insert", - "service": { - "shortName": "SqlSslCertsService", - "fullName": "google.cloud.sql.v1.SqlSslCertsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlSslCertsService_List_async", - "title": "SqlAvailableDatabaseVersionsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists all of the current SSL certificates for the instance.", - "canonical": true, - "file": "sql_ssl_certs_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlSslCertsService.List", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.SslCertsListResponse", - "client": { - "shortName": "SqlSslCertsServiceClient", - "fullName": "google.cloud.sql.v1.SqlSslCertsServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlSslCertsService.List", - "service": { - "shortName": "SqlSslCertsService", - "fullName": "google.cloud.sql.v1.SqlSslCertsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlTiersService_List_async", - "title": "SqlAvailableDatabaseVersionsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists all available machine types (tiers) for Cloud SQL, for example, `db-custom-1-3840`. For more information, see https://cloud.google.com/sql/pricing.", - "canonical": true, - "file": "sql_tiers_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlTiersService.List", - "async": true, - "parameters": [ - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.TiersListResponse", - "client": { - "shortName": "SqlTiersServiceClient", - "fullName": "google.cloud.sql.v1.SqlTiersServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlTiersService.List", - "service": { - "shortName": "SqlTiersService", - "fullName": "google.cloud.sql.v1.SqlTiersService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlUsersService_Delete_async", - "title": "SqlAvailableDatabaseVersionsService delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes a user from a Cloud SQL instance.", - "canonical": true, - "file": "sql_users_service.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1.SqlUsersService.Delete", - "async": true, - "parameters": [ - { - "name": "host", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlUsersServiceClient", - "fullName": "google.cloud.sql.v1.SqlUsersServiceClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1.SqlUsersService.Delete", - "service": { - "shortName": "SqlUsersService", - "fullName": "google.cloud.sql.v1.SqlUsersService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlUsersService_Get_async", - "title": "SqlAvailableDatabaseVersionsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a resource containing information about a user.", - "canonical": true, - "file": "sql_users_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlUsersService.Get", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "host", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.User", - "client": { - "shortName": "SqlUsersServiceClient", - "fullName": "google.cloud.sql.v1.SqlUsersServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1.SqlUsersService.Get", - "service": { - "shortName": "SqlUsersService", - "fullName": "google.cloud.sql.v1.SqlUsersService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlUsersService_Insert_async", - "title": "SqlAvailableDatabaseVersionsService insert Sample", - "origin": "API_DEFINITION", - "description": " Creates a new user in a Cloud SQL instance.", - "canonical": true, - "file": "sql_users_service.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1.SqlUsersService.Insert", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.User" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlUsersServiceClient", - "fullName": "google.cloud.sql.v1.SqlUsersServiceClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1.SqlUsersService.Insert", - "service": { - "shortName": "SqlUsersService", - "fullName": "google.cloud.sql.v1.SqlUsersService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlUsersService_List_async", - "title": "SqlAvailableDatabaseVersionsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists users in the specified Cloud SQL instance.", - "canonical": true, - "file": "sql_users_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlUsersService.List", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1.UsersListResponse", - "client": { - "shortName": "SqlUsersServiceClient", - "fullName": "google.cloud.sql.v1.SqlUsersServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1.SqlUsersService.List", - "service": { - "shortName": "SqlUsersService", - "fullName": "google.cloud.sql.v1.SqlUsersService" - } - } - } - }, - { - "regionTag": "sqladmin_v1_generated_SqlUsersService_Update_async", - "title": "SqlAvailableDatabaseVersionsService update Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing user in a Cloud SQL instance.", - "canonical": true, - "file": "sql_users_service.update.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1.SqlUsersService.Update", - "async": true, - "parameters": [ - { - "name": "host", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "database_roles", - "type": "TYPE_STRING[]" - }, - { - "name": "revoke_existing_roles", - "type": "TYPE_BOOL" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1.User" - } - ], - "resultType": ".google.cloud.sql.v1.Operation", - "client": { - "shortName": "SqlUsersServiceClient", - "fullName": "google.cloud.sql.v1.SqlUsersServiceClient" - }, - "method": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1.SqlUsersService.Update", - "service": { - "shortName": "SqlUsersService", - "fullName": "google.cloud.sql.v1.SqlUsersService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.delete.js deleted file mode 100644 index c03ebf2c57b1..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.delete.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlBackupRunsService_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The ID of the backup run to delete. To find a backup run ID, use the - * list (https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list) - * method. - */ - // const id = 1234 - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlBackupRunsServiceClient(); - - async function callDelete() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.delete(request); - console.log(response); - } - - callDelete(); - // [END sqladmin_v1_generated_SqlBackupRunsService_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.get.js deleted file mode 100644 index 867147b44057..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.get.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlBackupRunsService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The ID of this backup run. - */ - // const id = 1234 - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlBackupRunsServiceClient(); - - async function callGet() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1_generated_SqlBackupRunsService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.insert.js deleted file mode 100644 index a01b73476709..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.insert.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlBackupRunsService_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlBackupRunsServiceClient(); - - async function callInsert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.insert(request); - console.log(response); - } - - callInsert(); - // [END sqladmin_v1_generated_SqlBackupRunsService_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.list.js deleted file mode 100644 index 627d76725262..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backup_runs_service.list.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlBackupRunsService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID, or "-" for all instances. This does not include - * the project ID. - */ - // const instance = 'abc123' - /** - * Maximum number of backup runs per response. - */ - // const maxResults = 1234 - /** - * A previously-returned page token representing part of the larger set of - * results to view. - */ - // const pageToken = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlBackupRunsServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1_generated_SqlBackupRunsService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.create_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.create_backup.js deleted file mode 100644 index 466f37bf8bb3..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.create_backup.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, backup) { - // [START sqladmin_v1_generated_SqlBackupsService_CreateBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource where this backup is created. - * Format: projects/{project} - */ - // const parent = 'abc123' - /** - * Required. The Backup to create. - */ - // const backup = {} - - // Imports the Sql library - const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlBackupsServiceClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backup, - }; - - // Run request - const response = await sqlClient.createBackup(request); - console.log(response); - } - - callCreateBackup(); - // [END sqladmin_v1_generated_SqlBackupsService_CreateBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.delete_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.delete_backup.js deleted file mode 100644 index 497ecbdf237b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.delete_backup.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START sqladmin_v1_generated_SqlBackupsService_DeleteBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the backup to delete. - * Format: projects/{project}/backups/{backup} - */ - // const name = 'abc123' - - // Imports the Sql library - const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlBackupsServiceClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await sqlClient.deleteBackup(request); - console.log(response); - } - - callDeleteBackup(); - // [END sqladmin_v1_generated_SqlBackupsService_DeleteBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.get_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.get_backup.js deleted file mode 100644 index 110e6dc6f41f..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.get_backup.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START sqladmin_v1_generated_SqlBackupsService_GetBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the backup to retrieve. - * Format: projects/{project}/backups/{backup} - */ - // const name = 'abc123' - - // Imports the Sql library - const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlBackupsServiceClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await sqlClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END sqladmin_v1_generated_SqlBackupsService_GetBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.list_backups.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.list_backups.js deleted file mode 100644 index a0aac56639b9..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.list_backups.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START sqladmin_v1_generated_SqlBackupsService_ListBackups_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - */ - // const parent = 'abc123' - /** - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - */ - // const filter = 'abc123' - - // Imports the Sql library - const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlBackupsServiceClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = sqlClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END sqladmin_v1_generated_SqlBackupsService_ListBackups_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.update_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.update_backup.js deleted file mode 100644 index 704bbba7616d..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_backups_service.update_backup.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(backup) { - // [START sqladmin_v1_generated_SqlBackupsService_UpdateBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The backup to update. - * The backup’s `name` field is used to identify the backup to update. - * Format: projects/{project}/backups/{backup} - */ - // const backup = {} - /** - * The list of fields that you can update. You can update only the description - * and retention period of the final backup. - */ - // const updateMask = {} - - // Imports the Sql library - const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlBackupsServiceClient(); - - async function callUpdateBackup() { - // Construct request - const request = { - backup, - }; - - // Run request - const response = await sqlClient.updateBackup(request); - console.log(response); - } - - callUpdateBackup(); - // [END sqladmin_v1_generated_SqlBackupsService_UpdateBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js deleted file mode 100644 index 0f587bb4183c..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * PEM encoded public key to include in the signed certificate. - */ - // const publicKey = 'abc123' - /** - * Optional. Access token to include in the signed certificate. - */ - // const accessToken = 'abc123' - /** - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - */ - // const readTime = {} - /** - * Optional. If set, it will contain the cert valid duration. - */ - // const validDuration = {} - - // Imports the Sql library - const {SqlConnectServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlConnectServiceClient(); - - async function callGenerateEphemeralCert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.generateEphemeralCert(request); - console.log(response); - } - - callGenerateEphemeralCert(); - // [END sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.get_connect_settings.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.get_connect_settings.js deleted file mode 100644 index 60e53daeec94..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_connect_service.get_connect_settings.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlConnectService_GetConnectSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - */ - // const readTime = {} - - // Imports the Sql library - const {SqlConnectServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlConnectServiceClient(); - - async function callGetConnectSettings() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.getConnectSettings(request); - console.log(response); - } - - callGetConnectSettings(); - // [END sqladmin_v1_generated_SqlConnectService_GetConnectSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.delete.js deleted file mode 100644 index 6430023a18b9..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.delete.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlDatabasesService_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the database to be deleted in the instance. - */ - // const database = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callDelete() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.delete(request); - console.log(response); - } - - callDelete(); - // [END sqladmin_v1_generated_SqlDatabasesService_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.get.js deleted file mode 100644 index 86762f7225f9..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.get.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlDatabasesService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the database in the instance. - */ - // const database = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callGet() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1_generated_SqlDatabasesService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.insert.js deleted file mode 100644 index 7bbb93000a88..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.insert.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlDatabasesService_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callInsert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.insert(request); - console.log(response); - } - - callInsert(); - // [END sqladmin_v1_generated_SqlDatabasesService_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.list.js deleted file mode 100644 index 73b3f149793c..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.list.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlDatabasesService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1_generated_SqlDatabasesService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.patch.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.patch.js deleted file mode 100644 index 4918b9ad5950..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.patch.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlDatabasesService_Patch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the database to be updated in the instance. - */ - // const database = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callPatch() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.patch(request); - console.log(response); - } - - callPatch(); - // [END sqladmin_v1_generated_SqlDatabasesService_Patch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.update.js deleted file mode 100644 index 07f453ad6eaa..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_databases_service.update.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlDatabasesService_Update_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the database to be updated in the instance. - */ - // const database = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callUpdate() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.update(request); - console.log(response); - } - - callUpdate(); - // [END sqladmin_v1_generated_SqlDatabasesService_Update_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_flags_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_flags_service.list.js deleted file mode 100644 index 29b61a2e573b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_flags_service.list.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlFlagsService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database type and version you want to retrieve flags for. By default, this - * method returns flags for all database types and versions. - */ - // const databaseVersion = 'abc123' - /** - * Optional. Specify the scope of flags to be returned by SqlFlagsListService. - * Return list of database flags if unspecified. - */ - // const flagScope = {} - - // Imports the Sql library - const {SqlFlagsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlFlagsServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1_generated_SqlFlagsService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js deleted file mode 100644 index 59784cd77f78..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project, body) { - // [START sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This doesn't include the project ID. It's - * composed of lowercase letters, numbers, and hyphens, and it must start with - * a letter. The total length must be 98 characters or less (Example: - * instance-id). - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance (Example: - * project-id). - */ - // const project = 'my-project' - /** - * Required. The request body. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callAcquireSsrsLease() { - // Construct request - const request = { - instance, - project, - body, - }; - - // Run request - const response = await sqlClient.acquireSsrsLease(request); - console.log(response); - } - - callAcquireSsrsLease(); - // [END sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_entra_id_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_entra_id_certificate.js deleted file mode 100644 index 9f6f8628f622..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_entra_id_certificate.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callAddEntraIdCertificate() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.addEntraIdCertificate(request); - console.log(response); - } - - callAddEntraIdCertificate(); - // [END sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_ca.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_ca.js deleted file mode 100644 index 40e9895d5e0d..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_ca.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_AddServerCa_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callAddServerCa() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.addServerCa(request); - console.log(response); - } - - callAddServerCa(); - // [END sqladmin_v1_generated_SqlInstancesService_AddServerCa_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_certificate.js deleted file mode 100644 index 622d2b0bf852..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.add_server_certificate.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callAddServerCertificate() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.addServerCertificate(request); - console.log(response); - } - - callAddServerCertificate(); - // [END sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js deleted file mode 100644 index e8213ce4277d..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project, body) { - // [START sqladmin_v1_generated_SqlInstancesService_Clone_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The ID of the Cloud SQL instance to be cloned (source). This does - * not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the source Cloud SQL instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callClone() { - // Construct request - const request = { - instance, - project, - body, - }; - - // Run request - const response = await sqlClient.clone(request); - console.log(response); - } - - callClone(); - // [END sqladmin_v1_generated_SqlInstancesService_Clone_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.create_ephemeral.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.create_ephemeral.js deleted file mode 100644 index eae442f73c52..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.create_ephemeral.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the Cloud SQL project. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callCreateEphemeral() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.createEphemeral(request); - console.log(response); - } - - callCreateEphemeral(); - // [END sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.delete.js deleted file mode 100644 index a7a0883bc2c5..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.delete.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance to be deleted. - */ - // const project = 'my-project' - /** - * Flag to opt-in for final backup. By default, it is turned off. - */ - // const enableFinalBackup = true - /** - * Optional. Retention period of the final backup. - */ - // const finalBackupTtlDays = 1234 - /** - * Optional. Final Backup expiration time. - * Timestamp in UTC of when this resource is considered expired. - */ - // const finalBackupExpiryTime = {} - /** - * Optional. The description of the final backup. - */ - // const finalBackupDescription = 'abc123' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callDelete() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.delete(request); - console.log(response); - } - - callDelete(); - // [END sqladmin_v1_generated_SqlInstancesService_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote.js deleted file mode 100644 index 070c22f1f15d..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project, body) { - // [START sqladmin_v1_generated_SqlInstancesService_Demote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance name. - */ - // const instance = 'abc123' - /** - * Required. ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Required. The request body. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callDemote() { - // Construct request - const request = { - instance, - project, - body, - }; - - // Run request - const response = await sqlClient.demote(request); - console.log(response); - } - - callDemote(); - // [END sqladmin_v1_generated_SqlInstancesService_Demote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote_master.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote_master.js deleted file mode 100644 index 248458e43531..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.demote_master.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_DemoteMaster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callDemoteMaster() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.demoteMaster(request); - console.log(response); - } - - callDemoteMaster(); - // [END sqladmin_v1_generated_SqlInstancesService_DemoteMaster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.execute_sql.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.execute_sql.js deleted file mode 100644 index 2baf4e163477..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.execute_sql.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1_generated_SqlInstancesService_ExecuteSql_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * The request body. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callExecuteSql() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.executeSql(request); - console.log(response); - } - - callExecuteSql(); - // [END sqladmin_v1_generated_SqlInstancesService_ExecuteSql_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.export.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.export.js deleted file mode 100644 index ec4a82c0a385..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.export.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_Export_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance to be exported. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callExport() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.export(request); - console.log(response); - } - - callExport(); - // [END sqladmin_v1_generated_SqlInstancesService_Export_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.failover.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.failover.js deleted file mode 100644 index fc9afe077c5b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.failover.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_Failover_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the read replica. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callFailover() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.failover(request); - console.log(response); - } - - callFailover(); - // [END sqladmin_v1_generated_SqlInstancesService_Failover_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get.js deleted file mode 100644 index 90bfac74cbca..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1_generated_SqlInstancesService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callGet() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1_generated_SqlInstancesService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_disk_shrink_config.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_disk_shrink_config.js deleted file mode 100644 index 1c470900f368..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_disk_shrink_config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callGetDiskShrinkConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.getDiskShrinkConfig(request); - console.log(response); - } - - callGetDiskShrinkConfig(); - // [END sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_latest_recovery_time.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_latest_recovery_time.js deleted file mode 100644 index 88b574468ec1..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.get_latest_recovery_time.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * The timestamp used to identify the time when the source instance is - * deleted. If this instance is deleted, then you must set the timestamp. - */ - // const sourceInstanceDeletionTime = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callGetLatestRecoveryTime() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.getLatestRecoveryTime(request); - console.log(response); - } - - callGetLatestRecoveryTime(); - // [END sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.import.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.import.js deleted file mode 100644 index 3c2f8afb1990..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.import.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_Import_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callImport() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.import(request); - console.log(response); - } - - callImport(); - // [END sqladmin_v1_generated_SqlInstancesService_Import_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.insert.js deleted file mode 100644 index 4ca794e4e729..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.insert.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Project ID of the project to which the newly created Cloud SQL instances - * should belong. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callInsert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.insert(request); - console.log(response); - } - - callInsert(); - // [END sqladmin_v1_generated_SqlInstancesService_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list.js deleted file mode 100644 index 5ed7ab3c662a..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * A filter expression that filters resources listed in the response. - * The expression is in the form of field:value. For example, - * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per - * their JSON representation, such as 'settings.userLabels.auto_start:true'. - * Multiple filter queries are space-separated. For example. - * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each - * expression is an AND expression. However, you can include AND and OR - * expressions explicitly. - */ - // const filter = 'abc123' - /** - * The maximum number of instances to return. The service may return fewer - * than this value. - * If unspecified, at most 500 instances are returned. - * The maximum value is 1000; values above 1000 are coerced to 1000. - */ - // const maxResults = 1234 - /** - * A previously-returned page token representing part of the larger set of - * results to view. - */ - // const pageToken = 'abc123' - /** - * Project ID of the project for which to list Cloud SQL instances. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1_generated_SqlInstancesService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_entra_id_certificates.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_entra_id_certificates.js deleted file mode 100644 index 30a74340cd6d..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_entra_id_certificates.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callListEntraIdCertificates() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.listEntraIdCertificates(request); - console.log(response); - } - - callListEntraIdCertificates(); - // [END sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_cas.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_cas.js deleted file mode 100644 index f08365357218..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_cas.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_ListServerCas_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callListServerCas() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.listServerCas(request); - console.log(response); - } - - callListServerCas(); - // [END sqladmin_v1_generated_SqlInstancesService_ListServerCas_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_certificates.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_certificates.js deleted file mode 100644 index f4d91f9d8703..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.list_server_certificates.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callListServerCertificates() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.listServerCertificates(request); - console.log(response); - } - - callListServerCertificates(); - // [END sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.patch.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.patch.js deleted file mode 100644 index 8cc125fc4492..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.patch.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_Patch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callPatch() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.patch(request); - console.log(response); - } - - callPatch(); - // [END sqladmin_v1_generated_SqlInstancesService_Patch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.perform_disk_shrink.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.perform_disk_shrink.js deleted file mode 100644 index bea8a94fdbb3..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.perform_disk_shrink.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Perform disk shrink context. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callPerformDiskShrink() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.performDiskShrink(request); - console.log(response); - } - - callPerformDiskShrink(); - // [END sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.point_in_time_restore.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.point_in_time_restore.js deleted file mode 100644 index f58df2ca7d9a..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.point_in_time_restore.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, context) { - // [START sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource where you created this instance. - * Format: projects/{project} - */ - // const parent = 'abc123' - /** - * Required. The context for request to perform a PITR on a Google Cloud - * Backup and Disaster Recovery managed instance. - */ - // const context = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callPointInTimeRestore() { - // Construct request - const request = { - parent, - context, - }; - - // Run request - const response = await sqlClient.pointInTimeRestore(request); - console.log(response); - } - - callPointInTimeRestore(); - // [END sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js deleted file mode 100644 index 7bfbd08b94d1..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project, body) { - // [START sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Required. The context for request to perform the pre-check major version - * upgrade operation. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callPreCheckMajorVersionUpgrade() { - // Construct request - const request = { - instance, - project, - body, - }; - - // Run request - const response = await sqlClient.preCheckMajorVersionUpgrade(request); - console.log(response); - } - - callPreCheckMajorVersionUpgrade(); - // [END sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.promote_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.promote_replica.js deleted file mode 100644 index c97cde80216e..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.promote_replica.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_PromoteReplica_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL read replica instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the read replica. - */ - // const project = 'my-project' - /** - * Set to true to invoke a replica failover to the DR - * replica. As part of replica failover, the promote operation attempts - * to add the original primary instance as a replica of the promoted - * DR replica when the original primary instance comes back online. - * If set to false or not specified, then the original primary - * instance becomes an independent Cloud SQL primary instance. - */ - // const failover = true - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callPromoteReplica() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.promoteReplica(request); - console.log(response); - } - - callPromoteReplica(); - // [END sqladmin_v1_generated_SqlInstancesService_PromoteReplica_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reencrypt.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reencrypt.js deleted file mode 100644 index 02836183f717..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reencrypt.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_Reencrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Reencrypt body that users request - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callReencrypt() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.reencrypt(request); - console.log(response); - } - - callReencrypt(); - // [END sqladmin_v1_generated_SqlInstancesService_Reencrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.release_ssrs_lease.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.release_ssrs_lease.js deleted file mode 100644 index ee402959f3bf..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.release_ssrs_lease.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Cloud SQL instance ID. This doesn't include the project ID. - * The instance ID contains lowercase letters, numbers, and hyphens, and it - * must start with a letter. This ID can have a maximum length of 98 - * characters. - */ - // const instance = 'abc123' - /** - * Required. The project ID that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callReleaseSsrsLease() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.releaseSsrsLease(request); - console.log(response); - } - - callReleaseSsrsLease(); - // [END sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reschedule_maintenance.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reschedule_maintenance.js deleted file mode 100644 index ee85f3286055..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reschedule_maintenance.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRescheduleMaintenance() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.rescheduleMaintenance(request); - console.log(response); - } - - callRescheduleMaintenance(); - // [END sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_replica_size.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_replica_size.js deleted file mode 100644 index 81e4bb4b4f5b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_replica_size.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL read replica instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the read replica. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callResetReplicaSize() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.resetReplicaSize(request); - console.log(response); - } - - callResetReplicaSize(); - // [END sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_ssl_config.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_ssl_config.js deleted file mode 100644 index 059f10bc1f89..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.reset_ssl_config.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Optional. Reset SSL mode to use. - */ - // const mode = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callResetSslConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.resetSslConfig(request); - console.log(response); - } - - callResetSslConfig(); - // [END sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restart.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restart.js deleted file mode 100644 index 2c91617c87fa..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restart.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_Restart_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance to be restarted. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRestart() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.restart(request); - console.log(response); - } - - callRestart(); - // [END sqladmin_v1_generated_SqlInstancesService_Restart_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restore_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restore_backup.js deleted file mode 100644 index 401b5ad08d8c..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.restore_backup.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_RestoreBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRestoreBackup() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.restoreBackup(request); - console.log(response); - } - - callRestoreBackup(); - // [END sqladmin_v1_generated_SqlInstancesService_RestoreBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js deleted file mode 100644 index 00835e932fb5..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Optional. Rotate Entra ID certificate request body. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRotateEntraIdCertificate() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.rotateEntraIdCertificate(request); - console.log(response); - } - - callRotateEntraIdCertificate(); - // [END sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_ca.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_ca.js deleted file mode 100644 index 4fd54a95b9d4..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_ca.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_RotateServerCa_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRotateServerCa() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.rotateServerCa(request); - console.log(response); - } - - callRotateServerCa(); - // [END sqladmin_v1_generated_SqlInstancesService_RotateServerCa_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_certificate.js deleted file mode 100644 index 96260974d5b1..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.rotate_server_certificate.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Optional. Rotate server certificate request body. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRotateServerCertificate() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.rotateServerCertificate(request); - console.log(response); - } - - callRotateServerCertificate(); - // [END sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_external_sync.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_external_sync.js deleted file mode 100644 index e092b5da92fb..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_external_sync.js +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_StartExternalSync_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * External sync mode. - */ - // const syncMode = {} - /** - * Whether to skip the verification step (VESS). - */ - // const skipVerification = true - /** - * MySQL-specific settings for start external sync. - */ - // const mysqlSyncConfig = {} - /** - * Optional. Parallel level for initial data sync. Currently only applicable - * for MySQL. - */ - // const syncParallelLevel = {} - /** - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - */ - // const migrationType = {} - /** - * Optional. MySQL only. True if end-user has confirmed that this SES call - * will wipe replica databases overlapping with the proposed selected_objects. - * If this field is not set and there are both overlapping and additional - * databases proposed, an error will be returned. - */ - // const replicaOverwriteEnabled = true - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callStartExternalSync() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.startExternalSync(request); - console.log(response); - } - - callStartExternalSync(); - // [END sqladmin_v1_generated_SqlInstancesService_StartExternalSync_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_replica.js deleted file mode 100644 index 45042f654198..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.start_replica.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_StartReplica_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL read replica instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the read replica. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callStartReplica() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.startReplica(request); - console.log(response); - } - - callStartReplica(); - // [END sqladmin_v1_generated_SqlInstancesService_StartReplica_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.stop_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.stop_replica.js deleted file mode 100644 index ea2fe1fe0f91..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.stop_replica.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_StopReplica_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL read replica instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the read replica. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callStopReplica() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.stopReplica(request); - console.log(response); - } - - callStopReplica(); - // [END sqladmin_v1_generated_SqlInstancesService_StopReplica_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.switchover.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.switchover.js deleted file mode 100644 index 044709c588b3..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.switchover.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_Switchover_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL read replica instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the replica. - */ - // const project = 'my-project' - /** - * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations - * timeout, which is a sum of all database operations. Default value is 10 - * minutes and can be modified to a maximum value of 24 hours. - */ - // const dbTimeout = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callSwitchover() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.switchover(request); - console.log(response); - } - - callSwitchover(); - // [END sqladmin_v1_generated_SqlInstancesService_Switchover_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.truncate_log.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.truncate_log.js deleted file mode 100644 index c062db6cfd65..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.truncate_log.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_TruncateLog_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the Cloud SQL project. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callTruncateLog() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.truncateLog(request); - console.log(response); - } - - callTruncateLog(); - // [END sqladmin_v1_generated_SqlInstancesService_TruncateLog_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.update.js deleted file mode 100644 index 2d50f4e4f277..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.update.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_Update_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callUpdate() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.update(request); - console.log(response); - } - - callUpdate(); - // [END sqladmin_v1_generated_SqlInstancesService_Update_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.verify_external_sync_settings.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.verify_external_sync_settings.js deleted file mode 100644 index d8fe16160719..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_instances_service.verify_external_sync_settings.js +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Flag to enable verifying connection only - */ - // const verifyConnectionOnly = true - /** - * External sync mode - */ - // const syncMode = {} - /** - * Optional. Flag to verify settings required by replication setup only - */ - // const verifyReplicationOnly = true - /** - * Optional. MySQL-specific settings for start external sync. - */ - // const mysqlSyncConfig = {} - /** - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - */ - // const migrationType = {} - /** - * Optional. Parallel level for initial data sync. Only applicable for - * PostgreSQL. - */ - // const syncParallelLevel = {} - /** - * Optional. Migrate only the specified objects from the source instance. If - * this field is empty, then migrate all objects. - */ - // const selectedObjects = [1,2,3,4] - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callVerifyExternalSyncSettings() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.verifyExternalSyncSettings(request); - console.log(response); - } - - callVerifyExternalSyncSettings(); - // [END sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.cancel.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.cancel.js deleted file mode 100644 index 90a6025243d5..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.cancel.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlOperationsService_Cancel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Instance operation ID. - */ - // const operation = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlOperationsServiceClient(); - - async function callCancel() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.cancel(request); - console.log(response); - } - - callCancel(); - // [END sqladmin_v1_generated_SqlOperationsService_Cancel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.get.js deleted file mode 100644 index ffe5ebf842ec..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.get.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(operation, project) { - // [START sqladmin_v1_generated_SqlOperationsService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Instance operation ID. - */ - // const operation = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlOperationsServiceClient(); - - async function callGet() { - // Construct request - const request = { - operation, - project, - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1_generated_SqlOperationsService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.list.js deleted file mode 100644 index ab7710090943..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_operations_service.list.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlOperationsService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Maximum number of operations per response. - */ - // const maxResults = 1234 - /** - * A previously-returned page token representing part of the larger set of - * results to view. - */ - // const pageToken = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlOperationsServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1_generated_SqlOperationsService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.delete.js deleted file mode 100644 index 1b9e728c99b0..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.delete.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlSslCertsService_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Sha1 FingerPrint. - */ - // const sha1Fingerprint = 'abc123' - - // Imports the Sql library - const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlSslCertsServiceClient(); - - async function callDelete() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.delete(request); - console.log(response); - } - - callDelete(); - // [END sqladmin_v1_generated_SqlSslCertsService_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.get.js deleted file mode 100644 index 30ec37159783..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.get.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlSslCertsService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Sha1 FingerPrint. - */ - // const sha1Fingerprint = 'abc123' - - // Imports the Sql library - const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlSslCertsServiceClient(); - - async function callGet() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1_generated_SqlSslCertsService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.insert.js deleted file mode 100644 index 42dae5471039..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.insert.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlSslCertsService_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlSslCertsServiceClient(); - - async function callInsert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.insert(request); - console.log(response); - } - - callInsert(); - // [END sqladmin_v1_generated_SqlSslCertsService_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.list.js deleted file mode 100644 index 3a55f77a1426..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_ssl_certs_service.list.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlSslCertsService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlSslCertsServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1_generated_SqlSslCertsService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_tiers_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_tiers_service.list.js deleted file mode 100644 index f3ab61587d33..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_tiers_service.list.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlTiersService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Project ID of the project for which to list tiers. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlTiersServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlTiersServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1_generated_SqlTiersService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.delete.js deleted file mode 100644 index 7da3027f3ed2..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.delete.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlUsersService_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Host of the user in the instance. - */ - // const host = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Name of the user in the instance. - */ - // const name = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlUsersServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlUsersServiceClient(); - - async function callDelete() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.delete(request); - console.log(response); - } - - callDelete(); - // [END sqladmin_v1_generated_SqlUsersService_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.get.js deleted file mode 100644 index e43ccc5a1d96..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.get.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlUsersService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * User of the instance. - */ - // const name = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Host of a user of the instance. - */ - // const host = 'abc123' - - // Imports the Sql library - const {SqlUsersServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlUsersServiceClient(); - - async function callGet() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1_generated_SqlUsersService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.insert.js deleted file mode 100644 index 6a1b0e7c0ca3..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.insert.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlUsersService_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlUsersServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlUsersServiceClient(); - - async function callInsert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.insert(request); - console.log(response); - } - - callInsert(); - // [END sqladmin_v1_generated_SqlUsersService_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.list.js deleted file mode 100644 index 5c2ed4306dde..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.list.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlUsersService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlUsersServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlUsersServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1_generated_SqlUsersService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.update.js deleted file mode 100644 index 2db92883fbaa..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1/sql_users_service.update.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1_generated_SqlUsersService_Update_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Host of the user in the instance. - */ - // const host = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Name of the user in the instance. - */ - // const name = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Optional. List of database roles to grant to the user. body.database_roles - * will be ignored for update request. - */ - // const databaseRoles = ['abc','def'] - /** - * Optional. Specifies whether to revoke existing roles that are not present - * in the `database_roles` field. If `false` or unset, the database roles - * specified in `database_roles` are added to the user's existing roles. - */ - // const revokeExistingRoles = true - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlUsersServiceClient} = require('@google-cloud/sql').v1; - - // Instantiates a client - const sqlClient = new SqlUsersServiceClient(); - - async function callUpdate() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.update(request); - console.log(response); - } - - callUpdate(); - // [END sqladmin_v1_generated_SqlUsersService_Update_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json deleted file mode 100644 index 3806a1cf62ff..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json +++ /dev/null @@ -1,3567 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-sql", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.sql.v1beta4", - "version": "v1beta4" - } - ] - }, - "snippets": [ - { - "regionTag": "sqladmin_v1beta4_generated_SqlBackupRunsService_Delete_async", - "title": "SqlBackupRunsService delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes the backup taken by a backup run.", - "canonical": true, - "file": "sql_backup_runs_service.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Delete", - "async": true, - "parameters": [ - { - "name": "id", - "type": "TYPE_INT64" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlBackupRunsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsServiceClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Delete", - "service": { - "shortName": "SqlBackupRunsService", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlBackupRunsService_Get_async", - "title": "SqlBackupRunsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a resource containing information about a backup run.", - "canonical": true, - "file": "sql_backup_runs_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Get", - "async": true, - "parameters": [ - { - "name": "id", - "type": "TYPE_INT64" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.BackupRun", - "client": { - "shortName": "SqlBackupRunsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Get", - "service": { - "shortName": "SqlBackupRunsService", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlBackupRunsService_Insert_async", - "title": "SqlBackupRunsService insert Sample", - "origin": "API_DEFINITION", - "description": " Creates a new backup run on demand.", - "canonical": true, - "file": "sql_backup_runs_service.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Insert", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.BackupRun" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlBackupRunsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsServiceClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.Insert", - "service": { - "shortName": "SqlBackupRunsService", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlBackupRunsService_List_async", - "title": "SqlBackupRunsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists all backup runs associated with the project or a given instance and configuration in the reverse chronological order of the backup initiation time.", - "canonical": true, - "file": "sql_backup_runs_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.List", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.BackupRunsListResponse", - "client": { - "shortName": "SqlBackupRunsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService.List", - "service": { - "shortName": "SqlBackupRunsService", - "fullName": "google.cloud.sql.v1beta4.SqlBackupRunsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlBackupsService_CreateBackup_async", - "title": "SqlBackupRunsService createBackup Sample", - "origin": "API_DEFINITION", - "description": " Creates a backup for a Cloud SQL instance. This API can be used only to create on-demand backups.", - "canonical": true, - "file": "sql_backups_service.create_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateBackup", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.CreateBackup", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "backup", - "type": ".google.cloud.sql.v1beta4.Backup" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlBackupsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsServiceClient" - }, - "method": { - "shortName": "CreateBackup", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.CreateBackup", - "service": { - "shortName": "SqlBackupsService", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlBackupsService_GetBackup_async", - "title": "SqlBackupRunsService getBackup Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a resource containing information about a backup.", - "canonical": true, - "file": "sql_backups_service.get_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetBackup", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.GetBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Backup", - "client": { - "shortName": "SqlBackupsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsServiceClient" - }, - "method": { - "shortName": "GetBackup", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.GetBackup", - "service": { - "shortName": "SqlBackupsService", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlBackupsService_ListBackups_async", - "title": "SqlBackupRunsService listBackups Sample", - "origin": "API_DEFINITION", - "description": " Lists all backups associated with the project.", - "canonical": true, - "file": "sql_backups_service.list_backups.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListBackups", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.ListBackups", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.ListBackupsResponse", - "client": { - "shortName": "SqlBackupsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsServiceClient" - }, - "method": { - "shortName": "ListBackups", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.ListBackups", - "service": { - "shortName": "SqlBackupsService", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlBackupsService_UpdateBackup_async", - "title": "SqlBackupRunsService updateBackup Sample", - "origin": "API_DEFINITION", - "description": " Updates the retention period and the description of the backup. You can use this API to update final backups only.", - "canonical": true, - "file": "sql_backups_service.update_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateBackup", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.UpdateBackup", - "async": true, - "parameters": [ - { - "name": "backup", - "type": ".google.cloud.sql.v1beta4.Backup" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlBackupsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsServiceClient" - }, - "method": { - "shortName": "UpdateBackup", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.UpdateBackup", - "service": { - "shortName": "SqlBackupsService", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlBackupsService_DeleteBackup_async", - "title": "SqlBackupRunsService deleteBackup Sample", - "origin": "API_DEFINITION", - "description": " Deletes the backup.", - "canonical": true, - "file": "sql_backups_service.delete_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.DeleteBackup", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlBackupsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsServiceClient" - }, - "method": { - "shortName": "DeleteBackup", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService.DeleteBackup", - "service": { - "shortName": "SqlBackupsService", - "fullName": "google.cloud.sql.v1beta4.SqlBackupsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlConnectService_GetConnectSettings_async", - "title": "SqlBackupRunsService getConnectSettings Sample", - "origin": "API_DEFINITION", - "description": " Retrieves connect settings about a Cloud SQL instance.", - "canonical": true, - "file": "sql_connect_service.get_connect_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConnectSettings", - "fullName": "google.cloud.sql.v1beta4.SqlConnectService.GetConnectSettings", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.sql.v1beta4.ConnectSettings", - "client": { - "shortName": "SqlConnectServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlConnectServiceClient" - }, - "method": { - "shortName": "GetConnectSettings", - "fullName": "google.cloud.sql.v1beta4.SqlConnectService.GetConnectSettings", - "service": { - "shortName": "SqlConnectService", - "fullName": "google.cloud.sql.v1beta4.SqlConnectService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlConnectService_GenerateEphemeralCert_async", - "title": "SqlBackupRunsService generateEphemeralCert Sample", - "origin": "API_DEFINITION", - "description": " Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.", - "canonical": true, - "file": "sql_connect_service.generate_ephemeral_cert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GenerateEphemeralCert", - "fullName": "google.cloud.sql.v1beta4.SqlConnectService.GenerateEphemeralCert", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "public_key", - "type": "TYPE_STRING" - }, - { - "name": "access_token", - "type": "TYPE_STRING" - }, - { - "name": "read_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "valid_duration", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.cloud.sql.v1beta4.GenerateEphemeralCertResponse", - "client": { - "shortName": "SqlConnectServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlConnectServiceClient" - }, - "method": { - "shortName": "GenerateEphemeralCert", - "fullName": "google.cloud.sql.v1beta4.SqlConnectService.GenerateEphemeralCert", - "service": { - "shortName": "SqlConnectService", - "fullName": "google.cloud.sql.v1beta4.SqlConnectService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_Delete_async", - "title": "SqlBackupRunsService delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes a database from a Cloud SQL instance.", - "canonical": true, - "file": "sql_databases_service.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Delete", - "async": true, - "parameters": [ - { - "name": "database", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Delete", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_Get_async", - "title": "SqlBackupRunsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a resource containing information about a database inside a Cloud SQL instance.", - "canonical": true, - "file": "sql_databases_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Get", - "async": true, - "parameters": [ - { - "name": "database", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Database", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Get", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_Insert_async", - "title": "SqlBackupRunsService insert Sample", - "origin": "API_DEFINITION", - "description": " Inserts a resource containing information about a database inside a Cloud SQL instance. **Note:** You can't modify the default character set and collation.", - "canonical": true, - "file": "sql_databases_service.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Insert", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.Database" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Insert", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_List_async", - "title": "SqlBackupRunsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists databases in the specified Cloud SQL instance.", - "canonical": true, - "file": "sql_databases_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.List", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.DatabasesListResponse", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.List", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_Patch_async", - "title": "SqlBackupRunsService patch Sample", - "origin": "API_DEFINITION", - "description": " Partially updates a resource containing information about a database inside a Cloud SQL instance. This method supports patch semantics.", - "canonical": true, - "file": "sql_databases_service.patch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Patch", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Patch", - "async": true, - "parameters": [ - { - "name": "database", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.Database" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "Patch", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Patch", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlDatabasesService_Update_async", - "title": "SqlBackupRunsService update Sample", - "origin": "API_DEFINITION", - "description": " Updates a resource containing information about a database inside a Cloud SQL instance.", - "canonical": true, - "file": "sql_databases_service.update.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Update", - "async": true, - "parameters": [ - { - "name": "database", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.Database" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlDatabasesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesServiceClient" - }, - "method": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService.Update", - "service": { - "shortName": "SqlDatabasesService", - "fullName": "google.cloud.sql.v1beta4.SqlDatabasesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlFlagsService_List_async", - "title": "SqlBackupRunsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists all available database flags for Cloud SQL instances.", - "canonical": true, - "file": "sql_flags_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlFlagsService.List", - "async": true, - "parameters": [ - { - "name": "database_version", - "type": "TYPE_STRING" - }, - { - "name": "flag_scope", - "type": ".google.cloud.sql.v1beta4.SqlFlagScope" - } - ], - "resultType": ".google.cloud.sql.v1beta4.FlagsListResponse", - "client": { - "shortName": "SqlFlagsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlFlagsServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlFlagsService.List", - "service": { - "shortName": "SqlFlagsService", - "fullName": "google.cloud.sql.v1beta4.SqlFlagsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_AddServerCa_async", - "title": "SqlBackupRunsService addServerCa Sample", - "origin": "API_DEFINITION", - "description": " Add a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in. For instances that have enabled Certificate Authority Service (CAS) based server CA, use AddServerCertificate to add a new server certificate.", - "canonical": true, - "file": "sql_instances_service.add_server_ca.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddServerCa", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddServerCa", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "AddServerCa", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddServerCa", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_AddServerCertificate_async", - "title": "SqlBackupRunsService addServerCertificate Sample", - "origin": "API_DEFINITION", - "description": " Add a new trusted server certificate version for the specified instance using Certificate Authority Service (CAS) server CA. Required to prepare for a certificate rotation. If a server certificate version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one certificate version waiting to be rotated in. For instances not using CAS server CA, use AddServerCa instead.", - "canonical": true, - "file": "sql_instances_service.add_server_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddServerCertificate", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddServerCertificate", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "AddServerCertificate", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddServerCertificate", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_AddEntraIdCertificate_async", - "title": "SqlBackupRunsService addEntraIdCertificate Sample", - "origin": "API_DEFINITION", - "description": " Adds a new Entra ID certificate for the specified instance. If an Entra ID certificate was previously added but never used in a certificate rotation, this operation replaces that version.", - "canonical": true, - "file": "sql_instances_service.add_entra_id_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddEntraIdCertificate", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddEntraIdCertificate", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "AddEntraIdCertificate", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AddEntraIdCertificate", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Clone_async", - "title": "SqlBackupRunsService clone Sample", - "origin": "API_DEFINITION", - "description": " Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.", - "canonical": true, - "file": "sql_instances_service.clone.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Clone", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Clone", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesCloneRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Clone", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Clone", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Delete_async", - "title": "SqlBackupRunsService delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes a Cloud SQL instance.", - "canonical": true, - "file": "sql_instances_service.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Delete", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "enable_final_backup", - "type": "TYPE_BOOL" - }, - { - "name": "final_backup_ttl_days", - "type": "TYPE_INT64" - }, - { - "name": "final_backup_expiry_time", - "type": ".google.protobuf.Timestamp" - }, - { - "name": "final_backup_description", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Delete", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_DemoteMaster_async", - "title": "SqlBackupRunsService demoteMaster Sample", - "origin": "API_DEFINITION", - "description": " Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.", - "canonical": true, - "file": "sql_instances_service.demote_master.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DemoteMaster", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.DemoteMaster", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesDemoteMasterRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "DemoteMaster", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.DemoteMaster", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Demote_async", - "title": "SqlBackupRunsService demote Sample", - "origin": "API_DEFINITION", - "description": " Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server.", - "canonical": true, - "file": "sql_instances_service.demote.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Demote", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Demote", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesDemoteRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Demote", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Demote", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Export_async", - "title": "SqlBackupRunsService export Sample", - "origin": "API_DEFINITION", - "description": " Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.", - "canonical": true, - "file": "sql_instances_service.export.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Export", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Export", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesExportRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Export", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Export", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Failover_async", - "title": "SqlBackupRunsService failover Sample", - "origin": "API_DEFINITION", - "description": " Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the [Overview of high availability](https://cloud.google.com/sql/docs/mysql/high-availability) page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.", - "canonical": true, - "file": "sql_instances_service.failover.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Failover", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Failover", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesFailoverRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Failover", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Failover", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Reencrypt_async", - "title": "SqlBackupRunsService reencrypt Sample", - "origin": "API_DEFINITION", - "description": " Reencrypt CMEK instance with latest key version.", - "canonical": true, - "file": "sql_instances_service.reencrypt.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Reencrypt", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Reencrypt", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesReencryptRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Reencrypt", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Reencrypt", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Get_async", - "title": "SqlBackupRunsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a resource containing information about a Cloud SQL instance.", - "canonical": true, - "file": "sql_instances_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Get", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.DatabaseInstance", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Get", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Import_async", - "title": "SqlBackupRunsService import Sample", - "origin": "API_DEFINITION", - "description": " Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.", - "canonical": true, - "file": "sql_instances_service.import.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Import", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Import", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesImportRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Import", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Import", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Insert_async", - "title": "SqlBackupRunsService insert Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Cloud SQL instance.", - "canonical": true, - "file": "sql_instances_service.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Insert", - "async": true, - "parameters": [ - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.DatabaseInstance" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Insert", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_List_async", - "title": "SqlBackupRunsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists instances under a given project.", - "canonical": true, - "file": "sql_instances_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 75, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.List", - "async": true, - "parameters": [ - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": "TYPE_UINT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.InstancesListResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.List", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ListServerCas_async", - "title": "SqlBackupRunsService listServerCas Sample", - "origin": "API_DEFINITION", - "description": " Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.", - "canonical": true, - "file": "sql_instances_service.list_server_cas.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServerCas", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListServerCas", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.InstancesListServerCasResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ListServerCas", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListServerCas", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ListServerCertificates_async", - "title": "SqlBackupRunsService listServerCertificates Sample", - "origin": "API_DEFINITION", - "description": " Lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead.", - "canonical": true, - "file": "sql_instances_service.list_server_certificates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListServerCertificates", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListServerCertificates", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ListServerCertificates", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListServerCertificates", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ListEntraIdCertificates_async", - "title": "SqlBackupRunsService listEntraIdCertificates Sample", - "origin": "API_DEFINITION", - "description": " Lists all versions of EntraID certificates for the specified instance. There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out.", - "canonical": true, - "file": "sql_instances_service.list_entra_id_certificates.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListEntraIdCertificates", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListEntraIdCertificates", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ListEntraIdCertificates", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ListEntraIdCertificates", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Patch_async", - "title": "SqlBackupRunsService patch Sample", - "origin": "API_DEFINITION", - "description": " Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.", - "canonical": true, - "file": "sql_instances_service.patch.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Patch", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Patch", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.DatabaseInstance" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Patch", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Patch", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_PromoteReplica_async", - "title": "SqlBackupRunsService promoteReplica Sample", - "origin": "API_DEFINITION", - "description": " Promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.", - "canonical": true, - "file": "sql_instances_service.promote_replica.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PromoteReplica", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PromoteReplica", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "failover", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "PromoteReplica", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PromoteReplica", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Switchover_async", - "title": "SqlBackupRunsService switchover Sample", - "origin": "API_DEFINITION", - "description": " Switches over from the primary instance to the DR replica instance.", - "canonical": true, - "file": "sql_instances_service.switchover.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Switchover", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Switchover", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "db_timeout", - "type": ".google.protobuf.Duration" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Switchover", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Switchover", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ResetSslConfig_async", - "title": "SqlBackupRunsService resetSslConfig Sample", - "origin": "API_DEFINITION", - "description": " Deletes all client certificates and generates a new server SSL certificate for the instance.", - "canonical": true, - "file": "sql_instances_service.reset_ssl_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetSslConfig", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ResetSslConfig", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "mode", - "type": ".google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ResetSslConfig", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ResetSslConfig", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Restart_async", - "title": "SqlBackupRunsService restart Sample", - "origin": "API_DEFINITION", - "description": " Restarts a Cloud SQL instance.", - "canonical": true, - "file": "sql_instances_service.restart.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Restart", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Restart", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Restart", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Restart", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_RestoreBackup_async", - "title": "SqlBackupRunsService restoreBackup Sample", - "origin": "API_DEFINITION", - "description": " Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.", - "canonical": true, - "file": "sql_instances_service.restore_backup.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RestoreBackup", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RestoreBackup", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesRestoreBackupRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "RestoreBackup", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RestoreBackup", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCa_async", - "title": "SqlBackupRunsService rotateServerCa Sample", - "origin": "API_DEFINITION", - "description": " Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use RotateServerCertificate to rotate the server certificate.", - "canonical": true, - "file": "sql_instances_service.rotate_server_ca.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RotateServerCa", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCa", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesRotateServerCaRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "RotateServerCa", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCa", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCertificate_async", - "title": "SqlBackupRunsService rotateServerCertificate Sample", - "origin": "API_DEFINITION", - "description": " Rotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead.", - "canonical": true, - "file": "sql_instances_service.rotate_server_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RotateServerCertificate", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCertificate", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "RotateServerCertificate", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateServerCertificate", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_RotateEntraIdCertificate_async", - "title": "SqlBackupRunsService rotateEntraIdCertificate Sample", - "origin": "API_DEFINITION", - "description": " Rotates the Entra Id certificate version to one previously added with the addEntraIdCertificate method.", - "canonical": true, - "file": "sql_instances_service.rotate_entra_id_certificate.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 63, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RotateEntraIdCertificate", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateEntraIdCertificate", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "RotateEntraIdCertificate", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RotateEntraIdCertificate", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_StartReplica_async", - "title": "SqlBackupRunsService startReplica Sample", - "origin": "API_DEFINITION", - "description": " Starts the replication in the read replica instance.", - "canonical": true, - "file": "sql_instances_service.start_replica.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartReplica", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StartReplica", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "StartReplica", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StartReplica", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_StopReplica_async", - "title": "SqlBackupRunsService stopReplica Sample", - "origin": "API_DEFINITION", - "description": " Stops the replication in the read replica instance.", - "canonical": true, - "file": "sql_instances_service.stop_replica.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopReplica", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StopReplica", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "StopReplica", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StopReplica", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_TruncateLog_async", - "title": "SqlBackupRunsService truncateLog Sample", - "origin": "API_DEFINITION", - "description": " Truncate MySQL general and slow query log tables MySQL only.", - "canonical": true, - "file": "sql_instances_service.truncate_log.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TruncateLog", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.TruncateLog", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesTruncateLogRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "TruncateLog", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.TruncateLog", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_Update_async", - "title": "SqlBackupRunsService update Sample", - "origin": "API_DEFINITION", - "description": " Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.", - "canonical": true, - "file": "sql_instances_service.update.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Update", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.DatabaseInstance" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.Update", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_CreateEphemeral_async", - "title": "SqlBackupRunsService createEphemeral Sample", - "origin": "API_DEFINITION", - "description": " Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.", - "canonical": true, - "file": "sql_instances_service.create_ephemeral.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateEphemeral", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.CreateEphemeral", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.SslCert", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "CreateEphemeral", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.CreateEphemeral", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_RescheduleMaintenance_async", - "title": "SqlBackupRunsService rescheduleMaintenance Sample", - "origin": "API_DEFINITION", - "description": " Reschedules the maintenance on the given instance.", - "canonical": true, - "file": "sql_instances_service.reschedule_maintenance.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "RescheduleMaintenance", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RescheduleMaintenance", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "RescheduleMaintenance", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.RescheduleMaintenance", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_VerifyExternalSyncSettings_async", - "title": "SqlBackupRunsService verifyExternalSyncSettings Sample", - "origin": "API_DEFINITION", - "description": " Verify External primary instance external sync settings.", - "canonical": true, - "file": "sql_instances_service.verify_external_sync_settings.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 88, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "VerifyExternalSyncSettings", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.VerifyExternalSyncSettings", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "verify_connection_only", - "type": "TYPE_BOOL" - }, - { - "name": "sync_mode", - "type": ".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode" - }, - { - "name": "verify_replication_only", - "type": "TYPE_BOOL" - }, - { - "name": "mysql_sync_config", - "type": ".google.cloud.sql.v1beta4.MySqlSyncConfig" - }, - { - "name": "migration_type", - "type": ".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType" - }, - { - "name": "sync_parallel_level", - "type": ".google.cloud.sql.v1beta4.ExternalSyncParallelLevel" - }, - { - "name": "selected_objects", - "type": "TYPE_MESSAGE[]" - } - ], - "resultType": ".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "VerifyExternalSyncSettings", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.VerifyExternalSyncSettings", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_StartExternalSync_async", - "title": "SqlBackupRunsService startExternalSync Sample", - "origin": "API_DEFINITION", - "description": " Start External primary instance migration.", - "canonical": true, - "file": "sql_instances_service.start_external_sync.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 86, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartExternalSync", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StartExternalSync", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "sync_mode", - "type": ".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode" - }, - { - "name": "skip_verification", - "type": "TYPE_BOOL" - }, - { - "name": "mysql_sync_config", - "type": ".google.cloud.sql.v1beta4.MySqlSyncConfig" - }, - { - "name": "sync_parallel_level", - "type": ".google.cloud.sql.v1beta4.ExternalSyncParallelLevel" - }, - { - "name": "migration_type", - "type": ".google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType" - }, - { - "name": "replica_overwrite_enabled", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "StartExternalSync", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.StartExternalSync", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_PerformDiskShrink_async", - "title": "SqlBackupRunsService performDiskShrink Sample", - "origin": "API_DEFINITION", - "description": " Perform Disk Shrink on primary instance.", - "canonical": true, - "file": "sql_instances_service.perform_disk_shrink.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PerformDiskShrink", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PerformDiskShrink", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.PerformDiskShrinkContext" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "PerformDiskShrink", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PerformDiskShrink", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_GetDiskShrinkConfig_async", - "title": "SqlBackupRunsService getDiskShrinkConfig Sample", - "origin": "API_DEFINITION", - "description": " Get Disk Shrink Config for a given instance.", - "canonical": true, - "file": "sql_instances_service.get_disk_shrink_config.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetDiskShrinkConfig", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.GetDiskShrinkConfig", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "GetDiskShrinkConfig", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.GetDiskShrinkConfig", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ResetReplicaSize_async", - "title": "SqlBackupRunsService resetReplicaSize Sample", - "origin": "API_DEFINITION", - "description": " Reset Replica Size to primary instance disk size.", - "canonical": true, - "file": "sql_instances_service.reset_replica_size.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ResetReplicaSize", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ResetReplicaSize", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ResetReplicaSize", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ResetReplicaSize", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_GetLatestRecoveryTime_async", - "title": "SqlBackupRunsService getLatestRecoveryTime Sample", - "origin": "API_DEFINITION", - "description": " Get Latest Recovery Time for a given instance.", - "canonical": true, - "file": "sql_instances_service.get_latest_recovery_time.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 61, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetLatestRecoveryTime", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.GetLatestRecoveryTime", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "source_instance_deletion_time", - "type": ".google.protobuf.Timestamp" - } - ], - "resultType": ".google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "GetLatestRecoveryTime", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.GetLatestRecoveryTime", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ExecuteSql_async", - "title": "SqlBackupRunsService executeSql Sample", - "origin": "API_DEFINITION", - "description": " Execute SQL statements.", - "canonical": true, - "file": "sql_instances_service.execute_sql.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ExecuteSql", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ExecuteSql", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.ExecuteSqlPayload" - } - ], - "resultType": ".google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ExecuteSql", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ExecuteSql", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_async", - "title": "SqlBackupRunsService acquireSsrsLease Sample", - "origin": "API_DEFINITION", - "description": " Acquire a lease for the setup of SQL Server Reporting Services (SSRS).", - "canonical": true, - "file": "sql_instances_service.acquire_ssrs_lease.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AcquireSsrsLease", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AcquireSsrsLease", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "AcquireSsrsLease", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.AcquireSsrsLease", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_async", - "title": "SqlBackupRunsService releaseSsrsLease Sample", - "origin": "API_DEFINITION", - "description": " Release a lease for the setup of SQL Server Reporting Services (SSRS).", - "canonical": true, - "file": "sql_instances_service.release_ssrs_lease.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 62, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ReleaseSsrsLease", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ReleaseSsrsLease", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "ReleaseSsrsLease", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.ReleaseSsrsLease", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async", - "title": "SqlBackupRunsService preCheckMajorVersionUpgrade Sample", - "origin": "API_DEFINITION", - "description": " Execute MVU Pre-checks", - "canonical": true, - "file": "sql_instances_service.pre_check_major_version_upgrade.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PreCheckMajorVersionUpgrade", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PreCheckMajorVersionUpgrade", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "PreCheckMajorVersionUpgrade", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PreCheckMajorVersionUpgrade", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlInstancesService_PointInTimeRestore_async", - "title": "SqlBackupRunsService pointInTimeRestore Sample", - "origin": "API_DEFINITION", - "description": " Point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery.", - "canonical": true, - "file": "sql_instances_service.point_in_time_restore.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "PointInTimeRestore", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PointInTimeRestore", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "context", - "type": ".google.cloud.sql.v1beta4.PointInTimeRestoreContext" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlInstancesServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesServiceClient" - }, - "method": { - "shortName": "PointInTimeRestore", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService.PointInTimeRestore", - "service": { - "shortName": "SqlInstancesService", - "fullName": "google.cloud.sql.v1beta4.SqlInstancesService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlOperationsService_Get_async", - "title": "SqlBackupRunsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves an instance operation that has been performed on an instance.", - "canonical": true, - "file": "sql_operations_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.Get", - "async": true, - "parameters": [ - { - "name": "operation", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlOperationsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.Get", - "service": { - "shortName": "SqlOperationsService", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlOperationsService_List_async", - "title": "SqlBackupRunsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists all instance operations that have been performed on the given Cloud SQL instance in the reverse chronological order of the start time.", - "canonical": true, - "file": "sql_operations_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.List", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "max_results", - "type": "TYPE_UINT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.OperationsListResponse", - "client": { - "shortName": "SqlOperationsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.List", - "service": { - "shortName": "SqlOperationsService", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlOperationsService_Cancel_async", - "title": "SqlBackupRunsService cancel Sample", - "origin": "API_DEFINITION", - "description": " Cancels an instance operation that has been performed on an instance. Ordinarily, this method name should be `CancelSqlOperation`.", - "canonical": true, - "file": "sql_operations_service.cancel.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Cancel", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.Cancel", - "async": true, - "parameters": [ - { - "name": "operation", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SqlOperationsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsServiceClient" - }, - "method": { - "shortName": "Cancel", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsService.Cancel", - "service": { - "shortName": "SqlOperationsService", - "fullName": "google.cloud.sql.v1beta4.SqlOperationsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlSslCertsService_Delete_async", - "title": "SqlBackupRunsService delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes the SSL certificate. For First Generation instances, the certificate remains valid until the instance is restarted.", - "canonical": true, - "file": "sql_ssl_certs_service.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Delete", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "sha1_fingerprint", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlSslCertsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsServiceClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Delete", - "service": { - "shortName": "SqlSslCertsService", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlSslCertsService_Get_async", - "title": "SqlBackupRunsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a particular SSL certificate. Does not include the private key (required for usage). The private key must be saved from the response to initial creation.", - "canonical": true, - "file": "sql_ssl_certs_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 60, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Get", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "sha1_fingerprint", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.SslCert", - "client": { - "shortName": "SqlSslCertsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Get", - "service": { - "shortName": "SqlSslCertsService", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlSslCertsService_Insert_async", - "title": "SqlBackupRunsService insert Sample", - "origin": "API_DEFINITION", - "description": " Creates an SSL certificate and returns it along with the private key and server certificate authority. The new certificate will not be usable until the instance is restarted.", - "canonical": true, - "file": "sql_ssl_certs_service.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Insert", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.SslCertsInsertRequest" - } - ], - "resultType": ".google.cloud.sql.v1beta4.SslCertsInsertResponse", - "client": { - "shortName": "SqlSslCertsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsServiceClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.Insert", - "service": { - "shortName": "SqlSslCertsService", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlSslCertsService_List_async", - "title": "SqlBackupRunsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists all of the current SSL certificates for the instance.", - "canonical": true, - "file": "sql_ssl_certs_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.List", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.SslCertsListResponse", - "client": { - "shortName": "SqlSslCertsServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService.List", - "service": { - "shortName": "SqlSslCertsService", - "fullName": "google.cloud.sql.v1beta4.SqlSslCertsService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlTiersService_List_async", - "title": "SqlBackupRunsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists all available machine types (tiers) for Cloud SQL, for example, `db-custom-1-3840`. For related information, see [Pricing](/sql/pricing).", - "canonical": true, - "file": "sql_tiers_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 52, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlTiersService.List", - "async": true, - "parameters": [ - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.TiersListResponse", - "client": { - "shortName": "SqlTiersServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlTiersServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlTiersService.List", - "service": { - "shortName": "SqlTiersService", - "fullName": "google.cloud.sql.v1beta4.SqlTiersService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlUsersService_Delete_async", - "title": "SqlBackupRunsService delete Sample", - "origin": "API_DEFINITION", - "description": " Deletes a user from a Cloud SQL instance.", - "canonical": true, - "file": "sql_users_service.delete.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Delete", - "async": true, - "parameters": [ - { - "name": "host", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlUsersServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlUsersServiceClient" - }, - "method": { - "shortName": "Delete", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Delete", - "service": { - "shortName": "SqlUsersService", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlUsersService_Get_async", - "title": "SqlBackupRunsService get Sample", - "origin": "API_DEFINITION", - "description": " Retrieves a resource containing information about a user.", - "canonical": true, - "file": "sql_users_service.get.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Get", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "host", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.User", - "client": { - "shortName": "SqlUsersServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlUsersServiceClient" - }, - "method": { - "shortName": "Get", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Get", - "service": { - "shortName": "SqlUsersService", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlUsersService_Insert_async", - "title": "SqlBackupRunsService insert Sample", - "origin": "API_DEFINITION", - "description": " Creates a new user in a Cloud SQL instance.", - "canonical": true, - "file": "sql_users_service.insert.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Insert", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.User" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlUsersServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlUsersServiceClient" - }, - "method": { - "shortName": "Insert", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Insert", - "service": { - "shortName": "SqlUsersService", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlUsersService_List_async", - "title": "SqlBackupRunsService list Sample", - "origin": "API_DEFINITION", - "description": " Lists users in the specified Cloud SQL instance.", - "canonical": true, - "file": "sql_users_service.list.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService.List", - "async": true, - "parameters": [ - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.sql.v1beta4.UsersListResponse", - "client": { - "shortName": "SqlUsersServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlUsersServiceClient" - }, - "method": { - "shortName": "List", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService.List", - "service": { - "shortName": "SqlUsersService", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService" - } - } - } - }, - { - "regionTag": "sqladmin_v1beta4_generated_SqlUsersService_Update_async", - "title": "SqlBackupRunsService update Sample", - "origin": "API_DEFINITION", - "description": " Updates an existing user in a Cloud SQL instance.", - "canonical": true, - "file": "sql_users_service.update.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Update", - "async": true, - "parameters": [ - { - "name": "host", - "type": "TYPE_STRING" - }, - { - "name": "instance", - "type": "TYPE_STRING" - }, - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "project", - "type": "TYPE_STRING" - }, - { - "name": "database_roles", - "type": "TYPE_STRING[]" - }, - { - "name": "revoke_existing_roles", - "type": "TYPE_BOOL" - }, - { - "name": "body", - "type": ".google.cloud.sql.v1beta4.User" - } - ], - "resultType": ".google.cloud.sql.v1beta4.Operation", - "client": { - "shortName": "SqlUsersServiceClient", - "fullName": "google.cloud.sql.v1beta4.SqlUsersServiceClient" - }, - "method": { - "shortName": "Update", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService.Update", - "service": { - "shortName": "SqlUsersService", - "fullName": "google.cloud.sql.v1beta4.SqlUsersService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.delete.js deleted file mode 100644 index 6d910a7eb173..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.delete.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlBackupRunsService_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The ID of the backup run to delete. To find a backup run ID, use the - * list (https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/backupRuns/list) - * method. - */ - // const id = 1234 - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlBackupRunsServiceClient(); - - async function callDelete() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.delete(request); - console.log(response); - } - - callDelete(); - // [END sqladmin_v1beta4_generated_SqlBackupRunsService_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.get.js deleted file mode 100644 index 6f78ee22e833..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.get.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlBackupRunsService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The ID of this backup run. - */ - // const id = 1234 - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlBackupRunsServiceClient(); - - async function callGet() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1beta4_generated_SqlBackupRunsService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.insert.js deleted file mode 100644 index 248373d1f14b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.insert.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlBackupRunsService_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlBackupRunsServiceClient(); - - async function callInsert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.insert(request); - console.log(response); - } - - callInsert(); - // [END sqladmin_v1beta4_generated_SqlBackupRunsService_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.list.js deleted file mode 100644 index 350d99758a34..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backup_runs_service.list.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlBackupRunsService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID, or "-" for all instances. This does not include - * the project ID. - */ - // const instance = 'abc123' - /** - * Maximum number of backup runs per response. - */ - // const maxResults = 1234 - /** - * A previously-returned page token representing part of the larger set of - * results to view. - */ - // const pageToken = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlBackupRunsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlBackupRunsServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1beta4_generated_SqlBackupRunsService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.create_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.create_backup.js deleted file mode 100644 index 41c5c2493b92..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.create_backup.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, backup) { - // [START sqladmin_v1beta4_generated_SqlBackupsService_CreateBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource where this backup is created. - * Format: projects/{project} - */ - // const parent = 'abc123' - /** - * Required. The Backup to create. - */ - // const backup = {} - - // Imports the Sql library - const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlBackupsServiceClient(); - - async function callCreateBackup() { - // Construct request - const request = { - parent, - backup, - }; - - // Run request - const response = await sqlClient.createBackup(request); - console.log(response); - } - - callCreateBackup(); - // [END sqladmin_v1beta4_generated_SqlBackupsService_CreateBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.delete_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.delete_backup.js deleted file mode 100644 index f9cac8481cc9..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.delete_backup.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START sqladmin_v1beta4_generated_SqlBackupsService_DeleteBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the backup to delete. - * Format: projects/{project}/backups/{backup} - */ - // const name = 'abc123' - - // Imports the Sql library - const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlBackupsServiceClient(); - - async function callDeleteBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await sqlClient.deleteBackup(request); - console.log(response); - } - - callDeleteBackup(); - // [END sqladmin_v1beta4_generated_SqlBackupsService_DeleteBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.get_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.get_backup.js deleted file mode 100644 index 3f5643b41546..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.get_backup.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START sqladmin_v1beta4_generated_SqlBackupsService_GetBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the backup to retrieve. - * Format: projects/{project}/backups/{backup} - */ - // const name = 'abc123' - - // Imports the Sql library - const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlBackupsServiceClient(); - - async function callGetBackup() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await sqlClient.getBackup(request); - console.log(response); - } - - callGetBackup(); - // [END sqladmin_v1beta4_generated_SqlBackupsService_GetBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.list_backups.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.list_backups.js deleted file mode 100644 index 3c1f03669b74..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.list_backups.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START sqladmin_v1beta4_generated_SqlBackupsService_ListBackups_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - */ - // const parent = 'abc123' - /** - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - */ - // const filter = 'abc123' - - // Imports the Sql library - const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlBackupsServiceClient(); - - async function callListBackups() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = sqlClient.listBackupsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListBackups(); - // [END sqladmin_v1beta4_generated_SqlBackupsService_ListBackups_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.update_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.update_backup.js deleted file mode 100644 index f1cf80b18613..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_backups_service.update_backup.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(backup) { - // [START sqladmin_v1beta4_generated_SqlBackupsService_UpdateBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The backup to update. - * The backup’s `name` field is used to identify the backup to update. - * Format: projects/{project}/backups/{backup} - */ - // const backup = {} - /** - * The list of fields that you can update. You can update only the description - * and retention period of the final backup. - */ - // const updateMask = {} - - // Imports the Sql library - const {SqlBackupsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlBackupsServiceClient(); - - async function callUpdateBackup() { - // Construct request - const request = { - backup, - }; - - // Run request - const response = await sqlClient.updateBackup(request); - console.log(response); - } - - callUpdateBackup(); - // [END sqladmin_v1beta4_generated_SqlBackupsService_UpdateBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js deleted file mode 100644 index f6345625a97f..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlConnectService_GenerateEphemeralCert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * PEM encoded public key to include in the signed certificate. - */ - // const publicKey = 'abc123' - /** - * Optional. Access token to include in the signed certificate. - */ - // const accessToken = 'abc123' - /** - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - */ - // const readTime = {} - /** - * Optional. If set, it will contain the cert valid duration. - */ - // const validDuration = {} - - // Imports the Sql library - const {SqlConnectServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlConnectServiceClient(); - - async function callGenerateEphemeralCert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.generateEphemeralCert(request); - console.log(response); - } - - callGenerateEphemeralCert(); - // [END sqladmin_v1beta4_generated_SqlConnectService_GenerateEphemeralCert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.get_connect_settings.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.get_connect_settings.js deleted file mode 100644 index da577017b14d..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_connect_service.get_connect_settings.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlConnectService_GetConnectSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - */ - // const readTime = {} - - // Imports the Sql library - const {SqlConnectServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlConnectServiceClient(); - - async function callGetConnectSettings() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.getConnectSettings(request); - console.log(response); - } - - callGetConnectSettings(); - // [END sqladmin_v1beta4_generated_SqlConnectService_GetConnectSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.delete.js deleted file mode 100644 index 4ff659ed03e6..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.delete.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlDatabasesService_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the database to be deleted in the instance. - */ - // const database = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callDelete() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.delete(request); - console.log(response); - } - - callDelete(); - // [END sqladmin_v1beta4_generated_SqlDatabasesService_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.get.js deleted file mode 100644 index 2463810c3ef7..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.get.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlDatabasesService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the database in the instance. - */ - // const database = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callGet() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1beta4_generated_SqlDatabasesService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.insert.js deleted file mode 100644 index e8b3c3eb2a54..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.insert.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlDatabasesService_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callInsert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.insert(request); - console.log(response); - } - - callInsert(); - // [END sqladmin_v1beta4_generated_SqlDatabasesService_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.list.js deleted file mode 100644 index 45ca6768014b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.list.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlDatabasesService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1beta4_generated_SqlDatabasesService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.patch.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.patch.js deleted file mode 100644 index b3225e6fffa2..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.patch.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlDatabasesService_Patch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the database to be updated in the instance. - */ - // const database = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callPatch() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.patch(request); - console.log(response); - } - - callPatch(); - // [END sqladmin_v1beta4_generated_SqlDatabasesService_Patch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.update.js deleted file mode 100644 index d55fcfe7efde..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_databases_service.update.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlDatabasesService_Update_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the database to be updated in the instance. - */ - // const database = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlDatabasesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlDatabasesServiceClient(); - - async function callUpdate() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.update(request); - console.log(response); - } - - callUpdate(); - // [END sqladmin_v1beta4_generated_SqlDatabasesService_Update_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_flags_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_flags_service.list.js deleted file mode 100644 index 5b6db0e04fd5..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_flags_service.list.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlFlagsService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database type and version you want to retrieve flags for. By default, this - * method returns flags for all database types and versions. - */ - // const databaseVersion = 'abc123' - /** - * Optional. Specify the scope of flags to be returned by SqlFlagsListService. - * Return list of database flags if unspecified. - */ - // const flagScope = {} - - // Imports the Sql library - const {SqlFlagsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlFlagsServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1beta4_generated_SqlFlagsService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js deleted file mode 100644 index 1e52e20412a7..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This doesn't include the project ID. It's - * composed of lowercase letters, numbers, and hyphens, and it must start with - * a letter. The total length must be 98 characters or less (Example: - * instance-id). - */ - // const instance = 'abc123' - /** - * Required. ID of the project that contains the instance (Example: - * project-id). - */ - // const project = 'my-project' - /** - * The body for request to acquire an SSRS lease. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callAcquireSsrsLease() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.acquireSsrsLease(request); - console.log(response); - } - - callAcquireSsrsLease(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js deleted file mode 100644 index c9b6b9b21203..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_AddEntraIdCertificate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callAddEntraIdCertificate() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.addEntraIdCertificate(request); - console.log(response); - } - - callAddEntraIdCertificate(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_AddEntraIdCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_ca.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_ca.js deleted file mode 100644 index 4f1f748491ef..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_ca.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_AddServerCa_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callAddServerCa() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.addServerCa(request); - console.log(response); - } - - callAddServerCa(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_AddServerCa_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_certificate.js deleted file mode 100644 index a7f9401f65f5..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.add_server_certificate.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_AddServerCertificate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callAddServerCertificate() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.addServerCertificate(request); - console.log(response); - } - - callAddServerCertificate(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_AddServerCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.clone.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.clone.js deleted file mode 100644 index 2be0c22e236c..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.clone.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Clone_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The ID of the Cloud SQL instance to be cloned (source). This does not - * include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the source as well as the clone Cloud SQL instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callClone() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.clone(request); - console.log(response); - } - - callClone(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Clone_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.create_ephemeral.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.create_ephemeral.js deleted file mode 100644 index 3f65f841bcb3..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.create_ephemeral.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_CreateEphemeral_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the Cloud SQL project. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callCreateEphemeral() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.createEphemeral(request); - console.log(response); - } - - callCreateEphemeral(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_CreateEphemeral_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.delete.js deleted file mode 100644 index bc9edd5e4a59..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.delete.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance to be deleted. - */ - // const project = 'my-project' - /** - * Flag to opt-in for final backup. By default, it is turned off. - */ - // const enableFinalBackup = true - /** - * Optional. Retention period of the final backup. - */ - // const finalBackupTtlDays = 1234 - /** - * Optional. Final Backup expiration time. - * Timestamp in UTC of when this resource is considered expired. - */ - // const finalBackupExpiryTime = {} - /** - * Optional. The description of the final backup. - */ - // const finalBackupDescription = 'abc123' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callDelete() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.delete(request); - console.log(response); - } - - callDelete(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote.js deleted file mode 100644 index 2a1ffc1ee99b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Demote_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Cloud SQL instance. - */ - // const instance = 'abc123' - /** - * Required. The project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * The request body. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callDemote() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.demote(request); - console.log(response); - } - - callDemote(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Demote_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote_master.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote_master.js deleted file mode 100644 index 9bec02241936..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.demote_master.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_DemoteMaster_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callDemoteMaster() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.demoteMaster(request); - console.log(response); - } - - callDemoteMaster(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_DemoteMaster_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.execute_sql.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.execute_sql.js deleted file mode 100644 index 67a670fbe80d..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.execute_sql.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_ExecuteSql_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * The request body. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callExecuteSql() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.executeSql(request); - console.log(response); - } - - callExecuteSql(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_ExecuteSql_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.export.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.export.js deleted file mode 100644 index 50001a31bfd8..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.export.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Export_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * The Cloud SQL instance ID. This doesn't include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance to be exported. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callExport() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.export(request); - console.log(response); - } - - callExport(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Export_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.failover.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.failover.js deleted file mode 100644 index 84347d5a403d..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.failover.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Failover_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the read replica. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callFailover() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.failover(request); - console.log(response); - } - - callFailover(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Failover_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get.js deleted file mode 100644 index 2d4eec000577..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callGet() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js deleted file mode 100644 index fc11cfaa9753..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_GetDiskShrinkConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callGetDiskShrinkConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.getDiskShrinkConfig(request); - console.log(response); - } - - callGetDiskShrinkConfig(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_GetDiskShrinkConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js deleted file mode 100644 index adedab1cefca..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_GetLatestRecoveryTime_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * The timestamp used to identify the time when the source instance is - * deleted. If this instance is deleted, then you must set the timestamp. - */ - // const sourceInstanceDeletionTime = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callGetLatestRecoveryTime() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.getLatestRecoveryTime(request); - console.log(response); - } - - callGetLatestRecoveryTime(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_GetLatestRecoveryTime_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.import.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.import.js deleted file mode 100644 index 33e10c080fc9..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.import.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Import_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callImport() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.import(request); - console.log(response); - } - - callImport(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Import_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.insert.js deleted file mode 100644 index 40a80c80194c..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.insert.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Project ID of the project to which the newly created Cloud SQL instances - * should belong. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callInsert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.insert(request); - console.log(response); - } - - callInsert(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list.js deleted file mode 100644 index eb3d26e3bdd7..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list.js +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * A filter expression that filters resources listed in the response. - * The expression is in the form of field:value. For example, - * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per - * their JSON representation, such as 'settings.userLabels.auto_start:true'. - * Multiple filter queries are space-separated. For example. - * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each - * expression is an AND expression. However, you can include AND and OR - * expressions explicitly. - */ - // const filter = 'abc123' - /** - * The maximum number of instances to return. The service may return fewer - * than this value. - * If unspecified, at most 500 instances are returned. - * The maximum value is 1000; values above 1000 are coerced to 1000. - */ - // const maxResults = 1234 - /** - * A previously-returned page token representing part of the larger set of - * results to view. - */ - // const pageToken = 'abc123' - /** - * Project ID of the project for which to list Cloud SQL instances. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js deleted file mode 100644 index bc7553ad21d5..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_ListEntraIdCertificates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callListEntraIdCertificates() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.listEntraIdCertificates(request); - console.log(response); - } - - callListEntraIdCertificates(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_ListEntraIdCertificates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_cas.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_cas.js deleted file mode 100644 index 7f2de74c79c6..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_cas.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_ListServerCas_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callListServerCas() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.listServerCas(request); - console.log(response); - } - - callListServerCas(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_ListServerCas_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_certificates.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_certificates.js deleted file mode 100644 index 165fb7e0710c..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.list_server_certificates.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_ListServerCertificates_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callListServerCertificates() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.listServerCertificates(request); - console.log(response); - } - - callListServerCertificates(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_ListServerCertificates_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.patch.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.patch.js deleted file mode 100644 index 6fb24aff35df..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.patch.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Patch_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callPatch() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.patch(request); - console.log(response); - } - - callPatch(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Patch_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js deleted file mode 100644 index 7b1cb17bdc8d..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_PerformDiskShrink_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Perform disk shrink context. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callPerformDiskShrink() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.performDiskShrink(request); - console.log(response); - } - - callPerformDiskShrink(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_PerformDiskShrink_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js deleted file mode 100644 index 9372f05a8cef..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, context) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_PointInTimeRestore_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource where you created this instance. - * Format: projects/{project} - */ - // const parent = 'abc123' - /** - * Required. The context for request to perform a PITR on a Google Cloud - * Backup and Disaster Recovery managed instance. - */ - // const context = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callPointInTimeRestore() { - // Construct request - const request = { - parent, - context, - }; - - // Run request - const response = await sqlClient.pointInTimeRestore(request); - console.log(response); - } - - callPointInTimeRestore(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_PointInTimeRestore_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js deleted file mode 100644 index bb210e2f508c..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project, body) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Required. The context for request to perform the pre-check major version - * upgrade operation. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callPreCheckMajorVersionUpgrade() { - // Construct request - const request = { - instance, - project, - body, - }; - - // Run request - const response = await sqlClient.preCheckMajorVersionUpgrade(request); - console.log(response); - } - - callPreCheckMajorVersionUpgrade(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.promote_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.promote_replica.js deleted file mode 100644 index dcebee252a7f..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.promote_replica.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_PromoteReplica_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL read replica instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the read replica. - */ - // const project = 'my-project' - /** - * Set to true to invoke a replica failover to the DR replica. - * As part of replica failover, the promote operation attempts - * to add the original primary instance as a replica of the promoted - * DR replica when the original primary instance comes back online. - * If set to false or not specified, then the original primary - * instance becomes an independent Cloud SQL primary instance. - */ - // const failover = true - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callPromoteReplica() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.promoteReplica(request); - console.log(response); - } - - callPromoteReplica(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_PromoteReplica_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reencrypt.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reencrypt.js deleted file mode 100644 index c6f76335f8c4..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reencrypt.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Reencrypt_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Reencrypt body that users request - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callReencrypt() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.reencrypt(request); - console.log(response); - } - - callReencrypt(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Reencrypt_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js deleted file mode 100644 index 4acdbfdd9bb7..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The Cloud SQL instance ID. This doesn't include the project ID. - * It's composed of lowercase letters, numbers, and hyphens, and it must start - * with a letter. The total length must be 98 characters or less (Example: - * instance-id). - */ - // const instance = 'abc123' - /** - * Required. The ID of the project that contains the instance (Example: - * project-id). - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callReleaseSsrsLease() { - // Construct request - const request = { - instance, - project, - }; - - // Run request - const response = await sqlClient.releaseSsrsLease(request); - console.log(response); - } - - callReleaseSsrsLease(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js deleted file mode 100644 index 324e51aa3152..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_RescheduleMaintenance_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRescheduleMaintenance() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.rescheduleMaintenance(request); - console.log(response); - } - - callRescheduleMaintenance(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_RescheduleMaintenance_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_replica_size.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_replica_size.js deleted file mode 100644 index cc922cc39d5c..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_replica_size.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_ResetReplicaSize_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL read replica instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the read replica. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callResetReplicaSize() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.resetReplicaSize(request); - console.log(response); - } - - callResetReplicaSize(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_ResetReplicaSize_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js deleted file mode 100644 index 45f4a4964100..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_ResetSslConfig_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Optional. Reset SSL mode to use. - */ - // const mode = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callResetSslConfig() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.resetSslConfig(request); - console.log(response); - } - - callResetSslConfig(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_ResetSslConfig_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restart.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restart.js deleted file mode 100644 index a87242f8b5f9..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restart.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Restart_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance to be restarted. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRestart() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.restart(request); - console.log(response); - } - - callRestart(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Restart_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restore_backup.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restore_backup.js deleted file mode 100644 index 367c8547b92a..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.restore_backup.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_RestoreBackup_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRestoreBackup() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.restoreBackup(request); - console.log(response); - } - - callRestoreBackup(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_RestoreBackup_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js deleted file mode 100644 index 5ed5fd80eb6e..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project, body) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_RotateEntraIdCertificate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Required. Rotate Entra ID certificate request body. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRotateEntraIdCertificate() { - // Construct request - const request = { - instance, - project, - body, - }; - - // Run request - const response = await sqlClient.rotateEntraIdCertificate(request); - console.log(response); - } - - callRotateEntraIdCertificate(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_RotateEntraIdCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js deleted file mode 100644 index 984e44b16dbb..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCa_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRotateServerCa() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.rotateServerCa(request); - console.log(response); - } - - callRotateServerCa(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCa_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js deleted file mode 100644 index 6754ebe9ea53..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(instance, project, body) { - // [START sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCertificate_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Required. Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Required. Rotate server certificate request body. - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callRotateServerCertificate() { - // Construct request - const request = { - instance, - project, - body, - }; - - // Run request - const response = await sqlClient.rotateServerCertificate(request); - console.log(response); - } - - callRotateServerCertificate(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCertificate_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_external_sync.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_external_sync.js deleted file mode 100644 index 01d29c1b2be0..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_external_sync.js +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_StartExternalSync_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * External sync mode. - */ - // const syncMode = {} - /** - * Whether to skip the verification step (VESS). - */ - // const skipVerification = true - /** - * MySQL-specific settings for start external sync. - */ - // const mysqlSyncConfig = {} - /** - * Optional. Parallel level for initial data sync. Currently only applicable - * for MySQL. - */ - // const syncParallelLevel = {} - /** - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - */ - // const migrationType = {} - /** - * Optional. MySQL only. True if end-user has confirmed that this SES call - * will wipe replica databases overlapping with the proposed selected_objects. - * If this field is not set and there are both overlapping and additional - * databases proposed, an error will be returned. - */ - // const replicaOverwriteEnabled = true - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callStartExternalSync() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.startExternalSync(request); - console.log(response); - } - - callStartExternalSync(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_StartExternalSync_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_replica.js deleted file mode 100644 index 1e906e0c302b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.start_replica.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_StartReplica_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL read replica instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the read replica. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callStartReplica() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.startReplica(request); - console.log(response); - } - - callStartReplica(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_StartReplica_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.stop_replica.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.stop_replica.js deleted file mode 100644 index 2517fd4803fe..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.stop_replica.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_StopReplica_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL read replica instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the read replica. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callStopReplica() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.stopReplica(request); - console.log(response); - } - - callStopReplica(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_StopReplica_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.switchover.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.switchover.js deleted file mode 100644 index 93436f4de622..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.switchover.js +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Switchover_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL read replica instance name. - */ - // const instance = 'abc123' - /** - * ID of the project that contains the replica. - */ - // const project = 'my-project' - /** - * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations - * timeout, which is a sum of all database operations. Default value is 10 - * minutes and can be modified to a maximum value of 24 hours. - */ - // const dbTimeout = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callSwitchover() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.switchover(request); - console.log(response); - } - - callSwitchover(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Switchover_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.truncate_log.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.truncate_log.js deleted file mode 100644 index c3bf9807d7dc..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.truncate_log.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_TruncateLog_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the Cloud SQL project. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callTruncateLog() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.truncateLog(request); - console.log(response); - } - - callTruncateLog(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_TruncateLog_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.update.js deleted file mode 100644 index fd835af1de02..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.update.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_Update_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callUpdate() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.update(request); - console.log(response); - } - - callUpdate(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_Update_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js deleted file mode 100644 index 76ee9570376b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlInstancesService_VerifyExternalSyncSettings_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Flag to enable verifying connection only - */ - // const verifyConnectionOnly = true - /** - * External sync mode - */ - // const syncMode = {} - /** - * Optional. Flag to verify settings required by replication setup only - */ - // const verifyReplicationOnly = true - /** - * Optional. MySQL-specific settings for start external sync. - */ - // const mysqlSyncConfig = {} - /** - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - */ - // const migrationType = {} - /** - * Optional. Parallel level for initial data sync. Only applicable for - * PostgreSQL. - */ - // const syncParallelLevel = {} - /** - * Optional. Migrate only the specified objects from the source instance. If - * this field is empty, then migrate all objects. - */ - // const selectedObjects = [1,2,3,4] - - // Imports the Sql library - const {SqlInstancesServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlInstancesServiceClient(); - - async function callVerifyExternalSyncSettings() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.verifyExternalSyncSettings(request); - console.log(response); - } - - callVerifyExternalSyncSettings(); - // [END sqladmin_v1beta4_generated_SqlInstancesService_VerifyExternalSyncSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.cancel.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.cancel.js deleted file mode 100644 index a4cbea7a20b5..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.cancel.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlOperationsService_Cancel_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Instance operation ID. - */ - // const operation = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlOperationsServiceClient(); - - async function callCancel() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.cancel(request); - console.log(response); - } - - callCancel(); - // [END sqladmin_v1beta4_generated_SqlOperationsService_Cancel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.get.js deleted file mode 100644 index 46c55c814033..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.get.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlOperationsService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Instance operation ID. - */ - // const operation = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlOperationsServiceClient(); - - async function callGet() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1beta4_generated_SqlOperationsService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.list.js deleted file mode 100644 index d89f33948954..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_operations_service.list.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlOperationsService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Maximum number of operations per response. - */ - // const maxResults = 1234 - /** - * A previously-returned page token representing part of the larger set of - * results to view. - */ - // const pageToken = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlOperationsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlOperationsServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1beta4_generated_SqlOperationsService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.delete.js deleted file mode 100644 index 84f8522c7913..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.delete.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlSslCertsService_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Sha1 FingerPrint. - */ - // const sha1Fingerprint = 'abc123' - - // Imports the Sql library - const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlSslCertsServiceClient(); - - async function callDelete() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.delete(request); - console.log(response); - } - - callDelete(); - // [END sqladmin_v1beta4_generated_SqlSslCertsService_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.get.js deleted file mode 100644 index 7e0d6708b9ac..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.get.js +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlSslCertsService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Sha1 FingerPrint. - */ - // const sha1Fingerprint = 'abc123' - - // Imports the Sql library - const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlSslCertsServiceClient(); - - async function callGet() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1beta4_generated_SqlSslCertsService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.insert.js deleted file mode 100644 index 8d3655001f7f..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.insert.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlSslCertsService_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlSslCertsServiceClient(); - - async function callInsert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.insert(request); - console.log(response); - } - - callInsert(); - // [END sqladmin_v1beta4_generated_SqlSslCertsService_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.list.js deleted file mode 100644 index b923f87f9954..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_ssl_certs_service.list.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlSslCertsService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Cloud SQL instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlSslCertsServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlSslCertsServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1beta4_generated_SqlSslCertsService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_tiers_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_tiers_service.list.js deleted file mode 100644 index 0662bbd45615..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_tiers_service.list.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlTiersService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Project ID of the project for which to list tiers. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlTiersServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlTiersServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1beta4_generated_SqlTiersService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.delete.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.delete.js deleted file mode 100644 index bd7bbaa38d2f..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.delete.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlUsersService_Delete_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Host of the user in the instance. - */ - // const host = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Name of the user in the instance. - */ - // const name = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlUsersServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlUsersServiceClient(); - - async function callDelete() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.delete(request); - console.log(response); - } - - callDelete(); - // [END sqladmin_v1beta4_generated_SqlUsersService_Delete_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.get.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.get.js deleted file mode 100644 index b91e97ad4345..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.get.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlUsersService_Get_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * User of the instance. - */ - // const name = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Host of a user of the instance. - */ - // const host = 'abc123' - - // Imports the Sql library - const {SqlUsersServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlUsersServiceClient(); - - async function callGet() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.get(request); - console.log(response); - } - - callGet(); - // [END sqladmin_v1beta4_generated_SqlUsersService_Get_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.insert.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.insert.js deleted file mode 100644 index 7fc7f777810b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.insert.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlUsersService_Insert_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlUsersServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlUsersServiceClient(); - - async function callInsert() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.insert(request); - console.log(response); - } - - callInsert(); - // [END sqladmin_v1beta4_generated_SqlUsersService_Insert_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.list.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.list.js deleted file mode 100644 index 0e2b304ec68b..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.list.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlUsersService_List_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - - // Imports the Sql library - const {SqlUsersServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlUsersServiceClient(); - - async function callList() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.list(request); - console.log(response); - } - - callList(); - // [END sqladmin_v1beta4_generated_SqlUsersService_List_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.update.js b/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.update.js deleted file mode 100644 index 4ba5a10adcac..000000000000 --- a/owl-bot-staging/google-cloud-sql/samples/generated/v1beta4/sql_users_service.update.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START sqladmin_v1beta4_generated_SqlUsersService_Update_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Host of the user in the instance. - */ - // const host = 'abc123' - /** - * Database instance ID. This does not include the project ID. - */ - // const instance = 'abc123' - /** - * Name of the user in the instance. - */ - // const name = 'abc123' - /** - * Project ID of the project that contains the instance. - */ - // const project = 'my-project' - /** - * Optional. List of database roles to grant to the user. body.database_roles - * will be ignored for update request. - */ - // const databaseRoles = ['abc','def'] - /** - * Optional. Specifies whether to revoke existing roles that are not present - * in the `database_roles` field. If `false` or unset, the database roles - * specified in `database_roles` are added to the user's existing roles. - */ - // const revokeExistingRoles = true - /** - */ - // const body = {} - - // Imports the Sql library - const {SqlUsersServiceClient} = require('@google-cloud/sql').v1beta4; - - // Instantiates a client - const sqlClient = new SqlUsersServiceClient(); - - async function callUpdate() { - // Construct request - const request = { - }; - - // Run request - const response = await sqlClient.update(request); - console.log(response); - } - - callUpdate(); - // [END sqladmin_v1beta4_generated_SqlUsersService_Update_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-sql/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-sql/src/v1/gapic_metadata.json deleted file mode 100644 index b6405eb0be3c..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/gapic_metadata.json +++ /dev/null @@ -1,965 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.sql.v1", - "libraryPackage": "@google-cloud/sql", - "services": { - "SqlAvailableDatabaseVersionsService": { - "clients": { - "grpc": { - "libraryClient": "SqlAvailableDatabaseVersionsServiceClient", - "rpcs": {} - }, - "grpc-fallback": { - "libraryClient": "SqlAvailableDatabaseVersionsServiceClient", - "rpcs": {} - } - } - }, - "SqlBackupRunsService": { - "clients": { - "grpc": { - "libraryClient": "SqlBackupRunsServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlBackupRunsServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - } - } - } - } - }, - "SqlBackupsService": { - "clients": { - "grpc": { - "libraryClient": "SqlBackupsServiceClient", - "rpcs": { - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlBackupsServiceClient", - "rpcs": { - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - }, - "SqlConnectService": { - "clients": { - "grpc": { - "libraryClient": "SqlConnectServiceClient", - "rpcs": { - "GetConnectSettings": { - "methods": [ - "getConnectSettings" - ] - }, - "GenerateEphemeralCert": { - "methods": [ - "generateEphemeralCert" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlConnectServiceClient", - "rpcs": { - "GetConnectSettings": { - "methods": [ - "getConnectSettings" - ] - }, - "GenerateEphemeralCert": { - "methods": [ - "generateEphemeralCert" - ] - } - } - } - } - }, - "SqlDatabasesService": { - "clients": { - "grpc": { - "libraryClient": "SqlDatabasesServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Patch": { - "methods": [ - "patch" - ] - }, - "Update": { - "methods": [ - "update" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlDatabasesServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Patch": { - "methods": [ - "patch" - ] - }, - "Update": { - "methods": [ - "update" - ] - } - } - } - } - }, - "SqlEventsService": { - "clients": { - "grpc": { - "libraryClient": "SqlEventsServiceClient", - "rpcs": {} - }, - "grpc-fallback": { - "libraryClient": "SqlEventsServiceClient", - "rpcs": {} - } - } - }, - "SqlFeatureEligibilityService": { - "clients": { - "grpc": { - "libraryClient": "SqlFeatureEligibilityServiceClient", - "rpcs": {} - }, - "grpc-fallback": { - "libraryClient": "SqlFeatureEligibilityServiceClient", - "rpcs": {} - } - } - }, - "SqlFlagsService": { - "clients": { - "grpc": { - "libraryClient": "SqlFlagsServiceClient", - "rpcs": { - "List": { - "methods": [ - "list" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlFlagsServiceClient", - "rpcs": { - "List": { - "methods": [ - "list" - ] - } - } - } - } - }, - "SqlIamPoliciesService": { - "clients": { - "grpc": { - "libraryClient": "SqlIamPoliciesServiceClient", - "rpcs": {} - }, - "grpc-fallback": { - "libraryClient": "SqlIamPoliciesServiceClient", - "rpcs": {} - } - } - }, - "SqlInstanceNamesService": { - "clients": { - "grpc": { - "libraryClient": "SqlInstanceNamesServiceClient", - "rpcs": {} - }, - "grpc-fallback": { - "libraryClient": "SqlInstanceNamesServiceClient", - "rpcs": {} - } - } - }, - "SqlInstancesService": { - "clients": { - "grpc": { - "libraryClient": "SqlInstancesServiceClient", - "rpcs": { - "AddServerCa": { - "methods": [ - "addServerCa" - ] - }, - "AddServerCertificate": { - "methods": [ - "addServerCertificate" - ] - }, - "AddEntraIdCertificate": { - "methods": [ - "addEntraIdCertificate" - ] - }, - "Clone": { - "methods": [ - "clone" - ] - }, - "Delete": { - "methods": [ - "delete" - ] - }, - "DemoteMaster": { - "methods": [ - "demoteMaster" - ] - }, - "Demote": { - "methods": [ - "demote" - ] - }, - "Export": { - "methods": [ - "export" - ] - }, - "Failover": { - "methods": [ - "failover" - ] - }, - "Reencrypt": { - "methods": [ - "reencrypt" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Import": { - "methods": [ - "import" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "ListServerCas": { - "methods": [ - "listServerCas" - ] - }, - "ListServerCertificates": { - "methods": [ - "listServerCertificates" - ] - }, - "ListEntraIdCertificates": { - "methods": [ - "listEntraIdCertificates" - ] - }, - "Patch": { - "methods": [ - "patch" - ] - }, - "PromoteReplica": { - "methods": [ - "promoteReplica" - ] - }, - "Switchover": { - "methods": [ - "switchover" - ] - }, - "ResetSslConfig": { - "methods": [ - "resetSslConfig" - ] - }, - "Restart": { - "methods": [ - "restart" - ] - }, - "RestoreBackup": { - "methods": [ - "restoreBackup" - ] - }, - "RotateServerCa": { - "methods": [ - "rotateServerCa" - ] - }, - "RotateServerCertificate": { - "methods": [ - "rotateServerCertificate" - ] - }, - "RotateEntraIdCertificate": { - "methods": [ - "rotateEntraIdCertificate" - ] - }, - "StartReplica": { - "methods": [ - "startReplica" - ] - }, - "StopReplica": { - "methods": [ - "stopReplica" - ] - }, - "TruncateLog": { - "methods": [ - "truncateLog" - ] - }, - "Update": { - "methods": [ - "update" - ] - }, - "CreateEphemeral": { - "methods": [ - "createEphemeral" - ] - }, - "RescheduleMaintenance": { - "methods": [ - "rescheduleMaintenance" - ] - }, - "VerifyExternalSyncSettings": { - "methods": [ - "verifyExternalSyncSettings" - ] - }, - "StartExternalSync": { - "methods": [ - "startExternalSync" - ] - }, - "PerformDiskShrink": { - "methods": [ - "performDiskShrink" - ] - }, - "GetDiskShrinkConfig": { - "methods": [ - "getDiskShrinkConfig" - ] - }, - "ResetReplicaSize": { - "methods": [ - "resetReplicaSize" - ] - }, - "GetLatestRecoveryTime": { - "methods": [ - "getLatestRecoveryTime" - ] - }, - "ExecuteSql": { - "methods": [ - "executeSql" - ] - }, - "AcquireSsrsLease": { - "methods": [ - "acquireSsrsLease" - ] - }, - "ReleaseSsrsLease": { - "methods": [ - "releaseSsrsLease" - ] - }, - "PreCheckMajorVersionUpgrade": { - "methods": [ - "preCheckMajorVersionUpgrade" - ] - }, - "PointInTimeRestore": { - "methods": [ - "pointInTimeRestore" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlInstancesServiceClient", - "rpcs": { - "AddServerCa": { - "methods": [ - "addServerCa" - ] - }, - "AddServerCertificate": { - "methods": [ - "addServerCertificate" - ] - }, - "AddEntraIdCertificate": { - "methods": [ - "addEntraIdCertificate" - ] - }, - "Clone": { - "methods": [ - "clone" - ] - }, - "Delete": { - "methods": [ - "delete" - ] - }, - "DemoteMaster": { - "methods": [ - "demoteMaster" - ] - }, - "Demote": { - "methods": [ - "demote" - ] - }, - "Export": { - "methods": [ - "export" - ] - }, - "Failover": { - "methods": [ - "failover" - ] - }, - "Reencrypt": { - "methods": [ - "reencrypt" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Import": { - "methods": [ - "import" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "ListServerCas": { - "methods": [ - "listServerCas" - ] - }, - "ListServerCertificates": { - "methods": [ - "listServerCertificates" - ] - }, - "ListEntraIdCertificates": { - "methods": [ - "listEntraIdCertificates" - ] - }, - "Patch": { - "methods": [ - "patch" - ] - }, - "PromoteReplica": { - "methods": [ - "promoteReplica" - ] - }, - "Switchover": { - "methods": [ - "switchover" - ] - }, - "ResetSslConfig": { - "methods": [ - "resetSslConfig" - ] - }, - "Restart": { - "methods": [ - "restart" - ] - }, - "RestoreBackup": { - "methods": [ - "restoreBackup" - ] - }, - "RotateServerCa": { - "methods": [ - "rotateServerCa" - ] - }, - "RotateServerCertificate": { - "methods": [ - "rotateServerCertificate" - ] - }, - "RotateEntraIdCertificate": { - "methods": [ - "rotateEntraIdCertificate" - ] - }, - "StartReplica": { - "methods": [ - "startReplica" - ] - }, - "StopReplica": { - "methods": [ - "stopReplica" - ] - }, - "TruncateLog": { - "methods": [ - "truncateLog" - ] - }, - "Update": { - "methods": [ - "update" - ] - }, - "CreateEphemeral": { - "methods": [ - "createEphemeral" - ] - }, - "RescheduleMaintenance": { - "methods": [ - "rescheduleMaintenance" - ] - }, - "VerifyExternalSyncSettings": { - "methods": [ - "verifyExternalSyncSettings" - ] - }, - "StartExternalSync": { - "methods": [ - "startExternalSync" - ] - }, - "PerformDiskShrink": { - "methods": [ - "performDiskShrink" - ] - }, - "GetDiskShrinkConfig": { - "methods": [ - "getDiskShrinkConfig" - ] - }, - "ResetReplicaSize": { - "methods": [ - "resetReplicaSize" - ] - }, - "GetLatestRecoveryTime": { - "methods": [ - "getLatestRecoveryTime" - ] - }, - "ExecuteSql": { - "methods": [ - "executeSql" - ] - }, - "AcquireSsrsLease": { - "methods": [ - "acquireSsrsLease" - ] - }, - "ReleaseSsrsLease": { - "methods": [ - "releaseSsrsLease" - ] - }, - "PreCheckMajorVersionUpgrade": { - "methods": [ - "preCheckMajorVersionUpgrade" - ] - }, - "PointInTimeRestore": { - "methods": [ - "pointInTimeRestore" - ] - } - } - } - } - }, - "SqlOperationsService": { - "clients": { - "grpc": { - "libraryClient": "SqlOperationsServiceClient", - "rpcs": { - "Get": { - "methods": [ - "get" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Cancel": { - "methods": [ - "cancel" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlOperationsServiceClient", - "rpcs": { - "Get": { - "methods": [ - "get" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Cancel": { - "methods": [ - "cancel" - ] - } - } - } - } - }, - "SqlRegionsService": { - "clients": { - "grpc": { - "libraryClient": "SqlRegionsServiceClient", - "rpcs": {} - }, - "grpc-fallback": { - "libraryClient": "SqlRegionsServiceClient", - "rpcs": {} - } - } - }, - "SqlSslCertsService": { - "clients": { - "grpc": { - "libraryClient": "SqlSslCertsServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlSslCertsServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - } - } - } - } - }, - "SqlTiersService": { - "clients": { - "grpc": { - "libraryClient": "SqlTiersServiceClient", - "rpcs": { - "List": { - "methods": [ - "list" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlTiersServiceClient", - "rpcs": { - "List": { - "methods": [ - "list" - ] - } - } - } - } - }, - "SqlUsersService": { - "clients": { - "grpc": { - "libraryClient": "SqlUsersServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Update": { - "methods": [ - "update" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlUsersServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Update": { - "methods": [ - "update" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/index.ts b/owl-bot-staging/google-cloud-sql/src/v1/index.ts deleted file mode 100644 index 3e843e173570..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/index.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export { SqlAvailableDatabaseVersionsServiceClient } from './sql_available_database_versions_service_client'; -export { SqlBackupRunsServiceClient } from './sql_backup_runs_service_client'; -export { SqlBackupsServiceClient } from './sql_backups_service_client'; -export { SqlConnectServiceClient } from './sql_connect_service_client'; -export { SqlDatabasesServiceClient } from './sql_databases_service_client'; -export { SqlEventsServiceClient } from './sql_events_service_client'; -export { SqlFeatureEligibilityServiceClient } from './sql_feature_eligibility_service_client'; -export { SqlFlagsServiceClient } from './sql_flags_service_client'; -export { SqlIamPoliciesServiceClient } from './sql_iam_policies_service_client'; -export { SqlInstanceNamesServiceClient } from './sql_instance_names_service_client'; -export { SqlInstancesServiceClient } from './sql_instances_service_client'; -export { SqlOperationsServiceClient } from './sql_operations_service_client'; -export { SqlRegionsServiceClient } from './sql_regions_service_client'; -export { SqlSslCertsServiceClient } from './sql_ssl_certs_service_client'; -export { SqlTiersServiceClient } from './sql_tiers_service_client'; -export { SqlUsersServiceClient } from './sql_users_service_client'; diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client.ts deleted file mode 100644 index 651f749adb05..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client.ts +++ /dev/null @@ -1,491 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_available_database_versions_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_available_database_versions_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service that exposes Cloud SQL database versions information. This - * service is only used internally. - * @class - * @memberof v1 - */ -export class SqlAvailableDatabaseVersionsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlAvailableDatabaseVersionsServiceStub?: Promise<{ - [name: string]: Function; - }>; - - /** - * Construct an instance of SqlAvailableDatabaseVersionsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlAvailableDatabaseVersionsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this - .constructor as typeof SqlAvailableDatabaseVersionsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlAvailableDatabaseVersionsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlAvailableDatabaseVersionsServiceStub) { - return this.sqlAvailableDatabaseVersionsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlAvailableDatabaseVersionsService. - this.sqlAvailableDatabaseVersionsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlAvailableDatabaseVersionsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1 - .SqlAvailableDatabaseVersionsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - return this.sqlAvailableDatabaseVersionsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlAvailableDatabaseVersionsServiceStub && !this._terminated) { - return this.sqlAvailableDatabaseVersionsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client_config.json deleted file mode 100644 index 40ce241a885e..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_client_config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlAvailableDatabaseVersionsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": {} - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_available_database_versions_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts deleted file mode 100644 index 582b1c1f4ae2..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts +++ /dev/null @@ -1,1059 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_backup_runs_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_backup_runs_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for managing database backups. - * @class - * @memberof v1 - */ -export class SqlBackupRunsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlBackupRunsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlBackupRunsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlBackupRunsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlBackupRunsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlBackupRunsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlBackupRunsServiceStub) { - return this.sqlBackupRunsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlBackupRunsService. - this.sqlBackupRunsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlBackupRunsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlBackupRunsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlBackupRunsServiceStubMethods = ['delete', 'get', 'insert', 'list']; - for (const methodName of sqlBackupRunsServiceStubMethods) { - const callPromise = this.sqlBackupRunsServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlBackupRunsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Deletes the backup taken by a backup run. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.id - * The ID of the backup run to delete. To find a backup run ID, use the - * [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list) - * method. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backup_runs_service.delete.js - * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Delete_async - */ - delete( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | undefined, - {} | undefined, - ] - >; - delete( - request: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - id: request.id?.toString() ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('delete request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('delete response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .delete(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | undefined, - {} | undefined, - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a resource containing information about a backup run. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.id - * The ID of this backup run. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.BackupRun|BackupRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backup_runs_service.get.js - * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IBackupRun, - | protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - id: request.id?.toString() ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IBackupRun, - | protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates a new backup run on demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.BackupRun} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backup_runs_service.insert.js - * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Insert_async - */ - insert( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | undefined, - {} | undefined, - ] - >; - insert( - request: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('insert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .insert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | undefined, - {} | undefined, - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all backup runs associated with the project or a given instance - * and configuration in the reverse chronological order of the backup - * initiation time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID, or "-" for all instances. This does not include - * the project ID. - * @param {number} request.maxResults - * Maximum number of backup runs per response. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.BackupRunsListResponse|BackupRunsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backup_runs_service.list.js - * region_tag:sqladmin_v1_generated_SqlBackupRunsService_List_async - */ - list( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IBackupRunsListResponse, - | protos.google.cloud.sql.v1.ISqlBackupRunsListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IBackupRunsListResponse, - | protos.google.cloud.sql.v1.ISqlBackupRunsListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlBackupRunsServiceStub && !this._terminated) { - return this.sqlBackupRunsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client_config.json deleted file mode 100644 index 2bca0549c5aa..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlBackupRunsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Delete": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_backup_runs_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client.ts deleted file mode 100644 index 1931f7ec4f63..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client.ts +++ /dev/null @@ -1,1323 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - PaginationCallback, - GaxCall, - LocationsClient, - LocationProtos, -} from 'google-gax'; -import { Transform } from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_backups_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_backups_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1 - */ -export class SqlBackupsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlBackupsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlBackupsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlBackupsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlBackupsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listBackups: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'backups', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlBackupsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlBackupsServiceStub) { - return this.sqlBackupsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlBackupsService. - this.sqlBackupsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlBackupsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlBackupsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlBackupsServiceStubMethods = [ - 'createBackup', - 'getBackup', - 'listBackups', - 'updateBackup', - 'deleteBackup', - ]; - for (const methodName of sqlBackupsServiceStubMethods) { - const callPromise = this.sqlBackupsServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = this.descriptors.page[methodName] || undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlBackupsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Creates a backup for a Cloud SQL instance. This API can be used only to - * create on-demand backups. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this backup is created. - * Format: projects/{project} - * @param {google.cloud.sql.v1.Backup} request.backup - * Required. The Backup to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backups_service.create_backup.js - * region_tag:sqladmin_v1_generated_SqlBackupsService_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.sql.v1.ICreateBackupRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest | undefined, - {} | undefined, - ] - >; - createBackup( - request: protos.google.cloud.sql.v1.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - createBackup( - request: protos.google.cloud.sql.v1.ICreateBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - createBackup( - request?: protos.google.cloud.sql.v1.ICreateBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('createBackup request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createBackup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .createBackup(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest | undefined, - {} | undefined, - ]) => { - this._log.info('createBackup response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a resource containing information about a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the backup to retrieve. - * Format: projects/{project}/backups/{backup} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Backup|Backup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backups_service.get_backup.js - * region_tag:sqladmin_v1_generated_SqlBackupsService_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.sql.v1.IGetBackupRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest | undefined, - {} | undefined, - ] - >; - getBackup( - request: protos.google.cloud.sql.v1.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - getBackup( - request: protos.google.cloud.sql.v1.IGetBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - getBackup( - request?: protos.google.cloud.sql.v1.IGetBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('getBackup request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getBackup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getBackup(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest | undefined, - {} | undefined, - ]) => { - this._log.info('getBackup response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates the retention period and description of the backup. You can use - * this API to update final backups only. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.sql.v1.Backup} request.backup - * Required. The backup to update. - * The backup’s `name` field is used to identify the backup to update. - * Format: projects/{project}/backups/{backup} - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields that you can update. You can update only the description - * and retention period of the final backup. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backups_service.update_backup.js - * region_tag:sqladmin_v1_generated_SqlBackupsService_UpdateBackup_async - */ - updateBackup( - request?: protos.google.cloud.sql.v1.IUpdateBackupRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined, - {} | undefined, - ] - >; - updateBackup( - request: protos.google.cloud.sql.v1.IUpdateBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - updateBackup( - request: protos.google.cloud.sql.v1.IUpdateBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - updateBackup( - request?: protos.google.cloud.sql.v1.IUpdateBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'backup.name': request.backup!.name ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('updateBackup request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateBackup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .updateBackup(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined, - {} | undefined, - ]) => { - this._log.info('updateBackup response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Deletes the backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the backup to delete. - * Format: projects/{project}/backups/{backup} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backups_service.delete_backup.js - * region_tag:sqladmin_v1_generated_SqlBackupsService_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.sql.v1.IDeleteBackupRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined, - {} | undefined, - ] - >; - deleteBackup( - request: protos.google.cloud.sql.v1.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteBackup( - request: protos.google.cloud.sql.v1.IDeleteBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteBackup( - request?: protos.google.cloud.sql.v1.IDeleteBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('deleteBackup request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteBackup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .deleteBackup(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined, - {} | undefined, - ]) => { - this._log.info('deleteBackup response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Lists all backups associated with the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.sql.v1.Backup|Backup}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.sql.v1.IListBackupsRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IBackup[], - protos.google.cloud.sql.v1.IListBackupsRequest | null, - protos.google.cloud.sql.v1.IListBackupsResponse, - ] - >; - listBackups( - request: protos.google.cloud.sql.v1.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.sql.v1.IListBackupsRequest, - protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, - protos.google.cloud.sql.v1.IBackup - >, - ): void; - listBackups( - request: protos.google.cloud.sql.v1.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.sql.v1.IListBackupsRequest, - protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, - protos.google.cloud.sql.v1.IBackup - >, - ): void; - listBackups( - request?: protos.google.cloud.sql.v1.IListBackupsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.sql.v1.IListBackupsRequest, - protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, - protos.google.cloud.sql.v1.IBackup - >, - callback?: PaginationCallback< - protos.google.cloud.sql.v1.IListBackupsRequest, - protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, - protos.google.cloud.sql.v1.IBackup - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IBackup[], - protos.google.cloud.sql.v1.IListBackupsRequest | null, - protos.google.cloud.sql.v1.IListBackupsResponse, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - const wrappedCallback: - | PaginationCallback< - protos.google.cloud.sql.v1.IListBackupsRequest, - protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, - protos.google.cloud.sql.v1.IBackup - > - | undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listBackups values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listBackups request %j', request); - return this.innerApiCalls - .listBackups(request, options, wrappedCallback) - ?.then( - ([response, input, output]: [ - protos.google.cloud.sql.v1.IBackup[], - protos.google.cloud.sql.v1.IListBackupsRequest | null, - protos.google.cloud.sql.v1.IListBackupsResponse, - ]) => { - this._log.info('listBackups values %j', response); - return [response, input, output]; - }, - ); - } - - /** - * Equivalent to `listBackups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.sql.v1.Backup|Backup} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.sql.v1.IListBackupsRequest, - options?: CallOptions, - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('listBackups stream %j', request); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as GaxCall, - request, - callSettings, - ); - } - - /** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.sql.v1.Backup|Backup}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backups_service.list_backups.js - * region_tag:sqladmin_v1_generated_SqlBackupsService_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.sql.v1.IListBackupsRequest, - options?: CallOptions, - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('listBackups iterate %j', request); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as {}, - callSettings, - ) as AsyncIterable; - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlBackupsServiceStub && !this._terminated) { - return this.sqlBackupsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client_config.json deleted file mode 100644 index 4d1231dc69cc..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_client_config.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlBackupsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_backups_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client.ts deleted file mode 100644 index 55bcc54b96ae..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client.ts +++ /dev/null @@ -1,804 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_connect_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_connect_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Cloud SQL connect service. - * @class - * @memberof v1 - */ -export class SqlConnectServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlConnectServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlConnectServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlConnectServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlConnectServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlConnectService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlConnectServiceStub) { - return this.sqlConnectServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlConnectService. - this.sqlConnectServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlConnectService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlConnectService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlConnectServiceStubMethods = [ - 'getConnectSettings', - 'generateEphemeralCert', - ]; - for (const methodName of sqlConnectServiceStubMethods) { - const callPromise = this.sqlConnectServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlConnectServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Retrieves connect settings about a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.protobuf.Timestamp} [request.readTime] - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.ConnectSettings|ConnectSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_connect_service.get_connect_settings.js - * region_tag:sqladmin_v1_generated_SqlConnectService_GetConnectSettings_async - */ - getConnectSettings( - request?: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest | undefined, - {} | undefined, - ] - >; - getConnectSettings( - request: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest | null | undefined, - {} | null | undefined - >, - ): void; - getConnectSettings( - request: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, - callback: Callback< - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest | null | undefined, - {} | null | undefined - >, - ): void; - getConnectSettings( - request?: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IConnectSettings, - | protos.google.cloud.sql.v1.IGetConnectSettingsRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('getConnectSettings request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IConnectSettings, - | protos.google.cloud.sql.v1.IGetConnectSettingsRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getConnectSettings response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getConnectSettings(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest | undefined, - {} | undefined, - ]) => { - this._log.info('getConnectSettings response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Generates a short-lived X509 certificate containing the provided public key - * and signed by a private key specific to the target instance. Users may use - * the certificate to authenticate as themselves when connecting to the - * database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.publicKey - * PEM encoded public key to include in the signed certificate. - * @param {string} [request.accessToken] - * Optional. Access token to include in the signed certificate. - * @param {google.protobuf.Timestamp} [request.readTime] - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - * @param {google.protobuf.Duration} [request.validDuration] - * Optional. If set, it will contain the cert valid duration. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.GenerateEphemeralCertResponse|GenerateEphemeralCertResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js - * region_tag:sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_async - */ - generateEphemeralCert( - request?: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest | undefined, - {} | undefined, - ] - >; - generateEphemeralCert( - request: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - generateEphemeralCert( - request: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, - callback: Callback< - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - generateEphemeralCert( - request?: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('generateEphemeralCert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('generateEphemeralCert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .generateEphemeralCert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest | undefined, - {} | undefined, - ]) => { - this._log.info('generateEphemeralCert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlConnectServiceStub && !this._terminated) { - return this.sqlConnectServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client_config.json deleted file mode 100644 index 73a1cb931033..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_client_config.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlConnectService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetConnectSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateEphemeralCert": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_connect_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client.ts deleted file mode 100644 index 6b679b46644a..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client.ts +++ /dev/null @@ -1,1328 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_databases_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_databases_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service to manage databases. - * @class - * @memberof v1 - */ -export class SqlDatabasesServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlDatabasesServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlDatabasesServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlDatabasesServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlDatabasesServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlDatabasesService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlDatabasesServiceStub) { - return this.sqlDatabasesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlDatabasesService. - this.sqlDatabasesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlDatabasesService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlDatabasesService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlDatabasesServiceStubMethods = [ - 'delete', - 'get', - 'insert', - 'list', - 'patch', - 'update', - ]; - for (const methodName of sqlDatabasesServiceStubMethods) { - const callPromise = this.sqlDatabasesServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlDatabasesServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Deletes a database from a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be deleted in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.delete.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_Delete_async - */ - delete( - request?: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | undefined, - {} | undefined, - ] - >; - delete( - request: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request?: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - database: request.database ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('delete request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('delete response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .delete(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | undefined, - {} | undefined, - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a resource containing information about a database inside a Cloud - * SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Database|Database}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.get.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - database: request.database ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Inserts a resource containing information about a database inside a Cloud - * SQL instance. - * - * **Note:** You can't modify the default character set and collation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.insert.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_Insert_async - */ - insert( - request?: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | undefined, - {} | undefined, - ] - >; - insert( - request: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request?: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('insert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .insert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | undefined, - {} | undefined, - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists databases in the specified Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.DatabasesListResponse|DatabasesListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.list.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_List_async - */ - list( - request?: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IDatabasesListResponse, - | protos.google.cloud.sql.v1.ISqlDatabasesListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IDatabasesListResponse, - | protos.google.cloud.sql.v1.ISqlDatabasesListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Partially updates a resource containing information about a database inside - * a Cloud SQL instance. This method supports patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be updated in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.patch.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_Patch_async - */ - patch( - request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, - {} | undefined, - ] - >; - patch( - request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, - {} | null | undefined - >, - ): void; - patch( - request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, - {} | null | undefined - >, - ): void; - patch( - request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - database: request.database ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('patch request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patch response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .patch(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, - {} | undefined, - ]) => { - this._log.info('patch response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates a resource containing information about a database inside a Cloud - * SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be updated in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.update.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_Update_async - */ - update( - request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, - {} | undefined, - ] - >; - update( - request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, - {} | null | undefined - >, - ): void; - update( - request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, - {} | null | undefined - >, - ): void; - update( - request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - database: request.database ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('update request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('update response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .update(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, - {} | undefined, - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlDatabasesServiceStub && !this._terminated) { - return this.sqlDatabasesServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client_config.json deleted file mode 100644 index 24fb6c91fbad..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_client_config.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlDatabasesService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Delete": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Patch": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Update": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_databases_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client.ts deleted file mode 100644 index 0fd43b09b555..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client.ts +++ /dev/null @@ -1,487 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_events_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_events_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service that exposes Cloud SQL event information. This - * service is only used internally. - * @class - * @memberof v1 - */ -export class SqlEventsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlEventsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlEventsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlEventsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlEventsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlEventsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlEventsServiceStub) { - return this.sqlEventsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlEventsService. - this.sqlEventsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlEventsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlEventsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - return this.sqlEventsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlEventsServiceStub && !this._terminated) { - return this.sqlEventsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client_config.json deleted file mode 100644 index f23b6be99173..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_client_config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlEventsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": {} - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_events_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts deleted file mode 100644 index 55b053d0a121..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts +++ /dev/null @@ -1,488 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_feature_eligibility_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_feature_eligibility_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service to verify the eligibility of an instance for a given operation. - * @class - * @memberof v1 - */ -export class SqlFeatureEligibilityServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlFeatureEligibilityServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlFeatureEligibilityServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlFeatureEligibilityServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this - .constructor as typeof SqlFeatureEligibilityServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlFeatureEligibilityService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlFeatureEligibilityServiceStub) { - return this.sqlFeatureEligibilityServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlFeatureEligibilityService. - this.sqlFeatureEligibilityServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlFeatureEligibilityService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1 - .SqlFeatureEligibilityService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - return this.sqlFeatureEligibilityServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlFeatureEligibilityServiceStub && !this._terminated) { - return this.sqlFeatureEligibilityServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client_config.json deleted file mode 100644 index ee61d8115ba2..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_client_config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlFeatureEligibilityService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": {} - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_feature_eligibility_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client.ts deleted file mode 100644 index b30f40542afd..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client.ts +++ /dev/null @@ -1,642 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_flags_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_flags_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service to manage database flags for Cloud SQL instances. - * @class - * @memberof v1 - */ -export class SqlFlagsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlFlagsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlFlagsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlFlagsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlFlagsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlFlagsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlFlagsServiceStub) { - return this.sqlFlagsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlFlagsService. - this.sqlFlagsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlFlagsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlFlagsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlFlagsServiceStubMethods = ['list']; - for (const methodName of sqlFlagsServiceStubMethods) { - const callPromise = this.sqlFlagsServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlFlagsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Lists all available database flags for Cloud SQL instances. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.databaseVersion - * Database type and version you want to retrieve flags for. By default, this - * method returns flags for all database types and versions. - * @param {google.cloud.sql.v1.SqlFlagScope} [request.flagScope] - * Optional. Specify the scope of flags to be returned by SqlFlagsListService. - * Return list of database flags if unspecified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.FlagsListResponse|FlagsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_flags_service.list.js - * region_tag:sqladmin_v1_generated_SqlFlagsService_List_async - */ - list( - request?: protos.google.cloud.sql.v1.ISqlFlagsListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1.ISqlFlagsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1.ISqlFlagsListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1.ISqlFlagsListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlFlagsServiceStub && !this._terminated) { - return this.sqlFlagsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client_config.json deleted file mode 100644 index cf4ddd3729ab..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_client_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlFlagsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_flags_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client.ts deleted file mode 100644 index 2990a9bd3732..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client.ts +++ /dev/null @@ -1,487 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_iam_policies_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_iam_policies_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for providing IAM Meta APIs for Cloud SQL. - * @class - * @memberof v1 - */ -export class SqlIamPoliciesServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlIamPoliciesServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlIamPoliciesServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlIamPoliciesServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this - .constructor as typeof SqlIamPoliciesServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlIamPoliciesService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlIamPoliciesServiceStub) { - return this.sqlIamPoliciesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlIamPoliciesService. - this.sqlIamPoliciesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlIamPoliciesService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlIamPoliciesService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - return this.sqlIamPoliciesServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlIamPoliciesServiceStub && !this._terminated) { - return this.sqlIamPoliciesServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client_config.json deleted file mode 100644 index 2f2bb90fda5b..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_client_config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlIamPoliciesService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": {} - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_iam_policies_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client.ts deleted file mode 100644 index d92149ed7a0b..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client.ts +++ /dev/null @@ -1,487 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_instance_names_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_instance_names_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Cloud SQL instance names service. - * @class - * @memberof v1 - */ -export class SqlInstanceNamesServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlInstanceNamesServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlInstanceNamesServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlInstanceNamesServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this - .constructor as typeof SqlInstanceNamesServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlInstanceNamesService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlInstanceNamesServiceStub) { - return this.sqlInstanceNamesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlInstanceNamesService. - this.sqlInstanceNamesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlInstanceNamesService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlInstanceNamesService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - return this.sqlInstanceNamesServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlInstanceNamesServiceStub && !this._terminated) { - return this.sqlInstanceNamesServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client_config.json deleted file mode 100644 index 5c4fb4184d13..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_client_config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlInstanceNamesService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": {} - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_instance_names_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client.ts deleted file mode 100644 index e4e372e22ccb..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client.ts +++ /dev/null @@ -1,6827 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_instances_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_instances_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1 - */ -export class SqlInstancesServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlInstancesServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlInstancesServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlInstancesServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlInstancesServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}', - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlInstancesService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlInstancesServiceStub) { - return this.sqlInstancesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlInstancesService. - this.sqlInstancesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlInstancesService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlInstancesService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlInstancesServiceStubMethods = [ - 'addServerCa', - 'addServerCertificate', - 'addEntraIdCertificate', - 'clone', - 'delete', - 'demoteMaster', - 'demote', - 'export', - 'failover', - 'reencrypt', - 'get', - 'import', - 'insert', - 'list', - 'listServerCas', - 'listServerCertificates', - 'listEntraIdCertificates', - 'patch', - 'promoteReplica', - 'switchover', - 'resetSslConfig', - 'restart', - 'restoreBackup', - 'rotateServerCa', - 'rotateServerCertificate', - 'rotateEntraIdCertificate', - 'startReplica', - 'stopReplica', - 'truncateLog', - 'update', - 'createEphemeral', - 'rescheduleMaintenance', - 'verifyExternalSyncSettings', - 'startExternalSync', - 'performDiskShrink', - 'getDiskShrinkConfig', - 'resetReplicaSize', - 'getLatestRecoveryTime', - 'executeSql', - 'acquireSsrsLease', - 'releaseSsrsLease', - 'preCheckMajorVersionUpgrade', - 'pointInTimeRestore', - ]; - for (const methodName of sqlInstancesServiceStubMethods) { - const callPromise = this.sqlInstancesServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlInstancesServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Adds a new trusted Certificate Authority (CA) version for the specified - * instance. Required to prepare for a certificate rotation. If a CA version - * was previously added but never used in a certificate rotation, this - * operation replaces that version. There cannot be more than one CA version - * waiting to be rotated in. For instances that have enabled Certificate - * Authority Service (CAS) based server CA, use AddServerCertificate to add a - * new server certificate. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.add_server_ca.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_AddServerCa_async - */ - addServerCa( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | undefined, - {} | undefined, - ] - >; - addServerCa( - request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addServerCa( - request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addServerCa( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('addServerCa request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('addServerCa response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .addServerCa(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('addServerCa response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Add a new trusted server certificate version for the specified instance - * using Certificate Authority Service (CAS) server CA. Required to prepare - * for a certificate rotation. If a server certificate version was previously - * added but never used in a certificate rotation, this operation replaces - * that version. There cannot be more than one certificate version waiting to - * be rotated in. For instances not using CAS server CA, use AddServerCa - * instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.add_server_certificate.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_async - */ - addServerCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest - | undefined - ), - {} | undefined, - ] - >; - addServerCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addServerCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addServerCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('addServerCertificate request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('addServerCertificate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .addServerCertificate(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('addServerCertificate response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Adds a new Entra ID certificate for the specified instance. If an Entra ID - * certificate was previously added but never used in a certificate rotation, - * this operation replaces that version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.add_entra_id_certificate.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_async - */ - addEntraIdCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ] - >; - addEntraIdCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addEntraIdCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addEntraIdCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('addEntraIdCertificate request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('addEntraIdCertificate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .addEntraIdCertificate(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('addEntraIdCertificate response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates a Cloud SQL instance as a clone of the source instance. Using this - * operation might cause your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. The ID of the Cloud SQL instance to be cloned (source). This does - * not include the project ID. - * @param {string} request.project - * Required. Project ID of the source Cloud SQL instance. - * @param {google.cloud.sql.v1.InstancesCloneRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.clone.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Clone_async - */ - clone( - request?: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined, - {} | undefined, - ] - >; - clone( - request: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, - {} | null | undefined - >, - ): void; - clone( - request: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, - {} | null | undefined - >, - ): void; - clone( - request?: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesCloneRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('clone request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesCloneRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('clone response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .clone(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined, - {} | undefined, - ]) => { - this._log.info('clone response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Deletes a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be deleted. - * @param {boolean} request.enableFinalBackup - * Flag to opt-in for final backup. By default, it is turned off. - * @param {number} [request.finalBackupTtlDays] - * Optional. Retention period of the final backup. - * @param {google.protobuf.Timestamp} [request.finalBackupExpiryTime] - * Optional. Final Backup expiration time. - * Timestamp in UTC of when this resource is considered expired. - * @param {string} [request.finalBackupDescription] - * Optional. The description of the final backup. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.delete.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Delete_async - */ - delete( - request?: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined, - {} | undefined, - ] - >; - delete( - request: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request?: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('delete request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('delete response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .delete(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined, - {} | undefined, - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Demotes the stand-alone instance to be a Cloud SQL read replica for an - * external database server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance name. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesDemoteMasterRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.demote_master.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_DemoteMaster_async - */ - demoteMaster( - request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | undefined, - {} | undefined, - ] - >; - demoteMaster( - request: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - demoteMaster( - request: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - demoteMaster( - request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('demoteMaster request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('demoteMaster response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .demoteMaster(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('demoteMaster response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Demotes an existing standalone instance to be a Cloud SQL read replica - * for an external database server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance name. - * @param {string} request.project - * Required. ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesDemoteRequest} request.body - * Required. The request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.demote.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Demote_async - */ - demote( - request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined, - {} | undefined, - ] - >; - demote( - request: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, - {} | null | undefined - >, - ): void; - demote( - request: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, - {} | null | undefined - >, - ): void; - demote( - request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('demote request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('demote response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .demote(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined, - {} | undefined, - ]) => { - this._log.info('demote response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL - * dump or CSV file. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be exported. - * @param {google.cloud.sql.v1.InstancesExportRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.export.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Export_async - */ - export( - request?: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined, - {} | undefined, - ] - >; - export( - request: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, - {} | null | undefined - >, - ): void; - export( - request: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, - {} | null | undefined - >, - ): void; - export( - request?: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesExportRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('export request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesExportRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('export response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .export(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined, - {} | undefined, - ]) => { - this._log.info('export response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Initiates a manual failover of a high availability (HA) primary instance - * to a standby instance, which becomes the primary instance. Users are - * then rerouted to the new primary. For more information, see the - * [Overview of high - * availability](https://cloud.google.com/sql/docs/mysql/high-availability) - * page in the Cloud SQL documentation. - * If using Legacy HA (MySQL only), this causes the instance to failover to - * its failover replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {google.cloud.sql.v1.InstancesFailoverRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.failover.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Failover_async - */ - failover( - request?: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined, - {} | undefined, - ] - >; - failover( - request: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - failover( - request: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - failover( - request?: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('failover request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('failover response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .failover(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined, - {} | undefined, - ]) => { - this._log.info('failover response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Reencrypt CMEK instance with latest key version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesReencryptRequest} request.body - * Reencrypt body that users request - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.reencrypt.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Reencrypt_async - */ - reencrypt( - request?: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined, - {} | undefined, - ] - >; - reencrypt( - request: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - reencrypt( - request: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - reencrypt( - request?: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('reencrypt request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('reencrypt response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .reencrypt(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined, - {} | undefined, - ]) => { - this._log.info('reencrypt response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a resource containing information about a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Database instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.DatabaseInstance|DatabaseInstance}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.get.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Imports data into a Cloud SQL instance from a SQL dump or CSV file in - * Cloud Storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesImportRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.import.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Import_async - */ - import( - request?: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined, - {} | undefined, - ] - >; - import( - request: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, - {} | null | undefined - >, - ): void; - import( - request: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, - {} | null | undefined - >, - ): void; - import( - request?: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesImportRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('import request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesImportRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('import response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .import(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined, - {} | undefined, - ]) => { - this._log.info('import response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates a new Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Project ID of the project to which the newly created Cloud SQL instances - * should belong. - * @param {google.cloud.sql.v1.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.insert.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Insert_async - */ - insert( - request?: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined, - {} | undefined, - ] - >; - insert( - request: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request?: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesInsertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('insert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesInsertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .insert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined, - {} | undefined, - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists instances under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. - * The expression is in the form of field:value. For example, - * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per - * their JSON representation, such as 'settings.userLabels.auto_start:true'. - * - * Multiple filter queries are space-separated. For example. - * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each - * expression is an AND expression. However, you can include AND and OR - * expressions explicitly. - * @param {number} request.maxResults - * The maximum number of instances to return. The service may return fewer - * than this value. - * If unspecified, at most 500 instances are returned. - * The maximum value is 1000; values above 1000 are coerced to 1000. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project for which to list Cloud SQL instances. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListResponse|InstancesListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.list.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_List_async - */ - list( - request?: protos.google.cloud.sql.v1.ISqlInstancesListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1.ISqlInstancesListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1.ISqlInstancesListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1.ISqlInstancesListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IInstancesListResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IInstancesListResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all of the trusted Certificate Authorities (CAs) for the specified - * instance. There can be up to three CAs listed: the CA that was used to sign - * the certificate that is currently in use, a CA that has been added but not - * yet used to sign a certificate, and a CA used to sign a certificate that - * has previously rotated out. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListServerCasResponse|InstancesListServerCasResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.list_server_cas.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ListServerCas_async - */ - listServerCas( - request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | undefined, - {} | undefined, - ] - >; - listServerCas( - request: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listServerCas( - request: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listServerCas( - request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('listServerCas request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listServerCas response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .listServerCas(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('listServerCas response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all versions of server certificates and certificate authorities (CAs) - * for the specified instance. There can be up to three sets of certs listed: - * the certificate that is currently in use, a future that has been added but - * not yet used to sign a certificate, and a certificate that has been rotated - * out. For instances not using Certificate Authority Service (CAS) server CA, - * use ListServerCas instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse|InstancesListServerCertificatesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.list_server_certificates.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_async - */ - listServerCertificates( - request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest - | undefined - ), - {} | undefined, - ] - >; - listServerCertificates( - request: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listServerCertificates( - request: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listServerCertificates( - request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('listServerCertificates request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listServerCertificates response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .listServerCertificates(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('listServerCertificates response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all versions of EntraID certificates for the specified instance. - * There can be up to three sets of certificates listed: the certificate that - * is currently in use, a future that has been added but not yet used to sign - * a certificate, and a certificate that has been rotated out. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse|InstancesListEntraIdCertificatesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.list_entra_id_certificates.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_async - */ - listEntraIdCertificates( - request?: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest - | undefined - ), - {} | undefined, - ] - >; - listEntraIdCertificates( - request: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listEntraIdCertificates( - request: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listEntraIdCertificates( - request?: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('listEntraIdCertificates request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listEntraIdCertificates response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .listEntraIdCertificates(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('listEntraIdCertificates response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Partially updates settings of a Cloud SQL instance by merging the request - * with the current configuration. This method supports patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.patch.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Patch_async - */ - patch( - request?: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined, - {} | undefined, - ] - >; - patch( - request: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, - {} | null | undefined - >, - ): void; - patch( - request: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, - {} | null | undefined - >, - ): void; - patch( - request?: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPatchRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('patch request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPatchRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patch response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .patch(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined, - {} | undefined, - ]) => { - this._log.info('patch response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Promotes the read replica instance to be an independent Cloud SQL - * primary instance. - * Using this operation might cause your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {boolean} request.failover - * Set to true to invoke a replica failover to the DR - * replica. As part of replica failover, the promote operation attempts - * to add the original primary instance as a replica of the promoted - * DR replica when the original primary instance comes back online. - * If set to false or not specified, then the original primary - * instance becomes an independent Cloud SQL primary instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.promote_replica.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_PromoteReplica_async - */ - promoteReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | undefined, - {} | undefined, - ] - >; - promoteReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - promoteReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - promoteReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('promoteReplica request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('promoteReplica response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .promoteReplica(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('promoteReplica response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Switches over from the primary instance to the DR replica - * instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the replica. - * @param {google.protobuf.Duration} [request.dbTimeout] - * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations - * timeout, which is a sum of all database operations. Default value is 10 - * minutes and can be modified to a maximum value of 24 hours. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.switchover.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Switchover_async - */ - switchover( - request?: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined, - {} | undefined, - ] - >; - switchover( - request: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - switchover( - request: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - switchover( - request?: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('switchover request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('switchover response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .switchover(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined, - {} | undefined, - ]) => { - this._log.info('switchover response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Deletes all client certificates and generates a new server SSL certificate - * for the instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode} [request.mode] - * Optional. Reset SSL mode to use. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.reset_ssl_config.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_async - */ - resetSslConfig( - request?: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | undefined, - {} | undefined, - ] - >; - resetSslConfig( - request: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - resetSslConfig( - request: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - resetSslConfig( - request?: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('resetSslConfig request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('resetSslConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .resetSslConfig(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('resetSslConfig response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Restarts a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be restarted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.restart.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Restart_async - */ - restart( - request?: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined, - {} | undefined, - ] - >; - restart( - request: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, - {} | null | undefined - >, - ): void; - restart( - request: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, - {} | null | undefined - >, - ): void; - restart( - request?: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRestartRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('restart request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRestartRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('restart response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .restart(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined, - {} | undefined, - ]) => { - this._log.info('restart response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Restores a backup of a Cloud SQL instance. Using this operation might cause - * your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesRestoreBackupRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.restore_backup.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_RestoreBackup_async - */ - restoreBackup( - request?: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | undefined, - {} | undefined, - ] - >; - restoreBackup( - request: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - restoreBackup( - request: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - restoreBackup( - request?: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('restoreBackup request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('restoreBackup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .restoreBackup(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('restoreBackup response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Rotates the server certificate to one signed by the Certificate Authority - * (CA) version previously added with the addServerCA method. For instances - * that have enabled Certificate Authority Service (CAS) based server CA, - * use RotateServerCertificate to rotate the server certificate. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesRotateServerCaRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.rotate_server_ca.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateServerCa_async - */ - rotateServerCa( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | undefined, - {} | undefined, - ] - >; - rotateServerCa( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateServerCa( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateServerCa( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('rotateServerCa request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('rotateServerCa response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .rotateServerCa(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('rotateServerCa response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Rotates the server certificate version to one previously added with the - * addServerCertificate method. For instances not using Certificate Authority - * Service (CAS) server CA, use RotateServerCa instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} [request.body] - * Optional. Rotate server certificate request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.rotate_server_certificate.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_async - */ - rotateServerCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest - | undefined - ), - {} | undefined, - ] - >; - rotateServerCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateServerCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateServerCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('rotateServerCertificate request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('rotateServerCertificate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .rotateServerCertificate(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('rotateServerCertificate response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Rotates the server certificate version to one previously added with the - * addEntraIdCertificate method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} [request.body] - * Optional. Rotate Entra ID certificate request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_async - */ - rotateEntraIdCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ] - >; - rotateEntraIdCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateEntraIdCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateEntraIdCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('rotateEntraIdCertificate request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('rotateEntraIdCertificate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .rotateEntraIdCertificate(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('rotateEntraIdCertificate response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Starts the replication in the read replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.start_replica.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_StartReplica_async - */ - startReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | undefined, - {} | undefined, - ] - >; - startReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - startReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - startReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('startReplica request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('startReplica response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .startReplica(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('startReplica response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Stops the replication in the read replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.stop_replica.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_StopReplica_async - */ - stopReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | undefined, - {} | undefined, - ] - >; - stopReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - stopReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - stopReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('stopReplica request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('stopReplica response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .stopReplica(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('stopReplica response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Truncate MySQL general and slow query log tables - * MySQL only. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the Cloud SQL project. - * @param {google.cloud.sql.v1.InstancesTruncateLogRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.truncate_log.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_TruncateLog_async - */ - truncateLog( - request?: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | undefined, - {} | undefined, - ] - >; - truncateLog( - request: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - truncateLog( - request: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - truncateLog( - request?: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('truncateLog request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('truncateLog response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .truncateLog(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('truncateLog response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates settings of a Cloud SQL instance. Using this operation might cause - * your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.update.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Update_async - */ - update( - request?: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined, - {} | undefined, - ] - >; - update( - request: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, - {} | null | undefined - >, - ): void; - update( - request: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, - {} | null | undefined - >, - ): void; - update( - request?: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('update request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('update response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .update(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined, - {} | undefined, - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Generates a short-lived X509 certificate containing the provided public key - * and signed by a private key specific to the target instance. Users may use - * the certificate to authenticate as themselves when connecting to the - * database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the Cloud SQL project. - * @param {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCert|SslCert}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.create_ephemeral.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_async - */ - createEphemeral( - request?: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ISslCert, - ( - | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest - | undefined - ), - {} | undefined, - ] - >; - createEphemeral( - request: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISslCert, - | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - createEphemeral( - request: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISslCert, - | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - createEphemeral( - request?: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ISslCert, - | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ISslCert, - | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ISslCert, - ( - | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('createEphemeral request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ISslCert, - | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createEphemeral response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .createEphemeral(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISslCert, - ( - | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('createEphemeral response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Reschedules the maintenance on the given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.reschedule_maintenance.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_async - */ - rescheduleMaintenance( - request?: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest - | undefined - ), - {} | undefined, - ] - >; - rescheduleMaintenance( - request: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rescheduleMaintenance( - request: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rescheduleMaintenance( - request?: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('rescheduleMaintenance request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('rescheduleMaintenance response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .rescheduleMaintenance(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('rescheduleMaintenance response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Verify External primary instance external sync settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {boolean} request.verifyConnectionOnly - * Flag to enable verifying connection only - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode - * External sync mode - * @param {boolean} [request.verifyReplicationOnly] - * Optional. Flag to verify settings required by replication setup only - * @param {google.cloud.sql.v1.MySqlSyncConfig} [request.mysqlSyncConfig] - * Optional. MySQL-specific settings for start external sync. - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - * @param {google.cloud.sql.v1.ExternalSyncParallelLevel} [request.syncParallelLevel] - * Optional. Parallel level for initial data sync. Only applicable for - * PostgreSQL. - * @param {number[]} [request.selectedObjects] - * Optional. Migrate only the specified objects from the source instance. If - * this field is empty, then migrate all objects. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse|SqlInstancesVerifyExternalSyncSettingsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.verify_external_sync_settings.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_async - */ - verifyExternalSyncSettings( - request?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest - | undefined - ), - {} | undefined, - ] - >; - verifyExternalSyncSettings( - request: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - verifyExternalSyncSettings( - request: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - verifyExternalSyncSettings( - request?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('verifyExternalSyncSettings request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyExternalSyncSettings response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .verifyExternalSyncSettings(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('verifyExternalSyncSettings response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Start External primary instance migration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode - * External sync mode. - * @param {boolean} request.skipVerification - * Whether to skip the verification step (VESS). - * @param {google.cloud.sql.v1.MySqlSyncConfig} request.mysqlSyncConfig - * MySQL-specific settings for start external sync. - * @param {google.cloud.sql.v1.ExternalSyncParallelLevel} [request.syncParallelLevel] - * Optional. Parallel level for initial data sync. Currently only applicable - * for MySQL. - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - * @param {boolean} [request.replicaOverwriteEnabled] - * Optional. MySQL only. True if end-user has confirmed that this SES call - * will wipe replica databases overlapping with the proposed selected_objects. - * If this field is not set and there are both overlapping and additional - * databases proposed, an error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.start_external_sync.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_StartExternalSync_async - */ - startExternalSync( - request?: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest - | undefined - ), - {} | undefined, - ] - >; - startExternalSync( - request: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - startExternalSync( - request: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - startExternalSync( - request?: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('startExternalSync request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('startExternalSync response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .startExternalSync(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('startExternalSync response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Perform Disk Shrink on primary instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.PerformDiskShrinkContext} request.body - * Perform disk shrink context. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.perform_disk_shrink.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_async - */ - performDiskShrink( - request?: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest - | undefined - ), - {} | undefined, - ] - >; - performDiskShrink( - request: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - performDiskShrink( - request: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - performDiskShrink( - request?: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('performDiskShrink request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('performDiskShrink response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .performDiskShrink(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('performDiskShrink response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Get Disk Shrink Config for a given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse|SqlInstancesGetDiskShrinkConfigResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.get_disk_shrink_config.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_async - */ - getDiskShrinkConfig( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest - | undefined - ), - {} | undefined, - ] - >; - getDiskShrinkConfig( - request: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - getDiskShrinkConfig( - request: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - getDiskShrinkConfig( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('getDiskShrinkConfig request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getDiskShrinkConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getDiskShrinkConfig(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('getDiskShrinkConfig response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Reset Replica Size to primary instance disk size. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.reset_replica_size.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_async - */ - resetReplicaSize( - request?: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest - | undefined - ), - {} | undefined, - ] - >; - resetReplicaSize( - request: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - resetReplicaSize( - request: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - resetReplicaSize( - request?: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('resetReplicaSize request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('resetReplicaSize response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .resetReplicaSize(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('resetReplicaSize response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Get Latest Recovery Time for a given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.protobuf.Timestamp} request.sourceInstanceDeletionTime - * The timestamp used to identify the time when the source instance is - * deleted. If this instance is deleted, then you must set the timestamp. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse|SqlInstancesGetLatestRecoveryTimeResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.get_latest_recovery_time.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_async - */ - getLatestRecoveryTime( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest - | undefined - ), - {} | undefined, - ] - >; - getLatestRecoveryTime( - request: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - getLatestRecoveryTime( - request: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - getLatestRecoveryTime( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('getLatestRecoveryTime request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getLatestRecoveryTime response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getLatestRecoveryTime(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('getLatestRecoveryTime response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Execute SQL statements. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Database instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.ExecuteSqlPayload} request.body - * The request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse|SqlInstancesExecuteSqlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.execute_sql.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ExecuteSql_async - */ - executeSql( - request?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest | undefined, - {} | undefined, - ] - >; - executeSql( - request: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - executeSql( - request: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - executeSql( - request?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('executeSql request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('executeSql response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .executeSql(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest | undefined, - {} | undefined, - ]) => { - this._log.info('executeSql response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Acquire a lease for the setup of SQL Server Reporting Services (SSRS). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This doesn't include the project ID. It's - * composed of lowercase letters, numbers, and hyphens, and it must start with - * a letter. The total length must be 98 characters or less (Example: - * instance-id). - * @param {string} request.project - * Required. Project ID of the project that contains the instance (Example: - * project-id). - * @param {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} request.body - * Required. The request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse|SqlInstancesAcquireSsrsLeaseResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_async - */ - acquireSsrsLease( - request?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest - | undefined - ), - {} | undefined, - ] - >; - acquireSsrsLease( - request: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - acquireSsrsLease( - request: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - acquireSsrsLease( - request?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('acquireSsrsLease request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('acquireSsrsLease response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .acquireSsrsLease(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('acquireSsrsLease response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Release a lease for the setup of SQL Server Reporting Services (SSRS). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. The Cloud SQL instance ID. This doesn't include the project ID. - * The instance ID contains lowercase letters, numbers, and hyphens, and it - * must start with a letter. This ID can have a maximum length of 98 - * characters. - * @param {string} request.project - * Required. The project ID that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse|SqlInstancesReleaseSsrsLeaseResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.release_ssrs_lease.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_async - */ - releaseSsrsLease( - request?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest - | undefined - ), - {} | undefined, - ] - >; - releaseSsrsLease( - request: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - releaseSsrsLease( - request: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - releaseSsrsLease( - request?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('releaseSsrsLease request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('releaseSsrsLease response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .releaseSsrsLease(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('releaseSsrsLease response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Execute MVU Pre-checks - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} request.body - * Required. The context for request to perform the pre-check major version - * upgrade operation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async - */ - preCheckMajorVersionUpgrade( - request?: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | undefined - ), - {} | undefined, - ] - >; - preCheckMajorVersionUpgrade( - request: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - preCheckMajorVersionUpgrade( - request: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - preCheckMajorVersionUpgrade( - request?: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('preCheckMajorVersionUpgrade request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('preCheckMajorVersionUpgrade response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .preCheckMajorVersionUpgrade(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('preCheckMajorVersionUpgrade response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Point in time restore for an instance managed by Google Cloud Backup and - * Disaster Recovery. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where you created this instance. - * Format: projects/{project} - * @param {google.cloud.sql.v1.PointInTimeRestoreContext} request.context - * Required. The context for request to perform a PITR on a Google Cloud - * Backup and Disaster Recovery managed instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.point_in_time_restore.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_async - */ - pointInTimeRestore( - request?: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest - | undefined - ), - {} | undefined, - ] - >; - pointInTimeRestore( - request: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - pointInTimeRestore( - request: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - pointInTimeRestore( - request?: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('pointInTimeRestore request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pointInTimeRestore response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .pointInTimeRestore(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - ( - | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('pointInTimeRestore response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} backupvault - * @param {string} datasource - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath( - project: string, - location: string, - backupvault: string, - datasource: string, - backup: string, - ) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - location: location, - backupvault: backupvault, - datasource: datasource, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the location from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the location. - */ - matchLocationFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).location; - } - - /** - * Parse the backupvault from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backupvault. - */ - matchBackupvaultFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backupvault; - } - - /** - * Parse the datasource from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the datasource. - */ - matchDatasourceFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).datasource; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified network resource name string. - * - * @param {string} project - * @param {string} network - * @returns {string} Resource name string. - */ - networkPath(project: string, network: string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - network: network, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the network from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the network. - */ - matchNetworkFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).network; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlInstancesServiceStub && !this._terminated) { - return this.sqlInstancesServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client_config.json deleted file mode 100644 index d0194e6ed30d..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_client_config.json +++ /dev/null @@ -1,241 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlInstancesService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "AddServerCa": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AddServerCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AddEntraIdCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Clone": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Delete": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DemoteMaster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Demote": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Export": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Failover": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Reencrypt": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Import": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServerCas": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServerCertificates": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListEntraIdCertificates": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Patch": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PromoteReplica": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Switchover": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResetSslConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Restart": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RotateServerCa": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RotateServerCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RotateEntraIdCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartReplica": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StopReplica": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TruncateLog": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Update": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateEphemeral": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RescheduleMaintenance": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyExternalSyncSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartExternalSync": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PerformDiskShrink": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDiskShrinkConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResetReplicaSize": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetLatestRecoveryTime": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ExecuteSql": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AcquireSsrsLease": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReleaseSsrsLease": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PreCheckMajorVersionUpgrade": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PointInTimeRestore": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_instances_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client.ts deleted file mode 100644 index 4d9599d37c13..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client.ts +++ /dev/null @@ -1,916 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_operations_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_operations_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service to fetch operations for database instances. - * @class - * @memberof v1 - */ -export class SqlOperationsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlOperationsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlOperationsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlOperationsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlOperationsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlOperationsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlOperationsServiceStub) { - return this.sqlOperationsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlOperationsService. - this.sqlOperationsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlOperationsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlOperationsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlOperationsServiceStubMethods = ['get', 'list', 'cancel']; - for (const methodName of sqlOperationsServiceStubMethods) { - const callPromise = this.sqlOperationsServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlOperationsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Retrieves an instance operation that has been performed on an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Required. Instance operation ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_operations_service.get.js - * region_tag:sqladmin_v1_generated_SqlOperationsService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlOperationsGetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - operation: request.operation ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlOperationsGetRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all instance operations that have been performed on the given Cloud - * SQL instance in the reverse chronological order of the start time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {number} request.maxResults - * Maximum number of operations per response. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.OperationsListResponse|OperationsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_operations_service.list.js - * region_tag:sqladmin_v1_generated_SqlOperationsService_List_async - */ - list( - request?: protos.google.cloud.sql.v1.ISqlOperationsListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1.ISqlOperationsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1.ISqlOperationsListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1.ISqlOperationsListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperationsListResponse, - | protos.google.cloud.sql.v1.ISqlOperationsListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperationsListResponse, - | protos.google.cloud.sql.v1.ISqlOperationsListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Cancels an instance operation that has been performed on an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Instance operation ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_operations_service.cancel.js - * region_tag:sqladmin_v1_generated_SqlOperationsService_Cancel_async - */ - cancel( - request?: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | undefined, - {} | undefined, - ] - >; - cancel( - request: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, - {} | null | undefined - >, - ): void; - cancel( - request: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, - {} | null | undefined - >, - ): void; - cancel( - request?: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.sql.v1.ISqlOperationsCancelRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - operation: request.operation ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('cancel request %j', request); - const wrappedCallback: - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.sql.v1.ISqlOperationsCancelRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('cancel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .cancel(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | undefined, - {} | undefined, - ]) => { - this._log.info('cancel response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlOperationsServiceStub && !this._terminated) { - return this.sqlOperationsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client_config.json deleted file mode 100644 index c743c87fcf3c..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_client_config.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlOperationsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Cancel": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_operations_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client.ts deleted file mode 100644 index a473e37048d6..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client.ts +++ /dev/null @@ -1,487 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_regions_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_regions_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service that exposes Cloud SQL region information. This service is only used - * internally and does not follow the same patterns as the other v1 RPCs. - * @class - * @memberof v1 - */ -export class SqlRegionsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlRegionsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlRegionsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlRegionsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlRegionsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlRegionsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlRegionsServiceStub) { - return this.sqlRegionsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlRegionsService. - this.sqlRegionsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlRegionsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlRegionsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - return this.sqlRegionsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlRegionsServiceStub && !this._terminated) { - return this.sqlRegionsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client_config.json deleted file mode 100644 index a44241cc3d99..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_client_config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlRegionsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": {} - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_regions_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts deleted file mode 100644 index e820b8c0dff9..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts +++ /dev/null @@ -1,1046 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_ssl_certs_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_ssl_certs_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service to manage SSL certs for Cloud SQL instances. - * @class - * @memberof v1 - */ -export class SqlSslCertsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlSslCertsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlSslCertsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlSslCertsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlSslCertsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlSslCertsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlSslCertsServiceStub) { - return this.sqlSslCertsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlSslCertsService. - this.sqlSslCertsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlSslCertsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlSslCertsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlSslCertsServiceStubMethods = ['delete', 'get', 'insert', 'list']; - for (const methodName of sqlSslCertsServiceStubMethods) { - const callPromise = this.sqlSslCertsServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlSslCertsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Deletes the SSL certificate. For First Generation instances, the - * certificate remains valid until the instance is restarted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.sha1Fingerprint - * Sha1 FingerPrint. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_ssl_certs_service.delete.js - * region_tag:sqladmin_v1_generated_SqlSslCertsService_Delete_async - */ - delete( - request?: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | undefined, - {} | undefined, - ] - >; - delete( - request: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request?: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - sha1_fingerprint: request.sha1Fingerprint ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('delete request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - | protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('delete response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .delete(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | undefined, - {} | undefined, - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a particular SSL certificate. Does not include the private key - * (required for usage). The private key must be saved from the response to - * initial creation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.sha1Fingerprint - * Sha1 FingerPrint. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCert|SslCert}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_ssl_certs_service.get.js - * region_tag:sqladmin_v1_generated_SqlSslCertsService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - sha1_fingerprint: request.sha1Fingerprint ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates an SSL certificate and returns it along with the private key and - * server certificate authority. The new certificate will not be usable until - * the instance is restarted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.SslCertsInsertRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCertsInsertResponse|SslCertsInsertResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_ssl_certs_service.insert.js - * region_tag:sqladmin_v1_generated_SqlSslCertsService_Insert_async - */ - insert( - request?: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | undefined, - {} | undefined, - ] - >; - insert( - request: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request?: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - | protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('insert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - | protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .insert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | undefined, - {} | undefined, - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all of the current SSL certificates for the instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCertsListResponse|SslCertsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_ssl_certs_service.list.js - * region_tag:sqladmin_v1_generated_SqlSslCertsService_List_async - */ - list( - request?: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlSslCertsServiceStub && !this._terminated) { - return this.sqlSslCertsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client_config.json deleted file mode 100644 index c16ba4e25f84..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlSslCertsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Delete": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_ssl_certs_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client.ts deleted file mode 100644 index 559916f53617..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client.ts +++ /dev/null @@ -1,644 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_tiers_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_tiers_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for providing machine types (tiers) for Cloud SQL instances. - * @class - * @memberof v1 - */ -export class SqlTiersServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlTiersServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlTiersServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlTiersServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlTiersServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlTiersService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlTiersServiceStub) { - return this.sqlTiersServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlTiersService. - this.sqlTiersServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlTiersService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlTiersService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlTiersServiceStubMethods = ['list']; - for (const methodName of sqlTiersServiceStubMethods) { - const callPromise = this.sqlTiersServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlTiersServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Lists all available machine types (tiers) for Cloud SQL, for example, - * `db-custom-1-3840`. For more information, see - * https://cloud.google.com/sql/pricing. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Project ID of the project for which to list tiers. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.TiersListResponse|TiersListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_tiers_service.list.js - * region_tag:sqladmin_v1_generated_SqlTiersService_List_async - */ - list( - request?: protos.google.cloud.sql.v1.ISqlTiersListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1.ISqlTiersListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1.ISqlTiersListRequest, - callback: Callback< - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1.ISqlTiersListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlTiersServiceStub && !this._terminated) { - return this.sqlTiersServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client_config.json deleted file mode 100644 index e68965701bb8..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_client_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlTiersService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_tiers_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client.ts deleted file mode 100644 index 4ef6422ba951..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client.ts +++ /dev/null @@ -1,1181 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1/sql_users_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_users_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Cloud SQL users service. - * @class - * @memberof v1 - */ -export class SqlUsersServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlUsersServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlUsersServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlUsersServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlUsersServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlUsersService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlUsersServiceStub) { - return this.sqlUsersServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1.SqlUsersService. - this.sqlUsersServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1.SqlUsersService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlUsersService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlUsersServiceStubMethods = [ - 'delete', - 'get', - 'insert', - 'list', - 'update', - ]; - for (const methodName of sqlUsersServiceStubMethods) { - const callPromise = this.sqlUsersServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlUsersServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Deletes a user from a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.host - * Host of the user in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * Name of the user in the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_users_service.delete.js - * region_tag:sqladmin_v1_generated_SqlUsersService_Delete_async - */ - delete( - request?: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | undefined, - {} | undefined, - ] - >; - delete( - request: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request?: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('delete request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('delete response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .delete(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | undefined, - {} | undefined, - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a resource containing information about a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * User of the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.host - * Host of a user of the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_users_service.get.js - * region_tag:sqladmin_v1_generated_SqlUsersService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1.ISqlUsersGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1.ISqlUsersGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1.ISqlUsersGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1.ISqlUsersGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - name: request.name ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates a new user in a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.User} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_users_service.insert.js - * region_tag:sqladmin_v1_generated_SqlUsersService_Insert_async - */ - insert( - request?: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest | undefined, - {} | undefined, - ] - >; - insert( - request: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request?: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('insert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .insert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest | undefined, - {} | undefined, - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists users in the specified Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.UsersListResponse|UsersListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_users_service.list.js - * region_tag:sqladmin_v1_generated_SqlUsersService_List_async - */ - list( - request?: protos.google.cloud.sql.v1.ISqlUsersListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1.ISqlUsersListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1.ISqlUsersListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1.ISqlUsersListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates an existing user in a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.host] - * Optional. Host of the user in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * Name of the user in the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string[]} [request.databaseRoles] - * Optional. List of database roles to grant to the user. body.database_roles - * will be ignored for update request. - * @param {boolean} [request.revokeExistingRoles] - * Optional. Specifies whether to revoke existing roles that are not present - * in the `database_roles` field. If `false` or unset, the database roles - * specified in `database_roles` are added to the user's existing roles. - * @param {google.cloud.sql.v1.User} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_users_service.update.js - * region_tag:sqladmin_v1_generated_SqlUsersService_Update_async - */ - update( - request?: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | undefined, - {} | undefined, - ] - >; - update( - request: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, - {} | null | undefined - >, - ): void; - update( - request: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, - {} | null | undefined - >, - ): void; - update( - request?: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('update request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('update response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .update(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | undefined, - {} | undefined, - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlUsersServiceStub && !this._terminated) { - return this.sqlUsersServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client_config.json deleted file mode 100644 index 154c5021b316..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_client_config.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1.SqlUsersService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Delete": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Update": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_proto_list.json deleted file mode 100644 index b01e564537f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1/sql_users_service_proto_list.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1/cloud_sql_available_database_versions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backup_runs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_backups.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_databases.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_events.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_feature_eligibility.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_flags.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instance_names.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_instances.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_operations.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_regions.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_ssl_certs.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/gapic_metadata.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/gapic_metadata.json deleted file mode 100644 index 6c656c511fee..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/gapic_metadata.json +++ /dev/null @@ -1,905 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.sql.v1beta4", - "libraryPackage": "@google-cloud/sql", - "services": { - "SqlBackupRunsService": { - "clients": { - "grpc": { - "libraryClient": "SqlBackupRunsServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlBackupRunsServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - } - } - } - } - }, - "SqlBackupsService": { - "clients": { - "grpc": { - "libraryClient": "SqlBackupsServiceClient", - "rpcs": { - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlBackupsServiceClient", - "rpcs": { - "CreateBackup": { - "methods": [ - "createBackup" - ] - }, - "GetBackup": { - "methods": [ - "getBackup" - ] - }, - "UpdateBackup": { - "methods": [ - "updateBackup" - ] - }, - "DeleteBackup": { - "methods": [ - "deleteBackup" - ] - }, - "ListBackups": { - "methods": [ - "listBackups", - "listBackupsStream", - "listBackupsAsync" - ] - } - } - } - } - }, - "SqlConnectService": { - "clients": { - "grpc": { - "libraryClient": "SqlConnectServiceClient", - "rpcs": { - "GetConnectSettings": { - "methods": [ - "getConnectSettings" - ] - }, - "GenerateEphemeralCert": { - "methods": [ - "generateEphemeralCert" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlConnectServiceClient", - "rpcs": { - "GetConnectSettings": { - "methods": [ - "getConnectSettings" - ] - }, - "GenerateEphemeralCert": { - "methods": [ - "generateEphemeralCert" - ] - } - } - } - } - }, - "SqlDatabasesService": { - "clients": { - "grpc": { - "libraryClient": "SqlDatabasesServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Patch": { - "methods": [ - "patch" - ] - }, - "Update": { - "methods": [ - "update" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlDatabasesServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Patch": { - "methods": [ - "patch" - ] - }, - "Update": { - "methods": [ - "update" - ] - } - } - } - } - }, - "SqlFlagsService": { - "clients": { - "grpc": { - "libraryClient": "SqlFlagsServiceClient", - "rpcs": { - "List": { - "methods": [ - "list" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlFlagsServiceClient", - "rpcs": { - "List": { - "methods": [ - "list" - ] - } - } - } - } - }, - "SqlIamPoliciesService": { - "clients": { - "grpc": { - "libraryClient": "SqlIamPoliciesServiceClient", - "rpcs": {} - }, - "grpc-fallback": { - "libraryClient": "SqlIamPoliciesServiceClient", - "rpcs": {} - } - } - }, - "SqlInstancesService": { - "clients": { - "grpc": { - "libraryClient": "SqlInstancesServiceClient", - "rpcs": { - "AddServerCa": { - "methods": [ - "addServerCa" - ] - }, - "AddServerCertificate": { - "methods": [ - "addServerCertificate" - ] - }, - "AddEntraIdCertificate": { - "methods": [ - "addEntraIdCertificate" - ] - }, - "Clone": { - "methods": [ - "clone" - ] - }, - "Delete": { - "methods": [ - "delete" - ] - }, - "DemoteMaster": { - "methods": [ - "demoteMaster" - ] - }, - "Demote": { - "methods": [ - "demote" - ] - }, - "Export": { - "methods": [ - "export" - ] - }, - "Failover": { - "methods": [ - "failover" - ] - }, - "Reencrypt": { - "methods": [ - "reencrypt" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Import": { - "methods": [ - "import" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "ListServerCas": { - "methods": [ - "listServerCas" - ] - }, - "ListServerCertificates": { - "methods": [ - "listServerCertificates" - ] - }, - "ListEntraIdCertificates": { - "methods": [ - "listEntraIdCertificates" - ] - }, - "Patch": { - "methods": [ - "patch" - ] - }, - "PromoteReplica": { - "methods": [ - "promoteReplica" - ] - }, - "Switchover": { - "methods": [ - "switchover" - ] - }, - "ResetSslConfig": { - "methods": [ - "resetSslConfig" - ] - }, - "Restart": { - "methods": [ - "restart" - ] - }, - "RestoreBackup": { - "methods": [ - "restoreBackup" - ] - }, - "RotateServerCa": { - "methods": [ - "rotateServerCa" - ] - }, - "RotateServerCertificate": { - "methods": [ - "rotateServerCertificate" - ] - }, - "RotateEntraIdCertificate": { - "methods": [ - "rotateEntraIdCertificate" - ] - }, - "StartReplica": { - "methods": [ - "startReplica" - ] - }, - "StopReplica": { - "methods": [ - "stopReplica" - ] - }, - "TruncateLog": { - "methods": [ - "truncateLog" - ] - }, - "Update": { - "methods": [ - "update" - ] - }, - "CreateEphemeral": { - "methods": [ - "createEphemeral" - ] - }, - "RescheduleMaintenance": { - "methods": [ - "rescheduleMaintenance" - ] - }, - "VerifyExternalSyncSettings": { - "methods": [ - "verifyExternalSyncSettings" - ] - }, - "StartExternalSync": { - "methods": [ - "startExternalSync" - ] - }, - "PerformDiskShrink": { - "methods": [ - "performDiskShrink" - ] - }, - "GetDiskShrinkConfig": { - "methods": [ - "getDiskShrinkConfig" - ] - }, - "ResetReplicaSize": { - "methods": [ - "resetReplicaSize" - ] - }, - "GetLatestRecoveryTime": { - "methods": [ - "getLatestRecoveryTime" - ] - }, - "ExecuteSql": { - "methods": [ - "executeSql" - ] - }, - "AcquireSsrsLease": { - "methods": [ - "acquireSsrsLease" - ] - }, - "ReleaseSsrsLease": { - "methods": [ - "releaseSsrsLease" - ] - }, - "PreCheckMajorVersionUpgrade": { - "methods": [ - "preCheckMajorVersionUpgrade" - ] - }, - "PointInTimeRestore": { - "methods": [ - "pointInTimeRestore" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlInstancesServiceClient", - "rpcs": { - "AddServerCa": { - "methods": [ - "addServerCa" - ] - }, - "AddServerCertificate": { - "methods": [ - "addServerCertificate" - ] - }, - "AddEntraIdCertificate": { - "methods": [ - "addEntraIdCertificate" - ] - }, - "Clone": { - "methods": [ - "clone" - ] - }, - "Delete": { - "methods": [ - "delete" - ] - }, - "DemoteMaster": { - "methods": [ - "demoteMaster" - ] - }, - "Demote": { - "methods": [ - "demote" - ] - }, - "Export": { - "methods": [ - "export" - ] - }, - "Failover": { - "methods": [ - "failover" - ] - }, - "Reencrypt": { - "methods": [ - "reencrypt" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Import": { - "methods": [ - "import" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "ListServerCas": { - "methods": [ - "listServerCas" - ] - }, - "ListServerCertificates": { - "methods": [ - "listServerCertificates" - ] - }, - "ListEntraIdCertificates": { - "methods": [ - "listEntraIdCertificates" - ] - }, - "Patch": { - "methods": [ - "patch" - ] - }, - "PromoteReplica": { - "methods": [ - "promoteReplica" - ] - }, - "Switchover": { - "methods": [ - "switchover" - ] - }, - "ResetSslConfig": { - "methods": [ - "resetSslConfig" - ] - }, - "Restart": { - "methods": [ - "restart" - ] - }, - "RestoreBackup": { - "methods": [ - "restoreBackup" - ] - }, - "RotateServerCa": { - "methods": [ - "rotateServerCa" - ] - }, - "RotateServerCertificate": { - "methods": [ - "rotateServerCertificate" - ] - }, - "RotateEntraIdCertificate": { - "methods": [ - "rotateEntraIdCertificate" - ] - }, - "StartReplica": { - "methods": [ - "startReplica" - ] - }, - "StopReplica": { - "methods": [ - "stopReplica" - ] - }, - "TruncateLog": { - "methods": [ - "truncateLog" - ] - }, - "Update": { - "methods": [ - "update" - ] - }, - "CreateEphemeral": { - "methods": [ - "createEphemeral" - ] - }, - "RescheduleMaintenance": { - "methods": [ - "rescheduleMaintenance" - ] - }, - "VerifyExternalSyncSettings": { - "methods": [ - "verifyExternalSyncSettings" - ] - }, - "StartExternalSync": { - "methods": [ - "startExternalSync" - ] - }, - "PerformDiskShrink": { - "methods": [ - "performDiskShrink" - ] - }, - "GetDiskShrinkConfig": { - "methods": [ - "getDiskShrinkConfig" - ] - }, - "ResetReplicaSize": { - "methods": [ - "resetReplicaSize" - ] - }, - "GetLatestRecoveryTime": { - "methods": [ - "getLatestRecoveryTime" - ] - }, - "ExecuteSql": { - "methods": [ - "executeSql" - ] - }, - "AcquireSsrsLease": { - "methods": [ - "acquireSsrsLease" - ] - }, - "ReleaseSsrsLease": { - "methods": [ - "releaseSsrsLease" - ] - }, - "PreCheckMajorVersionUpgrade": { - "methods": [ - "preCheckMajorVersionUpgrade" - ] - }, - "PointInTimeRestore": { - "methods": [ - "pointInTimeRestore" - ] - } - } - } - } - }, - "SqlOperationsService": { - "clients": { - "grpc": { - "libraryClient": "SqlOperationsServiceClient", - "rpcs": { - "Get": { - "methods": [ - "get" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Cancel": { - "methods": [ - "cancel" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlOperationsServiceClient", - "rpcs": { - "Get": { - "methods": [ - "get" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Cancel": { - "methods": [ - "cancel" - ] - } - } - } - } - }, - "SqlSslCertsService": { - "clients": { - "grpc": { - "libraryClient": "SqlSslCertsServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlSslCertsServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - } - } - } - } - }, - "SqlTiersService": { - "clients": { - "grpc": { - "libraryClient": "SqlTiersServiceClient", - "rpcs": { - "List": { - "methods": [ - "list" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlTiersServiceClient", - "rpcs": { - "List": { - "methods": [ - "list" - ] - } - } - } - } - }, - "SqlUsersService": { - "clients": { - "grpc": { - "libraryClient": "SqlUsersServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Update": { - "methods": [ - "update" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SqlUsersServiceClient", - "rpcs": { - "Delete": { - "methods": [ - "delete" - ] - }, - "Get": { - "methods": [ - "get" - ] - }, - "Insert": { - "methods": [ - "insert" - ] - }, - "List": { - "methods": [ - "list" - ] - }, - "Update": { - "methods": [ - "update" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/index.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/index.ts deleted file mode 100644 index d8f42f199ca2..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/index.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export { SqlBackupRunsServiceClient } from './sql_backup_runs_service_client'; -export { SqlBackupsServiceClient } from './sql_backups_service_client'; -export { SqlConnectServiceClient } from './sql_connect_service_client'; -export { SqlDatabasesServiceClient } from './sql_databases_service_client'; -export { SqlFlagsServiceClient } from './sql_flags_service_client'; -export { SqlIamPoliciesServiceClient } from './sql_iam_policies_service_client'; -export { SqlInstancesServiceClient } from './sql_instances_service_client'; -export { SqlOperationsServiceClient } from './sql_operations_service_client'; -export { SqlSslCertsServiceClient } from './sql_ssl_certs_service_client'; -export { SqlTiersServiceClient } from './sql_tiers_service_client'; -export { SqlUsersServiceClient } from './sql_users_service_client'; diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts deleted file mode 100644 index 1d8a6b7aca1a..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts +++ /dev/null @@ -1,1114 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_backup_runs_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_backup_runs_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta4 - */ -export class SqlBackupRunsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlBackupRunsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlBackupRunsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlBackupRunsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlBackupRunsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlBackupRunsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlBackupRunsServiceStub) { - return this.sqlBackupRunsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlBackupRunsService. - this.sqlBackupRunsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlBackupRunsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlBackupRunsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlBackupRunsServiceStubMethods = ['delete', 'get', 'insert', 'list']; - for (const methodName of sqlBackupRunsServiceStubMethods) { - const callPromise = this.sqlBackupRunsServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlBackupRunsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Deletes the backup taken by a backup run. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.id - * The ID of the backup run to delete. To find a backup run ID, use the - * [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/backupRuns/list) - * method. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backup_runs_service.delete.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Delete_async - */ - delete( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest | undefined, - {} | undefined, - ] - >; - delete( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - delete( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - delete( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - id: request.id?.toString() ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('delete request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('delete response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .delete(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a resource containing information about a backup run. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.id - * The ID of this backup run. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.BackupRun|BackupRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backup_runs_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackupRun, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackupRun, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IBackupRun, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IBackupRun, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - id: request.id?.toString() ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IBackupRun, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates a new backup run on demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.BackupRun} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backup_runs_service.insert.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Insert_async - */ - insert( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest | undefined, - {} | undefined, - ] - >; - insert( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - insert( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - insert( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('insert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .insert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all backup runs associated with the project or a given instance and - * configuration in the reverse chronological order of the backup initiation - * time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID, or "-" for all instances. This does not include - * the project ID. - * @param {number} request.maxResults - * Maximum number of backup runs per response. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.BackupRunsListResponse|BackupRunsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backup_runs_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_List_async - */ - list( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlBackupRunsServiceStub && !this._terminated) { - return this.sqlBackupRunsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client_config.json deleted file mode 100644 index 809d41f9fddc..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlBackupRunsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Delete": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backup_runs_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts deleted file mode 100644 index 8c51bd7530ed..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts +++ /dev/null @@ -1,1339 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - PaginationCallback, - GaxCall, - LocationsClient, - LocationProtos, -} from 'google-gax'; -import { Transform } from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_backups_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_backups_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta4 - */ -export class SqlBackupsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlBackupsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlBackupsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlBackupsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlBackupsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - }; - - // Some of the methods on this service return "paged" results, - // (e.g. 50 results at a time, with tokens to get subsequent - // pages). Denote the keys used for pagination and results. - this.descriptors.page = { - listBackups: new this._gaxModule.PageDescriptor( - 'pageToken', - 'nextPageToken', - 'backups', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlBackupsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlBackupsServiceStub) { - return this.sqlBackupsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlBackupsService. - this.sqlBackupsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlBackupsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlBackupsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlBackupsServiceStubMethods = [ - 'createBackup', - 'getBackup', - 'listBackups', - 'updateBackup', - 'deleteBackup', - ]; - for (const methodName of sqlBackupsServiceStubMethods) { - const callPromise = this.sqlBackupsServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = this.descriptors.page[methodName] || undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlBackupsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Creates a backup for a Cloud SQL instance. This API can be used only to - * create on-demand backups. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this backup is created. - * Format: projects/{project} - * @param {google.cloud.sql.v1beta4.Backup} request.backup - * Required. The Backup to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backups_service.create_backup.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_CreateBackup_async - */ - createBackup( - request?: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest | undefined, - {} | undefined, - ] - >; - createBackup( - request: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - createBackup( - request: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - createBackup( - request?: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ICreateBackupRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('createBackup request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ICreateBackupRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createBackup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .createBackup(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest | undefined, - {} | undefined, - ]) => { - this._log.info('createBackup response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a resource containing information about a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the backup to retrieve. - * Format: projects/{project}/backups/{backup} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backups_service.get_backup.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_GetBackup_async - */ - getBackup( - request?: protos.google.cloud.sql.v1beta4.IGetBackupRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest | undefined, - {} | undefined, - ] - >; - getBackup( - request: protos.google.cloud.sql.v1beta4.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - getBackup( - request: protos.google.cloud.sql.v1beta4.IGetBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - getBackup( - request?: protos.google.cloud.sql.v1beta4.IGetBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('getBackup request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getBackup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getBackup(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest | undefined, - {} | undefined, - ]) => { - this._log.info('getBackup response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates the retention period and the description of the backup. You can use - * this API to update final backups only. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.sql.v1beta4.Backup} request.backup - * Required. The backup to update. - * The backup’s `name` field is used to identify the backup to update. - * Format: projects/{project}/backups/{backup} - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields that you can update. You can update only the description - * and retention period of the final backup. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backups_service.update_backup.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_UpdateBackup_async - */ - updateBackup( - request?: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | undefined, - {} | undefined, - ] - >; - updateBackup( - request: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - updateBackup( - request: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - updateBackup( - request?: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.IUpdateBackupRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - 'backup.name': request.backup!.name ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('updateBackup request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.IUpdateBackupRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('updateBackup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .updateBackup(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | undefined, - {} | undefined, - ]) => { - this._log.info('updateBackup response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Deletes the backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the backup to delete. - * Format: projects/{project}/backups/{backup} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backups_service.delete_backup.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_DeleteBackup_async - */ - deleteBackup( - request?: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | undefined, - {} | undefined, - ] - >; - deleteBackup( - request: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteBackup( - request: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | null | undefined, - {} | null | undefined - >, - ): void; - deleteBackup( - request?: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.IDeleteBackupRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - name: request.name ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('deleteBackup request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.IDeleteBackupRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('deleteBackup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .deleteBackup(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | undefined, - {} | undefined, - ]) => { - this._log.info('deleteBackup response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Lists all backups associated with the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackups( - request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IBackup[], - protos.google.cloud.sql.v1beta4.IListBackupsRequest | null, - protos.google.cloud.sql.v1beta4.IListBackupsResponse, - ] - >; - listBackups( - request: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.sql.v1beta4.IListBackupsRequest, - protos.google.cloud.sql.v1beta4.IListBackupsResponse | null | undefined, - protos.google.cloud.sql.v1beta4.IBackup - >, - ): void; - listBackups( - request: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.sql.v1beta4.IListBackupsRequest, - protos.google.cloud.sql.v1beta4.IListBackupsResponse | null | undefined, - protos.google.cloud.sql.v1beta4.IBackup - >, - ): void; - listBackups( - request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - optionsOrCallback?: - | CallOptions - | PaginationCallback< - protos.google.cloud.sql.v1beta4.IListBackupsRequest, - | protos.google.cloud.sql.v1beta4.IListBackupsResponse - | null - | undefined, - protos.google.cloud.sql.v1beta4.IBackup - >, - callback?: PaginationCallback< - protos.google.cloud.sql.v1beta4.IListBackupsRequest, - protos.google.cloud.sql.v1beta4.IListBackupsResponse | null | undefined, - protos.google.cloud.sql.v1beta4.IBackup - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IBackup[], - protos.google.cloud.sql.v1beta4.IListBackupsRequest | null, - protos.google.cloud.sql.v1beta4.IListBackupsResponse, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - const wrappedCallback: - | PaginationCallback< - protos.google.cloud.sql.v1beta4.IListBackupsRequest, - | protos.google.cloud.sql.v1beta4.IListBackupsResponse - | null - | undefined, - protos.google.cloud.sql.v1beta4.IBackup - > - | undefined = callback - ? (error, values, nextPageRequest, rawResponse) => { - this._log.info('listBackups values %j', values); - callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. - } - : undefined; - this._log.info('listBackups request %j', request); - return this.innerApiCalls - .listBackups(request, options, wrappedCallback) - ?.then( - ([response, input, output]: [ - protos.google.cloud.sql.v1beta4.IBackup[], - protos.google.cloud.sql.v1beta4.IListBackupsRequest | null, - protos.google.cloud.sql.v1beta4.IListBackupsResponse, - ]) => { - this._log.info('listBackups values %j', response); - return [response, input, output]; - }, - ); - } - - /** - * Equivalent to `listBackups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.sql.v1beta4.Backup|Backup} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ - listBackupsStream( - request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - options?: CallOptions, - ): Transform { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('listBackups stream %j', request); - return this.descriptors.page.listBackups.createStream( - this.innerApiCalls.listBackups as GaxCall, - request, - callSettings, - ); - } - - /** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backups_service.list_backups.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_ListBackups_async - */ - listBackupsAsync( - request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - options?: CallOptions, - ): AsyncIterable { - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listBackups']; - const callSettings = defaultCallSettings.merge(options); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('listBackups iterate %j', request); - return this.descriptors.page.listBackups.asyncIterate( - this.innerApiCalls['listBackups'] as GaxCall, - request as {}, - callSettings, - ) as AsyncIterable; - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlBackupsServiceStub && !this._terminated) { - return this.sqlBackupsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client_config.json deleted file mode 100644 index bb2f7167b21d..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_client_config.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlBackupsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "CreateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListBackups": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_backups_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts deleted file mode 100644 index 98f4fcbdfa17..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts +++ /dev/null @@ -1,816 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_connect_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_connect_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Cloud SQL connect service. - * @class - * @memberof v1beta4 - */ -export class SqlConnectServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlConnectServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlConnectServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlConnectServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlConnectServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlConnectService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlConnectServiceStub) { - return this.sqlConnectServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlConnectService. - this.sqlConnectServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlConnectService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlConnectService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlConnectServiceStubMethods = [ - 'getConnectSettings', - 'generateEphemeralCert', - ]; - for (const methodName of sqlConnectServiceStubMethods) { - const callPromise = this.sqlConnectServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlConnectServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Retrieves connect settings about a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.protobuf.Timestamp} [request.readTime] - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.ConnectSettings|ConnectSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_connect_service.get_connect_settings.js - * region_tag:sqladmin_v1beta4_generated_SqlConnectService_GetConnectSettings_async - */ - getConnectSettings( - request?: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IConnectSettings, - protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest | undefined, - {} | undefined, - ] - >; - getConnectSettings( - request: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IConnectSettings, - | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - getConnectSettings( - request: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IConnectSettings, - | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - getConnectSettings( - request?: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IConnectSettings, - | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IConnectSettings, - | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IConnectSettings, - protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('getConnectSettings request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IConnectSettings, - | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getConnectSettings response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getConnectSettings(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IConnectSettings, - ( - | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('getConnectSettings response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Generates a short-lived X509 certificate containing the provided public key - * and signed by a private key specific to the target instance. Users may use - * the certificate to authenticate as themselves when connecting to the - * database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.publicKey - * PEM encoded public key to include in the signed certificate. - * @param {string} [request.accessToken] - * Optional. Access token to include in the signed certificate. - * @param {google.protobuf.Timestamp} [request.readTime] - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - * @param {google.protobuf.Duration} [request.validDuration] - * Optional. If set, it will contain the cert valid duration. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse|GenerateEphemeralCertResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js - * region_tag:sqladmin_v1beta4_generated_SqlConnectService_GenerateEphemeralCert_async - */ - generateEphemeralCert( - request?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest | undefined, - {} | undefined, - ] - >; - generateEphemeralCert( - request: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - generateEphemeralCert( - request: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - generateEphemeralCert( - request?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('generateEphemeralCert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('generateEphemeralCert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .generateEphemeralCert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - ( - | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('generateEphemeralCert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlConnectServiceStub && !this._terminated) { - return this.sqlConnectServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client_config.json deleted file mode 100644 index 6d2f142ab0d5..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_client_config.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlConnectService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "GetConnectSettings": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GenerateEphemeralCert": { - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_connect_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts deleted file mode 100644 index acc2d5a1d7c3..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts +++ /dev/null @@ -1,1405 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_databases_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_databases_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta4 - */ -export class SqlDatabasesServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlDatabasesServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlDatabasesServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlDatabasesServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlDatabasesServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlDatabasesService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlDatabasesServiceStub) { - return this.sqlDatabasesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlDatabasesService. - this.sqlDatabasesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlDatabasesService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlDatabasesService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlDatabasesServiceStubMethods = [ - 'delete', - 'get', - 'insert', - 'list', - 'patch', - 'update', - ]; - for (const methodName of sqlDatabasesServiceStubMethods) { - const callPromise = this.sqlDatabasesServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlDatabasesServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Deletes a database from a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be deleted in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.delete.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Delete_async - */ - delete( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest | undefined, - {} | undefined, - ] - >; - delete( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - delete( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - delete( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - database: request.database ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('delete request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('delete response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .delete(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a resource containing information about a database inside a Cloud - * SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Database|Database}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabase, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabase, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IDatabase, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IDatabase, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - database: request.database ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IDatabase, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Inserts a resource containing information about a database inside a Cloud - * SQL instance. - * - * **Note:** You can't modify the default character set and collation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.insert.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Insert_async - */ - insert( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest | undefined, - {} | undefined, - ] - >; - insert( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - insert( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - insert( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('insert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .insert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists databases in the specified Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.DatabasesListResponse|DatabasesListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_List_async - */ - list( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Partially updates a resource containing information about a database inside - * a Cloud SQL instance. This method supports patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be updated in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.patch.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Patch_async - */ - patch( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, - {} | undefined, - ] - >; - patch( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - patch( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - patch( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - database: request.database ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('patch request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patch response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .patch(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('patch response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates a resource containing information about a database inside a Cloud - * SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be updated in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.update.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Update_async - */ - update( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, - {} | undefined, - ] - >; - update( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - update( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - update( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - database: request.database ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('update request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('update response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .update(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlDatabasesServiceStub && !this._terminated) { - return this.sqlDatabasesServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client_config.json deleted file mode 100644 index 21a09f6de4ff..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_client_config.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlDatabasesService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Delete": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Patch": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Update": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_databases_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts deleted file mode 100644 index 2ada4fa5a4c1..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts +++ /dev/null @@ -1,671 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_flags_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_flags_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta4 - */ -export class SqlFlagsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlFlagsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlFlagsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlFlagsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlFlagsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlFlagsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlFlagsServiceStub) { - return this.sqlFlagsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlFlagsService. - this.sqlFlagsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlFlagsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlFlagsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlFlagsServiceStubMethods = ['list']; - for (const methodName of sqlFlagsServiceStubMethods) { - const callPromise = this.sqlFlagsServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlFlagsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Lists all available database flags for Cloud SQL instances. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.databaseVersion - * Database type and version you want to retrieve flags for. By default, this - * method returns flags for all database types and versions. - * @param {google.cloud.sql.v1beta4.SqlFlagScope} [request.flagScope] - * Optional. Specify the scope of flags to be returned by SqlFlagsListService. - * Return list of database flags if unspecified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.FlagsListResponse|FlagsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_flags_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlFlagsService_List_async - */ - list( - request?: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlFlagsServiceStub && !this._terminated) { - return this.sqlFlagsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client_config.json deleted file mode 100644 index 55a4437b0a0f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_client_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlFlagsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_flags_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client.ts deleted file mode 100644 index 17b3569e3d57..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client.ts +++ /dev/null @@ -1,487 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_iam_policies_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_iam_policies_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for providing IAM Meta APIs for Cloud SQL. - * @class - * @memberof v1beta4 - */ -export class SqlIamPoliciesServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlIamPoliciesServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlIamPoliciesServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlIamPoliciesServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this - .constructor as typeof SqlIamPoliciesServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlIamPoliciesService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlIamPoliciesServiceStub) { - return this.sqlIamPoliciesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlIamPoliciesService. - this.sqlIamPoliciesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlIamPoliciesService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlIamPoliciesService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - return this.sqlIamPoliciesServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return []; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlIamPoliciesServiceStub && !this._terminated) { - return this.sqlIamPoliciesServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client_config.json deleted file mode 100644 index 8db77c020b9e..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_client_config.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlIamPoliciesService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": {} - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_iam_policies_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts deleted file mode 100644 index a487606fd449..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts +++ /dev/null @@ -1,6945 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_instances_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_instances_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta4 - */ -export class SqlInstancesServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlInstancesServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlInstancesServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlInstancesServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlInstancesServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlInstancesService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlInstancesServiceStub) { - return this.sqlInstancesServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlInstancesService. - this.sqlInstancesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlInstancesService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlInstancesService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlInstancesServiceStubMethods = [ - 'addServerCa', - 'addServerCertificate', - 'addEntraIdCertificate', - 'clone', - 'delete', - 'demoteMaster', - 'demote', - 'export', - 'failover', - 'reencrypt', - 'get', - 'import', - 'insert', - 'list', - 'listServerCas', - 'listServerCertificates', - 'listEntraIdCertificates', - 'patch', - 'promoteReplica', - 'switchover', - 'resetSslConfig', - 'restart', - 'restoreBackup', - 'rotateServerCa', - 'rotateServerCertificate', - 'rotateEntraIdCertificate', - 'startReplica', - 'stopReplica', - 'truncateLog', - 'update', - 'createEphemeral', - 'rescheduleMaintenance', - 'verifyExternalSyncSettings', - 'startExternalSync', - 'performDiskShrink', - 'getDiskShrinkConfig', - 'resetReplicaSize', - 'getLatestRecoveryTime', - 'executeSql', - 'acquireSsrsLease', - 'releaseSsrsLease', - 'preCheckMajorVersionUpgrade', - 'pointInTimeRestore', - ]; - for (const methodName of sqlInstancesServiceStubMethods) { - const callPromise = this.sqlInstancesServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlInstancesServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Add a new trusted Certificate Authority (CA) version for the specified - * instance. Required to prepare for a certificate rotation. If a CA version - * was previously added but never used in a certificate rotation, this - * operation replaces that version. There cannot be more than one CA version - * waiting to be rotated in. For instances that have enabled Certificate - * Authority Service (CAS) based server CA, use AddServerCertificate to add a - * new server certificate. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.add_server_ca.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddServerCa_async - */ - addServerCa( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest - | undefined - ), - {} | undefined, - ] - >; - addServerCa( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addServerCa( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addServerCa( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('addServerCa request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('addServerCa response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .addServerCa(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('addServerCa response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Add a new trusted server certificate version for the specified instance - * using Certificate Authority Service (CAS) server CA. Required to prepare - * for a certificate rotation. If a server certificate version was previously - * added but never used in a certificate rotation, this operation replaces - * that version. There cannot be more than one certificate version waiting to - * be rotated in. For instances not using CAS server CA, use AddServerCa - * instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.add_server_certificate.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddServerCertificate_async - */ - addServerCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest - | undefined - ), - {} | undefined, - ] - >; - addServerCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addServerCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addServerCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('addServerCertificate request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('addServerCertificate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .addServerCertificate(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('addServerCertificate response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Adds a new Entra ID certificate for the specified instance. If an Entra ID - * certificate was previously added but never used in a certificate rotation, - * this operation replaces that version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddEntraIdCertificate_async - */ - addEntraIdCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ] - >; - addEntraIdCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addEntraIdCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - addEntraIdCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('addEntraIdCertificate request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('addEntraIdCertificate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .addEntraIdCertificate(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('addEntraIdCertificate response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates a Cloud SQL instance as a clone of the source instance. Using this - * operation might cause your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * The ID of the Cloud SQL instance to be cloned (source). This does not - * include the project ID. - * @param {string} request.project - * Project ID of the source as well as the clone Cloud SQL instance. - * @param {google.cloud.sql.v1beta4.InstancesCloneRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.clone.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Clone_async - */ - clone( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest | undefined, - {} | undefined, - ] - >; - clone( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - clone( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - clone( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('clone request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('clone response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .clone(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest | undefined, - {} | undefined, - ]) => { - this._log.info('clone response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Deletes a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be deleted. - * @param {boolean} request.enableFinalBackup - * Flag to opt-in for final backup. By default, it is turned off. - * @param {number} [request.finalBackupTtlDays] - * Optional. Retention period of the final backup. - * @param {google.protobuf.Timestamp} [request.finalBackupExpiryTime] - * Optional. Final Backup expiration time. - * Timestamp in UTC of when this resource is considered expired. - * @param {string} [request.finalBackupDescription] - * Optional. The description of the final backup. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.delete.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Delete_async - */ - delete( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest | undefined, - {} | undefined, - ] - >; - delete( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - delete( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - delete( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('delete request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('delete response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .delete(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Demotes the stand-alone instance to be a Cloud SQL read replica for an - * external database server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance name. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.demote_master.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_DemoteMaster_async - */ - demoteMaster( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest - | undefined - ), - {} | undefined, - ] - >; - demoteMaster( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - demoteMaster( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - demoteMaster( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('demoteMaster request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('demoteMaster response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .demoteMaster(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('demoteMaster response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Demotes an existing standalone instance to be a Cloud SQL read replica - * for an external database server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. The name of the Cloud SQL instance. - * @param {string} request.project - * Required. The project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesDemoteRequest} request.body - * The request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.demote.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Demote_async - */ - demote( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest | undefined, - {} | undefined, - ] - >; - demote( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - demote( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - demote( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('demote request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('demote response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .demote(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('demote response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL - * dump or CSV file. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * The Cloud SQL instance ID. This doesn't include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be exported. - * @param {google.cloud.sql.v1beta4.InstancesExportRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.export.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Export_async - */ - export( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest | undefined, - {} | undefined, - ] - >; - export( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - export( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - export( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('export request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('export response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .export(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('export response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Initiates a manual failover of a high availability (HA) primary instance - * to a standby instance, which becomes the primary instance. Users are - * then rerouted to the new primary. For more information, see the - * [Overview of high - * availability](https://cloud.google.com/sql/docs/mysql/high-availability) - * page in the Cloud SQL documentation. - * If using Legacy HA (MySQL only), this causes the instance to failover to - * its failover replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {google.cloud.sql.v1beta4.InstancesFailoverRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.failover.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Failover_async - */ - failover( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest | undefined, - {} | undefined, - ] - >; - failover( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - failover( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - failover( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('failover request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('failover response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .failover(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('failover response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Reencrypt CMEK instance with latest key version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesReencryptRequest} request.body - * Reencrypt body that users request - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.reencrypt.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Reencrypt_async - */ - reencrypt( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest | undefined, - {} | undefined, - ] - >; - reencrypt( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - reencrypt( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - reencrypt( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('reencrypt request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('reencrypt response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .reencrypt(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('reencrypt response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a resource containing information about a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.DatabaseInstance|DatabaseInstance}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Imports data into a Cloud SQL instance from a SQL dump or CSV file in - * Cloud Storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesImportRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.import.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Import_async - */ - import( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest | undefined, - {} | undefined, - ] - >; - import( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - import( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - import( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('import request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('import response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .import(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('import response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates a new Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Project ID of the project to which the newly created Cloud SQL instances - * should belong. - * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.insert.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Insert_async - */ - insert( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest | undefined, - {} | undefined, - ] - >; - insert( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - insert( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - insert( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('insert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .insert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists instances under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. - * The expression is in the form of field:value. For example, - * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per - * their JSON representation, such as 'settings.userLabels.auto_start:true'. - * - * Multiple filter queries are space-separated. For example. - * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each - * expression is an AND expression. However, you can include AND and OR - * expressions explicitly. - * @param {number} request.maxResults - * The maximum number of instances to return. The service may return fewer - * than this value. - * If unspecified, at most 500 instances are returned. - * The maximum value is 1000; values above 1000 are coerced to 1000. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project for which to list Cloud SQL instances. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListResponse|InstancesListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_List_async - */ - list( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all of the trusted Certificate Authorities (CAs) for the specified - * instance. There can be up to three CAs listed: the CA that was used to sign - * the certificate that is currently in use, a CA that has been added but not - * yet used to sign a certificate, and a CA used to sign a certificate that - * has previously rotated out. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse|InstancesListServerCasResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.list_server_cas.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListServerCas_async - */ - listServerCas( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest - | undefined - ), - {} | undefined, - ] - >; - listServerCas( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listServerCas( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listServerCas( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('listServerCas request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listServerCas response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .listServerCas(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('listServerCas response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all versions of server certificates and certificate authorities (CAs) - * for the specified instance. There can be up to three sets of certs listed: - * the certificate that is currently in use, a future that has been added but - * not yet used to sign a certificate, and a certificate that has been rotated - * out. For instances not using Certificate Authority Service (CAS) server CA, - * use ListServerCas instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse|InstancesListServerCertificatesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.list_server_certificates.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListServerCertificates_async - */ - listServerCertificates( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest - | undefined - ), - {} | undefined, - ] - >; - listServerCertificates( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listServerCertificates( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listServerCertificates( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('listServerCertificates request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listServerCertificates response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .listServerCertificates(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('listServerCertificates response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all versions of EntraID certificates for the specified instance. - * There can be up to three sets of certificates listed: the certificate that - * is currently in use, a future that has been added but not yet used to sign - * a certificate, and a certificate that has been rotated out. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse|InstancesListEntraIdCertificatesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListEntraIdCertificates_async - */ - listEntraIdCertificates( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest - | undefined - ), - {} | undefined, - ] - >; - listEntraIdCertificates( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listEntraIdCertificates( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - listEntraIdCertificates( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('listEntraIdCertificates request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('listEntraIdCertificates response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .listEntraIdCertificates(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('listEntraIdCertificates response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Partially updates settings of a Cloud SQL instance by merging the request - * with the current configuration. This method supports patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.patch.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Patch_async - */ - patch( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest | undefined, - {} | undefined, - ] - >; - patch( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - patch( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - patch( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('patch request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('patch response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .patch(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest | undefined, - {} | undefined, - ]) => { - this._log.info('patch response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Promotes the read replica instance to be an independent Cloud SQL - * primary instance. - * Using this operation might cause your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {boolean} request.failover - * Set to true to invoke a replica failover to the DR replica. - * As part of replica failover, the promote operation attempts - * to add the original primary instance as a replica of the promoted - * DR replica when the original primary instance comes back online. - * If set to false or not specified, then the original primary - * instance becomes an independent Cloud SQL primary instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.promote_replica.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PromoteReplica_async - */ - promoteReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest - | undefined - ), - {} | undefined, - ] - >; - promoteReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - promoteReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - promoteReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('promoteReplica request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('promoteReplica response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .promoteReplica(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('promoteReplica response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Switches over from the primary instance to the DR replica - * instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the replica. - * @param {google.protobuf.Duration} [request.dbTimeout] - * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations - * timeout, which is a sum of all database operations. Default value is 10 - * minutes and can be modified to a maximum value of 24 hours. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.switchover.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Switchover_async - */ - switchover( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest - | undefined - ), - {} | undefined, - ] - >; - switchover( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - switchover( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - switchover( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('switchover request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('switchover response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .switchover(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('switchover response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Deletes all client certificates and generates a new server SSL certificate - * for the instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode} [request.mode] - * Optional. Reset SSL mode to use. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ResetSslConfig_async - */ - resetSslConfig( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest - | undefined - ), - {} | undefined, - ] - >; - resetSslConfig( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - resetSslConfig( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - resetSslConfig( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('resetSslConfig request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('resetSslConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .resetSslConfig(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('resetSslConfig response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Restarts a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be restarted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.restart.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Restart_async - */ - restart( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest | undefined, - {} | undefined, - ] - >; - restart( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - restart( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - restart( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('restart request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('restart response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .restart(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('restart response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Restores a backup of a Cloud SQL instance. Using this operation might cause - * your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.restore_backup.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RestoreBackup_async - */ - restoreBackup( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest - | undefined - ), - {} | undefined, - ] - >; - restoreBackup( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - restoreBackup( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - restoreBackup( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('restoreBackup request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('restoreBackup response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .restoreBackup(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('restoreBackup response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Rotates the server certificate to one signed by the Certificate Authority - * (CA) version previously added with the addServerCA method. For instances - * that have enabled Certificate Authority Service (CAS) based server CA, - * use RotateServerCertificate to rotate the server certificate. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCa_async - */ - rotateServerCa( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest - | undefined - ), - {} | undefined, - ] - >; - rotateServerCa( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateServerCa( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateServerCa( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('rotateServerCa request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('rotateServerCa response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .rotateServerCa(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('rotateServerCa response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Rotates the server certificate version to one previously added with the - * addServerCertificate method. For instances not using Certificate Authority - * Service (CAS) server CA, use RotateServerCa instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} request.body - * Required. Rotate server certificate request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCertificate_async - */ - rotateServerCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest - | undefined - ), - {} | undefined, - ] - >; - rotateServerCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateServerCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateServerCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('rotateServerCertificate request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('rotateServerCertificate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .rotateServerCertificate(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('rotateServerCertificate response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Rotates the Entra Id certificate version to one previously added with the - * addEntraIdCertificate method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} request.body - * Required. Rotate Entra ID certificate request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateEntraIdCertificate_async - */ - rotateEntraIdCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ] - >; - rotateEntraIdCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateEntraIdCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rotateEntraIdCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('rotateEntraIdCertificate request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('rotateEntraIdCertificate response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .rotateEntraIdCertificate(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('rotateEntraIdCertificate response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Starts the replication in the read replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.start_replica.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StartReplica_async - */ - startReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest - | undefined - ), - {} | undefined, - ] - >; - startReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - startReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - startReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('startReplica request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('startReplica response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .startReplica(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('startReplica response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Stops the replication in the read replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.stop_replica.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StopReplica_async - */ - stopReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest - | undefined - ), - {} | undefined, - ] - >; - stopReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - stopReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - stopReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('stopReplica request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('stopReplica response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .stopReplica(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('stopReplica response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Truncate MySQL general and slow query log tables - * MySQL only. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the Cloud SQL project. - * @param {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.truncate_log.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_TruncateLog_async - */ - truncateLog( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest - | undefined - ), - {} | undefined, - ] - >; - truncateLog( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - truncateLog( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - truncateLog( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('truncateLog request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('truncateLog response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .truncateLog(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('truncateLog response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates settings of a Cloud SQL instance. Using this operation might cause - * your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.update.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Update_async - */ - update( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest | undefined, - {} | undefined, - ] - >; - update( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - update( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - update( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('update request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('update response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .update(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Generates a short-lived X509 certificate containing the provided public key - * and signed by a private key specific to the target instance. Users may use - * the certificate to authenticate as themselves when connecting to the - * database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the Cloud SQL project. - * @param {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCert|SslCert}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.create_ephemeral.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_CreateEphemeral_async - */ - createEphemeral( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISslCert, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest - | undefined - ), - {} | undefined, - ] - >; - createEphemeral( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - createEphemeral( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - createEphemeral( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISslCert, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('createEphemeral request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('createEphemeral response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .createEphemeral(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISslCert, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('createEphemeral response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Reschedules the maintenance on the given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RescheduleMaintenance_async - */ - rescheduleMaintenance( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest - | undefined - ), - {} | undefined, - ] - >; - rescheduleMaintenance( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rescheduleMaintenance( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - rescheduleMaintenance( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('rescheduleMaintenance request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('rescheduleMaintenance response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .rescheduleMaintenance(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('rescheduleMaintenance response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Verify External primary instance external sync settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {boolean} request.verifyConnectionOnly - * Flag to enable verifying connection only - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode - * External sync mode - * @param {boolean} [request.verifyReplicationOnly] - * Optional. Flag to verify settings required by replication setup only - * @param {google.cloud.sql.v1beta4.MySqlSyncConfig} [request.mysqlSyncConfig] - * Optional. MySQL-specific settings for start external sync. - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - * @param {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} [request.syncParallelLevel] - * Optional. Parallel level for initial data sync. Only applicable for - * PostgreSQL. - * @param {number[]} [request.selectedObjects] - * Optional. Migrate only the specified objects from the source instance. If - * this field is empty, then migrate all objects. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse|SqlInstancesVerifyExternalSyncSettingsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_VerifyExternalSyncSettings_async - */ - verifyExternalSyncSettings( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest - | undefined - ), - {} | undefined, - ] - >; - verifyExternalSyncSettings( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - verifyExternalSyncSettings( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - verifyExternalSyncSettings( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('verifyExternalSyncSettings request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('verifyExternalSyncSettings response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .verifyExternalSyncSettings(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('verifyExternalSyncSettings response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Start External primary instance migration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode - * External sync mode. - * @param {boolean} request.skipVerification - * Whether to skip the verification step (VESS). - * @param {google.cloud.sql.v1beta4.MySqlSyncConfig} request.mysqlSyncConfig - * MySQL-specific settings for start external sync. - * @param {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} [request.syncParallelLevel] - * Optional. Parallel level for initial data sync. Currently only applicable - * for MySQL. - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - * @param {boolean} [request.replicaOverwriteEnabled] - * Optional. MySQL only. True if end-user has confirmed that this SES call - * will wipe replica databases overlapping with the proposed selected_objects. - * If this field is not set and there are both overlapping and additional - * databases proposed, an error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.start_external_sync.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StartExternalSync_async - */ - startExternalSync( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest - | undefined - ), - {} | undefined, - ] - >; - startExternalSync( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - startExternalSync( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - startExternalSync( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('startExternalSync request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('startExternalSync response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .startExternalSync(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('startExternalSync response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Perform Disk Shrink on primary instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.PerformDiskShrinkContext} request.body - * Perform disk shrink context. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PerformDiskShrink_async - */ - performDiskShrink( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest - | undefined - ), - {} | undefined, - ] - >; - performDiskShrink( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - performDiskShrink( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - performDiskShrink( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('performDiskShrink request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('performDiskShrink response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .performDiskShrink(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('performDiskShrink response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Get Disk Shrink Config for a given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse|SqlInstancesGetDiskShrinkConfigResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_GetDiskShrinkConfig_async - */ - getDiskShrinkConfig( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest - | undefined - ), - {} | undefined, - ] - >; - getDiskShrinkConfig( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - getDiskShrinkConfig( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - getDiskShrinkConfig( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('getDiskShrinkConfig request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getDiskShrinkConfig response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getDiskShrinkConfig(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('getDiskShrinkConfig response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Reset Replica Size to primary instance disk size. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.reset_replica_size.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ResetReplicaSize_async - */ - resetReplicaSize( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest - | undefined - ), - {} | undefined, - ] - >; - resetReplicaSize( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - resetReplicaSize( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - resetReplicaSize( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('resetReplicaSize request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('resetReplicaSize response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .resetReplicaSize(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('resetReplicaSize response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Get Latest Recovery Time for a given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.protobuf.Timestamp} request.sourceInstanceDeletionTime - * The timestamp used to identify the time when the source instance is - * deleted. If this instance is deleted, then you must set the timestamp. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse|SqlInstancesGetLatestRecoveryTimeResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_GetLatestRecoveryTime_async - */ - getLatestRecoveryTime( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest - | undefined - ), - {} | undefined, - ] - >; - getLatestRecoveryTime( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - getLatestRecoveryTime( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - getLatestRecoveryTime( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('getLatestRecoveryTime request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('getLatestRecoveryTime response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .getLatestRecoveryTime(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('getLatestRecoveryTime response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Execute SQL statements. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Database instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.ExecuteSqlPayload} request.body - * The request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse|SqlInstancesExecuteSqlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.execute_sql.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ExecuteSql_async - */ - executeSql( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest - | undefined - ), - {} | undefined, - ] - >; - executeSql( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - executeSql( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - executeSql( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('executeSql request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('executeSql response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .executeSql(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('executeSql response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Acquire a lease for the setup of SQL Server Reporting Services (SSRS). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This doesn't include the project ID. It's - * composed of lowercase letters, numbers, and hyphens, and it must start with - * a letter. The total length must be 98 characters or less (Example: - * instance-id). - * @param {string} request.project - * Required. ID of the project that contains the instance (Example: - * project-id). - * @param {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} request.body - * The body for request to acquire an SSRS lease. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse|SqlInstancesAcquireSsrsLeaseResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_async - */ - acquireSsrsLease( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest - | undefined - ), - {} | undefined, - ] - >; - acquireSsrsLease( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - acquireSsrsLease( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - acquireSsrsLease( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('acquireSsrsLease request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('acquireSsrsLease response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .acquireSsrsLease(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('acquireSsrsLease response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Release a lease for the setup of SQL Server Reporting Services (SSRS). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. The Cloud SQL instance ID. This doesn't include the project ID. - * It's composed of lowercase letters, numbers, and hyphens, and it must start - * with a letter. The total length must be 98 characters or less (Example: - * instance-id). - * @param {string} request.project - * Required. The ID of the project that contains the instance (Example: - * project-id). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse|SqlInstancesReleaseSsrsLeaseResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_async - */ - releaseSsrsLease( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest - | undefined - ), - {} | undefined, - ] - >; - releaseSsrsLease( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - releaseSsrsLease( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - releaseSsrsLease( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('releaseSsrsLease request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('releaseSsrsLease response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .releaseSsrsLease(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('releaseSsrsLease response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Execute MVU Pre-checks - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} request.body - * Required. The context for request to perform the pre-check major version - * upgrade operation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async - */ - preCheckMajorVersionUpgrade( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | undefined - ), - {} | undefined, - ] - >; - preCheckMajorVersionUpgrade( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - preCheckMajorVersionUpgrade( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - preCheckMajorVersionUpgrade( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('preCheckMajorVersionUpgrade request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('preCheckMajorVersionUpgrade response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .preCheckMajorVersionUpgrade(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('preCheckMajorVersionUpgrade response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Point in time restore for an instance managed by Google Cloud Backup and - * Disaster Recovery. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where you created this instance. - * Format: projects/{project} - * @param {google.cloud.sql.v1beta4.PointInTimeRestoreContext} request.context - * Required. The context for request to perform a PITR on a Google Cloud - * Backup and Disaster Recovery managed instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PointInTimeRestore_async - */ - pointInTimeRestore( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest - | undefined - ), - {} | undefined, - ] - >; - pointInTimeRestore( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - pointInTimeRestore( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - pointInTimeRestore( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest - | undefined - ), - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - parent: request.parent ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('pointInTimeRestore request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('pointInTimeRestore response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .pointInTimeRestore(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - ( - | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('pointInTimeRestore response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlInstancesServiceStub && !this._terminated) { - return this.sqlInstancesServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client_config.json deleted file mode 100644 index 6ed07a6bbffd..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_client_config.json +++ /dev/null @@ -1,241 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlInstancesService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "AddServerCa": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AddServerCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AddEntraIdCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Clone": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Delete": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DemoteMaster": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Demote": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Export": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Failover": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Reencrypt": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Import": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServerCas": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListServerCertificates": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListEntraIdCertificates": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Patch": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PromoteReplica": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Switchover": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResetSslConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Restart": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RestoreBackup": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RotateServerCa": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RotateServerCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RotateEntraIdCertificate": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartReplica": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StopReplica": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TruncateLog": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Update": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateEphemeral": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "RescheduleMaintenance": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "VerifyExternalSyncSettings": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "StartExternalSync": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PerformDiskShrink": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetDiskShrinkConfig": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ResetReplicaSize": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetLatestRecoveryTime": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ExecuteSql": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AcquireSsrsLease": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ReleaseSsrsLease": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PreCheckMajorVersionUpgrade": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "PointInTimeRestore": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_instances_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts deleted file mode 100644 index ceb1fa381192..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts +++ /dev/null @@ -1,963 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_operations_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_operations_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta4 - */ -export class SqlOperationsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlOperationsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlOperationsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlOperationsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlOperationsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlOperationsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlOperationsServiceStub) { - return this.sqlOperationsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlOperationsService. - this.sqlOperationsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlOperationsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlOperationsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlOperationsServiceStubMethods = ['get', 'list', 'cancel']; - for (const methodName of sqlOperationsServiceStubMethods) { - const callPromise = this.sqlOperationsServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlOperationsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Retrieves an instance operation that has been performed on an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Instance operation ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_operations_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - operation: request.operation ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all instance operations that have been performed on the given Cloud - * SQL instance in the reverse chronological order of the start time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {number} request.maxResults - * Maximum number of operations per response. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.OperationsListResponse|OperationsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_operations_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_List_async - */ - list( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Cancels an instance operation that has been performed on an instance. - * Ordinarily, this method name should be `CancelSqlOperation`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Instance operation ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_operations_service.cancel.js - * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_Cancel_async - */ - cancel( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest | undefined, - {} | undefined, - ] - >; - cancel( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - cancel( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - cancel( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - operation: request.operation ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('cancel request %j', request); - const wrappedCallback: - | Callback< - protos.google.protobuf.IEmpty, - | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('cancel response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .cancel(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - ( - | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest - | undefined - ), - {} | undefined, - ]) => { - this._log.info('cancel response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlOperationsServiceStub && !this._terminated) { - return this.sqlOperationsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client_config.json deleted file mode 100644 index 3386709574c2..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_client_config.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlOperationsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Cancel": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_operations_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts deleted file mode 100644 index aeb3ba6c3aa3..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts +++ /dev/null @@ -1,1097 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_ssl_certs_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_ssl_certs_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta4 - */ -export class SqlSslCertsServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlSslCertsServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlSslCertsServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlSslCertsServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlSslCertsServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlSslCertsService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlSslCertsServiceStub) { - return this.sqlSslCertsServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlSslCertsService. - this.sqlSslCertsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlSslCertsService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlSslCertsService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlSslCertsServiceStubMethods = ['delete', 'get', 'insert', 'list']; - for (const methodName of sqlSslCertsServiceStubMethods) { - const callPromise = this.sqlSslCertsServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlSslCertsServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Deletes the SSL certificate. For First Generation instances, the - * certificate remains valid until the instance is restarted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.sha1Fingerprint - * Sha1 FingerPrint. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_ssl_certs_service.delete.js - * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Delete_async - */ - delete( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest | undefined, - {} | undefined, - ] - >; - delete( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - delete( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - delete( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - sha1_fingerprint: request.sha1Fingerprint ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('delete request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('delete response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .delete(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest | undefined, - {} | undefined, - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a particular SSL certificate. Does not include the private key - * (required for usage). The private key must be saved from the response to - * initial creation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.sha1Fingerprint - * Sha1 FingerPrint. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCert|SslCert}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_ssl_certs_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - sha1_fingerprint: request.sha1Fingerprint ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates an SSL certificate and returns it along with the private key and - * server certificate authority. The new certificate will not be usable until - * the instance is restarted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.SslCertsInsertRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCertsInsertResponse|SslCertsInsertResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_ssl_certs_service.insert.js - * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Insert_async - */ - insert( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest | undefined, - {} | undefined, - ] - >; - insert( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - insert( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - insert( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('insert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .insert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest | undefined, - {} | undefined, - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists all of the current SSL certificates for the instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCertsListResponse|SslCertsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_ssl_certs_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_List_async - */ - list( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest - | null - | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project: string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlSslCertsServiceStub && !this._terminated) { - return this.sqlSslCertsServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client_config.json deleted file mode 100644 index 1b19ca0da53b..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client_config.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlSslCertsService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Delete": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts deleted file mode 100644 index 599f74109a04..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts +++ /dev/null @@ -1,647 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_tiers_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_tiers_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Service for providing machine types (tiers) for Cloud SQL. - * @class - * @memberof v1beta4 - */ -export class SqlTiersServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlTiersServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlTiersServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlTiersServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlTiersServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlTiersService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlTiersServiceStub) { - return this.sqlTiersServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlTiersService. - this.sqlTiersServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlTiersService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlTiersService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlTiersServiceStubMethods = ['list']; - for (const methodName of sqlTiersServiceStubMethods) { - const callPromise = this.sqlTiersServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlTiersServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Lists all available machine types (tiers) for Cloud SQL, for example, - * `db-custom-1-3840`. For related information, see [Pricing](/sql/pricing). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Project ID of the project for which to list tiers. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.TiersListResponse|TiersListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_tiers_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlTiersService_List_async - */ - list( - request?: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.ITiersListResponse, - | protos.google.cloud.sql.v1beta4.ISqlTiersListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.ITiersListResponse, - | protos.google.cloud.sql.v1beta4.ISqlTiersListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlTiersServiceStub && !this._terminated) { - return this.sqlTiersServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client_config.json deleted file mode 100644 index 21ed94c448ef..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_client_config.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlTiersService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_tiers_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client.ts b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client.ts deleted file mode 100644 index 2f95c603fe50..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client.ts +++ /dev/null @@ -1,1200 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type { - Callback, - CallOptions, - Descriptors, - ClientOptions, - LocationsClient, - LocationProtos, -} from 'google-gax'; - -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; - -/** - * Client JSON configuration object, loaded from - * `src/v1beta4/sql_users_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './sql_users_service_client_config.json'; -const version = require('../../../package.json').version; - -/** - * @class - * @memberof v1beta4 - */ -export class SqlUsersServiceClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: { [method: string]: gax.CallSettings }; - private _universeDomain: string; - private _servicePath: string; - private _log = logging.log('sql'); - - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: { [name: string]: Function }; - locationsClient: LocationsClient; - pathTemplates: { [name: string]: gax.PathTemplate }; - sqlUsersServiceStub?: Promise<{ [name: string]: Function }>; - - /** - * Construct an instance of SqlUsersServiceClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new SqlUsersServiceClient({fallback: true}, gax); - * ``` - */ - constructor( - opts?: ClientOptions, - gaxInstance?: typeof gax | typeof gax.fallback, - ) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlUsersServiceClient; - if ( - opts?.universe_domain && - opts?.universeDomain && - opts?.universe_domain !== opts?.universeDomain - ) { - throw new Error( - 'Please set either universe_domain or universeDomain, but not both.', - ); - } - const universeDomainEnvVar = - typeof process === 'object' && typeof process.env === 'object' - ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] - : undefined; - this._universeDomain = - opts?.universeDomain ?? - opts?.universe_domain ?? - universeDomainEnvVar ?? - 'googleapis.com'; - this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = - opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!( - opts?.servicePath || opts?.apiEndpoint - ); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = - opts?.fallback ?? - (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== this._servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = this._gaxGrpc.auth as gax.GoogleAuth; - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = this._servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === this._servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts, - ); - - // Determine the client header string. - const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; - if (typeof process === 'object' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}', - ), - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlUsersService', - gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, - { 'x-goog-api-client': clientHeader.join(' ') }, - ); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.sqlUsersServiceStub) { - return this.sqlUsersServiceStub; - } - - // Put together the "service stub" for - // google.cloud.sql.v1beta4.SqlUsersService. - this.sqlUsersServiceStub = this._gaxGrpc.createStub( - this._opts.fallback - ? (this._protos as protobuf.Root).lookupService( - 'google.cloud.sql.v1beta4.SqlUsersService', - ) - : // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1beta4.SqlUsersService, - this._opts, - this._providedCustomServicePath, - ) as Promise<{ [method: string]: Function }>; - - // Iterate over each of the methods that the service provides - // and create an API call method for each. - const sqlUsersServiceStubMethods = [ - 'delete', - 'get', - 'insert', - 'list', - 'update', - ]; - for (const methodName of sqlUsersServiceStubMethods) { - const callPromise = this.sqlUsersServiceStub.then( - (stub) => - (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error | null | undefined) => () => { - throw err; - }, - ); - - const descriptor = undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback, - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.sqlUsersServiceStub; - } - - /** - * The DNS address for this API service. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static servicePath is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service - same as servicePath. - * @deprecated Use the apiEndpoint method of the client instance. - * @returns {string} The DNS address for this service. - */ - static get apiEndpoint() { - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - process.emitWarning( - 'Static apiEndpoint is deprecated, please use the instance method instead.', - 'DeprecationWarning', - ); - } - return 'sqladmin.googleapis.com'; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - get apiEndpoint() { - return this._servicePath; - } - - get universeDomain() { - return this._universeDomain; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin', - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId( - callback?: Callback, - ): Promise | void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- - /** - * Deletes a user from a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.host - * Host of the user in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * Name of the user in the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_users_service.delete.js - * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Delete_async - */ - delete( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | undefined, - {} | undefined, - ] - >; - delete( - request: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | null | undefined, - {} | null | undefined - >, - ): void; - delete( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('delete request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('delete response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .delete(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | undefined, - {} | undefined, - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Retrieves a resource containing information about a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * User of the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.host - * Host of a user of the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_users_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Get_async - */ - get( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | undefined, - {} | undefined, - ] - >; - get( - request: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | null | undefined, - {} | null | undefined - >, - ): void; - get( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IUser, - | protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - name: request.name ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('get request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IUser, - | protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('get response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .get(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | undefined, - {} | undefined, - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Creates a new user in a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.User} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_users_service.insert.js - * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Insert_async - */ - insert( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | undefined, - {} | undefined, - ] - >; - insert( - request: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | null | undefined, - {} | null | undefined - >, - ): void; - insert( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('insert request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('insert response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .insert(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | undefined, - {} | undefined, - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Lists users in the specified Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.UsersListResponse|UsersListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_users_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlUsersService_List_async - */ - list( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | undefined, - {} | undefined, - ] - >; - list( - request: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | null | undefined, - {} | null | undefined - >, - ): void; - list( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IUsersListResponse, - | protos.google.cloud.sql.v1beta4.ISqlUsersListRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('list request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IUsersListResponse, - | protos.google.cloud.sql.v1beta4.ISqlUsersListRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('list response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .list(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | undefined, - {} | undefined, - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - /** - * Updates an existing user in a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.host] - * Optional. Host of the user in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * Name of the user in the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string[]} [request.databaseRoles] - * Optional. List of database roles to grant to the user. body.database_roles - * will be ignored for update request. - * @param {boolean} [request.revokeExistingRoles] - * Optional. Specifies whether to revoke existing roles that are not present - * in the `database_roles` field. If `false` or unset, the database roles - * specified in `database_roles` are added to the user's existing roles. - * @param {google.cloud.sql.v1beta4.User} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_users_service.update.js - * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Update_async - */ - update( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, - options?: CallOptions, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | undefined, - {} | undefined, - ] - >; - update( - request: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | null | undefined, - {} | null | undefined - >, - ): void; - update( - request: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | null | undefined, - {} | null | undefined - >, - ): void; - update( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, - optionsOrCallback?: - | CallOptions - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | null | undefined, - {} | null | undefined - >, - ): Promise< - [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | undefined, - {} | undefined, - ] - > | void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers['x-goog-request-params'] = - this._gaxModule.routingHeader.fromParams({ - project: request.project ?? '', - instance: request.instance ?? '', - }); - this.initialize().catch((err) => { - throw err; - }); - this._log.info('update request %j', request); - const wrappedCallback: - | Callback< - protos.google.cloud.sql.v1beta4.IOperation, - | protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest - | null - | undefined, - {} | null | undefined - > - | undefined = callback - ? (error, response, options, rawResponse) => { - this._log.info('update response %j', response); - callback!(error, response, options, rawResponse); // We verified callback above. - } - : undefined; - return this.innerApiCalls - .update(request, options, wrappedCallback) - ?.then( - ([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | undefined, - {} | undefined, - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }, - ) - .catch((error: any) => { - if ( - error && - 'statusDetails' in error && - error.statusDetails instanceof Array - ) { - const protos = this._gaxModule.protobuf.Root.fromJSON( - jsonProtos, - ) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray( - error.statusDetails, - protos, - ); - } - throw error; - }); - } - - /** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - /** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions, - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified backup resource name string. - * - * @param {string} project - * @param {string} backup - * @returns {string} Resource name string. - */ - backupPath(project: string, backup: string) { - return this.pathTemplates.backupPathTemplate.render({ - project: project, - backup: backup, - }); - } - - /** - * Parse the project from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the project. - */ - matchProjectFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).project; - } - - /** - * Parse the backup from Backup resource. - * - * @param {string} backupName - * A fully-qualified path representing Backup resource. - * @returns {string} A string representing the backup. - */ - matchBackupFromBackupName(backupName: string) { - return this.pathTemplates.backupPathTemplate.match(backupName).backup; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.sqlUsersServiceStub && !this._terminated) { - return this.sqlUsersServiceStub.then((stub) => { - this._log.info('ending gRPC channel'); - this._terminated = true; - stub.close(); - this.locationsClient.close().catch((err) => { - throw err; - }); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client_config.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client_config.json deleted file mode 100644 index a98c499e5123..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_client_config.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "interfaces": { - "google.cloud.sql.v1beta4.SqlUsersService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "Delete": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Get": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Insert": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "List": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "Update": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_proto_list.json b/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_proto_list.json deleted file mode 100644 index 3d9dcd428e8f..000000000000 --- a/owl-bot-staging/google-cloud-sql/src/v1beta4/sql_users_service_proto_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "../../protos/google/cloud/sql/v1beta4/cloud_sql.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_connect.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_iam_policies.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_resources.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_tiers.proto", - "../../protos/google/cloud/sql/v1beta4/cloud_sql_users.proto" -] diff --git a/owl-bot-staging/google-cloud-sql/system-test/install.ts b/owl-bot-staging/google-cloud-sql/system-test/install.ts deleted file mode 100644 index ccf167042d2e..000000000000 --- a/owl-bot-staging/google-cloud-sql/system-test/install.ts +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - it('TypeScript code', async function () { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync( - './system-test/fixtures/sample/src/index.ts', - ).toString(), - }, - }; - await packNTest(options); - }); - - it('JavaScript code', async function () { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - cjs: readFileSync( - './system-test/fixtures/sample/src/index.js', - ).toString(), - }, - }; - await packNTest(options); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_available_database_versions_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_available_database_versions_service_v1.ts deleted file mode 100644 index f1fdacd93cc1..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_available_database_versions_service_v1.ts +++ /dev/null @@ -1,571 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlavailabledatabaseversionsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlAvailableDatabaseVersionsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlavailabledatabaseversionsserviceModule.v1 - .SqlAvailableDatabaseVersionsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlavailabledatabaseversionsserviceModule.v1 - .SqlAvailableDatabaseVersionsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { universeDomain: 'example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { universe_domain: 'example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { universeDomain: 'configured.example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { universe_domain: 'example.com', universeDomain: 'example.net' }, - ); - }); - }); - - it('has port', () => { - const port = - sqlavailabledatabaseversionsserviceModule.v1 - .SqlAvailableDatabaseVersionsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - fallback: true, - }, - ); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - assert.strictEqual( - client.sqlAvailableDatabaseVersionsServiceStub, - undefined, - ); - await client.initialize(); - assert(client.sqlAvailableDatabaseVersionsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlAvailableDatabaseVersionsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - assert.strictEqual( - client.sqlAvailableDatabaseVersionsServiceStub, - undefined, - ); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqlavailabledatabaseversionsserviceModule.v1.SqlAvailableDatabaseVersionsServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts deleted file mode 100644 index 39a4cbb474bb..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts +++ /dev/null @@ -1,1192 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlbackuprunsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlBackupRunsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = - sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); - await client.initialize(); - assert(client.sqlBackupRunsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlBackupRunsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.delete = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.BackupRun(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.BackupRun(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IBackupRun | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsGetRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.insert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.BackupRunsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.BackupRunsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IBackupRunsListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlBackupRunsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts deleted file mode 100644 index 31018716d40f..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts +++ /dev/null @@ -1,1233 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlbackuprunsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlBackupRunsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient - .servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient - .apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = - sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); - await client.initialize(); - assert(client.sqlBackupRunsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlBackupRunsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.delete = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.BackupRun(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.BackupRun(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IBackupRun | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', - ['id'], - ); - request.id = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.insert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.BackupRunsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.BackupRunsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IBackupRunsListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - - describe('project', async () => { - const fakePath = '/rendered/path/project'; - const expectedParameters = { - project: 'projectValue', - }; - const client = - new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.projectPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath('projectValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1.ts deleted file mode 100644 index e0e3601d826c..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1.ts +++ /dev/null @@ -1,1435 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlbackupsserviceModule from '../src'; - -import { PassThrough } from 'stream'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall( - responses?: ResponseType[], - error?: Error, -) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error - ? sinon.stub().callsArgWith(2, error) - : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { - mockStream.write({}); - }); - } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlBackupsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlbackupsserviceModule.v1.SqlBackupsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlbackupsserviceModule.v1.SqlBackupsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient( - { universeDomain: 'configured.example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlbackupsserviceModule.v1.SqlBackupsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupsServiceStub, undefined); - await client.initialize(); - assert(client.sqlBackupsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlBackupsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.CreateBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.CreateBackupRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.createBackup = stubSimpleCall(expectedResponse); - const [response] = await client.createBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.CreateBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.CreateBackupRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.createBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.CreateBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.CreateBackupRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.CreateBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.CreateBackupRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.createBackup(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Backup(), - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Backup(), - ); - client.innerApiCalls.getBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IBackup | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('updateBackup', () => { - it('invokes updateBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.UpdateBackupRequest(), - ); - request.backup ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.UpdateBackupRequest', - ['backup', 'name'], - ); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); - const [response] = await client.updateBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.UpdateBackupRequest(), - ); - request.backup ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.UpdateBackupRequest', - ['backup', 'name'], - ); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.updateBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackup( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.UpdateBackupRequest(), - ); - request.backup ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.UpdateBackupRequest', - ['backup', 'name'], - ); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.updateBackup(request), expectedError); - const actualRequest = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.UpdateBackupRequest(), - ); - request.backup ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.UpdateBackupRequest', - ['backup', 'name'], - ); - request.backup.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.updateBackup(request), expectedError); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.DeleteBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.DeleteBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.DeleteBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.DeleteBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.deleteBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.DeleteBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.DeleteBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.DeleteBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.DeleteBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.deleteBackup(request), expectedError); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - ]; - client.innerApiCalls.listBackups = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IBackup[] | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - ]; - client.descriptors.page.listBackups.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.sql.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.sql.v1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listBackups, request), - ); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams), - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall( - undefined, - expectedError, - ); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.sql.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.sql.v1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listBackups, request), - ); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams), - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.sql.v1.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( - 0, - ).args[1], - request, - ); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams), - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError, - ); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.sql.v1.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( - 0, - ).args[1], - request, - ); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams), - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - - describe('project', async () => { - const fakePath = '/rendered/path/project'; - const expectedParameters = { - project: 'projectValue', - }; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.projectPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath('projectValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts deleted file mode 100644 index b2fece3336d8..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts +++ /dev/null @@ -1,1483 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlbackupsserviceModule from '../src'; - -import { PassThrough } from 'stream'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubPageStreamingCall( - responses?: ResponseType[], - error?: Error, -) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error - ? sinon.stub().callsArgWith(2, error) - : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { - mockStream.write({}); - }); - } - setImmediate(() => { - mockStream.end(); - }); - } else { - setImmediate(() => { - mockStream.write({}); - }); - setImmediate(() => { - mockStream.end(); - }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlBackupsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupsServiceStub, undefined); - await client.initialize(); - assert(client.sqlBackupsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlBackupsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.CreateBackupRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.createBackup = stubSimpleCall(expectedResponse); - const [response] = await client.createBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup without error using callback', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.CreateBackupRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.createBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.CreateBackupRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createBackup with closed client', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.CreateBackupRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.createBackup(request), expectedError); - }); - }); - - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Backup(), - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup without error using callback', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Backup(), - ); - client.innerApiCalls.getBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IBackup | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getBackup with closed client', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.getBackup(request), expectedError); - }); - }); - - describe('updateBackup', () => { - it('invokes updateBackup without error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), - ); - request.backup ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.UpdateBackupRequest', - ['backup', 'name'], - ); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); - const [response] = await client.updateBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackup without error using callback', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), - ); - request.backup ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.UpdateBackupRequest', - ['backup', 'name'], - ); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.updateBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackup( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackup with error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), - ); - request.backup ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.UpdateBackupRequest', - ['backup', 'name'], - ); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.updateBackup(request), expectedError); - const actualRequest = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.updateBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateBackup with closed client', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), - ); - request.backup ??= {}; - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.UpdateBackupRequest', - ['backup', 'name'], - ); - request.backup.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.updateBackup(request), expectedError); - }); - }); - - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.DeleteBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup without error using callback', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.DeleteBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.deleteBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.DeleteBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.deleteBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteBackup with closed client', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.DeleteBackupRequest', - ['name'], - ); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.deleteBackup(request), expectedError); - }); - }); - - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups without error using callback', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - ]; - client.innerApiCalls.listBackups = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IBackup[] | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackups with error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listBackups as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listBackupsStream without error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - ]; - client.descriptors.page.listBackups.createStream = - stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.sql.v1beta4.Backup[] = []; - stream.on( - 'data', - (response: protos.google.cloud.sql.v1beta4.Backup) => { - responses.push(response); - }, - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listBackups, request), - ); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams), - ); - }); - - it('invokes listBackupsStream with error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall( - undefined, - expectedError, - ); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.sql.v1beta4.Backup[] = []; - stream.on( - 'data', - (response: protos.google.cloud.sql.v1beta4.Backup) => { - responses.push(response); - }, - ); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0) - .calledWith(client.innerApiCalls.listBackups, request), - ); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams), - ); - }); - - it('uses async iteration with listBackups without error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.sql.v1beta4.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( - 0, - ).args[1], - request, - ); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams), - ); - }); - - it('uses async iteration with listBackups with error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.ListBackupsRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall( - undefined, - expectedError, - ); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.sql.v1beta4.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( - 0, - ).args[1], - request, - ); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0) - .args[2].otherArgs.headers[ - 'x-goog-request-params' - ].includes(expectedHeaderRequestParams), - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - - describe('project', async () => { - const fakePath = '/rendered/path/project'; - const expectedParameters = { - project: 'projectValue', - }; - const client = - new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.projectPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath('projectValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1.ts deleted file mode 100644 index b60949338fd6..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1.ts +++ /dev/null @@ -1,841 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlconnectserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlConnectServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlconnectserviceModule.v1.SqlConnectServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlconnectserviceModule.v1.SqlConnectServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlconnectserviceModule.v1.SqlConnectServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient( - { universeDomain: 'configured.example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlconnectserviceModule.v1.SqlConnectServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlConnectServiceStub, undefined); - await client.initialize(); - assert(client.sqlConnectServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlConnectServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlConnectServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getConnectSettings', () => { - it('invokes getConnectSettings without error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetConnectSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetConnectSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.ConnectSettings(), - ); - client.innerApiCalls.getConnectSettings = - stubSimpleCall(expectedResponse); - const [response] = await client.getConnectSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectSettings without error using callback', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetConnectSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetConnectSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.ConnectSettings(), - ); - client.innerApiCalls.getConnectSettings = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnectSettings( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IConnectSettings | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectSettings with error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetConnectSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetConnectSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnectSettings = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.getConnectSettings(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectSettings with closed client', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetConnectSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.GetConnectSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.getConnectSettings(request), expectedError); - }); - }); - - describe('generateEphemeralCert', () => { - it('invokes generateEphemeralCert without error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GenerateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.GenerateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertResponse(), - ); - client.innerApiCalls.generateEphemeralCert = - stubSimpleCall(expectedResponse); - const [response] = await client.generateEphemeralCert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateEphemeralCert without error using callback', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GenerateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.GenerateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertResponse(), - ); - client.innerApiCalls.generateEphemeralCert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateEphemeralCert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateEphemeralCert with error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GenerateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.GenerateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateEphemeralCert = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.generateEphemeralCert(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateEphemeralCert with closed client', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.GenerateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.GenerateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.generateEphemeralCert(request), - expectedError, - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts deleted file mode 100644 index 7a26e7c169f0..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts +++ /dev/null @@ -1,867 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlconnectserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlConnectServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlConnectServiceStub, undefined); - await client.initialize(); - assert(client.sqlConnectServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlConnectServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlConnectServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('getConnectSettings', () => { - it('invokes getConnectSettings without error', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ConnectSettings(), - ); - client.innerApiCalls.getConnectSettings = - stubSimpleCall(expectedResponse); - const [response] = await client.getConnectSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectSettings without error using callback', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ConnectSettings(), - ); - client.innerApiCalls.getConnectSettings = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnectSettings( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IConnectSettings | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectSettings with error', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnectSettings = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.getConnectSettings(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getConnectSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectSettings with closed client', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.getConnectSettings(request), expectedError); - }); - }); - - describe('generateEphemeralCert', () => { - it('invokes generateEphemeralCert without error', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse(), - ); - client.innerApiCalls.generateEphemeralCert = - stubSimpleCall(expectedResponse); - const [response] = await client.generateEphemeralCert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateEphemeralCert without error using callback', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse(), - ); - client.innerApiCalls.generateEphemeralCert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateEphemeralCert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateEphemeralCert with error', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateEphemeralCert = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.generateEphemeralCert(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.generateEphemeralCert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes generateEphemeralCert with closed client', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.generateEphemeralCert(request), - expectedError, - ); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1.ts deleted file mode 100644 index 15097fddb205..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1.ts +++ /dev/null @@ -1,1567 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqldatabasesserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlDatabasesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { universeDomain: 'example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { universe_domain: 'example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - fallback: true, - }, - ); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - assert.strictEqual(client.sqlDatabasesServiceStub, undefined); - await client.initialize(); - assert(client.sqlDatabasesServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlDatabasesServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - assert.strictEqual(client.sqlDatabasesServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.delete = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Database(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Database(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IDatabase | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesGetRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.insert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.DatabasesListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.DatabasesListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IDatabasesListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - - describe('patch', () => { - it('invokes patch without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.patch = stubSimpleCall(expectedResponse); - const [response] = await client.patch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patch( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patch(request), expectedError); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.patch(request), expectedError); - }); - }); - - describe('update', () => { - it('invokes update without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.update = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.update(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts deleted file mode 100644 index 3f9edfa33005..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts +++ /dev/null @@ -1,1575 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqldatabasesserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlDatabasesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient - .servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient - .apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = - sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlDatabasesServiceStub, undefined); - await client.initialize(); - assert(client.sqlDatabasesServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlDatabasesServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlDatabasesServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.delete = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Database(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Database(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IDatabase | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.insert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DatabasesListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DatabasesListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IDatabasesListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - - describe('patch', () => { - it('invokes patch without error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.patch = stubSimpleCall(expectedResponse); - const [response] = await client.patch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch without error using callback', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patch( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patch(request), expectedError); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with closed client', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.patch(request), expectedError); - }); - }); - - describe('update', () => { - it('invokes update without error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update without error using callback', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.update = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with closed client', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', - ['database'], - ); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.update(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - - describe('project', async () => { - const fakePath = '/rendered/path/project'; - const expectedParameters = { - project: 'projectValue', - }; - const client = - new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.projectPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath('projectValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_events_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_events_service_v1.ts deleted file mode 100644 index 798fbaf8fbf6..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_events_service_v1.ts +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqleventsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlEventsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqleventsserviceModule.v1.SqlEventsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqleventsserviceModule.v1.SqlEventsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqleventsserviceModule.v1.SqlEventsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqleventsserviceModule.v1.SqlEventsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlEventsServiceStub, undefined); - await client.initialize(); - assert(client.sqlEventsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlEventsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlEventsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqleventsserviceModule.v1.SqlEventsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts deleted file mode 100644 index b8f469f7bc39..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts +++ /dev/null @@ -1,565 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlfeatureeligibilityserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlFeatureEligibilityServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlfeatureeligibilityserviceModule.v1 - .SqlFeatureEligibilityServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlfeatureeligibilityserviceModule.v1 - .SqlFeatureEligibilityServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { universeDomain: 'example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { universe_domain: 'example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { universeDomain: 'configured.example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { universe_domain: 'example.com', universeDomain: 'example.net' }, - ); - }); - }); - - it('has port', () => { - const port = - sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient - .port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - fallback: true, - }, - ); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - assert.strictEqual(client.sqlFeatureEligibilityServiceStub, undefined); - await client.initialize(); - assert(client.sqlFeatureEligibilityServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlFeatureEligibilityServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - assert.strictEqual(client.sqlFeatureEligibilityServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1.ts deleted file mode 100644 index 09b5fbd0667f..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1.ts +++ /dev/null @@ -1,609 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlflagsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlFlagsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlflagsserviceModule.v1.SqlFlagsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlflagsserviceModule.v1.SqlFlagsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlflagsserviceModule.v1.SqlFlagsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlFlagsServiceStub, undefined); - await client.initialize(); - assert(client.sqlFlagsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlFlagsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlFlagsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlFlagsListRequest(), - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.FlagsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes list without error using callback', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlFlagsListRequest(), - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.FlagsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IFlagsListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes list with error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlFlagsListRequest(), - ); - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - }); - - it('invokes list with closed client', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlFlagsListRequest(), - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts deleted file mode 100644 index 4e37b9e1b3e7..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts +++ /dev/null @@ -1,649 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlflagsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlFlagsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlFlagsServiceStub, undefined); - await client.initialize(); - assert(client.sqlFlagsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlFlagsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlFlagsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.FlagsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes list without error using callback', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.FlagsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IFlagsListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); - - it('invokes list with error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), - ); - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - }); - - it('invokes list with closed client', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - - describe('project', async () => { - const fakePath = '/rendered/path/project'; - const expectedParameters = { - project: 'projectValue', - }; - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.projectPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath('projectValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1.ts deleted file mode 100644 index 23b93b55596e..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1.ts +++ /dev/null @@ -1,541 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqliampoliciesserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlIamPoliciesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient - .servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient - .apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = - sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlIamPoliciesServiceStub, undefined); - await client.initialize(); - assert(client.sqlIamPoliciesServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlIamPoliciesServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlIamPoliciesServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqliampoliciesserviceModule.v1.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1beta4.ts deleted file mode 100644 index ad15ef3ebba1..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_iam_policies_service_v1beta4.ts +++ /dev/null @@ -1,541 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqliampoliciesserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlIamPoliciesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient - .servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient - .apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient( - { universeDomain: 'configured.example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = - sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlIamPoliciesServiceStub, undefined); - await client.initialize(); - assert(client.sqlIamPoliciesServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlIamPoliciesServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlIamPoliciesServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqliampoliciesserviceModule.v1beta4.SqlIamPoliciesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_instance_names_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_instance_names_service_v1.ts deleted file mode 100644 index d801fe23600c..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_instance_names_service_v1.ts +++ /dev/null @@ -1,541 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlinstancenamesserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlInstanceNamesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient - .servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient - .apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = - sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlInstanceNamesServiceStub, undefined); - await client.initialize(); - assert(client.sqlInstanceNamesServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlInstanceNamesServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlInstanceNamesServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqlinstancenamesserviceModule.v1.SqlInstanceNamesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1.ts deleted file mode 100644 index 03dbe2acbf28..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1.ts +++ /dev/null @@ -1,7478 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlinstancesserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlInstancesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlinstancesserviceModule.v1.SqlInstancesServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlinstancesserviceModule.v1.SqlInstancesServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { universeDomain: 'example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { universe_domain: 'example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlinstancesserviceModule.v1.SqlInstancesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - fallback: true, - }, - ); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - assert.strictEqual(client.sqlInstancesServiceStub, undefined); - await client.initialize(); - assert(client.sqlInstancesServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlInstancesServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - assert.strictEqual(client.sqlInstancesServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('addServerCa', () => { - it('invokes addServerCa without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.addServerCa = stubSimpleCall(expectedResponse); - const [response] = await client.addServerCa(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCa without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.addServerCa = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addServerCa( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCa with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addServerCa = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.addServerCa(request), expectedError); - const actualRequest = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCa with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.addServerCa(request), expectedError); - }); - }); - - describe('addServerCertificate', () => { - it('invokes addServerCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.addServerCertificate = - stubSimpleCall(expectedResponse); - const [response] = await client.addServerCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.addServerCertificate = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addServerCertificate( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addServerCertificate = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.addServerCertificate(request), expectedError); - const actualRequest = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.addServerCertificate(request), expectedError); - }); - }); - - describe('addEntraIdCertificate', () => { - it('invokes addEntraIdCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.addEntraIdCertificate = - stubSimpleCall(expectedResponse); - const [response] = await client.addEntraIdCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addEntraIdCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.addEntraIdCertificate = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addEntraIdCertificate( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addEntraIdCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addEntraIdCertificate = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.addEntraIdCertificate(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addEntraIdCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.addEntraIdCertificate(request), - expectedError, - ); - }); - }); - - describe('clone', () => { - it('invokes clone without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCloneRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCloneRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.clone = stubSimpleCall(expectedResponse); - const [response] = await client.clone(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.clone as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clone without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCloneRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCloneRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.clone = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.clone( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.clone as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clone with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCloneRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCloneRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.clone = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.clone(request), expectedError); - const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.clone as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clone with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCloneRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCloneRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.clone(request), expectedError); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.delete = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('demoteMaster', () => { - it('invokes demoteMaster without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.demoteMaster = stubSimpleCall(expectedResponse); - const [response] = await client.demoteMaster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demoteMaster without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.demoteMaster = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.demoteMaster( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demoteMaster with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.demoteMaster = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.demoteMaster(request), expectedError); - const actualRequest = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demoteMaster with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.demoteMaster(request), expectedError); - }); - }); - - describe('demote', () => { - it('invokes demote without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.demote = stubSimpleCall(expectedResponse); - const [response] = await client.demote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demote as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demote without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.demote = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.demote( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demote as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demote with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.demote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.demote(request), expectedError); - const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demote as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demote with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesDemoteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.demote(request), expectedError); - }); - }); - - describe('export', () => { - it('invokes export without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.export = stubSimpleCall(expectedResponse); - const [response] = await client.export(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.export as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes export without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.export = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.export( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.export as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes export with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.export = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.export(request), expectedError); - const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.export as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes export with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.export(request), expectedError); - }); - }); - - describe('failover', () => { - it('invokes failover without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesFailoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesFailoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.failover = stubSimpleCall(expectedResponse); - const [response] = await client.failover(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failover without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesFailoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesFailoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.failover = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.failover( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failover with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesFailoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesFailoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.failover = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.failover(request), expectedError); - const actualRequest = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failover with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesFailoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesFailoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.failover(request), expectedError); - }); - }); - - describe('reencrypt', () => { - it('invokes reencrypt without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReencryptRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReencryptRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.reencrypt = stubSimpleCall(expectedResponse); - const [response] = await client.reencrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reencrypt without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReencryptRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReencryptRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.reencrypt = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reencrypt( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reencrypt with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReencryptRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReencryptRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reencrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reencrypt(request), expectedError); - const actualRequest = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reencrypt with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReencryptRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReencryptRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.reencrypt(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.DatabaseInstance(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.DatabaseInstance(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IDatabaseInstance | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('import', () => { - it('invokes import without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesImportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesImportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.import = stubSimpleCall(expectedResponse); - const [response] = await client.import(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.import as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes import without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesImportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesImportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.import = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.import( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.import as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes import with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesImportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesImportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.import = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.import(request), expectedError); - const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.import as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes import with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesImportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesImportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.import(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.insert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IInstancesListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - - describe('listServerCas', () => { - it('invokes listServerCas without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListServerCasResponse(), - ); - client.innerApiCalls.listServerCas = stubSimpleCall(expectedResponse); - const [response] = await client.listServerCas(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCas without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListServerCasResponse(), - ); - client.innerApiCalls.listServerCas = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerCas( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IInstancesListServerCasResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCas with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerCas = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.listServerCas(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCas with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.listServerCas(request), expectedError); - }); - }); - - describe('listServerCertificates', () => { - it('invokes listServerCertificates without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse(), - ); - client.innerApiCalls.listServerCertificates = - stubSimpleCall(expectedResponse); - const [response] = await client.listServerCertificates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse(), - ); - client.innerApiCalls.listServerCertificates = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerCertificates( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerCertificates = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.listServerCertificates(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.listServerCertificates(request), - expectedError, - ); - }); - }); - - describe('listEntraIdCertificates', () => { - it('invokes listEntraIdCertificates without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse(), - ); - client.innerApiCalls.listEntraIdCertificates = - stubSimpleCall(expectedResponse); - const [response] = await client.listEntraIdCertificates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse(), - ); - client.innerApiCalls.listEntraIdCertificates = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEntraIdCertificates( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEntraIdCertificates = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.listEntraIdCertificates(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.listEntraIdCertificates(request), - expectedError, - ); - }); - }); - - describe('patch', () => { - it('invokes patch without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPatchRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPatchRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.patch = stubSimpleCall(expectedResponse); - const [response] = await client.patch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPatchRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPatchRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patch( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPatchRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPatchRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patch(request), expectedError); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPatchRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPatchRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.patch(request), expectedError); - }); - }); - - describe('promoteReplica', () => { - it('invokes promoteReplica without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.promoteReplica = stubSimpleCall(expectedResponse); - const [response] = await client.promoteReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.promoteReplica = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.promoteReplica( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.promoteReplica = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.promoteReplica(request), expectedError); - const actualRequest = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.promoteReplica(request), expectedError); - }); - }); - - describe('switchover', () => { - it('invokes switchover without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.switchover = stubSimpleCall(expectedResponse); - const [response] = await client.switchover(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.switchover = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.switchover( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.switchover = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.switchover(request), expectedError); - const actualRequest = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.switchover(request), expectedError); - }); - }); - - describe('resetSslConfig', () => { - it('invokes resetSslConfig without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.resetSslConfig = stubSimpleCall(expectedResponse); - const [response] = await client.resetSslConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.resetSslConfig = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetSslConfig( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetSslConfig = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.resetSslConfig(request), expectedError); - const actualRequest = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.resetSslConfig(request), expectedError); - }); - }); - - describe('restart', () => { - it('invokes restart without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestartRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestartRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.restart = stubSimpleCall(expectedResponse); - const [response] = await client.restart(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restart as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestartRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestartRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.restart = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restart( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restart as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestartRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestartRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restart = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.restart(request), expectedError); - const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restart as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestartRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestartRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.restart(request), expectedError); - }); - }); - - describe('restoreBackup', () => { - it('invokes restoreBackup without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.restoreBackup = stubSimpleCall(expectedResponse); - const [response] = await client.restoreBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.restoreBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreBackup( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreBackup = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.restoreBackup(request), expectedError); - const actualRequest = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.restoreBackup(request), expectedError); - }); - }); - - describe('rotateServerCa', () => { - it('invokes rotateServerCa without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.rotateServerCa = stubSimpleCall(expectedResponse); - const [response] = await client.rotateServerCa(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.rotateServerCa = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateServerCa( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateServerCa = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.rotateServerCa(request), expectedError); - const actualRequest = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.rotateServerCa(request), expectedError); - }); - }); - - describe('rotateServerCertificate', () => { - it('invokes rotateServerCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.rotateServerCertificate = - stubSimpleCall(expectedResponse); - const [response] = await client.rotateServerCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.rotateServerCertificate = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateServerCertificate( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateServerCertificate = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.rotateServerCertificate(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.rotateServerCertificate(request), - expectedError, - ); - }); - }); - - describe('rotateEntraIdCertificate', () => { - it('invokes rotateEntraIdCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.rotateEntraIdCertificate = - stubSimpleCall(expectedResponse); - const [response] = await client.rotateEntraIdCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.rotateEntraIdCertificate = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateEntraIdCertificate( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.rotateEntraIdCertificate(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.rotateEntraIdCertificate(request), - expectedError, - ); - }); - }); - - describe('startReplica', () => { - it('invokes startReplica without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.startReplica = stubSimpleCall(expectedResponse); - const [response] = await client.startReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.startReplica = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startReplica( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startReplica = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.startReplica(request), expectedError); - const actualRequest = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.startReplica(request), expectedError); - }); - }); - - describe('stopReplica', () => { - it('invokes stopReplica without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.stopReplica = stubSimpleCall(expectedResponse); - const [response] = await client.stopReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.stopReplica = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopReplica( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopReplica = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.stopReplica(request), expectedError); - const actualRequest = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.stopReplica(request), expectedError); - }); - }); - - describe('truncateLog', () => { - it('invokes truncateLog without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.truncateLog = stubSimpleCall(expectedResponse); - const [response] = await client.truncateLog(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes truncateLog without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.truncateLog = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.truncateLog( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes truncateLog with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.truncateLog = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.truncateLog(request), expectedError); - const actualRequest = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes truncateLog with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.truncateLog(request), expectedError); - }); - }); - - describe('update', () => { - it('invokes update without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.update = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.update(request), expectedError); - }); - }); - - describe('createEphemeral', () => { - it('invokes createEphemeral without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCert(), - ); - client.innerApiCalls.createEphemeral = stubSimpleCall(expectedResponse); - const [response] = await client.createEphemeral(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEphemeral without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCert(), - ); - client.innerApiCalls.createEphemeral = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEphemeral( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ISslCert | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEphemeral with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEphemeral = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.createEphemeral(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEphemeral with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.createEphemeral(request), expectedError); - }); - }); - - describe('rescheduleMaintenance', () => { - it('invokes rescheduleMaintenance without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.rescheduleMaintenance = - stubSimpleCall(expectedResponse); - const [response] = await client.rescheduleMaintenance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.rescheduleMaintenance = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rescheduleMaintenance( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rescheduleMaintenance = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.rescheduleMaintenance(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.rescheduleMaintenance(request), - expectedError, - ); - }); - }); - - describe('verifyExternalSyncSettings', () => { - it('invokes verifyExternalSyncSettings without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse(), - ); - client.innerApiCalls.verifyExternalSyncSettings = - stubSimpleCall(expectedResponse); - const [response] = await client.verifyExternalSyncSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyExternalSyncSettings without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse(), - ); - client.innerApiCalls.verifyExternalSyncSettings = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyExternalSyncSettings( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyExternalSyncSettings with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.verifyExternalSyncSettings(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyExternalSyncSettings with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.verifyExternalSyncSettings(request), - expectedError, - ); - }); - }); - - describe('startExternalSync', () => { - it('invokes startExternalSync without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.startExternalSync = stubSimpleCall(expectedResponse); - const [response] = await client.startExternalSync(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startExternalSync without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.startExternalSync = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startExternalSync( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startExternalSync with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startExternalSync = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.startExternalSync(request), expectedError); - const actualRequest = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startExternalSync with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.startExternalSync(request), expectedError); - }); - }); - - describe('performDiskShrink', () => { - it('invokes performDiskShrink without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.performDiskShrink = stubSimpleCall(expectedResponse); - const [response] = await client.performDiskShrink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes performDiskShrink without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.performDiskShrink = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.performDiskShrink( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes performDiskShrink with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.performDiskShrink = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.performDiskShrink(request), expectedError); - const actualRequest = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes performDiskShrink with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.performDiskShrink(request), expectedError); - }); - }); - - describe('getDiskShrinkConfig', () => { - it('invokes getDiskShrinkConfig without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse(), - ); - client.innerApiCalls.getDiskShrinkConfig = - stubSimpleCall(expectedResponse); - const [response] = await client.getDiskShrinkConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDiskShrinkConfig without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse(), - ); - client.innerApiCalls.getDiskShrinkConfig = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDiskShrinkConfig( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDiskShrinkConfig with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDiskShrinkConfig = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.getDiskShrinkConfig(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDiskShrinkConfig with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.getDiskShrinkConfig(request), expectedError); - }); - }); - - describe('resetReplicaSize', () => { - it('invokes resetReplicaSize without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.resetReplicaSize = stubSimpleCall(expectedResponse); - const [response] = await client.resetReplicaSize(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetReplicaSize without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.resetReplicaSize = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetReplicaSize( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetReplicaSize with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetReplicaSize = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.resetReplicaSize(request), expectedError); - const actualRequest = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetReplicaSize with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.resetReplicaSize(request), expectedError); - }); - }); - - describe('getLatestRecoveryTime', () => { - it('invokes getLatestRecoveryTime without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse(), - ); - client.innerApiCalls.getLatestRecoveryTime = - stubSimpleCall(expectedResponse); - const [response] = await client.getLatestRecoveryTime(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLatestRecoveryTime without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse(), - ); - client.innerApiCalls.getLatestRecoveryTime = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLatestRecoveryTime( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLatestRecoveryTime with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLatestRecoveryTime = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLatestRecoveryTime(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLatestRecoveryTime with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.getLatestRecoveryTime(request), - expectedError, - ); - }); - }); - - describe('executeSql', () => { - it('invokes executeSql without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse(), - ); - client.innerApiCalls.executeSql = stubSimpleCall(expectedResponse); - const [response] = await client.executeSql(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes executeSql without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse(), - ); - client.innerApiCalls.executeSql = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.executeSql( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes executeSql with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.executeSql = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.executeSql(request), expectedError); - const actualRequest = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes executeSql with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.executeSql(request), expectedError); - }); - }); - - describe('acquireSsrsLease', () => { - it('invokes acquireSsrsLease without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse(), - ); - client.innerApiCalls.acquireSsrsLease = stubSimpleCall(expectedResponse); - const [response] = await client.acquireSsrsLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acquireSsrsLease without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse(), - ); - client.innerApiCalls.acquireSsrsLease = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.acquireSsrsLease( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acquireSsrsLease with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.acquireSsrsLease = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.acquireSsrsLease(request), expectedError); - const actualRequest = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acquireSsrsLease with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.acquireSsrsLease(request), expectedError); - }); - }); - - describe('releaseSsrsLease', () => { - it('invokes releaseSsrsLease without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse(), - ); - client.innerApiCalls.releaseSsrsLease = stubSimpleCall(expectedResponse); - const [response] = await client.releaseSsrsLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes releaseSsrsLease without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse(), - ); - client.innerApiCalls.releaseSsrsLease = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.releaseSsrsLease( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes releaseSsrsLease with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.releaseSsrsLease = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.releaseSsrsLease(request), expectedError); - const actualRequest = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes releaseSsrsLease with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.releaseSsrsLease(request), expectedError); - }); - }); - - describe('preCheckMajorVersionUpgrade', () => { - it('invokes preCheckMajorVersionUpgrade without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.preCheckMajorVersionUpgrade = - stubSimpleCall(expectedResponse); - const [response] = await client.preCheckMajorVersionUpgrade(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes preCheckMajorVersionUpgrade without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.preCheckMajorVersionUpgrade = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.preCheckMajorVersionUpgrade( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes preCheckMajorVersionUpgrade with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.preCheckMajorVersionUpgrade(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes preCheckMajorVersionUpgrade with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.preCheckMajorVersionUpgrade(request), - expectedError, - ); - }); - }); - - describe('pointInTimeRestore', () => { - it('invokes pointInTimeRestore without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.pointInTimeRestore = - stubSimpleCall(expectedResponse); - const [response] = await client.pointInTimeRestore(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pointInTimeRestore without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.pointInTimeRestore = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pointInTimeRestore( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pointInTimeRestore with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.pointInTimeRestore = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.pointInTimeRestore(request), expectedError); - const actualRequest = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pointInTimeRestore with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.pointInTimeRestore(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - location: 'locationValue', - backupvault: 'backupvaultValue', - datasource: 'datasourceValue', - backup: 'backupValue', - }; - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath( - 'projectValue', - 'locationValue', - 'backupvaultValue', - 'datasourceValue', - 'backupValue', - ); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, 'locationValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupvaultFromBackupName', () => { - const result = client.matchBackupvaultFromBackupName(fakePath); - assert.strictEqual(result, 'backupvaultValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchDatasourceFromBackupName', () => { - const result = client.matchDatasourceFromBackupName(fakePath); - assert.strictEqual(result, 'datasourceValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - - describe('network', async () => { - const fakePath = '/rendered/path/network'; - const expectedParameters = { - project: 'projectValue', - network: 'networkValue', - }; - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( - { - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }, - ); - await client.initialize(); - client.pathTemplates.networkPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.networkPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath('projectValue', 'networkValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, 'networkValue'); - assert( - (client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts deleted file mode 100644 index 57ac7bbd95ca..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts +++ /dev/null @@ -1,7248 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlinstancesserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlInstancesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient - .servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient - .apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = - sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlInstancesServiceStub, undefined); - await client.initialize(); - assert(client.sqlInstancesServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlInstancesServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlInstancesServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('addServerCa', () => { - it('invokes addServerCa without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.addServerCa = stubSimpleCall(expectedResponse); - const [response] = await client.addServerCa(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCa without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.addServerCa = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addServerCa( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCa with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addServerCa = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.addServerCa(request), expectedError); - const actualRequest = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCa with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.addServerCa(request), expectedError); - }); - }); - - describe('addServerCertificate', () => { - it('invokes addServerCertificate without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.addServerCertificate = - stubSimpleCall(expectedResponse); - const [response] = await client.addServerCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCertificate without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.addServerCertificate = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addServerCertificate( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCertificate with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addServerCertificate = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.addServerCertificate(request), expectedError); - const actualRequest = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCertificate with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.addServerCertificate(request), expectedError); - }); - }); - - describe('addEntraIdCertificate', () => { - it('invokes addEntraIdCertificate without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.addEntraIdCertificate = - stubSimpleCall(expectedResponse); - const [response] = await client.addEntraIdCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addEntraIdCertificate without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.addEntraIdCertificate = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addEntraIdCertificate( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addEntraIdCertificate with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.addEntraIdCertificate = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.addEntraIdCertificate(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.addEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addEntraIdCertificate with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.addEntraIdCertificate(request), - expectedError, - ); - }); - }); - - describe('clone', () => { - it('invokes clone without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.clone = stubSimpleCall(expectedResponse); - const [response] = await client.clone(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.clone as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clone without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.clone = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.clone( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.clone as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clone with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.clone = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.clone(request), expectedError); - const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.clone as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clone with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.clone(request), expectedError); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.delete = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('demoteMaster', () => { - it('invokes demoteMaster without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.demoteMaster = stubSimpleCall(expectedResponse); - const [response] = await client.demoteMaster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demoteMaster without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.demoteMaster = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.demoteMaster( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demoteMaster with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.demoteMaster = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.demoteMaster(request), expectedError); - const actualRequest = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demoteMaster as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demoteMaster with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.demoteMaster(request), expectedError); - }); - }); - - describe('demote', () => { - it('invokes demote without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.demote = stubSimpleCall(expectedResponse); - const [response] = await client.demote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demote as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demote without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.demote = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.demote( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demote as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demote with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.demote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.demote(request), expectedError); - const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.demote as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demote with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.demote(request), expectedError); - }); - }); - - describe('export', () => { - it('invokes export without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.export = stubSimpleCall(expectedResponse); - const [response] = await client.export(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.export as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes export without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.export = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.export( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.export as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes export with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.export = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.export(request), expectedError); - const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.export as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes export with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.export(request), expectedError); - }); - }); - - describe('failover', () => { - it('invokes failover without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.failover = stubSimpleCall(expectedResponse); - const [response] = await client.failover(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failover without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.failover = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.failover( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failover with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.failover = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.failover(request), expectedError); - const actualRequest = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.failover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failover with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.failover(request), expectedError); - }); - }); - - describe('reencrypt', () => { - it('invokes reencrypt without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.reencrypt = stubSimpleCall(expectedResponse); - const [response] = await client.reencrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reencrypt without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.reencrypt = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reencrypt( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reencrypt with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.reencrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reencrypt(request), expectedError); - const actualRequest = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.reencrypt as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reencrypt with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.reencrypt(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DatabaseInstance(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DatabaseInstance(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IDatabaseInstance | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('import', () => { - it('invokes import without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.import = stubSimpleCall(expectedResponse); - const [response] = await client.import(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.import as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes import without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.import = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.import( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.import as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes import with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.import = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.import(request), expectedError); - const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.import as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes import with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.import(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.insert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IInstancesListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - - describe('listServerCas', () => { - it('invokes listServerCas without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse(), - ); - client.innerApiCalls.listServerCas = stubSimpleCall(expectedResponse); - const [response] = await client.listServerCas(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCas without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse(), - ); - client.innerApiCalls.listServerCas = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerCas( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCas with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerCas = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.listServerCas(request), expectedError); - const actualRequest = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCas as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCas with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.listServerCas(request), expectedError); - }); - }); - - describe('listServerCertificates', () => { - it('invokes listServerCertificates without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse(), - ); - client.innerApiCalls.listServerCertificates = - stubSimpleCall(expectedResponse); - const [response] = await client.listServerCertificates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse(), - ); - client.innerApiCalls.listServerCertificates = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerCertificates( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerCertificates = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.listServerCertificates(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listServerCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.listServerCertificates(request), - expectedError, - ); - }); - }); - - describe('listEntraIdCertificates', () => { - it('invokes listEntraIdCertificates without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse(), - ); - client.innerApiCalls.listEntraIdCertificates = - stubSimpleCall(expectedResponse); - const [response] = await client.listEntraIdCertificates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse(), - ); - client.innerApiCalls.listEntraIdCertificates = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEntraIdCertificates( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEntraIdCertificates = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.listEntraIdCertificates(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.listEntraIdCertificates as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.listEntraIdCertificates(request), - expectedError, - ); - }); - }); - - describe('patch', () => { - it('invokes patch without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.patch = stubSimpleCall(expectedResponse); - const [response] = await client.patch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patch( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patch(request), expectedError); - const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.patch as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.patch(request), expectedError); - }); - }); - - describe('promoteReplica', () => { - it('invokes promoteReplica without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.promoteReplica = stubSimpleCall(expectedResponse); - const [response] = await client.promoteReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.promoteReplica = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.promoteReplica( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.promoteReplica = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.promoteReplica(request), expectedError); - const actualRequest = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.promoteReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.promoteReplica(request), expectedError); - }); - }); - - describe('switchover', () => { - it('invokes switchover without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.switchover = stubSimpleCall(expectedResponse); - const [response] = await client.switchover(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.switchover = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.switchover( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.switchover = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.switchover(request), expectedError); - const actualRequest = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.switchover as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.switchover(request), expectedError); - }); - }); - - describe('resetSslConfig', () => { - it('invokes resetSslConfig without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.resetSslConfig = stubSimpleCall(expectedResponse); - const [response] = await client.resetSslConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.resetSslConfig = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetSslConfig( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetSslConfig = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.resetSslConfig(request), expectedError); - const actualRequest = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetSslConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.resetSslConfig(request), expectedError); - }); - }); - - describe('restart', () => { - it('invokes restart without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.restart = stubSimpleCall(expectedResponse); - const [response] = await client.restart(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restart as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.restart = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restart( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restart as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restart = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.restart(request), expectedError); - const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restart as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.restart(request), expectedError); - }); - }); - - describe('restoreBackup', () => { - it('invokes restoreBackup without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.restoreBackup = stubSimpleCall(expectedResponse); - const [response] = await client.restoreBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.restoreBackup = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreBackup( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreBackup = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.restoreBackup(request), expectedError); - const actualRequest = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.restoreBackup as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.restoreBackup(request), expectedError); - }); - }); - - describe('rotateServerCa', () => { - it('invokes rotateServerCa without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.rotateServerCa = stubSimpleCall(expectedResponse); - const [response] = await client.rotateServerCa(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.rotateServerCa = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateServerCa( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateServerCa = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.rotateServerCa(request), expectedError); - const actualRequest = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCa as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.rotateServerCa(request), expectedError); - }); - }); - - describe('rotateServerCertificate', () => { - it('invokes rotateServerCertificate without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.rotateServerCertificate = - stubSimpleCall(expectedResponse); - const [response] = await client.rotateServerCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.rotateServerCertificate = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateServerCertificate( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateServerCertificate = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.rotateServerCertificate(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateServerCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.rotateServerCertificate(request), - expectedError, - ); - }); - }); - - describe('rotateEntraIdCertificate', () => { - it('invokes rotateEntraIdCertificate without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.rotateEntraIdCertificate = - stubSimpleCall(expectedResponse); - const [response] = await client.rotateEntraIdCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.rotateEntraIdCertificate = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateEntraIdCertificate( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.rotateEntraIdCertificate(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rotateEntraIdCertificate as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.rotateEntraIdCertificate(request), - expectedError, - ); - }); - }); - - describe('startReplica', () => { - it('invokes startReplica without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.startReplica = stubSimpleCall(expectedResponse); - const [response] = await client.startReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.startReplica = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startReplica( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startReplica = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.startReplica(request), expectedError); - const actualRequest = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.startReplica(request), expectedError); - }); - }); - - describe('stopReplica', () => { - it('invokes stopReplica without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.stopReplica = stubSimpleCall(expectedResponse); - const [response] = await client.stopReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.stopReplica = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopReplica( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopReplica = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.stopReplica(request), expectedError); - const actualRequest = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.stopReplica as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.stopReplica(request), expectedError); - }); - }); - - describe('truncateLog', () => { - it('invokes truncateLog without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.truncateLog = stubSimpleCall(expectedResponse); - const [response] = await client.truncateLog(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes truncateLog without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.truncateLog = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.truncateLog( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes truncateLog with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.truncateLog = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.truncateLog(request), expectedError); - const actualRequest = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.truncateLog as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes truncateLog with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.truncateLog(request), expectedError); - }); - }); - - describe('update', () => { - it('invokes update without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.update = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.update(request), expectedError); - }); - }); - - describe('createEphemeral', () => { - it('invokes createEphemeral without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCert(), - ); - client.innerApiCalls.createEphemeral = stubSimpleCall(expectedResponse); - const [response] = await client.createEphemeral(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEphemeral without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCert(), - ); - client.innerApiCalls.createEphemeral = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEphemeral( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ISslCert | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEphemeral with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEphemeral = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.createEphemeral(request), expectedError); - const actualRequest = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.createEphemeral as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEphemeral with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.createEphemeral(request), expectedError); - }); - }); - - describe('rescheduleMaintenance', () => { - it('invokes rescheduleMaintenance without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.rescheduleMaintenance = - stubSimpleCall(expectedResponse); - const [response] = await client.rescheduleMaintenance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.rescheduleMaintenance = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rescheduleMaintenance( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.rescheduleMaintenance = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.rescheduleMaintenance(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.rescheduleMaintenance as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.rescheduleMaintenance(request), - expectedError, - ); - }); - }); - - describe('verifyExternalSyncSettings', () => { - it('invokes verifyExternalSyncSettings without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse(), - ); - client.innerApiCalls.verifyExternalSyncSettings = - stubSimpleCall(expectedResponse); - const [response] = await client.verifyExternalSyncSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyExternalSyncSettings without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse(), - ); - client.innerApiCalls.verifyExternalSyncSettings = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyExternalSyncSettings( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyExternalSyncSettings with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.verifyExternalSyncSettings(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.verifyExternalSyncSettings as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyExternalSyncSettings with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.verifyExternalSyncSettings(request), - expectedError, - ); - }); - }); - - describe('startExternalSync', () => { - it('invokes startExternalSync without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.startExternalSync = stubSimpleCall(expectedResponse); - const [response] = await client.startExternalSync(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startExternalSync without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.startExternalSync = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startExternalSync( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startExternalSync with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startExternalSync = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.startExternalSync(request), expectedError); - const actualRequest = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.startExternalSync as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startExternalSync with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.startExternalSync(request), expectedError); - }); - }); - - describe('performDiskShrink', () => { - it('invokes performDiskShrink without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.performDiskShrink = stubSimpleCall(expectedResponse); - const [response] = await client.performDiskShrink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes performDiskShrink without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.performDiskShrink = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.performDiskShrink( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes performDiskShrink with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.performDiskShrink = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.performDiskShrink(request), expectedError); - const actualRequest = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.performDiskShrink as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes performDiskShrink with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.performDiskShrink(request), expectedError); - }); - }); - - describe('getDiskShrinkConfig', () => { - it('invokes getDiskShrinkConfig without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse(), - ); - client.innerApiCalls.getDiskShrinkConfig = - stubSimpleCall(expectedResponse); - const [response] = await client.getDiskShrinkConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDiskShrinkConfig without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse(), - ); - client.innerApiCalls.getDiskShrinkConfig = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDiskShrinkConfig( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDiskShrinkConfig with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDiskShrinkConfig = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.getDiskShrinkConfig(request), expectedError); - const actualRequest = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getDiskShrinkConfig as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDiskShrinkConfig with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.getDiskShrinkConfig(request), expectedError); - }); - }); - - describe('resetReplicaSize', () => { - it('invokes resetReplicaSize without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.resetReplicaSize = stubSimpleCall(expectedResponse); - const [response] = await client.resetReplicaSize(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetReplicaSize without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.resetReplicaSize = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetReplicaSize( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetReplicaSize with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetReplicaSize = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.resetReplicaSize(request), expectedError); - const actualRequest = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.resetReplicaSize as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetReplicaSize with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.resetReplicaSize(request), expectedError); - }); - }); - - describe('getLatestRecoveryTime', () => { - it('invokes getLatestRecoveryTime without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse(), - ); - client.innerApiCalls.getLatestRecoveryTime = - stubSimpleCall(expectedResponse); - const [response] = await client.getLatestRecoveryTime(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLatestRecoveryTime without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse(), - ); - client.innerApiCalls.getLatestRecoveryTime = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLatestRecoveryTime( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLatestRecoveryTime with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLatestRecoveryTime = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLatestRecoveryTime(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.getLatestRecoveryTime as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLatestRecoveryTime with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.getLatestRecoveryTime(request), - expectedError, - ); - }); - }); - - describe('executeSql', () => { - it('invokes executeSql without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse(), - ); - client.innerApiCalls.executeSql = stubSimpleCall(expectedResponse); - const [response] = await client.executeSql(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes executeSql without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse(), - ); - client.innerApiCalls.executeSql = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.executeSql( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes executeSql with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.executeSql = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.executeSql(request), expectedError); - const actualRequest = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.executeSql as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes executeSql with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.executeSql(request), expectedError); - }); - }); - - describe('acquireSsrsLease', () => { - it('invokes acquireSsrsLease without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse(), - ); - client.innerApiCalls.acquireSsrsLease = stubSimpleCall(expectedResponse); - const [response] = await client.acquireSsrsLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acquireSsrsLease without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse(), - ); - client.innerApiCalls.acquireSsrsLease = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.acquireSsrsLease( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acquireSsrsLease with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.acquireSsrsLease = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.acquireSsrsLease(request), expectedError); - const actualRequest = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.acquireSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acquireSsrsLease with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.acquireSsrsLease(request), expectedError); - }); - }); - - describe('releaseSsrsLease', () => { - it('invokes releaseSsrsLease without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse(), - ); - client.innerApiCalls.releaseSsrsLease = stubSimpleCall(expectedResponse); - const [response] = await client.releaseSsrsLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes releaseSsrsLease without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse(), - ); - client.innerApiCalls.releaseSsrsLease = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.releaseSsrsLease( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes releaseSsrsLease with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.releaseSsrsLease = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.releaseSsrsLease(request), expectedError); - const actualRequest = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.releaseSsrsLease as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes releaseSsrsLease with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.releaseSsrsLease(request), expectedError); - }); - }); - - describe('preCheckMajorVersionUpgrade', () => { - it('invokes preCheckMajorVersionUpgrade without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.preCheckMajorVersionUpgrade = - stubSimpleCall(expectedResponse); - const [response] = await client.preCheckMajorVersionUpgrade(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes preCheckMajorVersionUpgrade without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.preCheckMajorVersionUpgrade = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.preCheckMajorVersionUpgrade( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes preCheckMajorVersionUpgrade with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.preCheckMajorVersionUpgrade(request), - expectedError, - ); - const actualRequest = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes preCheckMajorVersionUpgrade with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects( - client.preCheckMajorVersionUpgrade(request), - expectedError, - ); - }); - }); - - describe('pointInTimeRestore', () => { - it('invokes pointInTimeRestore without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.pointInTimeRestore = - stubSimpleCall(expectedResponse); - const [response] = await client.pointInTimeRestore(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pointInTimeRestore without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.pointInTimeRestore = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pointInTimeRestore( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pointInTimeRestore with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.pointInTimeRestore = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects(client.pointInTimeRestore(request), expectedError); - const actualRequest = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.pointInTimeRestore as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pointInTimeRestore with closed client', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', - ['parent'], - ); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.pointInTimeRestore(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - - describe('project', async () => { - const fakePath = '/rendered/path/project'; - const expectedParameters = { - project: 'projectValue', - }; - const client = - new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.projectPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath('projectValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1.ts deleted file mode 100644 index 56b5f9690f63..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1.ts +++ /dev/null @@ -1,979 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqloperationsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlOperationsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqloperationsserviceModule.v1.SqlOperationsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqloperationsserviceModule.v1.SqlOperationsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = - sqloperationsserviceModule.v1.SqlOperationsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlOperationsServiceStub, undefined); - await client.initialize(); - assert(client.sqlOperationsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlOperationsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlOperationsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsGetRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsGetRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsGetRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsGetRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.OperationsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.OperationsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperationsListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - - describe('cancel', () => { - it('invokes cancel without error', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsCancelRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsCancelRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty(), - ); - client.innerApiCalls.cancel = stubSimpleCall(expectedResponse); - const [response] = await client.cancel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancel as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel without error using callback', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsCancelRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsCancelRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty(), - ); - client.innerApiCalls.cancel = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancel( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancel as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel with error', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsCancelRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsCancelRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancel(request), expectedError); - const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancel as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel with closed client', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsCancelRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlOperationsCancelRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.cancel(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts deleted file mode 100644 index 28cc64f3a40a..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts +++ /dev/null @@ -1,1020 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqloperationsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlOperationsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient - .servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient - .apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = - sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlOperationsServiceStub, undefined); - await client.initialize(); - assert(client.sqlOperationsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlOperationsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlOperationsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.OperationsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.OperationsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperationsListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - - describe('cancel', () => { - it('invokes cancel without error', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty(), - ); - client.innerApiCalls.cancel = stubSimpleCall(expectedResponse); - const [response] = await client.cancel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancel as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel without error using callback', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty(), - ); - client.innerApiCalls.cancel = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancel( - request, - ( - err?: Error | null, - result?: protos.google.protobuf.IEmpty | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancel as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel with error', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancel(request), expectedError); - const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.cancel as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel with closed client', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', - ['operation'], - ); - request.operation = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.cancel(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - - describe('project', async () => { - const fakePath = '/rendered/path/project'; - const expectedParameters = { - project: 'projectValue', - }; - const client = - new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.projectPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath('projectValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_regions_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_regions_service_v1.ts deleted file mode 100644 index 9eb1da8081ae..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_regions_service_v1.ts +++ /dev/null @@ -1,520 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlregionsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlRegionsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlregionsserviceModule.v1.SqlRegionsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlregionsserviceModule.v1.SqlRegionsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlregionsserviceModule.v1.SqlRegionsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient( - { universeDomain: 'configured.example.com' }, - ); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlregionsserviceModule.v1.SqlRegionsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlRegionsServiceStub, undefined); - await client.initialize(); - assert(client.sqlRegionsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlRegionsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlRegionsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqlregionsserviceModule.v1.SqlRegionsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts deleted file mode 100644 index 07ac5d56e9e0..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts +++ /dev/null @@ -1,1158 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlsslcertsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlSslCertsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlSslCertsServiceStub, undefined); - await client.initialize(); - assert(client.sqlSslCertsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlSslCertsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlSslCertsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.delete = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCert(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCert(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ISslCert | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsGetRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCertsInsertResponse(), - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCertsInsertResponse(), - ); - client.innerApiCalls.insert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ISslCertsInsertResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCertsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCertsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ISslCertsListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlSslCertsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts deleted file mode 100644 index 7b9549c8daf5..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts +++ /dev/null @@ -1,1231 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlsslcertsserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlSslCertsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = - sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlSslCertsServiceStub, undefined); - await client.initialize(); - assert(client.sqlSslCertsServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlSslCertsServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlSslCertsServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.delete = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCert(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCert(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ISslCert | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', - ['sha1Fingerprint'], - ); - request.sha1Fingerprint = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCertsInsertResponse(), - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCertsInsertResponse(), - ); - client.innerApiCalls.insert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCertsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCertsListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ISslCertsListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - - describe('project', async () => { - const fakePath = '/rendered/path/project'; - const expectedParameters = { - project: 'projectValue', - }; - const client = - new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.projectPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath('projectValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts deleted file mode 100644 index 0f48bbe07820..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts +++ /dev/null @@ -1,653 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqltiersserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlTiersServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqltiersserviceModule.v1.SqlTiersServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqltiersserviceModule.v1.SqlTiersServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqltiersserviceModule.v1.SqlTiersServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqltiersserviceModule.v1.SqlTiersServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlTiersServiceStub, undefined); - await client.initialize(); - assert(client.sqlTiersServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlTiersServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlTiersServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlTiersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlTiersListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.TiersListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlTiersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlTiersListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.TiersListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.ITiersListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlTiersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlTiersListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlTiersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlTiersListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts deleted file mode 100644 index 7eed7f7ae61f..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts +++ /dev/null @@ -1,655 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqltiersserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlTiersServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqltiersserviceModule.v1beta4.SqlTiersServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqltiersserviceModule.v1beta4.SqlTiersServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqltiersserviceModule.v1beta4.SqlTiersServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlTiersServiceStub, undefined); - await client.initialize(); - assert(client.sqlTiersServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlTiersServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlTiersServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlTiersListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.TiersListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlTiersListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.TiersListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.ITiersListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlTiersListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlTiersListRequest', - ['project'], - ); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1.ts deleted file mode 100644 index ffbc06c9fd47..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1.ts +++ /dev/null @@ -1,1285 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlusersserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.SqlUsersServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlusersserviceModule.v1.SqlUsersServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlusersserviceModule.v1.SqlUsersServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlusersserviceModule.v1.SqlUsersServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlusersserviceModule.v1.SqlUsersServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlUsersServiceStub, undefined); - await client.initialize(); - assert(client.sqlUsersServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlUsersServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlUsersServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.delete = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['name'], - ); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.User(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['name'], - ); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.User(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IUser | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['name'], - ); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersGetRequest', - ['name'], - ); - request.name = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.insert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.UsersListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.UsersListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IUsersListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - - describe('update', () => { - it('invokes update without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation(), - ); - client.innerApiCalls.update = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with closed client', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1.SqlUsersUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.update(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts b/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts deleted file mode 100644 index 10439be8e2e5..000000000000 --- a/owl-bot-staging/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts +++ /dev/null @@ -1,1287 +0,0 @@ -// Copyright 2026 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 -// -// https://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 file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { SinonStub } from 'sinon'; -import { describe, it } from 'mocha'; -import * as sqlusersserviceModule from '../src'; - -import { protobuf, LocationProtos } from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON( - require('../protos/protos.json'), -).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = ( - instance.constructor as typeof protobuf.Message - ).toObject(instance as protobuf.Message, { defaults: true }); - return (instance.constructor as typeof protobuf.Message).fromObject( - filledObject, - ) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error - ? sinon.stub().rejects(error) - : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback( - response?: ResponseType, - error?: Error, -) { - return error - ? sinon.stub().callsArgWith(2, error) - : sinon.stub().callsArgWith(2, null, response); -} - -function stubAsyncIterationCall( - responses?: ResponseType[], - error?: Error, -) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({ done: true, value: undefined }); - } - return Promise.resolve({ done: false, value: responses![counter++] }); - }, - }; - }, - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1beta4.SqlUsersServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, 'googleapis.com'); - }); - - if ( - typeof process === 'object' && - typeof process.emitWarning === 'function' - ) { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = - sqlusersserviceModule.v1beta4.SqlUsersServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = - sqlusersserviceModule.v1beta4.SqlUsersServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - universeDomain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - universe_domain: 'example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = - new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - universeDomain: 'configured.example.com', - }); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { - new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - universe_domain: 'example.com', - universeDomain: 'example.net', - }); - }); - }); - - it('has port', () => { - const port = sqlusersserviceModule.v1beta4.SqlUsersServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlUsersServiceStub, undefined); - await client.initialize(); - assert(client.sqlUsersServiceStub); - }); - - it('has close method for the initialized client', (done) => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.initialize().catch((err) => { - throw err; - }); - assert(client.sqlUsersServiceStub); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has close method for the non-initialized client', (done) => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlUsersServiceStub, undefined); - client - .close() - .then(() => { - done(); - }) - .catch((err) => { - throw err; - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); - - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon - .stub() - .callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error | null, projectId?: string | null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.delete = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.delete as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['name'], - ); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.User(), - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['name'], - ); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.User(), - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IUser | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['name'], - ); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.get as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['instance'], - ); - request.instance = defaultValue2; - const defaultValue3 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersGetRequest', - ['name'], - ); - request.name = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.insert = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.insert as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UsersListResponse(), - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UsersListResponse(), - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IUsersListResponse | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) - .args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.list as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersListRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersListRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.list(request), expectedError); - }); - }); - - describe('update', () => { - it('invokes update without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation(), - ); - client.innerApiCalls.update = - stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - ( - err?: Error | null, - result?: protos.google.cloud.sql.v1beta4.IOperation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( - 0, - ).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = ( - client.innerApiCalls.update as SinonStub - ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with closed client', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), - ); - const defaultValue1 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', - ['project'], - ); - request.project = defaultValue1; - const defaultValue2 = getTypeDefaultValue( - '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', - ['instance'], - ); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch((err) => { - throw err; - }); - await assert.rejects(client.update(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ); - client.locationsClient.getLocation = sinon - .stub() - .callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null, - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }, - ); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub).getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall( - undefined, - expectedError, - ); - await assert.rejects( - client.getLocation(request, expectedOptions), - expectedError, - ); - assert( - (client.locationsClient.getLocation as SinonStub) - .getCall(0) - .calledWith(request, expectedOptions, undefined), - ); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location(), - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest(), - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = - stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ).getCall(0).args[1], - request, - ); - assert( - ( - client.locationsClient.descriptors.page.listLocations - .asyncIterate as SinonStub - ) - .getCall(0) - .args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams, - ), - ); - }); - }); - - describe('Path templates', () => { - describe('backup', async () => { - const fakePath = '/rendered/path/backup'; - const expectedParameters = { - project: 'projectValue', - backup: 'backupValue', - }; - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: { client_email: 'bogus', private_key: 'bogus' }, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = sinon - .stub() - .returns(fakePath); - client.pathTemplates.backupPathTemplate.match = sinon - .stub() - .returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath('projectValue', 'backupValue'); - assert.strictEqual(result, fakePath); - assert( - (client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1) - .calledWith(expectedParameters), - ); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, 'projectValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, 'backupValue'); - assert( - (client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1) - .calledWith(fakePath), - ); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-sql/tsconfig.json b/owl-bot-staging/google-cloud-sql/tsconfig.json deleted file mode 100644 index ca73e7bfc824..000000000000 --- a/owl-bot-staging/google-cloud-sql/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2023", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts", - "src/**/*.json", - "samples/**/*.json", - "protos/protos.json" - ] -} diff --git a/owl-bot-staging/google-cloud-sql/webpack.config.js b/owl-bot-staging/google-cloud-sql/webpack.config.js deleted file mode 100644 index 07dc78031d41..000000000000 --- a/owl-bot-staging/google-cloud-sql/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 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 -// -// https://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. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'SqlAvailableDatabaseVersionsService', - filename: './sql-available-database-versions-service.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/google-cloud-sql/.eslintignore b/packages/google-cloud-sql/.eslintignore similarity index 100% rename from owl-bot-staging/google-cloud-sql/.eslintignore rename to packages/google-cloud-sql/.eslintignore diff --git a/owl-bot-staging/google-cloud-sql/.eslintrc.json b/packages/google-cloud-sql/.eslintrc.json similarity index 100% rename from owl-bot-staging/google-cloud-sql/.eslintrc.json rename to packages/google-cloud-sql/.eslintrc.json diff --git a/packages/google-cloud-sql/README.md b/packages/google-cloud-sql/README.md index 41814fd9b839..497b95b405f9 100644 --- a/packages/google-cloud-sql/README.md +++ b/packages/google-cloud-sql/README.md @@ -241,7 +241,7 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages] ## Contributing -Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/CONTRIBUTING.md). +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md). Please note that this `README.md` and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`) @@ -251,7 +251,7 @@ are generated from a central template. Apache Version 2.0 -See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-sql/LICENSE) +See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE) [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [projects]: https://console.cloud.google.com/project diff --git a/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto b/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto index bd71bd065f22..b07e2fa0b118 100644 --- a/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto +++ b/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_instances.proto @@ -481,7 +481,7 @@ message SqlInstancesCloneRequest { // not include the project ID. string instance = 1 [(google.api.field_behavior) = REQUIRED]; - // Required. Project ID of the source as well as the clone Cloud SQL instance. + // Required. Project ID of the source Cloud SQL instance. string project = 2 [(google.api.field_behavior) = REQUIRED]; InstancesCloneRequest body = 100 [(google.api.field_behavior) = REQUIRED]; @@ -1366,6 +1366,20 @@ message PointInTimeRestoreContext { // instance. This value cannot be the same as the preferred_zone field. optional string preferred_secondary_zone = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the instance settings that will be overridden from the + // source instance. This field is only applicable for cross project PITRs. + DatabaseInstance target_instance_settings = 11 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Specifies the instance settings that will be cleared from the + // source instance. This field is only applicable for cross project PITRs. + repeated string target_instance_clear_settings_field_names = 12 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The region of the target instance where the datasource will be + // restored. For example: "us-central1". + optional string region = 13 [(google.api.field_behavior) = OPTIONAL]; } // Binary log coordinates. @@ -2313,7 +2327,7 @@ message ExecuteSqlPayload { // Credentials for the database connection. oneof user_password { - // Optional. When set to true, the API caller identity associated with the + // Optional. When set to `true`, the API caller identity associated with the // request is used for database authentication. The API caller must be an // IAM user in the database. bool auto_iam_authn = 11 [(google.api.field_behavior) = OPTIONAL]; @@ -2510,4 +2524,7 @@ enum SqlSuspensionReason { // The KMS key used by the instance is either revoked or denied access to KMS_KEY_ISSUE = 5; + + // The project is suspended due to abuse detected by Ares. + PROJECT_ABUSE = 8; } diff --git a/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto b/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto index 78da0b646400..4f2fa0a5fc9e 100644 --- a/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto +++ b/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_resources.proto @@ -929,6 +929,24 @@ message PscConfig { // authorized to connect via PSC interface. // format: projects/PROJECT/regions/REGION/networkAttachments/ID string network_attachment_uri = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether PSC DNS automation is enabled for this + // instance. When enabled, Cloud SQL provisions a universal DNS record across + // all networks configured with Private Service Connect (PSC) + // auto-connections. This will default to true for new instances when Private + // Service Connect is enabled. + optional bool psc_auto_dns_enabled = 5 + [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Indicates whether PSC write endpoint DNS automation is enabled + // for this instance. When enabled, Cloud SQL provisions a universal global + // DNS record across all networks configured with Private Service Connect + // (PSC) auto-connections that always points to the cluster primary instance. + // This feature is only supported for Enterprise Plus edition. + // This will default to true for new Enterprise Plus instances when + // `psc_auto_dns_enabled` is enabled. + optional bool psc_write_endpoint_dns_enabled = 6 + [(google.api.field_behavior) = OPTIONAL]; } // Settings for an automatically-setup Private Service Connect consumer endpoint @@ -937,7 +955,7 @@ message PscAutoConnectionConfig { // Optional. This is the project ID of consumer service project of this // consumer endpoint. // - // Optional. This is only applicable if consumer_network is a shared vpc + // This is only applicable if `consumer_network` is a shared VPC // network. string consumer_project = 1 [(google.api.field_behavior) = OPTIONAL]; @@ -1340,6 +1358,9 @@ message Operation { // Creates a Cloud SQL read pool instance. CREATE_READ_POOL = 53; + + // Pre-checks the major version upgrade operation. + PRE_CHECK_MAJOR_VERSION_UPGRADE = 54; } // The status of an operation. @@ -1769,6 +1790,11 @@ message Settings { optional ReadPoolAutoScaleConfig read_pool_auto_scale_config = 48 [(google.api.field_behavior) = OPTIONAL]; + // Optional. Whether the replica is in accelerated mode. This feature is in + // private preview and requires allowlisting to take effect. + google.protobuf.BoolValue accelerated_replica_mode = 49 + [(google.api.field_behavior) = OPTIONAL]; + // Optional. Cloud SQL for MySQL auto-upgrade configuration. When this // parameter is set to true, auto-upgrade is enabled for MySQL 8.0 minor // versions. The MySQL version must be 8.0.35 or higher. @@ -1789,31 +1815,32 @@ message Settings { [(google.api.field_behavior) = OPTIONAL]; } -// Performance Capture configuration. +// Performance capture configuration. message PerformanceCaptureConfig { - // Optional. Enable or disable the Performance Capture feature. + // Optional. Enables or disables the performance capture feature. optional bool enabled = 1 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The time interval in seconds between any two probes. + // Optional. Specifies the interval in seconds between consecutive probes that + // check if any trigger condition thresholds have been reached. optional int32 probing_interval_seconds = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The minimum number of consecutive readings above threshold that - // triggers instance state capture. + // Optional. Specifies the minimum number of consecutive probe threshold that + // triggers performance capture. optional int32 probe_threshold = 3 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The minimum number of server threads running to trigger the - // capture on primary. + // Optional. Specifies the minimum number of MySQL `Threads_running` to + // trigger the performance capture on the primary instance. optional int32 running_threads_threshold = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The minimum number of seconds replica must be lagging behind - // primary to trigger capture on replica. + // Optional. Specifies the minimum number of seconds replica must be lagging + // behind primary instance to trigger the performance capture on replica. optional int32 seconds_behind_source_threshold = 5 [(google.api.field_behavior) = OPTIONAL]; - // Optional. The amount of time in seconds that a transaction needs to have - // been open before the watcher starts recording it. + // Optional. Specifies the amount of time in seconds that a transaction needs + // to have been open before the watcher starts recording it. optional int32 transaction_duration_threshold = 8 [(google.api.field_behavior) = OPTIONAL]; } @@ -2167,6 +2194,9 @@ enum SqlDatabaseVersion { // The database version is PostgreSQL 18. POSTGRES_18 = 557; + // The database version is PostgreSQL 19. + POSTGRES_19 = 684; + // The database version is SQL Server 2019 Standard. SQLSERVER_2019_STANDARD = 26; @@ -2190,6 +2220,15 @@ enum SqlDatabaseVersion { // The database version is SQL Server 2022 Web. SQLSERVER_2022_WEB = 202; + + // The database version is SQL Server 2025 Standard. + SQLSERVER_2025_STANDARD = 549; + + // The database version is SQL Server 2025 Enterprise. + SQLSERVER_2025_ENTERPRISE = 550; + + // The database version is SQL Server 2025 Express. + SQLSERVER_2025_EXPRESS = 551; } // The pricing plan for this instance. diff --git a/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto b/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto index 6a4011084e19..b74de3516d5b 100644 --- a/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto +++ b/packages/google-cloud-sql/protos/google/cloud/sql/v1/cloud_sql_users.proto @@ -19,6 +19,7 @@ package google.cloud.sql.v1; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; import "google/cloud/sql/v1/cloud_sql_resources.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; diff --git a/packages/google-cloud-sql/protos/protos.d.ts b/packages/google-cloud-sql/protos/protos.d.ts index 550fe4464ffc..fa584fd39e4e 100644 --- a/packages/google-cloud-sql/protos/protos.d.ts +++ b/packages/google-cloud-sql/protos/protos.d.ts @@ -4715,6 +4715,12 @@ export namespace google { /** PscConfig networkAttachmentUri */ networkAttachmentUri?: (string|null); + + /** PscConfig pscAutoDnsEnabled */ + pscAutoDnsEnabled?: (boolean|null); + + /** PscConfig pscWriteEndpointDnsEnabled */ + pscWriteEndpointDnsEnabled?: (boolean|null); } /** Represents a PscConfig. */ @@ -4738,6 +4744,12 @@ export namespace google { /** PscConfig networkAttachmentUri. */ public networkAttachmentUri: string; + /** PscConfig pscAutoDnsEnabled. */ + public pscAutoDnsEnabled?: (boolean|null); + + /** PscConfig pscWriteEndpointDnsEnabled. */ + public pscWriteEndpointDnsEnabled?: (boolean|null); + /** * Creates a new PscConfig instance using the specified properties. * @param [properties] Properties to set @@ -6250,7 +6262,8 @@ export namespace google { MANAGE_BACKUP = 50, ENHANCED_BACKUP = 51, REPAIR_READ_POOL = 52, - CREATE_READ_POOL = 53 + CREATE_READ_POOL = 53, + PRE_CHECK_MAJOR_VERSION_UPGRADE = 54 } /** SqlOperationStatus enum. */ @@ -6942,6 +6955,9 @@ export namespace google { /** Settings readPoolAutoScaleConfig */ readPoolAutoScaleConfig?: (google.cloud.sql.v1.IReadPoolAutoScaleConfig|null); + /** Settings acceleratedReplicaMode */ + acceleratedReplicaMode?: (google.protobuf.IBoolValue|null); + /** Settings autoUpgradeEnabled */ autoUpgradeEnabled?: (boolean|null); @@ -7087,6 +7103,9 @@ export namespace google { /** Settings readPoolAutoScaleConfig. */ public readPoolAutoScaleConfig?: (google.cloud.sql.v1.IReadPoolAutoScaleConfig|null); + /** Settings acceleratedReplicaMode. */ + public acceleratedReplicaMode?: (google.protobuf.IBoolValue|null); + /** Settings autoUpgradeEnabled. */ public autoUpgradeEnabled?: (boolean|null); @@ -8556,6 +8575,7 @@ export namespace google { POSTGRES_16 = 272, POSTGRES_17 = 408, POSTGRES_18 = 557, + POSTGRES_19 = 684, SQLSERVER_2019_STANDARD = 26, SQLSERVER_2019_ENTERPRISE = 27, SQLSERVER_2019_EXPRESS = 28, @@ -8563,7 +8583,10 @@ export namespace google { SQLSERVER_2022_STANDARD = 199, SQLSERVER_2022_ENTERPRISE = 200, SQLSERVER_2022_EXPRESS = 201, - SQLSERVER_2022_WEB = 202 + SQLSERVER_2022_WEB = 202, + SQLSERVER_2025_STANDARD = 549, + SQLSERVER_2025_ENTERPRISE = 550, + SQLSERVER_2025_EXPRESS = 551 } /** SqlPricingPlan enum. */ @@ -17756,6 +17779,15 @@ export namespace google { /** PointInTimeRestoreContext preferredSecondaryZone */ preferredSecondaryZone?: (string|null); + + /** PointInTimeRestoreContext targetInstanceSettings */ + targetInstanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** PointInTimeRestoreContext targetInstanceClearSettingsFieldNames */ + targetInstanceClearSettingsFieldNames?: (string[]|null); + + /** PointInTimeRestoreContext region */ + region?: (string|null); } /** Represents a PointInTimeRestoreContext. */ @@ -17788,6 +17820,15 @@ export namespace google { /** PointInTimeRestoreContext preferredSecondaryZone. */ public preferredSecondaryZone?: (string|null); + /** PointInTimeRestoreContext targetInstanceSettings. */ + public targetInstanceSettings?: (google.cloud.sql.v1.IDatabaseInstance|null); + + /** PointInTimeRestoreContext targetInstanceClearSettingsFieldNames. */ + public targetInstanceClearSettingsFieldNames: string[]; + + /** PointInTimeRestoreContext region. */ + public region?: (string|null); + /** * Creates a new PointInTimeRestoreContext instance using the specified properties. * @param [properties] Properties to set @@ -22351,7 +22392,8 @@ export namespace google { BILLING_ISSUE = 2, LEGAL_ISSUE = 3, OPERATIONAL_ISSUE = 4, - KMS_KEY_ISSUE = 5 + KMS_KEY_ISSUE = 5, + PROJECT_ABUSE = 8 } /** Represents a SqlConnectService */ @@ -55223,6 +55265,9 @@ export namespace google { /** CommonLanguageSettings destinations */ destinations?: (google.api.ClientLibraryDestination[]|null); + + /** CommonLanguageSettings selectiveGapicGeneration */ + selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); } /** Represents a CommonLanguageSettings. */ @@ -55240,6 +55285,9 @@ export namespace google { /** CommonLanguageSettings destinations. */ public destinations: google.api.ClientLibraryDestination[]; + /** CommonLanguageSettings selectiveGapicGeneration. */ + public selectiveGapicGeneration?: (google.api.ISelectiveGapicGeneration|null); + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @param [properties] Properties to set @@ -55940,6 +55988,9 @@ export namespace google { /** PythonSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** PythonSettings experimentalFeatures */ + experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); } /** Represents a PythonSettings. */ @@ -55954,6 +56005,9 @@ export namespace google { /** PythonSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** PythonSettings experimentalFeatures. */ + public experimentalFeatures?: (google.api.PythonSettings.IExperimentalFeatures|null); + /** * Creates a new PythonSettings instance using the specified properties. * @param [properties] Properties to set @@ -56032,6 +56086,118 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + namespace PythonSettings { + + /** Properties of an ExperimentalFeatures. */ + interface IExperimentalFeatures { + + /** ExperimentalFeatures restAsyncIoEnabled */ + restAsyncIoEnabled?: (boolean|null); + + /** ExperimentalFeatures protobufPythonicTypesEnabled */ + protobufPythonicTypesEnabled?: (boolean|null); + + /** ExperimentalFeatures unversionedPackageDisabled */ + unversionedPackageDisabled?: (boolean|null); + } + + /** Represents an ExperimentalFeatures. */ + class ExperimentalFeatures implements IExperimentalFeatures { + + /** + * Constructs a new ExperimentalFeatures. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.PythonSettings.IExperimentalFeatures); + + /** ExperimentalFeatures restAsyncIoEnabled. */ + public restAsyncIoEnabled: boolean; + + /** ExperimentalFeatures protobufPythonicTypesEnabled. */ + public protobufPythonicTypesEnabled: boolean; + + /** ExperimentalFeatures unversionedPackageDisabled. */ + public unversionedPackageDisabled: boolean; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @param [properties] Properties to set + * @returns ExperimentalFeatures instance + */ + public static create(properties?: google.api.PythonSettings.IExperimentalFeatures): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @param message ExperimentalFeatures message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.PythonSettings.IExperimentalFeatures, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Verifies an ExperimentalFeatures message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExperimentalFeatures + */ + public static fromObject(object: { [k: string]: any }): google.api.PythonSettings.ExperimentalFeatures; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @param message ExperimentalFeatures + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.PythonSettings.ExperimentalFeatures, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExperimentalFeatures + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + } + /** Properties of a NodeSettings. */ interface INodeSettings { @@ -56358,6 +56524,9 @@ export namespace google { /** GoSettings common */ common?: (google.api.ICommonLanguageSettings|null); + + /** GoSettings renamedServices */ + renamedServices?: ({ [k: string]: string }|null); } /** Represents a GoSettings. */ @@ -56372,6 +56541,9 @@ export namespace google { /** GoSettings common. */ public common?: (google.api.ICommonLanguageSettings|null); + /** GoSettings renamedServices. */ + public renamedServices: { [k: string]: string }; + /** * Creates a new GoSettings instance using the specified properties. * @param [properties] Properties to set @@ -56696,6 +56868,109 @@ export namespace google { PACKAGE_MANAGER = 20 } + /** Properties of a SelectiveGapicGeneration. */ + interface ISelectiveGapicGeneration { + + /** SelectiveGapicGeneration methods */ + methods?: (string[]|null); + + /** SelectiveGapicGeneration generateOmittedAsInternal */ + generateOmittedAsInternal?: (boolean|null); + } + + /** Represents a SelectiveGapicGeneration. */ + class SelectiveGapicGeneration implements ISelectiveGapicGeneration { + + /** + * Constructs a new SelectiveGapicGeneration. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ISelectiveGapicGeneration); + + /** SelectiveGapicGeneration methods. */ + public methods: string[]; + + /** SelectiveGapicGeneration generateOmittedAsInternal. */ + public generateOmittedAsInternal: boolean; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @param [properties] Properties to set + * @returns SelectiveGapicGeneration instance + */ + public static create(properties?: google.api.ISelectiveGapicGeneration): google.api.SelectiveGapicGeneration; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @param message SelectiveGapicGeneration message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ISelectiveGapicGeneration, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.SelectiveGapicGeneration; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.SelectiveGapicGeneration; + + /** + * Verifies a SelectiveGapicGeneration message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns SelectiveGapicGeneration + */ + public static fromObject(object: { [k: string]: any }): google.api.SelectiveGapicGeneration; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @param message SelectiveGapicGeneration + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.SelectiveGapicGeneration, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** LaunchStage enum. */ enum LaunchStage { LAUNCH_STAGE_UNSPECIFIED = 0, @@ -56978,6 +57253,9 @@ export namespace google { /** FieldInfo format */ format?: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format|null); + + /** FieldInfo referencedTypes */ + referencedTypes?: (google.api.ITypeReference[]|null); } /** Represents a FieldInfo. */ @@ -56992,6 +57270,9 @@ export namespace google { /** FieldInfo format. */ public format: (google.api.FieldInfo.Format|keyof typeof google.api.FieldInfo.Format); + /** FieldInfo referencedTypes. */ + public referencedTypes: google.api.ITypeReference[]; + /** * Creates a new FieldInfo instance using the specified properties. * @param [properties] Properties to set @@ -57081,6 +57362,103 @@ export namespace google { IPV4_OR_IPV6 = 4 } } + + /** Properties of a TypeReference. */ + interface ITypeReference { + + /** TypeReference typeName */ + typeName?: (string|null); + } + + /** Represents a TypeReference. */ + class TypeReference implements ITypeReference { + + /** + * Constructs a new TypeReference. + * @param [properties] Properties to set + */ + constructor(properties?: google.api.ITypeReference); + + /** TypeReference typeName. */ + public typeName: string; + + /** + * Creates a new TypeReference instance using the specified properties. + * @param [properties] Properties to set + * @returns TypeReference instance + */ + public static create(properties?: google.api.ITypeReference): google.api.TypeReference; + + /** + * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @param message TypeReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @param message TypeReference message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.api.ITypeReference, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a TypeReference message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.api.TypeReference; + + /** + * Decodes a TypeReference message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.api.TypeReference; + + /** + * Verifies a TypeReference message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a TypeReference message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns TypeReference + */ + public static fromObject(object: { [k: string]: any }): google.api.TypeReference; + + /** + * Creates a plain object from a TypeReference message. Also converts values to other types if specified. + * @param message TypeReference + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.api.TypeReference, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this TypeReference to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for TypeReference + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Namespace protobuf. */ @@ -57186,6 +57564,7 @@ export namespace google { /** Edition enum. */ enum Edition { EDITION_UNKNOWN = 0, + EDITION_LEGACY = 900, EDITION_PROTO2 = 998, EDITION_PROTO3 = 999, EDITION_2023 = 1000, @@ -57216,6 +57595,9 @@ export namespace google { /** FileDescriptorProto weakDependency */ weakDependency?: (number[]|null); + /** FileDescriptorProto optionDependency */ + optionDependency?: (string[]|null); + /** FileDescriptorProto messageType */ messageType?: (google.protobuf.IDescriptorProto[]|null); @@ -57265,6 +57647,9 @@ export namespace google { /** FileDescriptorProto weakDependency. */ public weakDependency: number[]; + /** FileDescriptorProto optionDependency. */ + public optionDependency: string[]; + /** FileDescriptorProto messageType. */ public messageType: google.protobuf.IDescriptorProto[]; @@ -57399,6 +57784,9 @@ export namespace google { /** DescriptorProto reservedName */ reservedName?: (string[]|null); + + /** DescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents a DescriptorProto. */ @@ -57440,6 +57828,9 @@ export namespace google { /** DescriptorProto reservedName. */ public reservedName: string[]; + /** DescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new DescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -58287,6 +58678,9 @@ export namespace google { /** EnumDescriptorProto reservedName */ reservedName?: (string[]|null); + + /** EnumDescriptorProto visibility */ + visibility?: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility|null); } /** Represents an EnumDescriptorProto. */ @@ -58313,6 +58707,9 @@ export namespace google { /** EnumDescriptorProto reservedName. */ public reservedName: string[]; + /** EnumDescriptorProto visibility. */ + public visibility: (google.protobuf.SymbolVisibility|keyof typeof google.protobuf.SymbolVisibility); + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @param [properties] Properties to set @@ -59247,6 +59644,9 @@ export namespace google { /** FieldOptions features */ features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); @@ -59305,6 +59705,9 @@ export namespace google { /** FieldOptions features. */ public features?: (google.protobuf.IFeatureSet|null); + /** FieldOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** FieldOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -59525,6 +59928,121 @@ export namespace google { */ public static getTypeUrl(typeUrlPrefix?: string): string; } + + /** Properties of a FeatureSupport. */ + interface IFeatureSupport { + + /** FeatureSupport editionIntroduced */ + editionIntroduced?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport editionDeprecated */ + editionDeprecated?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + + /** FeatureSupport deprecationWarning */ + deprecationWarning?: (string|null); + + /** FeatureSupport editionRemoved */ + editionRemoved?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); + } + + /** Represents a FeatureSupport. */ + class FeatureSupport implements IFeatureSupport { + + /** + * Constructs a new FeatureSupport. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FieldOptions.IFeatureSupport); + + /** FeatureSupport editionIntroduced. */ + public editionIntroduced: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport editionDeprecated. */ + public editionDeprecated: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** FeatureSupport deprecationWarning. */ + public deprecationWarning: string; + + /** FeatureSupport editionRemoved. */ + public editionRemoved: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @param [properties] Properties to set + * @returns FeatureSupport instance + */ + public static create(properties?: google.protobuf.FieldOptions.IFeatureSupport): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @param message FeatureSupport message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FieldOptions.IFeatureSupport, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Verifies a FeatureSupport message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns FeatureSupport + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FieldOptions.FeatureSupport; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @param message FeatureSupport + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FieldOptions.FeatureSupport, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this FeatureSupport to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for FeatureSupport + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } } /** Properties of an OneofOptions. */ @@ -59763,6 +60281,9 @@ export namespace google { /** EnumValueOptions debugRedact */ debugRedact?: (boolean|null); + /** EnumValueOptions featureSupport */ + featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption */ uninterpretedOption?: (google.protobuf.IUninterpretedOption[]|null); } @@ -59785,6 +60306,9 @@ export namespace google { /** EnumValueOptions debugRedact. */ public debugRedact: boolean; + /** EnumValueOptions featureSupport. */ + public featureSupport?: (google.protobuf.FieldOptions.IFeatureSupport|null); + /** EnumValueOptions uninterpretedOption. */ public uninterpretedOption: google.protobuf.IUninterpretedOption[]; @@ -60374,6 +60898,12 @@ export namespace google { /** FeatureSet jsonFormat */ jsonFormat?: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat|null); + + /** FeatureSet enforceNamingStyle */ + enforceNamingStyle?: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle|null); + + /** FeatureSet defaultSymbolVisibility */ + defaultSymbolVisibility?: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null); } /** Represents a FeatureSet. */ @@ -60403,6 +60933,12 @@ export namespace google { /** FeatureSet jsonFormat. */ public jsonFormat: (google.protobuf.FeatureSet.JsonFormat|keyof typeof google.protobuf.FeatureSet.JsonFormat); + /** FeatureSet enforceNamingStyle. */ + public enforceNamingStyle: (google.protobuf.FeatureSet.EnforceNamingStyle|keyof typeof google.protobuf.FeatureSet.EnforceNamingStyle); + + /** FeatureSet defaultSymbolVisibility. */ + public defaultSymbolVisibility: (google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|keyof typeof google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility); + /** * Creates a new FeatureSet instance using the specified properties. * @param [properties] Properties to set @@ -60525,6 +61061,116 @@ export namespace google { ALLOW = 1, LEGACY_BEST_EFFORT = 2 } + + /** EnforceNamingStyle enum. */ + enum EnforceNamingStyle { + ENFORCE_NAMING_STYLE_UNKNOWN = 0, + STYLE2024 = 1, + STYLE_LEGACY = 2 + } + + /** Properties of a VisibilityFeature. */ + interface IVisibilityFeature { + } + + /** Represents a VisibilityFeature. */ + class VisibilityFeature implements IVisibilityFeature { + + /** + * Constructs a new VisibilityFeature. + * @param [properties] Properties to set + */ + constructor(properties?: google.protobuf.FeatureSet.IVisibilityFeature); + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @param [properties] Properties to set + * @returns VisibilityFeature instance + */ + public static create(properties?: google.protobuf.FeatureSet.IVisibilityFeature): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @param message VisibilityFeature message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.protobuf.FeatureSet.IVisibilityFeature, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Verifies a VisibilityFeature message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns VisibilityFeature + */ + public static fromObject(object: { [k: string]: any }): google.protobuf.FeatureSet.VisibilityFeature; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @param message VisibilityFeature + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.protobuf.FeatureSet.VisibilityFeature, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this VisibilityFeature to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for VisibilityFeature + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + + namespace VisibilityFeature { + + /** DefaultSymbolVisibility enum. */ + enum DefaultSymbolVisibility { + DEFAULT_SYMBOL_VISIBILITY_UNKNOWN = 0, + EXPORT_ALL = 1, + EXPORT_TOP_LEVEL = 2, + LOCAL_ALL = 3, + STRICT = 4 + } + } } /** Properties of a FeatureSetDefaults. */ @@ -60644,8 +61290,11 @@ export namespace google { /** FeatureSetEditionDefault edition */ edition?: (google.protobuf.Edition|keyof typeof google.protobuf.Edition|null); - /** FeatureSetEditionDefault features */ - features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures */ + overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures */ + fixedFeatures?: (google.protobuf.IFeatureSet|null); } /** Represents a FeatureSetEditionDefault. */ @@ -60660,8 +61309,11 @@ export namespace google { /** FeatureSetEditionDefault edition. */ public edition: (google.protobuf.Edition|keyof typeof google.protobuf.Edition); - /** FeatureSetEditionDefault features. */ - public features?: (google.protobuf.IFeatureSet|null); + /** FeatureSetEditionDefault overridableFeatures. */ + public overridableFeatures?: (google.protobuf.IFeatureSet|null); + + /** FeatureSetEditionDefault fixedFeatures. */ + public fixedFeatures?: (google.protobuf.IFeatureSet|null); /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -61194,6 +61846,13 @@ export namespace google { } } + /** SymbolVisibility enum. */ + enum SymbolVisibility { + VISIBILITY_UNSET = 0, + VISIBILITY_LOCAL = 1, + VISIBILITY_EXPORT = 2 + } + /** Properties of a Duration. */ interface IDuration { diff --git a/packages/google-cloud-sql/protos/protos.js b/packages/google-cloud-sql/protos/protos.js index e2514df66382..654b059265f6 100644 --- a/packages/google-cloud-sql/protos/protos.js +++ b/packages/google-cloud-sql/protos/protos.js @@ -1860,6 +1860,7 @@ case 272: case 408: case 557: + case 684: case 26: case 27: case 28: @@ -1868,6 +1869,9 @@ case 200: case 201: case 202: + case 549: + case 550: + case 551: break; } if (message.diskEncryptionConfiguration != null && message.hasOwnProperty("diskEncryptionConfiguration")) { @@ -2203,6 +2207,10 @@ case 557: message.databaseVersion = 557; break; + case "POSTGRES_19": + case 684: + message.databaseVersion = 684; + break; case "SQLSERVER_2019_STANDARD": case 26: message.databaseVersion = 26; @@ -2235,6 +2243,18 @@ case 202: message.databaseVersion = 202; break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.databaseVersion = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.databaseVersion = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.databaseVersion = 551; + break; } if (object.diskEncryptionConfiguration != null) { if (typeof object.diskEncryptionConfiguration !== "object") @@ -4947,6 +4967,7 @@ case 272: case 408: case 557: + case 684: case 26: case 27: case 28: @@ -4955,6 +4976,9 @@ case 200: case 201: case 202: + case 549: + case 550: + case 551: break; } if (message.preCheckResponse != null && message.hasOwnProperty("preCheckResponse")) { @@ -5163,6 +5187,10 @@ case 557: message.targetDatabaseVersion = 557; break; + case "POSTGRES_19": + case 684: + message.targetDatabaseVersion = 684; + break; case "SQLSERVER_2019_STANDARD": case 26: message.targetDatabaseVersion = 26; @@ -5195,6 +5223,18 @@ case 202: message.targetDatabaseVersion = 202; break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.targetDatabaseVersion = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.targetDatabaseVersion = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.targetDatabaseVersion = 551; + break; } if (object.preCheckResponse) { if (!Array.isArray(object.preCheckResponse)) @@ -12912,6 +12952,8 @@ * @property {Array.|null} [allowedConsumerProjects] PscConfig allowedConsumerProjects * @property {Array.|null} [pscAutoConnections] PscConfig pscAutoConnections * @property {string|null} [networkAttachmentUri] PscConfig networkAttachmentUri + * @property {boolean|null} [pscAutoDnsEnabled] PscConfig pscAutoDnsEnabled + * @property {boolean|null} [pscWriteEndpointDnsEnabled] PscConfig pscWriteEndpointDnsEnabled */ /** @@ -12963,6 +13005,22 @@ */ PscConfig.prototype.networkAttachmentUri = ""; + /** + * PscConfig pscAutoDnsEnabled. + * @member {boolean|null|undefined} pscAutoDnsEnabled + * @memberof google.cloud.sql.v1.PscConfig + * @instance + */ + PscConfig.prototype.pscAutoDnsEnabled = null; + + /** + * PscConfig pscWriteEndpointDnsEnabled. + * @member {boolean|null|undefined} pscWriteEndpointDnsEnabled + * @memberof google.cloud.sql.v1.PscConfig + * @instance + */ + PscConfig.prototype.pscWriteEndpointDnsEnabled = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -12972,6 +13030,18 @@ set: $util.oneOfSetter($oneOfFields) }); + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscConfig.prototype, "_pscAutoDnsEnabled", { + get: $util.oneOfGetter($oneOfFields = ["pscAutoDnsEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + + // Virtual OneOf for proto3 optional field + Object.defineProperty(PscConfig.prototype, "_pscWriteEndpointDnsEnabled", { + get: $util.oneOfGetter($oneOfFields = ["pscWriteEndpointDnsEnabled"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new PscConfig instance using the specified properties. * @function create @@ -13006,6 +13076,10 @@ $root.google.cloud.sql.v1.PscAutoConnectionConfig.encode(message.pscAutoConnections[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.networkAttachmentUri != null && Object.hasOwnProperty.call(message, "networkAttachmentUri")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.networkAttachmentUri); + if (message.pscAutoDnsEnabled != null && Object.hasOwnProperty.call(message, "pscAutoDnsEnabled")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.pscAutoDnsEnabled); + if (message.pscWriteEndpointDnsEnabled != null && Object.hasOwnProperty.call(message, "pscWriteEndpointDnsEnabled")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.pscWriteEndpointDnsEnabled); return writer; }; @@ -13062,6 +13136,14 @@ message.networkAttachmentUri = reader.string(); break; } + case 5: { + message.pscAutoDnsEnabled = reader.bool(); + break; + } + case 6: { + message.pscWriteEndpointDnsEnabled = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -13122,6 +13204,16 @@ if (message.networkAttachmentUri != null && message.hasOwnProperty("networkAttachmentUri")) if (!$util.isString(message.networkAttachmentUri)) return "networkAttachmentUri: string expected"; + if (message.pscAutoDnsEnabled != null && message.hasOwnProperty("pscAutoDnsEnabled")) { + properties._pscAutoDnsEnabled = 1; + if (typeof message.pscAutoDnsEnabled !== "boolean") + return "pscAutoDnsEnabled: boolean expected"; + } + if (message.pscWriteEndpointDnsEnabled != null && message.hasOwnProperty("pscWriteEndpointDnsEnabled")) { + properties._pscWriteEndpointDnsEnabled = 1; + if (typeof message.pscWriteEndpointDnsEnabled !== "boolean") + return "pscWriteEndpointDnsEnabled: boolean expected"; + } return null; }; @@ -13158,6 +13250,10 @@ } if (object.networkAttachmentUri != null) message.networkAttachmentUri = String(object.networkAttachmentUri); + if (object.pscAutoDnsEnabled != null) + message.pscAutoDnsEnabled = Boolean(object.pscAutoDnsEnabled); + if (object.pscWriteEndpointDnsEnabled != null) + message.pscWriteEndpointDnsEnabled = Boolean(object.pscWriteEndpointDnsEnabled); return message; }; @@ -13197,6 +13293,16 @@ } if (message.networkAttachmentUri != null && message.hasOwnProperty("networkAttachmentUri")) object.networkAttachmentUri = message.networkAttachmentUri; + if (message.pscAutoDnsEnabled != null && message.hasOwnProperty("pscAutoDnsEnabled")) { + object.pscAutoDnsEnabled = message.pscAutoDnsEnabled; + if (options.oneofs) + object._pscAutoDnsEnabled = "pscAutoDnsEnabled"; + } + if (message.pscWriteEndpointDnsEnabled != null && message.hasOwnProperty("pscWriteEndpointDnsEnabled")) { + object.pscWriteEndpointDnsEnabled = message.pscWriteEndpointDnsEnabled; + if (options.oneofs) + object._pscWriteEndpointDnsEnabled = "pscWriteEndpointDnsEnabled"; + } return object; }; @@ -16733,6 +16839,7 @@ case 51: case 52: case 53: + case 54: break; } if (message.importContext != null && message.hasOwnProperty("importContext")) { @@ -17062,6 +17169,10 @@ case 53: message.operationType = 53; break; + case "PRE_CHECK_MAJOR_VERSION_UPGRADE": + case 54: + message.operationType = 54; + break; } if (object.importContext != null) { if (typeof object.importContext !== "object") @@ -17264,6 +17375,7 @@ * @property {number} ENHANCED_BACKUP=51 ENHANCED_BACKUP value * @property {number} REPAIR_READ_POOL=52 REPAIR_READ_POOL value * @property {number} CREATE_READ_POOL=53 CREATE_READ_POOL value + * @property {number} PRE_CHECK_MAJOR_VERSION_UPGRADE=54 PRE_CHECK_MAJOR_VERSION_UPGRADE value */ Operation.SqlOperationType = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -17319,6 +17431,7 @@ values[valuesById[51] = "ENHANCED_BACKUP"] = 51; values[valuesById[52] = "REPAIR_READ_POOL"] = 52; values[valuesById[53] = "CREATE_READ_POOL"] = 53; + values[valuesById[54] = "PRE_CHECK_MAJOR_VERSION_UPGRADE"] = 54; return values; })(); @@ -18755,6 +18868,7 @@ * @property {google.cloud.sql.v1.IConnectionPoolConfig|null} [connectionPoolConfig] Settings connectionPoolConfig * @property {google.cloud.sql.v1.IFinalBackupConfig|null} [finalBackupConfig] Settings finalBackupConfig * @property {google.cloud.sql.v1.IReadPoolAutoScaleConfig|null} [readPoolAutoScaleConfig] Settings readPoolAutoScaleConfig + * @property {google.protobuf.IBoolValue|null} [acceleratedReplicaMode] Settings acceleratedReplicaMode * @property {boolean|null} [autoUpgradeEnabled] Settings autoUpgradeEnabled * @property {google.cloud.sql.v1.ISqlServerEntraIdConfig|null} [entraidConfig] Settings entraidConfig * @property {google.cloud.sql.v1.Settings.DataApiAccess|null} [dataApiAccess] Settings dataApiAccess @@ -19108,6 +19222,14 @@ */ Settings.prototype.readPoolAutoScaleConfig = null; + /** + * Settings acceleratedReplicaMode. + * @member {google.protobuf.IBoolValue|null|undefined} acceleratedReplicaMode + * @memberof google.cloud.sql.v1.Settings + * @instance + */ + Settings.prototype.acceleratedReplicaMode = null; + /** * Settings autoUpgradeEnabled. * @member {boolean|null|undefined} autoUpgradeEnabled @@ -19295,6 +19417,8 @@ $root.google.cloud.sql.v1.FinalBackupConfig.encode(message.finalBackupConfig, writer.uint32(/* id 47, wireType 2 =*/378).fork()).ldelim(); if (message.readPoolAutoScaleConfig != null && Object.hasOwnProperty.call(message, "readPoolAutoScaleConfig")) $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.encode(message.readPoolAutoScaleConfig, writer.uint32(/* id 48, wireType 2 =*/386).fork()).ldelim(); + if (message.acceleratedReplicaMode != null && Object.hasOwnProperty.call(message, "acceleratedReplicaMode")) + $root.google.protobuf.BoolValue.encode(message.acceleratedReplicaMode, writer.uint32(/* id 49, wireType 2 =*/394).fork()).ldelim(); if (message.autoUpgradeEnabled != null && Object.hasOwnProperty.call(message, "autoUpgradeEnabled")) writer.uint32(/* id 50, wireType 0 =*/400).bool(message.autoUpgradeEnabled); if (message.entraidConfig != null && Object.hasOwnProperty.call(message, "entraidConfig")) @@ -19528,6 +19652,10 @@ message.readPoolAutoScaleConfig = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.decode(reader, reader.uint32()); break; } + case 49: { + message.acceleratedReplicaMode = $root.google.protobuf.BoolValue.decode(reader, reader.uint32()); + break; + } case 50: { message.autoUpgradeEnabled = reader.bool(); break; @@ -19830,6 +19958,11 @@ return "readPoolAutoScaleConfig." + error; } } + if (message.acceleratedReplicaMode != null && message.hasOwnProperty("acceleratedReplicaMode")) { + var error = $root.google.protobuf.BoolValue.verify(message.acceleratedReplicaMode); + if (error) + return "acceleratedReplicaMode." + error; + } if (message.autoUpgradeEnabled != null && message.hasOwnProperty("autoUpgradeEnabled")) { properties._autoUpgradeEnabled = 1; if (typeof message.autoUpgradeEnabled !== "boolean") @@ -20203,6 +20336,11 @@ throw TypeError(".google.cloud.sql.v1.Settings.readPoolAutoScaleConfig: object expected"); message.readPoolAutoScaleConfig = $root.google.cloud.sql.v1.ReadPoolAutoScaleConfig.fromObject(object.readPoolAutoScaleConfig); } + if (object.acceleratedReplicaMode != null) { + if (typeof object.acceleratedReplicaMode !== "object") + throw TypeError(".google.cloud.sql.v1.Settings.acceleratedReplicaMode: object expected"); + message.acceleratedReplicaMode = $root.google.protobuf.BoolValue.fromObject(object.acceleratedReplicaMode); + } if (object.autoUpgradeEnabled != null) message.autoUpgradeEnabled = Boolean(object.autoUpgradeEnabled); if (object.entraidConfig != null) { @@ -20291,6 +20429,7 @@ object.enableGoogleMlIntegration = null; object.enableDataplexIntegration = null; object.retainBackupsOnDelete = null; + object.acceleratedReplicaMode = null; object.entraidConfig = null; object.performanceCaptureConfig = null; } @@ -20410,6 +20549,8 @@ if (options.oneofs) object._readPoolAutoScaleConfig = "readPoolAutoScaleConfig"; } + if (message.acceleratedReplicaMode != null && message.hasOwnProperty("acceleratedReplicaMode")) + object.acceleratedReplicaMode = $root.google.protobuf.BoolValue.toObject(message.acceleratedReplicaMode, options); if (message.autoUpgradeEnabled != null && message.hasOwnProperty("autoUpgradeEnabled")) { object.autoUpgradeEnabled = message.autoUpgradeEnabled; if (options.oneofs) @@ -23955,6 +24096,7 @@ * @property {number} POSTGRES_16=272 POSTGRES_16 value * @property {number} POSTGRES_17=408 POSTGRES_17 value * @property {number} POSTGRES_18=557 POSTGRES_18 value + * @property {number} POSTGRES_19=684 POSTGRES_19 value * @property {number} SQLSERVER_2019_STANDARD=26 SQLSERVER_2019_STANDARD value * @property {number} SQLSERVER_2019_ENTERPRISE=27 SQLSERVER_2019_ENTERPRISE value * @property {number} SQLSERVER_2019_EXPRESS=28 SQLSERVER_2019_EXPRESS value @@ -23963,6 +24105,9 @@ * @property {number} SQLSERVER_2022_ENTERPRISE=200 SQLSERVER_2022_ENTERPRISE value * @property {number} SQLSERVER_2022_EXPRESS=201 SQLSERVER_2022_EXPRESS value * @property {number} SQLSERVER_2022_WEB=202 SQLSERVER_2022_WEB value + * @property {number} SQLSERVER_2025_STANDARD=549 SQLSERVER_2025_STANDARD value + * @property {number} SQLSERVER_2025_ENTERPRISE=550 SQLSERVER_2025_ENTERPRISE value + * @property {number} SQLSERVER_2025_EXPRESS=551 SQLSERVER_2025_EXPRESS value */ v1.SqlDatabaseVersion = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -24009,6 +24154,7 @@ values[valuesById[272] = "POSTGRES_16"] = 272; values[valuesById[408] = "POSTGRES_17"] = 408; values[valuesById[557] = "POSTGRES_18"] = 557; + values[valuesById[684] = "POSTGRES_19"] = 684; values[valuesById[26] = "SQLSERVER_2019_STANDARD"] = 26; values[valuesById[27] = "SQLSERVER_2019_ENTERPRISE"] = 27; values[valuesById[28] = "SQLSERVER_2019_EXPRESS"] = 28; @@ -24017,6 +24163,9 @@ values[valuesById[200] = "SQLSERVER_2022_ENTERPRISE"] = 200; values[valuesById[201] = "SQLSERVER_2022_EXPRESS"] = 201; values[valuesById[202] = "SQLSERVER_2022_WEB"] = 202; + values[valuesById[549] = "SQLSERVER_2025_STANDARD"] = 549; + values[valuesById[550] = "SQLSERVER_2025_ENTERPRISE"] = 550; + values[valuesById[551] = "SQLSERVER_2025_EXPRESS"] = 551; return values; })(); @@ -27099,6 +27248,7 @@ case 272: case 408: case 557: + case 684: case 26: case 27: case 28: @@ -27107,6 +27257,9 @@ case 200: case 201: case 202: + case 549: + case 550: + case 551: break; } if (message.maxChargeableBytes != null && message.hasOwnProperty("maxChargeableBytes")) { @@ -27453,6 +27606,10 @@ case 557: message.databaseVersion = 557; break; + case "POSTGRES_19": + case 684: + message.databaseVersion = 684; + break; case "SQLSERVER_2019_STANDARD": case 26: message.databaseVersion = 26; @@ -27485,6 +27642,18 @@ case 202: message.databaseVersion = 202; break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.databaseVersion = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.databaseVersion = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.databaseVersion = 551; + break; } if (object.maxChargeableBytes != null) if ($util.Long) @@ -45881,6 +46050,9 @@ * @property {string|null} [allocatedIpRange] PointInTimeRestoreContext allocatedIpRange * @property {string|null} [preferredZone] PointInTimeRestoreContext preferredZone * @property {string|null} [preferredSecondaryZone] PointInTimeRestoreContext preferredSecondaryZone + * @property {google.cloud.sql.v1.IDatabaseInstance|null} [targetInstanceSettings] PointInTimeRestoreContext targetInstanceSettings + * @property {Array.|null} [targetInstanceClearSettingsFieldNames] PointInTimeRestoreContext targetInstanceClearSettingsFieldNames + * @property {string|null} [region] PointInTimeRestoreContext region */ /** @@ -45892,6 +46064,7 @@ * @param {google.cloud.sql.v1.IPointInTimeRestoreContext=} [properties] Properties to set */ function PointInTimeRestoreContext(properties) { + this.targetInstanceClearSettingsFieldNames = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -45954,6 +46127,30 @@ */ PointInTimeRestoreContext.prototype.preferredSecondaryZone = null; + /** + * PointInTimeRestoreContext targetInstanceSettings. + * @member {google.cloud.sql.v1.IDatabaseInstance|null|undefined} targetInstanceSettings + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.targetInstanceSettings = null; + + /** + * PointInTimeRestoreContext targetInstanceClearSettingsFieldNames. + * @member {Array.} targetInstanceClearSettingsFieldNames + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.targetInstanceClearSettingsFieldNames = $util.emptyArray; + + /** + * PointInTimeRestoreContext region. + * @member {string|null|undefined} region + * @memberof google.cloud.sql.v1.PointInTimeRestoreContext + * @instance + */ + PointInTimeRestoreContext.prototype.region = null; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -45993,6 +46190,12 @@ set: $util.oneOfSetter($oneOfFields) }); + // Virtual OneOf for proto3 optional field + Object.defineProperty(PointInTimeRestoreContext.prototype, "_region", { + get: $util.oneOfGetter($oneOfFields = ["region"]), + set: $util.oneOfSetter($oneOfFields) + }); + /** * Creates a new PointInTimeRestoreContext instance using the specified properties. * @function create @@ -46031,6 +46234,13 @@ writer.uint32(/* id 6, wireType 2 =*/50).string(message.preferredZone); if (message.preferredSecondaryZone != null && Object.hasOwnProperty.call(message, "preferredSecondaryZone")) writer.uint32(/* id 9, wireType 2 =*/74).string(message.preferredSecondaryZone); + if (message.targetInstanceSettings != null && Object.hasOwnProperty.call(message, "targetInstanceSettings")) + $root.google.cloud.sql.v1.DatabaseInstance.encode(message.targetInstanceSettings, writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.targetInstanceClearSettingsFieldNames != null && message.targetInstanceClearSettingsFieldNames.length) + for (var i = 0; i < message.targetInstanceClearSettingsFieldNames.length; ++i) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.targetInstanceClearSettingsFieldNames[i]); + if (message.region != null && Object.hasOwnProperty.call(message, "region")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.region); return writer; }; @@ -46095,6 +46305,20 @@ message.preferredSecondaryZone = reader.string(); break; } + case 11: { + message.targetInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.decode(reader, reader.uint32()); + break; + } + case 12: { + if (!(message.targetInstanceClearSettingsFieldNames && message.targetInstanceClearSettingsFieldNames.length)) + message.targetInstanceClearSettingsFieldNames = []; + message.targetInstanceClearSettingsFieldNames.push(reader.string()); + break; + } + case 13: { + message.region = reader.string(); + break; + } default: reader.skipType(tag & 7); break; @@ -46166,6 +46390,23 @@ if (!$util.isString(message.preferredSecondaryZone)) return "preferredSecondaryZone: string expected"; } + if (message.targetInstanceSettings != null && message.hasOwnProperty("targetInstanceSettings")) { + var error = $root.google.cloud.sql.v1.DatabaseInstance.verify(message.targetInstanceSettings); + if (error) + return "targetInstanceSettings." + error; + } + if (message.targetInstanceClearSettingsFieldNames != null && message.hasOwnProperty("targetInstanceClearSettingsFieldNames")) { + if (!Array.isArray(message.targetInstanceClearSettingsFieldNames)) + return "targetInstanceClearSettingsFieldNames: array expected"; + for (var i = 0; i < message.targetInstanceClearSettingsFieldNames.length; ++i) + if (!$util.isString(message.targetInstanceClearSettingsFieldNames[i])) + return "targetInstanceClearSettingsFieldNames: string[] expected"; + } + if (message.region != null && message.hasOwnProperty("region")) { + properties._region = 1; + if (!$util.isString(message.region)) + return "region: string expected"; + } return null; }; @@ -46198,6 +46439,20 @@ message.preferredZone = String(object.preferredZone); if (object.preferredSecondaryZone != null) message.preferredSecondaryZone = String(object.preferredSecondaryZone); + if (object.targetInstanceSettings != null) { + if (typeof object.targetInstanceSettings !== "object") + throw TypeError(".google.cloud.sql.v1.PointInTimeRestoreContext.targetInstanceSettings: object expected"); + message.targetInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.fromObject(object.targetInstanceSettings); + } + if (object.targetInstanceClearSettingsFieldNames) { + if (!Array.isArray(object.targetInstanceClearSettingsFieldNames)) + throw TypeError(".google.cloud.sql.v1.PointInTimeRestoreContext.targetInstanceClearSettingsFieldNames: array expected"); + message.targetInstanceClearSettingsFieldNames = []; + for (var i = 0; i < object.targetInstanceClearSettingsFieldNames.length; ++i) + message.targetInstanceClearSettingsFieldNames[i] = String(object.targetInstanceClearSettingsFieldNames[i]); + } + if (object.region != null) + message.region = String(object.region); return message; }; @@ -46214,8 +46469,12 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.arrays || options.defaults) + object.targetInstanceClearSettingsFieldNames = []; + if (options.defaults) { object.pointInTime = null; + object.targetInstanceSettings = null; + } if (message.datasource != null && message.hasOwnProperty("datasource")) { object.datasource = message.datasource; if (options.oneofs) @@ -46248,6 +46507,18 @@ if (options.oneofs) object._preferredSecondaryZone = "preferredSecondaryZone"; } + if (message.targetInstanceSettings != null && message.hasOwnProperty("targetInstanceSettings")) + object.targetInstanceSettings = $root.google.cloud.sql.v1.DatabaseInstance.toObject(message.targetInstanceSettings, options); + if (message.targetInstanceClearSettingsFieldNames && message.targetInstanceClearSettingsFieldNames.length) { + object.targetInstanceClearSettingsFieldNames = []; + for (var j = 0; j < message.targetInstanceClearSettingsFieldNames.length; ++j) + object.targetInstanceClearSettingsFieldNames[j] = message.targetInstanceClearSettingsFieldNames[j]; + } + if (message.region != null && message.hasOwnProperty("region")) { + object.region = message.region; + if (options.oneofs) + object._region = "region"; + } return object; }; @@ -47615,6 +47886,7 @@ case 272: case 408: case 557: + case 684: case 26: case 27: case 28: @@ -47623,6 +47895,9 @@ case 200: case 201: case 202: + case 549: + case 550: + case 551: break; } if (message.settings != null && message.hasOwnProperty("settings")) { @@ -47727,6 +48002,7 @@ case 3: case 4: case 5: + case 8: break; } } @@ -48139,6 +48415,10 @@ case 557: message.databaseVersion = 557; break; + case "POSTGRES_19": + case 684: + message.databaseVersion = 684; + break; case "SQLSERVER_2019_STANDARD": case 26: message.databaseVersion = 26; @@ -48171,6 +48451,18 @@ case 202: message.databaseVersion = 202; break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.databaseVersion = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.databaseVersion = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.databaseVersion = 551; + break; } if (object.settings != null) { if (typeof object.settings !== "object") @@ -48319,6 +48611,10 @@ case 5: message.suspensionReason[i] = 5; break; + case "PROJECT_ABUSE": + case 8: + message.suspensionReason[i] = 8; + break; } } if (object.connectionName != null) @@ -58862,6 +59158,7 @@ * @property {number} LEGAL_ISSUE=3 LEGAL_ISSUE value * @property {number} OPERATIONAL_ISSUE=4 OPERATIONAL_ISSUE value * @property {number} KMS_KEY_ISSUE=5 KMS_KEY_ISSUE value + * @property {number} PROJECT_ABUSE=8 PROJECT_ABUSE value */ v1.SqlSuspensionReason = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -58870,6 +59167,7 @@ values[valuesById[3] = "LEGAL_ISSUE"] = 3; values[valuesById[4] = "OPERATIONAL_ISSUE"] = 4; values[valuesById[5] = "KMS_KEY_ISSUE"] = 5; + values[valuesById[8] = "PROJECT_ABUSE"] = 8; return values; })(); @@ -59664,6 +59962,7 @@ case 272: case 408: case 557: + case 684: case 26: case 27: case 28: @@ -59672,6 +59971,9 @@ case 200: case 201: case 202: + case 549: + case 550: + case 551: break; } if (message.backendType != null && message.hasOwnProperty("backendType")) @@ -59955,6 +60257,10 @@ case 557: message.databaseVersion = 557; break; + case "POSTGRES_19": + case 684: + message.databaseVersion = 684; + break; case "SQLSERVER_2019_STANDARD": case 26: message.databaseVersion = 26; @@ -59987,6 +60293,18 @@ case 202: message.databaseVersion = 202; break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.databaseVersion = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.databaseVersion = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.databaseVersion = 551; + break; } switch (object.backendType) { default: @@ -63945,6 +64263,7 @@ case 272: case 408: case 557: + case 684: case 26: case 27: case 28: @@ -63953,6 +64272,9 @@ case 200: case 201: case 202: + case 549: + case 550: + case 551: break; } } @@ -64257,6 +64579,10 @@ case 557: message.appliesTo[i] = 557; break; + case "POSTGRES_19": + case 684: + message.appliesTo[i] = 684; + break; case "SQLSERVER_2019_STANDARD": case 26: message.appliesTo[i] = 26; @@ -64289,6 +64615,18 @@ case 202: message.appliesTo[i] = 202; break; + case "SQLSERVER_2025_STANDARD": + case 549: + message.appliesTo[i] = 549; + break; + case "SQLSERVER_2025_ENTERPRISE": + case 550: + message.appliesTo[i] = 550; + break; + case "SQLSERVER_2025_EXPRESS": + case 551: + message.appliesTo[i] = 551; + break; } } if (object.allowedStringValues) { @@ -144678,6 +145016,7 @@ * @interface ICommonLanguageSettings * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri * @property {Array.|null} [destinations] CommonLanguageSettings destinations + * @property {google.api.ISelectiveGapicGeneration|null} [selectiveGapicGeneration] CommonLanguageSettings selectiveGapicGeneration */ /** @@ -144712,6 +145051,14 @@ */ CommonLanguageSettings.prototype.destinations = $util.emptyArray; + /** + * CommonLanguageSettings selectiveGapicGeneration. + * @member {google.api.ISelectiveGapicGeneration|null|undefined} selectiveGapicGeneration + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.selectiveGapicGeneration = null; + /** * Creates a new CommonLanguageSettings instance using the specified properties. * @function create @@ -144744,6 +145091,8 @@ writer.int32(message.destinations[i]); writer.ldelim(); } + if (message.selectiveGapicGeneration != null && Object.hasOwnProperty.call(message, "selectiveGapicGeneration")) + $root.google.api.SelectiveGapicGeneration.encode(message.selectiveGapicGeneration, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); return writer; }; @@ -144795,6 +145144,10 @@ message.destinations.push(reader.int32()); break; } + case 3: { + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -144846,6 +145199,11 @@ break; } } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) { + var error = $root.google.api.SelectiveGapicGeneration.verify(message.selectiveGapicGeneration); + if (error) + return "selectiveGapicGeneration." + error; + } return null; }; @@ -144888,6 +145246,11 @@ break; } } + if (object.selectiveGapicGeneration != null) { + if (typeof object.selectiveGapicGeneration !== "object") + throw TypeError(".google.api.CommonLanguageSettings.selectiveGapicGeneration: object expected"); + message.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.fromObject(object.selectiveGapicGeneration); + } return message; }; @@ -144906,8 +145269,10 @@ var object = {}; if (options.arrays || options.defaults) object.destinations = []; - if (options.defaults) + if (options.defaults) { object.referenceDocsUri = ""; + object.selectiveGapicGeneration = null; + } if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) object.referenceDocsUri = message.referenceDocsUri; if (message.destinations && message.destinations.length) { @@ -144915,6 +145280,8 @@ for (var j = 0; j < message.destinations.length; ++j) object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; } + if (message.selectiveGapicGeneration != null && message.hasOwnProperty("selectiveGapicGeneration")) + object.selectiveGapicGeneration = $root.google.api.SelectiveGapicGeneration.toObject(message.selectiveGapicGeneration, options); return object; }; @@ -146737,6 +147104,7 @@ * @memberof google.api * @interface IPythonSettings * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + * @property {google.api.PythonSettings.IExperimentalFeatures|null} [experimentalFeatures] PythonSettings experimentalFeatures */ /** @@ -146762,6 +147130,14 @@ */ PythonSettings.prototype.common = null; + /** + * PythonSettings experimentalFeatures. + * @member {google.api.PythonSettings.IExperimentalFeatures|null|undefined} experimentalFeatures + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.experimentalFeatures = null; + /** * Creates a new PythonSettings instance using the specified properties. * @function create @@ -146788,6 +147164,8 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.experimentalFeatures != null && Object.hasOwnProperty.call(message, "experimentalFeatures")) + $root.google.api.PythonSettings.ExperimentalFeatures.encode(message.experimentalFeatures, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -146828,6 +147206,10 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.decode(reader, reader.uint32()); + break; + } default: reader.skipType(tag & 7); break; @@ -146868,6 +147250,11 @@ if (error) return "common." + error; } + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) { + var error = $root.google.api.PythonSettings.ExperimentalFeatures.verify(message.experimentalFeatures); + if (error) + return "experimentalFeatures." + error; + } return null; }; @@ -146888,6 +147275,11 @@ throw TypeError(".google.api.PythonSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.experimentalFeatures != null) { + if (typeof object.experimentalFeatures !== "object") + throw TypeError(".google.api.PythonSettings.experimentalFeatures: object expected"); + message.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.fromObject(object.experimentalFeatures); + } return message; }; @@ -146904,10 +147296,14 @@ if (!options) options = {}; var object = {}; - if (options.defaults) + if (options.defaults) { object.common = null; + object.experimentalFeatures = null; + } if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + if (message.experimentalFeatures != null && message.hasOwnProperty("experimentalFeatures")) + object.experimentalFeatures = $root.google.api.PythonSettings.ExperimentalFeatures.toObject(message.experimentalFeatures, options); return object; }; @@ -146937,6 +147333,258 @@ return typeUrlPrefix + "/google.api.PythonSettings"; }; + PythonSettings.ExperimentalFeatures = (function() { + + /** + * Properties of an ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @interface IExperimentalFeatures + * @property {boolean|null} [restAsyncIoEnabled] ExperimentalFeatures restAsyncIoEnabled + * @property {boolean|null} [protobufPythonicTypesEnabled] ExperimentalFeatures protobufPythonicTypesEnabled + * @property {boolean|null} [unversionedPackageDisabled] ExperimentalFeatures unversionedPackageDisabled + */ + + /** + * Constructs a new ExperimentalFeatures. + * @memberof google.api.PythonSettings + * @classdesc Represents an ExperimentalFeatures. + * @implements IExperimentalFeatures + * @constructor + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + */ + function ExperimentalFeatures(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExperimentalFeatures restAsyncIoEnabled. + * @member {boolean} restAsyncIoEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.restAsyncIoEnabled = false; + + /** + * ExperimentalFeatures protobufPythonicTypesEnabled. + * @member {boolean} protobufPythonicTypesEnabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.protobufPythonicTypesEnabled = false; + + /** + * ExperimentalFeatures unversionedPackageDisabled. + * @member {boolean} unversionedPackageDisabled + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + */ + ExperimentalFeatures.prototype.unversionedPackageDisabled = false; + + /** + * Creates a new ExperimentalFeatures instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures=} [properties] Properties to set + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures instance + */ + ExperimentalFeatures.create = function create(properties) { + return new ExperimentalFeatures(properties); + }; + + /** + * Encodes the specified ExperimentalFeatures message. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.restAsyncIoEnabled != null && Object.hasOwnProperty.call(message, "restAsyncIoEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.restAsyncIoEnabled); + if (message.protobufPythonicTypesEnabled != null && Object.hasOwnProperty.call(message, "protobufPythonicTypesEnabled")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.protobufPythonicTypesEnabled); + if (message.unversionedPackageDisabled != null && Object.hasOwnProperty.call(message, "unversionedPackageDisabled")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.unversionedPackageDisabled); + return writer; + }; + + /** + * Encodes the specified ExperimentalFeatures message, length delimited. Does not implicitly {@link google.api.PythonSettings.ExperimentalFeatures.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.IExperimentalFeatures} message ExperimentalFeatures message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExperimentalFeatures.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.restAsyncIoEnabled = reader.bool(); + break; + } + case 2: { + message.protobufPythonicTypesEnabled = reader.bool(); + break; + } + case 3: { + message.unversionedPackageDisabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExperimentalFeatures message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExperimentalFeatures.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExperimentalFeatures message. + * @function verify + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExperimentalFeatures.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + if (typeof message.restAsyncIoEnabled !== "boolean") + return "restAsyncIoEnabled: boolean expected"; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + if (typeof message.protobufPythonicTypesEnabled !== "boolean") + return "protobufPythonicTypesEnabled: boolean expected"; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + if (typeof message.unversionedPackageDisabled !== "boolean") + return "unversionedPackageDisabled: boolean expected"; + return null; + }; + + /** + * Creates an ExperimentalFeatures message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings.ExperimentalFeatures} ExperimentalFeatures + */ + ExperimentalFeatures.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings.ExperimentalFeatures) + return object; + var message = new $root.google.api.PythonSettings.ExperimentalFeatures(); + if (object.restAsyncIoEnabled != null) + message.restAsyncIoEnabled = Boolean(object.restAsyncIoEnabled); + if (object.protobufPythonicTypesEnabled != null) + message.protobufPythonicTypesEnabled = Boolean(object.protobufPythonicTypesEnabled); + if (object.unversionedPackageDisabled != null) + message.unversionedPackageDisabled = Boolean(object.unversionedPackageDisabled); + return message; + }; + + /** + * Creates a plain object from an ExperimentalFeatures message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {google.api.PythonSettings.ExperimentalFeatures} message ExperimentalFeatures + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExperimentalFeatures.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.restAsyncIoEnabled = false; + object.protobufPythonicTypesEnabled = false; + object.unversionedPackageDisabled = false; + } + if (message.restAsyncIoEnabled != null && message.hasOwnProperty("restAsyncIoEnabled")) + object.restAsyncIoEnabled = message.restAsyncIoEnabled; + if (message.protobufPythonicTypesEnabled != null && message.hasOwnProperty("protobufPythonicTypesEnabled")) + object.protobufPythonicTypesEnabled = message.protobufPythonicTypesEnabled; + if (message.unversionedPackageDisabled != null && message.hasOwnProperty("unversionedPackageDisabled")) + object.unversionedPackageDisabled = message.unversionedPackageDisabled; + return object; + }; + + /** + * Converts this ExperimentalFeatures to JSON. + * @function toJSON + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @instance + * @returns {Object.} JSON object + */ + ExperimentalFeatures.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExperimentalFeatures + * @function getTypeUrl + * @memberof google.api.PythonSettings.ExperimentalFeatures + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExperimentalFeatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings.ExperimentalFeatures"; + }; + + return ExperimentalFeatures; + })(); + return PythonSettings; })(); @@ -147813,6 +148461,7 @@ * @memberof google.api * @interface IGoSettings * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + * @property {Object.|null} [renamedServices] GoSettings renamedServices */ /** @@ -147824,6 +148473,7 @@ * @param {google.api.IGoSettings=} [properties] Properties to set */ function GoSettings(properties) { + this.renamedServices = {}; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -147838,6 +148488,14 @@ */ GoSettings.prototype.common = null; + /** + * GoSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.renamedServices = $util.emptyObject; + /** * Creates a new GoSettings instance using the specified properties. * @function create @@ -147864,6 +148522,9 @@ writer = $Writer.create(); if (message.common != null && Object.hasOwnProperty.call(message, "common")) $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); return writer; }; @@ -147894,7 +148555,7 @@ GoSettings.decode = function decode(reader, length, error) { if (!(reader instanceof $Reader)) reader = $Reader.create(reader); - var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(), key, value; while (reader.pos < end) { var tag = reader.uint32(); if (tag === error) @@ -147904,6 +148565,29 @@ message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); break; } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } default: reader.skipType(tag & 7); break; @@ -147944,6 +148628,14 @@ if (error) return "common." + error; } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } return null; }; @@ -147964,6 +148656,13 @@ throw TypeError(".google.api.GoSettings.common: object expected"); message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.GoSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } return message; }; @@ -147980,10 +148679,18 @@ if (!options) options = {}; var object = {}; + if (options.objects || options.defaults) + object.renamedServices = {}; if (options.defaults) object.common = null; if (message.common != null && message.hasOwnProperty("common")) object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } return object; }; @@ -148622,6 +149329,251 @@ return values; })(); + api.SelectiveGapicGeneration = (function() { + + /** + * Properties of a SelectiveGapicGeneration. + * @memberof google.api + * @interface ISelectiveGapicGeneration + * @property {Array.|null} [methods] SelectiveGapicGeneration methods + * @property {boolean|null} [generateOmittedAsInternal] SelectiveGapicGeneration generateOmittedAsInternal + */ + + /** + * Constructs a new SelectiveGapicGeneration. + * @memberof google.api + * @classdesc Represents a SelectiveGapicGeneration. + * @implements ISelectiveGapicGeneration + * @constructor + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + */ + function SelectiveGapicGeneration(properties) { + this.methods = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SelectiveGapicGeneration methods. + * @member {Array.} methods + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.methods = $util.emptyArray; + + /** + * SelectiveGapicGeneration generateOmittedAsInternal. + * @member {boolean} generateOmittedAsInternal + * @memberof google.api.SelectiveGapicGeneration + * @instance + */ + SelectiveGapicGeneration.prototype.generateOmittedAsInternal = false; + + /** + * Creates a new SelectiveGapicGeneration instance using the specified properties. + * @function create + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration=} [properties] Properties to set + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration instance + */ + SelectiveGapicGeneration.create = function create(properties) { + return new SelectiveGapicGeneration(properties); + }; + + /** + * Encodes the specified SelectiveGapicGeneration message. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methods != null && message.methods.length) + for (var i = 0; i < message.methods.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.methods[i]); + if (message.generateOmittedAsInternal != null && Object.hasOwnProperty.call(message, "generateOmittedAsInternal")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.generateOmittedAsInternal); + return writer; + }; + + /** + * Encodes the specified SelectiveGapicGeneration message, length delimited. Does not implicitly {@link google.api.SelectiveGapicGeneration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.ISelectiveGapicGeneration} message SelectiveGapicGeneration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SelectiveGapicGeneration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer. + * @function decode + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.SelectiveGapicGeneration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.methods && message.methods.length)) + message.methods = []; + message.methods.push(reader.string()); + break; + } + case 2: { + message.generateOmittedAsInternal = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SelectiveGapicGeneration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SelectiveGapicGeneration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SelectiveGapicGeneration message. + * @function verify + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SelectiveGapicGeneration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methods != null && message.hasOwnProperty("methods")) { + if (!Array.isArray(message.methods)) + return "methods: array expected"; + for (var i = 0; i < message.methods.length; ++i) + if (!$util.isString(message.methods[i])) + return "methods: string[] expected"; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + if (typeof message.generateOmittedAsInternal !== "boolean") + return "generateOmittedAsInternal: boolean expected"; + return null; + }; + + /** + * Creates a SelectiveGapicGeneration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {Object.} object Plain object + * @returns {google.api.SelectiveGapicGeneration} SelectiveGapicGeneration + */ + SelectiveGapicGeneration.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.SelectiveGapicGeneration) + return object; + var message = new $root.google.api.SelectiveGapicGeneration(); + if (object.methods) { + if (!Array.isArray(object.methods)) + throw TypeError(".google.api.SelectiveGapicGeneration.methods: array expected"); + message.methods = []; + for (var i = 0; i < object.methods.length; ++i) + message.methods[i] = String(object.methods[i]); + } + if (object.generateOmittedAsInternal != null) + message.generateOmittedAsInternal = Boolean(object.generateOmittedAsInternal); + return message; + }; + + /** + * Creates a plain object from a SelectiveGapicGeneration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {google.api.SelectiveGapicGeneration} message SelectiveGapicGeneration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SelectiveGapicGeneration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.methods = []; + if (options.defaults) + object.generateOmittedAsInternal = false; + if (message.methods && message.methods.length) { + object.methods = []; + for (var j = 0; j < message.methods.length; ++j) + object.methods[j] = message.methods[j]; + } + if (message.generateOmittedAsInternal != null && message.hasOwnProperty("generateOmittedAsInternal")) + object.generateOmittedAsInternal = message.generateOmittedAsInternal; + return object; + }; + + /** + * Converts this SelectiveGapicGeneration to JSON. + * @function toJSON + * @memberof google.api.SelectiveGapicGeneration + * @instance + * @returns {Object.} JSON object + */ + SelectiveGapicGeneration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SelectiveGapicGeneration + * @function getTypeUrl + * @memberof google.api.SelectiveGapicGeneration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SelectiveGapicGeneration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.SelectiveGapicGeneration"; + }; + + return SelectiveGapicGeneration; + })(); + /** * LaunchStage enum. * @name google.api.LaunchStage @@ -149371,6 +150323,7 @@ * @memberof google.api * @interface IFieldInfo * @property {google.api.FieldInfo.Format|null} [format] FieldInfo format + * @property {Array.|null} [referencedTypes] FieldInfo referencedTypes */ /** @@ -149382,6 +150335,7 @@ * @param {google.api.IFieldInfo=} [properties] Properties to set */ function FieldInfo(properties) { + this.referencedTypes = []; if (properties) for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) if (properties[keys[i]] != null) @@ -149396,6 +150350,14 @@ */ FieldInfo.prototype.format = 0; + /** + * FieldInfo referencedTypes. + * @member {Array.} referencedTypes + * @memberof google.api.FieldInfo + * @instance + */ + FieldInfo.prototype.referencedTypes = $util.emptyArray; + /** * Creates a new FieldInfo instance using the specified properties. * @function create @@ -149422,6 +150384,9 @@ writer = $Writer.create(); if (message.format != null && Object.hasOwnProperty.call(message, "format")) writer.uint32(/* id 1, wireType 0 =*/8).int32(message.format); + if (message.referencedTypes != null && message.referencedTypes.length) + for (var i = 0; i < message.referencedTypes.length; ++i) + $root.google.api.TypeReference.encode(message.referencedTypes[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); return writer; }; @@ -149462,6 +150427,12 @@ message.format = reader.int32(); break; } + case 2: { + if (!(message.referencedTypes && message.referencedTypes.length)) + message.referencedTypes = []; + message.referencedTypes.push($root.google.api.TypeReference.decode(reader, reader.uint32())); + break; + } default: reader.skipType(tag & 7); break; @@ -149508,6 +150479,15 @@ case 4: break; } + if (message.referencedTypes != null && message.hasOwnProperty("referencedTypes")) { + if (!Array.isArray(message.referencedTypes)) + return "referencedTypes: array expected"; + for (var i = 0; i < message.referencedTypes.length; ++i) { + var error = $root.google.api.TypeReference.verify(message.referencedTypes[i]); + if (error) + return "referencedTypes." + error; + } + } return null; }; @@ -149551,6 +150531,16 @@ message.format = 4; break; } + if (object.referencedTypes) { + if (!Array.isArray(object.referencedTypes)) + throw TypeError(".google.api.FieldInfo.referencedTypes: array expected"); + message.referencedTypes = []; + for (var i = 0; i < object.referencedTypes.length; ++i) { + if (typeof object.referencedTypes[i] !== "object") + throw TypeError(".google.api.FieldInfo.referencedTypes: object expected"); + message.referencedTypes[i] = $root.google.api.TypeReference.fromObject(object.referencedTypes[i]); + } + } return message; }; @@ -149567,10 +150557,17 @@ if (!options) options = {}; var object = {}; + if (options.arrays || options.defaults) + object.referencedTypes = []; if (options.defaults) object.format = options.enums === String ? "FORMAT_UNSPECIFIED" : 0; if (message.format != null && message.hasOwnProperty("format")) object.format = options.enums === String ? $root.google.api.FieldInfo.Format[message.format] === undefined ? message.format : $root.google.api.FieldInfo.Format[message.format] : message.format; + if (message.referencedTypes && message.referencedTypes.length) { + object.referencedTypes = []; + for (var j = 0; j < message.referencedTypes.length; ++j) + object.referencedTypes[j] = $root.google.api.TypeReference.toObject(message.referencedTypes[j], options); + } return object; }; @@ -149623,6 +150620,211 @@ return FieldInfo; })(); + api.TypeReference = (function() { + + /** + * Properties of a TypeReference. + * @memberof google.api + * @interface ITypeReference + * @property {string|null} [typeName] TypeReference typeName + */ + + /** + * Constructs a new TypeReference. + * @memberof google.api + * @classdesc Represents a TypeReference. + * @implements ITypeReference + * @constructor + * @param {google.api.ITypeReference=} [properties] Properties to set + */ + function TypeReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TypeReference typeName. + * @member {string} typeName + * @memberof google.api.TypeReference + * @instance + */ + TypeReference.prototype.typeName = ""; + + /** + * Creates a new TypeReference instance using the specified properties. + * @function create + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference=} [properties] Properties to set + * @returns {google.api.TypeReference} TypeReference instance + */ + TypeReference.create = function create(properties) { + return new TypeReference(properties); + }; + + /** + * Encodes the specified TypeReference message. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @function encode + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference} message TypeReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TypeReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.typeName); + return writer; + }; + + /** + * Encodes the specified TypeReference message, length delimited. Does not implicitly {@link google.api.TypeReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.TypeReference + * @static + * @param {google.api.ITypeReference} message TypeReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TypeReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TypeReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.TypeReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.TypeReference} TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TypeReference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.TypeReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.typeName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TypeReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.TypeReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.TypeReference} TypeReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TypeReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TypeReference message. + * @function verify + * @memberof google.api.TypeReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TypeReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + return null; + }; + + /** + * Creates a TypeReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.TypeReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.TypeReference} TypeReference + */ + TypeReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.TypeReference) + return object; + var message = new $root.google.api.TypeReference(); + if (object.typeName != null) + message.typeName = String(object.typeName); + return message; + }; + + /** + * Creates a plain object from a TypeReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.TypeReference + * @static + * @param {google.api.TypeReference} message TypeReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TypeReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.typeName = ""; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + return object; + }; + + /** + * Converts this TypeReference to JSON. + * @function toJSON + * @memberof google.api.TypeReference + * @instance + * @returns {Object.} JSON object + */ + TypeReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TypeReference + * @function getTypeUrl + * @memberof google.api.TypeReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TypeReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.TypeReference"; + }; + + return TypeReference; + })(); + return api; })(); @@ -149866,6 +151068,7 @@ * @name google.protobuf.Edition * @enum {number} * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_LEGACY=900 EDITION_LEGACY value * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value * @property {number} EDITION_2023=1000 EDITION_2023 value @@ -149880,6 +151083,7 @@ protobuf.Edition = (function() { var valuesById = {}, values = Object.create(valuesById); values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[900] = "EDITION_LEGACY"] = 900; values[valuesById[998] = "EDITION_PROTO2"] = 998; values[valuesById[999] = "EDITION_PROTO3"] = 999; values[valuesById[1000] = "EDITION_2023"] = 1000; @@ -149904,6 +151108,7 @@ * @property {Array.|null} [dependency] FileDescriptorProto dependency * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [optionDependency] FileDescriptorProto optionDependency * @property {Array.|null} [messageType] FileDescriptorProto messageType * @property {Array.|null} [enumType] FileDescriptorProto enumType * @property {Array.|null} [service] FileDescriptorProto service @@ -149926,6 +151131,7 @@ this.dependency = []; this.publicDependency = []; this.weakDependency = []; + this.optionDependency = []; this.messageType = []; this.enumType = []; this.service = []; @@ -149976,6 +151182,14 @@ */ FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + /** + * FileDescriptorProto optionDependency. + * @member {Array.} optionDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.optionDependency = $util.emptyArray; + /** * FileDescriptorProto messageType. * @member {Array.} messageType @@ -150097,6 +151311,9 @@ writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + if (message.optionDependency != null && message.optionDependency.length) + for (var i = 0; i < message.optionDependency.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.optionDependency[i]); return writer; }; @@ -150169,6 +151386,12 @@ message.weakDependency.push(reader.int32()); break; } + case 15: { + if (!(message.optionDependency && message.optionDependency.length)) + message.optionDependency = []; + message.optionDependency.push(reader.string()); + break; + } case 4: { if (!(message.messageType && message.messageType.length)) message.messageType = []; @@ -150271,6 +151494,13 @@ if (!$util.isInteger(message.weakDependency[i])) return "weakDependency: integer[] expected"; } + if (message.optionDependency != null && message.hasOwnProperty("optionDependency")) { + if (!Array.isArray(message.optionDependency)) + return "optionDependency: array expected"; + for (var i = 0; i < message.optionDependency.length; ++i) + if (!$util.isString(message.optionDependency[i])) + return "optionDependency: string[] expected"; + } if (message.messageType != null && message.hasOwnProperty("messageType")) { if (!Array.isArray(message.messageType)) return "messageType: array expected"; @@ -150325,6 +151555,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -150377,6 +151608,13 @@ for (var i = 0; i < object.weakDependency.length; ++i) message.weakDependency[i] = object.weakDependency[i] | 0; } + if (object.optionDependency) { + if (!Array.isArray(object.optionDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.optionDependency: array expected"); + message.optionDependency = []; + for (var i = 0; i < object.optionDependency.length; ++i) + message.optionDependency[i] = String(object.optionDependency[i]); + } if (object.messageType) { if (!Array.isArray(object.messageType)) throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); @@ -150440,6 +151678,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -150505,6 +151747,7 @@ object.extension = []; object.publicDependency = []; object.weakDependency = []; + object.optionDependency = []; } if (options.defaults) { object.name = ""; @@ -150561,6 +151804,11 @@ object.syntax = message.syntax; if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.optionDependency && message.optionDependency.length) { + object.optionDependency = []; + for (var j = 0; j < message.optionDependency.length; ++j) + object.optionDependency[j] = message.optionDependency[j]; + } return object; }; @@ -150609,6 +151857,7 @@ * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options * @property {Array.|null} [reservedRange] DescriptorProto reservedRange * @property {Array.|null} [reservedName] DescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] DescriptorProto visibility */ /** @@ -150714,6 +151963,14 @@ */ DescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * DescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.visibility = 0; + /** * Creates a new DescriptorProto instance using the specified properties. * @function create @@ -150766,6 +152023,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.visibility); return writer; }; @@ -150858,6 +152117,10 @@ message.reservedName.push(reader.string()); break; } + case 11: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -150971,6 +152234,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -151070,6 +152342,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -151099,6 +152391,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -151144,6 +152437,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -153188,6 +154483,7 @@ * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + * @property {google.protobuf.SymbolVisibility|null} [visibility] EnumDescriptorProto visibility */ /** @@ -153248,6 +154544,14 @@ */ EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + /** + * EnumDescriptorProto visibility. + * @member {google.protobuf.SymbolVisibility} visibility + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.visibility = 0; + /** * Creates a new EnumDescriptorProto instance using the specified properties. * @function create @@ -153285,6 +154589,8 @@ if (message.reservedName != null && message.reservedName.length) for (var i = 0; i < message.reservedName.length; ++i) writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + if (message.visibility != null && Object.hasOwnProperty.call(message, "visibility")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.visibility); return writer; }; @@ -153347,6 +154653,10 @@ message.reservedName.push(reader.string()); break; } + case 6: { + message.visibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -153415,6 +154725,15 @@ if (!$util.isString(message.reservedName[i])) return "reservedName: string[] expected"; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + switch (message.visibility) { + default: + return "visibility: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -153464,6 +154783,26 @@ for (var i = 0; i < object.reservedName.length; ++i) message.reservedName[i] = String(object.reservedName[i]); } + switch (object.visibility) { + default: + if (typeof object.visibility === "number") { + message.visibility = object.visibility; + break; + } + break; + case "VISIBILITY_UNSET": + case 0: + message.visibility = 0; + break; + case "VISIBILITY_LOCAL": + case 1: + message.visibility = 1; + break; + case "VISIBILITY_EXPORT": + case 2: + message.visibility = 2; + break; + } return message; }; @@ -153488,6 +154827,7 @@ if (options.defaults) { object.name = ""; object.options = null; + object.visibility = options.enums === String ? "VISIBILITY_UNSET" : 0; } if (message.name != null && message.hasOwnProperty("name")) object.name = message.name; @@ -153508,6 +154848,8 @@ for (var j = 0; j < message.reservedName.length; ++j) object.reservedName[j] = message.reservedName[j]; } + if (message.visibility != null && message.hasOwnProperty("visibility")) + object.visibility = options.enums === String ? $root.google.protobuf.SymbolVisibility[message.visibility] === undefined ? message.visibility : $root.google.protobuf.SymbolVisibility[message.visibility] : message.visibility; return object; }; @@ -155826,6 +157168,7 @@ * @property {Array.|null} [targets] FieldOptions targets * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] FieldOptions featureSupport * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference @@ -155947,6 +157290,14 @@ */ FieldOptions.prototype.features = null; + /** + * FieldOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.featureSupport = null; + /** * FieldOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -156029,6 +157380,8 @@ $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); if (message.features != null && Object.hasOwnProperty.call(message, "features")) $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -156132,6 +157485,10 @@ message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } + case 22: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -156271,6 +157628,11 @@ if (error) return "features." + error; } + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -156464,6 +157826,11 @@ throw TypeError(".google.protobuf.FieldOptions.features: object expected"); message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); } + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.FieldOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); @@ -156566,6 +157933,7 @@ object.debugRedact = false; object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; object.features = null; + object.featureSupport = null; object[".google.api.resourceReference"] = null; object[".google.api.fieldInfo"] = null; } @@ -156599,6 +157967,8 @@ } if (message.features != null && message.hasOwnProperty("features")) object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -156873,6 +158243,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -156914,6 +158285,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -157013,6 +158388,488 @@ return EditionDefault; })(); + FieldOptions.FeatureSupport = (function() { + + /** + * Properties of a FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @interface IFeatureSupport + * @property {google.protobuf.Edition|null} [editionIntroduced] FeatureSupport editionIntroduced + * @property {google.protobuf.Edition|null} [editionDeprecated] FeatureSupport editionDeprecated + * @property {string|null} [deprecationWarning] FeatureSupport deprecationWarning + * @property {google.protobuf.Edition|null} [editionRemoved] FeatureSupport editionRemoved + */ + + /** + * Constructs a new FeatureSupport. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents a FeatureSupport. + * @implements IFeatureSupport + * @constructor + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + */ + function FeatureSupport(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSupport editionIntroduced. + * @member {google.protobuf.Edition} editionIntroduced + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionIntroduced = 0; + + /** + * FeatureSupport editionDeprecated. + * @member {google.protobuf.Edition} editionDeprecated + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionDeprecated = 0; + + /** + * FeatureSupport deprecationWarning. + * @member {string} deprecationWarning + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.deprecationWarning = ""; + + /** + * FeatureSupport editionRemoved. + * @member {google.protobuf.Edition} editionRemoved + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + */ + FeatureSupport.prototype.editionRemoved = 0; + + /** + * Creates a new FeatureSupport instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport instance + */ + FeatureSupport.create = function create(properties) { + return new FeatureSupport(properties); + }; + + /** + * Encodes the specified FeatureSupport message. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.editionIntroduced != null && Object.hasOwnProperty.call(message, "editionIntroduced")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.editionIntroduced); + if (message.editionDeprecated != null && Object.hasOwnProperty.call(message, "editionDeprecated")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.editionDeprecated); + if (message.deprecationWarning != null && Object.hasOwnProperty.call(message, "deprecationWarning")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.deprecationWarning); + if (message.editionRemoved != null && Object.hasOwnProperty.call(message, "editionRemoved")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.editionRemoved); + return writer; + }; + + /** + * Encodes the specified FeatureSupport message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.FeatureSupport.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.IFeatureSupport} message FeatureSupport message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSupport.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.editionIntroduced = reader.int32(); + break; + } + case 2: { + message.editionDeprecated = reader.int32(); + break; + } + case 3: { + message.deprecationWarning = reader.string(); + break; + } + case 4: { + message.editionRemoved = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSupport message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSupport.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSupport message. + * @function verify + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSupport.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + switch (message.editionIntroduced) { + default: + return "editionIntroduced: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + switch (message.editionDeprecated) { + default: + return "editionDeprecated: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + if (!$util.isString(message.deprecationWarning)) + return "deprecationWarning: string expected"; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + switch (message.editionRemoved) { + default: + return "editionRemoved: enum value expected"; + case 0: + case 900: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSupport message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.FeatureSupport} FeatureSupport + */ + FeatureSupport.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.FeatureSupport) + return object; + var message = new $root.google.protobuf.FieldOptions.FeatureSupport(); + switch (object.editionIntroduced) { + default: + if (typeof object.editionIntroduced === "number") { + message.editionIntroduced = object.editionIntroduced; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionIntroduced = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionIntroduced = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionIntroduced = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionIntroduced = 999; + break; + case "EDITION_2023": + case 1000: + message.editionIntroduced = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionIntroduced = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionIntroduced = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionIntroduced = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionIntroduced = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionIntroduced = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionIntroduced = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionIntroduced = 2147483647; + break; + } + switch (object.editionDeprecated) { + default: + if (typeof object.editionDeprecated === "number") { + message.editionDeprecated = object.editionDeprecated; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionDeprecated = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionDeprecated = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionDeprecated = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionDeprecated = 999; + break; + case "EDITION_2023": + case 1000: + message.editionDeprecated = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionDeprecated = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionDeprecated = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionDeprecated = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionDeprecated = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionDeprecated = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionDeprecated = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionDeprecated = 2147483647; + break; + } + if (object.deprecationWarning != null) + message.deprecationWarning = String(object.deprecationWarning); + switch (object.editionRemoved) { + default: + if (typeof object.editionRemoved === "number") { + message.editionRemoved = object.editionRemoved; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.editionRemoved = 0; + break; + case "EDITION_LEGACY": + case 900: + message.editionRemoved = 900; + break; + case "EDITION_PROTO2": + case 998: + message.editionRemoved = 998; + break; + case "EDITION_PROTO3": + case 999: + message.editionRemoved = 999; + break; + case "EDITION_2023": + case 1000: + message.editionRemoved = 1000; + break; + case "EDITION_2024": + case 1001: + message.editionRemoved = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.editionRemoved = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.editionRemoved = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.editionRemoved = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.editionRemoved = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.editionRemoved = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.editionRemoved = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSupport message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {google.protobuf.FieldOptions.FeatureSupport} message FeatureSupport + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSupport.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.editionIntroduced = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.editionDeprecated = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.deprecationWarning = ""; + object.editionRemoved = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.editionIntroduced != null && message.hasOwnProperty("editionIntroduced")) + object.editionIntroduced = options.enums === String ? $root.google.protobuf.Edition[message.editionIntroduced] === undefined ? message.editionIntroduced : $root.google.protobuf.Edition[message.editionIntroduced] : message.editionIntroduced; + if (message.editionDeprecated != null && message.hasOwnProperty("editionDeprecated")) + object.editionDeprecated = options.enums === String ? $root.google.protobuf.Edition[message.editionDeprecated] === undefined ? message.editionDeprecated : $root.google.protobuf.Edition[message.editionDeprecated] : message.editionDeprecated; + if (message.deprecationWarning != null && message.hasOwnProperty("deprecationWarning")) + object.deprecationWarning = message.deprecationWarning; + if (message.editionRemoved != null && message.hasOwnProperty("editionRemoved")) + object.editionRemoved = options.enums === String ? $root.google.protobuf.Edition[message.editionRemoved] === undefined ? message.editionRemoved : $root.google.protobuf.Edition[message.editionRemoved] : message.editionRemoved; + return object; + }; + + /** + * Converts this FeatureSupport to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @instance + * @returns {Object.} JSON object + */ + FeatureSupport.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSupport + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.FeatureSupport + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSupport.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.FeatureSupport"; + }; + + return FeatureSupport; + })(); + return FieldOptions; })(); @@ -157605,6 +159462,7 @@ * @property {boolean|null} [deprecated] EnumValueOptions deprecated * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {google.protobuf.FieldOptions.IFeatureSupport|null} [featureSupport] EnumValueOptions featureSupport * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption */ @@ -157648,6 +159506,14 @@ */ EnumValueOptions.prototype.debugRedact = false; + /** + * EnumValueOptions featureSupport. + * @member {google.protobuf.FieldOptions.IFeatureSupport|null|undefined} featureSupport + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.featureSupport = null; + /** * EnumValueOptions uninterpretedOption. * @member {Array.} uninterpretedOption @@ -157686,6 +159552,8 @@ $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.featureSupport != null && Object.hasOwnProperty.call(message, "featureSupport")) + $root.google.protobuf.FieldOptions.FeatureSupport.encode(message.featureSupport, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); if (message.uninterpretedOption != null && message.uninterpretedOption.length) for (var i = 0; i < message.uninterpretedOption.length; ++i) $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); @@ -157737,6 +159605,10 @@ message.debugRedact = reader.bool(); break; } + case 4: { + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.decode(reader, reader.uint32()); + break; + } case 999: { if (!(message.uninterpretedOption && message.uninterpretedOption.length)) message.uninterpretedOption = []; @@ -157789,6 +159661,11 @@ if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) if (typeof message.debugRedact !== "boolean") return "debugRedact: boolean expected"; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) { + var error = $root.google.protobuf.FieldOptions.FeatureSupport.verify(message.featureSupport); + if (error) + return "featureSupport." + error; + } if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { if (!Array.isArray(message.uninterpretedOption)) return "uninterpretedOption: array expected"; @@ -157822,6 +159699,11 @@ } if (object.debugRedact != null) message.debugRedact = Boolean(object.debugRedact); + if (object.featureSupport != null) { + if (typeof object.featureSupport !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.featureSupport: object expected"); + message.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.fromObject(object.featureSupport); + } if (object.uninterpretedOption) { if (!Array.isArray(object.uninterpretedOption)) throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); @@ -157854,6 +159736,7 @@ object.deprecated = false; object.features = null; object.debugRedact = false; + object.featureSupport = null; } if (message.deprecated != null && message.hasOwnProperty("deprecated")) object.deprecated = message.deprecated; @@ -157861,6 +159744,8 @@ object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) object.debugRedact = message.debugRedact; + if (message.featureSupport != null && message.hasOwnProperty("featureSupport")) + object.featureSupport = $root.google.protobuf.FieldOptions.FeatureSupport.toObject(message.featureSupport, options); if (message.uninterpretedOption && message.uninterpretedOption.length) { object.uninterpretedOption = []; for (var j = 0; j < message.uninterpretedOption.length; ++j) @@ -159300,6 +161185,8 @@ * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + * @property {google.protobuf.FeatureSet.EnforceNamingStyle|null} [enforceNamingStyle] FeatureSet enforceNamingStyle + * @property {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility|null} [defaultSymbolVisibility] FeatureSet defaultSymbolVisibility */ /** @@ -159365,6 +161252,22 @@ */ FeatureSet.prototype.jsonFormat = 0; + /** + * FeatureSet enforceNamingStyle. + * @member {google.protobuf.FeatureSet.EnforceNamingStyle} enforceNamingStyle + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enforceNamingStyle = 0; + + /** + * FeatureSet defaultSymbolVisibility. + * @member {google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility} defaultSymbolVisibility + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.defaultSymbolVisibility = 0; + /** * Creates a new FeatureSet instance using the specified properties. * @function create @@ -159401,6 +161304,10 @@ writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + if (message.enforceNamingStyle != null && Object.hasOwnProperty.call(message, "enforceNamingStyle")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.enforceNamingStyle); + if (message.defaultSymbolVisibility != null && Object.hasOwnProperty.call(message, "defaultSymbolVisibility")) + writer.uint32(/* id 8, wireType 0 =*/64).int32(message.defaultSymbolVisibility); return writer; }; @@ -159461,6 +161368,14 @@ message.jsonFormat = reader.int32(); break; } + case 7: { + message.enforceNamingStyle = reader.int32(); + break; + } + case 8: { + message.defaultSymbolVisibility = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -159551,6 +161466,26 @@ case 2: break; } + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + switch (message.enforceNamingStyle) { + default: + return "enforceNamingStyle: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + switch (message.defaultSymbolVisibility) { + default: + return "defaultSymbolVisibility: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + break; + } return null; }; @@ -159690,6 +161625,54 @@ message.jsonFormat = 2; break; } + switch (object.enforceNamingStyle) { + default: + if (typeof object.enforceNamingStyle === "number") { + message.enforceNamingStyle = object.enforceNamingStyle; + break; + } + break; + case "ENFORCE_NAMING_STYLE_UNKNOWN": + case 0: + message.enforceNamingStyle = 0; + break; + case "STYLE2024": + case 1: + message.enforceNamingStyle = 1; + break; + case "STYLE_LEGACY": + case 2: + message.enforceNamingStyle = 2; + break; + } + switch (object.defaultSymbolVisibility) { + default: + if (typeof object.defaultSymbolVisibility === "number") { + message.defaultSymbolVisibility = object.defaultSymbolVisibility; + break; + } + break; + case "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": + case 0: + message.defaultSymbolVisibility = 0; + break; + case "EXPORT_ALL": + case 1: + message.defaultSymbolVisibility = 1; + break; + case "EXPORT_TOP_LEVEL": + case 2: + message.defaultSymbolVisibility = 2; + break; + case "LOCAL_ALL": + case 3: + message.defaultSymbolVisibility = 3; + break; + case "STRICT": + case 4: + message.defaultSymbolVisibility = 4; + break; + } return message; }; @@ -159713,6 +161696,8 @@ object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + object.enforceNamingStyle = options.enums === String ? "ENFORCE_NAMING_STYLE_UNKNOWN" : 0; + object.defaultSymbolVisibility = options.enums === String ? "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN" : 0; } if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; @@ -159726,6 +161711,10 @@ object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + if (message.enforceNamingStyle != null && message.hasOwnProperty("enforceNamingStyle")) + object.enforceNamingStyle = options.enums === String ? $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] === undefined ? message.enforceNamingStyle : $root.google.protobuf.FeatureSet.EnforceNamingStyle[message.enforceNamingStyle] : message.enforceNamingStyle; + if (message.defaultSymbolVisibility != null && message.hasOwnProperty("defaultSymbolVisibility")) + object.defaultSymbolVisibility = options.enums === String ? $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] === undefined ? message.defaultSymbolVisibility : $root.google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility[message.defaultSymbolVisibility] : message.defaultSymbolVisibility; return object; }; @@ -159853,6 +161842,219 @@ return values; })(); + /** + * EnforceNamingStyle enum. + * @name google.protobuf.FeatureSet.EnforceNamingStyle + * @enum {number} + * @property {number} ENFORCE_NAMING_STYLE_UNKNOWN=0 ENFORCE_NAMING_STYLE_UNKNOWN value + * @property {number} STYLE2024=1 STYLE2024 value + * @property {number} STYLE_LEGACY=2 STYLE_LEGACY value + */ + FeatureSet.EnforceNamingStyle = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENFORCE_NAMING_STYLE_UNKNOWN"] = 0; + values[valuesById[1] = "STYLE2024"] = 1; + values[valuesById[2] = "STYLE_LEGACY"] = 2; + return values; + })(); + + FeatureSet.VisibilityFeature = (function() { + + /** + * Properties of a VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @interface IVisibilityFeature + */ + + /** + * Constructs a new VisibilityFeature. + * @memberof google.protobuf.FeatureSet + * @classdesc Represents a VisibilityFeature. + * @implements IVisibilityFeature + * @constructor + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + */ + function VisibilityFeature(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new VisibilityFeature instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature instance + */ + VisibilityFeature.create = function create(properties) { + return new VisibilityFeature(properties); + }; + + /** + * Encodes the specified VisibilityFeature message. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified VisibilityFeature message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.VisibilityFeature.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.IVisibilityFeature} message VisibilityFeature message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + VisibilityFeature.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet.VisibilityFeature(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a VisibilityFeature message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + VisibilityFeature.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a VisibilityFeature message. + * @function verify + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + VisibilityFeature.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a VisibilityFeature message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet.VisibilityFeature} VisibilityFeature + */ + VisibilityFeature.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet.VisibilityFeature) + return object; + return new $root.google.protobuf.FeatureSet.VisibilityFeature(); + }; + + /** + * Creates a plain object from a VisibilityFeature message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {google.protobuf.FeatureSet.VisibilityFeature} message VisibilityFeature + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + VisibilityFeature.toObject = function toObject() { + return {}; + }; + + /** + * Converts this VisibilityFeature to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @instance + * @returns {Object.} JSON object + */ + VisibilityFeature.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for VisibilityFeature + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet.VisibilityFeature + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + VisibilityFeature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet.VisibilityFeature"; + }; + + /** + * DefaultSymbolVisibility enum. + * @name google.protobuf.FeatureSet.VisibilityFeature.DefaultSymbolVisibility + * @enum {number} + * @property {number} DEFAULT_SYMBOL_VISIBILITY_UNKNOWN=0 DEFAULT_SYMBOL_VISIBILITY_UNKNOWN value + * @property {number} EXPORT_ALL=1 EXPORT_ALL value + * @property {number} EXPORT_TOP_LEVEL=2 EXPORT_TOP_LEVEL value + * @property {number} LOCAL_ALL=3 LOCAL_ALL value + * @property {number} STRICT=4 STRICT value + */ + VisibilityFeature.DefaultSymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN"] = 0; + values[valuesById[1] = "EXPORT_ALL"] = 1; + values[valuesById[2] = "EXPORT_TOP_LEVEL"] = 2; + values[valuesById[3] = "LOCAL_ALL"] = 3; + values[valuesById[4] = "STRICT"] = 4; + return values; + })(); + + return VisibilityFeature; + })(); + return FeatureSet; })(); @@ -160037,6 +162239,7 @@ default: return "minimumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -160054,6 +162257,7 @@ default: return "maximumEdition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -160102,6 +162306,10 @@ case 0: message.minimumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.minimumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.minimumEdition = 998; @@ -160154,6 +162362,10 @@ case 0: message.maximumEdition = 0; break; + case "EDITION_LEGACY": + case 900: + message.maximumEdition = 900; + break; case "EDITION_PROTO2": case 998: message.maximumEdition = 998; @@ -160262,7 +162474,8 @@ * @memberof google.protobuf.FeatureSetDefaults * @interface IFeatureSetEditionDefault * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition - * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + * @property {google.protobuf.IFeatureSet|null} [overridableFeatures] FeatureSetEditionDefault overridableFeatures + * @property {google.protobuf.IFeatureSet|null} [fixedFeatures] FeatureSetEditionDefault fixedFeatures */ /** @@ -160289,12 +162502,20 @@ FeatureSetEditionDefault.prototype.edition = 0; /** - * FeatureSetEditionDefault features. - * @member {google.protobuf.IFeatureSet|null|undefined} features + * FeatureSetEditionDefault overridableFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} overridableFeatures + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.overridableFeatures = null; + + /** + * FeatureSetEditionDefault fixedFeatures. + * @member {google.protobuf.IFeatureSet|null|undefined} fixedFeatures * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault * @instance */ - FeatureSetEditionDefault.prototype.features = null; + FeatureSetEditionDefault.prototype.fixedFeatures = null; /** * Creates a new FeatureSetEditionDefault instance using the specified properties. @@ -160320,10 +162541,12 @@ FeatureSetEditionDefault.encode = function encode(message, writer) { if (!writer) writer = $Writer.create(); - if (message.features != null && Object.hasOwnProperty.call(message, "features")) - $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + if (message.overridableFeatures != null && Object.hasOwnProperty.call(message, "overridableFeatures")) + $root.google.protobuf.FeatureSet.encode(message.overridableFeatures, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.fixedFeatures != null && Object.hasOwnProperty.call(message, "fixedFeatures")) + $root.google.protobuf.FeatureSet.encode(message.fixedFeatures, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -160364,8 +162587,12 @@ message.edition = reader.int32(); break; } - case 2: { - message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + case 4: { + message.overridableFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 5: { + message.fixedFeatures = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); break; } default: @@ -160408,6 +162635,7 @@ default: return "edition: enum value expected"; case 0: + case 900: case 998: case 999: case 1000: @@ -160420,10 +162648,15 @@ case 2147483647: break; } - if (message.features != null && message.hasOwnProperty("features")) { - var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.overridableFeatures); + if (error) + return "overridableFeatures." + error; + } + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) { + var error = $root.google.protobuf.FeatureSet.verify(message.fixedFeatures); if (error) - return "features." + error; + return "fixedFeatures." + error; } return null; }; @@ -160451,6 +162684,10 @@ case 0: message.edition = 0; break; + case "EDITION_LEGACY": + case 900: + message.edition = 900; + break; case "EDITION_PROTO2": case 998: message.edition = 998; @@ -160492,10 +162729,15 @@ message.edition = 2147483647; break; } - if (object.features != null) { - if (typeof object.features !== "object") - throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); - message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + if (object.overridableFeatures != null) { + if (typeof object.overridableFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.overridableFeatures: object expected"); + message.overridableFeatures = $root.google.protobuf.FeatureSet.fromObject(object.overridableFeatures); + } + if (object.fixedFeatures != null) { + if (typeof object.fixedFeatures !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fixedFeatures: object expected"); + message.fixedFeatures = $root.google.protobuf.FeatureSet.fromObject(object.fixedFeatures); } return message; }; @@ -160514,13 +162756,16 @@ options = {}; var object = {}; if (options.defaults) { - object.features = null; object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.overridableFeatures = null; + object.fixedFeatures = null; } - if (message.features != null && message.hasOwnProperty("features")) - object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); if (message.edition != null && message.hasOwnProperty("edition")) object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + if (message.overridableFeatures != null && message.hasOwnProperty("overridableFeatures")) + object.overridableFeatures = $root.google.protobuf.FeatureSet.toObject(message.overridableFeatures, options); + if (message.fixedFeatures != null && message.hasOwnProperty("fixedFeatures")) + object.fixedFeatures = $root.google.protobuf.FeatureSet.toObject(message.fixedFeatures, options); return object; }; @@ -161735,6 +163980,22 @@ return GeneratedCodeInfo; })(); + /** + * SymbolVisibility enum. + * @name google.protobuf.SymbolVisibility + * @enum {number} + * @property {number} VISIBILITY_UNSET=0 VISIBILITY_UNSET value + * @property {number} VISIBILITY_LOCAL=1 VISIBILITY_LOCAL value + * @property {number} VISIBILITY_EXPORT=2 VISIBILITY_EXPORT value + */ + protobuf.SymbolVisibility = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VISIBILITY_UNSET"] = 0; + values[valuesById[1] = "VISIBILITY_LOCAL"] = 1; + values[valuesById[2] = "VISIBILITY_EXPORT"] = 2; + return values; + })(); + protobuf.Duration = (function() { /** diff --git a/packages/google-cloud-sql/protos/protos.json b/packages/google-cloud-sql/protos/protos.json index bc666cfd4e7d..d3a8e054dbf8 100644 --- a/packages/google-cloud-sql/protos/protos.json +++ b/packages/google-cloud-sql/protos/protos.json @@ -1267,6 +1267,16 @@ "oneof": [ "pscEnabled" ] + }, + "_pscAutoDnsEnabled": { + "oneof": [ + "pscAutoDnsEnabled" + ] + }, + "_pscWriteEndpointDnsEnabled": { + "oneof": [ + "pscWriteEndpointDnsEnabled" + ] } }, "fields": { @@ -1299,6 +1309,22 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "pscAutoDnsEnabled": { + "type": "bool", + "id": 5, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } + }, + "pscWriteEndpointDnsEnabled": { + "type": "bool", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } } } }, @@ -1727,7 +1753,8 @@ "MANAGE_BACKUP": 50, "ENHANCED_BACKUP": 51, "REPAIR_READ_POOL": 52, - "CREATE_READ_POOL": 53 + "CREATE_READ_POOL": 53, + "PRE_CHECK_MAJOR_VERSION_UPGRADE": 54 } }, "SqlOperationStatus": { @@ -2101,6 +2128,13 @@ "proto3_optional": true } }, + "acceleratedReplicaMode": { + "type": "google.protobuf.BoolValue", + "id": 49, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "autoUpgradeEnabled": { "type": "bool", "id": 50, @@ -2667,6 +2701,7 @@ "POSTGRES_16": 272, "POSTGRES_17": 408, "POSTGRES_18": 557, + "POSTGRES_19": 684, "SQLSERVER_2019_STANDARD": 26, "SQLSERVER_2019_ENTERPRISE": 27, "SQLSERVER_2019_EXPRESS": 28, @@ -2674,7 +2709,10 @@ "SQLSERVER_2022_STANDARD": 199, "SQLSERVER_2022_ENTERPRISE": 200, "SQLSERVER_2022_EXPRESS": 201, - "SQLSERVER_2022_WEB": 202 + "SQLSERVER_2022_WEB": 202, + "SQLSERVER_2025_STANDARD": 549, + "SQLSERVER_2025_ENTERPRISE": 550, + "SQLSERVER_2025_EXPRESS": 551 } }, "SqlPricingPlan": { @@ -5191,6 +5229,11 @@ "oneof": [ "preferredSecondaryZone" ] + }, + "_region": { + "oneof": [ + "region" + ] } }, "fields": { @@ -5246,6 +5289,29 @@ "(google.api.field_behavior)": "OPTIONAL", "proto3_optional": true } + }, + "targetInstanceSettings": { + "type": "DatabaseInstance", + "id": 11, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "targetInstanceClearSettingsFieldNames": { + "rule": "repeated", + "type": "string", + "id": 12, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "region": { + "type": "string", + "id": 13, + "options": { + "(google.api.field_behavior)": "OPTIONAL", + "proto3_optional": true + } } } }, @@ -6608,7 +6674,8 @@ "BILLING_ISSUE": 2, "LEGAL_ISSUE": 3, "OPERATIONAL_ISSUE": 4, - "KMS_KEY_ISSUE": 5 + "KMS_KEY_ISSUE": 5, + "PROJECT_ABUSE": 8 } }, "SqlConnectService": { @@ -15951,8 +16018,7 @@ "java_multiple_files": true, "java_outer_classname": "FieldInfoProto", "java_package": "com.google.api", - "objc_class_prefix": "GAPI", - "cc_enable_arenas": true + "objc_class_prefix": "GAPI" }, "nested": { "http": { @@ -16076,6 +16142,10 @@ "rule": "repeated", "type": "ClientLibraryDestination", "id": 2 + }, + "selectiveGapicGeneration": { + "type": "SelectiveGapicGeneration", + "id": 3 } } }, @@ -16216,6 +16286,28 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "experimentalFeatures": { + "type": "ExperimentalFeatures", + "id": 2 + } + }, + "nested": { + "ExperimentalFeatures": { + "fields": { + "restAsyncIoEnabled": { + "type": "bool", + "id": 1 + }, + "protobufPythonicTypesEnabled": { + "type": "bool", + "id": 2 + }, + "unversionedPackageDisabled": { + "type": "bool", + "id": 3 + } + } } } }, @@ -16273,6 +16365,11 @@ "common": { "type": "CommonLanguageSettings", "id": 1 + }, + "renamedServices": { + "keyType": "string", + "type": "string", + "id": 2 } } }, @@ -16334,6 +16431,19 @@ "PACKAGE_MANAGER": 20 } }, + "SelectiveGapicGeneration": { + "fields": { + "methods": { + "rule": "repeated", + "type": "string", + "id": 1 + }, + "generateOmittedAsInternal": { + "type": "bool", + "id": 2 + } + } + }, "LaunchStage": { "values": { "LAUNCH_STAGE_UNSPECIFIED": 0, @@ -16455,6 +16565,11 @@ "format": { "type": "Format", "id": 1 + }, + "referencedTypes": { + "rule": "repeated", + "type": "TypeReference", + "id": 2 } }, "nested": { @@ -16468,6 +16583,14 @@ } } } + }, + "TypeReference": { + "fields": { + "typeName": { + "type": "string", + "id": 1 + } + } } } }, @@ -16490,12 +16613,19 @@ "type": "FileDescriptorProto", "id": 1 } - } + }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ] }, "Edition": { "edition": "proto2", "values": { "EDITION_UNKNOWN": 0, + "EDITION_LEGACY": 900, "EDITION_PROTO2": 998, "EDITION_PROTO3": 999, "EDITION_2023": 1000, @@ -16534,6 +16664,11 @@ "type": "int32", "id": 11 }, + "optionDependency": { + "rule": "repeated", + "type": "string", + "id": 15 + }, "messageType": { "rule": "repeated", "type": "DescriptorProto", @@ -16622,6 +16757,10 @@ "rule": "repeated", "type": "string", "id": 10 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 11 } }, "nested": { @@ -16847,6 +16986,10 @@ "rule": "repeated", "type": "string", "id": 5 + }, + "visibility": { + "type": "SymbolVisibility", + "id": 6 } }, "nested": { @@ -16897,7 +17040,14 @@ "type": "ServiceOptions", "id": 3 } - } + }, + "reserved": [ + [ + 4, + 4 + ], + "stream" + ] }, "MethodDescriptorProto": { "edition": "proto2", @@ -17061,6 +17211,7 @@ 42, 42 ], + "php_generic_services", [ 38, 38 @@ -17196,7 +17347,8 @@ "type": "bool", "id": 10, "options": { - "default": false + "default": false, + "deprecated": true } }, "debugRedact": { @@ -17224,6 +17376,10 @@ "type": "FeatureSet", "id": 21 }, + "featureSupport": { + "type": "FeatureSupport", + "id": 22 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -17293,6 +17449,26 @@ "id": 2 } } + }, + "FeatureSupport": { + "fields": { + "editionIntroduced": { + "type": "Edition", + "id": 1 + }, + "editionDeprecated": { + "type": "Edition", + "id": 2 + }, + "deprecationWarning": { + "type": "string", + "id": 3 + }, + "editionRemoved": { + "type": "Edition", + "id": 4 + } + } } } }, @@ -17381,6 +17557,10 @@ "default": false } }, + "featureSupport": { + "type": "FieldOptions.FeatureSupport", + "id": 4 + }, "uninterpretedOption": { "rule": "repeated", "type": "UninterpretedOption", @@ -17523,6 +17703,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_2023", "edition_defaults.value": "EXPLICIT" } @@ -17533,6 +17714,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "OPEN" } @@ -17543,6 +17725,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "PACKED" } @@ -17553,6 +17736,7 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "VERIFY" } @@ -17563,7 +17747,8 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", - "edition_defaults.edition": "EDITION_PROTO2", + "feature_support.edition_introduced": "EDITION_2023", + "edition_defaults.edition": "EDITION_LEGACY", "edition_defaults.value": "LENGTH_PREFIXED" } }, @@ -17573,27 +17758,38 @@ "options": { "retention": "RETENTION_RUNTIME", "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2023", "edition_defaults.edition": "EDITION_PROTO3", "edition_defaults.value": "ALLOW" } + }, + "enforceNamingStyle": { + "type": "EnforceNamingStyle", + "id": 7, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_METHOD", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "STYLE2024" + } + }, + "defaultSymbolVisibility": { + "type": "VisibilityFeature.DefaultSymbolVisibility", + "id": 8, + "options": { + "retention": "RETENTION_SOURCE", + "targets": "TARGET_TYPE_FILE", + "feature_support.edition_introduced": "EDITION_2024", + "edition_defaults.edition": "EDITION_2024", + "edition_defaults.value": "EXPORT_TOP_LEVEL" + } } }, "extensions": [ [ 1000, - 1000 - ], - [ - 1001, - 1001 - ], - [ - 1002, - 1002 - ], - [ - 9990, - 9990 + 9994 ], [ 9995, @@ -17638,7 +17834,13 @@ "UTF8_VALIDATION_UNKNOWN": 0, "VERIFY": 2, "NONE": 3 - } + }, + "reserved": [ + [ + 1, + 1 + ] + ] }, "MessageEncoding": { "values": { @@ -17653,6 +17855,33 @@ "ALLOW": 1, "LEGACY_BEST_EFFORT": 2 } + }, + "EnforceNamingStyle": { + "values": { + "ENFORCE_NAMING_STYLE_UNKNOWN": 0, + "STYLE2024": 1, + "STYLE_LEGACY": 2 + } + }, + "VisibilityFeature": { + "fields": {}, + "reserved": [ + [ + 1, + 536870911 + ] + ], + "nested": { + "DefaultSymbolVisibility": { + "values": { + "DEFAULT_SYMBOL_VISIBILITY_UNKNOWN": 0, + "EXPORT_ALL": 1, + "EXPORT_TOP_LEVEL": 2, + "LOCAL_ALL": 3, + "STRICT": 4 + } + } + } } } }, @@ -17680,11 +17909,26 @@ "type": "Edition", "id": 3 }, - "features": { + "overridableFeatures": { "type": "FeatureSet", - "id": 2 + "id": 4 + }, + "fixedFeatures": { + "type": "FeatureSet", + "id": 5 } - } + }, + "reserved": [ + [ + 1, + 1 + ], + [ + 2, + 2 + ], + "features" + ] } } }, @@ -17697,6 +17941,12 @@ "id": 1 } }, + "extensions": [ + [ + 536000000, + 536000000 + ] + ], "nested": { "Location": { "fields": { @@ -17782,6 +18032,14 @@ } } }, + "SymbolVisibility": { + "edition": "proto2", + "values": { + "VISIBILITY_UNSET": 0, + "VISIBILITY_LOCAL": 1, + "VISIBILITY_EXPORT": 2 + } + }, "Duration": { "fields": { "seconds": { diff --git a/packages/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json b/packages/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json index eebb8ef8de18..76103b57b6ed 100644 --- a/packages/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json +++ b/packages/google-cloud-sql/samples/generated/v1/snippet_metadata_google.cloud.sql.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-sql", - "version": "0.24.0", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js b/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js index 4f700337fe2c..e8213ce4277d 100644 --- a/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js +++ b/packages/google-cloud-sql/samples/generated/v1/sql_instances_service.clone.js @@ -34,7 +34,7 @@ function main(instance, project, body) { */ // const instance = 'abc123' /** - * Required. Project ID of the source as well as the clone Cloud SQL instance. + * Required. Project ID of the source Cloud SQL instance. */ // const project = 'my-project' /** diff --git a/packages/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json b/packages/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json index 477eae4f43d4..3806a1cf62ff 100644 --- a/packages/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json +++ b/packages/google-cloud-sql/samples/generated/v1beta4/snippet_metadata_google.cloud.sql.v1beta4.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-sql", - "version": "0.24.0", + "version": "0.1.0", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-sql/src/v1/index.ts b/packages/google-cloud-sql/src/v1/index.ts index fa8a89f713a8..3e843e173570 100644 --- a/packages/google-cloud-sql/src/v1/index.ts +++ b/packages/google-cloud-sql/src/v1/index.ts @@ -16,19 +16,19 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** - -export {SqlBackupRunsServiceClient} from './sql_backup_runs_service_client'; -export {SqlBackupsServiceClient} from './sql_backups_service_client'; -export {SqlConnectServiceClient} from './sql_connect_service_client'; -export {SqlDatabasesServiceClient} from './sql_databases_service_client'; - -export {SqlFeatureEligibilityServiceClient} from './sql_feature_eligibility_service_client'; -export {SqlFlagsServiceClient} from './sql_flags_service_client'; - - -export {SqlInstancesServiceClient} from './sql_instances_service_client'; -export {SqlOperationsServiceClient} from './sql_operations_service_client'; - -export {SqlSslCertsServiceClient} from './sql_ssl_certs_service_client'; -export {SqlTiersServiceClient} from './sql_tiers_service_client'; -export {SqlUsersServiceClient} from './sql_users_service_client'; +export { SqlAvailableDatabaseVersionsServiceClient } from './sql_available_database_versions_service_client'; +export { SqlBackupRunsServiceClient } from './sql_backup_runs_service_client'; +export { SqlBackupsServiceClient } from './sql_backups_service_client'; +export { SqlConnectServiceClient } from './sql_connect_service_client'; +export { SqlDatabasesServiceClient } from './sql_databases_service_client'; +export { SqlEventsServiceClient } from './sql_events_service_client'; +export { SqlFeatureEligibilityServiceClient } from './sql_feature_eligibility_service_client'; +export { SqlFlagsServiceClient } from './sql_flags_service_client'; +export { SqlIamPoliciesServiceClient } from './sql_iam_policies_service_client'; +export { SqlInstanceNamesServiceClient } from './sql_instance_names_service_client'; +export { SqlInstancesServiceClient } from './sql_instances_service_client'; +export { SqlOperationsServiceClient } from './sql_operations_service_client'; +export { SqlRegionsServiceClient } from './sql_regions_service_client'; +export { SqlSslCertsServiceClient } from './sql_ssl_certs_service_client'; +export { SqlTiersServiceClient } from './sql_tiers_service_client'; +export { SqlUsersServiceClient } from './sql_users_service_client'; diff --git a/packages/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts b/packages/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts index e6258c7ae72b..582b1c1f4ae2 100644 --- a/packages/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_backup_runs_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlBackupRunsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlBackupRunsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlBackupRunsServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlBackupRunsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlBackupRunsServiceClient. @@ -101,21 +108,42 @@ export class SqlBackupRunsServiceClient { * const client = new SqlBackupRunsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlBackupRunsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class SqlBackupRunsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +182,11 @@ export class SqlBackupRunsServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +208,17 @@ export class SqlBackupRunsServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlBackupRunsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlBackupRunsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,36 +249,40 @@ export class SqlBackupRunsServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlBackupRunsService. this.sqlBackupRunsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlBackupRunsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlBackupRunsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1.SqlBackupRunsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlBackupRunsServiceStubMethods = - ['delete', 'get', 'insert', 'list']; + const sqlBackupRunsServiceStubMethods = ['delete', 'get', 'insert', 'list']; for (const methodName of sqlBackupRunsServiceStubMethods) { const callPromise = this.sqlBackupRunsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -266,8 +297,14 @@ export class SqlBackupRunsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -278,8 +315,14 @@ export class SqlBackupRunsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -312,7 +355,7 @@ export class SqlBackupRunsServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -322,8 +365,9 @@ export class SqlBackupRunsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -334,413 +378,549 @@ export class SqlBackupRunsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Deletes the backup taken by a backup run. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.id - * The ID of the backup run to delete. To find a backup run ID, use the - * [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list) - * method. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backup_runs_service.delete.js - * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Delete_async - */ + /** + * Deletes the backup taken by a backup run. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.id + * The ID of the backup run to delete. To find a backup run ID, use the + * [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1/backupRuns/list) + * method. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backup_runs_service.delete.js + * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Delete_async + */ delete( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | undefined, + {} | undefined, + ] + >; delete( - request: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'id': request.id?.toString() ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + id: request.id?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('delete response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest|undefined, - {}|undefined - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a resource containing information about a backup run. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.id - * The ID of this backup run. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.BackupRun|BackupRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backup_runs_service.get.js - * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Get_async - */ + /** + * Retrieves a resource containing information about a backup run. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.id + * The ID of this backup run. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.BackupRun|BackupRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backup_runs_service.get.js + * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Get_async + */ get( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'id': request.id?.toString() ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + id: request.id?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IBackupRun, + | protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IBackupRun, - protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IBackupRun, + protos.google.cloud.sql.v1.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new backup run on demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.BackupRun} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backup_runs_service.insert.js - * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Insert_async - */ + /** + * Creates a new backup run on demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.BackupRun} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backup_runs_service.insert.js + * region_tag:sqladmin_v1_generated_SqlBackupRunsService_Insert_async + */ insert( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | undefined, + {} | undefined, + ] + >; insert( - request: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('insert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest|undefined, - {}|undefined - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlBackupRunsInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all backup runs associated with the project or a given instance - * and configuration in the reverse chronological order of the backup - * initiation time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID, or "-" for all instances. This does not include - * the project ID. - * @param {number} request.maxResults - * Maximum number of backup runs per response. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.BackupRunsListResponse|BackupRunsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backup_runs_service.list.js - * region_tag:sqladmin_v1_generated_SqlBackupRunsService_List_async - */ + /** + * Lists all backup runs associated with the project or a given instance + * and configuration in the reverse chronological order of the backup + * initiation time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID, or "-" for all instances. This does not include + * the project ID. + * @param {number} request.maxResults + * Maximum number of backup runs per response. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.BackupRunsListResponse|BackupRunsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backup_runs_service.list.js + * region_tag:sqladmin_v1_generated_SqlBackupRunsService_List_async + */ list( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlBackupRunsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IBackupRunsListResponse, + | protos.google.cloud.sql.v1.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IBackupRunsListResponse, - protos.google.cloud.sql.v1.ISqlBackupRunsListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IBackupRunsListResponse, + protos.google.cloud.sql.v1.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -775,12 +955,11 @@ export class SqlBackupRunsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -813,7 +992,7 @@ export class SqlBackupRunsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -829,7 +1008,7 @@ export class SqlBackupRunsServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -866,13 +1045,15 @@ export class SqlBackupRunsServiceClient { */ close(): Promise { if (this.sqlBackupRunsServiceStub && !this._terminated) { - return this.sqlBackupRunsServiceStub.then(stub => { + return this.sqlBackupRunsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1/sql_backups_service_client.ts b/packages/google-cloud-sql/src/v1/sql_backups_service_client.ts index e564a09bad51..1931f7ec4f63 100644 --- a/packages/google-cloud-sql/src/v1/sql_backups_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_backups_service_client.ts @@ -18,11 +18,20 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -43,7 +52,7 @@ export class SqlBackupsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -56,10 +65,10 @@ export class SqlBackupsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlBackupsServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlBackupsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlBackupsServiceClient. @@ -100,21 +109,42 @@ export class SqlBackupsServiceClient { * const client = new SqlBackupsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlBackupsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +169,7 @@ export class SqlBackupsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,15 +183,11 @@ export class SqlBackupsServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -183,10 +209,10 @@ export class SqlBackupsServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), }; @@ -194,14 +220,20 @@ export class SqlBackupsServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + listBackups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'backups', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlBackupsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlBackupsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -232,37 +264,46 @@ export class SqlBackupsServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlBackupsService. this.sqlBackupsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlBackupsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlBackupsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1.SqlBackupsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlBackupsServiceStubMethods = - ['createBackup', 'getBackup', 'listBackups', 'updateBackup', 'deleteBackup']; + const sqlBackupsServiceStubMethods = [ + 'createBackup', + 'getBackup', + 'listBackups', + 'updateBackup', + 'deleteBackup', + ]; for (const methodName of sqlBackupsServiceStubMethods) { const callPromise = this.sqlBackupsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -277,8 +318,14 @@ export class SqlBackupsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -289,8 +336,14 @@ export class SqlBackupsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -323,7 +376,7 @@ export class SqlBackupsServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -333,8 +386,9 @@ export class SqlBackupsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -345,490 +399,625 @@ export class SqlBackupsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates a backup for a Cloud SQL instance. This API can be used only to - * create on-demand backups. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this backup is created. - * Format: projects/{project} - * @param {google.cloud.sql.v1.Backup} request.backup - * Required. The Backup to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backups_service.create_backup.js - * region_tag:sqladmin_v1_generated_SqlBackupsService_CreateBackup_async - */ + /** + * Creates a backup for a Cloud SQL instance. This API can be used only to + * create on-demand backups. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this backup is created. + * Format: projects/{project} + * @param {google.cloud.sql.v1.Backup} request.backup + * Required. The Backup to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backups_service.create_backup.js + * region_tag:sqladmin_v1_generated_SqlBackupsService_CreateBackup_async + */ createBackup( - request?: protos.google.cloud.sql.v1.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ICreateBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | undefined, + {} | undefined, + ] + >; createBackup( - request: protos.google.cloud.sql.v1.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; createBackup( - request: protos.google.cloud.sql.v1.ICreateBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ICreateBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; createBackup( - request?: protos.google.cloud.sql.v1.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ICreateBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createBackup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createBackup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createBackup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ICreateBackupRequest|undefined, - {}|undefined - ]) => { - this._log.info('createBackup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ICreateBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a resource containing information about a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the backup to retrieve. - * Format: projects/{project}/backups/{backup} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Backup|Backup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backups_service.get_backup.js - * region_tag:sqladmin_v1_generated_SqlBackupsService_GetBackup_async - */ + /** + * Retrieves a resource containing information about a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the backup to retrieve. + * Format: projects/{project}/backups/{backup} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Backup|Backup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backups_service.get_backup.js + * region_tag:sqladmin_v1_generated_SqlBackupsService_GetBackup_async + */ getBackup( - request?: protos.google.cloud.sql.v1.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.IGetBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | undefined, + {} | undefined, + ] + >; getBackup( - request: protos.google.cloud.sql.v1.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; getBackup( - request: protos.google.cloud.sql.v1.IGetBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.IGetBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; getBackup( - request?: protos.google.cloud.sql.v1.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.IGetBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getBackup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getBackup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getBackup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IBackup, - protos.google.cloud.sql.v1.IGetBackupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getBackup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IBackup, + protos.google.cloud.sql.v1.IGetBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates the retention period and description of the backup. You can use - * this API to update final backups only. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.sql.v1.Backup} request.backup - * Required. The backup to update. - * The backup’s `name` field is used to identify the backup to update. - * Format: projects/{project}/backups/{backup} - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields that you can update. You can update only the description - * and retention period of the final backup. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backups_service.update_backup.js - * region_tag:sqladmin_v1_generated_SqlBackupsService_UpdateBackup_async - */ + /** + * Updates the retention period and description of the backup. You can use + * this API to update final backups only. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.sql.v1.Backup} request.backup + * Required. The backup to update. + * The backup’s `name` field is used to identify the backup to update. + * Format: projects/{project}/backups/{backup} + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields that you can update. You can update only the description + * and retention period of the final backup. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backups_service.update_backup.js + * region_tag:sqladmin_v1_generated_SqlBackupsService_UpdateBackup_async + */ updateBackup( - request?: protos.google.cloud.sql.v1.IUpdateBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.IUpdateBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined, + {} | undefined, + ] + >; updateBackup( - request: protos.google.cloud.sql.v1.IUpdateBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.IUpdateBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; updateBackup( - request: protos.google.cloud.sql.v1.IUpdateBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.IUpdateBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; updateBackup( - request?: protos.google.cloud.sql.v1.IUpdateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.IUpdateBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'backup.name': request.backup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'backup.name': request.backup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateBackup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateBackup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateBackup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IUpdateBackupRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateBackup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IUpdateBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes the backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the backup to delete. - * Format: projects/{project}/backups/{backup} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backups_service.delete_backup.js - * region_tag:sqladmin_v1_generated_SqlBackupsService_DeleteBackup_async - */ + /** + * Deletes the backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the backup to delete. + * Format: projects/{project}/backups/{backup} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backups_service.delete_backup.js + * region_tag:sqladmin_v1_generated_SqlBackupsService_DeleteBackup_async + */ deleteBackup( - request?: protos.google.cloud.sql.v1.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.IDeleteBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined, + {} | undefined, + ] + >; deleteBackup( - request: protos.google.cloud.sql.v1.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteBackup( - request: protos.google.cloud.sql.v1.IDeleteBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.IDeleteBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteBackup( - request?: protos.google.cloud.sql.v1.IDeleteBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.IDeleteBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteBackup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteBackup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteBackup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.IDeleteBackupRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteBackup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.IDeleteBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** - * Lists all backups associated with the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.sql.v1.Backup|Backup}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists all backups associated with the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.sql.v1.Backup|Backup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listBackups( - request?: protos.google.cloud.sql.v1.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IBackup[], - protos.google.cloud.sql.v1.IListBackupsRequest|null, - protos.google.cloud.sql.v1.IListBackupsResponse - ]>; + request?: protos.google.cloud.sql.v1.IListBackupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackup[], + protos.google.cloud.sql.v1.IListBackupsRequest | null, + protos.google.cloud.sql.v1.IListBackupsResponse, + ] + >; listBackups( - request: protos.google.cloud.sql.v1.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.sql.v1.IListBackupsRequest, - protos.google.cloud.sql.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.sql.v1.IBackup>): void; + request: protos.google.cloud.sql.v1.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.sql.v1.IListBackupsRequest, + protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1.IBackup + >, + ): void; listBackups( - request: protos.google.cloud.sql.v1.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.sql.v1.IListBackupsRequest, - protos.google.cloud.sql.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.sql.v1.IBackup>): void; + request: protos.google.cloud.sql.v1.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.sql.v1.IListBackupsRequest, + protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1.IBackup + >, + ): void; listBackups( - request?: protos.google.cloud.sql.v1.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.sql.v1.IListBackupsRequest, - protos.google.cloud.sql.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.sql.v1.IBackup>, - callback?: PaginationCallback< + request?: protos.google.cloud.sql.v1.IListBackupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.sql.v1.IListBackupsRequest, - protos.google.cloud.sql.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.sql.v1.IBackup>): - Promise<[ - protos.google.cloud.sql.v1.IBackup[], - protos.google.cloud.sql.v1.IListBackupsRequest|null, - protos.google.cloud.sql.v1.IListBackupsResponse - ]>|void { + protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1.IBackup + >, + callback?: PaginationCallback< + protos.google.cloud.sql.v1.IListBackupsRequest, + protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1.IBackup + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IBackup[], + protos.google.cloud.sql.v1.IListBackupsRequest | null, + protos.google.cloud.sql.v1.IListBackupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.sql.v1.IListBackupsRequest, - protos.google.cloud.sql.v1.IListBackupsResponse|null|undefined, - protos.google.cloud.sql.v1.IBackup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.sql.v1.IListBackupsRequest, + protos.google.cloud.sql.v1.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1.IBackup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listBackups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -837,137 +1026,142 @@ export class SqlBackupsServiceClient { this._log.info('listBackups request %j', request); return this.innerApiCalls .listBackups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.sql.v1.IBackup[], - protos.google.cloud.sql.v1.IListBackupsRequest|null, - protos.google.cloud.sql.v1.IListBackupsResponse - ]) => { - this._log.info('listBackups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.sql.v1.IBackup[], + protos.google.cloud.sql.v1.IListBackupsRequest | null, + protos.google.cloud.sql.v1.IListBackupsResponse, + ]) => { + this._log.info('listBackups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listBackups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.sql.v1.Backup|Backup} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listBackups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.sql.v1.Backup|Backup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listBackupsStream( - request?: protos.google.cloud.sql.v1.IListBackupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.sql.v1.IListBackupsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listBackups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listBackups stream %j', request); return this.descriptors.page.listBackups.createStream( this.innerApiCalls.listBackups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.sql.v1.Backup|Backup}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_backups_service.list_backups.js - * region_tag:sqladmin_v1_generated_SqlBackupsService_ListBackups_async - */ + /** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.sql.v1.Backup|Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_backups_service.list_backups.js + * region_tag:sqladmin_v1_generated_SqlBackupsService_ListBackups_async + */ listBackupsAsync( - request?: protos.google.cloud.sql.v1.IListBackupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.sql.v1.IListBackupsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listBackups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listBackups iterate %j', request); return this.descriptors.page.listBackups.asyncIterate( this.innerApiCalls['listBackups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } -/** + + /** * Gets information about a location. * * @param {Object} request @@ -1002,12 +1196,11 @@ export class SqlBackupsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -1040,7 +1233,7 @@ export class SqlBackupsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -1056,7 +1249,7 @@ export class SqlBackupsServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -1091,7 +1284,7 @@ export class SqlBackupsServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -1116,13 +1309,15 @@ export class SqlBackupsServiceClient { */ close(): Promise { if (this.sqlBackupsServiceStub && !this._terminated) { - return this.sqlBackupsServiceStub.then(stub => { + return this.sqlBackupsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1/sql_connect_service_client.ts b/packages/google-cloud-sql/src/v1/sql_connect_service_client.ts index 6c84fc9a1284..55bcc54b96ae 100644 --- a/packages/google-cloud-sql/src/v1/sql_connect_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_connect_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlConnectServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlConnectServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlConnectServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlConnectServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlConnectServiceClient. @@ -101,21 +108,42 @@ export class SqlConnectServiceClient { * const client = new SqlConnectServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlConnectServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class SqlConnectServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +182,11 @@ export class SqlConnectServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +208,17 @@ export class SqlConnectServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlConnectService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlConnectService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,36 +249,43 @@ export class SqlConnectServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlConnectService. this.sqlConnectServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlConnectService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlConnectService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1.SqlConnectService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlConnectServiceStubMethods = - ['getConnectSettings', 'generateEphemeralCert']; + const sqlConnectServiceStubMethods = [ + 'getConnectSettings', + 'generateEphemeralCert', + ]; for (const methodName of sqlConnectServiceStubMethods) { const callPromise = this.sqlConnectServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -266,8 +300,14 @@ export class SqlConnectServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -278,8 +318,14 @@ export class SqlConnectServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -312,7 +358,7 @@ export class SqlConnectServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -322,8 +368,9 @@ export class SqlConnectServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -334,217 +381,291 @@ export class SqlConnectServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Retrieves connect settings about a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.protobuf.Timestamp} [request.readTime] - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.ConnectSettings|ConnectSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_connect_service.get_connect_settings.js - * region_tag:sqladmin_v1_generated_SqlConnectService_GetConnectSettings_async - */ + /** + * Retrieves connect settings about a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.protobuf.Timestamp} [request.readTime] + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.ConnectSettings|ConnectSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_connect_service.get_connect_settings.js + * region_tag:sqladmin_v1_generated_SqlConnectService_GetConnectSettings_async + */ getConnectSettings( - request?: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | undefined, + {} | undefined, + ] + >; getConnectSettings( - request: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | null | undefined, + {} | null | undefined + >, + ): void; getConnectSettings( - request: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, - callback: Callback< - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, + callback: Callback< + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | null | undefined, + {} | null | undefined + >, + ): void; getConnectSettings( - request?: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.IGetConnectSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getConnectSettings request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IConnectSettings, + | protos.google.cloud.sql.v1.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getConnectSettings response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getConnectSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IConnectSettings, - protos.google.cloud.sql.v1.IGetConnectSettingsRequest|undefined, - {}|undefined - ]) => { - this._log.info('getConnectSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getConnectSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IConnectSettings, + protos.google.cloud.sql.v1.IGetConnectSettingsRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getConnectSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Generates a short-lived X509 certificate containing the provided public key - * and signed by a private key specific to the target instance. Users may use - * the certificate to authenticate as themselves when connecting to the - * database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.publicKey - * PEM encoded public key to include in the signed certificate. - * @param {string} [request.accessToken] - * Optional. Access token to include in the signed certificate. - * @param {google.protobuf.Timestamp} [request.readTime] - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - * @param {google.protobuf.Duration} [request.validDuration] - * Optional. If set, it will contain the cert valid duration. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.GenerateEphemeralCertResponse|GenerateEphemeralCertResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js - * region_tag:sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_async - */ + /** + * Generates a short-lived X509 certificate containing the provided public key + * and signed by a private key specific to the target instance. Users may use + * the certificate to authenticate as themselves when connecting to the + * database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.publicKey + * PEM encoded public key to include in the signed certificate. + * @param {string} [request.accessToken] + * Optional. Access token to include in the signed certificate. + * @param {google.protobuf.Timestamp} [request.readTime] + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + * @param {google.protobuf.Duration} [request.validDuration] + * Optional. If set, it will contain the cert valid duration. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.GenerateEphemeralCertResponse|GenerateEphemeralCertResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_connect_service.generate_ephemeral_cert.js + * region_tag:sqladmin_v1_generated_SqlConnectService_GenerateEphemeralCert_async + */ generateEphemeralCert( - request?: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest | undefined, + {} | undefined, + ] + >; generateEphemeralCert( - request: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; generateEphemeralCert( - request: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, - callback: Callback< - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, + callback: Callback< + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; generateEphemeralCert( - request?: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('generateEphemeralCert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('generateEphemeralCert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.generateEphemeralCert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest|undefined, - {}|undefined - ]) => { - this._log.info('generateEphemeralCert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .generateEphemeralCert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse, + protos.google.cloud.sql.v1.IGenerateEphemeralCertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('generateEphemeralCert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -579,12 +700,11 @@ export class SqlConnectServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -617,7 +737,7 @@ export class SqlConnectServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -633,7 +753,7 @@ export class SqlConnectServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -670,13 +790,15 @@ export class SqlConnectServiceClient { */ close(): Promise { if (this.sqlConnectServiceStub && !this._terminated) { - return this.sqlConnectServiceStub.then(stub => { + return this.sqlConnectServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1/sql_databases_service_client.ts b/packages/google-cloud-sql/src/v1/sql_databases_service_client.ts index 999cef663be5..6b679b46644a 100644 --- a/packages/google-cloud-sql/src/v1/sql_databases_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_databases_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlDatabasesServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlDatabasesServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlDatabasesServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlDatabasesServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlDatabasesServiceClient. @@ -101,21 +108,42 @@ export class SqlDatabasesServiceClient { * const client = new SqlDatabasesServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlDatabasesServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class SqlDatabasesServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +182,11 @@ export class SqlDatabasesServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +208,17 @@ export class SqlDatabasesServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlDatabasesService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlDatabasesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,36 +249,47 @@ export class SqlDatabasesServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlDatabasesService. this.sqlDatabasesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlDatabasesService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlDatabasesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1.SqlDatabasesService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlDatabasesServiceStubMethods = - ['delete', 'get', 'insert', 'list', 'patch', 'update']; + const sqlDatabasesServiceStubMethods = [ + 'delete', + 'get', + 'insert', + 'list', + 'patch', + 'update', + ]; for (const methodName of sqlDatabasesServiceStubMethods) { const callPromise = this.sqlDatabasesServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -266,8 +304,14 @@ export class SqlDatabasesServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -278,8 +322,14 @@ export class SqlDatabasesServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -312,7 +362,7 @@ export class SqlDatabasesServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -322,8 +372,9 @@ export class SqlDatabasesServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -334,611 +385,811 @@ export class SqlDatabasesServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Deletes a database from a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be deleted in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.delete.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_Delete_async - */ + /** + * Deletes a database from a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be deleted in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.delete.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_Delete_async + */ delete( - request?: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | undefined, + {} | undefined, + ] + >; delete( - request: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request?: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'database': request.database ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('delete response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest|undefined, - {}|undefined - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a resource containing information about a database inside a Cloud - * SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Database|Database}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.get.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_Get_async - */ + /** + * Retrieves a resource containing information about a database inside a Cloud + * SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Database|Database}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.get.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_Get_async + */ get( - request?: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlDatabasesGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'database': request.database ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IDatabase, - protos.google.cloud.sql.v1.ISqlDatabasesGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IDatabase, + protos.google.cloud.sql.v1.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Inserts a resource containing information about a database inside a Cloud - * SQL instance. - * - * **Note:** You can't modify the default character set and collation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.insert.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_Insert_async - */ + /** + * Inserts a resource containing information about a database inside a Cloud + * SQL instance. + * + * **Note:** You can't modify the default character set and collation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.insert.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_Insert_async + */ insert( - request?: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | undefined, + {} | undefined, + ] + >; insert( - request: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request?: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('insert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest|undefined, - {}|undefined - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists databases in the specified Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.DatabasesListResponse|DatabasesListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.list.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_List_async - */ + /** + * Lists databases in the specified Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.DatabasesListResponse|DatabasesListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.list.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_List_async + */ list( - request?: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlDatabasesListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IDatabasesListResponse, + | protos.google.cloud.sql.v1.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IDatabasesListResponse, - protos.google.cloud.sql.v1.ISqlDatabasesListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IDatabasesListResponse, + protos.google.cloud.sql.v1.ISqlDatabasesListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Partially updates a resource containing information about a database inside - * a Cloud SQL instance. This method supports patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be updated in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.patch.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_Patch_async - */ + /** + * Partially updates a resource containing information about a database inside + * a Cloud SQL instance. This method supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be updated in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.patch.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_Patch_async + */ patch( - request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + >; patch( - request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; patch( - request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; patch( - request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'database': request.database ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('patch request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('patch response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.patch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|undefined, - {}|undefined - ]) => { - this._log.info('patch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .patch(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ]) => { + this._log.info('patch response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a resource containing information about a database inside a Cloud - * SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be updated in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_databases_service.update.js - * region_tag:sqladmin_v1_generated_SqlDatabasesService_Update_async - */ + /** + * Updates a resource containing information about a database inside a Cloud + * SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be updated in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_databases_service.update.js + * region_tag:sqladmin_v1_generated_SqlDatabasesService_Update_async + */ update( - request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + >; update( - request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; update( - request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; update( - request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'database': request.database ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('update request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('update response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.update(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest|undefined, - {}|undefined - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -973,12 +1224,11 @@ export class SqlDatabasesServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -1011,7 +1261,7 @@ export class SqlDatabasesServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -1027,7 +1277,7 @@ export class SqlDatabasesServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -1064,13 +1314,15 @@ export class SqlDatabasesServiceClient { */ close(): Promise { if (this.sqlDatabasesServiceStub && !this._terminated) { - return this.sqlDatabasesServiceStub.then(stub => { + return this.sqlDatabasesServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts b/packages/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts index 15082a1ebb78..55b053d0a121 100644 --- a/packages/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_feature_eligibility_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlFeatureEligibilityServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlFeatureEligibilityServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlFeatureEligibilityServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlFeatureEligibilityServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlFeatureEligibilityServiceClient. @@ -101,21 +108,43 @@ export class SqlFeatureEligibilityServiceClient { * const client = new SqlFeatureEligibilityServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof SqlFeatureEligibilityServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + const staticMembers = this + .constructor as typeof SqlFeatureEligibilityServiceClient; + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +169,7 @@ export class SqlFeatureEligibilityServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +183,11 @@ export class SqlFeatureEligibilityServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +209,17 @@ export class SqlFeatureEligibilityServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlFeatureEligibilityService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlFeatureEligibilityService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,11 +250,16 @@ export class SqlFeatureEligibilityServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlFeatureEligibilityService. this.sqlFeatureEligibilityServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlFeatureEligibilityService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.sql.v1.SqlFeatureEligibilityService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlFeatureEligibilityService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.sql.v1 + .SqlFeatureEligibilityService, + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; return this.sqlFeatureEligibilityServiceStub; } @@ -237,8 +270,14 @@ export class SqlFeatureEligibilityServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -249,8 +288,14 @@ export class SqlFeatureEligibilityServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -290,8 +335,9 @@ export class SqlFeatureEligibilityServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -303,7 +349,7 @@ export class SqlFeatureEligibilityServiceClient { // -- Service calls -- // ------------------- -/** + /** * Gets information about a location. * * @param {Object} request @@ -338,12 +384,11 @@ export class SqlFeatureEligibilityServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -376,7 +421,7 @@ export class SqlFeatureEligibilityServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -392,7 +437,7 @@ export class SqlFeatureEligibilityServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -429,13 +474,15 @@ export class SqlFeatureEligibilityServiceClient { */ close(): Promise { if (this.sqlFeatureEligibilityServiceStub && !this._terminated) { - return this.sqlFeatureEligibilityServiceStub.then(stub => { + return this.sqlFeatureEligibilityServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1/sql_flags_service_client.ts b/packages/google-cloud-sql/src/v1/sql_flags_service_client.ts index deeadf3118b6..b30f40542afd 100644 --- a/packages/google-cloud-sql/src/v1/sql_flags_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_flags_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlFlagsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlFlagsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlFlagsServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlFlagsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlFlagsServiceClient. @@ -101,21 +108,42 @@ export class SqlFlagsServiceClient { * const client = new SqlFlagsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlFlagsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class SqlFlagsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +182,11 @@ export class SqlFlagsServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +208,17 @@ export class SqlFlagsServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlFlagsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlFlagsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,36 +249,40 @@ export class SqlFlagsServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlFlagsService. this.sqlFlagsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlFlagsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlFlagsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1.SqlFlagsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlFlagsServiceStubMethods = - ['list']; + const sqlFlagsServiceStubMethods = ['list']; for (const methodName of sqlFlagsServiceStubMethods) { const callPromise = this.sqlFlagsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -266,8 +297,14 @@ export class SqlFlagsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -278,8 +315,14 @@ export class SqlFlagsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -312,7 +355,7 @@ export class SqlFlagsServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -322,8 +365,9 @@ export class SqlFlagsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -334,101 +378,132 @@ export class SqlFlagsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Lists all available database flags for Cloud SQL instances. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.databaseVersion - * Database type and version you want to retrieve flags for. By default, this - * method returns flags for all database types and versions. - * @param {google.cloud.sql.v1.SqlFlagScope} [request.flagScope] - * Optional. Specify the scope of flags to be returned by SqlFlagsListService. - * Return list of database flags if unspecified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.FlagsListResponse|FlagsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_flags_service.list.js - * region_tag:sqladmin_v1_generated_SqlFlagsService_List_async - */ + /** + * Lists all available database flags for Cloud SQL instances. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.databaseVersion + * Database type and version you want to retrieve flags for. By default, this + * method returns flags for all database types and versions. + * @param {google.cloud.sql.v1.SqlFlagScope} [request.flagScope] + * Optional. Specify the scope of flags to be returned by SqlFlagsListService. + * Return list of database flags if unspecified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.FlagsListResponse|FlagsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_flags_service.list.js + * region_tag:sqladmin_v1_generated_SqlFlagsService_List_async + */ list( - request?: protos.google.cloud.sql.v1.ISqlFlagsListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlFlagsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1.ISqlFlagsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlFlagsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1.ISqlFlagsListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlFlagsListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1.ISqlFlagsListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlFlagsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IFlagsListResponse, - protos.google.cloud.sql.v1.ISqlFlagsListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IFlagsListResponse, + protos.google.cloud.sql.v1.ISqlFlagsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -463,12 +538,11 @@ export class SqlFlagsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -501,7 +575,7 @@ export class SqlFlagsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -517,7 +591,7 @@ export class SqlFlagsServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -554,13 +628,15 @@ export class SqlFlagsServiceClient { */ close(): Promise { if (this.sqlFlagsServiceStub && !this._terminated) { - return this.sqlFlagsServiceStub.then(stub => { + return this.sqlFlagsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1/sql_instances_service_client.ts b/packages/google-cloud-sql/src/v1/sql_instances_service_client.ts index 754b0a26a55a..e4e372e22ccb 100644 --- a/packages/google-cloud-sql/src/v1/sql_instances_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_instances_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -43,7 +50,7 @@ export class SqlInstancesServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -56,10 +63,10 @@ export class SqlInstancesServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlInstancesServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlInstancesServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlInstancesServiceClient. @@ -100,21 +107,42 @@ export class SqlInstancesServiceClient { * const client = new SqlInstancesServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlInstancesServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +167,7 @@ export class SqlInstancesServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,15 +181,11 @@ export class SqlInstancesServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -183,17 +207,20 @@ export class SqlInstancesServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}' + 'projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}', ), networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{network}' + 'projects/{project}/global/networks/{network}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlInstancesService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlInstancesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -224,36 +251,84 @@ export class SqlInstancesServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlInstancesService. this.sqlInstancesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlInstancesService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlInstancesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1.SqlInstancesService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlInstancesServiceStubMethods = - ['addServerCa', 'addServerCertificate', 'addEntraIdCertificate', 'clone', 'delete', 'demoteMaster', 'demote', 'export', 'failover', 'reencrypt', 'get', 'import', 'insert', 'list', 'listServerCas', 'listServerCertificates', 'listEntraIdCertificates', 'patch', 'promoteReplica', 'switchover', 'resetSslConfig', 'restart', 'restoreBackup', 'rotateServerCa', 'rotateServerCertificate', 'rotateEntraIdCertificate', 'startReplica', 'stopReplica', 'truncateLog', 'update', 'createEphemeral', 'rescheduleMaintenance', 'verifyExternalSyncSettings', 'startExternalSync', 'performDiskShrink', 'getDiskShrinkConfig', 'resetReplicaSize', 'getLatestRecoveryTime', 'executeSql', 'acquireSsrsLease', 'releaseSsrsLease', 'preCheckMajorVersionUpgrade', 'pointInTimeRestore']; + const sqlInstancesServiceStubMethods = [ + 'addServerCa', + 'addServerCertificate', + 'addEntraIdCertificate', + 'clone', + 'delete', + 'demoteMaster', + 'demote', + 'export', + 'failover', + 'reencrypt', + 'get', + 'import', + 'insert', + 'list', + 'listServerCas', + 'listServerCertificates', + 'listEntraIdCertificates', + 'patch', + 'promoteReplica', + 'switchover', + 'resetSslConfig', + 'restart', + 'restoreBackup', + 'rotateServerCa', + 'rotateServerCertificate', + 'rotateEntraIdCertificate', + 'startReplica', + 'stopReplica', + 'truncateLog', + 'update', + 'createEphemeral', + 'rescheduleMaintenance', + 'verifyExternalSyncSettings', + 'startExternalSync', + 'performDiskShrink', + 'getDiskShrinkConfig', + 'resetReplicaSize', + 'getLatestRecoveryTime', + 'executeSql', + 'acquireSsrsLease', + 'releaseSsrsLease', + 'preCheckMajorVersionUpgrade', + 'pointInTimeRestore', + ]; for (const methodName of sqlInstancesServiceStubMethods) { const callPromise = this.sqlInstancesServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -268,8 +343,14 @@ export class SqlInstancesServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -280,8 +361,14 @@ export class SqlInstancesServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -314,7 +401,7 @@ export class SqlInstancesServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -324,8 +411,9 @@ export class SqlInstancesServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -336,4348 +424,6190 @@ export class SqlInstancesServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Adds a new trusted Certificate Authority (CA) version for the specified - * instance. Required to prepare for a certificate rotation. If a CA version - * was previously added but never used in a certificate rotation, this - * operation replaces that version. There cannot be more than one CA version - * waiting to be rotated in. For instances that have enabled Certificate - * Authority Service (CAS) based server CA, use AddServerCertificate to add a - * new server certificate. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.add_server_ca.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_AddServerCa_async - */ + /** + * Adds a new trusted Certificate Authority (CA) version for the specified + * instance. Required to prepare for a certificate rotation. If a CA version + * was previously added but never used in a certificate rotation, this + * operation replaces that version. There cannot be more than one CA version + * waiting to be rotated in. For instances that have enabled Certificate + * Authority Service (CAS) based server CA, use AddServerCertificate to add a + * new server certificate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.add_server_ca.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_AddServerCa_async + */ addServerCa( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | undefined, + {} | undefined, + ] + >; addServerCa( - request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addServerCa( - request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addServerCa( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('addServerCa request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('addServerCa response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.addServerCa(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest|undefined, - {}|undefined - ]) => { - this._log.info('addServerCa response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .addServerCa(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addServerCa response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Add a new trusted server certificate version for the specified instance - * using Certificate Authority Service (CAS) server CA. Required to prepare - * for a certificate rotation. If a server certificate version was previously - * added but never used in a certificate rotation, this operation replaces - * that version. There cannot be more than one certificate version waiting to - * be rotated in. For instances not using CAS server CA, use AddServerCa - * instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.add_server_certificate.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_async - */ + /** + * Add a new trusted server certificate version for the specified instance + * using Certificate Authority Service (CAS) server CA. Required to prepare + * for a certificate rotation. If a server certificate version was previously + * added but never used in a certificate rotation, this operation replaces + * that version. There cannot be more than one certificate version waiting to + * be rotated in. For instances not using CAS server CA, use AddServerCa + * instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.add_server_certificate.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_AddServerCertificate_async + */ addServerCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ] + >; addServerCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addServerCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addServerCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('addServerCertificate request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('addServerCertificate response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.addServerCertificate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest|undefined, - {}|undefined - ]) => { - this._log.info('addServerCertificate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .addServerCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addServerCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Adds a new Entra ID certificate for the specified instance. If an Entra ID - * certificate was previously added but never used in a certificate rotation, - * this operation replaces that version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.add_entra_id_certificate.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_async - */ + /** + * Adds a new Entra ID certificate for the specified instance. If an Entra ID + * certificate was previously added but never used in a certificate rotation, + * this operation replaces that version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.add_entra_id_certificate.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_AddEntraIdCertificate_async + */ addEntraIdCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + >; addEntraIdCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addEntraIdCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addEntraIdCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('addEntraIdCertificate request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('addEntraIdCertificate response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.addEntraIdCertificate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest|undefined, - {}|undefined - ]) => { - this._log.info('addEntraIdCertificate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .addEntraIdCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addEntraIdCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a Cloud SQL instance as a clone of the source instance. Using this - * operation might cause your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. The ID of the Cloud SQL instance to be cloned (source). This does - * not include the project ID. - * @param {string} request.project - * Required. Project ID of the source as well as the clone Cloud SQL instance. - * @param {google.cloud.sql.v1.InstancesCloneRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.clone.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Clone_async - */ + /** + * Creates a Cloud SQL instance as a clone of the source instance. Using this + * operation might cause your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. The ID of the Cloud SQL instance to be cloned (source). This does + * not include the project ID. + * @param {string} request.project + * Required. Project ID of the source Cloud SQL instance. + * @param {google.cloud.sql.v1.InstancesCloneRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.clone.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Clone_async + */ clone( - request?: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ] + >; clone( - request: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, + {} | null | undefined + >, + ): void; clone( - request: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, + {} | null | undefined + >, + ): void; clone( - request?: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesCloneRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('clone request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('clone response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.clone(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesCloneRequest|undefined, - {}|undefined - ]) => { - this._log.info('clone response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .clone(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ]) => { + this._log.info('clone response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be deleted. - * @param {boolean} request.enableFinalBackup - * Flag to opt-in for final backup. By default, it is turned off. - * @param {number} [request.finalBackupTtlDays] - * Optional. Retention period of the final backup. - * @param {google.protobuf.Timestamp} [request.finalBackupExpiryTime] - * Optional. Final Backup expiration time. - * Timestamp in UTC of when this resource is considered expired. - * @param {string} [request.finalBackupDescription] - * Optional. The description of the final backup. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.delete.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Delete_async - */ + /** + * Deletes a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be deleted. + * @param {boolean} request.enableFinalBackup + * Flag to opt-in for final backup. By default, it is turned off. + * @param {number} [request.finalBackupTtlDays] + * Optional. Retention period of the final backup. + * @param {google.protobuf.Timestamp} [request.finalBackupExpiryTime] + * Optional. Final Backup expiration time. + * Timestamp in UTC of when this resource is considered expired. + * @param {string} [request.finalBackupDescription] + * Optional. The description of the final backup. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.delete.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Delete_async + */ delete( - request?: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined, + {} | undefined, + ] + >; delete( - request: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request?: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('delete response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest|undefined, - {}|undefined - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Demotes the stand-alone instance to be a Cloud SQL read replica for an - * external database server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance name. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesDemoteMasterRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.demote_master.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_DemoteMaster_async - */ + /** + * Demotes the stand-alone instance to be a Cloud SQL read replica for an + * external database server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance name. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesDemoteMasterRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.demote_master.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_DemoteMaster_async + */ demoteMaster( - request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | undefined, + {} | undefined, + ] + >; demoteMaster( - request: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): void; demoteMaster( - request: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): void; demoteMaster( - request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('demoteMaster request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('demoteMaster response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.demoteMaster(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest|undefined, - {}|undefined - ]) => { - this._log.info('demoteMaster response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .demoteMaster(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesDemoteMasterRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('demoteMaster response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Demotes an existing standalone instance to be a Cloud SQL read replica - * for an external database server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance name. - * @param {string} request.project - * Required. ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesDemoteRequest} request.body - * Required. The request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.demote.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Demote_async - */ - demote( - request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest|undefined, {}|undefined - ]>; - demote( - request: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest|null|undefined, - {}|null|undefined>): void; - demote( - request: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest|null|undefined, - {}|null|undefined>): void; + /** + * Demotes an existing standalone instance to be a Cloud SQL read replica + * for an external database server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance name. + * @param {string} request.project + * Required. ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesDemoteRequest} request.body + * Required. The request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.demote.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Demote_async + */ demote( - request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined, + {} | undefined, + ] + >; + demote( + request: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, + {} | null | undefined + >, + ): void; + demote( + request: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, + {} | null | undefined + >, + ): void; + demote( + request?: protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('demote request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('demote response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.demote(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest|undefined, - {}|undefined - ]) => { - this._log.info('demote response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .demote(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesDemoteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('demote response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL - * dump or CSV file. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be exported. - * @param {google.cloud.sql.v1.InstancesExportRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.export.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Export_async - */ + /** + * Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL + * dump or CSV file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be exported. + * @param {google.cloud.sql.v1.InstancesExportRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.export.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Export_async + */ export( - request?: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined, + {} | undefined, + ] + >; export( - request: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, + {} | null | undefined + >, + ): void; export( - request: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, + {} | null | undefined + >, + ): void; export( - request?: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesExportRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('export request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('export response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.export(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesExportRequest|undefined, - {}|undefined - ]) => { - this._log.info('export response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .export(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesExportRequest | undefined, + {} | undefined, + ]) => { + this._log.info('export response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Initiates a manual failover of a high availability (HA) primary instance - * to a standby instance, which becomes the primary instance. Users are - * then rerouted to the new primary. For more information, see the - * [Overview of high - * availability](https://cloud.google.com/sql/docs/mysql/high-availability) - * page in the Cloud SQL documentation. - * If using Legacy HA (MySQL only), this causes the instance to failover to - * its failover replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {google.cloud.sql.v1.InstancesFailoverRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.failover.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Failover_async - */ + /** + * Initiates a manual failover of a high availability (HA) primary instance + * to a standby instance, which becomes the primary instance. Users are + * then rerouted to the new primary. For more information, see the + * [Overview of high + * availability](https://cloud.google.com/sql/docs/mysql/high-availability) + * page in the Cloud SQL documentation. + * If using Legacy HA (MySQL only), this causes the instance to failover to + * its failover replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {google.cloud.sql.v1.InstancesFailoverRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.failover.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Failover_async + */ failover( - request?: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined, + {} | undefined, + ] + >; failover( - request: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; failover( - request: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; failover( - request?: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('failover request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('failover response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.failover(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest|undefined, - {}|undefined - ]) => { - this._log.info('failover response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .failover(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesFailoverRequest | undefined, + {} | undefined, + ]) => { + this._log.info('failover response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Reencrypt CMEK instance with latest key version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesReencryptRequest} request.body - * Reencrypt body that users request - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.reencrypt.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Reencrypt_async - */ + /** + * Reencrypt CMEK instance with latest key version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesReencryptRequest} request.body + * Reencrypt body that users request + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.reencrypt.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Reencrypt_async + */ reencrypt( - request?: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined, + {} | undefined, + ] + >; reencrypt( - request: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): void; reencrypt( - request: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): void; reencrypt( - request?: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('reencrypt request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('reencrypt response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.reencrypt(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest|undefined, - {}|undefined - ]) => { - this._log.info('reencrypt response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .reencrypt(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesReencryptRequest | undefined, + {} | undefined, + ]) => { + this._log.info('reencrypt response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a resource containing information about a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Database instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.DatabaseInstance|DatabaseInstance}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.get.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Get_async - */ + /** + * Retrieves a resource containing information about a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Database instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.DatabaseInstance|DatabaseInstance}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.get.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Get_async + */ get( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IDatabaseInstance, - protos.google.cloud.sql.v1.ISqlInstancesGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IDatabaseInstance, + protos.google.cloud.sql.v1.ISqlInstancesGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Imports data into a Cloud SQL instance from a SQL dump or CSV file in - * Cloud Storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesImportRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.import.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Import_async - */ + /** + * Imports data into a Cloud SQL instance from a SQL dump or CSV file in + * Cloud Storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesImportRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.import.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Import_async + */ import( - request?: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined, + {} | undefined, + ] + >; import( - request: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, + {} | null | undefined + >, + ): void; import( - request: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, + {} | null | undefined + >, + ): void; import( - request?: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesImportRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('import request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('import response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.import(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesImportRequest|undefined, - {}|undefined - ]) => { - this._log.info('import response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .import(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesImportRequest | undefined, + {} | undefined, + ]) => { + this._log.info('import response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Project ID of the project to which the newly created Cloud SQL instances - * should belong. - * @param {google.cloud.sql.v1.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.insert.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Insert_async - */ + /** + * Creates a new Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.project + * Project ID of the project to which the newly created Cloud SQL instances + * should belong. + * @param {google.cloud.sql.v1.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.insert.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Insert_async + */ insert( - request?: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined, + {} | undefined, + ] + >; insert( - request: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request?: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('insert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesInsertRequest|undefined, - {}|undefined - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists instances under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. - * The expression is in the form of field:value. For example, - * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per - * their JSON representation, such as 'settings.userLabels.auto_start:true'. - * - * Multiple filter queries are space-separated. For example. - * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each - * expression is an AND expression. However, you can include AND and OR - * expressions explicitly. - * @param {number} request.maxResults - * The maximum number of instances to return. The service may return fewer - * than this value. - * If unspecified, at most 500 instances are returned. - * The maximum value is 1000; values above 1000 are coerced to 1000. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project for which to list Cloud SQL instances. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListResponse|InstancesListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.list.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_List_async - */ - list( - request?: protos.google.cloud.sql.v1.ISqlInstancesListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest|undefined, {}|undefined - ]>; - list( - request: protos.google.cloud.sql.v1.ISqlInstancesListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest|null|undefined, - {}|null|undefined>): void; + /** + * Lists instances under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.filter + * A filter expression that filters resources listed in the response. + * The expression is in the form of field:value. For example, + * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per + * their JSON representation, such as 'settings.userLabels.auto_start:true'. + * + * Multiple filter queries are space-separated. For example. + * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each + * expression is an AND expression. However, you can include AND and OR + * expressions explicitly. + * @param {number} request.maxResults + * The maximum number of instances to return. The service may return fewer + * than this value. + * If unspecified, at most 500 instances are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project for which to list Cloud SQL instances. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListResponse|InstancesListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.list.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_List_async + */ list( - request: protos.google.cloud.sql.v1.ISqlInstancesListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest|null|undefined, - {}|null|undefined>): void; + request?: protos.google.cloud.sql.v1.ISqlInstancesListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined, + {} | undefined, + ] + >; list( - request?: protos.google.cloud.sql.v1.ISqlInstancesListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request: protos.google.cloud.sql.v1.ISqlInstancesListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request: protos.google.cloud.sql.v1.ISqlInstancesListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, + {} | null | undefined + >, + ): void; + list( + request?: protos.google.cloud.sql.v1.ISqlInstancesListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IInstancesListResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IInstancesListResponse, - protos.google.cloud.sql.v1.ISqlInstancesListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IInstancesListResponse, + protos.google.cloud.sql.v1.ISqlInstancesListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all of the trusted Certificate Authorities (CAs) for the specified - * instance. There can be up to three CAs listed: the CA that was used to sign - * the certificate that is currently in use, a CA that has been added but not - * yet used to sign a certificate, and a CA used to sign a certificate that - * has previously rotated out. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListServerCasResponse|InstancesListServerCasResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.list_server_cas.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ListServerCas_async - */ + /** + * Lists all of the trusted Certificate Authorities (CAs) for the specified + * instance. There can be up to three CAs listed: the CA that was used to sign + * the certificate that is currently in use, a CA that has been added but not + * yet used to sign a certificate, and a CA used to sign a certificate that + * has previously rotated out. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListServerCasResponse|InstancesListServerCasResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.list_server_cas.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ListServerCas_async + */ listServerCas( - request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | undefined, + {} | undefined, + ] + >; listServerCas( - request: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listServerCas( - request: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listServerCas( - request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listServerCas request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listServerCas response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listServerCas(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest|undefined, - {}|undefined - ]) => { - this._log.info('listServerCas response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listServerCas(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IInstancesListServerCasResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListServerCasRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listServerCas response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all versions of server certificates and certificate authorities (CAs) - * for the specified instance. There can be up to three sets of certs listed: - * the certificate that is currently in use, a future that has been added but - * not yet used to sign a certificate, and a certificate that has been rotated - * out. For instances not using Certificate Authority Service (CAS) server CA, - * use ListServerCas instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse|InstancesListServerCertificatesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.list_server_certificates.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_async - */ + /** + * Lists all versions of server certificates and certificate authorities (CAs) + * for the specified instance. There can be up to three sets of certs listed: + * the certificate that is currently in use, a future that has been added but + * not yet used to sign a certificate, and a certificate that has been rotated + * out. For instances not using Certificate Authority Service (CAS) server CA, + * use ListServerCas instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse|InstancesListServerCertificatesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.list_server_certificates.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ListServerCertificates_async + */ listServerCertificates( - request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ] + >; listServerCertificates( - request: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listServerCertificates( - request: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listServerCertificates( - request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listServerCertificates request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listServerCertificates response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listServerCertificates(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest|undefined, - {}|undefined - ]) => { - this._log.info('listServerCertificates response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listServerCertificates(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listServerCertificates response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all versions of EntraID certificates for the specified instance. - * There can be up to three sets of certificates listed: the certificate that - * is currently in use, a future that has been added but not yet used to sign - * a certificate, and a certificate that has been rotated out. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse|InstancesListEntraIdCertificatesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.list_entra_id_certificates.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_async - */ + /** + * Lists all versions of EntraID certificates for the specified instance. + * There can be up to three sets of certificates listed: the certificate that + * is currently in use, a future that has been added but not yet used to sign + * a certificate, and a certificate that has been rotated out. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse|InstancesListEntraIdCertificatesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.list_entra_id_certificates.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ListEntraIdCertificates_async + */ listEntraIdCertificates( - request?: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ] + >; listEntraIdCertificates( - request: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listEntraIdCertificates( - request: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, - callback: Callback< - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, + callback: Callback< + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listEntraIdCertificates( - request?: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listEntraIdCertificates request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listEntraIdCertificates response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listEntraIdCertificates(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest|undefined, - {}|undefined - ]) => { - this._log.info('listEntraIdCertificates response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listEntraIdCertificates(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listEntraIdCertificates response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Partially updates settings of a Cloud SQL instance by merging the request - * with the current configuration. This method supports patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.patch.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Patch_async - */ + /** + * Partially updates settings of a Cloud SQL instance by merging the request + * with the current configuration. This method supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.patch.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Patch_async + */ patch( - request?: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ] + >; patch( - request: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, + {} | null | undefined + >, + ): void; patch( - request: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, + {} | null | undefined + >, + ): void; patch( - request?: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesPatchRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('patch request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('patch response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.patch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPatchRequest|undefined, - {}|undefined - ]) => { - this._log.info('patch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .patch(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ]) => { + this._log.info('patch response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Promotes the read replica instance to be an independent Cloud SQL - * primary instance. - * Using this operation might cause your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {boolean} request.failover - * Set to true to invoke a replica failover to the DR - * replica. As part of replica failover, the promote operation attempts - * to add the original primary instance as a replica of the promoted - * DR replica when the original primary instance comes back online. - * If set to false or not specified, then the original primary - * instance becomes an independent Cloud SQL primary instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.promote_replica.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_PromoteReplica_async - */ + /** + * Promotes the read replica instance to be an independent Cloud SQL + * primary instance. + * Using this operation might cause your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {boolean} request.failover + * Set to true to invoke a replica failover to the DR + * replica. As part of replica failover, the promote operation attempts + * to add the original primary instance as a replica of the promoted + * DR replica when the original primary instance comes back online. + * If set to false or not specified, then the original primary + * instance becomes an independent Cloud SQL primary instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.promote_replica.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_PromoteReplica_async + */ promoteReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | undefined, + {} | undefined, + ] + >; promoteReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; promoteReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; promoteReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('promoteReplica request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('promoteReplica response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.promoteReplica(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest|undefined, - {}|undefined - ]) => { - this._log.info('promoteReplica response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .promoteReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPromoteReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('promoteReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Switches over from the primary instance to the DR replica - * instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the replica. - * @param {google.protobuf.Duration} [request.dbTimeout] - * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations - * timeout, which is a sum of all database operations. Default value is 10 - * minutes and can be modified to a maximum value of 24 hours. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.switchover.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Switchover_async - */ + /** + * Switches over from the primary instance to the DR replica + * instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the replica. + * @param {google.protobuf.Duration} [request.dbTimeout] + * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations + * timeout, which is a sum of all database operations. Default value is 10 + * minutes and can be modified to a maximum value of 24 hours. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.switchover.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Switchover_async + */ switchover( - request?: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined, + {} | undefined, + ] + >; switchover( - request: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; switchover( - request: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; switchover( - request?: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('switchover request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('switchover response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.switchover(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest|undefined, - {}|undefined - ]) => { - this._log.info('switchover response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .switchover(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesSwitchoverRequest | undefined, + {} | undefined, + ]) => { + this._log.info('switchover response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes all client certificates and generates a new server SSL certificate - * for the instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode} [request.mode] - * Optional. Reset SSL mode to use. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.reset_ssl_config.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_async - */ + /** + * Deletes all client certificates and generates a new server SSL certificate + * for the instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.SqlInstancesResetSslConfigRequest.ResetSslMode} [request.mode] + * Optional. Reset SSL mode to use. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.reset_ssl_config.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ResetSslConfig_async + */ resetSslConfig( - request?: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | undefined, + {} | undefined, + ] + >; resetSslConfig( - request: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; resetSslConfig( - request: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; resetSslConfig( - request?: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('resetSslConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('resetSslConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.resetSslConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('resetSslConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .resetSslConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesResetSslConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resetSslConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Restarts a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be restarted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.restart.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Restart_async - */ + /** + * Restarts a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be restarted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.restart.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Restart_async + */ restart( - request?: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined, + {} | undefined, + ] + >; restart( - request: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, + {} | null | undefined + >, + ): void; restart( - request: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, + {} | null | undefined + >, + ): void; restart( - request?: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesRestartRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('restart request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('restart response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.restart(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestartRequest|undefined, - {}|undefined - ]) => { - this._log.info('restart response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .restart(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestartRequest | undefined, + {} | undefined, + ]) => { + this._log.info('restart response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Restores a backup of a Cloud SQL instance. Using this operation might cause - * your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesRestoreBackupRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.restore_backup.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_RestoreBackup_async - */ + /** + * Restores a backup of a Cloud SQL instance. Using this operation might cause + * your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesRestoreBackupRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.restore_backup.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_RestoreBackup_async + */ restoreBackup( - request?: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | undefined, + {} | undefined, + ] + >; restoreBackup( - request: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; restoreBackup( - request: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; restoreBackup( - request?: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('restoreBackup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('restoreBackup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.restoreBackup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest|undefined, - {}|undefined - ]) => { - this._log.info('restoreBackup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .restoreBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRestoreBackupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('restoreBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Rotates the server certificate to one signed by the Certificate Authority - * (CA) version previously added with the addServerCA method. For instances - * that have enabled Certificate Authority Service (CAS) based server CA, - * use RotateServerCertificate to rotate the server certificate. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesRotateServerCaRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.rotate_server_ca.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateServerCa_async - */ + /** + * Rotates the server certificate to one signed by the Certificate Authority + * (CA) version previously added with the addServerCA method. For instances + * that have enabled Certificate Authority Service (CAS) based server CA, + * use RotateServerCertificate to rotate the server certificate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesRotateServerCaRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.rotate_server_ca.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateServerCa_async + */ rotateServerCa( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | undefined, + {} | undefined, + ] + >; rotateServerCa( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateServerCa( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateServerCa( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('rotateServerCa request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('rotateServerCa response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.rotateServerCa(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest|undefined, - {}|undefined - ]) => { - this._log.info('rotateServerCa response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .rotateServerCa(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateServerCa response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Rotates the server certificate version to one previously added with the - * addServerCertificate method. For instances not using Certificate Authority - * Service (CAS) server CA, use RotateServerCa instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} [request.body] - * Optional. Rotate server certificate request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.rotate_server_certificate.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_async - */ + /** + * Rotates the server certificate version to one previously added with the + * addServerCertificate method. For instances not using Certificate Authority + * Service (CAS) server CA, use RotateServerCa instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesRotateServerCertificateRequest} [request.body] + * Optional. Rotate server certificate request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.rotate_server_certificate.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateServerCertificate_async + */ rotateServerCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ] + >; rotateServerCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateServerCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateServerCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('rotateServerCertificate request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('rotateServerCertificate response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.rotateServerCertificate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest|undefined, - {}|undefined - ]) => { - this._log.info('rotateServerCertificate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .rotateServerCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateServerCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Rotates the server certificate version to one previously added with the - * addEntraIdCertificate method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} [request.body] - * Optional. Rotate Entra ID certificate request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_async - */ + /** + * Rotates the server certificate version to one previously added with the + * addEntraIdCertificate method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesRotateEntraIdCertificateRequest} [request.body] + * Optional. Rotate Entra ID certificate request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.rotate_entra_id_certificate.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_RotateEntraIdCertificate_async + */ rotateEntraIdCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + >; rotateEntraIdCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateEntraIdCertificate( - request: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateEntraIdCertificate( - request?: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('rotateEntraIdCertificate request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('rotateEntraIdCertificate response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.rotateEntraIdCertificate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest|undefined, - {}|undefined - ]) => { - this._log.info('rotateEntraIdCertificate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .rotateEntraIdCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateEntraIdCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Starts the replication in the read replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.start_replica.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_StartReplica_async - */ + /** + * Starts the replication in the read replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.start_replica.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_StartReplica_async + */ startReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | undefined, + {} | undefined, + ] + >; startReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('startReplica request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('startReplica response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.startReplica(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest|undefined, - {}|undefined - ]) => { - this._log.info('startReplica response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .startReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesStartReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Stops the replication in the read replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.stop_replica.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_StopReplica_async - */ + /** + * Stops the replication in the read replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.stop_replica.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_StopReplica_async + */ stopReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | undefined, + {} | undefined, + ] + >; stopReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; stopReplica( - request: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; stopReplica( - request?: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('stopReplica request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('stopReplica response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.stopReplica(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest|undefined, - {}|undefined - ]) => { - this._log.info('stopReplica response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .stopReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesStopReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('stopReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Truncate MySQL general and slow query log tables - * MySQL only. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the Cloud SQL project. - * @param {google.cloud.sql.v1.InstancesTruncateLogRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.truncate_log.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_TruncateLog_async - */ + /** + * Truncate MySQL general and slow query log tables + * MySQL only. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the Cloud SQL project. + * @param {google.cloud.sql.v1.InstancesTruncateLogRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.truncate_log.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_TruncateLog_async + */ truncateLog( - request?: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | undefined, + {} | undefined, + ] + >; truncateLog( - request: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): void; truncateLog( - request: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): void; truncateLog( - request?: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('truncateLog request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('truncateLog response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.truncateLog(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest|undefined, - {}|undefined - ]) => { - this._log.info('truncateLog response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .truncateLog(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesTruncateLogRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('truncateLog response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates settings of a Cloud SQL instance. Using this operation might cause - * your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.update.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_Update_async - */ + /** + * Updates settings of a Cloud SQL instance. Using this operation might cause + * your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.update.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_Update_async + */ update( - request?: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined, + {} | undefined, + ] + >; update( - request: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; update( - request: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; update( - request?: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('update request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('update response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.update(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest|undefined, - {}|undefined - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlInstancesUpdateRequest | undefined, + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Generates a short-lived X509 certificate containing the provided public key - * and signed by a private key specific to the target instance. Users may use - * the certificate to authenticate as themselves when connecting to the - * database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the Cloud SQL project. - * @param {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCert|SslCert}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.create_ephemeral.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_async - */ + /** + * Generates a short-lived X509 certificate containing the provided public key + * and signed by a private key specific to the target instance. Users may use + * the certificate to authenticate as themselves when connecting to the + * database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the Cloud SQL project. + * @param {google.cloud.sql.v1.SslCertsCreateEphemeralRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCert|SslCert}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.create_ephemeral.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_CreateEphemeral_async + */ createEphemeral( - request?: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCert, + ( + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ] + >; createEphemeral( - request: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISslCert, + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createEphemeral( - request: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISslCert, + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createEphemeral( - request?: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISslCert, + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCert, + ( + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createEphemeral request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISslCert, + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createEphemeral response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createEphemeral(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest|undefined, - {}|undefined - ]) => { - this._log.info('createEphemeral response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createEphemeral(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISslCert, + ( + | protos.google.cloud.sql.v1.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createEphemeral response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Reschedules the maintenance on the given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.reschedule_maintenance.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_async - */ + /** + * Reschedules the maintenance on the given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequestBody} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.reschedule_maintenance.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_RescheduleMaintenance_async + */ rescheduleMaintenance( - request?: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ] + >; rescheduleMaintenance( - request: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rescheduleMaintenance( - request: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rescheduleMaintenance( - request?: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('rescheduleMaintenance request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('rescheduleMaintenance response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.rescheduleMaintenance(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest|undefined, - {}|undefined - ]) => { - this._log.info('rescheduleMaintenance response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .rescheduleMaintenance(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rescheduleMaintenance response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Verify External primary instance external sync settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {boolean} request.verifyConnectionOnly - * Flag to enable verifying connection only - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode - * External sync mode - * @param {boolean} [request.verifyReplicationOnly] - * Optional. Flag to verify settings required by replication setup only - * @param {google.cloud.sql.v1.MySqlSyncConfig} [request.mysqlSyncConfig] - * Optional. MySQL-specific settings for start external sync. - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - * @param {google.cloud.sql.v1.ExternalSyncParallelLevel} [request.syncParallelLevel] - * Optional. Parallel level for initial data sync. Only applicable for - * PostgreSQL. - * @param {number[]} [request.selectedObjects] - * Optional. Migrate only the specified objects from the source instance. If - * this field is empty, then migrate all objects. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse|SqlInstancesVerifyExternalSyncSettingsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.verify_external_sync_settings.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_async - */ + /** + * Verify External primary instance external sync settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {boolean} request.verifyConnectionOnly + * Flag to enable verifying connection only + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode + * External sync mode + * @param {boolean} [request.verifyReplicationOnly] + * Optional. Flag to verify settings required by replication setup only + * @param {google.cloud.sql.v1.MySqlSyncConfig} [request.mysqlSyncConfig] + * Optional. MySQL-specific settings for start external sync. + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + * @param {google.cloud.sql.v1.ExternalSyncParallelLevel} [request.syncParallelLevel] + * Optional. Parallel level for initial data sync. Only applicable for + * PostgreSQL. + * @param {number[]} [request.selectedObjects] + * Optional. Migrate only the specified objects from the source instance. If + * this field is empty, then migrate all objects. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse|SqlInstancesVerifyExternalSyncSettingsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.verify_external_sync_settings.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_VerifyExternalSyncSettings_async + */ verifyExternalSyncSettings( - request?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ] + >; verifyExternalSyncSettings( - request: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; verifyExternalSyncSettings( - request: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; verifyExternalSyncSettings( - request?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('verifyExternalSyncSettings request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('verifyExternalSyncSettings response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.verifyExternalSyncSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest|undefined, - {}|undefined - ]) => { - this._log.info('verifyExternalSyncSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .verifyExternalSyncSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('verifyExternalSyncSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Start External primary instance migration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode - * External sync mode. - * @param {boolean} request.skipVerification - * Whether to skip the verification step (VESS). - * @param {google.cloud.sql.v1.MySqlSyncConfig} request.mysqlSyncConfig - * MySQL-specific settings for start external sync. - * @param {google.cloud.sql.v1.ExternalSyncParallelLevel} [request.syncParallelLevel] - * Optional. Parallel level for initial data sync. Currently only applicable - * for MySQL. - * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - * @param {boolean} [request.replicaOverwriteEnabled] - * Optional. MySQL only. True if end-user has confirmed that this SES call - * will wipe replica databases overlapping with the proposed selected_objects. - * If this field is not set and there are both overlapping and additional - * databases proposed, an error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.start_external_sync.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_StartExternalSync_async - */ + /** + * Start External primary instance migration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode + * External sync mode. + * @param {boolean} request.skipVerification + * Whether to skip the verification step (VESS). + * @param {google.cloud.sql.v1.MySqlSyncConfig} request.mysqlSyncConfig + * MySQL-specific settings for start external sync. + * @param {google.cloud.sql.v1.ExternalSyncParallelLevel} [request.syncParallelLevel] + * Optional. Parallel level for initial data sync. Currently only applicable + * for MySQL. + * @param {google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + * @param {boolean} [request.replicaOverwriteEnabled] + * Optional. MySQL only. True if end-user has confirmed that this SES call + * will wipe replica databases overlapping with the proposed selected_objects. + * If this field is not set and there are both overlapping and additional + * databases proposed, an error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.start_external_sync.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_StartExternalSync_async + */ startExternalSync( - request?: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ] + >; startExternalSync( - request: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startExternalSync( - request: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startExternalSync( - request?: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('startExternalSync request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('startExternalSync response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.startExternalSync(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest|undefined, - {}|undefined - ]) => { - this._log.info('startExternalSync response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .startExternalSync(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startExternalSync response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Perform Disk Shrink on primary instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.PerformDiskShrinkContext} request.body - * Perform disk shrink context. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.perform_disk_shrink.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_async - */ + /** + * Perform Disk Shrink on primary instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.PerformDiskShrinkContext} request.body + * Perform disk shrink context. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.perform_disk_shrink.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_PerformDiskShrink_async + */ performDiskShrink( - request?: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ] + >; performDiskShrink( - request: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): void; performDiskShrink( - request: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): void; performDiskShrink( - request?: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('performDiskShrink request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('performDiskShrink response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.performDiskShrink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest|undefined, - {}|undefined - ]) => { - this._log.info('performDiskShrink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .performDiskShrink(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('performDiskShrink response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Get Disk Shrink Config for a given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse|SqlInstancesGetDiskShrinkConfigResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.get_disk_shrink_config.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_async - */ + /** + * Get Disk Shrink Config for a given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse|SqlInstancesGetDiskShrinkConfigResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.get_disk_shrink_config.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_GetDiskShrinkConfig_async + */ getDiskShrinkConfig( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ] + >; getDiskShrinkConfig( - request: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDiskShrinkConfig( - request: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDiskShrinkConfig( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDiskShrinkConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDiskShrinkConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDiskShrinkConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDiskShrinkConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDiskShrinkConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDiskShrinkConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Reset Replica Size to primary instance disk size. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.reset_replica_size.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_async - */ + /** + * Reset Replica Size to primary instance disk size. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.reset_replica_size.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ResetReplicaSize_async + */ resetReplicaSize( - request?: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ] + >; resetReplicaSize( - request: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; resetReplicaSize( - request: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; resetReplicaSize( - request?: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('resetReplicaSize request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('resetReplicaSize response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.resetReplicaSize(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest|undefined, - {}|undefined - ]) => { - this._log.info('resetReplicaSize response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .resetReplicaSize(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resetReplicaSize response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Get Latest Recovery Time for a given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.protobuf.Timestamp} request.sourceInstanceDeletionTime - * The timestamp used to identify the time when the source instance is - * deleted. If this instance is deleted, then you must set the timestamp. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse|SqlInstancesGetLatestRecoveryTimeResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.get_latest_recovery_time.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_async - */ + /** + * Get Latest Recovery Time for a given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.protobuf.Timestamp} request.sourceInstanceDeletionTime + * The timestamp used to identify the time when the source instance is + * deleted. If this instance is deleted, then you must set the timestamp. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse|SqlInstancesGetLatestRecoveryTimeResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.get_latest_recovery_time.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_GetLatestRecoveryTime_async + */ getLatestRecoveryTime( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ] + >; getLatestRecoveryTime( - request: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getLatestRecoveryTime( - request: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getLatestRecoveryTime( - request?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getLatestRecoveryTime request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getLatestRecoveryTime response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getLatestRecoveryTime(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest|undefined, - {}|undefined - ]) => { - this._log.info('getLatestRecoveryTime response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getLatestRecoveryTime(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getLatestRecoveryTime response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Execute SQL statements. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Database instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.ExecuteSqlPayload} request.body - * The request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse|SqlInstancesExecuteSqlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.execute_sql.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ExecuteSql_async - */ + /** + * Execute SQL statements. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Database instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.ExecuteSqlPayload} request.body + * The request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse|SqlInstancesExecuteSqlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.execute_sql.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ExecuteSql_async + */ executeSql( - request?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest | undefined, + {} | undefined, + ] + >; executeSql( - request: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): void; executeSql( - request: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): void; executeSql( - request?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('executeSql request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('executeSql response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.executeSql(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest|undefined, - {}|undefined - ]) => { - this._log.info('executeSql response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .executeSql(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse, + protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlRequest | undefined, + {} | undefined, + ]) => { + this._log.info('executeSql response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Acquire a lease for the setup of SQL Server Reporting Services (SSRS). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This doesn't include the project ID. It's - * composed of lowercase letters, numbers, and hyphens, and it must start with - * a letter. The total length must be 98 characters or less (Example: - * instance-id). - * @param {string} request.project - * Required. Project ID of the project that contains the instance (Example: - * project-id). - * @param {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} request.body - * Required. The request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse|SqlInstancesAcquireSsrsLeaseResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_async - */ + /** + * Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This doesn't include the project ID. It's + * composed of lowercase letters, numbers, and hyphens, and it must start with + * a letter. The total length must be 98 characters or less (Example: + * instance-id). + * @param {string} request.project + * Required. Project ID of the project that contains the instance (Example: + * project-id). + * @param {google.cloud.sql.v1.InstancesAcquireSsrsLeaseRequest} request.body + * Required. The request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse|SqlInstancesAcquireSsrsLeaseResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.acquire_ssrs_lease.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_AcquireSsrsLease_async + */ acquireSsrsLease( - request?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + >; acquireSsrsLease( - request: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; acquireSsrsLease( - request: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; acquireSsrsLease( - request?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('acquireSsrsLease request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('acquireSsrsLease response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.acquireSsrsLease(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest|undefined, - {}|undefined - ]) => { - this._log.info('acquireSsrsLease response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .acquireSsrsLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('acquireSsrsLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Release a lease for the setup of SQL Server Reporting Services (SSRS). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. The Cloud SQL instance ID. This doesn't include the project ID. - * The instance ID contains lowercase letters, numbers, and hyphens, and it - * must start with a letter. This ID can have a maximum length of 98 - * characters. - * @param {string} request.project - * Required. The project ID that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse|SqlInstancesReleaseSsrsLeaseResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.release_ssrs_lease.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_async - */ + /** + * Release a lease for the setup of SQL Server Reporting Services (SSRS). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. The Cloud SQL instance ID. This doesn't include the project ID. + * The instance ID contains lowercase letters, numbers, and hyphens, and it + * must start with a letter. This ID can have a maximum length of 98 + * characters. + * @param {string} request.project + * Required. The project ID that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse|SqlInstancesReleaseSsrsLeaseResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.release_ssrs_lease.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_ReleaseSsrsLease_async + */ releaseSsrsLease( - request?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + >; releaseSsrsLease( - request: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; releaseSsrsLease( - request: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; releaseSsrsLease( - request?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('releaseSsrsLease request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('releaseSsrsLease response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.releaseSsrsLease(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest|undefined, - {}|undefined - ]) => { - this._log.info('releaseSsrsLease response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .releaseSsrsLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('releaseSsrsLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Execute MVU Pre-checks - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} request.body - * Required. The context for request to perform the pre-check major version - * upgrade operation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async - */ + /** + * Execute MVU Pre-checks + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.InstancesPreCheckMajorVersionUpgradeRequest} request.body + * Required. The context for request to perform the pre-check major version + * upgrade operation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.pre_check_major_version_upgrade.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async + */ preCheckMajorVersionUpgrade( - request?: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ] + >; preCheckMajorVersionUpgrade( - request: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; preCheckMajorVersionUpgrade( - request: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; preCheckMajorVersionUpgrade( - request?: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('preCheckMajorVersionUpgrade request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('preCheckMajorVersionUpgrade response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.preCheckMajorVersionUpgrade(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest|undefined, - {}|undefined - ]) => { - this._log.info('preCheckMajorVersionUpgrade response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .preCheckMajorVersionUpgrade(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('preCheckMajorVersionUpgrade response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Point in time restore for an instance managed by Google Cloud Backup and - * Disaster Recovery. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where you created this instance. - * Format: projects/{project} - * @param {google.cloud.sql.v1.PointInTimeRestoreContext} request.context - * Required. The context for request to perform a PITR on a Google Cloud - * Backup and Disaster Recovery managed instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_instances_service.point_in_time_restore.js - * region_tag:sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_async - */ + /** + * Point in time restore for an instance managed by Google Cloud Backup and + * Disaster Recovery. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where you created this instance. + * Format: projects/{project} + * @param {google.cloud.sql.v1.PointInTimeRestoreContext} request.context + * Required. The context for request to perform a PITR on a Google Cloud + * Backup and Disaster Recovery managed instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_instances_service.point_in_time_restore.js + * region_tag:sqladmin_v1_generated_SqlInstancesService_PointInTimeRestore_async + */ pointInTimeRestore( - request?: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ] + >; pointInTimeRestore( - request: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): void; pointInTimeRestore( - request: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): void; pointInTimeRestore( - request?: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('pointInTimeRestore request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('pointInTimeRestore response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.pointInTimeRestore(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest|undefined, - {}|undefined - ]) => { - this._log.info('pointInTimeRestore response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .pointInTimeRestore(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + ( + | protos.google.cloud.sql.v1.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('pointInTimeRestore response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -4712,12 +6642,11 @@ export class SqlInstancesServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -4750,7 +6679,7 @@ export class SqlInstancesServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -4769,7 +6698,13 @@ export class SqlInstancesServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,location:string,backupvault:string,datasource:string,backup:string) { + backupPath( + project: string, + location: string, + backupvault: string, + datasource: string, + backup: string, + ) { return this.pathTemplates.backupPathTemplate.render({ project: project, location: location, @@ -4841,7 +6776,7 @@ export class SqlInstancesServiceClient { * @param {string} network * @returns {string} Resource name string. */ - networkPath(project:string,network:string) { + networkPath(project: string, network: string) { return this.pathTemplates.networkPathTemplate.render({ project: project, network: network, @@ -4878,13 +6813,15 @@ export class SqlInstancesServiceClient { */ close(): Promise { if (this.sqlInstancesServiceStub && !this._terminated) { - return this.sqlInstancesServiceStub.then(stub => { + return this.sqlInstancesServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1/sql_operations_service_client.ts b/packages/google-cloud-sql/src/v1/sql_operations_service_client.ts index d027e27c654b..4d9599d37c13 100644 --- a/packages/google-cloud-sql/src/v1/sql_operations_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_operations_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlOperationsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlOperationsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlOperationsServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlOperationsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlOperationsServiceClient. @@ -101,21 +108,42 @@ export class SqlOperationsServiceClient { * const client = new SqlOperationsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlOperationsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class SqlOperationsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +182,11 @@ export class SqlOperationsServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +208,17 @@ export class SqlOperationsServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlOperationsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlOperationsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,36 +249,40 @@ export class SqlOperationsServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlOperationsService. this.sqlOperationsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlOperationsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlOperationsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1.SqlOperationsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlOperationsServiceStubMethods = - ['get', 'list', 'cancel']; + const sqlOperationsServiceStubMethods = ['get', 'list', 'cancel']; for (const methodName of sqlOperationsServiceStubMethods) { const callPromise = this.sqlOperationsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -266,8 +297,14 @@ export class SqlOperationsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -278,8 +315,14 @@ export class SqlOperationsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -312,7 +355,7 @@ export class SqlOperationsServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -322,8 +365,9 @@ export class SqlOperationsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -334,304 +378,406 @@ export class SqlOperationsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Retrieves an instance operation that has been performed on an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Required. Instance operation ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_operations_service.get.js - * region_tag:sqladmin_v1_generated_SqlOperationsService_Get_async - */ + /** + * Retrieves an instance operation that has been performed on an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.operation + * Required. Instance operation ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_operations_service.get.js + * region_tag:sqladmin_v1_generated_SqlOperationsService_Get_async + */ get( - request?: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlOperationsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'operation': request.operation ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + operation: request.operation ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlOperationsGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlOperationsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all instance operations that have been performed on the given Cloud - * SQL instance in the reverse chronological order of the start time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {number} request.maxResults - * Maximum number of operations per response. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.OperationsListResponse|OperationsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_operations_service.list.js - * region_tag:sqladmin_v1_generated_SqlOperationsService_List_async - */ + /** + * Lists all instance operations that have been performed on the given Cloud + * SQL instance in the reverse chronological order of the start time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {number} request.maxResults + * Maximum number of operations per response. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.OperationsListResponse|OperationsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_operations_service.list.js + * region_tag:sqladmin_v1_generated_SqlOperationsService_List_async + */ list( - request?: protos.google.cloud.sql.v1.ISqlOperationsListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlOperationsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1.ISqlOperationsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlOperationsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1.ISqlOperationsListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlOperationsListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1.ISqlOperationsListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlOperationsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperationsListResponse, + | protos.google.cloud.sql.v1.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperationsListResponse, - protos.google.cloud.sql.v1.ISqlOperationsListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperationsListResponse, + protos.google.cloud.sql.v1.ISqlOperationsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Cancels an instance operation that has been performed on an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Instance operation ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_operations_service.cancel.js - * region_tag:sqladmin_v1_generated_SqlOperationsService_Cancel_async - */ + /** + * Cancels an instance operation that has been performed on an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.operation + * Instance operation ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_operations_service.cancel.js + * region_tag:sqladmin_v1_generated_SqlOperationsService_Cancel_async + */ cancel( - request?: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | undefined, + {} | undefined, + ] + >; cancel( - request: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, + {} | null | undefined + >, + ): void; cancel( - request: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, + {} | null | undefined + >, + ): void; cancel( - request?: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlOperationsCancelRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'operation': request.operation ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + operation: request.operation ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('cancel request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('cancel response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.cancel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1.ISqlOperationsCancelRequest|undefined, - {}|undefined - ]) => { - this._log.info('cancel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .cancel(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1.ISqlOperationsCancelRequest | undefined, + {} | undefined, + ]) => { + this._log.info('cancel response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -666,12 +812,11 @@ export class SqlOperationsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -704,7 +849,7 @@ export class SqlOperationsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -720,7 +865,7 @@ export class SqlOperationsServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -757,13 +902,15 @@ export class SqlOperationsServiceClient { */ close(): Promise { if (this.sqlOperationsServiceStub && !this._terminated) { - return this.sqlOperationsServiceStub.then(stub => { + return this.sqlOperationsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts b/packages/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts index df2bb53abd2d..e820b8c0dff9 100644 --- a/packages/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_ssl_certs_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlSslCertsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlSslCertsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlSslCertsServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlSslCertsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlSslCertsServiceClient. @@ -101,21 +108,42 @@ export class SqlSslCertsServiceClient { * const client = new SqlSslCertsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlSslCertsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class SqlSslCertsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +182,11 @@ export class SqlSslCertsServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +208,17 @@ export class SqlSslCertsServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlSslCertsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlSslCertsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,36 +249,40 @@ export class SqlSslCertsServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlSslCertsService. this.sqlSslCertsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlSslCertsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlSslCertsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1.SqlSslCertsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlSslCertsServiceStubMethods = - ['delete', 'get', 'insert', 'list']; + const sqlSslCertsServiceStubMethods = ['delete', 'get', 'insert', 'list']; for (const methodName of sqlSslCertsServiceStubMethods) { const callPromise = this.sqlSslCertsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -266,8 +297,14 @@ export class SqlSslCertsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -278,8 +315,14 @@ export class SqlSslCertsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -312,7 +355,7 @@ export class SqlSslCertsServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -322,8 +365,9 @@ export class SqlSslCertsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -334,408 +378,536 @@ export class SqlSslCertsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Deletes the SSL certificate. For First Generation instances, the - * certificate remains valid until the instance is restarted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.sha1Fingerprint - * Sha1 FingerPrint. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_ssl_certs_service.delete.js - * region_tag:sqladmin_v1_generated_SqlSslCertsService_Delete_async - */ + /** + * Deletes the SSL certificate. For First Generation instances, the + * certificate remains valid until the instance is restarted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.sha1Fingerprint + * Sha1 FingerPrint. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_ssl_certs_service.delete.js + * region_tag:sqladmin_v1_generated_SqlSslCertsService_Delete_async + */ delete( - request?: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ] + >; delete( - request: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request?: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'sha1_fingerprint': request.sha1Fingerprint ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + sha1_fingerprint: request.sha1Fingerprint ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + | protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('delete response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest|undefined, - {}|undefined - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a particular SSL certificate. Does not include the private key - * (required for usage). The private key must be saved from the response to - * initial creation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.sha1Fingerprint - * Sha1 FingerPrint. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCert|SslCert}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_ssl_certs_service.get.js - * region_tag:sqladmin_v1_generated_SqlSslCertsService_Get_async - */ + /** + * Retrieves a particular SSL certificate. Does not include the private key + * (required for usage). The private key must be saved from the response to + * initial creation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.sha1Fingerprint + * Sha1 FingerPrint. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCert|SslCert}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_ssl_certs_service.get.js + * region_tag:sqladmin_v1_generated_SqlSslCertsService_Get_async + */ get( - request?: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlSslCertsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'sha1_fingerprint': request.sha1Fingerprint ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + sha1_fingerprint: request.sha1Fingerprint ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISslCert, - protos.google.cloud.sql.v1.ISqlSslCertsGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISslCert, + protos.google.cloud.sql.v1.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates an SSL certificate and returns it along with the private key and - * server certificate authority. The new certificate will not be usable until - * the instance is restarted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.SslCertsInsertRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCertsInsertResponse|SslCertsInsertResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_ssl_certs_service.insert.js - * region_tag:sqladmin_v1_generated_SqlSslCertsService_Insert_async - */ + /** + * Creates an SSL certificate and returns it along with the private key and + * server certificate authority. The new certificate will not be usable until + * the instance is restarted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.SslCertsInsertRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCertsInsertResponse|SslCertsInsertResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_ssl_certs_service.insert.js + * region_tag:sqladmin_v1_generated_SqlSslCertsService_Insert_async + */ insert( - request?: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ] + >; insert( - request: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request?: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('insert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISslCertsInsertResponse, - protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest|undefined, - {}|undefined - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISslCertsInsertResponse, + protos.google.cloud.sql.v1.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all of the current SSL certificates for the instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCertsListResponse|SslCertsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_ssl_certs_service.list.js - * region_tag:sqladmin_v1_generated_SqlSslCertsService_List_async - */ + /** + * Lists all of the current SSL certificates for the instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.SslCertsListResponse|SslCertsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_ssl_certs_service.list.js + * region_tag:sqladmin_v1_generated_SqlSslCertsService_List_async + */ list( - request?: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, - callback: Callback< - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, + callback: Callback< + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlSslCertsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ISslCertsListResponse, - protos.google.cloud.sql.v1.ISqlSslCertsListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ISslCertsListResponse, + protos.google.cloud.sql.v1.ISqlSslCertsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -770,12 +942,11 @@ export class SqlSslCertsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -808,7 +979,7 @@ export class SqlSslCertsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -824,7 +995,7 @@ export class SqlSslCertsServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -861,13 +1032,15 @@ export class SqlSslCertsServiceClient { */ close(): Promise { if (this.sqlSslCertsServiceStub && !this._terminated) { - return this.sqlSslCertsServiceStub.then(stub => { + return this.sqlSslCertsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1/sql_tiers_service_client.ts b/packages/google-cloud-sql/src/v1/sql_tiers_service_client.ts index f8c5bac50336..559916f53617 100644 --- a/packages/google-cloud-sql/src/v1/sql_tiers_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_tiers_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlTiersServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlTiersServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlTiersServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlTiersServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlTiersServiceClient. @@ -101,21 +108,42 @@ export class SqlTiersServiceClient { * const client = new SqlTiersServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlTiersServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class SqlTiersServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +182,11 @@ export class SqlTiersServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +208,17 @@ export class SqlTiersServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlTiersService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlTiersService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,36 +249,40 @@ export class SqlTiersServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlTiersService. this.sqlTiersServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlTiersService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlTiersService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1.SqlTiersService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlTiersServiceStubMethods = - ['list']; + const sqlTiersServiceStubMethods = ['list']; for (const methodName of sqlTiersServiceStubMethods) { const callPromise = this.sqlTiersServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -266,8 +297,14 @@ export class SqlTiersServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -278,8 +315,14 @@ export class SqlTiersServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -312,7 +355,7 @@ export class SqlTiersServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -322,8 +365,9 @@ export class SqlTiersServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -334,104 +378,134 @@ export class SqlTiersServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Lists all available machine types (tiers) for Cloud SQL, for example, - * `db-custom-1-3840`. For more information, see - * https://cloud.google.com/sql/pricing. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Project ID of the project for which to list tiers. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.TiersListResponse|TiersListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_tiers_service.list.js - * region_tag:sqladmin_v1_generated_SqlTiersService_List_async - */ + /** + * Lists all available machine types (tiers) for Cloud SQL, for example, + * `db-custom-1-3840`. For more information, see + * https://cloud.google.com/sql/pricing. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.project + * Project ID of the project for which to list tiers. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.TiersListResponse|TiersListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_tiers_service.list.js + * region_tag:sqladmin_v1_generated_SqlTiersService_List_async + */ list( - request?: protos.google.cloud.sql.v1.ISqlTiersListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlTiersListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1.ISqlTiersListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlTiersListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1.ISqlTiersListRequest, - callback: Callback< - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlTiersListRequest, + callback: Callback< + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1.ISqlTiersListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlTiersListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.ITiersListResponse, - protos.google.cloud.sql.v1.ISqlTiersListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.ITiersListResponse, + protos.google.cloud.sql.v1.ISqlTiersListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -466,12 +540,11 @@ export class SqlTiersServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -504,7 +577,7 @@ export class SqlTiersServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -520,7 +593,7 @@ export class SqlTiersServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -557,13 +630,15 @@ export class SqlTiersServiceClient { */ close(): Promise { if (this.sqlTiersServiceStub && !this._terminated) { - return this.sqlTiersServiceStub.then(stub => { + return this.sqlTiersServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1/sql_users_service_client.ts b/packages/google-cloud-sql/src/v1/sql_users_service_client.ts index 9550f405ca02..4ef6422ba951 100644 --- a/packages/google-cloud-sql/src/v1/sql_users_service_client.ts +++ b/packages/google-cloud-sql/src/v1/sql_users_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlUsersServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlUsersServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlUsersServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlUsersServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlUsersServiceClient. @@ -101,21 +108,42 @@ export class SqlUsersServiceClient { * const client = new SqlUsersServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlUsersServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class SqlUsersServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +182,11 @@ export class SqlUsersServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +208,17 @@ export class SqlUsersServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1.SqlUsersService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1.SqlUsersService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,36 +249,46 @@ export class SqlUsersServiceClient { // Put together the "service stub" for // google.cloud.sql.v1.SqlUsersService. this.sqlUsersServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1.SqlUsersService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1.SqlUsersService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1.SqlUsersService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlUsersServiceStubMethods = - ['delete', 'get', 'insert', 'list', 'update']; + const sqlUsersServiceStubMethods = [ + 'delete', + 'get', + 'insert', + 'list', + 'update', + ]; for (const methodName of sqlUsersServiceStubMethods) { const callPromise = this.sqlUsersServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -266,8 +303,14 @@ export class SqlUsersServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -278,8 +321,14 @@ export class SqlUsersServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -312,7 +361,7 @@ export class SqlUsersServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -322,8 +371,9 @@ export class SqlUsersServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -334,515 +384,665 @@ export class SqlUsersServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Deletes a user from a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.host - * Host of the user in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * Name of the user in the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_users_service.delete.js - * region_tag:sqladmin_v1_generated_SqlUsersService_Delete_async - */ + /** + * Deletes a user from a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.host + * Host of the user in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * Name of the user in the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_users_service.delete.js + * region_tag:sqladmin_v1_generated_SqlUsersService_Delete_async + */ delete( - request?: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ] + >; delete( - request: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request?: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlUsersDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('delete response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersDeleteRequest|undefined, - {}|undefined - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a resource containing information about a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * User of the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.host - * Host of a user of the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_users_service.get.js - * region_tag:sqladmin_v1_generated_SqlUsersService_Get_async - */ + /** + * Retrieves a resource containing information about a user. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * User of the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.host + * Host of a user of the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.User|User}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_users_service.get.js + * region_tag:sqladmin_v1_generated_SqlUsersService_Get_async + */ get( - request?: protos.google.cloud.sql.v1.ISqlUsersGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlUsersGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1.ISqlUsersGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlUsersGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1.ISqlUsersGetRequest, - callback: Callback< - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlUsersGetRequest, + callback: Callback< + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1.ISqlUsersGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlUsersGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IUser, - protos.google.cloud.sql.v1.ISqlUsersGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IUser, + protos.google.cloud.sql.v1.ISqlUsersGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new user in a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1.User} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_users_service.insert.js - * region_tag:sqladmin_v1_generated_SqlUsersService_Insert_async - */ + /** + * Creates a new user in a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1.User} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_users_service.insert.js + * region_tag:sqladmin_v1_generated_SqlUsersService_Insert_async + */ insert( - request?: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | undefined, + {} | undefined, + ] + >; insert( - request: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request?: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlUsersInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('insert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersInsertRequest|undefined, - {}|undefined - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists users in the specified Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.UsersListResponse|UsersListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_users_service.list.js - * region_tag:sqladmin_v1_generated_SqlUsersService_List_async - */ + /** + * Lists users in the specified Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.UsersListResponse|UsersListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_users_service.list.js + * region_tag:sqladmin_v1_generated_SqlUsersService_List_async + */ list( - request?: protos.google.cloud.sql.v1.ISqlUsersListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlUsersListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1.ISqlUsersListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlUsersListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1.ISqlUsersListRequest, - callback: Callback< - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlUsersListRequest, + callback: Callback< + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1.ISqlUsersListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlUsersListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IUsersListResponse, - protos.google.cloud.sql.v1.ISqlUsersListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IUsersListResponse, + protos.google.cloud.sql.v1.ISqlUsersListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates an existing user in a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.host] - * Optional. Host of the user in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * Name of the user in the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string[]} [request.databaseRoles] - * Optional. List of database roles to grant to the user. body.database_roles - * will be ignored for update request. - * @param {boolean} [request.revokeExistingRoles] - * Optional. Specifies whether to revoke existing roles that are not present - * in the `database_roles` field. If `false` or unset, the database roles - * specified in `database_roles` are added to the user's existing roles. - * @param {google.cloud.sql.v1.User} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1/sql_users_service.update.js - * region_tag:sqladmin_v1_generated_SqlUsersService_Update_async - */ + /** + * Updates an existing user in a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} [request.host] + * Optional. Host of the user in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * Name of the user in the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string[]} [request.databaseRoles] + * Optional. List of database roles to grant to the user. body.database_roles + * will be ignored for update request. + * @param {boolean} [request.revokeExistingRoles] + * Optional. Specifies whether to revoke existing roles that are not present + * in the `database_roles` field. If `false` or unset, the database roles + * specified in `database_roles` are added to the user's existing roles. + * @param {google.cloud.sql.v1.User} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1/sql_users_service.update.js + * region_tag:sqladmin_v1_generated_SqlUsersService_Update_async + */ update( - request?: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ] + >; update( - request: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; update( - request: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; update( - request?: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1.ISqlUsersUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('update request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('update response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.update(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1.IOperation, - protos.google.cloud.sql.v1.ISqlUsersUpdateRequest|undefined, - {}|undefined - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1.IOperation, + protos.google.cloud.sql.v1.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -877,12 +1077,11 @@ export class SqlUsersServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -915,7 +1114,7 @@ export class SqlUsersServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -931,7 +1130,7 @@ export class SqlUsersServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -968,13 +1167,15 @@ export class SqlUsersServiceClient { */ close(): Promise { if (this.sqlUsersServiceStub && !this._terminated) { - return this.sqlUsersServiceStub.then(stub => { + return this.sqlUsersServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1beta4/index.ts b/packages/google-cloud-sql/src/v1beta4/index.ts index c1b5dcdaf6e0..d8f42f199ca2 100644 --- a/packages/google-cloud-sql/src/v1beta4/index.ts +++ b/packages/google-cloud-sql/src/v1beta4/index.ts @@ -16,14 +16,14 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -export {SqlBackupRunsServiceClient} from './sql_backup_runs_service_client'; -export {SqlBackupsServiceClient} from './sql_backups_service_client'; -export {SqlConnectServiceClient} from './sql_connect_service_client'; -export {SqlDatabasesServiceClient} from './sql_databases_service_client'; -export {SqlFlagsServiceClient} from './sql_flags_service_client'; - -export {SqlInstancesServiceClient} from './sql_instances_service_client'; -export {SqlOperationsServiceClient} from './sql_operations_service_client'; -export {SqlSslCertsServiceClient} from './sql_ssl_certs_service_client'; -export {SqlTiersServiceClient} from './sql_tiers_service_client'; -export {SqlUsersServiceClient} from './sql_users_service_client'; +export { SqlBackupRunsServiceClient } from './sql_backup_runs_service_client'; +export { SqlBackupsServiceClient } from './sql_backups_service_client'; +export { SqlConnectServiceClient } from './sql_connect_service_client'; +export { SqlDatabasesServiceClient } from './sql_databases_service_client'; +export { SqlFlagsServiceClient } from './sql_flags_service_client'; +export { SqlIamPoliciesServiceClient } from './sql_iam_policies_service_client'; +export { SqlInstancesServiceClient } from './sql_instances_service_client'; +export { SqlOperationsServiceClient } from './sql_operations_service_client'; +export { SqlSslCertsServiceClient } from './sql_ssl_certs_service_client'; +export { SqlTiersServiceClient } from './sql_tiers_service_client'; +export { SqlUsersServiceClient } from './sql_users_service_client'; diff --git a/packages/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts b/packages/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts index 56b0124a7c70..1d8a6b7aca1a 100644 --- a/packages/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts +++ b/packages/google-cloud-sql/src/v1beta4/sql_backup_runs_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -43,7 +50,7 @@ export class SqlBackupRunsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -56,10 +63,10 @@ export class SqlBackupRunsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlBackupRunsServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlBackupRunsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlBackupRunsServiceClient. @@ -100,21 +107,42 @@ export class SqlBackupRunsServiceClient { * const client = new SqlBackupRunsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlBackupRunsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +167,7 @@ export class SqlBackupRunsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,15 +181,11 @@ export class SqlBackupRunsServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -183,17 +207,20 @@ export class SqlBackupRunsServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlBackupRunsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1beta4.SqlBackupRunsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -224,36 +251,40 @@ export class SqlBackupRunsServiceClient { // Put together the "service stub" for // google.cloud.sql.v1beta4.SqlBackupRunsService. this.sqlBackupRunsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1beta4.SqlBackupRunsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlBackupRunsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1beta4.SqlBackupRunsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlBackupRunsServiceStubMethods = - ['delete', 'get', 'insert', 'list']; + const sqlBackupRunsServiceStubMethods = ['delete', 'get', 'insert', 'list']; for (const methodName of sqlBackupRunsServiceStubMethods) { const callPromise = this.sqlBackupRunsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -268,8 +299,14 @@ export class SqlBackupRunsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -280,8 +317,14 @@ export class SqlBackupRunsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -314,7 +357,7 @@ export class SqlBackupRunsServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -324,8 +367,9 @@ export class SqlBackupRunsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -336,413 +380,579 @@ export class SqlBackupRunsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Deletes the backup taken by a backup run. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.id - * The ID of the backup run to delete. To find a backup run ID, use the - * [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/backupRuns/list) - * method. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backup_runs_service.delete.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Delete_async - */ + /** + * Deletes the backup taken by a backup run. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.id + * The ID of the backup run to delete. To find a backup run ID, use the + * [list](https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/backupRuns/list) + * method. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backup_runs_service.delete.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Delete_async + */ delete( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest | undefined, + {} | undefined, + ] + >; delete( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; delete( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; delete( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'id': request.id?.toString() ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + id: request.id?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('delete response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest|undefined, - {}|undefined - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsDeleteRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a resource containing information about a backup run. - * - * @param {Object} request - * The request object that will be sent. - * @param {number} request.id - * The ID of this backup run. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.BackupRun|BackupRun}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backup_runs_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Get_async - */ + /** + * Retrieves a resource containing information about a backup run. + * + * @param {Object} request + * The request object that will be sent. + * @param {number} request.id + * The ID of this backup run. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.BackupRun|BackupRun}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backup_runs_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Get_async + */ get( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackupRun, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackupRun, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackupRun, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IBackupRun, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackupRun, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'id': request.id?.toString() ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + id: request.id?.toString() ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IBackupRun, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IBackupRun, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IBackupRun, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new backup run on demand. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.BackupRun} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backup_runs_service.insert.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Insert_async - */ + /** + * Creates a new backup run on demand. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.BackupRun} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backup_runs_service.insert.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_Insert_async + */ insert( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest | undefined, + {} | undefined, + ] + >; insert( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; insert( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; insert( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('insert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest|undefined, - {}|undefined - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsInsertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all backup runs associated with the project or a given instance and - * configuration in the reverse chronological order of the backup initiation - * time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID, or "-" for all instances. This does not include - * the project ID. - * @param {number} request.maxResults - * Maximum number of backup runs per response. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.BackupRunsListResponse|BackupRunsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backup_runs_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_List_async - */ + /** + * Lists all backup runs associated with the project or a given instance and + * configuration in the reverse chronological order of the backup initiation + * time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID, or "-" for all instances. This does not include + * the project ID. + * @param {number} request.maxResults + * Maximum number of backup runs per response. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.BackupRunsListResponse|BackupRunsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backup_runs_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupRunsService_List_async + */ list( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, - protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IBackupRunsListResponse, + protos.google.cloud.sql.v1beta4.ISqlBackupRunsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -777,12 +987,11 @@ export class SqlBackupRunsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -815,7 +1024,7 @@ export class SqlBackupRunsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -831,7 +1040,7 @@ export class SqlBackupRunsServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -866,7 +1075,7 @@ export class SqlBackupRunsServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -891,13 +1100,15 @@ export class SqlBackupRunsServiceClient { */ close(): Promise { if (this.sqlBackupRunsServiceStub && !this._terminated) { - return this.sqlBackupRunsServiceStub.then(stub => { + return this.sqlBackupRunsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts b/packages/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts index 21c870f5d116..8c51bd7530ed 100644 --- a/packages/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts +++ b/packages/google-cloud-sql/src/v1beta4/sql_backups_service_client.ts @@ -18,11 +18,20 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, PaginationCallback, GaxCall, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + PaginationCallback, + GaxCall, + LocationsClient, + LocationProtos, +} from 'google-gax'; +import { Transform } from 'stream'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -43,7 +52,7 @@ export class SqlBackupsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -56,10 +65,10 @@ export class SqlBackupsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlBackupsServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlBackupsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlBackupsServiceClient. @@ -100,21 +109,42 @@ export class SqlBackupsServiceClient { * const client = new SqlBackupsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlBackupsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +169,7 @@ export class SqlBackupsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,15 +183,11 @@ export class SqlBackupsServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -183,10 +209,10 @@ export class SqlBackupsServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), }; @@ -194,14 +220,20 @@ export class SqlBackupsServiceClient { // (e.g. 50 results at a time, with tokens to get subsequent // pages). Denote the keys used for pagination and results. this.descriptors.page = { - listBackups: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'backups') + listBackups: new this._gaxModule.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'backups', + ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlBackupsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1beta4.SqlBackupsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -232,37 +264,46 @@ export class SqlBackupsServiceClient { // Put together the "service stub" for // google.cloud.sql.v1beta4.SqlBackupsService. this.sqlBackupsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1beta4.SqlBackupsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlBackupsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1beta4.SqlBackupsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlBackupsServiceStubMethods = - ['createBackup', 'getBackup', 'listBackups', 'updateBackup', 'deleteBackup']; + const sqlBackupsServiceStubMethods = [ + 'createBackup', + 'getBackup', + 'listBackups', + 'updateBackup', + 'deleteBackup', + ]; for (const methodName of sqlBackupsServiceStubMethods) { const callPromise = this.sqlBackupsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - this.descriptors.page[methodName] || - undefined; + const descriptor = this.descriptors.page[methodName] || undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -277,8 +318,14 @@ export class SqlBackupsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -289,8 +336,14 @@ export class SqlBackupsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -323,7 +376,7 @@ export class SqlBackupsServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -333,8 +386,9 @@ export class SqlBackupsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -345,490 +399,641 @@ export class SqlBackupsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Creates a backup for a Cloud SQL instance. This API can be used only to - * create on-demand backups. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where this backup is created. - * Format: projects/{project} - * @param {google.cloud.sql.v1beta4.Backup} request.backup - * Required. The Backup to create. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backups_service.create_backup.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_CreateBackup_async - */ + /** + * Creates a backup for a Cloud SQL instance. This API can be used only to + * create on-demand backups. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where this backup is created. + * Format: projects/{project} + * @param {google.cloud.sql.v1beta4.Backup} request.backup + * Required. The Backup to create. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backups_service.create_backup.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_CreateBackup_async + */ createBackup( - request?: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | undefined, + {} | undefined, + ] + >; createBackup( - request: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; createBackup( - request: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; createBackup( - request?: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ICreateBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ICreateBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createBackup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ICreateBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createBackup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createBackup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ICreateBackupRequest|undefined, - {}|undefined - ]) => { - this._log.info('createBackup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ICreateBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('createBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a resource containing information about a backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the backup to retrieve. - * Format: projects/{project}/backups/{backup} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backups_service.get_backup.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_GetBackup_async - */ + /** + * Retrieves a resource containing information about a backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the backup to retrieve. + * Format: projects/{project}/backups/{backup} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backups_service.get_backup.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_GetBackup_async + */ getBackup( - request?: protos.google.cloud.sql.v1beta4.IGetBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.IGetBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | undefined, + {} | undefined, + ] + >; getBackup( - request: protos.google.cloud.sql.v1beta4.IGetBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.IGetBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; getBackup( - request: protos.google.cloud.sql.v1beta4.IGetBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.IGetBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; getBackup( - request?: protos.google.cloud.sql.v1beta4.IGetBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.IGetBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest|undefined, {}|undefined - ]>|void { + protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getBackup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | null | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getBackup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getBackup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IBackup, - protos.google.cloud.sql.v1beta4.IGetBackupRequest|undefined, - {}|undefined - ]) => { - this._log.info('getBackup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IBackup, + protos.google.cloud.sql.v1beta4.IGetBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('getBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates the retention period and the description of the backup. You can use - * this API to update final backups only. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.sql.v1beta4.Backup} request.backup - * Required. The backup to update. - * The backup’s `name` field is used to identify the backup to update. - * Format: projects/{project}/backups/{backup} - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields that you can update. You can update only the description - * and retention period of the final backup. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backups_service.update_backup.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_UpdateBackup_async - */ + /** + * Updates the retention period and the description of the backup. You can use + * this API to update final backups only. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.sql.v1beta4.Backup} request.backup + * Required. The backup to update. + * The backup’s `name` field is used to identify the backup to update. + * Format: projects/{project}/backups/{backup} + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields that you can update. You can update only the description + * and retention period of the final backup. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backups_service.update_backup.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_UpdateBackup_async + */ updateBackup( - request?: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | undefined, + {} | undefined, + ] + >; updateBackup( - request: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; updateBackup( - request: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; updateBackup( - request?: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.IUpdateBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.IUpdateBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'backup.name': request.backup!.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + 'backup.name': request.backup!.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('updateBackup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.IUpdateBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('updateBackup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.updateBackup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IUpdateBackupRequest|undefined, - {}|undefined - ]) => { - this._log.info('updateBackup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .updateBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IUpdateBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('updateBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes the backup. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the backup to delete. - * Format: projects/{project}/backups/{backup} - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backups_service.delete_backup.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_DeleteBackup_async - */ + /** + * Deletes the backup. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the backup to delete. + * Format: projects/{project}/backups/{backup} + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backups_service.delete_backup.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_DeleteBackup_async + */ deleteBackup( - request?: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | undefined, + {} | undefined, + ] + >; deleteBackup( - request: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteBackup( - request: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): void; deleteBackup( - request?: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.IDeleteBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.IDeleteBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('deleteBackup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.IDeleteBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('deleteBackup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.deleteBackup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.IDeleteBackupRequest|undefined, - {}|undefined - ]) => { - this._log.info('deleteBackup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .deleteBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.IDeleteBackupRequest | undefined, + {} | undefined, + ]) => { + this._log.info('deleteBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } - /** - * Lists all backups associated with the project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed and will merge results from all the pages into this array. - * Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Lists all backups associated with the project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listBackups( - request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IBackup[], - protos.google.cloud.sql.v1beta4.IListBackupsRequest|null, - protos.google.cloud.sql.v1beta4.IListBackupsResponse - ]>; + request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackup[], + protos.google.cloud.sql.v1beta4.IListBackupsRequest | null, + protos.google.cloud.sql.v1beta4.IListBackupsResponse, + ] + >; listBackups( - request: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.sql.v1beta4.IListBackupsRequest, - protos.google.cloud.sql.v1beta4.IListBackupsResponse|null|undefined, - protos.google.cloud.sql.v1beta4.IBackup>): void; + request: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.sql.v1beta4.IListBackupsRequest, + protos.google.cloud.sql.v1beta4.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1beta4.IBackup + >, + ): void; listBackups( - request: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - callback: PaginationCallback< - protos.google.cloud.sql.v1beta4.IListBackupsRequest, - protos.google.cloud.sql.v1beta4.IListBackupsResponse|null|undefined, - protos.google.cloud.sql.v1beta4.IBackup>): void; + request: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + callback: PaginationCallback< + protos.google.cloud.sql.v1beta4.IListBackupsRequest, + protos.google.cloud.sql.v1beta4.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1beta4.IBackup + >, + ): void; listBackups( - request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.sql.v1beta4.IListBackupsRequest, - protos.google.cloud.sql.v1beta4.IListBackupsResponse|null|undefined, - protos.google.cloud.sql.v1beta4.IBackup>, - callback?: PaginationCallback< + request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + optionsOrCallback?: + | CallOptions + | PaginationCallback< protos.google.cloud.sql.v1beta4.IListBackupsRequest, - protos.google.cloud.sql.v1beta4.IListBackupsResponse|null|undefined, - protos.google.cloud.sql.v1beta4.IBackup>): - Promise<[ - protos.google.cloud.sql.v1beta4.IBackup[], - protos.google.cloud.sql.v1beta4.IListBackupsRequest|null, - protos.google.cloud.sql.v1beta4.IListBackupsResponse - ]>|void { + | protos.google.cloud.sql.v1beta4.IListBackupsResponse + | null + | undefined, + protos.google.cloud.sql.v1beta4.IBackup + >, + callback?: PaginationCallback< + protos.google.cloud.sql.v1beta4.IListBackupsRequest, + protos.google.cloud.sql.v1beta4.IListBackupsResponse | null | undefined, + protos.google.cloud.sql.v1beta4.IBackup + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IBackup[], + protos.google.cloud.sql.v1beta4.IListBackupsRequest | null, + protos.google.cloud.sql.v1beta4.IListBackupsResponse, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); - const wrappedCallback: PaginationCallback< - protos.google.cloud.sql.v1beta4.IListBackupsRequest, - protos.google.cloud.sql.v1beta4.IListBackupsResponse|null|undefined, - protos.google.cloud.sql.v1beta4.IBackup>|undefined = callback + const wrappedCallback: + | PaginationCallback< + protos.google.cloud.sql.v1beta4.IListBackupsRequest, + | protos.google.cloud.sql.v1beta4.IListBackupsResponse + | null + | undefined, + protos.google.cloud.sql.v1beta4.IBackup + > + | undefined = callback ? (error, values, nextPageRequest, rawResponse) => { this._log.info('listBackups values %j', values); callback!(error, values, nextPageRequest, rawResponse); // We verified callback above. @@ -837,137 +1042,142 @@ export class SqlBackupsServiceClient { this._log.info('listBackups request %j', request); return this.innerApiCalls .listBackups(request, options, wrappedCallback) - ?.then(([response, input, output]: [ - protos.google.cloud.sql.v1beta4.IBackup[], - protos.google.cloud.sql.v1beta4.IListBackupsRequest|null, - protos.google.cloud.sql.v1beta4.IListBackupsResponse - ]) => { - this._log.info('listBackups values %j', response); - return [response, input, output]; - }); + ?.then( + ([response, input, output]: [ + protos.google.cloud.sql.v1beta4.IBackup[], + protos.google.cloud.sql.v1beta4.IListBackupsRequest | null, + protos.google.cloud.sql.v1beta4.IListBackupsResponse, + ]) => { + this._log.info('listBackups values %j', response); + return [response, input, output]; + }, + ); } -/** - * Equivalent to `listBackups`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link protos.google.cloud.sql.v1beta4.Backup|Backup} on 'data' event. - * The client library will perform auto-pagination by default: it will call the API as many - * times as needed. Note that it can affect your quota. - * We recommend using `listBackupsAsync()` - * method described below for async iteration which you can stop as needed. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - */ + /** + * Equivalent to `listBackups`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.cloud.sql.v1beta4.Backup|Backup} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBackupsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ listBackupsStream( - request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - options?: CallOptions): - Transform{ + request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + options?: CallOptions, + ): Transform { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listBackups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listBackups stream %j', request); return this.descriptors.page.listBackups.createStream( this.innerApiCalls.listBackups as GaxCall, request, - callSettings + callSettings, ); } -/** - * Equivalent to `listBackups`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns this collection of backups. - * Format: projects/{project} - * @param {number} request.pageSize - * The maximum number of backups to return per response. The service might - * return fewer backups than this value. If a value for this parameter isn't - * specified, then, at most, 500 backups are returned. The maximum value is - * 2,000. Any values that you set, which are greater than 2,000, are changed - * to 2,000. - * @param {string} request.pageToken - * A page token, received from a previous `ListBackups` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListBackups` must match - * the call that provided the page token. - * @param {string} request.filter - * Multiple filter queries are separated by spaces. For example, - * 'instance:abc AND type:FINAL, 'location:us', - * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by - * type, instance, backupInterval.startTime (creation time), or location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. - * When you iterate the returned iterable, each element will be an object representing - * {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_backups_service.list_backups.js - * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_ListBackups_async - */ + /** + * Equivalent to `listBackups`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns this collection of backups. + * Format: projects/{project} + * @param {number} request.pageSize + * The maximum number of backups to return per response. The service might + * return fewer backups than this value. If a value for this parameter isn't + * specified, then, at most, 500 backups are returned. The maximum value is + * 2,000. Any values that you set, which are greater than 2,000, are changed + * to 2,000. + * @param {string} request.pageToken + * A page token, received from a previous `ListBackups` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListBackups` must match + * the call that provided the page token. + * @param {string} request.filter + * Multiple filter queries are separated by spaces. For example, + * 'instance:abc AND type:FINAL, 'location:us', + * 'backupInterval.startTime>=1950-01-01T01:01:25.771Z'. You can filter by + * type, instance, backupInterval.startTime (creation time), or location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.cloud.sql.v1beta4.Backup|Backup}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_backups_service.list_backups.js + * region_tag:sqladmin_v1beta4_generated_SqlBackupsService_ListBackups_async + */ listBackupsAsync( - request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, - options?: CallOptions): - AsyncIterable{ + request?: protos.google.cloud.sql.v1beta4.IListBackupsRequest, + options?: CallOptions, + ): AsyncIterable { request = request || {}; options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); const defaultCallSettings = this._defaults['listBackups']; const callSettings = defaultCallSettings.merge(options); - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('listBackups iterate %j', request); return this.descriptors.page.listBackups.asyncIterate( this.innerApiCalls['listBackups'] as GaxCall, request as {}, - callSettings + callSettings, ) as AsyncIterable; } -/** + + /** * Gets information about a location. * * @param {Object} request @@ -1002,12 +1212,11 @@ export class SqlBackupsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -1040,7 +1249,7 @@ export class SqlBackupsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -1056,7 +1265,7 @@ export class SqlBackupsServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -1091,7 +1300,7 @@ export class SqlBackupsServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -1116,13 +1325,15 @@ export class SqlBackupsServiceClient { */ close(): Promise { if (this.sqlBackupsServiceStub && !this._terminated) { - return this.sqlBackupsServiceStub.then(stub => { + return this.sqlBackupsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts b/packages/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts index 9dd0d4425b76..98f4fcbdfa17 100644 --- a/packages/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts +++ b/packages/google-cloud-sql/src/v1beta4/sql_connect_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlConnectServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlConnectServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlConnectServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlConnectServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlConnectServiceClient. @@ -101,21 +108,42 @@ export class SqlConnectServiceClient { * const client = new SqlConnectServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlConnectServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class SqlConnectServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +182,11 @@ export class SqlConnectServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +208,17 @@ export class SqlConnectServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlConnectService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1beta4.SqlConnectService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,36 +249,43 @@ export class SqlConnectServiceClient { // Put together the "service stub" for // google.cloud.sql.v1beta4.SqlConnectService. this.sqlConnectServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1beta4.SqlConnectService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlConnectService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1beta4.SqlConnectService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlConnectServiceStubMethods = - ['getConnectSettings', 'generateEphemeralCert']; + const sqlConnectServiceStubMethods = [ + 'getConnectSettings', + 'generateEphemeralCert', + ]; for (const methodName of sqlConnectServiceStubMethods) { const callPromise = this.sqlConnectServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -266,8 +300,14 @@ export class SqlConnectServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -278,8 +318,14 @@ export class SqlConnectServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -312,7 +358,7 @@ export class SqlConnectServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -322,8 +368,9 @@ export class SqlConnectServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -334,217 +381,303 @@ export class SqlConnectServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Retrieves connect settings about a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.protobuf.Timestamp} [request.readTime] - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.ConnectSettings|ConnectSettings}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_connect_service.get_connect_settings.js - * region_tag:sqladmin_v1beta4_generated_SqlConnectService_GetConnectSettings_async - */ + /** + * Retrieves connect settings about a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.protobuf.Timestamp} [request.readTime] + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.ConnectSettings|ConnectSettings}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_connect_service.get_connect_settings.js + * region_tag:sqladmin_v1beta4_generated_SqlConnectService_GetConnectSettings_async + */ getConnectSettings( - request?: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IConnectSettings, - protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IConnectSettings, + protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest | undefined, + {} | undefined, + ] + >; getConnectSettings( - request: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IConnectSettings, - protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IConnectSettings, + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getConnectSettings( - request: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IConnectSettings, - protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IConnectSettings, + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getConnectSettings( - request?: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IConnectSettings, - protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IConnectSettings, - protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IConnectSettings, - protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IConnectSettings, + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IConnectSettings, + protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getConnectSettings request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IConnectSettings, - protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IConnectSettings, + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getConnectSettings response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getConnectSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IConnectSettings, - protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest|undefined, - {}|undefined - ]) => { - this._log.info('getConnectSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getConnectSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IConnectSettings, + ( + | protos.google.cloud.sql.v1beta4.IGetConnectSettingsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getConnectSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Generates a short-lived X509 certificate containing the provided public key - * and signed by a private key specific to the target instance. Users may use - * the certificate to authenticate as themselves when connecting to the - * database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.publicKey - * PEM encoded public key to include in the signed certificate. - * @param {string} [request.accessToken] - * Optional. Access token to include in the signed certificate. - * @param {google.protobuf.Timestamp} [request.readTime] - * Optional. Optional snapshot read timestamp to trade freshness for - * performance. - * @param {google.protobuf.Duration} [request.validDuration] - * Optional. If set, it will contain the cert valid duration. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse|GenerateEphemeralCertResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js - * region_tag:sqladmin_v1beta4_generated_SqlConnectService_GenerateEphemeralCert_async - */ + /** + * Generates a short-lived X509 certificate containing the provided public key + * and signed by a private key specific to the target instance. Users may use + * the certificate to authenticate as themselves when connecting to the + * database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.publicKey + * PEM encoded public key to include in the signed certificate. + * @param {string} [request.accessToken] + * Optional. Access token to include in the signed certificate. + * @param {google.protobuf.Timestamp} [request.readTime] + * Optional. Optional snapshot read timestamp to trade freshness for + * performance. + * @param {google.protobuf.Duration} [request.validDuration] + * Optional. If set, it will contain the cert valid duration. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse|GenerateEphemeralCertResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_connect_service.generate_ephemeral_cert.js + * region_tag:sqladmin_v1beta4_generated_SqlConnectService_GenerateEphemeralCert_async + */ generateEphemeralCert( - request?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest | undefined, + {} | undefined, + ] + >; generateEphemeralCert( - request: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; generateEphemeralCert( - request: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; generateEphemeralCert( - request?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('generateEphemeralCert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('generateEphemeralCert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.generateEphemeralCert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, - protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest|undefined, - {}|undefined - ]) => { - this._log.info('generateEphemeralCert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .generateEphemeralCert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse, + ( + | protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('generateEphemeralCert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -579,12 +712,11 @@ export class SqlConnectServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -617,7 +749,7 @@ export class SqlConnectServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -633,7 +765,7 @@ export class SqlConnectServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -670,13 +802,15 @@ export class SqlConnectServiceClient { */ close(): Promise { if (this.sqlConnectServiceStub && !this._terminated) { - return this.sqlConnectServiceStub.then(stub => { + return this.sqlConnectServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts b/packages/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts index 8be5e2d2de26..acc2d5a1d7c3 100644 --- a/packages/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts +++ b/packages/google-cloud-sql/src/v1beta4/sql_databases_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -43,7 +50,7 @@ export class SqlDatabasesServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -56,10 +63,10 @@ export class SqlDatabasesServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlDatabasesServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlDatabasesServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlDatabasesServiceClient. @@ -100,21 +107,42 @@ export class SqlDatabasesServiceClient { * const client = new SqlDatabasesServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlDatabasesServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +167,7 @@ export class SqlDatabasesServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,15 +181,11 @@ export class SqlDatabasesServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -183,17 +207,20 @@ export class SqlDatabasesServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlDatabasesService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1beta4.SqlDatabasesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -224,36 +251,47 @@ export class SqlDatabasesServiceClient { // Put together the "service stub" for // google.cloud.sql.v1beta4.SqlDatabasesService. this.sqlDatabasesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1beta4.SqlDatabasesService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlDatabasesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1beta4.SqlDatabasesService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlDatabasesServiceStubMethods = - ['delete', 'get', 'insert', 'list', 'patch', 'update']; + const sqlDatabasesServiceStubMethods = [ + 'delete', + 'get', + 'insert', + 'list', + 'patch', + 'update', + ]; for (const methodName of sqlDatabasesServiceStubMethods) { const callPromise = this.sqlDatabasesServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -268,8 +306,14 @@ export class SqlDatabasesServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -280,8 +324,14 @@ export class SqlDatabasesServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -314,7 +364,7 @@ export class SqlDatabasesServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -324,8 +374,9 @@ export class SqlDatabasesServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -336,611 +387,863 @@ export class SqlDatabasesServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Deletes a database from a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be deleted in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.delete.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Delete_async - */ + /** + * Deletes a database from a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be deleted in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.delete.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Delete_async + */ delete( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest | undefined, + {} | undefined, + ] + >; delete( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; delete( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; delete( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'database': request.database ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('delete response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest|undefined, - {}|undefined - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlDatabasesDeleteRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a resource containing information about a database inside a Cloud - * SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Database|Database}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Get_async - */ + /** + * Retrieves a resource containing information about a database inside a Cloud + * SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Database|Database}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Get_async + */ get( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabase, + protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabase, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabase, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IDatabase, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabase, + protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'database': request.database ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IDatabase, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IDatabase, - protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IDatabase, + protos.google.cloud.sql.v1beta4.ISqlDatabasesGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Inserts a resource containing information about a database inside a Cloud - * SQL instance. - * - * **Note:** You can't modify the default character set and collation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.insert.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Insert_async - */ + /** + * Inserts a resource containing information about a database inside a Cloud + * SQL instance. + * + * **Note:** You can't modify the default character set and collation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.insert.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Insert_async + */ insert( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest | undefined, + {} | undefined, + ] + >; insert( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; insert( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; insert( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('insert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest|undefined, - {}|undefined - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlDatabasesInsertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists databases in the specified Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.DatabasesListResponse|DatabasesListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_List_async - */ + /** + * Lists databases in the specified Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.DatabasesListResponse|DatabasesListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_List_async + */ list( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IDatabasesListResponse, - protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IDatabasesListResponse, + protos.google.cloud.sql.v1beta4.ISqlDatabasesListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Partially updates a resource containing information about a database inside - * a Cloud SQL instance. This method supports patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be updated in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.patch.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Patch_async - */ + /** + * Partially updates a resource containing information about a database inside + * a Cloud SQL instance. This method supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be updated in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.patch.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Patch_async + */ patch( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + >; patch( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; patch( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; patch( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'database': request.database ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('patch request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('patch response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.patch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|undefined, - {}|undefined - ]) => { - this._log.info('patch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .patch(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('patch response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates a resource containing information about a database inside a Cloud - * SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.database - * Name of the database to be updated in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.Database} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_databases_service.update.js - * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Update_async - */ + /** + * Updates a resource containing information about a database inside a Cloud + * SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.database + * Name of the database to be updated in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.Database} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_databases_service.update.js + * region_tag:sqladmin_v1beta4_generated_SqlDatabasesService_Update_async + */ update( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + >; update( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; update( - request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; update( - request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'database': request.database ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + database: request.database ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('update request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('update response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.update(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest|undefined, - {}|undefined - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlDatabasesUpdateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -975,12 +1278,11 @@ export class SqlDatabasesServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -1013,7 +1315,7 @@ export class SqlDatabasesServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -1029,7 +1331,7 @@ export class SqlDatabasesServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -1064,7 +1366,7 @@ export class SqlDatabasesServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -1089,13 +1391,15 @@ export class SqlDatabasesServiceClient { */ close(): Promise { if (this.sqlDatabasesServiceStub && !this._terminated) { - return this.sqlDatabasesServiceStub.then(stub => { + return this.sqlDatabasesServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts b/packages/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts index c8b765e7f710..2ada4fa5a4c1 100644 --- a/packages/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts +++ b/packages/google-cloud-sql/src/v1beta4/sql_flags_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -43,7 +50,7 @@ export class SqlFlagsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -56,10 +63,10 @@ export class SqlFlagsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlFlagsServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlFlagsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlFlagsServiceClient. @@ -100,21 +107,42 @@ export class SqlFlagsServiceClient { * const client = new SqlFlagsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlFlagsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +167,7 @@ export class SqlFlagsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,15 +181,11 @@ export class SqlFlagsServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -183,17 +207,20 @@ export class SqlFlagsServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlFlagsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1beta4.SqlFlagsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -224,36 +251,40 @@ export class SqlFlagsServiceClient { // Put together the "service stub" for // google.cloud.sql.v1beta4.SqlFlagsService. this.sqlFlagsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1beta4.SqlFlagsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlFlagsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1beta4.SqlFlagsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlFlagsServiceStubMethods = - ['list']; + const sqlFlagsServiceStubMethods = ['list']; for (const methodName of sqlFlagsServiceStubMethods) { const callPromise = this.sqlFlagsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -268,8 +299,14 @@ export class SqlFlagsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -280,8 +317,14 @@ export class SqlFlagsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -314,7 +357,7 @@ export class SqlFlagsServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -324,8 +367,9 @@ export class SqlFlagsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -336,101 +380,136 @@ export class SqlFlagsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Lists all available database flags for Cloud SQL instances. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.databaseVersion - * Database type and version you want to retrieve flags for. By default, this - * method returns flags for all database types and versions. - * @param {google.cloud.sql.v1beta4.SqlFlagScope} [request.flagScope] - * Optional. Specify the scope of flags to be returned by SqlFlagsListService. - * Return list of database flags if unspecified. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.FlagsListResponse|FlagsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_flags_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlFlagsService_List_async - */ + /** + * Lists all available database flags for Cloud SQL instances. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.databaseVersion + * Database type and version you want to retrieve flags for. By default, this + * method returns flags for all database types and versions. + * @param {google.cloud.sql.v1beta4.SqlFlagScope} [request.flagScope] + * Optional. Specify the scope of flags to be returned by SqlFlagsListService. + * Return list of database flags if unspecified. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.FlagsListResponse|FlagsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_flags_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlFlagsService_List_async + */ list( - request?: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - this.initialize().catch(err => {throw err}); + this.initialize().catch((err) => { + throw err; + }); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IFlagsListResponse, - protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IFlagsListResponse, + protos.google.cloud.sql.v1beta4.ISqlFlagsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -465,12 +544,11 @@ export class SqlFlagsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -503,7 +581,7 @@ export class SqlFlagsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -519,7 +597,7 @@ export class SqlFlagsServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -554,7 +632,7 @@ export class SqlFlagsServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -579,13 +657,15 @@ export class SqlFlagsServiceClient { */ close(): Promise { if (this.sqlFlagsServiceStub && !this._terminated) { - return this.sqlFlagsServiceStub.then(stub => { + return this.sqlFlagsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts b/packages/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts index dbfed12b86a9..a487606fd449 100644 --- a/packages/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts +++ b/packages/google-cloud-sql/src/v1beta4/sql_instances_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -43,7 +50,7 @@ export class SqlInstancesServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -56,10 +63,10 @@ export class SqlInstancesServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlInstancesServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlInstancesServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlInstancesServiceClient. @@ -100,21 +107,42 @@ export class SqlInstancesServiceClient { * const client = new SqlInstancesServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlInstancesServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +167,7 @@ export class SqlInstancesServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,15 +181,11 @@ export class SqlInstancesServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -183,17 +207,20 @@ export class SqlInstancesServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlInstancesService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1beta4.SqlInstancesService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -224,36 +251,84 @@ export class SqlInstancesServiceClient { // Put together the "service stub" for // google.cloud.sql.v1beta4.SqlInstancesService. this.sqlInstancesServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1beta4.SqlInstancesService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlInstancesService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1beta4.SqlInstancesService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlInstancesServiceStubMethods = - ['addServerCa', 'addServerCertificate', 'addEntraIdCertificate', 'clone', 'delete', 'demoteMaster', 'demote', 'export', 'failover', 'reencrypt', 'get', 'import', 'insert', 'list', 'listServerCas', 'listServerCertificates', 'listEntraIdCertificates', 'patch', 'promoteReplica', 'switchover', 'resetSslConfig', 'restart', 'restoreBackup', 'rotateServerCa', 'rotateServerCertificate', 'rotateEntraIdCertificate', 'startReplica', 'stopReplica', 'truncateLog', 'update', 'createEphemeral', 'rescheduleMaintenance', 'verifyExternalSyncSettings', 'startExternalSync', 'performDiskShrink', 'getDiskShrinkConfig', 'resetReplicaSize', 'getLatestRecoveryTime', 'executeSql', 'acquireSsrsLease', 'releaseSsrsLease', 'preCheckMajorVersionUpgrade', 'pointInTimeRestore']; + const sqlInstancesServiceStubMethods = [ + 'addServerCa', + 'addServerCertificate', + 'addEntraIdCertificate', + 'clone', + 'delete', + 'demoteMaster', + 'demote', + 'export', + 'failover', + 'reencrypt', + 'get', + 'import', + 'insert', + 'list', + 'listServerCas', + 'listServerCertificates', + 'listEntraIdCertificates', + 'patch', + 'promoteReplica', + 'switchover', + 'resetSslConfig', + 'restart', + 'restoreBackup', + 'rotateServerCa', + 'rotateServerCertificate', + 'rotateEntraIdCertificate', + 'startReplica', + 'stopReplica', + 'truncateLog', + 'update', + 'createEphemeral', + 'rescheduleMaintenance', + 'verifyExternalSyncSettings', + 'startExternalSync', + 'performDiskShrink', + 'getDiskShrinkConfig', + 'resetReplicaSize', + 'getLatestRecoveryTime', + 'executeSql', + 'acquireSsrsLease', + 'releaseSsrsLease', + 'preCheckMajorVersionUpgrade', + 'pointInTimeRestore', + ]; for (const methodName of sqlInstancesServiceStubMethods) { const callPromise = this.sqlInstancesServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -268,8 +343,14 @@ export class SqlInstancesServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -280,8 +361,14 @@ export class SqlInstancesServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -314,7 +401,7 @@ export class SqlInstancesServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -324,8 +411,9 @@ export class SqlInstancesServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -336,4349 +424,6366 @@ export class SqlInstancesServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Add a new trusted Certificate Authority (CA) version for the specified - * instance. Required to prepare for a certificate rotation. If a CA version - * was previously added but never used in a certificate rotation, this - * operation replaces that version. There cannot be more than one CA version - * waiting to be rotated in. For instances that have enabled Certificate - * Authority Service (CAS) based server CA, use AddServerCertificate to add a - * new server certificate. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.add_server_ca.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddServerCa_async - */ + /** + * Add a new trusted Certificate Authority (CA) version for the specified + * instance. Required to prepare for a certificate rotation. If a CA version + * was previously added but never used in a certificate rotation, this + * operation replaces that version. There cannot be more than one CA version + * waiting to be rotated in. For instances that have enabled Certificate + * Authority Service (CAS) based server CA, use AddServerCertificate to add a + * new server certificate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.add_server_ca.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddServerCa_async + */ addServerCa( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | undefined + ), + {} | undefined, + ] + >; addServerCa( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addServerCa( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addServerCa( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('addServerCa request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('addServerCa response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.addServerCa(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest|undefined, - {}|undefined - ]) => { - this._log.info('addServerCa response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .addServerCa(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addServerCa response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Add a new trusted server certificate version for the specified instance - * using Certificate Authority Service (CAS) server CA. Required to prepare - * for a certificate rotation. If a server certificate version was previously - * added but never used in a certificate rotation, this operation replaces - * that version. There cannot be more than one certificate version waiting to - * be rotated in. For instances not using CAS server CA, use AddServerCa - * instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.add_server_certificate.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddServerCertificate_async - */ + /** + * Add a new trusted server certificate version for the specified instance + * using Certificate Authority Service (CAS) server CA. Required to prepare + * for a certificate rotation. If a server certificate version was previously + * added but never used in a certificate rotation, this operation replaces + * that version. There cannot be more than one certificate version waiting to + * be rotated in. For instances not using CAS server CA, use AddServerCa + * instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.add_server_certificate.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddServerCertificate_async + */ addServerCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ] + >; addServerCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addServerCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addServerCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('addServerCertificate request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('addServerCertificate response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.addServerCertificate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest|undefined, - {}|undefined - ]) => { - this._log.info('addServerCertificate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .addServerCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddServerCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addServerCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Adds a new Entra ID certificate for the specified instance. If an Entra ID - * certificate was previously added but never used in a certificate rotation, - * this operation replaces that version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddEntraIdCertificate_async - */ + /** + * Adds a new Entra ID certificate for the specified instance. If an Entra ID + * certificate was previously added but never used in a certificate rotation, + * this operation replaces that version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.add_entra_id_certificate.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AddEntraIdCertificate_async + */ addEntraIdCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + >; addEntraIdCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addEntraIdCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; addEntraIdCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('addEntraIdCertificate request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('addEntraIdCertificate response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.addEntraIdCertificate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest|undefined, - {}|undefined - ]) => { - this._log.info('addEntraIdCertificate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .addEntraIdCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAddEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('addEntraIdCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a Cloud SQL instance as a clone of the source instance. Using this - * operation might cause your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * The ID of the Cloud SQL instance to be cloned (source). This does not - * include the project ID. - * @param {string} request.project - * Project ID of the source as well as the clone Cloud SQL instance. - * @param {google.cloud.sql.v1beta4.InstancesCloneRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.clone.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Clone_async - */ + /** + * Creates a Cloud SQL instance as a clone of the source instance. Using this + * operation might cause your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * The ID of the Cloud SQL instance to be cloned (source). This does not + * include the project ID. + * @param {string} request.project + * Project ID of the source as well as the clone Cloud SQL instance. + * @param {google.cloud.sql.v1beta4.InstancesCloneRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.clone.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Clone_async + */ clone( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ] + >; clone( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + >, + ): void; clone( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + >, + ): void; clone( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('clone request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('clone response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.clone(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest|undefined, - {}|undefined - ]) => { - this._log.info('clone response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .clone(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesCloneRequest | undefined, + {} | undefined, + ]) => { + this._log.info('clone response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be deleted. - * @param {boolean} request.enableFinalBackup - * Flag to opt-in for final backup. By default, it is turned off. - * @param {number} [request.finalBackupTtlDays] - * Optional. Retention period of the final backup. - * @param {google.protobuf.Timestamp} [request.finalBackupExpiryTime] - * Optional. Final Backup expiration time. - * Timestamp in UTC of when this resource is considered expired. - * @param {string} [request.finalBackupDescription] - * Optional. The description of the final backup. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.delete.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Delete_async - */ + /** + * Deletes a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be deleted. + * @param {boolean} request.enableFinalBackup + * Flag to opt-in for final backup. By default, it is turned off. + * @param {number} [request.finalBackupTtlDays] + * Optional. Retention period of the final backup. + * @param {google.protobuf.Timestamp} [request.finalBackupExpiryTime] + * Optional. Final Backup expiration time. + * Timestamp in UTC of when this resource is considered expired. + * @param {string} [request.finalBackupDescription] + * Optional. The description of the final backup. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.delete.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Delete_async + */ delete( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest | undefined, + {} | undefined, + ] + >; delete( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; delete( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; delete( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('delete response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest|undefined, - {}|undefined - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesDeleteRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Demotes the stand-alone instance to be a Cloud SQL read replica for an - * external database server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance name. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.demote_master.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_DemoteMaster_async - */ + /** + * Demotes the stand-alone instance to be a Cloud SQL read replica for an + * external database server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance name. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesDemoteMasterRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.demote_master.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_DemoteMaster_async + */ demoteMaster( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | undefined + ), + {} | undefined, + ] + >; demoteMaster( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): void; demoteMaster( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): void; demoteMaster( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('demoteMaster request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('demoteMaster response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.demoteMaster(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest|undefined, - {}|undefined - ]) => { - this._log.info('demoteMaster response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .demoteMaster(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteMasterRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('demoteMaster response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Demotes an existing standalone instance to be a Cloud SQL read replica - * for an external database server. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. The name of the Cloud SQL instance. - * @param {string} request.project - * Required. The project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesDemoteRequest} request.body - * The request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.demote.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Demote_async - */ + /** + * Demotes an existing standalone instance to be a Cloud SQL read replica + * for an external database server. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. The name of the Cloud SQL instance. + * @param {string} request.project + * Required. The project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesDemoteRequest} request.body + * The request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.demote.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Demote_async + */ demote( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest | undefined, + {} | undefined, + ] + >; demote( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; demote( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; demote( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('demote request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('demote response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.demote(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest|undefined, - {}|undefined - ]) => { - this._log.info('demote response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .demote(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesDemoteRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('demote response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL - * dump or CSV file. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * The Cloud SQL instance ID. This doesn't include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be exported. - * @param {google.cloud.sql.v1beta4.InstancesExportRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.export.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Export_async - */ + /** + * Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL + * dump or CSV file. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * The Cloud SQL instance ID. This doesn't include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be exported. + * @param {google.cloud.sql.v1beta4.InstancesExportRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.export.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Export_async + */ export( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest | undefined, + {} | undefined, + ] + >; export( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; export( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; export( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('export request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('export response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.export(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest|undefined, - {}|undefined - ]) => { - this._log.info('export response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .export(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesExportRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('export response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Initiates a manual failover of a high availability (HA) primary instance - * to a standby instance, which becomes the primary instance. Users are - * then rerouted to the new primary. For more information, see the - * [Overview of high - * availability](https://cloud.google.com/sql/docs/mysql/high-availability) - * page in the Cloud SQL documentation. - * If using Legacy HA (MySQL only), this causes the instance to failover to - * its failover replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {google.cloud.sql.v1beta4.InstancesFailoverRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.failover.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Failover_async - */ + /** + * Initiates a manual failover of a high availability (HA) primary instance + * to a standby instance, which becomes the primary instance. Users are + * then rerouted to the new primary. For more information, see the + * [Overview of high + * availability](https://cloud.google.com/sql/docs/mysql/high-availability) + * page in the Cloud SQL documentation. + * If using Legacy HA (MySQL only), this causes the instance to failover to + * its failover replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {google.cloud.sql.v1beta4.InstancesFailoverRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.failover.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Failover_async + */ failover( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest | undefined, + {} | undefined, + ] + >; failover( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; failover( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; failover( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('failover request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('failover response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.failover(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest|undefined, - {}|undefined - ]) => { - this._log.info('failover response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .failover(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesFailoverRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('failover response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Reencrypt CMEK instance with latest key version. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesReencryptRequest} request.body - * Reencrypt body that users request - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.reencrypt.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Reencrypt_async - */ + /** + * Reencrypt CMEK instance with latest key version. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesReencryptRequest} request.body + * Reencrypt body that users request + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.reencrypt.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Reencrypt_async + */ reencrypt( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest | undefined, + {} | undefined, + ] + >; reencrypt( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): void; reencrypt( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): void; reencrypt( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('reencrypt request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('reencrypt response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.reencrypt(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest|undefined, - {}|undefined - ]) => { - this._log.info('reencrypt response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .reencrypt(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesReencryptRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('reencrypt response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a resource containing information about a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.DatabaseInstance|DatabaseInstance}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Get_async - */ + /** + * Retrieves a resource containing information about a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.DatabaseInstance|DatabaseInstance}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Get_async + */ get( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IDatabaseInstance, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IDatabaseInstance, + protos.google.cloud.sql.v1beta4.ISqlInstancesGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Imports data into a Cloud SQL instance from a SQL dump or CSV file in - * Cloud Storage. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesImportRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.import.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Import_async - */ + /** + * Imports data into a Cloud SQL instance from a SQL dump or CSV file in + * Cloud Storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesImportRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.import.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Import_async + */ import( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest | undefined, + {} | undefined, + ] + >; import( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; import( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + >, + ): void; import( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('import request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('import response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.import(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest|undefined, - {}|undefined - ]) => { - this._log.info('import response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .import(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesImportRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('import response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Project ID of the project to which the newly created Cloud SQL instances - * should belong. - * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.insert.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Insert_async - */ + /** + * Creates a new Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.project + * Project ID of the project to which the newly created Cloud SQL instances + * should belong. + * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.insert.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Insert_async + */ insert( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest | undefined, + {} | undefined, + ] + >; insert( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; insert( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; insert( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('insert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest|undefined, - {}|undefined - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesInsertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists instances under a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.filter - * A filter expression that filters resources listed in the response. - * The expression is in the form of field:value. For example, - * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per - * their JSON representation, such as 'settings.userLabels.auto_start:true'. - * - * Multiple filter queries are space-separated. For example. - * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each - * expression is an AND expression. However, you can include AND and OR - * expressions explicitly. - * @param {number} request.maxResults - * The maximum number of instances to return. The service may return fewer - * than this value. - * If unspecified, at most 500 instances are returned. - * The maximum value is 1000; values above 1000 are coerced to 1000. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project for which to list Cloud SQL instances. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListResponse|InstancesListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_List_async - */ + /** + * Lists instances under a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.filter + * A filter expression that filters resources listed in the response. + * The expression is in the form of field:value. For example, + * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per + * their JSON representation, such as 'settings.userLabels.auto_start:true'. + * + * Multiple filter queries are space-separated. For example. + * 'state:RUNNABLE instanceType:CLOUD_SQL_INSTANCE'. By default, each + * expression is an AND expression. However, you can include AND and OR + * expressions explicitly. + * @param {number} request.maxResults + * The maximum number of instances to return. The service may return fewer + * than this value. + * If unspecified, at most 500 instances are returned. + * The maximum value is 1000; values above 1000 are coerced to 1000. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project for which to list Cloud SQL instances. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListResponse|InstancesListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_List_async + */ list( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IInstancesListResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IInstancesListResponse, + protos.google.cloud.sql.v1beta4.ISqlInstancesListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all of the trusted Certificate Authorities (CAs) for the specified - * instance. There can be up to three CAs listed: the CA that was used to sign - * the certificate that is currently in use, a CA that has been added but not - * yet used to sign a certificate, and a CA used to sign a certificate that - * has previously rotated out. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse|InstancesListServerCasResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.list_server_cas.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListServerCas_async - */ + /** + * Lists all of the trusted Certificate Authorities (CAs) for the specified + * instance. There can be up to three CAs listed: the CA that was used to sign + * the certificate that is currently in use, a CA that has been added but not + * yet used to sign a certificate, and a CA used to sign a certificate that + * has previously rotated out. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse|InstancesListServerCasResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.list_server_cas.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListServerCas_async + */ listServerCas( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | undefined + ), + {} | undefined, + ] + >; listServerCas( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listServerCas( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listServerCas( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listServerCas request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listServerCas response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listServerCas(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest|undefined, - {}|undefined - ]) => { - this._log.info('listServerCas response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listServerCas(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCasRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listServerCas response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all versions of server certificates and certificate authorities (CAs) - * for the specified instance. There can be up to three sets of certs listed: - * the certificate that is currently in use, a future that has been added but - * not yet used to sign a certificate, and a certificate that has been rotated - * out. For instances not using Certificate Authority Service (CAS) server CA, - * use ListServerCas instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse|InstancesListServerCertificatesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.list_server_certificates.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListServerCertificates_async - */ + /** + * Lists all versions of server certificates and certificate authorities (CAs) + * for the specified instance. There can be up to three sets of certs listed: + * the certificate that is currently in use, a future that has been added but + * not yet used to sign a certificate, and a certificate that has been rotated + * out. For instances not using Certificate Authority Service (CAS) server CA, + * use ListServerCas instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse|InstancesListServerCertificatesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.list_server_certificates.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListServerCertificates_async + */ listServerCertificates( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ] + >; listServerCertificates( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listServerCertificates( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listServerCertificates( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listServerCertificates request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listServerCertificates response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listServerCertificates(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest|undefined, - {}|undefined - ]) => { - this._log.info('listServerCertificates response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listServerCertificates(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListServerCertificatesRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listServerCertificates response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all versions of EntraID certificates for the specified instance. - * There can be up to three sets of certificates listed: the certificate that - * is currently in use, a future that has been added but not yet used to sign - * a certificate, and a certificate that has been rotated out. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse|InstancesListEntraIdCertificatesResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListEntraIdCertificates_async - */ + /** + * Lists all versions of EntraID certificates for the specified instance. + * There can be up to three sets of certificates listed: the certificate that + * is currently in use, a future that has been added but not yet used to sign + * a certificate, and a certificate that has been rotated out. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse|InstancesListEntraIdCertificatesResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.list_entra_id_certificates.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ListEntraIdCertificates_async + */ listEntraIdCertificates( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ] + >; listEntraIdCertificates( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listEntraIdCertificates( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): void; listEntraIdCertificates( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('listEntraIdCertificates request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('listEntraIdCertificates response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.listEntraIdCertificates(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest|undefined, - {}|undefined - ]) => { - this._log.info('listEntraIdCertificates response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .listEntraIdCertificates(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesListEntraIdCertificatesRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('listEntraIdCertificates response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Partially updates settings of a Cloud SQL instance by merging the request - * with the current configuration. This method supports patch semantics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.patch.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Patch_async - */ + /** + * Partially updates settings of a Cloud SQL instance by merging the request + * with the current configuration. This method supports patch semantics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.patch.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Patch_async + */ patch( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ] + >; patch( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + >, + ): void; patch( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + >, + ): void; patch( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('patch request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('patch response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.patch(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest|undefined, - {}|undefined - ]) => { - this._log.info('patch response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .patch(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesPatchRequest | undefined, + {} | undefined, + ]) => { + this._log.info('patch response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Promotes the read replica instance to be an independent Cloud SQL - * primary instance. - * Using this operation might cause your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {boolean} request.failover - * Set to true to invoke a replica failover to the DR replica. - * As part of replica failover, the promote operation attempts - * to add the original primary instance as a replica of the promoted - * DR replica when the original primary instance comes back online. - * If set to false or not specified, then the original primary - * instance becomes an independent Cloud SQL primary instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.promote_replica.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PromoteReplica_async - */ + /** + * Promotes the read replica instance to be an independent Cloud SQL + * primary instance. + * Using this operation might cause your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {boolean} request.failover + * Set to true to invoke a replica failover to the DR replica. + * As part of replica failover, the promote operation attempts + * to add the original primary instance as a replica of the promoted + * DR replica when the original primary instance comes back online. + * If set to false or not specified, then the original primary + * instance becomes an independent Cloud SQL primary instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.promote_replica.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PromoteReplica_async + */ promoteReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | undefined + ), + {} | undefined, + ] + >; promoteReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; promoteReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; promoteReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('promoteReplica request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('promoteReplica response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.promoteReplica(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest|undefined, - {}|undefined - ]) => { - this._log.info('promoteReplica response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .promoteReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPromoteReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('promoteReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Switches over from the primary instance to the DR replica - * instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the replica. - * @param {google.protobuf.Duration} [request.dbTimeout] - * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations - * timeout, which is a sum of all database operations. Default value is 10 - * minutes and can be modified to a maximum value of 24 hours. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.switchover.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Switchover_async - */ + /** + * Switches over from the primary instance to the DR replica + * instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the replica. + * @param {google.protobuf.Duration} [request.dbTimeout] + * Optional. (MySQL and PostgreSQL only) Cloud SQL instance operations + * timeout, which is a sum of all database operations. Default value is 10 + * minutes and can be modified to a maximum value of 24 hours. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.switchover.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Switchover_async + */ switchover( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | undefined + ), + {} | undefined, + ] + >; switchover( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; switchover( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): void; switchover( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('switchover request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('switchover response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.switchover(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest|undefined, - {}|undefined - ]) => { - this._log.info('switchover response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .switchover(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesSwitchoverRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('switchover response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Deletes all client certificates and generates a new server SSL certificate - * for the instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode} [request.mode] - * Optional. Reset SSL mode to use. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ResetSslConfig_async - */ + /** + * Deletes all client certificates and generates a new server SSL certificate + * for the instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest.ResetSslMode} [request.mode] + * Optional. Reset SSL mode to use. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.reset_ssl_config.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ResetSslConfig_async + */ resetSslConfig( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | undefined + ), + {} | undefined, + ] + >; resetSslConfig( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; resetSslConfig( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; resetSslConfig( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('resetSslConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('resetSslConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.resetSslConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('resetSslConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .resetSslConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetSslConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resetSslConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Restarts a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance to be restarted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.restart.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Restart_async - */ + /** + * Restarts a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance to be restarted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.restart.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Restart_async + */ restart( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest | undefined, + {} | undefined, + ] + >; restart( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + >, + ): void; restart( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + >, + ): void; restart( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('restart request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('restart response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.restart(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest|undefined, - {}|undefined - ]) => { - this._log.info('restart response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .restart(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestartRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('restart response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Restores a backup of a Cloud SQL instance. Using this operation might cause - * your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.restore_backup.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RestoreBackup_async - */ + /** + * Restores a backup of a Cloud SQL instance. Using this operation might cause + * your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesRestoreBackupRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.restore_backup.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RestoreBackup_async + */ restoreBackup( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | undefined + ), + {} | undefined, + ] + >; restoreBackup( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; restoreBackup( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): void; restoreBackup( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('restoreBackup request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('restoreBackup response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.restoreBackup(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest|undefined, - {}|undefined - ]) => { - this._log.info('restoreBackup response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .restoreBackup(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRestoreBackupRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('restoreBackup response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Rotates the server certificate to one signed by the Certificate Authority - * (CA) version previously added with the addServerCA method. For instances - * that have enabled Certificate Authority Service (CAS) based server CA, - * use RotateServerCertificate to rotate the server certificate. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCa_async - */ + /** + * Rotates the server certificate to one signed by the Certificate Authority + * (CA) version previously added with the addServerCA method. For instances + * that have enabled Certificate Authority Service (CAS) based server CA, + * use RotateServerCertificate to rotate the server certificate. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesRotateServerCaRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.rotate_server_ca.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCa_async + */ rotateServerCa( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | undefined + ), + {} | undefined, + ] + >; rotateServerCa( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateServerCa( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateServerCa( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('rotateServerCa request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('rotateServerCa response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.rotateServerCa(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest|undefined, - {}|undefined - ]) => { - this._log.info('rotateServerCa response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .rotateServerCa(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateServerCa response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Rotates the server certificate version to one previously added with the - * addServerCertificate method. For instances not using Certificate Authority - * Service (CAS) server CA, use RotateServerCa instead. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} request.body - * Required. Rotate server certificate request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCertificate_async - */ + /** + * Rotates the server certificate version to one previously added with the + * addServerCertificate method. For instances not using Certificate Authority + * Service (CAS) server CA, use RotateServerCa instead. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesRotateServerCertificateRequest} request.body + * Required. Rotate server certificate request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.rotate_server_certificate.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateServerCertificate_async + */ rotateServerCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ] + >; rotateServerCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateServerCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateServerCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('rotateServerCertificate request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('rotateServerCertificate response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.rotateServerCertificate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest|undefined, - {}|undefined - ]) => { - this._log.info('rotateServerCertificate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .rotateServerCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateServerCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateServerCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Rotates the Entra Id certificate version to one previously added with the - * addEntraIdCertificate method. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} request.body - * Required. Rotate Entra ID certificate request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateEntraIdCertificate_async - */ + /** + * Rotates the Entra Id certificate version to one previously added with the + * addEntraIdCertificate method. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesRotateEntraIdCertificateRequest} request.body + * Required. Rotate Entra ID certificate request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.rotate_entra_id_certificate.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RotateEntraIdCertificate_async + */ rotateEntraIdCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + >; rotateEntraIdCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateEntraIdCertificate( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rotateEntraIdCertificate( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('rotateEntraIdCertificate request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('rotateEntraIdCertificate response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.rotateEntraIdCertificate(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest|undefined, - {}|undefined - ]) => { - this._log.info('rotateEntraIdCertificate response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .rotateEntraIdCertificate(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRotateEntraIdCertificateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rotateEntraIdCertificate response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Starts the replication in the read replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.start_replica.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StartReplica_async - */ + /** + * Starts the replication in the read replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.start_replica.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StartReplica_async + */ startReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | undefined + ), + {} | undefined, + ] + >; startReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('startReplica request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('startReplica response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.startReplica(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest|undefined, - {}|undefined - ]) => { - this._log.info('startReplica response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .startReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Stops the replication in the read replica instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.stop_replica.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StopReplica_async - */ + /** + * Stops the replication in the read replica instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.stop_replica.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StopReplica_async + */ stopReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | undefined + ), + {} | undefined, + ] + >; stopReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; stopReplica( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): void; stopReplica( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('stopReplica request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('stopReplica response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.stopReplica(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest|undefined, - {}|undefined - ]) => { - this._log.info('stopReplica response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .stopReplica(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStopReplicaRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('stopReplica response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Truncate MySQL general and slow query log tables - * MySQL only. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the Cloud SQL project. - * @param {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.truncate_log.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_TruncateLog_async - */ + /** + * Truncate MySQL general and slow query log tables + * MySQL only. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the Cloud SQL project. + * @param {google.cloud.sql.v1beta4.InstancesTruncateLogRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.truncate_log.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_TruncateLog_async + */ truncateLog( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | undefined + ), + {} | undefined, + ] + >; truncateLog( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): void; truncateLog( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): void; truncateLog( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('truncateLog request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('truncateLog response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.truncateLog(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest|undefined, - {}|undefined - ]) => { - this._log.info('truncateLog response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .truncateLog(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesTruncateLogRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('truncateLog response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates settings of a Cloud SQL instance. Using this operation might cause - * your instance to restart. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.update.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Update_async - */ + /** + * Updates settings of a Cloud SQL instance. Using this operation might cause + * your instance to restart. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.DatabaseInstance} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.update.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_Update_async + */ update( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest | undefined, + {} | undefined, + ] + >; update( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; update( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): void; update( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('update request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('update response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.update(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest|undefined, - {}|undefined - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesUpdateRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Generates a short-lived X509 certificate containing the provided public key - * and signed by a private key specific to the target instance. Users may use - * the certificate to authenticate as themselves when connecting to the - * database. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the Cloud SQL project. - * @param {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCert|SslCert}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.create_ephemeral.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_CreateEphemeral_async - */ + /** + * Generates a short-lived X509 certificate containing the provided public key + * and signed by a private key specific to the target instance. Users may use + * the certificate to authenticate as themselves when connecting to the + * database. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the Cloud SQL project. + * @param {google.cloud.sql.v1beta4.SslCertsCreateEphemeralRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCert|SslCert}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.create_ephemeral.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_CreateEphemeral_async + */ createEphemeral( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCert, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ] + >; createEphemeral( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createEphemeral( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; createEphemeral( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCert, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('createEphemeral request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('createEphemeral response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.createEphemeral(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest|undefined, - {}|undefined - ]) => { - this._log.info('createEphemeral response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .createEphemeral(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISslCert, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesCreateEphemeralCertRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('createEphemeral response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Reschedules the maintenance on the given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RescheduleMaintenance_async - */ + /** + * Reschedules the maintenance on the given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequestBody} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.reschedule_maintenance.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_RescheduleMaintenance_async + */ rescheduleMaintenance( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ] + >; rescheduleMaintenance( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rescheduleMaintenance( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): void; rescheduleMaintenance( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('rescheduleMaintenance request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('rescheduleMaintenance response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.rescheduleMaintenance(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest|undefined, - {}|undefined - ]) => { - this._log.info('rescheduleMaintenance response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .rescheduleMaintenance(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesRescheduleMaintenanceRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('rescheduleMaintenance response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Verify External primary instance external sync settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {boolean} request.verifyConnectionOnly - * Flag to enable verifying connection only - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode - * External sync mode - * @param {boolean} [request.verifyReplicationOnly] - * Optional. Flag to verify settings required by replication setup only - * @param {google.cloud.sql.v1beta4.MySqlSyncConfig} [request.mysqlSyncConfig] - * Optional. MySQL-specific settings for start external sync. - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - * @param {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} [request.syncParallelLevel] - * Optional. Parallel level for initial data sync. Only applicable for - * PostgreSQL. - * @param {number[]} [request.selectedObjects] - * Optional. Migrate only the specified objects from the source instance. If - * this field is empty, then migrate all objects. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse|SqlInstancesVerifyExternalSyncSettingsResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_VerifyExternalSyncSettings_async - */ + /** + * Verify External primary instance external sync settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {boolean} request.verifyConnectionOnly + * Flag to enable verifying connection only + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode + * External sync mode + * @param {boolean} [request.verifyReplicationOnly] + * Optional. Flag to verify settings required by replication setup only + * @param {google.cloud.sql.v1beta4.MySqlSyncConfig} [request.mysqlSyncConfig] + * Optional. MySQL-specific settings for start external sync. + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + * @param {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} [request.syncParallelLevel] + * Optional. Parallel level for initial data sync. Only applicable for + * PostgreSQL. + * @param {number[]} [request.selectedObjects] + * Optional. Migrate only the specified objects from the source instance. If + * this field is empty, then migrate all objects. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse|SqlInstancesVerifyExternalSyncSettingsResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.verify_external_sync_settings.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_VerifyExternalSyncSettings_async + */ verifyExternalSyncSettings( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ] + >; verifyExternalSyncSettings( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; verifyExternalSyncSettings( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): void; verifyExternalSyncSettings( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('verifyExternalSyncSettings request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('verifyExternalSyncSettings response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.verifyExternalSyncSettings(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest|undefined, - {}|undefined - ]) => { - this._log.info('verifyExternalSyncSettings response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .verifyExternalSyncSettings(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('verifyExternalSyncSettings response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Start External primary instance migration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode - * External sync mode. - * @param {boolean} request.skipVerification - * Whether to skip the verification step (VESS). - * @param {google.cloud.sql.v1beta4.MySqlSyncConfig} request.mysqlSyncConfig - * MySQL-specific settings for start external sync. - * @param {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} [request.syncParallelLevel] - * Optional. Parallel level for initial data sync. Currently only applicable - * for MySQL. - * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] - * Optional. MigrationType configures the migration to use physical files or - * logical dump files. If not set, then the logical dump file configuration is - * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. - * @param {boolean} [request.replicaOverwriteEnabled] - * Optional. MySQL only. True if end-user has confirmed that this SES call - * will wipe replica databases overlapping with the proposed selected_objects. - * If this field is not set and there are both overlapping and additional - * databases proposed, an error will be returned. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.start_external_sync.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StartExternalSync_async - */ + /** + * Start External primary instance migration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.ExternalSyncMode} request.syncMode + * External sync mode. + * @param {boolean} request.skipVerification + * Whether to skip the verification step (VESS). + * @param {google.cloud.sql.v1beta4.MySqlSyncConfig} request.mysqlSyncConfig + * MySQL-specific settings for start external sync. + * @param {google.cloud.sql.v1beta4.ExternalSyncParallelLevel} [request.syncParallelLevel] + * Optional. Parallel level for initial data sync. Currently only applicable + * for MySQL. + * @param {google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest.MigrationType} [request.migrationType] + * Optional. MigrationType configures the migration to use physical files or + * logical dump files. If not set, then the logical dump file configuration is + * used. Valid values are `LOGICAL` or `PHYSICAL`. Only applicable to MySQL. + * @param {boolean} [request.replicaOverwriteEnabled] + * Optional. MySQL only. True if end-user has confirmed that this SES call + * will wipe replica databases overlapping with the proposed selected_objects. + * If this field is not set and there are both overlapping and additional + * databases proposed, an error will be returned. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.start_external_sync.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_StartExternalSync_async + */ startExternalSync( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ] + >; startExternalSync( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startExternalSync( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): void; startExternalSync( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('startExternalSync request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('startExternalSync response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.startExternalSync(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest|undefined, - {}|undefined - ]) => { - this._log.info('startExternalSync response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .startExternalSync(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesStartExternalSyncRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('startExternalSync response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Perform Disk Shrink on primary instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.PerformDiskShrinkContext} request.body - * Perform disk shrink context. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PerformDiskShrink_async - */ + /** + * Perform Disk Shrink on primary instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.PerformDiskShrinkContext} request.body + * Perform disk shrink context. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.perform_disk_shrink.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PerformDiskShrink_async + */ performDiskShrink( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ] + >; performDiskShrink( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): void; performDiskShrink( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): void; performDiskShrink( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('performDiskShrink request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('performDiskShrink response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.performDiskShrink(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest|undefined, - {}|undefined - ]) => { - this._log.info('performDiskShrink response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .performDiskShrink(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPerformDiskShrinkRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('performDiskShrink response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Get Disk Shrink Config for a given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse|SqlInstancesGetDiskShrinkConfigResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_GetDiskShrinkConfig_async - */ + /** + * Get Disk Shrink Config for a given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse|SqlInstancesGetDiskShrinkConfigResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.get_disk_shrink_config.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_GetDiskShrinkConfig_async + */ getDiskShrinkConfig( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ] + >; getDiskShrinkConfig( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDiskShrinkConfig( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getDiskShrinkConfig( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getDiskShrinkConfig request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getDiskShrinkConfig response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getDiskShrinkConfig(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest|undefined, - {}|undefined - ]) => { - this._log.info('getDiskShrinkConfig response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getDiskShrinkConfig(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getDiskShrinkConfig response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Reset Replica Size to primary instance disk size. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL read replica instance name. - * @param {string} request.project - * ID of the project that contains the read replica. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.reset_replica_size.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ResetReplicaSize_async - */ + /** + * Reset Replica Size to primary instance disk size. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL read replica instance name. + * @param {string} request.project + * ID of the project that contains the read replica. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.reset_replica_size.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ResetReplicaSize_async + */ resetReplicaSize( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ] + >; resetReplicaSize( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; resetReplicaSize( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; resetReplicaSize( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('resetReplicaSize request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('resetReplicaSize response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.resetReplicaSize(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest|undefined, - {}|undefined - ]) => { - this._log.info('resetReplicaSize response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .resetReplicaSize(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesResetReplicaSizeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('resetReplicaSize response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Get Latest Recovery Time for a given instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.protobuf.Timestamp} request.sourceInstanceDeletionTime - * The timestamp used to identify the time when the source instance is - * deleted. If this instance is deleted, then you must set the timestamp. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse|SqlInstancesGetLatestRecoveryTimeResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_GetLatestRecoveryTime_async - */ + /** + * Get Latest Recovery Time for a given instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.protobuf.Timestamp} request.sourceInstanceDeletionTime + * The timestamp used to identify the time when the source instance is + * deleted. If this instance is deleted, then you must set the timestamp. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse|SqlInstancesGetLatestRecoveryTimeResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.get_latest_recovery_time.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_GetLatestRecoveryTime_async + */ getLatestRecoveryTime( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ] + >; getLatestRecoveryTime( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getLatestRecoveryTime( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; getLatestRecoveryTime( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('getLatestRecoveryTime request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('getLatestRecoveryTime response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.getLatestRecoveryTime(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest|undefined, - {}|undefined - ]) => { - this._log.info('getLatestRecoveryTime response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .getLatestRecoveryTime(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('getLatestRecoveryTime response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Execute SQL statements. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Database instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.ExecuteSqlPayload} request.body - * The request body. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse|SqlInstancesExecuteSqlResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.execute_sql.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ExecuteSql_async - */ + /** + * Execute SQL statements. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Database instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.ExecuteSqlPayload} request.body + * The request body. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse|SqlInstancesExecuteSqlResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.execute_sql.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ExecuteSql_async + */ executeSql( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | undefined + ), + {} | undefined, + ] + >; executeSql( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): void; executeSql( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): void; executeSql( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('executeSql request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('executeSql response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.executeSql(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest|undefined, - {}|undefined - ]) => { - this._log.info('executeSql response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .executeSql(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('executeSql response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Acquire a lease for the setup of SQL Server Reporting Services (SSRS). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This doesn't include the project ID. It's - * composed of lowercase letters, numbers, and hyphens, and it must start with - * a letter. The total length must be 98 characters or less (Example: - * instance-id). - * @param {string} request.project - * Required. ID of the project that contains the instance (Example: - * project-id). - * @param {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} request.body - * The body for request to acquire an SSRS lease. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse|SqlInstancesAcquireSsrsLeaseResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_async - */ + /** + * Acquire a lease for the setup of SQL Server Reporting Services (SSRS). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This doesn't include the project ID. It's + * composed of lowercase letters, numbers, and hyphens, and it must start with + * a letter. The total length must be 98 characters or less (Example: + * instance-id). + * @param {string} request.project + * Required. ID of the project that contains the instance (Example: + * project-id). + * @param {google.cloud.sql.v1beta4.InstancesAcquireSsrsLeaseRequest} request.body + * The body for request to acquire an SSRS lease. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse|SqlInstancesAcquireSsrsLeaseResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.acquire_ssrs_lease.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_AcquireSsrsLease_async + */ acquireSsrsLease( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + >; acquireSsrsLease( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; acquireSsrsLease( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; acquireSsrsLease( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('acquireSsrsLease request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('acquireSsrsLease response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.acquireSsrsLease(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest|undefined, - {}|undefined - ]) => { - this._log.info('acquireSsrsLease response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .acquireSsrsLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('acquireSsrsLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Release a lease for the setup of SQL Server Reporting Services (SSRS). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. The Cloud SQL instance ID. This doesn't include the project ID. - * It's composed of lowercase letters, numbers, and hyphens, and it must start - * with a letter. The total length must be 98 characters or less (Example: - * instance-id). - * @param {string} request.project - * Required. The ID of the project that contains the instance (Example: - * project-id). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse|SqlInstancesReleaseSsrsLeaseResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_async - */ + /** + * Release a lease for the setup of SQL Server Reporting Services (SSRS). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. The Cloud SQL instance ID. This doesn't include the project ID. + * It's composed of lowercase letters, numbers, and hyphens, and it must start + * with a letter. The total length must be 98 characters or less (Example: + * instance-id). + * @param {string} request.project + * Required. The ID of the project that contains the instance (Example: + * project-id). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse|SqlInstancesReleaseSsrsLeaseResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.release_ssrs_lease.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_ReleaseSsrsLease_async + */ releaseSsrsLease( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + >; releaseSsrsLease( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; releaseSsrsLease( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): void; releaseSsrsLease( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('releaseSsrsLease request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('releaseSsrsLease response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.releaseSsrsLease(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, - protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest|undefined, - {}|undefined - ]) => { - this._log.info('releaseSsrsLease response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .releaseSsrsLease(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('releaseSsrsLease response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Execute MVU Pre-checks - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Required. Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Required. Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} request.body - * Required. The context for request to perform the pre-check major version - * upgrade operation. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async - */ + /** + * Execute MVU Pre-checks + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Required. Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Required. Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.InstancesPreCheckMajorVersionUpgradeRequest} request.body + * Required. The context for request to perform the pre-check major version + * upgrade operation. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.pre_check_major_version_upgrade.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PreCheckMajorVersionUpgrade_async + */ preCheckMajorVersionUpgrade( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ] + >; preCheckMajorVersionUpgrade( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; preCheckMajorVersionUpgrade( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): void; preCheckMajorVersionUpgrade( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('preCheckMajorVersionUpgrade request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('preCheckMajorVersionUpgrade response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.preCheckMajorVersionUpgrade(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest|undefined, - {}|undefined - ]) => { - this._log.info('preCheckMajorVersionUpgrade response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .preCheckMajorVersionUpgrade(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPreCheckMajorVersionUpgradeRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('preCheckMajorVersionUpgrade response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Point in time restore for an instance managed by Google Cloud Backup and - * Disaster Recovery. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource where you created this instance. - * Format: projects/{project} - * @param {google.cloud.sql.v1beta4.PointInTimeRestoreContext} request.context - * Required. The context for request to perform a PITR on a Google Cloud - * Backup and Disaster Recovery managed instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js - * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PointInTimeRestore_async - */ + /** + * Point in time restore for an instance managed by Google Cloud Backup and + * Disaster Recovery. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource where you created this instance. + * Format: projects/{project} + * @param {google.cloud.sql.v1beta4.PointInTimeRestoreContext} request.context + * Required. The context for request to perform a PITR on a Google Cloud + * Backup and Disaster Recovery managed instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_instances_service.point_in_time_restore.js + * region_tag:sqladmin_v1beta4_generated_SqlInstancesService_PointInTimeRestore_async + */ pointInTimeRestore( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ] + >; pointInTimeRestore( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): void; pointInTimeRestore( - request: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): void; pointInTimeRestore( - request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: request.parent ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('pointInTimeRestore request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('pointInTimeRestore response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.pointInTimeRestore(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest|undefined, - {}|undefined - ]) => { - this._log.info('pointInTimeRestore response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .pointInTimeRestore(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + ( + | protos.google.cloud.sql.v1beta4.ISqlInstancesPointInTimeRestoreRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('pointInTimeRestore response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -4713,12 +6818,11 @@ export class SqlInstancesServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -4751,7 +6855,7 @@ export class SqlInstancesServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -4767,7 +6871,7 @@ export class SqlInstancesServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -4802,7 +6906,7 @@ export class SqlInstancesServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -4827,13 +6931,15 @@ export class SqlInstancesServiceClient { */ close(): Promise { if (this.sqlInstancesServiceStub && !this._terminated) { - return this.sqlInstancesServiceStub.then(stub => { + return this.sqlInstancesServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts b/packages/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts index 8889aa76f6d8..ceb1fa381192 100644 --- a/packages/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts +++ b/packages/google-cloud-sql/src/v1beta4/sql_operations_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -43,7 +50,7 @@ export class SqlOperationsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -56,10 +63,10 @@ export class SqlOperationsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlOperationsServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlOperationsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlOperationsServiceClient. @@ -100,21 +107,42 @@ export class SqlOperationsServiceClient { * const client = new SqlOperationsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlOperationsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +167,7 @@ export class SqlOperationsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,15 +181,11 @@ export class SqlOperationsServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -183,17 +207,20 @@ export class SqlOperationsServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlOperationsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1beta4.SqlOperationsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -224,36 +251,40 @@ export class SqlOperationsServiceClient { // Put together the "service stub" for // google.cloud.sql.v1beta4.SqlOperationsService. this.sqlOperationsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1beta4.SqlOperationsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlOperationsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1beta4.SqlOperationsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlOperationsServiceStubMethods = - ['get', 'list', 'cancel']; + const sqlOperationsServiceStubMethods = ['get', 'list', 'cancel']; for (const methodName of sqlOperationsServiceStubMethods) { const callPromise = this.sqlOperationsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -268,8 +299,14 @@ export class SqlOperationsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -280,8 +317,14 @@ export class SqlOperationsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -314,7 +357,7 @@ export class SqlOperationsServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -324,8 +367,9 @@ export class SqlOperationsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -336,305 +380,428 @@ export class SqlOperationsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Retrieves an instance operation that has been performed on an instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Instance operation ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_operations_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_Get_async - */ + /** + * Retrieves an instance operation that has been performed on an instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.operation + * Instance operation ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_operations_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_Get_async + */ get( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'operation': request.operation ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + operation: request.operation ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlOperationsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all instance operations that have been performed on the given Cloud - * SQL instance in the reverse chronological order of the start time. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {number} request.maxResults - * Maximum number of operations per response. - * @param {string} request.pageToken - * A previously-returned page token representing part of the larger set of - * results to view. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.OperationsListResponse|OperationsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_operations_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_List_async - */ + /** + * Lists all instance operations that have been performed on the given Cloud + * SQL instance in the reverse chronological order of the start time. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {number} request.maxResults + * Maximum number of operations per response. + * @param {string} request.pageToken + * A previously-returned page token representing part of the larger set of + * results to view. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.OperationsListResponse|OperationsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_operations_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_List_async + */ list( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperationsListResponse, - protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperationsListResponse, + protos.google.cloud.sql.v1beta4.ISqlOperationsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Cancels an instance operation that has been performed on an instance. - * Ordinarily, this method name should be `CancelSqlOperation`. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.operation - * Instance operation ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_operations_service.cancel.js - * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_Cancel_async - */ + /** + * Cancels an instance operation that has been performed on an instance. + * Ordinarily, this method name should be `CancelSqlOperation`. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.operation + * Instance operation ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.protobuf.Empty|Empty}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_operations_service.cancel.js + * region_tag:sqladmin_v1beta4_generated_SqlOperationsService_Cancel_async + */ cancel( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest | undefined, + {} | undefined, + ] + >; cancel( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; cancel( - request: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + >, + ): void; cancel( - request?: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.protobuf.IEmpty, + protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'operation': request.operation ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + operation: request.operation ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('cancel request %j', request); - const wrappedCallback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.protobuf.IEmpty, + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('cancel response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.cancel(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.protobuf.IEmpty, - protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest|undefined, - {}|undefined - ]) => { - this._log.info('cancel response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .cancel(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.protobuf.IEmpty, + ( + | protos.google.cloud.sql.v1beta4.ISqlOperationsCancelRequest + | undefined + ), + {} | undefined, + ]) => { + this._log.info('cancel response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -669,12 +836,11 @@ export class SqlOperationsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -707,7 +873,7 @@ export class SqlOperationsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -723,7 +889,7 @@ export class SqlOperationsServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -758,7 +924,7 @@ export class SqlOperationsServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -783,13 +949,15 @@ export class SqlOperationsServiceClient { */ close(): Promise { if (this.sqlOperationsServiceStub && !this._terminated) { - return this.sqlOperationsServiceStub.then(stub => { + return this.sqlOperationsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts b/packages/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts index 017e4fb36684..aeb3ba6c3aa3 100644 --- a/packages/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts +++ b/packages/google-cloud-sql/src/v1beta4/sql_ssl_certs_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -43,7 +50,7 @@ export class SqlSslCertsServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -56,10 +63,10 @@ export class SqlSslCertsServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlSslCertsServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlSslCertsServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlSslCertsServiceClient. @@ -100,21 +107,42 @@ export class SqlSslCertsServiceClient { * const client = new SqlSslCertsServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlSslCertsServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +167,7 @@ export class SqlSslCertsServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,15 +181,11 @@ export class SqlSslCertsServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -183,17 +207,20 @@ export class SqlSslCertsServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' + 'projects/{project}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlSslCertsService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1beta4.SqlSslCertsService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -224,36 +251,40 @@ export class SqlSslCertsServiceClient { // Put together the "service stub" for // google.cloud.sql.v1beta4.SqlSslCertsService. this.sqlSslCertsServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1beta4.SqlSslCertsService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlSslCertsService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1beta4.SqlSslCertsService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlSslCertsServiceStubMethods = - ['delete', 'get', 'insert', 'list']; + const sqlSslCertsServiceStubMethods = ['delete', 'get', 'insert', 'list']; for (const methodName of sqlSslCertsServiceStubMethods) { const callPromise = this.sqlSslCertsServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -268,8 +299,14 @@ export class SqlSslCertsServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -280,8 +317,14 @@ export class SqlSslCertsServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -314,7 +357,7 @@ export class SqlSslCertsServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -324,8 +367,9 @@ export class SqlSslCertsServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -336,408 +380,562 @@ export class SqlSslCertsServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Deletes the SSL certificate. For First Generation instances, the - * certificate remains valid until the instance is restarted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.sha1Fingerprint - * Sha1 FingerPrint. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_ssl_certs_service.delete.js - * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Delete_async - */ + /** + * Deletes the SSL certificate. For First Generation instances, the + * certificate remains valid until the instance is restarted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.sha1Fingerprint + * Sha1 FingerPrint. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_ssl_certs_service.delete.js + * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Delete_async + */ delete( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ] + >; delete( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; delete( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): void; delete( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'sha1_fingerprint': request.sha1Fingerprint ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + sha1_fingerprint: request.sha1Fingerprint ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('delete response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest|undefined, - {}|undefined - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlSslCertsDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a particular SSL certificate. Does not include the private key - * (required for usage). The private key must be saved from the response to - * initial creation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.sha1Fingerprint - * Sha1 FingerPrint. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCert|SslCert}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_ssl_certs_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Get_async - */ + /** + * Retrieves a particular SSL certificate. Does not include the private key + * (required for usage). The private key must be saved from the response to + * initial creation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.sha1Fingerprint + * Sha1 FingerPrint. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCert|SslCert}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_ssl_certs_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Get_async + */ get( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'sha1_fingerprint': request.sha1Fingerprint ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + sha1_fingerprint: request.sha1Fingerprint ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISslCert, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISslCert, - protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISslCert, + protos.google.cloud.sql.v1beta4.ISqlSslCertsGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates an SSL certificate and returns it along with the private key and - * server certificate authority. The new certificate will not be usable until - * the instance is restarted. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.SslCertsInsertRequest} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCertsInsertResponse|SslCertsInsertResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_ssl_certs_service.insert.js - * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Insert_async - */ + /** + * Creates an SSL certificate and returns it along with the private key and + * server certificate authority. The new certificate will not be usable until + * the instance is restarted. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.SslCertsInsertRequest} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCertsInsertResponse|SslCertsInsertResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_ssl_certs_service.insert.js + * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_Insert_async + */ insert( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ] + >; insert( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; insert( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): void; insert( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('insert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest|undefined, - {}|undefined - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists all of the current SSL certificates for the instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Cloud SQL instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCertsListResponse|SslCertsListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_ssl_certs_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_List_async - */ + /** + * Lists all of the current SSL certificates for the instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Cloud SQL instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.SslCertsListResponse|SslCertsListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_ssl_certs_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlSslCertsService_List_async + */ list( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest + | null + | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest + | null + | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + | protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ISslCertsListResponse, - protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ISslCertsListResponse, + protos.google.cloud.sql.v1beta4.ISqlSslCertsListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -772,12 +970,11 @@ export class SqlSslCertsServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -810,7 +1007,7 @@ export class SqlSslCertsServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -826,7 +1023,7 @@ export class SqlSslCertsServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -861,7 +1058,7 @@ export class SqlSslCertsServiceClient { * @param {string} project * @returns {string} Resource name string. */ - projectPath(project:string) { + projectPath(project: string) { return this.pathTemplates.projectPathTemplate.render({ project: project, }); @@ -886,13 +1083,15 @@ export class SqlSslCertsServiceClient { */ close(): Promise { if (this.sqlSslCertsServiceStub && !this._terminated) { - return this.sqlSslCertsServiceStub.then(stub => { + return this.sqlSslCertsServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts b/packages/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts index 3491ba057e4e..599f74109a04 100644 --- a/packages/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts +++ b/packages/google-cloud-sql/src/v1beta4/sql_tiers_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -44,7 +51,7 @@ export class SqlTiersServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -57,10 +64,10 @@ export class SqlTiersServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlTiersServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlTiersServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlTiersServiceClient. @@ -101,21 +108,42 @@ export class SqlTiersServiceClient { * const client = new SqlTiersServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlTiersServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -140,7 +168,7 @@ export class SqlTiersServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -154,15 +182,11 @@ export class SqlTiersServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -184,14 +208,17 @@ export class SqlTiersServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlTiersService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1beta4.SqlTiersService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -222,36 +249,40 @@ export class SqlTiersServiceClient { // Put together the "service stub" for // google.cloud.sql.v1beta4.SqlTiersService. this.sqlTiersServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1beta4.SqlTiersService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlTiersService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1beta4.SqlTiersService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlTiersServiceStubMethods = - ['list']; + const sqlTiersServiceStubMethods = ['list']; for (const methodName of sqlTiersServiceStubMethods) { const callPromise = this.sqlTiersServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -266,8 +297,14 @@ export class SqlTiersServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -278,8 +315,14 @@ export class SqlTiersServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -312,7 +355,7 @@ export class SqlTiersServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -322,8 +365,9 @@ export class SqlTiersServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -334,103 +378,137 @@ export class SqlTiersServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Lists all available machine types (tiers) for Cloud SQL, for example, - * `db-custom-1-3840`. For related information, see [Pricing](/sql/pricing). - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.project - * Project ID of the project for which to list tiers. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.TiersListResponse|TiersListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_tiers_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlTiersService_List_async - */ + /** + * Lists all available machine types (tiers) for Cloud SQL, for example, + * `db-custom-1-3840`. For related information, see [Pricing](/sql/pricing). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.project + * Project ID of the project for which to list tiers. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.TiersListResponse|TiersListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_tiers_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlTiersService_List_async + */ list( - request?: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlTiersListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlTiersListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.ITiersListResponse, + | protos.google.cloud.sql.v1beta4.ISqlTiersListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.ITiersListResponse, - protos.google.cloud.sql.v1beta4.ISqlTiersListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.ITiersListResponse, + protos.google.cloud.sql.v1beta4.ISqlTiersListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -465,12 +543,11 @@ export class SqlTiersServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -503,7 +580,7 @@ export class SqlTiersServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -519,7 +596,7 @@ export class SqlTiersServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -556,13 +633,15 @@ export class SqlTiersServiceClient { */ close(): Promise { if (this.sqlTiersServiceStub && !this._terminated) { - return this.sqlTiersServiceStub.then(stub => { + return this.sqlTiersServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/src/v1beta4/sql_users_service_client.ts b/packages/google-cloud-sql/src/v1beta4/sql_users_service_client.ts index 0f2b60605587..2f95c603fe50 100644 --- a/packages/google-cloud-sql/src/v1beta4/sql_users_service_client.ts +++ b/packages/google-cloud-sql/src/v1beta4/sql_users_service_client.ts @@ -18,11 +18,18 @@ /* global window */ import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos} from 'google-gax'; +import type { + Callback, + CallOptions, + Descriptors, + ClientOptions, + LocationsClient, + LocationProtos, +} from 'google-gax'; import * as protos from '../../protos/protos'; import jsonProtos = require('../../protos/protos.json'); -import {loggingUtils as logging, decodeAnyProtosInArray} from 'google-gax'; +import { loggingUtils as logging, decodeAnyProtosInArray } from 'google-gax'; /** * Client JSON configuration object, loaded from @@ -43,7 +50,7 @@ export class SqlUsersServiceClient { private _gaxModule: typeof gax | typeof gax.fallback; private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; + private _defaults: { [method: string]: gax.CallSettings }; private _universeDomain: string; private _servicePath: string; private _log = logging.log('sql'); @@ -56,10 +63,10 @@ export class SqlUsersServiceClient { batching: {}, }; warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; + innerApiCalls: { [name: string]: Function }; locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - sqlUsersServiceStub?: Promise<{[name: string]: Function}>; + pathTemplates: { [name: string]: gax.PathTemplate }; + sqlUsersServiceStub?: Promise<{ [name: string]: Function }>; /** * Construct an instance of SqlUsersServiceClient. @@ -100,21 +107,42 @@ export class SqlUsersServiceClient { * const client = new SqlUsersServiceClient({fallback: true}, gax); * ``` */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + constructor( + opts?: ClientOptions, + gaxInstance?: typeof gax | typeof gax.fallback, + ) { // Ensure that options include all the required fields. const staticMembers = this.constructor as typeof SqlUsersServiceClient; - if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) { - throw new Error('Please set either universe_domain or universeDomain, but not both.'); + if ( + opts?.universe_domain && + opts?.universeDomain && + opts?.universe_domain !== opts?.universeDomain + ) { + throw new Error( + 'Please set either universe_domain or universeDomain, but not both.', + ); } - const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined; - this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com'; + const universeDomainEnvVar = + typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + opts?.universeDomain ?? + opts?.universe_domain ?? + universeDomainEnvVar ?? + 'googleapis.com'; this._servicePath = 'sqladmin.' + this._universeDomain; - const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const servicePath = + opts?.servicePath || opts?.apiEndpoint || this._servicePath; + this._providedCustomServicePath = !!( + opts?.servicePath || opts?.apiEndpoint + ); const port = opts?.port || staticMembers.port; const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + const fallback = + opts?.fallback ?? + (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // Request numeric enum values if REST transport is used. opts.numericEnums = true; @@ -139,7 +167,7 @@ export class SqlUsersServiceClient { this._opts = opts; // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + this.auth = this._gaxGrpc.auth as gax.GoogleAuth; // Set useJWTAccessWithScope on the auth object. this.auth.useJWTAccessWithScope = true; @@ -153,15 +181,11 @@ export class SqlUsersServiceClient { } this.locationsClient = new this._gaxModule.LocationsClient( this._gaxGrpc, - opts + opts, ); - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; if (typeof process === 'object' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { @@ -183,14 +207,17 @@ export class SqlUsersServiceClient { // Create useful helper objects for these. this.pathTemplates = { backupPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/backups/{backup}' + 'projects/{project}/backups/{backup}', ), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.sql.v1beta4.SqlUsersService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + 'google.cloud.sql.v1beta4.SqlUsersService', + gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, + { 'x-goog-api-client': clientHeader.join(' ') }, + ); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code @@ -221,36 +248,46 @@ export class SqlUsersServiceClient { // Put together the "service stub" for // google.cloud.sql.v1beta4.SqlUsersService. this.sqlUsersServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.sql.v1beta4.SqlUsersService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._opts.fallback + ? (this._protos as protobuf.Root).lookupService( + 'google.cloud.sql.v1beta4.SqlUsersService', + ) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any (this._protos as any).google.cloud.sql.v1beta4.SqlUsersService, - this._opts, this._providedCustomServicePath) as Promise<{[method: string]: Function}>; + this._opts, + this._providedCustomServicePath, + ) as Promise<{ [method: string]: Function }>; // Iterate over each of the methods that the service provides // and create an API call method for each. - const sqlUsersServiceStubMethods = - ['delete', 'get', 'insert', 'list', 'update']; + const sqlUsersServiceStubMethods = [ + 'delete', + 'get', + 'insert', + 'list', + 'update', + ]; for (const methodName of sqlUsersServiceStubMethods) { const callPromise = this.sqlUsersServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { + (stub) => + (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error | null | undefined) => () => { throw err; - }); + }, + ); - const descriptor = - undefined; + const descriptor = undefined; const apiCall = this._gaxModule.createApiCall( callPromise, this._defaults[methodName], descriptor, - this._opts.fallback + this._opts.fallback, ); this.innerApiCalls[methodName] = apiCall; @@ -265,8 +302,14 @@ export class SqlUsersServiceClient { * @returns {string} The DNS address for this service. */ static get servicePath() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static servicePath is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -277,8 +320,14 @@ export class SqlUsersServiceClient { * @returns {string} The DNS address for this service. */ static get apiEndpoint() { - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + process.emitWarning( + 'Static apiEndpoint is deprecated, please use the instance method instead.', + 'DeprecationWarning', + ); } return 'sqladmin.googleapis.com'; } @@ -311,7 +360,7 @@ export class SqlUsersServiceClient { static get scopes() { return [ 'https://www.googleapis.com/auth/cloud-platform', - 'https://www.googleapis.com/auth/sqlservice.admin' + 'https://www.googleapis.com/auth/sqlservice.admin', ]; } @@ -321,8 +370,9 @@ export class SqlUsersServiceClient { * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ - getProjectId(callback?: Callback): - Promise|void { + getProjectId( + callback?: Callback, + ): Promise | void { if (callback) { this.auth.getProjectId(callback); return; @@ -333,515 +383,685 @@ export class SqlUsersServiceClient { // ------------------- // -- Service calls -- // ------------------- -/** - * Deletes a user from a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.host - * Host of the user in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * Name of the user in the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_users_service.delete.js - * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Delete_async - */ + /** + * Deletes a user from a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.host + * Host of the user in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * Name of the user in the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_users_service.delete.js + * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Delete_async + */ delete( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ] + >; delete( - request: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): void; delete( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('delete request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('delete response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.delete(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest|undefined, - {}|undefined - ]) => { - this._log.info('delete response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .delete(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersDeleteRequest | undefined, + {} | undefined, + ]) => { + this._log.info('delete response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Retrieves a resource containing information about a user. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * User of the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string} request.host - * Host of a user of the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.User|User}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_users_service.get.js - * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Get_async - */ + /** + * Retrieves a resource containing information about a user. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * User of the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string} request.host + * Host of a user of the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.User|User}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_users_service.get.js + * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Get_async + */ get( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | undefined, + {} | undefined, + ] + >; get( - request: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): void; get( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', - 'name': request.name ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + name: request.name ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('get request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IUser, + | protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('get response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.get(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IUser, - protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest|undefined, - {}|undefined - ]) => { - this._log.info('get response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .get(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IUser, + protos.google.cloud.sql.v1beta4.ISqlUsersGetRequest | undefined, + {} | undefined, + ]) => { + this._log.info('get response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Creates a new user in a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {google.cloud.sql.v1beta4.User} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_users_service.insert.js - * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Insert_async - */ + /** + * Creates a new user in a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {google.cloud.sql.v1beta4.User} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_users_service.insert.js + * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Insert_async + */ insert( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | undefined, + {} | undefined, + ] + >; insert( - request: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): void; insert( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('insert request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('insert response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.insert(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest|undefined, - {}|undefined - ]) => { - this._log.info('insert response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .insert(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersInsertRequest | undefined, + {} | undefined, + ]) => { + this._log.info('insert response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Lists users in the specified Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.UsersListResponse|UsersListResponse}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_users_service.list.js - * region_tag:sqladmin_v1beta4_generated_SqlUsersService_List_async - */ + /** + * Lists users in the specified Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.UsersListResponse|UsersListResponse}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_users_service.list.js + * region_tag:sqladmin_v1beta4_generated_SqlUsersService_List_async + */ list( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | undefined, + {} | undefined, + ] + >; list( - request: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): void; list( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlUsersListRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlUsersListRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('list request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IUsersListResponse, + | protos.google.cloud.sql.v1beta4.ISqlUsersListRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('list response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.list(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IUsersListResponse, - protos.google.cloud.sql.v1beta4.ISqlUsersListRequest|undefined, - {}|undefined - ]) => { - this._log.info('list response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .list(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IUsersListResponse, + protos.google.cloud.sql.v1beta4.ISqlUsersListRequest | undefined, + {} | undefined, + ]) => { + this._log.info('list response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** - * Updates an existing user in a Cloud SQL instance. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} [request.host] - * Optional. Host of the user in the instance. - * @param {string} request.instance - * Database instance ID. This does not include the project ID. - * @param {string} request.name - * Name of the user in the instance. - * @param {string} request.project - * Project ID of the project that contains the instance. - * @param {string[]} [request.databaseRoles] - * Optional. List of database roles to grant to the user. body.database_roles - * will be ignored for update request. - * @param {boolean} [request.revokeExistingRoles] - * Optional. Specifies whether to revoke existing roles that are not present - * in the `database_roles` field. If `false` or unset, the database roles - * specified in `database_roles` are added to the user's existing roles. - * @param {google.cloud.sql.v1beta4.User} request.body - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. - * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } - * for more details and examples. - * @example include:samples/generated/v1beta4/sql_users_service.update.js - * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Update_async - */ + /** + * Updates an existing user in a Cloud SQL instance. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} [request.host] + * Optional. Host of the user in the instance. + * @param {string} request.instance + * Database instance ID. This does not include the project ID. + * @param {string} request.name + * Name of the user in the instance. + * @param {string} request.project + * Project ID of the project that contains the instance. + * @param {string[]} [request.databaseRoles] + * Optional. List of database roles to grant to the user. body.database_roles + * will be ignored for update request. + * @param {boolean} [request.revokeExistingRoles] + * Optional. Specifies whether to revoke existing roles that are not present + * in the `database_roles` field. If `false` or unset, the database roles + * specified in `database_roles` are added to the user's existing roles. + * @param {google.cloud.sql.v1beta4.User} request.body + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link protos.google.cloud.sql.v1beta4.Operation|Operation}. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation } + * for more details and examples. + * @example include:samples/generated/v1beta4/sql_users_service.update.js + * region_tag:sqladmin_v1beta4_generated_SqlUsersService_Update_async + */ update( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest|undefined, {}|undefined - ]>; + request?: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, + options?: CallOptions, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ] + >; update( - request: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; update( - request: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, - callback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest|null|undefined, - {}|null|undefined>): void; + request: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, + callback: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): void; update( - request?: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< + request?: protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest, + optionsOrCallback?: + | CallOptions + | Callback< protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest|undefined, {}|undefined - ]>|void { + | protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | null | undefined, + {} | null | undefined + >, + ): Promise< + [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ] + > | void { request = request || {}; let options: CallOptions; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; - } - else { + } else { options = optionsOrCallback as CallOptions; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'project': request.project ?? '', - 'instance': request.instance ?? '', + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + project: request.project ?? '', + instance: request.instance ?? '', + }); + this.initialize().catch((err) => { + throw err; }); - this.initialize().catch(err => {throw err}); this._log.info('update request %j', request); - const wrappedCallback: Callback< - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest|null|undefined, - {}|null|undefined>|undefined = callback + const wrappedCallback: + | Callback< + protos.google.cloud.sql.v1beta4.IOperation, + | protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest + | null + | undefined, + {} | null | undefined + > + | undefined = callback ? (error, response, options, rawResponse) => { this._log.info('update response %j', response); callback!(error, response, options, rawResponse); // We verified callback above. } : undefined; - return this.innerApiCalls.update(request, options, wrappedCallback) - ?.then(([response, options, rawResponse]: [ - protos.google.cloud.sql.v1beta4.IOperation, - protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest|undefined, - {}|undefined - ]) => { - this._log.info('update response %j', response); - return [response, options, rawResponse]; - }).catch((error: any) => { - if (error && 'statusDetails' in error && error.statusDetails instanceof Array) { - const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos) as unknown as gax.protobuf.Type; - error.statusDetails = decodeAnyProtosInArray(error.statusDetails, protos); + return this.innerApiCalls + .update(request, options, wrappedCallback) + ?.then( + ([response, options, rawResponse]: [ + protos.google.cloud.sql.v1beta4.IOperation, + protos.google.cloud.sql.v1beta4.ISqlUsersUpdateRequest | undefined, + {} | undefined, + ]) => { + this._log.info('update response %j', response); + return [response, options, rawResponse]; + }, + ) + .catch((error: any) => { + if ( + error && + 'statusDetails' in error && + error.statusDetails instanceof Array + ) { + const protos = this._gaxModule.protobuf.Root.fromJSON( + jsonProtos, + ) as unknown as gax.protobuf.Type; + error.statusDetails = decodeAnyProtosInArray( + error.statusDetails, + protos, + ); } throw error; }); } -/** + /** * Gets information about a location. * * @param {Object} request @@ -876,12 +1096,11 @@ export class SqlUsersServiceClient { | null | undefined, {} | null | undefined - > + >, ): Promise { return this.locationsClient.getLocation(request, options, callback); } - -/** + /** * Lists information about the supported locations for this service. Returns an iterable object. * * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. @@ -914,7 +1133,7 @@ export class SqlUsersServiceClient { */ listLocationsAsync( request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions + options?: CallOptions, ): AsyncIterable { return this.locationsClient.listLocationsAsync(request, options); } @@ -930,7 +1149,7 @@ export class SqlUsersServiceClient { * @param {string} backup * @returns {string} Resource name string. */ - backupPath(project:string,backup:string) { + backupPath(project: string, backup: string) { return this.pathTemplates.backupPathTemplate.render({ project: project, backup: backup, @@ -967,13 +1186,15 @@ export class SqlUsersServiceClient { */ close(): Promise { if (this.sqlUsersServiceStub && !this._terminated) { - return this.sqlUsersServiceStub.then(stub => { + return this.sqlUsersServiceStub.then((stub) => { this._log.info('ending gRPC channel'); this._terminated = true; stub.close(); - this.locationsClient.close().catch(err => {throw err}); + this.locationsClient.close().catch((err) => { + throw err; + }); }); } return Promise.resolve(); } -} \ No newline at end of file +} diff --git a/packages/google-cloud-sql/system-test/install.ts b/packages/google-cloud-sql/system-test/install.ts index f66069aa3940..ccf167042d2e 100644 --- a/packages/google-cloud-sql/system-test/install.ts +++ b/packages/google-cloud-sql/system-test/install.ts @@ -16,34 +16,36 @@ // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { + it('TypeScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } + ts: readFileSync( + './system-test/fixtures/sample/src/index.ts', + ).toString(), + }, }; await packNTest(options); }); - it('JavaScript code', async function() { + it('JavaScript code', async function () { this.timeout(300000); const options = { packageDir: process.cwd(), sample: { description: 'JavaScript user can use the library', - cjs: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } + cjs: readFileSync( + './system-test/fixtures/sample/src/index.js', + ).toString(), + }, }; await packNTest(options); }); - }); diff --git a/packages/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts index ef97c1615c76..39a4cbb474bb 100644 --- a/packages/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_backup_runs_service_v1.ts @@ -19,927 +19,1174 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlbackuprunsserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlBackupRunsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + it('has universeDomain', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('has port', () => { - const port = sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('should create a client with no option', () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - fallback: true, + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + universeDomain: 'configured.example.com', }); - assert(client); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); - await client.initialize(); - assert(client.sqlBackupRunsServiceStub); + it('has port', () => { + const port = + sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + fallback: true, }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlBackupRunsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); + await client.initialize(); + assert(client.sqlBackupRunsServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlBackupRunsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', ['id']); - request.id = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.BackupRun() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.BackupRun() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IBackupRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsGetRequest', ['id']); - request.id = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.BackupRunsListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.BackupRunsListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IBackupRunsListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlBackupRunsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlBackupRunsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes delete with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes delete with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.BackupRun(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.BackupRun(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IBackupRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.BackupRunsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.BackupRunsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IBackupRunsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlbackuprunsserviceModule.v1.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts b/packages/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts index e6f331aed7d4..31018716d40f 100644 --- a/packages/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts +++ b/packages/google-cloud-sql/test/gapic_sql_backup_runs_service_v1beta4.ts @@ -19,957 +19,1215 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlbackuprunsserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta4.SqlBackupRunsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + it('has universeDomain', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('has port', () => { - const port = sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('should create a client with no option', () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - fallback: true, + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + universeDomain: 'configured.example.com', }); - assert(client); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); - await client.initialize(); - assert(client.sqlBackupRunsServiceStub); + it('has port', () => { + const port = + sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + fallback: true, }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlBackupRunsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); + await client.initialize(); + assert(client.sqlBackupRunsServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlBackupRunsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlBackupRunsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', ['id']); - request.id = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.BackupRun() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.BackupRun() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IBackupRun|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['id']); - request.id = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&id=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', ['id']); - request.id = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.BackupRunsListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.BackupRunsListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IBackupRunsListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes delete with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes delete with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsDeleteRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.BackupRun(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes get without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.BackupRun(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IBackupRun | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&id=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsGetRequest', + ['id'], + ); + request.id = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.BackupRunsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.BackupRunsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IBackupRunsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlBackupRunsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlBackupRunsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqlbackuprunsserviceModule.v1beta4.SqlBackupRunsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_backups_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_backups_service_v1.ts index 7cd5fd683143..e0e3601d826c 100644 --- a/packages/google-cloud-sql/test/gapic_sql_backups_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_backups_service_v1.ts @@ -19,1161 +19,1417 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlbackupsserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlBackupsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlbackupsserviceModule.v1.SqlBackupsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlbackupsserviceModule.v1.SqlBackupsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('has universeDomain', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlbackupsserviceModule.v1.SqlBackupsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlbackupsserviceModule.v1.SqlBackupsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('has port', () => { - const port = sqlbackupsserviceModule.v1.SqlBackupsServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('should create a client with no option', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - fallback: true, - }); - assert(client); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupsServiceStub, undefined); - await client.initialize(); - assert(client.sqlBackupsServiceStub); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has close method for the initialized client', done => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlBackupsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has port', () => { + const port = sqlbackupsserviceModule.v1.SqlBackupsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with no option', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient(); + assert(client); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupsServiceStub, undefined); + await client.initialize(); + assert(client.sqlBackupsServiceStub); }); - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.createBackup = stubSimpleCall(expectedResponse); - const [response] = await client.createBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the initialized client', (done) => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlBackupsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes createBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.createBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has close method for the non-initialized client', (done) => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('invokes createBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes createBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createBackup(request), expectedError); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); + }); - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.createBackup = stubSimpleCall(expectedResponse); + const [response] = await client.createBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createBackup without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.createBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createBackup with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBackup(request), expectedError); - }); + it('invokes createBackup with closed client', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createBackup(request), expectedError); }); + }); - describe('updateBackup', () => { - it('invokes updateBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); - const [response] = await client.updateBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Backup(), + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.updateBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackup( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getBackup without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Backup(), + ); + client.innerApiCalls.getBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IBackup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getBackup with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateBackup(request), expectedError); - }); + it('invokes getBackup with closed client', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getBackup(request), expectedError); }); + }); - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('updateBackup', () => { + it('invokes updateBackup without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); + const [response] = await client.updateBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.deleteBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateBackup without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.updateBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes updateBackup with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteBackup(request), expectedError); - }); + it('invokes updateBackup with closed client', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateBackup(request), expectedError); }); + }); - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listBackups without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteBackup without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.deleteBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listBackups with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes deleteBackup with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listBackupsStream without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.sql.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.sql.v1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes deleteBackup with closed client', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteBackup(request), expectedError); + }); + }); - it('invokes listBackupsStream with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.sql.v1.Backup[] = []; - stream.on('data', (response: protos.google.cloud.sql.v1.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listBackups without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.sql.v1.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes listBackups without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + ]; + client.innerApiCalls.listBackups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IBackup[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('uses async iteration with listBackups with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.sql.v1.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + it('invokes listBackups with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + + it('invokes listBackupsStream without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + ]; + client.descriptors.page.listBackups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.sql.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.sql.v1.Backup) => { + responses.push(response); }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); + stream.on('end', () => { + resolve(responses); }); - it('invokes getLocation with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + stream.on('error', (err: Error) => { + reject(err); }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBackups, request), + ); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + + it('invokes listBackupsStream with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.sql.v1.Backup[] = []; + stream.on('data', (response: protos.google.cloud.sql.v1.Backup) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBackups, request), + ); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('Path templates', () => { + it('uses async iteration with listBackups without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.sql.v1.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); + it('uses async iteration with listBackups with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.sql.v1.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sqlbackupsserviceModule.v1.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts b/packages/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts index 7284e1063b10..b2fece3336d8 100644 --- a/packages/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts +++ b/packages/google-cloud-sql/test/gapic_sql_backups_service_v1beta4.ts @@ -19,1161 +19,1465 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlbackupsserviceModule from '../src'; -import {PassThrough} from 'stream'; +import { PassThrough } from 'stream'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } +function stubPageStreamingCall( + responses?: ResponseType[], + error?: Error, +) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); + } + const transformStub = error + ? sinon.stub().callsArgWith(2, error) + : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { + mockStream.write({}); + }); } - return sinon.stub().returns(mockStream); + setImmediate(() => { + mockStream.end(); + }); + } else { + setImmediate(() => { + mockStream.write({}); + }); + setImmediate(() => { + mockStream.end(); + }); + } + return sinon.stub().returns(mockStream); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta4.SqlBackupsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + universeDomain: 'configured.example.com', }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); - assert(client); - }); + it('has port', () => { + const port = sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - fallback: true, - }); - assert(client); + it('should create a client with no option', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + fallback: true, }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupsServiceStub, undefined); - await client.initialize(); - assert(client.sqlBackupsServiceStub); + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlBackupsServiceStub, undefined); + await client.initialize(); + assert(client.sqlBackupsServiceStub); + }); - it('has close method for the initialized client', done => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlBackupsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlBackupsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlBackupsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the non-initialized client', (done) => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlBackupsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); + }); - describe('createBackup', () => { - it('invokes createBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.createBackup = stubSimpleCall(expectedResponse); - const [response] = await client.createBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('createBackup', () => { + it('invokes createBackup without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.createBackup = stubSimpleCall(expectedResponse); + const [response] = await client.createBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.createBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createBackup( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes createBackup without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.createBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes createBackup with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.CreateBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.CreateBackupRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createBackup(request), expectedError); + it('invokes createBackup with closed client', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.CreateBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.CreateBackupRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createBackup(request), expectedError); }); + }); - describe('getBackup', () => { - it('invokes getBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); - const [response] = await client.getBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('getBackup', () => { + it('invokes getBackup without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Backup(), + ); + client.innerApiCalls.getBackup = stubSimpleCall(expectedResponse); + const [response] = await client.getBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Backup() - ); - client.innerApiCalls.getBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getBackup( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IBackup|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes getBackup without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Backup(), + ); + client.innerApiCalls.getBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IBackup | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes getBackup with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getBackup = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getBackup(request), expectedError); + it('invokes getBackup with closed client', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getBackup(request), expectedError); }); + }); - describe('updateBackup', () => { - it('invokes updateBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); - const [response] = await client.updateBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('updateBackup', () => { + it('invokes updateBackup without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.updateBackup = stubSimpleCall(expectedResponse); + const [response] = await client.updateBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.updateBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateBackup( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes updateBackup without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.updateBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes updateBackup with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedHeaderRequestParams = `backup.name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.updateBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.updateBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes updateBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UpdateBackupRequest() - ); - request.backup ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.UpdateBackupRequest', ['backup', 'name']); - request.backup.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.updateBackup(request), expectedError); + it('invokes updateBackup with closed client', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UpdateBackupRequest(), + ); + request.backup ??= {}; + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.UpdateBackupRequest', + ['backup', 'name'], + ); + request.backup.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.updateBackup(request), expectedError); }); + }); - describe('deleteBackup', () => { - it('invokes deleteBackup without error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); - const [response] = await client.deleteBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('deleteBackup', () => { + it('invokes deleteBackup without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.deleteBackup = stubSimpleCall(expectedResponse); + const [response] = await client.deleteBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackup without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.deleteBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteBackup( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes deleteBackup without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.deleteBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackup with error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes deleteBackup with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.deleteBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.deleteBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes deleteBackup with closed client', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DeleteBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.DeleteBackupRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.deleteBackup(request), expectedError); + it('invokes deleteBackup with closed client', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DeleteBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.DeleteBackupRequest', + ['name'], + ); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.deleteBackup(request), expectedError); }); + }); - describe('listBackups', () => { - it('invokes listBackups without error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); - const [response] = await client.listBackups(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('listBackups', () => { + it('invokes listBackups without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + ]; + client.innerApiCalls.listBackups = stubSimpleCall(expectedResponse); + const [response] = await client.listBackups(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listBackups without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - ]; - client.innerApiCalls.listBackups = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listBackups( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IBackup[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listBackups without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + ]; + client.innerApiCalls.listBackups = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listBackups( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IBackup[] | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listBackups with error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listBackups = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listBackups(request), expectedError); - const actualRequest = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listBackups as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes listBackups with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listBackups = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listBackups(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listBackups as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listBackupsStream without error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - ]; - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.sql.v1beta4.Backup[] = []; - stream.on('data', (response: protos.google.cloud.sql.v1beta4.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - const responses = await promise; - assert.deepStrictEqual(responses, expectedResponse); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listBackupsStream without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + ]; + client.descriptors.page.listBackups.createStream = + stubPageStreamingCall(expectedResponse); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.sql.v1beta4.Backup[] = []; + stream.on( + 'data', + (response: protos.google.cloud.sql.v1beta4.Backup) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + const responses = await promise; + assert.deepStrictEqual(responses, expectedResponse); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBackups, request), + ); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('invokes listBackupsStream with error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listBackupsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.sql.v1beta4.Backup[] = []; - stream.on('data', (response: protos.google.cloud.sql.v1beta4.Backup) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listBackups, request)); - assert( - (client.descriptors.page.listBackups.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('invokes listBackupsStream with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.createStream = stubPageStreamingCall( + undefined, + expectedError, + ); + const stream = client.listBackupsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.sql.v1beta4.Backup[] = []; + stream.on( + 'data', + (response: protos.google.cloud.sql.v1beta4.Backup) => { + responses.push(response); + }, + ); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); }); + }); + await assert.rejects(promise, expectedError); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .calledWith(client.innerApiCalls.listBackups, request), + ); + assert( + (client.descriptors.page.listBackups.createStream as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listBackups without error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), - ]; - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.sql.v1beta4.IBackup[] = []; - const iterable = client.listBackupsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('uses async iteration with listBackups without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + generateSampleMessage(new protos.google.cloud.sql.v1beta4.Backup()), + ]; + client.descriptors.page.listBackups.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.sql.v1beta4.IBackup[] = []; + const iterable = client.listBackupsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); + }); - it('uses async iteration with listBackups with error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ListBackupsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.ListBackupsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listBackupsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.sql.v1beta4.IBackup[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listBackups.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + it('uses async iteration with listBackups with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ListBackupsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.ListBackupsRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.descriptors.page.listBackups.asyncIterate = stubAsyncIterationCall( + undefined, + expectedError, + ); + const iterable = client.listBackupsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.sql.v1beta4.IBackup[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listBackups.asyncIterate as SinonStub).getCall( + 0, + ).args[1], + request, + ); + assert( + (client.descriptors.page.listBackups.asyncIterate as SinonStub) + .getCall(0) + .args[2].otherArgs.headers[ + 'x-goog-request-params' + ].includes(expectedHeaderRequestParams), + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - it('invokes getLocation with error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); + }); - describe('Path templates', () => { + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sqlbackupsserviceModule.v1beta4.SqlBackupsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_connect_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_connect_service_v1.ts index 6871c0b454df..b60949338fd6 100644 --- a/packages/google-cloud-sql/test/gapic_sql_connect_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_connect_service_v1.ts @@ -19,663 +19,823 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlconnectserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlConnectServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlconnectserviceModule.v1.SqlConnectServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlconnectserviceModule.v1.SqlConnectServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlconnectserviceModule.v1.SqlConnectServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlconnectserviceModule.v1.SqlConnectServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlconnectserviceModule.v1.SqlConnectServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlconnectserviceModule.v1.SqlConnectServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has port', () => { - const port = sqlconnectserviceModule.v1.SqlConnectServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('should create a client with no option', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); - assert(client); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - fallback: true, - }); - assert(client); - }); + it('has port', () => { + const port = sqlconnectserviceModule.v1.SqlConnectServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlConnectServiceStub, undefined); - await client.initialize(); - assert(client.sqlConnectServiceStub); - }); + it('should create a client with no option', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient(); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlConnectServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlConnectServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlConnectServiceStub, undefined); + await client.initialize(); + assert(client.sqlConnectServiceStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlConnectServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlConnectServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getConnectSettings', () => { - it('invokes getConnectSettings without error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetConnectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GetConnectSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.GetConnectSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.ConnectSettings() - ); - client.innerApiCalls.getConnectSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getConnectSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes getConnectSettings without error using callback', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetConnectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GetConnectSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.GetConnectSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.ConnectSettings() - ); - client.innerApiCalls.getConnectSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnectSettings( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IConnectSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getConnectSettings', () => { + it('invokes getConnectSettings without error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.ConnectSettings(), + ); + client.innerApiCalls.getConnectSettings = + stubSimpleCall(expectedResponse); + const [response] = await client.getConnectSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getConnectSettings with error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetConnectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GetConnectSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.GetConnectSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnectSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConnectSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getConnectSettings without error using callback', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.ConnectSettings(), + ); + client.innerApiCalls.getConnectSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnectSettings( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IConnectSettings | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getConnectSettings with closed client', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GetConnectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GetConnectSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.GetConnectSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getConnectSettings(request), expectedError); - }); + it('invokes getConnectSettings with error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnectSettings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getConnectSettings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('generateEphemeralCert', () => { - it('invokes generateEphemeralCert without error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GenerateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.GenerateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertResponse() - ); - client.innerApiCalls.generateEphemeralCert = stubSimpleCall(expectedResponse); - const [response] = await client.generateEphemeralCert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getConnectSettings with closed client', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getConnectSettings(request), expectedError); + }); + }); + + describe('generateEphemeralCert', () => { + it('invokes generateEphemeralCert without error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertResponse(), + ); + client.innerApiCalls.generateEphemeralCert = + stubSimpleCall(expectedResponse); + const [response] = await client.generateEphemeralCert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateEphemeralCert without error using callback', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GenerateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.GenerateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertResponse() - ); - client.innerApiCalls.generateEphemeralCert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateEphemeralCert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes generateEphemeralCert without error using callback', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertResponse(), + ); + client.innerApiCalls.generateEphemeralCert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateEphemeralCert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IGenerateEphemeralCertResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateEphemeralCert with error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GenerateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.GenerateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateEphemeralCert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateEphemeralCert(request), expectedError); - const actualRequest = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes generateEphemeralCert with error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateEphemeralCert = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.generateEphemeralCert(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateEphemeralCert with closed client', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.GenerateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.GenerateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.generateEphemeralCert(request), expectedError); - }); + it('invokes generateEphemeralCert with closed client', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.generateEphemeralCert(request), + expectedError, + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); - - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes getLocation with error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlconnectserviceModule.v1.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts b/packages/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts index cf1df12ba74f..7a26e7c169f0 100644 --- a/packages/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts +++ b/packages/google-cloud-sql/test/gapic_sql_connect_service_v1beta4.ts @@ -19,663 +19,849 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlconnectserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta4.SqlConnectServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + universeDomain: 'configured.example.com', }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); - assert(client); - }); + it('has port', () => { + const port = sqlconnectserviceModule.v1beta4.SqlConnectServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlConnectServiceStub, undefined); - await client.initialize(); - assert(client.sqlConnectServiceStub); + it('should create a client with gRPC fallback', () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + fallback: true, }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlConnectServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlConnectServiceStub, undefined); + await client.initialize(); + assert(client.sqlConnectServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlConnectServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlConnectServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlConnectServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('getConnectSettings', () => { - it('invokes getConnectSettings without error', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetConnectSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetConnectSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ConnectSettings() - ); - client.innerApiCalls.getConnectSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getConnectSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes getConnectSettings without error using callback', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetConnectSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetConnectSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.ConnectSettings() - ); - client.innerApiCalls.getConnectSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnectSettings( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IConnectSettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('getConnectSettings', () => { + it('invokes getConnectSettings without error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ConnectSettings(), + ); + client.innerApiCalls.getConnectSettings = + stubSimpleCall(expectedResponse); + const [response] = await client.getConnectSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getConnectSettings with error', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetConnectSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetConnectSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnectSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConnectSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes getConnectSettings without error using callback', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.ConnectSettings(), + ); + client.innerApiCalls.getConnectSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnectSettings( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IConnectSettings | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getConnectSettings with closed client', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetConnectSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GetConnectSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getConnectSettings(request), expectedError); + it('invokes getConnectSettings with error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnectSettings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getConnectSettings(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getConnectSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('generateEphemeralCert', () => { - it('invokes generateEphemeralCert without error', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse() - ); - client.innerApiCalls.generateEphemeralCert = stubSimpleCall(expectedResponse); - const [response] = await client.generateEphemeralCert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes getConnectSettings with closed client', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GetConnectSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GetConnectSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getConnectSettings(request), expectedError); + }); + }); + + describe('generateEphemeralCert', () => { + it('invokes generateEphemeralCert without error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse(), + ); + client.innerApiCalls.generateEphemeralCert = + stubSimpleCall(expectedResponse); + const [response] = await client.generateEphemeralCert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateEphemeralCert without error using callback', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse() - ); - client.innerApiCalls.generateEphemeralCert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.generateEphemeralCert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes generateEphemeralCert without error using callback', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertResponse(), + ); + client.innerApiCalls.generateEphemeralCert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.generateEphemeralCert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IGenerateEphemeralCertResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateEphemeralCert with error', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.generateEphemeralCert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.generateEphemeralCert(request), expectedError); - const actualRequest = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.generateEphemeralCert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes generateEphemeralCert with error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.generateEphemeralCert = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.generateEphemeralCert(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.generateEphemeralCert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes generateEphemeralCert with closed client', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.generateEphemeralCert(request), expectedError); + it('invokes generateEphemeralCert with closed client', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.GenerateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.generateEphemeralCert(request), + expectedError, + ); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - it('invokes getLocation with error', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); - - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlconnectserviceModule.v1beta4.SqlConnectServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_databases_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_databases_service_v1.ts index cca0b07a3c6e..15097fddb205 100644 --- a/packages/google-cloud-sql/test/gapic_sql_databases_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_databases_service_v1.ts @@ -19,1191 +19,1549 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqldatabasesserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlDatabasesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ + universeDomain: 'configured.example.com', }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); - assert(client); - }); + it('has port', () => { + const port = sqldatabasesserviceModule.v1.SqlDatabasesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlDatabasesServiceStub, undefined); - await client.initialize(); - assert(client.sqlDatabasesServiceStub); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlDatabasesServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlDatabasesServiceStub, undefined); + await client.initialize(); + assert(client.sqlDatabasesServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlDatabasesServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlDatabasesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlDatabasesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); - it('invokes delete without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('delete', () => { + it('invokes delete without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes delete without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesDeleteRequest', ['database']); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); + it('invokes delete with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Database() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes delete with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); - it('invokes get without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Database() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IDatabase|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('get', () => { + it('invokes get without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Database(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes get without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Database(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IDatabase | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesGetRequest', ['database']); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); + it('invokes get with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes get with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); - it('invokes insert without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('insert', () => { + it('invokes insert without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes insert without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); + it('invokes insert with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.DatabasesListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes insert with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); - it('invokes list without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.DatabasesListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IDatabasesListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.DatabasesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.DatabasesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IDatabasesListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesListRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes list with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('patch', () => { - it('invokes patch without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.patch = stubSimpleCall(expectedResponse); - const [response] = await client.patch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); - it('invokes patch without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patch( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('patch', () => { + it('invokes patch without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCall(expectedResponse); + const [response] = await client.patch(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes patch with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patch(request), expectedError); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes patch without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.patch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes patch with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patch(request), expectedError); - }); + it('invokes patch with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.patch(request), expectedError); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('update', () => { - it('invokes update without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes patch with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.patch(request), expectedError); + }); + }); - it('invokes update without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.update = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('update', () => { + it('invokes update without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes update without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update with closed client', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.update(request), expectedError); - }); + it('invokes update with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + + it('invokes update with closed client', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); + it('invokes getLocation with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqldatabasesserviceModule.v1.SqlDatabasesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts b/packages/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts index 888634ab0244..3f9edfa33005 100644 --- a/packages/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts +++ b/packages/google-cloud-sql/test/gapic_sql_databases_service_v1beta4.ts @@ -19,1221 +19,1557 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqldatabasesserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta4.SqlDatabasesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + universeDomain: 'configured.example.com', }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); - assert(client); - }); + it('has port', () => { + const port = + sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - fallback: true, - }); - assert(client); + it('should create a client with no option', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + fallback: true, }); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlDatabasesServiceStub, undefined); - await client.initialize(); - assert(client.sqlDatabasesServiceStub); + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlDatabasesServiceStub, undefined); + await client.initialize(); + assert(client.sqlDatabasesServiceStub); + }); - it('has close method for the initialized client', done => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlDatabasesServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlDatabasesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); - it('has close method for the non-initialized client', done => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlDatabasesServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the non-initialized client', (done) => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlDatabasesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); + }); - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('delete', () => { + it('invokes delete without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes delete without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes delete with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with closed client', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', ['database']); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); + it('invokes delete with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesDeleteRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); }); + }); - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Database() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Database(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Database() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IDatabase|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes get without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Database(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IDatabase | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes get with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with closed client', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', ['database']); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); + it('invokes get with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesGetRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); }); + }); - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('insert', () => { + it('invokes insert without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes insert without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes insert with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with closed client', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); + it('invokes insert with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); }); + }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DatabasesListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DatabasesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DatabasesListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IDatabasesListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes list without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DatabasesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IDatabasesListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes list with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with closed client', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesListRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); + it('invokes list with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); }); + }); - describe('patch', () => { - it('invokes patch without error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.patch = stubSimpleCall(expectedResponse); - const [response] = await client.patch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('patch', () => { + it('invokes patch without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCall(expectedResponse); + const [response] = await client.patch(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes patch without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patch( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes patch without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.patch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes patch with error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patch(request), expectedError); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes patch with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.patch(request), expectedError); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes patch with closed client', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patch(request), expectedError); + it('invokes patch with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.patch(request), expectedError); }); + }); - describe('update', () => { - it('invokes update without error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + describe('update', () => { + it('invokes update without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.update = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes update without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update with error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&database=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('invokes update with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&database=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update with closed client', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', ['database']); - request.database = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.update(request), expectedError); + it('invokes update with closed client', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlDatabasesUpdateRequest', + ['database'], + ); + request.database = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - it('invokes getLocation without error using callback', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - it('invokes getLocation with error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); }); + }); - describe('Path templates', () => { + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sqldatabasesserviceModule.v1beta4.SqlDatabasesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts index 1b943f35d8e6..b8f469f7bc39 100644 --- a/packages/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_feature_eligibility_service_v1.ts @@ -19,419 +19,547 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlfeatureeligibilityserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlFeatureEligibilityServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlfeatureeligibilityserviceModule.v1 + .SqlFeatureEligibilityServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlfeatureeligibilityserviceModule.v1 + .SqlFeatureEligibilityServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has port', () => { - const port = sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { universeDomain: 'configured.example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { universe_domain: 'example.com', universeDomain: 'example.net' }, + ); + }); + }); - it('should create a client with no option', () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); - assert(client); - }); + it('has port', () => { + const port = + sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient + .port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlFeatureEligibilityServiceStub, undefined); - await client.initialize(); - assert(client.sqlFeatureEligibilityServiceStub); - }); + it('should create a client with gRPC fallback', () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlFeatureEligibilityServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlFeatureEligibilityServiceStub, undefined); + await client.initialize(); + assert(client.sqlFeatureEligibilityServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlFeatureEligibilityServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlFeatureEligibilityServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlFeatureEligibilityServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); + it('invokes getLocation with error', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlfeatureeligibilityserviceModule.v1.SqlFeatureEligibilityServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_flags_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_flags_service_v1.ts index be1385ccd329..09b5fbd0667f 100644 --- a/packages/google-cloud-sql/test/gapic_sql_flags_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_flags_service_v1.ts @@ -19,498 +19,591 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlflagsserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlFlagsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlflagsserviceModule.v1.SqlFlagsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlflagsserviceModule.v1.SqlFlagsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlflagsserviceModule.v1.SqlFlagsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlflagsserviceModule.v1.SqlFlagsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlflagsserviceModule.v1.SqlFlagsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = sqlflagsserviceModule.v1.SqlFlagsServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); - assert(client); - }); + it('has port', () => { + const port = sqlflagsserviceModule.v1.SqlFlagsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlFlagsServiceStub, undefined); - await client.initialize(); - assert(client.sqlFlagsServiceStub); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlFlagsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlFlagsServiceStub, undefined); + await client.initialize(); + assert(client.sqlFlagsServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlFlagsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlFlagsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlFlagsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlFlagsListRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.FlagsListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlFlagsListRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.FlagsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes list without error using callback', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlFlagsListRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.FlagsListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IFlagsListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); + it('invokes list without error using callback', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlFlagsListRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.FlagsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IFlagsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes list with error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlFlagsListRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes list with error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlFlagsListRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + }); - it('invokes list with closed client', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlFlagsListRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes list with closed client', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlFlagsListRequest(), + ); + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); - - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes getLocation with error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlflagsserviceModule.v1.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts b/packages/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts index 0d1278673ccd..4e37b9e1b3e7 100644 --- a/packages/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts +++ b/packages/google-cloud-sql/test/gapic_sql_flags_service_v1beta4.ts @@ -19,528 +19,631 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlflagsserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta4.SqlFlagsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + universeDomain: 'configured.example.com', }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); - assert(client); - }); + it('has port', () => { + const port = sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlFlagsServiceStub, undefined); - await client.initialize(); - assert(client.sqlFlagsServiceStub); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlFlagsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlFlagsServiceStub, undefined); + await client.initialize(); + assert(client.sqlFlagsServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlFlagsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlFlagsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlFlagsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.FlagsListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.FlagsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes list without error using callback', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.FlagsListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IFlagsListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - }); + it('invokes list without error using callback', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), + ); + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.FlagsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IFlagsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + }); - it('invokes list with error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest() - ); - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes list with error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), + ); + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + }); - it('invokes list with closed client', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest() - ); - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes list with closed client', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlFlagsListRequest(), + ); + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = new sqlflagsserviceModule.v1beta4.SqlFlagsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_instances_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_instances_service_v1.ts index 3e9991b4257f..03dbe2acbf28 100644 --- a/packages/google-cloud-sql/test/gapic_sql_instances_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_instances_service_v1.ts @@ -19,5609 +19,7460 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlinstancesserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlInstancesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlinstancesserviceModule.v1.SqlInstancesServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlinstancesserviceModule.v1.SqlInstancesServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlinstancesserviceModule.v1.SqlInstancesServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { universeDomain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlinstancesserviceModule.v1.SqlInstancesServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { universe_domain: 'example.com' }, + ); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('has port', () => { + const port = sqlinstancesserviceModule.v1.SqlInstancesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has port', () => { - const port = sqlinstancesserviceModule.v1.SqlInstancesServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); + it('should create a client with no option', () => { + const client = + new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); + assert(client); + }); - it('should create a client with no option', () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient(); - assert(client); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + fallback: true, + }, + ); + assert(client); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - fallback: true, - }); - assert(client); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlInstancesServiceStub, undefined); + await client.initialize(); + assert(client.sqlInstancesServiceStub); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlInstancesServiceStub, undefined); - await client.initialize(); - assert(client.sqlInstancesServiceStub); + it('has close method for the initialized client', (done) => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlInstancesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has close method for the initialized client', done => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlInstancesServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the non-initialized client', (done) => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + assert.strictEqual(client.sqlInstancesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlInstancesServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('addServerCa', () => { + it('invokes addServerCa without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addServerCa = stubSimpleCall(expectedResponse); + const [response] = await client.addServerCa(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('invokes addServerCa without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addServerCa = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addServerCa( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('addServerCa', () => { - it('invokes addServerCa without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.addServerCa = stubSimpleCall(expectedResponse); - const [response] = await client.addServerCa(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addServerCa with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addServerCa = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.addServerCa(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addServerCa without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.addServerCa = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addServerCa( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addServerCa with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.addServerCa(request), expectedError); + }); + }); + + describe('addServerCertificate', () => { + it('invokes addServerCertificate without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addServerCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.addServerCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addServerCa with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addServerCa = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addServerCa(request), expectedError); - const actualRequest = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addServerCertificate without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addServerCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addServerCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addServerCa with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addServerCa(request), expectedError); - }); + it('invokes addServerCertificate with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addServerCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.addServerCertificate(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('addServerCertificate', () => { - it('invokes addServerCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.addServerCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.addServerCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addServerCertificate with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.addServerCertificate(request), expectedError); + }); + }); + + describe('addEntraIdCertificate', () => { + it('invokes addEntraIdCertificate without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addEntraIdCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.addEntraIdCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addServerCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.addServerCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addServerCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addEntraIdCertificate without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.addEntraIdCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addEntraIdCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addServerCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addServerCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addServerCertificate(request), expectedError); - const actualRequest = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes addEntraIdCertificate with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addEntraIdCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.addEntraIdCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addServerCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addServerCertificate(request), expectedError); - }); + it('invokes addEntraIdCertificate with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.addEntraIdCertificate(request), + expectedError, + ); + }); + }); + + describe('clone', () => { + it('invokes clone without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.clone = stubSimpleCall(expectedResponse); + const [response] = await client.clone(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('addEntraIdCertificate', () => { - it('invokes addEntraIdCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.addEntraIdCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.addEntraIdCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes clone without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.clone = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.clone( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addEntraIdCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.addEntraIdCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addEntraIdCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes clone with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clone = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.clone(request), expectedError); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addEntraIdCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addEntraIdCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addEntraIdCertificate(request), expectedError); - const actualRequest = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes clone with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.clone(request), expectedError); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes addEntraIdCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAddEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addEntraIdCertificate(request), expectedError); - }); + it('invokes delete without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('clone', () => { - it('invokes clone without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCloneRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCloneRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCloneRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.clone = stubSimpleCall(expectedResponse); - const [response] = await client.clone(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes delete with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes clone without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCloneRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCloneRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCloneRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.clone = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.clone( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes delete with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('demoteMaster', () => { + it('invokes demoteMaster without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.demoteMaster = stubSimpleCall(expectedResponse); + const [response] = await client.demoteMaster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes clone with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCloneRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCloneRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCloneRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.clone = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.clone(request), expectedError); - const actualRequest = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes demoteMaster without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.demoteMaster = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.demoteMaster( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes clone with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCloneRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCloneRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCloneRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.clone(request), expectedError); - }); + it('invokes demoteMaster with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.demoteMaster = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.demoteMaster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes demoteMaster with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.demoteMaster(request), expectedError); + }); + }); + + describe('demote', () => { + it('invokes demote without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.demote = stubSimpleCall(expectedResponse); + const [response] = await client.demote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes demote without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.demote = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.demote( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes demote with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.demote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.demote(request), expectedError); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); + it('invokes demote with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.demote(request), expectedError); + }); + }); + + describe('export', () => { + it('invokes export without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.export = stubSimpleCall(expectedResponse); + const [response] = await client.export(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('demoteMaster', () => { - it('invokes demoteMaster without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.demoteMaster = stubSimpleCall(expectedResponse); - const [response] = await client.demoteMaster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes export without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.export = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.export( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes demoteMaster without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.demoteMaster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.demoteMaster( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes export with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.export = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.export(request), expectedError); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes demoteMaster with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.demoteMaster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.demoteMaster(request), expectedError); - const actualRequest = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes export with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.export(request), expectedError); + }); + }); + + describe('failover', () => { + it('invokes failover without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.failover = stubSimpleCall(expectedResponse); + const [response] = await client.failover(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes demoteMaster with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteMasterRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.demoteMaster(request), expectedError); - }); + it('invokes failover without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.failover = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.failover( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('demote', () => { - it('invokes demote without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.demote = stubSimpleCall(expectedResponse); - const [response] = await client.demote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes failover with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.failover = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.failover(request), expectedError); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes demote without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.demote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.demote( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes failover with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.failover(request), expectedError); + }); + }); + + describe('reencrypt', () => { + it('invokes reencrypt without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.reencrypt = stubSimpleCall(expectedResponse); + const [response] = await client.reencrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes demote with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.demote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.demote(request), expectedError); - const actualRequest = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes reencrypt without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.reencrypt = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reencrypt( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes demote with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesDemoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesDemoteRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.demote(request), expectedError); - }); + it('invokes reencrypt with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reencrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.reencrypt(request), expectedError); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('export', () => { - it('invokes export without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.export = stubSimpleCall(expectedResponse); - const [response] = await client.export(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes reencrypt with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.reencrypt(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.DatabaseInstance(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes export without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.export = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.export( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes get without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.DatabaseInstance(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IDatabaseInstance | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes export with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.export = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.export(request), expectedError); - const actualRequest = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes get with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes export with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExportRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.export(request), expectedError); - }); + it('invokes get with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('import', () => { + it('invokes import without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.import = stubSimpleCall(expectedResponse); + const [response] = await client.import(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('failover', () => { - it('invokes failover without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesFailoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesFailoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.failover = stubSimpleCall(expectedResponse); - const [response] = await client.failover(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes import without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.import = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.import( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes failover without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesFailoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesFailoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.failover = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.failover( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes import with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.import = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.import(request), expectedError); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes failover with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesFailoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesFailoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.failover = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.failover(request), expectedError); - const actualRequest = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes import with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.import(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes failover with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesFailoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesFailoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesFailoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.failover(request), expectedError); - }); + it('invokes insert without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('reencrypt', () => { - it('invokes reencrypt without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReencryptRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReencryptRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.reencrypt = stubSimpleCall(expectedResponse); - const [response] = await client.reencrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes insert with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes reencrypt without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReencryptRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReencryptRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.reencrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reencrypt( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes insert with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes reencrypt with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReencryptRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReencryptRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.reencrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reencrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IInstancesListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes reencrypt with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReencryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReencryptRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReencryptRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.reencrypt(request), expectedError); - }); + it('invokes list with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.DatabaseInstance() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('listServerCas', () => { + it('invokes listServerCas without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListServerCasResponse(), + ); + client.innerApiCalls.listServerCas = stubSimpleCall(expectedResponse); + const [response] = await client.listServerCas(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.DatabaseInstance() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IDatabaseInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerCas without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListServerCasResponse(), + ); + client.innerApiCalls.listServerCas = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerCas( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IInstancesListServerCasResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerCas with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerCas = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listServerCas(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); + it('invokes listServerCas with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listServerCas(request), expectedError); + }); + }); + + describe('listServerCertificates', () => { + it('invokes listServerCertificates without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse(), + ); + client.innerApiCalls.listServerCertificates = + stubSimpleCall(expectedResponse); + const [response] = await client.listServerCertificates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('import', () => { - it('invokes import without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesImportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesImportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.import = stubSimpleCall(expectedResponse); - const [response] = await client.import(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerCertificates without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse(), + ); + client.innerApiCalls.listServerCertificates = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerCertificates( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes import without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesImportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesImportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.import = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.import( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerCertificates with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerCertificates = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listServerCertificates(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes import with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesImportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesImportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.import = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.import(request), expectedError); - const actualRequest = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listServerCertificates with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.listServerCertificates(request), + expectedError, + ); + }); + }); + + describe('listEntraIdCertificates', () => { + it('invokes listEntraIdCertificates without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse(), + ); + client.innerApiCalls.listEntraIdCertificates = + stubSimpleCall(expectedResponse); + const [response] = await client.listEntraIdCertificates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes import with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesImportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesImportRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.import(request), expectedError); - }); + it('invokes listEntraIdCertificates without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse(), + ); + client.innerApiCalls.listEntraIdCertificates = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEntraIdCertificates( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesInsertRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listEntraIdCertificates with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntraIdCertificates = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listEntraIdCertificates(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesInsertRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes listEntraIdCertificates with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.listEntraIdCertificates(request), + expectedError, + ); + }); + }); + + describe('patch', () => { + it('invokes patch without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCall(expectedResponse); + const [response] = await client.patch(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesInsertRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes patch without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.patch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesInsertRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); + it('invokes patch with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.patch(request), expectedError); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes patch with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.patch(request), expectedError); + }); + }); + + describe('promoteReplica', () => { + it('invokes promoteReplica without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.promoteReplica = stubSimpleCall(expectedResponse); + const [response] = await client.promoteReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IInstancesListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes promoteReplica without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.promoteReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.promoteReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes promoteReplica with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.promoteReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.promoteReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes promoteReplica with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.promoteReplica(request), expectedError); + }); + }); + + describe('switchover', () => { + it('invokes switchover without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.switchover = stubSimpleCall(expectedResponse); + const [response] = await client.switchover(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listServerCas', () => { - it('invokes listServerCas without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCasRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCasRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListServerCasResponse() - ); - client.innerApiCalls.listServerCas = stubSimpleCall(expectedResponse); - const [response] = await client.listServerCas(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes switchover without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.switchover = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.switchover( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listServerCas without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCasRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCasRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListServerCasResponse() - ); - client.innerApiCalls.listServerCas = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerCas( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IInstancesListServerCasResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes switchover with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.switchover = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.switchover(request), expectedError); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes listServerCas with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCasRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCasRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerCas = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServerCas(request), expectedError); - const actualRequest = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCas with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCasRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCasRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listServerCas(request), expectedError); - }); + it('invokes switchover with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.switchover(request), expectedError); }); - - describe('listServerCertificates', () => { - it('invokes listServerCertificates without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse() - ); - client.innerApiCalls.listServerCertificates = stubSimpleCall(expectedResponse); - const [response] = await client.listServerCertificates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListServerCertificatesResponse() - ); - client.innerApiCalls.listServerCertificates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerCertificates( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IInstancesListServerCertificatesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerCertificates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServerCertificates(request), expectedError); - const actualRequest = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListServerCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listServerCertificates(request), expectedError); - }); + }); + + describe('resetSslConfig', () => { + it('invokes resetSslConfig without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.resetSslConfig = stubSimpleCall(expectedResponse); + const [response] = await client.resetSslConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listEntraIdCertificates', () => { - it('invokes listEntraIdCertificates without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse() - ); - client.innerApiCalls.listEntraIdCertificates = stubSimpleCall(expectedResponse); - const [response] = await client.listEntraIdCertificates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.InstancesListEntraIdCertificatesResponse() - ); - client.innerApiCalls.listEntraIdCertificates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEntraIdCertificates( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IInstancesListEntraIdCertificatesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEntraIdCertificates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEntraIdCertificates(request), expectedError); - const actualRequest = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesListEntraIdCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listEntraIdCertificates(request), expectedError); - }); + it('invokes resetSslConfig without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.resetSslConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetSslConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('patch', () => { - it('invokes patch without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPatchRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPatchRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.patch = stubSimpleCall(expectedResponse); - const [response] = await client.patch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPatchRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPatchRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patch( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPatchRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPatchRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patch(request), expectedError); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPatchRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPatchRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patch(request), expectedError); - }); + it('invokes resetSslConfig with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetSslConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.resetSslConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('promoteReplica', () => { - it('invokes promoteReplica without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.promoteReplica = stubSimpleCall(expectedResponse); - const [response] = await client.promoteReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.promoteReplica = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.promoteReplica( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.promoteReplica = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.promoteReplica(request), expectedError); - const actualRequest = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPromoteReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.promoteReplica(request), expectedError); - }); + it('invokes resetSslConfig with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.resetSslConfig(request), expectedError); }); - - describe('switchover', () => { - it('invokes switchover without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.switchover = stubSimpleCall(expectedResponse); - const [response] = await client.switchover(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.switchover = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.switchover( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.switchover = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.switchover(request), expectedError); - const actualRequest = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesSwitchoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesSwitchoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.switchover(request), expectedError); - }); + }); + + describe('restart', () => { + it('invokes restart without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.restart = stubSimpleCall(expectedResponse); + const [response] = await client.restart(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('resetSslConfig', () => { - it('invokes resetSslConfig without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.resetSslConfig = stubSimpleCall(expectedResponse); - const [response] = await client.resetSslConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.resetSslConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetSslConfig( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetSslConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resetSslConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetSslConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.resetSslConfig(request), expectedError); - }); + it('invokes restart without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.restart = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restart( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('restart', () => { - it('invokes restart without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestartRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestartRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestartRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.restart = stubSimpleCall(expectedResponse); - const [response] = await client.restart(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestartRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestartRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestartRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.restart = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restart( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestartRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestartRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestartRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.restart = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.restart(request), expectedError); - const actualRequest = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestartRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestartRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestartRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.restart(request), expectedError); - }); + it('invokes restart with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restart = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.restart(request), expectedError); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('restoreBackup', () => { - it('invokes restoreBackup without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.restoreBackup = stubSimpleCall(expectedResponse); - const [response] = await client.restoreBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.restoreBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreBackup( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.restoreBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.restoreBackup(request), expectedError); - }); + it('invokes restart with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.restart(request), expectedError); }); - - describe('rotateServerCa', () => { - it('invokes rotateServerCa without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.rotateServerCa = stubSimpleCall(expectedResponse); - const [response] = await client.rotateServerCa(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.rotateServerCa = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateServerCa( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateServerCa = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rotateServerCa(request), expectedError); - const actualRequest = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.rotateServerCa(request), expectedError); - }); + }); + + describe('restoreBackup', () => { + it('invokes restoreBackup without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.restoreBackup = stubSimpleCall(expectedResponse); + const [response] = await client.restoreBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('rotateServerCertificate', () => { - it('invokes rotateServerCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.rotateServerCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.rotateServerCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.rotateServerCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateServerCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateServerCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rotateServerCertificate(request), expectedError); - const actualRequest = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.rotateServerCertificate(request), expectedError); - }); + it('invokes restoreBackup without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.restoreBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('rotateEntraIdCertificate', () => { - it('invokes rotateEntraIdCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.rotateEntraIdCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateEntraIdCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rotateEntraIdCertificate(request), expectedError); - const actualRequest = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.rotateEntraIdCertificate(request), expectedError); - }); + it('invokes restoreBackup with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.restoreBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('startReplica', () => { - it('invokes startReplica without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.startReplica = stubSimpleCall(expectedResponse); - const [response] = await client.startReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.startReplica = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startReplica( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.startReplica = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startReplica(request), expectedError); - const actualRequest = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.startReplica(request), expectedError); - }); + it('invokes restoreBackup with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.restoreBackup(request), expectedError); }); - - describe('stopReplica', () => { - it('invokes stopReplica without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.stopReplica = stubSimpleCall(expectedResponse); - const [response] = await client.stopReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.stopReplica = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopReplica( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopReplica = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopReplica(request), expectedError); - const actualRequest = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.stopReplica(request), expectedError); - }); + }); + + describe('rotateServerCa', () => { + it('invokes rotateServerCa without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateServerCa = stubSimpleCall(expectedResponse); + const [response] = await client.rotateServerCa(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('truncateLog', () => { - it('invokes truncateLog without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.truncateLog = stubSimpleCall(expectedResponse); - const [response] = await client.truncateLog(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rotateServerCa without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateServerCa = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateServerCa( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes truncateLog without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.truncateLog = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.truncateLog( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rotateServerCa with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateServerCa = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.rotateServerCa(request), expectedError); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes truncateLog with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.truncateLog = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.truncateLog(request), expectedError); - const actualRequest = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rotateServerCa with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.rotateServerCa(request), expectedError); + }); + }); + + describe('rotateServerCertificate', () => { + it('invokes rotateServerCertificate without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateServerCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.rotateServerCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes truncateLog with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.truncateLog(request), expectedError); - }); + it('invokes rotateServerCertificate without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateServerCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateServerCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('update', () => { - it('invokes update without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rotateServerCertificate with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateServerCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rotateServerCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.update = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rotateServerCertificate with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rotateServerCertificate(request), + expectedError, + ); + }); + }); + + describe('rotateEntraIdCertificate', () => { + it('invokes rotateEntraIdCertificate without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateEntraIdCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.rotateEntraIdCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rotateEntraIdCertificate without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rotateEntraIdCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateEntraIdCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.update(request), expectedError); - }); + it('invokes rotateEntraIdCertificate with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rotateEntraIdCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('createEphemeral', () => { - it('invokes createEphemeral without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCert() - ); - client.innerApiCalls.createEphemeral = stubSimpleCall(expectedResponse); - const [response] = await client.createEphemeral(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rotateEntraIdCertificate with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rotateEntraIdCertificate(request), + expectedError, + ); + }); + }); + + describe('startReplica', () => { + it('invokes startReplica without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.startReplica = stubSimpleCall(expectedResponse); + const [response] = await client.startReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createEphemeral without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCert() - ); - client.innerApiCalls.createEphemeral = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEphemeral( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ISslCert|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes startReplica without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.startReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createEphemeral with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEphemeral = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEphemeral(request), expectedError); - const actualRequest = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes startReplica with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes createEphemeral with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createEphemeral(request), expectedError); - }); + it('invokes startReplica with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startReplica(request), expectedError); + }); + }); + + describe('stopReplica', () => { + it('invokes stopReplica without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.stopReplica = stubSimpleCall(expectedResponse); + const [response] = await client.stopReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('rescheduleMaintenance', () => { - it('invokes rescheduleMaintenance without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.rescheduleMaintenance = stubSimpleCall(expectedResponse); - const [response] = await client.rescheduleMaintenance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes stopReplica without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.stopReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes rescheduleMaintenance without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.rescheduleMaintenance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rescheduleMaintenance( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes stopReplica with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.stopReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes rescheduleMaintenance with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rescheduleMaintenance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rescheduleMaintenance(request), expectedError); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes stopReplica with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.stopReplica(request), expectedError); + }); + }); + + describe('truncateLog', () => { + it('invokes truncateLog without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.truncateLog = stubSimpleCall(expectedResponse); + const [response] = await client.truncateLog(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes rescheduleMaintenance with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.rescheduleMaintenance(request), expectedError); - }); + it('invokes truncateLog without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.truncateLog = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.truncateLog( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('verifyExternalSyncSettings', () => { - it('invokes verifyExternalSyncSettings without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse() - ); - client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCall(expectedResponse); - const [response] = await client.verifyExternalSyncSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes truncateLog with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.truncateLog = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.truncateLog(request), expectedError); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes verifyExternalSyncSettings without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse() - ); - client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyExternalSyncSettings( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes truncateLog with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.truncateLog(request), expectedError); + }); + }); + + describe('update', () => { + it('invokes update without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes verifyExternalSyncSettings with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyExternalSyncSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes update without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes verifyExternalSyncSettings with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyExternalSyncSettings(request), expectedError); - }); + it('invokes update with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('startExternalSync', () => { - it('invokes startExternalSync without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.startExternalSync = stubSimpleCall(expectedResponse); - const [response] = await client.startExternalSync(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes update with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); + }); + }); + + describe('createEphemeral', () => { + it('invokes createEphemeral without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCert(), + ); + client.innerApiCalls.createEphemeral = stubSimpleCall(expectedResponse); + const [response] = await client.createEphemeral(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes startExternalSync without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.startExternalSync = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startExternalSync( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createEphemeral without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCert(), + ); + client.innerApiCalls.createEphemeral = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEphemeral( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISslCert | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes startExternalSync with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.startExternalSync = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startExternalSync(request), expectedError); - const actualRequest = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes createEphemeral with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEphemeral = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createEphemeral(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes startExternalSync with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.startExternalSync(request), expectedError); - }); + it('invokes createEphemeral with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createEphemeral(request), expectedError); + }); + }); + + describe('rescheduleMaintenance', () => { + it('invokes rescheduleMaintenance without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rescheduleMaintenance = + stubSimpleCall(expectedResponse); + const [response] = await client.rescheduleMaintenance(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('performDiskShrink', () => { - it('invokes performDiskShrink without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.performDiskShrink = stubSimpleCall(expectedResponse); - const [response] = await client.performDiskShrink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rescheduleMaintenance without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.rescheduleMaintenance = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rescheduleMaintenance( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes performDiskShrink without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.performDiskShrink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.performDiskShrink( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rescheduleMaintenance with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rescheduleMaintenance = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rescheduleMaintenance(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes performDiskShrink with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.performDiskShrink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.performDiskShrink(request), expectedError); - const actualRequest = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes rescheduleMaintenance with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rescheduleMaintenance(request), + expectedError, + ); + }); + }); + + describe('verifyExternalSyncSettings', () => { + it('invokes verifyExternalSyncSettings without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse(), + ); + client.innerApiCalls.verifyExternalSyncSettings = + stubSimpleCall(expectedResponse); + const [response] = await client.verifyExternalSyncSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes performDiskShrink with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.performDiskShrink(request), expectedError); - }); + it('invokes verifyExternalSyncSettings without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsResponse(), + ); + client.innerApiCalls.verifyExternalSyncSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.verifyExternalSyncSettings( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesVerifyExternalSyncSettingsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getDiskShrinkConfig', () => { - it('invokes getDiskShrinkConfig without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse() - ); - client.innerApiCalls.getDiskShrinkConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getDiskShrinkConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes verifyExternalSyncSettings with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.verifyExternalSyncSettings(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDiskShrinkConfig without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse() - ); - client.innerApiCalls.getDiskShrinkConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDiskShrinkConfig( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes verifyExternalSyncSettings with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.verifyExternalSyncSettings(request), + expectedError, + ); + }); + }); + + describe('startExternalSync', () => { + it('invokes startExternalSync without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.startExternalSync = stubSimpleCall(expectedResponse); + const [response] = await client.startExternalSync(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDiskShrinkConfig with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDiskShrinkConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDiskShrinkConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes startExternalSync without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.startExternalSync = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startExternalSync( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getDiskShrinkConfig with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDiskShrinkConfig(request), expectedError); - }); + it('invokes startExternalSync with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startExternalSync = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startExternalSync(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('resetReplicaSize', () => { - it('invokes resetReplicaSize without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.resetReplicaSize = stubSimpleCall(expectedResponse); - const [response] = await client.resetReplicaSize(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes startExternalSync with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startExternalSync(request), expectedError); + }); + }); + + describe('performDiskShrink', () => { + it('invokes performDiskShrink without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.performDiskShrink = stubSimpleCall(expectedResponse); + const [response] = await client.performDiskShrink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resetReplicaSize without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.resetReplicaSize = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetReplicaSize( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes performDiskShrink without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.performDiskShrink = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.performDiskShrink( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resetReplicaSize with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetReplicaSize = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resetReplicaSize(request), expectedError); - const actualRequest = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes performDiskShrink with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.performDiskShrink = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.performDiskShrink(request), expectedError); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes resetReplicaSize with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.resetReplicaSize(request), expectedError); - }); + it('invokes performDiskShrink with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.performDiskShrink(request), expectedError); + }); + }); + + describe('getDiskShrinkConfig', () => { + it('invokes getDiskShrinkConfig without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse(), + ); + client.innerApiCalls.getDiskShrinkConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getDiskShrinkConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getLatestRecoveryTime', () => { - it('invokes getLatestRecoveryTime without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse() - ); - client.innerApiCalls.getLatestRecoveryTime = stubSimpleCall(expectedResponse); - const [response] = await client.getLatestRecoveryTime(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDiskShrinkConfig without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigResponse(), + ); + client.innerApiCalls.getDiskShrinkConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDiskShrinkConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesGetDiskShrinkConfigResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getLatestRecoveryTime without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse() - ); - client.innerApiCalls.getLatestRecoveryTime = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLatestRecoveryTime( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDiskShrinkConfig with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDiskShrinkConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDiskShrinkConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getLatestRecoveryTime with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLatestRecoveryTime = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLatestRecoveryTime(request), expectedError); - const actualRequest = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getDiskShrinkConfig with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDiskShrinkConfig(request), expectedError); + }); + }); + + describe('resetReplicaSize', () => { + it('invokes resetReplicaSize without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.resetReplicaSize = stubSimpleCall(expectedResponse); + const [response] = await client.resetReplicaSize(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes getLatestRecoveryTime with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getLatestRecoveryTime(request), expectedError); - }); + it('invokes resetReplicaSize without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.resetReplicaSize = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetReplicaSize( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('executeSql', () => { - it('invokes executeSql without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse() - ); - client.innerApiCalls.executeSql = stubSimpleCall(expectedResponse); - const [response] = await client.executeSql(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes resetReplicaSize with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetReplicaSize = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.resetReplicaSize(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes executeSql without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse() - ); - client.innerApiCalls.executeSql = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.executeSql( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes resetReplicaSize with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.resetReplicaSize(request), expectedError); + }); + }); + + describe('getLatestRecoveryTime', () => { + it('invokes getLatestRecoveryTime without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse(), + ); + client.innerApiCalls.getLatestRecoveryTime = + stubSimpleCall(expectedResponse); + const [response] = await client.getLatestRecoveryTime(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes executeSql with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.executeSql = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.executeSql(request), expectedError); - const actualRequest = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getLatestRecoveryTime without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeResponse(), + ); + client.innerApiCalls.getLatestRecoveryTime = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLatestRecoveryTime( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesGetLatestRecoveryTimeResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes executeSql with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.executeSql(request), expectedError); - }); + it('invokes getLatestRecoveryTime with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLatestRecoveryTime = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLatestRecoveryTime(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('acquireSsrsLease', () => { - it('invokes acquireSsrsLease without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse() - ); - client.innerApiCalls.acquireSsrsLease = stubSimpleCall(expectedResponse); - const [response] = await client.acquireSsrsLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes getLatestRecoveryTime with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getLatestRecoveryTime(request), + expectedError, + ); + }); + }); + + describe('executeSql', () => { + it('invokes executeSql without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse(), + ); + client.innerApiCalls.executeSql = stubSimpleCall(expectedResponse); + const [response] = await client.executeSql(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes acquireSsrsLease without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse() - ); - client.innerApiCalls.acquireSsrsLease = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.acquireSsrsLease( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes executeSql without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlResponse(), + ); + client.innerApiCalls.executeSql = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.executeSql( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesExecuteSqlResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes acquireSsrsLease with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.acquireSsrsLease = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.acquireSsrsLease(request), expectedError); - const actualRequest = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes executeSql with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.executeSql = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.executeSql(request), expectedError); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes acquireSsrsLease with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.acquireSsrsLease(request), expectedError); - }); + it('invokes executeSql with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.executeSql(request), expectedError); + }); + }); + + describe('acquireSsrsLease', () => { + it('invokes acquireSsrsLease without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse(), + ); + client.innerApiCalls.acquireSsrsLease = stubSimpleCall(expectedResponse); + const [response] = await client.acquireSsrsLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('releaseSsrsLease', () => { - it('invokes releaseSsrsLease without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse() - ); - client.innerApiCalls.releaseSsrsLease = stubSimpleCall(expectedResponse); - const [response] = await client.releaseSsrsLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes acquireSsrsLease without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseResponse(), + ); + client.innerApiCalls.acquireSsrsLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.acquireSsrsLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesAcquireSsrsLeaseResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes releaseSsrsLease without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse() - ); - client.innerApiCalls.releaseSsrsLease = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.releaseSsrsLease( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes acquireSsrsLease with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.acquireSsrsLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.acquireSsrsLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes releaseSsrsLease with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.releaseSsrsLease = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.releaseSsrsLease(request), expectedError); - const actualRequest = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes acquireSsrsLease with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.acquireSsrsLease(request), expectedError); + }); + }); + + describe('releaseSsrsLease', () => { + it('invokes releaseSsrsLease without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse(), + ); + client.innerApiCalls.releaseSsrsLease = stubSimpleCall(expectedResponse); + const [response] = await client.releaseSsrsLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes releaseSsrsLease with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.releaseSsrsLease(request), expectedError); - }); + it('invokes releaseSsrsLease without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseResponse(), + ); + client.innerApiCalls.releaseSsrsLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.releaseSsrsLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISqlInstancesReleaseSsrsLeaseResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('preCheckMajorVersionUpgrade', () => { - it('invokes preCheckMajorVersionUpgrade without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCall(expectedResponse); - const [response] = await client.preCheckMajorVersionUpgrade(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes releaseSsrsLease with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.releaseSsrsLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.releaseSsrsLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes preCheckMajorVersionUpgrade without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.preCheckMajorVersionUpgrade( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes releaseSsrsLease with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.releaseSsrsLease(request), expectedError); + }); + }); + + describe('preCheckMajorVersionUpgrade', () => { + it('invokes preCheckMajorVersionUpgrade without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.preCheckMajorVersionUpgrade = + stubSimpleCall(expectedResponse); + const [response] = await client.preCheckMajorVersionUpgrade(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes preCheckMajorVersionUpgrade with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.preCheckMajorVersionUpgrade(request), expectedError); - const actualRequest = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes preCheckMajorVersionUpgrade without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.preCheckMajorVersionUpgrade = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.preCheckMajorVersionUpgrade( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes preCheckMajorVersionUpgrade with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.preCheckMajorVersionUpgrade(request), expectedError); - }); + it('invokes preCheckMajorVersionUpgrade with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.preCheckMajorVersionUpgrade(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('pointInTimeRestore', () => { - it('invokes pointInTimeRestore without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.pointInTimeRestore = stubSimpleCall(expectedResponse); - const [response] = await client.pointInTimeRestore(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes preCheckMajorVersionUpgrade with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.preCheckMajorVersionUpgrade(request), + expectedError, + ); + }); + }); + + describe('pointInTimeRestore', () => { + it('invokes pointInTimeRestore without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.pointInTimeRestore = + stubSimpleCall(expectedResponse); + const [response] = await client.pointInTimeRestore(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes pointInTimeRestore without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.pointInTimeRestore = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pointInTimeRestore( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes pointInTimeRestore without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.pointInTimeRestore = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pointInTimeRestore( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes pointInTimeRestore with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.pointInTimeRestore = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pointInTimeRestore(request), expectedError); - const actualRequest = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes pointInTimeRestore with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.pointInTimeRestore = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.pointInTimeRestore(request), expectedError); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes pointInTimeRestore with closed client', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pointInTimeRestore(request), expectedError); - }); + it('invokes pointInTimeRestore with closed client', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.pointInTimeRestore(request), expectedError); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + location: 'locationValue', + backupvault: 'backupvaultValue', + datasource: 'datasourceValue', + backup: 'backupValue', + }; + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath( + 'projectValue', + 'locationValue', + 'backupvaultValue', + 'datasourceValue', + 'backupValue', + ); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchLocationFromBackupName', () => { + const result = client.matchLocationFromBackupName(fakePath); + assert.strictEqual(result, 'locationValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupvaultFromBackupName', () => { + const result = client.matchBackupvaultFromBackupName(fakePath); + assert.strictEqual(result, 'backupvaultValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchDatasourceFromBackupName', () => { + const result = client.matchDatasourceFromBackupName(fakePath); + assert.strictEqual(result, 'datasourceValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - backupvault: "backupvaultValue", - datasource: "datasourceValue", - backup: "backupValue", - }; - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "locationValue", "backupvaultValue", "datasourceValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromBackupName', () => { - const result = client.matchLocationFromBackupName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupvaultFromBackupName', () => { - const result = client.matchBackupvaultFromBackupName(fakePath); - assert.strictEqual(result, "backupvaultValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchDatasourceFromBackupName', () => { - const result = client.matchDatasourceFromBackupName(fakePath); - assert.strictEqual(result, "datasourceValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('network', async () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - network: "networkValue", - }; - const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "networkValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchNetworkFromNetworkName', () => { - const result = client.matchNetworkFromNetworkName(fakePath); - assert.strictEqual(result, "networkValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + describe('network', async () => { + const fakePath = '/rendered/path/network'; + const expectedParameters = { + project: 'projectValue', + network: 'networkValue', + }; + const client = new sqlinstancesserviceModule.v1.SqlInstancesServiceClient( + { + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }, + ); + await client.initialize(); + client.pathTemplates.networkPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.networkPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath('projectValue', 'networkValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchNetworkFromNetworkName', () => { + const result = client.matchNetworkFromNetworkName(fakePath); + assert.strictEqual(result, 'networkValue'); + assert( + (client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts b/packages/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts index 5a2dbf876691..57ac7bbd95ca 100644 --- a/packages/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts +++ b/packages/google-cloud-sql/test/gapic_sql_instances_service_v1beta4.ts @@ -19,5577 +19,7230 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlinstancesserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta4.SqlInstancesServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('has universeDomain', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has port', () => { - const port = sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient.port; - assert(port); - assert(typeof port === 'number'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('should create a client with no option', () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); - assert(client); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - fallback: true, - }); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlInstancesServiceStub, undefined); - await client.initialize(); - assert(client.sqlInstancesServiceStub); - }); + it('has port', () => { + const port = + sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the initialized client', done => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlInstancesServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('should create a client with no option', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + fallback: true, }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlInstancesServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlInstancesServiceStub, undefined); + await client.initialize(); + assert(client.sqlInstancesServiceStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlInstancesServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlInstancesServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('addServerCa', () => { - it('invokes addServerCa without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.addServerCa = stubSimpleCall(expectedResponse); - const [response] = await client.addServerCa(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCa without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.addServerCa = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addServerCa( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCa with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addServerCa = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addServerCa(request), expectedError); - const actualRequest = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCa with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addServerCa(request), expectedError); - }); - }); - - describe('addServerCertificate', () => { - it('invokes addServerCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.addServerCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.addServerCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.addServerCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addServerCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addServerCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addServerCertificate(request), expectedError); - const actualRequest = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addServerCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addServerCertificate(request), expectedError); - }); - }); - - describe('addEntraIdCertificate', () => { - it('invokes addEntraIdCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.addEntraIdCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.addEntraIdCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addEntraIdCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.addEntraIdCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addEntraIdCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addEntraIdCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.addEntraIdCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addEntraIdCertificate(request), expectedError); - const actualRequest = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.addEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes addEntraIdCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.addEntraIdCertificate(request), expectedError); - }); - }); - - describe('clone', () => { - it('invokes clone without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.clone = stubSimpleCall(expectedResponse); - const [response] = await client.clone(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clone without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.clone = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.clone( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clone with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.clone = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.clone(request), expectedError); - const actualRequest = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.clone as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes clone with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.clone(request), expectedError); - }); - }); - - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('demoteMaster', () => { - it('invokes demoteMaster without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.demoteMaster = stubSimpleCall(expectedResponse); - const [response] = await client.demoteMaster(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demoteMaster without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.demoteMaster = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.demoteMaster( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demoteMaster with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.demoteMaster = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.demoteMaster(request), expectedError); - const actualRequest = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demoteMaster as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demoteMaster with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.demoteMaster(request), expectedError); - }); - }); - - describe('demote', () => { - it('invokes demote without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.demote = stubSimpleCall(expectedResponse); - const [response] = await client.demote(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demote without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.demote = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.demote( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demote with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.demote = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.demote(request), expectedError); - const actualRequest = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.demote as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes demote with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.demote(request), expectedError); - }); - }); - - describe('export', () => { - it('invokes export without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.export = stubSimpleCall(expectedResponse); - const [response] = await client.export(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes export without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.export = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.export( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes export with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.export = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.export(request), expectedError); - const actualRequest = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.export as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes export with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExportRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.export(request), expectedError); - }); - }); - - describe('failover', () => { - it('invokes failover without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.failover = stubSimpleCall(expectedResponse); - const [response] = await client.failover(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failover without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.failover = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.failover( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failover with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.failover = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.failover(request), expectedError); - const actualRequest = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.failover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes failover with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.failover(request), expectedError); - }); - }); - - describe('reencrypt', () => { - it('invokes reencrypt without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.reencrypt = stubSimpleCall(expectedResponse); - const [response] = await client.reencrypt(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reencrypt without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.reencrypt = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.reencrypt( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reencrypt with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.reencrypt = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.reencrypt(request), expectedError); - const actualRequest = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.reencrypt as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes reencrypt with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.reencrypt(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DatabaseInstance() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.DatabaseInstance() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IDatabaseInstance|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('import', () => { - it('invokes import without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesImportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesImportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.import = stubSimpleCall(expectedResponse); - const [response] = await client.import(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes import without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesImportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesImportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.import = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.import( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes import with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesImportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesImportRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.import = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.import(request), expectedError); - const actualRequest = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.import as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes import with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesImportRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesImportRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.import(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IInstancesListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); - }); - - describe('listServerCas', () => { - it('invokes listServerCas without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse() - ); - client.innerApiCalls.listServerCas = stubSimpleCall(expectedResponse); - const [response] = await client.listServerCas(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCas without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse() - ); - client.innerApiCalls.listServerCas = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerCas( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCas with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerCas = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServerCas(request), expectedError); - const actualRequest = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCas as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCas with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listServerCas(request), expectedError); - }); - }); - - describe('listServerCertificates', () => { - it('invokes listServerCertificates without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse() - ); - client.innerApiCalls.listServerCertificates = stubSimpleCall(expectedResponse); - const [response] = await client.listServerCertificates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse() - ); - client.innerApiCalls.listServerCertificates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listServerCertificates( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listServerCertificates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listServerCertificates(request), expectedError); - const actualRequest = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listServerCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listServerCertificates with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listServerCertificates(request), expectedError); - }); - }); - - describe('listEntraIdCertificates', () => { - it('invokes listEntraIdCertificates without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse() - ); - client.innerApiCalls.listEntraIdCertificates = stubSimpleCall(expectedResponse); - const [response] = await client.listEntraIdCertificates(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse() - ); - client.innerApiCalls.listEntraIdCertificates = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listEntraIdCertificates( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.listEntraIdCertificates = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listEntraIdCertificates(request), expectedError); - const actualRequest = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listEntraIdCertificates as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listEntraIdCertificates with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.listEntraIdCertificates(request), expectedError); - }); - }); - - describe('patch', () => { - it('invokes patch without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.patch = stubSimpleCall(expectedResponse); - const [response] = await client.patch(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.patch( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.patch(request), expectedError); - const actualRequest = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.patch as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes patch with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.patch(request), expectedError); - }); - }); - - describe('promoteReplica', () => { - it('invokes promoteReplica without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.promoteReplica = stubSimpleCall(expectedResponse); - const [response] = await client.promoteReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.promoteReplica = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.promoteReplica( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.promoteReplica = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.promoteReplica(request), expectedError); - const actualRequest = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.promoteReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes promoteReplica with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.promoteReplica(request), expectedError); - }); - }); - - describe('switchover', () => { - it('invokes switchover without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.switchover = stubSimpleCall(expectedResponse); - const [response] = await client.switchover(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.switchover = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.switchover( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.switchover = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.switchover(request), expectedError); - const actualRequest = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.switchover as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes switchover with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.switchover(request), expectedError); - }); - }); - - describe('resetSslConfig', () => { - it('invokes resetSslConfig without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.resetSslConfig = stubSimpleCall(expectedResponse); - const [response] = await client.resetSslConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.resetSslConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetSslConfig( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetSslConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resetSslConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetSslConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetSslConfig with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.resetSslConfig(request), expectedError); - }); - }); - - describe('restart', () => { - it('invokes restart without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.restart = stubSimpleCall(expectedResponse); - const [response] = await client.restart(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.restart = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restart( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.restart = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.restart(request), expectedError); - const actualRequest = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restart as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restart with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.restart(request), expectedError); - }); - }); - - describe('restoreBackup', () => { - it('invokes restoreBackup without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.restoreBackup = stubSimpleCall(expectedResponse); - const [response] = await client.restoreBackup(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.restoreBackup = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.restoreBackup( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.restoreBackup = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.restoreBackup(request), expectedError); - const actualRequest = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.restoreBackup as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes restoreBackup with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.restoreBackup(request), expectedError); - }); - }); - - describe('rotateServerCa', () => { - it('invokes rotateServerCa without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.rotateServerCa = stubSimpleCall(expectedResponse); - const [response] = await client.rotateServerCa(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.rotateServerCa = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateServerCa( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateServerCa = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rotateServerCa(request), expectedError); - const actualRequest = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCa as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCa with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.rotateServerCa(request), expectedError); - }); - }); - - describe('rotateServerCertificate', () => { - it('invokes rotateServerCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.rotateServerCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.rotateServerCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.rotateServerCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateServerCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateServerCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rotateServerCertificate(request), expectedError); - const actualRequest = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateServerCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateServerCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.rotateServerCertificate(request), expectedError); - }); - }); - - describe('rotateEntraIdCertificate', () => { - it('invokes rotateEntraIdCertificate without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCall(expectedResponse); - const [response] = await client.rotateEntraIdCertificate(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rotateEntraIdCertificate( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rotateEntraIdCertificate(request), expectedError); - const actualRequest = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rotateEntraIdCertificate as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rotateEntraIdCertificate with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.rotateEntraIdCertificate(request), expectedError); - }); - }); - - describe('startReplica', () => { - it('invokes startReplica without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.startReplica = stubSimpleCall(expectedResponse); - const [response] = await client.startReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.startReplica = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startReplica( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.startReplica = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startReplica(request), expectedError); - const actualRequest = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startReplica with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.startReplica(request), expectedError); - }); - }); - - describe('stopReplica', () => { - it('invokes stopReplica without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.stopReplica = stubSimpleCall(expectedResponse); - const [response] = await client.stopReplica(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.stopReplica = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopReplica( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopReplica = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopReplica(request), expectedError); - const actualRequest = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopReplica as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopReplica with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.stopReplica(request), expectedError); - }); - }); - - describe('truncateLog', () => { - it('invokes truncateLog without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.truncateLog = stubSimpleCall(expectedResponse); - const [response] = await client.truncateLog(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes truncateLog without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.truncateLog = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.truncateLog( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes truncateLog with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.truncateLog = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.truncateLog(request), expectedError); - const actualRequest = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.truncateLog as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes truncateLog with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.truncateLog(request), expectedError); - }); - }); - - describe('update', () => { - it('invokes update without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.update = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes update with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.update(request), expectedError); - }); - }); - - describe('createEphemeral', () => { - it('invokes createEphemeral without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCert() - ); - client.innerApiCalls.createEphemeral = stubSimpleCall(expectedResponse); - const [response] = await client.createEphemeral(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEphemeral without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCert() - ); - client.innerApiCalls.createEphemeral = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createEphemeral( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ISslCert|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEphemeral with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.createEphemeral = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createEphemeral(request), expectedError); - const actualRequest = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createEphemeral as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createEphemeral with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.createEphemeral(request), expectedError); - }); - }); - - describe('rescheduleMaintenance', () => { - it('invokes rescheduleMaintenance without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.rescheduleMaintenance = stubSimpleCall(expectedResponse); - const [response] = await client.rescheduleMaintenance(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.rescheduleMaintenance = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.rescheduleMaintenance( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.rescheduleMaintenance = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.rescheduleMaintenance(request), expectedError); - const actualRequest = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.rescheduleMaintenance as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes rescheduleMaintenance with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.rescheduleMaintenance(request), expectedError); - }); - }); - - describe('verifyExternalSyncSettings', () => { - it('invokes verifyExternalSyncSettings without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse() - ); - client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCall(expectedResponse); - const [response] = await client.verifyExternalSyncSettings(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyExternalSyncSettings without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse() - ); - client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.verifyExternalSyncSettings( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyExternalSyncSettings with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.verifyExternalSyncSettings(request), expectedError); - const actualRequest = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.verifyExternalSyncSettings as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes verifyExternalSyncSettings with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.verifyExternalSyncSettings(request), expectedError); - }); - }); - - describe('startExternalSync', () => { - it('invokes startExternalSync without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.startExternalSync = stubSimpleCall(expectedResponse); - const [response] = await client.startExternalSync(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startExternalSync without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.startExternalSync = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startExternalSync( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startExternalSync with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.startExternalSync = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startExternalSync(request), expectedError); - const actualRequest = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startExternalSync as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startExternalSync with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.startExternalSync(request), expectedError); - }); - }); - - describe('performDiskShrink', () => { - it('invokes performDiskShrink without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.performDiskShrink = stubSimpleCall(expectedResponse); - const [response] = await client.performDiskShrink(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes performDiskShrink without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.performDiskShrink = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.performDiskShrink( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes performDiskShrink with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.performDiskShrink = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.performDiskShrink(request), expectedError); - const actualRequest = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.performDiskShrink as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes performDiskShrink with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.performDiskShrink(request), expectedError); - }); - }); - - describe('getDiskShrinkConfig', () => { - it('invokes getDiskShrinkConfig without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse() - ); - client.innerApiCalls.getDiskShrinkConfig = stubSimpleCall(expectedResponse); - const [response] = await client.getDiskShrinkConfig(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDiskShrinkConfig without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse() - ); - client.innerApiCalls.getDiskShrinkConfig = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getDiskShrinkConfig( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDiskShrinkConfig with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getDiskShrinkConfig = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getDiskShrinkConfig(request), expectedError); - const actualRequest = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getDiskShrinkConfig as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getDiskShrinkConfig with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getDiskShrinkConfig(request), expectedError); - }); - }); - - describe('resetReplicaSize', () => { - it('invokes resetReplicaSize without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.resetReplicaSize = stubSimpleCall(expectedResponse); - const [response] = await client.resetReplicaSize(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetReplicaSize without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.resetReplicaSize = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.resetReplicaSize( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetReplicaSize with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.resetReplicaSize = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.resetReplicaSize(request), expectedError); - const actualRequest = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.resetReplicaSize as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes resetReplicaSize with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.resetReplicaSize(request), expectedError); - }); - }); - - describe('getLatestRecoveryTime', () => { - it('invokes getLatestRecoveryTime without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse() - ); - client.innerApiCalls.getLatestRecoveryTime = stubSimpleCall(expectedResponse); - const [response] = await client.getLatestRecoveryTime(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLatestRecoveryTime without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse() - ); - client.innerApiCalls.getLatestRecoveryTime = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLatestRecoveryTime( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLatestRecoveryTime with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.getLatestRecoveryTime = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLatestRecoveryTime(request), expectedError); - const actualRequest = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getLatestRecoveryTime as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getLatestRecoveryTime with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.getLatestRecoveryTime(request), expectedError); - }); - }); - - describe('executeSql', () => { - it('invokes executeSql without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse() - ); - client.innerApiCalls.executeSql = stubSimpleCall(expectedResponse); - const [response] = await client.executeSql(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes executeSql without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse() - ); - client.innerApiCalls.executeSql = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.executeSql( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes executeSql with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.executeSql = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.executeSql(request), expectedError); - const actualRequest = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.executeSql as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes executeSql with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.executeSql(request), expectedError); - }); - }); - - describe('acquireSsrsLease', () => { - it('invokes acquireSsrsLease without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse() - ); - client.innerApiCalls.acquireSsrsLease = stubSimpleCall(expectedResponse); - const [response] = await client.acquireSsrsLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acquireSsrsLease without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse() - ); - client.innerApiCalls.acquireSsrsLease = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.acquireSsrsLease( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acquireSsrsLease with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.acquireSsrsLease = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.acquireSsrsLease(request), expectedError); - const actualRequest = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.acquireSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes acquireSsrsLease with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.acquireSsrsLease(request), expectedError); - }); - }); - - describe('releaseSsrsLease', () => { - it('invokes releaseSsrsLease without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse() - ); - client.innerApiCalls.releaseSsrsLease = stubSimpleCall(expectedResponse); - const [response] = await client.releaseSsrsLease(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes releaseSsrsLease without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse() - ); - client.innerApiCalls.releaseSsrsLease = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.releaseSsrsLease( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes releaseSsrsLease with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.releaseSsrsLease = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.releaseSsrsLease(request), expectedError); - const actualRequest = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.releaseSsrsLease as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes releaseSsrsLease with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.releaseSsrsLease(request), expectedError); - }); - }); - - describe('preCheckMajorVersionUpgrade', () => { - it('invokes preCheckMajorVersionUpgrade without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCall(expectedResponse); - const [response] = await client.preCheckMajorVersionUpgrade(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes preCheckMajorVersionUpgrade without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.preCheckMajorVersionUpgrade( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes preCheckMajorVersionUpgrade with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.preCheckMajorVersionUpgrade(request), expectedError); - const actualRequest = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes preCheckMajorVersionUpgrade with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.preCheckMajorVersionUpgrade(request), expectedError); - }); - }); - - describe('pointInTimeRestore', () => { - it('invokes pointInTimeRestore without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.pointInTimeRestore = stubSimpleCall(expectedResponse); - const [response] = await client.pointInTimeRestore(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pointInTimeRestore without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.pointInTimeRestore = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.pointInTimeRestore( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pointInTimeRestore with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.pointInTimeRestore = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.pointInTimeRestore(request), expectedError); - const actualRequest = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.pointInTimeRestore as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes pointInTimeRestore with closed client', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.pointInTimeRestore(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('addServerCa', () => { + it('invokes addServerCa without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addServerCa = stubSimpleCall(expectedResponse); + const [response] = await client.addServerCa(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes addServerCa without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addServerCa = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addServerCa( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes addServerCa with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addServerCa = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.addServerCa(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes addServerCa with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.addServerCa(request), expectedError); + }); + }); + + describe('addServerCertificate', () => { + it('invokes addServerCertificate without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addServerCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.addServerCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCertificate without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addServerCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addServerCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCertificate with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addServerCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.addServerCertificate(request), expectedError); + const actualRequest = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addServerCertificate with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.addServerCertificate(request), expectedError); + }); + }); + + describe('addEntraIdCertificate', () => { + it('invokes addEntraIdCertificate without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addEntraIdCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.addEntraIdCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addEntraIdCertificate without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.addEntraIdCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addEntraIdCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addEntraIdCertificate with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.addEntraIdCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.addEntraIdCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.addEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes addEntraIdCertificate with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAddEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.addEntraIdCertificate(request), + expectedError, + ); + }); + }); + + describe('clone', () => { + it('invokes clone without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.clone = stubSimpleCall(expectedResponse); + const [response] = await client.clone(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clone without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.clone = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.clone( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clone with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.clone = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.clone(request), expectedError); + const actualRequest = (client.innerApiCalls.clone as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.clone as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes clone with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCloneRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCloneRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.clone(request), expectedError); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); + + describe('demoteMaster', () => { + it('invokes demoteMaster without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.demoteMaster = stubSimpleCall(expectedResponse); + const [response] = await client.demoteMaster(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demoteMaster without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.demoteMaster = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.demoteMaster( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demoteMaster with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.demoteMaster = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.demoteMaster(request), expectedError); + const actualRequest = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demoteMaster as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demoteMaster with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteMasterRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.demoteMaster(request), expectedError); + }); + }); + + describe('demote', () => { + it('invokes demote without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.demote = stubSimpleCall(expectedResponse); + const [response] = await client.demote(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demote without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.demote = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.demote( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demote with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.demote = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.demote(request), expectedError); + const actualRequest = (client.innerApiCalls.demote as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.demote as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes demote with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesDemoteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.demote(request), expectedError); + }); + }); + + describe('export', () => { + it('invokes export without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.export = stubSimpleCall(expectedResponse); + const [response] = await client.export(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes export without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.export = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.export( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes export with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.export = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.export(request), expectedError); + const actualRequest = (client.innerApiCalls.export as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.export as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes export with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.export(request), expectedError); + }); + }); + + describe('failover', () => { + it('invokes failover without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.failover = stubSimpleCall(expectedResponse); + const [response] = await client.failover(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes failover without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.failover = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.failover( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes failover with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.failover = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.failover(request), expectedError); + const actualRequest = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.failover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes failover with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesFailoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.failover(request), expectedError); + }); + }); + + describe('reencrypt', () => { + it('invokes reencrypt without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.reencrypt = stubSimpleCall(expectedResponse); + const [response] = await client.reencrypt(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reencrypt without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.reencrypt = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.reencrypt( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reencrypt with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.reencrypt = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.reencrypt(request), expectedError); + const actualRequest = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.reencrypt as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes reencrypt with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReencryptRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.reencrypt(request), expectedError); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DatabaseInstance(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.DatabaseInstance(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IDatabaseInstance | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('import', () => { + it('invokes import without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.import = stubSimpleCall(expectedResponse); + const [response] = await client.import(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes import without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.import = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.import( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes import with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.import = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.import(request), expectedError); + const actualRequest = (client.innerApiCalls.import as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.import as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes import with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesImportRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesImportRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.import(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IInstancesListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('listServerCas', () => { + it('invokes listServerCas without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse(), + ); + client.innerApiCalls.listServerCas = stubSimpleCall(expectedResponse); + const [response] = await client.listServerCas(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCas without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListServerCasResponse(), + ); + client.innerApiCalls.listServerCas = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerCas( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IInstancesListServerCasResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCas with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerCas = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.listServerCas(request), expectedError); + const actualRequest = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCas as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCas with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCasRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.listServerCas(request), expectedError); + }); + }); + + describe('listServerCertificates', () => { + it('invokes listServerCertificates without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse(), + ); + client.innerApiCalls.listServerCertificates = + stubSimpleCall(expectedResponse); + const [response] = await client.listServerCertificates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCertificates without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListServerCertificatesResponse(), + ); + client.innerApiCalls.listServerCertificates = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listServerCertificates( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IInstancesListServerCertificatesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCertificates with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listServerCertificates = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listServerCertificates(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listServerCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listServerCertificates with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListServerCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.listServerCertificates(request), + expectedError, + ); + }); + }); + + describe('listEntraIdCertificates', () => { + it('invokes listEntraIdCertificates without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse(), + ); + client.innerApiCalls.listEntraIdCertificates = + stubSimpleCall(expectedResponse); + const [response] = await client.listEntraIdCertificates(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntraIdCertificates without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.InstancesListEntraIdCertificatesResponse(), + ); + client.innerApiCalls.listEntraIdCertificates = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listEntraIdCertificates( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IInstancesListEntraIdCertificatesResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntraIdCertificates with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listEntraIdCertificates = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.listEntraIdCertificates(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.listEntraIdCertificates as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listEntraIdCertificates with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesListEntraIdCertificatesRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.listEntraIdCertificates(request), + expectedError, + ); + }); + }); + + describe('patch', () => { + it('invokes patch without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCall(expectedResponse); + const [response] = await client.patch(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.patch = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.patch( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.patch = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.patch(request), expectedError); + const actualRequest = (client.innerApiCalls.patch as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.patch as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes patch with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPatchRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPatchRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.patch(request), expectedError); + }); + }); + + describe('promoteReplica', () => { + it('invokes promoteReplica without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.promoteReplica = stubSimpleCall(expectedResponse); + const [response] = await client.promoteReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes promoteReplica without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.promoteReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.promoteReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes promoteReplica with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.promoteReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.promoteReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.promoteReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes promoteReplica with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPromoteReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.promoteReplica(request), expectedError); + }); + }); + + describe('switchover', () => { + it('invokes switchover without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.switchover = stubSimpleCall(expectedResponse); + const [response] = await client.switchover(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes switchover without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.switchover = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.switchover( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes switchover with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.switchover = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.switchover(request), expectedError); + const actualRequest = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.switchover as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes switchover with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesSwitchoverRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.switchover(request), expectedError); + }); + }); + + describe('resetSslConfig', () => { + it('invokes resetSslConfig without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.resetSslConfig = stubSimpleCall(expectedResponse); + const [response] = await client.resetSslConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetSslConfig without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.resetSslConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetSslConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetSslConfig with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetSslConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.resetSslConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetSslConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetSslConfig with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetSslConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.resetSslConfig(request), expectedError); + }); + }); + + describe('restart', () => { + it('invokes restart without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.restart = stubSimpleCall(expectedResponse); + const [response] = await client.restart(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restart without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.restart = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restart( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restart with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restart = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.restart(request), expectedError); + const actualRequest = (client.innerApiCalls.restart as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restart as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restart with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestartRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestartRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.restart(request), expectedError); + }); + }); + + describe('restoreBackup', () => { + it('invokes restoreBackup without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.restoreBackup = stubSimpleCall(expectedResponse); + const [response] = await client.restoreBackup(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreBackup without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.restoreBackup = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.restoreBackup( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreBackup with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.restoreBackup = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.restoreBackup(request), expectedError); + const actualRequest = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.restoreBackup as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes restoreBackup with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRestoreBackupRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.restoreBackup(request), expectedError); + }); + }); + + describe('rotateServerCa', () => { + it('invokes rotateServerCa without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateServerCa = stubSimpleCall(expectedResponse); + const [response] = await client.rotateServerCa(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCa without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateServerCa = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateServerCa( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCa with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateServerCa = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.rotateServerCa(request), expectedError); + const actualRequest = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCa as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCa with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.rotateServerCa(request), expectedError); + }); + }); + + describe('rotateServerCertificate', () => { + it('invokes rotateServerCertificate without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateServerCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.rotateServerCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCertificate without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateServerCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateServerCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCertificate with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateServerCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rotateServerCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateServerCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateServerCertificate with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateServerCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rotateServerCertificate(request), + expectedError, + ); + }); + }); + + describe('rotateEntraIdCertificate', () => { + it('invokes rotateEntraIdCertificate without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateEntraIdCertificate = + stubSimpleCall(expectedResponse); + const [response] = await client.rotateEntraIdCertificate(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateEntraIdCertificate without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rotateEntraIdCertificate = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rotateEntraIdCertificate( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateEntraIdCertificate with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rotateEntraIdCertificate = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rotateEntraIdCertificate(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rotateEntraIdCertificate as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rotateEntraIdCertificate with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRotateEntraIdCertificateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rotateEntraIdCertificate(request), + expectedError, + ); + }); + }); + + describe('startReplica', () => { + it('invokes startReplica without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.startReplica = stubSimpleCall(expectedResponse); + const [response] = await client.startReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startReplica without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.startReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startReplica with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startReplica with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startReplica(request), expectedError); + }); + }); + + describe('stopReplica', () => { + it('invokes stopReplica without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.stopReplica = stubSimpleCall(expectedResponse); + const [response] = await client.stopReplica(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopReplica without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.stopReplica = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopReplica( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopReplica with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopReplica = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.stopReplica(request), expectedError); + const actualRequest = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.stopReplica as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopReplica with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStopReplicaRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.stopReplica(request), expectedError); + }); + }); + + describe('truncateLog', () => { + it('invokes truncateLog without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.truncateLog = stubSimpleCall(expectedResponse); + const [response] = await client.truncateLog(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes truncateLog without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.truncateLog = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.truncateLog( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes truncateLog with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.truncateLog = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.truncateLog(request), expectedError); + const actualRequest = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.truncateLog as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes truncateLog with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesTruncateLogRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.truncateLog(request), expectedError); + }); + }); + + describe('update', () => { + it('invokes update without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); + }); + }); + + describe('createEphemeral', () => { + it('invokes createEphemeral without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCert(), + ); + client.innerApiCalls.createEphemeral = stubSimpleCall(expectedResponse); + const [response] = await client.createEphemeral(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEphemeral without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCert(), + ); + client.innerApiCalls.createEphemeral = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createEphemeral( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISslCert | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEphemeral with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createEphemeral = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.createEphemeral(request), expectedError); + const actualRequest = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.createEphemeral as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createEphemeral with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesCreateEphemeralCertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.createEphemeral(request), expectedError); + }); + }); + + describe('rescheduleMaintenance', () => { + it('invokes rescheduleMaintenance without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rescheduleMaintenance = + stubSimpleCall(expectedResponse); + const [response] = await client.rescheduleMaintenance(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.rescheduleMaintenance = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.rescheduleMaintenance( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.rescheduleMaintenance = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.rescheduleMaintenance(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.rescheduleMaintenance as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes rescheduleMaintenance with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesRescheduleMaintenanceRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.rescheduleMaintenance(request), + expectedError, + ); + }); + }); + + describe('verifyExternalSyncSettings', () => { + it('invokes verifyExternalSyncSettings without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse(), + ); + client.innerApiCalls.verifyExternalSyncSettings = + stubSimpleCall(expectedResponse); + const [response] = await client.verifyExternalSyncSettings(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyExternalSyncSettings without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsResponse(), + ); + client.innerApiCalls.verifyExternalSyncSettings = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.verifyExternalSyncSettings( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesVerifyExternalSyncSettingsResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyExternalSyncSettings with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.verifyExternalSyncSettings = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.verifyExternalSyncSettings(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.verifyExternalSyncSettings as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes verifyExternalSyncSettings with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesVerifyExternalSyncSettingsRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.verifyExternalSyncSettings(request), + expectedError, + ); + }); + }); + + describe('startExternalSync', () => { + it('invokes startExternalSync without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.startExternalSync = stubSimpleCall(expectedResponse); + const [response] = await client.startExternalSync(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startExternalSync without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.startExternalSync = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startExternalSync( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startExternalSync with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startExternalSync = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.startExternalSync(request), expectedError); + const actualRequest = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.startExternalSync as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startExternalSync with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesStartExternalSyncRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.startExternalSync(request), expectedError); + }); + }); + + describe('performDiskShrink', () => { + it('invokes performDiskShrink without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.performDiskShrink = stubSimpleCall(expectedResponse); + const [response] = await client.performDiskShrink(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performDiskShrink without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.performDiskShrink = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.performDiskShrink( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performDiskShrink with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.performDiskShrink = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.performDiskShrink(request), expectedError); + const actualRequest = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.performDiskShrink as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes performDiskShrink with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPerformDiskShrinkRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.performDiskShrink(request), expectedError); + }); + }); + + describe('getDiskShrinkConfig', () => { + it('invokes getDiskShrinkConfig without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse(), + ); + client.innerApiCalls.getDiskShrinkConfig = + stubSimpleCall(expectedResponse); + const [response] = await client.getDiskShrinkConfig(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDiskShrinkConfig without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigResponse(), + ); + client.innerApiCalls.getDiskShrinkConfig = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getDiskShrinkConfig( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetDiskShrinkConfigResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDiskShrinkConfig with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getDiskShrinkConfig = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.getDiskShrinkConfig(request), expectedError); + const actualRequest = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getDiskShrinkConfig as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getDiskShrinkConfig with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetDiskShrinkConfigRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.getDiskShrinkConfig(request), expectedError); + }); + }); + + describe('resetReplicaSize', () => { + it('invokes resetReplicaSize without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.resetReplicaSize = stubSimpleCall(expectedResponse); + const [response] = await client.resetReplicaSize(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetReplicaSize without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.resetReplicaSize = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.resetReplicaSize( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetReplicaSize with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.resetReplicaSize = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.resetReplicaSize(request), expectedError); + const actualRequest = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.resetReplicaSize as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes resetReplicaSize with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesResetReplicaSizeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.resetReplicaSize(request), expectedError); + }); + }); + + describe('getLatestRecoveryTime', () => { + it('invokes getLatestRecoveryTime without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse(), + ); + client.innerApiCalls.getLatestRecoveryTime = + stubSimpleCall(expectedResponse); + const [response] = await client.getLatestRecoveryTime(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLatestRecoveryTime without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeResponse(), + ); + client.innerApiCalls.getLatestRecoveryTime = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLatestRecoveryTime( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesGetLatestRecoveryTimeResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLatestRecoveryTime with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getLatestRecoveryTime = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLatestRecoveryTime(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.getLatestRecoveryTime as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getLatestRecoveryTime with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesGetLatestRecoveryTimeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.getLatestRecoveryTime(request), + expectedError, + ); + }); + }); + + describe('executeSql', () => { + it('invokes executeSql without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse(), + ); + client.innerApiCalls.executeSql = stubSimpleCall(expectedResponse); + const [response] = await client.executeSql(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executeSql without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlResponse(), + ); + client.innerApiCalls.executeSql = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.executeSql( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesExecuteSqlResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executeSql with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.executeSql = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.executeSql(request), expectedError); + const actualRequest = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.executeSql as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes executeSql with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesExecuteSqlRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.executeSql(request), expectedError); + }); + }); + + describe('acquireSsrsLease', () => { + it('invokes acquireSsrsLease without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse(), + ); + client.innerApiCalls.acquireSsrsLease = stubSimpleCall(expectedResponse); + const [response] = await client.acquireSsrsLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes acquireSsrsLease without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseResponse(), + ); + client.innerApiCalls.acquireSsrsLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.acquireSsrsLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesAcquireSsrsLeaseResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes acquireSsrsLease with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.acquireSsrsLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.acquireSsrsLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.acquireSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes acquireSsrsLease with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesAcquireSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.acquireSsrsLease(request), expectedError); + }); + }); + + describe('releaseSsrsLease', () => { + it('invokes releaseSsrsLease without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse(), + ); + client.innerApiCalls.releaseSsrsLease = stubSimpleCall(expectedResponse); + const [response] = await client.releaseSsrsLease(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes releaseSsrsLease without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseResponse(), + ); + client.innerApiCalls.releaseSsrsLease = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.releaseSsrsLease( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISqlInstancesReleaseSsrsLeaseResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes releaseSsrsLease with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.releaseSsrsLease = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.releaseSsrsLease(request), expectedError); + const actualRequest = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.releaseSsrsLease as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes releaseSsrsLease with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesReleaseSsrsLeaseRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.releaseSsrsLease(request), expectedError); + }); + }); + + describe('preCheckMajorVersionUpgrade', () => { + it('invokes preCheckMajorVersionUpgrade without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.preCheckMajorVersionUpgrade = + stubSimpleCall(expectedResponse); + const [response] = await client.preCheckMajorVersionUpgrade(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes preCheckMajorVersionUpgrade without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.preCheckMajorVersionUpgrade = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.preCheckMajorVersionUpgrade( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes preCheckMajorVersionUpgrade with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.preCheckMajorVersionUpgrade = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.preCheckMajorVersionUpgrade(request), + expectedError, + ); + const actualRequest = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.preCheckMajorVersionUpgrade as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes preCheckMajorVersionUpgrade with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPreCheckMajorVersionUpgradeRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects( + client.preCheckMajorVersionUpgrade(request), + expectedError, + ); + }); + }); + + describe('pointInTimeRestore', () => { + it('invokes pointInTimeRestore without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.pointInTimeRestore = + stubSimpleCall(expectedResponse); + const [response] = await client.pointInTimeRestore(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pointInTimeRestore without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.pointInTimeRestore = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.pointInTimeRestore( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pointInTimeRestore with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.pointInTimeRestore = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects(client.pointInTimeRestore(request), expectedError); + const actualRequest = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.pointInTimeRestore as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes pointInTimeRestore with closed client', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlInstancesPointInTimeRestoreRequest', + ['parent'], + ); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.pointInTimeRestore(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqlinstancesserviceModule.v1beta4.SqlInstancesServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_operations_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_operations_service_v1.ts index 5903ce5f34ca..56b5f9690f63 100644 --- a/packages/google-cloud-sql/test/gapic_sql_operations_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_operations_service_v1.ts @@ -19,771 +19,961 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqloperationsserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlOperationsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqloperationsserviceModule.v1.SqlOperationsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqloperationsserviceModule.v1.SqlOperationsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqloperationsserviceModule.v1.SqlOperationsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + it('has universeDomain', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqloperationsserviceModule.v1.SqlOperationsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqloperationsserviceModule.v1.SqlOperationsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('has port', () => { - const port = sqloperationsserviceModule.v1.SqlOperationsServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('should create a client with no option', () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - fallback: true, - }); - assert(client); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlOperationsServiceStub, undefined); - await client.initialize(); - assert(client.sqlOperationsServiceStub); + it('has port', () => { + const port = + sqloperationsserviceModule.v1.SqlOperationsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + fallback: true, }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlOperationsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlOperationsServiceStub, undefined); + await client.initialize(); + assert(client.sqlOperationsServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlOperationsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlOperationsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlOperationsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsGetRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsGetRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsGetRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsGetRequest', ['operation']); - request.operation = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.OperationsListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.OperationsListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperationsListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsListRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); + it('invokes get without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('cancel', () => { - it('invokes cancel without error', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsCancelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsCancelRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsCancelRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancel = stubSimpleCall(expectedResponse); - const [response] = await client.cancel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel without error using callback', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsCancelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsCancelRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsCancelRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancel( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel with error', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsCancelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsCancelRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsCancelRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancel(request), expectedError); - const actualRequest = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel with closed client', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlOperationsCancelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsCancelRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlOperationsCancelRequest', ['operation']); - request.operation = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.cancel(request), expectedError); + it('invokes get with closed client', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.OperationsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + + it('invokes list without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.OperationsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperationsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes list with closed client', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('cancel', () => { + it('invokes cancel without error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.cancel = stubSimpleCall(expectedResponse); + const [response] = await client.cancel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes cancel without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.cancel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancel( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes cancel with error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancel = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancel(request), expectedError); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancel with closed client', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.cancel(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqloperationsserviceModule.v1.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts b/packages/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts index 5fca4c39fd70..28cc64f3a40a 100644 --- a/packages/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts +++ b/packages/google-cloud-sql/test/gapic_sql_operations_service_v1beta4.ts @@ -19,801 +19,1002 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqloperationsserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta4.SqlOperationsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); - }); + it('has universeDomain', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('has port', () => { - const port = sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient.port; - assert(port); - assert(typeof port === 'number'); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient + .servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient + .apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('should create a client with no option', () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); - assert(client); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - fallback: true, - }); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlOperationsServiceStub, undefined); - await client.initialize(); - assert(client.sqlOperationsServiceStub); - }); + it('has port', () => { + const port = + sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has close method for the initialized client', done => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlOperationsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('should create a client with no option', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + fallback: true, }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlOperationsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlOperationsServiceStub, undefined); + await client.initialize(); + assert(client.sqlOperationsServiceStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlOperationsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlOperationsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsGetRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsGetRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsGetRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsGetRequest', ['operation']); - request.operation = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.OperationsListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.OperationsListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperationsListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsListRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); - }); - - describe('cancel', () => { - it('invokes cancel without error', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancel = stubSimpleCall(expectedResponse); - const [response] = await client.cancel(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel without error using callback', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.innerApiCalls.cancel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.cancel( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel with error', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', ['operation']); - request.operation = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&operation=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.cancel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.cancel(request), expectedError); - const actualRequest = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.cancel as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes cancel with closed client', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', ['operation']); - request.operation = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.cancel(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); + + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes get with error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes get with closed client', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsGetRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.OperationsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('invokes list without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.OperationsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperationsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes list with error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + + describe('cancel', () => { + it('invokes cancel without error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.cancel = stubSimpleCall(expectedResponse); + const [response] = await client.cancel(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancel without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty(), + ); + client.innerApiCalls.cancel = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.cancel( + request, + ( + err?: Error | null, + result?: protos.google.protobuf.IEmpty | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancel with error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&operation=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.cancel = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.cancel(request), expectedError); + const actualRequest = (client.innerApiCalls.cancel as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.cancel as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes cancel with closed client', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlOperationsCancelRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlOperationsCancelRequest', + ['operation'], + ); + request.operation = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.cancel(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqloperationsserviceModule.v1beta4.SqlOperationsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts index d3e88a5978ca..07ac5d56e9e0 100644 --- a/packages/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1.ts @@ -19,927 +19,1140 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlsslcertsserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlSslCertsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); + + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + universeDomain: 'configured.example.com', }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); - assert(client); - }); + it('has port', () => { + const port = sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlSslCertsServiceStub, undefined); - await client.initialize(); - assert(client.sqlSslCertsServiceStub); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlSslCertsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlSslCertsServiceStub, undefined); + await client.initialize(); + assert(client.sqlSslCertsServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlSslCertsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlSslCertsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlSslCertsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); - it('invokes delete without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('delete', () => { + it('invokes delete without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes delete without error using callback', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsDeleteRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); + it('invokes delete with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCert() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes delete with closed client', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); - it('invokes get without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCert() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ISslCert|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('get', () => { + it('invokes get without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCert(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes get without error using callback', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCert(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISslCert | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsGetRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); + it('invokes get with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCertsInsertResponse() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes get with closed client', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); - it('invokes insert without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCertsInsertResponse() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ISslCertsInsertResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('insert', () => { + it('invokes insert without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCertsInsertResponse(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes insert without error using callback', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCertsInsertResponse(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISslCertsInsertResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); + it('invokes insert with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCertsListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes insert with closed client', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); - it('invokes list without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.SslCertsListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ISslCertsListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCertsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list without error using callback', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.SslCertsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ISslCertsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlSslCertsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlSslCertsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes list with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + + it('invokes list with closed client', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); + it('invokes getLocation with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); - describe('Path templates', () => { + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlsslcertsserviceModule.v1.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts b/packages/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts index 40109a1edb60..7b9549c8daf5 100644 --- a/packages/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts +++ b/packages/google-cloud-sql/test/gapic_sql_ssl_certs_service_v1beta4.ts @@ -19,957 +19,1213 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlsslcertsserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta4.SqlSslCertsServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); - - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); - - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + it('has universeDomain', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); + + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + universeDomain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('has port', () => { - const port = sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + universe_domain: 'example.com', }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('should create a client with no option', () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); - assert(client); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('should create a client with gRPC fallback', () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - fallback: true, + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + universeDomain: 'configured.example.com', }); - assert(client); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', + }); + }); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlSslCertsServiceStub, undefined); - await client.initialize(); - assert(client.sqlSslCertsServiceStub); + it('has port', () => { + const port = + sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + fallback: true, }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlSslCertsServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has initialize method and supports deferred initialization', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlSslCertsServiceStub, undefined); + await client.initialize(); + assert(client.sqlSslCertsServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlSslCertsServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlSslCertsServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + assert.strictEqual(client.sqlSslCertsServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; + }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes delete with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); - }); - - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCert() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCert() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ISslCert|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&sha1_fingerprint=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes get with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', ['sha1Fingerprint']); - request.sha1Fingerprint = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); - }); - - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCertsInsertResponse() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCertsInsertResponse() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes insert with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); - }); - - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCertsListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SslCertsListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ISslCertsListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes list with closed client', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlSslCertsListRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } + }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('delete', () => { + it('invokes delete without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes delete without error using callback', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes delete with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes delete with closed client', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsDeleteRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); - describe('project', async () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + describe('get', () => { + it('invokes get without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCert(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('invokes get without error using callback', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCert(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISslCert | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&sha1_fingerprint=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes get with closed client', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsGetRequest', + ['sha1Fingerprint'], + ); + request.sha1Fingerprint = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); + + describe('insert', () => { + it('invokes insert without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCertsInsertResponse(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert without error using callback', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCertsInsertResponse(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISslCertsInsertResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes insert with closed client', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCertsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list without error using callback', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SslCertsListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ISslCertsListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes list with closed client', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlSslCertsListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlSslCertsListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + }); + + describe('project', async () => { + const fakePath = '/rendered/path/project'; + const expectedParameters = { + project: 'projectValue', + }; + const client = + new sqlsslcertsserviceModule.v1beta4.SqlSslCertsServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.projectPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.projectPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath('projectValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts index 7be02eaff388..0f48bbe07820 100644 --- a/packages/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_tiers_service_v1.ts @@ -19,531 +19,635 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqltiersserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlTiersServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqltiersserviceModule.v1.SqlTiersServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqltiersserviceModule.v1.SqlTiersServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqltiersserviceModule.v1.SqlTiersServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqltiersserviceModule.v1.SqlTiersServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqltiersserviceModule.v1.SqlTiersServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = sqltiersserviceModule.v1.SqlTiersServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqltiersserviceModule.v1.SqlTiersServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); - assert(client); - }); + it('has port', () => { + const port = sqltiersserviceModule.v1.SqlTiersServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlTiersServiceStub, undefined); - await client.initialize(); - assert(client.sqlTiersServiceStub); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlTiersServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlTiersServiceStub, undefined); + await client.initialize(); + assert(client.sqlTiersServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlTiersServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlTiersServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlTiersServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlTiersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlTiersListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.TiersListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.TiersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list without error using callback', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlTiersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlTiersListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.TiersListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.ITiersListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list without error using callback', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.TiersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.ITiersListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlTiersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlTiersListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list with error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with closed client', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlTiersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlTiersListRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes list with closed client', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); - - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes getLocation with error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqltiersserviceModule.v1.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts b/packages/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts index 84dcb4615d7f..7eed7f7ae61f 100644 --- a/packages/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts +++ b/packages/google-cloud-sql/test/gapic_sql_tiers_service_v1beta4.ts @@ -19,531 +19,637 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqltiersserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta4.SqlTiersServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqltiersserviceModule.v1beta4.SqlTiersServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqltiersserviceModule.v1beta4.SqlTiersServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqltiersserviceModule.v1beta4.SqlTiersServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqltiersserviceModule.v1beta4.SqlTiersServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + universeDomain: 'configured.example.com', }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = sqltiersserviceModule.v1beta4.SqlTiersServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); - assert(client); - }); + it('has port', () => { + const port = sqltiersserviceModule.v1beta4.SqlTiersServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlTiersServiceStub, undefined); - await client.initialize(); - assert(client.sqlTiersServiceStub); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlTiersServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlTiersServiceStub, undefined); + await client.initialize(); + assert(client.sqlTiersServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlTiersServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlTiersServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlTiersServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlTiersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlTiersListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.TiersListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); + + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.TiersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list without error using callback', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlTiersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlTiersListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.TiersListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.ITiersListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list without error using callback', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.TiersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.ITiersListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlTiersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlTiersListRequest', ['project']); - request.project = defaultValue1; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list with error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with closed client', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlTiersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlTiersListRequest', ['project']); - request.project = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes list with closed client', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlTiersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlTiersListRequest', + ['project'], + ); + request.project = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); - - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('invokes getLocation with error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); + + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqltiersserviceModule.v1beta4.SqlTiersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); + + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); + + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); + + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_users_service_v1.ts b/packages/google-cloud-sql/test/gapic_sql_users_service_v1.ts index b5b898848b1b..ffbc06c9fd47 100644 --- a/packages/google-cloud-sql/test/gapic_sql_users_service_v1.ts +++ b/packages/google-cloud-sql/test/gapic_sql_users_service_v1.ts @@ -19,1035 +19,1267 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlusersserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1.SqlUsersServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); - - it('has universeDomain', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlusersserviceModule.v1.SqlUsersServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + it('has universeDomain', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlusersserviceModule.v1.SqlUsersServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlusersserviceModule.v1.SqlUsersServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlusersserviceModule.v1.SqlUsersServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); - }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlusersserviceModule.v1.SqlUsersServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - it('has port', () => { - const port = sqlusersserviceModule.v1.SqlUsersServiceClient.port; - assert(port); - assert(typeof port === 'number'); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + universeDomain: 'configured.example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('should create a client with no option', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); - assert(client); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlusersserviceModule.v1.SqlUsersServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - fallback: true, - }); - assert(client); - }); + it('has port', () => { + const port = sqlusersserviceModule.v1.SqlUsersServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlUsersServiceStub, undefined); - await client.initialize(); - assert(client.sqlUsersServiceStub); - }); + it('should create a client with no option', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient(); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlUsersServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlUsersServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlUsersServiceStub, undefined); + await client.initialize(); + assert(client.sqlUsersServiceStub); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the initialized client', (done) => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlUsersServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); + it('has close method for the non-initialized client', (done) => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlUsersServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); }); - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + }); - it('invokes delete without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); - it('invokes delete with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('delete', () => { + it('invokes delete without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with closed client', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); + it('invokes delete without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&name=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.User() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes delete with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&name=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.User() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes delete with closed client', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); - it('invokes get with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&name=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('get', () => { + it('invokes get without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.User(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with closed client', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersGetRequest', ['name']); - request.name = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); + it('invokes get without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.User(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IUser | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes get with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes get with closed client', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); - it('invokes insert with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('insert', () => { + it('invokes insert without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with closed client', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); + it('invokes insert without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.UsersListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes insert with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.UsersListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IUsersListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes insert with closed client', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); - it('invokes list with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.UsersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with closed client', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersListRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes list without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.UsersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IUsersListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('update', () => { - it('invokes update without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1.Operation() - ); - client.innerApiCalls.update = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list with closed client', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); - it('invokes update with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('update', () => { + it('invokes update without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update with closed client', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1.SqlUsersUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1.SqlUsersUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.update(request), expectedError); - }); + it('invokes update without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + + it('invokes update with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes update with closed client', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + it('invokes getLocation without error using callback', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); + it('invokes getLocation with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlusersserviceModule.v1.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts b/packages/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts index 46449019b106..10439be8e2e5 100644 --- a/packages/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts +++ b/packages/google-cloud-sql/test/gapic_sql_users_service_v1beta4.ts @@ -19,1035 +19,1269 @@ import * as protos from '../protos/protos'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; +import { SinonStub } from 'sinon'; +import { describe, it } from 'mocha'; import * as sqlusersserviceModule from '../src'; -import {protobuf, LocationProtos} from 'google-gax'; +import { protobuf, LocationProtos } from 'google-gax'; // Dynamically loaded proto JSON is needed to get the type information // to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); +const root = protobuf.Root.fromJSON( + require('../protos/protos.json'), +).resolveAll(); // eslint-disable-next-line @typescript-eslint/no-unused-vars function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; } function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; + const filledObject = ( + instance.constructor as typeof protobuf.Message + ).toObject(instance as protobuf.Message, { defaults: true }); + return (instance.constructor as typeof protobuf.Message).fromObject( + filledObject, + ) as T; } function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); + return error + ? sinon.stub().rejects(error) + : sinon.stub().resolves([response]); } -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +function stubSimpleCallWithCallback( + response?: ResponseType, + error?: Error, +) { + return error + ? sinon.stub().callsArgWith(2, error) + : sinon.stub().callsArgWith(2, null, response); } -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); +function stubAsyncIterationCall( + responses?: ResponseType[], + error?: Error, +) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: responses![counter++] }); + }, + }; + }, + }; + return sinon.stub().returns(asyncIterable); } describe('v1beta4.SqlUsersServiceClient', () => { - describe('Common methods', () => { - it('has apiEndpoint', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); - const apiEndpoint = client.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - }); + describe('Common methods', () => { + it('has apiEndpoint', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); + const apiEndpoint = client.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + }); - it('has universeDomain', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); - const universeDomain = client.universeDomain; - assert.strictEqual(universeDomain, "googleapis.com"); - }); + it('has universeDomain', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); + const universeDomain = client.universeDomain; + assert.strictEqual(universeDomain, 'googleapis.com'); + }); - if (typeof process === 'object' && typeof process.emitWarning === 'function') { - it('throws DeprecationWarning if static servicePath is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const servicePath = sqlusersserviceModule.v1beta4.SqlUsersServiceClient.servicePath; - assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); + if ( + typeof process === 'object' && + typeof process.emitWarning === 'function' + ) { + it('throws DeprecationWarning if static servicePath is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const servicePath = + sqlusersserviceModule.v1beta4.SqlUsersServiceClient.servicePath; + assert.strictEqual(servicePath, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); - it('throws DeprecationWarning if static apiEndpoint is used', () => { - const stub = sinon.stub(process, 'emitWarning'); - const apiEndpoint = sqlusersserviceModule.v1beta4.SqlUsersServiceClient.apiEndpoint; - assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); - assert(stub.called); - stub.restore(); - }); - } - it('sets apiEndpoint according to universe domain camelCase', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({universeDomain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('throws DeprecationWarning if static apiEndpoint is used', () => { + const stub = sinon.stub(process, 'emitWarning'); + const apiEndpoint = + sqlusersserviceModule.v1beta4.SqlUsersServiceClient.apiEndpoint; + assert.strictEqual(apiEndpoint, 'sqladmin.googleapis.com'); + assert(stub.called); + stub.restore(); + }); + } + it('sets apiEndpoint according to universe domain camelCase', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + universeDomain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - it('sets apiEndpoint according to universe domain snakeCase', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({universe_domain: 'example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - }); + it('sets apiEndpoint according to universe domain snakeCase', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + universe_domain: 'example.com', + }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + }); - if (typeof process === 'object' && 'env' in process) { - describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { - it('sets apiEndpoint from environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + if (typeof process === 'object' && 'env' in process) { + describe('GOOGLE_CLOUD_UNIVERSE_DOMAIN environment variable', () => { + it('sets apiEndpoint from environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } + }); - it('value configured in code has priority over environment variable', () => { - const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({universeDomain: 'configured.example.com'}); - const servicePath = client.apiEndpoint; - assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); - if (saved) { - process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; - } else { - delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; - } - }); + it('value configured in code has priority over environment variable', () => { + const saved = process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = 'example.com'; + const client = + new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + universeDomain: 'configured.example.com', }); - } - it('does not allow setting both universeDomain and universe_domain', () => { - assert.throws(() => { new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); }); + const servicePath = client.apiEndpoint; + assert.strictEqual(servicePath, 'sqladmin.configured.example.com'); + if (saved) { + process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] = saved; + } else { + delete process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']; + } }); - - it('has port', () => { - const port = sqlusersserviceModule.v1beta4.SqlUsersServiceClient.port; - assert(port); - assert(typeof port === 'number'); + }); + } + it('does not allow setting both universeDomain and universe_domain', () => { + assert.throws(() => { + new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + universe_domain: 'example.com', + universeDomain: 'example.net', }); + }); + }); - it('should create a client with no option', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); - assert(client); - }); + it('has port', () => { + const port = sqlusersserviceModule.v1beta4.SqlUsersServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); - it('should create a client with gRPC fallback', () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - fallback: true, - }); - assert(client); - }); + it('should create a client with no option', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient(); + assert(client); + }); - it('has initialize method and supports deferred initialization', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlUsersServiceStub, undefined); - await client.initialize(); - assert(client.sqlUsersServiceStub); - }); + it('should create a client with gRPC fallback', () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + fallback: true, + }); + assert(client); + }); - it('has close method for the initialized client', done => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize().catch(err => {throw err}); - assert(client.sqlUsersServiceStub); - client.close().then(() => { - done(); - }).catch(err => {throw err}); - }); + it('has initialize method and supports deferred initialization', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlUsersServiceStub, undefined); + await client.initialize(); + assert(client.sqlUsersServiceStub); + }); - it('has close method for the non-initialized client', done => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.sqlUsersServiceStub, undefined); - client.close().then(() => { - done(); - }).catch(err => {throw err}); + it('has close method for the initialized client', (done) => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.initialize().catch((err) => { + throw err; + }); + assert(client.sqlUsersServiceStub); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); - const result = await client.getProjectId(); - assert.strictEqual(result, fakeProjectId); - assert((client.auth.getProjectId as SinonStub).calledWithExactly()); + it('has close method for the non-initialized client', (done) => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + assert.strictEqual(client.sqlUsersServiceStub, undefined); + client + .close() + .then(() => { + done(); + }) + .catch((err) => { + throw err; }); + }); - it('has getProjectId method with callback', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.auth.getProjectId = sinon.stub().callsArgWith(0, null, fakeProjectId); - const promise = new Promise((resolve, reject) => { - client.getProjectId((err?: Error|null, projectId?: string|null) => { - if (err) { - reject(err); - } else { - resolve(projectId); - } - }); - }); - const result = await promise; - assert.strictEqual(result, fakeProjectId); - }); + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon.stub().resolves(fakeProjectId); + const result = await client.getProjectId(); + assert.strictEqual(result, fakeProjectId); + assert((client.auth.getProjectId as SinonStub).calledWithExactly()); }); - describe('delete', () => { - it('invokes delete without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.delete = stubSimpleCall(expectedResponse); - const [response] = await client.delete(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + it('has getProjectId method with callback', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + client.auth.getProjectId = sinon + .stub() + .callsArgWith(0, null, fakeProjectId); + const promise = new Promise((resolve, reject) => { + client.getProjectId((err?: Error | null, projectId?: string | null) => { + if (err) { + reject(err); + } else { + resolve(projectId); + } }); + }); + const result = await promise; + assert.strictEqual(result, fakeProjectId); + }); + }); - it('invokes delete without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.delete = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.delete( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('delete', () => { + it('invokes delete without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = stubSimpleCall(expectedResponse); + const [response] = await client.delete(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.delete(request), expectedError); - const actualRequest = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.delete as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes delete without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.delete = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.delete( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes delete with closed client', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.delete(request), expectedError); - }); + it('invokes delete with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.delete = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.delete(request), expectedError); + const actualRequest = (client.innerApiCalls.delete as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.delete as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('get', () => { - it('invokes get without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&name=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.User() - ); - client.innerApiCalls.get = stubSimpleCall(expectedResponse); - const [response] = await client.get(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes delete with closed client', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersDeleteRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersDeleteRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.delete(request), expectedError); + }); + }); - it('invokes get without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&name=${defaultValue3 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.User() - ); - client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.get( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IUser|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('get', () => { + it('invokes get without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.User(), + ); + client.innerApiCalls.get = stubSimpleCall(expectedResponse); + const [response] = await client.get(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['name']); - request.name = defaultValue3; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }&name=${defaultValue3 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.get(request), expectedError); - const actualRequest = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.get as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes get without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.User(), + ); + client.innerApiCalls.get = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.get( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IUser | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes get with closed client', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['instance']); - request.instance = defaultValue2; - const defaultValue3 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersGetRequest', ['name']); - request.name = defaultValue3; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.get(request), expectedError); - }); + it('invokes get with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}&name=${defaultValue3 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.get = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.get(request), expectedError); + const actualRequest = (client.innerApiCalls.get as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.get as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('insert', () => { - it('invokes insert without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.insert = stubSimpleCall(expectedResponse); - const [response] = await client.insert(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes get with closed client', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersGetRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['instance'], + ); + request.instance = defaultValue2; + const defaultValue3 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersGetRequest', + ['name'], + ); + request.name = defaultValue3; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.get(request), expectedError); + }); + }); - it('invokes insert without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.insert = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.insert( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('insert', () => { + it('invokes insert without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = stubSimpleCall(expectedResponse); + const [response] = await client.insert(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.insert(request), expectedError); - const actualRequest = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.insert as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes insert without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.insert = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.insert( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes insert with closed client', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersInsertRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersInsertRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.insert(request), expectedError); - }); + it('invokes insert with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.insert = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.insert(request), expectedError); + const actualRequest = (client.innerApiCalls.insert as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.insert as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('list', () => { - it('invokes list without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UsersListResponse() - ); - client.innerApiCalls.list = stubSimpleCall(expectedResponse); - const [response] = await client.list(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes insert with closed client', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersInsertRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersInsertRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.insert(request), expectedError); + }); + }); - it('invokes list without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.UsersListResponse() - ); - client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.list( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IUsersListResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('list', () => { + it('invokes list without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UsersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCall(expectedResponse); + const [response] = await client.list(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersListRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.list(request), expectedError); - const actualRequest = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.list as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.UsersListResponse(), + ); + client.innerApiCalls.list = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.list( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IUsersListResponse | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes list with closed client', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersListRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersListRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersListRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.list(request), expectedError); - }); + it('invokes list with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.list = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.list(request), expectedError); + const actualRequest = (client.innerApiCalls.list as SinonStub).getCall(0) + .args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.list as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('update', () => { - it('invokes update without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.update = stubSimpleCall(expectedResponse); - const [response] = await client.update(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes list with closed client', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersListRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersListRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.list(request), expectedError); + }); + }); - it('invokes update without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.Operation() - ); - client.innerApiCalls.update = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.update( - request, - (err?: Error|null, result?: protos.google.cloud.sql.v1beta4.IOperation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + describe('update', () => { + it('invokes update without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = stubSimpleCall(expectedResponse); + const [response] = await client.update(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedHeaderRequestParams = `project=${defaultValue1 ?? '' }&instance=${defaultValue2 ?? '' }`; - const expectedError = new Error('expected'); - client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.update(request), expectedError); - const actualRequest = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.update as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); + it('invokes update without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.Operation(), + ); + client.innerApiCalls.update = + stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.update( + request, + ( + err?: Error | null, + result?: protos.google.cloud.sql.v1beta4.IOperation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); - it('invokes update with closed client', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', ['project']); - request.project = defaultValue1; - const defaultValue2 = - getTypeDefaultValue('.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', ['instance']); - request.instance = defaultValue2; - const expectedError = new Error('The client has already been closed.'); - client.close().catch(err => {throw err}); - await assert.rejects(client.update(request), expectedError); - }); + it('invokes update with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedHeaderRequestParams = `project=${defaultValue1 ?? ''}&instance=${defaultValue2 ?? ''}`; + const expectedError = new Error('expected'); + client.innerApiCalls.update = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.update(request), expectedError); + const actualRequest = (client.innerApiCalls.update as SinonStub).getCall( + 0, + ).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = ( + client.innerApiCalls.update as SinonStub + ).getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); + + it('invokes update with closed client', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.sql.v1beta4.SqlUsersUpdateRequest(), + ); + const defaultValue1 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['project'], + ); + request.project = defaultValue1; + const defaultValue2 = getTypeDefaultValue( + '.google.cloud.sql.v1beta4.SqlUsersUpdateRequest', + ['instance'], + ); + request.instance = defaultValue2; + const expectedError = new Error('The client has already been closed.'); + client.close().catch((err) => { + throw err; + }); + await assert.rejects(client.update(request), expectedError); }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + it('invokes getLocation without error using callback', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ); + client.locationsClient.getLocation = sinon + .stub() + .callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null, + ) => { + if (err) { + reject(err); + } else { + resolve(result); } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); + }, + ); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub).getCall(0)); }); + it('invokes getLocation with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall( + undefined, + expectedError, + ); + await assert.rejects( + client.getLocation(request, expectedOptions), + expectedError, + ); + assert( + (client.locationsClient.getLocation as SinonStub) + .getCall(0) + .calledWith(request, expectedOptions, undefined), + ); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location(), + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest(), + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = + stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ).getCall(0).args[1], + request, + ); + assert( + ( + client.locationsClient.descriptors.page.listLocations + .asyncIterate as SinonStub + ) + .getCall(0) + .args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams, + ), + ); + }); + }); - describe('Path templates', () => { - - describe('backup', async () => { - const fakePath = "/rendered/path/backup"; - const expectedParameters = { - project: "projectValue", - backup: "backupValue", - }; - const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - await client.initialize(); - client.pathTemplates.backupPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.backupPathTemplate.match = - sinon.stub().returns(expectedParameters); + describe('Path templates', () => { + describe('backup', async () => { + const fakePath = '/rendered/path/backup'; + const expectedParameters = { + project: 'projectValue', + backup: 'backupValue', + }; + const client = new sqlusersserviceModule.v1beta4.SqlUsersServiceClient({ + credentials: { client_email: 'bogus', private_key: 'bogus' }, + projectId: 'bogus', + }); + await client.initialize(); + client.pathTemplates.backupPathTemplate.render = sinon + .stub() + .returns(fakePath); + client.pathTemplates.backupPathTemplate.match = sinon + .stub() + .returns(expectedParameters); - it('backupPath', () => { - const result = client.backupPath("projectValue", "backupValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.backupPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); + it('backupPath', () => { + const result = client.backupPath('projectValue', 'backupValue'); + assert.strictEqual(result, fakePath); + assert( + (client.pathTemplates.backupPathTemplate.render as SinonStub) + .getCall(-1) + .calledWith(expectedParameters), + ); + }); - it('matchProjectFromBackupName', () => { - const result = client.matchProjectFromBackupName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); + it('matchProjectFromBackupName', () => { + const result = client.matchProjectFromBackupName(fakePath); + assert.strictEqual(result, 'projectValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); - it('matchBackupFromBackupName', () => { - const result = client.matchBackupFromBackupName(fakePath); - assert.strictEqual(result, "backupValue"); - assert((client.pathTemplates.backupPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); + it('matchBackupFromBackupName', () => { + const result = client.matchBackupFromBackupName(fakePath); + assert.strictEqual(result, 'backupValue'); + assert( + (client.pathTemplates.backupPathTemplate.match as SinonStub) + .getCall(-1) + .calledWith(fakePath), + ); + }); }); + }); }); diff --git a/packages/google-cloud-sql/webpack.config.js b/packages/google-cloud-sql/webpack.config.js index 6968d355a69c..07dc78031d41 100644 --- a/packages/google-cloud-sql/webpack.config.js +++ b/packages/google-cloud-sql/webpack.config.js @@ -1,4 +1,4 @@ -// Copyright 2026 Google LLC +// Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License.